From 1ed833a4a7587dd1363b8337bf8f9b4dc583126e Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Mon, 22 Feb 2016 23:10:01 -0600 Subject: [PATCH] Fix mistake in spawnerclaw, made debug atlas dump harder to trigger --- .../botania/client/core/handler/MiscellaneousIcons.java | 8 +++++--- .../vazkii/botania/common/block/tile/TileSpawnerClaw.java | 5 +++-- 2 files changed, 8 insertions(+), 5 deletions(-) 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 b650e965f..41d034aa5 100644 --- a/src/main/java/vazkii/botania/client/core/handler/MiscellaneousIcons.java +++ b/src/main/java/vazkii/botania/client/core/handler/MiscellaneousIcons.java @@ -19,6 +19,7 @@ import net.minecraft.launchwrapper.Launch; import net.minecraftforge.client.event.ModelBakeEvent; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.event.entity.player.ArrowLooseEvent; +import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.apache.commons.lang3.text.WordUtils; import org.lwjgl.BufferUtils; @@ -165,14 +166,15 @@ public class MiscellaneousIcons { @SubscribeEvent public void dumpAtlas(ArrowLooseEvent evt) { - if (!evt.entityPlayer.worldObj.isRemote || !((Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment"))) + if (!evt.entityPlayer.worldObj.isRemote || !((Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment")) + || !evt.entityPlayer.isSneaking()) return; Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); int width = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH); int height = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT); - System.out.printf("Atlas is %d wide by %d tall%n", width, height); + FMLLog.info("[Botania]: Dumped atlas %d wide by %d tall%n", width, height); int pixels = width * height; @@ -202,7 +204,7 @@ public class MiscellaneousIcons { try { ImageIO.write(bufferedimage, "png", result); } catch (IOException e) { - e.printStackTrace(); + FMLLog.warning("[Botania]: Failed to dump debug atlas"); } } diff --git a/src/main/java/vazkii/botania/common/block/tile/TileSpawnerClaw.java b/src/main/java/vazkii/botania/common/block/tile/TileSpawnerClaw.java index a9af18172..173ec7e81 100644 --- a/src/main/java/vazkii/botania/common/block/tile/TileSpawnerClaw.java +++ b/src/main/java/vazkii/botania/common/block/tile/TileSpawnerClaw.java @@ -91,8 +91,9 @@ public class TileSpawnerClaw extends TileMod implements IManaReceiver { EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving)entity : null; entity.setLocationAndAngles(d2, d3, d4, logic.getSpawnerWorld().rand.nextFloat() * 360.0F, 0.0F); - if(entityliving == null || entityliving.getCanSpawnHere() && entityliving.isNotColliding()) { - MethodHandles.spawnNewEntity.invokeExact(logic, entity, true); + if(entityliving == null || entityliving.getCanSpawnHere()) { + // Must accept return value so methodhandle dynamically binds correctly + Entity e = ((Entity) MethodHandles.spawnNewEntity.invokeExact(logic, entity, true)); this.getWorld().playAuxSFX(2004, logic.getSpawnerPosition(), 0); if(entityliving != null) {