diff options
author | kekzdealer <kekzdealer@gmail.com> | 2020-05-13 11:29:09 +0200 |
---|---|---|
committer | kekzdealer <kekzdealer@gmail.com> | 2020-05-13 11:29:09 +0200 |
commit | 1731699923f01e166a2c3520a7afe10d7b31e28b (patch) | |
tree | c7574e529f011b281ab89909d971ae8eb09824a6 /src | |
parent | b9a3cc65e4a89990d8816fd6e815c0a84228ae6d (diff) | |
download | GT5-Unofficial-1731699923f01e166a2c3520a7afe10d7b31e28b.tar.gz GT5-Unofficial-1731699923f01e166a2c3520a7afe10d7b31e28b.tar.bz2 GT5-Unofficial-1731699923f01e166a2c3520a7afe10d7b31e28b.zip |
code cleanup, recipe fix
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/common/Recipes.java | 2 | ||||
-rw-r--r-- | src/main/java/common/blocks/Block_IchorJar.java | 54 | ||||
-rw-r--r-- | src/main/java/common/blocks/Block_ThaumiumReinforcedJar.java | 57 | ||||
-rw-r--r-- | src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java | 5 | ||||
-rw-r--r-- | src/main/java/items/Item_IchorJarFilled.java | 118 | ||||
-rw-r--r-- | src/main/java/items/Item_ThaumiumReinforcedJarFilled.java | 118 | ||||
-rw-r--r-- | src/main/java/kekztech/KekzCore.java | 2 | ||||
-rw-r--r-- | src/main/resources/assets/kekztech/lang/en_US.lang | 8 |
8 files changed, 68 insertions, 296 deletions
diff --git a/src/main/java/common/Recipes.java b/src/main/java/common/Recipes.java index 174e2b9104..43c9afe67b 100644 --- a/src/main/java/common/Recipes.java +++ b/src/main/java/common/Recipes.java @@ -557,7 +557,7 @@ public class Recipes { // Capacitor recycling GT_Values.RA.addUnboxingRecipe(new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 1), ItemList.Energy_LapotronicOrb.get(1L), - GT_OreDictUnificator.get(OrePrefixes.screw, Materials.TungstenSteel, 24), + GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Lapis, 4), 1200, 32); GT_Values.RA.addUnboxingRecipe(new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 2), ItemList.Energy_LapotronicOrb2.get(1L), diff --git a/src/main/java/common/blocks/Block_IchorJar.java b/src/main/java/common/blocks/Block_IchorJar.java index 7601ab0f78..a2be000b7a 100644 --- a/src/main/java/common/blocks/Block_IchorJar.java +++ b/src/main/java/common/blocks/Block_IchorJar.java @@ -53,7 +53,7 @@ public class Block_IchorJar extends BlockJar { @Override @SideOnly(Side.CLIENT) - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"unchecked"}) public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { par3List.add(new ItemStack(par1, 1, 0)); // Normal jar par3List.add(new ItemStack(par1, 1, 3)); // Void jar @@ -73,33 +73,39 @@ public class Block_IchorJar extends BlockJar { final TileEntity te = world.getTileEntity(x, y, z); if(te instanceof TE_IchorJar) { final TE_IchorJar ite = (TE_IchorJar) te; - if(ite.amount > 0) { - // Create a decent explosion in the center of the block (TNT has strength 4.0F) - world.createExplosion(null, x + 0.5D, y + 0.5D, z + 0.5D, 6.0F, false); - - // Place a lot of Flux in the area - final int limit = ite.amount / 16; - int created = 0; - for(int i = 0; i < 200; i++) { - final int xf = x + world.rand.nextInt(7) - world.rand.nextInt(7); - final int yf = x + world.rand.nextInt(7) - world.rand.nextInt(7); - final int zf = x + world.rand.nextInt(7) - world.rand.nextInt(7); - if(world.isAirBlock(xf, yf, zf)) { - if(yf > y) { - world.setBlock(xf, yf, zf, ConfigBlocks.blockFluxGas, 8, 3); - } else { - world.setBlock(xf, yf, zf, ConfigBlocks.blockFluxGoo, 8, 3); - } - - if(created++ > limit) { - break; - } + breakBlockWarpy(world, x, y, z, ite.amount, 200, 6.0F); + } else if(te instanceof TE_IchorVoidJar) { + final TE_IchorVoidJar ite = (TE_IchorVoidJar) te; + breakBlockWarpy(world, x, y, z, ite.amount, 200, 6.0F); + } + super.breakBlock(world, x, y, z, par5, par6); + } + + private void breakBlockWarpy(World world, int x, int y, int z, int fillAmount, int iterations, float explosionStrength){ + if(fillAmount > 0) { + // Create a decent explosion in the center of the block (TNT has strength 4.0F) + world.createExplosion(null, x + 0.5D, y + 0.5D, z + 0.5D, explosionStrength, false); + + // Place a lot of Flux in the area + final int limit = fillAmount / 16; + int created = 0; + for(int i = 0; i < iterations; i++) { + final int xf = x + world.rand.nextInt(7) - world.rand.nextInt(7); + final int yf = x + world.rand.nextInt(7) - world.rand.nextInt(7); + final int zf = x + world.rand.nextInt(7) - world.rand.nextInt(7); + if(world.isAirBlock(xf, yf, zf)) { + if(yf > y) { + world.setBlock(xf, yf, zf, ConfigBlocks.blockFluxGas, 8, 3); + } else { + world.setBlock(xf, yf, zf, ConfigBlocks.blockFluxGoo, 8, 3); + } + + if(created++ > limit) { + break; } } } } - - super.breakBlock(world, x, y, z, par5, par6); } @Override diff --git a/src/main/java/common/blocks/Block_ThaumiumReinforcedJar.java b/src/main/java/common/blocks/Block_ThaumiumReinforcedJar.java index edcdb54a17..d9064214d2 100644 --- a/src/main/java/common/blocks/Block_ThaumiumReinforcedJar.java +++ b/src/main/java/common/blocks/Block_ThaumiumReinforcedJar.java @@ -53,7 +53,7 @@ public class Block_ThaumiumReinforcedJar extends BlockJar { @Override @SideOnly(Side.CLIENT) - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"unchecked"}) public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { par3List.add(new ItemStack(par1, 1, 0)); // Normal jar par3List.add(new ItemStack(par1, 1, 3)); // Void jar @@ -71,35 +71,42 @@ public class Block_ThaumiumReinforcedJar extends BlockJar { @Override public void breakBlock(World world, int x, int y, int z, Block par5, int par6) { final TileEntity te = world.getTileEntity(x, y, z); - if(te != null && te instanceof TE_ThaumiumReinforcedJar) { + if(te instanceof TE_ThaumiumReinforcedJar) { final TE_ThaumiumReinforcedJar ite = (TE_ThaumiumReinforcedJar) te; - if(ite.amount > 0) { - // Create a small explosion in the center of the block (TNT has strength 4.0F) - world.createExplosion(null, x + 0.5D, y + 0.5D, z + 0.5D, 1.0F, false); - - // Place some Flux in the area - final int limit = ite.amount / 16; - int created = 0; - for(int i = 0; i < 50; i++) { - final int xf = x + world.rand.nextInt(4) - world.rand.nextInt(4); - final int yf = x + world.rand.nextInt(4) - world.rand.nextInt(4); - final int zf = x + world.rand.nextInt(4) - world.rand.nextInt(4); - if(world.isAirBlock(xf, yf, zf)) { - if(yf > y) { - world.setBlock(xf, yf, zf, ConfigBlocks.blockFluxGas, 8, 3); - } else { - world.setBlock(xf, yf, zf, ConfigBlocks.blockFluxGoo, 8, 3); - } - - if(created++ > limit) { - break; - } + breakBlockWarpy(world, x, y, z, ite.amount, 50, 1.0F); + } else if(te instanceof TE_ThaumiumReinforcedVoidJar) { + final TE_ThaumiumReinforcedVoidJar ite = (TE_ThaumiumReinforcedVoidJar) te; + breakBlockWarpy(world, x, y, z, ite.amount, 50, 1.0F); + } + + super.breakBlock(world, x, y, z, par5, par6); + } + + private void breakBlockWarpy(World world, int x, int y, int z, int fillAmount, int iterations, float explosionStrength){ + if(fillAmount > 0) { + // Create a decent explosion in the center of the block (TNT has strength 4.0F) + world.createExplosion(null, x + 0.5D, y + 0.5D, z + 0.5D, explosionStrength, false); + + // Place a lot of Flux in the area + final int limit = fillAmount / 16; + int created = 0; + for(int i = 0; i < iterations; i++) { + final int xf = x + world.rand.nextInt(7) - world.rand.nextInt(7); + final int yf = x + world.rand.nextInt(7) - world.rand.nextInt(7); + final int zf = x + world.rand.nextInt(7) - world.rand.nextInt(7); + if(world.isAirBlock(xf, yf, zf)) { + if(yf > y) { + world.setBlock(xf, yf, zf, ConfigBlocks.blockFluxGas, 8, 3); + } else { + world.setBlock(xf, yf, zf, ConfigBlocks.blockFluxGoo, 8, 3); + } + + if(created++ > limit) { + break; } } } } - - super.breakBlock(world, x, y, z, par5, par6); } @Override diff --git a/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java b/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java index 6afa33b91e..d81c5eb8c3 100644 --- a/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java +++ b/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java @@ -16,6 +16,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynam import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.objects.GT_RenderedTexture; +import kekztech.KekzCore; import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; @@ -292,6 +293,8 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_MultiBlock } } + KekzCore.LOGGER.info("Found " + mDynamoTunnelsTT.size() + "Laser Source Hatches"); + KekzCore.LOGGER.info("Found " + mEnergyTunnelsTT.size() + "Laser Target Hatches"); // Glass has to be at least UV-tier to allow TT Laser hatches if(colourCorrectedMeta < 5) { if(mEnergyTunnelsTT.size() > 0 || mDynamoTunnelsTT.size() > 0) { @@ -427,6 +430,7 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_MultiBlock final BigInteger recampLimited = (MAX_LONG.compareTo(remcapActual) > 0) ? remcapActual : MAX_LONG; final long power = Math.min(eHatch.maxEUInput() * eHatch.maxAmperesIn(), recampLimited.longValue()); if(power <= eHatch.getEUVar()) { + KekzCore.LOGGER.info("Tried to take " + power + "EU from a Laser Target Hatch"); eHatch.setEUVar(eHatch.getEUVar() - power); stored = stored.add(BigInteger.valueOf(power)); } @@ -439,6 +443,7 @@ public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_MultiBlock final BigInteger remStoredLimited = (MAX_LONG.compareTo(stored) > 0) ? stored : MAX_LONG; final long power = Math.min(eDynamo.maxEUOutput() * eDynamo.maxAmperesOut(), remStoredLimited.longValue()); if(eDynamo.getEUVar() <= eDynamo.maxEUStore() - power) { + KekzCore.LOGGER.info("Tried to inject " + power + "EU into a Laser Source Hatch"); eDynamo.setEUVar(eDynamo.getEUVar() + power); stored = stored.subtract(BigInteger.valueOf(power)); } diff --git a/src/main/java/items/Item_IchorJarFilled.java b/src/main/java/items/Item_IchorJarFilled.java deleted file mode 100644 index 1b62c3f29f..0000000000 --- a/src/main/java/items/Item_IchorJarFilled.java +++ /dev/null @@ -1,118 +0,0 @@ -package items; - -import common.Blocks; -import common.tileentities.TE_IchorJar; -import cpw.mods.fml.common.registry.GameRegistry; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import thaumcraft.api.aspects.Aspect; -import thaumcraft.api.aspects.AspectList; -import thaumcraft.common.blocks.ItemJarFilled; - -public class Item_IchorJarFilled extends ItemJarFilled { - - private static final Item_IchorJarFilled instance = new Item_IchorJarFilled(); - - private Item_IchorJarFilled() { - super(); - } - - public static Item_IchorJarFilled getInstance() { - return instance; - } - - public void registerItem() { - super.setHasSubtypes(false); - final String unlocalizedName = "kekztech_ichorjarfilled_item"; - super.setUnlocalizedName(unlocalizedName); - GameRegistry.registerItem(getInstance(), unlocalizedName); - } - - @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, - float par8, float par9, float par10) { - - final Block block = world.getBlock(x, y, z); - if(block == net.minecraft.init.Blocks.snow_layer && (world.getBlockMetadata(x, y, z) & 7) < 1) { - side = 1; - } else if(block != net.minecraft.init.Blocks.vine && block != net.minecraft.init.Blocks.tallgrass - && block != net.minecraft.init.Blocks.deadbush && !block.isReplaceable(world, x, y, z)) { - // Displace target location if original target can't be replaced - if(side == 0) { - y--; - } - if(side == 1) { - y++; - } - if(side == 2) { - z--; - } - if(side == 3) { - z++; - } - if(side == 4) { - x--; - } - if(side == 5) { - x++; - } - } - - if(stack.stackSize == 0) { - return false; - } else if(!player.canPlayerEdit(x, y, z, side, stack)) { - return false; - } else if(world.canPlaceEntityOnSide(Blocks.jarIchor, x, y, z, - false, side, player, stack)) { - - final Block jar = Blocks.jarIchor; - final int meta = this.getMetadata(stack.getItemDamage()); - final int idk = block.onBlockPlaced(world, x, y, z, side, par8, par9, par10, meta); - - if(placeBlockAt(stack, player, world, x, y, z, side, par9, par9, par10, idk)) { - - final TileEntity te = world.getTileEntity(x, y, z); - if(te != null && te instanceof TE_IchorJar && stack.hasTagCompound()) { - - final AspectList aspects = getAspects(stack); - if(aspects != null && aspects.size() == 1) { - ((TE_IchorJar) te).amount = aspects.getAmount(aspects.getAspects()[0]); - ((TE_IchorJar) te).aspect = aspects.getAspects()[0]; - } - - final String filter = stack.stackTagCompound.getString("AspectFilter"); - if(filter != null) { - ((TE_IchorJar) te).aspectFilter = Aspect.getAspect(filter); - } - } - - world.playSoundEffect((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), - (double) ((float) z + 0.5F), jar.stepSound.func_150496_b(), - (jar.stepSound.getVolume() + 1.0F) / 2.0F, jar.stepSound.getPitch() * 0.8F); - --stack.stackSize; - } - - return true; - } else { - return false; - } - } - - @Override - public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, - float hitX, float hitY, float hitZ, int metadata) { - if (!world.setBlock(x, y, z, Blocks.jarIchor, metadata, 3)) { - return false; - } else { - if (world.getBlock(x, y, z) == Blocks.jarIchor) { - Blocks.jarIchor.onBlockPlacedBy(world, x, y, z, player, stack); - Blocks.jarIchor.onPostBlockPlaced(world, x, y, z, metadata); - } - - return true; - } - } -} diff --git a/src/main/java/items/Item_ThaumiumReinforcedJarFilled.java b/src/main/java/items/Item_ThaumiumReinforcedJarFilled.java deleted file mode 100644 index 47b37837b7..0000000000 --- a/src/main/java/items/Item_ThaumiumReinforcedJarFilled.java +++ /dev/null @@ -1,118 +0,0 @@ -package items; - -import common.Blocks; -import common.tileentities.TE_ThaumiumReinforcedJar; -import cpw.mods.fml.common.registry.GameRegistry; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import thaumcraft.api.aspects.Aspect; -import thaumcraft.api.aspects.AspectList; -import thaumcraft.common.blocks.ItemJarFilled; - -public class Item_ThaumiumReinforcedJarFilled extends ItemJarFilled { - - private static final Item_ThaumiumReinforcedJarFilled instance = new Item_ThaumiumReinforcedJarFilled(); - - private Item_ThaumiumReinforcedJarFilled() { - super(); - } - - public static Item_ThaumiumReinforcedJarFilled getInstance() { - return instance; - } - - public void registerItem() { - super.setHasSubtypes(false); - final String unlocalizedName = "kekztech_thaumiumreinforcedjarfilled_item"; - super.setUnlocalizedName(unlocalizedName); - GameRegistry.registerItem(getInstance(), unlocalizedName); - } - - @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, - float par8, float par9, float par10) { - - final Block block = world.getBlock(x, y, z); - if(block == net.minecraft.init.Blocks.snow_layer && (world.getBlockMetadata(x, y, z) & 7) < 1) { - side = 1; - } else if(block != net.minecraft.init.Blocks.vine && block != net.minecraft.init.Blocks.tallgrass - && block != net.minecraft.init.Blocks.deadbush && !block.isReplaceable(world, x, y, z)) { - // Displace target location if original target can't be replaced - if(side == 0) { - y--; - } - if(side == 1) { - y++; - } - if(side == 2) { - z--; - } - if(side == 3) { - z++; - } - if(side == 4) { - x--; - } - if(side == 5) { - x++; - } - } - - if(stack.stackSize == 0) { - return false; - } else if(!player.canPlayerEdit(x, y, z, side, stack)) { - return false; - } else if(world.canPlaceEntityOnSide(Blocks.jarThaumiumReinforced, x, y, z, - false, side, player, stack)) { - - final Block jar = Blocks.jarThaumiumReinforced; - final int meta = this.getMetadata(stack.getItemDamage()); - final int idk = block.onBlockPlaced(world, x, y, z, side, par8, par9, par10, meta); - - if(placeBlockAt(stack, player, world, x, y, z, side, par9, par9, par10, idk)) { - - final TileEntity te = world.getTileEntity(x, y, z); - if(te != null && te instanceof TE_ThaumiumReinforcedJar && stack.hasTagCompound()) { - - final AspectList aspects = getAspects(stack); - if(aspects != null && aspects.size() == 1) { - ((TE_ThaumiumReinforcedJar) te).amount = aspects.getAmount(aspects.getAspects()[0]); - ((TE_ThaumiumReinforcedJar) te).aspect = aspects.getAspects()[0]; - } - - final String filter = stack.stackTagCompound.getString("AspectFilter"); - if(filter != null) { - ((TE_ThaumiumReinforcedJar) te).aspectFilter = Aspect.getAspect(filter); - } - } - - world.playSoundEffect((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), - (double) ((float) z + 0.5F), jar.stepSound.func_150496_b(), - (jar.stepSound.getVolume() + 1.0F) / 2.0F, jar.stepSound.getPitch() * 0.8F); - --stack.stackSize; - } - - return true; - } else { - return false; - } - } - - @Override - public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, - float hitX, float hitY, float hitZ, int metadata) { - if (!world.setBlock(x, y, z, Blocks.jarThaumiumReinforced, metadata, 3)) { - return false; - } else { - if (world.getBlock(x, y, z) == Blocks.jarThaumiumReinforced) { - Blocks.jarThaumiumReinforced.onBlockPlacedBy(world, x, y, z, player, stack); - Blocks.jarThaumiumReinforced.onPostBlockPlaced(world, x, y, z, metadata); - } - - return true; - } - } -} diff --git a/src/main/java/kekztech/KekzCore.java b/src/main/java/kekztech/KekzCore.java index 7fcafe1d77..232e2ede1d 100644 --- a/src/main/java/kekztech/KekzCore.java +++ b/src/main/java/kekztech/KekzCore.java @@ -59,8 +59,6 @@ public class KekzCore { //Item_Configurator.getInstance().registerItem();
Items.registerOreDictNames();
- //Item_ThaumiumReinforcedJarFilled.getInstance().registerItem();
-
Blocks.preInit();
// Register TileEntities
diff --git a/src/main/resources/assets/kekztech/lang/en_US.lang b/src/main/resources/assets/kekztech/lang/en_US.lang index 5a7829e4fa..f25ebcbb33 100644 --- a/src/main/resources/assets/kekztech/lang/en_US.lang +++ b/src/main/resources/assets/kekztech/lang/en_US.lang @@ -159,10 +159,6 @@ tile.kekztech_lapotronicenergyunit_block.desc=Part of the Lapotronic Super Capac tile.kekztech_thaumiumreinforcedjar_block.0.name=Thaumium Reinforced Jar
tile.kekztech_thaumiumreinforcedjar_block.3.name=Thaumium Reinforced Void Jar
-# -------- Thaumium Reinforced Jar: Items
-item.kekztech_thaumiumreinforcedjarfilled_item.name=Thaumium Reinforced Jar with Essentia
-item.kekztech_thaumiumreinforcedjarfilled_item.void.name=Thaumium Reinforced Void Jar with Essentia
-
# -------- Thaumium Reinforced Jar: Research
# This is the name of the research
tc.research_name.THAUMIUMREINFORCEDJAR=Thaumium Reinforced Jars
@@ -176,10 +172,6 @@ kekztech.research_page.THAUMIUMREINFORCEDJAR.1=Compressing this much Essentia in tile.kekztech_ichorjar_block.0.name=Ichor Jar
tile.kekztech_ichorjar_block.3.name=Ichor Void Jar
-# -------- Ichor Jar: Items
-item.kekztech_ichorjarfilled_item.name=Ichor Jar with Essentia
-item.kekztech_ichorjarfilled_item.void.name=Ichor Void Jar with Essentia
-
# -------- Ichor Jar: Research
tc.research_name.ICHORJAR=Ichor Jars
kekztech.research_page.ICHORJAR=Much better jars
|