This commit is contained in:
Adrian Siekierka 2017-02-10 00:39:17 +01:00
commit f88cdab008
8 changed files with 85 additions and 38 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.1.19" version = "7.1.20"
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]

View file

@ -0,0 +1,6 @@
Bugs fixed:
* [#3492] Remove wasted space in packets (asie)
* [#3488] Fix Zone Planner crash in fullscreen mode (asie)
* [#3429] Fix robots sinking through bedrock if the docking station is broken (asie)
* [#3341] Fix builder not handling flowing liquid correctly in survival mode (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.1.19 1.7.10:BuildCraft:7.1.20

View file

@ -6,6 +6,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockBasePressurePlate; import net.minecraft.block.BlockBasePressurePlate;
import net.minecraft.block.BlockBush; import net.minecraft.block.BlockBush;
import net.minecraft.block.BlockButton; import net.minecraft.block.BlockButton;
import net.minecraft.block.BlockDynamicLiquid;
import net.minecraft.block.BlockLever; import net.minecraft.block.BlockLever;
import net.minecraft.block.BlockStairs; import net.minecraft.block.BlockStairs;
import net.minecraft.block.BlockTorch; import net.minecraft.block.BlockTorch;
@ -14,15 +15,16 @@ import net.minecraft.init.Blocks;
import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.IPlantable;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidBlock;
import buildcraft.api.blueprints.SchematicBlock; import buildcraft.api.blueprints.SchematicBlock;
import buildcraft.api.blueprints.SchematicFluid; import buildcraft.api.blueprints.SchematicFluid;
import buildcraft.builders.schematics.SchematicStairs; import buildcraft.builders.schematics.SchematicStairs;
import buildcraft.core.blueprints.SchematicRegistry; import buildcraft.core.blueprints.SchematicRegistry;
import buildcraft.core.builders.schematics.SchematicBlockFloored; import buildcraft.core.builders.schematics.SchematicBlockFloored;
import buildcraft.core.builders.schematics.SchematicIgnore;
import buildcraft.core.builders.schematics.SchematicTileCreative; import buildcraft.core.builders.schematics.SchematicTileCreative;
import buildcraft.core.builders.schematics.SchematicWallSide; import buildcraft.core.builders.schematics.SchematicWallSide;
import buildcraft.core.lib.utils.FluidUtils;
public final class HeuristicBlockDetection { public final class HeuristicBlockDetection {
private HeuristicBlockDetection() { private HeuristicBlockDetection() {
@ -41,18 +43,16 @@ public final class HeuristicBlockDetection {
if (!SchematicRegistry.INSTANCE.isSupported(block, meta)) { if (!SchematicRegistry.INSTANCE.isSupported(block, meta)) {
try { try {
if (block.hasTileEntity(meta)) { if (block.hasTileEntity(meta)) {
// All tiles are registered as creative only. // All tiles not otherwise supported are registered
// This is helpful for example for server admins. // as creative only to prevent exploitation.
SchematicRegistry.INSTANCE.registerSchematicBlock(block, meta, SchematicTileCreative.class); SchematicRegistry.INSTANCE.registerSchematicBlock(block, meta, SchematicTileCreative.class);
continue; continue;
} }
try { try {
if (block instanceof IFluidBlock) { if (block instanceof BlockDynamicLiquid) {
IFluidBlock fblock = (IFluidBlock) block; // Fixes #3341 - not recording flowing water
if (fblock.getFluid() != null) { SchematicRegistry.INSTANCE.registerSchematicBlock(block, meta, SchematicIgnore.class);
SchematicRegistry.INSTANCE.registerSchematicBlock(block, meta, SchematicFluid.class, new FluidStack(fblock.getFluid(), 1000));
}
} else { } else {
if (block instanceof BlockBush || block instanceof IPlantable || block instanceof IGrowable || block instanceof BlockBasePressurePlate) { if (block instanceof BlockBush || block instanceof IPlantable || block instanceof IGrowable || block instanceof BlockBasePressurePlate) {
SchematicRegistry.INSTANCE.registerSchematicBlock(block, meta, SchematicBlockFloored.class); SchematicRegistry.INSTANCE.registerSchematicBlock(block, meta, SchematicBlockFloored.class);
@ -61,7 +61,12 @@ public final class HeuristicBlockDetection {
} else if (block instanceof BlockStairs) { } else if (block instanceof BlockStairs) {
SchematicRegistry.INSTANCE.registerSchematicBlock(block, meta, SchematicStairs.class); SchematicRegistry.INSTANCE.registerSchematicBlock(block, meta, SchematicStairs.class);
} else { } else {
SchematicRegistry.INSTANCE.registerSchematicBlock(block, meta, SchematicBlock.class); FluidStack fstack = FluidUtils.getFluidStackFromBlock(block);
if (fstack != null) {
SchematicRegistry.INSTANCE.registerSchematicBlock(block, meta, SchematicFluid.class, fstack);
} else {
SchematicRegistry.INSTANCE.registerSchematicBlock(block, meta, SchematicBlock.class);
}
} }
} }
} catch (Exception e) { } catch (Exception e) {

View file

@ -16,6 +16,21 @@ public final class FluidUtils {
} }
public static FluidStack getFluidStackFromBlock(Block b) {
if (b != null) {
if (b instanceof IFluidBlock && ((IFluidBlock) b).getFluid() != null) {
return new FluidStack(((IFluidBlock) b).getFluid(), 1000);
} else {
Fluid f = FluidRegistry.lookupFluidForBlock(b);
if (f != null && FluidRegistry.isFluidRegistered(f)) {
return new FluidStack(f, 1000);
}
}
}
return null;
}
public static FluidStack getFluidStackFromItemStack(ItemStack stack) { public static FluidStack getFluidStackFromItemStack(ItemStack stack) {
if (stack != null) { if (stack != null) {
if (stack.getItem() instanceof IFluidContainerItem) { if (stack.getItem() instanceof IFluidContainerItem) {
@ -26,14 +41,7 @@ public final class FluidUtils {
} else if (stack.getItem() instanceof ItemBlock) { } else if (stack.getItem() instanceof ItemBlock) {
Block b = Block.getBlockFromItem(stack.getItem()); Block b = Block.getBlockFromItem(stack.getItem());
if (b != null) { if (b != null) {
if (b instanceof IFluidBlock && ((IFluidBlock) b).getFluid() != null) { return getFluidStackFromBlock(b);
return new FluidStack(((IFluidBlock) b).getFluid(), 1000);
} else {
Fluid f = FluidRegistry.lookupFluidForBlock(b);
if (f != null && FluidRegistry.isFluidRegistered(f)) {
return new FluidStack(f, 1000);
}
}
} }
} }
} }

View file

@ -70,6 +70,6 @@ public final class ThreadSafeUtils {
} }
} }
packet.writeData(data); packet.writeData(data);
return new FMLProxyPacket(data, channel.attr(NetworkRegistry.FML_CHANNEL).get()); return new FMLProxyPacket(data.copy(), channel.attr(NetworkRegistry.FML_CHANNEL).get());
} }
} }

View file

@ -209,26 +209,38 @@ public class DockingStationPipe extends DockingStation implements IRequestProvid
@Override @Override
public boolean isInitialized() { public boolean isInitialized() {
if (getPipe() == null || getPipe().getPipe() == null) { getPipe();
if (pipe == null || pipe.getPipe() == null) {
return false; return false;
} }
return ((Pipe<?>) getPipe().getPipe()).isInitialized(); return ((Pipe<?>) pipe.getPipe()).isInitialized();
} }
@Override @Override
public boolean take(EntityRobotBase robot) { public boolean take(EntityRobotBase robot) {
getPipe();
if (pipe == null) {
return false;
}
boolean result = super.take(robot); boolean result = super.take(robot);
if (result) { if (result) {
getPipe().scheduleRenderUpdate(); pipe.scheduleRenderUpdate();
} }
return result; return result;
} }
@Override @Override
public boolean takeAsMain(EntityRobotBase robot) { public boolean takeAsMain(EntityRobotBase robot) {
getPipe();
if (pipe == null) {
return false;
}
boolean result = super.takeAsMain(robot); boolean result = super.takeAsMain(robot);
if (result) { if (result) {
getPipe().scheduleRenderUpdate(); pipe.scheduleRenderUpdate();
} }
return result; return result;
} }

View file

@ -19,6 +19,7 @@ import io.netty.buffer.ByteBuf;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.GuiTextField;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
@ -40,11 +41,13 @@ import buildcraft.robotics.TileZonePlan;
import buildcraft.robotics.ZonePlan; import buildcraft.robotics.ZonePlan;
public class GuiZonePlan extends GuiAdvancedInterface { public class GuiZonePlan extends GuiAdvancedInterface {
public static final int WINDOWED_MAP_WIDTH = 213;
public static final int WINDOWED_MAP_HEIGHT = 100;
private static final ResourceLocation TMP_TEXTURE = new ResourceLocation("buildcraftrobotics:textures/gui/zone_planner_gui.png"); private static final ResourceLocation TMP_TEXTURE = new ResourceLocation("buildcraftrobotics:textures/gui/zone_planner_gui.png");
private int mapWidth = 213; private int mapWidth = WINDOWED_MAP_WIDTH;
private int mapHeight = 100; private int mapHeight = WINDOWED_MAP_HEIGHT;
private TileZonePlan zonePlan; private TileZonePlan zonePlan;
@ -71,7 +74,6 @@ public class GuiZonePlan extends GuiAdvancedInterface {
private GuiBetterButton tool, fsButton; private GuiBetterButton tool, fsButton;
private List inventorySlots;
private List<GuiBetterButton> savedButtonList; private List<GuiBetterButton> savedButtonList;
private GuiTextField textField; private GuiTextField textField;
@ -130,8 +132,6 @@ public class GuiZonePlan extends GuiAdvancedInterface {
uploadMap(); uploadMap();
getContainer().loadArea(colorSelected.color.ordinal()); getContainer().loadArea(colorSelected.color.ordinal());
inventorySlots = container.inventorySlots;
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -167,21 +167,21 @@ public class GuiZonePlan extends GuiAdvancedInterface {
} }
private boolean isFullscreen() { private boolean isFullscreen() {
return getContainer().mapTexture.height > 100; return getContainer().mapTexture.height > WINDOWED_MAP_HEIGHT;
} }
@Override @Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
super.drawGuiContainerBackgroundLayer(f, x, y); super.drawGuiContainerBackgroundLayer(f, x, y);
if (getContainer().mapTexture.width <= 213) { if (getContainer().mapTexture.width <= WINDOWED_MAP_WIDTH) {
mapXMin = guiLeft + 8 + ((213 - getContainer().mapTexture.width) / 2); mapXMin = guiLeft + 8 + ((WINDOWED_MAP_WIDTH - getContainer().mapTexture.width) / 2);
} else { } else {
mapXMin = (width - getContainer().mapTexture.width) / 2; mapXMin = (width - getContainer().mapTexture.width) / 2;
} }
if (getContainer().mapTexture.height <= 100) { if (getContainer().mapTexture.height <= WINDOWED_MAP_HEIGHT) {
mapYMin = guiTop + 9 + ((100 - getContainer().mapTexture.height) / 2); mapYMin = guiTop + 9 + ((WINDOWED_MAP_HEIGHT - getContainer().mapTexture.height) / 2);
} else { } else {
mapYMin = (height - getContainer().mapTexture.height) / 2; mapYMin = (height - getContainer().mapTexture.height) / 2;
} }
@ -321,6 +321,10 @@ public class GuiZonePlan extends GuiAdvancedInterface {
} }
private void toFullscreen() { private void toFullscreen() {
if (isFullscreen()) {
return;
}
if (blocksPerPixel > 4.0f) { if (blocksPerPixel > 4.0f) {
blocksPerPixel = 4.0f; blocksPerPixel = 4.0f;
} }
@ -331,24 +335,36 @@ public class GuiZonePlan extends GuiAdvancedInterface {
getContainer().mapTexture = new DynamicTextureBC(mapWidth, mapHeight); getContainer().mapTexture = new DynamicTextureBC(mapWidth, mapHeight);
currentSelection = new DynamicTextureBC(mapWidth, mapHeight); currentSelection = new DynamicTextureBC(mapWidth, mapHeight);
for (Slot s : (List<Slot>) container.inventorySlots) {
s.xDisplayPosition += 1048576;
s.yDisplayPosition += 1048576;
}
uploadMap(); uploadMap();
refreshSelectedArea(); refreshSelectedArea();
container.inventorySlots = new LinkedList<Object>();
buttonList = new LinkedList<GuiBetterButton>(); buttonList = new LinkedList<GuiBetterButton>();
} }
private void toWindowed() { private void toWindowed() {
mapWidth = 213; if (!isFullscreen()) {
mapHeight = 100; return;
}
mapWidth = WINDOWED_MAP_WIDTH;
mapHeight = WINDOWED_MAP_HEIGHT;
getContainer().mapTexture = new DynamicTextureBC(mapWidth, mapHeight); getContainer().mapTexture = new DynamicTextureBC(mapWidth, mapHeight);
currentSelection = new DynamicTextureBC(mapWidth, mapHeight); currentSelection = new DynamicTextureBC(mapWidth, mapHeight);
for (Slot s : (List<Slot>) container.inventorySlots) {
s.xDisplayPosition -= 1048576;
s.yDisplayPosition -= 1048576;
}
uploadMap(); uploadMap();
refreshSelectedArea(); refreshSelectedArea();
container.inventorySlots = inventorySlots;
buttonList = savedButtonList; buttonList = savedButtonList;
} }