more ITER work, some balls-o-tron shenanigans

This commit is contained in:
Bob 2020-08-22 00:16:53 +02:00
parent b3bb02526d
commit fbf5ba8439
26 changed files with 5118 additions and 78 deletions

View File

@ -173,6 +173,7 @@ container.nukePrototype=Der Prototyp
container.nukeSolinium=Die Blauspülung
container.nukeTsar=Tsar Bombe
container.oilWell=Ölbohrturm
container.plasmaHeater=Plasmaheizer
container.press=Befeuerte Presse
container.puf6_tank=PuF6 Tank
container.pumpjack=Pferdekopfpumpe
@ -2283,6 +2284,7 @@ tile.pink_planks.name=Pinke Holzbretter
tile.pink_slab.name=Pinke Holzstufe
tile.pink_stairs.name=Pinke Holztreppen
tile.plasma.name=Plasma
tile.plasma_heater.name=Plasmaheizer
tile.pole_satellite_receiver.name=Satellitenschüssel
tile.pole_top.name=Antennenspitze
tile.radiobox.name=Rosenberg Ungeziefervernichter

View File

@ -173,6 +173,7 @@ container.nukePrototype=The Prototype
container.nukeSolinium=The Blue Rinse
container.nukeTsar=Tsar Bomba
container.oilWell=Oil Derrick
container.plasmaHeater=Plasma Heater
container.press=Burner Press
container.puf6_tank=PuF6 Tank
container.pumpjack=Pumpjack
@ -2283,6 +2284,7 @@ tile.pink_planks.name=Pink Wood Planks
tile.pink_slab.name=Pink Wood Slab
tile.pink_stairs.name=Pink Wood Stairs
tile.plasma.name=Plasma
tile.plasma_heater.name=Plasma Heater
tile.pole_satellite_receiver.name=Satellite Dish
tile.pole_top.name=Antenna Top
tile.radiobox.name=Rosenberg Pest Control Box

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -984,7 +984,7 @@ public class ModBlocks {
brick_jungle = new BlockGeneric(Material.rock).setBlockName("brick_jungle").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(900.0F).setBlockTextureName(RefStrings.MODID + ":brick_jungle");
brick_jungle_cracked = new BlockGeneric(Material.rock).setBlockName("brick_jungle_cracked").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(900.0F).setBlockTextureName(RefStrings.MODID + ":brick_jungle_cracked");
brick_jungle_lava = new BlockGeneric(Material.rock).setBlockName("brick_jungle_lava").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(900.0F).setLightLevel(5F/15F).setBlockTextureName(RefStrings.MODID + ":brick_jungle_lava");
brick_jungle_trap = new BlockGeneric(Material.rock).setBlockName("brick_jungle_trap").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(900.0F).setBlockTextureName(RefStrings.MODID + ":brick_jungle_trap");
brick_jungle_trap = new TrappedBrick(Material.rock).setBlockName("brick_jungle_trap").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(900.0F).setBlockTextureName(RefStrings.MODID + ":brick_jungle_trap");
brick_jungle_glyph = new BlockGlyph(Material.rock).setBlockName("brick_jungle_glyph").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(900.0F);
tape_recorder = new DecoTapeRecorder(Material.rock).setBlockName("tape_recorder").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":deco_tape_recorder");

View File

@ -0,0 +1,99 @@
package com.hbm.blocks.generic;
import com.hbm.blocks.ModBlocks;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class TrappedBrick extends BlockContainer {
public TrappedBrick(Material mat) {
super(mat);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return null;
}
@Override
public void onEntityWalking(World world, int x, int y, int z, Entity entity) {
int meta = world.getBlockMetadata(x, y, z);
if(world.isRemote || Trap.get(meta).type != TrapType.ON_STEP || !(entity instanceof EntityPlayer)) {
return;
}
EntityPlayer player = (EntityPlayer)entity;
switch(Trap.get(meta)) {
case FIRE:
if(world.getBlock(x, y + 1, z).isReplaceable(world, x, y + 1, z))
world.setBlock(x, y + 1, z, Blocks.fire);
break;
case MINE:
world.createExplosion(null, x + 0.5, y + 1.5, z + 0.5, 1F, false);
break;
case WEB:
if(world.getBlock(x, y + 1, z).isReplaceable(world, x, y + 1, z))
world.setBlock(x, y + 1, z, Blocks.web);
break;
case SLOWNESS:
player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 300, 2));
break;
case WEAKNESS:
player.addPotionEffect(new PotionEffect(Potion.weakness.id, 300, 2));
break;
}
world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "random.click", 0.3F, 0.6F);
world.setBlock(x, y, z, ModBlocks.brick_jungle);
}
public static enum TrapType {
ON_STEP,
DETECTOR
}
public static enum Trap {
FALLING_ROCKS(TrapType.DETECTOR),
FIRE(TrapType.ON_STEP),
ARROW(TrapType.DETECTOR),
SPIKES(TrapType.ON_STEP),
MINE(TrapType.ON_STEP),
WEB(TrapType.ON_STEP),
FLAMING_ARROW(TrapType.DETECTOR),
PILLAR(TrapType.DETECTOR),
RAD_CONVERSION(TrapType.ON_STEP),
MAGIC_CONVERSTION(TrapType.ON_STEP),
SLOWNESS(TrapType.ON_STEP),
WEAKNESS(TrapType.ON_STEP),
POISON_DART(TrapType.DETECTOR),
ZOMBIE(TrapType.DETECTOR),
SPIDERS(TrapType.DETECTOR);
public TrapType type;
private Trap(TrapType type) {
this.type = type;
}
public static Trap get(int i) {
if(i < 0 || i >= Trap.values().length)
return Trap.values()[i];
return FIRE;
}
}
}

