Change all containers init to IContainerProvider + Add Enum for gui ids handling

This commit is contained in:
Ourten 2017-01-08 20:34:46 +01:00
parent b93fe6c5ad
commit eb220643fc
114 changed files with 2155 additions and 2025 deletions

View file

@ -3,48 +3,50 @@ package techreborn.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IAdvancedRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
public class BlockComputerCube extends BlockMachineBase implements IAdvancedRotationTexture {
private final String prefix = "techreborn:blocks/machine/greg_machines/";
public BlockComputerCube(Material material) {
public BlockComputerCube(final Material material) {
super();
setUnlocalizedName("techreborn.computercube");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.computercube");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@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(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.manuelID, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.MANUAL.ordinal(), world, x, y, z);
return true;
}
@Override
public String getFront(boolean isActive) {
return prefix + "computer_cube";
public String getFront(final boolean isActive) {
return this.prefix + "computer_cube";
}
@Override
public String getSide(boolean isActive) {
return prefix + "computer_cube";
public String getSide(final boolean isActive) {
return this.prefix + "computer_cube";
}
@Override
public String getTop(boolean isActive) {
return prefix + "computer_cube";
public String getTop(final boolean isActive) {
return this.prefix + "computer_cube";
}
@Override
public String getBottom(boolean isActive) {
return prefix + "computer_cube";
public String getBottom(final boolean isActive) {
return this.prefix + "computer_cube";
}
}

View file

@ -6,7 +6,6 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@ -14,8 +13,9 @@ import net.minecraftforge.fluids.BlockFluidBase;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IAdvancedRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.TileDigitalChest;
import techreborn.tiles.TileTechStorageBase;
@ -30,13 +30,13 @@ public class BlockDigitalChest extends BlockMachineBase implements IAdvancedRota
public BlockDigitalChest() {
super();
setUnlocalizedName("techreborn.digitalChest");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.digitalChest");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
protected void dropInventory(World world, BlockPos pos) {
TileEntity tileEntity = world.getTileEntity(pos);
protected void dropInventory(final World world, final BlockPos pos) {
final TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity == null) {
return;
@ -45,13 +45,13 @@ public class BlockDigitalChest extends BlockMachineBase implements IAdvancedRota
return;
}
TileTechStorageBase inventory = (TileTechStorageBase) tileEntity;
final TileTechStorageBase inventory = (TileTechStorageBase) tileEntity;
List<ItemStack> items = new ArrayList<ItemStack>();
final List<ItemStack> items = new ArrayList<>();
List<ItemStack> droppables = inventory.getContentDrops();
final List<ItemStack> droppables = inventory.getContentDrops();
for (int i = 0; i < droppables.size(); i++) {
ItemStack itemStack = droppables.get(i);
final ItemStack itemStack = droppables.get(i);
if (itemStack == ItemStack.EMPTY) {
continue;
@ -68,21 +68,21 @@ public class BlockDigitalChest extends BlockMachineBase implements IAdvancedRota
items.add(itemStack.copy());
}
for (ItemStack itemStack : items) {
Random rand = new Random();
for (final ItemStack itemStack : items) {
final Random rand = new Random();
float dX = rand.nextFloat() * 0.8F + 0.1F;
float dY = rand.nextFloat() * 0.8F + 0.1F;
float dZ = rand.nextFloat() * 0.8F + 0.1F;
final float dX = rand.nextFloat() * 0.8F + 0.1F;
final float dY = rand.nextFloat() * 0.8F + 0.1F;
final float dZ = rand.nextFloat() * 0.8F + 0.1F;
EntityItem entityItem = new EntityItem(world, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ,
final EntityItem entityItem = new EntityItem(world, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ,
itemStack.copy());
if (itemStack.hasTagCompound()) {
entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
entityItem.getEntityItem().setTagCompound(itemStack.getTagCompound().copy());
}
float factor = 0.05F;
final float factor = 0.05F;
entityItem.motionX = rand.nextGaussian() * factor;
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
entityItem.motionZ = rand.nextGaussian() * factor;
@ -92,35 +92,35 @@ public class BlockDigitalChest extends BlockMachineBase implements IAdvancedRota
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
public TileEntity createNewTileEntity(final World p_149915_1_, final int p_149915_2_) {
return new TileDigitalChest();
}
@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(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.digitalChestID, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.DIGITAL_CHEST.ordinal(), world, x, y, z);
return true;
}
@Override
public String getFront(boolean isActive) {
return prefix + "quantum_chest";
public String getFront(final boolean isActive) {
return this.prefix + "quantum_chest";
}
@Override
public String getSide(boolean isActive) {
return prefix + "qchest_side";
public String getSide(final boolean isActive) {
return this.prefix + "qchest_side";
}
@Override
public String getTop(boolean isActive) {
return prefix + "quantum_top";
public String getTop(final boolean isActive) {
return this.prefix + "quantum_top";
}
@Override
public String getBottom(boolean isActive) {
return prefix + "machine_bottom";
public String getBottom(final boolean isActive) {
return this.prefix + "machine_bottom";
}
}

View file

@ -6,10 +6,12 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IAdvancedRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.fusionReactor.TileEntityFusionController;
import techreborn.utils.damageSources.FusionDamageSource;
@ -18,56 +20,56 @@ public class BlockFusionControlComputer extends BlockMachineBase implements IAdv
private final String prefix = "techreborn:blocks/machine/greg_machines/";
public BlockFusionControlComputer(Material material) {
public BlockFusionControlComputer(final Material material) {
super();
setUnlocalizedName("techreborn.fusioncontrolcomputer");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.fusioncontrolcomputer");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
float hitY, float hitZ) {
TileEntityFusionController tileEntityFusionController = (TileEntityFusionController) world
.getTileEntity(new BlockPos(x, y, z));
public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
final TileEntityFusionController tileEntityFusionController = (TileEntityFusionController) world
.getTileEntity(new BlockPos(x, y, z));
tileEntityFusionController.checkCoils();
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.fusionID, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.FUSION_CONTROLLER.ordinal(), world, x, y, z);
return true;
}
@Override
public void onEntityWalk(World worldIn, BlockPos pos, Entity entityIn) {
public void onEntityWalk(final World worldIn, final BlockPos pos, final Entity entityIn) {
super.onEntityWalk(worldIn, pos, entityIn);
if (worldIn.getTileEntity(pos) instanceof TileEntityFusionController) {
if (((TileEntityFusionController) worldIn.getTileEntity(pos)).crafingTickTime != 0
&& ((TileEntityFusionController) worldIn.getTileEntity(pos)).checkCoils()) {
&& ((TileEntityFusionController) worldIn.getTileEntity(pos)).checkCoils()) {
entityIn.attackEntityFrom(new FusionDamageSource(), 200F);
}
}
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
public TileEntity createNewTileEntity(final World world, final int meta) {
return new TileEntityFusionController();
}
@Override
public String getFront(boolean isActive) {
return prefix + "fusion_control_computer_front";
public String getFront(final boolean isActive) {
return this.prefix + "fusion_control_computer_front";
}
@Override
public String getSide(boolean isActive) {
return prefix + "machine_side";
public String getSide(final boolean isActive) {
return this.prefix + "machine_side";
}
@Override
public String getTop(boolean isActive) {
return prefix + "machine_side";
public String getTop(final boolean isActive) {
return this.prefix + "machine_side";
}
@Override
public String getBottom(boolean isActive) {
return prefix + "machine_side";
public String getBottom(final boolean isActive) {
return this.prefix + "machine_side";
}
}

View file

@ -5,10 +5,8 @@ import net.minecraft.block.BlockStaticLiquid;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
@ -20,7 +18,7 @@ import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IAdvancedRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.TileQuantumChest;
import techreborn.tiles.TileTechStorageBase;
@ -35,14 +33,14 @@ public class BlockQuantumChest extends BlockMachineBase implements IAdvancedRota
public BlockQuantumChest() {
super();
setUnlocalizedName("techreborn.quantumChest");
setCreativeTab(TechRebornCreativeTab.instance);
setHardness(2.0F);
this.setUnlocalizedName("techreborn.quantumChest");
this.setCreativeTab(TechRebornCreativeTab.instance);
this.setHardness(2.0F);
}
@Override
protected void dropInventory(World world, BlockPos pos) {
TileEntity tileEntity = world.getTileEntity(pos);
protected void dropInventory(final World world, final BlockPos pos) {
final TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity == null) {
return;
@ -51,13 +49,13 @@ public class BlockQuantumChest extends BlockMachineBase implements IAdvancedRota
return;
}
TileTechStorageBase inventory = (TileTechStorageBase) tileEntity;
final TileTechStorageBase inventory = (TileTechStorageBase) tileEntity;
List<ItemStack> items = new ArrayList<ItemStack>();
final List<ItemStack> items = new ArrayList<>();
List<ItemStack> droppables = inventory.getContentDrops();
final List<ItemStack> droppables = inventory.getContentDrops();
for (int i = 0; i < droppables.size(); i++) {
ItemStack itemStack = droppables.get(i);
final ItemStack itemStack = droppables.get(i);
if (itemStack == ItemStack.EMPTY) {
continue;
@ -74,21 +72,21 @@ public class BlockQuantumChest extends BlockMachineBase implements IAdvancedRota
items.add(itemStack.copy());
}
for (ItemStack itemStack : items) {
Random rand = new Random();
for (final ItemStack itemStack : items) {
final Random rand = new Random();
float dX = rand.nextFloat() * 0.8F + 0.1F;
float dY = rand.nextFloat() * 0.8F + 0.1F;
float dZ = rand.nextFloat() * 0.8F + 0.1F;
final float dX = rand.nextFloat() * 0.8F + 0.1F;
final float dY = rand.nextFloat() * 0.8F + 0.1F;
final float dZ = rand.nextFloat() * 0.8F + 0.1F;
EntityItem entityItem = new EntityItem(world, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ,
final EntityItem entityItem = new EntityItem(world, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ,
itemStack.copy());
if (itemStack.hasTagCompound()) {
entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
entityItem.getEntityItem().setTagCompound(itemStack.getTagCompound().copy());
}
float factor = 0.05F;
final float factor = 0.05F;
entityItem.motionX = rand.nextGaussian() * factor;
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
entityItem.motionZ = rand.nextGaussian() * factor;
@ -98,35 +96,35 @@ public class BlockQuantumChest extends BlockMachineBase implements IAdvancedRota
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
public TileEntity createNewTileEntity(final World p_149915_1_, final int p_149915_2_) {
return new TileQuantumChest();
}
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
public boolean onBlockActivated(final World worldIn, final BlockPos pos, final IBlockState state, final EntityPlayer playerIn,
final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
if (!playerIn.isSneaking())
playerIn.openGui(Core.INSTANCE, GuiHandler.quantumChestID, worldIn, pos.getX(), pos.getY(), pos.getZ());
playerIn.openGui(Core.INSTANCE, EGui.QUANTUM_CHEST.ordinal(), worldIn, pos.getX(), pos.getY(), pos.getZ());
return true;
}
@Override
public String getFront(boolean isActive) {
return prefix + "quantum_chest";
public String getFront(final boolean isActive) {
return this.prefix + "quantum_chest";
}
@Override
public String getSide(boolean isActive) {
return prefix + "qchest_side";
public String getSide(final boolean isActive) {
return this.prefix + "qchest_side";
}
@Override
public String getTop(boolean isActive) {
return prefix + "quantum_top";
public String getTop(final boolean isActive) {
return this.prefix + "quantum_top";
}
@Override
public String getBottom(boolean isActive) {
return prefix + "machine_bottom";
public String getBottom(final boolean isActive) {
return this.prefix + "machine_bottom";
}
}

View file

@ -4,10 +4,12 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IAdvancedRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.TileQuantumTank;
@ -17,45 +19,45 @@ public class BlockQuantumTank extends BlockMachineBase implements IAdvancedRotat
public BlockQuantumTank() {
super();
setUnlocalizedName("techreborn.quantumTank");
setHardness(2.0F);
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.quantumTank");
this.setHardness(2.0F);
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
public TileEntity createNewTileEntity(final World p_149915_1_, final int p_149915_2_) {
return new TileQuantumTank();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
float hitY, float hitZ) {
if (fillBlockWithFluid(world, new BlockPos(x, y, z), player)) {
public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (this.fillBlockWithFluid(world, new BlockPos(x, y, z), player)) {
return true;
}
if (!player.isSneaking()) {
player.openGui(Core.INSTANCE, GuiHandler.quantumTankID, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.QUANTUM_TANK.ordinal(), world, x, y, z);
}
return true;
}
@Override
public String getFront(boolean isActive) {
public String getFront(final boolean isActive) {
return "techreborn:blocks/machine/generators/thermal_generator_side_off";
}
@Override
public String getSide(boolean isActive) {
public String getSide(final boolean isActive) {
return "techreborn:blocks/machine/generators/thermal_generator_side_off";
}
@Override
public String getTop(boolean isActive) {
return prefix + "quantum_top";
public String getTop(final boolean isActive) {
return this.prefix + "quantum_top";
}
@Override
public String getBottom(boolean isActive) {
public String getBottom(final boolean isActive) {
return "techreborn:blocks/machine/generators/thermal_generator_bottom";
}
}

View file

@ -4,10 +4,12 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.multiblock.TileBlastFurnace;
@ -15,22 +17,22 @@ public class BlockBlastFurnace extends BlockMachineBase implements IRotationText
private final String prefix = "techreborn:blocks/machine/advanced_machines/";
public BlockBlastFurnace(Material material) {
public BlockBlastFurnace(final Material material) {
super();
setUnlocalizedName("techreborn.blastfurnace");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.blastfurnace");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
public TileEntity createNewTileEntity(final World world, final int p_149915_2_) {
return new TileBlastFurnace();
}
@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(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.blastFurnaceID, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.BLAST_FURNACE.ordinal(), world, x, y, z);
return true;
}
@ -41,26 +43,26 @@ public class BlockBlastFurnace extends BlockMachineBase implements IRotationText
@Override
public String getFrontOff() {
return prefix + "industrial_blast_furnace_front_off";
return this.prefix + "industrial_blast_furnace_front_off";
}
@Override
public String getFrontOn() {
return prefix + "industrial_blast_furnace_front_on";
return this.prefix + "industrial_blast_furnace_front_on";
}
@Override
public String getSide() {
return prefix + "advanced_machine_side";
return this.prefix + "advanced_machine_side";
}
@Override
public String getTop() {
return prefix + "advanced_machine_top";
return this.prefix + "advanced_machine_top";
}
@Override
public String getBottom() {
return prefix + "advanced_machine_bottom";
return this.prefix + "advanced_machine_bottom";
}
}

View file

@ -3,10 +3,12 @@ package techreborn.blocks.advanced_machine;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.TileCentrifuge;
@ -16,46 +18,46 @@ public class BlockCentrifuge extends BlockMachineBase implements IRotationTextur
public BlockCentrifuge() {
super();
setUnlocalizedName("techreborn.centrifuge");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.centrifuge");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
public TileEntity createNewTileEntity(final World p_149915_1_, final int p_149915_2_) {
return new TileCentrifuge();
}
@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(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (!player.isSneaking()) {
player.openGui(Core.INSTANCE, GuiHandler.centrifugeID, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.CENTRIFUGE.ordinal(), world, x, y, z);
}
return true;
}
@Override
public String getFrontOff() {
return prefix + "industrial_centrifuge_side_off";
return this.prefix + "industrial_centrifuge_side_off";
}
@Override
public String getFrontOn() {
return prefix + "industrial_centrifuge_side_on";
return this.prefix + "industrial_centrifuge_side_on";
}
@Override
public String getSide() {
return getFrontOff();
return this.getFrontOff();
}
@Override
public String getTop() {
return prefix + "industrial_centrifuge_top_off";
return this.prefix + "industrial_centrifuge_top_off";
}
@Override
public String getBottom() {
return prefix + "industrial_centrifuge_bottom";
return this.prefix + "industrial_centrifuge_bottom";
}
}

View file

@ -4,10 +4,12 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.multiblock.TileImplosionCompressor;
@ -15,47 +17,47 @@ public class BlockImplosionCompressor extends BlockMachineBase implements IRotat
private final String prefix = "techreborn:blocks/machine/advanced_machines/";
public BlockImplosionCompressor(Material material) {
public BlockImplosionCompressor(final Material material) {
super();
setUnlocalizedName("techreborn.implosioncompressor");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.implosioncompressor");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
public TileEntity createNewTileEntity(final World p_149915_1_, final int p_149915_2_) {
return new TileImplosionCompressor();
}
@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(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.implosionCompresserID, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.IMPLOSION_COMPRESSOR.ordinal(), world, x, y, z);
return true;
}
@Override
public String getFrontOff() {
return prefix + "implosion_compressor_front_off";
return this.prefix + "implosion_compressor_front_off";
}
@Override
public String getFrontOn() {
return prefix + "implosion_compressor_front_on";
return this.prefix + "implosion_compressor_front_on";
}
@Override
public String getSide() {
return prefix + "advanced_machine_side";
return this.prefix + "advanced_machine_side";
}
@Override
public String getTop() {
return prefix + "industrial_centrifuge_top_off";
return this.prefix + "industrial_centrifuge_top_off";
}
@Override
public String getBottom() {
return prefix + "implosion_compressor_bottom";
return this.prefix + "implosion_compressor_bottom";
}
}

View file

@ -4,10 +4,12 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.TileIndustrialElectrolyzer;
@ -15,47 +17,47 @@ public class BlockIndustrialElectrolyzer extends BlockMachineBase implements IRo
private final String prefix = "techreborn:blocks/machine/greg_machines/";
public BlockIndustrialElectrolyzer(Material material) {
public BlockIndustrialElectrolyzer(final Material material) {
super();
setUnlocalizedName("techreborn.industrialelectrolyzer");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.industrialelectrolyzer");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
public TileEntity createNewTileEntity(final World world, final int p_149915_2_) {
return new TileIndustrialElectrolyzer();
}
@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(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.industrialElectrolyzerID, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.INDUSTRIAL_ELECTROLYZER.ordinal(), world, x, y, z);
return true;
}
@Override
public String getFrontOff() {
return prefix + "industrial_electrolyzer_front_off";
return this.prefix + "industrial_electrolyzer_front_off";
}
@Override
public String getFrontOn() {
return prefix + "industrial_electrolyzer_front_on";
return this.prefix + "industrial_electrolyzer_front_on";
}
@Override
public String getSide() {
return prefix + "industrial_electrolyzer_front_off";
return this.prefix + "industrial_electrolyzer_front_off";
}
@Override
public String getTop() {
return prefix + "machine_top";
return this.prefix + "machine_top";
}
@Override
public String getBottom() {
return prefix + "machine_bottom";
return this.prefix + "machine_bottom";
}
}

View file

@ -5,10 +5,12 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.multiblock.TileIndustrialGrinder;
@ -16,50 +18,50 @@ public class BlockIndustrialGrinder extends BlockMachineBase implements IRotatio
private final String prefix = "techreborn:blocks/machine/advanced_machines/";
public BlockIndustrialGrinder(Material material) {
public BlockIndustrialGrinder(final Material material) {
super();
setUnlocalizedName("techreborn.industrialgrinder");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.industrialgrinder");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
public TileEntity createNewTileEntity(final World p_149915_1_, final int p_149915_2_) {
return new TileIndustrialGrinder();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
float hitY, float hitZ) {
if (fillBlockWithFluid(world, new BlockPos(x, y, z), player)) {
public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (this.fillBlockWithFluid(world, new BlockPos(x, y, z), player)) {
return true;
}
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.industrialGrinderID, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.INDUSTRIAL_GRINDER.ordinal(), world, x, y, z);
return true;
}
@Override
public String getFrontOff() {
return prefix + "industrial_grinder_front_off";
return this.prefix + "industrial_grinder_front_off";
}
@Override
public String getFrontOn() {
return prefix + "industrial_grinder_front_on";
return this.prefix + "industrial_grinder_front_on";
}
@Override
public String getSide() {
return prefix + "machine_side";
return this.prefix + "machine_side";
}
@Override
public String getTop() {
return prefix + "industrial_grinder_top_off";
return this.prefix + "industrial_grinder_top_off";
}
@Override
public String getBottom() {
return prefix + "industrial_centrifuge_bottom";
return this.prefix + "industrial_centrifuge_bottom";
}
}

View file

@ -5,10 +5,12 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.multiblock.TileIndustrialSawmill;
@ -16,50 +18,50 @@ public class BlockIndustrialSawmill extends BlockMachineBase implements IRotatio
private final String prefix = "techreborn:blocks/machine/advanced_machines/";
public BlockIndustrialSawmill(Material material) {
public BlockIndustrialSawmill(final Material material) {
super();
setUnlocalizedName("techreborn.industrialsawmill");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.industrialsawmill");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
public TileEntity createNewTileEntity(final World world, final int p_149915_2_) {
return new TileIndustrialSawmill();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
float hitY, float hitZ) {
if (fillBlockWithFluid(world, new BlockPos(x, y, z), player)) {
public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (this.fillBlockWithFluid(world, new BlockPos(x, y, z), player)) {
return true;
}
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.sawMillID, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.SAWMILL.ordinal(), world, x, y, z);
return true;
}
@Override
public String getFrontOff() {
return prefix + "industrial_sawmill_front_off";
return this.prefix + "industrial_sawmill_front_off";
}
@Override
public String getFrontOn() {
return prefix + "industrial_sawmill_front_on";
return this.prefix + "industrial_sawmill_front_on";
}
@Override
public String getSide() {
return prefix + "advanced_machine_side";
return this.prefix + "advanced_machine_side";
}
@Override
public String getTop() {
return prefix + "advanced_machine_side";
return this.prefix + "advanced_machine_side";
}
@Override
public String getBottom() {
return prefix + "advanced_machine_side";
return this.prefix + "advanced_machine_side";
}
}

View file

@ -5,10 +5,12 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IAdvancedRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.generator.TileDieselGenerator;
@ -16,46 +18,46 @@ public class BlockDieselGenerator extends BlockMachineBase implements IAdvancedR
private final String prefix = "techreborn:blocks/machine/generators/";
public BlockDieselGenerator(Material material) {
public BlockDieselGenerator(final Material material) {
super();
setUnlocalizedName("techreborn.dieselgenerator");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.dieselgenerator");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
public TileEntity createNewTileEntity(final World world, final int p_149915_2_) {
return new TileDieselGenerator();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
float hitY, float hitZ) {
if (fillBlockWithFluid(world, new BlockPos(x, y, z), player)) {
public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (this.fillBlockWithFluid(world, new BlockPos(x, y, z), player)) {
return true;
}
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.dieselGeneratorID, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.DIESEL_GENERATOR.ordinal(), world, x, y, z);
return true;
}
@Override
public String getFront(boolean isActive) {
return prefix + "generator_machine_side";
public String getFront(final boolean isActive) {
return this.prefix + "generator_machine_side";
}
@Override
public String getSide(boolean isActive) {
return prefix + "generator_machine_side";
public String getSide(final boolean isActive) {
return this.prefix + "generator_machine_side";
}
@Override
public String getTop(boolean isActive) {
return prefix + "diesel_generator_top_off";
public String getTop(final boolean isActive) {
return this.prefix + "diesel_generator_top_off";
}
@Override
public String getBottom(boolean isActive) {
return prefix + "generator_machine_bottom";
public String getBottom(final boolean isActive) {
return this.prefix + "generator_machine_bottom";
}
}

View file

@ -5,10 +5,12 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IAdvancedRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.generator.TileGasTurbine;
@ -16,46 +18,46 @@ public class BlockGasTurbine extends BlockMachineBase implements IAdvancedRotati
private final String prefix = "techreborn:blocks/machine/generators/";
public BlockGasTurbine(Material material) {
public BlockGasTurbine(final Material material) {
super();
setUnlocalizedName("techreborn.gasTurbine");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.gasTurbine");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
public TileEntity createNewTileEntity(final World world, final int p_149915_2_) {
return new TileGasTurbine();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
float hitY, float hitZ) {
if (fillBlockWithFluid(world, new BlockPos(x, y, z), player)) {
public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (this.fillBlockWithFluid(world, new BlockPos(x, y, z), player)) {
return true;
}
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.gasTurbineID, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.GAS_TURBINE.ordinal(), world, x, y, z);
return true;
}
@Override
public String getFront(boolean isActive) {
return prefix + "generator_machine_side";
public String getFront(final boolean isActive) {
return this.prefix + "generator_machine_side";
}
@Override
public String getSide(boolean isActive) {
return prefix + "generator_machine_side";
public String getSide(final boolean isActive) {
return this.prefix + "generator_machine_side";
}
@Override
public String getTop(boolean isActive) {
return prefix + "gas_generator_top";
public String getTop(final boolean isActive) {
return this.prefix + "gas_generator_top";
}
@Override
public String getBottom(boolean isActive) {
return prefix + "gas_generator_bottom";
public String getBottom(final boolean isActive) {
return this.prefix + "gas_generator_bottom";
}
}

View file

@ -3,10 +3,12 @@ package techreborn.blocks.generator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.generator.TileGenerator;
@ -16,46 +18,46 @@ public class BlockGenerator extends BlockMachineBase implements IRotationTexture
public BlockGenerator() {
super();
setUnlocalizedName("techreborn.generator");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.generator");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
public TileEntity createNewTileEntity(final World world, final int p_149915_2_) {
return new TileGenerator();
}
@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(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (!player.isSneaking()) {
player.openGui(Core.INSTANCE, GuiHandler.generatorID, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.GENERATOR.ordinal(), world, x, y, z);
}
return true;
}
@Override
public String getFrontOff() {
return prefix + "generator_front_off";
return this.prefix + "generator_front_off";
}
@Override
public String getFrontOn() {
return prefix + "generator_front_on";
return this.prefix + "generator_front_on";
}
@Override
public String getSide() {
return prefix + "generator_machine_side";
return this.prefix + "generator_machine_side";
}
@Override
public String getTop() {
return prefix + "generator_machine_top";
return this.prefix + "generator_machine_top";
}
@Override
public String getBottom() {
return prefix + "generator_machine_bottom";
return this.prefix + "generator_machine_bottom";
}
}

View file

@ -5,10 +5,12 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IAdvancedRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.generator.TileSemifluidGenerator;
@ -16,46 +18,46 @@ public class BlockSemiFluidGenerator extends BlockMachineBase implements IAdvanc
private final String prefix = "techreborn:blocks/machine/generators/";
public BlockSemiFluidGenerator(Material material) {
public BlockSemiFluidGenerator(final Material material) {
super();
setUnlocalizedName("techreborn.semifluidgenerator");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.semifluidgenerator");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
public TileEntity createNewTileEntity(final World world, final int p_149915_2_) {
return new TileSemifluidGenerator();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
float hitY, float hitZ) {
if (fillBlockWithFluid(world, new BlockPos(x, y, z), player)) {
public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (this.fillBlockWithFluid(world, new BlockPos(x, y, z), player)) {
return true;
}
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.semifluidGeneratorID, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.SEMIFLUID_GENERATOR.ordinal(), world, x, y, z);
return true;
}
@Override
public String getFront(boolean isActive) {
return prefix + "semifluid_generator_side";
public String getFront(final boolean isActive) {
return this.prefix + "semifluid_generator_side";
}
@Override
public String getSide(boolean isActive) {
return prefix + "semifluid_generator_side";
public String getSide(final boolean isActive) {
return this.prefix + "semifluid_generator_side";
}
@Override
public String getTop(boolean isActive) {
return prefix + "generator_machine_top";
public String getTop(final boolean isActive) {
return this.prefix + "generator_machine_top";
}
@Override
public String getBottom(boolean isActive) {
return prefix + "generator_machine_bottom";
public String getBottom(final boolean isActive) {
return this.prefix + "generator_machine_bottom";
}
}

View file

@ -4,10 +4,12 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IAdvancedRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.generator.TileThermalGenerator;
@ -17,43 +19,43 @@ public class BlockThermalGenerator extends BlockMachineBase implements IAdvanced
public BlockThermalGenerator() {
super();
setUnlocalizedName("techreborn.thermalGenerator");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.thermalGenerator");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
public TileEntity createNewTileEntity(final World world, final int p_149915_2_) {
return new TileThermalGenerator();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
float hitY, float hitZ) {
if (fillBlockWithFluid(world, new BlockPos(x, y, z), player)) {
public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (this.fillBlockWithFluid(world, new BlockPos(x, y, z), player)) {
return true;
}
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.thermalGeneratorID, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.THERMAL_GENERATOR.ordinal(), world, x, y, z);
return true;
}
@Override
public String getFront(boolean isActive) {
return isActive ? prefix + "thermal_generator_side_on" : prefix + "thermal_generator_side_off";
public String getFront(final boolean isActive) {
return isActive ? this.prefix + "thermal_generator_side_on" : this.prefix + "thermal_generator_side_off";
}
@Override
public String getSide(boolean isActive) {
return isActive ? prefix + "thermal_generator_side_on" : prefix + "thermal_generator_side_off";
public String getSide(final boolean isActive) {
return isActive ? this.prefix + "thermal_generator_side_on" : this.prefix + "thermal_generator_side_off";
}
@Override
public String getTop(boolean isActive) {
return isActive ? prefix + "thermal_generator_top_on" : prefix + "thermal_generator_top_off";
public String getTop(final boolean isActive) {
return isActive ? this.prefix + "thermal_generator_top_on" : this.prefix + "thermal_generator_top_off";
}
@Override
public String getBottom(boolean isActive) {
return prefix + "generator_machine_bottom";
public String getBottom(final boolean isActive) {
return this.prefix + "generator_machine_bottom";
}
}

View file

@ -8,10 +8,12 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.TileAlloyFurnace;
@ -22,54 +24,54 @@ public class BlockAlloyFurnace extends BlockMachineBase implements IRotationText
private final String prefix = "techreborn:blocks/machine/iron_machines/";
public BlockAlloyFurnace(Material material) {
public BlockAlloyFurnace(final Material material) {
super();
setUnlocalizedName("techreborn.alloyfurnace");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.alloyfurnace");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
public TileEntity createNewTileEntity(final World world, final int p_149915_2_) {
return new TileAlloyFurnace();
}
@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(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.alloyFurnaceID, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.ALLOY_FURNACE.ordinal(), world, x, y, z);
return true;
}
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
List<ItemStack> items = new ArrayList<>();
public List<ItemStack> getDrops(final IBlockAccess world, final BlockPos pos, final IBlockState state, final int fortune) {
final List<ItemStack> items = new ArrayList<>();
items.add(new ItemStack(this));
return items;
}
@Override
public String getFrontOff() {
return prefix + "alloy_furnace_front_off";
return this.prefix + "alloy_furnace_front_off";
}
@Override
public String getFrontOn() {
return prefix + "alloy_furnace_front_on";
return this.prefix + "alloy_furnace_front_on";
}
@Override
public String getSide() {
return prefix + "iron_machine_side";
return this.prefix + "iron_machine_side";
}
@Override
public String getTop() {
return prefix + "iron_machine_top";
return this.prefix + "iron_machine_top";
}
@Override
public String getBottom() {
return prefix + "iron_machine_bottom";
return this.prefix + "iron_machine_bottom";
}
}

View file

@ -11,10 +11,12 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.TileIronFurnace;
@ -28,60 +30,60 @@ public class BlockIronFurnace extends BlockMachineBase implements IRotationTextu
public BlockIronFurnace() {
super();
setUnlocalizedName("techreborn.ironfurnace");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.ironfurnace");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
public TileEntity createNewTileEntity(final World world, final int p_149915_2_) {
return new TileIronFurnace();
}
@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(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.ironFurnace, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.IRON_FURNACE.ordinal(), world, x, y, z);
return true;
}
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
List<ItemStack> items = new ArrayList<>();
public List<ItemStack> getDrops(final IBlockAccess world, final BlockPos pos, final IBlockState state, final int fortune) {
final List<ItemStack> items = new ArrayList<>();
items.add(new ItemStack(this));
return items;
}
@SideOnly(Side.CLIENT)
@SuppressWarnings("incomplete-switch")
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
public void randomDisplayTick(final World worldIn, final BlockPos pos, final IBlockState state, final Random rand) {
if (this.isActive(state)) {
EnumFacing enumfacing = state.getValue(FACING);
double d0 = (double) pos.getX() + 0.5D;
double d1 = (double) pos.getY() + rand.nextDouble() * 6.0D / 16.0D;
double d2 = (double) pos.getZ() + 0.5D;
double d3 = 0.52D;
double d4 = rand.nextDouble() * 0.6D - 0.3D;
final EnumFacing enumfacing = state.getValue(BlockMachineBase.FACING);
final double d0 = pos.getX() + 0.5D;
final double d1 = pos.getY() + rand.nextDouble() * 6.0D / 16.0D;
final double d2 = pos.getZ() + 0.5D;
final double d3 = 0.52D;
final double d4 = rand.nextDouble() * 0.6D - 0.3D;
switch (enumfacing) {
case WEST:
worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 - d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D,
new int[0]);
new int[0]);
worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 - d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]);
break;
case EAST:
worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D,
new int[0]);
new int[0]);
worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]);
break;
case NORTH:
worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d4, d1, d2 - d3, 0.0D, 0.0D, 0.0D,
new int[0]);
new int[0]);
worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + d4, d1, d2 - d3, 0.0D, 0.0D, 0.0D, new int[0]);
break;
case SOUTH:
worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d4, d1, d2 + d3, 0.0D, 0.0D, 0.0D,
new int[0]);
new int[0]);
worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + d4, d1, d2 + d3, 0.0D, 0.0D, 0.0D, new int[0]);
}
}
@ -89,26 +91,26 @@ public class BlockIronFurnace extends BlockMachineBase implements IRotationTextu
@Override
public String getFrontOff() {
return prefix + "iron_furnace_front_off";
return this.prefix + "iron_furnace_front_off";
}
@Override
public String getFrontOn() {
return prefix + "iron_furnace_front_on";
return this.prefix + "iron_furnace_front_on";
}
@Override
public String getSide() {
return prefix + "iron_machine_side";
return this.prefix + "iron_machine_side";
}
@Override
public String getTop() {
return prefix + "iron_machine_top";
return this.prefix + "iron_machine_top";
}
@Override
public String getBottom() {
return prefix + "iron_machine_bottom";
return this.prefix + "iron_machine_bottom";
}
}

View file

@ -4,10 +4,12 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.TileAssemblingMachine;
@ -15,47 +17,47 @@ public class BlockAssemblingMachine extends BlockMachineBase implements IRotatio
private final String prefix = "techreborn:blocks/machine/greg_machines/";
public BlockAssemblingMachine(Material material) {
public BlockAssemblingMachine(final Material material) {
super();
setUnlocalizedName("techreborn.assemblingmachine");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.assemblingmachine");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
public TileEntity createNewTileEntity(final World world, final int p_149915_2_) {
return new TileAssemblingMachine();
}
@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(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.assemblingmachineID, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.ASSEMBLING_MACHINE.ordinal(), world, x, y, z);
return true;
}
@Override
public String getFrontOff() {
return prefix + "assembling_machine_front_off";
return this.prefix + "assembling_machine_front_off";
}
@Override
public String getFrontOn() {
return prefix + "assembling_machine_front_on";
return this.prefix + "assembling_machine_front_on";
}
@Override
public String getSide() {
return prefix + "machine_side";
return this.prefix + "machine_side";
}
@Override
public String getTop() {
return prefix + "machine_top";
return this.prefix + "machine_top";
}
@Override
public String getBottom() {
return prefix + "assembling_machine_top";
return this.prefix + "assembling_machine_top";
}
}

View file

@ -4,10 +4,12 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.TileChargeBench;
@ -15,47 +17,47 @@ public class BlockChargeBench extends BlockMachineBase implements IRotationTextu
private final String prefix = "techreborn:blocks/machine/greg_machines/";
public BlockChargeBench(Material material) {
public BlockChargeBench(final Material material) {
super();
setUnlocalizedName("techreborn.chargebench");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.chargebench");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
public TileEntity createNewTileEntity(final World world, final int p_149915_2_) {
return new TileChargeBench();
}
@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(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.chargeBench, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.CHARGEBENCH.ordinal(), world, x, y, z);
return true;
}
@Override
public String getFrontOff() {
return prefix + "chargeBench_side";
return this.prefix + "chargeBench_side";
}
@Override
public String getFrontOn() {
return prefix + "chargeBench_side";
return this.prefix + "chargeBench_side";
}
@Override
public String getSide() {
return prefix + "chargeBench_side";
return this.prefix + "chargeBench_side";
}
@Override
public String getTop() {
return prefix + "chargeBench_side";
return this.prefix + "chargeBench_side";
}
@Override
public String getBottom() {
return prefix + "chargeBench_side";
return this.prefix + "chargeBench_side";
}
}

View file

@ -4,10 +4,12 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.TileChemicalReactor;
@ -15,47 +17,47 @@ public class BlockChemicalReactor extends BlockMachineBase implements IRotationT
private final String prefix = "techreborn:blocks/machine/greg_machines/";
public BlockChemicalReactor(Material material) {
public BlockChemicalReactor(final Material material) {
super();
setUnlocalizedName("techreborn.chemicalreactor");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.chemicalreactor");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
public TileEntity createNewTileEntity(final World world, final int p_149915_2_) {
return new TileChemicalReactor();
}
@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(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.chemicalReactorID, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.CHEMICAL_REACTOR.ordinal(), world, x, y, z);
return true;
}
@Override
public String getFrontOff() {
return prefix + "chemical_reactor_side_off";
return this.prefix + "chemical_reactor_side_off";
}
@Override
public String getFrontOn() {
return prefix + "chemical_reactor_side_on";
return this.prefix + "chemical_reactor_side_on";
}
@Override
public String getSide() {
return prefix + "machine_side";
return this.prefix + "machine_side";
}
@Override
public String getTop() {
return prefix + "machine_top";
return this.prefix + "machine_top";
}
@Override
public String getBottom() {
return prefix + "chemical_reactor_bottom";
return this.prefix + "chemical_reactor_bottom";
}
}

View file

@ -4,10 +4,12 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IAdvancedRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.TileChunkLoader;
@ -15,42 +17,42 @@ public class BlockChunkLoader extends BlockMachineBase implements IAdvancedRotat
private final String prefix = "techreborn:blocks/machine/greg_machines/";
public BlockChunkLoader(Material material) {
public BlockChunkLoader(final Material material) {
super();
setUnlocalizedName("techreborn.chunkloader");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.chunkloader");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
public TileEntity createNewTileEntity(final World world, final int p_149915_2_) {
return new TileChunkLoader();
}
@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(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.chunkloaderID, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.CHUNK_LOADER.ordinal(), world, x, y, z);
return true;
}
@Override
public String getFront(boolean isActive) {
return prefix + "industrial_chunk_loader_side";
public String getFront(final boolean isActive) {
return this.prefix + "industrial_chunk_loader_side";
}
@Override
public String getSide(boolean isActive) {
return prefix + "industrial_chunk_loader_side";
public String getSide(final boolean isActive) {
return this.prefix + "industrial_chunk_loader_side";
}
@Override
public String getTop(boolean isActive) {
return prefix + "machine_top";
public String getTop(final boolean isActive) {
return this.prefix + "machine_top";
}
@Override
public String getBottom(boolean isActive) {
return prefix + "machine_bottom";
public String getBottom(final boolean isActive) {
return this.prefix + "machine_bottom";
}
}

View file

@ -4,10 +4,12 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IAdvancedRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.TileMatterFabricator;
@ -15,22 +17,22 @@ public class BlockMatterFabricator extends BlockMachineBase implements IAdvanced
private final String prefix = "techreborn:blocks/machine/greg_machines/";
public BlockMatterFabricator(Material material) {
public BlockMatterFabricator(final Material material) {
super();
setUnlocalizedName("techreborn.matterfabricator");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.matterfabricator");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
public TileEntity createNewTileEntity(final World p_149915_1_, final int p_149915_2_) {
return new TileMatterFabricator();
}
@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(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.matterfabID, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.MATTER_FABRICATOR.ordinal(), world, x, y, z);
return true;
}
@ -40,22 +42,22 @@ public class BlockMatterFabricator extends BlockMachineBase implements IAdvanced
}
@Override
public String getFront(boolean isActive) {
return isActive ? prefix + "matter_fabricator_on" : prefix + "matter_fabricator_off";
public String getFront(final boolean isActive) {
return isActive ? this.prefix + "matter_fabricator_on" : this.prefix + "matter_fabricator_off";
}
@Override
public String getSide(boolean isActive) {
return isActive ? prefix + "matter_fabricator_on" : prefix + "matter_fabricator_off";
public String getSide(final boolean isActive) {
return isActive ? this.prefix + "matter_fabricator_on" : this.prefix + "matter_fabricator_off";
}
@Override
public String getTop(boolean isActive) {
return isActive ? prefix + "matter_fabricator_on" : prefix + "matter_fabricator_off";
public String getTop(final boolean isActive) {
return isActive ? this.prefix + "matter_fabricator_on" : this.prefix + "matter_fabricator_off";
}
@Override
public String getBottom(boolean isActive) {
return isActive ? prefix + "matter_fabricator_on" : prefix + "matter_fabricator_off";
public String getBottom(final boolean isActive) {
return isActive ? this.prefix + "matter_fabricator_on" : this.prefix + "matter_fabricator_off";
}
}

View file

@ -4,10 +4,12 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IAdvancedRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.TileRollingMachine;
@ -15,42 +17,42 @@ public class BlockRollingMachine extends BlockMachineBase implements IAdvancedRo
private final String prefix = "techreborn:blocks/machine/greg_machines/";
public BlockRollingMachine(Material material) {
public BlockRollingMachine(final Material material) {
super();
setUnlocalizedName("techreborn.rollingmachine");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.rollingmachine");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
public TileEntity createNewTileEntity(final World p_149915_1_, final int p_149915_2_) {
return new TileRollingMachine();
}
@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(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.rollingMachineID, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.ROLLING_MACHINE.ordinal(), world, x, y, z);
return true;
}
@Override
public String getFront(boolean isActive) {
return isActive ? prefix + "rolling_machine_side_on" : prefix + "rolling_machine_side_off";
public String getFront(final boolean isActive) {
return isActive ? this.prefix + "rolling_machine_side_on" : this.prefix + "rolling_machine_side_off";
}
@Override
public String getSide(boolean isActive) {
return prefix + "machine_side";
public String getSide(final boolean isActive) {
return this.prefix + "machine_side";
}
@Override
public String getTop(boolean isActive) {
return prefix + "machine_top";
public String getTop(final boolean isActive) {
return this.prefix + "machine_top";
}
@Override
public String getBottom(boolean isActive) {
return prefix + "machine_bottom";
public String getBottom(final boolean isActive) {
return this.prefix + "machine_bottom";
}
}

View file

@ -4,10 +4,12 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.TileScrapboxinator;
@ -15,48 +17,48 @@ public class BlockScrapboxinator extends BlockMachineBase implements IRotationTe
private final String prefix = "techreborn:blocks/machine/greg_machines/";
public BlockScrapboxinator(Material material) {
public BlockScrapboxinator(final Material material) {
super();
setUnlocalizedName("techreborn.scrapboxinator");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.scrapboxinator");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
public TileEntity createNewTileEntity(final World p_149915_1_, final int p_149915_2_) {
return new TileScrapboxinator();
}
@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(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (!player.isSneaking()) {
player.openGui(Core.INSTANCE, GuiHandler.scrapboxinatorID, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.SCRAPBOXINATOR.ordinal(), world, x, y, z);
}
return true;
}
@Override
public String getFrontOff() {
return prefix + "scrapboxinator_front_off";
return this.prefix + "scrapboxinator_front_off";
}
@Override
public String getFrontOn() {
return prefix + "scrapboxinator_front_on";
return this.prefix + "scrapboxinator_front_on";
}
@Override
public String getSide() {
return prefix + "machine_side";
return this.prefix + "machine_side";
}
@Override
public String getTop() {
return prefix + "machine_top";
return this.prefix + "machine_top";
}
@Override
public String getBottom() {
return prefix + "machine_bottom";
return this.prefix + "machine_bottom";
}
}

View file

@ -8,10 +8,12 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IAdvancedRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.multiblock.TileVacuumFreezer;
@ -19,43 +21,43 @@ public class BlockVacuumFreezer extends BlockMachineBase implements IAdvancedRot
private final String prefix = "techreborn:blocks/machine/greg_machines/";
public BlockVacuumFreezer(Material material) {
public BlockVacuumFreezer(final Material material) {
super();
setUnlocalizedName("techreborn.vacuumfreezer");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.vacuumfreezer");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
public TileEntity createNewTileEntity(final World world, final int meta) {
return new TileVacuumFreezer();
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
public boolean onBlockActivated(final World world, final BlockPos pos, final IBlockState state, final EntityPlayer player, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
if (!player.isSneaking()) {
player.openGui(Core.INSTANCE, GuiHandler.vacuumFreezerID, world, pos.getX(), pos.getY(), pos.getZ());
player.openGui(Core.INSTANCE, EGui.VACUUM_FREEZER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
return true;
}
return false;
}
@Override
public String getFront(boolean isActive) {
return prefix + "vacuum_freezer_front";
public String getFront(final boolean isActive) {
return this.prefix + "vacuum_freezer_front";
}
@Override
public String getSide(boolean isActive) {
return prefix + "machine_side";
public String getSide(final boolean isActive) {
return this.prefix + "machine_side";
}
@Override
public String getTop(boolean isActive) {
return prefix + "vacuum_freezer_top";
public String getTop(final boolean isActive) {
return this.prefix + "vacuum_freezer_top";
}
@Override
public String getBottom(boolean isActive) {
return prefix + "machine_bottom";
public String getBottom(final boolean isActive) {
return this.prefix + "machine_bottom";
}
}

View file

@ -6,7 +6,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.init.ModBlocks;
import techreborn.tiles.TileAesu;
@ -15,17 +16,17 @@ import java.util.List;
public class BlockAESU extends BlockEnergyStorage {
public BlockAESU() {
super("AESU", GuiHandler.aesuID);
super("AESU", EGui.AESU.ordinal());
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
public TileEntity createNewTileEntity(final World world, final int p_149915_2_) {
return new TileAesu();
}
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
ArrayList<ItemStack> list = new ArrayList<>();
public List<ItemStack> getDrops(final IBlockAccess world, final BlockPos pos, final IBlockState state, final int fortune) {
final ArrayList<ItemStack> list = new ArrayList<>();
list.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 2));
return list;
}

View file

@ -6,7 +6,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.tiles.storage.TileBatBox;
import java.util.ArrayList;
@ -17,17 +18,17 @@ import java.util.List;
*/
public class BlockBatBox extends BlockEnergyStorage {
public BlockBatBox() {
super("Batbox", GuiHandler.batboxID);
super("Batbox", EGui.BATBOX.ordinal());
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
public TileEntity createNewTileEntity(final World world, final int p_149915_2_) {
return new TileBatBox();
}
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
ArrayList<ItemStack> list = new ArrayList<>();
public List<ItemStack> getDrops(final IBlockAccess world, final BlockPos pos, final IBlockState state, final int fortune) {
final ArrayList<ItemStack> list = new ArrayList<>();
list.add(new ItemStack(this));
return list;
}

View file

@ -8,7 +8,8 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.tiles.idsu.TileIDSU;
import java.util.ArrayList;
@ -16,18 +17,18 @@ import java.util.List;
public class BlockIDSU extends BlockEnergyStorage {
public BlockIDSU() {
super("IDSU", GuiHandler.idsuID);
super("IDSU", EGui.IDSU.ordinal());
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
public TileEntity createNewTileEntity(final World world, final int p_149915_2_) {
return new TileIDSU();
}
@Override
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY,
float hitZ, int meta, EntityLivingBase placer) {
TileEntity tile = world.getTileEntity(pos);
public IBlockState getStateForPlacement(final World world, final BlockPos pos, final EnumFacing facing, final float hitX, final float hitY,
final float hitZ, final int meta, final EntityLivingBase placer) {
final TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileIDSU) {
((TileIDSU) tile).ownerUdid = placer.getUniqueID().toString();
}
@ -35,8 +36,8 @@ public class BlockIDSU extends BlockEnergyStorage {
}
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
ArrayList<ItemStack> list = new ArrayList<>();
public List<ItemStack> getDrops(final IBlockAccess world, final BlockPos pos, final IBlockState state, final int fortune) {
final ArrayList<ItemStack> list = new ArrayList<>();
list.add(new ItemStack(this, 1, 2));
return list;
}

View file

@ -6,7 +6,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.tiles.lesu.TileLesu;
import java.util.ArrayList;
@ -14,17 +15,17 @@ import java.util.List;
public class BlockLESU extends BlockEnergyStorage {
public BlockLESU() {
super("LESU", GuiHandler.lesuID);
super("LESU", EGui.LESU.ordinal());
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
public TileEntity createNewTileEntity(final World world, final int p_149915_2_) {
return new TileLesu();
}
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
ArrayList<ItemStack> list = new ArrayList<>();
public List<ItemStack> getDrops(final IBlockAccess world, final BlockPos pos, final IBlockState state, final int fortune) {
final ArrayList<ItemStack> list = new ArrayList<>();
list.add(new ItemStack(this, 1, 2));
return list;
}

View file

@ -6,7 +6,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.init.ModBlocks;
import techreborn.tiles.storage.TileMFE;
@ -18,17 +19,17 @@ import java.util.List;
*/
public class BlockMFE extends BlockEnergyStorage {
public BlockMFE() {
super("MFE", GuiHandler.mfeID);
super("MFE", EGui.MFE.ordinal());
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
public TileEntity createNewTileEntity(final World world, final int p_149915_2_) {
return new TileMFE();
}
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
ArrayList<ItemStack> list = new ArrayList<>();
public List<ItemStack> getDrops(final IBlockAccess world, final BlockPos pos, final IBlockState state, final int fortune) {
final ArrayList<ItemStack> list = new ArrayList<>();
list.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 1));
return list;
}

View file

@ -6,7 +6,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.init.ModBlocks;
import techreborn.tiles.storage.TileMFSU;
@ -18,18 +19,18 @@ import java.util.List;
*/
public class BlockMFSU extends BlockEnergyStorage {
public BlockMFSU() {
super("MFSU", GuiHandler.mfsuID);
setHardness(2f);
super("MFSU", EGui.MFSU.ordinal());
this.setHardness(2f);
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
public TileEntity createNewTileEntity(final World world, final int p_149915_2_) {
return new TileMFSU();
}
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
ArrayList<ItemStack> list = new ArrayList<>();
public List<ItemStack> getDrops(final IBlockAccess world, final BlockPos pos, final IBlockState state, final int fortune) {
final ArrayList<ItemStack> list = new ArrayList<>();
list.add(new ItemStack(ModBlocks.MACHINE_FRAMES, 1, 1));
return list;
}

View file

@ -4,10 +4,12 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.TileAlloySmelter;
@ -15,47 +17,47 @@ public class BlockAlloySmelter extends BlockMachineBase implements IRotationText
private final String prefix = "techreborn:blocks/machine/tier1_machines/";
public BlockAlloySmelter(Material material) {
public BlockAlloySmelter(final Material material) {
super();
setUnlocalizedName("techreborn.alloysmelter");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.alloysmelter");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
public TileEntity createNewTileEntity(final World world, final int p_149915_2_) {
return new TileAlloySmelter();
}
@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(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.alloySmelterID, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.ALLOY_SMELTER.ordinal(), world, x, y, z);
return true;
}
@Override
public String getFrontOff() {
return prefix + "electric_alloy_furnace_front_off";
return this.prefix + "electric_alloy_furnace_front_off";
}
@Override
public String getFrontOn() {
return prefix + "electric_alloy_furnace_front_on";
return this.prefix + "electric_alloy_furnace_front_on";
}
@Override
public String getSide() {
return prefix + "tier1_machine_side";
return this.prefix + "tier1_machine_side";
}
@Override
public String getTop() {
return prefix + "tier1_machine_top";
return this.prefix + "tier1_machine_top";
}
@Override
public String getBottom() {
return prefix + "tier1_machine_bottom";
return this.prefix + "tier1_machine_bottom";
}
}

View file

@ -4,10 +4,12 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.teir1.TileCompressor;
@ -15,48 +17,48 @@ public class BlockCompressor extends BlockMachineBase implements IRotationTextur
private final String prefix = "techreborn:blocks/machine/tier1_machines/";
public BlockCompressor(Material material) {
public BlockCompressor(final Material material) {
super();
setUnlocalizedName("techreborn.compressor");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.compressor");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
public TileEntity createNewTileEntity(final World p_149915_1_, final int p_149915_2_) {
return new TileCompressor();
}
@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(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (!player.isSneaking()) {
player.openGui(Core.INSTANCE, GuiHandler.compressorID, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.COMPRESSOR.ordinal(), world, x, y, z);
}
return true;
}
@Override
public String getFrontOff() {
return prefix + "compressor_front_off";
return this.prefix + "compressor_front_off";
}
@Override
public String getFrontOn() {
return prefix + "compressor_front_on";
return this.prefix + "compressor_front_on";
}
@Override
public String getSide() {
return prefix + "tier1_machine_side";
return this.prefix + "tier1_machine_side";
}
@Override
public String getTop() {
return prefix + "tier1_machine_top";
return this.prefix + "tier1_machine_top";
}
@Override
public String getBottom() {
return prefix + "tier1_machine_bottom";
return this.prefix + "tier1_machine_bottom";
}
}

View file

@ -4,10 +4,12 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.teir1.TileElectricFurnace;
@ -15,48 +17,48 @@ public class BlockElectricFurnace extends BlockMachineBase implements IRotationT
private final String prefix = "techreborn:blocks/machine/tier1_machines/";
public BlockElectricFurnace(Material material) {
public BlockElectricFurnace(final Material material) {
super();
setUnlocalizedName("techreborn.electricfurnace");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.electricfurnace");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
public TileEntity createNewTileEntity(final World p_149915_1_, final int p_149915_2_) {
return new TileElectricFurnace();
}
@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(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (!player.isSneaking()) {
player.openGui(Core.INSTANCE, GuiHandler.electricFurnaceID, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.ELECTRIC_FURNACE.ordinal(), world, x, y, z);
}
return true;
}
@Override
public String getFrontOff() {
return prefix + "electric_furnace_front_off";
return this.prefix + "electric_furnace_front_off";
}
@Override
public String getFrontOn() {
return prefix + "electric_furnace_front_on";
return this.prefix + "electric_furnace_front_on";
}
@Override
public String getSide() {
return prefix + "tier1_machine_side";
return this.prefix + "tier1_machine_side";
}
@Override
public String getTop() {
return prefix + "tier1_machine_top";
return this.prefix + "tier1_machine_top";
}
@Override
public String getBottom() {
return prefix + "tier1_machine_bottom";
return this.prefix + "tier1_machine_bottom";
}
}

View file

@ -4,10 +4,12 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.teir1.TileExtractor;
@ -15,48 +17,48 @@ public class BlockExtractor extends BlockMachineBase implements IRotationTexture
private final String prefix = "techreborn:blocks/machine/tier1_machines/";
public BlockExtractor(Material material) {
public BlockExtractor(final Material material) {
super();
setUnlocalizedName("techreborn.extractor");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.extractor");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
public TileEntity createNewTileEntity(final World p_149915_1_, final int p_149915_2_) {
return new TileExtractor();
}
@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(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (!player.isSneaking()) {
player.openGui(Core.INSTANCE, GuiHandler.extractorID, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.EXTRACTOR.ordinal(), world, x, y, z);
}
return true;
}
@Override
public String getFrontOff() {
return prefix + "extractor_front_off";
return this.prefix + "extractor_front_off";
}
@Override
public String getFrontOn() {
return prefix + "extractor_front_on";
return this.prefix + "extractor_front_on";
}
@Override
public String getSide() {
return prefix + "tier1_machine_side";
return this.prefix + "tier1_machine_side";
}
@Override
public String getTop() {
return prefix + "tier1_machine_top";
return this.prefix + "tier1_machine_top";
}
@Override
public String getBottom() {
return prefix + "tier1_machine_bottom";
return this.prefix + "tier1_machine_bottom";
}
}

View file

@ -4,10 +4,12 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IAdvancedRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.teir1.TileGrinder;
@ -15,44 +17,44 @@ public class BlockGrinder extends BlockMachineBase implements IAdvancedRotationT
private final String prefix = "techreborn:blocks/machine/tier1_machines/";
public BlockGrinder(Material material) {
public BlockGrinder(final Material material) {
super();
setUnlocalizedName("techreborn.grinder");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.grinder");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
public TileEntity createNewTileEntity(final World p_149915_1_, final int p_149915_2_) {
return new TileGrinder();
}
@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(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (!player.isSneaking()) {
player.openGui(Core.INSTANCE, GuiHandler.grinderID, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.GRINDER.ordinal(), world, x, y, z);
}
return true;
}
@Override
public String getFront(boolean isActive) {
return isActive ? prefix + "grinder_front_on" : prefix + "grinder_front_off";
public String getFront(final boolean isActive) {
return isActive ? this.prefix + "grinder_front_on" : this.prefix + "grinder_front_off";
}
@Override
public String getSide(boolean isActive) {
return prefix + "tier1_machine_side";
public String getSide(final boolean isActive) {
return this.prefix + "tier1_machine_side";
}
@Override
public String getTop(boolean isActive) {
return isActive ? prefix + "grinder_top_on" : prefix + "grinder_top_off";
public String getTop(final boolean isActive) {
return isActive ? this.prefix + "grinder_top_on" : this.prefix + "grinder_top_off";
}
@Override
public String getBottom(boolean isActive) {
return prefix + "tier1_machine_bottom";
public String getBottom(final boolean isActive) {
return this.prefix + "tier1_machine_bottom";
}
}

View file

@ -4,10 +4,12 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.blocks.IRotationTexture;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.teir1.TileRecycler;
@ -15,48 +17,48 @@ public class BlockRecycler extends BlockMachineBase implements IRotationTexture
private final String prefix = "techreborn:blocks/machine/tier1_machines/";
public BlockRecycler(Material material) {
public BlockRecycler(final Material material) {
super();
setUnlocalizedName("techreborn.recycler");
setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.recycler");
this.setCreativeTab(TechRebornCreativeTab.instance);
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
public TileEntity createNewTileEntity(final World p_149915_1_, final int p_149915_2_) {
return new TileRecycler();
}
@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(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX,
final float hitY, final float hitZ) {
if (!player.isSneaking()) {
player.openGui(Core.INSTANCE, GuiHandler.recyclerID, world, x, y, z);
player.openGui(Core.INSTANCE, EGui.RECYCLER.ordinal(), world, x, y, z);
}
return true;
}
@Override
public String getFrontOff() {
return prefix + "recycler_front_off";
return this.prefix + "recycler_front_off";
}
@Override
public String getFrontOn() {
return prefix + "recycler_front_on";
return this.prefix + "recycler_front_on";
}
@Override
public String getSide() {
return prefix + "tier1_machine_side";
return this.prefix + "tier1_machine_side";
}
@Override
public String getTop() {
return prefix + "tier1_machine_top";
return this.prefix + "tier1_machine_top";
}
@Override
public String getBottom() {
return prefix + "tier1_machine_bottom";
return this.prefix + "tier1_machine_bottom";
}
}

View file

@ -0,0 +1,55 @@
package techreborn.client;
public enum EGui {
THERMAL_GENERATOR(true),
QUANTUM_TANK(true),
QUANTUM_CHEST(true),
CENTRIFUGE(true),
ROLLING_MACHINE(true),
BLAST_FURNACE(true),
ALLOY_SMELTER(true),
INDUSTRIAL_GRINDER(true),
IMPLOSION_COMPRESSOR(true),
MATTER_FABRICATOR(true),
MANUAL(false),
CHUNK_LOADER(true),
ASSEMBLING_MACHINE(true),
DIESEL_GENERATOR(true),
INDUSTRIAL_ELECTROLYZER(true),
AESU(false),
ALLOY_FURNACE(true),
SAWMILL(true),
CHEMICAL_REACTOR(true),
SEMIFLUID_GENERATOR(true),
GAS_TURBINE(true),
DIGITAL_CHEST(true),
DESTRUCTOPACK(false),
LESU(false),
IDSU(false),
CHARGEBENCH(true),
FUSION_CONTROLLER(true),
VACUUM_FREEZER(true),
GRINDER(true),
GENERATOR(true),
EXTRACTOR(true),
COMPRESSOR(true),
ELECTRIC_FURNACE(true),
IRON_FURNACE(true),
RECYCLER(true),
SCRAPBOXINATOR(true),
BATBOX(true),
MFSU(true),
MFE(true);
private final boolean containerBuilder;
private EGui(final boolean containerBuilder)
{
this.containerBuilder = containerBuilder;
}
public boolean useContainerBuilder() {
return this.containerBuilder;
}
}

View file

@ -1,22 +1,13 @@
package techreborn.client;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler;
import reborncore.api.recipe.RecipeHandler;
import reborncore.api.tile.IContainerLayout;
import reborncore.common.container.RebornContainer;
import reborncore.common.util.ItemUtils;
import techreborn.api.RollingMachineRecipe;
import techreborn.api.recipe.machines.AlloySmelterRecipe;
import techreborn.client.container.*;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.client.gui.*;
import techreborn.init.ModItems;
import techreborn.manual.GuiManual;
import techreborn.tiles.*;
import techreborn.tiles.fusionReactor.TileEntityFusionController;
@ -31,281 +22,27 @@ import techreborn.tiles.teir1.*;
public class GuiHandler implements IGuiHandler {
public static final int thermalGeneratorID = 0;
public static final int quantumTankID = 1;
public static final int quantumChestID = 2;
public static final int centrifugeID = 3;
public static final int rollingMachineID = 4;
public static final int blastFurnaceID = 5;
public static final int alloySmelterID = 6;
public static final int industrialGrinderID = 7;
public static final int implosionCompresserID = 8;
public static final int matterfabID = 9;
public static final int manuelID = 10;
public static final int chunkloaderID = 11;
public static final int assemblingmachineID = 12;
public static final int dieselGeneratorID = 15;
public static final int industrialElectrolyzerID = 16;
public static final int aesuID = 17;
public static final int alloyFurnaceID = 18;
public static final int sawMillID = 19;
public static final int chemicalReactorID = 20;
public static final int semifluidGeneratorID = 21;
public static final int gasTurbineID = 22;
public static final int digitalChestID = 23;
public static final int destructoPackID = 25;
public static final int lesuID = 26;
public static final int idsuID = 27;
public static final int chargeBench = 28;
public static final int fusionID = 29;
public static final int vacuumFreezerID = 30;
public static final int grinderID = 31;
public static final int generatorID = 32;
public static final int extractorID = 33;
public static final int compressorID = 34;
public static final int electricFurnaceID = 35;
public static final int ironFurnace = 36;
public static final int recyclerID = 37;
public static final int scrapboxinatorID = 38;
public static final int batboxID = 39;
public static final int mfsuID = 40;
public static final int mfeID = 41;
@Override
public Object getServerGuiElement(final int ID, final EntityPlayer player, final World world, final int x,
final int y, final int z) {
final RebornContainer container = null;
if (ID == GuiHandler.gasTurbineID || ID == GuiHandler.semifluidGeneratorID
|| ID == GuiHandler.thermalGeneratorID || ID == GuiHandler.dieselGeneratorID) {
return new ContainerBuilder("fluidgenerator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 80, 17)
.outputSlot(1, 80, 53).fakeSlot(2, 59, 42).syncEnergyValue().addInventory().create();
} else if (ID == GuiHandler.quantumTankID) {
return new ContainerQuantumTank((TileQuantumTank) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == GuiHandler.digitalChestID || ID == GuiHandler.quantumChestID) {
return new ContainerBuilder("digitalchest").player(player.inventory).inventory().hotbar().addInventory()
.tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 80, 17).outputSlot(1, 80, 53)
.fakeSlot(2, 59, 42).addInventory().create();
} else if (ID == GuiHandler.centrifugeID) {
return new ContainerBuilder("centrifuge").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 80, 35)
.slot(1, 50, 5).outputSlot(2, 80, 5).outputSlot(3, 110, 35).outputSlot(4, 80, 65)
.outputSlot(5, 50, 35).energySlot(6, 8, 51).upgradeSlot(7, 152, 8).upgradeSlot(8, 152, 26)
.upgradeSlot(9, 152, 44).upgradeSlot(10, 152, 62).syncEnergyValue().syncCrafterValue()
.addInventory().create();
} else if (ID == GuiHandler.rollingMachineID) {
return new ContainerBuilder("rollingmachine").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(((TileRollingMachine) world.getTileEntity(new BlockPos(x, y, z))).craftMatrix)
.slot(0, 30, 17).slot(1, 48, 17).slot(2, 66, 17).slot(3, 30, 35).slot(4, 48, 35).slot(5, 66, 35)
.slot(6, 30, 53).slot(7, 48, 53).slot(8, 66, 53)
.onCraft(inv -> ((TileRollingMachine) world.getTileEntity(new BlockPos(x, y, z))).inventory
.setInventorySlotContents(1, RollingMachineRecipe.instance.findMatchingRecipe(inv, world)))
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).outputSlot(0, 124, 35)
.energySlot(2, 8, 51).syncEnergyValue()
.syncIntegerValue(((TileRollingMachine) world.getTileEntity(new BlockPos(x, y, z)))::getBurnTime,
((TileRollingMachine) world.getTileEntity(new BlockPos(x, y, z)))::setBurnTime)
.addInventory().create();
} else if (ID == GuiHandler.blastFurnaceID) {
return new ContainerBuilder("blastfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 40, 25)
.slot(1, 40, 43).outputSlot(2, 100, 35).outputSlot(3, 118, 35).syncEnergyValue().syncCrafterValue()
.syncIntegerValue(((TileBlastFurnace) world.getTileEntity(new BlockPos(x, y, z)))::getHeat,
((TileBlastFurnace) world.getTileEntity(new BlockPos(x, y, z)))::setHeat)
.addInventory().create();
} else if (ID == GuiHandler.alloySmelterID) {
return new ContainerBuilder("alloysmelter").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z)))
.filterSlot(0, 47, 17, stack -> RecipeHandler.recipeList.stream()
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
&& ItemUtils.isItemEqual(recipe.getInputs().get(0), stack, true, true, true)))
.filterSlot(1, 65, 17, stack -> RecipeHandler.recipeList.stream()
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
&& ItemUtils.isItemEqual(recipe.getInputs().get(1), stack, true, true, true)))
.outputSlot(2, 116, 35).energySlot(3, 56, 53).upgradeSlot(4, 152, 8).upgradeSlot(5, 152, 26)
.upgradeSlot(6, 152, 44).upgradeSlot(7, 152, 62).syncEnergyValue().syncCrafterValue().addInventory()
.create();
} else if (ID == GuiHandler.industrialGrinderID) {
return new ContainerBuilder("industrialgrinder").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 32, 26)
.slot(1, 32, 44).outputSlot(2, 77, 35).outputSlot(3, 95, 35).outputSlot(4, 113, 35)
.outputSlot(5, 131, 35).syncEnergyValue().syncCrafterValue().addInventory().create();
} else if (ID == GuiHandler.implosionCompresserID) {
return new ContainerBuilder("implosioncompressor").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 37, 26)
.slot(1, 37, 44).outputSlot(2, 93, 35).outputSlot(3, 111, 35).syncEnergyValue().syncCrafterValue()
.addInventory().create();
} else if (ID == GuiHandler.matterfabID) {
return new ContainerBuilder("matterfabricator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 33, 17)
.slot(1, 33, 35).slot(2, 33, 53).slot(3, 51, 17).slot(4, 51, 35).slot(5, 51, 53)
.outputSlot(6, 116, 35).syncEnergyValue()
.syncIntegerValue(((TileMatterFabricator) world.getTileEntity(new BlockPos(x, y, z)))::getProgress,
((TileMatterFabricator) world.getTileEntity(new BlockPos(x, y, z)))::setProgress)
.addInventory().create();
} else if (ID == GuiHandler.assemblingmachineID) {
return new ContainerBuilder("assemblingmachine").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 47, 17)
.slot(1, 65, 17).outputSlot(2, 116, 35).energySlot(3, 56, 53).upgradeSlot(4, 152, 8)
.upgradeSlot(5, 152, 26).upgradeSlot(6, 152, 44).upgradeSlot(7, 152, 62).syncEnergyValue()
.syncCrafterValue().addInventory().create();
} else if (ID == GuiHandler.chunkloaderID) {
return new ContainerBuilder("chunkloader").player(player.inventory).inventory().hotbar().addInventory()
.create();
} else if (ID == GuiHandler.industrialElectrolyzerID) {
return new ContainerBuilder("industrialelectrolyzer").player(player.inventory).inventory(8, 84)
.hotbar(8, 142).addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z)))
.slot(0, 80, 51).slot(1, 50, 51).outputSlot(2, 50, 19).outputSlot(3, 70, 19).outputSlot(4, 90, 19)
.outputSlot(5, 110, 19).energySlot(6, 18, 51).syncEnergyValue().syncCrafterValue().addInventory()
.create();
} else if (ID == GuiHandler.aesuID) {
return new ContainerAESU((TileAesu) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == GuiHandler.alloyFurnaceID) {
return new ContainerBuilder("alloyfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z)))
.filterSlot(0, 47, 17, stack -> RecipeHandler.recipeList.stream()
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
&& ItemUtils.isItemEqual(recipe.getInputs().get(0), stack, true, true, true)))
.filterSlot(1, 65, 17, stack -> RecipeHandler.recipeList.stream()
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
&& ItemUtils.isItemEqual(recipe.getInputs().get(1), stack, true, true, true)))
.outputSlot(2, 116, 35).fuelSlot(3, 56, 53)
.syncIntegerValue(((TileAlloyFurnace) world.getTileEntity(new BlockPos(x, y, z)))::getBurnTime,
((TileAlloyFurnace) world.getTileEntity(new BlockPos(x, y, z)))::setBurnTime)
.syncIntegerValue(((TileAlloyFurnace) world.getTileEntity(new BlockPos(x, y, z)))::getCookTime,
((TileAlloyFurnace) world.getTileEntity(new BlockPos(x, y, z)))::setCookTime)
.syncIntegerValue(
((TileAlloyFurnace) world.getTileEntity(new BlockPos(x, y, z)))::getCurrentItemBurnTime,
((TileAlloyFurnace) world.getTileEntity(new BlockPos(x, y, z)))::setCurrentItemBurnTime)
.addInventory().create();
} else if (ID == GuiHandler.sawMillID) {
return new ContainerBuilder("industrialsawmill").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 32, 26)
.slot(1, 32, 44).outputSlot(2, 84, 35).outputSlot(3, 102, 35).outputSlot(4, 120, 35)
.syncEnergyValue().addInventory().create();
} else if (ID == GuiHandler.chemicalReactorID) {
return new ContainerBuilder("chemicalreactor").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 70, 21)
.slot(1, 90, 21).outputSlot(2, 80, 51).energySlot(3, 8, 51).upgradeSlot(4, 152, 8)
.upgradeSlot(5, 152, 26).upgradeSlot(6, 152, 44).upgradeSlot(7, 152, 62).syncEnergyValue()
.syncCrafterValue().addInventory().create();
} else if (ID == GuiHandler.manuelID) {
return null;
} else if (ID == GuiHandler.destructoPackID) {
return new ContainerDestructoPack(player);
} else if (ID == GuiHandler.lesuID) {
return new ContainerLESU((TileLesu) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == GuiHandler.idsuID) {
return new ContainerIDSU((TileIDSU) world.getTileEntity(new BlockPos(x, y, z)), player);
} else if (ID == GuiHandler.fusionID) {
return new ContainerBuilder("fusionreactor").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 88, 17)
.slot(1, 88, 53).outputSlot(2, 148, 35).syncEnergyValue()
.syncIntegerValue(
((TileEntityFusionController) world.getTileEntity(new BlockPos(x, y, z)))::getCoilStatus,
((TileEntityFusionController) world.getTileEntity(new BlockPos(x, y, z)))::setCoilStatus)
.syncIntegerValue(
((TileEntityFusionController) world
.getTileEntity(new BlockPos(x, y, z)))::getCrafingTickTime,
((TileEntityFusionController) world
.getTileEntity(new BlockPos(x, y, z)))::setCrafingTickTime)
.syncIntegerValue(
((TileEntityFusionController) world.getTileEntity(new BlockPos(x, y, z)))::getFinalTickTime,
((TileEntityFusionController) world.getTileEntity(new BlockPos(x, y, z)))::setFinalTickTime)
.syncIntegerValue(
((TileEntityFusionController) world.getTileEntity(new BlockPos(x, y, z)))::getNeededPower,
((TileEntityFusionController) world.getTileEntity(new BlockPos(x, y, z)))::setNeededPower)
.addInventory().create();
} else if (ID == GuiHandler.chargeBench) {
return new ContainerBuilder("chargebench").player(player.inventory).inventory().hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).energySlot(0, 62, 21)
.energySlot(1, 80, 21).energySlot(2, 98, 21).energySlot(3, 62, 39).energySlot(4, 80, 39)
.energySlot(5, 98, 39).syncEnergyValue().addInventory().create();
} else if (ID == GuiHandler.vacuumFreezerID) {
return new ContainerBuilder("vacuumfreezer").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 56, 34)
.outputSlot(1, 116, 35).syncEnergyValue().syncCrafterValue().addInventory().create();
} else if (ID == GuiHandler.generatorID) {
return new ContainerBuilder("generator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).fuelSlot(0, 80, 53)
.energySlot(1, 80, 17).syncEnergyValue()
.syncIntegerValue(((TileGenerator) world.getTileEntity(new BlockPos(x, y, z)))::getBurnTime,
((TileGenerator) world.getTileEntity(new BlockPos(x, y, z)))::setBurnTime)
.syncIntegerValue(((TileGenerator) world.getTileEntity(new BlockPos(x, y, z)))::getTotalBurnTime,
((TileGenerator) world.getTileEntity(new BlockPos(x, y, z)))::setTotalBurnTime)
.addInventory().create();
} else if (ID == GuiHandler.compressorID) {
return new ContainerBuilder("compressor").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 56, 34)
.outputSlot(1, 116, 34).upgradeSlot(2, 152, 8).upgradeSlot(3, 152, 26).upgradeSlot(4, 152, 44)
.upgradeSlot(5, 152, 62).syncEnergyValue().syncCrafterValue().addInventory().create();
} else if (ID == GuiHandler.extractorID) {
return new ContainerBuilder("extractor").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 56, 34)
.outputSlot(1, 116, 34).upgradeSlot(2, 152, 8).upgradeSlot(3, 152, 26).upgradeSlot(4, 152, 44)
.upgradeSlot(5, 152, 62).syncEnergyValue().syncCrafterValue().addInventory().create();
} else if (ID == GuiHandler.grinderID) {
return new ContainerBuilder("grinder").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 56, 34)
.outputSlot(1, 116, 34).upgradeSlot(2, 152, 8).upgradeSlot(3, 152, 26).upgradeSlot(4, 152, 44)
.upgradeSlot(5, 152, 62).syncEnergyValue().syncCrafterValue().addInventory().create();
} else if (ID == GuiHandler.electricFurnaceID) {
return new ContainerBuilder("electricfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 56, 34)
.outputSlot(1, 116, 34).upgradeSlot(2, 152, 8).upgradeSlot(3, 152, 26).upgradeSlot(4, 152, 44)
.upgradeSlot(5, 152, 62).syncEnergyValue()
.syncIntegerValue(((TileElectricFurnace) world.getTileEntity(new BlockPos(x, y, z)))::getBurnTime,
((TileElectricFurnace) world.getTileEntity(new BlockPos(x, y, z)))::setBurnTime)
.addInventory().create();
} else if (ID == GuiHandler.ironFurnace) {
return new ContainerBuilder("ironfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 56, 17)
.outputSlot(1, 116, 34).fuelSlot(2, 56, 53)
.syncIntegerValue(((TileIronFurnace) world.getTileEntity(new BlockPos(x, y, z)))::getBurnTime,
((TileIronFurnace) world.getTileEntity(new BlockPos(x, y, z)))::setBurnTime)
.syncIntegerValue(((TileIronFurnace) world.getTileEntity(new BlockPos(x, y, z)))::getTotalBurnTime,
((TileIronFurnace) world.getTileEntity(new BlockPos(x, y, z)))::setTotalBurnTime)
.addInventory().create();
} else if (ID == GuiHandler.recyclerID) {
return new ContainerBuilder("recycler").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 56, 34)
.slot(1, 116, 34).upgradeSlot(2, 152, 8).upgradeSlot(3, 152, 26).upgradeSlot(4, 152, 44)
.upgradeSlot(5, 152, 62).syncEnergyValue()
.syncIntegerValue(((TileRecycler) world.getTileEntity(new BlockPos(x, y, z)))::getProgress,
((TileRecycler) world.getTileEntity(new BlockPos(x, y, z)))::setProgress)
.addInventory().create();
} else if (ID == GuiHandler.scrapboxinatorID) {
return new ContainerBuilder("scrapboxinator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z)))
.filterSlot(0, 56, 34, stack -> stack.getItem() == ModItems.SCRAP_BOX).outputSlot(1, 116, 34)
.upgradeSlot(2, 152, 8).upgradeSlot(3, 152, 26).upgradeSlot(4, 152, 44).upgradeSlot(5, 152, 62)
.syncEnergyValue()
.syncIntegerValue(((TileScrapboxinator) world.getTileEntity(new BlockPos(x, y, z)))::getProgress,
((TileScrapboxinator) world.getTileEntity(new BlockPos(x, y, z)))::setProgress)
.addInventory().create();
} else if (ID == GuiHandler.batboxID) {
return new ContainerBuilder("batbox").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).energySlot(0, 80, 17)
.energySlot(1, 80, 53).syncEnergyValue().addInventory().create();
} else if (ID == GuiHandler.mfeID) {
return new ContainerBuilder("mfe").player(player.inventory).inventory(8, 84).hotbar(8, 142).armor()
.complete(44, 6).addArmor().addInventory()
.tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).energySlot(0, 80, 17)
.energySlot(1, 80, 53).syncEnergyValue().addInventory().create();
} else if (ID == GuiHandler.mfsuID) {
return new ContainerBuilder("mfsu").player(player.inventory).inventory(8, 84).hotbar(8, 142).armor()
.complete(44, 6).addArmor().addInventory()
.tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).energySlot(0, 80, 17)
.energySlot(1, 80, 53).syncEnergyValue().addInventory().create();
}
if (container != null) {
if (container instanceof IContainerLayout) {
final IContainerLayout layout = (IContainerLayout) container;
layout.setTile(world.getTileEntity(new BlockPos(x, y, z)));
layout.setPlayer(player);
layout.addInventorySlots();
layout.addPlayerSlots();
}
return container;
final EGui gui = EGui.values()[ID];
final TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
if (gui.useContainerBuilder() && tile != null)
return ((IContainerProvider) tile).createContainer(player);
switch (gui) {
case AESU:
return new ContainerAESU((TileAesu) tile, player);
case DESTRUCTOPACK:
return new ContainerDestructoPack(player);
case LESU:
return new ContainerLESU((TileLesu) tile, player);
case IDSU:
return new ContainerIDSU((TileIDSU) tile, player);
default:
break;
}
return null;
}
@ -313,88 +50,91 @@ public class GuiHandler implements IGuiHandler {
@Override
public Object getClientGuiElement(final int ID, final EntityPlayer player, final World world, final int x,
final int y, final int z) {
if (ID == GuiHandler.thermalGeneratorID) {
return new GuiThermalGenerator(player, (TileThermalGenerator) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.semifluidGeneratorID) {
return new GuiSemifluidGenerator(player,
(TileSemifluidGenerator) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.gasTurbineID) {
return new GuiGasTurbine(player, (TileGasTurbine) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.quantumTankID) {
return new GuiQuantumTank(player, (TileQuantumTank) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.digitalChestID) {
return new GuiDigitalChest(player, (TileDigitalChest) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.quantumChestID) {
return new GuiQuantumChest(player, (TileQuantumChest) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.centrifugeID) {
return new GuiCentrifuge(player, (TileCentrifuge) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.rollingMachineID) {
return new GuiRollingMachine(player, (TileRollingMachine) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.blastFurnaceID) {
return new GuiBlastFurnace(player, (TileBlastFurnace) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.alloySmelterID) {
return new GuiAlloySmelter(player, (TileAlloySmelter) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.industrialGrinderID) {
return new GuiIndustrialGrinder(player, (TileIndustrialGrinder) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.implosionCompresserID) {
return new GuiImplosionCompressor(player,
(TileImplosionCompressor) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.matterfabID) {
return new GuiMatterFabricator(player, (TileMatterFabricator) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.chunkloaderID) {
return new GuiChunkLoader(player, (TileChunkLoader) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.assemblingmachineID) {
return new GuiAssemblingMachine(player, (TileAssemblingMachine) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.dieselGeneratorID) {
return new GuiDieselGenerator(player, (TileDieselGenerator) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.industrialElectrolyzerID) {
return new GuiIndustrialElectrolyzer(player,
(TileIndustrialElectrolyzer) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.aesuID) {
return new GuiAESU(player, (TileAesu) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.alloyFurnaceID) {
return new GuiAlloyFurnace(player, (TileAlloyFurnace) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.sawMillID) {
return new GuiIndustrialSawmill(player, (TileIndustrialSawmill) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.chemicalReactorID) {
return new GuiChemicalReactor(player, (TileChemicalReactor) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.manuelID) {
return new GuiManual();
} else if (ID == GuiHandler.destructoPackID) {
return new GuiDestructoPack(new ContainerDestructoPack(player));
} else if (ID == GuiHandler.lesuID) {
return new GuiLESU(player, (TileLesu) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.idsuID) {
return new GuiIDSU(player, (TileIDSU) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.chargeBench) {
return new GuiChargeBench(player, (TileChargeBench) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.fusionID) {
return new GuiFusionReactor(player,
(TileEntityFusionController) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.vacuumFreezerID) {
return new GuiVacuumFreezer(player, (TileVacuumFreezer) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.grinderID) {
return new GuiGrinder(player, (TileGrinder) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.generatorID) {
return new GuiGenerator(player, (TileGenerator) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.extractorID) {
return new GuiExtractor(player, (TileExtractor) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.compressorID) {
return new GuiCompressor(player, (TileCompressor) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.electricFurnaceID) {
return new GuiElectricFurnace(player, (TileElectricFurnace) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.ironFurnace) {
return new GuiIronFurnace(player, (TileIronFurnace) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.recyclerID) {
return new GuiRecycler(player, (TileRecycler) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.scrapboxinatorID) {
return new GuiScrapboxinator(player, (TileScrapboxinator) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.batboxID) {
return new GuiBatbox(player, (TileBatBox) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.mfsuID) {
return new GuiMFSU(player, (TileMFSU) world.getTileEntity(new BlockPos(x, y, z)));
} else if (ID == GuiHandler.mfeID) {
return new GuiMFE(player, (TileMFE) world.getTileEntity(new BlockPos(x, y, z)));
final EGui gui = EGui.values()[ID];
final TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
switch (gui) {
case AESU:
return new GuiAESU(player, (TileAesu) tile);
case ALLOY_FURNACE:
return new GuiAlloyFurnace(player, (TileAlloyFurnace) tile);
case ALLOY_SMELTER:
return new GuiAlloySmelter(player, (TileAlloySmelter) tile);
case ASSEMBLING_MACHINE:
return new GuiAssemblingMachine(player, (TileAssemblingMachine) tile);
case BATBOX:
return new GuiBatbox(player, (TileBatBox) tile);
case BLAST_FURNACE:
return new GuiBlastFurnace(player, (TileBlastFurnace) tile);
case CENTRIFUGE:
return new GuiCentrifuge(player, (TileCentrifuge) tile);
case CHARGEBENCH:
return new GuiChargeBench(player, (TileChargeBench) tile);
case CHEMICAL_REACTOR:
return new GuiChemicalReactor(player, (TileChemicalReactor) tile);
case CHUNK_LOADER:
return new GuiChunkLoader(player, (TileChunkLoader) tile);
case COMPRESSOR:
return new GuiCompressor(player, (TileCompressor) tile);
case DESTRUCTOPACK:
return new GuiDestructoPack(new ContainerDestructoPack(player));
case DIESEL_GENERATOR:
return new GuiDieselGenerator(player, (TileDieselGenerator) tile);
case DIGITAL_CHEST:
return new GuiDigitalChest(player, (TileDigitalChest) tile);
case ELECTRIC_FURNACE:
return new GuiElectricFurnace(player, (TileElectricFurnace) tile);
case EXTRACTOR:
return new GuiExtractor(player, (TileExtractor) tile);
case FUSION_CONTROLLER:
return new GuiFusionReactor(player, (TileEntityFusionController) tile);
case GAS_TURBINE:
return new GuiGasTurbine(player, (TileGasTurbine) tile);
case GENERATOR:
return new GuiGenerator(player, (TileGenerator) tile);
case GRINDER:
return new GuiGrinder(player, (TileGrinder) tile);
case IDSU:
return new GuiIDSU(player, (TileIDSU) tile);
case IMPLOSION_COMPRESSOR:
return new GuiImplosionCompressor(player, (TileImplosionCompressor) tile);
case INDUSTRIAL_ELECTROLYZER:
return new GuiIndustrialElectrolyzer(player, (TileIndustrialElectrolyzer) tile);
case INDUSTRIAL_GRINDER:
return new GuiIndustrialGrinder(player, (TileIndustrialGrinder) tile);
case IRON_FURNACE:
return new GuiIronFurnace(player, (TileIronFurnace) tile);
case LESU:
return new GuiLESU(player, (TileLesu) tile);
case MANUAL:
return new GuiManual();
case MATTER_FABRICATOR:
return new GuiMatterFabricator(player, (TileMatterFabricator) tile);
case MFE:
return new GuiMFE(player, (TileMFE) tile);
case MFSU:
return new GuiMFSU(player, (TileMFSU) tile);
case QUANTUM_CHEST:
return new GuiQuantumChest(player, (TileQuantumChest) tile);
case QUANTUM_TANK:
return new GuiQuantumTank(player, (TileQuantumTank) tile);
case RECYCLER:
return new GuiRecycler(player, (TileRecycler) tile);
case ROLLING_MACHINE:
return new GuiRollingMachine(player, (TileRollingMachine) tile);
case SAWMILL:
return new GuiIndustrialSawmill(player, (TileIndustrialSawmill) tile);
case SCRAPBOXINATOR:
return new GuiScrapboxinator(player, (TileScrapboxinator) tile);
case SEMIFLUID_GENERATOR:
return new GuiSemifluidGenerator(player, (TileSemifluidGenerator) tile);
case THERMAL_GENERATOR:
return new GuiThermalGenerator(player, (TileThermalGenerator) tile);
case VACUUM_FREEZER:
return new GuiVacuumFreezer(player, (TileVacuumFreezer) tile);
default:
break;
}
return null;
}

View file

@ -1,41 +0,0 @@
package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer;
import reborncore.client.gui.slots.BaseSlot;
import reborncore.client.gui.slots.SlotFake;
import reborncore.client.gui.slots.SlotFluid;
import reborncore.client.gui.slots.SlotOutput;
import reborncore.common.container.RebornContainer;
import techreborn.tiles.TileQuantumTank;
public class ContainerQuantumTank extends RebornContainer {
public TileQuantumTank tileQuantumTank;
public EntityPlayer player;
public ContainerQuantumTank(TileQuantumTank tileQuantumTank, EntityPlayer player) {
super();
this.tileQuantumTank = tileQuantumTank;
this.player = player;
this.addSlotToContainer(new SlotFluid(tileQuantumTank.inventory, 0, 80, 17));
this.addSlotToContainer(new SlotOutput(tileQuantumTank.inventory, 1, 80, 53));
this.addSlotToContainer(new SlotFake(tileQuantumTank.inventory, 2, 59, 42, false, false, 1));
int i;
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new BaseSlot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new BaseSlot(player.inventory, i, 8 + i * 18, 142));
}
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
}

View file

@ -0,0 +1,9 @@
package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer;
import techreborn.client.container.builder.BuiltContainer;
public interface IContainerProvider {
BuiltContainer createContainer(EntityPlayer player);
}

View file

@ -2,24 +2,26 @@ package techreborn.client.container.builder.slot;
import net.minecraft.inventory.IInventory;
import net.minecraft.util.ResourceLocation;
import techreborn.lib.ModInfo;
public class SpriteSlot extends FilteredSlot {
int stacksize;
public SpriteSlot(final IInventory inventory, final int index, final int xPosition, final int yPosition, String sprite, int stacksize) {
public SpriteSlot(final IInventory inventory, final int index, final int xPosition, final int yPosition, final String sprite, final int stacksize) {
super(inventory, index, xPosition, yPosition);
this.setBackgroundLocation(new ResourceLocation(ModInfo.MOD_ID.toLowerCase() + ":textures/gui/slot_sprites/" + sprite + ".png"));
this.setBackgroundLocation(
new ResourceLocation(ModInfo.MOD_ID + ":textures/gui/slot_sprites/" + sprite + ".png"));
this.stacksize = stacksize;
}
public SpriteSlot(final IInventory inventory, final int index, final int xPosition, final int yPosition, String sprite) {
public SpriteSlot(final IInventory inventory, final int index, final int xPosition, final int yPosition, final String sprite) {
this(inventory, index, xPosition, yPosition, sprite, 64);
}
@Override
public int getSlotStackLimit() {
return stacksize;
return this.stacksize;
}
}

View file

@ -6,11 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import reborncore.api.recipe.RecipeHandler;
import reborncore.common.util.ItemUtils;
import techreborn.api.recipe.machines.AlloySmelterRecipe;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileAlloyFurnace;
public class GuiAlloyFurnace extends GuiContainer {
@ -20,25 +15,11 @@ public class GuiAlloyFurnace extends GuiContainer {
TileAlloyFurnace alloyfurnace;
public GuiAlloyFurnace(final EntityPlayer player, final TileAlloyFurnace tileAlloyFurnace) {
super(new ContainerBuilder("alloyfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(tileAlloyFurnace)
.filterSlot(0, 47, 17,
stack -> RecipeHandler.recipeList.stream()
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
&& ItemUtils.isItemEqual(recipe.getInputs().get(0), stack, true, true, true)))
.filterSlot(1, 65, 17,
stack -> RecipeHandler.recipeList.stream()
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
&& ItemUtils.isItemEqual(recipe.getInputs().get(1), stack, true, true, true)))
.outputSlot(2, 116, 35).fuelSlot(3, 56, 53)
.syncIntegerValue(tileAlloyFurnace::getBurnTime, tileAlloyFurnace::setBurnTime)
.syncIntegerValue(tileAlloyFurnace::getCookTime, tileAlloyFurnace::setCookTime)
.syncIntegerValue(tileAlloyFurnace::getCurrentItemBurnTime, tileAlloyFurnace::setCurrentItemBurnTime)
.addInventory().create());
public GuiAlloyFurnace(final EntityPlayer player, final TileAlloyFurnace alloyFurnace) {
super(alloyFurnace.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.alloyfurnace = tileAlloyFurnace;
this.alloyfurnace = alloyFurnace;
}
@Override

View file

@ -6,11 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import reborncore.api.recipe.RecipeHandler;
import reborncore.common.util.ItemUtils;
import techreborn.api.recipe.machines.AlloySmelterRecipe;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileAlloySmelter;
public class GuiAlloySmelter extends GuiContainer {
@ -20,23 +15,11 @@ public class GuiAlloySmelter extends GuiContainer {
TileAlloySmelter alloysmelter;
public GuiAlloySmelter(final EntityPlayer player, final TileAlloySmelter tilealloysmelter) {
super(new ContainerBuilder("alloysmelter").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(tilealloysmelter)
.filterSlot(0, 47, 17,
stack -> RecipeHandler.recipeList.stream()
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
&& ItemUtils.isItemEqual(recipe.getInputs().get(0), stack, true, true, true)))
.filterSlot(1, 65, 17,
stack -> RecipeHandler.recipeList.stream()
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
&& ItemUtils.isItemEqual(recipe.getInputs().get(1), stack, true, true, true)))
.outputSlot(2, 116, 35).energySlot(3, 56, 53).upgradeSlot(4, 152, 8).upgradeSlot(5, 152, 26)
.upgradeSlot(6, 152, 44).upgradeSlot(7, 152, 62).syncEnergyValue().syncCrafterValue().addInventory()
.create());
public GuiAlloySmelter(final EntityPlayer player, final TileAlloySmelter alloySmelter) {
super(alloySmelter.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.alloysmelter = tilealloysmelter;
this.alloysmelter = alloySmelter;
}
@Override

View file

@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileAssemblingMachine;
public class GuiAssemblingMachine extends GuiContainer {
@ -17,10 +16,7 @@ public class GuiAssemblingMachine extends GuiContainer {
TileAssemblingMachine assemblingmachine;
public GuiAssemblingMachine(final EntityPlayer player, final TileAssemblingMachine assemblingMachine) {
super(new ContainerBuilder("assemblingmachine").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(assemblingMachine).slot(0, 47, 17).slot(1, 65, 17).outputSlot(2, 116, 35)
.energySlot(3, 56, 53).upgradeSlot(4, 152, 8).upgradeSlot(5, 152, 26).upgradeSlot(6, 152, 44)
.upgradeSlot(7, 152, 62).syncEnergyValue().syncCrafterValue().addInventory().create());
super(assemblingMachine.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.assemblingmachine = assemblingMachine;

View file

@ -2,8 +2,9 @@ package techreborn.client.gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import reborncore.common.powerSystem.PowerSystem;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.storage.TileBatBox;
public class GuiBatbox extends GuiBase {
@ -11,27 +12,27 @@ public class GuiBatbox extends GuiBase {
TileBatBox tile;
public GuiBatbox(final EntityPlayer player, final TileBatBox tile) {
super(player, tile, new ContainerBuilder("batbox").player(player.inventory).inventory().hotbar().addInventory().tile(tile).energySlot(0, 62, 45).energySlot(1, 98, 45).syncEnergyValue().addInventory().create());
super(player, tile, tile.createContainer(player));
this.tile = tile;
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
Layer layer = Layer.BACKGROUND;
final Layer layer = Layer.BACKGROUND;
drawSlot(62, 45, layer);
drawSlot(98, 45, layer);
this.drawSlot(62, 45, layer);
this.drawSlot(98, 45, layer);
}
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
Layer layer = Layer.FOREGROUND;
final Layer layer = Layer.FOREGROUND;
builder.drawMultiEnergyBar(this, 81, 28, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer);
this.builder.drawMultiEnergyBar(this, 81, 28, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
GlStateManager.scale(0.6, 0.6, 5);
drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) (tile.getEnergy())) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) (tile.getMaxPower())) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer);
this.drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.tile.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.tile.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer);
GlStateManager.scale(1, 1, 1);
}
}

View file

@ -17,7 +17,6 @@ import reborncore.client.multiblock.MultiblockSet;
import reborncore.common.misc.Location;
import reborncore.common.multiblock.CoordTriplet;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.init.ModBlocks;
import techreborn.proxies.ClientProxy;
import techreborn.tiles.multiblock.TileBlastFurnace;
@ -33,14 +32,11 @@ public class GuiBlastFurnace extends GuiContainer {
boolean hasMultiBlock;
public GuiBlastFurnace(final EntityPlayer player, final TileBlastFurnace tileblastfurnace) {
super(new ContainerBuilder("blastfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(tileblastfurnace).slot(0, 40, 25).slot(1, 40, 43).outputSlot(2, 100, 35)
.outputSlot(3, 118, 35).syncEnergyValue().syncCrafterValue()
.syncIntegerValue(tileblastfurnace::getHeat, tileblastfurnace::setHeat).addInventory().create());
public GuiBlastFurnace(final EntityPlayer player, final TileBlastFurnace blastFurnace) {
super(blastFurnace.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.blastfurnace = tileblastfurnace;
this.blastfurnace = blastFurnace;
}
@Override

View file

@ -1,19 +1,16 @@
package techreborn.client.gui;
import net.minecraft.entity.player.EntityPlayer;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileCentrifuge;
public class GuiCentrifuge extends GuiBase {
TileCentrifuge tile;
TileCentrifuge centrifuge;
public GuiCentrifuge(final EntityPlayer player, final TileCentrifuge tile) {
super(player, tile, new ContainerBuilder("centrifuge").player(player.inventory).inventory().hotbar().addInventory()
.tile(tile).slot(0, 40, 34).slot(1, 40, 54).outputSlot(2, 82, 44).outputSlot(3, 101, 25)
.outputSlot(4, 120, 44).outputSlot(5, 101, 63).energySlot(6, 8, 72).syncEnergyValue()
.syncCrafterValue().addInventory().create());
this.tile = tile;
public GuiCentrifuge(final EntityPlayer player, final TileCentrifuge centrifuge) {
super(player, centrifuge, centrifuge.createContainer(player));
this.centrifuge = centrifuge;
}
@Override
@ -24,29 +21,29 @@ public class GuiCentrifuge extends GuiBase {
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
Layer layer = Layer.BACKGROUND;
final Layer layer = Layer.BACKGROUND;
drawSlot(8, 72, layer);
this.drawSlot(8, 72, layer);
drawSlot(40, 34, layer);
drawSlot(40, 54, layer);
this.drawSlot(40, 34, layer);
this.drawSlot(40, 54, layer);
drawSlot(82, 44, layer);
drawSlot(101, 25, layer);
drawSlot(120, 44, layer);
drawSlot(101, 63, layer);
this.drawSlot(82, 44, layer);
this.drawSlot(101, 25, layer);
this.drawSlot(120, 44, layer);
this.drawSlot(101, 63, layer);
builder.drawJEIButton(this, 150, 4, mouseX, mouseY, layer);
this.builder.drawJEIButton(this, 150, 4, mouseX, mouseY, layer);
}
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
Layer layer = Layer.FOREGROUND;
final Layer layer = Layer.FOREGROUND;
builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 61, 47, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(this, 9, 18, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer);
this.builder.drawProgressBar(this, this.centrifuge.getProgressScaled(100), 100, 61, 47, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer);
this.builder.drawMultiEnergyBar(this, 9, 18, (int) this.centrifuge.getEnergy(), (int) this.centrifuge.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileChargeBench;
public class GuiChargeBench extends GuiContainer {
@ -15,13 +14,11 @@ public class GuiChargeBench extends GuiContainer {
TileChargeBench chargebench;
public GuiChargeBench(final EntityPlayer player, final TileChargeBench tile) {
super(new ContainerBuilder("charbench").player(player.inventory).inventory(8, 84).hotbar(8, 142).addInventory()
.tile(tile).energySlot(0, 62, 21).energySlot(1, 80, 21).energySlot(2, 98, 21).energySlot(3, 62, 39)
.energySlot(4, 80, 39).energySlot(5, 98, 39).syncEnergyValue().addInventory().create());
public GuiChargeBench(final EntityPlayer player, final TileChargeBench chargeBench) {
super(chargeBench.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.chargebench = tile;
this.chargebench = chargeBench;
}
@Override

View file

@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileChemicalReactor;
public class GuiChemicalReactor extends GuiContainer {
@ -16,14 +15,11 @@ public class GuiChemicalReactor extends GuiContainer {
TileChemicalReactor chemicalReactor;
public GuiChemicalReactor(final EntityPlayer player, final TileChemicalReactor tilechemicalReactor) {
super(new ContainerBuilder("chemicalreactor").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(tilechemicalReactor).slot(0, 70, 21).slot(1, 90, 21).outputSlot(2, 80, 51)
.energySlot(3, 8, 51).upgradeSlot(4, 152, 8).upgradeSlot(5, 152, 26).upgradeSlot(6, 152, 44)
.upgradeSlot(7, 152, 62).syncEnergyValue().syncCrafterValue().addInventory().create());
public GuiChemicalReactor(final EntityPlayer player, final TileChemicalReactor chemicalReactor) {
super(chemicalReactor.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.chemicalReactor = tilechemicalReactor;
this.chemicalReactor = chemicalReactor;
}
@Override

View file

@ -7,7 +7,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileChunkLoader;
public class GuiChunkLoader extends GuiContainer {
@ -20,12 +19,11 @@ public class GuiChunkLoader extends GuiContainer {
private GuiButton minusOneButton;
private GuiButton minusTenButton;
public GuiChunkLoader(final EntityPlayer player, final TileChunkLoader tilechunkloader) {
super(new ContainerBuilder("chunkloader").player(player.inventory).inventory().hotbar().addInventory()
.create());
public GuiChunkLoader(final EntityPlayer player, final TileChunkLoader chunkLoader) {
super(chunkLoader.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.chunkloader = tilechunkloader;
this.chunkloader = chunkLoader;
}
@Override

View file

@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.teir1.TileCompressor;
public class GuiCompressor extends GuiContainer {
@ -16,10 +15,7 @@ public class GuiCompressor extends GuiContainer {
TileCompressor compressor;
public GuiCompressor(final EntityPlayer player, final TileCompressor compressor) {
super(new ContainerBuilder("compressor").player(player.inventory).inventory(8, 84).hotbar(8, 142).addInventory()
.tile(compressor).slot(0, 56, 34).outputSlot(1, 116, 34).upgradeSlot(2, 152, 8).upgradeSlot(3, 152, 26)
.upgradeSlot(4, 152, 44).upgradeSlot(5, 152, 62).syncEnergyValue().syncCrafterValue().addInventory()
.create());
super(compressor.createContainer(player));
this.xSize = 176;
this.ySize = 167;

View file

@ -8,7 +8,6 @@ import net.minecraft.util.text.translation.I18n;
import reborncore.common.powerSystem.PowerSystem;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.generator.TileDieselGenerator;
public class GuiDieselGenerator extends GuiContainer {
@ -16,15 +15,13 @@ public class GuiDieselGenerator extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/diesel_generator.png");
TileDieselGenerator tile;
TileDieselGenerator dieselGenerator;
public GuiDieselGenerator(final EntityPlayer player, final TileDieselGenerator tile) {
super(new ContainerBuilder("fluidgenerator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(tile).slot(0, 80, 17).outputSlot(1, 80, 53).fakeSlot(2, 59, 42).syncEnergyValue()
.addInventory().create());
public GuiDieselGenerator(final EntityPlayer player, final TileDieselGenerator dieselGenerator) {
super(dieselGenerator.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.tile = tile;
this.dieselGenerator = dieselGenerator;
}
@Override
@ -44,10 +41,10 @@ public class GuiDieselGenerator extends GuiContainer {
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString("Liquid Amount", 10, 20, 16448255);
this.fontRendererObj.drawString(this.tile.tank.getFluidAmount() + "", 10, 30, 16448255);
this.fontRendererObj.drawString(this.dieselGenerator.tank.getFluidAmount() + "", 10, 30, 16448255);
this.fontRendererObj.drawString("Power Amount", 10, 40, 16448255);
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(this.tile.getEnergy()) + "", 10, 50,
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(this.dieselGenerator.getEnergy()) + "", 10, 50,
16448255);
}
}

View file

@ -2,22 +2,22 @@ package techreborn.client.gui;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileDigitalChest;
public class GuiDigitalChest extends GuiBase {
TileDigitalChest tile;
TileDigitalChest digitalChest;
public GuiDigitalChest(final EntityPlayer player, final TileDigitalChest tile) {
super(player, tile, new ContainerBuilder("digitalchest").player(player.inventory).inventory().hotbar().addInventory().tile(tile).slot(0, 80, 24).outputSlot(1, 80, 64).addInventory().create());
this.tile = tile;
public GuiDigitalChest(final EntityPlayer player, final TileDigitalChest digitalChest) {
super(player, digitalChest, digitalChest.createContainer(player));
this.digitalChest = digitalChest;
}
@Override
protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
Layer layer = Layer.BACKGROUND;
final Layer layer = Layer.BACKGROUND;
this.drawSlot(80, 24, layer);
this.drawSlot(80, 64, layer);
@ -26,13 +26,16 @@ public class GuiDigitalChest extends GuiBase {
@Override
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
Layer layer = Layer.FOREGROUND;
final Layer layer = Layer.FOREGROUND;
if (this.tile.storedItem != ItemStack.EMPTY && this.tile.getStackInSlot(1) != null) {
this.builder.drawBigBlueBar(this, 31, 43, this.tile.storedItem.getCount() + this.tile.getStackInSlot(1).getCount(), this.tile.maxCapacity, mouseX - this.guiLeft, mouseY - this.guiTop, "Stored", layer);
if (this.digitalChest.storedItem != ItemStack.EMPTY && this.digitalChest.getStackInSlot(1) != null) {
this.builder.drawBigBlueBar(this, 31, 43,
this.digitalChest.storedItem.getCount() + this.digitalChest.getStackInSlot(1).getCount(),
this.digitalChest.maxCapacity, mouseX - this.guiLeft, mouseY - this.guiTop, "Stored", layer);
}
if (this.tile.storedItem == ItemStack.EMPTY && this.tile.getStackInSlot(1) != null) {
this.builder.drawBigBlueBar(this, 31, 43, this.tile.getStackInSlot(1).getCount(), this.tile.maxCapacity, mouseX - this.guiLeft, mouseY - this.guiTop, "Stored", layer);
if (this.digitalChest.storedItem == ItemStack.EMPTY && this.digitalChest.getStackInSlot(1) != null) {
this.builder.drawBigBlueBar(this, 31, 43, this.digitalChest.getStackInSlot(1).getCount(),
this.digitalChest.maxCapacity, mouseX - this.guiLeft, mouseY - this.guiTop, "Stored", layer);
}
}
}

View file

@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.teir1.TileElectricFurnace;
public class GuiElectricFurnace extends GuiContainer {
@ -16,10 +15,7 @@ public class GuiElectricFurnace extends GuiContainer {
TileElectricFurnace furnace;
public GuiElectricFurnace(final EntityPlayer player, final TileElectricFurnace furnace) {
super(new ContainerBuilder("electricfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(furnace).slot(0, 56, 34).outputSlot(1, 116, 34).upgradeSlot(2, 152, 8)
.upgradeSlot(3, 152, 26).upgradeSlot(4, 152, 44).upgradeSlot(5, 152, 62).syncEnergyValue()
.syncIntegerValue(furnace::getBurnTime, furnace::setBurnTime).addInventory().create());
super(furnace.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.furnace = furnace;

View file

@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.teir1.TileExtractor;
public class GuiExtractor extends GuiContainer {
@ -16,10 +15,7 @@ public class GuiExtractor extends GuiContainer {
TileExtractor extractor;
public GuiExtractor(final EntityPlayer player, final TileExtractor extractor) {
super(new ContainerBuilder("extractor").player(player.inventory).inventory(8, 84).hotbar(8, 142).addInventory()
.tile(extractor).slot(0, 56, 34).outputSlot(1, 116, 34).upgradeSlot(2, 152, 8)
.upgradeSlot(3, 152, 26).upgradeSlot(4, 152, 44).upgradeSlot(5, 152, 62).syncEnergyValue()
.syncCrafterValue().addInventory().create());
super(extractor.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.extractor = extractor;

View file

@ -15,7 +15,6 @@ import reborncore.common.misc.Location;
import reborncore.common.powerSystem.PowerSystem;
import techreborn.client.ClientMultiBlocks;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.proxies.ClientProxy;
import techreborn.tiles.fusionReactor.TileEntityFusionController;
@ -29,12 +28,7 @@ public class GuiFusionReactor extends GuiContainer {
TileEntityFusionController fusionController;
public GuiFusionReactor(final EntityPlayer player, final TileEntityFusionController fusion) {
super(new ContainerBuilder("fusionreactor").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(fusion).slot(0, 88, 17).slot(1, 88, 53).outputSlot(2, 148, 35).syncEnergyValue()
.syncIntegerValue(fusion::getCoilStatus, fusion::setCoilStatus)
.syncIntegerValue(fusion::getCrafingTickTime, fusion::setCrafingTickTime)
.syncIntegerValue(fusion::getFinalTickTime, fusion::setFinalTickTime)
.syncIntegerValue(fusion::getNeededPower, fusion::setNeededPower).addInventory().create());
super(fusion.createContainer(player));
this.fusionController = fusion;
}

View file

@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.generator.TileGasTurbine;
public class GuiGasTurbine extends GuiContainer {
@ -15,16 +14,13 @@ public class GuiGasTurbine extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/thermal_generator.png");
TileGasTurbine tile;
TileGasTurbine gasTurbine;
public GuiGasTurbine(final EntityPlayer player, final TileGasTurbine tile) {
super(new ContainerBuilder("fluidgenerator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory()
.tile(tile).slot(0, 80, 17).outputSlot(1, 80, 53).fakeSlot(2, 59, 42).syncEnergyValue().addInventory()
.create());
public GuiGasTurbine(final EntityPlayer player, final TileGasTurbine gasTurbine) {
super(gasTurbine.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.tile = tile;
this.gasTurbine = gasTurbine;
}
@Override
@ -44,6 +40,6 @@ public class GuiGasTurbine extends GuiContainer {
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString("Liquid Amount", 10, 20, 16448255);
this.fontRendererObj.drawString(this.tile.tank.getFluidAmount() + "", 10, 30, 16448255);
this.fontRendererObj.drawString(this.gasTurbine.tank.getFluidAmount() + "", 10, 30, 16448255);
}
}

View file

@ -7,7 +7,6 @@ import net.minecraft.util.text.translation.I18n;
import reborncore.common.powerSystem.PowerSystem;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.generator.TileGenerator;
public class GuiGenerator extends GuiContainer {
@ -17,10 +16,7 @@ public class GuiGenerator extends GuiContainer {
TileGenerator generator;
public GuiGenerator(final EntityPlayer player, final TileGenerator generator) {
super(new ContainerBuilder("generator").player(player.inventory).inventory(8, 84).hotbar(8, 142).addInventory()
.tile(generator).fuelSlot(0, 80, 53).energySlot(1, 80, 17).syncEnergyValue()
.syncIntegerValue(generator::getBurnTime, generator::setBurnTime)
.syncIntegerValue(generator::getTotalBurnTime, generator::setTotalBurnTime).addInventory().create());
super(generator.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.generator = generator;

View file

@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.teir1.TileGrinder;
public class GuiGrinder extends GuiContainer {
@ -16,10 +15,7 @@ public class GuiGrinder extends GuiContainer {
TileGrinder grinder;
public GuiGrinder(final EntityPlayer player, final TileGrinder grinder) {
super(new ContainerBuilder("grinder").player(player.inventory).inventory(8, 84).hotbar(8, 142).addInventory()
.tile(grinder).slot(0, 56, 34).outputSlot(1, 116, 34).upgradeSlot(2, 152, 8).upgradeSlot(3, 152, 26)
.upgradeSlot(4, 152, 44).upgradeSlot(5, 152, 62).syncEnergyValue().syncCrafterValue().addInventory()
.create());
super(grinder.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.grinder = grinder;

View file

@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.multiblock.TileImplosionCompressor;
public class GuiImplosionCompressor extends GuiContainer {
@ -14,15 +13,13 @@ public class GuiImplosionCompressor extends GuiContainer {
public static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/implosion_compressor.png");
TileImplosionCompressor compresser;
TileImplosionCompressor compressor;
public GuiImplosionCompressor(final EntityPlayer player, final TileImplosionCompressor tilecompressor) {
super(new ContainerBuilder("implosioncompressor").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(tilecompressor).slot(0, 37, 26).slot(1, 37, 44).outputSlot(2, 93, 35)
.outputSlot(3, 111, 35).syncEnergyValue().syncCrafterValue().addInventory().create());
public GuiImplosionCompressor(final EntityPlayer player, final TileImplosionCompressor compressor) {
super(compressor.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.compresser = tilecompressor;
this.compressor = compressor;
}
@Override
@ -40,18 +37,18 @@ public class GuiImplosionCompressor extends GuiContainer {
final int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
if (!this.compresser.getMutliBlock()) {
if (!this.compressor.getMutliBlock()) {
// GuiDraw.drawTooltipBox(k + 30, l + 50 + 12 - 0, 114, 10);
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38, l + 52 + 12, -1);
}
this.mc.getTextureManager().bindTexture(GuiImplosionCompressor.texture);
int j = this.compresser.getProgressScaled(24);
int j = this.compressor.getProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 61, l + 37, 176, 14, j + 1, 16);
}
j = this.compresser.getEnergyScaled(12);
j = this.compressor.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 14, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}

View file

@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileIndustrialElectrolyzer;
public class GuiIndustrialElectrolyzer extends GuiContainer {
@ -18,10 +17,7 @@ public class GuiIndustrialElectrolyzer extends GuiContainer {
public GuiIndustrialElectrolyzer(final EntityPlayer player, final TileIndustrialElectrolyzer tileeletrolyzer) {
super(new ContainerBuilder("industrialelectrolyzer").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(tileeletrolyzer).slot(0, 80, 51).slot(1, 50, 51).outputSlot(2, 50, 19)
.outputSlot(3, 70, 19).outputSlot(4, 90, 19).outputSlot(5, 110, 19).energySlot(6, 18, 51)
.syncEnergyValue().syncCrafterValue().addInventory().create());
super(tileeletrolyzer.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.eletrolyzer = tileeletrolyzer;

View file

@ -9,7 +9,6 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.fluids.FluidStack;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.multiblock.TileIndustrialGrinder;
public class GuiIndustrialGrinder extends GuiContainer {
@ -19,14 +18,11 @@ public class GuiIndustrialGrinder extends GuiContainer {
TileIndustrialGrinder grinder;
public GuiIndustrialGrinder(final EntityPlayer player, final TileIndustrialGrinder tilegrinder) {
super(new ContainerBuilder("industrialgrinder").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(tilegrinder).slot(0, 32, 26).slot(1, 32, 44).outputSlot(2, 77, 35)
.outputSlot(3, 95, 35).outputSlot(4, 113, 35).outputSlot(5, 131, 35).syncEnergyValue()
.syncCrafterValue().addInventory().create());
public GuiIndustrialGrinder(final EntityPlayer player, final TileIndustrialGrinder grinder) {
super(grinder.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.grinder = tilegrinder;
this.grinder = grinder;
}
@Override

View file

@ -9,7 +9,6 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.fluids.FluidStack;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.multiblock.TileIndustrialSawmill;
public class GuiIndustrialSawmill extends GuiContainer {
@ -19,14 +18,11 @@ public class GuiIndustrialSawmill extends GuiContainer {
TileIndustrialSawmill sawmill;
public GuiIndustrialSawmill(final EntityPlayer player, final TileIndustrialSawmill tilesawmill) {
super(new ContainerBuilder("chemicalreactor").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(tilesawmill).slot(0, 70, 21).slot(1, 90, 21).outputSlot(2, 80, 51)
.energySlot(3, 8, 51).upgradeSlot(4, 152, 8).upgradeSlot(5, 152, 26).upgradeSlot(6, 152, 44)
.upgradeSlot(7, 152, 62).syncEnergyValue().syncCrafterValue().addInventory().create());
public GuiIndustrialSawmill(final EntityPlayer player, final TileIndustrialSawmill sawmill) {
super(sawmill.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.sawmill = tilesawmill;
this.sawmill = sawmill;
}
@Override

View file

@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileIronFurnace;
public class GuiIronFurnace extends GuiContainer {
@ -17,11 +16,7 @@ public class GuiIronFurnace extends GuiContainer {
TileIronFurnace furnace;
public GuiIronFurnace(final EntityPlayer player, final TileIronFurnace furnace) {
super(new ContainerBuilder("ironfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(furnace).slot(0, 56, 17).outputSlot(1, 116, 34).fuelSlot(2, 56, 53)
.syncIntegerValue(furnace::getBurnTime, furnace::setBurnTime)
.syncIntegerValue(furnace::getTotalBurnTime, furnace::setTotalBurnTime).addInventory()
.create());
super(furnace.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.furnace = furnace;

View file

@ -2,37 +2,38 @@ package techreborn.client.gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import reborncore.common.powerSystem.PowerSystem;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.storage.TileMFE;
public class GuiMFE extends GuiBase {
TileMFE tile;
TileMFE mfe;
public GuiMFE(final EntityPlayer player, final TileMFE tile) {
super(player, tile, new ContainerBuilder("mfe").player(player.inventory).inventory().hotbar().armor().complete(8, 18).addArmor().addInventory().tile(tile).energySlot(0, 62, 45).energySlot(1, 98, 45).syncEnergyValue().addInventory().create());
this.tile = tile;
public GuiMFE(final EntityPlayer player, final TileMFE mfe) {
super(player, mfe, mfe.createContainer(player));
this.mfe = mfe;
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
Layer layer = Layer.BACKGROUND;
final Layer layer = Layer.BACKGROUND;
drawSlot(62, 45, layer);
drawSlot(98, 45, layer);
drawArmourSlots(8, 18, layer);
this.drawSlot(62, 45, layer);
this.drawSlot(98, 45, layer);
this.drawArmourSlots(8, 18, layer);
}
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
Layer layer = Layer.FOREGROUND;
final Layer layer = Layer.FOREGROUND;
builder.drawMultiEnergyBar(this, 81, 28, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer);
this.builder.drawMultiEnergyBar(this, 81, 28, (int) this.mfe.getEnergy(), (int) this.mfe.getMaxPower(), mouseX, mouseY, 0, layer);
GlStateManager.scale(0.6, 0.6, 5);
drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) (tile.getEnergy())) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) (tile.getMaxPower())) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer);
this.drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.mfe.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.mfe.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer);
GlStateManager.scale(1, 1, 1);
}
}

View file

@ -2,37 +2,38 @@ package techreborn.client.gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import reborncore.common.powerSystem.PowerSystem;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.storage.TileMFSU;
public class GuiMFSU extends GuiBase {
TileMFSU tile;
TileMFSU mfsu;
public GuiMFSU(final EntityPlayer player, final TileMFSU tile) {
super(player, tile, new ContainerBuilder("mfsu").player(player.inventory).inventory().hotbar().armor().complete(8, 18).addArmor().addInventory().tile(tile).energySlot(0, 62, 45).energySlot(1, 98, 45).syncEnergyValue().addInventory().create());
this.tile = tile;
public GuiMFSU(final EntityPlayer player, final TileMFSU mfsu) {
super(player, mfsu, mfsu.createContainer(player));
this.mfsu = mfsu;
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
Layer layer = Layer.BACKGROUND;
final Layer layer = Layer.BACKGROUND;
drawSlot(62, 45, layer);
drawSlot(98, 45, layer);
drawArmourSlots(8, 18, layer);
this.drawSlot(62, 45, layer);
this.drawSlot(98, 45, layer);
this.drawArmourSlots(8, 18, layer);
}
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
Layer layer = Layer.FOREGROUND;
final Layer layer = Layer.FOREGROUND;
builder.drawMultiEnergyBar(this, 81, 28, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer);
this.builder.drawMultiEnergyBar(this, 81, 28, (int) this.mfsu.getEnergy(), (int) this.mfsu.getMaxPower(), mouseX, mouseY, 0, layer);
GlStateManager.scale(0.6, 0.6, 5);
drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) (tile.getEnergy())) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) (tile.getMaxPower())) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer);
this.drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.mfsu.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.mfsu.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer);
GlStateManager.scale(1, 1, 1);
}
}

View file

@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileMatterFabricator;
public class GuiMatterFabricator extends GuiContainer {
@ -17,10 +16,7 @@ public class GuiMatterFabricator extends GuiContainer {
TileMatterFabricator matterfab;
public GuiMatterFabricator(final EntityPlayer player, final TileMatterFabricator tilematterfab) {
super(new ContainerBuilder("matterfabricator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(tilematterfab).slot(0, 33, 17).slot(1, 33, 35).slot(2, 33, 53).slot(3, 51, 17)
.slot(4, 51, 35).slot(5, 51, 53).outputSlot(6, 116, 35).syncEnergyValue()
.syncIntegerValue(tilematterfab::getProgress, tilematterfab::setProgress).addInventory().create());
super(tilematterfab.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.matterfab = tilematterfab;

View file

@ -2,22 +2,22 @@ package techreborn.client.gui;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileQuantumChest;
public class GuiQuantumChest extends GuiBase {
TileQuantumChest tile;
TileQuantumChest quantumChest;
public GuiQuantumChest(final EntityPlayer player, final TileQuantumChest tile) {
super(player, tile, new ContainerBuilder("quantumchest").player(player.inventory).inventory().hotbar().addInventory().tile(tile).slot(0, 80, 24).outputSlot(1, 80, 64).addInventory().create());
this.tile = tile;
public GuiQuantumChest(final EntityPlayer player, final TileQuantumChest quantumChest) {
super(player, quantumChest, quantumChest.createContainer(player));
this.quantumChest = quantumChest;
}
@Override
protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
Layer layer = Layer.BACKGROUND;
final Layer layer = Layer.BACKGROUND;
this.drawSlot(80, 24, layer);
this.drawSlot(80, 64, layer);
@ -26,13 +26,13 @@ public class GuiQuantumChest extends GuiBase {
@Override
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
Layer layer = Layer.FOREGROUND;
final Layer layer = Layer.FOREGROUND;
if (this.tile.storedItem != ItemStack.EMPTY && this.tile.getStackInSlot(1) != null) {
this.builder.drawBigBlueBar(this, 31, 43, this.tile.storedItem.getCount() + this.tile.getStackInSlot(1).getCount(), this.tile.maxCapacity, mouseX - this.guiLeft, mouseY - this.guiTop, "Stored", layer);
if (this.quantumChest.storedItem != ItemStack.EMPTY && this.quantumChest.getStackInSlot(1) != null) {
this.builder.drawBigBlueBar(this, 31, 43, this.quantumChest.storedItem.getCount() + this.quantumChest.getStackInSlot(1).getCount(), this.quantumChest.maxCapacity, mouseX - this.guiLeft, mouseY - this.guiTop, "Stored", layer);
}
if (this.tile.storedItem == ItemStack.EMPTY && this.tile.getStackInSlot(1) != null) {
this.builder.drawBigBlueBar(this, 31, 43, this.tile.getStackInSlot(1).getCount(), this.tile.maxCapacity, mouseX - this.guiLeft, mouseY - this.guiTop, "Stored", layer);
if (this.quantumChest.storedItem == ItemStack.EMPTY && this.quantumChest.getStackInSlot(1) != null) {
this.builder.drawBigBlueBar(this, 31, 43, this.quantumChest.getStackInSlot(1).getCount(), this.quantumChest.maxCapacity, mouseX - this.guiLeft, mouseY - this.guiTop, "Stored", layer);
}
}
}

View file

@ -5,39 +5,40 @@ import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.ContainerQuantumTank;
import techreborn.tiles.TileQuantumTank;
public class GuiQuantumTank extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/thermal_generator.png");
"textures/gui/thermal_generator.png");
TileQuantumTank tile;
TileQuantumTank quantumTank;
public GuiQuantumTank(EntityPlayer player, TileQuantumTank tile) {
super(new ContainerQuantumTank(tile, player));
public GuiQuantumTank(final EntityPlayer player, final TileQuantumTank quantumTank) {
super(quantumTank.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.tile = tile;
this.quantumTank = quantumTank;
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
protected void drawGuiContainerBackgroundLayer(final float p_146976_1_, final int p_146976_2_, final int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.mc.getTextureManager().bindTexture(GuiQuantumTank.texture);
final int k = (this.width - this.xSize) / 2;
final int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String name = I18n.translateToLocal("tile.techreborn.quantumTank.name");
@Override
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
final String name = I18n.translateToLocal("tile.techreborn.quantumTank.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
4210752);
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString("Liquid Amount", 10, 20, 16448255);
this.fontRendererObj.drawString(tile.tank.getFluidAmount() + "", 10, 30, 16448255);
this.fontRendererObj.drawString(this.quantumTank.tank.getFluidAmount() + "", 10, 30, 16448255);
}
}

View file

@ -6,7 +6,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.teir1.TileRecycler;
public class GuiRecycler extends GuiContainer {
@ -16,10 +15,7 @@ public class GuiRecycler extends GuiContainer {
TileRecycler recycler;
public GuiRecycler(final EntityPlayer player, final TileRecycler recycler) {
super(new ContainerBuilder("recycler").player(player.inventory).inventory(8, 84).hotbar(8, 142).addInventory()
.tile(recycler).slot(0, 56, 34).slot(1, 116, 34).upgradeSlot(2, 152, 8).upgradeSlot(3, 152, 26)
.upgradeSlot(4, 152, 44).upgradeSlot(5, 152, 62).syncEnergyValue()
.syncIntegerValue(recycler::getProgress, recycler::setProgress).addInventory().create());
super(recycler.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.recycler = recycler;

View file

@ -7,8 +7,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.api.RollingMachineRecipe;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.TileRollingMachine;
public class GuiRollingMachine extends GuiContainer {
@ -18,14 +16,7 @@ public class GuiRollingMachine extends GuiContainer {
TileRollingMachine rollingMachine;
public GuiRollingMachine(final EntityPlayer player, final TileRollingMachine tileRollingmachine) {
super(new ContainerBuilder("rollingmachine").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(tileRollingmachine.craftMatrix).slot(0, 30, 17).slot(1, 48, 17).slot(2, 66, 17)
.slot(3, 30, 35).slot(4, 48, 35).slot(5, 66, 35).slot(6, 30, 53).slot(7, 48, 53).slot(8, 66, 53)
.onCraft(inv -> tileRollingmachine.inventory.setInventorySlotContents(1,
RollingMachineRecipe.instance.findMatchingRecipe(inv, tileRollingmachine.getWorld())))
.addInventory().tile(tileRollingmachine).outputSlot(0, 124, 35).energySlot(2, 8, 51).syncEnergyValue()
.syncIntegerValue(tileRollingmachine::getBurnTime, tileRollingmachine::setBurnTime).addInventory()
.create());
super(tileRollingmachine.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.rollingMachine = tileRollingmachine;

View file

@ -6,57 +6,50 @@ import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.init.ModItems;
import techreborn.tiles.TileScrapboxinator;
public class GuiScrapboxinator extends GuiContainer {
public static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/scrapboxinator.png");
public static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/scrapboxinator.png");
TileScrapboxinator tile;
TileScrapboxinator scrapboxinator;
public GuiScrapboxinator(final EntityPlayer player, final TileScrapboxinator scrapboxinator) {
super(new ContainerBuilder("scrapboxinator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(scrapboxinator)
.filterSlot(0, 56, 34, stack -> stack.getItem() == ModItems.SCRAP_BOX).outputSlot(1, 116, 34)
.upgradeSlot(2, 152, 8).upgradeSlot(3, 152, 26).upgradeSlot(4, 152, 44).upgradeSlot(5, 152, 62)
.syncEnergyValue().syncIntegerValue(scrapboxinator::getProgress, scrapboxinator::setProgress)
.addInventory().create());
this.xSize = 176;
this.ySize = 167;
this.tile = scrapboxinator;
}
public GuiScrapboxinator(final EntityPlayer player, final TileScrapboxinator scrapboxinator) {
super(scrapboxinator.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.scrapboxinator = scrapboxinator;
}
@Override
protected void drawGuiContainerBackgroundLayer(final float p_146976_1_, final int p_146976_2_, final int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(GuiScrapboxinator.texture);
final int k = (this.width - this.xSize) / 2;
final int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
@Override
protected void drawGuiContainerBackgroundLayer(final float p_146976_1_, final int p_146976_2_, final int p_146976_3_) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(GuiScrapboxinator.texture);
final int k = (this.width - this.xSize) / 2;
final int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int j = 0;
int j = 0;
j = this.tile.gaugeProgressScaled(24);
// System.out.println(compressor.gaugeProgressScaled(10));
if (j > 0) {
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
}
j = this.scrapboxinator.gaugeProgressScaled(24);
// System.out.println(compressor.gaugeProgressScaled(10));
if (j > 0) {
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
}
j = this.tile.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
j = this.scrapboxinator.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
}
@Override
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
final String name = net.minecraft.util.text.translation.I18n.translateToLocal("tile.techreborn.scrapboxinator.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2,
4210752);
}
@Override
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
final String name = net.minecraft.util.text.translation.I18n.translateToLocal("tile.techreborn.scrapboxinator.name");
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2,
4210752);
}
}

View file

@ -8,7 +8,6 @@ import net.minecraft.util.text.translation.I18n;
import reborncore.client.RenderUtil;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.generator.TileSemifluidGenerator;
public class GuiSemifluidGenerator extends GuiContainer {
@ -17,15 +16,13 @@ public class GuiSemifluidGenerator extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/semifluid_generator.png");
TileSemifluidGenerator tile;
TileSemifluidGenerator semifluidGenerator;
public GuiSemifluidGenerator(final EntityPlayer player, final TileSemifluidGenerator tile) {
super(new ContainerBuilder("fluidgenerator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(tile).slot(0, 80, 17).outputSlot(1, 80, 53).fakeSlot(2, 59, 42).syncEnergyValue()
.addInventory().create());
public GuiSemifluidGenerator(final EntityPlayer player, final TileSemifluidGenerator semifluidGenerator) {
super(semifluidGenerator.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.tile = tile;
this.semifluidGenerator = semifluidGenerator;
}
@Override
@ -35,7 +32,7 @@ public class GuiSemifluidGenerator extends GuiContainer {
final int k = (this.width - this.xSize) / 2;
final int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
RenderUtil.renderGuiTank(this.tile.tank.getFluid(), 16, 16, k + 59, l + 42, this.zLevel, 16, 16);
RenderUtil.renderGuiTank(this.semifluidGenerator.tank.getFluid(), 16, 16, k + 59, l + 42, this.zLevel, 16, 16);
}
@Override
@ -46,6 +43,6 @@ public class GuiSemifluidGenerator extends GuiContainer {
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString("Liquid Amount", 10, 20, 16448255);
this.fontRendererObj.drawString(this.tile.tank.getFluidAmount() + "", 10, 30, 16448255);
this.fontRendererObj.drawString(this.semifluidGenerator.tank.getFluidAmount() + "", 10, 30, 16448255);
}
}

View file

@ -8,7 +8,6 @@ import net.minecraft.util.text.translation.I18n;
import reborncore.client.RenderUtil;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.generator.TileThermalGenerator;
public class GuiThermalGenerator extends GuiContainer {
@ -16,15 +15,13 @@ public class GuiThermalGenerator extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation("techreborn",
"textures/gui/thermal_generator.png");
TileThermalGenerator tile;
TileThermalGenerator thermalGenerator;
public GuiThermalGenerator(final EntityPlayer player, final TileThermalGenerator tile) {
super(new ContainerBuilder("fluidgenerator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(tile).slot(0, 80, 17).outputSlot(1, 80, 53).fakeSlot(2, 59, 42).syncEnergyValue()
.addInventory().create());
public GuiThermalGenerator(final EntityPlayer player, final TileThermalGenerator thermalGenerator) {
super(thermalGenerator.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.tile = tile;
this.thermalGenerator = thermalGenerator;
}
@Override
@ -34,7 +31,7 @@ public class GuiThermalGenerator extends GuiContainer {
final int k = (this.width - this.xSize) / 2;
final int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
RenderUtil.renderGuiTank(this.tile.tank.getFluid(), 16, 16, k + 59, l + 42, this.zLevel, 16, 16);
RenderUtil.renderGuiTank(this.thermalGenerator.tank.getFluid(), 16, 16, k + 59, l + 42, this.zLevel, 16, 16);
}
@Override
@ -45,8 +42,8 @@ public class GuiThermalGenerator extends GuiContainer {
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString("Liquid Amount", 10, 20, 16448255);
this.fontRendererObj.drawString(this.tile.tank.getFluidAmount() + "", 10, 30, 16448255);
this.fontRendererObj.drawString(this.tile.getEnergy() + "", 10, 40, 16448255);
this.fontRendererObj.drawString(this.thermalGenerator.tank.getFluidAmount() + "", 10, 30, 16448255);
this.fontRendererObj.drawString(this.thermalGenerator.getEnergy() + "", 10, 40, 16448255);
}
}

View file

@ -6,22 +6,19 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.tiles.multiblock.TileVacuumFreezer;
public class GuiVacuumFreezer extends GuiContainer {
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/vacuum_freezer.png");
TileVacuumFreezer crafter;
TileVacuumFreezer freezer;
public GuiVacuumFreezer(final EntityPlayer player, final TileVacuumFreezer freezer) {
super(new ContainerBuilder("vacuumfreezer").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(freezer).slot(0, 56, 34).outputSlot(1, 116, 35).syncEnergyValue()
.syncCrafterValue().addInventory().create());
super(freezer.createContainer(player));
this.xSize = 176;
this.ySize = 167;
this.crafter = freezer;
this.freezer = freezer;
}
@Override
@ -32,21 +29,21 @@ public class GuiVacuumFreezer extends GuiContainer {
final int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int j = this.crafter.getProgressScaled(24);
int j = this.freezer.getProgressScaled(24);
if (j > 0) {
this.drawTexturedModalRect(k + 80, l + 37, 176, 14, j + 1, 16);
}
j = (int) (this.crafter.getEnergy() * 12f / this.crafter.getMaxPower());
j = (int) (this.freezer.getEnergy() * 12f / this.freezer.getMaxPower());
if (j > 0) {
this.drawTexturedModalRect(k + 26, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}
if (!this.crafter.getMultiBlock()) {
if (!this.freezer.getMultiBlock()) {
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38, l + 52 + 12, -1);
}
j = this.crafter.getEnergyScaled(12);
j = this.freezer.getEnergyScaled(12);
if (j > 0) {
this.drawTexturedModalRect(k + 26, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
}

View file

@ -1,30 +1,33 @@
package techreborn.items;
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.world.World;
import reborncore.RebornCore;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTabMisc;
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
public class ItemDestructopack extends ItemTextureBase implements ITexturedItem {
public ItemDestructopack() {
setUnlocalizedName("techreborn.destructopack");
setCreativeTab(TechRebornCreativeTabMisc.instance);
this.setUnlocalizedName("techreborn.destructopack");
this.setCreativeTab(TechRebornCreativeTabMisc.instance);
RebornCore.jsonDestroyer.registerObject(this);
}
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player,
EnumHand hand) {
player.openGui(Core.INSTANCE, GuiHandler.destructoPackID, world, (int) player.posX, (int) player.posY,
(int) player.posY);
public ActionResult<ItemStack> onItemRightClick(final World world, final EntityPlayer player,
final EnumHand hand) {
player.openGui(Core.INSTANCE, EGui.DESTRUCTOPACK.ordinal(), world, (int) player.posX, (int) player.posY,
(int) player.posY);
return new ActionResult<>(EnumActionResult.SUCCESS, player.getHeldItem(hand));
}
@ -34,7 +37,7 @@ public class ItemDestructopack extends ItemTextureBase implements ITexturedItem
}
@Override
public String getTextureName(int arg0) {
public String getTextureName(final int arg0) {
return "techreborn:items/misc/destructopack";
}
}

View file

@ -1,14 +1,16 @@
package techreborn.items;
import com.google.common.base.CaseFormat;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.world.World;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.init.ModItems;
@ -16,21 +18,21 @@ import java.security.InvalidParameterException;
public class ItemParts extends ItemTRNoDestroy {
public static final String[] types = new String[] { "energy_flow_circuit", "data_control_circuit", "data_storage_circuit",
"data_orb", "diamond_grinding_head", "diamond_saw_blade", "tungsten_grinding_head", "helium_coolant_simple",
"helium_coolant_triple", "helium_coolant_six", "nak_coolant_simple", "nak_coolant_triple", "nak_coolant_six",
"cupronickel_heating_coil", "nichrome_heating_coil", "kanthal_heating_coil", ModItems.META_PLACEHOLDER, "super_conductor",
"thorium_cell", "double_thorium_cell", "quad_thorium_cell", "plutonium_cell", "double_plutonium_cell",
"quad_plutonium_cell", "computer_monitor", "machine_parts", "neutron_reflector", "iridium_neutron_reflector",
"thick_neutron_reflector", "electronic_circuit", "advanced_circuit", "sap", "rubber", "scrap",
"carbon_mesh", "carbon_fiber", "coolant_simple", "coolant_triple", "coolant_six" };
"data_orb", "diamond_grinding_head", "diamond_saw_blade", "tungsten_grinding_head", "helium_coolant_simple",
"helium_coolant_triple", "helium_coolant_six", "nak_coolant_simple", "nak_coolant_triple", "nak_coolant_six",
"cupronickel_heating_coil", "nichrome_heating_coil", "kanthal_heating_coil", ModItems.META_PLACEHOLDER, "super_conductor",
"thorium_cell", "double_thorium_cell", "quad_thorium_cell", "plutonium_cell", "double_plutonium_cell",
"quad_plutonium_cell", "computer_monitor", "machine_parts", "neutron_reflector", "iridium_neutron_reflector",
"thick_neutron_reflector", "electronic_circuit", "advanced_circuit", "sap", "rubber", "scrap",
"carbon_mesh", "carbon_fiber", "coolant_simple", "coolant_triple", "coolant_six" };
public ItemParts() {
setCreativeTab(TechRebornCreativeTab.instance);
setHasSubtypes(true);
setUnlocalizedName("techreborn.part");
this.setCreativeTab(TechRebornCreativeTab.instance);
this.setHasSubtypes(true);
this.setUnlocalizedName("techreborn.part");
}
public static ItemStack getPartByName(String name, int count) {
public static ItemStack getPartByName(String name, final int count) {
//TODO: Change all recipes n' shit to use proper snake_case names so I don't have to do this bullshit
if (name.equals("NaKCoolantSimple"))
name = "nak_coolant_simple";
@ -47,43 +49,44 @@ public class ItemParts extends ItemTRNoDestroy {
if (name.equals("rubberSap"))
name = "sap";
name = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name);
for (int i = 0; i < types.length; i++) {
if (types[i].equalsIgnoreCase(name)) {
for (int i = 0; i < ItemParts.types.length; i++) {
if (ItemParts.types[i].equalsIgnoreCase(name)) {
return new ItemStack(ModItems.PARTS, count, i);
}
}
throw new InvalidParameterException("The part " + name + " could not be found.");
}
public static ItemStack getPartByName(String name) {
return getPartByName(name, 1);
public static ItemStack getPartByName(final String name) {
return ItemParts.getPartByName(name, 1);
}
@Override
// gets Unlocalized Name depending on meta data
public String getUnlocalizedName(ItemStack itemStack) {
public String getUnlocalizedName(final ItemStack itemStack) {
int meta = itemStack.getItemDamage();
if (meta < 0 || meta >= types.length) {
if (meta < 0 || meta >= ItemParts.types.length) {
meta = 0;
}
return super.getUnlocalizedName() + "." + types[meta];
return super.getUnlocalizedName() + "." + ItemParts.types[meta];
}
// Adds Dusts SubItems To Creative Tab
public void getSubItems(Item item, CreativeTabs creativeTabs, NonNullList list) {
for (int meta = 0; meta < types.length; ++meta) {
if (!types[meta].equals(ModItems.META_PLACEHOLDER)) {
@Override
public void getSubItems(final Item item, final CreativeTabs creativeTabs, final NonNullList list) {
for (int meta = 0; meta < ItemParts.types.length; ++meta) {
if (!ItemParts.types[meta].equals(ModItems.META_PLACEHOLDER)) {
list.add(new ItemStack(item, 1, meta));
}
}
}
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
public ItemStack onItemRightClick(final ItemStack itemStack, final World world, final EntityPlayer player) {
switch (itemStack.getItemDamage()) {
case 37: // Destructo pack
player.openGui(Core.INSTANCE, GuiHandler.destructoPackID, world, (int) player.posX, (int) player.posY,
(int) player.posY);
player.openGui(Core.INSTANCE, EGui.DESTRUCTOPACK.ordinal(), world, (int) player.posX, (int) player.posY,
(int) player.posY);
break;
}
return itemStack;

View file

@ -8,8 +8,9 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.world.World;
import techreborn.Core;
import techreborn.client.GuiHandler;
import techreborn.client.EGui;
import techreborn.client.TechRebornCreativeTab;
import techreborn.items.ItemTRNoDestroy;
@ -18,21 +19,21 @@ import java.util.List;
public class ItemTechManual extends ItemTRNoDestroy {
public ItemTechManual() {
setCreativeTab(TechRebornCreativeTab.instance);
setUnlocalizedName("techreborn.manual");
setMaxStackSize(1);
this.setCreativeTab(TechRebornCreativeTab.instance);
this.setUnlocalizedName("techreborn.manual");
this.setMaxStackSize(1);
}
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player,
EnumHand hand) {
player.openGui(Core.INSTANCE, GuiHandler.manuelID, world, (int) player.posX, (int) player.posY,
(int) player.posY);
public ActionResult<ItemStack> onItemRightClick(final World world, final EntityPlayer player,
final EnumHand hand) {
player.openGui(Core.INSTANCE, EGui.MANUAL.ordinal(), world, (int) player.posX, (int) player.posY,
(int) player.posY);
return new ActionResult<>(EnumActionResult.SUCCESS, player.getHeldItem(hand));
}
@Override
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
public void addInformation(final ItemStack stack, final EntityPlayer playerIn, final List<String> tooltip, final boolean advanced) {
tooltip.add(TextFormatting.RED + I18n.translateToLocal("tooltip.wip"));
}
}

View file

@ -18,299 +18,321 @@ import reborncore.common.util.Inventory;
import reborncore.common.util.ItemUtils;
import techreborn.api.Reference;
import techreborn.api.recipe.machines.AlloySmelterRecipe;
import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.init.ModBlocks;
public class TileAlloyFurnace extends TileLegacyMachineBase implements IWrenchable, IInventoryProvider {
public class TileAlloyFurnace extends TileLegacyMachineBase
implements IWrenchable, IInventoryProvider, IContainerProvider {
public int tickTime;
public Inventory inventory = new Inventory(4, "TileAlloyFurnace", 64, this);
public int burnTime;
public int currentItemBurnTime;
public int cookTime;
int input1 = 0;
int input2 = 1;
int output = 2;
int fuel = 3;
public int tickTime;
public Inventory inventory = new Inventory(4, "TileAlloyFurnace", 64, this);
public int burnTime;
public int currentItemBurnTime;
public int cookTime;
int input1 = 0;
int input2 = 1;
int output = 2;
int fuel = 3;
public TileAlloyFurnace() {
public TileAlloyFurnace() {
}
}
/**
* Returns the number of ticks that the supplied fuel item will keep the
* furnace burning, or 0 if the item isn't fuel
*/
public static int getItemBurnTime(final ItemStack stack) {
if (stack == null) {
return 0;
} else {
final Item item = stack.getItem();
/**
* Returns the number of ticks that the supplied fuel item will keep the
* furnace burning, or 0 if the item isn't fuel
*/
public static int getItemBurnTime(final ItemStack stack) {
if (stack == null) {
return 0;
} else {
final Item item = stack.getItem();
if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.AIR) {
final Block block = Block.getBlockFromItem(item);
if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.AIR) {
final Block block = Block.getBlockFromItem(item);
if (block == Blocks.WOODEN_SLAB) {
return 150;
}
if (block == Blocks.WOODEN_SLAB) {
return 150;
}
if (block.getMaterial(block.getDefaultState()) == Material.WOOD) {
return 300;
}
if (block.getMaterial(block.getDefaultState()) == Material.WOOD) {
return 300;
}
if (block == Blocks.COAL_BLOCK) {
return 16000;
}
}
if (block == Blocks.COAL_BLOCK) {
return 16000;
}
}
if (item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD"))
return 200;
if (item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD"))
return 200;
// if (item instanceof ItemHoe && ((ItemHoe)
// item).getToolMaterialName().equals("WOOD")) return 200;
if (item == Items.STICK)
return 100;
if (item == Items.COAL)
return 1600;
if (item == Items.LAVA_BUCKET)
return 20000;
if (item == Item.getItemFromBlock(Blocks.SAPLING))
return 100;
if (item == Items.BLAZE_ROD)
return 2400;
return GameRegistry.getFuelValue(stack);
}
}
if (item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD"))
return 200;
if (item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD"))
return 200;
// if (item instanceof ItemHoe && ((ItemHoe)
// item).getToolMaterialName().equals("WOOD")) return 200;
if (item == Items.STICK)
return 100;
if (item == Items.COAL)
return 1600;
if (item == Items.LAVA_BUCKET)
return 20000;
if (item == Item.getItemFromBlock(Blocks.SAPLING))
return 100;
if (item == Items.BLAZE_ROD)
return 2400;
return GameRegistry.getFuelValue(stack);
}
}
@Override
public void updateEntity() {
super.updateEntity();
final boolean flag = this.burnTime > 0;
boolean flag1 = false;
if (this.burnTime > 0) {
--this.burnTime;
}
if (!this.world.isRemote) {
if (this.burnTime != 0 || this.getStackInSlot(this.input1) != ItemStack.EMPTY && this.getStackInSlot(this.fuel) != ItemStack.EMPTY) {
if (this.burnTime == 0 && this.canSmelt()) {
this.currentItemBurnTime = this.burnTime = TileAlloyFurnace.getItemBurnTime(this.getStackInSlot(this.fuel));
if (this.burnTime > 0) {
flag1 = true;
if (this.getStackInSlot(this.fuel) != ItemStack.EMPTY) {
this.decrStackSize(this.fuel, 1);
}
}
}
if (this.isBurning() && this.canSmelt()) {
++this.cookTime;
if (this.cookTime == 200) {
this.cookTime = 0;
this.smeltItem();
flag1 = true;
}
} else {
this.cookTime = 0;
}
}
if (flag != this.burnTime > 0) {
flag1 = true;
// TODO sync on/off
}
}
if (flag1) {
this.markDirty();
}
}
@Override
public void updateEntity() {
super.updateEntity();
final boolean flag = this.burnTime > 0;
boolean flag1 = false;
if (this.burnTime > 0) {
--this.burnTime;
}
if (!this.world.isRemote) {
if (this.burnTime != 0 || this.getStackInSlot(this.input1) != ItemStack.EMPTY && this.getStackInSlot(this.fuel) != ItemStack.EMPTY) {
if (this.burnTime == 0 && this.canSmelt()) {
this.currentItemBurnTime = this.burnTime = TileAlloyFurnace.getItemBurnTime(this.getStackInSlot(this.fuel));
if (this.burnTime > 0) {
flag1 = true;
if (this.getStackInSlot(this.fuel) != ItemStack.EMPTY) {
this.decrStackSize(this.fuel, 1);
}
}
}
if (this.isBurning() && this.canSmelt()) {
++this.cookTime;
if (this.cookTime == 200) {
this.cookTime = 0;
this.smeltItem();
flag1 = true;
}
} else {
this.cookTime = 0;
}
}
if (flag != this.burnTime > 0) {
flag1 = true;
// TODO sync on/off
}
}
if (flag1) {
this.markDirty();
}
}
public boolean hasAllInputs(final IBaseRecipeType recipeType) {
if (recipeType == null) {
return false;
}
for (final ItemStack input : recipeType.getInputs()) {
Boolean hasItem = false;
for (int inputslot = 0; inputslot < 2; inputslot++) {
if (ItemUtils.isItemEqual(input, this.inventory.getStackInSlot(inputslot), true, true,
recipeType.useOreDic()) && this.inventory.getStackInSlot(inputslot).getCount() >= input.getCount()) {
hasItem = true;
}
}
if (!hasItem)
return false;
}
return true;
}
public boolean hasAllInputs(final IBaseRecipeType recipeType) {
if (recipeType == null) {
return false;
}
for (final ItemStack input : recipeType.getInputs()) {
Boolean hasItem = false;
for (int inputslot = 0; inputslot < 2; inputslot++) {
if (ItemUtils.isItemEqual(input, this.inventory.getStackInSlot(inputslot), true, true,
recipeType.useOreDic()) && this.inventory.getStackInSlot(inputslot).getCount() >= input.getCount()) {
hasItem = true;
}
}
if (!hasItem)
return false;
}
return true;
}
private boolean canSmelt() {
if (this.getStackInSlot(this.input1) == ItemStack.EMPTY || this.getStackInSlot(this.input2) == ItemStack.EMPTY) {
return false;
} else {
ItemStack itemstack = null;
for (final IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)) {
if (this.hasAllInputs(recipeType)) {
itemstack = recipeType.getOutput(0);
break;
}
}
private boolean canSmelt() {
if (this.getStackInSlot(this.input1) == ItemStack.EMPTY || this.getStackInSlot(this.input2) == ItemStack.EMPTY) {
return false;
} else {
ItemStack itemstack = null;
for (final IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)) {
if (this.hasAllInputs(recipeType)) {
itemstack = recipeType.getOutput(0);
break;
}
}
if (itemstack == null)
return false;
if (this.getStackInSlot(this.output) == ItemStack.EMPTY)
return true;
if (!this.getStackInSlot(this.output).isItemEqual(itemstack))
return false;
final int result = this.getStackInSlot(this.output).getCount() + itemstack.getCount();
return result <= this.getInventoryStackLimit() && result <= this.getStackInSlot(this.output).getMaxStackSize(); // Forge
// BugFix:
// Make
// it
// respect
// stack
// sizes
// properly.
}
}
if (itemstack == null)
return false;
if (this.getStackInSlot(this.output) == ItemStack.EMPTY)
return true;
if (!this.getStackInSlot(this.output).isItemEqual(itemstack))
return false;
final int result = this.getStackInSlot(this.output).getCount() + itemstack.getCount();
return result <= this.getInventoryStackLimit() && result <= this.getStackInSlot(this.output).getMaxStackSize(); // Forge
// BugFix:
// Make
// it
// respect
// stack
// sizes
// properly.
}
}
/**
* Turn one item from the furnace source stack into the appropriate smelted
* item in the furnace result stack
*/
public void smeltItem() {
if (this.canSmelt()) {
ItemStack itemstack = null;
for (final IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)) {
if (this.hasAllInputs(recipeType)) {
itemstack = recipeType.getOutput(0);
break;
}
if (itemstack != ItemStack.EMPTY) {
break;
}
}
/**
* Turn one item from the furnace source stack into the appropriate smelted
* item in the furnace result stack
*/
public void smeltItem() {
if (this.canSmelt()) {
ItemStack itemstack = null;
for (final IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)) {
if (this.hasAllInputs(recipeType)) {
itemstack = recipeType.getOutput(0);
break;
}
if (itemstack != ItemStack.EMPTY) {
break;
}
}
if (this.getStackInSlot(this.output) == ItemStack.EMPTY) {
this.setInventorySlotContents(this.output, itemstack.copy());
} else if (this.getStackInSlot(this.output).getItem() == itemstack.getItem()) {
this.decrStackSize(this.output, -itemstack.getCount());
}
if (this.getStackInSlot(this.output) == ItemStack.EMPTY) {
this.setInventorySlotContents(this.output, itemstack.copy());
} else if (this.getStackInSlot(this.output).getItem() == itemstack.getItem()) {
this.decrStackSize(this.output, -itemstack.getCount());
}
for (final IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)) {
boolean hasAllRecipes = true;
if (this.hasAllInputs(recipeType)) {
for (final IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)) {
boolean hasAllRecipes = true;
if (this.hasAllInputs(recipeType)) {
} else {
hasAllRecipes = false;
}
if (hasAllRecipes) {
for (final ItemStack input : recipeType.getInputs()) {
for (int inputSlot = 0; inputSlot < 2; inputSlot++) {
if (ItemUtils.isItemEqual(input, this.inventory.getStackInSlot(inputSlot), true, true,
recipeType.useOreDic())) {
this.inventory.decrStackSize(inputSlot, input.getCount());
break;
}
}
}
}
}
} else {
hasAllRecipes = false;
}
if (hasAllRecipes) {
for (final ItemStack input : recipeType.getInputs()) {
for (int inputSlot = 0; inputSlot < 2; inputSlot++) {
if (ItemUtils.isItemEqual(input, this.inventory.getStackInSlot(inputSlot), true, true,
recipeType.useOreDic())) {
this.inventory.decrStackSize(inputSlot, input.getCount());
break;
}
}
}
}
}
}
}
}
}
/**
* Furnace isBurning
*/
public boolean isBurning() {
return this.burnTime > 0;
}
/**
* Furnace isBurning
*/
public boolean isBurning() {
return this.burnTime > 0;
}
public int getBurnTimeRemainingScaled(final int scale) {
if (this.currentItemBurnTime == 0) {
this.currentItemBurnTime = 200;
}
public int getBurnTimeRemainingScaled(final int scale) {
if (this.currentItemBurnTime == 0) {
this.currentItemBurnTime = 200;
}
return this.burnTime * scale / this.currentItemBurnTime;
}
return this.burnTime * scale / this.currentItemBurnTime;
}
public int getCookProgressScaled(final int scale) {
return this.cookTime * scale / 200;
}
public int getCookProgressScaled(final int scale) {
return this.cookTime * scale / 200;
}
@Override
public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final EnumFacing side) {
return false;
}
@Override
public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final EnumFacing side) {
return false;
}
@Override
public EnumFacing getFacing() {
return this.getFacingEnum();
}
@Override
public EnumFacing getFacing() {
return this.getFacingEnum();
}
@Override
public boolean wrenchCanRemove(final EntityPlayer entityPlayer) {
return entityPlayer.isSneaking();
}
@Override
public boolean wrenchCanRemove(final EntityPlayer entityPlayer) {
return entityPlayer.isSneaking();
}
@Override
public float getWrenchDropRate() {
return 1.0F;
}
@Override
public float getWrenchDropRate() {
return 1.0F;
}
@Override
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
return new ItemStack(ModBlocks.IRON_ALLOY_FURNACE, 1);
}
@Override
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
return new ItemStack(ModBlocks.IRON_ALLOY_FURNACE, 1);
}
public boolean isComplete() {
return false;
}
public boolean isComplete() {
return false;
}
@Override
public Inventory getInventory() {
return this.inventory;
}
@Override
public Inventory getInventory() {
return this.inventory;
}
@Override
public int[] getSlotsForFace(final EnumFacing side) {
return new int[] { 0, 1, 2 };
}
@Override
public int[] getSlotsForFace(final EnumFacing side) {
return new int[] { 0, 1, 2 };
}
@Override
public boolean canInsertItem(final int index, final ItemStack itemStackIn, final EnumFacing direction) {
return index == 0 || index == 1;
}
@Override
public boolean canInsertItem(final int index, final ItemStack itemStackIn, final EnumFacing direction) {
return index == 0 || index == 1;
}
@Override
public boolean canExtractItem(final int index, final ItemStack stack, final EnumFacing direction) {
return index == 2;
}
@Override
public boolean canExtractItem(final int index, final ItemStack stack, final EnumFacing direction) {
return index == 2;
}
public int getBurnTime()
{
return this.burnTime;
}
public int getBurnTime()
{
return this.burnTime;
}
public void setBurnTime(final int burnTime)
{
this.burnTime = burnTime;
}
public void setBurnTime(final int burnTime)
{
this.burnTime = burnTime;
}
public int getCurrentItemBurnTime()
{
return this.currentItemBurnTime;
}
public int getCurrentItemBurnTime()
{
return this.currentItemBurnTime;
}
public void setCurrentItemBurnTime(final int currentItemBurnTime)
{
this.currentItemBurnTime = currentItemBurnTime;
}
public void setCurrentItemBurnTime(final int currentItemBurnTime)
{
this.currentItemBurnTime = currentItemBurnTime;
}
public int getCookTime()
{
return this.cookTime;
}
public int getCookTime()
{
return this.cookTime;
}
public void setCookTime(final int cookTime)
{
this.cookTime = cookTime;
}
public void setCookTime(final int cookTime)
{
this.cookTime = cookTime;
}
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("alloyfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(this)
.filterSlot(0, 47, 17,
stack -> RecipeHandler.recipeList.stream()
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
&& ItemUtils.isItemEqual(recipe.getInputs().get(0), stack, true, true, true)))
.filterSlot(1, 65, 17,
stack -> RecipeHandler.recipeList.stream()
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
&& ItemUtils.isItemEqual(recipe.getInputs().get(1), stack, true, true, true)))
.outputSlot(2, 116, 35).fuelSlot(3, 56, 53).syncIntegerValue(this::getBurnTime, this::setBurnTime)
.syncIntegerValue(this::getCookTime, this::setCookTime)
.syncIntegerValue(this::getCurrentItemBurnTime, this::setCurrentItemBurnTime).addInventory().create();
}
}

View file

@ -5,18 +5,27 @@ import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import reborncore.api.power.EnumPowerTier;
import reborncore.api.recipe.IRecipeCrafterProvider;
import reborncore.api.recipe.RecipeHandler;
import reborncore.api.tile.IInventoryProvider;
import reborncore.common.IWrenchable;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.util.Inventory;
import reborncore.common.util.ItemUtils;
import techreborn.api.Reference;
import techreborn.api.recipe.machines.AlloySmelterRecipe;
import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.init.ModBlocks;
import techreborn.utils.upgrade.UpgradeHandler;
public class TileAlloySmelter extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, ISidedInventory, IRecipeCrafterProvider {
public class TileAlloySmelter extends TilePowerAcceptor
implements IWrenchable, IInventoryProvider, ISidedInventory, IRecipeCrafterProvider, IContainerProvider {
public int tickTime;
public Inventory inventory = new Inventory(8, "TileAlloySmelter", 64, this);
@ -27,35 +36,35 @@ public class TileAlloySmelter extends TilePowerAcceptor implements IWrenchable,
public TileAlloySmelter() {
super(1);
// Input slots
int[] inputs = new int[2];
final int[] inputs = new int[2];
inputs[0] = 0;
inputs[1] = 1;
int[] outputs = new int[1];
final int[] outputs = new int[1];
outputs[0] = 2;
crafter = new RecipeCrafter(Reference.alloySmelteRecipe, this, 2, 1, inventory, inputs, outputs);
upgrades = new UpgradeHandler(crafter, inventory, 4, 5, 6, 7);
this.crafter = new RecipeCrafter(Reference.alloySmelteRecipe, this, 2, 1, this.inventory, inputs, outputs);
this.upgrades = new UpgradeHandler(this.crafter, this.inventory, 4, 5, 6, 7);
}
@Override
public void update() {
super.update();
crafter.updateEntity();
upgrades.tick();
charge(3);
this.crafter.updateEntity();
this.upgrades.tick();
this.charge(3);
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final EnumFacing side) {
return false;
}
@Override
public EnumFacing getFacing() {
return getFacingEnum();
return this.getFacingEnum();
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
public boolean wrenchCanRemove(final EntityPlayer entityPlayer) {
return entityPlayer.isSneaking();
}
@ -65,7 +74,7 @@ public class TileAlloySmelter extends TilePowerAcceptor implements IWrenchable,
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
return new ItemStack(ModBlocks.ALLOY_SMELTER, 1);
}
@ -74,16 +83,16 @@ public class TileAlloySmelter extends TilePowerAcceptor implements IWrenchable,
}
@Override
public void readFromNBT(NBTTagCompound tagCompound) {
public void readFromNBT(final NBTTagCompound tagCompound) {
super.readFromNBT(tagCompound);
inventory.readFromNBT(tagCompound);
crafter.readFromNBT(tagCompound);
this.inventory.readFromNBT(tagCompound);
this.crafter.readFromNBT(tagCompound);
}
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
super.writeToNBT(tagCompound);
crafter.writeToNBT(tagCompound);
this.crafter.writeToNBT(tagCompound);
return tagCompound;
}
@ -99,41 +108,41 @@ public class TileAlloySmelter extends TilePowerAcceptor implements IWrenchable,
// ISidedInventory
@Override
public int[] getSlotsForFace(EnumFacing side) {
public int[] getSlotsForFace(final EnumFacing side) {
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2 } : new int[] { 0, 1, 2 };
}
@Override
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
public boolean canInsertItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) {
if (slotIndex == 2)
return false;
return isItemValidForSlot(slotIndex, itemStack);
return this.isItemValidForSlot(slotIndex, itemStack);
}
@Override
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
public boolean canExtractItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) {
return slotIndex == 2;
}
public int getProgressScaled(int scale) {
if (crafter.currentTickTime != 0 && crafter.currentNeededTicks != 0) {
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
public int getProgressScaled(final int scale) {
if (this.crafter.currentTickTime != 0 && this.crafter.currentNeededTicks != 0) {
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
}
return 0;
}
@Override
public double getMaxPower() {
return capacity;
return this.capacity;
}
@Override
public boolean canAcceptEnergy(EnumFacing direction) {
public boolean canAcceptEnergy(final EnumFacing direction) {
return true;
}
@Override
public boolean canProvideEnergy(EnumFacing direction) {
public boolean canProvideEnergy(final EnumFacing direction) {
return false;
}
@ -154,11 +163,28 @@ public class TileAlloySmelter extends TilePowerAcceptor implements IWrenchable,
@Override
public Inventory getInventory() {
return inventory;
return this.inventory;
}
@Override
public RecipeCrafter getRecipeCrafter() {
return crafter;
return this.crafter;
}
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("alloysmelter").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(this)
.filterSlot(0, 47, 17,
stack -> RecipeHandler.recipeList.stream()
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
&& ItemUtils.isItemEqual(recipe.getInputs().get(0), stack, true, true, true)))
.filterSlot(1, 65, 17,
stack -> RecipeHandler.recipeList.stream()
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
&& ItemUtils.isItemEqual(recipe.getInputs().get(1), stack, true, true, true)))
.outputSlot(2, 116, 35).energySlot(3, 56, 53).upgradeSlot(4, 152, 8).upgradeSlot(5, 152, 26)
.upgradeSlot(6, 152, 44).upgradeSlot(7, 152, 62).syncEnergyValue().syncCrafterValue().addInventory()
.create();
}
}

View file

@ -4,6 +4,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import reborncore.api.power.EnumPowerTier;
import reborncore.api.recipe.IRecipeCrafterProvider;
import reborncore.api.tile.IInventoryProvider;
@ -11,10 +12,15 @@ import reborncore.common.IWrenchable;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.util.Inventory;
import techreborn.api.Reference;
import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.init.ModBlocks;
public class TileAssemblingMachine extends TilePowerAcceptor implements IWrenchable, ISidedInventory, IInventoryProvider, IRecipeCrafterProvider {
public class TileAssemblingMachine extends TilePowerAcceptor
implements IWrenchable, ISidedInventory, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider {
public int tickTime;
public Inventory inventory = new Inventory(8, "TileAssemblingMachine", 64, this);
@ -23,32 +29,32 @@ public class TileAssemblingMachine extends TilePowerAcceptor implements IWrencha
public TileAssemblingMachine() {
super(2);
// Input slots
int[] inputs = new int[2];
final int[] inputs = new int[2];
inputs[0] = 0;
inputs[1] = 1;
int[] outputs = new int[1];
final int[] outputs = new int[1];
outputs[0] = 2;
crafter = new RecipeCrafter(Reference.assemblingMachineRecipe, this, 2, 2, inventory, inputs, outputs);
this.crafter = new RecipeCrafter(Reference.assemblingMachineRecipe, this, 2, 2, this.inventory, inputs, outputs);
}
@Override
public void updateEntity() {
super.updateEntity();
charge(3);
this.charge(3);
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final EnumFacing side) {
return false;
}
@Override
public EnumFacing getFacing() {
return getFacingEnum();
return this.getFacingEnum();
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
public boolean wrenchCanRemove(final EntityPlayer entityPlayer) {
return entityPlayer.isSneaking();
}
@ -58,7 +64,7 @@ public class TileAssemblingMachine extends TilePowerAcceptor implements IWrencha
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
return new ItemStack(ModBlocks.ASSEMBLY_MACHINE, 1);
}
@ -76,9 +82,9 @@ public class TileAssemblingMachine extends TilePowerAcceptor implements IWrencha
// }
// }
public int getProgressScaled(int scale) {
if (crafter.currentTickTime != 0) {
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
public int getProgressScaled(final int scale) {
if (this.crafter.currentTickTime != 0) {
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
}
return 0;
}
@ -89,12 +95,12 @@ public class TileAssemblingMachine extends TilePowerAcceptor implements IWrencha
}
@Override
public boolean canAcceptEnergy(EnumFacing direction) {
public boolean canAcceptEnergy(final EnumFacing direction) {
return true;
}
@Override
public boolean canProvideEnergy(EnumFacing direction) {
public boolean canProvideEnergy(final EnumFacing direction) {
return false;
}
@ -115,27 +121,34 @@ public class TileAssemblingMachine extends TilePowerAcceptor implements IWrencha
@Override
public Inventory getInventory() {
return inventory;
return this.inventory;
}
@Override
public RecipeCrafter getRecipeCrafter() {
return crafter;
return this.crafter;
}
@Override
public int[] getSlotsForFace(EnumFacing side) {
public int[] getSlotsForFace(final EnumFacing side) {
return new int[] { 0, 1, 2 };
}
@Override
public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) {
public boolean canInsertItem(final int index, final ItemStack itemStackIn, final EnumFacing direction) {
return index == 0 || index == 1;
}
@Override
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) {
public boolean canExtractItem(final int index, final ItemStack stack, final EnumFacing direction) {
return index == 2;
}
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("assemblingmachine").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(this).slot(0, 47, 17).slot(1, 65, 17).outputSlot(2, 116, 35).energySlot(3, 56, 53)
.upgradeSlot(4, 152, 8).upgradeSlot(5, 152, 26).upgradeSlot(6, 152, 44).upgradeSlot(7, 152, 62)
.syncEnergyValue().syncCrafterValue().addInventory().create();
}
}

View file

@ -4,6 +4,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import reborncore.api.IListInfoProvider;
import reborncore.api.power.EnumPowerTier;
import reborncore.api.power.IEnergyItemInfo;
@ -14,7 +15,11 @@ import reborncore.common.powerSystem.PoweredItem;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.util.Inventory;
import techreborn.api.Reference;
import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.config.ConfigTechReborn;
import techreborn.init.ModBlocks;
import techreborn.items.DynamicCell;
@ -23,7 +28,7 @@ import techreborn.utils.upgrade.UpgradeHandler;
import java.util.List;
public class TileCentrifuge extends TilePowerAcceptor
implements IWrenchable, IInventoryProvider, IListInfoProvider, IRecipeCrafterProvider {
implements IWrenchable, IInventoryProvider, IListInfoProvider, IRecipeCrafterProvider, IContainerProvider {
public int tickTime;
public Inventory inventory = new Inventory(11, "TileCentrifuge", 64, this);
@ -35,30 +40,30 @@ public class TileCentrifuge extends TilePowerAcceptor
public TileCentrifuge() {
super(2);
// Input slots
int[] inputs = new int[] { 0, 1 };
int[] outputs = new int[4];
final int[] inputs = new int[] { 0, 1 };
final int[] outputs = new int[4];
outputs[0] = 2;
outputs[1] = 3;
outputs[2] = 4;
outputs[3] = 5;
crafter = new RecipeCrafter(Reference.centrifugeRecipe, this, 2, 4, inventory, inputs, outputs);
upgradeHandler = new UpgradeHandler(crafter, inventory, 7, 8, 9, 10);
this.crafter = new RecipeCrafter(Reference.centrifugeRecipe, this, 2, 4, this.inventory, inputs, outputs);
this.upgradeHandler = new UpgradeHandler(this.crafter, this.inventory, 7, 8, 9, 10);
}
@Override
public void updateEntity() {
super.updateEntity();
crafter.updateEntity();
upgradeHandler.tick();
charge(6);
if (inventory.getStackInSlot(6) != ItemStack.EMPTY) {
ItemStack stack = inventory.getStackInSlot(6);
this.crafter.updateEntity();
this.upgradeHandler.tick();
this.charge(6);
if (this.inventory.getStackInSlot(6) != ItemStack.EMPTY) {
final ItemStack stack = this.inventory.getStackInSlot(6);
if (stack.getItem() instanceof IEnergyItemInfo) {
IEnergyItemInfo item = (IEnergyItemInfo) stack.getItem();
final IEnergyItemInfo item = (IEnergyItemInfo) stack.getItem();
if (item.canProvideEnergy(stack)) {
if (getEnergy() != getMaxPower()) {
addEnergy(item.getMaxTransfer(stack));
if (this.getEnergy() != this.getMaxPower()) {
this.addEnergy(item.getMaxTransfer(stack));
PoweredItem.setEnergy(PoweredItem.getEnergy(stack) - item.getMaxTransfer(stack), stack);
}
}
@ -67,17 +72,17 @@ public class TileCentrifuge extends TilePowerAcceptor
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final EnumFacing side) {
return false;
}
@Override
public EnumFacing getFacing() {
return getFacingEnum();
return this.getFacingEnum();
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
public boolean wrenchCanRemove(final EntityPlayer entityPlayer) {
return entityPlayer.isSneaking();
}
@ -87,7 +92,7 @@ public class TileCentrifuge extends TilePowerAcceptor
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
return new ItemStack(ModBlocks.INDUSTRIAL_CENTRIFUGE, 1);
}
@ -96,44 +101,44 @@ public class TileCentrifuge extends TilePowerAcceptor
}
@Override
public void readFromNBT(NBTTagCompound tagCompound) {
public void readFromNBT(final NBTTagCompound tagCompound) {
super.readFromNBT(tagCompound);
crafter.readFromNBT(tagCompound);
this.crafter.readFromNBT(tagCompound);
}
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
super.writeToNBT(tagCompound);
crafter.writeToNBT(tagCompound);
this.crafter.writeToNBT(tagCompound);
return tagCompound;
}
// ISidedInventory
@Override
public int[] getSlotsForFace(EnumFacing side) {
public int[] getSlotsForFace(final EnumFacing side) {
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2, 3, 4, 5 } : new int[] { 0, 1, 2, 3, 4, 5 };
}
@Override
public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) {
public boolean canInsertItem(final int index, final ItemStack itemStackIn, final EnumFacing direction) {
return itemStackIn.isItemEqual(DynamicCell.getEmptyCell(1).copy()) ? index == 1 : index == 0;
}
@Override
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
public boolean canExtractItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) {
return slotIndex >= 2 && slotIndex <= 5;
}
@Override
public void addInfo(List<String> info, boolean isRealTile) {
public void addInfo(final List<String> info, final boolean isRealTile) {
super.addInfo(info, isRealTile);
info.add("Round and round it goes");
}
public int getProgressScaled(int scale) {
if (crafter.currentTickTime != 0) {
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
public int getProgressScaled(final int scale) {
if (this.crafter.currentTickTime != 0) {
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
}
return 0;
}
@ -144,12 +149,12 @@ public class TileCentrifuge extends TilePowerAcceptor
}
@Override
public boolean canAcceptEnergy(EnumFacing direction) {
public boolean canAcceptEnergy(final EnumFacing direction) {
return true;
}
@Override
public boolean canProvideEnergy(EnumFacing direction) {
public boolean canProvideEnergy(final EnumFacing direction) {
return false;
}
@ -170,12 +175,21 @@ public class TileCentrifuge extends TilePowerAcceptor
@Override
public Inventory getInventory() {
return inventory;
return this.inventory;
}
@Override
public RecipeCrafter getRecipeCrafter() {
return crafter;
return this.crafter;
}
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("centrifuge").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(this).slot(0, 80, 35).slot(1, 50, 5).outputSlot(2, 80, 5).outputSlot(3, 110, 35)
.outputSlot(4, 80, 65).outputSlot(5, 50, 35).energySlot(6, 8, 51).upgradeSlot(7, 152, 8)
.upgradeSlot(8, 152, 26).upgradeSlot(9, 152, 44).upgradeSlot(10, 152, 62).syncEnergyValue()
.syncCrafterValue().addInventory().create();
}
}

View file

@ -4,15 +4,21 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import reborncore.api.power.EnumPowerTier;
import reborncore.api.power.IEnergyInterfaceItem;
import reborncore.api.tile.IInventoryProvider;
import reborncore.common.IWrenchable;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.util.Inventory;
import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.init.ModBlocks;
public class TileChargeBench extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, ISidedInventory {
public class TileChargeBench extends TilePowerAcceptor
implements IWrenchable, IInventoryProvider, ISidedInventory, IContainerProvider {
public Inventory inventory = new Inventory(6, "TileChargeBench", 64, this);
public int capacity = 100000;
@ -26,15 +32,15 @@ public class TileChargeBench extends TilePowerAcceptor implements IWrenchable, I
super.updateEntity();
for (int i = 0; i < 6; i++) {
if (inventory.getStackInSlot(i) != ItemStack.EMPTY) {
if (getEnergy() > 0) {
ItemStack stack = inventory.getStackInSlot(i);
if (this.inventory.getStackInSlot(i) != ItemStack.EMPTY) {
if (this.getEnergy() > 0) {
final ItemStack stack = this.inventory.getStackInSlot(i);
if (stack.getItem() instanceof IEnergyInterfaceItem) {
IEnergyInterfaceItem interfaceItem = (IEnergyInterfaceItem) stack.getItem();
double trans = Math.min(interfaceItem.getMaxPower(stack) - interfaceItem.getEnergy(stack),
Math.min(interfaceItem.getMaxTransfer(stack), getEnergy()));
final IEnergyInterfaceItem interfaceItem = (IEnergyInterfaceItem) stack.getItem();
final double trans = Math.min(interfaceItem.getMaxPower(stack) - interfaceItem.getEnergy(stack),
Math.min(interfaceItem.getMaxTransfer(stack), this.getEnergy()));
interfaceItem.setEnergy(trans + interfaceItem.getEnergy(stack), stack);
useEnergy(trans);
this.useEnergy(trans);
}
}
}
@ -42,17 +48,17 @@ public class TileChargeBench extends TilePowerAcceptor implements IWrenchable, I
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final EnumFacing side) {
return false;
}
@Override
public EnumFacing getFacing() {
return getFacingEnum();
return this.getFacingEnum();
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
public boolean wrenchCanRemove(final EntityPlayer entityPlayer) {
return entityPlayer.isSneaking();
}
@ -62,7 +68,7 @@ public class TileChargeBench extends TilePowerAcceptor implements IWrenchable, I
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
return new ItemStack(ModBlocks.CHARGE_O_MAT, 1);
}
@ -72,17 +78,17 @@ public class TileChargeBench extends TilePowerAcceptor implements IWrenchable, I
// ISidedInventory
@Override
public int[] getSlotsForFace(EnumFacing side) {
public int[] getSlotsForFace(final EnumFacing side) {
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2, 3, 4, 5 } : new int[] { 0, 1, 2, 3, 4, 5 };
}
@Override
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
return isItemValidForSlot(slotIndex, itemStack);
public boolean canInsertItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) {
return this.isItemValidForSlot(slotIndex, itemStack);
}
@Override
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
public boolean canExtractItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) {
// if (itemStack.getItem() instanceof IElectricItem) {
// double CurrentCharge = ElectricItem.manager.getCharge(itemStack);
// double MaxCharge = ((IElectricItem)
@ -95,16 +101,16 @@ public class TileChargeBench extends TilePowerAcceptor implements IWrenchable, I
@Override
public double getMaxPower() {
return capacity;
return this.capacity;
}
@Override
public boolean canAcceptEnergy(EnumFacing direction) {
public boolean canAcceptEnergy(final EnumFacing direction) {
return true;
}
@Override
public boolean canProvideEnergy(EnumFacing direction) {
public boolean canProvideEnergy(final EnumFacing direction) {
return false;
}
@ -125,6 +131,13 @@ public class TileChargeBench extends TilePowerAcceptor implements IWrenchable, I
@Override
public Inventory getInventory() {
return inventory;
return this.inventory;
}
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("chargebench").player(player.inventory).inventory().hotbar(8, 142).addInventory()
.tile(this).energySlot(0, 62, 21).energySlot(1, 80, 21).energySlot(2, 98, 21).energySlot(3, 62, 39)
.energySlot(4, 80, 39).energySlot(5, 98, 39).syncEnergyValue().addInventory().create();
}
}

View file

@ -5,6 +5,7 @@ import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import reborncore.api.power.EnumPowerTier;
import reborncore.api.recipe.IRecipeCrafterProvider;
import reborncore.api.tile.IInventoryProvider;
@ -12,10 +13,15 @@ import reborncore.common.IWrenchable;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.util.Inventory;
import techreborn.api.Reference;
import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.init.ModBlocks;
public class TileChemicalReactor extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, ISidedInventory, IRecipeCrafterProvider {
public class TileChemicalReactor extends TilePowerAcceptor
implements IWrenchable, IInventoryProvider, ISidedInventory, IRecipeCrafterProvider, IContainerProvider {
public int tickTime;
public Inventory inventory = new Inventory(8, "TileChemicalReactor", 64, this);
@ -24,33 +30,33 @@ public class TileChemicalReactor extends TilePowerAcceptor implements IWrenchabl
public TileChemicalReactor() {
super(2);
// Input slots
int[] inputs = new int[2];
final int[] inputs = new int[2];
inputs[0] = 0;
inputs[1] = 1;
int[] outputs = new int[1];
final int[] outputs = new int[1];
outputs[0] = 2;
crafter = new RecipeCrafter(Reference.chemicalReactorRecipe, this, 2, 2, inventory, inputs, outputs);
this.crafter = new RecipeCrafter(Reference.chemicalReactorRecipe, this, 2, 2, this.inventory, inputs, outputs);
}
@Override
public void updateEntity() {
super.updateEntity();
crafter.updateEntity();
charge(3);
this.crafter.updateEntity();
this.charge(3);
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final EnumFacing side) {
return false;
}
@Override
public EnumFacing getFacing() {
return getFacingEnum();
return this.getFacingEnum();
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
public boolean wrenchCanRemove(final EntityPlayer entityPlayer) {
return entityPlayer.isSneaking();
}
@ -60,7 +66,7 @@ public class TileChemicalReactor extends TilePowerAcceptor implements IWrenchabl
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
return new ItemStack(ModBlocks.CHEMICAL_REACTOR, 1);
}
@ -69,33 +75,33 @@ public class TileChemicalReactor extends TilePowerAcceptor implements IWrenchabl
}
@Override
public void readFromNBT(NBTTagCompound tagCompound) {
public void readFromNBT(final NBTTagCompound tagCompound) {
super.readFromNBT(tagCompound);
crafter.readFromNBT(tagCompound);
this.crafter.readFromNBT(tagCompound);
}
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
super.writeToNBT(tagCompound);
crafter.writeToNBT(tagCompound);
this.crafter.writeToNBT(tagCompound);
return tagCompound;
}
// ISidedInventory
@Override
public int[] getSlotsForFace(EnumFacing side) {
public int[] getSlotsForFace(final EnumFacing side) {
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2 } : new int[] { 0, 1, 2 };
}
@Override
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
public boolean canInsertItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) {
if (slotIndex == 2)
return false;
return isItemValidForSlot(slotIndex, itemStack);
return this.isItemValidForSlot(slotIndex, itemStack);
}
@Override
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
public boolean canExtractItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) {
return slotIndex == 2;
}
@ -109,9 +115,9 @@ public class TileChemicalReactor extends TilePowerAcceptor implements IWrenchabl
// }
// }
public int getProgressScaled(int scale) {
if (crafter.currentTickTime != 0) {
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
public int getProgressScaled(final int scale) {
if (this.crafter.currentTickTime != 0) {
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
}
return 0;
}
@ -122,12 +128,12 @@ public class TileChemicalReactor extends TilePowerAcceptor implements IWrenchabl
}
@Override
public boolean canAcceptEnergy(EnumFacing direction) {
public boolean canAcceptEnergy(final EnumFacing direction) {
return true;
}
@Override
public boolean canProvideEnergy(EnumFacing direction) {
public boolean canProvideEnergy(final EnumFacing direction) {
return false;
}
@ -148,11 +154,19 @@ public class TileChemicalReactor extends TilePowerAcceptor implements IWrenchabl
@Override
public Inventory getInventory() {
return inventory;
return this.inventory;
}
@Override
public RecipeCrafter getRecipeCrafter() {
return crafter;
return this.crafter;
}
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("chemicalreactor").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(this).slot(0, 70, 21).slot(1, 90, 21).outputSlot(2, 80, 51).energySlot(3, 8, 51)
.upgradeSlot(4, 152, 8).upgradeSlot(5, 152, 26).upgradeSlot(6, 152, 44).upgradeSlot(7, 152, 62)
.syncEnergyValue().syncCrafterValue().addInventory().create();
}
}

View file

@ -3,14 +3,19 @@ package techreborn.tiles;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import reborncore.api.power.EnumPowerTier;
import reborncore.api.tile.IInventoryProvider;
import reborncore.common.IWrenchable;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.util.Inventory;
import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.init.ModBlocks;
public class TileChunkLoader extends TilePowerAcceptor implements IWrenchable, IInventoryProvider {
public class TileChunkLoader extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, IContainerProvider {
public Inventory inventory = new Inventory(1, "TileChunkLoader", 64, this);
@ -24,17 +29,17 @@ public class TileChunkLoader extends TilePowerAcceptor implements IWrenchable, I
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final EnumFacing side) {
return false;
}
@Override
public EnumFacing getFacing() {
return getFacingEnum();
return this.getFacingEnum();
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
public boolean wrenchCanRemove(final EntityPlayer entityPlayer) {
return entityPlayer.isSneaking();
}
@ -44,7 +49,7 @@ public class TileChunkLoader extends TilePowerAcceptor implements IWrenchable, I
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
return new ItemStack(ModBlocks.CHUNK_LOADER, 1);
}
@ -58,12 +63,12 @@ public class TileChunkLoader extends TilePowerAcceptor implements IWrenchable, I
}
@Override
public boolean canAcceptEnergy(EnumFacing direction) {
public boolean canAcceptEnergy(final EnumFacing direction) {
return true;
}
@Override
public boolean canProvideEnergy(EnumFacing direction) {
public boolean canProvideEnergy(final EnumFacing direction) {
return false;
}
@ -84,6 +89,12 @@ public class TileChunkLoader extends TilePowerAcceptor implements IWrenchable, I
@Override
public Inventory getInventory() {
return inventory;
return this.inventory;
}
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("chunkloader").player(player.inventory).inventory().hotbar().addInventory()
.create();
}
}

View file

@ -1,8 +1,20 @@
package techreborn.tiles;
public class TileDigitalChest extends TileTechStorageBase {
import net.minecraft.entity.player.EntityPlayer;
import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder;
public class TileDigitalChest extends TileTechStorageBase implements IContainerProvider {
public TileDigitalChest() {
super("TileDigitalChest", 32768);
}
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("digitalchest").player(player.inventory).inventory().hotbar().addInventory()
.tile(this).slot(0, 80, 17).outputSlot(1, 80, 53).fakeSlot(2, 59, 42).addInventory().create();
}
}

View file

@ -5,6 +5,7 @@ import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import reborncore.api.power.EnumPowerTier;
import reborncore.api.recipe.IRecipeCrafterProvider;
import reborncore.api.tile.IInventoryProvider;
@ -12,10 +13,15 @@ import reborncore.common.IWrenchable;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.util.Inventory;
import techreborn.api.Reference;
import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.init.ModBlocks;
public class TileIndustrialElectrolyzer extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, ISidedInventory, IRecipeCrafterProvider {
public class TileIndustrialElectrolyzer extends TilePowerAcceptor
implements IWrenchable, IInventoryProvider, ISidedInventory, IRecipeCrafterProvider, IContainerProvider {
public int tickTime;
public Inventory inventory = new Inventory(8, "TileIndustrialElectrolyzer", 64, this);
@ -24,36 +30,36 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor implements IWr
public TileIndustrialElectrolyzer() {
super(2);
// Input slots
int[] inputs = new int[2];
final int[] inputs = new int[2];
inputs[0] = 0;
inputs[1] = 1;
int[] outputs = new int[4];
final int[] outputs = new int[4];
outputs[0] = 2;
outputs[1] = 3;
outputs[2] = 4;
outputs[3] = 5;
crafter = new RecipeCrafter(Reference.industrialElectrolyzerRecipe, this, 2, 4, inventory, inputs, outputs);
this.crafter = new RecipeCrafter(Reference.industrialElectrolyzerRecipe, this, 2, 4, this.inventory, inputs, outputs);
}
@Override
public void updateEntity() {
super.updateEntity();
crafter.updateEntity();
charge(6);
this.crafter.updateEntity();
this.charge(6);
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final EnumFacing side) {
return false;
}
@Override
public EnumFacing getFacing() {
return getFacingEnum();
return this.getFacingEnum();
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
public boolean wrenchCanRemove(final EntityPlayer entityPlayer) {
return entityPlayer.isSneaking();
}
@ -63,7 +69,7 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor implements IWr
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
return new ItemStack(ModBlocks.INDUSTRIAL_ELECTROLYZER, 1);
}
@ -72,15 +78,15 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor implements IWr
}
@Override
public void readFromNBT(NBTTagCompound tagCompound) {
public void readFromNBT(final NBTTagCompound tagCompound) {
super.readFromNBT(tagCompound);
crafter.readFromNBT(tagCompound);
this.crafter.readFromNBT(tagCompound);
}
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
super.writeToNBT(tagCompound);
crafter.writeToNBT(tagCompound);
this.crafter.writeToNBT(tagCompound);
return tagCompound;
}
@ -96,25 +102,25 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor implements IWr
// ISidedInventory
@Override
public int[] getSlotsForFace(EnumFacing side) {
public int[] getSlotsForFace(final EnumFacing side) {
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2, 3, 4, 5 } : new int[] { 0, 1, 2, 3, 4, 5 };
}
@Override
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
public boolean canInsertItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) {
if (slotIndex >= 1)
return false;
return isItemValidForSlot(slotIndex, itemStack);
return this.isItemValidForSlot(slotIndex, itemStack);
}
@Override
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
public boolean canExtractItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) {
return slotIndex == 2 || slotIndex == 3 || slotIndex == 4 || slotIndex == 5;
}
public int getProgressScaled(int scale) {
if (crafter.currentTickTime != 0) {
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
public int getProgressScaled(final int scale) {
if (this.crafter.currentTickTime != 0) {
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
}
return 0;
}
@ -125,12 +131,12 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor implements IWr
}
@Override
public boolean canAcceptEnergy(EnumFacing direction) {
public boolean canAcceptEnergy(final EnumFacing direction) {
return true;
}
@Override
public boolean canProvideEnergy(EnumFacing direction) {
public boolean canProvideEnergy(final EnumFacing direction) {
return false;
}
@ -151,11 +157,19 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor implements IWr
@Override
public Inventory getInventory() {
return inventory;
return this.inventory;
}
@Override
public RecipeCrafter getRecipeCrafter() {
return crafter;
return this.crafter;
}
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("industrialelectrolyzer").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(this).slot(0, 80, 51).slot(1, 50, 51).outputSlot(2, 50, 19).outputSlot(3, 70, 19)
.outputSlot(4, 90, 19).outputSlot(5, 110, 19).energySlot(6, 18, 51).syncEnergyValue().syncCrafterValue()
.addInventory().create();
}
}

View file

@ -1,6 +1,7 @@
package techreborn.tiles;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.Item;
@ -14,7 +15,12 @@ import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.tile.TileLegacyMachineBase;
import reborncore.common.util.Inventory;
public class TileIronFurnace extends TileLegacyMachineBase implements IInventoryProvider, ISidedInventory {
import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder;
public class TileIronFurnace extends TileLegacyMachineBase
implements IInventoryProvider, ISidedInventory, IContainerProvider {
private static final int[] SLOTS_TOP = new int[] { 0 };
private static final int[] SLOTS_BOTTOM = new int[] { 2, 1 };
@ -181,4 +187,12 @@ public class TileIronFurnace extends TileLegacyMachineBase implements IInventory
public void setTotalBurnTime(final int totalBurnTime) {
this.fuelGague = totalBurnTime;
}
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("ironfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(this).slot(0, 56, 17).outputSlot(1, 116, 34).fuelSlot(2, 56, 53)
.syncIntegerValue(this::getBurnTime, this::setBurnTime)
.syncIntegerValue(this::getTotalBurnTime, this::setTotalBurnTime).addInventory().create();
}
}

View file

@ -11,11 +11,15 @@ import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.util.Inventory;
import reborncore.common.util.ItemUtils;
import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.init.ModBlocks;
import techreborn.init.ModItems;
import techreborn.items.ItemParts;
public class TileMatterFabricator extends TilePowerAcceptor implements IWrenchable, IInventoryProvider {
public class TileMatterFabricator extends TilePowerAcceptor
implements IWrenchable, IInventoryProvider, IContainerProvider {
public static int fabricationRate = 10000;
public int tickTime;
@ -218,4 +222,12 @@ public class TileMatterFabricator extends TilePowerAcceptor implements IWrenchab
}
return 0;
}
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("matterfabricator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(this).slot(0, 33, 17).slot(1, 33, 35).slot(2, 33, 53).slot(3, 51, 17)
.slot(4, 51, 35).slot(5, 51, 53).outputSlot(6, 116, 35).syncEnergyValue()
.syncIntegerValue(this::getProgress, this::setProgress).addInventory().create();
}
}

View file

@ -1,8 +1,20 @@
package techreborn.tiles;
public class TileQuantumChest extends TileTechStorageBase {
import net.minecraft.entity.player.EntityPlayer;
import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder;
public class TileQuantumChest extends TileTechStorageBase implements IContainerProvider {
public TileQuantumChest() {
super("TileQuantumChest", Integer.MAX_VALUE);
}
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("quantumchest").player(player.inventory).inventory().hotbar().addInventory()
.tile(this).slot(0, 80, 17).outputSlot(1, 80, 53).fakeSlot(2, 59, 42).addInventory().create();
}
}

View file

@ -8,6 +8,7 @@ import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import reborncore.api.IListInfoProvider;
import reborncore.api.tile.IInventoryProvider;
import reborncore.common.IWrenchable;
@ -15,63 +16,67 @@ import reborncore.common.tile.TileLegacyMachineBase;
import reborncore.common.util.FluidUtils;
import reborncore.common.util.Inventory;
import reborncore.common.util.Tank;
import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.init.ModBlocks;
import java.util.List;
public class TileQuantumTank extends TileLegacyMachineBase
implements IInventoryProvider, IWrenchable, IListInfoProvider {
implements IInventoryProvider, IWrenchable, IListInfoProvider, IContainerProvider {
public Tank tank = new Tank("TileQuantumTank", Integer.MAX_VALUE, this);
public Inventory inventory = new Inventory(3, "TileQuantumTank", 64, this);
@Override
public void readFromNBT(NBTTagCompound tagCompound) {
public void readFromNBT(final NBTTagCompound tagCompound) {
super.readFromNBT(tagCompound);
readFromNBTWithoutCoords(tagCompound);
this.readFromNBTWithoutCoords(tagCompound);
}
public void readFromNBTWithoutCoords(NBTTagCompound tagCompound) {
tank.readFromNBT(tagCompound);
public void readFromNBTWithoutCoords(final NBTTagCompound tagCompound) {
this.tank.readFromNBT(tagCompound);
}
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
super.writeToNBT(tagCompound);
writeToNBTWithoutCoords(tagCompound);
this.writeToNBTWithoutCoords(tagCompound);
return tagCompound;
}
public NBTTagCompound writeToNBTWithoutCoords(NBTTagCompound tagCompound) {
tank.writeToNBT(tagCompound);
public NBTTagCompound writeToNBTWithoutCoords(final NBTTagCompound tagCompound) {
this.tank.writeToNBT(tagCompound);
return tagCompound;
}
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
world.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
getPos().getY(), getPos().getZ());
readFromNBT(packet.getNbtCompound());
public void onDataPacket(final NetworkManager net, final SPacketUpdateTileEntity packet) {
this.world.markBlockRangeForRenderUpdate(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(),
this.getPos().getX(), this.getPos().getY(), this.getPos().getZ());
this.readFromNBT(packet.getNbtCompound());
}
@Override
public void updateEntity() {
super.updateEntity();
if (!world.isRemote) {
if (FluidUtils.drainContainers(tank, inventory, 0, 1)
|| FluidUtils.fillContainers(tank, inventory, 0, 1, tank.getFluidType()))
if (!this.world.isRemote) {
if (FluidUtils.drainContainers(this.tank, this.inventory, 0, 1)
|| FluidUtils.fillContainers(this.tank, this.inventory, 0, 1, this.tank.getFluidType()))
this.syncWithAll();
if (tank.getFluidType() != null && getStackInSlot(2) == ItemStack.EMPTY) {
inventory.setInventorySlotContents(2, new ItemStack(tank.getFluidType().getBlock()));
} else if (tank.getFluidType() == null && getStackInSlot(2) != ItemStack.EMPTY) {
setInventorySlotContents(2, ItemStack.EMPTY);
if (this.tank.getFluidType() != null && this.getStackInSlot(2) == ItemStack.EMPTY) {
this.inventory.setInventorySlotContents(2, new ItemStack(this.tank.getFluidType().getBlock()));
} else if (this.tank.getFluidType() == null && this.getStackInSlot(2) != ItemStack.EMPTY) {
this.setInventorySlotContents(2, ItemStack.EMPTY);
}
}
}
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
public boolean hasCapability(final Capability<?> capability, final EnumFacing facing) {
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
return true;
}
@ -79,25 +84,25 @@ public class TileQuantumTank extends TileLegacyMachineBase
}
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
public <T> T getCapability(final Capability<T> capability, final EnumFacing facing) {
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
return (T) tank;
return (T) this.tank;
}
return super.getCapability(capability, facing);
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final EnumFacing side) {
return false;
}
@Override
public EnumFacing getFacing() {
return getFacingEnum();
return this.getFacingEnum();
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
public boolean wrenchCanRemove(final EntityPlayer entityPlayer) {
return entityPlayer.isSneaking();
}
@ -107,34 +112,41 @@ public class TileQuantumTank extends TileLegacyMachineBase
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return getDropWithNBT();
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
return this.getDropWithNBT();
}
public ItemStack getDropWithNBT() {
NBTTagCompound tileEntity = new NBTTagCompound();
ItemStack dropStack = new ItemStack(ModBlocks.QUANTUM_TANK, 1);
writeToNBTWithoutCoords(tileEntity);
final NBTTagCompound tileEntity = new NBTTagCompound();
final ItemStack dropStack = new ItemStack(ModBlocks.QUANTUM_TANK, 1);
this.writeToNBTWithoutCoords(tileEntity);
dropStack.setTagCompound(new NBTTagCompound());
dropStack.getTagCompound().setTag("tileEntity", tileEntity);
return dropStack;
}
@Override
public void addInfo(List<String> info, boolean isRealTile) {
public void addInfo(final List<String> info, final boolean isRealTile) {
if (isRealTile) {
if (tank.getFluid() != null) {
info.add(tank.getFluidAmount() + " of " + tank.getFluidType().getName());
if (this.tank.getFluid() != null) {
info.add(this.tank.getFluidAmount() + " of " + this.tank.getFluidType().getName());
} else {
info.add("Empty");
}
}
info.add("Capacity " + tank.getCapacity() + " mb");
info.add("Capacity " + this.tank.getCapacity() + " mb");
}
@Override
public Inventory getInventory() {
return inventory;
return this.inventory;
}
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("quantumtank").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(this).fluidSlot(0, 80, 17).outputSlot(1, 80, 53).fakeSlot(2, 59, 42).addInventory()
.create();
}
}

View file

@ -15,10 +15,14 @@ import reborncore.common.util.Inventory;
import reborncore.common.util.ItemUtils;
import techreborn.api.RollingMachineRecipe;
import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.init.ModBlocks;
//TODO add tick and power bars.
public class TileRollingMachine extends TilePowerAcceptor implements IWrenchable, IInventoryProvider {
public class TileRollingMachine extends TilePowerAcceptor
implements IWrenchable, IInventoryProvider, IContainerProvider {
public final InventoryCrafting craftMatrix = new InventoryCrafting(new RollingTileContainer(), 3, 3);
public Inventory inventory = new Inventory(3, "TileRollingMachine", 64, this);
@ -204,4 +208,15 @@ public class TileRollingMachine extends TilePowerAcceptor implements IWrenchable
}
return this.tickTime * scale / this.runTime;
}
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("rollingmachine").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(this.craftMatrix).slot(0, 30, 17).slot(1, 48, 17).slot(2, 66, 17).slot(3, 30, 35)
.slot(4, 48, 35).slot(5, 66, 35).slot(6, 30, 53).slot(7, 48, 53).slot(8, 66, 53)
.onCraft(inv -> this.inventory.setInventorySlotContents(1,
RollingMachineRecipe.instance.findMatchingRecipe(inv, this.world)))
.addInventory().tile(this).outputSlot(0, 124, 35).energySlot(2, 8, 51).syncEnergyValue()
.syncIntegerValue(this::getBurnTime, this::setBurnTime).addInventory().create();
}
}

View file

@ -14,12 +14,16 @@ import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.util.Inventory;
import techreborn.api.ScrapboxList;
import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.init.ModBlocks;
import techreborn.init.ModItems;
import java.util.Random;
public class TileScrapboxinator extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, ISidedInventory {
public class TileScrapboxinator extends TilePowerAcceptor
implements IWrenchable, IInventoryProvider, ISidedInventory, IContainerProvider {
public Inventory inventory = new Inventory(6, "TileScrapboxinator", 64, this);
public int capacity = 1000;
@ -199,4 +203,13 @@ public class TileScrapboxinator extends TilePowerAcceptor implements IWrenchable
public void setProgress(final int progress) {
this.progress = progress;
}
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("scrapboxinator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(this).filterSlot(0, 56, 34, stack -> stack.getItem() == ModItems.SCRAP_BOX)
.outputSlot(1, 116, 34).upgradeSlot(2, 152, 8).upgradeSlot(3, 152, 26).upgradeSlot(4, 152, 44)
.upgradeSlot(5, 152, 62).syncEnergyValue().syncIntegerValue(this::getProgress, this::setProgress)
.addInventory().create();
}
}

View file

@ -1,5 +1,6 @@
package techreborn.tiles.fusionReactor;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
@ -14,9 +15,12 @@ import reborncore.common.util.ItemUtils;
import techreborn.api.reactor.FusionReactorRecipe;
import techreborn.api.reactor.FusionReactorRecipeHelper;
import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.init.ModBlocks;
public class TileEntityFusionController extends TilePowerAcceptor implements IInventoryProvider {
public class TileEntityFusionController extends TilePowerAcceptor implements IInventoryProvider, IContainerProvider {
public Inventory inventory = new Inventory(3, "TileEntityFusionController", 64, this);
@ -324,4 +328,14 @@ public class TileEntityFusionController extends TilePowerAcceptor implements IIn
return Math.max(0, Math.min(24, (this.getCrafingTickTime() > 0 ? 1 : 0)
+ this.getCrafingTickTime() * 24 / (this.finalTickTime < 1 ? 1 : this.finalTickTime)));
}
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("fusionreactor").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(this).slot(0, 88, 17).slot(1, 88, 53).outputSlot(2, 148, 35).syncEnergyValue()
.syncIntegerValue(this::getCoilStatus, this::setCoilStatus)
.syncIntegerValue(this::getCrafingTickTime, this::setCrafingTickTime)
.syncIntegerValue(this::getFinalTickTime, this::setFinalTickTime)
.syncIntegerValue(this::getNeededPower, this::setNeededPower).addInventory().create();
}
}

View file

@ -2,12 +2,17 @@ package techreborn.tiles.generator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import reborncore.api.power.EnumPowerTier;
import techreborn.api.generator.EFluidGenerator;
import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.config.ConfigTechReborn;
import techreborn.init.ModBlocks;
public class TileDieselGenerator extends TileBaseFluidGenerator {
public class TileDieselGenerator extends TileBaseFluidGenerator implements IContainerProvider {
public TileDieselGenerator() {
super(EFluidGenerator.DIESEL, ConfigTechReborn.ThermalGeneratorTier, "TileDieselGenerator", 1000 * 10,
@ -15,7 +20,7 @@ public class TileDieselGenerator extends TileBaseFluidGenerator {
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
return new ItemStack(ModBlocks.DIESEL_GENERATOR, 1);
}
@ -33,4 +38,11 @@ public class TileDieselGenerator extends TileBaseFluidGenerator {
public EnumPowerTier getTier() {
return EnumPowerTier.LOW;
}
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("dieselgenerator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(this).slot(0, 80, 17).outputSlot(1, 80, 53).fakeSlot(2, 59, 42).syncEnergyValue()
.addInventory().create();
}
}

View file

@ -2,19 +2,24 @@ package techreborn.tiles.generator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import reborncore.api.power.EnumPowerTier;
import techreborn.api.generator.EFluidGenerator;
import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.config.ConfigTechReborn;
import techreborn.init.ModBlocks;
public class TileGasTurbine extends TileBaseFluidGenerator {
public class TileGasTurbine extends TileBaseFluidGenerator implements IContainerProvider {
public TileGasTurbine() {
super(EFluidGenerator.GAS, ConfigTechReborn.ThermalGeneratorTier, "TileGasTurbine", 1000 * 10, 16);
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) {
return new ItemStack(ModBlocks.GAS_TURBINE, 1);
}
@ -27,4 +32,11 @@ public class TileGasTurbine extends TileBaseFluidGenerator {
public double getMaxPower() {
return ConfigTechReborn.ThermalGeneratorCharge;
}
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("gasturbine").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(this).slot(0, 80, 17).outputSlot(1, 80, 53).fakeSlot(2, 59, 42).syncEnergyValue()
.addInventory().create();
}
}

View file

@ -15,9 +15,12 @@ import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.util.Inventory;
import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.init.ModBlocks;
public class TileGenerator extends TilePowerAcceptor implements IWrenchable, IInventoryProvider {
public class TileGenerator extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, IContainerProvider {
public static int outputAmount = 10;
public Inventory inventory = new Inventory(2, "TileGenerator", 64, this);
public int fuelSlot = 0;
@ -163,4 +166,12 @@ public class TileGenerator extends TilePowerAcceptor implements IWrenchable, IIn
public int getScaledBurnTime(final int i) {
return (int) ((float) this.burnTime / (float) this.totalBurnTime * i);
}
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("generator").player(player.inventory).inventory(8, 84).hotbar(8, 142).addInventory()
.tile(this).fuelSlot(0, 80, 53).energySlot(1, 80, 17).syncEnergyValue()
.syncIntegerValue(this::getBurnTime, this::setBurnTime)
.syncIntegerValue(this::getTotalBurnTime, this::setTotalBurnTime).addInventory().create();
}
}

View file

@ -2,19 +2,24 @@ package techreborn.tiles.generator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import reborncore.api.power.EnumPowerTier;
import techreborn.api.generator.EFluidGenerator;
import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.config.ConfigTechReborn;
import techreborn.init.ModBlocks;
public class TileSemifluidGenerator extends TileBaseFluidGenerator {
public class TileSemifluidGenerator extends TileBaseFluidGenerator implements IContainerProvider {
public TileSemifluidGenerator() {
super(EFluidGenerator.SEMIFLUID, ConfigTechReborn.ThermalGeneratorTier, "TileSemifluidGenerator", 1000 * 10, 8);
}
@Override
public ItemStack getWrenchDrop(EntityPlayer arg0) {
public ItemStack getWrenchDrop(final EntityPlayer arg0) {
return new ItemStack(ModBlocks.SEMIFLUID_GENERATOR, 1);
}
@ -27,4 +32,11 @@ public class TileSemifluidGenerator extends TileBaseFluidGenerator {
public double getMaxPower() {
return ConfigTechReborn.ThermalGeneratorCharge;
}
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("semifluidgenerator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(this).slot(0, 80, 17).outputSlot(1, 80, 53).fakeSlot(2, 59, 42).syncEnergyValue()
.addInventory().create();
}
}

Some files were not shown because too many files have changed in this diff Show more