mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
RBMK autoloader
This commit is contained in:
parent
fd04024706
commit
2102db6229
@ -14,7 +14,10 @@
|
||||
## Changed
|
||||
* The alternate recipes for nitric acid and xenon gas in the chemical plant now require blueprints
|
||||
* The chemical plant now has a recipe for making cobblestone from 25mB of lava (which can be liquefacted into even more lava, useful for cobblestone generation)
|
||||
* Removed the old arc furnace
|
||||
|
||||
## Fixed
|
||||
* Fixed a few assembler recipes using the old crafting numbers which sometimes exceed the stack limit
|
||||
* As an extra safeguard, the recipe loader now throws an exception if that happens
|
||||
* As an extra safeguard, the recipe loader now throws an exception if that happens
|
||||
* Fixed dupe caused by the breeding reactor
|
||||
* Fixed a potential crash caused by a change done to tile entity proxies in relation to EnergyControl
|
||||
@ -750,9 +750,6 @@ public class ModBlocks {
|
||||
|
||||
public static Block machine_microwave;
|
||||
|
||||
public static Block machine_arc_furnace_off;
|
||||
public static Block machine_arc_furnace_on;
|
||||
|
||||
//public static Block machine_deuterium;
|
||||
|
||||
public static Block machine_battery_potato;
|
||||
@ -1124,6 +1121,7 @@ public class ModBlocks {
|
||||
public static Block rbmk_heater;
|
||||
public static Block rbmk_console;
|
||||
public static Block rbmk_crane_console;
|
||||
public static Block rbmk_autoloader;
|
||||
public static Block rbmk_loader;
|
||||
public static Block rbmk_steam_inlet;
|
||||
public static Block rbmk_steam_outlet;
|
||||
@ -1526,7 +1524,7 @@ public class ModBlocks {
|
||||
floodlight = new Floodlight(Material.iron).setBlockName("floodlight").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
floodlight_beam = new FloodlightBeam().setBlockName("floodlight_beam");
|
||||
|
||||
rebar = new BlockRebar().setBlockName("rebar").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(100.0F).setBlockTextureName(RefStrings.MODID + ":rebar");
|
||||
rebar = new BlockRebar().setBlockName("rebar").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(20.0F).setBlockTextureName(RefStrings.MODID + ":rebar");
|
||||
reinforced_stone = new BlockGeneric(Material.rock).setBlockName("reinforced_stone").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(100.0F).setBlockTextureName(RefStrings.MODID + ":reinforced_stone");
|
||||
concrete_smooth = new BlockRadResistant(Material.rock).setBlockName("concrete_smooth").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(140.0F).setBlockTextureName(RefStrings.MODID + ":concrete");
|
||||
concrete_colored = new BlockConcreteColored(Material.rock).setBlockName("concrete_colored").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(140.0F).setBlockTextureName(RefStrings.MODID + ":concrete");
|
||||
@ -1877,8 +1875,6 @@ public class ModBlocks {
|
||||
|
||||
machine_electric_furnace_off = new MachineElectricFurnace(false).setBlockName("machine_electric_furnace_off").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
machine_electric_furnace_on = new MachineElectricFurnace(true).setBlockName("machine_electric_furnace_on").setHardness(5.0F).setLightLevel(1.0F).setResistance(10.0F);
|
||||
machine_arc_furnace_off = new MachineArcFurnace(false).setBlockName("machine_arc_furnace_off").setHardness(5.0F).setResistance(10.0F);
|
||||
machine_arc_furnace_on = new MachineArcFurnace(true).setBlockName("machine_arc_furnace_on").setHardness(5.0F).setLightLevel(1.0F).setResistance(10.0F);
|
||||
machine_arc_furnace = new MachineArcFurnaceLarge().setBlockName("machine_arc_furnace").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_microwave = new MachineMicrowave(Material.iron).setBlockName("machine_microwave").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_microwave");
|
||||
|
||||
@ -2173,6 +2169,7 @@ public class ModBlocks {
|
||||
rbmk_heater = new RBMKHeater().setBlockName("rbmk_heater").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_heater");
|
||||
rbmk_console = new RBMKConsole().setBlockName("rbmk_console").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_console");
|
||||
rbmk_crane_console = new RBMKCraneConsole().setBlockName("rbmk_crane_console").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_crane_console");
|
||||
rbmk_autoloader = new RBMKAutoloader().setBlockName("rbmk_autoloader").setCreativeTab(MainRegistry.machineTab).setHardness(50.0F).setResistance(60.0F).setBlockTextureName(RefStrings.MODID + ":rbmk_autoloader");
|
||||
rbmk_loader = new RBMKLoader(Material.iron).setBlockName("rbmk_loader").setCreativeTab(MainRegistry.machineTab).setHardness(50.0F).setResistance(60.0F).setBlockTextureName(RefStrings.MODID + ":rbmk_loader");
|
||||
rbmk_steam_inlet = new RBMKInlet(Material.iron).setBlockName("rbmk_steam_inlet").setCreativeTab(MainRegistry.machineTab).setHardness(50.0F).setResistance(60.0F).setBlockTextureName(RefStrings.MODID + ":rbmk_steam_inlet");
|
||||
rbmk_steam_outlet = new RBMKOutlet(Material.iron).setBlockName("rbmk_steam_outlet").setCreativeTab(MainRegistry.machineTab).setHardness(50.0F).setResistance(60.0F).setBlockTextureName(RefStrings.MODID + ":rbmk_steam_outlet");
|
||||
@ -3188,6 +3185,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(rbmk_heater, rbmk_heater.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(rbmk_console, rbmk_console.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(rbmk_crane_console, rbmk_crane_console.getUnlocalizedName());
|
||||
register(rbmk_autoloader);
|
||||
register(rbmk_loader);
|
||||
register(rbmk_steam_inlet);
|
||||
register(rbmk_steam_outlet);
|
||||
@ -3293,8 +3291,6 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(machine_converter_rf_he, machine_converter_rf_he.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_electric_furnace_off, machine_electric_furnace_off.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_electric_furnace_on, machine_electric_furnace_on.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_arc_furnace_off, machine_arc_furnace_off.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_arc_furnace_on, machine_arc_furnace_on.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_microwave, machine_microwave.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_assembler, machine_assembler.getUnlocalizedName());
|
||||
register(machine_assembly_machine);
|
||||
|
||||
@ -1,288 +0,0 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineArcFurnace;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class MachineArcFurnace extends BlockContainer {
|
||||
|
||||
private final Random field_149933_a = new Random();
|
||||
private final boolean isActive;
|
||||
private static boolean keepInventory;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconFront;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBottom;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconRods;
|
||||
|
||||
public MachineArcFurnace(boolean blockState) {
|
||||
super(Material.iron);
|
||||
isActive = blockState;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.iconFront = iconRegister.registerIcon(RefStrings.MODID + (this.isActive ? ":machine_arc_furnace_front_on" : ":machine_arc_furnace_front_off"));
|
||||
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + (this.isActive ? ":machine_arc_furnace_top_on" : ":machine_arc_furnace_top"));
|
||||
this.iconBottom = iconRegister.registerIcon(RefStrings.MODID + ":machine_arc_furnace_bottom");
|
||||
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":machine_arc_furnace_side");
|
||||
this.iconRods = iconRegister.registerIcon(RefStrings.MODID + ":machine_arc_furnace_top_rods");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
|
||||
if(this == ModBlocks.machine_arc_furnace_off) {
|
||||
|
||||
if(side == 1 && metadata > 5) {
|
||||
return iconRods;
|
||||
}
|
||||
}
|
||||
|
||||
if(metadata > 5)
|
||||
metadata -= 4;
|
||||
|
||||
if(side == 0)
|
||||
return this.iconBottom;
|
||||
if(side == 1)
|
||||
return this.iconTop;
|
||||
|
||||
return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : this.blockIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
|
||||
{
|
||||
return Item.getItemFromBlock(ModBlocks.machine_arc_furnace_off);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
this.setDefaultDirection(world, x, y, z);
|
||||
}
|
||||
|
||||
private void setDefaultDirection(World world, int x, int y, int z) {
|
||||
if(!world.isRemote)
|
||||
{
|
||||
Block block1 = world.getBlock(x, y, z - 1);
|
||||
Block block2 = world.getBlock(x, y, z + 1);
|
||||
Block block3 = world.getBlock(x - 1, y, z);
|
||||
Block block4 = world.getBlock(x + 1, y, z);
|
||||
|
||||
byte b0 = 3;
|
||||
|
||||
if(block1.func_149730_j() && !block2.func_149730_j())
|
||||
{
|
||||
b0 = 3;
|
||||
}
|
||||
if(block2.func_149730_j() && !block1.func_149730_j())
|
||||
{
|
||||
b0 = 2;
|
||||
}
|
||||
if(block3.func_149730_j() && !block4.func_149730_j())
|
||||
{
|
||||
b0 = 5;
|
||||
}
|
||||
if(block4.func_149730_j() && !block3.func_149730_j())
|
||||
{
|
||||
b0 = 4;
|
||||
}
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, b0, 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
||||
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
|
||||
if(i == 0)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
}
|
||||
if(i == 1)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||
}
|
||||
if(i == 2)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
}
|
||||
if(i == 3)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||
}
|
||||
|
||||
if(itemStack.hasDisplayName())
|
||||
{
|
||||
((TileEntityMachineArcFurnace)world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if(world.isRemote)
|
||||
{
|
||||
return true;
|
||||
} else if(!player.isSneaking())
|
||||
{
|
||||
TileEntityMachineArcFurnace entity = (TileEntityMachineArcFurnace) world.getTileEntity(x, y, z);
|
||||
if(entity != null)
|
||||
{
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileEntityMachineArcFurnace();
|
||||
}
|
||||
|
||||
public static void updateBlockState(boolean isProcessing, World world, int x, int y, int z) {
|
||||
int i = world.getBlockMetadata(x, y, z);
|
||||
TileEntity entity = world.getTileEntity(x, y, z);
|
||||
keepInventory = true;
|
||||
|
||||
if(isProcessing)
|
||||
{
|
||||
world.setBlock(x, y, z, ModBlocks.machine_arc_furnace_on);
|
||||
}else{
|
||||
world.setBlock(x, y, z, ModBlocks.machine_arc_furnace_off);
|
||||
}
|
||||
|
||||
keepInventory = false;
|
||||
world.setBlockMetadataWithNotify(x, y, z, i, 2);
|
||||
|
||||
if(entity != null) {
|
||||
entity.validate();
|
||||
world.setTileEntity(x, y, z, entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_)
|
||||
{
|
||||
if (!keepInventory)
|
||||
{
|
||||
TileEntityMachineArcFurnace tileentityfurnace = (TileEntityMachineArcFurnace)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_);
|
||||
|
||||
if (tileentityfurnace != null)
|
||||
{
|
||||
for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1)
|
||||
{
|
||||
ItemStack itemstack = tileentityfurnace.getStackInSlot(i1);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while (itemstack.stackSize > 0)
|
||||
{
|
||||
int j1 = this.field_149933_a.nextInt(21) + 10;
|
||||
|
||||
if (j1 > itemstack.stackSize)
|
||||
{
|
||||
j1 = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j1;
|
||||
EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
{
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float)this.field_149933_a.nextGaussian() * f3;
|
||||
entityitem.motionY = (float)this.field_149933_a.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float)this.field_149933_a.nextGaussian() * f3;
|
||||
p_149749_1_.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_);
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World p_149734_1_, int x, int y, int z, Random rand)
|
||||
{
|
||||
if (isActive)
|
||||
{
|
||||
int l = p_149734_1_.getBlockMetadata(x, y, z);
|
||||
float f = x + 0.5F;
|
||||
float f1 = y + 0.0F + rand.nextFloat() * 6.0F / 16.0F;
|
||||
float f2 = z + 0.5F;
|
||||
float f3 = 0.52F;
|
||||
float f4 = rand.nextFloat() * 0.6F - 0.3F;
|
||||
|
||||
if (l == 4)
|
||||
{
|
||||
p_149734_1_.spawnParticle("smoke", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (l == 5)
|
||||
{
|
||||
p_149734_1_.spawnParticle("smoke", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (l == 2)
|
||||
{
|
||||
p_149734_1_.spawnParticle("smoke", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (l == 3)
|
||||
{
|
||||
p_149734_1_.spawnParticle("smoke", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
|
||||
p_149734_1_.spawnParticle("flame", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_)
|
||||
{
|
||||
return Item.getItemFromBlock(ModBlocks.machine_arc_furnace_off);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package com.hbm.blocks.machine.rbmk;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKAutoloader;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class RBMKAutoloader extends BlockDummyable {
|
||||
|
||||
public RBMKAutoloader() {
|
||||
super(Material.iron);
|
||||
|
||||
this.bounding.add(AxisAlignedBB.getBoundingBox(-0.125, 0, -0.125, 0.125, 4, 0.125));
|
||||
this.bounding.add(AxisAlignedBB.getBoundingBox(-0.5, 4, -0.5, 0.5, 9, 0.5));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
if(meta >= 12) return new TileEntityRBMKAutoloader();
|
||||
return new TileEntityProxyCombo().inventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getDimensions() {
|
||||
return new int[] {8, 0, 0, 0, 0, 0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOffset() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
return this.standardOpenBehavior(world, x, y, z, player, 0);
|
||||
}
|
||||
}
|
||||
@ -1,90 +0,0 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.inventory.SlotSmelting;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineArcFurnace;
|
||||
|
||||
import api.hbm.energymk2.IBatteryItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerMachineArcFurnace extends Container {
|
||||
|
||||
private TileEntityMachineArcFurnace diFurnace;
|
||||
|
||||
public ContainerMachineArcFurnace(InventoryPlayer invPlayer, TileEntityMachineArcFurnace tedf) {
|
||||
|
||||
diFurnace = tedf;
|
||||
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 56, 17));
|
||||
this.addSlotToContainer(new SlotSmelting(invPlayer.player, tedf, 1, 116, 35));
|
||||
this.addSlotToContainer(new Slot(tedf, 2, 38, 53));
|
||||
this.addSlotToContainer(new Slot(tedf, 3, 56, 53));
|
||||
this.addSlotToContainer(new Slot(tedf, 4, 74, 53));
|
||||
this.addSlotToContainer(new Slot(tedf, 5, 8, 53));
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 9; j++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting crafting) {
|
||||
super.addCraftingToCrafters(crafting);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
ItemStack rStack = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(index);
|
||||
|
||||
if(slot != null && slot.getHasStack()) {
|
||||
ItemStack stack = slot.getStack();
|
||||
rStack = stack.copy();
|
||||
|
||||
if(index <= 5) {
|
||||
if(!this.mergeItemStack(stack, 6, this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.onSlotChange(stack, rStack);
|
||||
|
||||
} else {
|
||||
|
||||
if(rStack.getItem() instanceof IBatteryItem || rStack.getItem() == ModItems.battery_creative) {
|
||||
if(!this.mergeItemStack(stack, 5, 6, false))
|
||||
return null;
|
||||
|
||||
} else if(rStack.getItem() == ModItems.arc_electrode) {
|
||||
if(!this.mergeItemStack(stack, 2, 5, false))
|
||||
return null;
|
||||
|
||||
} else if(!this.mergeItemStack(stack, 0, 1, false))
|
||||
return null;
|
||||
}
|
||||
|
||||
if(stack.stackSize == 0) {
|
||||
slot.putStack((ItemStack) null);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return rStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return diFurnace.isUseableByPlayer(player);
|
||||
}
|
||||
}
|
||||
@ -43,8 +43,8 @@ public class ContainerMachineReactorBreeding extends Container {
|
||||
ItemStack stack = slot.getStack();
|
||||
var3 = stack.copy();
|
||||
|
||||
if(index <= 1) {
|
||||
if(!this.mergeItemStack(stack, 1, this.inventorySlots.size(), true)) {
|
||||
if(index <= 2) {
|
||||
if(!this.mergeItemStack(stack, 2, this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,54 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKAutoloader;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerRBMKAutoloader extends ContainerBase {
|
||||
|
||||
public TileEntityRBMKAutoloader loader;
|
||||
|
||||
public ContainerRBMKAutoloader(InventoryPlayer invPlayer, TileEntityRBMKAutoloader tedf) {
|
||||
super(invPlayer, tedf);
|
||||
loader = tedf;
|
||||
|
||||
this.addSlots(loader, 0, 17, 18, 3, 3);
|
||||
this.addTakeOnlySlots(loader, 9, 107, 18, 3, 3);
|
||||
this.playerInv(invPlayer, 8, 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
ItemStack rStack = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(index);
|
||||
|
||||
if(slot != null && slot.getHasStack()) {
|
||||
ItemStack stack = slot.getStack();
|
||||
rStack = stack.copy();
|
||||
|
||||
if(index <= 17) {
|
||||
if(!this.mergeItemStack(stack, 18, this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
if(!this.mergeItemStack(stack, 0, 9, false)) return null;
|
||||
}
|
||||
|
||||
if(stack.stackSize == 0) {
|
||||
slot.putStack((ItemStack) null);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return rStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return loader.isUseableByPlayer(player);
|
||||
}
|
||||
}
|
||||
@ -1,64 +0,0 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerMachineArcFurnace;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineArcFurnace;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIMachineArcFurnace extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_arc.png");
|
||||
private TileEntityMachineArcFurnace diFurnace;
|
||||
|
||||
public GUIMachineArcFurnace(InventoryPlayer invPlayer, TileEntityMachineArcFurnace tedf) {
|
||||
super(new ContainerMachineArcFurnace(invPlayer, tedf));
|
||||
diFurnace = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 166;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 51 - 34, 16, 34, diFurnace.power, diFurnace.maxPower);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
if(diFurnace.isInvalid() && diFurnace.getWorldObj().getTileEntity(diFurnace.xCoord, diFurnace.yCoord, diFurnace.zCoord) instanceof TileEntityMachineArcFurnace)
|
||||
diFurnace = (TileEntityMachineArcFurnace) diFurnace.getWorldObj().getTileEntity(diFurnace.xCoord, diFurnace.yCoord, diFurnace.zCoord);
|
||||
|
||||
if(diFurnace.hasPower()) {
|
||||
int i = (int)diFurnace.getPowerRemainingScaled(34);
|
||||
drawTexturedModalRect(guiLeft + 8, guiTop + 51 - i, 176, 67 - i, 16, i);
|
||||
}
|
||||
|
||||
if(diFurnace.canProcess() && diFurnace.hasPower())
|
||||
{
|
||||
drawTexturedModalRect(guiLeft + 55, guiTop + 35, 176, 0, 15, 16);
|
||||
}
|
||||
|
||||
int j1 = diFurnace.getDiFurnaceProgressScaled(24);
|
||||
drawTexturedModalRect(guiLeft + 79, guiTop + 34, 176, 16, j1 + 1, 17);
|
||||
}
|
||||
}
|
||||
72
src/main/java/com/hbm/inventory/gui/GUIRBMKAutoloader.java
Normal file
72
src/main/java/com/hbm/inventory/gui/GUIRBMKAutoloader.java
Normal file
@ -0,0 +1,72 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerRBMKAutoloader;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toserver.NBTControlPacket;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKAutoloader;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIRBMKAutoloader extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/machine/gui_autoloader.png");
|
||||
private TileEntityRBMKAutoloader loader;
|
||||
|
||||
public GUIRBMKAutoloader(InventoryPlayer invPlayer, TileEntityRBMKAutoloader tile) {
|
||||
super(new ContainerRBMKAutoloader(invPlayer, tile));
|
||||
loader = tile;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 182;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int x, int y, int i) {
|
||||
super.mouseClicked(x, y, i);
|
||||
|
||||
if(guiLeft + 74 <= x && guiLeft + 74 + 12 > x && guiTop + 36 < y && guiTop + 36 + 12 >= y) {
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setBoolean("minus", true);
|
||||
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, loader.xCoord, loader.yCoord, loader.zCoord));
|
||||
}
|
||||
|
||||
if(guiLeft + 90 <= x && guiLeft + 90 + 12 > x && guiTop + 36 < y && guiTop + 36 + 12 >= y) {
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setBoolean("plus", true);
|
||||
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, loader.xCoord, loader.yCoord, loader.zCoord));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.loader.hasCustomInventoryName() ? this.loader.getInventoryName() : I18n.format(this.loader.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 0xFFFFFF);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
|
||||
String percent = loader.cycle + "%";
|
||||
this.fontRendererObj.drawString(percent, this.xSize / 2 - this.fontRendererObj.getStringWidth(percent) / 2, 23, 0x00FF00);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
}
|
||||
}
|
||||
@ -4005,7 +4005,7 @@ public class ModItems {
|
||||
upgrade_stack = new ItemMetaUpgrade(3).setUnlocalizedName("upgrade_stack").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_stack");
|
||||
upgrade_ejector = new ItemMetaUpgrade(3).setUnlocalizedName("upgrade_ejector").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":upgrade_ejector");
|
||||
|
||||
rebar_placer = new ItemRebarPlacer().setUnlocalizedName("rebar_placer").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setFull3D().setTextureName(RefStrings.MODID + ":rebar_placer");
|
||||
rebar_placer = new ItemRebarPlacer().setUnlocalizedName("rebar_placer").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":rebar_placer");
|
||||
wand = new ItemWand().setUnlocalizedName("wand_k").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setFull3D().setTextureName(RefStrings.MODID + ":wand");
|
||||
wand_s = new ItemWandS().setUnlocalizedName("wand_s").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setFull3D().setTextureName(RefStrings.MODID + ":wand_s");
|
||||
wand_d = new ItemWandD().setUnlocalizedName("wand_d").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setFull3D().setTextureName(RefStrings.MODID + ":wand_d");
|
||||
|
||||
@ -101,7 +101,10 @@ public class ItemRebarPlacer extends Item implements IGUIProvider {
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float fx, float fy, float fz) {
|
||||
if(world.isRemote) return true;
|
||||
if(!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound();
|
||||
if(!stack.hasTagCompound()) {
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
ItemStackUtil.addStacksToNBT(stack, new ItemStack[] {new ItemStack(ModBlocks.concrete_rebar)});
|
||||
}
|
||||
ItemStack theConk = ItemStackUtil.readStacksFromNBT(stack, 1)[0];
|
||||
|
||||
boolean hasConk = theConk != null && isValidConk(theConk.getItem(), theConk.getItemDamage());
|
||||
|
||||
@ -416,6 +416,7 @@ public class ClientProxy extends ServerProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRBMKCooler.class, new RenderRBMKLid());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRBMKStorage.class, new RenderRBMKLid());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRBMKHeater.class, new RenderRBMKLid());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRBMKAutoloader.class, new RenderRBMKAutoloader());
|
||||
//ITER
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityITER.class, new RenderITER());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachinePlasmaHeater.class, new RenderPlasmaHeater());
|
||||
|
||||
@ -1721,6 +1721,8 @@ public class MainRegistry {
|
||||
ignoreMappings.add("hbm:item.journal_pip");
|
||||
ignoreMappings.add("hbm:item.journal_bj");
|
||||
ignoreMappings.add("hbm:item.journal_silver");
|
||||
ignoreMappings.add("hbm:tile.machine_arc_furnace_off");
|
||||
ignoreMappings.add("hbm:tile.machine_arc_furnace_on");
|
||||
|
||||
/// REMAP ///
|
||||
remapItems.put("hbm:item.gadget_explosive8", ModItems.early_explosive_lenses);
|
||||
|
||||
@ -1565,10 +1565,12 @@ public class ResourceManager {
|
||||
public static final IModelCustom rbmk_rods_vbo = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/rbmk/rbmk_rods.obj")).asVBO();
|
||||
public static final IModelCustom rbmk_crane_console = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/rbmk/crane_console.obj")).asVBO();
|
||||
public static final IModelCustom rbmk_crane = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/rbmk/crane.obj")).asVBO();
|
||||
public static final IModelCustom rbmk_autoloader = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/rbmk/autoloader.obj")).asVBO();
|
||||
public static final IModelCustom rbmk_console = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/rbmk/rbmk_console.obj")).asVBO();
|
||||
public static final IModelCustom rbmk_debris = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/rbmk/debris.obj"));
|
||||
public static final ResourceLocation rbmk_crane_console_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/crane_console.png");
|
||||
public static final ResourceLocation rbmk_crane_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/rbmk_crane.png");
|
||||
public static final ResourceLocation rbmk_autoloader_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/rbmk_autoloader.png");
|
||||
public static final ResourceLocation rbmk_console_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/rbmk_control.png");
|
||||
public static final IModelCustom hev_battery = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/battery.obj"));
|
||||
public static final IModelCustom anvil = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blocks/anvil.obj"));
|
||||
|
||||
@ -112,6 +112,13 @@ public class ItemRenderFlaregun extends ItemRenderWeaponBase {
|
||||
GL11.glRotated(90, 0, 1, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupEntity(ItemStack stack) {
|
||||
super.setupEntity(stack);
|
||||
double scale = 0.5D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderOther(ItemStack stack, ItemRenderType type) {
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
@ -0,0 +1,62 @@
|
||||
package com.hbm.render.tileentity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.render.item.ItemRenderBase;
|
||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKAutoloader;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
public class RenderRBMKAutoloader extends TileEntitySpecialRenderer implements IItemRendererProvider {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float interp) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.rbmk_autoloader_tex);
|
||||
ResourceManager.rbmk_autoloader.renderPart("Base");
|
||||
|
||||
TileEntityRBMKAutoloader press = (TileEntityRBMKAutoloader) tile;
|
||||
double p = (press.lastPiston + (press.renderPiston - press.lastPiston) * interp);
|
||||
GL11.glTranslated(0, p * -4D, 0);
|
||||
|
||||
GL11.glTranslated(0, 4, 0);
|
||||
ResourceManager.rbmk_autoloader.renderPart("Piston");
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemForRenderer() {
|
||||
return Item.getItemFromBlock(ModBlocks.rbmk_autoloader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemRenderer getRenderer() {
|
||||
return new ItemRenderBase( ) {
|
||||
public void renderInventory() {
|
||||
GL11.glTranslated(0, -6, 0);
|
||||
GL11.glScaled(1.75, 1.75, 1.75);
|
||||
}
|
||||
public void renderCommon() {
|
||||
GL11.glRotated(180, 0, 1, 0);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.rbmk_autoloader_tex);
|
||||
ResourceManager.rbmk_autoloader.renderPart("Base");
|
||||
ResourceManager.rbmk_autoloader.renderPart("Piston");
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
}};
|
||||
}
|
||||
|
||||
}
|
||||
@ -75,8 +75,8 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Returns the actual tile entity that represents the core. Only for internal use. */
|
||||
protected TileEntity getTile() {
|
||||
/** Returns the actual tile entity that represents the core. Only for internal use, and EnergyControl. */
|
||||
public TileEntity getTile() {
|
||||
if(tile == null || tile.isInvalid()) {
|
||||
tile = this.getTE();
|
||||
}
|
||||
|
||||
@ -149,7 +149,6 @@ public class TileMappings {
|
||||
put(TileEntityCoreInjector.class, "tileentity_v0_injector");
|
||||
put(TileEntityCoreStabilizer.class, "tileentity_v0_stabilizer");
|
||||
put(TileEntityCore.class, "tileentity_v0");
|
||||
put(TileEntityMachineArcFurnace.class, "tileentity_arc_furnace");
|
||||
put(TileEntityMachineAmgen.class, "tileentity_amgen");
|
||||
put(TileEntityMachineHephaestus.class, "tileentity_hephaestus");
|
||||
put(TileEntityGeysir.class, "tileentity_geysir");
|
||||
@ -403,6 +402,7 @@ public class TileMappings {
|
||||
put(TileEntityRBMKConsole.class, "tileentity_rbmk_console");
|
||||
put(TileEntityRBMKInlet.class, "tileentity_rbmk_inlet");
|
||||
put(TileEntityRBMKOutlet.class, "tileentity_rbmk_outlet");
|
||||
put(TileEntityRBMKAutoloader.class, "tileentity_rbmk_autoloader");
|
||||
}
|
||||
|
||||
private static void putNetwork() {
|
||||
|
||||
@ -105,7 +105,7 @@ public class TileEntityDiFurnaceRTG extends TileEntityMachineBase implements IGU
|
||||
|
||||
for(int i = 0; i < 2; i++) {
|
||||
if(slots[i].stackSize <= 0)
|
||||
slots[i] = new ItemStack(slots[i].getItem().setFull3D());
|
||||
slots[i] = new ItemStack(slots[i].getItem());
|
||||
else
|
||||
slots[i].stackSize--;
|
||||
if(slots[i].stackSize <= 0)
|
||||
|
||||
@ -1,419 +0,0 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.machine.MachineArcFurnace;
|
||||
import com.hbm.inventory.container.ContainerMachineArcFurnace;
|
||||
import com.hbm.inventory.gui.GUIMachineArcFurnace;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import api.hbm.tile.IInfoProviderEC;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineArcFurnace extends TileEntityLoadedBase implements ISidedInventory, IEnergyReceiverMK2, IGUIProvider, IInfoProviderEC {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
public int dualCookTime;
|
||||
public long power;
|
||||
public static final long maxPower = 50000;
|
||||
public static final int processingSpeed = 20;
|
||||
|
||||
//0: i
|
||||
//1: o
|
||||
//2: 1
|
||||
//3: 2
|
||||
//4: 3
|
||||
//5: b
|
||||
private static final int[] slots_io = new int[] {0, 1, 2, 3, 4, 5};
|
||||
|
||||
private String customName;
|
||||
|
||||
public TileEntityMachineArcFurnace() {
|
||||
slots = new ItemStack[6];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return slots.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return slots[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
if(slots[i] != null)
|
||||
{
|
||||
ItemStack itemStack = slots[i];
|
||||
slots[i] = null;
|
||||
return itemStack;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemStack) {
|
||||
slots[i] = itemStack;
|
||||
if(itemStack != null && itemStack.stackSize > getInventoryStackLimit())
|
||||
{
|
||||
itemStack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return this.hasCustomInventoryName() ? this.customName : "container.arcFurnace";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return this.customName != null && this.customName.length() > 0;
|
||||
}
|
||||
|
||||
public void setCustomName(String name) {
|
||||
this.customName = name;
|
||||
markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
if(worldObj.getTileEntity(xCoord, yCoord, zCoord) != this)
|
||||
{
|
||||
return false;
|
||||
}else{
|
||||
return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <=64;
|
||||
}
|
||||
}
|
||||
|
||||
//You scrubs aren't needed for anything (right now)
|
||||
@Override
|
||||
public void openInventory() {}
|
||||
@Override
|
||||
public void closeInventory() {}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
|
||||
|
||||
if(i == 2 || i == 3 || i == 4)
|
||||
return itemStack.getItem() == ModItems.arc_electrode;
|
||||
|
||||
if(i == 0)
|
||||
return FurnaceRecipes.smelting().getSmeltingResult(itemStack) != null;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
if(slots[i] != null)
|
||||
{
|
||||
if(slots[i].stackSize <= j)
|
||||
{
|
||||
ItemStack itemStack = slots[i];
|
||||
slots[i] = null;
|
||||
return itemStack;
|
||||
}
|
||||
ItemStack itemStack1 = slots[i].splitStack(j);
|
||||
if (slots[i].stackSize == 0)
|
||||
{
|
||||
slots[i] = null;
|
||||
}
|
||||
|
||||
return itemStack1;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
NBTTagList list = nbt.getTagList("items", 10);
|
||||
|
||||
this.power = nbt.getLong("powerTime");
|
||||
this.dualCookTime = nbt.getInteger("cookTime");
|
||||
slots = new ItemStack[getSizeInventory()];
|
||||
|
||||
for(int i = 0; i < list.tagCount(); i++)
|
||||
{
|
||||
NBTTagCompound nbt1 = list.getCompoundTagAt(i);
|
||||
byte b0 = nbt1.getByte("slot");
|
||||
if(b0 >= 0 && b0 < slots.length)
|
||||
{
|
||||
slots[b0] = ItemStack.loadItemStackFromNBT(nbt1);
|
||||
}
|
||||
}
|
||||
|
||||
customName = nbt.getString("name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setLong("powerTime", power);
|
||||
nbt.setInteger("cookTime", dualCookTime);
|
||||
NBTTagList list = new NBTTagList();
|
||||
|
||||
for(int i = 0; i < slots.length; i++)
|
||||
{
|
||||
if(slots[i] != null)
|
||||
{
|
||||
NBTTagCompound nbt1 = new NBTTagCompound();
|
||||
nbt1.setByte("slot", (byte)i);
|
||||
slots[i].writeToNBT(nbt1);
|
||||
list.appendTag(nbt1);
|
||||
}
|
||||
}
|
||||
nbt.setTag("items", list);
|
||||
|
||||
if (customName != null) {
|
||||
nbt.setString("name", customName);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return slots_io;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int i, ItemStack itemStack, int j) {
|
||||
return this.isItemValidForSlot(i, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
|
||||
|
||||
if(i == 1)
|
||||
return true;
|
||||
|
||||
if(i == 2 || i == 3 || i == 4)
|
||||
return itemStack.getItem() == ModItems.arc_electrode_burnt;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getDiFurnaceProgressScaled(int i) {
|
||||
return (dualCookTime * i) / processingSpeed;
|
||||
}
|
||||
|
||||
public long getPowerRemainingScaled(long i) {
|
||||
return (power * i) / maxPower;
|
||||
}
|
||||
|
||||
public boolean hasPower() {
|
||||
return power >= 250;
|
||||
}
|
||||
|
||||
public boolean isProcessing() {
|
||||
return this.dualCookTime > 0;
|
||||
}
|
||||
|
||||
private boolean hasElectrodes() {
|
||||
|
||||
if(slots[2] != null && slots[3] != null && slots[4] != null) {
|
||||
if((slots[2].getItem() == ModItems.arc_electrode) &&
|
||||
(slots[3].getItem() == ModItems.arc_electrode) &&
|
||||
(slots[4].getItem() == ModItems.arc_electrode))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canProcess() {
|
||||
|
||||
if(!hasElectrodes())
|
||||
return false;
|
||||
|
||||
if(slots[0] == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
ItemStack itemStack = FurnaceRecipes.smelting().getSmeltingResult(this.slots[0]);
|
||||
|
||||
if(itemStack == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(slots[1] == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!slots[1].isItemEqual(itemStack)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(slots[1].stackSize < getInventoryStackLimit() && slots[1].stackSize < slots[1].getMaxStackSize()) {
|
||||
return true;
|
||||
}else{
|
||||
return slots[1].stackSize < itemStack.getMaxStackSize();
|
||||
}
|
||||
}
|
||||
|
||||
private void processItem() {
|
||||
if(canProcess()) {
|
||||
ItemStack itemStack = FurnaceRecipes.smelting().getSmeltingResult(this.slots[0]);
|
||||
|
||||
if(slots[1] == null)
|
||||
{
|
||||
slots[1] = itemStack.copy();
|
||||
}else if(slots[1].isItemEqual(itemStack)) {
|
||||
slots[1].stackSize += itemStack.stackSize;
|
||||
}
|
||||
|
||||
for(int i = 0; i < 1; i++)
|
||||
{
|
||||
if(slots[i].stackSize <= 0)
|
||||
{
|
||||
slots[i] = new ItemStack(slots[i].getItem());
|
||||
}else{
|
||||
slots[i].stackSize--;
|
||||
}
|
||||
if(slots[i].stackSize <= 0)
|
||||
{
|
||||
slots[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: fix this punjabi trash
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
boolean flag1 = false;
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
|
||||
|
||||
if(hasPower() && canProcess())
|
||||
{
|
||||
dualCookTime++;
|
||||
|
||||
power -= 250;
|
||||
|
||||
if(power < 0)
|
||||
power = 0;
|
||||
|
||||
if(this.dualCookTime == processingSpeed)
|
||||
{
|
||||
this.dualCookTime = 0;
|
||||
this.processItem();
|
||||
flag1 = true;
|
||||
}
|
||||
}else{
|
||||
dualCookTime = 0;
|
||||
}
|
||||
|
||||
boolean trigger = true;
|
||||
|
||||
if(hasPower() && canProcess() && this.dualCookTime == 0)
|
||||
{
|
||||
trigger = false;
|
||||
}
|
||||
|
||||
if(trigger)
|
||||
{
|
||||
flag1 = true;
|
||||
MachineArcFurnace.updateBlockState(this.dualCookTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
|
||||
}
|
||||
|
||||
if(worldObj.getBlock(xCoord, yCoord, zCoord) == ModBlocks.machine_arc_furnace_off) {
|
||||
|
||||
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||
|
||||
if(hasElectrodes() && meta <= 5) {
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, meta + 4, 2);
|
||||
}
|
||||
if(!hasElectrodes() && meta > 5) {
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, meta - 4, 2);
|
||||
}
|
||||
}
|
||||
|
||||
power = Library.chargeTEFromItems(slots, 5, power, maxPower);
|
||||
|
||||
networkPackNT(50); // it makes no sense to refactor this to some, but I want to delete the AuxElectricityPacket already
|
||||
}
|
||||
|
||||
if(flag1)
|
||||
{
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeLong(power);
|
||||
buf.writeInt(dualCookTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
power = buf.readLong();
|
||||
dualCookTime = buf.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long i) {
|
||||
power = i;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPower() {
|
||||
return power;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxPower() {
|
||||
return maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new ContainerMachineArcFurnace(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUIMachineArcFurnace(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideExtraInfo(NBTTagCompound data) {
|
||||
data.setBoolean(CompatEnergyControl.B_ACTIVE, this.hasPower() && this.canProcess());
|
||||
data.setInteger(CompatEnergyControl.I_PROGRESS, this.dualCookTime);
|
||||
}
|
||||
}
|
||||
@ -154,7 +154,7 @@ public class TileEntityMachineElectricFurnace extends TileEntityMachineBase impl
|
||||
|
||||
for(int i = 1; i < 2; i++) {
|
||||
if(slots[i].stackSize <= 0) {
|
||||
slots[i] = new ItemStack(slots[i].getItem().setFull3D());
|
||||
slots[i] = new ItemStack(slots[i].getItem());
|
||||
} else {
|
||||
slots[i].stackSize--;
|
||||
}
|
||||
|
||||
@ -240,7 +240,7 @@ public class TileEntityRtgFurnace extends TileEntity implements ISidedInventory,
|
||||
{
|
||||
if(slots[i].stackSize <= 0)
|
||||
{
|
||||
slots[i] = new ItemStack(slots[i].getItem().setFull3D());
|
||||
slots[i] = new ItemStack(slots[i].getItem());
|
||||
}else{
|
||||
slots[i].stackSize--;
|
||||
}
|
||||
|
||||
@ -0,0 +1,290 @@
|
||||
package com.hbm.tileentity.machine.rbmk;
|
||||
|
||||
import com.hbm.blocks.machine.rbmk.RBMKBase;
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.interfaces.ICopiable;
|
||||
import com.hbm.inventory.container.ContainerRBMKAutoloader;
|
||||
import com.hbm.inventory.gui.GUIRBMKAutoloader;
|
||||
import com.hbm.items.machine.ItemRBMKRod;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.sound.AudioWrapper;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityRBMKAutoloader extends TileEntityMachineBase implements IGUIProvider, IControlReceiver, ICopiable {
|
||||
|
||||
public double piston;
|
||||
public double renderPiston;
|
||||
public double lastPiston;
|
||||
private double syncPiston;
|
||||
private int turnProgress;
|
||||
private boolean isRetracting = true;
|
||||
private int delay = 0;
|
||||
|
||||
public static double speed = 0.005D;
|
||||
|
||||
public int cycle = 50;
|
||||
|
||||
private AudioWrapper audioLift;
|
||||
|
||||
public TileEntityRBMKAutoloader() {
|
||||
super(18);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "container.rbmkAutoloader";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
if(delay > 0) delay--;
|
||||
|
||||
if(delay <= 0 && this.isRetracting && this.piston > 0D) {
|
||||
this.piston -= this.speed;
|
||||
if(this.piston <= 0) {
|
||||
this.piston = 0;
|
||||
this.delay = 40;
|
||||
}
|
||||
}
|
||||
|
||||
// check for connected fuel rod and decide whether to begin working
|
||||
if(isRetracting && worldObj.getTotalWorldTime() % 20 == 0 && this.hasFuel() && this.hasSpace()) {
|
||||
Block below = worldObj.getBlock(xCoord, yCoord - 1, zCoord);
|
||||
if(below instanceof RBMKBase) {
|
||||
int[] pos = ((RBMKBase) below).findCore(worldObj, xCoord, yCoord - 1, zCoord);
|
||||
TileEntity tile = worldObj.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
if(tile instanceof TileEntityRBMKRod) {
|
||||
TileEntityRBMKRod rod = (TileEntityRBMKRod) tile;
|
||||
if(rod.slots[0] == null || (rod.slots[0] != null && rod.slots[0].getItem() instanceof ItemRBMKRod && ItemRBMKRod.getEnrichment(rod.slots[0]) * 100 < cycle)) {
|
||||
this.isRetracting = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(delay <= 0 && !this.isRetracting && this.piston < 1D) {
|
||||
this.piston += this.speed;
|
||||
if(this.piston >= 1) {
|
||||
this.piston = 1;
|
||||
this.delay = 40;
|
||||
}
|
||||
}
|
||||
|
||||
// once the piston is fully extended
|
||||
if(!isRetracting && this.piston >= 1D) {
|
||||
this.piston = 1D;
|
||||
|
||||
Block below = worldObj.getBlock(xCoord, yCoord - 1, zCoord);
|
||||
if(below instanceof RBMKBase) {
|
||||
int[] pos = ((RBMKBase) below).findCore(worldObj, xCoord, yCoord - 1, zCoord);
|
||||
TileEntity tile = worldObj.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
if(tile instanceof TileEntityRBMKRod) {
|
||||
TileEntityRBMKRod rod = (TileEntityRBMKRod) tile;
|
||||
// try to take out the old fuel rod
|
||||
if(rod.slots[0] != null && this.hasSpace()) {
|
||||
for(int i = 9; i < 18; i++) {
|
||||
if(slots[i] == null) {
|
||||
slots[i] = rod.slots[0].copy();
|
||||
rod.slots[0] = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// if there's space, try and insert a new fuel rod
|
||||
if(rod.slots[0] == null) {
|
||||
for(int i = 0; i < 9; i++) {
|
||||
ItemStack stack = slots[i];
|
||||
if(stack != null && stack.getItem() instanceof ItemRBMKRod && ItemRBMKRod.getEnrichment(stack) * 100 >= cycle) {
|
||||
rod.slots[0] = stack.copy();
|
||||
slots[i] = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.isRetracting = true;
|
||||
this.delay = 40;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.networkPackNT(100);
|
||||
} else {
|
||||
|
||||
this.lastPiston = this.renderPiston;
|
||||
|
||||
if(this.turnProgress > 0) {
|
||||
this.renderPiston = this.renderPiston + ((this.syncPiston - this.renderPiston) / (double) this.turnProgress);
|
||||
--this.turnProgress;
|
||||
} else {
|
||||
this.renderPiston = this.syncPiston;
|
||||
}
|
||||
|
||||
if(this.renderPiston > 0.01 && this.renderPiston < 0.99) {
|
||||
if(this.audioLift == null || !this.audioLift.isPlaying()) {
|
||||
this.audioLift = MainRegistry.proxy.getLoopedSound("hbm:door.wgh_start", xCoord, yCoord, zCoord, this.getVolume(0.75F), 25F, 1.0F, 5);
|
||||
this.audioLift.startSound();
|
||||
}
|
||||
this.audioLift.updateVolume(this.getVolume(0.75F));
|
||||
this.audioLift.keepAlive();
|
||||
} else {
|
||||
if(this.audioLift != null) {
|
||||
this.audioLift.stopSound();
|
||||
this.audioLift = null;
|
||||
MainRegistry.proxy.playSoundClient(xCoord, yCoord, zCoord, "hbm:door.wgh_stop", this.getVolume(2F), 1F);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.renderPiston > 0.99) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "tower");
|
||||
data.setFloat("lift", 0F);
|
||||
data.setFloat("base", 0.25F);
|
||||
data.setFloat("max", 1.5F);
|
||||
data.setInteger("life", 70 + worldObj.rand.nextInt(30));
|
||||
data.setDouble("posX", xCoord + 0.5 + worldObj.rand.nextGaussian() * 0.125);
|
||||
data.setDouble("posZ", zCoord + 0.5 + worldObj.rand.nextGaussian() * 0.125);
|
||||
data.setDouble("posY", yCoord + 0.25);
|
||||
data.setBoolean("noWind", true);
|
||||
data.setFloat("alphaMod", 2F);
|
||||
data.setFloat("strafe", 0.05F);
|
||||
for(int i = 0; i < 3; i++) MainRegistry.proxy.effectNT(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasFuel() {
|
||||
for(int i = 0; i < 9; i++) {
|
||||
ItemStack stack = slots[i];
|
||||
if(stack != null && stack.getItem() instanceof ItemRBMKRod && ItemRBMKRod.getEnrichment(stack) * 100 >= cycle) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasSpace() {
|
||||
for(int i = 9; i < 18; i++) if(slots[i] == null) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeDouble(this.piston);
|
||||
buf.writeInt(this.cycle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
this.syncPiston = buf.readDouble();
|
||||
this.cycle = buf.readInt();
|
||||
|
||||
this.turnProgress = 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack) {
|
||||
return stack.getItem() instanceof ItemRBMKRod && ItemRBMKRod.getEnrichment(stack) * 100 >= cycle && i < 9;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return this.piston <= 0 ? new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 } : new int[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
|
||||
return i >= 9;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
piston = nbt.getDouble("piston");
|
||||
isRetracting = nbt.getBoolean("ret");
|
||||
delay = nbt.getInteger("delay");
|
||||
cycle = nbt.getInteger("cycle");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setDouble("piston", piston);
|
||||
nbt.setBoolean("ret", isRetracting);
|
||||
nbt.setInteger("delay", delay);
|
||||
nbt.setInteger("cycle", cycle);
|
||||
}
|
||||
|
||||
protected AxisAlignedBB aabb;
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
if(aabb != null) return aabb;
|
||||
aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 9, zCoord + 1);
|
||||
return aabb;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(EntityPlayer player) {
|
||||
return this.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveControl(NBTTagCompound data) {
|
||||
if(data.hasKey("minus") && this.cycle > 5) this.cycle -= 5;
|
||||
if(data.hasKey("plus") && this.cycle < 95) this.cycle += 5;
|
||||
this.cycle = MathHelper.clamp_int(cycle, 5, 95);
|
||||
this.markChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new ContainerRBMKAutoloader(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUIRBMKAutoloader(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getSettings(World world, int x, int y, int z) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("cycle", cycle);
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pasteSettings(NBTTagCompound nbt, int index, World world, EntityPlayer player, int x, int y, int z) {
|
||||
if(nbt.hasKey("cycle")) {
|
||||
this.cycle = MathHelper.clamp_int(nbt.getInteger("cycle"), 5, 95);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -437,6 +437,7 @@ container.radGen=Strahlenbetriebener Generator
|
||||
container.radar=Radar
|
||||
container.radiobox=UKW-Sender
|
||||
container.radiorec=UKW Radio
|
||||
container.rbmkAutoloader=RBMK-Ladeautomat
|
||||
container.rbmkBoiler=RBMK Dampfkanal
|
||||
container.rbmkControl=RBMK Steuerstäbe
|
||||
container.rbmkControlAuto=RBMK Automatische Steuerstäbe
|
||||
@ -4729,6 +4730,7 @@ tile.rail_large_switch.name=Normalspur-Weiche (15m, Links)
|
||||
tile.rail_large_switch_flipped.name=Normalspur-Weiche (15m, Rechts)
|
||||
tile.rail_wood.name=Holzschienen
|
||||
tile.rbmk_absorber.name=RBMK Bor-Neutronenabsorber
|
||||
tile.rbmk_autoloader.name=RBMK-Ladeautomat
|
||||
tile.rbmk_blank.name=RBMK Strukturteil
|
||||
tile.rbmk_boiler.name=RBMK Dampfkanal
|
||||
tile.rbmk_cooler.name=RBMK Kühler
|
||||
|
||||
@ -841,6 +841,7 @@ container.radar=Radar
|
||||
container.radiobox=FM Transmitter
|
||||
container.radiolysis=RTG and Radiolysis Chamber
|
||||
container.radiorec=FM Radio
|
||||
container.rbmkAutoloader=RBMK Autoloader
|
||||
container.rbmkBoiler=RBMK Steam Channel
|
||||
container.rbmkControl=RBMK Control Rods
|
||||
container.rbmkControlAuto=RBMK Automatic Control Rods
|
||||
@ -5877,6 +5878,7 @@ tile.rail_large_switch_flipped.name=Standard Gauge Switch Rail (15m, Right)
|
||||
tile.rail_narrow.name=Narrow Gauge Cart Rail
|
||||
tile.rail_wood.name=Wooden Tracks
|
||||
tile.rbmk_absorber.name=RBMK Boron Neutron Absorber
|
||||
tile.rbmk_autoloader.name=RBMK Autoloader
|
||||
tile.rbmk_blank.name=RBMK Structural Column
|
||||
tile.rbmk_boiler.name=RBMK Steam Channel
|
||||
tile.rbmk_console.name=RBMK Console
|
||||
|
||||
1029
src/main/resources/assets/hbm/models/rbmk/autoloader.obj
Normal file
1029
src/main/resources/assets/hbm/models/rbmk/autoloader.obj
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 285 B |
Binary file not shown.
|
Before Width: | Height: | Size: 3.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
Loading…
x
Reference in New Issue
Block a user