initial 1.8 port
This commit is contained in:
@@ -22,7 +22,7 @@ group = "storagecraft"
|
|||||||
archivesBaseName = "storagecraft"
|
archivesBaseName = "storagecraft"
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
version = "1.7.10-10.13.4.1566-1.7.10"
|
version = "1.8-11.14.1.1341"
|
||||||
runDir = "eclipse"
|
runDir = "eclipse"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,9 +33,9 @@ repositories {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
compile "codechicken:CodeChickenLib:1.7.10-1.1.3.140:dev"
|
compile "codechicken:CodeChickenLib:1.8-1.1.2.139:dev"
|
||||||
compile "codechicken:CodeChickenCore:1.7.10-1.0.7.47:dev"
|
compile "codechicken:CodeChickenCore:1.8-1.0.5.36:dev"
|
||||||
compile "codechicken:NotEnoughItems:1.7.10-1.0.5.118:dev"
|
compile "codechicken:NotEnoughItems:1.8-1.0.5.104:dev"
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
package cofh.api;
|
|
||||||
|
|
||||||
public class CoFHAPIProps {
|
|
||||||
|
|
||||||
private CoFHAPIProps() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final String VERSION = "1.7.10R1.0.2";
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package cofh.api.energy;
|
package cofh.api.energy;
|
||||||
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement this interface on TileEntities which should connect to energy transportation blocks. This is intended for blocks which generate energy but do not
|
* Implement this interface on TileEntities which should connect to energy transportation blocks. This is intended for blocks which generate energy but do not
|
||||||
@@ -16,6 +16,6 @@ public interface IEnergyConnection {
|
|||||||
/**
|
/**
|
||||||
* Returns TRUE if the TileEntity can connect on a given side.
|
* Returns TRUE if the TileEntity can connect on a given side.
|
||||||
*/
|
*/
|
||||||
boolean canConnectEnergy(ForgeDirection from);
|
boolean canConnectEnergy(EnumFacing facing);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package cofh.api.energy;
|
package cofh.api.energy;
|
||||||
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement this interface on Tile Entities which should handle energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
|
* Implement this interface on Tile Entities which should handle energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
|
||||||
@@ -26,7 +27,7 @@ public interface IEnergyHandler extends IEnergyProvider, IEnergyReceiver {
|
|||||||
* @return Amount of energy that was (or would have been, if simulated) received.
|
* @return Amount of energy that was (or would have been, if simulated) received.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate);
|
int receiveEnergy(EnumFacing facing, int maxReceive, boolean simulate);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider.
|
* Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider.
|
||||||
@@ -40,19 +41,19 @@ public interface IEnergyHandler extends IEnergyProvider, IEnergyReceiver {
|
|||||||
* @return Amount of energy that was (or would have been, if simulated) extracted.
|
* @return Amount of energy that was (or would have been, if simulated) extracted.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate);
|
int extractEnergy(EnumFacing facing, int maxExtract, boolean simulate);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the amount of energy currently stored.
|
* Returns the amount of energy currently stored.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
int getEnergyStored(ForgeDirection from);
|
int getEnergyStored(EnumFacing facing);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the maximum amount of energy that can be stored.
|
* Returns the maximum amount of energy that can be stored.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
int getMaxEnergyStored(ForgeDirection from);
|
int getMaxEnergyStored(EnumFacing facing);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package cofh.api.energy;
|
package cofh.api.energy;
|
||||||
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement this interface on Tile Entities which should provide energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
|
* Implement this interface on Tile Entities which should provide energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
|
||||||
@@ -23,16 +24,16 @@ public interface IEnergyProvider extends IEnergyConnection {
|
|||||||
* If TRUE, the extraction will only be simulated.
|
* If TRUE, the extraction will only be simulated.
|
||||||
* @return Amount of energy that was (or would have been, if simulated) extracted.
|
* @return Amount of energy that was (or would have been, if simulated) extracted.
|
||||||
*/
|
*/
|
||||||
int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate);
|
int extractEnergy(EnumFacing facing, int maxExtract, boolean simulate);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the amount of energy currently stored.
|
* Returns the amount of energy currently stored.
|
||||||
*/
|
*/
|
||||||
int getEnergyStored(ForgeDirection from);
|
int getEnergyStored(EnumFacing facing);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the maximum amount of energy that can be stored.
|
* Returns the maximum amount of energy that can be stored.
|
||||||
*/
|
*/
|
||||||
int getMaxEnergyStored(ForgeDirection from);
|
int getMaxEnergyStored(EnumFacing facing);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package cofh.api.energy;
|
package cofh.api.energy;
|
||||||
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement this interface on Tile Entities which should receive energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
|
* Implement this interface on Tile Entities which should receive energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
|
||||||
@@ -23,16 +24,16 @@ public interface IEnergyReceiver extends IEnergyConnection {
|
|||||||
* If TRUE, the charge will only be simulated.
|
* If TRUE, the charge will only be simulated.
|
||||||
* @return Amount of energy that was (or would have been, if simulated) received.
|
* @return Amount of energy that was (or would have been, if simulated) received.
|
||||||
*/
|
*/
|
||||||
int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate);
|
int receiveEnergy(EnumFacing facing, int maxReceive, boolean simulate);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the amount of energy currently stored.
|
* Returns the amount of energy currently stored.
|
||||||
*/
|
*/
|
||||||
int getEnergyStored(ForgeDirection from);
|
int getEnergyStored(EnumFacing facing);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the maximum amount of energy that can be stored.
|
* Returns the maximum amount of energy that can be stored.
|
||||||
*/
|
*/
|
||||||
int getMaxEnergyStored(ForgeDirection from);
|
int getMaxEnergyStored(EnumFacing facing);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,15 +63,15 @@ public class ItemEnergyContainer extends Item implements IEnergyContainerItem {
|
|||||||
@Override
|
@Override
|
||||||
public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) {
|
public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) {
|
||||||
|
|
||||||
if (container.stackTagCompound == null) {
|
if (container.getTagCompound() == null) {
|
||||||
container.stackTagCompound = new NBTTagCompound();
|
container.setTagCompound(new NBTTagCompound());
|
||||||
}
|
}
|
||||||
int energy = container.stackTagCompound.getInteger("Energy");
|
int energy = container.getTagCompound().getInteger("Energy");
|
||||||
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
|
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
|
||||||
|
|
||||||
if (!simulate) {
|
if (!simulate) {
|
||||||
energy += energyReceived;
|
energy += energyReceived;
|
||||||
container.stackTagCompound.setInteger("Energy", energy);
|
container.getTagCompound().setInteger("Energy", energy);
|
||||||
}
|
}
|
||||||
return energyReceived;
|
return energyReceived;
|
||||||
}
|
}
|
||||||
@@ -79,15 +79,15 @@ public class ItemEnergyContainer extends Item implements IEnergyContainerItem {
|
|||||||
@Override
|
@Override
|
||||||
public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
|
public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
|
||||||
|
|
||||||
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
|
if (container.getTagCompound() == null || !container.getTagCompound().hasKey("Energy")) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int energy = container.stackTagCompound.getInteger("Energy");
|
int energy = container.getTagCompound().getInteger("Energy");
|
||||||
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
|
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
|
||||||
|
|
||||||
if (!simulate) {
|
if (!simulate) {
|
||||||
energy -= energyExtracted;
|
energy -= energyExtracted;
|
||||||
container.stackTagCompound.setInteger("Energy", energy);
|
container.getTagCompound().setInteger("Energy", energy);
|
||||||
}
|
}
|
||||||
return energyExtracted;
|
return energyExtracted;
|
||||||
}
|
}
|
||||||
@@ -95,10 +95,10 @@ public class ItemEnergyContainer extends Item implements IEnergyContainerItem {
|
|||||||
@Override
|
@Override
|
||||||
public int getEnergyStored(ItemStack container) {
|
public int getEnergyStored(ItemStack container) {
|
||||||
|
|
||||||
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
|
if (container.getTagCompound() == null || !container.getTagCompound().hasKey("Energy")) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return container.stackTagCompound.getInteger("Energy");
|
return container.getTagCompound().getInteger("Energy");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package cofh.api.energy;
|
|||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reference implementation of {@link IEnergyHandler}. Use/extend this or implement your own.
|
* Reference implementation of {@link IEnergyHandler}. Use/extend this or implement your own.
|
||||||
@@ -30,34 +30,34 @@ public class TileEnergyHandler extends TileEntity implements IEnergyHandler {
|
|||||||
|
|
||||||
/* IEnergyConnection */
|
/* IEnergyConnection */
|
||||||
@Override
|
@Override
|
||||||
public boolean canConnectEnergy(ForgeDirection from) {
|
public boolean canConnectEnergy(EnumFacing facing) {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IEnergyReceiver */
|
/* IEnergyReceiver */
|
||||||
@Override
|
@Override
|
||||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
|
public int receiveEnergy(EnumFacing facing, int maxReceive, boolean simulate) {
|
||||||
|
|
||||||
return storage.receiveEnergy(maxReceive, simulate);
|
return storage.receiveEnergy(maxReceive, simulate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IEnergyProvider */
|
/* IEnergyProvider */
|
||||||
@Override
|
@Override
|
||||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) {
|
public int extractEnergy(EnumFacing facing, int maxExtract, boolean simulate) {
|
||||||
|
|
||||||
return storage.extractEnergy(maxExtract, simulate);
|
return storage.extractEnergy(maxExtract, simulate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IEnergyReceiver and IEnergyProvider */
|
/* IEnergyReceiver and IEnergyProvider */
|
||||||
@Override
|
@Override
|
||||||
public int getEnergyStored(ForgeDirection from) {
|
public int getEnergyStored(EnumFacing facing) {
|
||||||
|
|
||||||
return storage.getEnergyStored();
|
return storage.getEnergyStored();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxEnergyStored(ForgeDirection from) {
|
public int getMaxEnergyStored(EnumFacing facing) {
|
||||||
|
|
||||||
return storage.getMaxEnergyStored();
|
return storage.getMaxEnergyStored();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
/**
|
|
||||||
* (C) 2014 Team CoFH / CoFH / Cult of the Full Hub
|
|
||||||
* http://www.teamcofh.com
|
|
||||||
*/
|
|
||||||
@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHAPI", provides = "CoFHAPI|energy")
|
|
||||||
package cofh.api.energy;
|
|
||||||
|
|
||||||
import cofh.api.CoFHAPIProps;
|
|
||||||
import cpw.mods.fml.common.API;
|
|
||||||
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
/**
|
|
||||||
* (C) 2014 Team CoFH / CoFH / Cult of the Full Hub
|
|
||||||
* http://www.teamcofh.com
|
|
||||||
*/
|
|
||||||
@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHLib", provides = "CoFHAPI")
|
|
||||||
package cofh.api;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.API;
|
|
||||||
|
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
package storagecraft;
|
package storagecraft;
|
||||||
|
|
||||||
import cpw.mods.fml.common.Mod;
|
|
||||||
import cpw.mods.fml.common.Mod.EventHandler;
|
|
||||||
import cpw.mods.fml.common.Mod.Instance;
|
|
||||||
import cpw.mods.fml.common.SidedProxy;
|
|
||||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
|
||||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
|
||||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
|
||||||
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;
|
||||||
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||||
|
import net.minecraftforge.fml.common.Mod.Instance;
|
||||||
|
import net.minecraftforge.fml.common.SidedProxy;
|
||||||
|
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||||
|
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||||
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||||
import storagecraft.item.ItemStorageCell;
|
import storagecraft.item.ItemStorageCell;
|
||||||
import storagecraft.proxy.CommonProxy;
|
import storagecraft.proxy.CommonProxy;
|
||||||
|
|
||||||
|
|||||||
@@ -3,11 +3,13 @@ package storagecraft.block;
|
|||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockPistonBase;
|
import net.minecraft.block.BlockPistonBase;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
import storagecraft.StorageCraft;
|
import storagecraft.StorageCraft;
|
||||||
import storagecraft.tile.TileBase;
|
import storagecraft.tile.TileBase;
|
||||||
import storagecraft.util.InventoryUtils;
|
import storagecraft.util.InventoryUtils;
|
||||||
@@ -23,7 +25,6 @@ public abstract class BlockBase extends Block
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
||||||
setCreativeTab(StorageCraft.TAB);
|
setCreativeTab(StorageCraft.TAB);
|
||||||
setBlockTextureName("storagecraft:" + name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -33,24 +34,24 @@ public abstract class BlockBase extends Block
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean rotateBlock(World world, int x, int y, int z, ForgeDirection axis)
|
public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
|
||||||
{
|
{
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
|
|
||||||
if (tile instanceof TileBase)
|
if (tile instanceof TileBase)
|
||||||
{
|
{
|
||||||
ForgeDirection dir = ((TileBase) tile).getDirection();
|
EnumFacing dir = ((TileBase) tile).getDirection();
|
||||||
|
|
||||||
int newDir = dir.ordinal() + 1;
|
int newDir = dir.ordinal() + 1;
|
||||||
|
|
||||||
if (newDir > ForgeDirection.VALID_DIRECTIONS.length - 1)
|
if (newDir > EnumFacing.VALUES.length - 1)
|
||||||
{
|
{
|
||||||
newDir = 0;
|
newDir = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
((TileBase) tile).setDirection(ForgeDirection.getOrientation(newDir));
|
((TileBase) tile).setDirection(EnumFacing.getFront(newDir));
|
||||||
|
|
||||||
world.markBlockForUpdate(x, y, z);
|
world.markBlockForUpdate(pos);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -59,34 +60,28 @@ public abstract class BlockBase extends Block
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(int meta)
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack itemStack)
|
||||||
{
|
{
|
||||||
return meta;
|
super.onBlockPlacedBy(world, pos, state, player, itemStack);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack)
|
|
||||||
{
|
|
||||||
super.onBlockPlacedBy(world, x, y, z, entityLiving, itemStack);
|
|
||||||
|
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
|
||||||
|
|
||||||
if (tile instanceof TileBase)
|
if (tile instanceof TileBase)
|
||||||
{
|
{
|
||||||
((TileBase) tile).setDirection(ForgeDirection.getOrientation(BlockPistonBase.determineOrientation(world, x, y, z, entityLiving)));
|
((TileBase) tile).setDirection(BlockPistonBase.func_180695_a(world, pos, player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPreDestroy(World world, int x, int y, int z, int meta)
|
public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state) // @TODO: Make this work all
|
||||||
{
|
{
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
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(), x, y, z);
|
InventoryUtils.dropInventory(world, ((TileBase) tile).getDroppedInventory(), pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onBlockPreDestroy(world, x, y, z, meta);
|
super.onBlockDestroyedByPlayer(world, pos, state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ package storagecraft.block;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.minecraft.block.ITileEntityProvider;
|
import net.minecraft.block.ITileEntityProvider;
|
||||||
|
import net.minecraft.block.properties.IProperty;
|
||||||
|
import net.minecraft.block.properties.PropertyBool;
|
||||||
|
import net.minecraft.block.state.BlockState;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
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;
|
||||||
@@ -11,11 +15,34 @@ import storagecraft.tile.TileCable;
|
|||||||
|
|
||||||
public class BlockCable extends BlockBase implements ITileEntityProvider
|
public class BlockCable extends BlockBase implements ITileEntityProvider
|
||||||
{
|
{
|
||||||
|
public static final PropertyBool SENSITIVE = PropertyBool.create("sensitive");
|
||||||
|
|
||||||
public BlockCable()
|
public BlockCable()
|
||||||
{
|
{
|
||||||
super("cable");
|
super("cable");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected BlockState createBlockState()
|
||||||
|
{
|
||||||
|
return new BlockState(this, new IProperty[]
|
||||||
|
{
|
||||||
|
SENSITIVE
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IBlockState getStateFromMeta(int meta)
|
||||||
|
{
|
||||||
|
return getDefaultState().withProperty(SENSITIVE, meta);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMetaFromState(IBlockState state)
|
||||||
|
{
|
||||||
|
return ((Boolean) state.getValue(SENSITIVE)) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta)
|
public TileEntity createNewTileEntity(World world, int meta)
|
||||||
{
|
{
|
||||||
@@ -42,10 +69,4 @@ public class BlockCable extends BlockBase implements ITileEntityProvider
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean renderAsNormalBlock()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,17 @@
|
|||||||
package storagecraft.block;
|
package storagecraft.block;
|
||||||
|
|
||||||
import net.minecraft.block.ITileEntityProvider;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import storagecraft.StorageCraft;
|
import storagecraft.StorageCraft;
|
||||||
import storagecraft.StorageCraftGUI;
|
import storagecraft.StorageCraftGUI;
|
||||||
import storagecraft.tile.TileConstructor;
|
import storagecraft.tile.TileConstructor;
|
||||||
|
|
||||||
public class BlockConstructor extends BlockBase implements ITileEntityProvider
|
public class BlockConstructor extends BlockMachine
|
||||||
{
|
{
|
||||||
private IIcon sideIcon;
|
|
||||||
private IIcon connectedIcon;
|
|
||||||
private IIcon disconnectedIcon;
|
|
||||||
|
|
||||||
public BlockConstructor()
|
public BlockConstructor()
|
||||||
{
|
{
|
||||||
super("constructor");
|
super("constructor");
|
||||||
@@ -29,45 +24,13 @@ public class BlockConstructor extends BlockBase implements ITileEntityProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
if (!world.isRemote)
|
if (!world.isRemote)
|
||||||
{
|
{
|
||||||
player.openGui(StorageCraft.INSTANCE, StorageCraftGUI.CONSTRUCTOR, world, x, y, z);
|
player.openGui(StorageCraft.INSTANCE, StorageCraftGUI.CONSTRUCTOR, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerBlockIcons(IIconRegister register)
|
|
||||||
{
|
|
||||||
connectedIcon = register.registerIcon("storagecraft:constructorConnected");
|
|
||||||
disconnectedIcon = register.registerIcon("storagecraft:constructorDisconnected");
|
|
||||||
sideIcon = register.registerIcon("storagecraft:side");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
|
||||||
{
|
|
||||||
TileConstructor tile = (TileConstructor) world.getTileEntity(x, y, z);
|
|
||||||
|
|
||||||
if (side == tile.getDirection().ordinal())
|
|
||||||
{
|
|
||||||
return tile.isConnected() ? connectedIcon : disconnectedIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
return sideIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(int side, int damage)
|
|
||||||
{
|
|
||||||
if (side == 3)
|
|
||||||
{
|
|
||||||
return disconnectedIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
return sideIcon;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
package storagecraft.block;
|
package storagecraft.block;
|
||||||
|
|
||||||
import net.minecraft.block.ITileEntityProvider;
|
import net.minecraft.block.ITileEntityProvider;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.block.properties.IProperty;
|
||||||
|
import net.minecraft.block.properties.PropertyInteger;
|
||||||
|
import net.minecraft.block.state.BlockState;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import storagecraft.StorageCraft;
|
import storagecraft.StorageCraft;
|
||||||
import storagecraft.StorageCraftGUI;
|
import storagecraft.StorageCraftGUI;
|
||||||
@@ -13,14 +16,34 @@ import storagecraft.tile.TileController;
|
|||||||
|
|
||||||
public class BlockController extends BlockBase implements ITileEntityProvider
|
public class BlockController extends BlockBase implements ITileEntityProvider
|
||||||
{
|
{
|
||||||
private IIcon sideIcon;
|
public static final PropertyInteger ENERGY = PropertyInteger.create("energy", 0, 15);
|
||||||
private IIcon[] icons = new IIcon[9];
|
|
||||||
|
|
||||||
public BlockController()
|
public BlockController()
|
||||||
{
|
{
|
||||||
super("controller");
|
super("controller");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected BlockState createBlockState()
|
||||||
|
{
|
||||||
|
return new BlockState(this, new IProperty[]
|
||||||
|
{
|
||||||
|
ENERGY
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IBlockState getStateFromMeta(int meta)
|
||||||
|
{
|
||||||
|
return getDefaultState().withProperty(ENERGY, meta);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMetaFromState(IBlockState state)
|
||||||
|
{
|
||||||
|
return ((Integer) state.getValue(ENERGY));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta)
|
public TileEntity createNewTileEntity(World world, int meta)
|
||||||
{
|
{
|
||||||
@@ -28,22 +51,22 @@ public class BlockController extends BlockBase implements ITileEntityProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
if (!world.isRemote)
|
if (!world.isRemote)
|
||||||
{
|
{
|
||||||
player.openGui(StorageCraft.INSTANCE, StorageCraftGUI.CONTROLLER, world, x, y, z);
|
player.openGui(StorageCraft.INSTANCE, StorageCraftGUI.CONTROLLER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPreDestroy(World world, int x, int y, int z, int meta)
|
public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state) // @TODO: What about explosions?
|
||||||
{
|
{
|
||||||
((TileController) world.getTileEntity(x, y, z)).onDestroyed();
|
((TileController) world.getTileEntity(pos)).onDestroyed();
|
||||||
|
|
||||||
super.onBlockPreDestroy(world, x, y, z, meta);
|
super.onBlockDestroyedByPlayer(world, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -53,45 +76,10 @@ public class BlockController extends BlockBase implements ITileEntityProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getComparatorInputOverride(World world, int x, int y, int z, int side)
|
public int getComparatorInputOverride(World world, BlockPos pos)
|
||||||
{
|
{
|
||||||
TileController tile = (TileController) world.getTileEntity(x, y, z);
|
TileController tile = (TileController) world.getTileEntity(pos);
|
||||||
|
|
||||||
return tile.getEnergyScaled(15);
|
return tile.getEnergyScaled(15);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerBlockIcons(IIconRegister register)
|
|
||||||
{
|
|
||||||
for (int i = 0; i <= 8; ++i)
|
|
||||||
{
|
|
||||||
icons[i] = register.registerIcon("storagecraft:controller" + i);
|
|
||||||
}
|
|
||||||
|
|
||||||
sideIcon = register.registerIcon("storagecraft:side");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
|
||||||
{
|
|
||||||
TileController tile = (TileController) world.getTileEntity(x, y, z);
|
|
||||||
|
|
||||||
if (side == tile.getDirection().ordinal())
|
|
||||||
{
|
|
||||||
return icons[tile.getEnergyScaled(8)];
|
|
||||||
}
|
|
||||||
|
|
||||||
return sideIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(int side, int meta)
|
|
||||||
{
|
|
||||||
if (side == 3)
|
|
||||||
{
|
|
||||||
return icons[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
return sideIcon;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,17 @@
|
|||||||
package storagecraft.block;
|
package storagecraft.block;
|
||||||
|
|
||||||
import net.minecraft.block.ITileEntityProvider;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import storagecraft.StorageCraft;
|
import storagecraft.StorageCraft;
|
||||||
import storagecraft.StorageCraftGUI;
|
import storagecraft.StorageCraftGUI;
|
||||||
import storagecraft.tile.TileDestructor;
|
import storagecraft.tile.TileDestructor;
|
||||||
|
|
||||||
public class BlockDestructor extends BlockBase implements ITileEntityProvider
|
public class BlockDestructor extends BlockMachine
|
||||||
{
|
{
|
||||||
private IIcon sideIcon;
|
|
||||||
private IIcon connectedIcon;
|
|
||||||
private IIcon disconnectedIcon;
|
|
||||||
|
|
||||||
public BlockDestructor()
|
public BlockDestructor()
|
||||||
{
|
{
|
||||||
super("destructor");
|
super("destructor");
|
||||||
@@ -29,45 +24,13 @@ public class BlockDestructor extends BlockBase implements ITileEntityProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
if (!world.isRemote)
|
if (!world.isRemote)
|
||||||
{
|
{
|
||||||
player.openGui(StorageCraft.INSTANCE, StorageCraftGUI.DESTRUCTOR, world, x, y, z);
|
player.openGui(StorageCraft.INSTANCE, StorageCraftGUI.DESTRUCTOR, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerBlockIcons(IIconRegister register)
|
|
||||||
{
|
|
||||||
connectedIcon = register.registerIcon("storagecraft:destructorConnected");
|
|
||||||
disconnectedIcon = register.registerIcon("storagecraft:destructorDisconnected");
|
|
||||||
sideIcon = register.registerIcon("storagecraft:side");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
|
||||||
{
|
|
||||||
TileDestructor tile = (TileDestructor) world.getTileEntity(x, y, z);
|
|
||||||
|
|
||||||
if (side == tile.getDirection().ordinal())
|
|
||||||
{
|
|
||||||
return tile.isConnected() ? connectedIcon : disconnectedIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
return sideIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(int side, int damage)
|
|
||||||
{
|
|
||||||
if (side == 3)
|
|
||||||
{
|
|
||||||
return disconnectedIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
return sideIcon;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,38 +1,23 @@
|
|||||||
package storagecraft.block;
|
package storagecraft.block;
|
||||||
|
|
||||||
import net.minecraft.block.ITileEntityProvider;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import storagecraft.StorageCraft;
|
import storagecraft.StorageCraft;
|
||||||
import storagecraft.StorageCraftGUI;
|
import storagecraft.StorageCraftGUI;
|
||||||
import storagecraft.tile.TileDetector;
|
import storagecraft.tile.TileDetector;
|
||||||
|
|
||||||
public class BlockDetector extends BlockBase implements ITileEntityProvider
|
// @TODO: This too other textures
|
||||||
|
public class BlockDetector extends BlockMachine
|
||||||
{
|
{
|
||||||
private IIcon poweredIcon;
|
|
||||||
private IIcon unpoweredIcon;
|
|
||||||
private IIcon sideIcon;
|
|
||||||
|
|
||||||
public BlockDetector()
|
public BlockDetector()
|
||||||
{
|
{
|
||||||
super("detector");
|
super("detector");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
|
||||||
{
|
|
||||||
if (!world.isRemote)
|
|
||||||
{
|
|
||||||
player.openGui(StorageCraft.INSTANCE, StorageCraftGUI.DETECTOR, world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta)
|
public TileEntity createNewTileEntity(World world, int meta)
|
||||||
{
|
{
|
||||||
@@ -40,54 +25,13 @@ public class BlockDetector extends BlockBase implements ITileEntityProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side)
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
return isProvidingStrongPower(world, x, y, z, side);
|
if (!world.isRemote)
|
||||||
|
{
|
||||||
|
player.openGui(StorageCraft.INSTANCE, StorageCraftGUI.DETECTOR, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int side)
|
|
||||||
{
|
|
||||||
TileDetector detector = (TileDetector) world.getTileEntity(x, y, z);
|
|
||||||
|
|
||||||
return detector.providesPower() ? 15 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvidePower()
|
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerBlockIcons(IIconRegister register)
|
|
||||||
{
|
|
||||||
poweredIcon = register.registerIcon("storagecraft:detectorPowered");
|
|
||||||
unpoweredIcon = register.registerIcon("storagecraft:detectorUnpowered");
|
|
||||||
sideIcon = register.registerIcon("storagecraft:side");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
|
||||||
{
|
|
||||||
if (side == 0 || side == 1)
|
|
||||||
{
|
|
||||||
return sideIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
TileDetector tile = (TileDetector) world.getTileEntity(x, y, z);
|
|
||||||
|
|
||||||
return tile.providesPower() ? poweredIcon : unpoweredIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(int side, int meta)
|
|
||||||
{
|
|
||||||
if (side == 0 || side == 1)
|
|
||||||
{
|
|
||||||
return sideIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
return unpoweredIcon;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,37 +1,22 @@
|
|||||||
package storagecraft.block;
|
package storagecraft.block;
|
||||||
|
|
||||||
import net.minecraft.block.ITileEntityProvider;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import storagecraft.StorageCraft;
|
import storagecraft.StorageCraft;
|
||||||
import storagecraft.StorageCraftGUI;
|
import storagecraft.StorageCraftGUI;
|
||||||
import storagecraft.tile.TileDrive;
|
import storagecraft.tile.TileDrive;
|
||||||
|
|
||||||
public class BlockDrive extends BlockBase implements ITileEntityProvider
|
public class BlockDrive extends BlockMachine
|
||||||
{
|
{
|
||||||
private IIcon frontIcon;
|
|
||||||
private IIcon sideIcon;
|
|
||||||
|
|
||||||
public BlockDrive()
|
public BlockDrive()
|
||||||
{
|
{
|
||||||
super("drive");
|
super("drive");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
|
||||||
{
|
|
||||||
if (!world.isRemote)
|
|
||||||
{
|
|
||||||
player.openGui(StorageCraft.INSTANCE, StorageCraftGUI.DRIVE, world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta)
|
public TileEntity createNewTileEntity(World world, int meta)
|
||||||
{
|
{
|
||||||
@@ -39,33 +24,13 @@ public class BlockDrive extends BlockBase implements ITileEntityProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerBlockIcons(IIconRegister register)
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
frontIcon = register.registerIcon("storagecraft:drive");
|
if (!world.isRemote)
|
||||||
sideIcon = register.registerIcon("storagecraft:side");
|
{
|
||||||
|
player.openGui(StorageCraft.INSTANCE, StorageCraftGUI.DRIVE, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
return true;
|
||||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
|
||||||
{
|
|
||||||
TileDrive tile = (TileDrive) world.getTileEntity(x, y, z);
|
|
||||||
|
|
||||||
if (side == tile.getDirection().ordinal())
|
|
||||||
{
|
|
||||||
return frontIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
return sideIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(int side, int meta)
|
|
||||||
{
|
|
||||||
if (side == 3)
|
|
||||||
{
|
|
||||||
return frontIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
return sideIcon;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,17 @@
|
|||||||
package storagecraft.block;
|
package storagecraft.block;
|
||||||
|
|
||||||
import net.minecraft.block.ITileEntityProvider;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import storagecraft.StorageCraft;
|
import storagecraft.StorageCraft;
|
||||||
import storagecraft.StorageCraftGUI;
|
import storagecraft.StorageCraftGUI;
|
||||||
import storagecraft.tile.TileExporter;
|
import storagecraft.tile.TileExporter;
|
||||||
|
|
||||||
public class BlockExporter extends BlockBase implements ITileEntityProvider
|
public class BlockExporter extends BlockMachine
|
||||||
{
|
{
|
||||||
private IIcon frontIcon;
|
|
||||||
private IIcon sideIcon;
|
|
||||||
|
|
||||||
public BlockExporter()
|
public BlockExporter()
|
||||||
{
|
{
|
||||||
super("exporter");
|
super("exporter");
|
||||||
@@ -28,44 +24,13 @@ public class BlockExporter extends BlockBase implements ITileEntityProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
if (!world.isRemote)
|
if (!world.isRemote)
|
||||||
{
|
{
|
||||||
player.openGui(StorageCraft.INSTANCE, StorageCraftGUI.EXPORTER, world, x, y, z);
|
player.openGui(StorageCraft.INSTANCE, StorageCraftGUI.EXPORTER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerBlockIcons(IIconRegister register)
|
|
||||||
{
|
|
||||||
frontIcon = register.registerIcon("storagecraft:exporter");
|
|
||||||
sideIcon = register.registerIcon("storagecraft:side");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
|
||||||
{
|
|
||||||
TileExporter tile = (TileExporter) world.getTileEntity(x, y, z);
|
|
||||||
|
|
||||||
if (side == tile.getDirection().ordinal())
|
|
||||||
{
|
|
||||||
return frontIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
return sideIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(int side, int meta)
|
|
||||||
{
|
|
||||||
if (side == 3)
|
|
||||||
{
|
|
||||||
return frontIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
return sideIcon;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,17 @@
|
|||||||
package storagecraft.block;
|
package storagecraft.block;
|
||||||
|
|
||||||
import net.minecraft.block.ITileEntityProvider;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import storagecraft.StorageCraft;
|
import storagecraft.StorageCraft;
|
||||||
import storagecraft.StorageCraftGUI;
|
import storagecraft.StorageCraftGUI;
|
||||||
import storagecraft.tile.TileExternalStorage;
|
import storagecraft.tile.TileExternalStorage;
|
||||||
|
|
||||||
public class BlockExternalStorage extends BlockBase implements ITileEntityProvider
|
public class BlockExternalStorage extends BlockMachine
|
||||||
{
|
{
|
||||||
private IIcon frontIcon;
|
|
||||||
private IIcon sideIcon;
|
|
||||||
|
|
||||||
public BlockExternalStorage()
|
public BlockExternalStorage()
|
||||||
{
|
{
|
||||||
super("externalStorage");
|
super("externalStorage");
|
||||||
@@ -28,44 +24,13 @@ public class BlockExternalStorage extends BlockBase implements ITileEntityProvid
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
if (!world.isRemote)
|
if (!world.isRemote)
|
||||||
{
|
{
|
||||||
player.openGui(StorageCraft.INSTANCE, StorageCraftGUI.EXTERNAL_STORAGE, world, x, y, z);
|
player.openGui(StorageCraft.INSTANCE, StorageCraftGUI.EXTERNAL_STORAGE, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerBlockIcons(IIconRegister register)
|
|
||||||
{
|
|
||||||
frontIcon = register.registerIcon("storagecraft:externalStorage");
|
|
||||||
sideIcon = register.registerIcon("storagecraft:side");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
|
||||||
{
|
|
||||||
TileExternalStorage tile = (TileExternalStorage) world.getTileEntity(x, y, z);
|
|
||||||
|
|
||||||
if (side == tile.getDirection().ordinal())
|
|
||||||
{
|
|
||||||
return frontIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
return sideIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(int side, int meta)
|
|
||||||
{
|
|
||||||
if (side == 3)
|
|
||||||
{
|
|
||||||
return frontIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
return sideIcon;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,17 @@
|
|||||||
package storagecraft.block;
|
package storagecraft.block;
|
||||||
|
|
||||||
import java.util.List;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.block.ITileEntityProvider;
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import storagecraft.StorageCraft;
|
import storagecraft.StorageCraft;
|
||||||
import storagecraft.StorageCraftGUI;
|
import storagecraft.StorageCraftGUI;
|
||||||
import storagecraft.tile.TileGrid;
|
import storagecraft.tile.TileGrid;
|
||||||
|
|
||||||
public class BlockGrid extends BlockBase implements ITileEntityProvider
|
public class BlockGrid extends BlockMachine
|
||||||
{
|
{
|
||||||
private IIcon sideIcon;
|
|
||||||
private IIcon connectedIcon;
|
|
||||||
private IIcon disconnectedIcon;
|
|
||||||
|
|
||||||
public BlockGrid()
|
public BlockGrid()
|
||||||
{
|
{
|
||||||
super("grid");
|
super("grid");
|
||||||
@@ -33,54 +24,13 @@ public class BlockGrid extends BlockBase implements ITileEntityProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item item, CreativeTabs tab, List subItems)
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||||
{
|
|
||||||
for (int i = 0; i < 2; i++)
|
|
||||||
{
|
|
||||||
subItems.add(new ItemStack(item, 1, i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
|
||||||
{
|
{
|
||||||
if (!world.isRemote)
|
if (!world.isRemote)
|
||||||
{
|
{
|
||||||
player.openGui(StorageCraft.INSTANCE, StorageCraftGUI.GRID, world, x, y, z);
|
player.openGui(StorageCraft.INSTANCE, StorageCraftGUI.GRID, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerBlockIcons(IIconRegister register)
|
|
||||||
{
|
|
||||||
connectedIcon = register.registerIcon("storagecraft:gridConnected");
|
|
||||||
disconnectedIcon = register.registerIcon("storagecraft:gridDisconnected");
|
|
||||||
sideIcon = register.registerIcon("storagecraft:side");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
|
||||||
{
|
|
||||||
TileGrid tile = (TileGrid) world.getTileEntity(x, y, z);
|
|
||||||
|
|
||||||
if (side == tile.getDirection().ordinal())
|
|
||||||
{
|
|
||||||
return tile.isConnected() ? connectedIcon : disconnectedIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
return sideIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(int side, int damage)
|
|
||||||
{
|
|
||||||
if (side == 3)
|
|
||||||
{
|
|
||||||
return disconnectedIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
return sideIcon;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,17 @@
|
|||||||
package storagecraft.block;
|
package storagecraft.block;
|
||||||
|
|
||||||
import net.minecraft.block.ITileEntityProvider;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import storagecraft.StorageCraft;
|
import storagecraft.StorageCraft;
|
||||||
import storagecraft.StorageCraftGUI;
|
import storagecraft.StorageCraftGUI;
|
||||||
import storagecraft.tile.TileImporter;
|
import storagecraft.tile.TileImporter;
|
||||||
|
|
||||||
public class BlockImporter extends BlockBase implements ITileEntityProvider
|
public class BlockImporter extends BlockMachine
|
||||||
{
|
{
|
||||||
private IIcon frontIcon;
|
|
||||||
private IIcon sideIcon;
|
|
||||||
|
|
||||||
public BlockImporter()
|
public BlockImporter()
|
||||||
{
|
{
|
||||||
super("importer");
|
super("importer");
|
||||||
@@ -28,44 +24,13 @@ public class BlockImporter extends BlockBase implements ITileEntityProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
if (!world.isRemote)
|
if (!world.isRemote)
|
||||||
{
|
{
|
||||||
player.openGui(StorageCraft.INSTANCE, StorageCraftGUI.IMPORTER, world, x, y, z);
|
player.openGui(StorageCraft.INSTANCE, StorageCraftGUI.IMPORTER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerBlockIcons(IIconRegister register)
|
|
||||||
{
|
|
||||||
frontIcon = register.registerIcon("storagecraft:importer");
|
|
||||||
sideIcon = register.registerIcon("storagecraft:side");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
|
||||||
{
|
|
||||||
TileImporter tile = (TileImporter) world.getTileEntity(x, y, z);
|
|
||||||
|
|
||||||
if (side == tile.getDirection().ordinal())
|
|
||||||
{
|
|
||||||
return frontIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
return sideIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(int side, int meta)
|
|
||||||
{
|
|
||||||
if (side == 3)
|
|
||||||
{
|
|
||||||
return frontIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
return sideIcon;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
38
src/main/java/storagecraft/block/BlockMachine.java
Normal file
38
src/main/java/storagecraft/block/BlockMachine.java
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
package storagecraft.block;
|
||||||
|
|
||||||
|
import net.minecraft.block.ITileEntityProvider;
|
||||||
|
import net.minecraft.block.properties.IProperty;
|
||||||
|
import net.minecraft.block.properties.PropertyBool;
|
||||||
|
import net.minecraft.block.state.BlockState;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
|
||||||
|
public abstract class BlockMachine extends BlockBase implements ITileEntityProvider
|
||||||
|
{
|
||||||
|
public static final PropertyBool CONNECTED = PropertyBool.create("connected");
|
||||||
|
|
||||||
|
public BlockMachine(String name)
|
||||||
|
{
|
||||||
|
super(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected BlockState createBlockState()
|
||||||
|
{
|
||||||
|
return new BlockState(this, new IProperty[]
|
||||||
|
{
|
||||||
|
CONNECTED
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IBlockState getStateFromMeta(int meta)
|
||||||
|
{
|
||||||
|
return getDefaultState().withProperty(CONNECTED, meta);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMetaFromState(IBlockState state)
|
||||||
|
{
|
||||||
|
return ((Boolean) state.getValue(CONNECTED)) ? 0 : 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,33 +1,9 @@
|
|||||||
package storagecraft.block;
|
package storagecraft.block;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
|
|
||||||
public class BlockMachineCasing extends BlockBase
|
public class BlockMachineCasing extends BlockBase
|
||||||
{
|
{
|
||||||
private IIcon icon;
|
|
||||||
|
|
||||||
public BlockMachineCasing()
|
public BlockMachineCasing()
|
||||||
{
|
{
|
||||||
super("machineCasing");
|
super("machineCasing");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerBlockIcons(IIconRegister register)
|
|
||||||
{
|
|
||||||
icon = register.registerIcon("storagecraft:side");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
|
||||||
{
|
|
||||||
return icon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(int side, int meta)
|
|
||||||
{
|
|
||||||
return icon;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,17 @@
|
|||||||
package storagecraft.block;
|
package storagecraft.block;
|
||||||
|
|
||||||
import net.minecraft.block.ITileEntityProvider;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import storagecraft.StorageCraft;
|
import storagecraft.StorageCraft;
|
||||||
import storagecraft.StorageCraftGUI;
|
import storagecraft.StorageCraftGUI;
|
||||||
import storagecraft.tile.TileSolderer;
|
import storagecraft.tile.TileSolderer;
|
||||||
|
|
||||||
public class BlockSolderer extends BlockBase implements ITileEntityProvider
|
public class BlockSolderer extends BlockMachine
|
||||||
{
|
{
|
||||||
private IIcon sideIcon;
|
|
||||||
private IIcon connectedIcon;
|
|
||||||
private IIcon disconnectedIcon;
|
|
||||||
|
|
||||||
public BlockSolderer()
|
public BlockSolderer()
|
||||||
{
|
{
|
||||||
super("solderer");
|
super("solderer");
|
||||||
@@ -29,45 +24,13 @@ public class BlockSolderer extends BlockBase implements ITileEntityProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
if (!world.isRemote)
|
if (!world.isRemote)
|
||||||
{
|
{
|
||||||
player.openGui(StorageCraft.INSTANCE, StorageCraftGUI.SOLDERER, world, x, y, z);
|
player.openGui(StorageCraft.INSTANCE, StorageCraftGUI.SOLDERER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerBlockIcons(IIconRegister register)
|
|
||||||
{
|
|
||||||
connectedIcon = register.registerIcon("storagecraft:soldererConnected");
|
|
||||||
disconnectedIcon = register.registerIcon("storagecraft:soldererDisconnected");
|
|
||||||
sideIcon = register.registerIcon("storagecraft:side");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
|
||||||
{
|
|
||||||
TileSolderer tile = (TileSolderer) world.getTileEntity(x, y, z);
|
|
||||||
|
|
||||||
if (side == tile.getDirection().ordinal())
|
|
||||||
{
|
|
||||||
return tile.isConnected() ? connectedIcon : disconnectedIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
return sideIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(int side, int damage)
|
|
||||||
{
|
|
||||||
if (side == 3)
|
|
||||||
{
|
|
||||||
return disconnectedIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
return sideIcon;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,39 +1,23 @@
|
|||||||
package storagecraft.block;
|
package storagecraft.block;
|
||||||
|
|
||||||
import net.minecraft.block.ITileEntityProvider;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import storagecraft.StorageCraft;
|
import storagecraft.StorageCraft;
|
||||||
import storagecraft.StorageCraftGUI;
|
import storagecraft.StorageCraftGUI;
|
||||||
import storagecraft.tile.TileWirelessTransmitter;
|
import storagecraft.tile.TileWirelessTransmitter;
|
||||||
|
|
||||||
public class BlockWirelessTransmitter extends BlockBase implements ITileEntityProvider
|
// @TODO: This texture behaves differently
|
||||||
|
public class BlockWirelessTransmitter extends BlockMachine
|
||||||
{
|
{
|
||||||
private IIcon icon;
|
|
||||||
private IIcon workingIcon;
|
|
||||||
private IIcon sideIcon;
|
|
||||||
private IIcon workingSideIcon;
|
|
||||||
|
|
||||||
public BlockWirelessTransmitter()
|
public BlockWirelessTransmitter()
|
||||||
{
|
{
|
||||||
super("wirelessTransmitter");
|
super("wirelessTransmitter");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
|
||||||
{
|
|
||||||
if (!world.isRemote)
|
|
||||||
{
|
|
||||||
player.openGui(StorageCraft.INSTANCE, StorageCraftGUI.WIRELESS_TRANSMITTER, world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta)
|
public TileEntity createNewTileEntity(World world, int meta)
|
||||||
{
|
{
|
||||||
@@ -41,35 +25,13 @@ public class BlockWirelessTransmitter extends BlockBase implements ITileEntityPr
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerBlockIcons(IIconRegister register)
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
icon = register.registerIcon("storagecraft:wirelessTransmitter");
|
if (!world.isRemote)
|
||||||
workingIcon = register.registerIcon("storagecraft:wirelessTransmitterWorking");
|
{
|
||||||
sideIcon = register.registerIcon("storagecraft:wirelessTransmitterSide");
|
player.openGui(StorageCraft.INSTANCE, StorageCraftGUI.WIRELESS_TRANSMITTER, world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
workingSideIcon = register.registerIcon("storagecraft:wirelessTransmitterSideWorking");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
return true;
|
||||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
|
||||||
{
|
|
||||||
TileWirelessTransmitter tile = (TileWirelessTransmitter) world.getTileEntity(x, y, z);
|
|
||||||
|
|
||||||
if (side == tile.getDirection().ordinal())
|
|
||||||
{
|
|
||||||
return tile.isWorking() ? workingIcon : icon;
|
|
||||||
}
|
|
||||||
|
|
||||||
return tile.isWorking() ? workingSideIcon : sideIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(int side, int damage)
|
|
||||||
{
|
|
||||||
if (side == 3)
|
|
||||||
{
|
|
||||||
return icon;
|
|
||||||
}
|
|
||||||
|
|
||||||
return sideIcon;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package storagecraft.container.slot;
|
|||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
import net.minecraft.inventory.SlotCrafting;
|
import net.minecraft.inventory.SlotCrafting;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import storagecraft.tile.TileGrid;
|
import storagecraft.tile.TileGrid;
|
||||||
@@ -11,7 +12,7 @@ public class SlotGridCraftingResult extends SlotCrafting
|
|||||||
private IInventory craftingMatrix;
|
private IInventory craftingMatrix;
|
||||||
private TileGrid grid;
|
private TileGrid grid;
|
||||||
|
|
||||||
public SlotGridCraftingResult(EntityPlayer player, IInventory 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);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package storagecraft.gui;
|
package storagecraft.gui;
|
||||||
|
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
@@ -85,7 +86,7 @@ public abstract class GuiBase extends GuiContainer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void actionPerformed(GuiButton button)
|
protected void actionPerformed(GuiButton button) throws IOException
|
||||||
{
|
{
|
||||||
super.actionPerformed(button);
|
super.actionPerformed(button);
|
||||||
|
|
||||||
@@ -156,11 +157,10 @@ public abstract class GuiBase extends GuiContainer
|
|||||||
|
|
||||||
RenderHelper.enableGUIStandardItemLighting();
|
RenderHelper.enableGUIStandardItemLighting();
|
||||||
|
|
||||||
itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.renderEngine, stack, x, y);
|
// @TODO: itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.renderEngine, stack, x, y);
|
||||||
|
|
||||||
if (withOverlay)
|
if (withOverlay)
|
||||||
{
|
{
|
||||||
itemRender.renderItemOverlayIntoGUI(fontRendererObj, mc.renderEngine, stack, x, y);
|
// @TODO: itemRender.renderItemOverlayIntoGUI(fontRendererObj, mc.renderEngine, stack, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
GL11.glPopAttrib();
|
GL11.glPopAttrib();
|
||||||
@@ -255,8 +255,7 @@ public abstract class GuiBase extends GuiContainer
|
|||||||
var14 = "\u00a77" + var14;
|
var14 = "\u00a77" + var14;
|
||||||
}
|
}
|
||||||
|
|
||||||
fontRendererObj.drawStringWithShadow(var14, var6, var7, -1);
|
// @TODO: fontRendererObj.drawStringWithShadow(var14, var6, var7, -1);
|
||||||
|
|
||||||
if (var13 == 0)
|
if (var13 == 0)
|
||||||
{
|
{
|
||||||
var7 += 2;
|
var7 += 2;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package storagecraft.gui;
|
package storagecraft.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 storagecraft.StorageCraft;
|
import storagecraft.StorageCraft;
|
||||||
import storagecraft.container.ContainerDetector;
|
import storagecraft.container.ContainerDetector;
|
||||||
@@ -31,7 +32,7 @@ public class GuiDetector extends GuiBase
|
|||||||
|
|
||||||
addSideButton(new SideButtonDetectorMode(detector));
|
addSideButton(new SideButtonDetectorMode(detector));
|
||||||
|
|
||||||
amountField = new GuiTextField(fontRendererObj, x + 62 + 1, y + 23 + 1, 25, fontRendererObj.FONT_HEIGHT);
|
amountField = new GuiTextField(0, fontRendererObj, x + 62 + 1, y + 23 + 1, 25, fontRendererObj.FONT_HEIGHT); // @TODO: Is this the right id?
|
||||||
amountField.setText(String.valueOf(detector.getAmount()));
|
amountField.setText(String.valueOf(detector.getAmount()));
|
||||||
amountField.setEnableBackgroundDrawing(false);
|
amountField.setEnableBackgroundDrawing(false);
|
||||||
amountField.setVisible(true);
|
amountField.setVisible(true);
|
||||||
@@ -63,7 +64,7 @@ public class GuiDetector extends GuiBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void keyTyped(char character, int keyCode)
|
protected void keyTyped(char character, int keyCode) throws IOException
|
||||||
{
|
{
|
||||||
if (!checkHotbarKeys(keyCode) && amountField.textboxKeyTyped(character, keyCode))
|
if (!checkHotbarKeys(keyCode) && amountField.textboxKeyTyped(character, keyCode))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package storagecraft.gui;
|
package storagecraft.gui;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@@ -59,7 +60,7 @@ public class GuiGrid extends GuiBase
|
|||||||
addSideButton(new SideButtonGridSortingDirection());
|
addSideButton(new SideButtonGridSortingDirection());
|
||||||
addSideButton(new SideButtonGridSortingType());
|
addSideButton(new SideButtonGridSortingType());
|
||||||
|
|
||||||
searchField = new GuiTextField(fontRendererObj, x + 80 + 1, y + 6 + 1, 88 - 6, fontRendererObj.FONT_HEIGHT);
|
searchField = new GuiTextField(0, fontRendererObj, x + 80 + 1, y + 6 + 1, 88 - 6, fontRendererObj.FONT_HEIGHT); // @TODO: Is this the right id?
|
||||||
searchField.setEnableBackgroundDrawing(false);
|
searchField.setEnableBackgroundDrawing(false);
|
||||||
searchField.setVisible(true);
|
searchField.setVisible(true);
|
||||||
searchField.setTextColor(16777215);
|
searchField.setTextColor(16777215);
|
||||||
@@ -279,7 +280,7 @@ public class GuiGrid extends GuiBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(int mouseX, int mouseY, int clickedButton)
|
public void mouseClicked(int mouseX, int mouseY, int clickedButton) throws IOException
|
||||||
{
|
{
|
||||||
super.mouseClicked(mouseX, mouseY, clickedButton);
|
super.mouseClicked(mouseX, mouseY, clickedButton);
|
||||||
|
|
||||||
@@ -291,11 +292,11 @@ public class GuiGrid extends GuiBase
|
|||||||
|
|
||||||
if (isHoveringOverSlot() && container.getPlayer().inventory.getItemStack() != null)
|
if (isHoveringOverSlot() && container.getPlayer().inventory.getItemStack() != null)
|
||||||
{
|
{
|
||||||
StorageCraft.NETWORK.sendToServer(new MessageStoragePush(controller.xCoord, controller.yCoord, controller.zCoord, -1, clickedButton == 1));
|
StorageCraft.NETWORK.sendToServer(new MessageStoragePush(controller.getPos().getX(), controller.getPos().getY(), controller.getPos().getZ(), -1, clickedButton == 1));
|
||||||
}
|
}
|
||||||
else if (isHoveringOverValidSlot() && container.getPlayer().inventory.getItemStack() == null)
|
else if (isHoveringOverValidSlot() && container.getPlayer().inventory.getItemStack() == null)
|
||||||
{
|
{
|
||||||
StorageCraft.NETWORK.sendToServer(new MessageStoragePull(controller.xCoord, controller.yCoord, controller.zCoord, hoveringId, clickedButton == 1, Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)));
|
StorageCraft.NETWORK.sendToServer(new MessageStoragePull(controller.getPos().getX(), controller.getPos().getY(), controller.getPos().getZ(), hoveringId, clickedButton == 1, Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)));
|
||||||
}
|
}
|
||||||
else if (clickedClear)
|
else if (clickedClear)
|
||||||
{
|
{
|
||||||
@@ -309,7 +310,7 @@ public class GuiGrid extends GuiBase
|
|||||||
{
|
{
|
||||||
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||||
{
|
{
|
||||||
StorageCraft.NETWORK.sendToServer(new MessageStoragePush(controller.xCoord, controller.yCoord, controller.zCoord, slot.slotNumber, clickedButton == 1));
|
StorageCraft.NETWORK.sendToServer(new MessageStoragePush(controller.getPos().getX(), controller.getPos().getY(), controller.getPos().getZ(), slot.slotNumber, clickedButton == 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -318,12 +319,12 @@ public class GuiGrid extends GuiBase
|
|||||||
|
|
||||||
if (clickedClear)
|
if (clickedClear)
|
||||||
{
|
{
|
||||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void keyTyped(char character, int keyCode)
|
protected void keyTyped(char character, int keyCode) throws IOException
|
||||||
{
|
{
|
||||||
if (!checkHotbarKeys(keyCode) && searchField.textboxKeyTyped(character, keyCode))
|
if (!checkHotbarKeys(keyCode) && searchField.textboxKeyTyped(character, keyCode))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
package storagecraft.gui;
|
package storagecraft.gui;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.IGuiHandler;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.fml.common.network.IGuiHandler;
|
||||||
import storagecraft.StorageCraftGUI;
|
import storagecraft.StorageCraftGUI;
|
||||||
import storagecraft.container.ContainerConstructor;
|
import storagecraft.container.ContainerConstructor;
|
||||||
import storagecraft.container.ContainerController;
|
import storagecraft.container.ContainerController;
|
||||||
@@ -65,13 +66,13 @@ 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(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(x, y, z);
|
TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
|
||||||
|
|
||||||
switch (ID)
|
switch (ID)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package storagecraft.inventory;
|
|||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.IChatComponent;
|
||||||
|
|
||||||
public class InventorySimple implements IInventory
|
public class InventorySimple implements IInventory
|
||||||
{
|
{
|
||||||
@@ -79,13 +80,13 @@ public class InventorySimple implements IInventory
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getInventoryName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasCustomInventoryName()
|
public boolean hasCustomName()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -102,16 +103,6 @@ public class InventorySimple implements IInventory
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void openInventory()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void closeInventory()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int slot, ItemStack stack)
|
public boolean isItemValidForSlot(int slot, ItemStack stack)
|
||||||
{
|
{
|
||||||
@@ -122,4 +113,42 @@ public class InventorySimple implements IInventory
|
|||||||
public void markDirty()
|
public void markDirty()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void openInventory(EntityPlayer playerIn)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void closeInventory(EntityPlayer playerIn)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getField(int id)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setField(int id, int value)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getFieldCount()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IChatComponent getDisplayName()
|
||||||
|
{
|
||||||
|
return null; // @TODO: ...
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public abstract class ItemBase extends Item
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
||||||
setCreativeTab(StorageCraft.TAB);
|
setCreativeTab(StorageCraft.TAB);
|
||||||
setTextureName("storagecraft:" + name);
|
// @TODO: ... setTextureName("storagecraft:" + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
package storagecraft.item;
|
package storagecraft.item;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.ItemBlockWithMetadata;
|
import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public abstract class ItemBlockBase extends ItemBlockWithMetadata
|
public abstract class ItemBlockBase extends ItemBlock
|
||||||
{
|
{
|
||||||
public ItemBlockBase(Block block)
|
public ItemBlockBase(Block block)
|
||||||
{
|
{
|
||||||
super(block, block);
|
super(block);
|
||||||
|
|
||||||
|
setHasSubtypes(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,20 +1,15 @@
|
|||||||
package storagecraft.item;
|
package storagecraft.item;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
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;
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
|
|
||||||
public class ItemCore extends ItemBase
|
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;
|
||||||
|
|
||||||
private IIcon constructionIcon;
|
|
||||||
private IIcon destructionIcon;
|
|
||||||
|
|
||||||
public ItemCore()
|
public ItemCore()
|
||||||
{
|
{
|
||||||
super("core");
|
super("core");
|
||||||
@@ -31,25 +26,4 @@ public class ItemCore extends ItemBase
|
|||||||
list.add(new ItemStack(item, 1, i));
|
list.add(new ItemStack(item, 1, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerIcons(IIconRegister register)
|
|
||||||
{
|
|
||||||
constructionIcon = register.registerIcon("storagecraft:core0");
|
|
||||||
destructionIcon = register.registerIcon("storagecraft:core1");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIconFromDamage(int damage)
|
|
||||||
{
|
|
||||||
switch (damage)
|
|
||||||
{
|
|
||||||
case TYPE_CONSTRUCTION:
|
|
||||||
return constructionIcon;
|
|
||||||
case TYPE_DESTRUCTION:
|
|
||||||
return destructionIcon;
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
package storagecraft.item;
|
package storagecraft.item;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
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;
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
|
|
||||||
public class ItemProcessor extends ItemBase
|
public class ItemProcessor extends ItemBase
|
||||||
{
|
{
|
||||||
@@ -17,8 +15,6 @@ 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;
|
||||||
|
|
||||||
private IIcon[] icons = new IIcon[7];
|
|
||||||
|
|
||||||
public ItemProcessor()
|
public ItemProcessor()
|
||||||
{
|
{
|
||||||
super("processor");
|
super("processor");
|
||||||
@@ -35,19 +31,4 @@ public class ItemProcessor extends ItemBase
|
|||||||
list.add(new ItemStack(item, 1, i));
|
list.add(new ItemStack(item, 1, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerIcons(IIconRegister register)
|
|
||||||
{
|
|
||||||
for (int i = 0; i <= 6; ++i)
|
|
||||||
{
|
|
||||||
icons[i] = register.registerIcon("storagecraft:processor" + i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIconFromDamage(int damage)
|
|
||||||
{
|
|
||||||
return icons[damage];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
package storagecraft.item;
|
package storagecraft.item;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import net.minecraft.util.StatCollector;
|
import net.minecraft.util.StatCollector;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import storagecraft.storage.CellStorage;
|
import storagecraft.storage.CellStorage;
|
||||||
@@ -21,8 +19,6 @@ public class ItemStorageCell extends ItemBase
|
|||||||
public static final int TYPE_64K = 3;
|
public static final int TYPE_64K = 3;
|
||||||
public static final int TYPE_CREATIVE = 4;
|
public static final int TYPE_CREATIVE = 4;
|
||||||
|
|
||||||
private IIcon[] icons = new IIcon[5];
|
|
||||||
|
|
||||||
public ItemStorageCell()
|
public ItemStorageCell()
|
||||||
{
|
{
|
||||||
super("storageCell");
|
super("storageCell");
|
||||||
@@ -62,33 +58,19 @@ public class ItemStorageCell extends ItemBase
|
|||||||
initNBT(stack);
|
initNBT(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerIcons(IIconRegister register)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < 5; ++i)
|
|
||||||
{
|
|
||||||
icons[i] = register.registerIcon("storagecraft:storageCell" + i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIconFromDamage(int damage)
|
|
||||||
{
|
|
||||||
return icons[damage];
|
|
||||||
}
|
|
||||||
|
|
||||||
private ItemStack initNBT(ItemStack cell)
|
private ItemStack initNBT(ItemStack cell)
|
||||||
{
|
{
|
||||||
cell.stackTagCompound = new NBTTagCompound();
|
cell.setTagCompound(new NBTTagCompound());
|
||||||
cell.stackTagCompound.setTag(CellStorage.NBT_ITEMS, new NBTTagList());
|
|
||||||
cell.stackTagCompound.setInteger(CellStorage.NBT_STORED, 0);
|
cell.getTagCompound().setTag(CellStorage.NBT_ITEMS, new NBTTagList());
|
||||||
|
cell.getTagCompound().setInteger(CellStorage.NBT_STORED, 0);
|
||||||
|
|
||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getStored(ItemStack cell)
|
public static int getStored(ItemStack cell)
|
||||||
{
|
{
|
||||||
return cell.stackTagCompound.getInteger(CellStorage.NBT_STORED);
|
return cell.getTagCompound().getInteger(CellStorage.NBT_STORED);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getCapacity(ItemStack cell)
|
public static int getCapacity(ItemStack cell)
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
package storagecraft.item;
|
package storagecraft.item;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
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;
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
|
|
||||||
public class ItemStoragePart extends ItemBase
|
public class ItemStoragePart extends ItemBase
|
||||||
{
|
{
|
||||||
@@ -14,8 +12,6 @@ public class ItemStoragePart extends ItemBase
|
|||||||
public static final int TYPE_16K = 2;
|
public static final int TYPE_16K = 2;
|
||||||
public static final int TYPE_64K = 3;
|
public static final int TYPE_64K = 3;
|
||||||
|
|
||||||
private IIcon[] icons = new IIcon[4];
|
|
||||||
|
|
||||||
public ItemStoragePart()
|
public ItemStoragePart()
|
||||||
{
|
{
|
||||||
super("storagePart");
|
super("storagePart");
|
||||||
@@ -32,19 +28,4 @@ public class ItemStoragePart extends ItemBase
|
|||||||
list.add(new ItemStack(item, 1, i));
|
list.add(new ItemStack(item, 1, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerIcons(IIconRegister register)
|
|
||||||
{
|
|
||||||
for (int i = 0; i <= 3; ++i)
|
|
||||||
{
|
|
||||||
icons[i] = register.registerIcon("storagecraft:storagePart" + i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIconFromDamage(int damage)
|
|
||||||
{
|
|
||||||
return icons[damage];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
package storagecraft.item;
|
package storagecraft.item;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.util.ChatComponentText;
|
import net.minecraft.util.ChatComponentText;
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import net.minecraft.util.StatCollector;
|
import net.minecraft.util.StatCollector;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import storagecraft.StorageCraft;
|
import storagecraft.StorageCraft;
|
||||||
@@ -22,9 +21,6 @@ public class ItemWirelessGrid extends ItemBase
|
|||||||
public static final String NBT_WIRELESS_TRANSMITTER_Y = "WirelessTransmitterY";
|
public static final String NBT_WIRELESS_TRANSMITTER_Y = "WirelessTransmitterY";
|
||||||
public static final String NBT_WIRELESS_TRANSMITTER_Z = "WirelessTransmitterZ";
|
public static final String NBT_WIRELESS_TRANSMITTER_Z = "WirelessTransmitterZ";
|
||||||
|
|
||||||
private IIcon iconConnected;
|
|
||||||
private IIcon iconDisconnected;
|
|
||||||
|
|
||||||
public ItemWirelessGrid()
|
public ItemWirelessGrid()
|
||||||
{
|
{
|
||||||
super("wirelessGrid");
|
super("wirelessGrid");
|
||||||
@@ -65,7 +61,7 @@ public class ItemWirelessGrid extends ItemBase
|
|||||||
int y = getY(stack);
|
int y = getY(stack);
|
||||||
int z = getZ(stack);
|
int z = getZ(stack);
|
||||||
|
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
|
||||||
|
|
||||||
if (tile instanceof TileWirelessTransmitter)
|
if (tile instanceof TileWirelessTransmitter)
|
||||||
{
|
{
|
||||||
@@ -81,7 +77,7 @@ public class ItemWirelessGrid extends ItemBase
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.openGui(StorageCraft.INSTANCE, StorageCraftGUI.GRID, world, grid.xCoord, grid.yCoord, grid.zCoord);
|
player.openGui(StorageCraft.INSTANCE, StorageCraftGUI.GRID, world, grid.getPos().getX(), grid.getPos().getY(), grid.getPos().getZ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -115,17 +111,17 @@ public class ItemWirelessGrid extends ItemBase
|
|||||||
|
|
||||||
public int getX(ItemStack stack)
|
public int getX(ItemStack stack)
|
||||||
{
|
{
|
||||||
return stack.stackTagCompound.getInteger(NBT_WIRELESS_TRANSMITTER_X);
|
return stack.getTagCompound().getInteger(NBT_WIRELESS_TRANSMITTER_X);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getY(ItemStack stack)
|
public int getY(ItemStack stack)
|
||||||
{
|
{
|
||||||
return stack.stackTagCompound.getInteger(NBT_WIRELESS_TRANSMITTER_Y);
|
return stack.getTagCompound().getInteger(NBT_WIRELESS_TRANSMITTER_Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getZ(ItemStack stack)
|
public int getZ(ItemStack stack)
|
||||||
{
|
{
|
||||||
return stack.stackTagCompound.getInteger(NBT_WIRELESS_TRANSMITTER_Z);
|
return stack.getTagCompound().getInteger(NBT_WIRELESS_TRANSMITTER_Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInRange(ItemStack stack, EntityPlayer player)
|
public boolean isInRange(ItemStack stack, EntityPlayer player)
|
||||||
@@ -135,25 +131,6 @@ public class ItemWirelessGrid extends ItemBase
|
|||||||
|
|
||||||
public boolean isValid(ItemStack stack)
|
public boolean isValid(ItemStack stack)
|
||||||
{
|
{
|
||||||
return stack.stackTagCompound != null && stack.stackTagCompound.hasKey(NBT_WIRELESS_TRANSMITTER_X) && stack.stackTagCompound.hasKey(NBT_WIRELESS_TRANSMITTER_Y) && stack.stackTagCompound.hasKey(NBT_WIRELESS_TRANSMITTER_Z);
|
return stack.hasTagCompound() && stack.getTagCompound().hasKey(NBT_WIRELESS_TRANSMITTER_X) && stack.getTagCompound().hasKey(NBT_WIRELESS_TRANSMITTER_Y) && stack.getTagCompound().hasKey(NBT_WIRELESS_TRANSMITTER_Z);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerIcons(IIconRegister register)
|
|
||||||
{
|
|
||||||
iconConnected = register.registerIcon("storagecraft:wirelessGridConnected");
|
|
||||||
iconDisconnected = register.registerIcon("storagecraft:wirelessGridDisconnected");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(ItemStack stack, int pass)
|
|
||||||
{
|
|
||||||
return getIconIndex(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIconIndex(ItemStack stack)
|
|
||||||
{
|
|
||||||
return isValid(stack) ? iconConnected : iconDisconnected;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
package storagecraft.network;
|
package storagecraft.network;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||||
import storagecraft.tile.ICompareSetting;
|
import storagecraft.tile.ICompareSetting;
|
||||||
|
|
||||||
public class MessageCompareUpdate implements IMessage, IMessageHandler<MessageCompareUpdate, IMessage>
|
public class MessageCompareUpdate implements IMessage, IMessageHandler<MessageCompareUpdate, IMessage>
|
||||||
@@ -21,9 +22,9 @@ public class MessageCompareUpdate implements IMessage, IMessageHandler<MessageCo
|
|||||||
|
|
||||||
public MessageCompareUpdate(ICompareSetting setting, int compare)
|
public MessageCompareUpdate(ICompareSetting setting, int compare)
|
||||||
{
|
{
|
||||||
this.x = setting.getX();
|
this.x = setting.getPos().getX();
|
||||||
this.y = setting.getY();
|
this.y = setting.getPos().getY();
|
||||||
this.z = setting.getZ();
|
this.z = setting.getPos().getZ();
|
||||||
this.compare = compare;
|
this.compare = compare;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +51,7 @@ public class MessageCompareUpdate implements IMessage, IMessageHandler<MessageCo
|
|||||||
{
|
{
|
||||||
EntityPlayerMP player = context.getServerHandler().playerEntity;
|
EntityPlayerMP player = context.getServerHandler().playerEntity;
|
||||||
|
|
||||||
TileEntity tile = player.worldObj.getTileEntity(message.x, message.y, message.z);
|
TileEntity tile = player.worldObj.getTileEntity(new BlockPos(message.x, message.y, message.z));
|
||||||
|
|
||||||
if (tile instanceof ICompareSetting)
|
if (tile instanceof ICompareSetting)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
package storagecraft.network;
|
package storagecraft.network;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||||
import storagecraft.tile.TileDetector;
|
import storagecraft.tile.TileDetector;
|
||||||
|
|
||||||
public class MessageDetectorAmountUpdate implements IMessage, IMessageHandler<MessageDetectorAmountUpdate, IMessage>
|
public class MessageDetectorAmountUpdate implements IMessage, IMessageHandler<MessageDetectorAmountUpdate, IMessage>
|
||||||
@@ -21,9 +22,9 @@ public class MessageDetectorAmountUpdate implements IMessage, IMessageHandler<Me
|
|||||||
|
|
||||||
public MessageDetectorAmountUpdate(TileDetector detector, int amount)
|
public MessageDetectorAmountUpdate(TileDetector detector, int amount)
|
||||||
{
|
{
|
||||||
this.x = detector.xCoord;
|
this.x = detector.getPos().getX();
|
||||||
this.y = detector.yCoord;
|
this.y = detector.getPos().getY();
|
||||||
this.z = detector.zCoord;
|
this.z = detector.getPos().getZ();
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +51,7 @@ public class MessageDetectorAmountUpdate implements IMessage, IMessageHandler<Me
|
|||||||
{
|
{
|
||||||
EntityPlayerMP player = context.getServerHandler().playerEntity;
|
EntityPlayerMP player = context.getServerHandler().playerEntity;
|
||||||
|
|
||||||
TileEntity tile = player.worldObj.getTileEntity(message.x, message.y, message.z);
|
TileEntity tile = player.worldObj.getTileEntity(new BlockPos(message.x, message.y, message.z));
|
||||||
|
|
||||||
if (tile instanceof TileDetector && message.amount >= 0)
|
if (tile instanceof TileDetector && message.amount >= 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
package storagecraft.network;
|
package storagecraft.network;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||||
import storagecraft.tile.TileDetector;
|
import storagecraft.tile.TileDetector;
|
||||||
|
|
||||||
public class MessageDetectorModeUpdate implements IMessage, IMessageHandler<MessageDetectorModeUpdate, IMessage>
|
public class MessageDetectorModeUpdate implements IMessage, IMessageHandler<MessageDetectorModeUpdate, IMessage>
|
||||||
@@ -20,9 +21,9 @@ public class MessageDetectorModeUpdate implements IMessage, IMessageHandler<Mess
|
|||||||
|
|
||||||
public MessageDetectorModeUpdate(TileDetector detector)
|
public MessageDetectorModeUpdate(TileDetector detector)
|
||||||
{
|
{
|
||||||
this.x = detector.xCoord;
|
this.x = detector.getPos().getX();
|
||||||
this.y = detector.yCoord;
|
this.y = detector.getPos().getY();
|
||||||
this.z = detector.zCoord;
|
this.z = detector.getPos().getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -46,7 +47,7 @@ public class MessageDetectorModeUpdate implements IMessage, IMessageHandler<Mess
|
|||||||
{
|
{
|
||||||
EntityPlayerMP player = context.getServerHandler().playerEntity;
|
EntityPlayerMP player = context.getServerHandler().playerEntity;
|
||||||
|
|
||||||
TileEntity tile = player.worldObj.getTileEntity(message.x, message.y, message.z);
|
TileEntity tile = player.worldObj.getTileEntity(new BlockPos(message.x, message.y, message.z));
|
||||||
|
|
||||||
if (tile instanceof TileDetector)
|
if (tile instanceof TileDetector)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
package storagecraft.network;
|
package storagecraft.network;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||||
import storagecraft.tile.TileGrid;
|
import storagecraft.tile.TileGrid;
|
||||||
|
|
||||||
public class MessageGridCraftingClear implements IMessage, IMessageHandler<MessageGridCraftingClear, IMessage>
|
public class MessageGridCraftingClear implements IMessage, IMessageHandler<MessageGridCraftingClear, IMessage>
|
||||||
@@ -21,9 +22,9 @@ public class MessageGridCraftingClear implements IMessage, IMessageHandler<Messa
|
|||||||
|
|
||||||
public MessageGridCraftingClear(TileGrid grid)
|
public MessageGridCraftingClear(TileGrid grid)
|
||||||
{
|
{
|
||||||
this.x = grid.xCoord;
|
this.x = grid.getPos().getX();
|
||||||
this.y = grid.yCoord;
|
this.y = grid.getPos().getY();
|
||||||
this.z = grid.zCoord;
|
this.z = grid.getPos().getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -47,7 +48,7 @@ public class MessageGridCraftingClear implements IMessage, IMessageHandler<Messa
|
|||||||
{
|
{
|
||||||
EntityPlayerMP player = context.getServerHandler().playerEntity;
|
EntityPlayerMP player = context.getServerHandler().playerEntity;
|
||||||
|
|
||||||
TileEntity tile = player.worldObj.getTileEntity(message.x, message.y, message.z);
|
TileEntity tile = player.worldObj.getTileEntity(new BlockPos(message.x, message.y, message.z));
|
||||||
|
|
||||||
if (tile instanceof TileGrid)
|
if (tile instanceof TileGrid)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
package storagecraft.network;
|
package storagecraft.network;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraftforge.fml.common.network.ByteBufUtils;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||||
import storagecraft.tile.TileGrid;
|
import storagecraft.tile.TileGrid;
|
||||||
|
|
||||||
public class MessageGridCraftingUpdate implements IMessage, IMessageHandler<MessageGridCraftingUpdate, IMessage>
|
public class MessageGridCraftingUpdate implements IMessage, IMessageHandler<MessageGridCraftingUpdate, IMessage>
|
||||||
@@ -23,9 +24,9 @@ public class MessageGridCraftingUpdate implements IMessage, IMessageHandler<Mess
|
|||||||
|
|
||||||
public MessageGridCraftingUpdate(TileGrid grid)
|
public MessageGridCraftingUpdate(TileGrid grid)
|
||||||
{
|
{
|
||||||
this.x = grid.xCoord;
|
this.x = grid.getPos().getX();
|
||||||
this.y = grid.yCoord;
|
this.y = grid.getPos().getY();
|
||||||
this.z = grid.zCoord;
|
this.z = grid.getPos().getZ();
|
||||||
|
|
||||||
for (int i = 0; i < 9; ++i)
|
for (int i = 0; i < 9; ++i)
|
||||||
{
|
{
|
||||||
@@ -62,7 +63,7 @@ public class MessageGridCraftingUpdate implements IMessage, IMessageHandler<Mess
|
|||||||
@Override
|
@Override
|
||||||
public IMessage onMessage(MessageGridCraftingUpdate message, MessageContext context)
|
public IMessage onMessage(MessageGridCraftingUpdate message, MessageContext context)
|
||||||
{
|
{
|
||||||
TileEntity tile = Minecraft.getMinecraft().theWorld.getTileEntity(message.x, message.y, message.z);
|
TileEntity tile = Minecraft.getMinecraft().theWorld.getTileEntity(new BlockPos(message.x, message.y, message.z));
|
||||||
|
|
||||||
if (tile instanceof TileGrid)
|
if (tile instanceof TileGrid)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
package storagecraft.network;
|
package storagecraft.network;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||||
import storagecraft.tile.TileImporter;
|
import storagecraft.tile.TileImporter;
|
||||||
|
|
||||||
public class MessageImporterModeUpdate implements IMessage, IMessageHandler<MessageImporterModeUpdate, IMessage>
|
public class MessageImporterModeUpdate implements IMessage, IMessageHandler<MessageImporterModeUpdate, IMessage>
|
||||||
@@ -20,9 +21,9 @@ public class MessageImporterModeUpdate implements IMessage, IMessageHandler<Mess
|
|||||||
|
|
||||||
public MessageImporterModeUpdate(TileImporter importer)
|
public MessageImporterModeUpdate(TileImporter importer)
|
||||||
{
|
{
|
||||||
this.x = importer.xCoord;
|
this.x = importer.getPos().getX();
|
||||||
this.y = importer.yCoord;
|
this.y = importer.getPos().getY();
|
||||||
this.z = importer.zCoord;
|
this.z = importer.getPos().getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -46,7 +47,7 @@ public class MessageImporterModeUpdate implements IMessage, IMessageHandler<Mess
|
|||||||
{
|
{
|
||||||
EntityPlayerMP player = context.getServerHandler().playerEntity;
|
EntityPlayerMP player = context.getServerHandler().playerEntity;
|
||||||
|
|
||||||
TileEntity tile = player.worldObj.getTileEntity(message.x, message.y, message.z);
|
TileEntity tile = player.worldObj.getTileEntity(new BlockPos(message.x, message.y, message.z));
|
||||||
|
|
||||||
if (tile instanceof TileImporter)
|
if (tile instanceof TileImporter)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
package storagecraft.network;
|
package storagecraft.network;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||||
import storagecraft.tile.IRedstoneModeSetting;
|
import storagecraft.tile.IRedstoneModeSetting;
|
||||||
|
|
||||||
public class MessageRedstoneModeUpdate implements IMessage, IMessageHandler<MessageRedstoneModeUpdate, IMessage>
|
public class MessageRedstoneModeUpdate implements IMessage, IMessageHandler<MessageRedstoneModeUpdate, IMessage>
|
||||||
@@ -20,9 +21,9 @@ public class MessageRedstoneModeUpdate implements IMessage, IMessageHandler<Mess
|
|||||||
|
|
||||||
public MessageRedstoneModeUpdate(IRedstoneModeSetting setting)
|
public MessageRedstoneModeUpdate(IRedstoneModeSetting setting)
|
||||||
{
|
{
|
||||||
this.x = setting.getX();
|
this.x = setting.getPos().getX();
|
||||||
this.y = setting.getY();
|
this.y = setting.getPos().getY();
|
||||||
this.z = setting.getZ();
|
this.z = setting.getPos().getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -46,7 +47,7 @@ public class MessageRedstoneModeUpdate implements IMessage, IMessageHandler<Mess
|
|||||||
{
|
{
|
||||||
EntityPlayerMP player = context.getServerHandler().playerEntity;
|
EntityPlayerMP player = context.getServerHandler().playerEntity;
|
||||||
|
|
||||||
TileEntity tile = player.worldObj.getTileEntity(message.x, message.y, message.z);
|
TileEntity tile = player.worldObj.getTileEntity(new BlockPos(message.x, message.y, message.z));
|
||||||
|
|
||||||
if (tile instanceof IRedstoneModeSetting)
|
if (tile instanceof IRedstoneModeSetting)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
package storagecraft.network;
|
package storagecraft.network;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||||
import storagecraft.storage.StorageItem;
|
import storagecraft.storage.StorageItem;
|
||||||
import storagecraft.tile.TileController;
|
import storagecraft.tile.TileController;
|
||||||
|
|
||||||
@@ -60,7 +61,7 @@ public class MessageStoragePull implements IMessage, IMessageHandler<MessageStor
|
|||||||
{
|
{
|
||||||
EntityPlayerMP player = context.getServerHandler().playerEntity;
|
EntityPlayerMP player = context.getServerHandler().playerEntity;
|
||||||
|
|
||||||
TileEntity tile = player.worldObj.getTileEntity(message.x, message.y, message.z);
|
TileEntity tile = player.worldObj.getTileEntity(new BlockPos(message.x, message.y, message.z));
|
||||||
|
|
||||||
if (tile instanceof TileController)
|
if (tile instanceof TileController)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
package storagecraft.network;
|
package storagecraft.network;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||||
import storagecraft.tile.TileController;
|
import storagecraft.tile.TileController;
|
||||||
|
|
||||||
public class MessageStoragePush implements IMessage, IMessageHandler<MessageStoragePush, IMessage>
|
public class MessageStoragePush implements IMessage, IMessageHandler<MessageStoragePush, IMessage>
|
||||||
@@ -55,7 +56,7 @@ public class MessageStoragePush implements IMessage, IMessageHandler<MessageStor
|
|||||||
{
|
{
|
||||||
EntityPlayerMP player = context.getServerHandler().playerEntity;
|
EntityPlayerMP player = context.getServerHandler().playerEntity;
|
||||||
|
|
||||||
TileEntity tile = player.worldObj.getTileEntity(message.x, message.y, message.z);
|
TileEntity tile = player.worldObj.getTileEntity(new BlockPos(message.x, message.y, message.z));
|
||||||
|
|
||||||
if (tile instanceof TileController)
|
if (tile instanceof TileController)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
package storagecraft.network;
|
package storagecraft.network;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||||
|
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||||
import storagecraft.tile.INetworkTile;
|
import storagecraft.tile.INetworkTile;
|
||||||
|
|
||||||
public class MessageTileUpdate implements IMessage, IMessageHandler<MessageTileUpdate, IMessage>
|
public class MessageTileUpdate implements IMessage, IMessageHandler<MessageTileUpdate, IMessage>
|
||||||
@@ -33,7 +34,7 @@ public class MessageTileUpdate implements IMessage, IMessageHandler<MessageTileU
|
|||||||
|
|
||||||
if (Minecraft.getMinecraft().theWorld != null)
|
if (Minecraft.getMinecraft().theWorld != null)
|
||||||
{
|
{
|
||||||
tile = Minecraft.getMinecraft().theWorld.getTileEntity(x, y, z);
|
tile = Minecraft.getMinecraft().theWorld.getTileEntity(new BlockPos(x, y, z));
|
||||||
|
|
||||||
if (tile instanceof INetworkTile)
|
if (tile instanceof INetworkTile)
|
||||||
{
|
{
|
||||||
@@ -45,9 +46,9 @@ public class MessageTileUpdate implements IMessage, IMessageHandler<MessageTileU
|
|||||||
@Override
|
@Override
|
||||||
public void toBytes(ByteBuf buf)
|
public void toBytes(ByteBuf buf)
|
||||||
{
|
{
|
||||||
buf.writeInt(tile.xCoord);
|
buf.writeInt(tile.getPos().getX());
|
||||||
buf.writeInt(tile.yCoord);
|
buf.writeInt(tile.getPos().getY());
|
||||||
buf.writeInt(tile.zCoord);
|
buf.writeInt(tile.getPos().getZ());
|
||||||
|
|
||||||
if (tile instanceof INetworkTile)
|
if (tile instanceof INetworkTile)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package storagecraft.proxy;
|
package storagecraft.proxy;
|
||||||
|
|
||||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
|
||||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraftforge.client.MinecraftForgeClient;
|
import net.minecraftforge.client.MinecraftForgeClient;
|
||||||
|
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||||
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
import storagecraft.StorageCraftBlocks;
|
import storagecraft.StorageCraftBlocks;
|
||||||
import storagecraft.render.BlockCableRenderer;
|
import storagecraft.render.BlockCableRenderer;
|
||||||
import storagecraft.render.ItemCableRenderer;
|
import storagecraft.render.ItemCableRenderer;
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
package storagecraft.proxy;
|
package storagecraft.proxy;
|
||||||
|
|
||||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
|
||||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
|
||||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||||
|
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||||
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||||
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import storagecraft.StorageCraft;
|
import storagecraft.StorageCraft;
|
||||||
import storagecraft.StorageCraftBlocks;
|
import storagecraft.StorageCraftBlocks;
|
||||||
import storagecraft.StorageCraftItems;
|
import storagecraft.StorageCraftItems;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ public class BlockCableRenderer extends TileEntitySpecialRenderer
|
|||||||
public static final CableModel CABLE_MODEL = new CableModel();
|
public static final CableModel CABLE_MODEL = new CableModel();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float scale)
|
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float scale, int a) // @TODO: Find out what a is
|
||||||
{
|
{
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import net.minecraft.client.Minecraft;
|
|||||||
import net.minecraft.client.model.ModelBase;
|
import net.minecraft.client.model.ModelBase;
|
||||||
import net.minecraft.client.model.ModelRenderer;
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
import storagecraft.tile.TileCable;
|
import storagecraft.tile.TileCable;
|
||||||
|
|
||||||
public class CableModel extends ModelBase
|
public class CableModel extends ModelBase
|
||||||
@@ -100,32 +100,32 @@ public class CableModel extends ModelBase
|
|||||||
Minecraft.getMinecraft().renderEngine.bindTexture(CABLE_RESOURCE);
|
Minecraft.getMinecraft().renderEngine.bindTexture(CABLE_RESOURCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cable.hasConnection(ForgeDirection.UP))
|
if (cable.hasConnection(EnumFacing.UP))
|
||||||
{
|
{
|
||||||
up.render(x);
|
up.render(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cable.hasConnection(ForgeDirection.DOWN))
|
if (cable.hasConnection(EnumFacing.DOWN))
|
||||||
{
|
{
|
||||||
down.render(x);
|
down.render(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cable.hasConnection(ForgeDirection.NORTH))
|
if (cable.hasConnection(EnumFacing.NORTH))
|
||||||
{
|
{
|
||||||
north.render(x);
|
north.render(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cable.hasConnection(ForgeDirection.EAST))
|
if (cable.hasConnection(EnumFacing.EAST))
|
||||||
{
|
{
|
||||||
east.render(x);
|
east.render(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cable.hasConnection(ForgeDirection.SOUTH))
|
if (cable.hasConnection(EnumFacing.SOUTH))
|
||||||
{
|
{
|
||||||
south.render(x);
|
south.render(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cable.hasConnection(ForgeDirection.WEST))
|
if (cable.hasConnection(EnumFacing.WEST))
|
||||||
{
|
{
|
||||||
west.render(x);
|
west.render(x);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class CellStorage implements IStorage
|
|||||||
@Override
|
@Override
|
||||||
public void addItems(List<StorageItem> items)
|
public void addItems(List<StorageItem> items)
|
||||||
{
|
{
|
||||||
NBTTagList list = (NBTTagList) cell.stackTagCompound.getTag(NBT_ITEMS);
|
NBTTagList list = (NBTTagList) cell.getTagCompound().getTag(NBT_ITEMS);
|
||||||
|
|
||||||
for (int i = 0; i < list.tagCount(); ++i)
|
for (int i = 0; i < list.tagCount(); ++i)
|
||||||
{
|
{
|
||||||
@@ -38,9 +38,9 @@ public class CellStorage implements IStorage
|
|||||||
@Override
|
@Override
|
||||||
public void push(ItemStack stack)
|
public void push(ItemStack stack)
|
||||||
{
|
{
|
||||||
NBTTagList list = (NBTTagList) cell.stackTagCompound.getTag(NBT_ITEMS);
|
NBTTagList list = (NBTTagList) cell.getTagCompound().getTag(NBT_ITEMS);
|
||||||
|
|
||||||
cell.stackTagCompound.setInteger(NBT_STORED, ItemStorageCell.getStored(cell) + stack.stackSize);
|
cell.getTagCompound().setInteger(NBT_STORED, ItemStorageCell.getStored(cell) + stack.stackSize);
|
||||||
|
|
||||||
for (int i = 0; i < list.tagCount(); ++i)
|
for (int i = 0; i < list.tagCount(); ++i)
|
||||||
{
|
{
|
||||||
@@ -62,9 +62,9 @@ public class CellStorage implements IStorage
|
|||||||
tag.setInteger(NBT_ITEM_QUANTITY, stack.stackSize);
|
tag.setInteger(NBT_ITEM_QUANTITY, stack.stackSize);
|
||||||
tag.setInteger(NBT_ITEM_DAMAGE, stack.getItemDamage());
|
tag.setInteger(NBT_ITEM_DAMAGE, stack.getItemDamage());
|
||||||
|
|
||||||
if (stack.stackTagCompound != null)
|
if (stack.hasTagCompound())
|
||||||
{
|
{
|
||||||
tag.setTag(NBT_ITEM_NBT, stack.stackTagCompound);
|
tag.setTag(NBT_ITEM_NBT, stack.getTagCompound());
|
||||||
}
|
}
|
||||||
|
|
||||||
list.appendTag(tag);
|
list.appendTag(tag);
|
||||||
@@ -75,7 +75,7 @@ public class CellStorage implements IStorage
|
|||||||
{
|
{
|
||||||
int quantity = stack.stackSize;
|
int quantity = stack.stackSize;
|
||||||
|
|
||||||
NBTTagList list = (NBTTagList) cell.stackTagCompound.getTag(NBT_ITEMS);
|
NBTTagList list = (NBTTagList) cell.getTagCompound().getTag(NBT_ITEMS);
|
||||||
|
|
||||||
for (int i = 0; i < list.tagCount(); ++i)
|
for (int i = 0; i < list.tagCount(); ++i)
|
||||||
{
|
{
|
||||||
@@ -97,7 +97,7 @@ public class CellStorage implements IStorage
|
|||||||
list.removeTag(i);
|
list.removeTag(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
cell.stackTagCompound.setInteger(NBT_STORED, ItemStorageCell.getStored(cell) - quantity);
|
cell.getTagCompound().setInteger(NBT_STORED, ItemStorageCell.getStored(cell) - quantity);
|
||||||
|
|
||||||
ItemStack newItem = item.toItemStack();
|
ItemStack newItem = item.toItemStack();
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
package storagecraft.storage;
|
package storagecraft.storage;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraftforge.fml.common.network.ByteBufUtils;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import storagecraft.util.InventoryUtils;
|
import storagecraft.util.InventoryUtils;
|
||||||
|
|
||||||
public class StorageItem
|
public class StorageItem
|
||||||
@@ -44,7 +44,7 @@ public class StorageItem
|
|||||||
|
|
||||||
public StorageItem(ItemStack stack)
|
public StorageItem(ItemStack stack)
|
||||||
{
|
{
|
||||||
this(stack.getItem(), stack.stackSize, stack.getItemDamage(), stack.stackTagCompound);
|
this(stack.getItem(), stack.stackSize, stack.getItemDamage(), stack.getTagCompound());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void toBytes(ByteBuf buf, int id)
|
public void toBytes(ByteBuf buf, int id)
|
||||||
@@ -116,7 +116,7 @@ public class StorageItem
|
|||||||
{
|
{
|
||||||
ItemStack stack = new ItemStack(type, quantity, damage);
|
ItemStack stack = new ItemStack(type, quantity, damage);
|
||||||
|
|
||||||
stack.stackTagCompound = tag;
|
stack.setTagCompound(tag);
|
||||||
|
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
@@ -162,7 +162,7 @@ public class StorageItem
|
|||||||
|
|
||||||
if ((flags & InventoryUtils.COMPARE_NBT) == InventoryUtils.COMPARE_NBT)
|
if ((flags & InventoryUtils.COMPARE_NBT) == InventoryUtils.COMPARE_NBT)
|
||||||
{
|
{
|
||||||
if (tag != null && !tag.equals(stack.stackTagCompound))
|
if (tag != null && !tag.equals(stack.getTagCompound()))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
package storagecraft.tile;
|
package storagecraft.tile;
|
||||||
|
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
|
||||||
public interface ICompareSetting
|
public interface ICompareSetting
|
||||||
{
|
{
|
||||||
public int getCompare();
|
public int getCompare();
|
||||||
|
|
||||||
public void setCompare(int compare);
|
public void setCompare(int compare);
|
||||||
|
|
||||||
public int getX();
|
public BlockPos getPos();
|
||||||
|
|
||||||
public int getY();
|
|
||||||
|
|
||||||
public int getZ();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package storagecraft.tile;
|
package storagecraft.tile;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
|
||||||
public interface INetworkTile
|
public interface INetworkTile
|
||||||
{
|
{
|
||||||
@@ -8,9 +9,5 @@ public interface INetworkTile
|
|||||||
|
|
||||||
public void toBytes(ByteBuf buf);
|
public void toBytes(ByteBuf buf);
|
||||||
|
|
||||||
public int getX();
|
public BlockPos getPos();
|
||||||
|
|
||||||
public int getY();
|
|
||||||
|
|
||||||
public int getZ();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
package storagecraft.tile;
|
package storagecraft.tile;
|
||||||
|
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
|
||||||
public interface IRedstoneModeSetting
|
public interface IRedstoneModeSetting
|
||||||
{
|
{
|
||||||
public RedstoneMode getRedstoneMode();
|
public RedstoneMode getRedstoneMode();
|
||||||
|
|
||||||
public void setRedstoneMode(RedstoneMode mode);
|
public void setRedstoneMode(RedstoneMode mode);
|
||||||
|
|
||||||
public int getX();
|
public BlockPos getPos();
|
||||||
|
|
||||||
public int getY();
|
|
||||||
|
|
||||||
public int getZ();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package storagecraft.tile;
|
package storagecraft.tile;
|
||||||
|
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public enum RedstoneMode
|
public enum RedstoneMode
|
||||||
@@ -29,16 +30,16 @@ public enum RedstoneMode
|
|||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEnabled(World world, int x, int y, int z)
|
public boolean isEnabled(World world, BlockPos pos)
|
||||||
{
|
{
|
||||||
switch (this)
|
switch (this)
|
||||||
{
|
{
|
||||||
case IGNORE:
|
case IGNORE:
|
||||||
return true;
|
return true;
|
||||||
case HIGH:
|
case HIGH:
|
||||||
return world.isBlockIndirectlyGettingPowered(x, y, z);
|
return true; // @TODO: ...
|
||||||
case LOW:
|
case LOW:
|
||||||
return !world.isBlockIndirectlyGettingPowered(x, y, z);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1,48 +1,47 @@
|
|||||||
package storagecraft.tile;
|
package storagecraft.tile;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.network.NetworkManager;
|
import net.minecraft.network.NetworkManager;
|
||||||
import net.minecraft.network.Packet;
|
import net.minecraft.network.Packet;
|
||||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||||
|
import net.minecraft.server.gui.IUpdatePlayerListBox;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
import storagecraft.StorageCraft;
|
import storagecraft.StorageCraft;
|
||||||
import storagecraft.network.MessageTileUpdate;
|
import storagecraft.network.MessageTileUpdate;
|
||||||
|
|
||||||
public abstract class TileBase extends TileEntity
|
public abstract class TileBase extends TileEntity implements IUpdatePlayerListBox
|
||||||
{
|
{
|
||||||
public static final int UPDATE_RANGE = 256;
|
public static final int UPDATE_RANGE = 256;
|
||||||
|
|
||||||
private ForgeDirection direction = ForgeDirection.UNKNOWN;
|
private EnumFacing direction;
|
||||||
|
|
||||||
protected int ticks;
|
protected int ticks;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void update()
|
||||||
{
|
{
|
||||||
super.updateEntity();
|
|
||||||
|
|
||||||
ticks++;
|
ticks++;
|
||||||
|
|
||||||
if (!worldObj.isRemote)
|
if (!worldObj.isRemote)
|
||||||
{
|
{
|
||||||
if (this instanceof INetworkTile)
|
if (this instanceof INetworkTile)
|
||||||
{
|
{
|
||||||
TargetPoint target = new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, UPDATE_RANGE);
|
TargetPoint target = new TargetPoint(worldObj.provider.getDimensionId(), pos.getX(), pos.getY(), pos.getZ(), UPDATE_RANGE);
|
||||||
|
|
||||||
StorageCraft.NETWORK.sendToAllAround(new MessageTileUpdate(this), target);
|
StorageCraft.NETWORK.sendToAllAround(new MessageTileUpdate(this), target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDirection(ForgeDirection direction)
|
public void setDirection(EnumFacing direction)
|
||||||
{
|
{
|
||||||
this.direction = direction;
|
this.direction = direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ForgeDirection getDirection()
|
public EnumFacing getDirection()
|
||||||
{
|
{
|
||||||
return direction;
|
return direction;
|
||||||
}
|
}
|
||||||
@@ -52,7 +51,7 @@ public abstract class TileBase extends TileEntity
|
|||||||
{
|
{
|
||||||
super.readFromNBT(nbt);
|
super.readFromNBT(nbt);
|
||||||
|
|
||||||
direction = ForgeDirection.getOrientation(nbt.getInteger("Direction"));
|
direction = EnumFacing.getFront(nbt.getInteger("Direction"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -70,13 +69,13 @@ public abstract class TileBase extends TileEntity
|
|||||||
|
|
||||||
nbt.setInteger("Direction", direction.ordinal());
|
nbt.setInteger("Direction", direction.ordinal());
|
||||||
|
|
||||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbt);
|
return new S35PacketUpdateTileEntity(pos, 1, nbt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
|
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
|
||||||
{
|
{
|
||||||
direction = ForgeDirection.getOrientation(packet.func_148857_g().getInteger("Direction"));
|
direction = EnumFacing.getFront(packet.getNbtCompound().getInteger("Direction"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public IInventory getDroppedInventory()
|
public IInventory getDroppedInventory()
|
||||||
|
|||||||
@@ -1,27 +1,24 @@
|
|||||||
package storagecraft.tile;
|
package storagecraft.tile;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
import storagecraft.block.BlockCable;
|
import storagecraft.block.BlockCable;
|
||||||
|
|
||||||
public class TileCable extends TileBase
|
public class TileCable extends TileBase
|
||||||
{
|
{
|
||||||
public static boolean isCable(World world, int x, int y, int z, ForgeDirection dir)
|
public static boolean isCable(World world, BlockPos pos)
|
||||||
{
|
{
|
||||||
Block block = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
|
return world.getBlockState(pos).getBlock() instanceof BlockCable;
|
||||||
|
|
||||||
return block instanceof BlockCable;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasConnection(ForgeDirection dir)
|
public boolean hasConnection(EnumFacing dir)
|
||||||
{
|
{
|
||||||
if (!isCable(worldObj, xCoord, yCoord, zCoord, dir))
|
if (!isCable(worldObj, pos.offset(dir)))
|
||||||
{
|
{
|
||||||
TileEntity tile = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
|
TileEntity tile = worldObj.getTileEntity(pos.offset(dir));
|
||||||
|
|
||||||
return tile instanceof TileMachine || tile instanceof TileController;
|
return tile instanceof TileMachine || tile instanceof TileController;
|
||||||
}
|
}
|
||||||
@@ -31,12 +28,14 @@ public class TileCable extends TileBase
|
|||||||
|
|
||||||
public boolean isPowered()
|
public boolean isPowered()
|
||||||
{
|
{
|
||||||
return worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord);
|
// @TODO: return worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSensitiveCable()
|
public boolean isSensitiveCable()
|
||||||
{
|
{
|
||||||
return worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 1;
|
// @TODO: return worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 1;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEnabled()
|
public boolean isEnabled()
|
||||||
@@ -49,29 +48,27 @@ public class TileCable extends TileBase
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addMachines(List<Vec3> visited, List<TileMachine> machines, TileController controller)
|
public void addMachines(List<BlockPos> visited, List<TileMachine> machines, TileController controller)
|
||||||
{
|
{
|
||||||
for (Vec3 visitedBlock : visited)
|
for (BlockPos visitedBlock : visited)
|
||||||
{
|
{
|
||||||
if (visitedBlock.xCoord == xCoord && visitedBlock.yCoord == yCoord && visitedBlock.zCoord == zCoord)
|
if (visitedBlock.equals(pos))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
visited.add(Vec3.createVectorHelper(xCoord, yCoord, zCoord));
|
visited.add(pos);
|
||||||
|
|
||||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
for (EnumFacing dir : EnumFacing.VALUES)
|
||||||
{
|
{
|
||||||
int x = xCoord + dir.offsetX;
|
BlockPos newPos = pos.offset(dir);
|
||||||
int y = yCoord + dir.offsetY;
|
|
||||||
int z = zCoord + dir.offsetZ;
|
|
||||||
|
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
|
|
||||||
for (Vec3 visitedBlock : visited)
|
for (BlockPos visitedBlock : visited)
|
||||||
{
|
{
|
||||||
if (visitedBlock.xCoord == x && visitedBlock.yCoord == y && visitedBlock.zCoord == z)
|
if (visitedBlock.equals(newPos))
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
@@ -82,21 +79,21 @@ public class TileCable extends TileBase
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
TileEntity tile = worldObj.getTileEntity(x, y, z);
|
TileEntity tile = worldObj.getTileEntity(newPos);
|
||||||
|
|
||||||
if (tile instanceof TileMachine && ((TileMachine) tile).getRedstoneMode().isEnabled(worldObj, x, y, z))
|
if (tile instanceof TileMachine && ((TileMachine) tile).getRedstoneMode().isEnabled(worldObj, newPos))
|
||||||
{
|
{
|
||||||
machines.add((TileMachine) tile);
|
machines.add((TileMachine) tile);
|
||||||
|
|
||||||
visited.add(Vec3.createVectorHelper(x, y, z));
|
visited.add(newPos);
|
||||||
}
|
}
|
||||||
else if (tile instanceof TileCable && ((TileCable) tile).isEnabled())
|
else if (tile instanceof TileCable && ((TileCable) tile).isEnabled())
|
||||||
{
|
{
|
||||||
((TileCable) tile).addMachines(visited, machines, controller);
|
((TileCable) tile).addMachines(visited, machines, controller);
|
||||||
}
|
}
|
||||||
else if (tile instanceof TileController && (x != controller.xCoord || y != controller.yCoord || z != controller.zCoord))
|
else if (tile instanceof TileController && !controller.getPos().equals(newPos))
|
||||||
{
|
{
|
||||||
worldObj.createExplosion(null, x, y, z, 4.5f, true);
|
worldObj.createExplosion(null, pos.getX(), pos.getY(), pos.getZ(), 4.5f, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,14 @@ package storagecraft.tile;
|
|||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.inventory.ISidedInventory;
|
import net.minecraft.inventory.ISidedInventory;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.IChatComponent;
|
||||||
import storagecraft.inventory.InventorySimple;
|
import storagecraft.inventory.InventorySimple;
|
||||||
import storagecraft.util.InventoryUtils;
|
import storagecraft.util.InventoryUtils;
|
||||||
|
|
||||||
@@ -30,17 +32,15 @@ public class TileConstructor extends TileMachine implements IInventory, ISidedIn
|
|||||||
{
|
{
|
||||||
if (ticks % 10 == 0)
|
if (ticks % 10 == 0)
|
||||||
{
|
{
|
||||||
int frontX = xCoord + getDirection().offsetX;
|
BlockPos front = pos.offset(getDirection());
|
||||||
int frontY = yCoord + getDirection().offsetY;
|
|
||||||
int frontZ = zCoord + getDirection().offsetZ;
|
|
||||||
|
|
||||||
if (worldObj.getBlock(frontX, frontY, frontZ) == Blocks.air && inventory.getStackInSlot(0) != null)
|
if (worldObj.isAirBlock(front) && inventory.getStackInSlot(0) != null)
|
||||||
{
|
{
|
||||||
ItemStack took = getController().take(inventory.getStackInSlot(0).copy(), compare);
|
ItemStack took = getController().take(inventory.getStackInSlot(0).copy(), compare);
|
||||||
|
|
||||||
if (took != null)
|
if (took != null)
|
||||||
{
|
{
|
||||||
worldObj.setBlock(frontX, frontY, frontZ, ((ItemBlock) took.getItem()).field_150939_a, took.getItemDamage(), 1 | 2);
|
worldObj.setBlockState(front, ((ItemBlock) took.getItem()).getBlock().getDefaultState(), 1 | 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -58,98 +58,6 @@ public class TileConstructor extends TileMachine implements IInventory, ISidedIn
|
|||||||
this.compare = compare;
|
this.compare = compare;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getSizeInventory()
|
|
||||||
{
|
|
||||||
return inventory.getSizeInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getStackInSlot(int slot)
|
|
||||||
{
|
|
||||||
return inventory.getStackInSlot(slot);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack decrStackSize(int slot, int amount)
|
|
||||||
{
|
|
||||||
return inventory.decrStackSize(slot, amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getStackInSlotOnClosing(int slot)
|
|
||||||
{
|
|
||||||
return inventory.getStackInSlotOnClosing(slot);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setInventorySlotContents(int slot, ItemStack stack)
|
|
||||||
{
|
|
||||||
inventory.setInventorySlotContents(slot, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getInventoryName()
|
|
||||||
{
|
|
||||||
return inventory.getInventoryName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasCustomInventoryName()
|
|
||||||
{
|
|
||||||
return inventory.hasCustomInventoryName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getInventoryStackLimit()
|
|
||||||
{
|
|
||||||
return inventory.getInventoryStackLimit();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isUseableByPlayer(EntityPlayer player)
|
|
||||||
{
|
|
||||||
return inventory.isUseableByPlayer(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void openInventory()
|
|
||||||
{
|
|
||||||
inventory.openInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void closeInventory()
|
|
||||||
{
|
|
||||||
inventory.closeInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isItemValidForSlot(int slot, ItemStack stack)
|
|
||||||
{
|
|
||||||
return inventory.isItemValidForSlot(slot, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int[] getAccessibleSlotsFromSide(int side)
|
|
||||||
{
|
|
||||||
return new int[]
|
|
||||||
{
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canInsertItem(int slot, ItemStack stack, int side)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canExtractItem(int slot, ItemStack stack, int side)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound nbt)
|
public void readFromNBT(NBTTagCompound nbt)
|
||||||
{
|
{
|
||||||
@@ -188,4 +96,126 @@ public class TileConstructor extends TileMachine implements IInventory, ISidedIn
|
|||||||
|
|
||||||
buf.writeInt(compare);
|
buf.writeInt(compare);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSizeInventory()
|
||||||
|
{
|
||||||
|
return inventory.getSizeInventory();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getStackInSlot(int slot)
|
||||||
|
{
|
||||||
|
return inventory.getStackInSlot(slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack decrStackSize(int slot, int count)
|
||||||
|
{
|
||||||
|
return inventory.decrStackSize(slot, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getStackInSlotOnClosing(int slot)
|
||||||
|
{
|
||||||
|
return inventory.getStackInSlotOnClosing(slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInventorySlotContents(int slot, ItemStack stack)
|
||||||
|
{
|
||||||
|
inventory.setInventorySlotContents(slot, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInventoryStackLimit()
|
||||||
|
{
|
||||||
|
return inventory.getInventoryStackLimit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUseableByPlayer(EntityPlayer player)
|
||||||
|
{
|
||||||
|
return inventory.isUseableByPlayer(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void openInventory(EntityPlayer player)
|
||||||
|
{
|
||||||
|
inventory.openInventory(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void closeInventory(EntityPlayer player)
|
||||||
|
{
|
||||||
|
inventory.closeInventory(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isItemValidForSlot(int slot, ItemStack stack)
|
||||||
|
{
|
||||||
|
return inventory.isItemValidForSlot(slot, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getField(int id)
|
||||||
|
{
|
||||||
|
return inventory.getField(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setField(int id, int value)
|
||||||
|
{
|
||||||
|
inventory.setField(id, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getFieldCount()
|
||||||
|
{
|
||||||
|
return inventory.getFieldCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear()
|
||||||
|
{
|
||||||
|
inventory.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return inventory.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasCustomName()
|
||||||
|
{
|
||||||
|
return inventory.hasCustomName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IChatComponent getDisplayName()
|
||||||
|
{
|
||||||
|
return inventory.getDisplayName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int[] getSlotsForFace(EnumFacing side)
|
||||||
|
{
|
||||||
|
return new int[]
|
||||||
|
{
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing direction)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import java.util.List;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraft.util.EnumFacing;
|
||||||
import storagecraft.StorageCraftBlocks;
|
import storagecraft.StorageCraftBlocks;
|
||||||
import storagecraft.storage.IStorage;
|
import storagecraft.storage.IStorage;
|
||||||
import storagecraft.storage.IStorageProvider;
|
import storagecraft.storage.IStorageProvider;
|
||||||
@@ -25,7 +25,7 @@ public class TileController extends TileBase implements IEnergyReceiver, INetwor
|
|||||||
|
|
||||||
private List<TileMachine> machines = new ArrayList<TileMachine>();
|
private List<TileMachine> machines = new ArrayList<TileMachine>();
|
||||||
|
|
||||||
private List<Vec3> visitedCables = new ArrayList<Vec3>();
|
private List<BlockPos> visitedCables = new ArrayList<BlockPos>();
|
||||||
|
|
||||||
private EnergyStorage energy = new EnergyStorage(32000);
|
private EnergyStorage energy = new EnergyStorage(32000);
|
||||||
private int energyUsage;
|
private int energyUsage;
|
||||||
@@ -33,9 +33,9 @@ public class TileController extends TileBase implements IEnergyReceiver, INetwor
|
|||||||
private boolean destroyed = false;
|
private boolean destroyed = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void update()
|
||||||
{
|
{
|
||||||
super.updateEntity();
|
super.update();
|
||||||
|
|
||||||
if (destroyed)
|
if (destroyed)
|
||||||
{
|
{
|
||||||
@@ -58,9 +58,9 @@ public class TileController extends TileBase implements IEnergyReceiver, INetwor
|
|||||||
|
|
||||||
List<TileMachine> newMachines = new ArrayList<TileMachine>();
|
List<TileMachine> newMachines = new ArrayList<TileMachine>();
|
||||||
|
|
||||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
for (EnumFacing dir : EnumFacing.VALUES)
|
||||||
{
|
{
|
||||||
TileEntity tile = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
|
TileEntity tile = worldObj.getTileEntity(pos.offset(dir));
|
||||||
|
|
||||||
if (tile instanceof TileCable)
|
if (tile instanceof TileCable)
|
||||||
{
|
{
|
||||||
@@ -116,8 +116,8 @@ public class TileController extends TileBase implements IEnergyReceiver, INetwor
|
|||||||
|
|
||||||
if (lastEnergy != energy.getEnergyStored())
|
if (lastEnergy != energy.getEnergyStored())
|
||||||
{
|
{
|
||||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
worldObj.markBlockForUpdate(pos);
|
||||||
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, StorageCraftBlocks.CONTROLLER);
|
worldObj.notifyNeighborsOfStateChange(pos, StorageCraftBlocks.CONTROLLER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -293,13 +293,13 @@ public class TileController extends TileBase implements IEnergyReceiver, INetwor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate)
|
public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate)
|
||||||
{
|
{
|
||||||
return energy.receiveEnergy(maxReceive, simulate);
|
return energy.receiveEnergy(maxReceive, simulate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getEnergyStored(ForgeDirection from)
|
public int getEnergyStored(EnumFacing from)
|
||||||
{
|
{
|
||||||
return energy.getEnergyStored();
|
return energy.getEnergyStored();
|
||||||
}
|
}
|
||||||
@@ -310,7 +310,7 @@ public class TileController extends TileBase implements IEnergyReceiver, INetwor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxEnergyStored(ForgeDirection from)
|
public int getMaxEnergyStored(EnumFacing from)
|
||||||
{
|
{
|
||||||
return energy.getMaxEnergyStored();
|
return energy.getMaxEnergyStored();
|
||||||
}
|
}
|
||||||
@@ -321,14 +321,14 @@ public class TileController extends TileBase implements IEnergyReceiver, INetwor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canConnectEnergy(ForgeDirection from)
|
public boolean canConnectEnergy(EnumFacing from)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isActive()
|
public boolean isActive()
|
||||||
{
|
{
|
||||||
return energy.getEnergyStored() >= getEnergyUsage() && redstoneMode.isEnabled(worldObj, xCoord, yCoord, zCoord);
|
return energy.getEnergyStored() >= getEnergyUsage() && redstoneMode.isEnabled(worldObj, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -343,24 +343,6 @@ public class TileController extends TileBase implements IEnergyReceiver, INetwor
|
|||||||
this.redstoneMode = mode;
|
this.redstoneMode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getX()
|
|
||||||
{
|
|
||||||
return xCoord;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getY()
|
|
||||||
{
|
|
||||||
return yCoord;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getZ()
|
|
||||||
{
|
|
||||||
return zCoord;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fromBytes(ByteBuf buf)
|
public void fromBytes(ByteBuf buf)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package storagecraft.tile;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
import storagecraft.util.InventoryUtils;
|
import storagecraft.util.InventoryUtils;
|
||||||
|
|
||||||
public class TileDestructor extends TileMachine
|
public class TileDestructor extends TileMachine
|
||||||
@@ -19,23 +19,21 @@ public class TileDestructor extends TileMachine
|
|||||||
{
|
{
|
||||||
if (ticks % 10 == 0)
|
if (ticks % 10 == 0)
|
||||||
{
|
{
|
||||||
int frontX = xCoord + getDirection().offsetX;
|
BlockPos front = pos.offset(getDirection());
|
||||||
int frontY = yCoord + getDirection().offsetY;
|
|
||||||
int frontZ = zCoord + getDirection().offsetZ;
|
|
||||||
|
|
||||||
Block front = worldObj.getBlock(frontX, frontY, frontZ);
|
Block frontBlock = worldObj.getBlockState(front).getBlock();
|
||||||
|
|
||||||
if (front != Blocks.air)
|
if (!frontBlock.isAir(worldObj, front))
|
||||||
{
|
{
|
||||||
List<ItemStack> drops = front.getDrops(worldObj, frontX, frontY, frontZ, worldObj.getBlockMetadata(frontX, frontY, frontZ), 0);
|
List<ItemStack> drops = frontBlock.getDrops(worldObj, front, worldObj.getBlockState(front), 0);
|
||||||
|
|
||||||
worldObj.setBlockToAir(frontX, frontY, frontZ);
|
worldObj.setBlockToAir(front);
|
||||||
|
|
||||||
for (ItemStack drop : drops)
|
for (ItemStack drop : drops)
|
||||||
{
|
{
|
||||||
if (!getController().push(drop))
|
if (!getController().push(drop))
|
||||||
{
|
{
|
||||||
InventoryUtils.dropStack(worldObj, drop, frontX, frontY, frontZ);
|
InventoryUtils.dropStack(worldObj, drop, front.getX(), front.getY(), front.getZ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import net.minecraft.inventory.IInventory;
|
|||||||
import net.minecraft.inventory.ISidedInventory;
|
import net.minecraft.inventory.ISidedInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.IChatComponent;
|
||||||
import storagecraft.StorageCraftBlocks;
|
import storagecraft.StorageCraftBlocks;
|
||||||
import storagecraft.inventory.InventorySimple;
|
import storagecraft.inventory.InventorySimple;
|
||||||
import storagecraft.storage.StorageItem;
|
import storagecraft.storage.StorageItem;
|
||||||
@@ -99,8 +101,8 @@ public class TileDetector extends TileMachine implements IInventory, ISidedInven
|
|||||||
|
|
||||||
if (providesPower != lastProvidesPower)
|
if (providesPower != lastProvidesPower)
|
||||||
{
|
{
|
||||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
worldObj.markBlockForUpdate(pos);
|
||||||
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, StorageCraftBlocks.DETECTOR);
|
worldObj.notifyBlockOfStateChange(pos, StorageCraftBlocks.DETECTOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -142,98 +144,6 @@ public class TileDetector extends TileMachine implements IInventory, ISidedInven
|
|||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getSizeInventory()
|
|
||||||
{
|
|
||||||
return inventory.getSizeInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getStackInSlot(int slot)
|
|
||||||
{
|
|
||||||
return inventory.getStackInSlot(slot);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack decrStackSize(int slot, int amount)
|
|
||||||
{
|
|
||||||
return inventory.decrStackSize(slot, amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getStackInSlotOnClosing(int slot)
|
|
||||||
{
|
|
||||||
return inventory.getStackInSlotOnClosing(slot);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setInventorySlotContents(int slot, ItemStack stack)
|
|
||||||
{
|
|
||||||
inventory.setInventorySlotContents(slot, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getInventoryName()
|
|
||||||
{
|
|
||||||
return inventory.getInventoryName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasCustomInventoryName()
|
|
||||||
{
|
|
||||||
return inventory.hasCustomInventoryName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getInventoryStackLimit()
|
|
||||||
{
|
|
||||||
return inventory.getInventoryStackLimit();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isUseableByPlayer(EntityPlayer player)
|
|
||||||
{
|
|
||||||
return inventory.isUseableByPlayer(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void openInventory()
|
|
||||||
{
|
|
||||||
inventory.openInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void closeInventory()
|
|
||||||
{
|
|
||||||
inventory.closeInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isItemValidForSlot(int slot, ItemStack stack)
|
|
||||||
{
|
|
||||||
return inventory.isItemValidForSlot(slot, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int[] getAccessibleSlotsFromSide(int side)
|
|
||||||
{
|
|
||||||
return new int[]
|
|
||||||
{
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canInsertItem(int slot, ItemStack stack, int side)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canExtractItem(int slot, ItemStack stack, int side)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound nbt)
|
public void readFromNBT(NBTTagCompound nbt)
|
||||||
{
|
{
|
||||||
@@ -290,4 +200,126 @@ public class TileDetector extends TileMachine implements IInventory, ISidedInven
|
|||||||
buf.writeInt(amount);
|
buf.writeInt(amount);
|
||||||
buf.writeBoolean(providesPower);
|
buf.writeBoolean(providesPower);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSizeInventory()
|
||||||
|
{
|
||||||
|
return inventory.getSizeInventory();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getStackInSlot(int slot)
|
||||||
|
{
|
||||||
|
return inventory.getStackInSlot(slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack decrStackSize(int slot, int count)
|
||||||
|
{
|
||||||
|
return inventory.decrStackSize(slot, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getStackInSlotOnClosing(int slot)
|
||||||
|
{
|
||||||
|
return inventory.getStackInSlotOnClosing(slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInventorySlotContents(int slot, ItemStack stack)
|
||||||
|
{
|
||||||
|
inventory.setInventorySlotContents(slot, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInventoryStackLimit()
|
||||||
|
{
|
||||||
|
return inventory.getInventoryStackLimit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUseableByPlayer(EntityPlayer player)
|
||||||
|
{
|
||||||
|
return inventory.isUseableByPlayer(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void openInventory(EntityPlayer player)
|
||||||
|
{
|
||||||
|
inventory.openInventory(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void closeInventory(EntityPlayer player)
|
||||||
|
{
|
||||||
|
inventory.closeInventory(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isItemValidForSlot(int slot, ItemStack stack)
|
||||||
|
{
|
||||||
|
return inventory.isItemValidForSlot(slot, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getField(int id)
|
||||||
|
{
|
||||||
|
return inventory.getField(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setField(int id, int value)
|
||||||
|
{
|
||||||
|
inventory.setField(id, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getFieldCount()
|
||||||
|
{
|
||||||
|
return inventory.getFieldCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear()
|
||||||
|
{
|
||||||
|
inventory.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return inventory.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasCustomName()
|
||||||
|
{
|
||||||
|
return inventory.hasCustomName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IChatComponent getDisplayName()
|
||||||
|
{
|
||||||
|
return inventory.getDisplayName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int[] getSlotsForFace(EnumFacing side)
|
||||||
|
{
|
||||||
|
return new int[]
|
||||||
|
{
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing direction)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.IChatComponent;
|
||||||
import storagecraft.inventory.InventorySimple;
|
import storagecraft.inventory.InventorySimple;
|
||||||
import storagecraft.storage.CellStorage;
|
import storagecraft.storage.CellStorage;
|
||||||
import storagecraft.storage.IStorage;
|
import storagecraft.storage.IStorage;
|
||||||
@@ -36,78 +37,6 @@ public class TileDrive extends TileMachine implements IInventory, IStorageProvid
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getSizeInventory()
|
|
||||||
{
|
|
||||||
return inventory.getSizeInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getStackInSlot(int slot)
|
|
||||||
{
|
|
||||||
return inventory.getStackInSlot(slot);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack decrStackSize(int slot, int amount)
|
|
||||||
{
|
|
||||||
return inventory.decrStackSize(slot, amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getStackInSlotOnClosing(int slot)
|
|
||||||
{
|
|
||||||
return inventory.getStackInSlotOnClosing(slot);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setInventorySlotContents(int slot, ItemStack stack)
|
|
||||||
{
|
|
||||||
inventory.setInventorySlotContents(slot, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getInventoryName()
|
|
||||||
{
|
|
||||||
return inventory.getInventoryName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasCustomInventoryName()
|
|
||||||
{
|
|
||||||
return inventory.hasCustomInventoryName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getInventoryStackLimit()
|
|
||||||
{
|
|
||||||
return inventory.getInventoryStackLimit();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isUseableByPlayer(EntityPlayer player)
|
|
||||||
{
|
|
||||||
return inventory.isUseableByPlayer(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void openInventory()
|
|
||||||
{
|
|
||||||
inventory.openInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void closeInventory()
|
|
||||||
{
|
|
||||||
inventory.closeInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isItemValidForSlot(int slot, ItemStack stack)
|
|
||||||
{
|
|
||||||
return inventory.isItemValidForSlot(slot, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound nbt)
|
public void readFromNBT(NBTTagCompound nbt)
|
||||||
{
|
{
|
||||||
@@ -136,6 +65,108 @@ public class TileDrive extends TileMachine implements IInventory, IStorageProvid
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSizeInventory()
|
||||||
|
{
|
||||||
|
return inventory.getSizeInventory();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getStackInSlot(int slot)
|
||||||
|
{
|
||||||
|
return inventory.getStackInSlot(slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack decrStackSize(int slot, int count)
|
||||||
|
{
|
||||||
|
return inventory.decrStackSize(slot, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getStackInSlotOnClosing(int slot)
|
||||||
|
{
|
||||||
|
return inventory.getStackInSlotOnClosing(slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInventorySlotContents(int slot, ItemStack stack)
|
||||||
|
{
|
||||||
|
inventory.setInventorySlotContents(slot, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInventoryStackLimit()
|
||||||
|
{
|
||||||
|
return inventory.getInventoryStackLimit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUseableByPlayer(EntityPlayer player)
|
||||||
|
{
|
||||||
|
return inventory.isUseableByPlayer(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void openInventory(EntityPlayer player)
|
||||||
|
{
|
||||||
|
inventory.openInventory(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void closeInventory(EntityPlayer player)
|
||||||
|
{
|
||||||
|
inventory.closeInventory(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isItemValidForSlot(int slot, ItemStack stack)
|
||||||
|
{
|
||||||
|
return inventory.isItemValidForSlot(slot, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getField(int id)
|
||||||
|
{
|
||||||
|
return inventory.getField(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setField(int id, int value)
|
||||||
|
{
|
||||||
|
inventory.setField(id, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getFieldCount()
|
||||||
|
{
|
||||||
|
return inventory.getFieldCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear()
|
||||||
|
{
|
||||||
|
inventory.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return inventory.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasCustomName()
|
||||||
|
{
|
||||||
|
return inventory.hasCustomName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IChatComponent getDisplayName()
|
||||||
|
{
|
||||||
|
return inventory.getDisplayName();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IInventory getDroppedInventory()
|
public IInventory getDroppedInventory()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import net.minecraft.inventory.ISidedInventory;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.IChatComponent;
|
||||||
import storagecraft.inventory.InventorySimple;
|
import storagecraft.inventory.InventorySimple;
|
||||||
import storagecraft.util.InventoryUtils;
|
import storagecraft.util.InventoryUtils;
|
||||||
|
|
||||||
@@ -27,7 +29,7 @@ public class TileExporter extends TileMachine implements IInventory, ISidedInven
|
|||||||
@Override
|
@Override
|
||||||
public void updateMachine()
|
public void updateMachine()
|
||||||
{
|
{
|
||||||
TileEntity tile = worldObj.getTileEntity(xCoord + getDirection().offsetX, yCoord + getDirection().offsetY, zCoord + getDirection().offsetZ);
|
TileEntity tile = worldObj.getTileEntity(pos.offset(getDirection()));
|
||||||
|
|
||||||
if (tile instanceof IInventory)
|
if (tile instanceof IInventory)
|
||||||
{
|
{
|
||||||
@@ -57,7 +59,7 @@ public class TileExporter extends TileMachine implements IInventory, ISidedInven
|
|||||||
|
|
||||||
for (int sidedSlot = 0; sidedSlot < connectedInventory.getSizeInventory(); ++sidedSlot)
|
for (int sidedSlot = 0; sidedSlot < connectedInventory.getSizeInventory(); ++sidedSlot)
|
||||||
{
|
{
|
||||||
if (sided.canInsertItem(sidedSlot, took, getDirection().getOpposite().ordinal()) && InventoryUtils.canPushToInventorySlot(connectedInventory, sidedSlot, took))
|
if (sided.canInsertItem(sidedSlot, took, getDirection().getOpposite()) && InventoryUtils.canPushToInventorySlot(connectedInventory, sidedSlot, took))
|
||||||
{
|
{
|
||||||
InventoryUtils.pushToInventorySlot(connectedInventory, sidedSlot, took);
|
InventoryUtils.pushToInventorySlot(connectedInventory, sidedSlot, took);
|
||||||
|
|
||||||
@@ -99,98 +101,6 @@ public class TileExporter extends TileMachine implements IInventory, ISidedInven
|
|||||||
this.compare = compare;
|
this.compare = compare;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getSizeInventory()
|
|
||||||
{
|
|
||||||
return inventory.getSizeInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getStackInSlot(int slot)
|
|
||||||
{
|
|
||||||
return inventory.getStackInSlot(slot);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack decrStackSize(int slot, int amount)
|
|
||||||
{
|
|
||||||
return inventory.decrStackSize(slot, amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getStackInSlotOnClosing(int slot)
|
|
||||||
{
|
|
||||||
return inventory.getStackInSlotOnClosing(slot);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setInventorySlotContents(int slot, ItemStack stack)
|
|
||||||
{
|
|
||||||
inventory.setInventorySlotContents(slot, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getInventoryName()
|
|
||||||
{
|
|
||||||
return inventory.getInventoryName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasCustomInventoryName()
|
|
||||||
{
|
|
||||||
return inventory.hasCustomInventoryName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getInventoryStackLimit()
|
|
||||||
{
|
|
||||||
return inventory.getInventoryStackLimit();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isUseableByPlayer(EntityPlayer player)
|
|
||||||
{
|
|
||||||
return inventory.isUseableByPlayer(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void openInventory()
|
|
||||||
{
|
|
||||||
inventory.openInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void closeInventory()
|
|
||||||
{
|
|
||||||
inventory.closeInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isItemValidForSlot(int slot, ItemStack stack)
|
|
||||||
{
|
|
||||||
return inventory.isItemValidForSlot(slot, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int[] getAccessibleSlotsFromSide(int side)
|
|
||||||
{
|
|
||||||
return new int[]
|
|
||||||
{
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canInsertItem(int slot, ItemStack stack, int side)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canExtractItem(int slot, ItemStack stack, int side)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound nbt)
|
public void readFromNBT(NBTTagCompound nbt)
|
||||||
{
|
{
|
||||||
@@ -229,4 +139,126 @@ public class TileExporter extends TileMachine implements IInventory, ISidedInven
|
|||||||
|
|
||||||
buf.writeInt(compare);
|
buf.writeInt(compare);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSizeInventory()
|
||||||
|
{
|
||||||
|
return inventory.getSizeInventory();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getStackInSlot(int slot)
|
||||||
|
{
|
||||||
|
return inventory.getStackInSlot(slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack decrStackSize(int slot, int count)
|
||||||
|
{
|
||||||
|
return inventory.decrStackSize(slot, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getStackInSlotOnClosing(int slot)
|
||||||
|
{
|
||||||
|
return inventory.getStackInSlotOnClosing(slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInventorySlotContents(int slot, ItemStack stack)
|
||||||
|
{
|
||||||
|
inventory.setInventorySlotContents(slot, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInventoryStackLimit()
|
||||||
|
{
|
||||||
|
return inventory.getInventoryStackLimit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUseableByPlayer(EntityPlayer player)
|
||||||
|
{
|
||||||
|
return inventory.isUseableByPlayer(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void openInventory(EntityPlayer player)
|
||||||
|
{
|
||||||
|
inventory.openInventory(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void closeInventory(EntityPlayer player)
|
||||||
|
{
|
||||||
|
inventory.closeInventory(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isItemValidForSlot(int slot, ItemStack stack)
|
||||||
|
{
|
||||||
|
return inventory.isItemValidForSlot(slot, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getField(int id)
|
||||||
|
{
|
||||||
|
return inventory.getField(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setField(int id, int value)
|
||||||
|
{
|
||||||
|
inventory.setField(id, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getFieldCount()
|
||||||
|
{
|
||||||
|
return inventory.getFieldCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear()
|
||||||
|
{
|
||||||
|
inventory.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return inventory.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasCustomName()
|
||||||
|
{
|
||||||
|
return inventory.hasCustomName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IChatComponent getDisplayName()
|
||||||
|
{
|
||||||
|
return inventory.getDisplayName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int[] getSlotsForFace(EnumFacing side)
|
||||||
|
{
|
||||||
|
return new int[]
|
||||||
|
{
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing direction)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class TileExternalStorage extends TileMachine implements IStorageProvider
|
|||||||
{
|
{
|
||||||
public IInventory getInventory()
|
public IInventory getInventory()
|
||||||
{
|
{
|
||||||
TileEntity tile = worldObj.getTileEntity(xCoord + getDirection().offsetX, yCoord + getDirection().offsetY, zCoord + getDirection().offsetZ);
|
TileEntity tile = worldObj.getTileEntity(pos.offset(getDirection()));
|
||||||
|
|
||||||
if (tile instanceof IInventory)
|
if (tile instanceof IInventory)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package storagecraft.tile;
|
package storagecraft.tile;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.inventory.InventoryCrafting;
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.CraftingManager;
|
import net.minecraft.item.crafting.CraftingManager;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
import storagecraft.StorageCraft;
|
import storagecraft.StorageCraft;
|
||||||
import storagecraft.container.ContainerGridCrafting;
|
import storagecraft.container.ContainerGridCrafting;
|
||||||
import storagecraft.inventory.InventorySimple;
|
import storagecraft.inventory.InventorySimple;
|
||||||
@@ -32,7 +32,7 @@ public class TileGrid extends TileMachine
|
|||||||
|
|
||||||
public int getType()
|
public int getType()
|
||||||
{
|
{
|
||||||
return worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
return 0; // @TODO: Make other grid work too
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCrafting()
|
public boolean isCrafting()
|
||||||
@@ -75,7 +75,7 @@ public class TileGrid extends TileMachine
|
|||||||
onCraftingMatrixChanged();
|
onCraftingMatrixChanged();
|
||||||
|
|
||||||
// @TODO: HACK!
|
// @TODO: HACK!
|
||||||
TargetPoint target = new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, UPDATE_RANGE);
|
TargetPoint target = new TargetPoint(worldObj.provider.getDimensionId(), pos.getX(), pos.getY(), pos.getZ(), UPDATE_RANGE);
|
||||||
|
|
||||||
StorageCraft.NETWORK.sendToAllAround(new MessageGridCraftingUpdate(this), target);
|
StorageCraft.NETWORK.sendToAllAround(new MessageGridCraftingUpdate(this), target);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import net.minecraft.inventory.ISidedInventory;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.IChatComponent;
|
||||||
import storagecraft.inventory.InventorySimple;
|
import storagecraft.inventory.InventorySimple;
|
||||||
import storagecraft.util.InventoryUtils;
|
import storagecraft.util.InventoryUtils;
|
||||||
|
|
||||||
@@ -34,7 +36,7 @@ public class TileImporter extends TileMachine implements IInventory, ISidedInven
|
|||||||
@Override
|
@Override
|
||||||
public void updateMachine()
|
public void updateMachine()
|
||||||
{
|
{
|
||||||
TileEntity tile = worldObj.getTileEntity(xCoord + getDirection().offsetX, yCoord + getDirection().offsetY, zCoord + getDirection().offsetZ);
|
TileEntity tile = worldObj.getTileEntity(pos.offset(getDirection()));
|
||||||
|
|
||||||
if (tile instanceof IInventory)
|
if (tile instanceof IInventory)
|
||||||
{
|
{
|
||||||
@@ -60,7 +62,7 @@ public class TileImporter extends TileMachine implements IInventory, ISidedInven
|
|||||||
{
|
{
|
||||||
ISidedInventory sided = (ISidedInventory) connectedInventory;
|
ISidedInventory sided = (ISidedInventory) connectedInventory;
|
||||||
|
|
||||||
if (sided.canExtractItem(currentSlot, slot.copy(), getDirection().getOpposite().ordinal()))
|
if (sided.canExtractItem(currentSlot, slot.copy(), getDirection().getOpposite()))
|
||||||
{
|
{
|
||||||
if (getController().push(slot.copy()))
|
if (getController().push(slot.copy()))
|
||||||
{
|
{
|
||||||
@@ -142,98 +144,6 @@ public class TileImporter extends TileMachine implements IInventory, ISidedInven
|
|||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getSizeInventory()
|
|
||||||
{
|
|
||||||
return inventory.getSizeInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getStackInSlot(int slot)
|
|
||||||
{
|
|
||||||
return inventory.getStackInSlot(slot);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack decrStackSize(int slot, int amount)
|
|
||||||
{
|
|
||||||
return inventory.decrStackSize(slot, amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getStackInSlotOnClosing(int slot)
|
|
||||||
{
|
|
||||||
return inventory.getStackInSlotOnClosing(slot);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setInventorySlotContents(int slot, ItemStack stack)
|
|
||||||
{
|
|
||||||
inventory.setInventorySlotContents(slot, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getInventoryName()
|
|
||||||
{
|
|
||||||
return inventory.getInventoryName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasCustomInventoryName()
|
|
||||||
{
|
|
||||||
return inventory.hasCustomInventoryName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getInventoryStackLimit()
|
|
||||||
{
|
|
||||||
return inventory.getInventoryStackLimit();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isUseableByPlayer(EntityPlayer player)
|
|
||||||
{
|
|
||||||
return inventory.isUseableByPlayer(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void openInventory()
|
|
||||||
{
|
|
||||||
inventory.openInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void closeInventory()
|
|
||||||
{
|
|
||||||
inventory.closeInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isItemValidForSlot(int slot, ItemStack stack)
|
|
||||||
{
|
|
||||||
return inventory.isItemValidForSlot(slot, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int[] getAccessibleSlotsFromSide(int side)
|
|
||||||
{
|
|
||||||
return new int[]
|
|
||||||
{
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canInsertItem(int slot, ItemStack stack, int side)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canExtractItem(int slot, ItemStack stack, int side)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound nbt)
|
public void readFromNBT(NBTTagCompound nbt)
|
||||||
{
|
{
|
||||||
@@ -280,4 +190,126 @@ public class TileImporter extends TileMachine implements IInventory, ISidedInven
|
|||||||
buf.writeInt(compare);
|
buf.writeInt(compare);
|
||||||
buf.writeInt(mode);
|
buf.writeInt(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSizeInventory()
|
||||||
|
{
|
||||||
|
return inventory.getSizeInventory();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getStackInSlot(int slot)
|
||||||
|
{
|
||||||
|
return inventory.getStackInSlot(slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack decrStackSize(int slot, int count)
|
||||||
|
{
|
||||||
|
return inventory.decrStackSize(slot, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getStackInSlotOnClosing(int slot)
|
||||||
|
{
|
||||||
|
return inventory.getStackInSlotOnClosing(slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInventorySlotContents(int slot, ItemStack stack)
|
||||||
|
{
|
||||||
|
inventory.setInventorySlotContents(slot, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInventoryStackLimit()
|
||||||
|
{
|
||||||
|
return inventory.getInventoryStackLimit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUseableByPlayer(EntityPlayer player)
|
||||||
|
{
|
||||||
|
return inventory.isUseableByPlayer(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void openInventory(EntityPlayer player)
|
||||||
|
{
|
||||||
|
inventory.openInventory(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void closeInventory(EntityPlayer player)
|
||||||
|
{
|
||||||
|
inventory.closeInventory(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isItemValidForSlot(int slot, ItemStack stack)
|
||||||
|
{
|
||||||
|
return inventory.isItemValidForSlot(slot, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getField(int id)
|
||||||
|
{
|
||||||
|
return inventory.getField(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setField(int id, int value)
|
||||||
|
{
|
||||||
|
inventory.setField(id, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getFieldCount()
|
||||||
|
{
|
||||||
|
return inventory.getFieldCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear()
|
||||||
|
{
|
||||||
|
inventory.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return inventory.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasCustomName()
|
||||||
|
{
|
||||||
|
return inventory.hasCustomName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IChatComponent getDisplayName()
|
||||||
|
{
|
||||||
|
return inventory.getDisplayName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int[] getSlotsForFace(EnumFacing side)
|
||||||
|
{
|
||||||
|
return new int[]
|
||||||
|
{
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing direction)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package storagecraft.tile;
|
|||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
|
||||||
public abstract class TileMachine extends TileBase implements INetworkTile, IRedstoneModeSetting
|
public abstract class TileMachine extends TileBase implements INetworkTile, IRedstoneModeSetting
|
||||||
{
|
{
|
||||||
@@ -10,17 +11,13 @@ public abstract class TileMachine extends TileBase implements INetworkTile, IRed
|
|||||||
|
|
||||||
private RedstoneMode redstoneMode = RedstoneMode.IGNORE;
|
private RedstoneMode redstoneMode = RedstoneMode.IGNORE;
|
||||||
|
|
||||||
private int xController;
|
private BlockPos controllerPos;
|
||||||
private int yController;
|
|
||||||
private int zController;
|
|
||||||
|
|
||||||
public void onConnected(TileController controller)
|
public void onConnected(TileController controller)
|
||||||
{
|
{
|
||||||
connected = true;
|
connected = true;
|
||||||
|
|
||||||
xController = controller.xCoord;
|
controllerPos = controller.getPos();
|
||||||
yController = controller.yCoord;
|
|
||||||
zController = controller.zCoord;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDisconnected()
|
public void onDisconnected()
|
||||||
@@ -29,9 +26,9 @@ public abstract class TileMachine extends TileBase implements INetworkTile, IRed
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void update()
|
||||||
{
|
{
|
||||||
super.updateEntity();
|
super.update();
|
||||||
|
|
||||||
if (!worldObj.isRemote && isConnected())
|
if (!worldObj.isRemote && isConnected())
|
||||||
{
|
{
|
||||||
@@ -59,27 +56,9 @@ public abstract class TileMachine extends TileBase implements INetworkTile, IRed
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getX()
|
|
||||||
{
|
|
||||||
return xCoord;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getY()
|
|
||||||
{
|
|
||||||
return yCoord;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getZ()
|
|
||||||
{
|
|
||||||
return zCoord;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TileController getController()
|
public TileController getController()
|
||||||
{
|
{
|
||||||
return (TileController) worldObj.getTileEntity(xController, yController, zController);
|
return (TileController) worldObj.getTileEntity(controllerPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -91,16 +70,14 @@ public abstract class TileMachine extends TileBase implements INetworkTile, IRed
|
|||||||
|
|
||||||
if (connected)
|
if (connected)
|
||||||
{
|
{
|
||||||
xController = buf.readInt();
|
controllerPos = new BlockPos(buf.readInt(), buf.readInt(), buf.readInt());
|
||||||
yController = buf.readInt();
|
|
||||||
zController = buf.readInt();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
redstoneMode = RedstoneMode.getById(buf.readInt());
|
redstoneMode = RedstoneMode.getById(buf.readInt());
|
||||||
|
|
||||||
if (lastConnected != connected)
|
if (lastConnected != connected)
|
||||||
{
|
{
|
||||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
worldObj.markBlockForUpdate(pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,9 +88,9 @@ public abstract class TileMachine extends TileBase implements INetworkTile, IRed
|
|||||||
|
|
||||||
if (connected)
|
if (connected)
|
||||||
{
|
{
|
||||||
buf.writeInt(xController);
|
buf.writeInt(controllerPos.getX());
|
||||||
buf.writeInt(yController);
|
buf.writeInt(controllerPos.getY());
|
||||||
buf.writeInt(zController);
|
buf.writeInt(controllerPos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
buf.writeInt(redstoneMode.id);
|
buf.writeInt(redstoneMode.id);
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
package storagecraft.tile;
|
package storagecraft.tile;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.inventory.ISidedInventory;
|
import net.minecraft.inventory.ISidedInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.IChatComponent;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import storagecraft.inventory.InventorySimple;
|
import storagecraft.inventory.InventorySimple;
|
||||||
import storagecraft.tile.solderer.ISoldererRecipe;
|
import storagecraft.tile.solderer.ISoldererRecipe;
|
||||||
import storagecraft.tile.solderer.SoldererRegistry;
|
import storagecraft.tile.solderer.SoldererRegistry;
|
||||||
@@ -82,111 +84,6 @@ public class TileSolderer extends TileMachine implements IInventory, ISidedInven
|
|||||||
recipe = null;
|
recipe = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getSizeInventory()
|
|
||||||
{
|
|
||||||
return inventory.getSizeInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getStackInSlot(int slot)
|
|
||||||
{
|
|
||||||
return inventory.getStackInSlot(slot);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack decrStackSize(int slot, int amount)
|
|
||||||
{
|
|
||||||
return inventory.decrStackSize(slot, amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getStackInSlotOnClosing(int slot)
|
|
||||||
{
|
|
||||||
return inventory.getStackInSlotOnClosing(slot);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setInventorySlotContents(int slot, ItemStack stack)
|
|
||||||
{
|
|
||||||
inventory.setInventorySlotContents(slot, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getInventoryName()
|
|
||||||
{
|
|
||||||
return inventory.getInventoryName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasCustomInventoryName()
|
|
||||||
{
|
|
||||||
return inventory.hasCustomInventoryName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getInventoryStackLimit()
|
|
||||||
{
|
|
||||||
return inventory.getInventoryStackLimit();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isUseableByPlayer(EntityPlayer player)
|
|
||||||
{
|
|
||||||
return inventory.isUseableByPlayer(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void openInventory()
|
|
||||||
{
|
|
||||||
inventory.openInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void closeInventory()
|
|
||||||
{
|
|
||||||
inventory.closeInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isItemValidForSlot(int slot, ItemStack stack)
|
|
||||||
{
|
|
||||||
return inventory.isItemValidForSlot(slot, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int[] getAccessibleSlotsFromSide(int side)
|
|
||||||
{
|
|
||||||
// On all sides, but not the bottom we can reach the slots
|
|
||||||
if (side > 0)
|
|
||||||
{
|
|
||||||
return new int[]
|
|
||||||
{
|
|
||||||
0, 1, 2
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// On the bottom we can only reach the output slot
|
|
||||||
return new int[]
|
|
||||||
{
|
|
||||||
3
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canInsertItem(int slot, ItemStack stack, int side)
|
|
||||||
{
|
|
||||||
// We can insert in all slots, but not the output slot or via the output side
|
|
||||||
return side != 0 && slot != 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canExtractItem(int slot, ItemStack stack, int side)
|
|
||||||
{
|
|
||||||
// We can only extract from the buttom in the last slot
|
|
||||||
return side == 0 && slot == 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound nbt)
|
public void readFromNBT(NBTTagCompound nbt)
|
||||||
{
|
{
|
||||||
@@ -265,4 +162,137 @@ public class TileSolderer extends TileMachine implements IInventory, ISidedInven
|
|||||||
{
|
{
|
||||||
return inventory;
|
return inventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSizeInventory()
|
||||||
|
{
|
||||||
|
return inventory.getSizeInventory();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getStackInSlot(int slot)
|
||||||
|
{
|
||||||
|
return inventory.getStackInSlot(slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack decrStackSize(int slot, int count)
|
||||||
|
{
|
||||||
|
return inventory.decrStackSize(slot, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getStackInSlotOnClosing(int slot)
|
||||||
|
{
|
||||||
|
return inventory.getStackInSlotOnClosing(slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInventorySlotContents(int slot, ItemStack stack)
|
||||||
|
{
|
||||||
|
inventory.setInventorySlotContents(slot, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInventoryStackLimit()
|
||||||
|
{
|
||||||
|
return inventory.getInventoryStackLimit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUseableByPlayer(EntityPlayer player)
|
||||||
|
{
|
||||||
|
return inventory.isUseableByPlayer(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void openInventory(EntityPlayer player)
|
||||||
|
{
|
||||||
|
inventory.openInventory(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void closeInventory(EntityPlayer player)
|
||||||
|
{
|
||||||
|
inventory.closeInventory(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isItemValidForSlot(int slot, ItemStack stack)
|
||||||
|
{
|
||||||
|
return inventory.isItemValidForSlot(slot, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getField(int id)
|
||||||
|
{
|
||||||
|
return inventory.getField(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setField(int id, int value)
|
||||||
|
{
|
||||||
|
inventory.setField(id, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getFieldCount()
|
||||||
|
{
|
||||||
|
return inventory.getFieldCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear()
|
||||||
|
{
|
||||||
|
inventory.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return inventory.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasCustomName()
|
||||||
|
{
|
||||||
|
return inventory.hasCustomName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IChatComponent getDisplayName()
|
||||||
|
{
|
||||||
|
return inventory.getDisplayName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int[] getSlotsForFace(EnumFacing side)
|
||||||
|
{
|
||||||
|
// On all sides, but not the bottom we can reach the slots
|
||||||
|
if (side != EnumFacing.DOWN)
|
||||||
|
{
|
||||||
|
return new int[]
|
||||||
|
{
|
||||||
|
0, 1, 2
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// On the bottom we can only reach the output slot
|
||||||
|
return new int[]
|
||||||
|
{
|
||||||
|
3
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing direction)
|
||||||
|
{
|
||||||
|
return slot != 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing direction)
|
||||||
|
{
|
||||||
|
return slot == 3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.IChatComponent;
|
||||||
import storagecraft.inventory.InventorySimple;
|
import storagecraft.inventory.InventorySimple;
|
||||||
import storagecraft.item.ItemWirelessGrid;
|
import storagecraft.item.ItemWirelessGrid;
|
||||||
import storagecraft.util.InventoryUtils;
|
import storagecraft.util.InventoryUtils;
|
||||||
@@ -51,10 +52,11 @@ public class TileWirelessTransmitter extends TileMachine implements IInventory
|
|||||||
{
|
{
|
||||||
ItemStack slot = inventory.getStackInSlot(1);
|
ItemStack slot = inventory.getStackInSlot(1);
|
||||||
|
|
||||||
slot.stackTagCompound = new NBTTagCompound();
|
slot.setTagCompound(new NBTTagCompound());
|
||||||
slot.stackTagCompound.setInteger(ItemWirelessGrid.NBT_WIRELESS_TRANSMITTER_X, xCoord);
|
|
||||||
slot.stackTagCompound.setInteger(ItemWirelessGrid.NBT_WIRELESS_TRANSMITTER_Y, yCoord);
|
slot.getTagCompound().setInteger(ItemWirelessGrid.NBT_WIRELESS_TRANSMITTER_X, pos.getX());
|
||||||
slot.stackTagCompound.setInteger(ItemWirelessGrid.NBT_WIRELESS_TRANSMITTER_Z, zCoord);
|
slot.getTagCompound().setInteger(ItemWirelessGrid.NBT_WIRELESS_TRANSMITTER_Y, pos.getY());
|
||||||
|
slot.getTagCompound().setInteger(ItemWirelessGrid.NBT_WIRELESS_TRANSMITTER_Z, pos.getZ());
|
||||||
|
|
||||||
inventory.setInventorySlotContents(2, slot);
|
inventory.setInventorySlotContents(2, slot);
|
||||||
inventory.setInventorySlotContents(1, null);
|
inventory.setInventorySlotContents(1, null);
|
||||||
@@ -89,7 +91,8 @@ public class TileWirelessTransmitter extends TileMachine implements IInventory
|
|||||||
{
|
{
|
||||||
for (TileMachine machine : getController().getMachines())
|
for (TileMachine machine : getController().getMachines())
|
||||||
{
|
{
|
||||||
if (worldObj.getTileEntity(machine.xCoord, machine.yCoord, machine.zCoord) != null)
|
// @TODO: Is this still needed?
|
||||||
|
if (worldObj.getTileEntity(machine.getPos()) != null)
|
||||||
{
|
{
|
||||||
if (machine instanceof TileGrid)
|
if (machine instanceof TileGrid)
|
||||||
{
|
{
|
||||||
@@ -106,78 +109,6 @@ public class TileWirelessTransmitter extends TileMachine implements IInventory
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getSizeInventory()
|
|
||||||
{
|
|
||||||
return inventory.getSizeInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getStackInSlot(int slot)
|
|
||||||
{
|
|
||||||
return inventory.getStackInSlot(slot);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack decrStackSize(int slot, int amount)
|
|
||||||
{
|
|
||||||
return inventory.decrStackSize(slot, amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getStackInSlotOnClosing(int slot)
|
|
||||||
{
|
|
||||||
return inventory.getStackInSlotOnClosing(slot);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setInventorySlotContents(int slot, ItemStack stack)
|
|
||||||
{
|
|
||||||
inventory.setInventorySlotContents(slot, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getInventoryName()
|
|
||||||
{
|
|
||||||
return inventory.getInventoryName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasCustomInventoryName()
|
|
||||||
{
|
|
||||||
return inventory.hasCustomInventoryName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getInventoryStackLimit()
|
|
||||||
{
|
|
||||||
return inventory.getInventoryStackLimit();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isUseableByPlayer(EntityPlayer player)
|
|
||||||
{
|
|
||||||
return inventory.isUseableByPlayer(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void openInventory()
|
|
||||||
{
|
|
||||||
inventory.openInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void closeInventory()
|
|
||||||
{
|
|
||||||
inventory.closeInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isItemValidForSlot(int slot, ItemStack stack)
|
|
||||||
{
|
|
||||||
return inventory.isItemValidForSlot(slot, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound nbt)
|
public void readFromNBT(NBTTagCompound nbt)
|
||||||
{
|
{
|
||||||
@@ -219,7 +150,7 @@ public class TileWirelessTransmitter extends TileMachine implements IInventory
|
|||||||
|
|
||||||
if (lastWorking != working)
|
if (lastWorking != working)
|
||||||
{
|
{
|
||||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
worldObj.markBlockForUpdate(pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,4 +168,106 @@ public class TileWirelessTransmitter extends TileMachine implements IInventory
|
|||||||
{
|
{
|
||||||
return inventory;
|
return inventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSizeInventory()
|
||||||
|
{
|
||||||
|
return inventory.getSizeInventory();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getStackInSlot(int slot)
|
||||||
|
{
|
||||||
|
return inventory.getStackInSlot(slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack decrStackSize(int slot, int count)
|
||||||
|
{
|
||||||
|
return inventory.decrStackSize(slot, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getStackInSlotOnClosing(int slot)
|
||||||
|
{
|
||||||
|
return inventory.getStackInSlotOnClosing(slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInventorySlotContents(int slot, ItemStack stack)
|
||||||
|
{
|
||||||
|
inventory.setInventorySlotContents(slot, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInventoryStackLimit()
|
||||||
|
{
|
||||||
|
return inventory.getInventoryStackLimit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUseableByPlayer(EntityPlayer player)
|
||||||
|
{
|
||||||
|
return inventory.isUseableByPlayer(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isItemValidForSlot(int slot, ItemStack stack)
|
||||||
|
{
|
||||||
|
return inventory.isItemValidForSlot(slot, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void openInventory(EntityPlayer player)
|
||||||
|
{
|
||||||
|
inventory.openInventory(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void closeInventory(EntityPlayer player)
|
||||||
|
{
|
||||||
|
inventory.closeInventory(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getField(int id)
|
||||||
|
{
|
||||||
|
return inventory.getField(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setField(int id, int value)
|
||||||
|
{
|
||||||
|
inventory.setField(id, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getFieldCount()
|
||||||
|
{
|
||||||
|
return inventory.getFieldCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear()
|
||||||
|
{
|
||||||
|
inventory.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return inventory.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasCustomName()
|
||||||
|
{
|
||||||
|
return inventory.hasCustomName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IChatComponent getDisplayName()
|
||||||
|
{
|
||||||
|
return inventory.getDisplayName();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class InventoryUtils
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void dropStack(World world, ItemStack stack, int x, int y, int z)
|
public static void dropStack(World world, ItemStack stack, int x, int y, int z) // @TODO: Take BlockPos here
|
||||||
{
|
{
|
||||||
float xo = world.rand.nextFloat() * 0.8F + 0.1F;
|
float xo = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||||
float yo = world.rand.nextFloat() * 0.8F + 0.1F;
|
float yo = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||||
@@ -226,7 +226,7 @@ public class InventoryUtils
|
|||||||
|
|
||||||
if ((flags & COMPARE_NBT) == COMPARE_NBT)
|
if ((flags & COMPARE_NBT) == COMPARE_NBT)
|
||||||
{
|
{
|
||||||
if (first.stackTagCompound != null && !first.stackTagCompound.equals(second.stackTagCompound))
|
if (first.hasTagCompound() && !first.getTagCompound().equals(second.getTagCompound()))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user