View File

@ -1,9 +1,14 @@
package com.hbm.blocks.machine;
import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ModBlocks;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.machine.TileEntityITER;
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.world.World;
@ -20,6 +25,29 @@ public class MachinePlasmaHeater extends BlockDummyable {
return new TileEntityMachinePlasmaHeater();
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, ModBlocks.guiID_plasma_heater, world, pos[0], pos[1], pos[2]);
}
return true;
} else {
return false;
}
}
@Override
public int[] getDimensions() {

View File

@ -16,7 +16,7 @@ public class EntityBOTPrimeBody extends EntityBOTPrimeBase {
super(world);
this.bodySpeed = 0.6D;
this.rangeForParts = 70.0D;
this.segmentDistance = 1.9D;
this.segmentDistance = 3.5D;
this.maxBodySpeed = 1.4D;
this.targetTasks.addTask(1, new EntityAINearestAttackableTargetNT(this, EntityLivingBase.class, 0, true, false, this.selector, 128.0D));
}

View File

@ -1,6 +1,7 @@
package com.hbm.entity.mob.botprime;
import com.hbm.entity.mob.EntityAINearestAttackableTargetNT;
import com.hbm.entity.particle.EntityCloudFX;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@ -27,15 +28,15 @@ public class EntityBOTPrimeHead extends EntityBOTPrimeBase implements IBossDispl
public EntityBOTPrimeHead(World world) {
super(world);
this.experienceValue = 1000;
/*this.experienceValue = 1000;
this.wasNearGround = false;
this.attackRange = 150.0D;
this.setSize(3.0F, 3.0F);
this.maxSpeed = 1.0D;
this.fallSpeed = 0.006D;
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
this.targetTasks.addTask(2, new EntityAINearestAttackableTargetNT(this, EntityPlayer.class, 0, false, false, null, 128.0D));
this.targetTasks.addTask(3, new EntityAINearestAttackableTargetNT(this, Entity.class, 0, false, false, this.selector, 50.0D));
this.targetTasks.addTask(2, new EntityAINearestAttackableTargetNT(this, EntityPlayer.class, 0, false, false, null, 128.0D));*/
//this.targetTasks.addTask(3, new EntityAINearestAttackableTargetNT(this, Entity.class, 0, false, false, this.selector, 50.0D));
}
@Override
@ -63,13 +64,13 @@ public class EntityBOTPrimeHead extends EntityBOTPrimeBase implements IBossDispl
public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) {
//TODO: check if this is even needed
setHeadID(this.getEntityId());
/*setHeadID(this.getEntityId());
int x = MathHelper.floor_double(this.posX);
int y = MathHelper.floor_double(this.posY);
int z = MathHelper.floor_double(this.posZ);
for (int i = 0; i < 119; i++) {
for (int i = 0; i < 49; i++) {
EntityBOTPrimeBody bodyPart = new EntityBOTPrimeBody(this.worldObj);
bodyPart.setPartNumber(i);
@ -81,7 +82,7 @@ public class EntityBOTPrimeHead extends EntityBOTPrimeBase implements IBossDispl
setPosition(x, y, z);
this.spawnPoint.set(x, y, z);
this.aggroCooldown = 60;
this.aggroCooldown = 60;*/
return super.onSpawnWithEgg(data);
}
@ -91,7 +92,11 @@ public class EntityBOTPrimeHead extends EntityBOTPrimeBase implements IBossDispl
super.updateAITasks();
this.movement.updateMovement();
/*this.movement.updateMovement();
if(worldObj.isRemote) {
System.out.println(posX + " " + posY + " " + posZ);
}
if ((getHealth() < getMaxHealth()) && (this.ticksExisted % 6 == 0)) {
if (this.targetedEntity != null) {
@ -119,7 +124,7 @@ public class EntityBOTPrimeHead extends EntityBOTPrimeBase implements IBossDispl
}
else if (this.attackCounter > 0) {
this.attackCounter -= 1;
}
}*/
}
@Override

View File

