further fixes in filler, for #1513
This commit is contained in:
parent
664004a9d9
commit
1a00a81731
2 changed files with 17 additions and 16 deletions
|
@ -34,15 +34,17 @@ import buildcraft.core.TileBuildCraft;
|
|||
import buildcraft.core.blueprints.BptBuilderTemplate;
|
||||
import buildcraft.core.blueprints.BptContext;
|
||||
import buildcraft.core.inventory.SimpleInventory;
|
||||
import buildcraft.core.network.IGuiReturnHandler;
|
||||
import buildcraft.core.network.PacketPayload;
|
||||
import buildcraft.core.network.PacketPayloadStream;
|
||||
import buildcraft.core.network.PacketUpdate;
|
||||
import buildcraft.core.network.RPC;
|
||||
import buildcraft.core.network.RPCHandler;
|
||||
import buildcraft.core.network.RPCSide;
|
||||
import buildcraft.core.triggers.ActionMachineControl;
|
||||
import buildcraft.core.triggers.ActionMachineControl.Mode;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
public class TileFiller extends TileBuildCraft implements IBuilderInventory, IMachine, IActionReceptor, IGuiReturnHandler, IBoxProvider {
|
||||
public class TileFiller extends TileBuildCraft implements IBuilderInventory, IMachine, IActionReceptor, IBoxProvider {
|
||||
|
||||
public IFillerPattern currentPattern = PatternFill.INSTANCE;
|
||||
|
||||
|
@ -238,6 +240,7 @@ public class TileFiller extends TileBuildCraft implements IBuilderInventory, IMa
|
|||
public void setPattern(IFillerPattern pattern) {
|
||||
if (pattern != null && currentPattern != pattern) {
|
||||
currentPattern = pattern;
|
||||
currentTemplate = null;
|
||||
done = false;
|
||||
sendNetworkUpdate();
|
||||
}
|
||||
|
@ -323,14 +326,13 @@ public class TileFiller extends TileBuildCraft implements IBuilderInventory, IMa
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeGuiData(ByteBuf data) {
|
||||
Utils.writeUTF(data, currentPattern.getUniqueTag());
|
||||
public void rpcSetPatternFromString (String name) {
|
||||
RPCHandler.rpcServer(this, "setPatternFromString", name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readGuiData(ByteBuf data, EntityPlayer player) {
|
||||
setPattern(FillerManager.registry.getPattern(Utils.readUTF(data)));
|
||||
@RPC (RPCSide.SERVER)
|
||||
public void setPatternFromString (String name) {
|
||||
setPattern(FillerManager.registry.getPattern(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
*/
|
||||
package buildcraft.builders.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import buildcraft.api.filler.FillerManager;
|
||||
import buildcraft.builders.TileFiller;
|
||||
import buildcraft.core.DefaultProps;
|
||||
|
@ -15,11 +18,7 @@ import buildcraft.core.gui.GuiBuildCraft;
|
|||
import buildcraft.core.gui.GuiTools;
|
||||
import buildcraft.core.gui.buttons.GuiBetterButton;
|
||||
import buildcraft.core.gui.buttons.StandardButtonTextureSets;
|
||||
import buildcraft.core.network.PacketGuiReturn;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GuiFiller extends GuiBuildCraft {
|
||||
|
||||
|
@ -50,13 +49,13 @@ public class GuiFiller extends GuiBuildCraft {
|
|||
protected void actionPerformed(GuiButton button) {
|
||||
super.actionPerformed(button);
|
||||
|
||||
if (button.id == 0)
|
||||
if (button.id == 0) {
|
||||
filler.currentPattern = FillerManager.registry.getPreviousPattern(filler.currentPattern);
|
||||
if (button.id == 1)
|
||||
} else if (button.id == 1) {
|
||||
filler.currentPattern = FillerManager.registry.getNextPattern(filler.currentPattern);
|
||||
}
|
||||
|
||||
PacketGuiReturn pkt = new PacketGuiReturn(filler);
|
||||
pkt.sendPacket();
|
||||
filler.rpcSetPatternFromString(filler.currentPattern.getUniqueTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue