Crap Cleanup Crew(tm) for NES and FamiCom

This commit is contained in:
Boblet 2026-04-27 12:04:52 +02:00
parent 90e345937a
commit 1680852b14
56 changed files with 9 additions and 17404 deletions

View File

@ -17,8 +17,10 @@
* Crates now open when right-clicked by default, holding shift is required to place them down
* The automatic buzzsaw can now burn coal tar creosote
* The old cluster type effect used by MPBs and cluster missiles now use the new generic projectile system with actual bomblet models
* Removed the legacy fusion reactor entirely
## Fixed
* Fixed uncrafting of the nickel RTG pellet not respecting item metadata
* Tile entities that use fluids should now force the chunk they are in to be written to disk when unloaded
* This should fix the issue where systems that constantly move fluids around may not properly save to disk
* Fixed dispensed dynamites being considered impact grenades for some reason

View File

@ -875,9 +875,6 @@ public class ModBlocks {
@Deprecated public static Block fusion_heater;
@Deprecated public static Block fusion_hatch;
@Deprecated public static Block iter;
@Deprecated public static Block plasma_heater;
public static Block fusion_component;
public static Block fusion_torus;
public static Block fusion_klystron;
@ -1993,8 +1990,6 @@ public class ModBlocks {
fusion_heater = new BlockPillar(Material.iron, RefStrings.MODID + ":fusion_heater_top").setBlockName("fusion_heater").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":fusion_heater_side");
fusion_hatch = new FusionHatch(Material.iron).setBlockName("fusion_hatch").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":fusion_hatch");
iter = new MachineITER().setBlockName("iter").setHardness(5.0F).setResistance(60.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":iter");
plasma_heater = new MachinePlasmaHeater().setBlockName("plasma_heater").setHardness(5.0F).setResistance(60.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":plasma_heater");
fusion_component = new BlockFusionComponent().setBlockName("fusion_component").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":fusion_component");
fusion_torus = new MachineFusionTorus().setBlockName("fusion_torus").setHardness(5.0F).setResistance(60.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
@ -3356,8 +3351,6 @@ public class ModBlocks {
//Multiblock Generators
GameRegistry.registerBlock(fusion_heater, fusion_heater.getUnlocalizedName());
GameRegistry.registerBlock(fusion_hatch, fusion_hatch.getUnlocalizedName());
GameRegistry.registerBlock(iter, iter.getUnlocalizedName());
GameRegistry.registerBlock(plasma_heater, plasma_heater.getUnlocalizedName());
register(fusion_component);
register(fusion_torus);

View File

@ -1,231 +0,0 @@
package com.hbm.blocks.machine;
import com.hbm.blocks.BlockDummyable;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.TileEntityProxyCombo;
import com.hbm.tileentity.machine.TileEntityITER;
import com.hbm.tileentity.machine.TileEntityITERStruct;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@Deprecated
public class MachineITER extends BlockDummyable {
public MachineITER() {
super(Material.iron);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
if(meta >= 12)
return new TileEntityITER();
if(meta >= 6)
return new TileEntityProxyCombo(true, true, true);
return null;
}
@Override
public int[] getDimensions() {
//because we'll implement our own gnarly behavior here
return new int[] { 0, 0, 0, 0, 0, 0 };
}
@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())
{
int[] pos = this.findCore(world, x, y, z);
if(pos == null)
return false;
TileEntityITER entity = (TileEntityITER) world.getTileEntity(pos[0], pos[1], pos[2]);
if(entity != null)
{
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, pos[0], pos[1], pos[2]);
}
return true;
} else {
return false;
}
}
public static final int height = 2;
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
if(!(player instanceof EntityPlayer))
return;
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
EntityPlayer pl = (EntityPlayer) player;
int o = getOffset();
ForgeDirection dir = ForgeDirection.NORTH;
if(i == 0)
{
dir = ForgeDirection.getOrientation(2);
}
if(i == 1)
{
dir = ForgeDirection.getOrientation(5);
}
if(i == 2)
{
dir = ForgeDirection.getOrientation(3);
}
if(i == 3)
{
dir = ForgeDirection.getOrientation(4);
}
dir = dir.getOpposite();
world.setBlockToAir(x, y, z);
if(!checkRequirement(world, x, y, z, dir, o)) {
if(!pl.capabilities.isCreativeMode) {
ItemStack stack = pl.inventory.mainInventory[pl.inventory.currentItem];
Item item = Item.getItemFromBlock(this);
if(stack == null) {
pl.inventory.mainInventory[pl.inventory.currentItem] = new ItemStack(this);
} else {
if(stack.getItem() != item || stack.stackSize == stack.getMaxStackSize()) {
pl.inventory.addItemStackToInventory(new ItemStack(this));
} else {
pl.getHeldItem().stackSize++;
}
}
}
return;
}
pl.getHeldItem().stackSize--;
world.setBlock(x + dir.offsetX * o , y + dir.offsetY * o + height, z + dir.offsetZ * o, this, dir.ordinal() + offset, 3);
this.safeRem = true;
fillSpace(world, x, y, z, dir, o);
this.safeRem = false;
world.scheduleBlockUpdate(x, y, z, this, 1);
world.scheduleBlockUpdate(x, y, z, this, 2);
super.onBlockPlacedBy(world, x, y, z, player, itemStack);
}
@Override
public boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
x = x + dir.offsetX * o;
z = z + dir.offsetZ * o;
int[][][] layout = TileEntityITERStruct.collisionMask;
for(int iy = 0; iy < 5; iy++) {
int l = iy > 2 ? 4 - iy : iy;
int[][] layer = layout[l];
for(int ix = 0; ix < layer.length; ix++) {
for(int iz = 0; iz < layer.length; iz++) {
int ex = ix - layer.length / 2;
int ez = iz - layer.length / 2;
if(ex == 0 && y == 2 && ez == 0)
continue;
if(!world.getBlock(x + ex, y + iy, z + ez).canPlaceBlockAt(world, x + ex, y + iy, z + ez)) {
return false;
}
}
}
}
return true;
}
@Override
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
x = x + dir.offsetX * o;
z = z + dir.offsetZ * o;
int[][][] layout = TileEntityITERStruct.collisionMask;
for(int iy = 0; iy < 5; iy++) {
int l = iy > 2 ? 4 - iy : iy;
int[][] layer = layout[l];
for(int ix = 0; ix < layer.length; ix++) {
for(int iz = 0; iz < layer[0].length; iz++) {
int ex = ix - layer.length / 2;
int ez = iz - layer.length / 2;
int meta = 0;
if(iy < 2) {
meta = ForgeDirection.DOWN.ordinal();
} else if(iy > 2) {
meta = ForgeDirection.UP.ordinal();
} else if(ex < 0) {
meta = ForgeDirection.WEST.ordinal();
} else if(ex > 0) {
meta = ForgeDirection.EAST.ordinal();
} else if(ez < 0) {
meta = ForgeDirection.NORTH.ordinal();
} else if(ez > 0) {
meta = ForgeDirection.SOUTH.ordinal();
} else {
continue;
}
if(layout[l][ix][iz] > 0)
world.setBlock(x + ex, y + iy, z + ez, this, meta, 3);
}
}
}
this.makeExtra(world, x, y, z);
this.makeExtra(world, x, y + 4, z);
Vec3 vec = Vec3.createVectorHelper(5.75, 0, 0);
for(int i = 0; i < 16; i++) {
vec.rotateAroundY((float) (Math.PI / 8));
this.makeExtra(world, x + (int)vec.xCoord, y, z + (int)vec.zCoord);
this.makeExtra(world, x + (int)vec.xCoord, y + 4, z + (int)vec.zCoord);
}
}
@Override
public int getOffset() {
return 7;
}
}

View File

