diff --git a/assets/hbm/lang/de_DE.lang b/assets/hbm/lang/de_DE.lang index 7d68af631..e2de021c8 100644 --- a/assets/hbm/lang/de_DE.lang +++ b/assets/hbm/lang/de_DE.lang @@ -1607,6 +1607,9 @@ item.clip_defabricator.name=Gürtel mit Defabrikator-Energiezellen item.ammo_container.name=Munitionsbehälter tile.block_schrabidium.name=Schrabidiumblock +tile.block_euphemium.name=Euphemiumblock +tile.block_schrabidium_cluster.name=Schrabidium-Cluster +tile.block_euphemium_cluster.name=Euphemiumgeätzter Schrabidium-Cluster item.plate_gold.name=Goldplatte item.syringe_empty.name=Leere Spritze diff --git a/assets/hbm/lang/en_US.lang b/assets/hbm/lang/en_US.lang index bb8e0415c..976d8457a 100644 --- a/assets/hbm/lang/en_US.lang +++ b/assets/hbm/lang/en_US.lang @@ -1607,6 +1607,9 @@ item.clip_defabricator.name=Belt with Defabricator Energy Cells item.ammo_container.name=Ammo Container tile.block_schrabidium.name=Block of Schrabidium +tile.block_euphemium.name=Block of Euphemium +tile.block_schrabidium_cluster.name=Schrabidium Cluster +tile.block_euphemium_cluster.name=Euphemium-Etched Schrabidium Cluster item.plate_gold.name=Gold Plate item.syringe_empty.name=Empty Syringe diff --git a/assets/hbm/sounds.json b/assets/hbm/sounds.json index 2fbea25a9..53602e42e 100644 --- a/assets/hbm/sounds.json +++ b/assets/hbm/sounds.json @@ -169,5 +169,6 @@ "alarm.airRaid": {"category": "record", "sounds": [{"name": "alarm/airRaid", "stream": true}]}, "alarm.classic": {"category": "record", "sounds": [{"name": "alarm/classicSiren", "stream": false}]}, "alarm.gambit": {"category": "record", "sounds": [{"name": "alarm/gambit", "stream": true}]}, - "alarm.soyuzed": {"category": "record", "sounds": [{"name": "alarm/soyuzed", "stream": false}]} + "alarm.soyuzed": {"category": "record", "sounds": [{"name": "alarm/soyuzed", "stream": false}]}, + "alarm.chime": {"category": "record", "sounds": [{"name": "alarm/chime", "stream": false}]} } diff --git a/assets/hbm/sounds/alarm/chime.ogg b/assets/hbm/sounds/alarm/chime.ogg new file mode 100644 index 000000000..5aa1c2835 Binary files /dev/null and b/assets/hbm/sounds/alarm/chime.ogg differ diff --git a/assets/hbm/textures/blocks/block_euphemium.png b/assets/hbm/textures/blocks/block_euphemium.png new file mode 100644 index 000000000..804a764ed Binary files /dev/null and b/assets/hbm/textures/blocks/block_euphemium.png differ diff --git a/assets/hbm/textures/blocks/block_euphemium_cluster_side.png b/assets/hbm/textures/blocks/block_euphemium_cluster_side.png new file mode 100644 index 000000000..d68f2853d Binary files /dev/null and b/assets/hbm/textures/blocks/block_euphemium_cluster_side.png differ diff --git a/assets/hbm/textures/blocks/block_euphemium_cluster_top.png b/assets/hbm/textures/blocks/block_euphemium_cluster_top.png new file mode 100644 index 000000000..1b38c8141 Binary files /dev/null and b/assets/hbm/textures/blocks/block_euphemium_cluster_top.png differ diff --git a/assets/hbm/textures/blocks/block_schrabidium_cluster_side.png b/assets/hbm/textures/blocks/block_schrabidium_cluster_side.png new file mode 100644 index 000000000..b77fff649 Binary files /dev/null and b/assets/hbm/textures/blocks/block_schrabidium_cluster_side.png differ diff --git a/assets/hbm/textures/blocks/block_schrabidium_cluster_top.png b/assets/hbm/textures/blocks/block_schrabidium_cluster_top.png new file mode 100644 index 000000000..c2d7c1d31 Binary files /dev/null and b/assets/hbm/textures/blocks/block_schrabidium_cluster_top.png differ diff --git a/assets/hbm/textures/gui/satellites/gui_sat_coord.png b/assets/hbm/textures/gui/satellites/gui_sat_coord.png index 808b651f6..8b329b3f4 100644 Binary files a/assets/hbm/textures/gui/satellites/gui_sat_coord.png and b/assets/hbm/textures/gui/satellites/gui_sat_coord.png differ diff --git a/assets/hbm/textures/items/new/scrap_advanced.png b/assets/hbm/textures/items/new/scrap_advanced.png new file mode 100644 index 000000000..2d51d0029 Binary files /dev/null and b/assets/hbm/textures/items/new/scrap_advanced.png differ diff --git a/assets/hbm/textures/items/new/scrap_aluminium.png b/assets/hbm/textures/items/new/scrap_aluminium.png new file mode 100644 index 000000000..3cffda3af Binary files /dev/null and b/assets/hbm/textures/items/new/scrap_aluminium.png differ diff --git a/assets/hbm/textures/items/new/scrap_beryllium.png b/assets/hbm/textures/items/new/scrap_beryllium.png new file mode 100644 index 000000000..276ab7129 Binary files /dev/null and b/assets/hbm/textures/items/new/scrap_beryllium.png differ diff --git a/assets/hbm/textures/items/new/scrap_cmb.png b/assets/hbm/textures/items/new/scrap_cmb.png new file mode 100644 index 000000000..660030c2e Binary files /dev/null and b/assets/hbm/textures/items/new/scrap_cmb.png differ diff --git a/assets/hbm/textures/items/new/scrap_copper.png b/assets/hbm/textures/items/new/scrap_copper.png new file mode 100644 index 000000000..e2c63b904 Binary files /dev/null and b/assets/hbm/textures/items/new/scrap_copper.png differ diff --git a/assets/hbm/textures/items/new/scrap_desh.png b/assets/hbm/textures/items/new/scrap_desh.png new file mode 100644 index 000000000..bdbaccfd8 Binary files /dev/null and b/assets/hbm/textures/items/new/scrap_desh.png differ diff --git a/assets/hbm/textures/items/new/scrap_dineutronium.png b/assets/hbm/textures/items/new/scrap_dineutronium.png new file mode 100644 index 000000000..19f190340 Binary files /dev/null and b/assets/hbm/textures/items/new/scrap_dineutronium.png differ diff --git a/assets/hbm/textures/items/new/scrap_dura_steel.png b/assets/hbm/textures/items/new/scrap_dura_steel.png new file mode 100644 index 000000000..087c9990c Binary files /dev/null and b/assets/hbm/textures/items/new/scrap_dura_steel.png differ diff --git a/assets/hbm/textures/items/new/scrap_iron.png b/assets/hbm/textures/items/new/scrap_iron.png new file mode 100644 index 000000000..6aff99790 Binary files /dev/null and b/assets/hbm/textures/items/new/scrap_iron.png differ diff --git a/assets/hbm/textures/items/new/scrap_lead.png b/assets/hbm/textures/items/new/scrap_lead.png new file mode 100644 index 000000000..b0a716814 Binary files /dev/null and b/assets/hbm/textures/items/new/scrap_lead.png differ diff --git a/assets/hbm/textures/items/new/scrap_magnetized_tungsten.png b/assets/hbm/textures/items/new/scrap_magnetized_tungsten.png new file mode 100644 index 000000000..0370d4fd5 Binary files /dev/null and b/assets/hbm/textures/items/new/scrap_magnetized_tungsten.png differ diff --git a/assets/hbm/textures/items/new/scrap_neptunium.png b/assets/hbm/textures/items/new/scrap_neptunium.png new file mode 100644 index 000000000..b20e602db Binary files /dev/null and b/assets/hbm/textures/items/new/scrap_neptunium.png differ diff --git a/assets/hbm/textures/items/new/scrap_plutonium.png b/assets/hbm/textures/items/new/scrap_plutonium.png new file mode 100644 index 000000000..c919776be Binary files /dev/null and b/assets/hbm/textures/items/new/scrap_plutonium.png differ diff --git a/assets/hbm/textures/items/new/scrap_red_copper.png b/assets/hbm/textures/items/new/scrap_red_copper.png new file mode 100644 index 000000000..596564154 Binary files /dev/null and b/assets/hbm/textures/items/new/scrap_red_copper.png differ diff --git a/assets/hbm/textures/items/new/scrap_saturnite.png b/assets/hbm/textures/items/new/scrap_saturnite.png new file mode 100644 index 000000000..45e3b41b1 Binary files /dev/null and b/assets/hbm/textures/items/new/scrap_saturnite.png differ diff --git a/assets/hbm/textures/items/new/scrap_schrabidium.png b/assets/hbm/textures/items/new/scrap_schrabidium.png new file mode 100644 index 000000000..f07269017 Binary files /dev/null and b/assets/hbm/textures/items/new/scrap_schrabidium.png differ diff --git a/assets/hbm/textures/items/new/scrap_steel.png b/assets/hbm/textures/items/new/scrap_steel.png new file mode 100644 index 000000000..255612cde Binary files /dev/null and b/assets/hbm/textures/items/new/scrap_steel.png differ diff --git a/assets/hbm/textures/items/new/scrap_titanium.png b/assets/hbm/textures/items/new/scrap_titanium.png new file mode 100644 index 000000000..d7005bdb2 Binary files /dev/null and b/assets/hbm/textures/items/new/scrap_titanium.png differ diff --git a/assets/hbm/textures/items/new/scrap_tungsten.png b/assets/hbm/textures/items/new/scrap_tungsten.png new file mode 100644 index 000000000..b1158b01d Binary files /dev/null and b/assets/hbm/textures/items/new/scrap_tungsten.png differ diff --git a/assets/hbm/textures/items/new/scrap_uranium.png b/assets/hbm/textures/items/new/scrap_uranium.png new file mode 100644 index 000000000..1dd1b99a1 Binary files /dev/null and b/assets/hbm/textures/items/new/scrap_uranium.png differ diff --git a/com/hbm/blocks/ModBlocks.java b/com/hbm/blocks/ModBlocks.java index ab6e14f02..9b4a21825 100644 --- a/com/hbm/blocks/ModBlocks.java +++ b/com/hbm/blocks/ModBlocks.java @@ -5,12 +5,10 @@ import com.hbm.blocks.bomb.*; import com.hbm.blocks.fluid.*; import com.hbm.blocks.machine.*; import com.hbm.blocks.test.*; +import com.hbm.items.block.ItemBlockLore; +import com.hbm.items.block.ItemTaintBlock; import com.hbm.items.bomb.ItemPrototypeBlock; -import com.hbm.items.special.ItemBlockLore; import com.hbm.items.special.ItemOreBlock; -import com.hbm.items.special.ItemPlasmaBlock; -import com.hbm.items.special.ItemSchrabidiumBlock; -import com.hbm.items.special.ItemTaintBlock; import com.hbm.lib.ModDamageSource; import com.hbm.lib.RefStrings; import com.hbm.main.MainRegistry; @@ -111,6 +109,9 @@ public class ModBlocks { public static Block block_electrical_scrap; public static Block block_beryllium; public static Block block_schrabidium; + public static Block block_euphemium; + public static Block block_schrabidium_cluster; + public static Block block_euphemium_cluster; public static Block block_advanced_alloy; public static Block block_magnetized_tungsten; public static Block block_combine_steel; @@ -827,6 +828,9 @@ public class ModBlocks { block_electrical_scrap = new BlockFalling(Material.iron).setBlockName("block_electrical_scrap").setCreativeTab(MainRegistry.blockTab).setHardness(2.5F).setResistance(5.0F).setStepSound(Block.soundTypeMetal).setBlockTextureName(RefStrings.MODID + ":electrical_scrap_alt2"); block_beryllium = new BlockGeneric(Material.iron).setBlockName("block_beryllium").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_beryllium"); block_schrabidium = new BlockGeneric(Material.iron).setBlockName("block_schrabidium").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(600.0F).setBlockTextureName(RefStrings.MODID + ":block_schrabidium"); + block_euphemium = new BlockGeneric(Material.iron).setBlockName("block_euphemium").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(60000.0F).setBlockTextureName(RefStrings.MODID + ":block_euphemium"); + block_schrabidium_cluster = new BlockGenericPillar(Material.rock).setBlockName("block_schrabidium_cluster").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(60000.0F); + block_euphemium_cluster = new BlockGenericPillar(Material.rock).setBlockName("block_euphemium_cluster").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(60000.0F); block_advanced_alloy = new BlockGeneric(Material.iron).setBlockName("block_advanced_alloy").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_advanced_alloy"); block_magnetized_tungsten = new BlockGeneric(Material.iron).setBlockName("block_magnetized_tungsten").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(35.0F).setBlockTextureName(RefStrings.MODID + ":block_magnetized_tungsten"); block_combine_steel = new BlockGeneric(Material.iron).setBlockName("block_combine_steel").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(600.0F).setBlockTextureName(RefStrings.MODID + ":block_combine_steel"); @@ -1357,7 +1361,7 @@ public class ModBlocks { GameRegistry.registerBlock(ore_oil_sand, ore_oil_sand.getUnlocalizedName()); GameRegistry.registerBlock(ore_lignite, ore_lignite.getUnlocalizedName()); GameRegistry.registerBlock(ore_asbestos, ore_asbestos.getUnlocalizedName()); - GameRegistry.registerBlock(ore_schrabidium, ItemSchrabidiumBlock.class, ore_schrabidium.getUnlocalizedName()); + GameRegistry.registerBlock(ore_schrabidium, ItemBlockLore.class, ore_schrabidium.getUnlocalizedName()); //Rare Minerals GameRegistry.registerBlock(ore_australium, ItemOreBlock.class, ore_australium.getUnlocalizedName()); @@ -1374,7 +1378,7 @@ public class ModBlocks { GameRegistry.registerBlock(ore_nether_tungsten, ore_nether_tungsten.getUnlocalizedName()); GameRegistry.registerBlock(ore_nether_sulfur, ore_nether_sulfur.getUnlocalizedName()); GameRegistry.registerBlock(ore_nether_fire, ore_nether_fire.getUnlocalizedName()); - GameRegistry.registerBlock(ore_nether_schrabidium, ItemSchrabidiumBlock.class, ore_nether_schrabidium.getUnlocalizedName()); + GameRegistry.registerBlock(ore_nether_schrabidium, ItemBlockLore.class, ore_nether_schrabidium.getUnlocalizedName()); //Meteor Ores GameRegistry.registerBlock(ore_meteor_uranium, ore_meteor_uranium.getUnlocalizedName()); @@ -1413,7 +1417,10 @@ public class ModBlocks { GameRegistry.registerBlock(block_asbestos, block_asbestos.getUnlocalizedName()); GameRegistry.registerBlock(block_trinitite, block_trinitite.getUnlocalizedName()); GameRegistry.registerBlock(block_waste, block_waste.getUnlocalizedName()); - GameRegistry.registerBlock(block_schrabidium, ItemSchrabidiumBlock.class, block_schrabidium.getUnlocalizedName()); + GameRegistry.registerBlock(block_schrabidium, ItemBlockLore.class, block_schrabidium.getUnlocalizedName()); + GameRegistry.registerBlock(block_euphemium, ItemBlockLore.class, block_euphemium.getUnlocalizedName()); + GameRegistry.registerBlock(block_schrabidium_cluster, ItemBlockLore.class, block_schrabidium_cluster.getUnlocalizedName()); + GameRegistry.registerBlock(block_euphemium_cluster, ItemBlockLore.class, block_euphemium_cluster.getUnlocalizedName()); GameRegistry.registerBlock(block_magnetized_tungsten, block_magnetized_tungsten.getUnlocalizedName()); GameRegistry.registerBlock(block_combine_steel, block_combine_steel.getUnlocalizedName()); GameRegistry.registerBlock(block_desh, block_desh.getUnlocalizedName()); @@ -1763,7 +1770,7 @@ public class ModBlocks { GameRegistry.registerBlock(fusion_heater, fusion_heater.getUnlocalizedName()); GameRegistry.registerBlock(fusion_hatch, fusion_hatch.getUnlocalizedName()); GameRegistry.registerBlock(fusion_core, fusion_core.getUnlocalizedName()); - GameRegistry.registerBlock(plasma, ItemPlasmaBlock.class, plasma.getUnlocalizedName()); + GameRegistry.registerBlock(plasma, ItemBlockLore.class, plasma.getUnlocalizedName()); GameRegistry.registerBlock(watz_element, watz_element.getUnlocalizedName()); GameRegistry.registerBlock(watz_control, watz_control.getUnlocalizedName()); diff --git a/com/hbm/blocks/generic/BlockGenericPillar.java b/com/hbm/blocks/generic/BlockGenericPillar.java index 05d1647ae..ec15da2e5 100644 --- a/com/hbm/blocks/generic/BlockGenericPillar.java +++ b/com/hbm/blocks/generic/BlockGenericPillar.java @@ -1,5 +1,6 @@ package com.hbm.blocks.generic; +import com.hbm.blocks.ModBlocks; import com.hbm.lib.RefStrings; import cpw.mods.fml.relauncher.Side; @@ -21,8 +22,18 @@ public class BlockGenericPillar extends BlockRotatedPillar { @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister reg) { - this.field_150164_N = reg.registerIcon(RefStrings.MODID + ":meteor_pillar_top"); - this.iconSide = reg.registerIcon(RefStrings.MODID + ":meteor_pillar"); + if(this == ModBlocks.meteor_pillar) { + this.field_150164_N = reg.registerIcon(RefStrings.MODID + ":meteor_pillar_top"); + this.iconSide = reg.registerIcon(RefStrings.MODID + ":meteor_pillar"); + } + if(this == ModBlocks.block_schrabidium_cluster) { + this.field_150164_N = reg.registerIcon(RefStrings.MODID + ":block_schrabidium_cluster_top"); + this.iconSide = reg.registerIcon(RefStrings.MODID + ":block_schrabidium_cluster_side"); + } + if(this == ModBlocks.block_euphemium_cluster) { + this.field_150164_N = reg.registerIcon(RefStrings.MODID + ":block_euphemium_cluster_top"); + this.iconSide = reg.registerIcon(RefStrings.MODID + ":block_euphemium_cluster_side"); + } } @Override diff --git a/com/hbm/blocks/generic/WasteLog.java b/com/hbm/blocks/generic/WasteLog.java index ba2e7042b..6c235ef7a 100644 --- a/com/hbm/blocks/generic/WasteLog.java +++ b/com/hbm/blocks/generic/WasteLog.java @@ -1,8 +1,10 @@ package com.hbm.blocks.generic; +import java.util.ArrayList; import java.util.Random; import com.hbm.blocks.ModBlocks; +import com.hbm.items.ModItems; import com.hbm.lib.RefStrings; import cpw.mods.fml.relauncher.Side; @@ -12,7 +14,9 @@ import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.init.Items; import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; +import net.minecraft.world.World; public class WasteLog extends Block { @@ -37,7 +41,7 @@ public class WasteLog extends Block { } @Override - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) + public Item getItemDropped(int i, Random rand, int j) { if(this == ModBlocks.waste_log) { @@ -50,6 +54,17 @@ public class WasteLog extends Block { return null; } + + public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { + + if(this == ModBlocks.waste_log && world.rand.nextInt(1000) == 0) { + ArrayList ret = new ArrayList(); + ret.add(new ItemStack(ModItems.burnt_bark)); + return ret; + } + + return super.getDrops(world, x, y, z, metadata, fortune); + } @Override public int quantityDropped(Random p_149745_1_) diff --git a/com/hbm/entity/projectile/EntityTom.java b/com/hbm/entity/projectile/EntityTom.java index a863f1cc5..7ded15ecd 100644 --- a/com/hbm/entity/projectile/EntityTom.java +++ b/com/hbm/entity/projectile/EntityTom.java @@ -24,13 +24,9 @@ public class EntityTom extends EntityThrowable { this.lastTickPosZ = this.prevPosZ = posZ; this.setPosition(posX + this.motionX, posY + this.motionY, posZ + this.motionZ); - /*this.prevPosX = this.posX; - this.prevPosY = this.posY; - this.prevPosZ = this.posZ; - - this.posX += this.motionX; - this.posY += this.motionY; - this.posZ += this.motionZ;*/ + if(this.ticksExisted % 100 == 0) { + worldObj.playSoundEffect(posX, posY, posZ, "hbm:alarm.chime", 10000, 1.0F); + } motionY = -0.5; diff --git a/com/hbm/explosion/ExplosionBalefire.java b/com/hbm/explosion/ExplosionBalefire.java index c0f422121..804e2e4da 100644 --- a/com/hbm/explosion/ExplosionBalefire.java +++ b/com/hbm/explosion/ExplosionBalefire.java @@ -93,8 +93,12 @@ public class ExplosionBalefire while(y > 0) { if(strength <= 10) { - if(worldObj.rand.nextInt(10) == 0) + if(worldObj.rand.nextInt(10) == 0) { worldObj.setBlock(pX, y + 1, pZ, ModBlocks.balefire); + + if(worldObj.getBlock(pX, y, pZ) == ModBlocks.block_schrabidium_cluster) + worldObj.setBlock(pX, y, pZ, ModBlocks.block_euphemium_cluster, worldObj.getBlockMetadata(pX, y, pZ), 3); + } if(worldObj.getBlock(pX, y, pZ) == Blocks.stone) worldObj.setBlock(pX, y, pZ, ModBlocks.sellafield_slaked); diff --git a/com/hbm/inventory/MachineRecipes.java b/com/hbm/inventory/MachineRecipes.java index 370c2c500..c3ca2cb40 100644 --- a/com/hbm/inventory/MachineRecipes.java +++ b/com/hbm/inventory/MachineRecipes.java @@ -215,6 +215,10 @@ public class MachineRecipes { ItemStack[] starmetal = new ItemStack[] { new ItemStack(ModItems.powder_dura_steel, 3), new ItemStack(ModItems.powder_astatine, 1), new ItemStack(ModItems.powder_cobalt, 2), new ItemStack(Blocks.gravel, 1) }; + + ItemStack[] euphCluster = new ItemStack[] { new ItemStack(ModItems.nugget_euphemium, 7), + new ItemStack(ModItems.powder_schrabidium, 4), new ItemStack(ModItems.ingot_starmetal, 2), + new ItemStack(ModItems.nugget_solinium, 2) }; if (MainRegistry.enableDebugMode) { if (item.getItem() == Item.getItemFromBlock(ModBlocks.test_render)) { @@ -366,6 +370,10 @@ public class MachineRecipes { return starmetal; } + if (item.getItem() == Item.getItemFromBlock(ModBlocks.block_euphemium_cluster)) { + return euphCluster; + } + return null; } @@ -1316,6 +1324,8 @@ public class MachineRecipes { getCentrifugeOutput(new ItemStack(ModBlocks.ore_lignite))); recipes.put(new ItemStack(ModBlocks.ore_meteor_starmetal), getCentrifugeOutput(new ItemStack(ModBlocks.ore_meteor_starmetal))); + recipes.put(new ItemStack(ModBlocks.block_euphemium_cluster), + getCentrifugeOutput(new ItemStack(ModBlocks.block_euphemium_cluster))); return recipes; } @@ -5031,6 +5041,7 @@ public class MachineRecipes { list.add(new ItemStack(ModItems.dynosphere_schrabidium_charged, 1)); list.add(new ItemStack(ModItems.ingot_plutonium, 1)); list.add(new ItemStack(ModItems.catalyst_clay, 16)); + list.add(new ItemStack(ModItems.ingot_euphemium, 1)); break; case DYN_DNT: list.add(new ItemStack(ModItems.dynosphere_euphemium_charged, 2)); @@ -5352,7 +5363,7 @@ public class MachineRecipes { output[0] = new ItemStack(ModItems.ingot_schrabidium, 1); break; case DYN_EUPH: - output[0] = new ItemStack(ModItems.ingot_euphemium, 1); + output[0] = new ItemStack(ModItems.nugget_euphemium, 12); break; case DYN_DNT: output[0] = new ItemStack(ModItems.ingot_dineutronium, 1); diff --git a/com/hbm/inventory/gui/GUIScreenSatCoord.java b/com/hbm/inventory/gui/GUIScreenSatCoord.java index 7e9ee1df0..b3ea77400 100644 --- a/com/hbm/inventory/gui/GUIScreenSatCoord.java +++ b/com/hbm/inventory/gui/GUIScreenSatCoord.java @@ -1,17 +1,14 @@ package com.hbm.inventory.gui; -import java.util.Arrays; - +import org.apache.commons.lang3.math.NumberUtils; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; -import com.hbm.inventory.gui.GUIRadioRec.RadioButton; import com.hbm.items.tool.ItemSatInterface; import com.hbm.lib.RefStrings; import com.hbm.packet.PacketDispatcher; -import com.hbm.packet.SatLaserPacket; +import com.hbm.packet.SatCoordPacket; import com.hbm.saveddata.satellites.Satellite.CoordActions; -import com.hbm.saveddata.satellites.Satellite.InterfaceActions; import com.hbm.saveddata.satellites.Satellite.Interfaces; import net.minecraft.client.Minecraft; @@ -29,8 +26,6 @@ public class GUIScreenSatCoord extends GuiScreen { protected int guiLeft; protected int guiTop; private final EntityPlayer player; - int x; - int z; private GuiTextField xField; private GuiTextField yField; @@ -68,20 +63,51 @@ public class GUIScreenSatCoord extends GuiScreen { protected void mouseClicked(int i, int j, int k) { super.mouseClicked(i, j, k); + + if(ItemSatInterface.currentSat == null) + return; + this.xField.mouseClicked(i, j, k); if(ItemSatInterface.currentSat.coordAcs.contains(CoordActions.HAS_Y)) this.yField.mouseClicked(i, j, k); this.zField.mouseClicked(i, j, k); if(i >= this.guiLeft + 133 && i < this.guiLeft + 133 + 18 && j >= this.guiTop + 52 && j < this.guiTop + 52 + 18 && player != null) { - mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("hbm:item.techBleep"), 1.0F)); - - PacketDispatcher.wrapper.sendToServer(new SatLaserPacket(x, z, ItemSatInterface.getFreq(player.getHeldItem()))); + if(NumberUtils.isNumber(xField.getText()) && NumberUtils.isNumber(zField.getText())) { + + if(ItemSatInterface.currentSat.coordAcs.contains(CoordActions.HAS_Y)) { + + if(NumberUtils.isNumber(yField.getText())) { + + mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("hbm:item.techBleep"), 1.0F)); + PacketDispatcher.wrapper.sendToServer( + new SatCoordPacket( + (int)Double.parseDouble(xField.getText()), + (int)Double.parseDouble(yField.getText()), + (int)Double.parseDouble(zField.getText()), + ItemSatInterface.getFreq(player.getHeldItem()))); + + this.mc.thePlayer.closeScreen(); + } + + } else { + + mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("hbm:item.techBleep"), 1.0F)); + PacketDispatcher.wrapper.sendToServer( + new SatCoordPacket( + (int)Double.parseDouble(xField.getText()), + 0, + (int)Double.parseDouble(zField.getText()), + ItemSatInterface.getFreq(player.getHeldItem()))); + + this.mc.thePlayer.closeScreen(); + } + } } } - public void drawScreen(int mouseX, int mouseY, float f) - { + public void drawScreen(int mouseX, int mouseY, float f) { + this.drawDefaultBackground(); this.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); GL11.glEnable(GL11.GL_LIGHTING); @@ -98,7 +124,7 @@ public class GUIScreenSatCoord extends GuiScreen { protected void drawGuiContainerForegroundLayer(int i, int j) { this.xField.drawTextBox(); - if(ItemSatInterface.currentSat.coordAcs.contains(CoordActions.HAS_Y)) this.yField.drawTextBox(); + if(ItemSatInterface.currentSat != null && ItemSatInterface.currentSat.coordAcs.contains(CoordActions.HAS_Y)) this.yField.drawTextBox(); this.zField.drawTextBox(); } @@ -106,9 +132,21 @@ public class GUIScreenSatCoord extends GuiScreen { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); Minecraft.getMinecraft().getTextureManager().bindTexture(texture); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); + + if(xField.isFocused()) + drawTexturedModalRect(guiLeft + 61, guiTop + 16, 0, 126, 54, 18); + + if(yField.isFocused()) + drawTexturedModalRect(guiLeft + 61, guiTop + 52, 0, 126, 54, 18); + + if(zField.isFocused()) + drawTexturedModalRect(guiLeft + 61, guiTop + 88, 0, 126, 54, 18); if(ItemSatInterface.currentSat != null) { + if(!ItemSatInterface.currentSat.coordAcs.contains(CoordActions.HAS_Y)) + drawTexturedModalRect(guiLeft + 61, guiTop + 52, 0, 144, 54, 18); + drawTexturedModalRect(guiLeft + 120, guiTop + 17, 194, 0, 7, 7); if(ItemSatInterface.currentSat.satIface == Interfaces.SAT_COORD) { @@ -122,7 +160,7 @@ public class GUIScreenSatCoord extends GuiScreen { if (this.xField.textboxKeyTyped(p_73869_1_, p_73869_2_)) { - } else if (ItemSatInterface.currentSat.coordAcs.contains(CoordActions.HAS_Y) && this.yField.textboxKeyTyped(p_73869_1_, p_73869_2_)) { + } else if (ItemSatInterface.currentSat != null && ItemSatInterface.currentSat.coordAcs.contains(CoordActions.HAS_Y) && this.yField.textboxKeyTyped(p_73869_1_, p_73869_2_)) { } else if (this.zField.textboxKeyTyped(p_73869_1_, p_73869_2_)) { } else { diff --git a/com/hbm/items/ModItems.java b/com/hbm/items/ModItems.java index 54f06df18..250255706 100644 --- a/com/hbm/items/ModItems.java +++ b/com/hbm/items/ModItems.java @@ -2416,7 +2416,7 @@ public class ModItems { recycled_misc = new Item().setUnlocalizedName("recycled_misc").setCreativeTab(null).setTextureName(RefStrings.MODID + ":recycled_misc"); rod_empty = new Item().setUnlocalizedName("rod_empty").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":rod_empty"); - rod_th232 = new ItemRadioactive().setUnlocalizedName("rod_th232").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.rod_empty).setTextureName(RefStrings.MODID + ":rod_th232"); + rod_th232 = new ItemCustomLore().setUnlocalizedName("rod_th232").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.rod_empty).setTextureName(RefStrings.MODID + ":rod_th232"); rod_uranium = new ItemRadioactive().setUnlocalizedName("rod_uranium").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.rod_empty).setTextureName(RefStrings.MODID + ":rod_uranium"); rod_u233 = new ItemRadioactive().setUnlocalizedName("rod_u233").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.rod_empty).setTextureName(RefStrings.MODID + ":rod_u233"); rod_u235 = new ItemRadioactive().setUnlocalizedName("rod_u235").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.rod_empty).setTextureName(RefStrings.MODID + ":rod_u235"); @@ -2438,7 +2438,7 @@ public class ModItems { rod_verticium = new ItemCustomLore().setUnlocalizedName("rod_verticium").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.rod_empty).setTextureName(RefStrings.MODID + ":rod_verticium"); rod_dual_empty = new Item().setUnlocalizedName("rod_dual_empty").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":rod_dual_empty"); - rod_dual_th232 = new ItemRadioactive().setUnlocalizedName("rod_dual_th232").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.rod_dual_empty).setTextureName(RefStrings.MODID + ":rod_dual_th232"); + rod_dual_th232 = new ItemCustomLore().setUnlocalizedName("rod_dual_th232").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.rod_dual_empty).setTextureName(RefStrings.MODID + ":rod_dual_th232"); rod_dual_uranium = new ItemRadioactive().setUnlocalizedName("rod_dual_uranium").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.rod_dual_empty).setTextureName(RefStrings.MODID + ":rod_dual_uranium"); rod_dual_u233 = new ItemRadioactive().setUnlocalizedName("rod_dual_u233").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.rod_dual_empty).setTextureName(RefStrings.MODID + ":rod_dual_u233"); rod_dual_u235 = new ItemRadioactive().setUnlocalizedName("rod_dual_u235").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.rod_dual_empty).setTextureName(RefStrings.MODID + ":rod_dual_u235"); @@ -2453,7 +2453,7 @@ public class ModItems { rod_dual_solinium = new ItemRadioactive().setUnlocalizedName("rod_dual_solinium").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.rod_dual_empty).setTextureName(RefStrings.MODID + ":rod_dual_solinium"); rod_quad_empty = new Item().setUnlocalizedName("rod_quad_empty").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":rod_quad_empty"); - rod_quad_th232 = new ItemRadioactive().setUnlocalizedName("rod_quad_th232").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.rod_quad_empty).setTextureName(RefStrings.MODID + ":rod_quad_th232"); + rod_quad_th232 = new ItemCustomLore().setUnlocalizedName("rod_quad_th232").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.rod_quad_empty).setTextureName(RefStrings.MODID + ":rod_quad_th232"); rod_quad_uranium = new ItemRadioactive().setUnlocalizedName("rod_quad_uranium").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.rod_quad_empty).setTextureName(RefStrings.MODID + ":rod_quad_uranium"); rod_quad_u233 = new ItemRadioactive().setUnlocalizedName("rod_quad_u233").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.rod_quad_empty).setTextureName(RefStrings.MODID + ":rod_quad_u233"); rod_quad_u235 = new ItemRadioactive().setUnlocalizedName("rod_quad_u235").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.rod_quad_empty).setTextureName(RefStrings.MODID + ":rod_quad_u235"); diff --git a/com/hbm/items/special/ItemBlockLore.java b/com/hbm/items/block/ItemBlockLore.java similarity index 68% rename from com/hbm/items/special/ItemBlockLore.java rename to com/hbm/items/block/ItemBlockLore.java index 09e1b449e..ef702e1e6 100644 --- a/com/hbm/items/special/ItemBlockLore.java +++ b/com/hbm/items/block/ItemBlockLore.java @@ -1,4 +1,4 @@ -package com.hbm.items.special; +package com.hbm.items.block; import java.util.List; @@ -7,6 +7,7 @@ import com.hbm.blocks.generic.RedBarrel; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; @@ -52,4 +53,18 @@ public class ItemBlockLore extends ItemBlock { } } + @Override + public EnumRarity getRarity(ItemStack stack) { + + if(this.field_150939_a == ModBlocks.ore_schrabidium || this.field_150939_a == ModBlocks.ore_nether_schrabidium || + this.field_150939_a == ModBlocks.block_schrabidium || this.field_150939_a == ModBlocks.block_schrabidium_cluster) + return EnumRarity.rare; + + if(this.field_150939_a == ModBlocks.block_euphemium || this.field_150939_a == ModBlocks.block_euphemium_cluster || + this.field_150939_a == ModBlocks.plasma || this.field_150939_a == ModBlocks.fwatz_plasma) + return EnumRarity.epic; + + return EnumRarity.common; + } + } diff --git a/com/hbm/items/special/ItemTaintBlock.java b/com/hbm/items/block/ItemTaintBlock.java similarity index 96% rename from com/hbm/items/special/ItemTaintBlock.java rename to com/hbm/items/block/ItemTaintBlock.java index d8d42b741..2f048d02a 100644 --- a/com/hbm/items/special/ItemTaintBlock.java +++ b/com/hbm/items/block/ItemTaintBlock.java @@ -1,4 +1,4 @@ -package com.hbm.items.special; +package com.hbm.items.block; import java.util.List; diff --git a/com/hbm/items/food/ItemAppleEuphemium.java b/com/hbm/items/food/ItemAppleEuphemium.java index 64ae90acc..f4fe90f4a 100644 --- a/com/hbm/items/food/ItemAppleEuphemium.java +++ b/com/hbm/items/food/ItemAppleEuphemium.java @@ -30,9 +30,9 @@ public class ItemAppleEuphemium extends ItemFood { { if (!p_77849_2_.isRemote) { - p_77849_3_.addPotionEffect(new PotionEffect(Potion.resistance.id, 2147483647, 127)); + p_77849_3_.addPotionEffect(new PotionEffect(Potion.resistance.id, 2147483647, 120)); p_77849_3_.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 2147483647, 0)); - p_77849_3_.addPotionEffect(new PotionEffect(Potion.field_76443_y.id, 2147483647, 127)); + p_77849_3_.addPotionEffect(new PotionEffect(Potion.field_76443_y.id, 2147483647, 120)); } } diff --git a/com/hbm/items/gear/ArmorEuphemium.java b/com/hbm/items/gear/ArmorEuphemium.java index c8a881f39..6ca1db9c2 100644 --- a/com/hbm/items/gear/ArmorEuphemium.java +++ b/com/hbm/items/gear/ArmorEuphemium.java @@ -1,23 +1,20 @@ package com.hbm.items.gear; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; -import net.minecraft.util.DamageSource; -import net.minecraft.util.MathHelper; import net.minecraft.world.World; -import net.minecraftforge.common.ISpecialArmor; import com.hbm.items.ModItems; import com.hbm.lib.Library; import com.hbm.lib.RefStrings; -public class ArmorEuphemium extends ItemArmor implements ISpecialArmor { +public class ArmorEuphemium extends ItemArmor { + private String [] armourTypes = new String [] {"euphemium_helmet", "euphemium_chest", "euphemium_legs", "euphemium_boots"}; public ArmorEuphemium(ArmorMaterial armorMaterial, int renderIndex, int armorType) { @@ -37,42 +34,6 @@ public class ArmorEuphemium extends ItemArmor implements ISpecialArmor { else return null; } - @Override - public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { - if(player instanceof EntityPlayer && Library.checkArmor((EntityPlayer)player, ModItems.euphemium_helmet, ModItems.euphemium_plate, ModItems.euphemium_legs, ModItems.euphemium_boots)) - { - return new ArmorProperties(1, 1, MathHelper.floor_double(999999999)); - } - return new ArmorProperties(0, 0, 0); - } - - @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { - if(slot == 0) - { - return 3; - } - if(slot == 1) - { - return 8; - } - if(slot == 2) - { - return 6; - } - if(slot == 3) - { - return 3; - } - return 0; - } - - - @Override - public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { - stack.damageItem(damage * 0, entity); - } - @Override public void onArmorTick(World world, EntityPlayer player, ItemStack armor) { if(player instanceof EntityPlayer && Library.checkArmor(player, ModItems.euphemium_helmet, ModItems.euphemium_plate, ModItems.euphemium_legs, ModItems.euphemium_boots)) @@ -96,5 +57,9 @@ public class ArmorEuphemium extends ItemArmor implements ISpecialArmor { return EnumRarity.epic; } + + //do literally nothing lole + @Override + public void setDamage(ItemStack stack, int damage) { } } diff --git a/com/hbm/items/special/ItemPlasmaBlock.java b/com/hbm/items/special/ItemPlasmaBlock.java deleted file mode 100644 index f97d7f4d4..000000000 --- a/com/hbm/items/special/ItemPlasmaBlock.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.hbm.items.special; - -import net.minecraft.block.Block; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; - -public class ItemPlasmaBlock extends ItemBlock { - - public ItemPlasmaBlock(Block p_i45328_1_) { - super(p_i45328_1_); - } - - @Override - public EnumRarity getRarity(ItemStack p_77613_1_) - { - return EnumRarity.epic; - } - -} diff --git a/com/hbm/items/special/ItemSchrabidiumBlock.java b/com/hbm/items/special/ItemSchrabidiumBlock.java deleted file mode 100644 index 81104b91e..000000000 --- a/com/hbm/items/special/ItemSchrabidiumBlock.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.hbm.items.special; - -import net.minecraft.block.Block; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; - -public class ItemSchrabidiumBlock extends ItemBlock { - - public ItemSchrabidiumBlock(Block p_i45328_1_) { - super(p_i45328_1_); - } - - @Override - public EnumRarity getRarity(ItemStack p_77613_1_) { - - return EnumRarity.rare; - } - -} diff --git a/com/hbm/items/tool/ItemAssemblyTemplate.java b/com/hbm/items/tool/ItemAssemblyTemplate.java index fdd7b072f..9a7830801 100644 --- a/com/hbm/items/tool/ItemAssemblyTemplate.java +++ b/com/hbm/items/tool/ItemAssemblyTemplate.java @@ -602,7 +602,23 @@ public class ItemAssemblyTemplate extends Item { new ItemStack(Blocks.redstone_block, 12), new ItemStack(ModItems.powder_magnetized_tungsten, 6), new ItemStack(ModItems.circuit_targeting_tier4, 1)), - new ItemStack(ModItems.mp_warhead_15_n2)); + new ItemStack(ModItems.mp_warhead_15_n2)), + + GERALD(1200, Arrays.asList( + new ItemStack(ModItems.cap_star, 1), + new ItemStack(ModItems.chlorine_pinwheel, 1), + new ItemStack(ModItems.burnt_bark, 1), + new ItemStack(ModItems.combine_scrap, 1), + new ItemStack(ModBlocks.block_euphemium_cluster, 1), + new ItemStack(ModItems.crystal_horn, 1), + new ItemStack(ModItems.crystal_charred, 1), + new ItemStack(ModBlocks.pink_log, 1), + new ItemStack(ModItems.mp_warhead_15_balefire, 1), + new ItemStack(ModBlocks.crate_red, 1), + new ItemStack(ModBlocks.det_nuke, 16), + new ItemStack(ModItems.ingot_starmetal, 32)), + + new ItemStack(ModItems.sat_gerald)); private EnumAssemblyTemplate() { } diff --git a/com/hbm/items/tool/ItemSatChip.java b/com/hbm/items/tool/ItemSatChip.java index ca434f44b..0369077d1 100644 --- a/com/hbm/items/tool/ItemSatChip.java +++ b/com/hbm/items/tool/ItemSatChip.java @@ -19,8 +19,11 @@ public class ItemSatChip extends Item { if(this == ModItems.sat_foeq) list.add("Gives you an achievement. That's it."); - if(this == ModItems.sat_gerald) - list.add("Unused (for now)"); + if(this == ModItems.sat_gerald) { + list.add("Single use."); + list.add("Requires orbital module."); + list.add("Melter of CPUs, bane of every server owner."); + } if(this == ModItems.sat_laser) list.add("Allows to summon lasers with a 15 second cooldown."); @@ -35,7 +38,7 @@ public class ItemSatChip extends Item { list.add("Shows a map of active entities."); if(this == ModItems.sat_resonator) - list.add("Unused"); + list.add("Allows for teleportation with no cooldown."); if(this == ModItems.sat_scanner) list.add("Creates a topdown map of underground ores."); diff --git a/com/hbm/main/CraftingManager.java b/com/hbm/main/CraftingManager.java index 5d543863a..febf48028 100644 --- a/com/hbm/main/CraftingManager.java +++ b/com/hbm/main/CraftingManager.java @@ -120,6 +120,8 @@ public class CraftingManager { GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.block_scrap), 1), new Object[] { "###", "###", "###", '#', ModItems.dust }); GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.block_beryllium), 1), new Object[] { "###", "###", "###", '#', ModItems.ingot_beryllium }); GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.block_schrabidium), 1), new Object[] { "###", "###", "###", '#', ModItems.ingot_schrabidium }); + GameRegistry.addRecipe(new ItemStack(ModBlocks.block_schrabidium_cluster, 1), new Object[] { "#S#", "S#S", "#S#", '#', ModItems.ingot_schrabidium, 'S', ModItems.ingot_starmetal }); + GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.block_euphemium), 1), new Object[] { "###", "###", "###", '#', ModItems.ingot_euphemium }); GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.block_advanced_alloy), 1), new Object[] { "###", "###", "###", '#', ModItems.ingot_advanced_alloy }); GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.block_magnetized_tungsten), 1), new Object[] { "###", "###", "###", '#', ModItems.ingot_magnetized_tungsten }); GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.block_combine_steel), 1), new Object[] { "###", "###", "###", '#', ModItems.ingot_combine_steel }); @@ -167,6 +169,7 @@ public class CraftingManager { GameRegistry.addRecipe(new ItemStack(ModItems.nuclear_waste, 9), new Object[] { "#", '#', Item.getItemFromBlock(ModBlocks.block_waste) }); GameRegistry.addRecipe(new ItemStack(ModItems.ingot_beryllium, 9), new Object[] { "#", '#', Item.getItemFromBlock(ModBlocks.block_beryllium) }); GameRegistry.addRecipe(new ItemStack(ModItems.ingot_schrabidium, 9), new Object[] { "#", '#', Item.getItemFromBlock(ModBlocks.block_schrabidium) }); + GameRegistry.addRecipe(new ItemStack(ModItems.ingot_euphemium, 9), new Object[] { "#", '#', Item.getItemFromBlock(ModBlocks.block_euphemium) }); GameRegistry.addRecipe(new ItemStack(ModItems.ingot_advanced_alloy, 9), new Object[] { "#", '#', Item.getItemFromBlock(ModBlocks.block_advanced_alloy) }); GameRegistry.addRecipe(new ItemStack(ModItems.ingot_magnetized_tungsten, 9), new Object[] { "#", '#', Item.getItemFromBlock(ModBlocks.block_magnetized_tungsten) }); GameRegistry.addRecipe(new ItemStack(ModItems.ingot_combine_steel, 9), new Object[] { "#", '#', Item.getItemFromBlock(ModBlocks.block_combine_steel) }); @@ -447,7 +450,7 @@ public class CraftingManager { GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModBlocks.deco_titanium), new Object[] { "ingotTitanium", ModBlocks.steel_scaffold })); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModBlocks.deco_tungsten), new Object[] { "ingotTungsten", ModBlocks.steel_scaffold })); - GameRegistry.addShapelessRecipe(new ItemStack(ModItems.nugget_euphemium, 1), new Object[] { ModItems.rod_quad_euphemium }); + GameRegistry.addRecipe(new ItemStack(ModItems.nugget_euphemium, 1), new Object[] { "###", "###", "###", '#', ModItems.rod_quad_euphemium }); GameRegistry.addRecipe(new ItemStack(ModItems.ingot_euphemium, 1), new Object[] { "###", "###", "###", '#', ModItems.nugget_euphemium }); GameRegistry.addRecipe(new ItemStack(ModItems.nugget_euphemium, 9), new Object[] { "#", '#', ModItems.ingot_euphemium }); diff --git a/com/hbm/main/ModEventHandler.java b/com/hbm/main/ModEventHandler.java index 26f11ebb5..8427be218 100644 --- a/com/hbm/main/ModEventHandler.java +++ b/com/hbm/main/ModEventHandler.java @@ -43,10 +43,12 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.tileentity.TileEntitySign; import net.minecraft.util.ChatComponentText; +import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; import net.minecraftforge.event.entity.EntityEvent.EnteringChunk; +import net.minecraftforge.event.entity.living.LivingAttackEvent; import net.minecraftforge.event.entity.living.LivingDeathEvent; import net.minecraftforge.event.entity.living.LivingSpawnEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; @@ -347,6 +349,18 @@ public class ModEventHandler ////////////////////// } + @SubscribeEvent + public void onEntityHurt(LivingAttackEvent event) { + + EntityLivingBase e = event.entityLiving; + DamageSource dmg = event.source; + + if(e instanceof EntityPlayer && Library.checkArmor((EntityPlayer)e, ModItems.euphemium_helmet, ModItems.euphemium_plate, ModItems.euphemium_legs, ModItems.euphemium_boots)) { + e.worldObj.playSoundAtEntity(e, "random.break", 5F, 1.0F + e.getRNG().nextFloat() * 0.5F); + event.setCanceled(true); + } + } + @SubscribeEvent public void onPlayerTick(TickEvent.PlayerTickEvent event) { diff --git a/com/hbm/packet/SatCoordPacket.java b/com/hbm/packet/SatCoordPacket.java index 49fc67f20..2710a7756 100644 --- a/com/hbm/packet/SatCoordPacket.java +++ b/com/hbm/packet/SatCoordPacket.java @@ -61,7 +61,7 @@ public class SatCoordPacket implements IMessage { Satellite sat = SatelliteSavedData.getData(p.worldObj).getSatFromFreq(m.freq); if(sat != null) - sat.onCoordAction(p.worldObj, m.x, m.y, m.z); + sat.onCoordAction(p.worldObj, p, m.x, m.y, m.z); } } diff --git a/com/hbm/render/entity/projectile/RenderTom.java b/com/hbm/render/entity/projectile/RenderTom.java index 05c8ef3db..482dbf1e1 100644 --- a/com/hbm/render/entity/projectile/RenderTom.java +++ b/com/hbm/render/entity/projectile/RenderTom.java @@ -14,7 +14,7 @@ public class RenderTom extends Render { public void doRender(Entity entity, double x, double y, double z, float f0, float f1) { GL11.glPushMatrix(); - GL11.glTranslated(x, y, z); + GL11.glTranslated(x, y - 50, z); TomPronter.prontTom(); GL11.glPopMatrix(); diff --git a/com/hbm/saveddata/SatelliteSavedData.java b/com/hbm/saveddata/SatelliteSavedData.java index 2eefd843c..432ee29cb 100644 --- a/com/hbm/saveddata/SatelliteSavedData.java +++ b/com/hbm/saveddata/SatelliteSavedData.java @@ -48,8 +48,6 @@ public class SatelliteSavedData extends WorldSavedData { int freq = nbt.getInteger("sat_freq_" + i); sats.put(freq, sat); - - System.out.println("Loaded sat" + i + " " + sat.getClass().getSimpleName()); } } @@ -68,8 +66,6 @@ public class SatelliteSavedData extends WorldSavedData { nbt.setTag("sat_data_" + i, data); nbt.setInteger("sat_freq_" + i, struct.getKey()); i++; - - System.out.println("Saved sat" + i + " " + struct.getValue().getClass().getSimpleName()); } } diff --git a/com/hbm/saveddata/satellites/Satellite.java b/com/hbm/saveddata/satellites/Satellite.java index 0aa422577..a6da6370a 100644 --- a/com/hbm/saveddata/satellites/Satellite.java +++ b/com/hbm/saveddata/satellites/Satellite.java @@ -7,6 +7,7 @@ import java.util.List; import com.hbm.items.ModItems; import com.hbm.saveddata.SatelliteSavedData; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; @@ -119,5 +120,5 @@ public abstract class Satellite { * @param y ditto * @param z ditto */ - public void onCoordAction(World world, int x, int y, int z) { } + public void onCoordAction(World world, EntityPlayer player, int x, int y, int z) { } } diff --git a/com/hbm/saveddata/satellites/SatelliteHorizons.java b/com/hbm/saveddata/satellites/SatelliteHorizons.java index 6a6885680..0b543ff25 100644 --- a/com/hbm/saveddata/satellites/SatelliteHorizons.java +++ b/com/hbm/saveddata/satellites/SatelliteHorizons.java @@ -1,12 +1,20 @@ package com.hbm.saveddata.satellites; +import com.hbm.entity.projectile.EntityTom; import com.hbm.main.MainRegistry; +import com.hbm.saveddata.SatelliteSavedData; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; public class SatelliteHorizons extends Satellite { + boolean used = false; + public SatelliteHorizons() { this.satIface = Interfaces.SAT_COORD; } @@ -16,4 +24,34 @@ public class SatelliteHorizons extends Satellite { for(Object p : world.playerEntities) ((EntityPlayer)p).triggerAchievement(MainRegistry.horizonsStart); } + + public void writeToNBT(NBTTagCompound nbt) { + nbt.setBoolean("used", used); + } + + public void readFromNBT(NBTTagCompound nbt) { + used = nbt.getBoolean("used"); + } + + public void onCoordAction(World world, EntityPlayer player, int x, int y, int z) { + + if(used) + return; + + used = true; + SatelliteSavedData.getData(world).markDirty(); + + EntityTom tom = new EntityTom(world); + tom.setPosition(x + 0.5, 600, z + 0.5); + world.spawnEntityInWorld(tom); + + for(Object p : world.playerEntities) + ((EntityPlayer)p).triggerAchievement(MainRegistry.horizonsEnd); + + //not necessary but JUST to make sure + if(!world.isRemote) { + + MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText(EnumChatFormatting.RED + "Horizons has been activated.")); + } + } } diff --git a/com/hbm/saveddata/satellites/SatelliteResonator.java b/com/hbm/saveddata/satellites/SatelliteResonator.java index 1aebe82c4..2eb356130 100644 --- a/com/hbm/saveddata/satellites/SatelliteResonator.java +++ b/com/hbm/saveddata/satellites/SatelliteResonator.java @@ -1,9 +1,23 @@ package com.hbm.saveddata.satellites; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.world.World; + public class SatelliteResonator extends Satellite { public SatelliteResonator() { this.coordAcs.add(CoordActions.HAS_Y); this.satIface = Interfaces.SAT_COORD; } + + public void onCoordAction(World world, EntityPlayer player, int x, int y, int z) { + + if(!(player instanceof EntityPlayerMP)) + + world.playSoundEffect(player.posX, player.posY, player.posZ, "mob.endermen.portal", 1.0F, 1.0F); + player.mountEntity(null); + ((EntityPlayerMP)player).playerNetServerHandler.setPlayerLocation(x + 0.5D, y, z + 0.5D, player.rotationYaw, player.rotationPitch); + world.playSoundEffect(player.posX, player.posY, player.posZ, "mob.endermen.portal", 1.0F, 1.0F); + } } diff --git a/com/hbm/tileentity/machine/TileEntityMachineAssembler.java b/com/hbm/tileentity/machine/TileEntityMachineAssembler.java index 0319bcfdd..5297c4dd5 100644 --- a/com/hbm/tileentity/machine/TileEntityMachineAssembler.java +++ b/com/hbm/tileentity/machine/TileEntityMachineAssembler.java @@ -288,90 +288,88 @@ public class TileEntityMachineAssembler extends TileEntity implements ISidedInve progress = 0; int meta = worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord); - TileEntity te = null; + + TileEntity te1 = null; + TileEntity te2 = null; + if(meta == 2) { - te = worldObj.getTileEntity(xCoord - 2, yCoord, zCoord); + te1 = worldObj.getTileEntity(xCoord - 2, yCoord, zCoord); + te2 = worldObj.getTileEntity(xCoord + 3, yCoord, zCoord - 1); } if(meta == 3) { - te = worldObj.getTileEntity(xCoord + 2, yCoord, zCoord); + te1 = worldObj.getTileEntity(xCoord + 2, yCoord, zCoord); + te2 = worldObj.getTileEntity(xCoord - 3, yCoord, zCoord + 1); } if(meta == 4) { - te = worldObj.getTileEntity(xCoord, yCoord, zCoord + 2); + te1 = worldObj.getTileEntity(xCoord, yCoord, zCoord + 2); + te2 = worldObj.getTileEntity(xCoord - 1, yCoord, zCoord - 3); } if(meta == 5) { - te = worldObj.getTileEntity(xCoord, yCoord, zCoord - 2); + te1 = worldObj.getTileEntity(xCoord, yCoord, zCoord - 2); + te2 = worldObj.getTileEntity(xCoord + 1, yCoord, zCoord + 3); } - if(te != null && te instanceof TileEntityChest) { - TileEntityChest chest = (TileEntityChest)te; + tryExchangeTemplates(te1, te2); + + //OUTPUT + if(te1 instanceof TileEntityChest) { + TileEntityChest chest = (TileEntityChest)te1; tryFillContainer(chest, 5); } - if(te != null && te instanceof TileEntityHopper) { - TileEntityHopper hopper = (TileEntityHopper)te; + if(te1 instanceof TileEntityHopper) { + TileEntityHopper hopper = (TileEntityHopper)te1; tryFillContainer(hopper, 5); } - if(te != null && te instanceof TileEntityCrateIron) { - TileEntityCrateIron hopper = (TileEntityCrateIron)te; + if(te1 instanceof TileEntityCrateIron) { + TileEntityCrateIron hopper = (TileEntityCrateIron)te1; tryFillContainer(hopper, 5); } - if(te != null && te instanceof TileEntityCrateSteel) { - TileEntityCrateSteel hopper = (TileEntityCrateSteel)te; + if(te1 instanceof TileEntityCrateSteel) { + TileEntityCrateSteel hopper = (TileEntityCrateSteel)te1; tryFillContainer(hopper, 5); } - te = null; - if(meta == 2) { - te = worldObj.getTileEntity(xCoord + 3, yCoord, zCoord - 1); - } - if(meta == 3) { - te = worldObj.getTileEntity(xCoord - 3, yCoord, zCoord + 1); - } - if(meta == 4) { - te = worldObj.getTileEntity(xCoord - 1, yCoord, zCoord - 3); - } - if(meta == 5) { - te = worldObj.getTileEntity(xCoord + 1, yCoord, zCoord + 3); - } - - if(te != null && te instanceof TileEntityChest) { - TileEntityChest chest = (TileEntityChest)te; + //INPUT + if(te2 instanceof TileEntityChest) { + TileEntityChest chest = (TileEntityChest)te2; for(int i = 0; i < chest.getSizeInventory(); i++) if(tryFillAssembler(chest, i)) break; } - if(te != null && te instanceof TileEntityHopper) { - TileEntityHopper hopper = (TileEntityHopper)te; + if(te2 instanceof TileEntityHopper) { + TileEntityHopper hopper = (TileEntityHopper)te2; for(int i = 0; i < hopper.getSizeInventory(); i++) if(tryFillAssembler(hopper, i)) break; } - if(te != null && te instanceof TileEntityCrateIron) { - TileEntityCrateIron hopper = (TileEntityCrateIron)te; + if(te2 instanceof TileEntityCrateIron) { + TileEntityCrateIron hopper = (TileEntityCrateIron)te2; for(int i = 0; i < hopper.getSizeInventory(); i++) if(tryFillAssembler(hopper, i)) break; } - if(te != null && te instanceof TileEntityCrateSteel) { - TileEntityCrateSteel hopper = (TileEntityCrateSteel)te; + if(te2 instanceof TileEntityCrateSteel) { + TileEntityCrateSteel hopper = (TileEntityCrateSteel)te2; for(int i = 0; i < hopper.getSizeInventory(); i++) if(tryFillAssembler(hopper, i)) break; } + PacketDispatcher.wrapper.sendToAllAround(new TEAssemblerPacket(xCoord, yCoord, zCoord, isProgressing), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 150)); PacketDispatcher.wrapper.sendToAllAround(new LoopedSoundPacket(xCoord, yCoord, zCoord), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 150)); PacketDispatcher.wrapper.sendToAllAround(new AuxElectricityPacket(xCoord, yCoord, zCoord, power), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50)); @@ -379,6 +377,70 @@ public class TileEntityMachineAssembler extends TileEntity implements ISidedInve } + public boolean tryExchangeTemplates(TileEntity te1, TileEntity te2) { + //validateTe sees if it's a valid inventory tile entity + boolean te1Valid = validateTe(te1); + boolean te2Valid = validateTe(te2); + + if(te1Valid && te2Valid){ + IInventory iTe1 = (IInventory)te1; + IInventory iTe2 = (IInventory)te2; + boolean openSlot = false; + boolean existingTemplate = false; + boolean filledContainer = false; + //Check if there's an existing template and an open slot + for(int i = 0; i < iTe1.getSizeInventory(); i++){ + if(iTe1.getStackInSlot(i) == null){ + openSlot = true; + + } + + } + if(this.slots[4] != null){ + existingTemplate = true; + } + //Check if there's a template in input + for(int i = 0; i < iTe2.getSizeInventory(); i++){ + if(iTe2.getStackInSlot(i) != null && iTe2.getStackInSlot(i).getItem() instanceof ItemAssemblyTemplate){ + if(openSlot && existingTemplate){ + filledContainer = tryFillContainer(iTe1, 4); + + } + if(filledContainer){ + ItemStack copy = iTe2.getStackInSlot(i).copy(); + iTe2.setInventorySlotContents(i, null); + this.slots[4] = copy; + } + } + + } + + + } + return false; + + } + + private boolean validateTe(TileEntity te) { + if(te instanceof TileEntityChest) { + return true; + } + + if(te instanceof TileEntityHopper) { + return true; + } + + if(te instanceof TileEntityCrateIron) { + return true; + } + + if(te instanceof TileEntityCrateSteel) { + return true; + } + + return false; + } + //I can't believe that worked. public ItemStack[] cloneItemStackProper(ItemStack[] array) { ItemStack[] stack = new ItemStack[array.length]; @@ -467,7 +529,7 @@ public class TileEntityMachineAssembler extends TileEntity implements ISidedInve boolean flag = false; for(int i = 0; i < list.size(); i++) - if(ItemStack.areItemStacksEqual(stack, list.get(i)) && ItemStack.areItemStackTagsEqual(stack, list.get(i))) + if(isItemAcceptible(stack, list.get(i))) flag = true; if(!flag) @@ -485,7 +547,7 @@ public class TileEntityMachineAssembler extends TileEntity implements ISidedInve sta1.stackSize = 1; sta2.stackSize = 1; - if(ItemStack.areItemStacksEqual(sta1, sta2) && ItemStack.areItemStackTagsEqual(sta1, sta2) && slots[i].stackSize < slots[i].getMaxStackSize()) { + if(isItemAcceptible(sta1, sta2) && slots[i].stackSize < slots[i].getMaxStackSize()) { ItemStack sta3 = inventory.getStackInSlot(slot).copy(); sta3.stackSize--; if(sta3.stackSize <= 0) diff --git a/com/hbm/tileentity/machine/TileEntityMachineChemplant.java b/com/hbm/tileentity/machine/TileEntityMachineChemplant.java index 51410c3c8..c4ab5199b 100644 --- a/com/hbm/tileentity/machine/TileEntityMachineChemplant.java +++ b/com/hbm/tileentity/machine/TileEntityMachineChemplant.java @@ -280,9 +280,7 @@ public class TileEntityMachineChemplant extends TileEntity implements ISidedInve if(consumption < 10) consumption = 10; - if(!worldObj.isRemote) - { - int meta = worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord); + if(!worldObj.isRemote) { isProgressing = false; @@ -340,88 +338,82 @@ public class TileEntityMachineChemplant extends TileEntity implements ISidedInve } else progress = 0; - TileEntity te = null; + int meta = worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord); + TileEntity te1 = null; + TileEntity te2 = null; + + if(meta == 2) { - te = worldObj.getTileEntity(xCoord - 2, yCoord, zCoord); + te1 = worldObj.getTileEntity(xCoord - 2, yCoord, zCoord); + te2 = worldObj.getTileEntity(xCoord + 3, yCoord, zCoord - 1); } if(meta == 3) { - te = worldObj.getTileEntity(xCoord + 2, yCoord, zCoord); + te1 = worldObj.getTileEntity(xCoord + 2, yCoord, zCoord); + te2 = worldObj.getTileEntity(xCoord - 3, yCoord, zCoord + 1); } if(meta == 4) { - te = worldObj.getTileEntity(xCoord, yCoord, zCoord + 2); + te1 = worldObj.getTileEntity(xCoord, yCoord, zCoord + 2); + te2 = worldObj.getTileEntity(xCoord - 1, yCoord, zCoord - 3); } if(meta == 5) { - te = worldObj.getTileEntity(xCoord, yCoord, zCoord - 2); + te1 = worldObj.getTileEntity(xCoord, yCoord, zCoord - 2); + te2 = worldObj.getTileEntity(xCoord + 1, yCoord, zCoord + 3); } - if(te != null && te instanceof TileEntityChest) { - TileEntityChest chest = (TileEntityChest)te; + tryExchangeTemplates(te1, te2); + + //OUTPUT + if(te1 instanceof TileEntityChest) { + TileEntityChest chest = (TileEntityChest)te1; - for(int i = 5; i < 9; i++) - tryFillContainer(chest, i); + tryFillContainer(chest, 5); } - if(te != null && te instanceof TileEntityHopper) { - TileEntityHopper hopper = (TileEntityHopper)te; + if(te1 instanceof TileEntityHopper) { + TileEntityHopper hopper = (TileEntityHopper)te1; - for(int i = 5; i < 9; i++) - tryFillContainer(hopper, i); + tryFillContainer(hopper, 5); } - if(te != null && te instanceof TileEntityCrateIron) { - TileEntityCrateIron hopper = (TileEntityCrateIron)te; + if(te1 instanceof TileEntityCrateIron) { + TileEntityCrateIron hopper = (TileEntityCrateIron)te1; - for(int i = 5; i < 9; i++) - tryFillContainer(hopper, i); + tryFillContainer(hopper, 5); } - if(te != null && te instanceof TileEntityCrateSteel) { - TileEntityCrateSteel hopper = (TileEntityCrateSteel)te; + if(te1 instanceof TileEntityCrateSteel) { + TileEntityCrateSteel hopper = (TileEntityCrateSteel)te1; - for(int i = 5; i < 9; i++) - tryFillContainer(hopper, i); + tryFillContainer(hopper, 5); } - te = null; - if(meta == 2) { - te = worldObj.getTileEntity(xCoord + 3, yCoord, zCoord - 1); - } - if(meta == 3) { - te = worldObj.getTileEntity(xCoord - 3, yCoord, zCoord + 1); - } - if(meta == 4) { - te = worldObj.getTileEntity(xCoord - 1, yCoord, zCoord - 3); - } - if(meta == 5) { - te = worldObj.getTileEntity(xCoord + 1, yCoord, zCoord + 3); - } - - if(te != null && te instanceof TileEntityChest) { - TileEntityChest chest = (TileEntityChest)te; + //INPUT + if(te2 instanceof TileEntityChest) { + TileEntityChest chest = (TileEntityChest)te2; for(int i = 0; i < chest.getSizeInventory(); i++) if(tryFillAssembler(chest, i)) break; } - if(te != null && te instanceof TileEntityHopper) { - TileEntityHopper hopper = (TileEntityHopper)te; + if(te2 instanceof TileEntityHopper) { + TileEntityHopper hopper = (TileEntityHopper)te2; for(int i = 0; i < hopper.getSizeInventory(); i++) if(tryFillAssembler(hopper, i)) break; } - if(te != null && te instanceof TileEntityCrateIron) { - TileEntityCrateIron chest = (TileEntityCrateIron)te; - - for(int i = 0; i < chest.getSizeInventory(); i++) - if(tryFillAssembler(chest, i)) + if(te2 instanceof TileEntityCrateIron) { + TileEntityCrateIron hopper = (TileEntityCrateIron)te2; + + for(int i = 0; i < hopper.getSizeInventory(); i++) + if(tryFillAssembler(hopper, i)) break; } - if(te != null && te instanceof TileEntityCrateSteel) { - TileEntityCrateSteel hopper = (TileEntityCrateSteel)te; + if(te2 instanceof TileEntityCrateSteel) { + TileEntityCrateSteel hopper = (TileEntityCrateSteel)te2; for(int i = 0; i < hopper.getSizeInventory(); i++) if(tryFillAssembler(hopper, i)) @@ -453,6 +445,70 @@ public class TileEntityMachineChemplant extends TileEntity implements ISidedInve } } + + public boolean tryExchangeTemplates(TileEntity te1, TileEntity te2) { + //validateTe sees if it's a valid inventory tile entity + boolean te1Valid = validateTe(te1); + boolean te2Valid = validateTe(te2); + + if(te1Valid && te2Valid){ + IInventory iTe1 = (IInventory)te1; + IInventory iTe2 = (IInventory)te2; + boolean openSlot = false; + boolean existingTemplate = false; + boolean filledContainer = false; + //Check if there's an existing template and an open slot + for(int i = 0; i < iTe1.getSizeInventory(); i++){ + if(iTe1.getStackInSlot(i) == null){ + openSlot = true; + + } + + } + if(this.slots[4] != null){ + existingTemplate = true; + } + //Check if there's a template in input + for(int i = 0; i < iTe2.getSizeInventory(); i++){ + if(iTe2.getStackInSlot(i) != null && iTe2.getStackInSlot(i).getItem() instanceof ItemChemistryTemplate){ + if(openSlot && existingTemplate){ + filledContainer = tryFillContainer(iTe1, 4); + + } + if(filledContainer){ + ItemStack copy = iTe2.getStackInSlot(i).copy(); + iTe2.setInventorySlotContents(i, null); + this.slots[4] = copy; + } + } + + } + + + } + return false; + + } + + private boolean validateTe(TileEntity te) { + if(te != null && te instanceof TileEntityChest) { + return true; + + } + + if(te != null && te instanceof TileEntityHopper) { + return true; + } + + if(te != null && te instanceof TileEntityCrateIron) { + return true; + } + + if(te != null && te instanceof TileEntityCrateSteel) { + return true; + } + return false; + } private void setContainers() { @@ -531,10 +587,10 @@ public class TileEntityMachineChemplant extends TileEntity implements ISidedInve if(sta7 != null) sta7.stackSize = 1; - if((slots[5] == null || stacks[0] == null || (stacks[0] != null && ItemStack.areItemStacksEqual(sta0, sta1) && ItemStack.areItemStackTagsEqual(sta0, sta1) && slots[5].stackSize + stacks[0].stackSize <= slots[5].getMaxStackSize())) && - (slots[6] == null || stacks[1] == null || (stacks[1] != null && ItemStack.areItemStacksEqual(sta2, sta3) && ItemStack.areItemStackTagsEqual(sta2, sta3) && slots[6].stackSize + stacks[1].stackSize <= slots[6].getMaxStackSize())) && - (slots[7] == null || stacks[2] == null || (stacks[2] != null && ItemStack.areItemStacksEqual(sta4, sta5) && ItemStack.areItemStackTagsEqual(sta4, sta5) && slots[7].stackSize + stacks[2].stackSize <= slots[7].getMaxStackSize())) && - (slots[8] == null || stacks[3] == null || (stacks[3] != null && ItemStack.areItemStacksEqual(sta6, sta7) && ItemStack.areItemStackTagsEqual(sta6, sta7) && slots[8].stackSize + stacks[3].stackSize <= slots[8].getMaxStackSize()))) + if((slots[5] == null || stacks[0] == null || (stacks[0] != null && isItemAcceptible(sta0, sta1) && slots[5].stackSize + stacks[0].stackSize <= slots[5].getMaxStackSize())) && + (slots[6] == null || stacks[1] == null || (stacks[1] != null && isItemAcceptible(sta2, sta3) && slots[6].stackSize + stacks[1].stackSize <= slots[6].getMaxStackSize())) && + (slots[7] == null || stacks[2] == null || (stacks[2] != null && isItemAcceptible(sta4, sta5) && slots[7].stackSize + stacks[2].stackSize <= slots[7].getMaxStackSize())) && + (slots[8] == null || stacks[3] == null || (stacks[3] != null && isItemAcceptible(sta6, sta7) && slots[8].stackSize + stacks[3].stackSize <= slots[8].getMaxStackSize()))) return true; return false; @@ -681,7 +737,7 @@ public class TileEntityMachineChemplant extends TileEntity implements ISidedInve sta1.stackSize = 1; sta2.stackSize = 1; - if(ItemStack.areItemStacksEqual(sta1, sta2) && ItemStack.areItemStackTagsEqual(sta1, sta2) && slots[i].stackSize < slots[i].getMaxStackSize()) { + if(isItemAcceptible(sta1, sta2) && slots[i].stackSize < slots[i].getMaxStackSize()) { ItemStack sta3 = inventory.getStackInSlot(slot).copy(); sta3.stackSize--; if(sta3.stackSize <= 0)