a bit of work on the ITER, TE for the trapped brick

This commit is contained in:
Bob 2020-08-23 00:01:28 +02:00
parent 36a03b2d70
commit e829d75b28
9 changed files with 143 additions and 20 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -6,9 +6,7 @@ import com.hbm.blocks.fluid.*;
import com.hbm.blocks.machine.*;
import com.hbm.blocks.network.*;
import com.hbm.blocks.test.*;
import com.hbm.items.block.ItemBlockLore;
import com.hbm.items.block.ItemGlyphBlock;
import com.hbm.items.block.ItemTaintBlock;
import com.hbm.items.block.*;
import com.hbm.items.bomb.ItemPrototypeBlock;
import com.hbm.items.special.ItemOreBlock;
import com.hbm.lib.ModDamageSource;
@ -1640,7 +1638,7 @@ public class ModBlocks {
GameRegistry.registerBlock(brick_jungle, brick_jungle.getUnlocalizedName());
GameRegistry.registerBlock(brick_jungle_cracked, brick_jungle_cracked.getUnlocalizedName());
GameRegistry.registerBlock(brick_jungle_lava, brick_jungle_lava.getUnlocalizedName());
GameRegistry.registerBlock(brick_jungle_trap, brick_jungle_trap.getUnlocalizedName());
GameRegistry.registerBlock(brick_jungle_trap, ItemTrapBlock.class, brick_jungle_trap.getUnlocalizedName());
GameRegistry.registerBlock(brick_jungle_glyph, ItemGlyphBlock.class, brick_jungle_glyph.getUnlocalizedName());
GameRegistry.registerBlock(tape_recorder, tape_recorder.getUnlocalizedName());
GameRegistry.registerBlock(steel_poles, steel_poles.getUnlocalizedName());

View File

@ -1,6 +1,7 @@
package com.hbm.blocks.generic;
import com.hbm.blocks.ModBlocks;
import com.hbm.tileentity.deco.TileEntityTrappedBrick;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@ -20,6 +21,10 @@ public class TrappedBrick extends BlockContainer {
@Override
public TileEntity createNewTileEntity(World world, int meta) {
if(Trap.get(meta).type == TrapType.DETECTOR)
return new TileEntityTrappedBrick();
return null;
}

View File

@ -63,8 +63,15 @@ public class GUIITER extends GuiInfoContainer {
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);
//TODO: progress bars and button
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);
for(int t = 0; t < 2; t++) {
Minecraft.getMinecraft().getTextureManager().bindTexture(iter.tanks[t].getSheet());

View File

@ -9,8 +9,8 @@ import net.minecraft.item.ItemStack;
public class ItemGlyphBlock extends ItemBlock {
public ItemGlyphBlock(Block p_i45328_1_) {
super(p_i45328_1_);
public ItemGlyphBlock(Block block) {
super(block);
this.setMaxDamage(0);
this.setHasSubtypes(true);
}
@ -38,8 +38,8 @@ public class ItemGlyphBlock extends ItemBlock {
}
}
public int getMetadata(int p_77647_1_)
public int getMetadata(int meta)
{
return p_77647_1_;
return meta;
}
}

View File

@ -0,0 +1,45 @@
package com.hbm.items.block;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
public class ItemTrapBlock extends ItemBlock {
public ItemTrapBlock(Block block) {
super(block);
this.setMaxDamage(0);
this.setHasSubtypes(true);
}
@Override
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) {
switch(itemstack.getItemDamage()) {
case 0: list.add("Hourglass"); break;
case 1: list.add("Eye"); break;
case 2: list.add("'Pillar'"); break;
case 3: list.add("IOI"); break;
case 4: list.add("Delta"); break;
case 5: list.add("VTPC"); break;
case 6: list.add("Cool S"); break;
case 7: list.add("Trefoil"); break;
case 8: list.add("Pony"); break;
case 9: list.add("Sparkle"); break;
case 10: list.add("PiP"); break;
case 11: list.add("Triangles"); break;
case 12: list.add("Linux Mint"); break;
case 13: list.add("13"); break;
case 14: list.add("Digamma"); break;
case 15: list.add("Celestial Altar"); break;
}
}
public int getMetadata(int meta)
{
return meta;
}
}

View File

@ -0,0 +1,38 @@
package com.hbm.tileentity.deco;
import com.hbm.blocks.generic.TrappedBrick.Trap;
import com.hbm.blocks.generic.TrappedBrick.TrapType;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
public class TileEntityTrappedBrick extends TileEntity {
AxisAlignedBB detector = null;
@Override
public void updateEntity() {
if(!worldObj.isRemote) {
if(detector == null) {
setDetector();
}
}
}
private void setDetector() {
Trap trap = Trap.get(this.getBlockMetadata());
switch(trap) {
case FALLING_ROCKS: break;
case ARROW: break;
case FLAMING_ARROW: break;
case PILLAR: break;
case POISON_DART: break;
case ZOMBIE: break;
case SPIDERS: break;
}
}
}

View File

@ -25,7 +25,8 @@ import net.minecraft.util.Vec3;
public class TileEntityITER extends TileEntityMachineBase implements IConsumer, IFluidAcceptor, IFluidSource {
public long power;
public static final long maxPower = 1000000000;
public static final long maxPower = 100000000;
public static final int powerReq = 1000000;
public int age = 0;
public List<IFluidAcceptor> list = new ArrayList();
public FluidTank[] tanks;
@ -60,10 +61,17 @@ public class TileEntityITER extends TileEntityMachineBase implements IConsumer,
if (age == 9 || age == 19)
fillFluidInit(tanks[1].getTankType());
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
/// START Processing part ///
if(plasma.getFill() > 0 && this.plasma.getTankType().temperature >= this.getShield()) {
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.disassemble();
Vec3 vec = Vec3.createVectorHelper(5.5, 0, 0);
vec.rotateAroundY(worldObj.rand.nextFloat() * (float)Math.PI * 2F);
@ -78,6 +86,25 @@ public class TileEntityITER extends TileEntityMachineBase implements IConsumer,
tanks[i].updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
plasma.updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
/// END Notif packets ///
NBTTagCompound data = new NBTTagCompound();
data.setBoolean("isOn", isOn);
data.setLong("power", power);
this.networkPack(data, 250);
}
}
@Override
public void networkUnpack(NBTTagCompound data) {
this.isOn = data.getBoolean("isOn");
this.power = data.getLong("power");
}
@Override
public void handleButtonPacket(int value, int meta) {
if(meta == 0) {
this.isOn = !this.isOn;
}
}

View File

@ -84,19 +84,22 @@ public class TileEntityMachinePlasmaHeater extends TileEntityMachineBase impleme
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();
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();
}
}
}
}