@ -2,8 +2,6 @@ package com.hbm.entity.mob.botprime;
import java.util.List;
import com.hbm.entity.mob.sodtekhnologiyah.EntityBurrowing;
import net.minecraft.command.IEntitySelector;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@ -13,7 +11,7 @@ import net.minecraft.util.DamageSource;
import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.World;
public abstract class EntityWormBaseNT extends EntityBurrowing {
public abstract class EntityWormBaseNT extends EntityBurrowingNT {
public int aggroCooldown = 0;
public int courseChangeCooldown = 0;
@ -51,7 +49,7 @@ public abstract class EntityWormBaseNT extends EntityBurrowing {
super(world);
this.setSize(1.0F, 1.0F);
this.surfaceY = 60;
this.renderDistanceWeight = 5.0D;
this.renderDistanceWeight = 15.0D;
}
public int getPartNumber() {
@ -81,7 +79,6 @@ public abstract class EntityWormBaseNT extends EntityBurrowing {
}
}
//TODO: test this with onUpdate instead
protected void updateEntityActionState() {
if((!this.worldObj.isRemote) && (this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL)) {

View File

@ -2,8 +2,6 @@ package com.hbm.entity.mob.botprime;
import java.util.List;
import com.hbm.entity.mob.sodtekhnologiyah.EntityWormBase;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
@ -27,7 +25,7 @@ public class WormMovementBodyNT {
}
if(((this.user.ticksExisted % 60 == 0) || (this.user.ticksExisted == 1)) && ((this.user.targetedEntity == null) || (this.user.followed == null))) {
findEntityToFollow(this.user.worldObj.selectEntitiesWithinAABB(EntityLiving.class, this.user.boundingBox.expand(this.user.rangeForParts, this.user.rangeForParts, this.user.rangeForParts), EntityWormBase.wormSelector));
findEntityToFollow(this.user.worldObj.selectEntitiesWithinAABB(EntityLiving.class, this.user.boundingBox.expand(this.user.rangeForParts, this.user.rangeForParts, this.user.rangeForParts), EntityWormBaseNT.wormSelector));
}
double deltaX = this.user.waypointX - this.user.posX;

View File

@ -10,19 +10,19 @@ public class FluidTypeHandler {
NONE (0x888888, 0, 1, 1, 0, 0, 0, EnumSymbol.NONE, "hbmfluid.none"),
WATER (0x3333FF, 1, 1, 1, 0, 0, 0, EnumSymbol.NONE, "hbmfluid.water"),
STEAM (0xe5e5e5, 9, 2, 1, 3, 0, 0, EnumSymbol.NONE, "hbmfluid.steam", true, false, false),
HOTSTEAM (0xE7D6D6, 1, 1, 2, 4, 0, 0, EnumSymbol.NONE, "hbmfluid.hotsteam", true, false, false),
SUPERHOTSTEAM (0xE7B7B7, 2, 1, 2, 4, 0, 0, EnumSymbol.NONE, "hbmfluid.superhotsteam", true, false, false),
ULTRAHOTSTEAM (0xE39393, 13, 1, 2, 4, 0, 0, EnumSymbol.NONE, "hbmfluid.ultrahotsteam", true, false, false),
STEAM (0xe5e5e5, 9, 2, 1, 3, 0, 0, EnumSymbol.NONE, "hbmfluid.steam", true, false, false, 100),
HOTSTEAM (0xE7D6D6, 1, 1, 2, 4, 0, 0, EnumSymbol.NONE, "hbmfluid.hotsteam", true, false, false, 300),
SUPERHOTSTEAM (0xE7B7B7, 2, 1, 2, 4, 0, 0, EnumSymbol.NONE, "hbmfluid.superhotsteam", true, false, false, 450),
ULTRAHOTSTEAM (0xE39393, 13, 1, 2, 4, 0, 0, EnumSymbol.NONE, "hbmfluid.ultrahotsteam", true, false, false, 600),
COOLANT (0xd8fcff, 2, 1, 1, 1, 0, 0, EnumSymbol.NONE, "hbmfluid.coolant"),
LAVA (0xFF3300, 3, 1, 1, 4, 0, 0, EnumSymbol.NOWATER, "hbmfluid.lava", true, false, false),
LAVA (0xFF3300, 3, 1, 1, 4, 0, 0, EnumSymbol.NOWATER, "hbmfluid.lava", true, false, false, 1200),
DEUTERIUM (0x0000FF, 4, 1, 1, 3, 4, 0, EnumSymbol.NONE, "hbmfluid.deuterium"),
TRITIUM (0x000099, 5, 1, 1, 3, 4, 0, EnumSymbol.RADIATION, "hbmfluid.tritium"),
OIL (0x020202, 6, 1, 1, 2, 1, 0, EnumSymbol.NONE, "hbmfluid.oil"),
HOTOIL (0x300900, 8, 2, 1, 2, 3, 0, EnumSymbol.NONE, "hbmfluid.hotoil", true, false, false),
HOTOIL (0x300900, 8, 2, 1, 2, 3, 0, EnumSymbol.NONE, "hbmfluid.hotoil", true, false, false, 350),
HEAVYOIL (0x141312, 2, 2, 1, 2, 1, 0, EnumSymbol.NONE, "hbmfluid.heavyoil"),
BITUMEN (0x1f2426, 3, 2, 1, 2, 0, 0, EnumSymbol.NONE, "hbmfluid.bitumen"),
@ -62,15 +62,15 @@ public class FluidTypeHandler {
HYDROGEN (0x4286f4, 3, 1, 2, 3, 4, 0, EnumSymbol.CROYGENIC, "hbmfluid.hydrogen"),
OXYGEN (0x98bdf9, 4, 1, 2, 3, 0, 0, EnumSymbol.CROYGENIC, "hbmfluid.oxygen"),
XENON (0xba45e8, 5, 1, 2, 0, 0, 0, EnumSymbol.ASPHYXIANT, "hbmfluid.xenon"),
BALEFIRE (0x28e02e, 6, 1, 2, 4, 4, 3, EnumSymbol.RADIATION, "hbmfluid.balefire", true, true, false),
BALEFIRE (0x28e02e, 6, 1, 2, 4, 4, 3, EnumSymbol.RADIATION, "hbmfluid.balefire", true, true, false, 1500),
MERCURY (0x808080, 7, 1, 2, 2, 0, 0, EnumSymbol.NONE, "hbmfluid.mercury"),
PLASMA_DT (0xF7AFDE, 8, 1, 2, 0, 4, 0, EnumSymbol.RADIATION, "hbmfluid.plasma_dt", true, false, true),
PLASMA_HD (0xF0ADF4, 9, 1, 2, 0, 4, 0, EnumSymbol.RADIATION, "hbmfluid.plasma_hd", true, false, true),
PLASMA_HT (0xD1ABF2, 10, 1, 2, 0, 4, 0, EnumSymbol.RADIATION, "hbmfluid.plasma_ht", true, false, true),
PLASMA_XM (0xC6A5FF, 11, 1, 2, 0, 4, 1, EnumSymbol.RADIATION, "hbmfluid.plasma_xm", true, false, true),
PLASMA_BF (0xA7F1A3, 12, 1, 2, 4, 5, 4, EnumSymbol.ANTIMATTER, "hbmfluid.plasma_bf", true, false, true);
PLASMA_DT (0xF7AFDE, 8, 1, 2, 0, 4, 0, EnumSymbol.RADIATION, "hbmfluid.plasma_dt", true, false, true, 3250),
PLASMA_HD (0xF0ADF4, 9, 1, 2, 0, 4, 0, EnumSymbol.RADIATION, "hbmfluid.plasma_hd", true, false, true, 2500),
PLASMA_HT (0xD1ABF2, 10, 1, 2, 0, 4, 0, EnumSymbol.RADIATION, "hbmfluid.plasma_ht", true, false, true, 3000),
PLASMA_XM (0xC6A5FF, 11, 1, 2, 0, 4, 1, EnumSymbol.RADIATION, "hbmfluid.plasma_xm", true, false, true, 4250),
PLASMA_BF (0xA7F1A3, 12, 1, 2, 4, 5, 4, EnumSymbol.ANTIMATTER, "hbmfluid.plasma_bf", true, false, true, 8500);
//Approximate HEX Color of the fluid, used for pipe rendering
@ -94,6 +94,7 @@ public class FluidTypeHandler {
public int flammability;
public int reactivity;
public EnumSymbol symbol;
public int temperature;
private FluidType(int color, int x, int y, int sheet, int p, int f, int r, EnumSymbol symbol, String name) {
this.color = color;
@ -105,6 +106,7 @@ public class FluidTypeHandler {
this.flammability = f;
this.reactivity = r;
this.symbol = symbol;
this.temperature = 0;
}
private FluidType(int color, int x, int y, int sheet, int p, int f, int r, EnumSymbol symbol, String name, boolean hot, boolean corrosive, boolean antimatter) {
@ -120,6 +122,12 @@ public class FluidTypeHandler {
this.hot = hot;
this.corrosive = corrosive;
this.antimatter = antimatter;
this.temperature = 0;
}
private FluidType(int color, int x, int y, int sheet, int p, int f, int r, EnumSymbol symbol, String name, boolean hot, boolean corrosive, boolean antimatter, int temperature) {
this(color, x, y, sheet, p, f, r, symbol, name, hot, corrosive, antimatter);
this.temperature = temperature;
}
public int getColor() {

View File

@ -887,6 +887,15 @@ public class GUIHandler implements IGuiHandler {
}
return null;
}
case ModBlocks.guiID_plasma_heater:
{
if(entity instanceof TileEntityMachinePlasmaHeater)
{
return new ContainerPlasmaHeater(player.inventory, (TileEntityMachinePlasmaHeater) entity);
}
return null;
}
}
} else {
//NON-TE CONTAINERS
@ -1773,6 +1782,15 @@ public class GUIHandler implements IGuiHandler {
}
return null;
}
case ModBlocks.guiID_plasma_heater:
{
if(entity instanceof TileEntityMachinePlasmaHeater)
{
return new GUIPlasmaHeater(player.inventory, (TileEntityMachinePlasmaHeater) entity);
}
return null;
}
}
} else {
//ITEM GUIS

View File

@ -11,12 +11,14 @@ import com.hbm.items.machine.ItemFluidIdentifier;
import com.hbm.lib.RefStrings;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.TEFluidPacket;
import com.hbm.tileentity.machine.TileEntityITER;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
public class FluidTank {
@ -221,8 +223,13 @@ public class FluidTank {
}
public void renderTankInfo(GuiInfoContainer gui, int mouseX, int mouseY, int x, int y, int width, int height) {
if(x <= mouseX && x + width > mouseX && y < mouseY && y + height >= mouseY)
gui.drawFluidInfo(new String[] { I18n.format(this.type.getUnlocalizedName()), fluid + "/" + maxFluid + "mB" }, mouseX, mouseY);
if(x <= mouseX && x + width > mouseX && y < mouseY && y + height >= mouseY) {
if(type.temperature == 0)
gui.drawFluidInfo(new String[] { I18n.format(this.type.getUnlocalizedName()), fluid + "/" + maxFluid + "mB" }, mouseX, mouseY);
else
gui.drawFluidInfo(new String[] { I18n.format(this.type.getUnlocalizedName()), fluid + "/" + maxFluid + "mB", EnumChatFormatting.RED + "" + type.temperature + "°C" }, mouseX, mouseY);
}
}
public ResourceLocation getSheet() {

View File

@ -0,0 +1,79 @@
package com.hbm.inventory.container;
import com.hbm.inventory.SlotMachineOutput;
import com.hbm.tileentity.machine.TileEntityMachinePlasmaHeater;
import com.hbm.tileentity.machine.TileEntityMicrowave;
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 SlotMachineOutput(tedf, 2, 44, 53));
this.addSlotToContainer(new Slot(tedf, 3, 152, 17));
this.addSlotToContainer(new SlotMachineOutput(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

@ -72,8 +72,8 @@ public class GUIITER extends GuiInfoContainer {
}
Minecraft.getMinecraft().getTextureManager().bindTexture(iter.plasma.getSheet());
iter.plasma.renderTank(this, guiLeft + 71, guiTop + 88, iter.plasma.getTankType().textureX() * FluidTank.x, iter.plasma.getTankType().textureY() * FluidTank.y, 16, 52);
iter.plasma.renderTank(this, guiLeft + 71 + 16, guiTop + 88, iter.plasma.getTankType().textureX() * FluidTank.x, iter.plasma.getTankType().textureY() * FluidTank.y, 16, 52);
iter.plasma.renderTank(this, guiLeft + 71 + 32, guiTop + 88, iter.plasma.getTankType().textureX() * FluidTank.x, iter.plasma.getTankType().textureY() * FluidTank.y, 2, 52);
iter.plasma.renderTank(this, guiLeft + 71, guiTop + 88, iter.plasma.getTankType().textureX() * FluidTank.x, iter.plasma.getTankType().textureY() * FluidTank.y, 16, 34);
iter.plasma.renderTank(this, guiLeft + 71 + 16, guiTop + 88, iter.plasma.getTankType().textureX() * FluidTank.x, iter.plasma.getTankType().textureY() * FluidTank.y, 16, 34);
iter.plasma.renderTank(this, guiLeft + 71 + 32, guiTop + 88, iter.plasma.getTankType().textureX() * FluidTank.x, iter.plasma.getTankType().textureY() * FluidTank.y, 2, 34);
}
}

View File

@ -0,0 +1,66 @@
package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.FluidTank;
import com.hbm.inventory.container.ContainerMicrowave;
import com.hbm.inventory.container.ContainerPlasmaHeater;
import com.hbm.lib.RefStrings;
import com.hbm.packet.AuxButtonPacket;
import com.hbm.packet.PacketDispatcher;
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);
Minecraft.getMinecraft().getTextureManager().bindTexture(microwave.tanks[0].getSheet());
microwave.tanks[0].renderTank(this, guiLeft + 62, guiTop + 69, microwave.tanks[0].getTankType().textureX() * FluidTank.x, microwave.tanks[0].getTankType().textureY() * FluidTank.y, 16, 52);
Minecraft.getMinecraft().getTextureManager().bindTexture(microwave.tanks[1].getSheet());
microwave.tanks[1].renderTank(this, guiLeft + 134, guiTop + 69, microwave.tanks[1].getTankType().textureX() * FluidTank.x, microwave.tanks[1].getTankType().textureY() * FluidTank.y, 16, 52);
Minecraft.getMinecraft().getTextureManager().bindTexture(microwave.plasma.getSheet());
microwave.plasma.renderTank(this, guiLeft + 98, guiTop + 69, microwave.plasma.getTankType().textureX() * FluidTank.x, microwave.plasma.getTankType().textureY() * FluidTank.y, 16, 52);
}
}

View File

@ -28,6 +28,8 @@ import com.hbm.entity.item.EntityMovingItem;
import com.hbm.entity.logic.*;
import com.hbm.entity.missile.*;
import com.hbm.entity.mob.*;
import com.hbm.entity.mob.botprime.EntityBOTPrimeBody;
import com.hbm.entity.mob.botprime.EntityBOTPrimeHead;
import com.hbm.entity.mob.sodtekhnologiyah.EntityBallsOTronSegment;
import com.hbm.entity.particle.*;
import com.hbm.entity.projectile.*;
@ -430,6 +432,8 @@ public class ClientProxy extends ServerProxy {
RenderingRegistry.registerEntityRenderingHandler(EntityTaintCrab.class, new RenderTaintCrab());
RenderingRegistry.registerEntityRenderingHandler(EntityMaskMan.class, new RenderMaskMan());
RenderingRegistry.registerEntityRenderingHandler(EntityBallsOTronSegment.class, new RenderBalls());
RenderingRegistry.registerEntityRenderingHandler(EntityBOTPrimeHead.class, new RenderWormHead());
RenderingRegistry.registerEntityRenderingHandler(EntityBOTPrimeBody.class, new RenderWormBody());
//"particles"
RenderingRegistry.registerEntityRenderingHandler(EntitySmokeFX.class, new MultiCloudRenderer(new Item[] { ModItems.smoke1, ModItems.smoke2, ModItems.smoke3, ModItems.smoke4, ModItems.smoke5, ModItems.smoke6, ModItems.smoke7, ModItems.smoke8 }));
RenderingRegistry.registerEntityRenderingHandler(EntityBSmokeFX.class, new MultiCloudRenderer(new Item[] { ModItems.b_smoke1, ModItems.b_smoke2, ModItems.b_smoke3, ModItems.b_smoke4, ModItems.b_smoke5, ModItems.b_smoke6, ModItems.b_smoke7, ModItems.b_smoke8 }));

View File

@ -41,6 +41,8 @@ import com.hbm.entity.item.EntityMovingItem;
import com.hbm.entity.logic.*;
import com.hbm.entity.missile.*;
import com.hbm.entity.mob.*;
import com.hbm.entity.mob.botprime.EntityBOTPrimeBody;
import com.hbm.entity.mob.botprime.EntityBOTPrimeHead;
import com.hbm.entity.mob.sodtekhnologiyah.*;
import com.hbm.entity.particle.*;
import com.hbm.entity.projectile.*;
@ -102,18 +104,13 @@ public class MainRegistry {
public static ToolMaterial enumToolMaterialBat = EnumHelper.addToolMaterial("BAT", 0, 500, 1.5F, 3F, 25);
public static ToolMaterial enumToolMaterialBatNail = EnumHelper.addToolMaterial("BATNAIL", 0, 450, 1.0F, 4F, 25);
public static ToolMaterial enumToolMaterialGolfClub = EnumHelper.addToolMaterial("GOLFCLUB", 1, 1000, 2.0F, 5F, 25);
public static ToolMaterial enumToolMaterialPipeRusty = EnumHelper.addToolMaterial("PIPERUSTY", 1, 350, 1.5F, 4.5F,
25);
public static ToolMaterial enumToolMaterialPipeLead = EnumHelper.addToolMaterial("PIPELEAD", 1, 250, 1.5F, 5.5F,
25);
public static ToolMaterial enumToolMaterialPipeRusty = EnumHelper.addToolMaterial("PIPERUSTY", 1, 350, 1.5F, 4.5F, 25);
public static ToolMaterial enumToolMaterialPipeLead = EnumHelper.addToolMaterial("PIPELEAD", 1, 250, 1.5F, 5.5F, 25);
public static ToolMaterial enumToolMaterialBottleOpener = EnumHelper.addToolMaterial("OPENER", 1, 250, 1.5F, 0.5F,
200);
public static ToolMaterial enumToolMaterialSledge = EnumHelper.addToolMaterial("SHIMMERSLEDGE", 1, 0, 25.0F, 26F,
200);
public static ToolMaterial enumToolMaterialBottleOpener = EnumHelper.addToolMaterial("OPENER", 1, 250, 1.5F, 0.5F, 200);
public static ToolMaterial enumToolMaterialSledge = EnumHelper.addToolMaterial("SHIMMERSLEDGE", 1, 0, 25.0F, 26F, 200);
public static ToolMaterial enumToolMaterialMultitool = EnumHelper.addToolMaterial("MULTITOOL", 3, 5000, 25F, 5.5F,
25);
public static ToolMaterial enumToolMaterialMultitool = EnumHelper.addToolMaterial("MULTITOOL", 3, 5000, 25F, 5.5F, 25);
// Armor Materials
public static ArmorMaterial enumArmorMaterialEmerald = EnumHelper.addArmorMaterial("HBM_TEST", 2500,
@ -702,8 +699,8 @@ public class MainRegistry {
EntityRegistry.registerGlobalEntityID(EntityTaintCrab.class, "entity_taint_crab", EntityRegistry.findGlobalUniqueEntityId(), 0xAAAAAA, 0xFF00FF);
EntityRegistry.registerGlobalEntityID(EntityMaskMan.class, "entity_mob_mask_man", EntityRegistry.findGlobalUniqueEntityId(), 0x818572, 0xC7C1B7);
EntityRegistry.registerGlobalEntityID(EntityBallsOTronHead.class, "entity_balls_o_tron_mk0", EntityRegistry.findGlobalUniqueEntityId(), 0xAAAAAA, 0xAAAAAA);
EntityRegistry.registerModEntity(EntityBallsOTronSegment.class, "entity_balls_o_tron_mk0_segfault", 148, this, 1000, 1, true);
EntityRegistry.registerGlobalEntityID(EntityBOTPrimeHead.class, "entity_balls_o_tron_mk0", EntityRegistry.findGlobalUniqueEntityId(), 0xAAAAAA, 0xAAAAAA);
EntityRegistry.registerModEntity(EntityBOTPrimeBody.class, "entity_balls_o_tron_mk0_segfault", 148, this, 1000, 1, true);
ForgeChunkManager.setForcedChunkLoadingCallback(this, new LoadingCallback() {

View File

@ -0,0 +1,40 @@
package com.hbm.render.entity.mob;
import org.lwjgl.opengl.GL11;
import com.hbm.lib.RefStrings;
import com.hbm.main.ResourceManager;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
public class RenderWormBody extends Render {
public RenderWormBody() {
this.shadowOpaque = 0.0F;
}
public static final IModelCustom body = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/mobs/bot_prime_body.obj"));
@Override
public void doRender(Entity entity, double x, double y, double z, float f0, float f1) {
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * f1 - 90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * f1 - 90, 0.0F, 0.0F, 1.0F);
this.bindEntityTexture(entity);
body.renderAll();
GL11.glPopMatrix();
}
@Override
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
return ResourceManager.universal;
}
}

View File

@ -0,0 +1,30 @@
package com.hbm.render.entity.mob;
import com.hbm.entity.mob.botprime.EntityBOTPrimeHead;
import com.hbm.main.ResourceManager;
import com.hbm.render.model.ModelWormHead;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.entity.boss.BossStatus;
import net.minecraft.util.ResourceLocation;
public class RenderWormHead extends RenderLiving {
public RenderWormHead() {
super(new ModelWormHead(), 1.0F);
this.shadowOpaque = 0.0F;
}
@Override
public void doRender(Entity entity, double x, double y, double z, float f0, float f1) {
BossStatus.setBossStatus((EntityBOTPrimeHead)entity, true);
super.doRender(entity, x, y, z, f0, f1);
}
@Override
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
return ResourceManager.universal;
}
}

View File

@ -0,0 +1,28 @@
package com.hbm.render.model;
import org.lwjgl.opengl.GL11;
import com.hbm.lib.RefStrings;
import net.minecraft.client.model.ModelBase;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
public class ModelWormHead extends ModelBase {
public static final IModelCustom head = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/mobs/bot_prime_head.obj"));
@Override
public void render(Entity entity, float x, float y, float z, float f3, float f4, float f5) {
super.render(entity, x, y, z, f3, f4, f5);
GL11.glTranslated(x, y, z);
GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * f5 - 90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * f5 - 90, 0.0F, 0.0F, 1.0F);
head.renderAll();
}
}

View File

@ -12,6 +12,8 @@ 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();
@ -38,32 +40,35 @@ public class RenderITER extends TileEntitySpecialRenderer {
ResourceManager.iter.renderPart("Solenoid");
GL11.glPopMatrix();
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 = ((TileEntityITER)te).plasma.getTankType().getColor();
int r = ((color & 0xFF0000) >> 16) / 2;
int g = ((color & 0xFF00) >> 8) / 2;
int b = (color & 0xFF) / 2;
GL11.glColor3b((byte) r, (byte) g, (byte) b);
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();
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);
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);

View File

@ -3,17 +3,24 @@ package com.hbm.tileentity.machine;
import java.util.ArrayList;
import java.util.List;
import com.hbm.blocks.ModBlocks;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.interfaces.IConsumer;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.interfaces.IFluidSource;
import com.hbm.inventory.FluidTank;
import com.hbm.items.special.ItemFusionShield;
import com.hbm.lib.Library;
import com.hbm.tileentity.TileEntityMachineBase;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.Vec3;
public class TileEntityITER extends TileEntityMachineBase implements IConsumer, IFluidAcceptor, IFluidSource {
@ -23,13 +30,17 @@ public class TileEntityITER extends TileEntityMachineBase implements IConsumer,
public List<IFluidAcceptor> list = new ArrayList();
public FluidTank[] tanks;
public FluidTank plasma;
public float rotor;
public float lastRotor;
public boolean isOn;
public TileEntityITER() {
super(5);
tanks = new FluidTank[2];
tanks[0] = new FluidTank(FluidType.WATER, 128000, 0);
tanks[1] = new FluidTank(FluidType.ULTRAHOTSTEAM, 128000, 0);
plasma = new FluidTank(FluidType.PLASMA_DT, 16000, 0);
tanks[1] = new FluidTank(FluidType.ULTRAHOTSTEAM, 128000, 1);
plasma = new FluidTank(FluidType.PLASMA_DT, 16000, 2);
}
@Override
@ -49,6 +60,24 @@ public class TileEntityITER extends TileEntityMachineBase implements IConsumer,
if (age == 9 || age == 19)
fillFluidInit(tanks[1].getTankType());
/// START Processing part ///
if(plasma.getFill() > 0 && this.plasma.getTankType().temperature >= this.getShield()) {
this.disassemble();
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);
}
/// END Processing part ///
/// START Notif packets ///
for(int i = 0; i < tanks.length; i++)
tanks[i].updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
plasma.updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
/// END Notif packets ///
}
}
@ -71,6 +100,9 @@ public class TileEntityITER extends TileEntityMachineBase implements IConsumer,
public void setFillstate(int fill, int index) {
if (index < 2 && tanks[index] != null)
tanks[index].setFill(fill);
if(index == 2)
plasma.setFill(fill);
}
@Override
@ -79,12 +111,17 @@ public class TileEntityITER extends TileEntityMachineBase implements IConsumer,
tanks[0].setFill(i);
else if (type.name().equals(tanks[1].getTankType().name()))
tanks[1].setFill(i);
else if (type.name().equals(plasma.getTankType().name()))
plasma.setFill(i);
}
@Override
public void setType(FluidType type, int index) {
if (index < 2 && tanks[index] != null)
tanks[index].setTankType(type);
if(index == 2)
plasma.setTankType(type);
}
@Override
@ -92,6 +129,7 @@ public class TileEntityITER extends TileEntityMachineBase implements IConsumer,
List<FluidTank> list = new ArrayList();
list.add(tanks[0]);
list.add(tanks[1]);
list.add(plasma);
return list;
}
@ -102,8 +140,8 @@ public class TileEntityITER extends TileEntityMachineBase implements IConsumer,
return tanks[0].getFill();
else if (type.name().equals(tanks[1].getTankType().name()))
return tanks[1].getFill();
else if (type.name().equals(tanks[2].getTankType().name()))
return tanks[2].getFill();
else if (type.name().equals(plasma.getTankType().name()))
return plasma.getFill();
else
return 0;
}
@ -142,10 +180,32 @@ public class TileEntityITER extends TileEntityMachineBase implements IConsumer,
public int getMaxFluidFill(FluidType type) {
if (type.name().equals(tanks[0].getTankType().name()))
return tanks[0].getMaxFill();
else if (type.name().equals(tanks[1].getTankType().name()))
return tanks[1].getMaxFill();
else if (type.name().equals(plasma.getTankType().name()))
return plasma.getMaxFill();
else
return 0;
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
tanks[0].readFromNBT(nbt, "water");
tanks[1].readFromNBT(nbt, "steam");
plasma.readFromNBT(nbt, "plasma");
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
tanks[0].writeToNBT(nbt, "water");
tanks[1].writeToNBT(nbt, "steam");
plasma.writeToNBT(nbt, "plasma");
}
AxisAlignedBB bb = null;
@Override
@ -170,4 +230,42 @@ public class TileEntityITER extends TileEntityMachineBase implements IConsumer,
public double getMaxRenderDistanceSquared() {
return 65536.0D;
}
public int getShield() {
if(slots[3] == null || !(slots[3].getItem() instanceof ItemFusionShield))
return 273;
return ((ItemFusionShield)slots[3].getItem()).maxTemp;
}
public void disassemble() {
int[][][] layout = TileEntityITERStruct.layout;
for(int y = 0; y < 5; y++) {
for(int x = 0; x < layout[0].length; x++) {
for(int z = 0; z < layout[0][0].length; z++) {
int ly = y > 2 ? 4 - y : y;
int width = 7;
if(x == width && y == 0 && z == width)
continue;
int b = layout[ly][x][z];
switch(b) {
case 1: worldObj.setBlock(xCoord - width + x, yCoord + y - 2, zCoord - width + z, ModBlocks.fusion_conductor); break;
case 2: worldObj.setBlock(xCoord - width + x, yCoord + y - 2, zCoord - width + z, ModBlocks.fusion_center); break;
case 3: worldObj.setBlock(xCoord - width + x, yCoord + y - 2, zCoord - width + z, ModBlocks.fusion_motor); break;
case 4: worldObj.setBlock(xCoord - width + x, yCoord + y - 2, zCoord - width + z, ModBlocks.reinforced_glass); break;
}
}
}
}
worldObj.setBlock(xCoord, yCoord - 2, zCoord, ModBlocks.struct_iter_core);
}
}

View File

@ -1,11 +1,39 @@
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.handler.FluidTypeHandler.FluidType;
import com.hbm.interfaces.IConsumer;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.inventory.FluidTank;
import com.hbm.lib.Library;
import com.hbm.tileentity.TileEntityMachineBase;
public class TileEntityMachinePlasmaHeater extends TileEntityMachineBase {
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityMachinePlasmaHeater extends TileEntityMachineBase implements IFluidAcceptor, IConsumer {
public static 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(FluidType.DEUTERIUM, 16000, 0);
tanks[1] = new FluidTank(FluidType.TRITIUM, 16000, 1);
plasma = new FluidTank(FluidType.PLASMA_DT, 64000, 2);
}
@Override
@ -16,6 +44,213 @@ public class TileEntityMachinePlasmaHeater extends TileEntityMachineBase {
@Override
public void updateEntity() {
if(!worldObj.isRemote) {
/// 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);
tanks[0].setFill(tanks[0].getFill() - convert);
tanks[1].setFill(tanks[1].getFill() - convert);
plasma.setFill(plasma.getFill() + convert * 2);
power -= convert * powerReq;
if(convert > 0)
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() != FluidType.NONE) {
iter.plasma.setTankType(this.plasma.getTankType());
}
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 ///
for(int i = 0; i < tanks.length; i++)
tanks[i].updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
plasma.updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
/// END Notif packets ///
}
}
private void updateType() {
if(plasma.getFill() > 0)
return;
List<FluidType> types = new ArrayList() {{ add(tanks[0].getTankType()); add(tanks[1].getTankType()); }};
if(types.contains(FluidType.DEUTERIUM) && types.contains(FluidType.TRITIUM)) {
plasma.setTankType(FluidType.PLASMA_DT);
return;
}
if(types.contains(FluidType.DEUTERIUM) && types.contains(FluidType.HYDROGEN)) {
plasma.setTankType(FluidType.PLASMA_HD);
return;
}
if(types.contains(FluidType.HYDROGEN) && types.contains(FluidType.TRITIUM)) {
plasma.setTankType(FluidType.PLASMA_HT);
return;
}
if(types.contains(FluidType.XENON) && types.contains(FluidType.MERCURY)) {
plasma.setTankType(FluidType.PLASMA_XM);
return;
}
if(types.contains(FluidType.BALEFIRE) && types.contains(FluidType.AMAT)) {
plasma.setTankType(FluidType.PLASMA_BF);
return;
}
plasma.setTankType(FluidType.NONE);
}
public long getPowerScaled(int i) {
return (power * i) / maxPower;
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
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);
tanks[0].writeToNBT(nbt, "fuel_1");
tanks[1].writeToNBT(nbt, "fuel_2");
plasma.writeToNBT(nbt, "plasma");
}
@Override
public AxisAlignedBB getRenderBoundingBox() {
return TileEntity.INFINITE_EXTENT_AABB;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared()
{
return 65536.0D;
}
@Override
public int getMaxFluidFill(FluidType type) {
if (type.name().equals(tanks[0].getTankType().name()))
return tanks[0].getMaxFill();
else if (type.name().equals(tanks[1].getTankType().name()))
return tanks[1].getMaxFill();
else if (type.name().equals(plasma.getTankType().name()))
return plasma.getMaxFill();
else
return 0;
}
@Override
public void setFluidFill(int i, FluidType type) {
if (type.name().equals(tanks[0].getTankType().name()))
tanks[0].setFill(i);
else if (type.name().equals(tanks[1].getTankType().name()))
tanks[1].setFill(i);
else if (type.name().equals(plasma.getTankType().name()))
plasma.setFill(i);
}
@Override
public int getFluidFill(FluidType type) {
if (type.name().equals(tanks[0].getTankType().name()))
return tanks[0].getFill();
else if (type.name().equals(tanks[1].getTankType().name()))
return tanks[1].getFill();
else if (type.name().equals(plasma.getTankType().name()))
return plasma.getFill();
else
return 0;
}
@Override
public void setFillstate(int fill, int index) {
if (index < 2 && tanks[index] != null)
tanks[index].setFill(fill);
if(index == 2)
plasma.setFill(fill);
}
@Override
public void setType(FluidType type, int index) {
if (index < 2 && tanks[index] != null)
tanks[index].setTankType(type);
if(index == 2)
plasma.setTankType(type);
}
@Override
public List<FluidTank> getTanks() {
List<FluidTank> list = new ArrayList();
list.add(tanks[0]);
list.add(tanks[1]);
list.add(plasma);
return list;
}
@Override
public void setPower(long i) {
this.power = i;
}
@Override
public long getPower() {
return power;
}
@Override
public long getMaxPower() {
return maxPower;
}
}