diff --git a/build.properties b/build.properties index d2ba7e27e..0c7265eeb 100644 --- a/build.properties +++ b/build.properties @@ -2,7 +2,7 @@ #Sat Mar 12 17:00:04 CST 2016 version=r1.8 dir_output=../Build Output/Botania/ -forge_version=12.16.0.1797-1.9 +forge_version=12.16.0.1811-1.9 mc_version=1.9 dir_repo=./ build_number=300 diff --git a/src/main/java/vazkii/botania/client/core/handler/DebugHandler.java b/src/main/java/vazkii/botania/client/core/handler/DebugHandler.java index 168e0999a..bf911b667 100644 --- a/src/main/java/vazkii/botania/client/core/handler/DebugHandler.java +++ b/src/main/java/vazkii/botania/client/core/handler/DebugHandler.java @@ -39,40 +39,40 @@ public final class DebugHandler { public void onDrawDebugText(RenderGameOverlayEvent.Text event) { World world = Minecraft.getMinecraft().theWorld; if(Minecraft.getMinecraft().gameSettings.showDebugInfo) { - event.left.add(null); + event.getLeft().add(null); String version = LibMisc.VERSION; if(version.contains("GRADLE")) version = "N/A"; - event.left.add(PREFIX + "pS: " + ParticleRenderDispatcher.sparkleFxCount + ", pFS: " + ParticleRenderDispatcher.fakeSparkleFxCount + ", pW: " + ParticleRenderDispatcher.wispFxCount + ", pDIW: " + ParticleRenderDispatcher.depthIgnoringWispFxCount + ", pLB: " + ParticleRenderDispatcher.lightningCount); - event.left.add(PREFIX + "(CLIENT) netColl: " + ManaNetworkHandler.instance.getAllCollectorsInWorld(world).size() + ", netPool: " + ManaNetworkHandler.instance.getAllPoolsInWorld(world).size() + ", rv: " + version); + event.getLeft().add(PREFIX + "pS: " + ParticleRenderDispatcher.sparkleFxCount + ", pFS: " + ParticleRenderDispatcher.fakeSparkleFxCount + ", pW: " + ParticleRenderDispatcher.wispFxCount + ", pDIW: " + ParticleRenderDispatcher.depthIgnoringWispFxCount + ", pLB: " + ParticleRenderDispatcher.lightningCount); + event.getLeft().add(PREFIX + "(CLIENT) netColl: " + ManaNetworkHandler.instance.getAllCollectorsInWorld(world).size() + ", netPool: " + ManaNetworkHandler.instance.getAllPoolsInWorld(world).size() + ", rv: " + version); if (Minecraft.getMinecraft().isSingleplayer()) { UUID id = Minecraft.getMinecraft().thePlayer.getUniqueID(); Entity ent = Minecraft.getMinecraft().getIntegratedServer().getEntityFromUuid(id); if (ent != null) { World serverWorld = Minecraft.getMinecraft().getIntegratedServer().getEntityFromUuid(id).worldObj; - event.left.add(PREFIX + String.format("(INTEGRATED SERVER DIM %d) netColl : %d, netPool: %d", serverWorld.provider.getDimension(), ManaNetworkHandler.instance.getAllCollectorsInWorld(serverWorld).size(), ManaNetworkHandler.instance.getAllPoolsInWorld(serverWorld).size())); + event.getLeft().add(PREFIX + String.format("(INTEGRATED SERVER DIM %d) netColl : %d, netPool: %d", serverWorld.provider.getDimension(), ManaNetworkHandler.instance.getAllCollectorsInWorld(serverWorld).size(), ManaNetworkHandler.instance.getAllPoolsInWorld(serverWorld).size())); } } if(GuiScreen.isCtrlKeyDown() && GuiScreen.isShiftKeyDown()) { - event.left.add(PREFIX + "Config Context"); - event.left.add(" shaders.enabled: " + ConfigHandler.useShaders); - event.left.add(" shaders.secondaryUnit: " + ConfigHandler.glSecondaryTextureUnit); + event.getLeft().add(PREFIX + "Config Context"); + event.getLeft().add(" shaders.enabled: " + ConfigHandler.useShaders); + event.getLeft().add(" shaders.secondaryUnit: " + ConfigHandler.glSecondaryTextureUnit); ContextCapabilities caps = GLContext.getCapabilities(); - event.left.add(PREFIX + "OpenGL Context"); - event.left.add(" GL_VERSION: " + GL11.glGetString(GL11.GL_VERSION)); - event.left.add(" GL_RENDERER: " + GL11.glGetString(GL11.GL_RENDERER)); - event.left.add(" GL_SHADING_LANGUAGE_VERSION: " + GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION)); - event.left.add(" GL_MAX_TEXTURE_IMAGE_UNITS_ARB: " + GL11.glGetInteger(ARBFragmentShader.GL_MAX_TEXTURE_IMAGE_UNITS_ARB)); - event.left.add(" GL_ARB_multitexture: " + caps.GL_ARB_multitexture); - event.left.add(" GL_ARB_texture_non_power_of_two: " + caps.GL_ARB_texture_non_power_of_two); - event.left.add(" OpenGL13: " + caps.OpenGL13); + event.getLeft().add(PREFIX + "OpenGL Context"); + event.getLeft().add(" GL_VERSION: " + GL11.glGetString(GL11.GL_VERSION)); + event.getLeft().add(" GL_RENDERER: " + GL11.glGetString(GL11.GL_RENDERER)); + event.getLeft().add(" GL_SHADING_LANGUAGE_VERSION: " + GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION)); + event.getLeft().add(" GL_MAX_TEXTURE_IMAGE_UNITS_ARB: " + GL11.glGetInteger(ARBFragmentShader.GL_MAX_TEXTURE_IMAGE_UNITS_ARB)); + event.getLeft().add(" GL_ARB_multitexture: " + caps.GL_ARB_multitexture); + event.getLeft().add(" GL_ARB_texture_non_power_of_two: " + caps.GL_ARB_texture_non_power_of_two); + event.getLeft().add(" OpenGL13: " + caps.OpenGL13); } else if(Minecraft.isRunningOnMac) - event.left.add(PREFIX + "SHIFT+CMD for context"); - else event.left.add(PREFIX + "SHIFT+CTRL for context"); + event.getLeft().add(PREFIX + "SHIFT+CMD for context"); + else event.getLeft().add(PREFIX + "SHIFT+CTRL for context"); } } diff --git a/src/main/java/vazkii/botania/client/core/handler/HUDHandler.java b/src/main/java/vazkii/botania/client/core/handler/HUDHandler.java index 98257d229..53c73042e 100644 --- a/src/main/java/vazkii/botania/client/core/handler/HUDHandler.java +++ b/src/main/java/vazkii/botania/client/core/handler/HUDHandler.java @@ -80,12 +80,12 @@ public final class HUDHandler { Minecraft mc = Minecraft.getMinecraft(); Profiler profiler = mc.mcProfiler; - if(event.type == ElementType.HEALTH) { + if(event.getType() == ElementType.HEALTH) { profiler.startSection("botania-hud"); ItemStack amulet = PlayerHandler.getPlayerBaubles(mc.thePlayer).getStackInSlot(0); if(amulet != null && amulet.getItem() == ModItems.flightTiara) { profiler.startSection("flugelTiara"); - ItemFlightTiara.renderHUD(event.resolution, mc.thePlayer, amulet); + ItemFlightTiara.renderHUD(event.getResolution(), mc.thePlayer, amulet); profiler.endSection(); } profiler.endSection(); @@ -99,7 +99,7 @@ public final class HUDHandler { ItemStack main = mc.thePlayer.getHeldItemMainhand(); ItemStack offhand = mc.thePlayer.getHeldItemOffhand(); - if(event.type == ElementType.ALL) { + if(event.getType() == ElementType.ALL) { profiler.startSection("botania-hud"); RayTraceResult pos = mc.objectMouseOver; @@ -110,61 +110,61 @@ public final class HUDHandler { if(PlayerHelper.hasAnyHeldItem(mc.thePlayer)) { if(pos != null && PlayerHelper.hasHeldItem(mc.thePlayer, ModItems.twigWand)) { - renderWandModeDisplay(PlayerHelper.getFirstHeldItem(mc.thePlayer, ModItems.twigWand), event.resolution); + renderWandModeDisplay(PlayerHelper.getFirstHeldItem(mc.thePlayer, ModItems.twigWand), event.getResolution()); if(block instanceof IWandHUD) { profiler.startSection("wandItem"); - ((IWandHUD) block).renderHUD(mc, event.resolution, mc.theWorld, pos.getBlockPos()); + ((IWandHUD) block).renderHUD(mc, event.getResolution(), mc.theWorld, pos.getBlockPos()); profiler.endSection(); } } else if(block != null && PlayerHelper.hasHeldItemClass(mc.thePlayer, ILexicon.class)) - drawLexiconHUD(PlayerHelper.getFirstHeldItemClass(mc.thePlayer, ILexicon.class), state, pos, event.resolution); + drawLexiconHUD(PlayerHelper.getFirstHeldItemClass(mc.thePlayer, ILexicon.class), state, pos, event.getResolution()); if(tile != null && tile instanceof TilePool && mc.thePlayer.getHeldItemMainhand() != null) - renderPoolRecipeHUD(event.resolution, (TilePool) tile, mc.thePlayer.getHeldItemMainhand()); + renderPoolRecipeHUD(event.getResolution(), (TilePool) tile, mc.thePlayer.getHeldItemMainhand()); } if(tile != null && tile instanceof TileAltar) - ((TileAltar) tile).renderHUD(mc, event.resolution); + ((TileAltar) tile).renderHUD(mc, event.getResolution()); else if(tile != null && tile instanceof TileRuneAltar) - ((TileRuneAltar) tile).renderHUD(mc, event.resolution); + ((TileRuneAltar) tile).renderHUD(mc, event.getResolution()); if(tile != null && tile instanceof TileCorporeaCrystalCube) - renderCrystalCubeHUD(event.resolution, (TileCorporeaCrystalCube) tile); + renderCrystalCubeHUD(event.getResolution(), (TileCorporeaCrystalCube) tile); } if(!TileCorporeaIndex.getInputHandler().getNearbyIndexes(mc.thePlayer).isEmpty() && mc.currentScreen != null && mc.currentScreen instanceof GuiChat) { profiler.startSection("nearIndex"); - renderNearIndexDisplay(event.resolution); + renderNearIndexDisplay(event.getResolution()); profiler.endSection(); } if(MultiblockRenderHandler.currentMultiblock != null && MultiblockRenderHandler.anchor == null) { profiler.startSection("multiblockRightClick"); String s = I18n.translateToLocal("botaniamisc.rightClickToAnchor"); - mc.fontRendererObj.drawStringWithShadow(s, event.resolution.getScaledWidth() / 2 - mc.fontRendererObj.getStringWidth(s) / 2, event.resolution.getScaledHeight() / 2 - 30, 0xFFFFFF); + mc.fontRendererObj.drawStringWithShadow(s, event.getResolution().getScaledWidth() / 2 - mc.fontRendererObj.getStringWidth(s) / 2, event.getResolution().getScaledHeight() / 2 - 30, 0xFFFFFF); profiler.endSection(); } if(main != null && main.getItem() instanceof ItemCraftingHalo) { profiler.startSection("craftingHalo"); - ItemCraftingHalo.renderHUD(event.resolution, mc.thePlayer, main); + ItemCraftingHalo.renderHUD(event.getResolution(), mc.thePlayer, main); profiler.endSection(); } if(main != null && main.getItem() instanceof ItemSextant) { profiler.startSection("sextant"); - ItemSextant.renderHUD(event.resolution, mc.thePlayer, main); + ItemSextant.renderHUD(event.getResolution(), mc.thePlayer, main); profiler.endSection(); } /*if(equippedStack != null && equippedStack.getItem() == ModItems.flugelEye) { profiler.startSection("flugelEye"); - ItemFlugelEye.renderHUD(event.resolution, mc.thePlayer, equippedStack); + ItemFlugelEye.renderHUD(event.getResolution(), mc.thePlayer, equippedStack); profiler.endSection(); }*/ if(Botania.proxy.isClientPlayerWearingMonocle()) { profiler.startSection("monocle"); - ItemMonocle.renderHUD(event.resolution, mc.thePlayer); + ItemMonocle.renderHUD(event.getResolution(), mc.thePlayer); profiler.endSection(); } @@ -206,12 +206,12 @@ public final class HUDHandler { } if(anyRequest) - renderManaInvBar(event.resolution, creative, totalMana, totalMaxMana); + renderManaInvBar(event.getResolution(), creative, totalMana, totalMaxMana); profiler.endStartSection("bossBar"); - BossBarHandler.render(event.resolution); + BossBarHandler.render(event.getResolution()); profiler.endStartSection("itemsRemaining"); - ItemsRemainingRenderHandler.render(event.resolution, event.partialTicks); + ItemsRemainingRenderHandler.render(event.getResolution(), event.getPartialTicks()); profiler.endSection(); profiler.endSection(); diff --git a/src/main/java/vazkii/botania/client/core/handler/LightningHandler.java b/src/main/java/vazkii/botania/client/core/handler/LightningHandler.java index d24ab673f..9294efe3e 100644 --- a/src/main/java/vazkii/botania/client/core/handler/LightningHandler.java +++ b/src/main/java/vazkii/botania/client/core/handler/LightningHandler.java @@ -68,7 +68,7 @@ public class LightningHandler { RedStringRenderer.renderAll(); profiler.endStartSection("lightning"); - float frame = event.partialTicks; + float frame = event.getPartialTicks(); Entity entity = Minecraft.getMinecraft().thePlayer; TextureManager render = Minecraft.getMinecraft().renderEngine; diff --git a/src/main/java/vazkii/botania/client/core/handler/MiscellaneousIcons.java b/src/main/java/vazkii/botania/client/core/handler/MiscellaneousIcons.java index 2ed55b467..76ec1ce5d 100644 --- a/src/main/java/vazkii/botania/client/core/handler/MiscellaneousIcons.java +++ b/src/main/java/vazkii/botania/client/core/handler/MiscellaneousIcons.java @@ -106,59 +106,59 @@ public class MiscellaneousIcons { @SubscribeEvent public void onTextureStitch(TextureStitchEvent.Pre evt) { - alfPortalTex = IconHelper.forName(evt.map, "alfheimPortalInside", "blocks"); - lightRelayWorldIcon = IconHelper.forName(evt.map, "lightRelay1", "blocks"); - lightRelayWorldIconRed = IconHelper.forName(evt.map, "lightRelay3", "blocks"); - alchemyCatalystOverlay = IconHelper.forName(evt.map, "alchemyCatalyst3", "blocks"); - enchanterOverlay = IconHelper.forName(evt.map, "enchanterOverlay", "blocks"); - manaVoidOverlay = IconHelper.forName(evt.map, "manaVoid1", "blocks"); - manaWater = IconHelper.forName(evt.map, "manaWater", "blocks"); - terraPlateOverlay = IconHelper.forName(evt.map, "terraPlateOverlay", "blocks"); - corporeaWorldIcon = IconHelper.forName(evt.map, "corporeaSpark1", "items"); - corporeaWorldIconMaster = IconHelper.forName(evt.map, "corporeaSpark3", "items"); - corporeaIconStar = IconHelper.forName(evt.map, "corporeaSparkStar", "items"); - sparkWorldIcon = IconHelper.forName(evt.map, "spark1", "items"); + alfPortalTex = IconHelper.forName(evt.getMap(), "alfheimPortalInside", "blocks"); + lightRelayWorldIcon = IconHelper.forName(evt.getMap(), "lightRelay1", "blocks"); + lightRelayWorldIconRed = IconHelper.forName(evt.getMap(), "lightRelay3", "blocks"); + alchemyCatalystOverlay = IconHelper.forName(evt.getMap(), "alchemyCatalyst3", "blocks"); + enchanterOverlay = IconHelper.forName(evt.getMap(), "enchanterOverlay", "blocks"); + manaVoidOverlay = IconHelper.forName(evt.getMap(), "manaVoid1", "blocks"); + manaWater = IconHelper.forName(evt.getMap(), "manaWater", "blocks"); + terraPlateOverlay = IconHelper.forName(evt.getMap(), "terraPlateOverlay", "blocks"); + corporeaWorldIcon = IconHelper.forName(evt.getMap(), "corporeaSpark1", "items"); + corporeaWorldIconMaster = IconHelper.forName(evt.getMap(), "corporeaSpark3", "items"); + corporeaIconStar = IconHelper.forName(evt.getMap(), "corporeaSparkStar", "items"); + sparkWorldIcon = IconHelper.forName(evt.getMap(), "spark1", "items"); sparkUpgradeIcons = new TextureAtlasSprite[ItemSparkUpgrade.VARIANTS]; for(int i = 0; i < ItemSparkUpgrade.VARIANTS; i++) { - sparkUpgradeIcons[i] = IconHelper.forName(evt.map, "sparkUpgradeL" + i, "items"); + sparkUpgradeIcons[i] = IconHelper.forName(evt.getMap(), "sparkUpgradeL" + i, "items"); } - tailIcon = IconHelper.forName(evt.map, "tail", "items"); - phiFlowerIcon = IconHelper.forName(evt.map, "phiFlower", "items"); - goldfishIcon = IconHelper.forName(evt.map, "goldfish", "items"); - nerfBatIcon = IconHelper.forName(evt.map, "nerfBat", "items"); + tailIcon = IconHelper.forName(evt.getMap(), "tail", "items"); + phiFlowerIcon = IconHelper.forName(evt.getMap(), "phiFlower", "items"); + goldfishIcon = IconHelper.forName(evt.getMap(), "goldfish", "items"); + nerfBatIcon = IconHelper.forName(evt.getMap(), "nerfBat", "items"); kingKeyWeaponIcons = new TextureAtlasSprite[ItemKingKey.WEAPON_TYPES]; for(int i = 0; i < ItemKingKey.WEAPON_TYPES; i++) - kingKeyWeaponIcons[i] = IconHelper.forName(evt.map, "gateWeapon" + i, "items"); + kingKeyWeaponIcons[i] = IconHelper.forName(evt.getMap(), "gateWeapon" + i, "items"); - manaDetectorIcon = IconHelper.forName(evt.map, "triggers/manaDetector", "items"); - runeAltarTriggerIcon = IconHelper.forName(evt.map, "triggers/runeAltarCanCraft", "items"); + manaDetectorIcon = IconHelper.forName(evt.getMap(), "triggers/manaDetector", "items"); + runeAltarTriggerIcon = IconHelper.forName(evt.getMap(), "triggers/runeAltarCanCraft", "items"); for (TriggerManaLevel.State s : TriggerManaLevel.State.values()) { - manaLevelTriggerIcons.put(s, IconHelper.forName(evt.map, "triggers/mana" + WordUtils.capitalizeFully(s.name()), "items")); + manaLevelTriggerIcons.put(s, IconHelper.forName(evt.getMap(), "triggers/mana" + WordUtils.capitalizeFully(s.name()), "items")); } tiaraWingIcons = new TextureAtlasSprite[ItemFlightTiara.WING_TYPES]; for (int i = 0; i < tiaraWingIcons.length; i++) { - tiaraWingIcons[i] = IconHelper.forName(evt.map, "flightTiara" + (i + 1), "items"); + tiaraWingIcons[i] = IconHelper.forName(evt.getMap(), "flightTiara" + (i + 1), "items"); } - terrasteelHelmWillIcon = IconHelper.forName(evt.map, "willFlame", "items"); + terrasteelHelmWillIcon = IconHelper.forName(evt.getMap(), "willFlame", "items"); - bloodPendantChain = IconHelper.forName(evt.map, "bloodPendant2", "items"); - bloodPendantGem = IconHelper.forName(evt.map, "bloodPendant3", "items"); - snowflakePendantGem = IconHelper.forName(evt.map, "icePendantGem", "items"); - itemFinderGem = IconHelper.forName(evt.map, "itemFinderGem", "items"); - pyroclastGem = IconHelper.forName(evt.map, "lavaPendantGem", "items"); - crimsonGem = IconHelper.forName(evt.map, "superLavaPendantGem", "items"); + bloodPendantChain = IconHelper.forName(evt.getMap(), "bloodPendant2", "items"); + bloodPendantGem = IconHelper.forName(evt.getMap(), "bloodPendant3", "items"); + snowflakePendantGem = IconHelper.forName(evt.getMap(), "icePendantGem", "items"); + itemFinderGem = IconHelper.forName(evt.getMap(), "itemFinderGem", "items"); + pyroclastGem = IconHelper.forName(evt.getMap(), "lavaPendantGem", "items"); + crimsonGem = IconHelper.forName(evt.getMap(), "superLavaPendantGem", "items"); } @SubscribeEvent public void dumpAtlas(ArrowLooseEvent evt) { - if (!evt.entityPlayer.worldObj.isRemote || !((Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment")) - || !evt.entityPlayer.isSneaking()) + if (!evt.getEntityPlayer().worldObj.isRemote || !((Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment")) + || !evt.getEntityPlayer().isSneaking()) return; Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); diff --git a/src/main/java/vazkii/botania/client/core/handler/ModelHandler.java b/src/main/java/vazkii/botania/client/core/handler/ModelHandler.java index 02b752f27..c33a8bf64 100644 --- a/src/main/java/vazkii/botania/client/core/handler/ModelHandler.java +++ b/src/main/java/vazkii/botania/client/core/handler/ModelHandler.java @@ -165,7 +165,6 @@ public final class ModelHandler { registerTESRItems(); registerManaResources(); registerRunes(); - registerBows(); registerLens(); registerBrews(); @@ -199,21 +198,8 @@ public final class ModelHandler { ? new ModelResourceLocation("botania:infiniteFruitBoot", "inventory") : new ModelResourceLocation("botania:infiniteFruit", "inventory"))); - ModelLoader.registerItemVariants(magnetRing, - new ModelResourceLocation("botania:magnetRingOn", "inventory"), - new ModelResourceLocation("botania:magnetRingOff", "inventory")); - ModelLoader.setCustomMeshDefinition(magnetRing, MesherWrapper.of(stack -> - ItemMagnetRing.getCooldown(stack) <= 0 - ? new ModelResourceLocation("botania:magnetRingOn", "inventory") - : new ModelResourceLocation("botania:magnetRingOff", "inventory"))); - - ModelLoader.registerItemVariants(magnetRingGreater, - new ModelResourceLocation("botania:magnetRingGreaterOn", "inventory"), - new ModelResourceLocation("botania:magnetRingGreaterOff", "inventory")); - ModelLoader.setCustomMeshDefinition(magnetRingGreater, MesherWrapper.of(stack -> - ItemMagnetRing.getCooldown(stack) <= 0 - ? new ModelResourceLocation("botania:magnetRingGreaterOn", "inventory") - : new ModelResourceLocation("botania:magnetRingGreaterOff", "inventory"))); + registerItemModel(magnetRing); + registerItemModel(magnetRingGreater); ModelLoader.registerItemVariants(manaGun, new ModelResourceLocation("botania:manaGun", "inventory"), @@ -241,18 +227,8 @@ public final class ModelHandler { ? new ModelResourceLocation("botania:totalBiscuit", "inventory") : new ModelResourceLocation("botania:manaCookie", "inventory"))); - ModelLoader.registerItemVariants(manasteelSword, - new ModelResourceLocation("botania:manasteelSword", "inventory"), - new ModelResourceLocation("botania:elucidator", "inventory")); - ModelLoader.setCustomMeshDefinition(manasteelSword, MesherWrapper.of(stack -> - "the elucidator".equals(stack.getDisplayName().toLowerCase().trim()) - ? new ModelResourceLocation("botania:elucidator", "inventory") - : new ModelResourceLocation("botania:manasteelSword", "inventory"))); - - ModelLoader.registerItemVariants(spawnerMover, - new ModelResourceLocation("botania:spawnerMover", "inventory"), - new ModelResourceLocation("botania:spawnerMoverFull", "inventory")); - ModelLoader.setCustomMeshDefinition(spawnerMover, MesherWrapper.of(stack -> new ModelResourceLocation("botania:spawnerMover" + (ItemSpawnerMover.hasData(stack) ? "Full" : ""), "inventory"))); + registerItemModel(manasteelSword); + registerItemModel(spawnerMover); ModelLoader.registerItemVariants(terraPick, new ModelResourceLocation("botania:terraPick", "inventory"), @@ -469,6 +445,8 @@ public final class ModelHandler { registerItemModel(starSword); registerItemModel(thunderSword); + registerItemModel(crystalBow); + registerItemModel(livingwoodBow); registerItemModel(glassPick); registerItemModel(flowerBag); @@ -594,9 +572,6 @@ public final class ModelHandler { registerItemModel(ModBlocks.hourglass); // todo json maybe? ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.hourglass), 0, TileHourglass.class); - registerItemModel(ModBlocks.pump); // todo await animation api - //ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.pump), 0, TilePump.class); - registerItemModel(ModBlocks.teruTeruBozu); ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.teruTeruBozu), 0, TileTeruTeruBozu.class); } @@ -616,22 +591,6 @@ public final class ModelHandler { } } - private static void registerBows() { - ModelLoader.registerItemVariants(livingwoodBow, new ModelResourceLocation("botania:livingwoodBow", "inventory")); - ModelLoader.registerItemVariants(livingwoodBow, new ModelResourceLocation("botania:livingwoodBow_pulling_1", "inventory")); - ModelLoader.registerItemVariants(livingwoodBow, new ModelResourceLocation("botania:livingwoodBow_pulling_2", "inventory")); - ModelLoader.registerItemVariants(livingwoodBow, new ModelResourceLocation("botania:livingwoodBow_pulling_3", "inventory")); - registerItemModel(livingwoodBow); - - ModelLoader.registerItemVariants(crystalBow, new ModelResourceLocation("botania:crystalBow", "inventory")); - ModelLoader.registerItemVariants(crystalBow, new ModelResourceLocation("botania:crystalBow_pulling_1", "inventory")); - ModelLoader.registerItemVariants(crystalBow, new ModelResourceLocation("botania:crystalBow_pulling_2", "inventory")); - ModelLoader.registerItemVariants(crystalBow, new ModelResourceLocation("botania:crystalBow_pulling_3", "inventory")); - ModelLoader.registerItemVariants(crystalBow, new ModelResourceLocation("botania:crystalBow_pulling_4", "inventory")); - ModelLoader.registerItemVariants(crystalBow, new ModelResourceLocation("botania:crystalBow_pulling_5", "inventory")); - registerItemModel(crystalBow); - } - private static void registerLens() { int counter = 0; for (String s : LibItemNames.LENS_NAMES) { diff --git a/src/main/java/vazkii/botania/client/core/handler/MultiblockRenderHandler.java b/src/main/java/vazkii/botania/client/core/handler/MultiblockRenderHandler.java index c0ff9d6fb..c838006e7 100644 --- a/src/main/java/vazkii/botania/client/core/handler/MultiblockRenderHandler.java +++ b/src/main/java/vazkii/botania/client/core/handler/MultiblockRenderHandler.java @@ -105,9 +105,9 @@ public final class MultiblockRenderHandler { @SubscribeEvent public void onPlayerInteract(PlayerInteractEvent event) { - if(currentMultiblock != null && anchor == null && event.action == Action.RIGHT_CLICK_BLOCK && event.entityPlayer == Minecraft.getMinecraft().thePlayer) { - anchor = event.pos; - angle = event.entityPlayer.getHorizontalFacing(); + if(currentMultiblock != null && anchor == null && event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getEntityPlayer() == Minecraft.getMinecraft().thePlayer) { + anchor = event.getPos(); + angle = event.getEntityPlayer().getHorizontalFacing(); event.setCanceled(true); } } diff --git a/src/main/java/vazkii/botania/client/core/handler/TooltipHandler.java b/src/main/java/vazkii/botania/client/core/handler/TooltipHandler.java index 7644460d3..a58b4df3f 100644 --- a/src/main/java/vazkii/botania/client/core/handler/TooltipHandler.java +++ b/src/main/java/vazkii/botania/client/core/handler/TooltipHandler.java @@ -24,16 +24,16 @@ public final class TooltipHandler { @SubscribeEvent(priority = EventPriority.HIGHEST) public void onTooltipEvent(ItemTooltipEvent event) { - if(event.itemStack.getItem() == Item.getItemFromBlock(Blocks.dirt) && event.itemStack.getItemDamage() == 1) { - event.toolTip.add(I18n.translateToLocal("botaniamisc.coarseDirt0")); - event.toolTip.add(I18n.translateToLocal("botaniamisc.coarseDirt1")); - } else if(event.itemStack.getItem() == Item.getItemFromBlock(Blocks.mob_spawner) && event.entityPlayer.capabilities.isCreativeMode) - event.toolTip.add(I18n.translateToLocal("botaniamisc.spawnerTip")); + if(event.getItemStack().getItem() == Item.getItemFromBlock(Blocks.dirt) && event.getItemStack().getItemDamage() == 1) { + event.getToolTip().add(I18n.translateToLocal("botaniamisc.coarseDirt0")); + event.getToolTip().add(I18n.translateToLocal("botaniamisc.coarseDirt1")); + } else if(event.getItemStack().getItem() == Item.getItemFromBlock(Blocks.mob_spawner) && event.getEntityPlayer().capabilities.isCreativeMode) + event.getToolTip().add(I18n.translateToLocal("botaniamisc.spawnerTip")); - if(ItemNBTHelper.detectNBT(event.itemStack) && ItemNBTHelper.getBoolean(event.itemStack, ItemRegenIvy.TAG_REGEN, false)) - event.toolTip.add(I18n.translateToLocal("botaniamisc.hasIvy")); - if(ItemNBTHelper.detectNBT(event.itemStack) && ItemNBTHelper.getBoolean(event.itemStack, ItemKeepIvy.TAG_KEEP, false)) - event.toolTip.add(I18n.translateToLocal("botaniamisc.hasKeepIvy")); + if(ItemNBTHelper.detectNBT(event.getItemStack()) && ItemNBTHelper.getBoolean(event.getItemStack(), ItemRegenIvy.TAG_REGEN, false)) + event.getToolTip().add(I18n.translateToLocal("botaniamisc.hasIvy")); + if(ItemNBTHelper.detectNBT(event.getItemStack()) && ItemNBTHelper.getBoolean(event.getItemStack(), ItemKeepIvy.TAG_KEEP, false)) + event.getToolTip().add(I18n.translateToLocal("botaniamisc.hasKeepIvy")); } } diff --git a/src/main/java/vazkii/botania/client/model/FloatingFlowerModel.java b/src/main/java/vazkii/botania/client/model/FloatingFlowerModel.java index 6d21631a4..7a1347f59 100644 --- a/src/main/java/vazkii/botania/client/model/FloatingFlowerModel.java +++ b/src/main/java/vazkii/botania/client/model/FloatingFlowerModel.java @@ -51,7 +51,7 @@ public class FloatingFlowerModel implements IBakedModel, IResourceManagerReloadL public static final FloatingFlowerModel INSTANCE = new FloatingFlowerModel(); private static final String MUNDANE_PREFIX = "botania:shimmeringFlower_"; - private static Table CACHE = HashBasedTable.create(); + private static final Table CACHE = HashBasedTable.create(); protected static BakedQuad transform(BakedQuad quad, final TRSRTransformation transform) { UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(DefaultVertexFormats.ITEM); diff --git a/src/main/java/vazkii/botania/common/block/BlockFelPumpkin.java b/src/main/java/vazkii/botania/common/block/BlockFelPumpkin.java index 19238fb77..80d51f0ed 100644 --- a/src/main/java/vazkii/botania/common/block/BlockFelPumpkin.java +++ b/src/main/java/vazkii/botania/common/block/BlockFelPumpkin.java @@ -86,10 +86,10 @@ public class BlockFelPumpkin extends BlockMod implements ILexiconable { @SubscribeEvent public void onDrops(LivingDropsEvent event) { - if(event.entity instanceof EntityBlaze && event.entity.getEntityData().getBoolean(TAG_FEL_SPAWNED)) - if(event.drops.isEmpty()) - event.drops.add(new EntityItem(event.entity.worldObj, event.entity.posX, event.entity.posY, event.entity.posZ, new ItemStack(Items.blaze_powder, 6))); - else for(EntityItem item : event.drops) { + if(event.getEntityLiving() instanceof EntityBlaze && event.getEntityLiving().getEntityData().getBoolean(TAG_FEL_SPAWNED)) + if(event.getDrops().isEmpty()) + event.getDrops().add(new EntityItem(event.getEntityLiving().worldObj, event.getEntityLiving().posX, event.getEntityLiving().posY, event.getEntityLiving().posZ, new ItemStack(Items.blaze_powder, 6))); + else for(EntityItem item : event.getDrops()) { ItemStack stack = item.getEntityItem(); if(stack.getItem() == Items.blaze_rod) item.setEntityItemStack(new ItemStack(Items.blaze_powder, stack.stackSize * 10)); diff --git a/src/main/java/vazkii/botania/common/block/BlockGhostRail.java b/src/main/java/vazkii/botania/common/block/BlockGhostRail.java index e54dbe951..f2cfdcd40 100644 --- a/src/main/java/vazkii/botania/common/block/BlockGhostRail.java +++ b/src/main/java/vazkii/botania/common/block/BlockGhostRail.java @@ -68,33 +68,33 @@ public class BlockGhostRail extends BlockRailBase implements ILexiconable { @SubscribeEvent public void onMinecartUpdate(MinecartUpdateEvent event) { - BlockPos entPos = new BlockPos(event.entity); - IBlockState state = event.entity.worldObj.getBlockState(entPos); + BlockPos entPos = new BlockPos(event.getEntity()); + IBlockState state = event.getEntity().worldObj.getBlockState(entPos); Block block = state.getBlock(); - boolean air = block.isAir(state, event.entity.worldObj, entPos); - int floatTicks = event.entity.getEntityData().getInteger(TAG_FLOAT_TICKS); + boolean air = block.isAir(state, event.getEntity().worldObj, entPos); + int floatTicks = event.getEntity().getEntityData().getInteger(TAG_FLOAT_TICKS); if(block == this) - event.entity.getEntityData().setInteger(TAG_FLOAT_TICKS, 20); + event.getEntity().getEntityData().setInteger(TAG_FLOAT_TICKS, 20); else if(block instanceof BlockRailBase || block == ModBlocks.dreamwood) { - event.entity.getEntityData().setInteger(TAG_FLOAT_TICKS, 0); + event.getEntity().getEntityData().setInteger(TAG_FLOAT_TICKS, 0); if(floatTicks > 0) - event.entity.worldObj.playAuxSFX(2003, entPos, 0); + event.getEntity().worldObj.playAuxSFX(2003, entPos, 0); } - floatTicks = event.entity.getEntityData().getInteger(TAG_FLOAT_TICKS); + floatTicks = event.getEntity().getEntityData().getInteger(TAG_FLOAT_TICKS); if(floatTicks > 0) { - IBlockState stateBelow = event.entity.worldObj.getBlockState(entPos.down()); + IBlockState stateBelow = event.getEntity().worldObj.getBlockState(entPos.down()); Block blockBelow = stateBelow.getBlock(); - boolean airBelow = blockBelow.isAir(stateBelow, event.entity.worldObj, entPos.down()); + boolean airBelow = blockBelow.isAir(stateBelow, event.getEntity().worldObj, entPos.down()); if(air && airBelow || !air && !airBelow) - event.entity.noClip = true; - event.entity.motionY = 0.2; - event.entity.motionX *= 1.4; - event.entity.motionZ *= 1.4; - event.entity.getEntityData().setInteger(TAG_FLOAT_TICKS, floatTicks - 1); - event.entity.worldObj.playAuxSFX(2000, entPos, 0); - } else event.entity.noClip = false; + event.getEntity().noClip = true; + event.getEntity().motionY = 0.2; + event.getEntity().motionX *= 1.4; + event.getEntity().motionZ *= 1.4; + event.getEntity().getEntityData().setInteger(TAG_FLOAT_TICKS, floatTicks - 1); + event.getEntity().worldObj.playAuxSFX(2000, entPos, 0); + } else event.getEntity().noClip = false; } @Override diff --git a/src/main/java/vazkii/botania/common/block/BlockPistonRelay.java b/src/main/java/vazkii/botania/common/block/BlockPistonRelay.java index 43481c00f..5e2912bb0 100644 --- a/src/main/java/vazkii/botania/common/block/BlockPistonRelay.java +++ b/src/main/java/vazkii/botania/common/block/BlockPistonRelay.java @@ -135,12 +135,12 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl @SubscribeEvent public void onWorldLoad(WorldEvent.Load event) { - WorldData.get(event.world); + WorldData.get(event.getWorld()); } @SubscribeEvent public void onWorldUnload(WorldEvent.Unload event) { - WorldData.get(event.world).markDirty(); + WorldData.get(event.getWorld()).markDirty(); } public static class WorldData extends WorldSavedData { diff --git a/src/main/java/vazkii/botania/common/block/string/BlockRedStringInterceptor.java b/src/main/java/vazkii/botania/common/block/string/BlockRedStringInterceptor.java index d33859781..08c5d6af3 100644 --- a/src/main/java/vazkii/botania/common/block/string/BlockRedStringInterceptor.java +++ b/src/main/java/vazkii/botania/common/block/string/BlockRedStringInterceptor.java @@ -61,8 +61,8 @@ public class BlockRedStringInterceptor extends BlockRedString { @SubscribeEvent public void onInteract(PlayerInteractEvent event) { - if(event.action == Action.RIGHT_CLICK_BLOCK) - TileRedStringInterceptor.onInteract(event.entityPlayer, event.world, event.pos); + if(event.getAction() == Action.RIGHT_CLICK_BLOCK) + TileRedStringInterceptor.onInteract(event.getEntityPlayer(), event.getWorld(), event.getPos()); } @Override diff --git a/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileVinculotus.java b/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileVinculotus.java index 11e3cf6a7..cef4b8324 100644 --- a/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileVinculotus.java +++ b/src/main/java/vazkii/botania/common/block/subtile/functional/SubTileVinculotus.java @@ -74,35 +74,35 @@ public class SubTileVinculotus extends SubTileFunctional { @SubscribeEvent public void onEndermanTeleport(EnderTeleportEvent event) { - if(event.entity.worldObj.isRemote) + if(event.getEntityLiving().worldObj.isRemote) return; int cost = 50; - if(event.entity instanceof EntityEnderman) { + if(event.getEntityLiving() instanceof EntityEnderman) { List possibleFlowers = new ArrayList<>(); for(SubTileVinculotus flower : existingFlowers) { - if(flower.redstoneSignal > 0 || flower.mana <= cost || flower.supertile.getWorld() != event.entity.worldObj || flower.supertile.getWorld().getTileEntity(flower.supertile.getPos()) != flower.supertile) + if(flower.redstoneSignal > 0 || flower.mana <= cost || flower.supertile.getWorld() != event.getEntityLiving().worldObj || flower.supertile.getWorld().getTileEntity(flower.supertile.getPos()) != flower.supertile) continue; double x = flower.supertile.getPos().getX() + 0.5; double y = flower.supertile.getPos().getY() + 1.5; double z = flower.supertile.getPos().getZ() + 0.5; - if(MathHelper.pointDistanceSpace(x, y, z, event.targetX, event.targetY, event.targetZ) < RANGE) + if(MathHelper.pointDistanceSpace(x, y, z, event.getTargetX(), event.getTargetY(), event.getTargetZ()) < RANGE) possibleFlowers.add(flower); } if(!possibleFlowers.isEmpty()) { - SubTileVinculotus flower = possibleFlowers.get(event.entity.worldObj.rand.nextInt(possibleFlowers.size())); + SubTileVinculotus flower = possibleFlowers.get(event.getEntityLiving().worldObj.rand.nextInt(possibleFlowers.size())); double x = flower.supertile.getPos().getX() + 0.5; double y = flower.supertile.getPos().getY() + 1.5; double z = flower.supertile.getPos().getZ() + 0.5; - event.targetX = x + Math.random() * 3 - 1; - event.targetY = y; - event.targetZ = z + Math.random() * 3 - 1; + event.setTargetX(x + Math.random() * 3 - 1); + event.setTargetY(y); + event.setTargetZ(z + Math.random() * 3 - 1); flower.mana -= cost; flower.sync(); } diff --git a/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileNarslimmus.java b/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileNarslimmus.java index 321673dc4..673f60ce2 100644 --- a/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileNarslimmus.java +++ b/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileNarslimmus.java @@ -90,8 +90,8 @@ public class SubTileNarslimmus extends SubTileGenerating { @SubscribeEvent public void onSpawn(LivingSpawnEvent.CheckSpawn event) { - if(event.entityLiving instanceof EntitySlime && event.getResult() != Result.DENY && isSlimeChunk(event.entityLiving.worldObj, MathHelper.floor_double(event.x), MathHelper.floor_double(event.z))) - event.entityLiving.getEntityData().setBoolean(TAG_WORLD_SPAWNED, true); + if(event.getEntityLiving() instanceof EntitySlime && event.getResult() != Result.DENY && isSlimeChunk(event.getEntityLiving().worldObj, MathHelper.floor_double(event.getX()), MathHelper.floor_double(event.getZ()))) + event.getEntityLiving().getEntityData().setBoolean(TAG_WORLD_SPAWNED, true); } public static boolean isSlimeChunk(World world, int x, int z) { diff --git a/src/main/java/vazkii/botania/common/brew/potion/PotionAllure.java b/src/main/java/vazkii/botania/common/brew/potion/PotionAllure.java index 41bea1849..442dc4355 100644 --- a/src/main/java/vazkii/botania/common/brew/potion/PotionAllure.java +++ b/src/main/java/vazkii/botania/common/brew/potion/PotionAllure.java @@ -27,7 +27,7 @@ public class PotionAllure extends PotionMod { @SubscribeEvent public void onEntityUpdate(LivingUpdateEvent event) { - EntityLivingBase e = event.entityLiving; + EntityLivingBase e = event.getEntityLiving(); if(e instanceof EntityPlayer && hasEffect(e)) { EntityFishHook hook = ((EntityPlayer) e).fishEntity; if(hook != null) diff --git a/src/main/java/vazkii/botania/common/brew/potion/PotionBloodthirst.java b/src/main/java/vazkii/botania/common/brew/potion/PotionBloodthirst.java index 2daa699ec..2181c99b2 100644 --- a/src/main/java/vazkii/botania/common/brew/potion/PotionBloodthirst.java +++ b/src/main/java/vazkii/botania/common/brew/potion/PotionBloodthirst.java @@ -33,9 +33,9 @@ public class PotionBloodthirst extends PotionMod { @SubscribeEvent public void onSpawn(LivingSpawnEvent.CheckSpawn event) { - if(event.getResult() != Result.ALLOW && event.entityLiving instanceof IMob) { - AxisAlignedBB aabb = new AxisAlignedBB(event.x - RANGE, event.y - RANGE, event.z - RANGE, event.x + RANGE, event.y + RANGE, event.z + RANGE); - for(EntityPlayer player : event.world.playerEntities) { + if(event.getResult() != Result.ALLOW && event.getEntityLiving() instanceof IMob) { + AxisAlignedBB aabb = new AxisAlignedBB(event.getX() - RANGE, event.getY() - RANGE, event.getZ() - RANGE, event.getX() + RANGE, event.getY() + RANGE, event.getZ() + RANGE); + for(EntityPlayer player : event.getWorld().playerEntities) { if(hasEffect(player) && !hasEffect(player, ModPotions.emptiness) && player.getEntityBoundingBox().intersectsWith(aabb)) { event.setResult(Result.ALLOW); return; diff --git a/src/main/java/vazkii/botania/common/brew/potion/PotionEmptiness.java b/src/main/java/vazkii/botania/common/brew/potion/PotionEmptiness.java index 6d82f70cd..a16133b51 100644 --- a/src/main/java/vazkii/botania/common/brew/potion/PotionEmptiness.java +++ b/src/main/java/vazkii/botania/common/brew/potion/PotionEmptiness.java @@ -32,9 +32,9 @@ public class PotionEmptiness extends PotionMod { @SubscribeEvent public void onSpawn(LivingSpawnEvent.CheckSpawn event) { - if(event.getResult() != Result.ALLOW && event.entityLiving instanceof IMob) { - AxisAlignedBB aabb = new AxisAlignedBB(event.x - RANGE, event.y - RANGE, event.z - RANGE, event.x + RANGE, event.y + RANGE, event.z + RANGE); - for(EntityPlayer player : event.world.playerEntities) { + if(event.getResult() != Result.ALLOW && event.getEntityLiving() instanceof IMob) { + AxisAlignedBB aabb = new AxisAlignedBB(event.getX() - RANGE, event.getY() - RANGE, event.getZ() - RANGE, event.getX() + RANGE, event.getY() + RANGE, event.getZ() + RANGE); + for(EntityPlayer player : event.getWorld().playerEntities) { if(hasEffect(player) && player.getEntityBoundingBox().intersectsWith(aabb)) { event.setResult(Result.DENY); return; diff --git a/src/main/java/vazkii/botania/common/brew/potion/PotionFeatherfeet.java b/src/main/java/vazkii/botania/common/brew/potion/PotionFeatherfeet.java index 11eb1e2d0..9caa07f88 100644 --- a/src/main/java/vazkii/botania/common/brew/potion/PotionFeatherfeet.java +++ b/src/main/java/vazkii/botania/common/brew/potion/PotionFeatherfeet.java @@ -25,7 +25,7 @@ public class PotionFeatherfeet extends PotionMod { @SubscribeEvent public void onEntityUpdate(LivingUpdateEvent event) { - EntityLivingBase e = event.entityLiving; + EntityLivingBase e = event.getEntityLiving(); if(hasEffect(e)) e.fallDistance = 2.5F; } diff --git a/src/main/java/vazkii/botania/common/brew/potion/PotionSoulCross.java b/src/main/java/vazkii/botania/common/brew/potion/PotionSoulCross.java index 8706bf491..eae7e3ad2 100644 --- a/src/main/java/vazkii/botania/common/brew/potion/PotionSoulCross.java +++ b/src/main/java/vazkii/botania/common/brew/potion/PotionSoulCross.java @@ -26,11 +26,11 @@ public class PotionSoulCross extends PotionMod { @SubscribeEvent public void onEntityKill(LivingDeathEvent event) { - Entity e = event.source.getEntity(); + Entity e = event.getSource().getEntity(); if(e != null && e instanceof EntityLivingBase) { EntityLivingBase living = (EntityLivingBase) e; if(hasEffect(living)) - living.heal(event.entityLiving.getMaxHealth() / 20); + living.heal(event.getEntityLiving().getMaxHealth() / 20); } } diff --git a/src/main/java/vazkii/botania/common/core/handler/BiomeDecorationHandler.java b/src/main/java/vazkii/botania/common/core/handler/BiomeDecorationHandler.java index ee88d3984..3108f5794 100644 --- a/src/main/java/vazkii/botania/common/core/handler/BiomeDecorationHandler.java +++ b/src/main/java/vazkii/botania/common/core/handler/BiomeDecorationHandler.java @@ -30,42 +30,42 @@ public class BiomeDecorationHandler { @SubscribeEvent(priority = EventPriority.LOWEST) public void onWorldDecoration(DecorateBiomeEvent.Decorate event) { - if((event.getResult() == Result.ALLOW || event.getResult() == Result.DEFAULT) && event.type == EventType.FLOWERS) { + if((event.getResult() == Result.ALLOW || event.getResult() == Result.DEFAULT) && event.getType() == EventType.FLOWERS) { boolean flowers = true; - if(event.world.provider instanceof IFlowerlessWorld) - flowers = ((IFlowerlessWorld) event.world.provider).generateFlowers(event.world); - else if(event.world.getBiomeGenForCoords(event.pos) instanceof IFlowerlessBiome) - flowers = ((IFlowerlessBiome) event.world.getBiomeGenForCoords(event.pos)).canGenerateFlowers(event.world, event.pos.getX(), event.pos.getZ()); + if(event.getWorld().provider instanceof IFlowerlessWorld) + flowers = ((IFlowerlessWorld) event.getWorld().provider).generateFlowers(event.getWorld()); + else if(event.getWorld().getBiomeGenForCoords(event.getPos()) instanceof IFlowerlessBiome) + flowers = ((IFlowerlessBiome) event.getWorld().getBiomeGenForCoords(event.getPos())).canGenerateFlowers(event.getWorld(), event.getPos().getX(), event.getPos().getZ()); if(!flowers) return; int dist = Math.min(8, Math.max(1, ConfigHandler.flowerPatchSize)); for(int i = 0; i < ConfigHandler.flowerQuantity; i++) { - if(event.rand.nextInt(ConfigHandler.flowerPatchChance) == 0) { - int x = event.pos.getX() + event.rand.nextInt(16) + 8; - int z = event.pos.getZ() + event.rand.nextInt(16) + 8; - int y = event.world.getTopSolidOrLiquidBlock(event.pos).getY(); + if(event.getRand().nextInt(ConfigHandler.flowerPatchChance) == 0) { + int x = event.getPos().getX() + event.getRand().nextInt(16) + 8; + int z = event.getPos().getZ() + event.getRand().nextInt(16) + 8; + int y = event.getWorld().getTopSolidOrLiquidBlock(event.getPos()).getY(); - EnumDyeColor color = EnumDyeColor.byMetadata(event.rand.nextInt(16)); - boolean primus = event.rand.nextInt(380) == 0; + EnumDyeColor color = EnumDyeColor.byMetadata(event.getRand().nextInt(16)); + boolean primus = event.getRand().nextInt(380) == 0; for(int j = 0; j < ConfigHandler.flowerDensity * ConfigHandler.flowerPatchChance; j++) { - int x1 = x + event.rand.nextInt(dist * 2) - dist; - int y1 = y + event.rand.nextInt(4) - event.rand.nextInt(4); - int z1 = z + event.rand.nextInt(dist * 2) - dist; + int x1 = x + event.getRand().nextInt(dist * 2) - dist; + int y1 = y + event.getRand().nextInt(4) - event.getRand().nextInt(4); + int z1 = z + event.getRand().nextInt(dist * 2) - dist; BlockPos pos2 = new BlockPos(x1, y1, z1); - if(event.world.isAirBlock(pos2) && (!event.world.provider.getHasNoSky() || y1 < 127) && ModBlocks.flower.canPlaceBlockAt(event.world, pos2)) { + if(event.getWorld().isAirBlock(pos2) && (!event.getWorld().provider.getHasNoSky() || y1 < 127) && ModBlocks.flower.canPlaceBlockAt(event.getWorld(), pos2)) { if(primus) { - event.world.setBlockState(pos2, ModBlocks.specialFlower.getDefaultState(), 2); - TileSpecialFlower flower = (TileSpecialFlower) event.world.getTileEntity(pos2); - flower.setSubTile(event.rand.nextBoolean() ? LibBlockNames.SUBTILE_NIGHTSHADE_PRIME : LibBlockNames.SUBTILE_DAYBLOOM_PRIME); + event.getWorld().setBlockState(pos2, ModBlocks.specialFlower.getDefaultState(), 2); + TileSpecialFlower flower = (TileSpecialFlower) event.getWorld().getTileEntity(pos2); + flower.setSubTile(event.getRand().nextBoolean() ? LibBlockNames.SUBTILE_NIGHTSHADE_PRIME : LibBlockNames.SUBTILE_DAYBLOOM_PRIME); SubTileDaybloom subtile = (SubTileDaybloom) flower.getSubTile(); subtile.setPrimusPosition(); } else { - event.world.setBlockState(pos2, ModBlocks.flower.getDefaultState().withProperty(BotaniaStateProps.COLOR, color), 2); - if(event.rand.nextDouble() < ConfigHandler.flowerTallChance && ((BlockModFlower) ModBlocks.flower).canGrow(event.world, pos2, event.world.getBlockState(pos2), false)) - BlockModFlower.placeDoubleFlower(event.world, pos2, color, 0); + event.getWorld().setBlockState(pos2, ModBlocks.flower.getDefaultState().withProperty(BotaniaStateProps.COLOR, color), 2); + if(event.getRand().nextDouble() < ConfigHandler.flowerTallChance && ((BlockModFlower) ModBlocks.flower).canGrow(event.getWorld(), pos2, event.getWorld().getBlockState(pos2), false)) + BlockModFlower.placeDoubleFlower(event.getWorld(), pos2, color, 0); } } } @@ -73,13 +73,13 @@ public class BiomeDecorationHandler { } for(int i = 0; i < ConfigHandler.mushroomQuantity; i++) { - int x = event.pos.getX() + event.rand.nextInt(16) + 8; - int z = event.pos.getZ() + event.rand.nextInt(16) + 8; - int y = event.rand.nextInt(26) + 4; + int x = event.getPos().getX() + event.getRand().nextInt(16) + 8; + int z = event.getPos().getZ() + event.getRand().nextInt(16) + 8; + int y = event.getRand().nextInt(26) + 4; BlockPos pos3 = new BlockPos(x, y, z); - EnumDyeColor color = EnumDyeColor.byMetadata(event.rand.nextInt(16)); - if(event.world.isAirBlock(pos3) && ModBlocks.mushroom.canPlaceBlockAt(event.world, pos3)) - event.world.setBlockState(pos3, ModBlocks.mushroom.getDefaultState().withProperty(BotaniaStateProps.COLOR, color), 2); + EnumDyeColor color = EnumDyeColor.byMetadata(event.getRand().nextInt(16)); + if(event.getWorld().isAirBlock(pos3) && ModBlocks.mushroom.canPlaceBlockAt(event.getWorld(), pos3)) + event.getWorld().setBlockState(pos3, ModBlocks.mushroom.getDefaultState().withProperty(BotaniaStateProps.COLOR, color), 2); } } } diff --git a/src/main/java/vazkii/botania/common/core/handler/ConfigHandler.java b/src/main/java/vazkii/botania/common/core/handler/ConfigHandler.java index aa31b274e..cd80212ad 100644 --- a/src/main/java/vazkii/botania/common/core/handler/ConfigHandler.java +++ b/src/main/java/vazkii/botania/common/core/handler/ConfigHandler.java @@ -287,7 +287,7 @@ public final class ConfigHandler { public static int loadPropInt(String propName, String desc, int default_) { Property prop = config.get(Configuration.CATEGORY_GENERAL, propName, default_); - prop.comment = desc; + prop.setComment(desc); if(adaptor != null) adaptor.adaptPropertyInt(prop, prop.getInt(default_)); @@ -297,7 +297,7 @@ public final class ConfigHandler { public static double loadPropDouble(String propName, String desc, double default_) { Property prop = config.get(Configuration.CATEGORY_GENERAL, propName, default_); - prop.comment = desc; + prop.setComment(desc); if(adaptor != null) adaptor.adaptPropertyDouble(prop, prop.getDouble(default_)); @@ -307,7 +307,7 @@ public final class ConfigHandler { public static boolean loadPropBool(String propName, String desc, boolean default_) { Property prop = config.get(Configuration.CATEGORY_GENERAL, propName, default_); - prop.comment = desc; + prop.setComment(desc); if(adaptor != null) adaptor.adaptPropertyBool(prop, prop.getBoolean(default_)); @@ -444,7 +444,7 @@ public final class ConfigHandler { @SubscribeEvent public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent eventArgs) { - if(eventArgs.modID.equals(LibMisc.MOD_ID)) + if(eventArgs.getModID().equals(LibMisc.MOD_ID)) load(); } diff --git a/src/main/java/vazkii/botania/common/core/handler/PixieHandler.java b/src/main/java/vazkii/botania/common/core/handler/PixieHandler.java index d317622a6..7b37a4f33 100644 --- a/src/main/java/vazkii/botania/common/core/handler/PixieHandler.java +++ b/src/main/java/vazkii/botania/common/core/handler/PixieHandler.java @@ -21,8 +21,8 @@ public class PixieHandler { @SubscribeEvent public void onDamageTaken(LivingHurtEvent event) { - if(!event.entityLiving.worldObj.isRemote && event.entityLiving instanceof EntityPlayer && event.source.getEntity() != null && event.source.getEntity() instanceof EntityLivingBase) { - EntityPlayer player = (EntityPlayer) event.entityLiving; + if(!event.getEntityLiving().worldObj.isRemote && event.getEntityLiving() instanceof EntityPlayer && event.getSource().getEntity() != null && event.getSource().getEntity() instanceof EntityLivingBase) { + EntityPlayer player = (EntityPlayer) event.getEntityLiving(); ItemStack stack = PlayerHelper.getFirstHeldItemClass(player, IPixieSpawner.class); float chance = getChance(stack); @@ -44,14 +44,14 @@ public class PixieHandler { MobEffects.moveSlowdown, MobEffects.weakness }; - pixie.setApplyPotionEffect(new PotionEffect(potions[event.entity.worldObj.rand.nextInt(potions.length)], 40, 0)); + pixie.setApplyPotionEffect(new PotionEffect(potions[event.getEntityLiving().worldObj.rand.nextInt(potions.length)], 40, 0)); } float dmg = 4; if(stack != null && stack.getItem() == ModItems.elementiumSword) dmg += 2; - pixie.setProps((EntityLivingBase) event.source.getEntity(), player, 0, dmg); + pixie.setProps((EntityLivingBase) event.getSource().getEntity(), player, 0, dmg); player.worldObj.spawnEntityInWorld(pixie); } } diff --git a/src/main/java/vazkii/botania/common/core/handler/SheddingHandler.java b/src/main/java/vazkii/botania/common/core/handler/SheddingHandler.java index b87d97ed0..0ea5d6552 100644 --- a/src/main/java/vazkii/botania/common/core/handler/SheddingHandler.java +++ b/src/main/java/vazkii/botania/common/core/handler/SheddingHandler.java @@ -42,14 +42,14 @@ public final class SheddingHandler { @SubscribeEvent public void onLivingUpdate(LivingUpdateEvent event) { - if(event.entity.worldObj.isRemote) + if(event.getEntityLiving().worldObj.isRemote) return; - ShedPattern pattern = getShedPattern(event.entity); + ShedPattern pattern = getShedPattern(event.getEntityLiving()); if(pattern != null) { - if(event.entity.worldObj.rand.nextInt(pattern.getRate()) == 0) - event.entity.entityDropItem(pattern.getItemStack(), 0.0F); + if(event.getEntityLiving().worldObj.rand.nextInt(pattern.getRate()) == 0) + event.getEntityLiving().entityDropItem(pattern.getItemStack(), 0.0F); } } @@ -116,7 +116,7 @@ public final class SheddingHandler { } Property prop = config.get("Shedding", key + ".item", itemName); - prop.comment = "Configuration of Shedding for "+key; + prop.setComment("Configuration of Shedding for "+key); itemName = prop.getString(); rate = config.get("Shedding", key + ".rate", rate).getInt(); metadata = config.get("Shedding", key + ".metadata", metadata).getInt(); diff --git a/src/main/java/vazkii/botania/common/integration/corporea/WrappedDeepStorage.java b/src/main/java/vazkii/botania/common/integration/corporea/WrappedDeepStorage.java index 9ce510c9b..2dfdf27b3 100644 --- a/src/main/java/vazkii/botania/common/integration/corporea/WrappedDeepStorage.java +++ b/src/main/java/vazkii/botania/common/integration/corporea/WrappedDeepStorage.java @@ -113,8 +113,8 @@ public class WrappedDeepStorage extends WrappedInventoryBase { * @return wrapped inventory or null if it has incompatible type. */ public static IWrappedInventory wrap(InvWithLocation inv, ICorporeaSpark spark) { - if(isDeepStorageNeeded() && inv.handler instanceof InvWrapper && ((InvWrapper) inv.handler).inv instanceof IDeepStorageUnit) { - return new WrappedDeepStorage(((IDeepStorageUnit) ((InvWrapper) inv.handler).inv), spark); + if(isDeepStorageNeeded() && inv.handler instanceof InvWrapper && ((InvWrapper) inv.handler).getInv() instanceof IDeepStorageUnit) { + return new WrappedDeepStorage(((IDeepStorageUnit) ((InvWrapper) inv.handler).getInv()), spark); } else return null; } diff --git a/src/main/java/vazkii/botania/common/item/ItemCraftingHalo.java b/src/main/java/vazkii/botania/common/item/ItemCraftingHalo.java index dec001766..0d032a606 100644 --- a/src/main/java/vazkii/botania/common/item/ItemCraftingHalo.java +++ b/src/main/java/vazkii/botania/common/item/ItemCraftingHalo.java @@ -79,7 +79,6 @@ public class ItemCraftingHalo extends ItemMod implements ICraftAchievement { public ItemCraftingHalo() { this(LibItemNames.CRAFTING_HALO); MinecraftForge.EVENT_BUS.register(this); - FMLCommonHandler.instance().bus().register(this); } public ItemCraftingHalo(String name) { @@ -392,7 +391,7 @@ public class ItemCraftingHalo extends ItemMod implements ICraftAchievement { EntityPlayer player = Minecraft.getMinecraft().thePlayer; ItemStack stack = PlayerHelper.getFirstHeldItemClass(player, ItemCraftingHalo.class); if(stack != null) - render(stack, player, event.partialTicks); + render(stack, player, event.getPartialTicks()); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/vazkii/botania/common/item/ItemFlowerBag.java b/src/main/java/vazkii/botania/common/item/ItemFlowerBag.java index 7c26cd8ac..98bab499d 100644 --- a/src/main/java/vazkii/botania/common/item/ItemFlowerBag.java +++ b/src/main/java/vazkii/botania/common/item/ItemFlowerBag.java @@ -51,17 +51,17 @@ public class ItemFlowerBag extends ItemMod { @SubscribeEvent public void onPickupItem(EntityItemPickupEvent event) { - ItemStack stack = event.item.getEntityItem(); + ItemStack stack = event.getItem().getEntityItem(); if(stack.getItem() == Item.getItemFromBlock(ModBlocks.flower) && stack.stackSize > 0) { int color = stack.getItemDamage(); if(color > 15) return; - for(int i = 0; i < event.entityPlayer.inventory.getSizeInventory(); i++) { - if(i == event.entityPlayer.inventory.currentItem) + for(int i = 0; i < event.getEntityPlayer().inventory.getSizeInventory(); i++) { + if(i == event.getEntityPlayer().inventory.currentItem) continue; // prevent item deletion - ItemStack invStack = event.entityPlayer.inventory.getStackInSlot(i); + ItemStack invStack = event.getEntityPlayer().inventory.getStackInSlot(i); if(invStack != null && invStack.getItem() == this) { ItemStack[] bagInv = loadStacks(invStack); ItemStack stackAt = bagInv[color]; diff --git a/src/main/java/vazkii/botania/common/item/ItemKeepIvy.java b/src/main/java/vazkii/botania/common/item/ItemKeepIvy.java index 2682d08fc..42ea56175 100644 --- a/src/main/java/vazkii/botania/common/item/ItemKeepIvy.java +++ b/src/main/java/vazkii/botania/common/item/ItemKeepIvy.java @@ -47,14 +47,14 @@ public class ItemKeepIvy extends ItemMod { @SubscribeEvent public void onPlayerDrops(PlayerDropsEvent event) { List keeps = new ArrayList<>(); - for(EntityItem item : event.drops) { + for(EntityItem item : event.getDrops()) { ItemStack stack = item.getEntityItem(); if(stack != null && ItemNBTHelper.detectNBT(stack) && ItemNBTHelper.getBoolean(stack, TAG_KEEP, false)) keeps.add(item); } if(keeps.size() > 0) { - event.drops.removeAll(keeps); + event.getDrops().removeAll(keeps); NBTTagCompound cmp = new NBTTagCompound(); @@ -69,7 +69,7 @@ public class ItemKeepIvy extends ItemMod { i++; } - NBTTagCompound data = event.entityPlayer.getEntityData(); + NBTTagCompound data = event.getEntityPlayer().getEntityData(); if(!data.hasKey(EntityPlayer.PERSISTED_NBT_TAG)) data.setTag(EntityPlayer.PERSISTED_NBT_TAG, new NBTTagCompound()); diff --git a/src/main/java/vazkii/botania/common/item/ItemSpawnerMover.java b/src/main/java/vazkii/botania/common/item/ItemSpawnerMover.java index bf3c8848b..060baab70 100644 --- a/src/main/java/vazkii/botania/common/item/ItemSpawnerMover.java +++ b/src/main/java/vazkii/botania/common/item/ItemSpawnerMover.java @@ -13,13 +13,16 @@ package vazkii.botania.common.item; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; +import net.minecraft.item.IItemPropertyGetter; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; @@ -40,6 +43,12 @@ public class ItemSpawnerMover extends ItemMod { public ItemSpawnerMover() { setUnlocalizedName(LibItemNames.SPAWNER_MOVER); setMaxStackSize(1); + addPropertyOverride(new ResourceLocation("botania", "full"), new IItemPropertyGetter() { + @Override + public float apply(ItemStack stack, World worldIn, EntityLivingBase entityIn) { + return hasData(stack) ? 1 : 0; + } + }); } public static NBTTagCompound getSpawnerTag(ItemStack stack) { diff --git a/src/main/java/vazkii/botania/common/item/ItemVirus.java b/src/main/java/vazkii/botania/common/item/ItemVirus.java index f889efd44..38f1b7678 100644 --- a/src/main/java/vazkii/botania/common/item/ItemVirus.java +++ b/src/main/java/vazkii/botania/common/item/ItemVirus.java @@ -70,11 +70,11 @@ public class ItemVirus extends ItemMod { @SubscribeEvent public void onLivingHurt(LivingHurtEvent event) { - EntityLivingBase entity = event.entityLiving; + EntityLivingBase entity = event.getEntityLiving(); if(entity.isRiding() && entity.getRidingEntity() instanceof EntityLivingBase) entity = (EntityLivingBase) entity.getRidingEntity(); - if(entity instanceof EntityHorse && event.source == DamageSource.fall) { + if(entity instanceof EntityHorse && event.getSource() == DamageSource.fall) { EntityHorse horse = (EntityHorse) entity; if((horse.getType() == HorseArmorType.ZOMBIE || horse.getType() == HorseArmorType.SKELETON) && horse.isTame()) event.setCanceled(true); diff --git a/src/main/java/vazkii/botania/common/item/equipment/armor/terrasteel/ItemTerrasteelHelm.java b/src/main/java/vazkii/botania/common/item/equipment/armor/terrasteel/ItemTerrasteelHelm.java index 791cd74a2..9fe906779 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/armor/terrasteel/ItemTerrasteelHelm.java +++ b/src/main/java/vazkii/botania/common/item/equipment/armor/terrasteel/ItemTerrasteelHelm.java @@ -120,7 +120,7 @@ public class ItemTerrasteelHelm extends ItemTerrasteelArmor implements IManaDisc @SubscribeEvent public void onEntityAttacked(LivingHurtEvent event) { - Entity attacker = event.source.getEntity(); + Entity attacker = event.getSource().getEntity(); if(attacker instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) attacker; if(hasArmorSet(player)) { @@ -135,17 +135,17 @@ public class ItemTerrasteelHelm extends ItemTerrasteelArmor implements IManaDisc boolean karil = hasAncientWill(stack, 5); if(ahrim) - event.entityLiving.addPotionEffect(new PotionEffect(MobEffects.weakness, 20, 1)); + event.getEntityLiving().addPotionEffect(new PotionEffect(MobEffects.weakness, 20, 1)); if(dharok) - event.ammount *= 1F + (1F - player.getHealth() / player.getMaxHealth()) * 0.5F; + event.setAmount(event.getAmount() * (1F + (1F - player.getHealth() / player.getMaxHealth()) * 0.5F)); if(guthan) - player.heal(event.ammount * 0.25F); + player.heal(event.getAmount() * 0.25F); if(torag) - event.entityLiving.addPotionEffect(new PotionEffect(MobEffects.moveSlowdown, 60, 1)); + event.getEntityLiving().addPotionEffect(new PotionEffect(MobEffects.moveSlowdown, 60, 1)); if(verac) - event.source.setDamageBypassesArmor(); + event.getSource().setDamageBypassesArmor(); if(karil) - event.entityLiving.addPotionEffect(new PotionEffect(MobEffects.wither, 60, 1)); + event.getEntityLiving().addPotionEffect(new PotionEffect(MobEffects.wither, 60, 1)); } } } diff --git a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemDivaCharm.java b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemDivaCharm.java index d9ccbc580..2ba4292c8 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemDivaCharm.java +++ b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemDivaCharm.java @@ -53,32 +53,32 @@ public class ItemDivaCharm extends ItemBauble implements IManaUsingItem, IBauble @SubscribeEvent public void onEntityDamaged(LivingHurtEvent event) { - if(event.source.getEntity() instanceof EntityPlayer && event.entityLiving instanceof EntityLiving && !event.entityLiving.worldObj.isRemote && Math.random() < 0.6F) { - EntityPlayer player = (EntityPlayer) event.source.getEntity(); + if(event.getSource().getEntity() instanceof EntityPlayer && event.getEntityLiving() instanceof EntityLiving && !event.getEntityLiving().worldObj.isRemote && Math.random() < 0.6F) { + EntityPlayer player = (EntityPlayer) event.getSource().getEntity(); ItemStack amulet = PlayerHandler.getPlayerBaubles(player).getStackInSlot(0); if(amulet != null && amulet.getItem() == this) { final int cost = 250; if(ManaItemHandler.requestManaExact(amulet, player, cost, false)) { final int range = 20; - List mobs = player.worldObj.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(event.entity.posX - range, event.entity.posY - range, event.entity.posZ - range, event.entity.posX + range, event.entity.posY + range, event.entity.posZ + range), Predicates.instanceOf(IMob.class)); + List mobs = player.worldObj.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(event.getEntityLiving().posX - range, event.getEntityLiving().posY - range, event.getEntityLiving().posZ - range, event.getEntityLiving().posX + range, event.getEntityLiving().posY + range, event.getEntityLiving().posZ + range), Predicates.instanceOf(IMob.class)); if(mobs.size() > 1) { - if(SubTileHeiseiDream.brainwashEntity((EntityLiving) event.entityLiving, ((List) mobs))) { - if(event.entityLiving instanceof EntityCreeper) - ReflectionHelper.setPrivateValue(EntityCreeper.class, (EntityCreeper) event.entityLiving, 2, LibObfuscation.TIME_SINCE_IGNITED); - event.entityLiving.heal(event.entityLiving.getMaxHealth()); - if(event.entityLiving.isDead) - event.entityLiving.isDead = false; + if(SubTileHeiseiDream.brainwashEntity((EntityLiving) event.getEntityLiving(), ((List) mobs))) { + if(event.getEntityLiving() instanceof EntityCreeper) + ReflectionHelper.setPrivateValue(EntityCreeper.class, (EntityCreeper) event.getEntityLiving(), 2, LibObfuscation.TIME_SINCE_IGNITED); + event.getEntityLiving().heal(event.getEntityLiving().getMaxHealth()); + if(event.getEntityLiving().isDead) + event.getEntityLiving().isDead = false; ManaItemHandler.requestManaExact(amulet, player, cost, true); player.worldObj.playSound(null, player.posX, player.posY, player.posZ, BotaniaSoundEvents.divaCharm, SoundCategory.PLAYERS, 1F, 1F); - double x = event.entityLiving.posX; - double y = event.entityLiving.posY; - double z = event.entityLiving.posZ; + double x = event.getEntityLiving().posX; + double y = event.getEntityLiving().posY; + double z = event.getEntityLiving().posZ; for(int i = 0; i < 50; i++) - Botania.proxy.sparkleFX(event.entityLiving.worldObj, x + Math.random() * event.entityLiving.width, y + Math.random() * event.entityLiving.height, z + Math.random() * event.entityLiving.width, 1F, 1F, 0.25F, 1F, 3); + Botania.proxy.sparkleFX(event.getEntityLiving().worldObj, x + Math.random() * event.getEntityLiving().width, y + Math.random() * event.getEntityLiving().height, z + Math.random() * event.getEntityLiving().width, 1F, 1F, 0.25F, 1F, 3); } } } diff --git a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemFlightTiara.java b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemFlightTiara.java index 1c0564804..8c1fe59c5 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemFlightTiara.java +++ b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemFlightTiara.java @@ -210,8 +210,8 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub @SubscribeEvent public void updatePlayerFlyStatus(LivingUpdateEvent event) { - if(event.entityLiving instanceof EntityPlayer) { - EntityPlayer player = (EntityPlayer) event.entityLiving; + if(event.getEntityLiving() instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) event.getEntityLiving(); ItemStack tiara = PlayerHandler.getPlayerBaubles(player).getStackInSlot(0); int left = ItemNBTHelper.getInt(tiara, TAG_TIME_LEFT, MAX_FLY_TIME); @@ -222,9 +222,9 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub if(!player.worldObj.isRemote) ManaItemHandler.requestManaExact(tiara, player, getCost(tiara, left), true); else if(Math.abs(player.motionX) > 0.1 || Math.abs(player.motionZ) > 0.1) { - double x = event.entityLiving.posX - 0.5; - double y = event.entityLiving.posY - 0.5; - double z = event.entityLiving.posZ - 0.5; + double x = event.getEntityLiving().posX - 0.5; + double y = event.getEntityLiving().posY - 0.5; + double z = event.getEntityLiving().posZ - 0.5; player.getGameProfile().getName(); float r = 1F; @@ -280,7 +280,7 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub } for(int i = 0; i < 2; i++) - Botania.proxy.sparkleFX(event.entityLiving.worldObj, x + Math.random() * event.entityLiving.width, y + Math.random() * 0.4, z + Math.random() * event.entityLiving.width, r, g, b, 2F * (float) Math.random(), 20); + Botania.proxy.sparkleFX(event.getEntityLiving().worldObj, x + Math.random() * event.getEntityLiving().width, y + Math.random() * 0.4, z + Math.random() * event.getEntityLiving().width, r, g, b, 2F * (float) Math.random(), 20); } } } else { diff --git a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemGoldenLaurel.java b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemGoldenLaurel.java index 576dda31d..0ba6e4442 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemGoldenLaurel.java +++ b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemGoldenLaurel.java @@ -44,8 +44,8 @@ public class ItemGoldenLaurel extends ItemBauble implements IBaubleRender { @SubscribeEvent(priority = EventPriority.HIGHEST) public void onPlayerDeath(LivingDeathEvent event) { - if(event.entity instanceof EntityPlayer) { - EntityPlayer player = (EntityPlayer) event.entity; + if(event.getEntityLiving() instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) event.getEntityLiving(); ItemStack amulet = PlayerHandler.getPlayerBaubles(player).getStackInSlot(0); if(amulet != null && amulet.getItem() == this) { diff --git a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemHolyCloak.java b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemHolyCloak.java index 58276a565..828b69f17 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemHolyCloak.java +++ b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemHolyCloak.java @@ -55,8 +55,8 @@ public class ItemHolyCloak extends ItemBauble implements IBaubleRender { @SubscribeEvent public void onPlayerDamage(LivingHurtEvent event) { - if(event.entityLiving instanceof EntityPlayer) { - EntityPlayer player = (EntityPlayer) event.entityLiving; + if(event.getEntityLiving() instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) event.getEntityLiving(); InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player); ItemStack belt = baubles.getStackInSlot(3); if(belt != null && belt.getItem() instanceof ItemHolyCloak && !isInEffect(belt)) { @@ -80,7 +80,7 @@ public class ItemHolyCloak extends ItemBauble implements IBaubleRender { } public boolean effectOnDamage(LivingHurtEvent event, EntityPlayer player, ItemStack stack) { - if(!event.source.isMagicDamage()) { + if(!event.getSource().isMagicDamage()) { event.setCanceled(true); player.worldObj.playSound(null, player.posX, player.posY, player.posZ, BotaniaSoundEvents.holyCloak, SoundCategory.PLAYERS, 1F, 1F); for(int i = 0; i < 30; i++) { diff --git a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemMagnetRing.java b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemMagnetRing.java index e368864aa..f17ee16a6 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemMagnetRing.java +++ b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemMagnetRing.java @@ -15,10 +15,12 @@ import java.util.List; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; +import net.minecraft.item.IItemPropertyGetter; import net.minecraft.item.ItemStack; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.item.ItemTossEvent; import vazkii.botania.api.BotaniaAPI; @@ -52,16 +54,22 @@ public class ItemMagnetRing extends ItemBauble { public ItemMagnetRing(String name, int range) { super(name); this.range = range; + addPropertyOverride(new ResourceLocation("botania", "on"), new IItemPropertyGetter() { + @Override + public float apply(ItemStack stack, World worldIn, EntityLivingBase entityIn) { + return ItemMagnetRing.getCooldown(stack) <= 0 ? 1 : 0; + } + }); } @SubscribeEvent public void onTossItem(ItemTossEvent event) { - InventoryBaubles inv = PlayerHandler.getPlayerBaubles(event.player); + InventoryBaubles inv = PlayerHandler.getPlayerBaubles(event.getPlayer()); for(int i = 0; i < inv.getSizeInventory(); i++) { ItemStack stack = inv.getStackInSlot(i); if(stack != null && stack.getItem() instanceof ItemMagnetRing) { setCooldown(stack, 100); - BotaniaAPI.internalHandler.sendBaubleUpdatePacket(event.player, i); + BotaniaAPI.internalHandler.sendBaubleUpdatePacket(event.getPlayer(), i); } } } diff --git a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemTravelBelt.java b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemTravelBelt.java index 69c0c4dcb..bc280391f 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemTravelBelt.java +++ b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemTravelBelt.java @@ -70,8 +70,8 @@ public class ItemTravelBelt extends ItemBauble implements IBaubleRender, IManaUs @SubscribeEvent public void updatePlayerStepStatus(LivingUpdateEvent event) { - if(event.entityLiving instanceof EntityPlayer) { - EntityPlayer player = (EntityPlayer) event.entityLiving; + if(event.getEntityLiving() instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) event.getEntityLiving(); String s = playerStr(player); ItemStack belt = PlayerHandler.getPlayerBaubles(player).getStackInSlot(3); @@ -119,8 +119,8 @@ public class ItemTravelBelt extends ItemBauble implements IBaubleRender, IManaUs @SubscribeEvent public void onPlayerJump(LivingJumpEvent event) { - if(event.entityLiving instanceof EntityPlayer) { - EntityPlayer player = (EntityPlayer) event.entityLiving; + if(event.getEntityLiving() instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) event.getEntityLiving(); ItemStack belt = PlayerHandler.getPlayerBaubles(player).getStackInSlot(3); if(belt != null && belt.getItem() instanceof ItemTravelBelt && ManaItemHandler.requestManaExact(belt, player, COST, false)) { diff --git a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemUnholyCloak.java b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemUnholyCloak.java index b967f1dad..063486d9c 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemUnholyCloak.java +++ b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemUnholyCloak.java @@ -38,13 +38,13 @@ public class ItemUnholyCloak extends ItemHolyCloak { @Override public boolean effectOnDamage(LivingHurtEvent event, EntityPlayer player, ItemStack stack) { - if(!event.source.isUnblockable()) { + if(!event.getSource().isUnblockable()) { int range = 6; List mobs = player.worldObj.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(player.posX - range, player.posY - range, player.posZ - range, player.posX + range, player.posY + range, player.posZ + range), Predicates.instanceOf(IMob.class)); for(IMob mob : ((List) mobs)) if(mob instanceof EntityLivingBase) { EntityLivingBase entity = (EntityLivingBase) mob; - entity.attackEntityFrom(DamageSource.causePlayerDamage(player), event.ammount); + entity.attackEntityFrom(DamageSource.causePlayerDamage(player), event.getAmount()); } player.worldObj.playSound(null, player.posX, player.posY, player.posZ, BotaniaSoundEvents.unholyCloak, SoundCategory.PLAYERS, 1F, 1F); diff --git a/src/main/java/vazkii/botania/common/item/equipment/tool/ItemGlassPick.java b/src/main/java/vazkii/botania/common/item/equipment/tool/ItemGlassPick.java index b82994d25..6b19405ba 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/tool/ItemGlassPick.java +++ b/src/main/java/vazkii/botania/common/item/equipment/tool/ItemGlassPick.java @@ -33,8 +33,8 @@ public class ItemGlassPick extends ItemManasteelPick { @SubscribeEvent public void onBlockDrops(HarvestDropsEvent event) { - if(event.harvester != null && event.state != null && event.drops.isEmpty() && event.harvester.getHeldItemMainhand() != null && event.harvester.getHeldItemMainhand().getItem() == this && event.state.getMaterial() == Material.glass && event.state.getBlock().canSilkHarvest(event.world, event.pos, event.state, event.harvester)) - event.drops.add(new ItemStack(event.state.getBlock(), 1, event.state.getBlock().getMetaFromState(event.state))); + if(event.getHarvester() != null && event.getState() != null && event.getDrops().isEmpty() && event.getHarvester().getHeldItemMainhand() != null && event.getHarvester().getHeldItemMainhand().getItem() == this && event.getState().getMaterial() == Material.glass && event.getState().getBlock().canSilkHarvest(event.getWorld(), event.getPos(), event.getState(), event.getHarvester())) + event.getDrops().add(new ItemStack(event.getState().getBlock(), 1, event.getState().getBlock().getMetaFromState(event.getState()))); } @Override diff --git a/src/main/java/vazkii/botania/common/item/equipment/tool/bow/ItemLivingwoodBow.java b/src/main/java/vazkii/botania/common/item/equipment/tool/bow/ItemLivingwoodBow.java index a88860db8..0f67d076e 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/tool/bow/ItemLivingwoodBow.java +++ b/src/main/java/vazkii/botania/common/item/equipment/tool/bow/ItemLivingwoodBow.java @@ -57,7 +57,6 @@ public class ItemLivingwoodBow extends ItemBow implements IManaUsingItem { setCreativeTab(BotaniaCreativeTab.INSTANCE); setUnlocalizedName(name); setMaxDamage(500); - setFull3D(); addPropertyOverride(new ResourceLocation("minecraft:pull"), new IItemPropertyGetter() { @Override public float apply(ItemStack stack, World worldIn, EntityLivingBase entityIn) { diff --git a/src/main/java/vazkii/botania/common/item/equipment/tool/elementium/ItemElementiumAxe.java b/src/main/java/vazkii/botania/common/item/equipment/tool/elementium/ItemElementiumAxe.java index cd41cdf8e..4de05f3af 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/tool/elementium/ItemElementiumAxe.java +++ b/src/main/java/vazkii/botania/common/item/equipment/tool/elementium/ItemElementiumAxe.java @@ -37,32 +37,32 @@ public class ItemElementiumAxe extends ItemManasteelAxe { @SubscribeEvent public void onEntityDrops(LivingDropsEvent event) { - if(event.recentlyHit && event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer) { - ItemStack weapon = ((EntityPlayer) event.source.getEntity()).getHeldItemMainhand(); + if(event.isRecentlyHit() && event.getSource().getEntity() != null && event.getSource().getEntity() instanceof EntityPlayer) { + ItemStack weapon = ((EntityPlayer) event.getSource().getEntity()).getHeldItemMainhand(); if(weapon != null && weapon.getItem() == this) { - Random rand = event.entity.worldObj.rand; + Random rand = event.getEntityLiving().worldObj.rand; int looting = EnchantmentHelper.getEnchantmentLevel(Enchantments.fortune, weapon); - if(event.entityLiving instanceof EntitySkeleton && rand.nextInt(26) <= 3 + looting) - addDrop(event, new ItemStack(Items.skull, 1, ((EntitySkeleton)event.entityLiving).getSkeletonType())); - else if(event.entityLiving instanceof EntityZombie && !(event.entityLiving instanceof EntityPigZombie) && rand.nextInt(26) <= 2 + 2 * looting) + if(event.getEntityLiving() instanceof EntitySkeleton && rand.nextInt(26) <= 3 + looting) + addDrop(event, new ItemStack(Items.skull, 1, ((EntitySkeleton)event.getEntityLiving()).getSkeletonType())); + else if(event.getEntityLiving() instanceof EntityZombie && !(event.getEntityLiving() instanceof EntityPigZombie) && rand.nextInt(26) <= 2 + 2 * looting) addDrop(event, new ItemStack(Items.skull, 1, 2)); - else if(event.entityLiving instanceof EntityCreeper && rand.nextInt(26) <= 2 + 2 * looting) + else if(event.getEntityLiving() instanceof EntityCreeper && rand.nextInt(26) <= 2 + 2 * looting) addDrop(event, new ItemStack(Items.skull, 1, 4)); - else if(event.entityLiving instanceof EntityPlayer && rand.nextInt(11) <= 1 + looting) { + else if(event.getEntityLiving() instanceof EntityPlayer && rand.nextInt(11) <= 1 + looting) { ItemStack stack = new ItemStack(Items.skull, 1, 3); - ItemNBTHelper.setString(stack, "SkullOwner", event.entityLiving.getName()); + ItemNBTHelper.setString(stack, "SkullOwner", event.getEntityLiving().getName()); addDrop(event, stack); - } else if(event.entityLiving instanceof EntityDoppleganger && rand.nextInt(13) < 1 + looting) + } else if(event.getEntityLiving() instanceof EntityDoppleganger && rand.nextInt(13) < 1 + looting) addDrop(event, new ItemStack(ModItems.gaiaHead)); } } } private void addDrop(LivingDropsEvent event, ItemStack drop) { - EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, drop); + EntityItem entityitem = new EntityItem(event.getEntityLiving().worldObj, event.getEntityLiving().posX, event.getEntityLiving().posY, event.getEntityLiving().posZ, drop); entityitem.setPickupDelay(10); - event.drops.add(entityitem); + event.getDrops().add(entityitem); } } diff --git a/src/main/java/vazkii/botania/common/item/equipment/tool/elementium/ItemElementiumPick.java b/src/main/java/vazkii/botania/common/item/equipment/tool/elementium/ItemElementiumPick.java index 594755f5a..30444395e 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/tool/elementium/ItemElementiumPick.java +++ b/src/main/java/vazkii/botania/common/item/equipment/tool/elementium/ItemElementiumPick.java @@ -21,16 +21,16 @@ public class ItemElementiumPick extends ItemManasteelPick { @SubscribeEvent public void onHarvestDrops(HarvestDropsEvent event) { - if(event.harvester != null) { - ItemStack stack = event.harvester.getHeldItemMainhand(); + if(event.getHarvester() != null) { + ItemStack stack = event.getHarvester().getHeldItemMainhand(); if(stack != null && (stack.getItem() == this || stack.getItem() == ModItems.terraPick && ItemTerraPick.isTipped(stack))) { - for(int i = 0; i < event.drops.size(); i++) { - ItemStack drop = event.drops.get(i); + for(int i = 0; i < event.getDrops().size(); i++) { + ItemStack drop = event.getDrops().get(i); if(drop != null) { Block block = Block.getBlockFromItem(drop.getItem()); if(block != null){ - if(isDisposable(block) || (isSemiDisposable(block) && !event.harvester.isSneaking())) - event.drops.remove(i); + if(isDisposable(block) || (isSemiDisposable(block) && !event.getHarvester().isSneaking())) + event.getDrops().remove(i); } } } diff --git a/src/main/java/vazkii/botania/common/item/equipment/tool/manasteel/ItemManasteelSword.java b/src/main/java/vazkii/botania/common/item/equipment/tool/manasteel/ItemManasteelSword.java index 979beed8d..71e9add70 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/tool/manasteel/ItemManasteelSword.java +++ b/src/main/java/vazkii/botania/common/item/equipment/tool/manasteel/ItemManasteelSword.java @@ -15,9 +15,11 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.IItemPropertyGetter; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import vazkii.botania.api.BotaniaAPI; @@ -42,6 +44,12 @@ public class ItemManasteelSword extends ItemSword implements IManaUsingItem { super(mat); setCreativeTab(BotaniaCreativeTab.INSTANCE); setUnlocalizedName(name); + addPropertyOverride(new ResourceLocation("botania", "elucidator"), new IItemPropertyGetter() { + @Override + public float apply(ItemStack stack, World worldIn, EntityLivingBase entityIn) { + return "the elucidator".equals(stack.getDisplayName().toLowerCase().trim()) ? 1 : 0; + } + }); } @Override diff --git a/src/main/java/vazkii/botania/common/item/relic/ItemAesirRing.java b/src/main/java/vazkii/botania/common/item/relic/ItemAesirRing.java index b513b7731..94998a50a 100644 --- a/src/main/java/vazkii/botania/common/item/relic/ItemAesirRing.java +++ b/src/main/java/vazkii/botania/common/item/relic/ItemAesirRing.java @@ -56,19 +56,19 @@ public class ItemAesirRing extends ItemRelicBauble implements IExtendedWireframe @SubscribeEvent public void onDropped(ItemTossEvent event) { - if(event.entityItem != null && event.entityItem.getEntityItem() != null && !event.entityItem.worldObj.isRemote) { - ItemStack stack = event.entityItem.getEntityItem(); + if(event.getEntityItem() != null && event.getEntityItem().getEntityItem() != null && !event.getEntityItem().worldObj.isRemote) { + ItemStack stack = event.getEntityItem().getEntityItem(); if(stack.getItem() != null && stack.getItem() == this) { - event.entityItem.setDead(); + event.getEntityItem().setDead(); UUID user = getSoulbindUUID(stack); for(Item item : new Item[] { ModItems.thorRing, ModItems.lokiRing, ModItems.odinRing }) { ItemStack stack1 = new ItemStack(item); bindToUUID(user, stack1); - EntityItem entity = new EntityItem(event.entityItem.worldObj, event.entityItem.posX, event.entityItem.posY, event.entityItem.posZ, stack1); - entity.motionX = event.entityItem.motionX; - entity.motionY = event.entityItem.motionY; - entity.motionZ = event.entityItem.motionZ; + EntityItem entity = new EntityItem(event.getEntityItem().worldObj, event.getEntityItem().posX, event.getEntityItem().posY, event.getEntityItem().posZ, stack1); + entity.motionX = event.getEntityItem().motionX; + entity.motionY = event.getEntityItem().motionY; + entity.motionZ = event.getEntityItem().motionZ; try { MethodHandles.itemAge_setter.invokeExact(entity, MethodHandles.itemAge_getter.invokeExact(entity)); @@ -76,7 +76,7 @@ public class ItemAesirRing extends ItemRelicBauble implements IExtendedWireframe int pickupDelay = 0; try { - pickupDelay = (int) MethodHandles.pickupDelay_getter.invokeExact(event.entityItem); + pickupDelay = (int) MethodHandles.pickupDelay_getter.invokeExact(event.getEntityItem()); } catch (Throwable ignored) {} entity.setPickupDelay(pickupDelay); diff --git a/src/main/java/vazkii/botania/common/item/relic/ItemOdinRing.java b/src/main/java/vazkii/botania/common/item/relic/ItemOdinRing.java index 93ddca992..30e075bae 100644 --- a/src/main/java/vazkii/botania/common/item/relic/ItemOdinRing.java +++ b/src/main/java/vazkii/botania/common/item/relic/ItemOdinRing.java @@ -63,9 +63,9 @@ public class ItemOdinRing extends ItemRelicBauble { @SubscribeEvent public void onPlayerAttacked(LivingAttackEvent event) { - if(event.entityLiving instanceof EntityPlayer) { - EntityPlayer player = (EntityPlayer) event.entityLiving; - if(getOdinRing(player) != null && damageNegations.contains(event.source.damageType)) + if(event.getEntityLiving() instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) event.getEntityLiving(); + if(getOdinRing(player) != null && damageNegations.contains(event.getSource().damageType)) event.setCanceled(true); } } diff --git a/src/main/java/vazkii/botania/common/item/rod/ItemExchangeRod.java b/src/main/java/vazkii/botania/common/item/rod/ItemExchangeRod.java index 89ade3110..89dd8f644 100644 --- a/src/main/java/vazkii/botania/common/item/rod/ItemExchangeRod.java +++ b/src/main/java/vazkii/botania/common/item/rod/ItemExchangeRod.java @@ -108,11 +108,11 @@ public class ItemExchangeRod extends ItemMod implements IManaUsingItem, IWirefra @SubscribeEvent public void onLeftClick(PlayerInteractEvent event) { - if(event.action == Action.LEFT_CLICK_BLOCK) { - ItemStack stack = event.entityPlayer.getHeldItemMainhand(); - if(stack != null && stack.getItem() == this && canExchange(stack) && ManaItemHandler.requestManaExactForTool(stack, event.entityPlayer, COST, false)) { - if(exchange(event.world, event.entityPlayer, event.pos, stack, getBlock(stack).getStateFromMeta(getBlockMeta(stack)))) - ManaItemHandler.requestManaExactForTool(stack, event.entityPlayer, COST, true); + if(event.getAction() == Action.LEFT_CLICK_BLOCK) { + ItemStack stack = event.getEntityPlayer().getHeldItemMainhand(); + if(stack != null && stack.getItem() == this && canExchange(stack) && ManaItemHandler.requestManaExactForTool(stack, event.getEntityPlayer(), COST, false)) { + if(exchange(event.getWorld(), event.getEntityPlayer(), event.getPos(), stack, getBlock(stack).getStateFromMeta(getBlockMeta(stack)))) + ManaItemHandler.requestManaExactForTool(stack, event.getEntityPlayer(), COST, true); } } } diff --git a/src/main/java/vazkii/botania/common/world/SkyblockWorldEvents.java b/src/main/java/vazkii/botania/common/world/SkyblockWorldEvents.java index b432083fa..7b830be89 100644 --- a/src/main/java/vazkii/botania/common/world/SkyblockWorldEvents.java +++ b/src/main/java/vazkii/botania/common/world/SkyblockWorldEvents.java @@ -26,7 +26,7 @@ import net.minecraft.world.World; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; -import net.minecraftforge.event.world.BlockEvent.HarvestDropsEvent; +import net.minecraftforge.event.world.BlockEvent; import vazkii.botania.common.block.ModBlocks; import vazkii.botania.common.block.tile.TileManaFlame; import vazkii.botania.common.item.ModItems; @@ -43,8 +43,8 @@ public final class SkyblockWorldEvents { @SubscribeEvent public void onPlayerUpdate(LivingUpdateEvent event) { - if(event.entityLiving instanceof EntityPlayer && !event.entity.worldObj.isRemote) { - EntityPlayer player = (EntityPlayer) event.entityLiving; + if(event.getEntityLiving() instanceof EntityPlayer && !event.getEntityLiving().worldObj.isRemote) { + EntityPlayer player = (EntityPlayer) event.getEntityLiving(); NBTTagCompound data = player.getEntityData(); if(!data.hasKey(EntityPlayer.PERSISTED_NBT_TAG)) data.setTag(EntityPlayer.PERSISTED_NBT_TAG, new NBTTagCompound()); @@ -66,24 +66,24 @@ public final class SkyblockWorldEvents { @SubscribeEvent public void onPlayerInteract(PlayerInteractEvent event) { - /*if(WorldTypeSkyblock.isWorldSkyblock(event.world)) { todo 1.9 + /*if(WorldTypeSkyblock.isWorldSkyblock(event.getWorld())) { todo 1.9 ItemStack equipped = event.entityPlayer.getCurrentEquippedItem(); if(event.action == Action.RIGHT_CLICK_BLOCK && equipped == null && event.entityPlayer.isSneaking()) { - Block block = event.world.getBlockState(event.pos).getBlock(); + Block block = event.getWorld().getBlockState(event.pos).getBlock(); if(block == Blocks.grass || block == Blocks.dirt) { - if(event.world.isRemote) + if(event.getWorld().isRemote) event.entityPlayer.swingItem(); else { - event.world.playSoundEffect(event.pos.getX() + 0.5, event.pos.getY() + 0.5, event.pos.getZ() + 0.5, block.stepSound.getBreakSound(), block.stepSound.getVolume() * 0.4F, block.stepSound.getFrequency() + (float) (Math.random() * 0.2 - 0.1)); + event.getWorld().playSoundEffect(event.pos.getX() + 0.5, event.pos.getY() + 0.5, event.pos.getZ() + 0.5, block.stepSound.getBreakSound(), block.stepSound.getVolume() * 0.4F, block.stepSound.getFrequency() + (float) (Math.random() * 0.2 - 0.1)); if(Math.random() < 0.8) event.entityPlayer.dropPlayerItemWithRandomChoice(new ItemStack(ModItems.manaResource, 1, 21), false); } } - } else if(equipped != null && equipped.getItem() == Items.bowl && event.action == Action.RIGHT_CLICK_BLOCK && !event.world.isRemote) { - RayTraceResult RayTraceResult = ToolCommons.raytraceFromEntity(event.world, event.entityPlayer, true, 4.5F); + } else if(equipped != null && equipped.getItem() == Items.bowl && event.action == Action.RIGHT_CLICK_BLOCK && !event.getWorld().isRemote) { + RayTraceResult RayTraceResult = ToolCommons.raytraceFromEntity(event.getWorld(), event.entityPlayer, true, 4.5F); if(RayTraceResult != null) { if (RayTraceResult.typeOfHit == net.minecraft.util.math.RayTraceResult.Type.BLOCK) { - if(event.world.getBlockState(RayTraceResult.getBlockPos()).getBlock().getMaterial() == Material.water) { + if(event.getWorld().getBlockState(RayTraceResult.getBlockPos()).getBlock().getMaterial() == Material.water) { --equipped.stackSize; if(equipped.stackSize <= 0) @@ -97,18 +97,18 @@ public final class SkyblockWorldEvents { } @SubscribeEvent - public void onDrops(HarvestDropsEvent event) { - if(WorldTypeSkyblock.isWorldSkyblock(event.world) && event.state.getBlock() == Blocks.tallgrass) { + public void onDrops(BlockEvent.HarvestDropsEvent event) { + if(WorldTypeSkyblock.isWorldSkyblock(event.getWorld()) && event.getState().getBlock() == Blocks.tallgrass) { ItemStack stackToRemove = null; - for(ItemStack stack : event.drops) - if(stack.getItem() == Items.wheat_seeds && event.world.rand.nextInt(4) == 0) { + for(ItemStack stack : event.getDrops()) + if(stack.getItem() == Items.wheat_seeds && event.getWorld().rand.nextInt(4) == 0) { stackToRemove = stack; break; } if(stackToRemove != null) { - event.drops.remove(stackToRemove); - event.drops.add(new ItemStack(event.world.rand.nextBoolean() ? Items.pumpkin_seeds : Items.melon_seeds)); + event.getDrops().remove(stackToRemove); + event.getDrops().add(new ItemStack(event.getWorld().rand.nextBoolean() ? Items.pumpkin_seeds : Items.melon_seeds)); } } } diff --git a/src/main/resources/assets/botania/models/item/crystalBow_pulling_1.json b/src/main/resources/assets/botania/models/item/crystalBow_pulling_1.json index 3cad87cf2..d907d7b2e 100644 --- a/src/main/resources/assets/botania/models/item/crystalBow_pulling_1.json +++ b/src/main/resources/assets/botania/models/item/crystalBow_pulling_1.json @@ -1,28 +1,6 @@ { - "parent": "minecraft:item/generated", + "parent": "botania:item/crystalBow", "textures": { "layer0": "botania:items/crystalBow1" - }, - "display": { - "thirdperson_righthand": { - "rotation": [ -80, 260, -40 ], - "translation": [ -1, -2, 2.5 ], - "scale": [ 0.9, 0.9, 0.9 ] - }, - "thirdperson_lefthand": { - "rotation": [ -80, -280, 40 ], - "translation": [ -1, -2, 2.5 ], - "scale": [ 0.9, 0.9, 0.9 ] - }, - "firstperson_righthand": { - "rotation": [ 0, -90, 25 ], - "translation": [ 1.13, 3.2, 1.13], - "scale": [ 0.68, 0.68, 0.68 ] - }, - "firstperson_lefthand": { - "rotation": [ 0, 90, -25 ], - "translation": [ 1.13, 3.2, 1.13], - "scale": [ 0.68, 0.68, 0.68 ] - } } } \ No newline at end of file diff --git a/src/main/resources/assets/botania/models/item/crystalBow_pulling_2.json b/src/main/resources/assets/botania/models/item/crystalBow_pulling_2.json index 205e705b4..87aa0174f 100644 --- a/src/main/resources/assets/botania/models/item/crystalBow_pulling_2.json +++ b/src/main/resources/assets/botania/models/item/crystalBow_pulling_2.json @@ -1,28 +1,6 @@ { - "parent": "minecraft:item/generated", + "parent": "botania:item/crystalBow", "textures": { "layer0": "botania:items/crystalBow2" - }, - "display": { - "thirdperson_righthand": { - "rotation": [ -80, 260, -40 ], - "translation": [ -1, -2, 2.5 ], - "scale": [ 0.9, 0.9, 0.9 ] - }, - "thirdperson_lefthand": { - "rotation": [ -80, -280, 40 ], - "translation": [ -1, -2, 2.5 ], - "scale": [ 0.9, 0.9, 0.9 ] - }, - "firstperson_righthand": { - "rotation": [ 0, -90, 25 ], - "translation": [ 1.13, 3.2, 1.13], - "scale": [ 0.68, 0.68, 0.68 ] - }, - "firstperson_lefthand": { - "rotation": [ 0, 90, -25 ], - "translation": [ 1.13, 3.2, 1.13], - "scale": [ 0.68, 0.68, 0.68 ] - } } } \ No newline at end of file diff --git a/src/main/resources/assets/botania/models/item/crystalBow_pulling_3.json b/src/main/resources/assets/botania/models/item/crystalBow_pulling_3.json index 835460709..cbc3df1f5 100644 --- a/src/main/resources/assets/botania/models/item/crystalBow_pulling_3.json +++ b/src/main/resources/assets/botania/models/item/crystalBow_pulling_3.json @@ -1,28 +1,6 @@ { - "parent": "minecraft:item/generated", + "parent": "botania:item/crystalBow", "textures": { "layer0": "botania:items/crystalBow3" - }, - "display": { - "thirdperson_righthand": { - "rotation": [ -80, 260, -40 ], - "translation": [ -1, -2, 2.5 ], - "scale": [ 0.9, 0.9, 0.9 ] - }, - "thirdperson_lefthand": { - "rotation": [ -80, -280, 40 ], - "translation": [ -1, -2, 2.5 ], - "scale": [ 0.9, 0.9, 0.9 ] - }, - "firstperson_righthand": { - "rotation": [ 0, -90, 25 ], - "translation": [ 1.13, 3.2, 1.13], - "scale": [ 0.68, 0.68, 0.68 ] - }, - "firstperson_lefthand": { - "rotation": [ 0, 90, -25 ], - "translation": [ 1.13, 3.2, 1.13], - "scale": [ 0.68, 0.68, 0.68 ] - } } } \ No newline at end of file diff --git a/src/main/resources/assets/botania/models/item/crystalBow_pulling_4.json b/src/main/resources/assets/botania/models/item/crystalBow_pulling_4.json index 6430d9d58..9ffa86873 100644 --- a/src/main/resources/assets/botania/models/item/crystalBow_pulling_4.json +++ b/src/main/resources/assets/botania/models/item/crystalBow_pulling_4.json @@ -1,28 +1,6 @@ { - "parent": "minecraft:item/generated", + "parent": "botania:item/crystalBow", "textures": { "layer0": "botania:items/crystalBow4" - }, - "display": { - "thirdperson_righthand": { - "rotation": [ -80, 260, -40 ], - "translation": [ -1, -2, 2.5 ], - "scale": [ 0.9, 0.9, 0.9 ] - }, - "thirdperson_lefthand": { - "rotation": [ -80, -280, 40 ], - "translation": [ -1, -2, 2.5 ], - "scale": [ 0.9, 0.9, 0.9 ] - }, - "firstperson_righthand": { - "rotation": [ 0, -90, 25 ], - "translation": [ 1.13, 3.2, 1.13], - "scale": [ 0.68, 0.68, 0.68 ] - }, - "firstperson_lefthand": { - "rotation": [ 0, 90, -25 ], - "translation": [ 1.13, 3.2, 1.13], - "scale": [ 0.68, 0.68, 0.68 ] - } } } \ No newline at end of file diff --git a/src/main/resources/assets/botania/models/item/crystalBow_pulling_5.json b/src/main/resources/assets/botania/models/item/crystalBow_pulling_5.json index ed9d6503b..b4d560244 100644 --- a/src/main/resources/assets/botania/models/item/crystalBow_pulling_5.json +++ b/src/main/resources/assets/botania/models/item/crystalBow_pulling_5.json @@ -1,28 +1,6 @@ { - "parent": "minecraft:item/generated", + "parent": "botania:item/crystalBow", "textures": { "layer0": "botania:items/crystalBow5" - }, - "display": { - "thirdperson_righthand": { - "rotation": [ -80, 260, -40 ], - "translation": [ -1, -2, 2.5 ], - "scale": [ 0.9, 0.9, 0.9 ] - }, - "thirdperson_lefthand": { - "rotation": [ -80, -280, 40 ], - "translation": [ -1, -2, 2.5 ], - "scale": [ 0.9, 0.9, 0.9 ] - }, - "firstperson_righthand": { - "rotation": [ 0, -90, 25 ], - "translation": [ 1.13, 3.2, 1.13], - "scale": [ 0.68, 0.68, 0.68 ] - }, - "firstperson_lefthand": { - "rotation": [ 0, 90, -25 ], - "translation": [ 1.13, 3.2, 1.13], - "scale": [ 0.68, 0.68, 0.68 ] - } } } \ No newline at end of file diff --git a/src/main/resources/assets/botania/models/item/livingwoodBow_pulling_1.json b/src/main/resources/assets/botania/models/item/livingwoodBow_pulling_1.json index 6d29694b9..3dd9b8449 100644 --- a/src/main/resources/assets/botania/models/item/livingwoodBow_pulling_1.json +++ b/src/main/resources/assets/botania/models/item/livingwoodBow_pulling_1.json @@ -1,28 +1,6 @@ { - "parent": "minecraft:item/generated", + "parent": "botania:item/livingwoodBow", "textures": { "layer0": "botania:items/livingwoodBow1" - }, - "display": { - "thirdperson_righthand": { - "rotation": [ -80, 260, -40 ], - "translation": [ -1, -2, 2.5 ], - "scale": [ 0.9, 0.9, 0.9 ] - }, - "thirdperson_lefthand": { - "rotation": [ -80, -280, 40 ], - "translation": [ -1, -2, 2.5 ], - "scale": [ 0.9, 0.9, 0.9 ] - }, - "firstperson_righthand": { - "rotation": [ 0, -90, 25 ], - "translation": [ 1.13, 3.2, 1.13], - "scale": [ 0.68, 0.68, 0.68 ] - }, - "firstperson_lefthand": { - "rotation": [ 0, 90, -25 ], - "translation": [ 1.13, 3.2, 1.13], - "scale": [ 0.68, 0.68, 0.68 ] - } } } \ No newline at end of file diff --git a/src/main/resources/assets/botania/models/item/livingwoodBow_pulling_2.json b/src/main/resources/assets/botania/models/item/livingwoodBow_pulling_2.json index c1baf4768..9b67919b4 100644 --- a/src/main/resources/assets/botania/models/item/livingwoodBow_pulling_2.json +++ b/src/main/resources/assets/botania/models/item/livingwoodBow_pulling_2.json @@ -1,28 +1,6 @@ { - "parent": "minecraft:item/generated", + "parent": "botania:item/livingwoodBow", "textures": { "layer0": "botania:items/livingwoodBow2" - }, - "display": { - "thirdperson_righthand": { - "rotation": [ -80, 260, -40 ], - "translation": [ -1, -2, 2.5 ], - "scale": [ 0.9, 0.9, 0.9 ] - }, - "thirdperson_lefthand": { - "rotation": [ -80, -280, 40 ], - "translation": [ -1, -2, 2.5 ], - "scale": [ 0.9, 0.9, 0.9 ] - }, - "firstperson_righthand": { - "rotation": [ 0, -90, 25 ], - "translation": [ 1.13, 3.2, 1.13], - "scale": [ 0.68, 0.68, 0.68 ] - }, - "firstperson_lefthand": { - "rotation": [ 0, 90, -25 ], - "translation": [ 1.13, 3.2, 1.13], - "scale": [ 0.68, 0.68, 0.68 ] - } } } \ No newline at end of file diff --git a/src/main/resources/assets/botania/models/item/livingwoodBow_pulling_3.json b/src/main/resources/assets/botania/models/item/livingwoodBow_pulling_3.json index 162be4377..ffa377cbb 100644 --- a/src/main/resources/assets/botania/models/item/livingwoodBow_pulling_3.json +++ b/src/main/resources/assets/botania/models/item/livingwoodBow_pulling_3.json @@ -1,28 +1,6 @@ { - "parent": "minecraft:item/generated", + "parent": "botania:item/livingwoodBow", "textures": { "layer0": "botania:items/livingwoodBow3" - }, - "display": { - "thirdperson_righthand": { - "rotation": [ -80, 260, -40 ], - "translation": [ -1, -2, 2.5 ], - "scale": [ 0.9, 0.9, 0.9 ] - }, - "thirdperson_lefthand": { - "rotation": [ -80, -280, 40 ], - "translation": [ -1, -2, 2.5 ], - "scale": [ 0.9, 0.9, 0.9 ] - }, - "firstperson_righthand": { - "rotation": [ 0, -90, 25 ], - "translation": [ 1.13, 3.2, 1.13], - "scale": [ 0.68, 0.68, 0.68 ] - }, - "firstperson_lefthand": { - "rotation": [ 0, 90, -25 ], - "translation": [ 1.13, 3.2, 1.13], - "scale": [ 0.68, 0.68, 0.68 ] - } } } \ No newline at end of file diff --git a/src/main/resources/assets/botania/models/item/magnetRing.json b/src/main/resources/assets/botania/models/item/magnetRing.json new file mode 100644 index 000000000..273320918 --- /dev/null +++ b/src/main/resources/assets/botania/models/item/magnetRing.json @@ -0,0 +1,12 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "botania:items/magnetRing1" + }, + "overrides": [{ + "predicate": { + "botania:on": 1 + }, + "model": "botania:item/magnetRingOn" + }] +} \ No newline at end of file diff --git a/src/main/resources/assets/botania/models/item/magnetRingGreater.json b/src/main/resources/assets/botania/models/item/magnetRingGreater.json new file mode 100644 index 000000000..f84549423 --- /dev/null +++ b/src/main/resources/assets/botania/models/item/magnetRingGreater.json @@ -0,0 +1,12 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "botania:items/magnetRingGreater1" + }, + "overrides": [{ + "predicate": { + "botania:on": 1 + }, + "model": "botania:item/magnetRingGreaterOn" + }] +} \ No newline at end of file diff --git a/src/main/resources/assets/botania/models/item/magnetRingGreaterOff.json b/src/main/resources/assets/botania/models/item/magnetRingGreaterOff.json deleted file mode 100644 index cc984190c..000000000 --- a/src/main/resources/assets/botania/models/item/magnetRingGreaterOff.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "minecraft:item/generated", - "textures": { - "layer0": "botania:items/magnetRingGreater1" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/botania/models/item/magnetRingOff.json b/src/main/resources/assets/botania/models/item/magnetRingOff.json deleted file mode 100644 index bce27d21e..000000000 --- a/src/main/resources/assets/botania/models/item/magnetRingOff.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "minecraft:item/generated", - "textures": { - "layer0": "botania:items/magnetRing1" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/botania/models/item/manasteelSword.json b/src/main/resources/assets/botania/models/item/manasteelSword.json index fff8c9a03..2279051fb 100644 --- a/src/main/resources/assets/botania/models/item/manasteelSword.json +++ b/src/main/resources/assets/botania/models/item/manasteelSword.json @@ -3,5 +3,11 @@ "textures": { "layer0": "botania:items/manasteelSword" - } + }, + "overrides": [{ + "predicate": { + "botania:elucidator": 1 + }, + "model": "botania:item/elucidator" + }] } \ No newline at end of file diff --git a/src/main/resources/assets/botania/models/item/spawnerMover.json b/src/main/resources/assets/botania/models/item/spawnerMover.json index faeaa3bbc..daaca965c 100644 --- a/src/main/resources/assets/botania/models/item/spawnerMover.json +++ b/src/main/resources/assets/botania/models/item/spawnerMover.json @@ -2,5 +2,11 @@ "parent": "minecraft:item/generated", "textures": { "layer0": "botania:items/spawnerMover0" - } + }, + "overrides": [{ + "predicate": { + "botania:full": 1 + }, + "model": "botania:item/spawnerMoverFull" + }] } \ No newline at end of file