The gui now only opens if there is is a full structure next to it.
This commit is contained in:
parent
7de15ec1a5
commit
1209c78345
4 changed files with 29 additions and 3 deletions
|
@ -68,7 +68,7 @@ public abstract class RectangularMultiblockControllerBase extends
|
||||||
// This is permitted so that we can incorporate certain non-multiblock parts inside interiors
|
// This is permitted so that we can incorporate certain non-multiblock parts inside interiors
|
||||||
part = null;
|
part = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate block type against both part-level and material-level validators.
|
// Validate block type against both part-level and material-level validators.
|
||||||
int extremes = 0;
|
int extremes = 0;
|
||||||
if(x == minimumCoord.x) { extremes++; }
|
if(x == minimumCoord.x) { extremes++; }
|
||||||
|
|
|
@ -9,10 +9,12 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import techreborn.Core;
|
import techreborn.Core;
|
||||||
import techreborn.client.GuiHandler;
|
import techreborn.client.GuiHandler;
|
||||||
import techreborn.client.TechRebornCreativeTab;
|
import techreborn.client.TechRebornCreativeTab;
|
||||||
import techreborn.tiles.TileBlastFurnace;
|
import techreborn.tiles.TileBlastFurnace;
|
||||||
|
import techreborn.tiles.TileMachineCasing;
|
||||||
|
|
||||||
public class BlockBlastFurnace extends BlockContainer{
|
public class BlockBlastFurnace extends BlockContainer{
|
||||||
|
|
||||||
|
@ -37,7 +39,14 @@ public class BlockBlastFurnace extends BlockContainer{
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
if (!player.isSneaking())
|
if (!player.isSneaking())
|
||||||
player.openGui(Core.INSTANCE, GuiHandler.blastFurnaceID, world, x, y, z);
|
for(ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS){
|
||||||
|
if(world.getTileEntity(x + direction.offsetX, y + direction.offsetY, z + direction.offsetZ) instanceof TileMachineCasing){
|
||||||
|
TileMachineCasing casing = (TileMachineCasing) world.getTileEntity(x + direction.offsetX, y + direction.offsetY, z + direction.offsetZ);
|
||||||
|
if(casing.getMultiblockController() != null && casing.getMultiblockController().isAssembled()){
|
||||||
|
player.openGui(Core.INSTANCE, GuiHandler.blastFurnaceID, world, x, y, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,15 @@ package techreborn.multiblocks;
|
||||||
|
|
||||||
import erogenousbeef.coreTR.multiblock.IMultiblockPart;
|
import erogenousbeef.coreTR.multiblock.IMultiblockPart;
|
||||||
import erogenousbeef.coreTR.multiblock.MultiblockControllerBase;
|
import erogenousbeef.coreTR.multiblock.MultiblockControllerBase;
|
||||||
|
import erogenousbeef.coreTR.multiblock.MultiblockValidationException;
|
||||||
import erogenousbeef.coreTR.multiblock.rectangular.RectangularMultiblockControllerBase;
|
import erogenousbeef.coreTR.multiblock.rectangular.RectangularMultiblockControllerBase;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import techreborn.util.LogHelper;
|
import techreborn.util.LogHelper;
|
||||||
|
|
||||||
public class MultiBlockCasing extends RectangularMultiblockControllerBase {
|
public class MultiBlockCasing extends RectangularMultiblockControllerBase {
|
||||||
|
|
||||||
public MultiBlockCasing(World world) {
|
public MultiBlockCasing(World world) {
|
||||||
super(world);
|
super(world);
|
||||||
}
|
}
|
||||||
|
@ -28,7 +31,7 @@ public class MultiBlockCasing extends RectangularMultiblockControllerBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onMachineAssembled() {
|
protected void onMachineAssembled() {
|
||||||
LogHelper.all("New multiblock created!");
|
LogHelper.warn("New multiblock created!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -120,4 +123,14 @@ public class MultiBlockCasing extends RectangularMultiblockControllerBase {
|
||||||
public void decodeDescriptionPacket(NBTTagCompound data) {
|
public void decodeDescriptionPacket(NBTTagCompound data) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void isBlockGoodForInterior(World world, int x, int y, int z) throws MultiblockValidationException {
|
||||||
|
Block block = world.getBlock(x, y, z);
|
||||||
|
if(block.getUnlocalizedName().equals("tile.lava") || block.getUnlocalizedName().equals("tile.air")){
|
||||||
|
} else {
|
||||||
|
super.isBlockGoodForInterior(world, x, y, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,4 +57,8 @@ public class TileMachineCasing extends RectangularMultiblockTileEntityBase {
|
||||||
public void isGoodForInterior() throws MultiblockValidationException {
|
public void isGoodForInterior() throws MultiblockValidationException {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MultiBlockCasing getMultiblockController() {
|
||||||
|
return (MultiBlockCasing) super.getMultiblockController();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue