Skip to content
This repository has been archived by the owner on Jan 26, 2019. It is now read-only.

Commit

Permalink
Start work on #175
Browse files Browse the repository at this point in the history
  • Loading branch information
robotia committed Mar 4, 2016
1 parent c96d171 commit 4a5c3b2
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ public class CauldronConfig extends ConfigBase

public final BoolSetting remapPluginFile = new BoolSetting(this, "plugin-settings.default.remap-plugin-file", false, "Remap the plugin file (dev)");

// Dynamic view distance settings
public final IntSetting decreaseVD = new IntSetting(this, "optimized.view-distance.trigger-decrease-player-count", 30, "When to trigger the view distance decrease (default view-distance between this and increase trigger)");
public final IntSetting increaseVD = new IntSetting(this, "optimized.view-distance.trigger-increase-player-count", 15, "When to trigger the view distance increase (default view-distance between this and decrease trigger)");
public final IntSetting lowerVD = new IntSetting(this, "optimized.view-distance.lower-view-distance", 6, "What the lower view distance should be");
public final IntSetting upperVD = new IntSetting(this, "optimized.view-distance.upper-view-distance", 10, "What the upper view distance should be");
public final BoolSetting dynamicVD = new BoolSetting(this, "optimized.view-distance.enabled", false, "Use dynamic view distance?");
/* ======================================================================== */

public CauldronConfig(String fileName, String commandName)
Expand Down Expand Up @@ -120,6 +126,11 @@ public void init()
settings.put(redstoneTorchL.path, redstoneTorchL);
settings.put(protectSP.path, protectSP);
settings.put(realNames.path, realNames);
settings.put(dynamicVD.path, dynamicVD);
settings.put(increaseVD.path, increaseVD);
settings.put(decreaseVD.path, decreaseVD);
settings.put(lowerVD.path, lowerVD);
settings.put(upperVD.path, upperVD);
load();
}

Expand Down
15 changes: 2 additions & 13 deletions src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public boolean isPlayerNotUsingContainer(net.minecraft.entity.player.EntityPlaye
this.inventoryItemStacks.clear();
this.inventorySlots.clear();
if (typeChanged) {
setupSlots(top, bottom, entityhuman.openContainer);
setupSlots(top, bottom);
}
int size = getSize();
player.getHandle().playerNetServerHandler.sendPacket(new net.minecraft.network.play.server.S2DPacketOpenWindow(this.windowId, type, cachedTitle, size, true));
Expand Down Expand Up @@ -127,7 +127,7 @@ public static int getNotchInventoryType(InventoryType type) {
return typeID;
}

private void setupSlots(net.minecraft.inventory.IInventory top, net.minecraft.inventory.IInventory bottom, Container ... openContainer) {
private void setupSlots(net.minecraft.inventory.IInventory top, net.minecraft.inventory.IInventory bottom) {
switch(cachedType) {
case CREATIVE:
break; // TODO: This should be an error?
Expand All @@ -154,20 +154,9 @@ private void setupSlots(net.minecraft.inventory.IInventory top, net.minecraft.in
case HOPPER:
setupHopper(top, bottom);
break;
default: // Thermos handle setup for custom inventories
if(openContainer.length > 0)
setupCustomInventory(top, bottom, openContainer[0]);
break;
}
}

private void setupCustomInventory(net.minecraft.inventory.IInventory top, net.minecraft.inventory.IInventory bottom, Container openContainer) {
for (Slot s : openContainer.inventorySlots)
{
this.addSlotToContainer(s);
}
}

private void setupChest(net.minecraft.inventory.IInventory top, net.minecraft.inventory.IInventory bottom) {
int rows = top.getSizeInventory() / 9;
int row;
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/thermos/thermite/ThermiteDynamicViewDistance.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package thermos.thermite;

public class ThermiteDynamicViewDistance {
static net.minecraftforge.cauldron.configuration.CauldronConfig config;
static net.minecraft.server.MinecraftServer server;
static
{
config = net.minecraftforge.cauldron.configuration.CauldronConfig.instance;
server = net.minecraft.server.MinecraftServer.getServer();
}
public static void checkAndUpdate(int size) {

}

}

0 comments on commit 4a5c3b2

Please sign in to comment.