mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
improved 256k tank explodability, fixed scaffolds
This commit is contained in:
parent
9bcb388d92
commit
d6e91eca9c
@ -2823,7 +2823,7 @@ public class ModBlocks {
|
|||||||
GameRegistry.registerBlock(steel_corner, steel_corner.getUnlocalizedName());
|
GameRegistry.registerBlock(steel_corner, steel_corner.getUnlocalizedName());
|
||||||
GameRegistry.registerBlock(steel_roof, steel_roof.getUnlocalizedName());
|
GameRegistry.registerBlock(steel_roof, steel_roof.getUnlocalizedName());
|
||||||
GameRegistry.registerBlock(steel_beam, steel_beam.getUnlocalizedName());
|
GameRegistry.registerBlock(steel_beam, steel_beam.getUnlocalizedName());
|
||||||
GameRegistry.registerBlock(steel_scaffold, steel_scaffold.getUnlocalizedName());
|
register(steel_scaffold);
|
||||||
GameRegistry.registerBlock(steel_grate, steel_grate.getUnlocalizedName());
|
GameRegistry.registerBlock(steel_grate, steel_grate.getUnlocalizedName());
|
||||||
GameRegistry.registerBlock(deco_pipe, ItemBlockBase.class, deco_pipe.getUnlocalizedName());
|
GameRegistry.registerBlock(deco_pipe, ItemBlockBase.class, deco_pipe.getUnlocalizedName());
|
||||||
GameRegistry.registerBlock(deco_pipe_rusted, ItemBlockBase.class, deco_pipe_rusted.getUnlocalizedName());
|
GameRegistry.registerBlock(deco_pipe_rusted, ItemBlockBase.class, deco_pipe_rusted.getUnlocalizedName());
|
||||||
|
|||||||
@ -11,8 +11,10 @@ import net.minecraft.block.material.Material;
|
|||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockScaffold extends BlockMulti {
|
public class BlockScaffold extends BlockMulti {
|
||||||
@ -31,6 +33,16 @@ public class BlockScaffold extends BlockMulti {
|
|||||||
return renderIDScaffold;
|
return renderIDScaffold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOpaqueCube() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean renderAsNormalBlock() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister reg) {
|
public void registerBlockIcons(IIconRegister reg) {
|
||||||
@ -69,4 +81,29 @@ public class BlockScaffold extends BlockMulti {
|
|||||||
public int getSubCount() {
|
public int getSubCount() {
|
||||||
return variants.length;
|
return variants.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) {
|
||||||
|
int te = p_149719_1_.getBlockMetadata(p_149719_2_, p_149719_3_, p_149719_4_);
|
||||||
|
float f = 0.0625F;
|
||||||
|
|
||||||
|
if((te & 8) != 0)
|
||||||
|
this.setBlockBounds(2 * f, 0.0F, 0.0F, 14 * f, 1.0F, 1.0F);
|
||||||
|
else
|
||||||
|
this.setBlockBounds(0.0F, 0.0F, 2 * f, 1.0F, 1.0F, 14 * f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||||
|
|
||||||
|
int te = world.getBlockMetadata(x, y, z);
|
||||||
|
float f = 0.0625F;
|
||||||
|
|
||||||
|
if((te & 8) != 0)
|
||||||
|
this.setBlockBounds(2 * f, 0.0F, 0.0F, 14 * f, 1.0F, 1.0F);
|
||||||
|
else
|
||||||
|
this.setBlockBounds(0.0F, 0.0F, 2 * f, 1.0F, 1.0F, 14 * f);
|
||||||
|
|
||||||
|
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,11 +14,13 @@ import com.hbm.util.I18nUtil;
|
|||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.stats.StatList;
|
import net.minecraft.stats.StatList;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
|
import net.minecraft.world.Explosion;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
@ -85,8 +87,32 @@ public class MachineFluidTank extends BlockDummyable implements IPersistentInfoP
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(ItemStack stack, NBTTagCompound persistentTag, EntityPlayer player, List list, boolean ext) {
|
public void addInformation(ItemStack stack, NBTTagCompound persistentTag, EntityPlayer player, List list, boolean ext) {
|
||||||
FluidTank tank = new FluidTank(Fluids.NONE, 0, 0);
|
FluidTank tank = new FluidTank(Fluids.NONE, 0);
|
||||||
tank.readFromNBT(persistentTag, "tank");
|
tank.readFromNBT(persistentTag, "tank");
|
||||||
list.add(EnumChatFormatting.YELLOW + "" + tank.getFill() + "/" + tank.getMaxFill() + "mB " + I18nUtil.resolveKey(tank.getTankType().getUnlocalizedName()));
|
list.add(EnumChatFormatting.YELLOW + "" + tank.getFill() + "/" + tank.getMaxFill() + "mB " + I18nUtil.resolveKey(tank.getTankType().getUnlocalizedName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canDropFromExplosion(Explosion explosion) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) {
|
||||||
|
|
||||||
|
int[] pos = this.findCore(world, x, y, z);
|
||||||
|
if(pos == null) return;
|
||||||
|
TileEntity core = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||||
|
if(!(core instanceof TileEntityMachineFluidTank)) return;
|
||||||
|
|
||||||
|
TileEntityMachineFluidTank tank = (TileEntityMachineFluidTank) core;
|
||||||
|
if(tank.lastExplosion == explosion) return;
|
||||||
|
tank.lastExplosion = explosion;
|
||||||
|
|
||||||
|
if(!tank.hasExploded) {
|
||||||
|
tank.explode();
|
||||||
|
} else {
|
||||||
|
world.setBlock(pos[0], pos[1], pos[2], Blocks.air);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -198,6 +198,7 @@ public class HazardRegistry {
|
|||||||
HazardSystem.register(trinitite, makeData(RADIATION, trn * ingot));
|
HazardSystem.register(trinitite, makeData(RADIATION, trn * ingot));
|
||||||
HazardSystem.register(block_trinitite, makeData(RADIATION, trn * block));
|
HazardSystem.register(block_trinitite, makeData(RADIATION, trn * block));
|
||||||
HazardSystem.register(nuclear_waste, makeData(RADIATION, wst * ingot));
|
HazardSystem.register(nuclear_waste, makeData(RADIATION, wst * ingot));
|
||||||
|
HazardSystem.register(yellow_barrel, makeData(RADIATION, wst * ingot * 10));
|
||||||
HazardSystem.register(billet_nuclear_waste, makeData(RADIATION, wst * billet));
|
HazardSystem.register(billet_nuclear_waste, makeData(RADIATION, wst * billet));
|
||||||
HazardSystem.register(nuclear_waste_tiny, makeData(RADIATION, wst * nugget));
|
HazardSystem.register(nuclear_waste_tiny, makeData(RADIATION, wst * nugget));
|
||||||
HazardSystem.register(nuclear_waste_vitrified, makeData(RADIATION, wstv * ingot));
|
HazardSystem.register(nuclear_waste_vitrified, makeData(RADIATION, wstv * ingot));
|
||||||
|
|||||||
@ -15,7 +15,7 @@ public class SlotNonRetarded extends Slot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dear mojang: Why wasn't that the standard to begin with? What do IInventories have isItemValidForSlot when by default nothing fucking uses it?
|
* Dear mojang: Why wasn't that the standard to begin with? What do IInventories have isItemValidForSlot for when by default nothing fucking uses it?
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValid(ItemStack stack) {
|
public boolean isItemValid(ItemStack stack) {
|
||||||
|
|||||||
@ -21,7 +21,7 @@ public class RenderScaffoldBlock implements ISimpleBlockRenderingHandler {
|
|||||||
|
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
Tessellator tessellator = Tessellator.instance;
|
Tessellator tessellator = Tessellator.instance;
|
||||||
IIcon iicon = block.getIcon(0, 0);
|
IIcon iicon = block.getIcon(0, metadata);
|
||||||
tessellator.setColorOpaque_F(1, 1, 1);
|
tessellator.setColorOpaque_F(1, 1, 1);
|
||||||
|
|
||||||
if(renderer.hasOverrideBlockTexture()) {
|
if(renderer.hasOverrideBlockTexture()) {
|
||||||
@ -51,7 +51,7 @@ public class RenderScaffoldBlock implements ISimpleBlockRenderingHandler {
|
|||||||
|
|
||||||
float rotation = (float) -Math.PI;
|
float rotation = (float) -Math.PI;
|
||||||
|
|
||||||
if((world.getBlockMetadata(x, y, z) & 8) != 0)
|
if((world.getBlockMetadata(x, y, z) & 8) == 0)
|
||||||
rotation = -90F / 180F * (float) Math.PI;
|
rotation = -90F / 180F * (float) Math.PI;
|
||||||
|
|
||||||
tessellator.addTranslation(x + 0.5F, y, z + 0.5F);
|
tessellator.addTranslation(x + 0.5F, y, z + 0.5F);
|
||||||
|
|||||||
@ -40,6 +40,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
import net.minecraft.world.Explosion;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
@ -50,6 +51,8 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
|
|||||||
public static final short modes = 4;
|
public static final short modes = 4;
|
||||||
public boolean hasExploded = false;
|
public boolean hasExploded = false;
|
||||||
|
|
||||||
|
public Explosion lastExplosion = null;
|
||||||
|
|
||||||
public int age = 0;
|
public int age = 0;
|
||||||
public List<IFluidAcceptor> list = new ArrayList();
|
public List<IFluidAcceptor> list = new ArrayList();
|
||||||
|
|
||||||
@ -102,13 +105,12 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
|
|||||||
if(tank.getFill() > 0) {
|
if(tank.getFill() > 0) {
|
||||||
if(tank.getTankType().isAntimatter()) {
|
if(tank.getTankType().isAntimatter()) {
|
||||||
worldObj.newExplosion(null, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 5, true, false);
|
worldObj.newExplosion(null, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 5, true, false);
|
||||||
this.hasExploded = true;
|
this.explode();
|
||||||
this.tank.setFill(0);
|
this.tank.setFill(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tank.getTankType().hasTrait(FT_Corrosive.class) && tank.getTankType().getTrait(FT_Corrosive.class).isHighlyCorrosive()) {
|
if(tank.getTankType().hasTrait(FT_Corrosive.class) && tank.getTankType().getTrait(FT_Corrosive.class).isHighlyCorrosive()) {
|
||||||
this.hasExploded = true;
|
this.explode();
|
||||||
this.tank.setFill(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.hasExploded) {
|
if(this.hasExploded) {
|
||||||
@ -136,6 +138,13 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** called when the tank breaks due to hazardous materials or external force, can be used to quickly void part of the tank or spawn a mushroom cloud */
|
||||||
|
public void explode() {
|
||||||
|
this.hasExploded = true;
|
||||||
|
this.markChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** called every tick post explosion, used for leaking fluid and spawning particles */
|
||||||
public void updateLeak(int amount) {
|
public void updateLeak(int amount) {
|
||||||
if(!hasExploded) return;
|
if(!hasExploded) return;
|
||||||
if(amount <= 0) return;
|
if(amount <= 0) return;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user