From 7620d7ff021c1107cb502de38ebb1f7294d00f99 Mon Sep 17 00:00:00 2001 From: Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> Date: Sat, 14 Feb 2026 07:57:20 +0000 Subject: [PATCH] BrandonCore deprecation (#86) Co-authored-by: Connor Colenso Co-authored-by: Martin Robertz Co-authored-by: Ruling-0 <47913168+Ruling-0@users.noreply.github.com> --- dependencies.gradle | 15 +- .../draconicevolution/DraconicEvolution.java | 11 +- .../api/GeneratorOverride.java | 10 +- .../draconicevolution/client/ClientProxy.java | 89 ++-- .../client/creativetab/DETab.java | 2 +- .../client/gui/GUIContainerTemplate.java | 69 --- .../client/gui/GUIDraconiumChest.java | 2 +- .../client/gui/GUIEnergyInfuser.java | 14 +- .../client/gui/GUIFlowGate.java | 7 +- .../client/gui/GUIGenerator.java | 40 +- .../client/gui/GUIGrinder.java | 33 +- .../client/gui/GUITeleporter.java | 24 +- .../client/gui/GUIUpgradeModifier.java | 6 +- .../client/gui/GuiHudConfig.java | 4 +- .../client/gui/componentguis/GUIManual.java | 20 +- .../client/gui/componentguis/GUIReactor.java | 43 +- .../gui/componentguis/GUIToolConfig.java | 27 +- .../gui/componentguis/GUIToolInventory.java | 12 +- .../client/gui/componentguis/ManualPage.java | 2 +- .../ComponentConfigItemButton.java | 8 +- .../ComponentContributorsPage.java | 10 +- .../guicomponents/ComponentFieldAdjuster.java | 12 +- .../guicomponents/ComponentFieldButton.java | 10 +- .../guicomponents/ComponentIndexButton.java | 8 +- .../guicomponents/ComponentManualPage.java | 16 +- .../client/handler/ClientEventHandler.java | 12 +- .../client/handler/HudHandler.java | 11 +- .../client/handler/ResourceHandler.java | 4 +- .../client/keybinding/KeyInputHandler.java | 6 +- .../render/block/RenderDraconiumChest.java | 2 +- .../client/render/item/RenderArmor.java | 2 +- .../client/render/item/RenderMobSoul.java | 4 +- .../render/particle/ParticleEnergyBeam.java | 5 +- .../client/render/particle/Particles.java | 18 +- .../tile/RenderTileTeleporterStand.java | 6 +- .../render/tile/RenderTileTestBlock.java | 72 --- .../client/utils/ClientUtils.java | 24 + .../CustomResourceLocation.java | 2 +- .../client/utils/GuiHelper.java | 140 +++++ .../utils/guicomponents/ComponentBase.java | 224 ++++++++ .../utils/guicomponents/ComponentButton.java | 122 +++++ .../guicomponents/ComponentCollection.java | 170 +++++++ .../guicomponents/ComponentItemRenderer.java | 50 ++ .../guicomponents/ComponentScrollingBase.java | 21 + .../ComponentSlotBackground.java | 48 ++ .../guicomponents/ComponentTextField.java | 71 +++ .../guicomponents/ComponentTextureButton.java | 91 ++++ .../guicomponents/ComponentTexturedRect.java | 68 +++ .../client/utils/guicomponents/GUIBase.java | 142 ++++++ .../utils/guicomponents/GUIScrollingBase.java | 76 +++ .../draconicevolution/common/CommonProxy.java | 68 +-- .../draconicevolution/common/ModBlocks.java | 9 - .../common/achievements/Achievements.java | 2 +- .../common/blocks/BlockContainerTemplate.java | 105 ---- .../common/blocks/BlockCustomDrop.java | 2 +- .../common/blocks/CKeyStone.java | 2 +- .../common/blocks/CustomSpawner.java | 8 +- .../common/blocks/DraconiumChest.java | 2 +- .../common/blocks/TeleporterStand.java | 2 +- .../itemblocks/ItemBlockCustomData.java | 2 +- .../common/blocks/machine/EnergyCrystal.java | 26 +- .../common/blocks/machine/FlowGate.java | 4 +- .../common/blocks/machine/Generator.java | 2 +- .../blocks/machine/LongRangeDislocator.java | 2 +- .../blocks/multiblock/EnergyStorageCore.java | 4 +- .../multiblock/InvisibleMultiblock.java | 4 +- .../multiblock/ReactorEnergyInjector.java | 4 +- .../blocks/multiblock/ReactorStabilizer.java | 4 +- .../common/container/ContainerAdvTool.java | 2 +- .../container/ContainerDissEnchanter.java | 2 +- .../common/container/ContainerReactor.java | 2 +- .../common/container/ContainerTemplate.java | 74 --- .../container/ContainerUpgradeModifier.java | 4 +- .../common/entity/ChaosImplosion.java | 8 +- .../common/entity/ChaosImplosionTrace.java | 2 +- .../common/entity/EntityChaosDrill.java | 6 +- .../common/entity/EntityChaosGuardian.java | 40 +- .../common/entity/EntityChaosVortex.java | 2 +- .../common/entity/EntityCustomDragon.java | 4 +- .../common/entity/EntityDragonHeart.java | 4 +- .../common/entity/EntityDragonProjectile.java | 12 +- .../common/entity/EntityEnderArrow.java | 4 +- .../common/handler/BalanceConfigHandler.java | 2 +- .../common/handler/ConfigHandler.java | 2 +- .../common/handler/ContributorHandler.java | 4 +- .../common/handler/CraftingHandler.java | 6 +- .../common/handler/FMLEventHandler.java | 2 +- .../handler/MinecraftForgeEventHandler.java | 14 +- .../common/inventory/InventoryTool.java | 6 +- .../common/items/DraconicCore.java | 4 +- .../draconicevolution/common/items/Key.java | 2 +- .../common/items/MobSoul.java | 12 +- .../common/items/Tclogo.java | 2 +- .../items/armor/CustomArmorHandler.java | 9 +- .../common/items/armor/DraconicArmor.java | 30 +- .../common/items/armor/WyvernArmor.java | 24 +- .../common/items/tools/AdminSpawnEgg.java | 4 +- .../common/items/tools/DraconicAxe.java | 8 +- .../items/tools/DraconicDistructionStaff.java | 14 +- .../common/items/tools/DraconicHoe.java | 27 +- .../common/items/tools/DraconicPickaxe.java | 6 +- .../common/items/tools/DraconicShovel.java | 6 +- .../items/tools/DraconiumFluxCapacitor.java | 14 +- .../common/items/tools/Magnet.java | 10 +- .../items/tools/ObliterationCatalyst.java | 2 +- .../common/items/tools/SafetyMatch.java | 2 +- .../common/items/tools/TeleporterMKI.java | 11 +- .../common/items/tools/TeleporterMKII.java | 14 +- .../common/items/tools/Wrench.java | 4 +- .../common/items/tools/WyvernPickaxe.java | 6 +- .../common/items/tools/WyvernShovel.java | 6 +- .../items/tools/baseclasses/MiningTool.java | 27 +- .../items/tools/baseclasses/RFItemBase.java | 17 +- .../items/tools/baseclasses/ToolBase.java | 23 +- .../items/tools/baseclasses/ToolHandler.java | 4 +- .../common/items/weapons/BowHandler.java | 4 +- .../common/items/weapons/DraconicBow.java | 41 +- .../common/items/weapons/DraconicSword.java | 28 +- .../common/items/weapons/WyvernBow.java | 44 +- .../common/items/weapons/WyvernSword.java | 30 +- .../common/lib/References.java | 2 - .../common/network/ButtonPacket.java | 4 +- .../common/network/ContributorPacket.java | 3 +- .../common/network/GenericParticlePacket.java | 26 +- .../common/network/ItemConfigPacket.java | 16 +- .../common/network/MagnetToggleAckPacket.java | 2 +- .../common/network/MagnetTogglePacket.java | 2 +- .../MagnetToggleSelfPickupAckPacket.java | 2 +- .../network/MagnetToggleSelfPickupPacket.java | 2 +- .../common/network/ShieldHitPacket.java | 4 +- .../common/network/SpeedRequestPacket.java | 6 +- .../common/network/TeleporterPacket.java | 22 +- .../common/network/TileObjectPacket.java | 6 +- .../common/tileentities/TileCKeyStone.java | 2 +- .../tileentities/TileContainerTemplate.java | 156 ------ .../tileentities/TileDissEnchanter.java | 2 +- .../tileentities/TileDraconiumChest.java | 6 +- .../tileentities/TileEnergyInfuser.java | 2 +- .../common/tileentities/TileGenerator.java | 2 +- .../common/tileentities/TileGrinder.java | 2 +- .../common/tileentities/TilePlacedItem.java | 2 +- .../common/tileentities/TileTestBlock.java | 70 +-- .../energynet/IRemoteEnergyHandler.java | 2 +- .../energynet/TileRemoteEnergyBase.java | 20 +- .../TileWirelessEnergyTransceiver.java | 4 +- .../tileentities/gates/TileFluidGate.java | 7 +- .../tileentities/gates/TileFluxGate.java | 5 +- .../common/tileentities/gates/TileGate.java | 8 +- .../TileDislocatorReceptacle.java | 4 +- .../TileEnderResurrection.java | 2 +- .../TileEnergyStorageCore.java | 13 +- .../TileInvisibleMultiblock.java | 2 +- .../multiblocktiles/TilePortalBlock.java | 4 +- .../reactor/ReactorExplosion.java | 8 +- .../reactor/ReactorExplosionTrace.java | 2 +- .../reactor/TileReactorCore.java | 20 +- .../reactor/TileReactorStabilizer.java | 2 +- .../common/utills/IInventoryTool.java | 15 - .../common/utills/InventoryUtils.java | 54 -- .../{utills => utils}/DamageSourceChaos.java | 2 +- .../common/utils/DataUtils.java | 261 ++++++++++ .../{utills => utils}/DragonChunkLoader.java | 2 +- .../{utills => utils}/EnergyStorage.java | 8 +- .../{utills => utils}/IConfigurableItem.java | 12 +- .../{utills => utils}/ICustomItemData.java | 4 +- .../{utills => utils}/IHudDisplayBlock.java | 2 +- .../{utills => utils}/IHudDisplayItem.java | 2 +- .../common/utils/IInventoryTool.java | 15 + .../{utills => utils}/IUpgradableItem.java | 21 +- .../common/utils/InfoHelper.java | 141 ++++++ .../common/utils/InventoryUtils.java | 436 ++++++++++++++++ .../{utills => utils}/ItemConfigField.java | 41 +- .../common/utils/ItemNBTHelper.java | 109 ++++ .../common/{utills => utils}/LogHelper.java | 3 +- .../OreDictionaryHelper.java | 2 +- .../common/utils/PlayerUtils.java | 19 + .../{utills => utils}/PortalHelper.java | 6 +- .../ShapedOreEnergyRecipe.java | 14 +- .../common/utils/SimplexNoise.java | 479 ++++++++++++++++++ .../common/utils/Teleporter.java | 319 ++++++++++++ .../draconicevolution/common/utils/Utils.java | 145 ++++++ .../common/utils/handlers/FileHandler.java | 19 + .../common/utils/handlers/IProcess.java | 11 + .../common/utils/handlers/ProcessHandler.java | 61 +++ .../common/utils/lib/References.java | 19 + .../common/world/ChaosWorldGenHandler.java | 47 +- .../common/world/WorldGenEnderIsland.java | 8 +- .../integration/ModHelper.java | 2 +- .../nei/CraftingChestOverlayHandler.java | 2 +- .../nei/CraftingChestStackPositioner.java | 2 +- .../nei/NEIDraconicevolutionConfig.java | 2 +- .../brandonscore/textures/gui/Widgets.png | Bin 0 -> 8916 bytes 192 files changed, 4029 insertions(+), 1474 deletions(-) delete mode 100644 src/main/java/com/brandon3055/draconicevolution/client/gui/GUIContainerTemplate.java delete mode 100644 src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileTestBlock.java create mode 100644 src/main/java/com/brandon3055/draconicevolution/client/utils/ClientUtils.java rename src/main/java/com/brandon3055/draconicevolution/client/{utill => utils}/CustomResourceLocation.java (93%) create mode 100644 src/main/java/com/brandon3055/draconicevolution/client/utils/GuiHelper.java create mode 100644 src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentBase.java create mode 100644 src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentButton.java create mode 100644 src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentCollection.java create mode 100644 src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentItemRenderer.java create mode 100644 src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentScrollingBase.java create mode 100644 src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentSlotBackground.java create mode 100644 src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentTextField.java create mode 100644 src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentTextureButton.java create mode 100644 src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentTexturedRect.java create mode 100644 src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/GUIBase.java create mode 100644 src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/GUIScrollingBase.java delete mode 100644 src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockContainerTemplate.java delete mode 100644 src/main/java/com/brandon3055/draconicevolution/common/container/ContainerTemplate.java delete mode 100644 src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileContainerTemplate.java delete mode 100644 src/main/java/com/brandon3055/draconicevolution/common/utills/IInventoryTool.java delete mode 100644 src/main/java/com/brandon3055/draconicevolution/common/utills/InventoryUtils.java rename src/main/java/com/brandon3055/draconicevolution/common/{utills => utils}/DamageSourceChaos.java (87%) create mode 100644 src/main/java/com/brandon3055/draconicevolution/common/utils/DataUtils.java rename src/main/java/com/brandon3055/draconicevolution/common/{utills => utils}/DragonChunkLoader.java (98%) rename src/main/java/com/brandon3055/draconicevolution/common/{utills => utils}/EnergyStorage.java (95%) rename src/main/java/com/brandon3055/draconicevolution/common/{utills => utils}/IConfigurableItem.java (89%) rename src/main/java/com/brandon3055/draconicevolution/common/{utills => utils}/ICustomItemData.java (72%) rename src/main/java/com/brandon3055/draconicevolution/common/{utills => utils}/IHudDisplayBlock.java (78%) rename src/main/java/com/brandon3055/draconicevolution/common/{utills => utils}/IHudDisplayItem.java (77%) create mode 100644 src/main/java/com/brandon3055/draconicevolution/common/utils/IInventoryTool.java rename src/main/java/com/brandon3055/draconicevolution/common/{utills => utils}/IUpgradableItem.java (93%) create mode 100644 src/main/java/com/brandon3055/draconicevolution/common/utils/InfoHelper.java create mode 100644 src/main/java/com/brandon3055/draconicevolution/common/utils/InventoryUtils.java rename src/main/java/com/brandon3055/draconicevolution/common/{utills => utils}/ItemConfigField.java (80%) create mode 100644 src/main/java/com/brandon3055/draconicevolution/common/utils/ItemNBTHelper.java rename src/main/java/com/brandon3055/draconicevolution/common/{utills => utils}/LogHelper.java (93%) rename src/main/java/com/brandon3055/draconicevolution/common/{utills => utils}/OreDictionaryHelper.java (88%) create mode 100644 src/main/java/com/brandon3055/draconicevolution/common/utils/PlayerUtils.java rename src/main/java/com/brandon3055/draconicevolution/common/{utills => utils}/PortalHelper.java (97%) rename src/main/java/com/brandon3055/draconicevolution/common/{utills => utils}/ShapedOreEnergyRecipe.java (71%) create mode 100644 src/main/java/com/brandon3055/draconicevolution/common/utils/SimplexNoise.java create mode 100644 src/main/java/com/brandon3055/draconicevolution/common/utils/Teleporter.java create mode 100644 src/main/java/com/brandon3055/draconicevolution/common/utils/Utils.java create mode 100644 src/main/java/com/brandon3055/draconicevolution/common/utils/handlers/FileHandler.java create mode 100644 src/main/java/com/brandon3055/draconicevolution/common/utils/handlers/IProcess.java create mode 100644 src/main/java/com/brandon3055/draconicevolution/common/utils/handlers/ProcessHandler.java create mode 100644 src/main/java/com/brandon3055/draconicevolution/common/utils/lib/References.java create mode 100644 src/main/resources/assets/brandonscore/textures/gui/Widgets.png diff --git a/dependencies.gradle b/dependencies.gradle index 77a59451..70d414b5 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,17 +1,16 @@ // Add your dependencies here dependencies { - api("com.github.GTNewHorizons:BrandonsCore:1.2.0-GTNH:dev") api("curse.maven:cofh-lib-220333:2388748") + api("com.github.GTNewHorizons:GTNHLib:0.9.6:dev") - compileOnly("com.github.GTNewHorizons:ForestryMC:4.11.2:api") {transitive = false} - compileOnly("com.github.GTNewHorizons:OpenComputers:1.12.4-GTNH:api") {transitive = false} - compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.8.39-GTNH:dev") {transitive = false} - compileOnly("com.github.GTNewHorizons:CodeChickenCore:1.4.8:dev") {transitive = false} + compileOnly("com.github.GTNewHorizons:ForestryMC:4.11.4:api") {transitive = false} + compileOnly("com.github.GTNewHorizons:OpenComputers:1.12.12-GTNH:api") {transitive = false} + compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.8.55-GTNH:dev") {transitive = false} + compileOnly("com.github.GTNewHorizons:CodeChickenCore:1.4.10:dev") {transitive = false} compileOnly("com.github.GTNewHorizons:inventory-tweaks:1.7.1:dev") {transitive = false} - compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.2-GTNH:dev') {transitive = false} - compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.52.117:dev") {transitive = false} - compileOnly("com.github.GTNewHorizons:GTNHLib:0.8.9:dev") {transitive = false} + compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.6-GTNH:dev') {transitive = false} + compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.52.225:dev") {transitive = false} compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") {transitive = false} compileOnly("curse.maven:computercraft-67504:2269339") {transitive = false} diff --git a/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java b/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java index 91d99180..e66a1baf 100644 --- a/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java +++ b/src/main/java/com/brandon3055/draconicevolution/DraconicEvolution.java @@ -7,7 +7,7 @@ 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 com.brandon3055.draconicevolution.common.utils.LogHelper; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.SidedProxy; @@ -23,15 +23,14 @@ import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; version = References.VERSION, canBeDeactivated = false, guiFactory = References.GUIFACTORY, - dependencies = "after:NotEnoughItems;" + "after:ThermalExpansion;" - + "after:ThermalFoundation;" - + "required-after:BrandonsCore@[1.0.0.11,);") + dependencies = "after:NotEnoughItems;" + "after:ThermalExpansion;" + "after:ThermalFoundation;") public class DraconicEvolution { @Mod.Instance(References.MODID) public static DraconicEvolution instance; - - @SidedProxy(clientSide = References.CLIENTPROXYLOCATION, serverSide = References.SERVERPROXYLOCATION) + @SidedProxy( + clientSide = "com.brandon3055.draconicevolution.client.ClientProxy", + serverSide = "com.brandon3055.draconicevolution.common.CommonProxy") public static CommonProxy proxy; public static CreativeTabs tabToolsWeapons = new DETab( diff --git a/src/main/java/com/brandon3055/draconicevolution/api/GeneratorOverride.java b/src/main/java/com/brandon3055/draconicevolution/api/GeneratorOverride.java index 23ab183b..7ebffd59 100644 --- a/src/main/java/com/brandon3055/draconicevolution/api/GeneratorOverride.java +++ b/src/main/java/com/brandon3055/draconicevolution/api/GeneratorOverride.java @@ -4,7 +4,7 @@ import java.util.Random; import net.minecraft.world.World; -import com.brandon3055.brandonscore.common.utills.DataUtills; +import com.brandon3055.draconicevolution.common.utils.DataUtils; import com.brandon3055.draconicevolution.common.world.ChaosWorldGenHandler; import com.brandon3055.draconicevolution.common.world.DraconicWorldGenerator; import com.brandon3055.draconicevolution.common.world.WorldGenEnderComet; @@ -43,12 +43,8 @@ public class GeneratorOverride { */ 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); + ChaosWorldGenHandler + .generateChunk(world, chunkX, chunkZ, new DataUtils.XZPair(centerX, centerZ), random); } /** diff --git a/src/main/java/com/brandon3055/draconicevolution/client/ClientProxy.java b/src/main/java/com/brandon3055/draconicevolution/client/ClientProxy.java index d3064391..28df03b3 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/ClientProxy.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/ClientProxy.java @@ -5,7 +5,9 @@ import static com.brandon3055.draconicevolution.integration.nei.IMCForNEI.IMCSen import net.minecraft.client.Minecraft; import net.minecraft.client.audio.ISound; import net.minecraft.client.particle.EntityFX; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; +import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.client.MinecraftForgeClient; @@ -114,54 +116,6 @@ public class ClientProxy extends CommonProxy { super.preInit(event); ResourceHandler.init(event); - - // downloadLocation = event.getModConfigurationDirectory().getParentFile().getAbsolutePath() + - // "/mods/derspack"; - // downloadLocation = downloadLocation.replaceAll("\\\\", "/"); - // - // File rescourcePack = new File(event.getModConfigurationDirectory().getParentFile(), "/mods/derspack"); - // - // - // //File file = new File(downloadLocation); - // if (!rescourcePack.exists()) rescourcePack.mkdir(); - // - // 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("/"))); - // - // InputStream is = url.openStream(); - // OutputStream os = new FileOutputStream(dll); - // - // ByteStreams.copy(is, os); - // - // 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()); - // } - // - // f.set(Minecraft.getMinecraft(), defaultResourcePacks); - // } - // catch (IllegalAccessException e) { - // e.printStackTrace(); - // } - } @Override @@ -390,10 +344,6 @@ public class ClientProxy extends CommonProxy { return beam; } - public boolean isOp(String paramString) { - return Minecraft.getMinecraft().theWorld.getWorldInfo().getGameType().isCreative(); - } - @Override public void spawnParticle(Object particle, int range) { if (particle instanceof EntityFX && ((EntityFX) particle).worldObj.isRemote) @@ -405,4 +355,39 @@ public class ClientProxy extends CommonProxy { FMLClientHandler.instance().getClient().getSoundHandler().playSound(sound); return sound; } + + @Override + public boolean isDedicatedServer() { + return false; + } + + @Override + public MinecraftServer getMCServer() { + return super.getMCServer(); + } + + @Override + public World getClientWorld() { + return Minecraft.getMinecraft().theWorld; + } + + @Override + public boolean isSpaceDown() { + return Minecraft.getMinecraft().gameSettings.keyBindJump.getIsKeyPressed(); + } + + @Override + public boolean isShiftDown() { + return Minecraft.getMinecraft().gameSettings.keyBindSneak.getIsKeyPressed(); + } + + @Override + public boolean isCtrlDown() { + return Minecraft.getMinecraft().gameSettings.keyBindSprint.getIsKeyPressed(); + } + + @Override + public EntityPlayer getClientPlayer() { + return Minecraft.getMinecraft().thePlayer; + } } 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 f347d41a..df373261 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/creativetab/DETab.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/creativetab/DETab.java @@ -5,9 +5,9 @@ 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 com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIContainerTemplate.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIContainerTemplate.java deleted file mode 100644 index e9e50616..00000000 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIContainerTemplate.java +++ /dev/null @@ -1,69 +0,0 @@ -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.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 { - - public EntityPlayer player; - private TileContainerTemplate tile; - - public GUIContainerTemplate(InventoryPlayer invPlayer, TileContainerTemplate tile) { - super(new ContainerTemplate(invPlayer, tile)); - - xSize = 176; - ySize = 140; - - this.tile = tile; - this.player = invPlayer.player; - } - - private static final ResourceLocation texture = new ResourceLocation( - References.MODID.toLowerCase(), - "textures/gui/.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); - } - - @Override - protected void drawGuiContainerForegroundLayer(int x, int y) { - fontRendererObj.drawStringWithShadow("Energy Infuser", 49, -9, 0x00FFFF); - // bindTexture(texture); - - // fontRendererObj.drawString("Charges: " + charges, 90, 25, 0x000000); - // drawCenteredString(fontRendererObj, "Charges: " + charges, 117, 25, 0x000000); - // drawCenteredString(fontRendererObj, "Weather Controller", xSize/2, -15, 0x2a4ed0); - - } - - @Override - public void initGui() { - super.initGui(); - } - - @Override - protected void actionPerformed(GuiButton button) {} - - @Override - public void updateScreen() { - super.updateScreen(); - } -} 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 301b4a37..35b4aefb 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIDraconiumChest.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIDraconiumChest.java @@ -17,9 +17,9 @@ import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; -import com.brandon3055.brandonscore.client.utills.GuiHelper; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.handler.ResourceHandler; +import com.brandon3055.draconicevolution.client.utils.GuiHelper; import com.brandon3055.draconicevolution.common.container.ContainerDraconiumChest; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.network.ButtonPacket; 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 244a042f..8cdd2579 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIEnergyInfuser.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIEnergyInfuser.java @@ -1,5 +1,7 @@ package com.brandon3055.draconicevolution.client.gui; +import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber; + import java.util.ArrayList; import java.util.Random; @@ -14,7 +16,7 @@ import net.minecraft.util.StatCollector; import org.lwjgl.opengl.GL11; -import com.brandon3055.brandonscore.client.utills.GuiHelper; +import com.brandon3055.draconicevolution.client.utils.GuiHelper; import com.brandon3055.draconicevolution.common.container.ContainerEnergyInfuser; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser; @@ -118,10 +120,9 @@ public class GUIEnergyInfuser extends GuiContainer { ArrayList internal = new ArrayList(); internal.add(StatCollector.translateToLocal("gui.de.internalStorage.txt")); internal.add( - "" + EnumChatFormatting.DARK_BLUE - + tile.energy.getEnergyStored() + EnumChatFormatting.DARK_BLUE + formatNumber(tile.energy.getEnergyStored()) + "/" - + tile.energy.getMaxEnergyStored()); + + formatNumber(tile.energy.getMaxEnergyStored())); GL11.glPushAttrib(GL11.GL_LIGHTING_BIT); drawHoveringText(internal, x + guiLeft, y + guiTop, fontRendererObj); GL11.glPopAttrib(); @@ -134,10 +135,9 @@ public class GUIEnergyInfuser extends GuiContainer { ArrayList internal = new ArrayList(); internal.add(StatCollector.translateToLocal("gui.de.itemStorage.txt")); internal.add( - "" + EnumChatFormatting.DARK_BLUE - + item.getEnergyStored(tile.getStackInSlot(0)) + EnumChatFormatting.DARK_BLUE + formatNumber(item.getEnergyStored(tile.getStackInSlot(0))) + "/" - + item.getMaxEnergyStored(tile.getStackInSlot(0))); + + formatNumber(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 47fe5f2e..56523740 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIFlowGate.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIFlowGate.java @@ -1,5 +1,7 @@ package com.brandon3055.draconicevolution.client.gui; +import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber; + import java.util.ArrayList; import java.util.List; @@ -10,9 +12,8 @@ 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.client.utils.GuiHelper; import com.brandon3055.draconicevolution.common.tileentities.gates.TileGate; /** @@ -87,7 +88,7 @@ public class GUIFlowGate extends GuiScreen { 0x00FF00); String flow = StatCollector.translateToLocal("gui.de.flowGateCurrentFlow.name") + ": " - + Utills.addCommas(tile.getActualFlow()); + + formatNumber(tile.getActualFlow()); fontRendererObj.drawString(flow, guiCrt - (fontRendererObj.getStringWidth(flow) / 2), guiTop + 76, 0x2c2c2c); if (!tile.flowOverridden) { 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 d894c3ed..cefe38c0 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIGenerator.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIGenerator.java @@ -1,19 +1,21 @@ package com.brandon3055.draconicevolution.client.gui; +import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber; + import java.util.ArrayList; 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.EnumChatFormatting; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; -import com.brandon3055.brandonscore.client.utills.GuiHelper; +import com.brandon3055.draconicevolution.client.utils.GuiHelper; import com.brandon3055.draconicevolution.common.container.ContainerGenerator; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.tileentities.TileGenerator; @@ -73,46 +75,30 @@ public class GUIGenerator extends GuiContainer { 18, 18 - (int) (fuel * 13)); // Power bar - fontRendererObj.drawStringWithShadow("Generator", guiLeft + 64, guiTop + 0, 0x00FFFF); + fontRendererObj.drawStringWithShadow( + StatCollector.translateToLocal("tile.draconicevolution:generator.name"), + guiLeft + 64, + guiTop, + 0x00FFFF); int x = X - guiLeft; int y = Y - guiTop; if (GuiHelper.isInRect(83, 10, 12, 40, x, y)) { ArrayList internal = new ArrayList(); - internal.add("Internal Storage"); + internal.add(StatCollector.translateToLocal("gui.de.internalStorage.txt")); internal.add( - "" + EnumChatFormatting.DARK_BLUE - + tile.getEnergyStored(ForgeDirection.UP) + EnumChatFormatting.DARK_BLUE + formatNumber(tile.getEnergyStored(ForgeDirection.UP)) + "/" - + tile.getMaxEnergyStored(ForgeDirection.UP)); + + formatNumber(tile.getMaxEnergyStored(ForgeDirection.UP))); drawHoveringText(internal, x + guiLeft, y + guiTop, fontRendererObj); } } - @Override - protected void drawGuiContainerForegroundLayer(int X, int Y) { - - 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); } - */ - } - @Override public void initGui() { super.initGui(); - - // ID - // buttonList.add(new GuiButton(0, guiLeft + 85, guiTop , 85, 20, text)); } - @Override - protected void actionPerformed(GuiButton button) {} - @Override public void updateScreen() { guiUpdateTick++; @@ -123,6 +109,4 @@ public class GUIGenerator extends GuiContainer { super.updateScreen(); } - // ####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 69b8ebdf..a0f671a4 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIGrinder.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIGrinder.java @@ -1,9 +1,10 @@ package com.brandon3055.draconicevolution.client.gui; +import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber; + import java.util.ArrayList; 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; @@ -13,7 +14,7 @@ import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; -import com.brandon3055.brandonscore.client.utills.GuiHelper; +import com.brandon3055.draconicevolution.client.utils.GuiHelper; import com.brandon3055.draconicevolution.common.container.ContainerGrinder; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.tileentities.TileGrinder; @@ -69,7 +70,7 @@ public class GUIGrinder extends GuiContainer { guiLeft + 83, guiTop + 11 + (int) (power * 40), xSize, - 0 + (int) (power * 40), + (int) (power * 40), 12, 40 - (int) (power * 40)); // Power bar drawTexturedModalRect( @@ -81,7 +82,7 @@ public class GUIGrinder extends GuiContainer { 18 - (int) (fuel * 13)); // Power bar if (tile.isExternallyPowered()) drawTexturedModalRect(guiLeft + 100, guiTop + 37, xSize, 66, 13, 13); - fontRendererObj.drawStringWithShadow("Grinder", guiLeft + 71, guiTop + 0, 0x00FFFF); + fontRendererObj.drawStringWithShadow("Grinder", guiLeft + 71, guiTop, 0x00FFFF); int x = X - guiLeft; int y = Y - guiTop; @@ -91,39 +92,25 @@ public class GUIGrinder extends GuiContainer { if (tile.isExternallyPowered()) { internal.add( "" + EnumChatFormatting.DARK_BLUE - + tile.getEnergyStored(ForgeDirection.UP) + + formatNumber(tile.getEnergyStored(ForgeDirection.UP)) + "/" - + tile.getMaxEnergyStored(ForgeDirection.UP)); + + formatNumber(tile.getMaxEnergyStored(ForgeDirection.UP))); } else { internal.add( "" + EnumChatFormatting.DARK_BLUE - + tile.getInternalBuffer().getEnergyStored() + + formatNumber(tile.getInternalBuffer().getEnergyStored()) + "/" - + tile.getInternalBuffer().getMaxEnergyStored()); + + formatNumber(tile.getInternalBuffer().getMaxEnergyStored())); } drawHoveringText(internal, x + guiLeft, y + guiTop, fontRendererObj); } } - @Override - protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) { - // fontRendererObj.drawString("Charges: " + charges, 90, 25, 0x000000); - // drawCenteredString(fontRendererObj, "Charges: " + charges, 117, 25, 0x000000); - // drawCenteredString(fontRendererObj, "Weather Controller", xSize/2, -15, 0x2a4ed0); - - } - @Override public void initGui() { super.initGui(); - - // ID - // buttonList.add(new GuiButton(0, guiLeft + 85, guiTop , 85, 20, text)); } - @Override - protected void actionPerformed(GuiButton button) {} - @Override public void updateScreen() { guiUpdateTick++; @@ -134,6 +121,4 @@ public class GUIGrinder extends GuiContainer { super.updateScreen(); } - // ####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/GUITeleporter.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUITeleporter.java index 9531e260..3dd251c8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUITeleporter.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUITeleporter.java @@ -20,14 +20,14 @@ 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.client.utils.GuiHelper; 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 com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.utils.Teleporter; import cpw.mods.fml.common.Loader; import cpw.mods.fml.relauncher.Side; @@ -43,7 +43,7 @@ public class GUITeleporter extends GuiScreen { References.MODID.toLowerCase(), "textures/gui/TeleporterMKII.png"); private ItemStack teleporterItem; - protected List locations = new ArrayList(0); + protected List locations = new ArrayList<>(0); private int selected = 0; private int selectionOffset = 0; @@ -446,7 +446,7 @@ public class GUITeleporter extends GuiScreen { } else { if (!textBeingEdited.getText().isEmpty()) { getLocationSafely(selected + selectionOffset).setName(textBeingEdited.getText()); - TeleportLocation location = new TeleportLocation(); + Teleporter.TeleportLocation location = new Teleporter.TeleportLocation(); location.setName(textBeingEdited.getText()); DraconicEvolution.network.sendToServer( new TeleporterPacket(location, TeleporterPacket.UPDATENAME, selected + selectionOffset)); @@ -460,7 +460,7 @@ public class GUITeleporter extends GuiScreen { } if (button.id == 1) { - TeleportLocation location = new TeleportLocation( + Teleporter.TeleportLocation location = new Teleporter.TeleportLocation( player.posX, player.posY - 1.62, player.posZ, @@ -484,14 +484,14 @@ public class GUITeleporter extends GuiScreen { if (button.id == 3 || button.id == 7) { if (button.id == 3) { if (selected > 0) { - TeleportLocation temp = getLocationSafely(selected + selectionOffset); + Teleporter.TeleportLocation temp = getLocationSafely(selected + selectionOffset); locations.set(selected + selectionOffset, getLocationSafely(selected + selectionOffset - 1)); locations.set(selected + selectionOffset - 1, temp); selected--; } } else { if (selected < Math.min(11, locations.size() - 1)) { - TeleportLocation temp = getLocationSafely(selected + selectionOffset); + Teleporter.TeleportLocation temp = getLocationSafely(selected + selectionOffset); locations.set(selected + selectionOffset, getLocationSafely(selected + selectionOffset + 1)); locations.set(selected + selectionOffset + 1, temp); selected++; @@ -624,7 +624,7 @@ public class GUITeleporter extends GuiScreen { // TeleportLocation location = new TeleportLocation(tagLocation.getDouble("X"), tagLocation.getDouble("Y"), // tagLocation.getDouble("Z"), tagLocation.getInteger("Dimension"), tagLocation.getFloat("Pitch"), // tagLocation.getFloat("Yaw"), tagLocation.getString("Name")); - TeleportLocation location = new TeleportLocation(); + Teleporter.TeleportLocation location = new Teleporter.TeleportLocation(); location.readFromNBT(tagLocation); location.setWriteProtected(tagLocation.getBoolean("WP")); locations.add(location); @@ -632,7 +632,7 @@ public class GUITeleporter extends GuiScreen { } private void addCurrentLocationToList(String name) { - TeleportLocation currentLocation = new TeleportLocation( + Teleporter.TeleportLocation currentLocation = new Teleporter.TeleportLocation( player.posX, player.posY - 1.62, player.posZ, @@ -644,8 +644,8 @@ public class GUITeleporter extends GuiScreen { locations.add(currentLocation); } - private TeleportLocation getLocationSafely(int index) { + private Teleporter.TeleportLocation getLocationSafely(int index) { if (index < locations.size() && index >= 0) return locations.get(index); - return new TeleportLocation(0, 0, 0, 0, 0, 0, EnumChatFormatting.DARK_RED + "[Index Error]"); + return new Teleporter.TeleportLocation(0, 0, 0, 0, 0, 0, EnumChatFormatting.DARK_RED + "[Index Error]"); } } 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 a3b51368..d7fc64dd 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIUpgradeModifier.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIUpgradeModifier.java @@ -15,13 +15,13 @@ 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.client.utils.GuiHelper; 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 com.brandon3055.draconicevolution.common.utils.IUpgradableItem; +import com.brandon3055.draconicevolution.common.utils.IUpgradableItem.EnumUpgrade; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; 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 42255c0e..0e14fb1d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiHudConfig.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GuiHudConfig.java @@ -11,8 +11,8 @@ 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.client.utils.GuiHelper; +import com.brandon3055.draconicevolution.client.utils.guicomponents.GUIBase; import com.brandon3055.draconicevolution.common.handler.ConfigHandler; /** 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 8f639046..951204bd 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 @@ -25,23 +25,23 @@ import org.apache.commons.io.IOUtils; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; -import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentBase; -import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentButton; -import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentCollection; -import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentTextureButton; -import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentTexturedRect; -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.gui.guicomponents.ComponentContributorsPage; import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentIndexButton; import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentManualPage; import com.brandon3055.draconicevolution.client.handler.ResourceHandler; +import com.brandon3055.draconicevolution.client.utils.ClientUtils; +import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentBase; +import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentButton; +import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentCollection; +import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentTextureButton; +import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentTexturedRect; +import com.brandon3055.draconicevolution.client.utils.guicomponents.GUIScrollingBase; import com.brandon3055.draconicevolution.common.container.DummyContainer; import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.handler.ContributorHandler; import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.utills.LogHelper; +import com.brandon3055.draconicevolution.common.utils.InfoHelper; +import com.brandon3055.draconicevolution.common.utils.LogHelper; import com.google.gson.stream.JsonReader; /** @@ -547,7 +547,7 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback { @Override public void confirmClicked(boolean confirmed, int id) { - if (confirmed) ClientUtills.openLink("https://www.patreon.com/brandon3055"); + if (confirmed) ClientUtils.openLink("https://www.patreon.com/brandon3055"); mc.displayGuiScreen(this); } } 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 cb398589..b74f0212 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,5 +1,7 @@ package com.brandon3055.draconicevolution.client.gui.componentguis; +import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber; + import java.util.ArrayList; import java.util.List; @@ -11,18 +13,18 @@ import net.minecraft.util.StatCollector; import org.lwjgl.opengl.GL11; -import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentButton; -import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentCollection; -import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentTextureButton; -import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentTexturedRect; -import com.brandon3055.brandonscore.client.gui.guicomponents.GUIBase; -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.client.utils.GuiHelper; +import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentButton; +import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentCollection; +import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentTextureButton; +import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentTexturedRect; +import com.brandon3055.draconicevolution.client.utils.guicomponents.GUIBase; import com.brandon3055.draconicevolution.common.container.ContainerReactor; import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore.ReactorState; +import com.brandon3055.draconicevolution.common.utils.Utils; /** * Created by brandon3055 on 30/7/2015. @@ -182,24 +184,24 @@ public class GUIReactor extends GUIBase { } else if (GuiHelper.isInRect(33, 4, 18, 114, mouseX - guiLeft, mouseY - guiTop)) { text.add(StatCollector.translateToLocal("gui.de.fieldStrength.txt")); if (core.maxFieldCharge > 0) { - text.add(Utills.round(core.fieldCharge / core.maxFieldCharge * 100D, 100D) + "%"); + text.add(Utils.round(core.fieldCharge / core.maxFieldCharge * 100D, 100D) + "%"); } - text.add(Utills.addCommas((int) core.fieldCharge) + " / " + Utills.addCommas((int) core.maxFieldCharge)); + text.add(formatNumber((int) core.fieldCharge) + " / " + formatNumber((int) core.maxFieldCharge)); 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 (core.maxEnergySaturation > 0) { text.add( - Utills.round((double) core.energySaturation / (double) core.maxEnergySaturation * 100D, 100D) + Utils.round((double) core.energySaturation / (double) core.maxEnergySaturation * 100D, 100D) + "%"); } - text.add(Utills.addCommas(core.energySaturation) + " / " + Utills.addCommas(core.maxEnergySaturation)); + text.add(formatNumber(core.energySaturation) + " / " + formatNumber(core.maxEnergySaturation)); 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 (core.reactorFuel + core.convertedFuel > 0) { text.add( - Utills.round( + Utils.round( ((double) core.convertedFuel + core.conversionUnit) / ((double) core.convertedFuel + (double) core.reactorFuel) * 100D, @@ -207,7 +209,7 @@ public class GUIReactor extends GUIBase { } text.add(core.convertedFuel + " / " + (core.convertedFuel + core.reactorFuel)); text.add( - "Full: " + (Utills.round( + "Full: " + (Utils.round( (float) (core.convertedFuel + core.reactorFuel) / ConfigHandler.reactorFuelStorage * 100, 1000)) + "%"); drawHoveringText(text, mouseX, mouseY, fontRendererObj); @@ -251,26 +253,23 @@ public class GUIReactor extends GUIBase { private void drawStatistics() { double inputRate = core.fieldDrain / (1D - (core.fieldCharge / core.maxFieldCharge)); fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.tempLoad.name"), 55, 16, 0x0000FF); - fontRendererObj.drawString(Utills.round(core.tempDrainFactor * 100D, 1D) + "%", 60, 2 + 24, 0); + fontRendererObj.drawString(Utils.round(core.tempDrainFactor * 100D, 1D) + "%", 60, 2 + 24, 0); fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.mass.name"), 55, 16 + 24, 0x0000FF); fontRendererObj.drawString( - Utills.round((core.reactorFuel + core.convertedFuel) / 1296D, 100) + "m^3", + Utils.round((core.reactorFuel + core.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) core.generationRate) + "RF/t", 60, 2 + 3 * 24, 0); + fontRendererObj.drawString(formatNumber((int) core.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); + .drawString(formatNumber((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(core.fuelUseRate * 1000000D)) + "nb/t", - 60, - 2 + 5 * 24, - 0); + fontRendererObj + .drawString(formatNumber((int) Math.round(core.fuelUseRate * 1000000D)) + "nb/t", 60, 2 + 5 * 24, 0); } private void drawStatus() { 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 a2f94e89..9b6e8097 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,7 @@ package com.brandon3055.draconicevolution.client.gui.componentguis; +import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber; + import java.util.ArrayList; import java.util.List; @@ -11,29 +13,28 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import net.minecraft.util.StringUtils; -import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentBase; -import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentButton; -import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentCollection; -import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentItemRenderer; -import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentTextField; -import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentTexturedRect; -import com.brandon3055.brandonscore.client.gui.guicomponents.GUIBase; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.gui.GuiHudConfig; import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentConfigItemButton; import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentFieldAdjuster; import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentFieldButton; +import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentBase; +import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentButton; +import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentCollection; +import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentItemRenderer; +import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentTextField; +import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentTexturedRect; +import com.brandon3055.draconicevolution.client.utils.guicomponents.GUIBase; import com.brandon3055.draconicevolution.common.container.ContainerAdvTool; import com.brandon3055.draconicevolution.common.handler.ContributorHandler; import com.brandon3055.draconicevolution.common.items.weapons.BowHandler; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.network.ContributorPacket; 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 com.brandon3055.draconicevolution.common.utils.IConfigurableItem; +import com.brandon3055.draconicevolution.common.utils.IInventoryTool; +import com.brandon3055.draconicevolution.common.utils.ItemConfigField; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; /** * Created by Brandon on 26/12/2014. @@ -325,7 +326,7 @@ public class GUIToolConfig extends GUIBase { List list = new ArrayList(); list.add( StatCollector.translateToLocal("gui.de.rfPerShot.txt") + ": " - + Utills.addCommas(properties.calculateEnergyCost())); + + formatNumber(properties.calculateEnergyCost())); list.add( StatCollector.translateToLocal("gui.de.maxDamage.txt") + ": " + properties.arrowDamage * (properties.arrowSpeed * 3)); 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 5b30b4cf..f77cd62a 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 @@ -6,12 +6,12 @@ import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; -import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentButton; -import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentCollection; -import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentItemRenderer; -import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentSlotBackground; -import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentTexturedRect; -import com.brandon3055.brandonscore.client.gui.guicomponents.GUIBase; +import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentButton; +import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentCollection; +import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentItemRenderer; +import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentSlotBackground; +import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentTexturedRect; +import com.brandon3055.draconicevolution.client.utils.guicomponents.GUIBase; import com.brandon3055.draconicevolution.common.container.ContainerAdvTool; import com.brandon3055.draconicevolution.common.lib.References; 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 769fbc4b..d294f904 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 @@ -4,7 +4,7 @@ import net.minecraft.util.StatCollector; import org.apache.commons.io.FilenameUtils; -import com.brandon3055.draconicevolution.common.utills.LogHelper; +import com.brandon3055.draconicevolution.common.utils.LogHelper; /** * Created by Brandon on 7/03/2015. 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 97b2956c..b024879a 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 @@ -9,11 +9,11 @@ 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.client.utils.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 com.brandon3055.draconicevolution.common.utils.IConfigurableItem; +import com.brandon3055.draconicevolution.common.utils.IInventoryTool; +import com.brandon3055.draconicevolution.common.utils.ItemConfigField; /** * Created by Brandon on 29/12/2014. 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 95ce811e..0d415636 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 @@ -17,13 +17,13 @@ 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.client.utils.ClientUtils; +import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentScrollingBase; +import com.brandon3055.draconicevolution.client.utils.guicomponents.GUIScrollingBase; import com.brandon3055.draconicevolution.common.handler.ContributorHandler; import com.brandon3055.draconicevolution.common.handler.ContributorHandler.Contributor; +import com.brandon3055.draconicevolution.common.utils.InfoHelper; /** * Created by brandon3055 on 5/11/2015. @@ -188,7 +188,7 @@ public class ComponentContributorsPage extends ComponentScrollingBase implements @Override public void confirmClicked(boolean confirmed, int button) { mc.displayGuiScreen(this.gui); - if (confirmed) ClientUtills.openLink(lastClickURL); + if (confirmed) ClientUtils.openLink(lastClickURL); } private static ModelBiped modelBiped = new ModelBiped(0.0265F); 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 408fb2c0..cf1ee074 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 @@ -6,13 +6,13 @@ 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; import com.brandon3055.draconicevolution.client.gui.componentguis.GUIToolConfig; +import com.brandon3055.draconicevolution.client.utils.GuiHelper; +import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentBase; import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; -import com.brandon3055.draconicevolution.common.utills.ItemConfigField; +import com.brandon3055.draconicevolution.common.utils.DataUtils; +import com.brandon3055.draconicevolution.common.utils.IConfigurableItem; +import com.brandon3055.draconicevolution.common.utils.ItemConfigField; /** * Created by Brandon on 1/01/2015. @@ -212,7 +212,7 @@ public class ComponentFieldAdjuster extends ComponentBase { .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( + DataUtils.writeObjectToCompound( IConfigurableItem.ProfileHelper.getProfileCompound(stack), field.value, field.datatype, 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 327bc8ae..ca97abc2 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 @@ -9,12 +9,12 @@ 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.client.utils.guicomponents.ComponentBase; import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; -import com.brandon3055.draconicevolution.common.utills.ItemConfigField; +import com.brandon3055.draconicevolution.common.utils.DataUtils; +import com.brandon3055.draconicevolution.common.utils.IConfigurableItem; +import com.brandon3055.draconicevolution.common.utils.ItemConfigField; /** * Created by Brandon on 31/12/2014. @@ -96,7 +96,7 @@ public class ComponentFieldButton extends ComponentBase { field.sendChanges(); ItemStack stack = gui.player.inventory.getStackInSlot(field.slot); if (stack != null && stack.getItem() instanceof IConfigurableItem) { - DataUtills.writeObjectToCompound( + DataUtils.writeObjectToCompound( IConfigurableItem.ProfileHelper.getProfileCompound(stack), field.value, field.datatype, 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 a23a9d81..c69f0e02 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 @@ -6,11 +6,11 @@ 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 com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentScrollingBase; +import com.brandon3055.draconicevolution.client.utils.guicomponents.GUIScrollingBase; +import com.brandon3055.draconicevolution.common.utils.Utils; /** * Created by Brandon on 7/03/2015. @@ -23,7 +23,7 @@ public class ComponentIndexButton extends ComponentScrollingBase { public ComponentIndexButton(int x, int y, GUIScrollingBase gui, ManualPage page) { super(x, y, gui); this.page = page; - stack = Utills.getStackFromName(page.name, page.meta); + stack = Utils.getStackFromName(page.name, page.meta); } @Override 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 ebb09312..78771d79 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 @@ -21,14 +21,14 @@ 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; -import com.brandon3055.brandonscore.common.utills.InfoHelper; -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 com.brandon3055.draconicevolution.client.utils.CustomResourceLocation; +import com.brandon3055.draconicevolution.client.utils.GuiHelper; +import com.brandon3055.draconicevolution.client.utils.guicomponents.ComponentScrollingBase; +import com.brandon3055.draconicevolution.client.utils.guicomponents.GUIScrollingBase; +import com.brandon3055.draconicevolution.common.utils.InfoHelper; +import com.brandon3055.draconicevolution.common.utils.Utils; /** * Created by Brandon on 19/03/2015. @@ -48,7 +48,7 @@ public class ComponentManualPage extends ComponentScrollingBase { super(x, y, gui); this.page = page; pageLength = 25; - stack = Utills.getStackFromName(page.name, page.meta); + stack = Utils.getStackFromName(page.name, page.meta); ContentComponent title = new ContentComponent("title." + page.getLocalizedName(), pageLength, this); pageLength += title.getHeight(); contentList.add(title); @@ -157,7 +157,7 @@ public class ComponentManualPage extends ComponentScrollingBase { } else if (type == 2) { String s = content.substring(content.indexOf("[c]") + 3); String name = s.substring(0, s.lastIndexOf(":")); - ItemStack stack = Utills.getStackFromName(name, Integer.parseInt(s.substring(s.lastIndexOf(":") + 1))); + ItemStack stack = Utils.getStackFromName(name, Integer.parseInt(s.substring(s.lastIndexOf(":") + 1))); result = stack; if (stack != null) { 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 434543f4..a96501f3 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/handler/ClientEventHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/handler/ClientEventHandler.java @@ -20,7 +20,6 @@ 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; import com.brandon3055.draconicevolution.common.handler.ConfigHandler; @@ -32,7 +31,8 @@ import com.brandon3055.draconicevolution.common.items.weapons.BowHandler; 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 com.brandon3055.draconicevolution.common.utils.DataUtils; +import com.brandon3055.draconicevolution.common.utils.LogHelper; import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; @@ -45,7 +45,7 @@ import cpw.mods.fml.relauncher.SideOnly; */ public class ClientEventHandler { - public static Map> playerShieldStatus = new HashMap>(); + public static Map> playerShieldStatus = new HashMap<>(); public static int elapsedTicks; private static float previousFOB = 0f; @@ -72,9 +72,9 @@ 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();) { - Map.Entry> entry = i.next(); + for (Iterator>> i = playerShieldStatus.entrySet() + .iterator(); i.hasNext();) { + Map.Entry> entry = i.next(); if (elapsedTicks - entry.getValue().getValue() > 5) i.remove(); } 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 5fe39a2f..92a1f87e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/handler/HudHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/handler/HudHandler.java @@ -1,5 +1,7 @@ package com.brandon3055.draconicevolution.client.handler; +import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber; + import java.util.ArrayList; import java.util.List; @@ -14,13 +16,12 @@ 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.client.utils.GuiHelper; 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 com.brandon3055.draconicevolution.common.utils.IHudDisplayBlock; +import com.brandon3055.draconicevolution.common.utils.IHudDisplayItem; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.relauncher.Side; @@ -213,7 +214,7 @@ public class HudHandler { GL11.glTranslated(-x, -y, 0); String shield = Math.round(shieldPoints) + "/" + (int) maxShieldPoints; String entropy = "EN: " + (int) shieldEntropy + "%"; - String energy = "RF: " + Utills.formatNumber(rfTotal); + String energy = "RF: " + formatNumber(rfTotal); float fade = Math.min(armorStatsFadeOut, 1F); if (!rotated) { fontRenderer 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 bd85f76b..9a33a763 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/handler/ResourceHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/handler/ResourceHandler.java @@ -26,9 +26,9 @@ 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.client.utils.CustomResourceLocation; import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.utills.LogHelper; +import com.brandon3055.draconicevolution.common.utils.LogHelper; import com.google.common.io.ByteStreams; import com.google.gson.stream.JsonWriter; 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 3ab05f39..83bd6030 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/keybinding/KeyInputHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/keybinding/KeyInputHandler.java @@ -13,7 +13,6 @@ 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; import com.brandon3055.draconicevolution.common.items.tools.Magnet; @@ -23,8 +22,9 @@ import com.brandon3055.draconicevolution.common.network.MagnetTogglePacket; import com.brandon3055.draconicevolution.common.network.MagnetToggleSelfPickupPacket; import com.brandon3055.draconicevolution.common.network.PlacedItemPacket; import com.brandon3055.draconicevolution.common.network.TeleporterPacket; -import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; -import com.brandon3055.draconicevolution.common.utills.InventoryUtils; +import com.brandon3055.draconicevolution.common.utils.IConfigurableItem; +import com.brandon3055.draconicevolution.common.utils.InventoryUtils; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; import com.brandon3055.draconicevolution.integration.ModHelper; import cpw.mods.fml.common.eventhandler.SubscribeEvent; 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 d7901743..35ad922c 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 @@ -8,7 +8,7 @@ import net.minecraftforge.client.IItemRenderer; import org.lwjgl.opengl.GL11; import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; -import com.brandon3055.draconicevolution.common.utills.ICustomItemData; +import com.brandon3055.draconicevolution.common.utils.ICustomItemData; /** * Created by Brandon on 16/11/2014. diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderArmor.java b/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderArmor.java index c21f3273..c57a25d0 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderArmor.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderArmor.java @@ -9,7 +9,7 @@ import org.lwjgl.opengl.GL11; import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.utills.LogHelper; +import com.brandon3055.draconicevolution.common.utils.LogHelper; /** * Created by brandon3055 on 17/8/2015. diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderMobSoul.java b/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderMobSoul.java index b22f3e22..0ccb36bb 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderMobSoul.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/item/RenderMobSoul.java @@ -10,8 +10,8 @@ import net.minecraftforge.client.IItemRenderer; import org.lwjgl.opengl.GL11; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; -import com.brandon3055.draconicevolution.common.utills.LogHelper; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.utils.LogHelper; public class RenderMobSoul implements IItemRenderer { diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergyBeam.java b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergyBeam.java index 7b03d8ca..4f8f8b93 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergyBeam.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergyBeam.java @@ -10,10 +10,10 @@ import net.minecraft.world.World; import org.lwjgl.opengl.GL11; -import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.client.handler.ClientEventHandler; import com.brandon3055.draconicevolution.client.handler.ResourceHandler; import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.utils.Utils; /** * Created by Brandon on 8/02/2015. @@ -83,14 +83,13 @@ public class ParticleEnergyBeam extends EntityFX { this.tZ = tZ; if (offsetMode > 0) { - double dist = Utills.getDistanceAtoB(x, z, tX, tZ); + double dist = Utils.getDistanceAtoB(x, z, tX, tZ); if (dist == 0) dist = 0.1; double xDist = x - tX; double zDist = z - tZ; double xOff = xDist / dist; double zOff = zDist / dist; if (xOff == 0 && zOff == 0) xOff = 1; - // LogHelper.info(xOff + " " + zOff); double offM = 0.4D; if (offsetMode == 2 || offsetMode == 3) setPosition(posX - xOff * offM, posY, posZ - zOff * offM); 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 52f436c8..f50c35eb 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 @@ -11,10 +11,10 @@ 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 com.brandon3055.draconicevolution.common.utils.Utils; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -710,8 +710,8 @@ public class Particles { // super.onUpdate(); if (particleAge >= particleMaxAge || this.getDistanceSq(targetX, targetY, targetZ) < 0.05) setDead(); - double d1 = Utills.getDistanceAtoB(startX, startY, startZ, targetX, targetY, targetZ); - double d2 = Utills.getDistanceAtoB(posX, posY, posZ, targetX, targetY, targetZ); + double d1 = Utils.getDistanceAtoB(startX, startY, startZ, targetX, targetY, targetZ); + double d2 = Utils.getDistanceAtoB(posX, posY, posZ, targetX, targetY, targetZ); particleScale = ((float) (d2 / d1)) * baseScale; particleAge++; @@ -1198,16 +1198,16 @@ public class Particles { prevPosZ = posZ; if (mode == 0) { - if (Utills.getDistanceAtoB(posX, posY, posZ, focalX, focalY, focalZ) < 0.2 && particleAge > 5) mode = 1; - double d = Utills.getDistanceAtoB(focalX, focalY, focalZ, shardX, shardY, shardZ); + if (Utils.getDistanceAtoB(posX, posY, posZ, focalX, focalY, focalZ) < 0.2 && particleAge > 5) mode = 1; + double d = Utils.getDistanceAtoB(focalX, focalY, focalZ, shardX, shardY, shardZ); float motionMod = 0.1F; motionX += (focalX - posX) / d * motionMod; motionY += (focalY - posY) / d * motionMod; motionZ += (focalZ - posZ) / d * motionMod; } if (mode == 1) { - if (Utills.getDistanceAtoB(posX, posY, posZ, shardX, shardY, shardZ) < 1) setDead(); - double d = Utills.getDistanceAtoB(focalX, focalY, focalZ, shardX, shardY, shardZ); + if (Utils.getDistanceAtoB(posX, posY, posZ, shardX, shardY, shardZ) < 1) setDead(); + double d = Utils.getDistanceAtoB(focalX, focalY, focalZ, shardX, shardY, shardZ); particleScale = 1F - (float) d * 0.01F; float motionMod = 1F; motionX = (shardX - focalX) / d * motionMod; @@ -1216,8 +1216,8 @@ public class Particles { } if (mode == 10) { - if (Utills.getDistanceAtoB(posX, posY, posZ, shardX, shardY, shardZ) < 0.3) setDead(); - double d = Utills.getDistanceAtoB(focalX, focalY, focalZ, shardX, shardY, shardZ); + if (Utils.getDistanceAtoB(posX, posY, posZ, shardX, shardY, shardZ) < 0.3) setDead(); + double d = Utils.getDistanceAtoB(focalX, focalY, focalZ, shardX, shardY, shardZ); float motionMod = 0.4F; motionX = (shardX - focalX) / d * motionMod; motionY = (shardY - focalY) / d * motionMod; 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 ec2c717f..0fed75a4 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 @@ -20,13 +20,13 @@ 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; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.utils.Utils; /** * Created by Brandon on 25/10/2014. @@ -136,7 +136,7 @@ public class RenderTileTeleporterStand extends TileEntitySpecialRenderer { double pitchAngle = Math.toDegrees( Math.atan2( yDiff, - Utills.getDistanceAtoB( + Utils.getDistanceAtoB( player.posX, player.posY, player.posZ, 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 deleted file mode 100644 index bd384495..00000000 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileTestBlock.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.brandon3055.draconicevolution.client.render.tile; - -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 IModelCustom iner_model; - private IModelCustom outer_model; - - public RenderTileTestBlock() { - 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")); - } - - @Override - public void renderTileEntityAt(TileEntity var1, double x, double y, double z, float var8) { - GL11.glPushMatrix(); - GL11.glColor4f(1F, 1F, 1F, 1F); - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) 100, (float) 100); - - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glDisable(GL11.GL_CULL_FACE); - // GL11.glDepthMask(false); - - GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5); - - FMLClientHandler.instance().getClient().getTextureManager().bindTexture(iner_model_texture); - - GL11.glPushMatrix(); - GL11.glRotatef(((TileTestBlock) var1).modelRotation, 0F, 1F, 0.5F); - // GL11.glColor4f(2F, 2F, 2F, 1F); - iner_model.renderAll(); - GL11.glPopMatrix(); - - GL11.glScalef(1.1F, 1.1F, 1.1F); - GL11.glDepthMask(false); - FMLClientHandler.instance().getClient().getTextureManager().bindTexture(outer_model_texture); - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 200F, 200F); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_BLEND); - GL11.glRotatef(((TileTestBlock) var1).modelRotation * 0.5F, 0F, -1F, -0.5F); - GL11.glColor4f(0.5F, 2F, 2F, 0.7F); - outer_model.renderAll(); - GL11.glDisable(GL11.GL_BLEND); - GL11.glDepthMask(true); - - GL11.glPopMatrix(); - } -} diff --git a/src/main/java/com/brandon3055/draconicevolution/client/utils/ClientUtils.java b/src/main/java/com/brandon3055/draconicevolution/client/utils/ClientUtils.java new file mode 100644 index 00000000..50834b24 --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/client/utils/ClientUtils.java @@ -0,0 +1,24 @@ +package com.brandon3055.draconicevolution.client.utils; + +import java.net.URI; + +import com.brandon3055.draconicevolution.common.utils.LogHelper; + +/** + * Created by brandon3055 on 11/11/2015. + */ +@SuppressWarnings("unused") +public class ClientUtils { + + public static void openLink(String url) { + try { + URI uri = new URI(url); + Class oclass = Class.forName("java.awt.Desktop"); + Object object = oclass.getMethod("getDesktop", new Class[0]).invoke(null, new Object[0]); + oclass.getMethod("browse", new Class[] { URI.class }).invoke(object, new Object[] { uri }); + } catch (Throwable throwable) { + LogHelper.error("Couldn\'t open link"); + throwable.printStackTrace(); + } + } +} diff --git a/src/main/java/com/brandon3055/draconicevolution/client/utill/CustomResourceLocation.java b/src/main/java/com/brandon3055/draconicevolution/client/utils/CustomResourceLocation.java similarity index 93% rename from src/main/java/com/brandon3055/draconicevolution/client/utill/CustomResourceLocation.java rename to src/main/java/com/brandon3055/draconicevolution/client/utils/CustomResourceLocation.java index c867fe3c..b0cb788b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/utill/CustomResourceLocation.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/utils/CustomResourceLocation.java @@ -1,4 +1,4 @@ -package com.brandon3055.draconicevolution.client.utill; +package com.brandon3055.draconicevolution.client.utils; import net.minecraft.util.ResourceLocation; diff --git a/src/main/java/com/brandon3055/draconicevolution/client/utils/GuiHelper.java b/src/main/java/com/brandon3055/draconicevolution/client/utils/GuiHelper.java new file mode 100644 index 00000000..8e7813fa --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/client/utils/GuiHelper.java @@ -0,0 +1,140 @@ +package com.brandon3055.draconicevolution.client.utils; + +import java.util.Iterator; +import java.util.List; + +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.Tessellator; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +/** + * Created by Brandon on 28/06/2014. + */ +@SuppressWarnings("unused") +public class GuiHelper { + + public static final double PXL128 = 0.0078125; + public static final double PXL256 = 0.00390625; + + public static boolean isInRect(int x, int y, int xSize, int ySize, int mouseX, int mouseY) { + return ((mouseX >= x && mouseX <= x + xSize) && (mouseY >= y && mouseY <= y + ySize)); + } + + public static void drawTexturedRect(int x, int y, int u, int v, int width, int height) { + drawTexturedRect(x, y, width, height, u, v, width, height, 0, PXL256); + } + + public static void drawTexturedRect(double x, double y, double width, double height, int u, int v, int uSize, + int vSize, double zLevel, double pxl) { + Tessellator tessellator = Tessellator.instance; + tessellator.startDrawingQuads(); + tessellator.addVertexWithUV(x, y + height, zLevel, u * pxl, (v + vSize) * pxl); + tessellator.addVertexWithUV(x + width, y + height, zLevel, (u + uSize) * pxl, (v + vSize) * pxl); + tessellator.addVertexWithUV(x + width, y, zLevel, (u + uSize) * pxl, v * pxl); + tessellator.addVertexWithUV(x, y, zLevel, u * pxl, v * pxl); + tessellator.draw(); + } + + public static void drawHoveringText(List list, int x, int y, FontRenderer font, float fade, double scale, + int guiWidth, int guiHeight) { + if (!list.isEmpty()) { + GL11.glPushMatrix(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glScaled(scale, scale, 1); + x = (int) (x / scale); + y = (int) (y / scale); + + int k = 0; + Iterator iterator = list.iterator(); + + while (iterator.hasNext()) { + String s = (String) iterator.next(); + int l = font.getStringWidth(s); + + if (l > k) { + k = l; + } + } + + int adjX = x + 12; + int adjY = y - 12; + int i1 = 8; + + if (list.size() > 1) { + i1 += 2 + (list.size() - 1) * 10; + } + + if (adjX + k > (int) (guiWidth / scale)) { + adjX -= 28 + k; + } + + if (adjY + i1 + 6 > (int) (guiHeight / scale)) { + adjY = (int) (guiHeight / scale) - i1 - 6; + } + + int j1 = -267386864; + drawGradientRect(adjX - 3, adjY - 4, adjX + k + 3, adjY - 3, j1, j1, fade, scale); + drawGradientRect(adjX - 3, adjY + i1 + 3, adjX + k + 3, adjY + i1 + 4, j1, j1, fade, scale); + drawGradientRect(adjX - 3, adjY - 3, adjX + k + 3, adjY + i1 + 3, j1, j1, fade, scale); + drawGradientRect(adjX - 4, adjY - 3, adjX - 3, adjY + i1 + 3, j1, j1, fade, scale); + drawGradientRect(adjX + k + 3, adjY - 3, adjX + k + 4, adjY + i1 + 3, j1, j1, fade, scale); + int k1 = 1347420415; + int l1 = (k1 & 16711422) >> 1 | k1 & -16777216; + drawGradientRect(adjX - 3, adjY - 3 + 1, adjX - 3 + 1, adjY + i1 + 3 - 1, k1, l1, fade, scale); + drawGradientRect(adjX + k + 2, adjY - 3 + 1, adjX + k + 3, adjY + i1 + 3 - 1, k1, l1, fade, scale); + drawGradientRect(adjX - 3, adjY - 3, adjX + k + 3, adjY - 3 + 1, k1, k1, fade, scale); + drawGradientRect(adjX - 3, adjY + i1 + 2, adjX + k + 3, adjY + i1 + 3, l1, l1, fade, scale); + + for (int i2 = 0; i2 < list.size(); ++i2) { + String s1 = (String) list.get(i2); + + GL11.glEnable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_ALPHA_TEST); + OpenGlHelper.glBlendFunc(770, 771, 1, 0); + font.drawStringWithShadow(s1, adjX, adjY, ((int) (fade * 240F) + 0x10 << 24) | 0x00FFFFFF); + + adjY += 10; + } + + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glPopMatrix(); + } + } + + public static void drawGradientRect(int x1, int y1, int x2, int y2, int colour1, int colour2, float fade, + double scale) { + float f = ((colour1 >> 24 & 255) / 255.0F) * fade; + float f1 = (float) (colour1 >> 16 & 255) / 255.0F; + float f2 = (float) (colour1 >> 8 & 255) / 255.0F; + float f3 = (float) (colour1 & 255) / 255.0F; + float f4 = ((colour2 >> 24 & 255) / 255.0F) * fade; + float f5 = (float) (colour2 >> 16 & 255) / 255.0F; + float f6 = (float) (colour2 >> 8 & 255) / 255.0F; + float f7 = (float) (colour2 & 255) / 255.0F; + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glEnable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_ALPHA_TEST); + OpenGlHelper.glBlendFunc(770, 771, 1, 0); + GL11.glShadeModel(GL11.GL_SMOOTH); + Tessellator tessellator = Tessellator.instance; + tessellator.startDrawingQuads(); + tessellator.setColorRGBA_F(f1, f2, f3, f); + tessellator.addVertex((double) x2, (double) y1, 300D); + tessellator.addVertex((double) x1, (double) y1, 300D); + tessellator.setColorRGBA_F(f5, f6, f7, f4); + tessellator.addVertex((double) x1, (double) y2, 300D); + tessellator.addVertex((double) x2, (double) y2, 300D); + tessellator.draw(); + GL11.glShadeModel(GL11.GL_FLAT); + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } +} diff --git a/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentBase.java b/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentBase.java new file mode 100644 index 00000000..70e038ae --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentBase.java @@ -0,0 +1,224 @@ +package com.brandon3055.draconicevolution.client.utils.guicomponents; + +/** + * Created by Brandon on 25/12/2014. This gui system is based on open blocks gui system + */ + +import java.util.Iterator; +import java.util.List; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public abstract class ComponentBase extends Gui { + + protected static RenderItem itemRender = new RenderItem(); + protected int x; + protected int y; + protected boolean enabled = true; + public static Minecraft mc; + public FontRenderer fontRendererObj; + private String group = ""; + /** The width of the screen object. */ + public int width; + /** The height of the screen object. */ + public int height; + + public String name; + + public ComponentBase(int x, int y) { + this.x = x; + this.y = y; + mc = Minecraft.getMinecraft(); + fontRendererObj = mc.fontRenderer; + } + + public String getGroup() { + return group; + } + + public ComponentBase setGroup(String group) { + this.group = group; + return this; + } + + public ComponentBase setName(String name) { + this.name = name; + return this; + } + + public void setX(int x) { + this.x = x; + } + + public void setY(int y) { + this.y = y; + } + + public int getX() { + return x; + } + + public int getY() { + return y; + } + + public abstract int getWidth(); + + public abstract int getHeight(); + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + + public boolean isEnabled() { + return enabled; + } + + public boolean isMouseOver(int mouseX, int mouseY) { + return mouseX >= x && mouseX < x + getWidth() && mouseY >= y && mouseY < y + getHeight(); + } + + public abstract void renderBackground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY); + + public abstract void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY); + + public void renderFinal(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {} + + protected void drawHoveringText(List list, int x, int y, FontRenderer font) { + if (!list.isEmpty()) { + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + // RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_DEPTH_TEST); + int k = 0; + Iterator iterator = list.iterator(); + + while (iterator.hasNext()) { + String s = (String) iterator.next(); + int l = font.getStringWidth(s); + + if (l > k) { + k = l; + } + } + + int adjX = x + 12; + int adjY = y - 12; + int i1 = 8; + + if (list.size() > 1) { + i1 += 2 + (list.size() - 1) * 10; + } + + if (adjX + k > width) { + adjX -= 28 + k; + } + + if (adjY + i1 + 6 > height) { + adjY = height - i1 - 6; + } + + this.zLevel = 300.0F; + itemRender.zLevel = 300.0F; + int j1 = -267386864; + this.drawGradientRect(adjX - 3, adjY - 4, adjX + k + 3, adjY - 3, j1, j1); + this.drawGradientRect(adjX - 3, adjY + i1 + 3, adjX + k + 3, adjY + i1 + 4, j1, j1); + this.drawGradientRect(adjX - 3, adjY - 3, adjX + k + 3, adjY + i1 + 3, j1, j1); + this.drawGradientRect(adjX - 4, adjY - 3, adjX - 3, adjY + i1 + 3, j1, j1); + this.drawGradientRect(adjX + k + 3, adjY - 3, adjX + k + 4, adjY + i1 + 3, j1, j1); + int k1 = 1347420415; + int l1 = (k1 & 16711422) >> 1 | k1 & -16777216; + this.drawGradientRect(adjX - 3, adjY - 3 + 1, adjX - 3 + 1, adjY + i1 + 3 - 1, k1, l1); + this.drawGradientRect(adjX + k + 2, adjY - 3 + 1, adjX + k + 3, adjY + i1 + 3 - 1, k1, l1); + this.drawGradientRect(adjX - 3, adjY - 3, adjX + k + 3, adjY - 3 + 1, k1, k1); + this.drawGradientRect(adjX - 3, adjY + i1 + 2, adjX + k + 3, adjY + i1 + 3, l1, l1); + + for (int i2 = 0; i2 < list.size(); ++i2) { + String s1 = (String) list.get(i2); + font.drawStringWithShadow(s1, adjX, adjY, -1); + + if (i2 == 0) { + adjY += 2; + } + + adjY += 10; + } + + this.zLevel = 0.0F; + itemRender.zLevel = 0.0F; + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_DEPTH_TEST); + // RenderHelper.enableStandardItemLighting(); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + } + } + + public void drawItemStack(ItemStack stack, int x, int y, String count) { + if (stack == null) return; + GL11.glPushMatrix(); + GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_DEPTH_TEST); + + GL11.glTranslatef(0.0F, 0.0F, 32.0F); + this.zLevel = 200.0F; + itemRender.zLevel = 200.0F; + FontRenderer font; + font = stack.getItem().getFontRenderer(stack); + if (font == null) font = fontRendererObj; + itemRender.renderItemAndEffectIntoGUI(font, mc.getTextureManager(), stack, x, y); + // itemRender.renderEffect(mc.getTextureManager(), x, y); + if (!count.equals("null")) + itemRender.renderItemOverlayIntoGUI(font, mc.getTextureManager(), stack, x, y, count); + this.zLevel = 0.0F; + itemRender.zLevel = 0.0F; + + // GL11.glEnable(GL11.GL_LIGHTING); + // GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glPopAttrib(); + GL11.glPopMatrix(); + } + + protected void renderToolTip(ItemStack stack, int x, int y) { + List list = stack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips); + + for (int k = 0; k < list.size(); ++k) { + if (k == 0) { + list.set(k, stack.getRarity().rarityColor + (String) list.get(k)); + } else { + list.set(k, EnumChatFormatting.GRAY + (String) list.get(k)); + } + } + + FontRenderer font = stack.getItem().getFontRenderer(stack); + drawHoveringText(list, x, y, (font == null ? fontRendererObj : font)); + } + + public void mouseClicked(int x, int y, int button) {} + + public void setWorldAndResolution(Minecraft mc, int width, int height) { + + this.mc = mc; + this.fontRendererObj = mc.fontRenderer; + this.width = width; + this.height = height; + } + + /** Translate To Local */ + public String ttl(String unlocalizedName) { + return StatCollector.translateToLocal(unlocalizedName); + } + + public void updateScreen() {} + + protected void keyTyped(char par1, int par2) {} +} diff --git a/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentButton.java b/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentButton.java new file mode 100644 index 00000000..bd0c65d7 --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentButton.java @@ -0,0 +1,122 @@ +package com.brandon3055.draconicevolution.client.utils.guicomponents; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StringUtils; + +import org.lwjgl.opengl.GL11; + +/** + * Created by Brandon on 1/01/2015. + */ +public class ComponentButton extends ComponentBase { + + protected static final ResourceLocation buttonTextures = new ResourceLocation("textures/gui/widgets.png"); + + public int buttonId; + public GUIBase gui; + public int xSize; + public int ySize; + public int packedFGColour; + public String displayString; + public String hoverText; + + public ComponentButton(int x, int y, int xSize, int ySize, int id, GUIBase gui, String displayString) { + super(x, y); + this.xSize = xSize; + this.ySize = ySize; + this.buttonId = id; + this.gui = gui; + this.displayString = displayString; + } + + public ComponentButton(int x, int y, int xSize, int ySize, int id, GUIBase gui, String displayString, + String hoverText) { + this(x, y, xSize, ySize, id, gui, displayString); + this.hoverText = hoverText; + } + + @Override + public int getWidth() { + return xSize; + } + + @Override + public int getHeight() { + return ySize; + } + + @Override + public void renderBackground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {} + + @Override + public void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { + GL11.glPushMatrix(); + GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); + // FontRenderer fontrenderer = minecraft.fontRenderer; + minecraft.getTextureManager().bindTexture(buttonTextures); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + int k = isMouseOver(mouseX, mouseY) ? 2 : 1; + GL11.glEnable(GL11.GL_BLEND); + OpenGlHelper.glBlendFunc(770, 771, 1, 0); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + this.drawTexturedModalRect(this.x, this.y, 0, 46 + k * 20, this.xSize / 2, this.ySize); + this.drawTexturedModalRect( + this.x + this.xSize / 2, + this.y, + 200 - this.xSize / 2, + 46 + k * 20, + this.xSize / 2, + this.ySize); + if (this.ySize < 20) { + + this.drawTexturedModalRect(x, y + 3, 0, (46 + k * 20) + 20 - ySize + 3, xSize / 2, ySize - 3); + this.drawTexturedModalRect( + x + xSize / 2, + y + 3, + 200 - xSize / 2, + (46 + k * 20) + 20 - ySize + 3, + xSize / 2, + ySize - 3); + } + // this.mouseDragged(minecraft, mouseX, mouseY); + int l = 14737632; + + if (packedFGColour != 0) { + l = packedFGColour; + } else if (!this.enabled) { + l = 10526880; + } else if (isMouseOver(mouseX, mouseY)) { + l = 16777120; + } + this.drawCenteredString( + fontRendererObj, + this.displayString, + this.x + this.xSize / 2, + this.y + (this.ySize - 8) / 2, + l); + GL11.glPopAttrib(); + GL11.glPopMatrix(); + } + + @Override + public void renderFinal(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { + if (isMouseOver(mouseX, mouseY) && !StringUtils.isNullOrEmpty(hoverText)) { + List list = new ArrayList(); + list.add(hoverText); + drawHoveringText(list, mouseX + offsetX, mouseY + offsetY + 10, fontRendererObj); + } + } + + @Override + public void mouseClicked(int x, int y, int button) { + Minecraft.getMinecraft().getSoundHandler() + .playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); + gui.buttonClicked(buttonId, button); + } +} diff --git a/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentCollection.java b/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentCollection.java new file mode 100644 index 00000000..795c21b1 --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentCollection.java @@ -0,0 +1,170 @@ +package com.brandon3055.draconicevolution.client.utils.guicomponents; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.client.Minecraft; + +/** + * Created by Brandon on 28/12/2014. + */ +public class ComponentCollection extends ComponentBase { + + protected List components = new ArrayList(); + protected int xSize; + protected int ySize; + protected List deadGroups = new ArrayList(); + protected GUIBase gui; + private boolean openBoarders = false; + + public ComponentCollection(int x, int y, int xSize, int ySize, GUIBase gui) { + super(x, y); + this.xSize = xSize; + this.ySize = ySize; + this.gui = gui; + } + + @Override + public int getWidth() { + return xSize; + } + + @Override + public int getHeight() { + return ySize; + } + + public ComponentBase addComponent(ComponentBase component) { + components.add(component); + component.setWorldAndResolution(Minecraft.getMinecraft(), width, height); + return component; + } + + private boolean isComponentEnabled(ComponentBase component) { + return component != null && component.isEnabled(); + } + + private boolean isComponentCapturingMouse(ComponentBase component, int mouseX, int mouseY) { + return isComponentEnabled(component) && component.isMouseOver(mouseX, mouseY); + } + + @Override + public final void renderBackground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { + for (ComponentBase component : components) if (isComponentEnabled(component)) { + component.renderBackground(minecraft, offsetX + this.x, offsetY + this.y, mouseX - this.x, mouseY - this.y); + } + } + + @Override + public final void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { + for (ComponentBase component : components) if (isComponentEnabled(component)) { + component.renderForground(minecraft, offsetX + this.x, offsetY + this.y, mouseX - this.x, mouseY - this.y); + } + } + + @Override + public final void renderFinal(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { + for (ComponentBase component : components) if (isComponentEnabled(component)) { + component.renderFinal(minecraft, offsetX + this.x, offsetY + this.y, mouseX - this.x, mouseY - this.y); + } + } + + @Override + public void mouseClicked(int x, int y, int button) { + for (ComponentBase component : components) { + if (!gui.buttonPressed && component.isEnabled() && component.isMouseOver(x, y)) { + component.mouseClicked(x, y, button); + } + } + // removeScheduled(); + } + + @Override + public void keyTyped(char par1, int par2) { + for (ComponentBase component : components) { + if (component.isEnabled()) { + component.keyTyped(par1, par2); + } + } + } + + public List getComponents() { + return components; + } + + public ComponentBase getComponent(String name) { + for (ComponentBase component : components) { + if (component.name != null && component.name.equals(name)) return component; + } + return null; + } + + public void setGroupEnabled(String group, boolean enabled) { + for (ComponentBase component : components) { + if (component.getGroup().equals(group)) { + component.setEnabled(enabled); + } + } + } + + public void setOnlyGroupEnabled(String group) { + for (ComponentBase component : components) { + if (component.getGroup().equals(group)) { + component.setEnabled(enabled); + } else { + component.setEnabled(false); + } + } + } + + public void setComponentEnabled(String name, boolean enabled) { + for (ComponentBase component : components) { + if (component.name != null && component.name.equals(name)) { + component.setEnabled(enabled); + } + } + } + + public void removeGroup(String group) { + List list = new ArrayList(); + for (ComponentBase component : components) { + if (component.getGroup().equals(group)) list.add(component); + } + components.removeAll(list); + } + + @Override + public void setWorldAndResolution(Minecraft mc, int width, int height) { + super.setWorldAndResolution(mc, width, height); + for (ComponentBase component : components) { + component.setWorldAndResolution(mc, width, height); + } + } + + public void removeScheduled() { + if (!deadGroups.isEmpty()) { + for (String s : deadGroups) removeGroup(s); + deadGroups.clear(); + } + } + + public void schedulRemoval(String group) { + deadGroups.add(group); + } + + @Override + public void updateScreen() { + for (ComponentBase component : components) { + component.updateScreen(); + } + } + + public ComponentCollection setOpenBoarders() { + openBoarders = true; + return this; + } + + public boolean openBoarders() { + return openBoarders; + } +} diff --git a/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentItemRenderer.java b/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentItemRenderer.java new file mode 100644 index 00000000..d3aed505 --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentItemRenderer.java @@ -0,0 +1,50 @@ +package com.brandon3055.draconicevolution.client.utils.guicomponents; + +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + +/** + * Created by Brandon on 31/12/2014. + */ +public class ComponentItemRenderer extends ComponentBase { + + private static final ResourceLocation texture = new ResourceLocation("brandonscore:textures/gui/Widgets.png"); + + ItemStack stack; + + public ComponentItemRenderer(int x, int y, ItemStack stack) { + super(x, y); + this.stack = stack; + } + + @Override + public int getWidth() { + return 20; + } + + @Override + public int getHeight() { + return 20; + } + + @Override + public void renderBackground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {} + + @Override + public void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { + GL11.glColor4f(1f, 1f, 1f, 1f); + Minecraft.getMinecraft().renderEngine.bindTexture(texture); + drawTexturedModalRect(x, y, 118, 0, getWidth(), getHeight()); + drawItemStack(stack, x + 2, y + 2, "null"); + } + + @Override + public void renderFinal(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { + if (isMouseOver(mouseX, mouseY)) { + renderToolTip(stack, mouseX + offsetX, mouseY + offsetY); + } + } +} diff --git a/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentScrollingBase.java b/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentScrollingBase.java new file mode 100644 index 00000000..6336ceee --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentScrollingBase.java @@ -0,0 +1,21 @@ +package com.brandon3055.draconicevolution.client.utils.guicomponents; + +/** + * Created by Brandon on 6/03/2015. + */ +public abstract class ComponentScrollingBase extends ComponentBase { + + protected GUIScrollingBase gui; + + public ComponentScrollingBase(int x, int y, GUIScrollingBase gui) { + super(x, y); + this.gui = gui; + } + + public abstract void handleScrollInput(int direction); + + @Override + public boolean isMouseOver(int mouseX, int mouseY) { + return super.isMouseOver(mouseX, mouseY + gui.scrollOffset); + } +} diff --git a/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentSlotBackground.java b/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentSlotBackground.java new file mode 100644 index 00000000..2e17c847 --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentSlotBackground.java @@ -0,0 +1,48 @@ +package com.brandon3055.draconicevolution.client.utils.guicomponents; + +import net.minecraft.client.Minecraft; +import net.minecraft.util.ResourceLocation; + +/** + * Created by Brandon on 13/01/2015. + */ +public class ComponentSlotBackground extends ComponentBase { + + private static final ResourceLocation widgets = new ResourceLocation("brandonscore:textures/gui/Widgets.png"); + + public ComponentSlotBackground(int x, int y) { + super(x, y); + } + + @Override + public int getWidth() { + return 18; + } + + @Override + public int getHeight() { + return 18; + } + + @Override + public void renderBackground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { + minecraft.renderEngine.bindTexture(widgets); + drawTexturedModalRect(x, y, 119, 1, getWidth(), getHeight()); + } + + @Override + public void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {} + + public static ComponentCollection addInventorySlots(ComponentCollection c, int xOffset, int yOffset, + int lockedSlot) { + for (int x = 0; x < 9; x++) if (x != lockedSlot) + c.addComponent(new ComponentSlotBackground(xOffset + x * 18, yOffset + 58)).setGroup("INVENTORY"); + + for (int y = 0; y < 3; y++) { + for (int x = 0; x < 9; x++) if (x + y * 9 + 9 != lockedSlot) + c.addComponent(new ComponentSlotBackground(xOffset + x * 18, yOffset + y * 18)).setGroup("INVENTORY"); + } + + return c; + } +} diff --git a/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentTextField.java b/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentTextField.java new file mode 100644 index 00000000..5fc4713f --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentTextField.java @@ -0,0 +1,71 @@ +package com.brandon3055.draconicevolution.client.utils.guicomponents; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiTextField; + +/** + * Created by brandon3055 on 16/2/2016. + */ +public class ComponentTextField extends ComponentBase { + + public GuiTextField textField; + private int xSize; + private int ySize; + private GUIBase parent; + private String label = ""; + private int labelColour = 0; + + public ComponentTextField(GUIBase parent, int x, int y, int xSize, int ySize) { + super(x, y); + this.xSize = xSize; + this.ySize = ySize; + this.parent = parent; + textField = new GuiTextField(fontRendererObj, x, y, xSize, ySize); + } + + @Override + public int getWidth() { + return xSize; + } + + @Override + public int getHeight() { + return ySize; + } + + @Override + public void renderBackground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {} + + @Override + public void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { + drawRect(x - 1, y - 1, x + xSize - textField.width + 1, y + ySize + 1, -6250336); + textField.drawTextBox(); + drawRect(x, y, x + xSize - textField.width, y + ySize, -16777216); + fontRendererObj.drawString(label, x + 1, y + 2, labelColour); + } + + @Override + public void mouseClicked(int x, int y, int button) { + textField.mouseClicked(x, y, button); + } + + @Override + protected void keyTyped(char par1, int par2) { + textField.textboxKeyTyped(par1, par2); + if (textField.isFocused()) parent.componentCallBack(this); + } + + public boolean isFocused() { + return textField.isFocused(); + } + + public ComponentTextField setLabel(String label, int labelColour) { + this.label = label; + this.labelColour = labelColour; + int labelLength = fontRendererObj.getStringWidth(label); + textField.xPosition = x + labelLength; + textField.width = xSize - labelLength; + textField.setTextColor(labelColour); + return this; + } +} diff --git a/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentTextureButton.java b/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentTextureButton.java new file mode 100644 index 00000000..f24dc124 --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentTextureButton.java @@ -0,0 +1,91 @@ +package com.brandon3055.draconicevolution.client.utils.guicomponents; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + +/** + * Created by brandon3055 on 31/7/2015. + */ +public class ComponentTextureButton extends ComponentButton { + + public int textureXPos; + public int textureYPos; + private ResourceLocation texture; + private boolean forceFullRender = false; + + // public ComponentTextureButton(int id, int xPos, int yPos, int textureXPos, int textureYPos, int xSise, int ySise, + // String text) { + public ComponentTextureButton(int x, int y, int textureXPos, int textureYPos, int xSize, int ySize, int id, + GUIBase gui, String displayString, String hoverText, ResourceLocation texture) { + super(x, y, xSize, ySize, id, gui, displayString, hoverText); + this.textureXPos = textureXPos; + this.textureYPos = textureYPos; + this.texture = texture; + } + + public ComponentTextureButton forceFullRender() { + forceFullRender = true; + return this; + } + + @Override + public void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { + + GL11.glPushMatrix(); + minecraft.getTextureManager().bindTexture(texture); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + if (!forceFullRender) { + int k = isMouseOver(mouseX, mouseY) ? 2 : 1; + GL11.glEnable(GL11.GL_BLEND); + OpenGlHelper.glBlendFunc(770, 771, 1, 0); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + this.drawTexturedModalRect(this.x, this.y, textureXPos, textureYPos + k * ySize, this.xSize, this.ySize); + int l = 14737632; + + if (packedFGColour != 0) { + l = packedFGColour; + } else if (!this.enabled) { + l = 10526880; + } else if (isMouseOver(mouseX, mouseY)) { + l = 16777120; + } + this.drawCenteredString( + fontRendererObj, + this.displayString, + this.x + this.xSize / 2, + this.y + (this.ySize - 8) / 2, + l); + } else { + int xPos = this.x; + int yPos = this.y; + int xSize = this.xSize; + int ySize = this.ySize; + Tessellator tessellator = Tessellator.instance; + + if (isMouseOver(mouseX, mouseY)) { + GL11.glDisable(GL11.GL_ALPHA_TEST); + tessellator.setColorRGBA_I(0x000000, 255); + tessellator.startDrawingQuads(); + tessellator.addVertex((double) xPos, (double) (yPos + ySize), (double) this.zLevel); + tessellator.addVertex((double) (xPos + xSize), (double) (yPos + ySize), (double) this.zLevel); + tessellator.addVertex((double) (xPos + xSize), (double) yPos, (double) this.zLevel); + tessellator.addVertex((double) xPos, (double) yPos, (double) this.zLevel); + tessellator.draw(); + GL11.glEnable(GL11.GL_ALPHA_TEST); + } + + tessellator.startDrawingQuads(); + tessellator.addVertexWithUV((double) xPos, (double) (yPos + ySize), (double) this.zLevel, 0, 1); + tessellator.addVertexWithUV((double) (xPos + xSize), (double) (yPos + ySize), (double) this.zLevel, 1, 1); + tessellator.addVertexWithUV((double) (xPos + xSize), (double) yPos, (double) this.zLevel, 1, 0); + tessellator.addVertexWithUV((double) xPos, (double) yPos, (double) this.zLevel, 0, 0); + tessellator.draw(); + } + GL11.glPopMatrix(); + } +} diff --git a/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentTexturedRect.java b/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentTexturedRect.java new file mode 100644 index 00000000..29af79b6 --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/ComponentTexturedRect.java @@ -0,0 +1,68 @@ +package com.brandon3055.draconicevolution.client.utils.guicomponents; + +import net.minecraft.client.Minecraft; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + +/** + * Created by Brandon on 29/12/2014. + */ +public class ComponentTexturedRect extends ComponentBase { + + private int width; + private int height; + private int texX = 0; + private int texY = 0; + private final ResourceLocation texture; + private boolean transparent = false; + + public ComponentTexturedRect(int x, int y, int width, int height, ResourceLocation texture) { + super(x, y); + this.width = width; + this.height = height; + this.texture = texture; + } + + public ComponentTexturedRect(int x, int y, int texX, int texY, int width, int height, ResourceLocation texture, + boolean transparent) { + super(x, y); + this.width = width; + this.height = height; + this.texture = texture; + this.texX = texX; + this.texY = texY; + this.transparent = transparent; + } + + @Override + public int getWidth() { + return width; + } + + @Override + public int getHeight() { + return height; + } + + @Override + public void renderBackground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { + Minecraft.getMinecraft().renderEngine.bindTexture(texture); + if (transparent) { + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_BLEND); + // GL11.glScalef(1f, 0.33f, 1f); + // GL11.glScalef(0.5f, 0.5f, 0.5f); + } + GL11.glColor4f(1f, 1f, 1f, 1f); + drawTexturedModalRect(x, y, texX, texY, width, height); + if (transparent) { + // GL11.glScalef(2f, 2f, 2f); + GL11.glDisable(GL11.GL_BLEND); + GL11.glPopMatrix(); + } + } + + @Override + public void renderForground(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {} +} diff --git a/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/GUIBase.java b/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/GUIBase.java new file mode 100644 index 00000000..41ce31de --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/GUIBase.java @@ -0,0 +1,142 @@ +package com.brandon3055.draconicevolution.client.utils.guicomponents; + +/** + * Created by Brandon on 25/12/2014. This class is copied from open blocks + */ + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.inventory.Container; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public abstract class GUIBase extends GuiContainer { + + protected ComponentCollection collection; + /** used to prevent multiple buttons being pressed wen overlapping components are changed */ + protected boolean buttonPressed = false; + + public GUIBase(Container container, int xSize, int ySize) { + super(container); + this.xSize = xSize; + this.ySize = ySize; + mc = Minecraft.getMinecraft(); + collection = assembleComponents(); + } + + protected abstract ComponentCollection assembleComponents(); + + protected void addDependentComponents() {} + + @Override + protected void mouseClicked(int x, int y, int button) { + super.mouseClicked(x, y, button); + if (collection.isMouseOver(x - this.guiLeft, y - this.guiTop) || collection.openBoarders()) { + collection.mouseClicked(x - this.guiLeft, y - this.guiTop, button); + } + } + + @Override + protected void mouseMovedOrUp(int x, int y, int button) { + super.mouseMovedOrUp(x, y, button); + if (collection.isMouseOver(x - this.guiLeft, y - this.guiTop) || collection.openBoarders()) { + // if (button >= 0) collection.mouseUp(x - this.guiLeft, y - this.guiTop, button); + } + } + + @Override + protected void mouseClickMove(int x, int y, int button, long time) { + super.mouseClickMove(x, y, button, time); + // if (collection.isMouseOver(x - this.guiLeft, y - this.guiTop)) collection.mouseDrag(x - this.guiLeft, y - + // this.guiTop, button, time); + } + + @Override + protected void keyTyped(char par1, int par2) { + super.keyTyped(par1, par2); + collection.keyTyped(par1, par2); + } + + public void preRender(float mouseX, float mouseY) {} + + public void postRender(int mouseX, int mouseY) {} + + @Override + protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) { + prepareRenderState(); + preRender(mouseX, mouseY); + GL11.glPushMatrix(); + GL11.glTranslated(this.guiLeft, this.guiTop, 0); + collection.renderBackground(this.mc, 0, 0, mouseX - this.guiLeft, mouseY - this.guiTop); + GL11.glPopMatrix(); + postRender(mouseX, mouseY); + restoreRenderState(); + } + + @Override + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { + // prepareRenderState(); + GL11.glPushMatrix(); + collection.renderForground(this.mc, 0, 0, mouseX - this.guiLeft, mouseY - this.guiTop); + GL11.glPopMatrix(); + // restoreRenderState(); + } + + @Override + public void drawScreen(int mouseX, int mouseY, float par3) { + super.drawScreen(mouseX, mouseY, par3); + prepareRenderState(); + GL11.glPushMatrix(); + collection.renderFinal(this.mc, this.guiLeft, this.guiTop, mouseX - this.guiLeft, mouseY - this.guiTop); + GL11.glPopMatrix(); + restoreRenderState(); + } + + protected void prepareRenderState() { + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_DEPTH_TEST); + } + + protected void restoreRenderState() { + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_DEPTH_TEST); + RenderHelper.enableStandardItemLighting(); + } + + @Override + public void setWorldAndResolution(Minecraft mc, int width, int height) { + super.setWorldAndResolution(mc, width, height); + collection.setWorldAndResolution(mc, width, height); + } + + @Override + public void updateScreen() { + super.updateScreen(); + collection.removeScheduled(); + collection.updateScreen(); + buttonPressed = false; + } + + public void buttonClicked(int id, int button) { + buttonPressed = true; + } + + public int getXSize() { + return xSize; + } + + public int getYSize() { + return ySize; + } + + /** + * This can be used by components to contact the GUI and the gui can then do some custom operation for that + * component Added so ComponentTextField can let the gui know when it has been changed + */ + public void componentCallBack(ComponentBase component) {} +} diff --git a/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/GUIScrollingBase.java b/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/GUIScrollingBase.java new file mode 100644 index 00000000..1c237a94 --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/client/utils/guicomponents/GUIScrollingBase.java @@ -0,0 +1,76 @@ +package com.brandon3055.draconicevolution.client.utils.guicomponents; + +import net.minecraft.inventory.Container; + +/** + * Created by Brandon on 6/03/2015. + */ +public abstract class GUIScrollingBase extends GUIBase { + + public int scrollOffset; + public int pageLength; + public int scrollLimit; + public int barPosition; + public boolean disableScrollBar = true; + + public GUIScrollingBase(Container container, int xSize, int ySize) { + super(container, xSize, ySize); + } + + @Override + public void handleMouseInput() { + super.handleMouseInput(); + int i = org.lwjgl.input.Mouse.getEventDWheel(); + if (i != 0) { + handleScrollInput(i > 0 ? -1 : 1); + + for (ComponentBase c : collection.getComponents()) { + if (c instanceof ComponentScrollingBase && c.isEnabled()) + ((ComponentScrollingBase) c).handleScrollInput(i > 0 ? -1 : 1); + } + } + } + + public abstract void handleScrollInput(int direction); + + @Override + protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) { + super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); + } + + protected int clickedY = 0; + protected boolean scrollPressed = false; + + @Override + protected void mouseClicked(int x, int y, int button) { + super.mouseClicked(x, y, button); + if (disableScrollBar) return; + clickedY = y; + if ((x - guiLeft + 17) > 0 && (x - guiLeft + 17) < 17 + && clickedY - guiTop - 20 > barPosition + && clickedY - guiTop - 20 < barPosition + 38) + scrollPressed = true; + } + + @Override + protected void mouseMovedOrUp(int x, int y, int button) { + super.mouseMovedOrUp(x, y, button); + scrollPressed = false; + } + + @Override + protected void mouseClickMove(int x, int y, int button, long time) { + super.mouseClickMove(x, y, button, time); + if (!scrollPressed || disableScrollBar) return; + barPosition += y - clickedY; + if (barPosition < 0) barPosition = 0; + else if (barPosition > 247) barPosition = 247; + if (barPosition != 0 && barPosition != 247) clickedY = y; + barMoved((double) barPosition / 247D * 1D); + } + + /** + * @param position New bar position between 0 (top) and 1 (bottom) + */ + public abstract void barMoved(double position); +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/CommonProxy.java b/src/main/java/com/brandon3055/draconicevolution/common/CommonProxy.java index 042575ab..567c0ef2 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/CommonProxy.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/CommonProxy.java @@ -1,7 +1,9 @@ package com.brandon3055.draconicevolution.common; import net.minecraft.client.audio.ISound; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; @@ -58,7 +60,6 @@ import com.brandon3055.draconicevolution.common.network.TileObjectPacket; import com.brandon3055.draconicevolution.common.network.ToolModePacket; import com.brandon3055.draconicevolution.common.tileentities.TileCKeyStone; import com.brandon3055.draconicevolution.common.tileentities.TileChaosShard; -import com.brandon3055.draconicevolution.common.tileentities.TileContainerTemplate; import com.brandon3055.draconicevolution.common.tileentities.TileCustomSpawner; import com.brandon3055.draconicevolution.common.tileentities.TileDislocatorInhibitor; import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter; @@ -73,7 +74,6 @@ import com.brandon3055.draconicevolution.common.tileentities.TilePlayerDetectorA import com.brandon3055.draconicevolution.common.tileentities.TilePotentiometer; import com.brandon3055.draconicevolution.common.tileentities.TileSunDial; import com.brandon3055.draconicevolution.common.tileentities.TileTeleporterStand; -import com.brandon3055.draconicevolution.common.tileentities.TileTestBlock; import com.brandon3055.draconicevolution.common.tileentities.TileUpgradeModifier; import com.brandon3055.draconicevolution.common.tileentities.TileWeatherController; import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyRelay; @@ -91,8 +91,10 @@ import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.Til import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorEnergyInjector; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorStabilizer; -import com.brandon3055.draconicevolution.common.utills.DragonChunkLoader; -import com.brandon3055.draconicevolution.common.utills.LogHelper; +import com.brandon3055.draconicevolution.common.utils.DragonChunkLoader; +import com.brandon3055.draconicevolution.common.utils.LogHelper; +import com.brandon3055.draconicevolution.common.utils.handlers.FileHandler; +import com.brandon3055.draconicevolution.common.utils.handlers.ProcessHandler; import com.brandon3055.draconicevolution.common.world.DraconicWorldGenerator; import com.brandon3055.draconicevolution.integration.computers.CCOCIntegration; @@ -108,6 +110,8 @@ import cpw.mods.fml.relauncher.Side; public class CommonProxy { public void preInit(FMLPreInitializationEvent event) { + FileHandler.init(event); + ProcessHandler.init(); ConfigHandler.init(event.getSuggestedConfigurationFile()); BalanceConfigHandler.init(event.getModConfigurationDirectory()); registerEventListeners(event.getSide()); @@ -119,29 +123,6 @@ public class CommonProxy { registerOres(); DraconicEvolution.reaperEnchant = new EnchantmentReaper(ConfigHandler.reaperEnchantID); - // - // Potion[] potionTypes = null; - // LogHelper.info("Expanding Potion array size to 256"); - // - // 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(); - // } - // } Achievements.addModAchievements(); LogHelper.info("Finished PreInitialization"); @@ -232,10 +213,6 @@ public class CommonProxy { GameRegistry.registerTileEntity(TileChaosShard.class, References.RESOURCESPREFIX + "TileChaosShard"); GameRegistry.registerTileEntity(TileUpgradeModifier.class, References.RESOURCESPREFIX + "TileEnhancementModifier"); GameRegistry.registerTileEntity(TileDislocatorInhibitor.class, References.RESOURCESPREFIX + "TileDislocatorInhibitor"); - if (DraconicEvolution.debug) { - GameRegistry.registerTileEntity(TileTestBlock.class, References.RESOURCESPREFIX + "TileTestBlock"); - GameRegistry.registerTileEntity(TileContainerTemplate.class, References.RESOURCESPREFIX + "TileContainerTemplate"); - } // spotless:on } @@ -281,7 +258,6 @@ public class CommonProxy { 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); - // 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); EntityRegistry.registerModEntity(EntityChaosGuardian.class, "ChaosGuardian", 6, DraconicEvolution.instance, 256, 1, true); EntityRegistry.registerModEntity(EntityDragonProjectile.class, "DragonProjectile", 7, DraconicEvolution.instance, 256, 1, true); @@ -311,4 +287,32 @@ public class CommonProxy { public ISound playISound(ISound sound) { return null; } + + public boolean isDedicatedServer() { + return true; + } + + public MinecraftServer getMCServer() { + return FMLCommonHandler.instance().getMinecraftServerInstance(); + } + + public World getClientWorld() { + return null; + } + + public boolean isSpaceDown() { + return false; + } + + public boolean isCtrlDown() { + return false; + } + + public boolean isShiftDown() { + return false; + } + + public EntityPlayer getClientPlayer() { + 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 10736cdd..0e38d9fa 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/ModBlocks.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/ModBlocks.java @@ -4,8 +4,6 @@ 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.BlockContainerTemplate; import com.brandon3055.draconicevolution.common.blocks.BlockDE; import com.brandon3055.draconicevolution.common.blocks.CKeyStone; import com.brandon3055.draconicevolution.common.blocks.ChaosCrystal; @@ -22,7 +20,6 @@ import com.brandon3055.draconicevolution.common.blocks.Potentiometer; import com.brandon3055.draconicevolution.common.blocks.RainSensor; import com.brandon3055.draconicevolution.common.blocks.SafetyFlame; import com.brandon3055.draconicevolution.common.blocks.TeleporterStand; -import com.brandon3055.draconicevolution.common.blocks.TestBlock; import com.brandon3055.draconicevolution.common.blocks.XRayBlock; import com.brandon3055.draconicevolution.common.blocks.machine.DislocatorInhibitor; import com.brandon3055.draconicevolution.common.blocks.machine.DissEnchanter; @@ -58,7 +55,6 @@ public class ModBlocks { public static BlockDE weatherController; public static BlockDE sunDial; public static BlockDE draconiumOre; - public static BlockDE testBlock; public static BlockDE grinder; public static BlockDE potentiometer; public static BlockDE rainSensor; @@ -141,11 +137,6 @@ public class ModBlocks { if (isEnabled(chaosShardAtmos)) GameRegistry.registerBlock(chaosShardAtmos, "chaosShardAtmos"); - if (DraconicEvolution.debug) { - testBlock = new TestBlock(); - containerTemplate = new BlockContainerTemplate(); - } - resurrectionStone = new ItemStack(ModBlocks.draconiumBlock, 1, 1); } 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 58f155f3..4b67f3cf 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/achievements/Achievements.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/achievements/Achievements.java @@ -9,9 +9,9 @@ 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 com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockContainerTemplate.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockContainerTemplate.java deleted file mode 100644 index 2b2874e9..00000000 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockContainerTemplate.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.brandon3055.draconicevolution.common.blocks; - -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -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); - this.setCreativeTab(DraconicEvolution.tabBlocksItems); - this.setStepSound(soundTypeStone); - this.setHardness(1f); - this.setResistance(200.0f); - ModBlocks.register(this); - } - - @SideOnly(Side.CLIENT) - @Override - public void registerBlockIcons(IIconRegister iconRegister) { - blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "machine_side"); - } - - @Override - public TileEntity createNewTileEntity(World world, int meta) { - return new TileContainerTemplate(); - } - - @Override - 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); - } - return true; - } - - @SideOnly(Side.CLIENT) - @Override - public int getRenderType() { - return super.getRenderType(); - } - - @Override - public boolean isOpaqueCube() { - return false; - } - - @Override - public boolean renderAsNormalBlock() { - return false; - } - - @Override - public void breakBlock(World world, int x, int y, int z, Block block, int meta) { - TileEntity te = world.getTileEntity(x, y, z); - if (te != null && te instanceof IInventory) { - IInventory inventory = (IInventory) te; - - for (int i = 0; i < inventory.getSizeInventory(); i++) { - ItemStack stack = inventory.getStackInSlot(i); - - if (stack != null) { - float spawnX = x + world.rand.nextFloat(); - float spawnY = y + world.rand.nextFloat(); - float spawnZ = z + world.rand.nextFloat(); - - EntityItem droppedItem = new EntityItem(world, spawnX, spawnY, spawnZ, stack); - - float multiplier = 0.05F; - - droppedItem.motionX = (-0.5F + world.rand.nextFloat()) * multiplier; - droppedItem.motionY = (4 + world.rand.nextFloat()) * multiplier; - droppedItem.motionZ = (-0.5F + world.rand.nextFloat()) * multiplier; - - world.spawnEntityInWorld(droppedItem); - } - } - } - - super.breakBlock(world, x, y, z, block, meta); - } -} 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 e4a0e98f..447d649d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockCustomDrop.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/BlockCustomDrop.java @@ -10,7 +10,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import com.brandon3055.brandonscore.common.utills.InventoryUtils; +import com.brandon3055.draconicevolution.common.utils.InventoryUtils; import com.google.common.collect.Lists; /** 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 880a486a..d8f21dea 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/CKeyStone.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/CKeyStone.java @@ -12,7 +12,6 @@ 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; @@ -20,6 +19,7 @@ import com.brandon3055.draconicevolution.common.blocks.itemblocks.CKeyStoneItemB import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.tileentities.TileCKeyStone; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; 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 e3ac38c3..881790e4 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/CustomSpawner.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/CustomSpawner.java @@ -23,16 +23,16 @@ 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 com.brandon3055.draconicevolution.common.utils.IHudDisplayBlock; +import com.brandon3055.draconicevolution.common.utils.InfoHelper; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.utils.LogHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; 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 b4803113..e059d654 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumChest.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/DraconiumChest.java @@ -35,7 +35,7 @@ import com.brandon3055.draconicevolution.common.blocks.itemblocks.DraconiumChest 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 com.brandon3055.draconicevolution.common.utils.ICustomItemData; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; 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 2f7d9561..9a090603 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/TeleporterStand.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/TeleporterStand.java @@ -14,13 +14,13 @@ 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 com.brandon3055.draconicevolution.common.utils.Teleporter; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; 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 59ea2fa0..03fbc4da 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 @@ -11,7 +11,7 @@ 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; +import com.brandon3055.draconicevolution.common.utils.ICustomItemData; /** * Created by Brandon on 13/11/2014. 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 a7a03211..f6af5cfb 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,5 +1,8 @@ package com.brandon3055.draconicevolution.common.blocks.machine; +import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber; +import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumberCompact; + import java.util.ArrayList; import java.util.List; @@ -17,7 +20,6 @@ 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; @@ -30,7 +32,8 @@ import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnerg 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 com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock; +import com.brandon3055.draconicevolution.common.utils.IHudDisplayBlock; +import com.brandon3055.draconicevolution.common.utils.InfoHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -40,13 +43,6 @@ import cpw.mods.fml.relauncher.SideOnly; */ 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; - public static final byte TRANSCEIVER_TIER_2 = 3; - public static final byte WIRELESS_TRANSCEIVER_TIER_1 = 3; - public static final byte WIRELESS_TRANSCEIVER_TIER_2 = 4; - public EnergyCrystal() { super(Material.glass); this.setBlockName(Strings.energyCrystalName); @@ -232,8 +228,8 @@ public class EnergyCrystal extends BlockDE implements IHudDisplayBlock { 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() + "%"); + list.add("RF: " + formatNumberCompact(tile.getEnergyStored(ForgeDirection.DOWN))); + list.add("Cap: " + formatNumber(tile.getCapacity()) + "%"); if (tile instanceof TileEnergyTransceiver) { String x5 = ((TileEnergyTransceiver) tile).getPowerTier() > 0 && ((TileEnergyTransceiver) tile).transferBoost @@ -247,16 +243,16 @@ public class EnergyCrystal extends BlockDE implements IHudDisplayBlock { if (tile instanceof TileRemoteEnergyBase) { list.add( StatCollector.translateToLocal("info.de.connections.txt") + ": " - + ((TileRemoteEnergyBase) tile).linkedDevices.size() + + formatNumber(((TileRemoteEnergyBase) tile).linkedDevices.size()) + "/" - + tile.getMaxConnections()); + + formatNumber(tile.getMaxConnections())); } if (tile instanceof TileWirelessEnergyTransceiver) { list.add( StatCollector.translateToLocal("info.de.wirelessConnections.txt") + ": " - + ((TileWirelessEnergyTransceiver) tile).receiverList.size() + + formatNumber(((TileWirelessEnergyTransceiver) tile).receiverList.size()) + "/" - + ((TileWirelessEnergyTransceiver) tile).getmaxWirelessConnections()); + + formatNumber(((TileWirelessEnergyTransceiver) tile).getmaxWirelessConnections())); } if (tile instanceof TileRemoteEnergyBase) { 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 a14f1914..2ce0b040 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 @@ -17,7 +17,6 @@ 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; @@ -28,6 +27,7 @@ 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 com.brandon3055.draconicevolution.common.utils.Utils; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -174,7 +174,7 @@ public class FlowGate extends BlockDE { ((TileGate) worldObj.getTileEntity(x, y, z)).output = facing; worldObj.setBlockMetadataWithNotify(x, y, z, facing.ordinal() + (type * 6), 2); - Utills.updateNeabourBlocks(worldObj, x, y, z); + Utils.updateNeabourBlocks(worldObj, x, y, z); return true; } 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 31554132..dc28fbc7 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 @@ -26,7 +26,7 @@ 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 com.brandon3055.draconicevolution.common.utils.LogHelper; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; 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 6d42ac93..cf6499ce 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 @@ -23,7 +23,7 @@ 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 com.brandon3055.draconicevolution.common.utils.LogHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; 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 a14f237f..a047076c 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 @@ -21,8 +21,8 @@ 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 com.brandon3055.draconicevolution.common.utils.IHudDisplayBlock; +import com.brandon3055.draconicevolution.common.utils.LogHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; 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 790bdc71..bf05e4d3 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 @@ -26,8 +26,8 @@ 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 com.brandon3055.draconicevolution.common.utils.IHudDisplayBlock; +import com.brandon3055.draconicevolution.common.utils.LogHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; 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 6e1f315c..acdfb404 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 @@ -12,12 +12,12 @@ 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.TileReactorEnergyInjector; +import com.brandon3055.draconicevolution.common.utils.Utils; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -83,7 +83,7 @@ public class ReactorEnergyInjector extends BlockDE implements ITileEntityProvide @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) { - ForgeDirection facing = ForgeDirection.getOrientation(Utills.determineOrientation(x, y, z, entity)); + ForgeDirection facing = ForgeDirection.getOrientation(Utils.determineOrientation(x, y, z, entity)); TileEntity tile = world.getTileEntity(x, y, z); if (tile instanceof TileReactorEnergyInjector injector) { injector.facing = entity.isSneaking() ? facing.getOpposite() : facing; 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 a4f167b7..d03893f2 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 @@ -11,13 +11,13 @@ 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 com.brandon3055.draconicevolution.common.utils.Utils; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -86,7 +86,7 @@ public class ReactorStabilizer extends BlockDE implements ITileEntityProvider { @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) { - ForgeDirection facing = ForgeDirection.getOrientation(Utills.determineOrientation(x, y, z, entity)); + ForgeDirection facing = ForgeDirection.getOrientation(Utils.determineOrientation(x, y, z, entity)); TileEntity tile = world.getTileEntity(x, y, z); if (tile instanceof TileReactorStabilizer stabilizer) { stabilizer.facing = entity.isSneaking() ? facing.getOpposite() : facing; 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 beb10e92..20fe1912 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerAdvTool.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerAdvTool.java @@ -15,7 +15,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagList; import com.brandon3055.draconicevolution.common.inventory.InventoryTool; -import com.brandon3055.draconicevolution.common.utills.IInventoryTool; +import com.brandon3055.draconicevolution.common.utils.IInventoryTool; /** * Created by Brandon on 13/01/2015. 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 98800dc9..a6981b12 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDissEnchanter.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerDissEnchanter.java @@ -9,9 +9,9 @@ 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; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; import com.brandon3055.draconicevolution.integration.ModHelper; public class ContainerDissEnchanter extends Container { 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 9904dc25..1f6b11b8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerReactor.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerReactor.java @@ -14,7 +14,7 @@ import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.inventory.GenericInventory; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore.ReactorState; -import com.brandon3055.draconicevolution.common.utills.OreDictionaryHelper; +import com.brandon3055.draconicevolution.common.utils.OreDictionaryHelper; /** * Created by brandon3055 on 30/7/2015. diff --git a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerTemplate.java b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerTemplate.java deleted file mode 100644 index ccade850..00000000 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerTemplate.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.brandon3055.draconicevolution.common.container; - -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; - private EntityPlayer player; - - public ContainerTemplate(InventoryPlayer invPlayer, TileContainerTemplate tile) { - this.tile = tile; - this.player = invPlayer.player; - - for (int x = 0; x < 9; x++) { - addSlotToContainer(new Slot(invPlayer, x, 8 + 18 * x, 116)); - } - - for (int y = 0; y < 3; y++) { - for (int x = 0; x < 9; x++) { - addSlotToContainer(new Slot(invPlayer, x + y * 9 + 9, 8 + 18 * x, 58 + y * 18)); - } - } - - for (int x = 0; x < 9; x++) { - addSlotToContainer(new Slot(tile, x, 8 + 18 * x, 10)); - } - } - - @Override - public boolean canInteractWith(EntityPlayer player) { - return tile.isUseableByPlayer(player); - } - - @Override - public ItemStack transferStackInSlot(EntityPlayer player, int i) { - Slot slot = getSlot(i); - - if (slot != null && slot.getHasStack()) { - ItemStack stack = slot.getStack(); - ItemStack result = stack.copy(); - - if (i >= 36) { - if (!mergeItemStack(stack, 0, 36, false)) { - return null; - } - } else if (!isStackValidForInventory(stack, 0) - || !mergeItemStack(stack, 36, 36 + tile.getSizeInventory(), false)) { - return null; - } - - if (stack.stackSize == 0) { - slot.putStack(null); - } else { - slot.onSlotChanged(); - } - - slot.onPickupFromSlot(player, stack); - - return result; - } - - return null; - } - - private boolean isStackValidForInventory(ItemStack stack, int slot) { - return true; - } -} 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 56df5e5d..f189f624 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerUpgradeModifier.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/container/ContainerUpgradeModifier.java @@ -11,8 +11,8 @@ 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; +import com.brandon3055.draconicevolution.common.utils.IUpgradableItem; +import com.brandon3055.draconicevolution.common.utils.IUpgradableItem.EnumUpgrade; public class ContainerUpgradeModifier extends ContainerDataSync { 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 38978734..e0e0f9f1 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/ChaosImplosion.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/ChaosImplosion.java @@ -5,9 +5,9 @@ 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 com.brandon3055.draconicevolution.common.utils.Utils; +import com.brandon3055.draconicevolution.common.utils.handlers.IProcess; +import com.brandon3055.draconicevolution.common.utils.handlers.ProcessHandler; /** * Created by brandon3055 on 12/8/2015. @@ -44,7 +44,7 @@ public class ChaosImplosion implements IProcess { for (int x = xCoord - size; x < xCoord + size; x++) { for (int z = zCoord - size; z < zCoord + size; z++) { - double dist = Utills.getDistanceAtoB(x, z, xCoord, zCoord); + double dist = Utils.getDistanceAtoB(x, z, xCoord, zCoord); if (dist < OD && dist >= ID) { float tracePower = power - (float) (expansion / 10D); tracePower *= 1F + ((random.nextFloat() - 0.5F) * 0.2); 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 92319b7a..0a8270df 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/ChaosImplosionTrace.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/ChaosImplosionTrace.java @@ -7,8 +7,8 @@ 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; +import com.brandon3055.draconicevolution.common.utils.handlers.IProcess; /** * Created by brandon3055 on 12/8/2015. 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 695a1d24..deace1c7 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosDrill.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosDrill.java @@ -7,9 +7,9 @@ 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; +import com.brandon3055.draconicevolution.common.utils.LogHelper; +import com.brandon3055.draconicevolution.common.utils.Utils; /** * Created by Brandon on 14/09/2014. @@ -73,7 +73,7 @@ public class EntityChaosDrill extends Entity { for (int x = (int) posX - r; x <= (int) posX + r; x++) { for (int z = (int) posZ - r; z <= (int) posZ + r; z++) { for (int y = (int) posY - r; y <= (int) posY + r; y++) { - int dist = (int) (Utills.getDistanceAtoB(x, y, z, (int) posX, (int) posY, (int) posZ)); + int dist = (int) (Utils.getDistanceAtoB(x, y, z, (int) posX, (int) posY, (int) posZ)); if (dist <= r) { if (!worldObj.isAirBlock(x, y, z)) { if (blocks.size() <= dist) { 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 e5e91a4e..a5fa5171 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosGuardian.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosGuardian.java @@ -25,11 +25,11 @@ import net.minecraft.util.Vec3; import net.minecraft.util.WeightedRandom; 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; +import com.brandon3055.draconicevolution.common.utils.DamageSourceChaos; +import com.brandon3055.draconicevolution.common.utils.DragonChunkLoader; +import com.brandon3055.draconicevolution.common.utils.Utils; /** * Created by Brandon on 4/07/2014. @@ -181,7 +181,7 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut customAIUpdate(); if (behaviour == EnumBehaviour.FIREBOMB - && Utills.getDistanceAtoB(posX, posY, posZ, homeX, homeY + 30, homeZ) <= 3) + && Utils.getDistanceAtoB(posX, posY, posZ, homeX, homeY + 30, homeZ) <= 3) moveSpeedMultiplier = 0; } @@ -259,8 +259,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) Utils.getDistanceAtoB(targetX, targetZ, posX, posZ) / 50) * 3F, 3F); } else { this.targetX = this.target.posX; this.targetZ = this.target.posZ; @@ -526,7 +526,7 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut break; case GO_HOME: - if (Utills.getDistanceAtoB(posX, posZ, homeX, homeZ) < 70) selectNewBehaviour(); + if (Utils.getDistanceAtoB(posX, posZ, homeX, homeZ) < 70) selectNewBehaviour(); break; case GUARDING: @@ -536,12 +536,12 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut break; case CHARGING: - if (Utills.getDistanceAtoB(posX, posZ, homeX, homeZ) > 300) behaviour = EnumBehaviour.GO_HOME; + if (Utils.getDistanceAtoB(posX, posZ, homeX, homeZ) > 300) behaviour = EnumBehaviour.GO_HOME; break; case CIRCLE_PLAYER: circlePosition += (0.02F * circleDirection); - if (Utills.getDistanceAtoB(posX, posZ, homeX, homeZ) > 300 || posY > 250) + if (Utils.getDistanceAtoB(posX, posZ, homeX, homeZ) > 300 || posY > 250) behaviour = EnumBehaviour.GO_HOME; break; @@ -611,18 +611,18 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut if (worldObj.isRemote || behaviour == EnumBehaviour.DEAD) return; if (behaviour == EnumBehaviour.FIREBOMB - && Utills.getDistanceAtoB(posX, posY, posZ, homeX, homeY + 30, homeZ) <= 3) { + && Utils.getDistanceAtoB(posX, posY, posZ, homeX, homeY + 30, homeZ) <= 3) { if (target == null || ticksExisted % 100 == 0) setNewTarget(); if (target != null) { - double distance = Utills + double distance = Utils .getDistanceAtoB(target.posX, target.posZ, dragonPartHead.posX, dragonPartHead.posZ); - if (Utills.getDistanceAtoB(target.posX, target.posZ, posX, posZ) < 5) distance *= -1; + if (Utils.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; rotationPitch = anglePitch; - if (Utills.getDistanceAtoB(target.posX, target.posZ, posX, posZ) > 8) rotationYaw = angleYaw + 180; + if (Utils.getDistanceAtoB(target.posX, target.posZ, posX, posZ) > 8) rotationYaw = angleYaw + 180; if (ticksExisted % 2 == 0) { EntityDragonProjectile projectile = new EntityDragonProjectile( @@ -690,8 +690,7 @@ 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 (Utils.getDistanceAtoB(posX, posY, posZ, attackTarget.posX, attackTarget.posY, attackTarget.posZ) > 10) { if (attackTimer % 2 == 0) { EntityDragonProjectile projectile = new EntityDragonProjectile( @@ -704,7 +703,7 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut worldObj.spawnEntityInWorld(projectile); } - double distance = Utills.getDistanceAtoB( + double distance = Utils.getDistanceAtoB( attackTarget.posX, attackTarget.posZ, dragonPartHead.posX, @@ -757,8 +756,7 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut attackInProgress = -1; return; } - if (Utills - .getDistanceAtoB(posX, posY, posZ, attackTarget.posX, attackTarget.posY, attackTarget.posZ) + if (Utils.getDistanceAtoB(posX, posY, posZ, attackTarget.posX, attackTarget.posY, attackTarget.posZ) > 15) { if (attackTimer % 2 == 0) { EntityDragonProjectile projectile = new EntityDragonProjectile( @@ -771,7 +769,7 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut worldObj.spawnEntityInWorld(projectile); } - double distance = Utills.getDistanceAtoB( + double distance = Utils.getDistanceAtoB( attackTarget.posX, attackTarget.posZ, dragonPartHead.posX, @@ -837,7 +835,7 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut case CHARGING: break; case FIREBOMB: - if (Utills.getDistanceAtoB(posX, posY, posZ, homeX, homeY + 30, homeZ) > 3) { + if (Utils.getDistanceAtoB(posX, posY, posZ, homeX, homeY + 30, homeZ) > 3) { targetX = homeX; targetY = homeY + 30; targetZ = homeZ; @@ -956,7 +954,7 @@ public class EntityChaosGuardian extends EntityDragon { // summon DraconicEvolut break; case FIREBOMB: - if ((target == null && Utills.getDistanceAtoB(posX, posY, posZ, homeX, homeY + 30, homeZ) <= 3) + if ((target == null && Utils.getDistanceAtoB(posX, posY, posZ, homeX, homeY + 30, homeZ) <= 3) || rand.nextInt(5) == 0) selectNewBehaviour(); if (damageSource.getEntity() instanceof EntityPlayer && damageSource.getEntity() != target 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 721d9569..6b65c83a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosVortex.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosVortex.java @@ -7,10 +7,10 @@ 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 com.brandon3055.draconicevolution.common.utils.handlers.ProcessHandler; import cpw.mods.fml.common.network.NetworkRegistry; 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 61fd961e..1ed1addb 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomDragon.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomDragon.java @@ -24,8 +24,8 @@ 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; +import com.brandon3055.draconicevolution.common.utils.DamageSourceChaos; +import com.brandon3055.draconicevolution.common.utils.LogHelper; /** * Created by Brandon on 4/07/2014. 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 d4c242c2..1a44126c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonHeart.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonHeart.java @@ -13,13 +13,13 @@ 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 com.brandon3055.draconicevolution.common.utils.Utils; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -129,7 +129,7 @@ public class EntityDragonHeart extends Entity { AxisAlignedBB.getBoundingBox(posX - 5, posY - 5, posZ - 5, posX + 5, posY + 5, posZ + 5)); for (EntityItem item : items) { ItemStack stack = item.getEntityItem(); - if (Utills.getDistanceAtoB(posX, posY + 0.5, posZ, item.posX, item.posY, item.posZ) < 1) { + if (Utils.getDistanceAtoB(posX, posY + 0.5, posZ, item.posX, item.posY, item.posZ) < 1) { if (coresConsumed == 16 || worldObj.isRemote) break; if (stack.getItem() != ModItems.draconicCore) { item.motionX = 1; 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 58002deb..e4f4faf3 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonProjectile.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonProjectile.java @@ -17,12 +17,12 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; -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 com.brandon3055.draconicevolution.common.utils.Teleporter; +import com.brandon3055.draconicevolution.common.utils.Utils; import cofh.api.energy.IEnergyContainerItem; import cpw.mods.fml.common.network.NetworkRegistry; @@ -160,7 +160,7 @@ public class EntityDragonProjectile extends Entity { } if (isChaser && !worldObj.isRemote) { - double tDist = Utills.getDistanceAtoB(target.posX, target.posY, target.posZ, posX, posY, posZ); + double tDist = Utils.getDistanceAtoB(target.posX, target.posY, target.posZ, posX, posY, posZ); if (tDist <= 0) tDist = 0.1; double x = (target.posX - posX) / tDist; @@ -183,7 +183,7 @@ public class EntityDragonProjectile extends Entity { private boolean checkTargetCondition() { if (worldObj.isRemote) return false; - double targetDistance = Utills.getDistanceAtoB(posX, posY, posZ, target.posX, target.posY, target.posZ); + double targetDistance = Utils.getDistanceAtoB(posX, posY, posZ, target.posX, target.posY, target.posZ); Entity entityHit = getHitEntity(); if (entityHit instanceof EntityDragonPart) entityHit = null; @@ -272,7 +272,7 @@ public class EntityDragonProjectile extends Entity { List list = worldObj.getEntitiesWithinAABBExcludingEntity( shooter, boundingBox.expand(60, 60, 60), - Utills.selectPlayer); + Utils.selectPlayer); for (i = +0; i > 0; i--) { newProjectile = new EntityDragonProjectile( worldObj, @@ -367,7 +367,7 @@ public class EntityDragonProjectile extends Entity { entityLivingBase.hurtResistantTime = 0; entityLivingBase.attackEntityFrom( source, - damage / (float) (Utills.getDistanceAtoB( + damage / (float) (Utils.getDistanceAtoB( entityLivingBase.posX, entityLivingBase.posY, entityLivingBase.posZ, 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 1144022f..daf2b948 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityEnderArrow.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityEnderArrow.java @@ -18,7 +18,7 @@ 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 com.brandon3055.draconicevolution.common.utils.Utils; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -463,7 +463,7 @@ public class EntityEnderArrow extends EntityDraconicArrow { int y = (int) Math.floor(posY); int z = (int) Math.floor(posZ); - double travelDist = Utills.getDistanceAtoB(startX, startY, startZ, x, y, z); + double travelDist = Utils.getDistanceAtoB(startX, startY, startZ, x, y, z); float travelDmg = (float) (travelDist / 5D); EnderTeleportEvent event = new EnderTeleportEvent( entityplayermp, 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 86ee8b78..f8666db8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/handler/BalanceConfigHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/handler/BalanceConfigHandler.java @@ -9,7 +9,7 @@ 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 com.brandon3055.draconicevolution.common.utils.IUpgradableItem.EnumUpgrade; import cpw.mods.fml.common.registry.GameRegistry; 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 1ef634aa..893d9ee3 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/handler/ConfigHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/handler/ConfigHandler.java @@ -8,7 +8,7 @@ import java.util.Map; import net.minecraftforge.common.config.Configuration; -import com.brandon3055.draconicevolution.common.utills.LogHelper; +import com.brandon3055.draconicevolution.common.utils.LogHelper; public class ConfigHandler { 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 c6565a3f..2e5ff752 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/handler/ContributorHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/handler/ContributorHandler.java @@ -19,12 +19,12 @@ 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; import com.brandon3055.draconicevolution.client.model.special.ModelContributorWings; import com.brandon3055.draconicevolution.common.network.ContributorPacket; -import com.brandon3055.draconicevolution.common.utills.LogHelper; +import com.brandon3055.draconicevolution.common.utils.LogHelper; +import com.brandon3055.draconicevolution.common.utils.handlers.FileHandler; import com.google.common.base.Charsets; import com.google.gson.stream.JsonReader; 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 c1163cf8..b11f7a9d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/handler/CraftingHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/handler/CraftingHandler.java @@ -8,11 +8,11 @@ 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 com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.utils.LogHelper; +import com.brandon3055.draconicevolution.common.utils.ShapedOreEnergyRecipe; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.registry.GameRegistry; 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 2fe59f79..a7e3ff37 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/handler/FMLEventHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/handler/FMLEventHandler.java @@ -7,7 +7,7 @@ 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 com.brandon3055.draconicevolution.common.utils.LogHelper; import cpw.mods.fml.client.event.ConfigChangedEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; 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 4fcb78b8..d6fa2b93 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/handler/MinecraftForgeEventHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/handler/MinecraftForgeEventHandler.java @@ -45,10 +45,6 @@ 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; @@ -60,7 +56,11 @@ 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.utils.DataUtils; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.utils.LogHelper; +import com.brandon3055.draconicevolution.common.utils.Utils; +import com.brandon3055.draconicevolution.common.utils.handlers.ProcessHandler; import com.brandon3055.draconicevolution.common.world.ChaosWorldGenHandler; import cpw.mods.fml.common.eventhandler.EventPriority; @@ -454,10 +454,10 @@ 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 + DataUtils.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) { + && Utils.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/InventoryTool.java b/src/main/java/com/brandon3055/draconicevolution/common/inventory/InventoryTool.java index f6fab981..0802931a 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/inventory/InventoryTool.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/inventory/InventoryTool.java @@ -8,10 +8,10 @@ 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; +import com.brandon3055.draconicevolution.common.utils.IInventoryTool; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.utils.LogHelper; /** * Created by Brandon on 13/01/2015. 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 db6905a2..1211dc2e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/DraconicCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/DraconicCore.java @@ -9,13 +9,13 @@ 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; 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 com.brandon3055.draconicevolution.common.utils.InfoHelper; +import com.brandon3055.draconicevolution.common.utils.LogHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; 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 c4b71a43..e6746f67 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/Key.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/Key.java @@ -7,10 +7,10 @@ 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 com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; 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 fa056817..870163c2 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/MobSoul.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/MobSoul.java @@ -15,10 +15,10 @@ 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 com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.utils.LogHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -36,10 +36,10 @@ public class MobSoul extends ItemDE { @Override public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List list, boolean par4) { String name = ItemNBTHelper.getString(stack, "Name", "Pig"); - list.add("" + EnumChatFormatting.WHITE + StatCollector.translateToLocal("info.mobSoul1.txt")); - list.add("" + EnumChatFormatting.WHITE + StatCollector.translateToLocal("info.mobSoul2.txt")); - list.add("" + EnumChatFormatting.WHITE + StatCollector.translateToLocal("info.mobSoul3.txt")); - list.add("" + EnumChatFormatting.DARK_PURPLE + name); + list.add(EnumChatFormatting.WHITE + StatCollector.translateToLocal("info.mobSoul1.txt")); + list.add(EnumChatFormatting.WHITE + StatCollector.translateToLocal("info.mobSoul2.txt")); + list.add(EnumChatFormatting.WHITE + StatCollector.translateToLocal("info.mobSoul3.txt")); + list.add(EnumChatFormatting.DARK_PURPLE + name); } @Override 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 31cbdd0e..439c2e72 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/items/Tclogo.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/items/Tclogo.java @@ -16,7 +16,7 @@ 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 com.brandon3055.draconicevolution.common.utils.LogHelper; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.common.FMLCommonHandler; 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 6126f5bc..ed8ed6f3 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 @@ -19,13 +19,12 @@ import net.minecraftforge.event.entity.living.LivingAttackEvent; import net.minecraftforge.event.entity.living.LivingDeathEvent; import net.minecraftforge.event.entity.living.LivingHurtEvent; -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.common.utils.IUpgradableItem; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; import com.brandon3055.draconicevolution.integration.ModHelper; import cofh.api.energy.IEnergyContainerItem; @@ -261,12 +260,12 @@ public class CustomArmorHandler { && summery.flightVModifier > 0) { // float percentIncrease = summery.flightVModifier; - if (BrandonsCore.proxy.isSpaceDown() && !BrandonsCore.proxy.isShiftDown()) { + if (DraconicEvolution.proxy.isSpaceDown() && !DraconicEvolution.proxy.isShiftDown()) { // LogHelper.info(player.motionY); player.motionY = 0.225F * summery.flightVModifier; } - if (BrandonsCore.proxy.isShiftDown() && !BrandonsCore.proxy.isSpaceDown()) { + if (DraconicEvolution.proxy.isShiftDown() && !DraconicEvolution.proxy.isSpaceDown()) { player.motionY = -0.225F * summery.flightVModifier; } } 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 a188281c..209b274a 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,7 @@ package com.brandon3055.draconicevolution.common.items.armor; +import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber; + import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -26,10 +28,6 @@ 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; -import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.model.ModelDraconicArmor; import com.brandon3055.draconicevolution.client.model.ModelDraconicArmorOld; @@ -39,10 +37,12 @@ import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolBase; 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.IUpgradableItem; -import com.brandon3055.draconicevolution.common.utills.ItemConfigField; +import com.brandon3055.draconicevolution.common.utils.IConfigurableItem; +import com.brandon3055.draconicevolution.common.utils.IInventoryTool; +import com.brandon3055.draconicevolution.common.utils.IUpgradableItem; +import com.brandon3055.draconicevolution.common.utils.InfoHelper; +import com.brandon3055.draconicevolution.common.utils.ItemConfigField; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; import com.brandon3055.draconicevolution.integration.ModHelper; import cpw.mods.fml.common.Loader; @@ -516,17 +516,17 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor, IConfigur InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + InfoHelper.HITC() - + Utills.formatNumber(getMaxEnergyStored(stack))); + + formatNumber(getMaxEnergyStored(stack))); strings.add( InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.ShieldCapacity.txt") + ": " + InfoHelper.HITC() - + (int) getProtectionPoints(stack)); + + formatNumber((int) getProtectionPoints(stack))); strings.add( InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.ShieldRecovery.txt") + ": " + InfoHelper.HITC() - + Utills.round(getRecoveryPoints(stack) * 0.2D, 10) + + formatNumber(getRecoveryPoints(stack) * 0.2D) + " EPS"); return strings; @@ -579,7 +579,7 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor, IConfigur @Override public float getJumpModifier(ItemStack stack, EntityPlayer player) { if (IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorSprintOnly", false)) { - return player.isSprinting() || BrandonsCore.proxy.isCtrlDown() + return player.isSprinting() || DraconicEvolution.proxy.isCtrlDown() ? IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorJumpMult", 0f) : IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorJumpMult", 0f) / 5F; } else return IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorJumpMult", 0f); @@ -588,7 +588,7 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor, IConfigur @Override public boolean hasHillStep(ItemStack stack, EntityPlayer player) { if (IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorSprintOnly", false)) { - return (player.isSprinting() || BrandonsCore.proxy.isCtrlDown()) + return (player.isSprinting() || DraconicEvolution.proxy.isCtrlDown()) && IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorHillStep", true); } else return IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorHillStep", true); } @@ -607,7 +607,7 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor, IConfigur @Override public float getFlightSpeedModifier(ItemStack stack, EntityPlayer player) { if (IConfigurableItem.ProfileHelper.getBoolean(stack, "EffectiveOnSprint", false)) { - return BrandonsCore.proxy.isCtrlDown() + return DraconicEvolution.proxy.isCtrlDown() ? IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorFlightSpeedMult", 0f) : 0F; } else return IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorFlightSpeedMult", 0f); @@ -616,7 +616,7 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor, IConfigur @Override public float getFlightVModifier(ItemStack stack, EntityPlayer player) { if (IConfigurableItem.ProfileHelper.getBoolean(stack, "EffectiveOnSprint", false)) { - return BrandonsCore.proxy.isCtrlDown() + return DraconicEvolution.proxy.isCtrlDown() ? IConfigurableItem.ProfileHelper.getFloat(stack, "VerticalAcceleration", 0F) : 0F; } else return IConfigurableItem.ProfileHelper.getFloat(stack, "VerticalAcceleration", 0F); 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 69ad04d2..1ad0f6ca 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,7 @@ package com.brandon3055.draconicevolution.common.items.armor; +import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber; + import java.util.ArrayList; import java.util.List; @@ -23,10 +25,6 @@ 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; -import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.model.ModelDraconicArmorOld; import com.brandon3055.draconicevolution.client.model.ModelWyvernArmor; @@ -36,10 +34,12 @@ import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolBase; 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.IUpgradableItem; -import com.brandon3055.draconicevolution.common.utills.ItemConfigField; +import com.brandon3055.draconicevolution.common.utils.IConfigurableItem; +import com.brandon3055.draconicevolution.common.utils.IInventoryTool; +import com.brandon3055.draconicevolution.common.utils.IUpgradableItem; +import com.brandon3055.draconicevolution.common.utils.InfoHelper; +import com.brandon3055.draconicevolution.common.utils.ItemConfigField; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; import com.brandon3055.draconicevolution.integration.ModHelper; import cpw.mods.fml.common.Loader; @@ -395,17 +395,17 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IConfigurab InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + InfoHelper.HITC() - + Utills.formatNumber(getMaxEnergyStored(stack))); + + formatNumber(getMaxEnergyStored(stack))); strings.add( InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.ShieldCapacity.txt") + ": " + InfoHelper.HITC() - + (int) getProtectionPoints(stack)); + + formatNumber((int) getProtectionPoints(stack))); strings.add( InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.ShieldRecovery.txt") + ": " + InfoHelper.HITC() - + Utills.round(getRecoveryPoints(stack) * 0.2D, 10) + + formatNumber(getRecoveryPoints(stack) * 0.2D) + " EPS"); return strings; @@ -457,7 +457,7 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IConfigurab @Override public float getJumpModifier(ItemStack stack, EntityPlayer player) { if (IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorSprintOnly", false)) { - return player.isSprinting() || BrandonsCore.proxy.isCtrlDown() + return player.isSprinting() || DraconicEvolution.proxy.isCtrlDown() ? IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorJumpMult", 0f) : IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorJumpMult", 0f) / 5F; } else return IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorJumpMult", 0f); 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 dc4b29dd..cccc0c39 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 @@ -12,13 +12,13 @@ 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 com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.utils.LogHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; 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 6e12beff..82b8d37c 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 @@ -19,10 +19,10 @@ import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; import com.brandon3055.draconicevolution.common.items.tools.baseclasses.MiningTool; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; -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 com.brandon3055.draconicevolution.common.utils.IConfigurableItem; +import com.brandon3055.draconicevolution.common.utils.IInventoryTool; +import com.brandon3055.draconicevolution.common.utils.IUpgradableItem; +import com.brandon3055.draconicevolution.common.utils.ItemConfigField; public class DraconicAxe extends MiningTool implements IInventoryTool, IRenderTweak { 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 8d5be87b..51c940af 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,7 @@ package com.brandon3055.draconicevolution.common.items.tools; +import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber; + import java.util.List; import net.minecraft.block.Block; @@ -15,7 +17,6 @@ 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; import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; @@ -24,10 +25,11 @@ import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolHand import com.brandon3055.draconicevolution.common.items.weapons.IEnergyContainerWeaponItem; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; -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 com.brandon3055.draconicevolution.common.utils.IConfigurableItem; +import com.brandon3055.draconicevolution.common.utils.IInventoryTool; +import com.brandon3055.draconicevolution.common.utils.IUpgradableItem; +import com.brandon3055.draconicevolution.common.utils.InfoHelper; +import com.brandon3055.draconicevolution.common.utils.ItemConfigField; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -215,7 +217,7 @@ public class DraconicDistructionStaff extends MiningTool InfoHelper.ITC() + StatCollector.translateToLocal("info.de.attackDamage.txt") + ": " + InfoHelper.HITC() - + ToolHandler.getBaseAttackDamage(stack)); + + formatNumber(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 848823c3..61515bd4 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,5 +1,7 @@ package com.brandon3055.draconicevolution.common.items.tools; +import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber; + import java.util.ArrayList; import java.util.List; @@ -22,9 +24,6 @@ import net.minecraftforge.event.entity.player.UseHoeEvent; import org.lwjgl.opengl.GL11; -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; @@ -33,11 +32,13 @@ 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.IConfigurableItem; -import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem; -import com.brandon3055.draconicevolution.common.utills.IUpgradableItem; -import com.brandon3055.draconicevolution.common.utills.ItemConfigField; -import com.brandon3055.draconicevolution.common.utills.LogHelper; +import com.brandon3055.draconicevolution.common.utils.IConfigurableItem; +import com.brandon3055.draconicevolution.common.utils.IHudDisplayItem; +import com.brandon3055.draconicevolution.common.utils.IUpgradableItem; +import com.brandon3055.draconicevolution.common.utils.InfoHelper; +import com.brandon3055.draconicevolution.common.utils.ItemConfigField; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.utils.LogHelper; import cofh.api.energy.IEnergyContainerItem; import cpw.mods.fml.common.eventhandler.Event.Result; @@ -358,16 +359,16 @@ public class DraconicHoe extends ItemHoe InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + InfoHelper.HITC() - + Utills.formatNumber(getMaxEnergyStored(itemstack))); + + formatNumber(getMaxEnergyStored(itemstack))); strings.add( InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " + StatCollector.translateToLocal("gui.de.DigAOE.txt") + ": " + InfoHelper.HITC() - + digaoe + + formatNumber(digaoe) + "x" - + digaoe); + + formatNumber(digaoe)); return strings; } @@ -388,9 +389,9 @@ public class DraconicHoe extends ItemHoe InfoHelper.ITC() + StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.HITC() - + Utills.formatNumber(getEnergyStored(stack)) + + formatNumber(getEnergyStored(stack)) + " / " - + Utills.formatNumber(capacity)); + + 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 523c3c48..79d5db24 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 @@ -16,9 +16,9 @@ import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; import com.brandon3055.draconicevolution.common.items.tools.baseclasses.MiningTool; import com.brandon3055.draconicevolution.common.lib.References; 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 com.brandon3055.draconicevolution.common.utils.IInventoryTool; +import com.brandon3055.draconicevolution.common.utils.IUpgradableItem; +import com.brandon3055.draconicevolution.common.utils.ItemConfigField; public class DraconicPickaxe extends MiningTool implements IInventoryTool, IRenderTweak { 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 47a5d478..b5e7e9c3 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 @@ -16,9 +16,9 @@ import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; import com.brandon3055.draconicevolution.common.items.tools.baseclasses.MiningTool; import com.brandon3055.draconicevolution.common.lib.References; 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 com.brandon3055.draconicevolution.common.utils.IInventoryTool; +import com.brandon3055.draconicevolution.common.utils.IUpgradableItem; +import com.brandon3055.draconicevolution.common.utils.ItemConfigField; public class DraconicShovel extends MiningTool implements IInventoryTool, IRenderTweak { // public IIcon itemIcon0; 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 ec6ba877..afd9ec30 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,5 +1,7 @@ package com.brandon3055.draconicevolution.common.items.tools; +import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber; + import java.util.ArrayList; import java.util.List; @@ -14,16 +16,15 @@ 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.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 com.brandon3055.draconicevolution.common.utils.IUpgradableItem; +import com.brandon3055.draconicevolution.common.utils.InfoHelper; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; import cofh.api.energy.IEnergyContainerItem; import cpw.mods.fml.relauncher.Side; @@ -174,7 +175,6 @@ public class DraconiumFluxCapacitor extends RFItemBase implements IUpgradableIte + StatCollector.translateToLocal( "info.de.capacitorMode" + ItemNBTHelper.getShort(stack, "Mode", (short) 0) + ".txt")); - // InfoHelper.addLore(stack, list); } ToolBase.holdCTRLForUpgrades(list, stack); InfoHelper.addEnergyInfo(stack, list); @@ -187,7 +187,7 @@ public class DraconiumFluxCapacitor extends RFItemBase implements IUpgradableIte @Override public List getUpgrades(ItemStack itemstack) { - return new ArrayList() { + return new ArrayList<>() { { add(EnumUpgrade.RF_CAPACITY); @@ -240,7 +240,7 @@ public class DraconiumFluxCapacitor extends RFItemBase implements IUpgradableIte InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + InfoHelper.HITC() - + Utills.formatNumber(getMaxEnergyStored(stack))); + + formatNumber(getMaxEnergyStored(stack))); return strings; } } 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 bee82b61..165d7952 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 @@ -24,17 +24,17 @@ 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 com.brandon3055.draconicevolution.common.tileentities.TileDislocatorInhibitor; -import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; -import com.brandon3055.draconicevolution.common.utills.InventoryUtils; -import com.brandon3055.draconicevolution.common.utills.ItemConfigField; +import com.brandon3055.draconicevolution.common.utils.IConfigurableItem; +import com.brandon3055.draconicevolution.common.utils.InfoHelper; +import com.brandon3055.draconicevolution.common.utils.InventoryUtils; +import com.brandon3055.draconicevolution.common.utils.ItemConfigField; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; import com.brandon3055.draconicevolution.integration.ModHelper; import com.gtnewhorizon.gtnhlib.GTNHLib; 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 14a49678..adbb17bb 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 @@ -10,7 +10,7 @@ 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 com.brandon3055.draconicevolution.common.utils.LogHelper; /** * Created by Brandon on 14/09/2014. 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 1e0d241e..a06ce8fc 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 @@ -11,13 +11,13 @@ 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 com.brandon3055.draconicevolution.common.utils.InfoHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; 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 ece6353b..2f192bd5 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 @@ -15,15 +15,14 @@ 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 com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.utils.Teleporter; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -109,7 +108,7 @@ public class TeleporterMKI extends ItemDE { ItemNBTHelper.setString( stack, "DimentionName", - BrandonsCore.proxy.getMCServer().worldServerForDimension(player.dimension).provider + DraconicEvolution.proxy.getMCServer().worldServerForDimension(player.dimension).provider .getDimensionName()); } return stack; @@ -176,10 +175,10 @@ public class TeleporterMKI extends ItemDE { return new EntityPersistentItem(world, location, itemstack); } - public TeleportLocation getLocation(ItemStack stack) { + public Teleporter.TeleportLocation getLocation(ItemStack stack) { if (!ItemNBTHelper.getBoolean(stack, "IsSet", false)) return null; - TeleportLocation location = new TeleportLocation(); + Teleporter.TeleportLocation location = new Teleporter.TeleportLocation(); location.readFromNBT(stack.getTagCompound()); return location; 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 aeb07301..a8d5fd76 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 @@ -16,16 +16,16 @@ 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 com.brandon3055.draconicevolution.common.utils.IHudDisplayItem; +import com.brandon3055.draconicevolution.common.utils.InfoHelper; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.utils.Teleporter; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; @@ -187,7 +187,7 @@ public class TeleporterMKII extends TeleporterMKI implements IHudDisplayItem { } @Override - public TeleportLocation getLocation(ItemStack stack) { + public Teleporter.TeleportLocation getLocation(ItemStack stack) { short selected = ItemNBTHelper.getShort(stack, "Selection", (short) 0); int selrctionOffset = ItemNBTHelper.getInteger(stack, "SelectionOffset", 0); NBTTagCompound compound = stack.getTagCompound(); @@ -195,7 +195,7 @@ public class TeleporterMKII extends TeleporterMKI implements IHudDisplayItem { NBTTagList list = (NBTTagList) compound.getTag("Locations"); if (list == null) return null; - TeleportLocation destination = new TeleportLocation(); + Teleporter.TeleportLocation destination = new Teleporter.TeleportLocation(); destination.readFromNBT(list.getCompoundTagAt(selected + selrctionOffset)); if (destination.getName().isEmpty()) return null; @@ -205,7 +205,7 @@ public class TeleporterMKII extends TeleporterMKI implements IHudDisplayItem { @Override public List getDisplayData(ItemStack stack) { List list = new ArrayList(); - TeleportLocation location = getLocation(stack); + Teleporter.TeleportLocation location = getLocation(stack); if (location != null) { list.add(location.getName()); } 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 e117d4d1..cbe41008 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 @@ -13,14 +13,14 @@ 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.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 com.brandon3055.draconicevolution.common.utils.IHudDisplayItem; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; import cofh.api.energy.IEnergyReceiver; import cpw.mods.fml.relauncher.Side; 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 889db511..37a1422a 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 @@ -16,9 +16,9 @@ import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; import com.brandon3055.draconicevolution.common.items.tools.baseclasses.MiningTool; import com.brandon3055.draconicevolution.common.lib.References; 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 com.brandon3055.draconicevolution.common.utils.IInventoryTool; +import com.brandon3055.draconicevolution.common.utils.IUpgradableItem; +import com.brandon3055.draconicevolution.common.utils.ItemConfigField; public class WyvernPickaxe extends MiningTool implements IInventoryTool, IRenderTweak { 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 08e1a486..5a9079c0 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 @@ -16,9 +16,9 @@ import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; import com.brandon3055.draconicevolution.common.items.tools.baseclasses.MiningTool; import com.brandon3055.draconicevolution.common.lib.References; 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 com.brandon3055.draconicevolution.common.utils.IInventoryTool; +import com.brandon3055.draconicevolution.common.utils.IUpgradableItem; +import com.brandon3055.draconicevolution.common.utils.ItemConfigField; public class WyvernShovel extends MiningTool implements IInventoryTool, IRenderTweak { 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 854fa306..fb7cba9e 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,5 +1,7 @@ package com.brandon3055.draconicevolution.common.items.tools.baseclasses; +import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -30,14 +32,13 @@ 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.common.utils.IConfigurableItem; +import com.brandon3055.draconicevolution.common.utils.IUpgradableItem; +import com.brandon3055.draconicevolution.common.utils.InfoHelper; +import com.brandon3055.draconicevolution.common.utils.ItemConfigField; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; /** * Created by Brandon on 2/01/2015. Modified by bartimaeusnek on 23/05/2018 @@ -389,39 +390,39 @@ public abstract class MiningTool extends ToolBase implements IUpgradableItem { InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + InfoHelper.HITC() - + Utills.formatNumber(getMaxEnergyStored(stack))); + + formatNumber(getMaxEnergyStored(stack))); strings.add( InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " + StatCollector.translateToLocal("gui.de.DigAOE.txt") + ": " + InfoHelper.HITC() - + digaoe + + formatNumber(digaoe) + "x" - + digaoe); + + formatNumber(digaoe)); if (depth > 0) strings.add( InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " + StatCollector.translateToLocal("gui.de.DigDepth.txt") + ": " + InfoHelper.HITC() - + depth); + + formatNumber(depth)); strings.add( InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " + StatCollector.translateToLocal("gui.de.DigSpeed.txt") + ": " + InfoHelper.HITC() - + getEfficiency(stack)); + + formatNumber(getEfficiency(stack))); if (attackaoe > 0) strings.add( InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " + StatCollector.translateToLocal("gui.de.AttackAOE.txt") + ": " + InfoHelper.HITC() - + attackaoe + + formatNumber(attackaoe) + "x" - + attackaoe); + + formatNumber(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 45b699d9..a9d9de4b 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,5 +1,7 @@ package com.brandon3055.draconicevolution.common.items.tools.baseclasses; +import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber; + import java.util.ArrayList; import java.util.List; @@ -12,15 +14,14 @@ 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.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 com.brandon3055.draconicevolution.common.utils.IConfigurableItem; +import com.brandon3055.draconicevolution.common.utils.IHudDisplayItem; +import com.brandon3055.draconicevolution.common.utils.InfoHelper; +import com.brandon3055.draconicevolution.common.utils.ItemConfigField; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; import cofh.api.energy.IEnergyContainerItem; import cpw.mods.fml.relauncher.Side; @@ -166,9 +167,9 @@ public class RFItemBase extends ItemDE implements IEnergyContainerItem, IConfigu InfoHelper.ITC() + StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.HITC() - + Utills.formatNumber(getEnergyStored(stack)) + + formatNumber(getEnergyStored(stack)) + " / " - + Utills.formatNumber(capacity)); + + 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 7bf76f09..27907a2a 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 @@ -19,18 +19,17 @@ 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; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.keybinding.KeyBindings; import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.network.ToolModePacket; -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.common.utils.DataUtils; +import com.brandon3055.draconicevolution.common.utils.IConfigurableItem; +import com.brandon3055.draconicevolution.common.utils.IUpgradableItem; +import com.brandon3055.draconicevolution.common.utils.InfoHelper; +import com.brandon3055.draconicevolution.common.utils.ItemConfigField; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; import com.google.common.collect.Sets; import cpw.mods.fml.relauncher.Side; @@ -250,9 +249,9 @@ public class ToolBase extends RFItemBase { @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { - if (!world.isRemote && !BrandonsCore.proxy.isDedicatedServer()) { + if (!world.isRemote && !DraconicEvolution.proxy.isDedicatedServer()) { handleModeChange(stack, player, InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown()); - } else if (world.isRemote && BrandonsCore.proxy.getMCServer() == null) { + } else if (world.isRemote && DraconicEvolution.proxy.getMCServer() == null) { handleModeChange(stack, player, InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown()); DraconicEvolution.network .sendToServer(new ToolModePacket(InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown())); @@ -273,7 +272,7 @@ public class ToolBase extends RFItemBase { aoe++; if (aoe > (Integer) field.max) aoe = (Integer) field.min; field.value = aoe; - DataUtills.writeObjectToCompound( + DataUtils.writeObjectToCompound( IConfigurableItem.ProfileHelper.getProfileCompound(stack), field.value, field.datatype, @@ -288,7 +287,7 @@ public class ToolBase extends RFItemBase { aoe++; if (aoe > (Integer) field.max) aoe = (Integer) field.min; field.value = aoe; - DataUtills.writeObjectToCompound( + DataUtils.writeObjectToCompound( IConfigurableItem.ProfileHelper.getProfileCompound(stack), field.value, field.datatype, @@ -303,7 +302,7 @@ public class ToolBase extends RFItemBase { aoe++; if (aoe > (Integer) field.max) aoe = (Integer) field.min; field.value = aoe; - DataUtills.writeObjectToCompound( + DataUtils.writeObjectToCompound( IConfigurableItem.ProfileHelper.getProfileCompound(stack), field.value, field.datatype, 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 c42879ae..28d7d273 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 @@ -25,8 +25,8 @@ 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; +import com.brandon3055.draconicevolution.common.utils.IUpgradableItem; +import com.brandon3055.draconicevolution.common.utils.LogHelper; public class ToolHandler { // public static Block[] destroyList = {Blocks.cobblestone, Blocks.stone, Blocks.dirt, Blocks.gravel, Blocks.sand, 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 c07de8c9..589c30dd 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 @@ -18,8 +18,8 @@ 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 com.brandon3055.draconicevolution.common.utils.IConfigurableItem; +import com.brandon3055.draconicevolution.common.utils.IUpgradableItem; import cofh.api.energy.IEnergyContainerItem; 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 74b5f2a8..89a043a1 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,7 @@ package com.brandon3055.draconicevolution.common.items.weapons; +import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber; + import java.util.ArrayList; import java.util.List; @@ -17,10 +19,6 @@ 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; -import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem; @@ -29,10 +27,12 @@ import com.brandon3055.draconicevolution.common.handler.ConfigHandler; 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.IHudDisplayItem; -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.common.utils.IHudDisplayItem; +import com.brandon3055.draconicevolution.common.utils.IInventoryTool; +import com.brandon3055.draconicevolution.common.utils.IUpgradableItem; +import com.brandon3055.draconicevolution.common.utils.InfoHelper; +import com.brandon3055.draconicevolution.common.utils.ItemConfigField; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; @@ -298,7 +298,7 @@ public class DraconicBow extends ItemBow InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + InfoHelper.HITC() - + Utills.formatNumber(getMaxEnergyStored(stack))); + + formatNumber(getMaxEnergyStored(stack))); list.add( InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " @@ -306,7 +306,7 @@ public class DraconicBow extends ItemBow + ": " + InfoHelper.HITC() + "+" - + EnumUpgrade.ARROW_SPEED.getUpgradePoints(stack) * 100 + + formatNumber(EnumUpgrade.ARROW_SPEED.getUpgradePoints(stack) * 100) + "%"); list.add( InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") @@ -314,13 +314,13 @@ public class DraconicBow extends ItemBow + StatCollector.translateToLocal("gui.de.ArrowDamage.txt") + ": " + InfoHelper.HITC() - + EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(stack) + + formatNumber(EnumUpgrade.ARROW_DAMAGE.getUpgradePoints(stack)) + ""); list.add( InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.DrawSpeed.txt") + ": " + InfoHelper.HITC() - + properties.getDrawTicks() / 20D + + formatNumber(properties.getDrawTicks() / 20D) + "s"); return list; @@ -369,9 +369,10 @@ public class DraconicBow extends ItemBow public List getDisplayData(ItemStack stack) { List list = new ArrayList(); - if (BrandonsCore.proxy.getClientPlayer() != null && BrandonsCore.proxy.getClientPlayer().getItemInUse() != null - && BrandonsCore.proxy.getClientPlayer().getItemInUseDuration() > 2) { - EntityPlayer player = BrandonsCore.proxy.getClientPlayer(); + if (DraconicEvolution.proxy.getClientPlayer() != null + && DraconicEvolution.proxy.getClientPlayer().getItemInUse() != null + && DraconicEvolution.proxy.getClientPlayer().getItemInUseDuration() > 2) { + EntityPlayer player = DraconicEvolution.proxy.getClientPlayer(); BowHandler.BowProperties properties = new BowHandler.BowProperties(stack, player); int power = (int) Math .min(((float) player.getItemInUseDuration() / (float) properties.getDrawTicks() * 100F), 100F); @@ -395,19 +396,19 @@ public class DraconicBow extends ItemBow InfoHelper.ITC() + StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.HITC() - + Utills.formatNumber(getEnergyStored(stack)) + + formatNumber(getEnergyStored(stack)) + " / " - + Utills.formatNumber(getMaxEnergyStored(stack))); + + formatNumber(getMaxEnergyStored(stack))); - if (BrandonsCore.proxy.getClientPlayer() != null) { + if (DraconicEvolution.proxy.getClientPlayer() != null) { BowHandler.BowProperties properties = new BowHandler.BowProperties( stack, - BrandonsCore.proxy.getClientPlayer()); + DraconicEvolution.proxy.getClientPlayer()); list.add( InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.rfPerShot.txt") + ": " + InfoHelper.HITC() - + Utills.addCommas(properties.calculateEnergyCost())); + + formatNumber(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 ac038d80..66011dd9 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,7 @@ package com.brandon3055.draconicevolution.common.items.weapons; +import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber; + import java.util.ArrayList; import java.util.List; @@ -20,10 +22,6 @@ 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; -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; @@ -34,11 +32,13 @@ import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolHand import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.network.ToolModePacket; -import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; -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 com.brandon3055.draconicevolution.common.utils.IConfigurableItem; +import com.brandon3055.draconicevolution.common.utils.IHudDisplayItem; +import com.brandon3055.draconicevolution.common.utils.IInventoryTool; +import com.brandon3055.draconicevolution.common.utils.IUpgradableItem; +import com.brandon3055.draconicevolution.common.utils.InfoHelper; +import com.brandon3055.draconicevolution.common.utils.ItemConfigField; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; import com.google.common.collect.Multimap; import cpw.mods.fml.common.registry.GameRegistry; @@ -305,7 +305,7 @@ public class DraconicSword extends ItemSword InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + InfoHelper.HITC() - + Utills.formatNumber(getMaxEnergyStored(stack))); + + formatNumber(getMaxEnergyStored(stack))); strings.add( InfoHelper.ITC() + StatCollector.translateToLocal("info.de.attackDamage.txt") + ": " @@ -317,9 +317,9 @@ public class DraconicSword extends ItemSword + StatCollector.translateToLocal("gui.de.AttackAOE.txt") + ": " + InfoHelper.HITC() - + attackaoe + + formatNumber(attackaoe) + "x" - + attackaoe); + + formatNumber(attackaoe)); return strings; } @@ -335,9 +335,9 @@ public class DraconicSword extends ItemSword @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { - if (!world.isRemote && !BrandonsCore.proxy.isDedicatedServer()) { + if (!world.isRemote && !DraconicEvolution.proxy.isDedicatedServer()) { ToolBase.handleModeChange(stack, player, InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown()); - } else if (world.isRemote && BrandonsCore.proxy.getMCServer() == null) { + } else if (world.isRemote && DraconicEvolution.proxy.getMCServer() == null) { ToolBase.handleModeChange(stack, player, InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown()); DraconicEvolution.network .sendToServer(new ToolModePacket(InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown())); 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 bb681d00..25c29b18 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,7 @@ package com.brandon3055.draconicevolution.common.items.weapons; +import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber; + import java.util.ArrayList; import java.util.List; @@ -17,10 +19,6 @@ 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; -import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem; @@ -29,10 +27,12 @@ import com.brandon3055.draconicevolution.common.handler.ConfigHandler; 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.IHudDisplayItem; -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.common.utils.IHudDisplayItem; +import com.brandon3055.draconicevolution.common.utils.IInventoryTool; +import com.brandon3055.draconicevolution.common.utils.IUpgradableItem; +import com.brandon3055.draconicevolution.common.utils.InfoHelper; +import com.brandon3055.draconicevolution.common.utils.ItemConfigField; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; @@ -299,7 +299,7 @@ public class WyvernBow extends ItemBow InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + InfoHelper.HITC() - + Utills.formatNumber(getMaxEnergyStored(stack))); + + formatNumber(getMaxEnergyStored(stack))); list.add( InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " @@ -307,16 +307,18 @@ public class WyvernBow extends ItemBow + ": " + InfoHelper.HITC() + "+" - + EnumUpgrade.ARROW_SPEED.getUpgradePoints(stack) * 100 + + formatNumber(EnumUpgrade.ARROW_SPEED.getUpgradePoints(stack) * 100) + "%"); list.add( - InfoHelper.ITC() + StatCollector.translateToLocal( - "gui.de.ArrowDamage.txt") + ": " + InfoHelper.HITC() + properties.arrowDamage + ""); + 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 + + formatNumber(properties.getDrawTicks() / 20D) + "s"); return list; @@ -360,9 +362,9 @@ public class WyvernBow extends ItemBow public List getDisplayData(ItemStack stack) { List list = new ArrayList(); - if (BrandonsCore.proxy.getClientPlayer() != null - && BrandonsCore.proxy.getClientPlayer().getItemInUse() != null) { - EntityPlayer player = BrandonsCore.proxy.getClientPlayer(); + if (DraconicEvolution.proxy.getClientPlayer() != null + && DraconicEvolution.proxy.getClientPlayer().getItemInUse() != null) { + EntityPlayer player = DraconicEvolution.proxy.getClientPlayer(); BowHandler.BowProperties properties = new BowHandler.BowProperties(stack, player); int power = (int) Math .min(((float) player.getItemInUseDuration() / (float) properties.getDrawTicks() * 100F), 100F); @@ -386,19 +388,19 @@ public class WyvernBow extends ItemBow InfoHelper.ITC() + StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.HITC() - + Utills.formatNumber(getEnergyStored(stack)) + + formatNumber(getEnergyStored(stack)) + " / " - + Utills.formatNumber(getMaxEnergyStored(stack))); + + formatNumber(getMaxEnergyStored(stack))); - if (BrandonsCore.proxy.getClientPlayer() != null) { + if (DraconicEvolution.proxy.getClientPlayer() != null) { BowHandler.BowProperties properties = new BowHandler.BowProperties( stack, - BrandonsCore.proxy.getClientPlayer()); + DraconicEvolution.proxy.getClientPlayer()); list.add( InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.rfPerShot.txt") + ": " + InfoHelper.HITC() - + Utills.addCommas(properties.calculateEnergyCost())); + + formatNumber(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 3113c70a..57533ff5 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,7 @@ package com.brandon3055.draconicevolution.common.items.weapons; +import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber; + import java.util.ArrayList; import java.util.List; @@ -21,10 +23,6 @@ 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; -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; @@ -35,11 +33,13 @@ import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolHand import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.lib.Strings; import com.brandon3055.draconicevolution.common.network.ToolModePacket; -import com.brandon3055.draconicevolution.common.utills.IConfigurableItem; -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 com.brandon3055.draconicevolution.common.utils.IConfigurableItem; +import com.brandon3055.draconicevolution.common.utils.IHudDisplayItem; +import com.brandon3055.draconicevolution.common.utils.IInventoryTool; +import com.brandon3055.draconicevolution.common.utils.IUpgradableItem; +import com.brandon3055.draconicevolution.common.utils.InfoHelper; +import com.brandon3055.draconicevolution.common.utils.ItemConfigField; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; import com.google.common.collect.Multimap; import cpw.mods.fml.common.registry.GameRegistry; @@ -307,21 +307,21 @@ public class WyvernSword extends ItemSword InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.RFCapacity.txt") + ": " + InfoHelper.HITC() - + Utills.formatNumber(getMaxEnergyStored(stack))); + + formatNumber(getMaxEnergyStored(stack))); strings.add( InfoHelper.ITC() + StatCollector.translateToLocal("info.de.attackDamage.txt") + ": " + InfoHelper.HITC() - + ToolHandler.getBaseAttackDamage(stack)); + + formatNumber(ToolHandler.getBaseAttackDamage(stack))); strings.add( InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.max.txt") + " " + StatCollector.translateToLocal("gui.de.AttackAOE.txt") + ": " + InfoHelper.HITC() - + attackaoe + + formatNumber(attackaoe) + "x" - + attackaoe); + + formatNumber(attackaoe)); return strings; } @@ -337,9 +337,9 @@ public class WyvernSword extends ItemSword @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { - if (!world.isRemote && !BrandonsCore.proxy.isDedicatedServer()) { + if (!world.isRemote && !DraconicEvolution.proxy.isDedicatedServer()) { ToolBase.handleModeChange(stack, player, InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown()); - } else if (world.isRemote && BrandonsCore.proxy.getMCServer() == null) { + } else if (world.isRemote && DraconicEvolution.proxy.getMCServer() == null) { ToolBase.handleModeChange(stack, player, InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown()); DraconicEvolution.network .sendToServer(new ToolModePacket(InfoHelper.isShiftKeyDown(), InfoHelper.isCtrlKeyDown())); 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 06cfad78..8a005dfe 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/lib/References.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/lib/References.java @@ -6,8 +6,6 @@ public final class References { public static final String MODNAME = "Draconic Evolution"; public static final String VERSION = VersionHandler.FULL_VERSION; public static final String MCVERSION = VersionHandler.MCVERSION; - public static final String CLIENTPROXYLOCATION = "com.brandon3055.draconicevolution.client.ClientProxy"; - public static final String SERVERPROXYLOCATION = "com.brandon3055.draconicevolution.common.CommonProxy"; public static final String GUIFACTORY = "com.brandon3055.draconicevolution.client.gui.DEGUIFactory"; public static final String RESOURCESPREFIX = MODID.toLowerCase() + ":"; 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 2be68695..c17d0c85 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/ButtonPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/ButtonPacket.java @@ -3,7 +3,6 @@ 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; import com.brandon3055.draconicevolution.common.container.ContainerDissEnchanter; @@ -12,7 +11,8 @@ import com.brandon3055.draconicevolution.common.container.ContainerWeatherContro 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 com.brandon3055.draconicevolution.common.utils.IConfigurableItem; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; 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 d9babbc7..4f0a0137 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/ContributorPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/ContributorPacket.java @@ -2,7 +2,6 @@ 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; @@ -58,7 +57,7 @@ public class ContributorPacket implements IMessage { DraconicEvolution.network.sendToAll(message); } else { - EntityPlayer player = BrandonsCore.proxy.getClientPlayer(); + EntityPlayer player = DraconicEvolution.proxy.getClientPlayer(); if (!contributor1.isUserValid(player) || message.contributor.equals(player.getCommandSenderName())) { return null; 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 db9ce037..35e63f9c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/GenericParticlePacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/GenericParticlePacket.java @@ -1,6 +1,6 @@ package com.brandon3055.draconicevolution.common.network; -import com.brandon3055.brandonscore.BrandonsCore; +import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.handler.ParticleHandler; import com.brandon3055.draconicevolution.client.render.particle.Particles; @@ -75,7 +75,7 @@ public class GenericParticlePacket implements IMessage { Particles.DragonProjectileParticle particle; for (int i = 0; i < 100; i++) { particle = new Particles.DragonProjectileParticle( - BrandonsCore.proxy.getClientWorld(), + DraconicEvolution.proxy.getClientWorld(), message.posX, message.posY, message.posZ, @@ -92,7 +92,7 @@ public class GenericParticlePacket implements IMessage { Particles.DragonProjectileParticle particle; for (int i = 0; i < 100; i++) { particle = new Particles.DragonProjectileParticle( - BrandonsCore.proxy.getClientWorld(), + DraconicEvolution.proxy.getClientWorld(), message.posX, message.posY, message.posZ, @@ -108,7 +108,7 @@ public class GenericParticlePacket implements IMessage { case CHAOS_IMPLOSION: { ParticleHandler.spawnCustomParticle( new Particles.ChaosImplosionParticle( - BrandonsCore.proxy.getClientWorld(), + DraconicEvolution.proxy.getClientWorld(), message.posX, message.posY, message.posZ, @@ -119,7 +119,7 @@ public class GenericParticlePacket implements IMessage { case ARROW_SHOCK_WAVE: { ParticleHandler.spawnCustomParticle( new Particles.ArrowShockParticle( - BrandonsCore.proxy.getClientWorld(), + DraconicEvolution.proxy.getClientWorld(), message.posX, message.posY, message.posZ, @@ -127,17 +127,17 @@ public class GenericParticlePacket implements IMessage { 256); 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, + DraconicEvolution.proxy.getClientWorld(), + message.posX - 0.25 + DraconicEvolution.proxy.getClientWorld().rand.nextDouble() * 0.5, + message.posY + DraconicEvolution.proxy.getClientWorld().rand.nextDouble() * 0.5, + message.posZ - 0.25 + DraconicEvolution.proxy.getClientWorld().rand.nextDouble() * 0.5, 0xff6000, - 0.2F + BrandonsCore.proxy.getClientWorld().rand.nextFloat() * 10f); + 0.2F + DraconicEvolution.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 = (DraconicEvolution.proxy.getClientWorld().rand.nextDouble() - 0.5) * mm; + particle.motionY = (DraconicEvolution.proxy.getClientWorld().rand.nextDouble() - 0.5) * mm; + particle.motionZ = (DraconicEvolution.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 8631bfb3..e108df53 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/ItemConfigPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/ItemConfigPacket.java @@ -5,11 +5,11 @@ 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 com.brandon3055.draconicevolution.common.utils.DataUtils; +import com.brandon3055.draconicevolution.common.utils.IConfigurableItem; +import com.brandon3055.draconicevolution.common.utils.ItemConfigField; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.utils.lib.References; import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; @@ -47,7 +47,7 @@ public class ItemConfigPacket implements IMessage { this.datatype = bytes.readByte(); this.slot = bytes.readInt(); this.name = ByteBufUtils.readUTF8String(bytes); - this.value = DataUtills.instance.readObjectFromBytes(bytes, datatype); + this.value = DataUtils.instance.readObjectFromBytes(bytes, datatype); this.renameProfile = bytes.readBoolean(); } @@ -56,7 +56,7 @@ public class ItemConfigPacket implements IMessage { bytes.writeByte(datatype); bytes.writeInt(slot); ByteBufUtils.writeUTF8String(bytes, name); - DataUtills.instance.writeObjectToBytes(bytes, datatype, value); + DataUtils.instance.writeObjectToBytes(bytes, datatype, value); bytes.writeBoolean(renameProfile); } @@ -93,7 +93,7 @@ public class ItemConfigPacket implements IMessage { if (newValue.castToDouble() <= field.castMaxToDouble() && newValue.castToDouble() >= field.castMinToDouble()) { - DataUtills.writeObjectToCompound( + DataUtils.writeObjectToCompound( IConfigurableItem.ProfileHelper.getProfileCompound(stack), message.value, message.datatype, 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 9345c10d..4fc53cb8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/MagnetToggleAckPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/MagnetToggleAckPacket.java @@ -8,7 +8,7 @@ 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 com.brandon3055.draconicevolution.common.utils.InventoryUtils; import com.brandon3055.draconicevolution.integration.ModHelper; import cpw.mods.fml.common.network.simpleimpl.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 688a06ed..fb3a1ea8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/MagnetTogglePacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/MagnetTogglePacket.java @@ -7,7 +7,7 @@ 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 com.brandon3055.draconicevolution.common.utils.InventoryUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/MagnetToggleSelfPickupAckPacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/MagnetToggleSelfPickupAckPacket.java index bd535da0..3249550e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/MagnetToggleSelfPickupAckPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/MagnetToggleSelfPickupAckPacket.java @@ -8,7 +8,7 @@ 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 com.brandon3055.draconicevolution.common.utils.InventoryUtils; import com.brandon3055.draconicevolution.integration.ModHelper; import cpw.mods.fml.common.network.simpleimpl.IMessage; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/network/MagnetToggleSelfPickupPacket.java b/src/main/java/com/brandon3055/draconicevolution/common/network/MagnetToggleSelfPickupPacket.java index 06463f1a..c287a4a2 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/MagnetToggleSelfPickupPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/MagnetToggleSelfPickupPacket.java @@ -7,7 +7,7 @@ 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 com.brandon3055.draconicevolution.common.utils.InventoryUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; 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 a989a1fc..a56dd804 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/ShieldHitPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/ShieldHitPacket.java @@ -4,8 +4,8 @@ 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 com.brandon3055.draconicevolution.common.utils.DataUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; @@ -48,7 +48,7 @@ public class ShieldHitPacket implements IMessage { Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(message.playerID); if (entity instanceof EntityPlayer) ClientEventHandler.playerShieldStatus.put( (EntityPlayer) entity, - new DataUtills.XZPair(message.shieldPowerF, ClientEventHandler.elapsedTicks)); + new DataUtils.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 7b47b8c8..02a6a724 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/SpeedRequestPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/SpeedRequestPacket.java @@ -1,9 +1,9 @@ package com.brandon3055.draconicevolution.common.network; -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 com.brandon3055.draconicevolution.common.utils.LogHelper; +import com.brandon3055.draconicevolution.common.utils.PlayerUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; @@ -40,7 +40,7 @@ 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()) + || (PlayerUtils.isOp(ctx.getServerHandler().playerEntity.getCommandSenderName()) && !ConfigHandler.speedLimitops)) return new SpeedRequestPacket(20F); return new SpeedRequestPacket(ConfigHandler.maxPlayerSpeed); 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 3b93b5f6..acd87a57 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/TeleporterPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/TeleporterPacket.java @@ -5,11 +5,11 @@ 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.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModItems; import com.brandon3055.draconicevolution.common.handler.ConfigHandler; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.utils.Teleporter; import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; @@ -34,7 +34,7 @@ public class TeleporterPacket implements IMessage { private int data = 0; private boolean dataB; private byte function = -1; - private TeleportLocation location; + private Teleporter.TeleportLocation location; public TeleporterPacket() {} @@ -44,12 +44,12 @@ public class TeleporterPacket implements IMessage { this.dataB = b; } - public TeleporterPacket(TeleportLocation location, int function) { + public TeleporterPacket(Teleporter.TeleportLocation location, int function) { this.location = location; this.function = (byte) function; } - public TeleporterPacket(TeleportLocation location, int function, int data) { + public TeleporterPacket(Teleporter.TeleportLocation location, int function, int data) { this.data = data; this.location = location; this.function = (byte) function; @@ -96,7 +96,7 @@ public class TeleporterPacket implements IMessage { public void fromBytes(ByteBuf bytes) { function = bytes.readByte(); if (function == ADDDESTINATION || function == UPDATEDESTINATION) { - location = new TeleportLocation(); + location = new Teleporter.TeleportLocation(); location.setXCoord(bytes.readDouble()); location.setYCoord(bytes.readDouble()); location.setZCoord(bytes.readDouble()); @@ -121,7 +121,7 @@ public class TeleporterPacket implements IMessage { } if (function == UPDATENAME) { - location = new TeleportLocation(); + location = new Teleporter.TeleportLocation(); location.setName(ByteBufUtils.readUTF8String(bytes)); data = bytes.readInt(); } @@ -146,7 +146,7 @@ public class TeleporterPacket implements IMessage { if (message.function == ADDDESTINATION) { NBTTagCompound tag = new NBTTagCompound(); message.location.setDimentionName( - BrandonsCore.proxy.getMCServer() + DraconicEvolution.proxy.getMCServer() .worldServerForDimension(message.location.getDimension()).provider.getDimensionName()); message.location.writeToNBT(tag); list.appendTag(tag); @@ -181,7 +181,7 @@ public class TeleporterPacket implements IMessage { if (message.function == UPDATEDESTINATION) { NBTTagCompound tag = list.getCompoundTagAt(message.data); message.location.setDimentionName( - BrandonsCore.proxy.getMCServer() + DraconicEvolution.proxy.getMCServer() .worldServerForDimension(message.location.getDimension()).provider.getDimensionName()); message.location.writeToNBT(tag); list.func_150304_a(message.data, tag); @@ -211,7 +211,7 @@ public class TeleporterPacket implements IMessage { int fuel = ItemNBTHelper.getInteger(teleporter, "Fuel", 0); if (!ctx.getServerHandler().playerEntity.capabilities.isCreativeMode) ItemNBTHelper.setInteger(teleporter, "Fuel", fuel - 1); - TeleportLocation destination = new TeleportLocation(); + Teleporter.TeleportLocation destination = new Teleporter.TeleportLocation(); destination.readFromNBT(list.getCompoundTagAt(message.data)); destination.sendEntityToCoords(ctx.getServerHandler().playerEntity); } 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 c5ffacb5..6ebefaf5 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/network/TileObjectPacket.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/network/TileObjectPacket.java @@ -2,9 +2,9 @@ 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 com.brandon3055.draconicevolution.common.utils.DataUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; @@ -55,7 +55,7 @@ public class TileObjectPacket implements IMessage { bytes.writeByte(dataType); bytes.writeShort(index); - DataUtills.instance.writeObjectToBytes(bytes, dataType, object); + DataUtils.instance.writeObjectToBytes(bytes, dataType, object); } @Override @@ -71,7 +71,7 @@ public class TileObjectPacket implements IMessage { dataType = bytes.readByte(); index = bytes.readShort(); - object = DataUtills.instance.readObjectFromBytes(bytes, dataType); + object = DataUtils.instance.readObjectFromBytes(bytes, dataType); } public static class Handler implements IMessageHandler { 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 16890022..a2bc4464 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileCKeyStone.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileCKeyStone.java @@ -10,8 +10,8 @@ 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; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; /** * Created by Brandon on 27/08/2014. diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileContainerTemplate.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileContainerTemplate.java deleted file mode 100644 index 9118b5e0..00000000 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileContainerTemplate.java +++ /dev/null @@ -1,156 +0,0 @@ -package com.brandon3055.draconicevolution.common.tileentities; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.ISidedInventory; -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.tileentity.TileEntity; - -/** - * Created by Brandon on 27/06/2014. - */ -public class TileContainerTemplate extends TileEntity implements ISidedInventory { - - ItemStack[] items = new ItemStack[9]; - - // ==============================================LOGIC=======================================================// - - @Override - public void updateEntity() {} - - // ==========================================SYNCHRONIZATION==================================================// - - @Override - public Packet getDescriptionPacket() { - NBTTagCompound tagCompound = new NBTTagCompound(); - this.writeToNBT(tagCompound); - return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tagCompound); - } - - @Override - public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { - readFromNBT(pkt.func_148857_g()); - } - - // ==============================================INVENTORY====================================================// - - @Override - public int getSizeInventory() { - return items.length; - } - - @Override - public ItemStack getStackInSlot(int i) { - return items[i]; - } - - @Override - public ItemStack decrStackSize(int i, int count) { - ItemStack itemstack = getStackInSlot(i); - - if (itemstack != null) { - if (itemstack.stackSize <= count) { - setInventorySlotContents(i, null); - } else { - itemstack = itemstack.splitStack(count); - if (itemstack.stackSize == 0) { - setInventorySlotContents(i, null); - } - } - } - return itemstack; - } - - @Override - public ItemStack getStackInSlotOnClosing(int i) { - ItemStack item = getStackInSlot(i); - if (item != null) setInventorySlotContents(i, null); - return item; - } - - @Override - public void setInventorySlotContents(int i, ItemStack itemstack) { - items[i] = itemstack; - if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) { - itemstack.stackSize = getInventoryStackLimit(); - } - } - - @Override - public String getInventoryName() { - return ""; - } - - @Override - public boolean hasCustomInventoryName() { - return false; - } - - @Override - public int getInventoryStackLimit() { - return 64; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer player) { - return player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.4) < 64; - } - - @Override - public void openInventory() {} - - @Override - public void closeInventory() {} - - @Override - public boolean isItemValidForSlot(int i, ItemStack itemstack) { - return true; - } - - @Override - public int[] getAccessibleSlotsFromSide(int var1) { - return new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; - } - - @Override - public boolean canInsertItem(int slot, ItemStack item, int side) { - return true; - } - - @Override - public boolean canExtractItem(int slot, ItemStack item, int side) { - return true; - } - - // ===========================================================================================================// - - @Override - public void writeToNBT(NBTTagCompound compound) { - NBTTagCompound[] tag = new NBTTagCompound[items.length]; - - for (int i = 0; i < items.length; i++) { - tag[i] = new NBTTagCompound(); - - if (items[i] != null) { - tag[i] = items[i].writeToNBT(tag[i]); - } - - compound.setTag("Item" + i, tag[i]); - } - super.writeToNBT(compound); - } - - @Override - public void readFromNBT(NBTTagCompound compound) { - NBTTagCompound[] tag = new NBTTagCompound[items.length]; - - for (int i = 0; i < items.length; i++) { - tag[i] = compound.getCompoundTag("Item" + i); - items[i] = ItemStack.loadItemStackFromNBT(tag[i]); - } - super.readFromNBT(compound); - } -} 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 21293e56..569b80c3 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDissEnchanter.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDissEnchanter.java @@ -17,7 +17,7 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.ForgeHooks; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; /** * Created by Brandon on 27/06/2014. 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 dcd5ed5f..e8b2df5d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDraconiumChest.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDraconiumChest.java @@ -16,13 +16,13 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; -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 com.brandon3055.draconicevolution.common.utils.EnergyStorage; +import com.brandon3055.draconicevolution.common.utils.ICustomItemData; +import com.brandon3055.draconicevolution.common.utils.InventoryUtils; import cofh.api.energy.IEnergyContainerItem; import cofh.api.energy.IEnergyReceiver; 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 45cc8a18..7a12ba23 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileEnergyInfuser.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileEnergyInfuser.java @@ -15,7 +15,7 @@ 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 com.brandon3055.draconicevolution.common.utils.EnergyStorage; import cofh.api.energy.IEnergyContainerItem; import cofh.api.energy.IEnergyReceiver; 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 2ca47434..766841c1 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileGenerator.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileGenerator.java @@ -20,7 +20,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.utills.EnergyStorage; +import com.brandon3055.draconicevolution.common.utils.EnergyStorage; import cofh.api.energy.IEnergyProvider; import cofh.api.energy.IEnergyReceiver; 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 f4c4856f..ef5defdf 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileGrinder.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileGrinder.java @@ -32,7 +32,7 @@ import net.minecraftforge.common.util.ForgeDirection; import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; import com.brandon3055.draconicevolution.common.lib.References; -import com.brandon3055.draconicevolution.common.utills.EnergyStorage; +import com.brandon3055.draconicevolution.common.utils.EnergyStorage; import com.mojang.authlib.GameProfile; import cofh.api.energy.IEnergyReceiver; 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 be9994e1..c6e9d6d0 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePlacedItem.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TilePlacedItem.java @@ -10,7 +10,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Vec3; import com.brandon3055.draconicevolution.common.ModBlocks; -import com.brandon3055.draconicevolution.common.utills.LogHelper; +import com.brandon3055.draconicevolution.common.utils.LogHelper; /** * Created by Brandon on 14/08/2014. 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 a49ef899..10103b65 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTestBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTestBlock.java @@ -11,17 +11,17 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraftforge.common.util.ForgeDirection; -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 com.brandon3055.draconicevolution.common.utils.EnergyStorage; +import com.brandon3055.draconicevolution.common.utils.LogHelper; +import com.brandon3055.draconicevolution.common.utils.Utils; import cofh.api.energy.IEnergyHandler; import cofh.api.energy.IEnergyReceiver; /** - * Created by Brandon on 24/06/2014. + * todo review Created by Brandon on 24/06/2014. */ public class TileTestBlock extends TileEntity implements IEnergyHandler { @@ -35,11 +35,6 @@ public class TileTestBlock extends TileEntity implements IEnergyHandler { @Override public void updateEntity() { - // beam = DraconicEvolution.proxy.energyBeam(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 0.5, 4.5, 0.5, - // 100, true, beam); - // ring = DraconicEvolution.proxy.energyField(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, - // ClientEventHandler.elapsedTicks % 100, true, ring); - if (worldObj.isRemote) return; for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) { if (worldObj.getTileEntity( @@ -49,57 +44,6 @@ public class TileTestBlock extends TileEntity implements IEnergyHandler { ((IEnergyReceiver) worldObj.getTileEntity(xCoord + d.offsetX, yCoord + d.offsetY, zCoord + d.offsetZ)) .receiveEnergy(d.getOpposite(), Integer.MAX_VALUE, false); } - // LogHelper.info(Integer.MAX_VALUE); - // if (1==1)return; - - // 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); - // } - // } - - // 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); - // } - // } - - // Achievements.addModAchievements(); - // Achievements.registerAchievementPane(); - - // if (worldObj.isRemote) modelRotation += 0.5; - - // LogHelper.info(modelCoreRotation); - - // int test = 4; - // //if (!worldObj.isRemote) - // //System.out.println(energy.getEnergyStored()); - // - // if ((this.energy.getEnergyStored() > 0)) { - // - // 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(), - // this.energy.extractEnergy(maxInput, true), false), false); - // } - // } } @Override @@ -153,7 +97,7 @@ public class TileTestBlock extends TileEntity implements IEnergyHandler { 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)); + .info("Read: " + Utils.getDistanceAtoB(player.posX, player.posY, player.posZ, xCoord, yCoord, zCoord)); LogHelper.info(worldObj + " " + player); } @@ -162,7 +106,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: " + Utils.getDistanceAtoB(player.posX, player.posY, player.posZ, xCoord, yCoord, zCoord)); } } 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 937c2892..03b23d8e 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 @@ -2,7 +2,7 @@ package com.brandon3055.draconicevolution.common.tileentities.energynet; import net.minecraft.entity.player.EntityPlayer; -import com.brandon3055.draconicevolution.common.utills.EnergyStorage; +import com.brandon3055.draconicevolution.common.utils.EnergyStorage; import cofh.api.energy.IEnergyHandler; 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 8e25d71b..ef2405bd 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 @@ -14,17 +14,17 @@ 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; 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.Wrench; 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 com.brandon3055.draconicevolution.common.utils.DataUtils; +import com.brandon3055.draconicevolution.common.utils.EnergyStorage; +import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; +import com.brandon3055.draconicevolution.common.utils.LogHelper; +import com.brandon3055.draconicevolution.common.utils.Utils; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -148,7 +148,7 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRe sendObjectToClient( References.INT_PAIR_ID, 0, - new DataUtills.IntPair(index, (int) linkedDevices.get(index).energyFlow)); + new DataUtils.IntPair(index, (int) linkedDevices.get(index).energyFlow)); linkedDevices.get(index).lastTickEnergyFlow = linkedDevices.get(index).energyFlow; } @@ -160,9 +160,9 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRe @SideOnly(Side.CLIENT) @Override public void receiveObjectFromServer(int index, Object object) { - if (index == 0 && object instanceof DataUtills.IntPair - && linkedDevices.size() > ((DataUtills.IntPair) object).i1) { - linkedDevices.get(((DataUtills.IntPair) object).i1).energyFlow = ((DataUtills.IntPair) object).i2; + if (index == 0 && object instanceof DataUtils.IntPair + && linkedDevices.size() > ((DataUtils.IntPair) object).i1) { + linkedDevices.get(((DataUtils.IntPair) object).i1).energyFlow = ((DataUtils.IntPair) object).i2; } else if (index == 1) storage.setEnergyStored((Integer) object); } @@ -289,7 +289,7 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRe if (worldObj.isRemote) player.addChatComponentMessage(new ChatComponentTranslation("msg.de.invalidTile.txt")); return false; - } else if (Utills.getDistanceAtoB(xCoord, yCoord, zCoord, x, y, z) > range) { + } else if (Utils.getDistanceAtoB(xCoord, yCoord, zCoord, x, y, z) > range) { if (worldObj.isRemote) player.addChatComponentMessage(new ChatComponentTranslation("msg.de.outOfRange.txt")); return false; 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 35e99064..0e853439 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 @@ -10,13 +10,13 @@ import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatComponentTranslation; import net.minecraftforge.common.util.ForgeDirection; -import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyField; 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 com.brandon3055.draconicevolution.common.utils.Utils; import cofh.api.energy.IEnergyReceiver; import cpw.mods.fml.relauncher.Side; @@ -150,7 +150,7 @@ public class TileWirelessEnergyTransceiver extends TileRemoteEnergyBase { return; } - if (Utills.getDistanceAtoB(xCoord, yCoord, zCoord, x, y, z) > (powerTier == 0 ? 15 : 30)) { + if (Utils.getDistanceAtoB(xCoord, yCoord, zCoord, x, y, z) > (powerTier == 0 ? 15 : 30)) { player.addChatComponentMessage(new ChatComponentTranslation("msg.de.outOfRange.txt")); return; } 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 ecee21b6..0318c540 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,5 +1,7 @@ package com.brandon3055.draconicevolution.common.tileentities.gates; +import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber; + import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; @@ -7,9 +9,8 @@ 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; +import com.brandon3055.draconicevolution.common.utils.LogHelper; /** * Created by Brandon on 29/6/2015. @@ -65,7 +66,7 @@ public class TileFluidGate extends TileGate implements IFluidHandler { @Override public String getFlowSetting(int selector) { - return selector == 0 ? Utills.addCommas(flowRSLow) + " MB/t" : Utills.addCommas(flowRSHigh) + " MB/t"; + return selector == 0 ? formatNumber(flowRSLow) + " MB/t" : formatNumber(flowRSHigh) + " MB/t"; } @Override 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 aff1f2ed..6a30998a 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,9 +1,10 @@ package com.brandon3055.draconicevolution.common.tileentities.gates; +import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber; + import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; -import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.common.lib.References; import cofh.api.energy.IEnergyReceiver; @@ -84,7 +85,7 @@ public class TileFluxGate extends TileGate implements IEnergyReceiver { @Override public String getFlowSetting(int selector) { - return selector == 0 ? Utills.addCommas(flowRSLow) + " RF/t" : Utills.addCommas(flowRSHigh) + " RF/t"; + return selector == 0 ? formatNumber(flowRSLow) + " RF/t" : formatNumber(flowRSHigh) + " RF/t"; } @Override 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 5642d3b7..294e578a 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 @@ -6,9 +6,9 @@ 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.common.utils.Utils; import com.brandon3055.draconicevolution.integration.computers.IDEPeripheral; /** @@ -109,19 +109,19 @@ public abstract class TileGate extends TileObjectSync implements IDEPeripheral { } 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())); - flowOverride = Utills.toInt((Double) args[0]); + flowOverride = Utils.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())); - flowRSHigh = Utills.toInt((Double) args[0]); + flowRSHigh = Utils.toInt((Double) args[0]); if (!worldObj.isRemote) sendObjectToClient(References.INT_ID, 4, flowRSHigh); } else if (method.equals("getSignalHighFlow")) { 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())); - flowRSLow = Utills.toInt((Double) args[0]); + flowRSLow = Utils.toInt((Double) args[0]); if (!worldObj.isRemote) sendObjectToClient(References.INT_ID, 5, flowRSLow); } else if (method.equals("getSignalLowFlow")) { return new Object[] { flowRSLow }; 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 ee0b2315..60e9976f 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 @@ -9,9 +9,9 @@ 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; +import com.brandon3055.draconicevolution.common.utils.PortalHelper; +import com.brandon3055.draconicevolution.common.utils.Teleporter; /** * Created by Brandon on 22/5/2015. 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 0581e983..da35c848 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 @@ -21,7 +21,7 @@ import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelp 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 com.brandon3055.draconicevolution.common.utils.LogHelper; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; 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 02610032..c8bd3dc4 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,7 @@ package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles; +import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber; + import java.util.ArrayList; import java.util.List; @@ -13,8 +15,6 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; -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.multiblock.InvisibleMultiblock; import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation; @@ -22,7 +22,8 @@ import com.brandon3055.draconicevolution.common.handler.BalanceConfigHandler; import com.brandon3055.draconicevolution.common.lib.References; import com.brandon3055.draconicevolution.common.tileentities.TileObjectSync; import com.brandon3055.draconicevolution.common.tileentities.TileParticleGenerator; -import com.brandon3055.draconicevolution.common.utills.LogHelper; +import com.brandon3055.draconicevolution.common.utils.InfoHelper; +import com.brandon3055.draconicevolution.common.utils.LogHelper; import cpw.mods.fml.common.network.NetworkRegistry; @@ -500,11 +501,11 @@ public class TileEnergyStorageCore extends TileObjectSync { information.add( StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.ITC() - + Utills.formatNumber(energy) + + formatNumber(energy) + " / " - + Utills.formatNumber(capacity) + + formatNumber(capacity) + " [" - + Utills.addCommas(energy) + + formatNumber(energy) + " RF]"); return information; } 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 b0782667..dd6c6b1c 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 @@ -8,7 +8,7 @@ import net.minecraft.tileentity.TileEntity; import com.brandon3055.draconicevolution.common.blocks.multiblock.InvisibleMultiblock; import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation; -import com.brandon3055.draconicevolution.common.utills.LogHelper; +import com.brandon3055.draconicevolution.common.utils.LogHelper; /** * Created by Brandon on 26/07/2014. 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 367d9134..e744c3c8 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 @@ -4,9 +4,9 @@ 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 com.brandon3055.draconicevolution.common.utils.Utils; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -32,7 +32,7 @@ public class TilePortalBlock extends TileEntity { if (!worldObj.isRemote) { return; } - double distanceMod = Utills.getDistanceAtoB( + double distanceMod = Utils.getDistanceAtoB( xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 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 55ee064c..fa2e963f 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 @@ -3,9 +3,9 @@ package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.re 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 com.brandon3055.draconicevolution.common.utils.Utils; +import com.brandon3055.draconicevolution.common.utils.handlers.IProcess; +import com.brandon3055.draconicevolution.common.utils.handlers.ProcessHandler; /** * Created by brandon3055 on 12/8/2015. @@ -38,7 +38,7 @@ public class ReactorExplosion implements IProcess { int size = (int) expansion; for (int x = xCoord - size; x < xCoord + size; x++) { for (int z = zCoord - size; z < zCoord + size; z++) { - double distance = Utills.getDistanceAtoB(x, z, xCoord, zCoord); + double distance = Utils.getDistanceAtoB(x, z, xCoord, zCoord); if (distance < expansion && distance >= size - 1) { float tracePower = power - (float) (expansion / 10D); tracePower *= 1F + (world.rand.nextFloat() - 0.5F) * 0.2; 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 e460dc3c..848d0af6 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 @@ -9,7 +9,7 @@ import net.minecraft.init.Blocks; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; -import com.brandon3055.brandonscore.common.handlers.IProcess; +import com.brandon3055.draconicevolution.common.utils.handlers.IProcess; /** * Created by brandon3055 on 12/8/2015. 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 0c73f2dd..61eb7f85 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 @@ -28,9 +28,6 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.StatCollector; 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; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.ReactorSound; import com.brandon3055.draconicevolution.client.gui.GuiHandler; @@ -42,7 +39,9 @@ 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 com.brandon3055.draconicevolution.common.utills.OreDictionaryHelper; +import com.brandon3055.draconicevolution.common.utils.OreDictionaryHelper; +import com.brandon3055.draconicevolution.common.utils.Utils; +import com.brandon3055.draconicevolution.common.utils.handlers.ProcessHandler; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.common.network.NetworkRegistry; @@ -145,8 +144,8 @@ public class TileReactorCore extends TileObjectSync implements IInventory { } private void checkPlayerCollision() { - EntityPlayer player = BrandonsCore.proxy.getClientPlayer(); - double distance = Utills + EntityPlayer player = DraconicEvolution.proxy.getClientPlayer(); + double distance = Utils .getDistanceAtoB(player.posX, player.posY, player.posZ, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5); double coreRadiusWithMargin = getCoreRadius() + 0.5; if (distance < coreRadiusWithMargin) { @@ -650,6 +649,7 @@ public class TileReactorCore extends TileObjectSync implements IInventory { maxFieldCharge = compound.getDouble("maxFieldCharge"); } + // todo review wtf public Object[] callMethod(String methodName, Object... args) { if (args.length > 0) { throw new IllegalArgumentException("This method does not accept arguments"); @@ -657,12 +657,12 @@ public class TileReactorCore extends TileObjectSync implements IInventory { if (methodName.equals("getReactorInfo")) { Map map = new HashMap<>(); - map.put("temperature", Utills.round(reactionTemperature, 100)); - map.put("fieldStrength", Utills.round(fieldCharge, 100)); - map.put("maxFieldStrength", Utills.round(maxFieldCharge, 100)); + map.put("temperature", Utils.round(reactionTemperature, 100)); + map.put("fieldStrength", Utils.round(fieldCharge, 100)); + map.put("maxFieldStrength", Utils.round(maxFieldCharge, 100)); map.put("energySaturation", energySaturation); map.put("maxEnergySaturation", maxEnergySaturation); - map.put("fuelConversion", Utills.round(convertedFuel + conversionUnit, 1000)); + map.put("fuelConversion", Utils.round(convertedFuel + conversionUnit, 1000)); map.put("maxFuelConversion", reactorFuel + convertedFuel); map.put("generationRate", (int) generationRate); map.put("fieldDrainRate", fieldDrain); 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 ac885db1..b8518659 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 @@ -21,7 +21,7 @@ import com.brandon3055.draconicevolution.common.blocks.multiblock.IReactorPart; import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation; import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore.ReactorState; -import com.brandon3055.draconicevolution.common.utills.OreDictionaryHelper; +import com.brandon3055.draconicevolution.common.utils.OreDictionaryHelper; import com.brandon3055.draconicevolution.integration.computers.IDEPeripheral; import cofh.api.energy.IEnergyProvider; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/IInventoryTool.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/IInventoryTool.java deleted file mode 100644 index c47bcecf..00000000 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/IInventoryTool.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.brandon3055.draconicevolution.common.utills; - -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(); - - public abstract boolean isEnchantValid(Enchantment enchant); -} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/InventoryUtils.java b/src/main/java/com/brandon3055/draconicevolution/common/utills/InventoryUtils.java deleted file mode 100644 index 565e6ad4..00000000 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/InventoryUtils.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.brandon3055.draconicevolution.common.utills; - -import java.util.Optional; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import baubles.common.lib.PlayerHandler; -import cpw.mods.fml.common.Loader; - -public final class InventoryUtils { - - private static final boolean BAUBLES_MOD_IS_LOADED = Loader.isModLoaded("Baubles"); - - private InventoryUtils() {} - - public static Optional getItemInAnyPlayerInventory(EntityPlayer player, - Class itemClass) { - if (BAUBLES_MOD_IS_LOADED) { - Optional itemInBaubles = getItemInPlayerBaublesInventory(player, itemClass); - if (itemInBaubles.isPresent()) { - return itemInBaubles; - } - } - return getItemInPlayerInventory(player, itemClass); - } - - public static Optional getItemInPlayerInventory(EntityPlayer player, Class itemClass) { - if (itemClass != null) { - for (int i = 0; i < player.inventory.getSizeInventory(); i++) { - ItemStack itemStack = player.inventory.getStackInSlot(i); - - if (itemStack != null && itemClass.isInstance(itemStack.getItem())) { - return Optional.of(itemStack); - } - } - } - return Optional.empty(); - } - - public static Optional getItemInPlayerBaublesInventory(EntityPlayer player, - Class itemClass) { - if (BAUBLES_MOD_IS_LOADED && itemClass != null) { - for (int i = 0; i < PlayerHandler.getPlayerBaubles(player).getSizeInventory(); i++) { - ItemStack itemStack = PlayerHandler.getPlayerBaubles(player).getStackInSlot(i); - if (itemStack != null && itemClass.isInstance(itemStack.getItem())) { - return Optional.of(itemStack); - } - } - } - return Optional.empty(); - } -} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/DamageSourceChaos.java b/src/main/java/com/brandon3055/draconicevolution/common/utils/DamageSourceChaos.java similarity index 87% rename from src/main/java/com/brandon3055/draconicevolution/common/utills/DamageSourceChaos.java rename to src/main/java/com/brandon3055/draconicevolution/common/utils/DamageSourceChaos.java index ea349c4e..697ea8e3 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/DamageSourceChaos.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utils/DamageSourceChaos.java @@ -1,4 +1,4 @@ -package com.brandon3055.draconicevolution.common.utills; +package com.brandon3055.draconicevolution.common.utils; import net.minecraft.entity.Entity; import net.minecraft.util.EntityDamageSource; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utils/DataUtils.java b/src/main/java/com/brandon3055/draconicevolution/common/utils/DataUtils.java new file mode 100644 index 00000000..39cbfa71 --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/common/utils/DataUtils.java @@ -0,0 +1,261 @@ +package com.brandon3055.draconicevolution.common.utils; + +import java.text.DecimalFormat; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +import com.brandon3055.draconicevolution.common.utils.lib.References; + +import cpw.mods.fml.common.network.ByteBufUtils; +import io.netty.buffer.ByteBuf; + +/** + * Created by Brandon on 31/12/2014. + */ +@SuppressWarnings("unused") +public class DataUtils { + + public static DataUtils instance = new DataUtils(); + + public void writeObjectToBytes(ByteBuf bytes, int dataType, Object object) { + switch (dataType) { + case References.BYTE_ID: + bytes.writeByte((Byte) object); + break; + case References.SHORT_ID: + bytes.writeShort((Short) object); + break; + case References.INT_ID: + bytes.writeInt((Integer) object); + break; + case References.LONG_ID: + bytes.writeLong((Long) object); + break; + case References.FLOAT_ID: + bytes.writeFloat((Float) object); + break; + case References.DOUBLE_ID: + bytes.writeDouble((Double) object); + break; + case References.CHAR_ID: + bytes.writeChar((Character) object); + break; + case References.STRING_ID: + ByteBufUtils.writeUTF8String(bytes, (String) object); + break; + case References.BOOLEAN_ID: + bytes.writeBoolean((Boolean) object); + break; + case References.INT_PAIR_ID: + bytes.writeInt(((IntPair) object).i1); + bytes.writeInt(((IntPair) object).i2); + break; + } + } + + public Object readObjectFromBytes(ByteBuf bytes, int dataType) { + switch (dataType) { + case References.BYTE_ID: + return bytes.readByte(); + case References.SHORT_ID: + return bytes.readShort(); + case References.INT_ID: + return bytes.readInt(); + case References.LONG_ID: + return bytes.readLong(); + case References.FLOAT_ID: + return bytes.readFloat(); + case References.DOUBLE_ID: + return bytes.readDouble(); + case References.CHAR_ID: + return bytes.readChar(); + case References.STRING_ID: + return ByteBufUtils.readUTF8String(bytes); + case References.BOOLEAN_ID: + return bytes.readBoolean(); + case References.INT_PAIR_ID: + IntPair tx = new IntPair(0, 0); + tx.i1 = bytes.readInt(); + tx.i2 = bytes.readInt(); + return tx; + } + return null; + } + + public static void writeObjectToItem(ItemStack stack, Object value, int datatype, String name) { + switch (datatype) { + case References.BYTE_ID: + ItemNBTHelper.setByte(stack, name, (Byte) value); + break; + case References.SHORT_ID: + ItemNBTHelper.setShort(stack, name, (Short) value); + break; + case References.INT_ID: + ItemNBTHelper.setInteger(stack, name, (Integer) value); + break; + case References.LONG_ID: + ItemNBTHelper.setLong(stack, name, (Long) value); + break; + case References.FLOAT_ID: + ItemNBTHelper.setFloat(stack, name, (Float) value); + break; + case References.DOUBLE_ID: + ItemNBTHelper.setDouble(stack, name, (Double) value); + break; + case References.STRING_ID: + ItemNBTHelper.setString(stack, name, (String) value); + break; + case References.BOOLEAN_ID: + ItemNBTHelper.setBoolean(stack, name, (Boolean) value); + break; + } + } + + public static void writeObjectToCompound(NBTTagCompound compound, Object value, int datatype, String name) { + switch (datatype) { + case References.BYTE_ID: + compound.setByte(name, (Byte) value); + break; + case References.SHORT_ID: + compound.setShort(name, (Short) value); + break; + case References.INT_ID: + compound.setInteger(name, (Integer) value); + break; + case References.LONG_ID: + compound.setLong(name, (Long) value); + break; + case References.FLOAT_ID: + compound.setFloat(name, (Float) value); + break; + case References.DOUBLE_ID: + compound.setDouble(name, (Double) value); + break; + case References.STRING_ID: + compound.setString(name, (String) value); + break; + case References.BOOLEAN_ID: + compound.setBoolean(name, (Boolean) value); + break; + } + } + + public static Object readObjectFromItem(ItemStack stack, int dataType, String name, Object defaultExpected) { + switch (dataType) { + case References.BYTE_ID: + return ItemNBTHelper.getByte(stack, name, (Byte) defaultExpected); + case References.SHORT_ID: + return ItemNBTHelper.getShort(stack, name, (Short) defaultExpected); + case References.INT_ID: + return ItemNBTHelper.getInteger(stack, name, (Integer) defaultExpected); + case References.LONG_ID: + return ItemNBTHelper.getLong(stack, name, (Long) defaultExpected); + case References.FLOAT_ID: + return ItemNBTHelper.getFloat(stack, name, (Float) defaultExpected); + case References.DOUBLE_ID: + return ItemNBTHelper.getDouble(stack, name, (Double) defaultExpected); + // case References.CHAR_ID: + case References.STRING_ID: + return ItemNBTHelper.getString(stack, name, (String) defaultExpected); + case References.BOOLEAN_ID: + return ItemNBTHelper.getBoolean(stack, name, (Boolean) defaultExpected); + } + return null; + } + + public static Object readObjectFromItem(ItemStack stack, int dataType, String name) { + switch (dataType) { + case References.BYTE_ID: + return ItemNBTHelper.getByte(stack, name, (byte) 0); + case References.SHORT_ID: + return ItemNBTHelper.getShort(stack, name, (short) 0); + case References.INT_ID: + return ItemNBTHelper.getInteger(stack, name, 0); + case References.LONG_ID: + return ItemNBTHelper.getLong(stack, name, 0L); + case References.FLOAT_ID: + return ItemNBTHelper.getFloat(stack, name, 0F); + case References.DOUBLE_ID: + return ItemNBTHelper.getDouble(stack, name, 0D); + case References.STRING_ID: + return ItemNBTHelper.getString(stack, name, ""); + case References.BOOLEAN_ID: + return ItemNBTHelper.getBoolean(stack, name, false); + } + return null; + } + + public static Object readObjectFromCompound(NBTTagCompound compound, int dataType, String name, + Object defaultExpected) { + switch (dataType) { + case References.BYTE_ID: + return compound.hasKey(name) ? compound.getByte(name) : (Byte) defaultExpected; + case References.SHORT_ID: + return compound.hasKey(name) ? compound.getShort(name) : (Short) defaultExpected; + case References.INT_ID: + return compound.hasKey(name) ? compound.getInteger(name) : (Integer) defaultExpected; + case References.LONG_ID: + return compound.hasKey(name) ? compound.getLong(name) : (Long) defaultExpected; + case References.FLOAT_ID: + return compound.hasKey(name) ? compound.getFloat(name) : (Float) defaultExpected; + case References.DOUBLE_ID: + return compound.hasKey(name) ? compound.getDouble(name) : (Double) defaultExpected; + case References.STRING_ID: + return compound.hasKey(name) ? compound.getString(name) : (String) defaultExpected; + case References.BOOLEAN_ID: + return compound.hasKey(name) ? compound.getBoolean(name) : (Boolean) defaultExpected; + } + return null; + } + + public static class IntPair { + + public int i1; + public int i2; + + public IntPair(int i1, int i2) { + this.i1 = i1; + this.i2 = i2; + } + } + + public static class XZPair { + + public X x; + public Z z; + + public XZPair(X x, Z z) { + this.x = x; + this.z = z; + } + + public X getKey() { + return x; + } + + public Z getValue() { + return z; + } + } + + public static class XYZTri { + + public X x; + public Y y; + public Z z; + + public XYZTri(X x, Y y, Z z) { + this.x = x; + this.y = y; + this.z = z; + } + } + + public static String formatFileSize(long size) { + if (size <= 0) return "0"; + final String[] units = new String[] { "B", "kB", "MB", "GB", "TB" }; + int digitGroups = (int) (Math.log10(size) / Math.log10(1024)); + return new DecimalFormat("#,##0.#").format(size / Math.pow(1024, digitGroups)) + " " + units[digitGroups]; + } +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/DragonChunkLoader.java b/src/main/java/com/brandon3055/draconicevolution/common/utils/DragonChunkLoader.java similarity index 98% rename from src/main/java/com/brandon3055/draconicevolution/common/utills/DragonChunkLoader.java rename to src/main/java/com/brandon3055/draconicevolution/common/utils/DragonChunkLoader.java index c49af295..8c21afe2 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/DragonChunkLoader.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utils/DragonChunkLoader.java @@ -1,4 +1,4 @@ -package com.brandon3055.draconicevolution.common.utills; +package com.brandon3055.draconicevolution.common.utils; import java.util.HashMap; import java.util.HashSet; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/EnergyStorage.java b/src/main/java/com/brandon3055/draconicevolution/common/utils/EnergyStorage.java similarity index 95% rename from src/main/java/com/brandon3055/draconicevolution/common/utills/EnergyStorage.java rename to src/main/java/com/brandon3055/draconicevolution/common/utils/EnergyStorage.java index e7ec181e..1d1b8300 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/EnergyStorage.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utils/EnergyStorage.java @@ -1,4 +1,4 @@ -package com.brandon3055.draconicevolution.common.utills; +package com.brandon3055.draconicevolution.common.utils; import net.minecraft.nbt.NBTTagCompound; @@ -61,12 +61,6 @@ public class EnergyStorage implements IEnergyStorage { } } - public void setMaxTransfer(int maxTransfer) { - - setMaxReceive(maxTransfer); - setMaxExtract(maxTransfer); - } - public void setMaxReceive(int maxReceive) { this.maxReceive = maxReceive; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/IConfigurableItem.java b/src/main/java/com/brandon3055/draconicevolution/common/utils/IConfigurableItem.java similarity index 89% rename from src/main/java/com/brandon3055/draconicevolution/common/utills/IConfigurableItem.java rename to src/main/java/com/brandon3055/draconicevolution/common/utils/IConfigurableItem.java index b927c209..a1eb604d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/IConfigurableItem.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utils/IConfigurableItem.java @@ -1,4 +1,4 @@ -package com.brandon3055.draconicevolution.common.utills; +package com.brandon3055.draconicevolution.common.utils; import java.util.List; @@ -6,8 +6,6 @@ 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. */ @@ -15,9 +13,9 @@ public interface IConfigurableItem { List getFields(ItemStack stack, int slot); - public boolean hasProfiles(); + boolean hasProfiles(); - public static class ProfileHelper { + class ProfileHelper { public static NBTTagCompound getProfileCompound(ItemStack stack) { int profile = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0); @@ -48,10 +46,6 @@ public interface IConfigurableItem { getProfileCompound(stack).setFloat(tag, f); } - public static void setDouble(ItemStack stack, String tag, double d) { - getProfileCompound(stack).setDouble(tag, d); - } - public static void setString(ItemStack stack, String tag, String s) { getProfileCompound(stack).setString(tag, s); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/ICustomItemData.java b/src/main/java/com/brandon3055/draconicevolution/common/utils/ICustomItemData.java similarity index 72% rename from src/main/java/com/brandon3055/draconicevolution/common/utills/ICustomItemData.java rename to src/main/java/com/brandon3055/draconicevolution/common/utils/ICustomItemData.java index 6b546d8d..20597c29 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/ICustomItemData.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utils/ICustomItemData.java @@ -1,4 +1,4 @@ -package com.brandon3055.draconicevolution.common.utills; +package com.brandon3055.draconicevolution.common.utils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -8,7 +8,7 @@ import net.minecraft.nbt.NBTTagCompound; */ public interface ICustomItemData { - public static final String tagName = "TileCompound"; + String tagName = "TileCompound"; void writeDataToItem(NBTTagCompound compound, ItemStack stack); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/IHudDisplayBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/utils/IHudDisplayBlock.java similarity index 78% rename from src/main/java/com/brandon3055/draconicevolution/common/utills/IHudDisplayBlock.java rename to src/main/java/com/brandon3055/draconicevolution/common/utils/IHudDisplayBlock.java index 882ebb81..4e4724a5 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/IHudDisplayBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utils/IHudDisplayBlock.java @@ -1,4 +1,4 @@ -package com.brandon3055.draconicevolution.common.utills; +package com.brandon3055.draconicevolution.common.utils; import java.util.List; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/IHudDisplayItem.java b/src/main/java/com/brandon3055/draconicevolution/common/utils/IHudDisplayItem.java similarity index 77% rename from src/main/java/com/brandon3055/draconicevolution/common/utills/IHudDisplayItem.java rename to src/main/java/com/brandon3055/draconicevolution/common/utils/IHudDisplayItem.java index 0116324e..9d9f56d5 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/IHudDisplayItem.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utils/IHudDisplayItem.java @@ -1,4 +1,4 @@ -package com.brandon3055.draconicevolution.common.utills; +package com.brandon3055.draconicevolution.common.utils; import java.util.List; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utils/IInventoryTool.java b/src/main/java/com/brandon3055/draconicevolution/common/utils/IInventoryTool.java new file mode 100644 index 00000000..0fcd4abd --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/common/utils/IInventoryTool.java @@ -0,0 +1,15 @@ +package com.brandon3055.draconicevolution.common.utils; + +import net.minecraft.enchantment.Enchantment; + +/** + * Created by Brandon on 17/01/2015. + */ +public interface IInventoryTool extends IConfigurableItem { + + String getInventoryName(); + + int getInventorySlots(); + + boolean isEnchantValid(Enchantment enchant); +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/IUpgradableItem.java b/src/main/java/com/brandon3055/draconicevolution/common/utils/IUpgradableItem.java similarity index 93% rename from src/main/java/com/brandon3055/draconicevolution/common/utills/IUpgradableItem.java rename to src/main/java/com/brandon3055/draconicevolution/common/utils/IUpgradableItem.java index fd2aeda3..7bfe3821 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/IUpgradableItem.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utils/IUpgradableItem.java @@ -1,4 +1,4 @@ -package com.brandon3055.draconicevolution.common.utills; +package com.brandon3055.draconicevolution.common.utils; import java.util.List; @@ -6,7 +6,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.StatCollector; -import com.brandon3055.brandonscore.common.utills.ItemNBTHelper; import com.brandon3055.draconicevolution.common.lib.References; import cofh.api.energy.IEnergyContainerItem; @@ -19,28 +18,28 @@ public interface IUpgradableItem { /** * @return a list of upgrades for this item. */ - public List getUpgrades(ItemStack itemstack); + List getUpgrades(ItemStack itemstack); /** * @return the maximum number of upgrades for this item */ - public int getUpgradeCap(ItemStack itemstack); + 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 */ - public int getMaxTier(ItemStack itemstack); + int getMaxTier(ItemStack itemstack); - public int getMaxUpgradePoints(int upgradeIndex); + int getMaxUpgradePoints(int upgradeIndex); - public int getMaxUpgradePoints(int upgradeIndex, ItemStack stack); + int getMaxUpgradePoints(int upgradeIndex, ItemStack stack); - public int getBaseUpgradePoints(int upgradeIndex); + int getBaseUpgradePoints(int upgradeIndex); - public List getUpgradeStats(ItemStack itemstack); + List getUpgradeStats(ItemStack itemstack); - public static enum EnumUpgrade { + enum EnumUpgrade { RF_CAPACITY(0, 1, "RFCapacity") { @@ -160,7 +159,7 @@ public interface IUpgradableItem { public String name; private final String COMPOUND_NAME = "Upgrades"; - private EnumUpgrade(int index, int pointConversion, String name) { + EnumUpgrade(int index, int pointConversion, String name) { this.index = index; this.pointConversion = pointConversion; this.name = name; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utils/InfoHelper.java b/src/main/java/com/brandon3055/draconicevolution/common/utils/InfoHelper.java new file mode 100644 index 00000000..402f775b --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/common/utils/InfoHelper.java @@ -0,0 +1,141 @@ +package com.brandon3055.draconicevolution.common.utils; + +import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumberCompact; + +import java.util.List; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; + +import org.lwjgl.input.Keyboard; + +import cofh.api.energy.IEnergyContainerItem; + +/** + * Created by Brandon on 1/07/2014. + */ +@SuppressWarnings("unused") +public class InfoHelper { + + @SuppressWarnings("unchecked") + public static void addEnergyInfo(ItemStack stack, List list) { + IEnergyContainerItem item = (IEnergyContainerItem) stack.getItem(); + int energy = item.getEnergyStored(stack); + int maxEnergy = item.getMaxEnergyStored(stack); + + list.add( + StatCollector.translateToLocal("info.de.charge.txt") + ": " + + formatNumberCompact(energy) + + " / " + + formatNumberCompact(maxEnergy) + + " RF"); + } + + @SuppressWarnings("unchecked") + public static void addLore(ItemStack stack, List list, boolean addLeadingLine) { + String[] lore = getLore(stack); + if (addLeadingLine) list.add(""); + if (lore == null) { + list.add( + "" + EnumChatFormatting.ITALIC + + "" + + EnumChatFormatting.DARK_PURPLE + + "Invalid lore localization! (something is broken)"); + return; + } + for (String s : lore) list.add("" + EnumChatFormatting.ITALIC + "" + EnumChatFormatting.DARK_PURPLE + s); + } + + /** Add lore with a blank line above it */ + public static void addLore(ItemStack stack, List list) { + addLore(stack, list, true); + } + + /** Add the standard energy and lore information */ + @SuppressWarnings("unchecked") + public static void addEnergyAndLore(ItemStack stack, List list) { + if (!isShiftKeyDown()) list.add( + StatCollector.translateToLocal("info.de.hold.txt") + " " + + EnumChatFormatting.AQUA + + "" + + EnumChatFormatting.ITALIC + + StatCollector.translateToLocal("info.de.shift.txt") + + EnumChatFormatting.RESET + + " " + + EnumChatFormatting.GRAY + + StatCollector.translateToLocal("info.de.forDetails.txt")); + else { + addEnergyInfo(stack, list); + addLore(stack, list); + } + } + + /** returns lore text or an empty string if the lore is not set */ + public static String[] getLore(ItemStack stack) { + String unlocalizeLore = stack.getItem().getUnlocalizedName() + ".lore"; + String rawLore = StatCollector.translateToLocal(unlocalizeLore); + + if (rawLore.contains(unlocalizeLore)) { + return null; + } + + String lineCountS = rawLore.substring(0, 1); + rawLore = rawLore.substring(1); + int lineCount = 0; + + try { + lineCount = Integer.parseInt(lineCountS); + } catch (NumberFormatException e) { + LogHelper.error( + "Invalid Lore Format! Lore myst start with the number of lines \"3Line 1\\nLine 2\\nLine 3\""); + } + + String[] loreLines = new String[lineCount]; + + for (int i = 0; i < lineCount; i++) { + if (rawLore.contains("\\n")) loreLines[i] = rawLore.substring(0, rawLore.indexOf("\\n")); + else loreLines[i] = rawLore; + if (rawLore.contains("\\n")) rawLore = rawLore.substring(rawLore.indexOf("\\n") + 2); + } + + return loreLines; + } + + public static boolean isShiftKeyDown() { + return Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT); + } + + public static boolean isCtrlKeyDown() { + return Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL); + } + + @SuppressWarnings("unchecked") + public static boolean holdShiftForDetails(List list, boolean inverted) { + if (isShiftKeyDown() == inverted) list.add( + StatCollector.translateToLocal("info.de.hold.txt") + " " + + EnumChatFormatting.AQUA + + "" + + EnumChatFormatting.ITALIC + + StatCollector.translateToLocal("info.de.shift.txt") + + EnumChatFormatting.RESET + + " " + + EnumChatFormatting.GRAY + + StatCollector.translateToLocal("info.de.forDetails.txt")); + return isShiftKeyDown(); + } + + public static boolean holdShiftForDetails(List list) { + return holdShiftForDetails(list, false); + } + + /** "Information Text Colour" The colour used for custom tool tip info */ + public static String ITC() { + return "" + EnumChatFormatting.RESET + "" + EnumChatFormatting.DARK_AQUA; + } + + /** "Highlighted Information Text Colour" The colour used for parts that need to stand out */ + public static String HITC() { + return "" + EnumChatFormatting.RESET + "" + EnumChatFormatting.ITALIC + "" + EnumChatFormatting.GOLD; + } +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utils/InventoryUtils.java b/src/main/java/com/brandon3055/draconicevolution/common/utils/InventoryUtils.java new file mode 100644 index 00000000..eea1e362 --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/common/utils/InventoryUtils.java @@ -0,0 +1,436 @@ +package com.brandon3055.draconicevolution.common.utils; + +import java.util.List; +import java.util.Optional; +import java.util.Set; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.inventory.InventoryLargeChest; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityChest; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; + +import baubles.common.lib.PlayerHandler; +import cpw.mods.fml.common.Loader; + +public final class InventoryUtils { + + private static final boolean BAUBLES_MOD_IS_LOADED = Loader.isModLoaded("Baubles"); + + private InventoryUtils() {} + + public static Optional getItemInAnyPlayerInventory(EntityPlayer player, + Class itemClass) { + if (BAUBLES_MOD_IS_LOADED) { + Optional itemInBaubles = getItemInPlayerBaublesInventory(player, itemClass); + if (itemInBaubles.isPresent()) { + return itemInBaubles; + } + } + return getItemInPlayerInventory(player, itemClass); + } + + public static Optional getItemInPlayerInventory(EntityPlayer player, Class itemClass) { + if (itemClass != null) { + for (int i = 0; i < player.inventory.getSizeInventory(); i++) { + ItemStack itemStack = player.inventory.getStackInSlot(i); + + if (itemStack != null && itemClass.isInstance(itemStack.getItem())) { + return Optional.of(itemStack); + } + } + } + return Optional.empty(); + } + + public static Optional getItemInPlayerBaublesInventory(EntityPlayer player, + Class itemClass) { + if (BAUBLES_MOD_IS_LOADED && itemClass != null) { + for (int i = 0; i < PlayerHandler.getPlayerBaubles(player).getSizeInventory(); i++) { + ItemStack itemStack = PlayerHandler.getPlayerBaubles(player).getStackInSlot(i); + if (itemStack != null && itemClass.isInstance(itemStack.getItem())) { + return Optional.of(itemStack); + } + } + } + return Optional.empty(); + } + + /*** + * Try to merge the supplied stack into the supplied slot in the target inventory + * + * @param targetInventory Although it doesn't return anything, it'll REDUCE the stack size of the stack that you + * pass in + * + * @param slot + * @param stack + */ + public static void tryInsertStack(IInventory targetInventory, int slot, ItemStack stack, boolean canMerge) { + if (targetInventory.isItemValidForSlot(slot, stack)) { + ItemStack targetStack = targetInventory.getStackInSlot(slot); + if (targetStack == null) { + targetInventory.setInventorySlotContents(slot, stack.copy()); + stack.stackSize = 0; + } else if (canMerge) { + if (targetInventory.isItemValidForSlot(slot, stack) && areMergeCandidates(stack, targetStack)) { + int space = targetStack.getMaxStackSize() - targetStack.stackSize; + int mergeAmount = Math.min(space, stack.stackSize); + ItemStack copy = targetStack.copy(); + copy.stackSize += mergeAmount; + targetInventory.setInventorySlotContents(slot, copy); + stack.stackSize -= mergeAmount; + } + } + } + } + + public static boolean areItemAndTagEqual(final ItemStack stackA, ItemStack stackB) { + return stackA.isItemEqual(stackB) && ItemStack.areItemStackTagsEqual(stackA, stackB); + } + + public static boolean areMergeCandidates(ItemStack source, ItemStack target) { + return areItemAndTagEqual(source, target) && target.stackSize < target.getMaxStackSize(); + } + + public static void insertItemIntoInventory(IInventory inventory, ItemStack stack) { + insertItemIntoInventory(inventory, stack, ForgeDirection.UNKNOWN, -1); + } + + public static void insertItemIntoInventory(IInventory inventory, ItemStack stack, ForgeDirection side, + int intoSlot) { + insertItemIntoInventory(inventory, stack, side, intoSlot, true); + } + + public static void insertItemIntoInventory(IInventory inventory, ItemStack stack, ForgeDirection side, int intoSlot, + boolean doMove) { + insertItemIntoInventory(inventory, stack, side, intoSlot, doMove, true); + } + + public static void insertItemIntoInventory(IInventory inventory, ItemStack stack, ForgeDirection side, int intoSlot, + boolean doMove, boolean canStack) { + if (stack == null) return; + + final int sideId = side.ordinal(); + IInventory targetInventory = inventory; + + // if we're not meant to move, make a clone of the inventory + if (!doMove) { + GenericInventory copy = new GenericInventory( + "temporary.inventory", + false, + targetInventory.getSizeInventory()); + copy.copyFrom(inventory); + targetInventory = copy; + } + + final Set attemptSlots = Sets.newTreeSet(); + + // if it's a sided inventory, get all the accessible slots + final boolean isSidedInventory = inventory instanceof ISidedInventory && side != ForgeDirection.UNKNOWN; + + if (isSidedInventory) { + int[] accessibleSlots = ((ISidedInventory) inventory).getAccessibleSlotsFromSide(sideId); + for (int slot : accessibleSlots) attemptSlots.add(slot); + } else { + // if it's just a standard inventory, get all slots + for (int a = 0; a < inventory.getSizeInventory(); a++) { + attemptSlots.add(a); + } + } + + // if we've defining a specific slot, we'll just use that + if (intoSlot > -1) attemptSlots.retainAll(ImmutableSet.of(intoSlot)); + + if (attemptSlots.isEmpty()) return; + + for (Integer slot : attemptSlots) { + if (stack.stackSize <= 0) break; + if (isSidedInventory && !((ISidedInventory) inventory).canInsertItem(slot, stack, sideId)) continue; + tryInsertStack(targetInventory, slot, stack, canStack); + } + } + + public static int moveItemInto(IInventory fromInventory, int fromSlot, Object target, int intoSlot, int maxAmount, + ForgeDirection direction, boolean doMove) { + return moveItemInto(fromInventory, fromSlot, target, intoSlot, maxAmount, direction, doMove, true); + } + + /*** + * Move an item from the fromInventory, into the target. The target can be an inventory or pipe. Double checks are + * automagically wrapped. If you're not bothered what slot you insert into, pass -1 for intoSlot. If you're passing + * false for doMove, it'll create a dummy inventory and its calculations on that instead + * + * @param fromInventory the inventory the item is coming from + * @param fromSlot the slot the item is coming from + * @param target the inventory you want the item to be put into. can be BC pipe or IInventory + * @param intoSlot the target slot. Pass -1 for any slot + * @param maxAmount The maximum amount you wish to pass + * @param direction The direction of the move. Pass UNKNOWN if not applicable + * @param doMove + * @param canStack + * @return The amount of items moved + */ + public static int moveItemInto(IInventory fromInventory, int fromSlot, Object target, int intoSlot, int maxAmount, + ForgeDirection direction, boolean doMove, boolean canStack) { + + fromInventory = getInventory(fromInventory); + + // if we dont have a stack in the source location, return 0 + ItemStack sourceStack = fromInventory.getStackInSlot(fromSlot); + if (sourceStack == null) { + return 0; + } + + if (fromInventory instanceof ISidedInventory + && !((ISidedInventory) fromInventory).canExtractItem(fromSlot, sourceStack, direction.ordinal())) + return 0; + + // create a clone of our source stack and set the size to either + // maxAmount or the stackSize + ItemStack clonedSourceStack = sourceStack.copy(); + clonedSourceStack.stackSize = Math.min(clonedSourceStack.stackSize, maxAmount); + int amountToMove = clonedSourceStack.stackSize; + int inserted = 0; + + if (target instanceof IInventory) { + IInventory targetInventory = getInventory((IInventory) target); + ForgeDirection side = direction.getOpposite(); + // try insert the item into the target inventory. this'll reduce the + // stackSize of our stack + insertItemIntoInventory(targetInventory, clonedSourceStack, side, intoSlot, doMove, canStack); + inserted = amountToMove - clonedSourceStack.stackSize; + } + + // if we've done the move, reduce/remove the stack from our source + // inventory + if (doMove) { + ItemStack newSourcestack = sourceStack.copy(); + newSourcestack.stackSize -= inserted; + if (newSourcestack.stackSize == 0) { + fromInventory.setInventorySlotContents(fromSlot, null); + } else { + fromInventory.setInventorySlotContents(fromSlot, newSourcestack); + } + } + + return inserted; + } + + private static IInventory doubleChestFix(TileEntity te) { + final World world = te.getWorldObj(); + final int x = te.xCoord; + final int y = te.yCoord; + final int z = te.zCoord; + if (world.getBlock(x - 1, y, z) == Blocks.chest) return new InventoryLargeChest( + "Large chest", + (IInventory) world.getTileEntity(x - 1, y, z), + (IInventory) te); + if (world.getBlock(x + 1, y, z) == Blocks.chest) return new InventoryLargeChest( + "Large chest", + (IInventory) te, + (IInventory) world.getTileEntity(x + 1, y, z)); + if (world.getBlock(x, y, z - 1) == Blocks.chest) return new InventoryLargeChest( + "Large chest", + (IInventory) world.getTileEntity(x, y, z - 1), + (IInventory) te); + if (world.getBlock(x, y, z + 1) == Blocks.chest) return new InventoryLargeChest( + "Large chest", + (IInventory) te, + (IInventory) world.getTileEntity(x, y, z + 1)); + return (te instanceof IInventory) ? (IInventory) te : null; + } + + public static IInventory getInventory(IInventory inventory) { + if (inventory instanceof TileEntityChest) return doubleChestFix((TileEntity) inventory); + return inventory; + } + + public static List getInventoryContents(IInventory inventory) { + List result = Lists.newArrayList(); + for (int i = 0; i < inventory.getSizeInventory(); i++) { + ItemStack slot = inventory.getStackInSlot(i); + if (slot != null) result.add(slot); + } + return result; + } + + public static void tryMergeStacks(ItemStack stackToMerge, ItemStack stackInSlot) { + if (stackInSlot == null || !stackInSlot.isItemEqual(stackToMerge) + || !ItemStack.areItemStackTagsEqual(stackToMerge, stackInSlot)) + return; + + int newStackSize = stackInSlot.stackSize + stackToMerge.stackSize; + + final int maxStackSize = stackToMerge.getMaxStackSize(); + if (newStackSize <= maxStackSize) { + stackToMerge.stackSize = 0; + stackInSlot.stackSize = newStackSize; + } else if (stackInSlot.stackSize < maxStackSize) { + stackToMerge.stackSize -= maxStackSize - stackInSlot.stackSize; + stackInSlot.stackSize = maxStackSize; + } + + } + + public static class GenericInventory implements IInventory { + + protected String inventoryTitle; + protected int slotsCount; + protected ItemStack[] inventoryContents; + protected boolean isInvNameLocalized; + + public GenericInventory(String name, boolean isInvNameLocalized, int size) { + this.isInvNameLocalized = isInvNameLocalized; + this.slotsCount = size; + this.inventoryTitle = name; + this.inventoryContents = new ItemStack[size]; + } + + @Override + public ItemStack decrStackSize(int par1, int par2) { + if (this.inventoryContents[par1] != null) { + ItemStack itemstack; + + if (this.inventoryContents[par1].stackSize <= par2) { + itemstack = this.inventoryContents[par1]; + this.inventoryContents[par1] = null; + return itemstack; + } + itemstack = this.inventoryContents[par1].splitStack(par2); + if (this.inventoryContents[par1].stackSize == 0) { + this.inventoryContents[par1] = null; + } + + return itemstack; + } + return null; + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public int getSizeInventory() { + return slotsCount; + } + + @Override + public ItemStack getStackInSlot(int i) { + return this.inventoryContents[i]; + } + + public ItemStack getStackInSlot(Enum i) { + return getStackInSlot(i.ordinal()); + } + + @Override + public ItemStack getStackInSlotOnClosing(int i) { + if (i >= this.inventoryContents.length) { + return null; + } + if (this.inventoryContents[i] != null) { + ItemStack itemstack = this.inventoryContents[i]; + this.inventoryContents[i] = null; + return itemstack; + } + return null; + } + + @Override + public boolean isItemValidForSlot(int i, ItemStack itemstack) { + return true; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer entityplayer) { + return true; + } + + public void readFromNBT(NBTTagCompound tag) { + if (tag.hasKey("size")) { + this.slotsCount = tag.getInteger("size"); + } + NBTTagList nbttaglist = tag.getTagList("Items", 10); + inventoryContents = new ItemStack[slotsCount]; + for (int i = 0; i < nbttaglist.tagCount(); i++) { + NBTTagCompound stacktag = nbttaglist.getCompoundTagAt(i); + int j = stacktag.getByte("Slot"); + if (j >= 0 && j < inventoryContents.length) { + inventoryContents[j] = ItemStack.loadItemStackFromNBT(stacktag); + } + } + } + + @Override + public void setInventorySlotContents(int i, ItemStack itemstack) { + this.inventoryContents[i] = itemstack; + + if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) { + itemstack.stackSize = getInventoryStackLimit(); + } + } + + public void writeToNBT(NBTTagCompound tag) { + tag.setInteger("size", getSizeInventory()); + NBTTagList nbttaglist = new NBTTagList(); + for (int i = 0; i < inventoryContents.length; i++) { + if (inventoryContents[i] != null) { + NBTTagCompound stacktag = new NBTTagCompound(); + stacktag.setByte("Slot", (byte) i); + inventoryContents[i].writeToNBT(stacktag); + nbttaglist.appendTag(stacktag); + } + } + tag.setTag("Items", nbttaglist); + } + + /** + * This bastard never even gets called, so don't rely on it. + */ + @Override + public void markDirty() {} + + public void copyFrom(IInventory inventory) { + for (int i = 0; i < inventory.getSizeInventory(); i++) { + if (i < getSizeInventory()) { + ItemStack stack = inventory.getStackInSlot(i); + if (stack != null) { + setInventorySlotContents(i, stack.copy()); + } else { + setInventorySlotContents(i, null); + } + } + } + } + + @Override + public String getInventoryName() { + return this.inventoryTitle; + } + + @Override + public boolean hasCustomInventoryName() { + return this.isInvNameLocalized; + } + + @Override + public void openInventory() {} + + @Override + public void closeInventory() {} + } +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/ItemConfigField.java b/src/main/java/com/brandon3055/draconicevolution/common/utils/ItemConfigField.java similarity index 80% rename from src/main/java/com/brandon3055/draconicevolution/common/utills/ItemConfigField.java rename to src/main/java/com/brandon3055/draconicevolution/common/utils/ItemConfigField.java index 2e35efe2..d2a8c96f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/ItemConfigField.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utils/ItemConfigField.java @@ -1,11 +1,11 @@ -package com.brandon3055.draconicevolution.common.utills; +package com.brandon3055.draconicevolution.common.utils; + +import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber; 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; @@ -49,12 +49,8 @@ public class ItemConfigField { return StatCollector.translateToLocal("button.de." + name + ".name"); } - // public void writeToItem(ItemStack stack){ - // DataUtills.writeObjectToItem(stack, value, datatype, name); - // } - public ItemConfigField readFromItem(ItemStack stack, Object defaultExpected) { - value = DataUtills.readObjectFromCompound( + value = DataUtils.readObjectFromCompound( IConfigurableItem.ProfileHelper.getProfileCompound(stack), datatype, name, @@ -71,7 +67,7 @@ public class ItemConfigField { if (datatype == References.INT_ID && !StringUtils.isNullOrEmpty(modifier) && modifier.equals("AOE")) { int i = (Integer) value; i *= 2; - return String.valueOf((i + 1) + "x" + (i + 1)); + return formatNumber(i + 1) + "x" + formatNumber(i + 1); } else if (datatype == References.BOOLEAN_ID) { return (Boolean) value ? StatCollector.translateToLocal("gui.de.on.txt") : StatCollector.translateToLocal("gui.de.off.txt"); @@ -80,7 +76,7 @@ public class ItemConfigField { return Math.round((Float) value * 100D) + "%"; } else if (datatype == References.FLOAT_ID && !StringUtils.isNullOrEmpty(modifier) && modifier.equals("PLUSPERCENT")) { - return "+" + Math.round((Float) value * 100D) + "%"; + return "+" + formatNumber(Math.round((Float) value * 100D)) + "%"; } else { return String.valueOf(value); } @@ -90,7 +86,7 @@ public class ItemConfigField { if (datatype == References.INT_ID && !StringUtils.isNullOrEmpty(modifier) && modifier.equals("AOE")) { int i = (Integer) max; i *= 2; - return String.valueOf((i + 1) + "x" + (i + 1)); + return formatNumber(i + 1) + "x" + formatNumber(i + 1); } else { return String.valueOf(max); } @@ -104,29 +100,6 @@ public class ItemConfigField { DraconicEvolution.network.sendToServer(new ItemConfigPacket(this)); } - public int castToInt() { - switch (datatype) { - case References.BYTE_ID: - return (int) (Byte) value; - case References.SHORT_ID: - return (int) (Short) value; - case References.INT_ID: - return (Integer) value; - case References.LONG_ID: - long l = (Long) value; - return (int) l; - case References.FLOAT_ID: - float f = (Float) value; - return (int) f; - case References.DOUBLE_ID: - double d = (Double) value; - return (int) d; - case References.BOOLEAN_ID: - return (Boolean) value ? 1 : 0; - } - return 0; - } - public double castToDouble() { switch (datatype) { case References.BYTE_ID: diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utils/ItemNBTHelper.java b/src/main/java/com/brandon3055/draconicevolution/common/utils/ItemNBTHelper.java new file mode 100644 index 00000000..d189d084 --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/common/utils/ItemNBTHelper.java @@ -0,0 +1,109 @@ +package com.brandon3055.draconicevolution.common.utils; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public final class ItemNBTHelper { + + // SETTERS /////////////////////////////////////////////////////////////////// + public static NBTTagCompound getCompound(ItemStack stack) { + if (stack.getTagCompound() == null) stack.setTagCompound(new NBTTagCompound()); + return stack.getTagCompound(); + } + + public static ItemStack setByte(ItemStack stack, String tag, byte b) { + NBTTagCompound compound = getCompound(stack); + compound.setByte(tag, b); + stack.setTagCompound(compound); + return stack; + } + + public static ItemStack setBoolean(ItemStack stack, String tag, boolean b) { + NBTTagCompound compound = getCompound(stack); + compound.setBoolean(tag, b); + stack.setTagCompound(compound); + return stack; + } + + public static ItemStack setShort(ItemStack stack, String tag, short s) { + NBTTagCompound compound = getCompound(stack); + compound.setShort(tag, s); + stack.setTagCompound(compound); + return stack; + } + + public static ItemStack setInteger(ItemStack stack, String tag, int i) { + NBTTagCompound compound = getCompound(stack); + compound.setInteger(tag, i); + stack.setTagCompound(compound); + return stack; + } + + public static ItemStack setLong(ItemStack stack, String tag, long i) { + NBTTagCompound compound = getCompound(stack); + compound.setLong(tag, i); + stack.setTagCompound(compound); + return stack; + } + + public static ItemStack setFloat(ItemStack stack, String tag, float f) { + NBTTagCompound compound = getCompound(stack); + compound.setFloat(tag, f); + stack.setTagCompound(compound); + return stack; + } + + public static ItemStack setDouble(ItemStack stack, String tag, double d) { + NBTTagCompound compound = getCompound(stack); + compound.setDouble(tag, d); + stack.setTagCompound(compound); + return stack; + } + + public static ItemStack setString(ItemStack stack, String tag, String s) { + NBTTagCompound compound = getCompound(stack); + compound.setString(tag, s); + stack.setTagCompound(compound); + return stack; + } + + // GETTERS /////////////////////////////////////////////////////////////////// + + public static boolean verifyExistance(ItemStack stack, String tag) { + NBTTagCompound compound = stack.getTagCompound(); + if (compound == null) return false; + else return stack.getTagCompound().hasKey(tag); + } + + public static byte getByte(ItemStack stack, String tag, byte defaultExpected) { + return verifyExistance(stack, tag) ? stack.getTagCompound().getByte(tag) : defaultExpected; + } + + public static boolean getBoolean(ItemStack stack, String tag, boolean defaultExpected) { + return verifyExistance(stack, tag) ? stack.getTagCompound().getBoolean(tag) : defaultExpected; + } + + public static short getShort(ItemStack stack, String tag, short defaultExpected) { + return verifyExistance(stack, tag) ? stack.getTagCompound().getShort(tag) : defaultExpected; + } + + public static int getInteger(ItemStack stack, String tag, int defaultExpected) { + return verifyExistance(stack, tag) ? stack.getTagCompound().getInteger(tag) : defaultExpected; + } + + public static long getLong(ItemStack stack, String tag, long defaultExpected) { + return verifyExistance(stack, tag) ? stack.getTagCompound().getLong(tag) : defaultExpected; + } + + public static float getFloat(ItemStack stack, String tag, float defaultExpected) { + return verifyExistance(stack, tag) ? stack.getTagCompound().getFloat(tag) : defaultExpected; + } + + public static double getDouble(ItemStack stack, String tag, double defaultExpected) { + return verifyExistance(stack, tag) ? stack.getTagCompound().getDouble(tag) : defaultExpected; + } + + public static String getString(ItemStack stack, String tag, String defaultExpected) { + return verifyExistance(stack, tag) ? stack.getTagCompound().getString(tag) : defaultExpected; + } +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/LogHelper.java b/src/main/java/com/brandon3055/draconicevolution/common/utils/LogHelper.java similarity index 93% rename from src/main/java/com/brandon3055/draconicevolution/common/utills/LogHelper.java rename to src/main/java/com/brandon3055/draconicevolution/common/utils/LogHelper.java index 4d77a277..249ac73f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/LogHelper.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utils/LogHelper.java @@ -1,4 +1,4 @@ -package com.brandon3055.draconicevolution.common.utills; +package com.brandon3055.draconicevolution.common.utils; import org.apache.logging.log4j.Level; @@ -10,6 +10,7 @@ import cpw.mods.fml.common.FMLLog; /** * Created by Brandon on 3/07/2014. */ +@SuppressWarnings("unused") public class LogHelper { public static void log(Level logLevel, Object object) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/OreDictionaryHelper.java b/src/main/java/com/brandon3055/draconicevolution/common/utils/OreDictionaryHelper.java similarity index 88% rename from src/main/java/com/brandon3055/draconicevolution/common/utills/OreDictionaryHelper.java rename to src/main/java/com/brandon3055/draconicevolution/common/utils/OreDictionaryHelper.java index 360f1341..1725be32 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/OreDictionaryHelper.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utils/OreDictionaryHelper.java @@ -1,4 +1,4 @@ -package com.brandon3055.draconicevolution.common.utills; +package com.brandon3055.draconicevolution.common.utils; import java.util.Arrays; import java.util.Set; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utils/PlayerUtils.java b/src/main/java/com/brandon3055/draconicevolution/common/utils/PlayerUtils.java new file mode 100644 index 00000000..0ab87936 --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/common/utils/PlayerUtils.java @@ -0,0 +1,19 @@ +package com.brandon3055.draconicevolution.common.utils; + +import net.minecraft.server.MinecraftServer; + +import cpw.mods.fml.common.FMLCommonHandler; + +public class PlayerUtils { + + public static boolean isOp(String paramString) { + MinecraftServer localMinecraftServer = FMLCommonHandler.instance().getMinecraftServerInstance(); + paramString = paramString.trim(); + for (String str : localMinecraftServer.getConfigurationManager().func_152606_n()) { + if (paramString.equalsIgnoreCase(str)) { + return true; + } + } + return false; + } +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/PortalHelper.java b/src/main/java/com/brandon3055/draconicevolution/common/utils/PortalHelper.java similarity index 97% rename from src/main/java/com/brandon3055/draconicevolution/common/utills/PortalHelper.java rename to src/main/java/com/brandon3055/draconicevolution/common/utils/PortalHelper.java index ce822b40..1f7a6c89 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/PortalHelper.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utils/PortalHelper.java @@ -1,4 +1,4 @@ -package com.brandon3055.draconicevolution.common.utills; +package com.brandon3055.draconicevolution.common.utils; import net.minecraft.block.Block; import net.minecraft.nbt.NBTTagCompound; @@ -21,10 +21,6 @@ public class PortalHelper { return block == ModBlocks.infusedObsidian; } - public static boolean isReceptacle(Block block) { - return block == ModBlocks.dislocatorReceptacle; - } - public static boolean isPortal(Block block) { return block == ModBlocks.portal; } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utills/ShapedOreEnergyRecipe.java b/src/main/java/com/brandon3055/draconicevolution/common/utils/ShapedOreEnergyRecipe.java similarity index 71% rename from src/main/java/com/brandon3055/draconicevolution/common/utills/ShapedOreEnergyRecipe.java rename to src/main/java/com/brandon3055/draconicevolution/common/utils/ShapedOreEnergyRecipe.java index e902a028..24836eaf 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/utills/ShapedOreEnergyRecipe.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/utils/ShapedOreEnergyRecipe.java @@ -1,13 +1,9 @@ -package com.brandon3055.draconicevolution.common.utills; +package com.brandon3055.draconicevolution.common.utils; -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 com.brandon3055.brandonscore.common.utills.ItemNBTHelper; - import cofh.api.energy.IEnergyContainerItem; /** @@ -15,14 +11,6 @@ import cofh.api.energy.IEnergyContainerItem; */ public class ShapedOreEnergyRecipe extends ShapedOreRecipe { - public ShapedOreEnergyRecipe(Block result, Object... recipe) { - this(new ItemStack(result), recipe); - } - - public ShapedOreEnergyRecipe(Item result, Object... recipe) { - this(new ItemStack(result), recipe); - } - public ShapedOreEnergyRecipe(ItemStack result, Object... recipe) { super(result, recipe); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utils/SimplexNoise.java b/src/main/java/com/brandon3055/draconicevolution/common/utils/SimplexNoise.java new file mode 100644 index 00000000..9b6f08a1 --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/common/utils/SimplexNoise.java @@ -0,0 +1,479 @@ +package com.brandon3055.draconicevolution.common.utils; + +/** + * Simplex Noise in 2D, 3D and 4D. Based on the example code of this paper: + * http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf + * + * @author Stefan Gustavson, Linkping University, Sweden (stegu at itn dot liu dot se) + * + * Slight optimizations & restructuring by + * @author Karsten Schmidt (info at toxi dot co dot uk) + * + */ +public class SimplexNoise { + + private static final double SQRT3 = Math.sqrt(3.0); + private static final double SQRT5 = Math.sqrt(5.0); + + /** + * Skewing and unskewing factors for 2D, 3D and 4D, some of them pre-multiplied. + */ + private static final double F2 = 0.5 * (SQRT3 - 1.0); + + private static final double G2 = (3.0 - SQRT3) / 6.0; + private static final double G22 = G2 * 2.0 - 1; + + private static final double F3 = 1.0 / 3.0; + private static final double G3 = 1.0 / 6.0; + + private static final double F4 = (SQRT5 - 1.0) / 4.0; + private static final double G4 = (5.0 - SQRT5) / 20.0; + private static final double G42 = G4 * 2.0; + private static final double G43 = G4 * 3.0; + private static final double G44 = G4 * 4.0 - 1.0; + + /** + * Gradient vectors for 3D (pointing to mid points of all edges of a unit cube) + */ + private static final int[][] grad3 = { { 1, 1, 0 }, { -1, 1, 0 }, { 1, -1, 0 }, { -1, -1, 0 }, { 1, 0, 1 }, + { -1, 0, 1 }, { 1, 0, -1 }, { -1, 0, -1 }, { 0, 1, 1 }, { 0, -1, 1 }, { 0, 1, -1 }, { 0, -1, -1 } }; + + /** + * Gradient vectors for 4D (pointing to mid points of all edges of a unit 4D hypercube) + */ + private static final int[][] grad4 = { { 0, 1, 1, 1 }, { 0, 1, 1, -1 }, { 0, 1, -1, 1 }, { 0, 1, -1, -1 }, + { 0, -1, 1, 1 }, { 0, -1, 1, -1 }, { 0, -1, -1, 1 }, { 0, -1, -1, -1 }, { 1, 0, 1, 1 }, { 1, 0, 1, -1 }, + { 1, 0, -1, 1 }, { 1, 0, -1, -1 }, { -1, 0, 1, 1 }, { -1, 0, 1, -1 }, { -1, 0, -1, 1 }, { -1, 0, -1, -1 }, + { 1, 1, 0, 1 }, { 1, 1, 0, -1 }, { 1, -1, 0, 1 }, { 1, -1, 0, -1 }, { -1, 1, 0, 1 }, { -1, 1, 0, -1 }, + { -1, -1, 0, 1 }, { -1, -1, 0, -1 }, { 1, 1, 1, 0 }, { 1, 1, -1, 0 }, { 1, -1, 1, 0 }, { 1, -1, -1, 0 }, + { -1, 1, 1, 0 }, { -1, 1, -1, 0 }, { -1, -1, 1, 0 }, { -1, -1, -1, 0 } }; + + /** + * Permutation table + */ + private static final int[] p = { 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, 35, 11, 32, 57, 177, 33, 88, 237, 149, 56, 87, 174, 20, 125, 136, 171, 168, 68, 175, 74, 165, 71, + 134, 139, 48, 27, 166, 77, 146, 158, 231, 83, 111, 229, 122, 60, 211, 133, 230, 220, 105, 92, 41, 55, 46, + 245, 40, 244, 102, 143, 54, 65, 25, 63, 161, 1, 216, 80, 73, 209, 76, 132, 187, 208, 89, 18, 169, 200, 196, + 135, 130, 116, 188, 159, 86, 164, 100, 109, 198, 173, 186, 3, 64, 52, 217, 226, 250, 124, 123, 5, 202, 38, + 147, 118, 126, 255, 82, 85, 212, 207, 206, 59, 227, 47, 16, 58, 17, 182, 189, 28, 42, 223, 183, 170, 213, + 119, 248, 152, 2, 44, 154, 163, 70, 221, 153, 101, 155, 167, 43, 172, 9, 129, 22, 39, 253, 19, 98, 108, 110, + 79, 113, 224, 232, 178, 185, 112, 104, 218, 246, 97, 228, 251, 34, 242, 193, 238, 210, 144, 12, 191, 179, + 162, 241, 81, 51, 145, 235, 249, 14, 239, 107, 49, 192, 214, 31, 181, 199, 106, 157, 184, 84, 204, 176, 115, + 121, 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 }; + + /** + * To remove the need for index wrapping, double the permutation table length + */ + private static int[] perm = new int[0x200]; + /** + * A lookup table to traverse the simplex around a given point in 4D. Details can be found where this table is used, + * in the 4D noise method. + */ + private static final int[][] simplex = { { 0, 1, 2, 3 }, { 0, 1, 3, 2 }, { 0, 0, 0, 0 }, { 0, 2, 3, 1 }, + { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 1, 2, 3, 0 }, { 0, 2, 1, 3 }, { 0, 0, 0, 0 }, + { 0, 3, 1, 2 }, { 0, 3, 2, 1 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 1, 3, 2, 0 }, + { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 1, 2, 0, 3 }, { 0, 0, 0, 0 }, { 1, 3, 0, 2 }, { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 2, 3, 0, 1 }, { 2, 3, 1, 0 }, { 1, 0, 2, 3 }, { 1, 0, 3, 2 }, + { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 2, 0, 3, 1 }, { 0, 0, 0, 0 }, { 2, 1, 3, 0 }, + { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 2, 0, 1, 3 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, + { 3, 0, 1, 2 }, { 3, 0, 2, 1 }, { 0, 0, 0, 0 }, { 3, 1, 2, 0 }, { 2, 1, 0, 3 }, { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 3, 1, 0, 2 }, { 0, 0, 0, 0 }, { 3, 2, 0, 1 }, { 3, 2, 1, 0 } }; + + static { + for (int i = 0; i < 0x200; i++) { + perm[i] = p[i & 0xff]; + } + } + + /** + * Computes dot product in 2D. + * + * @param g 2-vector (grid offset) + * @param x + * @param y + * @return dot product + */ + private static double dot(int g[], double x, double y) { + return g[0] * x + g[1] * y; + } + + /** + * Computes dot product in 3D. + * + * @param g 3-vector (grid offset) + * @param x + * @param y + * @param z + * @return dot product + */ + private static double dot(int g[], double x, double y, double z) { + return g[0] * x + g[1] * y + g[2] * z; + } + + /** + * Computes dot product in 4D. + * + * @param g 4-vector (grid offset) + * @param x + * @param y + * @param z + * @param w + * @return dot product + */ + private static double dot(int g[], double x, double y, double z, double w) { + return g[0] * x + g[1] * y + g[2] * z + g[3] * w; + } + + /** + * This method is a *lot* faster than using (int)Math.floor(x). + * + * @param x value to be floored + * @return + */ + private static final int fastfloor(double x) { + return x >= 0 ? (int) x : (int) x - 1; + } + + /** + * Computes 2D Simplex Noise. + * + * @param x coordinate + * @param y coordinate + * @return noise value in range -1 ... +1. + */ + public static double noise(double x, double y) { + double n0 = 0, n1 = 0, n2 = 0; // Noise contributions from the three + // corners + // Skew the input space to determine which simplex cell we're in + double s = (x + y) * F2; // Hairy factor for 2D + int i = fastfloor(x + s); + int j = fastfloor(y + s); + double t = (i + j) * G2; + double x0 = x - (i - t); // The x,y distances from the cell origin + double y0 = y - (j - t); + // For the 2D case, the simplex shape is an equilateral triangle. + // Determine which simplex we are in. + int i1, j1; // Offsets for second (middle) corner of simplex in (i,j) + if (x0 > y0) { + i1 = 1; + j1 = 0; + } // lower triangle, XY order: (0,0)->(1,0)->(1,1) + else { + i1 = 0; + j1 = 1; + } // upper triangle, YX order: (0,0)->(0,1)->(1,1) + // A step of (1,0) in (i,j) means a step of (1-c,-c) in (x,y), and + // a step of (0,1) in (i,j) means a step of (-c,1-c) in (x,y), where + // c = (3-sqrt(3))/6 + double x1 = x0 - i1 + G2; // Offsets for middle corner in (x,y) unskewed + double y1 = y0 - j1 + G2; + double x2 = x0 + G22; // Offsets for last corner in (x,y) unskewed + double y2 = y0 + G22; + // Work out the hashed gradient indices of the three simplex corners + int ii = i & 0xff; + int jj = j & 0xff; + // Calculate the contribution from the three corners + double t0 = 0.5 - x0 * x0 - y0 * y0; + if (t0 > 0) { + t0 *= t0; + int gi0 = perm[ii + perm[jj]] % 12; + n0 = t0 * t0 * dot(grad3[gi0], x0, y0); // (x,y) of grad3 used for + // 2D gradient + } + double t1 = 0.5 - x1 * x1 - y1 * y1; + if (t1 > 0) { + t1 *= t1; + int gi1 = perm[ii + i1 + perm[jj + j1]] % 12; + n1 = t1 * t1 * dot(grad3[gi1], x1, y1); + } + double t2 = 0.5 - x2 * x2 - y2 * y2; + if (t2 > 0) { + t2 *= t2; + int gi2 = perm[ii + 1 + perm[jj + 1]] % 12; + n2 = t2 * t2 * dot(grad3[gi2], x2, y2); + } + // Add contributions from each corner to get the final noise value. + // The result is scaled to return values in the interval [-1,1]. + return 70.0 * (n0 + n1 + n2); + } + + /** + * Computes 3D Simplex Noise. + * + * @param x coordinate + * @param y coordinate + * @param z coordinate + * @return noise value in range -1 ... +1 + */ + public static double noise(double x, double y, double z) { + double n0 = 0, n1 = 0, n2 = 0, n3 = 0; + // Noise contributions from the + // four corners + // Skew the input space to determine which simplex cell we're in + // final double F3 = 1.0 / 3.0; + double s = (x + y + z) * F3; // Very nice and simple skew factor + // for 3D + int i = fastfloor(x + s); + int j = fastfloor(y + s); + int k = fastfloor(z + s); + // final double G3 = 1.0 / 6.0; // Very nice and simple unskew factor, + // too + double t = (i + j + k) * G3; + double x0 = x - (i - t); // The x,y,z distances from the cell origin + double y0 = y - (j - t); + double z0 = z - (k - t); + // For the 3D case, the simplex shape is a slightly irregular + // tetrahedron. + // Determine which simplex we are in. + int i1, j1, k1; // Offsets for second corner of simplex in (i,j,k) + // coords + int i2, j2, k2; // Offsets for third corner of simplex in (i,j,k) coords + if (x0 >= y0) { + if (y0 >= z0) { + i1 = 1; + j1 = 0; + k1 = 0; + i2 = 1; + j2 = 1; + k2 = 0; + } // X Y Z order + else if (x0 >= z0) { + i1 = 1; + j1 = 0; + k1 = 0; + i2 = 1; + j2 = 0; + k2 = 1; + } // X Z Y order + else { + i1 = 0; + j1 = 0; + k1 = 1; + i2 = 1; + j2 = 0; + k2 = 1; + } // Z X Y order + } else { // x0 0) { + t0 *= t0; + int gi0 = perm[ii + perm[jj + perm[kk]]] % 12; + n0 = t0 * t0 * dot(grad3[gi0], x0, y0, z0); + } + double t1 = 0.6 - x1 * x1 - y1 * y1 - z1 * z1; + if (t1 > 0) { + t1 *= t1; + int gi1 = perm[ii + i1 + perm[jj + j1 + perm[kk + k1]]] % 12; + n1 = t1 * t1 * dot(grad3[gi1], x1, y1, z1); + } + double t2 = 0.6 - x2 * x2 - y2 * y2 - z2 * z2; + if (t2 > 0) { + t2 *= t2; + int gi2 = perm[ii + i2 + perm[jj + j2 + perm[kk + k2]]] % 12; + n2 = t2 * t2 * dot(grad3[gi2], x2, y2, z2); + } + double t3 = 0.6 - x3 * x3 - y3 * y3 - z3 * z3; + if (t3 > 0) { + t3 *= t3; + int gi3 = perm[ii + 1 + perm[jj + 1 + perm[kk + 1]]] % 12; + n3 = t3 * t3 * dot(grad3[gi3], x3, y3, z3); + } + // Add contributions from each corner to get the final noise value. + // The result is scaled to stay just inside [-1,1] + return 32.0 * (n0 + n1 + n2 + n3); + } + + /** + * Computes 4D Simplex Noise. + * + * @param x coordinate + * @param y coordinate + * @param z coordinate + * @param w coordinate + * @return noise value in range -1 ... +1 + */ + public static double noise(double x, double y, double z, double w) { + // The skewing and unskewing factors are hairy again for the 4D case + double n0 = 0, n1 = 0, n2 = 0, n3 = 0, n4 = 0; // Noise contributions + // from the five corners + // Skew the (x,y,z,w) space to determine which cell of 24 simplices + double s = (x + y + z + w) * F4; // Factor for 4D skewing + int i = fastfloor(x + s); + int j = fastfloor(y + s); + int k = fastfloor(z + s); + int l = fastfloor(w + s); + double t = (i + j + k + l) * G4; // Factor for 4D unskewing + double x0 = x - (i - t); // The x,y,z,w distances from the cell origin + double y0 = y - (j - t); + double z0 = z - (k - t); + double w0 = w - (l - t); + // For the 4D case, the simplex is a 4D shape I won't even try to + // describe. + // To find out which of the 24 possible simplices we're in, we need to + // determine the magnitude ordering of x0, y0, z0 and w0. + // The method below is a good way of finding the ordering of x,y,z,w and + // then find the correct traversal order for the simplex were in. + // First, six pair-wise comparisons are performed between each possible + // pair of the four coordinates, and the results are used to add up + // binary bits for an integer index. + int c = 0; + if (x0 > y0) { + c = 0x20; + } + if (x0 > z0) { + c |= 0x10; + } + if (y0 > z0) { + c |= 0x08; + } + if (x0 > w0) { + c |= 0x04; + } + if (y0 > w0) { + c |= 0x02; + } + if (z0 > w0) { + c |= 0x01; + } + int i1, j1, k1, l1; // The integer offsets for the second simplex corner + int i2, j2, k2, l2; // The integer offsets for the third simplex corner + int i3, j3, k3, l3; // The integer offsets for the fourth simplex corner + // simplex[c] is a 4-vector with the numbers 0, 1, 2 and 3 in some + // order. Many values of c will never occur, since e.g. x>y>z>w makes + // x= 3 ? 1 : 0; + j1 = sc[1] >= 3 ? 1 : 0; + k1 = sc[2] >= 3 ? 1 : 0; + l1 = sc[3] >= 3 ? 1 : 0; + // The number 2 in the "simplex" array is at the second largest + // coordinate. + i2 = sc[0] >= 2 ? 1 : 0; + j2 = sc[1] >= 2 ? 1 : 0; + k2 = sc[2] >= 2 ? 1 : 0; + l2 = sc[3] >= 2 ? 1 : 0; + // The number 1 in the "simplex" array is at the second smallest + // coordinate. + i3 = sc[0] >= 1 ? 1 : 0; + j3 = sc[1] >= 1 ? 1 : 0; + k3 = sc[2] >= 1 ? 1 : 0; + l3 = sc[3] >= 1 ? 1 : 0; + // The fifth corner has all coordinate offsets = 1, so no need to look + // that up. + double x1 = x0 - i1 + G4; // Offsets for second corner in (x,y,z,w) + double y1 = y0 - j1 + G4; + double z1 = z0 - k1 + G4; + double w1 = w0 - l1 + G4; + + double x2 = x0 - i2 + G42; // Offsets for third corner in (x,y,z,w) + double y2 = y0 - j2 + G42; + double z2 = z0 - k2 + G42; + double w2 = w0 - l2 + G42; + + double x3 = x0 - i3 + G43; // Offsets for fourth corner in (x,y,z,w) + double y3 = y0 - j3 + G43; + double z3 = z0 - k3 + G43; + double w3 = w0 - l3 + G43; + + double x4 = x0 + G44; // Offsets for last corner in (x,y,z,w) + double y4 = y0 + G44; + double z4 = z0 + G44; + double w4 = w0 + G44; + + // Work out the hashed gradient indices of the five simplex corners + int ii = i & 0xff; + int jj = j & 0xff; + int kk = k & 0xff; + int ll = l & 0xff; + + // Calculate the contribution from the five corners + double t0 = 0.6 - x0 * x0 - y0 * y0 - z0 * z0 - w0 * w0; + if (t0 > 0) { + t0 *= t0; + int gi0 = perm[ii + perm[jj + perm[kk + perm[ll]]]] % 32; + n0 = t0 * t0 * dot(grad4[gi0], x0, y0, z0, w0); + } + double t1 = 0.6 - x1 * x1 - y1 * y1 - z1 * z1 - w1 * w1; + if (t1 > 0) { + t1 *= t1; + int gi1 = perm[ii + i1 + perm[jj + j1 + perm[kk + k1 + perm[ll + l1]]]] % 32; + n1 = t1 * t1 * dot(grad4[gi1], x1, y1, z1, w1); + } + double t2 = 0.6 - x2 * x2 - y2 * y2 - z2 * z2 - w2 * w2; + if (t2 > 0) { + t2 *= t2; + int gi2 = perm[ii + i2 + perm[jj + j2 + perm[kk + k2 + perm[ll + l2]]]] % 32; + n2 = t2 * t2 * dot(grad4[gi2], x2, y2, z2, w2); + } + double t3 = 0.6 - x3 * x3 - y3 * y3 - z3 * z3 - w3 * w3; + if (t3 > 0) { + t3 *= t3; + int gi3 = perm[ii + i3 + perm[jj + j3 + perm[kk + k3 + perm[ll + l3]]]] % 32; + n3 = t3 * t3 * dot(grad4[gi3], x3, y3, z3, w3); + } + double t4 = 0.6 - x4 * x4 - y4 * y4 - z4 * z4 - w4 * w4; + if (t4 > 0) { + t4 *= t4; + int gi4 = perm[ii + 1 + perm[jj + 1 + perm[kk + 1 + perm[ll + 1]]]] % 32; + n4 = t4 * t4 * dot(grad4[gi4], x4, y4, z4, w4); + } + // Sum up and scale the result to cover the range [-1,1] + return 27.0 * (n0 + n1 + n2 + n3 + n4); + } +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utils/Teleporter.java b/src/main/java/com/brandon3055/draconicevolution/common/utils/Teleporter.java new file mode 100644 index 00000000..186a63cc --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/common/utils/Teleporter.java @@ -0,0 +1,319 @@ +package com.brandon3055.draconicevolution.common.utils; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.play.server.S07PacketRespawn; +import net.minecraft.network.play.server.S1DPacketEntityEffect; +import net.minecraft.network.play.server.S1FPacketSetExperience; +import net.minecraft.potion.PotionEffect; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; + +import com.brandon3055.draconicevolution.DraconicEvolution; + +import cpw.mods.fml.common.FMLCommonHandler; + +public class Teleporter { + + public static class TeleportLocation { + + protected double xCoord; + protected double yCoord; + protected double zCoord; + protected int dimension; + protected float pitch; + protected float yaw; + protected String name; + protected String dimentionName = ""; + protected boolean writeProtected = false; + + public TeleportLocation() {} + + public TeleportLocation(double x, double y, double z, int dimension) { + this.xCoord = x; + this.yCoord = y; + this.zCoord = z; + this.dimension = dimension; + this.pitch = 0; + this.yaw = 0; + } + + public TeleportLocation(double x, double y, double z, int dimension, float pitch, float yaw) { + this.xCoord = x; + this.yCoord = y; + this.zCoord = z; + this.dimension = dimension; + this.pitch = pitch; + this.yaw = yaw; + } + + public TeleportLocation(double x, double y, double z, int dimension, float pitch, float yaw, String name) { + this.xCoord = x; + this.yCoord = y; + this.zCoord = z; + this.dimension = dimension; + this.pitch = pitch; + this.yaw = yaw; + this.name = name; + } + + public double getXCoord() { + return xCoord; + } + + public double getYCoord() { + return yCoord; + } + + public double getZCoord() { + return zCoord; + } + + public int getDimension() { + return dimension; + } + + public String getDimensionName() { + return dimentionName; + } + + public float getPitch() { + return pitch; + } + + public float getYaw() { + return yaw; + } + + public String getName() { + return name; + } + + public boolean getWriteProtected() { + return writeProtected; + } + + public void setXCoord(double x) { + xCoord = x; + } + + public void setYCoord(double y) { + yCoord = y; + } + + public void setZCoord(double z) { + zCoord = z; + } + + public void setDimension(int d) { + dimension = d; + } + + public void setPitch(float p) { + pitch = p; + } + + public void setYaw(float y) { + yaw = y; + } + + public void setName(String s) { + name = s; + } + + public void setWriteProtected(boolean b) { + writeProtected = b; + } + + public void writeToNBT(NBTTagCompound compound) { + compound.setDouble("X", xCoord); + compound.setDouble("Y", yCoord); + compound.setDouble("Z", zCoord); + compound.setInteger("Dimension", dimension); + compound.setFloat("Pitch", pitch); + compound.setFloat("Yaw", yaw); + compound.setString("Name", name); + compound.setString("DimentionName", dimentionName); + compound.setBoolean("WP", writeProtected); + } + + public void readFromNBT(NBTTagCompound compound) { + xCoord = compound.getDouble("X"); + yCoord = compound.getDouble("Y"); + zCoord = compound.getDouble("Z"); + dimension = compound.getInteger("Dimension"); + pitch = compound.getFloat("Pitch"); + yaw = compound.getFloat("Yaw"); + name = compound.getString("Name"); + dimentionName = compound.getString("DimentionName"); + writeProtected = compound.getBoolean("WP"); + } + + public void sendEntityToCoords(Entity entity) { + entity.worldObj.playSoundEffect( + entity.posX, + entity.posY, + entity.posZ, + "draconicevolution:portal", + 0.1F, + entity.worldObj.rand.nextFloat() * 0.1F + 0.9F); + + teleportEntity(entity, this); + + entity.worldObj.playSoundEffect( + entity.posX, + entity.posY, + entity.posZ, + "draconicevolution:portal", + 0.1F, + entity.worldObj.rand.nextFloat() * 0.1F + 0.9F); + } + + public void setDimentionName(String dimentionName) { + this.dimentionName = dimentionName; + } + } + + @SuppressWarnings("unchecked") + private static Entity teleportEntity(Entity entity, TeleportLocation destination) { + if (entity == null || entity.worldObj.isRemote) return entity; + + World startWorld = entity.worldObj; + World destinationWorld = DraconicEvolution.proxy.getMCServer().worldServerForDimension(destination.dimension); + + if (destinationWorld == null) { + LogHelper.error("Destination world does not exist!"); + return entity; + } + + Entity mount = entity.ridingEntity; + if (entity.ridingEntity != null) { + entity.mountEntity(null); + mount = teleportEntity(mount, destination); + } + + boolean interDimensional = startWorld.provider.dimensionId != destinationWorld.provider.dimensionId; + + startWorld.updateEntityWithOptionalForce(entity, false); // added + + if ((entity instanceof EntityPlayerMP) && interDimensional) { + EntityPlayerMP player = (EntityPlayerMP) entity; + player.closeScreen(); // added + player.dimension = destination.dimension; + player.playerNetServerHandler.sendPacket( + new S07PacketRespawn( + player.dimension, + player.worldObj.difficultySetting, + destinationWorld.getWorldInfo().getTerrainType(), + player.theItemInWorldManager.getGameType())); + ((WorldServer) startWorld).getPlayerManager().removePlayer(player); + + startWorld.playerEntities.remove(player); + startWorld.updateAllPlayersSleepingFlag(); + int i = entity.chunkCoordX; + int j = entity.chunkCoordZ; + if ((entity.addedToChunk) && (startWorld.getChunkProvider().chunkExists(i, j))) { + startWorld.getChunkFromChunkCoords(i, j).removeEntity(entity); + startWorld.getChunkFromChunkCoords(i, j).isModified = true; + } + startWorld.loadedEntityList.remove(entity); + startWorld.onEntityRemoved(entity); + } + + entity.setLocationAndAngles( + destination.xCoord, + destination.yCoord, + destination.zCoord, + destination.yaw, + destination.pitch); + + ((WorldServer) destinationWorld).theChunkProviderServer + .loadChunk((int) destination.xCoord >> 4, (int) destination.zCoord >> 4); + + destinationWorld.theProfiler.startSection("placing"); + if (interDimensional) { + if (!(entity instanceof EntityPlayer)) { + NBTTagCompound entityNBT = new NBTTagCompound(); + entity.isDead = false; + entityNBT.setString("id", EntityList.getEntityString(entity)); + entity.writeToNBT(entityNBT); + entity.isDead = true; + entity = EntityList.createEntityFromNBT(entityNBT, destinationWorld); + if (entity == null) { + LogHelper.error("Failed to teleport entity to new location"); + return null; + } + entity.dimension = destinationWorld.provider.dimensionId; + } + destinationWorld.spawnEntityInWorld(entity); + entity.setWorld(destinationWorld); + } + entity.setLocationAndAngles( + destination.xCoord, + destination.yCoord, + destination.zCoord, + destination.yaw, + entity.rotationPitch); + + destinationWorld.updateEntityWithOptionalForce(entity, false); + entity.setLocationAndAngles( + destination.xCoord, + destination.yCoord, + destination.zCoord, + destination.yaw, + entity.rotationPitch); + + if ((entity instanceof EntityPlayerMP)) { + EntityPlayerMP player = (EntityPlayerMP) entity; + if (interDimensional) { + player.mcServer.getConfigurationManager().func_72375_a(player, (WorldServer) destinationWorld); + } + player.playerNetServerHandler.setPlayerLocation( + destination.xCoord, + destination.yCoord, + destination.zCoord, + player.rotationYaw, + player.rotationPitch); + } + + destinationWorld.updateEntityWithOptionalForce(entity, false); + + if (((entity instanceof EntityPlayerMP)) && interDimensional) { + EntityPlayerMP player = (EntityPlayerMP) entity; + player.theItemInWorldManager.setWorld((WorldServer) destinationWorld); + player.mcServer.getConfigurationManager() + .updateTimeAndWeatherForPlayer(player, (WorldServer) destinationWorld); + player.mcServer.getConfigurationManager().syncPlayerInventory(player); + + for (PotionEffect potionEffect : (Iterable) player.getActivePotionEffects()) { + player.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(player.getEntityId(), potionEffect)); + } + + player.playerNetServerHandler.sendPacket( + new S1FPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel)); + FMLCommonHandler.instance().firePlayerChangedDimensionEvent( + player, + startWorld.provider.dimensionId, + destinationWorld.provider.dimensionId); + } + entity.setLocationAndAngles( + destination.xCoord, + destination.yCoord, + destination.zCoord, + destination.yaw, + entity.rotationPitch); + + if (mount != null) { + entity.mountEntity(mount); + if ((entity instanceof EntityPlayerMP)) { + destinationWorld.updateEntityWithOptionalForce(entity, true); + } + } + destinationWorld.theProfiler.endSection(); + entity.fallDistance = 0; + return entity; + } +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utils/Utils.java b/src/main/java/com/brandon3055/draconicevolution/common/utils/Utils.java new file mode 100644 index 00000000..a7c223ce --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/common/utils/Utils.java @@ -0,0 +1,145 @@ +package com.brandon3055.draconicevolution.common.utils; + +import net.minecraft.command.IEntitySelector; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.registry.GameData; + +/** + * Created by Brandon on 25/07/2014. + */ +@SuppressWarnings("unused") +public class Utils { + + public static IEntitySelector selectLivingBase = entity -> entity instanceof EntityLivingBase; + + public static IEntitySelector selectPlayer = entity -> entity instanceof EntityPlayer; + + /** + * Calculates the exact distance between two points in 3D space + * + * @param x1 point A x + * @param y1 point A y + * @param z1 point A z + * @param x2 point B x + * @param y2 point B y + * @param z2 point B z + * @return The distance between point A and point B + */ + public static double getDistanceAtoB(double x1, double y1, double z1, double x2, double y2, double z2) { + double dx = x1 - x2; + double dy = y1 - y2; + double dz = z1 - z2; + return Math.sqrt((dx * dx + dy * dy + dz * dz)); + } + + /** + * Calculates the exact distance between two points in 2D space + * + * @param x1 point A x + * @param z1 point A z + * @param x2 point B x + * @param z2 point B z + * @return The distance between point A and point B + */ + public static double getDistanceAtoB(double x1, double z1, double x2, double z2) { + double dx = x1 - x2; + double dz = z1 - z2; + return Math.sqrt((dx * dx + dz * dz)); + } + + public static double getDistanceSq(double x1, double y1, double z1, double x2, double y2, double z2) { + double dx = x1 - x2; + double dy = y1 - y2; + double dz = z1 - z2; + return dx * dx + dy * dy + dz * dz; + } + + public static double getDistanceSq(double x1, double z1, double x2, double z2) { + double dx = x1 - x2; + double dz = z1 - z2; + return dx * dx + dz * dz; + } + + /** + * Returns true if this is a client connected to a remote server. + */ + public static boolean isConnectedToDedicatedServer() { + return FMLCommonHandler.instance().getMinecraftServerInstance() == null; + } + + /** + * Get itemstack from name of item or block name. + */ + public static ItemStack getStackFromName(String name, int meta) { + if (name.contains("tile.")) { + name = name.replace("draconicevolution", "DraconicEvolution").replace("tile.", ""); + if (GameData.getBlockRegistry().getObject(name) != null) + return new ItemStack(GameData.getBlockRegistry().getObject(name), 1, meta); + } + if (name.contains("item.")) { + name = name.replace("draconicevolution", "DraconicEvolution").replace("item.", ""); + if (GameData.getItemRegistry().getObject(name) != null) + return new ItemStack(GameData.getItemRegistry().getObject(name), 1, meta); + } + return null; + } + + public static double round(double number, double multiplier) { + return Math.round(number * multiplier) / multiplier; + } + + /** + * Update the blocks an all 6 sides of a block. + */ + public static void updateNeabourBlocks(World world, int x, int y, int z) { + world.notifyBlocksOfNeighborChange(x, y, z, world.getBlock(x, y, z)); + world.notifyBlocksOfNeighborChange(x - 1, y, z, world.getBlock(x, y, z)); + world.notifyBlocksOfNeighborChange(x + 1, y, z, world.getBlock(x, y, z)); + world.notifyBlocksOfNeighborChange(x, y - 1, z, world.getBlock(x, y, z)); + world.notifyBlocksOfNeighborChange(x, y + 1, z, world.getBlock(x, y, z)); + world.notifyBlocksOfNeighborChange(x, y, z - 1, world.getBlock(x, y, z)); + world.notifyBlocksOfNeighborChange(x, y, z + 1, world.getBlock(x, y, z)); + } + + /** + * Determine the orientation of a block based on the position of the entity that placed it. + */ + public static int determineOrientation(int x, int y, int z, EntityLivingBase entity) { + if (MathHelper.abs((float) entity.posX - (float) x) < 2.0F + && MathHelper.abs((float) entity.posZ - (float) z) < 2.0F) { + double d0 = entity.posY + 1.82D - (double) entity.yOffset; + + if (d0 - (double) y > 2.0D) return 0; + + if ((double) y - d0 > 0.0D) return 1; + } + + int l = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + return l == 0 ? 3 : (l == 1 ? 4 : (l == 2 ? 2 : (l == 3 ? 5 : 0))); + } + + public static int getNearestMultiple(int number, int multiple) { + int result = number; + + if (number < 0) result *= -1; + + if (result % multiple == 0) return number; + else if (result % multiple < multiple / 2) result = result - result % multiple; + else result = result + (multiple - result % multiple); + + if (number < 0) result *= -1; + + return result; + } + + /** Simple method to convert a Double object to a primitive int */ + public static int toInt(double d) { + return (int) d; + } +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utils/handlers/FileHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/utils/handlers/FileHandler.java new file mode 100644 index 00000000..00eca7bd --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/common/utils/handlers/FileHandler.java @@ -0,0 +1,19 @@ +package com.brandon3055.draconicevolution.common.utils.handlers; + +import java.io.File; + +import cpw.mods.fml.common.event.FMLPreInitializationEvent; + +/** + * Created by Brandon on 7/6/2015. + */ +public class FileHandler { + + public static File configFolder; + public static File mcDirectory; + + public static void init(FMLPreInitializationEvent event) { + configFolder = event.getModConfigurationDirectory(); + mcDirectory = configFolder.getParentFile(); + } +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utils/handlers/IProcess.java b/src/main/java/com/brandon3055/draconicevolution/common/utils/handlers/IProcess.java new file mode 100644 index 00000000..a58c5cf4 --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/common/utils/handlers/IProcess.java @@ -0,0 +1,11 @@ +package com.brandon3055.draconicevolution.common.utils.handlers; + +/** + * Created by brandon3055 on 12/8/2015. + */ +public interface IProcess { + + void updateProcess(); + + boolean isDead(); +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utils/handlers/ProcessHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/utils/handlers/ProcessHandler.java new file mode 100644 index 00000000..78a6990a --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/common/utils/handlers/ProcessHandler.java @@ -0,0 +1,61 @@ +package com.brandon3055.draconicevolution.common.utils.handlers; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.world.WorldEvent; + +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.TickEvent; + +/** + * This is a class used to run processes that implement IProcess. Processes are similar to tile entities except that + * they are not bound to anything and they are not currently persistent (they will be deleted when the world closes) + * + * Created by brandon3055 on 12/8/2015. + */ +public class ProcessHandler { + + private static List processes = new ArrayList(); + private static List newProcesses = new ArrayList(); + + public static void init() { + FMLCommonHandler.instance().bus().register(new ProcessHandler()); + MinecraftForge.EVENT_BUS.register(new ProcessHandler()); + } + + @SubscribeEvent + @SuppressWarnings("unused") + public void onServerTick(TickEvent.ServerTickEvent event) { + if (event.phase == TickEvent.Phase.START) { + + Iterator i = processes.iterator(); + + while (i.hasNext()) { + IProcess process = i.next(); + if (process.isDead()) i.remove(); + else process.updateProcess(); + } + + if (!newProcesses.isEmpty()) { + processes.addAll(newProcesses); + newProcesses.clear(); + } + } + } + + @SubscribeEvent + @SuppressWarnings("unused") + public void onWorldClose(WorldEvent.Unload event) { + processes.clear(); + newProcesses.clear(); + } + + @SuppressWarnings("unused") + public static void addProcess(IProcess process) { + newProcesses.add(process); + } +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/utils/lib/References.java b/src/main/java/com/brandon3055/draconicevolution/common/utils/lib/References.java new file mode 100644 index 00000000..cdc6c885 --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/common/utils/lib/References.java @@ -0,0 +1,19 @@ +package com.brandon3055.draconicevolution.common.utils.lib; + +/** + * Created by Brandon on 14/5/2015. + */ +public class References { + + // ======================Data Types========================// + public static final byte BYTE_ID = 0; + public static final byte SHORT_ID = 1; + public static final byte INT_ID = 2; + public static final byte LONG_ID = 3; + public static final byte FLOAT_ID = 4; + public static final byte DOUBLE_ID = 5; + public static final byte BOOLEAN_ID = 6; + public static final byte CHAR_ID = 7; + public static final byte STRING_ID = 8; + public static final byte INT_PAIR_ID = 9; +} 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 757d61e5..02deb630 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/world/ChaosWorldGenHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/world/ChaosWorldGenHandler.java @@ -7,15 +7,15 @@ 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; -import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.common.ModBlocks; 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 com.brandon3055.draconicevolution.common.utils.DataUtils; +import com.brandon3055.draconicevolution.common.utils.SimplexNoise; +import com.brandon3055.draconicevolution.common.utils.Utils; +import com.brandon3055.draconicevolution.common.utils.handlers.IProcess; /** * Created by brandon3055 on 9/9/2015. @@ -32,8 +32,8 @@ public class ChaosWorldGenHandler { * grid. */ public static void generateChunk(World world, int chunkX, int chunkZ, - DataUtills.XZPair islandCenter, Random random) { - DataUtills.XZPair closestSpawn = islandCenter == null ? getClosestChaosSpawn(chunkX, chunkZ) + DataUtils.XZPair islandCenter, Random random) { + DataUtils.XZPair closestSpawn = islandCenter == null ? getClosestChaosSpawn(chunkX, chunkZ) : islandCenter; if (closestSpawn.x == 0 && closestSpawn.z == 0) return; @@ -48,8 +48,6 @@ public class ChaosWorldGenHandler { && closestSpawn.z <= posZ + 16) generateStructures(world, closestSpawn, random); - // long l = System.nanoTime(); - for (int trueX = posX; trueX < posX + 16; trueX++) { for (int y = 0; y < 255; y++) { for (int trueZ = posZ; trueZ < posZ + 16; trueZ++) { @@ -96,20 +94,12 @@ public class ChaosWorldGenHandler { y + 64, 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) == - // Blocks.air) { - // 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, DataUtils.XZPair islandCenter, Random random) { int outerRadius = 330; // Gen Chaos Cavern @@ -144,9 +134,8 @@ public class ChaosWorldGenHandler { int spacing = 8; for (int x = islandCenter.x - outerRadius; x <= islandCenter.x + outerRadius; x++) { for (int z = islandCenter.z - outerRadius; z <= islandCenter.z + outerRadius; z++) { - int dist = (int) (Utills.getDistanceAtoB(x, z, islandCenter.x, islandCenter.z)); + int dist = (int) (Utils.getDistanceAtoB(x, z, islandCenter.x, islandCenter.z)); for (int i = 0; i < rings; i++) { - // if (dist < outerRadius1 && dist >= innerRadius1 || dist < outerRadius2 && dist >= innerRadius2) if (dist < (outerRadius - ((width + spacing) * i)) && dist >= (outerRadius - width - ((width + spacing) * i))) { int y = 90 + (int) ((double) (islandCenter.x - x) * 0.1D) + (random.nextInt(10) - 5); @@ -163,17 +152,17 @@ public class ChaosWorldGenHandler { 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); + double dist = Utils.getDistanceAtoB(x, yi, z, xi, yc, zi); double oRad = coreRadious - (Math.abs(yc - yi) * Math.abs(yc - yi)) / 10; if (dist > oRad - 3D && rand.nextDouble() * 3D < dist - (oRad - 3D)) continue; - if (fillIn && (int) (Utills.getDistanceAtoB(x, z, xi, zi)) <= ringRadius) { + if (fillIn && (int) (Utils.getDistanceAtoB(x, z, xi, zi)) <= ringRadius) { if ((int) dist < 9) world.setBlock(x, yi, z, ModBlocks.infusedObsidian); else world.setBlock(x, yi, z, Blocks.obsidian); - } else if (!fillIn && (int) (Utills.getDistanceAtoB(x, z, xi, zi)) >= ringRadius) { + } else if (!fillIn && (int) (Utils.getDistanceAtoB(x, z, xi, zi)) >= ringRadius) { world.setBlock(x, yi, z, Blocks.obsidian); - } else if (!fillIn && (int) Utills.getDistanceAtoB(x, z, xi, zi) <= ringRadius) { + } else if (!fillIn && (int) Utils.getDistanceAtoB(x, z, xi, zi) <= ringRadius) { Block b = world.getBlock(x, yi, z); if (b == Blocks.air || b == Blocks.end_stone || b == Blocks.obsidian) world.setBlock(x, yi, z, ModBlocks.chaosShardAtmos); @@ -182,13 +171,13 @@ public class ChaosWorldGenHandler { } } - public static DataUtills.XZPair getClosestChaosSpawn(int chunkX, int chunkZ) { - return new DataUtills.XZPair( - Utills.getNearestMultiple(chunkX * 16, ConfigHandler.chaosIslandSeparation), - Utills.getNearestMultiple(chunkZ * 16, ConfigHandler.chaosIslandSeparation)); + public static DataUtils.XZPair getClosestChaosSpawn(int chunkX, int chunkZ) { + return new DataUtils.XZPair( + Utils.getNearestMultiple(chunkX * 16, ConfigHandler.chaosIslandSeparation), + Utils.getNearestMultiple(chunkZ * 16, ConfigHandler.chaosIslandSeparation)); } - private static void generateObelisks(World world, DataUtills.XZPair islandCenter, Random rand) { + private static void generateObelisks(World world, DataUtils.XZPair islandCenter, Random rand) { for (int i = 0; i < 7; i++) { double rotation = i * 0.9D; @@ -238,7 +227,7 @@ public class ChaosWorldGenHandler { 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 (Utils.getDistanceAtoB(x, z, x1, z1) <= r) { if (pct > rand.nextDouble()) 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 8a6e9d65..55bc8553 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenEnderIsland.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenEnderIsland.java @@ -20,7 +20,7 @@ public class WorldGenEnderIsland extends WorldGenerator { private int spawnZ; private int size; - private void initialize(Random rand, int x, int y, int z) { + private void initialize(int x, int y, int z) { spawnX = x; spawnY = y; spawnZ = z; @@ -29,14 +29,12 @@ public class WorldGenEnderIsland extends WorldGenerator { @Override public boolean generate(World world, Random random, int x, int y, int z) { - // 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; } } - initialize(random, x, y, z); + initialize(x, y, z); generateCentre(world, random); generateBelt(world, random, size + 50, size + 200); generateObelisks(world, random); @@ -49,7 +47,7 @@ public class WorldGenEnderIsland extends WorldGenerator { private void generateCentre(World world, Random rand) { int centreThikness = 10; // multiplied by 2 and + 1 int curve = 2; - int diffStart = 20; // (int)((double)size * 0.1D); + int diffStart = 20; int r = size; int offPoint = size * curve; diff --git a/src/main/java/com/brandon3055/draconicevolution/integration/ModHelper.java b/src/main/java/com/brandon3055/draconicevolution/integration/ModHelper.java index 8f26a296..ab5613f6 100644 --- a/src/main/java/com/brandon3055/draconicevolution/integration/ModHelper.java +++ b/src/main/java/com/brandon3055/draconicevolution/integration/ModHelper.java @@ -7,7 +7,7 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.event.entity.living.LivingAttackEvent; import com.brandon3055.draconicevolution.common.items.armor.CustomArmorHandler.ArmorSummery; -import com.brandon3055.draconicevolution.common.utills.LogHelper; +import com.brandon3055.draconicevolution.common.utils.LogHelper; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Optional; 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 fbe25143..10e6ac14 100644 --- a/src/main/java/com/brandon3055/draconicevolution/integration/nei/CraftingChestOverlayHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/integration/nei/CraftingChestOverlayHandler.java @@ -13,7 +13,7 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest; -import com.brandon3055.draconicevolution.common.utills.LogHelper; +import com.brandon3055.draconicevolution.common.utils.LogHelper; import codechicken.lib.inventory.InventoryUtils; import codechicken.nei.FastTransferManager; 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 95a50114..8c858b97 100644 --- a/src/main/java/com/brandon3055/draconicevolution/integration/nei/CraftingChestStackPositioner.java +++ b/src/main/java/com/brandon3055/draconicevolution/integration/nei/CraftingChestStackPositioner.java @@ -5,7 +5,7 @@ import java.util.ArrayList; import net.minecraft.client.Minecraft; import com.brandon3055.draconicevolution.client.gui.GUIDraconiumChest; -import com.brandon3055.draconicevolution.common.utills.LogHelper; +import com.brandon3055.draconicevolution.common.utils.LogHelper; import codechicken.nei.PositionedStack; import codechicken.nei.api.IStackPositioner; 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 471e6431..f986eaeb 100644 --- a/src/main/java/com/brandon3055/draconicevolution/integration/nei/NEIDraconicevolutionConfig.java +++ b/src/main/java/com/brandon3055/draconicevolution/integration/nei/NEIDraconicevolutionConfig.java @@ -6,7 +6,7 @@ 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 com.brandon3055.draconicevolution.common.utils.LogHelper; import codechicken.nei.api.API; import codechicken.nei.api.IConfigureNEI; diff --git a/src/main/resources/assets/brandonscore/textures/gui/Widgets.png b/src/main/resources/assets/brandonscore/textures/gui/Widgets.png new file mode 100644 index 0000000000000000000000000000000000000000..1ecd02f5d75ba5c412f98a1095685719425ec9f7 GIT binary patch literal 8916 zcmcI~cT^MWxAp`=h}58np$G{eMS2rZfe=920Rbseq)3sXROuxF0xB(t2uLr|n+>TF z4oZkZ`_^6e@0+zIGb{6E=6&}(d+%pId!Fg(s?*c3(EtEIuc@JG z000p15CXtq;LgIc$N}8J?rW>7f_w0@uTqZ#cjw$SOuYbr_QKf)0aDYE;E&XgHFeae z$7wIY_^v+FdME+_C_qzH+0gITa)wn5M_a}?$>`pw!VT@OIGZ^%{)L=e!u>J3P}uo3 z)sF9fQy;WUsNgw7;i8D1M8^tVNp3;yHl>7?3--^n`;(r7r#uQf%E3mSa#X_hdayK2~~l+u0hK#R_5>0TaGer7=6rBCz=7s z4@_@{%z(QLJk~gd!xP5pW|NhYcfGE^orhQCVv|qj9p~Q{_o!Xe8mqngxT4xmm>@t$ zxShcJz2;)q$49@DwoWLi873zF4!7O?6l=hXI$>@;Ir`9|^q5#a>cKWhp1h5Y;}lUp z>NnXC?$ip)Xx0|ADUV2e=hw{|R-%lulVJ^=iC@eORW1PbT9Z464`ap1Z9=`Jw{+^@ z7!p=m`rmOr;=g&mo~bC_y$hF0W8*)KlDF%3?6lfN!N@(pvgLM~%m z?x{j5V2DUG4}j%yua0e!ZKRtBA1lg!yv&u&ujMWS_+B2oIbKOwGnviE14xQ$Ejm+# zGmIyjU1+~}EV)((xPMq&#`&=Njow)Ih6GJ@?#^VXF4CEGnJD@Q%*w&bhS(;O}Roo^qYG4EX_d9(717JM5KFoSlMm~b^ z^P8tE{n9gH;bm<0%jB7ih8sphA(kQYDq;RBq`=Ra29AtD_^jjg&Qa3o=D|5!KD_DT zjzx|b-DfjO(0I+b0)WsuE$SC?=@)MEIrn*im}K%yw96{TW?on`AV+j7S4%C3PzGn( zn!>&6D~PQhjT~ZYMXKt5v4ZDpj8o05M(&JiG(Ff|d7D5s!oDr5su;tl896x|rHHZS zr{f7@r@e(-lRBmjGpGH@jZncWi3UIFeOEH~37FEs<_AiLra>ED`KzTVTEw%>sk5s@9ZvVVm4oso zaw$lG2-8>TH+(CGiiYWruja4Sj~~Zb{d$^UZ|cM}eyMSd%7PRUtjvQ7-QeZIhJWUW-iZpzlzWwWDqv!PLq|6NZ=~m$Afn-?n-E$ zw=<1QlXas26i@eilW7Q7C?|de%lEDX#yDS{m^y&PzkDXO)Tp0qa6ce`tu5}d(5%;< zep5MJ04W{!Z53VpWQeWYnASiGL;)pk?=#ohSN^Q*QCA+#gl5F|0wAQCYnbXs)*@FV zx>;PfEJ~Xx$;p9-b%NN;>f=icX0+1TKTx9%Cv2WeqRwYFD>wEyos<(@d0WMD;lhQK zl$1G5s>IcqQO|K+O+=)P=HCO-A|a}xr~E>v>iRMZW-d!(pX$GlT+vL(EOM*;@%{l3 z+!)<@B)>UV1#myU^mG4oM-`~JQo{wSn{NtKqUd`;PTO4iqhjL0vRgwjm*$23lV{EaXBLH1K6C zF%~N+1x`+{-WZfTrAst$yp|SW{Z6u&&8M0a?gpfjH4>m+US863Jg(4LG8s*1N|kW| zmm;pDL}ZtBofx>SRDKy|*a&gA3Cj{2+NNxOS60NbTPm9HGQ4!$Ft&>Qrw6@dYB!(j zNX^^qvIxEtx($Wto)|p)f=iWIv=!|{L!%p=h5ol)KGF0o-*dTbcYmtt8;;c19bg8F z#yhe}9tT^Gh>PQ21KTs$Lx1OdM|`PVs+Wg|_WGuU*LaoCtF(8BFtm7Bur=RnFB-@u z!ot~fjR5!g{wo&sKIMu0b*?1WfSgYL;BbubHP@OU9fZg8(LAE!ui+xGp*+g!YUES8 zBxU--tK=(3@o#@V}Vv&1HgsF3~iEd1!H|>CcDM1T-o zNGUBCyO~^I;>)uOM|{TU)rL)mihK3f;)_-|k64E{D~%~J#{A=_C%e?wOb)Amboq~$ z4g%@5jy56_G%Z-bjC>hI@l#=p{XWHmvFp()fwG%vympB^crUlCas@OO{Tujaz$q0C z?|6CInJl(x&TIFb9y3NUf{Lp1&z4}(XU4ct+CI!V!UFot*`qyL{&|b4DsWabr8V94 z=%6}F#Z?4Pj&~JL{36UQ$GeyZ;iZbbMK|y1ub#)mtuqQkyT;Zi*DpJqo)dWK3w6Gx z;sfQj`_6-x_I`nZepo4h^wd5u&7?6be8H#LdgV1CCIC8-?w49u@%Frp0Qv?G;K5;i zpIf-c!$#=_1=BkkZs5|a&=s4QmhQAi(rh!F_~nnckR7=U+1|#l;e>dmYk)E!FvE5W zh>Z+Oq&WHR?h-03)3WH#3tWpw*?qqQ*y=Iw@ui^?X|fYl-?Jw1LF`|JR^f+Sxges{ ze0I}3_#l>SyabEarc>KgwC?ZKp!VB>&rtF0lHs?>(vt!hB+TOcU+vCCki=#R!Rsz9 zeXlN9_c_ndt4!Xt$;}bRNvS2+Ex}dWoy7rzStcO<$(|XzG+T)VeXamLF?SBNZK#Z{Xsn@*|V3waBu7FINqb z^-co?Hx2>p#AimOFI`=9^Z;uX+*&4JjHq}}bi#e3I41gG$-pb}?Cf4CYRVpfO-oSo zJwOc=IeZFpv0w4&+O{hFO&c2j_89=1kuZrOdv64*=#8#@HwmdO@pxPQ_M9obhLv)u zQV3aMQ~)z*dvH3Y)w5*cAaVHer&=fL4{8fcMZK|X|DTV2e0EFR_z=#`Qmf;u_@GV1 z>2?U``>gbkj#`e)VaD~vk1d`|8ryzJ_Ax-a9~<6T)FNNkX{7bSapK`8+$JY5ae`|k zZT;#Zb$cCqlT1yJPn82K$KkauK5YlA5ze3R@oy!7>Wvg#dDj_?(r z&7x;DuS&G%L9~?QkYH0dqvGAbNlM0>dI2XZ^{b)_jNkJw3>MjZ`~J0z(`$Gp3fBX7 zkCI}&L8*6XOzc|kj>2sAG~HDick}e&LD7-%(jhpUwUZ4$)t|4OpZ-G)3OcebvDsK* z7Mtli>NYf!Ih^`yE$~}rwH3{TRXrDd4XKwIA9IgBJM~FDg{h3M@2R$6PGX6X*=}YP z$&waGIqrD4-iT^9k0zb2j#0-G8Ma=$H{9sf{%ibKMBq{{)mksVU70hWt9cw%n?({E zvOUNg{u34KtyKq_Bx`y~ouda)`zka<0W_O5U}Rrenprhx)`##InxVw;6vrmv4rl5bMH8fx)o0qIYnQUnW-Xpqk_zMB%B z0LB!C@Flo(yNemk&iCRw!2@9t&h%J#x)P3aU|=A;h5>u46!s>y#{Ca={D2?yUn(a!pi9R;aC4h2Qo+9&q$^p z(ys&yR90h|qNsG-yPdN3pwR`(0Jw_-26tO=ZId4Pfo;T%zYd?k?r@LieU| zm&ej1ecp5~*S-_H*m~enDWOx#f{(F+e(SY8cjT&^#H{hcfoEL=IKRCQP!6skv70{kYw z@&nn-RCMQYGd84DmF@R+M$eXg(nvItmQ46n3F74&#(|UCVxJ5H8okIpR0@@NyjnF% z0L_G&+oAumAx%+yi{r$5zbYE6u09h$9;A$LulJG+flcTdPYLE*my7s!g?L&(t!<)Z z08#p)7gF)x3I;~ybOwGo@@Xa*;KCi=|Gd+NvJ<8QZ&z4Qpmk%e;b5T@z+b-Mlh}N8 zomd-B9)0Vg{&kZAk8c_o8F}YtdFj`%H&koj!|O8+S{!QLrP}`EJ5Z8&+a*?7M>{Gn z5sQqBxG$5Y^TlIiN@8@=O=;&5(DZDIUn>u$C3rOVM5!aT`^BB$8R3iNG6}r%=Jjir z(D_bLXT-;W2GjZ;Ho^ScUtQ4N>0Q@-g@RT8%N3}(jS!{FcNuyYjak@iK|&JMYa63n zKML|Bco?8nJZT~O1q1;bzT};WZ^t%&Urmm*pgpnevFD^*Yen%ruw>@Hoh~eR+EbiS zOCEHxlGpwN27nr$WiuP-hoPsrMdFqr&lS2Tg{iP2A{xh^$Y7l`arG&I}$M41vK2DbE9+-J+* z%YE?OL{)^x_h~?kdB|gm=5CkEA|zOBkSHA~sB-Oz`~HUg|8TP*v)9GS%-$|^SU`(P zBY{pcH^)$qgP02}`?U4}l9^0R**9mk)*4!C>{~}kR|uF?2k}bs8J zaTvP>0q}_?l;vvFHp4;*5+C)<(0I9?i$xVYdPZ@Grp-XE*5}7Wl;&3MwD7!&|Hu43 z`16AO_&fvULV(pL0LG>vh)^q$>j5vdbcUp=72Q`xT9ZEuul<=AV0;;aO?7arlJ1u- zeGDy0eoe69I+dgNfpzFyfIPbfziG$c6v;mmEX)&$6 z0O&*pJ}-8Bes`Z-xN_TU1#Xz+<+sYh5fI>&vn7g^+uCxtNpkCa=Woe>Rp*}i{b%A` zr@OWOQdX&B2@yESNEv`E0ny(`X}lAcJNBrdg!BE?!noVyIxnhx~aj@ z#0gJp(5;*NyMCjiDDFllv@P+s$?r9&-8ELda6B#iGDsA=a{T*ItN;xvAD_5iC6k6u z;1!C(XZ1LJ(Z`F^)$pdoWP$bZtTw-B_Fxa{3L+AcIkwLQ0J!bp2hZ(c%JJku|LEm+ zZCf*si8GnIKY1QxSA{P4ja7IcIv4y)t7v6uKvES!!}~w^Rcj?|BCxA=pV`zQ-kxQ1 zvzTo3$mvJf=#a*Mb1%Lky^t{j27r%8yLa!9_K*ua-XBpK>R@fBelfb-9{ZKdH?5CR zT*39GB4Z=3DrBX{q)^1Kmq83)@>javda zgrilY0bs39oog_2BFabfNu}t>tF$yB1+GL6Y&+r(Q2of)$mt&Y>H=R{Nd4+U;KKCH zjWpAn8;c;%1H+31g}c_g*!H&XxrzYK>JZXFfRenEj?-o}xE*cwkNCK1&?B2n%BZ(7u9HYoB+VpRNS%EO_8L zm(Aqo;^x27AuLCP$CsRFOn{)fWV6v;LouGB|g@4d}Wuu>P#FxA*PB8=QSBW>d}NPh0^|wtXf|M+)~fDt@dw93s~@W@yL-|8T7l5)r9Zg0uJ=OXqT#|Q`s}Ke=OA~v ze@4{UZM9l3R;S3JQP{m?qIf}ZHkJRL0}^t0j-w0)K|EbT5akD1Heib0hN32 zs!&$-*Vh3MK{4G2uW2+z3xB9tT@rfzEYGK3A;iZ2T}Au;c$69&)GVV_UBr~`y}i3&*ib?*`~ z)ukRW!;JrkP_3wc=LSqPN6=RB*W9;6MrsUvP=8)&`N=FmQQ+*J1;CIQ$g{-iu7)6> z`B9CCT!A&Ci?vzl!Agp8!8n{}-x=bffRPxII9*PaXcC1`en82lYw8<`0>34aF+VlX z%$s#=BEzDYu+{z#zSip32{u2ZM23;!(mK(cp{_@YaZ~+zRz^L(r#o_)`&I+~$>?*) zS7IkW4@rgVT)*YFt% zLF8LnYCW@UixXLhz2Uo3rm!*%{~b$%ADJ>YofomLrHPNPcLi4LWHJqChRi?_Wimxf z{V`jJp+bW>B>?ahC4*?lg{%p!-MMoo{}`}n8Ta?RG+S*Z0#(*~4KtEA2AqCemht=3 zOM2nPnrUClG$(gbTU*O{wzeU_Vr=!B8IR6DvsZm8$WdFS9Ns^Ziwiv1uO~k_9bkad zE}gDF>n{p5pm}n-A_HZ0-|Eep69QrLg$;ja2{dKw^^vONN#xuUDf(dIX=w2Do#ms_jm zk7fdd@G7{sLdjFzBGxpR_Ir|m>&Gmm#on2dWgm7A4jy<|e;1~(MzJy7xYS7XJoQQE zRP~jAuKwS0ik@Y;Os>Gy=3tV?lgf4@*x6YQUVvBAfa7T{{EXlT?(SBfbGw$-GKoT~ z3VI{YLX+8g94iN8FBYdR5&s`E9Hl`T8uP(E~tw z;NipNbNh~XH6%=9fKFMDflbt^(c(W4_Vr$cP5^_=uswILx+ZzjV0PW{a{GRdwQ- z+e0UMKRZcdUl-3$&$-vKE>VVm52{RlW%#_ z*7y2Eo^l(VJvCLz_yX4q#q26&=Gx_kZxR5D{`dM=lLWi`?IRE>vtB3BTNog#=Sn+8 z6C7kTKIQ+c7Vp*Qv=FeTO~@f6j@}GD(^Te%nc9;#lhtJ@S@!xuy=sNS@3;P4N+dyS zLKXN=UmKsrZJB@c7LT?0CoJ2o$Gs%e*KkGMIP-0C|1)Wd4-_k=7cRkg+dXad`N662 zQX-(ElOy+^TpC)^!lEoSUJ#P@zBM>SeGPONZ1G#0gjC-`p>i7sz0+c63G64Dd|Kb*-7!YGYi`^QI2&$G6x)O(@kk5cYT`{b9x6CS(TIqA@`Ko z%yAlFEzl@%7^Y*yi|k()Is^mBL+eSNfB^P1h=lnm@o&yw<=j&8nYB5!Roc5=hUsHj z`XTiIMZhq(H=YH(GRSmooe1_=JW=C(?EXIUix>JHUB7}x#*pCxB`YXHF>+M~36saf zvYIx>d~)!w#f~;6f7f`)6S)3klM!QNolUEqeW+eCcI)!)r`WKIwK*h~h zCmBI}{Fmn7(nv5s{Ar5A5MpW}NaiFMKAx!zLKmfzc5U=kD{UyF(h)*RN~(c}5K{sH z@Mn^c;>|hc(~$z6K`IO=$TqMO=w5~1CT&)q?hw0sdaQkX3VzrW)!4w##mf0(*Z*n;Y!cjt&ia#0X6X+q=o!kTZ$vWj?@wYx`3tfX~c|H@XiH z5Y@}w$I^I&WHT(gC#~Lgaj1M%6*}YfVW{Q2Ew&v#3XiNq{H0A1Py)Z|(rpm#|pC-+&hi8ox!MGm0i zG@w9-1d?}ewD|1flI+!JCITqsZ2z{wV2wi|dwWyF=-Eu&zcU_GvcN&b7hZdV?gM;| zybfm5$SmEyQIb}%L3y@oBY?K^w^2c0kq`v-F6CYBLfwpoG!|jQng68H*~@4syh{j|rf$E?;(9e-!ig`qY4&|AwlQ9R{w?Oe4<-K1*4k zV%Q298ErNNw$l=Lm#8uA&Ki)T3Pl^_G82P|COZ$;j9SZqpc zeV4$Ll9r}|fIgi{`F8+*MWZS1G7$pkrpsBXQh9Kw2u2KB9@^;Bf;|Cn)FB1p9h)<7 zMxeC%@IpIAU*DA>FS>U=J%{Fb2w3!q#o2<30$YFX8`IDFSOCoYH|?08Jd-9kY1v@VjbQ)1w(9+dx`WyC4WT)-v(;V^^}F^)oD zR~RV0KWQc~6Y~U`Kkbg0|2p~YABcv6U4<}|z!0M$nHGUf;sSw50O=_~27kqKHaDUQ zpSH&j7So(;(073iZ8Xx1F=7BfVRZH`faXM(`2!EfRfjPq?5#lnXsWI59U@Z?H6x?N z>Ea7m!?HPoEE9hWpunp8t5(b8m*-mcAM75zu>jC`o|IF_%jPw8J2_LfcxH| z8xLJ4&Y{-|ETbAc_nzyD;8jiuF+t$V6Q&N?iCej0p1kh8sWpkKg-$R*Cjidse-`|? zvxut`RXySoeciix0{E)4oD8}+^2IQ4BoP9J^PQGzu)Z^Zn29X2QbY2g$&?o)7i9iR zbid7YL_(S`v0*Ydf9J9wBF`UY;V#79ddmCNI!2i} z;tk7~SIZ6M_9Aw?m1PjSNrlBc@?X9EIz`o)-d+JgO^ZrS#9>AkLO9xL$WmGJ<4lg8 r31Gmh?R*0omVm&*|Bt^|X-|}vMWFT~P1^NmFQ;g#>8e&>t;7BwSvZgG literal 0 HcmV?d00001