diff --git a/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java b/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java index d79e393d..7c91cd73 100644 --- a/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java +++ b/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java @@ -1,10 +1,14 @@ package com.brandon3055.draconicevolution; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.enchantment.Enchantment; + import com.brandon3055.draconicevolution.client.creativetab.DETab; import com.brandon3055.draconicevolution.common.CommonProxy; import com.brandon3055.draconicevolution.common.lib.OreDoublingRegistry; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.utills.LogHelper; + import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; @@ -12,8 +16,6 @@ import cpw.mods.fml.common.event.FMLInterModComms; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.enchantment.Enchantment; @Mod( modid = References.MODID, @@ -32,10 +34,16 @@ public class DraconicEvolution { @SidedProxy(clientSide = References.CLIENTPROXYLOCATION, serverSide = References.SERVERPROXYLOCATION) public static CommonProxy proxy; - public static CreativeTabs tabToolsWeapons = - new DETab(CreativeTabs.getNextID(), References.MODID, "toolsAndWeapons", 0); - public static CreativeTabs tabBlocksItems = - new DETab(CreativeTabs.getNextID(), References.MODID, "blocksAndItems", 1); + public static CreativeTabs tabToolsWeapons = new DETab( + CreativeTabs.getNextID(), + References.MODID, + "toolsAndWeapons", + 0); + public static CreativeTabs tabBlocksItems = new DETab( + CreativeTabs.getNextID(), + References.MODID, + "blocksAndItems", + 1); public static final String networkChannelName = "DEvolutionNC"; public static SimpleNetworkWrapper network; @@ -52,13 +60,13 @@ public class DraconicEvolution { public static void preInit(final FMLPreInitializationEvent event) { if (debug) LogHelper.info("Initialization"); - // event.getModMetadata().autogenerated = false; - // event.getModMetadata().credits = ""; - // event.getModMetadata().description = "This is a mod originally made for the Tolkiencraft mod pack"; - // event.getModMetadata().authorList = Arrays.asList("brandon3055"); - // event.getModMetadata().logoFile = "banner.png"; - // event.getModMetadata().url = "http://www.brandon3055.com/"; - // event.getModMetadata().version = References.VERSION + "-MC1.7.10"; + // event.getModMetadata().autogenerated = false; + // event.getModMetadata().credits = ""; + // event.getModMetadata().description = "This is a mod originally made for the Tolkiencraft mod pack"; + // event.getModMetadata().authorList = Arrays.asList("brandon3055"); + // event.getModMetadata().logoFile = "banner.png"; + // event.getModMetadata().url = "http://www.brandon3055.com/"; + // event.getModMetadata().version = References.VERSION + "-MC1.7.10"; proxy.preInit(event); } @@ -68,9 +76,9 @@ public class DraconicEvolution { if (debug) System.out.println("init()"); proxy.init(event); - // === + // === - // === + // === } @Mod.EventHandler diff --git a/src/main/java/com/brandon3055/draconicevolution/api/GeneratorOverride.java b/src/main/java/com/brandon3055/draconicevolution/api/GeneratorOverride.java index 82bafa87..23ab183b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/api/GeneratorOverride.java +++ b/src/main/java/com/brandon3055/draconicevolution/api/GeneratorOverride.java @@ -1,12 +1,14 @@ package com.brandon3055.draconicevolution.api; +import java.util.Random; + +import net.minecraft.world.World; + import com.brandon3055.brandonscore.common.utills.DataUtills; import com.brandon3055.draconicevolution.common.world.ChaosWorldGenHandler; import com.brandon3055.draconicevolution.common.world.DraconicWorldGenerator; import com.brandon3055.draconicevolution.common.world.WorldGenEnderComet; import com.brandon3055.draconicevolution.common.world.WorldGenEnderIsland; -import java.util.Random; -import net.minecraft.world.World; /** * Created by Brandon on 11/7/2015. @@ -29,9 +31,9 @@ public class GeneratorOverride { } /** - * This can be used to generate a chaos island at a given set of coordinates - * This method needs to be called foe every chunk in a 360 x 360 block area. - * Its ok to run it on a larger area it just wont do anything to chunks outside that area. + * This can be used to generate a chaos island at a given set of coordinates This method needs to be called foe + * every chunk in a 360 x 360 block area. Its ok to run it on a larger area it just wont do anything to chunks + * outside that area. * * @param chunkX the x pos of the chunk being generated (this is the xCoord divided by 16 not the xCoord itself) * @param chunkZ the z pos of the chunk being generated (this is the zCoord divided by 16 not the zCoord itself) @@ -39,10 +41,14 @@ public class GeneratorOverride { * @param centerZ this should be the center of the area you are spawning the island it (this is the actual zCoord) * @param random a random */ - public static void generateChaosChunk( - World world, int chunkX, int chunkZ, int centerX, int centerZ, Random random) { + public static void generateChaosChunk(World world, int chunkX, int chunkZ, int centerX, int centerZ, + Random random) { ChaosWorldGenHandler.generateChunk( - world, chunkX, chunkZ, new DataUtills.XZPair(centerX, centerZ), random); + world, + chunkX, + chunkZ, + new DataUtills.XZPair(centerX, centerZ), + random); } /** diff --git a/src/main/java/com/brandon3055/draconicevolution/api/IExtendedRFStorage.java b/src/main/java/com/brandon3055/draconicevolution/api/IExtendedRFStorage.java index 95a085b5..de5747bb 100644 --- a/src/main/java/com/brandon3055/draconicevolution/api/IExtendedRFStorage.java +++ b/src/main/java/com/brandon3055/draconicevolution/api/IExtendedRFStorage.java @@ -4,6 +4,7 @@ package com.brandon3055.draconicevolution.api; * Created by Brandon on 6/03/2015. */ public interface IExtendedRFStorage { + /** * I will probably leave these here forever but i highly recommend switching as i may remove then at some point. */ diff --git a/src/main/java/com/brandon3055/draconicevolution/client/ClientProxy.java b/src/main/java/com/brandon3055/draconicevolution/client/ClientProxy.java index 37de6bb4..428e5e63 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/ClientProxy.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/ClientProxy.java @@ -1,5 +1,14 @@ package com.brandon3055.draconicevolution.client; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.ISound; +import net.minecraft.client.particle.EntityFX; +import net.minecraft.item.Item; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.client.MinecraftForgeClient; +import net.minecraftforge.common.MinecraftForge; + import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.handler.ClientEventHandler; import com.brandon3055.draconicevolution.client.handler.HudHandler; @@ -33,6 +42,7 @@ import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.rea import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorEnergyInjector; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorStabilizer; import com.brandon3055.draconicevolution.common.utills.UpdateChecker; + import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; @@ -40,16 +50,9 @@ import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import net.minecraft.client.Minecraft; -import net.minecraft.client.audio.ISound; -import net.minecraft.client.particle.EntityFX; -import net.minecraft.item.Item; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.client.MinecraftForgeClient; -import net.minecraftforge.common.MinecraftForge; public class ClientProxy extends CommonProxy { + private static final boolean debug = DraconicEvolution.debug; public static String downloadLocation; @@ -60,52 +63,52 @@ public class ClientProxy extends CommonProxy { ResourceHandler.init(event); - // downloadLocation = event.getModConfigurationDirectory().getParentFile().getAbsolutePath() + + // downloadLocation = event.getModConfigurationDirectory().getParentFile().getAbsolutePath() + // "/mods/derspack"; - // downloadLocation = downloadLocation.replaceAll("\\\\", "/"); + // downloadLocation = downloadLocation.replaceAll("\\\\", "/"); // - // File rescourcePack = new File(event.getModConfigurationDirectory().getParentFile(), "/mods/derspack"); + // File rescourcePack = new File(event.getModConfigurationDirectory().getParentFile(), "/mods/derspack"); // // - // //File file = new File(downloadLocation); - // if (!rescourcePack.exists()) rescourcePack.mkdir(); + // //File file = new File(downloadLocation); + // if (!rescourcePack.exists()) rescourcePack.mkdir(); // - // LogHelper.info("Downloading Images"); + // LogHelper.info("Downloading Images"); // - // try { - // URL url = new URL("http://i.imgur.com/oHRx1yQ.jpg"); - // String fileName = url.getFile(); - // //String destName = downloadLocation + fileName.substring(fileName.lastIndexOf("/")); - // File dll = new File(rescourcePack, fileName.substring(fileName.lastIndexOf("/"))); + // try { + // URL url = new URL("http://i.imgur.com/oHRx1yQ.jpg"); + // String fileName = url.getFile(); + // //String destName = downloadLocation + fileName.substring(fileName.lastIndexOf("/")); + // File dll = new File(rescourcePack, fileName.substring(fileName.lastIndexOf("/"))); // - // InputStream is = url.openStream(); - // OutputStream os = new FileOutputStream(dll); + // InputStream is = url.openStream(); + // OutputStream os = new FileOutputStream(dll); // - // ByteStreams.copy(is, os); + // ByteStreams.copy(is, os); // - // is.close(); - // os.close(); - // }catch (IOException e){ - // LogHelper.info(e); - // } + // is.close(); + // os.close(); + // }catch (IOException e){ + // LogHelper.info(e); + // } // // - // List defaultResourcePacks = Lists.newArrayList(); - // Field f = ReflectionHelper.findField(Minecraft.class, "defaultResourcePacks", "field_110449_ao"); - // f.setAccessible(true); - // try { - // defaultResourcePacks = (List)f.get(Minecraft.getMinecraft()); - // defaultResourcePacks.add(new FolderResourcePack(rescourcePack)); - // for (Object o : defaultResourcePacks){ - // if (o instanceof FolderResourcePack) LogHelper.info(((FolderResourcePack) o).getPackName()); - // if (o instanceof FileResourcePack) LogHelper.info(((FileResourcePack)o).getPackName()); - // } + // List defaultResourcePacks = Lists.newArrayList(); + // Field f = ReflectionHelper.findField(Minecraft.class, "defaultResourcePacks", "field_110449_ao"); + // f.setAccessible(true); + // try { + // defaultResourcePacks = (List)f.get(Minecraft.getMinecraft()); + // defaultResourcePacks.add(new FolderResourcePack(rescourcePack)); + // for (Object o : defaultResourcePacks){ + // if (o instanceof FolderResourcePack) LogHelper.info(((FolderResourcePack) o).getPackName()); + // if (o instanceof FileResourcePack) LogHelper.info(((FileResourcePack)o).getPackName()); + // } // - // f.set(Minecraft.getMinecraft(), defaultResourcePacks); - // } - // catch (IllegalAccessException e) { - // e.printStackTrace(); - // } + // f.set(Minecraft.getMinecraft(), defaultResourcePacks); + // } + // catch (IllegalAccessException e) { + // e.printStackTrace(); + // } } @@ -114,8 +117,7 @@ public class ClientProxy extends CommonProxy { super.init(event); FMLCommonHandler.instance().bus().register(new KeyInputHandler()); FMLCommonHandler.instance().bus().register(new ClientEventHandler()); - if (ConfigHandler.enableVersionChecker) - FMLCommonHandler.instance().bus().register(new UpdateChecker()); + if (ConfigHandler.enableVersionChecker) FMLCommonHandler.instance().bus().register(new UpdateChecker()); MinecraftForge.EVENT_BUS.register(new HudHandler()); MinecraftForge.EVENT_BUS.register(new ClientEventHandler()); KeyBindings.init(); @@ -154,12 +156,15 @@ public class ClientProxy extends CommonProxy { MinecraftForgeClient.registerItemRenderer( ModItems.draconicSword, new RenderTool( - "models/tools/DraconicSword.obj", "textures/models/tools/DraconicSword.png", (IRenderTweak) - ModItems.draconicSword)); + "models/tools/DraconicSword.obj", + "textures/models/tools/DraconicSword.png", + (IRenderTweak) ModItems.draconicSword)); MinecraftForgeClient.registerItemRenderer( ModItems.wyvernPickaxe, - new RenderTool("models/tools/Pickaxe.obj", "textures/models/tools/Pickaxe.png", (IRenderTweak) - ModItems.wyvernPickaxe)); + new RenderTool( + "models/tools/Pickaxe.obj", + "textures/models/tools/Pickaxe.png", + (IRenderTweak) ModItems.wyvernPickaxe)); MinecraftForgeClient.registerItemRenderer( ModItems.draconicPickaxe, new RenderTool( @@ -174,8 +179,10 @@ public class ClientProxy extends CommonProxy { (IRenderTweak) ModItems.draconicAxe)); MinecraftForgeClient.registerItemRenderer( ModItems.wyvernShovel, - new RenderTool("models/tools/Shovel.obj", "textures/models/tools/Shovel.png", (IRenderTweak) - ModItems.wyvernShovel)); + new RenderTool( + "models/tools/Shovel.obj", + "textures/models/tools/Shovel.png", + (IRenderTweak) ModItems.wyvernShovel)); MinecraftForgeClient.registerItemRenderer( ModItems.draconicShovel, new RenderTool( @@ -184,8 +191,10 @@ public class ClientProxy extends CommonProxy { (IRenderTweak) ModItems.draconicShovel)); MinecraftForgeClient.registerItemRenderer( ModItems.wyvernSword, - new RenderTool("models/tools/Sword.obj", "textures/models/tools/Sword.png", (IRenderTweak) - ModItems.wyvernSword)); + new RenderTool( + "models/tools/Sword.obj", + "textures/models/tools/Sword.png", + (IRenderTweak) ModItems.wyvernSword)); MinecraftForgeClient.registerItemRenderer( ModItems.draconicDestructionStaff, new RenderTool( @@ -195,30 +204,33 @@ public class ClientProxy extends CommonProxy { MinecraftForgeClient.registerItemRenderer( ModItems.draconicHoe, new RenderTool( - "models/tools/DraconicHoe.obj", "textures/models/tools/DraconicHoe.png", (IRenderTweak) - ModItems.draconicHoe)); + "models/tools/DraconicHoe.obj", + "textures/models/tools/DraconicHoe.png", + (IRenderTweak) ModItems.draconicHoe)); MinecraftForgeClient.registerItemRenderer(ModItems.draconicBow, new RenderBowModel(true)); MinecraftForgeClient.registerItemRenderer(ModItems.wyvernBow, new RenderBowModel(false)); } - MinecraftForgeClient.registerItemRenderer( - Item.getItemFromBlock(ModBlocks.draconiumChest), new RenderDraconiumChest()); - MinecraftForgeClient.registerItemRenderer( - Item.getItemFromBlock(ModBlocks.particleGenerator), new RenderParticleGen()); - MinecraftForgeClient.registerItemRenderer( - Item.getItemFromBlock(ModBlocks.energyInfuser), new RenderEnergyInfuser()); + MinecraftForgeClient + .registerItemRenderer(Item.getItemFromBlock(ModBlocks.draconiumChest), new RenderDraconiumChest()); + MinecraftForgeClient + .registerItemRenderer(Item.getItemFromBlock(ModBlocks.particleGenerator), new RenderParticleGen()); + MinecraftForgeClient + .registerItemRenderer(Item.getItemFromBlock(ModBlocks.energyInfuser), new RenderEnergyInfuser()); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.energyCrystal), new RenderCrystal()); MinecraftForgeClient.registerItemRenderer( - Item.getItemFromBlock(ModBlocks.reactorStabilizer), new RenderReactorStabilizer()); + Item.getItemFromBlock(ModBlocks.reactorStabilizer), + new RenderReactorStabilizer()); MinecraftForgeClient.registerItemRenderer( - Item.getItemFromBlock(ModBlocks.reactorEnergyInjector), new RenderReactorEnergyInjector()); - MinecraftForgeClient.registerItemRenderer( - Item.getItemFromBlock(ModBlocks.reactorCore), new RenderReactorCore()); + Item.getItemFromBlock(ModBlocks.reactorEnergyInjector), + new RenderReactorEnergyInjector()); + MinecraftForgeClient + .registerItemRenderer(Item.getItemFromBlock(ModBlocks.reactorCore), new RenderReactorCore()); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.earthBlock), new RenderEarthItem()); - MinecraftForgeClient.registerItemRenderer( - Item.getItemFromBlock(ModBlocks.chaosCrystal), new RenderChaosShard()); - MinecraftForgeClient.registerItemRenderer( - Item.getItemFromBlock(ModBlocks.upgradeModifier), new RenderUpgradeModifier()); + MinecraftForgeClient + .registerItemRenderer(Item.getItemFromBlock(ModBlocks.chaosCrystal), new RenderChaosShard()); + MinecraftForgeClient + .registerItemRenderer(Item.getItemFromBlock(ModBlocks.upgradeModifier), new RenderUpgradeModifier()); // ISimpleBlockRendering RenderingRegistry.registerBlockHandler(new RenderTeleporterStand()); @@ -241,8 +253,8 @@ public class ClientProxy extends CommonProxy { ClientRegistry.bindTileEntitySpecialRenderer(TileWirelessEnergyTransceiver.class, new RenderTileCrystal()); ClientRegistry.bindTileEntitySpecialRenderer(TileReactorCore.class, new RenderTileReactorCore()); ClientRegistry.bindTileEntitySpecialRenderer(TileReactorStabilizer.class, new RenderTileReactorStabilizer()); - ClientRegistry.bindTileEntitySpecialRenderer( - TileReactorEnergyInjector.class, new RenderTileReactorEnergyInjector()); + ClientRegistry + .bindTileEntitySpecialRenderer(TileReactorEnergyInjector.class, new RenderTileReactorEnergyInjector()); ClientRegistry.bindTileEntitySpecialRenderer(TileChaosShard.class, new RenderTileChaosShard()); ClientRegistry.bindTileEntitySpecialRenderer(TileUpgradeModifier.class, new RenderTileUpgradeModifier()); @@ -262,19 +274,8 @@ public class ClientProxy extends CommonProxy { } @Override - public ParticleEnergyBeam energyBeam( - World worldObj, - double x, - double y, - double z, - double tx, - double ty, - double tz, - int powerFlow, - boolean advanced, - ParticleEnergyBeam oldBeam, - boolean render, - int beamType) { + public ParticleEnergyBeam energyBeam(World worldObj, double x, double y, double z, double tx, double ty, double tz, + int powerFlow, boolean advanced, ParticleEnergyBeam oldBeam, boolean render, int beamType) { if (!worldObj.isRemote) return null; ParticleEnergyBeam beam = oldBeam; boolean inRange = ParticleHandler.isInRange(x, y, z, 50) || ParticleHandler.isInRange(tx, ty, tz, 50); @@ -295,15 +296,8 @@ public class ClientProxy extends CommonProxy { } @Override - public ParticleEnergyField energyField( - World worldObj, - double x, - double y, - double z, - int type, - boolean advanced, - ParticleEnergyField oldBeam, - boolean render) { + public ParticleEnergyField energyField(World worldObj, double x, double y, double z, int type, boolean advanced, + ParticleEnergyField oldBeam, boolean render) { if (!worldObj.isRemote) return null; ParticleEnergyField beam = oldBeam; boolean inRange = ParticleHandler.isInRange(x, y, z, 50); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/ReactorSound.java b/src/main/java/com/brandon3055/draconicevolution/client/ReactorSound.java index df9fa498..132c78cf 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/ReactorSound.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/ReactorSound.java @@ -1,15 +1,17 @@ package com.brandon3055.draconicevolution.client; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore; import net.minecraft.client.audio.ITickableSound; import net.minecraft.client.audio.PositionedSound; import net.minecraft.util.ResourceLocation; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore; + /** * Created by brandon3055 on 4/10/2015. */ public class ReactorSound extends PositionedSound implements ITickableSound { + private static ResourceLocation sound = new ResourceLocation(References.RESOURCESPREFIX + "coreSound"); public boolean donePlaying = false; private TileReactorCore tile; @@ -36,23 +38,24 @@ public class ReactorSound extends PositionedSound implements ITickableSound { if (tile.reactionTemperature > 8000) { volume += (float) ((tile.reactionTemperature - 8000D) / 1000D); } - if (tile.reactionTemperature > 2000 - && tile.maxFieldCharge > 0 + if (tile.reactionTemperature > 2000 && tile.maxFieldCharge > 0 && tile.fieldCharge < (tile.maxFieldCharge * 0.2D)) { volume += 2D - ((tile.fieldCharge / tile.maxFieldCharge) * 10D); } - if (tile.reactionTemperature > 2000 - && tile.reactorFuel + tile.convertedFuel > 0 + if (tile.reactionTemperature > 2000 && tile.reactorFuel + tile.convertedFuel > 0 && tile.reactorFuel < (double) (tile.reactorFuel + tile.convertedFuel) * 0.2D) { volume += 2D - ((tile.reactorFuel / (tile.reactorFuel + tile.convertedFuel)) * 10D); } field_147663_c = 0.5F + volume / 2F; - if (tile.isInvalid() - || !tile.getWorldObj() - .getChunkFromBlockCoords(tile.xCoord, tile.zCoord) - .isChunkLoaded) { // || player == null || tile.getDistanceFrom(player.posX, player.posY, + if (tile.isInvalid() || !tile.getWorldObj().getChunkFromBlockCoords(tile.xCoord, tile.zCoord).isChunkLoaded) { // || + // player + // == + // null + // || + // tile.getDistanceFrom(player.posX, + // player.posY, // player.posZ) > 512){ donePlaying = true; repeat = false; diff --git a/src/main/java/com/brandon3055/draconicevolution/client/creativetab/DETab.java b/src/main/java/com/brandon3055/draconicevolution/client/creativetab/DETab.java index 5670ff03..f347d41a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/creativetab/DETab.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/creativetab/DETab.java @@ -1,25 +1,27 @@ package com.brandon3055.draconicevolution.client.creativetab; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.ModItems; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.ModItems; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class DETab extends CreativeTabs { + private String label; private int tab; static ItemStack iconStackStaff; public static void initialize() { - if (ModItems.isEnabled(ModItems.draconicDestructionStaff)) - iconStackStaff = - ItemNBTHelper.setInteger(new ItemStack(ModItems.draconicDestructionStaff), "Energy", 30000000); + if (ModItems.isEnabled(ModItems.draconicDestructionStaff)) iconStackStaff = ItemNBTHelper + .setInteger(new ItemStack(ModItems.draconicDestructionStaff), "Energy", 30000000); else iconStackStaff = new ItemStack(Items.stick); } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/ConfigGUI.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/ConfigGUI.java index abc1a961..6f29be93 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/ConfigGUI.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/ConfigGUI.java @@ -1,16 +1,18 @@ package com.brandon3055.draconicevolution.client.gui; +import net.minecraft.client.gui.GuiScreen; +import net.minecraftforge.common.config.ConfigElement; +import net.minecraftforge.common.config.Configuration; + import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.lib.References; import cpw.mods.fml.client.config.GuiConfig; -import net.minecraft.client.gui.GuiScreen; -import net.minecraftforge.common.config.ConfigElement; -import net.minecraftforge.common.config.Configuration; /** * Created by Brandon on 6/08/2014. */ public class ConfigGUI extends GuiConfig { + public ConfigGUI(GuiScreen parent) { super( parent, diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/CustomGuiButton.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/CustomGuiButton.java index 86d7cc21..95e0f533 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/CustomGuiButton.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/CustomGuiButton.java @@ -4,6 +4,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.OpenGlHelper; + import org.lwjgl.opengl.GL11; public class CustomGuiButton extends GuiButton { @@ -17,8 +18,7 @@ public class CustomGuiButton extends GuiButton { FontRenderer fontrenderer = minecraft.fontRenderer; minecraft.getTextureManager().bindTexture(buttonTextures); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.field_146123_n = p_146112_2_ >= this.xPosition - && p_146112_3_ >= this.yPosition + this.field_146123_n = p_146112_2_ >= this.xPosition && p_146112_3_ >= this.yPosition && p_146112_2_ < this.xPosition + this.width && p_146112_3_ < this.yPosition + this.height; int k = this.getHoverState(this.field_146123_n); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/DEGUIFactory.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/DEGUIFactory.java index f6909481..3517656d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/DEGUIFactory.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/DEGUIFactory.java @@ -1,14 +1,17 @@ package com.brandon3055.draconicevolution.client.gui; -import cpw.mods.fml.client.IModGuiFactory; import java.util.Set; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; +import cpw.mods.fml.client.IModGuiFactory; + /** * Created by Brandon on 6/08/2014. */ public class DEGUIFactory implements IModGuiFactory { + @Override public void initialize(Minecraft minecraftInstance) {} diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIContainerTemplate.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIContainerTemplate.java index ada161d3..e9e50616 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIContainerTemplate.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIContainerTemplate.java @@ -1,18 +1,21 @@ package com.brandon3055.draconicevolution.client.gui; -import com.brandon3055.draconicevolution.common.container.ContainerTemplate; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.tileentities.TileContainerTemplate; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; + import org.lwjgl.opengl.GL11; +import com.brandon3055.draconicevolution.common.container.ContainerTemplate; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.tileentities.TileContainerTemplate; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + @SideOnly(Side.CLIENT) public class GUIContainerTemplate extends GuiContainer { @@ -29,8 +32,9 @@ public class GUIContainerTemplate extends GuiContainer { this.player = invPlayer.player; } - private static final ResourceLocation texture = - new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/.png"); + private static final ResourceLocation texture = new ResourceLocation( + References.MODID.toLowerCase(), + "textures/gui/.png"); @Override protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIDissEnchanter.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIDissEnchanter.java index 587ba633..0181809a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIDissEnchanter.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIDissEnchanter.java @@ -1,12 +1,5 @@ package com.brandon3055.draconicevolution.client.gui; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.container.ContainerDissEnchanter; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.network.ButtonPacket; -import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; @@ -14,8 +7,18 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; + import org.lwjgl.opengl.GL11; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.container.ContainerDissEnchanter; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.network.ButtonPacket; +import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + @SideOnly(Side.CLIENT) public class GUIDissEnchanter extends GuiContainer { @@ -34,8 +37,9 @@ public class GUIDissEnchanter extends GuiContainer { this.player = invPlayer.player; } - private static final ResourceLocation texture = - new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/DissEnchanter.png"); + private static final ResourceLocation texture = new ResourceLocation( + References.MODID.toLowerCase(), + "textures/gui/DissEnchanter.png"); @Override protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIDraconiumChest.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIDraconiumChest.java index 6992d937..d0933fcd 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIDraconiumChest.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIDraconiumChest.java @@ -1,21 +1,9 @@ package com.brandon3055.draconicevolution.client.gui; -import codechicken.nei.VisiblityData; -import codechicken.nei.api.INEIGuiHandler; -import codechicken.nei.api.TaggedInventoryArea; -import com.brandon3055.brandonscore.client.utills.GuiHelper; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.client.handler.ResourceHandler; -import com.brandon3055.draconicevolution.common.container.ContainerDraconiumChest; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.network.ButtonPacket; -import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.Collections; import java.util.List; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; @@ -26,17 +14,37 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; + import org.lwjgl.opengl.GL11; +import codechicken.nei.VisiblityData; +import codechicken.nei.api.INEIGuiHandler; +import codechicken.nei.api.TaggedInventoryArea; + +import com.brandon3055.brandonscore.client.utills.GuiHelper; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.client.handler.ResourceHandler; +import com.brandon3055.draconicevolution.common.container.ContainerDraconiumChest; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.network.ButtonPacket; +import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; + +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + @SideOnly(Side.CLIENT) @Optional.Interface(iface = "codechicken.nei.api.INEIGuiHandler", modid = "NotEnoughItems") public class GUIDraconiumChest extends GuiContainer implements INEIGuiHandler { + public EntityPlayer player; private TileDraconiumChest tile; - private static final ResourceLocation textureLeft = - new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/DraconicChestLeft.png"); - private static final ResourceLocation textureRight = - new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/DraconicChestRight.png"); + private static final ResourceLocation textureLeft = new ResourceLocation( + References.MODID.toLowerCase(), + "textures/gui/DraconicChestLeft.png"); + private static final ResourceLocation textureRight = new ResourceLocation( + References.MODID.toLowerCase(), + "textures/gui/DraconicChestRight.png"); private int lastAutoFeed = -1; public GUIDraconiumChest(InventoryPlayer invPlayer, TileDraconiumChest tile) { @@ -69,12 +77,16 @@ public class GUIDraconiumChest extends GuiContainer implements INEIGuiHandler { int arrowHight = (int) (((float) tile.smeltingProgressTime / (float) tile.smeltingCompleateTime) * 22f); drawTexturedModalRect( - guiLeft + 140, guiTop + 192 + 22 - arrowHight, 140, 216 + 22 - arrowHight, 16, arrowHight); + guiLeft + 140, + guiTop + 192 + 22 - arrowHight, + 140, + 216 + 22 - arrowHight, + 16, + arrowHight); Minecraft.getMinecraft().getTextureManager().bindTexture(textureRight); int energyWidth = (int) (((float) tile.getEnergyStored(ForgeDirection.DOWN) - / (float) tile.getMaxEnergyStored(ForgeDirection.DOWN)) - * 90f); + / (float) tile.getMaxEnergyStored(ForgeDirection.DOWN)) * 90f); drawTexturedModalRect(guiLeft + 44, guiTop + 235, 131, 236, energyWidth, 16); int flameHight = (int) (((float) tile.smeltingBurnSpeed / (float) tile.smeltingMaxBurnSpeed) * 13f); @@ -89,8 +101,10 @@ public class GUIDraconiumChest extends GuiContainer implements INEIGuiHandler { // 0x00FFFF); ArrayList list = new ArrayList(); - list.add(String.valueOf(tile.getEnergyStored(ForgeDirection.DOWN)) + "/" - + String.valueOf(tile.getMaxEnergyStored(ForgeDirection.DOWN)) + "RF"); + list.add( + String.valueOf(tile.getEnergyStored(ForgeDirection.DOWN)) + "/" + + String.valueOf(tile.getMaxEnergyStored(ForgeDirection.DOWN)) + + "RF"); if (GuiHelper.isInRect(44, 235, 90, 16, x - guiLeft, y - guiTop)) drawHoveringText(list, x - guiLeft, y - guiTop, fontRendererObj); list.clear(); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIEnergyInfuser.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIEnergyInfuser.java index d33bb0d2..a30059f6 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIEnergyInfuser.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIEnergyInfuser.java @@ -1,14 +1,8 @@ package com.brandon3055.draconicevolution.client.gui; -import cofh.api.energy.IEnergyContainerItem; -import com.brandon3055.brandonscore.client.utills.GuiHelper; -import com.brandon3055.draconicevolution.common.container.ContainerEnergyInfuser; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.Random; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; @@ -17,8 +11,19 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; + import org.lwjgl.opengl.GL11; +import cofh.api.energy.IEnergyContainerItem; + +import com.brandon3055.brandonscore.client.utills.GuiHelper; +import com.brandon3055.draconicevolution.common.container.ContainerEnergyInfuser; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + @SideOnly(Side.CLIENT) public class GUIEnergyInfuser extends GuiContainer { @@ -36,16 +41,17 @@ public class GUIEnergyInfuser extends GuiContainer { this.player = invPlayer.player; } - private static final ResourceLocation texture = - new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/EnergyInfuser.png"); + private static final ResourceLocation texture = new ResourceLocation( + References.MODID.toLowerCase(), + "textures/gui/EnergyInfuser.png"); @Override protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { GL11.glColor4f(1F, 1F, 1F, 1F); Minecraft.getMinecraft().getTextureManager().bindTexture(texture); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); - if (tile.getStackInSlot(0) == null) - drawTexturedModalRect(guiLeft + 63, guiTop + 34, 36, ySize, 18, 18); // fuel box + if (tile.getStackInSlot(0) == null) drawTexturedModalRect(guiLeft + 63, guiTop + 34, 36, ySize, 18, 18); // fuel + // box float power = (float) tile.energy.getEnergyStored() / (float) tile.energy.getMaxEnergyStored() * -1F + 1F; drawTexturedModalRect( @@ -56,15 +62,12 @@ public class GUIEnergyInfuser extends GuiContainer { 8, 45 - (int) (power * 45)); // Power bar - if (tile.running - && tile.getStackInSlot(0) != null + if (tile.running && tile.getStackInSlot(0) != null && tile.getStackInSlot(0).getItem() instanceof IEnergyContainerItem) { - IEnergyContainerItem item = - (IEnergyContainerItem) tile.getStackInSlot(0).getItem(); + IEnergyContainerItem item = (IEnergyContainerItem) tile.getStackInSlot(0).getItem(); float charge = (float) item.getEnergyStored(tile.getStackInSlot(0)) - / (float) item.getMaxEnergyStored(tile.getStackInSlot(0)) - * -1F - + 1F; + / (float) item.getMaxEnergyStored(tile.getStackInSlot(0)) + * -1F + 1F; drawTexturedModalRect( guiLeft + 119, guiTop + 7 + (int) (charge * 45), @@ -115,23 +118,27 @@ public class GUIEnergyInfuser extends GuiContainer { if (GuiHelper.isInRect(48, 6, 9, 46, x, y)) { ArrayList internal = new ArrayList(); internal.add(StatCollector.translateToLocal("gui.de.internalStorage.txt")); - internal.add("" + EnumChatFormatting.DARK_BLUE + tile.energy.getEnergyStored() + "/" - + tile.energy.getMaxEnergyStored()); + internal.add( + "" + EnumChatFormatting.DARK_BLUE + + tile.energy.getEnergyStored() + + "/" + + tile.energy.getMaxEnergyStored()); GL11.glPushAttrib(GL11.GL_LIGHTING_BIT); drawHoveringText(internal, x + guiLeft, y + guiTop, fontRendererObj); GL11.glPopAttrib(); } - if (GuiHelper.isInRect(118, 6, 10, 46, x, y) - && tile.running + if (GuiHelper.isInRect(118, 6, 10, 46, x, y) && tile.running && tile.getStackInSlot(0) != null && tile.getStackInSlot(0).getItem() instanceof IEnergyContainerItem) { - IEnergyContainerItem item = - (IEnergyContainerItem) tile.getStackInSlot(0).getItem(); + IEnergyContainerItem item = (IEnergyContainerItem) tile.getStackInSlot(0).getItem(); ArrayList internal = new ArrayList(); internal.add(StatCollector.translateToLocal("gui.de.itemStorage.txt")); - internal.add("" + EnumChatFormatting.DARK_BLUE + item.getEnergyStored(tile.getStackInSlot(0)) + "/" - + item.getMaxEnergyStored(tile.getStackInSlot(0))); + internal.add( + "" + EnumChatFormatting.DARK_BLUE + + item.getEnergyStored(tile.getStackInSlot(0)) + + "/" + + item.getMaxEnergyStored(tile.getStackInSlot(0))); GL11.glPushAttrib(GL11.GL_LIGHTING_BIT); drawHoveringText(internal, x + guiLeft, y + guiTop, fontRendererObj); GL11.glPopAttrib(); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIFlowGate.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIFlowGate.java index fdd4d39d..47fe5f2e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIFlowGate.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIFlowGate.java @@ -1,16 +1,19 @@ package com.brandon3055.draconicevolution.client.gui; +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; + +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; + import com.brandon3055.brandonscore.client.utills.GuiHelper; import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.common.tileentities.gates.TileGate; -import java.util.ArrayList; -import java.util.List; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import org.lwjgl.input.Keyboard; -import org.lwjgl.input.Mouse; /** * Created by Brandon on 30/6/2015. @@ -56,31 +59,32 @@ public class GUIFlowGate extends GuiScreen { String flowRSHeigh = tile.getFlowSetting(1); fontRendererObj.drawString( StatCollector.translateToLocal("gui.de.flowGateRSHigh.name"), - guiCrt - - (fontRendererObj.getStringWidth( - StatCollector.translateToLocal("gui.de.flowGateRSHigh.name")) - / 2), + guiCrt - (fontRendererObj + .getStringWidth(StatCollector.translateToLocal("gui.de.flowGateRSHigh.name")) / 2), guiTop + 20, 0xff0000); fontRendererObj.drawString( - flowRSHeigh, guiCrt - (fontRendererObj.getStringWidth(flowRSHeigh) / 2), guiTop + 31, 0x2c2c2c); + flowRSHeigh, + guiCrt - (fontRendererObj.getStringWidth(flowRSHeigh) / 2), + guiTop + 31, + 0x2c2c2c); fontRendererObj.drawString( StatCollector.translateToLocal("gui.de.flowGateRSLow.name"), - guiCrt - - (fontRendererObj.getStringWidth( - StatCollector.translateToLocal("gui.de.flowGateRSLow.name")) - / 2), + guiCrt - (fontRendererObj + .getStringWidth(StatCollector.translateToLocal("gui.de.flowGateRSLow.name")) / 2), guiTop + 50, 0x660000); fontRendererObj.drawString( - flowRSLow, guiCrt - (fontRendererObj.getStringWidth(flowRSLow) / 2), guiTop + 61, 0x2c2c2c); - } else - drawCenteredString( - fontRendererObj, - StatCollector.translateToLocal("gui.de.flowGateOverridden.txt"), - width / 2, - height / 2 - 30, - 0x00FF00); + flowRSLow, + guiCrt - (fontRendererObj.getStringWidth(flowRSLow) / 2), + guiTop + 61, + 0x2c2c2c); + } else drawCenteredString( + fontRendererObj, + StatCollector.translateToLocal("gui.de.flowGateOverridden.txt"), + width / 2, + height / 2 - 30, + 0x00FF00); String flow = StatCollector.translateToLocal("gui.de.flowGateCurrentFlow.name") + ": " + Utills.addCommas(tile.getActualFlow()); @@ -108,34 +112,35 @@ public class GUIFlowGate extends GuiScreen { boolean ctrl = Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL); if (GuiHelper.isInRect(guiLeft + 20, guiTop + 20, 18, 18, x, y)) { - hoverText.add(StatCollector.translateToLocal("gui.de.decrement.name") + " " - + tile.getToolTip(1, shift, ctrl)); + hoverText.add( + StatCollector.translateToLocal("gui.de.decrement.name") + " " + + tile.getToolTip(1, shift, ctrl)); } if (GuiHelper.isInRect(guiLeft + 159, guiTop + 20, 18, 18, x, y)) { - hoverText.add(StatCollector.translateToLocal("gui.de.increment.name") + " " - + tile.getToolTip(1, shift, ctrl)); + hoverText.add( + StatCollector.translateToLocal("gui.de.increment.name") + " " + + tile.getToolTip(1, shift, ctrl)); } if (GuiHelper.isInRect(guiLeft + 20, guiTop + 50, 18, 18, x, y)) { - hoverText.add(StatCollector.translateToLocal("gui.de.decrement.name") + " " - + tile.getToolTip(0, shift, ctrl)); + hoverText.add( + StatCollector.translateToLocal("gui.de.decrement.name") + " " + + tile.getToolTip(0, shift, ctrl)); } if (GuiHelper.isInRect(guiLeft + 159, guiTop + 50, 18, 18, x, y)) { - hoverText.add(StatCollector.translateToLocal("gui.de.increment.name") + " " - + tile.getToolTip(0, shift, ctrl)); + hoverText.add( + StatCollector.translateToLocal("gui.de.increment.name") + " " + + tile.getToolTip(0, shift, ctrl)); } if (!hoverText.isEmpty()) { hoverText.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("gui.de.pressOrScroll.name")); drawHoveringText( hoverText, - x - - (x < width / 2 - ? fontRendererObj.getStringWidth( - StatCollector.translateToLocal("gui.de.decrement.name") + " " - + tile.getToolTip(1, shift, ctrl)) - + 25 - : 0), + x - (x < width / 2 ? fontRendererObj.getStringWidth( + StatCollector.translateToLocal("gui.de.decrement.name") + " " + + tile.getToolTip(1, shift, ctrl)) + + 25 : 0), y, fontRendererObj); } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIGenerator.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIGenerator.java index 915af500..d894c3ed 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIGenerator.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIGenerator.java @@ -1,12 +1,7 @@ package com.brandon3055.draconicevolution.client.gui; -import com.brandon3055.brandonscore.client.utills.GuiHelper; -import com.brandon3055.draconicevolution.common.container.ContainerGenerator; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.tileentities.TileGenerator; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; @@ -15,8 +10,17 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; + import org.lwjgl.opengl.GL11; +import com.brandon3055.brandonscore.client.utills.GuiHelper; +import com.brandon3055.draconicevolution.common.container.ContainerGenerator; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.tileentities.TileGenerator; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + @SideOnly(Side.CLIENT) public class GUIGenerator extends GuiContainer { @@ -34,8 +38,9 @@ public class GUIGenerator extends GuiContainer { this.player = invPlayer.player; } - private static final ResourceLocation texture = - new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/GGrinder.png"); + private static final ResourceLocation texture = new ResourceLocation( + References.MODID.toLowerCase(), + "textures/gui/GGrinder.png"); @Override protected void drawGuiContainerBackgroundLayer(float f, int X, int Y) { @@ -45,13 +50,12 @@ public class GUIGenerator extends GuiContainer { drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); drawTexturedModalRect(guiLeft + 63, guiTop + 34, 0, ySize, 18, 18); // fuel box drawTexturedModalRect(guiLeft + 97, guiTop + 34, 18, ySize, 18, 18); // flame box - if (tile.getStackInSlot(0) == null) - drawTexturedModalRect(guiLeft + 63, guiTop + 34, 36, ySize, 18, 18); // fuel box + if (tile.getStackInSlot(0) == null) drawTexturedModalRect(guiLeft + 63, guiTop + 34, 36, ySize, 18, 18); // fuel + // box float power = (float) tile.getEnergyStored(ForgeDirection.DOWN) - / (float) tile.getMaxEnergyStored(ForgeDirection.DOWN) - * -1 - + 1; + / (float) tile.getMaxEnergyStored(ForgeDirection.DOWN) + * -1 + 1; float fuel = tile.burnTimeRemaining / ((float) tile.burnTime) * -1 + 1; drawTexturedModalRect( @@ -76,8 +80,11 @@ public class GUIGenerator extends GuiContainer { if (GuiHelper.isInRect(83, 10, 12, 40, x, y)) { ArrayList internal = new ArrayList(); internal.add("Internal Storage"); - internal.add("" + EnumChatFormatting.DARK_BLUE + tile.getEnergyStored(ForgeDirection.UP) + "/" - + tile.getMaxEnergyStored(ForgeDirection.UP)); + internal.add( + "" + EnumChatFormatting.DARK_BLUE + + tile.getEnergyStored(ForgeDirection.UP) + + "/" + + tile.getMaxEnergyStored(ForgeDirection.UP)); drawHoveringText(internal, x + guiLeft, y + guiTop, fontRendererObj); } } @@ -87,13 +94,12 @@ public class GUIGenerator extends GuiContainer { int x = X - guiLeft; int y = Y - guiTop; - /* if (GuiHelper.isInRect(83, 10, 95, 50, x, y)) { - ArrayList internal = new ArrayList(); - internal.add("Internal Storage"); - internal.add("" + EnumChatFormatting.DARK_BLUE + tile.getEnergyStored(ForgeDirection.UP) + "/" + tile.getMaxEnergyStored(ForgeDirection.UP)); - drawHoveringText(internal, x, y, fontRendererObj); - } - */ + /* + * if (GuiHelper.isInRect(83, 10, 95, 50, x, y)) { ArrayList internal = new ArrayList(); + * internal.add("Internal Storage"); internal.add("" + EnumChatFormatting.DARK_BLUE + + * tile.getEnergyStored(ForgeDirection.UP) + "/" + tile.getMaxEnergyStored(ForgeDirection.UP)); + * drawHoveringText(internal, x, y, fontRendererObj); } + */ } @Override @@ -117,6 +123,6 @@ public class GUIGenerator extends GuiContainer { super.updateScreen(); } - // ####Draw at############ read from size + // ####Draw at############ read from size // drawTexturedModalRect(guiLeft + 37, guiTop + 4, 0, 143, 37, 38); } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIGrinder.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIGrinder.java index 20431a04..69b8ebdf 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIGrinder.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIGrinder.java @@ -1,12 +1,7 @@ package com.brandon3055.draconicevolution.client.gui; -import com.brandon3055.brandonscore.client.utills.GuiHelper; -import com.brandon3055.draconicevolution.common.container.ContainerGrinder; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.tileentities.TileGrinder; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; @@ -15,8 +10,17 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; + import org.lwjgl.opengl.GL11; +import com.brandon3055.brandonscore.client.utills.GuiHelper; +import com.brandon3055.draconicevolution.common.container.ContainerGrinder; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.tileentities.TileGrinder; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + @SideOnly(Side.CLIENT) public class GUIGrinder extends GuiContainer { @@ -34,8 +38,9 @@ public class GUIGrinder extends GuiContainer { this.player = invPlayer.player; } - private static final ResourceLocation texture = - new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/GGrinder.png"); + private static final ResourceLocation texture = new ResourceLocation( + References.MODID.toLowerCase(), + "textures/gui/GGrinder.png"); @Override protected void drawGuiContainerBackgroundLayer(float f, int X, int Y) { @@ -51,14 +56,12 @@ public class GUIGrinder extends GuiContainer { float power; if (tile.isExternallyPowered()) { power = (float) tile.getEnergyStored(ForgeDirection.DOWN) - / (float) tile.getMaxEnergyStored(ForgeDirection.DOWN) - * -1 - + 1; + / (float) tile.getMaxEnergyStored(ForgeDirection.DOWN) + * -1 + 1; } else { power = (float) tile.getInternalBuffer().getEnergyStored() - / (float) tile.getInternalBuffer().getMaxEnergyStored() - * -1 - + 1; + / (float) tile.getInternalBuffer().getMaxEnergyStored() + * -1 + 1; } float fuel = tile.burnTimeRemaining / ((float) tile.burnTime) * -1 + 1; @@ -86,12 +89,17 @@ public class GUIGrinder extends GuiContainer { ArrayList internal = new ArrayList(); internal.add("Energy Buffer"); if (tile.isExternallyPowered()) { - internal.add("" + EnumChatFormatting.DARK_BLUE + tile.getEnergyStored(ForgeDirection.UP) + "/" - + tile.getMaxEnergyStored(ForgeDirection.UP)); + internal.add( + "" + EnumChatFormatting.DARK_BLUE + + tile.getEnergyStored(ForgeDirection.UP) + + "/" + + tile.getMaxEnergyStored(ForgeDirection.UP)); } else { - internal.add("" + EnumChatFormatting.DARK_BLUE - + tile.getInternalBuffer().getEnergyStored() + "/" - + tile.getInternalBuffer().getMaxEnergyStored()); + internal.add( + "" + EnumChatFormatting.DARK_BLUE + + tile.getInternalBuffer().getEnergyStored() + + "/" + + tile.getInternalBuffer().getMaxEnergyStored()); } drawHoveringText(internal, x + guiLeft, y + guiTop, fontRendererObj); } @@ -126,6 +134,6 @@ public class GUIGrinder extends GuiContainer { super.updateScreen(); } - // ####Draw at############ read from size + // ####Draw at############ read from size // drawTexturedModalRect(guiLeft + 37, guiTop + 4, 0, 143, 37, 38); } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIParticleGenerator.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIParticleGenerator.java index f8e9240c..55c6547c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIParticleGenerator.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIParticleGenerator.java @@ -1,23 +1,27 @@ package com.brandon3055.draconicevolution.client.gui; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.network.ParticleGenPacket; -import com.brandon3055.draconicevolution.common.tileentities.TileParticleGenerator; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; + import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.network.ParticleGenPacket; +import com.brandon3055.draconicevolution.common.tileentities.TileParticleGenerator; + public class GUIParticleGenerator extends GuiScreen { + private final int xSize = 212; private final int ySize = 198; - private ResourceLocation guiTexture = - new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/ParticleGenerator.png"); + private ResourceLocation guiTexture = new ResourceLocation( + References.MODID.toLowerCase(), + "textures/gui/ParticleGenerator.png"); private int page = 1; private int infoPage = 0; private boolean hasInitialized = false; @@ -80,32 +84,33 @@ public class GUIParticleGenerator extends GuiScreen { syncWithServer(); } - String[] InfoText = { - "" - + "The Particle Generator is a decorative device that allows you to create your own custom particle effects. " - + "It is fairly easy you use this device you simply adjust the fields (variables) in the interface to change how the generated particles look and behave. " - + "This block is a work in progress and new features and particles are likely to be added in future versions. " - + "The following is a list of all of the fields in the interface and what they do.", - "The first thing to note is that most fields have a random modifier which will add a random number between 0 and whatever max (or min) value you give it to the field. " - + "-The first 3 fields (Red, Green & Blue) control the colour of the particle. Most people should be familiar with this colour system if not google RGB colours. Note: the max value for each colour can not go higher then 255 so the colour field limits the random modifier e.g. if the colour field is set to 255 and the random modifier is set to 20 the result will always be 255", - "-The next 3 fields (Motion X, Y & Z) control the direction and speed of the particle " - + "-The \"Life\" field sets how long (in ticks) before the particle despawns. " - + "-The \"Size\" field sets the size of the particle. " - + "-The next 3 fields (Spawn X, Y & Z) Sets the spawn location of the particle (relative to the location of the particle generator)", - "-The \"Delay\" field sets the delay (in ticks) between each particle spawn e.g. 1=20/s, 20=1/s, 100=1/5s " - + "-The \"Fade\" field sets how long (in ticks) it takes the partile to fade out of existance. Note: This adds to the life of the particle " - + "-The \"Gravity\" field sets how the particle is affected by gravity. " - + "-\"Block Collision\" Toggles weather or not the particle will collide with blocks " - + "-\"Particle Selected\" Switches between the different particles available.", - EnumChatFormatting.DARK_RED + " Redstone Control" + EnumChatFormatting.BLACK - + "\nBy default a redstone signal is required for the generator to run." - + "\n\nHowever if you shift right click the generator with an empty hand it will switch to inverted mode." - + "\nThe redstone mode is indicated by the 8 cubes at the corners of the block.", - EnumChatFormatting.DARK_RED + " Computer Control" + EnumChatFormatting.BLACK - + "\nThe Generator can be controlled via a computer" + "\nIt exposes a relatively straight forward API:" - + "\n\n setGeneratorProperty(property, value)\n getGeneratorState()\n resetGeneratorState()" - + "\n\nGenerator state is obtained as a whole from getGeneratorState, whereas properties are modified one at a time using setGeneratorProperty. Property names are strings and mostly correspond to button labels in the GUI." - }; + String[] InfoText = { "" + + "The Particle Generator is a decorative device that allows you to create your own custom particle effects. " + + "It is fairly easy you use this device you simply adjust the fields (variables) in the interface to change how the generated particles look and behave. " + + "This block is a work in progress and new features and particles are likely to be added in future versions. " + + "The following is a list of all of the fields in the interface and what they do.", + "The first thing to note is that most fields have a random modifier which will add a random number between 0 and whatever max (or min) value you give it to the field. " + + "-The first 3 fields (Red, Green & Blue) control the colour of the particle. Most people should be familiar with this colour system if not google RGB colours. Note: the max value for each colour can not go higher then 255 so the colour field limits the random modifier e.g. if the colour field is set to 255 and the random modifier is set to 20 the result will always be 255", + "-The next 3 fields (Motion X, Y & Z) control the direction and speed of the particle " + + "-The \"Life\" field sets how long (in ticks) before the particle despawns. " + + "-The \"Size\" field sets the size of the particle. " + + "-The next 3 fields (Spawn X, Y & Z) Sets the spawn location of the particle (relative to the location of the particle generator)", + "-The \"Delay\" field sets the delay (in ticks) between each particle spawn e.g. 1=20/s, 20=1/s, 100=1/5s " + + "-The \"Fade\" field sets how long (in ticks) it takes the partile to fade out of existance. Note: This adds to the life of the particle " + + "-The \"Gravity\" field sets how the particle is affected by gravity. " + + "-\"Block Collision\" Toggles weather or not the particle will collide with blocks " + + "-\"Particle Selected\" Switches between the different particles available.", + EnumChatFormatting.DARK_RED + " Redstone Control" + + EnumChatFormatting.BLACK + + "\nBy default a redstone signal is required for the generator to run." + + "\n\nHowever if you shift right click the generator with an empty hand it will switch to inverted mode." + + "\nThe redstone mode is indicated by the 8 cubes at the corners of the block.", + EnumChatFormatting.DARK_RED + " Computer Control" + + EnumChatFormatting.BLACK + + "\nThe Generator can be controlled via a computer" + + "\nIt exposes a relatively straight forward API:" + + "\n\n setGeneratorProperty(property, value)\n getGeneratorState()\n resetGeneratorState()" + + "\n\nGenerator state is obtained as a whole from getGeneratorState, whereas properties are modified one at a time using setGeneratorProperty. Property names are strings and mostly correspond to button labels in the GUI." }; // @formatter:off @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIPlayerDetector.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIPlayerDetector.java index 07ff56dd..27056f53 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIPlayerDetector.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIPlayerDetector.java @@ -1,14 +1,7 @@ package com.brandon3055.draconicevolution.client.gui; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.container.ContainerPlayerDetector; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.network.PlayerDetectorButtonPacket; -import com.brandon3055.draconicevolution.common.network.PlayerDetectorStringPacket; -import com.brandon3055.draconicevolution.common.tileentities.TilePlayerDetectorAdvanced; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiTextField; @@ -16,8 +9,19 @@ import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; + import org.lwjgl.opengl.GL11; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.container.ContainerPlayerDetector; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.network.PlayerDetectorButtonPacket; +import com.brandon3055.draconicevolution.common.network.PlayerDetectorStringPacket; +import com.brandon3055.draconicevolution.common.tileentities.TilePlayerDetectorAdvanced; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + @SideOnly(Side.CLIENT) public class GUIPlayerDetector extends GuiContainer { @@ -49,8 +53,9 @@ public class GUIPlayerDetector extends GuiContainer { syncWithServer(); } - private static final ResourceLocation texture = - new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/PlayerDetector.png"); + private static final ResourceLocation texture = new ResourceLocation( + References.MODID.toLowerCase(), + "textures/gui/PlayerDetector.png"); @Override protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { @@ -158,8 +163,8 @@ public class GUIPlayerDetector extends GuiContainer { names[selected] = selectedNameText.getText(); selectedNameText.setText(""); selectedNameText.setFocused(false); - DraconicEvolution.network.sendToServer( - new PlayerDetectorStringPacket((byte) selected, names[selected])); + DraconicEvolution.network + .sendToServer(new PlayerDetectorStringPacket((byte) selected, names[selected])); selected = -1; } } else super.keyTyped(par1, par2); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUISunDial.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUISunDial.java index 3e2e469b..279ada47 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUISunDial.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUISunDial.java @@ -1,18 +1,21 @@ package com.brandon3055.draconicevolution.client.gui; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.container.ContainerSunDial; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.network.TeleporterPacket; import com.brandon3055.draconicevolution.common.tileentities.TileSunDial; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.ResourceLocation; -import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) public class GUISunDial extends GuiContainer { diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUITeleporter.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUITeleporter.java index d489d20b..96fb9454 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUITeleporter.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUITeleporter.java @@ -1,17 +1,8 @@ package com.brandon3055.draconicevolution.client.gui; -import com.brandon3055.brandonscore.client.utills.GuiHelper; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.brandonscore.common.utills.Teleporter.TeleportLocation; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.handler.ConfigHandler; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.network.TeleporterPacket; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.List; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; @@ -25,15 +16,30 @@ import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; + import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; +import com.brandon3055.brandonscore.client.utills.GuiHelper; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.brandonscore.common.utills.Teleporter.TeleportLocation; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.handler.ConfigHandler; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.network.TeleporterPacket; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + @SideOnly(Side.CLIENT) public class GUITeleporter extends GuiScreen { + private final int xSize = 182; private final int ySize = 141; - private ResourceLocation guiTexture = - new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/TeleporterMKII.png"); + private ResourceLocation guiTexture = new ResourceLocation( + References.MODID.toLowerCase(), + "textures/gui/TeleporterMKII.png"); private ItemStack teleporterItem; protected List locations = new ArrayList(0); @@ -168,26 +174,22 @@ public class GUITeleporter extends GuiScreen { int posY = (this.height - ySize) / 2; if (locations.size() <= 0) return; fontRendererObj.drawString( - EnumChatFormatting.GOLD + "X: " - + (int) getLocationSafely(selected + selectionOffset).getXCoord(), + EnumChatFormatting.GOLD + "X: " + (int) getLocationSafely(selected + selectionOffset).getXCoord(), posX + 114, posY + 7, 0x000000); fontRendererObj.drawString( - EnumChatFormatting.GOLD + "Y: " - + (int) getLocationSafely(selected + selectionOffset).getYCoord(), + EnumChatFormatting.GOLD + "Y: " + (int) getLocationSafely(selected + selectionOffset).getYCoord(), posX + 114, posY + 16, 0x000000); fontRendererObj.drawString( - EnumChatFormatting.GOLD + "Z: " - + (int) getLocationSafely(selected + selectionOffset).getZCoord(), + EnumChatFormatting.GOLD + "Z: " + (int) getLocationSafely(selected + selectionOffset).getZCoord(), posX + 114, posY + 25, 0x000000); fontRendererObj.drawString( - EnumChatFormatting.GOLD + "" - + getLocationSafely(selected + selectionOffset).getDimensionName(), + EnumChatFormatting.GOLD + "" + getLocationSafely(selected + selectionOffset).getDimensionName(), posX + 114, posY + 34, 0x000000); @@ -245,21 +247,19 @@ public class GUITeleporter extends GuiScreen { if (GuiHelper.isInRect(99, 8 + i * 11, 8, 7, x - posX, y - posY)) { getLocationSafely(i + selectionOffset) - .setWriteProtected( - !getLocationSafely(i + selectionOffset).getWriteProtected()); - DraconicEvolution.network.sendToServer(new TeleporterPacket( - TeleporterPacket.UPDATELOCK, - i + selectionOffset, - getLocationSafely(i + selectionOffset).getWriteProtected())); + .setWriteProtected(!getLocationSafely(i + selectionOffset).getWriteProtected()); + DraconicEvolution.network.sendToServer( + new TeleporterPacket( + TeleporterPacket.UPDATELOCK, + i + selectionOffset, + getLocationSafely(i + selectionOffset).getWriteProtected())); } } - if (selectionChanged) - DraconicEvolution.network.sendToServer( - new TeleporterPacket(TeleporterPacket.CHANGESELECTION, selected, false)); - if (offsetChanged) - DraconicEvolution.network.sendToServer( - new TeleporterPacket(TeleporterPacket.UPDATEOFFSET, selectionOffset, false)); + if (selectionChanged) DraconicEvolution.network + .sendToServer(new TeleporterPacket(TeleporterPacket.CHANGESELECTION, selected, false)); + if (offsetChanged) DraconicEvolution.network + .sendToServer(new TeleporterPacket(TeleporterPacket.UPDATEOFFSET, selectionOffset, false)); updateButtons(); super.mouseClicked(x, y, button); @@ -294,12 +294,10 @@ public class GUITeleporter extends GuiScreen { updateButtons(); } - if (selectionChanged) - DraconicEvolution.network.sendToServer( - new TeleporterPacket(TeleporterPacket.CHANGESELECTION, selected, false)); - if (offsetChanged) - DraconicEvolution.network.sendToServer( - new TeleporterPacket(TeleporterPacket.UPDATEOFFSET, selectionOffset, false)); + if (selectionChanged) DraconicEvolution.network + .sendToServer(new TeleporterPacket(TeleporterPacket.CHANGESELECTION, selected, false)); + if (offsetChanged) DraconicEvolution.network + .sendToServer(new TeleporterPacket(TeleporterPacket.UPDATEOFFSET, selectionOffset, false)); super.handleMouseInput(); } @@ -312,13 +310,12 @@ public class GUITeleporter extends GuiScreen { if ((selected + selectionOffset) + 1 > locations.size()) { selected = 0; selectionOffset = 0; - DraconicEvolution.network.sendToServer( - new TeleporterPacket(TeleporterPacket.CHANGESELECTION, selected, false)); - DraconicEvolution.network.sendToServer( - new TeleporterPacket(TeleporterPacket.UPDATEOFFSET, selectionOffset, false)); + DraconicEvolution.network + .sendToServer(new TeleporterPacket(TeleporterPacket.CHANGESELECTION, selected, false)); + DraconicEvolution.network + .sendToServer(new TeleporterPacket(TeleporterPacket.UPDATEOFFSET, selectionOffset, false)); } - if (locations.size() == 0 - || getLocationSafely(selected + selectionOffset).getWriteProtected()) { + if (locations.size() == 0 || getLocationSafely(selected + selectionOffset).getWriteProtected()) { ((GuiButton) buttonList.get(0)).enabled = false; ((GuiButton) buttonList.get(1)).enabled = false; ((GuiButton) buttonList.get(2)).enabled = false; @@ -347,25 +344,73 @@ public class GUITeleporter extends GuiScreen { // updateTeleporter(); - buttonList.add(new GuiButtonAHeight( - 0, posX + 112, posY + 45, 66, 12, StatCollector.translateToLocal("button.de.rename.txt"))); - buttonList.add(new GuiButtonAHeight( - 1, posX + 112, posY + 58, 66, 12, StatCollector.translateToLocal("button.de.setHere.txt"))); - buttonList.add(new GuiButtonAHeight( - 2, posX + 112, posY + 71, 66, 12, StatCollector.translateToLocal("button.de.remove.txt"))); + buttonList.add( + new GuiButtonAHeight( + 0, + posX + 112, + posY + 45, + 66, + 12, + StatCollector.translateToLocal("button.de.rename.txt"))); + buttonList.add( + new GuiButtonAHeight( + 1, + posX + 112, + posY + 58, + 66, + 12, + StatCollector.translateToLocal("button.de.setHere.txt"))); + buttonList.add( + new GuiButtonAHeight( + 2, + posX + 112, + posY + 71, + 66, + 12, + StatCollector.translateToLocal("button.de.remove.txt"))); - buttonList.add(new GuiButtonAHeight( - 3, posX + 112, posY + 99, 33, 12, StatCollector.translateToLocal("button.de.UP.txt"))); + buttonList.add( + new GuiButtonAHeight( + 3, + posX + 112, + posY + 99, + 33, + 12, + StatCollector.translateToLocal("button.de.UP.txt"))); - buttonList.add(new GuiButtonAHeight( - 4, posX + 112, posY + 112, 66, 12, StatCollector.translateToLocal("button.de.addNew.txt"))); - buttonList.add(new GuiButtonAHeight( - 5, posX + 112, posY + 125, 66, 12, StatCollector.translateToLocal("button.de.addFuel.txt"))); - buttonList.add(new GuiButtonAHeight( - 6, posX + xSize - 63, posY - 15, 60, 15, StatCollector.translateToLocal("button.de.cancel.txt"))); + buttonList.add( + new GuiButtonAHeight( + 4, + posX + 112, + posY + 112, + 66, + 12, + StatCollector.translateToLocal("button.de.addNew.txt"))); + buttonList.add( + new GuiButtonAHeight( + 5, + posX + 112, + posY + 125, + 66, + 12, + StatCollector.translateToLocal("button.de.addFuel.txt"))); + buttonList.add( + new GuiButtonAHeight( + 6, + posX + xSize - 63, + posY - 15, + 60, + 15, + StatCollector.translateToLocal("button.de.cancel.txt"))); - buttonList.add(new GuiButtonAHeight( - 7, posX + 112 + 34, posY + 99, 33, 12, StatCollector.translateToLocal("button.de.DOWN.txt"))); + buttonList.add( + new GuiButtonAHeight( + 7, + posX + 112 + 34, + posY + 99, + 33, + 12, + StatCollector.translateToLocal("button.de.DOWN.txt"))); ((GuiButton) buttonList.get(6)).visible = false; textBeingEdited = new GuiTextField(fontRendererObj, posX + 3, posY - 14, xSize - 67, 12); @@ -392,8 +437,7 @@ public class GUITeleporter extends GuiScreen { if (!editingExisting) { editingExisting = true; textBeingEdited.setVisible(true); - textBeingEdited.setText( - getLocationSafely(selected + selectionOffset).getName()); + textBeingEdited.setText(getLocationSafely(selected + selectionOffset).getName()); textBeingEdited.setSelectionPos(0); textBeingEdited.setFocused(true); ((GuiButton) buttonList.get(6)).visible = true; @@ -404,8 +448,8 @@ public class GUITeleporter extends GuiScreen { location.setName(textBeingEdited.getText()); DraconicEvolution.network.sendToServer( new TeleporterPacket(location, TeleporterPacket.UPDATENAME, selected + selectionOffset)); - ((GuiButton) buttonList.get(0)).displayString = - StatCollector.translateToLocal("button.de.rename.txt"); + ((GuiButton) buttonList.get(0)).displayString = StatCollector + .translateToLocal("button.de.rename.txt"); editingExisting = false; textBeingEdited.setVisible(false); ((GuiButton) buttonList.get(6)).visible = false; @@ -475,8 +519,8 @@ public class GUITeleporter extends GuiScreen { } else { if (!textBeingEdited.getText().isEmpty()) { addCurrentLocationToList(textBeingEdited.getText()); - ((GuiButton) buttonList.get(4)).displayString = - StatCollector.translateToLocal("button.de.addNew.txt"); + ((GuiButton) buttonList.get(4)).displayString = StatCollector + .translateToLocal("button.de.addNew.txt"); editingNew = false; textBeingEdited.setVisible(false); ((GuiButton) buttonList.get(6)).visible = false; @@ -514,13 +558,11 @@ public class GUITeleporter extends GuiScreen { public void keyTyped(char key, int keyN) { if (this.textBeingEdited.textboxKeyTyped(key, keyN)) { if (editingNew) { - ((GuiButton) buttonList.get(4)).enabled = - !textBeingEdited.getText().isEmpty(); + ((GuiButton) buttonList.get(4)).enabled = !textBeingEdited.getText().isEmpty(); ((GuiButton) buttonList.get(4)).displayString = StatCollector.translateToLocal("button.de.commit.txt"); } if (editingExisting) { - ((GuiButton) buttonList.get(0)).enabled = - !textBeingEdited.getText().isEmpty(); + ((GuiButton) buttonList.get(0)).enabled = !textBeingEdited.getText().isEmpty(); ((GuiButton) buttonList.get(0)).displayString = StatCollector.translateToLocal("button.de.commit.txt"); } return; @@ -544,13 +586,11 @@ public class GUITeleporter extends GuiScreen { this.mc.setIngameFocus(); } - if (tick % 5 == 0 - && locations.size() > 0 - && getLocationSafely(selected + selectionOffset) - .getDimensionName() - .equals("") + if (tick % 5 == 0 && locations.size() > 0 + && getLocationSafely(selected + selectionOffset).getDimensionName().equals("") && player.getHeldItem() != null - && player.getHeldItem().getItem() == ModItems.teleporterMKII) readDataFromItem(player.getHeldItem()); + && player.getHeldItem().getItem() == ModItems.teleporterMKII) + readDataFromItem(player.getHeldItem()); tick++; if (tick >= 10) { diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIUpgradeModifier.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIUpgradeModifier.java index b764e6da..a3b51368 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIUpgradeModifier.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIUpgradeModifier.java @@ -1,16 +1,8 @@ package com.brandon3055.draconicevolution.client.gui; -import com.brandon3055.brandonscore.client.utills.GuiHelper; -import com.brandon3055.draconicevolution.client.handler.ResourceHandler; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.container.ContainerUpgradeModifier; -import com.brandon3055.draconicevolution.common.tileentities.TileUpgradeModifier; -import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; -import com.brandon3055.draconicevolution.common.utills.IUpgradableItem.EnumUpgrade; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.List; + import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.gui.GuiButton; @@ -20,8 +12,20 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; + import org.lwjgl.opengl.GL11; +import com.brandon3055.brandonscore.client.utills.GuiHelper; +import com.brandon3055.draconicevolution.client.handler.ResourceHandler; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.container.ContainerUpgradeModifier; +import com.brandon3055.draconicevolution.common.tileentities.TileUpgradeModifier; +import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; +import com.brandon3055.draconicevolution.common.utills.IUpgradableItem.EnumUpgrade; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + @SideOnly(Side.CLIENT) public class GUIUpgradeModifier extends GuiContainer { @@ -34,8 +38,8 @@ public class GUIUpgradeModifier extends GuiContainer { private List itemUpgrades = new ArrayList(); private ContainerUpgradeModifier containerEM; - public GUIUpgradeModifier( - InventoryPlayer invPlayer, TileUpgradeModifier tile, ContainerUpgradeModifier containerEM) { + public GUIUpgradeModifier(InventoryPlayer invPlayer, TileUpgradeModifier tile, + ContainerUpgradeModifier containerEM) { super(containerEM); this.containerEM = containerEM; @@ -154,24 +158,21 @@ public class GUIUpgradeModifier extends GuiContainer { for (int i = 0; i <= coreTier; i++) { // Check + buttons - if (coreInInventory[i] - && coreSlots > usedSlots + if (coreInInventory[i] && coreSlots > usedSlots && GuiHelper.isInRect(xPos, yPos + 33 + i * 18, 8, 8, x, y) && upgrade.getUpgradePoints(stack) < upgradableItem.getMaxUpgradePoints(upgrade.index, stack)) { containerEM.sendObjectToServer(null, upgrade.index, i * 2); - Minecraft.getMinecraft() - .getSoundHandler() - .playSound(PositionedSoundRecord.func_147674_a( - ResourceHandler.getResourceWOP("gui.button.press"), 1.0F)); + Minecraft.getMinecraft().getSoundHandler().playSound( + PositionedSoundRecord + .func_147674_a(ResourceHandler.getResourceWOP("gui.button.press"), 1.0F)); } // Check - buttons if (appliedCores[i] > 0 && GuiHelper.isInRect(xPos + 16, yPos + 33 + i * 18, 8, 8, x, y)) { containerEM.sendObjectToServer(null, upgrade.index, 1 + i * 2); - Minecraft.getMinecraft() - .getSoundHandler() - .playSound(PositionedSoundRecord.func_147674_a( - ResourceHandler.getResourceWOP("gui.button.press"), 1.0F)); + Minecraft.getMinecraft().getSoundHandler().playSound( + PositionedSoundRecord + .func_147674_a(ResourceHandler.getResourceWOP("gui.button.press"), 1.0F)); } } } @@ -218,12 +219,11 @@ public class GUIUpgradeModifier extends GuiContainer { drawTexturedModalRect(xPos + 16, yPos + 33 + i * 18, 56 + (hovering ? 8 : 0), 208, 8, 8); } } - for (int i = 0; i <= coreTier; i++) - fontRendererObj.drawString( - String.valueOf(appliedCores[i]), - xPos + 12 - fontRendererObj.getStringWidth(String.valueOf(appliedCores[i])) / 2, - yPos + 29 + i * 18, - 0xFFFFFF); + for (int i = 0; i <= coreTier; i++) fontRendererObj.drawString( + String.valueOf(appliedCores[i]), + xPos + 12 - fontRendererObj.getStringWidth(String.valueOf(appliedCores[i])) / 2, + yPos + 29 + i * 18, + 0xFFFFFF); fontRendererObj.drawString( String.valueOf(upgrade.getUpgradePoints(stack)), xPos + 12 - fontRendererObj.getStringWidth(String.valueOf(upgrade.getUpgradePoints(stack))) / 2, @@ -232,15 +232,18 @@ public class GUIUpgradeModifier extends GuiContainer { } fontRendererObj.drawStringWithShadow( - StatCollector.translateToLocal("gui.de.cores.txt"), guiLeft + 4, guiTop + 4, 0x00ff00); - fontRendererObj.drawString( - StatCollector.translateToLocal("gui.de.cap.txt"), guiLeft + 4, guiTop + 16, 0x000000); + StatCollector.translateToLocal("gui.de.cores.txt"), + guiLeft + 4, + guiTop + 4, + 0x00ff00); + fontRendererObj + .drawString(StatCollector.translateToLocal("gui.de.cap.txt"), guiLeft + 4, guiTop + 16, 0x000000); fontRendererObj.drawString(">" + coreSlots, guiLeft + 4, guiTop + 25, 0x000000); - fontRendererObj.drawString( - StatCollector.translateToLocal("gui.de.installed.txt"), guiLeft + 4, guiTop + 37, 0x000000); + fontRendererObj + .drawString(StatCollector.translateToLocal("gui.de.installed.txt"), guiLeft + 4, guiTop + 37, 0x000000); fontRendererObj.drawString(">" + usedSlots, guiLeft + 4, guiTop + 46, 0x000000); - fontRendererObj.drawString( - StatCollector.translateToLocal("gui.de.free.txt"), guiLeft + 4, guiTop + 58, 0x000000); + fontRendererObj + .drawString(StatCollector.translateToLocal("gui.de.free.txt"), guiLeft + 4, guiTop + 58, 0x000000); fontRendererObj.drawString(">" + (coreSlots - usedSlots), guiLeft + 4, guiTop + 67, 0x000000); } @@ -265,10 +268,12 @@ public class GUIUpgradeModifier extends GuiContainer { if (GuiHelper.isInRect(xPos + 3, yPos - 9, 18, 8, x, y)) { List list = new ArrayList(); - list.add(StatCollector.translateToLocal("gui.de.basePoints.txt") + ": " - + upgradableItem.getBaseUpgradePoints(upgrade.index)); - list.add(StatCollector.translateToLocal("gui.de.maxPoints.txt") + ": " - + upgradableItem.getMaxUpgradePoints(upgrade.index, stack)); + list.add( + StatCollector.translateToLocal("gui.de.basePoints.txt") + ": " + + upgradableItem.getBaseUpgradePoints(upgrade.index)); + list.add( + StatCollector.translateToLocal("gui.de.maxPoints.txt") + ": " + + upgradableItem.getMaxUpgradePoints(upgrade.index, stack)); list.add(StatCollector.translateToLocal("gui.de.pointCost.txt") + ": " + upgrade.pointConversion); drawHoveringText(list, x, y, fontRendererObj); } @@ -277,9 +282,10 @@ public class GUIUpgradeModifier extends GuiContainer { if (GuiHelper.isInRect(xPos + 9, yPos + 25 + i * 18, 6, 15, x, y)) { List list = new ArrayList(); double value = Math.pow(2, i) / upgrade.pointConversion; - String string = StatCollector.translateToLocal("gui.de.value.txt") + ": " + value + " " - + (value == 1 - ? StatCollector.translateToLocal("gui.de.point.txt") + String string = StatCollector.translateToLocal("gui.de.value.txt") + ": " + + value + + " " + + (value == 1 ? StatCollector.translateToLocal("gui.de.point.txt") : StatCollector.translateToLocal("gui.de.points.txt")); list.add(string.replace(".0", "")); drawHoveringText(list, x, y, fontRendererObj); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIWeatherController.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIWeatherController.java index 448db1b8..feb4d991 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIWeatherController.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIWeatherController.java @@ -1,20 +1,23 @@ package com.brandon3055.draconicevolution.client.gui; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.container.ContainerWeatherController; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.network.ButtonPacket; -import com.brandon3055.draconicevolution.common.tileentities.TileWeatherController; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; + import org.lwjgl.opengl.GL11; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.container.ContainerWeatherController; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.network.ButtonPacket; +import com.brandon3055.draconicevolution.common.tileentities.TileWeatherController; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + @SideOnly(Side.CLIENT) public class GUIWeatherController extends GuiContainer { @@ -34,8 +37,9 @@ public class GUIWeatherController extends GuiContainer { this.player = invPlayer.player; } - private static final ResourceLocation texture = - new ResourceLocation(References.MODID.toLowerCase(), "textures/gui/WeatherController.png"); + private static final ResourceLocation texture = new ResourceLocation( + References.MODID.toLowerCase(), + "textures/gui/WeatherController.png"); @Override protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiButtonAHeight.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiButtonAHeight.java index f9cee6e5..4f592ad4 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiButtonAHeight.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiButtonAHeight.java @@ -4,6 +4,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.OpenGlHelper; + import org.lwjgl.opengl.GL11; /** @@ -21,8 +22,7 @@ public class GuiButtonAHeight extends GuiButton { FontRenderer fontrenderer = minecraft.fontRenderer; minecraft.getTextureManager().bindTexture(buttonTextures); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.field_146123_n = mouseX >= this.xPosition - && mouseY >= this.yPosition + this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; int k = this.getHoverState(this.field_146123_n); @@ -30,7 +30,12 @@ public class GuiButtonAHeight extends GuiButton { OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); this.drawTexturedModalRect( - this.xPosition, this.yPosition, 0, 46 + k * 20, width % 2 + this.width / 2, this.height); + this.xPosition, + this.yPosition, + 0, + 46 + k * 20, + width % 2 + this.width / 2, + this.height); this.drawTexturedModalRect( width % 2 + this.xPosition + this.width / 2, this.yPosition, diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiButtonTextOnly.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiButtonTextOnly.java index 364d06b3..4660331f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiButtonTextOnly.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiButtonTextOnly.java @@ -5,17 +5,19 @@ import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.util.EnumChatFormatting; + import org.lwjgl.opengl.GL11; /** * Created by Brandon on 17/09/2014. */ public class GuiButtonTextOnly extends GuiButton { + public String LINKED_PAGE; public int textColour; - public GuiButtonTextOnly( - int id, int xPos, int yPos, int width, int hight, String displayString, String linkedPage, int colour) { + public GuiButtonTextOnly(int id, int xPos, int yPos, int width, int hight, String displayString, String linkedPage, + int colour) { super(id, xPos, yPos, width, hight, displayString); this.LINKED_PAGE = linkedPage; this.textColour = colour; @@ -27,8 +29,7 @@ public class GuiButtonTextOnly extends GuiButton { FontRenderer fontrenderer = minecraft.fontRenderer; minecraft.getTextureManager().bindTexture(buttonTextures); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.field_146123_n = mouseX >= this.xPosition - && mouseY >= this.yPosition + this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; GL11.glEnable(GL11.GL_BLEND); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiHandler.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiHandler.java index a534c5f8..8945c70f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiHandler.java @@ -1,5 +1,9 @@ package com.brandon3055.draconicevolution.client.gui; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.gui.componentguis.GUIManual; import com.brandon3055.draconicevolution.client.gui.componentguis.GUIReactor; @@ -9,11 +13,9 @@ import com.brandon3055.draconicevolution.common.inventory.InventoryTool; import com.brandon3055.draconicevolution.common.tileentities.*; import com.brandon3055.draconicevolution.common.tileentities.gates.TileGate; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore; + import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.network.NetworkRegistry; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; public class GuiHandler implements IGuiHandler { @@ -104,12 +106,12 @@ public class GuiHandler implements IGuiHandler { } break; - // case GUIID_CONTAINER_TEMPLATE: - // TileEntity containerTemp = world.getTileEntity(x, y, z); - // if (containerTemp != null && containerTemp instanceof TileContainerTemplate) { - // return new ContainerTemplate(player.inventory, (TileContainerTemplate) containerTemp); - // } - // break; + // case GUIID_CONTAINER_TEMPLATE: + // TileEntity containerTemp = world.getTileEntity(x, y, z); + // if (containerTemp != null && containerTemp instanceof TileContainerTemplate) { + // return new ContainerTemplate(player.inventory, (TileContainerTemplate) containerTemp); + // } + // break; } return null; @@ -179,12 +181,15 @@ public class GuiHandler implements IGuiHandler { TileEntity reactor = world.getTileEntity(x, y, z); if (reactor != null && reactor instanceof TileReactorCore) { return new GUIReactor( - player, (TileReactorCore) reactor, new ContainerReactor(player, (TileReactorCore) reactor)); + player, + (TileReactorCore) reactor, + new ContainerReactor(player, (TileReactorCore) reactor)); } break; case GUIID_TOOL_CONFIG: return new GUIToolConfig( - player, new ContainerAdvTool(player.inventory, new InventoryTool(player, null))); + player, + new ContainerAdvTool(player.inventory, new InventoryTool(player, null))); case GUIID_FLOW_GATE: return world.getTileEntity(x, y, z) instanceof TileGate ? new GUIFlowGate((TileGate) world.getTileEntity(x, y, z)) @@ -199,12 +204,12 @@ public class GuiHandler implements IGuiHandler { } break; - // case GUIID_CONTAINER_TEMPLATE: - // TileEntity containerTemp = world.getTileEntity(x, y, z); - // if (containerTemp != null && containerTemp instanceof TileContainerTemplate) { - // return new GUIContainerTemplate(player.inventory, (TileContainerTemplate) containerTemp); - // } - // break; + // case GUIID_CONTAINER_TEMPLATE: + // TileEntity containerTemp = world.getTileEntity(x, y, z); + // if (containerTemp != null && containerTemp instanceof TileContainerTemplate) { + // return new GUIContainerTemplate(player.inventory, (TileContainerTemplate) containerTemp); + // } + // break; } return null; diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiHudConfig.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiHudConfig.java index 9b994210..42255c0e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiHudConfig.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiHudConfig.java @@ -1,21 +1,25 @@ package com.brandon3055.draconicevolution.client.gui; -import com.brandon3055.brandonscore.client.gui.guicomponents.GUIBase; -import com.brandon3055.brandonscore.client.utills.GuiHelper; -import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import java.util.ArrayList; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.util.StatCollector; + import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; +import com.brandon3055.brandonscore.client.gui.guicomponents.GUIBase; +import com.brandon3055.brandonscore.client.utills.GuiHelper; +import com.brandon3055.draconicevolution.common.handler.ConfigHandler; + /** * Created by brandon3055 on 11/2/2016. */ public class GuiHudConfig extends GuiScreen { + private GUIBase parent; private GuiButton buttonHudFade; private GuiButton buttonArmorFade; @@ -39,35 +43,76 @@ public class GuiHudConfig extends GuiScreen { buttonList.add(new GuiButtonAHeight(0, x - 35, y + 95, 70, 15, StatCollector.translateToLocal("gui.back"))); - buttonList.add(new GuiButtonAHeight( - 1, x + 2, y - 37, 80, 15, StatCollector.translateToLocal("button.de.scaleUp.txt"))); - buttonList.add(new GuiButtonAHeight( - 2, x - 81, y - 37, 80, 15, StatCollector.translateToLocal("button.de.scaleDown.txt"))); + buttonList.add( + new GuiButtonAHeight( + 1, + x + 2, + y - 37, + 80, + 15, + StatCollector.translateToLocal("button.de.scaleUp.txt"))); + buttonList.add( + new GuiButtonAHeight( + 2, + x - 81, + y - 37, + 80, + 15, + StatCollector.translateToLocal("button.de.scaleDown.txt"))); buttonList.add(buttonHudFade = new GuiButtonAHeight(3, x - 81, y - 20, 163, 15, "")); - buttonList.add(new GuiButtonAHeight( - 9, x - 81, y - 3, 163, 15, StatCollector.translateToLocal("button.de.toggleHidden.txt"))); + buttonList.add( + new GuiButtonAHeight( + 9, + x - 81, + y - 3, + 163, + 15, + StatCollector.translateToLocal("button.de.toggleHidden.txt"))); - buttonList.add(new GuiButtonAHeight( - 4, x + 2, y + 25, 80, 15, StatCollector.translateToLocal("button.de.scaleUp.txt"))); - buttonList.add(new GuiButtonAHeight( - 5, x - 81, y + 25, 80, 15, StatCollector.translateToLocal("button.de.scaleDown.txt"))); + buttonList.add( + new GuiButtonAHeight( + 4, + x + 2, + y + 25, + 80, + 15, + StatCollector.translateToLocal("button.de.scaleUp.txt"))); + buttonList.add( + new GuiButtonAHeight( + 5, + x - 81, + y + 25, + 80, + 15, + StatCollector.translateToLocal("button.de.scaleDown.txt"))); buttonList.add(buttonArmorFade = new GuiButtonAHeight(6, x - 81, y + 42, 163, 15, "")); buttonList.add(buttonArmorNumeric = new GuiButtonAHeight(7, x + 2, y + 59, 80, 15, "")); - buttonList.add(new GuiButtonAHeight( - 8, x - 81, y + 59, 80, 15, StatCollector.translateToLocal("button.de.rotate.txt"))); - buttonList.add(new GuiButtonAHeight( - 10, x - 81, y + 76, 163, 15, StatCollector.translateToLocal("button.de.toggleHidden.txt"))); + buttonList.add( + new GuiButtonAHeight( + 8, + x - 81, + y + 59, + 80, + 15, + StatCollector.translateToLocal("button.de.rotate.txt"))); + buttonList.add( + new GuiButtonAHeight( + 10, + x - 81, + y + 76, + 163, + 15, + StatCollector.translateToLocal("button.de.toggleHidden.txt"))); } @Override public void updateScreen() { - buttonHudFade.displayString = - StatCollector.translateToLocal("button.de.fadeMode" + ConfigHandler.hudSettings[6] + ".txt"); - buttonArmorFade.displayString = - StatCollector.translateToLocal("button.de.fadeMode" + ConfigHandler.hudSettings[7] + ".txt"); + buttonHudFade.displayString = StatCollector + .translateToLocal("button.de.fadeMode" + ConfigHandler.hudSettings[6] + ".txt"); + buttonArmorFade.displayString = StatCollector + .translateToLocal("button.de.fadeMode" + ConfigHandler.hudSettings[7] + ".txt"); buttonArmorNumeric.displayString = StatCollector.translateToLocal("button.de.numeric.txt") + " " - + (ConfigHandler.hudSettings[9] == 0 - ? StatCollector.translateToLocal("gui.de.off.txt") + + (ConfigHandler.hudSettings[9] == 0 ? StatCollector.translateToLocal("gui.de.off.txt") : StatCollector.translateToLocal("gui.de.on.txt")); } @@ -104,17 +149,15 @@ public class GuiHudConfig extends GuiScreen { else ConfigHandler.hudSettings[11] = 0; } - ConfigHandler.config - .get( - "Gui Stuff", - "HUD Settings", - new int[] {7, 874, 100, 100, 100, 100, 0, 0, 0, 0, 1, 1}, - "Used to store the position of the armor ant tool HUD's. This should not be modified", - Integer.MIN_VALUE, - Integer.MAX_VALUE, - true, - 12) - .set(ConfigHandler.hudSettings); + ConfigHandler.config.get( + "Gui Stuff", + "HUD Settings", + new int[] { 7, 874, 100, 100, 100, 100, 0, 0, 0, 0, 1, 1 }, + "Used to store the position of the armor ant tool HUD's. This should not be modified", + Integer.MIN_VALUE, + Integer.MAX_VALUE, + true, + 12).set(ConfigHandler.hudSettings); ConfigHandler.config.save(); } @@ -152,9 +195,17 @@ public class GuiHudConfig extends GuiScreen { 0xFFFFFF); drawCenteredString( - fontRendererObj, ConfigHandler.hudSettings[4] + "%", width / 2 + 97, height / 2 - 63, 0xFFFFFF); + fontRendererObj, + ConfigHandler.hudSettings[4] + "%", + width / 2 + 97, + height / 2 - 63, + 0xFFFFFF); drawCenteredString( - fontRendererObj, ConfigHandler.hudSettings[5] + "%", width / 2 + 97, height / 2 - 1, 0xFFFFFF); + fontRendererObj, + ConfigHandler.hudSettings[5] + "%", + width / 2 + 97, + height / 2 - 1, + 0xFFFFFF); super.drawScreen(x, y, partial); GL11.glDisable(GL12.GL_RESCALE_NORMAL); @@ -185,15 +236,12 @@ public class GuiHudConfig extends GuiScreen { if (GuiHelper.isInRect(armorX - 19, armorY - 19, 39, 39, x, y) || GuiHelper.isInRect(hudX - 19, hudY - 19, 39, 39, x, y)) { - drawHoveringText( - new ArrayList() { - { - add(StatCollector.translateToLocal("info.de.hudDisplayConfigTxt2.txt")); - } - }, - x, - y, - fontRendererObj); + drawHoveringText(new ArrayList() { + + { + add(StatCollector.translateToLocal("info.de.hudDisplayConfigTxt2.txt")); + } + }, x, y, fontRendererObj); } } @@ -224,17 +272,15 @@ public class GuiHudConfig extends GuiScreen { protected void mouseMovedOrUp(int x, int y, int action) { super.mouseMovedOrUp(x, y, action); draggingHud = draggingArmor = false; - ConfigHandler.config - .get( - "Gui Stuff", - "HUD Settings", - new int[] {7, 874, 100, 100, 100, 100, 0, 0, 0, 0, 1, 1}, - "Used to store the position of the armor ant tool HUD's. This should not be modified", - Integer.MIN_VALUE, - Integer.MAX_VALUE, - true, - 12) - .set(ConfigHandler.hudSettings); + ConfigHandler.config.get( + "Gui Stuff", + "HUD Settings", + new int[] { 7, 874, 100, 100, 100, 100, 0, 0, 0, 0, 1, 1 }, + "Used to store the position of the armor ant tool HUD's. This should not be modified", + Integer.MIN_VALUE, + Integer.MAX_VALUE, + true, + 12).set(ConfigHandler.hudSettings); ConfigHandler.config.save(); } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiTextureButton.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiTextureButton.java index 37e2b984..1a7912c2 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiTextureButton.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiTextureButton.java @@ -4,17 +4,19 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.OpenGlHelper; + import org.lwjgl.opengl.GL11; /** * Created by Brandon on 30/6/2015. */ public class GuiTextureButton extends GuiButton { + public int textureXPos; public int textureYPos; - public GuiTextureButton( - int id, int xPos, int yPos, int textureXPos, int textureYPos, int xSise, int ySise, String text) { + public GuiTextureButton(int id, int xPos, int yPos, int textureXPos, int textureYPos, int xSise, int ySise, + String text) { super(id, xPos, yPos, xSise, ySise, text); this.textureXPos = textureXPos; this.textureYPos = textureYPos; @@ -25,8 +27,7 @@ public class GuiTextureButton extends GuiButton { if (this.visible) { FontRenderer fontrenderer = mc.fontRenderer; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.field_146123_n = x >= this.xPosition - && y >= this.yPosition + this.field_146123_n = x >= this.xPosition && y >= this.yPosition && x < this.xPosition + this.width && y < this.yPosition + this.height; int k = this.getHoverState(this.field_146123_n); @@ -34,7 +35,12 @@ public class GuiTextureButton extends GuiButton { OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); this.drawTexturedModalRect( - this.xPosition, this.yPosition, textureXPos, textureYPos + k * height, this.width, this.height); + this.xPosition, + this.yPosition, + textureXPos, + textureYPos + k * height, + this.width, + this.height); this.mouseDragged(mc, x, y); int l = 14737632; diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIManual.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIManual.java index a076410a..61c411b0 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIManual.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIManual.java @@ -1,5 +1,23 @@ package com.brandon3055.draconicevolution.client.gui.componentguis; +import java.io.*; +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.client.gui.GuiConfirmOpenLink; +import net.minecraft.client.gui.GuiYesNoCallback; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.resources.IResource; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; + +import org.apache.commons.io.IOUtils; +import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.GL11; + import com.brandon3055.brandonscore.client.gui.guicomponents.*; import com.brandon3055.brandonscore.client.utills.ClientUtills; import com.brandon3055.brandonscore.common.utills.InfoHelper; @@ -13,21 +31,6 @@ import com.brandon3055.draconicevolution.common.handler.ContributorHandler; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.utills.LogHelper; import com.google.gson.stream.JsonReader; -import java.io.*; -import java.util.ArrayList; -import java.util.List; -import net.minecraft.client.Minecraft; -import net.minecraft.client.audio.PositionedSoundRecord; -import net.minecraft.client.gui.GuiConfirmOpenLink; -import net.minecraft.client.gui.GuiYesNoCallback; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.resources.IResource; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; -import org.apache.commons.io.IOUtils; -import org.lwjgl.input.Keyboard; -import org.lwjgl.opengl.GL11; /** * Created by Brandon on 6/03/2015. @@ -44,12 +47,16 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { public GUIManual() { super(new DummyContainer(), 255, 325); if (currentPage != null) { - collection - .addComponent(new ComponentManualPage(0, 0, this, currentPage)) - .setGroup(GR_PAGE); - collection - .addComponent(new ComponentButton( - 102, 314, 50, 12, 1, this, StatCollector.translateToLocal("button.de.back.txt"))) + collection.addComponent(new ComponentManualPage(0, 0, this, currentPage)).setGroup(GR_PAGE); + collection.addComponent( + new ComponentButton( + 102, + 314, + 50, + 12, + 1, + this, + StatCollector.translateToLocal("button.de.back.txt"))) .setGroup(GR_PAGE); collection.setOnlyGroupEnabled(GR_BACKGROUND); collection.setGroupEnabled(GR_PAGE, true); @@ -64,11 +71,8 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { loadPages(); if (previousScale == -1) adjustGuiScale(); - if (!Minecraft.getMinecraft() - .getLanguageManager() - .getCurrentLanguage() - .getLanguageCode() - .equals(lang)) loadPages(); + if (!Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode().equals(lang)) + loadPages(); LogHelper.info(ContributorHandler.contributors); } @@ -125,50 +129,60 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { protected ComponentCollection assembleComponents() { collection = new ComponentCollection(0, 0, xSize, ySize, this); - collection - .addComponent(new ComponentTexturedRect( - 0, 0, 255, 255, ResourceHandler.getResource("textures/gui/manualTop.png"))) + collection.addComponent( + new ComponentTexturedRect(0, 0, 255, 255, ResourceHandler.getResource("textures/gui/manualTop.png"))) .setGroup(GR_BACKGROUND); - collection - .addComponent(new ComponentTexturedRect( - 0, 255, 255, 69, ResourceHandler.getResource("textures/gui/manualBottom.png"))) - .setGroup(GR_BACKGROUND); - - collection - .addComponent(new ComponentTexturedRect( - 7, 100, 0, 0, 255, 255, ResourceHandler.getResource("textures/gui/images/debanner.png"), true)) - .setGroup(GR_INTRO) - .setName("BANNER"); - - collection - .addComponent(new ComponentButton( - 75, - 260, - 100, - 20, + collection.addComponent( + new ComponentTexturedRect( 0, - this, - StatCollector.translateToLocal("info.de.manual.indexButton.txt"), - StatCollector.translateToLocal("info.de.manual.indexButtonTip.txt"))) - .setGroup(GR_INTRO); - collection - .addComponent(new ComponentButton( - 75, - 285, + 255, + 255, + 69, + ResourceHandler.getResource("textures/gui/manualBottom.png"))) + .setGroup(GR_BACKGROUND); + + collection.addComponent( + new ComponentTexturedRect( + 7, 100, - 20, - 2, - this, - StatCollector.translateToLocal("info.de.manual.contributorsButton.txt"), - StatCollector.translateToLocal("info.de.manual.contributorsButtonInfo.txt"))) + 0, + 0, + 255, + 255, + ResourceHandler.getResource("textures/gui/images/debanner.png"), + true)) + .setGroup(GR_INTRO).setName("BANNER"); + + collection + .addComponent( + new ComponentButton( + 75, + 260, + 100, + 20, + 0, + this, + StatCollector.translateToLocal("info.de.manual.indexButton.txt"), + StatCollector.translateToLocal("info.de.manual.indexButtonTip.txt"))) .setGroup(GR_INTRO); collection - .addComponent(new ComponentContributorsPage(0, 0, this)) - .setGroup(GR_CONTRIBUTORS) + .addComponent( + new ComponentButton( + 75, + 285, + 100, + 20, + 2, + this, + StatCollector.translateToLocal("info.de.manual.contributorsButton.txt"), + StatCollector.translateToLocal("info.de.manual.contributorsButtonInfo.txt"))) + .setGroup(GR_INTRO); + collection.addComponent(new ComponentContributorsPage(0, 0, this)).setGroup(GR_CONTRIBUTORS) .setName("CONTRIBUTORS"); collection - .addComponent(new ComponentTextureButton( + .addComponent( + new ComponentTextureButton( 140, 290, 0, @@ -179,14 +193,11 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { this, "", "", - ResourceHandler.getResource("textures/gui/patreon.png")) - .forceFullRender()) + ResourceHandler.getResource("textures/gui/patreon.png")).forceFullRender()) .setGroup(GR_CONTRIBUTORS); for (int i = 0; i < pageList.size(); i++) { - collection - .addComponent(new ComponentIndexButton(20, 20 + i * 20, this, pageList.get(i))) - .setGroup(GR_INDEX) + collection.addComponent(new ComponentIndexButton(20, 20 + i * 20, this, pageList.get(i))).setGroup(GR_INDEX) .setName("INDEX_BUTTON_" + i); pageLength += 20; } @@ -212,13 +223,14 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { barPosition = (int) (((double) scrollOffset / scrollLimit) * 247D); } else if (collection.getComponent("CONTRIBUTORS") != null && collection.getComponent("CONTRIBUTORS").isEnabled()) { - ComponentContributorsPage page = (ComponentContributorsPage) collection.getComponent("CONTRIBUTORS"); - barPosition = (int) (((double) page.scrollOffset / page.scrollLimit) * 247D); - } else if (collection.getComponent("OPEN_PAGE") != null - && collection.getComponent("OPEN_PAGE").isEnabled()) { - ComponentManualPage page = (ComponentManualPage) collection.getComponent("OPEN_PAGE"); - barPosition = (int) (((double) page.scrollOffset / page.scrollLimit) * 247D); - } + ComponentContributorsPage page = (ComponentContributorsPage) collection + .getComponent("CONTRIBUTORS"); + barPosition = (int) (((double) page.scrollOffset / page.scrollLimit) * 247D); + } else + if (collection.getComponent("OPEN_PAGE") != null && collection.getComponent("OPEN_PAGE").isEnabled()) { + ComponentManualPage page = (ComponentManualPage) collection.getComponent("OPEN_PAGE"); + barPosition = (int) (((double) page.scrollOffset / page.scrollLimit) * 247D); + } } @Override @@ -226,8 +238,7 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { super.drawScreen(mouseX, mouseY, par3); int posX = (this.width - xSize) / 2; int posY = (this.height - ySize) / 2; - if (collection.getComponent("BANNER") != null - && collection.getComponent("BANNER").isEnabled()) + if (collection.getComponent("BANNER") != null && collection.getComponent("BANNER").isEnabled()) fontRendererObj.drawSplitString( StatCollector.translateToLocal("info.de.manual.introTxt.txt"), posX + 20, @@ -235,8 +246,7 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { 150, 0x000000); - if (collection.getComponent("BANNER") != null - && collection.getComponent("BANNER").isEnabled()) return; + if (collection.getComponent("BANNER") != null && collection.getComponent("BANNER").isEnabled()) return; ResourceHandler.bindResource("textures/gui/Widgets.png"); GL11.glColor4f(1F, 1F, 1F, 1F); drawTexturedModalRect(guiLeft, guiTop, 118, 20, 17, 17); @@ -255,24 +265,22 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { public void updateScreen() { super.updateScreen(); - disableScrollBar = collection.getComponent("BANNER") != null - && collection.getComponent("BANNER").isEnabled(); + disableScrollBar = collection.getComponent("BANNER") != null && collection.getComponent("BANNER").isEnabled(); - if (!scrollPressed - && collection.getComponent("INDEX_BUTTON_0") != null + if (!scrollPressed && collection.getComponent("INDEX_BUTTON_0") != null && collection.getComponent("INDEX_BUTTON_0").isEnabled()) { barPosition = (int) (((double) scrollOffset / scrollLimit) * 247D); - } else if (!scrollPressed - && collection.getComponent("CONTRIBUTORS") != null + } else if (!scrollPressed && collection.getComponent("CONTRIBUTORS") != null && collection.getComponent("CONTRIBUTORS").isEnabled()) { - ComponentContributorsPage page = (ComponentContributorsPage) collection.getComponent("CONTRIBUTORS"); - barPosition = (int) (((double) page.scrollOffset / page.scrollLimit) * 247D); - } else if (!scrollPressed - && collection.getComponent("OPEN_PAGE") != null - && collection.getComponent("OPEN_PAGE").isEnabled()) { - ComponentManualPage page = (ComponentManualPage) collection.getComponent("OPEN_PAGE"); - barPosition = (int) (((double) page.scrollOffset / page.scrollLimit) * 247D); - } + ComponentContributorsPage page = (ComponentContributorsPage) collection + .getComponent("CONTRIBUTORS"); + barPosition = (int) (((double) page.scrollOffset / page.scrollLimit) * 247D); + } else + if (!scrollPressed && collection.getComponent("OPEN_PAGE") != null + && collection.getComponent("OPEN_PAGE").isEnabled()) { + ComponentManualPage page = (ComponentManualPage) collection.getComponent("OPEN_PAGE"); + barPosition = (int) (((double) page.scrollOffset / page.scrollLimit) * 247D); + } if (worldUpdateIn > -1) worldUpdateIn--; if (worldUpdateIn == 0) collection.setWorldAndResolution(mc, width, height); @@ -348,13 +356,10 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { } public static void loadPages() { - lang = Minecraft.getMinecraft() - .getLanguageManager() - .getCurrentLanguage() - .getLanguageCode(); + lang = Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode(); - ResourceLocation rsLocation = - new ResourceLocation(References.RESOURCESPREFIX + "manual/manual-" + lang + ".json"); + ResourceLocation rsLocation = new ResourceLocation( + References.RESOURCESPREFIX + "manual/manual-" + lang + ".json"); IResource resource = null; try { @@ -456,13 +461,13 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { } reader.endObject(); - if (isValidPage(name)) - pageList.add(new ManualPage( - name, - images.toArray(new String[images.size()]), - content.toArray(new String[content.size()]), - nameL, - meta)); + if (isValidPage(name)) pageList.add( + new ManualPage( + name, + images.toArray(new String[images.size()]), + content.toArray(new String[content.size()]), + nameL, + meta)); } reader.endArray(); reader.close(); @@ -479,21 +484,23 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { if (buttonPressed) return; for (ComponentBase c : collection.getComponents()) { - if (c instanceof ComponentIndexButton - && c.isEnabled() + if (c instanceof ComponentIndexButton && c.isEnabled() && ((ComponentIndexButton) c).isOnScreen() && c.isMouseOver(x - guiLeft, y - guiTop)) { - Minecraft.getMinecraft() - .getSoundHandler() + Minecraft.getMinecraft().getSoundHandler() .playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); currentPage = ((ComponentIndexButton) c).getPage(); - collection - .addComponent(new ComponentManualPage(0, 0, this, currentPage)) - .setGroup(GR_PAGE) + collection.addComponent(new ComponentManualPage(0, 0, this, currentPage)).setGroup(GR_PAGE) .setName("OPEN_PAGE"); - collection - .addComponent(new ComponentButton( - 102, 314, 50, 12, 1, this, StatCollector.translateToLocal("button.de.back.txt"))) + collection.addComponent( + new ComponentButton( + 102, + 314, + 50, + 12, + 1, + this, + StatCollector.translateToLocal("button.de.back.txt"))) .setGroup(GR_PAGE); collection.setOnlyGroupEnabled(GR_BACKGROUND); collection.setGroupEnabled(GR_PAGE, true); @@ -504,19 +511,20 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { @Override public void barMoved(double position) { - if (collection.getComponent("INDEX_BUTTON_0") != null - && collection.getComponent("INDEX_BUTTON_0").isEnabled()) scrollOffset = (int) (position * scrollLimit); + if (collection.getComponent("INDEX_BUTTON_0") != null && collection.getComponent("INDEX_BUTTON_0").isEnabled()) + scrollOffset = (int) (position * scrollLimit); else if (collection.getComponent("CONTRIBUTORS") != null && collection.getComponent("CONTRIBUTORS").isEnabled()) { - ComponentContributorsPage page = (ComponentContributorsPage) collection.getComponent("CONTRIBUTORS"); - if (page.scrollLimit < 0) return; - page.scrollOffset = (int) (position * page.scrollLimit); - } else if (collection.getComponent("OPEN_PAGE") != null - && collection.getComponent("OPEN_PAGE").isEnabled()) { - ComponentManualPage page = (ComponentManualPage) collection.getComponent("OPEN_PAGE"); - if (page.scrollLimit < 0) return; - page.scrollOffset = (int) (position * page.scrollLimit); - } + ComponentContributorsPage page = (ComponentContributorsPage) collection + .getComponent("CONTRIBUTORS"); + if (page.scrollLimit < 0) return; + page.scrollOffset = (int) (position * page.scrollLimit); + } else + if (collection.getComponent("OPEN_PAGE") != null && collection.getComponent("OPEN_PAGE").isEnabled()) { + ComponentManualPage page = (ComponentManualPage) collection.getComponent("OPEN_PAGE"); + if (page.scrollLimit < 0) return; + page.scrollOffset = (int) (position * page.scrollLimit); + } } private static boolean isValidPage(String name) { diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIReactor.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIReactor.java index 968a72d7..41d9ff88 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIReactor.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIReactor.java @@ -1,24 +1,28 @@ package com.brandon3055.draconicevolution.client.gui.componentguis; +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; + +import org.lwjgl.opengl.GL11; + import com.brandon3055.brandonscore.client.gui.guicomponents.*; import com.brandon3055.brandonscore.client.utills.GuiHelper; import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.common.container.ContainerReactor; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore; -import java.util.ArrayList; -import java.util.List; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import org.lwjgl.opengl.GL11; /** * Created by brandon3055 on 30/7/2015. */ public class GUIReactor extends GUIBase { + private TileReactorCore reactor; private ContainerReactor container; private static boolean showStats = false; @@ -34,8 +38,8 @@ public class GUIReactor extends GUIBase { collection = new ComponentCollection(0, 0, 248, 222, this); collection.addComponent( new ComponentTexturedRect(0, 0, xSize, ySize, ResourceHandler.getResource("textures/gui/Reactor.png"))); - collection - .addComponent(new ComponentTextureButton( + collection.addComponent( + new ComponentTextureButton( 14, 190, 18, @@ -48,8 +52,8 @@ public class GUIReactor extends GUIBase { StatCollector.translateToLocal("button.de.reactorCharge.txt"), ResourceHandler.getResource("textures/gui/Widgets.png"))) .setName("CHARGE"); - collection - .addComponent(new ComponentTextureButton( + collection.addComponent( + new ComponentTextureButton( 14, 190, 18, @@ -62,8 +66,8 @@ public class GUIReactor extends GUIBase { StatCollector.translateToLocal("button.de.reactorStart.txt"), ResourceHandler.getResource("textures/gui/Widgets.png"))) .setName("ACTIVATE"); - collection - .addComponent(new ComponentTextureButton( + collection.addComponent( + new ComponentTextureButton( 216, 190, 18, @@ -76,8 +80,8 @@ public class GUIReactor extends GUIBase { StatCollector.translateToLocal("button.de.reactorStop.txt"), ResourceHandler.getResource("textures/gui/Widgets.png"))) .setName("DEACTIVATE"); - collection - .addComponent(new ComponentButton( + collection.addComponent( + new ComponentButton( 9, 120, 43, @@ -99,15 +103,15 @@ public class GUIReactor extends GUIBase { drawTexturedModalRect(guiLeft + 14, guiTop + 139, 14, ySize, 18, 18); drawTexturedModalRect(guiLeft + 216, guiTop + 139, 32, ySize, 18, 18); - fontRendererObj.drawString( - StatCollector.translateToLocal("gui.de.insert.txt"), guiLeft + 8, guiTop + 159, 0); - fontRendererObj.drawString( - StatCollector.translateToLocal("gui.de.fuel.txt"), guiLeft + 13, guiTop + 168, 0); + fontRendererObj + .drawString(StatCollector.translateToLocal("gui.de.insert.txt"), guiLeft + 8, guiTop + 159, 0); + fontRendererObj + .drawString(StatCollector.translateToLocal("gui.de.fuel.txt"), guiLeft + 13, guiTop + 168, 0); - fontRendererObj.drawString( - StatCollector.translateToLocal("gui.de.extract.txt"), guiLeft + 206, guiTop + 159, 0); - fontRendererObj.drawString( - StatCollector.translateToLocal("gui.de.fuel.txt"), guiLeft + 215, guiTop + 168, 0); + fontRendererObj + .drawString(StatCollector.translateToLocal("gui.de.extract.txt"), guiLeft + 206, guiTop + 159, 0); + fontRendererObj + .drawString(StatCollector.translateToLocal("gui.de.fuel.txt"), guiLeft + 215, guiTop + 168, 0); } drawCenteredString(fontRendererObj, "Draconic Reactor", guiLeft + xSize / 2, guiTop + 4, 0x00FFFF); } @@ -157,14 +161,13 @@ public class GUIReactor extends GUIBase { } String status = StatCollector.translateToLocal("gui.de.status.txt") + ": " - + (reactor.reactorState == 0 - ? EnumChatFormatting.DARK_GRAY - : reactor.reactorState == 1 - ? EnumChatFormatting.RED + + (reactor.reactorState == 0 ? EnumChatFormatting.DARK_GRAY + : reactor.reactorState == 1 ? EnumChatFormatting.RED : reactor.reactorState == 2 ? EnumChatFormatting.DARK_GREEN : EnumChatFormatting.RED) + StatCollector.translateToLocal("gui.de.status" + reactor.reactorState + ".txt"); if (reactor.reactorState == 1 && reactor.canStart()) - status = StatCollector.translateToLocal("gui.de.status.txt") + ": " + EnumChatFormatting.DARK_GREEN + status = StatCollector.translateToLocal("gui.de.status.txt") + ": " + + EnumChatFormatting.DARK_GREEN + StatCollector.translateToLocal("gui.de.status1_5.txt"); if (!showStats) fontRendererObj.drawString(status, xSize - 5 - fontRendererObj.getStringWidth(status), 125, 0); } @@ -181,52 +184,64 @@ public class GUIReactor extends GUIBase { text.add(StatCollector.translateToLocal("gui.de.fieldStrength.txt")); if (reactor.maxFieldCharge > 0) text.add(Utills.round(reactor.fieldCharge / reactor.maxFieldCharge * 100D, 100D) + "%"); - text.add(Utills.addCommas((int) reactor.fieldCharge) + " / " - + Utills.addCommas((int) reactor.maxFieldCharge)); // todo refine or remove + text.add( + Utills.addCommas((int) reactor.fieldCharge) + " / " + + Utills.addCommas((int) reactor.maxFieldCharge)); // todo refine or remove drawHoveringText(text, mouseX, mouseY, fontRendererObj); } else if (GuiHelper.isInRect(197, 4, 18, 114, mouseX - guiLeft, mouseY - guiTop)) { text.add(StatCollector.translateToLocal("gui.de.energySaturation.txt")); - if (reactor.maxEnergySaturation > 0) - text.add(Utills.round( - (double) reactor.energySaturation / (double) reactor.maxEnergySaturation * 100D, 100D) - + "%"); - text.add(Utills.addCommas(reactor.energySaturation) + " / " - + Utills.addCommas(reactor.maxEnergySaturation)); // todo refine or remove + if (reactor.maxEnergySaturation > 0) text.add( + Utills.round((double) reactor.energySaturation / (double) reactor.maxEnergySaturation * 100D, 100D) + + "%"); + text.add( + Utills.addCommas(reactor.energySaturation) + " / " + Utills.addCommas(reactor.maxEnergySaturation)); // todo + // refine + // or + // remove drawHoveringText(text, mouseX, mouseY, fontRendererObj); } else if (GuiHelper.isInRect(221, 4, 18, 114, mouseX - guiLeft, mouseY - guiTop)) { text.add(StatCollector.translateToLocal("gui.de.fuelConversion.txt")); - if (reactor.reactorFuel + reactor.convertedFuel > 0) - text.add(Utills.round( - ((double) reactor.convertedFuel + reactor.conversionUnit) - / ((double) reactor.convertedFuel + (double) reactor.reactorFuel) - * 100D, - 100D) - + "%"); - text.add(reactor.convertedFuel + " / " - + (reactor.convertedFuel + reactor.reactorFuel)); // todo refine or remove + if (reactor.reactorFuel + reactor.convertedFuel > 0) text.add( + Utills.round( + ((double) reactor.convertedFuel + reactor.conversionUnit) + / ((double) reactor.convertedFuel + (double) reactor.reactorFuel) + * 100D, + 100D) + "%"); + text.add(reactor.convertedFuel + " / " + (reactor.convertedFuel + reactor.reactorFuel)); // todo refine or + // remove drawHoveringText(text, mouseX, mouseY, fontRendererObj); } if (showStats) { if (GuiHelper.isInRect(53, 15, 140, 18, mouseX - guiLeft, mouseY - guiTop)) { - text.addAll(fontRendererObj.listFormattedStringToWidth( - StatCollector.translateToLocal("gui.de.reacTempLoadFactor.txt"), 200)); + text.addAll( + fontRendererObj.listFormattedStringToWidth( + StatCollector.translateToLocal("gui.de.reacTempLoadFactor.txt"), + 200)); drawHoveringText(text, mouseX, mouseY, fontRendererObj); } else if (GuiHelper.isInRect(53, 40, 140, 18, mouseX - guiLeft, mouseY - guiTop)) { - text.addAll(fontRendererObj.listFormattedStringToWidth( - StatCollector.translateToLocal("gui.de.reacCoreMass.txt"), 200)); + text.addAll( + fontRendererObj.listFormattedStringToWidth( + StatCollector.translateToLocal("gui.de.reacCoreMass.txt"), + 200)); drawHoveringText(text, mouseX, mouseY, fontRendererObj); } else if (GuiHelper.isInRect(53, 65, 140, 18, mouseX - guiLeft, mouseY - guiTop)) { - text.addAll(fontRendererObj.listFormattedStringToWidth( - StatCollector.translateToLocal("gui.de.reacGenRate.txt"), 200)); + text.addAll( + fontRendererObj.listFormattedStringToWidth( + StatCollector.translateToLocal("gui.de.reacGenRate.txt"), + 200)); drawHoveringText(text, mouseX, mouseY, fontRendererObj); } else if (GuiHelper.isInRect(53, 88, 140, 18, mouseX - guiLeft, mouseY - guiTop)) { - text.addAll(fontRendererObj.listFormattedStringToWidth( - StatCollector.translateToLocal("gui.de.reacInputRate.txt"), 200)); + text.addAll( + fontRendererObj.listFormattedStringToWidth( + StatCollector.translateToLocal("gui.de.reacInputRate.txt"), + 200)); drawHoveringText(text, mouseX, mouseY, fontRendererObj); } else if (GuiHelper.isInRect(53, 113, 140, 18, mouseX - guiLeft, mouseY - guiTop)) { - text.addAll(fontRendererObj.listFormattedStringToWidth( - StatCollector.translateToLocal("gui.de.reacConversionRate.txt"), 200)); + text.addAll( + fontRendererObj.listFormattedStringToWidth( + StatCollector.translateToLocal("gui.de.reacConversionRate.txt"), + 200)); drawHoveringText(text, mouseX, mouseY, fontRendererObj); } } @@ -239,17 +254,23 @@ public class GUIReactor extends GUIBase { fontRendererObj.drawString(Utills.round(reactor.tempDrainFactor * 100D, 1D) + "%", 60, 2 + 24, 0); fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.mass.name"), 55, 16 + 24, 0x0000FF); fontRendererObj.drawString( - Utills.round((reactor.reactorFuel + reactor.convertedFuel) / 1296D, 100) + "m^3", 60, 2 + 2 * 24, 0); + Utills.round((reactor.reactorFuel + reactor.convertedFuel) / 1296D, 100) + "m^3", + 60, + 2 + 2 * 24, + 0); fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.genRate.name"), 55, 16 + 2 * 24, 0x0000FF); fontRendererObj.drawString(Utills.addCommas((int) reactor.generationRate) + "RF/t", 60, 2 + 3 * 24, 0); + fontRendererObj + .drawString(StatCollector.translateToLocal("gui.de.fieldInputRate.name"), 55, 16 + 3 * 24, 0x0000FF); + fontRendererObj + .drawString(Utills.addCommas((int) Math.min(inputRate, Integer.MAX_VALUE)) + "RF/t", 60, 2 + 4 * 24, 0); + fontRendererObj + .drawString(StatCollector.translateToLocal("gui.de.fuelConversion.name"), 55, 16 + 4 * 24, 0x0000FF); fontRendererObj.drawString( - StatCollector.translateToLocal("gui.de.fieldInputRate.name"), 55, 16 + 3 * 24, 0x0000FF); - fontRendererObj.drawString( - Utills.addCommas((int) Math.min(inputRate, Integer.MAX_VALUE)) + "RF/t", 60, 2 + 4 * 24, 0); - fontRendererObj.drawString( - StatCollector.translateToLocal("gui.de.fuelConversion.name"), 55, 16 + 4 * 24, 0x0000FF); - fontRendererObj.drawString( - Utills.addCommas((int) Math.round(reactor.fuelUseRate * 1000000D)) + "nb/t", 60, 2 + 5 * 24, 0); + Utills.addCommas((int) Math.round(reactor.fuelUseRate * 1000000D)) + "nb/t", + 60, + 2 + 5 * 24, + 0); } @Override @@ -261,11 +282,12 @@ public class GUIReactor extends GUIBase { collection.getComponent("DEACTIVATE").setEnabled(false); else collection.getComponent("DEACTIVATE").setEnabled(true); if ((reactor.reactorState == TileReactorCore.STATE_OFFLINE - || (reactor.reactorState == TileReactorCore.STATE_STOP && !reactor.canStart())) - && reactor.canCharge()) collection.getComponent("CHARGE").setEnabled(true); + || (reactor.reactorState == TileReactorCore.STATE_STOP && !reactor.canStart())) && reactor.canCharge()) + collection.getComponent("CHARGE").setEnabled(true); else collection.getComponent("CHARGE").setEnabled(false); if ((reactor.reactorState == TileReactorCore.STATE_START || reactor.reactorState == TileReactorCore.STATE_STOP) - && reactor.canStart()) collection.getComponent("ACTIVATE").setEnabled(true); + && reactor.canStart()) + collection.getComponent("ACTIVATE").setEnabled(true); else collection.getComponent("ACTIVATE").setEnabled(false); super.updateScreen(); } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIToolConfig.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIToolConfig.java index 2e6752f8..255570c3 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIToolConfig.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIToolConfig.java @@ -1,5 +1,16 @@ package com.brandon3055.draconicevolution.client.gui.componentguis; +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; +import net.minecraft.util.StringUtils; + import com.brandon3055.brandonscore.client.gui.guicomponents.*; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; import com.brandon3055.brandonscore.common.utills.Utills; @@ -17,15 +28,6 @@ import com.brandon3055.draconicevolution.common.network.ItemConfigPacket; import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; import com.brandon3055.draconicevolution.common.utills.IInventoryTool; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; -import java.util.ArrayList; -import java.util.List; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; -import net.minecraft.util.StringUtils; /** * Created by Brandon on 26/12/2014. @@ -33,8 +35,8 @@ import net.minecraft.util.StringUtils; public class GUIToolConfig extends GUIBase { public EntityPlayer player; - private static final ResourceLocation inventoryTexture = - new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/ToolConfig.png"); + private static final ResourceLocation inventoryTexture = new ResourceLocation( + References.RESOURCESPREFIX + "textures/gui/ToolConfig.png"); private int screenLevel = 0; private ItemStack editingItem; private ContainerAdvTool container; @@ -52,28 +54,28 @@ public class GUIToolConfig extends GUIBase { public void initGui() { super.initGui(); if (ContributorHandler.contributors.containsKey(player.getCommandSenderName())) { - ContributorHandler.Contributor contributor = - ContributorHandler.contributors.get(player.getCommandSenderName()); + ContributorHandler.Contributor contributor = ContributorHandler.contributors + .get(player.getCommandSenderName()); if (!contributor.isUserValid(player)) return; buttonList.clear(); - if (contributor.contributionLevel >= 1) - buttonList.add(new GuiButton( - 0, - guiLeft - 150, - guiTop, - 150, - 20, - "Contributor Wings: " + (contributor.contributorWingsEnabled ? "Enabled" : "Disabled"))); - if (contributor.contribution.toLowerCase().contains("patreon")) - buttonList.add(new GuiButton( - 1, - guiLeft - 150, - guiTop + 22, - 150, - 20, - "Patreon Badge: " + (contributor.patreonBadgeEnabled ? "Enabled" : "Disabled"))); + if (contributor.contributionLevel >= 1) buttonList.add( + new GuiButton( + 0, + guiLeft - 150, + guiTop, + 150, + 20, + "Contributor Wings: " + (contributor.contributorWingsEnabled ? "Enabled" : "Disabled"))); + if (contributor.contribution.toLowerCase().contains("patreon")) buttonList.add( + new GuiButton( + 1, + guiLeft - 150, + guiTop + 22, + 150, + 20, + "Patreon Badge: " + (contributor.patreonBadgeEnabled ? "Enabled" : "Disabled"))); } } @@ -81,52 +83,61 @@ public class GUIToolConfig extends GUIBase { protected void actionPerformed(GuiButton button) { super.actionPerformed(button); if (ContributorHandler.contributors.containsKey(player.getCommandSenderName())) { - ContributorHandler.Contributor contributor = - ContributorHandler.contributors.get(player.getCommandSenderName()); + ContributorHandler.Contributor contributor = ContributorHandler.contributors + .get(player.getCommandSenderName()); if (!contributor.isUserValid(player)) return; if (button.id == 0) { contributor.contributorWingsEnabled = !contributor.contributorWingsEnabled; - button.displayString = - "Contributor Wings: " + (contributor.contributorWingsEnabled ? "Enabled" : "Disabled"); + button.displayString = "Contributor Wings: " + + (contributor.contributorWingsEnabled ? "Enabled" : "Disabled"); } else if (button.id == 1) { contributor.patreonBadgeEnabled = !contributor.patreonBadgeEnabled; button.displayString = "Patreon Badge: " + (contributor.patreonBadgeEnabled ? "Enabled" : "Disabled"); } - DraconicEvolution.network.sendToServer(new ContributorPacket( - player.getCommandSenderName(), - contributor.contributorWingsEnabled, - contributor.patreonBadgeEnabled)); + DraconicEvolution.network.sendToServer( + new ContributorPacket( + player.getCommandSenderName(), + contributor.contributorWingsEnabled, + contributor.patreonBadgeEnabled)); } } @Override protected ComponentCollection assembleComponents() { ComponentCollection c = new ComponentCollection(0, 0, xSize, ySize, this).setOpenBoarders(); - c.addComponent(new ComponentTexturedRect(0, -15, 198, 20, inventoryTexture)) - .setGroup("TEXT_TAB"); - c.addComponent(new ComponentTexturedRect(0, 0, 198, 89, inventoryTexture)) - .setGroup("BACKGROUND"); + c.addComponent(new ComponentTexturedRect(0, -15, 198, 20, inventoryTexture)).setGroup("TEXT_TAB"); + c.addComponent(new ComponentTexturedRect(0, 0, 198, 89, inventoryTexture)).setGroup("BACKGROUND"); c.addComponent(new ComponentTexturedRect(0, 13, 0, 9, 198, 80, inventoryTexture, false)) .setGroup("BACKGROUND_EXTENSION"); c.addComponent(new ComponentButton(3, 26, 20, 12, 0, this, "<=", StatCollector.translateToLocal("gui.back"))) - .setGroup("BUTTONS") - .setName("BACK_BUTTON"); - c.addComponent(new ComponentButton( - 3, 39, 20, 12, 1, this, "Inv", StatCollector.translateToLocal("gui.de.itemInventory.txt"))) - .setGroup("BUTTONS") - .setName("INVENTORY_BUTTON"); - c.addComponent(new ComponentFieldAdjuster(4, 34, null, this)) - .setGroup("FIELD_BUTTONS") + .setGroup("BUTTONS").setName("BACK_BUTTON"); + c.addComponent( + new ComponentButton( + 3, + 39, + 20, + 12, + 1, + this, + "Inv", + StatCollector.translateToLocal("gui.de.itemInventory.txt"))) + .setGroup("BUTTONS").setName("INVENTORY_BUTTON"); + c.addComponent(new ComponentFieldAdjuster(4, 34, null, this)).setGroup("FIELD_BUTTONS") .setName("FIELD_CONFIG_BUTTON_ARRAY"); - c.addComponent(new ComponentButton( - 0, ySize, xSize, 14, 2, this, StatCollector.translateToLocal("gui.de.configureGuiElements.txt")) - .setGroup("INV_SCREEN")); + c.addComponent( + new ComponentButton( + 0, + ySize, + xSize, + 14, + 2, + this, + StatCollector.translateToLocal("gui.de.configureGuiElements.txt")).setGroup("INV_SCREEN")); ComponentTextField textField = (ComponentTextField) new ComponentTextField(this, 3, -12, 191, 12) - .setLabel(StatCollector.translateToLocal("gui.de.profile.txt") + ":", 0xE0E0E0) - .setGroup("TEXT_TAB") + .setLabel(StatCollector.translateToLocal("gui.de.profile.txt") + ":", 0xE0E0E0).setGroup("TEXT_TAB") .setName("PROFILE_TEXT_FIELD"); c.addComponent(textField); return c; @@ -134,22 +145,18 @@ public class GUIToolConfig extends GUIBase { protected void addDependentComponents() { for (int x = 0; x < 9; x++) { - collection - .addComponent(new ComponentConfigItemButton(29 + 18 * x, 64, x, player)) - .setGroup("INV_SCREEN"); + collection.addComponent(new ComponentConfigItemButton(29 + 18 * x, 64, x, player)).setGroup("INV_SCREEN"); } for (int y = 0; y < 3; y++) { for (int x = 0; x < 9; x++) { - collection - .addComponent(new ComponentConfigItemButton(29 + 18 * x, 7 + y * 18, x + y * 9 + 9, player)) + collection.addComponent(new ComponentConfigItemButton(29 + 18 * x, 7 + y * 18, x + y * 9 + 9, player)) .setGroup("INV_SCREEN"); } } for (int y = 0; y < 4; y++) { - collection - .addComponent(new ComponentConfigItemButton(6, 7 + y * 19, 39 - y, player)) + collection.addComponent(new ComponentConfigItemButton(6, 7 + y * 19, 39 - y, player)) .setGroup("INV_SCREEN"); } @@ -174,8 +181,7 @@ public class GUIToolConfig extends GUIBase { int fieldOffsetY = 5; for (ComponentBase component : collection.getComponents()) { - if (component.isEnabled() - && component instanceof ComponentConfigItemButton + if (component.isEnabled() && component instanceof ComponentConfigItemButton && component.isMouseOver(x - this.guiLeft, y - this.guiTop) && ((ComponentConfigItemButton) component).hasValidItem) { ItemStack stack = player.inventory.getStackInSlot(((ComponentConfigItemButton) component).slot); @@ -186,8 +192,7 @@ public class GUIToolConfig extends GUIBase { setEditingItem(stack, ((ComponentConfigItemButton) component).slot); setLevel(1); for (ItemConfigField field : item.getFields(stack, ((ComponentConfigItemButton) component).slot)) { - collection - .addComponent(new ComponentFieldButton(fieldOffsetX, fieldOffsetY, player, field, this)) + collection.addComponent(new ComponentFieldButton(fieldOffsetX, fieldOffsetY, player, field, this)) .setGroup("LIST_SCREEN"); fieldOffsetY += 12; } @@ -218,8 +223,8 @@ public class GUIToolConfig extends GUIBase { } else if (id == 1 && editingItem != null) { // inventory button setLevel(3); Minecraft.getMinecraft().displayGuiScreen(new GUIToolInventory(player, container, this)); - // LogHelper.info("Pre send container " + Minecraft.getMinecraft().thePlayer.openContainer); - // DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOLINVENTORY, false)); + // LogHelper.info("Pre send container " + Minecraft.getMinecraft().thePlayer.openContainer); + // DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOLINVENTORY, false)); } else if (id == 2) { Minecraft.getMinecraft().displayGuiScreen(new GuiHudConfig(this)); } @@ -238,22 +243,19 @@ public class GUIToolConfig extends GUIBase { collection.setOnlyGroupEnabled("LIST_SCREEN"); collection.setGroupEnabled("BACKGROUND", true); collection.setGroupEnabled("BACKGROUND_EXTENSION", true); - if (editingItem != null - && editingItem.getItem() instanceof IConfigurableItem + if (editingItem != null && editingItem.getItem() instanceof IConfigurableItem && ((IConfigurableItem) editingItem.getItem()).hasProfiles()) collection.setGroupEnabled("TEXT_TAB", true); collection.setComponentEnabled("BACK_BUTTON", true); if (editingItem != null && editingItem.getItem() instanceof IInventoryTool) collection.setComponentEnabled("INVENTORY_BUTTON", true); - if (collection.getComponent("BACK_BUTTON") != null) - collection.getComponent("BACK_BUTTON").setY(26); + if (collection.getComponent("BACK_BUTTON") != null) collection.getComponent("BACK_BUTTON").setY(26); } else if (level == 2) { // field screen collection.setOnlyGroupEnabled("FIELD_BUTTONS"); collection.setGroupEnabled("BACKGROUND", true); collection.setComponentEnabled("BACK_BUTTON", true); - if (collection.getComponent("BACK_BUTTON") != null) - collection.getComponent("BACK_BUTTON").setY(3); - // slot = -1; + if (collection.getComponent("BACK_BUTTON") != null) collection.getComponent("BACK_BUTTON").setY(3); + // slot = -1; } else if (level == 3) { // inventory screen } @@ -301,23 +303,26 @@ public class GUIToolConfig extends GUIBase { super.drawGuiContainerForegroundLayer(mouseX, mouseY); if (slot > -1) editingItem = player.inventory.getStackInSlot(slot); - if (slot > -1 - && editingItem != null - && editingItem.getUnlocalizedName().toLowerCase().contains("bow")) { + if (slot > -1 && editingItem != null && editingItem.getUnlocalizedName().toLowerCase().contains("bow")) { BowHandler.BowProperties properties = new BowHandler.BowProperties(editingItem, player); - if (!properties.canFire() - && properties.cantFireMessage != null + if (!properties.canFire() && properties.cantFireMessage != null && !properties.cantFireMessage.equals("msg.de.outOfArrows.name")) { fontRendererObj.drawSplitString( - StatCollector.translateToLocal(properties.cantFireMessage), 0, ySize + 5, xSize, 0xFF0000); + StatCollector.translateToLocal(properties.cantFireMessage), + 0, + ySize + 5, + xSize, + 0xFF0000); } List list = new ArrayList(); - list.add(StatCollector.translateToLocal("gui.de.rfPerShot.txt") + ": " - + Utills.addCommas(properties.calculateEnergyCost())); - list.add(StatCollector.translateToLocal("gui.de.maxDamage.txt") + ": " - + properties.arrowDamage * (properties.arrowSpeed * 3)); + list.add( + StatCollector.translateToLocal("gui.de.rfPerShot.txt") + ": " + + Utills.addCommas(properties.calculateEnergyCost())); + list.add( + StatCollector.translateToLocal("gui.de.maxDamage.txt") + ": " + + properties.arrowDamage * (properties.arrowSpeed * 3)); drawHoveringText(list, xSize - 8, 0, fontRendererObj); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIToolInventory.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIToolInventory.java index cfaa80d0..3cebff8b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIToolInventory.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/GUIToolInventory.java @@ -1,20 +1,22 @@ package com.brandon3055.draconicevolution.client.gui.componentguis; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + import com.brandon3055.brandonscore.client.gui.guicomponents.*; import com.brandon3055.draconicevolution.common.container.ContainerAdvTool; import com.brandon3055.draconicevolution.common.lib.References; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.ResourceLocation; -import org.lwjgl.opengl.GL11; /** * Created by Brandon on 13/01/2015. */ public class GUIToolInventory extends GUIBase { - private static final ResourceLocation inventoryTexture = - new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/ToolConfig.png"); + private static final ResourceLocation inventoryTexture = new ResourceLocation( + References.RESOURCESPREFIX + "textures/gui/ToolConfig.png"); private ContainerAdvTool container; private String inventoryName; @@ -38,10 +40,8 @@ public class GUIToolInventory extends GUIBase { @Override protected ComponentCollection assembleComponents() { ComponentCollection c = new ComponentCollection(0, 0, xSize, ySize, this); - c.addComponent(new ComponentTexturedRect(0, 130 - 89, 198, 89, inventoryTexture)) - .setGroup("BACKGROUND"); - c.addComponent(new ComponentTexturedRect(0, 0, 198, 80, inventoryTexture)) - .setGroup("BACKGROUND"); + c.addComponent(new ComponentTexturedRect(0, 130 - 89, 198, 89, inventoryTexture)).setGroup("BACKGROUND"); + c.addComponent(new ComponentTexturedRect(0, 0, 198, 80, inventoryTexture)).setGroup("BACKGROUND"); c.addComponent(new ComponentButton(172, 3, 18, 12, 0, this, "<=", "Back")); for (int i = 0; i < 5; i++) { @@ -68,8 +68,7 @@ public class GUIToolInventory extends GUIBase { collection.addComponent(new ComponentSlotBackground(7 + x * 18, 18)).setGroup("INVENTORY"); ComponentSlotBackground.addInventorySlots(collection, 7, 44, container.inventoryItemSlot); if (container.inventoryItemSlot > 35) - collection - .addComponent(new ComponentItemRenderer(6, 18, container.inventoryTool.inventoryItem)) + collection.addComponent(new ComponentItemRenderer(6, 18, container.inventoryTool.inventoryItem)) .setGroup("INVENTORY"); } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/ManualPage.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/ManualPage.java index cf653f06..769fbc4b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/ManualPage.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/componentguis/ManualPage.java @@ -1,9 +1,11 @@ package com.brandon3055.draconicevolution.client.gui.componentguis; -import com.brandon3055.draconicevolution.common.utills.LogHelper; import net.minecraft.util.StatCollector; + import org.apache.commons.io.FilenameUtils; +import com.brandon3055.draconicevolution.common.utills.LogHelper; + /** * Created by Brandon on 7/03/2015. */ @@ -29,24 +31,23 @@ public class ManualPage { } public String getImageResourceName(String url) { - // try - // { + // try + // { LogHelper.info(url); return FilenameUtils.getName(url); // String fileName = new URL(url).getFile(); // return fileName.substring(fileName.indexOf("/") + 1); - // } - // catch (MalformedURLException e) - // { - // e.printStackTrace(); - // return ""; - // } + // } + // catch (MalformedURLException e) + // { + // e.printStackTrace(); + // return ""; + // } } public String getLocalizedName() { if (nameL != null) return nameL; - return (name.contains("item.") || name.contains("tile.")) - ? StatCollector.translateToLocal(name + ".name") + return (name.contains("item.") || name.contains("tile.")) ? StatCollector.translateToLocal(name + ".name") : name.contains("info.") ? name.substring(name.indexOf("info.") + 5) : "Invalid Name Data"; } } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentConfigItemButton.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentConfigItemButton.java index ff747bd4..97b2956c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentConfigItemButton.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentConfigItemButton.java @@ -1,25 +1,27 @@ package com.brandon3055.draconicevolution.client.gui.guicomponents; -import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentBase; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; -import com.brandon3055.draconicevolution.common.utills.IInventoryTool; -import com.brandon3055.draconicevolution.common.utills.ItemConfigField; import java.util.ArrayList; import java.util.List; + import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; +import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentBase; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; +import com.brandon3055.draconicevolution.common.utills.IInventoryTool; +import com.brandon3055.draconicevolution.common.utills.ItemConfigField; + /** * Created by Brandon on 29/12/2014. */ public class ComponentConfigItemButton extends ComponentBase { - private static final ResourceLocation texture = - new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/Widgets.png"); + private static final ResourceLocation texture = new ResourceLocation( + References.RESOURCESPREFIX + "textures/gui/Widgets.png"); public int slot; private InventoryPlayer inventory; public boolean hasValidItem = false; @@ -34,10 +36,8 @@ public class ComponentConfigItemButton extends ComponentBase { public void refreshState() { hasValidItem = (inventory.getStackInSlot(slot) != null && ((inventory.getStackInSlot(slot).getItem() instanceof IConfigurableItem - && !((IConfigurableItem) - inventory.getStackInSlot(slot).getItem()) - .getFields(inventory.getStackInSlot(slot), slot) - .isEmpty()) + && !((IConfigurableItem) inventory.getStackInSlot(slot).getItem()) + .getFields(inventory.getStackInSlot(slot), slot).isEmpty()) || inventory.getStackInSlot(slot).getItem() instanceof IInventoryTool)); } @@ -70,8 +70,7 @@ public class ComponentConfigItemButton extends ComponentBase { public void renderFinal(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { if (isMouseOver(mouseX, mouseY) && hasValidItem) { List list = new ArrayList(); - List fields = ((IConfigurableItem) - inventory.getStackInSlot(slot).getItem()) + List fields = ((IConfigurableItem) inventory.getStackInSlot(slot).getItem()) .getFields(inventory.getStackInSlot(slot), slot); for (ItemConfigField field : fields) { list.add(field.getLocalizedName() + ": " + field.getFormattedValue()); @@ -83,8 +82,7 @@ public class ComponentConfigItemButton extends ComponentBase { @Override public void mouseClicked(int x, int y, int button) { if (hasValidItem) { - Minecraft.getMinecraft() - .getSoundHandler() + Minecraft.getMinecraft().getSoundHandler() .playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentContributorsPage.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentContributorsPage.java index f5e54cbb..95ce811e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentContributorsPage.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentContributorsPage.java @@ -1,16 +1,10 @@ package com.brandon3055.draconicevolution.client.gui.guicomponents; -import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentScrollingBase; -import com.brandon3055.brandonscore.client.gui.guicomponents.GUIScrollingBase; -import com.brandon3055.brandonscore.client.utills.ClientUtills; -import com.brandon3055.brandonscore.common.utills.InfoHelper; -import com.brandon3055.draconicevolution.client.handler.ResourceHandler; -import com.brandon3055.draconicevolution.common.handler.ContributorHandler; -import com.brandon3055.draconicevolution.common.handler.ContributorHandler.Contributor; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; + import net.minecraft.client.Minecraft; import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.gui.GuiConfirmOpenLink; @@ -20,8 +14,17 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import net.minecraft.util.StringUtils; + import org.lwjgl.opengl.GL11; +import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentScrollingBase; +import com.brandon3055.brandonscore.client.gui.guicomponents.GUIScrollingBase; +import com.brandon3055.brandonscore.client.utills.ClientUtills; +import com.brandon3055.brandonscore.common.utills.InfoHelper; +import com.brandon3055.draconicevolution.client.handler.ResourceHandler; +import com.brandon3055.draconicevolution.common.handler.ContributorHandler; +import com.brandon3055.draconicevolution.common.handler.ContributorHandler.Contributor; + /** * Created by brandon3055 on 5/11/2015. */ @@ -40,7 +43,7 @@ public class ComponentContributorsPage extends ComponentScrollingBase implements @Override public void handleScrollInput(int direction) { - // page.scrollOffset += direction * 10; + // page.scrollOffset += direction * 10; scrollOffset += direction * (InfoHelper.isShiftKeyDown() ? 30 : 10); if (scrollOffset < 0) scrollOffset = 0; if (scrollOffset > pageLength - getHeight()) scrollOffset = pageLength - getHeight(); @@ -82,8 +85,7 @@ public class ComponentContributorsPage extends ComponentScrollingBase implements if (!(yOffset > 25 && yOffset < 324)) continue; - if (mouseX > 15 - && mouseX < 245 + if (mouseX > 15 && mouseX < 245 && mouseY < yOffset + 5 && mouseY > yOffset - 25 && !patreonButtonHighlighted) { @@ -101,10 +103,10 @@ public class ComponentContributorsPage extends ComponentScrollingBase implements renderPlayer(contributor.ign); GL11.glPopMatrix(); - fontRendererObj.drawStringWithShadow( - EnumChatFormatting.GOLD + contributor.name, 50, yOffset - 20, 0x000000); - fontRendererObj.drawString( - EnumChatFormatting.DARK_BLUE + contributor.contribution, 50, yOffset - 10, 0x000000); + fontRendererObj + .drawStringWithShadow(EnumChatFormatting.GOLD + contributor.name, 50, yOffset - 20, 0x000000); + fontRendererObj + .drawString(EnumChatFormatting.DARK_BLUE + contributor.contribution, 50, yOffset - 10, 0x000000); } } @@ -120,8 +122,7 @@ public class ComponentContributorsPage extends ComponentScrollingBase implements if (!(yOffset > 20 && yOffset < 330)) continue; - if (mouseX > 15 - && mouseX < 245 + if (mouseX > 15 && mouseX < 245 && mouseY < yOffset + 5 && mouseY > yOffset - 25 && !patreonButtonHighlighted) { @@ -142,17 +143,17 @@ public class ComponentContributorsPage extends ComponentScrollingBase implements if (!StringUtils.isNullOrEmpty(contributor.website)) { list.add(""); list.add("Website: " + EnumChatFormatting.BLUE + contributor.website); - list.add(EnumChatFormatting.GRAY - + StatCollector.translateToLocal("info.de.manual.clickToGoToSite.txt")); + list.add( + EnumChatFormatting.GRAY + + StatCollector.translateToLocal("info.de.manual.clickToGoToSite.txt")); } drawHoveringText(list, offsetX - 7, offsetY + yOffset + 20, fontRendererObj); } } - if (!ContributorHandler.successfulLoad) - fontRendererObj.drawString( - "[Error] Failed to download contributors list", offsetX + 20, offsetY + 40, 0xFF0000); + if (!ContributorHandler.successfulLoad) fontRendererObj + .drawString("[Error] Failed to download contributors list", offsetX + 20, offsetY + 40, 0xFF0000); } @Override @@ -174,8 +175,7 @@ public class ComponentContributorsPage extends ComponentScrollingBase implements if (!(yOffset > 20 && yOffset < 330) || patreonButtonHighlighted) continue; - if (x > 15 - && x < 245 + if (x > 15 && x < 245 && y < yOffset + 5 && y > yOffset - 25 && !StringUtils.isNullOrEmpty(contributor.website)) { diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentFieldAdjuster.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentFieldAdjuster.java index 3bf38299..408fb2c0 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentFieldAdjuster.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentFieldAdjuster.java @@ -1,5 +1,11 @@ package com.brandon3055.draconicevolution.client.gui.guicomponents; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; + import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentBase; import com.brandon3055.brandonscore.client.utills.GuiHelper; import com.brandon3055.brandonscore.common.utills.DataUtills; @@ -7,18 +13,14 @@ import com.brandon3055.draconicevolution.client.gui.componentguis.GUIToolConfig; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; -import net.minecraft.client.Minecraft; -import net.minecraft.client.audio.PositionedSoundRecord; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; /** * Created by Brandon on 1/01/2015. */ public class ComponentFieldAdjuster extends ComponentBase { - private static final ResourceLocation widgets = - new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/Widgets.png"); + + private static final ResourceLocation widgets = new ResourceLocation( + References.RESOURCESPREFIX + "textures/gui/Widgets.png"); protected static final ResourceLocation buttonTextures = new ResourceLocation("textures/gui/widgets.png"); public ItemConfigField field; @@ -103,20 +105,19 @@ public class ComponentFieldAdjuster extends ComponentBase { fieldValue = String.valueOf((double) Math.round(d * 100f) / 100D); } // if (field.datatype == References.FLOAT_ID) { - // float d = (Float)field.value; - // fieldValue = String.valueOf((double)Math.round((double)(d*100f)) / 100D); + // float d = (Float)field.value; + // fieldValue = String.valueOf((double)Math.round((double)(d*100f)) / 100D); // } int centre = fontRendererObj.getStringWidth(fieldName) / 2; fontRendererObj.drawString(fieldName, x + getWidth() / 2 - centre, y - 12, 0x00000); drawCenteredString(fontRendererObj, fieldValue, x + getWidth() / 2, y + 6, 0xffffff); - if (field.modifier == null || field.modifier.equals("AOE")) - drawCenteredString( - fontRendererObj, - StatCollector.translateToLocal("gui.de.max.txt") + " " + field.getMaxFormattedValue(), - x + getWidth() / 2, - y + 20, - 0xFFFFFF); + if (field.modifier == null || field.modifier.equals("AOE")) drawCenteredString( + fontRendererObj, + StatCollector.translateToLocal("gui.de.max.txt") + " " + field.getMaxFormattedValue(), + x + getWidth() / 2, + y + 20, + 0xFFFFFF); if (isDecimal() || isNonDecimal()) { fontRendererObj.drawString("---", 7, y + 6, 0x000000); @@ -207,13 +208,15 @@ public class ComponentFieldAdjuster extends ComponentBase { field.value = !(Boolean) field.value; break; } - Minecraft.getMinecraft() - .getSoundHandler() + Minecraft.getMinecraft().getSoundHandler() .playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); ItemStack stack = gui.player.inventory.getStackInSlot(field.slot); if (stack != null && stack.getItem() instanceof IConfigurableItem) { DataUtills.writeObjectToCompound( - IConfigurableItem.ProfileHelper.getProfileCompound(stack), field.value, field.datatype, field.name); + IConfigurableItem.ProfileHelper.getProfileCompound(stack), + field.value, + field.datatype, + field.name); } field.sendChanges(); } @@ -225,12 +228,22 @@ public class ComponentFieldAdjuster extends ComponentBase { this.drawTexturedModalRect(x, y, 0, 46 + k * 20, xSize / 2, 20 - Math.max(0, 20 - ySize)); this.drawTexturedModalRect( - x + xSize / 2, y, 200 - xSize / 2, 46 + k * 20, xSize / 2, 20 - Math.max(0, 20 - ySize)); + x + xSize / 2, + y, + 200 - xSize / 2, + 46 + k * 20, + xSize / 2, + 20 - Math.max(0, 20 - ySize)); if (ySize < 20) { this.drawTexturedModalRect(x, y + 3, 0, (46 + k * 20) + 20 - ySize + 3, xSize - 1, ySize - 3); this.drawTexturedModalRect( - x + xSize / 2, y + 3, 200 - xSize / 2, (46 + k * 20) + 20 - ySize + 3, xSize / 2, ySize - 3); + x + xSize / 2, + y + 3, + 200 - xSize / 2, + (46 + k * 20) + 20 - ySize + 3, + xSize / 2, + ySize - 3); } } @@ -239,8 +252,7 @@ public class ComponentFieldAdjuster extends ComponentBase { } private boolean isNonDecimal() { - return field.datatype == References.INT_ID - || field.datatype == References.SHORT_ID + return field.datatype == References.INT_ID || field.datatype == References.SHORT_ID || field.datatype == References.BYTE_ID; } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentFieldButton.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentFieldButton.java index 21ab4c0f..327bc8ae 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentFieldButton.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentFieldButton.java @@ -1,26 +1,28 @@ package com.brandon3055.draconicevolution.client.gui.guicomponents; +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; + import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentBase; import com.brandon3055.brandonscore.common.utills.DataUtills; import com.brandon3055.draconicevolution.client.gui.componentguis.GUIToolConfig; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; -import java.util.ArrayList; -import java.util.List; -import net.minecraft.client.Minecraft; -import net.minecraft.client.audio.PositionedSoundRecord; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; /** * Created by Brandon on 31/12/2014. */ public class ComponentFieldButton extends ComponentBase { - private static final ResourceLocation widgets = - new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/Widgets.png"); + private static final ResourceLocation widgets = new ResourceLocation( + References.RESOURCESPREFIX + "textures/gui/Widgets.png"); public EntityPlayer player; public int slot; @@ -87,8 +89,7 @@ public class ComponentFieldButton extends ComponentBase { @Override public void mouseClicked(int x, int y, int button) { - Minecraft.getMinecraft() - .getSoundHandler() + Minecraft.getMinecraft().getSoundHandler() .playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); if (field.datatype == References.BOOLEAN_ID) { field.value = !(Boolean) field.value; diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentIndexButton.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentIndexButton.java index 8afeacbd..a23a9d81 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentIndexButton.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentIndexButton.java @@ -1,14 +1,16 @@ package com.brandon3055.draconicevolution.client.gui.guicomponents; +import net.minecraft.client.Minecraft; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; + +import org.lwjgl.opengl.GL11; + import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentScrollingBase; import com.brandon3055.brandonscore.client.gui.guicomponents.GUIScrollingBase; import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.client.gui.componentguis.ManualPage; import com.brandon3055.draconicevolution.client.handler.ResourceHandler; -import net.minecraft.client.Minecraft; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import org.lwjgl.opengl.GL11; /** * Created by Brandon on 7/03/2015. diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentManualPage.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentManualPage.java index 9d4c49e8..756924f4 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentManualPage.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/guicomponents/ComponentManualPage.java @@ -1,5 +1,22 @@ package com.brandon3055.draconicevolution.client.gui.guicomponents; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.*; +import net.minecraftforge.oredict.OreDictionary; +import net.minecraftforge.oredict.ShapedOreRecipe; +import net.minecraftforge.oredict.ShapelessOreRecipe; + +import org.apache.commons.io.FilenameUtils; +import org.lwjgl.opengl.GL11; + import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentScrollingBase; import com.brandon3055.brandonscore.client.gui.guicomponents.GUIScrollingBase; import com.brandon3055.brandonscore.client.utills.GuiHelper; @@ -8,25 +25,12 @@ import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.client.gui.componentguis.ManualPage; import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.client.utill.CustomResourceLocation; -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.*; -import net.minecraftforge.oredict.OreDictionary; -import net.minecraftforge.oredict.ShapedOreRecipe; -import net.minecraftforge.oredict.ShapelessOreRecipe; -import org.apache.commons.io.FilenameUtils; -import org.lwjgl.opengl.GL11; /** * Created by Brandon on 19/03/2015. */ public class ComponentManualPage extends ComponentScrollingBase { + public ManualPage page; public List contentList = new ArrayList(); private int pageLength = 0; @@ -56,7 +60,7 @@ public class ComponentManualPage extends ComponentScrollingBase { @Override public void handleScrollInput(int direction) { - // scrollOffset += direction * 10; + // scrollOffset += direction * 10; scrollOffset += direction * (InfoHelper.isShiftKeyDown() ? 30 : 10); if (scrollOffset < 0) scrollOffset = 0; if (scrollOffset > pageLength - getHeight()) scrollOffset = pageLength - getHeight(); @@ -154,8 +158,7 @@ public class ComponentManualPage extends ComponentScrollingBase { if (stack != null) { - for (IRecipe recipe : - (List) CraftingManager.getInstance().getRecipeList()) { + for (IRecipe recipe : (List) CraftingManager.getInstance().getRecipeList()) { if (recipe == null) continue; ItemStack result = recipe.getRecipeOutput(); @@ -167,10 +170,7 @@ public class ComponentManualPage extends ComponentScrollingBase { recipes.add(recipe); } - Iterator iterator = FurnaceRecipes.smelting() - .getSmeltingList() - .entrySet() - .iterator(); + Iterator iterator = FurnaceRecipes.smelting().getSmeltingList().entrySet().iterator(); Map.Entry entry; while (iterator.hasNext()) { @@ -184,10 +184,8 @@ public class ComponentManualPage extends ComponentScrollingBase { } public int getHeight() { - if (type == 1 - && (ResourceHandler.downloadedImages.containsKey(FilenameUtils.getName(content)) - || (slide - && ResourceHandler.downloadedImages.containsKey(FilenameUtils.getName(content))))) { + if (type == 1 && (ResourceHandler.downloadedImages.containsKey(FilenameUtils.getName(content)) + || (slide && ResourceHandler.downloadedImages.containsKey(FilenameUtils.getName(content))))) { CustomResourceLocation texture = slide ? ResourceHandler.downloadedImages.get(FilenameUtils.getName(content)) : ResourceHandler.downloadedImages.get(FilenameUtils.getName(content)); @@ -211,7 +209,11 @@ public class ComponentManualPage extends ComponentScrollingBase { int y = yPos - page.scrollOffset; if (y > 310 || y < 5) return; page.drawCenteredString( - page.fontRendererObj, content.substring(content.indexOf("title.") + 6), 128, y, 0x00ffff); + page.fontRendererObj, + content.substring(content.indexOf("title.") + 6), + 128, + y, + 0x00ffff); if ((page.page.name.contains("tile.") || page.page.name.contains("item.")) && page.stack != null) { ResourceHandler.bindResource("textures/gui/Widgets.png"); @@ -229,8 +231,9 @@ public class ComponentManualPage extends ComponentScrollingBase { } private void renderImage() { - CustomResourceLocation image = - null; // slide ? ResourceHandler.downloadedImages.get(slides.get(page.slideTick % slides.size() - + CustomResourceLocation image = null; // slide ? + // ResourceHandler.downloadedImages.get(slides.get(page.slideTick % + // slides.size() - // 1)) : ResourceHandler.downloadedImages.get(content); if (slide) { int index = (page.slideTick / 20) % (slides.size()); @@ -297,13 +300,13 @@ public class ComponentManualPage extends ComponentScrollingBase { if (y + yDown + posY < 0 || y + yDown + posY > 305) continue; page.drawTexturedModalRect(x + posX, y + yDown + posY, 138, 0, 18, 18); - ItemStack stack = (ItemStack) - (getRecipeInput(recipe).length > i && getRecipeInput(recipe)[i] instanceof ItemStack + ItemStack stack = (ItemStack) (getRecipeInput(recipe).length > i + && getRecipeInput(recipe)[i] instanceof ItemStack ? getRecipeInput(recipe)[i] : getRecipeInput(recipe).length > i - && getRecipeInput(recipe)[i] instanceof ArrayList - ? ((ArrayList) getRecipeInput(recipe)[i]).get(0) - : null); + && getRecipeInput(recipe)[i] instanceof ArrayList + ? ((ArrayList) getRecipeInput(recipe)[i]).get(0) + : null); if (stack != null) { if (stack.getItemDamage() == OreDictionary.WILDCARD_VALUE) stack.setItemDamage(0); @@ -341,13 +344,13 @@ public class ComponentManualPage extends ComponentScrollingBase { int y = i / 3 * 18; if (y + yDown + posY < 0 || y + yDown + posY > 305) continue; - ItemStack stack = (ItemStack) - (getRecipeInput(recipe).length > i && getRecipeInput(recipe)[i] instanceof ItemStack + ItemStack stack = (ItemStack) (getRecipeInput(recipe).length > i + && getRecipeInput(recipe)[i] instanceof ItemStack ? getRecipeInput(recipe)[i] : getRecipeInput(recipe).length > i - && getRecipeInput(recipe)[i] instanceof ArrayList - ? ((ArrayList) getRecipeInput(recipe)[i]).get(0) - : null); + && getRecipeInput(recipe)[i] instanceof ArrayList + ? ((ArrayList) getRecipeInput(recipe)[i]).get(0) + : null); if (stack != null) { if (GuiHelper.isInRect(1 + x + posX, 1 + y + yDown + posY, 18, 18, mouseX, mouseY)) { @@ -403,8 +406,7 @@ public class ComponentManualPage extends ComponentScrollingBase { } private Object[] getRecipeInput(IRecipe recipe) { - if (recipe instanceof ShapelessOreRecipe) - return ((ShapelessOreRecipe) recipe).getInput().toArray(); + if (recipe instanceof ShapelessOreRecipe) return ((ShapelessOreRecipe) recipe).getInput().toArray(); else if (recipe instanceof ShapedOreRecipe) return getShapedOreRecipe((ShapedOreRecipe) recipe); else if (recipe instanceof ShapedRecipes) return ((ShapedRecipes) recipe).recipeItems; else if (recipe instanceof ShapelessRecipes) diff --git a/src/main/java/com/brandon3055/draconicevolution/client/handler/ClientEventHandler.java b/src/main/java/com/brandon3055/draconicevolution/client/handler/ClientEventHandler.java index 8b02a6f2..434543f4 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/handler/ClientEventHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/handler/ClientEventHandler.java @@ -1,5 +1,25 @@ package com.brandon3055.draconicevolution.client.handler; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Random; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.ModelBiped; +import net.minecraft.entity.Entity; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.attributes.IAttributeInstance; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemArmor; +import net.minecraftforge.client.event.FOVUpdateEvent; +import net.minecraftforge.client.event.RenderGameOverlayEvent; +import net.minecraftforge.client.event.RenderPlayerEvent; +import net.minecraftforge.client.model.AdvancedModelLoader; +import net.minecraftforge.client.model.IModelCustom; + +import org.lwjgl.opengl.GL11; + import com.brandon3055.brandonscore.common.utills.DataUtills.XZPair; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModItems; @@ -13,35 +33,19 @@ import com.brandon3055.draconicevolution.common.items.weapons.DraconicBow; import com.brandon3055.draconicevolution.common.items.weapons.WyvernBow; import com.brandon3055.draconicevolution.common.network.MountUpdatePacket; import com.brandon3055.draconicevolution.common.utills.LogHelper; + import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Random; -import net.minecraft.client.Minecraft; -import net.minecraft.client.model.ModelBiped; -import net.minecraft.entity.Entity; -import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.ai.attributes.IAttributeInstance; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemArmor; -import net.minecraftforge.client.event.FOVUpdateEvent; -import net.minecraftforge.client.event.RenderGameOverlayEvent; -import net.minecraftforge.client.event.RenderPlayerEvent; -import net.minecraftforge.client.model.AdvancedModelLoader; -import net.minecraftforge.client.model.IModelCustom; -import org.lwjgl.opengl.GL11; /** * Created by Brandon on 28/10/2014. */ public class ClientEventHandler { - public static Map> playerShieldStatus = - new HashMap>(); + + public static Map> playerShieldStatus = new HashMap>(); public static int elapsedTicks; private static float previousFOB = 0f; @@ -68,9 +72,8 @@ public class ClientEventHandler { if (event.phase != TickEvent.Phase.START || event.type != TickEvent.Type.CLIENT || event.side != Side.CLIENT) return; - for (Iterator>> i = - playerShieldStatus.entrySet().iterator(); - i.hasNext(); ) { + for (Iterator>> i = playerShieldStatus.entrySet().iterator(); i + .hasNext();) { Map.Entry> entry = i.next(); if (elapsedTicks - entry.getValue().getValue() > 5) i.remove(); } @@ -122,17 +125,18 @@ public class ClientEventHandler { || event.entity.getHeldItem().getItem() instanceof DraconicBow) && Minecraft.getMinecraft().gameSettings.keyBindUseItem.getIsKeyPressed()) { - BowHandler.BowProperties properties = - new BowHandler.BowProperties(event.entity.getHeldItem(), event.entity); + BowHandler.BowProperties properties = new BowHandler.BowProperties( + event.entity.getHeldItem(), + event.entity); event.newfov = ((6 - properties.zoomModifier) / 6) * event.fov; - // if (ItemNBTHelper.getString(event.entity.getItemInUse(), "mode", "").equals("sharpshooter")){ - // if (event.entity.getItemInUse().getItem() instanceof WyvernBow) zMax = 1.35f; - // else if (event.entity.getItemInUse().getItem() instanceof DraconicBow) zMax = 2.5f; - // bowZoom = true; - // tickSet = elapsedTicks; - // } + // if (ItemNBTHelper.getString(event.entity.getItemInUse(), "mode", "").equals("sharpshooter")){ + // if (event.entity.getItemInUse().getItem() instanceof WyvernBow) zMax = 1.35f; + // else if (event.entity.getItemInUse().getItem() instanceof DraconicBow) zMax = 2.5f; + // bowZoom = true; + // tickSet = elapsedTicks; + // } } // endregion @@ -141,11 +145,10 @@ public class ClientEventHandler { CustomArmorHandler.ArmorSummery summery = new CustomArmorHandler.ArmorSummery().getSummery(event.entity); if (summery != null && summery.speedModifier > 0) { - IAttributeInstance iattributeinstance = - event.entity.getEntityAttribute(SharedMonsterAttributes.movementSpeed); - float f = (float) - ((iattributeinstance.getAttributeValue() / (double) event.entity.capabilities.getWalkSpeed() + 1.0D) - / 2.0D); + IAttributeInstance iattributeinstance = event.entity + .getEntityAttribute(SharedMonsterAttributes.movementSpeed); + float f = (float) ((iattributeinstance.getAttributeValue() + / (double) event.entity.capabilities.getWalkSpeed() + 1.0D) / 2.0D); event.newfov /= f; } @@ -211,8 +214,7 @@ public class ClientEventHandler { EntityPlayer viewingPlayer = Minecraft.getMinecraft().thePlayer; - int i = 5 - - (elapsedTicks - playerShieldStatus.get(event.entityPlayer).getValue()); + int i = 5 - (elapsedTicks - playerShieldStatus.get(event.entityPlayer).getValue()); GL11.glColor4f(1F - p, 0F, p, i / 5F); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/handler/HudHandler.java b/src/main/java/com/brandon3055/draconicevolution/client/handler/HudHandler.java index 312bc7e8..5fe39a2f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/handler/HudHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/handler/HudHandler.java @@ -1,17 +1,8 @@ package com.brandon3055.draconicevolution.client.handler; -import com.brandon3055.brandonscore.client.utills.GuiHelper; -import com.brandon3055.brandonscore.common.utills.Utills; -import com.brandon3055.draconicevolution.client.gui.GuiHudConfig; -import com.brandon3055.draconicevolution.common.handler.ConfigHandler; -import com.brandon3055.draconicevolution.common.items.armor.CustomArmorHandler; -import com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock; -import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.List; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiChat; @@ -20,8 +11,21 @@ import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.StatCollector; import net.minecraftforge.client.event.RenderGameOverlayEvent; + import org.lwjgl.opengl.GL11; +import com.brandon3055.brandonscore.client.utills.GuiHelper; +import com.brandon3055.brandonscore.common.utills.Utills; +import com.brandon3055.draconicevolution.client.gui.GuiHudConfig; +import com.brandon3055.draconicevolution.common.handler.ConfigHandler; +import com.brandon3055.draconicevolution.common.items.armor.CustomArmorHandler; +import com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock; +import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem; + +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 26/01/2015. */ @@ -46,9 +50,9 @@ public class HudHandler { @SideOnly(Side.CLIENT) public void drawHUD(RenderGameOverlayEvent.Post event) { Minecraft mc = Minecraft.getMinecraft(); - if (event.type != RenderGameOverlayEvent.ElementType.ALL - || mc.gameSettings.showDebugInfo - || mc.currentScreen instanceof GuiChat) return; + if (event.type != RenderGameOverlayEvent.ElementType.ALL || mc.gameSettings.showDebugInfo + || mc.currentScreen instanceof GuiChat) + return; ScaledResolution resolution = event.resolution; width = resolution.getScaledWidth(); @@ -112,15 +116,14 @@ public class HudHandler { toolTipFadeOut = 1F; armorStatsFadeOut = 1F; } - } else if (mc.thePlayer.getHeldItem() != null - && mc.thePlayer.getHeldItem().getItem() instanceof IHudDisplayItem) { - hudList = - ((IHudDisplayItem) mc.thePlayer.getHeldItem().getItem()).getDisplayData(mc.thePlayer.getHeldItem()); - } + } else + if (mc.thePlayer.getHeldItem() != null && mc.thePlayer.getHeldItem().getItem() instanceof IHudDisplayItem) { + hudList = ((IHudDisplayItem) mc.thePlayer.getHeldItem().getItem()) + .getDisplayData(mc.thePlayer.getHeldItem()); + } MovingObjectPosition mop = mc.thePlayer.rayTrace(5, 0); - if (mop != null - && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK + if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && mc.theWorld.getBlock(mop.blockX, mop.blockY, mop.blockZ) instanceof IHudDisplayBlock) { hudList = ((IHudDisplayBlock) mc.theWorld.getBlock(mop.blockX, mop.blockY, mop.blockZ)) .getDisplayData(mc.theWorld, mop.blockX, mop.blockY, mop.blockZ); @@ -134,17 +137,17 @@ public class HudHandler { } showShieldHud = armorStatsFadeOut > 0F; - if (maxShieldPoints != summery.maxProtectionPoints - || shieldPoints != summery.protectionPoints + if (maxShieldPoints != summery.maxProtectionPoints || shieldPoints != summery.protectionPoints || shieldEntropy != summery.entropy - || rfTotal != summery.totalEnergyStored) armorStatsFadeOut = 5F; + || rfTotal != summery.totalEnergyStored) + armorStatsFadeOut = 5F; maxShieldPoints = summery.maxProtectionPoints; shieldPoints = summery.protectionPoints; shieldPercentCharge = (int) (summery.protectionPoints / summery.maxProtectionPoints * 100D); shieldEntropy = summery.entropy; - rfCharge = (int) - ((double) summery.totalEnergyStored / Math.max((double) summery.maxTotalEnergyStorage, 1D) * 100D); + rfCharge = (int) ((double) summery.totalEnergyStored / Math.max((double) summery.maxTotalEnergyStorage, 1D) + * 100D); rfTotal = summery.totalEnergyStored; } @@ -192,7 +195,16 @@ public class HudHandler { 0, GuiHelper.PXL128); GuiHelper.drawTexturedRect( - x + 13, y + 2 + 100 - rfCharge, 2, rfCharge, 28, 100 - rfCharge, 2, rfCharge, 0, GuiHelper.PXL128); + x + 13, + y + 2 + 100 - rfCharge, + 2, + rfCharge, + 28, + 100 - rfCharge, + 2, + rfCharge, + 0, + GuiHelper.PXL128); if (ConfigHandler.hudSettings[9] == 1) { FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; @@ -204,12 +216,12 @@ public class HudHandler { String energy = "RF: " + Utills.formatNumber(rfTotal); float fade = Math.min(armorStatsFadeOut, 1F); if (!rotated) { - fontRenderer.drawStringWithShadow( - shield, x + 18, y + 74, ((int) (fade * 240F) + 0x10 << 24) | 0x00FFFFFF); - fontRenderer.drawStringWithShadow( - energy, x + 18, y + 84, ((int) (fade * 240F) + 0x10 << 24) | 0x00FFFFFF); - fontRenderer.drawStringWithShadow( - entropy, x + 18, y + 94, ((int) (fade * 240F) + 0x10 << 24) | 0x00FFFFFF); + fontRenderer + .drawStringWithShadow(shield, x + 18, y + 74, ((int) (fade * 240F) + 0x10 << 24) | 0x00FFFFFF); + fontRenderer + .drawStringWithShadow(energy, x + 18, y + 84, ((int) (fade * 240F) + 0x10 << 24) | 0x00FFFFFF); + fontRenderer + .drawStringWithShadow(entropy, x + 18, y + 94, ((int) (fade * 240F) + 0x10 << 24) | 0x00FFFFFF); } else { fontRenderer.drawString( shield, @@ -221,8 +233,8 @@ public class HudHandler { x - fontRenderer.getStringWidth(entropy), y + 18, ((int) (fade * 240F) + 0x10 << 24) | 0x00FFFFFF); - fontRenderer.drawStringWithShadow( - energy, x - 102, y + 18, ((int) (fade * 240F) + 0x10 << 24) | 0x00FFFFFF); + fontRenderer + .drawStringWithShadow(energy, x - 102, y + 18, ((int) (fade * 240F) + 0x10 << 24) | 0x00FFFFFF); } } @@ -235,42 +247,42 @@ public class HudHandler { } // GL11.glPushMatrix(); -// GL11.glEnable(GL11.GL_ALPHA_TEST); -// ResourceHandler.bindResource("textures/gui/HUD.png"); +// GL11.glEnable(GL11.GL_ALPHA_TEST); +// ResourceHandler.bindResource("textures/gui/HUD.png"); // -// if (rotated){ -// GuiHelper.drawTexturedRect(x-(12*scale), y+scale, (int)(11*scale), (int)(13*scale), 2, 0, 11, 13, 0, +// if (rotated){ +// GuiHelper.drawTexturedRect(x-(12*scale), y+scale, (int)(11*scale), (int)(13*scale), 2, 0, 11, 13, 0, // GuiHelper.PXL128); -// x+=(104*scale); -// GL11.glTranslated(x, y, 0); -// GL11.glRotated(-90, 0, 0, -1); -// GL11.glTranslated(-x, -y, 0); -// } -// else GuiHelper.drawTexturedRect(x+(1*scale), y+(104*scale)+1, (int)(13*scale), (int)(15*scale), 2, 0, 11, 13, 0, +// x+=(104*scale); +// GL11.glTranslated(x, y, 0); +// GL11.glRotated(-90, 0, 0, -1); +// GL11.glTranslated(-x, -y, 0); +// } +// else GuiHelper.drawTexturedRect(x+(1*scale), y+(104*scale)+1, (int)(13*scale), (int)(15*scale), 2, 0, 11, 13, 0, // GuiHelper.PXL128); // -// GuiHelper.drawTexturedRect(x, y, (int)(17*scale), (int)(104*scale), 0, 15, 17, 104, 0, GuiHelper.PXL128); -// GuiHelper.drawTexturedRect(x+(2*scale), y+(2*scale)+(100-shieldPercentCharge), (int)(7*scale), shieldPercentCharge +// GuiHelper.drawTexturedRect(x, y, (int)(17*scale), (int)(104*scale), 0, 15, 17, 104, 0, GuiHelper.PXL128); +// GuiHelper.drawTexturedRect(x+(2*scale), y+(2*scale)+(100-shieldPercentCharge), (int)(7*scale), shieldPercentCharge // *scale, 17, 100-shieldPercentCharge, 7, shieldPercentCharge, 0, GuiHelper.PXL128); -// GuiHelper.drawTexturedRect(x+(10*scale), y+(2+(100-(int)shieldEntropy) * scale), (int)(2*scale), (int)shieldEntropy +// GuiHelper.drawTexturedRect(x+(10*scale), y+(2+(100-(int)shieldEntropy) * scale), (int)(2*scale), (int)shieldEntropy // * scale, 25, 100-(int)shieldEntropy, 2, (int)shieldEntropy, 0, GuiHelper.PXL128); // -// if (ConfigHandler.hudSettings[9] == 1) { -// FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; -// GL11.glTranslated(x, y, 0); -// GL11.glScaled(scale, scale, 1); -// if (rotated) GL11.glRotated(90, 0, 0, -1); -// GL11.glTranslated(-x, -y, 0); -// if (!rotated) { -// fontRenderer.drawStringWithShadow(Math.round(shieldPoints) + "/" + (int)maxShieldPoints, x + 16, y + 84, 0xFFFFFF); -// fontRenderer.drawStringWithShadow((int)shieldEntropy + "%", x + 16, y + 94, 0xFFFFFF); -// }else { -// fontRenderer.drawStringWithShadow(Math.round(shieldPoints) + "/" + (int)maxShieldPoints, x - 102, y + 16, 0xFFFFFF); -// fontRenderer.drawStringWithShadow((int)shieldEntropy + "%", x - fontRenderer.getStringWidth((int)shieldEntropy + +// if (ConfigHandler.hudSettings[9] == 1) { +// FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; +// GL11.glTranslated(x, y, 0); +// GL11.glScaled(scale, scale, 1); +// if (rotated) GL11.glRotated(90, 0, 0, -1); +// GL11.glTranslated(-x, -y, 0); +// if (!rotated) { +// fontRenderer.drawStringWithShadow(Math.round(shieldPoints) + "/" + (int)maxShieldPoints, x + 16, y + 84, 0xFFFFFF); +// fontRenderer.drawStringWithShadow((int)shieldEntropy + "%", x + 16, y + 94, 0xFFFFFF); +// }else { +// fontRenderer.drawStringWithShadow(Math.round(shieldPoints) + "/" + (int)maxShieldPoints, x - 102, y + 16, 0xFFFFFF); +// fontRenderer.drawStringWithShadow((int)shieldEntropy + "%", x - fontRenderer.getStringWidth((int)shieldEntropy + // "%"), y + 16, 0xFFFFFF); -// } -// } +// } +// } // -// ResourceHandler.bindTexture(ResourceHandler.getResourceWOP("minecraft:textures/gui/icons.png")); -// GL11.glDisable(GL11.GL_ALPHA_TEST); -// GL11.glPopMatrix(); +// ResourceHandler.bindTexture(ResourceHandler.getResourceWOP("minecraft:textures/gui/icons.png")); +// GL11.glDisable(GL11.GL_ALPHA_TEST); +// GL11.glPopMatrix(); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/handler/ItemDisplayManager.java b/src/main/java/com/brandon3055/draconicevolution/client/handler/ItemDisplayManager.java index c2c5f1b1..a8b1a78b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/handler/ItemDisplayManager.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/handler/ItemDisplayManager.java @@ -7,6 +7,7 @@ import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.item.ItemStack; + import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; @@ -17,8 +18,7 @@ public final class ItemDisplayManager { private int ticksCounter; private static final RenderItem renderItem = new RenderItem(); private static final FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; - private static final TextureManager textureManager = - Minecraft.getMinecraft().getTextureManager(); + private static final TextureManager textureManager = Minecraft.getMinecraft().getTextureManager(); public ItemDisplayManager(int ticks) { this.ticks = ticks; diff --git a/src/main/java/com/brandon3055/draconicevolution/client/handler/ParticleHandler.java b/src/main/java/com/brandon3055/draconicevolution/client/handler/ParticleHandler.java index 72956077..98e19dc8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/handler/ParticleHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/handler/ParticleHandler.java @@ -1,26 +1,22 @@ package com.brandon3055.draconicevolution.client.handler; -import com.brandon3055.draconicevolution.client.render.particle.ParticleDistortion; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.EntityFX; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.client.render.particle.ParticleDistortion; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + @SideOnly(Side.CLIENT) public class ParticleHandler { + private static Minecraft mc = Minecraft.getMinecraft(); private static World theWorld = mc.theWorld; - public static EntityFX spawnParticle( - String particleName, - double x, - double y, - double z, - double motionX, - double motionY, - double motionZ, - float scale) { + public static EntityFX spawnParticle(String particleName, double x, double y, double z, double motionX, + double motionY, double motionZ, float scale) { if (mc != null && mc.renderViewEntity != null && mc.effectRenderer != null) { int var14 = mc.gameSettings.particleSetting; if (var14 == 1 && theWorld.rand.nextInt(3) == 0) { @@ -38,7 +34,14 @@ public class ParticleHandler { } else { if (particleName.equals("distortionParticle")) { var21 = new ParticleDistortion( - theWorld, x, y, z, (float) motionX, (float) motionY, (float) motionZ, scale); + theWorld, + x, + y, + z, + (float) motionX, + (float) motionY, + (float) motionZ, + scale); } mc.effectRenderer.addEffect(var21); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/handler/ResourceHandler.java b/src/main/java/com/brandon3055/draconicevolution/client/handler/ResourceHandler.java index 4f96d9a8..193968cc 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/handler/ResourceHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/handler/ResourceHandler.java @@ -1,37 +1,43 @@ package com.brandon3055.draconicevolution.client.handler; +import java.awt.image.BufferedImage; +import java.io.*; +import java.lang.reflect.Field; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.*; + +import javax.imageio.ImageIO; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.particle.EffectRenderer; +import net.minecraft.client.resources.FolderResourcePack; +import net.minecraft.util.ResourceLocation; + +import org.apache.commons.io.FilenameUtils; + import com.brandon3055.draconicevolution.client.gui.componentguis.GUIManual; import com.brandon3055.draconicevolution.client.utill.CustomResourceLocation; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.utills.LogHelper; import com.google.common.io.ByteStreams; import com.google.gson.stream.JsonWriter; + import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.relauncher.ReflectionHelper; -import java.awt.image.BufferedImage; -import java.io.*; -import java.lang.reflect.Field; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.*; -import javax.imageio.ImageIO; -import net.minecraft.client.Minecraft; -import net.minecraft.client.particle.EffectRenderer; -import net.minecraft.client.resources.FolderResourcePack; -import net.minecraft.util.ResourceLocation; -import org.apache.commons.io.FilenameUtils; /** * Created by Brandon on 8/02/2015. */ public class ResourceHandler { + public static ResourceHandler instance = new ResourceHandler(); private static ResourceLocation defaultParticles; - private static ResourceLocation particles = - new ResourceLocation(References.RESOURCESPREFIX + "textures/particle/particles.png"); + private static ResourceLocation particles = new ResourceLocation( + References.RESOURCESPREFIX + "textures/particle/particles.png"); private static Map cachedResources = new HashMap(); public static Map downloadedImages = new HashMap(); @@ -57,9 +63,8 @@ public class ResourceHandler { public static void init(FMLPreInitializationEvent event) { FMLCommonHandler.instance().bus().register(instance); - if (event != null) - savePath = event.getModConfigurationDirectory().getParentFile().getAbsolutePath() - + "/config/draconicevolution"; + if (event != null) savePath = event.getModConfigurationDirectory().getParentFile().getAbsolutePath() + + "/config/draconicevolution"; GUIManual.loadPages(); downloadThread = new DownloadThread(GUIManual.imageURLs); @@ -67,6 +72,7 @@ public class ResourceHandler { } public static class DownloadThread extends Thread { + private List imageURLs; private boolean isFinished = false; private boolean wasSuccessful = true; @@ -90,7 +96,9 @@ public class ResourceHandler { downloadedImages.put( FilenameUtils.getName(fileName), new CustomResourceLocation( - FilenameUtils.getName(fileName), bi.getWidth(), bi.getHeight())); + FilenameUtils.getName(fileName), + bi.getWidth(), + bi.getHeight())); } catch (MalformedURLException e) { LogHelper.error("Image Read Failed"); e.printStackTrace(); @@ -219,10 +227,9 @@ public class ResourceHandler { public static void bindDefaultParticles() { if (defaultParticles == null) { try { - defaultParticles = (ResourceLocation) ReflectionHelper.getPrivateValue( - EffectRenderer.class, null, "particleTextures", "field_110737_b"); - } catch (Exception e) { - } + defaultParticles = (ResourceLocation) ReflectionHelper + .getPrivateValue(EffectRenderer.class, null, "particleTextures", "field_110737_b"); + } catch (Exception e) {} } if (defaultParticles != null) bindTexture(defaultParticles); } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/keybinding/KeyBindings.java b/src/main/java/com/brandon3055/draconicevolution/client/keybinding/KeyBindings.java index 920e597f..4d4902f5 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/keybinding/KeyBindings.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/keybinding/KeyBindings.java @@ -1,11 +1,14 @@ package com.brandon3055.draconicevolution.client.keybinding; +import net.minecraft.client.settings.KeyBinding; + +import org.lwjgl.input.Keyboard; + import com.brandon3055.draconicevolution.common.lib.References; + import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.settings.KeyBinding; -import org.lwjgl.input.Keyboard; /** * Created by Brandon on 14/08/2014. diff --git a/src/main/java/com/brandon3055/draconicevolution/client/keybinding/KeyInputHandler.java b/src/main/java/com/brandon3055/draconicevolution/client/keybinding/KeyInputHandler.java index 04443e6d..9d459c97 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/keybinding/KeyInputHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/keybinding/KeyInputHandler.java @@ -1,5 +1,14 @@ package com.brandon3055.draconicevolution.client.keybinding; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityClientPlayerMP; +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MovingObjectPosition; + +import org.lwjgl.input.Mouse; + import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModItems; @@ -9,17 +18,11 @@ import com.brandon3055.draconicevolution.common.network.MagnetTogglePacket; import com.brandon3055.draconicevolution.common.network.PlacedItemPacket; import com.brandon3055.draconicevolution.common.network.TeleporterPacket; import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; + import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.InputEvent; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityClientPlayerMP; -import net.minecraft.client.multiplayer.WorldClient; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.MovingObjectPosition; -import org.lwjgl.input.Mouse; /** * Created by Brandon on 14/08/2014. @@ -33,39 +36,39 @@ public class KeyInputHandler { handlePlaceItemKey(); } else if (KeyBindings.toolConfig.isPressed()) { DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOLCONFIG, false)); - } else if (KeyBindings.toolProfileChange.isPressed() - && Minecraft.getMinecraft().thePlayer != null + } else if (KeyBindings.toolProfileChange.isPressed() && Minecraft.getMinecraft().thePlayer != null && Minecraft.getMinecraft().thePlayer.getItemInUse() == null) { - DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOL_PROFILE_CHANGE, false)); + DraconicEvolution.network + .sendToServer(new ButtonPacket(ButtonPacket.ID_TOOL_PROFILE_CHANGE, false)); - ItemStack stack = Minecraft.getMinecraft().thePlayer.getHeldItem(); - if (stack != null - && stack.getItem() instanceof IConfigurableItem - && ((IConfigurableItem) stack.getItem()).hasProfiles()) { - int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0); - if (++preset >= 5) preset = 0; - ItemNBTHelper.setInteger(stack, "ConfigProfile", preset); - } - } else if (KeyBindings.toggleFlight.isPressed()) { - EntityPlayer player = Minecraft.getMinecraft().thePlayer; - if (player.capabilities.allowFlying) { - if (player.capabilities.isFlying) { - player.capabilities.isFlying = false; - } else { - player.capabilities.isFlying = true; - if (player.onGround) { - player.setPosition(player.posX, player.posY + 0.05D, player.posZ); - player.motionY = 0; + ItemStack stack = Minecraft.getMinecraft().thePlayer.getHeldItem(); + if (stack != null && stack.getItem() instanceof IConfigurableItem + && ((IConfigurableItem) stack.getItem()).hasProfiles()) { + int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0); + if (++preset >= 5) preset = 0; + ItemNBTHelper.setInteger(stack, "ConfigProfile", preset); } + } else + if (KeyBindings.toggleFlight.isPressed()) { + EntityPlayer player = Minecraft.getMinecraft().thePlayer; + if (player.capabilities.allowFlying) { + if (player.capabilities.isFlying) { + player.capabilities.isFlying = false; + } else { + player.capabilities.isFlying = true; + if (player.onGround) { + player.setPosition(player.posX, player.posY + 0.05D, player.posZ); + player.motionY = 0; + } + } + player.sendPlayerAbilities(); + } + } else if (KeyBindings.toggleMagnet.isPressed()) { + EntityPlayer player = Minecraft.getMinecraft().thePlayer; + if (player.inventory.hasItem(ModItems.magnet)) { + DraconicEvolution.network.sendToServer(new MagnetTogglePacket()); } - player.sendPlayerAbilities(); } - } else if (KeyBindings.toggleMagnet.isPressed()) { - EntityPlayer player = Minecraft.getMinecraft().thePlayer; - if (player.inventory.hasItem(ModItems.magnet)) { - DraconicEvolution.network.sendToServer(new MagnetTogglePacket()); - } - } } private void handlePlaceItemKey() { @@ -73,8 +76,8 @@ public class KeyInputHandler { WorldClient world = Minecraft.getMinecraft().theWorld; MovingObjectPosition mop = ToolHandler.raytraceFromEntity(world, player, 4.5D); if (mop != null) { - DraconicEvolution.network.sendToServer( - new PlacedItemPacket((byte) mop.sideHit, mop.blockX, mop.blockY, mop.blockZ)); + DraconicEvolution.network + .sendToServer(new PlacedItemPacket((byte) mop.sideHit, mop.blockX, mop.blockY, mop.blockZ)); } } @@ -89,8 +92,7 @@ public class KeyInputHandler { DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOL_PROFILE_CHANGE, false)); ItemStack stack = Minecraft.getMinecraft().thePlayer.getHeldItem(); - if (stack != null - && stack.getItem() instanceof IConfigurableItem + if (stack != null && stack.getItem() instanceof IConfigurableItem && ((IConfigurableItem) stack.getItem()).hasProfiles()) { int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0); if (++preset >= 5) preset = 0; diff --git a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelChaosCrystal.java b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelChaosCrystal.java index a2ad23a9..e0649888 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelChaosCrystal.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelChaosCrystal.java @@ -3,13 +3,14 @@ package com.brandon3055.draconicevolution.client.model; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; + import org.lwjgl.opengl.GL11; /** - * ModelChaosCrystal - Mojang-(Original) modified by brandon3055 - * Created using Tabula 5.0.0 + * ModelChaosCrystal - Mojang-(Original) modified by brandon3055 Created using Tabula 5.0.0 */ public class ModelChaosCrystal extends ModelBase { + public ModelRenderer base; public ModelRenderer glass; public ModelRenderer cube; diff --git a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelDraconicArmor.java b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelDraconicArmor.java index 08035f9f..3150ab74 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelDraconicArmor.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelDraconicArmor.java @@ -1,10 +1,11 @@ package com.brandon3055.draconicevolution.client.model; -import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; +import com.brandon3055.draconicevolution.client.handler.ResourceHandler; + public class ModelDraconicArmor extends ModelBiped { public ModelRenderOBJ head; @@ -182,14 +183,8 @@ public class ModelDraconicArmor extends ModelBiped { this.bipedLeftLeg.render(1F / 16F); } - public void setRotationAngles( - float p_78087_1_, - float p_78087_2_, - float p_78087_3_, - float p_78087_4_, - float p_78087_5_, - float p_78087_6_, - Entity p_78087_7_) { + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, + float p_78087_5_, float p_78087_6_, Entity p_78087_7_) { this.bipedRightArm.rotateAngleZ = 0.0F; this.bipedLeftArm.rotateAngleZ = 0.0F; this.bipedRightArm.rotationPointZ = 0.0F; diff --git a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelDraconicArmorOld.java b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelDraconicArmorOld.java index b3f4218e..7d6ffc0c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelDraconicArmorOld.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelDraconicArmorOld.java @@ -5,16 +5,16 @@ import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; /** - * Draconic Armor.tcn - TechneToTabulaImporter - * Created using Tabula 5.0.0 + * Draconic Armor.tcn - TechneToTabulaImporter Created using Tabula 5.0.0 */ public class ModelDraconicArmorOld extends ModelBiped { // - // public ModelRenderer bipedHead; - // public ModelRenderer bipedBody; - // public ModelRenderer bipedRightArm; - // public ModelRenderer bipedLeftArm; - // public ModelRenderer bipedRightLeg;/ - // public ModelRenderer bipedLeftLeg; + // public ModelRenderer bipedHead; + // public ModelRenderer bipedBody; + // public ModelRenderer bipedRightArm; + // public ModelRenderer bipedLeftArm; + // public ModelRenderer bipedRightLeg;/ + // public ModelRenderer bipedLeftLeg; + public ModelRenderer MainHelmPieceRight1; public ModelRenderer MainHelmPieceRight2; public ModelRenderer MainHelmPieceLeft1; @@ -108,8 +108,8 @@ public class ModelDraconicArmorOld extends ModelBiped { // private boolean isDraconic; - public ModelDraconicArmorOld( - float f, boolean isHelmet, boolean isChestPiece, boolean isLeggings, boolean isdBoots, boolean isDraconic) { + public ModelDraconicArmorOld(float f, boolean isHelmet, boolean isChestPiece, boolean isLeggings, boolean isdBoots, + boolean isDraconic) { super(f, 0.0f, 128, 128); this.textureWidth = 256; this.textureHeight = 128; @@ -271,7 +271,10 @@ public class ModelDraconicArmorOld extends ModelBiped { // this.DrChestDecorationPiece1.setRotationPoint(0.0F, -0.5F, -4.0F); this.DrChestDecorationPiece1.addBox(0.0F, 0.0F, -0.5F, 5, 5, 1, 0.0F); this.setRotateAngle( - DrChestDecorationPiece1, 0.1426609064282019F, -0.13533507716461618F, 0.7946695004338321F); + DrChestDecorationPiece1, + 0.1426609064282019F, + -0.13533507716461618F, + 0.7946695004338321F); this.ChestDecorationPiece2 = new ModelRenderer(this, 229, 38); this.ChestDecorationPiece2.setRotationPoint(-3.0F, 7.0F, -3.0F); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelReactorEnergyInjector.java b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelReactorEnergyInjector.java index 0ae709f0..3b952c9e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelReactorEnergyInjector.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelReactorEnergyInjector.java @@ -4,13 +4,14 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.entity.Entity; + import org.lwjgl.opengl.GL11; /** - * ModelReactorPowerInjector - brandon3055 - * Created using Tabula 5.0.0 + * ModelReactorPowerInjector - brandon3055 Created using Tabula 5.0.0 */ public class ModelReactorEnergyInjector extends ModelBase { + public ModelRenderer BasePlate; public ModelRenderer shape14; public ModelRenderer coreSupports; @@ -167,7 +168,9 @@ public class ModelReactorEnergyInjector extends ModelBase { float colour = Math.min(2F, (brightness * 2F) + 0.5F); if (brightness > 0F) GL11.glDisable(GL11.GL_LIGHTING); OpenGlHelper.setLightmapTextureCoords( - OpenGlHelper.lightmapTexUnit, Math.min(200F, lastBrightnessX + b), Math.min(200F, lastBrightnessY + b)); + OpenGlHelper.lightmapTexUnit, + Math.min(200F, lastBrightnessX + b), + Math.min(200F, lastBrightnessY + b)); GL11.glColor4f(colour, colour, colour, 1F); this.element1.render(f5); GL11.glColor4f(1F, 1F, 1F, 1F); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelReactorStabilizerCore.java b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelReactorStabilizerCore.java index 7b682dec..b66cda7b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelReactorStabilizerCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelReactorStabilizerCore.java @@ -4,13 +4,14 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.entity.Entity; + import org.lwjgl.opengl.GL11; /** - * ReactorStabilizerCore - brandon3055 - * Created using Tabula 5.0.0 + * ReactorStabilizerCore - brandon3055 Created using Tabula 5.0.0 */ public class ModelReactorStabilizerCore extends ModelBase { + public ModelRenderer hub1; public ModelRenderer hub2; public ModelRenderer rotor1R; @@ -270,7 +271,9 @@ public class ModelReactorStabilizerCore extends ModelBase { if (brightness > 0F) GL11.glDisable(GL11.GL_LIGHTING); OpenGlHelper.setLightmapTextureCoords( - OpenGlHelper.lightmapTexUnit, Math.min(200F, lastBrightnessX + b), Math.min(200F, lastBrightnessY + b)); + OpenGlHelper.lightmapTexUnit, + Math.min(200F, lastBrightnessX + b), + Math.min(200F, lastBrightnessY + b)); GL11.glColor4f(colour, colour, colour, 1F); this.rotor2R.render(f5); GL11.glRotatef(rotation * 2F, 0F, 0F, 1F); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelReactorStabilizerRing.java b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelReactorStabilizerRing.java index fd2c110f..8d2f1127 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelReactorStabilizerRing.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelReactorStabilizerRing.java @@ -4,13 +4,14 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.entity.Entity; + import org.lwjgl.opengl.GL11; /** - * EnergyStabilizer - brandon3055 - * Created using Tabula 5.0.0 + * EnergyStabilizer - brandon3055 Created using Tabula 5.0.0 */ public class ModelReactorStabilizerRing extends ModelBase { + public ModelRenderer ringElement1; public ModelRenderer ringElement2; public ModelRenderer ringElement3; @@ -114,8 +115,8 @@ public class ModelReactorStabilizerRing extends ModelBase { } @Override - public void render( - Entity entity, float embitterRotation, float brightness, float f2, float f3, float f4, float scale) { + public void render(Entity entity, float embitterRotation, float brightness, float f2, float f3, float f4, + float scale) { this.ringElement1.render(scale); this.ringElement2.render(scale); @@ -187,9 +188,9 @@ public class ModelReactorStabilizerRing extends ModelBase { this.hing4.render(scale); GL11.glPopMatrix(); - // float lastBrightnessX = OpenGlHelper.lastBrightnessX; - // float lastBrightnessY = OpenGlHelper.lastBrightnessY; - // OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 200F, 200F); + // float lastBrightnessX = OpenGlHelper.lastBrightnessX; + // float lastBrightnessY = OpenGlHelper.lastBrightnessY; + // OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 200F, 200F); float lastBrightnessX = OpenGlHelper.lastBrightnessX; float lastBrightnessY = OpenGlHelper.lastBrightnessY; @@ -197,7 +198,9 @@ public class ModelReactorStabilizerRing extends ModelBase { float colour = Math.min(2F, (brightness * 2F) + 0.1F); OpenGlHelper.setLightmapTextureCoords( - OpenGlHelper.lightmapTexUnit, Math.min(200F, lastBrightnessX + b), Math.min(200F, lastBrightnessY + b)); + OpenGlHelper.lightmapTexUnit, + Math.min(200F, lastBrightnessX + b), + Math.min(200F, lastBrightnessY + b)); GL11.glColor4f(colour, colour, colour, 1F); if (brightness > 0F) GL11.glDisable(GL11.GL_LIGHTING); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelRenderOBJ.java b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelRenderOBJ.java index 1abd6feb..54428458 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelRenderOBJ.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelRenderOBJ.java @@ -1,18 +1,21 @@ package com.brandon3055.draconicevolution.client.model; -import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.renderer.GLAllocation; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; + import org.lwjgl.opengl.GL11; +import com.brandon3055.draconicevolution.client.handler.ResourceHandler; + /** * Created by brandon3055 on 16/9/2015. */ public class ModelRenderOBJ extends ModelRenderer { + private IModelCustom model; private ResourceLocation texture; private int displayList; @@ -39,15 +42,21 @@ public class ModelRenderOBJ extends ModelRenderer { GL11.glCallList(this.displayList); } else { GL11.glTranslatef( - this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); + this.rotationPointX * scale, + this.rotationPointY * scale, + this.rotationPointZ * scale); GL11.glCallList(this.displayList); GL11.glTranslatef( - -this.rotationPointX * scale, -this.rotationPointY * scale, -this.rotationPointZ * scale); + -this.rotationPointX * scale, + -this.rotationPointY * scale, + -this.rotationPointZ * scale); } } else { GL11.glPushMatrix(); GL11.glTranslatef( - this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); + this.rotationPointX * scale, + this.rotationPointY * scale, + this.rotationPointZ * scale); if (this.rotateAngleZ != 0.0F) { GL11.glRotatef(this.rotateAngleZ * 57.295776F, 0.0F, 0.0F, 1.0F); } @@ -115,18 +124,22 @@ public class ModelRenderOBJ extends ModelRenderer { @Override public void postRender(float scale) { if (!this.isHidden && this.showModel) { - // if(!this.compiled) { - // this.compileDisplayList(scale); - // } + // if(!this.compiled) { + // this.compileDisplayList(scale); + // } if (this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F) { if (this.rotationPointX != 0.0F || this.rotationPointY != 0.0F || this.rotationPointZ != 0.0F) { GL11.glTranslatef( - this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); + this.rotationPointX * scale, + this.rotationPointY * scale, + this.rotationPointZ * scale); } } else { GL11.glTranslatef( - this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); + this.rotationPointX * scale, + this.rotationPointY * scale, + this.rotationPointZ * scale); if (this.rotateAngleZ != 0.0F) { GL11.glRotatef(this.rotateAngleZ * 57.295776F, 0.0F, 0.0F, 1.0F); } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelWyvernArmor.java b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelWyvernArmor.java index 4a63ceec..afbf05c5 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelWyvernArmor.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelWyvernArmor.java @@ -1,10 +1,11 @@ package com.brandon3055.draconicevolution.client.model; -import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; +import com.brandon3055.draconicevolution.client.handler.ResourceHandler; + public class ModelWyvernArmor extends ModelBiped { public ModelRenderOBJ head; @@ -179,14 +180,8 @@ public class ModelWyvernArmor extends ModelBiped { this.bipedLeftLeg.render(1F / 16F); } - public void setRotationAngles( - float p_78087_1_, - float p_78087_2_, - float p_78087_3_, - float p_78087_4_, - float p_78087_5_, - float scale, - Entity p_78087_7_) { + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, + float p_78087_5_, float scale, Entity p_78087_7_) { this.bipedRightArm.rotateAngleZ = 0.0F; this.bipedLeftArm.rotateAngleZ = 0.0F; this.bipedRightArm.rotationPointZ = 0.0F; diff --git a/src/main/java/com/brandon3055/draconicevolution/client/model/special/ModelContributorWings.java b/src/main/java/com/brandon3055/draconicevolution/client/model/special/ModelContributorWings.java index 32dbdebe..2c1a3258 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/model/special/ModelContributorWings.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/model/special/ModelContributorWings.java @@ -1,16 +1,18 @@ package com.brandon3055.draconicevolution.client.model.special; -import com.brandon3055.draconicevolution.client.handler.ClientEventHandler; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; + import org.lwjgl.opengl.GL11; +import com.brandon3055.draconicevolution.client.handler.ClientEventHandler; + /** - * DragonWings - brandon3055 - * Created using Tabula 5.0.0 + * DragonWings - brandon3055 Created using Tabula 5.0.0 */ public class ModelContributorWings extends ModelBase { + public ModelRenderer rightBaseStem; public ModelRenderer leftBaseStem; public ModelRenderer rightOuterStem; diff --git a/src/main/java/com/brandon3055/draconicevolution/client/model/special/ModelStaffOfTheGreatOne.java b/src/main/java/com/brandon3055/draconicevolution/client/model/special/ModelStaffOfTheGreatOne.java index ec3f5111..cad821d9 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/model/special/ModelStaffOfTheGreatOne.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/model/special/ModelStaffOfTheGreatOne.java @@ -3,14 +3,15 @@ package com.brandon3055.draconicevolution.client.model.special; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; + import org.lwjgl.opengl.GL11; /** - * Staff of the Great One - brandon3055 - * Created using Tabula 5.0.0 + * Staff of the Great One - brandon3055 Created using Tabula 5.0.0 */ public class ModelStaffOfTheGreatOne extends ModelBase { - public double[] modelScale = new double[] {2.0D, 2.0D, 2.0D}; + + public double[] modelScale = new double[] { 2.0D, 2.0D, 2.0D }; public ModelRenderer staff; public ModelRenderer edge1; public ModelRenderer edge1_1; @@ -337,11 +338,15 @@ public class ModelStaffOfTheGreatOne extends ModelBase { GL11.glPushMatrix(); GL11.glTranslated(this.edge1.offsetX, this.edge1.offsetY, this.edge1.offsetZ); GL11.glTranslated( - this.edge1.rotationPointX * f5, this.edge1.rotationPointY * f5, this.edge1.rotationPointZ * f5); + this.edge1.rotationPointX * f5, + this.edge1.rotationPointY * f5, + this.edge1.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge1.offsetX, -this.edge1.offsetY, -this.edge1.offsetZ); GL11.glTranslated( - -this.edge1.rotationPointX * f5, -this.edge1.rotationPointY * f5, -this.edge1.rotationPointZ * f5); + -this.edge1.rotationPointX * f5, + -this.edge1.rotationPointY * f5, + -this.edge1.rotationPointZ * f5); this.edge1.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); @@ -361,7 +366,9 @@ public class ModelStaffOfTheGreatOne extends ModelBase { GL11.glPushMatrix(); GL11.glTranslated(this.edge2_1.offsetX, this.edge2_1.offsetY, this.edge2_1.offsetZ); GL11.glTranslated( - this.edge2_1.rotationPointX * f5, this.edge2_1.rotationPointY * f5, this.edge2_1.rotationPointZ * f5); + this.edge2_1.rotationPointX * f5, + this.edge2_1.rotationPointY * f5, + this.edge2_1.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge2_1.offsetX, -this.edge2_1.offsetY, -this.edge2_1.offsetZ); GL11.glTranslated( @@ -401,21 +408,29 @@ public class ModelStaffOfTheGreatOne extends ModelBase { GL11.glPushMatrix(); GL11.glTranslated(this.tope2.offsetX, this.tope2.offsetY, this.tope2.offsetZ); GL11.glTranslated( - this.tope2.rotationPointX * f5, this.tope2.rotationPointY * f5, this.tope2.rotationPointZ * f5); + this.tope2.rotationPointX * f5, + this.tope2.rotationPointY * f5, + this.tope2.rotationPointZ * f5); GL11.glScaled(0.9D, 0.5D, 0.9D); GL11.glTranslated(-this.tope2.offsetX, -this.tope2.offsetY, -this.tope2.offsetZ); GL11.glTranslated( - -this.tope2.rotationPointX * f5, -this.tope2.rotationPointY * f5, -this.tope2.rotationPointZ * f5); + -this.tope2.rotationPointX * f5, + -this.tope2.rotationPointY * f5, + -this.tope2.rotationPointZ * f5); this.tope2.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.tope1.offsetX, this.tope1.offsetY, this.tope1.offsetZ); GL11.glTranslated( - this.tope1.rotationPointX * f5, this.tope1.rotationPointY * f5, this.tope1.rotationPointZ * f5); + this.tope1.rotationPointX * f5, + this.tope1.rotationPointY * f5, + this.tope1.rotationPointZ * f5); GL11.glScaled(1.2D, 0.5D, 1.2D); GL11.glTranslated(-this.tope1.offsetX, -this.tope1.offsetY, -this.tope1.offsetZ); GL11.glTranslated( - -this.tope1.rotationPointX * f5, -this.tope1.rotationPointY * f5, -this.tope1.rotationPointZ * f5); + -this.tope1.rotationPointX * f5, + -this.tope1.rotationPointY * f5, + -this.tope1.rotationPointZ * f5); this.tope1.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); @@ -435,11 +450,15 @@ public class ModelStaffOfTheGreatOne extends ModelBase { GL11.glPushMatrix(); GL11.glTranslated(this.shape4.offsetX, this.shape4.offsetY, this.shape4.offsetZ); GL11.glTranslated( - this.shape4.rotationPointX * f5, this.shape4.rotationPointY * f5, this.shape4.rotationPointZ * f5); + this.shape4.rotationPointX * f5, + this.shape4.rotationPointY * f5, + this.shape4.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape4.offsetX, -this.shape4.offsetY, -this.shape4.offsetZ); GL11.glTranslated( - -this.shape4.rotationPointX * f5, -this.shape4.rotationPointY * f5, -this.shape4.rotationPointZ * f5); + -this.shape4.rotationPointX * f5, + -this.shape4.rotationPointY * f5, + -this.shape4.rotationPointZ * f5); this.shape4.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); @@ -529,11 +548,15 @@ public class ModelStaffOfTheGreatOne extends ModelBase { GL11.glPushMatrix(); GL11.glTranslated(this.edge3.offsetX, this.edge3.offsetY, this.edge3.offsetZ); GL11.glTranslated( - this.edge3.rotationPointX * f5, this.edge3.rotationPointY * f5, this.edge3.rotationPointZ * f5); + this.edge3.rotationPointX * f5, + this.edge3.rotationPointY * f5, + this.edge3.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge3.offsetX, -this.edge3.offsetY, -this.edge3.offsetZ); GL11.glTranslated( - -this.edge3.rotationPointX * f5, -this.edge3.rotationPointY * f5, -this.edge3.rotationPointZ * f5); + -this.edge3.rotationPointX * f5, + -this.edge3.rotationPointY * f5, + -this.edge3.rotationPointZ * f5); this.edge3.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); @@ -609,7 +632,9 @@ public class ModelStaffOfTheGreatOne extends ModelBase { GL11.glPushMatrix(); GL11.glTranslated(this.edge5_2.offsetX, this.edge5_2.offsetY, this.edge5_2.offsetZ); GL11.glTranslated( - this.edge5_2.rotationPointX * f5, this.edge5_2.rotationPointY * f5, this.edge5_2.rotationPointZ * f5); + this.edge5_2.rotationPointX * f5, + this.edge5_2.rotationPointY * f5, + this.edge5_2.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge5_2.offsetX, -this.edge5_2.offsetY, -this.edge5_2.offsetZ); GL11.glTranslated( @@ -621,11 +646,15 @@ public class ModelStaffOfTheGreatOne extends ModelBase { GL11.glPushMatrix(); GL11.glTranslated(this.edge5.offsetX, this.edge5.offsetY, this.edge5.offsetZ); GL11.glTranslated( - this.edge5.rotationPointX * f5, this.edge5.rotationPointY * f5, this.edge5.rotationPointZ * f5); + this.edge5.rotationPointX * f5, + this.edge5.rotationPointY * f5, + this.edge5.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge5.offsetX, -this.edge5.offsetY, -this.edge5.offsetZ); GL11.glTranslated( - -this.edge5.rotationPointX * f5, -this.edge5.rotationPointY * f5, -this.edge5.rotationPointZ * f5); + -this.edge5.rotationPointX * f5, + -this.edge5.rotationPointY * f5, + -this.edge5.rotationPointZ * f5); this.edge5.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); @@ -659,7 +688,9 @@ public class ModelStaffOfTheGreatOne extends ModelBase { GL11.glPushMatrix(); GL11.glTranslated(this.edge1_1.offsetX, this.edge1_1.offsetY, this.edge1_1.offsetZ); GL11.glTranslated( - this.edge1_1.rotationPointX * f5, this.edge1_1.rotationPointY * f5, this.edge1_1.rotationPointZ * f5); + this.edge1_1.rotationPointX * f5, + this.edge1_1.rotationPointY * f5, + this.edge1_1.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge1_1.offsetX, -this.edge1_1.offsetY, -this.edge1_1.offsetZ); GL11.glTranslated( @@ -727,7 +758,9 @@ public class ModelStaffOfTheGreatOne extends ModelBase { GL11.glPushMatrix(); GL11.glTranslated(this.edge4_2.offsetX, this.edge4_2.offsetY, this.edge4_2.offsetZ); GL11.glTranslated( - this.edge4_2.rotationPointX * f5, this.edge4_2.rotationPointY * f5, this.edge4_2.rotationPointZ * f5); + this.edge4_2.rotationPointX * f5, + this.edge4_2.rotationPointY * f5, + this.edge4_2.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge4_2.offsetX, -this.edge4_2.offsetY, -this.edge4_2.offsetZ); GL11.glTranslated( @@ -753,7 +786,9 @@ public class ModelStaffOfTheGreatOne extends ModelBase { GL11.glPushMatrix(); GL11.glTranslated(this.edge3_3.offsetX, this.edge3_3.offsetY, this.edge3_3.offsetZ); GL11.glTranslated( - this.edge3_3.rotationPointX * f5, this.edge3_3.rotationPointY * f5, this.edge3_3.rotationPointZ * f5); + this.edge3_3.rotationPointX * f5, + this.edge3_3.rotationPointY * f5, + this.edge3_3.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge3_3.offsetX, -this.edge3_3.offsetY, -this.edge3_3.offsetZ); GL11.glTranslated( @@ -765,11 +800,15 @@ public class ModelStaffOfTheGreatOne extends ModelBase { GL11.glPushMatrix(); GL11.glTranslated(this.shape3.offsetX, this.shape3.offsetY, this.shape3.offsetZ); GL11.glTranslated( - this.shape3.rotationPointX * f5, this.shape3.rotationPointY * f5, this.shape3.rotationPointZ * f5); + this.shape3.rotationPointX * f5, + this.shape3.rotationPointY * f5, + this.shape3.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape3.offsetX, -this.shape3.offsetY, -this.shape3.offsetZ); GL11.glTranslated( - -this.shape3.rotationPointX * f5, -this.shape3.rotationPointY * f5, -this.shape3.rotationPointZ * f5); + -this.shape3.rotationPointX * f5, + -this.shape3.rotationPointY * f5, + -this.shape3.rotationPointZ * f5); this.shape3.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); @@ -915,21 +954,29 @@ public class ModelStaffOfTheGreatOne extends ModelBase { GL11.glPushMatrix(); GL11.glTranslated(this.tope3.offsetX, this.tope3.offsetY, this.tope3.offsetZ); GL11.glTranslated( - this.tope3.rotationPointX * f5, this.tope3.rotationPointY * f5, this.tope3.rotationPointZ * f5); + this.tope3.rotationPointX * f5, + this.tope3.rotationPointY * f5, + this.tope3.rotationPointZ * f5); GL11.glScaled(0.6D, 0.6D, 0.6D); GL11.glTranslated(-this.tope3.offsetX, -this.tope3.offsetY, -this.tope3.offsetZ); GL11.glTranslated( - -this.tope3.rotationPointX * f5, -this.tope3.rotationPointY * f5, -this.tope3.rotationPointZ * f5); + -this.tope3.rotationPointX * f5, + -this.tope3.rotationPointY * f5, + -this.tope3.rotationPointZ * f5); this.tope3.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.shape5.offsetX, this.shape5.offsetY, this.shape5.offsetZ); GL11.glTranslated( - this.shape5.rotationPointX * f5, this.shape5.rotationPointY * f5, this.shape5.rotationPointZ * f5); + this.shape5.rotationPointX * f5, + this.shape5.rotationPointY * f5, + this.shape5.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape5.offsetX, -this.shape5.offsetY, -this.shape5.offsetZ); GL11.glTranslated( - -this.shape5.rotationPointX * f5, -this.shape5.rotationPointY * f5, -this.shape5.rotationPointZ * f5); + -this.shape5.rotationPointX * f5, + -this.shape5.rotationPointY * f5, + -this.shape5.rotationPointZ * f5); this.shape5.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); @@ -963,7 +1010,9 @@ public class ModelStaffOfTheGreatOne extends ModelBase { GL11.glPushMatrix(); GL11.glTranslated(this.edge5_3.offsetX, this.edge5_3.offsetY, this.edge5_3.offsetZ); GL11.glTranslated( - this.edge5_3.rotationPointX * f5, this.edge5_3.rotationPointY * f5, this.edge5_3.rotationPointZ * f5); + this.edge5_3.rotationPointX * f5, + this.edge5_3.rotationPointY * f5, + this.edge5_3.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge5_3.offsetX, -this.edge5_3.offsetY, -this.edge5_3.offsetZ); GL11.glTranslated( @@ -975,7 +1024,9 @@ public class ModelStaffOfTheGreatOne extends ModelBase { GL11.glPushMatrix(); GL11.glTranslated(this.edge3_1.offsetX, this.edge3_1.offsetY, this.edge3_1.offsetZ); GL11.glTranslated( - this.edge3_1.rotationPointX * f5, this.edge3_1.rotationPointY * f5, this.edge3_1.rotationPointZ * f5); + this.edge3_1.rotationPointX * f5, + this.edge3_1.rotationPointY * f5, + this.edge3_1.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge3_1.offsetX, -this.edge3_1.offsetY, -this.edge3_1.offsetZ); GL11.glTranslated( @@ -987,11 +1038,15 @@ public class ModelStaffOfTheGreatOne extends ModelBase { GL11.glPushMatrix(); GL11.glTranslated(this.shape7.offsetX, this.shape7.offsetY, this.shape7.offsetZ); GL11.glTranslated( - this.shape7.rotationPointX * f5, this.shape7.rotationPointY * f5, this.shape7.rotationPointZ * f5); + this.shape7.rotationPointX * f5, + this.shape7.rotationPointY * f5, + this.shape7.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape7.offsetX, -this.shape7.offsetY, -this.shape7.offsetZ); GL11.glTranslated( - -this.shape7.rotationPointX * f5, -this.shape7.rotationPointY * f5, -this.shape7.rotationPointZ * f5); + -this.shape7.rotationPointX * f5, + -this.shape7.rotationPointY * f5, + -this.shape7.rotationPointZ * f5); this.shape7.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); @@ -1025,7 +1080,9 @@ public class ModelStaffOfTheGreatOne extends ModelBase { GL11.glPushMatrix(); GL11.glTranslated(this.edge2_3.offsetX, this.edge2_3.offsetY, this.edge2_3.offsetZ); GL11.glTranslated( - this.edge2_3.rotationPointX * f5, this.edge2_3.rotationPointY * f5, this.edge2_3.rotationPointZ * f5); + this.edge2_3.rotationPointX * f5, + this.edge2_3.rotationPointY * f5, + this.edge2_3.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge2_3.offsetX, -this.edge2_3.offsetY, -this.edge2_3.offsetZ); GL11.glTranslated( @@ -1051,7 +1108,9 @@ public class ModelStaffOfTheGreatOne extends ModelBase { GL11.glPushMatrix(); GL11.glTranslated(this.edge1_2.offsetX, this.edge1_2.offsetY, this.edge1_2.offsetZ); GL11.glTranslated( - this.edge1_2.rotationPointX * f5, this.edge1_2.rotationPointY * f5, this.edge1_2.rotationPointZ * f5); + this.edge1_2.rotationPointX * f5, + this.edge1_2.rotationPointY * f5, + this.edge1_2.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge1_2.offsetX, -this.edge1_2.offsetY, -this.edge1_2.offsetZ); GL11.glTranslated( @@ -1063,7 +1122,9 @@ public class ModelStaffOfTheGreatOne extends ModelBase { GL11.glPushMatrix(); GL11.glTranslated(this.edge2_2.offsetX, this.edge2_2.offsetY, this.edge2_2.offsetZ); GL11.glTranslated( - this.edge2_2.rotationPointX * f5, this.edge2_2.rotationPointY * f5, this.edge2_2.rotationPointZ * f5); + this.edge2_2.rotationPointX * f5, + this.edge2_2.rotationPointY * f5, + this.edge2_2.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge2_2.offsetX, -this.edge2_2.offsetY, -this.edge2_2.offsetZ); GL11.glTranslated( @@ -1075,11 +1136,15 @@ public class ModelStaffOfTheGreatOne extends ModelBase { GL11.glPushMatrix(); GL11.glTranslated(this.edge2.offsetX, this.edge2.offsetY, this.edge2.offsetZ); GL11.glTranslated( - this.edge2.rotationPointX * f5, this.edge2.rotationPointY * f5, this.edge2.rotationPointZ * f5); + this.edge2.rotationPointX * f5, + this.edge2.rotationPointY * f5, + this.edge2.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge2.offsetX, -this.edge2.offsetY, -this.edge2.offsetZ); GL11.glTranslated( - -this.edge2.rotationPointX * f5, -this.edge2.rotationPointY * f5, -this.edge2.rotationPointZ * f5); + -this.edge2.rotationPointX * f5, + -this.edge2.rotationPointY * f5, + -this.edge2.rotationPointZ * f5); this.edge2.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); @@ -1099,7 +1164,9 @@ public class ModelStaffOfTheGreatOne extends ModelBase { GL11.glPushMatrix(); GL11.glTranslated(this.edge5_1.offsetX, this.edge5_1.offsetY, this.edge5_1.offsetZ); GL11.glTranslated( - this.edge5_1.rotationPointX * f5, this.edge5_1.rotationPointY * f5, this.edge5_1.rotationPointZ * f5); + this.edge5_1.rotationPointX * f5, + this.edge5_1.rotationPointY * f5, + this.edge5_1.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge5_1.offsetX, -this.edge5_1.offsetY, -this.edge5_1.offsetZ); GL11.glTranslated( @@ -1125,7 +1192,9 @@ public class ModelStaffOfTheGreatOne extends ModelBase { GL11.glPushMatrix(); GL11.glTranslated(this.edge4_1.offsetX, this.edge4_1.offsetY, this.edge4_1.offsetZ); GL11.glTranslated( - this.edge4_1.rotationPointX * f5, this.edge4_1.rotationPointY * f5, this.edge4_1.rotationPointZ * f5); + this.edge4_1.rotationPointX * f5, + this.edge4_1.rotationPointY * f5, + this.edge4_1.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge4_1.offsetX, -this.edge4_1.offsetY, -this.edge4_1.offsetZ); GL11.glTranslated( @@ -1151,7 +1220,9 @@ public class ModelStaffOfTheGreatOne extends ModelBase { GL11.glPushMatrix(); GL11.glTranslated(this.edge3_2.offsetX, this.edge3_2.offsetY, this.edge3_2.offsetZ); GL11.glTranslated( - this.edge3_2.rotationPointX * f5, this.edge3_2.rotationPointY * f5, this.edge3_2.rotationPointZ * f5); + this.edge3_2.rotationPointX * f5, + this.edge3_2.rotationPointY * f5, + this.edge3_2.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge3_2.offsetX, -this.edge3_2.offsetY, -this.edge3_2.offsetZ); GL11.glTranslated( @@ -1219,7 +1290,9 @@ public class ModelStaffOfTheGreatOne extends ModelBase { GL11.glPushMatrix(); GL11.glTranslated(this.edge1_3.offsetX, this.edge1_3.offsetY, this.edge1_3.offsetZ); GL11.glTranslated( - this.edge1_3.rotationPointX * f5, this.edge1_3.rotationPointY * f5, this.edge1_3.rotationPointZ * f5); + this.edge1_3.rotationPointX * f5, + this.edge1_3.rotationPointY * f5, + this.edge1_3.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge1_3.offsetX, -this.edge1_3.offsetY, -this.edge1_3.offsetZ); GL11.glTranslated( @@ -1245,32 +1318,44 @@ public class ModelStaffOfTheGreatOne extends ModelBase { GL11.glPushMatrix(); GL11.glTranslated(this.shape2.offsetX, this.shape2.offsetY, this.shape2.offsetZ); GL11.glTranslated( - this.shape2.rotationPointX * f5, this.shape2.rotationPointY * f5, this.shape2.rotationPointZ * f5); + this.shape2.rotationPointX * f5, + this.shape2.rotationPointY * f5, + this.shape2.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape2.offsetX, -this.shape2.offsetY, -this.shape2.offsetZ); GL11.glTranslated( - -this.shape2.rotationPointX * f5, -this.shape2.rotationPointY * f5, -this.shape2.rotationPointZ * f5); + -this.shape2.rotationPointX * f5, + -this.shape2.rotationPointY * f5, + -this.shape2.rotationPointZ * f5); this.shape2.render(f5); GL11.glPopMatrix(); this.staff.render(f5); GL11.glPushMatrix(); GL11.glTranslated(this.shape6.offsetX, this.shape6.offsetY, this.shape6.offsetZ); GL11.glTranslated( - this.shape6.rotationPointX * f5, this.shape6.rotationPointY * f5, this.shape6.rotationPointZ * f5); + this.shape6.rotationPointX * f5, + this.shape6.rotationPointY * f5, + this.shape6.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.shape6.offsetX, -this.shape6.offsetY, -this.shape6.offsetZ); GL11.glTranslated( - -this.shape6.rotationPointX * f5, -this.shape6.rotationPointY * f5, -this.shape6.rotationPointZ * f5); + -this.shape6.rotationPointX * f5, + -this.shape6.rotationPointY * f5, + -this.shape6.rotationPointZ * f5); this.shape6.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(this.edge4.offsetX, this.edge4.offsetY, this.edge4.offsetZ); GL11.glTranslated( - this.edge4.rotationPointX * f5, this.edge4.rotationPointY * f5, this.edge4.rotationPointZ * f5); + this.edge4.rotationPointX * f5, + this.edge4.rotationPointY * f5, + this.edge4.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge4.offsetX, -this.edge4.offsetY, -this.edge4.offsetZ); GL11.glTranslated( - -this.edge4.rotationPointX * f5, -this.edge4.rotationPointY * f5, -this.edge4.rotationPointZ * f5); + -this.edge4.rotationPointX * f5, + -this.edge4.rotationPointY * f5, + -this.edge4.rotationPointZ * f5); this.edge4.render(f5); GL11.glPopMatrix(); GL11.glPushMatrix(); @@ -1304,7 +1389,9 @@ public class ModelStaffOfTheGreatOne extends ModelBase { GL11.glPushMatrix(); GL11.glTranslated(this.edge5_4.offsetX, this.edge5_4.offsetY, this.edge5_4.offsetZ); GL11.glTranslated( - this.edge5_4.rotationPointX * f5, this.edge5_4.rotationPointY * f5, this.edge5_4.rotationPointZ * f5); + this.edge5_4.rotationPointX * f5, + this.edge5_4.rotationPointY * f5, + this.edge5_4.rotationPointZ * f5); GL11.glScaled(0.7D, 0.7D, 0.7D); GL11.glTranslated(-this.edge5_4.offsetX, -this.edge5_4.offsetY, -this.edge5_4.offsetZ); GL11.glTranslated( diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderCrystal.java b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderCrystal.java index 0e6311fe..d116d2b9 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderCrystal.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderCrystal.java @@ -1,14 +1,16 @@ package com.brandon3055.draconicevolution.client.render.block; -import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyRelay; -import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyTransceiver; -import com.brandon3055.draconicevolution.common.tileentities.energynet.TileWirelessEnergyTransceiver; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.item.ItemStack; import net.minecraftforge.client.IItemRenderer; + import org.lwjgl.opengl.GL11; +import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyRelay; +import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyTransceiver; +import com.brandon3055.draconicevolution.common.tileentities.energynet.TileWirelessEnergyTransceiver; + /** * Created by Brandon on 16/02/2015. */ @@ -55,14 +57,10 @@ public class RenderCrystal implements IItemRenderer { } int meta = item.getItemDamage(); TileEntityRendererDispatcher.instance.renderTileEntityAt( - meta == 0 - ? relay1 - : meta == 1 - ? relay2 - : meta == 2 - ? transceiver1 - : meta == 3 - ? transceiver2 + meta == 0 ? relay1 + : meta == 1 ? relay2 + : meta == 2 ? transceiver1 + : meta == 3 ? transceiver2 : meta == 4 ? wirelessTransceiver1 : wirelessTransceiver2, 0.0D, 0.0D, diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderDraconiumChest.java b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderDraconiumChest.java index 744fdd1a..d7901743 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderDraconiumChest.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderDraconiumChest.java @@ -1,13 +1,15 @@ package com.brandon3055.draconicevolution.client.render.block; -import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; -import com.brandon3055.draconicevolution.common.utills.ICustomItemData; import net.minecraft.client.model.ModelChest; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.item.ItemStack; import net.minecraftforge.client.IItemRenderer; + import org.lwjgl.opengl.GL11; +import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; +import com.brandon3055.draconicevolution.common.utills.ICustomItemData; + /** * Created by Brandon on 16/11/2014. */ diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderEarthItem.java b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderEarthItem.java index 256bc490..9b8ea46a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderEarthItem.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderEarthItem.java @@ -1,10 +1,12 @@ package com.brandon3055.draconicevolution.client.render.block; +import net.minecraft.item.ItemStack; +import net.minecraftforge.client.IItemRenderer; + +import org.lwjgl.opengl.GL11; + import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.client.render.tile.RenderTileEarth; -import net.minecraft.item.ItemStack; -import net.minecraftforge.client.IItemRenderer; -import org.lwjgl.opengl.GL11; /** * Created by brandon3055 on 30/7/2015. diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderEnergyInfuser.java b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderEnergyInfuser.java index e6f176ad..14c36d86 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderEnergyInfuser.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderEnergyInfuser.java @@ -1,12 +1,15 @@ package com.brandon3055.draconicevolution.client.render.block; -import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.item.ItemStack; import net.minecraftforge.client.IItemRenderer; + import org.lwjgl.opengl.GL11; +import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser; + public class RenderEnergyInfuser implements IItemRenderer { + private TileEnergyInfuser tile; public RenderEnergyInfuser() { diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderParticleGen.java b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderParticleGen.java index 7b8bbe7e..c7bf06f5 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderParticleGen.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderParticleGen.java @@ -1,14 +1,17 @@ package com.brandon3055.draconicevolution.client.render.block; -import com.brandon3055.draconicevolution.common.tileentities.TileParticleGenerator; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.client.IItemRenderer; + import org.lwjgl.opengl.GL11; +import com.brandon3055.draconicevolution.common.tileentities.TileParticleGenerator; + public class RenderParticleGen implements IItemRenderer { + private TileEntity tile; public RenderParticleGen() { diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderPortal.java b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderPortal.java index 3e1e0859..0f70873b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderPortal.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderPortal.java @@ -1,8 +1,5 @@ package com.brandon3055.draconicevolution.client.render.block; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.lib.References; -import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; @@ -10,16 +7,21 @@ import net.minecraft.init.Blocks; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.lib.References; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; + /** * Created by Brandon on 25/5/2015. */ public class RenderPortal implements ISimpleBlockRenderingHandler { + @Override public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {} @Override - public boolean renderWorldBlock( - IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, + RenderBlocks renderer) { Tessellator tess = Tessellator.instance; int meta = world.getBlockMetadata(x, y, z); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderReactorCore.java b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderReactorCore.java index bca6a12c..895825e7 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderReactorCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderReactorCore.java @@ -1,10 +1,12 @@ package com.brandon3055.draconicevolution.client.render.block; +import net.minecraft.item.ItemStack; +import net.minecraftforge.client.IItemRenderer; + +import org.lwjgl.opengl.GL11; + import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.client.render.tile.RenderTileReactorCore; -import net.minecraft.item.ItemStack; -import net.minecraftforge.client.IItemRenderer; -import org.lwjgl.opengl.GL11; /** * Created by brandon3055 on 30/7/2015. diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderReactorEnergyInjector.java b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderReactorEnergyInjector.java index 32cfe345..f7280432 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderReactorEnergyInjector.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderReactorEnergyInjector.java @@ -1,10 +1,12 @@ package com.brandon3055.draconicevolution.client.render.block; +import net.minecraft.item.ItemStack; +import net.minecraftforge.client.IItemRenderer; + +import org.lwjgl.opengl.GL11; + import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.client.render.tile.RenderTileReactorEnergyInjector; -import net.minecraft.item.ItemStack; -import net.minecraftforge.client.IItemRenderer; -import org.lwjgl.opengl.GL11; /** * Created by brandon3055 on 30/7/2015. diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderReactorStabilizer.java b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderReactorStabilizer.java index 5373cae2..7dec1efc 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderReactorStabilizer.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderReactorStabilizer.java @@ -1,10 +1,12 @@ package com.brandon3055.draconicevolution.client.render.block; +import net.minecraft.item.ItemStack; +import net.minecraftforge.client.IItemRenderer; + +import org.lwjgl.opengl.GL11; + import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.client.render.tile.RenderTileReactorStabilizer; -import net.minecraft.item.ItemStack; -import net.minecraftforge.client.IItemRenderer; -import org.lwjgl.opengl.GL11; /** * Created by brandon3055 on 30/7/2015. diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderTeleporterStand.java b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderTeleporterStand.java index a776659a..978a9118 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderTeleporterStand.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderTeleporterStand.java @@ -1,14 +1,16 @@ package com.brandon3055.draconicevolution.client.render.block; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.tileentities.TileTeleporterStand; -import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.world.IBlockAccess; + import org.lwjgl.opengl.GL11; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.tileentities.TileTeleporterStand; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; + /** * Created by Brandon on 25/10/2014. */ @@ -23,8 +25,8 @@ public class RenderTeleporterStand implements ISimpleBlockRenderingHandler { } @Override - public boolean renderWorldBlock( - IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, + RenderBlocks renderer) { return false; } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderUpgradeModifier.java b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderUpgradeModifier.java index 1f0c3feb..b1a27d6c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderUpgradeModifier.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/block/RenderUpgradeModifier.java @@ -1,12 +1,15 @@ package com.brandon3055.draconicevolution.client.render.block; -import com.brandon3055.draconicevolution.common.tileentities.TileUpgradeModifier; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.item.ItemStack; import net.minecraftforge.client.IItemRenderer; + import org.lwjgl.opengl.GL11; +import com.brandon3055.draconicevolution.common.tileentities.TileUpgradeModifier; + public class RenderUpgradeModifier implements IItemRenderer { + private TileUpgradeModifier tile; public RenderUpgradeModifier() { diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderChaosCrystal.java b/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderChaosCrystal.java index 3206d92e..db31b9e9 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderChaosCrystal.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderChaosCrystal.java @@ -1,8 +1,5 @@ package com.brandon3055.draconicevolution.client.render.entity; -import com.brandon3055.draconicevolution.client.handler.ResourceHandler; -import com.brandon3055.draconicevolution.client.model.ModelChaosCrystal; -import com.brandon3055.draconicevolution.common.entity.EntityChaosCrystal; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; @@ -11,12 +8,18 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityEnderCrystal; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; + import org.lwjgl.opengl.GL11; +import com.brandon3055.draconicevolution.client.handler.ResourceHandler; +import com.brandon3055.draconicevolution.client.model.ModelChaosCrystal; +import com.brandon3055.draconicevolution.common.entity.EntityChaosCrystal; + /** * Created by brandon3055 on 30/8/2015. */ public class RenderChaosCrystal extends Render { + private ModelBase model; public RenderChaosCrystal() { @@ -100,12 +103,7 @@ public class RenderChaosCrystal extends Render { return this.getEntityTexture((EntityChaosCrystal) p_110775_1_); } - public void doRender( - Entity p_76986_1_, - double p_76986_2_, - double p_76986_4_, - double p_76986_6_, - float p_76986_8_, + public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { this.doRender((EntityChaosCrystal) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderChaosDrill.java b/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderChaosDrill.java index 91389e29..c994c6a7 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderChaosDrill.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderChaosDrill.java @@ -1,11 +1,12 @@ package com.brandon3055.draconicevolution.client.render.entity; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.entity.Render; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 14/09/2014. */ diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderDragon.java b/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderDragon.java index 7ce0c9e5..bbffb2d8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderDragon.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/entity/RenderDragon.java @@ -1,10 +1,7 @@ package com.brandon3055.draconicevolution.client.render.entity; -import com.brandon3055.draconicevolution.common.entity.EntityChaosGuardian; -import com.brandon3055.draconicevolution.common.lib.References; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.Random; + import net.minecraft.client.model.ModelDragon; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderHelper; @@ -17,23 +14,31 @@ import net.minecraft.entity.boss.BossStatus; import net.minecraft.entity.boss.EntityDragon; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; + import org.lwjgl.opengl.GL11; +import com.brandon3055.draconicevolution.common.entity.EntityChaosGuardian; +import com.brandon3055.draconicevolution.common.lib.References; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 11/08/2014. */ @SideOnly(Side.CLIENT) public class RenderDragon extends RenderLiving { - private static final ResourceLocation enderDragonExplodingTextures = - new ResourceLocation("textures/entity/enderdragon/dragon_exploding.png"); - private static final ResourceLocation enderDragonCrystalBeamTextures = - new ResourceLocation("textures/entity/endercrystal/endercrystal_beam.png"); - private static final ResourceLocation enderDragonEyesTextures = - new ResourceLocation("textures/entity/enderdragon/dragon_eyes.png"); - private static final ResourceLocation enderDragonTextures = - new ResourceLocation(References.RESOURCESPREFIX + "textures/entity/de_dragon.png"); - private static final ResourceLocation enderDragonTextures2 = - new ResourceLocation(References.RESOURCESPREFIX + "textures/entity/de_chaos_dragon.png"); + + private static final ResourceLocation enderDragonExplodingTextures = new ResourceLocation( + "textures/entity/enderdragon/dragon_exploding.png"); + private static final ResourceLocation enderDragonCrystalBeamTextures = new ResourceLocation( + "textures/entity/endercrystal/endercrystal_beam.png"); + private static final ResourceLocation enderDragonEyesTextures = new ResourceLocation( + "textures/entity/enderdragon/dragon_eyes.png"); + private static final ResourceLocation enderDragonTextures = new ResourceLocation( + References.RESOURCESPREFIX + "textures/entity/de_dragon.png"); + private static final ResourceLocation enderDragonTextures2 = new ResourceLocation( + References.RESOURCESPREFIX + "textures/entity/de_chaos_dragon.png"); /** * An instance of the dragon model in RenderDragon */ @@ -47,8 +52,8 @@ public class RenderDragon extends RenderLiving { protected void rotateCorpse(EntityDragon p_77043_1_, float p_77043_2_, float p_77043_3_, float p_77043_4_) { float f3 = (float) p_77043_1_.getMovementOffsets(7, p_77043_4_)[0]; - float f4 = (float) - (p_77043_1_.getMovementOffsets(5, p_77043_4_)[1] - p_77043_1_.getMovementOffsets(10, p_77043_4_)[1]); + float f4 = (float) (p_77043_1_.getMovementOffsets(5, p_77043_4_)[1] + - p_77043_1_.getMovementOffsets(10, p_77043_4_)[1]); GL11.glRotatef(-f3, 0.0F, 1.0F, 0.0F); GL11.glRotatef(f4 * 10.0F, 1.0F, 0.0F, 0.0F); GL11.glTranslatef(0.0F, 0.0F, 1.0F); @@ -68,14 +73,8 @@ public class RenderDragon extends RenderLiving { /** * Renders the model in RenderLiving */ - protected void renderModel( - EntityDragon p_77036_1_, - float p_77036_2_, - float p_77036_3_, - float p_77036_4_, - float p_77036_5_, - float p_77036_6_, - float p_77036_7_) { + protected void renderModel(EntityDragon p_77036_1_, float p_77036_2_, float p_77036_3_, float p_77036_4_, + float p_77036_5_, float p_77036_6_, float p_77036_7_) { if (p_77036_1_.deathTicks > 0) { float f6 = (float) p_77036_1_.deathTicks / 200.0F; GL11.glDepthFunc(GL11.GL_LEQUAL); @@ -109,12 +108,7 @@ public class RenderDragon extends RenderLiving { * (Render> 16, (color & 0xFF00) >> 8, (color & 0xFF), 0); tessellator.addVertexWithUV( - (double) (verX * sizeOrigin), (double) (verY * sizeOrigin), -0.55D, (double) texU, (double) - texV1); + (double) (verX * sizeOrigin), + (double) (verY * sizeOrigin), + -0.55D, + (double) texU, + (double) texV1); tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), alpha); - tessellator.addVertexWithUV( - (double) verX, (double) verY, (double) length, (double) texU, (double) texV2); + tessellator + .addVertexWithUV((double) verX, (double) verY, (double) length, (double) texU, (double) texV2); } length = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ) @@ -151,11 +158,14 @@ public class ParticleReactorBeam extends EntityFX { tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), alpha); tessellator.addVertexWithUV( - (double) (verX * sizeOrigin), (double) (verY * sizeOrigin), 0.0D, (double) texU, (double) - texV1); + (double) (verX * sizeOrigin), + (double) (verY * sizeOrigin), + 0.0D, + (double) texU, + (double) texV1); tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), 0); - tessellator.addVertexWithUV( - (double) verX, (double) verY, (double) length, (double) texU, (double) texV2); + tessellator + .addVertexWithUV((double) verX, (double) verY, (double) length, (double) texU, (double) texV2); } tessellator.draw(); @@ -178,11 +188,14 @@ public class ParticleReactorBeam extends EntityFX { tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), alpha / 2); tessellator.addVertexWithUV( - (double) (verX * sizeOrigin), (double) (verY * sizeOrigin), 0.0D, (double) texU, (double) - texV1); + (double) (verX * sizeOrigin), + (double) (verY * sizeOrigin), + 0.0D, + (double) texU, + (double) texV1); tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), 0); - tessellator.addVertexWithUV( - (double) verX, (double) verY, (double) length, (double) texU, (double) texV2); + tessellator + .addVertexWithUV((double) verX, (double) verY, (double) length, (double) texU, (double) texV2); } tessellator.draw(); @@ -195,14 +208,8 @@ public class ParticleReactorBeam extends EntityFX { tessellator.startDrawingQuads(); } - private void renderStabilizerEffect( - Tessellator tessellator, - TileReactorCore reactor, - float offsetX, - float offsetY, - float offsetZ, - float length, - float partialTick) { + private void renderStabilizerEffect(Tessellator tessellator, TileReactorCore reactor, float offsetX, float offsetY, + float offsetZ, float length, float partialTick) { GL11.glShadeModel(GL11.GL_SMOOTH); // Draw Beams @@ -287,23 +294,12 @@ public class ParticleReactorBeam extends EntityFX { } /** - * Size Origin is the fraction of size start Target - * So if size target is 10 and size origin is 0.5 origin will actually be 5 + * Size Origin is the fraction of size start Target So if size target is 10 and size origin is 0.5 origin will + * actually be 5 */ - private void drawBeam( - Tessellator tessellator, - TileReactorCore reactor, - float sizeOrigin, - float sizeTarget, - float length, - float offsetX, - float offsetY, - float offsetZ, - int tick, - float partialTick, - boolean reverseTransparency, - boolean reverseDirection, - int color) { + private void drawBeam(Tessellator tessellator, TileReactorCore reactor, float sizeOrigin, float sizeTarget, + float length, float offsetX, float offsetY, float offsetZ, int tick, float partialTick, + boolean reverseTransparency, boolean reverseDirection, int color) { float speed = 3F; float texV2 = -0.1F + ((float) tick + partialTick) * (reverseDirection ? -0.01F : 0.01F) * speed; float texV1 = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ) / 32.0F @@ -323,7 +319,11 @@ public class ParticleReactorBeam extends EntityFX { (color & 0xFF), reverseTransparency ? 0 : (int) (255D * reactor.renderSpeed)); tessellator.addVertexWithUV( - (double) (verX * sizeOrigin), (double) (verY * sizeOrigin), 0.0D, (double) texU, (double) texV1); + (double) (verX * sizeOrigin), + (double) (verY * sizeOrigin), + 0.0D, + (double) texU, + (double) texV1); tessellator.setColorRGBA( (color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, @@ -336,121 +336,121 @@ public class ParticleReactorBeam extends EntityFX { } } -// @Override -// public void renderParticle(Tessellator tessellator, float partialTick, float rotX, float rotXZ, float rotZ, float +// @Override +// public void renderParticle(Tessellator tessellator, float partialTick, float rotX, float rotXZ, float rotZ, float // rotYZ, float rotXY) { -// if (!((IIsSlave)tile).isActive()) return; -// tessellator.draw(); -// GL11.glPushMatrix(); -// GL11.glDisable(GL11.GL_CULL_FACE); -// GL11.glAlphaFunc(GL11.GL_GREATER, 0.0F); +// if (!((IIsSlave)tile).isActive()) return; +// tessellator.draw(); +// GL11.glPushMatrix(); +// GL11.glDisable(GL11.GL_CULL_FACE); +// GL11.glAlphaFunc(GL11.GL_GREATER, 0.0F); // -// float xx = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTick - interpPosX); -// float yy = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTick - interpPosY); -// float zz = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTick - interpPosZ); -// GL11.glTranslated((double)xx, (double)yy, (double)zz); +// float xx = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTick - interpPosX); +// float yy = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTick - interpPosY); +// float zz = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTick - interpPosZ); +// GL11.glTranslated((double)xx, (double)yy, (double)zz); // -// //Common Fields -// MultiblockHelper.TileLocation master = ((IIsSlave)tile).getMaster(); -// float offsetX = (float)(master.posX - tile.xCoord); -// float offsetY = (float)((double)master.posY - tile.yCoord); -// float offsetZ = (float)(master.posZ - tile.zCoord); -// float length = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ); +// //Common Fields +// MultiblockHelper.TileLocation master = ((IIsSlave)tile).getMaster(); +// float offsetX = (float)(master.posX - tile.xCoord); +// float offsetY = (float)((double)master.posY - tile.yCoord); +// float offsetZ = (float)(master.posZ - tile.zCoord); +// float length = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ); // // -// //Rotate beam to face target -// float f7 = MathHelper.sqrt_float(offsetX * offsetX + offsetZ * offsetZ); -// GL11.glRotatef((float) (-Math.atan2((double) offsetZ, (double) offsetX)) * 180.0F / (float) Math.PI - 90.0F, 0.0F, +// //Rotate beam to face target +// float f7 = MathHelper.sqrt_float(offsetX * offsetX + offsetZ * offsetZ); +// GL11.glRotatef((float) (-Math.atan2((double) offsetZ, (double) offsetX)) * 180.0F / (float) Math.PI - 90.0F, 0.0F, // 1.0F, 0.0F); -// GL11.glRotatef((float)(-Math.atan2((double)f7, (double)offsetY)) * 180.0F / (float)Math.PI - 90.0F, 1.0F, 0.0F, +// GL11.glRotatef((float)(-Math.atan2((double)f7, (double)offsetY)) * 180.0F / (float)Math.PI - 90.0F, 1.0F, 0.0F, // 0.0F); // -// if (tile instanceof TileReactorStabilizer) renderStabilizerEffect(tessellator, offsetX, offsetY, offsetZ, length, +// if (tile instanceof TileReactorStabilizer) renderStabilizerEffect(tessellator, offsetX, offsetY, offsetZ, length, // partialTick); -// else { -// GL11.glShadeModel(GL11.GL_SMOOTH); -// GL11.glTranslated(0, 0, 0.3); -// //GL11.glPushMatrix(); -// GL11.glRotatef(((float)particleAge + partialTick)*20F, 0, 0, 1); -// ResourceHandler.bindResource("textures/particle/reactorEnergyBeam.png"); -//// float sizeOrigin = 0.5F; -//// float sizeTarget = 0.2F; -// float sizeTarget = 0.2F; -// float sizeOrigin = 0.5F; +// else { +// GL11.glShadeModel(GL11.GL_SMOOTH); +// GL11.glTranslated(0, 0, 0.3); +// //GL11.glPushMatrix(); +// GL11.glRotatef(((float)particleAge + partialTick)*20F, 0, 0, 1); +// ResourceHandler.bindResource("textures/particle/reactorEnergyBeam.png"); +//// float sizeOrigin = 0.5F; +//// float sizeTarget = 0.2F; +// float sizeTarget = 0.2F; +// float sizeOrigin = 0.5F; // -// int color = 0xFF2200; -// int alpha = 200; -// length -= 1; +// int color = 0xFF2200; +// int alpha = 200; +// length -= 1; // -// float speed = 20F; -// float texV2 = 0.0F + ((float)particleAge + partialTick) * 0.01F * speed; -// float texV1 = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ) + +// float speed = 20F; +// float texV2 = 0.0F + ((float)particleAge + partialTick) * 0.01F * speed; +// float texV1 = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ) + // ((float)particleAge + partialTick) * 0.01F * speed; // -// tessellator.startDrawing(5); -// tessellator.setBrightness(200); +// tessellator.startDrawing(5); +// tessellator.setBrightness(200); // -// byte b0 = 16; -// for (int i = 0; i <= b0; ++i) -// { -// float verX = MathHelper.sin((float)(i % b0) * (float)Math.PI * 2.13F / (float)b0) * sizeTarget; -// float verY = MathHelper.cos((float)(i % b0) * (float)Math.PI * 2.13F / (float)b0) * sizeTarget; -// float texU = (float)(i % b0) * 1.0F / (float)b0; -// tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), alpha); +// byte b0 = 16; +// for (int i = 0; i <= b0; ++i) +// { +// float verX = MathHelper.sin((float)(i % b0) * (float)Math.PI * 2.13F / (float)b0) * sizeTarget; +// float verY = MathHelper.cos((float)(i % b0) * (float)Math.PI * 2.13F / (float)b0) * sizeTarget; +// float texU = (float)(i % b0) * 1.0F / (float)b0; +// tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), alpha); // -// tessellator.addVertexWithUV((double)(verX * sizeOrigin), (double)(verY * sizeOrigin), 0.0D, (double)texU, +// tessellator.addVertexWithUV((double)(verX * sizeOrigin), (double)(verY * sizeOrigin), 0.0D, (double)texU, // (double)texV1); -// tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), 0); -// tessellator.addVertexWithUV((double)verX, (double)verY, (double)length, (double)texU, (double)texV2); -// } +// tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), 0); +// tessellator.addVertexWithUV((double)verX, (double)verY, (double)length, (double)texU, (double)texV2); +// } // -// sizeTarget = 0.1F; +// sizeTarget = 0.1F; // -// length = 0F; -// for (int i = 0; i <= b0; ++i) -// { -// float verX = MathHelper.sin((float)(i % b0) * (float)Math.PI * 2.3F / (float)b0) * sizeTarget; -// float verY = MathHelper.cos((float)(i % b0) * (float)Math.PI * 2.3F / (float)b0) * sizeTarget; -// float texU = (float)(i % b0) * 1.0F / (float)b0; -// tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), 0); +// length = 0F; +// for (int i = 0; i <= b0; ++i) +// { +// float verX = MathHelper.sin((float)(i % b0) * (float)Math.PI * 2.3F / (float)b0) * sizeTarget; +// float verY = MathHelper.cos((float)(i % b0) * (float)Math.PI * 2.3F / (float)b0) * sizeTarget; +// float texU = (float)(i % b0) * 1.0F / (float)b0; +// tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), 0); // -// tessellator.addVertexWithUV((double)(verX * sizeOrigin), (double)(verY * sizeOrigin), -0.55D, (double)texU, +// tessellator.addVertexWithUV((double)(verX * sizeOrigin), (double)(verY * sizeOrigin), -0.55D, (double)texU, // (double)texV1); -// tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), alpha); -// tessellator.addVertexWithUV((double)verX, (double)verY, (double)length, (double)texU, (double)texV2); -// } +// tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), alpha); +// tessellator.addVertexWithUV((double)verX, (double)verY, (double)length, (double)texU, (double)texV2); +// } // -// tessellator.draw(); -// //GL11.glPopMatrix(); -// GL11.glRotatef(((float)particleAge + partialTick)*-30F, 0, 0, 1); +// tessellator.draw(); +// //GL11.glPopMatrix(); +// GL11.glRotatef(((float)particleAge + partialTick)*-30F, 0, 0, 1); // -// tessellator.startDrawing(5); -// tessellator.setBrightness(200); -// color = 0xFF4400; -// sizeOrigin = 0.15F; -// sizeTarget = 0.6F; -// length = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ) - 1; -// GL11.glTranslated(0, 0, -0.1); +// tessellator.startDrawing(5); +// tessellator.setBrightness(200); +// color = 0xFF4400; +// sizeOrigin = 0.15F; +// sizeTarget = 0.6F; +// length = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ) - 1; +// GL11.glTranslated(0, 0, -0.1); // -// for (int i = 0; i <= b0; ++i) -// { -// float verX = MathHelper.sin((float)(i % b0) * (float)Math.PI * 2.13F / (float)b0) * sizeTarget; -// float verY = MathHelper.cos((float)(i % b0) * (float)Math.PI * 2.13F / (float)b0) * sizeTarget; -// float texU = (float)(i % b0) * 1.0F / (float)b0; -// tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), alpha/2); +// for (int i = 0; i <= b0; ++i) +// { +// float verX = MathHelper.sin((float)(i % b0) * (float)Math.PI * 2.13F / (float)b0) * sizeTarget; +// float verY = MathHelper.cos((float)(i % b0) * (float)Math.PI * 2.13F / (float)b0) * sizeTarget; +// float texU = (float)(i % b0) * 1.0F / (float)b0; +// tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), alpha/2); // -// tessellator.addVertexWithUV((double)(verX * sizeOrigin), (double)(verY * sizeOrigin), 0.0D, (double)texU, +// tessellator.addVertexWithUV((double)(verX * sizeOrigin), (double)(verY * sizeOrigin), 0.0D, (double)texU, // (double)texV1); -// tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), 0); -// tessellator.addVertexWithUV((double)verX, (double)verY, (double)length, (double)texU, (double)texV2); -// } +// tessellator.setColorRGBA((color & 0xFF0000) >> 16, (color & 0xFF00) >> 8, (color & 0xFF), 0); +// tessellator.addVertexWithUV((double)verX, (double)verY, (double)length, (double)texU, (double)texV2); +// } // -// tessellator.draw(); -// GL11.glShadeModel(GL11.GL_FLAT); -// } +// tessellator.draw(); +// GL11.glShadeModel(GL11.GL_FLAT); +// } // -// GL11.glPopMatrix(); -// GL11.glEnable(GL11.GL_CULL_FACE); -// ResourceHandler.bindDefaultParticles(); -// tessellator.startDrawingQuads(); -// } +// GL11.glPopMatrix(); +// GL11.glEnable(GL11.GL_CULL_FACE); +// ResourceHandler.bindDefaultParticles(); +// tessellator.startDrawingQuads(); +// } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/Particles.java b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/Particles.java index 63ca9587..52f436c8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/Particles.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/Particles.java @@ -1,11 +1,5 @@ package com.brandon3055.draconicevolution.client.render.particle; -import com.brandon3055.brandonscore.common.utills.Utills; -import com.brandon3055.draconicevolution.client.handler.ResourceHandler; -import com.brandon3055.draconicevolution.common.entity.EntityDragonProjectile; -import com.brandon3055.draconicevolution.common.lib.References; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.particle.EntityFX; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; @@ -14,8 +8,17 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; + import org.lwjgl.opengl.GL11; +import com.brandon3055.brandonscore.common.utills.Utills; +import com.brandon3055.draconicevolution.client.handler.ResourceHandler; +import com.brandon3055.draconicevolution.common.entity.EntityDragonProjectile; +import com.brandon3055.draconicevolution.common.lib.References; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 27/07/2014. */ @@ -32,8 +35,8 @@ public class Particles { private double[] trailY = new double[15]; private double[] trailZ = new double[15]; - public EnergyBeamParticle( - World world, double x, double y, double z, double x1, double z1, int direction, boolean mirror) { + public EnergyBeamParticle(World world, double x, double y, double z, double x1, double z1, int direction, + boolean mirror) { super(world, x, y, z, 0.0D, 0.0D, 0.0D); float speed = 0.04F; this.motionX = 0; @@ -123,13 +126,7 @@ public class Particles { @Override @SideOnly(Side.CLIENT) - public void renderParticle( - Tessellator tesselator, - float par2, - float par3, - float par4, - float par5, - float par6, + public void renderParticle(Tessellator tesselator, float par2, float par3, float par4, float par5, float par6, float par7) { // Note U=X V=Y tesselator.draw(); @@ -235,8 +232,8 @@ public class Particles { private double targetZ; private boolean passive; - public EnergyTransferParticle( - World world, double x, double y, double z, double tX, double tY, double tZ, boolean passive) { + public EnergyTransferParticle(World world, double x, double y, double z, double tX, double tY, double tZ, + boolean passive) { super(world, x, y, z, 0.0D, 0.0D, 0.0D); this.passive = passive; this.targetX = tX; @@ -273,13 +270,7 @@ public class Particles { @Override @SideOnly(Side.CLIENT) - public void renderParticle( - Tessellator tesselator, - float par2, - float par3, - float par4, - float par5, - float par6, + public void renderParticle(Tessellator tesselator, float par2, float par3, float par4, float par5, float par6, float par7) { // Note U=X V=Y tesselator.draw(); @@ -304,18 +295,16 @@ public class Particles { float drawY = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) par2 - interpPosY); float drawZ = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) par2 - interpPosZ); - if (passive) - tesselator.setColorRGBA_F( - (float) this.getDistanceSq(targetX, targetY, targetZ) * 5F * this.particleRed, - (float) this.getDistanceSq(targetX, targetY, targetZ) * 5F * this.particleGreen, - this.particleBlue, - this.particleAlpha); - else - tesselator.setColorRGBA_F( - this.particleRed, - this.particleGreen, - this.particleBlue, - (float) this.getDistanceSq(targetX, targetY, targetZ) * 5F); + if (passive) tesselator.setColorRGBA_F( + (float) this.getDistanceSq(targetX, targetY, targetZ) * 5F * this.particleRed, + (float) this.getDistanceSq(targetX, targetY, targetZ) * 5F * this.particleGreen, + this.particleBlue, + this.particleAlpha); + else tesselator.setColorRGBA_F( + this.particleRed, + this.particleGreen, + this.particleBlue, + (float) this.getDistanceSq(targetX, targetY, targetZ) * 5F); // tesselator.setColorRGBA(0, 255, 255, (int) (this.particleAlpha * 255F)); @@ -359,8 +348,8 @@ public class Particles { public int behaviour; public int timer = 0; - public AdvancedSeekerParticle( - World world, double x, double y, double z, double tX, double tY, double tZ, int type, int maxAge) { + public AdvancedSeekerParticle(World world, double x, double y, double z, double tX, double tY, double tZ, + int type, int maxAge) { super(world, x, y, z, 0.0D, 0.0D, 0.0D); this.targetX = tX; this.targetY = tY; @@ -378,39 +367,16 @@ public class Particles { this.particleMaxAge = maxAge; } - public AdvancedSeekerParticle( - World world, - double x, - double y, - double z, - double tX, - double tY, - double tZ, - int type, - float red, - float green, - float blue, - int maxAge) { + public AdvancedSeekerParticle(World world, double x, double y, double z, double tX, double tY, double tZ, + int type, float red, float green, float blue, int maxAge) { this(world, x, y, z, tX, tY, tZ, type, maxAge); this.particleRed = red; this.particleGreen = green; this.particleBlue = blue; } - public AdvancedSeekerParticle( - World world, - double x, - double y, - double z, - double tX, - double tY, - double tZ, - int type, - float red, - float green, - float blue, - int maxAge, - int timer) { + public AdvancedSeekerParticle(World world, double x, double y, double z, double tX, double tY, double tZ, + int type, float red, float green, float blue, int maxAge, int timer) { this(world, x, y, z, tX, tY, tZ, type, maxAge); this.particleRed = red; this.particleGreen = green; @@ -516,8 +482,7 @@ public class Particles { motionY = (motionY * directMotT) + (targetY - posY) * directMotMod; motionZ = (motionZ * directMotT) + (targetZ - posZ) * directMotMod; - if (particleMaxAge - particleAge < 40 - && timer > 2300 + if (particleMaxAge - particleAge < 40 && timer > 2300 && (particleRed == 1F || (particleGreen == 1f && particleBlue == 1f))) { double yChange = (double) (timer - 2300); // setPosition(posX, targetY + yChange, posZ); @@ -538,13 +503,7 @@ public class Particles { @Override @SideOnly(Side.CLIENT) - public void renderParticle( - Tessellator tesselator, - float par2, - float par3, - float par4, - float par5, - float par6, + public void renderParticle(Tessellator tesselator, float par2, float par3, float par4, float par5, float par6, float par7) { // Note U=X V=Y tesselator.draw(); @@ -560,10 +519,10 @@ public class Particles { float minV = vIndex * 0.125F; float maxV = (vIndex + 1) * 0.125F; - // float minU = 0.0F + 0F;//(float)this.particleTextureIndexX / 32.0F; - // float maxU = 0.0F + 0.1245F;//minU + 0.124F; - // float minV = 0F;//(float)this.particleTextureIndexY / 32.0F; - // float maxV = 0.1245F;//minV + 0.124F; + // float minU = 0.0F + 0F;//(float)this.particleTextureIndexX / 32.0F; + // float maxU = 0.0F + 0.1245F;//minU + 0.124F; + // float minV = 0F;//(float)this.particleTextureIndexY / 32.0F; + // float maxV = 0.1245F;//minV + 0.124F; float drawScale = 0.1F * this.particleScale; if (this.particleIcon != null) { @@ -613,6 +572,7 @@ public class Particles { } public static class TransceiverParticle extends EntityFX { + public double targetX; public double targetY; public double targetZ; @@ -651,13 +611,7 @@ public class Particles { @Override @SideOnly(Side.CLIENT) - public void renderParticle( - Tessellator tesselator, - float par2, - float par3, - float par4, - float par5, - float par6, + public void renderParticle(Tessellator tesselator, float par2, float par3, float par4, float par5, float par6, float par7) { // Note U=X V=Y tesselator.draw(); @@ -722,6 +676,7 @@ public class Particles { } public static class PortalParticle extends EntityFX { + public double targetX; public double targetY; public double targetZ; @@ -768,13 +723,7 @@ public class Particles { @Override @SideOnly(Side.CLIENT) - public void renderParticle( - Tessellator tesselator, - float par2, - float par3, - float par4, - float par5, - float par6, + public void renderParticle(Tessellator tesselator, float par2, float par3, float par4, float par5, float par6, float par7) { // Note U=X V=Y tesselator.draw(); @@ -837,15 +786,15 @@ public class Particles { } public static class ReactorExplosionParticle extends EntityFX { + public static IModelCustom uvSphere; public double size = 0; public double maxSize; public ReactorExplosionParticle(World world, double x, double y, double z, double maxSize) { super(world, x, y, z, 0D, 0D, 0D); - if (uvSphere == null) - uvSphere = AdvancedModelLoader.loadModel( - new ResourceLocation(References.MODID.toLowerCase(), "models/reactorCoreModel.obj")); + if (uvSphere == null) uvSphere = AdvancedModelLoader + .loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/reactorCoreModel.obj")); this.maxSize = maxSize; } @@ -864,14 +813,8 @@ public class Particles { @Override @SideOnly(Side.CLIENT) - public void renderParticle( - Tessellator tessellator, - float partialTick, - float par3, - float par4, - float par5, - float par6, - float par7) { // Note U=X V=Y + public void renderParticle(Tessellator tessellator, float partialTick, float par3, float par4, float par5, + float par6, float par7) { // Note U=X V=Y tessellator.draw(); GL11.glPushMatrix(); @@ -973,15 +916,15 @@ public class Particles { } public static class ChaosImplosionParticle extends EntityFX { + public static IModelCustom uvSphere; public double size = 0; public double maxSize; public ChaosImplosionParticle(World world, double x, double y, double z, double maxSize) { super(world, x, y, z, 0D, 0D, 0D); - if (uvSphere == null) - uvSphere = AdvancedModelLoader.loadModel( - new ResourceLocation(References.MODID.toLowerCase(), "models/reactorCoreModel.obj")); + if (uvSphere == null) uvSphere = AdvancedModelLoader + .loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/reactorCoreModel.obj")); this.maxSize = maxSize; } @@ -1000,14 +943,8 @@ public class Particles { @Override @SideOnly(Side.CLIENT) - public void renderParticle( - Tessellator tessellator, - float partialTick, - float par3, - float par4, - float par5, - float par6, - float par7) { // Note U=X V=Y + public void renderParticle(Tessellator tessellator, float partialTick, float par3, float par4, float par5, + float par6, float par7) { // Note U=X V=Y tessellator.draw(); GL11.glPushMatrix(); @@ -1033,13 +970,13 @@ public class Particles { if (a > 0) uvSphere.renderAll(); GL11.glPopMatrix(); - // //Disk - // GL11.glPushMatrix(); - // a = (float)Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D)); - // GL11.glColor4f(1F, 1F, 1F, a); - // GL11.glScaled(2, 0.2, 2); - // if (a > 0)uvSphere.renderAll(); - // GL11.glPopMatrix(); + // //Disk + // GL11.glPushMatrix(); + // a = (float)Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D)); + // GL11.glColor4f(1F, 1F, 1F, a); + // GL11.glScaled(2, 0.2, 2); + // if (a > 0)uvSphere.renderAll(); + // GL11.glPopMatrix(); // Synced edge GL11.glPushMatrix(); @@ -1109,6 +1046,7 @@ public class Particles { } public static class DragonProjectileParticle extends EntityFX { + private EntityDragonProjectile entity; private int particleColour; @@ -1134,8 +1072,8 @@ public class Particles { // super.onUpdate(); if (particleAge >= particleMaxAge) setDead(); // - // double d1 = Utills.getDistanceAtoB(startX, startY, startZ, targetX, targetY, targetZ); - // double d2 = Utills.getDistanceAtoB(posX, posY, posZ, targetX, targetY, targetZ); + // double d1 = Utills.getDistanceAtoB(startX, startY, startZ, targetX, targetY, targetZ); + // double d2 = Utills.getDistanceAtoB(posX, posY, posZ, targetX, targetY, targetZ); // particleScale = ((float) (d2 / d1)) * baseScale; particleAlpha = (1F - (float) ((double) particleAge / particleMaxAge)); @@ -1150,13 +1088,7 @@ public class Particles { @Override @SideOnly(Side.CLIENT) - public void renderParticle( - Tessellator tesselator, - float par2, - float par3, - float par4, - float par5, - float par6, + public void renderParticle(Tessellator tesselator, float par2, float par3, float par4, float par5, float par6, float par7) { // Note U=X V=Y tesselator.draw(); ResourceHandler.bindParticles(); @@ -1231,8 +1163,8 @@ public class Particles { private int mode; - public ChaosBoltParticle( - World world, double x, double y, double z, double shardX, double shardY, double shardZ, int mode) { + public ChaosBoltParticle(World world, double x, double y, double z, double shardX, double shardY, double shardZ, + int mode) { super(world, x, y, z, 0.0D, 0.0D, 0.0D); this.focalX = x; this.focalY = y; @@ -1296,13 +1228,7 @@ public class Particles { @Override @SideOnly(Side.CLIENT) - public void renderParticle( - Tessellator tesselator, - float par2, - float par3, - float par4, - float par5, - float par6, + public void renderParticle(Tessellator tesselator, float par2, float par3, float par4, float par5, float par6, float par7) { // Note U=X V=Y tesselator.draw(); @@ -1366,6 +1292,7 @@ public class Particles { } public static class ChaosExpansionParticle extends EntityFX { + public static IModelCustom uvSphere; private final boolean shrink; public double size = 0; @@ -1374,9 +1301,8 @@ public class Particles { public ChaosExpansionParticle(World world, double x, double y, double z, boolean shrink) { super(world, x, y, z, 0D, 0D, 0D); this.shrink = shrink; - if (uvSphere == null) - uvSphere = AdvancedModelLoader.loadModel( - new ResourceLocation(References.MODID.toLowerCase(), "models/reactorCoreModel.obj")); + if (uvSphere == null) uvSphere = AdvancedModelLoader + .loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/reactorCoreModel.obj")); if (shrink) { size = 20; } @@ -1396,14 +1322,8 @@ public class Particles { @Override @SideOnly(Side.CLIENT) - public void renderParticle( - Tessellator tessellator, - float partialTick, - float par3, - float par4, - float par5, - float par6, - float par7) { // Note U=X V=Y + public void renderParticle(Tessellator tessellator, float partialTick, float par3, float par4, float par5, + float par6, float par7) { // Note U=X V=Y tessellator.draw(); GL11.glPushMatrix(); @@ -1434,6 +1354,7 @@ public class Particles { } public static class ArrowParticle extends EntityFX { + private int particleColour; private float setScale; @@ -1463,13 +1384,7 @@ public class Particles { @Override @SideOnly(Side.CLIENT) - public void renderParticle( - Tessellator tesselator, - float par2, - float par3, - float par4, - float par5, - float par6, + public void renderParticle(Tessellator tesselator, float par2, float par3, float par4, float par5, float par6, float par7) { // Note U=X V=Y tesselator.draw(); ResourceHandler.bindParticles(); @@ -1533,15 +1448,15 @@ public class Particles { } public static class ArrowShockParticle extends EntityFX { + public static IModelCustom uvSphere; public double size = 0; public double maxSize; public ArrowShockParticle(World world, double x, double y, double z, int maxSize) { super(world, x, y, z, 0D, 0D, 0D); - if (uvSphere == null) - uvSphere = AdvancedModelLoader.loadModel( - new ResourceLocation(References.MODID.toLowerCase(), "models/reactorCoreModel.obj")); + if (uvSphere == null) uvSphere = AdvancedModelLoader + .loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/reactorCoreModel.obj")); this.maxSize = maxSize / 100D; } @@ -1560,14 +1475,8 @@ public class Particles { @Override @SideOnly(Side.CLIENT) - public void renderParticle( - Tessellator tessellator, - float partialTick, - float par3, - float par4, - float par5, - float par6, - float par7) { // Note U=X V=Y + public void renderParticle(Tessellator tessellator, float partialTick, float par3, float par4, float par5, + float par6, float par7) { // Note U=X V=Y tessellator.draw(); GL11.glPushMatrix(); @@ -1592,13 +1501,13 @@ public class Particles { // if (a > 0)uvSphere.renderAll(); GL11.glPopMatrix(); - // //Disk - // GL11.glPushMatrix(); - // a = (float)Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D)); - // GL11.glColor4f(1F, 1F, 1F, a); - // GL11.glScaled(2, 0.2, 2); - // if (a > 0)uvSphere.renderAll(); - // GL11.glPopMatrix(); + // //Disk + // GL11.glPushMatrix(); + // a = (float)Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D)); + // GL11.glColor4f(1F, 1F, 1F, a); + // GL11.glScaled(2, 0.2, 2); + // if (a > 0)uvSphere.renderAll(); + // GL11.glPopMatrix(); // Synced edge GL11.glPushMatrix(); @@ -1607,59 +1516,59 @@ public class Particles { if (a > 0) uvSphere.renderAll(); GL11.glPopMatrix(); - // GL11.glScalef(1.5F, 1.5F, 1.5F); + // GL11.glScalef(1.5F, 1.5F, 1.5F); // - // //Inner edges - // GL11.glPushMatrix(); - // a = (float)Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D)); - //// GL11.glColor4f(1F, 0.3F, 0F, a); - // GL11.glScaled(0.8, 0.8, 0.8); - //// if (a > 0)uvSphere.renderAll(); + // //Inner edges + // GL11.glPushMatrix(); + // a = (float)Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D)); + //// GL11.glColor4f(1F, 0.3F, 0F, a); + // GL11.glScaled(0.8, 0.8, 0.8); + //// if (a > 0)uvSphere.renderAll(); // - //// GL11.glColor4f(1F, 0.3F, 0F, a); - // GL11.glScaled(0.8, 0.8, 0.8); - //// if (a > 0)uvSphere.renderAll(); + //// GL11.glColor4f(1F, 0.3F, 0F, a); + // GL11.glScaled(0.8, 0.8, 0.8); + //// if (a > 0)uvSphere.renderAll(); // - //// GL11.glColor4f(1F, 0.3F, 0F, a); - // GL11.glScaled(0.7, 0.7, 0.7); - //// if (a > 0)uvSphere.renderAll(); + //// GL11.glColor4f(1F, 0.3F, 0F, a); + // GL11.glScaled(0.7, 0.7, 0.7); + //// if (a > 0)uvSphere.renderAll(); // - //// GL11.glColor4f(1F, 0.3F, 0F, a); - // GL11.glScaled(0.6, 0.6, 0.6); - //// if (a > 0)uvSphere.renderAll(); + //// GL11.glColor4f(1F, 0.3F, 0F, a); + // GL11.glScaled(0.6, 0.6, 0.6); + //// if (a > 0)uvSphere.renderAll(); // - //// GL11.glColor4f(1F, 0.3F, 0F, a); - // GL11.glScaled(0.5, 0.5, 0.5); - //// if (a > 0)uvSphere.renderAll(); + //// GL11.glColor4f(1F, 0.3F, 0F, a); + // GL11.glScaled(0.5, 0.5, 0.5); + //// if (a > 0)uvSphere.renderAll(); // - // GL11.glPopMatrix(); + // GL11.glPopMatrix(); - // for (int i = 0; i < 10; i++) - // { - // GL11.glScalef(0.95F, 0.95F, 0.95F); - // GL11.glPushMatrix(); - // a = (float)Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D)); - // GL11.glColor4f(1F, 1F, 1F, a); - // GL11.glScaled(0.8, 0.6, 0.8); - // if (a > 0)uvSphere.renderAll(); + // for (int i = 0; i < 10; i++) + // { + // GL11.glScalef(0.95F, 0.95F, 0.95F); + // GL11.glPushMatrix(); + // a = (float)Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D)); + // GL11.glColor4f(1F, 1F, 1F, a); + // GL11.glScaled(0.8, 0.6, 0.8); + // if (a > 0)uvSphere.renderAll(); // - // GL11.glColor4f(1F, 1F, 1F, a); - // GL11.glScaled(0.8, 0.7, 0.8); - // if (a > 0)uvSphere.renderAll(); + // GL11.glColor4f(1F, 1F, 1F, a); + // GL11.glScaled(0.8, 0.7, 0.8); + // if (a > 0)uvSphere.renderAll(); // - // GL11.glColor4f(1F, 1F, 1F, a); - // GL11.glScaled(0.7, 0.9, 0.7); - // if (a > 0)uvSphere.renderAll(); + // GL11.glColor4f(1F, 1F, 1F, a); + // GL11.glScaled(0.7, 0.9, 0.7); + // if (a > 0)uvSphere.renderAll(); // - // GL11.glColor4f(1F, 1F, 1F, a); - // GL11.glScaled(0.6, 0.9, 0.6); - // if (a > 0)uvSphere.renderAll(); + // GL11.glColor4f(1F, 1F, 1F, a); + // GL11.glScaled(0.6, 0.9, 0.6); + // if (a > 0)uvSphere.renderAll(); // - // GL11.glColor4f(1F, 1F, 1F, a); - // GL11.glScaled(0.5, 0.9, 0.5); - // if (a > 0)uvSphere.renderAll(); - // GL11.glPopMatrix(); - // } + // GL11.glColor4f(1F, 1F, 1F, a); + // GL11.glScaled(0.5, 0.9, 0.5); + // if (a > 0)uvSphere.renderAll(); + // GL11.glPopMatrix(); + // } GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPopMatrix(); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileChaosShard.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileChaosShard.java index dc446e8c..a5c65397 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileChaosShard.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileChaosShard.java @@ -1,7 +1,5 @@ package com.brandon3055.draconicevolution.client.render.tile; -import com.brandon3055.draconicevolution.client.handler.ResourceHandler; -import com.brandon3055.draconicevolution.common.tileentities.TileChaosShard; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; @@ -9,14 +7,19 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MathHelper; import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; + import org.lwjgl.opengl.GL11; +import com.brandon3055.draconicevolution.client.handler.ResourceHandler; +import com.brandon3055.draconicevolution.common.tileentities.TileChaosShard; + /** * Created by brandon3055 on 24/9/2015. */ public class RenderTileChaosShard extends TileEntitySpecialRenderer { - public static IModelCustom model = - AdvancedModelLoader.loadModel(ResourceHandler.getResource("models/chaosCrystal.obj")); + + public static IModelCustom model = AdvancedModelLoader + .loadModel(ResourceHandler.getResource("models/chaosCrystal.obj")); @Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float tick) { diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileCrystal.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileCrystal.java index 5557be22..11b15daa 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileCrystal.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileCrystal.java @@ -1,11 +1,5 @@ package com.brandon3055.draconicevolution.client.render.tile; -import com.brandon3055.draconicevolution.client.handler.ClientEventHandler; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyRelay; -import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyTransceiver; -import com.brandon3055.draconicevolution.common.tileentities.energynet.TileRemoteEnergyBase; -import com.brandon3055.draconicevolution.common.tileentities.energynet.TileWirelessEnergyTransceiver; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; @@ -13,32 +7,45 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; + import org.lwjgl.opengl.GL11; +import com.brandon3055.draconicevolution.client.handler.ClientEventHandler; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyRelay; +import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyTransceiver; +import com.brandon3055.draconicevolution.common.tileentities.energynet.TileRemoteEnergyBase; +import com.brandon3055.draconicevolution.common.tileentities.energynet.TileWirelessEnergyTransceiver; + /** * Created by Brandon on 31/01/2015. */ public class RenderTileCrystal extends TileEntitySpecialRenderer { - private static ResourceLocation texrure = - new ResourceLocation(References.MODID.toLowerCase(), "textures/models/CrystalPurpleTransparent.png"); - private static ResourceLocation crystalBlue = - new ResourceLocation(References.MODID.toLowerCase(), "textures/models/CrystalBlue.png"); - private static ResourceLocation crystalBlueAlpha = - new ResourceLocation(References.MODID.toLowerCase(), "textures/models/CrystalBlueAlpha.png"); - private static ResourceLocation crystalRed = - new ResourceLocation(References.MODID.toLowerCase(), "textures/models/CrystalRed.png"); - private static ResourceLocation crystalRedAlpha = - new ResourceLocation(References.MODID.toLowerCase(), "textures/models/CrystalRedAlpha.png"); + private static ResourceLocation texrure = new ResourceLocation( + References.MODID.toLowerCase(), + "textures/models/CrystalPurpleTransparent.png"); + private static ResourceLocation crystalBlue = new ResourceLocation( + References.MODID.toLowerCase(), + "textures/models/CrystalBlue.png"); + private static ResourceLocation crystalBlueAlpha = new ResourceLocation( + References.MODID.toLowerCase(), + "textures/models/CrystalBlueAlpha.png"); + private static ResourceLocation crystalRed = new ResourceLocation( + References.MODID.toLowerCase(), + "textures/models/CrystalRed.png"); + private static ResourceLocation crystalRedAlpha = new ResourceLocation( + References.MODID.toLowerCase(), + "textures/models/CrystalRedAlpha.png"); private IModelCustom modelCrystal; private IModelCustom modelCrystalTransceiver; public RenderTileCrystal() { - modelCrystal = AdvancedModelLoader.loadModel( - new ResourceLocation(References.MODID.toLowerCase(), "models/CCrystal.obj")); - modelCrystalTransceiver = AdvancedModelLoader.loadModel( - new ResourceLocation(References.MODID.toLowerCase(), "models/CrystalTransceiver.obj")); + modelCrystal = AdvancedModelLoader + .loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/CCrystal.obj")); + modelCrystalTransceiver = AdvancedModelLoader + .loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/CrystalTransceiver.obj")); } @Override @@ -77,7 +84,7 @@ public class RenderTileCrystal extends TileEntitySpecialRenderer { modelCrystal.renderAll(); GL11.glAlphaFunc(GL11.GL_GREATER, 0f); - // GL11.glDisable(GL11.GL_ALPHA_TEST); + // GL11.glDisable(GL11.GL_ALPHA_TEST); // --- Render Overlay ---// bindTexture(texrure); @@ -121,7 +128,7 @@ public class RenderTileCrystal extends TileEntitySpecialRenderer { GL11.glTranslated(0, -1, 0); GL11.glDisable(GL11.GL_LIGHTING); - // RenderHelper.disableStandardItemLighting(); + // RenderHelper.disableStandardItemLighting(); GL11.glEnable(GL11.GL_BLEND); float innerLight = 100f; float outerLight = 140f + ClientEventHandler.energyCrystalAlphaValue * 40F; @@ -152,7 +159,7 @@ public class RenderTileCrystal extends TileEntitySpecialRenderer { // --- Post Render ---// GL11.glDisable(GL11.GL_BLEND); - // RenderHelper.enableStandardItemLighting(); + // RenderHelper.enableStandardItemLighting(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1f); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileCustomSpawner.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileCustomSpawner.java index 0afdb102..825e2428 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileCustomSpawner.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileCustomSpawner.java @@ -3,20 +3,24 @@ package com.brandon3055.draconicevolution.client.render.tile; /** * Created by Brandon on 5/07/2014. */ -import com.brandon3055.draconicevolution.client.handler.ResourceHandler; -import com.brandon3055.draconicevolution.common.tileentities.CustomSpawnerBaseLogic; -import com.brandon3055.draconicevolution.common.tileentities.TileCustomSpawner; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; + import org.lwjgl.opengl.GL11; +import com.brandon3055.draconicevolution.client.handler.ResourceHandler; +import com.brandon3055.draconicevolution.common.tileentities.CustomSpawnerBaseLogic; +import com.brandon3055.draconicevolution.common.tileentities.TileCustomSpawner; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + @SideOnly(Side.CLIENT) public class RenderTileCustomSpawner extends TileEntitySpecialRenderer { + public void renderTileEntityAt(TileCustomSpawner tile, double x, double y, double z, float p_147518_8_) { GL11.glPushMatrix(); GL11.glTranslatef((float) x + 0.5F, (float) y, (float) z + 0.5F); @@ -24,8 +28,8 @@ public class RenderTileCustomSpawner extends TileEntitySpecialRenderer { GL11.glPopMatrix(); } - public void renderTile( - CustomSpawnerBaseLogic customSpawnerBaseLogic, double x, double y, double z, float partialTick) { + public void renderTile(CustomSpawnerBaseLogic customSpawnerBaseLogic, double x, double y, double z, + float partialTick) { Tessellator tessellator = Tessellator.instance; Entity entity = customSpawnerBaseLogic.getEntityForRenderer(); @@ -38,8 +42,8 @@ public class RenderTileCustomSpawner extends TileEntitySpecialRenderer { GL11.glTranslatef(0.0F, 0.4F, 0.0F); GL11.glRotatef( (float) (customSpawnerBaseLogic.renderRotation1 - + (customSpawnerBaseLogic.renderRotation0 - customSpawnerBaseLogic.renderRotation1) - * (double) partialTick) + + (customSpawnerBaseLogic.renderRotation0 - customSpawnerBaseLogic.renderRotation1) + * (double) partialTick) * 10.0F, 0.0F, 1.0F, @@ -93,8 +97,8 @@ public class RenderTileCustomSpawner extends TileEntitySpecialRenderer { } @Override - public void renderTileEntityAt( - TileEntity p_147500_1_, double p_147500_2_, double p_147500_4_, double p_147500_6_, float p_147500_8_) { + public void renderTileEntityAt(TileEntity p_147500_1_, double p_147500_2_, double p_147500_4_, double p_147500_6_, + float p_147500_8_) { this.renderTileEntityAt((TileCustomSpawner) p_147500_1_, p_147500_2_, p_147500_4_, p_147500_6_, p_147500_8_); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileDissEnchanter.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileDissEnchanter.java index ff111cab..e3a4f6b6 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileDissEnchanter.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileDissEnchanter.java @@ -1,6 +1,5 @@ package com.brandon3055.draconicevolution.client.render.tile; -import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; @@ -12,8 +11,11 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; + import org.lwjgl.opengl.GL11; +import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter; + public class RenderTileDissEnchanter extends TileEntitySpecialRenderer { // private final ResourceLocation texture = new ResourceLocation(References.MODID.toLowerCase(), diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileDraconiumChest.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileDraconiumChest.java index fd10744c..7d584d40 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileDraconiumChest.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileDraconiumChest.java @@ -2,23 +2,27 @@ package com.brandon3055.draconicevolution.client.render.tile; import static org.lwjgl.opengl.GL11.*; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; import java.util.Random; + import net.minecraft.client.model.ModelChest; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; + import org.lwjgl.opengl.GL11; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; + /** * Created by Brandon on 25/10/2014. */ public class RenderTileDraconiumChest extends TileEntitySpecialRenderer { ModelChest model; - private final ResourceLocation texture = - new ResourceLocation(References.MODID.toLowerCase(), "textures/models/DraconiumChest.png"); + private final ResourceLocation texture = new ResourceLocation( + References.MODID.toLowerCase(), + "textures/models/DraconiumChest.png"); private Random random; public RenderTileDraconiumChest() { diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEarth.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEarth.java index 0ae4b716..880b51a1 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEarth.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEarth.java @@ -1,8 +1,5 @@ package com.brandon3055.draconicevolution.client.render.tile; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEarth; -import cpw.mods.fml.client.FMLClientHandler; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; @@ -10,20 +7,26 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; + import org.lwjgl.opengl.GL11; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEarth; +import cpw.mods.fml.client.FMLClientHandler; + /** * Created by Brandon on 27/07/2014. */ public class RenderTileEarth extends TileEntitySpecialRenderer { - private static final ResourceLocation iner_model_texture = - new ResourceLocation(References.MODID.toLowerCase(), "textures/models/Earth.png"); + private static final ResourceLocation iner_model_texture = new ResourceLocation( + References.MODID.toLowerCase(), + "textures/models/Earth.png"); public static IModelCustom modelCustom; public RenderTileEarth() { - modelCustom = - AdvancedModelLoader.loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/Earth.obj")); + modelCustom = AdvancedModelLoader + .loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/Earth.obj")); } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyInfiser.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyInfiser.java index 510dd7b7..ac6d53dc 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyInfiser.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyInfiser.java @@ -1,7 +1,5 @@ package com.brandon3055.draconicevolution.client.render.tile; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.entity.RenderManager; @@ -11,12 +9,17 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; + import org.lwjgl.opengl.GL11; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser; + public class RenderTileEnergyInfiser extends TileEntitySpecialRenderer { - private final ResourceLocation texture = - new ResourceLocation(References.MODID.toLowerCase(), "textures/models/EnergyInfuserTextureSheet.png"); + private final ResourceLocation texture = new ResourceLocation( + References.MODID.toLowerCase(), + "textures/models/EnergyInfuserTextureSheet.png"); private static float pxl = 1F / 256F; @@ -149,8 +152,8 @@ public class RenderTileEnergyInfiser extends TileEntitySpecialRenderer { GL11.glPopMatrix(); } - public static void render2DWithThicness( - Tessellator tess, float maxU, float minV, float minU, float maxV, int width, int height, float thickness) { + public static void render2DWithThicness(Tessellator tess, float maxU, float minV, float minU, float maxV, int width, + int height, float thickness) { double pix = 1D / 64D; tess.startDrawingQuads(); tess.setNormal(0.0F, 0.0F, 1.0F); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyPylon.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyPylon.java index 8cb7528c..00d6f412 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyPylon.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyPylon.java @@ -1,27 +1,30 @@ package com.brandon3055.draconicevolution.client.render.tile; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyPylon; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; + import org.lwjgl.opengl.GL11; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyPylon; + /** * Created by Brandon on 27/07/2014. */ public class RenderTileEnergyPylon extends TileEntitySpecialRenderer { - private static final ResourceLocation model_texture = - new ResourceLocation(References.MODID.toLowerCase(), "textures/models/pylon_sphere_texture.png"); + private static final ResourceLocation model_texture = new ResourceLocation( + References.MODID.toLowerCase(), + "textures/models/pylon_sphere_texture.png"); private IModelCustom model; public RenderTileEnergyPylon() { - model = AdvancedModelLoader.loadModel( - new ResourceLocation(References.MODID.toLowerCase(), "models/pylon_sphere.obj")); + model = AdvancedModelLoader + .loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/pylon_sphere.obj")); } @Override @@ -97,5 +100,5 @@ public class RenderTileEnergyPylon extends TileEntitySpecialRenderer { GL11.glPopMatrix(); } - // private void renderSphere() + // private void renderSphere() } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyStorageCore.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyStorageCore.java index f18c31f8..b139b351 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyStorageCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyStorageCore.java @@ -1,8 +1,5 @@ package com.brandon3055.draconicevolution.client.render.tile; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore; -import cpw.mods.fml.client.FMLClientHandler; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; @@ -10,22 +7,29 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; + import org.lwjgl.opengl.GL11; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore; +import cpw.mods.fml.client.FMLClientHandler; + /** * Created by Brandon on 27/07/2014. */ public class RenderTileEnergyStorageCore extends TileEntitySpecialRenderer { - private static final ResourceLocation iner_model_texture = - new ResourceLocation(References.MODID.toLowerCase(), "textures/models/power_sphere_layer_1.png"); - private static final ResourceLocation outer_model_texture = - new ResourceLocation(References.MODID.toLowerCase(), "textures/models/power_sphere_layer_2.png"); + private static final ResourceLocation iner_model_texture = new ResourceLocation( + References.MODID.toLowerCase(), + "textures/models/power_sphere_layer_1.png"); + private static final ResourceLocation outer_model_texture = new ResourceLocation( + References.MODID.toLowerCase(), + "textures/models/power_sphere_layer_2.png"); private IModelCustom iner_model; public RenderTileEnergyStorageCore() { - iner_model = AdvancedModelLoader.loadModel( - new ResourceLocation(References.MODID.toLowerCase(), "models/power_sphere_layer_1.obj")); + iner_model = AdvancedModelLoader + .loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/power_sphere_layer_1.obj")); } @Override @@ -81,19 +85,19 @@ public class RenderTileEnergyStorageCore extends TileEntitySpecialRenderer { iner_model.renderAll(); GL11.glPopMatrix(); - // GL11.glPushMatrix(); - // GL11.glScalef(0.8F, 0.8F, 0.8F); - // GL11.glColor4d(1F, 1f, 0.2f, 1F); - // GL11.glRotatef(rotation, 0F, 1F, 0.5F); - // //iner_model.renderAll(); - // GL11.glPopMatrix(); + // GL11.glPushMatrix(); + // GL11.glScalef(0.8F, 0.8F, 0.8F); + // GL11.glColor4d(1F, 1f, 0.2f, 1F); + // GL11.glRotatef(rotation, 0F, 1F, 0.5F); + // //iner_model.renderAll(); + // GL11.glPopMatrix(); // - // GL11.glPushMatrix(); - // GL11.glScalef(0.9F, 0.9F, 0.9F); - // GL11.glColor4d(1F, 0f, 0.2f, 1F); - // GL11.glRotatef(rotation, 0F, 1F, 0.5F); - // //iner_model.renderAll(); - // GL11.glPopMatrix(); + // GL11.glPushMatrix(); + // GL11.glScalef(0.9F, 0.9F, 0.9F); + // GL11.glColor4d(1F, 0f, 0.2f, 1F); + // GL11.glRotatef(rotation, 0F, 1F, 0.5F); + // //iner_model.renderAll(); + // GL11.glPopMatrix(); GL11.glScalef(1.1F, 1.1F, 1.1F); GL11.glDepthMask(false); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileParticleGen.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileParticleGen.java index d5f776b8..92643d10 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileParticleGen.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileParticleGen.java @@ -1,11 +1,5 @@ package com.brandon3055.draconicevolution.client.render.tile; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.tileentities.TileParticleGenerator; -import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore; -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; @@ -14,24 +8,36 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; + import org.lwjgl.opengl.GL11; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.tileentities.TileParticleGenerator; +import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore; + +import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + @SideOnly(Side.CLIENT) public class RenderTileParticleGen extends TileEntitySpecialRenderer { - private final ResourceLocation texture = - new ResourceLocation(References.MODID.toLowerCase(), "textures/models/ParticleGenTextureSheet.png"); - private final ResourceLocation beamTexture = - new ResourceLocation(References.MODID.toLowerCase(), "textures/models/stabilizer_beam.png"); - private static final ResourceLocation modelTexture = - new ResourceLocation(References.MODID.toLowerCase(), "textures/models/stabilizer_sphere.png"); + private final ResourceLocation texture = new ResourceLocation( + References.MODID.toLowerCase(), + "textures/models/ParticleGenTextureSheet.png"); + private final ResourceLocation beamTexture = new ResourceLocation( + References.MODID.toLowerCase(), + "textures/models/stabilizer_beam.png"); + private static final ResourceLocation modelTexture = new ResourceLocation( + References.MODID.toLowerCase(), + "textures/models/stabilizer_sphere.png"); private IModelCustom stabilizerSphereModel; private float pxl = 1F / 64; public RenderTileParticleGen() { - stabilizerSphereModel = AdvancedModelLoader.loadModel( - new ResourceLocation(References.MODID.toLowerCase(), "models/stabilizer_sphere.obj")); + stabilizerSphereModel = AdvancedModelLoader + .loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/stabilizer_sphere.obj")); } @Override @@ -325,8 +331,8 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer { GL11.glPopMatrix(); } - private void drawCornerCube( - Tessellator tess, float x, float y, float z, float FP, boolean inverted, boolean stabalizerMode) { + private void drawCornerCube(Tessellator tess, float x, float y, float z, float FP, boolean inverted, + boolean stabalizerMode) { float srcXMin = inverted ? 38F * pxl : 32F * pxl; float srcYMin = 0F; float srcXMax = inverted ? 44F * pxl : 38F * pxl; @@ -654,8 +660,8 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer { GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(true); // - // GL11.glEnable(GL11.GL_LIGHTING); - // GL11.glEnable(GL11.GL_TEXTURE_2D); + // GL11.glEnable(GL11.GL_LIGHTING); + // GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTilePlacedItem.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTilePlacedItem.java index d31f5be7..2ef40a62 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTilePlacedItem.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTilePlacedItem.java @@ -1,7 +1,5 @@ package com.brandon3055.draconicevolution.client.render.tile; -import com.brandon3055.draconicevolution.common.items.MobSoul; -import com.brandon3055.draconicevolution.common.tileentities.TilePlacedItem; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.entity.RenderManager; @@ -13,8 +11,12 @@ import net.minecraft.item.ItemBow; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; + import org.lwjgl.opengl.GL11; +import com.brandon3055.draconicevolution.common.items.MobSoul; +import com.brandon3055.draconicevolution.common.tileentities.TilePlacedItem; + /** * Created by Brandon on 27/07/2014. */ diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileReactorCore.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileReactorCore.java index f173ba12..2803ac74 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileReactorCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileReactorCore.java @@ -1,47 +1,50 @@ package com.brandon3055.draconicevolution.client.render.tile; -import com.brandon3055.draconicevolution.client.handler.ResourceHandler; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; + import org.lwjgl.opengl.GL11; +import com.brandon3055.draconicevolution.client.handler.ResourceHandler; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore; + /** * Created by Brandon on 16/6/2015. */ public class RenderTileReactorCore extends TileEntitySpecialRenderer { + public static IModelCustom reactorModel; public RenderTileReactorCore() { - reactorModel = AdvancedModelLoader.loadModel( - new ResourceLocation(References.MODID.toLowerCase(), "models/reactorCoreModel.obj")); + reactorModel = AdvancedModelLoader + .loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/reactorCoreModel.obj")); } @Override public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick) { TileReactorCore tile = (TileReactorCore) tileEntity; - // tile.renderList.clear(); + // tile.renderList.clear(); GL11.glPushMatrix(); GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5); renderReactorCore(tile, partialTick); - // for (MultiblockHelper.TileOffset offset : tile.stabilizerLocations){ - // if (!(offset.getTileEntity(tileEntity) instanceof TileReactorStabilizer)) continue; - // GL11.glPushMatrix(); + // for (MultiblockHelper.TileOffset offset : tile.stabilizerLocations){ + // if (!(offset.getTileEntity(tileEntity) instanceof TileReactorStabilizer)) continue; + // GL11.glPushMatrix(); // - // TileReactorStabilizer stabilizer = (TileReactorStabilizer)offset.getTileEntity(tileEntity); - // GL11.glTranslated(-offset.offsetX, -offset.offsetY, -offset.offsetZ); - // //RenderTileReactorStabilizer.renderCore(stabilizer, partialTick); - // //RenderTileReactorStabilizer.renderEffects(stabilizer, partialTick); + // TileReactorStabilizer stabilizer = (TileReactorStabilizer)offset.getTileEntity(tileEntity); + // GL11.glTranslated(-offset.offsetX, -offset.offsetY, -offset.offsetZ); + // //RenderTileReactorStabilizer.renderCore(stabilizer, partialTick); + // //RenderTileReactorStabilizer.renderEffects(stabilizer, partialTick); // - // GL11.glPopMatrix(); - // } + // GL11.glPopMatrix(); + // } GL11.glPopMatrix(); } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileReactorEnergyInjector.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileReactorEnergyInjector.java index 83bed45d..29f76be3 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileReactorEnergyInjector.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileReactorEnergyInjector.java @@ -1,11 +1,13 @@ package com.brandon3055.draconicevolution.client.render.tile; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; + +import org.lwjgl.opengl.GL11; + import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.client.model.ModelReactorEnergyInjector; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorEnergyInjector; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.tileentity.TileEntity; -import org.lwjgl.opengl.GL11; /** * Created by Brandon on 6/7/2015. diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileReactorStabilizer.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileReactorStabilizer.java index ea957648..0e7f2d0f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileReactorStabilizer.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileReactorStabilizer.java @@ -1,12 +1,14 @@ package com.brandon3055.draconicevolution.client.render.tile; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; + +import org.lwjgl.opengl.GL11; + import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.client.model.ModelReactorStabilizerCore; import com.brandon3055.draconicevolution.client.model.ModelReactorStabilizerRing; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorStabilizer; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.tileentity.TileEntity; -import org.lwjgl.opengl.GL11; /** * Created by Brandon on 6/7/2015. @@ -62,75 +64,75 @@ public class RenderTileReactorStabilizer extends TileEntitySpecialRenderer { GL11.glPopMatrix(); } - // public static void renderEffects(TileReactorStabilizer tile, float partialTick) { - // if (tile.isValid) - // { - // //Common Fields - // MultiblockHelper.TileLocation master = tile.masterLocation; - // float offsetX = (float)(master.posX - tile.xCoord); - // float offsetY = (float)((double)master.posY - tile.yCoord); - // float offsetZ = (float)(master.posZ - tile.zCoord); - // float length = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ); + // public static void renderEffects(TileReactorStabilizer tile, float partialTick) { + // if (tile.isValid) + // { + // //Common Fields + // MultiblockHelper.TileLocation master = tile.masterLocation; + // float offsetX = (float)(master.posX - tile.xCoord); + // float offsetY = (float)((double)master.posY - tile.yCoord); + // float offsetZ = (float)(master.posZ - tile.zCoord); + // float length = MathHelper.sqrt_float(offsetX * offsetX + offsetY * offsetY + offsetZ * offsetZ); // - // Tessellator tessellator = Tessellator.instance; + // Tessellator tessellator = Tessellator.instance; // - // //Pre Render - // GL11.glPushMatrix(); - //// RenderHelper.disableStandardItemLighting(); - // GL11.glDisable(GL11.GL_CULL_FACE); - // GL11.glShadeModel(GL11.GL_SMOOTH); - // GL11.glEnable(GL11.GL_BLEND); - // OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); - // GL11.glAlphaFunc(GL11.GL_GREATER, 0.0F); - // GL11.glDisable(GL11.GL_LIGHTING); - // GL11.glDepthMask(false); + // //Pre Render + // GL11.glPushMatrix(); + //// RenderHelper.disableStandardItemLighting(); + // GL11.glDisable(GL11.GL_CULL_FACE); + // GL11.glShadeModel(GL11.GL_SMOOTH); + // GL11.glEnable(GL11.GL_BLEND); + // OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); + // GL11.glAlphaFunc(GL11.GL_GREATER, 0.0F); + // GL11.glDisable(GL11.GL_LIGHTING); + // GL11.glDepthMask(false); // - // //Rotate beam to face target - // float f7 = MathHelper.sqrt_float(offsetX * offsetX + offsetZ * offsetZ); - // GL11.glRotatef((float) (-Math.atan2((double) offsetZ, (double) offsetX)) * 180.0F / (float) Math.PI - 90.0F, + // //Rotate beam to face target + // float f7 = MathHelper.sqrt_float(offsetX * offsetX + offsetZ * offsetZ); + // GL11.glRotatef((float) (-Math.atan2((double) offsetZ, (double) offsetX)) * 180.0F / (float) Math.PI - 90.0F, // 0.0F, 1.0F, 0.0F); - // GL11.glRotatef((float)(-Math.atan2((double)f7, (double)offsetY)) * 180.0F / (float)Math.PI - 90.0F, 1.0F, 0.0F, + // GL11.glRotatef((float)(-Math.atan2((double)f7, (double)offsetY)) * 180.0F / (float)Math.PI - 90.0F, 1.0F, 0.0F, // 0.0F); // // - // //Draw Beams - // GL11.glPushMatrix(); - // GL11.glTranslated(0, 0, -0.35); - // ResourceHandler.bindTexture(new ResourceLocation("textures/entity/endercrystal/endercrystal_beam.png")); - //// drawBeam(tessellator, 1F, 0.355F, 0.8F, offsetX, offsetY, offsetZ, tile.tick, partialTick, true, false); - // GL11.glPopMatrix(); + // //Draw Beams + // GL11.glPushMatrix(); + // GL11.glTranslated(0, 0, -0.35); + // ResourceHandler.bindTexture(new ResourceLocation("textures/entity/endercrystal/endercrystal_beam.png")); + //// drawBeam(tessellator, 1F, 0.355F, 0.8F, offsetX, offsetY, offsetZ, tile.tick, partialTick, true, false); + // GL11.glPopMatrix(); // - // GL11.glPushMatrix(); - // GL11.glTranslated(0, 0, 0.4526); - // float coreSize = 1.1F; - // float s = 0.355F; - //// drawBeam(tessellator, s/coreSize, coreSize, length - 0.5F, offsetX, offsetY, offsetZ, tile.tick, partialTick, + // GL11.glPushMatrix(); + // GL11.glTranslated(0, 0, 0.4526); + // float coreSize = 1.1F; + // float s = 0.355F; + //// drawBeam(tessellator, s/coreSize, coreSize, length - 0.5F, offsetX, offsetY, offsetZ, tile.tick, partialTick, // false, false); - // GL11.glPopMatrix(); + // GL11.glPopMatrix(); // - //// GL11.glPushMatrix(); - //// GL11.glTranslated(0, 0, -0.35); - //// ResourceHandler.bindTexture(new ResourceLocation("textures/entity/endercrystal/endercrystal_beam.png")); - //// drawBeam(tessellator, 1F, 0.26F, 0.8F, offsetX, offsetY, offsetZ, tile.tick, partialTick, true, true); - //// GL11.glPopMatrix(); + //// GL11.glPushMatrix(); + //// GL11.glTranslated(0, 0, -0.35); + //// ResourceHandler.bindTexture(new ResourceLocation("textures/entity/endercrystal/endercrystal_beam.png")); + //// drawBeam(tessellator, 1F, 0.26F, 0.8F, offsetX, offsetY, offsetZ, tile.tick, partialTick, true, true); + //// GL11.glPopMatrix(); //// - //// GL11.glPushMatrix(); - //// GL11.glTranslated(0, 0, 0.4526); - //// coreSize = 1.1F; - //// s = 0.263F; - //// drawBeam(tessellator, s/coreSize, coreSize, length - 0.5F, offsetX, offsetY, offsetZ, tile.tick, partialTick, + //// GL11.glPushMatrix(); + //// GL11.glTranslated(0, 0, 0.4526); + //// coreSize = 1.1F; + //// s = 0.263F; + //// drawBeam(tessellator, s/coreSize, coreSize, length - 0.5F, offsetX, offsetY, offsetZ, tile.tick, partialTick, // false, true); - //// GL11.glPopMatrix(); + //// GL11.glPopMatrix(); // - // //Post Render - // GL11.glDepthMask(true); - // GL11.glEnable(GL11.GL_LIGHTING); - // GL11.glEnable(GL11.GL_CULL_FACE); - // GL11.glShadeModel(GL11.GL_FLAT); - //// RenderHelper.enableStandardItemLighting(); - // GL11.glDisable(GL11.GL_BLEND); - // GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); - // GL11.glPopMatrix(); - // } - // } + // //Post Render + // GL11.glDepthMask(true); + // GL11.glEnable(GL11.GL_LIGHTING); + // GL11.glEnable(GL11.GL_CULL_FACE); + // GL11.glShadeModel(GL11.GL_FLAT); + //// RenderHelper.enableStandardItemLighting(); + // GL11.glDisable(GL11.GL_BLEND); + // GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); + // GL11.glPopMatrix(); + // } + // } } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileTeleporterStand.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileTeleporterStand.java index b8afb123..1df98f8a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileTeleporterStand.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileTeleporterStand.java @@ -1,13 +1,7 @@ package com.brandon3055.draconicevolution.client.render.tile; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.brandonscore.common.utills.Utills; -import com.brandon3055.draconicevolution.client.model.ModelTeleporterStand; -import com.brandon3055.draconicevolution.common.handler.ConfigHandler; -import com.brandon3055.draconicevolution.common.items.tools.TeleporterMKII; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.tileentities.TileTeleporterStand; import java.awt.*; + import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.FontRenderer; @@ -22,9 +16,18 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.ResourceLocation; + import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.brandonscore.common.utills.Utills; +import com.brandon3055.draconicevolution.client.model.ModelTeleporterStand; +import com.brandon3055.draconicevolution.common.handler.ConfigHandler; +import com.brandon3055.draconicevolution.common.items.tools.TeleporterMKII; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.tileentities.TileTeleporterStand; + /** * Created by Brandon on 25/10/2014. */ @@ -32,8 +35,9 @@ public class RenderTileTeleporterStand extends TileEntitySpecialRenderer { ModelTeleporterStand model = new ModelTeleporterStand(); - private final ResourceLocation texture = - new ResourceLocation(References.MODID.toLowerCase(), "textures/models/TeleporterStand.png"); + private final ResourceLocation texture = new ResourceLocation( + References.MODID.toLowerCase(), + "textures/models/TeleporterStand.png"); @Override public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) { @@ -94,8 +98,7 @@ public class RenderTileTeleporterStand extends TileEntitySpecialRenderer { private void drawNameString(ItemStack item, float rotation, TileEntity tileentity, float f) { EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; MovingObjectPosition mop = player.rayTrace(10, f); - boolean isCursorOver = mop != null - && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK + boolean isCursorOver = mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && mop.blockX == tileentity.xCoord && mop.blockY == tileentity.yCoord && mop.blockZ == tileentity.zCoord; @@ -130,15 +133,16 @@ public class RenderTileTeleporterStand extends TileEntitySpecialRenderer { double yDiff = player.posY - (tileentity.yCoord + 0.5); double zDiff = player.posZ - (tileentity.zCoord + 0.5); double yawAngle = Math.toDegrees(Math.atan2(zDiff, xDiff)); - double pitchAngle = Math.toDegrees(Math.atan2( - yDiff, - Utills.getDistanceAtoB( - player.posX, - player.posY, - player.posZ, - tileentity.xCoord + 0.5, - tileentity.yCoord + 0.5, - tileentity.zCoord + 0.5))); + double pitchAngle = Math.toDegrees( + Math.atan2( + yDiff, + Utills.getDistanceAtoB( + player.posX, + player.posY, + player.posZ, + tileentity.xCoord + 0.5, + tileentity.yCoord + 0.5, + tileentity.zCoord + 0.5))); GL11.glRotated(yawAngle + 90 - rotation, 0, 1, 0); GL11.glRotated(-pitchAngle, 1, 0, 0); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileTestBlock.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileTestBlock.java index 807c72fa..b3a111ac 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileTestBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileTestBlock.java @@ -1,31 +1,35 @@ package com.brandon3055.draconicevolution.client.render.tile; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.tileentities.TileTestBlock; -import cpw.mods.fml.client.FMLClientHandler; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; + import org.lwjgl.opengl.GL11; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.tileentities.TileTestBlock; +import cpw.mods.fml.client.FMLClientHandler; + /** * Created by Brandon on 24/07/2014. */ public class RenderTileTestBlock extends TileEntitySpecialRenderer { - private static final ResourceLocation iner_model_texture = - new ResourceLocation(References.MODID.toLowerCase(), "textures/models/power_sphere_layer_1.png"); - private static final ResourceLocation outer_model_texture = - new ResourceLocation(References.MODID.toLowerCase(), "textures/models/power_sphere_layer_2.png"); + private static final ResourceLocation iner_model_texture = new ResourceLocation( + References.MODID.toLowerCase(), + "textures/models/power_sphere_layer_1.png"); + private static final ResourceLocation outer_model_texture = new ResourceLocation( + References.MODID.toLowerCase(), + "textures/models/power_sphere_layer_2.png"); private IModelCustom iner_model; private IModelCustom outer_model; public RenderTileTestBlock() { - iner_model = AdvancedModelLoader.loadModel( - new ResourceLocation(References.MODID.toLowerCase(), "models/power_sphere_layer_1.obj")); + iner_model = AdvancedModelLoader + .loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/power_sphere_layer_1.obj")); // outer_model = AdvancedModelLoader.loadModel(new ResourceLocation(References.MODID.toLowerCase(), // "models/power_sphere_layer_2.obj")); } diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileUpgradeModifier.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileUpgradeModifier.java index 386286b8..739a401b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileUpgradeModifier.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileUpgradeModifier.java @@ -1,7 +1,5 @@ package com.brandon3055.draconicevolution.client.render.tile; -import com.brandon3055.draconicevolution.client.handler.ResourceHandler; -import com.brandon3055.draconicevolution.common.tileentities.TileUpgradeModifier; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.entity.RenderManager; @@ -10,8 +8,12 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; + import org.lwjgl.opengl.GL11; +import com.brandon3055.draconicevolution.client.handler.ResourceHandler; +import com.brandon3055.draconicevolution.common.tileentities.TileUpgradeModifier; + public class RenderTileUpgradeModifier extends TileEntitySpecialRenderer { private static float pxl = 1F / 256F; @@ -119,8 +121,8 @@ public class RenderTileUpgradeModifier extends TileEntitySpecialRenderer { GL11.glPopMatrix(); } - public static void render2DWithThicness( - Tessellator tess, float maxU, float minV, float minU, float maxV, int width, int height, float thickness) { + public static void render2DWithThicness(Tessellator tess, float maxU, float minV, float minU, float maxV, int width, + int height, float thickness) { double pix = 1D / 64D; tess.startDrawingQuads(); tess.setNormal(0.0F, 0.0F, 1.0F); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/utill/CustomResourceLocation.java b/src/main/java/com/brandon3055/draconicevolution/client/utill/CustomResourceLocation.java index dfd88816..c867fe3c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/utill/CustomResourceLocation.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/utill/CustomResourceLocation.java @@ -1,8 +1,9 @@ package com.brandon3055.draconicevolution.client.utill; +import net.minecraft.util.ResourceLocation; + import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.common.lib.References; -import net.minecraft.util.ResourceLocation; /** * Created by Brandon on 10/03/2015. diff --git a/src/main/java/com/brandon3055/draconicevolution/common/CommonProxy.java b/src/main/java/com/brandon3055/draconicevolution/common/CommonProxy.java index e3fac50e..06ee8c8e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/CommonProxy.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/CommonProxy.java @@ -1,5 +1,12 @@ package com.brandon3055.draconicevolution.common; +import net.minecraft.client.audio.ISound; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.oredict.OreDictionary; + import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.creativetab.DETab; import com.brandon3055.draconicevolution.client.gui.GuiHandler; @@ -28,6 +35,7 @@ import com.brandon3055.draconicevolution.common.utills.DragonChunkLoader; import com.brandon3055.draconicevolution.common.utills.LogHelper; import com.brandon3055.draconicevolution.common.world.DraconicWorldGenerator; import com.brandon3055.draconicevolution.integration.computers.CCOCIntegration; + import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; @@ -36,12 +44,6 @@ import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; -import net.minecraft.client.audio.ISound; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.oredict.OreDictionary; public class CommonProxy { @@ -58,28 +60,28 @@ public class CommonProxy { DraconicEvolution.reaperEnchant = new EnchantmentReaper(ConfigHandler.reaperEnchantID); // - // Potion[] potionTypes = null; - // LogHelper.info("Expanding Potion array size to 256"); + // Potion[] potionTypes = null; + // LogHelper.info("Expanding Potion array size to 256"); // - // for (Field f : Potion.class.getDeclaredFields()) { - // f.setAccessible(true); + // for (Field f : Potion.class.getDeclaredFields()) { + // f.setAccessible(true); // - // try { - // if (f.getName().equals("potionTypes") || f.getName().equals("field_76425_a")) { - // Field modfield = Field.class.getDeclaredField("modifiers"); - // modfield.setAccessible(true); - // modfield.setInt(f, f.getModifiers() & ~Modifier.FINAL); - // potionTypes = (Potion[]) f.get(null); - // final Potion[] newPotionTypes = new Potion[256]; - // System.arraycopy(potionTypes, 0, newPotionTypes, 0, potionTypes.length); - // f.set(null, newPotionTypes); - // } - // } - // catch (Exception e) { - // LogHelper.error("Severe error, please report this to the mod author:"); - // e.printStackTrace(); - // } - // } + // try { + // if (f.getName().equals("potionTypes") || f.getName().equals("field_76425_a")) { + // Field modfield = Field.class.getDeclaredField("modifiers"); + // modfield.setAccessible(true); + // modfield.setInt(f, f.getModifiers() & ~Modifier.FINAL); + // potionTypes = (Potion[]) f.get(null); + // final Potion[] newPotionTypes = new Potion[256]; + // System.arraycopy(potionTypes, 0, newPotionTypes, 0, potionTypes.length); + // f.set(null, newPotionTypes); + // } + // } + // catch (Exception e) { + // LogHelper.error("Severe error, please report this to the mod author:"); + // e.printStackTrace(); + // } + // } Achievements.addModAchievements(); LogHelper.info("Finished PreInitialization"); @@ -108,96 +110,108 @@ public class CommonProxy { public void initializeNetwork() { DraconicEvolution.network = NetworkRegistry.INSTANCE.newSimpleChannel(DraconicEvolution.networkChannelName); DraconicEvolution.network.registerMessage(ButtonPacket.Handler.class, ButtonPacket.class, 0, Side.SERVER); + DraconicEvolution.network + .registerMessage(ParticleGenPacket.Handler.class, ParticleGenPacket.class, 1, Side.SERVER); + DraconicEvolution.network + .registerMessage(PlacedItemPacket.Handler.class, PlacedItemPacket.class, 2, Side.SERVER); DraconicEvolution.network.registerMessage( - ParticleGenPacket.Handler.class, ParticleGenPacket.class, 1, Side.SERVER); + PlayerDetectorButtonPacket.Handler.class, + PlayerDetectorButtonPacket.class, + 3, + Side.SERVER); DraconicEvolution.network.registerMessage( - PlacedItemPacket.Handler.class, PlacedItemPacket.class, 2, Side.SERVER); - DraconicEvolution.network.registerMessage( - PlayerDetectorButtonPacket.Handler.class, PlayerDetectorButtonPacket.class, 3, Side.SERVER); - DraconicEvolution.network.registerMessage( - PlayerDetectorStringPacket.Handler.class, PlayerDetectorStringPacket.class, 4, Side.SERVER); - DraconicEvolution.network.registerMessage( - TeleporterPacket.Handler.class, TeleporterPacket.class, 5, Side.SERVER); - DraconicEvolution.network.registerMessage( - TileObjectPacket.Handler.class, TileObjectPacket.class, 6, Side.CLIENT); - DraconicEvolution.network.registerMessage( - MountUpdatePacket.Handler.class, MountUpdatePacket.class, 7, Side.CLIENT); - DraconicEvolution.network.registerMessage( - MountUpdatePacket.Handler.class, MountUpdatePacket.class, 8, Side.SERVER); - DraconicEvolution.network.registerMessage( - ItemConfigPacket.Handler.class, ItemConfigPacket.class, 9, Side.SERVER); - DraconicEvolution.network.registerMessage( - TileObjectPacket.Handler.class, TileObjectPacket.class, 10, Side.SERVER); - DraconicEvolution.network.registerMessage( - BlockUpdatePacket.Handler.class, BlockUpdatePacket.class, 11, Side.SERVER); - DraconicEvolution.network.registerMessage( - SpeedRequestPacket.Handler.class, SpeedRequestPacket.class, 12, Side.SERVER); - DraconicEvolution.network.registerMessage( - SpeedRequestPacket.Handler.class, SpeedRequestPacket.class, 13, Side.CLIENT); + PlayerDetectorStringPacket.Handler.class, + PlayerDetectorStringPacket.class, + 4, + Side.SERVER); + DraconicEvolution.network + .registerMessage(TeleporterPacket.Handler.class, TeleporterPacket.class, 5, Side.SERVER); + DraconicEvolution.network + .registerMessage(TileObjectPacket.Handler.class, TileObjectPacket.class, 6, Side.CLIENT); + DraconicEvolution.network + .registerMessage(MountUpdatePacket.Handler.class, MountUpdatePacket.class, 7, Side.CLIENT); + DraconicEvolution.network + .registerMessage(MountUpdatePacket.Handler.class, MountUpdatePacket.class, 8, Side.SERVER); + DraconicEvolution.network + .registerMessage(ItemConfigPacket.Handler.class, ItemConfigPacket.class, 9, Side.SERVER); + DraconicEvolution.network + .registerMessage(TileObjectPacket.Handler.class, TileObjectPacket.class, 10, Side.SERVER); + DraconicEvolution.network + .registerMessage(BlockUpdatePacket.Handler.class, BlockUpdatePacket.class, 11, Side.SERVER); + DraconicEvolution.network + .registerMessage(SpeedRequestPacket.Handler.class, SpeedRequestPacket.class, 12, Side.SERVER); + DraconicEvolution.network + .registerMessage(SpeedRequestPacket.Handler.class, SpeedRequestPacket.class, 13, Side.CLIENT); DraconicEvolution.network.registerMessage(ToolModePacket.Handler.class, ToolModePacket.class, 14, Side.SERVER); - DraconicEvolution.network.registerMessage( - GenericParticlePacket.Handler.class, GenericParticlePacket.class, 15, Side.CLIENT); - DraconicEvolution.network.registerMessage( - ShieldHitPacket.Handler.class, ShieldHitPacket.class, 16, Side.CLIENT); - DraconicEvolution.network.registerMessage( - ContributorPacket.Handler.class, ContributorPacket.class, 17, Side.CLIENT); - DraconicEvolution.network.registerMessage( - ContributorPacket.Handler.class, ContributorPacket.class, 18, Side.SERVER); - DraconicEvolution.network.registerMessage( - MagnetTogglePacket.Handler.class, MagnetTogglePacket.class, 19, Side.SERVER); - DraconicEvolution.network.registerMessage( - MagnetToggleAckPacket.Handler.class, MagnetToggleAckPacket.class, 20, Side.CLIENT); + DraconicEvolution.network + .registerMessage(GenericParticlePacket.Handler.class, GenericParticlePacket.class, 15, Side.CLIENT); + DraconicEvolution.network + .registerMessage(ShieldHitPacket.Handler.class, ShieldHitPacket.class, 16, Side.CLIENT); + DraconicEvolution.network + .registerMessage(ContributorPacket.Handler.class, ContributorPacket.class, 17, Side.CLIENT); + DraconicEvolution.network + .registerMessage(ContributorPacket.Handler.class, ContributorPacket.class, 18, Side.SERVER); + DraconicEvolution.network + .registerMessage(MagnetTogglePacket.Handler.class, MagnetTogglePacket.class, 19, Side.SERVER); + DraconicEvolution.network + .registerMessage(MagnetToggleAckPacket.Handler.class, MagnetToggleAckPacket.class, 20, Side.CLIENT); } public void registerTileEntities() { - GameRegistry.registerTileEntity( - TileWeatherController.class, References.RESOURCESPREFIX + "TileWeatherController"); + GameRegistry + .registerTileEntity(TileWeatherController.class, References.RESOURCESPREFIX + "TileWeatherController"); GameRegistry.registerTileEntity(TileSunDial.class, References.RESOURCESPREFIX + "TileSunDial"); GameRegistry.registerTileEntity(TileGrinder.class, References.RESOURCESPREFIX + "TileGrinder"); GameRegistry.registerTileEntity(TilePotentiometer.class, References.RESOURCESPREFIX + "TilePotentiometer"); - GameRegistry.registerTileEntity( - TileParticleGenerator.class, References.RESOURCESPREFIX + "TileParticleGenerator"); + GameRegistry + .registerTileEntity(TileParticleGenerator.class, References.RESOURCESPREFIX + "TileParticleGenerator"); GameRegistry.registerTileEntity(TilePlayerDetector.class, References.RESOURCESPREFIX + "TilePlayerDetector"); GameRegistry.registerTileEntity( - TilePlayerDetectorAdvanced.class, References.RESOURCESPREFIX + "TilePlayerDetectorAdvanced"); + TilePlayerDetectorAdvanced.class, + References.RESOURCESPREFIX + "TilePlayerDetectorAdvanced"); GameRegistry.registerTileEntity(TileEnergyInfuser.class, References.RESOURCESPREFIX + "TileEnergyInfuser"); GameRegistry.registerTileEntity(TileCustomSpawner.class, References.RESOURCESPREFIX + "TileCustomSpawner"); GameRegistry.registerTileEntity(TileGenerator.class, References.RESOURCESPREFIX + "TileGenerator"); - GameRegistry.registerTileEntity( - TileEnergyStorageCore.class, References.RESOURCESPREFIX + "TileEnergyStorageCore"); + GameRegistry + .registerTileEntity(TileEnergyStorageCore.class, References.RESOURCESPREFIX + "TileEnergyStorageCore"); GameRegistry.registerTileEntity(TileEarth.class, References.RESOURCESPREFIX + "TileEarth"); GameRegistry.registerTileEntity( - TileInvisibleMultiblock.class, References.RESOURCESPREFIX + "TileInvisibleMultiblock"); + TileInvisibleMultiblock.class, + References.RESOURCESPREFIX + "TileInvisibleMultiblock"); GameRegistry.registerTileEntity(TileEnergyPylon.class, References.RESOURCESPREFIX + "TileEnergyPylon"); - GameRegistry.registerTileEntity( - TileEnderResurrection.class, References.RESOURCESPREFIX + "TileEnderResurrection"); + GameRegistry + .registerTileEntity(TileEnderResurrection.class, References.RESOURCESPREFIX + "TileEnderResurrection"); GameRegistry.registerTileEntity(TilePlacedItem.class, References.RESOURCESPREFIX + "TilePlacedItem"); GameRegistry.registerTileEntity(TileCKeyStone.class, References.RESOURCESPREFIX + "TileCKeyStone"); GameRegistry.registerTileEntity(TileDissEnchanter.class, References.RESOURCESPREFIX + "TileDissEnchanter"); GameRegistry.registerTileEntity(TileTeleporterStand.class, References.RESOURCESPREFIX + "TileTeleporterStand"); GameRegistry.registerTileEntity(TileDraconiumChest.class, References.RESOURCESPREFIX + "TileDraconiumChest"); GameRegistry.registerTileEntity(TileEnergyRelay.class, References.RESOURCESPREFIX + "TileEnergyRelay"); + GameRegistry + .registerTileEntity(TileEnergyTransceiver.class, References.RESOURCESPREFIX + "TileEnergyTransceiver"); GameRegistry.registerTileEntity( - TileEnergyTransceiver.class, References.RESOURCESPREFIX + "TileEnergyTransceiver"); + TileWirelessEnergyTransceiver.class, + References.RESOURCESPREFIX + "TileWirelessEnergyTransceiver"); GameRegistry.registerTileEntity( - TileWirelessEnergyTransceiver.class, References.RESOURCESPREFIX + "TileWirelessEnergyTransceiver"); - GameRegistry.registerTileEntity( - TileDislocatorReceptacle.class, References.RESOURCESPREFIX + "TileDislocatorReceptacle"); + TileDislocatorReceptacle.class, + References.RESOURCESPREFIX + "TileDislocatorReceptacle"); GameRegistry.registerTileEntity(TilePortalBlock.class, References.RESOURCESPREFIX + "TilePortalBlock"); GameRegistry.registerTileEntity(TileReactorCore.class, References.RESOURCESPREFIX + "TileReactorCore"); GameRegistry.registerTileEntity(TileFluxGate.class, References.RESOURCESPREFIX + "TileFluxGate"); GameRegistry.registerTileEntity(TileFluidGate.class, References.RESOURCESPREFIX + "TileFluidGate"); + GameRegistry + .registerTileEntity(TileReactorStabilizer.class, References.RESOURCESPREFIX + "TileReactorStabilizer"); GameRegistry.registerTileEntity( - TileReactorStabilizer.class, References.RESOURCESPREFIX + "TileReactorStabilizer"); - GameRegistry.registerTileEntity( - TileReactorEnergyInjector.class, References.RESOURCESPREFIX + "TileReactorEnergyInjector"); + TileReactorEnergyInjector.class, + References.RESOURCESPREFIX + "TileReactorEnergyInjector"); GameRegistry.registerTileEntity(TileChaosShard.class, References.RESOURCESPREFIX + "TileChaosShard"); - GameRegistry.registerTileEntity( - TileUpgradeModifier.class, References.RESOURCESPREFIX + "TileEnhancementModifier"); + GameRegistry + .registerTileEntity(TileUpgradeModifier.class, References.RESOURCESPREFIX + "TileEnhancementModifier"); if (DraconicEvolution.debug) { GameRegistry.registerTileEntity(TileTestBlock.class, References.RESOURCESPREFIX + "TileTestBlock"); GameRegistry.registerTileEntity( - TileContainerTemplate.class, References.RESOURCESPREFIX + "TileContainerTemplate"); + TileContainerTemplate.class, + References.RESOURCESPREFIX + "TileContainerTemplate"); } } @@ -239,56 +253,86 @@ public class CommonProxy { // @Callback public void registerEntities() { EntityRegistry.registerModEntity( - EntityCustomDragon.class, "EnderDragon", 0, DraconicEvolution.instance, 256, 3, true); + EntityCustomDragon.class, + "EnderDragon", + 0, + DraconicEvolution.instance, + 256, + 3, + true); EntityRegistry.registerModEntity( - EntityPersistentItem.class, "Persistent Item", 1, DraconicEvolution.instance, 32, 5, true); - EntityRegistry.registerModEntity( - EntityDraconicArrow.class, "Arrow", 2, DraconicEvolution.instance, 32, 5, true); - EntityRegistry.registerModEntity( - EntityEnderArrow.class, "Ender Arrow", 3, DraconicEvolution.instance, 32, 1, true); + EntityPersistentItem.class, + "Persistent Item", + 1, + DraconicEvolution.instance, + 32, + 5, + true); + EntityRegistry + .registerModEntity(EntityDraconicArrow.class, "Arrow", 2, DraconicEvolution.instance, 32, 5, true); + EntityRegistry + .registerModEntity(EntityEnderArrow.class, "Ender Arrow", 3, DraconicEvolution.instance, 32, 1, true); // EntityRegistry.registerModEntity(EntityChaosDrill.class, "Chaos Drill", 4, DraconicEvolution.instance, 10, 5, // false); EntityRegistry.registerModEntity( - EntityDragonHeart.class, "Dragon Heart Item", 5, DraconicEvolution.instance, 32, 5, true); + EntityDragonHeart.class, + "Dragon Heart Item", + 5, + DraconicEvolution.instance, + 32, + 5, + true); EntityRegistry.registerModEntity( - EntityChaosGuardian.class, "ChaosGuardian", 6, DraconicEvolution.instance, 256, 1, true); + EntityChaosGuardian.class, + "ChaosGuardian", + 6, + DraconicEvolution.instance, + 256, + 1, + true); EntityRegistry.registerModEntity( - EntityDragonProjectile.class, "DragonProjectile", 7, DraconicEvolution.instance, 256, 1, true); + EntityDragonProjectile.class, + "DragonProjectile", + 7, + DraconicEvolution.instance, + 256, + 1, + true); EntityRegistry.registerModEntity( - EntityChaosCrystal.class, "ChaosCrystal", 8, DraconicEvolution.instance, 256, 5, false); + EntityChaosCrystal.class, + "ChaosCrystal", + 8, + DraconicEvolution.instance, + 256, + 5, + false); + EntityRegistry + .registerModEntity(EntityChaosBolt.class, "ChaosBolt", 9, DraconicEvolution.instance, 32, 5, true); EntityRegistry.registerModEntity( - EntityChaosBolt.class, "ChaosBolt", 9, DraconicEvolution.instance, 32, 5, true); + EntityChaosVortex.class, + "EntityChaosEnergyVortex", + 10, + DraconicEvolution.instance, + 512, + 5, + true); EntityRegistry.registerModEntity( - EntityChaosVortex.class, "EntityChaosEnergyVortex", 10, DraconicEvolution.instance, 512, 5, true); - EntityRegistry.registerModEntity( - EntityCustomArrow.class, "CustomArrow", 11, DraconicEvolution.instance, 128, 1, true); + EntityCustomArrow.class, + "CustomArrow", + 11, + DraconicEvolution.instance, + 128, + 1, + true); } - public ParticleEnergyBeam energyBeam( - World worldObj, - double x, - double y, - double z, - double tx, - double ty, - double tz, - int powerFlow, - boolean advanced, - ParticleEnergyBeam oldBeam, - boolean render, - int beamType) { + public ParticleEnergyBeam energyBeam(World worldObj, double x, double y, double z, double tx, double ty, double tz, + int powerFlow, boolean advanced, ParticleEnergyBeam oldBeam, boolean render, int beamType) { return null; } - public ParticleEnergyField energyField( - World worldObj, - double x, - double y, - double z, - int type, - boolean advanced, - ParticleEnergyField oldBeam, - boolean render) { + public ParticleEnergyField energyField(World worldObj, double x, double y, double z, int type, boolean advanced, + ParticleEnergyField oldBeam, boolean render) { return null; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/ModBlocks.java b/src/main/java/com/brandon3055/draconicevolution/common/ModBlocks.java index 17b9e924..db41c341 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/ModBlocks.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/ModBlocks.java @@ -1,5 +1,9 @@ package com.brandon3055.draconicevolution.common; +import net.minecraft.block.Block; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; + import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.blocks.*; import com.brandon3055.draconicevolution.common.blocks.machine.*; @@ -7,12 +11,10 @@ import com.brandon3055.draconicevolution.common.blocks.multiblock.*; import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.lib.References; import cpw.mods.fml.common.registry.GameRegistry; -import net.minecraft.block.Block; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; @GameRegistry.ObjectHolder(References.MODID) public class ModBlocks { + public static BlockDE xRayBlock; public static BlockDE weatherController; public static BlockDE sunDial; @@ -117,8 +119,7 @@ public class ModBlocks { } public static void registerOther(Block block) { - String name = - block.getUnlocalizedName().substring(block.getUnlocalizedName().indexOf(".") + 1); + String name = block.getUnlocalizedName().substring(block.getUnlocalizedName().indexOf(".") + 1); if (isEnabled(block)) GameRegistry.registerBlock(block, name.substring(name.indexOf(":") + 1)); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/ModItems.java b/src/main/java/com/brandon3055/draconicevolution/common/ModItems.java index 45794163..220a979c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/ModItems.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/ModItems.java @@ -1,5 +1,12 @@ package com.brandon3055.draconicevolution.common; +import net.minecraft.item.Item; +import net.minecraft.item.Item.ToolMaterial; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemArmor.ArmorMaterial; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.EnumHelper; + import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.items.*; import com.brandon3055.draconicevolution.common.items.armor.DraconicArmor; @@ -12,19 +19,14 @@ import com.brandon3055.draconicevolution.common.items.weapons.WyvernSword; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; import cpw.mods.fml.common.registry.GameRegistry; -import net.minecraft.item.Item; -import net.minecraft.item.Item.ToolMaterial; -import net.minecraft.item.ItemArmor; -import net.minecraft.item.ItemArmor.ArmorMaterial; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.EnumHelper; @GameRegistry.ObjectHolder(References.MODID) public class ModItems { - public static ArmorMaterial WYVERN_ARMOR = - EnumHelper.addArmorMaterial("WYVERN_ARMOR", -1, new int[] {3, 8, 6, 3}, 30); - public static ArmorMaterial DRACONIC_ARMOR = - EnumHelper.addArmorMaterial("DRACONIC_ARMOR", -1, new int[] {3, 8, 6, 3}, 30); + + public static ArmorMaterial WYVERN_ARMOR = EnumHelper + .addArmorMaterial("WYVERN_ARMOR", -1, new int[] { 3, 8, 6, 3 }, 30); + public static ArmorMaterial DRACONIC_ARMOR = EnumHelper + .addArmorMaterial("DRACONIC_ARMOR", -1, new int[] { 3, 8, 6, 3 }, 30); public static ToolMaterial WYVERN = EnumHelper.addToolMaterial("WYVERN", 10, -1, 12.0F, 20.0F, 35); public static ToolMaterial AWAKENED = EnumHelper.addToolMaterial("AWAKENED", 10, -1, 16.0F, 40.0F, 40); public static ToolMaterial CHAOTIC = EnumHelper.addToolMaterial("CHAOTIC", 10, -1, 400.0F, 60.0F, 45); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/achievements/Achievements.java b/src/main/java/com/brandon3055/draconicevolution/common/achievements/Achievements.java index 6ca9405a..58f155f3 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/achievements/Achievements.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/achievements/Achievements.java @@ -1,11 +1,7 @@ package com.brandon3055.draconicevolution.common.achievements; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.ModItems; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.PlayerEvent; import java.util.HashMap; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.stats.Achievement; @@ -13,6 +9,13 @@ import net.minecraft.util.StatCollector; import net.minecraftforge.common.AchievementPage; import net.minecraftforge.event.entity.player.EntityItemPickupEvent; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.ModItems; + +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.PlayerEvent; + /** * Created by Brandon on 18/11/2014. */ @@ -54,14 +57,12 @@ public class Achievements { addAchievement( "draconicevolution.dust", new Achievement( - "draconicevolution.dust", - "draconicevolution.dust", - -10 + x, - 0, - ModItems.draconiumDust, - null) - .initIndependentStat() - .setSpecial(), + "draconicevolution.dust", + "draconicevolution.dust", + -10 + x, + 0, + ModItems.draconiumDust, + null).initIndependentStat().setSpecial(), "pickup"); addAchievement( "draconicevolution.ingot", @@ -86,13 +87,12 @@ public class Achievements { addAchievement( "draconicevolution.core2", new Achievement( - "draconicevolution.core2", - "draconicevolution.core2", - -4 + x, - 0, - ModItems.wyvernCore, - getAchievement("draconicevolution.core")) - .setSpecial(), + "draconicevolution.core2", + "draconicevolution.core2", + -4 + x, + 0, + ModItems.wyvernCore, + getAchievement("draconicevolution.core")).setSpecial(), "craft"); addAchievement( @@ -269,13 +269,12 @@ public class Achievements { addAchievement( "draconicevolution.heart", new Achievement( - "draconicevolution.heart", - "draconicevolution.heart", - 0 + x, - 0, - ModItems.dragonHeart, - getAchievement("draconicevolution.core2")) - .setSpecial(), + "draconicevolution.heart", + "draconicevolution.heart", + 0 + x, + 0, + ModItems.dragonHeart, + getAchievement("draconicevolution.core2")).setSpecial(), "pickup"); addAchievement( "draconicevolution.awakenedblock", @@ -290,13 +289,12 @@ public class Achievements { addAchievement( "draconicevolution.core3", new Achievement( - "draconicevolution.core3", - "draconicevolution.core3", - 4 + x, - 0, - ModItems.awakenedCore, - getAchievement("draconicevolution.awakenedblock")) - .setSpecial(), + "draconicevolution.core3", + "draconicevolution.core3", + 4 + x, + 0, + ModItems.awakenedCore, + getAchievement("draconicevolution.awakenedblock")).setSpecial(), "craft"); addAchievement( @@ -414,13 +412,12 @@ public class Achievements { addAchievement( "draconicevolution.dstaff", new Achievement( - "draconicevolution.dstaff", - "draconicevolution.dstaff", - 8 + x, - 0, - ModItems.draconicDestructionStaff, - getAchievement("draconicevolution.dpick")) - .setSpecial(), + "draconicevolution.dstaff", + "draconicevolution.dstaff", + 8 + x, + 0, + ModItems.draconicDestructionStaff, + getAchievement("draconicevolution.dpick")).setSpecial(), "craft"); ItemStack mobSoul = new ItemStack(ModItems.mobSoul); @@ -450,7 +447,8 @@ public class Achievements { achievements = achievementsList.values().toArray(achievements); achievementsPage = new AchievementPage( - StatCollector.translateToLocal("draconicevolution.achievementPage.name"), achievements); + StatCollector.translateToLocal("draconicevolution.achievementPage.name"), + achievements); AchievementPage.registerAchievementPage(achievementsPage); } @@ -460,9 +458,7 @@ public class Achievements { stack.stackSize = 1; if (achievementItems.containsKey(stack.getUnlocalizedName()) && achievementItems.get(stack.getUnlocalizedName()).isCorrectCondition("pickup")) { - triggerAchievement( - event.entityPlayer, - achievementItems.get(stack.getUnlocalizedName()).getName()); + triggerAchievement(event.entityPlayer, achievementItems.get(stack.getUnlocalizedName()).getName()); } } @@ -472,9 +468,7 @@ public class Achievements { stack.stackSize = 1; if (achievementItems.containsKey(stack.getUnlocalizedName()) && achievementItems.get(stack.getUnlocalizedName()).isCorrectCondition("craft")) { - triggerAchievement( - event.player, - achievementItems.get(stack.getUnlocalizedName()).getName()); + triggerAchievement(event.player, achievementItems.get(stack.getUnlocalizedName()).getName()); } } @@ -484,13 +478,12 @@ public class Achievements { stack.stackSize = 1; if (achievementItems.containsKey(stack.getUnlocalizedName()) && achievementItems.get(stack.getUnlocalizedName()).isCorrectCondition("smelt")) { - triggerAchievement( - event.player, - achievementItems.get(stack.getUnlocalizedName()).getName()); + triggerAchievement(event.player, achievementItems.get(stack.getUnlocalizedName()).getName()); } } private static class AchievementCondition { + private final String name; public final String condition; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockContainerTemplate.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockContainerTemplate.java index 2377d57f..2b2874e9 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockContainerTemplate.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockContainerTemplate.java @@ -1,14 +1,5 @@ package com.brandon3055.draconicevolution.common.blocks; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.client.gui.GuiHandler; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.tileentities.TileContainerTemplate; -import cpw.mods.fml.common.network.internal.FMLNetworkHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -19,10 +10,22 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.client.gui.GuiHandler; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.tileentities.TileContainerTemplate; + +import cpw.mods.fml.common.network.internal.FMLNetworkHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 27/06/2014. */ public class BlockContainerTemplate extends BlockContainerDE { + public BlockContainerTemplate() { super(Material.iron); this.setBlockName(Strings.containerTemplateName); @@ -45,11 +48,11 @@ public class BlockContainerTemplate extends BlockContainerDE { } @Override - public boolean onBlockActivated( - World world, int x, int y, int z, EntityPlayer player, int side, float prx, float pry, float prz) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float prx, + float pry, float prz) { if (!world.isRemote) { - FMLNetworkHandler.openGui( - player, DraconicEvolution.instance, GuiHandler.GUIID_CONTAINER_TEMPLATE, world, x, y, z); + FMLNetworkHandler + .openGui(player, DraconicEvolution.instance, GuiHandler.GUIID_CONTAINER_TEMPLATE, world, x, y, z); } return true; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockCustomDrop.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockCustomDrop.java index 41dbae8c..e4a0e98f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockCustomDrop.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockCustomDrop.java @@ -1,9 +1,8 @@ package com.brandon3055.draconicevolution.common.blocks; -import com.brandon3055.brandonscore.common.utills.InventoryUtils; -import com.google.common.collect.Lists; import java.util.ArrayList; import java.util.List; + import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; @@ -11,10 +10,14 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import com.brandon3055.brandonscore.common.utills.InventoryUtils; +import com.google.common.collect.Lists; + /** * Created by Brandon on 13/11/2014. */ public abstract class BlockCustomDrop extends BlockContainerDE { + public BlockCustomDrop(final Material material) { super(material); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockDE.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockDE.java index c7469d05..504951bc 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockDE.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockDE.java @@ -1,12 +1,14 @@ package com.brandon3055.draconicevolution.common.blocks; -import com.brandon3055.draconicevolution.common.lib.References; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; +import com.brandon3055.draconicevolution.common.lib.References; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class BlockDE extends Block { public BlockDE(final Material material) { @@ -25,7 +27,8 @@ public class BlockDE extends Block { public String getUnlocalizedName() { return String.format( "tile.%s%s", - References.MODID.toLowerCase() + ":", getUnwrappedUnlocalizedName(super.getUnlocalizedName())); + References.MODID.toLowerCase() + ":", + getUnwrappedUnlocalizedName(super.getUnlocalizedName())); } public String getUnwrappedUnlocalizedName(String unlocalizedName) { @@ -35,7 +38,7 @@ public class BlockDE extends Block { @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { - this.blockIcon = iconRegister.registerIcon( - References.RESOURCESPREFIX + getUnwrappedUnlocalizedName(super.getUnlocalizedName())); + this.blockIcon = iconRegister + .registerIcon(References.RESOURCESPREFIX + getUnwrappedUnlocalizedName(super.getUnlocalizedName())); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/CKeyStone.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/CKeyStone.java index 46442398..b1c79840 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/CKeyStone.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/CKeyStone.java @@ -1,15 +1,5 @@ package com.brandon3055.draconicevolution.common.blocks; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.blocks.itemblocks.CKeyStoneItemBlock; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.tileentities.TileCKeyStone; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -21,10 +11,23 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.blocks.itemblocks.CKeyStoneItemBlock; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.tileentities.TileCKeyStone; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 27/08/2014. */ public class CKeyStone extends BlockDE { + private IIcon blockIcon1; public CKeyStone() { @@ -61,28 +64,18 @@ public class CKeyStone extends BlockDE { @Override public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { if (side == 0 || side == 1) return Blocks.furnace.getIcon(side, 0); - TileCKeyStone tile = - world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileCKeyStone - ? (TileCKeyStone) world.getTileEntity(x, y, z) + TileCKeyStone tile = world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TileCKeyStone ? (TileCKeyStone) world.getTileEntity(x, y, z) : null; if (tile != null) return tile.isActivated ? blockIcon1 : blockIcon; else return blockIcon; } @Override - public boolean onBlockActivated( - World world, - int x, - int y, - int z, - EntityPlayer player, - int p_149727_6_, - float p_149727_7_, - float p_149727_8_, - float p_149727_9_) { - TileCKeyStone tile = - world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileCKeyStone - ? (TileCKeyStone) world.getTileEntity(x, y, z) + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, + float p_149727_7_, float p_149727_8_, float p_149727_9_) { + TileCKeyStone tile = world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TileCKeyStone ? (TileCKeyStone) world.getTileEntity(x, y, z) : null; if (tile != null) return tile.onActivated(player.getHeldItem(), player); @@ -101,9 +94,8 @@ public class CKeyStone extends BlockDE { @Override public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int meta) { - TileCKeyStone tile = - world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileCKeyStone - ? (TileCKeyStone) world.getTileEntity(x, y, z) + TileCKeyStone tile = world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TileCKeyStone ? (TileCKeyStone) world.getTileEntity(x, y, z) : null; if (tile != null) return tile.isActivated ? 15 : 0; return 0; @@ -116,9 +108,8 @@ public class CKeyStone extends BlockDE { @Override public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) { - TileCKeyStone tile = - world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileCKeyStone - ? (TileCKeyStone) world.getTileEntity(x, y, z) + TileCKeyStone tile = world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TileCKeyStone ? (TileCKeyStone) world.getTileEntity(x, y, z) : null; if (tile != null) { ItemStack key = new ItemStack(ModItems.key); @@ -132,8 +123,8 @@ public class CKeyStone extends BlockDE { } @Override - public boolean isBlockSolid( - IBlockAccess p_149747_1_, int p_149747_2_, int p_149747_3_, int p_149747_4_, int p_149747_5_) { + public boolean isBlockSolid(IBlockAccess p_149747_1_, int p_149747_2_, int p_149747_3_, int p_149747_4_, + int p_149747_5_) { return true; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/ChaosCrystal.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/ChaosCrystal.java index 49ff84f6..d8bddbc5 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/ChaosCrystal.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/ChaosCrystal.java @@ -1,12 +1,8 @@ package com.brandon3055.draconicevolution.common.blocks; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.tileentities.TileChaosShard; import java.util.List; import java.util.Random; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -21,6 +17,12 @@ import net.minecraft.util.DamageSource; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.tileentities.TileChaosShard; + /** * Created by brandon3055 on 24/9/2015. */ @@ -94,11 +96,9 @@ public class ChaosCrystal extends BlockDE { entity.attackEntityFrom(punishment, Float.MAX_VALUE); } - private static String[] naughtyList = new String[] {"item.blockMover", "tile.CardboardBox", "item.WandCasting"}; - private static DamageSource punishment = new DamageSource("chrystalMoved") - .setDamageAllowedInCreativeMode() - .setDamageBypassesArmor() - .setDamageIsAbsolute(); + private static String[] naughtyList = new String[] { "item.blockMover", "tile.CardboardBox", "item.WandCasting" }; + private static DamageSource punishment = new DamageSource("chrystalMoved").setDamageAllowedInCreativeMode() + .setDamageBypassesArmor().setDamageIsAbsolute(); @Override public void onBlockAdded(World world, int x, int y, int z) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/ChaosShardAtmos.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/ChaosShardAtmos.java index 0d7e75bd..46544d13 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/ChaosShardAtmos.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/ChaosShardAtmos.java @@ -1,13 +1,15 @@ package com.brandon3055.draconicevolution.common.blocks; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.entity.EntityChaosBolt; import java.util.Random; + import net.minecraft.block.BlockAir; import net.minecraft.entity.Entity; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.entity.EntityChaosBolt; + /** * Created by brandon3055 on 30/9/2015. */ @@ -28,7 +30,13 @@ public class ChaosShardAtmos extends BlockAir { for (int searchZ = z - 15; searchZ < z + 15; searchZ++) { if (world.getBlock(searchX, 80, searchZ) == ModBlocks.chaosCrystal) { EntityChaosBolt bolt = new EntityChaosBolt( - world, x + 0.5, y + 0.5, z + 0.5, searchX + 0.5, 80.5, searchZ + 0.5); + world, + x + 0.5, + y + 0.5, + z + 0.5, + searchX + 0.5, + 80.5, + searchZ + 0.5); world.spawnEntityInWorld(bolt); return; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/CustomSpawner.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/CustomSpawner.java index c5f654b8..5b004050 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/CustomSpawner.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/CustomSpawner.java @@ -1,21 +1,10 @@ package com.brandon3055.draconicevolution.common.blocks; -import com.brandon3055.brandonscore.common.utills.InfoHelper; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.handler.ConfigHandler; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.tileentities.TileCustomSpawner; -import com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock; -import com.brandon3055.draconicevolution.common.utills.LogHelper; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Random; + import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.texture.IIconRegister; @@ -30,10 +19,25 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import com.brandon3055.brandonscore.common.utills.InfoHelper; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.handler.ConfigHandler; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.tileentities.TileCustomSpawner; +import com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock; +import com.brandon3055.draconicevolution.common.utills.LogHelper; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 5/07/2014. */ public class CustomSpawner extends BlockDE implements IHudDisplayBlock { + public CustomSpawner() { this.setBlockName(Strings.customSpawnerName); this.setCreativeTab(DraconicEvolution.tabBlocksItems); @@ -44,31 +48,21 @@ public class CustomSpawner extends BlockDE implements IHudDisplayBlock { } @Override - public boolean onBlockActivated( - World world, - int x, - int y, - int z, - EntityPlayer player, - int p_149727_6_, - float p_149727_7_, - float p_149727_8_, - float p_149727_9_) { - TileCustomSpawner spawner = - (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileCustomSpawner) + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, + float p_149727_7_, float p_149727_8_, float p_149727_9_) { + TileCustomSpawner spawner = (world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TileCustomSpawner) ? (TileCustomSpawner) world.getTileEntity(x, y, z) : null; if (spawner != null) { ItemStack item = player.getHeldItem(); if (item != null && item.getItem().equals(ModItems.mobSoul)) { String name = ItemNBTHelper.getString(item, "Name", "Pig"); - if ((!ConfigHandler.spawnerListType - && Arrays.asList(ConfigHandler.spawnerList).contains(name)) + if ((!ConfigHandler.spawnerListType && Arrays.asList(ConfigHandler.spawnerList).contains(name)) || (ConfigHandler.spawnerListType && !Arrays.asList(ConfigHandler.spawnerList).contains(name))) { - if (!world.isRemote) - player.addChatComponentMessage( - new ChatComponentText(EnumChatFormatting.RED + "[Error] soul disabled in config!")); + if (!world.isRemote) player.addChatComponentMessage( + new ChatComponentText(EnumChatFormatting.RED + "[Error] soul disabled in config!")); return false; } @@ -81,63 +75,72 @@ public class CustomSpawner extends BlockDE implements IHudDisplayBlock { world.markBlockForUpdate(x, y, z); item.splitStack(1); return true; - } else if (item != null - && item.getItem().equals(Items.nether_star) - && spawner.getBaseLogic().requiresPlayer) { - spawner.getBaseLogic().requiresPlayer = false; - world.markBlockForUpdate(x, y, z); - item.splitStack(1); - return true; - } else if (item != null - && item.getItem().equals(ModItems.wyvernCore) - && spawner.getBaseLogic().spawnSpeed == 1) { - spawner.getBaseLogic().setSpawnRate(2); - world.markBlockForUpdate(x, y, z); - item.splitStack(1); - return true; - } else if (item != null - && item.getItem().equals(ModItems.awakenedCore) - && spawner.getBaseLogic().spawnSpeed == 2) { - spawner.getBaseLogic().setSpawnRate(3); - world.markBlockForUpdate(x, y, z); - item.splitStack(1); - return true; - } else if (item != null - && item.getItem().equals(Items.golden_apple) - && item.getItemDamage() == 1 - && !spawner.getBaseLogic().ignoreSpawnRequirements) { - spawner.getBaseLogic().ignoreSpawnRequirements = true; - world.markBlockForUpdate(x, y, z); - item.splitStack(1); - return true; - } else { - if (world.isRemote && !player.isSneaking()) { - player.addChatMessage( - new ChatComponentText(EnumChatFormatting.GOLD + "#################################")); - player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo1.txt") - .appendText(": " + EnumChatFormatting.DARK_AQUA + spawner.getBaseLogic().entityName)); - player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo2.txt") - .appendText(": " + EnumChatFormatting.DARK_AQUA + spawner.getBaseLogic().requiresPlayer)); - player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo3.txt") - .appendText(": " + EnumChatFormatting.DARK_AQUA - + spawner.getBaseLogic().ignoreSpawnRequirements)); - player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo4.txt") - .appendText(": " + EnumChatFormatting.DARK_AQUA + spawner.getBaseLogic().spawnSpeed)); - player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo5.txt")); - player.addChatMessage( - new ChatComponentText(EnumChatFormatting.GOLD + "#################################")); - } else if (world.isRemote && player.isSneaking()) { - player.addChatMessage( - new ChatComponentText(EnumChatFormatting.GOLD + "#################################")); - player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo6.txt")); - player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo7.txt")); - player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo8.txt")); - player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo9.txt")); - player.addChatMessage( - new ChatComponentText(EnumChatFormatting.GOLD + "#################################")); - } - return true; - } + } else + if (item != null && item.getItem().equals(Items.nether_star) && spawner.getBaseLogic().requiresPlayer) { + spawner.getBaseLogic().requiresPlayer = false; + world.markBlockForUpdate(x, y, z); + item.splitStack(1); + return true; + } else if (item != null && item.getItem().equals(ModItems.wyvernCore) + && spawner.getBaseLogic().spawnSpeed == 1) { + spawner.getBaseLogic().setSpawnRate(2); + world.markBlockForUpdate(x, y, z); + item.splitStack(1); + return true; + } else + if (item != null && item.getItem().equals(ModItems.awakenedCore) + && spawner.getBaseLogic().spawnSpeed == 2) { + spawner.getBaseLogic().setSpawnRate(3); + world.markBlockForUpdate(x, y, z); + item.splitStack(1); + return true; + } else + if (item != null && item.getItem().equals(Items.golden_apple) + && item.getItemDamage() == 1 + && !spawner.getBaseLogic().ignoreSpawnRequirements) { + spawner.getBaseLogic().ignoreSpawnRequirements = true; + world.markBlockForUpdate(x, y, z); + item.splitStack(1); + return true; + } else { + if (world.isRemote && !player.isSneaking()) { + player.addChatMessage( + new ChatComponentText( + EnumChatFormatting.GOLD + "#################################")); + player.addChatMessage( + new ChatComponentTranslation("msg.spawnerInfo1.txt").appendText( + ": " + EnumChatFormatting.DARK_AQUA + + spawner.getBaseLogic().entityName)); + player.addChatMessage( + new ChatComponentTranslation("msg.spawnerInfo2.txt").appendText( + ": " + EnumChatFormatting.DARK_AQUA + + spawner.getBaseLogic().requiresPlayer)); + player.addChatMessage( + new ChatComponentTranslation("msg.spawnerInfo3.txt").appendText( + ": " + EnumChatFormatting.DARK_AQUA + + spawner.getBaseLogic().ignoreSpawnRequirements)); + player.addChatMessage( + new ChatComponentTranslation("msg.spawnerInfo4.txt").appendText( + ": " + EnumChatFormatting.DARK_AQUA + + spawner.getBaseLogic().spawnSpeed)); + player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo5.txt")); + player.addChatMessage( + new ChatComponentText( + EnumChatFormatting.GOLD + "#################################")); + } else if (world.isRemote && player.isSneaking()) { + player.addChatMessage( + new ChatComponentText( + EnumChatFormatting.GOLD + "#################################")); + player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo6.txt")); + player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo7.txt")); + player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo8.txt")); + player.addChatMessage(new ChatComponentTranslation("msg.spawnerInfo9.txt")); + player.addChatMessage( + new ChatComponentText( + EnumChatFormatting.GOLD + "#################################")); + } + return true; + } } LogHelper.error("Invalid or nonexistent TileEntity"); return false; @@ -191,8 +194,8 @@ public class CustomSpawner extends BlockDE implements IHudDisplayBlock { @Override public void onNeighborBlockChange(World world, int x, int y, int z, Block p_149695_5_) { - TileCustomSpawner spawner = - (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileCustomSpawner) + TileCustomSpawner spawner = (world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TileCustomSpawner) ? (TileCustomSpawner) world.getTileEntity(x, y, z) : null; if (spawner != null) { @@ -212,16 +215,20 @@ public class CustomSpawner extends BlockDE implements IHudDisplayBlock { @Override public void breakBlock(World world, int x, int y, int z, Block p_149749_5_, int p_149749_6_) { - TileCustomSpawner spawner = - (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileCustomSpawner) + TileCustomSpawner spawner = (world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TileCustomSpawner) ? (TileCustomSpawner) world.getTileEntity(x, y, z) : null; if (spawner != null && !world.isRemote) { float multiplyer = 0.05F; if (spawner.getBaseLogic().ignoreSpawnRequirements) { - EntityItem item = - new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(Items.golden_apple, 1, 1)); + EntityItem item = new EntityItem( + world, + x + 0.5, + y + 0.5, + z + 0.5, + new ItemStack(Items.golden_apple, 1, 1)); item.motionX = (-0.5F + world.rand.nextFloat()) * multiplyer; item.motionY = (4 + world.rand.nextFloat()) * multiplyer; item.motionZ = (-0.5F + world.rand.nextFloat()) * multiplyer; @@ -235,8 +242,12 @@ public class CustomSpawner extends BlockDE implements IHudDisplayBlock { world.spawnEntityInWorld(item); } if (spawner.getBaseLogic().spawnSpeed > 2) { - EntityItem item = - new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.awakenedCore)); + EntityItem item = new EntityItem( + world, + x + 0.5, + y + 0.5, + z + 0.5, + new ItemStack(ModItems.awakenedCore)); item.motionX = (-0.5F + world.rand.nextFloat()) * multiplyer; item.motionY = (4 + world.rand.nextFloat()) * multiplyer; item.motionZ = (-0.5F + world.rand.nextFloat()) * multiplyer; @@ -255,22 +266,30 @@ public class CustomSpawner extends BlockDE implements IHudDisplayBlock { @Override public List getDisplayData(World world, int x, int y, int z) { - TileCustomSpawner spawner = - (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileCustomSpawner) + TileCustomSpawner spawner = (world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TileCustomSpawner) ? (TileCustomSpawner) world.getTileEntity(x, y, z) : null; List list = new ArrayList(); if (spawner != null) { list.add(InfoHelper.HITC() + getLocalizedName()); if (world.isRemote && !Minecraft.getMinecraft().thePlayer.isSneaking()) { - list.add(StatCollector.translateToLocal("msg.spawnerInfo1.txt") + ": " + EnumChatFormatting.DARK_AQUA - + spawner.getBaseLogic().entityName); - list.add(StatCollector.translateToLocal("msg.spawnerInfo2.txt") + ": " + EnumChatFormatting.DARK_AQUA - + spawner.getBaseLogic().requiresPlayer); - list.add(StatCollector.translateToLocal("msg.spawnerInfo3.txt") + ": " + EnumChatFormatting.DARK_AQUA - + spawner.getBaseLogic().ignoreSpawnRequirements); - list.add(StatCollector.translateToLocal("msg.spawnerInfo4.txt") + ": " + EnumChatFormatting.DARK_AQUA - + spawner.getBaseLogic().spawnSpeed); + list.add( + StatCollector.translateToLocal("msg.spawnerInfo1.txt") + ": " + + EnumChatFormatting.DARK_AQUA + + spawner.getBaseLogic().entityName); + list.add( + StatCollector.translateToLocal("msg.spawnerInfo2.txt") + ": " + + EnumChatFormatting.DARK_AQUA + + spawner.getBaseLogic().requiresPlayer); + list.add( + StatCollector.translateToLocal("msg.spawnerInfo3.txt") + ": " + + EnumChatFormatting.DARK_AQUA + + spawner.getBaseLogic().ignoreSpawnRequirements); + list.add( + StatCollector.translateToLocal("msg.spawnerInfo4.txt") + ": " + + EnumChatFormatting.DARK_AQUA + + spawner.getBaseLogic().spawnSpeed); list.add(StatCollector.translateToLocal("msg.spawnerInfo5.txt")); } else if (world.isRemote && Minecraft.getMinecraft().thePlayer.isSneaking()) { list.add(StatCollector.translateToLocal("msg.spawnerInfo6.txt")); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconicBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconicBlock.java index 07000407..c9d88145 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconicBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconicBlock.java @@ -1,9 +1,5 @@ package com.brandon3055.draconicevolution.common.blocks; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -12,10 +8,16 @@ import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; + /** * Created by Brandon on 21/11/2014. */ public class DraconicBlock extends BlockDE { + IIcon top; public DraconicBlock() { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumBlock.java index fb532d99..66db5654 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumBlock.java @@ -1,14 +1,7 @@ package com.brandon3055.draconicevolution.common.blocks; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.blocks.itemblocks.DraconiumItemBlock; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnderResurrection; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.List; + import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; @@ -21,10 +14,21 @@ import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.itemblocks.DraconiumItemBlock; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnderResurrection; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 25/07/2014. */ public class DraconiumBlock extends BlockDE { + private final int DRACONIUM_META = 0; private final int SUMMON_BLOCK_META = 1; private final int CHARGED_DRACONIUM_META = 2; @@ -81,23 +85,15 @@ public class DraconiumBlock extends BlockDE { } @Override - public boolean onBlockActivated( - World world, - int x, - int y, - int z, - EntityPlayer player, - int p_149727_6_, - float p_149727_7_, - float p_149727_8_, - float p_149727_9_) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, + float p_149727_7_, float p_149727_8_, float p_149727_9_) { int meta = world.getBlockMetadata(x, y, z); if (meta == 0) return false; if (meta == 1) { TileEnderResurrection tile = (world.getTileEntity(x, y, z) != null - && world.getTileEntity(x, y, z) instanceof TileEnderResurrection) - ? (TileEnderResurrection) world.getTileEntity(x, y, z) - : null; + && world.getTileEntity(x, y, z) instanceof TileEnderResurrection) + ? (TileEnderResurrection) world.getTileEntity(x, y, z) + : null; if (tile != null) return tile.onActivated(player); } return false; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumChest.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumChest.java index 9aa56019..d45381de 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumChest.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumChest.java @@ -3,19 +3,9 @@ package com.brandon3055.draconicevolution.common.blocks; import static net.minecraftforge.common.util.ForgeDirection.DOWN; import static net.minecraftforge.common.util.ForgeDirection.UP; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.client.gui.GuiHandler; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.blocks.itemblocks.DraconiumChestItemBlock; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; -import com.brandon3055.draconicevolution.common.utills.ICustomItemData; -import cpw.mods.fml.common.network.internal.FMLNetworkHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.List; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -34,14 +24,26 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.oredict.OreDictionary; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.client.gui.GuiHandler; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.itemblocks.DraconiumChestItemBlock; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; +import com.brandon3055.draconicevolution.common.utills.ICustomItemData; + +import cpw.mods.fml.common.network.internal.FMLNetworkHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 28/10/2014. */ public class DraconiumChest extends BlockCustomDrop { - private static final String[] STORAGE_BLACKLIST = new String[] { - "tile.thermalexpansion.strongbox", "item.thermalexpansion.satchel", "tile.draconicevolution:draconiumChest" - }; + private static final String[] STORAGE_BLACKLIST = new String[] { "tile.thermalexpansion.strongbox", + "item.thermalexpansion.satchel", "tile.draconicevolution:draconiumChest" }; public DraconiumChest() { super(Material.iron); @@ -61,39 +63,44 @@ public class DraconiumChest extends BlockCustomDrop { } @Override - public boolean onBlockActivated( - World world, int x, int y, int z, EntityPlayer player, int side, float cx, float cy, float cz) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float cx, float cy, + float cz) { TileEntity tileEntity = world.getTileEntity(x, y, z); if (!(tileEntity instanceof TileDraconiumChest)) return false; TileDraconiumChest te = (TileDraconiumChest) tileEntity; if (player.isSneaking()) { te.editMode = !te.editMode; - if (world.isRemote) - player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.DARK_GREEN + "" - + StatCollector.translateToLocal("msg.draconiumChestEditmode.txt") - + EnumChatFormatting.DARK_AQUA + " " + String.valueOf(te.editMode))); + if (world.isRemote) player.addChatComponentMessage( + new ChatComponentText( + EnumChatFormatting.DARK_GREEN + "" + + StatCollector.translateToLocal("msg.draconiumChestEditmode.txt") + + EnumChatFormatting.DARK_AQUA + + " " + + String.valueOf(te.editMode))); if (te.editMode) { - if (world.isRemote) - player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GOLD + "" - + StatCollector.translateToLocal("msg.draconiumChestEditL1.txt"))); - if (world.isRemote) - player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GOLD + "" - + StatCollector.translateToLocal("msg.draconiumChestEditL2.txt"))); - if (world.isRemote) - player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GOLD + "" - + StatCollector.translateToLocal("msg.draconiumChestEditL3.txt"))); - if (world.isRemote) - player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GOLD + "" - + StatCollector.translateToLocal("msg.draconiumChestEditL4.txt"))); + if (world.isRemote) player.addChatComponentMessage( + new ChatComponentText( + EnumChatFormatting.GOLD + "" + + StatCollector.translateToLocal("msg.draconiumChestEditL1.txt"))); + if (world.isRemote) player.addChatComponentMessage( + new ChatComponentText( + EnumChatFormatting.GOLD + "" + + StatCollector.translateToLocal("msg.draconiumChestEditL2.txt"))); + if (world.isRemote) player.addChatComponentMessage( + new ChatComponentText( + EnumChatFormatting.GOLD + "" + + StatCollector.translateToLocal("msg.draconiumChestEditL3.txt"))); + if (world.isRemote) player.addChatComponentMessage( + new ChatComponentText( + EnumChatFormatting.GOLD + "" + + StatCollector.translateToLocal("msg.draconiumChestEditL4.txt"))); } return false; } - if (te.editMode - && (isDye(player.getHeldItem(), "dyeRed") - || isDye(player.getHeldItem(), "dyeGreen") - || isDye(player.getHeldItem(), "dyeBlue"))) { + if (te.editMode && (isDye(player.getHeldItem(), "dyeRed") || isDye(player.getHeldItem(), "dyeGreen") + || isDye(player.getHeldItem(), "dyeBlue"))) { int increment = cy > 0.5F ? 5 : -5; if (isDye(player.getHeldItem(), "dyeRed")) { @@ -111,21 +118,18 @@ public class DraconiumChest extends BlockCustomDrop { if (te.blue > 255) te.blue = 255; if (te.blue < 0) te.blue = 0; } - if (world.isRemote) - player.addChatComponentMessage(new ChatComponentText( - StatCollector.translateToLocal("msg.draconiumChestRed.txt") + " " + te.red)); - if (world.isRemote) - player.addChatComponentMessage(new ChatComponentText( - StatCollector.translateToLocal("msg.draconiumChestGreen.txt") + " " + te.green)); - if (world.isRemote) - player.addChatComponentMessage(new ChatComponentText( - StatCollector.translateToLocal("msg.draconiumChestBlue.txt") + " " + te.blue)); + if (world.isRemote) player.addChatComponentMessage( + new ChatComponentText(StatCollector.translateToLocal("msg.draconiumChestRed.txt") + " " + te.red)); + if (world.isRemote) player.addChatComponentMessage( + new ChatComponentText( + StatCollector.translateToLocal("msg.draconiumChestGreen.txt") + " " + te.green)); + if (world.isRemote) player.addChatComponentMessage( + new ChatComponentText( + StatCollector.translateToLocal("msg.draconiumChestBlue.txt") + " " + te.blue)); return true; } - if (te.editMode - && player.getHeldItem() != null - && player.getHeldItem().getItem().equals(Items.paper)) { + if (te.editMode && player.getHeldItem() != null && player.getHeldItem().getItem().equals(Items.paper)) { if (player.getHeldItem().stackSize != 1) { if (world.isRemote) player.addChatComponentMessage(new ChatComponentTranslation("msg.draconiumChestEdit2.txt")); @@ -158,9 +162,8 @@ public class DraconiumChest extends BlockCustomDrop { return true; } - if (!world.isRemote) - FMLNetworkHandler.openGui( - player, DraconicEvolution.instance, GuiHandler.GUIID_DRACONIC_CHEST, world, x, y, z); + if (!world.isRemote) FMLNetworkHandler + .openGui(player, DraconicEvolution.instance, GuiHandler.GUIID_DRACONIC_CHEST, world, x, y, z); return true; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumOre.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumOre.java index b4cf18e5..60d5a131 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumOre.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumOre.java @@ -1,13 +1,7 @@ package com.brandon3055.draconicevolution.common.blocks; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.Random; + import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.texture.IIconRegister; @@ -18,7 +12,17 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class DraconiumOre extends BlockDE { + public IIcon icon; public IIcon iconEnd; public IIcon iconNether; @@ -65,8 +69,7 @@ public class DraconiumOre extends BlockDE { @Override public int quantityDroppedWithBonus(int fortune, Random random) { - return fortune == 0 - ? this.quantityDropped(random) + return fortune == 0 ? this.quantityDropped(random) : this.quantityDropped(random) + fortune + random.nextInt(fortune * 2); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/InfusedObsidian.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/InfusedObsidian.java index 7861d6c7..63c08b58 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/InfusedObsidian.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/InfusedObsidian.java @@ -1,11 +1,7 @@ package com.brandon3055.draconicevolution.common.blocks; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.lib.References; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.List; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -19,6 +15,13 @@ import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.lib.References; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 19/5/2015. */ @@ -50,15 +53,8 @@ public class InfusedObsidian extends BlockDE { public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) {} @Override - public float getExplosionResistance( - Entity par1Entity, - World world, - int x, - int y, - int z, - double explosionX, - double explosionY, - double explosionZ) { + public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX, + double explosionY, double explosionZ) { return super.getExplosionResistance(par1Entity, world, x, y, z, explosionX, explosionY, explosionZ); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/ParticleGenerator.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/ParticleGenerator.java index 5e88b0cf..d87d7d81 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/ParticleGenerator.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/ParticleGenerator.java @@ -1,18 +1,7 @@ package com.brandon3055.draconicevolution.common.blocks; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.client.gui.GuiHandler; -import com.brandon3055.draconicevolution.client.handler.ParticleHandler; -import com.brandon3055.draconicevolution.client.render.particle.ParticleCustom; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.tileentities.TileParticleGenerator; -import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore; -import cpw.mods.fml.common.network.internal.FMLNetworkHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.Random; + import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -23,7 +12,22 @@ import net.minecraft.util.ChatComponentTranslation; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.client.gui.GuiHandler; +import com.brandon3055.draconicevolution.client.handler.ParticleHandler; +import com.brandon3055.draconicevolution.client.render.particle.ParticleCustom; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.tileentities.TileParticleGenerator; +import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore; + +import cpw.mods.fml.common.network.internal.FMLNetworkHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class ParticleGenerator extends BlockDE { + public static Block instance; public ParticleGenerator() { @@ -41,22 +45,15 @@ public class ParticleGenerator extends BlockDE { } @Override - public boolean onBlockActivated( - World world, - int x, - int y, - int z, - EntityPlayer player, - int side, - float p_149727_7_, - float p_149727_8_, - float p_149727_9_) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float p_149727_7_, + float p_149727_8_, float p_149727_9_) { if (world.getBlockMetadata(x, y, z) == 1) return false; if (player.getHeldItem() != null && player.getHeldItem().getItem() == Items.paper) { TileEntity tile = world.getTileEntity(x, y, z); - TileParticleGenerator gen = - (tile != null && tile instanceof TileParticleGenerator) ? (TileParticleGenerator) tile : null; + TileParticleGenerator gen = (tile != null && tile instanceof TileParticleGenerator) + ? (TileParticleGenerator) tile + : null; ItemStack stack = player.getHeldItem(); if (gen != null && stack.hasTagCompound() && stack.getTagCompound().hasKey("particles_enabled")) { gen.setBlockNBT(stack.getTagCompound()); @@ -67,8 +64,9 @@ public class ParticleGenerator extends BlockDE { if (player.isSneaking()) { if (activateEnergyStorageCore(world, x, y, z, player)) return true; TileEntity tile = world.getTileEntity(x, y, z); - TileParticleGenerator gen = - (tile != null && tile instanceof TileParticleGenerator) ? (TileParticleGenerator) tile : null; + TileParticleGenerator gen = (tile != null && tile instanceof TileParticleGenerator) + ? (TileParticleGenerator) tile + : null; if (gen != null) { gen.toggleInverted(); } @@ -86,8 +84,9 @@ public class ParticleGenerator extends BlockDE { @Override public void onNeighborBlockChange(final World world, final int x, final int y, final int z, final Block block) { TileEntity tile = world.getTileEntity(x, y, z); - TileParticleGenerator gen = - (tile != null && tile instanceof TileParticleGenerator) ? (TileParticleGenerator) tile : null; + TileParticleGenerator gen = (tile != null && tile instanceof TileParticleGenerator) + ? (TileParticleGenerator) tile + : null; if (gen != null) { gen.signal = world.isBlockIndirectlyGettingPowered(x, y, z); world.markBlockForUpdate(x, y, z); @@ -116,8 +115,17 @@ public class ParticleGenerator extends BlockDE { float MZ = modifier - ((2f * modifier) * rand.nextFloat()); { - ParticleCustom particle = - new ParticleCustom(world, spawnX, spawnY, spawnZ, MX, MY, MZ, SCALE, false, 1); + ParticleCustom particle = new ParticleCustom( + world, + spawnX, + spawnY, + spawnZ, + MX, + MY, + MZ, + SCALE, + false, + 1); particle.red = rand.nextInt(255); particle.green = rand.nextInt(255); particle.blue = rand.nextInt(255); @@ -138,8 +146,8 @@ public class ParticleGenerator extends BlockDE { } @Override - public boolean shouldSideBeRendered( - IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) { + public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, + int p_149646_5_) { return false; } @@ -162,22 +170,20 @@ public class ParticleGenerator extends BlockDE { for (int x1 = x - 11; x1 <= x + 11; x1++) { if (world.getBlock(x1, y, z) == ModBlocks.energyStorageCore) { TileEnergyStorageCore tile = (world.getTileEntity(x1, y, z) != null - && world.getTileEntity(x1, y, z) instanceof TileEnergyStorageCore) - ? (TileEnergyStorageCore) world.getTileEntity(x1, y, z) - : null; + && world.getTileEntity(x1, y, z) instanceof TileEnergyStorageCore) + ? (TileEnergyStorageCore) world.getTileEntity(x1, y, z) + : null; if (tile != null && !tile.isOnline()) { if (player.capabilities.isCreativeMode) { if (!tile.creativeActivate()) { - if (world.isRemote) - player.addChatComponentMessage( - new ChatComponentTranslation("msg.energyStorageCoreUTA.txt")); + if (world.isRemote) player.addChatComponentMessage( + new ChatComponentTranslation("msg.energyStorageCoreUTA.txt")); return false; } } else { if (!tile.tryActivate()) { - if (world.isRemote) - player.addChatComponentMessage( - new ChatComponentTranslation("msg.energyStorageCoreUTA.txt")); + if (world.isRemote) player.addChatComponentMessage( + new ChatComponentTranslation("msg.energyStorageCoreUTA.txt")); return false; } } @@ -189,22 +195,20 @@ public class ParticleGenerator extends BlockDE { for (int z1 = z - 11; z1 <= z + 11; z1++) { if (world.getBlock(x, y, z1) == ModBlocks.energyStorageCore) { TileEnergyStorageCore tile = (world.getTileEntity(x, y, z1) != null - && world.getTileEntity(x, y, z1) instanceof TileEnergyStorageCore) - ? (TileEnergyStorageCore) world.getTileEntity(x, y, z1) - : null; + && world.getTileEntity(x, y, z1) instanceof TileEnergyStorageCore) + ? (TileEnergyStorageCore) world.getTileEntity(x, y, z1) + : null; if (tile != null && !tile.isOnline()) { if (player.capabilities.isCreativeMode) { if (!tile.creativeActivate()) { - if (world.isRemote) - player.addChatComponentMessage( - new ChatComponentTranslation("msg.energyStorageCoreUTA.txt")); + if (world.isRemote) player.addChatComponentMessage( + new ChatComponentTranslation("msg.energyStorageCoreUTA.txt")); return false; } } else { if (!tile.tryActivate()) { - if (world.isRemote) - player.addChatComponentMessage( - new ChatComponentTranslation("msg.energyStorageCoreUTA.txt")); + if (world.isRemote) player.addChatComponentMessage( + new ChatComponentTranslation("msg.energyStorageCoreUTA.txt")); return false; } } @@ -219,8 +223,9 @@ public class ParticleGenerator extends BlockDE { public void breakBlock(World world, int x, int y, int z, Block p_149749_5_, int meta) { if (meta == 1) { TileEntity tile = world.getTileEntity(x, y, z); - TileParticleGenerator gen = - (tile != null && tile instanceof TileParticleGenerator) ? (TileParticleGenerator) tile : null; + TileParticleGenerator gen = (tile != null && tile instanceof TileParticleGenerator) + ? (TileParticleGenerator) tile + : null; if (gen != null && gen.getMaster() != null) { world.setBlockMetadataWithNotify(x, y, z, 0, 2); // LogHelper.info("deActivate"); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/PlacedItem.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/PlacedItem.java index 4e44b88c..eb7f1319 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/PlacedItem.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/PlacedItem.java @@ -1,9 +1,7 @@ package com.brandon3055.draconicevolution.common.blocks; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.tileentities.TilePlacedItem; import java.util.Random; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -18,10 +16,15 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.tileentities.TilePlacedItem; + /** * Created by Brandon on 13/08/2014. */ public class PlacedItem extends BlockDE { + public PlacedItem() { super(Material.circuits); this.setHardness(5F); @@ -73,8 +76,8 @@ public class PlacedItem extends BlockDE { @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { - TilePlacedItem tile = - (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TilePlacedItem) + TilePlacedItem tile = (world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TilePlacedItem) ? (TilePlacedItem) world.getTileEntity(x, y, z) : null; int meta = world.getBlockMetadata(x, y, z); @@ -82,44 +85,44 @@ public class PlacedItem extends BlockDE { if (tile.getStack().getItem() instanceof ItemBlock) { switch (meta) { case 0: - return AxisAlignedBB.getBoundingBox( - x + 0.25D, y + 0.5D, z + 0.25D, x + 0.75D, y + 1D, z + 0.75D); + return AxisAlignedBB + .getBoundingBox(x + 0.25D, y + 0.5D, z + 0.25D, x + 0.75D, y + 1D, z + 0.75D); case 1: - return AxisAlignedBB.getBoundingBox( - x + 0.25D, y + 0D, z + 0.25D, x + 0.75D, y + 0.5D, z + 0.75D); + return AxisAlignedBB + .getBoundingBox(x + 0.25D, y + 0D, z + 0.25D, x + 0.75D, y + 0.5D, z + 0.75D); case 2: - return AxisAlignedBB.getBoundingBox( - x + 0.25D, y + 0.25D, z + 0.5D, x + 0.75D, y + 0.75D, z + 1D); + return AxisAlignedBB + .getBoundingBox(x + 0.25D, y + 0.25D, z + 0.5D, x + 0.75D, y + 0.75D, z + 1D); case 3: - return AxisAlignedBB.getBoundingBox( - x + 0.25D, y + 0.25D, z + 0D, x + 0.75D, y + 0.75D, z + 0.5D); + return AxisAlignedBB + .getBoundingBox(x + 0.25D, y + 0.25D, z + 0D, x + 0.75D, y + 0.75D, z + 0.5D); case 4: - return AxisAlignedBB.getBoundingBox( - x + 0.5D, y + 0.25D, z + 0.25D, x + 1D, y + 0.75D, z + 0.75D); + return AxisAlignedBB + .getBoundingBox(x + 0.5D, y + 0.25D, z + 0.25D, x + 1D, y + 0.75D, z + 0.75D); case 5: - return AxisAlignedBB.getBoundingBox( - x + 0D, y + 0.25D, z + 0.25D, x + 0.5D, y + 0.75D, z + 0.75D); + return AxisAlignedBB + .getBoundingBox(x + 0D, y + 0.25D, z + 0.25D, x + 0.5D, y + 0.75D, z + 0.75D); } } else { switch (meta) { case 0: - return AxisAlignedBB.getBoundingBox( - x + 0.25D, y + 0.9D, z + 0.25D, x + 0.75D, y + 1D, z + 0.75D); + return AxisAlignedBB + .getBoundingBox(x + 0.25D, y + 0.9D, z + 0.25D, x + 0.75D, y + 1D, z + 0.75D); case 1: - return AxisAlignedBB.getBoundingBox( - x + 0.25D, y + 0D, z + 0.25D, x + 0.75D, y + 0.1D, z + 0.75D); + return AxisAlignedBB + .getBoundingBox(x + 0.25D, y + 0D, z + 0.25D, x + 0.75D, y + 0.1D, z + 0.75D); case 2: - return AxisAlignedBB.getBoundingBox( - x + 0.25D, y + 0.25D, z + 0.9D, x + 0.75D, y + 0.75D, z + 1D); + return AxisAlignedBB + .getBoundingBox(x + 0.25D, y + 0.25D, z + 0.9D, x + 0.75D, y + 0.75D, z + 1D); case 3: - return AxisAlignedBB.getBoundingBox( - x + 0.25D, y + 0.25D, z + 0D, x + 0.75D, y + 0.75D, z + 0.1D); + return AxisAlignedBB + .getBoundingBox(x + 0.25D, y + 0.25D, z + 0D, x + 0.75D, y + 0.75D, z + 0.1D); case 4: - return AxisAlignedBB.getBoundingBox( - x + 0.9D, y + 0.25D, z + 0.25D, x + 1D, y + 0.75D, z + 0.75D); + return AxisAlignedBB + .getBoundingBox(x + 0.9D, y + 0.25D, z + 0.25D, x + 1D, y + 0.75D, z + 0.75D); case 5: - return AxisAlignedBB.getBoundingBox( - x + 0D, y + 0.25D, z + 0.25D, x + 0.1D, y + 0.75D, z + 0.75D); + return AxisAlignedBB + .getBoundingBox(x + 0D, y + 0.25D, z + 0.25D, x + 0.1D, y + 0.75D, z + 0.75D); } } } @@ -171,19 +174,11 @@ public class PlacedItem extends BlockDE { } @Override - public boolean onBlockActivated( - World world, - int x, - int y, - int z, - EntityPlayer player, - int p_149727_6_, - float p_149727_7_, - float p_149727_8_, - float p_149727_9_) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, + float p_149727_7_, float p_149727_8_, float p_149727_9_) { if (player.isSneaking()) { - TilePlacedItem tile = - (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TilePlacedItem) + TilePlacedItem tile = (world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TilePlacedItem) ? (TilePlacedItem) world.getTileEntity(x, y, z) : null; if (tile == null) { @@ -201,8 +196,8 @@ public class PlacedItem extends BlockDE { @Override public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) { if (player.isSneaking()) { - TilePlacedItem tile = - (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TilePlacedItem) + TilePlacedItem tile = (world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TilePlacedItem) ? (TilePlacedItem) world.getTileEntity(x, y, z) : null; if (tile == null) { @@ -210,8 +205,8 @@ public class PlacedItem extends BlockDE { } tile.rotation += 22.5F; } else { - TilePlacedItem tile = - (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TilePlacedItem) + TilePlacedItem tile = (world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TilePlacedItem) ? (TilePlacedItem) world.getTileEntity(x, y, z) : null; if (tile == null) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/Potentiometer.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/Potentiometer.java index 0536cbcb..69139166 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/Potentiometer.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/Potentiometer.java @@ -2,13 +2,6 @@ package com.brandon3055.draconicevolution.common.blocks; import static net.minecraftforge.common.util.ForgeDirection.*; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.tileentities.TilePotentiometer; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -21,7 +14,17 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.tileentities.TilePotentiometer; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class Potentiometer extends BlockDE { + IIcon icons[] = new IIcon[16]; public Potentiometer() { @@ -40,8 +43,8 @@ public class Potentiometer extends BlockDE { } @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool( - World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) { + public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, + int p_149668_4_) { return null; } @@ -77,8 +80,7 @@ public class Potentiometer extends BlockDE { @Override public boolean canPlaceBlockAt(World world, int x, int y, int z) { - return (world.isSideSolid(x, y + 1, z, UP)) - || (world.isSideSolid(x, y - 1, z, DOWN)) + return (world.isSideSolid(x, y + 1, z, UP)) || (world.isSideSolid(x, y - 1, z, DOWN)) || (world.isSideSolid(x - 1, y, z, EAST)) || (world.isSideSolid(x + 1, y, z, WEST)) || (world.isSideSolid(x, y, z - 1, SOUTH)) @@ -125,16 +127,8 @@ public class Potentiometer extends BlockDE { } @Override - public int onBlockPlaced( - World world, - int x, - int y, - int z, - int side, - float p_149660_6_, - float p_149660_7_, - float p_149660_8_, - int p_149660_9_) { + public int onBlockPlaced(World world, int x, int y, int z, int side, float p_149660_6_, float p_149660_7_, + float p_149660_8_, int p_149660_9_) { int j1 = world.getBlockMetadata(x, y, z); int k1 = j1 & 8; j1 &= 7; @@ -258,21 +252,13 @@ public class Potentiometer extends BlockDE { // #################################LOGIC##################################// @Override - public boolean onBlockActivated( - World world, - int x, - int y, - int z, - EntityPlayer player, - int side, - float p_149727_7_, - float p_149727_8_, - float p_149727_9_) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float p_149727_7_, + float p_149727_8_, float p_149727_9_) { TilePotentiometer tile = (TilePotentiometer) world.getTileEntity(x, y, z); if (tile != null && tile instanceof TilePotentiometer) { if (!player.isSneaking()) ((TilePotentiometer) tile).increasePower(); - else ((TilePotentiometer) tile).decreasePower(); + else((TilePotentiometer) tile).decreasePower(); if (world.isRemote) player.addChatMessage(new ChatComponentText(String.valueOf(((TilePotentiometer) tile).power))); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/RainSensor.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/RainSensor.java index eb16d5f2..7bcfb343 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/RainSensor.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/RainSensor.java @@ -1,12 +1,7 @@ package com.brandon3055.draconicevolution.common.blocks; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.Random; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -14,7 +9,16 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class RainSensor extends BlockDE { + IIcon icon_inactive; IIcon icon_active; IIcon icon_side; @@ -85,16 +89,8 @@ public class RainSensor extends BlockDE { } @Override - public int onBlockPlaced( - World world, - int x, - int y, - int z, - int p_149660_5_, - float p_149660_6_, - float p_149660_7_, - float p_149660_8_, - int p_149660_9_) { + public int onBlockPlaced(World world, int x, int y, int z, int p_149660_5_, float p_149660_6_, float p_149660_7_, + float p_149660_8_, int p_149660_9_) { world.scheduleBlockUpdate(x, y, z, this, 10); return super.onBlockPlaced(world, x, y, z, p_149660_5_, p_149660_6_, p_149660_7_, p_149660_8_, p_149660_9_); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/SafetyFlame.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/SafetyFlame.java index 32e5fef1..3bd0a4c9 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/SafetyFlame.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/SafetyFlame.java @@ -1,17 +1,20 @@ package com.brandon3055.draconicevolution.common.blocks; +import java.util.Random; + +import net.minecraft.block.BlockFire; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; -import java.util.Random; -import net.minecraft.block.BlockFire; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; /** * Created by Brandon on 23/08/2014. */ public class SafetyFlame extends BlockFire { + public SafetyFlame() { super(); this.setBlockName(Strings.safetyFlameName); @@ -24,7 +27,8 @@ public class SafetyFlame extends BlockFire { public String getUnlocalizedName() { return String.format( "tile.%s%s", - References.MODID.toLowerCase() + ":", getUnwrappedUnlocalizedName(super.getUnlocalizedName())); + References.MODID.toLowerCase() + ":", + getUnwrappedUnlocalizedName(super.getUnlocalizedName())); } public String getUnwrappedUnlocalizedName(String unlocalizedName) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/TeleporterStand.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/TeleporterStand.java index ac2eadb6..2f7d9561 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/TeleporterStand.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/TeleporterStand.java @@ -1,15 +1,7 @@ package com.brandon3055.draconicevolution.common.blocks; -import com.brandon3055.brandonscore.common.utills.Teleporter; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.items.tools.TeleporterMKI; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.tileentities.TileTeleporterStand; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.List; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -22,10 +14,22 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; +import com.brandon3055.brandonscore.common.utills.Teleporter; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.items.tools.TeleporterMKI; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.tileentities.TileTeleporterStand; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 27/06/2014. */ public class TeleporterStand extends BlockCustomDrop { + public TeleporterStand() { super(Material.rock); this.setBlockName(Strings.teleporterStandName); @@ -49,14 +53,13 @@ public class TeleporterStand extends BlockCustomDrop { } @Override - public boolean onBlockActivated( - World world, int x, int y, int z, EntityPlayer player, int side, float prx, float pry, float prz) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float prx, + float pry, float prz) { TileTeleporterStand tile = world.getTileEntity(x, y, z) instanceof TileTeleporterStand ? (TileTeleporterStand) world.getTileEntity(x, y, z) : null; if (tile == null) return false; - if (tile.getStackInSlot(0) == null - && player.getHeldItem() != null + if (tile.getStackInSlot(0) == null && player.getHeldItem() != null && (player.getHeldItem().getItem() instanceof TeleporterMKI)) { ItemStack stack = player.getHeldItem(); tile.setInventorySlotContents(0, stack.copy()); @@ -66,8 +69,7 @@ public class TeleporterStand extends BlockCustomDrop { } if (tile.getStackInSlot(0) != null && player.isSneaking()) { - EntityItem item = new EntityItem( - world, x + 0.5, y + 0.9, z + 0.5, tile.getStackInSlot(0).copy()); + EntityItem item = new EntityItem(world, x + 0.5, y + 0.9, z + 0.5, tile.getStackInSlot(0).copy()); item.motionX = 0; item.motionY = 0; item.motionZ = 0; @@ -77,11 +79,10 @@ public class TeleporterStand extends BlockCustomDrop { return true; } - if (tile.getStackInSlot(0) != null - && !player.isSneaking() + if (tile.getStackInSlot(0) != null && !player.isSneaking() && tile.getStackInSlot(0).getItem() instanceof TeleporterMKI) { - Teleporter.TeleportLocation l = - ((TeleporterMKI) tile.getStackInSlot(0).getItem()).getLocation(tile.getStackInSlot(0)); + Teleporter.TeleportLocation l = ((TeleporterMKI) tile.getStackInSlot(0).getItem()) + .getLocation(tile.getStackInSlot(0)); if (l != null) l.sendEntityToCoords(player); return true; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/TestBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/TestBlock.java index 1f4374d0..791a3fdf 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/TestBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/TestBlock.java @@ -1,13 +1,8 @@ package com.brandon3055.draconicevolution.common.blocks; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.blocks.itemblocks.TestItemBlock; -import com.brandon3055.draconicevolution.common.tileentities.TileTestBlock; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.List; import java.util.Random; + import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.effect.EntityLightningBolt; @@ -20,6 +15,14 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.itemblocks.TestItemBlock; +import com.brandon3055.draconicevolution.common.tileentities.TileTestBlock; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class TestBlock extends BlockDE { public TestBlock() { @@ -73,25 +76,17 @@ public class TestBlock extends BlockDE { } @Override - public boolean onBlockActivated( - World world, int x, int y, int z, EntityPlayer player, int side, float px, float py, float pz) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float px, float py, + float pz) { EntityLightningBolt bolt = new EntityLightningBolt(world, x, y, z + 5); // System.out.println(world.getBlockMetadata(x,y,z)); world.spawnEntityInWorld(bolt); /* - - if (!world.isRemote && !player.isSneaking()) - { - System.out.println("Sending from server"); - DraconicEvolution.channelHandler.sendToAll(new ExamplePacket()); - } - - if (world.isRemote && player.isSneaking()) - { - System.out.println("Sending from client"); - DraconicEvolution.channelHandler.sendToServer(new ExamplePacket()); - } - */ + * if (!world.isRemote && !player.isSneaking()) { System.out.println("Sending from server"); + * DraconicEvolution.channelHandler.sendToAll(new ExamplePacket()); } if (world.isRemote && player.isSneaking()) + * { System.out.println("Sending from client"); DraconicEvolution.channelHandler.sendToServer(new + * ExamplePacket()); } + */ return true; } @@ -117,8 +112,8 @@ public class TestBlock extends BlockDE { } @Override - public boolean shouldSideBeRendered( - IBlockAccess world, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) { + public boolean shouldSideBeRendered(IBlockAccess world, int p_149646_2_, int p_149646_3_, int p_149646_4_, + int p_149646_5_) { return true; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/XRayBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/XRayBlock.java index 71d94f80..75e5f7e8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/XRayBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/XRayBlock.java @@ -1,13 +1,7 @@ package com.brandon3055.draconicevolution.common.blocks; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.client.handler.ParticleHandler; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.lib.Strings; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.Random; + import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; @@ -17,6 +11,15 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.client.handler.ParticleHandler; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.lib.Strings; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class XRayBlock extends BlockDE { public XRayBlock() { @@ -44,8 +47,8 @@ public class XRayBlock extends BlockDE { } @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool( - final World p_149668_1_, final int p_149668_2_, final int p_149668_3_, final int p_149668_4_) { + public AxisAlignedBB getCollisionBoundingBoxFromPool(final World p_149668_1_, final int p_149668_2_, + final int p_149668_3_, final int p_149668_4_) { return null; } @@ -98,24 +101,16 @@ public class XRayBlock extends BlockDE { } @Override - public void onEntityCollidedWithBlock( - final World world, final int x, final int y, final int z, final Entity entity) { + public void onEntityCollidedWithBlock(final World world, final int x, final int y, final int z, + final Entity entity) { // if(entity != EntityItem) // System.out.println(); // entity.attackEntityFrom(DamageSource.magic, 10F); } @Override - public boolean onBlockActivated( - World world, - int x, - int y, - int z, - EntityPlayer player, - int p_149727_6_, - float p_149727_7_, - float p_149727_8_, - float p_149727_9_) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, + float p_149727_7_, float p_149727_8_, float p_149727_9_) { // world.spawnEntityInWorld(new EntityLightningBolt(world, x, y, z)); return false; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/CKeyStoneItemBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/CKeyStoneItemBlock.java index 2353c9f1..2729d47b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/CKeyStoneItemBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/CKeyStoneItemBlock.java @@ -1,6 +1,7 @@ package com.brandon3055.draconicevolution.common.blocks.itemblocks; import java.util.List; + import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/DraconiumChestItemBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/DraconiumChestItemBlock.java index aa260f5e..28653fae 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/DraconiumChestItemBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/DraconiumChestItemBlock.java @@ -1,7 +1,7 @@ package com.brandon3055.draconicevolution.common.blocks.itemblocks; -import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem; import java.util.List; + import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -9,10 +9,13 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem; + /** * Created by Brandon on 31/10/2014. */ public class DraconiumChestItemBlock extends ItemBlockCustomData { + public DraconiumChestItemBlock(Block block) { super(block); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/DraconiumItemBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/DraconiumItemBlock.java index 8bbc3be3..0d49ec8b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/DraconiumItemBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/DraconiumItemBlock.java @@ -1,10 +1,7 @@ package com.brandon3055.draconicevolution.common.blocks.itemblocks; -import cofh.api.energy.IEnergyContainerItem; -import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.List; + import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; @@ -15,10 +12,18 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; +import cofh.api.energy.IEnergyContainerItem; + +import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 8/08/2014. */ public class DraconiumItemBlock extends ItemBlock implements IEnergyContainerItem { + public DraconiumItemBlock(Block block) { super(block); setHasSubtypes(true); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/EnergyCrystalItemBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/EnergyCrystalItemBlock.java index 8bd7182f..4e944827 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/EnergyCrystalItemBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/EnergyCrystalItemBlock.java @@ -1,12 +1,13 @@ package com.brandon3055.draconicevolution.common.blocks.itemblocks; -import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyTransceiver; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyTransceiver; + /** * Created by Brandon on 10/02/2015. */ @@ -28,18 +29,8 @@ public class EnergyCrystalItemBlock extends ItemBlock { } @Override - public boolean placeBlockAt( - ItemStack stack, - EntityPlayer player, - World world, - int x, - int y, - int z, - int side, - float hitX, - float hitY, - float hitZ, - int metadata) { + public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, + float hitX, float hitY, float hitZ, int metadata) { boolean b = super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata); TileEnergyTransceiver transceiver = world.getTileEntity(x, y, z) instanceof TileEnergyTransceiver ? (TileEnergyTransceiver) world.getTileEntity(x, y, z) diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/ItemBlockCustomData.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/ItemBlockCustomData.java index 817d43c5..59ea2fa0 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/ItemBlockCustomData.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/ItemBlockCustomData.java @@ -1,7 +1,5 @@ package com.brandon3055.draconicevolution.common.blocks.itemblocks; -import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; -import com.brandon3055.draconicevolution.common.utills.ICustomItemData; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -12,6 +10,9 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; +import com.brandon3055.draconicevolution.common.utills.ICustomItemData; + /** * Created by Brandon on 13/11/2014. */ @@ -22,17 +23,8 @@ public class ItemBlockCustomData extends ItemBlock { } @Override - public boolean onItemUse( - ItemStack stack, - EntityPlayer player, - World world, - int x, - int y, - int z, - int side, - float hitX, - float hitY, - float hitZ) { + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, + float hitX, float hitY, float hitZ) { if (stack.stackSize <= 0) return false; Block block = world.getBlock(x, y, z); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/ItemBlockFrowGate.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/ItemBlockFrowGate.java index 1644d0f3..a4ac9ba6 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/ItemBlockFrowGate.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/ItemBlockFrowGate.java @@ -8,6 +8,7 @@ import net.minecraft.item.ItemStack; * Created by Brandon on 25/6/2015. */ public class ItemBlockFrowGate extends ItemBlock { + public ItemBlockFrowGate(Block block) { super(block); this.setHasSubtypes(true); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/LRDItemBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/LRDItemBlock.java index 33168ea0..e799a1af 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/LRDItemBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/LRDItemBlock.java @@ -8,6 +8,7 @@ import net.minecraft.item.ItemStack; * Created by Brandon on 23/06/2014. */ public class LRDItemBlock extends ItemBlock { + public LRDItemBlock(Block block) { super(block); setHasSubtypes(true); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/TestItemBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/TestItemBlock.java index 5ecb188f..3df3d771 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/TestItemBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/itemblocks/TestItemBlock.java @@ -8,6 +8,7 @@ import net.minecraft.item.ItemStack; * Created by Brandon on 23/06/2014. */ public class TestItemBlock extends ItemBlock { + public TestItemBlock(Block block) { super(block); setHasSubtypes(true); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/DissEnchanter.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/DissEnchanter.java index 00984efa..4afd3350 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/DissEnchanter.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/DissEnchanter.java @@ -1,17 +1,8 @@ package com.brandon3055.draconicevolution.common.blocks.machine; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.client.gui.GuiHandler; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter; -import cpw.mods.fml.common.network.internal.FMLNetworkHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.List; import java.util.Random; + import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -21,10 +12,23 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.client.gui.GuiHandler; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter; + +import cpw.mods.fml.common.network.internal.FMLNetworkHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 27/06/2014. */ public class DissEnchanter extends BlockCustomDrop { + IIcon top; IIcon bottom; @@ -56,11 +60,11 @@ public class DissEnchanter extends BlockCustomDrop { } @Override - public boolean onBlockActivated( - World world, int x, int y, int z, EntityPlayer player, int side, float prx, float pry, float prz) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float prx, + float pry, float prz) { if (!world.isRemote) { - FMLNetworkHandler.openGui( - player, DraconicEvolution.instance, GuiHandler.GUIID_DISSENCHANTER, world, x, y, z); + FMLNetworkHandler + .openGui(player, DraconicEvolution.instance, GuiHandler.GUIID_DISSENCHANTER, world, x, y, z); } return true; } @@ -113,7 +117,7 @@ public class DissEnchanter extends BlockCustomDrop { } // world.spawnParticle("enchantmenttable", x + 0.5D, y + 2.0D, z + 0.5D, l - x + - // rand.nextFloat() - 0.5D, j1 - y - rand.nextFloat() - 1.0F, i1 - z + rand.nextFloat() - + // rand.nextFloat() - 0.5D, j1 - y - rand.nextFloat() - 1.0F, i1 - z + rand.nextFloat() - // 0.5D); world.spawnParticle( "enchantmenttable", diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/EnergyCrystal.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/EnergyCrystal.java index 39a4c03e..2b3caea1 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/EnergyCrystal.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/EnergyCrystal.java @@ -1,18 +1,8 @@ package com.brandon3055.draconicevolution.common.blocks.machine; -import com.brandon3055.brandonscore.common.utills.InfoHelper; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.blocks.BlockDE; -import com.brandon3055.draconicevolution.common.blocks.itemblocks.EnergyCrystalItemBlock; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.tileentities.energynet.*; -import com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.List; + import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -27,10 +17,24 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import com.brandon3055.brandonscore.common.utills.InfoHelper; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.BlockDE; +import com.brandon3055.draconicevolution.common.blocks.itemblocks.EnergyCrystalItemBlock; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.tileentities.energynet.*; +import com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 10/02/2015. */ public class EnergyCrystal extends BlockDE implements IHudDisplayBlock { + public static final byte RELAY_TIER_1 = 0; public static final byte RELAY_TIER_2 = 1; public static final byte TRANSCEIVER_TIER_1 = 2; @@ -103,23 +107,23 @@ public class EnergyCrystal extends BlockDE implements IHudDisplayBlock { if (tile != null) { switch (tile.facing) { case 0: - return AxisAlignedBB.getBoundingBox( - x + 0.37F, y + 0.59F, z + 0.37F, x + 0.63F, y + 1.0F, z + 0.63F); + return AxisAlignedBB + .getBoundingBox(x + 0.37F, y + 0.59F, z + 0.37F, x + 0.63F, y + 1.0F, z + 0.63F); case 1: - return AxisAlignedBB.getBoundingBox( - x + 0.37F, y + 0.0F, z + 0.37F, x + 0.63F, y + 0.41F, z + 0.63F); + return AxisAlignedBB + .getBoundingBox(x + 0.37F, y + 0.0F, z + 0.37F, x + 0.63F, y + 0.41F, z + 0.63F); case 2: - return AxisAlignedBB.getBoundingBox( - x + 0.37F, y + 0.37F, z + 0.59F, x + 0.63F, y + 0.63F, z + 1.0F); + return AxisAlignedBB + .getBoundingBox(x + 0.37F, y + 0.37F, z + 0.59F, x + 0.63F, y + 0.63F, z + 1.0F); case 3: - return AxisAlignedBB.getBoundingBox( - x + 0.37F, y + 0.37F, z + 0.0F, x + 0.63F, y + 0.63F, z + 0.41F); + return AxisAlignedBB + .getBoundingBox(x + 0.37F, y + 0.37F, z + 0.0F, x + 0.63F, y + 0.63F, z + 0.41F); case 4: - return AxisAlignedBB.getBoundingBox( - x + 0.59F, y + 0.37F, z + 0.37F, x + 1.0F, y + 0.63F, z + 0.63F); + return AxisAlignedBB + .getBoundingBox(x + 0.59F, y + 0.37F, z + 0.37F, x + 1.0F, y + 0.63F, z + 0.63F); case 5: - return AxisAlignedBB.getBoundingBox( - x + 0.0F, y + 0.37F, z + 0.37F, x + 0.41F, y + 0.63F, z + 0.63F); + return AxisAlignedBB + .getBoundingBox(x + 0.0F, y + 0.37F, z + 0.37F, x + 0.41F, y + 0.63F, z + 0.63F); } } } @@ -139,23 +143,23 @@ public class EnergyCrystal extends BlockDE implements IHudDisplayBlock { if (tile != null) { switch (tile.facing) { case 0: - return AxisAlignedBB.getBoundingBox( - x + 0.37F, y + 0.59F, z + 0.37F, x + 0.63F, y + 1.0F, z + 0.63F); + return AxisAlignedBB + .getBoundingBox(x + 0.37F, y + 0.59F, z + 0.37F, x + 0.63F, y + 1.0F, z + 0.63F); case 1: - return AxisAlignedBB.getBoundingBox( - x + 0.37F, y + 0.0F, z + 0.37F, x + 0.63F, y + 0.41F, z + 0.63F); + return AxisAlignedBB + .getBoundingBox(x + 0.37F, y + 0.0F, z + 0.37F, x + 0.63F, y + 0.41F, z + 0.63F); case 2: - return AxisAlignedBB.getBoundingBox( - x + 0.37F, y + 0.37F, z + 0.59F, x + 0.63F, y + 0.63F, z + 1.0F); + return AxisAlignedBB + .getBoundingBox(x + 0.37F, y + 0.37F, z + 0.59F, x + 0.63F, y + 0.63F, z + 1.0F); case 3: - return AxisAlignedBB.getBoundingBox( - x + 0.37F, y + 0.37F, z + 0.0F, x + 0.63F, y + 0.63F, z + 0.41F); + return AxisAlignedBB + .getBoundingBox(x + 0.37F, y + 0.37F, z + 0.0F, x + 0.63F, y + 0.63F, z + 0.41F); case 4: - return AxisAlignedBB.getBoundingBox( - x + 0.59F, y + 0.37F, z + 0.37F, x + 1.0F, y + 0.63F, z + 0.63F); + return AxisAlignedBB + .getBoundingBox(x + 0.59F, y + 0.37F, z + 0.37F, x + 1.0F, y + 0.63F, z + 0.63F); case 5: - return AxisAlignedBB.getBoundingBox( - x + 0.0F, y + 0.37F, z + 0.37F, x + 0.41F, y + 0.63F, z + 0.63F); + return AxisAlignedBB + .getBoundingBox(x + 0.0F, y + 0.37F, z + 0.37F, x + 0.41F, y + 0.63F, z + 0.63F); } } } @@ -170,10 +174,8 @@ public class EnergyCrystal extends BlockDE implements IHudDisplayBlock { @Override public TileEntity createTileEntity(World world, int metadata) { - return metadata == 0 || metadata == 1 - ? new TileEnergyRelay(metadata) - : metadata == 2 || metadata == 3 - ? new TileEnergyTransceiver(metadata - 2) + return metadata == 0 || metadata == 1 ? new TileEnergyRelay(metadata) + : metadata == 2 || metadata == 3 ? new TileEnergyTransceiver(metadata - 2) : metadata == 4 || metadata == 5 ? new TileWirelessEnergyTransceiver(metadata - 4) : null; } @@ -183,8 +185,8 @@ public class EnergyCrystal extends BlockDE implements IHudDisplayBlock { } @Override - public boolean onBlockActivated( - World world, int x, int y, int z, EntityPlayer player, int side, float xx, float yy, float zz) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float xx, float yy, + float zz) { if (world.getTileEntity(x, y, z) instanceof TileRemoteEnergyBase) ((TileRemoteEnergyBase) world.getTileEntity(x, y, z)).onBlockActivated(player); return true; @@ -222,29 +224,34 @@ public class EnergyCrystal extends BlockDE implements IHudDisplayBlock { ? (IRemoteEnergyHandler) world.getTileEntity(x, y, z) : null; if (tile != null) { - list.add(InfoHelper.HITC() - + StatCollector.translateToLocal( - this.getUnlocalizedName() + world.getBlockMetadata(x, y, z) + ".name")); + list.add( + InfoHelper.HITC() + StatCollector + .translateToLocal(this.getUnlocalizedName() + world.getBlockMetadata(x, y, z) + ".name")); list.add("RF: " + tile.getEnergyStored(ForgeDirection.DOWN)); list.add("Cap: " + tile.getCapacity() + "%"); if (tile instanceof TileEnergyTransceiver) { String x5 = ((TileEnergyTransceiver) tile).getPowerTier() > 0 - && ((TileEnergyTransceiver) tile).transferBoost - ? StatCollector.translateToLocal("info.de.5xTransfer.txt") - : ""; + && ((TileEnergyTransceiver) tile).transferBoost + ? StatCollector.translateToLocal("info.de.5xTransfer.txt") + : ""; list.add( ((TileEnergyTransceiver) tile).getInput() ? StatCollector.translateToLocal("info.de.modeIn.txt") + x5 : StatCollector.translateToLocal("info.de.modeOut.txt") + x5); } if (tile instanceof TileRemoteEnergyBase) { - list.add(StatCollector.translateToLocal("info.de.connections.txt") + ": " - + ((TileRemoteEnergyBase) tile).linkedDevices.size() + "/" + tile.getMaxConnections()); + list.add( + StatCollector.translateToLocal("info.de.connections.txt") + ": " + + ((TileRemoteEnergyBase) tile).linkedDevices.size() + + "/" + + tile.getMaxConnections()); } if (tile instanceof TileWirelessEnergyTransceiver) { - list.add(StatCollector.translateToLocal("info.de.wirelessConnections.txt") + ": " - + ((TileWirelessEnergyTransceiver) tile).receiverList.size() + "/" - + ((TileWirelessEnergyTransceiver) tile).getmaxWirelessConnections()); + list.add( + StatCollector.translateToLocal("info.de.wirelessConnections.txt") + ": " + + ((TileWirelessEnergyTransceiver) tile).receiverList.size() + + "/" + + ((TileWirelessEnergyTransceiver) tile).getmaxWirelessConnections()); } if (tile instanceof TileRemoteEnergyBase) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/EnergyInfuser.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/EnergyInfuser.java index 07cfa5bf..f747f2dc 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/EnergyInfuser.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/EnergyInfuser.java @@ -1,16 +1,7 @@ package com.brandon3055.draconicevolution.common.blocks.machine; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.client.gui.GuiHandler; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser; -import cpw.mods.fml.common.network.internal.FMLNetworkHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.List; + import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -20,10 +11,23 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.client.gui.GuiHandler; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser; + +import cpw.mods.fml.common.network.internal.FMLNetworkHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 27/06/2014. */ public class EnergyInfuser extends BlockCustomDrop { + public EnergyInfuser() { super(Material.iron); this.setBlockName(Strings.energyInfuserName); @@ -45,11 +49,11 @@ public class EnergyInfuser extends BlockCustomDrop { } @Override - public boolean onBlockActivated( - World world, int x, int y, int z, EntityPlayer player, int side, float prx, float pry, float prz) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float prx, + float pry, float prz) { if (!world.isRemote) { - FMLNetworkHandler.openGui( - player, DraconicEvolution.instance, GuiHandler.GUIID_ENERGY_INFUSER, world, x, y, z); + FMLNetworkHandler + .openGui(player, DraconicEvolution.instance, GuiHandler.GUIID_ENERGY_INFUSER, world, x, y, z); } world.markBlockForUpdate(x, y, z); return true; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/FlowGate.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/FlowGate.java index 679ec6be..a14f1914 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/FlowGate.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/FlowGate.java @@ -1,19 +1,7 @@ package com.brandon3055.draconicevolution.common.blocks.machine; -import com.brandon3055.brandonscore.common.utills.Utills; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.client.gui.GuiHandler; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.blocks.BlockDE; -import com.brandon3055.draconicevolution.common.blocks.itemblocks.ItemBlockFrowGate; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.tileentities.gates.TileFluidGate; -import com.brandon3055.draconicevolution.common.tileentities.gates.TileFluxGate; -import com.brandon3055.draconicevolution.common.tileentities.gates.TileGate; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.List; + import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -29,6 +17,21 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import com.brandon3055.brandonscore.common.utills.Utills; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.client.gui.GuiHandler; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.blocks.BlockDE; +import com.brandon3055.draconicevolution.common.blocks.itemblocks.ItemBlockFrowGate; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.tileentities.gates.TileFluidGate; +import com.brandon3055.draconicevolution.common.tileentities.gates.TileFluxGate; +import com.brandon3055.draconicevolution.common.tileentities.gates.TileGate; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 25/6/2015. */ @@ -181,19 +184,9 @@ public class FlowGate extends BlockDE { } @Override - public boolean onBlockActivated( - World world, - int x, - int y, - int z, - EntityPlayer player, - int p_149727_6_, - float p_149727_7_, - float p_149727_8_, - float p_149727_9_) { - if (world.isRemote - && !(player.getHeldItem() != null - && player.getHeldItem().getItem().equals(ModItems.wrench))) + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, + float p_149727_7_, float p_149727_8_, float p_149727_9_) { + if (world.isRemote && !(player.getHeldItem() != null && player.getHeldItem().getItem().equals(ModItems.wrench))) player.openGui(DraconicEvolution.instance, GuiHandler.GUIID_FLOW_GATE, world, x, y, z); return true; } @@ -209,8 +202,8 @@ public class FlowGate extends BlockDE { } private void updateSignal(IBlockAccess world, int x, int y, int z) { - TileGate gate = - world.getTileEntity(x, y, z) instanceof TileGate ? (TileGate) world.getTileEntity(x, y, z) : null; + TileGate gate = world.getTileEntity(x, y, z) instanceof TileGate ? (TileGate) world.getTileEntity(x, y, z) + : null; if (gate != null && world instanceof World) { gate.signal = ((World) world).getStrongestIndirectPower(x, y, z); ((World) world).markBlockForUpdate(x, y, z); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/Generator.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/Generator.java index 841279be..31554132 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/Generator.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/Generator.java @@ -1,19 +1,8 @@ package com.brandon3055.draconicevolution.common.blocks.machine; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.client.gui.GuiHandler; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.tileentities.TileGenerator; -import com.brandon3055.draconicevolution.common.tileentities.TileGrinder; -import com.brandon3055.draconicevolution.common.utills.LogHelper; -import cpw.mods.fml.common.network.internal.FMLNetworkHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.List; import java.util.Random; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -29,6 +18,20 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.client.gui.GuiHandler; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.tileentities.TileGenerator; +import com.brandon3055.draconicevolution.common.tileentities.TileGrinder; +import com.brandon3055.draconicevolution.common.utills.LogHelper; + +import cpw.mods.fml.common.network.internal.FMLNetworkHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 23/07/2014. */ @@ -70,9 +73,8 @@ public class Generator extends BlockCustomDrop { @Override public int getLightValue(IBlockAccess world, int x, int y, int z) { - TileGenerator tile = - (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileGenerator) - ? (TileGenerator) world.getTileEntity(x, y, z) + TileGenerator tile = (world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TileGenerator) ? (TileGenerator) world.getTileEntity(x, y, z) : null; if (tile == null) { LogHelper.error("Missing Tile Entity (Generator)"); @@ -89,9 +91,8 @@ public class Generator extends BlockCustomDrop { @Override @SideOnly(Side.CLIENT) public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { - TileGenerator tile = - (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileGenerator) - ? (TileGenerator) world.getTileEntity(x, y, z) + TileGenerator tile = (world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TileGenerator) ? (TileGenerator) world.getTileEntity(x, y, z) : null; if (tile == null) { LogHelper.error("Missing Tile Entity (Generator)"); @@ -169,8 +170,8 @@ public class Generator extends BlockCustomDrop { } @Override - public boolean onBlockActivated( - World world, int x, int y, int z, EntityPlayer player, int side, float prx, float pry, float prz) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float prx, + float pry, float prz) { if (!world.isRemote) { FMLNetworkHandler.openGui(player, DraconicEvolution.instance, GuiHandler.GUIID_GENERATOR, world, x, y, z); } @@ -221,9 +222,8 @@ public class Generator extends BlockCustomDrop { @Override public void randomDisplayTick(World world, int x, int y, int z, Random random) { - TileGenerator tile = - (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileGenerator) - ? (TileGenerator) world.getTileEntity(x, y, z) + TileGenerator tile = (world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TileGenerator) ? (TileGenerator) world.getTileEntity(x, y, z) : null; if (tile == null) { LogHelper.error("Missing Tile Entity (Generator)"); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/Grinder.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/Grinder.java index 2f895876..28170db3 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/Grinder.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/Grinder.java @@ -1,16 +1,7 @@ package com.brandon3055.draconicevolution.common.blocks.machine; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.client.gui.GuiHandler; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.tileentities.TileGrinder; -import cpw.mods.fml.common.network.internal.FMLNetworkHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.List; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -26,7 +17,20 @@ import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.client.gui.GuiHandler; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.tileentities.TileGrinder; + +import cpw.mods.fml.common.network.internal.FMLNetworkHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class Grinder extends BlockCustomDrop { + public IIcon icon_front; public IIcon icon_side; public IIcon icon_back; @@ -146,8 +150,8 @@ public class Grinder extends BlockCustomDrop { } @Override - public boolean onBlockActivated( - World world, int X, int Y, int Z, EntityPlayer player, int side, float prx, float pry, float prz) { + public boolean onBlockActivated(World world, int X, int Y, int Z, EntityPlayer player, int side, float prx, + float pry, float prz) { TileEntity tile = world.getTileEntity(X, Y, Z); if (!(tile instanceof TileGrinder)) { return false; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/LongRangeDislocator.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/LongRangeDislocator.java index 9b68623e..6d42ac93 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/LongRangeDislocator.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/LongRangeDislocator.java @@ -1,17 +1,8 @@ package com.brandon3055.draconicevolution.common.blocks.machine; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.blocks.BlockDE; -import com.brandon3055.draconicevolution.common.blocks.itemblocks.LRDItemBlock; -import com.brandon3055.draconicevolution.common.handler.ConfigHandler; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.utills.LogHelper; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.List; import java.util.Random; + import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -25,6 +16,18 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.BlockDE; +import com.brandon3055.draconicevolution.common.blocks.itemblocks.LRDItemBlock; +import com.brandon3055.draconicevolution.common.handler.ConfigHandler; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.utills.LogHelper; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 20/07/2014. */ @@ -60,16 +63,8 @@ public class LongRangeDislocator extends BlockDE { } @Override - public boolean onBlockActivated( - World world, - int x, - int y, - int z, - EntityPlayer player, - int p_149727_6_, - float p_149727_7_, - float p_149727_8_, - float p_149727_9_) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, + float p_149727_7_, float p_149727_8_, float p_149727_9_) { int meta = world.getBlockMetadata(x, y, z); if (meta == 0) return false; // return teleportPlayer(world, player, false); else if (meta == 1) return false; @@ -110,8 +105,12 @@ public class LongRangeDislocator extends BlockDE { break; } } - player.addChatComponentMessage(new ChatComponentText("" + EnumChatFormatting.RED + "[WARNING]" - + EnumChatFormatting.WHITE + " Do not move until the world loads!")); + player.addChatComponentMessage( + new ChatComponentText( + "" + EnumChatFormatting.RED + + "[WARNING]" + + EnumChatFormatting.WHITE + + " Do not move until the world loads!")); if (world.getBlock(randX, y, randZ).isBlockSolid(world, randX, y, randZ, 0)) { world.setBlock(randX, y, randZ, world.getBlock(randX, y, randZ)); player.setLocationAndAngles(randX + 0.5, y + 1.5, randZ + 0.5, 0F, 0F); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/PlayerDetector.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/PlayerDetector.java index 5c4a34fe..3104c0ce 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/PlayerDetector.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/PlayerDetector.java @@ -1,11 +1,5 @@ package com.brandon3055.draconicevolution.common.blocks.machine; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.blocks.BlockDE; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.tileentities.TilePlayerDetector; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -17,7 +11,15 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.BlockDE; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.tileentities.TilePlayerDetector; + public class PlayerDetector extends BlockDE { + IIcon side_inactive; IIcon side_active; IIcon top; @@ -58,8 +60,8 @@ public class PlayerDetector extends BlockDE { } @Override - public boolean isBlockSolid( - IBlockAccess p_149747_1_, int p_149747_2_, int p_149747_3_, int p_149747_4_, int p_149747_5_) { + public boolean isBlockSolid(IBlockAccess p_149747_1_, int p_149747_2_, int p_149747_3_, int p_149747_4_, + int p_149747_5_) { return true; } @@ -106,16 +108,8 @@ public class PlayerDetector extends BlockDE { } @Override - public boolean onBlockActivated( - World world, - int x, - int y, - int z, - EntityPlayer player, - int side, - float p_149727_7_, - float p_149727_8_, - float p_149727_9_) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float p_149727_7_, + float p_149727_8_, float p_149727_9_) { TileEntity te = world.getTileEntity(x, y, z); TilePlayerDetector detector = (te != null && te instanceof TilePlayerDetector) ? (TilePlayerDetector) te : null; if (detector != null) { @@ -131,9 +125,8 @@ public class PlayerDetector extends BlockDE { if (range < 1) range = 10; detector.setRange(range); - if (world.isRemote) - player.addChatMessage(new ChatComponentTranslation("msg.range.txt") - .appendSibling(new ChatComponentText(" " + range))); + if (world.isRemote) player.addChatMessage( + new ChatComponentTranslation("msg.range.txt").appendSibling(new ChatComponentText(" " + range))); } return true; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/PlayerDetectorAdvanced.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/PlayerDetectorAdvanced.java index 613ef3a9..b99daa3b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/PlayerDetectorAdvanced.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/PlayerDetectorAdvanced.java @@ -1,16 +1,7 @@ package com.brandon3055.draconicevolution.common.blocks.machine; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.client.gui.GuiHandler; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.tileentities.TilePlayerDetectorAdvanced; -import cpw.mods.fml.common.network.internal.FMLNetworkHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.List; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -23,7 +14,20 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.client.gui.GuiHandler; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.tileentities.TilePlayerDetectorAdvanced; + +import cpw.mods.fml.common.network.internal.FMLNetworkHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class PlayerDetectorAdvanced extends BlockCustomDrop { + IIcon side_inactive; IIcon side_active; IIcon top; @@ -40,16 +44,16 @@ public class PlayerDetectorAdvanced extends BlockCustomDrop { @SideOnly(Side.CLIENT) @Override public void registerBlockIcons(IIconRegister iconRegister) { - side_inactive = - iconRegister.registerIcon(References.RESOURCESPREFIX + "advanced_player_detector_side_inactive"); + side_inactive = iconRegister + .registerIcon(References.RESOURCESPREFIX + "advanced_player_detector_side_inactive"); side_active = iconRegister.registerIcon(References.RESOURCESPREFIX + "advanced_player_detector_side_active"); top = iconRegister.registerIcon(References.RESOURCESPREFIX + "machine_top_0"); bottom = iconRegister.registerIcon(References.RESOURCESPREFIX + "machine_side"); } @Override - public boolean isBlockSolid( - IBlockAccess p_149747_1_, int p_149747_2_, int p_149747_3_, int p_149747_4_, int p_149747_5_) { + public boolean isBlockSolid(IBlockAccess p_149747_1_, int p_149747_2_, int p_149747_3_, int p_149747_4_, + int p_149747_5_) { return true; } @@ -64,8 +68,9 @@ public class PlayerDetectorAdvanced extends BlockCustomDrop { IIcon side_icon; TileEntity tile = world.getTileEntity(x, y, z); - TilePlayerDetectorAdvanced detector = - (tile != null && tile instanceof TilePlayerDetectorAdvanced) ? (TilePlayerDetectorAdvanced) tile : null; + TilePlayerDetectorAdvanced detector = (tile != null && tile instanceof TilePlayerDetectorAdvanced) + ? (TilePlayerDetectorAdvanced) tile + : null; if (detector != null && detector.getStackInSlot(0) != null) { ItemStack stack = detector.getStackInSlot(0); Block block = Block.getBlockFromItem(stack.getItem()); @@ -96,19 +101,11 @@ public class PlayerDetectorAdvanced extends BlockCustomDrop { } @Override - public boolean onBlockActivated( - World world, - int x, - int y, - int z, - EntityPlayer player, - int p_149727_6_, - float p_149727_7_, - float p_149727_8_, - float p_149727_9_) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, + float p_149727_7_, float p_149727_8_, float p_149727_9_) { if (!world.isRemote) { - FMLNetworkHandler.openGui( - player, DraconicEvolution.instance, GuiHandler.GUIID_PLAYERDETECTOR, world, x, y, z); + FMLNetworkHandler + .openGui(player, DraconicEvolution.instance, GuiHandler.GUIID_PLAYERDETECTOR, world, x, y, z); } return true; } @@ -127,22 +124,22 @@ public class PlayerDetectorAdvanced extends BlockCustomDrop { @Override public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int meta) { TileEntity te = world.getTileEntity(x, y, z); - TilePlayerDetectorAdvanced detector = - (te != null && te instanceof TilePlayerDetectorAdvanced) ? (TilePlayerDetectorAdvanced) te : null; - if (detector != null) - if (!detector.outputInverted) return detector.output ? 15 : 0; - else return detector.output ? 0 : 15; + TilePlayerDetectorAdvanced detector = (te != null && te instanceof TilePlayerDetectorAdvanced) + ? (TilePlayerDetectorAdvanced) te + : null; + if (detector != null) if (!detector.outputInverted) return detector.output ? 15 : 0; + else return detector.output ? 0 : 15; else return 0; } @Override public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int meta) { TileEntity te = world.getTileEntity(x, y, z); - TilePlayerDetectorAdvanced detector = - (te != null && te instanceof TilePlayerDetectorAdvanced) ? (TilePlayerDetectorAdvanced) te : null; - if (detector != null) - if (!detector.outputInverted) return detector.output ? 15 : 0; - else return detector.output ? 0 : 15; + TilePlayerDetectorAdvanced detector = (te != null && te instanceof TilePlayerDetectorAdvanced) + ? (TilePlayerDetectorAdvanced) te + : null; + if (detector != null) if (!detector.outputInverted) return detector.output ? 15 : 0; + else return detector.output ? 0 : 15; else return 0; } @@ -162,8 +159,9 @@ public class PlayerDetectorAdvanced extends BlockCustomDrop { @Override public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) { TileEntity te = world.getTileEntity(x, y, z); - TilePlayerDetectorAdvanced detector = - (te != null && te instanceof TilePlayerDetectorAdvanced) ? (TilePlayerDetectorAdvanced) te : null; + TilePlayerDetectorAdvanced detector = (te != null && te instanceof TilePlayerDetectorAdvanced) + ? (TilePlayerDetectorAdvanced) te + : null; if (detector != null && detector.getStackInSlot(0) != null) { return detector.getStackInSlot(0); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/SunDial.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/SunDial.java index cc9863ba..37eb4492 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/SunDial.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/SunDial.java @@ -1,13 +1,5 @@ package com.brandon3055.draconicevolution.common.blocks.machine; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.blocks.BlockDE; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.tileentities.TileSunDial; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -16,7 +8,18 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.BlockDE; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.tileentities.TileSunDial; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class SunDial extends BlockDE { + // @SideOnly(Side.CLIENT) public IIcon icon_front; public IIcon icon_front_active; @@ -75,16 +78,8 @@ public class SunDial extends BlockDE { } @Override - public boolean onBlockActivated( - final World world, - final int x, - final int y, - final int z, - final EntityPlayer entityPlayer, - final int par1, - final float par2, - final float par3, - final float par4) { + public boolean onBlockActivated(final World world, final int x, final int y, final int z, + final EntityPlayer entityPlayer, final int par1, final float par2, final float par3, final float par4) { if (!world.isRemote) { // FMLNetworkHandler.openGui(entityPlayer, DraconicEvolution.instance, 1, world, x, y, z); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/UpgradeModifier.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/UpgradeModifier.java index fc5e1897..3e570c3b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/UpgradeModifier.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/UpgradeModifier.java @@ -1,14 +1,7 @@ package com.brandon3055.draconicevolution.common.blocks.machine; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.client.gui.GuiHandler; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop; -import com.brandon3055.draconicevolution.common.tileentities.TileUpgradeModifier; -import cpw.mods.fml.common.network.internal.FMLNetworkHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.List; + import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -18,10 +11,21 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.client.gui.GuiHandler; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop; +import com.brandon3055.draconicevolution.common.tileentities.TileUpgradeModifier; + +import cpw.mods.fml.common.network.internal.FMLNetworkHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by brandon3055 on 23/12/2015. */ public class UpgradeModifier extends BlockCustomDrop { + public UpgradeModifier() { super(Material.iron); this.setBlockName("upgradeModifier"); @@ -43,11 +47,11 @@ public class UpgradeModifier extends BlockCustomDrop { } @Override - public boolean onBlockActivated( - World world, int x, int y, int z, EntityPlayer player, int side, float prx, float pry, float prz) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float prx, + float pry, float prz) { if (!world.isRemote) { - FMLNetworkHandler.openGui( - player, DraconicEvolution.instance, GuiHandler.GUIID_UPGRADE_MODIFIER, world, x, y, z); + FMLNetworkHandler + .openGui(player, DraconicEvolution.instance, GuiHandler.GUIID_UPGRADE_MODIFIER, world, x, y, z); } world.markBlockForUpdate(x, y, z); return true; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/WeatherController.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/WeatherController.java index 0f1d9e60..e6826f32 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/WeatherController.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/machine/WeatherController.java @@ -1,16 +1,7 @@ package com.brandon3055.draconicevolution.common.blocks.machine; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.client.gui.GuiHandler; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.tileentities.TileWeatherController; -import cpw.mods.fml.common.network.internal.FMLNetworkHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.List; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -23,6 +14,18 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.client.gui.GuiHandler; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.tileentities.TileWeatherController; + +import cpw.mods.fml.common.network.internal.FMLNetworkHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class WeatherController extends BlockCustomDrop { public boolean blockState = true; @@ -53,18 +56,18 @@ public class WeatherController extends BlockCustomDrop { public void registerBlockIcons(final IIconRegister iconRegister) { icon_top = iconRegister.registerIcon(References.RESOURCESPREFIX + "weather_controller/weather_controller_top"); icon_bottom = iconRegister.registerIcon(References.RESOURCESPREFIX + "machine_side"); - icon_side_rain_off = - iconRegister.registerIcon(References.RESOURCESPREFIX + "weather_controller/weather_controller_rain"); - icon_side_rain_on = iconRegister.registerIcon( - References.RESOURCESPREFIX + "weather_controller/weatherController_rain_active"); - icon_side_thunder_off = iconRegister.registerIcon( - References.RESOURCESPREFIX + "weather_controller/weatherController_thunderstorm"); - icon_side_thunder_on = iconRegister.registerIcon( - References.RESOURCESPREFIX + "weather_controller/weatherController_thunderstorm_active"); - icon_side_sun_off = - iconRegister.registerIcon(References.RESOURCESPREFIX + "weather_controller/weatherController_sun"); - icon_side_sun_on = iconRegister.registerIcon( - References.RESOURCESPREFIX + "weather_controller/weatherController_sun_active"); + icon_side_rain_off = iconRegister + .registerIcon(References.RESOURCESPREFIX + "weather_controller/weather_controller_rain"); + icon_side_rain_on = iconRegister + .registerIcon(References.RESOURCESPREFIX + "weather_controller/weatherController_rain_active"); + icon_side_thunder_off = iconRegister + .registerIcon(References.RESOURCESPREFIX + "weather_controller/weatherController_thunderstorm"); + icon_side_thunder_on = iconRegister + .registerIcon(References.RESOURCESPREFIX + "weather_controller/weatherController_thunderstorm_active"); + icon_side_sun_off = iconRegister + .registerIcon(References.RESOURCESPREFIX + "weather_controller/weatherController_sun"); + icon_side_sun_on = iconRegister + .registerIcon(References.RESOURCESPREFIX + "weather_controller/weatherController_sun_active"); } @Override @@ -105,19 +108,17 @@ public class WeatherController extends BlockCustomDrop { } @Override - public boolean onBlockActivated( - final World world, - final int x, - final int y, - final int z, - final EntityPlayer entityPlayer, - final int par1, - final float par2, - final float par3, - final float par4) { + public boolean onBlockActivated(final World world, final int x, final int y, final int z, + final EntityPlayer entityPlayer, final int par1, final float par2, final float par3, final float par4) { if (!world.isRemote) { FMLNetworkHandler.openGui( - entityPlayer, DraconicEvolution.instance, GuiHandler.GUIID_WEATHER_CONTROLLER, world, x, y, z); + entityPlayer, + DraconicEvolution.instance, + GuiHandler.GUIID_WEATHER_CONTROLLER, + world, + x, + y, + z); } return true; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/DislocatorReceptacle.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/DislocatorReceptacle.java index c3232e27..15069d18 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/DislocatorReceptacle.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/DislocatorReceptacle.java @@ -1,13 +1,8 @@ package com.brandon3055.draconicevolution.common.blocks.multiblock; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop; -import com.brandon3055.draconicevolution.common.items.tools.TeleporterMKI; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileDislocatorReceptacle; import java.util.List; import java.util.Random; + import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -20,10 +15,18 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop; +import com.brandon3055.draconicevolution.common.items.tools.TeleporterMKI; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileDislocatorReceptacle; + /** * Created by Brandon on 19/5/2015. */ public class DislocatorReceptacle extends BlockCustomDrop implements ITileEntityProvider { + IIcon textureInactive; public DislocatorReceptacle() { @@ -39,8 +42,8 @@ public class DislocatorReceptacle extends BlockCustomDrop implements ITileEntity @Override public void registerBlockIcons(IIconRegister iconRegister) { - textureInactive = - iconRegister.registerIcon(References.RESOURCESPREFIX + "animated/dislocatorReceptacle_inactive"); + textureInactive = iconRegister + .registerIcon(References.RESOURCESPREFIX + "animated/dislocatorReceptacle_inactive"); blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "animated/dislocatorReceptacle_active"); } @@ -80,16 +83,8 @@ public class DislocatorReceptacle extends BlockCustomDrop implements ITileEntity } @Override - public boolean onBlockActivated( - World world, - int x, - int y, - int z, - EntityPlayer player, - int side, - float p_149727_7_, - float p_149727_8_, - float p_149727_9_) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float p_149727_7_, + float p_149727_8_, float p_149727_9_) { if (world.isRemote) return true; TileDislocatorReceptacle tile = (TileDislocatorReceptacle) world.getTileEntity(x, y, z); if (tile == null) return false; @@ -108,8 +103,7 @@ public class DislocatorReceptacle extends BlockCustomDrop implements ITileEntity } else { ItemStack stack = player.getHeldItem(); - if (stack != null - && stack.getItem() instanceof TeleporterMKI + if (stack != null && stack.getItem() instanceof TeleporterMKI && ((TeleporterMKI) stack.getItem()).getLocation(stack) != null) { tile.setInventorySlotContents(0, player.getHeldItem()); player.destroyCurrentEquippedItem(); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/Earth.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/Earth.java index 320ad7ac..6bcbea23 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/Earth.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/Earth.java @@ -1,19 +1,21 @@ package com.brandon3055.draconicevolution.common.blocks.multiblock; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChatComponentText; +import net.minecraft.world.World; + import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.blocks.BlockDE; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEarth; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ChatComponentText; -import net.minecraft.world.World; public class Earth extends BlockDE { @@ -58,16 +60,8 @@ public class Earth extends BlockDE { } @Override - public boolean onBlockActivated( - World world, - int x, - int y, - int z, - EntityPlayer player, - int p_149727_6_, - float p_149727_7_, - float p_149727_8_, - float p_149727_9_) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, + float p_149727_7_, float p_149727_8_, float p_149727_9_) { TileEarth tile = (TileEarth) world.getTileEntity(x, y, z); if (player.isSneaking()) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/EnergyPylon.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/EnergyPylon.java index 0031c6e9..a410034c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/EnergyPylon.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/EnergyPylon.java @@ -1,13 +1,5 @@ package com.brandon3055.draconicevolution.common.blocks.multiblock; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.blocks.BlockDE; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyPylon; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -18,10 +10,21 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.BlockDE; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyPylon; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 28/07/2014. */ public class EnergyPylon extends BlockDE { // todo fix sphere renderer + @SideOnly(Side.CLIENT) public IIcon icon_active_face; @@ -70,8 +73,8 @@ public class EnergyPylon extends BlockDE { // todo fix sphere renderer int meta = world.getBlockMetadata(x, y, z); if (meta == 1 && side == 1) return icon_active_face; if (meta == 2 && side == 0) return icon_active_face; - TileEnergyPylon thisTile = - (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) + TileEnergyPylon thisTile = (world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) ? (TileEnergyPylon) world.getTileEntity(x, y, z) : null; if (thisTile == null) return icon_input; @@ -90,18 +93,17 @@ public class EnergyPylon extends BlockDE { // todo fix sphere renderer world.setBlock(x, y - 1, z, ModBlocks.invisibleMultiblock, 2, 2); } } else { - TileEnergyPylon thisTile = - (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) + TileEnergyPylon thisTile = (world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) ? (TileEnergyPylon) world.getTileEntity(x, y, z) : null; - if (thisTile == null - || (meta == 1 && !isGlass(world, x, y + 1, z)) + if (thisTile == null || (meta == 1 && !isGlass(world, x, y + 1, z)) || (meta == 2 && !isGlass(world, x, y - 1, z))) { world.setBlockMetadataWithNotify(x, y, z, 0, 2); } } - TileEnergyPylon thisTile = - (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) + TileEnergyPylon thisTile = (world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) ? (TileEnergyPylon) world.getTileEntity(x, y, z) : null; if (thisTile != null) { @@ -116,20 +118,12 @@ public class EnergyPylon extends BlockDE { // todo fix sphere renderer } @Override - public boolean onBlockActivated( - World world, - int x, - int y, - int z, - EntityPlayer player, - int p_149727_6_, - float p_149727_7_, - float p_149727_8_, - float p_149727_9_) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, + float p_149727_7_, float p_149727_8_, float p_149727_9_) { int meta = world.getBlockMetadata(x, y, z); if (meta == 0) return false; - TileEnergyPylon thisTile = - (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) + TileEnergyPylon thisTile = (world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) ? (TileEnergyPylon) world.getTileEntity(x, y, z) : null; if (thisTile != null) { @@ -152,18 +146,17 @@ public class EnergyPylon extends BlockDE { // todo fix sphere renderer world.setBlock(x, y - 1, z, ModBlocks.invisibleMultiblock, 2, 2); } } else { - TileEnergyPylon thisTile = - (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) + TileEnergyPylon thisTile = (world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) ? (TileEnergyPylon) world.getTileEntity(x, y, z) : null; - if (thisTile == null - || (meta == 1 && !isGlass(world, x, y + 1, z)) + if (thisTile == null || (meta == 1 && !isGlass(world, x, y + 1, z)) || (meta == 2 && !isGlass(world, x, y - 1, z))) { world.setBlockMetadataWithNotify(x, y, z, 0, 2); } } - TileEnergyPylon thisTile = - (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) + TileEnergyPylon thisTile = (world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) ? (TileEnergyPylon) world.getTileEntity(x, y, z) : null; if (thisTile != null) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/EnergyStorageCore.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/EnergyStorageCore.java index 1084bf45..17338224 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/EnergyStorageCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/EnergyStorageCore.java @@ -1,19 +1,8 @@ package com.brandon3055.draconicevolution.common.blocks.multiblock; -import com.brandon3055.brandonscore.common.utills.InfoHelper; -import com.brandon3055.brandonscore.common.utills.Utills; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.blocks.BlockDE; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore; -import com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock; -import com.brandon3055.draconicevolution.common.utills.LogHelper; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.List; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -26,6 +15,20 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import com.brandon3055.brandonscore.common.utills.InfoHelper; +import com.brandon3055.brandonscore.common.utills.Utills; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.BlockDE; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore; +import com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock; +import com.brandon3055.draconicevolution.common.utills.LogHelper; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 25/07/2014. */ @@ -67,18 +70,10 @@ public class EnergyStorageCore extends BlockDE implements IHudDisplayBlock { } @Override - public boolean onBlockActivated( - World world, - int x, - int y, - int z, - EntityPlayer player, - int p_149727_6_, - float p_149727_7_, - float p_149727_8_, - float p_149727_9_) { - TileEnergyStorageCore tile = - (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyStorageCore) + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, + float p_149727_7_, float p_149727_8_, float p_149727_9_) { + TileEnergyStorageCore tile = (world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TileEnergyStorageCore) ? (TileEnergyStorageCore) world.getTileEntity(x, y, z) : null; if (tile == null) { @@ -89,9 +84,15 @@ public class EnergyStorageCore extends BlockDE implements IHudDisplayBlock { if (!world.isRemote) { player.addChatComponentMessage(new ChatComponentText("Tier:" + (tile.getTier() + 1))); String BN = String.valueOf(tile.getEnergyStored()); - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("info.de.charge.txt") - + ": " + Utills.formatNumber(tile.getEnergyStored()) + " / " - + Utills.formatNumber(tile.getMaxEnergyStored()) + " [" + BN + " RF]")); + player.addChatComponentMessage( + new ChatComponentText( + StatCollector.translateToLocal("info.de.charge.txt") + ": " + + Utills.formatNumber(tile.getEnergyStored()) + + " / " + + Utills.formatNumber(tile.getMaxEnergyStored()) + + " [" + + BN + + " RF]")); } return true; } @@ -100,20 +101,18 @@ public class EnergyStorageCore extends BlockDE implements IHudDisplayBlock { @SideOnly(Side.CLIENT) public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) { TileEnergyStorageCore tile = (world.getTileEntity( - x - ForgeDirection.getOrientation(side).offsetX, - y - ForgeDirection.getOrientation(side).offsetY, - z - ForgeDirection.getOrientation(side).offsetZ) - != null - && world.getTileEntity( - x - ForgeDirection.getOrientation(side).offsetX, - y - ForgeDirection.getOrientation(side).offsetY, - z - ForgeDirection.getOrientation(side).offsetZ) - instanceof TileEnergyStorageCore) - ? (TileEnergyStorageCore) world.getTileEntity( + x - ForgeDirection.getOrientation(side).offsetX, + y - ForgeDirection.getOrientation(side).offsetY, + z - ForgeDirection.getOrientation(side).offsetZ) != null + && world.getTileEntity( x - ForgeDirection.getOrientation(side).offsetX, y - ForgeDirection.getOrientation(side).offsetY, - z - ForgeDirection.getOrientation(side).offsetZ) - : null; + z - ForgeDirection.getOrientation(side).offsetZ) instanceof TileEnergyStorageCore) + ? (TileEnergyStorageCore) world.getTileEntity( + x - ForgeDirection.getOrientation(side).offsetX, + y - ForgeDirection.getOrientation(side).offsetY, + z - ForgeDirection.getOrientation(side).offsetZ) + : null; // LogHelper.error(world.getTileEntity(x - ForgeDirection.getOrientation(side).offsetX, y - // ForgeDirection.getOrientation(side).offsetY, z - ForgeDirection.getOrientation(side).offsetZ)); if (tile == null) { @@ -126,8 +125,8 @@ public class EnergyStorageCore extends BlockDE implements IHudDisplayBlock { @Override public void onNeighborBlockChange(World world, int x, int y, int z, Block p_149695_5_) { - TileEnergyStorageCore thisTile = - (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyStorageCore) + TileEnergyStorageCore thisTile = (world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TileEnergyStorageCore) ? (TileEnergyStorageCore) world.getTileEntity(x, y, z) : null; if (thisTile != null && thisTile.isOnline() && thisTile.getTier() == 0) { @@ -137,8 +136,8 @@ public class EnergyStorageCore extends BlockDE implements IHudDisplayBlock { @Override public void breakBlock(World world, int x, int y, int z, Block p_149749_5_, int p_149749_6_) { - TileEnergyStorageCore thisTile = - (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyStorageCore) + TileEnergyStorageCore thisTile = (world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TileEnergyStorageCore) ? (TileEnergyStorageCore) world.getTileEntity(x, y, z) : null; if (thisTile != null && thisTile.isOnline() && thisTile.getTier() == 0) { @@ -149,8 +148,8 @@ public class EnergyStorageCore extends BlockDE implements IHudDisplayBlock { @Override public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) { - TileEnergyStorageCore thisTile = - (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyStorageCore) + TileEnergyStorageCore thisTile = (world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TileEnergyStorageCore) ? (TileEnergyStorageCore) world.getTileEntity(x, y, z) : null; if (thisTile != null && thisTile.isOnline()) { @@ -169,8 +168,8 @@ public class EnergyStorageCore extends BlockDE implements IHudDisplayBlock { public List getDisplayData(World world, int x, int y, int z) { List list = new ArrayList(); - TileEnergyStorageCore tile = - (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyStorageCore) + TileEnergyStorageCore tile = (world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TileEnergyStorageCore) ? (TileEnergyStorageCore) world.getTileEntity(x, y, z) : null; if (tile == null) { @@ -181,9 +180,15 @@ public class EnergyStorageCore extends BlockDE implements IHudDisplayBlock { list.add(InfoHelper.HITC() + getLocalizedName()); list.add("Tier: " + InfoHelper.ITC() + (tile.getTier() + 1)); String BN = String.valueOf(tile.getEnergyStored()); - list.add(StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.ITC() - + Utills.formatNumber(tile.getEnergyStored()) + " / " + Utills.formatNumber(tile.getMaxEnergyStored()) - + " [" + BN + " RF]"); + list.add( + StatCollector.translateToLocal("info.de.charge.txt") + ": " + + InfoHelper.ITC() + + Utills.formatNumber(tile.getEnergyStored()) + + " / " + + Utills.formatNumber(tile.getMaxEnergyStored()) + + " [" + + BN + + " RF]"); return list; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/IReactorPart.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/IReactorPart.java index 970f5927..caf24725 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/IReactorPart.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/IReactorPart.java @@ -4,6 +4,7 @@ package com.brandon3055.draconicevolution.common.blocks.multiblock; * Created by Brandon on 23/7/2015. */ public interface IReactorPart { + public static int RMODE_TEMP = 0; public static int RMODE_TEMP_INV = 1; public static int RMODE_FIELD = 2; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/InvisibleMultiblock.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/InvisibleMultiblock.java index 02ed0492..ecc74380 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/InvisibleMultiblock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/InvisibleMultiblock.java @@ -1,22 +1,9 @@ package com.brandon3055.draconicevolution.common.blocks.multiblock; -import com.brandon3055.brandonscore.common.utills.InfoHelper; -import com.brandon3055.brandonscore.common.utills.Utills; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.blocks.BlockDE; -import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyPylon; -import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore; -import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileInvisibleMultiblock; -import com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock; -import com.brandon3055.draconicevolution.common.utills.LogHelper; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.List; import java.util.Random; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -31,6 +18,22 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.StatCollector; import net.minecraft.world.World; +import com.brandon3055.brandonscore.common.utills.InfoHelper; +import com.brandon3055.brandonscore.common.utills.Utills; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.BlockDE; +import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyPylon; +import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore; +import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileInvisibleMultiblock; +import com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock; +import com.brandon3055.draconicevolution.common.utills.LogHelper; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 25/07/2014. */ @@ -101,22 +104,14 @@ public class InvisibleMultiblock extends BlockDE implements IHudDisplayBlock { } @Override - public boolean onBlockActivated( - World world, - int x, - int y, - int z, - EntityPlayer player, - int p_149727_6_, - float p_149727_7_, - float p_149727_8_, - float p_149727_9_) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, + float p_149727_7_, float p_149727_8_, float p_149727_9_) { int meta = world.getBlockMetadata(x, y, z); if (meta == 0 || meta == 1) { TileInvisibleMultiblock thisTile = (world.getTileEntity(x, y, z) != null - && world.getTileEntity(x, y, z) instanceof TileInvisibleMultiblock) - ? (TileInvisibleMultiblock) world.getTileEntity(x, y, z) - : null; + && world.getTileEntity(x, y, z) instanceof TileInvisibleMultiblock) + ? (TileInvisibleMultiblock) world.getTileEntity(x, y, z) + : null; if (thisTile == null) { LogHelper.error("Missing Tile Entity (TileInvisibleMultiblock)"); return false; @@ -131,19 +126,24 @@ public class InvisibleMultiblock extends BlockDE implements IHudDisplayBlock { player.addChatComponentMessage(new ChatComponentText("Tier:" + (master.getTier() + 1))); String BN = String.valueOf(master.getEnergyStored()); player.addChatComponentMessage( - new ChatComponentText(StatCollector.translateToLocal("info.de.charge.txt") + ": " - + Utills.formatNumber(master.getEnergyStored()) + " / " - + Utills.formatNumber(master.getMaxEnergyStored()) + " [" + BN + " RF]")); + new ChatComponentText( + StatCollector.translateToLocal("info.de.charge.txt") + ": " + + Utills.formatNumber(master.getEnergyStored()) + + " / " + + Utills.formatNumber(master.getMaxEnergyStored()) + + " [" + + BN + + " RF]")); } return true; } else if (meta == 2) { TileEnergyPylon pylon = (world.getTileEntity(x, y + 1, z) != null - && world.getTileEntity(x, y + 1, z) instanceof TileEnergyPylon) - ? (TileEnergyPylon) world.getTileEntity(x, y + 1, z) - : (world.getTileEntity(x, y - 1, z) != null + && world.getTileEntity(x, y + 1, z) instanceof TileEnergyPylon) + ? (TileEnergyPylon) world.getTileEntity(x, y + 1, z) + : (world.getTileEntity(x, y - 1, z) != null && world.getTileEntity(x, y - 1, z) instanceof TileEnergyPylon) - ? (TileEnergyPylon) world.getTileEntity(x, y - 1, z) - : null; + ? (TileEnergyPylon) world.getTileEntity(x, y - 1, z) + : null; if (pylon == null) return false; pylon.reciveEnergy = !pylon.reciveEnergy; world.markBlockForUpdate(pylon.xCoord, pylon.yCoord, pylon.zCoord); @@ -158,9 +158,9 @@ public class InvisibleMultiblock extends BlockDE implements IHudDisplayBlock { int meta = world.getBlockMetadata(x, y, z); if (meta == 0 || meta == 1) { TileInvisibleMultiblock thisTile = (world.getTileEntity(x, y, z) != null - && world.getTileEntity(x, y, z) instanceof TileInvisibleMultiblock) - ? (TileInvisibleMultiblock) world.getTileEntity(x, y, z) - : null; + && world.getTileEntity(x, y, z) instanceof TileInvisibleMultiblock) + ? (TileInvisibleMultiblock) world.getTileEntity(x, y, z) + : null; if (thisTile == null) { LogHelper.error("Missing Tile Entity (TileInvisibleMultiblock)"); revert(world, x, y, z); @@ -172,12 +172,12 @@ public class InvisibleMultiblock extends BlockDE implements IHudDisplayBlock { revert(world, x, y, z); return; } - if (master.isOnline()) - master.isStructureStillValid(thisTile.getMaster().getTier() == 1); + if (master.isOnline()) master.isStructureStillValid(thisTile.getMaster().getTier() == 1); if (!master.isOnline()) revert(world, x, y, z); } else if (meta == 2) { if (world.getBlock(x, y + 1, z) != ModBlocks.energyPylon - && world.getBlock(x, y - 1, z) != ModBlocks.energyPylon) world.setBlock(x, y, z, Blocks.glass); + && world.getBlock(x, y - 1, z) != ModBlocks.energyPylon) + world.setBlock(x, y, z, Blocks.glass); } } @@ -205,11 +205,10 @@ public class InvisibleMultiblock extends BlockDE implements IHudDisplayBlock { @Override public void breakBlock(World world, int x, int y, int z, Block p_149749_5_, int meta) { TileEntity tile = world.getTileEntity(x, y, z); - TileInvisibleMultiblock thisTile = - (tile != null && tile instanceof TileInvisibleMultiblock) ? (TileInvisibleMultiblock) tile : null; - if (thisTile != null - && thisTile.getMaster() != null - && thisTile.getMaster().isOnline()) { + TileInvisibleMultiblock thisTile = (tile != null && tile instanceof TileInvisibleMultiblock) + ? (TileInvisibleMultiblock) tile + : null; + if (thisTile != null && thisTile.getMaster() != null && thisTile.getMaster().isOnline()) { world.setBlockMetadataWithNotify(x, y, z, 0, 2); thisTile.getMaster().isStructureStillValid(thisTile.getMaster().getTier() == 1); @@ -222,9 +221,9 @@ public class InvisibleMultiblock extends BlockDE implements IHudDisplayBlock { int meta = world.getBlockMetadata(x, y, z); if (meta == 0 || meta == 1) { TileInvisibleMultiblock thisTile = (world.getTileEntity(x, y, z) != null - && world.getTileEntity(x, y, z) instanceof TileInvisibleMultiblock) - ? (TileInvisibleMultiblock) world.getTileEntity(x, y, z) - : null; + && world.getTileEntity(x, y, z) instanceof TileInvisibleMultiblock) + ? (TileInvisibleMultiblock) world.getTileEntity(x, y, z) + : null; if (thisTile != null && thisTile.getMaster() != null) { return AxisAlignedBB.getBoundingBox( thisTile.getMaster().xCoord, @@ -276,9 +275,9 @@ public class InvisibleMultiblock extends BlockDE implements IHudDisplayBlock { int meta = world.getBlockMetadata(x, y, z); if (meta == 0 || meta == 1) { TileInvisibleMultiblock thisTile = (world.getTileEntity(x, y, z) != null - && world.getTileEntity(x, y, z) instanceof TileInvisibleMultiblock) - ? (TileInvisibleMultiblock) world.getTileEntity(x, y, z) - : null; + && world.getTileEntity(x, y, z) instanceof TileInvisibleMultiblock) + ? (TileInvisibleMultiblock) world.getTileEntity(x, y, z) + : null; if (thisTile == null) { LogHelper.error("Missing Tile Entity (TileInvisibleMultiblock getDisplayData)"); return list; @@ -293,10 +292,15 @@ public class InvisibleMultiblock extends BlockDE implements IHudDisplayBlock { list.add(InfoHelper.HITC() + ModBlocks.energyStorageCore.getLocalizedName()); list.add("Tier: " + InfoHelper.ITC() + (master.getTier() + 1)); String BN = String.valueOf(master.getEnergyStored()); - list.add(StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.ITC() - + Utills.formatNumber(master.getEnergyStored()) + " / " - + Utills.formatNumber(master.getMaxEnergyStored()) + " [" - + Utills.addCommas(master.getEnergyStored()) + " RF]"); + list.add( + StatCollector.translateToLocal("info.de.charge.txt") + ": " + + InfoHelper.ITC() + + Utills.formatNumber(master.getEnergyStored()) + + " / " + + Utills.formatNumber(master.getMaxEnergyStored()) + + " [" + + Utills.addCommas(master.getEnergyStored()) + + " RF]"); return list; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/MultiblockHelper.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/MultiblockHelper.java index 7e82eb70..29007fc7 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/MultiblockHelper.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/MultiblockHelper.java @@ -11,6 +11,7 @@ import net.minecraft.world.World; public class MultiblockHelper { public static class TileLocation extends ChunkCoordinates { + public boolean initialized = false; public TileLocation() {} @@ -79,6 +80,7 @@ public class MultiblockHelper { } public static class TileOffset { + public int offsetX; public int offsetY; public int offsetZ; @@ -122,8 +124,7 @@ public class MultiblockHelper { } public TileEntity getTileEntity(TileEntity tileEntity) { - return tileEntity - .getWorldObj() + return tileEntity.getWorldObj() .getTileEntity(getXCoord(tileEntity), getYCoord(tileEntity), getZCoord(tileEntity)); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/Portal.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/Portal.java index 3be88afd..d7fce57b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/Portal.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/Portal.java @@ -1,13 +1,7 @@ package com.brandon3055.draconicevolution.common.blocks.multiblock; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.blocks.BlockDE; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileDislocatorReceptacle; -import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TilePortalBlock; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.Random; + import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; @@ -19,6 +13,15 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.BlockDE; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileDislocatorReceptacle; +import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TilePortalBlock; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 23/5/2015. */ @@ -44,8 +47,8 @@ public class Portal extends BlockDE implements ITileEntityProvider { } @Override - public AxisAlignedBB getSelectedBoundingBoxFromPool( - World p_149633_1_, int p_149633_2_, int p_149633_3_, int p_149633_4_) { + public AxisAlignedBB getSelectedBoundingBoxFromPool(World p_149633_1_, int p_149633_2_, int p_149633_3_, + int p_149633_4_) { return AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0); } @@ -65,8 +68,8 @@ public class Portal extends BlockDE implements ITileEntityProvider { } @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool( - World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) { + public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, + int p_149668_4_) { return null; } @@ -111,8 +114,7 @@ public class Portal extends BlockDE implements ITileEntityProvider { private boolean isPortalOrFrame(IBlockAccess access, int x, int y, int z) { Block block = access.getBlock(x, y, z); - return block == ModBlocks.portal - || block == ModBlocks.infusedObsidian + return block == ModBlocks.portal || block == ModBlocks.infusedObsidian || block == ModBlocks.dislocatorReceptacle; } @@ -125,18 +127,18 @@ public class Portal extends BlockDE implements ITileEntityProvider { if (world.isRemote || world.getBlockMetadata(x, y, z) != 0) return; int meta = 0; - if (isPortalOrFrame(world, x, y + 1, z) - && isPortalOrFrame(world, x, y - 1, z) + if (isPortalOrFrame(world, x, y + 1, z) && isPortalOrFrame(world, x, y - 1, z) && isPortalOrFrame(world, x + 1, y, z) - && isPortalOrFrame(world, x - 1, y, z)) meta = 1; - else if (isPortalOrFrame(world, x, y + 1, z) - && isPortalOrFrame(world, x, y - 1, z) + && isPortalOrFrame(world, x - 1, y, z)) + meta = 1; + else if (isPortalOrFrame(world, x, y + 1, z) && isPortalOrFrame(world, x, y - 1, z) && isPortalOrFrame(world, x, y, z + 1) - && isPortalOrFrame(world, x, y, z - 1)) meta = 2; - else if (isPortalOrFrame(world, x + 1, y, z) - && isPortalOrFrame(world, x - 1, y, z) + && isPortalOrFrame(world, x, y, z - 1)) + meta = 2; + else if (isPortalOrFrame(world, x + 1, y, z) && isPortalOrFrame(world, x - 1, y, z) && isPortalOrFrame(world, x, y, z + 1) - && isPortalOrFrame(world, x, y, z - 1)) meta = 3; + && isPortalOrFrame(world, x, y, z - 1)) + meta = 3; world.setBlockMetadataWithNotify(x, y, z, meta, 2); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorCore.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorCore.java index aadf2c86..6f647fd7 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorCore.java @@ -1,12 +1,5 @@ package com.brandon3055.draconicevolution.common.blocks.multiblock; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.blocks.BlockDE; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -14,6 +7,15 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.BlockDE; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 16/6/2015. */ @@ -69,21 +71,13 @@ public class ReactorCore extends BlockDE { @Override public AxisAlignedBB getSelectedBoundingBoxFromPool(World p_149633_1_, int x, int y, int z) { - return AxisAlignedBB.getBoundingBox( - 0, 0, 0, 1, 1, 1); // super.getSelectedBoundingBoxFromPool(p_149633_1_, x, y, z); + return AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 1, 1); // super.getSelectedBoundingBoxFromPool(p_149633_1_, x, + // y, z); } @Override - public boolean onBlockActivated( - World world, - int x, - int y, - int z, - EntityPlayer player, - int p_149727_6_, - float p_149727_7_, - float p_149727_8_, - float p_149727_9_) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, + float p_149727_7_, float p_149727_8_, float p_149727_9_) { // TileReactorCore tile = world.getTileEntity(x, y, z) instanceof TileReactorCore ? (TileReactorCore) // world.getTileEntity(x, y, z) : null; // if (tile != null) return tile.onStructureRightClicked(player); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorEnergyInjector.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorEnergyInjector.java index e5b74bd2..bc011ba3 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorEnergyInjector.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorEnergyInjector.java @@ -1,14 +1,5 @@ package com.brandon3055.draconicevolution.common.blocks.multiblock; -import com.brandon3055.brandonscore.common.utills.Utills; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.blocks.BlockDE; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore; -import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorEnergyInjector; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -20,10 +11,22 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import com.brandon3055.brandonscore.common.utills.Utills; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.BlockDE; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore; +import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorEnergyInjector; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 23/7/2015. */ public class ReactorEnergyInjector extends BlockDE { + public ReactorEnergyInjector() { this.setCreativeTab(DraconicEvolution.tabBlocksItems); this.setBlockName("reactorEnergyInjector"); @@ -121,16 +124,8 @@ public class ReactorEnergyInjector extends BlockDE { } @Override - public boolean onBlockActivated( - World world, - int x, - int y, - int z, - EntityPlayer player, - int p_149727_6_, - float p_149727_7_, - float p_149727_8_, - float p_149727_9_) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, + float p_149727_7_, float p_149727_8_, float p_149727_9_) { IReactorPart tile = world.getTileEntity(x, y, z) instanceof IReactorPart ? (IReactorPart) world.getTileEntity(x, y, z) : null; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorStabilizer.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorStabilizer.java index 67119fd9..7a557187 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorStabilizer.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorStabilizer.java @@ -1,14 +1,5 @@ package com.brandon3055.draconicevolution.common.blocks.multiblock; -import com.brandon3055.brandonscore.common.utills.Utills; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.blocks.BlockDE; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore; -import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorStabilizer; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; @@ -19,10 +10,22 @@ import net.minecraft.util.ChatComponentText; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import com.brandon3055.brandonscore.common.utills.Utills; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.BlockDE; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore; +import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorStabilizer; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 5/7/2015. */ public class ReactorStabilizer extends BlockDE { + public ReactorStabilizer() { this.setCreativeTab(DraconicEvolution.tabBlocksItems); this.setBlockName("reactorStabilizer"); @@ -41,16 +44,8 @@ public class ReactorStabilizer extends BlockDE { } @Override - public boolean onBlockActivated( - World world, - int x, - int y, - int z, - EntityPlayer player, - int p_149727_6_, - float p_149727_7_, - float p_149727_8_, - float p_149727_9_) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, + float p_149727_7_, float p_149727_8_, float p_149727_9_) { if (!player.isSneaking()) { TileReactorStabilizer tile = world.getTileEntity(x, y, z) instanceof TileReactorStabilizer ? (TileReactorStabilizer) world.getTileEntity(x, y, z) @@ -102,9 +97,7 @@ public class ReactorStabilizer extends BlockDE { ? (TileReactorStabilizer) world.getTileEntity(x, y, z) : null; if (tile != null) { - if (entity.isSneaking()) - tile.facingDirection = - ForgeDirection.getOrientation(d).getOpposite().ordinal(); + if (entity.isSneaking()) tile.facingDirection = ForgeDirection.getOrientation(d).getOpposite().ordinal(); else tile.facingDirection = ForgeDirection.getOrientation(d).ordinal(); tile.onPlaced(); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerAdvTool.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerAdvTool.java index a7fb717c..beb10e92 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerAdvTool.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerAdvTool.java @@ -1,8 +1,7 @@ package com.brandon3055.draconicevolution.common.container; -import com.brandon3055.draconicevolution.common.inventory.InventoryTool; -import com.brandon3055.draconicevolution.common.utills.IInventoryTool; import java.util.ArrayList; + import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.enchantment.EnumEnchantmentType; @@ -15,6 +14,9 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagList; +import com.brandon3055.draconicevolution.common.inventory.InventoryTool; +import com.brandon3055.draconicevolution.common.utills.IInventoryTool; + /** * Created by Brandon on 13/01/2015. */ @@ -44,8 +46,13 @@ public class ContainerAdvTool extends ContainerDataSync { for (int y = 0; y < 3; y++) { for (int x = 0; x < 9; x++) { - addSlotToContainer(new SlotPlayerInv( - player.inventory, x + y * 9 + 9, 8 + 18 * x, 45 + y * 18, inventoryItemSlot)); + addSlotToContainer( + new SlotPlayerInv( + player.inventory, + x + y * 9 + 9, + 8 + 18 * x, + 45 + y * 18, + inventoryItemSlot)); } } @@ -64,12 +71,13 @@ public class ContainerAdvTool extends ContainerDataSync { for (int y = 0; y < 3; y++) { for (int x = 0; x < 9; x++) { - addSlotToContainer(new SlotPlayerInv( - player.inventory, - x + y * 9 + 9, - -1000 + 8 + 18 * x, - -1000 + 45 + y * 18, - inventoryItemSlot)); + addSlotToContainer( + new SlotPlayerInv( + player.inventory, + x + y * 9 + 9, + -1000 + 8 + 18 * x, + -1000 + 45 + y * 18, + inventoryItemSlot)); } } } @@ -94,32 +102,32 @@ public class ContainerAdvTool extends ContainerDataSync { @Override public ItemStack transferStackInSlot(EntityPlayer player, int i) { - // Slot slot = getSlot(i); + // Slot slot = getSlot(i); // - // if (slot != null && slot.getHasStack()) - // { - // ItemStack stack = slot.getStack(); - // ItemStack result = stack.copy(); + // if (slot != null && slot.getHasStack()) + // { + // ItemStack stack = slot.getStack(); + // ItemStack result = stack.copy(); // - // if (i >= 36){ //To player - // if (!mergeItemStack(stack, 0, 36, false)){ - // return null; - // } - // }else if (stack.stackSize != 1 || !(stack.getItem() instanceof IEnergyContainerItem) || + // if (i >= 36){ //To player + // if (!mergeItemStack(stack, 0, 36, false)){ + // return null; + // } + // }else if (stack.stackSize != 1 || !(stack.getItem() instanceof IEnergyContainerItem) || // !mergeItemStack(stack, 36, 37, false)){ - // return null; - // } + // return null; + // } // - // if (stack.stackSize == 0) { - // slot.putStack(null); - // }else{ - // slot.onSlotChanged(); - // } + // if (stack.stackSize == 0) { + // slot.putStack(null); + // }else{ + // slot.onSlotChanged(); + // } // - // slot.onPickupFromSlot(player, stack); + // slot.onPickupFromSlot(player, stack); // - // return result; - // } + // return result; + // } return null; } @@ -146,6 +154,7 @@ public class ContainerAdvTool extends ContainerDataSync { } public class SlotPlayerInv extends Slot { + public int inventoryItemSlot = -1; public SlotPlayerInv(IInventory iInventory, int slot, int x, int y, int inventoryItemSlot) { @@ -160,6 +169,7 @@ public class ContainerAdvTool extends ContainerDataSync { } public class SlotOblitFilter extends Slot { + public SlotOblitFilter(IInventory iInventory, int slot, int x, int y) { super(iInventory, slot, x, y); } @@ -171,6 +181,7 @@ public class ContainerAdvTool extends ContainerDataSync { } public class SlotEnchantment extends Slot { + InventoryTool inventory; public SlotEnchantment(IInventory iInventory, int slot, int x, int y) { @@ -182,14 +193,15 @@ public class ContainerAdvTool extends ContainerDataSync { if (stack == null || stack.getItem() != Items.enchanted_book || !stack.hasTagCompound()) return false; NBTTagList list = stack.getTagCompound().getTagList("StoredEnchantments", 10); if (list.tagCount() != 1) return false; - Enchantment enchant = - Enchantment.enchantmentsList[list.getCompoundTagAt(0).getInteger("id")]; + Enchantment enchant = Enchantment.enchantmentsList[list.getCompoundTagAt(0).getInteger("id")]; if (inventoryTool.inventoryItem == null || !(inventoryTool.inventoryItem.getItem() instanceof IInventoryTool) || (!((IInventoryTool) inventoryTool.inventoryItem.getItem()).isEnchantValid(enchant) - && enchant.type != EnumEnchantmentType.all)) return false; + && enchant.type != EnumEnchantmentType.all)) + return false; if (EnchantmentHelper.getEnchantments(inventoryTool.inventoryItem) - .containsKey(list.getCompoundTagAt(0).getInteger("id"))) return false; + .containsKey(list.getCompoundTagAt(0).getInteger("id"))) + return false; return super.isItemValid(stack); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDataSync.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDataSync.java index 2c5d50b9..0a7284a2 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDataSync.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDataSync.java @@ -1,13 +1,15 @@ package com.brandon3055.draconicevolution.common.container; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.inventory.Container; + import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.network.TileObjectPacket; import com.brandon3055.draconicevolution.common.tileentities.TileObjectSync; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.inventory.Container; /** * Created by Brandon on 14/11/2014. @@ -23,22 +25,22 @@ public abstract class ContainerDataSync extends Container { // something better between now and then) /** - * Sends two ints to the client-side Container. Normally the first int identifies which variable to update, and the second contains the new - * value. - * if tile != null the packet will be sent to the tile client tile instead of the client container. + * Sends two ints to the client-side Container. Normally the first int identifies which variable to update, and the + * second contains the new value. if tile != null the packet will be sent to the tile client tile instead of the + * client container. */ public Object sendObjectToClient(TileObjectSync tile, int index, Object object) { for (Object p : crafters) { - DraconicEvolution.network.sendTo( - new TileObjectPacket(tile, References.INT_ID, index, object), (EntityPlayerMP) p); + DraconicEvolution.network + .sendTo(new TileObjectPacket(tile, References.INT_ID, index, object), (EntityPlayerMP) p); } return object; } /** - * Sends two ints to the server-side Container. Normally the first int identifies which variable to update, and the second contains the new - * value. - * if tile != null the packet will be sent to the tile client tile instead of the client container. + * Sends two ints to the server-side Container. Normally the first int identifies which variable to update, and the + * second contains the new value. if tile != null the packet will be sent to the tile client tile instead of the + * client container. */ @SideOnly(Side.CLIENT) public Object sendObjectToServer(TileObjectSync tile, int index, Object object) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDissEnchanter.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDissEnchanter.java index 17a8eed2..ff211ebb 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDissEnchanter.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDissEnchanter.java @@ -1,8 +1,5 @@ package com.brandon3055.draconicevolution.common.container; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.draconicevolution.common.inventory.SlotOutput; -import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -12,6 +9,10 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.inventory.SlotOutput; +import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter; + public class ContainerDissEnchanter extends Container { private TileDissEnchanter tile; @@ -61,8 +62,8 @@ public class ContainerDissEnchanter extends Container { } } else if ((!isStackValidForInventory(stack, 0) || !mergeItemStack(stack, 36, 37, false)) && (!isStackValidForInventory(stack, 1) || !mergeItemStack(stack, 37, 38, false))) { - return null; - } + return null; + } if (stack.stackSize == 0) { slot.putStack(null); @@ -85,6 +86,7 @@ public class ContainerDissEnchanter extends Container { } public class SlotBook extends Slot { + public SlotBook(IInventory inventory, int id, int x, int y) { super(inventory, id, x, y); } @@ -101,6 +103,7 @@ public class ContainerDissEnchanter extends Container { } public class SlotEnchantedItem extends Slot { + public SlotEnchantedItem(IInventory inventory, int id, int x, int y) { super(inventory, id, x, y); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDraconiumChest.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDraconiumChest.java index e541ed27..32142b23 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDraconiumChest.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDraconiumChest.java @@ -1,14 +1,5 @@ package com.brandon3055.draconicevolution.common.container; -import cofh.api.energy.IEnergyContainerItem; -import com.brandon3055.draconicevolution.common.blocks.DraconiumChest; -import com.brandon3055.draconicevolution.common.inventory.InventoryCraftingChest; -import com.brandon3055.draconicevolution.common.inventory.InventoryCraftingChestResult; -import com.brandon3055.draconicevolution.common.lib.OreDoublingRegistry; -import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import invtweaks.api.container.ChestContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.*; @@ -18,6 +9,18 @@ import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import cofh.api.energy.IEnergyContainerItem; + +import com.brandon3055.draconicevolution.common.blocks.DraconiumChest; +import com.brandon3055.draconicevolution.common.inventory.InventoryCraftingChest; +import com.brandon3055.draconicevolution.common.inventory.InventoryCraftingChestResult; +import com.brandon3055.draconicevolution.common.lib.OreDoublingRegistry; +import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import invtweaks.api.container.ChestContainer; + @ChestContainer(isLargeChest = false, rowSize = 26) public class ContainerDraconiumChest extends Container { @@ -71,11 +74,12 @@ public class ContainerDraconiumChest extends Container { private void addPlayerInventory() { for (int playerInvRow = 0; playerInvRow < 3; playerInvRow++) { for (int playerInvCol = 0; playerInvCol < 9; playerInvCol++) { - addSlotToContainer(new Slot( - player.inventory, - playerInvCol + (playerInvRow * 9) + 9, - 161 + 18 * playerInvCol, - 179 + playerInvRow * 18)); + addSlotToContainer( + new Slot( + player.inventory, + playerInvCol + (playerInvRow * 9) + 9, + 161 + 18 * playerInvCol, + 179 + playerInvRow * 18)); } } @@ -98,16 +102,20 @@ public class ContainerDraconiumChest extends Container { for (int gridCol = 0; gridCol < 3; ++gridCol) { for (int gridRow = 0; gridRow < 3; ++gridRow) { - addSlotToContainer(new SlotDChest( - craftMatrix, gridRow + (gridCol * 3), xOffset + (gridRow * 18), yOffset + (gridCol * 18))); + addSlotToContainer( + new SlotDChest( + craftMatrix, + gridRow + (gridCol * 3), + xOffset + (gridRow * 18), + yOffset + (gridCol * 18))); } } } @Override public void onCraftMatrixChanged(IInventory inventory) { - craftResult.setInventorySlotContents( - 0, CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj)); + craftResult + .setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj)); } @Override @@ -173,9 +181,9 @@ public class ContainerDraconiumChest extends Container { @Override public void addCraftingToCrafters(ICrafting iCrafting) { super.addCraftingToCrafters(iCrafting); - // iCrafting.sendProgressBarUpdate(this, 0, tile.smeltingProgressTime); - // iCrafting.sendProgressBarUpdate(this, 1, tile.getEnergyStored(ForgeDirection.DOWN)/32); - // iCrafting.sendProgressBarUpdate(this, 2, tile.smeltingBurnSpeed); + // iCrafting.sendProgressBarUpdate(this, 0, tile.smeltingProgressTime); + // iCrafting.sendProgressBarUpdate(this, 1, tile.getEnergyStored(ForgeDirection.DOWN)/32); + // iCrafting.sendProgressBarUpdate(this, 2, tile.smeltingBurnSpeed); } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerEnergyInfuser.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerEnergyInfuser.java index e8817e1a..55e80051 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerEnergyInfuser.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerEnergyInfuser.java @@ -1,15 +1,18 @@ package com.brandon3055.draconicevolution.common.container; -import cofh.api.energy.IEnergyContainerItem; -import com.brandon3055.draconicevolution.common.inventory.SlotChargable; -import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +import cofh.api.energy.IEnergyContainerItem; + +import com.brandon3055.draconicevolution.common.inventory.SlotChargable; +import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class ContainerEnergyInfuser extends ContainerDataSync { private TileEnergyInfuser tile; @@ -50,11 +53,10 @@ public class ContainerEnergyInfuser extends ContainerDataSync { if (!mergeItemStack(stack, 0, 36, false)) { return null; } - } else if (stack.stackSize != 1 - || !(stack.getItem() instanceof IEnergyContainerItem) + } else if (stack.stackSize != 1 || !(stack.getItem() instanceof IEnergyContainerItem) || !mergeItemStack(stack, 36, 37, false)) { - return null; - } + return null; + } if (stack.stackSize == 0) { slot.putStack(null); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerGenerator.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerGenerator.java index 6c525585..19096cdb 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerGenerator.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerGenerator.java @@ -1,15 +1,17 @@ package com.brandon3055.draconicevolution.common.container; -import com.brandon3055.draconicevolution.common.inventory.SlotItemValid; -import com.brandon3055.draconicevolution.common.tileentities.TileGenerator; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; +import com.brandon3055.draconicevolution.common.inventory.SlotItemValid; +import com.brandon3055.draconicevolution.common.tileentities.TileGenerator; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class ContainerGenerator extends ContainerDataSync { private TileGenerator tile; @@ -52,8 +54,8 @@ public class ContainerGenerator extends ContainerDataSync { } } else if (TileGenerator.getItemBurnTime(stack) == 0 || !mergeItemStack(stack, 36, 36 + tile.getSizeInventory(), false)) { - return null; - } + return null; + } if (stack.stackSize == 0) { slot.putStack(null); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerGrinder.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerGrinder.java index 2280c4b8..376e52a0 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerGrinder.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerGrinder.java @@ -1,14 +1,16 @@ package com.brandon3055.draconicevolution.common.container; -import com.brandon3055.draconicevolution.common.inventory.SlotItemValid; -import com.brandon3055.draconicevolution.common.tileentities.TileGrinder; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +import com.brandon3055.draconicevolution.common.inventory.SlotItemValid; +import com.brandon3055.draconicevolution.common.tileentities.TileGrinder; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class ContainerGrinder extends ContainerDataSync { private TileGrinder tile; @@ -52,8 +54,8 @@ public class ContainerGrinder extends ContainerDataSync { } } else if (TileGrinder.getItemBurnTime(stack) == 0 || !mergeItemStack(stack, 36, 36 + tile.getSizeInventory(), false)) { - return null; - } + return null; + } if (stack.stackSize == 0) { slot.putStack(null); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerPlayerDetector.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerPlayerDetector.java index 5a40a589..dcee948a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerPlayerDetector.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerPlayerDetector.java @@ -1,15 +1,17 @@ package com.brandon3055.draconicevolution.common.container; -import com.brandon3055.draconicevolution.client.gui.GUIPlayerDetector; -import com.brandon3055.draconicevolution.common.inventory.SlotOpaqueBlock; -import com.brandon3055.draconicevolution.common.tileentities.TilePlayerDetectorAdvanced; import java.util.Iterator; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +import com.brandon3055.draconicevolution.client.gui.GUIPlayerDetector; +import com.brandon3055.draconicevolution.common.inventory.SlotOpaqueBlock; +import com.brandon3055.draconicevolution.common.tileentities.TilePlayerDetectorAdvanced; + public class ContainerPlayerDetector extends Container { private TilePlayerDetectorAdvanced tileDetector; @@ -23,8 +25,8 @@ public class ContainerPlayerDetector extends Container { updateContainerSlots(); } - public ContainerPlayerDetector( - InventoryPlayer invPlayer, TilePlayerDetectorAdvanced tileDetector, GUIPlayerDetector gui) { + public ContainerPlayerDetector(InventoryPlayer invPlayer, TilePlayerDetectorAdvanced tileDetector, + GUIPlayerDetector gui) { this.tileDetector = tileDetector; this.gui = gui; @@ -96,34 +98,34 @@ public class ContainerPlayerDetector extends Container { @Override public ItemStack transferStackInSlot(EntityPlayer player, int i) { - // Slot slot = getSlot(i); + // Slot slot = getSlot(i); // // - // if (slot != null && slot.getHasStack()) - // { - // ItemStack stack = slot.getStack(); - // ItemStack result = stack.copy(); - // Block block = Block.getBlockFromItem(stack.getItem()); + // if (slot != null && slot.getHasStack()) + // { + // ItemStack stack = slot.getStack(); + // ItemStack result = stack.copy(); + // Block block = Block.getBlockFromItem(stack.getItem()); // - // if (i >= 36){ - // if (!mergeItemStack(stack, 0, 36, false)){ - // return null; - // } - // }else if (!(block.isOpaqueCube() && block.renderAsNormalBlock()) || !mergeItemStack(stack, 36, 36 + + // if (i >= 36){ + // if (!mergeItemStack(stack, 0, 36, false)){ + // return null; + // } + // }else if (!(block.isOpaqueCube() && block.renderAsNormalBlock()) || !mergeItemStack(stack, 36, 36 + // tileDetector.getSizeInventory(), false)){ - // return null; - // } + // return null; + // } // - // if (stack.stackSize == 0) { - // slot.putStack(null); - // }else{ - // slot.onSlotChanged(); - // } + // if (stack.stackSize == 0) { + // slot.putStack(null); + // }else{ + // slot.onSlotChanged(); + // } // - // slot.onPickupFromSlot(player, stack); + // slot.onPickupFromSlot(player, stack); // - // return result; - // } + // return result; + // } return null; } @@ -135,9 +137,9 @@ public class ContainerPlayerDetector extends Container { @Override public ItemStack slotClick(int slot, int button, int par3, EntityPlayer par4EntityPlayer) { return super.slotClick(slot, button, par3, par4EntityPlayer); - // if (par3 == 4) - // return super.slotClick(slot, button, 0, par4EntityPlayer); - // else - // return super.slotClick(slot, button, par3, par4EntityPlayer); + // if (par3 == 4) + // return super.slotClick(slot, button, 0, par4EntityPlayer); + // else + // return super.slotClick(slot, button, par3, par4EntityPlayer); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerReactor.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerReactor.java index a885c0ad..62097775 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerReactor.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerReactor.java @@ -1,10 +1,7 @@ package com.brandon3055.draconicevolution.common.container; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.inventory.GenericInventory; -import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore; import java.util.Iterator; + import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; @@ -12,6 +9,11 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.inventory.GenericInventory; +import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore; + /** * Created by brandon3055 on 30/7/2015. */ @@ -20,6 +22,7 @@ public class ContainerReactor extends ContainerDataSync { private TileReactorCore reactor; private EntityPlayer player; private GenericInventory ioSlots = new GenericInventory() { + private ItemStack[] items = new ItemStack[2]; @Override @@ -41,8 +44,7 @@ public class ContainerReactor extends ContainerDataSync { @Override public void setInventorySlotContents(int i, ItemStack stack) { - if (i == 0 - && stack != null + if (i == 0 && stack != null && (stack.getItem() == ModItems.draconicIngot || stack.getItem() == Item.getItemFromBlock(ModBlocks.draconicBlock) || (stack.getItem() == ModItems.nugget && stack.getItemDamage() == 1))) { @@ -55,15 +57,15 @@ public class ContainerReactor extends ContainerDataSync { } }; - // Syncing //todo sort out syncing + // Syncing //todo sort out syncing public int LTConversionUnit = -1; public int LTReactionIntensity = -1; - // public int LTMaxReactIntensity = -1; - // public int LTFieldStrength = -1; - // public int LTMaxFieldStrength = -1; - // public int LTEnergySaturation = -1; - // public int LTMaxEnergySaturation = -1; - // public int LTFuelConversion = -1; + // public int LTMaxReactIntensity = -1; + // public int LTFieldStrength = -1; + // public int LTMaxFieldStrength = -1; + // public int LTEnergySaturation = -1; + // public int LTMaxEnergySaturation = -1; + // public int LTFuelConversion = -1; public double LTTempDrainFactor = -1; public double LTGenerationRate = -1; @@ -96,8 +98,13 @@ public class ContainerReactor extends ContainerDataSync { @Override public void onContainerClosed(EntityPlayer entityPlayer) { if (ioSlots.getStackInSlot(1) != null && !player.worldObj.isRemote) { - entityPlayer.worldObj.spawnEntityInWorld(new EntityItem( - player.worldObj, entityPlayer.posX, player.posY, player.posZ, ioSlots.getStackInSlot(1))); + entityPlayer.worldObj.spawnEntityInWorld( + new EntityItem( + player.worldObj, + entityPlayer.posX, + player.posY, + player.posZ, + ioSlots.getStackInSlot(1))); ioSlots.setInventorySlotContents(1, null); } super.onContainerClosed(entityPlayer); @@ -109,8 +116,8 @@ public class ContainerReactor extends ContainerDataSync { } @Override - public void - detectAndSendChanges() { // todo check what values are being synced by the tile and remove them from here + public void detectAndSendChanges() { // todo check what values are being synced by the tile and remove them from + // here if (LTOffline && reactor.reactorState != TileReactorCore.STATE_OFFLINE) { Iterator i = inventorySlots.iterator(); @@ -128,27 +135,27 @@ public class ContainerReactor extends ContainerDataSync { if (reactor.conversionUnit != LTConversionUnit) LTConversionUnit = (Integer) sendObjectToClient(null, 0, (int) (reactor.conversionUnit * 100)); - // if ((int)reactor.reactionTemperature != LTReactionIntensity)LTReactionIntensity = (Integer) + // if ((int)reactor.reactionTemperature != LTReactionIntensity)LTReactionIntensity = (Integer) // sendObjectToClient(null, 1, (int) reactor.reactionTemperature); - // if ((int)reactor.maxReactTemperature != LTMaxReactIntensity)LTMaxReactIntensity = (Integer) + // if ((int)reactor.maxReactTemperature != LTMaxReactIntensity)LTMaxReactIntensity = (Integer) // sendObjectToClient(null, 2, (int) reactor.maxReactTemperature); - // if ((int)reactor.fieldCharge != LTFieldStrength) LTFieldStrength = (Integer) sendObjectToClient(null, + // if ((int)reactor.fieldCharge != LTFieldStrength) LTFieldStrength = (Integer) sendObjectToClient(null, // 3, (int) reactor.fieldCharge); - // if ((int)reactor.maxFieldCharge != LTMaxFieldStrength) LTMaxFieldStrength = (Integer) + // if ((int)reactor.maxFieldCharge != LTMaxFieldStrength) LTMaxFieldStrength = (Integer) // sendObjectToClient(null, 7, (int) reactor.maxFieldCharge); - // if (reactor.energySaturation != LTEnergySaturation) LTEnergySaturation = (Integer) + // if (reactor.energySaturation != LTEnergySaturation) LTEnergySaturation = (Integer) // sendObjectToClient(null, 4, reactor.energySaturation); - // if (reactor.maxEnergySaturation != LTMaxEnergySaturation) LTMaxEnergySaturation = (Integer) + // if (reactor.maxEnergySaturation != LTMaxEnergySaturation) LTMaxEnergySaturation = (Integer) // sendObjectToClient(null, 5, reactor.maxEnergySaturation); - // if (reactor.convertedFuel != LTFuelConversion) LTFuelConversion = (Integer) sendObjectToClient(null, + // if (reactor.convertedFuel != LTFuelConversion) LTFuelConversion = (Integer) sendObjectToClient(null, // 6, reactor.convertedFuel); - /*if (reactor.tempDrainFactor != LTTempDrainFactor) LTTempDrainFactor = (Integer) */ + /* if (reactor.tempDrainFactor != LTTempDrainFactor) LTTempDrainFactor = (Integer) */ sendObjectToClient(null, 8, (int) (reactor.tempDrainFactor * 1000D)); if (reactor.generationRate != LTGenerationRate) LTGenerationRate = (Integer) sendObjectToClient(null, 9, (int) (reactor.generationRate)); if (reactor.fieldDrain != LTFieldDrain) LTFieldDrain = (Integer) sendObjectToClient(null, 10, reactor.fieldDrain); - /*if (reactor.fuelUseRate != LTFuelUseRate) LTFuelUseRate = (Integer) */ + /* if (reactor.fuelUseRate != LTFuelUseRate) LTFuelUseRate = (Integer) */ sendObjectToClient(null, 11, (int) (reactor.fuelUseRate * 1000000D)); super.detectAndSendChanges(); @@ -157,13 +164,13 @@ public class ContainerReactor extends ContainerDataSync { @Override public void receiveSyncData(int index, int value) { if (index == 0) reactor.conversionUnit = (double) value / 100D; - // else if (index == 1) reactor.reactionTemperature = value; - // else if (index == 2) reactor.maxReactTemperature = value; - // else if (index == 3) reactor.fieldCharge = value; - // else if (index == 4) reactor.energySaturation = value; - // else if (index == 5) reactor.maxEnergySaturation = value; - // else if (index == 6) reactor.convertedFuel = value; - // else if (index == 7) reactor.maxFieldCharge = value; + // else if (index == 1) reactor.reactionTemperature = value; + // else if (index == 2) reactor.maxReactTemperature = value; + // else if (index == 3) reactor.fieldCharge = value; + // else if (index == 4) reactor.energySaturation = value; + // else if (index == 5) reactor.maxEnergySaturation = value; + // else if (index == 6) reactor.convertedFuel = value; + // else if (index == 7) reactor.maxFieldCharge = value; else if (index == 8) reactor.tempDrainFactor = value / 1000D; else if (index == 9) reactor.generationRate = value; else if (index == 10) reactor.fieldDrain = value; @@ -225,6 +232,7 @@ public class ContainerReactor extends ContainerDataSync { } public static class SlotInsert extends Slot { + private int numberAllowed = -1; private TileReactorCore reactor; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerSunDial.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerSunDial.java index 06076b26..5d97d275 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerSunDial.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerSunDial.java @@ -1,11 +1,12 @@ package com.brandon3055.draconicevolution.common.container; -import com.brandon3055.draconicevolution.common.tileentities.TileSunDial; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; +import com.brandon3055.draconicevolution.common.tileentities.TileSunDial; + public class ContainerSunDial extends Container { private TileSunDial tile; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerTemplate.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerTemplate.java index b972cbae..ccade850 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerTemplate.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerTemplate.java @@ -1,12 +1,13 @@ package com.brandon3055.draconicevolution.common.container; -import com.brandon3055.draconicevolution.common.tileentities.TileContainerTemplate; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +import com.brandon3055.draconicevolution.common.tileentities.TileContainerTemplate; + public class ContainerTemplate extends Container { private TileContainerTemplate tile; @@ -50,8 +51,8 @@ public class ContainerTemplate extends Container { } } else if (!isStackValidForInventory(stack, 0) || !mergeItemStack(stack, 36, 36 + tile.getSizeInventory(), false)) { - return null; - } + return null; + } if (stack.stackSize == 0) { slot.putStack(null); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerUpgradeModifier.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerUpgradeModifier.java index 079c7a17..56df5e5d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerUpgradeModifier.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerUpgradeModifier.java @@ -1,9 +1,5 @@ package com.brandon3055.draconicevolution.common.container; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.tileentities.TileUpgradeModifier; -import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; -import com.brandon3055.draconicevolution.common.utills.IUpgradableItem.EnumUpgrade; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -13,10 +9,15 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.tileentities.TileUpgradeModifier; +import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; +import com.brandon3055.draconicevolution.common.utills.IUpgradableItem.EnumUpgrade; + public class ContainerUpgradeModifier extends ContainerDataSync { - private static final Item[] CORES_INDEX = { - ModItems.draconicCore, ModItems.wyvernCore, ModItems.awakenedCore, ModItems.chaoticCore - }; + + private static final Item[] CORES_INDEX = { ModItems.draconicCore, ModItems.wyvernCore, ModItems.awakenedCore, + ModItems.chaoticCore }; private TileUpgradeModifier tile; private EntityPlayer player; private boolean slotsActive = true; @@ -55,8 +56,7 @@ public class ContainerUpgradeModifier extends ContainerDataSync { } private void updateSlotState() { - if (tile.getStackInSlot(0) != null - && tile.getStackInSlot(0).getItem() instanceof IUpgradableItem + if (tile.getStackInSlot(0) != null && tile.getStackInSlot(0).getItem() instanceof IUpgradableItem && slotsActive) { for (Object o : inventorySlots) { if (o instanceof Slot && !(o instanceof SlotUpgradable)) ((Slot) o).xDisplayPosition += 1000; @@ -64,11 +64,11 @@ public class ContainerUpgradeModifier extends ContainerDataSync { slotsActive = false; } else if ((tile.getStackInSlot(0) == null || !(tile.getStackInSlot(0).getItem() instanceof IUpgradableItem)) && !slotsActive) { - for (Object o : inventorySlots) { - if (o instanceof Slot && !(o instanceof SlotUpgradable)) ((Slot) o).xDisplayPosition -= 1000; - } - slotsActive = true; - } + for (Object o : inventorySlots) { + if (o instanceof Slot && !(o instanceof SlotUpgradable)) ((Slot) o).xDisplayPosition -= 1000; + } + slotsActive = true; + } } @Override @@ -90,8 +90,8 @@ public class ContainerUpgradeModifier extends ContainerDataSync { } } else if (!isStackValidForInventory(stack, 0) || !mergeItemStack(stack, 36, 36 + tile.getSizeInventory(), false)) { - return null; - } + return null; + } if (stack.stackSize == 0) { slot.putStack(null); @@ -117,29 +117,24 @@ public class ContainerUpgradeModifier extends ContainerDataSync { int coreTier = value / 2; boolean addCore = value % 2 == 0; ItemStack stack = tile.getStackInSlot(0); - if (upgrade == null - || stack == null + if (upgrade == null || stack == null || !(stack.getItem() instanceof IUpgradableItem) || coreTier < 0 || coreTier > 3 - || (upgrade.getCoresApplied(stack)[coreTier] <= 0 && !addCore)) return; + || (upgrade.getCoresApplied(stack)[coreTier] <= 0 && !addCore)) + return; handleCoreTransaction(upgrade, coreTier, addCore, (IUpgradableItem) stack.getItem(), stack); } - private void handleCoreTransaction( - EnumUpgrade upgrade, - int coreTier, - boolean addCoreElseRemove, - IUpgradableItem upgradableItem, - ItemStack stack) { + private void handleCoreTransaction(EnumUpgrade upgrade, int coreTier, boolean addCoreElseRemove, + IUpgradableItem upgradableItem, ItemStack stack) { int coreSlots = upgradableItem.getUpgradeCap(stack); int totalCores = 0; int[] coresApplied = upgrade.getCoresApplied(stack); for (EnumUpgrade u : upgradableItem.getUpgrades(stack)) totalCores += u.getCoresApplied(stack)[coreTier]; if (addCoreElseRemove) { - if (!player.inventory.hasItem(CORES_INDEX[coreTier]) - || totalCores >= coreSlots + if (!player.inventory.hasItem(CORES_INDEX[coreTier]) || totalCores >= coreSlots || upgrade.getUpgradePoints(stack) >= upgradableItem.getMaxUpgradePoints(upgrade.index, stack)) return; coresApplied[coreTier]++; @@ -153,7 +148,11 @@ public class ContainerUpgradeModifier extends ContainerDataSync { upgrade.onRemovedFromItem(stack); if (!player.inventory.addItemStackToInventory(new ItemStack(CORES_INDEX[coreTier]))) { EntityItem entityItem = new EntityItem( - player.worldObj, player.posX, player.posY, player.posZ, new ItemStack(CORES_INDEX[coreTier])); + player.worldObj, + player.posX, + player.posY, + player.posZ, + new ItemStack(CORES_INDEX[coreTier])); if (!player.worldObj.isRemote) player.worldObj.spawnEntityInWorld(entityItem); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerWeatherController.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerWeatherController.java index 391feec4..c988b890 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerWeatherController.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerWeatherController.java @@ -1,7 +1,5 @@ package com.brandon3055.draconicevolution.common.container; -import com.brandon3055.draconicevolution.common.inventory.SlotItemValid; -import com.brandon3055.draconicevolution.common.tileentities.TileWeatherController; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Items; @@ -9,6 +7,9 @@ import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +import com.brandon3055.draconicevolution.common.inventory.SlotItemValid; +import com.brandon3055.draconicevolution.common.tileentities.TileWeatherController; + public class ContainerWeatherController extends Container { private TileWeatherController tileWC; @@ -48,8 +49,8 @@ public class ContainerWeatherController extends Container { } } else if (!stack.getItem().equals(Items.emerald) || !mergeItemStack(stack, 36, 36 + tileWC.getSizeInventory(), false)) { - return null; - } + return null; + } if (stack.stackSize == 0) { slot.putStack(null); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/DummyContainer.java b/src/main/java/com/brandon3055/draconicevolution/common/container/DummyContainer.java index 0f88bd66..2db41729 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/DummyContainer.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/DummyContainer.java @@ -8,6 +8,7 @@ import net.minecraft.item.ItemStack; * Created by Brandon on 16/09/2014. */ public class DummyContainer extends Container { + @Override public boolean canInteractWith(EntityPlayer p_75145_1_) { return true; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/ChaosImplosion.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/ChaosImplosion.java index a48595b0..38978734 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/ChaosImplosion.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/ChaosImplosion.java @@ -1,22 +1,21 @@ package com.brandon3055.draconicevolution.common.entity; +import java.util.Random; + +import net.minecraft.util.DamageSource; +import net.minecraft.world.World; + import com.brandon3055.brandonscore.common.handlers.IProcess; import com.brandon3055.brandonscore.common.handlers.ProcessHandler; import com.brandon3055.brandonscore.common.utills.Utills; -import java.util.Random; -import net.minecraft.util.DamageSource; -import net.minecraft.world.World; /** * Created by brandon3055 on 12/8/2015. */ public class ChaosImplosion implements IProcess { - public static DamageSource chaosImplosion = new DamageSource("chaosImplosion") - .setExplosion() - .setDamageBypassesArmor() - .setDamageIsAbsolute() - .setDamageAllowedInCreativeMode(); + public static DamageSource chaosImplosion = new DamageSource("chaosImplosion").setExplosion() + .setDamageBypassesArmor().setDamageIsAbsolute().setDamageAllowedInCreativeMode(); private World worldObj; private int xCoord; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/ChaosImplosionTrace.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/ChaosImplosionTrace.java index a6eb3c63..4a64d802 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/ChaosImplosionTrace.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/ChaosImplosionTrace.java @@ -1,13 +1,15 @@ package com.brandon3055.draconicevolution.common.entity; -import com.brandon3055.brandonscore.common.handlers.IProcess; -import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.ReactorExplosion; import java.util.List; import java.util.Random; + import net.minecraft.entity.Entity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; +import com.brandon3055.brandonscore.common.handlers.IProcess; +import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.ReactorExplosion; + /** * Created by brandon3055 on 12/8/2015. */ @@ -36,7 +38,8 @@ public class ChaosImplosionTrace implements IProcess { for (int y = yCoord; y > 0 && energy > 0; y--) { List entities = worldObj.getEntitiesWithinAABB( - Entity.class, AxisAlignedBB.getBoundingBox(xCoord, y, zCoord, xCoord + 1, y + 1, zCoord + 1)); + Entity.class, + AxisAlignedBB.getBoundingBox(xCoord, y, zCoord, xCoord + 1, y + 1, zCoord + 1)); for (Entity entity : entities) entity.attackEntityFrom(ChaosImplosion.chaosImplosion, power * 100); // energy -= block instanceof BlockLiquid ? 10 : block.getExplosionResistance(null); @@ -49,7 +52,8 @@ public class ChaosImplosionTrace implements IProcess { yCoord++; for (int y = yCoord; y < 255 && energy > 0; y++) { List entities = worldObj.getEntitiesWithinAABB( - Entity.class, AxisAlignedBB.getBoundingBox(xCoord, y, zCoord, xCoord + 1, y + 1, zCoord + 1)); + Entity.class, + AxisAlignedBB.getBoundingBox(xCoord, y, zCoord, xCoord + 1, y + 1, zCoord + 1)); for (Entity entity : entities) entity.attackEntityFrom(ReactorExplosion.fusionExplosion, power * 100); // energy -= block instanceof BlockLiquid ? 10 : block.getExplosionResistance(null); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosBolt.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosBolt.java index 2cbaad3c..d1fec39d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosBolt.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosBolt.java @@ -1,12 +1,13 @@ package com.brandon3055.draconicevolution.common.entity; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.client.render.particle.Particles; import net.minecraft.entity.Entity; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.client.render.particle.Particles; + /** * Created by brandon3055 on 30/9/2015. */ @@ -17,8 +18,8 @@ public class EntityChaosBolt extends Entity { public double shardZ; public boolean burst; public int ticks = 0; - private static DamageSource chaosBurst = - new DamageSource("chaosBurst").setDamageBypassesArmor().setDamageIsAbsolute(); + private static DamageSource chaosBurst = new DamageSource("chaosBurst").setDamageBypassesArmor() + .setDamageIsAbsolute(); public EntityChaosBolt(World world) { this(world, 0, 0, 0, 0, 0, 0); @@ -62,35 +63,35 @@ public class EntityChaosBolt extends Entity { if (ticks == 10 && !burst) { if (worldObj.isRemote) { DraconicEvolution.proxy.spawnParticle( - new Particles.ChaosBoltParticle(worldObj, posX, posY, posZ, shardX, shardY, shardZ, 10), 32); + new Particles.ChaosBoltParticle(worldObj, posX, posY, posZ, shardX, shardY, shardZ, 10), + 32); } setDead(); } else if (ticks > 10) { if (ticks < 25) { for (int i = 0; i < 20; i++) { - if (worldObj.isRemote) - DraconicEvolution.proxy.spawnParticle( - new Particles.ChaosBoltParticle(worldObj, posX, posY, posZ, shardX, shardY, shardZ, 0), - 32); + if (worldObj.isRemote) DraconicEvolution.proxy.spawnParticle( + new Particles.ChaosBoltParticle(worldObj, posX, posY, posZ, shardX, shardY, shardZ, 0), + 32); } } if (ticks > 40 && !worldObj.isRemote) { - // if (ticks % 5 == 0) - // { - // double dist = Utills.getDistanceAtoB(posX, posY, posZ, shardX, shardY, shardZ); - // Vec3 dir = Vec3.createVectorHelper((shardX - posX) / dist, (shardY - posY) / dist, (shardZ - + // if (ticks % 5 == 0) + // { + // double dist = Utills.getDistanceAtoB(posX, posY, posZ, shardX, shardY, shardZ); + // Vec3 dir = Vec3.createVectorHelper((shardX - posX) / dist, (shardY - posY) / dist, (shardZ - // posZ) / dist); - // MovingObjectPosition movingobjectposition = + // MovingObjectPosition movingobjectposition = // this.worldObj.//func_147447_a(Vec3.createVectorHelper(posX, posY, posZ), dir, false, true, false); - // Entity entity = movingobjectposition.entityHit; //WorldUtil.rayTraceEntities(worldObj, + // Entity entity = movingobjectposition.entityHit; //WorldUtil.rayTraceEntities(worldObj, // Vec3.createVectorHelper(posX, posY, posZ), dir, 20); // - // LogHelper.info(movingobjectposition); - // if (entity instanceof EntityLivingBase) { - // entity.hurtResistantTime = 0; - // entity.attackEntityFrom(chaosBurst, 50F); - // } - // } + // LogHelper.info(movingobjectposition); + // if (entity instanceof EntityLivingBase) { + // entity.hurtResistantTime = 0; + // entity.attackEntityFrom(chaosBurst, 50F); + // } + // } } } @@ -103,18 +104,18 @@ public class EntityChaosBolt extends Entity { @Override protected void readEntityFromNBT(NBTTagCompound compound) { - // if (compound.hasKey("ShardPos")){ - // int[] pos = compound.getIntArray("ShardPos"); - // shardX = pos[0]; - // shardY = pos[1]; - // shardZ = pos[2]; - // LogHelper.info("read"); - // } + // if (compound.hasKey("ShardPos")){ + // int[] pos = compound.getIntArray("ShardPos"); + // shardX = pos[0]; + // shardY = pos[1]; + // shardZ = pos[2]; + // LogHelper.info("read"); + // } } @Override protected void writeEntityToNBT(NBTTagCompound compound) { - // compound.setIntArray("ShardPos", new int[] {(int)(shardX-0.5D), (int)(shardY-0.5D), (int)(shardZ-0.5D)}); - // LogHelper.info("write"); + // compound.setIntArray("ShardPos", new int[] {(int)(shardX-0.5D), (int)(shardY-0.5D), (int)(shardZ-0.5D)}); + // LogHelper.info("write"); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosCrystal.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosCrystal.java index 3f3c2ae7..2be914a2 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosCrystal.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosCrystal.java @@ -1,9 +1,7 @@ package com.brandon3055.draconicevolution.common.entity; -import com.brandon3055.draconicevolution.common.ModBlocks; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.List; + import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; @@ -19,10 +17,16 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.WorldProviderEnd; +import com.brandon3055.draconicevolution.common.ModBlocks; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by brandon3055 on 30/8/2015. */ public class EntityChaosCrystal extends EntityLivingBase { + public int innerRotation; public float deathAnimation = 1F; public int shieldTime = 0; @@ -180,8 +184,7 @@ public class EntityChaosCrystal extends EntityLivingBase { if (guardian == null) { List list = worldObj.getEntitiesWithinAABB( EntityChaosGuardian.class, - AxisAlignedBB.getBoundingBox(posX, posY, posZ, posX, posY, posZ) - .expand(512, 512, 512)); + AxisAlignedBB.getBoundingBox(posX, posY, posZ, posX, posY, posZ).expand(512, 512, 512)); if (list.size() > 0) guardian = list.get(0); if (guardian != null && guardian.crystals != null && !guardian.crystals.contains(this)) { guardian.crystals.add(this); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosDrill.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosDrill.java index acb7d484..695a1d24 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosDrill.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosDrill.java @@ -1,14 +1,16 @@ package com.brandon3055.draconicevolution.common.entity; -import com.brandon3055.brandonscore.common.utills.Utills; -import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper; -import com.brandon3055.draconicevolution.common.utills.LogHelper; import java.util.ArrayList; + import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; +import com.brandon3055.brandonscore.common.utills.Utills; +import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper; +import com.brandon3055.draconicevolution.common.utills.LogHelper; + /** * Created by Brandon on 14/09/2014. */ @@ -61,10 +63,7 @@ public class EntityChaosDrill extends Entity { ArrayList blocks = getBlocksInSphere(5); LogHelper.info(blocks.size()); if (blocks.size() > 0) - worldObj.setBlockToAir( - blocks.get(1).getXCoord(), - blocks.get(1).getYCoord(), - blocks.get(1).getZCoord()); + worldObj.setBlockToAir(blocks.get(1).getXCoord(), blocks.get(1).getYCoord(), blocks.get(1).getZCoord()); } private ArrayList getBlocksInSphere(int r) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosGuardian.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosGuardian.java index 64de2be2..124a9432 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosGuardian.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosGuardian.java @@ -1,13 +1,9 @@ package com.brandon3055.draconicevolution.common.entity; -import com.brandon3055.brandonscore.common.utills.Utills; -import com.brandon3055.draconicevolution.common.handler.ConfigHandler; -import com.brandon3055.draconicevolution.common.tileentities.TileChaosShard; -import com.brandon3055.draconicevolution.common.utills.DamageSourceChaos; -import com.brandon3055.draconicevolution.common.utills.DragonChunkLoader; import java.util.ArrayList; import java.util.Iterator; import java.util.List; + import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -22,6 +18,12 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.*; import net.minecraft.world.World; +import com.brandon3055.brandonscore.common.utills.Utills; +import com.brandon3055.draconicevolution.common.handler.ConfigHandler; +import com.brandon3055.draconicevolution.common.tileentities.TileChaosShard; +import com.brandon3055.draconicevolution.common.utills.DamageSourceChaos; +import com.brandon3055.draconicevolution.common.utills.DragonChunkLoader; + /** * Created by Brandon on 4/07/2014. */ @@ -69,7 +71,7 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut public int activeCrystals = 0; public EntityChaosCrystal healingChaosCrystal; - // public int connectedCrystalID = -1; + // public int connectedCrystalID = -1; public int crystalX = 0; public int crystalY = -1; public int crystalZ = 0; @@ -92,7 +94,7 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut @Override protected void entityInit() { super.entityInit(); - // dataWatcher.addObject(20, connectedCrystalID); + // dataWatcher.addObject(20, connectedCrystalID); dataWatcher.addObject(21, crystalX); dataWatcher.addObject(22, crystalY); dataWatcher.addObject(23, crystalZ); @@ -128,28 +130,27 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut float moveSpeedMultiplier = behaviour.dragonSpeed; if (this.worldObj.isRemote) { - // connectedCrystalID = dataWatcher.getWatchableObjectInt(20); + // connectedCrystalID = dataWatcher.getWatchableObjectInt(20); crystalX = dataWatcher.getWatchableObjectInt(21); crystalY = dataWatcher.getWatchableObjectInt(22); crystalZ = dataWatcher.getWatchableObjectInt(23); - // if (ticksExisted % 10 == 0 && connectedCrystalID != -1 && worldObj.getEntityByID(connectedCrystalID) + // if (ticksExisted % 10 == 0 && connectedCrystalID != -1 && worldObj.getEntityByID(connectedCrystalID) // instanceof EntityChaosCrystal) healingChaosCrystal = // (EntityChaosCrystal)worldObj.getEntityByID(connectedCrystalID); - // else if (connectedCrystalID == -1 && healingChaosCrystal != null) healingChaosCrystal = null; + // else if (connectedCrystalID == -1 && healingChaosCrystal != null) healingChaosCrystal = null; f = MathHelper.cos(this.animTime * (float) Math.PI * 2.0F); f1 = MathHelper.cos(this.prevAnimTime * (float) Math.PI * 2.0F); if (f1 <= -0.3F && f >= -0.3F) { - if (deathTicks <= 0) - this.worldObj.playSound( - this.posX, - this.posY, - this.posZ, - "mob.enderdragon.wings", - 5.0F, - 0.8F + this.rand.nextFloat() * 0.3F, - false); + if (deathTicks <= 0) this.worldObj.playSound( + this.posX, + this.posY, + this.posZ, + "mob.enderdragon.wings", + 5.0F, + 0.8F + this.rand.nextFloat() * 0.3F, + false); } } @@ -157,7 +158,7 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut float f2; if (!worldObj.isRemote) { - // dataWatcher.updateObject(20, connectedCrystalID); + // dataWatcher.updateObject(20, connectedCrystalID); dataWatcher.updateObject(21, crystalX); dataWatcher.updateObject(22, crystalY); dataWatcher.updateObject(23, crystalZ); @@ -173,7 +174,8 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut customAIUpdate(); if (behaviour == EnumBehaviour.FIREBOMB - && Utills.getDistanceAtoB(posX, posY, posZ, homeX, homeY + 30, homeZ) <= 3) moveSpeedMultiplier = 0; + && Utills.getDistanceAtoB(posX, posY, posZ, homeX, homeY + 30, homeZ) <= 3) + moveSpeedMultiplier = 0; } if (this.getHealth() <= 0.0F) { @@ -192,9 +194,8 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut } { this.updateDragonEnderCrystal(); - f = 0.2F - / (MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ) * 10.0F - + 1.0F); + f = 0.2F / (MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ) * 10.0F + + 1.0F); f *= moveSpeedMultiplier == 0 ? 1 : moveSpeedMultiplier; f *= (float) Math.pow(2.0D, this.motionY); @@ -231,8 +232,8 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut d0 = this.posY + (this.newPosY - this.posY) / (double) this.newPosRotationIncrements; d1 = this.posZ + (this.newPosZ - this.posZ) / (double) this.newPosRotationIncrements; d2 = MathHelper.wrapAngleTo180_double(this.newRotationYaw - (double) this.rotationYaw); - this.rotationYaw = - (float) ((double) this.rotationYaw + d2 / (double) this.newPosRotationIncrements); + this.rotationYaw = (float) ((double) this.rotationYaw + + d2 / (double) this.newPosRotationIncrements); this.rotationPitch = (float) ((double) this.rotationPitch + (this.newRotationPitch - (double) this.rotationPitch) / (double) this.newPosRotationIncrements); @@ -251,9 +252,8 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut if (behaviour == EnumBehaviour.CIRCLE_PLAYER) { this.targetX = this.target.posX + (int) (Math.cos(circlePosition) * 60); this.targetZ = this.target.posZ + (int) (Math.sin(circlePosition) * 60); - moveSpeedMultiplier = 1F - + Math.min( - ((float) Utills.getDistanceAtoB(targetX, targetZ, posX, posZ) / 50) * 3F, 3F); + moveSpeedMultiplier = 1F + Math + .min(((float) Utills.getDistanceAtoB(targetX, targetZ, posX, posZ) / 50) * 3F, 3F); } else { this.targetX = this.target.posX; this.targetZ = this.target.posZ; @@ -268,18 +268,18 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut d8 = 10.0D; } - this.targetY = - this.target.boundingBox.minY + d8 + (behaviour == EnumBehaviour.CIRCLE_PLAYER ? 25 : 0); + this.targetY = this.target.boundingBox.minY + d8 + + (behaviour == EnumBehaviour.CIRCLE_PLAYER ? 25 : 0); } else if (behaviour != EnumBehaviour.FIREBOMB) { this.targetX += this.rand.nextGaussian() * 2.0D; this.targetZ += this.rand.nextGaussian() * 2.0D; } - if (this.forceNewTarget - || d2 < 100.0D + if (this.forceNewTarget || d2 < 100.0D || d2 > 22500.0D || this.isCollidedHorizontally - || this.isCollidedVertically) this.setNewTarget(); + || this.isCollidedVertically) + this.setNewTarget(); d0 /= (double) MathHelper.sqrt_double(d10 * d10 + d1 * d1); // if (isUber) f12 = 1.0F;//Verticle Motion Speed @@ -308,13 +308,13 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut } Vec3 vec3 = Vec3.createVectorHelper( - this.targetX - this.posX, this.targetY - this.posY, this.targetZ - this.posZ) - .normalize(); + this.targetX - this.posX, + this.targetY - this.posY, + this.targetZ - this.posZ).normalize(); Vec3 vec32 = Vec3.createVectorHelper( - (double) MathHelper.sin(this.rotationYaw * (float) Math.PI / 180.0F), - this.motionY, - (double) (-MathHelper.cos(this.rotationYaw * (float) Math.PI / 180.0F))) - .normalize(); + (double) MathHelper.sin(this.rotationYaw * (float) Math.PI / 180.0F), + this.motionY, + (double) (-MathHelper.cos(this.rotationYaw * (float) Math.PI / 180.0F))).normalize(); float f5 = (float) (vec32.dotProduct(vec3) + 0.5D) / 1.5F; if (f5 < 0.0F) { @@ -322,16 +322,16 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut } this.randomYawVelocity *= 0.8F; - float f6 = - MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ) * 1.0F + 1.0F; + float f6 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ) * 1.0F + + 1.0F; double d9 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ) * 1.0D + 1.0D; if (d9 > 40.0D) { d9 = 40.0D; } - this.randomYawVelocity = - (float) ((double) this.randomYawVelocity + d6 * (0.699999988079071D / d9 / (double) f6)); + this.randomYawVelocity = (float) ((double) this.randomYawVelocity + + d6 * (0.699999988079071D / d9 / (double) f6)); this.rotationYaw += this.randomYawVelocity * 0.1F; float f7 = (float) (2.0D / (d9 + 1.0D)); float f8 = 0.06F; @@ -349,8 +349,7 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut this.motionZ * moveSpeedMultiplier); } - Vec3 vec31 = Vec3.createVectorHelper(this.motionX, this.motionY, this.motionZ) - .normalize(); + Vec3 vec31 = Vec3.createVectorHelper(this.motionX, this.motionY, this.motionZ).normalize(); float f9 = (float) (vec31.dotProduct(vec32) + 1.0D) / 2.0F; f9 = 0.8F + 0.15F * f9; this.motionX *= (double) f9; @@ -369,8 +368,7 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut this.dragonPartWing1.width = 4.0F; this.dragonPartWing2.height = 3.0F; this.dragonPartWing2.width = 4.0F; - f1 = (float) (this.getMovementOffsets(5, 1.0F)[1] - this.getMovementOffsets(10, 1.0F)[1]) - * 10.0F + f1 = (float) (this.getMovementOffsets(5, 1.0F)[1] - this.getMovementOffsets(10, 1.0F)[1]) * 10.0F / 180.0F * (float) Math.PI; f2 = MathHelper.cos(f1); @@ -380,29 +378,39 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut float f4 = MathHelper.cos(f3); this.dragonPartBody.onUpdate(); this.dragonPartBody.setLocationAndAngles( - this.posX + (double) (f11 * 0.5F), this.posY, this.posZ - (double) (f4 * 0.5F), 0.0F, 0.0F); + this.posX + (double) (f11 * 0.5F), + this.posY, + this.posZ - (double) (f4 * 0.5F), + 0.0F, + 0.0F); this.dragonPartWing1.onUpdate(); this.dragonPartWing1.setLocationAndAngles( - this.posX + (double) (f4 * 4.5F), this.posY + 2.0D, this.posZ + (double) (f11 * 4.5F), 0.0F, 0.0F); + this.posX + (double) (f4 * 4.5F), + this.posY + 2.0D, + this.posZ + (double) (f11 * 4.5F), + 0.0F, + 0.0F); this.dragonPartWing2.onUpdate(); this.dragonPartWing2.setLocationAndAngles( - this.posX - (double) (f4 * 4.5F), this.posY + 2.0D, this.posZ - (double) (f11 * 4.5F), 0.0F, 0.0F); + this.posX - (double) (f4 * 4.5F), + this.posY + 2.0D, + this.posZ - (double) (f11 * 4.5F), + 0.0F, + 0.0F); if (!this.worldObj.isRemote && this.hurtTime == 0) { - this.collideWithEntities(this.worldObj.getEntitiesWithinAABBExcludingEntity( - this, - this.dragonPartWing1 - .boundingBox - .expand(4.0D, 2.0D, 4.0D) - .offset(0.0D, -2.0D, 0.0D))); - this.collideWithEntities(this.worldObj.getEntitiesWithinAABBExcludingEntity( - this, - this.dragonPartWing2 - .boundingBox - .expand(4.0D, 2.0D, 4.0D) - .offset(0.0D, -2.0D, 0.0D))); - this.attackEntitiesInList(this.worldObj.getEntitiesWithinAABBExcludingEntity( - this, this.dragonPartHead.boundingBox.expand(1.0D, 1.0D, 1.0D))); + this.collideWithEntities( + this.worldObj.getEntitiesWithinAABBExcludingEntity( + this, + this.dragonPartWing1.boundingBox.expand(4.0D, 2.0D, 4.0D).offset(0.0D, -2.0D, 0.0D))); + this.collideWithEntities( + this.worldObj.getEntitiesWithinAABBExcludingEntity( + this, + this.dragonPartWing2.boundingBox.expand(4.0D, 2.0D, 4.0D).offset(0.0D, -2.0D, 0.0D))); + this.attackEntitiesInList( + this.worldObj.getEntitiesWithinAABBExcludingEntity( + this, + this.dragonPartHead.boundingBox.expand(1.0D, 1.0D, 1.0D))); } double[] adouble1 = this.getMovementOffsets(5, 1.0F); @@ -471,22 +479,20 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut nextAttackTimer = 20; attackTimer = 1000; } - if (deathTicks <= 0) - this.worldObj.playSoundEffect( - player.posX, - player.posY, - player.posZ, - "mob.enderdragon.growl", - 20.0F, - 0.8F + this.rand.nextFloat() * 0.3F); + if (deathTicks <= 0) this.worldObj.playSoundEffect( + player.posX, + player.posY, + player.posZ, + "mob.enderdragon.growl", + 20.0F, + 0.8F + this.rand.nextFloat() * 0.3F); } public void updateCrystals() { if (crystals == null) crystals = new ArrayList(); List list = worldObj.getEntitiesWithinAABB( EntityChaosCrystal.class, - AxisAlignedBB.getBoundingBox(homeX, homeY, homeZ, homeX, homeY, homeZ) - .expand(200, 200, 200)); + AxisAlignedBB.getBoundingBox(homeX, homeY, homeZ, homeX, homeY, homeZ).expand(200, 200, 200)); activeCrystals = 0; for (EntityChaosCrystal crystal : list) { if (!crystals.contains(crystal)) crystals.add(crystal); @@ -502,7 +508,7 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut crystals = null; activeCrystals = 0; crystalY = -1; - // connectedCrystalID = -1; + // connectedCrystalID = -1; healingChaosCrystal = null; updateCrystals(); } @@ -567,18 +573,21 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut ignitionChargeTimer--; if (ignitionChargeTimer <= 0 && !worldObj.isRemote) { if ((ticksExisted - 19) % 20 == 0) - ignitionChargeTimer = - (behaviour == EnumBehaviour.LOW_HEALTH_STRATEGY ? 1000 : 2000) + rand.nextInt(600); + ignitionChargeTimer = (behaviour == EnumBehaviour.LOW_HEALTH_STRATEGY ? 1000 : 2000) + + rand.nextInt(600); if (activeCrystals < crystals.size() && ticksExisted % 10 == 0) { EntityChaosCrystal closest = null; - for (EntityChaosCrystal crystal : crystals) - if (!crystal.isAlive() - && (closest == null || getDistanceToEntity(crystal) < getDistanceToEntity(closest))) - closest = crystal; + for (EntityChaosCrystal crystal : crystals) if (!crystal.isAlive() + && (closest == null || getDistanceToEntity(crystal) < getDistanceToEntity(closest))) + closest = crystal; if (closest != null) { EntityDragonProjectile charge = new EntityDragonProjectile( - worldObj, EntityDragonProjectile.IGNITION_CHARGE, closest, 0, this); + worldObj, + EntityDragonProjectile.IGNITION_CHARGE, + closest, + 0, + this); charge.setPosition( dragonPartHead.posX + Math.cos((rotationYaw - 90) / 180.0F * (float) Math.PI) * 2, dragonPartHead.posY + 1.5, @@ -598,13 +607,13 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut && Utills.getDistanceAtoB(posX, posY, posZ, homeX, homeY + 30, homeZ) <= 3) { if (target == null || ticksExisted % 100 == 0) setNewTarget(); if (target != null) { - double distance = - Utills.getDistanceAtoB(target.posX, target.posZ, dragonPartHead.posX, dragonPartHead.posZ); + double distance = Utills + .getDistanceAtoB(target.posX, target.posZ, dragonPartHead.posX, dragonPartHead.posZ); if (Utills.getDistanceAtoB(target.posX, target.posZ, posX, posZ) < 5) distance *= -1; - float anglePitch = - (float) Math.toDegrees(Math.atan2(target.posY - dragonPartHead.posY, distance)) * -1F; - float angleYaw = - (float) Math.toDegrees(Math.atan2(target.posX - dragonPartHead.posX, target.posZ - posZ)) * -1F; + float anglePitch = (float) Math.toDegrees(Math.atan2(target.posY - dragonPartHead.posY, distance)) + * -1F; + float angleYaw = (float) Math + .toDegrees(Math.atan2(target.posX - dragonPartHead.posX, target.posZ - posZ)) * -1F; rotationPitch = anglePitch; if (Utills.getDistanceAtoB(target.posX, target.posZ, posX, posZ) > 8) rotationYaw = angleYaw + 180; @@ -628,10 +637,11 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut Entity attackTarget = target; List targets = attackTarget == null - ? worldObj.getEntitiesWithinAABB( - EntityPlayer.class, - AxisAlignedBB.getBoundingBox(homeX, homeY, homeZ, homeX, homeY, homeZ) - .expand(100, 100, 100)) + ? worldObj + .getEntitiesWithinAABB( + EntityPlayer.class, + AxisAlignedBB.getBoundingBox(homeX, homeY, homeZ, homeX, homeY, homeZ) + .expand(100, 100, 100)) : null; if (targets != null && targets.size() > 0) { @@ -649,12 +659,11 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut if (attackInProgress == -1) { selectNewAttack(); switch (attackInProgress) { - case ATTACK_FIREBALL_CHARGE: - { - attackTimer = 90 + rand.nextInt(80); - previousBehaviour = behaviour; - behaviour = EnumBehaviour.CHARGING; - } + case ATTACK_FIREBALL_CHARGE: { + attackTimer = 90 + rand.nextInt(80); + previousBehaviour = behaviour; + behaviour = EnumBehaviour.CHARGING; + } break; case ATTACK_FIREBALL_CHASER: attackTimer = 10 + rand.nextInt(80); @@ -674,8 +683,8 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut switch (attackInProgress) { case ATTACK_FIREBALL_CHARGE: if (target == null && behaviour == EnumBehaviour.CHARGING) target = attackTarget; - if (Utills.getDistanceAtoB( - posX, posY, posZ, attackTarget.posX, attackTarget.posY, attackTarget.posZ) + if (Utills + .getDistanceAtoB(posX, posY, posZ, attackTarget.posX, attackTarget.posY, attackTarget.posZ) > 10) { if (attackTimer % 2 == 0) { EntityDragonProjectile projectile = new EntityDragonProjectile( @@ -689,10 +698,12 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut } double distance = Utills.getDistanceAtoB( - attackTarget.posX, attackTarget.posZ, dragonPartHead.posX, dragonPartHead.posZ); - float angle = - (float) Math.toDegrees(Math.atan2(attackTarget.posY - dragonPartHead.posY, distance)) - * -1F; + attackTarget.posX, + attackTarget.posZ, + dragonPartHead.posX, + dragonPartHead.posZ); + float angle = (float) Math + .toDegrees(Math.atan2(attackTarget.posY - dragonPartHead.posY, distance)) * -1F; rotationPitch = angle; } else attackTimer = 0; @@ -739,8 +750,8 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut attackInProgress = -1; return; } - if (Utills.getDistanceAtoB( - posX, posY, posZ, attackTarget.posX, attackTarget.posY, attackTarget.posZ) + if (Utills + .getDistanceAtoB(posX, posY, posZ, attackTarget.posX, attackTarget.posY, attackTarget.posZ) > 15) { if (attackTimer % 2 == 0) { EntityDragonProjectile projectile = new EntityDragonProjectile( @@ -754,10 +765,12 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut } double distance = Utills.getDistanceAtoB( - attackTarget.posX, attackTarget.posZ, dragonPartHead.posX, dragonPartHead.posZ); - float angle = - (float) Math.toDegrees(Math.atan2(attackTarget.posY - dragonPartHead.posY, distance)) - * -1F; + attackTarget.posX, + attackTarget.posZ, + dragonPartHead.posX, + dragonPartHead.posZ); + float angle = (float) Math + .toDegrees(Math.atan2(attackTarget.posY - dragonPartHead.posY, distance)) * -1F; rotationPitch = angle; } else attackTimer = 0; @@ -770,32 +783,23 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut attackInProgress = -1; nextAttackTimer = -1; } - } else - nextAttackTimer = - behaviour == EnumBehaviour.LOW_HEALTH_STRATEGY ? 10 + rand.nextInt(50) : 60 + rand.nextInt(200); + } else nextAttackTimer = behaviour == EnumBehaviour.LOW_HEALTH_STRATEGY ? 10 + rand.nextInt(50) + : 60 + rand.nextInt(200); } private static final WeightedRandom.Item[] weightedAttacks = new WeightedRandom.Item[] { - new WeightedAttack(16, ATTACK_FIREBALL_CHARGE), - new WeightedAttack(14, ATTACK_FIREBALL_CHASER), - new WeightedAttack(12, ATTACK_ENERGY_CHASER), - new WeightedAttack(10, ATTACK_CHAOS_CHASER), - }; + new WeightedAttack(16, ATTACK_FIREBALL_CHARGE), new WeightedAttack(14, ATTACK_FIREBALL_CHASER), + new WeightedAttack(12, ATTACK_ENERGY_CHASER), new WeightedAttack(10, ATTACK_CHAOS_CHASER), }; private static final WeightedRandom.Item[] weightedLowHealthAttaxks = new WeightedRandom.Item[] { - new WeightedAttack(5, ATTACK_FIREBALL_CHASER), - new WeightedAttack(5, ATTACK_TELEPORT), - new WeightedAttack(10, ATTACK_ENERGY_CHASER), - new WeightedAttack(15, ATTACK_CHAOS_CHASER), - }; + new WeightedAttack(5, ATTACK_FIREBALL_CHASER), new WeightedAttack(5, ATTACK_TELEPORT), + new WeightedAttack(10, ATTACK_ENERGY_CHASER), new WeightedAttack(15, ATTACK_CHAOS_CHASER), }; private static final WeightedRandom.Item[] weightedBehaviours = new WeightedRandom.Item[] { - new WeightedBehaviour(1, EnumBehaviour.LOW_HEALTH_STRATEGY), - new WeightedBehaviour(10, EnumBehaviour.GUARDING), - new WeightedBehaviour(4, EnumBehaviour.CHARGING), - new WeightedBehaviour(12, EnumBehaviour.FIREBOMB), - new WeightedBehaviour(20, EnumBehaviour.CIRCLE_PLAYER), - }; + new WeightedBehaviour(1, EnumBehaviour.LOW_HEALTH_STRATEGY), + new WeightedBehaviour(10, EnumBehaviour.GUARDING), new WeightedBehaviour(4, EnumBehaviour.CHARGING), + new WeightedBehaviour(12, EnumBehaviour.FIREBOMB), + new WeightedBehaviour(20, EnumBehaviour.CIRCLE_PLAYER), }; private void selectNewAttack() { if (behaviour == EnumBehaviour.DEAD) return; @@ -884,16 +888,16 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut case LOW_HEALTH_STRATEGY: break; case FIREBOMB: - List targets = - worldObj.getEntitiesWithinAABB(EntityPlayer.class, boundingBox.expand(150, 150, 150)); + List targets = worldObj + .getEntitiesWithinAABB(EntityPlayer.class, boundingBox.expand(150, 150, 150)); target = null; while (targets.size() > 0 && target == null) { EntityPlayer potentialTarget = targets.get(rand.nextInt(targets.size())); if (worldObj.rayTraceBlocks( - Vec3.createVectorHelper(posX, posY, posZ), - Vec3.createVectorHelper( - potentialTarget.posX, potentialTarget.posY, potentialTarget.posZ)) - == null) target = potentialTarget; + Vec3.createVectorHelper(posX, posY, posZ), + Vec3.createVectorHelper(potentialTarget.posX, potentialTarget.posY, potentialTarget.posZ)) + == null) + target = potentialTarget; else targets.remove(potentialTarget); } @@ -946,15 +950,15 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut break; case FIREBOMB: if ((target == null && Utills.getDistanceAtoB(posX, posY, posZ, homeX, homeY + 30, homeZ) <= 3) - || rand.nextInt(5) == 0) selectNewBehaviour(); - if (damageSource.getEntity() instanceof EntityPlayer - && damageSource.getEntity() != target + || rand.nextInt(5) == 0) + selectNewBehaviour(); + if (damageSource.getEntity() instanceof EntityPlayer && damageSource.getEntity() != target && worldObj.rayTraceBlocks( - Vec3.createVectorHelper(posX, posY, posZ), - Vec3.createVectorHelper( - damageSource.getEntity().posX, - damageSource.getEntity().posY, - damageSource.getEntity().posZ)) + Vec3.createVectorHelper(posX, posY, posZ), + Vec3.createVectorHelper( + damageSource.getEntity().posX, + damageSource.getEntity().posY, + damageSource.getEntity().posZ)) == null) { target = damageSource.getEntity(); } @@ -963,28 +967,30 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut break; } - // float f1 = this.rotationYaw * (float)Math.PI / 180.0F; - // float f2 = MathHelper.sin(f1); - // float f3 = MathHelper.cos(f1); - // this.targetX = this.posX + (double)(f2 * 5.0F) + (double)((this.rand.nextFloat() - 0.5F) * 2.0F); - // this.targetY = this.posY + (double)(this.rand.nextFloat() * 3.0F) + 1.0D; - // this.targetZ = this.posZ - (double)(f3 * 5.0F) + (double)((this.rand.nextFloat() - 0.5F) * 2.0F); - // this.target = null; + // float f1 = this.rotationYaw * (float)Math.PI / 180.0F; + // float f2 = MathHelper.sin(f1); + // float f3 = MathHelper.cos(f1); + // this.targetX = this.posX + (double)(f2 * 5.0F) + (double)((this.rand.nextFloat() - 0.5F) * 2.0F); + // this.targetY = this.posY + (double)(this.rand.nextFloat() * 3.0F) + 1.0D; + // this.targetZ = this.posZ - (double)(f3 * 5.0F) + (double)((this.rand.nextFloat() - 0.5F) * 2.0F); + // this.target = null; if ((damageSource.getEntity() instanceof EntityPlayer || damageSource.isExplosion()) && healingChaosCrystal == null) // tod reanable this { - // if (getHealth() > 1F)setHealth(1F);//tod and remove this! + // if (getHealth() > 1F)setHealth(1F);//tod and remove this! this.func_82195_e(damageSource, dmg); } else if (damageSource.getEntity() instanceof EntityPlayer) - ((EntityPlayer) damageSource.getEntity()) - .addChatComponentMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE - + StatCollector.translateToLocal("msg.de.guardianAttackBlocked.txt"))); + ((EntityPlayer) damageSource.getEntity()).addChatComponentMessage( + new ChatComponentText( + EnumChatFormatting.DARK_PURPLE + + StatCollector.translateToLocal("msg.de.guardianAttackBlocked.txt"))); return true; } private static enum EnumBehaviour { + /** * Will roam around home until a player is spotted */ @@ -1017,6 +1023,7 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut * will die... */ DEAD(0.5F); + public float dragonSpeed; private EnumBehaviour(float dragonSpeed) { @@ -1025,6 +1032,7 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut } private static class WeightedAttack extends WeightedRandom.Item { + public int attack; public WeightedAttack(int weight, int attack) { @@ -1034,6 +1042,7 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut } private static class WeightedBehaviour extends WeightedRandom.Item { + public EnumBehaviour randomBehaviour; public WeightedBehaviour(int weight, EnumBehaviour randomBehaviour) { @@ -1044,27 +1053,27 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut @Override protected void onDeathUpdate() { - // if (deathTicks == 0 && !isUber) - // { - // for (int ix = -150; ix < 150; ix++) { - // for (int iz = -150; iz < 150; iz++) { - // if (worldObj.getBlock(ix, homeY, iz) == Blocks.bedrock && worldObj.getBlock(ix, homeY - 1, iz) == + // if (deathTicks == 0 && !isUber) + // { + // for (int ix = -150; ix < 150; ix++) { + // for (int iz = -150; iz < 150; iz++) { + // if (worldObj.getBlock(ix, homeY, iz) == Blocks.bedrock && worldObj.getBlock(ix, homeY - 1, iz) == // Blocks.bedrock) { - // homeX = ix; - // homeZ = iz; - // createPortal = false; - // break; - // } - // } - // } - // if (ConfigHandler.dragonEggSpawnLocation[0] != 0 || ConfigHandler.dragonEggSpawnLocation[1] != 0 || + // homeX = ix; + // homeZ = iz; + // createPortal = false; + // break; + // } + // } + // } + // if (ConfigHandler.dragonEggSpawnLocation[0] != 0 || ConfigHandler.dragonEggSpawnLocation[1] != 0 || // ConfigHandler.dragonEggSpawnLocation[1] != 0) { - // createPortal = false; - // homeX = ConfigHandler.dragonEggSpawnLocation[0]; - // homeY = ConfigHandler.dragonEggSpawnLocation[1]; - // homeZ = ConfigHandler.dragonEggSpawnLocation[2]; - // } - // } + // createPortal = false; + // homeX = ConfigHandler.dragonEggSpawnLocation[0]; + // homeY = ConfigHandler.dragonEggSpawnLocation[1]; + // homeZ = ConfigHandler.dragonEggSpawnLocation[2]; + // } + // } if (deathTicks == 0) { if (worldObj.getTileEntity(homeX, homeY, homeZ) instanceof TileChaosShard) { @@ -1086,12 +1095,12 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut ++this.deathTicks; - // if (worldObj.rand.nextInt(5) == 2) - // { - // EntityLightningBolt bolt = new EntityLightningBolt(worldObj, homeX, homeY + 1, homeZ); - // bolt.ignoreFrustumCheck = true; - // worldObj.addWeatherEffect(bolt); - // } + // if (worldObj.rand.nextInt(5) == 2) + // { + // EntityLightningBolt bolt = new EntityLightningBolt(worldObj, homeX, homeY + 1, homeZ); + // bolt.ignoreFrustumCheck = true; + // worldObj.addWeatherEffect(bolt); + // } if (this.deathTicks >= 180 && this.deathTicks <= 200) { float f = (this.rand.nextFloat() - 0.5F) * 8.0F; @@ -1110,18 +1119,18 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut int i; int j; - // if (!this.worldObj.isRemote) { - // if (this.deathTicks > 150 && this.deathTicks % 5 == 0) { - // i = 1000; + // if (!this.worldObj.isRemote) { + // if (this.deathTicks > 150 && this.deathTicks % 5 == 0) { + // i = 1000; // - // while (i > 0) { - // j = EntityXPOrb.getXPSplit(i); - // i -= j; - // this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j)); - // } - // } + // while (i > 0) { + // j = EntityXPOrb.getXPSplit(i); + // i -= j; + // this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j)); + // } + // } // - // }else + // }else if (this.deathTicks == 1) { this.worldObj.playSound(this.posX, this.posY, this.posZ, "mob.enderdragon.end", 50.0F, 1F, false); // this.worldObj.playBroadcastSound(1018, (int) this.posX, (int) this.posY, (int) this.posZ, 0); @@ -1150,29 +1159,29 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut } private void collideWithEntities(List par1List) { - // if (true) return; + // if (true) return; // - // double d0 = (this.dragonPartBody.boundingBox.minX + this.dragonPartBody.boundingBox.maxX) / 2.0D; - // double d1 = (this.dragonPartBody.boundingBox.minZ + this.dragonPartBody.boundingBox.maxZ) / 2.0D; - // Iterator iterator = par1List.iterator(); + // double d0 = (this.dragonPartBody.boundingBox.minX + this.dragonPartBody.boundingBox.maxX) / 2.0D; + // double d1 = (this.dragonPartBody.boundingBox.minZ + this.dragonPartBody.boundingBox.maxZ) / 2.0D; + // Iterator iterator = par1List.iterator(); // - // while (iterator.hasNext()) { - // Entity entity = (Entity) iterator.next(); + // while (iterator.hasNext()) { + // Entity entity = (Entity) iterator.next(); // - // if (entity instanceof EntityLivingBase) { - // double d2 = entity.posX - d0; - // double d3 = entity.posZ - d1; - // double d4 = d2 * d2 + d3 * d3; - // if (rand.nextInt(isUber ? 3 : 10) == 0) entity.addVelocity(d2 / d4 * 8.0D, 5.20000000298023224D, d3 / d4 * + // if (entity instanceof EntityLivingBase) { + // double d2 = entity.posX - d0; + // double d3 = entity.posZ - d1; + // double d4 = d2 * d2 + d3 * d3; + // if (rand.nextInt(isUber ? 3 : 10) == 0) entity.addVelocity(d2 / d4 * 8.0D, 5.20000000298023224D, d3 / d4 * // 8.0D); - // entity.velocityChanged = true; - // ((EntityLivingBase)entity).setLastAttacker(this); - // } - // if (entity instanceof EntityLivingBase && isUber){ - // ((EntityLivingBase)entity).setLastAttacker(this); - // entity.attackEntityFrom(new DamageSourceChaos(this), 20F); - // } - // } + // entity.velocityChanged = true; + // ((EntityLivingBase)entity).setLastAttacker(this); + // } + // if (entity instanceof EntityLivingBase && isUber){ + // ((EntityLivingBase)entity).setLastAttacker(this); + // entity.attackEntityFrom(new DamageSourceChaos(this), 20F); + // } + // } } private void attackEntitiesInList(List par1List) { @@ -1198,7 +1207,7 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut if (getHealth() <= 0) { healingChaosCrystal = null; crystalY = -1; - // connectedCrystalID = -1; + // connectedCrystalID = -1; return; } @@ -1213,19 +1222,18 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut if (this.rand.nextInt(10) == 0) { EntityChaosCrystal closest = null; - for (EntityChaosCrystal crystal : crystals) - if (crystal.isAlive() - && (closest == null || getDistanceToEntity(crystal) < getDistanceToEntity(closest))) - closest = crystal; + for (EntityChaosCrystal crystal : crystals) if (crystal.isAlive() + && (closest == null || getDistanceToEntity(crystal) < getDistanceToEntity(closest))) + closest = crystal; healingChaosCrystal = closest; if (healingChaosCrystal != null) { - // connectedCrystalID = healingChaosCrystal.getEntityId(); + // connectedCrystalID = healingChaosCrystal.getEntityId(); crystalX = (int) Math.floor(healingChaosCrystal.posX); crystalY = (int) Math.floor(healingChaosCrystal.posY); crystalZ = (int) Math.floor(healingChaosCrystal.posZ); } else { crystalY = -1; - // connectedCrystalID = -1; + // connectedCrystalID = -1; } } } @@ -1277,52 +1285,52 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut } private void spawnEgg() { - // if (ConfigHandler.dragonEggSpawnLocation[0] != 0 || ConfigHandler.dragonEggSpawnLocation[1] != 0 || + // if (ConfigHandler.dragonEggSpawnLocation[0] != 0 || ConfigHandler.dragonEggSpawnLocation[1] != 0 || // ConfigHandler.dragonEggSpawnLocation[1] != 0 && !isUber) { - // homeX = ConfigHandler.dragonEggSpawnLocation[0]; - // homeY = ConfigHandler.dragonEggSpawnLocation[1]; - // homeZ = ConfigHandler.dragonEggSpawnLocation[2]; - // } + // homeX = ConfigHandler.dragonEggSpawnLocation[0]; + // homeY = ConfigHandler.dragonEggSpawnLocation[1]; + // homeZ = ConfigHandler.dragonEggSpawnLocation[2]; + // } // - // BlockEndPortal.field_149948_a = true; + // BlockEndPortal.field_149948_a = true; // - // if (createPortal || isUber) { - // createEnderPortal(homeX, homeZ); - // } - // LogHelper.info("spawn egg"); - // if (worldObj.getBlock(homeX, homeY + 1, homeZ) == Blocks.air) { - // worldObj.setBlock(homeX, homeY + 1, homeZ, Blocks.dragon_egg); - // LogHelper.info("spawn egg2 " + homeX + " " + homeY + " " + homeZ); - // }else { - // for (int i = homeY + 1; i < 250; i++) { - // if (worldObj.getBlock(homeX, i, homeZ) == Blocks.air) { - // worldObj.setBlock(homeX, i, homeZ, Blocks.dragon_egg); - // LogHelper.info("spawn egg3"); - // break; - // } - // } - // } + // if (createPortal || isUber) { + // createEnderPortal(homeX, homeZ); + // } + // LogHelper.info("spawn egg"); + // if (worldObj.getBlock(homeX, homeY + 1, homeZ) == Blocks.air) { + // worldObj.setBlock(homeX, homeY + 1, homeZ, Blocks.dragon_egg); + // LogHelper.info("spawn egg2 " + homeX + " " + homeY + " " + homeZ); + // }else { + // for (int i = homeY + 1; i < 250; i++) { + // if (worldObj.getBlock(homeX, i, homeZ) == Blocks.air) { + // worldObj.setBlock(homeX, i, homeZ, Blocks.dragon_egg); + // LogHelper.info("spawn egg3"); + // break; + // } + // } + // } // - // for (int iX = homeX - 2; iX <= homeX + 2; iX++) - // { - // for (int iZ = homeZ - 2; iZ <= homeZ + 2; iZ++) - // { + // for (int iX = homeX - 2; iX <= homeX + 2; iX++) + // { + // for (int iZ = homeZ - 2; iZ <= homeZ + 2; iZ++) + // { // - // if (worldObj.getBlock(iX, homeY - 4, iZ) == Blocks.bedrock && !(iX == homeX && iZ == homeZ)) - // { - // worldObj.setBlock(iX, homeY - 3, iZ, Blocks.end_portal); - // } - // } - // } + // if (worldObj.getBlock(iX, homeY - 4, iZ) == Blocks.bedrock && !(iX == homeX && iZ == homeZ)) + // { + // worldObj.setBlock(iX, homeY - 3, iZ, Blocks.end_portal); + // } + // } + // } // // - // worldObj.setBlock(homeX - 1, homeY - 1, homeZ, Blocks.torch); - // worldObj.setBlock(homeX + 1, homeY - 1, homeZ, Blocks.torch); - // worldObj.setBlock(homeX, homeY - 1, homeZ - 1, Blocks.torch); - // worldObj.setBlock(homeX, homeY - 1, homeZ + 1, Blocks.torch); + // worldObj.setBlock(homeX - 1, homeY - 1, homeZ, Blocks.torch); + // worldObj.setBlock(homeX + 1, homeY - 1, homeZ, Blocks.torch); + // worldObj.setBlock(homeX, homeY - 1, homeZ - 1, Blocks.torch); + // worldObj.setBlock(homeX, homeY - 1, homeZ + 1, Blocks.torch); // // - // BlockEndPortal.field_149948_a = false; + // BlockEndPortal.field_149948_a = false; } private void createEnderPortal(int par1, int par2) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosVortex.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosVortex.java index 64f8a3ef..620ef4c4 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosVortex.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosVortex.java @@ -1,20 +1,23 @@ package com.brandon3055.draconicevolution.common.entity; +import java.util.List; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; + import com.brandon3055.brandonscore.common.handlers.ProcessHandler; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.render.particle.Particles; import com.brandon3055.draconicevolution.common.network.GenericParticlePacket; import cpw.mods.fml.common.network.NetworkRegistry; -import java.util.List; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; /** * Created by brandon3055 on 3/10/2015. */ public class EntityChaosVortex extends Entity { + public EntityChaosVortex(World world) { super(world); this.noClip = true; @@ -36,22 +39,20 @@ public class EntityChaosVortex extends Entity { if (!worldObj.isRemote) dataWatcher.updateObject(20, ticksExisted); else ticksExisted = dataWatcher.getWatchableObjectInt(20); - if (ticksExisted < 30 && ticksExisted % 5 == 0 && worldObj.isRemote) - DraconicEvolution.proxy.spawnParticle( - new Particles.ChaosExpansionParticle(worldObj, posX, posY, posZ, false), 512); + if (ticksExisted < 30 && ticksExisted % 5 == 0 && worldObj.isRemote) DraconicEvolution.proxy + .spawnParticle(new Particles.ChaosExpansionParticle(worldObj, posX, posY, posZ, false), 512); if (ticksExisted >= 100 && ticksExisted < 130 && ticksExisted % 5 == 0 && worldObj.isRemote) - DraconicEvolution.proxy.spawnParticle( - new Particles.ChaosExpansionParticle(worldObj, posX, posY, posZ, true), 512); + DraconicEvolution.proxy + .spawnParticle(new Particles.ChaosExpansionParticle(worldObj, posX, posY, posZ, true), 512); if (ticksExisted < 100) return; for (int i = 0; i < 10; i++) { double x = posX - 18 + rand.nextDouble() * 36; double y = posY - 8 + rand.nextDouble() * 16; double z = posZ - 18 + rand.nextDouble() * 36; - if (worldObj.isRemote) - DraconicEvolution.proxy.spawnParticle( - new Particles.AdvancedSeekerParticle(worldObj, x, y, z, posX, posY, posZ, 2, 1f, 1f, 1f, 100), - 128); + if (worldObj.isRemote) DraconicEvolution.proxy.spawnParticle( + new Particles.AdvancedSeekerParticle(worldObj, x, y, z, posX, posY, posZ, 2, 1f, 1f, 1f, 100), + 128); } if (ticksExisted > 130 && worldObj.isRemote && ticksExisted % 2 == 0) shakeScreen(); @@ -70,8 +71,8 @@ public class EntityChaosVortex extends Entity { double intensity = (ticksExisted - 130) / 100D; if (intensity > 1D) intensity = 1D; - List players = - worldObj.getEntitiesWithinAABB(EntityPlayer.class, boundingBox.expand(200, 200, 200)); + List players = worldObj + .getEntitiesWithinAABB(EntityPlayer.class, boundingBox.expand(200, 200, 200)); for (EntityPlayer player : players) { double x = (rand.nextDouble() - 0.5) * 2 * intensity; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomArrow.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomArrow.java index f947e873..bbcb9f7f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomArrow.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomArrow.java @@ -1,15 +1,7 @@ package com.brandon3055.draconicevolution.common.entity; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.client.handler.ParticleHandler; -import com.brandon3055.draconicevolution.client.render.particle.Particles; -import com.brandon3055.draconicevolution.common.handler.ConfigHandler; -import com.brandon3055.draconicevolution.common.items.weapons.BowHandler; -import com.brandon3055.draconicevolution.common.network.GenericParticlePacket; -import cpw.mods.fml.common.network.NetworkRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.List; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.enchantment.EnchantmentHelper; @@ -28,7 +20,19 @@ import net.minecraft.network.play.server.S2BPacketChangeGameState; import net.minecraft.util.*; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.client.handler.ParticleHandler; +import com.brandon3055.draconicevolution.client.render.particle.Particles; +import com.brandon3055.draconicevolution.common.handler.ConfigHandler; +import com.brandon3055.draconicevolution.common.items.weapons.BowHandler; +import com.brandon3055.draconicevolution.common.network.GenericParticlePacket; + +import cpw.mods.fml.common.network.NetworkRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class EntityCustomArrow extends EntityArrow { + private int blockX = -1; private int blockY = -1; private int blockZ = -1; @@ -55,12 +59,8 @@ public class EntityCustomArrow extends EntityArrow { renderDistanceWeight = 40; } - public EntityCustomArrow( - World p_i1755_1_, - EntityLivingBase p_i1755_2_, - EntityLivingBase p_i1755_3_, - float p_i1755_4_, - float p_i1755_5_) { + public EntityCustomArrow(World p_i1755_1_, EntityLivingBase p_i1755_2_, EntityLivingBase p_i1755_3_, + float p_i1755_4_, float p_i1755_5_) { super(p_i1755_1_, p_i1755_2_, p_i1755_3_, p_i1755_4_, p_i1755_5_); renderDistanceWeight = 40; } @@ -108,8 +108,8 @@ public class EntityCustomArrow extends EntityArrow { if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); - this.prevRotationYaw = - this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); + this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D + / Math.PI); this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(this.motionY, f) * 180.0D / Math.PI); } @@ -124,8 +124,8 @@ public class EntityCustomArrow extends EntityArrow { if (block.getMaterial() != Material.air) { onHitAnything(); block.setBlockBoundsBasedOnState(this.worldObj, this.blockX, this.blockY, this.blockZ); - AxisAlignedBB axisalignedbb = - block.getCollisionBoundingBoxFromPool(this.worldObj, this.blockX, this.blockY, this.blockZ); + AxisAlignedBB axisalignedbb = block + .getCollisionBoundingBoxFromPool(this.worldObj, this.blockX, this.blockY, this.blockZ); if (axisalignedbb != null && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ))) { @@ -140,9 +140,8 @@ public class EntityCustomArrow extends EntityArrow { if (block == this.blockHit && j == this.inData) { ++this.ticksInGround; - if (this.ticksInGround == 1200 - || bowProperties - .energyBolt) { // Delete the entity when it hits the ground if it is an energy bolt + if (this.ticksInGround == 1200 || bowProperties.energyBolt) { // Delete the entity when it hits the + // ground if it is an energy bolt this.setDead(); } } else { @@ -157,12 +156,12 @@ public class EntityCustomArrow extends EntityArrow { // region Detect Entity Hit ++this.ticksInAir; Vec3 vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); - Vec3 vec3 = Vec3.createVectorHelper( - this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + Vec3 vec3 = Vec3 + .createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec31, vec3, false, true, false); vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); - vec3 = Vec3.createVectorHelper( - this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + vec3 = Vec3 + .createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); if (movingobjectposition != null) { vec3 = Vec3.createVectorHelper( @@ -174,9 +173,7 @@ public class EntityCustomArrow extends EntityArrow { Entity entity = null; List list = this.worldObj.getEntitiesWithinAABBExcludingEntity( this, - this.boundingBox - .addCoord(this.motionX, this.motionY, this.motionZ) - .expand(1.0D, 1.0D, 1.0D)); + this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); double d0 = 0.0D; int i; float f1; @@ -204,14 +201,12 @@ public class EntityCustomArrow extends EntityArrow { movingobjectposition = new MovingObjectPosition(entity); } - if (movingobjectposition != null - && movingobjectposition.entityHit != null + if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer) { EntityPlayer entityplayer = (EntityPlayer) movingobjectposition.entityHit; - if (entityplayer.capabilities.disableDamage - || this.shootingEntity instanceof EntityPlayer - && !((EntityPlayer) this.shootingEntity).canAttackPlayer(entityplayer)) { + if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer + && !((EntityPlayer) this.shootingEntity).canAttackPlayer(entityplayer)) { movingobjectposition = null; } } @@ -243,11 +238,9 @@ public class EntityCustomArrow extends EntityArrow { if (bowProperties.energyBolt) movingobjectposition.entityHit.hurtResistantTime = 0; if (movingobjectposition.entityHit instanceof EntityDragonPart - && ((EntityDragonPart) movingobjectposition.entityHit).entityDragonObj - instanceof EntityDragon + && ((EntityDragonPart) movingobjectposition.entityHit).entityDragonObj instanceof EntityDragon && bowProperties.energyBolt) { - ((EntityDragon) ((EntityDragonPart) movingobjectposition.entityHit).entityDragonObj) - .hurtResistantTime = 0; + ((EntityDragon) ((EntityDragonPart) movingobjectposition.entityHit).entityDragonObj).hurtResistantTime = 0; } if (movingobjectposition.entityHit.attackEntityFrom(getDamageSource(), actualDamage)) { @@ -271,16 +264,15 @@ public class EntityCustomArrow extends EntityArrow { if (this.shootingEntity != null && this.shootingEntity instanceof EntityLivingBase) { EnchantmentHelper.func_151384_a(entitylivingbase, this.shootingEntity); - EnchantmentHelper.func_151385_b( - (EntityLivingBase) this.shootingEntity, entitylivingbase); + EnchantmentHelper + .func_151385_b((EntityLivingBase) this.shootingEntity, entitylivingbase); } - if (this.shootingEntity != null - && movingobjectposition.entityHit != this.shootingEntity + if (this.shootingEntity != null && movingobjectposition.entityHit != this.shootingEntity && movingobjectposition.entityHit instanceof EntityPlayer && this.shootingEntity instanceof EntityPlayerMP) { - ((EntityPlayerMP) this.shootingEntity) - .playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(6, 0.0F)); + ((EntityPlayerMP) this.shootingEntity).playerNetServerHandler + .sendPacket(new S2BPacketChangeGameState(6, 0.0F)); } } @@ -288,9 +280,8 @@ public class EntityCustomArrow extends EntityArrow { this.setDead(); } else { - if (!(worldObj.isRemote - && ticksInAir - < 5)) { // Fix arrow wobble on fire due to client side collision with shooting + if (!(worldObj.isRemote && ticksInAir < 5)) { // Fix arrow wobble on fire due to client side + // collision with shooting // entity this.motionX *= -0.10000000149011612D; this.motionY *= -0.10000000149011612D; @@ -320,8 +311,8 @@ public class EntityCustomArrow extends EntityArrow { this.arrowShake = 7; if (this.blockHit.getMaterial() != Material.air) { - this.blockHit.onEntityCollidedWithBlock( - this.worldObj, this.blockX, this.blockY, this.blockZ, this); + this.blockHit + .onEntityCollidedWithBlock(this.worldObj, this.blockX, this.blockY, this.blockZ, this); } } } @@ -351,9 +342,9 @@ public class EntityCustomArrow extends EntityArrow { velocity = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); - for (this.rotationPitch = (float) (Math.atan2(this.motionY, velocity) * 180.0D / Math.PI); - this.rotationPitch - this.prevRotationPitch < -180.0F; - this.prevRotationPitch -= 360.0F) { + for (this.rotationPitch = (float) (Math.atan2(this.motionY, velocity) * 180.0D + / Math.PI); this.rotationPitch - this.prevRotationPitch + < -180.0F; this.prevRotationPitch -= 360.0F) { ; } @@ -458,8 +449,8 @@ public class EntityCustomArrow extends EntityArrow { public void onCollideWithPlayer(EntityPlayer par1EntityPlayer) { if (!this.worldObj.isRemote && this.inGround && this.arrowShake <= 0) { - boolean flag = - this.canBePickedUp == 1 || this.canBePickedUp == 2 && par1EntityPlayer.capabilities.isCreativeMode; + boolean flag = this.canBePickedUp == 1 + || this.canBePickedUp == 2 && par1EntityPlayer.capabilities.isCreativeMode; if (this.canBePickedUp == 1 && !par1EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Items.arrow, 1))) { @@ -468,7 +459,9 @@ public class EntityCustomArrow extends EntityArrow { if (flag) { this.playSound( - "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + "random.pop", + 0.2F, + ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); par1EntityPlayer.onItemPickup(this, 1); this.setDead(); } @@ -480,13 +473,22 @@ public class EntityCustomArrow extends EntityArrow { public void onHitAnything() { if (bowProperties.explosionPower > 0 && !worldObj.isRemote) { worldObj.createExplosion( - this, prevPosX, prevPosY, prevPosZ, bowProperties.explosionPower, ConfigHandler.bowBlockDamage); + this, + prevPosX, + prevPosY, + prevPosZ, + bowProperties.explosionPower, + ConfigHandler.bowBlockDamage); setDead(); } if (bowProperties.shockWavePower > 0 && !worldObj.isRemote) { DraconicEvolution.network.sendToAllAround( - new GenericParticlePacket(GenericParticlePacket.ARROW_SHOCK_WAVE, posX, posY, posZ, (int) - (bowProperties.shockWavePower * 100)), + new GenericParticlePacket( + GenericParticlePacket.ARROW_SHOCK_WAVE, + posX, + posY, + posZ, + (int) (bowProperties.shockWavePower * 100)), new NetworkRegistry.TargetPoint(dimension, posX, posY, posZ, 256)); worldObj.playSoundEffect( posX, @@ -522,9 +524,9 @@ public class EntityCustomArrow extends EntityArrow { private DamageSource getDamageSource() { if (bowProperties.energyBolt) { return new EntityDamageSourceIndirect( - "customArrowEnergy", this, shootingEntity != null ? shootingEntity : this) - .setProjectile() - .setDamageIsAbsolute(); + "customArrowEnergy", + this, + shootingEntity != null ? shootingEntity : this).setProjectile().setDamageIsAbsolute(); } else return DamageSource.causeArrowDamage(this, shootingEntity != null ? shootingEntity : this); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomDragon.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomDragon.java index d472ecf5..61fd961e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomDragon.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomDragon.java @@ -1,10 +1,8 @@ package com.brandon3055.draconicevolution.common.entity; -import com.brandon3055.draconicevolution.common.handler.ConfigHandler; -import com.brandon3055.draconicevolution.common.utills.DamageSourceChaos; -import com.brandon3055.draconicevolution.common.utills.LogHelper; import java.util.Iterator; import java.util.List; + import net.minecraft.block.Block; import net.minecraft.block.BlockEndPortal; import net.minecraft.entity.Entity; @@ -25,6 +23,10 @@ import net.minecraft.util.Vec3; import net.minecraft.world.Explosion; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.common.handler.ConfigHandler; +import com.brandon3055.draconicevolution.common.utills.DamageSourceChaos; +import com.brandon3055.draconicevolution.common.utills.LogHelper; + /** * Created by Brandon on 4/07/2014. */ @@ -111,13 +113,10 @@ public class EntityCustomDragon extends EntityDragon { } else { this.updateDragonEnderCrystal(); if (isUber) - f = 0.5F - / (MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ) * 10.0F - + 1.0F); // Wing Speed - else - f = 0.2F - / (MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ) * 10.0F - + 1.0F); + f = 0.5F / (MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ) * 10.0F + + 1.0F); // Wing Speed + else f = 0.2F / (MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ) * 10.0F + + 1.0F); f *= (float) Math.pow(2.0D, this.motionY); if (this.slowed) { @@ -153,8 +152,8 @@ public class EntityCustomDragon extends EntityDragon { d0 = this.posY + (this.newPosY - this.posY) / (double) this.newPosRotationIncrements; d1 = this.posZ + (this.newPosZ - this.posZ) / (double) this.newPosRotationIncrements; d2 = MathHelper.wrapAngleTo180_double(this.newRotationYaw - (double) this.rotationYaw); - this.rotationYaw = - (float) ((double) this.rotationYaw + d2 / (double) this.newPosRotationIncrements); + this.rotationYaw = (float) ((double) this.rotationYaw + + d2 / (double) this.newPosRotationIncrements); this.rotationPitch = (float) ((double) this.rotationPitch + (this.newRotationPitch - (double) this.rotationPitch) / (double) this.newPosRotationIncrements); @@ -186,8 +185,7 @@ public class EntityCustomDragon extends EntityDragon { this.targetZ += this.rand.nextGaussian() * 2.0D; } - if (this.forceNewTarget - || d2 < 100.0D + if (this.forceNewTarget || d2 < 100.0D || d2 > 22500.0D || this.isCollidedHorizontally || this.isCollidedVertically) { @@ -220,13 +218,13 @@ public class EntityCustomDragon extends EntityDragon { } Vec3 vec3 = Vec3.createVectorHelper( - this.targetX - this.posX, this.targetY - this.posY, this.targetZ - this.posZ) - .normalize(); + this.targetX - this.posX, + this.targetY - this.posY, + this.targetZ - this.posZ).normalize(); Vec3 vec32 = Vec3.createVectorHelper( - (double) MathHelper.sin(this.rotationYaw * (float) Math.PI / 180.0F), - this.motionY, - (double) (-MathHelper.cos(this.rotationYaw * (float) Math.PI / 180.0F))) - .normalize(); + (double) MathHelper.sin(this.rotationYaw * (float) Math.PI / 180.0F), + this.motionY, + (double) (-MathHelper.cos(this.rotationYaw * (float) Math.PI / 180.0F))).normalize(); float f5 = (float) (vec32.dotProduct(vec3) + 0.5D) / 1.5F; if (f5 < 0.0F) { @@ -234,16 +232,16 @@ public class EntityCustomDragon extends EntityDragon { } this.randomYawVelocity *= 0.8F; - float f6 = - MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ) * 1.0F + 1.0F; + float f6 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ) * 1.0F + + 1.0F; double d9 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ) * 1.0D + 1.0D; if (d9 > 40.0D) { d9 = 40.0D; } - this.randomYawVelocity = - (float) ((double) this.randomYawVelocity + d6 * (0.699999988079071D / d9 / (double) f6)); + this.randomYawVelocity = (float) ((double) this.randomYawVelocity + + d6 * (0.699999988079071D / d9 / (double) f6)); this.rotationYaw += this.randomYawVelocity * 0.1F; float f7 = (float) (2.0D / (d9 + 1.0D)); float f8 = 0.06F; @@ -260,8 +258,7 @@ public class EntityCustomDragon extends EntityDragon { this.moveEntity(this.motionX, this.motionY, this.motionZ); } - Vec3 vec31 = Vec3.createVectorHelper(this.motionX, this.motionY, this.motionZ) - .normalize(); + Vec3 vec31 = Vec3.createVectorHelper(this.motionX, this.motionY, this.motionZ).normalize(); float f9 = (float) (vec31.dotProduct(vec32) + 1.0D) / 2.0F; f9 = 0.8F + 0.15F * f9; this.motionX *= (double) f9; @@ -280,8 +277,7 @@ public class EntityCustomDragon extends EntityDragon { this.dragonPartWing1.width = 4.0F; this.dragonPartWing2.height = 3.0F; this.dragonPartWing2.width = 4.0F; - f1 = (float) (this.getMovementOffsets(5, 1.0F)[1] - this.getMovementOffsets(10, 1.0F)[1]) - * 10.0F + f1 = (float) (this.getMovementOffsets(5, 1.0F)[1] - this.getMovementOffsets(10, 1.0F)[1]) * 10.0F / 180.0F * (float) Math.PI; f2 = MathHelper.cos(f1); @@ -291,29 +287,39 @@ public class EntityCustomDragon extends EntityDragon { float f4 = MathHelper.cos(f3); this.dragonPartBody.onUpdate(); this.dragonPartBody.setLocationAndAngles( - this.posX + (double) (f11 * 0.5F), this.posY, this.posZ - (double) (f4 * 0.5F), 0.0F, 0.0F); + this.posX + (double) (f11 * 0.5F), + this.posY, + this.posZ - (double) (f4 * 0.5F), + 0.0F, + 0.0F); this.dragonPartWing1.onUpdate(); this.dragonPartWing1.setLocationAndAngles( - this.posX + (double) (f4 * 4.5F), this.posY + 2.0D, this.posZ + (double) (f11 * 4.5F), 0.0F, 0.0F); + this.posX + (double) (f4 * 4.5F), + this.posY + 2.0D, + this.posZ + (double) (f11 * 4.5F), + 0.0F, + 0.0F); this.dragonPartWing2.onUpdate(); this.dragonPartWing2.setLocationAndAngles( - this.posX - (double) (f4 * 4.5F), this.posY + 2.0D, this.posZ - (double) (f11 * 4.5F), 0.0F, 0.0F); + this.posX - (double) (f4 * 4.5F), + this.posY + 2.0D, + this.posZ - (double) (f11 * 4.5F), + 0.0F, + 0.0F); if (!this.worldObj.isRemote && this.hurtTime == 0) { - this.collideWithEntities(this.worldObj.getEntitiesWithinAABBExcludingEntity( - this, - this.dragonPartWing1 - .boundingBox - .expand(4.0D, 2.0D, 4.0D) - .offset(0.0D, -2.0D, 0.0D))); - this.collideWithEntities(this.worldObj.getEntitiesWithinAABBExcludingEntity( - this, - this.dragonPartWing2 - .boundingBox - .expand(4.0D, 2.0D, 4.0D) - .offset(0.0D, -2.0D, 0.0D))); - this.attackEntitiesInList(this.worldObj.getEntitiesWithinAABBExcludingEntity( - this, this.dragonPartHead.boundingBox.expand(1.0D, 1.0D, 1.0D))); + this.collideWithEntities( + this.worldObj.getEntitiesWithinAABBExcludingEntity( + this, + this.dragonPartWing1.boundingBox.expand(4.0D, 2.0D, 4.0D).offset(0.0D, -2.0D, 0.0D))); + this.collideWithEntities( + this.worldObj.getEntitiesWithinAABBExcludingEntity( + this, + this.dragonPartWing2.boundingBox.expand(4.0D, 2.0D, 4.0D).offset(0.0D, -2.0D, 0.0D))); + this.attackEntitiesInList( + this.worldObj.getEntitiesWithinAABBExcludingEntity( + this, + this.dragonPartHead.boundingBox.expand(1.0D, 1.0D, 1.0D))); } double[] adouble1 = this.getMovementOffsets(5, 1.0F); @@ -381,8 +387,7 @@ public class EntityCustomDragon extends EntityDragon { } } } - if (ConfigHandler.dragonEggSpawnLocation[0] != 0 - || ConfigHandler.dragonEggSpawnLocation[1] != 0 + if (ConfigHandler.dragonEggSpawnLocation[0] != 0 || ConfigHandler.dragonEggSpawnLocation[1] != 0 || ConfigHandler.dragonEggSpawnLocation[1] != 0) { createPortal = false; portalX = ConfigHandler.dragonEggSpawnLocation[0]; @@ -423,8 +428,8 @@ public class EntityCustomDragon extends EntityDragon { while (i > 0) { j = EntityXPOrb.getXPSplit(i); i -= j; - this.worldObj.spawnEntityInWorld( - new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j)); + this.worldObj + .spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j)); } } } else if (this.deathTicks == 1) { @@ -496,7 +501,9 @@ public class EntityCustomDragon extends EntityDragon { if (this.healingEnderCrystal.isDead) { if (!this.worldObj.isRemote) { this.attackEntityFromPart( - this.dragonPartHead, DamageSource.setExplosionSource((Explosion) null), 10.0F); + this.dragonPartHead, + DamageSource.setExplosionSource((Explosion) null), + 10.0F); } this.healingEnderCrystal = null; @@ -509,7 +516,8 @@ public class EntityCustomDragon extends EntityDragon { if (this.rand.nextInt(10) == 0) { float f = 32.0F; List list = this.worldObj.getEntitiesWithinAABB( - EntityEnderCrystal.class, this.boundingBox.expand((double) f, (double) f, (double) f)); + EntityEnderCrystal.class, + this.boundingBox.expand((double) f, (double) f, (double) f)); EntityEnderCrystal entityendercrystal = null; double d0 = Double.MAX_VALUE; Iterator iterator = list.iterator(); @@ -531,11 +539,10 @@ public class EntityCustomDragon extends EntityDragon { private void setNewTarget() { this.forceNewTarget = false; - if ((isUber || this.rand.nextInt(2) == 0) - && (!isUber || 19 > this.rand.nextInt(20)) + if ((isUber || this.rand.nextInt(2) == 0) && (!isUber || 19 > this.rand.nextInt(20)) && !this.worldObj.playerEntities.isEmpty()) { - this.target = - (Entity) this.worldObj.playerEntities.get(this.rand.nextInt(this.worldObj.playerEntities.size())); + this.target = (Entity) this.worldObj.playerEntities + .get(this.rand.nextInt(this.worldObj.playerEntities.size())); } else { boolean flag = false; @@ -602,8 +609,7 @@ public class EntityCustomDragon extends EntityDragon { } private void spawnEgg() { - if (ConfigHandler.dragonEggSpawnLocation[0] != 0 - || ConfigHandler.dragonEggSpawnLocation[1] != 0 + if (ConfigHandler.dragonEggSpawnLocation[0] != 0 || ConfigHandler.dragonEggSpawnLocation[1] != 0 || ConfigHandler.dragonEggSpawnLocation[1] != 0 && !isUber) { portalX = ConfigHandler.dragonEggSpawnLocation[0]; portalY = ConfigHandler.dragonEggSpawnLocation[1]; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDraconicArrow.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDraconicArrow.java index d58439cb..90ed120b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDraconicArrow.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDraconicArrow.java @@ -1,9 +1,7 @@ package com.brandon3055.draconicevolution.common.entity; -import com.brandon3055.draconicevolution.common.handler.ConfigHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.List; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.enchantment.EnchantmentHelper; @@ -22,7 +20,13 @@ import net.minecraft.network.play.server.S2BPacketChangeGameState; import net.minecraft.util.*; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.common.handler.ConfigHandler; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class EntityDraconicArrow extends EntityArrow { + private int blockX = -1; private int blockY = -1; private int blockZ = -1; @@ -48,12 +52,8 @@ public class EntityDraconicArrow extends EntityArrow { super(p_i1754_1_, p_i1754_2_, p_i1754_4_, p_i1754_6_); } - public EntityDraconicArrow( - World p_i1755_1_, - EntityLivingBase p_i1755_2_, - EntityLivingBase p_i1755_3_, - float p_i1755_4_, - float p_i1755_5_) { + public EntityDraconicArrow(World p_i1755_1_, EntityLivingBase p_i1755_2_, EntityLivingBase p_i1755_3_, + float p_i1755_4_, float p_i1755_5_) { super(p_i1755_1_, p_i1755_2_, p_i1755_3_, p_i1755_4_, p_i1755_5_); } @@ -119,8 +119,8 @@ public class EntityDraconicArrow extends EntityArrow { super.onEntityUpdate(); if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); - this.prevRotationYaw = - this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); + this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D + / Math.PI); this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(this.motionY, f) * 180.0D / Math.PI); } @@ -139,8 +139,8 @@ public class EntityDraconicArrow extends EntityArrow { return; } block.setBlockBoundsBasedOnState(this.worldObj, this.blockX, this.blockY, this.blockZ); - AxisAlignedBB axisalignedbb = - block.getCollisionBoundingBoxFromPool(this.worldObj, this.blockX, this.blockY, this.blockZ); + AxisAlignedBB axisalignedbb = block + .getCollisionBoundingBoxFromPool(this.worldObj, this.blockX, this.blockY, this.blockZ); if (axisalignedbb != null && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ))) { @@ -172,12 +172,12 @@ public class EntityDraconicArrow extends EntityArrow { } else { ++this.ticksInAir; Vec3 vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); - Vec3 vec3 = Vec3.createVectorHelper( - this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + Vec3 vec3 = Vec3 + .createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec31, vec3, false, true, false); vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); - vec3 = Vec3.createVectorHelper( - this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + vec3 = Vec3 + .createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); if (movingobjectposition != null) { vec3 = Vec3.createVectorHelper( @@ -189,9 +189,7 @@ public class EntityDraconicArrow extends EntityArrow { Entity entity = null; List list = this.worldObj.getEntitiesWithinAABBExcludingEntity( this, - this.boundingBox - .addCoord(this.motionX, this.motionY, this.motionZ) - .expand(1.0D, 1.0D, 1.0D)); + this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); double d0 = 0.0D; int i; float f1; @@ -219,14 +217,12 @@ public class EntityDraconicArrow extends EntityArrow { movingobjectposition = new MovingObjectPosition(entity); } - if (movingobjectposition != null - && movingobjectposition.entityHit != null + if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer) { EntityPlayer entityplayer = (EntityPlayer) movingobjectposition.entityHit; - if (entityplayer.capabilities.disableDamage - || this.shootingEntity instanceof EntityPlayer - && !((EntityPlayer) this.shootingEntity).canAttackPlayer(entityplayer)) { + if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer + && !((EntityPlayer) this.shootingEntity).canAttackPlayer(entityplayer)) { movingobjectposition = null; } } @@ -251,9 +247,9 @@ public class EntityDraconicArrow extends EntityArrow { } int k; if (!ignorSpeed) { - f2 = MathHelper.sqrt_double(this.motionX * this.motionX - + this.motionY * this.motionY - + this.motionZ * this.motionZ); + f2 = MathHelper.sqrt_double( + this.motionX * this.motionX + this.motionY * this.motionY + + this.motionZ * this.motionZ); k = MathHelper.ceiling_double_int(f2 * this.damage); if (this.getIsCritical()) { @@ -281,10 +277,8 @@ public class EntityDraconicArrow extends EntityArrow { movingobjectposition.entityHit.hurtResistantTime = 0; if (movingobjectposition.entityHit instanceof EntityDragonPart - && ((EntityDragonPart) movingobjectposition.entityHit).entityDragonObj - instanceof EntityDragon) { - ((EntityDragon) ((EntityDragonPart) movingobjectposition.entityHit).entityDragonObj) - .hurtResistantTime = 0; + && ((EntityDragonPart) movingobjectposition.entityHit).entityDragonObj instanceof EntityDragon) { + ((EntityDragon) ((EntityDragonPart) movingobjectposition.entityHit).entityDragonObj).hurtResistantTime = 0; } if (movingobjectposition.entityHit.attackEntityFrom(damagesource, k)) { @@ -308,16 +302,15 @@ public class EntityDraconicArrow extends EntityArrow { if (this.shootingEntity != null && this.shootingEntity instanceof EntityLivingBase) { EnchantmentHelper.func_151384_a(entitylivingbase, this.shootingEntity); - EnchantmentHelper.func_151385_b( - (EntityLivingBase) this.shootingEntity, entitylivingbase); + EnchantmentHelper + .func_151385_b((EntityLivingBase) this.shootingEntity, entitylivingbase); } - if (this.shootingEntity != null - && movingobjectposition.entityHit != this.shootingEntity + if (this.shootingEntity != null && movingobjectposition.entityHit != this.shootingEntity && movingobjectposition.entityHit instanceof EntityPlayer && this.shootingEntity instanceof EntityPlayerMP) { - ((EntityPlayerMP) this.shootingEntity) - .playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(6, 0.0F)); + ((EntityPlayerMP) this.shootingEntity).playerNetServerHandler + .sendPacket(new S2BPacketChangeGameState(6, 0.0F)); } } @@ -355,8 +348,8 @@ public class EntityDraconicArrow extends EntityArrow { this.arrowShake = 7; if (this.blockHit.getMaterial() != Material.air) { - this.blockHit.onEntityCollidedWithBlock( - this.worldObj, this.blockX, this.blockY, this.blockZ, this); + this.blockHit + .onEntityCollidedWithBlock(this.worldObj, this.blockX, this.blockY, this.blockZ, this); } } } @@ -380,9 +373,8 @@ public class EntityDraconicArrow extends EntityArrow { f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); - for (this.rotationPitch = (float) (Math.atan2(this.motionY, f2) * 180.0D / Math.PI); - this.rotationPitch - this.prevRotationPitch < -180.0F; - this.prevRotationPitch -= 360.0F) { + for (this.rotationPitch = (float) (Math.atan2(this.motionY, f2) * 180.0D / Math.PI); this.rotationPitch + - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) { ; } @@ -476,8 +468,8 @@ public class EntityDraconicArrow extends EntityArrow { public void onCollideWithPlayer(EntityPlayer par1EntityPlayer) { if (!this.worldObj.isRemote && this.inGround && this.arrowShake <= 0) { - boolean flag = - this.canBePickedUp == 1 || this.canBePickedUp == 2 && par1EntityPlayer.capabilities.isCreativeMode; + boolean flag = this.canBePickedUp == 1 + || this.canBePickedUp == 2 && par1EntityPlayer.capabilities.isCreativeMode; if (this.canBePickedUp == 1 && !par1EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Items.arrow, 1))) { @@ -486,7 +478,9 @@ public class EntityDraconicArrow extends EntityArrow { if (flag) { this.playSound( - "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + "random.pop", + 0.2F, + ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); par1EntityPlayer.onItemPickup(this, 1); this.setDead(); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonHeart.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonHeart.java index 7b5e358d..d4c242c2 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonHeart.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonHeart.java @@ -1,16 +1,8 @@ package com.brandon3055.draconicevolution.common.entity; -import com.brandon3055.brandonscore.common.utills.Utills; -import com.brandon3055.draconicevolution.client.handler.ParticleHandler; -import com.brandon3055.draconicevolution.client.render.particle.Particles; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.blocks.DraconiumBlock; -import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.List; + import net.minecraft.client.particle.EntityFX; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; @@ -21,6 +13,17 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.world.World; +import com.brandon3055.brandonscore.common.utills.Utills; +import com.brandon3055.draconicevolution.client.handler.ParticleHandler; +import com.brandon3055.draconicevolution.client.render.particle.Particles; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.blocks.DraconiumBlock; +import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 21/11/2014. */ @@ -102,7 +105,11 @@ public class EntityDragonHeart extends Entity { opPhase = 3; if (coresConsumed < 4) { EntityPersistentItem item = new EntityPersistentItem( - worldObj, posX, posY, posZ, new ItemStack(ModItems.dragonHeart)); + worldObj, + posX, + posY, + posZ, + new ItemStack(ModItems.dragonHeart)); item.motionX = 0; item.motionY = 0; item.motionZ = 0; @@ -176,7 +183,11 @@ public class EntityDragonHeart extends Entity { if (blocks.size() == 0) { if (!worldObj.isRemote) { EntityPersistentItem item = new EntityPersistentItem( - worldObj, posX, posY, posZ, new ItemStack(ModItems.dragonHeart)); + worldObj, + posX, + posY, + posZ, + new ItemStack(ModItems.dragonHeart)); item.motionX = 0; item.motionY = 0; item.motionZ = 0; @@ -192,9 +203,13 @@ public class EntityDragonHeart extends Entity { break; } for (TileLocation tile : blocks) { - if (!worldObj.isRemote) - worldObj.setBlock( - tile.getXCoord(), tile.getYCoord(), tile.getZCoord(), ModBlocks.draconicBlock, 0, 2); + if (!worldObj.isRemote) worldObj.setBlock( + tile.getXCoord(), + tile.getYCoord(), + tile.getZCoord(), + ModBlocks.draconicBlock, + 0, + 2); worldObj.createExplosion(null, tile.getXCoord(), tile.getYCoord(), tile.getZCoord(), 4, false); } worldObj.createExplosion(null, posX, posY, posZ, 4, false); @@ -218,7 +233,18 @@ public class EntityDragonHeart extends Entity { double offsetX = Math.sin(nextFloat); double offsetZ = Math.cos(nextFloat); EntityFX particle = new Particles.AdvancedSeekerParticle( - worldObj, posX + offsetX, correctY, posZ + offsetZ, posX, correctY, posZ, 1, 1f, 1f, 1f, 10); + worldObj, + posX + offsetX, + correctY, + posZ + offsetZ, + posX, + correctY, + posZ, + 1, + 1f, + 1f, + 1f, + 10); ParticleHandler.spawnCustomParticle(particle, 64); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonProjectile.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonProjectile.java index a1265676..04529b02 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonProjectile.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonProjectile.java @@ -1,16 +1,7 @@ package com.brandon3055.draconicevolution.common.entity; -import cofh.api.energy.IEnergyContainerItem; -import com.brandon3055.brandonscore.common.utills.Teleporter; -import com.brandon3055.brandonscore.common.utills.Utills; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.client.handler.ParticleHandler; -import com.brandon3055.draconicevolution.client.render.particle.Particles; -import com.brandon3055.draconicevolution.common.network.GenericParticlePacket; -import cpw.mods.fml.common.network.NetworkRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.List; + import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.boss.EntityDragon; @@ -22,6 +13,19 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.*; import net.minecraft.world.World; +import cofh.api.energy.IEnergyContainerItem; + +import com.brandon3055.brandonscore.common.utills.Teleporter; +import com.brandon3055.brandonscore.common.utills.Utills; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.client.handler.ParticleHandler; +import com.brandon3055.draconicevolution.client.render.particle.Particles; +import com.brandon3055.draconicevolution.common.network.GenericParticlePacket; + +import cpw.mods.fml.common.network.NetworkRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by brandon3055 on 23/8/2015. */ @@ -34,19 +38,14 @@ public class EntityDragonProjectile extends Entity { public boolean isChaser; private double lastTickTargetDistance = 100; private float heath = 5F; - private DamageSource damageFireball = new DamageSource("de.GuardianFireball") - .setDamageAllowedInCreativeMode() - .setMagicDamage() - .setExplosion(); - private DamageSource damageEnergy = new DamageSource("de.GuardianEnergyBall") - .setDamageAllowedInCreativeMode() + private DamageSource damageFireball = new DamageSource("de.GuardianFireball").setDamageAllowedInCreativeMode() + .setMagicDamage().setExplosion(); + private DamageSource damageEnergy = new DamageSource("de.GuardianEnergyBall").setDamageAllowedInCreativeMode() .setDamageBypassesArmor(); - private DamageSource damageChaos = new DamageSource("de.GuardianChaosBall") - .setDamageAllowedInCreativeMode() - .setDamageBypassesArmor() - .setDamageIsAbsolute(); + private DamageSource damageChaos = new DamageSource("de.GuardianChaosBall").setDamageAllowedInCreativeMode() + .setDamageBypassesArmor().setDamageIsAbsolute(); - // public static final int FIREBALL = 0; /** Generic fireball a lot more powerful then ghast fireball */ + // public static final int FIREBALL = 0; /** Generic fireball a lot more powerful then ghast fireball */ public static final int FIREBOMB = 1; /** * Large fireball with a trail and large fiery AOE @@ -65,7 +64,8 @@ public class EntityDragonProjectile extends Entity { */ public static final int CHAOS_CHASER = 5; /** - * Chases player. On impact splits into mini chaos charges which lock on to other or the same player (can pass through blocks) + * Chases player. On impact splits into mini chaos charges which lock on to other or the same player (can pass + * through blocks) */ public static final int MINI_CHAOS_CHASER = 6; /** @@ -86,8 +86,7 @@ public class EntityDragonProjectile extends Entity { this.target = target; this.shooter = shooter; this.power = power; - this.isChaser = type == FIRE_CHASER - || type == ENERGY_CHASER + this.isChaser = type == FIRE_CHASER || type == ENERGY_CHASER || type == CHAOS_CHASER || type == MINI_CHAOS_CHASER || type == IGNITION_CHARGE; @@ -130,11 +129,11 @@ public class EntityDragonProjectile extends Entity { @Override protected void entityInit() { - if (type == ENERGY_CHASER - || type == CHAOS_CHASER + if (type == ENERGY_CHASER || type == CHAOS_CHASER || type == MINI_CHAOS_CHASER || type == IGNITION_CHARGE - || worldObj.isRemote) noClip = true; + || worldObj.isRemote) + noClip = true; dataWatcher.addObject(10, (byte) type); } @@ -190,8 +189,7 @@ public class EntityDragonProjectile extends Entity { switch (type) { case FIREBOMB: - if (genericHit - || (targetDistance > lastTickTargetDistance && targetDistance < power) + if (genericHit || (targetDistance > lastTickTargetDistance && targetDistance < power) || isCollided || ticksExisted > 600 || heath <= 0) { @@ -206,20 +204,16 @@ public class EntityDragonProjectile extends Entity { Entity hit = entityHit != null ? entityHit : target; if (!(hit instanceof EntityPlayer)) break; int r = rand.nextInt(); - if (shooter != null) - new Teleporter.TeleportLocation( - shooter.posX + (Math.cos(r) * 600), - rand.nextInt(255), - shooter.posZ + (Math.sin(r) * 600), - hit.dimension) - .sendEntityToCoords(hit); - else - new Teleporter.TeleportLocation( - posX + (Math.cos(r) * 600), - rand.nextInt(255), - posZ + (Math.sin(r) * 600), - hit.dimension) - .sendEntityToCoords(hit); + if (shooter != null) new Teleporter.TeleportLocation( + shooter.posX + (Math.cos(r) * 600), + rand.nextInt(255), + shooter.posZ + (Math.sin(r) * 600), + hit.dimension).sendEntityToCoords(hit); + else new Teleporter.TeleportLocation( + posX + (Math.cos(r) * 600), + rand.nextInt(255), + posZ + (Math.sin(r) * 600), + hit.dimension).sendEntityToCoords(hit); hit.attackEntityFrom(DamageSource.fall, 10F); @@ -227,8 +221,7 @@ public class EntityDragonProjectile extends Entity { break; case FIRE_CHASER: noClip = ticksExisted < 60; - if (genericHit - || (targetDistance > lastTickTargetDistance && targetDistance < power / 2) + if (genericHit || (targetDistance > lastTickTargetDistance && targetDistance < power / 2) || (isCollided && ticksExisted > 60) || ticksExisted > 400 || heath <= 0) { @@ -238,8 +231,7 @@ public class EntityDragonProjectile extends Entity { } break; case ENERGY_CHASER: - if (genericHit - || (targetDistance > lastTickTargetDistance && targetDistance < power) + if (genericHit || (targetDistance > lastTickTargetDistance && targetDistance < power) || ticksExisted > 800 || heath <= 0) { setDead(); @@ -257,8 +249,7 @@ public class EntityDragonProjectile extends Entity { } break; case CHAOS_CHASER: - if (genericHit - || (targetDistance > lastTickTargetDistance && targetDistance < power) + if (genericHit || (targetDistance > lastTickTargetDistance && targetDistance < power) || ticksExisted > 800 || heath <= 0) { setDead(); @@ -276,7 +267,9 @@ public class EntityDragonProjectile extends Entity { int i = 3 + rand.nextInt(3); EntityDragonProjectile newProjectile; List list = worldObj.getEntitiesWithinAABBExcludingEntity( - shooter, boundingBox.expand(60, 60, 60), Utills.selectPlayer); + shooter, + boundingBox.expand(60, 60, 60), + Utills.selectPlayer); for (i = +0; i > 0; i--) { newProjectile = new EntityDragonProjectile( worldObj, @@ -296,11 +289,9 @@ public class EntityDragonProjectile extends Entity { break; case MINI_CHAOS_CHASER: - if ((genericHit - || (targetDistance > lastTickTargetDistance && targetDistance < power) - || ticksExisted > 800 - || heath <= 0) - && ticksExisted > 5) { + if ((genericHit || (targetDistance > lastTickTargetDistance && targetDistance < power) + || ticksExisted > 800 + || heath <= 0) && ticksExisted > 5) { setDead(); DraconicEvolution.network.sendToAllAround( new GenericParticlePacket(GenericParticlePacket.CHAOS_BALL_KILL, posX, posY, posZ), @@ -329,15 +320,13 @@ public class EntityDragonProjectile extends Entity { private Entity getHitEntity() { Vec3 vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); - Vec3 vec3 = - Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + Vec3 vec3 = Vec3 + .createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); Entity entityHit = null; List list = this.worldObj.getEntitiesWithinAABBExcludingEntity( this, - this.boundingBox - .addCoord(this.motionX, this.motionY, this.motionZ) - .expand(1.0D, 1.0D, 1.0D)); + this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); double d0 = 0.0D; int i; float f1; @@ -375,15 +364,13 @@ public class EntityDragonProjectile extends Entity { entityLivingBase.hurtResistantTime = 0; entityLivingBase.attackEntityFrom( source, - damage - / (float) (Utills.getDistanceAtoB( - entityLivingBase.posX, - entityLivingBase.posY, - entityLivingBase.posZ, - posX, - posY, - posZ) - / radius)); + damage / (float) (Utills.getDistanceAtoB( + entityLivingBase.posX, + entityLivingBase.posY, + entityLivingBase.posZ, + posX, + posY, + posZ) / radius)); if (source == damageChaos && entityLivingBase instanceof EntityPlayer) { for (ItemStack stack : ((EntityPlayer) entityLivingBase).inventory.armorInventory) { if (stack != null && stack.getItem() instanceof IEnergyContainerItem) { @@ -399,9 +386,9 @@ public class EntityDragonProjectile extends Entity { public boolean attackEntityFrom(DamageSource source, float dmg) { if (heath <= 0) return false; if ((source.getEntity() instanceof EntityPlayer || source.getEntity() instanceof EntityArrow) - && ticksExisted > 5) heath -= dmg; - if (source.getSourceOfDamage() instanceof EntityArrow) - source.getSourceOfDamage().setDead(); + && ticksExisted > 5) + heath -= dmg; + if (source.getSourceOfDamage() instanceof EntityArrow) source.getSourceOfDamage().setDead(); if (heath <= 0) { worldObj.newExplosion(this, this.posX, this.posY, this.posZ, 2F, false, false); @@ -466,8 +453,7 @@ public class EntityDragonProjectile extends Entity { type = compound.getInteger("Type"); if (!worldObj.isRemote) dataWatcher.updateObject(10, (byte) type); noClip = type == ENERGY_CHASER || type == CHAOS_CHASER || type == MINI_CHAOS_CHASER || type == IGNITION_CHARGE; - isChaser = type == FIRE_CHASER - || type == ENERGY_CHASER + isChaser = type == FIRE_CHASER || type == ENERGY_CHASER || type == CHAOS_CHASER || type == MINI_CHAOS_CHASER || type == IGNITION_CHARGE; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityEnderArrow.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityEnderArrow.java index 568b5ca1..97470c11 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityEnderArrow.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityEnderArrow.java @@ -1,9 +1,7 @@ package com.brandon3055.draconicevolution.common.entity; -import com.brandon3055.brandonscore.common.utills.Utills; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.List; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; @@ -16,7 +14,13 @@ import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.EnderTeleportEvent; +import com.brandon3055.brandonscore.common.utills.Utills; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class EntityEnderArrow extends EntityDraconicArrow { + private int field_145791_d = -1; private int field_145792_e = -1; private int field_145789_f = -1; @@ -42,12 +46,8 @@ public class EntityEnderArrow extends EntityDraconicArrow { super(p_i1754_1_, p_i1754_2_, p_i1754_4_, p_i1754_6_); } - public EntityEnderArrow( - World p_i1755_1_, - EntityLivingBase p_i1755_2_, - EntityLivingBase p_i1755_3_, - float p_i1755_4_, - float p_i1755_5_) { + public EntityEnderArrow(World p_i1755_1_, EntityLivingBase p_i1755_2_, EntityLivingBase p_i1755_3_, + float p_i1755_4_, float p_i1755_5_) { super(p_i1755_1_, p_i1755_2_, p_i1755_3_, p_i1755_4_, p_i1755_5_); } @@ -109,21 +109,20 @@ public class EntityEnderArrow extends EntityDraconicArrow { @Override public void onUpdate() { - for (int i = 0; i < 10; i++) - this.worldObj.spawnParticle( - "portal", - this.posX + (this.rand.nextDouble() - 0.5D) * (double) this.width, - this.posY + this.rand.nextDouble() * (double) this.height - 0.25D, - this.posZ + (this.rand.nextDouble() - 0.5D) * (double) this.width, - (this.rand.nextDouble() - 0.5D) * 2.0D, - -this.rand.nextDouble(), - (this.rand.nextDouble() - 0.5D) * 2.0D); + for (int i = 0; i < 10; i++) this.worldObj.spawnParticle( + "portal", + this.posX + (this.rand.nextDouble() - 0.5D) * (double) this.width, + this.posY + this.rand.nextDouble() * (double) this.height - 0.25D, + this.posZ + (this.rand.nextDouble() - 0.5D) * (double) this.width, + (this.rand.nextDouble() - 0.5D) * 2.0D, + -this.rand.nextDouble(), + (this.rand.nextDouble() - 0.5D) * 2.0D); super.onEntityUpdate(); if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); - this.prevRotationYaw = - this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); + this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D + / Math.PI); this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(this.motionY, f) * 180.0D / Math.PI); } @@ -132,9 +131,15 @@ public class EntityEnderArrow extends EntityDraconicArrow { if (block.getMaterial() != Material.air) { onImpact(null); block.setBlockBoundsBasedOnState( - this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f); + this.worldObj, + this.field_145791_d, + this.field_145792_e, + this.field_145789_f); AxisAlignedBB axisalignedbb = block.getCollisionBoundingBoxFromPool( - this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f); + this.worldObj, + this.field_145791_d, + this.field_145792_e, + this.field_145789_f); if (axisalignedbb != null && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ))) { @@ -151,12 +156,12 @@ public class EntityEnderArrow extends EntityDraconicArrow { } else { ++this.ticksInAir; Vec3 vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); - Vec3 vec3 = Vec3.createVectorHelper( - this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + Vec3 vec3 = Vec3 + .createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec31, vec3, false, true, false); vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); - vec3 = Vec3.createVectorHelper( - this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + vec3 = Vec3 + .createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); if (movingobjectposition != null) { vec3 = Vec3.createVectorHelper( @@ -168,9 +173,7 @@ public class EntityEnderArrow extends EntityDraconicArrow { Entity entity = null; List list = this.worldObj.getEntitiesWithinAABBExcludingEntity( this, - this.boundingBox - .addCoord(this.motionX, this.motionY, this.motionZ) - .expand(1.0D, 1.0D, 1.0D)); + this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); double d0 = 0.0D; int i; float f1; @@ -200,14 +203,12 @@ public class EntityEnderArrow extends EntityDraconicArrow { movingobjectposition = new MovingObjectPosition(entity); } - if (movingobjectposition != null - && movingobjectposition.entityHit != null + if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer) { EntityPlayer entityplayer = (EntityPlayer) movingobjectposition.entityHit; - if (entityplayer.capabilities.disableDamage - || this.shootingEntity instanceof EntityPlayer - && !((EntityPlayer) this.shootingEntity).canAttackPlayer(entityplayer)) { + if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer + && !((EntityPlayer) this.shootingEntity).canAttackPlayer(entityplayer)) { movingobjectposition = null; } } @@ -216,92 +217,92 @@ public class EntityEnderArrow extends EntityDraconicArrow { float f4; if (movingobjectposition != null) { - // if (movingobjectposition.entityHit != null && movingobjectposition.entityHit != shootingEntity) { - // onImpact(movingobjectposition.entityHit); - // int k; - // if (!ignorSpeed) { - // f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + + // if (movingobjectposition.entityHit != null && movingobjectposition.entityHit != shootingEntity) { + // onImpact(movingobjectposition.entityHit); + // int k; + // if (!ignorSpeed) { + // f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + // this.motionZ * this.motionZ); - // k = MathHelper.ceiling_double_int(f2 * this.damage); + // k = MathHelper.ceiling_double_int(f2 * this.damage); // - // if (this.getIsCritical()) { - // k += this.rand.nextInt(k / 2 + 2); - // } - // } else { - // k = (int) this.damage; - // if (this.getIsCritical()) { - // k += this.rand.nextInt(k / 2 + 2); - // } - // } + // if (this.getIsCritical()) { + // k += this.rand.nextInt(k / 2 + 2); + // } + // } else { + // k = (int) this.damage; + // if (this.getIsCritical()) { + // k += this.rand.nextInt(k / 2 + 2); + // } + // } // - // DamageSource damagesource = null; + // DamageSource damagesource = null; // - // if (this.shootingEntity == null) { - // damagesource = DamageSource.causeArrowDamage(this, this); - // } else { - // damagesource = DamageSource.causeArrowDamage(this, this.shootingEntity); - // } - // if (movingobjectposition.entityHit instanceof EntityEnderman) - // damagesource = DamageSource.magic; + // if (this.shootingEntity == null) { + // damagesource = DamageSource.causeArrowDamage(this, this); + // } else { + // damagesource = DamageSource.causeArrowDamage(this, this.shootingEntity); + // } + // if (movingobjectposition.entityHit instanceof EntityEnderman) + // damagesource = DamageSource.magic; // - // if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman)) { - // movingobjectposition.entityHit.setFire(5); - // } + // if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman)) { + // movingobjectposition.entityHit.setFire(5); + // } // - // movingobjectposition.entityHit.hurtResistantTime = 0; + // movingobjectposition.entityHit.hurtResistantTime = 0; // - // if (movingobjectposition.entityHit.attackEntityFrom(damagesource, k)) { - // if (movingobjectposition.entityHit instanceof EntityLivingBase) { - // EntityLivingBase entitylivingbase = (EntityLivingBase) movingobjectposition.entityHit; + // if (movingobjectposition.entityHit.attackEntityFrom(damagesource, k)) { + // if (movingobjectposition.entityHit instanceof EntityLivingBase) { + // EntityLivingBase entitylivingbase = (EntityLivingBase) movingobjectposition.entityHit; // - // if (!this.worldObj.isRemote) { - // entitylivingbase.setArrowCountInEntity(entitylivingbase.getArrowCountInEntity() + 1); - // } + // if (!this.worldObj.isRemote) { + // entitylivingbase.setArrowCountInEntity(entitylivingbase.getArrowCountInEntity() + 1); + // } // - // if (this.knockbackStrength > 0) { - // f4 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + // if (this.knockbackStrength > 0) { + // f4 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); // - // if (f4 > 0.0F) { - // movingobjectposition.entityHit.addVelocity(this.motionX * this.knockbackStrength * + // if (f4 > 0.0F) { + // movingobjectposition.entityHit.addVelocity(this.motionX * this.knockbackStrength * // 0.6000000238418579D / f4, 0.1D, this.motionZ * this.knockbackStrength * 0.6000000238418579D / f4); - // } - // } + // } + // } // - // if (this.shootingEntity != null && this.shootingEntity instanceof EntityLivingBase) { - // EnchantmentHelper.func_151384_a(entitylivingbase, this.shootingEntity); - // EnchantmentHelper.func_151385_b((EntityLivingBase) this.shootingEntity, entitylivingbase); - // } + // if (this.shootingEntity != null && this.shootingEntity instanceof EntityLivingBase) { + // EnchantmentHelper.func_151384_a(entitylivingbase, this.shootingEntity); + // EnchantmentHelper.func_151385_b((EntityLivingBase) this.shootingEntity, entitylivingbase); + // } // - // if (this.shootingEntity != null && movingobjectposition.entityHit != this.shootingEntity && + // if (this.shootingEntity != null && movingobjectposition.entityHit != this.shootingEntity && // movingobjectposition.entityHit instanceof EntityPlayer && this.shootingEntity instanceof // EntityPlayerMP) { - // ((EntityPlayerMP) this.shootingEntity).playerNetServerHandler.sendPacket(new + // ((EntityPlayerMP) this.shootingEntity).playerNetServerHandler.sendPacket(new // S2BPacketChangeGameState(6, 0.0F)); - // } - // } + // } + // } // - // this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); + // this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); // - // // if (!(movingobjectposition.entityHit instanceof EntityEnderman)) - // //{ - // this.setDead(); - // //} - // } else { - // this.motionX *= -0.10000000149011612D; - // this.motionY *= -0.10000000149011612D; - // this.motionZ *= -0.10000000149011612D; - // this.rotationYaw += 180.0F; - // this.prevRotationYaw += 180.0F; - // this.ticksInAir = 0; - // } - // } else + // // if (!(movingobjectposition.entityHit instanceof EntityEnderman)) + // //{ + // this.setDead(); + // //} + // } else { + // this.motionX *= -0.10000000149011612D; + // this.motionY *= -0.10000000149011612D; + // this.motionZ *= -0.10000000149011612D; + // this.rotationYaw += 180.0F; + // this.prevRotationYaw += 180.0F; + // this.ticksInAir = 0; + // } + // } else if (movingobjectposition.entityHit == null) { this.field_145791_d = movingobjectposition.blockX; this.field_145792_e = movingobjectposition.blockY; this.field_145789_f = movingobjectposition.blockZ; this.field_145790_g = block; - this.inData = this.worldObj.getBlockMetadata( - this.field_145791_d, this.field_145792_e, this.field_145789_f); + this.inData = this.worldObj + .getBlockMetadata(this.field_145791_d, this.field_145792_e, this.field_145789_f); this.motionX = ((float) (movingobjectposition.hitVec.xCoord - this.posX)); this.motionY = ((float) (movingobjectposition.hitVec.yCoord - this.posY)); this.motionZ = ((float) (movingobjectposition.hitVec.zCoord - this.posZ)); @@ -317,7 +318,11 @@ public class EntityEnderArrow extends EntityDraconicArrow { if (this.field_145790_g.getMaterial() != Material.air) { this.field_145790_g.onEntityCollidedWithBlock( - this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f, this); + this.worldObj, + this.field_145791_d, + this.field_145792_e, + this.field_145789_f, + this); } } } @@ -328,9 +333,8 @@ public class EntityEnderArrow extends EntityDraconicArrow { f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); - for (this.rotationPitch = (float) (Math.atan2(this.motionY, f2) * 180.0D / Math.PI); - this.rotationPitch - this.prevRotationPitch < -180.0F; - this.prevRotationPitch -= 360.0F) { + for (this.rotationPitch = (float) (Math.atan2(this.motionY, f2) * 180.0D / Math.PI); this.rotationPitch + - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) { ; } @@ -457,8 +461,12 @@ public class EntityEnderArrow extends EntityDraconicArrow { double travelDist = Utills.getDistanceAtoB(startX, startY, startZ, x, y, z); float travelDmg = (float) (travelDist / 5D); - EnderTeleportEvent event = - new EnderTeleportEvent(entityplayermp, x + 0.5, y + 0.5, z + 0.5, travelDmg); + EnderTeleportEvent event = new EnderTeleportEvent( + entityplayermp, + x + 0.5, + y + 0.5, + z + 0.5, + travelDmg); if (!MinecraftForge.EVENT_BUS.post(event)) { if (this.shootingEntity.isRiding()) { shootingEntity.mountEntity((Entity) null); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityPersistentItem.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityPersistentItem.java index dba6f61f..b6ccfdfd 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityPersistentItem.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityPersistentItem.java @@ -1,6 +1,5 @@ package com.brandon3055.draconicevolution.common.entity; -import com.brandon3055.draconicevolution.common.items.DragonHeart; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; @@ -12,10 +11,13 @@ import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.item.ItemExpireEvent; +import com.brandon3055.draconicevolution.common.items.DragonHeart; + /** * Created by Brandon on 15/08/2014. */ public class EntityPersistentItem extends EntityItem { + public EntityPersistentItem(World par1World, double par2, double par4, double par6) { super(par1World, par2, par4, par6); this.isImmuneToFire = true; @@ -47,8 +49,7 @@ public class EntityPersistentItem extends EntityItem { @Override public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) { - if (getEntityItem().getItem() instanceof DragonHeart - && par1DamageSource.isExplosion() + if (getEntityItem().getItem() instanceof DragonHeart && par1DamageSource.isExplosion() && par2 > 10f && !this.isDead) { worldObj.spawnEntityInWorld(new EntityDragonHeart(worldObj, posX, posY, posZ)); @@ -75,10 +76,10 @@ public class EntityPersistentItem extends EntityItem { if (age + 10 >= lifespan) age = 0; boolean flag2 = false; if (this.worldObj.getBlock( - MathHelper.floor_double(this.posX), - MathHelper.floor_double(this.posY - 1), - MathHelper.floor_double(this.posZ)) - == Blocks.end_portal) flag2 = true; + MathHelper.floor_double(this.posX), + MathHelper.floor_double(this.posY - 1), + MathHelper.floor_double(this.posZ)) == Blocks.end_portal) + flag2 = true; ItemStack stack = this.getDataWatcher().getWatchableObjectItemStack(10); if (stack != null && stack.getItem() != null) { if (stack.getItem().onEntityItemUpdate(this)) { @@ -104,21 +105,17 @@ public class EntityPersistentItem extends EntityItem { motionY = 0; motionZ = 0; } - this.noClip = - this.func_145771_j(this.posX, (this.boundingBox.minY + this.boundingBox.maxY) / 2.0D, this.posZ); + this.noClip = this + .func_145771_j(this.posX, (this.boundingBox.minY + this.boundingBox.maxY) / 2.0D, this.posZ); this.moveEntity(this.motionX, this.motionY, this.motionZ); - boolean flag = (int) this.prevPosX != (int) this.posX - || (int) this.prevPosY != (int) this.posY + boolean flag = (int) this.prevPosX != (int) this.posX || (int) this.prevPosY != (int) this.posY || (int) this.prevPosZ != (int) this.posZ; if (flag || this.ticksExisted % 25 == 0) { - if (this.worldObj - .getBlock( - MathHelper.floor_double(this.posX), - MathHelper.floor_double(this.posY), - MathHelper.floor_double(this.posZ)) - .getMaterial() - == Material.lava) { + if (this.worldObj.getBlock( + MathHelper.floor_double(this.posX), + MathHelper.floor_double(this.posY), + MathHelper.floor_double(this.posZ)).getMaterial() == Material.lava) { this.motionY = 0.20000000298023224D; this.motionX = (double) ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F); this.motionZ = (double) ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F); @@ -130,11 +127,9 @@ public class EntityPersistentItem extends EntityItem { if (this.onGround) { f = this.worldObj.getBlock( - MathHelper.floor_double(this.posX), - MathHelper.floor_double(this.boundingBox.minY) - 1, - MathHelper.floor_double(this.posZ)) - .slipperiness - * 0.98F; + MathHelper.floor_double(this.posX), + MathHelper.floor_double(this.boundingBox.minY) - 1, + MathHelper.floor_double(this.posZ)).slipperiness * 0.98F; } this.motionX *= (double) f; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/ExtendedPlayer.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/ExtendedPlayer.java index 8ef98489..e2e4e475 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/ExtendedPlayer.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/ExtendedPlayer.java @@ -22,16 +22,16 @@ public class ExtendedPlayer implements IExtendedEntityProperties { } /** - * Used to register these extended properties for the player during EntityConstructing event - * This method is for convenience only; it will make your code look nicer + * Used to register these extended properties for the player during EntityConstructing event This method is for + * convenience only; it will make your code look nicer */ public static void register(EntityPlayer player) { player.registerExtendedProperties(ExtendedPlayer.EXT_PROP_NAME, new ExtendedPlayer(player)); } /** - * Returns ExtendedPlayer properties for player - * This method is for convenience only; it will make your code look nicer + * Returns ExtendedPlayer properties for player This method is for convenience only; it will make your code look + * nicer */ public static ExtendedPlayer get(EntityPlayer player) { return (ExtendedPlayer) player.getExtendedProperties(EXT_PROP_NAME); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/handler/BalanceConfigHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/handler/BalanceConfigHandler.java index b347e397..4bce1c1c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/handler/BalanceConfigHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/handler/BalanceConfigHandler.java @@ -1,16 +1,19 @@ package com.brandon3055.draconicevolution.common.handler; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.utills.IUpgradableItem.EnumUpgrade; -import cpw.mods.fml.common.registry.GameRegistry; import java.io.File; + import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; import net.minecraft.init.Blocks; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.utills.IUpgradableItem.EnumUpgrade; +import cpw.mods.fml.common.registry.GameRegistry; + public class BalanceConfigHandler { + public static final int wyvernArmorMinShieldRecovery = 5; public static final int draconicArmorMinShieldRecovery = 5; public static final int wyvernToolsMinDigAOEUpgradePoints = 1; @@ -170,36 +173,47 @@ public class BalanceConfigHandler { config.load(); config.setCategoryRequiresMcRestart("tweaks", true); config.setCategoryComment( - "tweaks.armor", "Values in this category may be replaced automatically to prevent problems"); + "tweaks.armor", + "Values in this category may be replaced automatically to prevent problems"); config.setCategoryComment( - "tweaks.tools", "Values in this category may be replaced automatically to prevent problems"); + "tweaks.tools", + "Values in this category may be replaced automatically to prevent problems"); config.setCategoryComment( - "tweaks.weapons", "Values in this category may be replaced automatically to prevent problems"); + "tweaks.weapons", + "Values in this category may be replaced automatically to prevent problems"); syncConfig(); } } private static void syncConfig() { - wyvernArmorBaseStorage = - getInteger("energy.armor", "Wyvern Armor: Base energy storage (RF)", wyvernArmorBaseStorage); + wyvernArmorBaseStorage = getInteger( + "energy.armor", + "Wyvern Armor: Base energy storage (RF)", + wyvernArmorBaseStorage); wyvernArmorStoragePerUpgrade = getInteger( "energy.armor", "Wyvern Armor: Additional energy storage per upgrade installed (RF)", wyvernArmorStoragePerUpgrade); - wyvernArmorMaxTransfer = - getInteger("energy.armor", "Wyvern Armor: Maximum energy transfer rate (RF/t)", wyvernArmorMaxTransfer); + wyvernArmorMaxTransfer = getInteger( + "energy.armor", + "Wyvern Armor: Maximum energy transfer rate (RF/t)", + wyvernArmorMaxTransfer); wyvernArmorEnergyPerProtectionPoint = getInteger( "energy.armor", "Wyvern Armor: Amount of energy required to restore protection point (RF)", wyvernArmorEnergyPerProtectionPoint); - draconicArmorBaseStorage = - getInteger("energy.armor", "Draconic Armor: Base energy storage (RF)", draconicArmorBaseStorage); + draconicArmorBaseStorage = getInteger( + "energy.armor", + "Draconic Armor: Base energy storage (RF)", + draconicArmorBaseStorage); draconicArmorStoragePerUpgrade = getInteger( "energy.armor", "Draconic Armor: Additional energy storage per upgrade installed (RF)", draconicArmorStoragePerUpgrade); draconicArmorMaxTransfer = getInteger( - "energy.armor", "Draconic Armor: Maximum energy transfer rate (RF/t)", draconicArmorMaxTransfer); + "energy.armor", + "Draconic Armor: Maximum energy transfer rate (RF/t)", + draconicArmorMaxTransfer); draconicArmorEnergyPerProtectionPoint = getInteger( "energy.armor", "Draconic Armor: Amount of energy required to restore protection point (RF)", @@ -208,32 +222,42 @@ public class BalanceConfigHandler { "energy.armor", "Draconic Armor: Amount of energy required to remove negative effects (RF)", draconicArmorEnergyToRemoveEffects); - wyvernToolsBaseStorage = - getInteger("energy.tools", "Wyvern Tools: Base energy storage (RF)", wyvernToolsBaseStorage); + wyvernToolsBaseStorage = getInteger( + "energy.tools", + "Wyvern Tools: Base energy storage (RF)", + wyvernToolsBaseStorage); wyvernToolsStoragePerUpgrade = getInteger( "energy.tools", "Wyvern Tools: Additional energy storage per upgrade installed (RF)", wyvernToolsStoragePerUpgrade); - wyvernToolsMaxTransfer = - getInteger("energy.tools", "Wyvern Tools: Maximum energy transfer rate (RF/t)", wyvernToolsMaxTransfer); + wyvernToolsMaxTransfer = getInteger( + "energy.tools", + "Wyvern Tools: Maximum energy transfer rate (RF/t)", + wyvernToolsMaxTransfer); wyvernToolsEnergyPerAction = getInteger( "energy.tools", "Wyvern Tools: Amount of energy required to perform action (RF)", wyvernToolsEnergyPerAction); - draconicToolsBaseStorage = - getInteger("energy.tools", "Draconic Tools: Base energy storage (RF)", draconicToolsBaseStorage); + draconicToolsBaseStorage = getInteger( + "energy.tools", + "Draconic Tools: Base energy storage (RF)", + draconicToolsBaseStorage); draconicToolsStoragePerUpgrade = getInteger( "energy.tools", "Draconic Tools: Additional energy storage per upgrade installed (RF)", draconicToolsStoragePerUpgrade); draconicToolsMaxTransfer = getInteger( - "energy.tools", "Draconic Tools: Maximum energy transfer rate (RF/t)", draconicToolsMaxTransfer); + "energy.tools", + "Draconic Tools: Maximum energy transfer rate (RF/t)", + draconicToolsMaxTransfer); draconicToolsEnergyPerAction = getInteger( "energy.tools", "Draconic Tools: Amount of energy required to perform action (RF)", draconicToolsEnergyPerAction); wyvernCapacitorBaseStorage = getInteger( - "energy.tools", "Wyvern Flux Capacitor: Base energy storage (RF)", wyvernCapacitorBaseStorage); + "energy.tools", + "Wyvern Flux Capacitor: Base energy storage (RF)", + wyvernCapacitorBaseStorage); wyvernCapacitorStoragePerUpgrade = getInteger( "energy.tools", "Wyvern Flux Capacitor: Additional energy storage per upgrade installed (RF)", @@ -247,7 +271,9 @@ public class BalanceConfigHandler { "Wyvern Flux Capacitor: Maximum energy extraction rate (RF/t)", wyvernCapacitorMaxExtract); draconicCapacitorBaseStorage = getInteger( - "energy.tools", "Draconic Flux Capacitor: Base energy storage (RF)", draconicCapacitorBaseStorage); + "energy.tools", + "Draconic Flux Capacitor: Base energy storage (RF)", + draconicCapacitorBaseStorage); draconicCapacitorStoragePerUpgrade = getInteger( "energy.tools", "Draconic Flux Capacitor: Additional energy storage per upgrade installed (RF)", @@ -260,46 +286,66 @@ public class BalanceConfigHandler { "energy.tools", "Draconic Flux Capacitor: Maximum energy extraction rate (RF/t)", draconicCapacitorMaxExtract); - wyvernWeaponsBaseStorage = - getInteger("energy.weapons", "Wyvern Weapons: Base energy storage (RF)", wyvernWeaponsBaseStorage); + wyvernWeaponsBaseStorage = getInteger( + "energy.weapons", + "Wyvern Weapons: Base energy storage (RF)", + wyvernWeaponsBaseStorage); wyvernWeaponsStoragePerUpgrade = getInteger( "energy.weapons", "Wyvern Weapons: Additional energy storage per upgrade installed (RF)", wyvernWeaponsStoragePerUpgrade); wyvernWeaponsMaxTransfer = getInteger( - "energy.weapons", "Wyvern Weapons: Maximum energy transfer rate (RF/t)", wyvernWeaponsMaxTransfer); + "energy.weapons", + "Wyvern Weapons: Maximum energy transfer rate (RF/t)", + wyvernWeaponsMaxTransfer); wyvernWeaponsEnergyPerAttack = getInteger( "energy.weapons", "Wyvern Weapons: Amount of energy required to perform attack (RF)", wyvernWeaponsEnergyPerAttack); wyvernBowEnergyPerShot = getInteger( - "energy.weapons", "Wyvern Bow: Amount of energy required to shoot (RF)", wyvernBowEnergyPerShot); - draconicWeaponsBaseStorage = - getInteger("energy.weapons", "Draconic Weapons: Base energy storage (RF)", draconicWeaponsBaseStorage); + "energy.weapons", + "Wyvern Bow: Amount of energy required to shoot (RF)", + wyvernBowEnergyPerShot); + draconicWeaponsBaseStorage = getInteger( + "energy.weapons", + "Draconic Weapons: Base energy storage (RF)", + draconicWeaponsBaseStorage); draconicWeaponsStoragePerUpgrade = getInteger( "energy.weapons", "Draconic Weapons: Additional energy storage per upgrade installed (RF)", draconicWeaponsStoragePerUpgrade); draconicWeaponsMaxTransfer = getInteger( - "energy.weapons", "Draconic Weapons: Maximum energy transfer rate (RF/t)", draconicWeaponsMaxTransfer); + "energy.weapons", + "Draconic Weapons: Maximum energy transfer rate (RF/t)", + draconicWeaponsMaxTransfer); draconicWeaponsEnergyPerAttack = getInteger( "energy.weapons", "Draconic Weapons: Amount of energy required to perform attack (RF)", draconicWeaponsEnergyPerAttack); draconicBowEnergyPerShot = getInteger( - "energy.weapons", "Draconic Bow: Amount of energy required to shoot (RF)", draconicBowEnergyPerShot); + "energy.weapons", + "Draconic Bow: Amount of energy required to shoot (RF)", + draconicBowEnergyPerShot); draconicFireEnergyCostMultiptier = getInteger( - "energy.weapons", "Arrow of Draconic Fire: Energy cost multiplier", draconicFireEnergyCostMultiptier); + "energy.weapons", + "Arrow of Draconic Fire: Energy cost multiplier", + draconicFireEnergyCostMultiptier); draconiumBlockEnergyToChange = getInteger( "energy.misc", "Draconium Block: Amount of energy required to charge (RF)", draconiumBlockEnergyToChange); draconiumBlockChargingSpeed = getInteger( - "energy.misc", "Draconium Block: Maximum charging speed (RF/t)", draconiumBlockChargingSpeed); - energyInfuserStorage = - getInteger("energy.machines", "Energy Infuser: Energy buffer size (RF)", energyInfuserStorage); + "energy.misc", + "Draconium Block: Maximum charging speed (RF/t)", + draconiumBlockChargingSpeed); + energyInfuserStorage = getInteger( + "energy.machines", + "Energy Infuser: Energy buffer size (RF)", + energyInfuserStorage); energyInfuserMaxTransfer = getInteger( - "energy.machines", "Energy Infuser: Maximum energy transfer rate (RF/t)", energyInfuserMaxTransfer); + "energy.machines", + "Energy Infuser: Maximum energy transfer rate (RF/t)", + energyInfuserMaxTransfer); energyStorageTier1Storage = getLong( "energy.machines", "Multiblock Energy Storage Tier 1: Energy buffer size (RF)", @@ -329,31 +375,49 @@ public class BalanceConfigHandler { "Multiblock Energy Storage Tier 7: Energy buffer size (RF)", energyStorageTier7Storage); grinderInternalEnergyBufferSize = getInteger( - "energy.machines", "Mob Grinder: Internal energy buffer size (RF)", grinderInternalEnergyBufferSize); + "energy.machines", + "Mob Grinder: Internal energy buffer size (RF)", + grinderInternalEnergyBufferSize); grinderExternalEnergyBufferSize = getInteger( - "energy.machines", "Mob Grinder: Main energy buffer size (RF)", grinderExternalEnergyBufferSize); - grinderMaxReceive = - getInteger("energy.machines", "Mob Grinder: Maximum energy reception rate (RF/t)", grinderMaxReceive); + "energy.machines", + "Mob Grinder: Main energy buffer size (RF)", + grinderExternalEnergyBufferSize); + grinderMaxReceive = getInteger( + "energy.machines", + "Mob Grinder: Maximum energy reception rate (RF/t)", + grinderMaxReceive); grinderEnergyPerKill = getInteger( - "energy.machines", "Mob Grinder: Amount of energy required to kill entity (RF)", grinderEnergyPerKill); - energyRelayBasicStorage = - getInteger("energy.machines", "Energy Relay: Energy buffer size (RF)", energyRelayBasicStorage); + "energy.machines", + "Mob Grinder: Amount of energy required to kill entity (RF)", + grinderEnergyPerKill); + energyRelayBasicStorage = getInteger( + "energy.machines", + "Energy Relay: Energy buffer size (RF)", + energyRelayBasicStorage); energyRelayAdvancedStorage = getInteger( - "energy.machines", "Advanced Energy Relay: Energy buffer size (RF)", energyRelayAdvancedStorage); + "energy.machines", + "Advanced Energy Relay: Energy buffer size (RF)", + energyRelayAdvancedStorage); energyRelayBasicMaxReceive = getInteger( - "energy.machines", "Energy Relay: Maximum energy reception rate (RF/t)", energyRelayBasicMaxReceive); + "energy.machines", + "Energy Relay: Maximum energy reception rate (RF/t)", + energyRelayBasicMaxReceive); energyRelayAdvancedMaxReceive = getInteger( "energy.machines", "Advanced Energy Relay: Maximum energy reception rate (RF/t)", energyRelayAdvancedMaxReceive); energyRelayBasicMaxExtract = getInteger( - "energy.machines", "Energy Relay: Maximum energy extraction rate (RF/t)", energyRelayBasicMaxExtract); + "energy.machines", + "Energy Relay: Maximum energy extraction rate (RF/t)", + energyRelayBasicMaxExtract); energyRelayAdvancedMaxExtract = getInteger( "energy.machines", "Advanced Energy Relay: Maximum energy extraction rate (RF/t)", energyRelayAdvancedMaxExtract); energyTransceiverBasicStorage = getInteger( - "energy.machines", "Energy Transceiver: Energy buffer size (RF)", energyTransceiverBasicStorage); + "energy.machines", + "Energy Transceiver: Energy buffer size (RF)", + energyTransceiverBasicStorage); energyTransceiverAdvancedStorage = getInteger( "energy.machines", "Advanced Energy Transceiver: Energy buffer size (RF)", @@ -406,33 +470,39 @@ public class BalanceConfigHandler { "energy.machines", "Advanced Wireless Energy Transceiver: Maximum energy " + "sending rate for each linked device (RF/t)", energyWirelessTransceiverAdvancedMaxSend); - wyvernArmorMaxCapacityUpgradePoints = (int) Math.floor((double) (Integer.MAX_VALUE - wyvernArmorBaseStorage) + wyvernArmorMaxCapacityUpgradePoints = (int) Math.floor( + (double) (Integer.MAX_VALUE - wyvernArmorBaseStorage) / (double) Math.max(wyvernArmorStoragePerUpgrade, 1)) * EnumUpgrade.RF_CAPACITY.pointConversion; - wyvernArmorMaxUpgrades = - getInteger("tweaks.armor", "Wyvern Armor: Maximum amount of upgrades", wyvernArmorMaxUpgrades); + wyvernArmorMaxUpgrades = getInteger( + "tweaks.armor", + "Wyvern Armor: Maximum amount of upgrades", + wyvernArmorMaxUpgrades); wyvernArmorMaxUpgradePoints = getInteger( "tweaks.armor", "Wyvern Armor: Maximum amount of upgrade points", wyvernArmorMaxUpgradePoints, wyvernArmorMaxUpgrades, Integer.MAX_VALUE); - wyvernArmorMaxCapacityUpgradePoints = - Math.max(Math.min(wyvernArmorMaxUpgradePoints, wyvernArmorMaxCapacityUpgradePoints), 0); - draconicArmorMaxCapacityUpgradePoints = (int) Math.floor((double) (Integer.MAX_VALUE - draconicArmorBaseStorage) - / Math.max(draconicArmorStoragePerUpgrade, 1)) + wyvernArmorMaxCapacityUpgradePoints = Math + .max(Math.min(wyvernArmorMaxUpgradePoints, wyvernArmorMaxCapacityUpgradePoints), 0); + draconicArmorMaxCapacityUpgradePoints = (int) Math.floor( + (double) (Integer.MAX_VALUE - draconicArmorBaseStorage) / Math.max(draconicArmorStoragePerUpgrade, 1)) * EnumUpgrade.RF_CAPACITY.pointConversion; - draconicArmorMaxUpgrades = - getInteger("tweaks.armor", "Draconic Armor: Maximum amount of upgrades", draconicArmorMaxUpgrades); + draconicArmorMaxUpgrades = getInteger( + "tweaks.armor", + "Draconic Armor: Maximum amount of upgrades", + draconicArmorMaxUpgrades); draconicArmorMaxUpgradePoints = getInteger( "tweaks.armor", "Draconic Armor: Maximum amount of upgrade points", draconicArmorMaxUpgradePoints, draconicArmorMaxUpgrades, Integer.MAX_VALUE); - draconicArmorMaxCapacityUpgradePoints = - Math.max(Math.min(draconicArmorMaxUpgradePoints, draconicArmorMaxCapacityUpgradePoints), 0); - wyvernToolsMaxCapacityUpgradePoints = (int) Math.floor((double) (Integer.MAX_VALUE - wyvernToolsBaseStorage) + draconicArmorMaxCapacityUpgradePoints = Math + .max(Math.min(draconicArmorMaxUpgradePoints, draconicArmorMaxCapacityUpgradePoints), 0); + wyvernToolsMaxCapacityUpgradePoints = (int) Math.floor( + (double) (Integer.MAX_VALUE - wyvernToolsBaseStorage) / (double) Math.max(wyvernToolsStoragePerUpgrade, 1)) * EnumUpgrade.RF_CAPACITY.pointConversion; wyvernToolsMaxUpgrades = getInteger( @@ -441,7 +511,7 @@ public class BalanceConfigHandler { wyvernToolsMaxUpgrades, 0, (wyvernToolsMaxDigAOEUpgradePoints - wyvernToolsMinDigAOEUpgradePoints) - * EnumUpgrade.DIG_AOE.pointConversion + * EnumUpgrade.DIG_AOE.pointConversion + (wyvernToolsMaxDigSpeedUpgradePoints - wyvernToolsMinDigSpeedUpgradePoints) * EnumUpgrade.DIG_SPEED.pointConversion + wyvernToolsMaxCapacityUpgradePoints); @@ -451,9 +521,10 @@ public class BalanceConfigHandler { wyvernToolsMaxUpgradePoints, wyvernToolsMaxUpgrades, Integer.MAX_VALUE); - wyvernToolsMaxCapacityUpgradePoints = - Math.max(Math.min(wyvernToolsMaxUpgradePoints, wyvernToolsMaxCapacityUpgradePoints), 0); - draconicToolsMaxCapacityUpgradePoints = (int) Math.floor((double) (Integer.MAX_VALUE - draconicToolsBaseStorage) + wyvernToolsMaxCapacityUpgradePoints = Math + .max(Math.min(wyvernToolsMaxUpgradePoints, wyvernToolsMaxCapacityUpgradePoints), 0); + draconicToolsMaxCapacityUpgradePoints = (int) Math.floor( + (double) (Integer.MAX_VALUE - draconicToolsBaseStorage) / (double) Math.max(draconicToolsStoragePerUpgrade, 1)) * EnumUpgrade.RF_CAPACITY.pointConversion; draconicToolsMaxUpgrades = getInteger( @@ -462,7 +533,7 @@ public class BalanceConfigHandler { draconicToolsMaxUpgrades, 0, (draconicToolsMaxDigAOEUpgradePoints - draconicToolsMinDigAOEUpgradePoints) - * EnumUpgrade.DIG_AOE.pointConversion + * EnumUpgrade.DIG_AOE.pointConversion + (draconicToolsMaxDigSpeedUpgradePoints - draconicToolsMinDigSpeedUpgradePoints) * EnumUpgrade.DIG_SPEED.pointConversion + (draconicToolsMaxDigDepthUpgradePoints - draconicToolsMinDigDepthUpgradePoints) @@ -474,9 +545,10 @@ public class BalanceConfigHandler { draconicToolsMaxUpgradePoints, draconicToolsMaxUpgrades, Integer.MAX_VALUE); - draconicToolsMaxCapacityUpgradePoints = - Math.max(Math.min(draconicToolsMaxUpgradePoints, draconicToolsMaxCapacityUpgradePoints), 0); - wyvernWeaponsMaxCapacityUpgradePoints = (int) Math.floor((double) (Integer.MAX_VALUE - wyvernWeaponsBaseStorage) + draconicToolsMaxCapacityUpgradePoints = Math + .max(Math.min(draconicToolsMaxUpgradePoints, draconicToolsMaxCapacityUpgradePoints), 0); + wyvernWeaponsMaxCapacityUpgradePoints = (int) Math.floor( + (double) (Integer.MAX_VALUE - wyvernWeaponsBaseStorage) / (double) Math.max(wyvernWeaponsStoragePerUpgrade, 1)) * EnumUpgrade.RF_CAPACITY.pointConversion; wyvernWeaponsMaxUpgrades = getInteger( @@ -485,7 +557,7 @@ public class BalanceConfigHandler { wyvernWeaponsMaxUpgrades, 0, (wyvernWeaponsMaxAttackAOEUpgradePoints - wyvernWeaponsMinAttackAOEUpgradePoints) - * EnumUpgrade.ATTACK_AOE.pointConversion + * EnumUpgrade.ATTACK_AOE.pointConversion + (wyvernWeaponsMaxAttackDamageUpgradePoints - wyvernWeaponsMinAttackDamageUpgradePoints) * EnumUpgrade.ATTACK_DAMAGE.pointConversion + wyvernWeaponsMaxCapacityUpgradePoints); @@ -495,19 +567,19 @@ public class BalanceConfigHandler { wyvernWeaponsMaxUpgradePoints, wyvernWeaponsMaxUpgrades, Integer.MAX_VALUE); - wyvernWeaponsMaxCapacityUpgradePoints = - Math.max(Math.min(wyvernWeaponsMaxUpgradePoints, wyvernWeaponsMaxCapacityUpgradePoints), 0); - draconicWeaponsMaxCapacityUpgradePoints = - (int) Math.floor((double) (Integer.MAX_VALUE - draconicWeaponsBaseStorage) - / (double) Math.max(draconicWeaponsStoragePerUpgrade, 1)) - * EnumUpgrade.RF_CAPACITY.pointConversion; + wyvernWeaponsMaxCapacityUpgradePoints = Math + .max(Math.min(wyvernWeaponsMaxUpgradePoints, wyvernWeaponsMaxCapacityUpgradePoints), 0); + draconicWeaponsMaxCapacityUpgradePoints = (int) Math.floor( + (double) (Integer.MAX_VALUE - draconicWeaponsBaseStorage) + / (double) Math.max(draconicWeaponsStoragePerUpgrade, 1)) + * EnumUpgrade.RF_CAPACITY.pointConversion; draconicWeaponsMaxUpgrades = getInteger( "tweaks.weapons", "Draconic Weapons: Maximum amount of upgrades", draconicWeaponsMaxUpgrades, 0, (draconicWeaponsMaxAttackAOEUpgradePoints - draconicWeaponsMinAttackAOEUpgradePoints) - * EnumUpgrade.ATTACK_AOE.pointConversion + * EnumUpgrade.ATTACK_AOE.pointConversion + (draconicWeaponsMaxAttackDamageUpgradePoints - draconicWeaponsMinAttackDamageUpgradePoints) * EnumUpgrade.ARROW_DAMAGE.pointConversion + draconicWeaponsMaxCapacityUpgradePoints); @@ -517,9 +589,10 @@ public class BalanceConfigHandler { draconicWeaponsMaxUpgradePoints, draconicWeaponsMaxUpgrades, Integer.MAX_VALUE); - draconicWeaponsMaxCapacityUpgradePoints = - Math.max(Math.min(draconicWeaponsMaxUpgradePoints, draconicWeaponsMaxCapacityUpgradePoints), 0); - wyvernBowMaxCapacityUpgradePoints = (int) Math.floor((double) (Integer.MAX_VALUE - wyvernWeaponsBaseStorage) + draconicWeaponsMaxCapacityUpgradePoints = Math + .max(Math.min(draconicWeaponsMaxUpgradePoints, draconicWeaponsMaxCapacityUpgradePoints), 0); + wyvernBowMaxCapacityUpgradePoints = (int) Math.floor( + (double) (Integer.MAX_VALUE - wyvernWeaponsBaseStorage) / (double) Math.max(wyvernWeaponsStoragePerUpgrade, 1)) * EnumUpgrade.RF_CAPACITY.pointConversion; wyvernBowMaxUpgrades = getInteger( @@ -528,7 +601,7 @@ public class BalanceConfigHandler { wyvernBowMaxUpgrades, 0, (wyvernBowMaxDrawSpeedUpgradePoints - wyvernBowMinDrawSpeedUpgradePoints) - * EnumUpgrade.DRAW_SPEED.pointConversion + * EnumUpgrade.DRAW_SPEED.pointConversion + (wyvernBowMaxArrowSpeedUpgradePoints - wyvernBowMinArrowSpeedUpgradePoints) * EnumUpgrade.ARROW_SPEED.pointConversion + (wyvernBowMaxArrowDamageUpgradePoints - wyvernBowMinArrowDamageUpgradePoints) @@ -540,9 +613,10 @@ public class BalanceConfigHandler { wyvernBowMaxUpgradePoints, wyvernBowMaxUpgrades, Integer.MAX_VALUE); - wyvernBowMaxCapacityUpgradePoints = - Math.max(Math.min(wyvernBowMaxUpgradePoints, wyvernBowMaxCapacityUpgradePoints), 0); - draconicBowMaxCapacityUpgradePoints = (int) Math.floor((double) (Integer.MAX_VALUE - draconicWeaponsBaseStorage) + wyvernBowMaxCapacityUpgradePoints = Math + .max(Math.min(wyvernBowMaxUpgradePoints, wyvernBowMaxCapacityUpgradePoints), 0); + draconicBowMaxCapacityUpgradePoints = (int) Math.floor( + (double) (Integer.MAX_VALUE - draconicWeaponsBaseStorage) / (double) Math.max(draconicWeaponsStoragePerUpgrade, 1)) * EnumUpgrade.RF_CAPACITY.pointConversion; draconicBowMaxUpgrades = getInteger( @@ -551,7 +625,7 @@ public class BalanceConfigHandler { draconicBowMaxUpgrades, 0, (draconicBowMaxDrawSpeedUpgradePoints - draconicBowMinDrawSpeedUpgradePoints) - * EnumUpgrade.DRAW_SPEED.pointConversion + * EnumUpgrade.DRAW_SPEED.pointConversion + (draconicBowMaxArrowSpeedUpgradePoints - draconicBowMinArrowSpeedUpgradePoints) * EnumUpgrade.ARROW_SPEED.pointConversion + (draconicBowMaxArrowDamageUpgradePoints - draconicBowMinArrowDamageUpgradePoints) @@ -563,20 +637,20 @@ public class BalanceConfigHandler { draconicBowMaxUpgradePoints, draconicBowMaxUpgrades, Integer.MAX_VALUE); - draconicBowMaxCapacityUpgradePoints = - Math.max(Math.min(draconicBowMaxUpgradePoints, draconicBowMaxCapacityUpgradePoints), 0); - draconicStaffMaxCapacityUpgradePoints = (int) Math.floor((double) - (Integer.MAX_VALUE - draconicToolsBaseStorage * 2 - draconicWeaponsBaseStorage) + draconicBowMaxCapacityUpgradePoints = Math + .max(Math.min(draconicBowMaxUpgradePoints, draconicBowMaxCapacityUpgradePoints), 0); + draconicStaffMaxCapacityUpgradePoints = (int) Math.floor( + (double) (Integer.MAX_VALUE - draconicToolsBaseStorage * 2 - draconicWeaponsBaseStorage) / (double) Math.max(draconicToolsStoragePerUpgrade + draconicWeaponsStoragePerUpgrade, 1)) * EnumUpgrade.RF_CAPACITY.pointConversion; draconicStaffMaxUpgrades = draconicToolsMaxUpgrades + draconicWeaponsMaxUpgrades; draconicStaffMaxUpgradePoints = draconicToolsMaxUpgradePoints + draconicWeaponsMaxUpgradePoints; - draconicStaffMaxCapacityUpgradePoints = - Math.max(Math.min(draconicStaffMaxUpgradePoints, draconicStaffMaxCapacityUpgradePoints), 0); - wyvernCapacitorMaxCapacityUpgradePoints = - (int) Math.floor((double) (Integer.MAX_VALUE - wyvernCapacitorBaseStorage) - / (double) Math.max(wyvernCapacitorStoragePerUpgrade, 1)) - * EnumUpgrade.RF_CAPACITY.pointConversion; + draconicStaffMaxCapacityUpgradePoints = Math + .max(Math.min(draconicStaffMaxUpgradePoints, draconicStaffMaxCapacityUpgradePoints), 0); + wyvernCapacitorMaxCapacityUpgradePoints = (int) Math.floor( + (double) (Integer.MAX_VALUE - wyvernCapacitorBaseStorage) + / (double) Math.max(wyvernCapacitorStoragePerUpgrade, 1)) + * EnumUpgrade.RF_CAPACITY.pointConversion; wyvernCapacitorMaxUpgrades = getInteger( "tweaks.tools", "Wyvern Flux Capacitor: Maximum amount of upgrades", @@ -589,12 +663,12 @@ public class BalanceConfigHandler { wyvernCapacitorMaxUpgradePoints, wyvernCapacitorMaxUpgrades, Integer.MAX_VALUE); - wyvernCapacitorMaxCapacityUpgradePoints = - Math.max(Math.min(wyvernCapacitorMaxUpgradePoints, wyvernCapacitorMaxCapacityUpgradePoints), 0); - draconicCapacitorMaxCapacityUpgradePoints = - (int) Math.floor((double) (Integer.MAX_VALUE - draconicCapacitorBaseStorage) - / (double) Math.max(draconicCapacitorStoragePerUpgrade, 1)) - * EnumUpgrade.RF_CAPACITY.pointConversion; + wyvernCapacitorMaxCapacityUpgradePoints = Math + .max(Math.min(wyvernCapacitorMaxUpgradePoints, wyvernCapacitorMaxCapacityUpgradePoints), 0); + draconicCapacitorMaxCapacityUpgradePoints = (int) Math.floor( + (double) (Integer.MAX_VALUE - draconicCapacitorBaseStorage) + / (double) Math.max(draconicCapacitorStoragePerUpgrade, 1)) + * EnumUpgrade.RF_CAPACITY.pointConversion; draconicCapacitorMaxUpgrades = getInteger( "tweaks.tools", "Draconic Flux Capacitor: Maximum amount of upgrades", @@ -607,10 +681,12 @@ public class BalanceConfigHandler { draconicCapacitorMaxUpgradePoints, draconicCapacitorMaxUpgrades, Integer.MAX_VALUE); - draconicCapacitorMaxCapacityUpgradePoints = - Math.max(Math.min(draconicCapacitorMaxUpgradePoints, draconicCapacitorMaxCapacityUpgradePoints), 0); - grinderShouldUseLooting = - getBoolean("tweaks.machines", "Mob Grinder: Use Looting enchantment", grinderShouldUseLooting); + draconicCapacitorMaxCapacityUpgradePoints = Math + .max(Math.min(draconicCapacitorMaxUpgradePoints, draconicCapacitorMaxCapacityUpgradePoints), 0); + grinderShouldUseLooting = getBoolean( + "tweaks.machines", + "Mob Grinder: Use Looting enchantment", + grinderShouldUseLooting); energyDeviceBasicLinkingRange = getInteger( "tweaks.machines", "Energy Device (Relay/Transceiver): Linking range", diff --git a/src/main/java/com/brandon3055/draconicevolution/common/handler/ConfigHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/handler/ConfigHandler.java index ed5457ca..edfe66f7 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/handler/ConfigHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/handler/ConfigHandler.java @@ -1,13 +1,15 @@ package com.brandon3055.draconicevolution.common.handler; -import com.brandon3055.draconicevolution.common.utills.LogHelper; import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; + import net.minecraftforge.common.config.Configuration; +import com.brandon3055.draconicevolution.common.utills.LogHelper; + public class ConfigHandler { public static Configuration config; @@ -71,8 +73,8 @@ public class ConfigHandler { public static double reactorOutputMultiplier; public static double reactorFuelUsageMultiplier; - private static String[] defaultSpawnerList = - new String[] {"ExampleMob1", "ExampleMob2", "ExampleMob3 (these examples can be deleted)"}; + private static String[] defaultSpawnerList = new String[] { "ExampleMob1", "ExampleMob2", + "ExampleMob3 (these examples can be deleted)" }; public static void init(File confFile) { if (config == null) { @@ -86,220 +88,202 @@ public class ConfigHandler { try { // General - // disableSunDial = config.get(Configuration.CATEGORY_GENERAL, "Disable Sun Dial", 0, "Disable Sun Dial + // disableSunDial = config.get(Configuration.CATEGORY_GENERAL, "Disable Sun Dial", 0, "Disable Sun Dial // 0:Default, 1:Disable recipe, 2:Disable completely").getInt(0); - // disableXrayBlock = config.get(Configuration.CATEGORY_GENERAL, "Disable Xray Block", 0, "Disable + // disableXrayBlock = config.get(Configuration.CATEGORY_GENERAL, "Disable Xray Block", 0, "Disable // Distortion Flame 0:Default, 1:Disable recipe, 2:Disable completely").getInt(0); teleporterUsesPerPearl = config.get( - Configuration.CATEGORY_GENERAL, - "Teleporter Uses PerPearl", - 1, - "Charm of Dislocation uses per Ender pearl") - .getInt(1); + Configuration.CATEGORY_GENERAL, + "Teleporter Uses PerPearl", + 1, + "Charm of Dislocation uses per Ender pearl").getInt(1); bowBlockDamage = config.get( - Configuration.CATEGORY_GENERAL, - "Bow Block Damage", - true, - "Dose Draconic bow explosion damage blocks") - .getBoolean(true); + Configuration.CATEGORY_GENERAL, + "Bow Block Damage", + true, + "Dose Draconic bow explosion damage blocks").getBoolean(true); showUnlocalizedNames = config.get( - Configuration.CATEGORY_GENERAL, - "Show Unlocalized Names", - false, - "If set to true the unlocalized name of every block and item will be displayed in its tool tip") + Configuration.CATEGORY_GENERAL, + "Show Unlocalized Names", + false, + "If set to true the unlocalized name of every block and item will be displayed in its tool tip") .getBoolean(false); soulDropChance = config.get( - Configuration.CATEGORY_GENERAL, - "soulDropChance", - 1000, - "Mobs have a 1 in this number chance to drop a soul", - 1, - Integer.MAX_VALUE) - .getInt(1000); + Configuration.CATEGORY_GENERAL, + "soulDropChance", + 1000, + "Mobs have a 1 in this number chance to drop a soul", + 1, + Integer.MAX_VALUE).getInt(1000); passiveSoulDropChance = config.get( - Configuration.CATEGORY_GENERAL, - "passiveSoulDropChance", - 800, - "Passive (Animals) Mobs have a 1 in this number chance to drop a soul", - 1, - Integer.MAX_VALUE) - .getInt(800); + Configuration.CATEGORY_GENERAL, + "passiveSoulDropChance", + 800, + "Passive (Animals) Mobs have a 1 in this number chance to drop a soul", + 1, + Integer.MAX_VALUE).getInt(800); cometRarity = config.get( - Configuration.CATEGORY_GENERAL, - "Ender Comet Rarity", - 10000, - "Ender Comet has a 1 in {this number} chance to spawn in each chunk") - .getInt(10000); + Configuration.CATEGORY_GENERAL, + "Ender Comet Rarity", + 10000, + "Ender Comet has a 1 in {this number} chance to spawn in each chunk").getInt(10000); generateEnderComets = config.get( - Configuration.CATEGORY_GENERAL, - "Generate Ender Comets", - true, - "Should Ender comets be generated") - .getBoolean(true); + Configuration.CATEGORY_GENERAL, + "Generate Ender Comets", + true, + "Should Ender comets be generated").getBoolean(true); generateChaosIslands = config.get( - Configuration.CATEGORY_GENERAL, - "Generate Chaos Islands", - true, - "Should Chaos Islands be generated") - .getBoolean(true); - pigmenBloodRage = config.get( - Configuration.CATEGORY_GENERAL, "Pigmen Blood Rage", true, "Is Pigmen blood rage active") + Configuration.CATEGORY_GENERAL, + "Generate Chaos Islands", + true, + "Should Chaos Islands be generated").getBoolean(true); + pigmenBloodRage = config + .get(Configuration.CATEGORY_GENERAL, "Pigmen Blood Rage", true, "Is Pigmen blood rage active") .getBoolean(true); disableLore = config.get( - Configuration.CATEGORY_GENERAL, - "Disable Item Lore", - false, - "Set to true to disable all item lore") - .getBoolean(false); + Configuration.CATEGORY_GENERAL, + "Disable Item Lore", + false, + "Set to true to disable all item lore").getBoolean(false); invertDPDSB = config.get( - Configuration.CATEGORY_GENERAL, - "InvertDPDSB", - false, - "Invert Dislocator Pedestal display name shift behavior") - .getBoolean(false); + Configuration.CATEGORY_GENERAL, + "InvertDPDSB", + false, + "Invert Dislocator Pedestal display name shift behavior").getBoolean(false); // First is tool hud second is armor hud // x, y, x, y, scale, scale, fademode, fademode, rotateArmor, armorText, hudEnabled, shieldEnabled hudSettings = config.get( - "Gui Stuff", - "HUD Settings", - new int[] {996, 825, 69, 907, 90, 100, 3, 0, 1, 1, 1, 1}, - "Used to store the position of the armor ant tool HUD's. This should not be modified", - Integer.MIN_VALUE, - Integer.MAX_VALUE, - true, - 12) - .getIntList(); + "Gui Stuff", + "HUD Settings", + new int[] { 996, 825, 69, 907, 90, 100, 3, 0, 1, 1, 1, 1 }, + "Used to store the position of the armor ant tool HUD's. This should not be modified", + Integer.MIN_VALUE, + Integer.MAX_VALUE, + true, + 12).getIntList(); disableOreSpawnEnd = config.get( - Configuration.CATEGORY_GENERAL, - "Disable Ore Spawn (End)", - false, - "Set to true to prevent draconium ore from spawning in the end") - .getBoolean(false); + Configuration.CATEGORY_GENERAL, + "Disable Ore Spawn (End)", + false, + "Set to true to prevent draconium ore from spawning in the end").getBoolean(false); disableOreSpawnNether = config.get( - Configuration.CATEGORY_GENERAL, - "Disable Ore Spawn (Nether)", - false, - "Set to true to prevent draconium ore from spawning in the nether") - .getBoolean(false); + Configuration.CATEGORY_GENERAL, + "Disable Ore Spawn (Nether)", + false, + "Set to true to prevent draconium ore from spawning in the nether").getBoolean(false); disableOreSpawnOverworld = config.get( - Configuration.CATEGORY_GENERAL, - "Disable Ore Spawn (Overworld)", - false, - "Set to true to prevent draconium ore from spawning in the overworld") - .getBoolean(false); + Configuration.CATEGORY_GENERAL, + "Disable Ore Spawn (Overworld)", + false, + "Set to true to prevent draconium ore from spawning in the overworld").getBoolean(false); enableVersionChecker = config.get( - Configuration.CATEGORY_GENERAL, - "Enable version checker", - true, - "Set to false to disable the version checker") - .getBoolean(true); + Configuration.CATEGORY_GENERAL, + "Enable version checker", + true, + "Set to false to disable the version checker").getBoolean(true); dragonBreaksBlocks = config.get( - Configuration.CATEGORY_GENERAL, - "Can dragon break blocks", - true, - "Set to false to disable the DE dragons ability to break blocks (dose not effect vanilla dragon)") + Configuration.CATEGORY_GENERAL, + "Can dragon break blocks", + true, + "Set to false to disable the DE dragons ability to break blocks (dose not effect vanilla dragon)") .getBoolean(true); dragonEggSpawnLocation = config.get( - Configuration.CATEGORY_GENERAL, - "Dragon egg spawn location", - new int[] {0, 0, 0}, - "Sets the exact location to spawn the dragon egg and disables the portal spawn (dose not effect vanilla dragon)") + Configuration.CATEGORY_GENERAL, + "Dragon egg spawn location", + new int[] { 0, 0, 0 }, + "Sets the exact location to spawn the dragon egg and disables the portal spawn (dose not effect vanilla dragon)") .getIntList(); oreGenDimentionBlacklist = config.get( - Configuration.CATEGORY_GENERAL, - "Ore gen dimension blacklist", - new int[0], - "Add the id's of dimensions you do not want draconium ore to spawn in") - .getIntList(); + Configuration.CATEGORY_GENERAL, + "Ore gen dimension blacklist", + new int[0], + "Add the id's of dimensions you do not want draconium ore to spawn in").getIntList(); disabledBlocksItems = config.getStringList( "Disabled Blocks & Items", Configuration.CATEGORY_GENERAL, new String[0], "add the unlocalized name of a block or item to this list to disable it"); maxPlayerSpeed = config.get( - Configuration.CATEGORY_GENERAL, - "Player speed cap", - 10D, - "Limits the max speed of players. Recommend between 0.5 - 1.0 for servers") - .getDouble(10D); + Configuration.CATEGORY_GENERAL, + "Player speed cap", + 10D, + "Limits the max speed of players. Recommend between 0.5 - 1.0 for servers").getDouble(10D); speedDimBlackList = config.get( - Configuration.CATEGORY_GENERAL, - "Speed limit Dim black lack list", - new int[] {1}, - "A list of dimensions the speed limit will not effect (speed limit is not so really required in the end)") + Configuration.CATEGORY_GENERAL, + "Speed limit Dim black lack list", + new int[] { 1 }, + "A list of dimensions the speed limit will not effect (speed limit is not so really required in the end)") .getIntList(); speedLimitops = config.get( - Configuration.CATEGORY_GENERAL, - "Speed limit effects ops", - false, - "Dose the speed limit effect ops") - .getBoolean(false); - rapidlyDespawnMinedItems = config.get( + Configuration.CATEGORY_GENERAL, + "Speed limit effects ops", + false, + "Dose the speed limit effect ops").getBoolean(false); + rapidlyDespawnMinedItems = config + .get( Configuration.CATEGORY_GENERAL, "Rapidly despawn aoe mined items", false, "If true items dropped by a tool in aoe mode will despawn after 5 seconds") .getBoolean(false); - useOldArmorModel = config.get( + useOldArmorModel = config + .get( Configuration.CATEGORY_GENERAL, "Use old armor model", false, "If true the armor will use the original vanilla 2D model instead of the new 3D models") .getBoolean(false); sumonRitualAccelerated = config.get( - Configuration.CATEGORY_GENERAL, - "Fast Summon Ritual", - false, - "If true the resurrection ritual will be a lot faster") - .getBoolean(false); + Configuration.CATEGORY_GENERAL, + "Fast Summon Ritual", + false, + "If true the resurrection ritual will be a lot faster").getBoolean(false); useOldD2DToolTextures = config.get( - Configuration.CATEGORY_GENERAL, - "Use old 2D tool textures", - false, - "If true the 3D tool models will be replaced with standard 2D textures") - .getBoolean(false); + Configuration.CATEGORY_GENERAL, + "Use old 2D tool textures", + false, + "If true the 3D tool models will be replaced with standard 2D textures").getBoolean(false); chaosIslandSeparation = config.get( - Configuration.CATEGORY_GENERAL, - "Chaos Island Separation", - 10000, - "This sets how far apart the chaos islands will spawn. The islands spawn in a grid pattern.") + Configuration.CATEGORY_GENERAL, + "Chaos Island Separation", + 10000, + "This sets how far apart the chaos islands will spawn. The islands spawn in a grid pattern.") .getInt(10000); useOriginal3DArmorModel = config.get( - Configuration.CATEGORY_GENERAL, - "Use the original 3D armor models", - false, - "If true the original 3D armor models created by Skeletonpunk will be used instead of the current ones") + Configuration.CATEGORY_GENERAL, + "Use the original 3D armor models", + false, + "If true the original 3D armor models created by Skeletonpunk will be used instead of the current ones") .getBoolean(false); disableGuardianCrystalRespawn = config.get( - Configuration.CATEGORY_GENERAL, - "Disable Guardian Crystal Respawn", - false, - "(Wuss mode) Setting this to true will disable the chaos guardians ability to respawn healing crystals. Under certain circumstances such as on a Spigot server where entity render distance is significantly lower this may be required.") + Configuration.CATEGORY_GENERAL, + "Disable Guardian Crystal Respawn", + false, + "(Wuss mode) Setting this to true will disable the chaos guardians ability to respawn healing crystals. Under certain circumstances such as on a Spigot server where entity render distance is significantly lower this may be required.") .getBoolean(false); itemDislocatorBlacklist = config.getStringList( "Item Dislocator Blacklist", Configuration.CATEGORY_GENERAL, - new String[] {"appliedenergistics2:item.ItemCrystalSeed"}, + new String[] { "appliedenergistics2:item.ItemCrystalSeed" }, "A list of items of items that should be ignored by the item dislocator. Use the items registry name e.g. minecraft:apple you can also add a meta value like so minecraft:wool|4"); disableLog = config.get( - Configuration.CATEGORY_GENERAL, - "Disable Log", - false, - "If you are having issued with console spam that you cant fix setting this to true will disable all log output from Draconic Evolution (Not recommended)") + Configuration.CATEGORY_GENERAL, + "Disable Log", + false, + "If you are having issued with console spam that you cant fix setting this to true will disable all log output from Draconic Evolution (Not recommended)") .getBoolean(false); enableFlight = config.get( - Configuration.CATEGORY_GENERAL, - "Enable Flight", - true, - "Set this to false to disable flight given by draconic armor.") - .getBoolean(true); + Configuration.CATEGORY_GENERAL, + "Enable Flight", + true, + "Set this to false to disable flight given by draconic armor.").getBoolean(true); // Spawner spawnerListType = config.get( - "spawner", - "listType", - false, - "Sets weather the spawner list is a white list or a black list (true = white list false = black list)") + "spawner", + "listType", + false, + "Sets weather the spawner list is a white list or a black list (true = white list false = black list)") .getBoolean(false); spawnerList = config.getStringList( "Spawn List", @@ -308,42 +292,40 @@ public class ConfigHandler { "List of names that will be ether accepted or rejected by the spawner depending on the list type"); // LRD - admin_dislocator_Min_Range = config.get("long range dislocator", "Dislocator Min Range", 1000) - .getInt(1000); + admin_dislocator_Min_Range = config.get("long range dislocator", "Dislocator Min Range", 1000).getInt(1000); admin_dislocator_Max_Range = config.get("long range dislocator", "Dislocator Max Range", 10000) .getInt(10000); admin_dislocator_Detect_Range = config.get("long range dislocator", "Admin Dislocator Detect Range", 5) .getInt(5); // Potions - // potionFlightID = config.get("magic id's", "potionFlightID", 50).getInt(50); + // potionFlightID = config.get("magic id's", "potionFlightID", 50).getInt(50); // Enchantments reaperEnchantID = config.get("magicId's", "Reaper Enchant id", 180).getInt(180); // Reactor - enableReactorBigBoom = config.get( + enableReactorBigBoom = config + .get( "Draconic Reactor", "EnableBigExplosion", true, "Setting this to false will reduce the reactor explosion to little more then a tnt blast") .getBoolean(true); reactorFuelUsageMultiplier = config.get( - "Draconic Reactor", - "FuelUsageMultiplier", - 1, - "Use this to adjust how quickly the reactor uses fuel", - 0, - 1000000) - .getDouble(1); + "Draconic Reactor", + "FuelUsageMultiplier", + 1, + "Use this to adjust how quickly the reactor uses fuel", + 0, + 1000000).getDouble(1); reactorOutputMultiplier = config.get( - "Draconic Reactor", - "EnergyOutputMultiplier", - 1, - "Use this to adjust the output of the reactor", - 0, - 1000000) - .getDouble(1); + "Draconic Reactor", + "EnergyOutputMultiplier", + 1, + "Use this to adjust the output of the reactor", + 0, + 1000000).getDouble(1); disabledNamesList.clear(); for (String s : disabledBlocksItems) { @@ -358,8 +340,8 @@ public class ConfigHandler { itemDislocatorBlacklistMap.clear(); for (String s : itemDislocatorBlacklist) { if (s.contains("|")) { - itemDislocatorBlacklistMap.put( - s.substring(0, s.indexOf("|")), Integer.parseInt(s.substring(s.indexOf("|") + 1))); + itemDislocatorBlacklistMap + .put(s.substring(0, s.indexOf("|")), Integer.parseInt(s.substring(s.indexOf("|") + 1))); } else { itemDislocatorBlacklistMap.put(s, -1); } @@ -383,23 +365,29 @@ public class ConfigHandler { } } /* -{ - //config.load(); - - disableSunDial = config.getInt("Disable Sun Dial", Configuration.CATEGORY_GENERAL, disableSunDial, 0, 2, "Disable Sun Dial 0:Default, 1:Disable recipe, 2:Disable completely"); - disableXrayBlock = config.getInt("Disable Xray Block", Configuration.CATEGORY_GENERAL, disableXrayBlock, 0, 2, "Disable Distortion Flame 0:Default, 1:Disable recipe, 2:Disable completely"); - teleporterUsesPerPearl = config.getInt("Teleporter Uses PerPearl", Configuration.CATEGORY_GENERAL, teleporterUsesPerPearl, 0, Integer.MAX_VALUE, "Charm of Dislocation uses per Ender pearl"); - bowBlockDamage = config.getBoolean(Configuration.CATEGORY_GENERAL, "Bow Block Damage", bowBlockDamage, "Dose Draconic bow explosion damage blocks"); - spawnerListType = config.getBoolean("spawner", "listType", spawnerListType, "Sets weather the spawner list is a white list or a black list (true = white list false = black list)"); - spawnerList = config.getStringList("Spawn List", "spawner", defaultSpawnerList, "List of names that will be ether accepted or rejected by the spawner depending on the list type"); - soulDropChance = config.getInt("soulDropChance", "spawner", soulDropChance, 1, Integer.MAX_VALUE, "Mobs have a 1 in this number chance to drop a soul"); - updateFix = config.getBoolean(Configuration.CATEGORY_GENERAL, "Update Fix", updateFix, "Convert blocks from v0.9.2 to the v0.2.3+ format (set to false if you are not updating from v0.9.2 or earlier)"); - - //dislocator_Min_Range = config.get("Long Range Dislocator", "Admin Dislocator Min Range", 1000000).getInt(1000000); - //dislocator_Max_Range = config.get("Long Range Dislocator", "Admin Dislocator Max Range", 29000000).getInt(29000000); - admin_dislocator_Min_Range = config.getInt("Dislocator Min Range", "long range dislocator", admin_dislocator_Min_Range, 0, 100000, ""); - admin_dislocator_Max_Range = config.getInt("Dislocator Max Range", "long range dislocator", admin_dislocator_Max_Range, 0, 100000, ""); - admin_dislocator_Detect_Range = config.getInt("long range dislocator", "Admin Dislocator Detect Range", admin_dislocator_Detect_Range, 0, 100, ""); - disable_LRD = config.getInt("Disable Dislocator", "long range dislocator", disable_LRD, 0, 2, "Disable Long Range Dislocator 0:Default, 1:Disable recipe, 2:Disable completely (Includes Admin Dislocator)"); - } + * { //config.load(); disableSunDial = config.getInt("Disable Sun Dial", Configuration.CATEGORY_GENERAL, disableSunDial, + * 0, 2, "Disable Sun Dial 0:Default, 1:Disable recipe, 2:Disable completely"); disableXrayBlock = + * config.getInt("Disable Xray Block", Configuration.CATEGORY_GENERAL, disableXrayBlock, 0, 2, + * "Disable Distortion Flame 0:Default, 1:Disable recipe, 2:Disable completely"); teleporterUsesPerPearl = + * config.getInt("Teleporter Uses PerPearl", Configuration.CATEGORY_GENERAL, teleporterUsesPerPearl, 0, + * Integer.MAX_VALUE, "Charm of Dislocation uses per Ender pearl"); bowBlockDamage = + * config.getBoolean(Configuration.CATEGORY_GENERAL, "Bow Block Damage", bowBlockDamage, + * "Dose Draconic bow explosion damage blocks"); spawnerListType = config.getBoolean("spawner", "listType", + * spawnerListType, + * "Sets weather the spawner list is a white list or a black list (true = white list false = black list)"); spawnerList + * = config.getStringList("Spawn List", "spawner", defaultSpawnerList, + * "List of names that will be ether accepted or rejected by the spawner depending on the list type"); soulDropChance = + * config.getInt("soulDropChance", "spawner", soulDropChance, 1, Integer.MAX_VALUE, + * "Mobs have a 1 in this number chance to drop a soul"); updateFix = config.getBoolean(Configuration.CATEGORY_GENERAL, + * "Update Fix", updateFix, + * "Convert blocks from v0.9.2 to the v0.2.3+ format (set to false if you are not updating from v0.9.2 or earlier)"); + * //dislocator_Min_Range = config.get("Long Range Dislocator", "Admin Dislocator Min Range", 1000000).getInt(1000000); + * //dislocator_Max_Range = config.get("Long Range Dislocator", "Admin Dislocator Max Range", + * 29000000).getInt(29000000); admin_dislocator_Min_Range = config.getInt("Dislocator Min Range", + * "long range dislocator", admin_dislocator_Min_Range, 0, 100000, ""); admin_dislocator_Max_Range = + * config.getInt("Dislocator Max Range", "long range dislocator", admin_dislocator_Max_Range, 0, 100000, ""); + * admin_dislocator_Detect_Range = config.getInt("long range dislocator", "Admin Dislocator Detect Range", + * admin_dislocator_Detect_Range, 0, 100, ""); disable_LRD = config.getInt("Disable Dislocator", + * "long range dislocator", disable_LRD, 0, 2, + * "Disable Long Range Dislocator 0:Default, 1:Disable recipe, 2:Disable completely (Includes Admin Dislocator)"); } */ diff --git a/src/main/java/com/brandon3055/draconicevolution/common/handler/ContributorHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/handler/ContributorHandler.java index 915c2112..0dbecfb8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/handler/ContributorHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/handler/ContributorHandler.java @@ -1,5 +1,20 @@ package com.brandon3055.draconicevolution.common.handler; +import java.io.*; +import java.net.URL; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.UUID; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraftforge.client.event.RenderPlayerEvent; + +import org.apache.commons.io.IOUtils; +import org.lwjgl.opengl.GL11; + import com.brandon3055.brandonscore.common.handlers.FileHandler; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.handler.ResourceHandler; @@ -8,20 +23,9 @@ import com.brandon3055.draconicevolution.common.network.ContributorPacket; import com.brandon3055.draconicevolution.common.utills.LogHelper; import com.google.common.base.Charsets; import com.google.gson.stream.JsonReader; + import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.gameevent.PlayerEvent; -import java.io.*; -import java.net.URL; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.UUID; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraftforge.client.event.RenderPlayerEvent; -import org.apache.commons.io.IOUtils; -import org.lwjgl.opengl.GL11; /** * Created by brandon3055 on 5/11/2015. @@ -43,9 +47,9 @@ public class ContributorHandler { Contributor contributor = contributors.get(event.entityPlayer.getCommandSenderName()); if (contributor.contributionLevel >= 1 && (contributor.contributorWingsEnabled)) renderWings(event); - if (contributor.contribution != null - && contributor.contribution.toLowerCase().contains("patreon") - && contributor.patreonBadgeEnabled) renderBadge(event); + if (contributor.contribution != null && contributor.contribution.toLowerCase().contains("patreon") + && contributor.patreonBadgeEnabled) + renderBadge(event); } } @@ -131,8 +135,7 @@ public class ContributorHandler { public static void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) { if (event.player instanceof EntityPlayerMP) { for (String contribName : ContributorHandler.contributors.keySet()) { - for (String name : - FMLCommonHandler.instance().getMinecraftServerInstance().getAllUsernames()) { + for (String name : FMLCommonHandler.instance().getMinecraftServerInstance().getAllUsernames()) { if (name.equals(contribName)) { ContributorHandler.Contributor contributor = ContributorHandler.contributors.get(contribName); DraconicEvolution.network.sendTo( @@ -250,6 +253,7 @@ public class ContributorHandler { // endregion public static class Contributor { + public String name; public String ign; public String contribution; @@ -269,8 +273,8 @@ public class ContributorHandler { public boolean isUserValid(EntityPlayer player) { if (!validated) { - isValid = !UUID.nameUUIDFromBytes( - ("OfflinePlayer:" + player.getCommandSenderName()).getBytes(Charsets.UTF_8)) + isValid = !UUID + .nameUUIDFromBytes(("OfflinePlayer:" + player.getCommandSenderName()).getBytes(Charsets.UTF_8)) .equals(player.getUniqueID()); } return isValid; @@ -278,8 +282,14 @@ public class ContributorHandler { @Override public String toString() { - return "[Contributor: " + name + ", Contribution: " + contribution + ", Details: " + details + ", Website: " - + website + "]"; + return "[Contributor: " + name + + ", Contribution: " + + contribution + + ", Details: " + + details + + ", Website: " + + website + + "]"; } } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/handler/CraftingHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/handler/CraftingHandler.java index 4a59d7f0..3cc75cfa 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/handler/CraftingHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/handler/CraftingHandler.java @@ -1,12 +1,5 @@ package com.brandon3055.draconicevolution.common.handler; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.utills.LogHelper; -import com.brandon3055.draconicevolution.common.utills.ShapedOreEnergyRecipe; -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -15,7 +8,17 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.utills.LogHelper; +import com.brandon3055.draconicevolution.common.utills.ShapedOreEnergyRecipe; + +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.registry.GameRegistry; + public class CraftingHandler { + public static void init() { // todo In 1.8-1.9 when the feature modals are implemented add a dependency system to automatically disable a // recipe if a required component is disabled @@ -95,9 +98,8 @@ public class CraftingHandler { if (ModItems.isEnabled(ModItems.draconiumIngot) && ModItems.isEnabled(ModItems.draconiumBlend)) GameRegistry.addSmelting(ModItems.draconiumBlend, getStack(ModItems.draconiumIngot, 2, 0), 1.0f); - if (ModItems.isEnabled(ModItems.draconiumIngot) && ModItems.isEnabled(ModItems.draconiumDust)) - GameRegistry.addSmelting( - new ItemStack(ModItems.draconiumDust), getStack(ModItems.draconiumIngot, 1, 0), 1.0f); + if (ModItems.isEnabled(ModItems.draconiumIngot) && ModItems.isEnabled(ModItems.draconiumDust)) GameRegistry + .addSmelting(new ItemStack(ModItems.draconiumDust), getStack(ModItems.draconiumIngot, 1, 0), 1.0f); // Reactor addOre( @@ -969,8 +971,7 @@ public class CraftingHandler { if (result == null) return; for (Object o : recipe) { if (o == null) return; - String s = o instanceof Item - ? ((Item) o).getUnlocalizedName() + String s = o instanceof Item ? ((Item) o).getUnlocalizedName() : o instanceof Block ? ((Block) o).getUnlocalizedName() : null; if (s != null && ConfigHandler.disabledNamesList.contains(s)) return; } @@ -982,8 +983,7 @@ public class CraftingHandler { if (result == null) return; for (Object o : recipe) { if (o == null) return; - String s = o instanceof Item - ? ((Item) o).getUnlocalizedName() + String s = o instanceof Item ? ((Item) o).getUnlocalizedName() : o instanceof Block ? ((Block) o).getUnlocalizedName() : null; if (s != null && ConfigHandler.disabledNamesList.contains(s)) return; } @@ -1003,8 +1003,7 @@ public class CraftingHandler { if (result == null) return; for (Object o : recipe) { if (o == null) return; - String s = o instanceof Item - ? ((Item) o).getUnlocalizedName() + String s = o instanceof Item ? ((Item) o).getUnlocalizedName() : o instanceof Block ? ((Block) o).getUnlocalizedName() : null; if (s != null && ConfigHandler.disabledNamesList.contains(s)) return; } @@ -1024,8 +1023,7 @@ public class CraftingHandler { if (result == null) return; for (Object o : recipe) { if (o == null) return; - String s = o instanceof Item - ? ((Item) o).getUnlocalizedName() + String s = o instanceof Item ? ((Item) o).getUnlocalizedName() : o instanceof Block ? ((Block) o).getUnlocalizedName() : null; if (s != null && ConfigHandler.disabledNamesList.contains(s)) return; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/handler/FMLEventHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/handler/FMLEventHandler.java index 7bb9c843..2fe59f79 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/handler/FMLEventHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/handler/FMLEventHandler.java @@ -1,16 +1,18 @@ package com.brandon3055.draconicevolution.common.handler; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChatComponentText; + import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.items.armor.CustomArmorHandler; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.utills.LogHelper; + import cpw.mods.fml.client.event.ConfigChangedEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent; import cpw.mods.fml.common.gameevent.TickEvent; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ChatComponentText; public class FMLEventHandler { @@ -49,12 +51,13 @@ public class FMLEventHandler { if (!mmGiven && event.player.getCommandSenderName().toLowerCase().equals("dezil_nz")) { mmGiven = true; event.player.addChatComponentMessage(new ChatComponentText("Hello Dez! Here have a Marshmallow")); - event.player.worldObj.spawnEntityInWorld(new EntityItem( - event.player.worldObj, - event.player.posX, - event.player.posY, - event.player.posZ, - new ItemStack(ModItems.dezilsMarshmallow))); + event.player.worldObj.spawnEntityInWorld( + new EntityItem( + event.player.worldObj, + event.player.posX, + event.player.posY, + event.player.posZ, + new ItemStack(ModItems.dezilsMarshmallow))); } ContributorHandler.onPlayerLogin(event); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/handler/MinecraftForgeEventHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/handler/MinecraftForgeEventHandler.java index 87fe202d..214fecbf 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/handler/MinecraftForgeEventHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/handler/MinecraftForgeEventHandler.java @@ -1,32 +1,11 @@ package com.brandon3055.draconicevolution.common.handler; -import com.brandon3055.brandonscore.common.handlers.ProcessHandler; -import com.brandon3055.brandonscore.common.utills.DataUtills; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.brandonscore.common.utills.Utills; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.achievements.Achievements; -import com.brandon3055.draconicevolution.common.entity.EntityCustomDragon; -import com.brandon3055.draconicevolution.common.entity.EntityDragonHeart; -import com.brandon3055.draconicevolution.common.entity.ExtendedPlayer; -import com.brandon3055.draconicevolution.common.items.armor.CustomArmorHandler; -import com.brandon3055.draconicevolution.common.network.MountUpdatePacket; -import com.brandon3055.draconicevolution.common.network.SpeedRequestPacket; -import com.brandon3055.draconicevolution.common.tileentities.TileGrinder; -import com.brandon3055.draconicevolution.common.utills.LogHelper; -import com.brandon3055.draconicevolution.common.world.ChaosWorldGenHandler; -import cpw.mods.fml.common.eventhandler.EventPriority; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.relauncher.ReflectionHelper; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.List; import java.util.Random; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.entity.EntityPlayerSP; @@ -62,6 +41,30 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerUseItemEvent; import net.minecraftforge.event.world.WorldEvent; +import com.brandon3055.brandonscore.common.handlers.ProcessHandler; +import com.brandon3055.brandonscore.common.utills.DataUtills; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.brandonscore.common.utills.Utills; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.achievements.Achievements; +import com.brandon3055.draconicevolution.common.entity.EntityCustomDragon; +import com.brandon3055.draconicevolution.common.entity.EntityDragonHeart; +import com.brandon3055.draconicevolution.common.entity.ExtendedPlayer; +import com.brandon3055.draconicevolution.common.items.armor.CustomArmorHandler; +import com.brandon3055.draconicevolution.common.network.MountUpdatePacket; +import com.brandon3055.draconicevolution.common.network.SpeedRequestPacket; +import com.brandon3055.draconicevolution.common.tileentities.TileGrinder; +import com.brandon3055.draconicevolution.common.utills.LogHelper; +import com.brandon3055.draconicevolution.common.world.ChaosWorldGenHandler; + +import cpw.mods.fml.common.eventhandler.EventPriority; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.relauncher.ReflectionHelper; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class MinecraftForgeEventHandler { Random random = new Random(); @@ -75,8 +78,8 @@ public class MinecraftForgeEventHandler { public MinecraftForgeEventHandler() { try { - persistenceRequired = - ReflectionHelper.findField(EntityLiving.class, "field_82179_bU", "persistenceRequired"); + persistenceRequired = ReflectionHelper + .findField(EntityLiving.class, "field_82179_bU", "persistenceRequired"); } catch (Exception e) { LogHelper.error("Unable to find field \"persistenceRequired\""); } @@ -159,31 +162,34 @@ public class MinecraftForgeEventHandler { @SubscribeEvent public void onDropEvent(LivingDropsEvent event) { if (!event.entity.worldObj.isRemote - && ((event.entity instanceof EntityDragon) - || (EntityList.getEntityString(event.entity) != null - && !EntityList.getEntityString(event.entity).isEmpty() - && EntityList.getEntityString(event.entity).equals("HardcoreEnderExpansion.Dragon")))) { + && ((event.entity instanceof EntityDragon) || (EntityList.getEntityString(event.entity) != null + && !EntityList.getEntityString(event.entity).isEmpty() + && EntityList.getEntityString(event.entity).equals("HardcoreEnderExpansion.Dragon")))) { EntityItem item = new EntityItem( event.entity.worldObj, event.entity.posX, event.entity.posY, event.entity.posZ, new ItemStack(ModItems.dragonHeart)); - event.entity.worldObj.spawnEntityInWorld(new EntityDragonHeart( - event.entity.worldObj, - ((int) event.entity.posX) + 0.5, - event.entity.posY, - ((int) event.entity.posZ) + 0.5)); + event.entity.worldObj.spawnEntityInWorld( + new EntityDragonHeart( + event.entity.worldObj, + ((int) event.entity.posX) + 0.5, + event.entity.posY, + ((int) event.entity.posZ) + 0.5)); if (event.entity instanceof EntityCustomDragon && ((EntityCustomDragon) event.entity).getIsUber()) { - event.entity.worldObj.spawnEntityInWorld(new EntityDragonHeart( - event.entity.worldObj, event.entity.posX, event.entity.posY + 2, event.entity.posZ)); + event.entity.worldObj.spawnEntityInWorld( + new EntityDragonHeart( + event.entity.worldObj, + event.entity.posX, + event.entity.posY + 2, + event.entity.posZ)); } for (Object o : event.entity.worldObj.playerEntities) { if (o instanceof EntityPlayer) { - ((EntityPlayer) o) - .addChatComponentMessage( - new ChatComponentText(StatCollector.translateToLocal("msg.de.dragonDeath.txt"))); + ((EntityPlayer) o).addChatComponentMessage( + new ChatComponentText(StatCollector.translateToLocal("msg.de.dragonDeath.txt"))); } } @@ -257,8 +263,8 @@ public class MinecraftForgeEventHandler { return true; } else if (ConfigHandler.spawnerList[i].equals(entity.getCommandSenderName()) && !ConfigHandler.spawnerListType) { - return false; - } + return false; + } } if (ConfigHandler.spawnerListType) { return false; @@ -292,8 +298,16 @@ public class MinecraftForgeEventHandler { private boolean makeChange(ExtendedBlockStorage storage, int x, int y, int z, Block block) { if (block == null) return false; - LogHelper.info("Changing block at [X:" + x + " Y:" + y + " Z:" + z + "] from " - + storage.getBlockByExtId(x, y, z).getUnlocalizedName() + " to " + block.getUnlocalizedName()); + LogHelper.info( + "Changing block at [X:" + x + + " Y:" + + y + + " Z:" + + z + + "] from " + + storage.getBlockByExtId(x, y, z).getUnlocalizedName() + + " to " + + block.getUnlocalizedName()); storage.func_150818_a(x, y, z, block); return true; } @@ -349,7 +363,7 @@ public class MinecraftForgeEventHandler { becomeAngryAt = ReflectionHelper.findMethod( EntityPigZombie.class, zombie, - new String[] {"becomeAngryAt", "func_70835_c"}, + new String[] { "becomeAngryAt", "func_70835_c" }, Entity.class); becomeAngryAt.setAccessible(true); } @@ -362,9 +376,9 @@ public class MinecraftForgeEventHandler { e.printStackTrace(); } - if (Math.abs(zombie.posX - player.posX) < 14 - && Math.abs(zombie.posY - player.posY) < 14 - && Math.abs(zombie.posZ - player.posZ) < 14) flag = true; + if (Math.abs(zombie.posX - player.posX) < 14 && Math.abs(zombie.posY - player.posY) < 14 + && Math.abs(zombie.posZ - player.posZ) < 14) + flag = true; zombie.addPotionEffect(new PotionEffect(5, 10000, 3)); zombie.addPotionEffect(new PotionEffect(11, 10000, 2)); } @@ -387,8 +401,8 @@ public class MinecraftForgeEventHandler { public void getBreakSpeed(PlayerEvent.BreakSpeed event) { if (event.entityPlayer != null) { float newDigSpeed = event.originalSpeed; - CustomArmorHandler.ArmorSummery summery = - new CustomArmorHandler.ArmorSummery().getSummery(event.entityPlayer); + CustomArmorHandler.ArmorSummery summery = new CustomArmorHandler.ArmorSummery() + .getSummery(event.entityPlayer); if (summery == null) return; if (event.entityPlayer.isInsideOfMaterial(Material.water)) { @@ -422,7 +436,12 @@ public class MinecraftForgeEventHandler { if (event.world.getBlock(x, y, z) == ModBlocks.safetyFlame) { event.world.setBlockToAir(x, y, z); event.world.playSoundEffect( - x + 0.5D, y + 0.5D, z + 0.5D, "random.fizz", 1F, event.world.rand.nextFloat() * 0.1F + 2F); + x + 0.5D, + y + 0.5D, + z + 0.5D, + "random.fizz", + 1F, + event.world.rand.nextFloat() * 0.1F + 2F); event.setCanceled(true); } } @@ -431,8 +450,8 @@ public class MinecraftForgeEventHandler { @SubscribeEvent public void entityJoinWorld(EntityJoinWorldEvent event) { if (!event.world.isRemote && event.entity instanceof EntityEnderCrystal && event.entity.dimension == 1) { - DataUtills.XZPair location = ChaosWorldGenHandler.getClosestChaosSpawn( - (int) event.entity.posX / 16, (int) event.entity.posZ / 16); + DataUtills.XZPair location = ChaosWorldGenHandler + .getClosestChaosSpawn((int) event.entity.posX / 16, (int) event.entity.posZ / 16); if ((location.x != 0 || location.z != 0) && Utills.getDistanceAtoB(event.entity.posX, event.entity.posZ, location.x, location.z) < 500) { ProcessHandler.addProcess(new ChaosWorldGenHandler.CrystalRemover(event.entity)); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/inventory/InventoryCraftingChest.java b/src/main/java/com/brandon3055/draconicevolution/common/inventory/InventoryCraftingChest.java index 77f7d244..9b2f1ae9 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/inventory/InventoryCraftingChest.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/inventory/InventoryCraftingChest.java @@ -1,22 +1,23 @@ package com.brandon3055.draconicevolution.common.inventory; -import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.*; import net.minecraft.item.ItemStack; +import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; + /** * Created by Brandon on 29/10/2014. */ public class InventoryCraftingChest extends InventoryCrafting { + /** * the width of the crafting inventory */ private int inventoryWidth; /** - * Class containing the callbacks for the events on_GUIClosed and - * on_CraftMaxtrixChanged. + * Class containing the callbacks for the events on_GUIClosed and on_CraftMaxtrixChanged. */ private Container eventHandler; @@ -67,8 +68,8 @@ public class InventoryCraftingChest extends InventoryCrafting { } /** - * Removes from an inventory slot (first arg) up to a specified number - * (second arg) of items and returns them in a new stack. + * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a + * new stack. */ @Override public ItemStack decrStackSize(int slotID, int par2) { @@ -98,8 +99,7 @@ public class InventoryCraftingChest extends InventoryCrafting { } /** - * Sets the given item stack to the specified slot in the inventory (can be - * crafting or armor sections). + * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). */ @Override public void setInventorySlotContents(int slot, ItemStack itemstack) { @@ -108,8 +108,8 @@ public class InventoryCraftingChest extends InventoryCrafting { } /** - * Returns the maximum stack size for a inventory slot. Seems to always be - * 64, possibly will be extended. *Isn't this more of a set than a get?* + * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't + * this more of a set than a get?* */ @Override public int getInventoryStackLimit() { @@ -123,8 +123,7 @@ public class InventoryCraftingChest extends InventoryCrafting { public void markDirty() {} /** - * Do not make give this method the name canInteractWith because it clashes - * with Container + * Do not make give this method the name canInteractWith because it clashes with Container */ @Override public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) { @@ -136,8 +135,7 @@ public class InventoryCraftingChest extends InventoryCrafting { public void closeChest() {} /** - * Returns true if automation is allowed to insert the given stack (ignoring - * stack size) into the given slot. + * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. */ public boolean isStackValidForSlot(int par1, ItemStack par2ItemStack) { return true; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/inventory/InventoryCraftingChestResult.java b/src/main/java/com/brandon3055/draconicevolution/common/inventory/InventoryCraftingChestResult.java index 393a1f5c..6b1f51e9 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/inventory/InventoryCraftingChestResult.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/inventory/InventoryCraftingChestResult.java @@ -1,14 +1,16 @@ package com.brandon3055.draconicevolution.common.inventory; -import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.InventoryCraftResult; import net.minecraft.item.ItemStack; +import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; + /** * Created by Brandon on 29/10/2014. */ public class InventoryCraftingChestResult extends InventoryCraftResult { + TileDraconiumChest tile; public InventoryCraftingChestResult(TileDraconiumChest tile) { @@ -39,17 +41,16 @@ public class InventoryCraftingChestResult extends InventoryCraftResult { } /** - * If this returns false, the inventory name will be used as an unlocalized - * name, and translated into the player's language. Otherwise it will be - * used directly. + * If this returns false, the inventory name will be used as an unlocalized name, and translated into the player's + * language. Otherwise it will be used directly. */ public boolean isInvNameLocalized() { return false; } /** - * Removes from an inventory slot (first arg) up to a specified number - * (second arg) of items and returns them in a new stack. + * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a + * new stack. */ @Override public ItemStack decrStackSize(int par1, int par2) { @@ -64,9 +65,8 @@ public class InventoryCraftingChestResult extends InventoryCraftResult { } /** - * When some containers are closed they call this on each slot, then drop - * whatever it returns as an EntityItem - like when you close a workbench - * GUI. + * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - + * like when you close a workbench GUI. */ @Override public ItemStack getStackInSlotOnClosing(int par1) { @@ -74,8 +74,7 @@ public class InventoryCraftingChestResult extends InventoryCraftResult { } /** - * Sets the given item stack to the specified slot in the inventory (can be - * crafting or armor sections). + * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). */ @Override public void setInventorySlotContents(int par1, ItemStack par2ItemStack) { @@ -83,8 +82,8 @@ public class InventoryCraftingChestResult extends InventoryCraftResult { } /** - * Returns the maximum stack size for a inventory slot. Seems to always be - * 64, possibly will be extended. *Isn't this more of a set than a get?* + * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't + * this more of a set than a get?* */ @Override public int getInventoryStackLimit() { @@ -98,8 +97,7 @@ public class InventoryCraftingChestResult extends InventoryCraftResult { public void markDirty() {} /** - * Do not make give this method the name canInteractWith because it clashes - * with Container + * Do not make give this method the name canInteractWith because it clashes with Container */ @Override public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) { @@ -111,8 +109,7 @@ public class InventoryCraftingChestResult extends InventoryCraftResult { public void closeChest() {} /** - * Returns true if automation is allowed to insert the given stack (ignoring - * stack size) into the given slot. + * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. */ public boolean isStackValidForSlot(int par1, ItemStack par2ItemStack) { return true; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/inventory/InventoryTool.java b/src/main/java/com/brandon3055/draconicevolution/common/inventory/InventoryTool.java index af579ce3..f6fab981 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/inventory/InventoryTool.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/inventory/InventoryTool.java @@ -1,9 +1,5 @@ package com.brandon3055.draconicevolution.common.inventory; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.draconicevolution.common.container.ContainerAdvTool; -import com.brandon3055.draconicevolution.common.utills.IInventoryTool; -import com.brandon3055.draconicevolution.common.utills.LogHelper; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; @@ -12,6 +8,11 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.StringUtils; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.container.ContainerAdvTool; +import com.brandon3055.draconicevolution.common.utills.IInventoryTool; +import com.brandon3055.draconicevolution.common.utills.LogHelper; + /** * Created by Brandon on 13/01/2015. */ @@ -132,8 +133,7 @@ public class InventoryTool implements IInventory { } private ItemStack getItem() { - if (slot != -1 - && player.inventory.getStackInSlot(slot) != null + if (slot != -1 && player.inventory.getStackInSlot(slot) != null && inventoryItem != null && player.inventory.getStackInSlot(slot).getItem() == inventoryItem.getItem()) { return player.inventory.getStackInSlot(slot); @@ -170,24 +170,23 @@ public class InventoryTool implements IInventory { } else if (inventoryStacks[i] != null) { if (inventoryStacks[i].getTagCompound() == null) inventoryStacks[i] = null; else { - enchList.appendTag(inventoryStacks[i] - .getTagCompound() - .getTagList("StoredEnchantments", 10) - .getCompoundTagAt(0)); + enchList.appendTag( + inventoryStacks[i].getTagCompound().getTagList("StoredEnchantments", 10) + .getCompoundTagAt(0)); } } compound.setTag("ench", enchList); } - // for (int i = size; i < getSizeInventory(); i++) - // { - // if (inventoryStacks[i] != null && inventoryStacks[i].getItem() == Items.enchanted_book && + // for (int i = size; i < getSizeInventory(); i++) + // { + // if (inventoryStacks[i] != null && inventoryStacks[i].getItem() == Items.enchanted_book && // inventoryStacks[i].hasTagCompound() && inventoryStacks[i].getTagCompound().hasKey("StoredEnchantments")) - // { - // NBTTagList enchants = inventoryStacks[i].getTagCompound().getTagList("StoredEnchantments", 10); - // compound.setTag("ench", enchants); - // } - // } + // { + // NBTTagList enchants = inventoryStacks[i].getTagCompound().getTagList("StoredEnchantments", 10); + // compound.setTag("ench", enchants); + // } + // } if (compound.hasKey("ench") && compound.getTagList("ench", 10).tagCount() == 0) compound.removeTag("ench"); } @@ -211,22 +210,22 @@ public class InventoryTool implements IInventory { } } - // if (compound.hasKey("ench")) - // { - // NBTTagList enchants = compound.getTagList("ench", 10); - // for (int i = size; i < getSizeInventory(); i++) - // { - // if (!enchants.getCompoundTagAt(i - size).hasNoTags()) - // { - // inventoryStacks[i] = new ItemStack(Items.enchanted_book); - // NBTTagCompound compound1 = new NBTTagCompound(); - // NBTTagList list = new NBTTagList(); - // list.appendTag(enchants.getCompoundTagAt(i - size)); - // compound1.setTag("StoredEnchantments", list); - // inventoryStacks[i].setTagCompound(compound1); - // } - // } - // } + // if (compound.hasKey("ench")) + // { + // NBTTagList enchants = compound.getTagList("ench", 10); + // for (int i = size; i < getSizeInventory(); i++) + // { + // if (!enchants.getCompoundTagAt(i - size).hasNoTags()) + // { + // inventoryStacks[i] = new ItemStack(Items.enchanted_book); + // NBTTagCompound compound1 = new NBTTagCompound(); + // NBTTagList list = new NBTTagList(); + // list.appendTag(enchants.getCompoundTagAt(i - size)); + // compound1.setTag("StoredEnchantments", list); + // inventoryStacks[i].setTagCompound(compound1); + // } + // } + // } if (compound.hasKey("ench") && compound.getTagList("ench", 10).tagCount() == 0) compound.removeTag("ench"); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/inventory/SlotChargable.java b/src/main/java/com/brandon3055/draconicevolution/common/inventory/SlotChargable.java index c854fc89..dfd597c8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/inventory/SlotChargable.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/inventory/SlotChargable.java @@ -1,11 +1,13 @@ package com.brandon3055.draconicevolution.common.inventory; -import cofh.api.energy.IEnergyContainerItem; -import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +import cofh.api.energy.IEnergyContainerItem; + +import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser; + public class SlotChargable extends Slot { public SlotChargable(IInventory inventory, int id, int x, int y) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/inventory/SlotItemValid.java b/src/main/java/com/brandon3055/draconicevolution/common/inventory/SlotItemValid.java index 9a56f313..71587f4c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/inventory/SlotItemValid.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/inventory/SlotItemValid.java @@ -1,6 +1,5 @@ package com.brandon3055.draconicevolution.common.inventory; -import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; @@ -14,6 +13,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.item.ItemTool; +import cpw.mods.fml.common.registry.GameRegistry; + public class SlotItemValid extends Slot { private Item item; @@ -59,12 +60,9 @@ public class SlotItemValid extends Slot { } } - if (item instanceof ItemTool - && ((ItemTool) item).getToolMaterialName().equals("WOOD")) return 200; - if (item instanceof ItemSword - && ((ItemSword) item).getToolMaterialName().equals("WOOD")) return 200; - if (item instanceof ItemHoe - && ((ItemHoe) item).getToolMaterialName().equals("WOOD")) return 200; + if (item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD")) return 200; + if (item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD")) return 200; + if (item instanceof ItemHoe && ((ItemHoe) item).getToolMaterialName().equals("WOOD")) return 200; if (item == Items.stick) return 100; if (item == Items.coal) return 1600; if (item == Items.lava_bucket) return 20000; @@ -74,13 +72,7 @@ public class SlotItemValid extends Slot { } } /* - @Override - public IIcon getBackgroundIconIndex() - { - IIcon icon = Items.coal.getIconIndex(new ItemStack(Items.coal)); - if (false) - return icon; - else - return super.getBackgroundIconIndex(); - }*/ + * @Override public IIcon getBackgroundIconIndex() { IIcon icon = Items.coal.getIconIndex(new + * ItemStack(Items.coal)); if (false) return icon; else return super.getBackgroundIconIndex(); } + */ } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/inventory/SlotOutput.java b/src/main/java/com/brandon3055/draconicevolution/common/inventory/SlotOutput.java index d40f7edc..904d2bb0 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/inventory/SlotOutput.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/inventory/SlotOutput.java @@ -8,6 +8,7 @@ import net.minecraft.item.ItemStack; * Created by Brandon on 11/10/2014. */ public class SlotOutput extends Slot { + public SlotOutput(IInventory inventory, int id, int x, int y) { super(inventory, id, x, y); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/AwakenedCore.java b/src/main/java/com/brandon3055/draconicevolution/common/items/AwakenedCore.java index a6cb4e1d..1078051d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/AwakenedCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/AwakenedCore.java @@ -1,11 +1,13 @@ package com.brandon3055.draconicevolution.common.items; +import net.minecraft.item.ItemStack; + import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.lib.Strings; -import net.minecraft.item.ItemStack; public class AwakenedCore extends ItemDE { + public AwakenedCore() { this.setUnlocalizedName(Strings.draconicCompoundName); this.setCreativeTab(DraconicEvolution.tabBlocksItems); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/ChaosFragment.java b/src/main/java/com/brandon3055/draconicevolution/common/items/ChaosFragment.java index ec2ee19f..da7d764b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/ChaosFragment.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/ChaosFragment.java @@ -1,11 +1,13 @@ package com.brandon3055.draconicevolution.common.items; -import com.brandon3055.draconicevolution.common.ModItems; import java.util.List; + import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import com.brandon3055.draconicevolution.common.ModItems; + /** * Created by brandon3055 on 8/10/2015. */ diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/ChaosShard.java b/src/main/java/com/brandon3055/draconicevolution/common/items/ChaosShard.java index 80955795..eda1a44a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/ChaosShard.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/ChaosShard.java @@ -1,17 +1,19 @@ package com.brandon3055.draconicevolution.common.items; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem; + /** * Created by brandon3055 on 1/10/2015. */ public class ChaosShard extends ItemDE { + public ChaosShard() { this.setUnlocalizedName("chaosShard"); this.setCreativeTab(DraconicEvolution.tabBlocksItems); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/ChaoticCore.java b/src/main/java/com/brandon3055/draconicevolution/common/items/ChaoticCore.java index 2da607da..58fe0033 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/ChaoticCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/ChaoticCore.java @@ -1,13 +1,15 @@ package com.brandon3055.draconicevolution.common.items; +import net.minecraft.item.ItemStack; + import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModItems; -import net.minecraft.item.ItemStack; /** * Created by brandon3055 on 2/10/2015. */ public class ChaoticCore extends ItemDE { + public ChaoticCore() { this.setUnlocalizedName("chaoticCore"); this.setCreativeTab(DraconicEvolution.tabBlocksItems); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/DezilsMarshmallow.java b/src/main/java/com/brandon3055/draconicevolution/common/items/DezilsMarshmallow.java index 967ff4c1..0eeadb6b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/DezilsMarshmallow.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/DezilsMarshmallow.java @@ -1,7 +1,5 @@ package com.brandon3055.draconicevolution.common.items; -import com.brandon3055.draconicevolution.common.lib.References; -import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemFood; @@ -10,10 +8,14 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.common.lib.References; +import cpw.mods.fml.common.registry.GameRegistry; + /** * Created by Brandon on 4/15/2015. */ public class DezilsMarshmallow extends ItemFood { + public DezilsMarshmallow() { super(100, 100F, true); this.setUnlocalizedName("draconicevolution:dezilsMarshmallow"); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/DraconicCore.java b/src/main/java/com/brandon3055/draconicevolution/common/items/DraconicCore.java index cdaaf3fe..db6905a2 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/DraconicCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/DraconicCore.java @@ -1,5 +1,14 @@ package com.brandon3055.draconicevolution.common.items; +import java.util.List; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntityMobSpawner; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + import com.brandon3055.brandonscore.common.utills.InfoHelper; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModBlocks; @@ -7,17 +16,12 @@ import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.tileentities.TileCustomSpawner; import com.brandon3055.draconicevolution.common.utills.LogHelper; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import java.util.List; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntityMobSpawner; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; public class DraconicCore extends ItemDE { + public DraconicCore() { this.setUnlocalizedName(Strings.draconicCoreName); this.setCreativeTab(DraconicEvolution.tabBlocksItems); @@ -32,17 +36,8 @@ public class DraconicCore extends ItemDE { } @Override - public boolean onItemUse( - ItemStack stack, - EntityPlayer player, - World world, - int x, - int y, - int z, - int par7, - float par8, - float par9, - float par10) { + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, + float par8, float par9, float par10) { if (world.getBlock(x, y, z) == Blocks.mob_spawner) { TileEntityMobSpawner oldSpawner = world.getTileEntity(x, y, z) instanceof TileEntityMobSpawner ? (TileEntityMobSpawner) world.getTileEntity(x, y, z) diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/DraconicIngot.java b/src/main/java/com/brandon3055/draconicevolution/common/items/DraconicIngot.java index 0c93b829..741d338a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/DraconicIngot.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/DraconicIngot.java @@ -8,6 +8,7 @@ import com.brandon3055.draconicevolution.common.lib.Strings; * Created by Brandon on 21/11/2014. */ public class DraconicIngot extends ItemDE { + public DraconicIngot() { this.setUnlocalizedName(Strings.draconicIngotName); this.setCreativeTab(DraconicEvolution.tabBlocksItems); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/DraconiumBlend.java b/src/main/java/com/brandon3055/draconicevolution/common/items/DraconiumBlend.java index 9171d90f..e0bec859 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/DraconiumBlend.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/DraconiumBlend.java @@ -5,6 +5,7 @@ import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.lib.Strings; public class DraconiumBlend extends ItemDE { + public DraconiumBlend() { this.setUnlocalizedName(Strings.draconiumBlendName); this.setCreativeTab(DraconicEvolution.tabBlocksItems); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/DraconiumDust.java b/src/main/java/com/brandon3055/draconicevolution/common/items/DraconiumDust.java index 950168e1..eb265868 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/DraconiumDust.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/DraconiumDust.java @@ -5,6 +5,7 @@ import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.lib.Strings; public class DraconiumDust extends ItemDE { + public DraconiumDust() { this.setUnlocalizedName(Strings.draconiumDustName); this.setCreativeTab(DraconicEvolution.tabBlocksItems); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/DraconiumEnergyCore.java b/src/main/java/com/brandon3055/draconicevolution/common/items/DraconiumEnergyCore.java index 8348eb10..00132b01 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/DraconiumEnergyCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/DraconiumEnergyCore.java @@ -1,21 +1,25 @@ package com.brandon3055.draconicevolution.common.items; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.lib.Strings; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.List; + import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.lib.Strings; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 24/11/2014. */ public class DraconiumEnergyCore extends ItemDE { + IIcon[] icons = new IIcon[2]; public DraconiumEnergyCore() { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/DraconiumIngot.java b/src/main/java/com/brandon3055/draconicevolution/common/items/DraconiumIngot.java index bb762f56..f3ba568e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/DraconiumIngot.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/DraconiumIngot.java @@ -5,6 +5,7 @@ import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.lib.Strings; public class DraconiumIngot extends ItemDE { + public DraconiumIngot() { this.setUnlocalizedName(Strings.draconiumIngotName); this.setCreativeTab(DraconicEvolution.tabBlocksItems); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/DragonHeart.java b/src/main/java/com/brandon3055/draconicevolution/common/items/DragonHeart.java index eab92c65..8256945f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/DragonHeart.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/DragonHeart.java @@ -1,12 +1,13 @@ package com.brandon3055.draconicevolution.common.items; +import net.minecraft.entity.Entity; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem; import com.brandon3055.draconicevolution.common.lib.Strings; -import net.minecraft.entity.Entity; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; public class DragonHeart extends ItemDE { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/InfoTablet.java b/src/main/java/com/brandon3055/draconicevolution/common/items/InfoTablet.java index 6e605552..89170219 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/InfoTablet.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/InfoTablet.java @@ -1,15 +1,16 @@ package com.brandon3055.draconicevolution.common.items; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.gui.GuiHandler; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; /** * Created by Brandon on 29/09/2014. diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/ItemDE.java b/src/main/java/com/brandon3055/draconicevolution/common/items/ItemDE.java index a1cd661e..59502658 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/ItemDE.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/ItemDE.java @@ -1,13 +1,16 @@ package com.brandon3055.draconicevolution.common.items; -import com.brandon3055.draconicevolution.common.lib.References; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import com.brandon3055.draconicevolution.common.lib.References; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class ItemDE extends Item { + public String getUnwrappedUnlocalizedName(final String unlocalizedName) { return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1); } @@ -16,7 +19,8 @@ public class ItemDE extends Item { public String getUnlocalizedName() { return String.format( "item.%s%s", - References.MODID.toLowerCase() + ":", getUnwrappedUnlocalizedName(super.getUnlocalizedName())); + References.MODID.toLowerCase() + ":", + getUnwrappedUnlocalizedName(super.getUnlocalizedName())); } @Override @@ -27,8 +31,8 @@ public class ItemDE extends Item { @Override @SideOnly(Side.CLIENT) public void registerIcons(final IIconRegister iconRegister) { - this.itemIcon = iconRegister.registerIcon( - References.RESOURCESPREFIX + getUnwrappedUnlocalizedName(super.getUnlocalizedName())); + this.itemIcon = iconRegister + .registerIcon(References.RESOURCESPREFIX + getUnwrappedUnlocalizedName(super.getUnlocalizedName())); } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/Key.java b/src/main/java/com/brandon3055/draconicevolution/common/items/Key.java index 2ea15253..c4b71a43 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/Key.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/Key.java @@ -1,21 +1,25 @@ package com.brandon3055.draconicevolution.common.items; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.lib.Strings; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.List; + import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.lib.Strings; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 27/08/2014. */ public class Key extends ItemDE { + public Key() { this.setUnlocalizedName(Strings.keyName); this.setCreativeTab(DraconicEvolution.tabBlocksItems); @@ -45,13 +49,22 @@ public class Key extends ItemDE { list.add(keyCode == 0 ? "Un-Bound" : "Key Code: " + String.valueOf(keyCode)); if (keyCode != 0) { - list.add("Linked to {X:" + ItemNBTHelper.getInteger(key, "X", 0) + " Y:" - + ItemNBTHelper.getInteger(key, "Y", 0) + " X:" + ItemNBTHelper.getInteger(key, "Z", 0) + "}"); + list.add( + "Linked to {X:" + ItemNBTHelper.getInteger(key, "X", 0) + + " Y:" + + ItemNBTHelper.getInteger(key, "Y", 0) + + " X:" + + ItemNBTHelper.getInteger(key, "Z", 0) + + "}"); if (ItemNBTHelper.getInteger(key, "LockCount", 0) == 0) return; for (int i = 1; i <= ItemNBTHelper.getInteger(key, "LockCount", 0); i++) { - list.add("Linked to {X:" + ItemNBTHelper.getInteger(key, "X_" + i, 0) + " Y:" - + ItemNBTHelper.getInteger(key, "Y_" + i, 0) + " X:" - + ItemNBTHelper.getInteger(key, "Z_" + i, 0) + "}"); + list.add( + "Linked to {X:" + ItemNBTHelper.getInteger(key, "X_" + i, 0) + + " Y:" + + ItemNBTHelper.getInteger(key, "Y_" + i, 0) + + " X:" + + ItemNBTHelper.getInteger(key, "Z_" + i, 0) + + "}"); } } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/MobSoul.java b/src/main/java/com/brandon3055/draconicevolution/common/items/MobSoul.java index a5139097..60b0e88a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/MobSoul.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/MobSoul.java @@ -1,12 +1,7 @@ package com.brandon3055.draconicevolution.common.items; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.utills.LogHelper; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.List; + import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.*; import net.minecraft.entity.player.EntityPlayer; @@ -16,10 +11,19 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.utills.LogHelper; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 7/07/2014. */ public class MobSoul extends ItemDE { + public MobSoul() { this.setUnlocalizedName(Strings.MobSoulName); ModItems.register(this); @@ -39,17 +43,8 @@ public class MobSoul extends ItemDE { public void registerIcons(IIconRegister iconRegister) {} @Override - public boolean onItemUse( - ItemStack stack, - EntityPlayer player, - World world, - int x, - int y, - int z, - int side, - float p_77648_8_, - float p_77648_9_, - float p_77648_10_) { + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, + float p_77648_8_, float p_77648_9_, float p_77648_10_) { if (!player.isSneaking()) return false; String name = ItemNBTHelper.getString(stack, "Name", "Pig"); Entity entity = EntityList.createEntityByName(name, world); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/Nugget.java b/src/main/java/com/brandon3055/draconicevolution/common/items/Nugget.java index b4ede07f..1d785a04 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/Nugget.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/Nugget.java @@ -1,19 +1,22 @@ package com.brandon3055.draconicevolution.common.items; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.lib.References; import java.util.List; + import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.lib.References; + /** * Created by brandon3055 on 8/10/2015. */ public class Nugget extends ItemDE { + private IIcon draconium; private IIcon awakened; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/ReactorStabiliserPart.java b/src/main/java/com/brandon3055/draconicevolution/common/items/ReactorStabiliserPart.java index d3d71f8b..335c6cb8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/ReactorStabiliserPart.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/ReactorStabiliserPart.java @@ -1,21 +1,24 @@ package com.brandon3055.draconicevolution.common.items; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModItems; import java.util.HashMap; import java.util.List; import java.util.Map; + import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModItems; + /** * Created by brandon3055 on 2/10/2015. */ public class ReactorStabiliserPart extends ItemDE { public static final Map parts = new HashMap() { + { put(0, "frame"); put(1, "rotorInner"); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/SunFocus.java b/src/main/java/com/brandon3055/draconicevolution/common/items/SunFocus.java index 16cdb485..43fd26e3 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/SunFocus.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/SunFocus.java @@ -4,6 +4,7 @@ import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.lib.Strings; public class SunFocus extends ItemDE { + public SunFocus() { this.setUnlocalizedName(Strings.sunFocusName); // this.setCreativeTab(DraconicEvolution.tabBlocksItems); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/Tclogo.java b/src/main/java/com/brandon3055/draconicevolution/common/items/Tclogo.java index 779dfd7f..31cbdd0e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/Tclogo.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/Tclogo.java @@ -1,17 +1,7 @@ package com.brandon3055.draconicevolution.common.items; -import com.brandon3055.draconicevolution.client.render.particle.Particles; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.entity.ExtendedPlayer; -import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolHandler; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.utills.LogHelper; -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.List; + import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; @@ -21,7 +11,21 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.client.render.particle.Particles; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.entity.ExtendedPlayer; +import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolHandler; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.utills.LogHelper; + +import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class Tclogo extends ItemDE { + public Tclogo() { this.setUnlocalizedName(Strings.tclogoName); // this.setCreativeTab(draconicevolution.getCreativeTab()); @@ -35,55 +39,40 @@ public class Tclogo extends ItemDE { @Override public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) { - // if (entity instanceof EntityPlayerMP && !entity.onGround) { - // //for (int i = 0; i < 10; i++) - // EntityPlayer player = (EntityPlayer)entity; - // if (player.posX < 500){ + // if (entity instanceof EntityPlayerMP && !entity.onGround) { + // //for (int i = 0; i < 10; i++) + // EntityPlayer player = (EntityPlayer)entity; + // if (player.posX < 500){ // - // ((EntityPlayerMP) entity).playerNetServerHandler.setPlayerLocation(player.posX + 10, entity.posY, + // ((EntityPlayerMP) entity).playerNetServerHandler.setPlayerLocation(player.posX + 10, entity.posY, // entity.posZ, entity.rotationYaw, entity.rotationPitch); - // player.motionX += 10; - // if (player.posX > 128) { + // player.motionX += 10; + // if (player.posX > 128) { // - // ((EntityPlayerMP) entity).playerNetServerHandler.setPlayerLocation(501, entity.posY, entity.posZ, + // ((EntityPlayerMP) entity).playerNetServerHandler.setPlayerLocation(501, entity.posY, entity.posZ, // entity.rotationYaw, entity.rotationPitch); // - // } + // } // - // } - // else player.motionX = 0; + // } + // else player.motionX = 0; - // ((EntityPlayerMP) entity).playerNetServerHandler.setPlayerLocation(entity.posX + 10, entity.posY, + // ((EntityPlayerMP) entity).playerNetServerHandler.setPlayerLocation(entity.posX + 10, entity.posY, // entity.posZ, entity.rotationYaw, entity.rotationPitch); - // ((EntityPlayerMP) entity).addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 10, 1000)); - // if (entity.posX > 500) ((EntityPlayerMP) entity).destroyCurrentEquippedItem(); - // } + // ((EntityPlayerMP) entity).addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 10, 1000)); + // if (entity.posX > 500) ((EntityPlayerMP) entity).destroyCurrentEquippedItem(); + // } /* - //if (entity.isCollidedHorizontally)// && !world.isRemote) - //entity.setLocationAndAngles(entity.posX+30D, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);; - /* - //System.out.println("Update Tick"); - int X = (int)entity.posX; - int Y = (int)entity.posY; - int Z = (int)entity.posZ; - - entity.worldObj.spawnParticle("flame", 613, 5, -822, 0, 0, 0); - if (((EntityPlayer)entity).getHeldItem() != null && ((EntityPlayer)entity).getHeldItem().isItemEqual(new ItemStack(ModItems.tclogo))) - { - - for(int x = X - 5; x <= X + 5; x++) - { - for(int y = Y; y <= Y; y++) - { - for(int z = Z - 5; z <= Z + 5; z++) - { - entity.worldObj.spawnParticle("flame", x - 0.5, y - 0.5, z - 0.5, 0, 0, 0); - entity.worldObj.scheduleBlockUpdate(x, y, z, entity.worldObj.getBlock(x, y, z), 1); - System.out.println("Update Tick " +X+ " " +Y+ " " +Z); - } - } - } - }*/ + * //if (entity.isCollidedHorizontally)// && !world.isRemote) //entity.setLocationAndAngles(entity.posX+30D, + * entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);; /* //System.out.println("Update Tick"); + * int X = (int)entity.posX; int Y = (int)entity.posY; int Z = (int)entity.posZ; + * entity.worldObj.spawnParticle("flame", 613, 5, -822, 0, 0, 0); if (((EntityPlayer)entity).getHeldItem() != + * null && ((EntityPlayer)entity).getHeldItem().isItemEqual(new ItemStack(ModItems.tclogo))) { for(int x = X - + * 5; x <= X + 5; x++) { for(int y = Y; y <= Y; y++) { for(int z = Z - 5; z <= Z + 5; z++) { + * entity.worldObj.spawnParticle("flame", x - 0.5, y - 0.5, z - 0.5, 0, 0, 0); + * entity.worldObj.scheduleBlockUpdate(x, y, z, entity.worldObj.getBlock(x, y, z), 1); + * System.out.println("Update Tick " +X+ " " +Y+ " " +Z); } } } } + */ } @Override @@ -100,9 +89,7 @@ public class Tclogo extends ItemDE { private void particle(World world, EntityPlayer player) { MovingObjectPosition mop = ToolHandler.raytraceFromEntity(world, player, 10000); if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - FMLClientHandler.instance() - .getClient() - .effectRenderer + FMLClientHandler.instance().getClient().effectRenderer .addEffect(new Particles.ReactorExplosionParticle(world, mop.blockX, mop.blockY, mop.blockZ, 100)); } @@ -116,7 +103,7 @@ public class Tclogo extends ItemDE { if (!world.isRemote) { // ExtendedPlayer.get(player).setSpawnCount(6); LogHelper.info(ExtendedPlayer.get(player).getSpawnCount()); - // player.getEntityData().setTag("Tag", new NBTTagCompound()); + // player.getEntityData().setTag("Tag", new NBTTagCompound()); } else LogHelper.info(ExtendedPlayer.get(player).getSpawnCount()); // LogHelper.info(FMLCommonHandler.instance().getMinecraftServerInstance().func_152358_ax().func_152655_a(player.getCommandSenderName()).getId()); // LogHelper.info(player.getUniqueID()); @@ -125,81 +112,81 @@ public class Tclogo extends ItemDE { // LogHelper.info(UUID.nameUUIDFromBytes(("OfflinePlayer:" + // player.getCommandSenderName()).getBytes(Charsets.UTF_8)).equals(player.getUniqueID())); if (FMLCommonHandler.instance().getMinecraftServerInstance() instanceof IntegratedServer) { - // LogHelper.info(FMLClientHandler.instance().getClient().getSession().getToken()); - // LogHelper.info(((YggdrasilMinecraftSessionService)FMLCommonHandler.instance().getMinecraftServerInstance().func_147130_as()).getAuthenticationService().); + // LogHelper.info(FMLClientHandler.instance().getClient().getSession().getToken()); + // LogHelper.info(((YggdrasilMinecraftSessionService)FMLCommonHandler.instance().getMinecraftServerInstance().func_147130_as()).getAuthenticationService().); } } catch (Exception e) { e.printStackTrace(); } - // LogHelper.info(Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode()); + // LogHelper.info(Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode()); // - // ResourceLocation rs = new ResourceLocation(References.RESOURCESPREFIX + "manual-en_US.json"); + // ResourceLocation rs = new ResourceLocation(References.RESOURCESPREFIX + "manual-en_US.json"); // - // try { - // LogHelper.info(Minecraft.getMinecraft().getResourceManager().getResource(rs)); - // } - // catch (IOException e) { - // e.printStackTrace(); - // } + // try { + // LogHelper.info(Minecraft.getMinecraft().getResourceManager().getResource(rs)); + // } + // catch (IOException e) { + // e.printStackTrace(); + // } - // if ((int)System.currentTimeMillis() < lts + 10) return stack; - // else lts = (int)System.currentTimeMillis(); + // if ((int)System.currentTimeMillis() < lts + 10) return stack; + // else lts = (int)System.currentTimeMillis(); // world.playSound(player.posX, player.posY, player.posZ, "DraconicEvolution:fusionExplosion", 1F, 1F, false); - // LogHelper.info(GameRegistry.findBlock("ThermalDynamics", "ThermalDynamics_0")); - // if (player.inventory.getStackInSlot(0) != null) + // LogHelper.info(GameRegistry.findBlock("ThermalDynamics", "ThermalDynamics_0")); + // if (player.inventory.getStackInSlot(0) != null) // LogHelper.info(GameRegistry.findUniqueIdentifierFor(player.inventory.getStackInSlot(0).getItem())); // - // if (world.isRemote){ - // particle(world, player); - // //if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + // if (world.isRemote){ + // particle(world, player); + // //if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) // ProcessHandler.addProcess(new ReactorExplosion(world, mop.blockX, mop.blockY, mop.blockZ, 10F)); - // } - // else { - // MovingObjectPosition mop = ToolHandler.raytraceFromEntity(world, player, 10000); - // //LogHelper.info(mop); - // //FMLClientHandler.instance().getClient().effectRenderer.addEffect(new + // } + // else { + // MovingObjectPosition mop = ToolHandler.raytraceFromEntity(world, player, 10000); + // //LogHelper.info(mop); + // //FMLClientHandler.instance().getClient().effectRenderer.addEffect(new // Particles.ReactorExplosionParticle(world, mop.blockX, mop.blockY, mop.blockZ)); - // if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + // if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) // ProcessHandler.addProcess(new ReactorExplosion(world, mop.blockX, mop.blockY, mop.blockZ, 20F)); - // } + // } // EntityDragonProjectile projectile = new EntityDragonProjectile(world, 6, null, 10, player); // projectile.setPosition(player.posX, player.posY, player.posZ); // - // if (!world.isRemote) - // { - // int x = 45622; - // LogHelper.info("45622".hashCode()); + // if (!world.isRemote) + // { + // int x = 45622; + // LogHelper.info("45622".hashCode()); // // - // File file = new File("C:/Users/Brandon/Desktop/0to"+String.valueOf(Integer.MAX_VALUE)+".txt"); + // File file = new File("C:/Users/Brandon/Desktop/0to"+String.valueOf(Integer.MAX_VALUE)+".txt"); // - // try { - // FileWriter writer = new FileWriter(file); - // for (int i = 0; i < Integer.MAX_VALUE; i++) writer.write(i+","); - // writer.close(); - // LogHelper.info("Done"); - // } - // catch (Exception e) { - // e.printStackTrace(); - // } + // try { + // FileWriter writer = new FileWriter(file); + // for (int i = 0; i < Integer.MAX_VALUE; i++) writer.write(i+","); + // writer.close(); + // LogHelper.info("Done"); + // } + // catch (Exception e) { + // e.printStackTrace(); + // } // // - // int xCoord = 0; - // int yCoord = 0; - // int zCoord = 0; + // int xCoord = 0; + // int yCoord = 0; + // int zCoord = 0; // // // - // int locationHash = (String.valueOf(xCoord)+String.valueOf(yCoord)+String.valueOf(zCoord)).hashCode(); + // int locationHash = (String.valueOf(xCoord)+String.valueOf(yCoord)+String.valueOf(zCoord)).hashCode(); // // - // LogHelper.info(ContributorHandler.contributors); - // ContributorHandler.init(); - // LogHelper.info(ContributorHandler.contributors); + // LogHelper.info(ContributorHandler.contributors); + // ContributorHandler.init(); + // LogHelper.info(ContributorHandler.contributors); // EntityFallingBlock fallingBlock = new EntityFallingBlock(world, (int)player.posX + 0.5, (int)player.posY + // 0.5, (int)player.posZ + 0.5, Blocks.obsidian, 0); @@ -211,176 +198,175 @@ public class Tclogo extends ItemDE { // fallingBlock.motionZ = (rand.nextFloat()-0.5F) * motion; // world.spawnEntityInWorld(fallingBlock); - // try - // { - // for (Object o : AchievementList.achievementList) - // { - // LogHelper.info(o); - // if (o instanceof Achievement)LogHelper.info(((EntityPlayerMP) + // try + // { + // for (Object o : AchievementList.achievementList) + // { + // LogHelper.info(o); + // if (o instanceof Achievement)LogHelper.info(((EntityPlayerMP) // player).func_147099_x().hasAchievementUnlocked((Achievement) o)); - // if (o instanceof Achievement)LogHelper.info(((EntityPlayerMP) + // if (o instanceof Achievement)LogHelper.info(((EntityPlayerMP) // player).func_147099_x().canUnlockAchievement((Achievement) o)); - // LogHelper.info(o instanceof Achievement); - // } + // LogHelper.info(o instanceof Achievement); + // } // - // //LogHelper.info(FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().playerEntityList); - // } - // catch (Exception e) {e.printStackTrace();} + // //LogHelper.info(FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().playerEntityList); + // } + // catch (Exception e) {e.printStackTrace();} // LogHelper.info(); - // LogHelper.info("#########################"); - // Map blocks = new HashMap(); - // List l = new ArrayList(); + // LogHelper.info("#########################"); + // Map blocks = new HashMap(); + // List l = new ArrayList(); - // int rand = itemRand.nextInt(); + // int rand = itemRand.nextInt(); // - // long u = System.nanoTime(); + // long u = System.nanoTime(); // - // for (int i = 0; i < 100000; i++) blocks.containsKey(i+rand); + // for (int i = 0; i < 100000; i++) blocks.containsKey(i+rand); // - // LogHelper.info("Time1:"+(System.nanoTime()-u)/1000000D); - // u = System.nanoTime(); + // LogHelper.info("Time1:"+(System.nanoTime()-u)/1000000D); + // u = System.nanoTime(); // - // for (int i = 0; i < 100000; i++) l.get(i + rand); + // for (int i = 0; i < 100000; i++) l.get(i + rand); // - // LogHelper.info("Time2:"+(System.nanoTime()-u)/1000000D); + // LogHelper.info("Time2:"+(System.nanoTime()-u)/1000000D); - // DraconicWorldGenerator.chaosIslandGen = new WorldGenChaosIsland(); - // LogHelper.info("Reinitialized"); - // long u = System.nanoTime(); - // long m = System.currentTimeMillis(); - // BlockCollection blocks = DraconicWorldGenerator.chaosIslandGen.getBlocks(world.rand); - // LogHelper.info(blocks.getIndex(30285000, 45, -30927500)); + // DraconicWorldGenerator.chaosIslandGen = new WorldGenChaosIsland(); + // LogHelper.info("Reinitialized"); + // long u = System.nanoTime(); + // long m = System.currentTimeMillis(); + // BlockCollection blocks = DraconicWorldGenerator.chaosIslandGen.getBlocks(world.rand); + // LogHelper.info(blocks.getIndex(30285000, 45, -30927500)); //// - // LogHelper.info("Generated in:"+(System.nanoTime()-u)+"ns, "+(System.currentTimeMillis()-m)+"ms"); + // LogHelper.info("Generated in:"+(System.nanoTime()-u)+"ns, "+(System.currentTimeMillis()-m)+"ms"); // for (float f = 0; f < 1; f+=0.01) LogHelper.info((0.5D-Math.abs(f-0.5D))*2D); - // short id = (short)itemRand.nextInt(4000); - // byte meta = (byte)itemRand.nextInt(16); - // LogHelper.info("#########################"); - // LogHelper.info("ID:"+id+" Meta:"+meta); + // short id = (short)itemRand.nextInt(4000); + // byte meta = (byte)itemRand.nextInt(16); + // LogHelper.info("#########################"); + // LogHelper.info("ID:"+id+" Meta:"+meta); // - // byte data1 = (byte)(id >> 4); - // byte data2 = (byte)(((id & 0xF) << 4) | meta); + // byte data1 = (byte)(id >> 4); + // byte data2 = (byte)(((id & 0xF) << 4) | meta); // - // int decodedID = (((data1 & 0xFF) << 4) | ((data2 & 0xF0) >> 4)); - // int decodedMeta = (data2 & 0x0F); - // LogHelper.info("DecodedID:"+decodedID+" DecodedMeta:"+decodedMeta); + // int decodedID = (((data1 & 0xFF) << 4) | ((data2 & 0xF0) >> 4)); + // int decodedMeta = (data2 & 0x0F); + // LogHelper.info("DecodedID:"+decodedID+" DecodedMeta:"+decodedMeta); - // LogHelper.info(Integer.toBinaryString(id) + " "+Integer.toBinaryString(meta)); - // LogHelper.info(Integer.toBinaryString(id >> 4) +" " +Integer.toBinaryString(id & 0xF)); - // LogHelper.info(id+" "+meta); - //// LogHelper.info(b1+" "+b2); - // LogHelper.info(Integer.toBinaryString(b1 & 0xFF)+" "+Integer.toBinaryString(b2 & 0xFF));// +" " + // LogHelper.info(Integer.toBinaryString(id) + " "+Integer.toBinaryString(meta)); + // LogHelper.info(Integer.toBinaryString(id >> 4) +" " +Integer.toBinaryString(id & 0xF)); + // LogHelper.info(id+" "+meta); + //// LogHelper.info(b1+" "+b2); + // LogHelper.info(Integer.toBinaryString(b1 & 0xFF)+" "+Integer.toBinaryString(b2 & 0xFF));// +" " // +Integer.toBinaryString(0xF0)); - //// LogHelper.info((((b1 & 0xF0) << 8) + (b2 & 0xFF)) +" "+meta); - // LogHelper.info("Id: "+Integer.toBinaryString(((b1 & 0xFF) << 4)) +" "+ Integer.toBinaryString(((b2 & 0xF0) + //// LogHelper.info((((b1 & 0xF0) << 8) + (b2 & 0xFF)) +" "+meta); + // LogHelper.info("Id: "+Integer.toBinaryString(((b1 & 0xFF) << 4)) +" "+ Integer.toBinaryString(((b2 & 0xF0) // >>> 4))); - // LogHelper.info("Id: "+Integer.toBinaryString(((b1 & 0xFF) << 4) | ((b2 & 0xF0) >> 4))+" "+(((b1 & 0xFF) << + // LogHelper.info("Id: "+Integer.toBinaryString(((b1 & 0xFF) << 4) | ((b2 & 0xF0) >> 4))+" "+(((b1 & 0xFF) << // 4) | ((b2 & 0xF0) >> 4))); - // LogHelper.info("Meta: "+Integer.toBinaryString(b2 & 0x0F)+" "+(b2 & 0x0F)); - // LogHelper.info("Meta: "+Integer.toBinaryString(4095)); + // LogHelper.info("Meta: "+Integer.toBinaryString(b2 & 0x0F)+" "+(b2 & 0x0F)); + // LogHelper.info("Meta: "+Integer.toBinaryString(4095)); - // for (int index = 0; index < blockId.length; index++) { - // if ((index >> 1) >= addId.length) { // No corresponding AddBlocks index - // blocks[index] = (short) (blockId[index] & 0xFF); - // } else { - // if ((index & 1) != 0) { - // blocks[index] = (short) (((addId[index >> 1] & 0x0F) << 8) + (short) (blockId[index] & 0xFF)); - // } else { - // blocks[index] = (short) (((addId[index >> 1] & 0xF0) << 4) + (short) (blockId[index] & 0xFF)); - // } - // } - // } + // for (int index = 0; index < blockId.length; index++) { + // if ((index >> 1) >= addId.length) { // No corresponding AddBlocks index + // blocks[index] = (short) (blockId[index] & 0xFF); + // } else { + // if ((index & 1) != 0) { + // blocks[index] = (short) (((addId[index >> 1] & 0x0F) << 8) + (short) (blockId[index] & 0xFF)); + // } else { + // blocks[index] = (short) (((addId[index >> 1] & 0xF0) << 4) + (short) (blockId[index] & 0xFF)); + // } + // } + // } - // long s = (652800000L * 8L) + (652800000L * 8L); - // LogHelper.info((s / 1000000000D) / 8D); + // long s = (652800000L * 8L) + (652800000L * 8L); + // LogHelper.info((s / 1000000000D) / 8D); - // int posX = (int)player.posX; - // int posZ = (int)player.posZ; + // int posX = (int)player.posX; + // int posZ = (int)player.posZ; // - // BlockCollection blocks = DraconicWorldGenerator.chaosIslandGen.getBlocks(world.rand); - // LogHelper.info("Generated"); + // BlockCollection blocks = DraconicWorldGenerator.chaosIslandGen.getBlocks(world.rand); + // LogHelper.info("Generated"); // - // for (int x = -400; x < 400; x++){ - // for (int y = 0; y < 255; y++){ - // for (int z = -400; z < 400; z++){ - // world.setBlock(posX+x, y, posZ+z, blocks.getBlock(x, y, z)); - // } - // } - // System.out.print(x+", "); - // } + // for (int x = -400; x < 400; x++){ + // for (int y = 0; y < 255; y++){ + // for (int z = -400; z < 400; z++){ + // world.setBlock(posX+x, y, posZ+z, blocks.getBlock(x, y, z)); + // } + // } + // System.out.print(x+", "); + // } - // int rand1 = itemRand.nextInt(); - // int rand2 = itemRand.nextInt(); - // int rand3 = itemRand.nextInt(); - // int rand4 = itemRand.nextInt(); - // int rand5 = itemRand.nextInt(); - // int rand6 = itemRand.nextInt(); + // int rand1 = itemRand.nextInt(); + // int rand2 = itemRand.nextInt(); + // int rand3 = itemRand.nextInt(); + // int rand4 = itemRand.nextInt(); + // int rand5 = itemRand.nextInt(); + // int rand6 = itemRand.nextInt(); // - // long l = System.currentTimeMillis(); - // for (int i = 0; i < 2000000000; i++){ + // long l = System.currentTimeMillis(); + // for (int i = 0; i < 2000000000; i++){ // - // int x1 = rand1 + i; - // int x2 = rand2 + i; - // int y1 = rand3 + i; - // int y2 = rand4 + i; - // int z1 = rand5 + i; - // int z2 = rand6 + i; + // int x1 = rand1 + i; + // int x2 = rand2 + i; + // int y1 = rand3 + i; + // int y2 = rand4 + i; + // int z1 = rand5 + i; + // int z2 = rand6 + i; // - // double dx = x1-x2; - // double dy = y1-y2; - // double dz = z1-z2; - // double d = dx * dx + dy * dy + dz * dz; - // Math.sqrt(d+i); - // } - // LogHelper.info("Time 1:"+ (System.currentTimeMillis()-l)); + // double dx = x1-x2; + // double dy = y1-y2; + // double dz = z1-z2; + // double d = dx * dx + dy * dy + dz * dz; + // Math.sqrt(d+i); + // } + // LogHelper.info("Time 1:"+ (System.currentTimeMillis()-l)); - // long l = System.currentTimeMillis(); - // new WorldGenChaosIsland().initialize(world.rand); - // LogHelper.info(System.currentTimeMillis() - l); + // long l = System.currentTimeMillis(); + // new WorldGenChaosIsland().initialize(world.rand); + // LogHelper.info(System.currentTimeMillis() - l); // // - // } + // } // List l = world.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(player.posX, // player.posY, player.posZ, player.posX, player.posY, player.posZ).expand(500, 500, 500)); // for (Entity e : l) if (!(e instanceof EntityPlayer)) e.setDead(); // if (1==1) return stack; - /*if (player instanceof EntityPlayerMP) { - for (int i = 0; i < 10; i++) - ((EntityPlayerMP) player).playerNetServerHandler.setPlayerLocation(player.posX + 1, player.posY, player.posZ, player.rotationYaw, player.rotationPitch); - } - - if (1==1) return stack;*/ + /* + * if (player instanceof EntityPlayerMP) { for (int i = 0; i < 10; i++) ((EntityPlayerMP) + * player).playerNetServerHandler.setPlayerLocation(player.posX + 1, player.posY, player.posZ, + * player.rotationYaw, player.rotationPitch); } if (1==1) return stack; + */ // Minecraft.getMinecraft().gameSettings.mouseSensitivity = -0.34F; - // if (world.isRemote) - // { - // ResourceHandler.init(null); - // String str = "A String"; - // IChatComponent localIChatComponent; + // if (world.isRemote) + // { + // ResourceHandler.init(null); + // String str = "A String"; + // IChatComponent localIChatComponent; // // - // localIChatComponent = IChatComponent.Serializer.func_150699_a("[{\"text\":\"" + str + + // localIChatComponent = IChatComponent.Serializer.func_150699_a("[{\"text\":\"" + str + // "\",\"color\":\"aqua\"}," + "{\"text\":\" " + EnumChatFormatting.WHITE + "[" + EnumChatFormatting.GREEN + - // "info.cofh.updater.download" + EnumChatFormatting.WHITE + "]\"," + + // "info.cofh.updater.download" + EnumChatFormatting.WHITE + "]\"," + // "\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":" + "{\"text\":\"" + // - // "info.cofh.updater.tooltip" + ".\",\"color\":\"yellow\"}}," + + // "info.cofh.updater.tooltip" + ".\",\"color\":\"yellow\"}}," + // "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + "www.google.com" + "\"}}]"); // - // //player.addChatMessage(localIChatComponent); - // } - // else - // { - // //for (Object o : EntityList.classToStringMapping.values()) LogHelper.info(o); - // } + // //player.addChatMessage(localIChatComponent); + // } + // else + // { + // //for (Object o : EntityList.classToStringMapping.values()) LogHelper.info(o); + // } if (!player.isSneaking()) { player.capabilities.allowFlying = true; @@ -406,52 +392,52 @@ public class Tclogo extends ItemDE { world.markBlockRangeForRenderUpdate(xi - rad, yi - 20, zi - rad, xi + rad, yi + 20, zi + rad); } // - // LogHelper.info("Downloading Image"); + // LogHelper.info("Downloading Image"); // - // try { - // URL url = new URL("http://i.imgur.com/oHRx1yQ.jpg"); - // String fileName = url.getFile(); - // String destName = ClientProxy.downloadLocation + fileName.substring(fileName.lastIndexOf("/")); - // System.out.println(destName); + // try { + // URL url = new URL("http://i.imgur.com/oHRx1yQ.jpg"); + // String fileName = url.getFile(); + // String destName = ClientProxy.downloadLocation + fileName.substring(fileName.lastIndexOf("/")); + // System.out.println(destName); // - // InputStream is = url.openStream(); - // OutputStream os = new FileOutputStream(destName); + // InputStream is = url.openStream(); + // OutputStream os = new FileOutputStream(destName); // - // byte[] b = new byte[2048]; - // int length; + // byte[] b = new byte[2048]; + // int length; // - // while ((length = is.read(b)) != -1) { - // os.write(b, 0, length); - // } + // while ((length = is.read(b)) != -1) { + // os.write(b, 0, length); + // } // - // is.close(); - // os.close(); - // }catch (IOException e){ - // LogHelper.info(e); - // } + // is.close(); + // os.close(); + // }catch (IOException e){ + // LogHelper.info(e); + // } - // player.addPotionEffect(new PotionEffect(PotionHandler.potionFlight.id, 100, 0)); - // player.addPotionEffect(new PotionEffect(PotionHandler.potionFireResist.id, 100, 1)); - // player.addPotionEffect(new PotionEffect(PotionHandler.potionSpeed.id, 100, 1)); - // player.addPotionEffect(new PotionEffect(PotionHandler.potionUpHillStep.id, 100, 1)); + // player.addPotionEffect(new PotionEffect(PotionHandler.potionFlight.id, 100, 0)); + // player.addPotionEffect(new PotionEffect(PotionHandler.potionFireResist.id, 100, 1)); + // player.addPotionEffect(new PotionEffect(PotionHandler.potionSpeed.id, 100, 1)); + // player.addPotionEffect(new PotionEffect(PotionHandler.potionUpHillStep.id, 100, 1)); int xi = (int) player.posX; int yi = (int) player.posY; int zi = (int) player.posZ; int rad = 1000; - // Block block; - // for (int x = xi-rad; x < xi+rad; x++){ - // for (int y = yi-10; y < yi+30; y++){ - // for (int z = zi-rad; z < zi+rad; z++){ - // // block = world.getBlock(x, y, z); - // //if (block.getMaterial().equals(Material.vine) || block.getMaterial().equals(Material.plants)){ - // //world.setBlockToAir(x, y, z); - // //} + // Block block; + // for (int x = xi-rad; x < xi+rad; x++){ + // for (int y = yi-10; y < yi+30; y++){ + // for (int z = zi-rad; z < zi+rad; z++){ + // // block = world.getBlock(x, y, z); + // //if (block.getMaterial().equals(Material.vine) || block.getMaterial().equals(Material.plants)){ + // //world.setBlockToAir(x, y, z); + // //} // - // //world.markBlockForUpdate(x, y, z); - // } - // } - // } + // //world.markBlockForUpdate(x, y, z); + // } + // } + // } // world.markBlockRangeForRenderUpdate(xi-rad, yi-rad, zi-rad, xi+rad, yi+rad, zi+rad); // if (world.isRemote)player.displayGUIWorkbench((int)player.posX, (int)player.posY, (int)player.posZ); @@ -478,34 +464,35 @@ public class Tclogo extends ItemDE { @Override @SideOnly(Side.CLIENT) - public void addInformation( - final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) { - list.add(EnumChatFormatting.RED - + "Warning! this is an item used to test random bits of code. You should not play with it"); + public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, + final boolean extraInformation) { + list.add( + EnumChatFormatting.RED + + "Warning! this is an item used to test random bits of code. You should not play with it"); list.add(EnumChatFormatting.RED + "because depending on what i used it for last it could do anything."); list.add(EnumChatFormatting.RED + "It may even break your world"); list.add("At the time this warning was added it created a 200x200 block smoking creator"); - // list.add(EnumChatFormatting.AQUA + "AQUA"); - // list.add(EnumChatFormatting.BLACK + "BLACK"); - // list.add(EnumChatFormatting.BLUE + "BLUE"); - // list.add(EnumChatFormatting.DARK_AQUA + "DARK_AQUA"); - // list.add(EnumChatFormatting.DARK_BLUE + "DARK_BLUE"); - // list.add(EnumChatFormatting.DARK_GRAY + "DARK_GRAY"); - // list.add(EnumChatFormatting.DARK_GREEN + "DARK_GREEN"); - // list.add(EnumChatFormatting.DARK_PURPLE + "DARK_PURPLE"); - // list.add(EnumChatFormatting.DARK_RED + "DARK_RED"); - // list.add(EnumChatFormatting.GOLD + "GOLD"); - // list.add(EnumChatFormatting.GRAY + "GRAY"); - // list.add(EnumChatFormatting.GREEN + "GREEN"); - // list.add(EnumChatFormatting.LIGHT_PURPLE + "LIGHT_PURPLE"); - // list.add(EnumChatFormatting.RED + "RED"); - // list.add(EnumChatFormatting.WHITE + "WHITE"); - // list.add(EnumChatFormatting.YELLOW + "YELLOW"); - // list.add(EnumChatFormatting.BOLD + "BOLD"); - // list.add(EnumChatFormatting.ITALIC + "ITALIC"); - // list.add(EnumChatFormatting.OBFUSCATED + "OBFUSCATED"); - // list.add(EnumChatFormatting.UNDERLINE + "UNDERLINE"); - // list.add(EnumChatFormatting.STRIKETHROUGH + "STRIKETHROUGH"); + // list.add(EnumChatFormatting.AQUA + "AQUA"); + // list.add(EnumChatFormatting.BLACK + "BLACK"); + // list.add(EnumChatFormatting.BLUE + "BLUE"); + // list.add(EnumChatFormatting.DARK_AQUA + "DARK_AQUA"); + // list.add(EnumChatFormatting.DARK_BLUE + "DARK_BLUE"); + // list.add(EnumChatFormatting.DARK_GRAY + "DARK_GRAY"); + // list.add(EnumChatFormatting.DARK_GREEN + "DARK_GREEN"); + // list.add(EnumChatFormatting.DARK_PURPLE + "DARK_PURPLE"); + // list.add(EnumChatFormatting.DARK_RED + "DARK_RED"); + // list.add(EnumChatFormatting.GOLD + "GOLD"); + // list.add(EnumChatFormatting.GRAY + "GRAY"); + // list.add(EnumChatFormatting.GREEN + "GREEN"); + // list.add(EnumChatFormatting.LIGHT_PURPLE + "LIGHT_PURPLE"); + // list.add(EnumChatFormatting.RED + "RED"); + // list.add(EnumChatFormatting.WHITE + "WHITE"); + // list.add(EnumChatFormatting.YELLOW + "YELLOW"); + // list.add(EnumChatFormatting.BOLD + "BOLD"); + // list.add(EnumChatFormatting.ITALIC + "ITALIC"); + // list.add(EnumChatFormatting.OBFUSCATED + "OBFUSCATED"); + // list.add(EnumChatFormatting.UNDERLINE + "UNDERLINE"); + // list.add(EnumChatFormatting.STRIKETHROUGH + "STRIKETHROUGH"); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/WyvernCore.java b/src/main/java/com/brandon3055/draconicevolution/common/items/WyvernCore.java index f334820f..4c1497d3 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/WyvernCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/WyvernCore.java @@ -5,6 +5,7 @@ import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.lib.Strings; public class WyvernCore extends ItemDE { + public WyvernCore() { this.setUnlocalizedName(Strings.infusedCompoundName); this.setCreativeTab(DraconicEvolution.tabBlocksItems); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/armor/CustomArmorHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/items/armor/CustomArmorHandler.java index 17b81513..1c435a8b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/armor/CustomArmorHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/armor/CustomArmorHandler.java @@ -1,17 +1,7 @@ package com.brandon3055.draconicevolution.common.items.armor; -import cofh.api.energy.IEnergyContainerItem; -import com.brandon3055.brandonscore.BrandonsCore; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; -import com.brandon3055.draconicevolution.common.handler.ConfigHandler; -import com.brandon3055.draconicevolution.common.network.ShieldHitPacket; -import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; -import com.brandon3055.draconicevolution.integration.ModHelper; -import cpw.mods.fml.common.gameevent.TickEvent; -import cpw.mods.fml.common.network.NetworkRegistry; import java.util.*; + import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.ai.attributes.IAttribute; @@ -25,60 +15,73 @@ import net.minecraftforge.event.entity.living.LivingAttackEvent; import net.minecraftforge.event.entity.living.LivingDeathEvent; import net.minecraftforge.event.entity.living.LivingHurtEvent; +import cofh.api.energy.IEnergyContainerItem; + +import com.brandon3055.brandonscore.BrandonsCore; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; +import com.brandon3055.draconicevolution.common.handler.ConfigHandler; +import com.brandon3055.draconicevolution.common.network.ShieldHitPacket; +import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; +import com.brandon3055.draconicevolution.integration.ModHelper; + +import cpw.mods.fml.common.gameevent.TickEvent; +import cpw.mods.fml.common.network.NetworkRegistry; + /** * Created by Brandon on 13/11/2014. */ public class CustomArmorHandler { + public static final UUID WALK_SPEED_UUID = UUID.fromString("0ea6ce8e-d2e8-11e5-ab30-625662870761"); private static final DamageSource ADMIN_KILL = new DamageSource("administrative.kill") - .setDamageAllowedInCreativeMode() - .setDamageBypassesArmor() - .setDamageIsAbsolute(); + .setDamageAllowedInCreativeMode().setDamageBypassesArmor().setDamageIsAbsolute(); public static Map playersWithFlight = new WeakHashMap(); public static List playersWithUphillStep = new ArrayList(); public static void onPlayerHurt(LivingHurtEvent event) { - // EntityPlayer player = (EntityPlayer) event.entityLiving; - // ArmorSummery summery = new ArmorSummery().getSummery(player); - // if (summery == null || summery.protectionPoints <= 0) return; - // float newEntropy = Math.min(summery.entropy + Math.min(3, event.ammount/5) + + // EntityPlayer player = (EntityPlayer) event.entityLiving; + // ArmorSummery summery = new ArmorSummery().getSummery(player); + // if (summery == null || summery.protectionPoints <= 0) return; + // float newEntropy = Math.min(summery.entropy + Math.min(3, event.ammount/5) + // player.worldObj.rand.nextFloat(), 100F); // - // //Divide the damage between the armor peaces based on how many of the protection points each peace has - // float totalAbsorbed = 0; - // for (int i = 0; i < summery.allocation.length; i++){ - // if (summery.allocation[i] == 0) continue; - // ItemStack armorPeace = summery.armorStacks[i]; + // //Divide the damage between the armor peaces based on how many of the protection points each peace has + // float totalAbsorbed = 0; + // for (int i = 0; i < summery.allocation.length; i++){ + // if (summery.allocation[i] == 0) continue; + // ItemStack armorPeace = summery.armorStacks[i]; // - // float dmgShear = summery.allocation[i] / summery.protectionPoints; - // float dmg = dmgShear * event.ammount; + // float dmgShear = summery.allocation[i] / summery.protectionPoints; + // float dmg = dmgShear * event.ammount; // - // float absorbed = Math.min(dmg, summery.allocation[i]); - // dmg -= absorbed; - // totalAbsorbed += absorbed; - // summery.allocation[i]-=absorbed; - // ItemNBTHelper.setFloat(armorPeace, "ProtectionPoints", summery.allocation[i]); - // ItemNBTHelper.setInteger(armorPeace, "ShieldHitTimer", 20); - // ItemNBTHelper.setFloat(armorPeace, "ShieldEntropy", newEntropy); + // float absorbed = Math.min(dmg, summery.allocation[i]); + // dmg -= absorbed; + // totalAbsorbed += absorbed; + // summery.allocation[i]-=absorbed; + // ItemNBTHelper.setFloat(armorPeace, "ProtectionPoints", summery.allocation[i]); + // ItemNBTHelper.setInteger(armorPeace, "ShieldHitTimer", 20); + // ItemNBTHelper.setFloat(armorPeace, "ShieldEntropy", newEntropy); // - //// if (dmg > 0 && absorbed >= dmgShear*20F){ - //// int energyCost = (int)(dmg * OVER_DRAIN_COST); - //// int extracted = ((IEnergyContainerItem)armorPeace.getItem()).extractEnergy(armorPeace, energyCost, + //// if (dmg > 0 && absorbed >= dmgShear*20F){ + //// int energyCost = (int)(dmg * OVER_DRAIN_COST); + //// int extracted = ((IEnergyContainerItem)armorPeace.getItem()).extractEnergy(armorPeace, energyCost, // false); - //// dmg = (energyCost-extracted) / OVER_DRAIN_COST; - //// totalAbsorbed += extracted / OVER_DRAIN_COST; - //// ItemNBTHelper.setFloat(armorPeace, "ShieldEntropy", 100); - //// } + //// dmg = (energyCost-extracted) / OVER_DRAIN_COST; + //// totalAbsorbed += extracted / OVER_DRAIN_COST; + //// ItemNBTHelper.setFloat(armorPeace, "ShieldEntropy", 100); + //// } // - //// LogHelper.info(dmg); - // } + //// LogHelper.info(dmg); + // } // - // event.ammount-=totalAbsorbed; - // if (event.ammount <= 0) event.setCanceled(true); - // player.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).removeModifier(new + // event.ammount-=totalAbsorbed; + // if (event.ammount <= 0) event.setCanceled(true); + // player.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).removeModifier(new // AttributeModifier(KB_ATTRIB_UUID, SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), // 100, 0)); - // LogHelper.info("hurt"); + // LogHelper.info("hurt"); } public static void onPlayerAttacked(LivingAttackEvent event) { @@ -158,7 +161,7 @@ public class CustomArmorHandler { if (summery.protectionPoints > 500) { event.setCanceled(true); event.entityLiving.setHealth(10); - // LogHelper.warn("Something is trying to bypass the draconic shield. [Culprit: {Damage Type=" + + // LogHelper.warn("Something is trying to bypass the draconic shield. [Culprit: {Damage Type=" + // event.source.damageType + ", Damage Class=" + event.source.toString() + "]"); return; } @@ -179,17 +182,16 @@ public class CustomArmorHandler { for (int i = 0; i < summery.armorStacks.length; i++) { if (summery.armorStacks[i] != null) { - ((IEnergyContainerItem) summery.armorStacks[i].getItem()) - .extractEnergy( - summery.armorStacks[i], - (int) ((charge[i] / (double) totalCharge) - * BalanceConfigHandler.draconicArmorBaseStorage), - false); + ((IEnergyContainerItem) summery.armorStacks[i].getItem()).extractEnergy( + summery.armorStacks[i], + (int) ((charge[i] / (double) totalCharge) * BalanceConfigHandler.draconicArmorBaseStorage), + false); } } - player.addChatComponentMessage(new ChatComponentTranslation("msg.de.shieldDepleted.txt") - .setChatStyle(new ChatStyle().setColor(EnumChatFormatting.DARK_RED))); + player.addChatComponentMessage( + new ChatComponentTranslation("msg.de.shieldDepleted.txt") + .setChatStyle(new ChatStyle().setColor(EnumChatFormatting.DARK_RED))); event.setCanceled(true); player.setHealth(1); } @@ -204,18 +206,17 @@ public class CustomArmorHandler { } public static void tickShield(ArmorSummery summery, EntityPlayer player) { - if (summery == null - || (summery.maxProtectionPoints - summery.protectionPoints < 0.01 && summery.entropy == 0) - || player.worldObj.isRemote) return; + if (summery == null || (summery.maxProtectionPoints - summery.protectionPoints < 0.01 && summery.entropy == 0) + || player.worldObj.isRemote) + return; - float totalPointsToAdd = - Math.min(summery.maxProtectionPoints - summery.protectionPoints, summery.maxProtectionPoints / 60F); + float totalPointsToAdd = Math + .min(summery.maxProtectionPoints - summery.protectionPoints, summery.maxProtectionPoints / 60F); totalPointsToAdd *= (1F - (summery.entropy / 100F)); totalPointsToAdd = Math.min( totalPointsToAdd, summery.totalEnergyStored - / (summery.hasDraconic - ? BalanceConfigHandler.draconicArmorEnergyPerProtectionPoint + / (summery.hasDraconic ? BalanceConfigHandler.draconicArmorEnergyPerProtectionPoint : BalanceConfigHandler.wyvernArmorEnergyPerProtectionPoint)); if (totalPointsToAdd < 0F) totalPointsToAdd = 0F; @@ -227,15 +228,13 @@ public class CustomArmorHandler { if (stack == null || summery.totalEnergyStored <= 0) continue; float maxForPeace = ((ICustomArmor) stack.getItem()).getProtectionPoints(stack); int energyAmount = ((ICustomArmor) summery.armorStacks[i].getItem()).getEnergyPerProtectionPoint(); - ((IEnergyContainerItem) stack.getItem()) - .extractEnergy( - stack, - (int) (((double) summery.energyAllocation[i] / (double) summery.totalEnergyStored) - * (totalPointsToAdd * energyAmount)), - false); - float pointsForPeace = - (summery.pointsDown[i] / Math.max(1, summery.maxProtectionPoints - summery.protectionPoints)) - * totalPointsToAdd; + ((IEnergyContainerItem) stack.getItem()).extractEnergy( + stack, + (int) (((double) summery.energyAllocation[i] / (double) summery.totalEnergyStored) + * (totalPointsToAdd * energyAmount)), + false); + float pointsForPeace = (summery.pointsDown[i] + / Math.max(1, summery.maxProtectionPoints - summery.protectionPoints)) * totalPointsToAdd; summery.allocation[i] += pointsForPeace; if (summery.allocation[i] > maxForPeace || maxForPeace - summery.allocation[i] < 0.1F) summery.allocation[i] = maxForPeace; @@ -255,10 +254,9 @@ public class CustomArmorHandler { if (player.worldObj.isRemote) setPlayerFlySpeed(player, 0.05F + (0.05F * summery.flightSpeedModifier)); - if ((!player.onGround && player.capabilities.isFlying) - && player.motionY != 0 + if ((!player.onGround && player.capabilities.isFlying) && player.motionY != 0 && summery.flightVModifier > 0) { - // float percentIncrease = summery.flightVModifier; + // float percentIncrease = summery.flightVModifier; if (BrandonsCore.proxy.isSpaceDown() && !BrandonsCore.proxy.isShiftDown()) { // LogHelper.info(player.motionY); @@ -270,8 +268,7 @@ public class CustomArmorHandler { } } - if (summery.flight[2] - && player.moveForward == 0 + if (summery.flight[2] && player.moveForward == 0 && player.moveStrafing == 0 && player.capabilities.isFlying) { player.motionX *= 0.5; @@ -311,18 +308,13 @@ public class CustomArmorHandler { if (summery != null && summery.speedModifier > 0) { double value = summery.speedModifier; if (player.getEntityAttribute(speedAttr).getModifier(WALK_SPEED_UUID) == null) { - player.getEntityAttribute(speedAttr) - .applyModifier(new AttributeModifier( - WALK_SPEED_UUID, speedAttr.getAttributeUnlocalizedName(), value, 1)); - } else if (player.getEntityAttribute(speedAttr) - .getModifier(WALK_SPEED_UUID) - .getAmount() - != value) { + player.getEntityAttribute(speedAttr).applyModifier( + new AttributeModifier(WALK_SPEED_UUID, speedAttr.getAttributeUnlocalizedName(), value, 1)); + } else if (player.getEntityAttribute(speedAttr).getModifier(WALK_SPEED_UUID).getAmount() != value) { player.getEntityAttribute(speedAttr) .removeModifier(player.getEntityAttribute(speedAttr).getModifier(WALK_SPEED_UUID)); - player.getEntityAttribute(speedAttr) - .applyModifier(new AttributeModifier( - WALK_SPEED_UUID, speedAttr.getAttributeUnlocalizedName(), value, 1)); + player.getEntityAttribute(speedAttr).applyModifier( + new AttributeModifier(WALK_SPEED_UUID, speedAttr.getAttributeUnlocalizedName(), value, 1)); } if (!player.onGround && player.ridingEntity == null) @@ -380,6 +372,7 @@ public class CustomArmorHandler { } public static class ArmorSummery { + /*---- Shield ----*/ /** * Max protection points from all equipped armor peaces @@ -394,7 +387,7 @@ public class CustomArmorHandler { */ public int peaces = 0; /** - * Point Allocation, The number of points on each peace + * Point Allocation, The number of points on each peace */ public float[] allocation; /** @@ -426,7 +419,7 @@ public class CustomArmorHandler { */ public int[] energyAllocation; /*---- Effects ----*/ - public boolean[] flight = new boolean[] {false, false, false}; + public boolean[] flight = new boolean[] { false, false, false }; public float flightVModifier = 0F; public float speedModifier = 0F; public float jumpModifier = 0F; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/armor/DraconicArmor.java b/src/main/java/com/brandon3055/draconicevolution/common/items/armor/DraconicArmor.java index d46c890d..8251e289 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/armor/DraconicArmor.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/armor/DraconicArmor.java @@ -1,5 +1,31 @@ package com.brandon3055.draconicevolution.common.items.armor; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnumEnchantmentType; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.*; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.DamageSource; +import net.minecraft.util.IIcon; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; +import net.minecraftforge.common.ISpecialArmor; + +import thaumcraft.api.IGoggles; +import thaumcraft.api.IVisDiscountGear; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.nodes.IRevealer; + import com.brandon3055.brandonscore.BrandonsCore; import com.brandon3055.brandonscore.common.utills.InfoHelper; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; @@ -18,6 +44,7 @@ import com.brandon3055.draconicevolution.common.utills.IInventoryTool; import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; import com.brandon3055.draconicevolution.integration.ModHelper; + import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Optional.Interface; import cpw.mods.fml.common.Optional.InterfaceList; @@ -28,52 +55,18 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import forestry.api.apiculture.IArmorApiarist; import forestry.api.core.IArmorNaturalist; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import net.minecraft.client.model.ModelBiped; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnumEnchantmentType; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.*; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; -import net.minecraft.util.DamageSource; -import net.minecraft.util.IIcon; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; -import net.minecraftforge.common.ISpecialArmor; -import thaumcraft.api.IGoggles; -import thaumcraft.api.IVisDiscountGear; -import thaumcraft.api.aspects.Aspect; -import thaumcraft.api.nodes.IRevealer; /** * Created by Brandon on 3/07/2014. */ @InterfaceList( - value = { - @Interface(iface = "thaumcraft.api.IGoggles", modid = "Thaumcraft"), - @Interface(iface = "thaumcraft.api.IVisDiscountGear", modid = "Thaumcraft"), - @Interface(iface = "thaumcraft.api.nodes.IRevealer", modid = "Thaumcraft"), - @Interface(iface = "forestry.api.apiculture.IArmorApiarist", modid = "Forestry"), - @Interface(iface = "forestry.api.core.IArmorNaturalist", modid = "Forestry") - }) -public class DraconicArmor extends ItemArmor - implements ISpecialArmor, - IConfigurableItem, - IInventoryTool, - IGoggles, - IVisDiscountGear, - IRevealer, - IUpgradableItem, - ICustomArmor, - IArmorNaturalist, - IArmorApiarist { + value = { @Interface(iface = "thaumcraft.api.IGoggles", modid = "Thaumcraft"), + @Interface(iface = "thaumcraft.api.IVisDiscountGear", modid = "Thaumcraft"), + @Interface(iface = "thaumcraft.api.nodes.IRevealer", modid = "Thaumcraft"), + @Interface(iface = "forestry.api.apiculture.IArmorApiarist", modid = "Forestry"), + @Interface(iface = "forestry.api.core.IArmorNaturalist", modid = "Forestry") }) +public class DraconicArmor extends ItemArmor implements ISpecialArmor, IConfigurableItem, IInventoryTool, IGoggles, + IVisDiscountGear, IRevealer, IUpgradableItem, ICustomArmor, IArmorNaturalist, IArmorApiarist { // TODO Wings @SideOnly(Side.CLIENT) @@ -155,8 +148,7 @@ public class DraconicArmor extends ItemArmor public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { if (!ConfigHandler.useOldArmorModel) return References.RESOURCESPREFIX + "textures/models/armor/armorDraconic.png"; - if (stack.getItem() == ModItems.draconicHelm - || stack.getItem() == ModItems.draconicChest + if (stack.getItem() == ModItems.draconicHelm || stack.getItem() == ModItems.draconicChest || stack.getItem() == ModItems.draconicBoots) { return References.RESOURCESPREFIX + "textures/models/armor/draconic_layer_1.png"; } else { @@ -195,8 +187,8 @@ public class DraconicArmor extends ItemArmor // region ISpecialArmor @Override - public ArmorProperties getProperties( - EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { + public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, + int slot) { if (source.isUnblockable() || source.isDamageAbsolute() || source.isMagicDamage()) return new ArmorProperties(0, damageReduceAmount / 100D, 15); return new ArmorProperties(0, damageReduceAmount / 24.5D, 1000); @@ -221,8 +213,9 @@ public class DraconicArmor extends ItemArmor this.extractEnergy(stack, BalanceConfigHandler.draconicArmorEnergyToRemoveEffects, false); } if (player.worldObj.getBlockLightValue( - (int) Math.floor(player.posX), (int) player.posY + 1, (int) Math.floor(player.posZ)) - < 5 + (int) Math.floor(player.posX), + (int) player.posY + 1, + (int) Math.floor(player.posZ)) < 5 && IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorNVActive", false)) { player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 419, 0, true)); } else if (IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorNVActive", false) @@ -250,20 +243,20 @@ public class DraconicArmor extends ItemArmor if (player.isBurning()) { player.extinguish(); /* - * Wyvern Armor doesn't require energy to extinguish player => Draconic Armor shouldn't require. - * See CustomArmorHandler.applyArmorDamageBlocking - * */ + * Wyvern Armor doesn't require energy to extinguish player => Draconic Armor shouldn't require. See + * CustomArmorHandler.applyArmorDamageBlocking + */ // flag = false; } for (PotionEffect potion : potions) { int id = potion.getPotionID(); if ((Boolean) ReflectionHelper.getPrivateValue( - Potion.class, Potion.potionTypes[id], new String[] {"isBadEffect", "field_76418_K", "J"})) { + Potion.class, + Potion.potionTypes[id], + new String[] { "isBadEffect", "field_76418_K", "J" })) { if (potion.getPotionID() == Potion.digSlowdown.id && ModHelper.isHoldingCleaver(player)) break; - if ((player.getHeldItem() == null - || (player.getHeldItem().getItem() != ModItems.wyvernBow - && player.getHeldItem().getItem() != ModItems.draconicBow)) - || id != 2) { + if ((player.getHeldItem() == null || (player.getHeldItem().getItem() != ModItems.wyvernBow + && player.getHeldItem().getItem() != ModItems.draconicBow)) || id != 2) { player.removePotionEffect(id); flag = true; } @@ -328,43 +321,41 @@ public class DraconicArmor extends ItemArmor list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ArmorNVActive").readFromItem(stack, false)); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ArmorNVLock").readFromItem(stack, true)); if (Loader.isModLoaded("Thaumcraft")) { - list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "GogglesOfRevealing") - .readFromItem(stack, true)); + list.add( + new ItemConfigField(References.BOOLEAN_ID, slot, "GogglesOfRevealing") + .readFromItem(stack, true)); } if (Loader.isModLoaded("Forestry")) { list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ApiaristArmor").readFromItem(stack, true)); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "NaturalistArmor").readFromItem(stack, true)); } } else if (armorType == 1) { - list.add(new ItemConfigField(References.FLOAT_ID, slot, "VerticalAcceleration") - .setMinMaxAndIncromente(0f, 8f, 0.1f) - .readFromItem(stack, 0F) - .setModifier("PLUSPERCENT")); - list.add(new ItemConfigField(References.FLOAT_ID, slot, "ArmorFlightSpeedMult") - .setMinMaxAndIncromente(0f, 6f, 0.1f) - .readFromItem(stack, 0F) - .setModifier("PLUSPERCENT")); + list.add( + new ItemConfigField(References.FLOAT_ID, slot, "VerticalAcceleration") + .setMinMaxAndIncromente(0f, 8f, 0.1f).readFromItem(stack, 0F).setModifier("PLUSPERCENT")); + list.add( + new ItemConfigField(References.FLOAT_ID, slot, "ArmorFlightSpeedMult") + .setMinMaxAndIncromente(0f, 6f, 0.1f).readFromItem(stack, 0F).setModifier("PLUSPERCENT")); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "EffectiveOnSprint").readFromItem(stack, false)); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ArmorFlightLock").readFromItem(stack, false)); - list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ArmorInertiaCancellation") - .readFromItem(stack, false)); + list.add( + new ItemConfigField(References.BOOLEAN_ID, slot, "ArmorInertiaCancellation") + .readFromItem(stack, false)); if (Loader.isModLoaded("Forestry")) { list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ApiaristArmor").readFromItem(stack, true)); } } else if (armorType == 2) { - list.add(new ItemConfigField(References.FLOAT_ID, slot, "ArmorSpeedMult") - .setMinMaxAndIncromente(0f, 8f, 0.1f) - .readFromItem(stack, 0F) - .setModifier("PLUSPERCENT")); + list.add( + new ItemConfigField(References.FLOAT_ID, slot, "ArmorSpeedMult") + .setMinMaxAndIncromente(0f, 8f, 0.1f).readFromItem(stack, 0F).setModifier("PLUSPERCENT")); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ArmorSprintOnly").readFromItem(stack, false)); if (Loader.isModLoaded("Forestry")) { list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ApiaristArmor").readFromItem(stack, true)); } } else if (armorType == 3) { - list.add(new ItemConfigField(References.FLOAT_ID, slot, "ArmorJumpMult") - .setMinMaxAndIncromente(0f, 15f, 0.1f) - .readFromItem(stack, 0f) - .setModifier("PLUSPERCENT")); + list.add( + new ItemConfigField(References.FLOAT_ID, slot, "ArmorJumpMult") + .setMinMaxAndIncromente(0f, 15f, 0.1f).readFromItem(stack, 0f).setModifier("PLUSPERCENT")); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ArmorSprintOnly").readFromItem(stack, false)); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ArmorHillStep").readFromItem(stack, true)); if (Loader.isModLoaded("Forestry")) { @@ -462,8 +453,7 @@ public class DraconicArmor extends ItemArmor if ((entityLiving instanceof EntityPlayer)) { if (((EntityPlayer) entityLiving).getItemInUseDuration() > 0) { - EnumAction enumaction = - ((EntityPlayer) entityLiving).getItemInUse().getItemUseAction(); + EnumAction enumaction = ((EntityPlayer) entityLiving).getItemInUse().getItemUseAction(); if (enumaction == EnumAction.block) { this.model.heldItemRight = 3; } else if (enumaction == EnumAction.bow) { @@ -478,12 +468,13 @@ public class DraconicArmor extends ItemArmor @Override public List getUpgrades(ItemStack itemstack) { return new ArrayList() { + { add(EnumUpgrade.RF_CAPACITY); add(EnumUpgrade.SHIELD_CAPACITY); add(EnumUpgrade.SHIELD_RECOVERY); - // if (armorType == 2) add(EnumUpgrade.MOVE_SPEED); - // if (armorType == 3) add(EnumUpgrade.JUMP_BOOST); + // if (armorType == 2) add(EnumUpgrade.MOVE_SPEED); + // if (armorType == 3) add(EnumUpgrade.JUMP_BOOST); } }; } @@ -502,12 +493,22 @@ public class DraconicArmor extends ItemArmor public List getUpgradeStats(ItemStack stack) { List strings = new ArrayList(); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " - + InfoHelper.HITC() + Utills.formatNumber(getMaxEnergyStored(stack))); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.ShieldCapacity.txt") + ": " - + InfoHelper.HITC() + (int) getProtectionPoints(stack)); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.ShieldRecovery.txt") + ": " - + InfoHelper.HITC() + Utills.round(getRecoveryPoints(stack) * 0.2D, 10) + " EPS"); + strings.add( + InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + + ": " + + InfoHelper.HITC() + + Utills.formatNumber(getMaxEnergyStored(stack))); + strings.add( + InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.ShieldCapacity.txt") + + ": " + + InfoHelper.HITC() + + (int) getProtectionPoints(stack)); + strings.add( + InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.ShieldRecovery.txt") + + ": " + + InfoHelper.HITC() + + Utills.round(getRecoveryPoints(stack) * 0.2D, 10) + + " EPS"); return strings; } @@ -551,8 +552,7 @@ public class DraconicArmor extends ItemArmor @Override public float getSpeedModifier(ItemStack stack, EntityPlayer player) { if (IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorSprintOnly", false)) { - return player.isSprinting() - ? IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorSpeedMult", 0f) + return player.isSprinting() ? IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorSpeedMult", 0f) : IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorSpeedMult", 0f) / 5F; } else return IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorSpeedMult", 0f); } @@ -581,11 +581,8 @@ public class DraconicArmor extends ItemArmor @Override public boolean[] hasFlight(ItemStack stack) { - return new boolean[] { - true, - IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorFlightLock", false), - IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorInertiaCancellation", false) - }; + return new boolean[] { true, IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorFlightLock", false), + IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorInertiaCancellation", false) }; } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/armor/ICustomArmor.java b/src/main/java/com/brandon3055/draconicevolution/common/items/armor/ICustomArmor.java index 6e9ed846..c03466e5 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/armor/ICustomArmor.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/armor/ICustomArmor.java @@ -1,46 +1,51 @@ package com.brandon3055.draconicevolution.common.items.armor; -import cofh.api.energy.IEnergyContainerItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import cofh.api.energy.IEnergyContainerItem; + /** * Created by brandon3055 on 5/2/2016. */ public interface ICustomArmor extends IEnergyContainerItem { - /**Returns the max number of protection points this armor piece can provide - * 1 protection point equals 1 half heart of protection. - * */ + /** + * Returns the max number of protection points this armor piece can provide 1 protection point equals 1 half heart + * of protection. + */ float getProtectionPoints(ItemStack stack); - /**Returns the number of Upgrade points applied to shield recovery*/ + /** Returns the number of Upgrade points applied to shield recovery */ int getRecoveryPoints(ItemStack stack); - /**Returns the movement speed modifier for this armor*/ + /** Returns the movement speed modifier for this armor */ float getSpeedModifier(ItemStack stack, EntityPlayer player); - /**Returns the jump height modifier for this armor*/ + /** Returns the jump height modifier for this armor */ float getJumpModifier(ItemStack stack, EntityPlayer player); - /**Returns true if this armor has up-hill step enabled*/ + /** Returns true if this armor has up-hill step enabled */ boolean hasHillStep(ItemStack stack, EntityPlayer player); - /**Returns the fire resistance modifier for this armor - * This is the percentage of fire damage this armor should absorb - * If the total resistance for all armor peaces the player is wearing is >= 1 the player will not be damaged by fire. - * Should return a number between 0 and 1*/ + /** + * Returns the fire resistance modifier for this armor This is the percentage of fire damage this armor should + * absorb If the total resistance for all armor peaces the player is wearing is >= 1 the player will not be damaged + * by fire. Should return a number between 0 and 1 + */ float getFireResistance(ItemStack stack); - /**Returns {true, false} if this armor gives the player flight - * Returns {true, true} if flight lock is also enables on this armor*/ + /** + * Returns {true, false} if this armor gives the player flight Returns {true, true} if flight lock is also enables + * on this armor + */ boolean[] hasFlight(ItemStack stack); float getFlightSpeedModifier(ItemStack stack, EntityPlayer player); - /**Returns the vertical acceleration speed*/ + /** Returns the vertical acceleration speed */ float getFlightVModifier(ItemStack stack, EntityPlayer player); - /**Returns amount of energy, required to restore protection point */ + /** Returns amount of energy, required to restore protection point */ int getEnergyPerProtectionPoint(); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/armor/WyvernArmor.java b/src/main/java/com/brandon3055/draconicevolution/common/items/armor/WyvernArmor.java index 115e65cc..a1f38bb9 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/armor/WyvernArmor.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/armor/WyvernArmor.java @@ -1,5 +1,23 @@ package com.brandon3055.draconicevolution.common.items.armor; +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnumEnchantmentType; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.*; +import net.minecraft.util.DamageSource; +import net.minecraft.util.IIcon; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; +import net.minecraftforge.common.ISpecialArmor; + import com.brandon3055.brandonscore.BrandonsCore; import com.brandon3055.brandonscore.common.utills.InfoHelper; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; @@ -17,31 +35,17 @@ import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; import com.brandon3055.draconicevolution.common.utills.IInventoryTool; import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; + import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import java.util.ArrayList; -import java.util.List; -import net.minecraft.client.model.ModelBiped; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnumEnchantmentType; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.*; -import net.minecraft.util.DamageSource; -import net.minecraft.util.IIcon; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; -import net.minecraftforge.common.ISpecialArmor; /** * Created by Brandon on 3/07/2014. */ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IConfigurableItem, IInventoryTool, IUpgradableItem, ICustomArmor { + @SideOnly(Side.CLIENT) private IIcon helmIcon; @@ -121,8 +125,7 @@ public class WyvernArmor extends ItemArmor public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { if (!ConfigHandler.useOldArmorModel) return References.RESOURCESPREFIX + "textures/models/armor/armorWyvern.png"; - if (stack.getItem() == ModItems.wyvernHelm - || stack.getItem() == ModItems.wyvernChest + if (stack.getItem() == ModItems.wyvernHelm || stack.getItem() == ModItems.wyvernChest || stack.getItem() == ModItems.wyvernBoots) { return References.RESOURCESPREFIX + "textures/models/armor/wyvern_layer_1.png"; } else { @@ -161,8 +164,8 @@ public class WyvernArmor extends ItemArmor // region ISpecialArmor @Override - public ArmorProperties getProperties( - EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { + public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, + int slot) { if (source.isUnblockable() || source.isDamageAbsolute() || source.isMagicDamage()) return new ArmorProperties(0, damageReduceAmount / 100D, 15); return new ArmorProperties(0, damageReduceAmount / 25D, 1000); @@ -235,16 +238,14 @@ public class WyvernArmor extends ItemArmor public List getFields(ItemStack stack, int slot) { List list = new ArrayList(); if (armorType == 2) { - list.add(new ItemConfigField(References.FLOAT_ID, slot, "ArmorSpeedMult") - .setMinMaxAndIncromente(0f, 5f, 0.1f) - .readFromItem(stack, 0F) - .setModifier("PLUSPERCENT")); + list.add( + new ItemConfigField(References.FLOAT_ID, slot, "ArmorSpeedMult") + .setMinMaxAndIncromente(0f, 5f, 0.1f).readFromItem(stack, 0F).setModifier("PLUSPERCENT")); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ArmorSprintOnly").readFromItem(stack, false)); } else if (armorType == 3) { - list.add(new ItemConfigField(References.FLOAT_ID, slot, "ArmorJumpMult") - .setMinMaxAndIncromente(0f, 5f, 0.1f) - .readFromItem(stack, 0f) - .setModifier("PLUSPERCENT")); + list.add( + new ItemConfigField(References.FLOAT_ID, slot, "ArmorJumpMult").setMinMaxAndIncromente(0f, 5f, 0.1f) + .readFromItem(stack, 0f).setModifier("PLUSPERCENT")); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ArmorSprintOnly").readFromItem(stack, false)); } return list; @@ -318,8 +319,7 @@ public class WyvernArmor extends ItemArmor if ((entityLiving instanceof EntityPlayer)) { if (((EntityPlayer) entityLiving).getItemInUseDuration() > 0) { - EnumAction enumaction = - ((EntityPlayer) entityLiving).getItemInUse().getItemUseAction(); + EnumAction enumaction = ((EntityPlayer) entityLiving).getItemInUse().getItemUseAction(); if (enumaction == EnumAction.block) { this.model.heldItemRight = 3; } else if (enumaction == EnumAction.bow) { @@ -334,12 +334,13 @@ public class WyvernArmor extends ItemArmor @Override public List getUpgrades(ItemStack itemstack) { return new ArrayList() { + { add(EnumUpgrade.RF_CAPACITY); add(EnumUpgrade.SHIELD_CAPACITY); add(EnumUpgrade.SHIELD_RECOVERY); - // if (armorType == 2) add(EnumUpgrade.MOVE_SPEED); - // if (armorType == 3) add(EnumUpgrade.JUMP_BOOST); + // if (armorType == 2) add(EnumUpgrade.MOVE_SPEED); + // if (armorType == 3) add(EnumUpgrade.JUMP_BOOST); } }; } @@ -358,12 +359,22 @@ public class WyvernArmor extends ItemArmor public List getUpgradeStats(ItemStack stack) { List strings = new ArrayList(); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " - + InfoHelper.HITC() + Utills.formatNumber(getMaxEnergyStored(stack))); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.ShieldCapacity.txt") + ": " - + InfoHelper.HITC() + (int) getProtectionPoints(stack)); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.ShieldRecovery.txt") + ": " - + InfoHelper.HITC() + Utills.round(getRecoveryPoints(stack) * 0.2D, 10) + " EPS"); + strings.add( + InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + + ": " + + InfoHelper.HITC() + + Utills.formatNumber(getMaxEnergyStored(stack))); + strings.add( + InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.ShieldCapacity.txt") + + ": " + + InfoHelper.HITC() + + (int) getProtectionPoints(stack)); + strings.add( + InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.ShieldRecovery.txt") + + ": " + + InfoHelper.HITC() + + Utills.round(getRecoveryPoints(stack) * 0.2D, 10) + + " EPS"); return strings; } @@ -406,8 +417,7 @@ public class WyvernArmor extends ItemArmor @Override public float getSpeedModifier(ItemStack stack, EntityPlayer player) { if (IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorSprintOnly", false)) { - return player.isSprinting() - ? IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorSpeedMult", 0f) + return player.isSprinting() ? IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorSpeedMult", 0f) : IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorSpeedMult", 0f) / 5F; } else return IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorSpeedMult", 0f); } @@ -433,7 +443,7 @@ public class WyvernArmor extends ItemArmor @Override public boolean[] hasFlight(ItemStack stack) { - return new boolean[] {false, false, false}; + return new boolean[] { false, false, false }; } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/AdminSpawnEgg.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/AdminSpawnEgg.java index f5c717f1..dc4b29dd 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/AdminSpawnEgg.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/AdminSpawnEgg.java @@ -1,15 +1,7 @@ package com.brandon3055.draconicevolution.common.items.tools; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.items.ItemDE; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.utills.LogHelper; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.List; + import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; @@ -20,10 +12,22 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.items.ItemDE; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.utills.LogHelper; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 25/09/2014. */ public class AdminSpawnEgg extends ItemDE { + public AdminSpawnEgg() { this.setUnlocalizedName(Strings.adminSpawnEggName); this.setCreativeTab(DraconicEvolution.tabBlocksItems); @@ -31,8 +35,7 @@ public class AdminSpawnEgg extends ItemDE { } public String getItemStackDisplayName(ItemStack stack) { - NBTTagCompound compound = - (NBTTagCompound) ItemNBTHelper.getCompound(stack).copy(); + NBTTagCompound compound = (NBTTagCompound) ItemNBTHelper.getCompound(stack).copy(); if (compound == null) return null; String name = compound.getString("EntityName"); return "Spawn " + name; @@ -72,19 +75,9 @@ public class AdminSpawnEgg extends ItemDE { } @Override - public boolean onItemUse( - ItemStack stack, - EntityPlayer player, - World world, - int x, - int y, - int z, - int side, - float p_77648_8_, - float p_77648_9_, - float p_77648_10_) { - NBTTagCompound compound = - (NBTTagCompound) ItemNBTHelper.getCompound(stack).copy(); + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, + float p_77648_8_, float p_77648_9_, float p_77648_10_) { + NBTTagCompound compound = (NBTTagCompound) ItemNBTHelper.getCompound(stack).copy(); if (compound == null) return false; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/CreativeStructureSpawner.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/CreativeStructureSpawner.java index 3a036642..c0ef6840 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/CreativeStructureSpawner.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/CreativeStructureSpawner.java @@ -1,25 +1,29 @@ package com.brandon3055.draconicevolution.common.items.tools; +import java.util.List; +import java.util.Random; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.items.ItemDE; import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.tileentities.TileChaosShard; import com.brandon3055.draconicevolution.common.world.WorldGenEnderComet; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import java.util.List; -import java.util.Random; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; /** * Created by Brandon on 29/08/2014. */ public class CreativeStructureSpawner extends ItemDE { + public CreativeStructureSpawner() { this.setUnlocalizedName(Strings.creativeStructureSpawnerName); this.hasSubtypes = true; @@ -55,17 +59,8 @@ public class CreativeStructureSpawner extends ItemDE { } @Override - public boolean onItemUse( - ItemStack stack, - EntityPlayer player, - World world, - int x, - int y, - int z, - int p_77648_7_, - float p_77648_8_, - float p_77648_9_, - float p_77648_10_) { + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int p_77648_7_, + float p_77648_8_, float p_77648_9_, float p_77648_10_) { if (world.isRemote) return false; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicAxe.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicAxe.java index 0aa63542..6e12beff 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicAxe.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicAxe.java @@ -1,5 +1,18 @@ package com.brandon3055.draconicevolution.common.items.tools; +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnumEnchantmentType; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; +import net.minecraftforge.client.IItemRenderer; + +import org.lwjgl.opengl.GL11; + import com.brandon3055.draconicevolution.client.render.IRenderTweak; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; @@ -10,16 +23,6 @@ import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; import com.brandon3055.draconicevolution.common.utills.IInventoryTool; import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; -import java.util.List; -import net.minecraft.block.Block; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnumEnchantmentType; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; -import net.minecraftforge.client.IItemRenderer; -import org.lwjgl.opengl.GL11; public class DraconicAxe extends MiningTool implements IInventoryTool, IRenderTweak { @@ -38,13 +41,14 @@ public class DraconicAxe extends MiningTool implements IInventoryTool, IRenderTw public List getFields(ItemStack stack, int slot) { List list = super.getFields(stack, slot); - list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_AOE) - .setMinMaxAndIncromente(0, EnumUpgrade.DIG_AOE.getUpgradePoints(stack), 1) - .readFromItem(stack, 0) - .setModifier("AOE")); - list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_DEPTH) - .setMinMaxAndIncromente(1, EnumUpgrade.DIG_DEPTH.getUpgradePoints(stack), 1) - .readFromItem(stack, 1)); + list.add( + new ItemConfigField(References.INT_ID, slot, References.DIG_AOE) + .setMinMaxAndIncromente(0, EnumUpgrade.DIG_AOE.getUpgradePoints(stack), 1) + .readFromItem(stack, 0).setModifier("AOE")); + list.add( + new ItemConfigField(References.INT_ID, slot, References.DIG_DEPTH) + .setMinMaxAndIncromente(1, EnumUpgrade.DIG_DEPTH.getUpgradePoints(stack), 1) + .readFromItem(stack, 1)); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, References.TREE_MODE).readFromItem(stack, false)); return list; } @@ -69,14 +73,13 @@ public class DraconicAxe extends MiningTool implements IInventoryTool, IRenderTw if (IConfigurableItem.ProfileHelper.getBoolean(stack, References.TREE_MODE, false) && isTree(player.worldObj, x, y, z)) { trimLeavs(x, y, z, player, player.worldObj, stack); - for (int i = 0; i < 9; i++) - player.worldObj.playAuxSFX( - 2001, - x, - y, - z, - Block.getIdFromBlock(player.worldObj.getBlock(x, y, z)) - + (player.worldObj.getBlockMetadata(x, y, z) << 12)); + for (int i = 0; i < 9; i++) player.worldObj.playAuxSFX( + 2001, + x, + y, + z, + Block.getIdFromBlock(player.worldObj.getBlock(x, y, z)) + + (player.worldObj.getBlockMetadata(x, y, z) << 12)); chopTree(x, y, z, player, player.worldObj, stack); return false; } @@ -137,32 +140,32 @@ public class DraconicAxe extends MiningTool implements IInventoryTool, IRenderTw return 0; } - // @Override - // public boolean onBlockStartBreak(ItemStack stack, int X, int Y, int Z, EntityPlayer player) { - // World world = player.worldObj; - // boolean tree = isTree(world, X, Y, Z); + // @Override + // public boolean onBlockStartBreak(ItemStack stack, int X, int Y, int Z, EntityPlayer player) { + // World world = player.worldObj; + // boolean tree = isTree(world, X, Y, Z); // - // if (player.isSneaking()) { - // return false; - // } + // if (player.isSneaking()) { + // return false; + // } // - // Block block = world.getBlock(X, Y, Z); - // Material mat = block.getMaterial(); - // if (!ToolHandler.isRightMaterial(mat, ToolHandler.materialsAxe)) { - // return false; - // } + // Block block = world.getBlock(X, Y, Z); + // Material mat = block.getMaterial(); + // if (!ToolHandler.isRightMaterial(mat, ToolHandler.materialsAxe)) { + // return false; + // } // - // if (!tree) { - // ToolHandler.disSquare(X, Y, Z, player, world, false, 0, ToolHandler.materialsAxe, stack); - // return false; - // } + // if (!tree) { + // ToolHandler.disSquare(X, Y, Z, player, world, false, 0, ToolHandler.materialsAxe, stack); + // return false; + // } // - // if (!world.isRemote) world.playAuxSFX(2001, X, Y, Z, Block.getIdFromBlock(world.getBlock(X, Y, Z))); - // trimLeavs(X, Y, Z, player, world, stack); - // chopTree(X, Y, Z, player, world, stack); + // if (!world.isRemote) world.playAuxSFX(2001, X, Y, Z, Block.getIdFromBlock(world.getBlock(X, Y, Z))); + // trimLeavs(X, Y, Z, player, world, stack); + // chopTree(X, Y, Z, player, world, stack); // - // return true; - // } + // return true; + // } // private boolean isTree(World world, int X, int Y, int Z) { final Block wood = world.getBlock(X, Y, Z); @@ -210,7 +213,7 @@ public class DraconicAxe extends MiningTool implements IInventoryTool, IRenderTw } chopTree(xPos, yPos, zPos, player, world, stack); } // else - // trimLeavs(xPos, yPos, zPos, player, world, stack); + // trimLeavs(xPos, yPos, zPos, player, world, stack); } } } @@ -253,18 +256,18 @@ public class DraconicAxe extends MiningTool implements IInventoryTool, IRenderTw } } - // @SuppressWarnings({"rawtypes", "unchecked"}) - // @Override - // public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean + // @SuppressWarnings({"rawtypes", "unchecked"}) + // @Override + // public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean // extraInformation) { - // if (InfoHelper.holdShiftForDetails(list)){ - // InfoHelper.addEnergyInfo(stack, list); - // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.draconicAxe2.txt")); - // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.draconicAxe3.txt")); - // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.draconicAxe4.txt")); - // InfoHelper.addLore(stack, list); + // if (InfoHelper.holdShiftForDetails(list)){ + // InfoHelper.addEnergyInfo(stack, list); + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.draconicAxe2.txt")); + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.draconicAxe3.txt")); + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.draconicAxe4.txt")); + // InfoHelper.addLore(stack, list); // - // }else list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.draconicAxe1.txt")); - // } + // }else list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.draconicAxe1.txt")); + // } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicDistructionStaff.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicDistructionStaff.java index 5e3bd50a..8d5be87b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicDistructionStaff.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicDistructionStaff.java @@ -1,5 +1,20 @@ package com.brandon3055.draconicevolution.common.items.tools; +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnumEnchantmentType; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; +import net.minecraftforge.client.IItemRenderer; + +import org.lwjgl.opengl.GL11; + import com.brandon3055.brandonscore.common.utills.InfoHelper; import com.brandon3055.draconicevolution.client.render.IRenderTweak; import com.brandon3055.draconicevolution.common.ModItems; @@ -13,20 +28,9 @@ import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; import com.brandon3055.draconicevolution.common.utills.IInventoryTool; import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import java.util.List; -import net.minecraft.block.Block; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnumEnchantmentType; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; -import net.minecraftforge.client.IItemRenderer; -import org.lwjgl.opengl.GL11; public class DraconicDistructionStaff extends MiningTool implements IInventoryTool, IRenderTweak, IEnergyContainerWeaponItem { @@ -55,17 +59,18 @@ public class DraconicDistructionStaff extends MiningTool @Override public List getFields(ItemStack stack, int slot) { List list = super.getFields(stack, slot); - list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_AOE) - .setMinMaxAndIncromente(0, EnumUpgrade.DIG_AOE.getUpgradePoints(stack), 1) - .readFromItem(stack, 0) - .setModifier("AOE")); - list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_DEPTH) - .setMinMaxAndIncromente(1, EnumUpgrade.DIG_DEPTH.getUpgradePoints(stack), 1) - .readFromItem(stack, 1)); - list.add(new ItemConfigField(References.INT_ID, slot, References.ATTACK_AOE) - .setMinMaxAndIncromente(0, EnumUpgrade.ATTACK_AOE.getUpgradePoints(stack), 1) - .readFromItem(stack, 1) - .setModifier("AOE")); + list.add( + new ItemConfigField(References.INT_ID, slot, References.DIG_AOE) + .setMinMaxAndIncromente(0, EnumUpgrade.DIG_AOE.getUpgradePoints(stack), 1) + .readFromItem(stack, 0).setModifier("AOE")); + list.add( + new ItemConfigField(References.INT_ID, slot, References.DIG_DEPTH) + .setMinMaxAndIncromente(1, EnumUpgrade.DIG_DEPTH.getUpgradePoints(stack), 1) + .readFromItem(stack, 1)); + list.add( + new ItemConfigField(References.INT_ID, slot, References.ATTACK_AOE) + .setMinMaxAndIncromente(0, EnumUpgrade.ATTACK_AOE.getUpgradePoints(stack), 1) + .readFromItem(stack, 1).setModifier("AOE")); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, References.OBLITERATE).readFromItem(stack, false)); return list; } @@ -90,7 +95,10 @@ public class DraconicDistructionStaff extends MiningTool entity.hurtResistantTime = 0; ToolHandler.damageEntityBasedOnHealth(entity, player, 0.3F); ToolHandler.AOEAttack( - player, entity, stack, IConfigurableItem.ProfileHelper.getInteger(stack, References.ATTACK_AOE, 0)); + player, + entity, + stack, + IConfigurableItem.ProfileHelper.getInteger(stack, References.ATTACK_AOE, 0)); return true; } @@ -105,10 +113,15 @@ public class DraconicDistructionStaff extends MiningTool super.addInformation(stack, player, list, extended); list.add(""); - list.add(EnumChatFormatting.BLUE + "+" + ToolHandler.getBaseAttackDamage(stack) + " " - + StatCollector.translateToLocal("info.de.attackDamage.txt")); - list.add(EnumChatFormatting.BLUE + "+30%" + " " - + StatCollector.translateToLocal("info.de.bonusHealthDamage.txt")); + list.add( + EnumChatFormatting.BLUE + "+" + + ToolHandler.getBaseAttackDamage(stack) + + " " + + StatCollector.translateToLocal("info.de.attackDamage.txt")); + list.add( + EnumChatFormatting.BLUE + "+30%" + + " " + + StatCollector.translateToLocal("info.de.bonusHealthDamage.txt")); } @Override @@ -180,11 +193,9 @@ public class DraconicDistructionStaff extends MiningTool @Override public int getCapacity(ItemStack stack) { int points = IUpgradableItem.EnumUpgrade.RF_CAPACITY.getUpgradePoints(stack); - return BalanceConfigHandler.draconicToolsBaseStorage * 2 - + BalanceConfigHandler.draconicWeaponsBaseStorage - + points - * (BalanceConfigHandler.draconicToolsStoragePerUpgrade - + BalanceConfigHandler.draconicWeaponsStoragePerUpgrade); + return BalanceConfigHandler.draconicToolsBaseStorage * 2 + BalanceConfigHandler.draconicWeaponsBaseStorage + + points * (BalanceConfigHandler.draconicToolsStoragePerUpgrade + + BalanceConfigHandler.draconicWeaponsStoragePerUpgrade); } @Override @@ -200,8 +211,11 @@ public class DraconicDistructionStaff extends MiningTool @Override public List getUpgradeStats(ItemStack stack) { List list = super.getUpgradeStats(stack); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.attackDamage.txt") + ": " - + InfoHelper.HITC() + ToolHandler.getBaseAttackDamage(stack)); + list.add( + InfoHelper.ITC() + StatCollector.translateToLocal("info.de.attackDamage.txt") + + ": " + + InfoHelper.HITC() + + ToolHandler.getBaseAttackDamage(stack)); return list; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicHoe.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicHoe.java index 20b6ffe4..1e37d67c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicHoe.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicHoe.java @@ -1,24 +1,8 @@ package com.brandon3055.draconicevolution.common.items.tools; -import cofh.api.energy.IEnergyContainerItem; -import com.brandon3055.brandonscore.common.utills.InfoHelper; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.brandonscore.common.utills.Utills; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.client.render.IRenderTweak; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem; -import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; -import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolBase; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.utills.*; -import cpw.mods.fml.common.eventhandler.Event.Result; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.List; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -35,8 +19,29 @@ import net.minecraft.world.World; import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.UseHoeEvent; + import org.lwjgl.opengl.GL11; +import cofh.api.energy.IEnergyContainerItem; + +import com.brandon3055.brandonscore.common.utills.InfoHelper; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.brandonscore.common.utills.Utills; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.client.render.IRenderTweak; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem; +import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; +import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolBase; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.utills.*; + +import cpw.mods.fml.common.eventhandler.Event.Result; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class DraconicHoe extends ItemHoe implements IEnergyContainerItem, IRenderTweak, IUpgradableItem, IConfigurableItem, IHudDisplayItem { @@ -59,10 +64,10 @@ public class DraconicHoe extends ItemHoe @Override public List getFields(ItemStack stack, int slot) { List list = new ArrayList(); - list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_AOE) - .setMinMaxAndIncromente(0, EnumUpgrade.DIG_AOE.getUpgradePoints(stack), 1) - .readFromItem(stack, 0) - .setModifier("AOE")); + list.add( + new ItemConfigField(References.INT_ID, slot, References.DIG_AOE) + .setMinMaxAndIncromente(0, EnumUpgrade.DIG_AOE.getUpgradePoints(stack), 1) + .readFromItem(stack, 0).setModifier("AOE")); return list; } @@ -100,21 +105,11 @@ public class DraconicHoe extends ItemHoe } @Override - public boolean onItemUse( - ItemStack stack, - EntityPlayer player, - World world, - int x, - int y, - int z, - int par7, - float par8, - float par9, - float par10) { + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, + float par8, float par9, float par10) { boolean successfull = false; Block clicked = world.getBlock(x, y, z); - if (!player.isSneaking() - && player.canPlayerEdit(x, y, z, par7, stack) + if (!player.isSneaking() && player.canPlayerEdit(x, y, z, par7, stack) && (clicked == Blocks.dirt || clicked == Blocks.grass || clicked == Blocks.farmland) && par7 == 1) { int size = IConfigurableItem.ProfileHelper.getInteger(stack, References.DIG_AOE, 0); @@ -135,8 +130,7 @@ public class DraconicHoe extends ItemHoe world.setBlockToAir(x + x1, y + 2, z + z1); } Block block = world.getBlock(x + x1, y, z + z1); - if (block.isReplaceable(world, x + x1, y, z + z1) - && !block.getMaterial().equals(Material.water)) { + if (block.isReplaceable(world, x + x1, y, z + z1) && !block.getMaterial().equals(Material.water)) { world.setBlockToAir(x + x1, y, z + z1); } @@ -150,16 +144,16 @@ public class DraconicHoe extends ItemHoe } if ((world.getBlock(x + x1, y + 1, z + z1) == Blocks.dirt - || world.getBlock(x + x1, y + 1, z + z1) == Blocks.grass - || world.getBlock(x + x1, y + 1, z + z1) == Blocks.farmland) + || world.getBlock(x + x1, y + 1, z + z1) == Blocks.grass + || world.getBlock(x + x1, y + 1, z + z1) == Blocks.farmland) && world.getBlock(x + x1, y + 2, z + z1) == Blocks.air) { - if (!world.isRemote) - world.spawnEntityInWorld(new EntityItem( - world, - player.posX, - player.posY, - player.posZ, - new ItemStack(Item.getItemFromBlock(Blocks.dirt)))); + if (!world.isRemote) world.spawnEntityInWorld( + new EntityItem( + world, + player.posX, + player.posY, + player.posZ, + new ItemStack(Item.getItemFromBlock(Blocks.dirt)))); world.setBlock(x + x1, y + 1, z + z1, Blocks.air); } @@ -168,14 +162,13 @@ public class DraconicHoe extends ItemHoe } } else successfull = hoe(stack, player, world, x, y, z, par7); Block block1 = Blocks.farmland; - if (successfull) - world.playSoundEffect( - x + 0.5F, - y + 0.5F, - z + 0.5F, - block1.stepSound.getStepResourcePath(), - (block1.stepSound.getVolume() + 1.0F) / 2.0F, - block1.stepSound.getPitch() * 0.8F); + if (successfull) world.playSoundEffect( + x + 0.5F, + y + 0.5F, + z + 0.5F, + block1.stepSound.getStepResourcePath(), + (block1.stepSound.getVolume() + 1.0F) / 2.0F, + block1.stepSound.getPitch() * 0.8F); return successfull; } @@ -185,9 +178,8 @@ public class DraconicHoe extends ItemHoe < BalanceConfigHandler.draconicToolsEnergyPerAction) { if (!player.capabilities.isCreativeMode) return false; } else { - if (!player.capabilities.isCreativeMode) - ((IEnergyContainerItem) stack.getItem()) - .extractEnergy(stack, BalanceConfigHandler.draconicToolsEnergyPerAction, false); + if (!player.capabilities.isCreativeMode) ((IEnergyContainerItem) stack.getItem()) + .extractEnergy(stack, BalanceConfigHandler.draconicToolsEnergyPerAction, false); } if (!player.canPlayerEdit(x, y, z, par7, stack)) { return false; @@ -204,8 +196,7 @@ public class DraconicHoe extends ItemHoe Block block = world.getBlock(x, y, z); - if (par7 != 0 - && world.getBlock(x, y + 1, z).isAir(world, x, y + 1, z) + if (par7 != 0 && world.getBlock(x, y + 1, z).isAir(world, x, y + 1, z) && (block == Blocks.grass || block == Blocks.dirt)) { Block block1 = Blocks.farmland; @@ -223,8 +214,8 @@ public class DraconicHoe extends ItemHoe } @Override - public void addInformation( - final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) { + public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, + final boolean extraInformation) { InfoHelper.addEnergyInfo(stack, list); ToolBase.holdCTRLForUpgrades(list, stack); InfoHelper.addLore(stack, list); @@ -310,6 +301,7 @@ public class DraconicHoe extends ItemHoe @Override public List getUpgrades(ItemStack itemstack) { return new ArrayList() { + { add(EnumUpgrade.RF_CAPACITY); add(EnumUpgrade.DIG_AOE); @@ -359,11 +351,20 @@ public class DraconicHoe extends ItemHoe for (ItemConfigField field : getFields(itemstack, 0)) if (field.name.equals(References.DIG_AOE)) digaoe = 1 + ((Integer) field.max * 2); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " - + InfoHelper.HITC() + Utills.formatNumber(getMaxEnergyStored(itemstack))); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " - + StatCollector.translateToLocal("gui.de.DigAOE.txt") + ": " + InfoHelper.HITC() + digaoe + "x" - + digaoe); + strings.add( + InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + + ": " + + InfoHelper.HITC() + + Utills.formatNumber(getMaxEnergyStored(itemstack))); + strings.add( + InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + + " " + + StatCollector.translateToLocal("gui.de.DigAOE.txt") + + ": " + + InfoHelper.HITC() + + digaoe + + "x" + + digaoe); return strings; } @@ -377,10 +378,16 @@ public class DraconicHoe extends ItemHoe public List getDisplayData(ItemStack stack) { List list = new ArrayList(); - for (ItemConfigField field : getFields(stack, 0)) - list.add(field.getTooltipInfo()); // list.add(field.getLocalizedName() + ": " + field.getFormattedValue()); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.HITC() - + Utills.formatNumber(getEnergyStored(stack)) + " / " + Utills.formatNumber(capacity)); + for (ItemConfigField field : getFields(stack, 0)) list.add(field.getTooltipInfo()); // list.add(field.getLocalizedName() + // + ": " + + // field.getFormattedValue()); + list.add( + InfoHelper.ITC() + StatCollector.translateToLocal("info.de.charge.txt") + + ": " + + InfoHelper.HITC() + + Utills.formatNumber(getEnergyStored(stack)) + + " / " + + Utills.formatNumber(capacity)); return list; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicPickaxe.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicPickaxe.java index 29386cbb..523c3c48 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicPickaxe.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicPickaxe.java @@ -1,5 +1,15 @@ package com.brandon3055.draconicevolution.common.items.tools; +import java.util.List; + +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnumEnchantmentType; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; +import net.minecraftforge.client.IItemRenderer; + +import org.lwjgl.opengl.GL11; + import com.brandon3055.draconicevolution.client.render.IRenderTweak; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; @@ -9,13 +19,6 @@ import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.utills.IInventoryTool; import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; -import java.util.List; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnumEnchantmentType; -import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; -import net.minecraftforge.client.IItemRenderer; -import org.lwjgl.opengl.GL11; public class DraconicPickaxe extends MiningTool implements IInventoryTool, IRenderTweak { @@ -33,13 +36,14 @@ public class DraconicPickaxe extends MiningTool implements IInventoryTool, IRend @Override public List getFields(ItemStack stack, int slot) { List list = super.getFields(stack, slot); - list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_AOE) - .setMinMaxAndIncromente(0, EnumUpgrade.DIG_AOE.getUpgradePoints(stack), 1) - .readFromItem(stack, 0) - .setModifier("AOE")); - list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_DEPTH) - .setMinMaxAndIncromente(1, EnumUpgrade.DIG_DEPTH.getUpgradePoints(stack), 1) - .readFromItem(stack, 1)); + list.add( + new ItemConfigField(References.INT_ID, slot, References.DIG_AOE) + .setMinMaxAndIncromente(0, EnumUpgrade.DIG_AOE.getUpgradePoints(stack), 1) + .readFromItem(stack, 0).setModifier("AOE")); + list.add( + new ItemConfigField(References.INT_ID, slot, References.DIG_DEPTH) + .setMinMaxAndIncromente(1, EnumUpgrade.DIG_DEPTH.getUpgradePoints(stack), 1) + .readFromItem(stack, 1)); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, References.OBLITERATE).readFromItem(stack, false)); return list; } @@ -130,185 +134,185 @@ public class DraconicPickaxe extends MiningTool implements IInventoryTool, IRend return 0; } - // @Override - // public boolean isItemTool(ItemStack p_77616_1_) { - // return true; - // } + // @Override + // public boolean isItemTool(ItemStack p_77616_1_) { + // return true; + // } // - // @SideOnly(Side.CLIENT) - // @SuppressWarnings("unchecked") - // @Override - // public void getSubItems(Item item, CreativeTabs tab, List list) { - // list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", 0)); - // list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", capacity)); - // } + // @SideOnly(Side.CLIENT) + // @SuppressWarnings("unchecked") + // @Override + // public void getSubItems(Item item, CreativeTabs tab, List list) { + // list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", 0)); + // list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", capacity)); + // } // - // @Override - // public String getUnlocalizedName(){ + // @Override + // public String getUnlocalizedName(){ // - // return String.format("item.%s%s", References.MODID.toLowerCase() + ":", + // return String.format("item.%s%s", References.MODID.toLowerCase() + ":", // super.getUnlocalizedName().substring(super.getUnlocalizedName().indexOf(".") + 1)); - // } + // } // - // @Override - // public String getUnlocalizedName(final ItemStack itemStack){ - // return getUnlocalizedName(); - // } + // @Override + // public String getUnlocalizedName(final ItemStack itemStack){ + // return getUnlocalizedName(); + // } // - // @Override - // @SideOnly(Side.CLIENT) - // public void registerIcons(final IIconRegister iconRegister) - // { - // this.itemIcon0 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_pick"); - // this.itemIcon1 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_pick_active"); - // this.itemIcon2 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_pick_obliterate"); - // } + // @Override + // @SideOnly(Side.CLIENT) + // public void registerIcons(final IIconRegister iconRegister) + // { + // this.itemIcon0 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_pick"); + // this.itemIcon1 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_pick_active"); + // this.itemIcon2 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_pick_obliterate"); + // } // - // @Override - // @SideOnly(Side.CLIENT) - // public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) - // { - // if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0 && ItemNBTHelper.getBoolean(stack, "obliterate", false)) - // return itemIcon2; - // else if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) - // return itemIcon1; - // else - // return itemIcon0; - // } + // @Override + // @SideOnly(Side.CLIENT) + // public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) + // { + // if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0 && ItemNBTHelper.getBoolean(stack, "obliterate", false)) + // return itemIcon2; + // else if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) + // return itemIcon1; + // else + // return itemIcon0; + // } // - // @Override - // @SideOnly(Side.CLIENT) - // public IIcon getIconIndex(ItemStack stack) - // { - // if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0 && ItemNBTHelper.getBoolean(stack, "obliterate", false)) - // return itemIcon2; - // else if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) - // return itemIcon1; - // else - // return itemIcon0; - // } + // @Override + // @SideOnly(Side.CLIENT) + // public IIcon getIconIndex(ItemStack stack) + // { + // if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0 && ItemNBTHelper.getBoolean(stack, "obliterate", false)) + // return itemIcon2; + // else if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) + // return itemIcon1; + // else + // return itemIcon0; + // } // - // @Override - // public boolean onBlockStartBreak(final ItemStack stack, final int x, final int y, final int z, final EntityPlayer + // @Override + // public boolean onBlockStartBreak(final ItemStack stack, final int x, final int y, final int z, final EntityPlayer // player) - // { - // World world = player.worldObj; - // Block block = world.getBlock(x, y, z); - // Material mat = block.getMaterial(); - // if (!ToolHandler.isRightMaterial(mat, ToolHandler.materialsPick)) { - // return false; - // } - // int fortune = EnchantmentHelper.getFortuneModifier(player); - // boolean silk = EnchantmentHelper.getSilkTouchModifier(player); - // ToolHandler.disSquare(x, y, z, player, world, silk, fortune, ToolHandler.materialsPick, stack); - // return false; - // } + // { + // World world = player.worldObj; + // Block block = world.getBlock(x, y, z); + // Material mat = block.getMaterial(); + // if (!ToolHandler.isRightMaterial(mat, ToolHandler.materialsPick)) { + // return false; + // } + // int fortune = EnchantmentHelper.getFortuneModifier(player); + // boolean silk = EnchantmentHelper.getSilkTouchModifier(player); + // ToolHandler.disSquare(x, y, z, player, world, silk, fortune, ToolHandler.materialsPick, stack); + // return false; + // } // - // @Override - // public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer player) - // { - // return ToolHandler.changeMode(stack, player, true, 3); - // } + // @Override + // public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer player) + // { + // return ToolHandler.changeMode(stack, player, true, 3); + // } // - // @SuppressWarnings({ "rawtypes", "unchecked" }) - // @Override - // public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean + // @SuppressWarnings({ "rawtypes", "unchecked" }) + // @Override + // public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean // extraInformation) - // { - // int size = (ItemNBTHelper.getShort(stack, "size", (short) 0) * 2) + 1; - // boolean oblit = ItemNBTHelper.getBoolean(stack, "obliterate", false); - // if (InfoHelper.holdShiftForDetails(list)){ - // InfoHelper.addEnergyInfo(stack, list); + // { + // int size = (ItemNBTHelper.getShort(stack, "size", (short) 0) * 2) + 1; + // boolean oblit = ItemNBTHelper.getBoolean(stack, "obliterate", false); + // if (InfoHelper.holdShiftForDetails(list)){ + // InfoHelper.addEnergyInfo(stack, list); // - // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.miningMode.txt") + ": " + InfoHelper.HITC() + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.miningMode.txt") + ": " + InfoHelper.HITC() // + size + "x" + size); - // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.changeMiningMode.txt")); - // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.obliterationMode.txt") + ": " + + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.changeMiningMode.txt")); + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.obliterationMode.txt") + ": " + // InfoHelper.HITC() + StatCollector.translateToLocal("info.de.obliterationMode"+oblit+".txt")); - // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.toggleOblit.txt")); - // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.oblitInfo.txt")); + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.toggleOblit.txt")); + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.oblitInfo.txt")); // - // InfoHelper.addLore(stack, list); - // } - // } + // InfoHelper.addLore(stack, list); + // } + // } // - // @Override - // public EnumRarity getRarity(ItemStack stack) - // { - // return EnumRarity.rare; - // } + // @Override + // public EnumRarity getRarity(ItemStack stack) + // { + // return EnumRarity.rare; + // } // - // @Override - // public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) { + // @Override + // public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) { // - // if (container.stackTagCompound == null) { - // container.stackTagCompound = new NBTTagCompound(); - // } - // int energy = container.stackTagCompound.getInteger("Energy"); - // int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive)); + // if (container.stackTagCompound == null) { + // container.stackTagCompound = new NBTTagCompound(); + // } + // int energy = container.stackTagCompound.getInteger("Energy"); + // int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive)); // - // if (!simulate) { - // energy += energyReceived; - // container.stackTagCompound.setInteger("Energy", energy); - // } - // return energyReceived; - // } + // if (!simulate) { + // energy += energyReceived; + // container.stackTagCompound.setInteger("Energy", energy); + // } + // return energyReceived; + // } // - // @Override - // public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) { + // @Override + // public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) { // - // if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { - // return 0; - // } - // int energy = container.stackTagCompound.getInteger("Energy"); - // int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); + // if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { + // return 0; + // } + // int energy = container.stackTagCompound.getInteger("Energy"); + // int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); // - // if (!simulate) { - // energy -= energyExtracted; - // container.stackTagCompound.setInteger("Energy", energy); - // } - // return energyExtracted; - // } + // if (!simulate) { + // energy -= energyExtracted; + // container.stackTagCompound.setInteger("Energy", energy); + // } + // return energyExtracted; + // } // - // @Override - // public int getEnergyStored(ItemStack container) { - // if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { - // return 0; - // } - // return container.stackTagCompound.getInteger("Energy"); - // } + // @Override + // public int getEnergyStored(ItemStack container) { + // if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { + // return 0; + // } + // return container.stackTagCompound.getInteger("Energy"); + // } // - // @Override - // public int getMaxEnergyStored(ItemStack container) { - // return capacity; - // } + // @Override + // public int getMaxEnergyStored(ItemStack container) { + // return capacity; + // } // - // @Override - // public boolean showDurabilityBar(ItemStack stack) { - // return !(getEnergyStored(stack) == getMaxEnergyStored(stack)); - // } + // @Override + // public boolean showDurabilityBar(ItemStack stack) { + // return !(getEnergyStored(stack) == getMaxEnergyStored(stack)); + // } // - // @Override - // public double getDurabilityForDisplay(ItemStack stack) { - // return 1D - ((double)getEnergyStored(stack) / (double)getMaxEnergyStored(stack)); - // } + // @Override + // public double getDurabilityForDisplay(ItemStack stack) { + // return 1D - ((double)getEnergyStored(stack) / (double)getMaxEnergyStored(stack)); + // } // - // @Override - // public float getDigSpeed(ItemStack stack, Block block, int meta) { - // if ((stack.getItem() instanceof IEnergyContainerItem) && + // @Override + // public float getDigSpeed(ItemStack stack, Block block, int meta) { + // if ((stack.getItem() instanceof IEnergyContainerItem) && // ((IEnergyContainerItem)stack.getItem()).getEnergyStored(stack) >= energyPerOperation) - // return super.getDigSpeed(stack, block, meta); - // else - // return 1F; - // } + // return super.getDigSpeed(stack, block, meta); + // else + // return 1F; + // } // - // @Override - // public boolean hasCustomEntity(ItemStack stack) { - // return true; - // } + // @Override + // public boolean hasCustomEntity(ItemStack stack) { + // return true; + // } // - // @Override - // public Entity createEntity(World world, Entity location, ItemStack itemstack) { - // return new EntityPersistentItem(world, location, itemstack); - // } + // @Override + // public Entity createEntity(World world, Entity location, ItemStack itemstack) { + // return new EntityPersistentItem(world, location, itemstack); + // } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicShovel.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicShovel.java index 91877bde..47a5d478 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicShovel.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconicShovel.java @@ -1,5 +1,15 @@ package com.brandon3055.draconicevolution.common.items.tools; +import java.util.List; + +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnumEnchantmentType; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; +import net.minecraftforge.client.IItemRenderer; + +import org.lwjgl.opengl.GL11; + import com.brandon3055.draconicevolution.client.render.IRenderTweak; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; @@ -9,18 +19,11 @@ import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.utills.IInventoryTool; import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; -import java.util.List; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnumEnchantmentType; -import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; -import net.minecraftforge.client.IItemRenderer; -import org.lwjgl.opengl.GL11; public class DraconicShovel extends MiningTool implements IInventoryTool, IRenderTweak { - // public IIcon itemIcon0; - // public IIcon itemIcon1; - // public IIcon itemIcon2; + // public IIcon itemIcon0; + // public IIcon itemIcon1; + // public IIcon itemIcon2; public DraconicShovel() { super(ModItems.AWAKENED); @@ -36,13 +39,14 @@ public class DraconicShovel extends MiningTool implements IInventoryTool, IRende @Override public List getFields(ItemStack stack, int slot) { List list = super.getFields(stack, slot); - list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_AOE) - .setMinMaxAndIncromente(0, EnumUpgrade.DIG_AOE.getUpgradePoints(stack), 1) - .readFromItem(stack, 0) - .setModifier("AOE")); - list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_DEPTH) - .setMinMaxAndIncromente(1, EnumUpgrade.DIG_DEPTH.getUpgradePoints(stack), 1) - .readFromItem(stack, 1)); + list.add( + new ItemConfigField(References.INT_ID, slot, References.DIG_AOE) + .setMinMaxAndIncromente(0, EnumUpgrade.DIG_AOE.getUpgradePoints(stack), 1) + .readFromItem(stack, 0).setModifier("AOE")); + list.add( + new ItemConfigField(References.INT_ID, slot, References.DIG_DEPTH) + .setMinMaxAndIncromente(1, EnumUpgrade.DIG_DEPTH.getUpgradePoints(stack), 1) + .readFromItem(stack, 1)); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, References.OBLITERATE).readFromItem(stack, false)); return list; } @@ -134,190 +138,190 @@ public class DraconicShovel extends MiningTool implements IInventoryTool, IRende } return 0; } - // @Override - // public boolean isItemTool(ItemStack p_77616_1_) { - // return true; - // } + // @Override + // public boolean isItemTool(ItemStack p_77616_1_) { + // return true; + // } // - // @SideOnly(Side.CLIENT) - // @SuppressWarnings("unchecked") - // @Override - // public void getSubItems(Item item, CreativeTabs tab, List list) { - // list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", 0)); - // list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", capacity)); - // } + // @SideOnly(Side.CLIENT) + // @SuppressWarnings("unchecked") + // @Override + // public void getSubItems(Item item, CreativeTabs tab, List list) { + // list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", 0)); + // list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", capacity)); + // } // - // @Override - // public String getUnlocalizedName(){ + // @Override + // public String getUnlocalizedName(){ // - // return String.format("item.%s%s", References.MODID.toLowerCase() + ":", + // return String.format("item.%s%s", References.MODID.toLowerCase() + ":", // super.getUnlocalizedName().substring(super.getUnlocalizedName().indexOf(".") + 1)); - // } + // } // - // @Override - // public String getUnlocalizedName(final ItemStack itemStack){ - // return getUnlocalizedName(); - // } + // @Override + // public String getUnlocalizedName(final ItemStack itemStack){ + // return getUnlocalizedName(); + // } // - // @Override - // @SideOnly(Side.CLIENT) - // public void registerIcons(final IIconRegister iconRegister) - // { - // this.itemIcon0 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_shovel"); - // this.itemIcon1 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_shovel_active"); - // this.itemIcon2 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_shovel_obliterate"); - // } + // @Override + // @SideOnly(Side.CLIENT) + // public void registerIcons(final IIconRegister iconRegister) + // { + // this.itemIcon0 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_shovel"); + // this.itemIcon1 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_shovel_active"); + // this.itemIcon2 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_shovel_obliterate"); + // } // - // @Override - // @SideOnly(Side.CLIENT) - // public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) - // { - // if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0 && ItemNBTHelper.getBoolean(stack, "obliterate", false)) - // return itemIcon2; - // else if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) - // return itemIcon1; - // else - // return itemIcon0; - // } + // @Override + // @SideOnly(Side.CLIENT) + // public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) + // { + // if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0 && ItemNBTHelper.getBoolean(stack, "obliterate", false)) + // return itemIcon2; + // else if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) + // return itemIcon1; + // else + // return itemIcon0; + // } // - // @Override - // @SideOnly(Side.CLIENT) - // public IIcon getIconIndex(ItemStack stack) - // { - // if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0 && ItemNBTHelper.getBoolean(stack, "obliterate", false)) - // return itemIcon2; - // else if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) - // return itemIcon1; - // else - // return itemIcon0; - // } + // @Override + // @SideOnly(Side.CLIENT) + // public IIcon getIconIndex(ItemStack stack) + // { + // if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0 && ItemNBTHelper.getBoolean(stack, "obliterate", false)) + // return itemIcon2; + // else if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) + // return itemIcon1; + // else + // return itemIcon0; + // } // - // @Override - // public boolean onBlockStartBreak(final ItemStack stack, final int x, final int y, final int z, final EntityPlayer + // @Override + // public boolean onBlockStartBreak(final ItemStack stack, final int x, final int y, final int z, final EntityPlayer // player) - // { - // World world = player.worldObj; - // Block block = world.getBlock(x, y, z); - // Material mat = block.getMaterial(); - // if (!ToolHandler.isRightMaterial(mat, ToolHandler.materialsShovel)) { - // return false; - // } - // int fortune = EnchantmentHelper.getFortuneModifier(player); - // boolean silk = EnchantmentHelper.getSilkTouchModifier(player); - // ToolHandler.disSquare(x, y, z, player, world, silk, fortune, ToolHandler.materialsShovel, stack); - // return false; - // } + // { + // World world = player.worldObj; + // Block block = world.getBlock(x, y, z); + // Material mat = block.getMaterial(); + // if (!ToolHandler.isRightMaterial(mat, ToolHandler.materialsShovel)) { + // return false; + // } + // int fortune = EnchantmentHelper.getFortuneModifier(player); + // boolean silk = EnchantmentHelper.getSilkTouchModifier(player); + // ToolHandler.disSquare(x, y, z, player, world, silk, fortune, ToolHandler.materialsShovel, stack); + // return false; + // } // - // @Override - // public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer player) - // { - // return ToolHandler.changeMode(stack, player, true, 3); - // } + // @Override + // public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer player) + // { + // return ToolHandler.changeMode(stack, player, true, 3); + // } // - // public static int getMode(final ItemStack tool) - // { - // return tool.getItemDamage(); - // } + // public static int getMode(final ItemStack tool) + // { + // return tool.getItemDamage(); + // } // - // @SuppressWarnings({ "rawtypes", "unchecked" }) - // @Override - // public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean + // @SuppressWarnings({ "rawtypes", "unchecked" }) + // @Override + // public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean // extraInformation) - // { - // int size = (ItemNBTHelper.getShort(stack, "size", (short) 0) * 2) + 1; - // boolean oblit = ItemNBTHelper.getBoolean(stack, "obliterate", false); - // if (InfoHelper.holdShiftForDetails(list)){ - // InfoHelper.addEnergyInfo(stack, list); + // { + // int size = (ItemNBTHelper.getShort(stack, "size", (short) 0) * 2) + 1; + // boolean oblit = ItemNBTHelper.getBoolean(stack, "obliterate", false); + // if (InfoHelper.holdShiftForDetails(list)){ + // InfoHelper.addEnergyInfo(stack, list); // - // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.miningMode.txt") + ": " + InfoHelper.HITC() + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.miningMode.txt") + ": " + InfoHelper.HITC() // + size + "x" + size); - // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.changeMiningMode.txt")); - // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.obliterationMode.txt") + ": " + + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.changeMiningMode.txt")); + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.obliterationMode.txt") + ": " + // InfoHelper.HITC() + StatCollector.translateToLocal("info.de.obliterationMode"+oblit+".txt")); - // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.toggleOblit.txt")); - // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.oblitInfo.txt")); + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.toggleOblit.txt")); + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.oblitInfo.txt")); // - // InfoHelper.addLore(stack, list); - // } - // } + // InfoHelper.addLore(stack, list); + // } + // } // - // @Override - // public EnumRarity getRarity(ItemStack stack) - // { - // return EnumRarity.rare; - // } + // @Override + // public EnumRarity getRarity(ItemStack stack) + // { + // return EnumRarity.rare; + // } // - // @Override - // public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) { + // @Override + // public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) { // - // if (container.stackTagCompound == null) { - // container.stackTagCompound = new NBTTagCompound(); - // } - // int energy = container.stackTagCompound.getInteger("Energy"); - // int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive)); + // if (container.stackTagCompound == null) { + // container.stackTagCompound = new NBTTagCompound(); + // } + // int energy = container.stackTagCompound.getInteger("Energy"); + // int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive)); // - // if (!simulate) { - // energy += energyReceived; - // container.stackTagCompound.setInteger("Energy", energy); - // } - // return energyReceived; - // } + // if (!simulate) { + // energy += energyReceived; + // container.stackTagCompound.setInteger("Energy", energy); + // } + // return energyReceived; + // } // - // @Override - // public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) { + // @Override + // public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) { // - // if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { - // return 0; - // } - // int energy = container.stackTagCompound.getInteger("Energy"); - // int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); + // if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { + // return 0; + // } + // int energy = container.stackTagCompound.getInteger("Energy"); + // int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); // - // if (!simulate) { - // energy -= energyExtracted; - // container.stackTagCompound.setInteger("Energy", energy); - // } - // return energyExtracted; - // } + // if (!simulate) { + // energy -= energyExtracted; + // container.stackTagCompound.setInteger("Energy", energy); + // } + // return energyExtracted; + // } // - // @Override - // public int getEnergyStored(ItemStack container) { - // if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { - // return 0; - // } - // return container.stackTagCompound.getInteger("Energy"); - // } + // @Override + // public int getEnergyStored(ItemStack container) { + // if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { + // return 0; + // } + // return container.stackTagCompound.getInteger("Energy"); + // } // - // @Override - // public int getMaxEnergyStored(ItemStack container) { - // return capacity; - // } + // @Override + // public int getMaxEnergyStored(ItemStack container) { + // return capacity; + // } // - // @Override - // public boolean showDurabilityBar(ItemStack stack) { - // return !(getEnergyStored(stack) == getMaxEnergyStored(stack)); - // } + // @Override + // public boolean showDurabilityBar(ItemStack stack) { + // return !(getEnergyStored(stack) == getMaxEnergyStored(stack)); + // } // - // @Override - // public double getDurabilityForDisplay(ItemStack stack) { - // return 1D - ((double)getEnergyStored(stack) / (double)getMaxEnergyStored(stack)); - // } + // @Override + // public double getDurabilityForDisplay(ItemStack stack) { + // return 1D - ((double)getEnergyStored(stack) / (double)getMaxEnergyStored(stack)); + // } // - // @Override - // public float getDigSpeed(ItemStack stack, Block block, int meta) { - // if ((stack.getItem() instanceof IEnergyContainerItem) && + // @Override + // public float getDigSpeed(ItemStack stack, Block block, int meta) { + // if ((stack.getItem() instanceof IEnergyContainerItem) && // ((IEnergyContainerItem)stack.getItem()).getEnergyStored(stack) >= References.ENERGYPERBLOCK) - // return super.getDigSpeed(stack, block, meta); - // else - // return 1F; - // } + // return super.getDigSpeed(stack, block, meta); + // else + // return 1F; + // } // - // @Override - // public boolean hasCustomEntity(ItemStack stack) { - // return true; - // } + // @Override + // public boolean hasCustomEntity(ItemStack stack) { + // return true; + // } // - // @Override - // public Entity createEntity(World world, Entity location, ItemStack itemstack) { - // return new EntityPersistentItem(world, location, itemstack); - // } + // @Override + // public Entity createEntity(World world, Entity location, ItemStack itemstack) { + // return new EntityPersistentItem(world, location, itemstack); + // } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconiumFluxCapacitor.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconiumFluxCapacitor.java index 298ec61f..60ebf599 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconiumFluxCapacitor.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/DraconiumFluxCapacitor.java @@ -1,20 +1,8 @@ package com.brandon3055.draconicevolution.common.items.tools; -import cofh.api.energy.IEnergyContainerItem; -import com.brandon3055.brandonscore.common.utills.InfoHelper; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.brandonscore.common.utills.Utills; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; -import com.brandon3055.draconicevolution.common.items.tools.baseclasses.RFItemBase; -import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolBase; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.List; + import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; @@ -26,10 +14,27 @@ import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; +import cofh.api.energy.IEnergyContainerItem; + +import com.brandon3055.brandonscore.common.utills.InfoHelper; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.brandonscore.common.utills.Utills; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; +import com.brandon3055.draconicevolution.common.items.tools.baseclasses.RFItemBase; +import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolBase; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 24/11/2014. */ public class DraconiumFluxCapacitor extends RFItemBase implements IUpgradableItem { + IIcon[] icons = new IIcon[2]; public DraconiumFluxCapacitor() { @@ -57,11 +62,17 @@ public class DraconiumFluxCapacitor extends RFItemBase implements IUpgradableIte @Override public void getSubItems(Item item, CreativeTabs tab, List list) { list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", 0)); - list.add(ItemNBTHelper.setInteger( - new ItemStack(item, 1, 0), "Energy", BalanceConfigHandler.wyvernCapacitorBaseStorage)); + list.add( + ItemNBTHelper.setInteger( + new ItemStack(item, 1, 0), + "Energy", + BalanceConfigHandler.wyvernCapacitorBaseStorage)); list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 1), "Energy", 0)); - list.add(ItemNBTHelper.setInteger( - new ItemStack(item, 1, 1), "Energy", BalanceConfigHandler.draconicCapacitorBaseStorage)); + list.add( + ItemNBTHelper.setInteger( + new ItemStack(item, 1, 1), + "Energy", + BalanceConfigHandler.draconicCapacitorBaseStorage)); } @Override @@ -83,15 +94,13 @@ public class DraconiumFluxCapacitor extends RFItemBase implements IUpgradableIte @Override public int getMaxExtract(ItemStack stack) { - return stack.getItemDamage() == 0 - ? BalanceConfigHandler.wyvernCapacitorMaxExtract + return stack.getItemDamage() == 0 ? BalanceConfigHandler.wyvernCapacitorMaxExtract : stack.getItemDamage() == 1 ? BalanceConfigHandler.draconicCapacitorMaxExtract : 0; } @Override public int getMaxReceive(ItemStack stack) { - return stack.getItemDamage() == 0 - ? BalanceConfigHandler.wyvernCapacitorMaxReceive + return stack.getItemDamage() == 0 ? BalanceConfigHandler.wyvernCapacitorMaxReceive : stack.getItemDamage() == 1 ? BalanceConfigHandler.draconicCapacitorMaxReceive : 0; } @@ -107,8 +116,7 @@ public class DraconiumFluxCapacitor extends RFItemBase implements IUpgradableIte int max = Math.min(getEnergyStored(container), getMaxExtract(container)); ItemStack stack = player.inventory.getStackInSlot(i); - if (stack != null - && stack.getItem() instanceof IEnergyContainerItem + if (stack != null && stack.getItem() instanceof IEnergyContainerItem && stack.getItem() != ModItems.draconiumFluxCapacitor) { IEnergyContainerItem item = (IEnergyContainerItem) stack.getItem(); extractEnergy(container, item.receiveEnergy(stack, max, false), false); @@ -121,8 +129,7 @@ public class DraconiumFluxCapacitor extends RFItemBase implements IUpgradableIte int max = Math.min(getEnergyStored(container), getMaxExtract(container)); ItemStack stack = player.getEquipmentInSlot(i); - if (stack != null - && stack.getItem() instanceof IEnergyContainerItem + if (stack != null && stack.getItem() instanceof IEnergyContainerItem && stack.getItem() != ModItems.draconiumFluxCapacitor) { IEnergyContainerItem item = (IEnergyContainerItem) stack.getItem(); extractEnergy(container, item.receiveEnergy(stack, max, false), false); @@ -142,26 +149,32 @@ public class DraconiumFluxCapacitor extends RFItemBase implements IUpgradableIte int mode = ItemNBTHelper.getShort(stack, "Mode", (short) 0); int newMode = mode == 3 ? 0 : mode + 1; ItemNBTHelper.setShort(stack, "Mode", (short) newMode); - if (world.isRemote) - player.addChatComponentMessage(new ChatComponentTranslation(InfoHelper.ITC() - + StatCollector.translateToLocal("info.de.capacitorMode.txt") + ": " + InfoHelper.HITC() - + StatCollector.translateToLocal( - "info.de.capacitorMode" + ItemNBTHelper.getShort(stack, "Mode", (short) 0) + ".txt"))); + if (world.isRemote) player.addChatComponentMessage( + new ChatComponentTranslation( + InfoHelper.ITC() + StatCollector.translateToLocal("info.de.capacitorMode.txt") + + ": " + + InfoHelper.HITC() + + StatCollector.translateToLocal( + "info.de.capacitorMode" + ItemNBTHelper.getShort(stack, "Mode", (short) 0) + + ".txt"))); } return stack; } @Override @SideOnly(Side.CLIENT) - public void addInformation( - final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) { + public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, + final boolean extraInformation) { if (InfoHelper.holdShiftForDetails(list)) { list.add(StatCollector.translateToLocal("info.de.changwMode.txt")); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.capacitorMode.txt") + ": " - + InfoHelper.HITC() - + StatCollector.translateToLocal( - "info.de.capacitorMode" + ItemNBTHelper.getShort(stack, "Mode", (short) 0) + ".txt")); + list.add( + InfoHelper.ITC() + StatCollector.translateToLocal("info.de.capacitorMode.txt") + + ": " + + InfoHelper.HITC() + + StatCollector.translateToLocal( + "info.de.capacitorMode" + ItemNBTHelper.getShort(stack, "Mode", (short) 0) + + ".txt")); // InfoHelper.addLore(stack, list); } ToolBase.holdCTRLForUpgrades(list, stack); @@ -176,6 +189,7 @@ public class DraconiumFluxCapacitor extends RFItemBase implements IUpgradableIte @Override public List getUpgrades(ItemStack itemstack) { return new ArrayList() { + { add(EnumUpgrade.RF_CAPACITY); } @@ -184,8 +198,7 @@ public class DraconiumFluxCapacitor extends RFItemBase implements IUpgradableIte @Override public int getUpgradeCap(ItemStack stack) { - return stack.getItemDamage() == 0 - ? BalanceConfigHandler.wyvernCapacitorMaxUpgrades + return stack.getItemDamage() == 0 ? BalanceConfigHandler.wyvernCapacitorMaxUpgrades : stack.getItemDamage() == 1 ? BalanceConfigHandler.draconicCapacitorMaxUpgrades : 0; } @@ -207,16 +220,12 @@ public class DraconiumFluxCapacitor extends RFItemBase implements IUpgradableIte return getMaxUpgradePoints(upgradeIndex); } if (upgradeIndex == EnumUpgrade.RF_CAPACITY.index) { - return stack.getItemDamage() == 0 - ? BalanceConfigHandler.wyvernCapacitorMaxCapacityUpgradePoints - : stack.getItemDamage() == 1 - ? BalanceConfigHandler.draconicCapacitorMaxCapacityUpgradePoints + return stack.getItemDamage() == 0 ? BalanceConfigHandler.wyvernCapacitorMaxCapacityUpgradePoints + : stack.getItemDamage() == 1 ? BalanceConfigHandler.draconicCapacitorMaxCapacityUpgradePoints : getMaxUpgradePoints(upgradeIndex); } - return stack.getItemDamage() == 0 - ? BalanceConfigHandler.wyvernCapacitorMaxUpgradePoints - : stack.getItemDamage() == 1 - ? BalanceConfigHandler.draconicCapacitorMaxUpgradePoints + return stack.getItemDamage() == 0 ? BalanceConfigHandler.wyvernCapacitorMaxUpgradePoints + : stack.getItemDamage() == 1 ? BalanceConfigHandler.draconicCapacitorMaxUpgradePoints : getMaxUpgradePoints(upgradeIndex); } @@ -228,8 +237,11 @@ public class DraconiumFluxCapacitor extends RFItemBase implements IUpgradableIte @Override public List getUpgradeStats(ItemStack stack) { List strings = new ArrayList(); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " - + InfoHelper.HITC() + Utills.formatNumber(getMaxEnergyStored(stack))); + strings.add( + InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + + ": " + + InfoHelper.HITC() + + Utills.formatNumber(getMaxEnergyStored(stack))); return strings; } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/EnderArrow.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/EnderArrow.java index 01ea9238..b62d65fb 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/EnderArrow.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/EnderArrow.java @@ -1,21 +1,24 @@ package com.brandon3055.draconicevolution.common.items.tools; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.items.ItemDE; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; import java.util.List; + import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.items.ItemDE; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; + /** * Created by Brandon on 15/08/2014. */ public class EnderArrow extends ItemDE { + public EnderArrow() { this.setUnlocalizedName(Strings.enderArrowName); this.setCreativeTab(DraconicEvolution.tabToolsWeapons); @@ -29,9 +32,13 @@ public class EnderArrow extends ItemDE { @Override public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List list, boolean p_77624_4_) { - list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC - + StatCollector.translateToLocal("info.arrowInfo.txt")); - list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC - + StatCollector.translateToLocal("info.arrowInfo0.txt")); + list.add( + EnumChatFormatting.DARK_PURPLE + "" + + EnumChatFormatting.ITALIC + + StatCollector.translateToLocal("info.arrowInfo.txt")); + list.add( + EnumChatFormatting.DARK_PURPLE + "" + + EnumChatFormatting.ITALIC + + StatCollector.translateToLocal("info.arrowInfo0.txt")); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/Magnet.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/Magnet.java index d3a41df4..3ecdafaa 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/Magnet.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/Magnet.java @@ -1,15 +1,7 @@ package com.brandon3055.draconicevolution.common.items.tools; -import com.brandon3055.brandonscore.common.utills.InfoHelper; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.handler.ConfigHandler; -import com.brandon3055.draconicevolution.common.items.ItemDE; -import com.brandon3055.draconicevolution.common.lib.References; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.List; + import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; @@ -25,10 +17,22 @@ import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.PlayerPickupXpEvent; +import com.brandon3055.brandonscore.common.utills.InfoHelper; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.handler.ConfigHandler; +import com.brandon3055.draconicevolution.common.items.ItemDE; +import com.brandon3055.draconicevolution.common.lib.References; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by brandon3055 on 9/3/2016. */ public class Magnet extends ItemDE { + private IIcon draconium; private IIcon awakened; @@ -75,8 +79,7 @@ public class Magnet extends ItemDE { @Override public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean hotbar) { - if (!entity.isSneaking() - && entity.ticksExisted % 5 == 0 + if (!entity.isSneaking() && entity.ticksExisted % 5 == 0 && isEnabled(stack) && entity instanceof EntityPlayer) { int range = stack.getItemDamage() == 0 ? 8 : 32; @@ -84,8 +87,12 @@ public class Magnet extends ItemDE { List items = world.getEntitiesWithinAABB( EntityItem.class, AxisAlignedBB.getBoundingBox( - entity.posX, entity.posY, entity.posZ, entity.posX, entity.posY, entity.posZ) - .expand(range, range, range)); + entity.posX, + entity.posY, + entity.posZ, + entity.posX, + entity.posY, + entity.posZ).expand(range, range, range)); boolean playSound = false; @@ -94,8 +101,7 @@ public class Magnet extends ItemDE { continue; } - String name = - Item.itemRegistry.getNameForObject(item.getEntityItem().getItem()); + String name = Item.itemRegistry.getNameForObject(item.getEntityItem().getItem()); if (ConfigHandler.itemDislocatorBlacklistMap.containsKey(name) && (ConfigHandler.itemDislocatorBlacklistMap.get(name) == -1 || ConfigHandler.itemDislocatorBlacklistMap.get(name) @@ -127,8 +133,12 @@ public class Magnet extends ItemDE { List xp = world.getEntitiesWithinAABB( EntityXPOrb.class, AxisAlignedBB.getBoundingBox( - entity.posX, entity.posY, entity.posZ, entity.posX, entity.posY, entity.posZ) - .expand(4, 4, 4)); + entity.posX, + entity.posY, + entity.posZ, + entity.posX, + entity.posY, + entity.posZ).expand(4, 4, 4)); EntityPlayer player = (EntityPlayer) entity; for (EntityXPOrb orb : xp) { if (orb.field_70532_c == 0 && orb.isEntityAlive()) { @@ -171,7 +181,10 @@ public class Magnet extends ItemDE { public void addInformation(ItemStack stack, EntityPlayer p_77624_2_, List list, boolean p_77624_4_) { list.add(StatCollector.translateToLocal("info.de.shiftRightClickToActivate.txt")); int range = stack.getItemDamage() == 0 ? 8 : 32; - list.add(InfoHelper.HITC() + range + InfoHelper.ITC() + " " - + StatCollector.translateToLocal("info.de.blockRange.txt")); + list.add( + InfoHelper.HITC() + range + + InfoHelper.ITC() + + " " + + StatCollector.translateToLocal("info.de.blockRange.txt")); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/ObliterationCatalyst.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/ObliterationCatalyst.java index 2e43f64f..14a49678 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/ObliterationCatalyst.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/ObliterationCatalyst.java @@ -1,20 +1,22 @@ package com.brandon3055.draconicevolution.common.items.tools; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.entity.EntityChaosDrill; import com.brandon3055.draconicevolution.common.items.ItemDE; import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.utills.LogHelper; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; /** * Created by Brandon on 14/09/2014. */ public class ObliterationCatalyst extends ItemDE { + public ObliterationCatalyst() { this.setUnlocalizedName(Strings.obliterationCatalystName); this.setCreativeTab(DraconicEvolution.tabToolsWeapons); @@ -31,17 +33,8 @@ public class ObliterationCatalyst extends ItemDE { } @Override - public boolean onItemUse( - ItemStack stack, - EntityPlayer player, - World world, - int i1, - int i2, - int i3, - int i4, - float f1, - float f2, - float f3) { + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int i1, int i2, int i3, int i4, + float f1, float f2, float f3) { // LogHelper.info("onItemUse"); return false; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/SafetyMatch.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/SafetyMatch.java index 67138907..1e0d241e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/SafetyMatch.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/SafetyMatch.java @@ -1,15 +1,7 @@ package com.brandon3055.draconicevolution.common.items.tools; -import com.brandon3055.brandonscore.common.utills.InfoHelper; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.items.ItemDE; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.List; + import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; @@ -19,6 +11,17 @@ import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; +import com.brandon3055.brandonscore.common.utills.InfoHelper; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.items.ItemDE; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 23/08/2014. */ @@ -73,17 +76,8 @@ public class SafetyMatch extends ItemDE { return damage == 1000 ? itemIcon : boxIcon; } - public boolean onItemUse( - ItemStack stack, - EntityPlayer player, - World world, - int x, - int y, - int z, - int p_77648_7_, - float p_77648_8_, - float p_77648_9_, - float p_77648_10_) { + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int p_77648_7_, + float p_77648_8_, float p_77648_9_, float p_77648_10_) { if (p_77648_7_ == 0) { --y; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKI.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKI.java index 11a07ec0..ece6353b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKI.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKI.java @@ -1,17 +1,7 @@ package com.brandon3055.draconicevolution.common.items.tools; -import com.brandon3055.brandonscore.BrandonsCore; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.brandonscore.common.utills.Teleporter.TeleportLocation; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem; -import com.brandon3055.draconicevolution.common.items.ItemDE; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.List; + import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; @@ -25,6 +15,19 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraft.world.World; +import com.brandon3055.brandonscore.BrandonsCore; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.brandonscore.common.utills.Teleporter.TeleportLocation; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem; +import com.brandon3055.draconicevolution.common.items.ItemDE; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class TeleporterMKI extends ItemDE { public TeleporterMKI(boolean MKII) {} @@ -63,13 +66,16 @@ public class TeleporterMKI extends ItemDE { stack.damageItem(1, player); if (!player.capabilities.isCreativeMode) player.setHealth(player.getHealth() - 2); getLocation(stack).sendEntityToCoords(entity); - if (player.worldObj.isRemote) - player.addChatMessage(new ChatComponentText( - new ChatComponentTranslation("msg.teleporterSentMob.txt").getFormattedText() + " x:" - + (int) getLocation(stack).getXCoord() + " y:" - + (int) getLocation(stack).getYCoord() + " z:" - + (int) getLocation(stack).getZCoord() + " Dimension: " - + getLocation(stack).getDimensionName())); + if (player.worldObj.isRemote) player.addChatMessage( + new ChatComponentText( + new ChatComponentTranslation("msg.teleporterSentMob.txt").getFormattedText() + " x:" + + (int) getLocation(stack).getXCoord() + + " y:" + + (int) getLocation(stack).getYCoord() + + " z:" + + (int) getLocation(stack).getZCoord() + + " Dimension: " + + getLocation(stack).getDimensionName())); } else if (player.worldObj.isRemote) player.addChatMessage(new ChatComponentTranslation("msg.teleporterLowHealth.txt")); @@ -81,10 +87,17 @@ public class TeleporterMKI extends ItemDE { if (player.isSneaking()) { if (getLocation(stack) == null) { if (world.isRemote) { - player.addChatMessage(new ChatComponentText( - new ChatComponentTranslation("msg.teleporterBound.txt").getFormattedText() + "{X:" - + (int) player.posX + " Y:" + (int) player.posY + " Z:" + (int) player.posZ - + " Dim:" + player.worldObj.provider.getDimensionName() + "}")); + player.addChatMessage( + new ChatComponentText( + new ChatComponentTranslation("msg.teleporterBound.txt").getFormattedText() + "{X:" + + (int) player.posX + + " Y:" + + (int) player.posY + + " Z:" + + (int) player.posZ + + " Dim:" + + player.worldObj.provider.getDimensionName() + + "}")); } else { ItemNBTHelper.setDouble(stack, "X", player.posX); ItemNBTHelper.setDouble(stack, "Y", player.posY); @@ -96,15 +109,12 @@ public class TeleporterMKI extends ItemDE { ItemNBTHelper.setString( stack, "DimentionName", - BrandonsCore.proxy - .getMCServer() - .worldServerForDimension(player.dimension) - .provider + BrandonsCore.proxy.getMCServer().worldServerForDimension(player.dimension).provider .getDimensionName()); } return stack; - } else if (world.isRemote) - player.addChatMessage(new ChatComponentTranslation("msg.teleporterAlreadySet.txt")); + } else + if (world.isRemote) player.addChatMessage(new ChatComponentTranslation("msg.teleporterAlreadySet.txt")); return stack; } else { @@ -117,15 +127,15 @@ public class TeleporterMKI extends ItemDE { getLocation(stack).sendEntityToCoords(player); stack.damageItem(1, player); if (!player.capabilities.isCreativeMode) player.setHealth(player.getHealth() - 2); - } else if (world.isRemote) - player.addChatMessage(new ChatComponentTranslation("msg.teleporterLowHealth.txt")); + } else + if (world.isRemote) player.addChatMessage(new ChatComponentTranslation("msg.teleporterLowHealth.txt")); return stack; } } @Override - public void addInformation( - final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) { + public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, + final boolean extraInformation) { if (!ItemNBTHelper.getBoolean(stack, "IsSet", false)) { list.add(EnumChatFormatting.RED + StatCollector.translateToLocal("info.teleporterInfUnset1.txt")); list.add(EnumChatFormatting.WHITE + StatCollector.translateToLocal("info.teleporterInfUnset2.txt")); @@ -134,12 +144,20 @@ public class TeleporterMKI extends ItemDE { list.add(EnumChatFormatting.WHITE + StatCollector.translateToLocal("info.teleporterInfUnset5.txt")); } else { list.add(EnumChatFormatting.GREEN + StatCollector.translateToLocal("info.teleporterInfSet1.txt")); - list.add(EnumChatFormatting.WHITE + "{x:" + (int) ItemNBTHelper.getDouble(stack, "X", 0) + " y:" - + (int) ItemNBTHelper.getDouble(stack, "Y", 0) + " z:" - + (int) ItemNBTHelper.getDouble(stack, "Z", 0) + " Dim:" - + getLocation(stack).getDimensionName() + "}"); - list.add(EnumChatFormatting.BLUE + String.valueOf(stack.getMaxDamage() - stack.getItemDamage() + 1) + " " - + StatCollector.translateToLocal("info.teleporterInfSet2.txt")); + list.add( + EnumChatFormatting.WHITE + "{x:" + + (int) ItemNBTHelper.getDouble(stack, "X", 0) + + " y:" + + (int) ItemNBTHelper.getDouble(stack, "Y", 0) + + " z:" + + (int) ItemNBTHelper.getDouble(stack, "Z", 0) + + " Dim:" + + getLocation(stack).getDimensionName() + + "}"); + list.add( + EnumChatFormatting.BLUE + String.valueOf(stack.getMaxDamage() - stack.getItemDamage() + 1) + + " " + + StatCollector.translateToLocal("info.teleporterInfSet2.txt")); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKII.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKII.java index 60894552..aeb07301 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKII.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/TeleporterMKII.java @@ -1,20 +1,8 @@ package com.brandon3055.draconicevolution.common.items.tools; -import com.brandon3055.brandonscore.common.utills.InfoHelper; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.brandonscore.common.utills.Teleporter.TeleportLocation; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.client.gui.GuiHandler; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem; -import cpw.mods.fml.common.network.internal.FMLNetworkHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.List; + import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; @@ -28,6 +16,21 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraft.world.World; +import com.brandon3055.brandonscore.common.utills.InfoHelper; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.brandonscore.common.utills.Teleporter.TeleportLocation; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.client.gui.GuiHandler; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem; + +import cpw.mods.fml.common.network.internal.FMLNetworkHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class TeleporterMKII extends TeleporterMKI implements IHudDisplayItem { public TeleporterMKII() { @@ -50,15 +53,14 @@ public class TeleporterMKII extends TeleporterMKI implements IHudDisplayItem { int fuel = ItemNBTHelper.getInteger(stack, "Fuel", 0); if (getLocation(stack) == null) { - if (world.isRemote) - FMLNetworkHandler.openGui( - player, - DraconicEvolution.instance, - GuiHandler.GUIID_TELEPORTER, - world, - (int) player.posX, - (int) player.posY, - (int) player.posZ); + if (world.isRemote) FMLNetworkHandler.openGui( + player, + DraconicEvolution.instance, + GuiHandler.GUIID_TELEPORTER, + world, + (int) player.posX, + (int) player.posY, + (int) player.posZ); return true; } @@ -102,15 +104,14 @@ public class TeleporterMKII extends TeleporterMKI implements IHudDisplayItem { } else { if (getLocation(stack) == null) { - if (world.isRemote) - FMLNetworkHandler.openGui( - player, - DraconicEvolution.instance, - GuiHandler.GUIID_TELEPORTER, - world, - (int) player.posX, - (int) player.posY, - (int) player.posZ); + if (world.isRemote) FMLNetworkHandler.openGui( + player, + DraconicEvolution.instance, + GuiHandler.GUIID_TELEPORTER, + world, + (int) player.posX, + (int) player.posY, + (int) player.posZ); return stack; } @@ -128,8 +129,8 @@ public class TeleporterMKII extends TeleporterMKI implements IHudDisplayItem { } @Override - public void addInformation( - final ItemStack teleporter, final EntityPlayer player, final List list2, final boolean extraInformation) { + public void addInformation(final ItemStack teleporter, final EntityPlayer player, final List list2, + final boolean extraInformation) { short selected = ItemNBTHelper.getShort(teleporter, "Selection", (short) 0); int selrctionOffset = ItemNBTHelper.getInteger(teleporter, "SelectionOffset", 0); NBTTagCompound compound = teleporter.getTagCompound(); @@ -140,12 +141,18 @@ public class TeleporterMKII extends TeleporterMKI implements IHudDisplayItem { list2.add(EnumChatFormatting.GOLD + "" + selectedDest); if (InfoHelper.holdShiftForDetails(list2)) { - list2.add(EnumChatFormatting.WHITE + StatCollector.translateToLocal("info.teleporterInfFuel.txt") + " " - + ItemNBTHelper.getInteger(teleporter, "Fuel", 0)); - list2.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC - + StatCollector.translateToLocal("info.teleporterInfGUI.txt")); - list2.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC - + StatCollector.translateToLocal("info.teleporterInfScroll.txt")); + list2.add( + EnumChatFormatting.WHITE + StatCollector.translateToLocal("info.teleporterInfFuel.txt") + + " " + + ItemNBTHelper.getInteger(teleporter, "Fuel", 0)); + list2.add( + EnumChatFormatting.DARK_PURPLE + "" + + EnumChatFormatting.ITALIC + + StatCollector.translateToLocal("info.teleporterInfGUI.txt")); + list2.add( + EnumChatFormatting.DARK_PURPLE + "" + + EnumChatFormatting.ITALIC + + StatCollector.translateToLocal("info.teleporterInfScroll.txt")); } } @@ -172,11 +179,11 @@ public class TeleporterMKII extends TeleporterMKI implements IHudDisplayItem { @Override public void onUpdate(ItemStack stack, World world, Entity entity, int p_77663_4_, boolean p_77663_5_) { - // if (world.isRemote && entity instanceof EntityPlayer && ((EntityPlayer) entity).getHeldItem() != null && + // if (world.isRemote && entity instanceof EntityPlayer && ((EntityPlayer) entity).getHeldItem() != null && // ((EntityPlayer) entity).getHeldItem().getItem() instanceof TeleporterMKII){ - // if (getLocation(((EntityPlayer) entity).getHeldItem()) != null) + // if (getLocation(((EntityPlayer) entity).getHeldItem()) != null) // HudHandler.setTooltip(getLocation(((EntityPlayer) entity).getHeldItem()).getName()); - // } + // } } @Override @@ -202,8 +209,9 @@ public class TeleporterMKII extends TeleporterMKI implements IHudDisplayItem { if (location != null) { list.add(location.getName()); } - list.add(StatCollector.translateToLocal("info.teleporterInfFuel.txt") + " " - + ItemNBTHelper.getInteger(stack, "Fuel", 0)); + list.add( + StatCollector.translateToLocal("info.teleporterInfFuel.txt") + " " + + ItemNBTHelper.getInteger(stack, "Fuel", 0)); return list; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/Wrench.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/Wrench.java index c2e6ca66..6f249480 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/Wrench.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/Wrench.java @@ -1,18 +1,8 @@ package com.brandon3055.draconicevolution.common.items.tools; -import cofh.api.energy.IEnergyReceiver; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.items.ItemDE; -import com.brandon3055.draconicevolution.common.lib.Strings; -import com.brandon3055.draconicevolution.common.tileentities.energynet.TileRemoteEnergyBase; -import com.brandon3055.draconicevolution.common.tileentities.energynet.TileWirelessEnergyTransceiver; -import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.List; + import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -23,6 +13,20 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import cofh.api.energy.IEnergyReceiver; + +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.items.ItemDE; +import com.brandon3055.draconicevolution.common.lib.Strings; +import com.brandon3055.draconicevolution.common.tileentities.energynet.TileRemoteEnergyBase; +import com.brandon3055.draconicevolution.common.tileentities.energynet.TileWirelessEnergyTransceiver; +import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 23/08/2014. */ @@ -55,7 +59,7 @@ public class Wrench extends ItemDE implements IHudDisplayItem { return super.onItemRightClick(stack, world, player); } - static final String[] modes = new String[] {BIND_MODE, UNBIND_MODE, CLEAR_BINDINGS, MODE_SWITCH}; + static final String[] modes = new String[] { BIND_MODE, UNBIND_MODE, CLEAR_BINDINGS, MODE_SWITCH }; private static void cycleMode(ItemStack stack, World world, EntityPlayer player) { String currentMode = ItemNBTHelper.getString(stack, "Mode", "bind"); @@ -76,14 +80,21 @@ public class Wrench extends ItemDE implements IHudDisplayItem { @SideOnly(Side.CLIENT) @Override public void addInformation(ItemStack stack, EntityPlayer p_77624_2_, List list, boolean bool) { - list.add(StatCollector.translateToLocal( - "msg.de.wrenchMode." + ItemNBTHelper.getString(stack, "Mode", "bind") + ".txt")); + list.add( + StatCollector.translateToLocal( + "msg.de.wrenchMode." + ItemNBTHelper.getString(stack, "Mode", "bind") + ".txt")); NBTTagCompound linkDat = null; if (stack.hasTagCompound() && stack.getTagCompound().hasKey("LinkData")) linkDat = stack.getTagCompound().getCompoundTag("LinkData"); if (linkDat != null && linkDat.getBoolean("Bound")) { - list.add(StatCollector.translateToLocal("msg.de.boundTo.txt") + ": [X:" + linkDat.getInteger("XCoord") - + ", Y:" + linkDat.getInteger("YCoord") + ", Z:" + linkDat.getInteger("ZCoord") + "]"); + list.add( + StatCollector.translateToLocal("msg.de.boundTo.txt") + ": [X:" + + linkDat.getInteger("XCoord") + + ", Y:" + + linkDat.getInteger("YCoord") + + ", Z:" + + linkDat.getInteger("ZCoord") + + "]"); list.add(StatCollector.translateToLocal("msg.de.rightClickUnbind.txt")); } } @@ -91,14 +102,21 @@ public class Wrench extends ItemDE implements IHudDisplayItem { @Override public List getDisplayData(ItemStack stack) { List list = new ArrayList(); - list.add(StatCollector.translateToLocal( - "msg.de.wrenchMode." + ItemNBTHelper.getString(stack, "Mode", "bind") + ".txt")); + list.add( + StatCollector.translateToLocal( + "msg.de.wrenchMode." + ItemNBTHelper.getString(stack, "Mode", "bind") + ".txt")); NBTTagCompound linkDat = null; if (stack.hasTagCompound() && stack.getTagCompound().hasKey("LinkData")) linkDat = stack.getTagCompound().getCompoundTag("LinkData"); if (linkDat != null && linkDat.getBoolean("Bound")) { - list.add(StatCollector.translateToLocal("msg.de.boundTo.txt") + ": [X:" + linkDat.getInteger("XCoord") - + ", Y:" + linkDat.getInteger("YCoord") + ", Z:" + linkDat.getInteger("ZCoord") + "]"); + list.add( + StatCollector.translateToLocal("msg.de.boundTo.txt") + ": [X:" + + linkDat.getInteger("XCoord") + + ", Y:" + + linkDat.getInteger("YCoord") + + ", Z:" + + linkDat.getInteger("ZCoord") + + "]"); list.add(StatCollector.translateToLocal("msg.de.rightClickUnbind.txt")); } return list; @@ -109,21 +127,13 @@ public class Wrench extends ItemDE implements IHudDisplayItem { } @Override - public boolean onItemUseFirst( - ItemStack stack, - EntityPlayer player, - World world, - int x, - int y, - int z, - int side, - float hitX, - float hitY, - float hitZ) { + public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, + float hitX, float hitY, float hitZ) { Block clicked = world.getBlock(x, y, z); if (getMode(stack).equals(MODE_SWITCH) && clicked.rotateBlock(world, x, y, z, ForgeDirection.getOrientation(side)) - && !world.isRemote) return true; + && !world.isRemote) + return true; if (world.isRemote) return false; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/WyvernPickaxe.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/WyvernPickaxe.java index 8dbc6ab5..889db511 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/WyvernPickaxe.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/WyvernPickaxe.java @@ -1,5 +1,15 @@ package com.brandon3055.draconicevolution.common.items.tools; +import java.util.List; + +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnumEnchantmentType; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; +import net.minecraftforge.client.IItemRenderer; + +import org.lwjgl.opengl.GL11; + import com.brandon3055.draconicevolution.client.render.IRenderTweak; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; @@ -9,13 +19,6 @@ import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.utills.IInventoryTool; import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; -import java.util.List; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnumEnchantmentType; -import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; -import net.minecraftforge.client.IItemRenderer; -import org.lwjgl.opengl.GL11; public class WyvernPickaxe extends MiningTool implements IInventoryTool, IRenderTweak { @@ -33,10 +36,10 @@ public class WyvernPickaxe extends MiningTool implements IInventoryTool, IRender @Override public List getFields(ItemStack stack, int slot) { List list = super.getFields(stack, slot); - list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_AOE) - .setMinMaxAndIncromente(0, EnumUpgrade.DIG_AOE.getUpgradePoints(stack), 1) - .readFromItem(stack, 0) - .setModifier("AOE")); + list.add( + new ItemConfigField(References.INT_ID, slot, References.DIG_AOE) + .setMinMaxAndIncromente(0, EnumUpgrade.DIG_AOE.getUpgradePoints(stack), 1) + .readFromItem(stack, 0).setModifier("AOE")); return list; } @@ -128,176 +131,176 @@ public class WyvernPickaxe extends MiningTool implements IInventoryTool, IRender return list; } - // @Override - // public boolean isItemTool(ItemStack p_77616_1_) { - // return true; - // } + // @Override + // public boolean isItemTool(ItemStack p_77616_1_) { + // return true; + // } // - // @SideOnly(Side.CLIENT) - // @SuppressWarnings("unchecked") - // @Override - // public void getSubItems(Item item, CreativeTabs tab, List list) { - // list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", 0)); - // list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", capacity)); - // } + // @SideOnly(Side.CLIENT) + // @SuppressWarnings("unchecked") + // @Override + // public void getSubItems(Item item, CreativeTabs tab, List list) { + // list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", 0)); + // list.add(ItemNBTHelper.setInteger(new ItemStack(item, 1, 0), "Energy", capacity)); + // } // - // @Override - // public String getUnlocalizedName(){ + // @Override + // public String getUnlocalizedName(){ // - // return String.format("item.%s%s", References.MODID.toLowerCase() + ":", + // return String.format("item.%s%s", References.MODID.toLowerCase() + ":", // super.getUnlocalizedName().substring(super.getUnlocalizedName().indexOf(".") + 1)); - // } + // } // - // @Override - // public String getUnlocalizedName(final ItemStack itemStack){ - // return getUnlocalizedName(); - // } + // @Override + // public String getUnlocalizedName(final ItemStack itemStack){ + // return getUnlocalizedName(); + // } // - // @Override - // @SideOnly(Side.CLIENT) - // public void registerIcons(final IIconRegister iconRegister) - // { - // this.itemIcon0 = iconRegister.registerIcon(References.RESOURCESPREFIX + "wyvern_pick"); - // this.itemIcon1 = iconRegister.registerIcon(References.RESOURCESPREFIX + "wyvern_pick_active"); - // } + // @Override + // @SideOnly(Side.CLIENT) + // public void registerIcons(final IIconRegister iconRegister) + // { + // this.itemIcon0 = iconRegister.registerIcon(References.RESOURCESPREFIX + "wyvern_pick"); + // this.itemIcon1 = iconRegister.registerIcon(References.RESOURCESPREFIX + "wyvern_pick_active"); + // } // - // @Override - // @SideOnly(Side.CLIENT) - // public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) - // { - // if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) - // return itemIcon1; - // else - // return itemIcon0; - // } + // @Override + // @SideOnly(Side.CLIENT) + // public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) + // { + // if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) + // return itemIcon1; + // else + // return itemIcon0; + // } // - // @Override - // @SideOnly(Side.CLIENT) - // public IIcon getIconIndex(ItemStack stack) - // { - // if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) - // return itemIcon1; - // else - // return itemIcon0; - // } + // @Override + // @SideOnly(Side.CLIENT) + // public IIcon getIconIndex(ItemStack stack) + // { + // if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) + // return itemIcon1; + // else + // return itemIcon0; + // } // - // @Override - // public boolean onBlockStartBreak(final ItemStack stack, final int x, final int y, final int z, final EntityPlayer + // @Override + // public boolean onBlockStartBreak(final ItemStack stack, final int x, final int y, final int z, final EntityPlayer // player) - // { - // World world = player.worldObj; - // Block block = world.getBlock(x, y, z); - // Material mat = block.getMaterial(); - // if (!ToolHandler.isRightMaterial(mat, ToolHandler.materialsPick)) { - // return false; - // } - // int fortune = EnchantmentHelper.getFortuneModifier(player); - // boolean silk = EnchantmentHelper.getSilkTouchModifier(player); - // ToolHandler.disSquare(x, y, z, player, world, silk, fortune, ToolHandler.materialsPick, stack); - // return false; - // } + // { + // World world = player.worldObj; + // Block block = world.getBlock(x, y, z); + // Material mat = block.getMaterial(); + // if (!ToolHandler.isRightMaterial(mat, ToolHandler.materialsPick)) { + // return false; + // } + // int fortune = EnchantmentHelper.getFortuneModifier(player); + // boolean silk = EnchantmentHelper.getSilkTouchModifier(player); + // ToolHandler.disSquare(x, y, z, player, world, silk, fortune, ToolHandler.materialsPick, stack); + // return false; + // } // - // @Override - // public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer player) - // { - // return ToolHandler.changeMode(stack, player, false, 1); - // } + // @Override + // public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer player) + // { + // return ToolHandler.changeMode(stack, player, false, 1); + // } // - // @Override - // @SideOnly(Side.CLIENT) - // @SuppressWarnings({ "unchecked", "rawtypes" }) - // public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean + // @Override + // @SideOnly(Side.CLIENT) + // @SuppressWarnings({ "unchecked", "rawtypes" }) + // public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean // extraInformation) - // { - // int size = (ItemNBTHelper.getShort(stack, "size", (short) 0) * 2) + 1; - // if (InfoHelper.holdShiftForDetails(list)){ - // InfoHelper.addEnergyInfo(stack, list); + // { + // int size = (ItemNBTHelper.getShort(stack, "size", (short) 0) * 2) + 1; + // if (InfoHelper.holdShiftForDetails(list)){ + // InfoHelper.addEnergyInfo(stack, list); // - // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.miningMode.txt") + ": " + InfoHelper.HITC() + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.miningMode.txt") + ": " + InfoHelper.HITC() // + size + "x" + size); - // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.changeMiningMode.txt")); + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.changeMiningMode.txt")); // - // InfoHelper.addLore(stack, list); - // } - // } + // InfoHelper.addLore(stack, list); + // } + // } // - // @Override - // public EnumRarity getRarity(ItemStack stack) - // { - // return EnumRarity.uncommon; - // } + // @Override + // public EnumRarity getRarity(ItemStack stack) + // { + // return EnumRarity.uncommon; + // } // - // @Override - // public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) { + // @Override + // public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) { // - // if (container.stackTagCompound == null) { - // container.stackTagCompound = new NBTTagCompound(); - // } - // int energy = container.stackTagCompound.getInteger("Energy"); - // int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive)); + // if (container.stackTagCompound == null) { + // container.stackTagCompound = new NBTTagCompound(); + // } + // int energy = container.stackTagCompound.getInteger("Energy"); + // int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive)); // - // if (!simulate) { - // energy += energyReceived; - // container.stackTagCompound.setInteger("Energy", energy); - // } - // return energyReceived; - // } + // if (!simulate) { + // energy += energyReceived; + // container.stackTagCompound.setInteger("Energy", energy); + // } + // return energyReceived; + // } // - // @Override - // public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) { + // @Override + // public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) { // - // if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { - // return 0; - // } - // int energy = container.stackTagCompound.getInteger("Energy"); - // int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); + // if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { + // return 0; + // } + // int energy = container.stackTagCompound.getInteger("Energy"); + // int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); // - // if (!simulate) { - // energy -= energyExtracted; - // container.stackTagCompound.setInteger("Energy", energy); - // } - // return energyExtracted; - // } + // if (!simulate) { + // energy -= energyExtracted; + // container.stackTagCompound.setInteger("Energy", energy); + // } + // return energyExtracted; + // } // - // @Override - // public int getEnergyStored(ItemStack container) { - // if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { - // return 0; - // } - // return container.stackTagCompound.getInteger("Energy"); - // } + // @Override + // public int getEnergyStored(ItemStack container) { + // if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { + // return 0; + // } + // return container.stackTagCompound.getInteger("Energy"); + // } // - // @Override - // public int getMaxEnergyStored(ItemStack container) { - // return capacity; - // } + // @Override + // public int getMaxEnergyStored(ItemStack container) { + // return capacity; + // } // - // @Override - // public boolean showDurabilityBar(ItemStack stack) { - // return !(getEnergyStored(stack) == getMaxEnergyStored(stack)); - // } + // @Override + // public boolean showDurabilityBar(ItemStack stack) { + // return !(getEnergyStored(stack) == getMaxEnergyStored(stack)); + // } // - // @Override - // public double getDurabilityForDisplay(ItemStack stack) { - // return 1D - ((double)getEnergyStored(stack) / (double)getMaxEnergyStored(stack)); - // } + // @Override + // public double getDurabilityForDisplay(ItemStack stack) { + // return 1D - ((double)getEnergyStored(stack) / (double)getMaxEnergyStored(stack)); + // } // - // @Override - // public float getDigSpeed(ItemStack stack, Block block, int meta) { - // if ((stack.getItem() instanceof IEnergyContainerItem) && + // @Override + // public float getDigSpeed(ItemStack stack, Block block, int meta) { + // if ((stack.getItem() instanceof IEnergyContainerItem) && // ((IEnergyContainerItem)stack.getItem()).getEnergyStored(stack) >= energyPerOperation) - // return super.getDigSpeed(stack, block, meta); - // else - // return 1F; - // } + // return super.getDigSpeed(stack, block, meta); + // else + // return 1F; + // } // - // @Override - // public boolean hasCustomEntity(ItemStack stack) { - // return true; - // } + // @Override + // public boolean hasCustomEntity(ItemStack stack) { + // return true; + // } // - // @Override - // public Entity createEntity(World world, Entity location, ItemStack itemstack) { - // return new EntityPersistentItem(world, location, itemstack); - // } + // @Override + // public Entity createEntity(World world, Entity location, ItemStack itemstack) { + // return new EntityPersistentItem(world, location, itemstack); + // } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/WyvernShovel.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/WyvernShovel.java index 8e28ac80..08e1a486 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/WyvernShovel.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/WyvernShovel.java @@ -1,5 +1,15 @@ package com.brandon3055.draconicevolution.common.items.tools; +import java.util.List; + +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnumEnchantmentType; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; +import net.minecraftforge.client.IItemRenderer; + +import org.lwjgl.opengl.GL11; + import com.brandon3055.draconicevolution.client.render.IRenderTweak; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; @@ -9,13 +19,6 @@ import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.utills.IInventoryTool; import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; -import java.util.List; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnumEnchantmentType; -import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; -import net.minecraftforge.client.IItemRenderer; -import org.lwjgl.opengl.GL11; public class WyvernShovel extends MiningTool implements IInventoryTool, IRenderTweak { @@ -33,10 +36,10 @@ public class WyvernShovel extends MiningTool implements IInventoryTool, IRenderT @Override public List getFields(ItemStack stack, int slot) { List list = super.getFields(stack, slot); - list.add(new ItemConfigField(References.INT_ID, slot, References.DIG_AOE) - .setMinMaxAndIncromente(0, EnumUpgrade.DIG_AOE.getUpgradePoints(stack), 1) - .readFromItem(stack, 0) - .setModifier("AOE")); + list.add( + new ItemConfigField(References.INT_ID, slot, References.DIG_AOE) + .setMinMaxAndIncromente(0, EnumUpgrade.DIG_AOE.getUpgradePoints(stack), 1) + .readFromItem(stack, 0).setModifier("AOE")); return list; } @@ -127,155 +130,155 @@ public class WyvernShovel extends MiningTool implements IInventoryTool, IRenderT return list; } - // @Override - // public boolean isItemTool(ItemStack p_77616_1_) { - // return true; - // } + // @Override + // public boolean isItemTool(ItemStack p_77616_1_) { + // return true; + // } - // @Override - // @SideOnly(Side.CLIENT) - // public void registerIcons(final IIconRegister iconRegister) - // { - // this.itemIcon0 = iconRegister.registerIcon(References.RESOURCESPREFIX + "wyvern_shovel"); - // this.itemIcon1 = iconRegister.registerIcon(References.RESOURCESPREFIX + "wyvern_shovel_active"); - // } + // @Override + // @SideOnly(Side.CLIENT) + // public void registerIcons(final IIconRegister iconRegister) + // { + // this.itemIcon0 = iconRegister.registerIcon(References.RESOURCESPREFIX + "wyvern_shovel"); + // this.itemIcon1 = iconRegister.registerIcon(References.RESOURCESPREFIX + "wyvern_shovel_active"); + // } // - // @Override - // @SideOnly(Side.CLIENT) - // public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) - // { - // if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) - // return itemIcon1; - // else - // return itemIcon0; - // } + // @Override + // @SideOnly(Side.CLIENT) + // public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) + // { + // if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) + // return itemIcon1; + // else + // return itemIcon0; + // } // - // @Override - // @SideOnly(Side.CLIENT) - // public IIcon getIconIndex(ItemStack stack) - // { - // if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) - // return itemIcon1; - // else - // return itemIcon0; - // } + // @Override + // @SideOnly(Side.CLIENT) + // public IIcon getIconIndex(ItemStack stack) + // { + // if (ItemNBTHelper.getShort(stack, "size", (short)0) > 0) + // return itemIcon1; + // else + // return itemIcon0; + // } - // @Override - // public boolean onBlockStartBreak(final ItemStack stack, final int x, final int y, final int z, final EntityPlayer + // @Override + // public boolean onBlockStartBreak(final ItemStack stack, final int x, final int y, final int z, final EntityPlayer // player) - // { - // World world = player.worldObj; - // Block block = world.getBlock(x, y, z); - // Material mat = block.getMaterial(); - // if (!ToolHandler.isRightMaterial(mat, ToolHandler.materialsShovel)) { - // return false; - // } - // int fortune = EnchantmentHelper.getFortuneModifier(player); - // boolean silk = EnchantmentHelper.getSilkTouchModifier(player); - // ToolHandler.disSquare(x, y, z, player, world, silk, fortune, ToolHandler.materialsShovel, stack); - // return false; - // } + // { + // World world = player.worldObj; + // Block block = world.getBlock(x, y, z); + // Material mat = block.getMaterial(); + // if (!ToolHandler.isRightMaterial(mat, ToolHandler.materialsShovel)) { + // return false; + // } + // int fortune = EnchantmentHelper.getFortuneModifier(player); + // boolean silk = EnchantmentHelper.getSilkTouchModifier(player); + // ToolHandler.disSquare(x, y, z, player, world, silk, fortune, ToolHandler.materialsShovel, stack); + // return false; + // } // - // @Override - // public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer player) - // { - // return ToolHandler.changeMode(stack, player, false, 1); - // } + // @Override + // public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer player) + // { + // return ToolHandler.changeMode(stack, player, false, 1); + // } // - // @SuppressWarnings({ "rawtypes", "unchecked" }) - // @Override - // public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean + // @SuppressWarnings({ "rawtypes", "unchecked" }) + // @Override + // public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean // extraInformation) - // { - // int size = (ItemNBTHelper.getShort(stack, "size", (short) 0) * 2) + 1; - // if (InfoHelper.holdShiftForDetails(list)){ - // InfoHelper.addEnergyInfo(stack, list); + // { + // int size = (ItemNBTHelper.getShort(stack, "size", (short) 0) * 2) + 1; + // if (InfoHelper.holdShiftForDetails(list)){ + // InfoHelper.addEnergyInfo(stack, list); // - // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.miningMode.txt") + ": " + InfoHelper.HITC() + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.miningMode.txt") + ": " + InfoHelper.HITC() // + size + "x" + size); - // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.changeMiningMode.txt")); + // list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.changeMiningMode.txt")); // - // InfoHelper.addLore(stack, list); - // } - // } + // InfoHelper.addLore(stack, list); + // } + // } // - // @Override - // public EnumRarity getRarity(ItemStack stack) - // { - // return EnumRarity.uncommon; - // } + // @Override + // public EnumRarity getRarity(ItemStack stack) + // { + // return EnumRarity.uncommon; + // } // - // @Override - // public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) { + // @Override + // public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) { // - // if (container.stackTagCompound == null) { - // container.stackTagCompound = new NBTTagCompound(); - // } - // int energy = container.stackTagCompound.getInteger("Energy"); - // int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive)); + // if (container.stackTagCompound == null) { + // container.stackTagCompound = new NBTTagCompound(); + // } + // int energy = container.stackTagCompound.getInteger("Energy"); + // int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive)); // - // if (!simulate) { - // energy += energyReceived; - // container.stackTagCompound.setInteger("Energy", energy); - // } - // return energyReceived; - // } + // if (!simulate) { + // energy += energyReceived; + // container.stackTagCompound.setInteger("Energy", energy); + // } + // return energyReceived; + // } // - // @Override - // public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) { + // @Override + // public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) { // - // if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { - // return 0; - // } - // int energy = container.stackTagCompound.getInteger("Energy"); - // int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); + // if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { + // return 0; + // } + // int energy = container.stackTagCompound.getInteger("Energy"); + // int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); // - // if (!simulate) { - // energy -= energyExtracted; - // container.stackTagCompound.setInteger("Energy", energy); - // } - // return energyExtracted; - // } + // if (!simulate) { + // energy -= energyExtracted; + // container.stackTagCompound.setInteger("Energy", energy); + // } + // return energyExtracted; + // } // - // @Override - // public int getEnergyStored(ItemStack container) { - // if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { - // return 0; - // } - // return container.stackTagCompound.getInteger("Energy"); - // } + // @Override + // public int getEnergyStored(ItemStack container) { + // if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { + // return 0; + // } + // return container.stackTagCompound.getInteger("Energy"); + // } // - // @Override - // public int getMaxEnergyStored(ItemStack container) { - // return capacity; - // } + // @Override + // public int getMaxEnergyStored(ItemStack container) { + // return capacity; + // } // - // @Override - // public boolean showDurabilityBar(ItemStack stack) { - // return !(getEnergyStored(stack) == getMaxEnergyStored(stack)); - // } + // @Override + // public boolean showDurabilityBar(ItemStack stack) { + // return !(getEnergyStored(stack) == getMaxEnergyStored(stack)); + // } // - // @Override - // public double getDurabilityForDisplay(ItemStack stack) { - // return 1D - ((double)getEnergyStored(stack) / (double)getMaxEnergyStored(stack)); - // } + // @Override + // public double getDurabilityForDisplay(ItemStack stack) { + // return 1D - ((double)getEnergyStored(stack) / (double)getMaxEnergyStored(stack)); + // } // - // @Override - // public float getDigSpeed(ItemStack stack, Block block, int meta) { - // if ((stack.getItem() instanceof IEnergyContainerItem) && + // @Override + // public float getDigSpeed(ItemStack stack, Block block, int meta) { + // if ((stack.getItem() instanceof IEnergyContainerItem) && // ((IEnergyContainerItem)stack.getItem()).getEnergyStored(stack) >= energyPerOperation) - // return super.getDigSpeed(stack, block, meta); - // else - // return 1F; - // } + // return super.getDigSpeed(stack, block, meta); + // else + // return 1F; + // } // - // @Override - // public boolean hasCustomEntity(ItemStack stack) { - // return true; - // } + // @Override + // public boolean hasCustomEntity(ItemStack stack) { + // return true; + // } // - // @Override - // public Entity createEntity(World world, Entity location, ItemStack itemstack) { - // return new EntityPersistentItem(world, location, itemstack); - // } + // @Override + // public Entity createEntity(World world, Entity location, ItemStack itemstack) { + // return new EntityPersistentItem(world, location, itemstack); + // } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/MiningTool.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/MiningTool.java index 8d651ab6..3cac62ab 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/MiningTool.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/MiningTool.java @@ -1,18 +1,10 @@ package com.brandon3055.draconicevolution.common.items.tools.baseclasses; -import com.brandon3055.brandonscore.common.utills.InfoHelper; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.brandonscore.common.utills.Utills; -import com.brandon3055.draconicevolution.common.handler.ConfigHandler; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; -import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; -import com.brandon3055.draconicevolution.common.utills.ItemConfigField; -import com.brandon3055.draconicevolution.integration.ModHelper; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; + import net.minecraft.block.Block; import net.minecraft.block.material.MaterialLiquid; import net.minecraft.client.Minecraft; @@ -37,9 +29,18 @@ import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.event.world.BlockEvent; +import com.brandon3055.brandonscore.common.utills.InfoHelper; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.brandonscore.common.utills.Utills; +import com.brandon3055.draconicevolution.common.handler.ConfigHandler; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; +import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; +import com.brandon3055.draconicevolution.common.utills.ItemConfigField; +import com.brandon3055.draconicevolution.integration.ModHelper; + /** - * Created by Brandon on 2/01/2015. - * Modified by bartimaeusnek on 23/05/2018 + * Created by Brandon on 2/01/2015. Modified by bartimaeusnek on 23/05/2018 */ public abstract class MiningTool extends ToolBase implements IUpgradableItem { @@ -79,18 +80,18 @@ public abstract class MiningTool extends ToolBase implements IUpgradableItem { } @Override - public boolean onBlockDestroyed( - ItemStack stack, - World p_150894_2_, - Block p_150894_3_, - int p_150894_4_, - int p_150894_5_, - int p_150894_6_, - EntityLivingBase p_150894_7_) { + public boolean onBlockDestroyed(ItemStack stack, World p_150894_2_, Block p_150894_3_, int p_150894_4_, + int p_150894_5_, int p_150894_6_, EntityLivingBase p_150894_7_) { if (IConfigurableItem.ProfileHelper.getInteger(stack, References.DIG_AOE, 0) == 0) extractEnergy(stack, energyPerOperation, false); return super.onBlockDestroyed( - stack, p_150894_2_, p_150894_3_, p_150894_4_, p_150894_5_, p_150894_6_, p_150894_7_); + stack, + p_150894_2_, + p_150894_3_, + p_150894_4_, + p_150894_5_, + p_150894_6_, + p_150894_7_); } @Override @@ -99,8 +100,8 @@ public abstract class MiningTool extends ToolBase implements IUpgradableItem { return super.onItemRightClick(stack, world, player); } - public boolean breakAOEBlocks( - ItemStack stack, int x, int y, int z, int breakRadius, int breakDepth, EntityPlayer player) { + public boolean breakAOEBlocks(ItemStack stack, int x, int y, int z, int breakRadius, int breakDepth, + EntityPlayer player) { Map blockMap = IConfigurableItem.ProfileHelper.getBoolean(stack, References.OBLITERATE, false) ? getObliterationList(stack) : new HashMap(); @@ -178,10 +179,8 @@ public abstract class MiningTool extends ToolBase implements IUpgradableItem { if (te != null && !ModHelper.isGregTechTileEntityOre(te)) { if (player.worldObj.isRemote) { player.addChatComponentMessage(new ChatComponentTranslation("msg.de.baseSafeAOW.txt")); - } else - ((EntityPlayerMP) player) - .playerNetServerHandler.sendPacket( - new S23PacketBlockChange(x, y, z, ((EntityPlayerMP) player).worldObj)); + } else((EntityPlayerMP) player).playerNetServerHandler + .sendPacket(new S23PacketBlockChange(x, y, z, ((EntityPlayerMP) player).worldObj)); return true; } } @@ -219,7 +218,12 @@ public abstract class MiningTool extends ToolBase implements IUpgradableItem { List items = player.worldObj.getEntitiesWithinAABB( EntityItem.class, AxisAlignedBB.getBoundingBox( - x - xMin, y + yOffset - yMin, z - zMin, x + xMax + 1, y + yOffset + yMax + 1, z + zMax + 1)); + x - xMin, + y + yOffset - yMin, + z - zMin, + x + xMax + 1, + y + yOffset + yMax + 1, + z + zMax + 1)); for (EntityItem item : items) { if (!player.worldObj.isRemote) { item.setLocationAndAngles(player.posX, player.posY, player.posZ, 0, 0); @@ -232,22 +236,14 @@ public abstract class MiningTool extends ToolBase implements IUpgradableItem { return true; } - protected void breakExtraBlock( - ItemStack stack, - World world, - int x, - int y, - int z, - int totalSize, - EntityPlayer player, - float refStrength, - boolean breakSound, - Map blockMap) { + protected void breakExtraBlock(ItemStack stack, World world, int x, int y, int z, int totalSize, + EntityPlayer player, float refStrength, boolean breakSound, Map blockMap) { if (world.isAirBlock(x, y, z)) return; Block block = world.getBlock(x, y, z); if (block.getMaterial() instanceof MaterialLiquid - || (block.getBlockHardness(world, x, y, x) == -1 && !player.capabilities.isCreativeMode)) return; + || (block.getBlockHardness(world, x, y, x) == -1 && !player.capabilities.isCreativeMode)) + return; int meta = world.getBlockMetadata(x, y, z); @@ -261,13 +257,13 @@ public abstract class MiningTool extends ToolBase implements IUpgradableItem { float strength = ForgeHooks.blockStrength(block, player, world, x, y, z); - if (!player.canHarvestBlock(block) - || !ForgeHooks.canHarvestBlock(block, player, meta) - || refStrength / strength > 10f && !player.capabilities.isCreativeMode) return; + if (!player.canHarvestBlock(block) || !ForgeHooks.canHarvestBlock(block, player, meta) + || refStrength / strength > 10f && !player.capabilities.isCreativeMode) + return; if (!world.isRemote) { - BlockEvent.BreakEvent event = ForgeHooks.onBlockBreakEvent( - world, world.getWorldInfo().getGameType(), (EntityPlayerMP) player, x, y, z); + BlockEvent.BreakEvent event = ForgeHooks + .onBlockBreakEvent(world, world.getWorldInfo().getGameType(), (EntityPlayerMP) player, x, y, z); if (event.isCanceled()) { ((EntityPlayerMP) player).playerNetServerHandler.sendPacket(new S23PacketBlockChange(x, y, z, world)); return; @@ -297,8 +293,8 @@ public abstract class MiningTool extends ToolBase implements IUpgradableItem { block.onBlockHarvested(world, x, y, z, meta, player); - ArrayList drops = - block.getDrops(world, x, y, z, meta, EnchantmentHelper.getFortuneModifier(player)); + ArrayList drops = block + .getDrops(world, x, y, z, meta, EnchantmentHelper.getFortuneModifier(player)); for (ItemStack is : drops) { if (!player.inventory.addItemStackToInventory(is)) { if (world.getGameRules().getGameRuleBooleanValue("doTileDrops") && !world.restoringBlockSnapshots) { @@ -306,8 +302,12 @@ public abstract class MiningTool extends ToolBase implements IUpgradableItem { double d0 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; double d1 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; double d2 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; - EntityItem entityitem = - new EntityItem(world, (double) x + d0, (double) y + d1, (double) z + d2, is); + EntityItem entityitem = new EntityItem( + world, + (double) x + d0, + (double) y + d1, + (double) z + d2, + is); entityitem.delayBeforeCanPickup = 10; world.spawnEntityInWorld(entityitem); } @@ -327,16 +327,15 @@ public abstract class MiningTool extends ToolBase implements IUpgradableItem { block.onBlockDestroyedByPlayer(world, x, y, z, meta); } - Minecraft.getMinecraft() - .getNetHandler() - .addToSendQueue( - new C07PacketPlayerDigging(2, x, y, z, Minecraft.getMinecraft().objectMouseOver.sideHit)); + Minecraft.getMinecraft().getNetHandler().addToSendQueue( + new C07PacketPlayerDigging(2, x, y, z, Minecraft.getMinecraft().objectMouseOver.sideHit)); } } @Override public List getUpgrades(ItemStack itemstack) { return new ArrayList() { + { add(EnumUpgrade.RF_CAPACITY); add(EnumUpgrade.DIG_SPEED); @@ -370,21 +369,43 @@ public abstract class MiningTool extends ToolBase implements IUpgradableItem { else if (field.name.equals(References.ATTACK_AOE)) attackaoe = 1 + ((Integer) field.max * 2); } - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " - + InfoHelper.HITC() + Utills.formatNumber(getMaxEnergyStored(stack))); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " - + StatCollector.translateToLocal("gui.de.DigAOE.txt") + ": " + InfoHelper.HITC() + digaoe + "x" - + digaoe); - if (depth > 0) - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " - + StatCollector.translateToLocal("gui.de.DigDepth.txt") + ": " + InfoHelper.HITC() + depth); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " - + StatCollector.translateToLocal("gui.de.DigSpeed.txt") + ": " + InfoHelper.HITC() - + getEfficiency(stack)); - if (attackaoe > 0) - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " - + StatCollector.translateToLocal("gui.de.AttackAOE.txt") + ": " + InfoHelper.HITC() + attackaoe - + "x" + attackaoe); + strings.add( + InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + + ": " + + InfoHelper.HITC() + + Utills.formatNumber(getMaxEnergyStored(stack))); + strings.add( + InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + + " " + + StatCollector.translateToLocal("gui.de.DigAOE.txt") + + ": " + + InfoHelper.HITC() + + digaoe + + "x" + + digaoe); + if (depth > 0) strings.add( + InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + + " " + + StatCollector.translateToLocal("gui.de.DigDepth.txt") + + ": " + + InfoHelper.HITC() + + depth); + strings.add( + InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + + " " + + StatCollector.translateToLocal("gui.de.DigSpeed.txt") + + ": " + + InfoHelper.HITC() + + getEfficiency(stack)); + if (attackaoe > 0) strings.add( + InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + + " " + + StatCollector.translateToLocal("gui.de.AttackAOE.txt") + + ": " + + InfoHelper.HITC() + + attackaoe + + "x" + + attackaoe); return strings; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/RFItemBase.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/RFItemBase.java index ca6bec1a..595551e0 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/RFItemBase.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/RFItemBase.java @@ -1,19 +1,8 @@ package com.brandon3055.draconicevolution.common.items.tools.baseclasses; -import cofh.api.energy.IEnergyContainerItem; -import com.brandon3055.brandonscore.common.utills.InfoHelper; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.brandonscore.common.utills.Utills; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem; -import com.brandon3055.draconicevolution.common.items.ItemDE; -import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; -import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem; -import com.brandon3055.draconicevolution.common.utills.ItemConfigField; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.List; + import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.item.Item; @@ -23,10 +12,26 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraft.world.World; +import cofh.api.energy.IEnergyContainerItem; + +import com.brandon3055.brandonscore.common.utills.InfoHelper; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.brandonscore.common.utills.Utills; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem; +import com.brandon3055.draconicevolution.common.items.ItemDE; +import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; +import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem; +import com.brandon3055.draconicevolution.common.utills.ItemConfigField; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 8/01/2015. */ public class RFItemBase extends ItemDE implements IEnergyContainerItem, IConfigurableItem, IHudDisplayItem { + protected int capacity = 0; /** * Max Receive @@ -147,8 +152,10 @@ public class RFItemBase extends ItemDE implements IEnergyContainerItem, IConfigu List list = new ArrayList(); if (hasProfiles()) { int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0); - list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("info.de.capacitorMode.txt") + ": " - + ItemNBTHelper.getString(stack, "ProfileName" + preset, "Profile " + preset)); + list.add( + EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("info.de.capacitorMode.txt") + + ": " + + ItemNBTHelper.getString(stack, "ProfileName" + preset, "Profile " + preset)); } for (ItemConfigField field : getFields(stack, 0)) { @@ -156,8 +163,13 @@ public class RFItemBase extends ItemDE implements IEnergyContainerItem, IConfigu } if (getCapacity(stack) > 0) { - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.HITC() - + Utills.formatNumber(getEnergyStored(stack)) + " / " + Utills.formatNumber(capacity)); + list.add( + InfoHelper.ITC() + StatCollector.translateToLocal("info.de.charge.txt") + + ": " + + InfoHelper.HITC() + + Utills.formatNumber(getEnergyStored(stack)) + + " / " + + Utills.formatNumber(capacity)); } return list; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolBase.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolBase.java index f01ff1fa..7bf76f09 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolBase.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolBase.java @@ -1,5 +1,24 @@ package com.brandon3055.draconicevolution.common.items.tools.baseclasses; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; +import net.minecraftforge.common.ForgeHooks; + +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; + import com.brandon3055.brandonscore.BrandonsCore; import com.brandon3055.brandonscore.common.utills.DataUtills; import com.brandon3055.brandonscore.common.utills.InfoHelper; @@ -13,24 +32,9 @@ import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; import com.google.common.collect.Sets; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; -import net.minecraftforge.common.ForgeHooks; -import org.lwjgl.input.Keyboard; -import org.lwjgl.input.Mouse; /** * Created by Brandon on 2/01/2015. @@ -145,8 +149,7 @@ public class ToolBase extends RFItemBase { */ @Override public float func_150893_a(ItemStack stack, Block block) { - return blockOverrides.contains(block) || blockOverrides.contains(block.getMaterial()) - ? getEfficiency(stack) + return blockOverrides.contains(block) || blockOverrides.contains(block.getMaterial()) ? getEfficiency(stack) : 1.0F; } @@ -191,14 +194,11 @@ public class ToolBase extends RFItemBase { @Override public List getFields(ItemStack stack, int slot) { List list = super.getFields(stack, slot); - if (!getToolClasses(stack).isEmpty()) - list.add(new ItemConfigField(References.FLOAT_ID, slot, References.DIG_SPEED_MULTIPLIER) - .setMinMaxAndIncromente(0f, 1f, 0.01f) - .readFromItem(stack, 1f) - .setModifier("PERCENT")); - if (!getToolClasses(stack).isEmpty()) - list.add(new ItemConfigField(References.BOOLEAN_ID, slot, References.BASE_SAFE_AOE) - .readFromItem(stack, false)); + if (!getToolClasses(stack).isEmpty()) list.add( + new ItemConfigField(References.FLOAT_ID, slot, References.DIG_SPEED_MULTIPLIER) + .setMinMaxAndIncromente(0f, 1f, 0.01f).readFromItem(stack, 1f).setModifier("PERCENT")); + if (!getToolClasses(stack).isEmpty()) list.add( + new ItemConfigField(References.BOOLEAN_ID, slot, References.BASE_SAFE_AOE).readFromItem(stack, false)); return list; } @@ -209,12 +209,14 @@ public class ToolBase extends RFItemBase { if (show) { if (hasProfiles()) { int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0); - list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("info.de.capacitorMode.txt") - + ": " + ItemNBTHelper.getString(stack, "ProfileName" + preset, "Profile " + preset)); + list.add( + EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("info.de.capacitorMode.txt") + + ": " + + ItemNBTHelper.getString(stack, "ProfileName" + preset, "Profile " + preset)); } List l = getFields(stack, 0); for (ItemConfigField f : l) list.add(f.getTooltipInfo()); - // if (getCapacity(stack) > 0) list.add(InfoHelper.ITC() + + // if (getCapacity(stack) > 0) list.add(InfoHelper.ITC() + // StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.HITC() + // Utills.formatNumber(getEnergyStored(stack)) + " / " + Utills.formatNumber(getCapacity(stack))); } @@ -232,8 +234,11 @@ public class ToolBase extends RFItemBase { key = Keyboard.getKeyName(KeyBindings.toolConfig.getKeyCode()); else key = Mouse.getButtonName(KeyBindings.toolConfig.getKeyCode() + 101); - list.add(StatCollector.translateToLocal("info.de.press.txt") + " " + key + " " - + StatCollector.translateToLocal("info.de.toOpenConfigGUI.txt")); + list.add( + StatCollector.translateToLocal("info.de.press.txt") + " " + + key + + " " + + StatCollector.translateToLocal("info.de.toOpenConfigGUI.txt")); } @Override @@ -249,8 +254,8 @@ public class ToolBase extends RFItemBase { handleModeChange(stack, player, InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown()); } else if (world.isRemote && BrandonsCore.proxy.getMCServer() == null) { handleModeChange(stack, player, InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown()); - DraconicEvolution.network.sendToServer( - new ToolModePacket(InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown())); + DraconicEvolution.network + .sendToServer(new ToolModePacket(InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown())); } return super.onItemRightClick(stack, world, player); @@ -314,15 +319,22 @@ public class ToolBase extends RFItemBase { public static void holdCTRLForUpgrades(List list, ItemStack stack) { if (stack == null || !(stack.getItem() instanceof IUpgradableItem)) return; - if (!InfoHelper.isCtrlKeyDown()) - list.add(StatCollector.translateToLocal("info.de.hold.txt") + " " + EnumChatFormatting.AQUA + "" - + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("info.de.ctrl.txt") - + EnumChatFormatting.RESET + " " + EnumChatFormatting.GRAY - + StatCollector.translateToLocal("info.de.forUpgrades.txt")); + if (!InfoHelper.isCtrlKeyDown()) list.add( + StatCollector.translateToLocal("info.de.hold.txt") + " " + + EnumChatFormatting.AQUA + + "" + + EnumChatFormatting.ITALIC + + StatCollector.translateToLocal("info.de.ctrl.txt") + + EnumChatFormatting.RESET + + " " + + EnumChatFormatting.GRAY + + StatCollector.translateToLocal("info.de.forUpgrades.txt")); else { list.addAll(((IUpgradableItem) stack.getItem()).getUpgradeStats(stack)); - list.add(EnumChatFormatting.GOLD + "" + EnumChatFormatting.ITALIC - + StatCollector.translateToLocal("info.de.useUpgradeModifier.txt")); + list.add( + EnumChatFormatting.GOLD + "" + + EnumChatFormatting.ITALIC + + StatCollector.translateToLocal("info.de.useUpgradeModifier.txt")); } } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolHandler.java index 14e570ec..27dc8255 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/tools/baseclasses/ToolHandler.java @@ -1,11 +1,7 @@ package com.brandon3055.draconicevolution.common.items.tools.baseclasses; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.entity.EntityDragonProjectile; -import com.brandon3055.draconicevolution.common.items.weapons.IEnergyContainerWeaponItem; -import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; -import com.brandon3055.draconicevolution.common.utills.LogHelper; import java.util.List; + import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; @@ -22,126 +18,132 @@ import net.minecraft.network.play.server.S23PacketBlockChange; import net.minecraft.util.*; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.entity.EntityDragonProjectile; +import com.brandon3055.draconicevolution.common.items.weapons.IEnergyContainerWeaponItem; +import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; +import com.brandon3055.draconicevolution.common.utills.LogHelper; + public class ToolHandler { - // public static Block[] destroyList = {Blocks.cobblestone, Blocks.stone, Blocks.dirt, Blocks.gravel, Blocks.sand, + // public static Block[] destroyList = {Blocks.cobblestone, Blocks.stone, Blocks.dirt, Blocks.gravel, Blocks.sand, // Blocks.grass, Blocks.netherrack}; // - // public static boolean isRightMaterial(final Material material, final Material[] materialsListing) { - // for (final Material mat : materialsListing) { - // if (material == mat) { - // return true; - // } - // } - // return false; - // } + // public static boolean isRightMaterial(final Material material, final Material[] materialsListing) { + // for (final Material mat : materialsListing) { + // if (material == mat) { + // return true; + // } + // } + // return false; + // } // - // public static boolean checkDestroyList(Block curBlock) { - // for (Block block : destroyList) { - // if (curBlock == block) { - // return true; - // } - // } - // return false; - // } + // public static boolean checkDestroyList(Block curBlock) { + // for (Block block : destroyList) { + // if (curBlock == block) { + // return true; + // } + // } + // return false; + // } // - // public static boolean disSquare(int x, int y, int z, final EntityPlayer player, final World world, final boolean + // public static boolean disSquare(int x, int y, int z, final EntityPlayer player, final World world, final boolean // silk, final int fortune, Material[] materialsListing, ItemStack stack) { - // int size = stack.getItem().equals(ModItems.draconicAxe) ? 2 : ItemNBTHelper.getShort(stack, "size", (short) 0); - // MovingObjectPosition mop = raytraceFromEntity(world, player, 4.5D); - // if (mop == null) { - // updateGhostBlocks(player, world); - // return false; - // } + // int size = stack.getItem().equals(ModItems.draconicAxe) ? 2 : ItemNBTHelper.getShort(stack, "size", (short) 0); + // MovingObjectPosition mop = raytraceFromEntity(world, player, 4.5D); + // if (mop == null) { + // updateGhostBlocks(player, world); + // return false; + // } // - // int sizeX = size; - // int sizeY = size; - // int sizeZ = size; - // int yOff = (size * -1); - // Block targetBlock = world.getBlock(x, y, z); - // if (size > 0) yOff++; - // //if (size == 0) return false; - // int side = (stack.getItem().equals(ModItems.draconicAxe)) ? 6 : mop.sideHit; - // switch (side) { - // case 0: - // case 1: - // sizeY = 0; - // yOff = 0; - // break; - // case 2: - // case 3: - // sizeZ = 0; - // break; - // case 4: - // case 5: - // sizeX = 0; - // break; - // } + // int sizeX = size; + // int sizeY = size; + // int sizeZ = size; + // int yOff = (size * -1); + // Block targetBlock = world.getBlock(x, y, z); + // if (size > 0) yOff++; + // //if (size == 0) return false; + // int side = (stack.getItem().equals(ModItems.draconicAxe)) ? 6 : mop.sideHit; + // switch (side) { + // case 0: + // case 1: + // sizeY = 0; + // yOff = 0; + // break; + // case 2: + // case 3: + // sizeZ = 0; + // break; + // case 4: + // case 5: + // sizeX = 0; + // break; + // } // - // for (int x1 = x - sizeX; x1 <= x + sizeX; x1++) { - // for (int y1 = y - (sizeY + yOff); y1 <= y + (sizeY - yOff); y1++) { - // for (int z1 = z - sizeZ; z1 <= z + sizeZ; z1++) { - // mineBlock(x1, y1, z1, player, world, silk, fortune, materialsListing, stack); - // //player.worldObj.scheduleBlockUpdate(x1, y1, z1, Blocks.stone, 100); - // } - // } - // } - // world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, targetBlock.stepSound.getStepResourcePath(), + // for (int x1 = x - sizeX; x1 <= x + sizeX; x1++) { + // for (int y1 = y - (sizeY + yOff); y1 <= y + (sizeY - yOff); y1++) { + // for (int z1 = z - sizeZ; z1 <= z + sizeZ; z1++) { + // mineBlock(x1, y1, z1, player, world, silk, fortune, materialsListing, stack); + // //player.worldObj.scheduleBlockUpdate(x1, y1, z1, Blocks.stone, 100); + // } + // } + // } + // world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, targetBlock.stepSound.getStepResourcePath(), // (targetBlock.stepSound.getVolume() + 1.0F) / 2.0F, targetBlock.stepSound.getPitch() * 0.8F); - // return true; - // } + // return true; + // } // - // @SuppressWarnings({"rawtypes", "unchecked"}) - // public static void mineBlock(final int x, final int y, final int z, final EntityPlayer player, final World world, + // @SuppressWarnings({"rawtypes", "unchecked"}) + // public static void mineBlock(final int x, final int y, final int z, final EntityPlayer player, final World world, // final boolean silk, final int fortune, Material[] materialsListing, ItemStack stack) { - // Block block = world.getBlock(x, y, z); - // int meta = world.getBlockMetadata(x, y, z); - // Material mat = block.getMaterial(); - // if ((block != null) && (!block.isAir(world, x, y, z)) && (block.getPlayerRelativeBlockHardness(player, world, x, + // Block block = world.getBlock(x, y, z); + // int meta = world.getBlockMetadata(x, y, z); + // Material mat = block.getMaterial(); + // if ((block != null) && (!block.isAir(world, x, y, z)) && (block.getPlayerRelativeBlockHardness(player, world, x, // y, z) != 0.0F)) { - // List items = new ArrayList(); + // List items = new ArrayList(); // - // if ((!block.canHarvestBlock(player, meta)) || (!isRightMaterial(mat, materialsListing))) { - // return; - // } + // if ((!block.canHarvestBlock(player, meta)) || (!isRightMaterial(mat, materialsListing))) { + // return; + // } // - // if (!(stack.getItem() instanceof IEnergyContainerItem) || ((IEnergyContainerItem) + // if (!(stack.getItem() instanceof IEnergyContainerItem) || ((IEnergyContainerItem) // stack.getItem()).getEnergyStored(stack) < References.ENERGYPERBLOCK) { - // if (!player.capabilities.isCreativeMode) return; - // } else { - // if (!player.capabilities.isCreativeMode) - // ((IEnergyContainerItem) stack.getItem()).extractEnergy(stack, References.ENERGYPERBLOCK, false); - // } + // if (!player.capabilities.isCreativeMode) return; + // } else { + // if (!player.capabilities.isCreativeMode) + // ((IEnergyContainerItem) stack.getItem()).extractEnergy(stack, References.ENERGYPERBLOCK, false); + // } // - // if (checkDestroyList(block) && (IConfigurableItem.ProfileHelper.getBoolean(stack, "obliterate", false))) { - // world.setBlockToAir(x, y, z); - // return; - // } + // if (checkDestroyList(block) && (IConfigurableItem.ProfileHelper.getBoolean(stack, "obliterate", false))) { + // world.setBlockToAir(x, y, z); + // return; + // } // - // if ((stack.getItem().equals(ModItems.draconicAxe) ? 2 : ItemNBTHelper.getShort(stack, "size", (short) 0)) == 0) + // if ((stack.getItem().equals(ModItems.draconicAxe) ? 2 : ItemNBTHelper.getShort(stack, "size", (short) 0)) == 0) // return; // - // if ((silk) && (block.canSilkHarvest(world, player, x, y, z, meta))) { - // if (block == Blocks.lit_redstone_ore) - // items.add(new ItemStack(Item.getItemFromBlock(Blocks.redstone_ore))); - // else items.add(new ItemStack(block, 1, meta)); - // } else { - // items.addAll(block.getDrops(world, x, y, z, meta, fortune)); - // //block.dropXpOnBlockBreak(world, (int)player.posX, (int)player.posY, (int)player.posZ, + // if ((silk) && (block.canSilkHarvest(world, player, x, y, z, meta))) { + // if (block == Blocks.lit_redstone_ore) + // items.add(new ItemStack(Item.getItemFromBlock(Blocks.redstone_ore))); + // else items.add(new ItemStack(block, 1, meta)); + // } else { + // items.addAll(block.getDrops(world, x, y, z, meta, fortune)); + // //block.dropXpOnBlockBreak(world, (int)player.posX, (int)player.posY, (int)player.posZ, // block.getExpDrop(world, meta, fortune)); - // int xp = block.getExpDrop(world, meta, fortune); - // player.addExperience(xp); - // } + // int xp = block.getExpDrop(world, meta, fortune); + // player.addExperience(xp); + // } // - // world.setBlockToAir(x, y, z); + // world.setBlockToAir(x, y, z); // - // if (!world.isRemote && !player.capabilities.isCreativeMode && + // if (!world.isRemote && !player.capabilities.isCreativeMode && // world.getGameRules().getGameRuleBooleanValue("doTileDrops")) { - // for (ItemStack item : items) { - // world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, item)); - // } - // } - // } - // } + // for (ItemStack item : items) { + // world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, item)); + // } + // } + // } + // } public static void damageEntityBasedOnHealth(Entity entity, EntityPlayer player, float dmgMult) { ItemStack stack = player.getCurrentEquippedItem(); @@ -161,8 +163,8 @@ public class ToolHandler { } if (entity instanceof EntityDragonPart) { - List list = - player.worldObj.getEntitiesWithinAABB(EntityDragon.class, entity.boundingBox.expand(10, 10, 10)); + List list = player.worldObj + .getEntitiesWithinAABB(EntityDragon.class, entity.boundingBox.expand(10, 10, 10)); if (!list.isEmpty() && list.get(0) instanceof EntityDragon) { EntityDragon dragon = list.get(0); float entHealth = dragon.getHealth(); @@ -188,18 +190,15 @@ public class ToolHandler { double d1 = player.posX - entityLivingBase.posX; double d0; - for (d0 = player.posZ - entityLivingBase.posZ; - d1 * d1 + d0 * d0 < 1.0E-4D; - d0 = (Math.random() - Math.random()) * 0.01D) { + for (d0 = player.posZ - entityLivingBase.posZ; d1 * d1 + d0 * d0 + < 1.0E-4D; d0 = (Math.random() - Math.random()) * 0.01D) { d1 = (Math.random() - Math.random()) * 0.01D; } - entityLivingBase.attackedAtYaw = - (float) (Math.atan2(d0, d1) * 180.0D / Math.PI) - entityLivingBase.rotationYaw; + entityLivingBase.attackedAtYaw = (float) (Math.atan2(d0, d1) * 180.0D / Math.PI) + - entityLivingBase.rotationYaw; - if (entityLivingBase.worldObj.rand.nextDouble() - >= entityLivingBase - .getEntityAttribute(SharedMonsterAttributes.knockbackResistance) - .getAttributeValue()) { + if (entityLivingBase.worldObj.rand.nextDouble() >= entityLivingBase + .getEntityAttribute(SharedMonsterAttributes.knockbackResistance).getAttributeValue()) { entityLivingBase.isAirBorne = true; float f1 = MathHelper.sqrt_double(d1 * d1 + d0 * d0); float f2 = 0.1F + EnchantmentHelper.getKnockbackModifier(player, entityLivingBase) * 0.4F; @@ -220,13 +219,12 @@ public class ToolHandler { public static void AOEAttack(EntityPlayer player, Entity entity, ItemStack stack, int range) { World world = player.worldObj; AxisAlignedBB box = AxisAlignedBB.getBoundingBox( - entity.posX - range, - entity.posY - range, - entity.posZ - range, - entity.posX + range, - entity.posY + range, - entity.posZ + range) - .expand(1.0D, 1.0D, 1.0D); + entity.posX - range, + entity.posY - range, + entity.posZ - range, + entity.posX + range, + entity.posY + range, + entity.posZ + range).expand(1.0D, 1.0D, 1.0D); List list = world.getEntitiesWithinAABBExcludingEntity(player, box); if (range == 0) return; IEnergyContainerWeaponItem item = (IEnergyContainerWeaponItem) stack.getItem(); @@ -246,23 +244,19 @@ public class ToolHandler { entityLivingBase.attackEntityFrom(DamageSource.causePlayerDamage(player), dmg); item.extractEnergy(stack, rf, false); - if (EnchantmentHelper.getEnchantmentLevel(Enchantment.fireAspect.effectId, stack) > 0) - entityLivingBase.setFire( - EnchantmentHelper.getEnchantmentLevel(Enchantment.fireAspect.effectId, stack) * 15); + if (EnchantmentHelper.getEnchantmentLevel(Enchantment.fireAspect.effectId, stack) > 0) entityLivingBase + .setFire(EnchantmentHelper.getEnchantmentLevel(Enchantment.fireAspect.effectId, stack) * 15); double d1 = player.posX - entityLivingBase.posX; double d0; - for (d0 = player.posZ - entityLivingBase.posZ; - d1 * d1 + d0 * d0 < 1.0E-4D; - d0 = (Math.random() - Math.random()) * 0.01D) { + for (d0 = player.posZ - entityLivingBase.posZ; d1 * d1 + d0 * d0 + < 1.0E-4D; d0 = (Math.random() - Math.random()) * 0.01D) { d1 = (Math.random() - Math.random()) * 0.01D; } - if (entityLivingBase.worldObj.rand.nextDouble() - >= entityLivingBase - .getEntityAttribute(SharedMonsterAttributes.knockbackResistance) - .getAttributeValue()) { + if (entityLivingBase.worldObj.rand.nextDouble() >= entityLivingBase + .getEntityAttribute(SharedMonsterAttributes.knockbackResistance).getAttributeValue()) { entityLivingBase.isAirBorne = true; float f1 = MathHelper.sqrt_double(d1 * d1 + d0 * d0); float f2 = 0.1F + (EnchantmentHelper.getKnockbackModifier(player, entityLivingBase) * 0.4F); @@ -292,8 +286,10 @@ public class ToolHandler { } } - public static MovingObjectPosition raytraceFromEntity( - World world, Entity player, double range) { // todo move to core and make the range work as expected + public static MovingObjectPosition raytraceFromEntity(World world, Entity player, double range) { // todo move to + // core and make + // the range work + // as expected float f = 1.0F; float f1 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * f; float f2 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * f; @@ -325,8 +321,8 @@ public class ToolHandler { for (int x = xPos - 6; x < xPos + 6; x++) { for (int y = yPos - 6; y < yPos + 6; y++) { for (int z = zPos - 6; z < zPos + 6; z++) { - ((EntityPlayerMP) player) - .playerNetServerHandler.sendPacket(new S23PacketBlockChange(x, y, z, world)); + ((EntityPlayerMP) player).playerNetServerHandler + .sendPacket(new S23PacketBlockChange(x, y, z, world)); // world.markBlockForUpdate(x, y, z); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/BowHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/BowHandler.java index c57c149e..33a49d33 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/BowHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/BowHandler.java @@ -1,13 +1,7 @@ package com.brandon3055.draconicevolution.common.items.weapons; -import cofh.api.energy.IEnergyContainerItem; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.entity.EntityCustomArrow; -import com.brandon3055.draconicevolution.common.entity.EntityEnderArrow; -import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; -import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; -import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; import java.util.Random; + import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.player.EntityPlayer; @@ -20,6 +14,15 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.ArrowLooseEvent; import net.minecraftforge.event.entity.player.ArrowNockEvent; +import cofh.api.energy.IEnergyContainerItem; + +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.entity.EntityCustomArrow; +import com.brandon3055.draconicevolution.common.entity.EntityEnderArrow; +import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; +import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; +import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; + public class BowHandler { public static ItemStack onBowRightClick(Item bow, ItemStack stack, World world, EntityPlayer player) { @@ -87,16 +90,8 @@ public class BowHandler { (1.0F / (world.rand.nextFloat() * 0.4F + 1.2F) + (drawArrowSpeedModifier + (velocity / 40F)) * 0.5F)); } - public static void enderShot( - ItemStack stack, - World world, - EntityPlayer player, - int count, - Random itemRand, - float pullSpeedModifier, - float speedModifier, - float soundPitchModifier, - int minRelease) { + public static void enderShot(ItemStack stack, World world, EntityPlayer player, int count, Random itemRand, + float pullSpeedModifier, float speedModifier, float soundPitchModifier, int minRelease) { int j = 72000 - count; ArrowLooseEvent event = new ArrowLooseEvent(player, stack, j); MinecraftForge.EVENT_BUS.post(event); @@ -135,6 +130,7 @@ public class BowHandler { } public static class BowProperties { + public ItemStack bow; public EntityPlayer player; @@ -180,8 +176,7 @@ public class BowHandler { if (player == null) return false; if (!(bow.getItem() instanceof IEnergyContainerWeaponItem)) { - cantFireMessage = - "[Error] This bow is not a valid energy container (This is a bug, Please report on the Draconic Evolution github)"; + cantFireMessage = "[Error] This bow is not a valid energy container (This is a bug, Please report on the Draconic Evolution github)"; return false; } else if (!energyBolt && shockWavePower > 0) { cantFireMessage = "msg.de.shockWaveForEnergyBoltsOnly.txt"; @@ -191,23 +186,23 @@ public class BowHandler { return false; } else if (calculateEnergyCost() > ((IEnergyContainerWeaponItem) bow.getItem()).getEnergyStored(bow) && !player.capabilities.isCreativeMode) { - cantFireMessage = "msg.de.insufficientPowerToFire.txt"; - return false; - } else if (!energyBolt - && !player.inventory.hasItem(Items.arrow) - && EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, bow) == 0 - && !player.capabilities.isCreativeMode) { - cantFireMessage = "msg.de.outOfArrows.txt"; - return false; - } + cantFireMessage = "msg.de.insufficientPowerToFire.txt"; + return false; + } else + if (!energyBolt && !player.inventory.hasItem(Items.arrow) + && EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, bow) == 0 + && !player.capabilities.isCreativeMode) { + cantFireMessage = "msg.de.outOfArrows.txt"; + return false; + } cantFireMessage = null; return true; } private void updateValues() { - arrowDamage = IConfigurableItem.ProfileHelper.getFloat( - bow, "BowArrowDamage", IUpgradableItem.EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(bow)); + arrowDamage = IConfigurableItem.ProfileHelper + .getFloat(bow, "BowArrowDamage", IUpgradableItem.EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(bow)); arrowSpeed = 1F + IConfigurableItem.ProfileHelper.getFloat(bow, "BowArrowSpeedModifier", 0F); explosionPower = IConfigurableItem.ProfileHelper.getFloat(bow, "BowExplosionPower", 0F); shockWavePower = IConfigurableItem.ProfileHelper.getFloat(bow, "BowShockWavePower", 0F); @@ -222,16 +217,15 @@ public class BowHandler { } /** - * Consumes energy for the shot and also consumes an arrow if the bow dose not have infinity - * Returns true if an arrow was consumed. + * Consumes energy for the shot and also consumes an arrow if the bow dose not have infinity Returns true if an + * arrow was consumed. */ public boolean consumeArrowAndEnergy() { if (!player.capabilities.isCreativeMode) ((IEnergyContainerWeaponItem) bow.getItem()).extractEnergy(bow, calculateEnergyCost(), false); - if (!energyBolt - && EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, bow) == 0 + if (!energyBolt && EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, bow) == 0 && !player.capabilities.isCreativeMode) { player.inventory.consumeInventoryItem(Items.arrow); return true; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicBow.java b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicBow.java index 3b85ee97..74b5f2a8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicBow.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicBow.java @@ -1,5 +1,22 @@ package com.brandon3055.draconicevolution.common.items.weapons; +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnumEnchantmentType; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBow; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IIcon; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + import com.brandon3055.brandonscore.BrandonsCore; import com.brandon3055.brandonscore.common.utills.InfoHelper; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; @@ -16,28 +33,15 @@ import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem; import com.brandon3055.draconicevolution.common.utills.IInventoryTool; import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; + import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import java.util.ArrayList; -import java.util.List; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnumEnchantmentType; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemBow; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IIcon; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; public class DraconicBow extends ItemBow implements IInventoryTool, IUpgradableItem, IEnergyContainerWeaponItem, IHudDisplayItem { - public static final String[] bowPullIconNameArray = new String[] {"pulling_0", "pulling_1", "pulling_2"}; + + public static final String[] bowPullIconNameArray = new String[] { "pulling_0", "pulling_1", "pulling_2" }; protected int capacity = BalanceConfigHandler.draconicWeaponsBaseStorage; protected int maxReceive = BalanceConfigHandler.draconicWeaponsMaxTransfer; @@ -82,8 +86,8 @@ public class DraconicBow extends ItemBow this.iconArray = new IIcon[bowPullIconNameArray.length]; for (int i = 0; i < this.iconArray.length; ++i) { - this.iconArray[i] = iconRegister.registerIcon( - References.RESOURCESPREFIX + "draconic_bow" + "_" + bowPullIconNameArray[i]); + this.iconArray[i] = iconRegister + .registerIcon(References.RESOURCESPREFIX + "draconic_bow" + "_" + bowPullIconNameArray[i]); } } @@ -116,13 +120,15 @@ public class DraconicBow extends ItemBow @Override @SideOnly(Side.CLIENT) - public void addInformation( - final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) { + public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, + final boolean extraInformation) { boolean show = InfoHelper.holdShiftForDetails(list); if (show) { int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0); - list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("info.de.capacitorMode.txt") + ": " - + ItemNBTHelper.getString(stack, "ProfileName" + preset, "Profile " + preset)); + list.add( + EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("info.de.capacitorMode.txt") + + ": " + + ItemNBTHelper.getString(stack, "ProfileName" + preset, "Profile " + preset)); List l = getFields(stack, 0); for (ItemConfigField f : l) list.add(f.getTooltipInfo()); } @@ -201,28 +207,26 @@ public class DraconicBow extends ItemBow public List getFields(ItemStack stack, int slot) { List list = new ArrayList(); - list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowArrowDamage") - .setMinMaxAndIncromente( + list.add( + new ItemConfigField(References.FLOAT_ID, slot, "BowArrowDamage").setMinMaxAndIncromente( (float) getBaseUpgradePoints(EnumUpgrade.ARROW_DAMAGE.index), (float) EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(stack), - 0.1F) - .readFromItem(stack, (float) EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(stack))); - list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowArrowSpeedModifier") - .setMinMaxAndIncromente(0F, (float) EnumUpgrade.ARROW_SPEED.getUpgradePoints(stack), 0.01F) - .readFromItem(stack, 0F) - .setModifier("PLUSPERCENT")); + 0.1F).readFromItem(stack, (float) EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(stack))); + list.add( + new ItemConfigField(References.FLOAT_ID, slot, "BowArrowSpeedModifier") + .setMinMaxAndIncromente(0F, (float) EnumUpgrade.ARROW_SPEED.getUpgradePoints(stack), 0.01F) + .readFromItem(stack, 0F).setModifier("PLUSPERCENT")); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "BowAutoFire").readFromItem(stack, false)); - list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowExplosionPower") - .setMinMaxAndIncromente(0F, 6F, 0.1F) - .readFromItem(stack, 0F)); - list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowShockWavePower") - .setMinMaxAndIncromente(0F, 10F, 0.1F) - .readFromItem(stack, 0F)); + list.add( + new ItemConfigField(References.FLOAT_ID, slot, "BowExplosionPower").setMinMaxAndIncromente(0F, 6F, 0.1F) + .readFromItem(stack, 0F)); + list.add( + new ItemConfigField(References.FLOAT_ID, slot, "BowShockWavePower") + .setMinMaxAndIncromente(0F, 10F, 0.1F).readFromItem(stack, 0F)); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "BowEnergyBolt").readFromItem(stack, false)); - list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowZoomModifier") - .setMinMaxAndIncromente(0F, 6F, 0.01F) - .readFromItem(stack, 0F) - .setModifier("PLUSPERCENT")); + list.add( + new ItemConfigField(References.FLOAT_ID, slot, "BowZoomModifier").setMinMaxAndIncromente(0F, 6F, 0.01F) + .readFromItem(stack, 0F).setModifier("PLUSPERCENT")); return list; } @@ -230,6 +234,7 @@ public class DraconicBow extends ItemBow @Override public List getUpgrades(ItemStack itemstack) { return new ArrayList() { + { add(EnumUpgrade.RF_CAPACITY); add(EnumUpgrade.DRAW_SPEED); @@ -289,16 +294,34 @@ public class DraconicBow extends ItemBow public List getUpgradeStats(ItemStack stack) { BowHandler.BowProperties properties = new BowHandler.BowProperties(stack, null); List list = new ArrayList(); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + InfoHelper.HITC() - + Utills.formatNumber(getMaxEnergyStored(stack))); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " - + StatCollector.translateToLocal("gui.de.ArrowSpeed.txt") + ": " + InfoHelper.HITC() + "+" - + EnumUpgrade.ARROW_SPEED.getUpgradePoints(stack) * 100 + "%"); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " - + StatCollector.translateToLocal("gui.de.ArrowDamage.txt") + ": " + InfoHelper.HITC() - + EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(stack) + ""); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.DrawSpeed.txt") + ": " + InfoHelper.HITC() - + properties.getDrawTicks() / 20D + "s"); + list.add( + InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + + ": " + + InfoHelper.HITC() + + Utills.formatNumber(getMaxEnergyStored(stack))); + list.add( + InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + + " " + + StatCollector.translateToLocal("gui.de.ArrowSpeed.txt") + + ": " + + InfoHelper.HITC() + + "+" + + EnumUpgrade.ARROW_SPEED.getUpgradePoints(stack) * 100 + + "%"); + list.add( + InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + + " " + + StatCollector.translateToLocal("gui.de.ArrowDamage.txt") + + ": " + + InfoHelper.HITC() + + EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(stack) + + ""); + list.add( + InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.DrawSpeed.txt") + + ": " + + InfoHelper.HITC() + + properties.getDrawTicks() / 20D + + "s"); return list; } @@ -346,19 +369,21 @@ public class DraconicBow extends ItemBow public List getDisplayData(ItemStack stack) { List list = new ArrayList(); - if (BrandonsCore.proxy.getClientPlayer() != null - && BrandonsCore.proxy.getClientPlayer().getItemInUse() != null + if (BrandonsCore.proxy.getClientPlayer() != null && BrandonsCore.proxy.getClientPlayer().getItemInUse() != null && BrandonsCore.proxy.getClientPlayer().getItemInUseDuration() > 2) { EntityPlayer player = BrandonsCore.proxy.getClientPlayer(); BowHandler.BowProperties properties = new BowHandler.BowProperties(stack, player); - int power = (int) - Math.min(((float) player.getItemInUseDuration() / (float) properties.getDrawTicks() * 100F), 100F); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.power.txt") + ": " + InfoHelper.HITC() - + power + "%"); + int power = (int) Math + .min(((float) player.getItemInUseDuration() / (float) properties.getDrawTicks() * 100F), 100F); + list.add( + InfoHelper.ITC() + StatCollector + .translateToLocal("info.de.power.txt") + ": " + InfoHelper.HITC() + power + "%"); } else { int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0); - list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("info.de.capacitorMode.txt") + ": " - + ItemNBTHelper.getString(stack, "ProfileName" + preset, "Profile " + preset)); + list.add( + EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("info.de.capacitorMode.txt") + + ": " + + ItemNBTHelper.getString(stack, "ProfileName" + preset, "Profile " + preset)); for (ItemConfigField field : getFields(stack, 0)) { if ((field.datatype == References.FLOAT_ID && (Float) field.value > 0) @@ -366,15 +391,23 @@ public class DraconicBow extends ItemBow list.add(field.getTooltipInfo()); } - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.HITC() - + Utills.formatNumber(getEnergyStored(stack)) + " / " - + Utills.formatNumber(getMaxEnergyStored(stack))); + list.add( + InfoHelper.ITC() + StatCollector.translateToLocal("info.de.charge.txt") + + ": " + + InfoHelper.HITC() + + Utills.formatNumber(getEnergyStored(stack)) + + " / " + + Utills.formatNumber(getMaxEnergyStored(stack))); if (BrandonsCore.proxy.getClientPlayer() != null) { - BowHandler.BowProperties properties = - new BowHandler.BowProperties(stack, BrandonsCore.proxy.getClientPlayer()); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.rfPerShot.txt") + ": " - + InfoHelper.HITC() + Utills.addCommas(properties.calculateEnergyCost())); + BowHandler.BowProperties properties = new BowHandler.BowProperties( + stack, + BrandonsCore.proxy.getClientPlayer()); + list.add( + InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.rfPerShot.txt") + + ": " + + InfoHelper.HITC() + + Utills.addCommas(properties.calculateEnergyCost())); if (!properties.canFire() && properties.cantFireMessage != null) list.add(EnumChatFormatting.DARK_RED + StatCollector.translateToLocal(properties.cantFireMessage)); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicSword.java b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicSword.java index 8c700be8..40fc97a2 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicSword.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/DraconicSword.java @@ -1,5 +1,25 @@ package com.brandon3055.draconicevolution.common.items.weapons; +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnumEnchantmentType; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemSword; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; +import net.minecraftforge.client.IItemRenderer; + +import org.lwjgl.opengl.GL11; + import com.brandon3055.brandonscore.BrandonsCore; import com.brandon3055.brandonscore.common.utills.InfoHelper; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; @@ -16,29 +36,14 @@ import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.network.ToolModePacket; import com.brandon3055.draconicevolution.common.utills.*; import com.google.common.collect.Multimap; + import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import java.util.ArrayList; -import java.util.List; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnumEnchantmentType; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemSword; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; -import net.minecraftforge.client.IItemRenderer; -import org.lwjgl.opengl.GL11; public class DraconicSword extends ItemSword implements IEnergyContainerWeaponItem, IInventoryTool, IRenderTweak, IUpgradableItem, IHudDisplayItem { + protected int capacity = BalanceConfigHandler.draconicWeaponsBaseStorage; protected int maxReceive = BalanceConfigHandler.draconicWeaponsMaxTransfer; protected int maxExtract = BalanceConfigHandler.draconicWeaponsMaxTransfer; @@ -86,14 +91,17 @@ public class DraconicSword extends ItemSword public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { entity.hurtResistantTime = 0; ToolHandler.AOEAttack( - player, entity, stack, IConfigurableItem.ProfileHelper.getInteger(stack, References.ATTACK_AOE, 0)); + player, + entity, + stack, + IConfigurableItem.ProfileHelper.getInteger(stack, References.ATTACK_AOE, 0)); ToolHandler.damageEntityBasedOnHealth(entity, player, 0.2F); return true; } @Override - public void addInformation( - final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) { + public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, + final boolean extraInformation) { if (InfoHelper.holdShiftForDetails(list)) { List l = getFields(stack, 0); for (ItemConfigField f : l) list.add(f.getTooltipInfo()); @@ -103,10 +111,15 @@ public class DraconicSword extends ItemSword ToolBase.holdCTRLForUpgrades(list, stack); InfoHelper.addEnergyInfo(stack, list); list.add(""); - list.add(EnumChatFormatting.BLUE + "+" + ToolHandler.getBaseAttackDamage(stack) + " " - + StatCollector.translateToLocal("info.de.attackDamage.txt")); - list.add(EnumChatFormatting.BLUE + "+20%" + " " - + StatCollector.translateToLocal("info.de.bonusHealthDamage.txt")); + list.add( + EnumChatFormatting.BLUE + "+" + + ToolHandler.getBaseAttackDamage(stack) + + " " + + StatCollector.translateToLocal("info.de.attackDamage.txt")); + list.add( + EnumChatFormatting.BLUE + "+20%" + + " " + + StatCollector.translateToLocal("info.de.bonusHealthDamage.txt")); } @Override @@ -189,10 +202,10 @@ public class DraconicSword extends ItemSword @Override public List getFields(ItemStack stack, int slot) { List list = new ArrayList(); - list.add(new ItemConfigField(References.INT_ID, slot, References.ATTACK_AOE) - .setMinMaxAndIncromente(0, EnumUpgrade.ATTACK_AOE.getUpgradePoints(stack), 1) - .readFromItem(stack, 1) - .setModifier("AOE")); + list.add( + new ItemConfigField(References.INT_ID, slot, References.ATTACK_AOE) + .setMinMaxAndIncromente(0, EnumUpgrade.ATTACK_AOE.getUpgradePoints(stack), 1) + .readFromItem(stack, 1).setModifier("AOE")); return list; } @@ -227,6 +240,7 @@ public class DraconicSword extends ItemSword @Override public List getUpgrades(ItemStack itemstack) { return new ArrayList() { + { add(EnumUpgrade.RF_CAPACITY); add(EnumUpgrade.ATTACK_AOE); @@ -283,13 +297,25 @@ public class DraconicSword extends ItemSword for (ItemConfigField field : getFields(stack, 0)) if (field.name.equals(References.ATTACK_AOE)) attackaoe = 1 + ((Integer) field.max * 2); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " - + InfoHelper.HITC() + Utills.formatNumber(getMaxEnergyStored(stack))); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.attackDamage.txt") + ": " - + InfoHelper.HITC() + ToolHandler.getBaseAttackDamage(stack)); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " - + StatCollector.translateToLocal("gui.de.AttackAOE.txt") + ": " + InfoHelper.HITC() + attackaoe + "x" - + attackaoe); + strings.add( + InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + + ": " + + InfoHelper.HITC() + + Utills.formatNumber(getMaxEnergyStored(stack))); + strings.add( + InfoHelper.ITC() + StatCollector.translateToLocal("info.de.attackDamage.txt") + + ": " + + InfoHelper.HITC() + + ToolHandler.getBaseAttackDamage(stack)); + strings.add( + InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + + " " + + StatCollector.translateToLocal("gui.de.AttackAOE.txt") + + ": " + + InfoHelper.HITC() + + attackaoe + + "x" + + attackaoe); return strings; } @@ -297,8 +323,9 @@ public class DraconicSword extends ItemSword @Override public List getDisplayData(ItemStack stack) { List list = new ArrayList(); - for (ItemConfigField field : getFields(stack, 0)) - list.add(field.getTooltipInfo()); // list.add(field.getLocalizedName() + ": " + field.getFormattedValue()); + for (ItemConfigField field : getFields(stack, 0)) list.add(field.getTooltipInfo()); // list.add(field.getLocalizedName() + // + ": " + + // field.getFormattedValue()); return list; } @@ -308,8 +335,8 @@ public class DraconicSword extends ItemSword ToolBase.handleModeChange(stack, player, InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown()); } else if (world.isRemote && BrandonsCore.proxy.getMCServer() == null) { ToolBase.handleModeChange(stack, player, InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown()); - DraconicEvolution.network.sendToServer( - new ToolModePacket(InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown())); + DraconicEvolution.network + .sendToServer(new ToolModePacket(InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown())); } return super.onItemRightClick(stack, world, player); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/IEnergyContainerWeaponItem.java b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/IEnergyContainerWeaponItem.java index f65de351..6e352d22 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/IEnergyContainerWeaponItem.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/IEnergyContainerWeaponItem.java @@ -3,5 +3,6 @@ package com.brandon3055.draconicevolution.common.items.weapons; import cofh.api.energy.IEnergyContainerItem; public interface IEnergyContainerWeaponItem extends IEnergyContainerItem { + int getEnergyPerAttack(); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernBow.java b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernBow.java index 3575b8fb..bb681d00 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernBow.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernBow.java @@ -1,5 +1,22 @@ package com.brandon3055.draconicevolution.common.items.weapons; +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnumEnchantmentType; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBow; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IIcon; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + import com.brandon3055.brandonscore.BrandonsCore; import com.brandon3055.brandonscore.common.utills.InfoHelper; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; @@ -16,29 +33,15 @@ import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem; import com.brandon3055.draconicevolution.common.utills.IInventoryTool; import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; + import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import java.util.ArrayList; -import java.util.List; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnumEnchantmentType; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemBow; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IIcon; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; public class WyvernBow extends ItemBow implements IInventoryTool, IUpgradableItem, IEnergyContainerWeaponItem, IHudDisplayItem { - public static final String[] bowPullIconNameArray = new String[] {"pulling_0", "pulling_1", "pulling_2"}; + public static final String[] bowPullIconNameArray = new String[] { "pulling_0", "pulling_1", "pulling_2" }; protected int capacity = BalanceConfigHandler.wyvernWeaponsBaseStorage; protected int maxReceive = BalanceConfigHandler.wyvernWeaponsMaxTransfer; @@ -82,8 +85,8 @@ public class WyvernBow extends ItemBow this.iconArray = new IIcon[bowPullIconNameArray.length]; for (int i = 0; i < this.iconArray.length; ++i) { - this.iconArray[i] = iconRegister.registerIcon( - References.RESOURCESPREFIX + "wyvern_bow" + "_" + bowPullIconNameArray[i]); + this.iconArray[i] = iconRegister + .registerIcon(References.RESOURCESPREFIX + "wyvern_bow" + "_" + bowPullIconNameArray[i]); } } @@ -126,13 +129,15 @@ public class WyvernBow extends ItemBow @Override @SideOnly(Side.CLIENT) - public void addInformation( - final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) { + public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, + final boolean extraInformation) { boolean show = InfoHelper.holdShiftForDetails(list); if (show) { int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0); - list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("info.de.capacitorMode.txt") + ": " - + ItemNBTHelper.getString(stack, "ProfileName" + preset, "Profile " + preset)); + list.add( + EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("info.de.capacitorMode.txt") + + ": " + + ItemNBTHelper.getString(stack, "ProfileName" + preset, "Profile " + preset)); List l = getFields(stack, 0); for (ItemConfigField f : l) list.add(f.getTooltipInfo()); } @@ -199,27 +204,25 @@ public class WyvernBow extends ItemBow public List getFields(ItemStack stack, int slot) { List list = new ArrayList(); - list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowArrowDamage") - .setMinMaxAndIncromente( + list.add( + new ItemConfigField(References.FLOAT_ID, slot, "BowArrowDamage").setMinMaxAndIncromente( (float) getBaseUpgradePoints(EnumUpgrade.ARROW_DAMAGE.index), (float) EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(stack), - 0.1F) - .readFromItem(stack, (float) EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(stack))); - list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowArrowSpeedModifier") - .setMinMaxAndIncromente(0F, (float) EnumUpgrade.ARROW_SPEED.getUpgradePoints(stack), 0.01F) - .readFromItem(stack, 0F) - .setModifier("PLUSPERCENT")); + 0.1F).readFromItem(stack, (float) EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(stack))); + list.add( + new ItemConfigField(References.FLOAT_ID, slot, "BowArrowSpeedModifier") + .setMinMaxAndIncromente(0F, (float) EnumUpgrade.ARROW_SPEED.getUpgradePoints(stack), 0.01F) + .readFromItem(stack, 0F).setModifier("PLUSPERCENT")); list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "BowAutoFire").readFromItem(stack, false)); - list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowExplosionPower") - .setMinMaxAndIncromente(0F, 4F, 0.1F) - .readFromItem(stack, 0F)); - // list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowShockWavePower").setMinMaxAndIncromente(0F, 4F, + list.add( + new ItemConfigField(References.FLOAT_ID, slot, "BowExplosionPower").setMinMaxAndIncromente(0F, 4F, 0.1F) + .readFromItem(stack, 0F)); + // list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowShockWavePower").setMinMaxAndIncromente(0F, 4F, // 0.1F).readFromItem(stack, 0F)); - // list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "BowEnergyBolt").readFromItem(stack, false)); - list.add(new ItemConfigField(References.FLOAT_ID, slot, "BowZoomModifier") - .setMinMaxAndIncromente(0F, 3F, 0.01F) - .readFromItem(stack, 0F) - .setModifier("PLUSPERCENT")); + // list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "BowEnergyBolt").readFromItem(stack, false)); + list.add( + new ItemConfigField(References.FLOAT_ID, slot, "BowZoomModifier").setMinMaxAndIncromente(0F, 3F, 0.01F) + .readFromItem(stack, 0F).setModifier("PLUSPERCENT")); return list; } @@ -232,6 +235,7 @@ public class WyvernBow extends ItemBow @Override public List getUpgrades(ItemStack itemstack) { return new ArrayList() { + { add(EnumUpgrade.RF_CAPACITY); add(EnumUpgrade.DRAW_SPEED); @@ -291,15 +295,29 @@ public class WyvernBow extends ItemBow public List getUpgradeStats(ItemStack stack) { BowHandler.BowProperties properties = new BowHandler.BowProperties(stack, null); List list = new ArrayList(); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + InfoHelper.HITC() - + Utills.formatNumber(getMaxEnergyStored(stack))); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " - + StatCollector.translateToLocal("gui.de.ArrowSpeed.txt") + ": " + InfoHelper.HITC() + "+" - + EnumUpgrade.ARROW_SPEED.getUpgradePoints(stack) * 100 + "%"); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.ArrowDamage.txt") + ": " + InfoHelper.HITC() - + properties.arrowDamage + ""); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.DrawSpeed.txt") + ": " + InfoHelper.HITC() - + properties.getDrawTicks() / 20D + "s"); + list.add( + InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + + ": " + + InfoHelper.HITC() + + Utills.formatNumber(getMaxEnergyStored(stack))); + list.add( + InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + + " " + + StatCollector.translateToLocal("gui.de.ArrowSpeed.txt") + + ": " + + InfoHelper.HITC() + + "+" + + EnumUpgrade.ARROW_SPEED.getUpgradePoints(stack) * 100 + + "%"); + list.add( + InfoHelper.ITC() + StatCollector.translateToLocal( + "gui.de.ArrowDamage.txt") + ": " + InfoHelper.HITC() + properties.arrowDamage + ""); + list.add( + InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.DrawSpeed.txt") + + ": " + + InfoHelper.HITC() + + properties.getDrawTicks() / 20D + + "s"); return list; } @@ -346,14 +364,17 @@ public class WyvernBow extends ItemBow && BrandonsCore.proxy.getClientPlayer().getItemInUse() != null) { EntityPlayer player = BrandonsCore.proxy.getClientPlayer(); BowHandler.BowProperties properties = new BowHandler.BowProperties(stack, player); - int power = (int) - Math.min(((float) player.getItemInUseDuration() / (float) properties.getDrawTicks() * 100F), 100F); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.power.txt") + ": " + InfoHelper.HITC() - + power + "%"); + int power = (int) Math + .min(((float) player.getItemInUseDuration() / (float) properties.getDrawTicks() * 100F), 100F); + list.add( + InfoHelper.ITC() + StatCollector + .translateToLocal("info.de.power.txt") + ": " + InfoHelper.HITC() + power + "%"); } else { int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0); - list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("info.de.capacitorMode.txt") + ": " - + ItemNBTHelper.getString(stack, "ProfileName" + preset, "Profile " + preset)); + list.add( + EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("info.de.capacitorMode.txt") + + ": " + + ItemNBTHelper.getString(stack, "ProfileName" + preset, "Profile " + preset)); for (ItemConfigField field : getFields(stack, 0)) { if ((field.datatype == References.FLOAT_ID && (Float) field.value > 0) @@ -361,15 +382,23 @@ public class WyvernBow extends ItemBow list.add(field.getTooltipInfo()); } - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.HITC() - + Utills.formatNumber(getEnergyStored(stack)) + " / " - + Utills.formatNumber(getMaxEnergyStored(stack))); + list.add( + InfoHelper.ITC() + StatCollector.translateToLocal("info.de.charge.txt") + + ": " + + InfoHelper.HITC() + + Utills.formatNumber(getEnergyStored(stack)) + + " / " + + Utills.formatNumber(getMaxEnergyStored(stack))); if (BrandonsCore.proxy.getClientPlayer() != null) { - BowHandler.BowProperties properties = - new BowHandler.BowProperties(stack, BrandonsCore.proxy.getClientPlayer()); - list.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.rfPerShot.txt") + ": " - + InfoHelper.HITC() + Utills.addCommas(properties.calculateEnergyCost())); + BowHandler.BowProperties properties = new BowHandler.BowProperties( + stack, + BrandonsCore.proxy.getClientPlayer()); + list.add( + InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.rfPerShot.txt") + + ": " + + InfoHelper.HITC() + + Utills.addCommas(properties.calculateEnergyCost())); if (!properties.canFire() && properties.cantFireMessage != null) list.add(EnumChatFormatting.DARK_RED + StatCollector.translateToLocal(properties.cantFireMessage)); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernSword.java b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernSword.java index 5cb59e20..bc196fb2 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernSword.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/weapons/WyvernSword.java @@ -1,5 +1,26 @@ package com.brandon3055.draconicevolution.common.items.weapons; +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnumEnchantmentType; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemSword; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; +import net.minecraftforge.client.IItemRenderer; + +import org.lwjgl.opengl.GL11; + import com.brandon3055.brandonscore.BrandonsCore; import com.brandon3055.brandonscore.common.utills.InfoHelper; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; @@ -16,27 +37,10 @@ import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.network.ToolModePacket; import com.brandon3055.draconicevolution.common.utills.*; import com.google.common.collect.Multimap; + import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import java.util.ArrayList; -import java.util.List; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnumEnchantmentType; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemSword; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; -import net.minecraftforge.client.IItemRenderer; -import org.lwjgl.opengl.GL11; public class WyvernSword extends ItemSword implements IEnergyContainerWeaponItem, IInventoryTool, IRenderTweak, IUpgradableItem, IHudDisplayItem { @@ -86,14 +90,17 @@ public class WyvernSword extends ItemSword @Override public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { ToolHandler.AOEAttack( - player, entity, stack, IConfigurableItem.ProfileHelper.getInteger(stack, References.ATTACK_AOE, 0)); + player, + entity, + stack, + IConfigurableItem.ProfileHelper.getInteger(stack, References.ATTACK_AOE, 0)); ToolHandler.damageEntityBasedOnHealth(entity, player, 0.1F); return true; } @Override - public void addInformation( - final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) { + public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, + final boolean extraInformation) { if (InfoHelper.holdShiftForDetails(list)) { List l = getFields(stack, 0); for (ItemConfigField f : l) list.add(f.getTooltipInfo()); @@ -103,10 +110,15 @@ public class WyvernSword extends ItemSword ToolBase.holdCTRLForUpgrades(list, stack); InfoHelper.addEnergyInfo(stack, list); list.add(""); - list.add(EnumChatFormatting.BLUE + "+" + ToolHandler.getBaseAttackDamage(stack) + " " - + StatCollector.translateToLocal("info.de.attackDamage.txt")); - list.add(EnumChatFormatting.BLUE + "+10%" + " " - + StatCollector.translateToLocal("info.de.bonusHealthDamage.txt")); + list.add( + EnumChatFormatting.BLUE + "+" + + ToolHandler.getBaseAttackDamage(stack) + + " " + + StatCollector.translateToLocal("info.de.attackDamage.txt")); + list.add( + EnumChatFormatting.BLUE + "+10%" + + " " + + StatCollector.translateToLocal("info.de.bonusHealthDamage.txt")); } @Override @@ -115,8 +127,8 @@ public class WyvernSword extends ItemSword } @Override - public boolean hitEntity( - ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) { + public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, + EntityLivingBase par3EntityLivingBase) { return super.hitEntity(par1ItemStack, par2EntityLivingBase, par3EntityLivingBase); } @@ -195,10 +207,10 @@ public class WyvernSword extends ItemSword @Override public List getFields(ItemStack stack, int slot) { List list = new ArrayList(); - list.add(new ItemConfigField(References.INT_ID, slot, References.ATTACK_AOE) - .setMinMaxAndIncromente(0, EnumUpgrade.ATTACK_AOE.getUpgradePoints(stack), 1) - .readFromItem(stack, 1) - .setModifier("AOE")); + list.add( + new ItemConfigField(References.INT_ID, slot, References.ATTACK_AOE) + .setMinMaxAndIncromente(0, EnumUpgrade.ATTACK_AOE.getUpgradePoints(stack), 1) + .readFromItem(stack, 1).setModifier("AOE")); return list; } @@ -230,6 +242,7 @@ public class WyvernSword extends ItemSword @Override public List getUpgrades(ItemStack itemstack) { return new ArrayList() { + { add(EnumUpgrade.RF_CAPACITY); add(EnumUpgrade.ATTACK_AOE); @@ -286,13 +299,25 @@ public class WyvernSword extends ItemSword for (ItemConfigField field : getFields(stack, 0)) if (field.name.equals(References.ATTACK_AOE)) attackaoe = 1 + ((Integer) field.max * 2); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " - + InfoHelper.HITC() + Utills.formatNumber(getMaxEnergyStored(stack))); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.attackDamage.txt") + ": " - + InfoHelper.HITC() + ToolHandler.getBaseAttackDamage(stack)); - strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " - + StatCollector.translateToLocal("gui.de.AttackAOE.txt") + ": " + InfoHelper.HITC() + attackaoe + "x" - + attackaoe); + strings.add( + InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + + ": " + + InfoHelper.HITC() + + Utills.formatNumber(getMaxEnergyStored(stack))); + strings.add( + InfoHelper.ITC() + StatCollector.translateToLocal("info.de.attackDamage.txt") + + ": " + + InfoHelper.HITC() + + ToolHandler.getBaseAttackDamage(stack)); + strings.add( + InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + + " " + + StatCollector.translateToLocal("gui.de.AttackAOE.txt") + + ": " + + InfoHelper.HITC() + + attackaoe + + "x" + + attackaoe); return strings; } @@ -300,8 +325,9 @@ public class WyvernSword extends ItemSword @Override public List getDisplayData(ItemStack stack) { List list = new ArrayList(); - for (ItemConfigField field : getFields(stack, 0)) - list.add(field.getTooltipInfo()); // list.add(field.getLocalizedName() + ": " + field.getFormattedValue()); + for (ItemConfigField field : getFields(stack, 0)) list.add(field.getTooltipInfo()); // list.add(field.getLocalizedName() + // + ": " + + // field.getFormattedValue()); return list; } @@ -311,8 +337,8 @@ public class WyvernSword extends ItemSword ToolBase.handleModeChange(stack, player, InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown()); } else if (world.isRemote && BrandonsCore.proxy.getMCServer() == null) { ToolBase.handleModeChange(stack, player, InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown()); - DraconicEvolution.network.sendToServer( - new ToolModePacket(InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown())); + DraconicEvolution.network + .sendToServer(new ToolModePacket(InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown())); } return super.onItemRightClick(stack, world, player); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/lib/OreDoublingRegistry.java b/src/main/java/com/brandon3055/draconicevolution/common/lib/OreDoublingRegistry.java index e21d7a7a..8c2055b6 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/lib/OreDoublingRegistry.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/lib/OreDoublingRegistry.java @@ -1,10 +1,8 @@ package com.brandon3055.draconicevolution.common.lib; -import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.items.DraconiumBlend; -import cpw.mods.fml.common.registry.GameRegistry; import java.util.HashMap; import java.util.Map; + import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; @@ -12,26 +10,18 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraftforge.oredict.OreDictionary; +import com.brandon3055.draconicevolution.common.ModItems; +import com.brandon3055.draconicevolution.common.items.DraconiumBlend; +import cpw.mods.fml.common.registry.GameRegistry; + /** * Created by Brandon on 2/11/2014. */ public class OreDoublingRegistry { + private static Map oreResults = new HashMap(); - private static String[] names = { - "oreGold", - "oreIron", - "oreAluminum", - "oreCopper", - "oreLead", - "oreSilver", - "oreTin", - "oreUranium", - "orePlatinum", - "oreNickel", - "oreMithril", - "oreCobalt", - "oreArdite" - }; + private static String[] names = { "oreGold", "oreIron", "oreAluminum", "oreCopper", "oreLead", "oreSilver", + "oreTin", "oreUranium", "orePlatinum", "oreNickel", "oreMithril", "oreCobalt", "oreArdite" }; public static Map resultOverrides = new HashMap(); public static void init() { @@ -51,9 +41,7 @@ public class OreDoublingRegistry { public static ItemStack getOreResult(ItemStack stack) { if (stack == null) return null; if (resultOverrides.containsKey(stack.getItem().getUnlocalizedName(stack))) - return resultOverrides - .get(stack.getItem().getUnlocalizedName(stack)) - .copy(); + return resultOverrides.get(stack.getItem().getUnlocalizedName(stack)).copy(); if (FurnaceRecipes.smelting().getSmeltingResult(stack) == null) return null; if (stack.getItem() instanceof DraconiumBlend) return new ItemStack(ModItems.draconiumIngot, 4); else if (stack.getItem() == Item.getItemFromBlock(Blocks.cobblestone)) return new ItemStack(Blocks.stone, 2); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/lib/References.java b/src/main/java/com/brandon3055/draconicevolution/common/lib/References.java index 879f20a7..b495ad60 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/lib/References.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/lib/References.java @@ -1,6 +1,7 @@ package com.brandon3055.draconicevolution.common.lib; public final class References { + public static final String MODID = "DraconicEvolution"; public static final String MODNAME = "Draconic Evolution"; public static final String VERSION = VersionHandler.FULL_VERSION; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/lib/Strings.java b/src/main/java/com/brandon3055/draconicevolution/common/lib/Strings.java index 57294537..fe4ef7cd 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/lib/Strings.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/lib/Strings.java @@ -1,6 +1,7 @@ package com.brandon3055.draconicevolution.common.lib; -public class Strings { // public static Block name +public class Strings { // public static Block name + public static final String blockWeatherControllerName = "weatherController"; public static final String tclogoName = "tclogo"; public static final String xrayBlockName = "xRayBlock"; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/lib/VersionHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/lib/VersionHandler.java index 00c7ab6a..3d102062 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/lib/VersionHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/lib/VersionHandler.java @@ -4,11 +4,12 @@ package com.brandon3055.draconicevolution.common.lib; * Created by Brandon on 24/02/2015. */ public class VersionHandler { + public static final String VERSION = "GRADLETOKEN_VERSION"; public static final int SNAPSHOT = 0; public static final String MCVERSION = "1.7.10"; - @SuppressWarnings({"unused"}) + @SuppressWarnings({ "unused" }) public static final String FULL_VERSION = VERSION + (SNAPSHOT > 0 ? "-snapshot_" + SNAPSHOT : ""); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/magic/EnchantmentReaper.java b/src/main/java/com/brandon3055/draconicevolution/common/magic/EnchantmentReaper.java index c4515590..e3e202b2 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/magic/EnchantmentReaper.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/magic/EnchantmentReaper.java @@ -7,6 +7,7 @@ import net.minecraft.enchantment.EnumEnchantmentType; * Created by Brandon on 17/11/2014. */ public class EnchantmentReaper extends Enchantment { + public EnchantmentReaper(int id) { super(id, 2, EnumEnchantmentType.weapon); setName("draconicevolution.reaperEnchant"); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/magic/PotionHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/magic/PotionHandler.java index 2fe42823..5beee6d3 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/magic/PotionHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/magic/PotionHandler.java @@ -24,23 +24,23 @@ public class PotionHandler { @Override public void renderInventoryEffect(int x, int y, PotionEffect effect, Minecraft mc) { - // mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.effect.txt"), x+7, y+6, 0xffffff); - // if (effect.getPotionID() == potionFlight.id) - // mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.flight.txt"), x+7, y+17, + // mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.effect.txt"), x+7, y+6, 0xffffff); + // if (effect.getPotionID() == potionFlight.id) + // mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.flight.txt"), x+7, y+17, // 0x00ff00); - // else if (effect.getPotionID() == potionUpHillStep.id) - // mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.highStep.txt"), x+7, y+17, + // else if (effect.getPotionID() == potionUpHillStep.id) + // mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.highStep.txt"), x+7, y+17, // 0x00ff00); - // else if (effect.getPotionID() == potionSpeed.id) - // mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.swiftness.txt"), x+7, y+17, + // else if (effect.getPotionID() == potionSpeed.id) + // mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.swiftness.txt"), x+7, y+17, // 0x00ff00); - // else if (effect.getPotionID() == potionFireResist.id) - // mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.fireImmune.txt"), x+7, y+17, + // else if (effect.getPotionID() == potionFireResist.id) + // mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.fireImmune.txt"), x+7, y+17, // 0x00ff00); - // else if (effect.getPotionID() == potionJumpBoost.id) - // mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.jumpBoost.txt"), x+7, y+17, + // else if (effect.getPotionID() == potionJumpBoost.id) + // mc.fontRenderer.drawString(StatCollector.translateToLocal("magic.de.jumpBoost.txt"), x+7, y+17, // 0x00ff00); - // if (effect.getAmplifier() > 0)mc.fontRenderer.drawString("lvl: "+(effect.getAmplifier()+1), x+86, y+12, + // if (effect.getAmplifier() > 0)mc.fontRenderer.drawString("lvl: "+(effect.getAmplifier()+1), x+86, y+12, // 0xff0000); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/BlockUpdatePacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/BlockUpdatePacket.java index cabc65b5..3fb85f56 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/BlockUpdatePacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/BlockUpdatePacket.java @@ -1,12 +1,14 @@ package com.brandon3055.draconicevolution.common.network; +import net.minecraft.network.play.server.S23PacketBlockChange; + import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import io.netty.buffer.ByteBuf; -import net.minecraft.network.play.server.S23PacketBlockChange; public class BlockUpdatePacket implements IMessage { + int x, y, z; public BlockUpdatePacket() {} @@ -35,11 +37,12 @@ public class BlockUpdatePacket implements IMessage { @Override public IMessage onMessage(BlockUpdatePacket message, MessageContext ctx) { - ctx.getServerHandler() - .playerEntity - .playerNetServerHandler - .sendPacket(new S23PacketBlockChange( - message.x, message.y, message.z, ctx.getServerHandler().playerEntity.worldObj)); + ctx.getServerHandler().playerEntity.playerNetServerHandler.sendPacket( + new S23PacketBlockChange( + message.x, + message.y, + message.z, + ctx.getServerHandler().playerEntity.worldObj)); return null; } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/ButtonPacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/ButtonPacket.java index 4c4bb453..2be68695 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/ButtonPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/ButtonPacket.java @@ -1,5 +1,8 @@ package com.brandon3055.draconicevolution.common.network; +import net.minecraft.inventory.Container; +import net.minecraft.item.ItemStack; + import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.gui.GuiHandler; @@ -10,14 +13,14 @@ import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter; import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; import com.brandon3055.draconicevolution.common.tileentities.TileWeatherController; import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; + import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import io.netty.buffer.ByteBuf; -import net.minecraft.inventory.Container; -import net.minecraft.item.ItemStack; public class ButtonPacket implements IMessage { + public static final byte ID_WEATHERCONTROLLER = 0; public static final byte ID_DISSENCHANTER = 1; public static final byte ID_DRACONIUMCHEST0 = 2; @@ -111,21 +114,18 @@ public class ButtonPacket implements IMessage { break; } case ID_TOOLCONFIG: { - ctx.getServerHandler() - .playerEntity - .openGui( - DraconicEvolution.instance, - GuiHandler.GUIID_TOOL_CONFIG, - ctx.getServerHandler().playerEntity.worldObj, - (int) ctx.getServerHandler().playerEntity.posX, - (int) ctx.getServerHandler().playerEntity.posY, - (int) ctx.getServerHandler().playerEntity.posZ); + ctx.getServerHandler().playerEntity.openGui( + DraconicEvolution.instance, + GuiHandler.GUIID_TOOL_CONFIG, + ctx.getServerHandler().playerEntity.worldObj, + (int) ctx.getServerHandler().playerEntity.posX, + (int) ctx.getServerHandler().playerEntity.posY, + (int) ctx.getServerHandler().playerEntity.posZ); break; } case ID_TOOL_PROFILE_CHANGE: { ItemStack stack = ctx.getServerHandler().playerEntity.getHeldItem(); - if (stack != null - && stack.getItem() instanceof IConfigurableItem + if (stack != null && stack.getItem() instanceof IConfigurableItem && ((IConfigurableItem) stack.getItem()).hasProfiles()) { int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0); if (++preset >= 5) preset = 0; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/ContributorPacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/ContributorPacket.java index d51446e7..d9babbc7 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/ContributorPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/ContributorPacket.java @@ -1,17 +1,20 @@ package com.brandon3055.draconicevolution.common.network; +import net.minecraft.entity.player.EntityPlayer; + import com.brandon3055.brandonscore.BrandonsCore; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.handler.ContributorHandler; + import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cpw.mods.fml.relauncher.Side; import io.netty.buffer.ByteBuf; -import net.minecraft.entity.player.EntityPlayer; public class ContributorPacket implements IMessage { + public String contributor; public boolean wings; public boolean badge; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/GenericParticlePacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/GenericParticlePacket.java index 708e76a2..db9ce037 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/GenericParticlePacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/GenericParticlePacket.java @@ -3,6 +3,7 @@ package com.brandon3055.draconicevolution.common.network; import com.brandon3055.brandonscore.BrandonsCore; import com.brandon3055.draconicevolution.client.handler.ParticleHandler; import com.brandon3055.draconicevolution.client.render.particle.Particles; + import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; @@ -11,6 +12,7 @@ import cpw.mods.fml.relauncher.SideOnly; import io.netty.buffer.ByteBuf; public class GenericParticlePacket implements IMessage { + public static final byte ENERGY_BALL_KILL = 0; public static final byte CHAOS_BALL_KILL = 1; public static final byte CHAOS_IMPLOSION = 3; @@ -126,36 +128,16 @@ public class GenericParticlePacket implements IMessage { for (int i = 0; i < 100; i++) { Particles.ArrowParticle particle = new Particles.ArrowParticle( BrandonsCore.proxy.getClientWorld(), - message.posX - - 0.25 - + BrandonsCore.proxy - .getClientWorld() - .rand - .nextDouble() - * 0.5, - message.posY - + BrandonsCore.proxy - .getClientWorld() - .rand - .nextDouble() - * 0.5, - message.posZ - - 0.25 - + BrandonsCore.proxy - .getClientWorld() - .rand - .nextDouble() - * 0.5, + message.posX - 0.25 + BrandonsCore.proxy.getClientWorld().rand.nextDouble() * 0.5, + message.posY + BrandonsCore.proxy.getClientWorld().rand.nextDouble() * 0.5, + message.posZ - 0.25 + BrandonsCore.proxy.getClientWorld().rand.nextDouble() * 0.5, 0xff6000, 0.2F + BrandonsCore.proxy.getClientWorld().rand.nextFloat() * 10f); double mm = 2; - particle.motionX = - (BrandonsCore.proxy.getClientWorld().rand.nextDouble() - 0.5) * mm; - particle.motionY = - (BrandonsCore.proxy.getClientWorld().rand.nextDouble() - 0.5) * mm; - particle.motionZ = - (BrandonsCore.proxy.getClientWorld().rand.nextDouble() - 0.5) * mm; + particle.motionX = (BrandonsCore.proxy.getClientWorld().rand.nextDouble() - 0.5) * mm; + particle.motionY = (BrandonsCore.proxy.getClientWorld().rand.nextDouble() - 0.5) * mm; + particle.motionZ = (BrandonsCore.proxy.getClientWorld().rand.nextDouble() - 0.5) * mm; ParticleHandler.spawnCustomParticle(particle, 64); } break; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/ItemConfigPacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/ItemConfigPacket.java index 490c12c1..8631bfb3 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/ItemConfigPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/ItemConfigPacket.java @@ -1,20 +1,24 @@ package com.brandon3055.draconicevolution.common.network; +import java.util.List; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + import com.brandon3055.brandonscore.common.lib.References; import com.brandon3055.brandonscore.common.utills.DataUtills; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; import com.brandon3055.draconicevolution.common.utills.ItemConfigField; + import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import io.netty.buffer.ByteBuf; -import java.util.List; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; public class ItemConfigPacket implements IMessage { + public byte datatype; public int slot; public Object value; @@ -70,7 +74,9 @@ public class ItemConfigPacket implements IMessage { if (message.renameProfile) { ItemNBTHelper.setString( - stack, "ProfileName" + ItemNBTHelper.getInteger(stack, "ConfigProfile", 0), message.name); + stack, + "ProfileName" + ItemNBTHelper.getInteger(stack, "ConfigProfile", 0), + message.name); return null; } @@ -79,8 +85,11 @@ public class ItemConfigPacket implements IMessage { for (ItemConfigField field : fields) { if (field.name.equals(message.name) && message.datatype == field.datatype) { - ItemConfigField newValue = - new ItemConfigField(message.datatype, message.value, message.slot, message.name); + ItemConfigField newValue = new ItemConfigField( + message.datatype, + message.value, + message.slot, + message.name); if (newValue.castToDouble() <= field.castMaxToDouble() && newValue.castToDouble() >= field.castMinToDouble()) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/MagnetToggleAckPacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/MagnetToggleAckPacket.java index fece76d5..1285ebd3 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/MagnetToggleAckPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/MagnetToggleAckPacket.java @@ -1,18 +1,21 @@ package com.brandon3055.draconicevolution.common.network; +import java.util.Optional; + +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + import com.brandon3055.draconicevolution.client.handler.ClientEventHandler; import com.brandon3055.draconicevolution.common.items.tools.Magnet; import com.brandon3055.draconicevolution.common.utills.InventoryUtils; + import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import io.netty.buffer.ByteBuf; -import java.util.Optional; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; public final class MagnetToggleAckPacket implements IMessage { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/MagnetTogglePacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/MagnetTogglePacket.java index ec0fd1d7..9f40cb82 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/MagnetTogglePacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/MagnetTogglePacket.java @@ -1,15 +1,18 @@ package com.brandon3055.draconicevolution.common.network; +import java.util.Optional; + +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; + import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.items.tools.Magnet; import com.brandon3055.draconicevolution.common.utills.InventoryUtils; + import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import io.netty.buffer.ByteBuf; -import java.util.Optional; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; public final class MagnetTogglePacket implements IMessage { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/MountUpdatePacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/MountUpdatePacket.java index 1945bccc..50ce995f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/MountUpdatePacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/MountUpdatePacket.java @@ -1,6 +1,7 @@ package com.brandon3055.draconicevolution.common.network; import com.brandon3055.draconicevolution.client.handler.ClientEventHandler; + import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; @@ -39,8 +40,7 @@ public class MountUpdatePacket implements IMessage { ctx.getServerHandler().playerEntity.mountEntity(null); return null; } else if (ctx.getServerHandler().playerEntity.ridingEntity != null) { - return new MountUpdatePacket( - ctx.getServerHandler().playerEntity.ridingEntity.getEntityId()); + return new MountUpdatePacket(ctx.getServerHandler().playerEntity.ridingEntity.getEntityId()); } return null; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/ParticleGenPacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/ParticleGenPacket.java index 0b20ab27..40d3d2d7 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/ParticleGenPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/ParticleGenPacket.java @@ -1,11 +1,5 @@ package com.brandon3055.draconicevolution.common.network; -import com.brandon3055.draconicevolution.common.tileentities.TileParticleGenerator; -import com.brandon3055.draconicevolution.common.utills.LogHelper; -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; -import io.netty.buffer.ByteBuf; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; @@ -14,7 +8,16 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChatComponentText; +import com.brandon3055.draconicevolution.common.tileentities.TileParticleGenerator; +import com.brandon3055.draconicevolution.common.utills.LogHelper; + +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import io.netty.buffer.ByteBuf; + public class ParticleGenPacket implements IMessage { + byte buttonId = 0; short value = 0; int tileX = 0; @@ -53,12 +56,11 @@ public class ParticleGenPacket implements IMessage { @Override public IMessage onMessage(ParticleGenPacket message, MessageContext ctx) { - TileEntity tile = ctx.getServerHandler() - .playerEntity - .worldObj + TileEntity tile = ctx.getServerHandler().playerEntity.worldObj .getTileEntity(message.tileX, message.tileY, message.tileZ); - TileParticleGenerator gen = - (tile != null && tile instanceof TileParticleGenerator) ? (TileParticleGenerator) tile : null; + TileParticleGenerator gen = (tile != null && tile instanceof TileParticleGenerator) + ? (TileParticleGenerator) tile + : null; if (gen != null) { // System.out.println(buttonId + " " + value); switch (message.buttonId) { @@ -295,16 +297,11 @@ public class ParticleGenPacket implements IMessage { if (ctx.getServerHandler().playerEntity.capabilities.isCreativeMode || ctx.getServerHandler().playerEntity.inventory.hasItem(Items.paper)) { giveNote(message, ctx); - } else - ctx.getServerHandler() - .playerEntity - .addChatComponentMessage( - new ChatComponentText("You need paper in your inventory to do that")); + } else ctx.getServerHandler().playerEntity.addChatComponentMessage( + new ChatComponentText("You need paper in your inventory to do that")); } - ctx.getServerHandler() - .playerEntity - .worldObj + ctx.getServerHandler().playerEntity.worldObj .markBlockForUpdate(message.tileX, message.tileY, message.tileZ); } return null; @@ -315,12 +312,11 @@ public class ParticleGenPacket implements IMessage { if (!player.capabilities.isCreativeMode) player.inventory.consumeInventoryItem(Items.paper); ItemStack stack = new ItemStack(Items.paper); stack.setTagCompound(new NBTTagCompound()); - TileEntity tile = ctx.getServerHandler() - .playerEntity - .worldObj + TileEntity tile = ctx.getServerHandler().playerEntity.worldObj .getTileEntity(message.tileX, message.tileY, message.tileZ); - TileParticleGenerator gen = - (tile != null && tile instanceof TileParticleGenerator) ? (TileParticleGenerator) tile : null; + TileParticleGenerator gen = (tile != null && tile instanceof TileParticleGenerator) + ? (TileParticleGenerator) tile + : null; if (gen != null) { gen.getBlockNBT(stack.getTagCompound()); stack.setStackDisplayName("Saved Particle Gen Settings"); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/PlacedItemPacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/PlacedItemPacket.java index 03f95d44..d9c52702 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/PlacedItemPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/PlacedItemPacket.java @@ -1,11 +1,5 @@ package com.brandon3055.draconicevolution.common.network; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.tileentities.TilePlacedItem; -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; -import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; @@ -14,10 +8,19 @@ import net.minecraftforge.common.util.BlockSnapshot; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.event.world.BlockEvent; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.tileentities.TilePlacedItem; + +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import io.netty.buffer.ByteBuf; + /** * Created by Brandon on 14/08/2014. */ public class PlacedItemPacket implements IMessage { + byte side = 0; int blockX = 0; int blockY = 0; @@ -59,9 +62,9 @@ public class PlacedItemPacket implements IMessage { World world = ctx.getServerHandler().playerEntity.worldObj; EntityPlayer player = ctx.getServerHandler().playerEntity; - if (!world.isAirBlock(x, y, z) - || player.getHeldItem() == null - || !ModBlocks.isEnabled(ModBlocks.placedItem)) return null; + if (!world.isAirBlock(x, y, z) || player.getHeldItem() == null + || !ModBlocks.isEnabled(ModBlocks.placedItem)) + return null; BlockEvent.PlaceEvent event = new BlockEvent.PlaceEvent( new BlockSnapshot(world, x, y, z, ModBlocks.placedItem, 0), @@ -76,8 +79,8 @@ public class PlacedItemPacket implements IMessage { ItemStack stack = player.getHeldItem(); world.setBlock(x, y, z, ModBlocks.placedItem, message.side, 2); - TilePlacedItem tile = - (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TilePlacedItem) + TilePlacedItem tile = (world.getTileEntity(x, y, z) != null + && world.getTileEntity(x, y, z) instanceof TilePlacedItem) ? (TilePlacedItem) world.getTileEntity(x, y, z) : null; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/PlayerDetectorButtonPacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/PlayerDetectorButtonPacket.java index 9e8976ba..dc0abde7 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/PlayerDetectorButtonPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/PlayerDetectorButtonPacket.java @@ -2,12 +2,14 @@ package com.brandon3055.draconicevolution.common.network; import com.brandon3055.draconicevolution.common.container.ContainerPlayerDetector; import com.brandon3055.draconicevolution.common.tileentities.TilePlayerDetectorAdvanced; + import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import io.netty.buffer.ByteBuf; public class PlayerDetectorButtonPacket implements IMessage { + private short index = 0; private short value = 0; @@ -34,12 +36,13 @@ public class PlayerDetectorButtonPacket implements IMessage { @Override public IMessage onMessage(PlayerDetectorButtonPacket message, MessageContext ctx) { - ContainerPlayerDetector container = - (ctx.getServerHandler().playerEntity.openContainer instanceof ContainerPlayerDetector) + ContainerPlayerDetector container = (ctx + .getServerHandler().playerEntity.openContainer instanceof ContainerPlayerDetector) ? (ContainerPlayerDetector) ctx.getServerHandler().playerEntity.openContainer : null; - TilePlayerDetectorAdvanced tile = - (container != null) ? ((ContainerPlayerDetector) container).getTileDetector() : null; + TilePlayerDetectorAdvanced tile = (container != null) + ? ((ContainerPlayerDetector) container).getTileDetector() + : null; if (tile != null) { switch (message.index) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/PlayerDetectorStringPacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/PlayerDetectorStringPacket.java index d0a9397e..eb4c4203 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/PlayerDetectorStringPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/PlayerDetectorStringPacket.java @@ -2,6 +2,7 @@ package com.brandon3055.draconicevolution.common.network; import com.brandon3055.draconicevolution.common.container.ContainerPlayerDetector; import com.brandon3055.draconicevolution.common.tileentities.TilePlayerDetectorAdvanced; + import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; @@ -9,6 +10,7 @@ import cpw.mods.fml.common.network.simpleimpl.MessageContext; import io.netty.buffer.ByteBuf; public class PlayerDetectorStringPacket implements IMessage { + private int index = 0; private String name = ""; @@ -35,8 +37,8 @@ public class PlayerDetectorStringPacket implements IMessage { @Override public IMessage onMessage(PlayerDetectorStringPacket message, MessageContext ctx) { - ContainerPlayerDetector container = - (ctx.getServerHandler().playerEntity.openContainer instanceof ContainerPlayerDetector) + ContainerPlayerDetector container = (ctx + .getServerHandler().playerEntity.openContainer instanceof ContainerPlayerDetector) ? (ContainerPlayerDetector) ctx.getServerHandler().playerEntity.openContainer : null; TilePlayerDetectorAdvanced tile = (container != null) ? container.getTileDetector() : null; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/ShieldHitPacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/ShieldHitPacket.java index 0601e9bc..a989a1fc 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/ShieldHitPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/ShieldHitPacket.java @@ -1,19 +1,22 @@ package com.brandon3055.draconicevolution.common.network; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; + import com.brandon3055.brandonscore.common.utills.DataUtills; import com.brandon3055.draconicevolution.client.handler.ClientEventHandler; + import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import io.netty.buffer.ByteBuf; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; /** * Created by brandon3055 on 15/2/2016. */ public class ShieldHitPacket implements IMessage { + public int playerID; public byte shieldPowerB; public float shieldPowerF; @@ -43,10 +46,9 @@ public class ShieldHitPacket implements IMessage { @Override public IMessage onMessage(ShieldHitPacket message, MessageContext ctx) { Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(message.playerID); - if (entity instanceof EntityPlayer) - ClientEventHandler.playerShieldStatus.put( - (EntityPlayer) entity, - new DataUtills.XZPair(message.shieldPowerF, ClientEventHandler.elapsedTicks)); + if (entity instanceof EntityPlayer) ClientEventHandler.playerShieldStatus.put( + (EntityPlayer) entity, + new DataUtills.XZPair(message.shieldPowerF, ClientEventHandler.elapsedTicks)); return null; } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/SpeedRequestPacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/SpeedRequestPacket.java index e983ba61..7b47b8c8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/SpeedRequestPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/SpeedRequestPacket.java @@ -4,6 +4,7 @@ import com.brandon3055.brandonscore.BrandonsCore; import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.handler.MinecraftForgeEventHandler; import com.brandon3055.draconicevolution.common.utills.LogHelper; + import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; @@ -14,6 +15,7 @@ import io.netty.buffer.ByteBuf; * Created by Brandon on 26/03/2015. */ public class SpeedRequestPacket implements IMessage { + double speed = 0F; public SpeedRequestPacket() {} @@ -38,9 +40,9 @@ public class SpeedRequestPacket implements IMessage { public IMessage onMessage(SpeedRequestPacket message, MessageContext ctx) { if (ctx.side == Side.SERVER) { if (ConfigHandler.speedLimitDimList.contains(ctx.getServerHandler().playerEntity.dimension) - || (BrandonsCore.proxy.isOp( - ctx.getServerHandler().playerEntity.getCommandSenderName()) - && !ConfigHandler.speedLimitops)) return new SpeedRequestPacket(20F); + || (BrandonsCore.proxy.isOp(ctx.getServerHandler().playerEntity.getCommandSenderName()) + && !ConfigHandler.speedLimitops)) + return new SpeedRequestPacket(20F); return new SpeedRequestPacket(ConfigHandler.maxPlayerSpeed); } else { MinecraftForgeEventHandler.maxSpeed = message.speed; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/TeleporterPacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/TeleporterPacket.java index 10d8985c..3b93b5f6 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/TeleporterPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/TeleporterPacket.java @@ -1,21 +1,24 @@ package com.brandon3055.draconicevolution.common.network; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; + import com.brandon3055.brandonscore.BrandonsCore; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; import com.brandon3055.brandonscore.common.utills.Teleporter.TeleportLocation; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.handler.ConfigHandler; + import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import io.netty.buffer.ByteBuf; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; public class TeleporterPacket implements IMessage { + public static final int ADDDESTINATION = 0; public static final int REMOVEDESTINATION = 1; public static final int UPDATENAME = 2; @@ -72,8 +75,7 @@ public class TeleporterPacket implements IMessage { bytes.writeBoolean(dataB); } - if (function == UPDATEOFFSET - || function == CHANGESELECTION + if (function == UPDATEOFFSET || function == CHANGESELECTION || function == REMOVEDESTINATION || function == ADDFUEL || function == SCROLL) { @@ -111,8 +113,7 @@ public class TeleporterPacket implements IMessage { dataB = bytes.readBoolean(); } - if (function == UPDATEOFFSET - || function == CHANGESELECTION + if (function == UPDATEOFFSET || function == CHANGESELECTION || function == REMOVEDESTINATION || function == ADDFUEL || function == SCROLL) { @@ -144,11 +145,9 @@ public class TeleporterPacket implements IMessage { if (message.function == ADDDESTINATION) { NBTTagCompound tag = new NBTTagCompound(); - message.location.setDimentionName(BrandonsCore.proxy - .getMCServer() - .worldServerForDimension(message.location.getDimension()) - .provider - .getDimensionName()); + message.location.setDimentionName( + BrandonsCore.proxy.getMCServer() + .worldServerForDimension(message.location.getDimension()).provider.getDimensionName()); message.location.writeToNBT(tag); list.appendTag(tag); compound.setTag("Locations", list); @@ -181,11 +180,9 @@ public class TeleporterPacket implements IMessage { if (message.function == UPDATEDESTINATION) { NBTTagCompound tag = list.getCompoundTagAt(message.data); - message.location.setDimentionName(BrandonsCore.proxy - .getMCServer() - .worldServerForDimension(message.location.getDimension()) - .provider - .getDimensionName()); + message.location.setDimentionName( + BrandonsCore.proxy.getMCServer() + .worldServerForDimension(message.location.getDimension()).provider.getDimensionName()); message.location.writeToNBT(tag); list.func_150304_a(message.data, tag); compound.setTag("Locations", list); @@ -230,24 +227,30 @@ public class TeleporterPacket implements IMessage { if (selected > 0) { NBTTagCompound temp = list.getCompoundTagAt(selected + selectionOffset); list.func_150304_a( - selected + selectionOffset, list.getCompoundTagAt(selected + selectionOffset - 1)); + selected + selectionOffset, + list.getCompoundTagAt(selected + selectionOffset - 1)); list.func_150304_a(selected + selectionOffset - 1, temp); compound.setTag("Locations", list); teleporter.setTagCompound(compound); - ItemNBTHelper.setShort(teleporter, "Selection", (short) - (ItemNBTHelper.getShort(teleporter, "Selection", (short) 0) - 1)); + ItemNBTHelper.setShort( + teleporter, + "Selection", + (short) (ItemNBTHelper.getShort(teleporter, "Selection", (short) 0) - 1)); } } else // down { if (selected < maxSelect) { NBTTagCompound temp = list.getCompoundTagAt(selected + selectionOffset); list.func_150304_a( - selected + selectionOffset, list.getCompoundTagAt(selected + selectionOffset + 1)); + selected + selectionOffset, + list.getCompoundTagAt(selected + selectionOffset + 1)); list.func_150304_a(selected + selectionOffset + 1, temp); compound.setTag("Locations", list); teleporter.setTagCompound(compound); - ItemNBTHelper.setShort(teleporter, "Selection", (short) - (ItemNBTHelper.getShort(teleporter, "Selection", (short) 0) + 1)); + ItemNBTHelper.setShort( + teleporter, + "Selection", + (short) (ItemNBTHelper.getShort(teleporter, "Selection", (short) 0) + 1)); } } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/TileObjectPacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/TileObjectPacket.java index 782479ce..c5ffacb5 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/TileObjectPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/TileObjectPacket.java @@ -1,14 +1,16 @@ package com.brandon3055.draconicevolution.common.network; +import net.minecraft.client.Minecraft; + import com.brandon3055.brandonscore.common.utills.DataUtills; import com.brandon3055.draconicevolution.common.container.ContainerDataSync; import com.brandon3055.draconicevolution.common.tileentities.TileObjectSync; + import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cpw.mods.fml.relauncher.Side; import io.netty.buffer.ByteBuf; -import net.minecraft.client.Minecraft; /** * Created by Brandon on 14/11/2014. @@ -78,34 +80,34 @@ public class TileObjectPacket implements IMessage { public IMessage onMessage(TileObjectPacket message, MessageContext ctx) { if (ctx.side == Side.CLIENT) { if (message.isContainerPacket) { - ContainerDataSync container = - Minecraft.getMinecraft().thePlayer.openContainer instanceof ContainerDataSync + ContainerDataSync container = Minecraft + .getMinecraft().thePlayer.openContainer instanceof ContainerDataSync ? (ContainerDataSync) Minecraft.getMinecraft().thePlayer.openContainer : null; if (container == null) return null; container.receiveSyncData(message.index, (Integer) message.object); } else { - if (!(Minecraft.getMinecraft().theWorld.getTileEntity(message.x, message.y, message.z) - instanceof TileObjectSync)) return null; + if (!(Minecraft.getMinecraft().theWorld + .getTileEntity(message.x, message.y, message.z) instanceof TileObjectSync)) + return null; ((TileObjectSync) Minecraft.getMinecraft().theWorld.getTileEntity(message.x, message.y, message.z)) .receiveObjectFromServer(message.index, message.object); } } else { if (message.isContainerPacket) { - ContainerDataSync container = - ctx.getServerHandler().playerEntity.openContainer instanceof ContainerDataSync + ContainerDataSync container = ctx + .getServerHandler().playerEntity.openContainer instanceof ContainerDataSync ? (ContainerDataSync) ctx.getServerHandler().playerEntity.openContainer : null; if (container == null) return null; container.receiveSyncData(message.index, (Integer) message.object); } else { - if (!(ctx.getServerHandler().playerEntity.worldObj.getTileEntity(message.x, message.y, message.z) - instanceof TileObjectSync)) return null; - ((TileObjectSync) ctx.getServerHandler() - .playerEntity - .worldObj - .getTileEntity(message.x, message.y, message.z)) - .receiveObjectFromClient(message.index, message.object); + if (!(ctx.getServerHandler().playerEntity.worldObj + .getTileEntity(message.x, message.y, message.z) instanceof TileObjectSync)) + return null; + ((TileObjectSync) ctx.getServerHandler().playerEntity.worldObj + .getTileEntity(message.x, message.y, message.z)) + .receiveObjectFromClient(message.index, message.object); } } return null; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/ToolModePacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/ToolModePacket.java index ff33fc3a..52401b8c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/ToolModePacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/ToolModePacket.java @@ -1,6 +1,7 @@ package com.brandon3055.draconicevolution.common.network; import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolBase; + import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; @@ -34,6 +35,7 @@ public class ToolModePacket implements IMessage { } public static class Handler implements IMessageHandler { + @Override public IMessage onMessage(ToolModePacket message, MessageContext ctx) { ToolBase.handleModeChange( diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/CustomSpawnerBaseLogic.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/CustomSpawnerBaseLogic.java index 694998b4..b8e8e80d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/CustomSpawnerBaseLogic.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/CustomSpawnerBaseLogic.java @@ -3,10 +3,8 @@ package com.brandon3055.draconicevolution.common.tileentities; /** * Created by Brandon on 5/07/2014. */ -import com.brandon3055.draconicevolution.common.handler.ConfigHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.Arrays; + import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityLiving; @@ -19,7 +17,13 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.common.handler.ConfigHandler; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public abstract class CustomSpawnerBaseLogic { + /** * The delay to spawn. */ @@ -85,14 +89,11 @@ public abstract class CustomSpawnerBaseLogic { */ public boolean isActivated() { if (!requiresPlayer) return true; - else - return this.getSpawnerWorld() - .getClosestPlayer( - (double) this.getSpawnerX() + 0.5D, - (double) this.getSpawnerY() + 0.5D, - (double) this.getSpawnerZ() + 0.5D, - (double) this.activatingRangeFromPlayer) - != null; + else return this.getSpawnerWorld().getClosestPlayer( + (double) this.getSpawnerX() + 0.5D, + (double) this.getSpawnerY() + 0.5D, + (double) this.getSpawnerZ() + 0.5D, + (double) this.activatingRangeFromPlayer) != null; } public void updateSpawner() { @@ -100,12 +101,9 @@ public abstract class CustomSpawnerBaseLogic { double d2; if (this.getSpawnerWorld().isRemote) { - double d0 = (double) ((float) this.getSpawnerX() - + this.getSpawnerWorld().rand.nextFloat()); - double d1 = (double) ((float) this.getSpawnerY() - + this.getSpawnerWorld().rand.nextFloat()); - d2 = (double) ((float) this.getSpawnerZ() - + this.getSpawnerWorld().rand.nextFloat()); + double d0 = (double) ((float) this.getSpawnerX() + this.getSpawnerWorld().rand.nextFloat()); + double d1 = (double) ((float) this.getSpawnerY() + this.getSpawnerWorld().rand.nextFloat()); + d2 = (double) ((float) this.getSpawnerZ() + this.getSpawnerWorld().rand.nextFloat()); this.getSpawnerWorld().spawnParticle("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D); this.getSpawnerWorld().spawnParticle("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D); @@ -114,8 +112,8 @@ public abstract class CustomSpawnerBaseLogic { } this.renderRotation1 = this.renderRotation0; - this.renderRotation0 = - (this.renderRotation0 + (double) (1000.0F / ((float) this.spawnDelay + 200.0F))) % 360.0D; + this.renderRotation0 = (this.renderRotation0 + (double) (1000.0F / ((float) this.spawnDelay + 200.0F))) + % 360.0D; } else { if (this.spawnDelay == -1) { this.resetTimer(); @@ -135,18 +133,17 @@ public abstract class CustomSpawnerBaseLogic { return; } - int j = this.getSpawnerWorld() - .getEntitiesWithinAABB( - entity.getClass(), - AxisAlignedBB.getBoundingBox( - (double) this.getSpawnerX(), - (double) this.getSpawnerY(), - (double) this.getSpawnerZ(), - (double) (this.getSpawnerX() + 1), - (double) (this.getSpawnerY() + 1), - (double) (this.getSpawnerZ() + 1)) - .expand((double) (this.spawnRange * 2), 4.0D, (double) - (this.spawnRange * 2))) + int j = this.getSpawnerWorld().getEntitiesWithinAABB( + entity.getClass(), + AxisAlignedBB + .getBoundingBox( + (double) this.getSpawnerX(), + (double) this.getSpawnerY(), + (double) this.getSpawnerZ(), + (double) (this.getSpawnerX() + 1), + (double) (this.getSpawnerY() + 1), + (double) (this.getSpawnerZ() + 1)) + .expand((double) (this.spawnRange * 2), 4.0D, (double) (this.spawnRange * 2))) .size(); if (j >= this.maxNearbyEntities) { @@ -154,15 +151,11 @@ public abstract class CustomSpawnerBaseLogic { return; } - int x = this.getSpawnerX() - + (int) ((this.getSpawnerWorld().rand.nextDouble() - - this.getSpawnerWorld().rand.nextDouble()) - * (double) this.spawnRange); + int x = this.getSpawnerX() + (int) ((this.getSpawnerWorld().rand.nextDouble() + - this.getSpawnerWorld().rand.nextDouble()) * (double) this.spawnRange); int y = this.getSpawnerY() + this.getSpawnerWorld().rand.nextInt(3) - 1; - int z = this.getSpawnerZ() - + (int) ((this.getSpawnerWorld().rand.nextDouble() - - this.getSpawnerWorld().rand.nextDouble()) - * (double) this.spawnRange); + int z = this.getSpawnerZ() + (int) ((this.getSpawnerWorld().rand.nextDouble() + - this.getSpawnerWorld().rand.nextDouble()) * (double) this.spawnRange); EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving) entity : null; entity.setLocationAndAngles( x + 0.5, @@ -171,10 +164,8 @@ public abstract class CustomSpawnerBaseLogic { this.getSpawnerWorld().rand.nextFloat() * 360.0F, 0.0F); - if (entityliving == null - || (entityliving.getCanSpawnHere() - || ignoreSpawnRequirements - && getSpawnerWorld().getBlock(x, y, z) == Blocks.air)) { + if (entityliving == null || (entityliving.getCanSpawnHere() + || ignoreSpawnRequirements && getSpawnerWorld().getBlock(x, y, z) == Blocks.air)) { this.spawnEntity(entity); this.getSpawnerWorld() .playAuxSFX(2004, this.getSpawnerX(), this.getSpawnerY(), this.getSpawnerZ(), 0); @@ -205,13 +196,11 @@ public abstract class CustomSpawnerBaseLogic { } else { par1Entity.setCurrentItemOrArmor(0, new ItemStack(Items.bow)); } - } else ((EntityLiving) par1Entity).onSpawnWithEgg(null); + } else((EntityLiving) par1Entity).onSpawnWithEgg(null); if (!requiresPlayer) { ((EntityLiving) par1Entity).func_110163_bv(); - par1Entity - .getEntityData() - .setLong("SpawnedByDESpawner", getSpawnerWorld().getTotalWorldTime()); + par1Entity.getEntityData().setLong("SpawnedByDESpawner", getSpawnerWorld().getTotalWorldTime()); } if (!getSpawnerWorld().isRemote) this.getSpawnerWorld().spawnEntityInWorld(par1Entity); @@ -234,8 +223,7 @@ public abstract class CustomSpawnerBaseLogic { public void readFromNBT(NBTTagCompound par1NBTTagCompound) { this.entityName = par1NBTTagCompound.getString("EntityId"); this.spawnDelay = par1NBTTagCompound.getShort("Delay"); - if ((!ConfigHandler.spawnerListType - && Arrays.asList(ConfigHandler.spawnerList).contains(this.entityName)) + if ((!ConfigHandler.spawnerListType && Arrays.asList(ConfigHandler.spawnerList).contains(this.entityName)) || (ConfigHandler.spawnerListType && !Arrays.asList(ConfigHandler.spawnerList).contains(this.entityName))) { this.entityName = "Pig"; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileCKeyStone.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileCKeyStone.java index 4722c88e..59d750eb 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileCKeyStone.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileCKeyStone.java @@ -1,7 +1,5 @@ package com.brandon3055.draconicevolution.common.tileentities; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.draconicevolution.common.ModItems; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -12,6 +10,9 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatComponentTranslation; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.ModItems; + /** * Created by Brandon on 27/08/2014. */ @@ -43,10 +44,10 @@ public class TileCKeyStone extends TileEntity { public boolean onActivated(ItemStack stack, EntityPlayer player) { if (stack == null || stack.getItem() != ModItems.key) { - if (player.capabilities.isCreativeMode - && stack == null + if (player.capabilities.isCreativeMode && stack == null && player.isSneaking() - && (getMeta() == 1 || getMeta() == 3)) delay += 5; + && (getMeta() == 1 || getMeta() == 3)) + delay += 5; if (player.capabilities.isCreativeMode && stack == null) giveInformation(player); return false; } @@ -77,22 +78,20 @@ public class TileCKeyStone extends TileEntity { 0.6F); break; case 2: // Toggle Activation - if (!isActivated) - worldObj.playSoundEffect( - (double) xCoord + 0.5D, - (double) yCoord + 0.5D, - (double) zCoord + 0.5D, - "random.click", - 0.3F, - 0.6F); - else - worldObj.playSoundEffect( - (double) xCoord + 0.5D, - (double) yCoord + 0.5D, - (double) zCoord + 0.5D, - "random.click", - 0.3F, - 0.5F); + if (!isActivated) worldObj.playSoundEffect( + (double) xCoord + 0.5D, + (double) yCoord + 0.5D, + (double) zCoord + 0.5D, + "random.click", + 0.3F, + 0.6F); + else worldObj.playSoundEffect( + (double) xCoord + 0.5D, + (double) yCoord + 0.5D, + (double) zCoord + 0.5D, + "random.click", + 0.3F, + 0.5F); isActivated = !isActivated; break; case 3: // Button Activation (Consume Key) @@ -118,30 +117,27 @@ public class TileCKeyStone extends TileEntity { if (worldObj.isRemote) { player.addChatComponentMessage(new ChatComponentTranslation("msg.cKeyStoneType" + getMeta() + ".txt")); player.addChatComponentMessage(new ChatComponentText("Key: " + keyCode)); - if (getMeta() == 1 || getMeta() == 3) - player.addChatComponentMessage( - new ChatComponentText("Delay: " + delay + "t (" + (((double) delay) / 20D) + "s)")); + if (getMeta() == 1 || getMeta() == 3) player.addChatComponentMessage( + new ChatComponentText("Delay: " + delay + "t (" + (((double) delay) / 20D) + "s)")); } } private boolean isMasterKey(ItemStack key) { if (key.getItemDamage() == 1) { - if (!isActivated) - worldObj.playSoundEffect( - (double) xCoord + 0.5D, - (double) yCoord + 0.5D, - (double) zCoord + 0.5D, - "random.click", - 0.3F, - 0.6F); - else - worldObj.playSoundEffect( - (double) xCoord + 0.5D, - (double) yCoord + 0.5D, - (double) zCoord + 0.5D, - "random.click", - 0.3F, - 0.5F); + if (!isActivated) worldObj.playSoundEffect( + (double) xCoord + 0.5D, + (double) yCoord + 0.5D, + (double) zCoord + 0.5D, + "random.click", + 0.3F, + 0.6F); + else worldObj.playSoundEffect( + (double) xCoord + 0.5D, + (double) yCoord + 0.5D, + (double) zCoord + 0.5D, + "random.click", + 0.3F, + 0.5F); isActivated = !isActivated; updateBlocks(); return true; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileChaosShard.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileChaosShard.java index 502e8a0d..dfa81027 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileChaosShard.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileChaosShard.java @@ -1,6 +1,5 @@ package com.brandon3055.draconicevolution.common.tileentities; -import com.brandon3055.draconicevolution.common.entity.EntityChaosVortex; import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; @@ -9,6 +8,8 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; +import com.brandon3055.draconicevolution.common.entity.EntityChaosVortex; + /** * Created by brandon3055 on 24/9/2015. */ @@ -23,8 +24,7 @@ public class TileChaosShard extends TileEntity { public void updateEntity() { tick++; - if (tick > 1 - && !worldObj.isRemote + if (tick > 1 && !worldObj.isRemote && locationHash != getLocationHash(xCoord, yCoord, zCoord, worldObj.provider.dimensionId)) worldObj.setBlockToAir(xCoord, yCoord, zCoord); @@ -44,7 +44,10 @@ public class TileChaosShard extends TileEntity { int x = 5 - worldObj.rand.nextInt(11); int z = 5 - worldObj.rand.nextInt(11); EntityLightningBolt bolt = new EntityLightningBolt( - worldObj, xCoord + x, worldObj.getTopSolidOrLiquidBlock(xCoord + x, zCoord + z), zCoord + z); + worldObj, + xCoord + x, + worldObj.getTopSolidOrLiquidBlock(xCoord + x, zCoord + z), + zCoord + z); bolt.ignoreFrustumCheck = true; worldObj.addWeatherEffect(bolt); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileContainerTemplate.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileContainerTemplate.java index e658cc07..9118b5e0 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileContainerTemplate.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileContainerTemplate.java @@ -13,6 +13,7 @@ import net.minecraft.tileentity.TileEntity; * Created by Brandon on 27/06/2014. */ public class TileContainerTemplate extends TileEntity implements ISidedInventory { + ItemStack[] items = new ItemStack[9]; // ==============================================LOGIC=======================================================// @@ -111,7 +112,7 @@ public class TileContainerTemplate extends TileEntity implements ISidedInventory @Override public int[] getAccessibleSlotsFromSide(int var1) { - return new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8}; + return new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileCustomSpawner.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileCustomSpawner.java index 63b7c324..b82d9a12 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileCustomSpawner.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileCustomSpawner.java @@ -10,10 +10,12 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; public class TileCustomSpawner extends TileEntity { + public boolean isSetToSpawn = false; public EntityPlayer owner; private final CustomSpawnerBaseLogic spawnerBaseLogic = new CustomSpawnerBaseLogic() { + public void blockEvent(int par1) { worldObj.addBlockEvent(xCoord, yCoord, zCoord, Blocks.mob_spawner, par1, 0); } @@ -40,45 +42,14 @@ public class TileCustomSpawner extends TileEntity { spawnerBaseLogic.updateSpawner(); } /* - else if (trySet && owner != null){ - - if (worldObj.isRemote) spawnParticles(false); - - if (!foundTarget && setTick > 70 && target == null && setTick % 10 == 0) - { - foundTarget = findTargetEntity(); - setTick = 71; - } - - if (foundTarget) - { - target.setHealth(10); - if (setTick < 150) { - target.setPosition(xCoord + 0.5, yCoord, zCoord + 0.5); - } else { - target.setPosition(xCoord + 0.5, yCoord - 0.5, zCoord + 0.5); - } - spawnParticles(true); - if (setTick > 151){ - spawnerBaseLogic.entityName = target.getCommandSenderName(); - target.setDead(); - setTick = 0; - trySet = false; - isSetToSpawn = true; - } - - - } - - setTick++; - if (setTick > 200){ - setTick = 0; - trySet = false; - } - } else { - trySet = false; - } - */ + * else if (trySet && owner != null){ if (worldObj.isRemote) spawnParticles(false); if (!foundTarget && setTick + * > 70 && target == null && setTick % 10 == 0) { foundTarget = findTargetEntity(); setTick = 71; } if + * (foundTarget) { target.setHealth(10); if (setTick < 150) { target.setPosition(xCoord + 0.5, yCoord, zCoord + + * 0.5); } else { target.setPosition(xCoord + 0.5, yCoord - 0.5, zCoord + 0.5); } spawnParticles(true); if + * (setTick > 151){ spawnerBaseLogic.entityName = target.getCommandSenderName(); target.setDead(); setTick = 0; + * trySet = false; isSetToSpawn = true; } } setTick++; if (setTick > 200){ setTick = 0; trySet = false; } } else + * { trySet = false; } + */ } public void writeToNBT(NBTTagCompound tagCompound) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDissEnchanter.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDissEnchanter.java index 807ca277..21293e56 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDissEnchanter.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDissEnchanter.java @@ -1,9 +1,9 @@ package com.brandon3055.draconicevolution.common.tileentities; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; import java.util.HashMap; import java.util.Iterator; import java.util.Map; + import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; @@ -17,10 +17,13 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.ForgeHooks; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; + /** * Created by Brandon on 27/06/2014. */ public class TileDissEnchanter extends TileEntity implements ISidedInventory { + ItemStack[] items = new ItemStack[3]; public boolean isValidRecipe = false; public int dissenchantCost = 0; @@ -50,8 +53,8 @@ public class TileDissEnchanter extends TileEntity implements ISidedInventory { flag = false; dissenchantCost = 0; } else { - if (items[1].getItem() != Items.book - || EnchantmentHelper.getEnchantments(items[0]).size() == 0) flag = false; + if (items[1].getItem() != Items.book || EnchantmentHelper.getEnchantments(items[0]).size() == 0) + flag = false; } if (items[0] != null) dissenchantCost = ItemNBTHelper.getInteger(items[0], "RepairCost", 0); // if (flag) dissenchantCost = ItemNBTHelper.getInteger(items[0], "RepairCost", 0); @@ -64,8 +67,7 @@ public class TileDissEnchanter extends TileEntity implements ISidedInventory { for (j = -1; j <= 1; ++j) { for (int k = -1; k <= 1; ++k) { - if ((j != 0 || k != 0) - && this.worldObj.isAirBlock(this.xCoord + k, this.yCoord, this.zCoord + j) + if ((j != 0 || k != 0) && this.worldObj.isAirBlock(this.xCoord + k, this.yCoord, this.zCoord + j) && this.worldObj.isAirBlock(this.xCoord + k, this.yCoord + 1, this.zCoord + j)) { bookPower += ForgeHooks.getEnchantPower(worldObj, xCoord + k * 2, yCoord, zCoord + j * 2); bookPower += ForgeHooks.getEnchantPower(worldObj, xCoord + k * 2, yCoord + 1, zCoord + j * 2); @@ -118,12 +120,11 @@ public class TileDissEnchanter extends TileEntity implements ISidedInventory { if (list.tagCount() > 0) input.setTagInfo(tagName, list); if (input.getItem() == Items.enchanted_book && list.tagCount() == 0) setInventorySlotContents(0, null); if (!player.capabilities.isCreativeMode) player.addExperienceLevel(-dissenchantCost); - if (items[0] != null && ItemNBTHelper.getInteger(items[0], "RepairCost", 0) > 0) - ItemNBTHelper.setInteger( - items[0], - "RepairCost", - ItemNBTHelper.getInteger(items[0], "RepairCost", 0) - - Math.min(2, ItemNBTHelper.getInteger(items[0], "RepairCost", 0))); + if (items[0] != null && ItemNBTHelper.getInteger(items[0], "RepairCost", 0) > 0) ItemNBTHelper.setInteger( + items[0], + "RepairCost", + ItemNBTHelper.getInteger(items[0], "RepairCost", 0) + - Math.min(2, ItemNBTHelper.getInteger(items[0], "RepairCost", 0))); if (!player.capabilities.isCreativeMode) decrStackSize(1, 1); int maxDamage = items[0] != null ? items[0].getMaxDamage() : 0; float damageF = (40f - bookPower) / 100f; @@ -236,7 +237,7 @@ public class TileDissEnchanter extends TileEntity implements ISidedInventory { @Override public int[] getAccessibleSlotsFromSide(int var1) { - return new int[] {1}; + return new int[] { 1 }; } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDraconiumChest.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDraconiumChest.java index 5249457d..c72b24b5 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDraconiumChest.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDraconiumChest.java @@ -1,15 +1,7 @@ package com.brandon3055.draconicevolution.common.tileentities; -import cofh.api.energy.IEnergyContainerItem; -import cofh.api.energy.IEnergyReceiver; -import com.brandon3055.brandonscore.common.utills.InventoryUtils; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.blocks.DraconiumChest; -import com.brandon3055.draconicevolution.common.container.ContainerDraconiumChest; -import com.brandon3055.draconicevolution.common.lib.OreDoublingRegistry; -import com.brandon3055.draconicevolution.common.utills.EnergyStorage; -import com.brandon3055.draconicevolution.common.utills.ICustomItemData; import java.util.List; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; @@ -24,10 +16,22 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; +import cofh.api.energy.IEnergyContainerItem; +import cofh.api.energy.IEnergyReceiver; + +import com.brandon3055.brandonscore.common.utills.InventoryUtils; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.DraconiumChest; +import com.brandon3055.draconicevolution.common.container.ContainerDraconiumChest; +import com.brandon3055.draconicevolution.common.lib.OreDoublingRegistry; +import com.brandon3055.draconicevolution.common.utills.EnergyStorage; +import com.brandon3055.draconicevolution.common.utills.ICustomItemData; + /** * Created by Brandon on 27/06/2014. */ public class TileDraconiumChest extends TileEntity implements ISidedInventory, IEnergyReceiver, ICustomItemData { + ItemStack[] items = new ItemStack[240]; ItemStack[] itemsCrafting = new ItemStack[10]; private int ticksSinceSync = -1; @@ -62,8 +66,7 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I @Override public void updateEntity() { // Resynchronize clients with the server state - if (worldObj != null - && !this.worldObj.isRemote + if (worldObj != null && !this.worldObj.isRemote && this.numUsingPlayers != 0 && (this.ticksSinceSync + this.xCoord + this.yCoord + this.zCoord) % 200 == 0) { this.numUsingPlayers = 0; @@ -102,7 +105,12 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I double d = (double) xCoord + 0.5D; double d1 = (double) zCoord + 0.5D; worldObj.playSoundEffect( - d, (double) yCoord + 0.5D, d1, "random.chestopen", 0.5F, worldObj.rand.nextFloat() * 0.1F + 0.9F); + d, + (double) yCoord + 0.5D, + d1, + "random.chestopen", + 0.5F, + worldObj.rand.nextFloat() * 0.1F + 0.9F); } if (numUsingPlayers == 0 && lidAngle > 0.0F || numUsingPlayers > 0 && lidAngle < 1.0F) { float f1 = lidAngle; @@ -135,11 +143,9 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I } public void updateEnergy() { // todo if no charging item wait a sec before checking again - if (energy.getEnergyStored() < energy.getMaxEnergyStored() - && getStackInSlot(239) != null + if (energy.getEnergyStored() < energy.getMaxEnergyStored() && getStackInSlot(239) != null && getStackInSlot(239).getItem() instanceof IEnergyContainerItem) { - IEnergyContainerItem item = - (IEnergyContainerItem) getStackInSlot(239).getItem(); + IEnergyContainerItem item = (IEnergyContainerItem) getStackInSlot(239).getItem(); item.extractEnergy( getStackInSlot(239), receiveEnergy( @@ -224,8 +230,8 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I flag = false; for (int i = 0; i < 5; i++) { ItemStack recipe = getStackInSlot(234 + i); - if (recipe == null || recipe.stackSize == 1) - continue; // checks that there is more then one of at least one item in the input + if (recipe == null || recipe.stackSize == 1) continue; // checks that there is more then one of at least + // one item in the input flag = true; } if (!flag) return false; @@ -268,8 +274,8 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I InventoryUtils.tryMergeStacks(result, getStackInSlot(j)); } - if (result.stackSize > 0) - InventoryUtils.insertItemIntoInventory(this, result); // Insert stack into inventory + if (result.stackSize > 0) InventoryUtils.insertItemIntoInventory(this, result); // Insert stack into + // inventory if (result.stackSize == 0) { recipe.stackSize--; @@ -289,7 +295,7 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I } public void feedNextItem() { - boolean[] stacksFull = new boolean[] {false, false, false, false, false}; + boolean[] stacksFull = new boolean[] { false, false, false, false, false }; for (int i = 0; i < getSizeInventory(); i++) { if (getStackInSlot(i) == null) continue; @@ -372,7 +378,12 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I public void rotateAround(ForgeDirection axis) { setFacing((byte) ForgeDirection.getOrientation(facing).getRotation(axis).ordinal()); worldObj.addBlockEvent( - xCoord, yCoord, zCoord, ModBlocks.draconiumChest, 3, ((numUsingPlayers << 3) & 0xF8) | (facing & 0x7)); + xCoord, + yCoord, + zCoord, + ModBlocks.draconiumChest, + 3, + ((numUsingPlayers << 3) & 0xF8) | (facing & 0x7)); } public int getFacing() { @@ -397,9 +408,9 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I super.writeToNBT(compound); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, compound); - // NBTTagCompound tagCompound = new NBTTagCompound(); - // this.writeToNBT(tagCompound); - // return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tagCompound); + // NBTTagCompound tagCompound = new NBTTagCompound(); + // this.writeToNBT(tagCompound); + // return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tagCompound); } @Override @@ -462,8 +473,7 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I @Override public String getInventoryName() { - return hasCustomInventoryName() - ? customName + return hasCustomInventoryName() ? customName : StatCollector.translateToLocal(ModBlocks.draconiumChest.getUnlocalizedName() + ".name"); } @@ -679,96 +689,96 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I } // inTick = true; -// tick++; +// tick++; // -// boolean canSmelt = false; -// boolean flag = true; +// boolean canSmelt = false; +// boolean flag = true; // -// for (int i = 0; i < 5; i++) { -// if (getStackInSlot(234 + i) == null) continue; -// ItemStack stack = getStackInSlot(234 + i); -// if (isSmeltable(stack)) canSmelt = true; -// else flag = false; -// } +// for (int i = 0; i < 5; i++) { +// if (getStackInSlot(234 + i) == null) continue; +// ItemStack stack = getStackInSlot(234 + i); +// if (isSmeltable(stack)) canSmelt = true; +// else flag = false; +// } // // -// if (!flag) canSmelt = false; +// if (!flag) canSmelt = false; // -// if (canSmelt) {//Check if there is room for the output -// for (int i = 0; i < 5; i++) { +// if (canSmelt) {//Check if there is room for the output +// for (int i = 0; i < 5; i++) { // -// if (getStackInSlot(234 + i) == null) continue; -// ItemStack output = getResult(getStackInSlot(234 + i)).copy(); +// if (getStackInSlot(234 + i) == null) continue; +// ItemStack output = getResult(getStackInSlot(234 + i)).copy(); // -// for (int j = 0; j < getSizeInventory(); j++) { -// InventoryUtils.insertItemIntoInventory(this, output, ForgeDirection.DOWN, j, false); -// if (output.stackSize == 0) break; -// } +// for (int j = 0; j < getSizeInventory(); j++) { +// InventoryUtils.insertItemIntoInventory(this, output, ForgeDirection.DOWN, j, false); +// if (output.stackSize == 0) break; +// } // -// if (output.stackSize > 0) { -// canSmelt = false; -// break; -// } -// } -// } +// if (output.stackSize > 0) { +// canSmelt = false; +// break; +// } +// } +// } // -// if (canSmelt && getLock()){ //Confirm that the firnace can still run when lock mode is enabled -// flag = false; -// for (int i = 0; i < 5; i++) { +// if (canSmelt && getLock()){ //Confirm that the firnace can still run when lock mode is enabled +// flag = false; +// for (int i = 0; i < 5; i++) { // -// ItemStack recipe = getStackInSlot(234 + i); +// ItemStack recipe = getStackInSlot(234 + i); // -// if (recipe == null || recipe.stackSize == 1) continue; +// if (recipe == null || recipe.stackSize == 1) continue; // -// flag = true; -// } -// canSmelt = flag; -// } +// flag = true; +// } +// canSmelt = flag; +// } // -// flag = false; -// if (canSmelt && smeltingProgressTime >= smeltingCompleateTime) { -// int itemsToProccess = 5; -// int proccessAttempts = 0; -// do { -// for (int i = 0; i < 5; i++) { +// flag = false; +// if (canSmelt && smeltingProgressTime >= smeltingCompleateTime) { +// int itemsToProccess = 5; +// int proccessAttempts = 0; +// do { +// for (int i = 0; i < 5; i++) { // -// ItemStack recipe = getStackInSlot(234 + i); +// ItemStack recipe = getStackInSlot(234 + i); // -// if (recipe == null || (getLock() && recipe.stackSize == 1)) continue; +// if (recipe == null || (getLock() && recipe.stackSize == 1)) continue; // -// ItemStack result = getResult(recipe).copy(); +// ItemStack result = getResult(recipe).copy(); // -// for (int j = 0; j < getSizeInventory(); j++) { -// if (getStackInSlot(j) == null) continue; -// InventoryUtils.tryMergeStacks(result, getStackInSlot(j)); -// } +// for (int j = 0; j < getSizeInventory(); j++) { +// if (getStackInSlot(j) == null) continue; +// InventoryUtils.tryMergeStacks(result, getStackInSlot(j)); +// } // -// if (result.stackSize > 0) InventoryUtils.insertItemIntoInventory(this, result); +// if (result.stackSize > 0) InventoryUtils.insertItemIntoInventory(this, result); // -// if (result.stackSize == 0) { -// recipe.stackSize--; -// if (recipe.stackSize == 0) setInventorySlotContents(234 + i, null); -// itemsToProccess--; -// flag = true; -// } +// if (result.stackSize == 0) { +// recipe.stackSize--; +// if (recipe.stackSize == 0) setInventorySlotContents(234 + i, null); +// itemsToProccess--; +// flag = true; +// } // -// if (itemsToProccess == 0) break; -// } +// if (itemsToProccess == 0) break; +// } // -// proccessAttempts++; +// proccessAttempts++; // -// } while (itemsToProccess > 0 && proccessAttempts < 5); -// } +// } while (itemsToProccess > 0 && proccessAttempts < 5); +// } // -// if ((flag && (getFill() || getLock() || getAll())) || (!canSmelt && (getLock() || getAll()) && (tick + xCoord + +// if ((flag && (getFill() || getLock() || getAll())) || (!canSmelt && (getLock() || getAll()) && (tick + xCoord + // yCoord + zCoord) % 60 == 0)) feedNextItem(); // -// if (canSmelt) { -// smeltingBurnSpeed = Math.min(energy.getEnergyStored() / 1000, smeltingMaxBurnSpeed); -// } else smeltingBurnSpeed = 0; +// if (canSmelt) { +// smeltingBurnSpeed = Math.min(energy.getEnergyStored() / 1000, smeltingMaxBurnSpeed); +// } else smeltingBurnSpeed = 0; // -// if (canSmelt && smeltingProgressTime < smeltingCompleateTime) { -// smeltingProgressTime += smeltingBurnSpeed; -// energy.modifyEnergyStored(-smeltingBurnSpeed * 5); -// } else smeltingProgressTime = 0; -// inTick = false; +// if (canSmelt && smeltingProgressTime < smeltingCompleateTime) { +// smeltingProgressTime += smeltingBurnSpeed; +// energy.modifyEnergyStored(-smeltingBurnSpeed * 5); +// } else smeltingProgressTime = 0; +// inTick = false; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileEnergyInfuser.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileEnergyInfuser.java index c3a9773e..2dd75e5e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileEnergyInfuser.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileEnergyInfuser.java @@ -1,15 +1,7 @@ package com.brandon3055.draconicevolution.common.tileentities; -import cofh.api.energy.IEnergyContainerItem; -import cofh.api.energy.IEnergyReceiver; -import com.brandon3055.draconicevolution.client.handler.ParticleHandler; -import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergy; -import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.utills.EnergyStorage; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.Random; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; @@ -19,13 +11,27 @@ import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraftforge.common.util.ForgeDirection; +import cofh.api.energy.IEnergyContainerItem; +import cofh.api.energy.IEnergyReceiver; + +import com.brandon3055.draconicevolution.client.handler.ParticleHandler; +import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergy; +import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.utills.EnergyStorage; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 27/06/2014. */ public class TileEnergyInfuser extends TileObjectSync implements IEnergyReceiver, ISidedInventory { + ItemStack[] items = new ItemStack[1]; - public EnergyStorage energy = - new EnergyStorage(BalanceConfigHandler.energyInfuserStorage, BalanceConfigHandler.energyInfuserMaxTransfer); + public EnergyStorage energy = new EnergyStorage( + BalanceConfigHandler.energyInfuserStorage, + BalanceConfigHandler.energyInfuserMaxTransfer); public boolean running = false; public boolean runningCach = false; private int tick = 0; @@ -65,8 +71,7 @@ public class TileEnergyInfuser extends TileObjectSync implements IEnergyReceiver } private boolean tryStartOrStop() { - if (items[0] != null - && items[0].stackSize == 1 + if (items[0] != null && items[0].stackSize == 1 && items[0] != null && items[0].getItem() instanceof IEnergyContainerItem) { IEnergyContainerItem item = (IEnergyContainerItem) items[0].getItem(); @@ -343,7 +348,7 @@ public class TileEnergyInfuser extends TileObjectSync implements IEnergyReceiver @Override public int[] getAccessibleSlotsFromSide(int var1) { - return new int[] {0}; + return new int[] { 0 }; } @Override @@ -356,8 +361,9 @@ public class TileEnergyInfuser extends TileObjectSync implements IEnergyReceiver if (item == null || !(item.getItem() instanceof IEnergyContainerItem)) return true; if ((((IEnergyContainerItem) item.getItem()).getEnergyStored(item) - >= ((IEnergyContainerItem) item.getItem()).getMaxEnergyStored(item)) - || ((IEnergyContainerItem) item.getItem()).receiveEnergy(item, 1, true) == 0) return true; + >= ((IEnergyContainerItem) item.getItem()).getMaxEnergyStored(item)) + || ((IEnergyContainerItem) item.getItem()).receiveEnergy(item, 1, true) == 0) + return true; else return false; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileGenerator.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileGenerator.java index b12c1a97..fcf9f2af 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileGenerator.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileGenerator.java @@ -1,12 +1,5 @@ package com.brandon3055.draconicevolution.common.tileentities; -import cofh.api.energy.IEnergyProvider; -import cofh.api.energy.IEnergyReceiver; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.utills.EnergyStorage; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; @@ -21,7 +14,18 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; +import cofh.api.energy.IEnergyProvider; +import cofh.api.energy.IEnergyReceiver; + +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.utills.EnergyStorage; + +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class TileGenerator extends TileObjectSync implements ISidedInventory, IEnergyProvider { + // ########### variables #############// private ItemStack[] items; public int burnTime = 1; @@ -51,8 +55,9 @@ public class TileGenerator extends TileObjectSync implements ISidedInventory, IE if (burnTimeRemaining > 0 && storage.getEnergyStored() < storage.getMaxEnergyStored()) { burnTimeRemaining -= burnSpeed; - storage.setEnergyStored(storage.getEnergyStored() - + Math.min(burnSpeed * EPBT, storage.getMaxEnergyStored() - storage.getEnergyStored())); + storage.setEnergyStored( + storage.getEnergyStored() + + Math.min(burnSpeed * EPBT, storage.getMaxEnergyStored() - storage.getEnergyStored())); } else if (burnTimeRemaining <= 0) tryRefuel(); if ((storage.getEnergyStored() > 0)) { @@ -63,11 +68,10 @@ public class TileGenerator extends TileObjectSync implements ISidedInventory, IE zCoord + ForgeDirection.getOrientation(i).offsetZ); if (tile != null && tile instanceof IEnergyReceiver) { storage.extractEnergy( - ((IEnergyReceiver) tile) - .receiveEnergy( - ForgeDirection.getOrientation(i).getOpposite(), - storage.extractEnergy(storage.getMaxExtract(), true), - false), + ((IEnergyReceiver) tile).receiveEnergy( + ForgeDirection.getOrientation(i).getOpposite(), + storage.extractEnergy(storage.getMaxExtract(), true), + false), false); } } @@ -115,12 +119,9 @@ public class TileGenerator extends TileObjectSync implements ISidedInventory, IE } } - if (item instanceof ItemTool - && ((ItemTool) item).getToolMaterialName().equals("WOOD")) return 200; - if (item instanceof ItemSword - && ((ItemSword) item).getToolMaterialName().equals("WOOD")) return 200; - if (item instanceof ItemHoe - && ((ItemHoe) item).getToolMaterialName().equals("WOOD")) return 200; + if (item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD")) return 200; + if (item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD")) return 200; + if (item instanceof ItemHoe && ((ItemHoe) item).getToolMaterialName().equals("WOOD")) return 200; if (item == Items.stick) return 100; if (item == Items.coal) return 1600; if (item == Items.lava_bucket) return 20000; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileGrinder.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileGrinder.java index 61cc7bfd..7fe150e6 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileGrinder.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileGrinder.java @@ -1,15 +1,8 @@ package com.brandon3055.draconicevolution.common.tileentities; -import cofh.api.energy.IEnergyReceiver; -import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.utills.EnergyStorage; -import com.mojang.authlib.GameProfile; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.List; import java.util.UUID; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.enchantment.Enchantment; @@ -32,7 +25,19 @@ import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.common.util.FakePlayerFactory; import net.minecraftforge.common.util.ForgeDirection; +import cofh.api.energy.IEnergyReceiver; + +import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.utills.EnergyStorage; +import com.mojang.authlib.GameProfile; + +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class TileGrinder extends TileObjectSync implements ISidedInventory, IEnergyReceiver { + // ########### variables #############// public int meta = -1; List killList; @@ -50,9 +55,13 @@ public class TileGrinder extends TileObjectSync implements ISidedInventory, IEne public boolean hasPowerCach = false; private boolean readyNext = false; public EnergyStorage internalGenBuffer = new EnergyStorage( - BalanceConfigHandler.grinderInternalEnergyBufferSize, BalanceConfigHandler.grinderMaxReceive, 0); + BalanceConfigHandler.grinderInternalEnergyBufferSize, + BalanceConfigHandler.grinderMaxReceive, + 0); public EnergyStorage externalInputBuffer = new EnergyStorage( - BalanceConfigHandler.grinderExternalEnergyBufferSize, BalanceConfigHandler.grinderMaxReceive, 0); + BalanceConfigHandler.grinderExternalEnergyBufferSize, + BalanceConfigHandler.grinderMaxReceive, + 0); public int energyPerKill = BalanceConfigHandler.grinderEnergyPerKill; private ItemStack diamondSword; public static FakePlayer fakePlayer; @@ -107,8 +116,8 @@ public class TileGrinder extends TileObjectSync implements ISidedInventory, IEne if (burnTimeRemaining > 0 && internalGenBuffer.getEnergyStored() < internalGenBuffer.getMaxEnergyStored()) { burnTimeRemaining -= burnSpeed; - internalGenBuffer.setEnergyStored(internalGenBuffer.getEnergyStored() - + Math.min( + internalGenBuffer.setEnergyStored( + internalGenBuffer.getEnergyStored() + Math.min( burnSpeed * EPBT, internalGenBuffer.getMaxEnergyStored() - internalGenBuffer.getEnergyStored())); } else if (burnTimeRemaining <= 0) tryRefuel(); @@ -161,13 +170,17 @@ public class TileGrinder extends TileObjectSync implements ISidedInventory, IEne (WorldServer) worldObj, new GameProfile(UUID.fromString("5b5689b9-e43d-4282-a42a-dc916f3616b7"), "[Draconic-Evolution]")); } - if (BalanceConfigHandler.grinderShouldUseLooting - && (fakePlayer.getHeldItem() == null - || !ItemStack.areItemStacksEqual(fakePlayer.getHeldItem(), diamondSword))) { + if (BalanceConfigHandler.grinderShouldUseLooting && (fakePlayer.getHeldItem() == null + || !ItemStack.areItemStacksEqual(fakePlayer.getHeldItem(), diamondSword))) { fakePlayer.setCurrentItemOrArmor(0, diamondSword); } killBox = AxisAlignedBB.getBoundingBox( - centreX - 4.5, centreY - 4.5, centreZ - 4.5, centreX + 4.5, centreY + 4.5, centreZ + 4.5); + centreX - 4.5, + centreY - 4.5, + centreZ - 4.5, + centreX + 4.5, + centreY + 4.5, + centreZ + 4.5); killList = worldObj.getEntitiesWithinAABB(EntityLiving.class, killBox); List xp = worldObj.getEntitiesWithinAABB(EntityXPOrb.class, killBox.expand(4, 4, 4)); @@ -214,12 +227,9 @@ public class TileGrinder extends TileObjectSync implements ISidedInventory, IEne } } - if (item instanceof ItemTool - && ((ItemTool) item).getToolMaterialName().equals("WOOD")) return 200; - if (item instanceof ItemSword - && ((ItemSword) item).getToolMaterialName().equals("WOOD")) return 200; - if (item instanceof ItemHoe - && ((ItemHoe) item).getToolMaterialName().equals("WOOD")) return 200; + if (item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD")) return 200; + if (item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD")) return 200; + if (item instanceof ItemHoe && ((ItemHoe) item).getToolMaterialName().equals("WOOD")) return 200; if (item == Items.stick) return 100; if (item == Items.coal) return 1600; if (item == Items.lava_bucket) return 20000; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileLRD.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileLRD.java index 7fab4ba0..d9b99b0b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileLRD.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileLRD.java @@ -5,4 +5,5 @@ import net.minecraft.tileentity.TileEntity; /** * Created by Brandon on 21/07/2014. */ -public class TileLRD extends TileEntity {} +public class TileLRD extends TileEntity { +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileObjectSync.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileObjectSync.java index 13b64ee8..0c7e267d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileObjectSync.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileObjectSync.java @@ -1,9 +1,10 @@ package com.brandon3055.draconicevolution.common.tileentities; +import net.minecraft.tileentity.TileEntity; + import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.network.TileObjectPacket; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; -import net.minecraft.tileentity.TileEntity; /** * Created by Brandon on 14/11/2014. @@ -15,7 +16,10 @@ public abstract class TileObjectSync extends TileEntity { */ public Object sendObjectToClient(byte dataType, int index, Object object) { return sendObjectToClient( - dataType, index, object, new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 64)); + dataType, + index, + object, + new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 64)); } /** diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileParticleGenerator.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileParticleGenerator.java index d540275d..85590e48 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileParticleGenerator.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileParticleGenerator.java @@ -1,16 +1,9 @@ package com.brandon3055.draconicevolution.common.tileentities; -import com.brandon3055.draconicevolution.client.handler.ParticleHandler; -import com.brandon3055.draconicevolution.client.render.particle.ParticleCustom; -import com.brandon3055.draconicevolution.client.render.particle.Particles; -import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation; -import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore; -import com.brandon3055.draconicevolution.integration.computers.IDEPeripheral; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.HashMap; import java.util.Map; import java.util.Random; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; @@ -18,7 +11,18 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; +import com.brandon3055.draconicevolution.client.handler.ParticleHandler; +import com.brandon3055.draconicevolution.client.render.particle.ParticleCustom; +import com.brandon3055.draconicevolution.client.render.particle.Particles; +import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation; +import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore; +import com.brandon3055.draconicevolution.integration.computers.IDEPeripheral; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class TileParticleGenerator extends TileEntity implements IDEPeripheral { + public boolean particles_enabled = true; public int red = 0; @@ -145,9 +149,23 @@ public class TileParticleGenerator extends TileEntity implements IDEPeripheral { else if (getMaster().zCoord < zCoord) direction = 3; Particles.EnergyBeamParticle particle = new Particles.EnergyBeamParticle( - worldObj, x, y, z, getMaster().xCoord + 0.5, getMaster().zCoord + 0.5, direction, false); + worldObj, + x, + y, + z, + getMaster().xCoord + 0.5, + getMaster().zCoord + 0.5, + direction, + false); Particles.EnergyBeamParticle particle2 = new Particles.EnergyBeamParticle( - worldObj, x, y, z, getMaster().xCoord + 0.5, getMaster().zCoord + 0.5, direction, true); + worldObj, + x, + y, + z, + getMaster().xCoord + 0.5, + getMaster().zCoord + 0.5, + direction, + true); ParticleHandler.spawnCustomParticle(particle, 60); ParticleHandler.spawnCustomParticle(particle2, 60); } @@ -188,13 +206,15 @@ public class TileParticleGenerator extends TileEntity implements IDEPeripheral { public TileEnergyStorageCore getMaster() { if (master == null) return null; - TileEnergyStorageCore tile = - (worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) != null - && worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) - instanceof TileEnergyStorageCore) - ? (TileEnergyStorageCore) - worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) - : null; + TileEnergyStorageCore tile = (worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) + != null + && worldObj.getTileEntity( + master.getXCoord(), + master.getYCoord(), + master.getZCoord()) instanceof TileEnergyStorageCore) + ? (TileEnergyStorageCore) worldObj + .getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) + : null; return tile; } @@ -319,14 +339,14 @@ public class TileParticleGenerator extends TileEntity implements IDEPeripheral { @Override public String[] getMethodNames() { - return new String[] {"setGeneratorProperty", "getGeneratorState", "resetGeneratorState"}; + return new String[] { "setGeneratorProperty", "getGeneratorState", "resetGeneratorState" }; } @Override public Object[] callMethod(String method, Object... args) { if (method.startsWith("setGeneratorProperty")) { - if (args.length != 2) return new Object[] {false}; - else if (!(args[0] instanceof String)) return new Object[] {false}; + if (args.length != 2) return new Object[] { false }; + else if (!(args[0] instanceof String)) return new Object[] { false }; /* Particles */ if (args[0].equals("particles_enabled") && args[1] instanceof Boolean) { @@ -408,11 +428,11 @@ public class TileParticleGenerator extends TileEntity implements IDEPeripheral { } else if (args[0].equals("beam_rotation") && args[1] instanceof Double) { beam_rotation = (float) limit((Double) args[1], -1F, 1F); } else { - return new Object[] {false}; + return new Object[] { false }; } worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - return new Object[] {true}; + return new Object[] { true }; } else if (method.startsWith("getGeneratorState")) { Map map = new HashMap(); @@ -458,7 +478,7 @@ public class TileParticleGenerator extends TileEntity implements IDEPeripheral { map.put("beam_length", beam_length); map.put("beam_rotation", beam_rotation); - return new Object[] {map}; + return new Object[] { map }; } else if (method.startsWith("resetGeneratorState")) { particles_enabled = true; red = 0; @@ -504,9 +524,9 @@ public class TileParticleGenerator extends TileEntity implements IDEPeripheral { beam_rotation = 0F; worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - return new Object[] {true}; + return new Object[] { true }; } - return new Object[] {0}; + return new Object[] { 0 }; } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePlacedItem.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePlacedItem.java index 831ace64..32d2f4c9 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePlacedItem.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePlacedItem.java @@ -1,6 +1,5 @@ package com.brandon3055.draconicevolution.common.tileentities; -import com.brandon3055.draconicevolution.common.ModBlocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; @@ -8,10 +7,13 @@ import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; +import com.brandon3055.draconicevolution.common.ModBlocks; + /** * Created by Brandon on 14/08/2014. */ public class TilePlacedItem extends TileEntity { + public ItemStack stack; public float rotation = 0F; private boolean hasUpdated = false; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePlayerDetector.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePlayerDetector.java index 7e8597e1..8074bcf9 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePlayerDetector.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePlayerDetector.java @@ -8,6 +8,7 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; public class TilePlayerDetector extends TileEntity { + private int tick = 0; public boolean output = false; private int scanRate = 5; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePlayerDetectorAdvanced.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePlayerDetectorAdvanced.java index 612b78bf..7c8247ab 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePlayerDetectorAdvanced.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePlayerDetectorAdvanced.java @@ -1,8 +1,8 @@ package com.brandon3055.draconicevolution.common.tileentities; -import com.brandon3055.draconicevolution.common.container.ContainerPlayerDetector; import java.util.Iterator; import java.util.List; + import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; @@ -17,7 +17,10 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; +import com.brandon3055.draconicevolution.common.container.ContainerPlayerDetector; + public class TilePlayerDetectorAdvanced extends TileEntity implements IInventory { + public String[] names = new String[42]; private ItemStack[] items; public boolean whiteList = false; @@ -82,8 +85,8 @@ public class TilePlayerDetectorAdvanced extends TileEntity implements IInventory // ScanBox = AxisAlignedBB.getBoundingBox(x1, y1, z1, x2, y2, z2); // ScanBox = AxisAlignedBB.getAABBPool().getAABB(xCoord + 0.5 - range, yCoord + 0.5 - range, zCoord + 0.5 - // range, xCoord + 0.5 + range, yCoord + 0.5 + range, zCoord + 0.5 + range); - EntityList = worldObj.getEntitiesWithinAABB( - EntityPlayer.class, AxisAlignedBB.getBoundingBox(x1, y1, z1, x2, y2, z2)); + EntityList = worldObj + .getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x1, y1, z1, x2, y2, z2)); // System.out.println(EntityList); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePotentiometer.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePotentiometer.java index 69a27f2b..71a1d0a3 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePotentiometer.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePotentiometer.java @@ -7,6 +7,7 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; public class TilePotentiometer extends TileEntity { + public int power = 0; public void increasePower() { @@ -33,25 +34,46 @@ public class TilePotentiometer extends TileEntity { if (meta == 1) { worldObj.notifyBlocksOfNeighborChange( - xCoord - 1, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); + xCoord - 1, + yCoord, + zCoord, + worldObj.getBlock(xCoord, yCoord, zCoord)); } else if (meta == 2) { worldObj.notifyBlocksOfNeighborChange( - xCoord + 1, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); + xCoord + 1, + yCoord, + zCoord, + worldObj.getBlock(xCoord, yCoord, zCoord)); } else if (meta == 3) { worldObj.notifyBlocksOfNeighborChange( - xCoord, yCoord, zCoord - 1, worldObj.getBlock(xCoord, yCoord, zCoord)); + xCoord, + yCoord, + zCoord - 1, + worldObj.getBlock(xCoord, yCoord, zCoord)); } else if (meta == 4) { worldObj.notifyBlocksOfNeighborChange( - xCoord, yCoord, zCoord + 1, worldObj.getBlock(xCoord, yCoord, zCoord)); + xCoord, + yCoord, + zCoord + 1, + worldObj.getBlock(xCoord, yCoord, zCoord)); } else if (meta == 5) { worldObj.notifyBlocksOfNeighborChange( - xCoord, yCoord + 1, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); + xCoord, + yCoord + 1, + zCoord, + worldObj.getBlock(xCoord, yCoord, zCoord)); } else if (meta == 6) { worldObj.notifyBlocksOfNeighborChange( - xCoord, yCoord - 1, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); + xCoord, + yCoord - 1, + zCoord, + worldObj.getBlock(xCoord, yCoord, zCoord)); } else { worldObj.notifyBlocksOfNeighborChange( - xCoord, yCoord - 1, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); + xCoord, + yCoord - 1, + zCoord, + worldObj.getBlock(xCoord, yCoord, zCoord)); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileSunDial.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileSunDial.java index 49aa74e0..01f504e9 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileSunDial.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileSunDial.java @@ -6,6 +6,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; public class TileSunDial extends TileEntity implements IInventory { + int tick; int tick2; public boolean running = false; @@ -90,22 +91,20 @@ public class TileSunDial extends TileEntity implements IInventory { 0D); } if (tick > 74) Track(getTime()); - if (tick > 74) - worldObj.playSoundEffect( - xCoord + 0.5D, - yCoord + 0.5D, - zCoord + 0.5D, - "draconicevolution:beam", - 5F, - worldObj.rand.nextFloat() * 0.1F + 0.9F); - if (tick > 74) - worldObj.playSoundEffect( - xCoord + 0.5D, - yCoord + 0.5D, - zCoord + 0.5D, - "draconicevolution:boom", - 20F, - worldObj.rand.nextFloat() * 0.1F + 0.9F); + if (tick > 74) worldObj.playSoundEffect( + xCoord + 0.5D, + yCoord + 0.5D, + zCoord + 0.5D, + "draconicevolution:beam", + 5F, + worldObj.rand.nextFloat() * 0.1F + 0.9F); + if (tick > 74) worldObj.playSoundEffect( + xCoord + 0.5D, + yCoord + 0.5D, + zCoord + 0.5D, + "draconicevolution:boom", + 20F, + worldObj.rand.nextFloat() * 0.1F + 0.9F); if (tick2 == 5) tick2 = 0; } @@ -177,8 +176,8 @@ public class TileSunDial extends TileEntity implements IInventory { return time4; } - private double map( - final double x, final double in_min, final double in_max, final double out_min, final double out_max) { + private double map(final double x, final double in_min, final double in_max, final double out_min, + final double out_max) { return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTeleporterStand.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTeleporterStand.java index ea600f40..cae20c5d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTeleporterStand.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTeleporterStand.java @@ -13,6 +13,7 @@ import net.minecraft.tileentity.TileEntity; * Created by Brandon on 27/06/2014. */ public class TileTeleporterStand extends TileEntity implements IInventory { // todo Create IRotatable Tile and gui + ItemStack[] items = new ItemStack[1]; public int rotation = 0; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTestBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTestBlock.java index 9d4b0bc6..e78e5d69 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTestBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTestBlock.java @@ -2,13 +2,6 @@ package com.brandon3055.draconicevolution.common.tileentities; import static net.minecraftforge.common.util.ForgeDirection.UP; -import cofh.api.energy.IEnergyHandler; -import cofh.api.energy.IEnergyReceiver; -import com.brandon3055.brandonscore.common.utills.Utills; -import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyBeam; -import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyField; -import com.brandon3055.draconicevolution.common.utills.EnergyStorage; -import com.brandon3055.draconicevolution.common.utills.LogHelper; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; @@ -18,10 +11,20 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraftforge.common.util.ForgeDirection; +import cofh.api.energy.IEnergyHandler; +import cofh.api.energy.IEnergyReceiver; + +import com.brandon3055.brandonscore.common.utills.Utills; +import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyBeam; +import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyField; +import com.brandon3055.draconicevolution.common.utills.EnergyStorage; +import com.brandon3055.draconicevolution.common.utills.LogHelper; + /** * Created by Brandon on 24/06/2014. */ public class TileTestBlock extends TileEntity implements IEnergyHandler { + public EnergyStorage energy = new EnergyStorage(100000000); public int maxInput = 100000000; public float modelRotation; @@ -39,62 +42,64 @@ public class TileTestBlock extends TileEntity implements IEnergyHandler { if (worldObj.isRemote) return; for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) { - if (worldObj.getTileEntity(xCoord + d.offsetX, yCoord + d.offsetY, zCoord + d.offsetZ) - instanceof IEnergyReceiver) + if (worldObj.getTileEntity( + xCoord + d.offsetX, + yCoord + d.offsetY, + zCoord + d.offsetZ) instanceof IEnergyReceiver) ((IEnergyReceiver) worldObj.getTileEntity(xCoord + d.offsetX, yCoord + d.offsetY, zCoord + d.offsetZ)) .receiveEnergy(d.getOpposite(), Integer.MAX_VALUE, false); } - // LogHelper.info(Integer.MAX_VALUE); + // LogHelper.info(Integer.MAX_VALUE); // if (1==1)return; - // for (Field f : StatList.class.getDeclaredFields()) { - // f.setAccessible(true); + // for (Field f : StatList.class.getDeclaredFields()) { + // f.setAccessible(true); // - // try { - // if (f.getName().equals("oneShotStats")) { - // f.set(null, new HashMap()); - // } - // } - // catch (Exception e) { - // LogHelper.error("Severe error, please report this to the mod author:"); - // LogHelper.error(e); - // } - // } + // try { + // if (f.getName().equals("oneShotStats")) { + // f.set(null, new HashMap()); + // } + // } + // catch (Exception e) { + // LogHelper.error("Severe error, please report this to the mod author:"); + // LogHelper.error(e); + // } + // } - // for (Field f : AchievementPage.class.getDeclaredFields()) {// - // f.setAccessible(true); + // for (Field f : AchievementPage.class.getDeclaredFields()) {// + // f.setAccessible(true); // - // try { - // if (f.getName().equals("achievementPages")) { - // f.set(null, new LinkedList()); - // } - // } - // catch (Exception e) { - // LogHelper.error("Severe error, please report this to the mod author:"); - // LogHelper.error(e); - // } - // } + // try { + // if (f.getName().equals("achievementPages")) { + // f.set(null, new LinkedList()); + // } + // } + // catch (Exception e) { + // LogHelper.error("Severe error, please report this to the mod author:"); + // LogHelper.error(e); + // } + // } - // Achievements.addModAchievements(); - // Achievements.registerAchievementPane(); + // Achievements.addModAchievements(); + // Achievements.registerAchievementPane(); - // if (worldObj.isRemote) modelRotation += 0.5; + // if (worldObj.isRemote) modelRotation += 0.5; // LogHelper.info(modelCoreRotation); - // int test = 4; - // //if (!worldObj.isRemote) - // //System.out.println(energy.getEnergyStored()); + // int test = 4; + // //if (!worldObj.isRemote) + // //System.out.println(energy.getEnergyStored()); // - // if ((this.energy.getEnergyStored() > 0)) { + // if ((this.energy.getEnergyStored() > 0)) { // - // TileEntity tile = worldObj.getTileEntity(xCoord + UP.offsetX, yCoord + UP.offsetY, zCoord + UP.offsetZ); + // TileEntity tile = worldObj.getTileEntity(xCoord + UP.offsetX, yCoord + UP.offsetY, zCoord + UP.offsetZ); // - // if ((tile instanceof IEnergyHandler)) { - // this.energy.extractEnergy(((IEnergyHandler)tile).receiveEnergy(UP.getOpposite(), + // if ((tile instanceof IEnergyHandler)) { + // this.energy.extractEnergy(((IEnergyHandler)tile).receiveEnergy(UP.getOpposite(), // this.energy.extractEnergy(maxInput, true), false), false); - // } - // } + // } + // } } @Override @@ -147,9 +152,8 @@ public class TileTestBlock extends TileEntity implements IEnergyHandler { super.readFromNBT(p_145839_1_); EntityPlayer player = null; if (worldObj != null) player = worldObj.getClosestPlayer(xCoord, yCoord, zCoord, -1); - if (player != null) - LogHelper.info( - "Read: " + Utills.getDistanceAtoB(player.posX, player.posY, player.posZ, xCoord, yCoord, zCoord)); + if (player != null) LogHelper + .info("Read: " + Utills.getDistanceAtoB(player.posX, player.posY, player.posZ, xCoord, yCoord, zCoord)); LogHelper.info(worldObj + " " + player); } @@ -158,8 +162,7 @@ public class TileTestBlock extends TileEntity implements IEnergyHandler { super.writeToNBT(p_145841_1_); EntityPlayer player = null; if (worldObj != null) player = worldObj.getClosestPlayer(xCoord, yCoord, zCoord, -1); - if (player != null) - LogHelper.info( - "Write: " + Utills.getDistanceAtoB(player.posX, player.posY, player.posZ, xCoord, yCoord, zCoord)); + if (player != null) LogHelper.info( + "Write: " + Utills.getDistanceAtoB(player.posX, player.posY, player.posZ, xCoord, yCoord, zCoord)); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileUpgradeModifier.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileUpgradeModifier.java index 25beaa28..3fc99c50 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileUpgradeModifier.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileUpgradeModifier.java @@ -13,6 +13,7 @@ import net.minecraft.tileentity.TileEntity; * Created by brandon3055 on 23/12/2015. */ public class TileUpgradeModifier extends TileEntity implements ISidedInventory { + ItemStack[] items = new ItemStack[1]; public float rotation = 0; @@ -129,7 +130,7 @@ public class TileUpgradeModifier extends TileEntity implements ISidedInventory { @Override public int[] getAccessibleSlotsFromSide(int var1) { - return new int[] {0}; + return new int[] { 0 }; } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileWeatherController.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileWeatherController.java index a8848d5f..ad31214d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileWeatherController.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileWeatherController.java @@ -1,6 +1,5 @@ package com.brandon3055.draconicevolution.common.tileentities; -import com.brandon3055.draconicevolution.DraconicEvolution; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; @@ -12,7 +11,10 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.storage.WorldInfo; +import com.brandon3055.draconicevolution.DraconicEvolution; + public class TileWeatherController extends TileEntity implements IInventory { + int tick = 0; boolean running = false; public boolean lastTickInput = false; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/IRemoteEnergyHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/IRemoteEnergyHandler.java index d4239ac6..9012ea7e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/IRemoteEnergyHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/IRemoteEnergyHandler.java @@ -1,9 +1,11 @@ package com.brandon3055.draconicevolution.common.tileentities.energynet; -import cofh.api.energy.IEnergyHandler; -import com.brandon3055.draconicevolution.common.utills.EnergyStorage; import net.minecraft.entity.player.EntityPlayer; +import cofh.api.energy.IEnergyHandler; + +import com.brandon3055.draconicevolution.common.utills.EnergyStorage; + /** * Created by Brandon on 10/02/2015. */ diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/LinkedEnergyDevice.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/LinkedEnergyDevice.java index 74158d42..f48c18e0 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/LinkedEnergyDevice.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/LinkedEnergyDevice.java @@ -1,16 +1,19 @@ package com.brandon3055.draconicevolution.common.tileentities.energynet; -import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyBeam; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyBeam; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 11/02/2015. */ public class LinkedEnergyDevice { + @SideOnly(Side.CLIENT) public ParticleEnergyBeam beam; /** @@ -31,12 +34,12 @@ public class LinkedEnergyDevice { this.zCoord = zCoord; } - // public LinkedEnergyDevice(int xCoord, int yCoord, int zCoord, ParticleEnergyBeam beam) { - // this.xCoord = xCoord; - // this.yCoord = yCoord; - // this.zCoord = zCoord; - // this.beam = beam; - // } + // public LinkedEnergyDevice(int xCoord, int yCoord, int zCoord, ParticleEnergyBeam beam) { + // this.xCoord = xCoord; + // this.yCoord = yCoord; + // this.zCoord = zCoord; + // this.beam = beam; + // } public TileEntity getTile(World world) { return world.getTileEntity(xCoord, yCoord, zCoord); @@ -54,8 +57,7 @@ public class LinkedEnergyDevice { if (beam != null) { compound.setShort("Flow_" + key, (short) beam.getFlow()); } - } catch (Throwable e) { - } + } catch (Throwable e) {} return this; } @@ -68,8 +70,7 @@ public class LinkedEnergyDevice { if (beam != null) { beam.setFlow(compound.getShort("Flow" + key)); } - } catch (Throwable e) { - } + } catch (Throwable e) {} return this; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/LinkedReceiver.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/LinkedReceiver.java index 33df0227..bbc65a56 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/LinkedReceiver.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/LinkedReceiver.java @@ -1,12 +1,13 @@ package com.brandon3055.draconicevolution.common.tileentities.energynet; -import cofh.api.energy.IEnergyReceiver; import net.minecraft.block.Block; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import cofh.api.energy.IEnergyReceiver; + /** * Created by Brandon on 26/03/2015. */ @@ -45,9 +46,8 @@ public class LinkedReceiver { } public int receiveEnergy(World world, int maxReceive, boolean simulate) { - if (isStillValid(world)) - return getReceiver(world) - .receiveEnergy(ForgeDirection.getOrientation(connectionSide), maxReceive, simulate); + if (isStillValid(world)) return getReceiver(world) + .receiveEnergy(ForgeDirection.getOrientation(connectionSide), maxReceive, simulate); else return 0; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileEnergyRelay.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileEnergyRelay.java index a77c0314..034f3dff 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileEnergyRelay.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileEnergyRelay.java @@ -1,16 +1,19 @@ package com.brandon3055.draconicevolution.common.tileentities.energynet; +import net.minecraft.nbt.NBTTagCompound; + import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyField; import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.nbt.NBTTagCompound; /** * Created by Brandon on 10/02/2015. */ public class TileEnergyRelay extends TileRemoteEnergyBase { + @SideOnly(Side.CLIENT) private ParticleEnergyField ring; @@ -23,22 +26,19 @@ public class TileEnergyRelay extends TileRemoteEnergyBase { @Override public int getCap() { - return powerTier == 0 - ? BalanceConfigHandler.energyRelayBasicStorage + return powerTier == 0 ? BalanceConfigHandler.energyRelayBasicStorage : BalanceConfigHandler.energyRelayAdvancedStorage; } @Override public int getRec() { - return powerTier == 0 - ? BalanceConfigHandler.energyRelayBasicMaxReceive + return powerTier == 0 ? BalanceConfigHandler.energyRelayBasicMaxReceive : BalanceConfigHandler.energyRelayAdvancedMaxReceive; } @Override public int getExt() { - return powerTier == 0 - ? BalanceConfigHandler.energyRelayBasicMaxExtract + return powerTier == 0 ? BalanceConfigHandler.energyRelayBasicMaxExtract : BalanceConfigHandler.energyRelayAdvancedMaxExtract; } @@ -48,7 +48,14 @@ public class TileEnergyRelay extends TileRemoteEnergyBase { if (worldObj.isRemote) { ring = DraconicEvolution.proxy.energyField( - worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 0, powerTier == 1, ring, inView > 0); + worldObj, + xCoord + 0.5, + yCoord + 0.5, + zCoord + 0.5, + 0, + powerTier == 1, + ring, + inView > 0); return; } } @@ -63,19 +70,17 @@ public class TileEnergyRelay extends TileRemoteEnergyBase { super.readFromNBT(compound); } - // @Override - // public double getCapacity() { - // return ((double) getEnergyStored(ForgeDirection.UNKNOWN) / (double) getMaxEnergyStored(ForgeDirection.UNKNOWN)) + // @Override + // public double getCapacity() { + // return ((double) getEnergyStored(ForgeDirection.UNKNOWN) / (double) getMaxEnergyStored(ForgeDirection.UNKNOWN)) // * 100D; - // } + // } /** - * Calculates the energy flow based on the local buffer - * and the remote buffer - * return double between 0 to 100 + * Calculates the energy flow based on the local buffer and the remote buffer return double between 0 to 100 */ public double getFlow(double localCap, double remoteCap) { - return Math.max(0, Math.min(100, (localCap - remoteCap) * 100D /*Flow Multiplier*/)); + return Math.max(0, Math.min(100, (localCap - remoteCap) * 100D /* Flow Multiplier */)); } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileEnergyTransceiver.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileEnergyTransceiver.java index 890b5788..e8672de6 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileEnergyTransceiver.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileEnergyTransceiver.java @@ -1,19 +1,22 @@ package com.brandon3055.draconicevolution.common.tileentities.energynet; -import cofh.api.energy.IEnergyProvider; -import cofh.api.energy.IEnergyReceiver; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyField; -import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; -import com.brandon3055.draconicevolution.common.items.tools.Wrench; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; +import cofh.api.energy.IEnergyProvider; +import cofh.api.energy.IEnergyReceiver; + +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyField; +import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; +import com.brandon3055.draconicevolution.common.items.tools.Wrench; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 16/02/2015. */ @@ -39,44 +42,45 @@ public class TileEnergyTransceiver extends TileRemoteEnergyBase { if (!worldObj.isRemote) { ForgeDirection direction = ForgeDirection.getOrientation(facing).getOpposite(); - TileEntity adjacentTile = worldObj.getTileEntity( - xCoord + direction.offsetX, yCoord + direction.offsetY, zCoord + direction.offsetZ); + TileEntity adjacentTile = worldObj + .getTileEntity(xCoord + direction.offsetX, yCoord + direction.offsetY, zCoord + direction.offsetZ); if (!input && adjacentTile instanceof IEnergyReceiver) { IEnergyReceiver handler = (IEnergyReceiver) adjacentTile; storage.extractEnergy( handler.receiveEnergy( - direction.getOpposite(), storage.extractEnergy(storage.getMaxExtract(), true), false), + direction.getOpposite(), + storage.extractEnergy(storage.getMaxExtract(), true), + false), false); if (transferBoost) { - for (int i = 0; i < 4; i++) - storage.extractEnergy( - handler.receiveEnergy( - direction.getOpposite(), - storage.extractEnergy(storage.getMaxExtract(), true), - false), - false); + for (int i = 0; i < 4; i++) storage.extractEnergy( + handler.receiveEnergy( + direction.getOpposite(), + storage.extractEnergy(storage.getMaxExtract(), true), + false), + false); } } else if (input && adjacentTile instanceof IEnergyProvider) { IEnergyProvider handler = (IEnergyProvider) adjacentTile; storage.receiveEnergy( handler.extractEnergy( - direction.getOpposite(), storage.receiveEnergy(storage.getMaxExtract(), true), false), + direction.getOpposite(), + storage.receiveEnergy(storage.getMaxExtract(), true), + false), false); if (transferBoost) { - for (int i = 0; i < 4; i++) - storage.receiveEnergy( - handler.extractEnergy( - direction.getOpposite(), - storage.receiveEnergy(storage.getMaxExtract(), true), - false), - false); + for (int i = 0; i < 4; i++) storage.receiveEnergy( + handler.extractEnergy( + direction.getOpposite(), + storage.receiveEnergy(storage.getMaxExtract(), true), + false), + false); } } } - if (worldObj.isRemote) - particle = DraconicEvolution.proxy.energyField( - worldObj, getBeamX(), getBeamY(), getBeamZ(), 1, powerTier == 1, particle, inView > 0); + if (worldObj.isRemote) particle = DraconicEvolution.proxy + .energyField(worldObj, getBeamX(), getBeamY(), getBeamZ(), 1, powerTier == 1, particle, inView > 0); } @Override @@ -124,22 +128,19 @@ public class TileEnergyTransceiver extends TileRemoteEnergyBase { @Override public int getCap() { - return powerTier == 0 - ? BalanceConfigHandler.energyTransceiverBasicStorage + return powerTier == 0 ? BalanceConfigHandler.energyTransceiverBasicStorage : BalanceConfigHandler.energyTransceiverAdvancedStorage; } @Override public int getRec() { - return powerTier == 0 - ? BalanceConfigHandler.energyTransceiverBasicMaxReceive + return powerTier == 0 ? BalanceConfigHandler.energyTransceiverBasicMaxReceive : BalanceConfigHandler.energyTransceiverAdvancedMaxReceive; } @Override public int getExt() { - return powerTier == 0 - ? BalanceConfigHandler.energyTransceiverBasicMaxExtract + return powerTier == 0 ? BalanceConfigHandler.energyTransceiverBasicMaxExtract : BalanceConfigHandler.energyTransceiverAdvancedMaxExtract; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileRemoteEnergyBase.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileRemoteEnergyBase.java index 86fa859a..8e25d71b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileRemoteEnergyBase.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileRemoteEnergyBase.java @@ -1,5 +1,19 @@ package com.brandon3055.draconicevolution.common.tileentities.energynet; +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraftforge.common.util.ForgeDirection; + import com.brandon3055.brandonscore.common.utills.DataUtills; import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; import com.brandon3055.brandonscore.common.utills.Utills; @@ -11,26 +25,18 @@ import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.tileentities.TileObjectSync; import com.brandon3055.draconicevolution.common.utills.EnergyStorage; import com.brandon3055.draconicevolution.common.utills.LogHelper; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import java.util.ArrayList; -import java.util.List; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.ChatComponentTranslation; -import net.minecraftforge.common.util.ForgeDirection; /** * Created by Brandon on 10/02/2015. */ -public abstract class TileRemoteEnergyBase extends TileObjectSync - implements IRemoteEnergyHandler { // todo optimize (add cutoff, explore possible cach optimization) +public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRemoteEnergyHandler { // todo optimize + // (add cutoff, + // explore possible + // cach + // optimization) /** * The tier of the relay (0-1) @@ -109,17 +115,20 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync rType); } else { double difference = getCapacity() - remoteTile.getCapacity(); - double energyToEqual = Math.round( - difference / 100D * (double) remoteTile.getStorage().getMaxEnergyStored() / 2.01D); - double maxFlow = Math.min(energyToEqual, (double) Math.min( - storage.getMaxExtract(), - remoteTile.getStorage().getMaxEnergyStored() - - remoteTile.getStorage().getEnergyStored())); + double energyToEqual = Math + .round(difference / 100D * (double) remoteTile.getStorage().getMaxEnergyStored() / 2.01D); + double maxFlow = Math.min( + energyToEqual, + (double) Math.min( + storage.getMaxExtract(), + remoteTile.getStorage().getMaxEnergyStored() + - remoteTile.getStorage().getEnergyStored())); device.energyFlow = getFlow(getCapacity(), remoteTile.getCapacity()); int flow = (int) ((device.energyFlow / 100D) * maxFlow); int transfered = storage.extractEnergy( - remoteTile.getStorage().receiveEnergy(storage.extractEnergy(flow, true), false), false); + remoteTile.getStorage().receiveEnergy(storage.extractEnergy(flow, true), false), + false); device.energyFlow = Math.min(((double) transfered / 10000D) * 100D, 100D); @@ -134,11 +143,12 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync boolean forceSend = (tick + xCoord + yCoord + zCoord) % 100 == 0; if ((tick + xCoord + yCoord + zCoord) % 20 == 0 || forceSend) { - if (index >= 0 - && (linkedDevices.get(index).energyFlow != linkedDevices.get(index).lastTickEnergyFlow - || forceSend)) { - sendObjectToClient(References.INT_PAIR_ID, 0, new DataUtills.IntPair(index, (int) - linkedDevices.get(index).energyFlow)); + if (index >= 0 && (linkedDevices.get(index).energyFlow != linkedDevices.get(index).lastTickEnergyFlow + || forceSend)) { + sendObjectToClient( + References.INT_PAIR_ID, + 0, + new DataUtills.IntPair(index, (int) linkedDevices.get(index).energyFlow)); linkedDevices.get(index).lastTickEnergyFlow = linkedDevices.get(index).energyFlow; } @@ -150,8 +160,7 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync @SideOnly(Side.CLIENT) @Override public void receiveObjectFromServer(int index, Object object) { - if (index == 0 - && object instanceof DataUtills.IntPair + if (index == 0 && object instanceof DataUtills.IntPair && linkedDevices.size() > ((DataUtills.IntPair) object).i1) { linkedDevices.get(((DataUtills.IntPair) object).i1).energyFlow = ((DataUtills.IntPair) object).i2; } else if (index == 1) storage.setEnergyStored((Integer) object); @@ -163,12 +172,10 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync } /** - * Calculates the energy flow based on the local buffer - * and the remote buffer - * return double between 0 to 100 + * Calculates the energy flow based on the local buffer and the remote buffer return double between 0 to 100 */ public double getFlow(double localCap, double remoteCap) { - return Math.max(0, Math.min(100, (localCap - remoteCap) * 10D /*Flow Multiplier*/)); + return Math.max(0, Math.min(100, (localCap - remoteCap) * 10D /* Flow Multiplier */)); } public int getPowerTier() { @@ -214,8 +221,7 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync } else if (mode.equals(Wrench.UNBIND_MODE)) { if (linkDat != null && linkDat.hasKey("Bound") && linkDat.getBoolean("Bound")) { for (LinkedEnergyDevice ld : linkedDevices) { - if (ld.xCoord == linkDat.getInteger("XCoord") - && ld.yCoord == linkDat.getInteger("YCoord") + if (ld.xCoord == linkDat.getInteger("XCoord") && ld.yCoord == linkDat.getInteger("YCoord") && ld.zCoord == linkDat.getInteger("ZCoord")) { if (!(ld.getTile(worldObj) instanceof TileRemoteEnergyBase)) { @@ -273,8 +279,7 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync @Override public boolean handleBinding(EntityPlayer player, int x, int y, int z, boolean callOther) { - int range = powerTier == 0 - ? BalanceConfigHandler.energyDeviceBasicLinkingRange + int range = powerTier == 0 ? BalanceConfigHandler.energyDeviceBasicLinkingRange : BalanceConfigHandler.energyDeviceAdvancedLinkingRange; IRemoteEnergyHandler tile = worldObj.getTileEntity(x, y, z) instanceof IRemoteEnergyHandler ? (IRemoteEnergyHandler) worldObj.getTileEntity(x, y, z) diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileWirelessEnergyTransceiver.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileWirelessEnergyTransceiver.java index 2320d954..fefe7420 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileWirelessEnergyTransceiver.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileWirelessEnergyTransceiver.java @@ -1,6 +1,17 @@ package com.brandon3055.draconicevolution.common.tileentities.energynet; +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraftforge.common.util.ForgeDirection; + import cofh.api.energy.IEnergyReceiver; + import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyField; @@ -8,16 +19,9 @@ import com.brandon3055.draconicevolution.client.render.particle.Particles; import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; import com.brandon3055.draconicevolution.common.items.tools.Wrench; import com.brandon3055.draconicevolution.common.lib.References; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import java.util.ArrayList; -import java.util.List; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.ChatComponentTranslation; -import net.minecraftforge.common.util.ForgeDirection; /** * Created by Brandon on 10/02/2015. @@ -38,22 +42,19 @@ public class TileWirelessEnergyTransceiver extends TileRemoteEnergyBase { @Override public int getCap() { - return powerTier == 0 - ? BalanceConfigHandler.energyWirelessTransceiverBasicStorage + return powerTier == 0 ? BalanceConfigHandler.energyWirelessTransceiverBasicStorage : BalanceConfigHandler.energyWirelessTransceiverAdvancedStorage; } @Override public int getRec() { - return powerTier == 0 - ? BalanceConfigHandler.energyWirelessTransceiverBasicMaxReceive + return powerTier == 0 ? BalanceConfigHandler.energyWirelessTransceiverBasicMaxReceive : BalanceConfigHandler.energyWirelessTransceiverAdvancedMaxReceive; } @Override public int getExt() { - return powerTier == 0 - ? BalanceConfigHandler.energyWirelessTransceiverBasicMaxExtract + return powerTier == 0 ? BalanceConfigHandler.energyWirelessTransceiverBasicMaxExtract : BalanceConfigHandler.energyWirelessTransceiverAdvancedMaxExtract; } @@ -63,7 +64,14 @@ public class TileWirelessEnergyTransceiver extends TileRemoteEnergyBase { if (worldObj.isRemote) { ring = DraconicEvolution.proxy.energyField( - worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 2, powerTier == 1, ring, inView > 0); + worldObj, + xCoord + 0.5, + yCoord + 0.5, + zCoord + 0.5, + 2, + powerTier == 1, + ring, + inView > 0); for (LinkedReceiver receiver : receiverList) { int particleValue = 200; @@ -97,8 +105,7 @@ public class TileWirelessEnergyTransceiver extends TileRemoteEnergyBase { storage.extractEnergy( receiver.receiveEnergy( worldObj, - powerTier == 0 - ? BalanceConfigHandler.energyWirelessTransceiverBasicMaxSend + powerTier == 0 ? BalanceConfigHandler.energyWirelessTransceiverBasicMaxSend : BalanceConfigHandler.energyWirelessTransceiverAdvancedMaxSend, true), false), @@ -153,8 +160,7 @@ public class TileWirelessEnergyTransceiver extends TileRemoteEnergyBase { LinkedReceiver r = new LinkedReceiver(x, y, z, side); for (LinkedReceiver r2 : receiverList) { - if (r.xCoord == r2.xCoord - && r.yCoord == r2.yCoord + if (r.xCoord == r2.xCoord && r.yCoord == r2.yCoord && r.zCoord == r2.zCoord && r.connectionSide == r2.connectionSide) { player.addChatComponentMessage(new ChatComponentTranslation("msg.de.linked.txt")); @@ -195,19 +201,17 @@ public class TileWirelessEnergyTransceiver extends TileRemoteEnergyBase { } } - // @Override - // public double getCapacity() { - // return ((double) getEnergyStored(ForgeDirection.UNKNOWN) / (double) getMaxEnergyStored(ForgeDirection.UNKNOWN)) + // @Override + // public double getCapacity() { + // return ((double) getEnergyStored(ForgeDirection.UNKNOWN) / (double) getMaxEnergyStored(ForgeDirection.UNKNOWN)) // * 100D; - // } + // } /** - * Calculates the energy flow based on the local buffer - * and the remote buffer - * return double between 0 to 100 + * Calculates the energy flow based on the local buffer and the remote buffer return double between 0 to 100 */ public double getFlow(double localCap, double remoteCap) { - return Math.max(0, Math.min(100, (localCap - remoteCap) * 100D /*Flow Multiplier*/)); + return Math.max(0, Math.min(100, (localCap - remoteCap) * 100D /* Flow Multiplier */)); } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/gates/TileFluidGate.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/gates/TileFluidGate.java index f8db223a..ecee21b6 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/gates/TileFluidGate.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/gates/TileFluidGate.java @@ -1,8 +1,5 @@ package com.brandon3055.draconicevolution.common.tileentities.gates; -import com.brandon3055.brandonscore.common.utills.Utills; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.utills.LogHelper; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; @@ -10,6 +7,10 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidHandler; +import com.brandon3055.brandonscore.common.utills.Utills; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.utills.LogHelper; + /** * Created by Brandon on 29/6/2015. */ @@ -57,8 +58,8 @@ public class TileFluidGate extends TileGate implements IFluidHandler { } private IFluidHandler getOutputTarget() { - TileEntity tile = - worldObj.getTileEntity(xCoord + output.offsetX, yCoord + output.offsetY, zCoord + output.offsetZ); + TileEntity tile = worldObj + .getTileEntity(xCoord + output.offsetX, yCoord + output.offsetY, zCoord + output.offsetZ); return tile instanceof IFluidHandler ? (IFluidHandler) tile : null; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/gates/TileFluxGate.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/gates/TileFluxGate.java index fe23884a..9c81a5d6 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/gates/TileFluxGate.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/gates/TileFluxGate.java @@ -1,11 +1,13 @@ package com.brandon3055.draconicevolution.common.tileentities.gates; -import cofh.api.energy.IEnergyReceiver; -import com.brandon3055.brandonscore.common.utills.Utills; -import com.brandon3055.draconicevolution.common.lib.References; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; +import cofh.api.energy.IEnergyReceiver; + +import com.brandon3055.brandonscore.common.utills.Utills; +import com.brandon3055.draconicevolution.common.lib.References; + /** * Created by Brandon on 29/6/2015. */ @@ -23,11 +25,10 @@ public class TileFluxGate extends TileGate implements IEnergyReceiver { @Override public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) { IEnergyReceiver target = getOutputTarget(); - // int i = buffer.receiveEnergy(Math.max(0, Math.min(maxReceive, Math.min(getActualFlow(), getActualFlow() - + // int i = buffer.receiveEnergy(Math.max(0, Math.min(maxReceive, Math.min(getActualFlow(), getActualFlow() - // buffer.getEnergyStored()))), simulate); - // return i; - int transfer = target == null - ? 0 + // return i; + int transfer = target == null ? 0 : target.receiveEnergy( from, Math.min( @@ -38,25 +39,25 @@ public class TileFluxGate extends TileGate implements IEnergyReceiver { return transfer; } - // private EnergyStorage buffer = new EnergyStorage(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE); + // private EnergyStorage buffer = new EnergyStorage(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE); // - // @Override - // public void updateEntity() { - // super.updateEntity(); + // @Override + // public void updateEntity() { + // super.updateEntity(); // - // IEnergyReceiver receiver = getOutputTarget(); - // if (receiver != null && !worldObj.isRemote){ - // buffer.extractEnergy(receiver.receiveEnergy(output.getOpposite(), getActualFlow(), false), false); - // } - // } + // IEnergyReceiver receiver = getOutputTarget(); + // if (receiver != null && !worldObj.isRemote){ + // buffer.extractEnergy(receiver.receiveEnergy(output.getOpposite(), getActualFlow(), false), false); + // } + // } // - // @Override - // public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) { - // if (buffer.getEnergyStored() > 0) return 0; - // int i = buffer.receiveEnergy(Math.max(0, Math.min(maxReceive, Math.min(getActualFlow(), getActualFlow() - + // @Override + // public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) { + // if (buffer.getEnergyStored() > 0) return 0; + // int i = buffer.receiveEnergy(Math.max(0, Math.min(maxReceive, Math.min(getActualFlow(), getActualFlow() - // buffer.getEnergyStored()))), simulate); - // return i; - // } + // return i; + // } @Override public int getEnergyStored(ForgeDirection from) { @@ -76,8 +77,8 @@ public class TileFluxGate extends TileGate implements IEnergyReceiver { } private IEnergyReceiver getOutputTarget() { - TileEntity tile = - worldObj.getTileEntity(xCoord + output.offsetX, yCoord + output.offsetY, zCoord + output.offsetZ); + TileEntity tile = worldObj + .getTileEntity(xCoord + output.offsetX, yCoord + output.offsetY, zCoord + output.offsetZ); return tile instanceof IEnergyReceiver ? (IEnergyReceiver) tile : null; } @@ -88,8 +89,8 @@ public class TileFluxGate extends TileGate implements IEnergyReceiver { @Override public void incrementFlow(int selector, boolean ctrl, boolean shift, boolean add, int button) { - int amount = - button == 0 ? shift ? ctrl ? 10000 : 1000 : ctrl ? 5 : 50 : shift ? ctrl ? 1000 : 100 : ctrl ? 1 : 10; + int amount = button == 0 ? shift ? ctrl ? 10000 : 1000 : ctrl ? 5 : 50 + : shift ? ctrl ? 1000 : 100 : ctrl ? 1 : 10; if (selector == 0) { if (ctrl && shift && button == 0) amount += flowRSLow / 100000 * 1000; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/gates/TileGate.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/gates/TileGate.java index 76ceaee7..5642d3b7 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/gates/TileGate.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/gates/TileGate.java @@ -1,15 +1,16 @@ package com.brandon3055.draconicevolution.common.tileentities.gates; -import com.brandon3055.brandonscore.common.utills.Utills; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.tileentities.TileObjectSync; -import com.brandon3055.draconicevolution.integration.computers.IDEPeripheral; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraftforge.common.util.ForgeDirection; +import com.brandon3055.brandonscore.common.utills.Utills; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.tileentities.TileObjectSync; +import com.brandon3055.draconicevolution.integration.computers.IDEPeripheral; + /** * Created by Brandon on 29/6/2015. */ @@ -90,52 +91,40 @@ public abstract class TileGate extends TileObjectSync implements IDEPeripheral { @Override public String[] getMethodNames() { - return new String[] { - "getFlow", - "setOverrideEnabled", - "getOverrideEnabled", - "setFlowOverride", - "setSignalHighFlow", - "getSignalHighFlow", - "setSignalLowFlow", - "getSignalLowFlow" - }; + return new String[] { "getFlow", "setOverrideEnabled", "getOverrideEnabled", "setFlowOverride", + "setSignalHighFlow", "getSignalHighFlow", "setSignalLowFlow", "getSignalLowFlow" }; } @Override public Object[] callMethod(String method, Object... args) { if (method.equals("getFlow")) { - return new Object[] {getActualFlow()}; + return new Object[] { getActualFlow() }; } else if (method.equals("setOverrideEnabled")) { - if (args.length == 0 || !(args[0] instanceof Boolean)) - throw new IllegalArgumentException("Expected Boolean got " - + (args.length == 0 ? "nil" : args[0].getClass().getSimpleName())); + if (args.length == 0 || !(args[0] instanceof Boolean)) throw new IllegalArgumentException( + "Expected Boolean got " + (args.length == 0 ? "nil" : args[0].getClass().getSimpleName())); flowOverridden = (Boolean) args[0]; if (!worldObj.isRemote) sendObjectToClient(References.BOOLEAN_ID, 2, flowOverridden); } else if (method.equals("getOverrideEnabled")) { - return new Object[] {flowOverridden}; + return new Object[] { flowOverridden }; } else if (method.equals("setFlowOverride")) { - if (args.length == 0 || !(args[0] instanceof Number)) - throw new IllegalArgumentException("Expected Number got " - + (args.length == 0 ? "nil" : args[0].getClass().getSimpleName())); + if (args.length == 0 || !(args[0] instanceof Number)) throw new IllegalArgumentException( + "Expected Number got " + (args.length == 0 ? "nil" : args[0].getClass().getSimpleName())); flowOverride = Utills.toInt((Double) args[0]); if (!worldObj.isRemote) sendObjectToClient(References.INT_ID, 3, flowOverride); } else if (method.equals("setSignalHighFlow")) { - if (args.length == 0 || !(args[0] instanceof Number)) - throw new IllegalArgumentException("Expected Number got " - + (args.length == 0 ? "nil" : args[0].getClass().getSimpleName())); + if (args.length == 0 || !(args[0] instanceof Number)) throw new IllegalArgumentException( + "Expected Number got " + (args.length == 0 ? "nil" : args[0].getClass().getSimpleName())); flowRSHigh = Utills.toInt((Double) args[0]); if (!worldObj.isRemote) sendObjectToClient(References.INT_ID, 4, flowRSHigh); } else if (method.equals("getSignalHighFlow")) { - return new Object[] {flowRSHigh}; + return new Object[] { flowRSHigh }; } else if (method.equals("setSignalLowFlow")) { - if (args.length == 0 || !(args[0] instanceof Number)) - throw new IllegalArgumentException("Expected Number got " - + (args.length == 0 ? "nil" : args[0].getClass().getSimpleName())); + if (args.length == 0 || !(args[0] instanceof Number)) throw new IllegalArgumentException( + "Expected Number got " + (args.length == 0 ? "nil" : args[0].getClass().getSimpleName())); flowRSLow = Utills.toInt((Double) args[0]); if (!worldObj.isRemote) sendObjectToClient(References.INT_ID, 5, flowRSLow); } else if (method.equals("getSignalLowFlow")) { - return new Object[] {flowRSLow}; + return new Object[] { flowRSLow }; } return new Object[0]; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileDislocatorReceptacle.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileDislocatorReceptacle.java index 5238ca4a..ce0bd58f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileDislocatorReceptacle.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileDislocatorReceptacle.java @@ -1,8 +1,5 @@ package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles; -import com.brandon3055.brandonscore.common.utills.Teleporter; -import com.brandon3055.draconicevolution.common.items.tools.TeleporterMKI; -import com.brandon3055.draconicevolution.common.utills.PortalHelper; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; @@ -12,6 +9,10 @@ import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; +import com.brandon3055.brandonscore.common.utills.Teleporter; +import com.brandon3055.draconicevolution.common.items.tools.TeleporterMKI; +import com.brandon3055.draconicevolution.common.utills.PortalHelper; + /** * Created by Brandon on 22/5/2015. */ @@ -169,8 +170,7 @@ public class TileDislocatorReceptacle extends TileEntity implements IInventory { @Override public boolean isItemValidForSlot(int i, ItemStack itemstack) { - return itemstack != null - && itemstack.getItem() instanceof TeleporterMKI + return itemstack != null && itemstack.getItem() instanceof TeleporterMKI && ((TeleporterMKI) itemstack.getItem()).getLocation(itemstack) != null; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEarth.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEarth.java index 2c4941d0..9992b61e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEarth.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEarth.java @@ -1,12 +1,13 @@ package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles; -import com.brandon3055.draconicevolution.common.tileentities.TileObjectSync; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.util.AxisAlignedBB; +import com.brandon3055.draconicevolution.common.tileentities.TileObjectSync; + public class TileEarth extends TileObjectSync { // Prevent culling when block is out of frame so model can remain active. diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnderResurrection.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnderResurrection.java index 3414244f..0581e983 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnderResurrection.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnderResurrection.java @@ -1,16 +1,7 @@ package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles; -import com.brandon3055.draconicevolution.client.handler.ParticleHandler; -import com.brandon3055.draconicevolution.client.render.particle.Particles.AdvancedSeekerParticle; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper; -import com.brandon3055.draconicevolution.common.entity.EntityCustomDragon; -import com.brandon3055.draconicevolution.common.entity.ExtendedPlayer; -import com.brandon3055.draconicevolution.common.handler.ConfigHandler; -import com.brandon3055.draconicevolution.common.utills.LogHelper; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.Random; + import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; import net.minecraft.entity.effect.EntityLightningBolt; @@ -23,6 +14,18 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChatComponentTranslation; +import com.brandon3055.draconicevolution.client.handler.ParticleHandler; +import com.brandon3055.draconicevolution.client.render.particle.Particles.AdvancedSeekerParticle; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper; +import com.brandon3055.draconicevolution.common.entity.EntityCustomDragon; +import com.brandon3055.draconicevolution.common.entity.ExtendedPlayer; +import com.brandon3055.draconicevolution.common.handler.ConfigHandler; +import com.brandon3055.draconicevolution.common.utills.LogHelper; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 8/08/2014. */ @@ -67,28 +70,30 @@ public class TileEnderResurrection extends TileEntity { for (int i = 0; i < diamondPillars.length; i++) { if (diamondPillars[i] == null) return; worldObj.setBlockToAir( - diamondPillars[i].getXCoord(), diamondPillars[i].getYCoord(), diamondPillars[i].getZCoord()); - if (!worldObj.isRemote) - worldObj.createExplosion( - owner, - diamondPillars[i].getXCoord() + 0.5, - diamondPillars[i].getYCoord() + 0.5, - diamondPillars[i].getZCoord() + 0.5, - 3, - true); + diamondPillars[i].getXCoord(), + diamondPillars[i].getYCoord(), + diamondPillars[i].getZCoord()); + if (!worldObj.isRemote) worldObj.createExplosion( + owner, + diamondPillars[i].getXCoord() + 0.5, + diamondPillars[i].getYCoord() + 0.5, + diamondPillars[i].getZCoord() + 0.5, + 3, + true); } for (int i = 0; i < draconiumPillars.length; i++) { if (draconiumPillars[i] == null) return; worldObj.setBlockToAir( - draconiumPillars[i].getXCoord(), draconiumPillars[i].getYCoord(), draconiumPillars[i].getZCoord()); - if (!worldObj.isRemote) - worldObj.createExplosion( - owner, - draconiumPillars[i].getXCoord() + 0.5, - draconiumPillars[i].getYCoord() + 0.5, - draconiumPillars[i].getZCoord() + 0.5, - 3, - true); + draconiumPillars[i].getXCoord(), + draconiumPillars[i].getYCoord(), + draconiumPillars[i].getZCoord()); + if (!worldObj.isRemote) worldObj.createExplosion( + owner, + draconiumPillars[i].getXCoord() + 0.5, + draconiumPillars[i].getYCoord() + 0.5, + draconiumPillars[i].getZCoord() + 0.5, + 3, + true); } worldObj.setBlockToAir(xCoord, yCoord, zCoord); @@ -241,11 +246,13 @@ public class TileEnderResurrection extends TileEntity { if (worldObj.getBlock(xCoord + 1, yCoord, zCoord) != Blocks.obsidian || worldObj.getBlock(xCoord - 1, yCoord, zCoord) != Blocks.obsidian || worldObj.getBlock(xCoord, yCoord, zCoord + 1) != Blocks.obsidian - || worldObj.getBlock(xCoord, yCoord, zCoord - 1) != Blocks.obsidian) return false; + || worldObj.getBlock(xCoord, yCoord, zCoord - 1) != Blocks.obsidian) + return false; if (worldObj.getBlock(xCoord + 1, yCoord, zCoord + 1) != Blocks.glowstone || worldObj.getBlock(xCoord - 1, yCoord, zCoord - 1) != Blocks.glowstone || worldObj.getBlock(xCoord - 1, yCoord, zCoord + 1) != Blocks.glowstone - || worldObj.getBlock(xCoord + 1, yCoord, zCoord - 1) != Blocks.glowstone) return false; + || worldObj.getBlock(xCoord + 1, yCoord, zCoord - 1) != Blocks.glowstone) + return false; return true; } @@ -253,38 +260,34 @@ public class TileEnderResurrection extends TileEntity { for (int i = 0; i < diamondPillars.length; i++) { if (diamondPillars[i] == null) return false; if (worldObj.getBlock( - diamondPillars[i].getXCoord(), - diamondPillars[i].getYCoord(), - diamondPillars[i].getZCoord()) - != Blocks.diamond_block + diamondPillars[i].getXCoord(), + diamondPillars[i].getYCoord(), + diamondPillars[i].getZCoord()) != Blocks.diamond_block || worldObj.getBlock( - diamondPillars[i].getXCoord(), - diamondPillars[i].getYCoord() - 1, - diamondPillars[i].getZCoord()) - != Blocks.quartz_block) return false; + diamondPillars[i].getXCoord(), + diamondPillars[i].getYCoord() - 1, + diamondPillars[i].getZCoord()) != Blocks.quartz_block) + return false; } for (int i = 0; i < draconiumPillars.length; i++) { if (draconiumPillars[i] == null) return false; if ((worldObj.getBlock( - draconiumPillars[i].getXCoord(), - draconiumPillars[i].getYCoord(), - draconiumPillars[i].getZCoord()) - != ModBlocks.draconiumBlock - && worldObj.getBlockMetadata( - draconiumPillars[i].getXCoord(), - draconiumPillars[i].getYCoord(), - draconiumPillars[i].getZCoord()) - != 2) + draconiumPillars[i].getXCoord(), + draconiumPillars[i].getYCoord(), + draconiumPillars[i].getZCoord()) != ModBlocks.draconiumBlock + && worldObj.getBlockMetadata( + draconiumPillars[i].getXCoord(), + draconiumPillars[i].getYCoord(), + draconiumPillars[i].getZCoord()) != 2) || worldObj.getBlock( - draconiumPillars[i].getXCoord(), - draconiumPillars[i].getYCoord() - 1, - draconiumPillars[i].getZCoord()) - != Blocks.quartz_block + draconiumPillars[i].getXCoord(), + draconiumPillars[i].getYCoord() - 1, + draconiumPillars[i].getZCoord()) != Blocks.quartz_block || worldObj.getBlock( - draconiumPillars[i].getXCoord(), - draconiumPillars[i].getYCoord() - 2, - draconiumPillars[i].getZCoord()) - != Blocks.quartz_block) return false; + draconiumPillars[i].getXCoord(), + draconiumPillars[i].getYCoord() - 2, + draconiumPillars[i].getZCoord()) != Blocks.quartz_block) + return false; } return true; } @@ -296,8 +299,7 @@ public class TileEnderResurrection extends TileEntity { for (int x = xCoord - xzRange; x < xCoord + xzRange; x++) { for (int y = yCoord + 2; y < yCoord + 5; y++) { for (int z = zCoord - xzRange; z < zCoord + xzRange; z++) { - if (worldObj.getBlock(x, y, z) == ModBlocks.draconiumBlock - && isPillarValid(0, x, y, z) + if (worldObj.getBlock(x, y, z) == ModBlocks.draconiumBlock && isPillarValid(0, x, y, z) && worldObj.getBlockMetadata(x, y, z) == 2 && draconiumCount < 4) { draconiumPillars[draconiumCount] = new MultiblockHelper.TileLocation(x, y, z); @@ -310,8 +312,7 @@ public class TileEnderResurrection extends TileEntity { for (int x = xCoord - xzRange; x < xCoord + xzRange; x++) { for (int y = yCoord + 1; y < yCoord + 4; y++) { for (int z = zCoord - xzRange; z < zCoord + xzRange; z++) { - if (worldObj.getBlock(x, y, z) == Blocks.diamond_block - && isPillarValid(1, x, y, z) + if (worldObj.getBlock(x, y, z) == Blocks.diamond_block && isPillarValid(1, x, y, z) && diamondCount < 4) { diamondPillars[diamondCount] = new MultiblockHelper.TileLocation(x, y, z); diamondCount++; @@ -343,20 +344,19 @@ public class TileEnderResurrection extends TileEntity { 1.0F, 100); AdvancedSeekerParticle particle2; - if (timer < 300) - particle2 = new AdvancedSeekerParticle( - worldObj, - draconiumPillars[i].getXCoord() + 0.5, - draconiumPillars[i].getYCoord() + 0.5, - draconiumPillars[i].getZCoord() + 0.5, - xCoord + 0.5, - yCoord + 0.5, - zCoord + 0.5, - 1, - 1F, - 0.0F, - 0F, - 40); + if (timer < 300) particle2 = new AdvancedSeekerParticle( + worldObj, + draconiumPillars[i].getXCoord() + 0.5, + draconiumPillars[i].getYCoord() + 0.5, + draconiumPillars[i].getZCoord() + 0.5, + xCoord + 0.5, + yCoord + 0.5, + zCoord + 0.5, + 1, + 1F, + 0.0F, + 0F, + 40); else { particle2 = new AdvancedSeekerParticle( worldObj, @@ -471,7 +471,8 @@ public class TileEnderResurrection extends TileEntity { if (worldObj.getBlock(x, y - 1, z) == Blocks.quartz_block && worldObj.getBlock(x, y - 2, z) == Blocks.quartz_block && worldObj.getBlockMetadata(x, y - 1, z) == 2 - && worldObj.getBlockMetadata(x, y - 2, z) == 2) return true; + && worldObj.getBlockMetadata(x, y - 2, z) == 2) + return true; } else if (type == 1) { if (worldObj.getBlock(x, y - 1, z) == Blocks.quartz_block && worldObj.getBlockMetadata(x, y - 1, z) == 2) return true; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyPylon.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyPylon.java index fdae07ce..044709ae 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyPylon.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyPylon.java @@ -1,21 +1,9 @@ package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles; -import cofh.api.energy.IEnergyHandler; -import cofh.api.energy.IEnergyReceiver; -import com.brandon3055.draconicevolution.api.IExtendedRFStorage; -import com.brandon3055.draconicevolution.client.handler.ParticleHandler; -import com.brandon3055.draconicevolution.client.render.particle.Particles; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation; -import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.tileentities.TileObjectSync; -import com.brandon3055.draconicevolution.integration.computers.IDEPeripheral; -import cpw.mods.fml.common.network.NetworkRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.List; import java.util.Random; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; @@ -24,10 +12,27 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraftforge.common.util.ForgeDirection; +import cofh.api.energy.IEnergyHandler; +import cofh.api.energy.IEnergyReceiver; + +import com.brandon3055.draconicevolution.api.IExtendedRFStorage; +import com.brandon3055.draconicevolution.client.handler.ParticleHandler; +import com.brandon3055.draconicevolution.client.render.particle.Particles; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation; +import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.tileentities.TileObjectSync; +import com.brandon3055.draconicevolution.integration.computers.IDEPeripheral; + +import cpw.mods.fml.common.network.NetworkRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 28/07/2014. */ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, IExtendedRFStorage, IDEPeripheral { + public boolean active = false; public boolean lastTickActive = false; public boolean reciveEnergy = false; // Power Flow to system @@ -58,19 +63,40 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I int cOut = (int) (getEnergyStored() / getMaxEnergyStored() * 15D); if (cOut != lastCheckCompOverride) { worldObj.notifyBlocksOfNeighborChange( - xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); + xCoord, + yCoord, + zCoord, + worldObj.getBlock(xCoord, yCoord, zCoord)); worldObj.notifyBlocksOfNeighborChange( - xCoord - 1, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); + xCoord - 1, + yCoord, + zCoord, + worldObj.getBlock(xCoord, yCoord, zCoord)); worldObj.notifyBlocksOfNeighborChange( - xCoord + 1, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); + xCoord + 1, + yCoord, + zCoord, + worldObj.getBlock(xCoord, yCoord, zCoord)); worldObj.notifyBlocksOfNeighborChange( - xCoord, yCoord - 1, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); + xCoord, + yCoord - 1, + zCoord, + worldObj.getBlock(xCoord, yCoord, zCoord)); worldObj.notifyBlocksOfNeighborChange( - xCoord, yCoord + 1, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); + xCoord, + yCoord + 1, + zCoord, + worldObj.getBlock(xCoord, yCoord, zCoord)); worldObj.notifyBlocksOfNeighborChange( - xCoord, yCoord, zCoord - 1, worldObj.getBlock(xCoord, yCoord, zCoord)); + xCoord, + yCoord, + zCoord - 1, + worldObj.getBlock(xCoord, yCoord, zCoord)); worldObj.notifyBlocksOfNeighborChange( - xCoord, yCoord, zCoord + 1, worldObj.getBlock(xCoord, yCoord, zCoord)); + xCoord, + yCoord, + zCoord + 1, + worldObj.getBlock(xCoord, yCoord, zCoord)); lastCheckCompOverride = cOut; } } @@ -103,9 +129,9 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I if (coreLocatios.isEmpty()) return null; if (selectedCore >= coreLocatios.size()) selectedCore = coreLocatios.size() - 1; TileLocation core = coreLocatios.get(selectedCore); - if (core == null - || !(worldObj.getTileEntity(core.getXCoord(), core.getYCoord(), core.getZCoord()) - instanceof TileEnergyStorageCore)) return null; + if (core == null || !(worldObj + .getTileEntity(core.getXCoord(), core.getYCoord(), core.getZCoord()) instanceof TileEnergyStorageCore)) + return null; return (TileEnergyStorageCore) worldObj.getTileEntity(core.getXCoord(), core.getYCoord(), core.getZCoord()); } @@ -148,17 +174,11 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I int z = getMaster().zCoord; int cYCoord = worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 1 ? yCoord + 1 : yCoord - 1; - float disMod = getMaster().getTier() == 0 - ? 0.5F - : getMaster().getTier() == 1 - ? 1F - : getMaster().getTier() == 2 - ? 1F - : getMaster().getTier() == 3 - ? 2F - : getMaster().getTier() == 4 - ? 2F - : getMaster().getTier() == 5 ? 3F : 4F; + float disMod = getMaster().getTier() == 0 ? 0.5F + : getMaster().getTier() == 1 ? 1F + : getMaster().getTier() == 2 ? 1F + : getMaster().getTier() == 3 ? 2F + : getMaster().getTier() == 4 ? 2F : getMaster().getTier() == 5 ? 3F : 4F; double spawnX; double spawnY; double spawnZ; @@ -175,7 +195,14 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I targetZ = zCoord + 0.5; if (rand.nextFloat() < 0.05F) { Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle( - worldObj, spawnX, spawnY, spawnZ, targetX, targetY, targetZ, true); + worldObj, + spawnX, + spawnY, + spawnZ, + targetX, + targetY, + targetZ, + true); ParticleHandler.spawnCustomParticle(passiveParticle, 35); } if (particleRate > 0) { @@ -185,7 +212,14 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I spawnY = y + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); spawnZ = z + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle( - worldObj, spawnX, spawnY, spawnZ, targetX, targetY, targetZ, false); + worldObj, + spawnX, + spawnY, + spawnZ, + targetX, + targetY, + targetZ, + false); ParticleHandler.spawnCustomParticle(passiveParticle, 35); } } else if (rand.nextInt(Math.max(1, 10 - particleRate)) == 0) { @@ -193,7 +227,14 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I spawnY = y + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); spawnZ = z + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle( - worldObj, spawnX, spawnY, spawnZ, targetX, targetY, targetZ, false); + worldObj, + spawnX, + spawnY, + spawnZ, + targetX, + targetY, + targetZ, + false); ParticleHandler.spawnCustomParticle(passiveParticle, 35); } } @@ -207,7 +248,14 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I spawnZ = zCoord + 0.5; if (rand.nextFloat() < 0.05F) { Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle( - worldObj, spawnX, spawnY, spawnZ, targetX, targetY, targetZ, true); + worldObj, + spawnX, + spawnY, + spawnZ, + targetX, + targetY, + targetZ, + true); ParticleHandler.spawnCustomParticle(passiveParticle, 35); } @@ -218,7 +266,14 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I targetY = y + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); targetZ = z + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle( - worldObj, spawnX, spawnY, spawnZ, targetX, targetY, targetZ, false); + worldObj, + spawnX, + spawnY, + spawnZ, + targetX, + targetY, + targetZ, + false); ParticleHandler.spawnCustomParticle(passiveParticle, 35); } } else if (rand.nextInt(Math.max(1, 10 - particleRate)) == 0) { @@ -226,7 +281,14 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I targetY = y + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); targetZ = z + 0.5 - disMod + (rand.nextFloat() * (disMod * 2)); Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle( - worldObj, spawnX, spawnY, spawnZ, targetX, targetY, targetZ, false); + worldObj, + spawnX, + spawnY, + spawnZ, + targetX, + targetY, + targetZ, + false); ParticleHandler.spawnCustomParticle(passiveParticle, 35); } } @@ -328,18 +390,16 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I } private void detectAndSendChanges() { - if (lastTickActive != active) - lastTickActive = (Boolean) sendObjectToClient( - References.BOOLEAN_ID, - 0, - active, - new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 256)); - if (lastTickReciveEnergy != reciveEnergy) - lastTickReciveEnergy = (Boolean) sendObjectToClient( - References.BOOLEAN_ID, - 1, - reciveEnergy, - new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 256)); + if (lastTickActive != active) lastTickActive = (Boolean) sendObjectToClient( + References.BOOLEAN_ID, + 0, + active, + new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 256)); + if (lastTickReciveEnergy != reciveEnergy) lastTickReciveEnergy = (Boolean) sendObjectToClient( + References.BOOLEAN_ID, + 1, + reciveEnergy, + new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 256)); if (lastTickParticleRate != particleRate) lastTickParticleRate = (Byte) sendObjectToClient(References.BYTE_ID, 2, particleRate); } @@ -387,13 +447,13 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I @Override public String[] getMethodNames() { - return new String[] {"getEnergyStored", "getMaxEnergyStored"}; + return new String[] { "getEnergyStored", "getMaxEnergyStored" }; } @Override public Object[] callMethod(String method, Object... args) { - if (method.equals("getEnergyStored")) return new Object[] {getExtendedStorage()}; - else if (method.equals("getMaxEnergyStored")) return new Object[] {getExtendedCapacity()}; + if (method.equals("getEnergyStored")) return new Object[] { getExtendedStorage() }; + else if (method.equals("getMaxEnergyStored")) return new Object[] { getExtendedCapacity() }; return new Object[0]; } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyStorageCore.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyStorageCore.java index 282823a9..14812a1c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyStorageCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyStorageCore.java @@ -1,5 +1,12 @@ package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.util.AxisAlignedBB; + import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation; import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; @@ -8,12 +15,6 @@ import com.brandon3055.draconicevolution.common.tileentities.TileObjectSync; import com.brandon3055.draconicevolution.common.tileentities.TileParticleGenerator; import com.brandon3055.draconicevolution.common.utills.LogHelper; import cpw.mods.fml.common.network.NetworkRegistry; -import net.minecraft.init.Blocks; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; -import net.minecraft.util.AxisAlignedBB; /** * Created by Brandon on 25/07/2014. @@ -244,7 +245,8 @@ public class TileEnergyStorageCore extends TileObjectSync { || !testForOrActivateDraconium(xCoord, yCoord + 1, zCoord, setBlocks, activate) || !testForOrActivateDraconium(xCoord, yCoord - 1, zCoord, setBlocks, activate) || !testForOrActivateDraconium(xCoord, yCoord, zCoord + 1, setBlocks, activate) - || !testForOrActivateDraconium(xCoord, yCoord, zCoord - 1, setBlocks, activate)) return false; + || !testForOrActivateDraconium(xCoord, yCoord, zCoord - 1, setBlocks, activate)) + return false; if (!isReplacable(xCoord + 1, yCoord + 1, zCoord, setBlocks) || !isReplacable(xCoord, yCoord + 1, zCoord + 1, setBlocks) || !isReplacable(xCoord - 1, yCoord + 1, zCoord, setBlocks) @@ -256,7 +258,8 @@ public class TileEnergyStorageCore extends TileObjectSync { || !isReplacable(xCoord + 1, yCoord, zCoord + 1, setBlocks) || !isReplacable(xCoord - 1, yCoord, zCoord - 1, setBlocks) || !isReplacable(xCoord + 1, yCoord, zCoord - 1, setBlocks) - || !isReplacable(xCoord - 1, yCoord, zCoord + 1, setBlocks)) return false; + || !isReplacable(xCoord - 1, yCoord, zCoord + 1, setBlocks)) + return false; if (!isReplacable(xCoord + 1, yCoord + 1, zCoord + 1, setBlocks) || !isReplacable(xCoord - 1, yCoord + 1, zCoord - 1, setBlocks) || !isReplacable(xCoord + 1, yCoord + 1, zCoord - 1, setBlocks) @@ -264,7 +267,8 @@ public class TileEnergyStorageCore extends TileObjectSync { || !isReplacable(xCoord + 1, yCoord - 1, zCoord + 1, setBlocks) || !isReplacable(xCoord - 1, yCoord - 1, zCoord - 1, setBlocks) || !isReplacable(xCoord + 1, yCoord - 1, zCoord - 1, setBlocks) - || !isReplacable(xCoord - 1, yCoord - 1, zCoord + 1, setBlocks)) return false; + || !isReplacable(xCoord - 1, yCoord - 1, zCoord + 1, setBlocks)) + return false; break; case 2: if (!testOrActivateRect(1, 1, 1, "draconiumBlock", setBlocks, activate)) return false; @@ -308,10 +312,12 @@ public class TileEnergyStorageCore extends TileObjectSync { if (!(x == xCoord && y == yCoord && z == zCoord) && !isReplacable(x, y, z, set)) return false; } else if (block.equals("redstone")) { if (!(x == xCoord && y == yCoord && z == zCoord) - && !testForOrActivateRedstone(x, y, z, set, activate)) return false; + && !testForOrActivateRedstone(x, y, z, set, activate)) + return false; } else if (block.equals("draconiumBlock")) { if (!(x == xCoord && y == yCoord && z == zCoord) - && !testForOrActivateDraconium(x, y, z, set, activate)) return false; + && !testForOrActivateDraconium(x, y, z, set, activate)) + return false; } else if (!block.equals("draconiumBlock") && !block.equals("redstone") && !block.equals("air")) { LogHelper.error("Invalid String In Multiblock Structure Code!!!"); return false; @@ -329,13 +335,16 @@ public class TileEnergyStorageCore extends TileObjectSync { if (y == yCoord - size || y == yCoord + size || z == zCoord - size || z == zCoord + size) { if (block.equals("air")) { if (!(xCoord + dist == xCoord && y == yCoord && z == zCoord) - && !isReplacable(xCoord + dist, y, z, set)) return false; + && !isReplacable(xCoord + dist, y, z, set)) + return false; } else if (block.equals("redstone")) { if (!(xCoord + dist == xCoord && y == yCoord && z == zCoord) - && !testForOrActivateRedstone(xCoord + dist, y, z, set, activate)) return false; + && !testForOrActivateRedstone(xCoord + dist, y, z, set, activate)) + return false; } else if (block.equals("draconiumBlock")) { if (!(xCoord + dist == xCoord && y == yCoord && z == zCoord) - && !testForOrActivateDraconium(xCoord + dist, y, z, set, activate)) return false; + && !testForOrActivateDraconium(xCoord + dist, y, z, set, activate)) + return false; } else if (!block.equals("draconiumBlock") && !block.equals("redstone") && !block.equals("air")) { LogHelper.error("Invalid String In Multiblock Structure Code!!!"); return false; @@ -349,13 +358,16 @@ public class TileEnergyStorageCore extends TileObjectSync { if (y == yCoord - size || y == yCoord + size || z == zCoord - size || z == zCoord + size) { if (block.equals("air")) { if (!(xCoord - dist == xCoord && y == yCoord && z == zCoord) - && !isReplacable(xCoord - dist, y, z, set)) return false; + && !isReplacable(xCoord - dist, y, z, set)) + return false; } else if (block.equals("redstone")) { if (!(xCoord - dist == xCoord && y == yCoord && z == zCoord) - && !testForOrActivateRedstone(xCoord - dist, y, z, set, activate)) return false; + && !testForOrActivateRedstone(xCoord - dist, y, z, set, activate)) + return false; } else if (block.equals("draconiumBlock")) { if (!(xCoord - dist == xCoord && y == yCoord && z == zCoord) - && !testForOrActivateDraconium(xCoord - dist, y, z, set, activate)) return false; + && !testForOrActivateDraconium(xCoord - dist, y, z, set, activate)) + return false; } else if (!block.equals("draconiumBlock") && !block.equals("redstone") && !block.equals("air")) { LogHelper.error("Invalid String In Multiblock Structure Code!!!"); return false; @@ -370,13 +382,16 @@ public class TileEnergyStorageCore extends TileObjectSync { if (x == xCoord - size || x == xCoord + size || z == zCoord - size || z == zCoord + size) { if (block.equals("air")) { if (!(x == xCoord && yCoord + dist == yCoord && z == zCoord) - && !isReplacable(x, yCoord + dist, z, set)) return false; + && !isReplacable(x, yCoord + dist, z, set)) + return false; } else if (block.equals("redstone")) { if (!(x == xCoord && yCoord + dist == yCoord && z == zCoord) - && !testForOrActivateRedstone(x, yCoord + dist, z, set, activate)) return false; + && !testForOrActivateRedstone(x, yCoord + dist, z, set, activate)) + return false; } else if (block.equals("draconiumBlock")) { if (!(x == xCoord && yCoord + dist == yCoord && z == zCoord) - && !testForOrActivateDraconium(x, yCoord + dist, z, set, activate)) return false; + && !testForOrActivateDraconium(x, yCoord + dist, z, set, activate)) + return false; } else if (!block.equals("draconiumBlock") && !block.equals("redstone") && !block.equals("air")) { LogHelper.error("Invalid String In Multiblock Structure Code!!!"); return false; @@ -390,13 +405,16 @@ public class TileEnergyStorageCore extends TileObjectSync { if (x == xCoord - size || x == xCoord + size || z == zCoord - size || z == zCoord + size) { if (block.equals("air")) { if (!(x == xCoord && yCoord - dist == yCoord && z == zCoord) - && !isReplacable(x, yCoord - dist, z, set)) return false; + && !isReplacable(x, yCoord - dist, z, set)) + return false; } else if (block.equals("redstone")) { if (!(x == xCoord && yCoord - dist == yCoord && z == zCoord) - && !testForOrActivateRedstone(x, yCoord - dist, z, set, activate)) return false; + && !testForOrActivateRedstone(x, yCoord - dist, z, set, activate)) + return false; } else if (block.equals("draconiumBlock")) { if (!(x == xCoord && yCoord - dist == yCoord && z == zCoord) - && !testForOrActivateDraconium(x, yCoord - dist, z, set, activate)) return false; + && !testForOrActivateDraconium(x, yCoord - dist, z, set, activate)) + return false; } else if (!block.equals("draconiumBlock") && !block.equals("redstone") && !block.equals("air")) { LogHelper.error("Invalid String In Multiblock Structure Code!!!"); return false; @@ -411,13 +429,16 @@ public class TileEnergyStorageCore extends TileObjectSync { if (y == yCoord - size || y == yCoord + size || x == xCoord - size || x == xCoord + size) { if (block.equals("air")) { if (!(x == xCoord && y == yCoord && zCoord + dist == zCoord) - && !isReplacable(x, y, zCoord + dist, set)) return false; + && !isReplacable(x, y, zCoord + dist, set)) + return false; } else if (block.equals("redstone")) { if (!(x == xCoord && y == yCoord && zCoord + dist == zCoord) - && !testForOrActivateRedstone(x, y, zCoord + dist, set, activate)) return false; + && !testForOrActivateRedstone(x, y, zCoord + dist, set, activate)) + return false; } else if (block.equals("draconiumBlock")) { if (!(x == xCoord && y == yCoord && zCoord + dist == zCoord) - && !testForOrActivateDraconium(x, y, zCoord + dist, set, activate)) return false; + && !testForOrActivateDraconium(x, y, zCoord + dist, set, activate)) + return false; } else if (!block.equals("draconiumBlock") && !block.equals("redstone") && !block.equals("air")) { LogHelper.error("Invalid String In Multiblock Structure Code!!!"); return false; @@ -431,13 +452,16 @@ public class TileEnergyStorageCore extends TileObjectSync { if (y == yCoord - size || y == yCoord + size || x == xCoord - size || x == xCoord + size) { if (block.equals("air")) { if (!(x == xCoord && y == yCoord && zCoord - dist == zCoord) - && !isReplacable(x, y, zCoord - dist, set)) return false; + && !isReplacable(x, y, zCoord - dist, set)) + return false; } else if (block.equals("redstone")) { if (!(x == xCoord && y == yCoord && zCoord - dist == zCoord) - && !testForOrActivateRedstone(x, y, zCoord - dist, set, activate)) return false; + && !testForOrActivateRedstone(x, y, zCoord - dist, set, activate)) + return false; } else if (block.equals("draconiumBlock")) { if (!(x == xCoord && y == yCoord && zCoord - dist == zCoord) - && !testForOrActivateDraconium(x, y, zCoord - dist, set, activate)) return false; + && !testForOrActivateDraconium(x, y, zCoord - dist, set, activate)) + return false; } else if (!block.equals("draconiumBlock") && !block.equals("redstone") && !block.equals("air")) { LogHelper.error("Invalid String In Multiblock Structure Code!!!"); return false; @@ -455,13 +479,16 @@ public class TileEnergyStorageCore extends TileObjectSync { if (block.equals("air")) { if (!(xCoord + dist == xCoord && y == yCoord && z == zCoord) - && !isReplacable(xCoord + dist, y, z, set)) return false; + && !isReplacable(xCoord + dist, y, z, set)) + return false; } else if (block.equals("redstone")) { if (!(xCoord + dist == xCoord && y == yCoord && z == zCoord) - && !testForOrActivateRedstone(xCoord + dist, y, z, set, activate)) return false; + && !testForOrActivateRedstone(xCoord + dist, y, z, set, activate)) + return false; } else if (block.equals("draconiumBlock")) { if (!(xCoord + dist == xCoord && y == yCoord && z == zCoord) - && !testForOrActivateDraconium(xCoord + dist, y, z, set, activate)) return false; + && !testForOrActivateDraconium(xCoord + dist, y, z, set, activate)) + return false; } else if (!block.equals("draconiumBlock") && !block.equals("redstone") && !block.equals("air")) { LogHelper.error("Invalid String In Multiblock Structure Code!!!"); return false; @@ -473,13 +500,16 @@ public class TileEnergyStorageCore extends TileObjectSync { if (block.equals("air")) { if (!(xCoord - dist == xCoord && y == yCoord && z == zCoord) - && !isReplacable(xCoord - dist, y, z, set)) return false; + && !isReplacable(xCoord - dist, y, z, set)) + return false; } else if (block.equals("redstone")) { if (!(xCoord - dist == xCoord && y == yCoord && z == zCoord) - && !testForOrActivateRedstone(xCoord - dist, y, z, set, activate)) return false; + && !testForOrActivateRedstone(xCoord - dist, y, z, set, activate)) + return false; } else if (block.equals("draconiumBlock")) { if (!(xCoord - dist == xCoord && y == yCoord && z == zCoord) - && !testForOrActivateDraconium(xCoord - dist, y, z, set, activate)) return false; + && !testForOrActivateDraconium(xCoord - dist, y, z, set, activate)) + return false; } else if (!block.equals("draconiumBlock") && !block.equals("redstone") && !block.equals("air")) { LogHelper.error("Invalid String In Multiblock Structure Code!!!"); return false; @@ -492,13 +522,16 @@ public class TileEnergyStorageCore extends TileObjectSync { if (block.equals("air")) { if (!(x == xCoord && yCoord + dist == yCoord && z == zCoord) - && !isReplacable(x, yCoord + dist, z, set)) return false; + && !isReplacable(x, yCoord + dist, z, set)) + return false; } else if (block.equals("redstone")) { if (!(x == xCoord && yCoord + dist == yCoord && z == zCoord) - && !testForOrActivateRedstone(x, yCoord + dist, z, set, activate)) return false; + && !testForOrActivateRedstone(x, yCoord + dist, z, set, activate)) + return false; } else if (block.equals("draconiumBlock")) { if (!(x == xCoord && yCoord + dist == yCoord && z == zCoord) - && !testForOrActivateDraconium(x, yCoord + dist, z, set, activate)) return false; + && !testForOrActivateDraconium(x, yCoord + dist, z, set, activate)) + return false; } else if (!block.equals("draconiumBlock") && !block.equals("redstone") && !block.equals("air")) { LogHelper.error("Invalid String In Multiblock Structure Code!!!"); return false; @@ -510,13 +543,16 @@ public class TileEnergyStorageCore extends TileObjectSync { if (block.equals("air")) { if (!(x == xCoord && yCoord - dist == yCoord && z == zCoord) - && !isReplacable(x, yCoord - dist, z, set)) return false; + && !isReplacable(x, yCoord - dist, z, set)) + return false; } else if (block.equals("redstone")) { if (!(x == xCoord && yCoord - dist == yCoord && z == zCoord) - && !testForOrActivateRedstone(x, yCoord - dist, z, set, activate)) return false; + && !testForOrActivateRedstone(x, yCoord - dist, z, set, activate)) + return false; } else if (block.equals("draconiumBlock")) { if (!(x == xCoord && yCoord - dist == yCoord && z == zCoord) - && !testForOrActivateDraconium(x, yCoord - dist, z, set, activate)) return false; + && !testForOrActivateDraconium(x, yCoord - dist, z, set, activate)) + return false; } else if (!block.equals("draconiumBlock") && !block.equals("redstone") && !block.equals("air")) { LogHelper.error("Invalid String In Multiblock Structure Code!!!"); return false; @@ -529,13 +565,16 @@ public class TileEnergyStorageCore extends TileObjectSync { if (block.equals("air")) { if (!(x == xCoord && y == yCoord && zCoord + dist == zCoord) - && !isReplacable(x, y, zCoord + dist, set)) return false; + && !isReplacable(x, y, zCoord + dist, set)) + return false; } else if (block.equals("redstone")) { if (!(x == xCoord && y == yCoord && zCoord + dist == zCoord) - && !testForOrActivateRedstone(x, y, zCoord + dist, set, activate)) return false; + && !testForOrActivateRedstone(x, y, zCoord + dist, set, activate)) + return false; } else if (block.equals("draconiumBlock")) { if (!(x == xCoord && y == yCoord && zCoord + dist == zCoord) - && !testForOrActivateDraconium(x, y, zCoord + dist, set, activate)) return false; + && !testForOrActivateDraconium(x, y, zCoord + dist, set, activate)) + return false; } else if (!block.equals("draconiumBlock") && !block.equals("redstone") && !block.equals("air")) { LogHelper.error("Invalid String In Multiblock Structure Code!!!"); return false; @@ -547,13 +586,16 @@ public class TileEnergyStorageCore extends TileObjectSync { if (block.equals("air")) { if (!(x == xCoord && y == yCoord && zCoord - dist == zCoord) - && !isReplacable(x, y, zCoord - dist, set)) return false; + && !isReplacable(x, y, zCoord - dist, set)) + return false; } else if (block.equals("redstone")) { if (!(x == xCoord && y == yCoord && zCoord - dist == zCoord) - && !testForOrActivateRedstone(x, y, zCoord - dist, set, activate)) return false; + && !testForOrActivateRedstone(x, y, zCoord - dist, set, activate)) + return false; } else if (block.equals("draconiumBlock")) { if (!(x == xCoord && y == yCoord && zCoord - dist == zCoord) - && !testForOrActivateDraconium(x, y, zCoord - dist, set, activate)) return false; + && !testForOrActivateDraconium(x, y, zCoord - dist, set, activate)) + return false; } else if (!block.equals("draconiumBlock") && !block.equals("redstone") && !block.equals("air")) { LogHelper.error("Invalid String In Multiblock Structure Code!!!"); return false; @@ -575,12 +617,11 @@ public class TileEnergyStorageCore extends TileObjectSync { BalanceConfigHandler.energyStorageStructureOuterBlockMetadata, 3); return true; - } else - return (worldObj.getBlock(x, y, z) == BalanceConfigHandler.energyStorageStructureOuterBlock - && worldObj.getBlockMetadata(x, y, z) - == BalanceConfigHandler.energyStorageStructureOuterBlockMetadata) - || (worldObj.getBlock(x, y, z) == ModBlocks.invisibleMultiblock - && worldObj.getBlockMetadata(x, y, z) == 0); + } else return (worldObj.getBlock(x, y, z) == BalanceConfigHandler.energyStorageStructureOuterBlock + && worldObj.getBlockMetadata(x, y, z) + == BalanceConfigHandler.energyStorageStructureOuterBlockMetadata) + || (worldObj.getBlock(x, y, z) == ModBlocks.invisibleMultiblock + && worldObj.getBlockMetadata(x, y, z) == 0); } else { return activateDraconium(x, y, z); } @@ -599,8 +640,8 @@ public class TileEnergyStorageCore extends TileObjectSync { return true; } else { return (worldObj.getBlock(x, y, z) == BalanceConfigHandler.energyStorageStructureBlock - && worldObj.getBlockMetadata(x, y, z) - == BalanceConfigHandler.energyStorageStructureBlockMetadata) + && worldObj.getBlockMetadata(x, y, z) + == BalanceConfigHandler.energyStorageStructureBlockMetadata) || (worldObj.getBlock(x, y, z) == ModBlocks.invisibleMultiblock && worldObj.getBlockMetadata(x, y, z) == 1); } @@ -613,9 +654,9 @@ public class TileEnergyStorageCore extends TileObjectSync { if (testForOrActivateDraconium(x, y, z, false, false)) { worldObj.setBlock(x, y, z, ModBlocks.invisibleMultiblock, 0, 2); TileInvisibleMultiblock tile = (worldObj.getTileEntity(x, y, z) != null - && worldObj.getTileEntity(x, y, z) instanceof TileInvisibleMultiblock) - ? (TileInvisibleMultiblock) worldObj.getTileEntity(x, y, z) - : null; + && worldObj.getTileEntity(x, y, z) instanceof TileInvisibleMultiblock) + ? (TileInvisibleMultiblock) worldObj.getTileEntity(x, y, z) + : null; if (tile != null) { tile.master = new TileLocation(xCoord, yCoord, zCoord); } @@ -629,9 +670,9 @@ public class TileEnergyStorageCore extends TileObjectSync { if (testForOrActivateRedstone(x, y, z, false, false)) { worldObj.setBlock(x, y, z, ModBlocks.invisibleMultiblock, 1, 2); TileInvisibleMultiblock tile = (worldObj.getTileEntity(x, y, z) != null - && worldObj.getTileEntity(x, y, z) instanceof TileInvisibleMultiblock) - ? (TileInvisibleMultiblock) worldObj.getTileEntity(x, y, z) - : null; + && worldObj.getTileEntity(x, y, z) instanceof TileInvisibleMultiblock) + ? (TileInvisibleMultiblock) worldObj.getTileEntity(x, y, z) + : null; if (tile != null) { tile.master = new TileLocation(xCoord, yCoord, zCoord); } @@ -658,19 +699,18 @@ public class TileEnergyStorageCore extends TileObjectSync { LogHelper.error("activateStabilizers stabalizers[" + i + "] == null!!!"); return; } - TileParticleGenerator tile = (worldObj.getTileEntity( + TileParticleGenerator tile = (worldObj + .getTileEntity(stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) + != null + && worldObj.getTileEntity( + stabilizers[i].getXCoord(), + stabilizers[i].getYCoord(), + stabilizers[i].getZCoord()) instanceof TileParticleGenerator) + ? (TileParticleGenerator) worldObj.getTileEntity( stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) - != null - && worldObj.getTileEntity( - stabilizers[i].getXCoord(), - stabilizers[i].getYCoord(), - stabilizers[i].getZCoord()) - instanceof TileParticleGenerator) - ? (TileParticleGenerator) worldObj.getTileEntity( - stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) - : null; + : null; if (tile == null) { LogHelper.error("Missing Tile Entity (Particle Generator)"); return; @@ -678,7 +718,11 @@ public class TileEnergyStorageCore extends TileObjectSync { tile.stabalizerMode = true; tile.setMaster(new TileLocation(xCoord, yCoord, zCoord)); worldObj.setBlockMetadataWithNotify( - stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord(), 1, 2); + stabilizers[i].getXCoord(), + stabilizers[i].getYCoord(), + stabilizers[i].getZCoord(), + 1, + 2); } initializeCapacity(); } @@ -718,24 +762,28 @@ public class TileEnergyStorageCore extends TileObjectSync { LogHelper.error("activateStabilizers stabalizers[" + i + "] == null!!!"); } else { TileParticleGenerator tile = (worldObj.getTileEntity( + stabilizers[i].getXCoord(), + stabilizers[i].getYCoord(), + stabilizers[i].getZCoord()) != null + && worldObj.getTileEntity( + stabilizers[i].getXCoord(), + stabilizers[i].getYCoord(), + stabilizers[i].getZCoord()) instanceof TileParticleGenerator) + ? (TileParticleGenerator) worldObj.getTileEntity( stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) - != null - && worldObj.getTileEntity( - stabilizers[i].getXCoord(), - stabilizers[i].getYCoord(), - stabilizers[i].getZCoord()) - instanceof TileParticleGenerator) - ? (TileParticleGenerator) worldObj.getTileEntity( - stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) - : null; + : null; if (tile == null) { // LogHelper.error("Missing Tile Entity (Particle Generator)"); } else { tile.stabalizerMode = false; worldObj.setBlockMetadataWithNotify( - stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord(), 0, 2); + stabilizers[i].getXCoord(), + stabilizers[i].getYCoord(), + stabilizers[i].getZCoord(), + 0, + 2); } } } @@ -747,27 +795,27 @@ public class TileEnergyStorageCore extends TileObjectSync { LogHelper.error("activateStabilizers stabalizers[" + i + "] == null!!!"); return false; } - TileParticleGenerator tile = (worldObj.getTileEntity( + TileParticleGenerator tile = (worldObj + .getTileEntity(stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) + != null + && worldObj.getTileEntity( + stabilizers[i].getXCoord(), + stabilizers[i].getYCoord(), + stabilizers[i].getZCoord()) instanceof TileParticleGenerator) + ? (TileParticleGenerator) worldObj.getTileEntity( stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) - != null - && worldObj.getTileEntity( - stabilizers[i].getXCoord(), - stabilizers[i].getYCoord(), - stabilizers[i].getZCoord()) - instanceof TileParticleGenerator) - ? (TileParticleGenerator) worldObj.getTileEntity( - stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) - : null; + : null; if (tile == null) { // LogHelper.error("Missing Tile Entity (Particle Generator)"); return false; } - if (!tile.stabalizerMode - || worldObj.getBlockMetadata( - stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) - != 1) return false; + if (!tile.stabalizerMode || worldObj.getBlockMetadata( + stabilizers[i].getXCoord(), + stabilizers[i].getYCoord(), + stabilizers[i].getZCoord()) != 1) + return false; } return true; } @@ -775,23 +823,22 @@ public class TileEnergyStorageCore extends TileObjectSync { private boolean checkStabilizers() { for (int i = 0; i < stabilizers.length; i++) { if (stabilizers[i] == null) return false; - TileParticleGenerator gen = (worldObj.getTileEntity( + TileParticleGenerator gen = (worldObj + .getTileEntity(stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) + != null + && worldObj.getTileEntity( + stabilizers[i].getXCoord(), + stabilizers[i].getYCoord(), + stabilizers[i].getZCoord()) instanceof TileParticleGenerator) + ? (TileParticleGenerator) worldObj.getTileEntity( stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) - != null - && worldObj.getTileEntity( - stabilizers[i].getXCoord(), - stabilizers[i].getYCoord(), - stabilizers[i].getZCoord()) - instanceof TileParticleGenerator) - ? (TileParticleGenerator) worldObj.getTileEntity( - stabilizers[i].getXCoord(), stabilizers[i].getYCoord(), stabilizers[i].getZCoord()) - : null; + : null; if (gen == null || !gen.stabalizerMode) return false; - if (gen.getMaster().xCoord != xCoord - || gen.getMaster().yCoord != yCoord - || gen.getMaster().zCoord != zCoord) return false; + if (gen.getMaster().xCoord != xCoord || gen.getMaster().yCoord != yCoord + || gen.getMaster().zCoord != zCoord) + return false; } return true; } @@ -878,12 +925,11 @@ public class TileEnergyStorageCore extends TileObjectSync { } private void detectAndRendChanges() { - if (lastTickCapacity != energy) - lastTickCapacity = (Long) sendObjectToClient( - References.LONG_ID, - 0, - energy, - new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 20)); + if (lastTickCapacity != energy) lastTickCapacity = (Long) sendObjectToClient( + References.LONG_ID, + 0, + energy, + new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 20)); } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileInvisibleMultiblock.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileInvisibleMultiblock.java index 346cc119..aa8b6245 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileInvisibleMultiblock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileInvisibleMultiblock.java @@ -1,18 +1,20 @@ package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles; -import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation; -import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; -import com.brandon3055.draconicevolution.common.utills.LogHelper; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; +import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation; +import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; +import com.brandon3055.draconicevolution.common.utills.LogHelper; + /** * Created by Brandon on 26/07/2014. */ public class TileInvisibleMultiblock extends TileEntity { + public TileLocation master = new TileLocation(); @Override @@ -21,13 +23,15 @@ public class TileInvisibleMultiblock extends TileEntity { } public boolean isMasterOnline() { - TileEnergyStorageCore tile = - (worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) != null - && worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) - instanceof TileEnergyStorageCore) - ? (TileEnergyStorageCore) - worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) - : null; + TileEnergyStorageCore tile = (worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) + != null + && worldObj.getTileEntity( + master.getXCoord(), + master.getYCoord(), + master.getZCoord()) instanceof TileEnergyStorageCore) + ? (TileEnergyStorageCore) worldObj + .getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) + : null; if (tile == null) { return false; } @@ -36,13 +40,15 @@ public class TileInvisibleMultiblock extends TileEntity { public TileEnergyStorageCore getMaster() { if (master == null) return null; - TileEnergyStorageCore tile = - (worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) != null - && worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) - instanceof TileEnergyStorageCore) - ? (TileEnergyStorageCore) - worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) - : null; + TileEnergyStorageCore tile = (worldObj.getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) + != null + && worldObj.getTileEntity( + master.getXCoord(), + master.getYCoord(), + master.getZCoord()) instanceof TileEnergyStorageCore) + ? (TileEnergyStorageCore) worldObj + .getTileEntity(master.getXCoord(), master.getYCoord(), master.getZCoord()) + : null; return tile; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TilePortalBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TilePortalBlock.java index 034a17e1..31d023d0 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TilePortalBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TilePortalBlock.java @@ -1,13 +1,15 @@ package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; + import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.render.particle.Particles; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; /** * Created by Brandon on 24/5/2015. @@ -43,17 +45,16 @@ public class TilePortalBlock extends TileEntity { double rO1 = -0.1 + worldObj.rand.nextDouble() * 0.2; double rO2 = -0.1 + worldObj.rand.nextDouble() * 0.2; - if (blockMetadata == 1 && RenderManager.renderPosZ < zCoord + 0.5) - DraconicEvolution.proxy.spawnParticle( - new Particles.PortalParticle( - worldObj, - xCoord + rD1, - yCoord + rD2, - zCoord, - xCoord + rD1 + rO1, - yCoord + rD2 + rO2, - zCoord + 0.75), - 256); + if (blockMetadata == 1 && RenderManager.renderPosZ < zCoord + 0.5) DraconicEvolution.proxy.spawnParticle( + new Particles.PortalParticle( + worldObj, + xCoord + rD1, + yCoord + rD2, + zCoord, + xCoord + rD1 + rO1, + yCoord + rD2 + rO2, + zCoord + 0.75), + 256); else if (blockMetadata == 1 && RenderManager.renderPosZ > zCoord + 0.5) DraconicEvolution.proxy.spawnParticle( new Particles.PortalParticle( diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/ReactorExplosion.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/ReactorExplosion.java index f07ad318..b16a22a4 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/ReactorExplosion.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/ReactorExplosion.java @@ -1,22 +1,21 @@ package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor; +import java.util.Random; + +import net.minecraft.util.DamageSource; +import net.minecraft.world.World; + import com.brandon3055.brandonscore.common.handlers.IProcess; import com.brandon3055.brandonscore.common.handlers.ProcessHandler; import com.brandon3055.brandonscore.common.utills.Utills; -import java.util.Random; -import net.minecraft.util.DamageSource; -import net.minecraft.world.World; /** * Created by brandon3055 on 12/8/2015. */ public class ReactorExplosion implements IProcess { - public static DamageSource fusionExplosion = new DamageSource("damage.de.fusionExplode") - .setExplosion() - .setDamageBypassesArmor() - .setDamageIsAbsolute() - .setDamageAllowedInCreativeMode(); + public static DamageSource fusionExplosion = new DamageSource("damage.de.fusionExplode").setExplosion() + .setDamageBypassesArmor().setDamageIsAbsolute().setDamageAllowedInCreativeMode(); private World worldObj; private int xCoord; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/ReactorExplosionTrace.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/ReactorExplosionTrace.java index b9a7e40e..94d1ed85 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/ReactorExplosionTrace.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/ReactorExplosionTrace.java @@ -1,8 +1,8 @@ package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor; -import com.brandon3055.brandonscore.common.handlers.IProcess; import java.util.List; import java.util.Random; + import net.minecraft.block.Block; import net.minecraft.block.BlockLiquid; import net.minecraft.entity.Entity; @@ -10,6 +10,8 @@ import net.minecraft.init.Blocks; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; +import com.brandon3055.brandonscore.common.handlers.IProcess; + /** * Created by brandon3055 on 12/8/2015. */ @@ -40,7 +42,8 @@ public class ReactorExplosionTrace implements IProcess { Block block = worldObj.getBlock(xCoord, y, zCoord); List entities = worldObj.getEntitiesWithinAABB( - Entity.class, AxisAlignedBB.getBoundingBox(xCoord, y, zCoord, xCoord + 1, y + 1, zCoord + 1)); + Entity.class, + AxisAlignedBB.getBoundingBox(xCoord, y, zCoord, xCoord + 1, y + 1, zCoord + 1)); for (Entity entity : entities) entity.attackEntityFrom(ReactorExplosion.fusionExplosion, power * 100); energy -= block instanceof BlockLiquid ? 10 : block.getExplosionResistance(null); @@ -67,7 +70,8 @@ public class ReactorExplosionTrace implements IProcess { Block block = worldObj.getBlock(xCoord, y, zCoord); List entities = worldObj.getEntitiesWithinAABB( - Entity.class, AxisAlignedBB.getBoundingBox(xCoord, y, zCoord, xCoord + 1, y + 1, zCoord + 1)); + Entity.class, + AxisAlignedBB.getBoundingBox(xCoord, y, zCoord, xCoord + 1, y + 1, zCoord + 1)); for (Entity entity : entities) entity.attackEntityFrom(ReactorExplosion.fusionExplosion, power * 100); energy -= block instanceof BlockLiquid ? 10 : block.getExplosionResistance(null); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorCore.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorCore.java index f200039f..06f0db1f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorCore.java @@ -1,5 +1,18 @@ package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraftforge.common.util.ForgeDirection; + import com.brandon3055.brandonscore.BrandonsCore; import com.brandon3055.brandonscore.common.handlers.ProcessHandler; import com.brandon3055.brandonscore.common.utills.Utills; @@ -12,26 +25,17 @@ import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelp import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.tileentities.TileObjectSync; + import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraftforge.common.util.ForgeDirection; /** * Created by Brandon on 16/6/2015. */ public class TileReactorCore extends TileObjectSync { + public static final int MAX_SLAVE_RANGE = 10; public static final int STATE_OFFLINE = 0; public static final int STATE_START = 1; @@ -50,8 +54,8 @@ public class TileReactorCore extends TileObjectSync { // Key operational figures public int reactorFuel = 0; public int convertedFuel = 0; // The amount of fuel that has converted - public double conversionUnit = - 0; // used to smooth out the conversion between int and floating point. When >= 1 minus one and convert one + public double conversionUnit = 0; // used to smooth out the conversion between int and floating point. When >= 1 + // minus one and convert one // int worth of fuel public double reactionTemperature = 20; @@ -69,18 +73,18 @@ public class TileReactorCore extends TileObjectSync { // ####################### // TODO DONT FORGET TO ACTUALLY FINISH ALL THESE THINGS!!!! - // Check //-Bounding box - // Check //-Custom player collision - // Check //-Finish stabilizer place and break mechanics - // Check //-Have the GUI tell you if the structure is invalid - // Check //-Config + // Check //-Bounding box + // Check //-Custom player collision + // Check //-Finish stabilizer place and break mechanics + // Check //-Have the GUI tell you if the structure is invalid + // Check //-Config // TODO things for later // -GUI info (maby speed up gui sync via the container) // -GUI warning red bars // -Maby get around to setting the angle of the stabiliser elements - // Check //-SOUND!!!!! - // Check //-CC Integration - // Check //-Redstone + // Check //-SOUND!!!!! + // Check //-CC Integration + // Check //-Redstone // -Add reactor and gates to tablet public List stabilizerLocations = new ArrayList(); @@ -126,8 +130,8 @@ public class TileReactorCore extends TileObjectSync { private void checkPlayerCollision() { EntityPlayer player = BrandonsCore.proxy.getClientPlayer(); - double distance = - Utills.getDistanceAtoB(player.posX, player.posY, player.posZ, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5); + double distance = Utills + .getDistanceAtoB(player.posX, player.posY, player.posZ, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5); if (distance < (getCoreDiameter() / 2) + 0.5) { double dMod = 1D - (distance / Math.max(0.1, (getCoreDiameter() / 2) + 0.5)); double offsetX = player.posX - xCoord + 0.5; @@ -172,9 +176,8 @@ public class TileReactorCore extends TileObjectSync { double temp = ((reactionTemperature) / maxReactTemperature) * 50D; // The conversion level. Ranges from -0.3 to 1.0 double conversion = (((double) convertedFuel + conversionUnit) - / ((double) (convertedFuel + reactorFuel) - conversionUnit) - * 1.3) - - 0.3D; + / ((double) (convertedFuel + reactorFuel) - conversionUnit) + * 1.3) - 0.3D; // Temperature Calculation double tempOffset = 444.7; // Adjusts where the temp falls to at 100% saturation @@ -220,21 +223,31 @@ public class TileReactorCore extends TileObjectSync { // -field drain // Field Drain Calculation - fieldDrain = (int) Math.min(tempDrainFactor * (1D - saturation) * (baseMaxRFt / 10.923556), (double) - Integer.MAX_VALUE); // <(baseMaxRFt/make smaller to increase field power drain) + fieldDrain = (int) Math + .min(tempDrainFactor * (1D - saturation) * (baseMaxRFt / 10.923556), (double) Integer.MAX_VALUE); // <(baseMaxRFt/make + // smaller + // to + // increase + // field + // power + // drain) double fieldNegPercent = 1D - (fieldCharge / maxFieldCharge); fieldInputRate = fieldDrain / fieldNegPercent; - // LogHelper.info(fieldDrain+" "+tempDrainFactor+" "+(1D-saturation)+" "+tempDrainFactor * (1D-saturation) * + // LogHelper.info(fieldDrain+" "+tempDrainFactor+" "+(1D-saturation)+" "+tempDrainFactor * (1D-saturation) * // (baseMaxRFt/10.923556)); fieldCharge -= fieldDrain; // ====================== // Calculate Fuel Usage - fuelUseRate = tempDrainFactor - * (1D - saturation) - * (0.001 * ConfigHandler.reactorFuelUsageMultiplier); // = 1 && reactorFuel > 0) { conversionUnit--; @@ -276,8 +289,8 @@ public class TileReactorCore extends TileObjectSync { while (i.hasNext()) { TileLocation location = i.next(); if (!(location.getTileEntity(worldObj) instanceof TileReactorStabilizer) - || !((TileReactorStabilizer) location.getTileEntity(worldObj)) - .masterLocation.isThisLocation(xCoord, yCoord, zCoord)) { + || !((TileReactorStabilizer) location.getTileEntity(worldObj)).masterLocation + .isThisLocation(xCoord, yCoord, zCoord)) { i.remove(); updateRequired = true; } else stabilizers.add((TileReactorStabilizer) location.getTileEntity(worldObj)); @@ -292,8 +305,7 @@ public class TileReactorCore extends TileObjectSync { for (TileReactorStabilizer comp : stabilizers) { if (!(comp == stabilizer || checkList.contains(comp)) && ForgeDirection.getOrientation(comp.facingDirection) - == ForgeDirection.getOrientation(stabilizer.facingDirection) - .getOpposite()) { + == ForgeDirection.getOrientation(stabilizer.facingDirection).getOpposite()) { checkList.add(comp); checkList.add(stabilizer); if (checkList.size() == 4) { @@ -328,7 +340,9 @@ public class TileReactorCore extends TileObjectSync { boolean flag = false; for (int i = 1; i < MAX_SLAVE_RANGE && !flag; i++) { TileLocation location = new TileLocation( - xCoord + direction.offsetX * i, yCoord + direction.offsetY * i, zCoord + direction.offsetZ * i); + xCoord + direction.offsetX * i, + yCoord + direction.offsetY * i, + zCoord + direction.offsetZ * i); if (location.getTileEntity(worldObj) != null) { if (location.getTileEntity(worldObj) instanceof IReactorPart && !((IReactorPart) location.getTileEntity(worldObj)).getMaster().initialized) @@ -344,12 +358,13 @@ public class TileReactorCore extends TileObjectSync { for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) { for (int i = 1; i < MAX_SLAVE_RANGE; i++) { TileLocation location = new TileLocation( - xCoord + direction.offsetX * i, yCoord + direction.offsetY * i, zCoord + direction.offsetZ * i); + xCoord + direction.offsetX * i, + yCoord + direction.offsetY * i, + zCoord + direction.offsetZ * i); if (location.getTileEntity(worldObj) instanceof IReactorPart - && ((IReactorPart) location.getTileEntity(worldObj)) - .getMaster() - .compareTo(new TileLocation(xCoord, yCoord, zCoord)) - == 0) ((IReactorPart) location.getTileEntity(worldObj)).shutDown(); + && ((IReactorPart) location.getTileEntity(worldObj)).getMaster() + .compareTo(new TileLocation(xCoord, yCoord, zCoord)) == 0) + ((IReactorPart) location.getTileEntity(worldObj)).shutDown(); } } @@ -390,8 +405,7 @@ public class TileReactorCore extends TileObjectSync { public boolean canStart() { validateStructure(); - return reactionTemperature >= 2000 - && fieldCharge >= (maxFieldCharge / 2) + return reactionTemperature >= 2000 && fieldCharge >= (maxFieldCharge / 2) && energySaturation >= (maxEnergySaturation / 2) && isStructureValid && convertedFuel + reactorFuel + conversionUnit >= 144; @@ -440,14 +454,18 @@ public class TileReactorCore extends TileObjectSync { private double maxFieldChargeCach = -1; private void detectAndSendChanges() { - NetworkRegistry.TargetPoint tp = - new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 128); + NetworkRegistry.TargetPoint tp = new NetworkRegistry.TargetPoint( + worldObj.provider.dimensionId, + xCoord, + yCoord, + zCoord, + 128); if (reactionTemperatureCach != reactionTemperature) reactionTemperatureCach = (Double) sendObjectToClient(References.DOUBLE_ID, 8, reactionTemperature, tp); if (tick % 10 != 0) return; if (isStructureValidCach != isStructureValid) isStructureValidCach = (Boolean) sendObjectToClient(References.BOOLEAN_ID, 0, isStructureValid, tp); - // if (isActiveCach != isActive) isActiveCach = (Boolean) sendObjectToClient(References.BOOLEAN_ID, + // if (isActiveCach != isActive) isActiveCach = (Boolean) sendObjectToClient(References.BOOLEAN_ID, // 1, isActive, tp); if (startupInitializedCach != startupInitialized) startupInitializedCach = (Boolean) sendObjectToClient(References.BOOLEAN_ID, 2, startupInitialized, tp); @@ -517,7 +535,7 @@ public class TileReactorCore extends TileObjectSync { case 0: isStructureValid = (Boolean) object; break; - // case 1: isActive = (Boolean) object; break; + // case 1: isActive = (Boolean) object; break; case 2: startupInitialized = (Boolean) object; break; @@ -549,11 +567,8 @@ public class TileReactorCore extends TileObjectSync { maxFieldCharge = (Double) object; break; case 100: - FMLClientHandler.instance() - .getClient() - .effectRenderer - .addEffect(new Particles.ReactorExplosionParticle( - worldObj, xCoord, yCoord, zCoord, (Integer) object)); + FMLClientHandler.instance().getClient().effectRenderer.addEffect( + new Particles.ReactorExplosionParticle(worldObj, xCoord, yCoord, zCoord, (Integer) object)); } super.receiveObjectFromServer(index, object); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorEnergyInjector.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorEnergyInjector.java index 7b858f72..6dbe79e4 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorEnergyInjector.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorEnergyInjector.java @@ -1,16 +1,8 @@ package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor; -import cofh.api.energy.IEnergyReceiver; -import com.brandon3055.brandonscore.common.utills.Utills; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.client.render.particle.ParticleReactorBeam; -import com.brandon3055.draconicevolution.common.blocks.multiblock.IReactorPart; -import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper; -import com.brandon3055.draconicevolution.integration.computers.IDEPeripheral; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.HashMap; import java.util.Map; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; @@ -20,6 +12,18 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; +import cofh.api.energy.IEnergyReceiver; + +import com.brandon3055.brandonscore.common.utills.Utills; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.client.render.particle.ParticleReactorBeam; +import com.brandon3055.draconicevolution.common.blocks.multiblock.IReactorPart; +import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper; +import com.brandon3055.draconicevolution.integration.computers.IDEPeripheral; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by Brandon on 23/7/2015. */ @@ -199,7 +203,7 @@ public class TileReactorEnergyInjector extends TileEntity implements IReactorPar @Override public String[] getMethodNames() { - return new String[] {"getReactorInfo", "chargeReactor", "activateReactor", "stopReactor"}; + return new String[] { "getReactorInfo", "chargeReactor", "activateReactor", "stopReactor" }; } @Override @@ -223,31 +227,27 @@ public class TileReactorEnergyInjector extends TileEntity implements IReactorPar map.put("fuelConversionRate", (int) Math.round(reactor.fuelUseRate * 1000000D)); map.put( "status", - reactor.reactorState == 0 - ? "offline" - : reactor.reactorState == 1 && !reactor.canStart() - ? "charging" - : reactor.reactorState == 1 && reactor.canStart() - ? "charged" - : reactor.reactorState == 2 - ? "online" + reactor.reactorState == 0 ? "offline" + : reactor.reactorState == 1 && !reactor.canStart() ? "charging" + : reactor.reactorState == 1 && reactor.canStart() ? "charged" + : reactor.reactorState == 2 ? "online" : reactor.reactorState == 3 ? "stopping" : "invalid"); - return new Object[] {map}; + return new Object[] { map }; } else if (method.equals("chargeReactor")) { if (reactor.canCharge()) { reactor.reactorState = TileReactorCore.STATE_START; - return new Object[] {true}; - } else return new Object[] {false}; + return new Object[] { true }; + } else return new Object[] { false }; } else if (method.equals("activateReactor")) { if (reactor.canStart()) { reactor.reactorState = TileReactorCore.STATE_ONLINE; - return new Object[] {true}; - } else return new Object[] {false}; + return new Object[] { true }; + } else return new Object[] { false }; } else if (method.equals("stopReactor")) { if (reactor.canStop()) { reactor.reactorState = TileReactorCore.STATE_STOP; - return new Object[] {true}; - } else return new Object[] {false}; + return new Object[] { true }; + } else return new Object[] { false }; } return new Object[] {}; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorStabilizer.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorStabilizer.java index 7f682967..fd9f0744 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorStabilizer.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorStabilizer.java @@ -1,17 +1,8 @@ package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor; -import cofh.api.energy.IEnergyProvider; -import cofh.api.energy.IEnergyReceiver; -import com.brandon3055.brandonscore.common.utills.Utills; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.client.render.particle.ParticleReactorBeam; -import com.brandon3055.draconicevolution.common.blocks.multiblock.IReactorPart; -import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation; -import com.brandon3055.draconicevolution.integration.computers.IDEPeripheral; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import java.util.HashMap; import java.util.Map; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; @@ -20,6 +11,19 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; +import cofh.api.energy.IEnergyProvider; +import cofh.api.energy.IEnergyReceiver; + +import com.brandon3055.brandonscore.common.utills.Utills; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.client.render.particle.ParticleReactorBeam; +import com.brandon3055.draconicevolution.common.blocks.multiblock.IReactorPart; +import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation; +import com.brandon3055.draconicevolution.integration.computers.IDEPeripheral; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + /** * Created by brandon3055 on 5/7/2015. */ @@ -54,16 +58,15 @@ public class TileReactorStabilizer extends TileEntity implements IReactorPart, I if (master instanceof TileReactorCore && ((TileReactorCore) master).reactorState == TileReactorCore.STATE_ONLINE) { ForgeDirection back = ForgeDirection.getOrientation(facingDirection).getOpposite(); - TileEntity output = - worldObj.getTileEntity(xCoord + back.offsetX, yCoord + back.offsetY, zCoord + back.offsetZ); + TileEntity output = worldObj + .getTileEntity(xCoord + back.offsetX, yCoord + back.offsetY, zCoord + back.offsetZ); if (output instanceof IEnergyReceiver) { - int sent = ((IEnergyReceiver) output) - .receiveEnergy( - back.getOpposite(), - Math.min( - ((TileReactorCore) master).energySaturation, - ((TileReactorCore) master).maxEnergySaturation / 100), - false); + int sent = ((IEnergyReceiver) output).receiveEnergy( + back.getOpposite(), + Math.min( + ((TileReactorCore) master).energySaturation, + ((TileReactorCore) master).maxEnergySaturation / 100), + false); ((TileReactorCore) master).energySaturation -= sent; } } @@ -112,9 +115,19 @@ public class TileReactorStabilizer extends TileEntity implements IReactorPart, I int z = zCoord + (dir.offsetZ * i); if (!worldObj.isAirBlock(x, y, z)) { TileEntity tile = worldObj.getTileEntity(x, y, z); - if (tile instanceof TileReactorCore - && ((TileReactorCore) tile).stabilizerLocations.size() - < 4) // todo add check reactor side to make sure this aligns with other stabilizers + if (tile instanceof TileReactorCore && ((TileReactorCore) tile).stabilizerLocations.size() < 4) // todo + // add + // check + // reactor + // side + // to + // make + // sure + // this + // aligns + // with + // other + // stabilizers { ((TileReactorCore) tile).stabilizerLocations.add(new TileLocation(xCoord, yCoord, zCoord)); masterLocation.set(x, y, z); @@ -233,7 +246,7 @@ public class TileReactorStabilizer extends TileEntity implements IReactorPart, I @Override public String[] getMethodNames() { - return new String[] {"getReactorInfo", "chargeReactor", "activateReactor", "stopReactor"}; + return new String[] { "getReactorInfo", "chargeReactor", "activateReactor", "stopReactor" }; } @Override @@ -257,31 +270,27 @@ public class TileReactorStabilizer extends TileEntity implements IReactorPart, I map.put("fuelConversionRate", (int) Math.round(reactor.fuelUseRate * 1000000D)); map.put( "status", - reactor.reactorState == 0 - ? "offline" - : reactor.reactorState == 1 && !reactor.canStart() - ? "charging" - : reactor.reactorState == 1 && reactor.canStart() - ? "charged" - : reactor.reactorState == 2 - ? "online" + reactor.reactorState == 0 ? "offline" + : reactor.reactorState == 1 && !reactor.canStart() ? "charging" + : reactor.reactorState == 1 && reactor.canStart() ? "charged" + : reactor.reactorState == 2 ? "online" : reactor.reactorState == 3 ? "stopping" : "invalid"); - return new Object[] {map}; + return new Object[] { map }; } else if (method.equals("chargeReactor")) { if (reactor.canCharge()) { reactor.reactorState = TileReactorCore.STATE_START; - return new Object[] {true}; - } else return new Object[] {false}; + return new Object[] { true }; + } else return new Object[] { false }; } else if (method.equals("activateReactor")) { if (reactor.canStart()) { reactor.reactorState = TileReactorCore.STATE_ONLINE; - return new Object[] {true}; - } else return new Object[] {false}; + return new Object[] { true }; + } else return new Object[] { false }; } else if (method.equals("stopReactor")) { if (reactor.canStop()) { reactor.reactorState = TileReactorCore.STATE_STOP; - return new Object[] {true}; - } else return new Object[] {false}; + return new Object[] { true }; + } else return new Object[] { false }; } return new Object[] {}; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/DamageSourceChaos.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/DamageSourceChaos.java index a6ec6380..ea349c4e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/DamageSourceChaos.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/DamageSourceChaos.java @@ -7,6 +7,7 @@ import net.minecraft.util.EntityDamageSource; * Created by Brandon on 1/09/2014. */ public class DamageSourceChaos extends EntityDamageSource { + public DamageSourceChaos(Entity entity) { super("Chaos", entity); this.setDamageBypassesArmor(); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/DragonChunkLoader.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/DragonChunkLoader.java index 4ac07a42..a238df04 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/DragonChunkLoader.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/DragonChunkLoader.java @@ -1,8 +1,7 @@ package com.brandon3055.draconicevolution.common.utills; -import com.brandon3055.draconicevolution.DraconicEvolution; -import com.brandon3055.draconicevolution.common.entity.EntityChaosGuardian; import java.util.*; + import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.World; import net.minecraftforge.common.ForgeChunkManager; @@ -10,10 +9,14 @@ import net.minecraftforge.common.ForgeChunkManager.LoadingCallback; import net.minecraftforge.common.ForgeChunkManager.Ticket; import net.minecraftforge.common.MinecraftForge; +import com.brandon3055.draconicevolution.DraconicEvolution; +import com.brandon3055.draconicevolution.common.entity.EntityChaosGuardian; + /** * Created by brandon3055 on 21/10/2015. */ public class DragonChunkLoader implements LoadingCallback { + public static DragonChunkLoader instance; public static Map ticketList = new HashMap(); public static boolean hasReportedIssue = false; @@ -30,8 +33,8 @@ public class DragonChunkLoader implements LoadingCallback { if (ticketList.containsKey(guardian)) { ticket = ticketList.get(guardian); } else { - ticket = ForgeChunkManager.requestTicket( - DraconicEvolution.instance, guardian.worldObj, ForgeChunkManager.Type.ENTITY); + ticket = ForgeChunkManager + .requestTicket(DraconicEvolution.instance, guardian.worldObj, ForgeChunkManager.Type.ENTITY); if (ticket != null) { ticket.bindEntity(guardian); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/EnergyStorage.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/EnergyStorage.java index 365751c8..e7ec181e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/EnergyStorage.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/EnergyStorage.java @@ -1,8 +1,9 @@ package com.brandon3055.draconicevolution.common.utills; -import cofh.api.energy.IEnergyStorage; import net.minecraft.nbt.NBTTagCompound; +import cofh.api.energy.IEnergyStorage; + /** * Reference implementation of {@link cofh.api.energy.IEnergyStorage}. Use/extend this or implement your own. * @@ -87,8 +88,8 @@ public class EnergyStorage implements IEnergyStorage { } /** - * This function is included to allow for server -> client sync. Do not call this externally to the containing Tile Entity, as not all IEnergyHandlers are - * guaranteed to have it. + * This function is included to allow for server -> client sync. Do not call this externally to the containing Tile + * Entity, as not all IEnergyHandlers are guaranteed to have it. * * @param energy */ @@ -104,8 +105,8 @@ public class EnergyStorage implements IEnergyStorage { } /** - * This function is included to allow the containing tile to directly and efficiently modify the energy contained in the EnergyStorage. Do not rely on this - * externally, as not all IEnergyHandlers are guaranteed to have it. + * This function is included to allow the containing tile to directly and efficiently modify the energy contained in + * the EnergyStorage. Do not rely on this externally, as not all IEnergyHandlers are guaranteed to have it. * * @param energy */ diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/IConfigurableItem.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/IConfigurableItem.java index 5a16a13d..e6688920 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/IConfigurableItem.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/IConfigurableItem.java @@ -1,15 +1,18 @@ package com.brandon3055.draconicevolution.common.utills; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; import java.util.List; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; + /** * Created by Brandon on 29/12/2014. */ public interface IConfigurableItem { + List getFields(ItemStack stack, int slot); public boolean hasProfiles(); @@ -50,33 +53,23 @@ public interface IConfigurableItem { } public static boolean getBoolean(ItemStack stack, String tag, boolean defaultExpected) { - return getProfileCompound(stack).hasKey(tag) - ? getProfileCompound(stack).getBoolean(tag) - : defaultExpected; + return getProfileCompound(stack).hasKey(tag) ? getProfileCompound(stack).getBoolean(tag) : defaultExpected; } public static int getInteger(ItemStack stack, String tag, int defaultExpected) { - return getProfileCompound(stack).hasKey(tag) - ? getProfileCompound(stack).getInteger(tag) - : defaultExpected; + return getProfileCompound(stack).hasKey(tag) ? getProfileCompound(stack).getInteger(tag) : defaultExpected; } public static float getFloat(ItemStack stack, String tag, float defaultExpected) { - return getProfileCompound(stack).hasKey(tag) - ? getProfileCompound(stack).getFloat(tag) - : defaultExpected; + return getProfileCompound(stack).hasKey(tag) ? getProfileCompound(stack).getFloat(tag) : defaultExpected; } public static double getDouble(ItemStack stack, String tag, double defaultExpected) { - return getProfileCompound(stack).hasKey(tag) - ? getProfileCompound(stack).getDouble(tag) - : defaultExpected; + return getProfileCompound(stack).hasKey(tag) ? getProfileCompound(stack).getDouble(tag) : defaultExpected; } public static String getString(ItemStack stack, String tag, String defaultExpected) { - return getProfileCompound(stack).hasKey(tag) - ? getProfileCompound(stack).getString(tag) - : defaultExpected; + return getProfileCompound(stack).hasKey(tag) ? getProfileCompound(stack).getString(tag) : defaultExpected; } } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/IHudDisplayBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/IHudDisplayBlock.java index e7068101..882ebb81 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/IHudDisplayBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/IHudDisplayBlock.java @@ -1,11 +1,13 @@ package com.brandon3055.draconicevolution.common.utills; import java.util.List; + import net.minecraft.world.World; /** * Created by Brandon on 27/01/2015. */ public interface IHudDisplayBlock { + List getDisplayData(World world, int x, int y, int z); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/IHudDisplayItem.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/IHudDisplayItem.java index b6e6ceff..0116324e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/IHudDisplayItem.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/IHudDisplayItem.java @@ -1,11 +1,13 @@ package com.brandon3055.draconicevolution.common.utills; import java.util.List; + import net.minecraft.item.ItemStack; /** * Created by Brandon on 26/01/2015. */ public interface IHudDisplayItem { + List getDisplayData(ItemStack stack); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/IInventoryTool.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/IInventoryTool.java index 68ae124f..c47bcecf 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/IInventoryTool.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/IInventoryTool.java @@ -6,6 +6,7 @@ import net.minecraft.enchantment.Enchantment; * Created by Brandon on 17/01/2015. */ public interface IInventoryTool extends IConfigurableItem { + public abstract String getInventoryName(); public abstract int getInventorySlots(); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/IUpgradableItem.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/IUpgradableItem.java index d406a889..480644c3 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/IUpgradableItem.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/IUpgradableItem.java @@ -1,17 +1,21 @@ package com.brandon3055.draconicevolution.common.utills; -import cofh.api.energy.IEnergyContainerItem; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.draconicevolution.common.lib.References; import java.util.List; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.StatCollector; +import cofh.api.energy.IEnergyContainerItem; + +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.lib.References; + /** * Created by brandon3055 on 23/12/2015. */ public interface IUpgradableItem { + /** * @return a list of upgrades for this item. */ @@ -23,11 +27,8 @@ public interface IUpgradableItem { public int getUpgradeCap(ItemStack itemstack); /** - * @return the max upgrade tier allowed for this item - * 0 = Draconic Core - * 1 = Wyvern Core - * 2 = Awakened Core - * 3 = Chaotic Core + * @return the max upgrade tier allowed for this item 0 = Draconic Core 1 = Wyvern Core 2 = Awakened Core 3 = + * Chaotic Core */ public int getMaxTier(ItemStack itemstack); @@ -40,22 +41,26 @@ public interface IUpgradableItem { public List getUpgradeStats(ItemStack itemstack); public static enum EnumUpgrade { + RF_CAPACITY(0, 1, "RFCapacity") { + @Override public void onRemovedFromItem(ItemStack itemStack) { if (itemStack != null && itemStack.getItem() instanceof IEnergyContainerItem) { IEnergyContainerItem item = (IEnergyContainerItem) itemStack.getItem(); - for (int i = 0; - i < 500 && item.getEnergyStored(itemStack) > item.getMaxEnergyStored(itemStack); - i++) { + for (int i = 0; i < 500 + && item.getEnergyStored(itemStack) > item.getMaxEnergyStored(itemStack); i++) { item.extractEnergy( - itemStack, item.getEnergyStored(itemStack) - item.getMaxEnergyStored(itemStack), false); + itemStack, + item.getEnergyStored(itemStack) - item.getMaxEnergyStored(itemStack), + false); } } } }, DIG_SPEED(1, 1, "DigSpeed"), DIG_AOE(2, 4, "DigAOE") { + @Override public void onRemovedFromItem(ItemStack itemStack) { int profile = ItemNBTHelper.getInteger(itemStack, "ConfigProfile", 0); @@ -64,14 +69,15 @@ public interface IUpgradableItem { ItemNBTHelper.setInteger(itemStack, "ConfigProfile", i); if (IConfigurableItem.ProfileHelper.getInteger(itemStack, References.DIG_AOE, 0) > getUpgradePoints(itemStack)) - IConfigurableItem.ProfileHelper.setInteger( - itemStack, References.DIG_AOE, getUpgradePoints(itemStack)); + IConfigurableItem.ProfileHelper + .setInteger(itemStack, References.DIG_AOE, getUpgradePoints(itemStack)); } ItemNBTHelper.setInteger(itemStack, "ConfigProfile", profile); } }, DIG_DEPTH(3, 2, "DigDepth") { + @Override public void onRemovedFromItem(ItemStack itemStack) { int profile = ItemNBTHelper.getInteger(itemStack, "ConfigProfile", 0); @@ -80,8 +86,8 @@ public interface IUpgradableItem { ItemNBTHelper.setInteger(itemStack, "ConfigProfile", i); if (IConfigurableItem.ProfileHelper.getInteger(itemStack, References.DIG_DEPTH, 0) > getUpgradePoints(itemStack)) - IConfigurableItem.ProfileHelper.setInteger( - itemStack, References.DIG_DEPTH, getUpgradePoints(itemStack)); + IConfigurableItem.ProfileHelper + .setInteger(itemStack, References.DIG_DEPTH, getUpgradePoints(itemStack)); } ItemNBTHelper.setInteger(itemStack, "ConfigProfile", profile); @@ -89,6 +95,7 @@ public interface IUpgradableItem { }, ATTACK_DAMAGE(4, 1, "AttackDamage"), ATTACK_AOE(5, 2, "AttackAOE") { + @Override public void onRemovedFromItem(ItemStack itemStack) { int profile = ItemNBTHelper.getInteger(itemStack, "ConfigProfile", 0); @@ -97,14 +104,15 @@ public interface IUpgradableItem { ItemNBTHelper.setInteger(itemStack, "ConfigProfile", i); if (IConfigurableItem.ProfileHelper.getInteger(itemStack, References.ATTACK_AOE, 0) > getUpgradePoints(itemStack)) - IConfigurableItem.ProfileHelper.setInteger( - itemStack, References.ATTACK_AOE, getUpgradePoints(itemStack)); + IConfigurableItem.ProfileHelper + .setInteger(itemStack, References.ATTACK_AOE, getUpgradePoints(itemStack)); } ItemNBTHelper.setInteger(itemStack, "ConfigProfile", profile); } }, ARROW_DAMAGE(6, 1, "ArrowDamage") { + @Override public void onRemovedFromItem(ItemStack itemStack) { int profile = ItemNBTHelper.getInteger(itemStack, "ConfigProfile", 0); @@ -113,8 +121,8 @@ public interface IUpgradableItem { ItemNBTHelper.setInteger(itemStack, "ConfigProfile", i); if (IConfigurableItem.ProfileHelper.getInteger(itemStack, "BowArrowDamage", 0) > getUpgradePoints(itemStack)) - IConfigurableItem.ProfileHelper.setInteger( - itemStack, "BowArrowDamage", getUpgradePoints(itemStack)); + IConfigurableItem.ProfileHelper + .setInteger(itemStack, "BowArrowDamage", getUpgradePoints(itemStack)); } ItemNBTHelper.setInteger(itemStack, "ConfigProfile", profile); @@ -122,6 +130,7 @@ public interface IUpgradableItem { }, DRAW_SPEED(7, 2, "DrawSpeed"), ARROW_SPEED(8, 2, "ArrowSpeed") { + @Override public void onRemovedFromItem(ItemStack itemStack) { int profile = ItemNBTHelper.getInteger(itemStack, "ConfigProfile", 0); @@ -130,8 +139,8 @@ public interface IUpgradableItem { ItemNBTHelper.setInteger(itemStack, "ConfigProfile", i); if (IConfigurableItem.ProfileHelper.getInteger(itemStack, "BowArrowSpeedModifier", 0) > getUpgradePoints(itemStack)) - IConfigurableItem.ProfileHelper.setInteger( - itemStack, "BowArrowSpeedModifier", getUpgradePoints(itemStack)); + IConfigurableItem.ProfileHelper + .setInteger(itemStack, "BowArrowSpeedModifier", getUpgradePoints(itemStack)); } ItemNBTHelper.setInteger(itemStack, "ConfigProfile", profile); @@ -160,22 +169,21 @@ public interface IUpgradableItem { /** * Get the number of cores applied to this upgrade * - * @return an int[4] containing the number of cores that have been applied - * in order from index 0 which is the number od draconic cores to index 3 which is the number of chaotic cores - * with wyvern and awakened in between + * @return an int[4] containing the number of cores that have been applied in order from index 0 which is the + * number od draconic cores to index 3 which is the number of chaotic cores with wyvern and awakened in + * between */ public int[] getCoresApplied(ItemStack stack) { - if (stack == null) return new int[] {0, 0, 0, 0}; + if (stack == null) return new int[] { 0, 0, 0, 0 }; NBTTagCompound compound = ItemNBTHelper.getCompound(stack); - if (!compound.hasKey(COMPOUND_NAME)) return new int[] {0, 0, 0, 0}; + if (!compound.hasKey(COMPOUND_NAME)) return new int[] { 0, 0, 0, 0 }; NBTTagCompound upgrades = compound.getCompoundTag(COMPOUND_NAME); if (upgrades.hasKey(name) && upgrades.getIntArray(name).length == 4) return upgrades.getIntArray(name); - return new int[] {0, 0, 0, 0}; + return new int[] { 0, 0, 0, 0 }; } /** - * Sets the number of each core type applied - * takes an ItemStack and an int[4] + * Sets the number of each core type applied takes an ItemStack and an int[4] */ public void setCoresApplied(ItemStack stack, int[] cores) { if (cores.length != 4) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/InventoryUtils.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/InventoryUtils.java index 2fc76c05..32637da5 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/InventoryUtils.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/InventoryUtils.java @@ -2,6 +2,7 @@ package com.brandon3055.draconicevolution.common.utills; import java.util.Arrays; import java.util.Optional; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -12,7 +13,6 @@ public final class InventoryUtils { public static Optional getItemInPlayerInventory(EntityPlayer player, Class item) { return Arrays.stream(player.inventory.mainInventory) - .filter(itemStack -> itemStack != null && item.isInstance(itemStack.getItem())) - .findAny(); + .filter(itemStack -> itemStack != null && item.isInstance(itemStack.getItem())).findAny(); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/ItemConfigField.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/ItemConfigField.java index 8812ac68..2e35efe2 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/ItemConfigField.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/ItemConfigField.java @@ -1,13 +1,14 @@ package com.brandon3055.draconicevolution.common.utills; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; +import net.minecraft.util.StringUtils; + import com.brandon3055.brandonscore.common.utills.DataUtills; import com.brandon3055.brandonscore.common.utills.InfoHelper; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.network.ItemConfigPacket; -import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; -import net.minecraft.util.StringUtils; /** * Created by Brandon on 29/12/2014. @@ -48,13 +49,16 @@ public class ItemConfigField { return StatCollector.translateToLocal("button.de." + name + ".name"); } - // public void writeToItem(ItemStack stack){ - // DataUtills.writeObjectToItem(stack, value, datatype, name); - // } + // public void writeToItem(ItemStack stack){ + // DataUtills.writeObjectToItem(stack, value, datatype, name); + // } public ItemConfigField readFromItem(ItemStack stack, Object defaultExpected) { value = DataUtills.readObjectFromCompound( - IConfigurableItem.ProfileHelper.getProfileCompound(stack), datatype, name, defaultExpected); + IConfigurableItem.ProfileHelper.getProfileCompound(stack), + datatype, + name, + defaultExpected); return this; } @@ -69,20 +73,17 @@ public class ItemConfigField { i *= 2; return String.valueOf((i + 1) + "x" + (i + 1)); } else if (datatype == References.BOOLEAN_ID) { - return (Boolean) value - ? StatCollector.translateToLocal("gui.de.on.txt") + return (Boolean) value ? StatCollector.translateToLocal("gui.de.on.txt") : StatCollector.translateToLocal("gui.de.off.txt"); - } else if (datatype == References.FLOAT_ID - && !StringUtils.isNullOrEmpty(modifier) - && modifier.equals("PERCENT")) { - return Math.round((Float) value * 100D) + "%"; - } else if (datatype == References.FLOAT_ID - && !StringUtils.isNullOrEmpty(modifier) - && modifier.equals("PLUSPERCENT")) { - return "+" + Math.round((Float) value * 100D) + "%"; - } else { - return String.valueOf(value); - } + } else + if (datatype == References.FLOAT_ID && !StringUtils.isNullOrEmpty(modifier) && modifier.equals("PERCENT")) { + return Math.round((Float) value * 100D) + "%"; + } else if (datatype == References.FLOAT_ID && !StringUtils.isNullOrEmpty(modifier) + && modifier.equals("PLUSPERCENT")) { + return "+" + Math.round((Float) value * 100D) + "%"; + } else { + return String.valueOf(value); + } } public String getMaxFormattedValue() { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/LogHelper.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/LogHelper.java index 7beb5e6e..92cc857d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/LogHelper.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/LogHelper.java @@ -1,9 +1,10 @@ package com.brandon3055.draconicevolution.common.utills; +import org.apache.logging.log4j.Level; + import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.lib.References; import cpw.mods.fml.common.FMLLog; -import org.apache.logging.log4j.Level; /** * Created by Brandon on 3/07/2014. diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/PortalHelper.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/PortalHelper.java index 8d8b386f..a8381b63 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/PortalHelper.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/PortalHelper.java @@ -1,14 +1,15 @@ package com.brandon3055.draconicevolution.common.utills; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileDislocatorReceptacle; -import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TilePortalBlock; import net.minecraft.block.Block; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; import net.minecraftforge.common.util.ForgeDirection; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileDislocatorReceptacle; +import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TilePortalBlock; + /** * Created by Brandon on 23/5/2015. */ @@ -43,8 +44,8 @@ public class PortalHelper { return null; } - public static PortalStructure traceFrame( - World world, int x, int y, int z, ForgeDirection startDir, ForgeDirection plane) { + public static PortalStructure traceFrame(World world, int x, int y, int z, ForgeDirection startDir, + ForgeDirection plane) { int MAX_SIZE = 150; int startX = x + startDir.offsetX; int startY = y + startDir.offsetY; @@ -60,36 +61,42 @@ public class PortalHelper { // Get X size for (int i = 0; i <= MAX_SIZE; i++) { Block block = world.getBlock( - startX + i * startDir.offsetX, startY + i * startDir.offsetY, startZ + i * startDir.offsetZ); + startX + i * startDir.offsetX, + startY + i * startDir.offsetY, + startZ + i * startDir.offsetZ); if (isFrame(block)) { xSize = i; break; } else if (!world.isAirBlock( - startX + i * startDir.offsetX, startY + i * startDir.offsetY, startZ + i * startDir.offsetZ)) + startX + i * startDir.offsetX, + startY + i * startDir.offsetY, + startZ + i * startDir.offsetZ)) return null; } // Get Y size above receptacle for (int i = 0; i <= MAX_SIZE; i++) { - Block block = - world.getBlock(startX + i * plane.offsetX, startY + i * plane.offsetY, startZ + i * plane.offsetZ); + Block block = world + .getBlock(startX + i * plane.offsetX, startY + i * plane.offsetY, startZ + i * plane.offsetZ); if (isFrame(block)) { ySize = i; break; - } else if (!world.isAirBlock( - startX + i * plane.offsetX, startY + i * plane.offsetY, startZ + i * plane.offsetZ)) return null; + } else if (!world + .isAirBlock(startX + i * plane.offsetX, startY + i * plane.offsetY, startZ + i * plane.offsetZ)) + return null; } // Get Y size below receptacle and get y offset for (int i = 0; i <= MAX_SIZE; i++) { - Block block = - world.getBlock(startX - i * plane.offsetX, startY - i * plane.offsetY, startZ - i * plane.offsetZ); + Block block = world + .getBlock(startX - i * plane.offsetX, startY - i * plane.offsetY, startZ - i * plane.offsetZ); if (isFrame(block)) { ySize += i - 1; yOffset = i; break; - } else if (!world.isAirBlock( - startX - i * plane.offsetX, startY - i * plane.offsetY, startZ - i * plane.offsetZ)) return null; + } else if (!world + .isAirBlock(startX - i * plane.offsetX, startY - i * plane.offsetY, startZ - i * plane.offsetZ)) + return null; } if (xSize == 0 || ySize == 0 || ySize > MAX_SIZE) return null; @@ -159,8 +166,8 @@ public class PortalHelper { return true; } - public boolean scanPortal( - World world, int x, int y, int z, boolean setPortalBlocks, boolean checkPortalBlocks) { + public boolean scanPortal(World world, int x, int y, int z, boolean setPortalBlocks, + boolean checkPortalBlocks) { int startX = x + startDir.offsetX; int startY = y + startDir.offsetY; int startZ = z + startDir.offsetZ; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/ShapedOreEnergyRecipe.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/ShapedOreEnergyRecipe.java index ba0bcd06..8b26d64f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/ShapedOreEnergyRecipe.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/ShapedOreEnergyRecipe.java @@ -1,13 +1,15 @@ package com.brandon3055.draconicevolution.common.utills; -import cofh.api.energy.IEnergyContainerItem; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; import net.minecraft.block.Block; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.ShapedOreRecipe; +import cofh.api.energy.IEnergyContainerItem; + +import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; + /** * Created by Brandon on 8/12/2014. */ diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/UpdateChecker.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/UpdateChecker.java index cfa77800..e10f4f9a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/UpdateChecker.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utills/UpdateChecker.java @@ -1,20 +1,24 @@ package com.brandon3055.draconicevolution.common.utills; -import com.brandon3055.draconicevolution.common.lib.VersionHandler; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.TickEvent; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; + import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StringUtils; +import com.brandon3055.draconicevolution.common.lib.VersionHandler; + +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.TickEvent; + /** * Created by Brandon on 24/02/2015. */ public class UpdateChecker { + private final UpdateCheckThread thread; private int delay = 300; private boolean playerNotified = false; @@ -24,7 +28,7 @@ public class UpdateChecker { thread.start(); } - @SuppressWarnings({"unused"}) + @SuppressWarnings({ "unused" }) @SubscribeEvent public void tickStart(TickEvent.PlayerTickEvent event) { if (event.phase != TickEvent.Phase.START) return; @@ -39,18 +43,28 @@ public class UpdateChecker { if (!thread.getVersion().equals(VersionHandler.VERSION) || (VersionHandler.SNAPSHOT > 0 && thread.getSnapshot() == 0)) { - event.player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.LIGHT_PURPLE - + "[Draconic Evolution]" + EnumChatFormatting.RESET + " New version available:")); + event.player.addChatComponentMessage( + new ChatComponentText( + EnumChatFormatting.LIGHT_PURPLE + "[Draconic Evolution]" + + EnumChatFormatting.RESET + + " New version available:")); event.player.addChatComponentMessage( new ChatComponentText(EnumChatFormatting.GREEN + "Draconic Evolution v" + thread.getVersion())); if (!StringUtils.isNullOrEmpty(thread.getNote())) { event.player.addChatComponentMessage(new ChatComponentText(thread.getNote())); } } else if (thread.getSnapshot() > VersionHandler.SNAPSHOT) { - event.player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE - + "[Draconic Evolution]" + EnumChatFormatting.RESET + " New snapshot version available:")); - event.player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.BLUE - + "Draconic Evolution v" + thread.getVersion() + "-snapshot_" + thread.getSnapshot())); + event.player.addChatComponentMessage( + new ChatComponentText( + EnumChatFormatting.DARK_PURPLE + "[Draconic Evolution]" + + EnumChatFormatting.RESET + + " New snapshot version available:")); + event.player.addChatComponentMessage( + new ChatComponentText( + EnumChatFormatting.BLUE + "Draconic Evolution v" + + thread.getVersion() + + "-snapshot_" + + thread.getSnapshot())); if (!StringUtils.isNullOrEmpty(thread.getNote())) { event.player.addChatComponentMessage(new ChatComponentText(thread.getNote())); } @@ -60,14 +74,18 @@ public class UpdateChecker { playerNotified = true; FMLCommonHandler.instance().bus().unregister(this); - event.player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE - + "[Draconic Evolution]" + EnumChatFormatting.RED + " Version check failed")); + event.player.addChatComponentMessage( + new ChatComponentText( + EnumChatFormatting.DARK_PURPLE + "[Draconic Evolution]" + + EnumChatFormatting.RED + + " Version check failed")); if (!StringUtils.isNullOrEmpty(thread.getNote())) event.player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.RED + thread.getNote())); } } public class UpdateCheckThread extends Thread { + private String version = null; private int snapshot = -1; private String note = null; @@ -78,8 +96,8 @@ public class UpdateChecker { public void run() { LogHelper.info("[Update Checker] Thread Started"); try { - URL versionURL = - new URL("https://raw.githubusercontent.com/brandon3055/Draconic-Evolution/master/VERSION.txt"); + URL versionURL = new URL( + "https://raw.githubusercontent.com/brandon3055/Draconic-Evolution/master/VERSION.txt"); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader((versionURL).openStream())); @@ -101,27 +119,27 @@ public class UpdateChecker { } LogHelper.info("[Update Checker] Thread Finished"); - // if (complete) - // { - // if (!getVersion().equals(VersionHandler.VERSION) || (VersionHandler.SNAPSHOT > 0 && getSnapshot() + // if (complete) + // { + // if (!getVersion().equals(VersionHandler.VERSION) || (VersionHandler.SNAPSHOT > 0 && getSnapshot() // == 0)) - // { - // LogHelper.info("###############################"); - // LogHelper.info("New version available:"); - // LogHelper.info("Draconic Evolution v" + thread.getVersion()); - // if (!StringUtils.isNullOrEmpty(thread.getNote())) LogHelper.info(thread.getNote()); - // LogHelper.info("###############################"); - // } - // else if (getSnapshot() > VersionHandler.SNAPSHOT) - // { - // LogHelper.info("###############################"); - // LogHelper.info("New snapshot version available:"); - // LogHelper.info("Draconic Evolution v" + thread.getVersion() + "-snapshot_" + + // { + // LogHelper.info("###############################"); + // LogHelper.info("New version available:"); + // LogHelper.info("Draconic Evolution v" + thread.getVersion()); + // if (!StringUtils.isNullOrEmpty(thread.getNote())) LogHelper.info(thread.getNote()); + // LogHelper.info("###############################"); + // } + // else if (getSnapshot() > VersionHandler.SNAPSHOT) + // { + // LogHelper.info("###############################"); + // LogHelper.info("New snapshot version available:"); + // LogHelper.info("Draconic Evolution v" + thread.getVersion() + "-snapshot_" + // thread.getSnapshot()); - // if (!StringUtils.isNullOrEmpty(thread.getNote())) LogHelper.info(thread.getNote()); - // LogHelper.info("###############################"); - // } - // } + // if (!StringUtils.isNullOrEmpty(thread.getNote())) LogHelper.info(thread.getNote()); + // LogHelper.info("###############################"); + // } + // } } catch (Exception e) { LogHelper.info("[Update Checker] Check Failed"); failed = true; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/world/ChaosWorldGenHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/world/ChaosWorldGenHandler.java index dfeba12f..757d61e5 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/world/ChaosWorldGenHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/world/ChaosWorldGenHandler.java @@ -1,5 +1,12 @@ package com.brandon3055.draconicevolution.common.world; +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; + import com.brandon3055.brandonscore.common.handlers.IProcess; import com.brandon3055.brandonscore.common.utills.DataUtills; import com.brandon3055.brandonscore.common.utills.SimplexNoise; @@ -9,11 +16,6 @@ import com.brandon3055.draconicevolution.common.entity.EntityChaosCrystal; import com.brandon3055.draconicevolution.common.entity.EntityChaosGuardian; import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.tileentities.TileChaosShard; -import java.util.Random; -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; /** * Created by brandon3055 on 9/9/2015. @@ -26,12 +28,13 @@ public class ChaosWorldGenHandler { * @param world The world. * @param chunkX The X position of the chunk being generated. * @param chunkZ The Z position of the chunk being generated. - * @param islandCenter Where to generate the island. If left null the islands will generate in a 10000 by 10000 grid. + * @param islandCenter Where to generate the island. If left null the islands will generate in a 10000 by 10000 + * grid. */ - public static void generateChunk( - World world, int chunkX, int chunkZ, DataUtills.XZPair islandCenter, Random random) { - DataUtills.XZPair closestSpawn = - islandCenter == null ? getClosestChaosSpawn(chunkX, chunkZ) : islandCenter; + public static void generateChunk(World world, int chunkX, int chunkZ, + DataUtills.XZPair islandCenter, Random random) { + DataUtills.XZPair closestSpawn = islandCenter == null ? getClosestChaosSpawn(chunkX, chunkZ) + : islandCenter; if (closestSpawn.x == 0 && closestSpawn.z == 0) return; int posX = chunkX * 16; @@ -40,10 +43,10 @@ public class ChaosWorldGenHandler { if (Math.abs(posX - closestSpawn.x) > copyStartDistance || Math.abs(posZ - closestSpawn.z) > copyStartDistance) return; - if (closestSpawn.x > posX - && closestSpawn.x <= posX + 16 + if (closestSpawn.x > posX && closestSpawn.x <= posX + 16 && closestSpawn.z > posZ - && closestSpawn.z <= posZ + 16) generateStructures(world, closestSpawn, random); + && closestSpawn.z <= posZ + 16) + generateStructures(world, closestSpawn, random); // long l = System.nanoTime(); @@ -78,12 +81,9 @@ public class ChaosWorldGenHandler { // Calculate heightMapFalloff heightMapFalloff = 0; - for (int octave = 1; octave < 5; octave++) - heightMapFalloff += - ((SimplexNoise.noise(xd * octave + closestSpawn.x, zd * octave + closestSpawn.z) + 1) - * 0.5D) - * 0.01D - * (octave * 10D * 1 - (dist * 0.001D)); + for (int octave = 1; octave < 5; octave++) heightMapFalloff += ((SimplexNoise + .noise(xd * octave + closestSpawn.x, zd * octave + closestSpawn.z) + 1) * 0.5D) * 0.01D + * (octave * 10D * 1 - (dist * 0.001D)); if (heightMapFalloff <= 0) heightMapFalloff = 0; heightMapFalloff += ((0.5D - Math.abs(yd - 0.5D)) * 0.15D); if (heightMapFalloff == 0) continue; @@ -97,19 +97,19 @@ public class ChaosWorldGenHandler { z + closestSpawn.z, (dist > 60 || dist > random.nextInt(60)) ? Blocks.end_stone : Blocks.obsidian); - // if (density > 0.1 && world.getBlock(x + closestSpawn.x, y + 64, z + closestSpawn.z) == + // if (density > 0.1 && world.getBlock(x + closestSpawn.x, y + 64, z + closestSpawn.z) == // Blocks.air) { - // boolean b = dist > 60 || dist > random.nextInt(60); - // world.setBlock(x + closestSpawn.x, y + 64, z + closestSpawn.z, (dist > 60 || dist > + // boolean b = dist > 60 || dist > random.nextInt(60); + // world.setBlock(x + closestSpawn.x, y + 64, z + closestSpawn.z, (dist > 60 || dist > // random.nextInt(60)) ? Blocks.end_stone : Blocks.obsidian); - // } + // } } } } } - public static void generateStructures( - World world, DataUtills.XZPair islandCenter, Random random) { + public static void generateStructures(World world, DataUtills.XZPair islandCenter, + Random random) { int outerRadius = 330; // Gen Chaos Cavern @@ -131,8 +131,8 @@ public class ChaosWorldGenHandler { world.setBlock(islandCenter.x, shardY, islandCenter.z, ModBlocks.chaosCrystal); TileChaosShard tileChaosShard = (TileChaosShard) world.getTileEntity(islandCenter.x, shardY, islandCenter.z); - tileChaosShard.locationHash = - tileChaosShard.getLocationHash(islandCenter.x, shardY, islandCenter.z, world.provider.dimensionId); + tileChaosShard.locationHash = tileChaosShard + .getLocationHash(islandCenter.x, shardY, islandCenter.z, world.provider.dimensionId); EntityChaosGuardian guardian = new EntityChaosGuardian(world); guardian.setPositionAndUpdate(islandCenter.x, shardY, islandCenter.z); @@ -159,8 +159,8 @@ public class ChaosWorldGenHandler { generateObelisks(world, islandCenter, random); } - public static void genCoreSlice( - World world, int xi, int yi, int zi, int ringRadius, int yc, int coreRadious, boolean fillIn, Random rand) { + public static void genCoreSlice(World world, int xi, int yi, int zi, int ringRadius, int yc, int coreRadious, + boolean fillIn, Random rand) { for (int x = xi - coreRadious; x <= xi + coreRadious; x++) { for (int z = zi - coreRadious; z <= zi + coreRadious; z++) { double dist = Utills.getDistanceAtoB(x, yi, z, xi, yc, zi); @@ -267,6 +267,7 @@ public class ChaosWorldGenHandler { } public static class CrystalRemover implements IProcess { + private boolean dead = false; private Entity entity; @@ -282,7 +283,7 @@ public class ChaosWorldGenHandler { else { boolean flag = true; int y = (int) entity.posY - 1; - for (; flag; ) { + for (; flag;) { flag = false; for (int x = (int) Math.floor(entity.posX) - 4; x <= (int) Math.floor(entity.posX) + 4; x++) { for (int z = (int) Math.floor(entity.posZ) - 4; z <= (int) Math.floor(entity.posZ) + 4; z++) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/world/DraconicWorldGenerator.java b/src/main/java/com/brandon3055/draconicevolution/common/world/DraconicWorldGenerator.java index 4784ed03..c023ee81 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/world/DraconicWorldGenerator.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/world/DraconicWorldGenerator.java @@ -1,27 +1,25 @@ package com.brandon3055.draconicevolution.common.world; -import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.handler.ConfigHandler; -import cpw.mods.fml.common.IWorldGenerator; import java.util.Random; + import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.feature.WorldGenMinable; +import com.brandon3055.draconicevolution.common.ModBlocks; +import com.brandon3055.draconicevolution.common.handler.ConfigHandler; +import cpw.mods.fml.common.IWorldGenerator; + public class DraconicWorldGenerator implements IWorldGenerator { + public static boolean chaosIslandsEnabled = true; public static boolean cometsEnabled = true; public static boolean oreEnabledInEnd = true; @Override - public void generate( - Random random, - int chunkX, - int chunkZ, - World world, - IChunkProvider chunkGenerator, + public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { switch (world.provider.dimensionId) { case 0: @@ -42,11 +40,7 @@ public class DraconicWorldGenerator implements IWorldGenerator { } } - public void generateSurface( - Random random, - int x, - int z, - World world) { // minVainSise, + public void generateSurface(Random random, int x, int z, World world) { // minVainSise, // maxVainSize, spawnChance(Def2), minY, maxY if (!ConfigHandler.disableOreSpawnOverworld) addOreSpawn(ModBlocks.draconiumOre, world, random, x, z, 3, 4, 2, 2, 8); @@ -56,8 +50,7 @@ public class DraconicWorldGenerator implements IWorldGenerator { int x1 = x + random.nextInt(16); int y = 20 + random.nextInt(170); int z1 = z + random.nextInt(16); - if (cometsEnabled - && ConfigHandler.generateEnderComets + if (cometsEnabled && ConfigHandler.generateEnderComets && Math.sqrt(x * x + z * z) > 200 && random.nextInt(Math.max(1, ConfigHandler.cometRarity)) == 0) new WorldGenEnderComet().generate(world, random, x1, y, z1); @@ -73,30 +66,11 @@ public class DraconicWorldGenerator implements IWorldGenerator { } /** - * Generate Ore - * Block to generate - * World - * Random - * Chunk x - * Chunk z - * min vain size - * max vain size - * number of tries to spawn - * min y - * max y - * * + * Generate Ore Block to generate World Random Chunk x Chunk z min vain size max vain size number of tries to spawn + * min y max y * */ - public void addOreSpawn( - Block block, - World world, - Random random, - int chunkXPos, - int chunkZPos, - int minVainSize, - int maxVainSize, - int chancesToSpawn, - int minY, - int maxY) { + public void addOreSpawn(Block block, World world, Random random, int chunkXPos, int chunkZPos, int minVainSize, + int maxVainSize, int chancesToSpawn, int minY, int maxY) { for (int i = 0; i < chancesToSpawn; i++) { int posX = chunkXPos + random.nextInt(16); int posY = minY + random.nextInt(maxY - minY); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenChaosIsland.java b/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenChaosIsland.java index d3304180..2477bbc4 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenChaosIsland.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenChaosIsland.java @@ -1,15 +1,17 @@ package com.brandon3055.draconicevolution.common.world; -import com.brandon3055.brandonscore.common.utills.SimplexNoise; -import com.brandon3055.brandonscore.common.world.BlockCollection; -import com.brandon3055.draconicevolution.common.utills.LogHelper; import java.util.Random; + import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.gen.NoiseGeneratorImproved; import net.minecraft.world.gen.NoiseGeneratorOctaves; import net.minecraft.world.gen.NoiseGeneratorSimplex; +import com.brandon3055.brandonscore.common.utills.SimplexNoise; +import com.brandon3055.brandonscore.common.world.BlockCollection; +import com.brandon3055.draconicevolution.common.utills.LogHelper; + /** * Created by brandon3055 on 1/9/2015. */ @@ -32,20 +34,20 @@ public class WorldGenChaosIsland { public boolean generate(BlockCollection world, Random random) { // LogHelper.info("Generate"); - // for (int y1 = y - 10; y1 < y + 10; y1++) { - // if (world.getBlock(x, y1, z) == Blocks.end_stone) { - // //LogHelper.info("cancel"); - // return false; - // } - // } + // for (int y1 = y - 10; y1 < y + 10; y1++) { + // if (world.getBlock(x, y1, z) == Blocks.end_stone) { + // //LogHelper.info("cancel"); + // return false; + // } + // } size = 400; generateCentre(world, random); - // generateBelt(world, random, size + 50, size + 200); - // generateObelisks(world, random); - // EntityChaosGuardian dragon = new EntityChaosGuardian(world); - // dragon.setPositionAndUpdate(x, 180, z); - // world.spawnEntityInWorld(dragon); + // generateBelt(world, random, size + 50, size + 200); + // generateObelisks(world, random); + // EntityChaosGuardian dragon = new EntityChaosGuardian(world); + // dragon.setPositionAndUpdate(x, 180, z); + // world.spawnEntityInWorld(dragon); return true; } @@ -84,8 +86,8 @@ public class WorldGenChaosIsland { double density, center_falloff, plateau_falloff, densityZ; - center_falloff = - 0.1; /// (Math.pow((xf - 0.5) * 1.5, 2) + Math.pow((yf - 1.0) * 0.8, 2) + Math.pow((zf - + center_falloff = 0.1; /// (Math.pow((xf - 0.5) * 1.5, 2) + Math.pow((yf - 1.0) * 0.8, 2) + + /// Math.pow((zf - // 0.5) * 1.5, 2)); double diameterScale = 100D; @@ -112,16 +114,16 @@ public class WorldGenChaosIsland { // LogHelper.info(yf); f = false; - // //setup fields + // //setup fields // // - // dist += rand.nextInt(4) - 2; + // dist += rand.nextInt(4) - 2; // - // //Generate core island - // double yMod = dist / (500D/dist+1D); - // if (dist <= coreDiameter && y <= spawnY + yMod){ - // blocks.setBlock(x, y, z, Blocks.end_stone); - // } + // //Generate core island + // double yMod = dist / (500D/dist+1D); + // if (dist <= coreDiameter && y <= spawnY + yMod){ + // blocks.setBlock(x, y, z, Blocks.end_stone); + // } // } @@ -144,8 +146,8 @@ public class WorldGenChaosIsland { double density, center_falloff, plateau_falloff, densityZ; - center_falloff = - 0.1; /// (Math.pow((xf - 0.5) * 1.5, 2) + Math.pow((yf - 1.0) * 0.8, 2) + Math.pow((zf - 0.5) * 1.5, + center_falloff = 0.1; /// (Math.pow((xf - 0.5) * 1.5, 2) + Math.pow((yf - 1.0) * 0.8, 2) + Math.pow((zf - 0.5) * + /// 1.5, // 2)); double diameterScale = 100D; @@ -174,35 +176,35 @@ public class WorldGenChaosIsland { if (density > 1) world.setBlock(x + offsetX, y, z + offsetZ, Blocks.end_stone); } - // if(yf <= 0.8){ - // plateau_falloff = 1.0F; - // } - // else if(0.8 < yf && yf < 0.9){ - // plateau_falloff = 1.0F-(yf-0.8F)*10.0F; - // } - // else{ - // plateau_falloff = 0.0F; - // } + // if(yf <= 0.8){ + // plateau_falloff = 1.0F; + // } + // else if(0.8 < yf && yf < 0.9){ + // plateau_falloff = 1.0F-(yf-0.8F)*10.0F; + // } + // else{ + // plateau_falloff = 0.0F; + // } // - // center_falloff = 0.1F/ (float)( - // Math.pow((xf - 0.5F) * 1.5F, 2) + - // Math.pow((yf - 1.0F) * 0.8F, 2F) + - // Math.pow((zf - 0.5F) * 1.5F, 2F) - // ); - // caves = (float)Math.pow(simplex_noise(1, xf * 5, yf * 5, zf * 5), 3); + // center_falloff = 0.1F/ (float)( + // Math.pow((xf - 0.5F) * 1.5F, 2) + + // Math.pow((yf - 1.0F) * 0.8F, 2F) + + // Math.pow((zf - 0.5F) * 1.5F, 2F) + // ); + // caves = (float)Math.pow(simplex_noise(1, xf * 5, yf * 5, zf * 5), 3); // density = ( simplex_noise(5, xf, yf * 0.5F, zf));// * center_falloff * plateau_falloff); // density *= Math.pow( noise((xf+1)*3.0F, (yf+1)*3.0F, (zf+1)*3.0F)+0.4, 1.8F); - // if(caves<0.5){ - // density = 0; - // } + // if(caves<0.5){ + // density = 0; + // } // put(x, y, z, density>3.1 ? ROCK : 0); // endfor - // public float dot(float x, float y, float z, float... g){ - // return x*g[0] + y*g[1] + z*g[2]; - // } + // public float dot(float x, float y, float z, float... g){ + // return x*g[0] + y*g[1] + z*g[2]; + // } // // public static int[] perm = {151, 160, 137, 91, 90, 15, 131, 13, 201, 95, 96, 53, 194, 233, 7, 225, 140, 36, 103, // 30, 69, 142, 8, 99, 37, 240, 21, 10, 23, 190, 6, 148, 247, 120, 234, 75, 0, 26, 197, 62, 94, 252, 219, 203, 117, @@ -227,219 +229,219 @@ public class WorldGenChaosIsland { // 50, 45, 127, 4, 150, 254, 138, 236, 205, 93, 222, 114, 67, 29, 24, 72, 243, 141, 128, 195, 78, 66, 215, 61, 156, // 180}; // - // public float[][] grad = { - // {1.0F,1.0F,0.0F},{-1.0F,1.0F,0.0F},{1.0F,-1.0F,0.0F},{-1.0F,-1.0F,0.0F}, - // {1.0F,0.0F,1.0F},{-1.0F,0.0F,1.0F},{1.0F,0.0F,-1.0F},{-1.0F,0.0F,-1.0F}, - // {0.0F,1.0F,1.0F},{0.0F,-1.0F,1.0F},{0.0F,1.0F,-1.0F},{0.0F,-1.0F,-1.0F} - // }; + // public float[][] grad = { + // {1.0F,1.0F,0.0F},{-1.0F,1.0F,0.0F},{1.0F,-1.0F,0.0F},{-1.0F,-1.0F,0.0F}, + // {1.0F,0.0F,1.0F},{-1.0F,0.0F,1.0F},{1.0F,0.0F,-1.0F},{-1.0F,0.0F,-1.0F}, + // {0.0F,1.0F,1.0F},{0.0F,-1.0F,1.0F},{0.0F,1.0F,-1.0F},{0.0F,-1.0F,-1.0F} + // }; // // public float noise(float xin, float yin, float zin){ - // float F3, G3, t, X0, Y0, Z0, x0, y0, z0, s, x1, y1, z1, x2, y2, z2, x3, y3, z3, t0, t1, t2, t3, n0, n1, n2, n3; - // int i, j, k, ii, jj, kk, i1, j1, k1, i2, j2, k2, gi0, gi1, gi2, gi3; + // float F3, G3, t, X0, Y0, Z0, x0, y0, z0, s, x1, y1, z1, x2, y2, z2, x3, y3, z3, t0, t1, t2, t3, n0, n1, n2, n3; + // int i, j, k, ii, jj, kk, i1, j1, k1, i2, j2, k2, gi0, gi1, gi2, gi3; // - // F3 = 1.0F/3.0F; - // s = (xin+yin+zin)*F3; - // i = (int)(xin+s); - // j = (int)(yin+s); - // k = (int)(zin+s); - // G3 = 1.0F/6.0F; - // t = (i+j+k)*G3; - // X0 = i-t; - // Y0 = j-t; - // Z0 = k-t; - // x0 = xin-X0; - // y0 = yin-Y0; - // z0 = zin-Z0; + // F3 = 1.0F/3.0F; + // s = (xin+yin+zin)*F3; + // i = (int)(xin+s); + // j = (int)(yin+s); + // k = (int)(zin+s); + // G3 = 1.0F/6.0F; + // t = (i+j+k)*G3; + // X0 = i-t; + // Y0 = j-t; + // Z0 = k-t; + // x0 = xin-X0; + // y0 = yin-Y0; + // z0 = zin-Z0; // - // if(x0 >= y0){ - // if(y0 >= z0){ - // i1=1; j1=0; k1=0; i2=1; j2=1; k2=0; - // } - // else if(x0 >= z0){ - // i1=1; j1=0; k1=0; i2=1; j2=0; k2=1; - // } - // else{ - // i1=0; j1=0; k1=1; i2=1; j2=0; k2=1; - // } - // } - // else{ - // if(y0 < z0){ - // i1=0; j1=0; k1=1; i2=0; j2=1; k2=1; - // } - // else if(x0 < z0){ - // i1=0; j1=1; k1=0; i2=0; j2=1; k2=1; - // } - // else{ - // i1=0; j1=1; k1=0; i2=1; j2=1; k2=0; - // } - // } + // if(x0 >= y0){ + // if(y0 >= z0){ + // i1=1; j1=0; k1=0; i2=1; j2=1; k2=0; + // } + // else if(x0 >= z0){ + // i1=1; j1=0; k1=0; i2=1; j2=0; k2=1; + // } + // else{ + // i1=0; j1=0; k1=1; i2=1; j2=0; k2=1; + // } + // } + // else{ + // if(y0 < z0){ + // i1=0; j1=0; k1=1; i2=0; j2=1; k2=1; + // } + // else if(x0 < z0){ + // i1=0; j1=1; k1=0; i2=0; j2=1; k2=1; + // } + // else{ + // i1=0; j1=1; k1=0; i2=1; j2=1; k2=0; + // } + // } // - // x1 = x0 - i1 + G3; - // y1 = y0 - j1 + G3; - // z1 = z0 - k1 + G3; - // x2 = x0 - i2 + 2.0F*G3; - // y2 = y0 - j2 + 2.0F*G3; - // z2 = z0 - k2 + 2.0F*G3; - // x3 = x0 - 1.0F + 3.0F*G3; - // y3 = y0 - 1.0F + 3.0F*G3; - // z3 = z0 - 1.0F + 3.0F*G3; + // x1 = x0 - i1 + G3; + // y1 = y0 - j1 + G3; + // z1 = z0 - k1 + G3; + // x2 = x0 - i2 + 2.0F*G3; + // y2 = y0 - j2 + 2.0F*G3; + // z2 = z0 - k2 + 2.0F*G3; + // x3 = x0 - 1.0F + 3.0F*G3; + // y3 = y0 - 1.0F + 3.0F*G3; + // z3 = z0 - 1.0F + 3.0F*G3; // - // ii = i & 255; - // jj = j & 255; - // kk = k & 255; + // ii = i & 255; + // jj = j & 255; + // kk = k & 255; // - // gi0 = perm[ii+perm[jj+perm[kk]]] % 12; - // gi1 = perm[ii+i1+perm[jj+j1+perm[kk+k1]]] % 12; - // gi2 = perm[ii+i2+perm[jj+j2+perm[kk+k2]]] % 12; - // gi3 = perm[ii+1+perm[jj+1+perm[kk+1]]] % 12; + // gi0 = perm[ii+perm[jj+perm[kk]]] % 12; + // gi1 = perm[ii+i1+perm[jj+j1+perm[kk+k1]]] % 12; + // gi2 = perm[ii+i2+perm[jj+j2+perm[kk+k2]]] % 12; + // gi3 = perm[ii+1+perm[jj+1+perm[kk+1]]] % 12; // - // t0 = 0.6F - x0*x0 - y0*y0 - z0*z0; - // if(t0<0){ - // n0 = 0.0F; - // } - // else{ - // t0 *= t0; - // n0 = t0 * t0 * dot(x0, y0, z0, grad[gi0]); - // } + // t0 = 0.6F - x0*x0 - y0*y0 - z0*z0; + // if(t0<0){ + // n0 = 0.0F; + // } + // else{ + // t0 *= t0; + // n0 = t0 * t0 * dot(x0, y0, z0, grad[gi0]); + // } // - // t1 = 0.6F - x1*x1 - y1*y1 - z1*z1; - // if(t1<0){ - // n1 = 0.0F; - // } - // else{ - // t1 *= t1; - // n1 = t1 * t1 * dot(x1, y1, z1, grad[gi1]); - // } + // t1 = 0.6F - x1*x1 - y1*y1 - z1*z1; + // if(t1<0){ + // n1 = 0.0F; + // } + // else{ + // t1 *= t1; + // n1 = t1 * t1 * dot(x1, y1, z1, grad[gi1]); + // } // - // t2 = 0.6F - x2*x2 - y2*y2 - z2*z2; - // if(t2<0){ - // n2 = 0.0F; - // } - // else{ - // t2 *= t2; - // n2 = t2 * t2 * dot(x2, y2, z2, grad[gi2]); - // } + // t2 = 0.6F - x2*x2 - y2*y2 - z2*z2; + // if(t2<0){ + // n2 = 0.0F; + // } + // else{ + // t2 *= t2; + // n2 = t2 * t2 * dot(x2, y2, z2, grad[gi2]); + // } // - // t3 = 0.6F - x3*x3 - y3*y3 - z3*z3; - // if(t3<0){ - // n3 = 0.0F; - // } - // else{ - // t3 *= t3; - // n3 = t3 * t3 * dot(x3, y3, z3, grad[gi3]); - // } + // t3 = 0.6F - x3*x3 - y3*y3 - z3*z3; + // if(t3<0){ + // n3 = 0.0F; + // } + // else{ + // t3 *= t3; + // n3 = t3 * t3 * dot(x3, y3, z3, grad[gi3]); + // } // - // return 16.0F*(n0 + n1 + n2 + n3)+1.0F; - // } + // return 16.0F*(n0 + n1 + n2 + n3)+1.0F; + // } // - // public float simplex_noise(int octaves, float x, float y, float z){ - // float value = 0.0F; - // int i; - // for(i=0; i= offPoint + // for (int x = spawnX - r; x <= spawnX + r; x++) { + // for (int z = spawnZ - r; z <= spawnZ + r; z++) { + // for (int y = spawnY - (r / 2); y <= spawnY + (r / 2); y++) { + // if ((int) (Utills.getDistanceAtoB(x, y, z, spawnX, spawnY + offPoint + centreThikness, spawnZ)) >= offPoint // && (int) (Utills.getDistanceAtoB(x, y, z, spawnX, spawnY - offPoint - centreThikness, spawnZ)) >= offPoint && // (int) (Utills.getDistanceAtoB(x, y, z, spawnX, spawnY, spawnZ)) <= r) { // - // int dist = (int) Math.sqrt((x-spawnX)*(x-spawnX) + (y-spawnY)*(y-spawnY) + (z-spawnZ)*(z-spawnZ)); + // int dist = (int) Math.sqrt((x-spawnX)*(x-spawnX) + (y-spawnY)*(y-spawnY) + (z-spawnZ)*(z-spawnZ)); // - // int diffusionPCt = getDiffusionPct(dist - diffStart, size - diffStart); - // int yRand = (int) (Math.max(0, getDiffusionPctD(dist - 40, size - 40)) * (double) (40 - rand.nextInt(80))); + // int diffusionPCt = getDiffusionPct(dist - diffStart, size - diffStart); + // int yRand = (int) (Math.max(0, getDiffusionPctD(dist - 40, size - 40)) * (double) (40 - rand.nextInt(80))); // - // if (dist <= diffStart) { - // if (world.isAirBlock(x, y + yRand, z)) { - // world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); - // } - // } - // else if (dist < (int) ((double) size * 0.3D) && diffusionPCt > rand.nextInt(3000)) { - // if (0.95F > rand.nextFloat()) { - // if (world.isAirBlock(x, y + yRand, z)) { - // world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); - // } - // } - // else if (world.isAirBlock(x, y + yRand, z)) { - // world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2); - // } - // } - // else if (dist < (int) ((double) size * 0.4D) && diffusionPCt > rand.nextInt(4000)) { - // if (0.95F > rand.nextFloat()) { - // if (world.isAirBlock(x, y + yRand, z)) { - // world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); - // } - // } - // else if (world.isAirBlock(x, y + yRand, z)) { - // world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2); - // } - // } - // else if (dist < (int) ((double) size * 0.5D) && diffusionPCt > rand.nextInt(5000)) { - // if (0.95F > rand.nextFloat()) { - // if (world.isAirBlock(x, y + yRand, z)) { - // world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); - // } - // } - // else if (world.isAirBlock(x, y + yRand, z)) { - // world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2); - // } - // } - // else if (dist < (int) ((double) size * 0.6D) && diffusionPCt > rand.nextInt(6000)) { - // if (0.95F > rand.nextFloat()) { - // if (world.isAirBlock(x, y + yRand, z)) { - // world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); - // } - // } - // else if (world.isAirBlock(x, y + yRand, z)) { - // world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2); - // } - // } - // else if (dist < (int) ((double) size * 0.7D) && diffusionPCt > rand.nextInt(7000)) { - // if (0.95F > rand.nextFloat()) { - // if (world.isAirBlock(x, y + yRand, z)) { - // world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); - // } - // } - // else if (world.isAirBlock(x, y + yRand, z)) { - // world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2); - // } - // } - // else if (dist < (int) ((double) size * 0.8D) && diffusionPCt > rand.nextInt(8000)) { - // if (0.95F > rand.nextFloat()) { - // if (world.isAirBlock(x, y + yRand, z)) { - // world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); - // } - // } - // else if (world.isAirBlock(x, y + yRand, z)) { - // world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2); - // } - // } - // else if (diffusionPCt > rand.nextInt(9000)) { - // if (0.95F > rand.nextFloat()) { - // if (world.isAirBlock(x, y + yRand, z)) { - // world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); - // } - // } - // else if (world.isAirBlock(x, y + yRand, z)) { - // world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2); - // } - // } - // } - // } - // } - // } - // } + // if (dist <= diffStart) { + // if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); + // } + // } + // else if (dist < (int) ((double) size * 0.3D) && diffusionPCt > rand.nextInt(3000)) { + // if (0.95F > rand.nextFloat()) { + // if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); + // } + // } + // else if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2); + // } + // } + // else if (dist < (int) ((double) size * 0.4D) && diffusionPCt > rand.nextInt(4000)) { + // if (0.95F > rand.nextFloat()) { + // if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); + // } + // } + // else if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2); + // } + // } + // else if (dist < (int) ((double) size * 0.5D) && diffusionPCt > rand.nextInt(5000)) { + // if (0.95F > rand.nextFloat()) { + // if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); + // } + // } + // else if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2); + // } + // } + // else if (dist < (int) ((double) size * 0.6D) && diffusionPCt > rand.nextInt(6000)) { + // if (0.95F > rand.nextFloat()) { + // if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); + // } + // } + // else if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2); + // } + // } + // else if (dist < (int) ((double) size * 0.7D) && diffusionPCt > rand.nextInt(7000)) { + // if (0.95F > rand.nextFloat()) { + // if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); + // } + // } + // else if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2); + // } + // } + // else if (dist < (int) ((double) size * 0.8D) && diffusionPCt > rand.nextInt(8000)) { + // if (0.95F > rand.nextFloat()) { + // if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); + // } + // } + // else if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2); + // } + // } + // else if (diffusionPCt > rand.nextInt(9000)) { + // if (0.95F > rand.nextFloat()) { + // if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2); + // } + // } + // else if (world.isAirBlock(x, y + yRand, z)) { + // world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2); + // } + // } + // } + // } + // } + // } + // } private int getDiffusionPct(int dist, int maxDist) { double d = (double) dist / (double) maxDist; @@ -454,96 +456,96 @@ public class WorldGenChaosIsland { private void generateObelisks(BlockCollection world, Random rand) { - // for (int i = 0; i < 7; i++) { - // double rotation = i * 0.9D; - // int sX = spawnX + (int) (Math.sin(rotation) * 35D); - // int sZ = spawnZ + (int) (Math.cos(rotation) * 35D); - // generateObelisk(world, sX, spawnY + 10, sZ, false, rand); - // } + // for (int i = 0; i < 7; i++) { + // double rotation = i * 0.9D; + // int sX = spawnX + (int) (Math.sin(rotation) * 35D); + // int sZ = spawnZ + (int) (Math.cos(rotation) * 35D); + // generateObelisk(world, sX, spawnY + 10, sZ, false, rand); + // } // - // for (int i = 0; i < 14; i++) { - // double rotation = i * 0.45D; - // int sX = spawnX + (int) (Math.sin(rotation) * 70D); - // int sZ = spawnZ + (int) (Math.cos(rotation) * 70D); - // generateObelisk(world, sX, spawnY + 10, sZ, true, rand); - // } + // for (int i = 0; i < 14; i++) { + // double rotation = i * 0.45D; + // int sX = spawnX + (int) (Math.sin(rotation) * 70D); + // int sZ = spawnZ + (int) (Math.cos(rotation) * 70D); + // generateObelisk(world, sX, spawnY + 10, sZ, true, rand); + // } } private void generateObelisk(BlockCollection world, int x1, int y1, int z1, boolean outer, Random rand) { - // if (!outer) { - // world.setBlock(x1, y1 + 20, z1, ModBlocks.infusedObsidian, 0, 2); - //// if (!world.isRemote) { - //// EntityChaosCrystal crystal = new EntityChaosCrystal(world); - //// crystal.setPosition(x1 + 0.5, y1 + 21, z1 + 0.5); - //// world.spawnEntityInWorld(crystal); - //// } - // for (int y = y1; y < y1 + 20; y++) { - // world.setBlock(x1, y, z1, Blocks.obsidian, 0, 2); - // world.setBlock(x1 + 1, y, z1, Blocks.obsidian, 0, 2); - // world.setBlock(x1 - 1, y, z1, Blocks.obsidian, 0, 2); - // world.setBlock(x1, y, z1 + 1, Blocks.obsidian, 0, 2); - // world.setBlock(x1, y, z1 - 1, Blocks.obsidian, 0, 2); - // world.setBlock(x1 + 1, y, z1 + 1, Blocks.obsidian, 0, 2); - // world.setBlock(x1 - 1, y, z1 - 1, Blocks.obsidian, 0, 2); - // world.setBlock(x1 + 1, y, z1 - 1, Blocks.obsidian, 0, 2); - // world.setBlock(x1 - 1, y, z1 + 1, Blocks.obsidian, 0, 2); - // } - // } else { - // world.setBlock(x1, y1 + 40, z1, ModBlocks.infusedObsidian, 0, 2); - //// if (!world.isRemote) { - //// EntityChaosCrystal crystal = new EntityChaosCrystal(world); - //// crystal.setPosition(x1 + 0.5, y1 + 41, z1 + 0.5); - //// world.spawnEntityInWorld(crystal); - //// } - // int diff = 0; - // for (int y = y1 + 20; y < y1 + 40; y++) { - // diff++; - // double pct = (double) diff / 25D; - // int r = 3; - // for (int x = x1 - r; x <= x1 + r; x++) { - // for (int z = z1 - r; z <= z1 + r; z++) { - // if (Utills.getDistanceAtoB(x, z, x1, z1) <= r) { - // if (pct > rand.nextDouble()) world.setBlock(x, y, z, Blocks.obsidian, 0, 2); - // } - // } - // } - // } + // if (!outer) { + // world.setBlock(x1, y1 + 20, z1, ModBlocks.infusedObsidian, 0, 2); + //// if (!world.isRemote) { + //// EntityChaosCrystal crystal = new EntityChaosCrystal(world); + //// crystal.setPosition(x1 + 0.5, y1 + 21, z1 + 0.5); + //// world.spawnEntityInWorld(crystal); + //// } + // for (int y = y1; y < y1 + 20; y++) { + // world.setBlock(x1, y, z1, Blocks.obsidian, 0, 2); + // world.setBlock(x1 + 1, y, z1, Blocks.obsidian, 0, 2); + // world.setBlock(x1 - 1, y, z1, Blocks.obsidian, 0, 2); + // world.setBlock(x1, y, z1 + 1, Blocks.obsidian, 0, 2); + // world.setBlock(x1, y, z1 - 1, Blocks.obsidian, 0, 2); + // world.setBlock(x1 + 1, y, z1 + 1, Blocks.obsidian, 0, 2); + // world.setBlock(x1 - 1, y, z1 - 1, Blocks.obsidian, 0, 2); + // world.setBlock(x1 + 1, y, z1 - 1, Blocks.obsidian, 0, 2); + // world.setBlock(x1 - 1, y, z1 + 1, Blocks.obsidian, 0, 2); + // } + // } else { + // world.setBlock(x1, y1 + 40, z1, ModBlocks.infusedObsidian, 0, 2); + //// if (!world.isRemote) { + //// EntityChaosCrystal crystal = new EntityChaosCrystal(world); + //// crystal.setPosition(x1 + 0.5, y1 + 41, z1 + 0.5); + //// world.spawnEntityInWorld(crystal); + //// } + // int diff = 0; + // for (int y = y1 + 20; y < y1 + 40; y++) { + // diff++; + // double pct = (double) diff / 25D; + // int r = 3; + // for (int x = x1 - r; x <= x1 + r; x++) { + // for (int z = z1 - r; z <= z1 + r; z++) { + // if (Utills.getDistanceAtoB(x, z, x1, z1) <= r) { + // if (pct > rand.nextDouble()) world.setBlock(x, y, z, Blocks.obsidian, 0, 2); + // } + // } + // } + // } // // - // int cageS = 2; - // for (int x = x1 - cageS; x <= x1 + cageS; x++) { - // for (int y = y1 - cageS; y <= y1 + cageS; y++) { - // if (0.8F > rand.nextFloat()) world.setBlock(x, y + 41, z1 + cageS, Blocks.iron_bars, 0, 2); - // if (0.8F > rand.nextFloat()) world.setBlock(x, y + 41, z1 - cageS, Blocks.iron_bars, 0, 2); - // } - // } - // for (int z = z1 - cageS; z <= z1 + cageS; z++) { - // for (int y = y1 - cageS; y <= y1 + cageS; y++) { - // if (0.8F > rand.nextFloat()) world.setBlock(x1 + cageS, y + 41, z, Blocks.iron_bars, 0, 2); - // if (0.8F > rand.nextFloat()) world.setBlock(x1 - cageS, y + 41, z, Blocks.iron_bars, 0, 2); - // } - // } - // for (int z = z1 - cageS; z <= z1 + cageS; z++) { - // for (int x = x1 - cageS; x <= x1 + cageS; x++) { - // if (0.8F > rand.nextFloat()) world.setBlock(x, y1 + 44, z, Blocks.stone_slab, 6, 2); - // } - // } + // int cageS = 2; + // for (int x = x1 - cageS; x <= x1 + cageS; x++) { + // for (int y = y1 - cageS; y <= y1 + cageS; y++) { + // if (0.8F > rand.nextFloat()) world.setBlock(x, y + 41, z1 + cageS, Blocks.iron_bars, 0, 2); + // if (0.8F > rand.nextFloat()) world.setBlock(x, y + 41, z1 - cageS, Blocks.iron_bars, 0, 2); + // } + // } + // for (int z = z1 - cageS; z <= z1 + cageS; z++) { + // for (int y = y1 - cageS; y <= y1 + cageS; y++) { + // if (0.8F > rand.nextFloat()) world.setBlock(x1 + cageS, y + 41, z, Blocks.iron_bars, 0, 2); + // if (0.8F > rand.nextFloat()) world.setBlock(x1 - cageS, y + 41, z, Blocks.iron_bars, 0, 2); + // } + // } + // for (int z = z1 - cageS; z <= z1 + cageS; z++) { + // for (int x = x1 - cageS; x <= x1 + cageS; x++) { + // if (0.8F > rand.nextFloat()) world.setBlock(x, y1 + 44, z, Blocks.stone_slab, 6, 2); + // } + // } // - // } + // } } private void generateBelt(BlockCollection world, Random random, int innerRadius, int outerRadius) { - // int r = outerRadius; - // for (int x = spawnX - r; x <= spawnX + r; x++) { - // for (int z = spawnZ - r; z <= spawnZ + r; z++) { - // int dist = (int) (Utills.getDistanceAtoB(x, z, spawnX, spawnZ)); - // if (dist < outerRadius && dist >= innerRadius) { - // int y = spawnY + (int) ((double) (spawnX - x) * 0.2D) + (random.nextInt(10) - 5); - // if (0.1F > random.nextFloat()) world.setBlock(x, y, z, Blocks.end_stone, 0, 2); - // if (0.001F > random.nextFloat()) world.setBlock(x, y, z, ModBlocks.draconiumOre, 0, 2); - // } - // } - // } + // int r = outerRadius; + // for (int x = spawnX - r; x <= spawnX + r; x++) { + // for (int z = spawnZ - r; z <= spawnZ + r; z++) { + // int dist = (int) (Utills.getDistanceAtoB(x, z, spawnX, spawnZ)); + // if (dist < outerRadius && dist >= innerRadius) { + // int y = spawnY + (int) ((double) (spawnX - x) * 0.2D) + (random.nextInt(10) - 5); + // if (0.1F > random.nextFloat()) world.setBlock(x, y, z, Blocks.end_stone, 0, 2); + // if (0.001F > random.nextFloat()) world.setBlock(x, y, z, ModBlocks.draconiumOre, 0, 2); + // } + // } + // } } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenEnderComet.java b/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenEnderComet.java index 4517a44e..162d1f95 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenEnderComet.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenEnderComet.java @@ -1,11 +1,13 @@ package com.brandon3055.draconicevolution.common.world; -import com.brandon3055.draconicevolution.common.ModBlocks; import java.util.Random; + import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; +import com.brandon3055.draconicevolution.common.ModBlocks; + /** * Created by Brandon on 28/08/2014. */ @@ -89,8 +91,7 @@ public class WorldGenEnderComet extends WorldGenerator { for (int x = xi - r; x <= xi + r; x++) { for (int z = zi - r; z <= zi + r; z++) { for (int y = yi - r; y <= yi + r; y++) { - if ((density >= rand.nextInt(10000)) - && world.isAirBlock(x, y, z) + if ((density >= rand.nextInt(10000)) && world.isAirBlock(x, y, z) && (int) (getDistance(x, y, z, xi, yi, zi)) == r) { if (0.9F >= rand.nextFloat()) world.setBlock(x, y, z, Blocks.end_stone, 0, 2); else if (rand.nextBoolean()) world.setBlock(x, y, z, Blocks.obsidian, 0, 2); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenEnderIsland.java b/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenEnderIsland.java index 83131545..8a6e9d65 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenEnderIsland.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenEnderIsland.java @@ -1,12 +1,14 @@ package com.brandon3055.draconicevolution.common.world; +import java.util.Random; + +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenerator; + import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.entity.EntityChaosCrystal; import com.brandon3055.draconicevolution.common.entity.EntityChaosGuardian; -import java.util.Random; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; -import net.minecraft.world.gen.feature.WorldGenerator; /** * Created by Brandon on 29/08/2014. diff --git a/src/main/java/com/brandon3055/draconicevolution/integration/ModHelper.java b/src/main/java/com/brandon3055/draconicevolution/integration/ModHelper.java index d347f258..56b35a56 100644 --- a/src/main/java/com/brandon3055/draconicevolution/integration/ModHelper.java +++ b/src/main/java/com/brandon3055/draconicevolution/integration/ModHelper.java @@ -1,13 +1,15 @@ package com.brandon3055.draconicevolution.integration; -import com.brandon3055.draconicevolution.common.items.armor.CustomArmorHandler.ArmorSummery; -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.event.entity.living.LivingAttackEvent; +import com.brandon3055.draconicevolution.common.items.armor.CustomArmorHandler.ArmorSummery; + +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.registry.GameRegistry; + /** * Created by brandon3055 on 29/9/2015. */ @@ -31,49 +33,43 @@ public class ModHelper { // isRotaryCraftInstalled = Loader.isModLoaded("RotaryCraft"); isGregTechInstalled = Loader.isModLoaded("gregtech"); - if (isGregTechInstalled) - try { - GTores = Class.forName("gregtech.common.blocks.GT_TileEntity_Ores"); - } catch (ClassNotFoundException e) { - } - if (Loader.isModLoaded("bartworks")) - try { - bwores = Class.forName("com.github.bartimaeusnek.bartworks.system.material.BW_MetaGeneratedOreTE"); - } catch (ClassNotFoundException e) { - } + if (isGregTechInstalled) try { + GTores = Class.forName("gregtech.common.blocks.GT_TileEntity_Ores"); + } catch (ClassNotFoundException e) {} + if (Loader.isModLoaded("bartworks")) try { + bwores = Class.forName("com.github.bartimaeusnek.bartworks.system.material.BW_MetaGeneratedOreTE"); + } catch (ClassNotFoundException e) {} } public static boolean isHoldingCleaver(EntityPlayer player) { if (!isTConInstalled) return false; else if (cleaver == null) cleaver = GameRegistry.findItem("TConstruct", "cleaver"); - return cleaver != null - && player.getHeldItem() != null - && player.getHeldItem().getItem().equals(cleaver); + return cleaver != null && player.getHeldItem() != null && player.getHeldItem().getItem().equals(cleaver); } public static boolean isHoldingAvaritiaSword(EntityPlayer player) { if (!isAvaritiaInstalled) return false; else if (avaritiaSword == null) avaritiaSword = GameRegistry.findItem("Avaritia", "Infinity_Sword"); - return avaritiaSword != null - && player.getHeldItem() != null + return avaritiaSword != null && player.getHeldItem() != null && player.getHeldItem().getItem().equals(avaritiaSword); } - // public static boolean isHoldingBedrockSword(EntityPlayer player) { - // if (!isRotaryCraftInstalled) return false; - // else if (bedrockSword == null) bedrockSword = GameRegistry.findItem("RotaryCraft", + // public static boolean isHoldingBedrockSword(EntityPlayer player) { + // if (!isRotaryCraftInstalled) return false; + // else if (bedrockSword == null) bedrockSword = GameRegistry.findItem("RotaryCraft", // "rotarycraft_item_bedsword"); // - // return bedrockSword != null && player.getHeldItem() != null && + // return bedrockSword != null && player.getHeldItem() != null && // player.getHeldItem().getItem().equals(bedrockSword); - // } + // } public static float applyModDamageAdjustments(ArmorSummery summery, LivingAttackEvent event) { if (summery == null) return event.ammount; - EntityPlayer attacker = - event.source.getEntity() instanceof EntityPlayer ? (EntityPlayer) event.source.getEntity() : null; + EntityPlayer attacker = event.source.getEntity() instanceof EntityPlayer + ? (EntityPlayer) event.source.getEntity() + : null; if (attacker == null) { return event.ammount; @@ -83,15 +79,15 @@ public class ModHelper { event.entityLiving.hurtResistantTime = 0; return 300F; } - // else if (isHoldingBedrockSword(attacker)) { - // summery.entropy += 10; + // else if (isHoldingBedrockSword(attacker)) { + // summery.entropy += 10; // - // if (summery.entropy > 100) { - // summery.entropy = 100; - // } + // if (summery.entropy > 100) { + // summery.entropy = 100; + // } // - // return Math.max(event.ammount, Math.min(50F, summery.protectionPoints)); - // } + // return Math.max(event.ammount, Math.min(50F, summery.protectionPoints)); + // } else if (event.source.isUnblockable() || event.source.canHarmInCreative()) { summery.entropy += 3; diff --git a/src/main/java/com/brandon3055/draconicevolution/integration/computers/CCOCIntegration.java b/src/main/java/com/brandon3055/draconicevolution/integration/computers/CCOCIntegration.java index 5cc91b47..936faa70 100644 --- a/src/main/java/com/brandon3055/draconicevolution/integration/computers/CCOCIntegration.java +++ b/src/main/java/com/brandon3055/draconicevolution/integration/computers/CCOCIntegration.java @@ -1,17 +1,20 @@ package com.brandon3055.draconicevolution.integration.computers; +import li.cil.oc.api.Driver; +import li.cil.oc.api.network.ManagedEnvironment; +import li.cil.oc.api.prefab.DriverTileEntity; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + import com.brandon3055.draconicevolution.integration.computers.cc.CCAdapter; import com.brandon3055.draconicevolution.integration.computers.oc.DEManagedPeripheral; + import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Optional; import dan200.computercraft.api.ComputerCraftAPI; import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.api.peripheral.IPeripheralProvider; -import li.cil.oc.api.Driver; -import li.cil.oc.api.network.ManagedEnvironment; -import li.cil.oc.api.prefab.DriverTileEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; /** * Created by brandon3055 on 21/9/2015. diff --git a/src/main/java/com/brandon3055/draconicevolution/integration/computers/cc/CCAdapter.java b/src/main/java/com/brandon3055/draconicevolution/integration/computers/cc/CCAdapter.java index e89c2125..32d1bbae 100644 --- a/src/main/java/com/brandon3055/draconicevolution/integration/computers/cc/CCAdapter.java +++ b/src/main/java/com/brandon3055/draconicevolution/integration/computers/cc/CCAdapter.java @@ -1,6 +1,7 @@ package com.brandon3055.draconicevolution.integration.computers.cc; import com.brandon3055.draconicevolution.integration.computers.IDEPeripheral; + import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.lua.LuaException; import dan200.computercraft.api.peripheral.IComputerAccess; @@ -10,6 +11,7 @@ import dan200.computercraft.api.peripheral.IPeripheral; * Created by brandon3055 on 21/9/2015. */ public class CCAdapter implements IPeripheral { + private IDEPeripheral peripheral; public CCAdapter(IDEPeripheral peripheral) { diff --git a/src/main/java/com/brandon3055/draconicevolution/integration/computers/oc/DEManagedPeripheral.java b/src/main/java/com/brandon3055/draconicevolution/integration/computers/oc/DEManagedPeripheral.java index 57ff0302..4d4266c9 100644 --- a/src/main/java/com/brandon3055/draconicevolution/integration/computers/oc/DEManagedPeripheral.java +++ b/src/main/java/com/brandon3055/draconicevolution/integration/computers/oc/DEManagedPeripheral.java @@ -1,16 +1,18 @@ package com.brandon3055.draconicevolution.integration.computers.oc; -import com.brandon3055.draconicevolution.integration.computers.IDEPeripheral; import li.cil.oc.api.driver.NamedBlock; import li.cil.oc.api.machine.Arguments; import li.cil.oc.api.machine.Context; import li.cil.oc.api.network.ManagedPeripheral; import li.cil.oc.api.prefab.ManagedEnvironment; +import com.brandon3055.draconicevolution.integration.computers.IDEPeripheral; + /** * Created by brandon3055 on 22/9/2015. */ public class DEManagedPeripheral extends ManagedEnvironment implements ManagedPeripheral, NamedBlock { + private IDEPeripheral peripheral; public DEManagedPeripheral(IDEPeripheral peripheral) { diff --git a/src/main/java/com/brandon3055/draconicevolution/integration/nei/CraftingChestOverlayHandler.java b/src/main/java/com/brandon3055/draconicevolution/integration/nei/CraftingChestOverlayHandler.java index 419aa7b5..54aae478 100644 --- a/src/main/java/com/brandon3055/draconicevolution/integration/nei/CraftingChestOverlayHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/integration/nei/CraftingChestOverlayHandler.java @@ -1,23 +1,28 @@ package com.brandon3055.draconicevolution.integration.nei; +import java.util.*; + +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + import codechicken.lib.inventory.InventoryUtils; import codechicken.nei.FastTransferManager; import codechicken.nei.PositionedStack; import codechicken.nei.api.IOverlayHandler; import codechicken.nei.recipe.IRecipeHandler; + import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; import com.brandon3055.draconicevolution.common.utills.LogHelper; -import java.util.*; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; /** * Created by Brandon on 30/10/2014. */ public class CraftingChestOverlayHandler implements IOverlayHandler { + public static class DistributedIngred { + public DistributedIngred(ItemStack item) { stack = InventoryUtils.copyStack(item, 1); } @@ -30,6 +35,7 @@ public class CraftingChestOverlayHandler implements IOverlayHandler { } public static class IngredientDistribution { + public IngredientDistribution(DistributedIngred distrib, ItemStack permutation) { this.distrib = distrib; this.permutation = permutation; @@ -63,14 +69,13 @@ public class CraftingChestOverlayHandler implements IOverlayHandler { private boolean clearIngredients(GuiContainer gui, List ingreds) { int offsetx = getOffsetX(gui); int offsety = getOffsetY(gui); - for (PositionedStack pstack : ingreds) - for (Slot slot : (List) gui.inventorySlots.inventorySlots) - if (slot.xDisplayPosition == pstack.relx + offsetx && slot.yDisplayPosition == pstack.rely + offsety) { - if (!slot.getHasStack()) continue; + for (PositionedStack pstack : ingreds) for (Slot slot : (List) gui.inventorySlots.inventorySlots) + if (slot.xDisplayPosition == pstack.relx + offsetx && slot.yDisplayPosition == pstack.rely + offsety) { + if (!slot.getHasStack()) continue; - FastTransferManager.clickSlot(gui, slot.slotNumber, 0, 1); - if (slot.getHasStack()) return false; - } + FastTransferManager.clickSlot(gui, slot.slotNumber, 0, 1); + if (slot.getHasStack()) return false; + } return true; } @@ -130,8 +135,8 @@ public class CraftingChestOverlayHandler implements IOverlayHandler { return quantity; } - private Slot[][] assignIngredSlots( - GuiContainer gui, List ingredients, List assignedIngredients) { + private Slot[][] assignIngredSlots(GuiContainer gui, List ingredients, + List assignedIngredients) { Slot[][] recipeSlots = mapIngredSlots(gui, ingredients); // setup the slot map HashMap distribution = new HashMap(); @@ -147,7 +152,7 @@ public class CraftingChestOverlayHandler implements IOverlayHandler { } while (avaliableSlots.size() > 0 && remainingIngreds.size() > 0) { - for (Iterator iterator = remainingIngreds.iterator(); iterator.hasNext(); ) { + for (Iterator iterator = remainingIngreds.iterator(); iterator.hasNext();) { int i = iterator.next(); boolean assigned = false; DistributedIngred istack = assignedIngredients.get(i).distrib; @@ -174,8 +179,8 @@ public class CraftingChestOverlayHandler implements IOverlayHandler { return recipeSlots; } - private List assignIngredients( - List ingredients, List ingredStacks) { + private List assignIngredients(List ingredients, + List ingredStacks) { ArrayList assignedIngredients = new ArrayList(); for (PositionedStack posstack : ingredients) // assign what we need and have { @@ -187,9 +192,14 @@ public class CraftingChestOverlayHandler implements IOverlayHandler { for (int j = 0; j < ingredStacks.size(); j++) { DistributedIngred istack = ingredStacks.get(j); if (!InventoryUtils.canStack(pstack, istack.stack) - || istack.invAmount - istack.distributed < pstack.stackSize) continue; - LogHelper.info(istack.invAmount - istack.invAmount + " " + istack.recipeAmount * istack.distributed - + " " + pstack.stackSize); + || istack.invAmount - istack.distributed < pstack.stackSize) + continue; + LogHelper.info( + istack.invAmount - istack.invAmount + + " " + + istack.recipeAmount * istack.distributed + + " " + + pstack.stackSize); int relsize = (istack.invAmount - istack.invAmount / istack.recipeAmount * istack.distributed) / pstack.stackSize; if (relsize > biggestSize) { @@ -202,7 +212,7 @@ public class CraftingChestOverlayHandler implements IOverlayHandler { } if (biggestIngred == null) // not enough ingreds - return null; + return null; biggestIngred.distributed += permutation.stackSize; assignedIngredients.add(new IngredientDistribution(biggestIngred, permutation)); diff --git a/src/main/java/com/brandon3055/draconicevolution/integration/nei/CraftingChestStackPositioner.java b/src/main/java/com/brandon3055/draconicevolution/integration/nei/CraftingChestStackPositioner.java index 7c1fe5aa..fed2fa38 100644 --- a/src/main/java/com/brandon3055/draconicevolution/integration/nei/CraftingChestStackPositioner.java +++ b/src/main/java/com/brandon3055/draconicevolution/integration/nei/CraftingChestStackPositioner.java @@ -1,12 +1,15 @@ package com.brandon3055.draconicevolution.integration.nei; +import java.util.ArrayList; + +import net.minecraft.client.Minecraft; + import codechicken.nei.PositionedStack; import codechicken.nei.api.IStackPositioner; import codechicken.nei.recipe.GuiRecipe; + import com.brandon3055.draconicevolution.client.gui.GUIDraconiumChest; import com.brandon3055.draconicevolution.common.utills.LogHelper; -import java.util.ArrayList; -import net.minecraft.client.Minecraft; /** * Created by Brandon on 30/10/2014. diff --git a/src/main/java/com/brandon3055/draconicevolution/integration/nei/DENEIGuiHandler.java b/src/main/java/com/brandon3055/draconicevolution/integration/nei/DENEIGuiHandler.java index 45555bbc..b185aafc 100644 --- a/src/main/java/com/brandon3055/draconicevolution/integration/nei/DENEIGuiHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/integration/nei/DENEIGuiHandler.java @@ -1,15 +1,18 @@ package com.brandon3055.draconicevolution.integration.nei; +import java.util.Collections; +import java.util.List; + +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.item.ItemStack; + import codechicken.nei.VisiblityData; import codechicken.nei.api.INEIGuiHandler; import codechicken.nei.api.TaggedInventoryArea; + import com.brandon3055.draconicevolution.client.gui.GUIUpgradeModifier; import com.brandon3055.draconicevolution.client.gui.componentguis.GUIManual; import com.brandon3055.draconicevolution.client.gui.componentguis.GUIToolConfig; -import java.util.Collections; -import java.util.List; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.item.ItemStack; /** * Created by brandon3055 on 27/1/2016. diff --git a/src/main/java/com/brandon3055/draconicevolution/integration/nei/NEIDraconicevolutionConfig.java b/src/main/java/com/brandon3055/draconicevolution/integration/nei/NEIDraconicevolutionConfig.java index 1a3290ba..f10c74ed 100644 --- a/src/main/java/com/brandon3055/draconicevolution/integration/nei/NEIDraconicevolutionConfig.java +++ b/src/main/java/com/brandon3055/draconicevolution/integration/nei/NEIDraconicevolutionConfig.java @@ -1,18 +1,21 @@ package com.brandon3055.draconicevolution.integration.nei; +import net.minecraft.item.ItemStack; + import codechicken.nei.api.API; import codechicken.nei.api.IConfigureNEI; + import com.brandon3055.draconicevolution.client.gui.GUIDraconiumChest; import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.utills.LogHelper; -import net.minecraft.item.ItemStack; /** * Created by Brandon on 30/10/2014. */ public class NEIDraconicevolutionConfig implements IConfigureNEI { + @Override public void loadConfig() {