more fixes
- grid / crafting grid differ works - cable / sensitive cable differ works - redstoen mode works again
This commit is contained in:
@@ -1,8 +1,11 @@
|
|||||||
package storagecraft.block;
|
package storagecraft.block;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockPistonBase;
|
import net.minecraft.block.BlockPistonBase;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.properties.IProperty;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -18,6 +21,8 @@ public abstract class BlockBase extends Block
|
|||||||
{
|
{
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
protected List<IProperty> states = new ArrayList<IProperty>();
|
||||||
|
|
||||||
public BlockBase(String name)
|
public BlockBase(String name)
|
||||||
{
|
{
|
||||||
super(Material.rock);
|
super(Material.rock);
|
||||||
@@ -73,7 +78,7 @@ public abstract class BlockBase extends Block
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state) // @TODO: Make this work all
|
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||||
{
|
{
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
|
|
||||||
@@ -82,6 +87,6 @@ public abstract class BlockBase extends Block
|
|||||||
InventoryUtils.dropInventory(world, ((TileBase) tile).getDroppedInventory(), pos.getX(), pos.getY(), pos.getZ());
|
InventoryUtils.dropInventory(world, ((TileBase) tile).getDroppedInventory(), pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onBlockDestroyedByPlayer(world, pos, state);
|
super.breakBlock(world, pos, state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -34,13 +34,13 @@ public class BlockCable extends BlockBase implements ITileEntityProvider
|
|||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta)
|
public IBlockState getStateFromMeta(int meta)
|
||||||
{
|
{
|
||||||
return getDefaultState().withProperty(SENSITIVE, meta == 1 ? true : false);
|
return getDefaultState().withProperty(SENSITIVE, meta == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state)
|
public int getMetaFromState(IBlockState state)
|
||||||
{
|
{
|
||||||
return ((Boolean) state.getValue(SENSITIVE)) ? 0 : 1;
|
return ((Boolean) state.getValue(SENSITIVE)) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -62,11 +62,11 @@ public class BlockController extends BlockBase implements ITileEntityProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state) // @TODO: What about explosions?
|
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||||
{
|
{
|
||||||
((TileController) world.getTileEntity(pos)).onDestroyed();
|
((TileController) world.getTileEntity(pos)).onDestroyed();
|
||||||
|
|
||||||
super.onBlockDestroyedByPlayer(world, pos, state);
|
super.breakBlock(world, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -1,17 +1,27 @@
|
|||||||
package storagecraft.block;
|
package storagecraft.block;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import net.minecraft.block.properties.IProperty;
|
||||||
|
import net.minecraft.block.properties.PropertyEnum;
|
||||||
|
import net.minecraft.block.state.BlockState;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.BlockPos;
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import storagecraft.StorageCraft;
|
import storagecraft.StorageCraft;
|
||||||
import storagecraft.StorageCraftGUI;
|
import storagecraft.StorageCraftGUI;
|
||||||
|
import static storagecraft.block.BlockMachine.CONNECTED;
|
||||||
import storagecraft.tile.TileGrid;
|
import storagecraft.tile.TileGrid;
|
||||||
|
|
||||||
public class BlockGrid extends BlockMachine
|
public class BlockGrid extends BlockMachine
|
||||||
{
|
{
|
||||||
|
public static final PropertyEnum TYPE = PropertyEnum.create("type", EnumGridType.class);
|
||||||
|
|
||||||
public BlockGrid()
|
public BlockGrid()
|
||||||
{
|
{
|
||||||
super("grid");
|
super("grid");
|
||||||
@@ -23,6 +33,54 @@ public class BlockGrid extends BlockMachine
|
|||||||
return new TileGrid();
|
return new TileGrid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getSubBlocks(Item item, CreativeTabs tab, List subItems)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
subItems.add(new ItemStack(item, 1, i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected BlockState createBlockState()
|
||||||
|
{
|
||||||
|
return new BlockState(this, new IProperty[]
|
||||||
|
{
|
||||||
|
CONNECTED,
|
||||||
|
TYPE
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IBlockState getStateFromMeta(int meta)
|
||||||
|
{
|
||||||
|
switch (meta)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
return getDefaultState().withProperty(CONNECTED, false).withProperty(TYPE, EnumGridType.NORMAL);
|
||||||
|
case 1:
|
||||||
|
return getDefaultState().withProperty(CONNECTED, false).withProperty(TYPE, EnumGridType.CRAFTING);
|
||||||
|
case 2:
|
||||||
|
return getDefaultState().withProperty(CONNECTED, true).withProperty(TYPE, EnumGridType.NORMAL);
|
||||||
|
case 3:
|
||||||
|
return getDefaultState().withProperty(CONNECTED, true).withProperty(TYPE, EnumGridType.CRAFTING);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMetaFromState(IBlockState state)
|
||||||
|
{
|
||||||
|
if ((Boolean) state.getValue(CONNECTED))
|
||||||
|
{
|
||||||
|
return state.getValue(TYPE) == EnumGridType.NORMAL ? 2 : 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
return state.getValue(TYPE) == EnumGridType.NORMAL ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
|
@@ -9,14 +9,14 @@ import net.minecraft.block.state.IBlockState;
|
|||||||
public abstract class BlockMachine extends BlockBase implements ITileEntityProvider
|
public abstract class BlockMachine extends BlockBase implements ITileEntityProvider
|
||||||
{
|
{
|
||||||
public static final PropertyBool CONNECTED = PropertyBool.create("connected");
|
public static final PropertyBool CONNECTED = PropertyBool.create("connected");
|
||||||
|
|
||||||
public BlockMachine(String name)
|
public BlockMachine(String name)
|
||||||
{
|
{
|
||||||
super(name);
|
super(name);
|
||||||
|
|
||||||
this.setDefaultState(this.blockState.getBaseState().withProperty(CONNECTED, false));
|
setDefaultState(blockState.getBaseState().withProperty(CONNECTED, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockState createBlockState()
|
protected BlockState createBlockState()
|
||||||
{
|
{
|
||||||
@@ -25,16 +25,16 @@ public abstract class BlockMachine extends BlockBase implements ITileEntityProvi
|
|||||||
CONNECTED
|
CONNECTED
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta)
|
public IBlockState getStateFromMeta(int meta)
|
||||||
{
|
{
|
||||||
return getDefaultState().withProperty(CONNECTED, meta == 1 ? true : false);
|
return getDefaultState().withProperty(CONNECTED, meta == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state)
|
public int getMetaFromState(IBlockState state)
|
||||||
{
|
{
|
||||||
return ((Boolean) state.getValue(CONNECTED)) ? 0 : 1;
|
return ((Boolean) state.getValue(CONNECTED)) ? 1 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
36
src/main/java/storagecraft/block/EnumGridType.java
Normal file
36
src/main/java/storagecraft/block/EnumGridType.java
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
package storagecraft.block;
|
||||||
|
|
||||||
|
import net.minecraft.util.IStringSerializable;
|
||||||
|
|
||||||
|
public enum EnumGridType implements IStringSerializable
|
||||||
|
{
|
||||||
|
NORMAL(0, "normal"),
|
||||||
|
CRAFTING(1, "crafting");
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
EnumGridType(int id, String name)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -1,37 +1,38 @@
|
|||||||
package storagecraft.container;
|
package storagecraft.container;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
import storagecraft.container.slot.SlotGridCraftingResult;
|
import storagecraft.block.EnumGridType;
|
||||||
import storagecraft.tile.TileGrid;
|
import storagecraft.container.slot.SlotGridCraftingResult;
|
||||||
|
import storagecraft.tile.TileGrid;
|
||||||
public class ContainerGrid extends ContainerBase
|
|
||||||
{
|
public class ContainerGrid extends ContainerBase
|
||||||
public ContainerGrid(EntityPlayer player, TileGrid grid)
|
{
|
||||||
{
|
public ContainerGrid(EntityPlayer player, TileGrid grid)
|
||||||
super(player);
|
{
|
||||||
|
super(player);
|
||||||
addPlayerInventory(8, grid.isCrafting() ? 174 : 108);
|
|
||||||
|
addPlayerInventory(8, grid.getType() == EnumGridType.CRAFTING ? 174 : 108);
|
||||||
if (grid.isCrafting())
|
|
||||||
{
|
if (grid.getType() == EnumGridType.CRAFTING)
|
||||||
int x = 25;
|
{
|
||||||
int y = 106;
|
int x = 25;
|
||||||
|
int y = 106;
|
||||||
for (int i = 0; i < 9; ++i)
|
|
||||||
{
|
for (int i = 0; i < 9; ++i)
|
||||||
addSlotToContainer(new Slot(grid.getCraftingMatrix(), i, x, y));
|
{
|
||||||
|
addSlotToContainer(new Slot(grid.getCraftingMatrix(), i, x, y));
|
||||||
x += 18;
|
|
||||||
|
x += 18;
|
||||||
if ((i + 1) % 3 == 0)
|
|
||||||
{
|
if ((i + 1) % 3 == 0)
|
||||||
y += 18;
|
{
|
||||||
x = 25;
|
y += 18;
|
||||||
}
|
x = 25;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
addSlotToContainer(new SlotGridCraftingResult(player, grid.getCraftingMatrix(), grid.getCraftingResult(), grid, 0, 137, 124));
|
|
||||||
}
|
addSlotToContainer(new SlotGridCraftingResult(player, grid.getCraftingMatrix(), grid.getCraftingResult(), grid, 0, 137, 124));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@@ -12,6 +12,7 @@ import net.minecraft.util.ResourceLocation;
|
|||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
import org.lwjgl.input.Mouse;
|
import org.lwjgl.input.Mouse;
|
||||||
import storagecraft.StorageCraft;
|
import storagecraft.StorageCraft;
|
||||||
|
import storagecraft.block.EnumGridType;
|
||||||
import storagecraft.container.ContainerGrid;
|
import storagecraft.container.ContainerGrid;
|
||||||
import storagecraft.gui.sidebutton.SideButtonGridSortingDirection;
|
import storagecraft.gui.sidebutton.SideButtonGridSortingDirection;
|
||||||
import storagecraft.gui.sidebutton.SideButtonGridSortingType;
|
import storagecraft.gui.sidebutton.SideButtonGridSortingType;
|
||||||
@@ -46,7 +47,7 @@ public class GuiGrid extends GuiBase
|
|||||||
|
|
||||||
public GuiGrid(ContainerGrid container, TileGrid grid)
|
public GuiGrid(ContainerGrid container, TileGrid grid)
|
||||||
{
|
{
|
||||||
super(container, 176, grid.isCrafting() ? 256 : 190);
|
super(container, 176, grid.getType() == EnumGridType.CRAFTING ? 256 : 190);
|
||||||
|
|
||||||
this.container = container;
|
this.container = container;
|
||||||
this.grid = grid;
|
this.grid = grid;
|
||||||
@@ -126,7 +127,7 @@ public class GuiGrid extends GuiBase
|
|||||||
@Override
|
@Override
|
||||||
public void drawBackground(int x, int y, int mouseX, int mouseY)
|
public void drawBackground(int x, int y, int mouseX, int mouseY)
|
||||||
{
|
{
|
||||||
if (grid.isCrafting())
|
if (grid.getType() == EnumGridType.CRAFTING)
|
||||||
{
|
{
|
||||||
bindTexture("gui/craftingGrid.png");
|
bindTexture("gui/craftingGrid.png");
|
||||||
}
|
}
|
||||||
@@ -145,12 +146,12 @@ public class GuiGrid extends GuiBase
|
|||||||
{
|
{
|
||||||
drawString(7, 7, t("gui.storagecraft:grid"));
|
drawString(7, 7, t("gui.storagecraft:grid"));
|
||||||
|
|
||||||
if (grid.isCrafting())
|
if (grid.getType() == EnumGridType.CRAFTING)
|
||||||
{
|
{
|
||||||
drawString(7, 94, t("container.crafting"));
|
drawString(7, 94, t("container.crafting"));
|
||||||
}
|
}
|
||||||
|
|
||||||
drawString(7, grid.isCrafting() ? 163 : 96, t("container.inventory"));
|
drawString(7, grid.getType() == EnumGridType.CRAFTING ? 163 : 96, t("container.inventory"));
|
||||||
|
|
||||||
int x = 8;
|
int x = 8;
|
||||||
int y = 20;
|
int y = 20;
|
||||||
@@ -202,7 +203,7 @@ public class GuiGrid extends GuiBase
|
|||||||
drawTooltip(mouseX, mouseY, items.get(hoveringSlotId).toItemStack());
|
drawTooltip(mouseX, mouseY, items.get(hoveringSlotId).toItemStack());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (grid.isCrafting() && isHoveringOverClear(mouseX, mouseY))
|
if (grid.getType() == EnumGridType.CRAFTING && isHoveringOverClear(mouseX, mouseY))
|
||||||
{
|
{
|
||||||
drawTooltip(mouseX, mouseY, t("misc.storagecraft:clear"));
|
drawTooltip(mouseX, mouseY, t("misc.storagecraft:clear"));
|
||||||
}
|
}
|
||||||
@@ -284,7 +285,7 @@ public class GuiGrid extends GuiBase
|
|||||||
{
|
{
|
||||||
super.mouseClicked(mouseX, mouseY, clickedButton);
|
super.mouseClicked(mouseX, mouseY, clickedButton);
|
||||||
|
|
||||||
boolean clickedClear = grid.isCrafting() && clickedButton == 0 && isHoveringOverClear(mouseX - guiLeft, mouseY - guiTop);
|
boolean clickedClear = grid.getType() == EnumGridType.CRAFTING && clickedButton == 0 && isHoveringOverClear(mouseX - guiLeft, mouseY - guiTop);
|
||||||
|
|
||||||
if (grid.isConnected())
|
if (grid.isConnected())
|
||||||
{
|
{
|
||||||
|
@@ -1,16 +1,14 @@
|
|||||||
package storagecraft.item;
|
package storagecraft.item;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemColored;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public abstract class ItemBlockBase extends ItemBlock
|
public abstract class ItemBlockBase extends ItemColored
|
||||||
{
|
{
|
||||||
public ItemBlockBase(Block block)
|
public ItemBlockBase(Block block)
|
||||||
{
|
{
|
||||||
super(block);
|
super(block, true);
|
||||||
|
|
||||||
setHasSubtypes(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -12,6 +12,7 @@ import net.minecraft.util.StatCollector;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import storagecraft.StorageCraft;
|
import storagecraft.StorageCraft;
|
||||||
import storagecraft.StorageCraftGUI;
|
import storagecraft.StorageCraftGUI;
|
||||||
|
import storagecraft.block.EnumGridType;
|
||||||
import storagecraft.tile.TileGrid;
|
import storagecraft.tile.TileGrid;
|
||||||
import storagecraft.tile.TileWirelessTransmitter;
|
import storagecraft.tile.TileWirelessTransmitter;
|
||||||
|
|
||||||
@@ -69,7 +70,7 @@ public class ItemWirelessGrid extends ItemBase
|
|||||||
|
|
||||||
if (wirelessTransmitter.isWorking())
|
if (wirelessTransmitter.isWorking())
|
||||||
{
|
{
|
||||||
TileGrid grid = wirelessTransmitter.getGrid(stack.getItemDamage());
|
TileGrid grid = wirelessTransmitter.getGrid(stack.getItemDamage() == 1 ? EnumGridType.CRAFTING : EnumGridType.NORMAL);
|
||||||
|
|
||||||
if (grid == null)
|
if (grid == null)
|
||||||
{
|
{
|
||||||
|
@@ -8,28 +8,28 @@ public enum RedstoneMode
|
|||||||
IGNORE(0),
|
IGNORE(0),
|
||||||
HIGH(1),
|
HIGH(1),
|
||||||
LOW(2);
|
LOW(2);
|
||||||
|
|
||||||
public static final String NBT = "RedstoneMode";
|
public static final String NBT = "RedstoneMode";
|
||||||
|
|
||||||
public final int id;
|
public final int id;
|
||||||
|
|
||||||
RedstoneMode(int id)
|
RedstoneMode(int id)
|
||||||
{
|
{
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RedstoneMode next()
|
public RedstoneMode next()
|
||||||
{
|
{
|
||||||
RedstoneMode next = getById(id + 1);
|
RedstoneMode next = getById(id + 1);
|
||||||
|
|
||||||
if (next == null)
|
if (next == null)
|
||||||
{
|
{
|
||||||
return getById(0);
|
return getById(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEnabled(World world, BlockPos pos)
|
public boolean isEnabled(World world, BlockPos pos)
|
||||||
{
|
{
|
||||||
switch (this)
|
switch (this)
|
||||||
@@ -37,14 +37,14 @@ public enum RedstoneMode
|
|||||||
case IGNORE:
|
case IGNORE:
|
||||||
return true;
|
return true;
|
||||||
case HIGH:
|
case HIGH:
|
||||||
return true; // @TODO: ...
|
return world.isBlockPowered(pos);
|
||||||
case LOW:
|
case LOW:
|
||||||
return true;
|
return !world.isBlockPowered(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RedstoneMode getById(int id)
|
public static RedstoneMode getById(int id)
|
||||||
{
|
{
|
||||||
for (RedstoneMode control : values())
|
for (RedstoneMode control : values())
|
||||||
@@ -54,7 +54,7 @@ public enum RedstoneMode
|
|||||||
return control;
|
return control;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -84,7 +84,7 @@ public abstract class TileBase extends TileEntity implements IUpdatePlayerListBo
|
|||||||
@Override
|
@Override
|
||||||
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newState)
|
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newState)
|
||||||
{
|
{
|
||||||
return false;
|
return oldState.getBlock() != newState.getBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IInventory getDroppedInventory()
|
public IInventory getDroppedInventory()
|
||||||
|
@@ -28,14 +28,12 @@ public class TileCable extends TileBase
|
|||||||
|
|
||||||
public boolean isPowered()
|
public boolean isPowered()
|
||||||
{
|
{
|
||||||
// @TODO: return worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord);
|
return worldObj.isBlockPowered(pos);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSensitiveCable()
|
public boolean isSensitiveCable()
|
||||||
{
|
{
|
||||||
// @TODO: return worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 1;
|
return (Boolean) worldObj.getBlockState(pos).getValue(BlockCable.SENSITIVE);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEnabled()
|
public boolean isEnabled()
|
||||||
|
@@ -7,6 +7,8 @@ import net.minecraft.item.crafting.CraftingManager;
|
|||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint;
|
import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
import storagecraft.StorageCraft;
|
import storagecraft.StorageCraft;
|
||||||
|
import storagecraft.block.BlockGrid;
|
||||||
|
import storagecraft.block.EnumGridType;
|
||||||
import storagecraft.container.ContainerGridCrafting;
|
import storagecraft.container.ContainerGridCrafting;
|
||||||
import storagecraft.inventory.InventorySimple;
|
import storagecraft.inventory.InventorySimple;
|
||||||
import storagecraft.network.MessageGridCraftingUpdate;
|
import storagecraft.network.MessageGridCraftingUpdate;
|
||||||
@@ -30,14 +32,9 @@ public class TileGrid extends TileMachine
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getType()
|
public EnumGridType getType()
|
||||||
{
|
{
|
||||||
return 0; // @TODO: Make other grid work too
|
return (EnumGridType) worldObj.getBlockState(pos).getValue(BlockGrid.TYPE);
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isCrafting()
|
|
||||||
{
|
|
||||||
return getType() == 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public InventoryCrafting getCraftingMatrix()
|
public InventoryCrafting getCraftingMatrix()
|
||||||
|
@@ -6,6 +6,7 @@ import net.minecraft.inventory.IInventory;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.IChatComponent;
|
import net.minecraft.util.IChatComponent;
|
||||||
|
import storagecraft.block.EnumGridType;
|
||||||
import storagecraft.inventory.InventorySimple;
|
import storagecraft.inventory.InventorySimple;
|
||||||
import storagecraft.item.ItemWirelessGrid;
|
import storagecraft.item.ItemWirelessGrid;
|
||||||
import storagecraft.util.InventoryUtils;
|
import storagecraft.util.InventoryUtils;
|
||||||
@@ -87,7 +88,7 @@ public class TileWirelessTransmitter extends TileMachine implements IInventory
|
|||||||
return progress;
|
return progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TileGrid getGrid(int type)
|
public TileGrid getGrid(EnumGridType type)
|
||||||
{
|
{
|
||||||
for (TileMachine machine : getController().getMachines())
|
for (TileMachine machine : getController().getMachines())
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user