@ -1,124 +0,0 @@
package com.hbm.blocks.machine;
import com.hbm.blocks.BlockDummyable;
import com.hbm.handler.MultiblockHandlerXR;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.TileEntityProxyCombo;
import com.hbm.tileentity.machine.TileEntityMachinePlasmaHeater;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
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.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class MachinePlasmaHeater extends BlockDummyable {
public MachinePlasmaHeater() {
super(Material.iron);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
if(meta >= 12)
return new TileEntityMachinePlasmaHeater();
if(meta >= 6)
return new TileEntityProxyCombo(false, true, true);
return null;
}
@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())
{
int[] pos = this.findCore(world, x, y, z);
if(pos == null)
return false;
TileEntityMachinePlasmaHeater entity = (TileEntityMachinePlasmaHeater) world.getTileEntity(pos[0], pos[1], pos[2]);
if(entity != null)
{
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, pos[0], pos[1], pos[2]);
}
return true;
} else {
return false;
}
}
@Override
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
super.fillSpace(world, x, y, z, dir, o);
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {4, -3, 2, 1, 1, 1}, this, dir);
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y + 2, z + dir.offsetZ * o, new int[] {0, 1, 10, -8, 0, 0}, this, dir);
ForgeDirection side = dir.getRotation(ForgeDirection.UP);
for(int i = 1; i < 4; i++) {
for(int j = -1; j < 2; j++) {
this.makeExtra(world, x + side.offsetX * j, y + i, z + side.offsetZ * j);
}
}
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
float f = 0.0625F;
if(world.getBlockMetadata(x, y, z) == ForgeDirection.UP.ordinal() && world.getBlock(x, y + 1, z) != this) {
return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + f * 8F, z + 1);
} else if(world.getBlockMetadata(x, y, z) == ForgeDirection.DOWN.ordinal() && world.getBlock(x, y - 1, z) != this) {
return AxisAlignedBB.getBoundingBox(x, y + f * 8F, z, x + 1, y + 1, z + 1);
} else {
return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1);
}
}
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
float f = 0.0625F;
if(world.getBlockMetadata(x, y, z) == ForgeDirection.UP.ordinal() && world.getBlock(x, y + 1, z) != this) {
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, f * 8F, 1.0F);
} else if(world.getBlockMetadata(x, y, z) == ForgeDirection.DOWN.ordinal() && world.getBlock(x, y - 1, z) != this) {
this.setBlockBounds(0.0F, f * 8F, 0.0F, 1, 1.0F, 1.0F);
} else {
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
}
protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, getDimensions(), x, y, z, dir))
return false;
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {4, -3, 1, 1, 1, 1}, x, y, z, dir))
return false;
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + 2, z + dir.offsetZ * o, new int[] {0, 1, 10, -8, 0, 0}, x, y, z, dir))
return false;
return true;
}
@Override
public int[] getDimensions() {
return new int[] {3, 0, 8, 1, 1, 1};
}
@Override
public int getOffset() {
return 1;
}
}

View File

@ -135,7 +135,6 @@ public class EntityMappings {
addEntity(EntitySiegeLaser.class, "entity_ntm_siege_laser", 1000);
addEntity(EntityTNTPrimedBase.class, "entity_ntm_tnt_primed", 1000);
addEntity(EntityGrenadeBouncyGeneric.class, "entity_grenade_bouncy_generic", 250);
addEntity(EntityGrenadeImpactGeneric.class, "entity_grenade_impact_generic", 250);
addEntity(EntityMinecartCrate.class, "entity_ntm_cart_crate", 250, false);
addEntity(EntityMinecartDestroyer.class, "entity_ntm_cart_destroyer", 250, false);
addEntity(EntityMinecartOre.class, "entity_ntm_cart_ore", 250, false);

View File

@ -1,61 +0,0 @@
package com.hbm.entity.grenade;
import com.hbm.items.ModItems;
import com.hbm.items.weapon.ItemGenericGrenade;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
public class EntityGrenadeImpactGeneric extends EntityGrenadeBase implements IGenericGrenade {
public EntityGrenadeImpactGeneric(World p_i1773_1_) {
super(p_i1773_1_);
}
public EntityGrenadeImpactGeneric(World p_i1774_1_, EntityLivingBase p_i1774_2_) {
super(p_i1774_1_, p_i1774_2_);
}
public EntityGrenadeImpactGeneric(World p_i1775_1_, double p_i1775_2_, double p_i1775_4_, double p_i1775_6_) {
super(p_i1775_1_, p_i1775_2_, p_i1775_4_, p_i1775_6_);
}
public EntityGrenadeImpactGeneric setType(ItemGenericGrenade grenade) {
this.dataWatcher.updateObject(12, Item.getIdFromItem(grenade));
return this;
}
@Override
public ItemGenericGrenade getGrenade() {
ItemGenericGrenade gren = (ItemGenericGrenade) Item.getItemById(this.dataWatcher.getWatchableObjectInt(12));
return gren != null ? gren : (ItemGenericGrenade) ModItems.stick_dynamite;
}
@Override
protected void entityInit() {
this.dataWatcher.addObject(12, 0);
}
@Override
public void explode() {
if(!this.worldObj.isRemote && getGrenade() != null) {
getGrenade().explode(this, this.getThrower(), worldObj, posX, posY, posZ);
this.setDead();
}
}
@Override
public void writeEntityToNBT(NBTTagCompound nbt) {
super.writeEntityToNBT(nbt);
nbt.setInteger("grenade", this.dataWatcher.getWatchableObjectInt(12));
}
@Override
public void readEntityFromNBT(NBTTagCompound nbt) {
super.readEntityFromNBT(nbt);
this.dataWatcher.updateObject(12, nbt.getInteger("grenade"));
}
}

View File

@ -42,12 +42,12 @@ public class DispenserBehaviorHandler {
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.stick_dynamite, new BehaviorProjectileDispense() {
protected IProjectile getProjectileEntity(World world, IPosition position) {
return new EntityGrenadeImpactGeneric(world, position.getX(), position.getY(), position.getZ()).setType((ItemGenericGrenade) ModItems.stick_dynamite);
return new EntityGrenadeBouncyGeneric(world, position.getX(), position.getY(), position.getZ()).setType((ItemGenericGrenade) ModItems.stick_dynamite);
}
});
BlockDispenser.dispenseBehaviorRegistry.putObject(ModItems.stick_dynamite_fishing, new BehaviorProjectileDispense() {
protected IProjectile getProjectileEntity(World world, IPosition position) {
return new EntityGrenadeImpactGeneric(world, position.getX(), position.getY(), position.getZ()).setType((ItemGenericGrenade) ModItems.stick_dynamite_fishing);
return new EntityGrenadeBouncyGeneric(world, position.getX(), position.getY(), position.getZ()).setType((ItemGenericGrenade) ModItems.stick_dynamite_fishing);
}
});

View File

@ -1,76 +0,0 @@
package com.hbm.inventory.container;
import com.hbm.inventory.SlotTakeOnly;
import com.hbm.tileentity.machine.TileEntityITER;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerITER extends Container {
private TileEntityITER iter;
public ContainerITER(InventoryPlayer invPlayer, TileEntityITER tedf) {
iter = tedf;
//Battery
this.addSlotToContainer(new Slot(tedf, 0, 107, 108));
//Breeder In
this.addSlotToContainer(new Slot(tedf, 1, 26, 18));
//Breeder Out
this.addSlotToContainer(new SlotTakeOnly(tedf, 2, 62, 18));
//Plasma Shield
this.addSlotToContainer(new Slot(tedf, 3, 98, 18));
//Byproduct
this.addSlotToContainer(new SlotTakeOnly(tedf, 4, 134, 18));
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 + 56));
}
}
for(int i = 0; i < 9; i++)
{
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142 + 56));
}
}
@Override
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) {
ItemStack var3 = null;
Slot var4 = (Slot) this.inventorySlots.get(par2);
if(var4 != null && var4.getHasStack()) {
ItemStack var5 = var4.getStack();
var3 = var5.copy();
if(par2 <= 4) {
if(!this.mergeItemStack(var5, 5, this.inventorySlots.size(), true)) {
return null;
}
} else {
return null;
}
if(var5.stackSize == 0) {
var4.putStack((ItemStack) null);
} else {
var4.onSlotChanged();
}
}
return var3;
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return iter.isUseableByPlayer(player);
}
}

View File

@ -1,68 +0,0 @@
package com.hbm.inventory.container;
import com.hbm.inventory.SlotTakeOnly;
import com.hbm.tileentity.machine.TileEntityMachinePlasmaHeater;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerPlasmaHeater extends Container {
private TileEntityMachinePlasmaHeater microwave;
public ContainerPlasmaHeater(InventoryPlayer invPlayer, TileEntityMachinePlasmaHeater tedf) {
microwave = tedf;
this.addSlotToContainer(new Slot(tedf, 0, 8, 53));
this.addSlotToContainer(new Slot(tedf, 1, 44, 17));
this.addSlotToContainer(new SlotTakeOnly(tedf, 2, 44, 53));
this.addSlotToContainer(new Slot(tedf, 3, 152, 17));
this.addSlotToContainer(new SlotTakeOnly(tedf, 4, 152, 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 ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) {
ItemStack var3 = null;
Slot var4 = (Slot) this.inventorySlots.get(par2);
if(var4 != null && var4.getHasStack()) {
ItemStack var5 = var4.getStack();
var3 = var5.copy();
if(par2 <= 4) {
if(!this.mergeItemStack(var5, 5, this.inventorySlots.size(), true)) {
return null;
}
} else {
if(!this.mergeItemStack(var5, 0, 1, true))
return null;
}
if(var5.stackSize == 0) {
var4.putStack((ItemStack) null);
} else {
var4.onSlotChanged();
}
}
return var3;
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return microwave.isUseableByPlayer(player);
}
}

View File

@ -1,90 +0,0 @@
package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerITER;
import com.hbm.lib.RefStrings;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.toserver.AuxButtonPacket;
import com.hbm.tileentity.machine.TileEntityITER;
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.util.ResourceLocation;
public class GUIITER extends GuiInfoContainer {
public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/reactors/gui_fusion_multiblock.png");
private TileEntityITER iter;
public GUIITER(InventoryPlayer invPlayer, TileEntityITER laser) {
super(new ContainerITER(invPlayer, laser));
this.iter = laser;
this.xSize = 176;
this.ySize = 222;
}
@Override
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 71, guiTop + 108, 34, 16, iter.power, iter.maxPower);
iter.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 26, guiTop + 54, 16, 52); //Water
iter.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 54, 16, 52); //Steam
iter.plasma.renderTankInfo(this, mouseX, mouseY, guiLeft + 71, guiTop + 54, 34, 34); //Plasma
String text = "Magnets are " + ((iter.isOn && iter.power >= iter.powerReq) ? "ON" : "OFF");
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 76, guiTop + 94, 24, 12, mouseX, mouseY, new String[] { text });
}
protected void mouseClicked(int x, int y, int i) {
super.mouseClicked(x, y, i);
if(guiLeft + 52 <= x && guiLeft + 52 + 18 > x && guiTop + 107 < y && guiTop + 107 + 18 >= y) {
//toggle the magnets
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(iter.xCoord, iter.yCoord, iter.zCoord, 0, 0));
}
}
@Override
protected void drawGuiContainerForegroundLayer(int i, int j) {
String name = this.iter.hasCustomInventoryName() ? this.iter.getInventoryName() : I18n.format(this.iter.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(iter.isOn)
drawTexturedModalRect(guiLeft + 52, guiTop + 107, 176, 0, 18, 18);
if(iter.isOn && iter.power >= iter.powerReq)
drawTexturedModalRect(guiLeft + 76, guiTop + 94, 194, 0, 24, 12);
if(iter.getShield() >= iter.plasma.getTankType().temperature)
drawTexturedModalRect(guiLeft + 97, guiTop + 17, 218, 0, 18, 18);
int i = (int)iter.getPowerScaled(34);
drawTexturedModalRect(guiLeft + 71, guiTop + 108, 176, 25, i, 16);
int j = (int)iter.getProgressScaled(17);
drawTexturedModalRect(guiLeft + 44, guiTop + 22, 176, 18, j, 7);
for(int t = 0; t < 2; t++) {
iter.tanks[t].renderTank(guiLeft + 26 + 108 * t, guiTop + 106, this.zLevel, 16, 52);
}
iter.plasma.renderTank(guiLeft + 71, guiTop + 88, this.zLevel, 34, 34);
}
}

View File

@ -1,58 +0,0 @@
package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerPlasmaHeater;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.TileEntityMachinePlasmaHeater;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
public class GUIPlasmaHeater extends GuiInfoContainer {
public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/reactors/gui_fusion_heater.png");
private TileEntityMachinePlasmaHeater microwave;
public GUIPlasmaHeater(InventoryPlayer invPlayer, TileEntityMachinePlasmaHeater microwave) {
super(new ContainerPlasmaHeater(invPlayer, microwave));
this.microwave = microwave;
this.xSize = 176;
this.ySize = 168;
}
@Override
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
microwave.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 62, guiTop + 17, 16, 52);
microwave.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 17, 16, 52);
microwave.plasma.renderTankInfo(this, mouseX, mouseY, guiLeft + 98, guiTop + 17, 16, 52);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 17, 16, 34, microwave.power, microwave.maxPower);
}
@Override
protected void drawGuiContainerForegroundLayer(int i, int j) {
String name = this.microwave.hasCustomInventoryName() ? this.microwave.getInventoryName() : I18n.format(this.microwave.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);
int i = (int)microwave.getPowerScaled(34);
drawTexturedModalRect(guiLeft + 8, guiTop + 51 - i, 176, 34 - i, 16, i);
microwave.tanks[0].renderTank(guiLeft + 62, guiTop + 69, this.zLevel, 16, 52);
microwave.tanks[1].renderTank(guiLeft + 134, guiTop + 69, this.zLevel, 16, 52);
microwave.plasma.renderTank(guiLeft + 98, guiTop + 69, this.zLevel, 16, 52);
}
}

View File

