more compilation fixes for 1.7.2
This commit is contained in:
parent
6b36051353
commit
36a9ef91e5
78 changed files with 412 additions and 302 deletions
|
@ -239,12 +239,12 @@ public class BuildCraftBuilders extends BuildCraftMod {
|
|||
fillerLifespanNormal = fillerLifespanNormalProp.getInt(DefaultProps.FILLER_LIFESPAN_NORMAL);
|
||||
|
||||
templateItem = new ItemBptTemplate();
|
||||
templateItem.setBlockName("templateItem");
|
||||
templateItem.setUnlocalizedName("templateItem");
|
||||
LanguageRegistry.addName(templateItem, "Template");
|
||||
CoreProxy.proxy.registerItem(templateItem);
|
||||
|
||||
blueprintItem = new ItemBptBluePrint();
|
||||
blueprintItem.setBlockName("blueprintItem");
|
||||
blueprintItem.setUnlocalizedName("blueprintItem");
|
||||
LanguageRegistry.addName(blueprintItem, "Blueprint");
|
||||
CoreProxy.proxy.registerItem(blueprintItem);
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ public class BuildCraftCore extends BuildCraftMod {
|
|||
longFactor.comment = "delay between full client sync packets, increasing it saves bandwidth, decreasing makes for better client syncronization.";
|
||||
longUpdateFactor = longFactor.getInt(40);
|
||||
|
||||
wrenchItem = (new ItemWrench()).setBlockName("wrenchItem");
|
||||
wrenchItem = (new ItemWrench()).setUnlocalizedName("wrenchItem");
|
||||
LanguageRegistry.addName(wrenchItem, "Wrench");
|
||||
CoreProxy.proxy.registerItem(wrenchItem);
|
||||
|
||||
|
@ -226,27 +226,27 @@ public class BuildCraftCore extends BuildCraftMod {
|
|||
consumeWaterSources = consumeWater.getBoolean(consumeWaterSources);
|
||||
consumeWater.comment = "set to true if the Pump should consume water";
|
||||
|
||||
woodenGearItem = (new ItemBuildCraft()).setBlockName("woodenGearItem");
|
||||
woodenGearItem = (new ItemBuildCraft()).setUnlocalizedName("woodenGearItem");
|
||||
LanguageRegistry.addName(woodenGearItem, "Wooden Gear");
|
||||
CoreProxy.proxy.registerItem(woodenGearItem);
|
||||
OreDictionary.registerOre("gearWood", new ItemStack(woodenGearItem));
|
||||
|
||||
stoneGearItem = (new ItemBuildCraft()).setBlockName("stoneGearItem");
|
||||
stoneGearItem = (new ItemBuildCraft()).setUnlocalizedName("stoneGearItem");
|
||||
LanguageRegistry.addName(stoneGearItem, "Stone Gear");
|
||||
CoreProxy.proxy.registerItem(stoneGearItem);
|
||||
OreDictionary.registerOre("gearStone", new ItemStack(stoneGearItem));
|
||||
|
||||
ironGearItem = (new ItemBuildCraft()).setBlockName("ironGearItem");
|
||||
ironGearItem = (new ItemBuildCraft()).setUnlocalizedName("ironGearItem");
|
||||
LanguageRegistry.addName(ironGearItem, "Iron Gear");
|
||||
CoreProxy.proxy.registerItem(ironGearItem);
|
||||
OreDictionary.registerOre("gearIron", new ItemStack(ironGearItem));
|
||||
|
||||
goldGearItem = (new ItemBuildCraft()).setBlockName("goldGearItem");
|
||||
goldGearItem = (new ItemBuildCraft()).setUnlocalizedName("goldGearItem");
|
||||
LanguageRegistry.addName(goldGearItem, "Gold Gear");
|
||||
CoreProxy.proxy.registerItem(goldGearItem);
|
||||
OreDictionary.registerOre("gearGold", new ItemStack(goldGearItem));
|
||||
|
||||
diamondGearItem = (new ItemBuildCraft()).setBlockName("diamondGearItem");
|
||||
diamondGearItem = (new ItemBuildCraft()).setUnlocalizedName("diamondGearItem");
|
||||
LanguageRegistry.addName(diamondGearItem, "Diamond Gear");
|
||||
CoreProxy.proxy.registerItem(diamondGearItem);
|
||||
OreDictionary.registerOre("gearDiamond", new ItemStack(diamondGearItem));
|
||||
|
|
|
@ -81,7 +81,7 @@ public class BuildCraftSilicon extends BuildCraftMod {
|
|||
LanguageRegistry.addName(new ItemStack(assemblyTableBlock, 0, 2), "Integration Table");
|
||||
|
||||
redstoneChipset = new ItemRedstoneChipset();
|
||||
redstoneChipset.setBlockName("redstoneChipset");
|
||||
redstoneChipset.setUnlocalizedName("redstoneChipset");
|
||||
CoreProxy.proxy.registerItem(redstoneChipset);
|
||||
redstoneChipset.registerItemStacks();
|
||||
}
|
||||
|
|
|
@ -45,7 +45,6 @@ import buildcraft.transport.ItemPipeWire;
|
|||
import buildcraft.transport.gates.GateExpansionRedstoneFader;
|
||||
import buildcraft.transport.gates.GateExpansionTimer;
|
||||
import buildcraft.transport.network.PacketHandlerTransport;
|
||||
import buildcraft.transport.network.TransportConnectionHandler;
|
||||
import buildcraft.transport.pipes.PipeFluidsCobblestone;
|
||||
import buildcraft.transport.pipes.PipeFluidsEmerald;
|
||||
import buildcraft.transport.pipes.PipeFluidsGold;
|
||||
|
@ -319,7 +318,7 @@ public class BuildCraftTransport extends BuildCraftMod {
|
|||
CoreProxy.proxy.registerItem(pipeGate);
|
||||
|
||||
facadeItem = new ItemFacade();
|
||||
facadeItem.setBlockName("pipeFacade");
|
||||
facadeItem.setUnlocalizedName("pipeFacade");
|
||||
CoreProxy.proxy.registerItem(facadeItem);
|
||||
|
||||
plugItem = new ItemPlug();
|
||||
|
@ -445,7 +444,7 @@ public class BuildCraftTransport extends BuildCraftMod {
|
|||
String name = Character.toLowerCase(clas.getSimpleName().charAt(0)) + clas.getSimpleName().substring(1);
|
||||
|
||||
ItemPipe res = BlockGenericPipe.registerPipe(clas);
|
||||
res.setBlockName(clas.getSimpleName());
|
||||
res.setUnlocalizedName(clas.getSimpleName());
|
||||
LanguageRegistry.addName(res, descr);
|
||||
|
||||
// Add appropriate recipe to temporary list
|
||||
|
|
|
@ -111,7 +111,8 @@ public class BlockArchitect extends BlockContainer {
|
|||
}
|
||||
|
||||
@SuppressWarnings({ "all" })
|
||||
public IIcon getBlockTexture(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
int m = iblockaccess.getBlockMetadata(i, j, k);
|
||||
|
||||
if (l == 1)
|
||||
|
|
|
@ -46,7 +46,7 @@ public class BlockBlueprintLibrary extends BlockContainer {
|
|||
|
||||
TileBlueprintLibrary tile = (TileBlueprintLibrary) world.getTileEntity(i, j, k);
|
||||
|
||||
if (!tile.locked || entityplayer.username.equals(tile.owner))
|
||||
if (!tile.locked || entityplayer.getDisplayName().equals(tile.owner))
|
||||
if (!CoreProxy.proxy.isRenderWorld(world)) {
|
||||
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.BLUEPRINT_LIBRARY, world, i, j, k);
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public class BlockBlueprintLibrary extends BlockContainer {
|
|||
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityliving, ItemStack stack) {
|
||||
if (CoreProxy.proxy.isSimulating(world) && entityliving instanceof EntityPlayer) {
|
||||
TileBlueprintLibrary tile = (TileBlueprintLibrary) world.getTileEntity(i, j, k);
|
||||
tile.owner = ((EntityPlayer) entityliving).username;
|
||||
tile.owner = ((EntityPlayer) entityliving).getDisplayName();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ public class BlockFiller extends BlockContainer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IIcon getBlockTexture(IBlockAccess world, int x, int y, int z, int side) {
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
int m = world.getBlockMetadata(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
|
|
|
@ -43,13 +43,13 @@ public class BlockPathMarker extends BlockMarker {
|
|||
|
||||
@SuppressWarnings({ "all" })
|
||||
// @Override (client only)
|
||||
public IIcon getBlockTexture(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
public IIcon getIcon(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
TilePathMarker marker = (TilePathMarker) iblockaccess.getTileEntity(i, j, k);
|
||||
|
||||
if (l == 1 || (marker != null && marker.tryingToConnect))
|
||||
return activeMarker;
|
||||
else
|
||||
return super.getBlockTexture(iblockaccess, i, j, k, l);
|
||||
return super.getIcon(iblockaccess, i, j, k, l);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -138,7 +138,7 @@ public class TileArchitect extends TileBuildCraft implements IInventory {
|
|||
|
||||
BptBase result = new BptTemplate(box.sizeX(), box.sizeY(), box.sizeZ());
|
||||
|
||||
for (int x = box.xMin; x <= box.xMax; ++x) {
|
||||
/*for (int x = box.xMin; x <= box.xMax; ++x) {
|
||||
for (int y = box.yMin; y <= box.yMax; ++y) {
|
||||
for (int z = box.zMin; z <= box.zMax; ++z) {
|
||||
if (!worldObj.isAirBlock(x, y, z)) {
|
||||
|
@ -148,7 +148,7 @@ public class TileArchitect extends TileBuildCraft implements IInventory {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -260,10 +260,10 @@ public class TileArchitect extends TileBuildCraft implements IInventory {
|
|||
box.initialize(nbttagcompound.getCompoundTag("box"));
|
||||
}
|
||||
|
||||
NBTTagList nbttaglist = nbttagcompound.getTagList("Items");
|
||||
NBTTagList nbttaglist = nbttagcompound.getTagList("Items", Utils.NBTTag_Types.NBTTagCompound.ordinal());
|
||||
items = new ItemStack[getSizeInventory()];
|
||||
for (int i = 0; i < nbttaglist.tagCount(); i++) {
|
||||
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.tagAt(i);
|
||||
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
|
||||
int j = nbttagcompound1.getByte("Slot") & 0xff;
|
||||
if (j >= 0 && j < items.length) {
|
||||
items[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
|
||||
|
|
|
@ -456,10 +456,10 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP
|
|||
|
||||
if (nbttagcompound.hasKey("path")) {
|
||||
path = new LinkedList<BlockIndex>();
|
||||
NBTTagList list = nbttagcompound.getTagList("path");
|
||||
NBTTagList list = nbttagcompound.getTagList("path", Utils.NBTTag_Types.NBTTagCompound.ordinal());
|
||||
|
||||
for (int i = 0; i < list.tagCount(); ++i) {
|
||||
path.add(new BlockIndex((NBTTagCompound) list.tagAt(i)));
|
||||
path.add(new BlockIndex(list.getCompoundTagAt(i)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ import buildcraft.core.proxy.CoreProxy;
|
|||
import buildcraft.core.triggers.ActionMachineControl;
|
||||
import buildcraft.core.triggers.ActionMachineControl.Mode;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
|
@ -246,21 +247,21 @@ public class TileFiller extends TileBuildCraft implements IInventory, IPowerRece
|
|||
public PacketPayload getPacketPayload() {
|
||||
PacketPayloadStream payload = new PacketPayloadStream(new PacketPayloadStream.StreamWriter() {
|
||||
@Override
|
||||
public void writeData(DataOutputStream data) throws IOException {
|
||||
public void writeData(ByteBuf data) {
|
||||
box.writeToStream(data);
|
||||
data.writeBoolean(done);
|
||||
data.writeUTF(currentPattern.getUniqueTag());
|
||||
Utils.writeUTF(data, currentPattern.getUniqueTag());
|
||||
}
|
||||
});
|
||||
|
||||
return payload;
|
||||
}
|
||||
|
||||
public void handlePacketPayload(DataInputStream data) throws IOException {
|
||||
public void handlePacketPayload(ByteBuf data) {
|
||||
boolean initialized = box.isInitialized();
|
||||
box.readFromStream(data);
|
||||
done = data.readBoolean();
|
||||
setPattern(FillerManager.registry.getPattern(data.readUTF()));
|
||||
setPattern(FillerManager.registry.getPattern(Utils.readUTF(data)));
|
||||
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
if (!initialized && box.isInitialized()) {
|
||||
|
@ -331,13 +332,13 @@ public class TileFiller extends TileBuildCraft implements IInventory, IPowerRece
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeGuiData(DataOutputStream data) throws IOException {
|
||||
data.writeUTF(currentPattern.getUniqueTag());
|
||||
public void writeGuiData(ByteBuf data) {
|
||||
Utils.writeUTF(data, currentPattern.getUniqueTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readGuiData(DataInputStream data, EntityPlayer player) throws IOException {
|
||||
setPattern(FillerManager.registry.getPattern(data.readUTF()));
|
||||
public void readGuiData(ByteBuf data, EntityPlayer player) {
|
||||
setPattern(FillerManager.registry.getPattern(Utils.readUTF(data)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -41,7 +41,7 @@ public class GuiBlueprintLibrary extends GuiBuildCraft {
|
|||
this.library = library;
|
||||
container = (ContainerBlueprintLibrary) inventorySlots;
|
||||
|
||||
index = BuildCraftBuilders.getPlayerIndex(player.username);
|
||||
index = BuildCraftBuilders.getPlayerIndex(player.getDisplayName());
|
||||
}
|
||||
private GuiButton nextPageButton;
|
||||
private GuiButton prevPageButton;
|
||||
|
|
|
@ -9,9 +9,7 @@ import buildcraft.core.network.PacketIds;
|
|||
import buildcraft.core.network.PacketPayloadArrays;
|
||||
import buildcraft.core.network.PacketUpdate;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import cpw.mods.fml.common.network.IPacketHandler;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
|
@ -20,8 +18,6 @@ import java.io.DataInputStream;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.network.INetHandler;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.Packet250CustomPayload;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class PacketHandlerBuilders extends BuildCraftChannelHandler {
|
||||
|
|
|
@ -14,11 +14,14 @@ import buildcraft.api.core.Position;
|
|||
import buildcraft.core.network.TileNetworkData;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -225,7 +228,7 @@ public class Box implements IBox {
|
|||
}
|
||||
}
|
||||
|
||||
public void writeToStream(DataOutputStream stream) throws IOException {
|
||||
public void writeToStream(ByteBuf stream) {
|
||||
stream.writeBoolean(initialized);
|
||||
|
||||
stream.writeInt(xMin);
|
||||
|
@ -237,7 +240,7 @@ public class Box implements IBox {
|
|||
stream.writeInt(zMax);
|
||||
}
|
||||
|
||||
public void readFromStream(DataInputStream stream) throws IOException {
|
||||
public void readFromStream(ByteBuf stream) {
|
||||
initialized = stream.readBoolean();
|
||||
|
||||
xMin = stream.readInt();
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
package buildcraft.core;
|
||||
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.command.WrongUsageException;
|
||||
import net.minecraft.util.ChatMessageComponent;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
|
||||
public class CommandBuildCraft extends CommandBase {
|
||||
|
||||
|
@ -46,9 +48,9 @@ public class CommandBuildCraft extends CommandBase {
|
|||
commandVersion(sender, arguments);
|
||||
return;
|
||||
} else if (arguments[0].matches("help")) {
|
||||
sender.sendChatToPlayer(ChatMessageComponent.createFromText("Format: '" + this.getCommandName() + " <command> <arguments>'"));
|
||||
sender.sendChatToPlayer(ChatMessageComponent.createFromText("Available commands:"));
|
||||
sender.sendChatToPlayer(ChatMessageComponent.createFromText("- version : Version information."));
|
||||
sender.addChatMessage(new ChatComponentText("Format: '" + this.getCommandName() + " <command> <arguments>'"));
|
||||
sender.addChatMessage(new ChatComponentText("Available commands:"));
|
||||
sender.addChatMessage(new ChatComponentText("- version : Version information."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -58,11 +60,11 @@ public class CommandBuildCraft extends CommandBase {
|
|||
private void commandVersion(ICommandSender sender, String[] arguments) {
|
||||
String colour = Version.isOutdated() ? "\u00A7c" : "\u00A7a";
|
||||
|
||||
sender.sendChatToPlayer(ChatMessageComponent.createFromText(String.format(colour + "BuildCraft %s for Minecraft %s (Latest: %s).", Version.getVersion(),
|
||||
sender.addChatMessage(new ChatComponentText(String.format(colour + "BuildCraft %s for Minecraft %s (Latest: %s).", Version.getVersion(),
|
||||
CoreProxy.proxy.getMinecraftVersion(), Version.getRecommendedVersion())));
|
||||
if (Version.isOutdated()) {
|
||||
for (String updateLine : Version.getChangelog()) {
|
||||
sender.sendChatToPlayer(ChatMessageComponent.createFromText("\u00A79" + updateLine));
|
||||
sender.addChatMessage(new ChatComponentText("\u00A79" + updateLine));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package buildcraft.core;
|
||||
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemBlockBuildCraft extends ItemBlock {
|
||||
|
||||
public ItemBlockBuildCraft() {
|
||||
super();
|
||||
public ItemBlockBuildCraft(Block b) {
|
||||
super(b);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,7 +17,7 @@ public class ItemBlockBuildCraft extends ItemBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getItemDisplayName(ItemStack itemstack) {
|
||||
public String getItemStackDisplayName(ItemStack itemstack) {
|
||||
return StringUtils.localize(getUnlocalizedName(itemstack));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,14 +26,14 @@ public class ItemBuildCraft extends Item {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getItemDisplayName(ItemStack itemstack) {
|
||||
public String getItemStackDisplayName(ItemStack itemstack) {
|
||||
return StringUtils.localize(getUnlocalizedName(itemstack));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item setBlockName(String par1Str) {
|
||||
public Item setUnlocalizedName(String par1Str) {
|
||||
iconName = par1Str;
|
||||
return super.setBlockName(par1Str);
|
||||
return super.setUnlocalizedName(par1Str);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,12 +10,15 @@
|
|||
package buildcraft.core;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemSpring extends ItemBlockBuildCraft {
|
||||
|
||||
public ItemSpring(int i) {
|
||||
super(i);
|
||||
public ItemSpring(Block block) {
|
||||
super(block);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class FluidUtils {
|
|||
if (used > 0) {
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, InvUtils.consumeItem(current));
|
||||
player.inventory.onInventoryChanged();
|
||||
player.inventory.markDirty();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -55,11 +55,11 @@ public class FluidUtils {
|
|||
if (!player.inventory.addItemStackToInventory(filled))
|
||||
return false;
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, InvUtils.consumeItem(current));
|
||||
player.inventory.onInventoryChanged();
|
||||
player.inventory.markDirty();
|
||||
} else {
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, InvUtils.consumeItem(current));
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, filled);
|
||||
player.inventory.onInventoryChanged();
|
||||
player.inventory.markDirty();
|
||||
}
|
||||
|
||||
tank.drain(side, liquid.amount, true);
|
||||
|
|
|
@ -48,7 +48,7 @@ public class Tank extends FluidTank {
|
|||
NBTTagCompound tankData = new NBTTagCompound();
|
||||
super.writeToNBT(tankData);
|
||||
writeTankToNBT(tankData);
|
||||
nbt.setCompoundTag(name, tankData);
|
||||
nbt.setTag(name, tankData);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,6 @@ import buildcraft.core.gui.slots.SlotBase;
|
|||
import buildcraft.core.gui.widgets.Widget;
|
||||
import buildcraft.core.inventory.StackHelper;
|
||||
import buildcraft.core.network.PacketGuiWidget;
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
|
|
@ -27,7 +27,7 @@ public abstract class GuiAdvancedInterface extends GuiBuildCraft {
|
|||
|
||||
public String getDescription() {
|
||||
if (getItemStack() != null)
|
||||
return getItemStack().getItem().getItemDisplayName(getItemStack());
|
||||
return getItemStack().getItem().getItemStackDisplayName(getItemStack());
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package buildcraft.core.inventory;
|
|||
import buildcraft.core.inventory.InventoryIterator.IInvSlot;
|
||||
import buildcraft.core.inventory.filters.ArrayStackFilter;
|
||||
import buildcraft.core.inventory.filters.IStackFilter;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryLargeChest;
|
||||
|
@ -124,19 +125,19 @@ public class InvUtils {
|
|||
public static NBTTagCompound getItemData(ItemStack stack) {
|
||||
NBTTagCompound nbt = stack.getTagCompound();
|
||||
if (nbt == null) {
|
||||
nbt = new NBTTagCompound("tag");
|
||||
nbt = new NBTTagCompound();
|
||||
stack.setTagCompound(nbt);
|
||||
}
|
||||
return nbt;
|
||||
}
|
||||
|
||||
public static void addItemToolTip(ItemStack stack, String tag, String msg) {
|
||||
public static void addItemToolTip(ItemStack stack, String msg) {
|
||||
NBTTagCompound nbt = getItemData(stack);
|
||||
NBTTagCompound display = nbt.getCompoundTag("display");
|
||||
nbt.setCompoundTag("display", display);
|
||||
NBTTagList lore = display.getTagList("Lore");
|
||||
nbt.setTag("display", display);
|
||||
NBTTagList lore = display.getTagList("Lore", Utils.NBTTag_Types.NBTTagString.ordinal());
|
||||
display.setTag("Lore", lore);
|
||||
lore.appendTag(new NBTTagString(tag, msg));
|
||||
lore.appendTag(new NBTTagString(msg));
|
||||
}
|
||||
|
||||
public static void writeInvToNBT(IInventory inv, String tag, NBTTagCompound data) {
|
||||
|
@ -154,9 +155,9 @@ public class InvUtils {
|
|||
}
|
||||
|
||||
public static void readInvFromNBT(IInventory inv, String tag, NBTTagCompound data) {
|
||||
NBTTagList list = data.getTagList(tag);
|
||||
NBTTagList list = data.getTagList(tag, Utils.NBTTag_Types.NBTTagCompound.ordinal());
|
||||
for (byte entry = 0; entry < list.tagCount(); entry++) {
|
||||
NBTTagCompound itemTag = (NBTTagCompound) list.tagAt(entry);
|
||||
NBTTagCompound itemTag = list.getCompoundTagAt(entry);
|
||||
int slot = itemTag.getByte("Slot");
|
||||
if (slot >= 0 && slot < inv.getSizeInventory()) {
|
||||
ItemStack stack = ItemStack.loadItemStackFromNBT(itemTag);
|
||||
|
@ -166,11 +167,11 @@ public class InvUtils {
|
|||
}
|
||||
|
||||
public static void readStacksFromNBT(NBTTagCompound nbt, String name, ItemStack[] stacks) {
|
||||
NBTTagList nbttaglist = nbt.getTagList(name);
|
||||
NBTTagList nbttaglist = nbt.getTagList(name, Utils.NBTTag_Types.NBTTagCompound.ordinal());
|
||||
|
||||
for (int i = 0; i < stacks.length; ++i) {
|
||||
if (i < nbttaglist.tagCount()) {
|
||||
NBTTagCompound nbttagcompound2 = (NBTTagCompound) nbttaglist.tagAt(i);
|
||||
NBTTagCompound nbttagcompound2 = nbttaglist.getCompoundTagAt(i);
|
||||
|
||||
stacks[i] = ItemStack.loadItemStackFromNBT(nbttagcompound2);
|
||||
} else {
|
||||
|
|
|
@ -69,20 +69,11 @@ public class InventoryConcatenator implements IInventory {
|
|||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvNameLocalized() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInventoryChanged() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return true;
|
||||
|
@ -100,4 +91,13 @@ public class InventoryConcatenator implements IInventory {
|
|||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
return invMap.get(slot).isItemValidForSlot(slotMap.get(slot), stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,14 +44,12 @@ public class InventoryCopy implements IInventory {
|
|||
if (contents[i].stackSize <= j) {
|
||||
ItemStack itemstack = contents[i];
|
||||
contents[i] = null;
|
||||
onInventoryChanged();
|
||||
return itemstack;
|
||||
}
|
||||
ItemStack itemstack1 = contents[i].splitStack(j);
|
||||
if (contents[i].stackSize <= 0) {
|
||||
contents[i] = null;
|
||||
}
|
||||
onInventoryChanged();
|
||||
return itemstack1;
|
||||
} else {
|
||||
return null;
|
||||
|
@ -64,7 +62,6 @@ public class InventoryCopy implements IInventory {
|
|||
if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) {
|
||||
itemstack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
onInventoryChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -77,10 +74,6 @@ public class InventoryCopy implements IInventory {
|
|||
return orignal.getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInventoryChanged() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return true;
|
||||
|
@ -99,11 +92,6 @@ public class InventoryCopy implements IInventory {
|
|||
return orignal.getStackInSlotOnClosing(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvNameLocalized() {
|
||||
return orignal.isInvNameLocalized();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
return orignal.isItemValidForSlot(slot, stack);
|
||||
|
@ -112,4 +100,14 @@ public class InventoryCopy implements IInventory {
|
|||
public ItemStack[] getItemStacks() {
|
||||
return contents;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,11 +76,6 @@ public class InventoryMapper implements IInventory {
|
|||
return stackSizeLimit > 0 ? stackSizeLimit : inv.getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInventoryChanged() {
|
||||
inv.onInventoryChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return inv.isUseableByPlayer(entityplayer);
|
||||
|
@ -101,11 +96,6 @@ public class InventoryMapper implements IInventory {
|
|||
return inv.getStackInSlotOnClosing(start + slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvNameLocalized() {
|
||||
return inv.isInvNameLocalized();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
if (checkItems) {
|
||||
|
@ -113,4 +103,14 @@ public class InventoryMapper implements IInventory {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return inv.hasCustomInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
inv.markDirty();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public abstract class InventoryWrapper implements ISidedInventory {
|
|||
@Override public String getInventoryName() { return inventory.getInventoryName(); }
|
||||
@Override public boolean isInvNameLocalized() { return inventory.isInvNameLocalized(); }
|
||||
@Override public int getInventoryStackLimit() { return inventory.getInventoryStackLimit(); }
|
||||
@Override public void onInventoryChanged() { inventory.onInventoryChanged(); }
|
||||
@Override public void markDirty() { inventory.markDirty(); }
|
||||
@Override public boolean isUseableByPlayer(EntityPlayer entityplayer) { return inventory.isUseableByPlayer(entityplayer); }
|
||||
@Override public void openInventory() { inventory.openInventory(); }
|
||||
@Override public void closeInventory() { inventory.closeInventory(); }
|
||||
|
|
|
@ -28,4 +28,13 @@ public class InventoryWrapperSimple extends InventoryWrapper {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,10 @@
|
|||
package buildcraft.core.inventory;
|
||||
|
||||
import buildcraft.core.utils.INBTTagable;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -44,7 +47,7 @@ public class SimpleInventory implements IInventory, INBTTagable {
|
|||
if (slotId < _contents.length && _contents[slotId] != null) {
|
||||
if (_contents[slotId].stackSize > count) {
|
||||
ItemStack result = _contents[slotId].splitStack(count);
|
||||
onInventoryChanged();
|
||||
markDirty();
|
||||
return result;
|
||||
}
|
||||
ItemStack stack = _contents[slotId];
|
||||
|
@ -64,7 +67,7 @@ public class SimpleInventory implements IInventory, INBTTagable {
|
|||
if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()) {
|
||||
itemstack.stackSize = this.getInventoryStackLimit();
|
||||
}
|
||||
onInventoryChanged();
|
||||
markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -77,13 +80,6 @@ public class SimpleInventory implements IInventory, INBTTagable {
|
|||
return _stackLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInventoryChanged() {
|
||||
for (TileEntity handler : _listener) {
|
||||
handler.onInventoryChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return true;
|
||||
|
@ -103,10 +99,10 @@ public class SimpleInventory implements IInventory, INBTTagable {
|
|||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound data, String tag) {
|
||||
NBTTagList nbttaglist = data.getTagList(tag);
|
||||
NBTTagList nbttaglist = data.getTagList(tag, Utils.NBTTag_Types.NBTTagCompound.ordinal());
|
||||
|
||||
for (int j = 0; j < nbttaglist.tagCount(); ++j) {
|
||||
NBTTagCompound slot = (NBTTagCompound) nbttaglist.tagAt(j);
|
||||
NBTTagCompound slot = nbttaglist.getCompoundTagAt(j);
|
||||
int index;
|
||||
if (slot.hasKey("index")) {
|
||||
index = slot.getInteger("index");
|
||||
|
@ -157,12 +153,19 @@ public class SimpleInventory implements IInventory, INBTTagable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvNameLocalized() {
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return true;
|
||||
public void markDirty() {
|
||||
for (TileEntity handler : _listener) {
|
||||
handler.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public class TransactorSimple extends Transactor {
|
|||
injected = tryPut(stack, filledSlots, injected, doAdd);
|
||||
injected = tryPut(stack, emptySlots, injected, doAdd);
|
||||
|
||||
inventory.onInventoryChanged();
|
||||
inventory.markDirty();
|
||||
return injected;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package buildcraft.core.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
@ -17,7 +19,7 @@ public interface IClientState {
|
|||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public void writeData(DataOutputStream data) throws IOException;
|
||||
public void writeData(ByteBuf data);
|
||||
|
||||
/**
|
||||
* Deserializes the state from the stream
|
||||
|
@ -25,5 +27,5 @@ public interface IClientState {
|
|||
* @param data
|
||||
* @throws IOException
|
||||
*/
|
||||
public void readData(DataInputStream data) throws IOException;
|
||||
public void readData(ByteBuf data);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package buildcraft.core.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
@ -14,7 +16,7 @@ import net.minecraft.world.World;
|
|||
public abstract interface IGuiReturnHandler {
|
||||
public World getWorld();
|
||||
|
||||
public void writeGuiData(DataOutputStream data) throws IOException;
|
||||
public void writeGuiData(ByteBuf data);
|
||||
|
||||
public void readGuiData(DataInputStream data, EntityPlayer player) throws IOException;
|
||||
public void readGuiData(ByteBuf data, EntityPlayer player);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -39,6 +38,7 @@ public class PacketGuiReturn extends BuildCraftPacket {
|
|||
@Override
|
||||
public void writeData(ByteBuf data) {
|
||||
data.writeInt(obj.getWorld().provider.dimensionId);
|
||||
|
||||
if (obj instanceof TileEntity) {
|
||||
TileEntity tile = (TileEntity) obj;
|
||||
data.writeBoolean(true);
|
||||
|
@ -49,11 +49,15 @@ public class PacketGuiReturn extends BuildCraftPacket {
|
|||
Entity entity = (Entity) obj;
|
||||
data.writeBoolean(false);
|
||||
data.writeInt(entity.getEntityId());
|
||||
} else
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
obj.writeGuiData(data);
|
||||
if (extraData != null)
|
||||
data.write(extraData);
|
||||
|
||||
if (extraData != null) {
|
||||
data.writeBytes(extraData);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -61,6 +65,7 @@ public class PacketGuiReturn extends BuildCraftPacket {
|
|||
int dim = data.readInt();
|
||||
World world = DimensionManager.getWorld(dim);
|
||||
boolean tileReturn = data.readBoolean();
|
||||
|
||||
if (tileReturn) {
|
||||
int x = data.readInt();
|
||||
int y = data.readInt();
|
||||
|
@ -68,15 +73,16 @@ public class PacketGuiReturn extends BuildCraftPacket {
|
|||
|
||||
TileEntity t = world.getTileEntity(x, y, z);
|
||||
|
||||
if (t instanceof IGuiReturnHandler)
|
||||
if (t instanceof IGuiReturnHandler) {
|
||||
((IGuiReturnHandler) t).readGuiData(data, sender);
|
||||
|
||||
}
|
||||
} else {
|
||||
int entityId = data.readInt();
|
||||
Entity entity = world.getEntityByID(entityId);
|
||||
|
||||
if (entity instanceof IGuiReturnHandler)
|
||||
if (entity instanceof IGuiReturnHandler) {
|
||||
((IGuiReturnHandler) entity).readGuiData(data, sender);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,9 +26,14 @@ public class PacketNBT extends PacketCoordinates {
|
|||
|
||||
super.writeData(data);
|
||||
|
||||
byte[] compressed = CompressedStreamTools.compress(nbttagcompound);
|
||||
data.writeShort(compressed.length);
|
||||
data.write(compressed);
|
||||
try {
|
||||
byte[] compressed = CompressedStreamTools.compress(nbttagcompound);
|
||||
data.writeShort(compressed.length);
|
||||
data.writeBytes(compressed);
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,8 +43,14 @@ public class PacketNBT extends PacketCoordinates {
|
|||
|
||||
short length = data.readShort();
|
||||
byte[] compressed = new byte[length];
|
||||
data.readFully(compressed);
|
||||
this.nbttagcompound = CompressedStreamTools.decompress(compressed);
|
||||
data.readBytes(compressed);
|
||||
|
||||
try {
|
||||
this.nbttagcompound = CompressedStreamTools.decompress(compressed);
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public NBTTagCompound getTagCompound() {
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.io.DataInputStream;
|
|||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
|
||||
|
@ -30,7 +31,7 @@ public class PacketSlotChange extends PacketCoordinates {
|
|||
|
||||
data.writeInt(slot);
|
||||
if (stack != null) {
|
||||
data.writeInt(stack.itemID);
|
||||
data.writeInt(Item.itemRegistry.getIDForObject(stack.getItem()));
|
||||
data.writeInt(stack.stackSize);
|
||||
data.writeInt(stack.getItemDamage());
|
||||
|
||||
|
@ -56,7 +57,8 @@ public class PacketSlotChange extends PacketCoordinates {
|
|||
int id = data.readInt();
|
||||
|
||||
if (id != 0) {
|
||||
stack = new ItemStack(id, data.readInt(), data.readInt());
|
||||
Item item = Item.getItemById(id);
|
||||
stack = new ItemStack(item, data.readInt(), data.readInt());
|
||||
|
||||
// Yes, this stuff may indeed have NBT and don't you forget it.
|
||||
short length = data.readShort();
|
||||
|
|
|
@ -49,7 +49,7 @@ public class PacketTileState extends PacketCoordinates {
|
|||
super.readData(data);
|
||||
}
|
||||
|
||||
public void applyStates(DataInputStream data, ISyncedTile tile) throws IOException {
|
||||
public void applyStates(ByteBuf data, ISyncedTile tile) throws IOException {
|
||||
byte stateCount = data.readByte();
|
||||
for (int i = 0; i < stateCount; i++) {
|
||||
byte stateId = data.readByte();
|
||||
|
|
|
@ -34,7 +34,6 @@ public class PacketUpdate extends BuildCraftPacket {
|
|||
public PacketUpdate(int packetId) {
|
||||
this.packetId = packetId;
|
||||
this.isChunkDataPacket = true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -34,7 +34,6 @@ import net.minecraft.network.INetHandler;
|
|||
import net.minecraft.network.NetHandlerPlayServer;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatMessageComponent;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
|
@ -73,7 +72,7 @@ public class CoreProxy {
|
|||
|
||||
/* ENTITY HANDLING */
|
||||
public void removeEntity(Entity entity) {
|
||||
entity.getWorldObj().removeEntity(entity);
|
||||
entity.worldObj.removeEntity(entity);
|
||||
}
|
||||
|
||||
/* WRAPPER */
|
||||
|
|
|
@ -44,7 +44,6 @@ import net.minecraft.network.INetHandler;
|
|||
import net.minecraft.network.NetHandlerPlayServer;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatMessageComponent;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -141,7 +140,7 @@ public class CoreProxyClient extends CoreProxy {
|
|||
/* BUILDCRAFT PLAYER */
|
||||
@Override
|
||||
public String playerName() {
|
||||
return FMLClientHandler.instance().getClient().thePlayer.username;
|
||||
return FMLClientHandler.instance().getClient().thePlayer.getDisplayName();
|
||||
}
|
||||
|
||||
private EntityPlayer createNewPlayer(World world) {
|
||||
|
|
|
@ -125,7 +125,7 @@ public class RenderingMarkers implements ISimpleBlockRenderingHandler {
|
|||
int yCoord = (int) y;
|
||||
int zCoord = (int) z;
|
||||
|
||||
IIcon i = block.getBlockTexture(iblockaccess, xCoord, yCoord, zCoord, 1);
|
||||
IIcon i = block.getIcon(iblockaccess, xCoord, yCoord, zCoord, 1);
|
||||
|
||||
int m = metaToOld[meta];
|
||||
x += 0.5D;
|
||||
|
@ -173,7 +173,7 @@ public class RenderingMarkers implements ISimpleBlockRenderingHandler {
|
|||
tessellator.addVertexWithUV(x - s, y + 0.5 - s, z - s, minU, minV);
|
||||
}
|
||||
|
||||
i = block.getBlockTexture(iblockaccess, xCoord, yCoord, zCoord, 0);
|
||||
i = block.getIcon(iblockaccess, xCoord, yCoord, zCoord, 0);
|
||||
|
||||
minU = i.getMinU();
|
||||
maxU = i.getMaxU();
|
||||
|
|
|
@ -5,8 +5,8 @@ import buildcraft.api.gates.IAction;
|
|||
import buildcraft.api.gates.IActionProvider;
|
||||
import buildcraft.core.IMachine;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import java.util.LinkedList;
|
||||
import java.util.logging.Level;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
|
@ -29,7 +29,7 @@ public class DefaultActionProvider implements IActionProvider {
|
|||
res.add(BuildCraftCore.actionLoop);
|
||||
}
|
||||
} catch (Throwable error) {
|
||||
FMLLog.log("Buildcraft", Level.SEVERE, "Outdated API detected, please update your mods!");
|
||||
FMLLog.log("Buildcraft", Level.FATAL, "Outdated API detected, please update your mods!");
|
||||
}
|
||||
|
||||
return res;
|
||||
|
|
|
@ -17,13 +17,11 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFluid;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.Packet60Explosion;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -93,7 +91,7 @@ public class BlockUtil {
|
|||
}
|
||||
|
||||
public static boolean canChangeBlock(World world, int x, int y, int z) {
|
||||
return canChangeBlock(world.getBlockId(x, y, z), world, x, y, z);
|
||||
return canChangeBlock(world.getBlock(x, y, z), world, x, y, z);
|
||||
}
|
||||
|
||||
public static boolean canChangeBlock(Block block, World world, int x, int y, int z) {
|
||||
|
|
|
@ -41,8 +41,19 @@ import net.minecraft.entity.EntityLivingBase;
|
|||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryLargeChest;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagByte;
|
||||
import net.minecraft.nbt.NBTTagByteArray;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagDouble;
|
||||
import net.minecraft.nbt.NBTTagEnd;
|
||||
import net.minecraft.nbt.NBTTagFloat;
|
||||
import net.minecraft.nbt.NBTTagInt;
|
||||
import net.minecraft.nbt.NBTTagIntArray;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.NBTTagLong;
|
||||
import net.minecraft.nbt.NBTTagShort;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityChest;
|
||||
|
@ -56,6 +67,13 @@ public class Utils {
|
|||
public static final Random RANDOM = new Random();
|
||||
private static final List<ForgeDirection> directions = new ArrayList<ForgeDirection>(Arrays.asList(ForgeDirection.VALID_DIRECTIONS));
|
||||
|
||||
public enum NBTTag_Types {
|
||||
NBTTagEnd, NBTTagByte, NBTTagShort,
|
||||
NBTTagInt, NBTTagLong, NBTTagFloat,
|
||||
NBTTagDouble, NBTTagByteArray, NBTTagString,
|
||||
NBTTagList, NBTTagCompound, NBTTagIntArray
|
||||
}
|
||||
|
||||
/* IINVENTORY HELPERS */
|
||||
/**
|
||||
* Tries to add the passed stack to any valid inventories around the given
|
||||
|
@ -423,4 +441,47 @@ public class Utils {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeNBT (ByteBuf data, NBTTagCompound nbt) {
|
||||
try {
|
||||
byte[] compressed = CompressedStreamTools.compress(nbt);
|
||||
data.writeShort(compressed.length);
|
||||
data.writeBytes(compressed);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static NBTTagCompound readNBT(ByteBuf data) {
|
||||
try {
|
||||
short length = data.readShort();
|
||||
byte[] compressed = new byte[length];
|
||||
data.readBytes(compressed);
|
||||
return CompressedStreamTools.decompress(compressed);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeStack (ByteBuf data, ItemStack stack) {
|
||||
if (stack == null) {
|
||||
data.writeBoolean(false);
|
||||
} else {
|
||||
data.writeBoolean(true);
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
stack.writeToNBT(nbt);
|
||||
Utils.writeNBT(data, nbt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static ItemStack readStack(ByteBuf data) {
|
||||
if (!data.readBoolean()) {
|
||||
return null;
|
||||
} else {
|
||||
NBTTagCompound nbt = readNBT(data);
|
||||
return ItemStack.loadItemStackFromNBT(nbt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,14 +29,14 @@ public class ItemBucketBuildcraft extends ItemBucket {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getItemDisplayName(ItemStack itemstack) {
|
||||
public String getItemStackDisplayName(ItemStack itemstack) {
|
||||
return StringUtils.localize(getUnlocalizedName(itemstack));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item setBlockName(String par1Str) {
|
||||
public Item setUnlocalizedName(String par1Str) {
|
||||
iconName = par1Str;
|
||||
return super.setBlockName(par1Str);
|
||||
return super.setUnlocalizedName(par1Str);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,12 +10,13 @@
|
|||
package buildcraft.energy;
|
||||
|
||||
import buildcraft.core.ItemBlockBuildCraft;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemEngine extends ItemBlockBuildCraft {
|
||||
|
||||
public ItemEngine(int i) {
|
||||
super(i);
|
||||
public ItemEngine(Block block) {
|
||||
super(block);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import buildcraft.energy.TileEngine;
|
|||
import buildcraft.energy.TileEngine.EnergyStage;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
@ -26,6 +26,7 @@ import static net.minecraftforge.common.util.ForgeDirection.NORTH;
|
|||
import static net.minecraftforge.common.util.ForgeDirection.SOUTH;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.UP;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.WEST;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderEngine extends TileEntitySpecialRenderer implements IInventoryRenderer {
|
||||
|
@ -84,7 +85,7 @@ public class RenderEngine extends TileEntitySpecialRenderer implements IInventor
|
|||
public RenderEngine(ResourceLocation baseTexture) {
|
||||
this();
|
||||
this.baseTexture = baseTexture;
|
||||
setTileEntityRenderer(TileEntityRenderer.instance);
|
||||
field_147501_a = TileEntityRendererDispatcher.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,7 +27,6 @@ import static net.minecraftforge.common.BiomeDictionary.Type.DESERT;
|
|||
import static net.minecraftforge.common.BiomeDictionary.Type.FOREST;
|
||||
import static net.minecraftforge.common.BiomeDictionary.Type.FROZEN;
|
||||
import static net.minecraftforge.common.BiomeDictionary.Type.WASTELAND;
|
||||
import net.minecraftforge.common.EnumHelper;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.event.terraingen.PopulateChunkEvent;
|
||||
import net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType;
|
||||
|
@ -280,7 +279,7 @@ public class OilPopulate {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (block.isGenMineableReplaceable(world, x, y, z, Block.stone.blockID)) {
|
||||
if (block.isGenMineableReplaceable(world, x, y, z, Blocks.stone)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public class BlockTank extends BlockContainer {
|
|||
|
||||
@SuppressWarnings({"all"})
|
||||
@Override
|
||||
public IIcon getBlockTexture(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
public IIcon getIcon(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
switch (l) {
|
||||
case 0:
|
||||
case 1:
|
||||
|
|
|
@ -27,8 +27,8 @@ import net.minecraft.inventory.SlotCrafting;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ChatMessageComponent;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileAutoWorkbench extends TileBuildCraft implements ISidedInventory {
|
||||
|
@ -69,9 +69,9 @@ public class TileAutoWorkbench extends TileBuildCraft implements ISidedInventory
|
|||
}
|
||||
|
||||
@Override
|
||||
public void sendChatToPlayer(ChatMessageComponent var1) {
|
||||
public void addChatMessage(IChatComponent var1) {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canCommandSenderUseCommand(int var1, String var2) {
|
||||
return false;
|
||||
|
@ -81,6 +81,8 @@ public class TileAutoWorkbench extends TileBuildCraft implements ISidedInventory
|
|||
public ChunkCoordinates getPlayerCoordinates() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,9 +16,7 @@ import net.minecraft.entity.item.EntityItem;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.Packet3Chat;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChatMessageComponent;
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
|
@ -51,9 +49,6 @@ import buildcraft.core.utils.Utils;
|
|||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
|
||||
public class TileQuarry extends TileBuildCraft implements IMachine, IPowerReceptor, IBuilderInventory {
|
||||
|
||||
public @TileNetworkData
|
||||
|
|
|
@ -40,7 +40,7 @@ public class ContainerAutoWorkbench extends BuildCraftContainer {
|
|||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
super.setInventorySlotContents(slot, stack);
|
||||
if (stack != null && tile.isLast() && CoreProxy.proxy.isRenderWorld(tile.getWorldObj())) {
|
||||
InvUtils.addItemToolTip(stack, "tip", EnumChatFormatting.YELLOW + StringUtils.localize("gui.clickcraft"));
|
||||
InvUtils.addItemToolTip(stack, EnumChatFormatting.YELLOW + StringUtils.localize("gui.clickcraft"));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -7,7 +7,7 @@ import buildcraft.core.IInventoryRenderer;
|
|||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
@ -35,7 +35,7 @@ public class RenderHopper extends TileEntitySpecialRenderer implements IInventor
|
|||
bottom.rotationPointX = 8F;
|
||||
bottom.rotationPointY = 8F;
|
||||
bottom.rotationPointZ = 8F;
|
||||
setTileEntityRenderer(TileEntityRenderer.instance);
|
||||
field_147501_a = TileEntityRendererDispatcher.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,11 +15,12 @@ import buildcraft.core.render.RenderUtils;
|
|||
import buildcraft.factory.TileRefinery;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderRefinery extends TileEntitySpecialRenderer implements IInventoryRenderer {
|
||||
|
@ -51,7 +52,7 @@ public class RenderRefinery extends TileEntitySpecialRenderer implements IInvent
|
|||
|
||||
}
|
||||
|
||||
setTileEntityRenderer(TileEntityRenderer.instance);
|
||||
field_147501_a = TileEntityRendererDispatcher.instance;
|
||||
}
|
||||
|
||||
public RenderRefinery(String baseTexture) {
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
package buildcraft.silicon;
|
||||
|
||||
import buildcraft.core.ItemBlockBuildCraft;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemLaserTable extends ItemBlockBuildCraft {
|
||||
|
||||
public ItemLaserTable(int par1) {
|
||||
super(par1);
|
||||
public ItemLaserTable(Block block) {
|
||||
super(block);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public class SiliconRenderBlock implements ISimpleBlockRenderingHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory() {
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -168,23 +168,4 @@ public class SiliconRenderBlock implements ISimpleBlockRenderingHandler {
|
|||
renderblocks.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, i));
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
/*
|
||||
* @Override public GuiScreen handleGUI(int i) { switch (Utils.intToPacketId(i)) { case AssemblyTableGUI: return new GuiAssemblyTable(
|
||||
* ModLoader.getMinecraftInstance().thePlayer.inventory, new TileAssemblyTable()); default: return null; } }
|
||||
*/
|
||||
|
||||
/*
|
||||
* @Override public void handlePacket(Packet230ModLoader packet) { switch (PacketIds.values()[packet.packetType]) { case AssemblyTableSelect: GuiScreen
|
||||
* screen = ModLoader.getMinecraftInstance().currentScreen;
|
||||
*
|
||||
* if (screen instanceof GuiAssemblyTable) { GuiAssemblyTable gui = (GuiAssemblyTable) screen; SelectionMessage message = new SelectionMessage();
|
||||
*
|
||||
* TileAssemblyTable.selectionMessageWrapper.updateFromPacket(message, packet);
|
||||
*
|
||||
* gui.handleSelectionMessage (message); }
|
||||
*
|
||||
* break; } }
|
||||
*/
|
||||
|
||||
}
|
||||
|
|
|
@ -42,8 +42,8 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatMessageComponent;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.DOWN;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.EAST;
|
||||
|
@ -52,8 +52,6 @@ import static net.minecraftforge.common.util.ForgeDirection.SOUTH;
|
|||
import static net.minecraftforge.common.util.ForgeDirection.WEST;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import org.bouncycastle.util.Arrays;
|
||||
|
||||
public class TileAdvancedCraftingTable extends TileLaserTableBase implements IInventory, ILaserTarget, IMachine, IActionReceptor, ISidedInventory {
|
||||
|
||||
private final class InternalInventoryCraftingContainer extends Container {
|
||||
|
@ -149,7 +147,7 @@ public class TileAdvancedCraftingTable extends TileLaserTableBase implements IIn
|
|||
}
|
||||
|
||||
@Override
|
||||
public void sendChatToPlayer(ChatMessageComponent var1) {
|
||||
public void addChatMessage(IChatComponent var1) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -215,8 +213,8 @@ public class TileAdvancedCraftingTable extends TileLaserTableBase implements IIn
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onInventoryChanged() {
|
||||
super.onInventoryChanged();
|
||||
public void markDirty() {
|
||||
super.markDirty();
|
||||
craftable = craftResult.getStackInSlot(0) != null;
|
||||
}
|
||||
|
||||
|
@ -385,7 +383,7 @@ public class TileAdvancedCraftingTable extends TileLaserTableBase implements IIn
|
|||
currentRecipe = CraftingHelper.findMatchingRecipe(internalInventoryCrafting, worldObj);
|
||||
}
|
||||
internalInventoryCrafting.recipeUpdate(false);
|
||||
onInventoryChanged();
|
||||
markDirty();
|
||||
}
|
||||
|
||||
private void updateRecipeOutputDisplay() {
|
||||
|
@ -400,7 +398,7 @@ public class TileAdvancedCraftingTable extends TileLaserTableBase implements IIn
|
|||
internalInventoryCrafting.recipeUpdate(false);
|
||||
}
|
||||
craftResult.setInventorySlotContents(0, resultStack);
|
||||
onInventoryChanged();
|
||||
markDirty();
|
||||
}
|
||||
|
||||
private ItemStack getRecipeOutput() {
|
||||
|
|
|
@ -129,10 +129,10 @@ public class TileAssemblyTable extends TileLaserTableBase implements IMachine, I
|
|||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
NBTTagList list = nbt.getTagList("planned");
|
||||
NBTTagList list = nbt.getTagList("planned", Utils.NBTTag_Types.NBTTagCompound.ordinal());
|
||||
|
||||
for (int i = 0; i < list.tagCount(); ++i) {
|
||||
NBTTagCompound cpt = (NBTTagCompound) list.tagAt(i);
|
||||
NBTTagCompound cpt = list.getCompoundTagAt(i);
|
||||
|
||||
ItemStack stack = ItemStack.loadItemStackFromNBT(cpt);
|
||||
|
||||
|
|
|
@ -943,7 +943,7 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
|||
|
||||
public static ItemPipe registerPipe(Class<? extends Pipe> clas) {
|
||||
ItemPipe item = new ItemPipe();
|
||||
item.setBlockName("buildcraftPipe." + clas.getSimpleName().toLowerCase(Locale.ENGLISH));
|
||||
item.setUnlocalizedName("buildcraftPipe." + clas.getSimpleName().toLowerCase(Locale.ENGLISH));
|
||||
GameRegistry.registerItem(item, item.getUnlocalizedName());
|
||||
|
||||
pipes.put(item, clas);
|
||||
|
|
|
@ -71,7 +71,7 @@ public class ItemPipe extends ItemBuildCraft implements IItemPipe {
|
|||
}
|
||||
|
||||
if (world.canPlaceEntityOnSide(block, i, j, k, false, side, entityplayer, itemstack)) {
|
||||
Pipe pipe = BlockGenericPipe.createPipe(itemID);
|
||||
Pipe pipe = BlockGenericPipe.createPipe(this);
|
||||
|
||||
if (pipe == null) {
|
||||
BCLog.logger.log(Level.WARNING, "Pipe failed to create during placement at {0},{1},{2}", new Object[]{i, j, k});
|
||||
|
@ -128,7 +128,7 @@ public class ItemPipe extends ItemBuildCraft implements IItemPipe {
|
|||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) {
|
||||
super.addInformation(stack, player, list, advanced);
|
||||
Class<? extends Pipe> pipe = BlockGenericPipe.pipes.get(itemID);
|
||||
Class<? extends Pipe> pipe = BlockGenericPipe.pipes.get(this);
|
||||
List<String> toolTip = PipeToolTipManager.getToolTip(pipe);
|
||||
list.addAll(toolTip);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public class ItemPipeWire extends ItemBuildCraft {
|
|||
setHasSubtypes(true);
|
||||
setMaxDamage(0);
|
||||
setPassSneakClick(true);
|
||||
setBlockName("pipeWire");
|
||||
setUnlocalizedName("pipeWire");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,9 +7,12 @@ import buildcraft.transport.utils.TextureMatrix;
|
|||
import buildcraft.transport.utils.WireMatrix;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class PipeRenderState implements IClientState {
|
||||
|
@ -72,7 +75,7 @@ public class PipeRenderState implements IClientState {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeData(DataOutputStream data) throws IOException {
|
||||
public void writeData(ByteBuf data) {
|
||||
data.writeBoolean(isGateLit);
|
||||
data.writeBoolean(isGatePulsing);
|
||||
data.writeInt(gateIconIndex);
|
||||
|
@ -84,7 +87,7 @@ public class PipeRenderState implements IClientState {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readData(DataInputStream data) throws IOException {
|
||||
public void readData(ByteBuf data) {
|
||||
isGateLit = data.readBoolean();
|
||||
isGatePulsing = data.readBoolean();
|
||||
gateIconIndex = data.readInt();
|
||||
|
|
|
@ -18,16 +18,18 @@ import buildcraft.core.inventory.Transactor;
|
|||
import buildcraft.core.utils.BCLog;
|
||||
import buildcraft.core.utils.BlockUtil;
|
||||
import buildcraft.core.utils.MathUtils;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import buildcraft.transport.network.PacketPipeTransportItemStackRequest;
|
||||
import buildcraft.transport.network.PacketPipeTransportTraveler;
|
||||
import buildcraft.transport.pipes.events.PipeEventItem;
|
||||
import buildcraft.transport.utils.TransportUtils;
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -370,11 +372,11 @@ public class PipeTransportItems extends PipeTransport {
|
|||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
NBTTagList nbttaglist = nbt.getTagList("travelingEntities");
|
||||
NBTTagList nbttaglist = nbt.getTagList("travelingEntities", Utils.NBTTag_Types.NBTTagCompound.ordinal());
|
||||
|
||||
for (int j = 0; j < nbttaglist.tagCount(); ++j) {
|
||||
try {
|
||||
NBTTagCompound dataTag = (NBTTagCompound) nbttaglist.tagAt(j);
|
||||
NBTTagCompound dataTag = nbttaglist.getCompoundTagAt(j);
|
||||
|
||||
TravelingItem item = TravelingItem.make(dataTag);
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
package buildcraft.transport;
|
||||
|
||||
import buildcraft.api.transport.PipeWire;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
@ -16,6 +18,7 @@ import java.util.logging.Level;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.Packet;
|
||||
|
@ -55,9 +58,10 @@ import buildcraft.transport.gates.GateDefinition;
|
|||
import buildcraft.transport.gates.GateFactory;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import net.minecraft.server.management.PlayerInstance;
|
||||
|
||||
import net.minecraft.world.WorldServer;
|
||||
|
||||
public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFluidHandler, IPipeTile, IOverrideDefaultTriggers, ITileBufferHolder,
|
||||
|
@ -71,7 +75,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
|||
public final Set<Byte> expansions = new HashSet<Byte>();
|
||||
|
||||
@Override
|
||||
public void writeData(DataOutputStream data) throws IOException {
|
||||
public void writeData(ByteBuf data) {
|
||||
data.writeInt(pipeId);
|
||||
data.writeByte(gateMaterial);
|
||||
data.writeByte(gateLogic);
|
||||
|
@ -82,7 +86,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readData(DataInputStream data) throws IOException {
|
||||
public void readData(ByteBuf data) {
|
||||
pipeId = data.readInt();
|
||||
gateMaterial = data.readByte();
|
||||
gateLogic = data.readByte();
|
||||
|
@ -106,7 +110,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
|||
private boolean pipeBound = false;
|
||||
private boolean resyncGateExpansions = false;
|
||||
public int redstoneInput = 0;
|
||||
private Block[] facadeBlocks = new int[ForgeDirection.VALID_DIRECTIONS.length];
|
||||
private Block[] facadeBlocks = new Block[ForgeDirection.VALID_DIRECTIONS.length];
|
||||
private int[] facadeMeta = new int[ForgeDirection.VALID_DIRECTIONS.length];
|
||||
private boolean[] plugs = new boolean[ForgeDirection.VALID_DIRECTIONS.length];
|
||||
|
||||
|
@ -119,13 +123,13 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
|||
nbt.setByte("redstoneInput", (byte)redstoneInput);
|
||||
|
||||
if (pipe != null) {
|
||||
nbt.setInteger("pipeId", pipe.itemID);
|
||||
nbt.setInteger("pipeId", Item.itemRegistry.getIDForObject(pipe.item));
|
||||
pipe.writeToNBT(nbt);
|
||||
} else
|
||||
nbt.setInteger("pipeId", coreState.pipeId);
|
||||
|
||||
for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
|
||||
nbt.setInteger("facadeBlocks[" + i + "]", facadeBlocks[i]);
|
||||
nbt.setInteger("facadeBlocks[" + i + "]", Block.blockRegistry.getIDForObject(facadeBlocks[i]));
|
||||
nbt.setInteger("facadeMeta[" + i + "]", facadeMeta[i]);
|
||||
nbt.setBoolean("plug[" + i + "]", plugs[i]);
|
||||
}
|
||||
|
@ -138,7 +142,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
|||
redstoneInput = nbt.getByte("redstoneInput");
|
||||
|
||||
coreState.pipeId = nbt.getInteger("pipeId");
|
||||
pipe = BlockGenericPipe.createPipe(coreState.pipeId);
|
||||
pipe = BlockGenericPipe.createPipe((Item) Item.itemRegistry.getObjectById(coreState.pipeId));
|
||||
bindPipe();
|
||||
|
||||
if (pipe != null)
|
||||
|
@ -149,7 +153,8 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
|||
}
|
||||
|
||||
for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
|
||||
facadeBlocks[i] = nbt.getInteger("facadeBlocks[" + i + "]");
|
||||
facadeBlocks[i] = (Block) Block.blockRegistry.getObjectById(nbt
|
||||
.getInteger("facadeBlocks[" + i + "]"));
|
||||
facadeMeta[i] = nbt.getInteger("facadeMeta[" + i + "]");
|
||||
plugs[i] = nbt.getBoolean("plug[" + i + "]");
|
||||
}
|
||||
|
@ -327,7 +332,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
|||
|
||||
pipe.setTile(this);
|
||||
|
||||
coreState.pipeId = pipe.itemID;
|
||||
coreState.pipeId = Item.getIdFromItem(pipe.item);
|
||||
pipeBound = true;
|
||||
}
|
||||
}
|
||||
|
@ -609,7 +614,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
|||
if (direction == null || direction == ForgeDirection.UNKNOWN)
|
||||
return false;
|
||||
if (this.getWorldObj().isRemote)
|
||||
return renderState.facadeMatrix.getFacadeBlockId(direction) != 0;
|
||||
return renderState.facadeMatrix.getFacadeBlock(direction) != null;
|
||||
return (this.facadeBlocks[direction.ordinal()] != null);
|
||||
}
|
||||
|
||||
|
@ -657,24 +662,28 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
|||
|
||||
switch (stateId) {
|
||||
case 0:
|
||||
if (pipe == null && coreState.pipeId != 0)
|
||||
initialize(BlockGenericPipe.createPipe(coreState.pipeId));
|
||||
if (pipe == null && coreState.pipeId != 0) {
|
||||
initialize(BlockGenericPipe.createPipe((Item) Item.itemRegistry.getObjectById(coreState.pipeId)));
|
||||
}
|
||||
|
||||
if (pipe == null)
|
||||
if (pipe == null) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (coreState.gateMaterial == -1)
|
||||
if (coreState.gateMaterial == -1) {
|
||||
pipe.gate = null;
|
||||
else if (pipe.gate == null)
|
||||
} else if (pipe.gate == null) {
|
||||
pipe.gate = GateFactory.makeGate(pipe, GateDefinition.GateMaterial.fromOrdinal(coreState.gateMaterial), GateDefinition.GateLogic.fromOrdinal(coreState.gateLogic));
|
||||
}
|
||||
|
||||
syncGateExpansions();
|
||||
|
||||
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
|
||||
break;
|
||||
|
||||
case 1: {
|
||||
if (renderState.needsRenderUpdate()) {
|
||||
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
|
||||
renderState.clean();
|
||||
}
|
||||
break;
|
||||
|
@ -765,13 +774,13 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeGuiData(DataOutputStream data) throws IOException {
|
||||
public void writeGuiData(ByteBuf data) {
|
||||
if (BlockGenericPipe.isValid(pipe) && pipe instanceof IGuiReturnHandler)
|
||||
((IGuiReturnHandler) pipe).writeGuiData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readGuiData(DataInputStream data, EntityPlayer sender) throws IOException {
|
||||
public void readGuiData(ByteBuf data, EntityPlayer sender) {
|
||||
if (BlockGenericPipe.isValid(pipe) && pipe instanceof IGuiReturnHandler)
|
||||
((IGuiReturnHandler) pipe).readGuiData(data, sender);
|
||||
}
|
||||
|
|
|
@ -179,7 +179,7 @@ public final class TravelingItem {
|
|||
data.setFloat("speed", getSpeed());
|
||||
NBTTagCompound itemStackTag = new NBTTagCompound();
|
||||
getItemStack().writeToNBT(itemStackTag);
|
||||
data.setCompoundTag("Item", itemStackTag);
|
||||
data.setTag("Item", itemStackTag);
|
||||
|
||||
data.setBoolean("toCenter", toCenter);
|
||||
data.setInteger("input", input.ordinal());
|
||||
|
|
|
@ -11,6 +11,7 @@ package buildcraft.transport.gates;
|
|||
import buildcraft.api.gates.GateExpansionController;
|
||||
import buildcraft.api.gates.GateExpansions;
|
||||
import buildcraft.api.gates.IGateExpansion;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import buildcraft.transport.Gate;
|
||||
import buildcraft.transport.Pipe;
|
||||
import buildcraft.transport.gates.GateDefinition.GateLogic;
|
||||
|
@ -98,9 +99,9 @@ public class GateFactory {
|
|||
gate.expansions.put(GateExpansionPulsar.INSTANCE, pulsarCon);
|
||||
}
|
||||
|
||||
NBTTagList exList = nbt.getTagList("expansions");
|
||||
NBTTagList exList = nbt.getTagList("expansions", Utils.NBTTag_Types.NBTTagCompound.ordinal());
|
||||
for (int i = 0; i < exList.tagCount(); i++) {
|
||||
NBTTagCompound conNBT = (NBTTagCompound) exList.tagAt(i);
|
||||
NBTTagCompound conNBT = exList.getCompoundTagAt(i);
|
||||
IGateExpansion ex = GateExpansions.getExpansion(conNBT.getString("type"));
|
||||
if (ex != null) {
|
||||
GateExpansionController con = ex.makeController(pipe.container);
|
||||
|
|
|
@ -9,19 +9,23 @@ import buildcraft.api.gates.ITrigger;
|
|||
import buildcraft.core.ItemBuildCraft;
|
||||
import buildcraft.core.inventory.InvUtils;
|
||||
import buildcraft.core.utils.Localization;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import buildcraft.transport.Gate;
|
||||
import buildcraft.transport.gates.GateDefinition.GateLogic;
|
||||
import buildcraft.transport.gates.GateDefinition.GateMaterial;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
@ -75,8 +79,8 @@ public class ItemGate extends ItemBuildCraft {
|
|||
NBTTagCompound nbt = getNBT(stack);
|
||||
if (nbt == null)
|
||||
return;
|
||||
NBTTagList expansionList = nbt.getTagList(NBT_TAG_EX);
|
||||
expansionList.appendTag(new NBTTagString("", expansion.getUniqueIdentifier()));
|
||||
NBTTagList expansionList = nbt.getTagList(NBT_TAG_EX, Utils.NBTTag_Types.NBTTagString.ordinal());
|
||||
expansionList.appendTag(new NBTTagString(expansion.getUniqueIdentifier()));
|
||||
nbt.setTag(NBT_TAG_EX, expansionList);
|
||||
}
|
||||
|
||||
|
@ -85,10 +89,10 @@ public class ItemGate extends ItemBuildCraft {
|
|||
if (nbt == null)
|
||||
return false;
|
||||
try {
|
||||
NBTTagList expansionList = nbt.getTagList(NBT_TAG_EX);
|
||||
NBTTagList expansionList = nbt.getTagList(NBT_TAG_EX, Utils.NBTTag_Types.NBTTagString.ordinal());
|
||||
for (int i = 0; i < expansionList.tagCount(); i++) {
|
||||
NBTTagString ex = (NBTTagString) expansionList.tagAt(i);
|
||||
if (ex.data.equals(expansion.getUniqueIdentifier()))
|
||||
String ex = expansionList.getStringTagAt(i);
|
||||
if (ex.equals(expansion.getUniqueIdentifier()))
|
||||
return true;
|
||||
}
|
||||
} catch (RuntimeException error) {
|
||||
|
@ -102,10 +106,10 @@ public class ItemGate extends ItemBuildCraft {
|
|||
if (nbt == null)
|
||||
return expansions;
|
||||
try {
|
||||
NBTTagList expansionList = nbt.getTagList(NBT_TAG_EX);
|
||||
NBTTagList expansionList = nbt.getTagList(NBT_TAG_EX, Utils.NBTTag_Types.NBTTagString.ordinal());
|
||||
for (int i = 0; i < expansionList.tagCount(); i++) {
|
||||
NBTTagString exTag = (NBTTagString) expansionList.tagAt(i);
|
||||
IGateExpansion ex = GateExpansions.getExpansion(exTag.data);
|
||||
String exTag = expansionList.getStringTagAt(i);
|
||||
IGateExpansion ex = GateExpansions.getExpansion(exTag);
|
||||
if (ex != null)
|
||||
expansions.add(ex);
|
||||
}
|
||||
|
@ -141,7 +145,7 @@ public class ItemGate extends ItemBuildCraft {
|
|||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(int id, CreativeTabs tab, List itemList) {
|
||||
public void getSubItems(Item item, CreativeTabs tab, List itemList) {
|
||||
for (GateMaterial material : GateMaterial.VALUES) {
|
||||
for (GateLogic logic : GateLogic.VALUES) {
|
||||
if (material == GateMaterial.REDSTONE && logic == GateLogic.OR)
|
||||
|
|
|
@ -22,8 +22,10 @@ import buildcraft.core.network.PacketPayloadArrays;
|
|||
import buildcraft.core.network.PacketPayloadStream;
|
||||
import buildcraft.core.network.PacketUpdate;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import buildcraft.transport.Pipe;
|
||||
import buildcraft.transport.gates.GateDefinition;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
|
@ -39,6 +41,7 @@ import net.minecraft.inventory.ICrafting;
|
|||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
@ -163,50 +166,47 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
|||
* @param packet
|
||||
*/
|
||||
public void setSelection(PacketUpdate packet, boolean notify) {
|
||||
try {
|
||||
PacketPayloadStream payload = (PacketPayloadStream) packet.payload;
|
||||
DataInputStream data = payload.stream;
|
||||
PacketPayloadStream payload = (PacketPayloadStream) packet.payload;
|
||||
ByteBuf data = payload.stream;
|
||||
|
||||
int position = data.readInt();
|
||||
int position = data.readInt();
|
||||
|
||||
setTrigger(position, ActionManager.triggers.get(data.readUTF()), notify);
|
||||
setAction(position, ActionManager.actions.get(data.readUTF()), notify);
|
||||
setTrigger(position, ActionManager.triggers.get(Utils.readUTF(data)), notify);
|
||||
setAction(position, ActionManager.actions.get(Utils.readUTF(data)), notify);
|
||||
|
||||
ItemStack parameter = Packet.readItemStack(data);
|
||||
if (parameter != null) {
|
||||
ITriggerParameter param = new TriggerParameter();
|
||||
param.set(parameter);
|
||||
setTriggerParameter(position, param, notify);
|
||||
} else {
|
||||
setTriggerParameter(position, null, notify);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
ItemStack parameter = Utils.readStack(data);
|
||||
|
||||
if (parameter != null) {
|
||||
ITriggerParameter param = new TriggerParameter();
|
||||
param.set(parameter);
|
||||
setTriggerParameter(position, param, notify);
|
||||
} else {
|
||||
setTriggerParameter(position, null, notify);
|
||||
}
|
||||
}
|
||||
|
||||
private PacketPayload getSelectionPayload(final int position) {
|
||||
PacketPayloadStream payload = new PacketPayloadStream(new PacketPayloadStream.StreamWriter() {
|
||||
@Override
|
||||
public void writeData(DataOutputStream data) throws IOException {
|
||||
public void writeData(ByteBuf data) {
|
||||
data.writeInt(position);
|
||||
|
||||
if (pipe.gate.triggers[position] != null) {
|
||||
data.writeUTF(pipe.gate.triggers[position].getUniqueTag());
|
||||
Utils.writeUTF(data, pipe.gate.triggers[position].getUniqueTag());
|
||||
} else {
|
||||
data.writeUTF("");
|
||||
Utils.writeUTF(data, "");
|
||||
}
|
||||
|
||||
if (pipe.gate.actions[position] != null) {
|
||||
data.writeUTF(pipe.gate.actions[position].getUniqueTag());
|
||||
Utils.writeUTF(data, pipe.gate.actions[position].getUniqueTag());
|
||||
} else {
|
||||
data.writeUTF("");
|
||||
Utils.writeUTF(data, "");
|
||||
}
|
||||
|
||||
if (pipe.gate.triggerParameters[position] != null && pipe.gate.triggerParameters[position].getItemStack() != null) {
|
||||
Packet.writeItemStack(pipe.gate.triggerParameters[position].getItemStack().copy(), data);
|
||||
Utils.writeStack(data, pipe.gate.triggerParameters[position].getItemStack());
|
||||
} else {
|
||||
Packet.writeItemStack(null, data);
|
||||
Utils.writeStack(data, null);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -2,6 +2,7 @@ package buildcraft.transport.network;
|
|||
|
||||
import buildcraft.core.network.BuildCraftPacket;
|
||||
import buildcraft.core.network.PacketIds;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import buildcraft.transport.TravelingItem;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
|
@ -28,13 +29,13 @@ public class PacketPipeTransportItemStack extends BuildCraftPacket {
|
|||
@Override
|
||||
public void writeData(ByteBuf data) {
|
||||
data.writeInt(entityId);
|
||||
Packet.writeItemStack(stack, data);
|
||||
Utils.writeStack(data, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(ByteBuf data) {
|
||||
this.entityId = data.readInt();
|
||||
stack = Packet.readItemStack(data);
|
||||
stack = Utils.readStack(data);
|
||||
TravelingItem item = TravelingItem.clientCache.get(entityId);
|
||||
if (item != null)
|
||||
item.setItemStack(stack);
|
||||
|
|
|
@ -3,8 +3,6 @@ package buildcraft.transport.network;
|
|||
import buildcraft.core.network.BuildCraftPacket;
|
||||
import buildcraft.core.network.PacketIds;
|
||||
import buildcraft.transport.TravelingItem;
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
package buildcraft.transport.pipes;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import buildcraft.transport.PipeIconProvider;
|
||||
|
||||
/**
|
||||
|
@ -15,8 +16,8 @@ import buildcraft.transport.PipeIconProvider;
|
|||
*/
|
||||
public class PipeFluidsEmerald extends PipeFluidsWood {
|
||||
|
||||
public PipeFluidsEmerald(int itemID) {
|
||||
super(itemID);
|
||||
public PipeFluidsEmerald(Item item) {
|
||||
super(item);
|
||||
|
||||
standardIconIndex = PipeIconProvider.TYPE.PipeFluidsEmerald_Standard.ordinal();
|
||||
solidIconIndex = PipeIconProvider.TYPE.PipeAllEmerald_Solid.ordinal();
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
*/
|
||||
package buildcraft.transport.pipes;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
@ -27,6 +29,7 @@ import buildcraft.core.inventory.SimpleInventory;
|
|||
import buildcraft.core.inventory.StackHelper;
|
||||
import buildcraft.core.network.IClientState;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import buildcraft.transport.BlockGenericPipe;
|
||||
import buildcraft.transport.Pipe;
|
||||
import buildcraft.transport.PipeIconProvider;
|
||||
|
@ -138,17 +141,15 @@ public class PipeItemsDiamond extends Pipe<PipeTransportItems> implements IClien
|
|||
|
||||
// ICLIENTSTATE
|
||||
@Override
|
||||
public void writeData(DataOutputStream data) throws IOException {
|
||||
public void writeData(ByteBuf data) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
writeToNBT(nbt);
|
||||
NBTBase.writeNamedTag(nbt, data);
|
||||
Utils.writeNBT(data, nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(DataInputStream data) throws IOException {
|
||||
NBTBase nbt = NBTBase.readNamedTag(data);
|
||||
if (nbt instanceof NBTTagCompound) {
|
||||
readFromNBT((NBTTagCompound) nbt);
|
||||
}
|
||||
public void readData(ByteBuf data) {
|
||||
NBTTagCompound nbt = Utils.readNBT(data);
|
||||
readFromNBT(nbt);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
*/
|
||||
package buildcraft.transport.pipes;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
@ -14,6 +16,7 @@ import java.io.IOException;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -74,8 +77,8 @@ public class PipeItemsEmerald extends PipeItemsWood implements IClientState, IGu
|
|||
private final SimpleInventory filters = new SimpleInventory(9, "Filters", 1);
|
||||
private int currentFilter = 0;
|
||||
|
||||
public PipeItemsEmerald(int itemID) {
|
||||
super(itemID);
|
||||
public PipeItemsEmerald(Item item) {
|
||||
super(item);
|
||||
|
||||
standardIconIndex = PipeIconProvider.TYPE.PipeItemsEmerald_Standard.ordinal();
|
||||
solidIconIndex = PipeIconProvider.TYPE.PipeAllEmerald_Solid.ordinal();
|
||||
|
@ -245,18 +248,16 @@ public class PipeItemsEmerald extends PipeItemsWood implements IClientState, IGu
|
|||
|
||||
// ICLIENTSTATE
|
||||
@Override
|
||||
public void writeData(DataOutputStream data) throws IOException {
|
||||
public void writeData(ByteBuf data) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
writeToNBT(nbt);
|
||||
NBTBase.writeNamedTag(nbt, data);
|
||||
Utils.writeNBT(data, nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(DataInputStream data) throws IOException {
|
||||
NBTBase nbt = NBTBase.readNamedTag(data);
|
||||
if (nbt instanceof NBTTagCompound) {
|
||||
readFromNBT((NBTTagCompound) nbt);
|
||||
}
|
||||
public void readData(ByteBuf data) {
|
||||
NBTTagCompound nbt = Utils.readNBT(data);
|
||||
readFromNBT(nbt);
|
||||
}
|
||||
|
||||
public IInventory getFilters() {
|
||||
|
@ -268,12 +269,12 @@ public class PipeItemsEmerald extends PipeItemsWood implements IClientState, IGu
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeGuiData(DataOutputStream data) throws IOException {
|
||||
public void writeGuiData(ByteBuf data) {
|
||||
data.writeByte(stateController.getCurrentState());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readGuiData(DataInputStream data, EntityPlayer sender) throws IOException {
|
||||
public void readGuiData(ByteBuf data, EntityPlayer sender) {
|
||||
stateController.setCurrentState(data.readByte());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
*/
|
||||
package buildcraft.transport.pipes;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.BitSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
|
@ -16,6 +18,7 @@ import java.util.Map.Entry;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
@ -32,6 +35,7 @@ import buildcraft.transport.BlockGenericPipe;
|
|||
import buildcraft.transport.PipeIconProvider;
|
||||
import buildcraft.transport.TravelingItem;
|
||||
import buildcraft.transport.triggers.ActionExtractionPreset;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
@ -48,8 +52,8 @@ public class PipeItemsEmzuli extends PipeItemsWood implements IGuiReturnHandler
|
|||
private final int filterCount = filters.getSizeInventory();
|
||||
private int currentFilter = 0;
|
||||
|
||||
public PipeItemsEmzuli(int itemID) {
|
||||
super(itemID);
|
||||
public PipeItemsEmzuli(Item item) {
|
||||
super(item);
|
||||
|
||||
standardIconIndex = PipeIconProvider.TYPE.PipeItemsEmzuli_Standard.ordinal();
|
||||
solidIconIndex = PipeIconProvider.TYPE.PipeAllEmzuli_Solid.ordinal();
|
||||
|
@ -234,11 +238,11 @@ public class PipeItemsEmzuli extends PipeItemsWood implements IGuiReturnHandler
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeGuiData(DataOutputStream paramDataOutputStream) throws IOException {
|
||||
public void writeGuiData(ByteBuf paramDataOutputStream) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readGuiData(DataInputStream data, EntityPlayer paramEntityPlayer) throws IOException {
|
||||
public void readGuiData(ByteBuf data, EntityPlayer paramEntityPlayer) {
|
||||
byte slot = data.readByte();
|
||||
slotColors[slot] = data.readByte();
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ public class PipeItemsWood extends Pipe<PipeTransportItems> implements IPowerRec
|
|||
if (extracted == null)
|
||||
return;
|
||||
|
||||
tile.onInventoryChanged();
|
||||
tile.markDirty();
|
||||
|
||||
for (ItemStack stack : extracted) {
|
||||
if (stack == null || stack.stackSize == 0) {
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package buildcraft.transport.utils;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class ConnectionMatrix {
|
||||
|
@ -39,11 +42,11 @@ public class ConnectionMatrix {
|
|||
dirty = false;
|
||||
}
|
||||
|
||||
public void writeData(DataOutputStream data) throws IOException {
|
||||
public void writeData(ByteBuf data) {
|
||||
data.writeByte(mask);
|
||||
}
|
||||
|
||||
public void readData(DataInputStream data) throws IOException {
|
||||
public void readData(ByteBuf data) {
|
||||
byte newMask = data.readByte();
|
||||
|
||||
if (newMask != mask) {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package buildcraft.transport.utils;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
@ -40,14 +42,14 @@ public class FacadeMatrix {
|
|||
dirty = false;
|
||||
}
|
||||
|
||||
public void writeData(DataOutputStream data) throws IOException {
|
||||
public void writeData(ByteBuf data) {
|
||||
for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
|
||||
data.writeShort(Block.blockRegistry.getIDForObject(_blocks[i]));
|
||||
data.writeByte(_blockMetas[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void readData(DataInputStream data) throws IOException {
|
||||
public void readData(ByteBuf data) {
|
||||
for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
|
||||
short id = data.readShort();
|
||||
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package buildcraft.transport.utils;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TextureMatrix {
|
||||
|
@ -29,13 +32,13 @@ public class TextureMatrix {
|
|||
dirty = false;
|
||||
}
|
||||
|
||||
public void writeData(DataOutputStream data) throws IOException {
|
||||
public void writeData(ByteBuf data) {
|
||||
for (int i = 0; i < _iconIndexes.length; i++) {
|
||||
data.writeByte(_iconIndexes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void readData(DataInputStream data) throws IOException {
|
||||
public void readData(ByteBuf data) {
|
||||
for (int i = 0; i < _iconIndexes.length; i++) {
|
||||
int icon = data.readByte();
|
||||
if (_iconIndexes[i] != icon) {
|
||||
|
|
|
@ -2,10 +2,13 @@ package buildcraft.transport.utils;
|
|||
|
||||
import buildcraft.transport.Pipe;
|
||||
import buildcraft.api.transport.PipeWire;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.BitSet;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class WireMatrix {
|
||||
|
@ -72,7 +75,7 @@ public class WireMatrix {
|
|||
dirty = false;
|
||||
}
|
||||
|
||||
public void writeData(DataOutputStream data) throws IOException {
|
||||
public void writeData(ByteBuf data) {
|
||||
data.writeByte(_bitSetCodec.encode(_hasWire));
|
||||
|
||||
for (int i = 0; i < PipeWire.values().length; i++) {
|
||||
|
@ -81,7 +84,7 @@ public class WireMatrix {
|
|||
}
|
||||
}
|
||||
|
||||
public void readData(DataInputStream data) throws IOException {
|
||||
public void readData(ByteBuf data) {
|
||||
_bitSetCodec.decode(data.readByte(), _hasWire);
|
||||
for (int i = 0; i < PipeWire.values().length; i++) {
|
||||
_wires[i].readData(data);
|
||||
|
|
Loading…
Add table
Reference in a new issue