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: 'checkstyle'
version = "7.1.19"
version = "7.1.20"
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]

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

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) {
if (stack != null) {
if (stack.getItem() instanceof IFluidContainerItem) {
@ -26,14 +41,7 @@ public final class FluidUtils {
} else if (stack.getItem() instanceof ItemBlock) {
Block b = Block.getBlockFromItem(stack.getItem());
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 getFluidStackFromBlock(b);
}
}
}

View file

@ -70,6 +70,6 @@ public final class ThreadSafeUtils {
}
}
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
public boolean isInitialized() {
if (getPipe() == null || getPipe().getPipe() == null) {
getPipe();
if (pipe == null || pipe.getPipe() == null) {
return false;
}
return ((Pipe<?>) getPipe().getPipe()).isInitialized();
return ((Pipe<?>) pipe.getPipe()).isInitialized();
}
@Override
public boolean take(EntityRobotBase robot) {
getPipe();
if (pipe == null) {
return false;
}
boolean result = super.take(robot);
if (result) {
getPipe().scheduleRenderUpdate();
pipe.scheduleRenderUpdate();
}
return result;
}
@Override
public boolean takeAsMain(EntityRobotBase robot) {
getPipe();
if (pipe == null) {
return false;
}
boolean result = super.takeAsMain(robot);
if (result) {
getPipe().scheduleRenderUpdate();
pipe.scheduleRenderUpdate();
}
return result;
}

View file

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