From 6a3a331a1f6076eaaa663d4893e330f9d2efeaef Mon Sep 17 00:00:00 2001 From: HbmMods Date: Mon, 23 Jul 2018 19:20:07 +0200 Subject: [PATCH] Gun mechanism recipes, small reactor fix --- assets/hbm/lang/de_DE.lang | 7 + assets/hbm/lang/en_US.lang | 7 + assets/hbm/textures/items/mechanism_1.png | Bin 0 -> 281 bytes assets/hbm/textures/items/mechanism_2.png | Bin 0 -> 296 bytes assets/hbm/textures/items/mechanism_3.png | Bin 0 -> 316 bytes assets/hbm/textures/items/mechanism_4.png | Bin 0 -> 296 bytes assets/hbm/textures/items/mechanism_5.png | Bin 0 -> 261 bytes assets/hbm/textures/items/mechanism_6.png | Bin 0 -> 290 bytes assets/hbm/textures/items/mechanism_7.png | Bin 0 -> 401 bytes com/hbm/inventory/MachineRecipes.java | 1 + com/hbm/items/ModItems.java | 24 + com/hbm/main/CraftingManager.java | 61 +- com/hbm/main/ModEventHandler.java | 30 +- .../TileEntityMachineReactorSmall.java | 541 +++++++++--------- 14 files changed, 368 insertions(+), 303 deletions(-) create mode 100644 assets/hbm/textures/items/mechanism_1.png create mode 100644 assets/hbm/textures/items/mechanism_2.png create mode 100644 assets/hbm/textures/items/mechanism_3.png create mode 100644 assets/hbm/textures/items/mechanism_4.png create mode 100644 assets/hbm/textures/items/mechanism_5.png create mode 100644 assets/hbm/textures/items/mechanism_6.png create mode 100644 assets/hbm/textures/items/mechanism_7.png diff --git a/assets/hbm/lang/de_DE.lang b/assets/hbm/lang/de_DE.lang index 812699d9b..07e785c6e 100644 --- a/assets/hbm/lang/de_DE.lang +++ b/assets/hbm/lang/de_DE.lang @@ -557,6 +557,13 @@ item.circuit_targeting_tier3.name=Militärische Schaltplatte (Stufe 3) item.circuit_targeting_tier4.name=Militärische Schaltplatte (Stufe 4) item.circuit_targeting_tier5.name=Militärische Schaltplatte (Stufe 5) item.circuit_targeting_tier6.name=Militärische Schaltplatte (Stufe 6) +item.mechanism_revolver_1.name=Revolvermechanismus +item.mechanism_revolver_2.name=Fortgeschrittener Revolvermechanismus +item.mechanism_rifle_1.name=Gewehmechanismus +item.mechanism_rifle_2.name=Fortgeschrittener Gewehmechanismus +item.mechanism_launcher_1.name=Werfermechanismus +item.mechanism_launcher_2.name=Fortgeschrittener Werfermechanismus +item.mechanism_special.name=High-Tech Waffenmechanismus item.piston_selenium.name=Sternmotorenkolben diff --git a/assets/hbm/lang/en_US.lang b/assets/hbm/lang/en_US.lang index 976395d71..497dd2843 100644 --- a/assets/hbm/lang/en_US.lang +++ b/assets/hbm/lang/en_US.lang @@ -557,6 +557,13 @@ item.circuit_targeting_tier3.name=Military Grade Circuit Board (Tier 3) item.circuit_targeting_tier4.name=Military Grade Circuit Board (Tier 4) item.circuit_targeting_tier5.name=Military Grade Circuit Board (Tier 5) item.circuit_targeting_tier6.name=Military Grade Circuit Board (Tier 6) +item.mechanism_revolver_1.name=Revolver Mechanism +item.mechanism_revolver_2.name=Advanced Revolver Mechanism +item.mechanism_rifle_1.name=Rifle Mechanism +item.mechanism_rifle_2.name=Advanced Rifle Mechanism +item.mechanism_launcher_1.name=Launcher Mechanism +item.mechanism_launcher_2.name=Advanced Launcher Mechanism +item.mechanism_special.name=High-Tech Weapon Mechanism item.piston_selenium.name=Radial Engine Piston diff --git a/assets/hbm/textures/items/mechanism_1.png b/assets/hbm/textures/items/mechanism_1.png new file mode 100644 index 0000000000000000000000000000000000000000..06c19bffe64e8d83c85043bc9beb1b271f0e96cd GIT binary patch literal 281 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf6O=UC6#{xdf*na9v=Stiqo@=01Z4&UC!n9#FxYDibK;QRCtPe=eoLATNvUM1SjplMjToeV)IgBv?er=Mj$s*$S1^~`E=6S|B zcbF{(BH~3PS(}K6uc``T3|W?i1RHGb2_~VQrU_N0EKA051b%pfAP!K~<@@%+1G=s| u-2a`(?|HAdi^0obWLX*`{t9Oj{3)L9{C69oBAu`R0000 literal 0 HcmV?d00001 diff --git a/assets/hbm/textures/items/mechanism_3.png b/assets/hbm/textures/items/mechanism_3.png new file mode 100644 index 0000000000000000000000000000000000000000..db85d9f0a9916c4bb57dfa28b88399761a962276 GIT binary patch literal 316 zcmV-C0mJ@@P)LQY`31(OVV z0dByegNwn$5CUbZQwcwcP4u1GetDku`wILRse52KKATMEDDo6h81(AhjJmLHtU(kF zy0M1k_)J*9;fiLUx(aME;$_ZzUUd$3DrLz+0GuUD?-LKM96jAQX{#{3S1?RCo9#EPdtx O0000?~sFl>;13>CqbbN8Y+CITQzvhS2#V|=_$5pJlUOR&sOH#Q$D3r$KFlnHuxQOKG#M{G!w!2p!)e)F65> zQDmmck**gGQ`IhXsGrc@+|<0|51ULQ-v%T8*T>B_DD7gu<-l6-VEQc4H~Fq6_0wl| rh*b(ZJWM{B9yjx&cCFDt|5En)_T+^&zqdRBdX>S`)z4*}Q$iB}!j5ig literal 0 HcmV?d00001 diff --git a/assets/hbm/textures/items/mechanism_5.png b/assets/hbm/textures/items/mechanism_5.png new file mode 100644 index 0000000000000000000000000000000000000000..ae6dc2567ba21413176945a6f8976327aa04807a GIT binary patch literal 261 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf&zklNyJA)z%>j$psCExr_ zQ_tT%=Yg`!@8@|S9V9Il=Yk{0{Vl&)78&q Iol`;+0JRKj{{R30 literal 0 HcmV?d00001 diff --git a/assets/hbm/textures/items/mechanism_6.png b/assets/hbm/textures/items/mechanism_6.png new file mode 100644 index 0000000000000000000000000000000000000000..6656fe1cd088117c0bde78a96329d9c24dcba1f2 GIT binary patch literal 290 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf?fddbcp8k|qQ#hu07|1#B;ni_rk=7&`qk@gL$F~_DIud!o^wFcm(oKmC zHq+H&Cd_V~-v|T`U(fH?=-L_iL-NT^JEIxDcKpk~A9Ms{+<}&L49hC-Ht#R6+hozx z#;8_ef6#6bs( f>|gg3#2FZLzelk~Mx9OqdXmA@)z4*}Q$iB}kh*u? literal 0 HcmV?d00001 diff --git a/assets/hbm/textures/items/mechanism_7.png b/assets/hbm/textures/items/mechanism_7.png new file mode 100644 index 0000000000000000000000000000000000000000..9166afeb4083da0cef28b75f9b1c56c2381a4c92 GIT binary patch literal 401 zcmV;C0dD?@P)M>rm5U%3Asy{7s!Rs3#9l2<$4}Ke1HjB zMMMwa6BM}U1q^hRf?F42`FFgdZElO0OQQ`4_N~sj=YAg_-#M@&wDpHVp&+*lt;77MOAok)SFY*y7Ff#Glnz$b8>!JETVCFusTzK5K{$>a z4+gA+P`%;08o+GiF`4Vs&))!;%ylKc7ZmYC0)Q{yM>h=B2PijFOy)YJwoSR2Vm9&! zIq*G?l@RR5@&UeY*T#$c=bA0XbQt7JoD+h+_YRBm`re$GT7J+?$QrqUR vGUxU2eIvKfC2F 0 ? MainRegistry.meteorShowerChance : MainRegistry.meteorStrikeChance) == 0) { if(!event.world.playerEntities.isEmpty()) { @@ -85,13 +90,18 @@ public class ModEventHandler if(effect != null) { if(entity instanceof EntityCreeper) { - EntityNuclearCreeper creep = new EntityNuclearCreeper(event.world); - creep.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch); - - if(!entity.isDead) - if(!event.world.isRemote) - event.world.spawnEntityInWorld(creep); - entity.setDead(); + + if(event.world.rand.nextInt(5) == 0) { + EntityNuclearCreeper creep = new EntityNuclearCreeper(event.world); + creep.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch); + + if(!entity.isDead) + if(!event.world.isRemote) + event.world.spawnEntityInWorld(creep); + entity.setDead(); + } else { + entity.attackEntityFrom(ModDamageSource.radiation, 100F); + } } else if(entity instanceof EntityCow) { EntityMooshroom creep = new EntityMooshroom(event.world); @@ -149,6 +159,12 @@ public class ModEventHandler } } } + + ////////////////////// + } catch(Exception x) { + MainRegistry.logger.error("Ouchie, something has happened in the NTM world tick event."); + } + ////////////////////// } @SubscribeEvent diff --git a/com/hbm/tileentity/machine/TileEntityMachineReactorSmall.java b/com/hbm/tileentity/machine/TileEntityMachineReactorSmall.java index c017a8c0c..a4714fe09 100644 --- a/com/hbm/tileentity/machine/TileEntityMachineReactorSmall.java +++ b/com/hbm/tileentity/machine/TileEntityMachineReactorSmall.java @@ -38,7 +38,8 @@ import net.minecraft.potion.PotionEffect; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; -public class TileEntityMachineReactorSmall extends TileEntity implements ISidedInventory, ISource, IFluidContainer, IFluidAcceptor { +public class TileEntityMachineReactorSmall extends TileEntity + implements ISidedInventory, ISource, IFluidContainer, IFluidAcceptor { private ItemStack slots[]; @@ -54,13 +55,13 @@ public class TileEntityMachineReactorSmall extends TileEntity implements ISidedI public int age = 0; public List list = new ArrayList(); public FluidTank[] tanks; - - private static final int[] slots_top = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8}; - private static final int[] slots_bottom = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}; - private static final int[] slots_side = new int[] {9, 10, 11}; - + + private static final int[] slots_top = new int[] { 16 }; + private static final int[] slots_bottom = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 16 }; + private static final int[] slots_side = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16 }; + private String customName; - + public TileEntityMachineReactorSmall() { slots = new ItemStack[17]; tanks = new FluidTank[2]; @@ -80,21 +81,19 @@ public class TileEntityMachineReactorSmall extends TileEntity implements ISidedI @Override public ItemStack getStackInSlotOnClosing(int i) { - if(slots[i] != null) - { + if (slots[i] != null) { ItemStack itemStack = slots[i]; slots[i] = null; return itemStack; } else { - return null; + return null; } } @Override public void setInventorySlotContents(int i, ItemStack itemStack) { slots[i] = itemStack; - if(itemStack != null && itemStack.stackSize > getInventoryStackLimit()) - { + if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()) { itemStack.stackSize = getInventoryStackLimit(); } } @@ -108,7 +107,7 @@ public class TileEntityMachineReactorSmall extends TileEntity implements ISidedI public boolean hasCustomInventoryName() { return this.customName != null && this.customName.length() > 0; } - + public void setCustomName(String name) { this.customName = name; } @@ -120,67 +119,61 @@ public class TileEntityMachineReactorSmall extends TileEntity implements ISidedI @Override public boolean isUseableByPlayer(EntityPlayer player) { - if(worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) - { + if (worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) { return false; - }else{ - return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <=64; + } else { + return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64; } } - - //You scrubs aren't needed for anything (right now) + + // You scrubs aren't needed for anything (right now) @Override - public void openInventory() {} + public void openInventory() { + } + @Override - public void closeInventory() {} + public void closeInventory() { + } @Override public boolean isItemValidForSlot(int i, ItemStack itemStack) { - if(i == 0 || - i == 1 || - i == 2 || - i == 3 || - i == 4 || - i == 5 || - i == 6 || - i == 7 || - i == 8) - if(itemStack.getItem() instanceof ItemFuelRod) + if (i == 0 || i == 1 || i == 2 || i == 3 || i == 4 || i == 5 || i == 6 || i == 7 || i == 8 || i == 9 || i == 10 + || i == 11) + if (itemStack.getItem() instanceof ItemFuelRod) return true; - if(i == 12) - if(itemStack.getItem() == ModItems.rod_water || itemStack.getItem() == ModItems.rod_dual_water || itemStack.getItem() == ModItems.rod_quad_water || itemStack.getItem() == Items.water_bucket) + if (i == 12) + if (itemStack.getItem() == ModItems.rod_water || itemStack.getItem() == ModItems.rod_dual_water + || itemStack.getItem() == ModItems.rod_quad_water || itemStack.getItem() == Items.water_bucket) return true; - if(i == 14) - if(itemStack.getItem() == ModItems.rod_coolant || itemStack.getItem() == ModItems.rod_dual_coolant || itemStack.getItem() == ModItems.rod_quad_coolant) + if (i == 14) + if (itemStack.getItem() == ModItems.rod_coolant || itemStack.getItem() == ModItems.rod_dual_coolant + || itemStack.getItem() == ModItems.rod_quad_coolant) return true; - if(i == 16) - if(itemStack.getItem() instanceof ItemBattery) + if (i == 16) + if (itemStack.getItem() instanceof ItemBattery) return true; return false; } - + @Override public ItemStack decrStackSize(int i, int j) { - if(slots[i] != null) - { - if(slots[i].stackSize <= j) - { + if (slots[i] != null) { + if (slots[i].stackSize <= j) { ItemStack itemStack = slots[i]; slots[i] = null; return itemStack; } ItemStack itemStack1 = slots[i].splitStack(j); - if (slots[i].stackSize == 0) - { + if (slots[i].stackSize == 0) { slots[i] = null; } - + return itemStack1; } else { return null; } } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -188,48 +181,45 @@ public class TileEntityMachineReactorSmall extends TileEntity implements ISidedI power = nbt.getLong("power"); coreHeat = nbt.getInteger("heat"); + hullHeat = nbt.getInteger("hullHeat"); slots = new ItemStack[getSizeInventory()]; tanks[0].readFromNBT(nbt, "water"); tanks[1].readFromNBT(nbt, "coolant"); - - for(int i = 0; i < list.tagCount(); i++) - { + + for (int i = 0; i < list.tagCount(); i++) { NBTTagCompound nbt1 = list.getCompoundTagAt(i); byte b0 = nbt1.getByte("slot"); - if(b0 >= 0 && b0 < slots.length) - { + if (b0 >= 0 && b0 < slots.length) { slots[b0] = ItemStack.loadItemStackFromNBT(nbt1); } } } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setLong("power", power); nbt.setInteger("heat", coreHeat); + nbt.setInteger("hullHeat", hullHeat); NBTTagList list = new NBTTagList(); tanks[0].writeToNBT(nbt, "water"); tanks[1].writeToNBT(nbt, "coolant"); - - for(int i = 0; i < slots.length; i++) - { - if(slots[i] != null) - { + + for (int i = 0; i < slots.length; i++) { + if (slots[i] != null) { NBTTagCompound nbt1 = new NBTTagCompound(); - nbt1.setByte("slot", (byte)i); + nbt1.setByte("slot", (byte) i); slots[i].writeToNBT(nbt1); list.appendTag(nbt1); } } nbt.setTag("items", list); } - + @Override - public int[] getAccessibleSlotsFromSide(int p_94128_1_) - { - return p_94128_1_ == 0 ? slots_bottom : (p_94128_1_ == 1 ? slots_top : slots_side); - } + public int[] getAccessibleSlotsFromSide(int p_94128_1_) { + return p_94128_1_ == 0 ? slots_bottom : (p_94128_1_ == 1 ? slots_top : slots_side); + } @Override public boolean canInsertItem(int i, ItemStack itemStack, int j) { @@ -238,208 +228,220 @@ public class TileEntityMachineReactorSmall extends TileEntity implements ISidedI @Override public boolean canExtractItem(int i, ItemStack itemStack, int j) { - if(i == 0 || - i == 1 || - i == 2 || - i == 3 || - i == 4 || - i == 5 || - i == 6 || - i == 7 || - i == 8) - if(itemStack.getItem() == ModItems.rod_uranium_fuel_depleted || - itemStack.getItem() == ModItems.rod_dual_uranium_fuel_depleted || - itemStack.getItem() == ModItems.rod_quad_uranium_fuel_depleted || - itemStack.getItem() == ModItems.rod_plutonium_fuel_depleted || - itemStack.getItem() == ModItems.rod_dual_plutonium_fuel_depleted || - itemStack.getItem() == ModItems.rod_quad_plutonium_fuel_depleted || - itemStack.getItem() == ModItems.rod_mox_fuel_depleted || - itemStack.getItem() == ModItems.rod_dual_mox_fuel_depleted || - itemStack.getItem() == ModItems.rod_quad_mox_fuel_depleted || - itemStack.getItem() == ModItems.rod_schrabidium_fuel_depleted || - itemStack.getItem() == ModItems.rod_dual_schrabidium_fuel_depleted || - itemStack.getItem() == ModItems.rod_quad_schrabidium_fuel_depleted) + if (i == 0 || i == 1 || i == 2 || i == 3 || i == 4 || i == 5 || i == 6 || i == 7 || i == 8 || i == 9 || i == 10 + || i == 11) + if (itemStack.getItem() == ModItems.rod_uranium_fuel_depleted + || itemStack.getItem() == ModItems.rod_dual_uranium_fuel_depleted + || itemStack.getItem() == ModItems.rod_quad_uranium_fuel_depleted + || itemStack.getItem() == ModItems.rod_plutonium_fuel_depleted + || itemStack.getItem() == ModItems.rod_dual_plutonium_fuel_depleted + || itemStack.getItem() == ModItems.rod_quad_plutonium_fuel_depleted + || itemStack.getItem() == ModItems.rod_mox_fuel_depleted + || itemStack.getItem() == ModItems.rod_dual_mox_fuel_depleted + || itemStack.getItem() == ModItems.rod_quad_mox_fuel_depleted + || itemStack.getItem() == ModItems.rod_schrabidium_fuel_depleted + || itemStack.getItem() == ModItems.rod_dual_schrabidium_fuel_depleted + || itemStack.getItem() == ModItems.rod_quad_schrabidium_fuel_depleted) return true; - if(i == 9 || i == 10) - if(itemStack.getItem() == Items.bucket || itemStack.getItem() == ModItems.rod_empty || itemStack.getItem() == ModItems.rod_dual_empty || itemStack.getItem() == ModItems.rod_quad_empty) + if (i == 13 || i == 15) + if (itemStack.getItem() == Items.bucket || itemStack.getItem() == ModItems.rod_empty + || itemStack.getItem() == ModItems.rod_dual_empty || itemStack.getItem() == ModItems.rod_quad_empty + || itemStack.getItem() == ModItems.fluid_tank_empty + || itemStack.getItem() == ModItems.fluid_barrel_empty) return true; - if(i == 11) - if (itemStack.getItem() instanceof ItemBattery && ItemBattery.getCharge(itemStack) == ItemBattery.getMaxChargeStatic(itemStack)) + if (i == 16) + if (itemStack.getItem() instanceof ItemBattery + && ItemBattery.getCharge(itemStack) == ItemBattery.getMaxChargeStatic(itemStack)) return true; - + return false; } - + public long getPowerScaled(long i) { return (power * i) / powerMax; } - + public int getCoreHeatScaled(int i) { return (coreHeat * i) / maxCoreHeat; } - + public int getHullHeatScaled(int i) { return (hullHeat * i) / maxHullHeat; } - + public boolean hasPower() { return power > 0; } - + public boolean hasCoreHeat() { return coreHeat > 0; } - + public boolean hasHullHeat() { return hullHeat > 0; } - + private int[] getNeighbouringSlots(int id) { - - switch(id) { - case 0: return new int[] { 1, 5 }; - case 1: return new int[] { 0, 6 }; - case 2: return new int[] { 3, 7 }; - case 3: return new int[] { 2, 4, 8 }; - case 4: return new int[] { 3, 9 }; - case 5: return new int[] { 0, 6, 0xA }; - case 6: return new int[] { 1, 5, 0xB }; - case 7: return new int[] { 2, 8 }; - case 8: return new int[] { 3, 7, 9}; - case 9: return new int[] { 4, 8 }; - case 10: return new int[] { 5, 0xB }; - case 11: return new int[] { 6, 0xA }; + + switch (id) { + case 0: + return new int[] { 1, 5 }; + case 1: + return new int[] { 0, 6 }; + case 2: + return new int[] { 3, 7 }; + case 3: + return new int[] { 2, 4, 8 }; + case 4: + return new int[] { 3, 9 }; + case 5: + return new int[] { 0, 6, 0xA }; + case 6: + return new int[] { 1, 5, 0xB }; + case 7: + return new int[] { 2, 8 }; + case 8: + return new int[] { 3, 7, 9 }; + case 9: + return new int[] { 4, 8 }; + case 10: + return new int[] { 5, 0xB }; + case 11: + return new int[] { 6, 0xA }; } - + return null; } @Override public void updateEntity() { - - if(!worldObj.isRemote) - { + + if (!worldObj.isRemote) { age++; - if(age >= 20) - { + if (age >= 20) { age = 0; } - - if(age == 9 || age == 19) + + if (age == 9 || age == 19) ffgeuaInit(); - - if(tanks[0].getFill() < tanks[0].getMaxFill()) { - - if(worldObj.getBlock(xCoord + 1, yCoord + 1, zCoord) == Blocks.water || worldObj.getBlock(xCoord + 1, yCoord + 1, zCoord) == Blocks.flowing_water) + + if (tanks[0].getFill() < tanks[0].getMaxFill()) { + + if (worldObj.getBlock(xCoord + 1, yCoord + 1, zCoord) == Blocks.water + || worldObj.getBlock(xCoord + 1, yCoord + 1, zCoord) == Blocks.flowing_water) tanks[0].setFill(tanks[0].getFill() + 25); - - if(worldObj.getBlock(xCoord - 1, yCoord + 1, zCoord) == Blocks.water || worldObj.getBlock(xCoord - 1, yCoord + 1, zCoord) == Blocks.flowing_water) + + if (worldObj.getBlock(xCoord - 1, yCoord + 1, zCoord) == Blocks.water + || worldObj.getBlock(xCoord - 1, yCoord + 1, zCoord) == Blocks.flowing_water) tanks[0].setFill(tanks[0].getFill() + 25); - - if(worldObj.getBlock(xCoord, yCoord + 1, zCoord + 1) == Blocks.water || worldObj.getBlock(xCoord, yCoord + 1, zCoord + 1) == Blocks.flowing_water) + + if (worldObj.getBlock(xCoord, yCoord + 1, zCoord + 1) == Blocks.water + || worldObj.getBlock(xCoord, yCoord + 1, zCoord + 1) == Blocks.flowing_water) tanks[0].setFill(tanks[0].getFill() + 25); - - if(worldObj.getBlock(xCoord, yCoord + 1, zCoord - 1) == Blocks.water || worldObj.getBlock(xCoord, yCoord + 1, zCoord - 1) == Blocks.flowing_water) + + if (worldObj.getBlock(xCoord, yCoord + 1, zCoord - 1) == Blocks.water + || worldObj.getBlock(xCoord, yCoord + 1, zCoord - 1) == Blocks.flowing_water) tanks[0].setFill(tanks[0].getFill() + 25); - - if(tanks[0].getFill() > tanks[0].getMaxFill()) + + if (tanks[0].getFill() > tanks[0].getMaxFill()) tanks[0].setFill(tanks[0].getMaxFill()); } - + tanks[0].loadTank(12, 13, slots); tanks[1].loadTank(14, 15, slots); - - if(retracting && rods > 0) { - - if(rods == rodsMax) - this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.reactorStart", 1.0F, 0.75F); - + + if (retracting && rods > 0) { + + if (rods == rodsMax) + this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.reactorStart", 1.0F, + 0.75F); + rods--; - - if(rods == 0) - this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.reactorStop", 1.0F, 1.0F); + + if (rods == 0) + this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.reactorStop", 1.0F, + 1.0F); } - if(!retracting && rods < rodsMax) { - - if(rods == 0) - this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.reactorStart", 1.0F, 0.75F); - + if (!retracting && rods < rodsMax) { + + if (rods == 0) + this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.reactorStart", 1.0F, + 0.75F); + rods++; - - if(rods == rodsMax) - this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.reactorStop", 1.0F, 1.0F); + + if (rods == rodsMax) + this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.reactorStop", 1.0F, + 1.0F); } - - for(int i = 0; i < 2; i++) + + for (int i = 0; i < 2; i++) tanks[i].updateTank(xCoord, yCoord, zCoord); - - //Batteries + + // Batteries power = Library.chargeItemsFromTE(slots, 11, power, powerMax); - - if(rods >= rodsMax) - for(int i = 0; i < 12; i++) - { - if(slots[i] != null && slots[i].getItem() instanceof ItemFuelRod) + + if (rods >= rodsMax) + for (int i = 0; i < 12; i++) { + if (slots[i] != null && slots[i].getItem() instanceof ItemFuelRod) decay(i); } - - if(this.coreHeat > 0 && this.tanks[1].getFill() > 0 && this.hullHeat < this.maxHullHeat) { + + if (this.coreHeat > 0 && this.tanks[1].getFill() > 0 && this.hullHeat < this.maxHullHeat) { this.hullHeat += this.coreHeat * 0.175; this.coreHeat -= this.coreHeat * 0.1; - + this.tanks[1].setFill(this.tanks[1].getFill() - 10); - - if(this.tanks[1].getFill() < 0) + + if (this.tanks[1].getFill() < 0) this.tanks[1].setFill(0); } - if(this.hullHeat > maxHullHeat) - { + if (this.hullHeat > maxHullHeat) { this.hullHeat = maxHullHeat; } - - if(this.hullHeat > 0 && this.tanks[0].getFill() > 0) { + + if (this.hullHeat > 0 && this.tanks[0].getFill() > 0) { this.power += this.hullHeat * 0.1; this.hullHeat -= this.hullHeat * 0.085; - + this.tanks[0].setFill(this.tanks[0].getFill() - 100); - - if(this.tanks[0].getFill() < 0) + + if (this.tanks[0].getFill() < 0) this.tanks[0].setFill(0); } - if(this.power > powerMax) - { + if (this.power > powerMax) { this.power = powerMax; } - - if(this.coreHeat > maxCoreHeat) - { + + if (this.coreHeat > maxCoreHeat) { this.explode(); } - - if(rods > 0 && coreHeat > 0 && - !(worldObj.getBlock(xCoord + 1, yCoord + 1, zCoord).isNormalCube() && - worldObj.getBlock(xCoord - 1, yCoord + 1, zCoord).isNormalCube() && - worldObj.getBlock(xCoord, yCoord + 1, zCoord + 1).isNormalCube() && - worldObj.getBlock(xCoord, yCoord + 1, zCoord - 1).isNormalCube() && - worldObj.getBlock(xCoord + 1, yCoord + 1, zCoord) != Blocks.air && - worldObj.getBlock(xCoord - 1, yCoord + 1, zCoord) != Blocks.air && - worldObj.getBlock(xCoord, yCoord + 1, zCoord + 1) != Blocks.air && - worldObj.getBlock(xCoord, yCoord + 1, zCoord - 1) != Blocks.air)) { - - List list = (List)worldObj.getEntitiesWithinAABBExcludingEntity(null, - AxisAlignedBB.getBoundingBox(xCoord + 0.5 - 5, yCoord + 1.5 - 5, zCoord + 0.5 - 5, xCoord + 0.5 + 5, yCoord + 1.5 + 5, zCoord + 0.5 + 5)); - - for(Entity e : list) { - if(e instanceof EntityPlayer && Library.checkForHazmat((EntityPlayer)e)) - { - - } else { - if(e instanceof EntityLivingBase) - ((EntityLivingBase) e).addPotionEffect(new PotionEffect(HbmPotion.radiation.id, 80 * 20, 25)); - } + + if (rods > 0 && coreHeat > 0 + && !(worldObj.getBlock(xCoord + 1, yCoord + 1, zCoord).isNormalCube() + && worldObj.getBlock(xCoord - 1, yCoord + 1, zCoord).isNormalCube() + && worldObj.getBlock(xCoord, yCoord + 1, zCoord + 1).isNormalCube() + && worldObj.getBlock(xCoord, yCoord + 1, zCoord - 1).isNormalCube() + && worldObj.getBlock(xCoord + 1, yCoord + 1, zCoord) != Blocks.air + && worldObj.getBlock(xCoord - 1, yCoord + 1, zCoord) != Blocks.air + && worldObj.getBlock(xCoord, yCoord + 1, zCoord + 1) != Blocks.air + && worldObj.getBlock(xCoord, yCoord + 1, zCoord - 1) != Blocks.air)) { + + List list = (List) worldObj.getEntitiesWithinAABBExcludingEntity(null, + AxisAlignedBB.getBoundingBox(xCoord + 0.5 - 5, yCoord + 1.5 - 5, zCoord + 0.5 - 5, + xCoord + 0.5 + 5, yCoord + 1.5 + 5, zCoord + 0.5 + 5)); + + for (Entity e : list) { + if (e instanceof EntityPlayer && Library.checkForHazmat((EntityPlayer) e)) { + + } else { + if (e instanceof EntityLivingBase) + ((EntityLivingBase) e) + .addPotionEffect(new PotionEffect(HbmPotion.radiation.id, 80 * 20, 25)); + } } } @@ -450,113 +452,112 @@ public class TileEntityMachineReactorSmall extends TileEntity implements ISidedI PacketDispatcher.wrapper.sendToAll(new AuxGaugePacket(xCoord, yCoord, zCoord, hullHeat, 3)); } } - + private boolean hasFuelRod(int id) { - if(id > 11) + if (id > 11) return false; - - if(slots[id] != null) + + if (slots[id] != null) return slots[id].getItem() instanceof ItemFuelRod; - + return false; } - + private int getNeightbourCount(int id) { - + int[] neighbours = this.getNeighbouringSlots(id); - - if(neighbours == null) + + if (neighbours == null) return 0; - + int count = 0; - - for(int i = 0; i < neighbours.length; i++) - if(hasFuelRod(neighbours[i])) + + for (int i = 0; i < neighbours.length; i++) + if (hasFuelRod(neighbours[i])) count++; - + return count; - + } - //itemstack in slots[id] has to contain ItemFuelRod item + // itemstack in slots[id] has to contain ItemFuelRod item private void decay(int id) { - if(id > 11) + if (id > 11) return; - + int decay = getNeightbourCount(id) + 1; - - for(int i = 0; i < decay; i++) { - ItemFuelRod rod = ((ItemFuelRod)slots[id].getItem()); + + for (int i = 0; i < decay; i++) { + ItemFuelRod rod = ((ItemFuelRod) slots[id].getItem()); this.coreHeat += rod.heat; ItemFuelRod.setLifeTime(slots[id], ItemFuelRod.getLifeTime(slots[id]) + 1); ItemFuelRod.updateDamage(slots[id]); - - if(ItemFuelRod.getLifeTime(slots[id]) > ((ItemFuelRod)slots[id].getItem()).lifeTime) { + + if (ItemFuelRod.getLifeTime(slots[id]) > ((ItemFuelRod) slots[id].getItem()).lifeTime) { onRunOut(id); return; } } } - - //itemstack in slots[id] has to contain ItemFuelRod item + + // itemstack in slots[id] has to contain ItemFuelRod item private void onRunOut(int id) { - + System.out.println("aaa"); - + Item item = slots[id].getItem(); - if(item == ModItems.rod_uranium_fuel) { + if (item == ModItems.rod_uranium_fuel) { slots[id] = new ItemStack(ModItems.rod_uranium_fuel_depleted); - - } else if(item == ModItems.rod_plutonium_fuel) { + + } else if (item == ModItems.rod_plutonium_fuel) { slots[id] = new ItemStack(ModItems.rod_plutonium_fuel_depleted); - - } else if(item == ModItems.rod_mox_fuel) { + + } else if (item == ModItems.rod_mox_fuel) { slots[id] = new ItemStack(ModItems.rod_mox_fuel_depleted); - - } else if(item == ModItems.rod_schrabidium_fuel) { + + } else if (item == ModItems.rod_schrabidium_fuel) { slots[id] = new ItemStack(ModItems.rod_schrabidium_fuel_depleted); - - } else if(item == ModItems.rod_dual_uranium_fuel) { + + } else if (item == ModItems.rod_dual_uranium_fuel) { slots[id] = new ItemStack(ModItems.rod_dual_uranium_fuel_depleted); - - } else if(item == ModItems.rod_dual_plutonium_fuel) { + + } else if (item == ModItems.rod_dual_plutonium_fuel) { slots[id] = new ItemStack(ModItems.rod_dual_plutonium_fuel_depleted); - - } else if(item == ModItems.rod_dual_mox_fuel) { + + } else if (item == ModItems.rod_dual_mox_fuel) { slots[id] = new ItemStack(ModItems.rod_dual_mox_fuel_depleted); - - } else if(item == ModItems.rod_dual_schrabidium_fuel) { + + } else if (item == ModItems.rod_dual_schrabidium_fuel) { slots[id] = new ItemStack(ModItems.rod_dual_schrabidium_fuel_depleted); - - } else if(item == ModItems.rod_quad_uranium_fuel) { + + } else if (item == ModItems.rod_quad_uranium_fuel) { slots[id] = new ItemStack(ModItems.rod_quad_uranium_fuel_depleted); - - } else if(item == ModItems.rod_quad_plutonium_fuel) { + + } else if (item == ModItems.rod_quad_plutonium_fuel) { slots[id] = new ItemStack(ModItems.rod_quad_plutonium_fuel_depleted); - - } else if(item == ModItems.rod_quad_mox_fuel) { + + } else if (item == ModItems.rod_quad_mox_fuel) { slots[id] = new ItemStack(ModItems.rod_quad_mox_fuel_depleted); - - } else if(item == ModItems.rod_quad_schrabidium_fuel) { + + } else if (item == ModItems.rod_quad_schrabidium_fuel) { slots[id] = new ItemStack(ModItems.rod_quad_schrabidium_fuel_depleted); } } - + private void explode() { - for(int i = 0; i < slots.length; i++) - { + for (int i = 0; i < slots.length; i++) { this.slots[i] = null; } - - worldObj.createExplosion(null, this.xCoord, this.yCoord, this.zCoord, 18.0F, true); - ExplosionNukeGeneric.waste(worldObj, this.xCoord, this.yCoord, this.zCoord, 35); - worldObj.setBlock(this.xCoord, this.yCoord, this.zCoord, Blocks.flowing_lava); + + worldObj.createExplosion(null, this.xCoord, this.yCoord, this.zCoord, 18.0F, true); + ExplosionNukeGeneric.waste(worldObj, this.xCoord, this.yCoord, this.zCoord, 35); + worldObj.setBlock(this.xCoord, this.yCoord, this.zCoord, Blocks.flowing_lava); } @Override public void ffgeua(int x, int y, int z, boolean newTact) { - + Library.ffgeua(x, y, z, newTact, this, worldObj); } @@ -566,20 +567,19 @@ public class TileEntityMachineReactorSmall extends TileEntity implements ISidedI ffgeua(this.xCoord + 1, this.yCoord, this.zCoord, getTact()); ffgeua(this.xCoord, this.yCoord, this.zCoord - 1, getTact()); ffgeua(this.xCoord, this.yCoord, this.zCoord + 1, getTact()); - + ffgeua(this.xCoord - 1, this.yCoord + 2, this.zCoord, getTact()); ffgeua(this.xCoord + 1, this.yCoord + 2, this.zCoord, getTact()); ffgeua(this.xCoord, this.yCoord + 2, this.zCoord - 1, getTact()); ffgeua(this.xCoord, this.yCoord + 2, this.zCoord + 1, getTact()); } - + @Override public boolean getTact() { - if(age >= 0 && age < 10) - { + if (age >= 0 && age < 10) { return true; } - + return false; } @@ -605,9 +605,9 @@ public class TileEntityMachineReactorSmall extends TileEntity implements ISidedI @Override public int getMaxAFluidFill(FluidType type) { - if(type.name().equals(tanks[0].getTankType().name())) + if (type.name().equals(tanks[0].getTankType().name())) return tanks[0].getMaxFill(); - else if(type.name().equals(tanks[1].getTankType().name())) + else if (type.name().equals(tanks[1].getTankType().name())) return tanks[1].getMaxFill(); else return 0; @@ -615,17 +615,17 @@ public class TileEntityMachineReactorSmall extends TileEntity implements ISidedI @Override public void setAFluidFill(int i, FluidType type) { - if(type.name().equals(tanks[0].getTankType().name())) + if (type.name().equals(tanks[0].getTankType().name())) tanks[0].setFill(i); - else if(type.name().equals(tanks[1].getTankType().name())) + else if (type.name().equals(tanks[1].getTankType().name())) tanks[1].setFill(i); } @Override public int getAFluidFill(FluidType type) { - if(type.name().equals(tanks[0].getTankType().name())) + if (type.name().equals(tanks[0].getTankType().name())) return tanks[0].getFill(); - else if(type.name().equals(tanks[1].getTankType().name())) + else if (type.name().equals(tanks[1].getTankType().name())) return tanks[1].getFill(); else return 0; @@ -633,25 +633,24 @@ public class TileEntityMachineReactorSmall extends TileEntity implements ISidedI @Override public void setFillstate(int fill, int index) { - if(index < 2 && tanks[index] != null) + if (index < 2 && tanks[index] != null) tanks[index].setFill(fill); } @Override public void setType(FluidType type, int index) { - if(index < 2 && tanks[index] != null) + if (index < 2 && tanks[index] != null) tanks[index].setTankType(type); } - + @Override public AxisAlignedBB getRenderBoundingBox() { return TileEntity.INFINITE_EXTENT_AABB; } - + @Override @SideOnly(Side.CLIENT) - public double getMaxRenderDistanceSquared() - { + public double getMaxRenderDistanceSquared() { return 65536.0D; } } \ No newline at end of file