Switch to IntelliJ
0
.gitignore
vendored
Normal file → Executable file
0
LICENSE.md
Normal file → Executable file
0
build.gradle
Normal file → Executable file
0
gradlew.bat
vendored
Normal file → Executable file
0
logo.png
Normal file → Executable file
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
0
screenshots/crafting_grid.png
Normal file → Executable file
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 90 KiB |
0
screenshots/interface.png
Normal file → Executable file
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
0
screenshots/overview.png
Normal file → Executable file
Before Width: | Height: | Size: 558 KiB After Width: | Height: | Size: 558 KiB |
0
screenshots/relays.png
Normal file → Executable file
Before Width: | Height: | Size: 130 KiB After Width: | Height: | Size: 130 KiB |
0
screenshots/storage_block.png
Normal file → Executable file
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
0
src/main/java/cofh/api/CoFHAPIProps.java
Normal file → Executable file
0
src/main/java/cofh/api/energy/EnergyStorage.java
Normal file → Executable file
0
src/main/java/cofh/api/energy/IEnergyConnection.java
Normal file → Executable file
0
src/main/java/cofh/api/energy/IEnergyContainerItem.java
Normal file → Executable file
0
src/main/java/cofh/api/energy/IEnergyHandler.java
Normal file → Executable file
0
src/main/java/cofh/api/energy/IEnergyProvider.java
Normal file → Executable file
0
src/main/java/cofh/api/energy/IEnergyReceiver.java
Normal file → Executable file
0
src/main/java/cofh/api/energy/IEnergyStorage.java
Normal file → Executable file
0
src/main/java/cofh/api/energy/ItemEnergyContainer.java
Normal file → Executable file
0
src/main/java/cofh/api/energy/TileEnergyHandler.java
Normal file → Executable file
0
src/main/java/cofh/api/energy/package-info.java
Normal file → Executable file
0
src/main/java/cofh/api/package-info.java
Normal file → Executable file
21
src/main/java/refinedstorage/RefinedStorage.java
Normal file → Executable file
@@ -16,24 +16,20 @@ import refinedstorage.item.ItemStorageCell;
|
|||||||
import refinedstorage.proxy.CommonProxy;
|
import refinedstorage.proxy.CommonProxy;
|
||||||
|
|
||||||
@Mod(modid = RefinedStorage.ID, version = RefinedStorage.VERSION)
|
@Mod(modid = RefinedStorage.ID, version = RefinedStorage.VERSION)
|
||||||
public final class RefinedStorage
|
public final class RefinedStorage {
|
||||||
{
|
|
||||||
public static final String ID = "refinedstorage";
|
public static final String ID = "refinedstorage";
|
||||||
public static final String VERSION = "0.5";
|
public static final String VERSION = "0.5";
|
||||||
|
|
||||||
public static final SimpleNetworkWrapper NETWORK = NetworkRegistry.INSTANCE.newSimpleChannel(ID);
|
public static final SimpleNetworkWrapper NETWORK = NetworkRegistry.INSTANCE.newSimpleChannel(ID);
|
||||||
|
|
||||||
public static final CreativeTabs TAB = new CreativeTabs(ID)
|
public static final CreativeTabs TAB = new CreativeTabs(ID) {
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getIconItemStack()
|
public ItemStack getIconItemStack() {
|
||||||
{
|
|
||||||
return new ItemStack(RefinedStorageItems.STORAGE_CELL, 1, ItemStorageCell.TYPE_1K);
|
return new ItemStack(RefinedStorageItems.STORAGE_CELL, 1, ItemStorageCell.TYPE_1K);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getTabIconItem()
|
public Item getTabIconItem() {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -45,20 +41,17 @@ public final class RefinedStorage
|
|||||||
public static RefinedStorage INSTANCE;
|
public static RefinedStorage INSTANCE;
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void preInit(FMLPreInitializationEvent e)
|
public void preInit(FMLPreInitializationEvent e) {
|
||||||
{
|
|
||||||
PROXY.preInit(e);
|
PROXY.preInit(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void init(FMLInitializationEvent e)
|
public void init(FMLInitializationEvent e) {
|
||||||
{
|
|
||||||
PROXY.init(e);
|
PROXY.init(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void postInit(FMLPostInitializationEvent e)
|
public void postInit(FMLPostInitializationEvent e) {
|
||||||
{
|
|
||||||
PROXY.postInit(e);
|
PROXY.postInit(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
3
src/main/java/refinedstorage/RefinedStorageBlocks.java
Normal file → Executable file
@@ -2,8 +2,7 @@ package refinedstorage;
|
|||||||
|
|
||||||
import refinedstorage.block.*;
|
import refinedstorage.block.*;
|
||||||
|
|
||||||
public final class RefinedStorageBlocks
|
public final class RefinedStorageBlocks {
|
||||||
{
|
|
||||||
public static final BlockController CONTROLLER = new BlockController();
|
public static final BlockController CONTROLLER = new BlockController();
|
||||||
public static final BlockCable CABLE = new BlockCable();
|
public static final BlockCable CABLE = new BlockCable();
|
||||||
public static final BlockGrid GRID = new BlockGrid();
|
public static final BlockGrid GRID = new BlockGrid();
|
||||||
|
3
src/main/java/refinedstorage/RefinedStorageGui.java
Normal file → Executable file
@@ -1,7 +1,6 @@
|
|||||||
package refinedstorage;
|
package refinedstorage;
|
||||||
|
|
||||||
public final class RefinedStorageGui
|
public final class RefinedStorageGui {
|
||||||
{
|
|
||||||
public static final int CONTROLLER = 0;
|
public static final int CONTROLLER = 0;
|
||||||
public static final int GRID = 1;
|
public static final int GRID = 1;
|
||||||
public static final int DRIVE = 2;
|
public static final int DRIVE = 2;
|
||||||
|
3
src/main/java/refinedstorage/RefinedStorageItems.java
Normal file → Executable file
@@ -2,8 +2,7 @@ package refinedstorage;
|
|||||||
|
|
||||||
import refinedstorage.item.*;
|
import refinedstorage.item.*;
|
||||||
|
|
||||||
public final class RefinedStorageItems
|
public final class RefinedStorageItems {
|
||||||
{
|
|
||||||
public static final ItemStorageCell STORAGE_CELL = new ItemStorageCell();
|
public static final ItemStorageCell STORAGE_CELL = new ItemStorageCell();
|
||||||
public static final ItemWirelessGrid WIRELESS_GRID = new ItemWirelessGrid();
|
public static final ItemWirelessGrid WIRELESS_GRID = new ItemWirelessGrid();
|
||||||
public static final ItemWirelessGridPlate WIRELESS_GRID_PLATE = new ItemWirelessGridPlate();
|
public static final ItemWirelessGridPlate WIRELESS_GRID_PLATE = new ItemWirelessGridPlate();
|
||||||
|
48
src/main/java/refinedstorage/block/BlockBase.java
Normal file → Executable file
@@ -18,14 +18,12 @@ import refinedstorage.RefinedStorage;
|
|||||||
import refinedstorage.tile.TileBase;
|
import refinedstorage.tile.TileBase;
|
||||||
import refinedstorage.util.InventoryUtils;
|
import refinedstorage.util.InventoryUtils;
|
||||||
|
|
||||||
public abstract class BlockBase extends Block
|
public abstract class BlockBase extends Block {
|
||||||
{
|
|
||||||
public static final PropertyDirection DIRECTION = PropertyDirection.create("direction");
|
public static final PropertyDirection DIRECTION = PropertyDirection.create("direction");
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
public BlockBase(String name)
|
public BlockBase(String name) {
|
||||||
{
|
|
||||||
super(Material.rock);
|
super(Material.rock);
|
||||||
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@@ -35,14 +33,12 @@ public abstract class BlockBase extends Block
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUnlocalizedName()
|
public String getUnlocalizedName() {
|
||||||
{
|
|
||||||
return "block." + RefinedStorage.ID + ":" + name;
|
return "block." + RefinedStorage.ID + ":" + name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState()
|
protected BlockStateContainer createBlockState() {
|
||||||
{
|
|
||||||
return new BlockStateContainer(this, new IProperty[]
|
return new BlockStateContainer(this, new IProperty[]
|
||||||
{
|
{
|
||||||
DIRECTION,
|
DIRECTION,
|
||||||
@@ -50,24 +46,20 @@ public abstract class BlockBase extends Block
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta)
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
{
|
|
||||||
return getDefaultState();
|
return getDefaultState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state)
|
public int getMetaFromState(IBlockState state) {
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos)
|
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||||
{
|
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
|
|
||||||
if (tile instanceof TileBase)
|
if (tile instanceof TileBase) {
|
||||||
{
|
|
||||||
return state.withProperty(DIRECTION, ((TileBase) tile).getDirection());
|
return state.withProperty(DIRECTION, ((TileBase) tile).getDirection());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,24 +67,20 @@ public abstract class BlockBase extends Block
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(IBlockState state)
|
public int damageDropped(IBlockState state) {
|
||||||
{
|
|
||||||
return getMetaFromState(state);
|
return getMetaFromState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
|
public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) {
|
||||||
{
|
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
|
|
||||||
if (tile instanceof TileBase)
|
if (tile instanceof TileBase) {
|
||||||
{
|
|
||||||
EnumFacing dir = ((TileBase) tile).getDirection();
|
EnumFacing dir = ((TileBase) tile).getDirection();
|
||||||
|
|
||||||
int newDir = dir.ordinal() + 1;
|
int newDir = dir.ordinal() + 1;
|
||||||
|
|
||||||
if (newDir > EnumFacing.VALUES.length - 1)
|
if (newDir > EnumFacing.VALUES.length - 1) {
|
||||||
{
|
|
||||||
newDir = 0;
|
newDir = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,25 +95,21 @@ public abstract class BlockBase extends Block
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack itemStack)
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack itemStack) {
|
||||||
{
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, itemStack);
|
super.onBlockPlacedBy(world, pos, state, player, itemStack);
|
||||||
|
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
|
|
||||||
if (tile instanceof TileBase)
|
if (tile instanceof TileBase) {
|
||||||
{
|
|
||||||
((TileBase) tile).setDirection(BlockPistonBase.getFacingFromEntity(pos, player));
|
((TileBase) tile).setDirection(BlockPistonBase.getFacingFromEntity(pos, player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
||||||
{
|
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
|
|
||||||
if (tile instanceof TileBase && ((TileBase) tile).getDroppedInventory() != null)
|
if (tile instanceof TileBase && ((TileBase) tile).getDroppedInventory() != null) {
|
||||||
{
|
|
||||||
InventoryUtils.dropInventory(world, ((TileBase) tile).getDroppedInventory(), pos.getX(), pos.getY(), pos.getZ());
|
InventoryUtils.dropInventory(world, ((TileBase) tile).getDroppedInventory(), pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
30
src/main/java/refinedstorage/block/BlockCable.java
Normal file → Executable file
@@ -11,8 +11,7 @@ import net.minecraft.world.IBlockAccess;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import refinedstorage.tile.TileCable;
|
import refinedstorage.tile.TileCable;
|
||||||
|
|
||||||
public class BlockCable extends BlockBase
|
public class BlockCable extends BlockBase {
|
||||||
{
|
|
||||||
public static final PropertyBool NORTH = PropertyBool.create("north");
|
public static final PropertyBool NORTH = PropertyBool.create("north");
|
||||||
public static final PropertyBool EAST = PropertyBool.create("east");
|
public static final PropertyBool EAST = PropertyBool.create("east");
|
||||||
public static final PropertyBool SOUTH = PropertyBool.create("south");
|
public static final PropertyBool SOUTH = PropertyBool.create("south");
|
||||||
@@ -20,14 +19,12 @@ public class BlockCable extends BlockBase
|
|||||||
public static final PropertyBool UP = PropertyBool.create("up");
|
public static final PropertyBool UP = PropertyBool.create("up");
|
||||||
public static final PropertyBool DOWN = PropertyBool.create("down");
|
public static final PropertyBool DOWN = PropertyBool.create("down");
|
||||||
|
|
||||||
public BlockCable()
|
public BlockCable() {
|
||||||
{
|
|
||||||
super("cable");
|
super("cable");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState()
|
protected BlockStateContainer createBlockState() {
|
||||||
{
|
|
||||||
return new BlockStateContainer(this, new IProperty[]
|
return new BlockStateContainer(this, new IProperty[]
|
||||||
{
|
{
|
||||||
DIRECTION,
|
DIRECTION,
|
||||||
@@ -41,8 +38,7 @@ public class BlockCable extends BlockBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos)
|
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||||
{
|
|
||||||
return super.getActualState(state, world, pos)
|
return super.getActualState(state, world, pos)
|
||||||
.withProperty(NORTH, TileCable.hasConnectionWith(world, pos.north()))
|
.withProperty(NORTH, TileCable.hasConnectionWith(world, pos.north()))
|
||||||
.withProperty(EAST, TileCable.hasConnectionWith(world, pos.east()))
|
.withProperty(EAST, TileCable.hasConnectionWith(world, pos.east()))
|
||||||
@@ -53,40 +49,34 @@ public class BlockCable extends BlockBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos)
|
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||||
{
|
|
||||||
float pixel = 1F / 16F;
|
float pixel = 1F / 16F;
|
||||||
|
|
||||||
return new AxisAlignedBB(4 * pixel, 4 * pixel, 4 * pixel, 1 - 4 * pixel, 1 - 4 * pixel, 1 - 4 * pixel);
|
return new AxisAlignedBB(4 * pixel, 4 * pixel, 4 * pixel, 1 - 4 * pixel, 1 - 4 * pixel, 1 - 4 * pixel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, World world, BlockPos pos)
|
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, World world, BlockPos pos) {
|
||||||
{
|
|
||||||
return getBoundingBox(state, world, pos);
|
return getBoundingBox(state, world, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasTileEntity(IBlockState state)
|
public boolean hasTileEntity(IBlockState state) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createTileEntity(World world, IBlockState state)
|
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||||
{
|
|
||||||
return new TileCable();
|
return new TileCable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state)
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state)
|
public boolean isFullCube(IBlockState state) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
15
src/main/java/refinedstorage/block/BlockConstructor.java
Normal file → Executable file
@@ -11,24 +11,19 @@ import refinedstorage.RefinedStorage;
|
|||||||
import refinedstorage.RefinedStorageGui;
|
import refinedstorage.RefinedStorageGui;
|
||||||
import refinedstorage.tile.TileConstructor;
|
import refinedstorage.tile.TileConstructor;
|
||||||
|
|
||||||
public class BlockConstructor extends BlockMachine
|
public class BlockConstructor extends BlockMachine {
|
||||||
{
|
public BlockConstructor() {
|
||||||
public BlockConstructor()
|
|
||||||
{
|
|
||||||
super("constructor");
|
super("constructor");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createTileEntity(World world, IBlockState state)
|
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||||
{
|
|
||||||
return new TileConstructor();
|
return new TileConstructor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, net.minecraft.util.math.BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(World world, net.minecraft.util.math.BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
{
|
if (!world.isRemote) {
|
||||||
if (!world.isRemote)
|
|
||||||
{
|
|
||||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.CONSTRUCTOR, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.CONSTRUCTOR, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
48
src/main/java/refinedstorage/block/BlockController.java
Normal file → Executable file
@@ -1,6 +1,5 @@
|
|||||||
package refinedstorage.block;
|
package refinedstorage.block;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
import net.minecraft.block.properties.PropertyEnum;
|
import net.minecraft.block.properties.PropertyEnum;
|
||||||
import net.minecraft.block.properties.PropertyInteger;
|
import net.minecraft.block.properties.PropertyInteger;
|
||||||
@@ -20,28 +19,25 @@ import refinedstorage.RefinedStorage;
|
|||||||
import refinedstorage.RefinedStorageGui;
|
import refinedstorage.RefinedStorageGui;
|
||||||
import refinedstorage.tile.TileController;
|
import refinedstorage.tile.TileController;
|
||||||
|
|
||||||
public class BlockController extends BlockBase
|
import java.util.List;
|
||||||
{
|
|
||||||
|
public class BlockController extends BlockBase {
|
||||||
public static final PropertyEnum TYPE = PropertyEnum.create("type", EnumControllerType.class);
|
public static final PropertyEnum TYPE = PropertyEnum.create("type", EnumControllerType.class);
|
||||||
public static final PropertyInteger ENERGY = PropertyInteger.create("energy", 0, 8);
|
public static final PropertyInteger ENERGY = PropertyInteger.create("energy", 0, 8);
|
||||||
|
|
||||||
public BlockController()
|
public BlockController() {
|
||||||
{
|
|
||||||
super("controller");
|
super("controller");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item item, CreativeTabs tab, List subItems)
|
public void getSubBlocks(Item item, CreativeTabs tab, List subItems) {
|
||||||
{
|
for (int i = 0; i <= 1; i++) {
|
||||||
for (int i = 0; i <= 1; i++)
|
|
||||||
{
|
|
||||||
subItems.add(new ItemStack(item, 1, i));
|
subItems.add(new ItemStack(item, 1, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState()
|
protected BlockStateContainer createBlockState() {
|
||||||
{
|
|
||||||
return new BlockStateContainer(this, new IProperty[]
|
return new BlockStateContainer(this, new IProperty[]
|
||||||
{
|
{
|
||||||
DIRECTION,
|
DIRECTION,
|
||||||
@@ -51,41 +47,34 @@ public class BlockController extends BlockBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta)
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
{
|
|
||||||
return getDefaultState().withProperty(TYPE, meta == 0 ? EnumControllerType.NORMAL : EnumControllerType.CREATIVE);
|
return getDefaultState().withProperty(TYPE, meta == 0 ? EnumControllerType.NORMAL : EnumControllerType.CREATIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state)
|
public int getMetaFromState(IBlockState state) {
|
||||||
{
|
|
||||||
return state.getValue(TYPE) == EnumControllerType.NORMAL ? 0 : 1;
|
return state.getValue(TYPE) == EnumControllerType.NORMAL ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos)
|
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||||
{
|
|
||||||
return super.getActualState(state, world, pos)
|
return super.getActualState(state, world, pos)
|
||||||
.withProperty(ENERGY, ((TileController) world.getTileEntity(pos)).getEnergyScaled(8));
|
.withProperty(ENERGY, ((TileController) world.getTileEntity(pos)).getEnergyScaled(8));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasTileEntity(IBlockState state)
|
public boolean hasTileEntity(IBlockState state) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createTileEntity(World world, IBlockState state)
|
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||||
{
|
|
||||||
return new TileController();
|
return new TileController();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
{
|
if (!world.isRemote) {
|
||||||
if (!world.isRemote)
|
|
||||||
{
|
|
||||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.CONTROLLER, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.CONTROLLER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,22 +82,19 @@ public class BlockController extends BlockBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
||||||
{
|
|
||||||
((TileController) world.getTileEntity(pos)).onDestroyed();
|
((TileController) world.getTileEntity(pos)).onDestroyed();
|
||||||
|
|
||||||
super.breakBlock(world, pos, state);
|
super.breakBlock(world, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasComparatorInputOverride(IBlockState state)
|
public boolean hasComparatorInputOverride(IBlockState state) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getComparatorInputOverride(IBlockState state, World world, BlockPos pos)
|
public int getComparatorInputOverride(IBlockState state, World world, BlockPos pos) {
|
||||||
{
|
|
||||||
return ((TileController) world.getTileEntity(pos)).getEnergyScaled(15);
|
return ((TileController) world.getTileEntity(pos)).getEnergyScaled(15);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
15
src/main/java/refinedstorage/block/BlockDestructor.java
Normal file → Executable file
@@ -11,24 +11,19 @@ import refinedstorage.RefinedStorage;
|
|||||||
import refinedstorage.RefinedStorageGui;
|
import refinedstorage.RefinedStorageGui;
|
||||||
import refinedstorage.tile.TileDestructor;
|
import refinedstorage.tile.TileDestructor;
|
||||||
|
|
||||||
public class BlockDestructor extends BlockMachine
|
public class BlockDestructor extends BlockMachine {
|
||||||
{
|
public BlockDestructor() {
|
||||||
public BlockDestructor()
|
|
||||||
{
|
|
||||||
super("destructor");
|
super("destructor");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createTileEntity(World world, IBlockState state)
|
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||||
{
|
|
||||||
return new TileDestructor();
|
return new TileDestructor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, net.minecraft.util.math.BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(World world, net.minecraft.util.math.BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
{
|
if (!world.isRemote) {
|
||||||
if (!world.isRemote)
|
|
||||||
{
|
|
||||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.DESTRUCTOR, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.DESTRUCTOR, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
33
src/main/java/refinedstorage/block/BlockDetector.java
Normal file → Executable file
@@ -16,18 +16,15 @@ import refinedstorage.RefinedStorage;
|
|||||||
import refinedstorage.RefinedStorageGui;
|
import refinedstorage.RefinedStorageGui;
|
||||||
import refinedstorage.tile.TileDetector;
|
import refinedstorage.tile.TileDetector;
|
||||||
|
|
||||||
public class BlockDetector extends BlockMachine
|
public class BlockDetector extends BlockMachine {
|
||||||
{
|
|
||||||
public static final PropertyBool POWERED = PropertyBool.create("powered");
|
public static final PropertyBool POWERED = PropertyBool.create("powered");
|
||||||
|
|
||||||
public BlockDetector()
|
public BlockDetector() {
|
||||||
{
|
|
||||||
super("detector");
|
super("detector");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState()
|
protected BlockStateContainer createBlockState() {
|
||||||
{
|
|
||||||
return new BlockStateContainer(this, new IProperty[]
|
return new BlockStateContainer(this, new IProperty[]
|
||||||
{
|
{
|
||||||
DIRECTION,
|
DIRECTION,
|
||||||
@@ -37,25 +34,21 @@ public class BlockDetector extends BlockMachine
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos)
|
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||||
{
|
|
||||||
return super.getActualState(state, world, pos)
|
return super.getActualState(state, world, pos)
|
||||||
.withProperty(POWERED, ((TileDetector) world.getTileEntity(pos)).isPowered());
|
.withProperty(POWERED, ((TileDetector) world.getTileEntity(pos)).isPowered());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createTileEntity(World world, IBlockState state)
|
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||||
{
|
|
||||||
return new TileDetector();
|
return new TileDetector();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getWeakPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side)
|
public int getWeakPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||||
{
|
|
||||||
TileDetector detector = (TileDetector) world.getTileEntity(pos);
|
TileDetector detector = (TileDetector) world.getTileEntity(pos);
|
||||||
|
|
||||||
if (detector.getDirection() == side.getOpposite())
|
if (detector.getDirection() == side.getOpposite()) {
|
||||||
{
|
|
||||||
return detector.isPowered() ? 15 : 0;
|
return detector.isPowered() ? 15 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,22 +56,18 @@ public class BlockDetector extends BlockMachine
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStrongPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side)
|
public int getStrongPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||||
{
|
|
||||||
return getWeakPower(state, world, pos, side);
|
return getWeakPower(state, world, pos, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canProvidePower(IBlockState state)
|
public boolean canProvidePower(IBlockState state) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, net.minecraft.util.math.BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(World world, net.minecraft.util.math.BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
{
|
if (!world.isRemote) {
|
||||||
if (!world.isRemote)
|
|
||||||
{
|
|
||||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.DETECTOR, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.DETECTOR, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
15
src/main/java/refinedstorage/block/BlockDrive.java
Normal file → Executable file
@@ -11,24 +11,19 @@ import refinedstorage.RefinedStorage;
|
|||||||
import refinedstorage.RefinedStorageGui;
|
import refinedstorage.RefinedStorageGui;
|
||||||
import refinedstorage.tile.TileDrive;
|
import refinedstorage.tile.TileDrive;
|
||||||
|
|
||||||
public class BlockDrive extends BlockMachine
|
public class BlockDrive extends BlockMachine {
|
||||||
{
|
public BlockDrive() {
|
||||||
public BlockDrive()
|
|
||||||
{
|
|
||||||
super("drive");
|
super("drive");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createTileEntity(World world, IBlockState state)
|
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||||
{
|
|
||||||
return new TileDrive();
|
return new TileDrive();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, net.minecraft.util.math.BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(World world, net.minecraft.util.math.BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
{
|
if (!world.isRemote) {
|
||||||
if (!world.isRemote)
|
|
||||||
{
|
|
||||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.DRIVE, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.DRIVE, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
15
src/main/java/refinedstorage/block/BlockExporter.java
Normal file → Executable file
@@ -11,24 +11,19 @@ import refinedstorage.RefinedStorage;
|
|||||||
import refinedstorage.RefinedStorageGui;
|
import refinedstorage.RefinedStorageGui;
|
||||||
import refinedstorage.tile.TileExporter;
|
import refinedstorage.tile.TileExporter;
|
||||||
|
|
||||||
public class BlockExporter extends BlockMachine
|
public class BlockExporter extends BlockMachine {
|
||||||
{
|
public BlockExporter() {
|
||||||
public BlockExporter()
|
|
||||||
{
|
|
||||||
super("exporter");
|
super("exporter");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createTileEntity(World world, IBlockState state)
|
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||||
{
|
|
||||||
return new TileExporter();
|
return new TileExporter();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, net.minecraft.util.math.BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(World world, net.minecraft.util.math.BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
{
|
if (!world.isRemote) {
|
||||||
if (!world.isRemote)
|
|
||||||
{
|
|
||||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.EXPORTER, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.EXPORTER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
15
src/main/java/refinedstorage/block/BlockExternalStorage.java
Normal file → Executable file
@@ -11,24 +11,19 @@ import refinedstorage.RefinedStorage;
|
|||||||
import refinedstorage.RefinedStorageGui;
|
import refinedstorage.RefinedStorageGui;
|
||||||
import refinedstorage.tile.TileExternalStorage;
|
import refinedstorage.tile.TileExternalStorage;
|
||||||
|
|
||||||
public class BlockExternalStorage extends BlockMachine
|
public class BlockExternalStorage extends BlockMachine {
|
||||||
{
|
public BlockExternalStorage() {
|
||||||
public BlockExternalStorage()
|
|
||||||
{
|
|
||||||
super("external_storage");
|
super("external_storage");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createTileEntity(World world, IBlockState state)
|
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||||
{
|
|
||||||
return new TileExternalStorage();
|
return new TileExternalStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, net.minecraft.util.math.BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(World world, net.minecraft.util.math.BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
{
|
if (!world.isRemote) {
|
||||||
if (!world.isRemote)
|
|
||||||
{
|
|
||||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.STORAGE, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.STORAGE, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
33
src/main/java/refinedstorage/block/BlockGrid.java
Normal file → Executable file
@@ -1,6 +1,5 @@
|
|||||||
package refinedstorage.block;
|
package refinedstorage.block;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
import net.minecraft.block.properties.PropertyEnum;
|
import net.minecraft.block.properties.PropertyEnum;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
@@ -18,33 +17,29 @@ import refinedstorage.RefinedStorage;
|
|||||||
import refinedstorage.RefinedStorageGui;
|
import refinedstorage.RefinedStorageGui;
|
||||||
import refinedstorage.tile.TileGrid;
|
import refinedstorage.tile.TileGrid;
|
||||||
|
|
||||||
public class BlockGrid extends BlockMachine
|
import java.util.List;
|
||||||
{
|
|
||||||
|
public class BlockGrid extends BlockMachine {
|
||||||
public static final PropertyEnum TYPE = PropertyEnum.create("type", EnumGridType.class);
|
public static final PropertyEnum TYPE = PropertyEnum.create("type", EnumGridType.class);
|
||||||
|
|
||||||
public BlockGrid()
|
public BlockGrid() {
|
||||||
{
|
|
||||||
super("grid");
|
super("grid");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createTileEntity(World world, IBlockState state)
|
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||||
{
|
|
||||||
return new TileGrid();
|
return new TileGrid();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item item, CreativeTabs tab, List subItems)
|
public void getSubBlocks(Item item, CreativeTabs tab, List subItems) {
|
||||||
{
|
for (int i = 0; i <= 1; i++) {
|
||||||
for (int i = 0; i <= 1; i++)
|
|
||||||
{
|
|
||||||
subItems.add(new ItemStack(item, 1, i));
|
subItems.add(new ItemStack(item, 1, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState()
|
protected BlockStateContainer createBlockState() {
|
||||||
{
|
|
||||||
return new BlockStateContainer(this, new IProperty[]
|
return new BlockStateContainer(this, new IProperty[]
|
||||||
{
|
{
|
||||||
DIRECTION,
|
DIRECTION,
|
||||||
@@ -54,22 +49,18 @@ public class BlockGrid extends BlockMachine
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta)
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
{
|
|
||||||
return getDefaultState().withProperty(TYPE, meta == 0 ? EnumGridType.NORMAL : EnumGridType.CRAFTING);
|
return getDefaultState().withProperty(TYPE, meta == 0 ? EnumGridType.NORMAL : EnumGridType.CRAFTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state)
|
public int getMetaFromState(IBlockState state) {
|
||||||
{
|
|
||||||
return state.getValue(TYPE) == EnumGridType.NORMAL ? 0 : 1;
|
return state.getValue(TYPE) == EnumGridType.NORMAL ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
{
|
if (!world.isRemote) {
|
||||||
if (!world.isRemote)
|
|
||||||
{
|
|
||||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.GRID, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.GRID, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
15
src/main/java/refinedstorage/block/BlockImporter.java
Normal file → Executable file
@@ -11,24 +11,19 @@ import refinedstorage.RefinedStorage;
|
|||||||
import refinedstorage.RefinedStorageGui;
|
import refinedstorage.RefinedStorageGui;
|
||||||
import refinedstorage.tile.TileImporter;
|
import refinedstorage.tile.TileImporter;
|
||||||
|
|
||||||
public class BlockImporter extends BlockMachine
|
public class BlockImporter extends BlockMachine {
|
||||||
{
|
public BlockImporter() {
|
||||||
public BlockImporter()
|
|
||||||
{
|
|
||||||
super("importer");
|
super("importer");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createTileEntity(World world, IBlockState state)
|
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||||
{
|
|
||||||
return new TileImporter();
|
return new TileImporter();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, net.minecraft.util.math.BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(World world, net.minecraft.util.math.BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
{
|
if (!world.isRemote) {
|
||||||
if (!world.isRemote)
|
|
||||||
{
|
|
||||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.IMPORTER, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.IMPORTER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
15
src/main/java/refinedstorage/block/BlockInterface.java
Normal file → Executable file
@@ -11,24 +11,19 @@ import refinedstorage.RefinedStorage;
|
|||||||
import refinedstorage.RefinedStorageGui;
|
import refinedstorage.RefinedStorageGui;
|
||||||
import refinedstorage.tile.TileInterface;
|
import refinedstorage.tile.TileInterface;
|
||||||
|
|
||||||
public class BlockInterface extends BlockMachine
|
public class BlockInterface extends BlockMachine {
|
||||||
{
|
public BlockInterface() {
|
||||||
public BlockInterface()
|
|
||||||
{
|
|
||||||
super("interface");
|
super("interface");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createTileEntity(World world, IBlockState state)
|
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||||
{
|
|
||||||
return new TileInterface();
|
return new TileInterface();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, net.minecraft.util.math.BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(World world, net.minecraft.util.math.BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
{
|
if (!world.isRemote) {
|
||||||
if (!world.isRemote)
|
|
||||||
{
|
|
||||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.INTERFACE, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.INTERFACE, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
15
src/main/java/refinedstorage/block/BlockMachine.java
Normal file → Executable file
@@ -8,24 +8,20 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import refinedstorage.tile.TileMachine;
|
import refinedstorage.tile.TileMachine;
|
||||||
|
|
||||||
public abstract class BlockMachine extends BlockBase
|
public abstract class BlockMachine extends BlockBase {
|
||||||
{
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasTileEntity(IBlockState state)
|
public boolean hasTileEntity(IBlockState state) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState()
|
protected BlockStateContainer createBlockState() {
|
||||||
{
|
|
||||||
return new BlockStateContainer(this, new IProperty[]
|
return new BlockStateContainer(this, new IProperty[]
|
||||||
{
|
{
|
||||||
DIRECTION,
|
DIRECTION,
|
||||||
@@ -34,8 +30,7 @@ public abstract class BlockMachine extends BlockBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos)
|
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||||
{
|
|
||||||
return super.getActualState(state, world, pos)
|
return super.getActualState(state, world, pos)
|
||||||
.withProperty(CONNECTED, ((TileMachine) world.getTileEntity(pos)).isConnected());
|
.withProperty(CONNECTED, ((TileMachine) world.getTileEntity(pos)).isConnected());
|
||||||
}
|
}
|
||||||
|
6
src/main/java/refinedstorage/block/BlockMachineCasing.java
Normal file → Executable file
@@ -1,9 +1,7 @@
|
|||||||
package refinedstorage.block;
|
package refinedstorage.block;
|
||||||
|
|
||||||
public class BlockMachineCasing extends BlockBase
|
public class BlockMachineCasing extends BlockBase {
|
||||||
{
|
public BlockMachineCasing() {
|
||||||
public BlockMachineCasing()
|
|
||||||
{
|
|
||||||
super("machine_casing");
|
super("machine_casing");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
15
src/main/java/refinedstorage/block/BlockRelay.java
Normal file → Executable file
@@ -12,24 +12,19 @@ import refinedstorage.RefinedStorage;
|
|||||||
import refinedstorage.RefinedStorageGui;
|
import refinedstorage.RefinedStorageGui;
|
||||||
import refinedstorage.tile.TileRelay;
|
import refinedstorage.tile.TileRelay;
|
||||||
|
|
||||||
public class BlockRelay extends BlockMachine
|
public class BlockRelay extends BlockMachine {
|
||||||
{
|
public BlockRelay() {
|
||||||
public BlockRelay()
|
|
||||||
{
|
|
||||||
super("relay");
|
super("relay");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createTileEntity(World world, IBlockState state)
|
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||||
{
|
|
||||||
return new TileRelay();
|
return new TileRelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
{
|
if (!world.isRemote) {
|
||||||
if (!world.isRemote)
|
|
||||||
{
|
|
||||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.RELAY, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.RELAY, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
15
src/main/java/refinedstorage/block/BlockSolderer.java
Normal file → Executable file
@@ -11,24 +11,19 @@ import refinedstorage.RefinedStorage;
|
|||||||
import refinedstorage.RefinedStorageGui;
|
import refinedstorage.RefinedStorageGui;
|
||||||
import refinedstorage.tile.TileSolderer;
|
import refinedstorage.tile.TileSolderer;
|
||||||
|
|
||||||
public class BlockSolderer extends BlockMachine
|
public class BlockSolderer extends BlockMachine {
|
||||||
{
|
public BlockSolderer() {
|
||||||
public BlockSolderer()
|
|
||||||
{
|
|
||||||
super("solderer");
|
super("solderer");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createTileEntity(World world, IBlockState state)
|
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||||
{
|
|
||||||
return new TileSolderer();
|
return new TileSolderer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, net.minecraft.util.math.BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(World world, net.minecraft.util.math.BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
{
|
if (!world.isRemote) {
|
||||||
if (!world.isRemote)
|
|
||||||
{
|
|
||||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.SOLDERER, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.SOLDERER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
53
src/main/java/refinedstorage/block/BlockStorage.java
Normal file → Executable file
@@ -1,7 +1,5 @@
|
|||||||
package refinedstorage.block;
|
package refinedstorage.block;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
import net.minecraft.block.properties.PropertyEnum;
|
import net.minecraft.block.properties.PropertyEnum;
|
||||||
import net.minecraft.block.state.BlockStateContainer;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
@@ -24,27 +22,25 @@ import refinedstorage.RefinedStorageGui;
|
|||||||
import refinedstorage.item.ItemBlockStorage;
|
import refinedstorage.item.ItemBlockStorage;
|
||||||
import refinedstorage.tile.TileStorage;
|
import refinedstorage.tile.TileStorage;
|
||||||
|
|
||||||
public class BlockStorage extends BlockMachine
|
import java.util.ArrayList;
|
||||||
{
|
import java.util.List;
|
||||||
|
|
||||||
|
public class BlockStorage extends BlockMachine {
|
||||||
public static final PropertyEnum TYPE = PropertyEnum.create("type", EnumStorageType.class);
|
public static final PropertyEnum TYPE = PropertyEnum.create("type", EnumStorageType.class);
|
||||||
|
|
||||||
public BlockStorage()
|
public BlockStorage() {
|
||||||
{
|
|
||||||
super("storage");
|
super("storage");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item item, CreativeTabs tab, List subItems)
|
public void getSubBlocks(Item item, CreativeTabs tab, List subItems) {
|
||||||
{
|
for (int i = 0; i <= 4; i++) {
|
||||||
for (int i = 0; i <= 4; i++)
|
|
||||||
{
|
|
||||||
subItems.add(ItemBlockStorage.initNBT(new ItemStack(item, 1, i)));
|
subItems.add(ItemBlockStorage.initNBT(new ItemStack(item, 1, i)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState()
|
protected BlockStateContainer createBlockState() {
|
||||||
{
|
|
||||||
return new BlockStateContainer(this, new IProperty[]
|
return new BlockStateContainer(this, new IProperty[]
|
||||||
{
|
{
|
||||||
DIRECTION,
|
DIRECTION,
|
||||||
@@ -54,28 +50,23 @@ public class BlockStorage extends BlockMachine
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta)
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
{
|
|
||||||
return getDefaultState().withProperty(TYPE, EnumStorageType.getById(meta));
|
return getDefaultState().withProperty(TYPE, EnumStorageType.getById(meta));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state)
|
public int getMetaFromState(IBlockState state) {
|
||||||
{
|
|
||||||
return ((EnumStorageType) state.getValue(TYPE)).getId();
|
return ((EnumStorageType) state.getValue(TYPE)).getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createTileEntity(World world, IBlockState state)
|
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||||
{
|
|
||||||
return new TileStorage();
|
return new TileStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, net.minecraft.util.math.BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(World world, net.minecraft.util.math.BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
{
|
if (!world.isRemote) {
|
||||||
if (!world.isRemote)
|
|
||||||
{
|
|
||||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.STORAGE, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.STORAGE, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,21 +74,18 @@ public class BlockStorage extends BlockMachine
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack)
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
|
||||||
{
|
|
||||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||||
|
|
||||||
NBTTagCompound tag = stack.getTagCompound();
|
NBTTagCompound tag = stack.getTagCompound();
|
||||||
|
|
||||||
if (tag != null && tag.hasKey(TileStorage.NBT_STORAGE))
|
if (tag != null && tag.hasKey(TileStorage.NBT_STORAGE)) {
|
||||||
{
|
|
||||||
((TileStorage) world.getTileEntity(pos)).setStorageTag((NBTTagCompound) tag.getTag(TileStorage.NBT_STORAGE));
|
((TileStorage) world.getTileEntity(pos)).setStorageTag((NBTTagCompound) tag.getTag(TileStorage.NBT_STORAGE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||||
{
|
|
||||||
List<ItemStack> drops = new ArrayList<ItemStack>();
|
List<ItemStack> drops = new ArrayList<ItemStack>();
|
||||||
|
|
||||||
ItemStack stack = new ItemStack(RefinedStorageBlocks.STORAGE, 1, RefinedStorageBlocks.STORAGE.getMetaFromState(state));
|
ItemStack stack = new ItemStack(RefinedStorageBlocks.STORAGE, 1, RefinedStorageBlocks.STORAGE.getMetaFromState(state));
|
||||||
@@ -114,10 +102,8 @@ public class BlockStorage extends BlockMachine
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
|
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
|
||||||
{
|
if (willHarvest) {
|
||||||
if (willHarvest)
|
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,8 +111,7 @@ public class BlockStorage extends BlockMachine
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity tile, ItemStack stack)
|
public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity tile, ItemStack stack) {
|
||||||
{
|
|
||||||
super.harvestBlock(world, player, pos, state, tile, stack);
|
super.harvestBlock(world, player, pos, state, tile, stack);
|
||||||
|
|
||||||
world.setBlockToAir(pos);
|
world.setBlockToAir(pos);
|
||||||
|
21
src/main/java/refinedstorage/block/BlockWirelessTransmitter.java
Normal file → Executable file
@@ -16,18 +16,15 @@ import refinedstorage.RefinedStorage;
|
|||||||
import refinedstorage.RefinedStorageGui;
|
import refinedstorage.RefinedStorageGui;
|
||||||
import refinedstorage.tile.TileWirelessTransmitter;
|
import refinedstorage.tile.TileWirelessTransmitter;
|
||||||
|
|
||||||
public class BlockWirelessTransmitter extends BlockMachine
|
public class BlockWirelessTransmitter extends BlockMachine {
|
||||||
{
|
|
||||||
public static final PropertyBool WORKING = PropertyBool.create("working");
|
public static final PropertyBool WORKING = PropertyBool.create("working");
|
||||||
|
|
||||||
public BlockWirelessTransmitter()
|
public BlockWirelessTransmitter() {
|
||||||
{
|
|
||||||
super("wireless_transmitter");
|
super("wireless_transmitter");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState()
|
protected BlockStateContainer createBlockState() {
|
||||||
{
|
|
||||||
return new BlockStateContainer(this, new IProperty[]
|
return new BlockStateContainer(this, new IProperty[]
|
||||||
{
|
{
|
||||||
DIRECTION,
|
DIRECTION,
|
||||||
@@ -37,23 +34,19 @@ public class BlockWirelessTransmitter extends BlockMachine
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos)
|
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||||
{
|
|
||||||
return super.getActualState(state, world, pos)
|
return super.getActualState(state, world, pos)
|
||||||
.withProperty(WORKING, ((TileWirelessTransmitter) world.getTileEntity(pos)).isWorking());
|
.withProperty(WORKING, ((TileWirelessTransmitter) world.getTileEntity(pos)).isWorking());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createTileEntity(World world, IBlockState state)
|
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||||
{
|
|
||||||
return new TileWirelessTransmitter();
|
return new TileWirelessTransmitter();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, net.minecraft.util.math.BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(World world, net.minecraft.util.math.BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
{
|
if (!world.isRemote) {
|
||||||
if (!world.isRemote)
|
|
||||||
{
|
|
||||||
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.WIRELESS_TRANSMITTER, world, pos.getX(), pos.getY(), pos.getZ());
|
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.WIRELESS_TRANSMITTER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
15
src/main/java/refinedstorage/block/EnumControllerType.java
Normal file → Executable file
@@ -2,34 +2,29 @@ package refinedstorage.block;
|
|||||||
|
|
||||||
import net.minecraft.util.IStringSerializable;
|
import net.minecraft.util.IStringSerializable;
|
||||||
|
|
||||||
public enum EnumControllerType implements IStringSerializable
|
public enum EnumControllerType implements IStringSerializable {
|
||||||
{
|
|
||||||
NORMAL(0, "normal"),
|
NORMAL(0, "normal"),
|
||||||
CREATIVE(1, "creative");
|
CREATIVE(1, "creative");
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
EnumControllerType(int id, String name)
|
EnumControllerType(int id, String name) {
|
||||||
{
|
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName()
|
public String getName() {
|
||||||
{
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId()
|
public int getId() {
|
||||||
{
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
15
src/main/java/refinedstorage/block/EnumGridType.java
Normal file → Executable file
@@ -2,34 +2,29 @@ package refinedstorage.block;
|
|||||||
|
|
||||||
import net.minecraft.util.IStringSerializable;
|
import net.minecraft.util.IStringSerializable;
|
||||||
|
|
||||||
public enum EnumGridType implements IStringSerializable
|
public enum EnumGridType implements IStringSerializable {
|
||||||
{
|
|
||||||
NORMAL(0, "normal"),
|
NORMAL(0, "normal"),
|
||||||
CRAFTING(1, "crafting");
|
CRAFTING(1, "crafting");
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
EnumGridType(int id, String name)
|
EnumGridType(int id, String name) {
|
||||||
{
|
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName()
|
public String getName() {
|
||||||
{
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId()
|
public int getId() {
|
||||||
{
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
27
src/main/java/refinedstorage/block/EnumStorageType.java
Normal file → Executable file
@@ -2,8 +2,7 @@ package refinedstorage.block;
|
|||||||
|
|
||||||
import net.minecraft.util.IStringSerializable;
|
import net.minecraft.util.IStringSerializable;
|
||||||
|
|
||||||
public enum EnumStorageType implements IStringSerializable
|
public enum EnumStorageType implements IStringSerializable {
|
||||||
{
|
|
||||||
TYPE_1K(0, 1000, "1k"),
|
TYPE_1K(0, 1000, "1k"),
|
||||||
TYPE_4K(1, 4000, "4k"),
|
TYPE_4K(1, 4000, "4k"),
|
||||||
TYPE_16K(2, 16000, "16k"),
|
TYPE_16K(2, 16000, "16k"),
|
||||||
@@ -14,41 +13,33 @@ public enum EnumStorageType implements IStringSerializable
|
|||||||
private int capacity;
|
private int capacity;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
EnumStorageType(int id, int capacity, String name)
|
EnumStorageType(int id, int capacity, String name) {
|
||||||
{
|
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.capacity = capacity;
|
this.capacity = capacity;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName()
|
public String getName() {
|
||||||
{
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId()
|
public int getId() {
|
||||||
{
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCapacity()
|
public int getCapacity() {
|
||||||
{
|
|
||||||
return capacity;
|
return capacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString() {
|
||||||
{
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EnumStorageType getById(int id)
|
public static EnumStorageType getById(int id) {
|
||||||
{
|
for (EnumStorageType type : EnumStorageType.values()) {
|
||||||
for (EnumStorageType type : EnumStorageType.values())
|
if (type.getId() == id) {
|
||||||
{
|
|
||||||
if (type.getId() == id)
|
|
||||||
{
|
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
86
src/main/java/refinedstorage/container/ContainerBase.java
Normal file → Executable file
@@ -1,7 +1,5 @@
|
|||||||
package refinedstorage.container;
|
package refinedstorage.container;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.ClickType;
|
import net.minecraft.inventory.ClickType;
|
||||||
@@ -11,28 +9,26 @@ import net.minecraft.item.ItemStack;
|
|||||||
import refinedstorage.container.slot.SlotDisabled;
|
import refinedstorage.container.slot.SlotDisabled;
|
||||||
import refinedstorage.container.slot.SlotSpecimen;
|
import refinedstorage.container.slot.SlotSpecimen;
|
||||||
|
|
||||||
public abstract class ContainerBase extends Container
|
import java.util.ArrayList;
|
||||||
{
|
import java.util.List;
|
||||||
|
|
||||||
|
public abstract class ContainerBase extends Container {
|
||||||
private EntityPlayer player;
|
private EntityPlayer player;
|
||||||
|
|
||||||
private List<Slot> playerInventorySlots = new ArrayList<Slot>();
|
private List<Slot> playerInventorySlots = new ArrayList<Slot>();
|
||||||
|
|
||||||
public ContainerBase(EntityPlayer player)
|
public ContainerBase(EntityPlayer player) {
|
||||||
{
|
|
||||||
this.player = player;
|
this.player = player;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityPlayer getPlayer()
|
public EntityPlayer getPlayer() {
|
||||||
{
|
|
||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addPlayerInventory(int xInventory, int yInventory)
|
protected void addPlayerInventory(int xInventory, int yInventory) {
|
||||||
{
|
|
||||||
int id = 0;
|
int id = 0;
|
||||||
|
|
||||||
for (int i = 0; i < 9; i++)
|
for (int i = 0; i < 9; i++) {
|
||||||
{
|
|
||||||
Slot slot = new Slot(player.inventory, id, xInventory + i * 18, yInventory + 4 + (3 * 18));
|
Slot slot = new Slot(player.inventory, id, xInventory + i * 18, yInventory + 4 + (3 * 18));
|
||||||
|
|
||||||
playerInventorySlots.add(slot);
|
playerInventorySlots.add(slot);
|
||||||
@@ -42,10 +38,8 @@ public abstract class ContainerBase extends Container
|
|||||||
id++;
|
id++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int y = 0; y < 3; y++)
|
for (int y = 0; y < 3; y++) {
|
||||||
{
|
for (int x = 0; x < 9; x++) {
|
||||||
for (int x = 0; x < 9; x++)
|
|
||||||
{
|
|
||||||
Slot slot = new Slot(player.inventory, id, xInventory + x * 18, yInventory + y * 18);
|
Slot slot = new Slot(player.inventory, id, xInventory + x * 18, yInventory + y * 18);
|
||||||
|
|
||||||
playerInventorySlots.add(slot);
|
playerInventorySlots.add(slot);
|
||||||
@@ -58,20 +52,15 @@ public abstract class ContainerBase extends Container
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack func_184996_a(int id, int clickedButton, ClickType clickType, EntityPlayer player)
|
public ItemStack func_184996_a(int id, int clickedButton, ClickType clickType, EntityPlayer player) {
|
||||||
{
|
|
||||||
Slot slot = id >= 0 ? getSlot(id) : null;
|
Slot slot = id >= 0 ? getSlot(id) : null;
|
||||||
|
|
||||||
if (slot instanceof SlotSpecimen)
|
if (slot instanceof SlotSpecimen) {
|
||||||
{
|
if (((SlotSpecimen) slot).isSizeAllowed()) {
|
||||||
if (((SlotSpecimen) slot).isSizeAllowed())
|
if (player.inventory.getItemStack() != null) {
|
||||||
{
|
|
||||||
if (player.inventory.getItemStack() != null)
|
|
||||||
{
|
|
||||||
int amount = player.inventory.getItemStack().stackSize;
|
int amount = player.inventory.getItemStack().stackSize;
|
||||||
|
|
||||||
if (clickedButton == 1)
|
if (clickedButton == 1) {
|
||||||
{
|
|
||||||
amount = 1;
|
amount = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,32 +68,22 @@ public abstract class ContainerBase extends Container
|
|||||||
toPut.stackSize = amount;
|
toPut.stackSize = amount;
|
||||||
|
|
||||||
slot.putStack(toPut);
|
slot.putStack(toPut);
|
||||||
}
|
} else if (slot.getStack() != null) {
|
||||||
else if (slot.getStack() != null)
|
if (GuiScreen.isShiftKeyDown()) {
|
||||||
{
|
|
||||||
if (GuiScreen.isShiftKeyDown())
|
|
||||||
{
|
|
||||||
slot.putStack(null);
|
slot.putStack(null);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
int amount = slot.getStack().stackSize;
|
int amount = slot.getStack().stackSize;
|
||||||
|
|
||||||
if (clickedButton == 0)
|
if (clickedButton == 0) {
|
||||||
{
|
|
||||||
amount++;
|
amount++;
|
||||||
|
|
||||||
if (amount > 64)
|
if (amount > 64) {
|
||||||
{
|
|
||||||
amount = 64;
|
amount = 64;
|
||||||
}
|
}
|
||||||
}
|
} else if (clickedButton == 1) {
|
||||||
else if (clickedButton == 1)
|
|
||||||
{
|
|
||||||
amount--;
|
amount--;
|
||||||
|
|
||||||
if (amount < 1)
|
if (amount < 1) {
|
||||||
{
|
|
||||||
amount = 1;
|
amount = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -112,20 +91,14 @@ public abstract class ContainerBase extends Container
|
|||||||
slot.getStack().stackSize = amount;
|
slot.getStack().stackSize = amount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (player.inventory.getItemStack() == null) {
|
||||||
else if (player.inventory.getItemStack() == null)
|
|
||||||
{
|
|
||||||
slot.putStack(null);
|
slot.putStack(null);
|
||||||
}
|
} else if (slot.isItemValid(player.inventory.getItemStack())) {
|
||||||
else if (slot.isItemValid(player.inventory.getItemStack()))
|
|
||||||
{
|
|
||||||
slot.putStack(player.inventory.getItemStack().copy());
|
slot.putStack(player.inventory.getItemStack().copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
return player.inventory.getItemStack();
|
return player.inventory.getItemStack();
|
||||||
}
|
} else if (slot instanceof SlotDisabled) {
|
||||||
else if (slot instanceof SlotDisabled)
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,19 +106,16 @@ public abstract class ContainerBase extends Container
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex)
|
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInteractWith(EntityPlayer player)
|
public boolean canInteractWith(EntityPlayer player) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Slot> getPlayerInventorySlots()
|
public List<Slot> getPlayerInventorySlots() {
|
||||||
{
|
|
||||||
return playerInventorySlots;
|
return playerInventorySlots;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
15
src/main/java/refinedstorage/container/ContainerConstructor.java
Normal file → Executable file
@@ -7,24 +7,19 @@ import net.minecraft.item.ItemStack;
|
|||||||
import refinedstorage.container.slot.SlotSpecimen;
|
import refinedstorage.container.slot.SlotSpecimen;
|
||||||
import refinedstorage.tile.TileConstructor;
|
import refinedstorage.tile.TileConstructor;
|
||||||
|
|
||||||
public class ContainerConstructor extends ContainerBase
|
public class ContainerConstructor extends ContainerBase {
|
||||||
{
|
class SlotConstructor extends SlotSpecimen {
|
||||||
class SlotConstructor extends SlotSpecimen
|
public SlotConstructor(IInventory inventory, int id, int x, int y) {
|
||||||
{
|
|
||||||
public SlotConstructor(IInventory inventory, int id, int x, int y)
|
|
||||||
{
|
|
||||||
super(inventory, id, x, y, false);
|
super(inventory, id, x, y, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValid(ItemStack stack)
|
public boolean isItemValid(ItemStack stack) {
|
||||||
{
|
|
||||||
return stack.getItem() instanceof ItemBlock;
|
return stack.getItem() instanceof ItemBlock;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContainerConstructor(EntityPlayer player, TileConstructor constructor)
|
public ContainerConstructor(EntityPlayer player, TileConstructor constructor) {
|
||||||
{
|
|
||||||
super(player);
|
super(player);
|
||||||
|
|
||||||
addSlotToContainer(new SlotConstructor(constructor.getInventory(), 0, 80, 20));
|
addSlotToContainer(new SlotConstructor(constructor.getInventory(), 0, 80, 20));
|
||||||
|
6
src/main/java/refinedstorage/container/ContainerController.java
Normal file → Executable file
@@ -2,10 +2,8 @@ package refinedstorage.container;
|
|||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
|
||||||
public class ContainerController extends ContainerBase
|
public class ContainerController extends ContainerBase {
|
||||||
{
|
public ContainerController(EntityPlayer player) {
|
||||||
public ContainerController(EntityPlayer player)
|
|
||||||
{
|
|
||||||
super(player);
|
super(player);
|
||||||
|
|
||||||
addPlayerInventory(8, 99);
|
addPlayerInventory(8, 99);
|
||||||
|
6
src/main/java/refinedstorage/container/ContainerDestructor.java
Normal file → Executable file
@@ -2,10 +2,8 @@ package refinedstorage.container;
|
|||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
|
||||||
public class ContainerDestructor extends ContainerBase
|
public class ContainerDestructor extends ContainerBase {
|
||||||
{
|
public ContainerDestructor(EntityPlayer player) {
|
||||||
public ContainerDestructor(EntityPlayer player)
|
|
||||||
{
|
|
||||||
super(player);
|
super(player);
|
||||||
|
|
||||||
addPlayerInventory(8, 50);
|
addPlayerInventory(8, 50);
|
||||||
|
6
src/main/java/refinedstorage/container/ContainerDetector.java
Normal file → Executable file
@@ -4,10 +4,8 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||||||
import refinedstorage.container.slot.SlotSpecimen;
|
import refinedstorage.container.slot.SlotSpecimen;
|
||||||
import refinedstorage.tile.TileDetector;
|
import refinedstorage.tile.TileDetector;
|
||||||
|
|
||||||
public class ContainerDetector extends ContainerBase
|
public class ContainerDetector extends ContainerBase {
|
||||||
{
|
public ContainerDetector(EntityPlayer player, TileDetector detector) {
|
||||||
public ContainerDetector(EntityPlayer player, TileDetector detector)
|
|
||||||
{
|
|
||||||
super(player);
|
super(player);
|
||||||
|
|
||||||
addSlotToContainer(new SlotSpecimen(detector.getInventory(), 0, 107, 20, false));
|
addSlotToContainer(new SlotSpecimen(detector.getInventory(), 0, 107, 20, false));
|
||||||
|
12
src/main/java/refinedstorage/container/ContainerDrive.java
Normal file → Executable file
@@ -6,19 +6,15 @@ import refinedstorage.container.slot.BasicItemValidator;
|
|||||||
import refinedstorage.container.slot.SlotFiltered;
|
import refinedstorage.container.slot.SlotFiltered;
|
||||||
import refinedstorage.tile.TileDrive;
|
import refinedstorage.tile.TileDrive;
|
||||||
|
|
||||||
public class ContainerDrive extends ContainerStorage
|
public class ContainerDrive extends ContainerStorage {
|
||||||
{
|
public ContainerDrive(EntityPlayer player, TileDrive drive) {
|
||||||
public ContainerDrive(EntityPlayer player, TileDrive drive)
|
|
||||||
{
|
|
||||||
super(player, drive.getInventory());
|
super(player, drive.getInventory());
|
||||||
|
|
||||||
for (int i = 0; i < 4; ++i)
|
for (int i = 0; i < 4; ++i) {
|
||||||
{
|
|
||||||
addSlotToContainer(new SlotFiltered(drive, i, 98 + (i * 18), 78, new BasicItemValidator(RefinedStorageItems.STORAGE_CELL)));
|
addSlotToContainer(new SlotFiltered(drive, i, 98 + (i * 18), 78, new BasicItemValidator(RefinedStorageItems.STORAGE_CELL)));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 4; ++i)
|
for (int i = 0; i < 4; ++i) {
|
||||||
{
|
|
||||||
addSlotToContainer(new SlotFiltered(drive, 4 + i, 98 + (i * 18), 96, new BasicItemValidator(RefinedStorageItems.STORAGE_CELL)));
|
addSlotToContainer(new SlotFiltered(drive, 4 + i, 98 + (i * 18), 96, new BasicItemValidator(RefinedStorageItems.STORAGE_CELL)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
9
src/main/java/refinedstorage/container/ContainerExporter.java
Normal file → Executable file
@@ -4,14 +4,11 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||||||
import refinedstorage.container.slot.SlotSpecimen;
|
import refinedstorage.container.slot.SlotSpecimen;
|
||||||
import refinedstorage.tile.TileExporter;
|
import refinedstorage.tile.TileExporter;
|
||||||
|
|
||||||
public class ContainerExporter extends ContainerBase
|
public class ContainerExporter extends ContainerBase {
|
||||||
{
|
public ContainerExporter(EntityPlayer player, TileExporter exporter) {
|
||||||
public ContainerExporter(EntityPlayer player, TileExporter exporter)
|
|
||||||
{
|
|
||||||
super(player);
|
super(player);
|
||||||
|
|
||||||
for (int i = 0; i < 9; ++i)
|
for (int i = 0; i < 9; ++i) {
|
||||||
{
|
|
||||||
addSlotToContainer(new SlotSpecimen(exporter.getInventory(), i, 8 + (18 * i), 20, false));
|
addSlotToContainer(new SlotSpecimen(exporter.getInventory(), i, 8 + (18 * i), 20, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
15
src/main/java/refinedstorage/container/ContainerGrid.java
Normal file → Executable file
@@ -6,31 +6,26 @@ import refinedstorage.block.EnumGridType;
|
|||||||
import refinedstorage.container.slot.SlotGridCraftingResult;
|
import refinedstorage.container.slot.SlotGridCraftingResult;
|
||||||
import refinedstorage.tile.TileGrid;
|
import refinedstorage.tile.TileGrid;
|
||||||
|
|
||||||
public class ContainerGrid extends ContainerBase
|
public class ContainerGrid extends ContainerBase {
|
||||||
{
|
|
||||||
private TileGrid grid;
|
private TileGrid grid;
|
||||||
|
|
||||||
public ContainerGrid(EntityPlayer player, TileGrid grid)
|
public ContainerGrid(EntityPlayer player, TileGrid grid) {
|
||||||
{
|
|
||||||
super(player);
|
super(player);
|
||||||
|
|
||||||
this.grid = grid;
|
this.grid = grid;
|
||||||
|
|
||||||
addPlayerInventory(8, grid.getType() == EnumGridType.CRAFTING ? 174 : 108);
|
addPlayerInventory(8, grid.getType() == EnumGridType.CRAFTING ? 174 : 108);
|
||||||
|
|
||||||
if (grid.getType() == EnumGridType.CRAFTING)
|
if (grid.getType() == EnumGridType.CRAFTING) {
|
||||||
{
|
|
||||||
int x = 25;
|
int x = 25;
|
||||||
int y = 106;
|
int y = 106;
|
||||||
|
|
||||||
for (int i = 0; i < 9; ++i)
|
for (int i = 0; i < 9; ++i) {
|
||||||
{
|
|
||||||
addSlotToContainer(new Slot(grid.getCraftingInventory(), i, x, y));
|
addSlotToContainer(new Slot(grid.getCraftingInventory(), i, x, y));
|
||||||
|
|
||||||
x += 18;
|
x += 18;
|
||||||
|
|
||||||
if ((i + 1) % 3 == 0)
|
if ((i + 1) % 3 == 0) {
|
||||||
{
|
|
||||||
y += 18;
|
y += 18;
|
||||||
x = 25;
|
x = 25;
|
||||||
}
|
}
|
||||||
|
9
src/main/java/refinedstorage/container/ContainerImporter.java
Normal file → Executable file
@@ -4,14 +4,11 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||||||
import refinedstorage.container.slot.SlotSpecimen;
|
import refinedstorage.container.slot.SlotSpecimen;
|
||||||
import refinedstorage.tile.TileImporter;
|
import refinedstorage.tile.TileImporter;
|
||||||
|
|
||||||
public class ContainerImporter extends ContainerBase
|
public class ContainerImporter extends ContainerBase {
|
||||||
{
|
public ContainerImporter(EntityPlayer player, TileImporter importer) {
|
||||||
public ContainerImporter(EntityPlayer player, TileImporter importer)
|
|
||||||
{
|
|
||||||
super(player);
|
super(player);
|
||||||
|
|
||||||
for (int i = 0; i < 9; ++i)
|
for (int i = 0; i < 9; ++i) {
|
||||||
{
|
|
||||||
addSlotToContainer(new SlotSpecimen(importer.getInventory(), i, 8 + (18 * i), 20, false));
|
addSlotToContainer(new SlotSpecimen(importer.getInventory(), i, 8 + (18 * i), 20, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
38
src/main/java/refinedstorage/container/ContainerInterface.java
Normal file → Executable file
@@ -7,24 +7,19 @@ import refinedstorage.container.slot.SlotOutput;
|
|||||||
import refinedstorage.container.slot.SlotSpecimen;
|
import refinedstorage.container.slot.SlotSpecimen;
|
||||||
import refinedstorage.tile.TileInterface;
|
import refinedstorage.tile.TileInterface;
|
||||||
|
|
||||||
public class ContainerInterface extends ContainerBase
|
public class ContainerInterface extends ContainerBase {
|
||||||
{
|
public ContainerInterface(EntityPlayer player, TileInterface tile) {
|
||||||
public ContainerInterface(EntityPlayer player, TileInterface tile)
|
|
||||||
{
|
|
||||||
super(player);
|
super(player);
|
||||||
|
|
||||||
for (int i = 0; i < 9; ++i)
|
for (int i = 0; i < 9; ++i) {
|
||||||
{
|
|
||||||
addSlotToContainer(new Slot(tile, i, 8 + (18 * i), 20));
|
addSlotToContainer(new Slot(tile, i, 8 + (18 * i), 20));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 9; i < 18; ++i)
|
for (int i = 9; i < 18; ++i) {
|
||||||
{
|
|
||||||
addSlotToContainer(new SlotSpecimen(tile, i, 8 + (18 * (i - 9)), 54, true));
|
addSlotToContainer(new SlotSpecimen(tile, i, 8 + (18 * (i - 9)), 54, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 18; i < 27; ++i)
|
for (int i = 18; i < 27; ++i) {
|
||||||
{
|
|
||||||
addSlotToContainer(new SlotOutput(tile, i, 8 + (18 * (i - 18)), 100));
|
addSlotToContainer(new SlotOutput(tile, i, 8 + (18 * (i - 18)), 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,34 +27,25 @@ public class ContainerInterface extends ContainerBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack transferStackInSlot(EntityPlayer player, int index)
|
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||||
{
|
|
||||||
ItemStack stack = null;
|
ItemStack stack = null;
|
||||||
|
|
||||||
Slot slot = getSlot(index);
|
Slot slot = getSlot(index);
|
||||||
|
|
||||||
if (slot != null && slot.getHasStack())
|
if (slot != null && slot.getHasStack()) {
|
||||||
{
|
|
||||||
stack = slot.getStack().copy();
|
stack = slot.getStack().copy();
|
||||||
|
|
||||||
if (index < 9)
|
if (index < 9) {
|
||||||
{
|
if (!mergeItemStack(stack, 9, inventorySlots.size(), true)) {
|
||||||
if (!mergeItemStack(stack, 9, inventorySlots.size(), true))
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
} else if (!mergeItemStack(stack, 0, 9, false)) {
|
||||||
else if (!mergeItemStack(stack, 0, 9, false))
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.stackSize == 0)
|
if (stack.stackSize == 0) {
|
||||||
{
|
|
||||||
slot.putStack(null);
|
slot.putStack(null);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
slot.onSlotChanged();
|
slot.onSlotChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
6
src/main/java/refinedstorage/container/ContainerRelay.java
Normal file → Executable file
@@ -2,10 +2,8 @@ package refinedstorage.container;
|
|||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
|
||||||
public class ContainerRelay extends ContainerBase
|
public class ContainerRelay extends ContainerBase {
|
||||||
{
|
public ContainerRelay(EntityPlayer player) {
|
||||||
public ContainerRelay(EntityPlayer player)
|
|
||||||
{
|
|
||||||
super(player);
|
super(player);
|
||||||
|
|
||||||
addPlayerInventory(8, 50);
|
addPlayerInventory(8, 50);
|
||||||
|
32
src/main/java/refinedstorage/container/ContainerSolderer.java
Normal file → Executable file
@@ -6,17 +6,14 @@ import net.minecraft.item.ItemStack;
|
|||||||
import refinedstorage.container.slot.SlotOutput;
|
import refinedstorage.container.slot.SlotOutput;
|
||||||
import refinedstorage.tile.TileSolderer;
|
import refinedstorage.tile.TileSolderer;
|
||||||
|
|
||||||
public class ContainerSolderer extends ContainerBase
|
public class ContainerSolderer extends ContainerBase {
|
||||||
{
|
public ContainerSolderer(EntityPlayer player, TileSolderer solderer) {
|
||||||
public ContainerSolderer(EntityPlayer player, TileSolderer solderer)
|
|
||||||
{
|
|
||||||
super(player);
|
super(player);
|
||||||
|
|
||||||
int x = 44;
|
int x = 44;
|
||||||
int y = 20;
|
int y = 20;
|
||||||
|
|
||||||
for (int i = 0; i < 3; ++i)
|
for (int i = 0; i < 3; ++i) {
|
||||||
{
|
|
||||||
addSlotToContainer(new Slot(solderer, i, x, y));
|
addSlotToContainer(new Slot(solderer, i, x, y));
|
||||||
|
|
||||||
y += 18;
|
y += 18;
|
||||||
@@ -28,34 +25,25 @@ public class ContainerSolderer extends ContainerBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack transferStackInSlot(EntityPlayer player, int index)
|
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||||
{
|
|
||||||
ItemStack stack = null;
|
ItemStack stack = null;
|
||||||
|
|
||||||
Slot slot = getSlot(index);
|
Slot slot = getSlot(index);
|
||||||
|
|
||||||
if (slot != null && slot.getHasStack())
|
if (slot != null && slot.getHasStack()) {
|
||||||
{
|
|
||||||
stack = slot.getStack().copy();
|
stack = slot.getStack().copy();
|
||||||
|
|
||||||
if (index < 3)
|
if (index < 3) {
|
||||||
{
|
if (!mergeItemStack(stack, 3, inventorySlots.size(), true)) {
|
||||||
if (!mergeItemStack(stack, 3, inventorySlots.size(), true))
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
} else if (!mergeItemStack(stack, 0, 3, false)) {
|
||||||
else if (!mergeItemStack(stack, 0, 3, false))
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.stackSize == 0)
|
if (stack.stackSize == 0) {
|
||||||
{
|
|
||||||
slot.putStack(null);
|
slot.putStack(null);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
slot.onSlotChanged();
|
slot.onSlotChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
9
src/main/java/refinedstorage/container/ContainerStorage.java
Normal file → Executable file
@@ -4,14 +4,11 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import refinedstorage.container.slot.SlotSpecimen;
|
import refinedstorage.container.slot.SlotSpecimen;
|
||||||
|
|
||||||
public class ContainerStorage extends ContainerBase
|
public class ContainerStorage extends ContainerBase {
|
||||||
{
|
public ContainerStorage(EntityPlayer player, IInventory inventory) {
|
||||||
public ContainerStorage(EntityPlayer player, IInventory inventory)
|
|
||||||
{
|
|
||||||
super(player);
|
super(player);
|
||||||
|
|
||||||
for (int i = 0; i < 9; ++i)
|
for (int i = 0; i < 9; ++i) {
|
||||||
{
|
|
||||||
addSlotToContainer(new SlotSpecimen(inventory, i, 8 + (18 * i), 20, false));
|
addSlotToContainer(new SlotSpecimen(inventory, i, 8 + (18 * i), 20, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
29
src/main/java/refinedstorage/container/ContainerWirelessTransmitter.java
Normal file → Executable file
@@ -10,10 +10,8 @@ import refinedstorage.container.slot.SlotFiltered;
|
|||||||
import refinedstorage.container.slot.SlotOutput;
|
import refinedstorage.container.slot.SlotOutput;
|
||||||
import refinedstorage.tile.TileWirelessTransmitter;
|
import refinedstorage.tile.TileWirelessTransmitter;
|
||||||
|
|
||||||
public class ContainerWirelessTransmitter extends ContainerBase
|
public class ContainerWirelessTransmitter extends ContainerBase {
|
||||||
{
|
public ContainerWirelessTransmitter(EntityPlayer player, TileWirelessTransmitter wirelessTransmitter) {
|
||||||
public ContainerWirelessTransmitter(EntityPlayer player, TileWirelessTransmitter wirelessTransmitter)
|
|
||||||
{
|
|
||||||
super(player);
|
super(player);
|
||||||
|
|
||||||
addSlotToContainer(new SlotFiltered(wirelessTransmitter, 0, 8, 20, new BasicItemValidator(Items.ender_pearl)));
|
addSlotToContainer(new SlotFiltered(wirelessTransmitter, 0, 8, 20, new BasicItemValidator(Items.ender_pearl)));
|
||||||
@@ -24,34 +22,25 @@ public class ContainerWirelessTransmitter extends ContainerBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack transferStackInSlot(EntityPlayer player, int index)
|
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||||
{
|
|
||||||
ItemStack stack = null;
|
ItemStack stack = null;
|
||||||
|
|
||||||
Slot slot = getSlot(index);
|
Slot slot = getSlot(index);
|
||||||
|
|
||||||
if (slot != null && slot.getHasStack())
|
if (slot != null && slot.getHasStack()) {
|
||||||
{
|
|
||||||
stack = slot.getStack().copy();
|
stack = slot.getStack().copy();
|
||||||
|
|
||||||
if (index < 3)
|
if (index < 3) {
|
||||||
{
|
if (!mergeItemStack(stack, 3, inventorySlots.size(), true)) {
|
||||||
if (!mergeItemStack(stack, 3, inventorySlots.size(), true))
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
} else if (!mergeItemStack(stack, 0, 3, false)) {
|
||||||
else if (!mergeItemStack(stack, 0, 3, false))
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.stackSize == 0)
|
if (stack.stackSize == 0) {
|
||||||
{
|
|
||||||
slot.putStack(null);
|
slot.putStack(null);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
slot.onSlotChanged();
|
slot.onSlotChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
9
src/main/java/refinedstorage/container/slot/BasicItemValidator.java
Normal file → Executable file
@@ -3,18 +3,15 @@ package refinedstorage.container.slot;
|
|||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class BasicItemValidator implements IItemValidator
|
public class BasicItemValidator implements IItemValidator {
|
||||||
{
|
|
||||||
private Item item;
|
private Item item;
|
||||||
|
|
||||||
public BasicItemValidator(Item item)
|
public BasicItemValidator(Item item) {
|
||||||
{
|
|
||||||
this.item = item;
|
this.item = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid(ItemStack stack)
|
public boolean isValid(ItemStack stack) {
|
||||||
{
|
|
||||||
return item == stack.getItem();
|
return item == stack.getItem();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
3
src/main/java/refinedstorage/container/slot/IItemValidator.java
Normal file → Executable file
@@ -2,7 +2,6 @@ package refinedstorage.container.slot;
|
|||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public interface IItemValidator
|
public interface IItemValidator {
|
||||||
{
|
|
||||||
public boolean isValid(ItemStack stack);
|
public boolean isValid(ItemStack stack);
|
||||||
}
|
}
|
||||||
|
9
src/main/java/refinedstorage/container/slot/SlotDisabled.java
Normal file → Executable file
@@ -4,16 +4,13 @@ import net.minecraft.inventory.IInventory;
|
|||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class SlotDisabled extends Slot
|
public class SlotDisabled extends Slot {
|
||||||
{
|
public SlotDisabled(IInventory inventory, int id, int x, int y) {
|
||||||
public SlotDisabled(IInventory inventory, int id, int x, int y)
|
|
||||||
{
|
|
||||||
super(inventory, id, x, y);
|
super(inventory, id, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValid(ItemStack stack)
|
public boolean isItemValid(ItemStack stack) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
9
src/main/java/refinedstorage/container/slot/SlotFiltered.java
Normal file → Executable file
@@ -4,20 +4,17 @@ import net.minecraft.inventory.IInventory;
|
|||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class SlotFiltered extends Slot
|
public class SlotFiltered extends Slot {
|
||||||
{
|
|
||||||
private IItemValidator validator;
|
private IItemValidator validator;
|
||||||
|
|
||||||
public SlotFiltered(IInventory inventory, int id, int x, int y, IItemValidator validator)
|
public SlotFiltered(IInventory inventory, int id, int x, int y, IItemValidator validator) {
|
||||||
{
|
|
||||||
super(inventory, id, x, y);
|
super(inventory, id, x, y);
|
||||||
|
|
||||||
this.validator = validator;
|
this.validator = validator;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValid(ItemStack item)
|
public boolean isItemValid(ItemStack item) {
|
||||||
{
|
|
||||||
return validator.isValid(item);
|
return validator.isValid(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
15
src/main/java/refinedstorage/container/slot/SlotGridCraftingResult.java
Normal file → Executable file
@@ -7,13 +7,11 @@ import net.minecraft.inventory.SlotCrafting;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import refinedstorage.tile.TileGrid;
|
import refinedstorage.tile.TileGrid;
|
||||||
|
|
||||||
public class SlotGridCraftingResult extends SlotCrafting
|
public class SlotGridCraftingResult extends SlotCrafting {
|
||||||
{
|
|
||||||
private IInventory craftingMatrix;
|
private IInventory craftingMatrix;
|
||||||
private TileGrid grid;
|
private TileGrid grid;
|
||||||
|
|
||||||
public SlotGridCraftingResult(EntityPlayer player, InventoryCrafting craftingMatrix, IInventory craftingResult, TileGrid grid, int id, int x, int y)
|
public SlotGridCraftingResult(EntityPlayer player, InventoryCrafting craftingMatrix, IInventory craftingResult, TileGrid grid, int id, int x, int y) {
|
||||||
{
|
|
||||||
super(player, craftingMatrix, craftingResult, id, x, y);
|
super(player, craftingMatrix, craftingResult, id, x, y);
|
||||||
|
|
||||||
this.craftingMatrix = craftingMatrix;
|
this.craftingMatrix = craftingMatrix;
|
||||||
@@ -21,14 +19,11 @@ public class SlotGridCraftingResult extends SlotCrafting
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPickupFromSlot(EntityPlayer player, ItemStack stack)
|
public void onPickupFromSlot(EntityPlayer player, ItemStack stack) {
|
||||||
{
|
|
||||||
ItemStack[] matrixSlots = new ItemStack[craftingMatrix.getSizeInventory()];
|
ItemStack[] matrixSlots = new ItemStack[craftingMatrix.getSizeInventory()];
|
||||||
|
|
||||||
for (int i = 0; i < craftingMatrix.getSizeInventory(); ++i)
|
for (int i = 0; i < craftingMatrix.getSizeInventory(); ++i) {
|
||||||
{
|
if (craftingMatrix.getStackInSlot(i) != null) {
|
||||||
if (craftingMatrix.getStackInSlot(i) != null)
|
|
||||||
{
|
|
||||||
matrixSlots[i] = craftingMatrix.getStackInSlot(i).copy();
|
matrixSlots[i] = craftingMatrix.getStackInSlot(i).copy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
9
src/main/java/refinedstorage/container/slot/SlotOutput.java
Normal file → Executable file
@@ -4,16 +4,13 @@ import net.minecraft.inventory.IInventory;
|
|||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class SlotOutput extends Slot
|
public class SlotOutput extends Slot {
|
||||||
{
|
public SlotOutput(IInventory inventory, int id, int x, int y) {
|
||||||
public SlotOutput(IInventory inventory, int id, int x, int y)
|
|
||||||
{
|
|
||||||
super(inventory, id, x, y);
|
super(inventory, id, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValid(ItemStack stack)
|
public boolean isItemValid(ItemStack stack) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
21
src/main/java/refinedstorage/container/slot/SlotSpecimen.java
Normal file → Executable file
@@ -5,42 +5,35 @@ import net.minecraft.inventory.IInventory;
|
|||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class SlotSpecimen extends Slot
|
public class SlotSpecimen extends Slot {
|
||||||
{
|
|
||||||
private boolean sizeAllowed;
|
private boolean sizeAllowed;
|
||||||
|
|
||||||
public SlotSpecimen(IInventory inventory, int id, int x, int y, boolean allowSize)
|
public SlotSpecimen(IInventory inventory, int id, int x, int y, boolean allowSize) {
|
||||||
{
|
|
||||||
super(inventory, id, x, y);
|
super(inventory, id, x, y);
|
||||||
|
|
||||||
this.sizeAllowed = allowSize;
|
this.sizeAllowed = allowSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canTakeStack(EntityPlayer player)
|
public boolean canTakeStack(EntityPlayer player) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValid(ItemStack stack)
|
public boolean isItemValid(ItemStack stack) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void putStack(ItemStack stack)
|
public void putStack(ItemStack stack) {
|
||||||
{
|
if (stack != null && !sizeAllowed) {
|
||||||
if (stack != null && !sizeAllowed)
|
|
||||||
{
|
|
||||||
stack.stackSize = 1;
|
stack.stackSize = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
super.putStack(stack);
|
super.putStack(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSizeAllowed()
|
public boolean isSizeAllowed() {
|
||||||
{
|
|
||||||
return sizeAllowed;
|
return sizeAllowed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
102
src/main/java/refinedstorage/gui/GuiBase.java
Normal file → Executable file
@@ -1,9 +1,5 @@
|
|||||||
package refinedstorage.gui;
|
package refinedstorage.gui;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
@@ -15,8 +11,12 @@ import org.lwjgl.opengl.GL11;
|
|||||||
import refinedstorage.RefinedStorage;
|
import refinedstorage.RefinedStorage;
|
||||||
import refinedstorage.gui.sidebutton.SideButton;
|
import refinedstorage.gui.sidebutton.SideButton;
|
||||||
|
|
||||||
public abstract class GuiBase extends GuiContainer
|
import java.io.IOException;
|
||||||
{
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public abstract class GuiBase extends GuiContainer {
|
||||||
public static final int SIDE_BUTTON_WIDTH = 20;
|
public static final int SIDE_BUTTON_WIDTH = 20;
|
||||||
public static final int SIDE_BUTTON_HEIGHT = 20;
|
public static final int SIDE_BUTTON_HEIGHT = 20;
|
||||||
|
|
||||||
@@ -28,8 +28,7 @@ public abstract class GuiBase extends GuiContainer
|
|||||||
protected int width;
|
protected int width;
|
||||||
protected int height;
|
protected int height;
|
||||||
|
|
||||||
public GuiBase(Container container, int width, int height)
|
public GuiBase(Container container, int width, int height) {
|
||||||
{
|
|
||||||
super(container);
|
super(container);
|
||||||
|
|
||||||
this.width = width;
|
this.width = width;
|
||||||
@@ -39,10 +38,8 @@ public abstract class GuiBase extends GuiContainer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui()
|
public void initGui() {
|
||||||
{
|
if (sideButtons.size() > 0) {
|
||||||
if (sideButtons.size() > 0)
|
|
||||||
{
|
|
||||||
xSize -= SIDE_BUTTON_WIDTH;
|
xSize -= SIDE_BUTTON_WIDTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,44 +52,38 @@ public abstract class GuiBase extends GuiContainer
|
|||||||
|
|
||||||
init(guiLeft, guiTop);
|
init(guiLeft, guiTop);
|
||||||
|
|
||||||
if (sideButtons.size() > 0)
|
if (sideButtons.size() > 0) {
|
||||||
{
|
|
||||||
xSize += SIDE_BUTTON_WIDTH;
|
xSize += SIDE_BUTTON_WIDTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateScreen()
|
public void updateScreen() {
|
||||||
{
|
|
||||||
super.updateScreen();
|
super.updateScreen();
|
||||||
|
|
||||||
update(guiLeft, guiTop);
|
update(guiLeft, guiTop);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerBackgroundLayer(float renderPartialTicks, int mouseX, int mouseY)
|
protected void drawGuiContainerBackgroundLayer(float renderPartialTicks, int mouseX, int mouseY) {
|
||||||
{
|
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
drawBackground(guiLeft, guiTop, mouseX, mouseY);
|
drawBackground(guiLeft, guiTop, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||||
{
|
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
mouseX -= guiLeft;
|
mouseX -= guiLeft;
|
||||||
mouseY -= guiTop;
|
mouseY -= guiTop;
|
||||||
|
|
||||||
for (SideButton sideButton : sideButtons)
|
for (SideButton sideButton : sideButtons) {
|
||||||
{
|
|
||||||
GL11.glDisable(GL11.GL_LIGHTING);
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
sideButton.draw(this, sideButton.getX() + 2, sideButton.getY() + 1);
|
sideButton.draw(this, sideButton.getX() + 2, sideButton.getY() + 1);
|
||||||
GL11.glEnable(GL11.GL_LIGHTING);
|
GL11.glEnable(GL11.GL_LIGHTING);
|
||||||
|
|
||||||
if (inBounds(sideButton.getX(), sideButton.getY(), SIDE_BUTTON_WIDTH, SIDE_BUTTON_HEIGHT, mouseX, mouseY))
|
if (inBounds(sideButton.getX(), sideButton.getY(), SIDE_BUTTON_WIDTH, SIDE_BUTTON_HEIGHT, mouseX, mouseY)) {
|
||||||
{
|
|
||||||
drawTooltip(mouseX, mouseY, sideButton.getTooltip(this));
|
drawTooltip(mouseX, mouseY, sideButton.getTooltip(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -101,26 +92,21 @@ public abstract class GuiBase extends GuiContainer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void actionPerformed(GuiButton button) throws IOException
|
protected void actionPerformed(GuiButton button) throws IOException {
|
||||||
{
|
|
||||||
super.actionPerformed(button);
|
super.actionPerformed(button);
|
||||||
|
|
||||||
for (SideButton sideButton : sideButtons)
|
for (SideButton sideButton : sideButtons) {
|
||||||
{
|
if (sideButton.getId() == button.id) {
|
||||||
if (sideButton.getId() == button.id)
|
|
||||||
{
|
|
||||||
sideButton.actionPerformed();
|
sideButton.actionPerformed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public GuiButton addButton(int x, int y, int w, int h)
|
public GuiButton addButton(int x, int y, int w, int h) {
|
||||||
{
|
|
||||||
return addButton(x, y, w, h, "");
|
return addButton(x, y, w, h, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public GuiButton addButton(int x, int y, int w, int h, String text)
|
public GuiButton addButton(int x, int y, int w, int h, String text) {
|
||||||
{
|
|
||||||
GuiButton button = new GuiButton(lastButtonId++, x, y, w, h, text);
|
GuiButton button = new GuiButton(lastButtonId++, x, y, w, h, text);
|
||||||
|
|
||||||
buttonList.add(button);
|
buttonList.add(button);
|
||||||
@@ -128,8 +114,7 @@ public abstract class GuiBase extends GuiContainer
|
|||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSideButton(SideButton button)
|
public void addSideButton(SideButton button) {
|
||||||
{
|
|
||||||
button.setX(xSize - 1);
|
button.setX(xSize - 1);
|
||||||
button.setY(lastSideButtonY);
|
button.setY(lastSideButtonY);
|
||||||
button.setId(addButton(guiLeft + button.getX(), guiTop + button.getY(), SIDE_BUTTON_WIDTH, SIDE_BUTTON_HEIGHT).id);
|
button.setId(addButton(guiLeft + button.getX(), guiTop + button.getY(), SIDE_BUTTON_WIDTH, SIDE_BUTTON_HEIGHT).id);
|
||||||
@@ -139,52 +124,43 @@ public abstract class GuiBase extends GuiContainer
|
|||||||
sideButtons.add(button);
|
sideButtons.add(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean inBounds(int x, int y, int w, int h, int ox, int oy)
|
public boolean inBounds(int x, int y, int w, int h, int ox, int oy) {
|
||||||
{
|
|
||||||
return ox >= x && ox <= x + w && oy >= y && oy <= y + h;
|
return ox >= x && ox <= x + w && oy >= y && oy <= y + h;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void bindTexture(String file)
|
public void bindTexture(String file) {
|
||||||
{
|
|
||||||
bindTexture(RefinedStorage.ID, file);
|
bindTexture(RefinedStorage.ID, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void bindTexture(String base, String file)
|
public void bindTexture(String base, String file) {
|
||||||
{
|
|
||||||
mc.getTextureManager().bindTexture(new ResourceLocation(base, "textures/" + file));
|
mc.getTextureManager().bindTexture(new ResourceLocation(base, "textures/" + file));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawItem(int x, int y, ItemStack stack)
|
public void drawItem(int x, int y, ItemStack stack) {
|
||||||
{
|
|
||||||
drawItem(x, y, stack, false, null);
|
drawItem(x, y, stack, false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawItem(int x, int y, ItemStack stack, boolean withOverlay)
|
public void drawItem(int x, int y, ItemStack stack, boolean withOverlay) {
|
||||||
{
|
|
||||||
drawItem(x, y, stack, withOverlay, null);
|
drawItem(x, y, stack, withOverlay, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawItem(int x, int y, ItemStack stack, boolean withOverlay, String message)
|
public void drawItem(int x, int y, ItemStack stack, boolean withOverlay, String message) {
|
||||||
{
|
|
||||||
zLevel = 200.0F;
|
zLevel = 200.0F;
|
||||||
itemRender.zLevel = 200.0F;
|
itemRender.zLevel = 200.0F;
|
||||||
|
|
||||||
FontRenderer font = null;
|
FontRenderer font = null;
|
||||||
|
|
||||||
if (stack != null)
|
if (stack != null) {
|
||||||
{
|
|
||||||
font = stack.getItem().getFontRenderer(stack);
|
font = stack.getItem().getFontRenderer(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (font == null)
|
if (font == null) {
|
||||||
{
|
|
||||||
font = fontRendererObj;
|
font = fontRendererObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
itemRender.renderItemIntoGUI(stack, x, y);
|
itemRender.renderItemIntoGUI(stack, x, y);
|
||||||
|
|
||||||
if (withOverlay)
|
if (withOverlay) {
|
||||||
{
|
|
||||||
itemRender.renderItemOverlayIntoGUI(font, stack, x, y, message);
|
itemRender.renderItemOverlayIntoGUI(font, stack, x, y, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,37 +168,31 @@ public abstract class GuiBase extends GuiContainer
|
|||||||
itemRender.zLevel = 0.0F;
|
itemRender.zLevel = 0.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawString(int x, int y, String message)
|
public void drawString(int x, int y, String message) {
|
||||||
{
|
|
||||||
drawString(x, y, message, 4210752);
|
drawString(x, y, message, 4210752);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawString(int x, int y, String message, int color)
|
public void drawString(int x, int y, String message, int color) {
|
||||||
{
|
|
||||||
GL11.glDisable(GL11.GL_LIGHTING);
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
fontRendererObj.drawString(message, x, y, color);
|
fontRendererObj.drawString(message, x, y, color);
|
||||||
GL11.glEnable(GL11.GL_LIGHTING);
|
GL11.glEnable(GL11.GL_LIGHTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawTooltip(int x, int y, String message)
|
public void drawTooltip(int x, int y, String message) {
|
||||||
{
|
|
||||||
GL11.glDisable(GL11.GL_LIGHTING);
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
drawHoveringText(Arrays.asList(message.split("\n")), x, y);
|
drawHoveringText(Arrays.asList(message.split("\n")), x, y);
|
||||||
GL11.glEnable(GL11.GL_LIGHTING);
|
GL11.glEnable(GL11.GL_LIGHTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawTooltip(int x, int y, ItemStack stack)
|
public void drawTooltip(int x, int y, ItemStack stack) {
|
||||||
{
|
|
||||||
renderToolTip(stack, x, y);
|
renderToolTip(stack, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawTexture(int x, int y, int textureX, int textureY, int width, int height)
|
public void drawTexture(int x, int y, int textureX, int textureY, int width, int height) {
|
||||||
{
|
|
||||||
drawTexturedModalRect(x, y, textureX, textureY, width, height);
|
drawTexturedModalRect(x, y, textureX, textureY, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String t(String name, Object... format)
|
public String t(String name, Object... format) {
|
||||||
{
|
|
||||||
return I18n.translateToLocalFormatted(name, format);
|
return I18n.translateToLocalFormatted(name, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
18
src/main/java/refinedstorage/gui/GuiConstructor.java
Normal file → Executable file
@@ -6,20 +6,17 @@ import refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
|
|||||||
import refinedstorage.tile.TileConstructor;
|
import refinedstorage.tile.TileConstructor;
|
||||||
import refinedstorage.util.InventoryUtils;
|
import refinedstorage.util.InventoryUtils;
|
||||||
|
|
||||||
public class GuiConstructor extends GuiBase
|
public class GuiConstructor extends GuiBase {
|
||||||
{
|
|
||||||
private TileConstructor constructor;
|
private TileConstructor constructor;
|
||||||
|
|
||||||
public GuiConstructor(ContainerConstructor container, TileConstructor constructor)
|
public GuiConstructor(ContainerConstructor container, TileConstructor constructor) {
|
||||||
{
|
|
||||||
super(container, 176, 137);
|
super(container, 176, 137);
|
||||||
|
|
||||||
this.constructor = constructor;
|
this.constructor = constructor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y)
|
public void init(int x, int y) {
|
||||||
{
|
|
||||||
addSideButton(new SideButtonRedstoneMode(constructor));
|
addSideButton(new SideButtonRedstoneMode(constructor));
|
||||||
|
|
||||||
addSideButton(new SideButtonCompare(constructor, InventoryUtils.COMPARE_DAMAGE));
|
addSideButton(new SideButtonCompare(constructor, InventoryUtils.COMPARE_DAMAGE));
|
||||||
@@ -27,21 +24,18 @@ public class GuiConstructor extends GuiBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(int x, int y)
|
public void update(int x, int y) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBackground(int x, int y, int mouseX, int mouseY)
|
public void drawBackground(int x, int y, int mouseX, int mouseY) {
|
||||||
{
|
|
||||||
bindTexture("gui/constructor.png");
|
bindTexture("gui/constructor.png");
|
||||||
|
|
||||||
drawTexture(x, y, 0, 0, width, height);
|
drawTexture(x, y, 0, 0, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawForeground(int mouseX, int mouseY)
|
public void drawForeground(int mouseX, int mouseY) {
|
||||||
{
|
|
||||||
drawString(7, 7, t("gui.refinedstorage:constructor"));
|
drawString(7, 7, t("gui.refinedstorage:constructor"));
|
||||||
drawString(7, 43, t("container.inventory"));
|
drawString(7, 43, t("container.inventory"));
|
||||||
}
|
}
|
||||||
|
43
src/main/java/refinedstorage/gui/GuiController.java
Normal file → Executable file
@@ -9,8 +9,7 @@ import refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
|
|||||||
import refinedstorage.tile.TileController;
|
import refinedstorage.tile.TileController;
|
||||||
import refinedstorage.tile.TileMachine;
|
import refinedstorage.tile.TileMachine;
|
||||||
|
|
||||||
public class GuiController extends GuiBase
|
public class GuiController extends GuiBase {
|
||||||
{
|
|
||||||
private TileController controller;
|
private TileController controller;
|
||||||
|
|
||||||
private int barX = 8;
|
private int barX = 8;
|
||||||
@@ -20,28 +19,24 @@ public class GuiController extends GuiBase
|
|||||||
|
|
||||||
private Scrollbar scrollbar = new Scrollbar(157, 20, 12, 59);
|
private Scrollbar scrollbar = new Scrollbar(157, 20, 12, 59);
|
||||||
|
|
||||||
public GuiController(ContainerController container, TileController controller)
|
public GuiController(ContainerController container, TileController controller) {
|
||||||
{
|
|
||||||
super(container, 176, 181);
|
super(container, 176, 181);
|
||||||
|
|
||||||
this.controller = controller;
|
this.controller = controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y)
|
public void init(int x, int y) {
|
||||||
{
|
|
||||||
addSideButton(new SideButtonRedstoneMode(controller));
|
addSideButton(new SideButtonRedstoneMode(controller));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(int x, int y)
|
public void update(int x, int y) {
|
||||||
{
|
|
||||||
scrollbar.setCanScroll(getRows() > getVisibleRows());
|
scrollbar.setCanScroll(getRows() > getVisibleRows());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBackground(int x, int y, int mouseX, int mouseY)
|
public void drawBackground(int x, int y, int mouseX, int mouseY) {
|
||||||
{
|
|
||||||
bindTexture("gui/controller.png");
|
bindTexture("gui/controller.png");
|
||||||
|
|
||||||
drawTexture(x, y, 0, 0, width, height);
|
drawTexture(x, y, 0, 0, width, height);
|
||||||
@@ -54,8 +49,7 @@ public class GuiController extends GuiBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawForeground(int mouseX, int mouseY)
|
public void drawForeground(int mouseX, int mouseY) {
|
||||||
{
|
|
||||||
scrollbar.update(this, mouseX, mouseY);
|
scrollbar.update(this, mouseX, mouseY);
|
||||||
|
|
||||||
drawString(7, 7, t("gui.refinedstorage:controller." + controller.getType().getId()));
|
drawString(7, 7, t("gui.refinedstorage:controller." + controller.getType().getId()));
|
||||||
@@ -68,10 +62,8 @@ public class GuiController extends GuiBase
|
|||||||
|
|
||||||
RenderHelper.enableGUIStandardItemLighting();
|
RenderHelper.enableGUIStandardItemLighting();
|
||||||
|
|
||||||
for (int i = 0; i < 4; ++i)
|
for (int i = 0; i < 4; ++i) {
|
||||||
{
|
if (slot < controller.getMachines().size()) {
|
||||||
if (slot < controller.getMachines().size())
|
|
||||||
{
|
|
||||||
TileMachine machine = controller.getMachines().get(slot);
|
TileMachine machine = controller.getMachines().get(slot);
|
||||||
IBlockState machineState = machine.getWorld().getBlockState(machine.getPos());
|
IBlockState machineState = machine.getWorld().getBlockState(machine.getPos());
|
||||||
Block machineBlock = machineState.getBlock();
|
Block machineBlock = machineState.getBlock();
|
||||||
@@ -82,39 +74,32 @@ public class GuiController extends GuiBase
|
|||||||
drawString(x + 21, y + 5, t("misc.refinedstorage:energy_usage_minimal", machine.getEnergyUsage()));
|
drawString(x + 21, y + 5, t("misc.refinedstorage:energy_usage_minimal", machine.getEnergyUsage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == 1)
|
if (i == 1) {
|
||||||
{
|
|
||||||
x = 33;
|
x = 33;
|
||||||
y += 30;
|
y += 30;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
x += 60;
|
x += 60;
|
||||||
}
|
}
|
||||||
|
|
||||||
slot++;
|
slot++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inBounds(barX, barY, barWidth, barHeight, mouseX, mouseY))
|
if (inBounds(barX, barY, barWidth, barHeight, mouseX, mouseY)) {
|
||||||
{
|
|
||||||
drawTooltip(mouseX, mouseY, t("misc.refinedstorage:energy_usage", controller.getEnergyUsage()) + "\n" + t("misc.refinedstorage:energy_stored", controller.getEnergyStored(null), controller.getMaxEnergyStored(null)));
|
drawTooltip(mouseX, mouseY, t("misc.refinedstorage:energy_usage", controller.getEnergyUsage()) + "\n" + t("misc.refinedstorage:energy_stored", controller.getEnergyStored(null), controller.getMaxEnergyStored(null)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getOffset()
|
public int getOffset() {
|
||||||
{
|
|
||||||
return (int) (scrollbar.getCurrentScroll() / 59f * (float) getRows());
|
return (int) (scrollbar.getCurrentScroll() / 59f * (float) getRows());
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getRows()
|
private int getRows() {
|
||||||
{
|
|
||||||
int max = (int) Math.ceil((float) controller.getMachines().size() / (float) 2);
|
int max = (int) Math.ceil((float) controller.getMachines().size() / (float) 2);
|
||||||
|
|
||||||
return max < 0 ? 0 : max;
|
return max < 0 ? 0 : max;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getVisibleRows()
|
private int getVisibleRows() {
|
||||||
{
|
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
18
src/main/java/refinedstorage/gui/GuiDestructor.java
Normal file → Executable file
@@ -4,39 +4,33 @@ import refinedstorage.container.ContainerDestructor;
|
|||||||
import refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
|
import refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
|
||||||
import refinedstorage.tile.TileDestructor;
|
import refinedstorage.tile.TileDestructor;
|
||||||
|
|
||||||
public class GuiDestructor extends GuiBase
|
public class GuiDestructor extends GuiBase {
|
||||||
{
|
|
||||||
private TileDestructor destructor;
|
private TileDestructor destructor;
|
||||||
|
|
||||||
public GuiDestructor(ContainerDestructor container, TileDestructor destructor)
|
public GuiDestructor(ContainerDestructor container, TileDestructor destructor) {
|
||||||
{
|
|
||||||
super(container, 176, 131);
|
super(container, 176, 131);
|
||||||
|
|
||||||
this.destructor = destructor;
|
this.destructor = destructor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y)
|
public void init(int x, int y) {
|
||||||
{
|
|
||||||
addSideButton(new SideButtonRedstoneMode(destructor));
|
addSideButton(new SideButtonRedstoneMode(destructor));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(int x, int y)
|
public void update(int x, int y) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBackground(int x, int y, int mouseX, int mouseY)
|
public void drawBackground(int x, int y, int mouseX, int mouseY) {
|
||||||
{
|
|
||||||
bindTexture("gui/destructor.png");
|
bindTexture("gui/destructor.png");
|
||||||
|
|
||||||
drawTexture(x, y, 0, 0, width, height);
|
drawTexture(x, y, 0, 0, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawForeground(int mouseX, int mouseY)
|
public void drawForeground(int mouseX, int mouseY) {
|
||||||
{
|
|
||||||
drawString(7, 7, t("gui.refinedstorage:destructor"));
|
drawString(7, 7, t("gui.refinedstorage:destructor"));
|
||||||
drawString(7, 39, t("container.inventory"));
|
drawString(7, 39, t("container.inventory"));
|
||||||
}
|
}
|
||||||
|
34
src/main/java/refinedstorage/gui/GuiDetector.java
Normal file → Executable file
@@ -1,7 +1,6 @@
|
|||||||
package refinedstorage.gui;
|
package refinedstorage.gui;
|
||||||
|
|
||||||
import com.google.common.primitives.Ints;
|
import com.google.common.primitives.Ints;
|
||||||
import java.io.IOException;
|
|
||||||
import net.minecraft.client.gui.GuiTextField;
|
import net.minecraft.client.gui.GuiTextField;
|
||||||
import refinedstorage.RefinedStorage;
|
import refinedstorage.RefinedStorage;
|
||||||
import refinedstorage.container.ContainerDetector;
|
import refinedstorage.container.ContainerDetector;
|
||||||
@@ -11,22 +10,21 @@ import refinedstorage.network.MessageDetectorAmountUpdate;
|
|||||||
import refinedstorage.tile.TileDetector;
|
import refinedstorage.tile.TileDetector;
|
||||||
import refinedstorage.util.InventoryUtils;
|
import refinedstorage.util.InventoryUtils;
|
||||||
|
|
||||||
public class GuiDetector extends GuiBase
|
import java.io.IOException;
|
||||||
{
|
|
||||||
|
public class GuiDetector extends GuiBase {
|
||||||
private TileDetector detector;
|
private TileDetector detector;
|
||||||
|
|
||||||
private GuiTextField amountField;
|
private GuiTextField amountField;
|
||||||
|
|
||||||
public GuiDetector(ContainerDetector container, TileDetector detector)
|
public GuiDetector(ContainerDetector container, TileDetector detector) {
|
||||||
{
|
|
||||||
super(container, 176, 137);
|
super(container, 176, 137);
|
||||||
|
|
||||||
this.detector = detector;
|
this.detector = detector;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y)
|
public void init(int x, int y) {
|
||||||
{
|
|
||||||
addSideButton(new SideButtonCompare(detector, InventoryUtils.COMPARE_DAMAGE));
|
addSideButton(new SideButtonCompare(detector, InventoryUtils.COMPARE_DAMAGE));
|
||||||
addSideButton(new SideButtonCompare(detector, InventoryUtils.COMPARE_NBT));
|
addSideButton(new SideButtonCompare(detector, InventoryUtils.COMPARE_NBT));
|
||||||
|
|
||||||
@@ -42,13 +40,11 @@ public class GuiDetector extends GuiBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(int x, int y)
|
public void update(int x, int y) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBackground(int x, int y, int mouseX, int mouseY)
|
public void drawBackground(int x, int y, int mouseX, int mouseY) {
|
||||||
{
|
|
||||||
bindTexture("gui/detector.png");
|
bindTexture("gui/detector.png");
|
||||||
|
|
||||||
drawTexture(x, y, 0, 0, width, height);
|
drawTexture(x, y, 0, 0, width, height);
|
||||||
@@ -57,26 +53,20 @@ public class GuiDetector extends GuiBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawForeground(int mouseX, int mouseY)
|
public void drawForeground(int mouseX, int mouseY) {
|
||||||
{
|
|
||||||
drawString(7, 7, t("gui.refinedstorage:detector"));
|
drawString(7, 7, t("gui.refinedstorage:detector"));
|
||||||
drawString(7, 43, t("container.inventory"));
|
drawString(7, 43, t("container.inventory"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void keyTyped(char character, int keyCode) throws IOException
|
protected void keyTyped(char character, int keyCode) throws IOException {
|
||||||
{
|
if (!checkHotbarKeys(keyCode) && amountField.textboxKeyTyped(character, keyCode)) {
|
||||||
if (!checkHotbarKeys(keyCode) && amountField.textboxKeyTyped(character, keyCode))
|
|
||||||
{
|
|
||||||
Integer result = Ints.tryParse(amountField.getText());
|
Integer result = Ints.tryParse(amountField.getText());
|
||||||
|
|
||||||
if (result != null)
|
if (result != null) {
|
||||||
{
|
|
||||||
RefinedStorage.NETWORK.sendToServer(new MessageDetectorAmountUpdate(detector, result));
|
RefinedStorage.NETWORK.sendToServer(new MessageDetectorAmountUpdate(detector, result));
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
super.keyTyped(character, keyCode);
|
super.keyTyped(character, keyCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
18
src/main/java/refinedstorage/gui/GuiExporter.java
Normal file → Executable file
@@ -6,20 +6,17 @@ import refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
|
|||||||
import refinedstorage.tile.TileExporter;
|
import refinedstorage.tile.TileExporter;
|
||||||
import refinedstorage.util.InventoryUtils;
|
import refinedstorage.util.InventoryUtils;
|
||||||
|
|
||||||
public class GuiExporter extends GuiBase
|
public class GuiExporter extends GuiBase {
|
||||||
{
|
|
||||||
private TileExporter exporter;
|
private TileExporter exporter;
|
||||||
|
|
||||||
public GuiExporter(ContainerExporter container, TileExporter exporter)
|
public GuiExporter(ContainerExporter container, TileExporter exporter) {
|
||||||
{
|
|
||||||
super(container, 176, 137);
|
super(container, 176, 137);
|
||||||
|
|
||||||
this.exporter = exporter;
|
this.exporter = exporter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y)
|
public void init(int x, int y) {
|
||||||
{
|
|
||||||
addSideButton(new SideButtonRedstoneMode(exporter));
|
addSideButton(new SideButtonRedstoneMode(exporter));
|
||||||
|
|
||||||
addSideButton(new SideButtonCompare(exporter, InventoryUtils.COMPARE_DAMAGE));
|
addSideButton(new SideButtonCompare(exporter, InventoryUtils.COMPARE_DAMAGE));
|
||||||
@@ -27,21 +24,18 @@ public class GuiExporter extends GuiBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(int x, int y)
|
public void update(int x, int y) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBackground(int x, int y, int mouseX, int mouseY)
|
public void drawBackground(int x, int y, int mouseX, int mouseY) {
|
||||||
{
|
|
||||||
bindTexture("gui/exporter.png");
|
bindTexture("gui/exporter.png");
|
||||||
|
|
||||||
drawTexture(x, y, 0, 0, width, height);
|
drawTexture(x, y, 0, 0, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawForeground(int mouseX, int mouseY)
|
public void drawForeground(int mouseX, int mouseY) {
|
||||||
{
|
|
||||||
drawString(7, 7, t("gui.refinedstorage:exporter"));
|
drawString(7, 7, t("gui.refinedstorage:exporter"));
|
||||||
drawString(7, 43, t("container.inventory"));
|
drawString(7, 43, t("container.inventory"));
|
||||||
}
|
}
|
||||||
|
186
src/main/java/refinedstorage/gui/GuiGrid.java
Normal file → Executable file
@@ -1,10 +1,5 @@
|
|||||||
package refinedstorage.gui;
|
package refinedstorage.gui;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.client.gui.GuiTextField;
|
import net.minecraft.client.gui.GuiTextField;
|
||||||
@@ -25,8 +20,13 @@ import refinedstorage.storage.StorageItem;
|
|||||||
import refinedstorage.tile.TileController;
|
import refinedstorage.tile.TileController;
|
||||||
import refinedstorage.tile.TileGrid;
|
import refinedstorage.tile.TileGrid;
|
||||||
|
|
||||||
public class GuiGrid extends GuiBase
|
import java.io.IOException;
|
||||||
{
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class GuiGrid extends GuiBase {
|
||||||
private ContainerGrid container;
|
private ContainerGrid container;
|
||||||
private TileGrid grid;
|
private TileGrid grid;
|
||||||
|
|
||||||
@@ -37,8 +37,7 @@ public class GuiGrid extends GuiBase
|
|||||||
|
|
||||||
private Scrollbar scrollbar = new Scrollbar(174, 20, 12, 70);
|
private Scrollbar scrollbar = new Scrollbar(174, 20, 12, 70);
|
||||||
|
|
||||||
public GuiGrid(ContainerGrid container, TileGrid grid)
|
public GuiGrid(ContainerGrid container, TileGrid grid) {
|
||||||
{
|
|
||||||
super(container, 193, grid.getType() == EnumGridType.CRAFTING ? 256 : 190);
|
super(container, 193, grid.getType() == EnumGridType.CRAFTING ? 256 : 190);
|
||||||
|
|
||||||
this.container = container;
|
this.container = container;
|
||||||
@@ -46,8 +45,7 @@ public class GuiGrid extends GuiBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y)
|
public void init(int x, int y) {
|
||||||
{
|
|
||||||
addSideButton(new SideButtonRedstoneMode(grid));
|
addSideButton(new SideButtonRedstoneMode(grid));
|
||||||
|
|
||||||
addSideButton(new SideButtonGridSortingDirection(grid));
|
addSideButton(new SideButtonGridSortingDirection(grid));
|
||||||
@@ -62,25 +60,20 @@ public class GuiGrid extends GuiBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(int x, int y)
|
public void update(int x, int y) {
|
||||||
{
|
|
||||||
scrollbar.setCanScroll(getRows() > getVisibleRows());
|
scrollbar.setCanScroll(getRows() > getVisibleRows());
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getOffset()
|
public int getOffset() {
|
||||||
{
|
|
||||||
return (int) (scrollbar.getCurrentScroll() / 70f * (float) getRows());
|
return (int) (scrollbar.getCurrentScroll() / 70f * (float) getRows());
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getVisibleRows()
|
public int getVisibleRows() {
|
||||||
{
|
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRows()
|
public int getRows() {
|
||||||
{
|
if (!grid.isConnected()) {
|
||||||
if (!grid.isConnected())
|
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,20 +82,16 @@ public class GuiGrid extends GuiBase
|
|||||||
return max < 0 ? 0 : max;
|
return max < 0 ? 0 : max;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isHoveringOverValidSlot(List<StorageItem> items)
|
private boolean isHoveringOverValidSlot(List<StorageItem> items) {
|
||||||
{
|
|
||||||
return grid.isConnected() && isHoveringOverSlot() && hoveringSlotId < items.size();
|
return grid.isConnected() && isHoveringOverSlot() && hoveringSlotId < items.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isHoveringOverSlot()
|
private boolean isHoveringOverSlot() {
|
||||||
{
|
|
||||||
return hoveringSlotId >= 0;
|
return hoveringSlotId >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHoveringOverClear(int mouseX, int mouseY)
|
public boolean isHoveringOverClear(int mouseX, int mouseY) {
|
||||||
{
|
if (grid.getType() == EnumGridType.CRAFTING) {
|
||||||
if (grid.getType() == EnumGridType.CRAFTING)
|
|
||||||
{
|
|
||||||
return inBounds(81, 105, 7, 7, mouseX, mouseY);
|
return inBounds(81, 105, 7, 7, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,14 +99,10 @@ 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.getType() == EnumGridType.CRAFTING) {
|
||||||
if (grid.getType() == EnumGridType.CRAFTING)
|
|
||||||
{
|
|
||||||
bindTexture("gui/crafting_grid.png");
|
bindTexture("gui/crafting_grid.png");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
bindTexture("gui/grid.png");
|
bindTexture("gui/grid.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,14 +114,12 @@ public class GuiGrid extends GuiBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawForeground(int mouseX, int mouseY)
|
public void drawForeground(int mouseX, int mouseY) {
|
||||||
{
|
|
||||||
scrollbar.update(this, mouseX, mouseY);
|
scrollbar.update(this, mouseX, mouseY);
|
||||||
|
|
||||||
drawString(7, 7, t("gui.refinedstorage:grid"));
|
drawString(7, 7, t("gui.refinedstorage:grid"));
|
||||||
|
|
||||||
if (grid.getType() == EnumGridType.CRAFTING)
|
if (grid.getType() == EnumGridType.CRAFTING) {
|
||||||
{
|
|
||||||
drawString(7, 94, t("container.crafting"));
|
drawString(7, 94, t("container.crafting"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,40 +136,29 @@ public class GuiGrid extends GuiBase
|
|||||||
|
|
||||||
RenderHelper.enableGUIStandardItemLighting();
|
RenderHelper.enableGUIStandardItemLighting();
|
||||||
|
|
||||||
for (int i = 0; i < 9 * getVisibleRows(); ++i)
|
for (int i = 0; i < 9 * getVisibleRows(); ++i) {
|
||||||
{
|
if (slot < items.size()) {
|
||||||
if (slot < items.size())
|
|
||||||
{
|
|
||||||
int qty = items.get(slot).getQuantity();
|
int qty = items.get(slot).getQuantity();
|
||||||
|
|
||||||
String text;
|
String text;
|
||||||
|
|
||||||
if (qty >= 1000000)
|
if (qty >= 1000000) {
|
||||||
{
|
|
||||||
text = String.valueOf((int) Math.floor(qty / 1000000)) + "M";
|
text = String.valueOf((int) Math.floor(qty / 1000000)) + "M";
|
||||||
}
|
} else if (qty >= 1000) {
|
||||||
else if (qty >= 1000)
|
|
||||||
{
|
|
||||||
text = String.valueOf((int) Math.floor(qty / 1000)) + "K";
|
text = String.valueOf((int) Math.floor(qty / 1000)) + "K";
|
||||||
}
|
} else if (qty == 1) {
|
||||||
else if (qty == 1)
|
|
||||||
{
|
|
||||||
text = null;
|
text = null;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
text = String.valueOf(qty);
|
text = String.valueOf(qty);
|
||||||
}
|
}
|
||||||
|
|
||||||
drawItem(x, y, items.get(slot).toItemStack(), true, text);
|
drawItem(x, y, items.get(slot).toItemStack(), true, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inBounds(x, y, 16, 16, mouseX, mouseY) || !grid.isConnected())
|
if (inBounds(x, y, 16, 16, mouseX, mouseY) || !grid.isConnected()) {
|
||||||
{
|
|
||||||
hoveringSlotId = slot;
|
hoveringSlotId = slot;
|
||||||
|
|
||||||
if (slot < items.size())
|
if (slot < items.size()) {
|
||||||
{
|
|
||||||
// We need to use the ID, because if we filter, the client-side index will change
|
// We need to use the ID, because if we filter, the client-side index will change
|
||||||
// while the serverside's index will still be the same.
|
// while the serverside's index will still be the same.
|
||||||
hoveringId = items.get(slot).getId();
|
hoveringId = items.get(slot).getId();
|
||||||
@@ -209,61 +181,48 @@ public class GuiGrid extends GuiBase
|
|||||||
|
|
||||||
x += 18;
|
x += 18;
|
||||||
|
|
||||||
if ((i + 1) % 9 == 0)
|
if ((i + 1) % 9 == 0) {
|
||||||
{
|
|
||||||
x = 8;
|
x = 8;
|
||||||
y += 18;
|
y += 18;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isHoveringOverValidSlot(items))
|
if (isHoveringOverValidSlot(items)) {
|
||||||
{
|
|
||||||
drawTooltip(mouseX, mouseY, items.get(hoveringSlotId).toItemStack());
|
drawTooltip(mouseX, mouseY, items.get(hoveringSlotId).toItemStack());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isHoveringOverClear(mouseX, mouseY))
|
if (isHoveringOverClear(mouseX, mouseY)) {
|
||||||
{
|
|
||||||
drawTooltip(mouseX, mouseY, t("misc.refinedstorage:clear"));
|
drawTooltip(mouseX, mouseY, t("misc.refinedstorage:clear"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<StorageItem> getItems()
|
public List<StorageItem> getItems() {
|
||||||
{
|
|
||||||
List<StorageItem> items = new ArrayList<StorageItem>();
|
List<StorageItem> items = new ArrayList<StorageItem>();
|
||||||
|
|
||||||
if (!grid.isConnected())
|
if (!grid.isConnected()) {
|
||||||
{
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
items.addAll(grid.getController().getItems());
|
items.addAll(grid.getController().getItems());
|
||||||
|
|
||||||
if (!searchField.getText().trim().isEmpty())
|
if (!searchField.getText().trim().isEmpty()) {
|
||||||
{
|
|
||||||
Iterator<StorageItem> t = items.iterator();
|
Iterator<StorageItem> t = items.iterator();
|
||||||
|
|
||||||
while (t.hasNext())
|
while (t.hasNext()) {
|
||||||
{
|
|
||||||
StorageItem item = t.next();
|
StorageItem item = t.next();
|
||||||
|
|
||||||
if (!item.toItemStack().getDisplayName().toLowerCase().contains(searchField.getText().toLowerCase()))
|
if (!item.toItemStack().getDisplayName().toLowerCase().contains(searchField.getText().toLowerCase())) {
|
||||||
{
|
|
||||||
t.remove();
|
t.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
items.sort(new Comparator<StorageItem>()
|
items.sort(new Comparator<StorageItem>() {
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(StorageItem o1, StorageItem o2)
|
public int compare(StorageItem o1, StorageItem o2) {
|
||||||
{
|
if (grid.getSortingDirection() == TileGrid.SORTING_DIRECTION_ASCENDING) {
|
||||||
if (grid.getSortingDirection() == TileGrid.SORTING_DIRECTION_ASCENDING)
|
|
||||||
{
|
|
||||||
return o2.toItemStack().getDisplayName().compareTo(o1.toItemStack().getDisplayName());
|
return o2.toItemStack().getDisplayName().compareTo(o1.toItemStack().getDisplayName());
|
||||||
}
|
} else if (grid.getSortingDirection() == TileGrid.SORTING_DIRECTION_DESCENDING) {
|
||||||
else if (grid.getSortingDirection() == TileGrid.SORTING_DIRECTION_DESCENDING)
|
|
||||||
{
|
|
||||||
return o1.toItemStack().getDisplayName().compareTo(o2.toItemStack().getDisplayName());
|
return o1.toItemStack().getDisplayName().compareTo(o2.toItemStack().getDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,19 +230,13 @@ public class GuiGrid extends GuiBase
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (grid.getSortingType() == TileGrid.SORTING_TYPE_QUANTITY)
|
if (grid.getSortingType() == TileGrid.SORTING_TYPE_QUANTITY) {
|
||||||
{
|
items.sort(new Comparator<StorageItem>() {
|
||||||
items.sort(new Comparator<StorageItem>()
|
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(StorageItem o1, StorageItem o2)
|
public int compare(StorageItem o1, StorageItem o2) {
|
||||||
{
|
if (grid.getSortingDirection() == TileGrid.SORTING_DIRECTION_ASCENDING) {
|
||||||
if (grid.getSortingDirection() == TileGrid.SORTING_DIRECTION_ASCENDING)
|
|
||||||
{
|
|
||||||
return Integer.valueOf(o2.getQuantity()).compareTo(o1.getQuantity());
|
return Integer.valueOf(o2.getQuantity()).compareTo(o1.getQuantity());
|
||||||
}
|
} else if (grid.getSortingDirection() == TileGrid.SORTING_DIRECTION_DESCENDING) {
|
||||||
else if (grid.getSortingDirection() == TileGrid.SORTING_DIRECTION_DESCENDING)
|
|
||||||
{
|
|
||||||
return Integer.valueOf(o1.getQuantity()).compareTo(o2.getQuantity());
|
return Integer.valueOf(o1.getQuantity()).compareTo(o2.getQuantity());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,40 +249,28 @@ public class GuiGrid extends GuiBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(int mouseX, int mouseY, int clickedButton) throws IOException
|
public void mouseClicked(int mouseX, int mouseY, int clickedButton) throws IOException {
|
||||||
{
|
|
||||||
super.mouseClicked(mouseX, mouseY, clickedButton);
|
super.mouseClicked(mouseX, mouseY, clickedButton);
|
||||||
|
|
||||||
boolean clickedClear = clickedButton == 0 && isHoveringOverClear(mouseX - guiLeft, mouseY - guiTop);
|
boolean clickedClear = clickedButton == 0 && isHoveringOverClear(mouseX - guiLeft, mouseY - guiTop);
|
||||||
|
|
||||||
if (grid.isConnected())
|
if (grid.isConnected()) {
|
||||||
{
|
|
||||||
TileController controller = grid.getController();
|
TileController controller = grid.getController();
|
||||||
|
|
||||||
if (isHoveringOverSlot() && container.getPlayer().inventory.getItemStack() != null)
|
if (isHoveringOverSlot() && container.getPlayer().inventory.getItemStack() != null) {
|
||||||
{
|
|
||||||
RefinedStorage.NETWORK.sendToServer(new MessageStoragePush(controller.getPos().getX(), controller.getPos().getY(), controller.getPos().getZ(), -1, clickedButton == 1));
|
RefinedStorage.NETWORK.sendToServer(new MessageStoragePush(controller.getPos().getX(), controller.getPos().getY(), controller.getPos().getZ(), -1, clickedButton == 1));
|
||||||
}
|
} else if (isHoveringOverValidSlot(getItems()) && container.getPlayer().inventory.getItemStack() == null) {
|
||||||
else if (isHoveringOverValidSlot(getItems()) && container.getPlayer().inventory.getItemStack() == null)
|
|
||||||
{
|
|
||||||
boolean half = clickedButton == 1;
|
boolean half = clickedButton == 1;
|
||||||
boolean shift = GuiScreen.isShiftKeyDown();
|
boolean shift = GuiScreen.isShiftKeyDown();
|
||||||
boolean one = clickedButton == 2;
|
boolean one = clickedButton == 2;
|
||||||
|
|
||||||
RefinedStorage.NETWORK.sendToServer(new MessageStoragePull(controller.getPos().getX(), controller.getPos().getY(), controller.getPos().getZ(), hoveringId, half, one, shift));
|
RefinedStorage.NETWORK.sendToServer(new MessageStoragePull(controller.getPos().getX(), controller.getPos().getY(), controller.getPos().getZ(), hoveringId, half, one, shift));
|
||||||
}
|
} else if (clickedClear) {
|
||||||
else if (clickedClear)
|
|
||||||
{
|
|
||||||
RefinedStorage.NETWORK.sendToServer(new MessageGridCraftingClear(grid));
|
RefinedStorage.NETWORK.sendToServer(new MessageGridCraftingClear(grid));
|
||||||
}
|
} else {
|
||||||
else
|
for (Slot slot : container.getPlayerInventorySlots()) {
|
||||||
{
|
if (inBounds(slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, mouseX - guiLeft, mouseY - guiTop)) {
|
||||||
for (Slot slot : container.getPlayerInventorySlots())
|
if (GuiScreen.isShiftKeyDown()) {
|
||||||
{
|
|
||||||
if (inBounds(slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, mouseX - guiLeft, mouseY - guiTop))
|
|
||||||
{
|
|
||||||
if (GuiScreen.isShiftKeyDown())
|
|
||||||
{
|
|
||||||
RefinedStorage.NETWORK.sendToServer(new MessageStoragePush(controller.getPos().getX(), controller.getPos().getY(), controller.getPos().getZ(), slot.slotNumber, clickedButton == 1));
|
RefinedStorage.NETWORK.sendToServer(new MessageStoragePush(controller.getPos().getX(), controller.getPos().getY(), controller.getPos().getZ(), slot.slotNumber, clickedButton == 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -337,20 +278,15 @@ public class GuiGrid extends GuiBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clickedClear)
|
if (clickedClear) {
|
||||||
{
|
|
||||||
mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.ui_button_click, 1.0F));
|
mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.ui_button_click, 1.0F));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void keyTyped(char character, int keyCode) throws IOException
|
protected void keyTyped(char character, int keyCode) throws IOException {
|
||||||
{
|
if (!checkHotbarKeys(keyCode) && searchField.textboxKeyTyped(character, keyCode)) {
|
||||||
if (!checkHotbarKeys(keyCode) && searchField.textboxKeyTyped(character, keyCode))
|
} else {
|
||||||
{
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
super.keyTyped(character, keyCode);
|
super.keyTyped(character, keyCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
18
src/main/java/refinedstorage/gui/GuiHandler.java
Normal file → Executable file
@@ -11,12 +11,9 @@ import refinedstorage.container.*;
|
|||||||
import refinedstorage.storage.IStorageGui;
|
import refinedstorage.storage.IStorageGui;
|
||||||
import refinedstorage.tile.*;
|
import refinedstorage.tile.*;
|
||||||
|
|
||||||
public class GuiHandler implements IGuiHandler
|
public class GuiHandler implements IGuiHandler {
|
||||||
{
|
private Container getContainer(int ID, EntityPlayer player, TileEntity tile) {
|
||||||
private Container getContainer(int ID, EntityPlayer player, TileEntity tile)
|
switch (ID) {
|
||||||
{
|
|
||||||
switch (ID)
|
|
||||||
{
|
|
||||||
case RefinedStorageGui.CONTROLLER:
|
case RefinedStorageGui.CONTROLLER:
|
||||||
return new ContainerController(player);
|
return new ContainerController(player);
|
||||||
case RefinedStorageGui.GRID:
|
case RefinedStorageGui.GRID:
|
||||||
@@ -49,18 +46,15 @@ public class GuiHandler implements IGuiHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||||
{
|
|
||||||
return getContainer(ID, player, world.getTileEntity(new BlockPos(x, y, z)));
|
return getContainer(ID, player, world.getTileEntity(new BlockPos(x, y, z)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||||
{
|
|
||||||
TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
|
TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
|
||||||
|
|
||||||
switch (ID)
|
switch (ID) {
|
||||||
{
|
|
||||||
case RefinedStorageGui.CONTROLLER:
|
case RefinedStorageGui.CONTROLLER:
|
||||||
return new GuiController((ContainerController) getContainer(ID, player, tile), (TileController) tile);
|
return new GuiController((ContainerController) getContainer(ID, player, tile), (TileController) tile);
|
||||||
case RefinedStorageGui.GRID:
|
case RefinedStorageGui.GRID:
|
||||||
|
18
src/main/java/refinedstorage/gui/GuiImporter.java
Normal file → Executable file
@@ -7,20 +7,17 @@ import refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
|
|||||||
import refinedstorage.tile.TileImporter;
|
import refinedstorage.tile.TileImporter;
|
||||||
import refinedstorage.util.InventoryUtils;
|
import refinedstorage.util.InventoryUtils;
|
||||||
|
|
||||||
public class GuiImporter extends GuiBase
|
public class GuiImporter extends GuiBase {
|
||||||
{
|
|
||||||
private TileImporter importer;
|
private TileImporter importer;
|
||||||
|
|
||||||
public GuiImporter(ContainerImporter container, TileImporter importer)
|
public GuiImporter(ContainerImporter container, TileImporter importer) {
|
||||||
{
|
|
||||||
super(container, 176, 137);
|
super(container, 176, 137);
|
||||||
|
|
||||||
this.importer = importer;
|
this.importer = importer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y)
|
public void init(int x, int y) {
|
||||||
{
|
|
||||||
addSideButton(new SideButtonRedstoneMode(importer));
|
addSideButton(new SideButtonRedstoneMode(importer));
|
||||||
|
|
||||||
addSideButton(new SideButtonMode(importer));
|
addSideButton(new SideButtonMode(importer));
|
||||||
@@ -30,21 +27,18 @@ public class GuiImporter extends GuiBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(int x, int y)
|
public void update(int x, int y) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBackground(int x, int y, int mouseX, int mouseY)
|
public void drawBackground(int x, int y, int mouseX, int mouseY) {
|
||||||
{
|
|
||||||
bindTexture("gui/importer.png");
|
bindTexture("gui/importer.png");
|
||||||
|
|
||||||
drawTexture(x, y, 0, 0, width, height);
|
drawTexture(x, y, 0, 0, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawForeground(int mouseX, int mouseY)
|
public void drawForeground(int mouseX, int mouseY) {
|
||||||
{
|
|
||||||
drawString(7, 7, t("gui.refinedstorage:importer"));
|
drawString(7, 7, t("gui.refinedstorage:importer"));
|
||||||
drawString(7, 43, t("container.inventory"));
|
drawString(7, 43, t("container.inventory"));
|
||||||
}
|
}
|
||||||
|
21
src/main/java/refinedstorage/gui/GuiInterface.java
Normal file → Executable file
@@ -6,20 +6,17 @@ import refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
|
|||||||
import refinedstorage.tile.TileInterface;
|
import refinedstorage.tile.TileInterface;
|
||||||
import refinedstorage.util.InventoryUtils;
|
import refinedstorage.util.InventoryUtils;
|
||||||
|
|
||||||
public class GuiInterface extends GuiBase
|
public class GuiInterface extends GuiBase {
|
||||||
{
|
|
||||||
private TileInterface tile;
|
private TileInterface tile;
|
||||||
|
|
||||||
public GuiInterface(ContainerInterface container, TileInterface tile)
|
public GuiInterface(ContainerInterface container, TileInterface tile) {
|
||||||
{
|
|
||||||
super(container, 176, 218);
|
super(container, 176, 218);
|
||||||
|
|
||||||
this.tile = tile;
|
this.tile = tile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y)
|
public void init(int x, int y) {
|
||||||
{
|
|
||||||
addSideButton(new SideButtonRedstoneMode(tile));
|
addSideButton(new SideButtonRedstoneMode(tile));
|
||||||
|
|
||||||
addSideButton(new SideButtonCompare(tile, InventoryUtils.COMPARE_DAMAGE));
|
addSideButton(new SideButtonCompare(tile, InventoryUtils.COMPARE_DAMAGE));
|
||||||
@@ -27,27 +24,23 @@ public class GuiInterface extends GuiBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(int x, int y)
|
public void update(int x, int y) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBackground(int x, int y, int mouseX, int mouseY)
|
public void drawBackground(int x, int y, int mouseX, int mouseY) {
|
||||||
{
|
|
||||||
bindTexture("gui/interface.png");
|
bindTexture("gui/interface.png");
|
||||||
|
|
||||||
drawTexture(x, y, 0, 0, width, height);
|
drawTexture(x, y, 0, 0, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawForeground(int mouseX, int mouseY)
|
public void drawForeground(int mouseX, int mouseY) {
|
||||||
{
|
|
||||||
drawString(7, 7, t("gui.refinedstorage:interface.import"));
|
drawString(7, 7, t("gui.refinedstorage:interface.import"));
|
||||||
drawString(7, 42, t("gui.refinedstorage:interface.export"));
|
drawString(7, 42, t("gui.refinedstorage:interface.export"));
|
||||||
drawString(7, 123, t("container.inventory"));
|
drawString(7, 123, t("container.inventory"));
|
||||||
|
|
||||||
if (inBounds(162, 42, 7, 7, mouseX, mouseY))
|
if (inBounds(162, 42, 7, 7, mouseX, mouseY)) {
|
||||||
{
|
|
||||||
String message = t("gui.refinedstorage:interface.export.explanation.0");
|
String message = t("gui.refinedstorage:interface.export.explanation.0");
|
||||||
message += "\n" + t("gui.refinedstorage:interface.export.explanation.1");
|
message += "\n" + t("gui.refinedstorage:interface.export.explanation.1");
|
||||||
message += "\n" + t("gui.refinedstorage:interface.export.explanation.2");
|
message += "\n" + t("gui.refinedstorage:interface.export.explanation.2");
|
||||||
|
18
src/main/java/refinedstorage/gui/GuiRelay.java
Normal file → Executable file
@@ -4,39 +4,33 @@ import refinedstorage.container.ContainerRelay;
|
|||||||
import refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
|
import refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
|
||||||
import refinedstorage.tile.TileRelay;
|
import refinedstorage.tile.TileRelay;
|
||||||
|
|
||||||
public class GuiRelay extends GuiBase
|
public class GuiRelay extends GuiBase {
|
||||||
{
|
|
||||||
private TileRelay relay;
|
private TileRelay relay;
|
||||||
|
|
||||||
public GuiRelay(ContainerRelay container, TileRelay relay)
|
public GuiRelay(ContainerRelay container, TileRelay relay) {
|
||||||
{
|
|
||||||
super(container, 176, 131);
|
super(container, 176, 131);
|
||||||
|
|
||||||
this.relay = relay;
|
this.relay = relay;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y)
|
public void init(int x, int y) {
|
||||||
{
|
|
||||||
addSideButton(new SideButtonRedstoneMode(relay));
|
addSideButton(new SideButtonRedstoneMode(relay));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(int x, int y)
|
public void update(int x, int y) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBackground(int x, int y, int mouseX, int mouseY)
|
public void drawBackground(int x, int y, int mouseX, int mouseY) {
|
||||||
{
|
|
||||||
bindTexture("gui/relay.png");
|
bindTexture("gui/relay.png");
|
||||||
|
|
||||||
drawTexture(x, y, 0, 0, width, height);
|
drawTexture(x, y, 0, 0, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawForeground(int mouseX, int mouseY)
|
public void drawForeground(int mouseX, int mouseY) {
|
||||||
{
|
|
||||||
drawString(7, 7, t("gui.refinedstorage:relay"));
|
drawString(7, 7, t("gui.refinedstorage:relay"));
|
||||||
drawString(7, 39, t("container.inventory"));
|
drawString(7, 39, t("container.inventory"));
|
||||||
}
|
}
|
||||||
|
21
src/main/java/refinedstorage/gui/GuiSolderer.java
Normal file → Executable file
@@ -4,44 +4,37 @@ import net.minecraft.inventory.Container;
|
|||||||
import refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
|
import refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
|
||||||
import refinedstorage.tile.TileSolderer;
|
import refinedstorage.tile.TileSolderer;
|
||||||
|
|
||||||
public class GuiSolderer extends GuiBase
|
public class GuiSolderer extends GuiBase {
|
||||||
{
|
|
||||||
private TileSolderer solderer;
|
private TileSolderer solderer;
|
||||||
|
|
||||||
public GuiSolderer(Container container, TileSolderer solderer)
|
public GuiSolderer(Container container, TileSolderer solderer) {
|
||||||
{
|
|
||||||
super(container, 176, 177);
|
super(container, 176, 177);
|
||||||
|
|
||||||
this.solderer = solderer;
|
this.solderer = solderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y)
|
public void init(int x, int y) {
|
||||||
{
|
|
||||||
addSideButton(new SideButtonRedstoneMode(solderer));
|
addSideButton(new SideButtonRedstoneMode(solderer));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(int x, int y)
|
public void update(int x, int y) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBackground(int x, int y, int mouseX, int mouseY)
|
public void drawBackground(int x, int y, int mouseX, int mouseY) {
|
||||||
{
|
|
||||||
bindTexture("gui/solderer.png");
|
bindTexture("gui/solderer.png");
|
||||||
|
|
||||||
drawTexture(x, y, 0, 0, width, height);
|
drawTexture(x, y, 0, 0, width, height);
|
||||||
|
|
||||||
if (solderer.isWorking())
|
if (solderer.isWorking()) {
|
||||||
{
|
|
||||||
drawTexture(x + 83, y + 40 - 1, 177, 0, solderer.getProgressScaled(22), 15);
|
drawTexture(x + 83, y + 40 - 1, 177, 0, solderer.getProgressScaled(22), 15);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawForeground(int mouseX, int mouseY)
|
public void drawForeground(int mouseX, int mouseY) {
|
||||||
{
|
|
||||||
drawString(7, 7, t("gui.refinedstorage:solderer"));
|
drawString(7, 7, t("gui.refinedstorage:solderer"));
|
||||||
drawString(7, 82, t("container.inventory"));
|
drawString(7, 82, t("container.inventory"));
|
||||||
}
|
}
|
||||||
|
52
src/main/java/refinedstorage/gui/GuiStorage.java
Normal file → Executable file
@@ -1,7 +1,6 @@
|
|||||||
package refinedstorage.gui;
|
package refinedstorage.gui;
|
||||||
|
|
||||||
import com.google.common.primitives.Ints;
|
import com.google.common.primitives.Ints;
|
||||||
import java.io.IOException;
|
|
||||||
import net.minecraft.client.gui.GuiTextField;
|
import net.minecraft.client.gui.GuiTextField;
|
||||||
import refinedstorage.container.ContainerStorage;
|
import refinedstorage.container.ContainerStorage;
|
||||||
import refinedstorage.gui.sidebutton.SideButtonCompare;
|
import refinedstorage.gui.sidebutton.SideButtonCompare;
|
||||||
@@ -10,8 +9,9 @@ import refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
|
|||||||
import refinedstorage.storage.IStorageGui;
|
import refinedstorage.storage.IStorageGui;
|
||||||
import refinedstorage.util.InventoryUtils;
|
import refinedstorage.util.InventoryUtils;
|
||||||
|
|
||||||
public class GuiStorage extends GuiBase
|
import java.io.IOException;
|
||||||
{
|
|
||||||
|
public class GuiStorage extends GuiBase {
|
||||||
private IStorageGui gui;
|
private IStorageGui gui;
|
||||||
private String texture;
|
private String texture;
|
||||||
|
|
||||||
@@ -22,34 +22,28 @@ public class GuiStorage extends GuiBase
|
|||||||
private int barWidth = 16;
|
private int barWidth = 16;
|
||||||
private int barHeight = 58;
|
private int barHeight = 58;
|
||||||
|
|
||||||
public GuiStorage(ContainerStorage container, IStorageGui gui, String texture)
|
public GuiStorage(ContainerStorage container, IStorageGui gui, String texture) {
|
||||||
{
|
|
||||||
super(container, 176, 211);
|
super(container, 176, 211);
|
||||||
|
|
||||||
this.gui = gui;
|
this.gui = gui;
|
||||||
this.texture = texture;
|
this.texture = texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GuiStorage(ContainerStorage container, IStorageGui gui)
|
public GuiStorage(ContainerStorage container, IStorageGui gui) {
|
||||||
{
|
|
||||||
this(container, gui, "gui/storage.png");
|
this(container, gui, "gui/storage.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y)
|
public void init(int x, int y) {
|
||||||
{
|
if (gui.getRedstoneModeSetting() != null) {
|
||||||
if (gui.getRedstoneModeSetting() != null)
|
|
||||||
{
|
|
||||||
addSideButton(new SideButtonRedstoneMode(gui.getRedstoneModeSetting()));
|
addSideButton(new SideButtonRedstoneMode(gui.getRedstoneModeSetting()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gui.getModeSetting() != null)
|
if (gui.getModeSetting() != null) {
|
||||||
{
|
|
||||||
addSideButton(new SideButtonMode(gui.getModeSetting()));
|
addSideButton(new SideButtonMode(gui.getModeSetting()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gui.getCompareSetting() != null)
|
if (gui.getCompareSetting() != null) {
|
||||||
{
|
|
||||||
addSideButton(new SideButtonCompare(gui.getCompareSetting(), InventoryUtils.COMPARE_DAMAGE));
|
addSideButton(new SideButtonCompare(gui.getCompareSetting(), InventoryUtils.COMPARE_DAMAGE));
|
||||||
addSideButton(new SideButtonCompare(gui.getCompareSetting(), InventoryUtils.COMPARE_NBT));
|
addSideButton(new SideButtonCompare(gui.getCompareSetting(), InventoryUtils.COMPARE_NBT));
|
||||||
}
|
}
|
||||||
@@ -64,13 +58,11 @@ public class GuiStorage extends GuiBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(int x, int y)
|
public void update(int x, int y) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBackground(int x, int y, int mouseX, int mouseY)
|
public void drawBackground(int x, int y, int mouseX, int mouseY) {
|
||||||
{
|
|
||||||
bindTexture(texture);
|
bindTexture(texture);
|
||||||
|
|
||||||
drawTexture(x, y, 0, 0, width, height);
|
drawTexture(x, y, 0, 0, width, height);
|
||||||
@@ -83,19 +75,16 @@ public class GuiStorage extends GuiBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawForeground(int mouseX, int mouseY)
|
public void drawForeground(int mouseX, int mouseY) {
|
||||||
{
|
|
||||||
drawString(7, 7, t(gui.getName()));
|
drawString(7, 7, t(gui.getName()));
|
||||||
drawString(7, 42, gui.getCapacity() == -1 ? t("misc.refinedstorage:storage.stored_minimal", gui.getStored()) : t("misc.refinedstorage:storage.stored_capacity_minimal", gui.getStored(), gui.getCapacity()));
|
drawString(7, 42, gui.getCapacity() == -1 ? t("misc.refinedstorage:storage.stored_minimal", gui.getStored()) : t("misc.refinedstorage:storage.stored_capacity_minimal", gui.getStored(), gui.getCapacity()));
|
||||||
drawString(97, 42, t("misc.refinedstorage:priority"));
|
drawString(97, 42, t("misc.refinedstorage:priority"));
|
||||||
drawString(7, 117, t("container.inventory"));
|
drawString(7, 117, t("container.inventory"));
|
||||||
|
|
||||||
if (inBounds(barX, barY, barWidth, barHeight, mouseX, mouseY))
|
if (inBounds(barX, barY, barWidth, barHeight, mouseX, mouseY)) {
|
||||||
{
|
|
||||||
int full = 0;
|
int full = 0;
|
||||||
|
|
||||||
if (gui.getCapacity() >= 0)
|
if (gui.getCapacity() >= 0) {
|
||||||
{
|
|
||||||
full = (int) ((float) gui.getStored() / (float) gui.getCapacity() * 100f);
|
full = (int) ((float) gui.getStored() / (float) gui.getCapacity() * 100f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,19 +93,14 @@ public class GuiStorage extends GuiBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void keyTyped(char character, int keyCode) throws IOException
|
protected void keyTyped(char character, int keyCode) throws IOException {
|
||||||
{
|
if (!checkHotbarKeys(keyCode) && priorityField.textboxKeyTyped(character, keyCode)) {
|
||||||
if (!checkHotbarKeys(keyCode) && priorityField.textboxKeyTyped(character, keyCode))
|
|
||||||
{
|
|
||||||
Integer result = Ints.tryParse(priorityField.getText());
|
Integer result = Ints.tryParse(priorityField.getText());
|
||||||
|
|
||||||
if (result != null)
|
if (result != null) {
|
||||||
{
|
|
||||||
gui.onPriorityChanged(result);
|
gui.onPriorityChanged(result);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
super.keyTyped(character, keyCode);
|
super.keyTyped(character, keyCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
24
src/main/java/refinedstorage/gui/GuiWirelessTransmitter.java
Normal file → Executable file
@@ -4,37 +4,31 @@ import net.minecraft.inventory.Container;
|
|||||||
import refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
|
import refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
|
||||||
import refinedstorage.tile.TileWirelessTransmitter;
|
import refinedstorage.tile.TileWirelessTransmitter;
|
||||||
|
|
||||||
public class GuiWirelessTransmitter extends GuiBase
|
public class GuiWirelessTransmitter extends GuiBase {
|
||||||
{
|
|
||||||
private TileWirelessTransmitter wirelessTransmitter;
|
private TileWirelessTransmitter wirelessTransmitter;
|
||||||
|
|
||||||
public GuiWirelessTransmitter(Container container, TileWirelessTransmitter wirelessTransmitter)
|
public GuiWirelessTransmitter(Container container, TileWirelessTransmitter wirelessTransmitter) {
|
||||||
{
|
|
||||||
super(container, 176, 137);
|
super(container, 176, 137);
|
||||||
|
|
||||||
this.wirelessTransmitter = wirelessTransmitter;
|
this.wirelessTransmitter = wirelessTransmitter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(int x, int y)
|
public void init(int x, int y) {
|
||||||
{
|
|
||||||
addSideButton(new SideButtonRedstoneMode(wirelessTransmitter));
|
addSideButton(new SideButtonRedstoneMode(wirelessTransmitter));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(int x, int y)
|
public void update(int x, int y) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBackground(int x, int y, int mouseX, int mouseY)
|
public void drawBackground(int x, int y, int mouseX, int mouseY) {
|
||||||
{
|
|
||||||
bindTexture("gui/wireless_transmitter.png");
|
bindTexture("gui/wireless_transmitter.png");
|
||||||
|
|
||||||
drawTexture(x, y, 0, 0, width, height);
|
drawTexture(x, y, 0, 0, width, height);
|
||||||
|
|
||||||
if (wirelessTransmitter.isWorking())
|
if (wirelessTransmitter.isWorking()) {
|
||||||
{
|
|
||||||
int progress = (int) ((float) wirelessTransmitter.getProgress() / (float) TileWirelessTransmitter.TOTAL_PROGRESS * 14f);
|
int progress = (int) ((float) wirelessTransmitter.getProgress() / (float) TileWirelessTransmitter.TOTAL_PROGRESS * 14f);
|
||||||
|
|
||||||
drawTexture(x + 36 - 1, y + 21 - 1 + progress, 178, 0 + progress, 14, 14);
|
drawTexture(x + 36 - 1, y + 21 - 1 + progress, 178, 0 + progress, 14, 14);
|
||||||
@@ -42,13 +36,11 @@ public class GuiWirelessTransmitter extends GuiBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawForeground(int mouseX, int mouseY)
|
public void drawForeground(int mouseX, int mouseY) {
|
||||||
{
|
|
||||||
drawString(7, 7, t("gui.refinedstorage:wireless_transmitter"));
|
drawString(7, 7, t("gui.refinedstorage:wireless_transmitter"));
|
||||||
drawString(7, 43, t("container.inventory"));
|
drawString(7, 43, t("container.inventory"));
|
||||||
|
|
||||||
if (inBounds(36, 21, 14, 14, mouseX, mouseY) && wirelessTransmitter.isWorking())
|
if (inBounds(36, 21, 14, 14, mouseX, mouseY) && wirelessTransmitter.isWorking()) {
|
||||||
{
|
|
||||||
int workRemaining = (int) (((float) (TileWirelessTransmitter.TOTAL_PROGRESS - wirelessTransmitter.getProgress())) / (float) TileWirelessTransmitter.TOTAL_PROGRESS * 100f);
|
int workRemaining = (int) (((float) (TileWirelessTransmitter.TOTAL_PROGRESS - wirelessTransmitter.getProgress())) / (float) TileWirelessTransmitter.TOTAL_PROGRESS * 100f);
|
||||||
|
|
||||||
drawTooltip(mouseX, mouseY, workRemaining + "%");
|
drawTooltip(mouseX, mouseY, workRemaining + "%");
|
||||||
|
53
src/main/java/refinedstorage/gui/Scrollbar.java
Normal file → Executable file
@@ -2,8 +2,7 @@ package refinedstorage.gui;
|
|||||||
|
|
||||||
import org.lwjgl.input.Mouse;
|
import org.lwjgl.input.Mouse;
|
||||||
|
|
||||||
public class Scrollbar
|
public class Scrollbar {
|
||||||
{
|
|
||||||
private boolean canScroll = true;
|
private boolean canScroll = true;
|
||||||
|
|
||||||
private int x;
|
private int x;
|
||||||
@@ -15,33 +14,27 @@ public class Scrollbar
|
|||||||
private boolean wasClicking = false;
|
private boolean wasClicking = false;
|
||||||
private boolean isScrolling = false;
|
private boolean isScrolling = false;
|
||||||
|
|
||||||
public Scrollbar(int x, int y, int scrollbarWidth, int scrollbarHeight)
|
public Scrollbar(int x, int y, int scrollbarWidth, int scrollbarHeight) {
|
||||||
{
|
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
this.scrollbarWidth = scrollbarWidth;
|
this.scrollbarWidth = scrollbarWidth;
|
||||||
this.scrollbarHeight = scrollbarHeight;
|
this.scrollbarHeight = scrollbarHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCanScroll(boolean canScroll)
|
public void setCanScroll(boolean canScroll) {
|
||||||
{
|
|
||||||
this.canScroll = canScroll;
|
this.canScroll = canScroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canScroll()
|
public boolean canScroll() {
|
||||||
{
|
|
||||||
return canScroll;
|
return canScroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getCurrentScroll()
|
public float getCurrentScroll() {
|
||||||
{
|
|
||||||
return currentScroll;
|
return currentScroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCurrentScroll(float newCurrentScroll)
|
public void setCurrentScroll(float newCurrentScroll) {
|
||||||
{
|
if (newCurrentScroll < 0) {
|
||||||
if (newCurrentScroll < 0)
|
|
||||||
{
|
|
||||||
newCurrentScroll = 0;
|
newCurrentScroll = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,61 +42,49 @@ public class Scrollbar
|
|||||||
|
|
||||||
int max = scrollbarHeight - scrollbarItselfHeight - 3;
|
int max = scrollbarHeight - scrollbarItselfHeight - 3;
|
||||||
|
|
||||||
if (newCurrentScroll > max)
|
if (newCurrentScroll > max) {
|
||||||
{
|
|
||||||
newCurrentScroll = max;
|
newCurrentScroll = max;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentScroll = newCurrentScroll;
|
currentScroll = newCurrentScroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(GuiBase gui)
|
public void draw(GuiBase gui) {
|
||||||
{
|
|
||||||
gui.bindTexture("icons.png");
|
gui.bindTexture("icons.png");
|
||||||
gui.drawTexture(gui.guiLeft + x, gui.guiTop + y + (int) currentScroll, canScroll() ? 232 : 244, 0, 12, 15);
|
gui.drawTexture(gui.guiLeft + x, gui.guiTop + y + (int) currentScroll, canScroll() ? 232 : 244, 0, 12, 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(GuiBase gui, int mouseX, int mouseY)
|
public void update(GuiBase gui, int mouseX, int mouseY) {
|
||||||
{
|
if (!canScroll()) {
|
||||||
if (!canScroll())
|
|
||||||
{
|
|
||||||
isScrolling = false;
|
isScrolling = false;
|
||||||
wasClicking = false;
|
wasClicking = false;
|
||||||
currentScroll = 0;
|
currentScroll = 0;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
int wheel = Mouse.getDWheel();
|
int wheel = Mouse.getDWheel();
|
||||||
|
|
||||||
wheel = Math.max(Math.min(-wheel, 1), -1);
|
wheel = Math.max(Math.min(-wheel, 1), -1);
|
||||||
|
|
||||||
float delta = 15;
|
float delta = 15;
|
||||||
|
|
||||||
if (wheel == -1)
|
if (wheel == -1) {
|
||||||
{
|
|
||||||
setCurrentScroll(currentScroll - delta);
|
setCurrentScroll(currentScroll - delta);
|
||||||
}
|
} else if (wheel == 1) {
|
||||||
else if (wheel == 1)
|
|
||||||
{
|
|
||||||
setCurrentScroll(currentScroll + delta);
|
setCurrentScroll(currentScroll + delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean down = Mouse.isButtonDown(0);
|
boolean down = Mouse.isButtonDown(0);
|
||||||
|
|
||||||
if (!wasClicking && down && gui.inBounds(x, y, scrollbarWidth, scrollbarHeight, mouseX, mouseY))
|
if (!wasClicking && down && gui.inBounds(x, y, scrollbarWidth, scrollbarHeight, mouseX, mouseY)) {
|
||||||
{
|
|
||||||
isScrolling = true;
|
isScrolling = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!down)
|
if (!down) {
|
||||||
{
|
|
||||||
isScrolling = false;
|
isScrolling = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wasClicking = down;
|
wasClicking = down;
|
||||||
|
|
||||||
if (isScrolling)
|
if (isScrolling) {
|
||||||
{
|
|
||||||
setCurrentScroll(mouseY - 20);
|
setCurrentScroll(mouseY - 20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
21
src/main/java/refinedstorage/gui/sidebutton/SideButton.java
Normal file → Executable file
@@ -2,39 +2,32 @@ package refinedstorage.gui.sidebutton;
|
|||||||
|
|
||||||
import refinedstorage.gui.GuiBase;
|
import refinedstorage.gui.GuiBase;
|
||||||
|
|
||||||
public abstract class SideButton
|
public abstract class SideButton {
|
||||||
{
|
|
||||||
private int id;
|
private int id;
|
||||||
private int x;
|
private int x;
|
||||||
private int y;
|
private int y;
|
||||||
|
|
||||||
public int getId()
|
public int getId() {
|
||||||
{
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(int id)
|
public void setId(int id) {
|
||||||
{
|
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getX()
|
public int getX() {
|
||||||
{
|
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setX(int x)
|
public void setX(int x) {
|
||||||
{
|
|
||||||
this.x = x;
|
this.x = x;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getY()
|
public int getY() {
|
||||||
{
|
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setY(int y)
|
public void setY(int y) {
|
||||||
{
|
|
||||||
this.y = y;
|
this.y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
29
src/main/java/refinedstorage/gui/sidebutton/SideButtonCompare.java
Normal file → Executable file
@@ -7,30 +7,24 @@ import refinedstorage.network.MessageCompareUpdate;
|
|||||||
import refinedstorage.tile.settings.ICompareSetting;
|
import refinedstorage.tile.settings.ICompareSetting;
|
||||||
import refinedstorage.util.InventoryUtils;
|
import refinedstorage.util.InventoryUtils;
|
||||||
|
|
||||||
public class SideButtonCompare extends SideButton
|
public class SideButtonCompare extends SideButton {
|
||||||
{
|
|
||||||
private ICompareSetting setting;
|
private ICompareSetting setting;
|
||||||
private int mask;
|
private int mask;
|
||||||
|
|
||||||
public SideButtonCompare(ICompareSetting setting, int mask)
|
public SideButtonCompare(ICompareSetting setting, int mask) {
|
||||||
{
|
|
||||||
this.setting = setting;
|
this.setting = setting;
|
||||||
this.mask = mask;
|
this.mask = mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTooltip(GuiBase gui)
|
public String getTooltip(GuiBase gui) {
|
||||||
{
|
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
builder.append(TextFormatting.YELLOW).append(gui.t("sidebutton.refinedstorage:compare." + mask)).append(TextFormatting.RESET).append("\n");
|
builder.append(TextFormatting.YELLOW).append(gui.t("sidebutton.refinedstorage:compare." + mask)).append(TextFormatting.RESET).append("\n");
|
||||||
|
|
||||||
if ((setting.getCompare() & mask) == mask)
|
if ((setting.getCompare() & mask) == mask) {
|
||||||
{
|
|
||||||
builder.append(gui.t("misc.refinedstorage:yes"));
|
builder.append(gui.t("misc.refinedstorage:yes"));
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
builder.append(gui.t("misc.refinedstorage:no"));
|
builder.append(gui.t("misc.refinedstorage:no"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,18 +32,14 @@ public class SideButtonCompare extends SideButton
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(GuiBase gui, int x, int y)
|
public void draw(GuiBase gui, int x, int y) {
|
||||||
{
|
|
||||||
gui.bindTexture("icons.png");
|
gui.bindTexture("icons.png");
|
||||||
|
|
||||||
int ty = 0;
|
int ty = 0;
|
||||||
|
|
||||||
if (mask == InventoryUtils.COMPARE_DAMAGE)
|
if (mask == InventoryUtils.COMPARE_DAMAGE) {
|
||||||
{
|
|
||||||
ty = 80;
|
ty = 80;
|
||||||
}
|
} else if (mask == InventoryUtils.COMPARE_NBT) {
|
||||||
else if (mask == InventoryUtils.COMPARE_NBT)
|
|
||||||
{
|
|
||||||
ty = 48;
|
ty = 48;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,8 +49,7 @@ public class SideButtonCompare extends SideButton
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed()
|
public void actionPerformed() {
|
||||||
{
|
|
||||||
RefinedStorage.NETWORK.sendToServer(new MessageCompareUpdate(setting, setting.getCompare() ^ mask));
|
RefinedStorage.NETWORK.sendToServer(new MessageCompareUpdate(setting, setting.getCompare() ^ mask));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
15
src/main/java/refinedstorage/gui/sidebutton/SideButtonDetectorMode.java
Normal file → Executable file
@@ -8,18 +8,15 @@ import refinedstorage.gui.GuiBase;
|
|||||||
import refinedstorage.network.MessageDetectorModeUpdate;
|
import refinedstorage.network.MessageDetectorModeUpdate;
|
||||||
import refinedstorage.tile.TileDetector;
|
import refinedstorage.tile.TileDetector;
|
||||||
|
|
||||||
public class SideButtonDetectorMode extends SideButton
|
public class SideButtonDetectorMode extends SideButton {
|
||||||
{
|
|
||||||
private TileDetector detector;
|
private TileDetector detector;
|
||||||
|
|
||||||
public SideButtonDetectorMode(TileDetector detector)
|
public SideButtonDetectorMode(TileDetector detector) {
|
||||||
{
|
|
||||||
this.detector = detector;
|
this.detector = detector;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTooltip(GuiBase gui)
|
public String getTooltip(GuiBase gui) {
|
||||||
{
|
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
builder.append(TextFormatting.GREEN).append(gui.t("sidebutton.refinedstorage:detector.mode")).append(TextFormatting.RESET).append("\n");
|
builder.append(TextFormatting.GREEN).append(gui.t("sidebutton.refinedstorage:detector.mode")).append(TextFormatting.RESET).append("\n");
|
||||||
@@ -30,14 +27,12 @@ public class SideButtonDetectorMode extends SideButton
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(GuiBase gui, int x, int y)
|
public void draw(GuiBase gui, int x, int y) {
|
||||||
{
|
|
||||||
gui.drawItem(x, y, new ItemStack(Items.redstone, 1));
|
gui.drawItem(x, y, new ItemStack(Items.redstone, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed()
|
public void actionPerformed() {
|
||||||
{
|
|
||||||
RefinedStorage.NETWORK.sendToServer(new MessageDetectorModeUpdate(detector));
|
RefinedStorage.NETWORK.sendToServer(new MessageDetectorModeUpdate(detector));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
22
src/main/java/refinedstorage/gui/sidebutton/SideButtonGridSortingDirection.java
Normal file → Executable file
@@ -6,18 +6,15 @@ import refinedstorage.gui.GuiBase;
|
|||||||
import refinedstorage.network.MessageGridSortingUpdate;
|
import refinedstorage.network.MessageGridSortingUpdate;
|
||||||
import refinedstorage.tile.TileGrid;
|
import refinedstorage.tile.TileGrid;
|
||||||
|
|
||||||
public class SideButtonGridSortingDirection extends SideButton
|
public class SideButtonGridSortingDirection extends SideButton {
|
||||||
{
|
|
||||||
private TileGrid grid;
|
private TileGrid grid;
|
||||||
|
|
||||||
public SideButtonGridSortingDirection(TileGrid grid)
|
public SideButtonGridSortingDirection(TileGrid grid) {
|
||||||
{
|
|
||||||
this.grid = grid;
|
this.grid = grid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTooltip(GuiBase gui)
|
public String getTooltip(GuiBase gui) {
|
||||||
{
|
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
builder.append(TextFormatting.YELLOW).append(gui.t("sidebutton.refinedstorage:sorting.direction")).append(TextFormatting.RESET).append("\n");
|
builder.append(TextFormatting.YELLOW).append(gui.t("sidebutton.refinedstorage:sorting.direction")).append(TextFormatting.RESET).append("\n");
|
||||||
@@ -28,23 +25,18 @@ public class SideButtonGridSortingDirection extends SideButton
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(GuiBase gui, int x, int y)
|
public void draw(GuiBase gui, int x, int y) {
|
||||||
{
|
|
||||||
gui.bindTexture("icons.png");
|
gui.bindTexture("icons.png");
|
||||||
gui.drawTexture(x, y + 2 - 1, grid.getSortingDirection() * 16, 16, 16, 16);
|
gui.drawTexture(x, y + 2 - 1, grid.getSortingDirection() * 16, 16, 16, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed()
|
public void actionPerformed() {
|
||||||
{
|
|
||||||
int dir = grid.getSortingDirection();
|
int dir = grid.getSortingDirection();
|
||||||
|
|
||||||
if (dir == TileGrid.SORTING_DIRECTION_ASCENDING)
|
if (dir == TileGrid.SORTING_DIRECTION_ASCENDING) {
|
||||||
{
|
|
||||||
dir = TileGrid.SORTING_DIRECTION_DESCENDING;
|
dir = TileGrid.SORTING_DIRECTION_DESCENDING;
|
||||||
}
|
} else if (dir == TileGrid.SORTING_DIRECTION_DESCENDING) {
|
||||||
else if (dir == TileGrid.SORTING_DIRECTION_DESCENDING)
|
|
||||||
{
|
|
||||||
dir = TileGrid.SORTING_DIRECTION_ASCENDING;
|
dir = TileGrid.SORTING_DIRECTION_ASCENDING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
22
src/main/java/refinedstorage/gui/sidebutton/SideButtonGridSortingType.java
Normal file → Executable file
@@ -6,18 +6,15 @@ import refinedstorage.gui.GuiBase;
|
|||||||
import refinedstorage.network.MessageGridSortingUpdate;
|
import refinedstorage.network.MessageGridSortingUpdate;
|
||||||
import refinedstorage.tile.TileGrid;
|
import refinedstorage.tile.TileGrid;
|
||||||
|
|
||||||
public class SideButtonGridSortingType extends SideButton
|
public class SideButtonGridSortingType extends SideButton {
|
||||||
{
|
|
||||||
private TileGrid grid;
|
private TileGrid grid;
|
||||||
|
|
||||||
public SideButtonGridSortingType(TileGrid grid)
|
public SideButtonGridSortingType(TileGrid grid) {
|
||||||
{
|
|
||||||
this.grid = grid;
|
this.grid = grid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTooltip(GuiBase gui)
|
public String getTooltip(GuiBase gui) {
|
||||||
{
|
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
builder.append(TextFormatting.YELLOW).append(gui.t("sidebutton.refinedstorage:sorting.type")).append(TextFormatting.RESET).append("\n");
|
builder.append(TextFormatting.YELLOW).append(gui.t("sidebutton.refinedstorage:sorting.type")).append(TextFormatting.RESET).append("\n");
|
||||||
@@ -28,23 +25,18 @@ public class SideButtonGridSortingType extends SideButton
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(GuiBase gui, int x, int y)
|
public void draw(GuiBase gui, int x, int y) {
|
||||||
{
|
|
||||||
gui.bindTexture("icons.png");
|
gui.bindTexture("icons.png");
|
||||||
gui.drawTexture(x - 1, y + 2 - 1, grid.getSortingType() * 16, 32, 16, 16);
|
gui.drawTexture(x - 1, y + 2 - 1, grid.getSortingType() * 16, 32, 16, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed()
|
public void actionPerformed() {
|
||||||
{
|
|
||||||
int type = grid.getSortingType();
|
int type = grid.getSortingType();
|
||||||
|
|
||||||
if (type == TileGrid.SORTING_TYPE_QUANTITY)
|
if (type == TileGrid.SORTING_TYPE_QUANTITY) {
|
||||||
{
|
|
||||||
type = TileGrid.SORTING_TYPE_NAME;
|
type = TileGrid.SORTING_TYPE_NAME;
|
||||||
}
|
} else if (type == TileGrid.SORTING_TYPE_NAME) {
|
||||||
else if (type == TileGrid.SORTING_TYPE_NAME)
|
|
||||||
{
|
|
||||||
type = TileGrid.SORTING_TYPE_QUANTITY;
|
type = TileGrid.SORTING_TYPE_QUANTITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
22
src/main/java/refinedstorage/gui/sidebutton/SideButtonMode.java
Normal file → Executable file
@@ -6,18 +6,15 @@ import refinedstorage.gui.GuiBase;
|
|||||||
import refinedstorage.network.MessageModeToggle;
|
import refinedstorage.network.MessageModeToggle;
|
||||||
import refinedstorage.tile.settings.IModeSetting;
|
import refinedstorage.tile.settings.IModeSetting;
|
||||||
|
|
||||||
public class SideButtonMode extends SideButton
|
public class SideButtonMode extends SideButton {
|
||||||
{
|
|
||||||
private IModeSetting mode;
|
private IModeSetting mode;
|
||||||
|
|
||||||
public SideButtonMode(IModeSetting mode)
|
public SideButtonMode(IModeSetting mode) {
|
||||||
{
|
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTooltip(GuiBase gui)
|
public String getTooltip(GuiBase gui) {
|
||||||
{
|
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
builder.append(TextFormatting.GREEN).append(gui.t("sidebutton.refinedstorage:mode")).append(TextFormatting.RESET).append("\n");
|
builder.append(TextFormatting.GREEN).append(gui.t("sidebutton.refinedstorage:mode")).append(TextFormatting.RESET).append("\n");
|
||||||
@@ -28,18 +25,14 @@ public class SideButtonMode extends SideButton
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(GuiBase gui, int x, int y)
|
public void draw(GuiBase gui, int x, int y) {
|
||||||
{
|
|
||||||
gui.bindTexture("icons.png");
|
gui.bindTexture("icons.png");
|
||||||
|
|
||||||
int tx = 0;
|
int tx = 0;
|
||||||
|
|
||||||
if (mode.isWhitelist())
|
if (mode.isWhitelist()) {
|
||||||
{
|
|
||||||
tx = 0;
|
tx = 0;
|
||||||
}
|
} else if (mode.isBlacklist()) {
|
||||||
else if (mode.isBlacklist())
|
|
||||||
{
|
|
||||||
tx = 16;
|
tx = 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,8 +40,7 @@ public class SideButtonMode extends SideButton
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed()
|
public void actionPerformed() {
|
||||||
{
|
|
||||||
RefinedStorage.NETWORK.sendToServer(new MessageModeToggle(mode));
|
RefinedStorage.NETWORK.sendToServer(new MessageModeToggle(mode));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
15
src/main/java/refinedstorage/gui/sidebutton/SideButtonRedstoneMode.java
Normal file → Executable file
@@ -6,18 +6,15 @@ import refinedstorage.gui.GuiBase;
|
|||||||
import refinedstorage.network.MessageRedstoneModeUpdate;
|
import refinedstorage.network.MessageRedstoneModeUpdate;
|
||||||
import refinedstorage.tile.settings.IRedstoneModeSetting;
|
import refinedstorage.tile.settings.IRedstoneModeSetting;
|
||||||
|
|
||||||
public class SideButtonRedstoneMode extends SideButton
|
public class SideButtonRedstoneMode extends SideButton {
|
||||||
{
|
|
||||||
private IRedstoneModeSetting setting;
|
private IRedstoneModeSetting setting;
|
||||||
|
|
||||||
public SideButtonRedstoneMode(IRedstoneModeSetting setting)
|
public SideButtonRedstoneMode(IRedstoneModeSetting setting) {
|
||||||
{
|
|
||||||
this.setting = setting;
|
this.setting = setting;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTooltip(GuiBase gui)
|
public String getTooltip(GuiBase gui) {
|
||||||
{
|
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
builder.append(TextFormatting.RED).append(gui.t("sidebutton.refinedstorage:redstone_mode")).append(TextFormatting.RESET).append("\n");
|
builder.append(TextFormatting.RED).append(gui.t("sidebutton.refinedstorage:redstone_mode")).append(TextFormatting.RESET).append("\n");
|
||||||
@@ -28,15 +25,13 @@ public class SideButtonRedstoneMode extends SideButton
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(GuiBase gui, int x, int y)
|
public void draw(GuiBase gui, int x, int y) {
|
||||||
{
|
|
||||||
gui.bindTexture("icons.png");
|
gui.bindTexture("icons.png");
|
||||||
gui.drawTexture(x, y + 1, setting.getRedstoneMode().id * 16, 0, 16, 16);
|
gui.drawTexture(x, y + 1, setting.getRedstoneMode().id * 16, 0, 16, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed()
|
public void actionPerformed() {
|
||||||
{
|
|
||||||
RefinedStorage.NETWORK.sendToServer(new MessageRedstoneModeUpdate(setting));
|
RefinedStorage.NETWORK.sendToServer(new MessageRedstoneModeUpdate(setting));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
85
src/main/java/refinedstorage/inventory/InventorySimple.java
Normal file → Executable file
@@ -6,56 +6,45 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
|
||||||
public class InventorySimple implements IInventory
|
public class InventorySimple implements IInventory {
|
||||||
{
|
|
||||||
private TileEntity tile;
|
private TileEntity tile;
|
||||||
private ItemStack[] inventory;
|
private ItemStack[] inventory;
|
||||||
private int size;
|
private int size;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
public InventorySimple(String name, int size)
|
public InventorySimple(String name, int size) {
|
||||||
{
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.size = size;
|
this.size = size;
|
||||||
this.inventory = new ItemStack[size];
|
this.inventory = new ItemStack[size];
|
||||||
}
|
}
|
||||||
|
|
||||||
public InventorySimple(String name, int size, TileEntity tile)
|
public InventorySimple(String name, int size, TileEntity tile) {
|
||||||
{
|
|
||||||
this(name, size);
|
this(name, size);
|
||||||
|
|
||||||
this.tile = tile;
|
this.tile = tile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSizeInventory()
|
public int getSizeInventory() {
|
||||||
{
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getStackInSlot(int slotIndex)
|
public ItemStack getStackInSlot(int slotIndex) {
|
||||||
{
|
|
||||||
return inventory[slotIndex];
|
return inventory[slotIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack decrStackSize(int slot, int amount)
|
public ItemStack decrStackSize(int slot, int amount) {
|
||||||
{
|
|
||||||
ItemStack stack = getStackInSlot(slot);
|
ItemStack stack = getStackInSlot(slot);
|
||||||
|
|
||||||
if (stack != null)
|
if (stack != null) {
|
||||||
{
|
if (stack.stackSize <= amount) {
|
||||||
if (stack.stackSize <= amount)
|
|
||||||
{
|
|
||||||
setInventorySlotContents(slot, null);
|
setInventorySlotContents(slot, null);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
stack = stack.splitStack(amount);
|
stack = stack.splitStack(amount);
|
||||||
|
|
||||||
if (stack.stackSize == 0)
|
if (stack.stackSize == 0) {
|
||||||
{
|
|
||||||
setInventorySlotContents(slot, null);
|
setInventorySlotContents(slot, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -65,12 +54,10 @@ public class InventorySimple implements IInventory
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack removeStackFromSlot(int slot)
|
public ItemStack removeStackFromSlot(int slot) {
|
||||||
{
|
|
||||||
ItemStack stack = getStackInSlot(slot);
|
ItemStack stack = getStackInSlot(slot);
|
||||||
|
|
||||||
if (stack != null)
|
if (stack != null) {
|
||||||
{
|
|
||||||
setInventorySlotContents(slot, null);
|
setInventorySlotContents(slot, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,10 +65,8 @@ public class InventorySimple implements IInventory
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setInventorySlotContents(int slot, ItemStack stack)
|
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||||
{
|
if (stack != null && stack.stackSize > getInventoryStackLimit()) {
|
||||||
if (stack != null && stack.stackSize > getInventoryStackLimit())
|
|
||||||
{
|
|
||||||
stack.stackSize = getInventoryStackLimit();
|
stack.stackSize = getInventoryStackLimit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,79 +74,65 @@ public class InventorySimple implements IInventory
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName()
|
public String getName() {
|
||||||
{
|
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasCustomName()
|
public boolean hasCustomName() {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getInventoryStackLimit()
|
public int getInventoryStackLimit() {
|
||||||
{
|
|
||||||
return 64;
|
return 64;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isUseableByPlayer(EntityPlayer player)
|
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int slot, ItemStack stack)
|
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void markDirty()
|
public void markDirty() {
|
||||||
{
|
if (tile != null) {
|
||||||
if (tile != null)
|
|
||||||
{
|
|
||||||
tile.markDirty();
|
tile.markDirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void openInventory(EntityPlayer playerIn)
|
public void openInventory(EntityPlayer playerIn) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void closeInventory(EntityPlayer playerIn)
|
public void closeInventory(EntityPlayer playerIn) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getField(int id)
|
public int getField(int id) {
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setField(int id, int value)
|
public void setField(int id, int value) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFieldCount()
|
public int getFieldCount() {
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clear()
|
public void clear() {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ITextComponent getDisplayName()
|
public ITextComponent getDisplayName() {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
15
src/main/java/refinedstorage/item/ItemBase.java
Normal file → Executable file
@@ -4,28 +4,23 @@ import net.minecraft.item.Item;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import refinedstorage.RefinedStorage;
|
import refinedstorage.RefinedStorage;
|
||||||
|
|
||||||
public abstract class ItemBase extends Item
|
public abstract class ItemBase extends Item {
|
||||||
{
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
public ItemBase(String name)
|
public ItemBase(String name) {
|
||||||
{
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
||||||
setCreativeTab(RefinedStorage.TAB);
|
setCreativeTab(RefinedStorage.TAB);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUnlocalizedName()
|
public String getUnlocalizedName() {
|
||||||
{
|
|
||||||
return "item." + RefinedStorage.ID + ":" + name;
|
return "item." + RefinedStorage.ID + ":" + name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUnlocalizedName(ItemStack stack)
|
public String getUnlocalizedName(ItemStack stack) {
|
||||||
{
|
if (getHasSubtypes()) {
|
||||||
if (getHasSubtypes())
|
|
||||||
{
|
|
||||||
return getUnlocalizedName() + "." + stack.getItemDamage();
|
return getUnlocalizedName() + "." + stack.getItemDamage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
9
src/main/java/refinedstorage/item/ItemBlockBase.java
Normal file → Executable file
@@ -4,16 +4,13 @@ import net.minecraft.block.Block;
|
|||||||
import net.minecraft.item.ItemColored;
|
import net.minecraft.item.ItemColored;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public abstract class ItemBlockBase extends ItemColored
|
public abstract class ItemBlockBase extends ItemColored {
|
||||||
{
|
public ItemBlockBase(Block block) {
|
||||||
public ItemBlockBase(Block block)
|
|
||||||
{
|
|
||||||
super(block, true);
|
super(block, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUnlocalizedName(ItemStack stack)
|
public String getUnlocalizedName(ItemStack stack) {
|
||||||
{
|
|
||||||
return getUnlocalizedName() + "." + stack.getItemDamage();
|
return getUnlocalizedName() + "." + stack.getItemDamage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
6
src/main/java/refinedstorage/item/ItemBlockController.java
Normal file → Executable file
@@ -2,10 +2,8 @@ package refinedstorage.item;
|
|||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
|
||||||
public class ItemBlockController extends ItemBlockBase
|
public class ItemBlockController extends ItemBlockBase {
|
||||||
{
|
public ItemBlockController(Block block) {
|
||||||
public ItemBlockController(Block block)
|
|
||||||
{
|
|
||||||
super(block);
|
super(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
6
src/main/java/refinedstorage/item/ItemBlockGrid.java
Normal file → Executable file
@@ -2,10 +2,8 @@ package refinedstorage.item;
|
|||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
|
||||||
public class ItemBlockGrid extends ItemBlockBase
|
public class ItemBlockGrid extends ItemBlockBase {
|
||||||
{
|
public ItemBlockGrid(Block block) {
|
||||||
public ItemBlockGrid(Block block)
|
|
||||||
{
|
|
||||||
super(block);
|
super(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
28
src/main/java/refinedstorage/item/ItemBlockStorage.java
Normal file → Executable file
@@ -1,6 +1,5 @@
|
|||||||
package refinedstorage.item;
|
package refinedstorage.item;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -11,43 +10,36 @@ import refinedstorage.block.EnumStorageType;
|
|||||||
import refinedstorage.storage.NBTStorage;
|
import refinedstorage.storage.NBTStorage;
|
||||||
import refinedstorage.tile.TileStorage;
|
import refinedstorage.tile.TileStorage;
|
||||||
|
|
||||||
public class ItemBlockStorage extends ItemBlockBase
|
import java.util.List;
|
||||||
{
|
|
||||||
public ItemBlockStorage(Block block)
|
public class ItemBlockStorage extends ItemBlockBase {
|
||||||
{
|
public ItemBlockStorage(Block block) {
|
||||||
super(block);
|
super(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean b)
|
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean b) {
|
||||||
{
|
|
||||||
EnumStorageType type = EnumStorageType.getById(stack.getMetadata());
|
EnumStorageType type = EnumStorageType.getById(stack.getMetadata());
|
||||||
|
|
||||||
if (type != null && stack.getTagCompound() != null && stack.getTagCompound().hasKey(TileStorage.NBT_STORAGE))
|
if (type != null && stack.getTagCompound() != null && stack.getTagCompound().hasKey(TileStorage.NBT_STORAGE)) {
|
||||||
{
|
|
||||||
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(TileStorage.NBT_STORAGE);
|
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(TileStorage.NBT_STORAGE);
|
||||||
|
|
||||||
if (type == EnumStorageType.TYPE_CREATIVE)
|
if (type == EnumStorageType.TYPE_CREATIVE) {
|
||||||
{
|
|
||||||
list.add(String.format(I18n.translateToLocal("misc.refinedstorage:storage.stored"), NBTStorage.getStored(tag)));
|
list.add(String.format(I18n.translateToLocal("misc.refinedstorage:storage.stored"), NBTStorage.getStored(tag)));
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
list.add(String.format(I18n.translateToLocal("misc.refinedstorage:storage.stored_capacity"), NBTStorage.getStored(tag), type.getCapacity()));
|
list.add(String.format(I18n.translateToLocal("misc.refinedstorage:storage.stored_capacity"), NBTStorage.getStored(tag), type.getCapacity()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreated(ItemStack stack, World world, EntityPlayer player)
|
public void onCreated(ItemStack stack, World world, EntityPlayer player) {
|
||||||
{
|
|
||||||
super.onCreated(stack, world, player);
|
super.onCreated(stack, world, player);
|
||||||
|
|
||||||
initNBT(stack);
|
initNBT(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack initNBT(ItemStack stack)
|
public static ItemStack initNBT(ItemStack stack) {
|
||||||
{
|
|
||||||
NBTTagCompound tag = new NBTTagCompound();
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
|
|
||||||
tag.setTag(TileStorage.NBT_STORAGE, NBTStorage.getBaseNBT());
|
tag.setTag(TileStorage.NBT_STORAGE, NBTStorage.getBaseNBT());
|
||||||
|
15
src/main/java/refinedstorage/item/ItemCore.java
Normal file → Executable file
@@ -1,17 +1,16 @@
|
|||||||
package refinedstorage.item;
|
package refinedstorage.item;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class ItemCore extends ItemBase
|
import java.util.List;
|
||||||
{
|
|
||||||
|
public class ItemCore extends ItemBase {
|
||||||
public static final int TYPE_CONSTRUCTION = 0;
|
public static final int TYPE_CONSTRUCTION = 0;
|
||||||
public static final int TYPE_DESTRUCTION = 1;
|
public static final int TYPE_DESTRUCTION = 1;
|
||||||
|
|
||||||
public ItemCore()
|
public ItemCore() {
|
||||||
{
|
|
||||||
super("core");
|
super("core");
|
||||||
|
|
||||||
setHasSubtypes(true);
|
setHasSubtypes(true);
|
||||||
@@ -19,10 +18,8 @@ public class ItemCore extends ItemBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubItems(Item item, CreativeTabs tab, List list)
|
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||||
{
|
for (int i = 0; i < 2; ++i) {
|
||||||
for (int i = 0; i < 2; ++i)
|
|
||||||
{
|
|
||||||
list.add(new ItemStack(item, 1, i));
|
list.add(new ItemStack(item, 1, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
15
src/main/java/refinedstorage/item/ItemProcessor.java
Normal file → Executable file
@@ -1,12 +1,12 @@
|
|||||||
package refinedstorage.item;
|
package refinedstorage.item;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class ItemProcessor extends ItemBase
|
import java.util.List;
|
||||||
{
|
|
||||||
|
public class ItemProcessor extends ItemBase {
|
||||||
public static final int TYPE_PRINTED_BASIC = 0;
|
public static final int TYPE_PRINTED_BASIC = 0;
|
||||||
public static final int TYPE_PRINTED_IMPROVED = 1;
|
public static final int TYPE_PRINTED_IMPROVED = 1;
|
||||||
public static final int TYPE_PRINTED_ADVANCED = 2;
|
public static final int TYPE_PRINTED_ADVANCED = 2;
|
||||||
@@ -15,8 +15,7 @@ public class ItemProcessor extends ItemBase
|
|||||||
public static final int TYPE_ADVANCED = 5;
|
public static final int TYPE_ADVANCED = 5;
|
||||||
public static final int TYPE_PRINTED_SILICON = 6;
|
public static final int TYPE_PRINTED_SILICON = 6;
|
||||||
|
|
||||||
public ItemProcessor()
|
public ItemProcessor() {
|
||||||
{
|
|
||||||
super("processor");
|
super("processor");
|
||||||
|
|
||||||
setHasSubtypes(true);
|
setHasSubtypes(true);
|
||||||
@@ -24,10 +23,8 @@ public class ItemProcessor extends ItemBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubItems(Item item, CreativeTabs tab, List list)
|
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||||
{
|
for (int i = 0; i <= 6; ++i) {
|
||||||
for (int i = 0; i <= 6; ++i)
|
|
||||||
{
|
|
||||||
list.add(new ItemStack(item, 1, i));
|
list.add(new ItemStack(item, 1, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|