Merge branch '6.5.x' of github.com:BuildCraft/BuildCraft into 7.1.x

This commit is contained in:
asiekierka 2015-06-30 12:49:29 +02:00
commit 1c73dd18c7
35 changed files with 197 additions and 63 deletions

View file

@ -22,7 +22,7 @@ apply plugin: 'forge' // adds the forge dependency
apply plugin: 'maven' // for uploading to a maven repo apply plugin: 'maven' // for uploading to a maven repo
apply plugin: 'checkstyle' apply plugin: 'checkstyle'
version = "7.0.12" version = "7.0.13"
group= "com.mod-buildcraft" group= "com.mod-buildcraft"
archivesBaseName = "buildcraft" // the name that all artifacts will use as a base. artifacts names follow this pattern: [baseName]-[appendix]-[version]-[classifier].[extension] archivesBaseName = "buildcraft" // the name that all artifacts will use as a base. artifacts names follow this pattern: [baseName]-[appendix]-[version]-[classifier].[extension]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 535 B

After

Width:  |  Height:  |  Size: 517 B

View file

@ -0,0 +1,14 @@
Improvements:
* [#2846] Make Blueprints removable from Construction Markers (asie)
* Code optimizations (asie)
Bugs fixed:
* [#2852] Diamond fluid pipes not sorting into unfiltered slots (asie)
* [#2850] Random ArrayIndexOutOfBoundException (asie - not a true fix, it will however give you a console warning if this is caught again; it's very rare)
* [#2849] Graphical Glitch on Assembly Table when using Texture Packs (asie)
* [#2842] Various fixes to robot state saving (hea3ven)
* [#2835] Robot helmet overlay rendering incorrectly (hea3ven)
* [#2753] Remove unused slot from Packager (asie)
* Crashes in item pipe packet sending (asie)

View file

@ -1,3 +1,3 @@
1.6.4:BuildCraft:4.2.2 1.6.4:BuildCraft:4.2.2
1.7.2:BuildCraft:6.0.16 1.7.2:BuildCraft:6.0.16
1.7.10:BuildCraft:7.0.12 1.7.10:BuildCraft:7.0.13

View file

@ -10,13 +10,15 @@ package buildcraft.builders;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import buildcraft.api.tools.IToolWrench;
import buildcraft.core.lib.utils.BlockUtils;
import buildcraft.core.lib.utils.Utils; import buildcraft.core.lib.utils.Utils;
public class BlockConstructionMarker extends BlockMarker { public class BlockConstructionMarker extends BlockMarker {
@ -31,17 +33,23 @@ public class BlockConstructionMarker extends BlockMarker {
@Override @Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6) { public void breakBlock(World world, int x, int y, int z, Block block, int par6) {
Utils.preDestroyBlock(world, x, y, z); Utils.preDestroyBlock(world, x, y, z);
dropMarkerIfPresent(world, x, y, z, true);
super.breakBlock(world, x, y, z, block, par6);
}
private boolean dropMarkerIfPresent(World world, int x, int y, int z, boolean onBreak) {
TileConstructionMarker marker = (TileConstructionMarker) world.getTileEntity(x, y, z); TileConstructionMarker marker = (TileConstructionMarker) world.getTileEntity(x, y, z);
if (marker != null && marker.itemBlueprint != null && !world.isRemote) { if (marker != null && marker.itemBlueprint != null && !world.isRemote) {
float f1 = 0.7F; BlockUtils.dropItem((WorldServer) world, x, y, z, 6000, marker.itemBlueprint);
double d = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D; marker.itemBlueprint = null;
double d1 = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D; if (!onBreak) {
double d2 = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D; marker.bluePrintBuilder = null;
EntityItem itemToDrop = new EntityItem(world, x + d, y + d1, z + d2, marker.itemBlueprint); marker.bptContext = null;
itemToDrop.delayBeforeCanPickup = 10; marker.sendNetworkUpdate();
world.spawnEntityInWorld(itemToDrop);
} }
super.breakBlock(world, x, y, z, block, par6); return true;
}
return false;
} }
@Override @Override
@ -83,6 +91,8 @@ public class BlockConstructionMarker extends BlockMarker {
ItemConstructionMarker.link(entityplayer.getCurrentEquippedItem(), world, x, y, z); ItemConstructionMarker.link(entityplayer.getCurrentEquippedItem(), world, x, y, z);
return true; return true;
} }
} else if ((equipped == null || equipped instanceof IToolWrench) && entityplayer.isSneaking()) {
return dropMarkerIfPresent(world, x, y, z, false);
} }
return false; return false;

View file

@ -25,7 +25,6 @@ import buildcraft.core.render.RenderBuildingItems;
import buildcraft.core.render.RenderLaser; import buildcraft.core.render.RenderLaser;
public class RenderConstructionMarker extends RenderBoxProvider { public class RenderConstructionMarker extends RenderBoxProvider {
private final RenderBuildingItems renderItems = new RenderBuildingItems(); private final RenderBuildingItems renderItems = new RenderBuildingItems();
private final EntityItem dummyEntityItem = new EntityItem(null); private final EntityItem dummyEntityItem = new EntityItem(null);

View file

@ -19,9 +19,6 @@ import java.util.List;
import java.util.ListIterator; import java.util.ListIterator;
import java.util.Map.Entry; import java.util.Map.Entry;
import com.google.common.collect.HashMultiset;
import com.google.common.collect.Multiset;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item; import net.minecraft.item.Item;

View file

@ -14,8 +14,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import com.google.common.collect.Multiset;
import net.minecraft.world.WorldSettings; import net.minecraft.world.WorldSettings;
public class BuildingSlotMapIterator { public class BuildingSlotMapIterator {

View file

@ -1,6 +1,5 @@
package buildcraft.core.lib.render; package buildcraft.core.lib.render;
import net.minecraft.client.Minecraft;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
public class SubIcon implements IIcon { public class SubIcon implements IIcon {
@ -10,17 +9,13 @@ public class SubIcon implements IIcon {
private float uScale, vScale; private float uScale, vScale;
private int iw, ih; private int iw, ih;
public SubIcon(IIcon icon, int u, int v) { public SubIcon(IIcon icon, int u, int v, int size) {
this(icon, u, v, 16, 16); this(icon, u, v, 16, 16, size);
} }
public SubIcon(IIcon icon, int u, int v, int w, int h) { public SubIcon(IIcon icon, int u, int v, int w, int h, int size) {
iw = icon.getIconWidth(); iw = size;
ih = icon.getIconHeight(); ih = size;
if (Minecraft.getMinecraft().gameSettings.anisotropicFiltering > 1) {
iw -= 16;
ih -= 16;
}
this.icon = icon; this.icon = icon;
this.uScale = icon.getMaxU() - icon.getMinU(); this.uScale = icon.getMaxU() - icon.getMinU();
this.vScale = icon.getMaxV() - icon.getMinV(); this.vScale = icon.getMaxV() - icon.getMinV();

View file

@ -45,7 +45,7 @@ public class AIRobotAttack extends AIRobot {
@Override @Override
public void update() { public void update() {
if (target.isDead) { if (target == null || target.isDead) {
terminate(); terminate();
return; return;
} }

View file

@ -137,6 +137,11 @@ public class AIRobotBreak extends AIRobot {
return (int) Math.ceil((float) BuilderAPI.BREAK_ENERGY * 2 / 30.0F); return (int) Math.ceil((float) BuilderAPI.BREAK_ENERGY * 2 / 30.0F);
} }
@Override
public boolean canLoadFromNBT() {
return true;
}
@Override @Override
public void writeSelfToNBT(NBTTagCompound nbt) { public void writeSelfToNBT(NBTTagCompound nbt) {
super.writeSelfToNBT(nbt); super.writeSelfToNBT(nbt);

View file

@ -8,6 +8,11 @@
*/ */
package buildcraft.robotics.ai; package buildcraft.robotics.ai;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.core.BlockIndex;
import buildcraft.api.robots.AIRobot; import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.DockingStation; import buildcraft.api.robots.DockingStation;
import buildcraft.api.robots.EntityRobotBase; import buildcraft.api.robots.EntityRobotBase;
@ -61,4 +66,31 @@ public class AIRobotGoAndLinkToDock extends AIRobot {
terminate(); terminate();
} }
} }
@Override
public boolean canLoadFromNBT() {
return true;
}
@Override
public void writeSelfToNBT(NBTTagCompound nbt) {
super.writeSelfToNBT(nbt);
NBTTagCompound indexNBT = new NBTTagCompound();
station.index().writeTo(indexNBT);
nbt.setTag("stationIndex", indexNBT);
nbt.setByte("stationSide", (byte) station.side().ordinal());
}
@Override
public void loadSelfFromNBT(NBTTagCompound nbt) {
if (nbt.hasKey("stationIndex")) {
BlockIndex index = new BlockIndex(nbt.getCompoundTag("stationIndex"));
ForgeDirection side = ForgeDirection.values()[nbt.getByte("stationSide")];
station = robot.getRegistry().getStation(index.x, index.y, index.z, side);
} else {
station = robot.getLinkedStation();
}
}
} }

View file

@ -31,9 +31,4 @@ public class AIRobotGotoSleep extends AIRobot {
terminate(); terminate();
} }
} }
@Override
public boolean canLoadFromNBT() {
return true;
}
} }

View file

@ -36,7 +36,7 @@ public class AIRobotGotoStationAndLoad extends AIRobot {
@Override @Override
public void delegateAIEnded(AIRobot ai) { public void delegateAIEnded(AIRobot ai) {
if (ai instanceof AIRobotGotoStationToLoad) { if (ai instanceof AIRobotGotoStationToLoad) {
if (ai.success()) { if (filter != null && ai.success()) {
startDelegateAI(new AIRobotLoad(robot, filter, quantity)); startDelegateAI(new AIRobotLoad(robot, filter, quantity));
} else { } else {
setSuccess(false); setSuccess(false);

View file

@ -34,7 +34,7 @@ public class AIRobotGotoStationAndLoadFluids extends AIRobot {
@Override @Override
public void delegateAIEnded(AIRobot ai) { public void delegateAIEnded(AIRobot ai) {
if (ai instanceof AIRobotGotoStationToLoadFluids) { if (ai instanceof AIRobotGotoStationToLoadFluids) {
if (ai.success()) { if (filter != null && ai.success()) {
startDelegateAI(new AIRobotLoadFluids(robot, filter)); startDelegateAI(new AIRobotLoadFluids(robot, filter));
} else { } else {
setSuccess(false); setSuccess(false);

View file

@ -59,6 +59,11 @@ public class AIRobotHarvest extends AIRobot {
} }
} }
@Override
public boolean canLoadFromNBT() {
return true;
}
@Override @Override
public void writeSelfToNBT(NBTTagCompound nbt) { public void writeSelfToNBT(NBTTagCompound nbt) {
super.writeSelfToNBT(nbt); super.writeSelfToNBT(nbt);

View file

@ -44,7 +44,6 @@ public class AIRobotLoad extends AIRobot {
@Override @Override
public void update() { public void update() {
if (filter == null) { if (filter == null) {
// loading error
terminate(); terminate();
return; return;
} }

View file

@ -38,6 +38,11 @@ public class AIRobotLoadFluids extends AIRobot {
@Override @Override
public void update() { public void update() {
if (filter == null) {
terminate();
return;
}
waitedCycles++; waitedCycles++;
if (waitedCycles > 40) { if (waitedCycles > 40) {

View file

@ -93,6 +93,11 @@ public class AIRobotSearchBlock extends AIRobot {
return blockFound != null; return blockFound != null;
} }
@Override
public boolean canLoadFromNBT() {
return true;
}
@Override @Override
public void writeSelfToNBT(NBTTagCompound nbt) { public void writeSelfToNBT(NBTTagCompound nbt) {
super.writeSelfToNBT(nbt); super.writeSelfToNBT(nbt);

0
common/buildcraft/robotics/ai/AIRobotSearchEntity.java Executable file → Normal file
View file

View file

@ -42,7 +42,6 @@ public class AIRobotSearchRandomGroundBlock extends AIRobot {
@Override @Override
public void update() { public void update() {
if (filter == null) { if (filter == null) {
// defensive code
terminate(); terminate();
} }

View file

@ -8,6 +8,8 @@
*/ */
package buildcraft.robotics.ai; package buildcraft.robotics.ai;
import net.minecraft.nbt.NBTTagCompound;
import buildcraft.api.robots.EntityRobotBase; import buildcraft.api.robots.EntityRobotBase;
public class AIRobotStraightMoveTo extends AIRobotGoto { public class AIRobotStraightMoveTo extends AIRobotGoto {
@ -52,4 +54,29 @@ public class AIRobotStraightMoveTo extends AIRobotGoto {
terminate(); terminate();
} }
} }
@Override
public boolean canLoadFromNBT() {
return true;
}
@Override
public void writeSelfToNBT(NBTTagCompound nbt) {
super.writeSelfToNBT(nbt);
nbt.setFloat("x", x);
nbt.setFloat("y", y);
nbt.setFloat("z", z);
}
@Override
public void loadSelfFromNBT(NBTTagCompound nbt) {
super.loadSelfFromNBT(nbt);
if (nbt.hasKey("x")) {
x = nbt.getFloat("x");
y = nbt.getFloat("y");
z = nbt.getFloat("z");
}
}
} }

View file

@ -46,6 +46,12 @@ public class AIRobotStripesHandler extends AIRobot implements IStripesActivator
@Override @Override
public void update() { public void update() {
if (useToBlock == null) {
setSuccess(false);
terminate();
return;
}
useCycles++; useCycles++;
if (useCycles > 60) { if (useCycles > 60) {

View file

@ -9,7 +9,9 @@
package buildcraft.robotics.boards; package buildcraft.robotics.boards;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidRegistry;
@ -80,8 +82,9 @@ public class BoardRobotPump extends RedstoneBoardRobot {
} else { } else {
startDelegateAI(new AIRobotGotoSleep(robot)); startDelegateAI(new AIRobotGotoSleep(robot));
} }
} else if (ai instanceof AIRobotGotoStationAndUnloadFluids) { } else if (ai instanceof AIRobotPumpBlock) {
releaseBlockFound(); releaseBlockFound();
} else if (ai instanceof AIRobotGotoStationAndUnloadFluids) {
if (!ai.success()) { if (!ai.success()) {
startDelegateAI(new AIRobotGotoSleep(robot)); startDelegateAI(new AIRobotGotoSleep(robot));
@ -118,4 +121,27 @@ public class BoardRobotPump extends RedstoneBoardRobot {
return fluidFilter.matches(fluid); return fluidFilter.matches(fluid);
} }
@Override
public boolean canLoadFromNBT() {
return true;
}
@Override
public void writeSelfToNBT(NBTTagCompound nbt) {
super.writeSelfToNBT(nbt);
if (blockFound != null) {
NBTTagCompound sub = new NBTTagCompound();
blockFound.writeTo(sub);
nbt.setTag("blockFound", sub);
}
}
@Override
public void loadSelfFromNBT(NBTTagCompound nbt) {
super.loadSelfFromNBT(nbt);
if (nbt.hasKey("blockFound")) {
blockFound = new BlockIndex(nbt.getCompoundTag("blockFound"));
}
}
} }

View file

@ -68,10 +68,12 @@ public class ActionRobotGotoStation extends BCStatement implements IActionIntern
newStation = getStation((StatementParameterItemStack) parameters[0], registry); newStation = getStation((StatementParameterItemStack) parameters[0], registry);
} }
if (newStation != null) {
robot.overrideAI(new AIRobotGoAndLinkToDock(robot, newStation)); robot.overrideAI(new AIRobotGoAndLinkToDock(robot, newStation));
} }
} }
} }
}
private DockingStation getStation(StatementParameterItemStack stackParam, private DockingStation getStation(StatementParameterItemStack stackParam,
IRobotRegistry registry) { IRobotRegistry registry) {

View file

@ -1,7 +1,6 @@
package buildcraft.silicon; package buildcraft.silicon;
import java.util.EnumMap; import java.util.EnumMap;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;

View file

@ -42,7 +42,7 @@ public class ContainerPackager extends BuildCraftContainer {
} }
} }
addSlotToContainer(new Slot(tile, 10, 108, 31)); // addSlotToContainer(new Slot(tile, 10, 108, 31));
addSlotToContainer(new SlotOutput(tile, 11, 123, 59)); addSlotToContainer(new SlotOutput(tile, 11, 123, 59));

View file

@ -87,12 +87,12 @@ public class RenderLaserTable implements ISimpleBlockRenderingHandler {
block.setColor(0xFFFFFF); block.setColor(0xFFFFFF);
IIcon[] icons = block.getTextureState().popArray(); IIcon[] icons = block.getTextureState().popArray();
icons[0] = new SubIcon(base, topX + w - xI, topY - zI, 16, 16); icons[0] = new SubIcon(base, topX + w - xI, topY - zI, 16, 16, 64);
icons[1] = new SubIcon(base, topX - xI, topY - zI, 16, 16); icons[1] = new SubIcon(base, topX - xI, topY - zI, 16, 16, 64);
icons[2] = new SubIcon(base, topX - xI, topY + d - yI, 16, 16); icons[2] = new SubIcon(base, topX - xI, topY + d - yI, 16, 16, 64);
icons[3] = new SubIcon(base, topX + w + d - xI, topY + d - yI, 16, 16); icons[3] = new SubIcon(base, topX + w + d - xI, topY + d - yI, 16, 16, 64);
icons[4] = new SubIcon(base, topX - d - zI, topY + d - yI, 16, 16); icons[4] = new SubIcon(base, topX - d - zI, topY + d - yI, 16, 16, 64);
icons[5] = new SubIcon(base, topX + w - zI, topY + d - yI, 16, 16); icons[5] = new SubIcon(base, topX + w - zI, topY + d - yI, 16, 16, 64);
renderer.setRenderBounds(xB, yB, zB, xB + (w / 16.0F), yB + (h / 16.0F), zB + (d / 16.0F)); renderer.setRenderBounds(xB, yB, zB, xB + (w / 16.0F), yB + (h / 16.0F), zB + (d / 16.0F));
if (isInventory) { if (isInventory) {

View file

@ -5,7 +5,6 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import com.google.common.collect.EnumMultiset; import com.google.common.collect.EnumMultiset;
import com.google.common.collect.HashMultiset;
import com.google.common.collect.Multiset; import com.google.common.collect.Multiset;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;

View file

@ -308,6 +308,13 @@ public class PipeTransportItems extends PipeTransport implements IDebuggable {
continue; continue;
} }
if (item.output == ForgeDirection.UNKNOWN) {
// TODO: Figure out why this is actually happening.
items.scheduleRemoval(item);
BCLog.logger.warn("Glitched item [Output direction UNKNOWN] removed from world @ " + container.x() + ", " + container.y() + ", " + container.z() + "!");
continue;
}
TileEntity tile = container.getTile(item.output, true); TileEntity tile = container.getTile(item.output, true);
PipeEventItem.ReachedEnd event = new PipeEventItem.ReachedEnd(container.pipe, item, tile); PipeEventItem.ReachedEnd event = new PipeEventItem.ReachedEnd(container.pipe, item, tile);

View file

@ -182,13 +182,14 @@ public class PipeFluidsDiamond extends Pipe<PipeTransportFluids> implements IDia
@Override @Override
public void writeData(ByteBuf data) { public void writeData(ByteBuf data) {
NBTTagCompound nbt = new NBTTagCompound(); NBTTagCompound nbt = new NBTTagCompound();
writeToNBT(nbt); filters.writeToNBT(nbt);
NetworkUtils.writeNBT(data, nbt); NetworkUtils.writeNBT(data, nbt);
} }
@Override @Override
public void readData(ByteBuf data) { public void readData(ByteBuf data) {
NBTTagCompound nbt = NetworkUtils.readNBT(data); NBTTagCompound nbt = NetworkUtils.readNBT(data);
readFromNBT(nbt); filters.readFromNBT(nbt);
filters.markDirty();
} }
} }

View file

@ -86,14 +86,14 @@ public class PipeFluidsEmerald extends PipeFluidsWood implements ISerializable {
@Override @Override
public void writeData(ByteBuf data) { public void writeData(ByteBuf data) {
NBTTagCompound nbt = new NBTTagCompound(); NBTTagCompound nbt = new NBTTagCompound();
writeToNBT(nbt); filters.writeToNBT(nbt);
NetworkUtils.writeNBT(data, nbt); NetworkUtils.writeNBT(data, nbt);
} }
@Override @Override
public void readData(ByteBuf data) { public void readData(ByteBuf data) {
NBTTagCompound nbt = NetworkUtils.readNBT(data); NBTTagCompound nbt = NetworkUtils.readNBT(data);
readFromNBT(nbt); filters.readFromNBT(nbt);
} }
@Override @Override

View file

@ -119,7 +119,8 @@ public class PipeFluidsWood extends Pipe<PipeTransportFluids> implements IEnergy
if (extracted != null) { if (extracted != null) {
inserted = transport.fill(side, extracted, true); inserted = transport.fill(side, extracted, true);
if (inserted > 0) { if (inserted > 0) {
fluidHandler.drain(side.getOpposite(), new FluidStack(extracted.getFluid(), inserted), true); extracted.amount = inserted;
fluidHandler.drain(side.getOpposite(), extracted, true);
} }
} }

View file

@ -207,13 +207,17 @@ public class PipeItemsDiamond extends Pipe<PipeTransportItems> implements IDiamo
@Override @Override
public void writeData(ByteBuf data) { public void writeData(ByteBuf data) {
NBTTagCompound nbt = new NBTTagCompound(); NBTTagCompound nbt = new NBTTagCompound();
writeToNBT(nbt); filters.writeToNBT(nbt);
nbt.setLong("usedFilters", usedFilters);
NetworkUtils.writeNBT(data, nbt); NetworkUtils.writeNBT(data, nbt);
} }
@Override @Override
public void readData(ByteBuf data) { public void readData(ByteBuf data) {
NBTTagCompound nbt = NetworkUtils.readNBT(data); NBTTagCompound nbt = NetworkUtils.readNBT(data);
readFromNBT(nbt); filters.readFromNBT(nbt);
if (nbt.hasKey("usedFilters")) {
usedFilters = nbt.getLong("usedFilters");
}
} }
} }

View file

@ -197,20 +197,20 @@ public class PipeItemsEmerald extends PipeItemsWood implements ISerializable, IG
} }
private void incrementFilter() { private void incrementFilter() {
currentFilter++; currentFilter = (currentFilter + 1) % filters.getSizeInventory();
int count = 0; int count = 0;
while (filters.getStackInSlot(currentFilter % filters.getSizeInventory()) == null && count < filters.getSizeInventory()) { while (filters.getStackInSlot(currentFilter) == null && count < filters.getSizeInventory()) {
currentFilter++; currentFilter = (currentFilter + 1) % filters.getSizeInventory();
count++; count++;
} }
} }
private ItemStack getCurrentFilter() { private ItemStack getCurrentFilter() {
ItemStack filter = filters.getStackInSlot(currentFilter % filters.getSizeInventory()); ItemStack filter = filters.getStackInSlot(currentFilter);
if (filter == null) { if (filter == null) {
incrementFilter(); incrementFilter();
} }
return filters.getStackInSlot(currentFilter % filters.getSizeInventory()); return filters.getStackInSlot(currentFilter);
} }
public IInventory getFilters() { public IInventory getFilters() {
@ -224,14 +224,18 @@ public class PipeItemsEmerald extends PipeItemsWood implements ISerializable, IG
@Override @Override
public void writeData(ByteBuf data) { public void writeData(ByteBuf data) {
NBTTagCompound nbt = new NBTTagCompound(); NBTTagCompound nbt = new NBTTagCompound();
writeToNBT(nbt); filters.writeToNBT(nbt);
settings.writeToNBT(nbt);
NetworkUtils.writeNBT(data, nbt); NetworkUtils.writeNBT(data, nbt);
data.writeByte(currentFilter);
} }
@Override @Override
public void readData(ByteBuf data) { public void readData(ByteBuf data) {
NBTTagCompound nbt = NetworkUtils.readNBT(data); NBTTagCompound nbt = NetworkUtils.readNBT(data);
readFromNBT(nbt); filters.readFromNBT(nbt);
settings.readFromNBT(nbt);
currentFilter = data.readUnsignedByte();
} }
@Override @Override
@ -241,7 +245,7 @@ public class PipeItemsEmerald extends PipeItemsWood implements ISerializable, IG
filters.readFromNBT(nbt); filters.readFromNBT(nbt);
settings.readFromNBT(nbt); settings.readFromNBT(nbt);
currentFilter = nbt.getInteger("currentFilter"); currentFilter = nbt.getInteger("currentFilter") % filters.getSizeInventory();
} }
@Override @Override