diff --git a/src/main/java/api/hbm/energy/PowerNet.java b/src/main/java/api/hbm/energy/PowerNet.java index 89efb819c..da1edbdf6 100644 --- a/src/main/java/api/hbm/energy/PowerNet.java +++ b/src/main/java/api/hbm/energy/PowerNet.java @@ -4,6 +4,8 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import com.hbm.config.GeneralConfig; + import net.minecraft.tileentity.TileEntity; /** @@ -165,7 +167,10 @@ public class PowerNet implements IPowerNet { @Override public void reevaluate() { - //this.destroy();// + if(!GeneralConfig.enableReEval) { + this.destroy(); + return; + } HashMap copy = new HashMap(links); HashMap proxyCopy = new HashMap(proxies); diff --git a/src/main/java/api/hbm/entity/IRadarDetectable.java b/src/main/java/api/hbm/entity/IRadarDetectable.java index 293b2030b..f89fc99d4 100644 --- a/src/main/java/api/hbm/entity/IRadarDetectable.java +++ b/src/main/java/api/hbm/entity/IRadarDetectable.java @@ -14,7 +14,8 @@ public interface IRadarDetectable { MISSILE_15_20("Size 15/20 Custom Missile"), //size 15/20 custom missiles MISSILE_20("Size 20 Custom Missile"), //size 20 custom missiles MISSILE_AB("Anti-Ballistic Missile"), //anti ballistic missile - PLAYER("Player"); //airborne players + PLAYER("Player"), //airborne players + ARTILLERY("Artillery Shell"); //airborne players public String name; diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index f6e6a1e25..8bafa0b77 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -797,16 +797,14 @@ public class ModBlocks { public static Block struct_plasma_core; public static Block factory_titanium_hull; - public static Block factory_titanium_furnace; - public static Block factory_titanium_conductor; - public static Block factory_titanium_core; - public static final int guiID_factory_titanium = 24; + @Deprecated public static Block factory_titanium_furnace; + @Deprecated public static Block factory_titanium_conductor; + @Deprecated public static Block factory_titanium_core; public static Block factory_advanced_hull; - public static Block factory_advanced_furnace; - public static Block factory_advanced_conductor; - public static Block factory_advanced_core; - public static final int guiID_factory_advanced = 25; + @Deprecated public static Block factory_advanced_furnace; + @Deprecated public static Block factory_advanced_conductor; + @Deprecated public static Block factory_advanced_core; public static Block reactor_element; public static Block reactor_control; diff --git a/src/main/java/com/hbm/blocks/machine/FactoryHatch.java b/src/main/java/com/hbm/blocks/machine/FactoryHatch.java index e04b8c10d..b86e508a3 100644 --- a/src/main/java/com/hbm/blocks/machine/FactoryHatch.java +++ b/src/main/java/com/hbm/blocks/machine/FactoryHatch.java @@ -45,47 +45,9 @@ public class FactoryHatch extends Block { return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : this.blockIcon); } - @Override - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) - { - return Item.getItemFromBlock(this); - } - @Override public void onBlockAdded(World world, int x, int y, int z) { super.onBlockAdded(world, x, y, z); - //this.setDefaultDirection(world, x, y, z); - } - - private void setDefaultDirection(World world, int x, int y, int z) { - if(!world.isRemote) - { - Block block1 = world.getBlock(x, y, z - 1); - Block block2 = world.getBlock(x, y, z + 1); - Block block3 = world.getBlock(x - 1, y, z); - Block block4 = world.getBlock(x + 1, y, z); - - byte b0 = 3; - - if(block1.func_149730_j() && !block2.func_149730_j()) - { - b0 = 3; - } - if(block2.func_149730_j() && !block1.func_149730_j()) - { - b0 = 2; - } - if(block3.func_149730_j() && !block4.func_149730_j()) - { - b0 = 5; - } - if(block4.func_149730_j() && !block3.func_149730_j()) - { - b0 = 4; - } - - world.setBlockMetadataWithNotify(x, y, z, b0, 2); - } } @Override @@ -109,137 +71,5 @@ public class FactoryHatch extends Block { world.setBlockMetadataWithNotify(x, y, z, 4, 2); } } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - if(world.isRemote) - { - return true; - } else if(!player.isSneaking()) - { - if(this == ModBlocks.factory_titanium_furnace) - { - if(world.getBlockMetadata(x, y, z) == 2) - { - if(world.getTileEntity(x, y, z + 1) instanceof TileEntityCoreTitanium) - { - if(((TileEntityCoreTitanium)world.getTileEntity(x, y, z + 1)).isStructureValid(world)) - { - FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_factory_titanium, world, x, y, z + 1); - } else { - player.addChatMessage(new ChatComponentText("[Basic Factory] Error: Factory Structure not valid!")); - } - } else { - player.addChatMessage(new ChatComponentText("[Basic Factory] Error: Factory Core not found!")); - } - } - if(world.getBlockMetadata(x, y, z) == 3) - { - if(world.getTileEntity(x, y, z - 1) instanceof TileEntityCoreTitanium) - { - if(((TileEntityCoreTitanium)world.getTileEntity(x, y, z - 1)).isStructureValid(world)) - { - FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_factory_titanium, world, x, y, z - 1); - } else { - player.addChatMessage(new ChatComponentText("[Basic Factory] Error: Factory Structure not valid!")); - } - } else { - player.addChatMessage(new ChatComponentText("[Basic Factory] Error: Factory Core not found!")); - } - } - if(world.getBlockMetadata(x, y, z) == 4) - { - if(world.getTileEntity(x + 1, y, z) instanceof TileEntityCoreTitanium) - { - if(((TileEntityCoreTitanium)world.getTileEntity(x + 1, y, z)).isStructureValid(world)) - { - FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_factory_titanium, world, x + 1, y, z); - } else { - player.addChatMessage(new ChatComponentText("[Basic Factory] Error: Factory Structure not valid!")); - } - } else { - player.addChatMessage(new ChatComponentText("[Basic Factory] Error: Factory Core not found!")); - } - } - if(world.getBlockMetadata(x, y, z) == 5) - { - if(world.getTileEntity(x - 1, y, z) instanceof TileEntityCoreTitanium) - { - if(((TileEntityCoreTitanium)world.getTileEntity(x - 1, y, z)).isStructureValid(world)) - { - FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_factory_titanium, world, x - 1, y, z); - } else { - player.addChatMessage(new ChatComponentText("[Basic Factory] Error: Factory Structure not valid!")); - } - } else { - player.addChatMessage(new ChatComponentText("[Basic Factory] Error: Factory Core not found!")); - } - } - } - - if(this == ModBlocks.factory_advanced_furnace) - { - if(world.getBlockMetadata(x, y, z) == 2) - { - if(world.getTileEntity(x, y, z + 1) instanceof TileEntityCoreAdvanced) - { - if(((TileEntityCoreAdvanced)world.getTileEntity(x, y, z + 1)).isStructureValid(world)) - { - FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_factory_advanced, world, x, y, z + 1); - } else { - player.addChatMessage(new ChatComponentText("[Advanced Factory] Error: Factory Structure not valid!")); - } - } else { - player.addChatMessage(new ChatComponentText("[Advanced Factory] Error: Factory Core not found!")); - } - } - if(world.getBlockMetadata(x, y, z) == 3) - { - if(world.getTileEntity(x, y, z - 1) instanceof TileEntityCoreAdvanced) - { - if(((TileEntityCoreAdvanced)world.getTileEntity(x, y, z - 1)).isStructureValid(world)) - { - FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_factory_advanced, world, x, y, z - 1); - } else { - player.addChatMessage(new ChatComponentText("[Advanced Factory] Error: Factory Structure not valid!")); - } - } else { - player.addChatMessage(new ChatComponentText("[Advanced Factory] Error: Factory Core not found!")); - } - } - if(world.getBlockMetadata(x, y, z) == 4) - { - if(world.getTileEntity(x + 1, y, z) instanceof TileEntityCoreAdvanced) - { - if(((TileEntityCoreAdvanced)world.getTileEntity(x + 1, y, z)).isStructureValid(world)) - { - FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_factory_advanced, world, x + 1, y, z); - } else { - player.addChatMessage(new ChatComponentText("[Advanced Factory] Error: Factory Structure not valid!")); - } - } else { - player.addChatMessage(new ChatComponentText("[Advanced Factory] Error: Factory Core not found!")); - } - } - if(world.getBlockMetadata(x, y, z) == 5) - { - if(world.getTileEntity(x - 1, y, z) instanceof TileEntityCoreAdvanced) - { - if(((TileEntityCoreAdvanced)world.getTileEntity(x - 1, y, z)).isStructureValid(world)) - { - FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_factory_advanced, world, x - 1, y, z); - } else { - player.addChatMessage(new ChatComponentText("[Advanced Factory] Error: Factory Structure not valid!")); - } - } else { - player.addChatMessage(new ChatComponentText("[Advanced Factory] Error: Factory Core not found!")); - } - } - } - return true; - } else { - return false; - } - } } diff --git a/src/main/java/com/hbm/blocks/network/CraneInserter.java b/src/main/java/com/hbm/blocks/network/CraneInserter.java index 4a78bb8e3..e6d8e8475 100644 --- a/src/main/java/com/hbm/blocks/network/CraneInserter.java +++ b/src/main/java/com/hbm/blocks/network/CraneInserter.java @@ -16,6 +16,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; @@ -60,7 +61,8 @@ public class CraneInserter extends BlockCraneBase implements IEnterableBlock { if(te instanceof ISidedInventory) { ISidedInventory sided = (ISidedInventory) te; - access = sided.getAccessibleSlotsFromSide(dir.ordinal()); + //access = sided.getAccessibleSlotsFromSide(dir.ordinal()); + access = masquerade(sided, dir.ordinal()); } if(te instanceof IInventory) { @@ -119,6 +121,15 @@ public class CraneInserter extends BlockCraneBase implements IEnterableBlock { } } + public static int[] masquerade(ISidedInventory sided, int side) { + + if(sided instanceof TileEntityFurnace) { + return new int[] {1, 0}; + } + + return sided.getAccessibleSlotsFromSide(side); + } + public static ItemStack addToInventory(IInventory inv, int[] access, ItemStack toAdd, int side) { ISidedInventory sided = inv instanceof ISidedInventory ? (ISidedInventory) inv : null; diff --git a/src/main/java/com/hbm/config/GeneralConfig.java b/src/main/java/com/hbm/config/GeneralConfig.java index 3200633b5..d4c85eb53 100644 --- a/src/main/java/com/hbm/config/GeneralConfig.java +++ b/src/main/java/com/hbm/config/GeneralConfig.java @@ -24,6 +24,7 @@ public class GeneralConfig { public static boolean enableReflectorCompat = false; public static boolean enableRenderDistCheck = true; public static boolean enableCustomDashKeybind = false; + public static boolean enableReEval = true; public static int hintPos = 0; public static boolean enable528 = false; @@ -71,6 +72,7 @@ public class GeneralConfig { enableReflectorCompat = config.get(CATEGORY_GENERAL, "1.24_enableReflectorCompat", false).getBoolean(false); enableRenderDistCheck = config.get(CATEGORY_GENERAL, "1.25_enableRenderDistCheck", true).getBoolean(true); enableCustomDashKeybind = config.get(CATEGORY_GENERAL, "1.26_enableCustomDashKeybind", false).getBoolean(false); + enableReEval = config.get(CATEGORY_GENERAL, "1.27_enableReEval", true).getBoolean(true); hintPos = CommonConfig.createConfigInt(config, CATEGORY_GENERAL, "1.27_hudOverlayPosition", "0: Top left\n1: Top right\n2: Center right\n3: Center Left", 0); diff --git a/src/main/java/com/hbm/crafting/ToolRecipes.java b/src/main/java/com/hbm/crafting/ToolRecipes.java index 0911db267..b170fe58a 100644 --- a/src/main/java/com/hbm/crafting/ToolRecipes.java +++ b/src/main/java/com/hbm/crafting/ToolRecipes.java @@ -12,12 +12,10 @@ import com.hbm.items.tool.ItemModMinecart.EnumCartBase; import com.hbm.items.tool.ItemModMinecart.EnumMinecart; import com.hbm.main.CraftingManager; -import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.ShapelessRecipes; /** * For mining and utility tools @@ -114,6 +112,7 @@ public class ToolRecipes { CraftingManager.addRecipeAuto(new ItemStack(ModItems.designator, 1), new Object[] { " A", "#B#", "#B#", '#', IRON.plate(), 'A', STEEL.plate(), 'B', ModItems.circuit_red_copper }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.designator_range, 1), new Object[] { "RRD", "PIC", " P", 'P', STEEL.plate(), 'R', Items.redstone, 'C', ModItems.circuit_gold, 'D', ModItems.designator, 'I', STEEL.ingot() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.designator_manual, 1), new Object[] { " A", "#C#", "#B#", '#', POLYMER.ingot(), 'A', PB.plate(), 'B', ModItems.circuit_gold, 'C', ModItems.designator }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.designator_arty_range, 1), new Object[] { "M", "C", "P", 'M', ModItems.magnetron, 'C', ModItems.circuit_gold, 'P', ANY_PLASTIC.ingot() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.linker, 1), new Object[] { "I I", "ICI", "GGG", 'I', IRON.plate(), 'G', GOLD.plate(), 'C', ModItems.circuit_gold }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.oil_detector, 1), new Object[] { "W I", "WCI", "PPP", 'W', ModItems.wire_gold, 'I', CU.ingot(), 'C', ModItems.circuit_red_copper, 'P', STEEL.plate() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.turret_chip, 1), new Object[] { "WWW", "CPC", "WWW", 'W', ModItems.wire_gold, 'P', POLYMER.ingot(), 'C', ModItems.circuit_gold, }); diff --git a/src/main/java/com/hbm/crafting/WeaponRecipes.java b/src/main/java/com/hbm/crafting/WeaponRecipes.java index ff616d29a..8c0bec46c 100644 --- a/src/main/java/com/hbm/crafting/WeaponRecipes.java +++ b/src/main/java/com/hbm/crafting/WeaponRecipes.java @@ -2,7 +2,6 @@ package com.hbm.crafting; import com.hbm.blocks.ModBlocks; import com.hbm.inventory.OreDictManager; -import com.hbm.inventory.RecipesCommon.ComparableStack; import com.hbm.inventory.fluid.Fluids; import static com.hbm.inventory.OreDictManager.*; @@ -272,6 +271,14 @@ public class WeaponRecipes { CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_shell_apfsds_du, 6), new Object[] { " I ", "GIG", "CCC", 'I', U238.ingot(), 'G', ModItems.cordite, 'C', CU.ingot() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_shell_w9, 1), new Object[] { " P ", "NSN", " P ", 'P', PU239.nugget(), 'N', OreDictManager.getReflector(), 'S', ModItems.ammo_shell_explosive }); + //Artillery Shells + CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_arty, 1, 0), new Object[] { "CIC", "CSC", "CCC", 'C', ModItems.cordite, 'I', IRON.block(), 'S', ModItems.hull_small_steel }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_arty, 1, 1), new Object[] { " D ", "DSD", " D ", 'D', ModItems.ball_dynamite, 'S', new ItemStack(ModItems.ammo_arty, 1, 0) }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_arty, 1, 2), new Object[] { "TTT", "TST", "TTT", 'T', ModItems.ball_tnt, 'S', new ItemStack(ModItems.ammo_arty, 1, 0) }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_arty, 1, 5), new Object[] { " D ", "DSD", " D ", 'D', P_WHITE.ingot(), 'S', new ItemStack(ModItems.ammo_arty, 1, 0) }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_arty, 1, 3), new Object[] { " P ", "NSN", " P ", 'P', PU239.nugget(), 'N', OreDictManager.getReflector(), 'S', new ItemStack(ModItems.ammo_arty, 1, 0) }); + CraftingManager.addShapelessAuto(new ItemStack(ModItems.ammo_arty, 1, 4), new Object[] { new ItemStack(ModItems.ammo_arty, 1, 2), ModItems.boy_bullet, ModItems.boy_target, ModItems.boy_shielding, ModItems.circuit_red_copper, ModItems.ducttape }); + //DGK Belts CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_dgk, 1), new Object[] { "LLL", "GGG", "CCC", 'L', PB.plate(), 'G', ModItems.ballistite, 'C', CU.ingot() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.ammo_dgk, 1), new Object[] { "LLL", "GGG", "CCC", 'L', PB.plate(), 'G', ModItems.cordite, 'C', CU.ingot() }); diff --git a/src/main/java/com/hbm/entity/effect/EntityNukeCloudSmall.java b/src/main/java/com/hbm/entity/effect/EntityNukeCloudSmall.java index 530d426c0..b2794a939 100644 --- a/src/main/java/com/hbm/entity/effect/EntityNukeCloudSmall.java +++ b/src/main/java/com/hbm/entity/effect/EntityNukeCloudSmall.java @@ -128,7 +128,7 @@ public class EntityNukeCloudSmall extends Entity { @SideOnly(Side.CLIENT) public boolean isInRangeToRenderDist(double distance) { - return distance < 25000; + return true; } public static class Cloudlet { diff --git a/src/main/java/com/hbm/entity/missile/EntityMissileBaseAdvanced.java b/src/main/java/com/hbm/entity/missile/EntityMissileBaseAdvanced.java index 582330105..5c0d93b67 100644 --- a/src/main/java/com/hbm/entity/missile/EntityMissileBaseAdvanced.java +++ b/src/main/java/com/hbm/entity/missile/EntityMissileBaseAdvanced.java @@ -8,7 +8,6 @@ import com.hbm.explosion.ExplosionLarge; import com.hbm.main.MainRegistry; import com.hbm.packet.AuxParticlePacket; import com.hbm.packet.PacketDispatcher; -import com.hbm.tileentity.machine.TileEntityMachineRadar; import api.hbm.entity.IRadarDetectable; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; diff --git a/src/main/java/com/hbm/entity/projectile/EntityArtilleryShell.java b/src/main/java/com/hbm/entity/projectile/EntityArtilleryShell.java index 1585ade7b..c11471a5e 100644 --- a/src/main/java/com/hbm/entity/projectile/EntityArtilleryShell.java +++ b/src/main/java/com/hbm/entity/projectile/EntityArtilleryShell.java @@ -1,9 +1,14 @@ package com.hbm.entity.projectile; +import java.util.ArrayList; +import java.util.List; + import com.hbm.entity.logic.IChunkLoader; import com.hbm.items.weapon.ItemAmmoArty; import com.hbm.items.weapon.ItemAmmoArty.ArtilleryShell; +import com.hbm.main.MainRegistry; +import api.hbm.entity.IRadarDetectable; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.nbt.NBTTagCompound; @@ -13,8 +18,9 @@ import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.World; import net.minecraftforge.common.ForgeChunkManager; import net.minecraftforge.common.ForgeChunkManager.Ticket; +import net.minecraftforge.common.ForgeChunkManager.Type; -public class EntityArtilleryShell extends EntityThrowableNT implements IChunkLoader { +public class EntityArtilleryShell extends EntityThrowableNT implements IChunkLoader, IRadarDetectable { private Ticket loaderTicket; @@ -44,6 +50,7 @@ public class EntityArtilleryShell extends EntityThrowableNT implements IChunkLoa @Override protected void entityInit() { + init(ForgeChunkManager.requestTicket(MainRegistry.instance, worldObj, Type.ENTITY)); this.dataWatcher.addObject(10, new Integer(0)); } @@ -89,10 +96,12 @@ public class EntityArtilleryShell extends EntityThrowableNT implements IChunkLoa double dist = Math.sqrt(deltaX * deltaX + deltaZ * deltaZ); if(speed * 18 > dist) { - worldObj.playSoundEffect(this.targetX, this.targetY, this.targetZ, "hbm:turret.mortarWhistle", 5.0F, 1.0F); + worldObj.playSoundEffect(this.targetX, this.targetY, this.targetZ, "hbm:turret.mortarWhistle", 15.0F, 1.0F); this.didWhistle = true; } } + + loadNeighboringChunks((int)Math.floor(posX / 16D), (int)Math.floor(posZ / 16D)); } else { if(this.turnProgress > 0) { @@ -139,6 +148,10 @@ public class EntityArtilleryShell extends EntityThrowableNT implements IChunkLoa this.setDead();*/ this.getType().onImpact(this, mop); + + for(ChunkCoordIntPair chunk : loadedChunks) { + ForgeChunkManager.unforceChunk(loaderTicket, chunk); + } } } @@ -154,14 +167,53 @@ public class EntityArtilleryShell extends EntityThrowableNT implements IChunkLoa } } + List loadedChunks = new ArrayList(); + + public void loadNeighboringChunks(int newChunkX, int newChunkZ) { + if(!worldObj.isRemote && loaderTicket != null) { + + for(ChunkCoordIntPair chunk : loadedChunks) { + ForgeChunkManager.unforceChunk(loaderTicket, chunk); + } + + loadedChunks.clear(); + loadedChunks.add(new ChunkCoordIntPair(newChunkX, newChunkZ)); + loadedChunks.add(new ChunkCoordIntPair(newChunkX + (int) Math.ceil((this.posX + this.motionX) / 16D), newChunkZ + (int) Math.ceil((this.posZ + this.motionZ) / 16D))); + /*loadedChunks.add(new ChunkCoordIntPair(newChunkX + 1, newChunkZ + 1)); + loadedChunks.add(new ChunkCoordIntPair(newChunkX - 1, newChunkZ - 1)); + loadedChunks.add(new ChunkCoordIntPair(newChunkX + 1, newChunkZ - 1)); + loadedChunks.add(new ChunkCoordIntPair(newChunkX - 1, newChunkZ + 1)); + loadedChunks.add(new ChunkCoordIntPair(newChunkX + 1, newChunkZ)); + loadedChunks.add(new ChunkCoordIntPair(newChunkX, newChunkZ + 1)); + loadedChunks.add(new ChunkCoordIntPair(newChunkX - 1, newChunkZ)); + loadedChunks.add(new ChunkCoordIntPair(newChunkX, newChunkZ - 1));*/ + + for(ChunkCoordIntPair chunk : loadedChunks) { + ForgeChunkManager.forceChunk(loaderTicket, chunk); + } + } + } + @Override public void writeEntityToNBT(NBTTagCompound nbt) { super.writeEntityToNBT(nbt); + + nbt.setBoolean("shouldWhistle", this.shouldWhistle); + nbt.setBoolean("didWhistle", this.didWhistle); + nbt.setDouble("targetX", this.targetX); + nbt.setDouble("targetY", this.targetY); + nbt.setDouble("targetZ", this.targetZ); } @Override public void readEntityFromNBT(NBTTagCompound nbt) { super.readEntityFromNBT(nbt); + + this.shouldWhistle = nbt.getBoolean("shouldWhistle"); + this.didWhistle = nbt.getBoolean("didWhistle"); + this.targetX = nbt.getDouble("targetX"); + this.targetY = nbt.getDouble("targetY"); + this.targetZ = nbt.getDouble("targetZ"); } @Override @@ -173,4 +225,9 @@ public class EntityArtilleryShell extends EntityThrowableNT implements IChunkLoa public double getGravityVelocity() { return 9.81 * 0.05; } + + @Override + public RadarTargetType getTargetType() { + return RadarTargetType.ARTILLERY; + } } diff --git a/src/main/java/com/hbm/handler/GUIHandler.java b/src/main/java/com/hbm/handler/GUIHandler.java index 2a93686ba..144dcb6b6 100644 --- a/src/main/java/com/hbm/handler/GUIHandler.java +++ b/src/main/java/com/hbm/handler/GUIHandler.java @@ -218,20 +218,6 @@ public class GUIHandler implements IGuiHandler { return null; } - case ModBlocks.guiID_factory_titanium: { - if(entity instanceof TileEntityCoreTitanium) { - return new ContainerCoreTitanium(player.inventory, (TileEntityCoreTitanium) entity); - } - return null; - } - - case ModBlocks.guiID_factory_advanced: { - if(entity instanceof TileEntityCoreAdvanced) { - return new ContainerCoreAdvanced(player.inventory, (TileEntityCoreAdvanced) entity); - } - return null; - } - case ModBlocks.guiID_reactor_multiblock: { if(entity instanceof TileEntityMachineReactorLarge) { return new ContainerReactorMultiblock(player.inventory, (TileEntityMachineReactorLarge) entity); @@ -1058,20 +1044,6 @@ public class GUIHandler implements IGuiHandler { return null; } - case ModBlocks.guiID_factory_titanium: { - if(entity instanceof TileEntityCoreTitanium) { - return new GUICoreTitanium(player.inventory, (TileEntityCoreTitanium) entity); - } - return null; - } - - case ModBlocks.guiID_factory_advanced: { - if(entity instanceof TileEntityCoreAdvanced) { - return new GUICoreAdvanced(player.inventory, (TileEntityCoreAdvanced) entity); - } - return null; - } - case ModBlocks.guiID_reactor_multiblock: { if(entity instanceof TileEntityMachineReactorLarge) { return new GUIReactorMultiblock(player.inventory, (TileEntityMachineReactorLarge) entity); diff --git a/src/main/java/com/hbm/inventory/container/ContainerCoreAdvanced.java b/src/main/java/com/hbm/inventory/container/ContainerCoreAdvanced.java deleted file mode 100644 index 65282550f..000000000 --- a/src/main/java/com/hbm/inventory/container/ContainerCoreAdvanced.java +++ /dev/null @@ -1,156 +0,0 @@ -package com.hbm.inventory.container; - -import com.hbm.inventory.SlotMachineOutput; -import com.hbm.tileentity.machine.TileEntityCoreAdvanced; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class ContainerCoreAdvanced extends Container { - - private TileEntityCoreAdvanced diFurnace; - private int progress; - private int power; - - public ContainerCoreAdvanced(InventoryPlayer invPlayer, TileEntityCoreAdvanced tedf) { - - diFurnace = tedf; - - //Input Storage - this.addSlotToContainer(new Slot(tedf, 0, 8, 18)); - this.addSlotToContainer(new Slot(tedf, 1, 26, 18)); - this.addSlotToContainer(new Slot(tedf, 2, 44, 18)); - this.addSlotToContainer(new Slot(tedf, 3, 62, 18)); - this.addSlotToContainer(new Slot(tedf, 4, 80, 18)); - this.addSlotToContainer(new Slot(tedf, 5, 98, 18)); - this.addSlotToContainer(new Slot(tedf, 6, 116, 18)); - this.addSlotToContainer(new Slot(tedf, 7, 134, 18)); - this.addSlotToContainer(new Slot(tedf, 8, 152, 18)); - //Inputs - this.addSlotToContainer(new Slot(tedf, 9, 8, 54)); - this.addSlotToContainer(new Slot(tedf, 10, 8, 72)); - //Outputs - this.addSlotToContainer(new SlotMachineOutput(tedf, 11, 134, 54)); - this.addSlotToContainer(new SlotMachineOutput(tedf, 12, 134, 72)); - //Output Storage - this.addSlotToContainer(new SlotMachineOutput(tedf, 13, 8, 108)); - this.addSlotToContainer(new SlotMachineOutput(tedf, 14, 26, 108)); - this.addSlotToContainer(new SlotMachineOutput(tedf, 15, 44, 108)); - this.addSlotToContainer(new SlotMachineOutput(tedf, 16, 62, 108)); - this.addSlotToContainer(new SlotMachineOutput(tedf, 17, 80, 108)); - this.addSlotToContainer(new SlotMachineOutput(tedf, 18, 98, 108)); - this.addSlotToContainer(new SlotMachineOutput(tedf, 19, 116, 108)); - this.addSlotToContainer(new SlotMachineOutput(tedf, 20, 134, 108)); - this.addSlotToContainer(new SlotMachineOutput(tedf, 21, 152, 108)); - //Power Cell - this.addSlotToContainer(new Slot(tedf, 22, 44, 72)); - //More Inputs - this.addSlotToContainer(new Slot(tedf, 23, 26, 54)); - this.addSlotToContainer(new Slot(tedf, 24, 26, 72)); - //More Outputs - this.addSlotToContainer(new SlotMachineOutput(tedf, 25, 152, 54)); - this.addSlotToContainer(new SlotMachineOutput(tedf, 26, 152, 72)); - - for(int i = 0; i < 3; i++) - { - for(int j = 0; j < 9; j++) - { - this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18 + 56)); - } - } - - for(int i = 0; i < 9; i++) - { - this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142 + 56)); - } - } - - @Override - public void addCraftingToCrafters(ICrafting crafting) { - super.addCraftingToCrafters(crafting); - crafting.sendProgressBarUpdate(this, 0, this.diFurnace.progress); - crafting.sendProgressBarUpdate(this, 1, (int)this.diFurnace.power); - } - - @Override - public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) - { - ItemStack var3 = null; - Slot var4 = (Slot) this.inventorySlots.get(par2); - - if (var4 != null && var4.getHasStack()) - { - ItemStack var5 = var4.getStack(); - var3 = var5.copy(); - - if (par2 <= 26) { - if (!this.mergeItemStack(var5, 27, this.inventorySlots.size(), true)) - { - return null; - } - } - else if (!this.mergeItemStack(var5, 22, 23, false)) - { - if (!this.mergeItemStack(var5, 9, 11, false)) - if (!this.mergeItemStack(var5, 23, 25, false)) - if (!this.mergeItemStack(var5, 0, 9, false)) - return null; - } - - if (var5.stackSize == 0) - { - var4.putStack((ItemStack) null); - } - else - { - var4.onSlotChanged(); - } - } - - return var3; - } - - @Override - public boolean canInteractWith(EntityPlayer player) { - return diFurnace.isUseableByPlayer(player); - } - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - - for(int i = 0; i < this.crafters.size(); i++) - { - ICrafting par1 = (ICrafting)this.crafters.get(i); - - if(this.progress != this.diFurnace.progress) - { - par1.sendProgressBarUpdate(this, 0, this.diFurnace.progress); - } - - if(this.power != this.diFurnace.power) - { - par1.sendProgressBarUpdate(this, 1, (int)this.diFurnace.power); - } - } - - this.progress = this.diFurnace.progress; - this.power = (int)this.diFurnace.power; - } - - @Override - public void updateProgressBar(int i, int j) { - if(i == 0) - { - diFurnace.progress = j; - } - if(i == 1) - { - diFurnace.power = j; - } - } -} diff --git a/src/main/java/com/hbm/inventory/container/ContainerCoreTitanium.java b/src/main/java/com/hbm/inventory/container/ContainerCoreTitanium.java deleted file mode 100644 index 63c3ddf8a..000000000 --- a/src/main/java/com/hbm/inventory/container/ContainerCoreTitanium.java +++ /dev/null @@ -1,150 +0,0 @@ -package com.hbm.inventory.container; - -import com.hbm.inventory.SlotMachineOutput; -import com.hbm.tileentity.machine.TileEntityCoreTitanium; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class ContainerCoreTitanium extends Container { - - private TileEntityCoreTitanium diFurnace; - private int progress; - private int power; - - public ContainerCoreTitanium(InventoryPlayer invPlayer, TileEntityCoreTitanium tedf) { - - diFurnace = tedf; - - //Input Storage - this.addSlotToContainer(new Slot(tedf, 0, 8, 18)); - this.addSlotToContainer(new Slot(tedf, 1, 26, 18)); - this.addSlotToContainer(new Slot(tedf, 2, 44, 18)); - this.addSlotToContainer(new Slot(tedf, 3, 62, 18)); - this.addSlotToContainer(new Slot(tedf, 4, 80, 18)); - this.addSlotToContainer(new Slot(tedf, 5, 98, 18)); - this.addSlotToContainer(new Slot(tedf, 6, 116, 18)); - this.addSlotToContainer(new Slot(tedf, 7, 134, 18)); - this.addSlotToContainer(new Slot(tedf, 8, 152, 18)); - //Inputs - this.addSlotToContainer(new Slot(tedf, 9, 8, 54)); - this.addSlotToContainer(new Slot(tedf, 10, 8, 72)); - //Outputs - this.addSlotToContainer(new SlotMachineOutput(tedf, 11, 152, 54)); - this.addSlotToContainer(new SlotMachineOutput(tedf, 12, 152, 72)); - //Output Storage - this.addSlotToContainer(new SlotMachineOutput(tedf, 13, 8, 108)); - this.addSlotToContainer(new SlotMachineOutput(tedf, 14, 26, 108)); - this.addSlotToContainer(new SlotMachineOutput(tedf, 15, 44, 108)); - this.addSlotToContainer(new SlotMachineOutput(tedf, 16, 62, 108)); - this.addSlotToContainer(new SlotMachineOutput(tedf, 17, 80, 108)); - this.addSlotToContainer(new SlotMachineOutput(tedf, 18, 98, 108)); - this.addSlotToContainer(new SlotMachineOutput(tedf, 19, 116, 108)); - this.addSlotToContainer(new SlotMachineOutput(tedf, 20, 134, 108)); - this.addSlotToContainer(new SlotMachineOutput(tedf, 21, 152, 108)); - //Power Cell - this.addSlotToContainer(new Slot(tedf, 22, 44, 72)); - - for(int i = 0; i < 3; i++) - { - for(int j = 0; j < 9; j++) - { - this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18 + 56)); - } - } - - for(int i = 0; i < 9; i++) - { - this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142 + 56)); - } - } - - @Override - public void addCraftingToCrafters(ICrafting crafting) { - super.addCraftingToCrafters(crafting); - crafting.sendProgressBarUpdate(this, 0, this.diFurnace.progress); - crafting.sendProgressBarUpdate(this, 1, (int)this.diFurnace.power); - } - - @Override - public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) - { - ItemStack var3 = null; - Slot var4 = (Slot) this.inventorySlots.get(par2); - - if (var4 != null && var4.getHasStack()) - { - ItemStack var5 = var4.getStack(); - var3 = var5.copy(); - - if (par2 <= 22) { - if (!this.mergeItemStack(var5, 23, this.inventorySlots.size(), true)) - { - return null; - } - } - else if (!this.mergeItemStack(var5, 22, 23, false)) - { - if (!this.mergeItemStack(var5, 9, 11, false)) - if (!this.mergeItemStack(var5, 0, 9, false)) - return null; - } - - if (var5.stackSize == 0) - { - var4.putStack((ItemStack) null); - } - else - { - var4.onSlotChanged(); - } - } - - return var3; - } - - @Override - public boolean canInteractWith(EntityPlayer player) { - return diFurnace.isUseableByPlayer(player); - } - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - - for(int i = 0; i < this.crafters.size(); i++) - { - ICrafting par1 = (ICrafting)this.crafters.get(i); - - if(this.progress != this.diFurnace.progress) - { - par1.sendProgressBarUpdate(this, 0, this.diFurnace.progress); - } - - if(this.power != this.diFurnace.power) - { - par1.sendProgressBarUpdate(this, 1, (int)this.diFurnace.power); - } - } - - this.progress = this.diFurnace.progress; - this.power = (int)this.diFurnace.power; - } - - @Override - public void updateProgressBar(int i, int j) { - if(i == 0) - { - diFurnace.progress = j; - } - if(i == 1) - { - diFurnace.power = j; - } - } - -} diff --git a/src/main/java/com/hbm/inventory/gui/GUICoreAdvanced.java b/src/main/java/com/hbm/inventory/gui/GUICoreAdvanced.java deleted file mode 100644 index ad88a5601..000000000 --- a/src/main/java/com/hbm/inventory/gui/GUICoreAdvanced.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.hbm.inventory.gui; - -import org.lwjgl.opengl.GL11; - -import com.hbm.inventory.container.ContainerCoreAdvanced; -import com.hbm.lib.RefStrings; -import com.hbm.tileentity.machine.TileEntityCoreAdvanced; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.ResourceLocation; - -public class GUICoreAdvanced extends GuiInfoContainer { - - private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/factory_advanced.png"); - private TileEntityCoreAdvanced diFurnace; - - public GUICoreAdvanced(InventoryPlayer invPlayer, TileEntityCoreAdvanced tedf) { - super(new ContainerCoreAdvanced(invPlayer, tedf)); - diFurnace = tedf; - - this.xSize = 176; - this.ySize = 222; - } - - @Override - protected void drawGuiContainerForegroundLayer(int i, int j) { - String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName()); - - this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); - this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752); - } - - @Override - public void drawScreen(int mouseX, int mouseY, float f) { - super.drawScreen(mouseX, mouseY, f); - - String[] text = new String[] { "Basically just a larger furnace with a queue." }; - this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, text); - - String[] text1 = new String[] { "Requires an advanced factory energy cluster as", - "an energy buffer, even if external power is used!" }; - this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 16, 16, 16, guiLeft - 8, guiTop + 36 + 16, text1); - } - - @Override - protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - Minecraft.getMinecraft().getTextureManager().bindTexture(texture); - drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); - - if(diFurnace.power > 0) { - int i = (int)diFurnace.getPowerScaled(52); - drawTexturedModalRect(guiLeft + 62, guiTop + 72, 0, 240, i, 16); - } - - if(diFurnace.progress > 0) { - int j = diFurnace.getProgressScaled(90); - drawTexturedModalRect(guiLeft + 43, guiTop + 53, 0, 222, j, 18); - } - - this.drawInfoPanel(guiLeft - 16, guiTop + 36, 16, 16, 2); - this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 16, 16, 16, 3); - } -} diff --git a/src/main/java/com/hbm/inventory/gui/GUICoreTitanium.java b/src/main/java/com/hbm/inventory/gui/GUICoreTitanium.java deleted file mode 100644 index 63bf0124e..000000000 --- a/src/main/java/com/hbm/inventory/gui/GUICoreTitanium.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.hbm.inventory.gui; - -import org.lwjgl.opengl.GL11; - -import com.hbm.inventory.container.ContainerCoreTitanium; -import com.hbm.lib.RefStrings; -import com.hbm.tileentity.machine.TileEntityCoreTitanium; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.ResourceLocation; - -public class GUICoreTitanium extends GuiInfoContainer { - - private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/factory_titanium.png"); - private TileEntityCoreTitanium diFurnace; - - public GUICoreTitanium(InventoryPlayer invPlayer, TileEntityCoreTitanium tedf) { - super(new ContainerCoreTitanium(invPlayer, tedf)); - diFurnace = tedf; - - this.xSize = 176; - this.ySize = 222; - } - - @Override - protected void drawGuiContainerForegroundLayer(int i, int j) { - String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName()); - - this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); - this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752); - } - - @Override - public void drawScreen(int mouseX, int mouseY, float f) { - super.drawScreen(mouseX, mouseY, f); - - String[] text = new String[] { "Basically just a larger furnace with a queue." }; - this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, text); - - String[] text1 = new String[] { "Requires a basic factory energy cluster as", - "an energy buffer, even if external power is used!" }; - this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 16, 16, 16, guiLeft - 8, guiTop + 36 + 16, text1); - } - - @Override - protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - Minecraft.getMinecraft().getTextureManager().bindTexture(texture); - drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); - - if(diFurnace.power > 0) { - int i = (int)diFurnace.getPowerScaled(52); - drawTexturedModalRect(guiLeft + 62, guiTop + 72, 0, 240, i, 16); - } - - if(diFurnace.progress > 0) { - int j = diFurnace.getProgressScaled(90); - drawTexturedModalRect(guiLeft + 43, guiTop + 53, 0, 222, j, 18); - } - - this.drawInfoPanel(guiLeft - 16, guiTop + 36, 16, 16, 2); - this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 16, 16, 16, 3); - } -} diff --git a/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java b/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java index 1d63c2a09..15f788d35 100644 --- a/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java @@ -298,10 +298,6 @@ public class AssemblerRecipes { makeRecipe(new ComparableStack(ModBlocks.machine_teleporter, 1), new AStack[] {new OreDictStack(TI.ingot(), 6), new OreDictStack(ALLOY.plate(), 12), new OreDictStack(CMB.plate(), 4), new ComparableStack(ModItems.telepad, 1), new ComparableStack(ModItems.entanglement_kit, 1), new ComparableStack(ModBlocks.machine_battery, 2), new ComparableStack(ModItems.coil_magnetized_tungsten, 4), },300); makeRecipe(new ComparableStack(ModBlocks.machine_schrabidium_transmutator, 1), new AStack[] {new OreDictStack(MAGTUNG.ingot(), 1), new OreDictStack(TI.ingot(), 24), new OreDictStack(ALLOY.plate(), 18), new OreDictStack(STEEL.plate(), 12), new ComparableStack(ModItems.plate_desh, 6), new OreDictStack(RUBBER.ingot(), 8), new ComparableStack(ModBlocks.machine_battery, 5), new ComparableStack(ModItems.circuit_gold, 5), },500); makeRecipe(new ComparableStack(ModBlocks.machine_combine_factory, 1), new AStack[] {new OreDictStack(STEEL.ingot(), 8), new OreDictStack(ANY_PLASTIC.ingot(), 6), new OreDictStack(TI.plate(), 4), new OreDictStack(CU.plate(), 6), new ComparableStack(ModItems.circuit_gold, 6), new ComparableStack(ModItems.coil_advanced_alloy, 8), new ComparableStack(ModItems.coil_tungsten, 4), new OreDictStack(MAGTUNG.ingot(), 12), },150); - makeRecipe(new ComparableStack(ModBlocks.factory_advanced_hull, 1), new AStack[] {new OreDictStack(ALLOY.ingot(), 4), new OreDictStack(ALLOY.plate(), 4), new ComparableStack(ModItems.wire_advanced_alloy, 6), },50); - makeRecipe(new ComparableStack(ModBlocks.factory_advanced_furnace, 1), new AStack[] {new OreDictStack(ALLOY.ingot(), 4), new OreDictStack(ALLOY.plate(), 4), new OreDictStack(STEEL.plate(), 8), new ComparableStack(ModItems.coil_advanced_alloy, 2), },100); - makeRecipe(new ComparableStack(ModBlocks.factory_advanced_core, 1), new AStack[] {new OreDictStack(ALLOY.ingot(), 6), new OreDictStack(ALLOY.plate(), 6), new OreDictStack(STEEL.plate(), 8), new ComparableStack(ModItems.coil_advanced_alloy, 2), new ComparableStack(ModItems.motor, 16), new ComparableStack(Blocks.piston, 6), },100); - makeRecipe(new ComparableStack(ModBlocks.factory_advanced_conductor, 1), new AStack[] {new OreDictStack(ALLOY.ingot(), 8), new OreDictStack(ALLOY.plate(), 6), new ComparableStack(ModItems.wire_advanced_alloy, 4), new ComparableStack(ModItems.fuse, 6), },50); makeRecipe(new ComparableStack(ModBlocks.fusion_conductor, 1), new AStack[] {new OreDictStack(STEEL.ingot(), 2), new ComparableStack(ModItems.coil_advanced_alloy, 5), },150); makeRecipe(new ComparableStack(ModBlocks.fusion_center, 1), new AStack[] {new OreDictStack(W.ingot(), 4), new OreDictStack(STEEL.plate(), 6), new ComparableStack(ModItems.wire_advanced_alloy, 24), },200); makeRecipe(new ComparableStack(ModBlocks.fusion_motor, 1), new AStack[] {new OreDictStack(TI.ingot(), 4), new OreDictStack(STEEL.ingot(), 2), new ComparableStack(ModItems.motor, 4), },250); @@ -736,6 +732,17 @@ public class AssemblerRecipes { new ComparableStack(ModBlocks.barrel_steel, 1), new ComparableStack(ModItems.crt_display, 1) }, 200); + makeRecipe(new ComparableStack(ModBlocks.turret_arty, 1), new AStack[] { + new ComparableStack(ModBlocks.machine_battery, 1), + new OreDictStack(STEEL.ingot(), 128), + new OreDictStack(DURA.ingot(), 32), + new ComparableStack(ModItems.motor_desh, 5), + new ComparableStack(ModItems.circuit_targeting_tier4, 1), + new ComparableStack(ModItems.pipes_steel, 1), + new ComparableStack(ModItems.mechanism_launcher_2, 3), + new ComparableStack(ModBlocks.machine_radar, 1), + new ComparableStack(ModItems.crt_display, 1) + }, 200); makeRecipe(new ComparableStack(ModBlocks.machine_silex, 1), new AStack[] { new ComparableStack(Blocks.glass, 12), diff --git a/src/main/java/com/hbm/items/weapon/ItemAmmoArty.java b/src/main/java/com/hbm/items/weapon/ItemAmmoArty.java index 1b4cec380..540301887 100644 --- a/src/main/java/com/hbm/items/weapon/ItemAmmoArty.java +++ b/src/main/java/com/hbm/items/weapon/ItemAmmoArty.java @@ -2,16 +2,25 @@ package com.hbm.items.weapon; import java.util.List; +import com.hbm.config.BombConfig; +import com.hbm.entity.effect.EntityNukeCloudSmall; +import com.hbm.entity.logic.EntityNukeExplosionMK4; import com.hbm.entity.projectile.EntityArtilleryShell; +import com.hbm.explosion.ExplosionChaos; import com.hbm.explosion.ExplosionLarge; import com.hbm.explosion.ExplosionNukeSmall; +import com.hbm.explosion.vanillant.ExplosionVNT; +import com.hbm.explosion.vanillant.standard.BlockAllocatorStandard; +import com.hbm.explosion.vanillant.standard.BlockProcessorStandard; +import com.hbm.explosion.vanillant.standard.EntityProcessorStandard; +import com.hbm.explosion.vanillant.standard.ExplosionEffectStandard; +import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard; import com.hbm.lib.Library; import com.hbm.lib.RefStrings; import com.hbm.main.MainRegistry; import com.hbm.packet.AuxParticlePacketNT; import com.hbm.packet.PacketDispatcher; import com.hbm.potion.HbmPotion; -import com.hbm.util.ParticleUtil; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; @@ -20,11 +29,13 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.PotionEffect; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IIcon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; @@ -32,12 +43,12 @@ import net.minecraft.util.Vec3; public class ItemAmmoArty extends Item { public static ArtilleryShell[] types = new ArtilleryShell[ /* >>> */ 6 /* <<< */ ]; - public int NORMAL = 0; - public int CLASSIC = 1; - public int EXPLOSIVE = 2; - public int MINI_NUKE = 3; - public int NUKE = 4; - public int PHOSPHORUS = 5; + public final int NORMAL = 0; + public final int CLASSIC = 1; + public final int EXPLOSIVE = 2; + public final int MINI_NUKE = 3; + public final int NUKE = 4; + public final int PHOSPHORUS = 5; public ItemAmmoArty() { this.setHasSubtypes(true); @@ -55,6 +66,47 @@ public class ItemAmmoArty extends Item { list.add(new ItemStack(item, 1, MINI_NUKE)); list.add(new ItemStack(item, 1, NUKE)); } + + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { + + String r = EnumChatFormatting.RED + ""; + String y = EnumChatFormatting.YELLOW + ""; + String b = EnumChatFormatting.BLUE + ""; + + switch(stack.getItemDamage()) { + case NORMAL: + list.add(y + "Strength: 10"); + list.add(y + "Damage modifier: 3x"); + list.add(b + "Does not destroy blocks"); + break; + case CLASSIC: + list.add(y + "Strength: 15"); + list.add(y + "Damage modifier: 5x"); + list.add(b + "Does not destroy blocks"); + break; + case EXPLOSIVE: + list.add(y + "Strength: 15"); + list.add(y + "Damage modifier: 3x"); + list.add(r + "Destroys blocks"); + break; + case PHOSPHORUS: + list.add(y + "Strength: 10"); + list.add(y + "Damage modifier: 3x"); + list.add(r + "Phosphorus splash"); + list.add(b + "Does not destroy blocks"); + break; + case MINI_NUKE: + list.add(y + "Strength: 20"); + list.add(r + "Deals nuclear damage"); + list.add(r + "Destroys blocks"); + case NUKE: + list.add(r + "☠"); + list.add(r + "(that is the best skull and crossbones"); + list.add(r + "minecraft's unicode has to offer)"); + break; + } + } private IIcon[] icons = new IIcon[types.length]; @@ -94,33 +146,58 @@ public class ItemAmmoArty extends Item { this.types[NORMAL] = new ArtilleryShell("ammo_arty") { @Override public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { Vec3 vec = Vec3.createVectorHelper(shell.motionX, shell.motionY, shell.motionZ).normalize(); - shell.worldObj.newExplosion(shell, mop.hitVec.xCoord - vec.xCoord, mop.hitVec.yCoord - vec.yCoord, mop.hitVec.zCoord - vec.zCoord, 15F, false, false); + + ExplosionVNT xnt = new ExplosionVNT(shell.worldObj, mop.hitVec.xCoord - vec.xCoord, mop.hitVec.yCoord - vec.yCoord, mop.hitVec.zCoord - vec.zCoord, 10F); + xnt.setEntityProcessor(new EntityProcessorStandard().withRangeMod(3F)); + xnt.setPlayerProcessor(new PlayerProcessorStandard()); + xnt.setSFX(new ExplosionEffectStandard()); + xnt.explode(); + shell.setDead(); } }; this.types[CLASSIC] = new ArtilleryShell("ammo_arty_classic") { @Override public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { Vec3 vec = Vec3.createVectorHelper(shell.motionX, shell.motionY, shell.motionZ).normalize(); - shell.worldObj.newExplosion(shell, mop.hitVec.xCoord - vec.xCoord, mop.hitVec.yCoord - vec.yCoord, mop.hitVec.zCoord - vec.zCoord, 25F, false, false); + + ExplosionVNT xnt = new ExplosionVNT(shell.worldObj, mop.hitVec.xCoord - vec.xCoord, mop.hitVec.yCoord - vec.yCoord, mop.hitVec.zCoord - vec.zCoord, 15F); + xnt.setEntityProcessor(new EntityProcessorStandard().withRangeMod(5F)); + xnt.setPlayerProcessor(new PlayerProcessorStandard()); + xnt.setSFX(new ExplosionEffectStandard()); + xnt.explode(); + shell.setDead(); } }; this.types[EXPLOSIVE] = new ArtilleryShell("ammo_arty_he") { @Override public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { Vec3 vec = Vec3.createVectorHelper(shell.motionX, shell.motionY, shell.motionZ).normalize(); - shell.worldObj.newExplosion(shell, mop.hitVec.xCoord - vec.xCoord, mop.hitVec.yCoord - vec.yCoord, mop.hitVec.zCoord - vec.zCoord, 15F, false, true); + + ExplosionVNT xnt = new ExplosionVNT(shell.worldObj, mop.hitVec.xCoord - vec.xCoord, mop.hitVec.yCoord - vec.yCoord, mop.hitVec.zCoord - vec.zCoord, 20F); + xnt.setBlockAllocator(new BlockAllocatorStandard(48)); + xnt.setBlockProcessor(new BlockProcessorStandard().setNoDrop()); + xnt.setEntityProcessor(new EntityProcessorStandard().withRangeMod(3F)); + xnt.setPlayerProcessor(new PlayerProcessorStandard()); + xnt.setSFX(new ExplosionEffectStandard()); + xnt.explode(); + shell.setDead(); } }; this.types[MINI_NUKE] = new ArtilleryShell("ammo_arty_mini_nuke") { @Override public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { - //Vec3 vec = Vec3.createVectorHelper(shell.motionX, shell.motionY, shell.motionZ).normalize(); ExplosionNukeSmall.explode(shell.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, ExplosionNukeSmall.medium); shell.setDead(); } }; this.types[NUKE] = new ArtilleryShell("ammo_arty_nuke") { @Override public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { + shell.worldObj.spawnEntityInWorld(EntityNukeExplosionMK4.statFac(shell.worldObj, BombConfig.missileRadius, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord)); + EntityNukeCloudSmall entity2 = new EntityNukeCloudSmall(shell.worldObj, 1000, BombConfig.missileRadius * 0.005F); + entity2.posX = mop.hitVec.xCoord; + entity2.posY = mop.hitVec.yCoord; + entity2.posZ = mop.hitVec.zCoord; + shell.worldObj.spawnEntityInWorld(entity2); shell.setDead(); } }; @@ -131,7 +208,15 @@ public class ItemAmmoArty extends Item { double x = mop.hitVec.xCoord - vec.xCoord; double y = mop.hitVec.yCoord - vec.yCoord; double z = mop.hitVec.zCoord - vec.zCoord; - shell.worldObj.newExplosion(shell, x, y, z, 15F, true, false); + + ExplosionVNT xnt = new ExplosionVNT(shell.worldObj, x, y, z, 10F); + xnt.setEntityProcessor(new EntityProcessorStandard().withRangeMod(3F)); + xnt.setPlayerProcessor(new PlayerProcessorStandard()); + xnt.setSFX(new ExplosionEffectStandard()); + xnt.explode(); + + ExplosionLarge.spawnShrapnels(shell.worldObj, x, y, z, 15); + ExplosionChaos.burn(shell.worldObj, (int)x, (int)y, (int)z, 12); int radius = 15; List hit = shell.worldObj.getEntitiesWithinAABBExcludingEntity(shell, AxisAlignedBB.getBoundingBox(shell.posX - radius, shell.posY - radius, shell.posZ - radius, shell.posX + radius, shell.posY + radius, shell.posZ + radius)); diff --git a/src/main/java/com/hbm/lib/HbmWorld.java b/src/main/java/com/hbm/lib/HbmWorld.java index eb6556b39..242899b3e 100644 --- a/src/main/java/com/hbm/lib/HbmWorld.java +++ b/src/main/java/com/hbm/lib/HbmWorld.java @@ -1,8 +1,5 @@ package com.hbm.lib; -import com.hbm.world.test.StructureComponentTest; -import com.hbm.world.test.StructureStartTest; -import com.hbm.world.test.WorldGenTest; import com.hbm.world.worldgen.ComponentNTMFeatures; import com.hbm.world.worldgen.MapGenNTMFeatures; import com.hbm.world.worldgen.NTMWorldGenerator; diff --git a/src/main/java/com/hbm/lib/RefStrings.java b/src/main/java/com/hbm/lib/RefStrings.java index 4a82c4005..1a03ad993 100644 --- a/src/main/java/com/hbm/lib/RefStrings.java +++ b/src/main/java/com/hbm/lib/RefStrings.java @@ -3,7 +3,7 @@ package com.hbm.lib; public class RefStrings { public static final String MODID = "hbm"; public static final String NAME = "Hbm's Nuclear Tech Mod"; - public static final String VERSION = "1.0.27 BETA (4263H1)"; + public static final String VERSION = "1.0.27 BETA (4277)"; //HBM's Beta Naming Convention: //V T (X) //V -> next release version diff --git a/src/main/java/com/hbm/main/CraftingManager.java b/src/main/java/com/hbm/main/CraftingManager.java index 650152206..267d7bf61 100644 --- a/src/main/java/com/hbm/main/CraftingManager.java +++ b/src/main/java/com/hbm/main/CraftingManager.java @@ -294,12 +294,7 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModBlocks.muffler, 1), new Object[] { "III", "IWI", "III", 'I', ModItems.plate_polymer, 'W', Blocks.wool }); addRecipeAuto(new ItemStack(Item.getItemFromBlock(ModBlocks.factory_titanium_hull), 1), new Object[] { "PIP", "I I", "PIP", 'P', TI.plate(), 'I', TI.ingot() }); - addRecipeAuto(new ItemStack(Item.getItemFromBlock(ModBlocks.factory_titanium_furnace), 1), new Object[] { "HMH", "MFM", "HMH", 'H', Item.getItemFromBlock(ModBlocks.factory_titanium_hull), 'M', ModItems.motor, 'F', Item.getItemFromBlock(Blocks.furnace) }); - addRecipeAuto(new ItemStack(Item.getItemFromBlock(ModBlocks.factory_titanium_conductor), 1), new Object[] { "SWS", "FFF", "SWS", 'S', TI.ingot(), 'W', Item.getItemFromBlock(ModBlocks.red_wire_coated), 'F', ModItems.fuse }); - addRecipeAuto(new ItemStack(Item.getItemFromBlock(ModBlocks.factory_titanium_core), 1), new Object[] { "HPH", "PCP", "HPH", 'H', Item.getItemFromBlock(ModBlocks.factory_titanium_hull), 'C', ModItems.circuit_aluminium, 'P', Item.getItemFromBlock(Blocks.piston) }); - addRecipeAuto(ItemBattery.getEmptyBattery(ModItems.factory_core_titanium), new Object[] { "BRB", "RHR", "BRB", 'B', ItemBattery.getEmptyBattery(ModItems.battery_generic), 'R', REDSTONE.block(), 'H', Item.getItemFromBlock(ModBlocks.factory_titanium_hull) }); - addRecipeAuto(ItemBattery.getEmptyBattery(ModItems.factory_core_advanced), new Object[] { "BLB", "SHS", "BLB", 'B', ItemBattery.getEmptyBattery(ModItems.battery_advanced), 'S', S.block(), 'L', PB.block(), 'H', Item.getItemFromBlock(ModBlocks.factory_advanced_hull) }); - addRecipeAuto(ItemBattery.getEmptyBattery(ModItems.factory_core_advanced), new Object[] { "BSB", "LHL", "BSB", 'B', ItemBattery.getEmptyBattery(ModItems.battery_advanced), 'S', S.block(), 'L', PB.block(), 'H', Item.getItemFromBlock(ModBlocks.factory_advanced_hull) }); + addRecipeAuto(new ItemStack(Item.getItemFromBlock(ModBlocks.factory_advanced_hull), 1), new Object[] { "PIP", "I I", "PIP", 'P', ALLOY.plate(), 'I', ALLOY.ingot() }); addRecipeAuto(new ItemStack(ModItems.arc_electrode, 1), new Object[] { "C", "T", "C", 'C', GRAPHITE.ingot(), 'T', ModItems.bolt_tungsten }); addRecipeAuto(new ItemStack(ModItems.arc_electrode_desh, 1), new Object[] { "C", "T", "C", 'C', DESH.dust(), 'T', ModItems.arc_electrode }); diff --git a/src/main/java/com/hbm/render/item/ItemRenderLibrary.java b/src/main/java/com/hbm/render/item/ItemRenderLibrary.java index 64254fb6a..a82248153 100644 --- a/src/main/java/com/hbm/render/item/ItemRenderLibrary.java +++ b/src/main/java/com/hbm/render/item/ItemRenderLibrary.java @@ -1292,21 +1292,21 @@ public class ItemRenderLibrary { }}); renderers.put(Item.getItemFromBlock(ModBlocks.machine_assemfac), new ItemRenderBase( ) { - public void renderInventory() { - GL11.glScaled(2.5, 2.5, 2.5); - } - public void renderCommon() { - GL11.glScaled(0.5, 0.5, 0.5); - GL11.glShadeModel(GL11.GL_SMOOTH); - bindTexture(ResourceManager.assemfac_tex); ResourceManager.assemfac.renderPart("Factory"); - for(int i = 1; i < 7; i++) { - ResourceManager.assemfac.renderPart("Pivot" + i); - ResourceManager.assemfac.renderPart("Arm" + i); - ResourceManager.assemfac.renderPart("Piston" + i); - ResourceManager.assemfac.renderPart("Striker" + i); + public void renderInventory() { + GL11.glScaled(2.5, 2.5, 2.5); } - GL11.glShadeModel(GL11.GL_FLAT); - }}); + public void renderCommon() { + GL11.glScaled(0.5, 0.5, 0.5); + GL11.glShadeModel(GL11.GL_SMOOTH); + bindTexture(ResourceManager.assemfac_tex); ResourceManager.assemfac.renderPart("Factory"); + for(int i = 1; i < 7; i++) { + ResourceManager.assemfac.renderPart("Pivot" + i); + ResourceManager.assemfac.renderPart("Arm" + i); + ResourceManager.assemfac.renderPart("Piston" + i); + ResourceManager.assemfac.renderPart("Striker" + i); + } + GL11.glShadeModel(GL11.GL_FLAT); + }}); renderers.put(Item.getItemFromBlock(ModBlocks.furnace_iron), new ItemRenderBase( ) { public void renderInventory() { @@ -1319,6 +1319,26 @@ public class ItemRenderLibrary { ResourceManager.furnace_iron.renderPart("Main"); ResourceManager.furnace_iron.renderPart("Off"); }}); + + renderers.put(Item.getItemFromBlock(ModBlocks.turret_arty), new ItemRenderBase( ) { + public void renderInventory() { + GL11.glTranslated(-3, -4, 0); + GL11.glScaled(3.5, 3.5, 3.5); + } + public void renderCommon() { + GL11.glRotated(-90, 0, 1, 0); + GL11.glScaled(0.5, 0.5, 0.5); + GL11.glShadeModel(GL11.GL_SMOOTH); + bindTexture(ResourceManager.turret_arty_tex); + ResourceManager.turret_arty.renderPart("Base"); + ResourceManager.turret_arty.renderPart("Carriage"); + GL11.glTranslated(0, 3, 0); + GL11.glRotated(45, 1, 0, 0); + GL11.glTranslated(0, -3, 0); + ResourceManager.turret_arty.renderPart("Cannon"); + ResourceManager.turret_arty.renderPart("Barrel"); + GL11.glShadeModel(GL11.GL_FLAT); + }}); } private static void bindTexture(ResourceLocation res) { diff --git a/src/main/java/com/hbm/render/item/weapon/ItemRenderWeaponGlass.java b/src/main/java/com/hbm/render/item/weapon/ItemRenderWeaponGlass.java index 02464712e..aa8e186e4 100644 --- a/src/main/java/com/hbm/render/item/weapon/ItemRenderWeaponGlass.java +++ b/src/main/java/com/hbm/render/item/weapon/ItemRenderWeaponGlass.java @@ -2,7 +2,6 @@ package com.hbm.render.item.weapon; import org.lwjgl.opengl.GL11; -import com.hbm.handler.BulletConfigSyncingUtil; import com.hbm.handler.BulletConfiguration; import com.hbm.items.weapon.gununified.ItemEnergyGunBase; import com.hbm.main.ResourceManager; @@ -12,8 +11,6 @@ import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.item.ItemStack; import net.minecraftforge.client.IItemRenderer; -import net.minecraftforge.client.IItemRenderer.ItemRenderType; -import net.minecraftforge.client.IItemRenderer.ItemRendererHelper; public class ItemRenderWeaponGlass implements IItemRenderer { @@ -52,9 +49,8 @@ public class ItemRenderWeaponGlass implements IItemRenderer { double s0 = 0.5D; GL11.glRotated(25, 0, 0, 1); - GL11.glTranslated(2.5, 0.15, 0.5); - GL11.glRotated(90, 0, -1, 0); - GL11.glRotatef(90, 0, 1, 0); + GL11.glTranslated(2.25, 0.0, 0.125); + GL11.glRotatef(-10, 0, 1, 0); GL11.glScaled(s0, s0, s0); break; diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityCoreAdvanced.java b/src/main/java/com/hbm/tileentity/machine/TileEntityCoreAdvanced.java index a945201d1..27e1b8b90 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityCoreAdvanced.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityCoreAdvanced.java @@ -234,426 +234,11 @@ public class TileEntityCoreAdvanced extends TileEntityLoadedBase implements ISid } @Override - public void updateEntity() { - - if(!worldObj.isRemote) { - if(worldObj.getBlock(xCoord, yCoord + 1, zCoord) == ModBlocks.factory_advanced_conductor) - this.trySubscribe(worldObj, xCoord, yCoord + 2, zCoord, ForgeDirection.UP); - else - this.tryUnsubscribe(worldObj, xCoord, yCoord + 2, zCoord); - - if(worldObj.getBlock(xCoord, yCoord - 1, zCoord) == ModBlocks.factory_advanced_conductor) - this.trySubscribe(worldObj, xCoord, yCoord - 2, zCoord, ForgeDirection.DOWN); - else - this.tryUnsubscribe(worldObj, xCoord, yCoord - 2, zCoord); - } - - if(this.slots[22] != null && this.slots[22].getItem() == ModItems.factory_core_advanced) - { - this.power = (int) ((IBatteryItem)slots[22].getItem()).getCharge(slots[22]); - } else { - this.power = 0; - } - - if(this.slots[9] == null) - { - for(int i = 0; i < 9; i++) - { - if(slots[i] != null && isProcessable(slots[i])) - { - slots[9] = slots[i].copy(); - slots[i] = null; - break; - } - } - } else { - for(int i = 0; i < 9; i++) - { - if(slots[i] != null) - { - if(slots[i].getItem() == slots[9].getItem() && slots[i].getItemDamage() == slots[9].getItemDamage()) - { - if(slots[9].stackSize + slots[i].stackSize <= slots[i].getMaxStackSize()) - { - slots[9].stackSize += slots[i].stackSize; - slots[i] = null; - } else { - int j = slots[9].getMaxStackSize() - slots[9].stackSize; - slots[9].stackSize += j; - slots[i].stackSize -= j; - } - break; - } - } - } - } - - if(this.slots[10] == null) - { - for(int i = 0; i < 9; i++) - { - if(slots[i] != null && isProcessable(slots[i])) - { - slots[10] = slots[i].copy(); - slots[i] = null; - break; - } - } - } else { - for(int i = 0; i < 9; i++) - { - if(slots[i] != null) - { - if(slots[i].getItem() == slots[10].getItem() && slots[i].getItemDamage() == slots[10].getItemDamage()) - { - if(slots[10].stackSize + slots[i].stackSize <= slots[i].getMaxStackSize()) - { - slots[10].stackSize += slots[i].stackSize; - slots[i] = null; - } else { - int j = slots[10].getMaxStackSize() - slots[10].stackSize; - slots[10].stackSize += j; - slots[i].stackSize -= j; - } - break; - } - } - } - } - - if(this.slots[23] == null) - { - for(int i = 0; i < 9; i++) - { - if(slots[i] != null && isProcessable(slots[i])) - { - slots[23] = slots[i].copy(); - slots[i] = null; - break; - } - } - } else { - for(int i = 0; i < 9; i++) - { - if(slots[i] != null) - { - if(slots[i].getItem() == slots[23].getItem() && slots[i].getItemDamage() == slots[23].getItemDamage()) - { - if(slots[23].stackSize + slots[i].stackSize <= slots[i].getMaxStackSize()) - { - slots[23].stackSize += slots[i].stackSize; - slots[i] = null; - } else { - int j = slots[23].getMaxStackSize() - slots[23].stackSize; - slots[23].stackSize += j; - slots[i].stackSize -= j; - } - break; - } - } - } - } - - if(this.slots[24] == null) - { - for(int i = 0; i < 9; i++) - { - if(slots[i] != null && isProcessable(slots[i])) - { - slots[24] = slots[i].copy(); - slots[i] = null; - break; - } - } - } else { - for(int i = 0; i < 9; i++) - { - if(slots[i] != null) - { - if(slots[i].getItem() == slots[24].getItem() && slots[i].getItemDamage() == slots[24].getItemDamage()) - { - if(slots[24].stackSize + slots[i].stackSize <= slots[i].getMaxStackSize()) - { - slots[24].stackSize += slots[i].stackSize; - slots[i] = null; - } else { - int j = slots[24].getMaxStackSize() - slots[24].stackSize; - slots[24].stackSize += j; - slots[i].stackSize -= j; - } - break; - } - } - } - } - - if(this.power > 0 && (isProcessable(slots[9]) || isProcessable(slots[10]) || isProcessable(slots[23]) || isProcessable(slots[24])) && isStructureValid(worldObj)) - { - this.progress += 1; - ((ItemBattery)slots[22].getItem()).dischargeBattery(slots[22], 1); - if(soundCycle == 0) - this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "minecart.base", 1.0F, 0.75F); - soundCycle++; - - if(soundCycle >= 50) - soundCycle = 0; - } else { - this.progress = 0; - } - - if(slots[9] != null && slots[11] != null && (FurnaceRecipes.smelting().getSmeltingResult(slots[9]).getItem() != slots[11].getItem() || FurnaceRecipes.smelting().getSmeltingResult(slots[9]).getItemDamage() != slots[11].getItemDamage())) - { - this.progress = 0; - } - - if(slots[10] != null && slots[12] != null && (FurnaceRecipes.smelting().getSmeltingResult(slots[10]).getItem() != slots[12].getItem() || FurnaceRecipes.smelting().getSmeltingResult(slots[10]).getItemDamage() != slots[12].getItemDamage())) - { - this.progress = 0; - } - - if(slots[23] != null && slots[25] != null && (FurnaceRecipes.smelting().getSmeltingResult(slots[23]).getItem() != slots[25].getItem() || FurnaceRecipes.smelting().getSmeltingResult(slots[23]).getItemDamage() != slots[25].getItemDamage())) - { - this.progress = 0; - } - - if(slots[24] != null && slots[26] != null && (FurnaceRecipes.smelting().getSmeltingResult(slots[24]).getItem() != slots[26].getItem() || FurnaceRecipes.smelting().getSmeltingResult(slots[24]).getItemDamage() != slots[26].getItemDamage())) - { - this.progress = 0; - } - - if(this.progress >= TileEntityCoreAdvanced.processTime) - { - if(this.slots[9] != null && isProcessable(this.slots[9])) - { - ItemStack itemStack = FurnaceRecipes.smelting().getSmeltingResult(slots[9]); - if(slots[11] == null) - { - slots[11] = itemStack.copy(); - }else if(slots[11].isItemEqual(itemStack)) { - slots[11].stackSize += itemStack.stackSize; - } - if(slots[9].stackSize <= 0) - { - slots[9] = new ItemStack(slots[9].getItem().setFull3D()); - }else{ - slots[9].stackSize--; - } - if(slots[9].stackSize <= 0) - { - slots[9] = null; - } - } - if(this.slots[10] != null && isProcessable(this.slots[10])) - { - ItemStack itemStack = FurnaceRecipes.smelting().getSmeltingResult(slots[10]); - if(slots[12] == null) - { - slots[12] = itemStack.copy(); - }else if(slots[12].isItemEqual(itemStack)) { - slots[12].stackSize += itemStack.stackSize; - } - if(slots[10].stackSize <= 0) - { - slots[10] = new ItemStack(slots[10].getItem().setFull3D()); - }else{ - slots[10].stackSize--; - } - if(slots[10].stackSize <= 0) - { - slots[10] = null; - } - } - if(this.slots[23] != null && isProcessable(this.slots[23])) - { - ItemStack itemStack = FurnaceRecipes.smelting().getSmeltingResult(slots[23]); - if(slots[25] == null) - { - slots[25] = itemStack.copy(); - }else if(slots[25].isItemEqual(itemStack)) { - slots[25].stackSize += itemStack.stackSize; - } - if(slots[23].stackSize <= 0) - { - slots[23] = new ItemStack(slots[23].getItem().setFull3D()); - }else{ - slots[23].stackSize--; - } - if(slots[23].stackSize <= 0) - { - slots[23] = null; - } - } - if(this.slots[24] != null && isProcessable(this.slots[24])) - { - ItemStack itemStack = FurnaceRecipes.smelting().getSmeltingResult(slots[24]); - if(slots[26] == null) - { - slots[26] = itemStack.copy(); - }else if(slots[26].isItemEqual(itemStack)) { - slots[26].stackSize += itemStack.stackSize; - } - if(slots[24].stackSize <= 0) - { - slots[24] = new ItemStack(slots[24].getItem().setFull3D()); - }else{ - slots[24].stackSize--; - } - if(slots[24].stackSize <= 0) - { - slots[24] = null; - } - } - - this.progress = 0; - } - - if(this.slots[11] != null) - { - for(int i = 0; i < 9; i++) - { - int j = i + 13; - if(slots[j] != null) - { - if(slots[j].getItem() == slots[11].getItem() && slots[j].getItemDamage() == slots[11].getItemDamage()) - { - if(slots[j].stackSize < slots[j].getMaxStackSize()) - { - if(slots[j].stackSize + slots[11].stackSize <= slots[11].getMaxStackSize()) - { - slots[j].stackSize += slots[11].stackSize; - slots[11] = null; - break; - } else { - int k = slots[j].getMaxStackSize() - slots[j].stackSize; - if(k < 0) - { - slots[j].stackSize += k; - slots[11].stackSize -= k; - break; - } - } - } - } - } else { - slots[j] = slots[11].copy(); - slots[11] = null; - break; - } - } - } - - if(this.slots[12] != null) - { - for(int i = 0; i < 9; i++) - { - int j = i + 13; - if(slots[j] != null) - { - if(slots[j].getItem() == slots[12].getItem() && slots[j].getItemDamage() == slots[12].getItemDamage()) - { - if(slots[j].stackSize < slots[j].getMaxStackSize()) - { - if(slots[j].stackSize + slots[12].stackSize <= slots[12].getMaxStackSize()) - { - slots[j].stackSize += slots[12].stackSize; - slots[12] = null; - break; - } else { - int k = slots[j].getMaxStackSize() - slots[j].stackSize; - if(k < 0) - { - slots[j].stackSize += k; - slots[12].stackSize -= k; - break; - } - } - } - } - } else { - slots[j] = slots[12].copy(); - slots[12] = null; - break; - } - } - } - - if(this.slots[25] != null) - { - for(int i = 0; i < 9; i++) - { - int j = i + 13; - if(slots[j] != null) - { - if(slots[j].getItem() == slots[25].getItem() && slots[j].getItemDamage() == slots[25].getItemDamage()) - { - if(slots[j].stackSize < slots[j].getMaxStackSize()) - { - if(slots[j].stackSize + slots[25].stackSize <= slots[25].getMaxStackSize()) - { - slots[j].stackSize += slots[25].stackSize; - slots[25] = null; - break; - } else { - int k = slots[j].getMaxStackSize() - slots[j].stackSize; - if(k < 0) - { - slots[j].stackSize += k; - slots[25].stackSize -= k; - break; - } - } - } - } - } else { - slots[j] = slots[25].copy(); - slots[25] = null; - break; - } - } - } - - if(this.slots[26] != null) - { - for(int i = 0; i < 9; i++) - { - int j = i + 13; - if(slots[j] != null) - { - if(slots[j].getItem() == slots[26].getItem() && slots[j].getItemDamage() == slots[26].getItemDamage()) - { - if(slots[j].stackSize < slots[j].getMaxStackSize()) - { - if(slots[j].stackSize + slots[26].stackSize <= slots[26].getMaxStackSize()) - { - slots[j].stackSize += slots[26].stackSize; - slots[26] = null; - break; - } else { - int k = slots[j].getMaxStackSize() - slots[j].stackSize; - if(k < 0) - { - slots[j].stackSize += k; - slots[26].stackSize -= k; - break; - } - } - } - } - } else { - slots[j] = slots[26].copy(); - slots[26] = null; - break; - } - } - } - } + public void updateEntity() { } + @Override - public void setPower(long i) { - if(this.slots[22] != null && this.slots[22].getItem() == ModItems.factory_core_advanced) - { - ((ItemBattery)slots[22].getItem()).setCharge(slots[22], (int)i); - } - } + public void setPower(long i) { } + @Override public long getPower() { return power; diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityCoreTitanium.java b/src/main/java/com/hbm/tileentity/machine/TileEntityCoreTitanium.java index 21c51712d..1af5b3cfd 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityCoreTitanium.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityCoreTitanium.java @@ -236,240 +236,11 @@ public class TileEntityCoreTitanium extends TileEntityLoadedBase implements ISid } @Override - public void updateEntity() { - - if(!worldObj.isRemote) { - if(worldObj.getBlock(xCoord, yCoord + 1, zCoord) == ModBlocks.factory_titanium_conductor) - this.trySubscribe(worldObj, xCoord, yCoord + 2, zCoord, ForgeDirection.UP); - else - this.tryUnsubscribe(worldObj, xCoord, yCoord + 2, zCoord); - - if(worldObj.getBlock(xCoord, yCoord - 1, zCoord) == ModBlocks.factory_titanium_conductor) - this.trySubscribe(worldObj, xCoord, yCoord - 2, zCoord, ForgeDirection.DOWN); - else - this.tryUnsubscribe(worldObj, xCoord, yCoord - 2, zCoord); - } - - if(this.slots[22] != null && this.slots[22].getItem() == ModItems.factory_core_titanium) - { - this.power = (int) ((IBatteryItem)slots[22].getItem()).getCharge(slots[22]); - } else { - this.power = 0; - } - - if(this.slots[9] == null) - { - for(int i = 0; i < 9; i++) - { - if(slots[i] != null && isProcessable(slots[i])) - { - slots[9] = slots[i].copy(); - slots[i] = null; - break; - } - } - } else { - for(int i = 0; i < 9; i++) - { - if(slots[i] != null) - { - if(slots[i].getItem() == slots[9].getItem() && slots[i].getItemDamage() == slots[9].getItemDamage()) - { - if(slots[9].stackSize + slots[i].stackSize <= slots[i].getMaxStackSize()) - { - slots[9].stackSize += slots[i].stackSize; - slots[i] = null; - } else { - int j = 64 - slots[9].stackSize; - slots[9].stackSize += j; - slots[i].stackSize -= j; - } - break; - } - } - } - } - - if(this.slots[10] == null) - { - for(int i = 0; i < 9; i++) - { - if(slots[i] != null && isProcessable(slots[i])) - { - slots[10] = slots[i].copy(); - slots[i] = null; - break; - } - } - } else { - for(int i = 0; i < 9; i++) - { - if(slots[i] != null) - { - if(slots[i].getItem() == slots[10].getItem() && slots[i].getItemDamage() == slots[10].getItemDamage()) - { - if(slots[10].stackSize + slots[i].stackSize <= slots[i].getMaxStackSize()) - { - slots[10].stackSize += slots[i].stackSize; - slots[i] = null; - } else { - int j = 64 - slots[10].stackSize; - slots[10].stackSize += j; - slots[i].stackSize -= j; - } - break; - } - } - } - } - - if(this.power > 0 && (isProcessable(slots[9]) || isProcessable(slots[10])) && isStructureValid(worldObj)) - { - this.progress += 1; - ((ItemBattery)slots[22].getItem()).dischargeBattery(slots[22], 1); - if(soundCycle == 0) - this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "minecart.base", 1.0F, 0.75F); - soundCycle++; - - if(soundCycle >= 50) - soundCycle = 0; - } else { - this.progress = 0; - } - - if(slots[9] != null && slots[11] != null && (FurnaceRecipes.smelting().getSmeltingResult(slots[9]).getItem() != slots[11].getItem() || FurnaceRecipes.smelting().getSmeltingResult(slots[9]).getItemDamage() != slots[11].getItemDamage())) - { - this.progress = 0; - } - - if(slots[10] != null && slots[12] != null && (FurnaceRecipes.smelting().getSmeltingResult(slots[10]).getItem() != slots[12].getItem() || FurnaceRecipes.smelting().getSmeltingResult(slots[10]).getItemDamage() != slots[12].getItemDamage())) - { - this.progress = 0; - } - - if(this.progress >= TileEntityCoreTitanium.processTime) - { - if(this.slots[9] != null && isProcessable(this.slots[9])) - { - ItemStack itemStack = FurnaceRecipes.smelting().getSmeltingResult(slots[9]); - if(slots[11] == null) - { - slots[11] = itemStack.copy(); - }else if(slots[11].isItemEqual(itemStack)) { - slots[11].stackSize += itemStack.stackSize; - } - if(slots[9].stackSize <= 0) - { - slots[9] = new ItemStack(slots[9].getItem().setFull3D()); - }else{ - slots[9].stackSize--; - } - if(slots[9].stackSize <= 0) - { - slots[9] = null; - } - } - if(this.slots[10] != null && isProcessable(this.slots[10])) - { - ItemStack itemStack = FurnaceRecipes.smelting().getSmeltingResult(slots[10]); - if(slots[12] == null) - { - slots[12] = itemStack.copy(); - }else if(slots[12].isItemEqual(itemStack)) { - slots[12].stackSize += itemStack.stackSize; - } - if(slots[10].stackSize <= 0) - { - slots[10] = new ItemStack(slots[10].getItem().setFull3D()); - }else{ - slots[10].stackSize--; - } - if(slots[10].stackSize <= 0) - { - slots[10] = null; - } - } - - this.progress = 0; - } - - if(this.slots[11] != null) - { - for(int i = 0; i < 9; i++) - { - int j = i + 13; - if(slots[j] != null) - { - if(slots[j].getItem() == slots[11].getItem() && slots[j].getItemDamage() == slots[11].getItemDamage()) - { - if(slots[j].stackSize < slots[j].getMaxStackSize()) - { - if(slots[j].stackSize + slots[11].stackSize <= slots[11].getMaxStackSize()) - { - slots[j].stackSize += slots[11].stackSize; - slots[11] = null; - break; - } else { - int k = slots[j].getMaxStackSize() - slots[j].stackSize; - if(k < 0) - { - slots[j].stackSize += k; - slots[11].stackSize -= k; - break; - } - } - } - } - } else { - slots[j] = slots[11].copy(); - slots[11] = null; - break; - } - } - } - - if(this.slots[12] != null) - { - for(int i = 0; i < 9; i++) - { - int j = i + 13; - if(slots[j] != null) - { - if(slots[j].getItem() == slots[12].getItem() && slots[j].getItemDamage() == slots[12].getItemDamage()) - { - if(slots[j].stackSize < slots[j].getMaxStackSize()) - { - if(slots[j].stackSize + slots[12].stackSize <= slots[12].getMaxStackSize()) - { - slots[j].stackSize += slots[12].stackSize; - slots[12] = null; - break; - } else { - int k = slots[j].getMaxStackSize() - slots[j].stackSize; - if(k < 0) - { - slots[j].stackSize += k; - slots[12].stackSize -= k; - break; - } - } - } - } - } else { - slots[j] = slots[12].copy(); - slots[12] = null; - break; - } - } - } - } + public void updateEntity() { } + @Override - public void setPower(long i) { - if(this.slots[22] != null && this.slots[22].getItem() == ModItems.factory_core_titanium) - { - ((ItemBattery)slots[22].getItem()).setCharge(slots[22], (int)i); - } - } + public void setPower(long i) { } + @Override public long getPower() { return power; diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemblerBase.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemblerBase.java index 733ff4993..bdb552293 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemblerBase.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemblerBase.java @@ -12,6 +12,7 @@ import com.hbm.util.InventoryUtil; import api.hbm.energy.IEnergyUser; import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChunkCoordinates; @@ -155,6 +156,7 @@ public abstract class TileEntityMachineAssemblerBase extends TileEntityMachineBa if(te instanceof IInventory) { IInventory inv = (IInventory) te; + ISidedInventory sided = inv instanceof ISidedInventory ? (ISidedInventory) inv : null; for(AStack ingredient : recipe) { @@ -163,7 +165,7 @@ public abstract class TileEntityMachineAssemblerBase extends TileEntityMachineBa for(int i = 0; i < inv.getSizeInventory(); i++) { ItemStack stack = inv.getStackInSlot(i); - if(ingredient.matchesRecipe(stack, true)) { + if(ingredient.matchesRecipe(stack, true) && (sided == null || sided.canExtractItem(i, stack, 0))) { for(int j = indices[0]; j <= indices[1]; j++) { @@ -212,6 +214,10 @@ public abstract class TileEntityMachineAssemblerBase extends TileEntityMachineBa if(out != null) { for(int j = 0; j < inv.getSizeInventory(); j++) { + + if(!inv.isItemValidForSlot(j, out)) + continue; + ItemStack target = inv.getStackInSlot(j); if(InventoryUtil.doesStackDataMatch(out, target) && target.stackSize < target.getMaxStackSize() && target.stackSize < inv.getInventoryStackLimit()) { @@ -222,6 +228,9 @@ public abstract class TileEntityMachineAssemblerBase extends TileEntityMachineBa } for(int j = 0; j < inv.getSizeInventory(); j++) { + + if(!inv.isItemValidForSlot(j, out)) + continue; if(inv.getStackInSlot(j) == null && inv.isItemValidForSlot(j, out)) { ItemStack copy = out.copy(); diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplant.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplant.java index fc4721ec7..7d6ac89fc 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplant.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplant.java @@ -27,6 +27,7 @@ import api.hbm.fluid.IFluidStandardTransceiver; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -348,6 +349,7 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements if(te instanceof IInventory) { IInventory inv = (IInventory) te; + ISidedInventory sided = inv instanceof ISidedInventory ? (ISidedInventory) inv : null; for(AStack ingredient : recipe.inputs) { @@ -356,7 +358,7 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements for(int i = 0; i < inv.getSizeInventory(); i++) { ItemStack stack = inv.getStackInSlot(i); - if(ingredient.matchesRecipe(stack, true)) { + if(ingredient.matchesRecipe(stack, true) && (sided == null || sided.canExtractItem(i, stack, 0))) { for(int j = 13; j <= 16; j++) { @@ -405,6 +407,10 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements if(out != null) { for(int j = 0; j < inv.getSizeInventory(); j++) { + + if(!inv.isItemValidForSlot(j, out)) + continue; + ItemStack target = inv.getStackInSlot(j); if(InventoryUtil.doesStackDataMatch(out, target) && target.stackSize < target.getMaxStackSize()) { @@ -416,6 +422,9 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements for(int j = 0; j < inv.getSizeInventory(); j++) { + if(!inv.isItemValidForSlot(j, out)) + continue; + if(inv.getStackInSlot(j) == null && inv.isItemValidForSlot(j, out)) { ItemStack copy = out.copy(); copy.stackSize = 1; diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplantBase.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplantBase.java index bb9b848df..032eff15c 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplantBase.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemplantBase.java @@ -18,6 +18,7 @@ import com.hbm.util.InventoryUtil; import api.hbm.energy.IEnergyUser; import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -218,6 +219,7 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa if(te instanceof IInventory) { IInventory inv = (IInventory) te; + ISidedInventory sided = inv instanceof ISidedInventory ? (ISidedInventory) inv : null; for(AStack ingredient : recipe.inputs) { @@ -226,7 +228,7 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa for(int i = 0; i < inv.getSizeInventory(); i++) { ItemStack stack = inv.getStackInSlot(i); - if(ingredient.matchesRecipe(stack, true)) { + if(ingredient.matchesRecipe(stack, true) && (sided == null || sided.canExtractItem(i, stack, 0))) { for(int j = indices[0]; j <= indices[1]; j++) { @@ -276,6 +278,10 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa if(out != null) { for(int j = 0; j < inv.getSizeInventory(); j++) { + + if(!inv.isItemValidForSlot(j, out)) + continue; + ItemStack target = inv.getStackInSlot(j); if(InventoryUtil.doesStackDataMatch(out, target) && target.stackSize < target.getMaxStackSize() && target.stackSize < inv.getInventoryStackLimit()) { @@ -287,6 +293,9 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa for(int j = 0; j < inv.getSizeInventory(); j++) { + if(!inv.isItemValidForSlot(j, out)) + continue; + if(inv.getStackInSlot(j) == null && inv.isItemValidForSlot(j, out)) { ItemStack copy = out.copy(); copy.stackSize = 1; diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineMiningDrill.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineMiningDrill.java index e7a56664b..c29bd6b3d 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineMiningDrill.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineMiningDrill.java @@ -234,6 +234,10 @@ public class TileEntityMachineMiningDrill extends TileEntityMachineBase implemen ItemStack sta1 = inventory.getStackInSlot(i).copy(); ItemStack sta2 = slots[slot].copy(); + + if(!inventory.isItemValidForSlot(i, sta2)) + continue; + if(sta1 != null && sta2 != null) { sta1.stackSize = 1; sta2.stackSize = 1; @@ -259,6 +263,10 @@ public class TileEntityMachineMiningDrill extends TileEntityMachineBase implemen return false; ItemStack sta2 = slots[slot].copy(); + + if(!inventory.isItemValidForSlot(i, sta2)) + continue; + if(inventory.getStackInSlot(i) == null && sta2 != null) { sta2.stackSize = 1; slots[slot].stackSize--; diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityCraneExtractor.java b/src/main/java/com/hbm/tileentity/network/TileEntityCraneExtractor.java index 3360627b8..a6f08ce7b 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityCraneExtractor.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityCraneExtractor.java @@ -21,6 +21,7 @@ import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; @@ -84,7 +85,8 @@ public class TileEntityCraneExtractor extends TileEntityMachineBase implements I if(te instanceof ISidedInventory) { sided = (ISidedInventory) te; - access = sided.getAccessibleSlotsFromSide(dir.ordinal()); + //access = sided.getAccessibleSlotsFromSide(dir.ordinal()); + access = masquerade(sided, dir.ordinal()); } boolean hasSent = false; @@ -158,6 +160,15 @@ public class TileEntityCraneExtractor extends TileEntityMachineBase implements I } } + public static int[] masquerade(ISidedInventory sided, int side) { + + if(sided instanceof TileEntityFurnace) { + return new int[] {2}; + } + + return sided.getAccessibleSlotsFromSide(side); + } + public void networkUnpack(NBTTagCompound nbt) { this.isWhitelist = nbt.getBoolean("isWhitelist"); this.matcher.modes = new String[this.matcher.modes.length]; diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityCraneInserter.java b/src/main/java/com/hbm/tileentity/network/TileEntityCraneInserter.java index 35ce9fdaf..ab8089d07 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityCraneInserter.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityCraneInserter.java @@ -43,7 +43,8 @@ public class TileEntityCraneInserter extends TileEntityMachineBase implements IG if(te instanceof ISidedInventory) { ISidedInventory sided = (ISidedInventory) te; - access = sided.getAccessibleSlotsFromSide(dir.ordinal()); + //access = sided.getAccessibleSlotsFromSide(dir.ordinal()); + access = CraneInserter.masquerade(sided, dir.ordinal()); } if(te instanceof IInventory) { diff --git a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretArty.java b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretArty.java index 2e147e50d..c35818c77 100644 --- a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretArty.java +++ b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretArty.java @@ -3,6 +3,7 @@ package com.hbm.tileentity.turret; import java.util.ArrayList; import java.util.List; +import com.hbm.blocks.BlockDummyable; import com.hbm.entity.projectile.EntityArtilleryShell; import com.hbm.handler.BulletConfigSyncingUtil; import com.hbm.inventory.container.ContainerTurretBase; @@ -24,6 +25,7 @@ import net.minecraft.item.Item; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.Vec3; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; public class TileEntityTurretArty extends TileEntityTurretBaseNT implements IGUIProvider { @@ -49,7 +51,12 @@ public class TileEntityTurretArty extends TileEntityTurretBaseNT implements IGUI } public void enqueueTarget(double x, double y, double z) { - this.targetQueue.add(Vec3.createVectorHelper(x, y, z)); + + Vec3 pos = this.getTurretPos(); + Vec3 delta = Vec3.createVectorHelper(x - pos.xCoord, y - pos.yCoord, z - pos.zCoord); + if(delta.lengthVector() <= this.getDecetorRange()) { + this.targetQueue.add(Vec3.createVectorHelper(x, y, z)); + } } @Override @@ -111,6 +118,11 @@ public class TileEntityTurretArty extends TileEntityTurretBaseNT implements IGUI public double getTurretElevation() { return 90D; } + + @Override + public int getDecetorInterval() { + return mode == MODE_CANNON ? 20 : 200; + } @Override protected void seekNewTarget() { @@ -148,7 +160,7 @@ public class TileEntityTurretArty extends TileEntityTurretBaseNT implements IGUI /* * This is done to compensate for the barrel length, as this small deviation has a huge impact in both modes at longer ranges. * The consequence of this is that using the >before< angle of the barrel as an approximation can lead to problems at closer range, - * as the math tries to properly calculate the >after< angle. This should not be a problem due to the etector grace distance being + * as the math tries to properly calculate the >after< angle. This should not be a problem due to the detector grace distance being * rather high, but it is still important to note. */ pos.xCoord += barrel.xCoord; @@ -160,7 +172,7 @@ public class TileEntityTurretArty extends TileEntityTurretBaseNT implements IGUI double x = Math.sqrt(delta.xCoord * delta.xCoord + delta.zCoord * delta.zCoord); double y = delta.yCoord; - double v0 = 20; + double v0 = getV0(); double v02 = v0 * v0; double g = 9.81 * 0.05; double upperLower = mode == MODE_CANNON ? -1 : 1; @@ -169,6 +181,10 @@ public class TileEntityTurretArty extends TileEntityTurretBaseNT implements IGUI this.turnTowardsAngle(targetPitch, targetYaw); } + public double getV0() { + return mode == MODE_CANNON ? 20D : 50D; + } + public int getShellLoaded() { for(int i = 1; i < 10; i++) { @@ -203,7 +219,7 @@ public class TileEntityTurretArty extends TileEntityTurretBaseNT implements IGUI EntityArtilleryShell proj = new EntityArtilleryShell(worldObj); proj.setPositionAndRotation(pos.xCoord + vec.xCoord, pos.yCoord + vec.yCoord, pos.zCoord + vec.zCoord, 0.0F, 0.0F); - proj.setThrowableHeading(vec.xCoord, vec.yCoord, vec.zCoord, 20F, 0.0F); + proj.setThrowableHeading(vec.xCoord, vec.yCoord, vec.zCoord, (float) getV0(), 0.0F); proj.setTarget((int) tPos.xCoord, (int) tPos.yCoord, (int) tPos.zCoord); proj.setType(type); @@ -213,6 +229,20 @@ public class TileEntityTurretArty extends TileEntityTurretBaseNT implements IGUI worldObj.spawnEntityInWorld(proj); } + protected void updateConnections() { + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset).getOpposite(); + ForgeDirection rot = dir.getRotation(ForgeDirection.UP); + + for(int i = 0; i < 2; i++) { + for(int j = 0; j < 4; j++) { + this.trySubscribe(worldObj, xCoord + dir.offsetX * (-1 + j) + rot.offsetX * -3, yCoord + i, zCoord + dir.offsetZ * (-1 + j) + rot.offsetZ * -3, ForgeDirection.SOUTH); + this.trySubscribe(worldObj, xCoord + dir.offsetX * (-1 + j) + rot.offsetX * 2, yCoord + i, zCoord + dir.offsetZ * (-1 + j) + rot.offsetZ * 2, ForgeDirection.NORTH); + this.trySubscribe(worldObj, xCoord + dir.offsetX * -2 + rot.offsetX * (1 - j), yCoord + i, zCoord + dir.offsetZ * -2 + rot.offsetZ * (1 - j), ForgeDirection.EAST); + this.trySubscribe(worldObj, xCoord + dir.offsetX * 3 + rot.offsetX * (1 - j), yCoord + i, zCoord + dir.offsetZ * 3 + rot.offsetZ * (1 - j), ForgeDirection.WEST); + } + } + } + @Override public void updateEntity() { @@ -251,6 +281,8 @@ public class TileEntityTurretArty extends TileEntityTurretBaseNT implements IGUI if(!worldObj.isRemote) { + this.updateConnections(); + if(this.target != null && !target.isEntityAlive()) { this.target = null; this.stattrak++; @@ -342,7 +374,9 @@ public class TileEntityTurretArty extends TileEntityTurretBaseNT implements IGUI timer++; - if(timer % 40 == 0) { + int delay = mode == MODE_ARTILLERY ? 200 : 40; + + if(timer % delay == 0) { int conf = this.getShellLoaded(); @@ -377,6 +411,10 @@ public class TileEntityTurretArty extends TileEntityTurretBaseNT implements IGUI this.mode++; if(this.mode > 2) this.mode = 0; + + this.tPos = null; + this.targetQueue.clear(); + } else{ super.handleButtonPacket(value, meta); } diff --git a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretBaseNT.java b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretBaseNT.java index 11b8b5412..40155d00a 100644 --- a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretBaseNT.java +++ b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretBaseNT.java @@ -248,7 +248,7 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple return data; } - private void updateConnections() { + protected void updateConnections() { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset).getOpposite(); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); diff --git a/src/main/java/com/hbm/util/ArmorUtil.java b/src/main/java/com/hbm/util/ArmorUtil.java index 6c42058ef..ff292c09c 100644 --- a/src/main/java/com/hbm/util/ArmorUtil.java +++ b/src/main/java/com/hbm/util/ArmorUtil.java @@ -98,6 +98,10 @@ public class ArmorUtil { return; entity.getEquipmentInSlot(slot + 1).damageItem(amount, entity); + + if(entity.getEquipmentInSlot(slot + 1).stackSize == 0) { + entity.setCurrentItemOrArmor(slot + 1, null); + } } public static void resetFlightTime(EntityPlayer player) { diff --git a/src/main/resources/assets/hbm/lang/de_DE.lang b/src/main/resources/assets/hbm/lang/de_DE.lang index bb61339ef..8ce100638 100644 --- a/src/main/resources/assets/hbm/lang/de_DE.lang +++ b/src/main/resources/assets/hbm/lang/de_DE.lang @@ -318,6 +318,7 @@ container.soyuzLauncher=Soyuz-Startplatform container.storageDrum=Atommüll-Lagertrommel container.teleLinker=TelLink-Gerät container.teleporter=Teleporter +container.turretArty=Greg container.turretChekhov=Tschechows Gewehr container.turretFriendly=Mister Friendly container.turretFritz=Fritz @@ -678,6 +679,12 @@ item.ammo_9mm_ap.name=9mm Patrone (Panzerbrechend) item.ammo_9mm_chlorophyte.name=9mm Patrone (Grünalgen) item.ammo_9mm_du.name=9mm Patrone (DU) item.ammo_9mm_rocket.name=9mm Rakete +item.ammo_arty.name=16" Artilleriegranate +item.ammo_arty_classic.name=16" Artilleriegranate (Das Factorio-Spezial) +item.ammo_arty_he.name=16" Artilleriegranate (HE) +item.ammo_arty_mini_nuke.name=16" Mikroatomgranate +item.ammo_arty_nuke.name=16" Atomare Artilleriegranate +item.ammo_arty_phosphorus.name=16" Phosphor-Artilleriegranate item.ammo_cell.name=Energiezelle item.ammo_container.name=Munitionsbehälter item.ammo_dart.name=Plastikdart (Withernd) @@ -1049,7 +1056,7 @@ item.cape_schrabidium.name=Cape (Schrabidisch) item.cape_vertice.name=Lord Vertices Cape item.cart.crate.name=Stahlkistenlore item.cart.destroyer.name=Schuttzerstörende Lore -item.cart.empty.name=Stählerne Lore +item.cart.empty.name=Lore item.casing_357.name=.357 Magnum-Hülse (x24) item.casing_44.name=.44 Magnum-Hülse (x24) item.casing_50.name=Großkaliberhülse (x12) @@ -1279,6 +1286,7 @@ item.desh_pickaxe.name=Arbeitslegierungsspitzhacke item.desh_shovel.name=Arbeitslegierungsschaufel item.desh_sword.name=Arbeitslegierungsschwert item.designator.name=Kurzdistanz Zielmarkierer +item.designator_arty_range.name=Weitstrecken Artilleriefernbedienung item.designator_manual.name=Manueller Zielmarkierer item.designator_range.name=Weitstrecken-Zielmarkierer item.detonator.name=Fernzünder @@ -3676,6 +3684,7 @@ tile.tile_lab_cracked.name=Gesprungene Laborfliesen tile.tnt_ntm.name=Echtes TNT tile.toxic_block.name=Stereotypischer grüner Schleim tile.transition_seal.name=Übergangssiegel +tile.turret_arty.name=Artilleriegeschütz "Greg" tile.turret_cheapo.name=Billigsdorfer Gatling-Geschütz tile.turret_chekhov.name=Schweres MG-Geschütz "Tschechows Gewehr" tile.turret_cwis.name=Phalanx Mk-15 CIWS diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index f93d66595..9c5f71776 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -495,6 +495,7 @@ container.soyuzLauncher=Soyuz Launch Platform container.storageDrum=Nuclear Waste Disposal Drum container.teleLinker=TelLink Device container.teleporter=Teleporter +container.turretArty=Greg container.turretChekhov=Chekhov's Gun container.turretFriendly=Mister Friendly container.turretFritz=Fritz @@ -892,6 +893,12 @@ item.ammo_9mm_ap.name=9mm Round (Armor Piercing) item.ammo_9mm_chlorophyte.name=9mm Round (Chlorophyte) item.ammo_9mm_du.name=9mm Round (DU) item.ammo_9mm_rocket.name=9mm Rocket +item.ammo_arty.name=16" Artillery Shell +item.ammo_arty_classic.name=16" Artillery Shell (The Factorio Special) +item.ammo_arty_he.name=16" High Explosive Artillery Shell +item.ammo_arty_mini_nuke.name=16" Micro Nuclear Artillery Shell +item.ammo_arty_nuke.name=16" Nuclear Artillery Shell +item.ammo_arty_phosphorus.name=16" Phosphorus Shell item.ammo_cell.name=Energy Cell item.ammo_container.name=Ammo Container item.ammo_dart.name=Plastic Dart (Withering) @@ -1281,7 +1288,7 @@ item.cape_schrabidium.name=Cape (Schrabidic) item.cape_vertice.name=Lord Vertice's Cape item.cart.crate.name=Crate Cart item.cart.destroyer.name=Scrap Destroying Cart -item.cart.empty.name=Steel Minecart +item.cart.empty.name=Minecart item.casing_357.name=.357 Magnum Casing (x24) item.casing_44.name=.44 Magnum Casing (x24) item.casing_50.name=Large Caliber Casing (x12) @@ -1518,6 +1525,7 @@ item.desh_pickaxe.name=Worker's Alloy Pickaxe item.desh_shovel.name=Worker's Alloy Shovel item.desh_sword.name=Worker's Alloy Sword item.designator.name=Short Range Target Designator +item.designator_arty_range.name=Long Range Artillery Remote item.designator_manual.name=Manual Target Designator item.designator_range.name=Long Range Target Designator item.detonator.name=Detonator @@ -4090,6 +4098,7 @@ tile.tile_lab_cracked.name=Cracked Laboratory Tiles tile.tnt_ntm.name=Actual TNT tile.toxic_block.name=Stereotypical Green Ooze tile.transition_seal.name=Transition Seal +tile.turret_arty.name=Artillery Turret "Greg" tile.turret_cheapo.name=Cheapo Gatling Sentry tile.turret_chekhov.name=Heavy Machine Gun Turret "Chekhov's Gun" tile.turret_cwis.name=Phalanx Mk-15 CIWS diff --git a/src/main/resources/assets/hbm/textures/gui/factory_advanced.png b/src/main/resources/assets/hbm/textures/gui/factory_advanced.png deleted file mode 100644 index 9868c4b8a..000000000 Binary files a/src/main/resources/assets/hbm/textures/gui/factory_advanced.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/gui/factory_titanium.png b/src/main/resources/assets/hbm/textures/gui/factory_titanium.png deleted file mode 100644 index 2e24e9a20..000000000 Binary files a/src/main/resources/assets/hbm/textures/gui/factory_titanium.png and /dev/null differ diff --git a/src/main/resources/assets/hbm/textures/gui/machine/gui_radar.png b/src/main/resources/assets/hbm/textures/gui/machine/gui_radar.png index d613e7da2..fdb717ce1 100644 Binary files a/src/main/resources/assets/hbm/textures/gui/machine/gui_radar.png and b/src/main/resources/assets/hbm/textures/gui/machine/gui_radar.png differ diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index b5f55c1d5..b0ca0293a 100755 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -3,7 +3,7 @@ "modid": "hbm", "name": "Hbm's Nuclear Tech", "description": "A mod that adds weapons, nuclear themed stuff and machines", - "version":"1.0.27_X4263H1", + "version":"1.0.27_X4277", "mcversion": "1.7.10", "url": "", "updateUrl": "",