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: 'checkstyle'
version = "7.0.12"
version = "7.0.13"
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]

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

View file

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

View file

@ -19,9 +19,6 @@ import java.util.List;
import java.util.ListIterator;
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.inventory.IInventory;
import net.minecraft.item.Item;

View file

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

View file

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

View file

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

View file

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

View file

@ -8,6 +8,11 @@
*/
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.DockingStation;
import buildcraft.api.robots.EntityRobotBase;
@ -61,4 +66,31 @@ public class AIRobotGoAndLinkToDock extends AIRobot {
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();
}
}
@Override
public boolean canLoadFromNBT() {
return true;
}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -93,6 +93,11 @@ public class AIRobotSearchBlock extends AIRobot {
return blockFound != null;
}
@Override
public boolean canLoadFromNBT() {
return true;
}
@Override
public void writeSelfToNBT(NBTTagCompound 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
public void update() {
if (filter == null) {
// defensive code
terminate();
}

View file

@ -8,6 +8,8 @@
*/
package buildcraft.robotics.ai;
import net.minecraft.nbt.NBTTagCompound;
import buildcraft.api.robots.EntityRobotBase;
public class AIRobotStraightMoveTo extends AIRobotGoto {
@ -52,4 +54,29 @@ public class AIRobotStraightMoveTo extends AIRobotGoto {
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
public void update() {
if (useToBlock == null) {
setSuccess(false);
terminate();
return;
}
useCycles++;
if (useCycles > 60) {

View file

@ -9,7 +9,9 @@
package buildcraft.robotics.boards;
import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
@ -80,8 +82,9 @@ public class BoardRobotPump extends RedstoneBoardRobot {
} else {
startDelegateAI(new AIRobotGotoSleep(robot));
}
} else if (ai instanceof AIRobotGotoStationAndUnloadFluids) {
} else if (ai instanceof AIRobotPumpBlock) {
releaseBlockFound();
} else if (ai instanceof AIRobotGotoStationAndUnloadFluids) {
if (!ai.success()) {
startDelegateAI(new AIRobotGotoSleep(robot));
@ -118,4 +121,27 @@ public class BoardRobotPump extends RedstoneBoardRobot {
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,7 +68,9 @@ public class ActionRobotGotoStation extends BCStatement implements IActionIntern
newStation = getStation((StatementParameterItemStack) parameters[0], registry);
}
robot.overrideAI(new AIRobotGoAndLinkToDock(robot, newStation));
if (newStation != null) {
robot.overrideAI(new AIRobotGoAndLinkToDock(robot, newStation));
}
}
}
}

View file

@ -1,7 +1,6 @@
package buildcraft.silicon;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.Map;
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));

View file

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

View file

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

View file

@ -308,6 +308,13 @@ public class PipeTransportItems extends PipeTransport implements IDebuggable {
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);
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
public void writeData(ByteBuf data) {
NBTTagCompound nbt = new NBTTagCompound();
writeToNBT(nbt);
filters.writeToNBT(nbt);
NetworkUtils.writeNBT(data, nbt);
}
@Override
public void readData(ByteBuf 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
public void writeData(ByteBuf data) {
NBTTagCompound nbt = new NBTTagCompound();
writeToNBT(nbt);
filters.writeToNBT(nbt);
NetworkUtils.writeNBT(data, nbt);
}
@Override
public void readData(ByteBuf data) {
NBTTagCompound nbt = NetworkUtils.readNBT(data);
readFromNBT(nbt);
filters.readFromNBT(nbt);
}
@Override

View file

@ -119,7 +119,8 @@ public class PipeFluidsWood extends Pipe<PipeTransportFluids> implements IEnergy
if (extracted != null) {
inserted = transport.fill(side, extracted, true);
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
public void writeData(ByteBuf data) {
NBTTagCompound nbt = new NBTTagCompound();
writeToNBT(nbt);
filters.writeToNBT(nbt);
nbt.setLong("usedFilters", usedFilters);
NetworkUtils.writeNBT(data, nbt);
}
@Override
public void readData(ByteBuf 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() {
currentFilter++;
currentFilter = (currentFilter + 1) % filters.getSizeInventory();
int count = 0;
while (filters.getStackInSlot(currentFilter % filters.getSizeInventory()) == null && count < filters.getSizeInventory()) {
currentFilter++;
while (filters.getStackInSlot(currentFilter) == null && count < filters.getSizeInventory()) {
currentFilter = (currentFilter + 1) % filters.getSizeInventory();
count++;
}
}
private ItemStack getCurrentFilter() {
ItemStack filter = filters.getStackInSlot(currentFilter % filters.getSizeInventory());
ItemStack filter = filters.getStackInSlot(currentFilter);
if (filter == null) {
incrementFilter();
}
return filters.getStackInSlot(currentFilter % filters.getSizeInventory());
return filters.getStackInSlot(currentFilter);
}
public IInventory getFilters() {
@ -224,14 +224,18 @@ public class PipeItemsEmerald extends PipeItemsWood implements ISerializable, IG
@Override
public void writeData(ByteBuf data) {
NBTTagCompound nbt = new NBTTagCompound();
writeToNBT(nbt);
filters.writeToNBT(nbt);
settings.writeToNBT(nbt);
NetworkUtils.writeNBT(data, nbt);
data.writeByte(currentFilter);
}
@Override
public void readData(ByteBuf data) {
NBTTagCompound nbt = NetworkUtils.readNBT(data);
readFromNBT(nbt);
filters.readFromNBT(nbt);
settings.readFromNBT(nbt);
currentFilter = data.readUnsignedByte();
}
@Override
@ -241,7 +245,7 @@ public class PipeItemsEmerald extends PipeItemsWood implements ISerializable, IG
filters.readFromNBT(nbt);
settings.readFromNBT(nbt);
currentFilter = nbt.getInteger("currentFilter");
currentFilter = nbt.getInteger("currentFilter") % filters.getSizeInventory();
}
@Override