@ -1,7 +1,6 @@
package com.hbm.items.weapon;
import com.hbm.entity.grenade.EntityGrenadeBouncyGeneric;
import com.hbm.entity.grenade.EntityGrenadeImpactGeneric;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@ -9,7 +8,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
@Deprecated
public class ItemGenericGrenade extends ItemGrenade {
public ItemGenericGrenade(int fuse) {
@ -26,11 +24,7 @@ public class ItemGenericGrenade extends ItemGrenade {
world.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if(!world.isRemote) {
if(fuse == -1)
world.spawnEntityInWorld(new EntityGrenadeImpactGeneric(world, player).setType(this));
else
world.spawnEntityInWorld(new EntityGrenadeBouncyGeneric(world, player).setType(this));
world.spawnEntityInWorld(new EntityGrenadeBouncyGeneric(world, player).setType(this));
}
return stack;

View File

@ -1,18 +0,0 @@
package com.hbm.items.weapon;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.world.World;
@Deprecated
public class ItemGrenadeKyiv extends ItemGenericGrenade {
public ItemGrenadeKyiv(int fuse) {
super(fuse);
}
@Override
public void explode(Entity grenade, EntityLivingBase thrower, World world, double x, double y, double z) {
world.newExplosion(grenade, x, y, z, 5F, true, true);
}
}

View File

@ -421,8 +421,6 @@ public class ClientProxy extends ServerProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRBMKRodReaSim.class, new RenderRBMKFuelChannel());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRBMKAutoloader.class, new RenderRBMKAutoloader());
//ITER
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityITER.class, new RenderITER());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachinePlasmaHeater.class, new RenderPlasmaHeater());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityICF.class, new RenderICF());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityICFController.class, new RenderICFController());
//Fusion
@ -633,7 +631,6 @@ public class ClientProxy extends ServerProxy {
RenderingRegistry.registerEntityRenderingHandler(EntityAcidBomb.class, new RenderSnowball(Items.slime_ball));
//grenades
RenderingRegistry.registerEntityRenderingHandler(EntityGrenadeBouncyGeneric.class, new RenderGenericGrenade());
RenderingRegistry.registerEntityRenderingHandler(EntityGrenadeImpactGeneric.class, new RenderGenericGrenade());
RenderingRegistry.registerEntityRenderingHandler(EntityDisperserCanister.class, new RenderGenericGrenade());
RenderingRegistry.registerEntityRenderingHandler(EntityGrenadeUniversal.class, new RenderGrenadeUniversal());
//missiles

View File

@ -439,7 +439,7 @@ public class MainRegistry {
achRBMKBoom = new Achievement("achievement.RBMKBoom", "RBMKBoom", 9, -7, ModItems.debris_fuel, achRBMK).initIndependentStat().setSpecial().registerStat();
achBismuth = new Achievement("achievement.bismuth", "bismuth", 11, -6, ModItems.ingot_bismuth, achRBMK).initIndependentStat().registerStat();
achBreeding = new Achievement("achievement.breeding", "breeding", 7, -6, ModItems.ingot_am_mix, achRBMK).initIndependentStat().setSpecial().registerStat();
achFusion = new Achievement("achievement.fusion", "fusion", 13, -7, new ItemStack(ModBlocks.iter), achBismuth).initIndependentStat().setSpecial().registerStat();
achFusion = new Achievement("achievement.fusion", "fusion", 13, -7, new ItemStack(ModBlocks.fusion_torus), achBismuth).initIndependentStat().setSpecial().registerStat();
achRedBalloons = new Achievement("achievement.redBalloons", "redBalloons", 11, 0, ModItems.missile_nuclear, achPolymer).initIndependentStat().setSpecial().registerStat();
achManhattan = new Achievement("achievement.manhattan", "manhattan", 11, -4, new ItemStack(ModBlocks.nuke_boy), achPolymer).initIndependentStat().setSpecial().registerStat();
@ -1572,6 +1572,8 @@ public class MainRegistry {
ignoreMappings.add("hbm:tile.plasma");
ignoreMappings.add("hbm:tile.cheater_virus");
ignoreMappings.add("hbm:tile.cheater_virus_seed");
ignoreMappings.add("hbm:tile.iter");
ignoreMappings.add("hbm:tile.plasma_heater");
/// REMAP ///
remapItems.put("hbm:item.gadget_explosive8", ModItems.early_explosive_lenses);

View File

@ -242,7 +242,6 @@ public class ResourceManager {
public static final IModelCustom breeder = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/reactors/breeder.obj"));
//ITER
public static final IModelCustom iter = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/reactors/iter.obj")).asVBO();
public static final IModelCustom fusion_torus = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/fusion/torus.obj")).asVBO();
public static final IModelCustom fusion_klystron = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/fusion/klystron.obj")).asVBO();
public static final IModelCustom fusion_breeder = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/fusion/breeder.obj")).asVBO();
@ -702,18 +701,6 @@ public class ResourceManager {
public static final ResourceLocation breeder_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/breeder.png");
//ITER
public static final ResourceLocation iter_glass = new ResourceLocation(RefStrings.MODID, "textures/models/iter/glass.png");
public static final ResourceLocation iter_microwave = new ResourceLocation(RefStrings.MODID, "textures/models/iter/microwave.png");
public static final ResourceLocation iter_motor = new ResourceLocation(RefStrings.MODID, "textures/models/iter/motor.png");
public static final ResourceLocation iter_plasma = new ResourceLocation(RefStrings.MODID, "textures/models/iter/plasma.png");
public static final ResourceLocation iter_rails = new ResourceLocation(RefStrings.MODID, "textures/models/iter/rails.png");
public static final ResourceLocation iter_solenoid = new ResourceLocation(RefStrings.MODID, "textures/models/iter/solenoid.png");
public static final ResourceLocation iter_toroidal = new ResourceLocation(RefStrings.MODID, "textures/models/iter/toroidal.png");
public static final ResourceLocation iter_torus = new ResourceLocation(RefStrings.MODID, "textures/models/iter/torus.png");
public static final ResourceLocation iter_torus_tungsten = new ResourceLocation(RefStrings.MODID, "textures/models/iter/torus_tungsten.png");
public static final ResourceLocation iter_torus_desh = new ResourceLocation(RefStrings.MODID, "textures/models/iter/torus_desh.png");
public static final ResourceLocation iter_torus_chlorophyte = new ResourceLocation(RefStrings.MODID, "textures/models/iter/torus_chlorophyte.png");
public static final ResourceLocation iter_torus_vaporwave = new ResourceLocation(RefStrings.MODID, "textures/models/iter/torus_vaporwave.png");
public static final ResourceLocation fusion_torus_tex = new ResourceLocation(RefStrings.MODID, "textures/models/fusion/torus.png");
public static final ResourceLocation fusion_plasma_tex = new ResourceLocation(RefStrings.MODID, "textures/models/fusion/plasma.png");
public static final ResourceLocation fusion_plasma_glow_tex = new ResourceLocation(RefStrings.MODID, "textures/models/fusion/plasma_glow.png");
@ -1330,7 +1317,6 @@ public class ResourceManager {
public static final ResourceLocation duchessgambit_tex = new ResourceLocation(RefStrings.MODID, "textures/models/duchessgambit.png");
public static final ResourceLocation building_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/building.png");
public static final ResourceLocation torpedo_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/torpedo.png");
public static final ResourceLocation rpc_tex = new ResourceLocation(RefStrings.MODID, "textures/models/rpc.png");
public static final ResourceLocation tom_main_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/tom_main.png");
public static final ResourceLocation tom_flame_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/tom_flame.png");
public static final ResourceLocation nikonium_tex = new ResourceLocation(RefStrings.MODID, "textures/models/misc/nikonium.png");
@ -1389,7 +1375,6 @@ public class ResourceManager {
public static final ResourceLocation missileShuttle_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile/missile_shuttle.png");
public static final ResourceLocation minerRocket_tex = new ResourceLocation(RefStrings.MODID, "textures/models/minerRocket.png");
public static final ResourceLocation bobmazon_tex = new ResourceLocation(RefStrings.MODID, "textures/models/bobmazon.png");
public static final ResourceLocation siege_dropship_tex = new ResourceLocation(RefStrings.MODID, "textures/models/siege_dropship.png");
public static final ResourceLocation soyuz_engineblock = new ResourceLocation(RefStrings.MODID, "textures/models/soyuz/engineblock.png");
public static final ResourceLocation soyuz_bottomstage = new ResourceLocation(RefStrings.MODID, "textures/models/soyuz/bottomstage.png");

View File

@ -55,23 +55,6 @@ public class ItemRenderLibrary {
GL11.glShadeModel(GL11.GL_FLAT);
}});
renderers.put(Item.getItemFromBlock(ModBlocks.iter), new ItemRenderBase() {
public void renderInventory() {
GL11.glTranslated(0, -1, 0);
GL11.glScaled(4.5, 4.5, 4.5);
}
public void renderCommon() {
GL11.glScaled(0.25, 0.25, 0.25);
GL11.glShadeModel(GL11.GL_SMOOTH);
bindTexture(ResourceManager.iter_glass); ResourceManager.iter.renderPart("Windows");
bindTexture(ResourceManager.iter_motor); ResourceManager.iter.renderPart("Motors");
bindTexture(ResourceManager.iter_rails); ResourceManager.iter.renderPart("Rails");
bindTexture(ResourceManager.iter_toroidal); ResourceManager.iter.renderPart("Toroidal");
bindTexture(ResourceManager.iter_torus); ResourceManager.iter.renderPart("Torus");
bindTexture(ResourceManager.iter_solenoid); ResourceManager.iter.renderPart("Solenoid");
GL11.glShadeModel(GL11.GL_FLAT);
}});
renderers.put(Item.getItemFromBlock(ModBlocks.machine_press), new ItemRenderBase() {
public void renderInventory() {
GL11.glTranslated(0, -4, 0);
@ -259,20 +242,6 @@ public class ItemRenderLibrary {
bindTexture(ResourceManager.mining_laser_laser_tex); ResourceManager.mining_laser.renderPart("Laser");
}});
renderers.put(Item.getItemFromBlock(ModBlocks.plasma_heater), new ItemRenderBase() {
public void renderInventory() {
GL11.glTranslated(0, -1, 0);
GL11.glRotated(90, 0, 1, 0);
GL11.glScaled(2.5, 2.5, 2.5);
}
public void renderCommon() {
GL11.glScaled(0.5, 0.5, 0.5);
GL11.glTranslatef(0, 0, 14);
GL11.glShadeModel(GL11.GL_SMOOTH);
bindTexture(ResourceManager.iter_microwave); ResourceManager.iter.renderPart("Microwave");
GL11.glShadeModel(GL11.GL_FLAT);
}});
renderers.put(Item.getItemFromBlock(ModBlocks.tesla), new ItemRenderBase() {
public void renderInventory() {
GL11.glTranslated(0, -3, 0);

View File

@ -1,90 +0,0 @@
package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import com.hbm.main.ResourceManager;
import com.hbm.tileentity.machine.TileEntityITER;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
public class RenderITER extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {
TileEntityITER iter = (TileEntityITER) te;
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y - 2, (float) z + 0.5F);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glShadeModel(GL11.GL_SMOOTH);
bindTexture(ResourceManager.iter_glass);
ResourceManager.iter.renderPart("Windows");
bindTexture(ResourceManager.iter_motor);
ResourceManager.iter.renderPart("Motors");
bindTexture(ResourceManager.iter_rails);
ResourceManager.iter.renderPart("Rails");
bindTexture(ResourceManager.iter_toroidal);
ResourceManager.iter.renderPart("Toroidal");
switch(iter.blanket) {
case 0: bindTexture(ResourceManager.iter_torus); break;
case 1: bindTexture(ResourceManager.iter_torus_tungsten); break;
case 2: bindTexture(ResourceManager.iter_torus_desh); break;
case 3: bindTexture(ResourceManager.iter_torus_chlorophyte); break;
case 4: bindTexture(ResourceManager.iter_torus_vaporwave); break;
default: bindTexture(ResourceManager.iter_torus); break;
}
ResourceManager.iter.renderPart("Torus");
GL11.glPushMatrix();
GL11.glRotated(iter.lastRotor + (iter.rotor - iter.lastRotor) * f, 0, 1, 0);
bindTexture(ResourceManager.iter_solenoid);
ResourceManager.iter.renderPart("Solenoid");
GL11.glPopMatrix();
if(iter.plasma.getFill() > 0) {
GL11.glPushMatrix();
GL11.glRotated(System.currentTimeMillis() / 50D % 360, 0, 1, 0);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
GL11.glDepthMask(false);
int color = iter.plasma.getTankType().getColor();
double alpha = (double) iter.plasma.getFill() / (double) iter.plasma.getMaxFill();
int r = (int) (((color & 0xFF0000) >> 16) / 2 * alpha);
int g = (int) (((color & 0xFF00) >> 8) / 2 * alpha);
int b = (int) ((color & 0xFF) / 2 * alpha);
GL11.glColor3b((byte) r, (byte) g, (byte) b);
GL11.glTranslatef(0, 2.5F, 0);
GL11.glScaled(1, alpha, 1);
GL11.glTranslatef(0, -2.5F, 0);
bindTexture(ResourceManager.iter_plasma);
ResourceManager.iter.renderPart("Plasma");
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(true);
GL11.glPopMatrix();
}
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPopMatrix();
}
}

View File

@ -1,39 +0,0 @@
package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.BlockDummyable;
import com.hbm.main.ResourceManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
public class RenderPlasmaHeater extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y, (float) z + 0.5F);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glShadeModel(GL11.GL_SMOOTH);
switch(te.getBlockMetadata() - BlockDummyable.offset) {
case 2: GL11.glRotatef(0, 0F, 1F, 0F); break;
case 4: GL11.glRotatef(90, 0F, 1F, 0F); break;
case 3: GL11.glRotatef(180, 0F, 1F, 0F); break;
case 5: GL11.glRotatef(270, 0F, 1F, 0F); break;
}
GL11.glTranslatef(0, 0, 18);
bindTexture(ResourceManager.iter_microwave);
ResourceManager.iter.renderPart("Microwave");
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPopMatrix();
}
}

View File

@ -179,12 +179,10 @@ public class TileMappings {
put(TileEntityNukeBalefire.class, "tileentity_nuke_fstbmb");
put(TileEntityMicrowave.class, "tileentity_microwave");
put(TileEntityMachineMiniRTG.class, "tileentity_mini_rtg");
put(TileEntityITER.class, "tileentity_iter");
put(TileEntityBlockICF.class, "tileentity_block_icf");
put(TileEntityICFPress.class, "tileentity_icf_press");
put(TileEntityICFController.class, "tileentity_icf_controller");
put(TileEntityICF.class, "tileentity_icf");
put(TileEntityMachinePlasmaHeater.class, "tileentity_plasma_heater");
put(TileEntityMachineFENSU.class, "tileentity_fensu");
put(TileEntityTrappedBrick.class, "tileentity_trapped_brick");
put(TileEntityWatzStruct.class, "tileentity_watz_struct");

View File

@ -1,566 +0,0 @@
package com.hbm.tileentity.machine;
import java.util.ArrayList;
import java.util.List;
import com.hbm.explosion.ExplosionLarge;
import com.hbm.explosion.ExplosionNT;
import com.hbm.explosion.ExplosionNT.ExAttrib;
import com.hbm.handler.threading.PacketThreading;
import com.hbm.inventory.container.ContainerITER;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.gui.GUIITER;
import com.hbm.inventory.recipes.BreederRecipes;
import com.hbm.inventory.recipes.BreederRecipes.BreederRecipe;
import com.hbm.inventory.recipes.FusionRecipesLegacy;
import com.hbm.items.ModItems;
import com.hbm.items.special.ItemFusionShield;
import com.hbm.lib.Library;
import com.hbm.main.MainRegistry;
import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.sound.AudioWrapper;
import com.hbm.tileentity.IFluidCopiable;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.util.CompatEnergyControl;
import com.hbm.util.fauxpointtwelve.DirPos;
import api.hbm.energymk2.IEnergyReceiverMK2;
import api.hbm.fluid.IFluidStandardTransceiver;
import api.hbm.redstoneoverradio.IRORInteractive;
import api.hbm.redstoneoverradio.IRORValueProvider;
import api.hbm.tile.IInfoProviderEC;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
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.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@Deprecated
public class TileEntityITER extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiver, IGUIProvider, IInfoProviderEC, IFluidCopiable, IRORValueProvider, IRORInteractive {
public long power;
public static final long maxPower = 10000000;
public static final int powerReq = 100000;
public FluidTank[] tanks;
public FluidTank plasma;
public int progress;
public static final int duration = 100;
public long totalRuntime;
@SideOnly(Side.CLIENT)
public int blanket;
public float rotor;
public float lastRotor;
public boolean isOn;
private float rotorSpeed = 0F;
private AudioWrapper audio;
public TileEntityITER() {
super(5);
tanks = new FluidTank[2];
tanks[0] = new FluidTank(Fluids.WATER, 1280000);
tanks[1] = new FluidTank(Fluids.ULTRAHOTSTEAM, 128000);
plasma = new FluidTank(Fluids.PLASMA_DT, 16000);
}
@Override
public String getName() {
return "container.machineITER";
}
@Override
public void updateEntity() {
if(!worldObj.isRemote) {
this.updateConnections();
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
/// START Processing part ///
if(!isOn) {
plasma.setFill(0); //jettison plasma if the thing is turned off
}
//explode either if there's plasma that is too hot or if the reactor is turned on but the magnets have no power
if(plasma.getFill() > 0 && (this.plasma.getTankType().temperature >= this.getShield() || (this.isOn && this.power < this.powerReq))) {
this.explode();
}
if(isOn && power >= powerReq) {
power -= powerReq;
if(plasma.getFill() > 0) {
this.totalRuntime++;
int delay = FusionRecipesLegacy.getByproductDelay(plasma.getTankType());
if(delay > 0 && totalRuntime % delay == 0) produceByproduct();
}
if(plasma.getFill() > 0 && this.getShield() != 0) {
ItemFusionShield.setShieldDamage(slots[3], ItemFusionShield.getShieldDamage(slots[3]) + 1);
if(ItemFusionShield.getShieldDamage(slots[3]) > ((ItemFusionShield)slots[3].getItem()).maxDamage) {
slots[3] = null;
worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.shutdown", 5F, 1F);
this.isOn = false;
this.markDirty();
}
}
int prod = FusionRecipesLegacy.getSteamProduction(plasma.getTankType());
for(int i = 0; i < 20; i++) {
if(plasma.getFill() > 0) {
if(tanks[0].getFill() >= prod * 10) {
tanks[0].setFill(tanks[0].getFill() - prod * 10);
tanks[1].setFill(tanks[1].getFill() + prod);
if(tanks[1].getFill() > tanks[1].getMaxFill())
tanks[1].setFill(tanks[1].getMaxFill());
}
plasma.setFill(plasma.getFill() - 1);
}
}
}
doBreederStuff();
/// END Processing part ///
/// START Notif packets ///
for(DirPos pos : getConPos()) {
if(tanks[1].getFill() > 0) {
this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
}
this.networkPackNT(250);
/// END Notif packets ///
} else {
this.lastRotor = this.rotor;
this.rotor += this.rotorSpeed;
if(this.rotor >= 360) {
this.rotor -= 360;
this.lastRotor -= 360;
}
if(this.isOn && this.power >= powerReq) {
this.rotorSpeed = Math.max(0F, Math.min(15F, this.rotorSpeed + 0.05F));
if(audio == null) {
audio = MainRegistry.proxy.getLoopedSound("hbm:block.fusionReactorRunning", xCoord, yCoord, zCoord, 1.0F, 30F, 1.0F);
audio.startSound();
}
float rotorSpeed = this.rotorSpeed / 15F;
audio.updateVolume(getVolume(0.5f * rotorSpeed));
audio.updatePitch(0.25F + 0.75F * rotorSpeed);
} else {
this.rotorSpeed = Math.max(0F, Math.min(15F, this.rotorSpeed - 0.1F));
if(audio != null) {
if(this.rotorSpeed > 0) {
float rotorSpeed = this.rotorSpeed / 15F;
audio.updateVolume(getVolume(0.5f * rotorSpeed));
audio.updatePitch(0.25F + 0.75F * rotorSpeed);
} else {
audio.stopSound();
audio = null;
}
}
}
}
}
protected List<DirPos> connections;
private void updateConnections() {
for(DirPos pos : getConPos()) {
this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
}
protected List<DirPos> getConPos() {
if(connections != null && !connections.isEmpty())
return connections;
connections = new ArrayList();
connections.add(new DirPos(xCoord, yCoord + 3, zCoord, ForgeDirection.UP));
connections.add(new DirPos(xCoord, yCoord - 3, zCoord, ForgeDirection.DOWN));
Vec3 vec = Vec3.createVectorHelper(5.75, 0, 0);
for(int i = 0; i < 16; i++) {
vec.rotateAroundY((float) (Math.PI / 8));
connections.add(new DirPos(xCoord + (int)vec.xCoord, yCoord + 3, zCoord + (int)vec.zCoord, ForgeDirection.UP));
connections.add(new DirPos(xCoord + (int)vec.xCoord, yCoord - 3, zCoord + (int)vec.zCoord, ForgeDirection.DOWN));
}
return connections;
}
private void explode() {
this.disassemble();
if(this.plasma.getTankType() == Fluids.PLASMA_BF) {
worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:weapon.mukeExplosion", 15.0F, 1.0F);
ExplosionLarge.spawnShrapnels(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 50);
ExplosionNT exp = new ExplosionNT(worldObj, null, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 20F)
.addAttrib(ExAttrib.BALEFIRE)
.addAttrib(ExAttrib.NOPARTICLE)
.addAttrib(ExAttrib.NOSOUND)
.addAttrib(ExAttrib.NODROP)
.overrideResolution(64);
exp.doExplosionA();
exp.doExplosionB(false);
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "muke");
data.setBoolean("balefire", true);
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 250));
} else {
Vec3 vec = Vec3.createVectorHelper(5.5, 0, 0);
vec.rotateAroundY(worldObj.rand.nextFloat() * (float)Math.PI * 2F);
worldObj.newExplosion(null, xCoord + 0.5 + vec.xCoord, yCoord + 0.5 + worldObj.rand.nextGaussian() * 1.5D, zCoord + 0.5 + vec.zCoord, 2.5F, true, true);
}
}
private void doBreederStuff() {
if(plasma.getFill() == 0) {
this.progress = 0;
return;
}
BreederRecipe out = BreederRecipes.getOutput(slots[1]);
if(slots[1] != null && slots[1].getItem() == ModItems.meteorite_sword_irradiated)
out = new BreederRecipe(ModItems.meteorite_sword_fused, 1000);
if(slots[1] != null && slots[1].getItem() == ModItems.meteorite_sword_fused)
out = new BreederRecipe(ModItems.meteorite_sword_baleful, 4000);
if(out == null) {
this.progress = 0;
return;
}
if(slots[2] != null && slots[2].stackSize >= slots[2].getMaxStackSize()) {
this.progress = 0;
return;
}
int level = FusionRecipesLegacy.getBreedingLevel(plasma.getTankType());
if(out.flux > level) {
this.progress = 0;
return;
}
progress++;
if(progress > this.duration) {
this.progress = 0;
if(slots[2] != null) {
slots[2].stackSize++;
} else {
slots[2] = out.output.copy();
}
slots[1].stackSize--;
if(slots[1].stackSize <= 0)
slots[1] = null;
this.markDirty();
}
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, int side) {
return slot == 2 || slot == 4; // only allow removing breeder outputs <- ?????
}
@Override
public int[] getAccessibleSlotsFromSide(int side) {
return new int[] { 1, 2, 4 };
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack) {
if(i == 1 && BreederRecipes.getOutput(stack) != null)
return true;
return false;
}
private void produceByproduct() {
ItemStack by = FusionRecipesLegacy.getByproduct(plasma.getTankType());
if(by == null)
return;
if(slots[4] == null) {
slots[4] = by;
return;
}
if(slots[4].getItem() == by.getItem() && slots[4].getItemDamage() == by.getItemDamage() && slots[4].stackSize < slots[4].getMaxStackSize()) {
slots[4].stackSize++;
}
}
public int getShield() {
if(slots[3] == null || !(slots[3].getItem() instanceof ItemFusionShield))
return 0;
return ((ItemFusionShield)slots[3].getItem()).maxTemp;
}
@Override
public void serialize(ByteBuf buf) {
super.serialize(buf);
buf.writeBoolean(this.isOn);
buf.writeLong(this.power);
buf.writeInt(this.progress);
tanks[0].serialize(buf);
tanks[1].serialize(buf);
plasma.serialize(buf);
if(slots[3] == null) {
buf.writeInt(0);
} else if(slots[3].getItem() == ModItems.fusion_shield_tungsten) {
buf.writeInt(1);
} else if(slots[3].getItem() == ModItems.fusion_shield_desh) {
buf.writeInt(2);
} else if(slots[3].getItem() == ModItems.fusion_shield_chlorophyte) {
buf.writeInt(3);
} else if(slots[3].getItem() == ModItems.fusion_shield_vaporwave) {
buf.writeInt(4);
}
}
@Override
public void deserialize(ByteBuf buf) {
super.deserialize(buf);
this.isOn = buf.readBoolean();
this.power = buf.readLong();
this.progress = buf.readInt();
tanks[0].deserialize(buf);
tanks[1].deserialize(buf);
plasma.deserialize(buf);
this.blanket = buf.readInt();
}
@Override
public void handleButtonPacket(int value, int meta) {
if(meta == 0) this.isOn = !this.isOn;
}
public long getPowerScaled(long i) { return (power * i) / maxPower; }
public long getProgressScaled(long i) { return (progress * i) / duration; }
@Override public void setPower(long i) { this.power = i; }
@Override public long getPower() { return power; }
@Override public long getMaxPower() { return maxPower; }
@Override
public void onChunkUnload() {
super.onChunkUnload();
if(audio != null) {
audio.stopSound();
audio = null;
}
}
@Override
public void invalidate() {
super.invalidate();
if(audio != null) {
audio.stopSound();
audio = null;
}
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.power = nbt.getLong("power");
this.isOn = nbt.getBoolean("isOn");
this.totalRuntime = nbt.getLong("totalRuntime");
tanks[0].readFromNBT(nbt, "water");
tanks[1].readFromNBT(nbt, "steam");
plasma.readFromNBT(nbt, "plasma");
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setLong("power", this.power);
nbt.setBoolean("isOn", isOn);
nbt.setLong("totalRuntime", this.totalRuntime);
tanks[0].writeToNBT(nbt, "water");
tanks[1].writeToNBT(nbt, "steam");
plasma.writeToNBT(nbt, "plasma");
}
AxisAlignedBB bb = null;
@Override
public AxisAlignedBB getRenderBoundingBox() {
if(bb == null) {
bb = AxisAlignedBB.getBoundingBox(
xCoord + 0.5 - 8,
yCoord + 0.5 - 3,
zCoord + 0.5 - 8,
xCoord + 0.5 + 8,
yCoord + 0.5 + 3,
zCoord + 0.5 + 8
);
}
return bb;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared() {
return 65536.0D;
}
public void disassemble() {
worldObj.func_147480_a(xCoord, yCoord, zCoord, false);
}
@Override
public FluidTank[] getSendingTanks() {
return new FluidTank[] {tanks[1]};
}
@Override
public FluidTank[] getReceivingTanks() {
return new FluidTank[] {tanks[0]};
}
@Override
public FluidTank[] getAllTanks() {
return tanks;
}
@Override
public boolean canConnect(ForgeDirection dir) {
return dir == ForgeDirection.UP || dir == ForgeDirection.DOWN;
}
@Override
public boolean canConnect(FluidType type, ForgeDirection dir) {
return dir == ForgeDirection.UP || dir == ForgeDirection.DOWN;
}
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerITER(player.inventory, this);
}
@Override
@SideOnly(Side.CLIENT)
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new GUIITER(player.inventory, this);
}
@Override
public void provideExtraInfo(NBTTagCompound data) {
data.setBoolean(CompatEnergyControl.B_ACTIVE, this.isOn && plasma.getFill() > 0);
int output = FusionRecipesLegacy.getSteamProduction(plasma.getTankType());
data.setDouble("consumption", output * 10);
data.setDouble("outputmb", output);
}
@Override
public FluidTank getTankToPaste() {
return null;
}
@Override
public String[] getFunctionInfo() {
return new String[] {
PREFIX_VALUE + "durability",
PREFIX_VALUE + "durabilitypercent",
PREFIX_FUNCTION + "toggle",
PREFIX_FUNCTION + "switch" + NAME_SEPARATOR + "on/off",
};
}
@Override
public String provideRORValue(String name) {
if((PREFIX_VALUE + "durability").equals(name)) return (slots[3] != null && slots[3].getItem() instanceof ItemFusionShield) ? "" + (((ItemFusionShield) slots[3].getItem()).maxDamage - ItemFusionShield.getShieldDamage(slots[3])) : "0";
if((PREFIX_VALUE + "durabilitypercent").equals(name)) return (slots[3] != null && slots[3].getItem() instanceof ItemFusionShield) ? "" + ((((ItemFusionShield) slots[3].getItem()).maxDamage - ItemFusionShield.getShieldDamage(slots[3])) * 100 / ((ItemFusionShield) slots[3].getItem()).maxDamage) : "0";
return null;
}
@Override
public String runRORFunction(String name, String[] params) {
if((PREFIX_FUNCTION + "toggle").equals(name)) {
this.isOn = !this.isOn;
this.markChanged();
return null;
}
if((PREFIX_FUNCTION + "switch").equals(name) && params.length > 0) {
if("on".equals(params[0])) {
this.isOn = true;
this.markChanged();
return null;
}
if("off".equals(params[0])) {
this.isOn = false;
this.markChanged();
return null;
}
}
return null;
}
}

View File

@ -1,115 +0,0 @@
package com.hbm.tileentity.machine;
@Deprecated
public class TileEntityITERStruct {
public static final int[][][] layout = new int[][][] {
new int[][] {
new int[] {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
new int[] {0,0,0,0,0,1,1,1,1,1,0,0,0,0,0},
new int[] {0,0,0,0,1,1,1,1,1,1,1,0,0,0,0},
new int[] {0,0,0,1,1,0,0,0,0,0,1,1,0,0,0},
new int[] {0,0,1,1,0,0,0,0,0,0,0,1,1,0,0},
new int[] {0,1,1,0,0,0,0,0,0,0,0,0,1,1,0},
new int[] {0,1,1,0,0,0,0,0,0,0,0,0,1,1,0},
new int[] {0,1,1,0,0,0,0,3,0,0,0,0,1,1,0},
new int[] {0,1,1,0,0,0,0,0,0,0,0,0,1,1,0},
new int[] {0,1,1,0,0,0,0,0,0,0,0,0,1,1,0},
new int[] {0,0,1,1,0,0,0,0,0,0,0,1,1,0,0},
new int[] {0,0,0,1,1,0,0,0,0,0,1,1,0,0,0},
new int[] {0,0,0,0,1,1,1,1,1,1,1,0,0,0,0},
new int[] {0,0,0,0,0,1,1,1,1,1,0,0,0,0,0},
new int[] {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
},
new int[][] {
new int[] {0,0,0,0,0,0,1,1,1,0,0,0,0,0,0},
new int[] {0,0,0,0,1,1,0,0,0,1,1,0,0,0,0},
new int[] {0,0,0,1,0,0,0,0,0,0,0,1,0,0,0},
new int[] {0,0,1,0,0,1,1,1,1,1,0,0,1,0,0},
new int[] {0,1,0,0,1,0,2,2,2,0,1,0,0,1,0},
new int[] {0,1,0,1,0,2,0,2,0,2,0,1,0,1,0},
new int[] {1,0,0,1,2,0,0,2,0,0,2,1,0,0,1},
new int[] {1,0,0,1,2,2,2,3,2,2,2,1,0,0,1},
new int[] {1,0,0,1,2,0,0,2,0,0,2,1,0,0,1},
new int[] {0,1,0,1,0,2,0,2,0,2,0,1,0,1,0},
new int[] {0,1,0,0,1,0,2,2,2,0,1,0,0,1,0},
new int[] {0,0,1,0,0,1,1,1,1,1,0,0,1,0,0},
new int[] {0,0,0,1,0,0,0,0,0,0,0,1,0,0,0},
new int[] {0,0,0,0,1,1,0,0,0,1,1,0,0,0,0},
new int[] {0,0,0,0,0,0,1,1,1,0,0,0,0,0,0}
},
new int[][] {
new int[] {0,0,0,0,0,0,1,1,1,0,0,0,0,0,0},
new int[] {0,0,0,0,1,1,0,0,0,1,1,0,0,0,0},
new int[] {0,0,0,4,0,0,0,0,0,0,0,4,0,0,0},
new int[] {0,0,4,0,0,1,1,1,1,1,0,0,4,0,0},
new int[] {0,1,0,0,1,0,2,2,2,0,1,0,0,1,0},
new int[] {0,1,0,1,0,2,0,0,0,2,0,1,0,1,0},
new int[] {1,0,0,1,2,0,0,0,0,0,2,1,0,0,1},
new int[] {1,0,0,1,2,0,0,3,0,0,2,1,0,0,1},
new int[] {1,0,0,1,2,0,0,0,0,0,2,1,0,0,1},
new int[] {0,1,0,1,0,2,0,0,0,2,0,1,0,1,0},
new int[] {0,1,0,0,1,0,2,2,2,0,1,0,0,1,0},
new int[] {0,0,4,0,0,1,1,1,1,1,0,0,4,0,0},
new int[] {0,0,0,4,0,0,0,0,0,0,0,4,0,0,0},
new int[] {0,0,0,0,1,1,0,0,0,1,1,0,0,0,0},
new int[] {0,0,0,0,0,0,1,1,1,0,0,0,0,0,0}
}
};
public static final int[][][] collisionMask = new int[][][] {
new int[][] {
new int[] {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
new int[] {0,0,0,0,0,1,1,1,1,1,0,0,0,0,0},
new int[] {0,0,0,0,1,1,1,1,1,1,1,0,0,0,0},
new int[] {0,0,0,1,1,0,0,0,0,0,1,1,0,0,0},
new int[] {0,0,1,1,0,0,0,0,0,0,0,1,1,0,0},
new int[] {0,1,1,0,0,0,0,0,0,0,0,0,1,1,0},
new int[] {0,1,1,0,0,0,0,0,0,0,0,0,1,1,0},
new int[] {0,1,1,0,0,0,0,3,0,0,0,0,1,1,0},
new int[] {0,1,1,0,0,0,0,0,0,0,0,0,1,1,0},
new int[] {0,1,1,0,0,0,0,0,0,0,0,0,1,1,0},
new int[] {0,0,1,1,0,0,0,0,0,0,0,1,1,0,0},
new int[] {0,0,0,1,1,0,0,0,0,0,1,1,0,0,0},
new int[] {0,0,0,0,1,1,1,1,1,1,1,0,0,0,0},
new int[] {0,0,0,0,0,1,1,1,1,1,0,0,0,0,0},
new int[] {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
},
new int[][] {
new int[] {0,0,0,0,0,0,1,1,1,0,0,0,0,0,0},
new int[] {0,0,0,0,1,1,1,1,1,1,1,0,0,0,0},
new int[] {0,0,0,1,1,1,1,1,1,1,1,1,0,0,0},
new int[] {0,0,1,1,1,1,1,1,1,1,1,1,1,0,0},
new int[] {0,1,1,1,1,0,2,2,2,0,1,1,1,1,0},
new int[] {0,1,1,1,0,2,0,0,0,2,0,1,1,1,0},
new int[] {1,1,1,1,2,0,0,0,0,0,2,1,1,1,1},
new int[] {1,1,1,1,2,0,0,3,0,0,2,1,1,1,1},
new int[] {1,1,1,1,2,0,0,0,0,0,2,1,1,1,1},
new int[] {0,1,1,1,0,2,0,0,0,2,0,1,1,1,0},
new int[] {0,1,1,1,1,0,2,2,2,0,1,1,1,1,0},
new int[] {0,0,1,1,1,1,1,1,1,1,1,1,1,0,0},
new int[] {0,0,0,1,1,1,1,1,1,1,1,1,0,0,0},
new int[] {0,0,0,0,1,1,1,1,1,1,1,0,0,0,0},
new int[] {0,0,0,0,0,0,1,1,1,0,0,0,0,0,0}
},
new int[][] {
new int[] {0,0,0,0,0,0,1,1,1,0,0,0,0,0,0},
new int[] {0,0,0,0,1,1,1,1,1,1,1,0,0,0,0},
new int[] {0,0,0,1,1,1,1,1,1,1,1,1,0,0,0},
new int[] {0,0,1,1,1,1,1,1,1,1,1,1,1,0,0},
new int[] {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0},
new int[] {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0},
new int[] {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
new int[] {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
new int[] {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
new int[] {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0},
new int[] {0,1,1,1,1,1,1,1,1,1,1,1,1,1,0},
new int[] {0,0,1,1,1,1,1,1,1,1,1,1,1,0,0},
new int[] {0,0,0,1,1,1,1,1,1,1,1,1,0,0,0},
new int[] {0,0,0,0,1,1,1,1,1,1,1,0,0,0,0},
new int[] {0,0,0,0,0,0,1,1,1,0,0,0,0,0,0}
}
};
}

View File

@ -1,267 +0,0 @@
package com.hbm.tileentity.machine;
import java.util.ArrayList;
import java.util.List;
import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.machine.MachineITER;
import com.hbm.inventory.container.ContainerPlasmaHeater;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.gui.GUIPlasmaHeater;
import com.hbm.lib.Library;
import com.hbm.tileentity.IFluidCopiable;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityMachineBase;
import api.hbm.energymk2.IEnergyReceiverMK2;
import api.hbm.fluid.IFluidStandardReceiver;
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.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityMachinePlasmaHeater extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardReceiver, IGUIProvider, IFluidCopiable {
public long power;
public static final long maxPower = 100000000;
public FluidTank[] tanks;
public FluidTank plasma;
public TileEntityMachinePlasmaHeater() {
super(5);
tanks = new FluidTank[2];
tanks[0] = new FluidTank(Fluids.DEUTERIUM, 16_000);
tanks[1] = new FluidTank(Fluids.TRITIUM, 16_000);
plasma = new FluidTank(Fluids.PLASMA_DT, 64_000);
}
@Override
public String getName() {
return "container.plasmaHeater";
}
@Override
public void updateEntity() {
if(!worldObj.isRemote) {
if(this.worldObj.getTotalWorldTime() % 20 == 0)
this.updateConnections();
/// START Managing all the internal stuff ///
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
tanks[0].setType(1, 2, slots);
tanks[1].setType(3, 4, slots);
updateType();
int maxConv = 50;
int powerReq = 10000;
int convert = Math.min(tanks[0].getFill(), tanks[1].getFill());
convert = Math.min(convert, (plasma.getMaxFill() - plasma.getFill()) / 2);
convert = Math.min(convert, maxConv);
convert = (int) Math.min(convert, power / powerReq);
convert = Math.max(0, convert);
if(convert > 0 && plasma.getTankType() != Fluids.NONE) {
tanks[0].setFill(tanks[0].getFill() - convert);
tanks[1].setFill(tanks[1].getFill() - convert);
plasma.setFill(plasma.getFill() + convert * 2);
power -= convert * powerReq;
this.markDirty();
}
/// END Managing all the internal stuff ///
/// START Loading plasma into the ITER ///
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset).getOpposite();
int dist = 11;
if(worldObj.getBlock(xCoord + dir.offsetX * dist, yCoord + 2, zCoord + dir.offsetZ * dist) == ModBlocks.iter) {
int[] pos = ((MachineITER)ModBlocks.iter).findCore(worldObj, xCoord + dir.offsetX * dist, yCoord + 2, zCoord + dir.offsetZ * dist);
if(pos != null) {
TileEntity te = worldObj.getTileEntity(pos[0], pos[1], pos[2]);
if(te instanceof TileEntityITER) {
TileEntityITER iter = (TileEntityITER)te;
if(iter.plasma.getFill() == 0 && this.plasma.getTankType() != Fluids.NONE) {
iter.plasma.setTankType(this.plasma.getTankType());
}
if(iter.isOn) {
if(iter.plasma.getTankType() == this.plasma.getTankType()) {
int toLoad = Math.min(iter.plasma.getMaxFill() - iter.plasma.getFill(), this.plasma.getFill());
toLoad = Math.min(toLoad, 40);
this.plasma.setFill(this.plasma.getFill() - toLoad);
iter.plasma.setFill(iter.plasma.getFill() + toLoad);
this.markDirty();
iter.markDirty();
}
}
}
}
}
/// END Loading plasma into the ITER ///
/// START Notif packets ///
this.networkPackNT(50);
/// END Notif packets ///
}
}
private void updateConnections() {
this.getBlockMetadata();
ForgeDirection dir = ForgeDirection.getOrientation(this.blockMetadata - BlockDummyable.offset);
ForgeDirection side = dir.getRotation(ForgeDirection.UP);
for(int i = 1; i < 4; i++) {
for(int j = -1; j < 2; j++) {
this.trySubscribe(worldObj, xCoord + side.offsetX * j + dir.offsetX * 2, yCoord + i, zCoord + side.offsetZ * j + dir.offsetZ * 2, j < 0 ? ForgeDirection.DOWN : ForgeDirection.UP);
this.trySubscribe(tanks[0].getTankType(), worldObj, xCoord + side.offsetX * j + dir.offsetX * 2, yCoord + i, zCoord + side.offsetZ * j + dir.offsetZ * 2, j < 0 ? ForgeDirection.DOWN : ForgeDirection.UP);
this.trySubscribe(tanks[1].getTankType(), worldObj, xCoord + side.offsetX * j + dir.offsetX * 2, yCoord + i, zCoord + side.offsetZ * j + dir.offsetZ * 2, j < 0 ? ForgeDirection.DOWN : ForgeDirection.UP);
}
}
}
@Override
public void serialize(ByteBuf buf) {
super.serialize(buf);
buf.writeLong(power);
tanks[0].serialize(buf);
tanks[1].serialize(buf);
plasma.serialize(buf);
}
@Override
public void deserialize(ByteBuf buf) {
super.deserialize(buf);
this.power = buf.readLong();
tanks[0].deserialize(buf);
tanks[1].deserialize(buf);
plasma.deserialize(buf);
}
private void updateType() {
List<FluidType> types = new ArrayList() {{ add(tanks[0].getTankType()); add(tanks[1].getTankType()); }};
if(types.contains(Fluids.DEUTERIUM) && types.contains(Fluids.TRITIUM)) {
plasma.setTankType(Fluids.PLASMA_DT);
return;
}
if(types.contains(Fluids.DEUTERIUM) && types.contains(Fluids.HELIUM3)) {
plasma.setTankType(Fluids.PLASMA_DH3);
return;
}
if(types.contains(Fluids.DEUTERIUM) && types.contains(Fluids.HYDROGEN)) {
plasma.setTankType(Fluids.PLASMA_HD);
return;
}
if(types.contains(Fluids.HYDROGEN) && types.contains(Fluids.TRITIUM)) {
plasma.setTankType(Fluids.PLASMA_HT);
return;
}
if(types.contains(Fluids.HELIUM4) && types.contains(Fluids.OXYGEN)) {
plasma.setTankType(Fluids.PLASMA_XM);
return;
}
if(types.contains(Fluids.BALEFIRE) && types.contains(Fluids.AMAT)) {
plasma.setTankType(Fluids.PLASMA_BF);
return;
}
plasma.setTankType(Fluids.NONE);
}
public long getPowerScaled(int i) {
return (power * i) / maxPower;
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.power = nbt.getLong("power");
tanks[0].readFromNBT(nbt, "fuel_1");
tanks[1].readFromNBT(nbt, "fuel_2");
plasma.readFromNBT(nbt, "plasma");
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setLong("power", power);
tanks[0].writeToNBT(nbt, "fuel_1");
tanks[1].writeToNBT(nbt, "fuel_2");
plasma.writeToNBT(nbt, "plasma");
}
@Override
public void setPower(long i) {
this.power = i;
}
@Override
public long getPower() {
return power;
}
@Override
public long getMaxPower() {
return maxPower;
}
@Override
public AxisAlignedBB getRenderBoundingBox() {
return TileEntity.INFINITE_EXTENT_AABB;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared() {
return 65536.0D;
}
@Override
public FluidTank[] getAllTanks() {
return new FluidTank[] {tanks[0], tanks[1], plasma};
}
@Override
public FluidTank[] getReceivingTanks() {
return tanks;
}
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerPlasmaHeater(player.inventory, this);
}
@Override
@SideOnly(Side.CLIENT)
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new GUIPlasmaHeater(player.inventory, this);
}
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 819 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 549 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 750 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 918 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 776 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 808 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 909 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 954 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 892 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 317 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 297 B