summaryrefslogtreecommitdiff
path: root/ihl/explosion/PileTileEntity.java
diff options
context:
space:
mode:
authorFoghrye4 <foghrye4@gmail.com>2017-02-12 20:43:03 +0300
committerFoghrye4 <foghrye4@gmail.com>2017-02-12 20:43:03 +0300
commit5cb4c6e24033cf337812390d99a6817d24d21eab (patch)
tree695789855920199efd4702a7bb3e4bacfe58b9f0 /ihl/explosion/PileTileEntity.java
parent8f22398517206aed21a7fd840f463332429fae35 (diff)
Removed explosion radius limitations. Explosion calculation optimized (reduced memory usage). One more detonator and explosive pack recipe. GT6 recipes for both chemical reactors and cryogenic distiller. Max stack size of muffle furnace is limited to 32. A lot of old features are removed.
Diffstat (limited to 'ihl/explosion/PileTileEntity.java')
-rw-r--r--ihl/explosion/PileTileEntity.java83
1 files changed, 35 insertions, 48 deletions
diff --git a/ihl/explosion/PileTileEntity.java b/ihl/explosion/PileTileEntity.java
index b6046db..67f430a 100644
--- a/ihl/explosion/PileTileEntity.java
+++ b/ihl/explosion/PileTileEntity.java
@@ -11,46 +11,37 @@ import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
-public class PileTileEntity extends TileEntity
-{
+public class PileTileEntity extends TileEntity {
public ItemStack content = new ItemStack(Blocks.sandstone);
private boolean firstTick = true;
-
+
@Override
- public boolean canUpdate()
- {
+ public boolean canUpdate() {
return IC2.platform.isRendering();
}
-
+
@Override
- public void updateEntity()
- {
- if(firstTick && this.content!=null)
- {
- if(this.worldObj.isRemote)
- {
+ public void updateEntity() {
+ if (firstTick && this.content != null) {
+ if (this.worldObj.isRemote) {
IHLMod.proxy.requestTileEntityInitdataFromClientToServer(xCoord, yCoord, zCoord);
- }
- else
- {
+ } else {
checkAndFall();
}
firstTick = false;
}
}
-
- public void setContent(ItemStack other)
- {
- this.content=other;
+
+ public void setContent(ItemStack other) {
+ this.content = other;
}
-
- public boolean checkAndFall()
- {
- Block underblock = this.worldObj.getBlock(xCoord, yCoord-1, zCoord);
- if(underblock.isAir(worldObj, xCoord, yCoord-1, zCoord) || underblock==Blocks.air || underblock.getCollisionBoundingBoxFromPool(worldObj, xCoord, yCoord-1, zCoord)==null)
- {
+
+ public boolean checkAndFall() {
+ Block underblock = this.worldObj.getBlock(xCoord, yCoord - 1, zCoord);
+ if (underblock.isAir(worldObj, xCoord, yCoord - 1, zCoord) || underblock == Blocks.air
+ || underblock.getCollisionBoundingBoxFromPool(worldObj, xCoord, yCoord - 1, zCoord) == null) {
IHLEntityFallingPile fallingPile = new IHLEntityFallingPile(worldObj);
- fallingPile.setPosition(xCoord+0.5d, yCoord+0.5d, zCoord+0.5d);
+ fallingPile.setPosition(xCoord + 0.5d, yCoord + 0.5d, zCoord + 0.5d);
fallingPile.setEntityItemStack(content);
this.worldObj.setBlockToAir(xCoord, yCoord, zCoord);
this.worldObj.spawnEntityInWorld(fallingPile);
@@ -60,32 +51,28 @@ public class PileTileEntity extends TileEntity
}
@Override
- public void readFromNBT(NBTTagCompound nbttagcompound)
- {
- super.readFromNBT(nbttagcompound);
- this.content = ItemStack.loadItemStackFromNBT(nbttagcompound.getCompoundTag("content"));
- }
+ public void readFromNBT(NBTTagCompound nbttagcompound) {
+ super.readFromNBT(nbttagcompound);
+ this.content = ItemStack.loadItemStackFromNBT(nbttagcompound.getCompoundTag("content"));
+ }
- @Override
- public void writeToNBT(NBTTagCompound nbttagcompound)
- {
- super.writeToNBT(nbttagcompound);
- NBTTagCompound contentNBT = new NBTTagCompound();
- this.content.writeToNBT(contentNBT);
- nbttagcompound.setTag("content", contentNBT);
- }
+ @Override
+ public void writeToNBT(NBTTagCompound nbttagcompound) {
+ super.writeToNBT(nbttagcompound);
+ NBTTagCompound contentNBT = new NBTTagCompound();
+ this.content.writeToNBT(contentNBT);
+ nbttagcompound.setTag("content", contentNBT);
+ }
- public void updateBlockRender()
- {
+ public void updateBlockRender() {
Minecraft.getMinecraft().renderGlobal.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
}
-
+
@Override
- public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
- {
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
this.readFromNBT(pkt.func_148857_g());
- Minecraft.getMinecraft().renderGlobal.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
- }
+ if (checkAndFall()) {
+ Minecraft.getMinecraft().renderGlobal.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
+ }
+ }
}
-
-