diff --git a/dependencies.gradle b/dependencies.gradle index 0745e9c47..e252fc024 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -5,17 +5,18 @@ dependencies { implementation('com.github.GTNewHorizons:GT5-Unofficial:5.09.48.62:dev') implementation('com.github.GTNewHorizons:ForbiddenMagic:0.7.0-GTNH:dev') implementation('com.github.GTNewHorizons:twilightforest:2.6.27:dev') - implementation('curse.maven:travellers-gear-224440:2262113') implementation('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') - implementation('com.github.GTNewHorizons:CodeChickenLib:1.3.0:dev') implementation('com.github.GTNewHorizons:NotEnoughItems:2.6.11-GTNH:dev') + compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.5.0:dev') {transitive=false} compileOnly('com.github.GTNewHorizons:Botania:1.11.3-GTNH:api') {transitive=false} compileOnly('com.github.GTNewHorizons:CraftTweaker:3.3.1:dev') {transitive=false} compileOnly('com.github.GTNewHorizons:ZenScript:1.0.0-GTNH') {transitive=false} compileOnly('com.github.GTNewHorizons:MagicBees:2.8.1-GTNH:api') {transitive=false} + compileOnly('com.github.GTNewHorizons:TinkersConstruct:1.12.2-GTNH:dev') {transitive=false} + compileOnly(deobfCurse('enviromine-230236:2269710')) runtimeOnly('com.github.GTNewHorizons:Baubles:1.0.4:dev') } diff --git a/gradle.properties b/gradle.properties index 83b7693af..575fc033b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -41,19 +41,19 @@ developmentEnvironmentUserName = Developer # Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8. # See https://github.com/bsideup/jabel for details on how this works. -enableModernJavaSyntax = false +enableModernJavaSyntax = true # Enables injecting missing generics into the decompiled source code for a better coding experience. # Turns most publicly visible List, Map, etc. into proper List, Map types. -enableGenericInjection = false +enableGenericInjection = true # Generate a class with a String field for the mod version named as defined below. # If generateGradleTokenClass is empty or not missing, no such class will be generated. # If gradleTokenVersion is empty or missing, the field will not be present in the class. -generateGradleTokenClass = +generateGradleTokenClass = witchinggadgets.Tags # Name of the token containing the project's current version to generate/replace. -gradleTokenVersion = GRADLETOKEN_VERSION +gradleTokenVersion = VERSION # [DEPRECATED] Mod ID replacement token. gradleTokenModId = @@ -70,7 +70,7 @@ gradleTokenGroupName = # The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's # version in @Mod([...], version = VERSION, [...]). # Leave these properties empty to skip individual token replacements. -replaceGradleTokenInFile = WitchingGadgets.java +replaceGradleTokenInFile = # In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can # leave this property empty. diff --git a/src/main/java/witchinggadgets/WitchingGadgets.java b/src/main/java/witchinggadgets/WitchingGadgets.java index b142b39a4..9d03182e0 100644 --- a/src/main/java/witchinggadgets/WitchingGadgets.java +++ b/src/main/java/witchinggadgets/WitchingGadgets.java @@ -58,7 +58,7 @@ public class WitchingGadgets { public static final String MODID = "WitchingGadgets"; public static final String MODNAME = "Witching Gadgets"; - public static final String VERSION = "GRADLETOKEN_VERSION"; + public static final String VERSION = Tags.VERSION; public PlayerTickHandler playerTickHandler; diff --git a/src/main/java/witchinggadgets/client/ClientEventHandler.java b/src/main/java/witchinggadgets/client/ClientEventHandler.java index 0e403ed90..0a9e8860d 100644 --- a/src/main/java/witchinggadgets/client/ClientEventHandler.java +++ b/src/main/java/witchinggadgets/client/ClientEventHandler.java @@ -129,13 +129,12 @@ public void handleMouse(MouseEvent event) { int my = event.y - mc.displayHeight / 2; double radius = Math.sqrt(mx * mx + my * my); - double cx = mx / radius; // Math.cos(Math.toRadians(angle)); + double cx = mx / radius; double angle = (mx < 0 ? 180 : 0) + Math.abs( (mx < 0 ? -180 : 0) + (my < 0 ? 90 : 0) + Math.abs((my < 0 ? -90 : 0) + Math.abs(Math.toDegrees(Math.acos(cx)) - 90))); int sel = angle > 288 ? 0 : angle < 72 ? 1 : 2 + (int) ((288 - angle) / 72); WitchingGadgets.packetHandler.sendToServer(new MessagePrimordialGlove(player, (byte) 0, sel)); - // WGPacketPipeline.INSTANCE.sendToServer(new PacketPrimordialGlove(player, (byte)0, sel)); } } @@ -152,14 +151,14 @@ public void renderGameOverlay(RenderGameOverlayEvent.Pre event) { ClientUtilities.bindTexture("witchinggadgets:textures/gui/steam_overlay.png"); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(0.0D, (double) event.resolution.getScaledHeight(), -90.0D, 0.0D, 1.0D); + tessellator.addVertexWithUV(0.0D, event.resolution.getScaledHeight(), -90.0D, 0.0D, 1.0D); tessellator.addVertexWithUV( - (double) event.resolution.getScaledWidth(), - (double) event.resolution.getScaledHeight(), + event.resolution.getScaledWidth(), + event.resolution.getScaledHeight(), -90.0D, 1.0D, 1.0D); - tessellator.addVertexWithUV((double) event.resolution.getScaledWidth(), 0.0D, -90.0D, 1.0D, 0.0D); + tessellator.addVertexWithUV(event.resolution.getScaledWidth(), 0.0D, -90.0D, 1.0D, 0.0D); tessellator.addVertexWithUV(0.0D, 0.0D, -90.0D, 0.0D, 0.0D); tessellator.draw(); GL11.glDepthMask(true); @@ -175,7 +174,7 @@ public void renderGameOverlay(RenderGameOverlayEvent.Pre event) { || !(mc.thePlayer.getCurrentEquippedItem().getItem() instanceof ItemPrimordialGlove))) WGKeyHandler.gemLock = false; - GL11.glEnable(3042); + GL11.glEnable(GL11.GL_BLEND); double rad = 50 * WGKeyHandler.gemRadial; int x = event.resolution.getScaledWidth() / 2; int y = event.resolution.getScaledHeight() / 2; @@ -217,8 +216,7 @@ public void renderGameOverlay(RenderGameOverlayEvent.Pre event) { (my < 0 ? -90 : 0) + Math.abs(Math.toDegrees(Math.acos(mx / reverseRadius)) - 90))); int sel = reverseAngle > 288 ? 0 : reverseAngle < 72 ? 1 : 2 + (int) ((288 - reverseAngle) / 72); - // - // mc.fontRenderer.drawString("mPos: "+mx+", "+my+", sel: "+sel, x, y, 0xffffff); + GL11.glPushMatrix(); for (int g = 0; g < gems.length; g++) if (gems[g] != null) { int ix = (int) (((g == 0 ? -54 : g == 1 ? 13 : g == 3 ? -22 : g == 2 ? -76 : 35) / 256f) * rad * 2); @@ -229,24 +227,16 @@ public void renderGameOverlay(RenderGameOverlayEvent.Pre event) { GL11.glDisable(GL11.GL_LIGHTING); GL11.glDepthMask(false); ClientUtilities.bindTexture("witchinggadgets:textures/models/white.png"); - GL11.glEnable(3042); GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(770, 771); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); for (int j1 = 0; j1 < 2; ++j1) { tessellator.startDrawingQuads(); tessellator.setColorRGBA_I(0, 64); - tessellator.addVertexWithUV(ix - 2 + 00, iy - 2 + 20, 50, 0, 1); // ((f2 + (float)p5 * f4) * - // f), )((f3 + (float)p5) * - // f1)); - tessellator.addVertexWithUV(ix - 2 + 20, iy - 2 + 20, 50, 1, 1); // ((f2 + (float)p4 + - // (float)p5 * f4) * f), - // ((f3 + (float)p5) * - // f1)); - tessellator.addVertexWithUV(ix - 2 + 20, iy - 2 + 00, 50, 1, 0); // ((f2 + (float)p4) * f), - // ((f3 + 0.0F) * f1)); - tessellator.addVertexWithUV(ix - 2 + 00, iy - 2 + 00, 50, 0, 0); // ((f2 + 0.0F) * f), ((f3 - // + 0.0F) * f1)); + tessellator.addVertexWithUV(ix - 2, iy - 2 + 20, 50, 0, 1); + tessellator.addVertexWithUV(ix - 2 + 20, iy - 2 + 20, 50, 1, 1); + tessellator.addVertexWithUV(ix - 2 + 20, iy - 2, 50, 1, 0); + tessellator.addVertexWithUV(ix - 2, iy - 2, 50, 0, 0); tessellator.draw(); } @@ -329,7 +319,7 @@ public void setSpecialRendersLiving(RenderLivingEvent.Pre event) { .getPlayerEntityByName(event.entity.getCommandSenderName()); if (pl != null) for (ItemStack cloak : Utilities.getActiveMagicalCloak(pl)) if (cloak != null && cloak.hasTagCompound() && cloak.getTagCompound().getBoolean("isSpectral")) { - GL11.glEnable(3042); + GL11.glEnable(GL11.GL_BLEND); boolean goggles = Minecraft.getMinecraft().thePlayer.getEquipmentInSlot(4) != null && (Minecraft.getMinecraft().thePlayer.getEquipmentInSlot(4).getItem() instanceof IRevealer || Minecraft.getMinecraft().thePlayer.getEquipmentInSlot(4) @@ -355,7 +345,7 @@ public void resetResetSpecialLiving(RenderLivingEvent.Post event) { .getPlayerEntityByName(event.entity.getCommandSenderName()); if (pl != null) for (ItemStack cloak : Utilities.getActiveMagicalCloak(pl)) if (cloak != null && cloak.hasTagCompound() && cloak.getTagCompound().getBoolean("isSpectral")) { - GL11.glDisable(3042); + GL11.glDisable(GL11.GL_BLEND); GL11.glColor4f(1, 1, 1, 1); } } diff --git a/src/main/java/witchinggadgets/client/ClientProxy.java b/src/main/java/witchinggadgets/client/ClientProxy.java index 505325e80..84f671f4e 100644 --- a/src/main/java/witchinggadgets/client/ClientProxy.java +++ b/src/main/java/witchinggadgets/client/ClientProxy.java @@ -109,8 +109,6 @@ public void registerRenders() { MinecraftForgeClient.registerItemRenderer(WGContent.ItemCapsule, new ItemRenderCapsule()); RenderingRegistry.registerEntityRenderingHandler(EntityItemReforming.class, new EntityRenderReforming()); - // MinecraftForgeClient.registerItemRenderer(WGContent.BlockWoodenDevice.blockID, new - // ItemRenderSpinningWheel()); } public void registerHandlers() { diff --git a/src/main/java/witchinggadgets/client/ClientTickHandler.java b/src/main/java/witchinggadgets/client/ClientTickHandler.java index 3dec8a81c..c6882eb0b 100644 --- a/src/main/java/witchinggadgets/client/ClientTickHandler.java +++ b/src/main/java/witchinggadgets/client/ClientTickHandler.java @@ -17,17 +17,15 @@ public class ClientTickHandler { - public static HashMap oreHighlightMap = new HashMap(); - public static HashMap oreHighlightBeamMap = new HashMap(); + public static HashMap oreHighlightMap = new HashMap<>(); + public static HashMap oreHighlightBeamMap = new HashMap<>(); static int highlight; @SideOnly(Side.CLIENT) @SubscribeEvent public void renderTick(TickEvent.RenderTickEvent event) { - if (!(Minecraft.getMinecraft().renderViewEntity instanceof EntityPlayer)) return; - EntityPlayer player = (EntityPlayer) Minecraft.getMinecraft().renderViewEntity; - if (player == null || oreHighlightMap.isEmpty()) { - oreHighlightMap.clear(); + if (!(Minecraft.getMinecraft().renderViewEntity instanceof EntityPlayer player)) return; + if (oreHighlightMap.isEmpty()) { oreHighlightBeamMap.clear(); highlight = 0; return; @@ -43,18 +41,11 @@ public void renderTick(TickEvent.RenderTickEvent event) { double[] hand = ClientUtilities.getPlayerHandPos(player, true); - // Thaumcraft.proxy.wispFX3(player.worldObj, hand[0],hand[1],hand[2], x,y,z, .15f,3,false,0); FXWisp ef = new FXWisp(player.worldObj, hand[0], hand[1], hand[2], x, y, z, .05f, 3); ef.noClip = true; ef.setGravity(0); ef.shrink = true; - ParticleEngine.instance.addEffect(player.worldObj, ef); - - // oreHighlightBeamMap.put(e.getKey(), Thaumcraft.proxy.beamPower(player.worldObj, hand[0],hand[1],hand[2], - // x,y,z, 0, 1, 0, true, oreHighlightBeamMap.get(e.getKey())));//beamBore(Minecraft.getMinecraft().theWorld, - // x,y,z, hand[0],hand[1],hand[2], 1,Aspect.EARTH.getColor(), true, .2f, - // oreHighlightBeamMap.get(e.getKey()), 0)); highlight++; if (highlight >= oreHighlightMap.size()) highlight = 0; } diff --git a/src/main/java/witchinggadgets/client/ClientUtilities.java b/src/main/java/witchinggadgets/client/ClientUtilities.java index 845150cbb..cc064f1dd 100644 --- a/src/main/java/witchinggadgets/client/ClientUtilities.java +++ b/src/main/java/witchinggadgets/client/ClientUtilities.java @@ -8,7 +8,6 @@ import java.util.Collections; import java.util.Comparator; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import javax.imageio.ImageIO; @@ -32,6 +31,7 @@ import org.apache.logging.log4j.Level; import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; import thaumcraft.api.aspects.Aspect; import witchinggadgets.WitchingGadgets; @@ -218,10 +218,10 @@ public static void renderIconWithMask(IIcon icon, IIcon mask, Color colour, colour.getGreen() / 255f, colour.getBlue() / 255f, colour.getAlpha() / 255f); - GL11.glEnable(3042); - GL11.glBlendFunc(770, 771); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glDisable(2884); + GL11.glDisable(GL11.GL_CULL_FACE); Tessellator localTessellator = Tessellator.instance; localTessellator.startDrawingQuads(); localTessellator.setNormal(0.0F, 0.0F, 1.0F); @@ -266,7 +266,7 @@ public static void renderIconWithMask(IIcon icon, IIcon mask, Color colour, // RenderHelper.setBlockTextureSheet(); bindTexture("textures/atlas/blocks.png"); - GL11.glDepthFunc(514); + GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDepthMask(false); localTessellator.startDrawingQuads(); @@ -309,10 +309,10 @@ public static void renderIconWithMask(IIcon icon, IIcon mask, Color colour, } localTessellator.draw(); - GL11.glDisable(3042); + GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); - GL11.glDepthFunc(515); - GL11.glEnable(2884); + GL11.glDepthFunc(GL11.GL_LEQUAL); + GL11.glEnable(GL11.GL_CULL_FACE); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); } @@ -321,13 +321,11 @@ public static void drawTooltipHoveringText(GuiScreen gui, List list, int if ((list == null) || (list.isEmpty())) { return; } - GL11.glDisable(32826); - GL11.glDisable(2896); - GL11.glDisable(2929); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_DEPTH_TEST); int k = minimalWidth; - Iterator iterator = list.iterator(); - while (iterator.hasNext()) { - String s = (String) iterator.next(); + for (String s : list) { int l = font.getStringWidth(s); if (l > k) { k = l; @@ -346,8 +344,6 @@ public static void drawTooltipHoveringText(GuiScreen gui, List list, int j1 = gui.height - k1 - 6; } - // gui.zLevel = 300.0F; - // GuiContainer.itemRenderer.zLevel = 300.0F; int l1 = -267386864; drawGradientRect(i1 - 3, j1 - 4, i1 + k + 3, j1 - 3, l1, l1); drawGradientRect(i1 - 3, j1 + k1 + 3, i1 + k + 3, j1 + k1 + 4, l1, l1); @@ -362,25 +358,13 @@ public static void drawTooltipHoveringText(GuiScreen gui, List list, int drawGradientRect(i1 - 3, j1 + k1 + 2, i1 + k + 3, j1 + k1 + 3, j2, j2); drawHoveringText(list, i1, j1, font); - // for (int k2 = 0; k2 < list.size(); k2++) - // { - // String s1 = (String)list.get(k2); - // font.drawStringWithShadow(s1, i1, j1, -1); - // if (k2 == 0) { - // j1 += 2; - // } - // j1 += 10; - // } - // gui.zLevel = 0.0F; - // GuiContainer.itemRenderer.zLevel = 0.0F; - // GL11.glEnable(2896); - GL11.glEnable(2929); - GL11.glEnable(32826); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); } public static void drawHoveringText(List list, int x, int y, FontRenderer font) { for (int iS = 0; iS < list.size(); iS++) { - String s1 = (String) list.get(iS); + String s1 = list.get(iS); font.drawStringWithShadow(s1, x, y, -1); if (iS == 0) { y += 2; @@ -405,11 +389,11 @@ public static void drawGradientRect(int par1, int par2, int par3, int par4, int GL11.glShadeModel(GL11.GL_SMOOTH); Tessellator.instance.startDrawingQuads(); Tessellator.instance.setColorRGBA_F(f1, f2, f3, f); - Tessellator.instance.addVertex((double) par3, (double) par2, (double) 500); - Tessellator.instance.addVertex((double) par1, (double) par2, (double) 500); + Tessellator.instance.addVertex(par3, par2, 500); + Tessellator.instance.addVertex(par1, par2, 500); Tessellator.instance.setColorRGBA_F(f5, f6, f7, f4); - Tessellator.instance.addVertex((double) par1, (double) par4, (double) 500); - Tessellator.instance.addVertex((double) par3, (double) par4, (double) 500); + Tessellator.instance.addVertex(par1, par4, 500); + Tessellator.instance.addVertex(par3, par4, 500); Tessellator.instance.draw(); GL11.glShadeModel(GL11.GL_FLAT); GL11.glDisable(GL11.GL_BLEND); @@ -435,8 +419,8 @@ public static double[] getPlayerHandPos(EntityPlayer player, boolean targetItem) return new double[] { x - xOff * radius, y, z - zOff * radius }; } - static HashMap modelMap = new HashMap(); - static HashMap textureMap = new HashMap(); + static HashMap modelMap = new HashMap<>(); + static HashMap textureMap = new HashMap<>(); public static void bindTexture(String path) { mc().getTextureManager().bindTexture(getResource(path)); @@ -633,83 +617,23 @@ public static void addBoxToBlockrender(Vec3 offset, double xMin, double yMin, do icon.getInterpolatedV(16 - yMax * 16)); } - // public static Framebuffer stackBuffer; - // /** Thanks TTFTCUTS! :P */ - // public static BufferedImage getItemStackImage(ItemStack stack) - // { - // if (stackBuffer == null) - // stackBuffer = new Framebuffer(16,16,true); - // Minecraft mc = Minecraft.getMinecraft(); - // // bind the buffer and such - // GL11.glPushMatrix(); - // GL11.glLoadIdentity(); - // stackBuffer.bindFramebuffer(true); - // GL11.glClearColor(0, 0, 0, 0); - // GL11.glClear(GL11.GL_STENCIL_BUFFER_BIT | GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); - // GL11.glMatrixMode(GL11.GL_PROJECTION); - // GL11.glLoadIdentity(); - // GL11.glOrtho(0.0D, 16, 16, 0.0D, 1000.0D, 3000.0D); - // GL11.glMatrixMode(GL11.GL_MODELVIEW); - // GL11.glLoadIdentity(); - // GL11.glTranslatef(0.0F, 0.0F, -2000.0F); - // //GL11.glTranslatef(0, 0, -5); - // GL11.glColor3f(1, 0, 0); - // // draw image - // RenderItem render = new RenderItem(); - // GL11.glPushMatrix(); - // GL11.glEnable(GL11.GL_BLEND); - // GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - // RenderHelper.enableGUIStandardItemLighting(); - // GL11.glEnable(GL12.GL_RESCALE_NORMAL); - // GL11.glEnable(GL11.GL_DEPTH_TEST); - // render.renderItemIntoGUI(mc.fontRenderer, mc.getTextureManager(), stack, 0, 0); - // RenderHelper.disableStandardItemLighting(); - // GL11.glDisable(GL11.GL_BLEND); - // GL11.glPopMatrix(); - // // set back to normal - // stackBuffer.unbindFramebuffer(); - // GL11.glPopMatrix(); - // // dump to image - // int width = 16; - // int height = 16; - // int length = width * height; - // IntBuffer data = BufferUtils.createIntBuffer(length); - // BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); - // GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1); - // GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1); - // GL11.glBindTexture(GL11.GL_TEXTURE_2D, stackBuffer.framebufferTexture); - // GL11.glGetTexImage(GL11.GL_TEXTURE_2D, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, data); - // int[] dataarray = new int[length]; - // data.get(dataarray); - // TextureUtil.func_147953_a(dataarray, 16, 16); - // int l = stackBuffer.framebufferTextureHeight - stackBuffer.framebufferHeight; - // image.setRGB(0, 0, 16, 16, dataarray, 0, 16); - // for (int i1 = l; i1 < stackBuffer.framebufferTextureHeight; ++i1) - // for (int j1 = 0; j1 < stackBuffer.framebufferWidth; ++j1) - // image.setRGB(j1, i1 - l, dataarray[i1 * stackBuffer.framebufferTextureWidth + j1]); - // // send out the image - // return image; - // } - public static BufferedImage getImageForResource(ResourceLocation resource) throws IOException { InputStream layer = Minecraft.getMinecraft().getResourceManager().getResource(resource).getInputStream(); return ImageIO.read(layer); } public static List getItemColours(ItemStack stack) { - List colourSet = new ArrayList(); + List colourSet = new ArrayList<>(); Item item = stack.getItem(); ResourceLocation resource; BufferedImage buffered; - // = item.getSpriteNumber()==1?TextureMap.locationItemsTexture:TextureMap.locationBlocksTexture; try { for (int pass = 0; pass < item.getRenderPasses(stack.getItemDamage()); pass++) { IIcon icon = item.getIcon(stack, pass); - if (icon instanceof TextureAtlasSprite) { - TextureAtlasSprite tas = (TextureAtlasSprite) icon; + if (icon instanceof TextureAtlasSprite tas) { String iconName = tas.getIconName(); iconName = iconName.substring(0, Math.max(0, iconName.indexOf(":") + 1)) + (item.getSpriteNumber() == 0 ? "textures/blocks/" : "textures/items/") @@ -747,7 +671,7 @@ public static int getAverageItemColour(ItemStack stack) { } public static List getImageColours(BufferedImage image) { - List colourSet = new ArrayList(); + List colourSet = new ArrayList<>(); int[] data = new int[image.getWidth() * image.getHeight()]; image.getRGB(0, 0, image.getWidth(), image.getHeight(), data, 0, image.getWidth()); for (int i = 0; i < data.length; i++) colourSet.add(data[i]); diff --git a/src/main/java/witchinggadgets/client/ThaumonomiconIndexSearcher.java b/src/main/java/witchinggadgets/client/ThaumonomiconIndexSearcher.java index ccb40bdd5..80d225ca4 100644 --- a/src/main/java/witchinggadgets/client/ThaumonomiconIndexSearcher.java +++ b/src/main/java/witchinggadgets/client/ThaumonomiconIndexSearcher.java @@ -141,7 +141,7 @@ public void onGuiPostDraw(GuiScreenEvent.DrawScreenEvent.Post event) { if (!searchResults.isEmpty()) { ClientUtilities.bindTexture("thaumcraft:textures/misc/parchment3.png"); - GL11.glEnable(3042); + GL11.glEnable(GL11.GL_BLEND); Tessellator tes = Tessellator.instance; tes.startDrawingQuads(); tes.setColorOpaque_I(0xffffff); @@ -218,7 +218,7 @@ public void renderTick(TickEvent.ClientTickEvent event) { static String searchCategory; static String lastKeyword; - static List searchResults = new ArrayList(); + static List searchResults = new ArrayList<>(); static void buildEntryList(String query) { if (query == null || query.isEmpty()) { @@ -226,18 +226,18 @@ static void buildEntryList(String query) { return; } query = query.toLowerCase(); - List valids = new ArrayList(); + List valids = new ArrayList<>(); Set keys; if (searchCategory != null && !searchCategory.isEmpty()) keys = ResearchCategories.getResearchList(searchCategory).research.keySet(); else { - keys = new HashSet(); + keys = new HashSet<>(); for (ResearchCategoryList cat : ResearchCategories.researchCategories.values()) keys.addAll(cat.research.keySet()); } - Set recipeBased = new HashSet(); - Set usedResearches = new HashSet(); + Set recipeBased = new HashSet<>(); + Set usedResearches = new HashSet<>(); for (String key : keys) if (key != null && !key.isEmpty() && ResearchCategories.getResearch(key) != null && ThaumcraftApiHelper diff --git a/src/main/java/witchinggadgets/client/gui/GuiCuttingTable.java b/src/main/java/witchinggadgets/client/gui/GuiCuttingTable.java index b84147028..b31454dbc 100644 --- a/src/main/java/witchinggadgets/client/gui/GuiCuttingTable.java +++ b/src/main/java/witchinggadgets/client/gui/GuiCuttingTable.java @@ -35,7 +35,7 @@ protected void drawGuiContainerBackgroundLayer(float par1, int mX, int mY) { int xOff = this.tile.targetGemCut == 0 ? 0 : 80; int yOff = this.tile.targetGemCut == 0 ? 0 : 80; Tessellator tes = Tessellator.instance; - GL11.glEnable(3042); + GL11.glEnable(GL11.GL_BLEND); tes.startDrawingQuads(); tes.addVertexWithUV(guiLeft + 73, guiTop + 17, 0, (xOff) / 255f, (yOff) / 255f); tes.addVertexWithUV(guiLeft + 73, guiTop + 47, 0, (xOff) / 255f, (yOff + 80) / 255f); @@ -53,18 +53,13 @@ protected void mouseClicked(int mX, int mY, int button) { mY -= (height - ySize) / 2; if (mY > 12 && mY < 24) { int old = this.tile.targetGemCut; - if (mX > 106 && mX < 117) - // this.tile.targetGemCut = (byte) (old==0?1:0); - this.tile.targetGemCut++; - if (mX > 59 && mX < 70) - // this.tile.targetGemCut = (byte) (old==0?1:0); - this.tile.targetGemCut--; + if (mX > 106 && mX < 117) this.tile.targetGemCut++; + if (mX > 59 && mX < 70) this.tile.targetGemCut--; if (this.tile.targetGemCut < 0) this.tile.targetGemCut = (byte) (ItemInfusedGem.GemCut.values().length - 1); else if (this.tile.targetGemCut >= ItemInfusedGem.GemCut.values().length) this.tile.targetGemCut = 0; if (this.tile.targetGemCut != old) WitchingGadgets.packetHandler.sendToServer(new MessageTileUpdate(this.tile)); - // WGPacketPipeline.INSTANCE.sendToServer(new PacketTileUpdate(this.tile)); } } } diff --git a/src/main/java/witchinggadgets/client/gui/GuiLabelLibrary.java b/src/main/java/witchinggadgets/client/gui/GuiLabelLibrary.java index 67712097e..8d51d00d6 100644 --- a/src/main/java/witchinggadgets/client/gui/GuiLabelLibrary.java +++ b/src/main/java/witchinggadgets/client/gui/GuiLabelLibrary.java @@ -49,9 +49,6 @@ protected void drawGuiContainerBackgroundLayer(float par1, int mX, int mY) { GL11.glScalef(1 / scale, 1 / scale, 1); UtilsFX.drawTag(guiLeft + 8, guiTop + 30, tile.aspect, 0.0F, 0, zLevel); - - // if(this.tile.getOutput()!=null) - // this.drawVirtualItem(tile.getOutput(), guiLeft+118,guiTop+24, false, mX, mY, false); } @Override @@ -72,6 +69,5 @@ protected void mouseClicked(int mX, int mY, int button) { i++; } if (tile.aspect != old) WitchingGadgets.packetHandler.sendToServer(new MessageTileUpdate(this.tile)); - // WGPacketPipeline.INSTANCE.sendToServer(new PacketTileUpdate(tile)); } } diff --git a/src/main/java/witchinggadgets/client/gui/GuiPrimordialGlove.java b/src/main/java/witchinggadgets/client/gui/GuiPrimordialGlove.java index 87e382877..c08c9c27a 100644 --- a/src/main/java/witchinggadgets/client/gui/GuiPrimordialGlove.java +++ b/src/main/java/witchinggadgets/client/gui/GuiPrimordialGlove.java @@ -26,14 +26,6 @@ public class GuiPrimordialGlove extends GuiContainer { - String tx1 = "textures/misc/node.png"; - String tx_c_n = "textures/misc/node_core_normal.png"; - String tx_c_d = "textures/misc/node_core_dark.png"; - String tx_c_u = "textures/misc/node_core_unstable.png"; - String tx_c_t = "textures/misc/node_core_taint.png"; - String tx_c_p = "textures/misc/node_core_pure.png"; - String tx_c_h = "textures/misc/node_core_hungry.png"; - InventoryPlayer invPlayer; EntityPlayer player; protected Slot theSlot; @@ -83,7 +75,7 @@ protected void drawGuiContainerForegroundLayer(int par1, int par2) { @Override protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - GL11.glEnable(3042); + GL11.glEnable(GL11.GL_BLEND); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); ClientUtilities.bindTexture("witchinggadgets:textures/gui/primordialGlove.png"); int k = (this.width - this.xSize) / 2; @@ -111,8 +103,8 @@ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { float radius = 10 + 8 * mod * (aspects.getAmount(a) / average); int perm = (int) ((System.currentTimeMillis() / 64) % 32) + count * 4; GL11.glPushMatrix(); - GL11.glEnable(3042); - GL11.glBlendFunc(770, 771); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); tes.startDrawingQuads(); tes.setColorRGBA_I(a.getColor(), 64); @@ -122,14 +114,16 @@ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { tes.addVertexWithUV(k + 88 - radius, l + 39 - radius, zLevel, (perm + 0) * .03125, 0); tes.draw(); - GL11.glDisable(3042); + GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); count++; } GL11.glPushMatrix(); - GL11.glEnable(3042); - if (nodeType != 0) GL11.glBlendFunc(770, nodeType == 3 || nodeType == 4 ? 771 : 1); + GL11.glEnable(GL11.GL_BLEND); + if (nodeType != 0) GL11.glBlendFunc( + GL11.GL_SRC_ALPHA, + nodeType == 3 || nodeType == 4 ? GL11.GL_ONE_MINUS_SRC_ALPHA : GL11.GL_ONE); float radius = 10; int perm = (int) ((System.currentTimeMillis() / 64) % 32); @@ -163,7 +157,7 @@ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { (overl + 0) * .03125); tes.draw(); - GL11.glDisable(3042); + GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); } } diff --git a/src/main/java/witchinggadgets/client/nei/NEISpinningWheelHandler.java b/src/main/java/witchinggadgets/client/nei/NEISpinningWheelHandler.java index a8d944fb4..b59045187 100644 --- a/src/main/java/witchinggadgets/client/nei/NEISpinningWheelHandler.java +++ b/src/main/java/witchinggadgets/client/nei/NEISpinningWheelHandler.java @@ -87,7 +87,7 @@ public void loadCraftingRecipes(ItemStack result) { public void loadUsageRecipes(ItemStack ingredient) { for (SpinningRecipe recipe : SpinningRecipe.recipeList) if (recipe != null && recipe.getOutput() != null) for (Object ss : recipe.getInput()) { - if (ss instanceof List && ((List) ss).contains(ingredient)) { + if (ss instanceof List && ((List) ss).contains(ingredient)) { this.arecipes.add(new CachedSpinningWheelRecipe(recipe)); break; } else if (ss instanceof ItemStack && OreDictionary.itemMatches((ItemStack) ss, ingredient, true)) { diff --git a/src/main/java/witchinggadgets/client/nei/NEIWGConfig.java b/src/main/java/witchinggadgets/client/nei/NEIWGConfig.java index ecd1e6b2a..bf4f71db8 100644 --- a/src/main/java/witchinggadgets/client/nei/NEIWGConfig.java +++ b/src/main/java/witchinggadgets/client/nei/NEIWGConfig.java @@ -17,8 +17,6 @@ public void loadConfig() { API.registerRecipeHandler(new NEIInfernalBlastfurnaceHandler()); API.registerUsageHandler(new NEIInfernalBlastfurnaceHandler()); - // if(WGConfig.allowClusters && ItemClusters.materialMap.isEmpty()) - // API.hideItem(new ItemStack(WGContent.ItemCluster,1,OreDictionary.WILDCARD_VALUE)); API.hideItem(new ItemStack(WGContent.BlockWallMirror)); API.hideItem(new ItemStack(WGContent.BlockVoidWalkway)); } diff --git a/src/main/java/witchinggadgets/client/render/BlockRenderMetalDevice.java b/src/main/java/witchinggadgets/client/render/BlockRenderMetalDevice.java index 79aca1c44..f05bacf6f 100644 --- a/src/main/java/witchinggadgets/client/render/BlockRenderMetalDevice.java +++ b/src/main/java/witchinggadgets/client/render/BlockRenderMetalDevice.java @@ -17,6 +17,7 @@ import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import cpw.mods.fml.client.registry.RenderingRegistry; @@ -57,7 +58,7 @@ public void renderInventoryBlock(Block block, int metadata, int modelID, RenderB } catch (Exception e) { e.printStackTrace(); } - GL11.glEnable(32826); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } } diff --git a/src/main/java/witchinggadgets/client/render/BlockRenderStoneDevice.java b/src/main/java/witchinggadgets/client/render/BlockRenderStoneDevice.java index ea5fb7de2..0d7bfbafb 100644 --- a/src/main/java/witchinggadgets/client/render/BlockRenderStoneDevice.java +++ b/src/main/java/witchinggadgets/client/render/BlockRenderStoneDevice.java @@ -11,6 +11,7 @@ import net.minecraft.world.IBlockAccess; import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import cpw.mods.fml.client.registry.RenderingRegistry; @@ -37,7 +38,7 @@ public void renderInventoryBlock(Block block, int metadata, int modelID, RenderB // e.printStackTrace(); Tessellator.instance.draw(); } - GL11.glEnable(32826); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } diff --git a/src/main/java/witchinggadgets/client/render/BlockRenderWoodenDevice.java b/src/main/java/witchinggadgets/client/render/BlockRenderWoodenDevice.java index 613f48ac6..351f1ba36 100644 --- a/src/main/java/witchinggadgets/client/render/BlockRenderWoodenDevice.java +++ b/src/main/java/witchinggadgets/client/render/BlockRenderWoodenDevice.java @@ -8,6 +8,7 @@ import net.minecraft.world.IBlockAccess; import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import cpw.mods.fml.client.registry.RenderingRegistry; @@ -72,7 +73,7 @@ public void renderInventoryBlock(Block block, int metadata, int modelID, RenderB } catch (Exception e) { e.printStackTrace(); } - GL11.glEnable(32826); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } diff --git a/src/main/java/witchinggadgets/client/render/ItemRenderCapsule.java b/src/main/java/witchinggadgets/client/render/ItemRenderCapsule.java index fc12b744e..e09895c14 100644 --- a/src/main/java/witchinggadgets/client/render/ItemRenderCapsule.java +++ b/src/main/java/witchinggadgets/client/render/ItemRenderCapsule.java @@ -37,8 +37,8 @@ public void renderItem(ItemRenderType type, ItemStack item, Object... data) { TextureManager textureManager = Minecraft.getMinecraft().getTextureManager(); GL11.glPushMatrix(); - GL11.glEnable(3042); - GL11.glEnable(3008); + GL11.glEnable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_ALPHA_TEST); OpenGlHelper.glBlendFunc(770, 771, 1, 0); if (type.equals(ItemRenderType.ENTITY)) { @@ -103,7 +103,7 @@ public void renderItem(ItemRenderType type, ItemStack item, Object... data) { return; } - GL11.glEnable(3042); + GL11.glEnable(GL11.GL_BLEND); ItemRenderer.renderItemIn2D( tes, iicon.getMaxU(), @@ -115,7 +115,7 @@ public void renderItem(ItemRenderType type, ItemStack item, Object... data) { 0.0625F); if (type.equals(ItemRenderType.INVENTORY)) GL11.glScaled(1 / 16, 1 / 16, 1 / 16); - GL11.glDisable(3042); + GL11.glDisable(GL11.GL_BLEND); textureManager.bindTexture(textureManager.getResourceLocation(item.getItemSpriteNumber())); TextureUtil.func_147945_b(); GL11.glPopMatrix(); diff --git a/src/main/java/witchinggadgets/client/render/ItemRenderInfusedGem.java b/src/main/java/witchinggadgets/client/render/ItemRenderInfusedGem.java index 808cb179e..cbc7afc1c 100644 --- a/src/main/java/witchinggadgets/client/render/ItemRenderInfusedGem.java +++ b/src/main/java/witchinggadgets/client/render/ItemRenderInfusedGem.java @@ -58,14 +58,14 @@ public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { } GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); - GL11.glEnable(3042); + GL11.glEnable(GL11.GL_BLEND); ItemInfusedGem.GemCut cut = ItemInfusedGem.getCut(stack); ClientUtilities.bindTexture("witchinggadgets:textures/models/white.png"); Aspect a = ItemInfusedGem.getAspect(stack); if (a != null) { - // GL11.glBlendFunc(770, a.getBlend()); + // GL11.glBlendFunc(GL11.GL_SRC_ALPHA, a.getBlend()); float r = (a.getColor() >> 16 & 0xff) / 255f; float g = (a.getColor() >> 8 & 0xff) / 255f; float b = (a.getColor() & 0xff) / 255f; @@ -73,7 +73,7 @@ public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { } if (cut != null) ClientProxy.gemModel.renderPart(Utilities.getTitleCase(cut.name()) + "Cut_0" + cut.ordinal()); if (cut != null && type != ItemRenderType.INVENTORY) { - GL11.glBlendFunc(770, 1); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); GL11.glColor4f(1, 1, 1, 1f); float scale = .875f; GL11.glScaled(scale, scale, scale); diff --git a/src/main/java/witchinggadgets/client/render/ItemRenderMaterial.java b/src/main/java/witchinggadgets/client/render/ItemRenderMaterial.java index 7f0b35e5d..b7098f486 100644 --- a/src/main/java/witchinggadgets/client/render/ItemRenderMaterial.java +++ b/src/main/java/witchinggadgets/client/render/ItemRenderMaterial.java @@ -208,8 +208,8 @@ public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { // double step = 1.0/9.0; // int frame = timerSteps<60 ? 0 : timerSteps-59; - GL11.glEnable(3042); - GL11.glBlendFunc(770, 771); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); tessellator.startDrawingQuads(); byte b0 = 7; // tessellator.addVertexWithUV(0 - b0, 128 + b0, 0.0D, 0.0D, frame*step); @@ -267,7 +267,7 @@ public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { tessellator.addVertexWithUV(0 - b0, 0 - b0, 0.0D, ic.getMinU(), ic.getMinV()); tessellator.draw(); GL11.glColor4d(1, 1, 1, 1); - GL11.glDisable(3042); + GL11.glDisable(GL11.GL_BLEND); } if (scanStack != null) { diff --git a/src/main/java/witchinggadgets/client/render/ItemRenderPrimordialGauntlet.java b/src/main/java/witchinggadgets/client/render/ItemRenderPrimordialGauntlet.java index 69e2a2ab5..2e62eb3b3 100644 --- a/src/main/java/witchinggadgets/client/render/ItemRenderPrimordialGauntlet.java +++ b/src/main/java/witchinggadgets/client/render/ItemRenderPrimordialGauntlet.java @@ -185,7 +185,7 @@ public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { GL11.glRotated(-90, 1, 0, 0); GL11.glRotated(-90, 0, 1, 0); GL11.glTranslated(-.1875, .147, 0.0); - GL11.glEnable(3042); + GL11.glEnable(GL11.GL_BLEND); GL11.glTranslated( sel < 2 ? .09375 : sel == 3 ? .0125 : .035, @@ -269,8 +269,8 @@ public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { } average += nodeAspects.getAmount(aspect); GL11.glPushMatrix(); - GL11.glEnable(3042); - GL11.glBlendFunc(770, aspect.getBlend()); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, aspect.getBlend()); nodeScale = MathHelper.sin(ticksExisted / (14.0F - count)) * bscale + bscale * 2.0F; nodeScale = 0.2F + nodeScale * (nodeAspects.getAmount(aspect) / 50.0F); nodeScale *= size; @@ -291,7 +291,7 @@ public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { tessellator.addVertexWithUV(-radius, -radius, -count * .001, uMin, 0); tessellator.draw(); - GL11.glDisable(3042); + GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); count++; if (aspect.getBlend() == 771) { @@ -300,11 +300,13 @@ public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { } average /= nodeAspects.size(); GL11.glPushMatrix(); - GL11.glEnable(3042); + GL11.glEnable(GL11.GL_BLEND); nodeScale = 0.1F + average / 150.0F; nodeScale *= size; - if (nodeType != 0) GL11.glBlendFunc(770, nodeType == 3 || nodeType == 4 ? 771 : 1); + if (nodeType != 0) GL11.glBlendFunc( + GL11.GL_SRC_ALPHA, + nodeType == 3 || nodeType == 4 ? GL11.GL_ONE_MINUS_SRC_ALPHA : GL11.GL_ONE); int perm = (int) ((System.currentTimeMillis() / 64) % 32); int overl = nodeType == 2 ? 6 @@ -319,7 +321,7 @@ public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { tessellator.addVertexWithUV(-0.0825, -0.0825, -count * .001, uMin, (overl + 0) * .03125); tessellator.draw(); - GL11.glDisable(3042); + GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); } diff --git a/src/main/java/witchinggadgets/client/render/ItemRenderScanCamera.java b/src/main/java/witchinggadgets/client/render/ItemRenderScanCamera.java index ce6d45eb0..075f1824e 100644 --- a/src/main/java/witchinggadgets/client/render/ItemRenderScanCamera.java +++ b/src/main/java/witchinggadgets/client/render/ItemRenderScanCamera.java @@ -65,8 +65,8 @@ public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { EntityClientPlayerMP player = mc.thePlayer; GL11.glPushMatrix(); - GL11.glEnable(3042); - GL11.glBlendFunc(770, 771); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); if (type == ItemRenderType.ENTITY) { GL11.glScaled(2, 2, 2); GL11.glTranslated(0, 0.125, 0); @@ -78,7 +78,7 @@ public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { ClientProxy.cameraModel.renderPart("scanner_03"); ClientUtilities.bindTexture(woodTexture); ClientProxy.cameraModel.renderPart("wood_04"); - GL11.glDisable(3042); + GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); return; } @@ -92,7 +92,7 @@ public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { ClientProxy.cameraModel.renderPart("scanner_03"); ClientUtilities.bindTexture(woodTexture); ClientProxy.cameraModel.renderPart("wood_04"); - GL11.glDisable(3042); + GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); return; } @@ -315,8 +315,8 @@ public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { aspects = ((INode) tile).getAspects(); GL11.glPushMatrix(); - GL11.glEnable(3042); - GL11.glBlendFunc(770, 1); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); String t = StatCollector .translateToLocal("nodetype." + ((INode) tile).getNodeType() + ".name"); if (((INode) tile).getNodeModifier() != null) { @@ -330,7 +330,7 @@ public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { float scale = 0.006F; GL11.glScalef(scale, scale, scale); mc.fontRenderer.drawString(t, -sw / 2, -40, 16777215, false); - GL11.glDisable(3042); + GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); } } @@ -379,8 +379,8 @@ public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { if (text.length() > 0) { GL11.glPushMatrix(); - GL11.glEnable(3042); - GL11.glBlendFunc(770, 1); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); // // GL11.glRotatef(45.0F, 0.5F, 0.0F, 0.0F); @@ -394,7 +394,7 @@ public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { } GL11.glScalef(scale, scale, scale); mc.fontRenderer.drawString(text, -sw / 2, 0, 16777215, false); - GL11.glDisable(3042); + GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); } } @@ -403,7 +403,7 @@ public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { // double step = 1.0/9.0; // int frame = timerSteps<60 ? 0 : timerSteps-59; - GL11.glDisable(3042); + GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); diff --git a/src/main/java/witchinggadgets/client/render/ItemRenderWallMirror.java b/src/main/java/witchinggadgets/client/render/ItemRenderWallMirror.java index aadb2f2da..b09fc3a6f 100644 --- a/src/main/java/witchinggadgets/client/render/ItemRenderWallMirror.java +++ b/src/main/java/witchinggadgets/client/render/ItemRenderWallMirror.java @@ -28,7 +28,7 @@ public void renderItem(ItemRenderType type, ItemStack item, Object... data) { GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(770, 771); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_LIGHTING); GL11.glRotatef(90, 0, 1, 0); diff --git a/src/main/java/witchinggadgets/client/render/ModelCloak.java b/src/main/java/witchinggadgets/client/render/ModelCloak.java index 0fc016f25..9ba40b50c 100644 --- a/src/main/java/witchinggadgets/client/render/ModelCloak.java +++ b/src/main/java/witchinggadgets/client/render/ModelCloak.java @@ -64,8 +64,8 @@ public void render(Entity entity, float par2, float par3, float par4, float par5 this.bipedLeftLeg.showModel = false; super.render(entity, par2, par3, par4, par5, par6, par7); GL11.glPushMatrix(); - GL11.glEnable(3042); - GL11.glBlendFunc(770, 771); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); boolean drawHood = false; Tessellator tessellator = Tessellator.instance; @@ -254,7 +254,7 @@ public void render(Entity entity, float par2, float par3, float par4, float par5 } GL11.glColor3f(1, 1, 1); - GL11.glDisable(3042); + GL11.glDisable(GL11.GL_BLEND); // GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); } diff --git a/src/main/java/witchinggadgets/client/render/ModelKama.java b/src/main/java/witchinggadgets/client/render/ModelKama.java index fe9e460cc..f3a2a3962 100644 --- a/src/main/java/witchinggadgets/client/render/ModelKama.java +++ b/src/main/java/witchinggadgets/client/render/ModelKama.java @@ -28,8 +28,8 @@ public ModelKama(int colour) { public void render(Entity entity, float par2, float par3, float par4, float par5, float par6, float par7) { super.render(entity, par2, par3, par4, par5, par6, par7); GL11.glPushMatrix(); - GL11.glEnable(3042); - GL11.glBlendFunc(770, 771); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); Tessellator tessellator = Tessellator.instance; @@ -139,7 +139,7 @@ public void render(Entity entity, float par2, float par3, float par4, float par5 tessellator.addVertexWithUV(-.25 - w, ap - .125, .125 + w, .375, 1); tessellator.draw(); - GL11.glDisable(3042); + GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); } } diff --git a/src/main/java/witchinggadgets/client/render/ModelPrimordialArmor.java b/src/main/java/witchinggadgets/client/render/ModelPrimordialArmor.java index 4cda4012a..99cb4961f 100644 --- a/src/main/java/witchinggadgets/client/render/ModelPrimordialArmor.java +++ b/src/main/java/witchinggadgets/client/render/ModelPrimordialArmor.java @@ -114,7 +114,7 @@ public ModelPrimordialArmor(ItemStack stack) { this.bd_add0 = new ModelRenderer(this, 66, 46); this.bd_add0.setRotationPoint(0.0F, 0.0F, -3.3F); this.bd_add0.addBox(-2.0F, 0.0F, -1.0F, 4, 4, 2, scale); - this.setRotateAngle(bd_add0, 0.3141592653589793F, 0.0F, 0.0F); + this.setRotateAngle(bd_add0, ((float) Math.PI / 10F), 0.0F, 0.0F); this.bd_add1 = new ModelRenderer(this, 66, 52); this.bd_add1.mirror = true; @@ -269,7 +269,7 @@ public ModelPrimordialArmor(ItemStack stack) { this.ll_plate_o0.mirror = true; this.ll_plate_o0.setRotationPoint(1.8F, 0.2F, 0.0F); this.ll_plate_o0.addBox(-0.5F, 0.0F, -2.0F, 1, 4, 4, scale); - this.setRotateAngle(ll_plate_o0, 0.0F, 0.0F, -0.3141592653589793F); + this.setRotateAngle(ll_plate_o0, 0.0F, 0.0F, -((float) Math.PI / 10F)); this.ll_plate_o1 = new ModelRenderer(this, 16, 32); this.ll_plate_o1.mirror = true; this.ll_plate_o1.setRotationPoint(1.9F, 3.0F, 0.0F); @@ -308,7 +308,7 @@ public ModelPrimordialArmor(ItemStack stack) { this.rl_plate_o0 = new ModelRenderer(this, 16, 32); this.rl_plate_o0.setRotationPoint(-1.8F, 0.2F, 0.0F); this.rl_plate_o0.addBox(-0.5F, 0.0F, -2.0F, 1, 4, 4, scale); - this.setRotateAngle(rl_plate_o0, 0.0F, 0.0F, 0.3141592653589793F); + this.setRotateAngle(rl_plate_o0, 0.0F, 0.0F, ((float) Math.PI / 10F)); this.rl_plate_o1 = new ModelRenderer(this, 16, 32); this.rl_plate_o1.setRotationPoint(-1.9F, 3.0F, 0.0F); this.rl_plate_o1.addBox(-0.5F, 0.0F, -2.0F, 1, 4, 4, scale); @@ -498,14 +498,14 @@ public void render(Entity entity, float f, float f1, float f2, float f3, float f this.setRotationAngles(f, f1, f2, f3, f4, f5, entity); if (((entity instanceof EntitySkeleton)) || ((entity instanceof EntityZombie))) { - float f6 = MathHelper.sin(this.onGround * 3.141593F); - float f7 = MathHelper.sin((1.0F - (1.0F - this.onGround) * (1.0F - this.onGround)) * 3.141593F); + float f6 = MathHelper.sin(this.onGround * (float) Math.PI); + float f7 = MathHelper.sin((1.0F - (1.0F - this.onGround) * (1.0F - this.onGround)) * (float) Math.PI); this.bipedRightArm.rotateAngleZ = 0.0F; this.bipedLeftArm.rotateAngleZ = 0.0F; this.bipedRightArm.rotateAngleY = (-(0.1F - f6 * 0.6F)); this.bipedLeftArm.rotateAngleY = (0.1F - f6 * 0.6F); - this.bipedRightArm.rotateAngleX = -1.570796F; - this.bipedLeftArm.rotateAngleX = -1.570796F; + this.bipedRightArm.rotateAngleX = -((float) Math.PI / 2F); + this.bipedLeftArm.rotateAngleX = -((float) Math.PI / 2F); this.bipedRightArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F; this.bipedLeftArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F; this.bipedRightArm.rotateAngleZ += MathHelper.cos(f2 * 0.09F) * 0.05F + 0.05F; diff --git a/src/main/java/witchinggadgets/client/render/ModelRobeSkirted.java b/src/main/java/witchinggadgets/client/render/ModelRobeSkirted.java index 9b2526f0a..5085c9f3a 100644 --- a/src/main/java/witchinggadgets/client/render/ModelRobeSkirted.java +++ b/src/main/java/witchinggadgets/client/render/ModelRobeSkirted.java @@ -132,14 +132,14 @@ protected ModelRobeSkirted() { public void render(Entity entity, float par2, float par3, float par4, float par5, float par6, float par7) { this.setRotationAngles(par2, par3, par4, par5, par6, par7, entity); if (((entity instanceof EntitySkeleton)) || ((entity instanceof EntityZombie))) { - float f6 = MathHelper.sin(this.onGround * 3.141593F); - float f7 = MathHelper.sin((1.0F - (1.0F - this.onGround) * (1.0F - this.onGround)) * 3.141593F); + float f6 = MathHelper.sin(this.onGround * (float) Math.PI); + float f7 = MathHelper.sin((1.0F - (1.0F - this.onGround) * (1.0F - this.onGround)) * (float) Math.PI); this.bipedRightArm.rotateAngleZ = 0.0F; this.bipedLeftArm.rotateAngleZ = 0.0F; this.bipedRightArm.rotateAngleY = (-(0.1F - f6 * 0.6F)); this.bipedLeftArm.rotateAngleY = (0.1F - f6 * 0.6F); - this.bipedRightArm.rotateAngleX = -1.570796F; - this.bipedLeftArm.rotateAngleX = -1.570796F; + this.bipedRightArm.rotateAngleX = -((float) Math.PI / 2F); + this.bipedLeftArm.rotateAngleX = -((float) Math.PI / 2F); this.bipedRightArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F; this.bipedLeftArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F; this.bipedRightArm.rotateAngleZ += MathHelper.cos(par4 * 0.09F) * 0.05F + 0.05F; diff --git a/src/main/java/witchinggadgets/client/render/ModelSpinningWheel.java b/src/main/java/witchinggadgets/client/render/ModelSpinningWheel.java deleted file mode 100644 index 813e9db38..000000000 --- a/src/main/java/witchinggadgets/client/render/ModelSpinningWheel.java +++ /dev/null @@ -1,42 +0,0 @@ -// package witchinggadgets.client.render; -// -// import net.minecraft.client.model.ModelBase; -// import net.minecraftforge.client.model.IModelCustom; -// -// import org.lwjgl.opengl.GL11; -// -// import witchinggadgets.client.ClientUtilities; -// -// public class ModelSpinningWheel extends ModelBase -// { -// private IModelCustom model; -// -// public ModelSpinningWheel() -// { -// model = ClientUtilities.bindModel("witchinggadgets","models/SpinningWheel.obj"); -// } -// -// public void render(int tick) -// { -// model.renderPart("Frame_Cube"); -// -// double angle = tick * (360.0/64.0); -// GL11.glRotated(angle, 1, 0, 0); -// model.renderPart("Wheel_Circle"); -// GL11.glRotated(angle, -1, 0, 0); -// -// GL11.glTranslatef(0, 0.18F, 0.38F); -// GL11.glRotated(18, 1, 0, 0); -// GL11.glRotated(angle, 0, 0, 1); -// model.renderPart("String_Cylinder"); -// GL11.glRotated(angle, 0, 0, -1); -// GL11.glRotated(18, -1, 0, 0); -// GL11.glTranslatef(0, -0.18F, -0.38F); -// -// GL11.glTranslatef(0, -0.105F, 0.725F); -// GL11.glRotated(angle, 0, 1, 0); -// model.renderPart("Spindle_Cone"); -// GL11.glRotated(angle, 0, -1, 0); -// GL11.glTranslatef(0, 0.105F, -0.725F); -// } -// } diff --git a/src/main/java/witchinggadgets/client/render/NotRenderer.java b/src/main/java/witchinggadgets/client/render/NotRenderer.java deleted file mode 100644 index 4b7cfc66d..000000000 --- a/src/main/java/witchinggadgets/client/render/NotRenderer.java +++ /dev/null @@ -1,18 +0,0 @@ -package witchinggadgets.client.render; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.WorldClient; -import net.minecraftforge.client.IRenderHandler; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class NotRenderer extends IRenderHandler { - - @Override - @SideOnly(Side.CLIENT) - public void render(float partialTicks, WorldClient world, Minecraft mc) { - // TODO Auto-generated method stub - - } -} diff --git a/src/main/java/witchinggadgets/client/render/TileRenderCobbleGen.java b/src/main/java/witchinggadgets/client/render/TileRenderCobbleGen.java index 28afc43bd..605900bae 100644 --- a/src/main/java/witchinggadgets/client/render/TileRenderCobbleGen.java +++ b/src/main/java/witchinggadgets/client/render/TileRenderCobbleGen.java @@ -85,8 +85,8 @@ public void renderTileEntityAt(TileEntityCobbleGen tile, double x, double y, dou double slowTick = tick / 4; double loopTick = slowTick * 1.65; double inc = 1.0 / 512.0; - GL11.glEnable(3042); - GL11.glBlendFunc(770, 771); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); ClientUtilities.bindTexture("textures/blocks/lava_flow.png"); renderPixelBlock( tes, @@ -114,7 +114,7 @@ public void renderTileEntityAt(TileEntityCobbleGen tile, double x, double y, dou (loopTick * inc), .625, ((loopTick + 8) * inc)); - GL11.glDisable(3042); + GL11.glDisable(GL11.GL_BLEND); ClientUtilities.bindTexture("textures/blocks/cobblestone.png"); if (tick > 32) renderPixelBlock(tes, 0.3125, 0.3125, 0.3125, 0.6875, 0.6875, 0.6875, 0, 0, 1, 1); diff --git a/src/main/java/witchinggadgets/client/render/TileRenderCuttingTable.java b/src/main/java/witchinggadgets/client/render/TileRenderCuttingTable.java index cfbe4034d..fde4883de 100644 --- a/src/main/java/witchinggadgets/client/render/TileRenderCuttingTable.java +++ b/src/main/java/witchinggadgets/client/render/TileRenderCuttingTable.java @@ -44,7 +44,7 @@ public void renderTileEntityAt(TileEntity tileentity, double x, double y, double ClientUtilities.bindTexture("witchinggadgets:textures/models/cuttingTable.png"); model.render(null, 0, 0, 0, 0, 0, .0625f); - GL11.glBlendFunc(770, 771); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); for (byte i = 0; i < 3; i++) if (tile.getStackInSlot(1 + i) != null && tile.getStackInSlot(1 + i).hasTagCompound()) { @@ -356,14 +356,14 @@ public void render(Entity ent, float par2, float par3, float par4, float par5, f } public void renderFlask(byte fl, int colour) { - GL11.glEnable(3042); + GL11.glEnable(GL11.GL_BLEND); flasks.get(fl)[2].render(.0625f); GL11.glColor3f((colour >> 16 & 255) / 255.0F, (colour >> 8 & 255) / 255.0F, (colour & 255) / 255.0F); flasks.get(fl)[3].render(.0625f); GL11.glColor4f(1, 1, 1, 1); flasks.get(fl)[0].render(.0625f); flasks.get(fl)[1].render(.0625f); - GL11.glDisable(3042); + GL11.glDisable(GL11.GL_BLEND); } public void renderEssence(byte fl, int colour) { diff --git a/src/main/java/witchinggadgets/client/render/TileRenderIceGen.java b/src/main/java/witchinggadgets/client/render/TileRenderIceGen.java index 6eb493051..df0020642 100644 --- a/src/main/java/witchinggadgets/client/render/TileRenderIceGen.java +++ b/src/main/java/witchinggadgets/client/render/TileRenderIceGen.java @@ -85,8 +85,8 @@ public void renderTileEntityAt(TileEntityIceGen tile, double x, double y, double double slowTick = tick / 4.0; double loopTick = slowTick * 1.65; double inc = 1.0 / 512.0; - GL11.glEnable(3042); - GL11.glBlendFunc(770, 771); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); ClientUtilities.bindTexture("textures/blocks/ice.png"); renderPixelBlock( tes, @@ -114,7 +114,7 @@ public void renderTileEntityAt(TileEntityIceGen tile, double x, double y, double (loopTick * inc), .625, ((loopTick + 8) * inc)); - GL11.glDisable(3042); + GL11.glDisable(GL11.GL_BLEND); ClientUtilities.bindTexture("textures/blocks/ice.png"); if (tick > 32) renderPixelBlock(tes, 0.3125, 0.3125, 0.3125, 0.6875, 0.6875, 0.6875, 0, 0, 1, 1); diff --git a/src/main/java/witchinggadgets/client/render/TileRenderLabelLibrary.java b/src/main/java/witchinggadgets/client/render/TileRenderLabelLibrary.java index bcc16c3e7..1cc8655b6 100644 --- a/src/main/java/witchinggadgets/client/render/TileRenderLabelLibrary.java +++ b/src/main/java/witchinggadgets/client/render/TileRenderLabelLibrary.java @@ -68,7 +68,7 @@ public void renderTileEntityAt(TileEntity tileentity, double x, double y, double } if (tile.getWorldObj() != null) { - GL11.glBlendFunc(770, 771); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); ClientUtilities.bindTexture("textures/atlas/items.png"); GL11.glTranslatef(-.375f, 1f, -.4375f); GL11.glScaled(.375f, .75f, .375f); diff --git a/src/main/java/witchinggadgets/client/render/TileRenderSnowGen.java b/src/main/java/witchinggadgets/client/render/TileRenderSnowGen.java index 45c9221d1..0fd78e48d 100644 --- a/src/main/java/witchinggadgets/client/render/TileRenderSnowGen.java +++ b/src/main/java/witchinggadgets/client/render/TileRenderSnowGen.java @@ -120,15 +120,15 @@ public void renderTileEntityAt(TileEntitySnowGen tile, double x, double y, doubl // TODO INDICATE ACTIVE STATUS GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glDisable(GL11.GL_LIGHTING); - GL11.glEnable(3042); - GL11.glBlendFunc(770, 771); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); ClientUtilities.bindTexture("textures/blocks/snow.png"); TileRenderCobbleGen.renderPixelBlock(tes, 0.1875, 0.25, 0.1875, 0.375, 0.5, 0.375, 0, 0, 1, 1); TileRenderCobbleGen.renderPixelBlock(tes, 0.375, 0.25, 0.1875, 0.625, 0.5625, 0.4375, 0, 0, 1, 1); TileRenderCobbleGen.renderPixelBlock(tes, 0.15625, 0.25, 0.5, 0.4375, 0.5625, 0.8125, 0, 0, 1, 1); TileRenderCobbleGen.renderPixelBlock(tes, 0.5, 0.25, 0.5625, 0.75, 0.375, 0.875, 0, 0, 1, 1); TileRenderCobbleGen.renderPixelBlock(tes, 0.65625, 0.25, 0.3125, 0.8125, 0.75, 0.5, 0, 0, 1, 1); - GL11.glDisable(3042); + GL11.glDisable(GL11.GL_BLEND); GL11.glPopAttrib(); GL11.glPopMatrix(); diff --git a/src/main/java/witchinggadgets/client/render/TileRenderWallMirror.java b/src/main/java/witchinggadgets/client/render/TileRenderWallMirror.java index 250e48a1d..e2a54ef58 100644 --- a/src/main/java/witchinggadgets/client/render/TileRenderWallMirror.java +++ b/src/main/java/witchinggadgets/client/render/TileRenderWallMirror.java @@ -53,9 +53,6 @@ public void renderTileEntityAt(TileEntityWallMirror tile, double x, double y, do Tessellator tes = Tessellator.instance; - // GL11.glEnable(3042); - // GL11.glBlendFunc(770, 771); - GL11.glTranslatef((float) x, (float) y, (float) z); switch (tile.facing) { @@ -87,12 +84,6 @@ public void renderTileEntityAt(TileEntityWallMirror tile, double x, double y, do } ClientUtilities.bindTexture("witchinggadgets:textures/models/glass.png"); - // tes.startDrawingQuads(); - // tes.addVertexWithUV(0.03, 0, 0, glassUmax, darknessVmax); - // tes.addVertexWithUV(0.03, 2, 0, glassUmax, darknessVmin); - // tes.addVertexWithUV(0.03, 2, 1, glassUmin, darknessVmin); - // tes.addVertexWithUV(0.03, 0, 1, glassUmin, darknessVmax); - // tes.draw(); if (activating || deactivating || !active) { tes.startDrawingQuads(); tes.addVertexWithUV(0.0005, 0, 0, glassUmax, glassVmax); @@ -102,7 +93,6 @@ public void renderTileEntityAt(TileEntityWallMirror tile, double x, double y, do tes.draw(); } - // this.bindTexture(new ResourceLocation(Block.blockGold.getItemIconName())); ClientUtilities.bindTexture("witchinggadgets:textures/blocks/white.png"); for (int i = 0; i < shape.length; i++) { for (int j = 0; j < shape[i].length; j++) { @@ -153,7 +143,6 @@ private void drawPlayer(EntityLivingBase player, float scale, int facing, float GL11.glScalef((-0.0048f), 1, 1); GL11.glScalef(1, scale, scale); GL11.glTranslatef(0.5f, 0, 0); - // +vOffset switch (facing) { case 2: GL11.glRotatef(90, 0, -1, 0); @@ -172,26 +161,10 @@ private void drawPlayer(EntityLivingBase player, float scale, int facing, float ItemStack cc = player.getHeldItem(); player.setCurrentItemOrArmor(0, null); - // GL11.glDepthMask(false); - // GL11.glDisable(GL11.GL_BLEND); - // GL11.glDepthFunc(0); - // GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); - // GL11.glDisable(GL11.GL_TEXTURE_2D); - RenderManager.instance.renderEntityWithPosYaw(player, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); - // GL11.glDepthMask(true); - // GL11.glEnable(GL11.GL_BLEND); - // GL11.glBlendFunc(GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE); - // GL11.glEnable(GL11.GL_TEXTURE_2D); - player.setCurrentItemOrArmor(0, cc); GL11.glPopMatrix(); - // RenderHelper.disableStandardItemLighting(); - // GL11.glDisable(GL12.GL_RESCALE_NORMAL); - // OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); - // GL11.glDisable(GL11.GL_TEXTURE_2D); - // OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); } } diff --git a/src/main/java/witchinggadgets/common/WGConfig.java b/src/main/java/witchinggadgets/common/WGConfig.java index b1f58317c..008021dbe 100644 --- a/src/main/java/witchinggadgets/common/WGConfig.java +++ b/src/main/java/witchinggadgets/common/WGConfig.java @@ -191,7 +191,7 @@ public static void loadConfig(FMLPreInitializationEvent event) { new String[] { "minecraft:stone", "minecraft:sand", "minecraft:packed_ice", "minecraft:grass", "minecraft:gravel", "minecraft:dirt" }, "A list of valid blocks that Thaumcraft's hilltop stones can spawn upon"); - Set validBlocks = new HashSet(); + Set validBlocks = new HashSet<>(); for (String cm_allowedSpawnblocks_hilltopStone : cm_allowedSpawnblocks_HilltopStones) { String[] ssA = cm_allowedSpawnblocks_hilltopStone.split(":", 2); if (ssA.length > 1) { @@ -207,7 +207,7 @@ public static void loadConfig(FMLPreInitializationEvent event) { new String[] { "minecraft:stone", "minecraft:sand", "minecraft:packed_ice", "minecraft:grass", "minecraft:gravel", "minecraft:dirt" }, "A list of valid blocks that Thaumcraft's eldritch obelisks can spawn upon"); - validBlocks = new HashSet(); + validBlocks = new HashSet<>(); for (String s : cm_allowedSpawnblocks_EldritchRing) { String[] ssA = s.split(":", 2); if (ssA.length > 1) { diff --git a/src/main/java/witchinggadgets/common/WGContent.java b/src/main/java/witchinggadgets/common/WGContent.java index 1185dc010..af93ef83a 100644 --- a/src/main/java/witchinggadgets/common/WGContent.java +++ b/src/main/java/witchinggadgets/common/WGContent.java @@ -2,10 +2,9 @@ import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; import java.util.Map.Entry; import java.util.UUID; @@ -85,7 +84,6 @@ import witchinggadgets.common.items.tools.ItemPrimordialHammer; import witchinggadgets.common.items.tools.ItemPrimordialSword; import witchinggadgets.common.items.tools.ItemScanCamera; -import witchinggadgets.common.items.tools.ItemVorpalSword; import witchinggadgets.common.magic.WGEnchantBackstab; import witchinggadgets.common.magic.WGEnchantGemBrittle; import witchinggadgets.common.magic.WGEnchantGemPotency; @@ -179,11 +177,11 @@ public class WGContent { public static HashMap ClusterSmeltable = new HashMap(); public static String[] bannedMaterials = { "AnyIron", "AnyCopper" }; - public static ArrayList b = new ArrayList(); + public static ArrayList b = new ArrayList<>(); public static void preInit() { - for (String s : bannedMaterials) b.add(s); - for (String s : WGConfig.tripplingClusterList) b.add(s); + Collections.addAll(b, bannedMaterials); + Collections.addAll(b, WGConfig.tripplingClusterList); initClusters(); preInitItems(); preInitBlocks(); @@ -191,39 +189,31 @@ public static void preInit() { // final static String UUIDBASE = "424C5553-5747-1694-4452-"; private static void initClusters() { - HashSet L = new HashSet(); - Map map = Materials.getMaterialsMap(); - Iterator> entries = Materials.getMaterialsMap().entrySet().iterator(); - - while (entries.hasNext()) { - Map.Entry entry = entries.next(); - if (!b.contains(entry.getValue().mDefaultLocalName) && !OreDictionary - .getOres("ore" + entry.getValue().mDefaultLocalName.replaceAll(" ", "")).isEmpty()) { - Integer rgb = ((entry.getValue().getRGBA()[0] & 0x0ff) << 16) - | ((entry.getValue().getRGBA()[1] & 0x0ff) << 8) - | (entry.getValue().getRGBA()[2] & 0x0ff); - L.add(entry.getValue().mDefaultLocalName.replaceAll(" ", "")); - GT_Cluster_Color.put( - entry.getValue().mDefaultLocalName.replaceAll(" ", ""), - new Integer[] { ClientUtilities.getVibrantColourToInt(rgb), - entry.getValue().getRGBA()[0] > entry.getValue().getRGBA()[2] - && entry.getValue().getRGBA()[1] > entry.getValue().getRGBA()[2] - ? 2 - : entry.getValue().getRGBA()[0] > entry.getValue().getRGBA()[1] - && entry.getValue().getRGBA()[0] > entry.getValue().getRGBA()[2] - ? 1 - : 0 }); - ClusterEBF.put( - entry.getValue().mDefaultLocalName.replaceAll(" ", ""), - entry.getValue().mBlastFurnaceRequired); - if (!entry.getValue().mBlastFurnaceRequired - && (entry.getValue().getMolten(144) != null || entry.getValue().getFluid(144) != null)) - if (entry.getValue().getMolten(144) != null) ClusterSmeltable.put( - entry.getValue().mLocalizedName.replaceAll(" ", ""), - entry.getValue().getMolten(288).getFluid()); - else if (entry.getValue().getMolten(144) == null) ClusterSmeltable.put( - entry.getValue().mLocalizedName.replaceAll(" ", ""), - entry.getValue().getFluid(288).getFluid()); + HashSet L = new HashSet<>(); + for (Entry entry : Materials.getMaterialsMap().entrySet()) { + Materials material = entry.getValue(); + if (!b.contains(material.mDefaultLocalName) + && !OreDictionary.getOres("ore" + material.mDefaultLocalName.replaceAll(" ", "")).isEmpty()) { + Integer rgb = ((material.getRGBA()[0] & 0x0ff) << 16) | ((material.getRGBA()[1] & 0x0ff) << 8) + | (material.getRGBA()[2] & 0x0ff); + L.add(material.mDefaultLocalName.replaceAll(" ", "")); + GT_Cluster_Color + .put( + material.mDefaultLocalName.replaceAll(" ", ""), + new Integer[] { ClientUtilities.getVibrantColourToInt(rgb), + material.getRGBA()[0] > material.getRGBA()[2] + && material.getRGBA()[1] > material.getRGBA()[2] + ? 2 + : material.getRGBA()[0] > material.getRGBA()[1] + && material.getRGBA()[0] > material.getRGBA()[2] ? 1 + : 0 }); + ClusterEBF.put(material.mDefaultLocalName.replaceAll(" ", ""), material.mBlastFurnaceRequired); + if (!material.mBlastFurnaceRequired + && (material.getMolten(144) != null || material.getFluid(144) != null)) + if (material.getMolten(144) != null) ClusterSmeltable + .put(material.mLocalizedName.replaceAll(" ", ""), material.getMolten(288).getFluid()); + else if (material.getMolten(144) == null) ClusterSmeltable + .put(material.mLocalizedName.replaceAll(" ", ""), material.getFluid(288).getFluid()); } } GT_Cluster = new String[L.size()]; @@ -439,9 +429,6 @@ private static void preInitItems() { ItemMaterial = new ItemMaterials().setUnlocalizedName("WG_Material"); GameRegistry.registerItem(ItemMaterial, ItemMaterial.getUnlocalizedName()); - ItemVorpalSword = new ItemVorpalSword().setUnlocalizedName("WG_VorpalSword"); - // GameRegistry.registerItem(ItemVorpalSword,ItemVorpalSword.getUnlocalizedName()); TODO - ItemThaumiumShears = new ItemThaumiumShears().setUnlocalizedName("WG_ThaumiumShears"); GameRegistry.registerItem(ItemThaumiumShears, ItemThaumiumShears.getUnlocalizedName()); @@ -852,8 +839,8 @@ static void addOreAspects(String ore, AspectList aspects, boolean isRareOre) { } static boolean oreHasAspects(String ore) { - for (ItemStack stack : OreDictionary.getOres(ore)) if (stack != null) return ThaumcraftApi.objectTags - .get(Arrays.asList(new Object[] { stack.getItem(), Integer.valueOf(stack.getItemDamage()) })) != null; + for (ItemStack stack : OreDictionary.getOres(ore)) if (stack != null) + return ThaumcraftApi.objectTags.get(Arrays.asList(stack.getItem(), stack.getItemDamage())) != null; return false; } } diff --git a/src/main/java/witchinggadgets/common/WGModCompat.java b/src/main/java/witchinggadgets/common/WGModCompat.java index 48891308e..36e36d774 100644 --- a/src/main/java/witchinggadgets/common/WGModCompat.java +++ b/src/main/java/witchinggadgets/common/WGModCompat.java @@ -1,8 +1,5 @@ package witchinggadgets.common; -import java.lang.reflect.Field; -import java.lang.reflect.Method; - import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.EntityLivingBase; @@ -15,9 +12,15 @@ import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.registry.GameRegistry; +import enviromine.handlers.EM_StatusManager; +import enviromine.trackers.EnviroDataTracker; +import mods.railcraft.common.core.RailcraftConfig; +import tconstruct.library.crafting.DryingRackRecipes; +import tconstruct.library.crafting.Smeltery; import thaumcraft.api.ThaumcraftApi; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; +import thaumic.tinkerer.common.enchantment.core.EnchantmentManager; import witchinggadgets.common.minetweaker.WGMinetweaker; public class WGModCompat { @@ -153,127 +156,57 @@ public static void addTConSmelteryRecipe(String oreName, String blockName, int t if (blockStack == null || Block.getBlockFromItem(blockStack.getItem()) == null) blockStack = new ItemStack(Blocks.iron_block); Block b = Block.getBlockFromItem(blockStack.getItem()); - if (!OreDictionary.getOres(oreName).isEmpty()) for (ItemStack oreStack : OreDictionary.getOres(oreName)) if (oreStack != null) addTConSmelteryRecipe(oreStack, b, blockStack.getItemDamage(), temperature, fluidName, fluidAmount); } } - static Class smeltery = null; - static Method addMelting = null; - public static void addTConSmelteryRecipe(ItemStack ore, Block block, int blockMeta, int temperature, String fluidName, int fluidAmount) { if (!loaded_TCon || FluidRegistry.getFluid(fluidName) == null) return; - - try { - FluidStack fluid = new FluidStack(FluidRegistry.getFluid(fluidName), fluidAmount); - - if (smeltery == null) smeltery = Class.forName("tconstruct.library.crafting.Smeltery"); - if (addMelting == null) addMelting = smeltery.getDeclaredMethod( - "addMelting", - ItemStack.class, - Block.class, - int.class, - int.class, - FluidStack.class); - addMelting.invoke(null, ore, block, blockMeta, temperature, fluid); - } catch (Exception e) { - e.printStackTrace(); - } + FluidStack fluid = new FluidStack(FluidRegistry.getFluid(fluidName), fluidAmount); + Smeltery.addMelting(ore, block, blockMeta, temperature, fluid); } - static Class dryingRack = null; - static Method addDryingRecipe = null; - public static void addTConDryingRecipe(Object input, int time, Object output) { if (!loaded_TCon) return; - - try { - if (dryingRack == null) dryingRack = Class.forName("tconstruct.library.crafting.DryingRackRecipes"); - if (addDryingRecipe == null) addDryingRecipe = dryingRack - .getDeclaredMethod("addDryingRecipe", Object.class, int.class, Object.class); - addDryingRecipe.invoke(null, input, time, output); - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException(e); - } + DryingRackRecipes.addDryingRecipe(input, time, output); } - static Class enviro_DataTracker = null; - static Method enviro_lookupTracker = null; - static Field enviro_temperatue = null; - static Field enviro_hydration = null; - static Field enviro_sanity = null; - static Method enviro_dehydrate = null; static final float SANITYBUFF = .02f; public static void enviromineDoSaunaStuff(EntityLivingBase player, float deh, float temp) { if (!loaded_Enviromine) return; - try { - if (enviro_DataTracker == null) enviro_DataTracker = Class.forName("enviromine.trackers.EnviroDataTracker"); - if (enviro_lookupTracker == null) { - Class c_EM_StatusManager = Class.forName("enviromine.handlers.EM_StatusManager"); - enviro_lookupTracker = c_EM_StatusManager.getDeclaredMethod("lookupTracker", EntityLivingBase.class); - } - if (enviro_temperatue == null) enviro_temperatue = enviro_DataTracker.getField("bodyTemp"); - if (enviro_hydration == null) enviro_hydration = enviro_DataTracker.getField("hydration"); - if (enviro_sanity == null) enviro_sanity = enviro_DataTracker.getField("sanity"); - if (enviro_dehydrate == null) enviro_dehydrate = enviro_DataTracker.getMethod("dehydrate", float.class); - Object tracker = enviro_lookupTracker.invoke(null, player); - float curTemp = enviro_temperatue.getFloat(tracker); - if (curTemp + temp < 37.5f) enviro_temperatue.set(tracker, curTemp + temp); - float curSane = enviro_sanity.getFloat(tracker); - if (curSane + SANITYBUFF <= 100f) enviro_sanity.set(tracker, curSane + SANITYBUFF); - - float curHyd = enviro_hydration.getFloat(tracker); - enviro_dehydrate.invoke(tracker, curHyd > 80 ? deh : 0); - } catch (Exception e) { - e.printStackTrace(); + EnviroDataTracker tracker = EM_StatusManager.lookupTracker(player); + float curTemp = tracker.bodyTemp; + if (curTemp + temp < 37.5f) { + tracker.bodyTemp = curTemp + temp; } - } - static Method railcraft_isSubBlockEnabled = null; + float curSane = tracker.sanity; + if (curSane + SANITYBUFF <= 100f) { + tracker.sanity = curSane + SANITYBUFF; + } + + float curHyd = tracker.hydration; + tracker.dehydrate(curHyd > 80 ? deh : 0); + } public static boolean railcraftAllowBlastFurnace() { if (!loaded_Railcraft) return false; - try { - if (railcraft_isSubBlockEnabled == null) { - Class c_RailcraftConfig = Class.forName("mods.railcraft.common.core.RailcraftConfig"); - railcraft_isSubBlockEnabled = c_RailcraftConfig.getMethod("isSubBlockEnabled", String.class); - } - boolean enabled = (Boolean) railcraft_isSubBlockEnabled.invoke(null, "machine.alpha.blast.furnace"); - boolean block = GameRegistry.findBlock("Railcraft", "brick.infernal") != null; - boolean stair = GameRegistry.findBlock("Railcraft", "stair") != null; - return enabled && block && stair; - } catch (Exception e) { - e.printStackTrace(); - } - return false; - } - static Method thaumtink_registerExponentialCostData = null; + boolean enabled = RailcraftConfig.isSubBlockEnabled("machine.alpha.blast.furnace"); + boolean block = GameRegistry.findBlock("Railcraft", "brick.infernal") != null; + boolean stair = GameRegistry.findBlock("Railcraft", "stair") != null; + + return enabled && block && stair; + } public static void thaumicTinkererRegisterEnchantment(Enchantment enchantment, String texture, AspectList aspects, String research) { if (!loaded_TT) return; - try { - if (thaumtink_registerExponentialCostData == null) { - Class c_EnchantmentManager = Class - .forName("thaumic.tinkerer.common.enchantment.core.EnchantmentManager"); - thaumtink_registerExponentialCostData = c_EnchantmentManager.getMethod( - "registerExponentialCostData", - Enchantment.class, - String.class, - boolean.class, - AspectList.class, - String.class); - } - thaumtink_registerExponentialCostData.invoke(null, enchantment, texture, false, aspects, research); - } catch (Exception e) { - e.printStackTrace(); - } + EnchantmentManager.registerExponentialCostData(enchantment, texture, false, aspects, research); } } diff --git a/src/main/java/witchinggadgets/common/WGResearch.java b/src/main/java/witchinggadgets/common/WGResearch.java index cf4e5c604..c270cd500 100644 --- a/src/main/java/witchinggadgets/common/WGResearch.java +++ b/src/main/java/witchinggadgets/common/WGResearch.java @@ -214,7 +214,7 @@ public static void registerResearch() { .add(Aspect.CRAFT, 1); pages = new ResearchPage[] { new ResearchPage("witchinggadgets_research_page.GEMCUTTING.1"), new ResearchPage((ShapedOreRecipe) WGContent.recipeList.get("GEMCUTTING_TOOLS")), - new ResearchPage((List) WGContent.recipeList.get("GEMCUTTING")), + new ResearchPage((List) WGContent.recipeList.get("GEMCUTTING")), new ResearchPage("witchinggadgets_research_page.GEMCUTTING.2"), new ResearchPage("witchinggadgets_research_page.GEMCUTTING.3"), new ResearchPage("witchinggadgets_research_page.GEMCUTTING.4"), @@ -383,11 +383,11 @@ public static void registerResearch() { if (WGConfig.moduleKama) { // KAMA researchAspects = new AspectList().add(Aspect.CLOTH, 2).add(Aspect.ARMOR, 2); - ArrayList recList = new ArrayList(); + ArrayList recList = new ArrayList<>(); for (int cm = 0; cm < ItemCloak.subNames.length; cm++) recList.add((ShapedArcaneRecipe) WGContent.recipeList.get("CLOAKKAMA_" + cm)); pages = new ResearchPage[] { new ResearchPage("witchinggadgets_research_page.CLOAKKAMA.1"), - new ResearchPage((ShapedArcaneRecipe[]) recList.toArray(new ShapedArcaneRecipe[0])) }; + new ResearchPage(recList.toArray(new ShapedArcaneRecipe[0])) }; getResearchItem( "CLOAKKAMA", "WITCHGADG", @@ -752,7 +752,7 @@ public static void registerResearch() { .add(Aspect.DARKNESS, 1).add(Aspect.TAINT, 1); pages = new ResearchPage[] { new ResearchPage("witchinggadgets_research_page.INFERNALBLASTFURNACE.1"), new ResearchPage("witchinggadgets_research_page.INFERNALBLASTFURNACE.2"), - new ResearchPage((List) WGContent.recipeList.get("INFERNALBLASTFURNACE")), + new ResearchPage((List) WGContent.recipeList.get("INFERNALBLASTFURNACE")), new ResearchPage("witchinggadgets_research_page.INFERNALBLASTFURNACE.3") }; getResearchItem( "INFERNALBLASTFURNACE", diff --git a/src/main/java/witchinggadgets/common/blocks/BlockBiomeFocusEmpty.java b/src/main/java/witchinggadgets/common/blocks/BlockBiomeFocusEmpty.java deleted file mode 100644 index cc0fa4235..000000000 --- a/src/main/java/witchinggadgets/common/blocks/BlockBiomeFocusEmpty.java +++ /dev/null @@ -1,109 +0,0 @@ -package witchinggadgets.common.blocks; - -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import thaumcraft.api.aspects.Aspect; -import witchinggadgets.WitchingGadgets; -import witchinggadgets.api.ITerraformFocus; -import witchinggadgets.common.blocks.tiles.TileEntityTerraformFocus; - -public class BlockBiomeFocusEmpty extends BlockContainer implements ITerraformFocus { - - private BiomeGenBase Saved = null; - - public BlockBiomeFocusEmpty() { - super(Material.iron); - this.setHardness(4F); - this.setResistance(15); - setCreativeTab(WitchingGadgets.tabWG); - } - - @Override - public void registerBlockIcons(IIconRegister iconRegister) { - iconRegister.registerIcon("witchinggadgets:tfFocusEmpty"); - } - - @Override - public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { - return new TileEntityTerraformFocus(); - } - - @Override - public void onBlockAdded(World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_) { - if (this.Saved == null) this.Saved = p_149726_1_.getBiomeGenForCoords(p_149726_2_, p_149726_4_); - super.onBlockAdded(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_); - } - - @Override - public Aspect requiredAspect(int metadata) { - if (Saved != null) { - if (Saved.getTempCategory() == BiomeGenBase.TempCategory.COLD) return Aspect.COLD; - if (Saved.getTempCategory() == BiomeGenBase.TempCategory.WARM) return Aspect.FIRE; - if (Saved.getTempCategory() == BiomeGenBase.TempCategory.OCEAN) return Aspect.WATER; - if (Saved.getTempCategory() == BiomeGenBase.TempCategory.MEDIUM) return Aspect.EARTH; - } - return null; - } - - @Override - public Aspect requiredAspect(World world, int x, int y, int z) { - return requiredAspect(0); - } - - @Override - public BiomeGenBase getCreatedBiome(World world, int x, int y, int z) { - return Saved; - } - - @Override - public ItemStack getDisplayedBlock(World world, int x, int y, int z) { - return null; - } - - @Override - public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) { - return false; - } - - @Override - public boolean isOpaqueCube() { - return false; - } - - @Override - public boolean renderAsNormalBlock() { - return false; - } - - @SideOnly(Side.CLIENT) - @Override - public boolean shouldSideBeRendered(IBlockAccess iBlockAccess, int x, int y, int z, int side) { - return super.shouldSideBeRendered(iBlockAccess, x, y, z, side); - } - - @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { - return super.getCollisionBoundingBoxFromPool(world, x, y, z); - } - - @Override - public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) { - return super.getSelectedBoundingBoxFromPool(world, x, y, z); - } - - @Override - public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { - this.setBlockBounds(.125f, 0, .125f, .875f, .75f, .875f); - } -} diff --git a/src/main/java/witchinggadgets/common/blocks/BlockFluidDarkIron.java b/src/main/java/witchinggadgets/common/blocks/BlockFluidDarkIron.java deleted file mode 100644 index 561eec0c9..000000000 --- a/src/main/java/witchinggadgets/common/blocks/BlockFluidDarkIron.java +++ /dev/null @@ -1,18 +0,0 @@ -package witchinggadgets.common.blocks; - -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraftforge.fluids.BlockFluidFinite; -import net.minecraftforge.fluids.Fluid; - -public class BlockFluidDarkIron extends BlockFluidFinite { - - public BlockFluidDarkIron(Fluid fluid) { - super(fluid, Material.lava); - } - - @Override - public void registerBlockIcons(IIconRegister par1IconRegister) { - this.blockIcon = par1IconRegister.registerIcon("witchinggadgets:darkIronFluid"); - } -} diff --git a/src/main/java/witchinggadgets/common/blocks/BlockRoseVines.java b/src/main/java/witchinggadgets/common/blocks/BlockRoseVines.java index 1f89ac25e..643637fdb 100644 --- a/src/main/java/witchinggadgets/common/blocks/BlockRoseVines.java +++ b/src/main/java/witchinggadgets/common/blocks/BlockRoseVines.java @@ -64,8 +64,9 @@ public void registerBlockIcons(IIconRegister iconRegister) { @Override public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { - // world.markBlockForRenderUpdate(x, y, z); - if (entity instanceof EntityLivingBase) entity.attackEntityFrom(DamageSource.generic, 1.0F); + if (entity instanceof EntityLivingBase) { + entity.attackEntityFrom(DamageSource.generic, 1.0F); + } } @Override @@ -73,55 +74,20 @@ public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, return null; } - // @SuppressWarnings("unused") - // private boolean canBePlacedOn(int id) - // { - // if (id == 0) - // { - // return false; - // } - // Block block = Block.blocksList[id]; - // return block.renderAsNormalBlock() && block.blockMaterial.blocksMovement(); - // } - public void spreadVines(World world, int x, int y, int z, Random random, boolean ignoreRandom) { int growthStage = world.getBlockMetadata(x, y, z); if (growthStage >= 5) { - // if(isRoseVinePlaceable(world, x, y, z+1)) - // if(random.nextInt(4)==0 || ignoreRandom) - // world.setBlock(x, y, z+1, this.blockID); - // - // if(isRoseVinePlaceable(world, x, y, z-1)) - // if(random.nextInt(4)==0 || ignoreRandom) - // world.setBlock(x, y, z-1, this.blockID); - // - // if(isRoseVinePlaceable(world, x+1, y, z)) - // if(random.nextInt(4)==0 || ignoreRandom) - // world.setBlock(x+1, y, z, this.blockID); - // - // if(isRoseVinePlaceable(world, x-1, y, z)) - // if(random.nextInt(4)==0 || ignoreRandom) - // world.setBlock(x-1, y, z, this.blockID); - if (isRoseVinePlaceable(world, x, y + 1, z)) if (random.nextInt(4) == 0 || ignoreRandom) if (world.isSideSolid(x, y + 1, z - 1, ForgeDirection.SOUTH, false) || world.isSideSolid(x, y + 1, z + 1, ForgeDirection.NORTH, false) || world.isSideSolid(x - 1, y + 1, z, ForgeDirection.WEST, false) || world.isSideSolid(x + 1, y + 1, z, ForgeDirection.EAST, false)) world.setBlock(x, y + 1, z, this); - - // if(isRoseVinePlaceable(world, x, y-1, z)) - // if(random.nextInt(4)==0 || ignoreRandom) - // world.setBlock(x, y-1, z, this.blockID); } else { world.setBlockMetadataWithNotify(x, y, z, growthStage + 1, 2); } } - public boolean isBlockSolidOnSide(World world, int x, int y, int z, ForgeDirection side) { - return false; - } - public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { float minX = 0.0F; float minY = 0.0F; @@ -215,7 +181,7 @@ public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int @Override public ArrayList onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune) { - ArrayList ret = new ArrayList(); + ArrayList ret = new ArrayList<>(); ret.add(new ItemStack(this, 1)); return ret; } diff --git a/src/main/java/witchinggadgets/common/blocks/BlockTimeStone.java b/src/main/java/witchinggadgets/common/blocks/BlockTimeStone.java deleted file mode 100644 index c41f0ee31..000000000 --- a/src/main/java/witchinggadgets/common/blocks/BlockTimeStone.java +++ /dev/null @@ -1,35 +0,0 @@ -package witchinggadgets.common.blocks; - -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -import witchinggadgets.common.blocks.tiles.TileEntityAgeingStone; - -public class BlockTimeStone extends BlockContainer { - - public BlockTimeStone() { - super(Material.rock); - this.setHardness(0.8F); - this.setResistance(10); - } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, - float hitY, float hitZ) { - return false; - } - - @Override - public void registerBlockIcons(IIconRegister iconRegister) { - this.blockIcon = iconRegister.registerIcon("witchinggadgets:timeStone"); - } - - @Override - public TileEntity createNewTileEntity(World world, int meta) { - return new TileEntityAgeingStone(); - } -} diff --git a/src/main/java/witchinggadgets/common/blocks/BlockVoidWalkway.java b/src/main/java/witchinggadgets/common/blocks/BlockVoidWalkway.java index a2af8fa82..3b1c68e41 100644 --- a/src/main/java/witchinggadgets/common/blocks/BlockVoidWalkway.java +++ b/src/main/java/witchinggadgets/common/blocks/BlockVoidWalkway.java @@ -28,8 +28,7 @@ public BlockVoidWalkway() { public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if (!player.isSneaking() && player.getCurrentEquippedItem() != null - && player.getCurrentEquippedItem().getItem() instanceof ItemBlock) { - ItemBlock ib = (ItemBlock) player.getCurrentEquippedItem().getItem(); + && player.getCurrentEquippedItem().getItem() instanceof ItemBlock ib) { if (ib.placeBlockAt( player.getCurrentEquippedItem(), player, diff --git a/src/main/java/witchinggadgets/common/blocks/BlockWGMetalDevice.java b/src/main/java/witchinggadgets/common/blocks/BlockWGMetalDevice.java index 2ed499da2..cdd2b1cfa 100644 --- a/src/main/java/witchinggadgets/common/blocks/BlockWGMetalDevice.java +++ b/src/main/java/witchinggadgets/common/blocks/BlockWGMetalDevice.java @@ -144,7 +144,7 @@ public TileEntity createNewTileEntity(World world, int metadata) { } @Override - public void getSubBlocks(Item item, CreativeTabs tab, List list) { + public void getSubBlocks(Item item, CreativeTabs tab, List list) { for (int i = 0; i < subNames.length; i++) list.add(new ItemStack(item, 1, i)); } diff --git a/src/main/java/witchinggadgets/common/blocks/BlockWGStoneDevice.java b/src/main/java/witchinggadgets/common/blocks/BlockWGStoneDevice.java index 348e1d98c..112477266 100644 --- a/src/main/java/witchinggadgets/common/blocks/BlockWGStoneDevice.java +++ b/src/main/java/witchinggadgets/common/blocks/BlockWGStoneDevice.java @@ -21,7 +21,6 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.util.IIcon; -import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; @@ -98,29 +97,26 @@ public IIcon getIcon(int side, int meta) { @Override public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { - if (world.getTileEntity(x, y, z) instanceof TileEntityEtherealWall) { - TileEntityEtherealWall tile = (TileEntityEtherealWall) world.getTileEntity(x, y, z); - - if (tile.camoID != null) { - if (tile.camoID != null && tile.isRenderTypeValid(tile.camoID.getRenderType(), tile.camoMeta)) - return tile.camoID.getIcon(side, tile.camoMeta); + if (world.getTileEntity(x, y, z) instanceof TileEntityEtherealWall tile) { + if (tile.camoID != null && tile.isRenderTypeValid(tile.camoID.getRenderType(), tile.camoMeta)) { + return tile.camoID.getIcon(side, tile.camoMeta); } } - if (world.getTileEntity(x, y, z) instanceof TileEntityBlastfurnace) { - return ((TileEntityBlastfurnace) world.getTileEntity(x, y, z)).getTexture(side); + if (world.getTileEntity(x, y, z) instanceof TileEntityBlastfurnace blastfurnace) { + return blastfurnace.getTexture(side); } + return this.icons[Math.min(world.getBlockMetadata(x, y, z), icons.length - 1)]; } @Override public int getLightValue(IBlockAccess world, int x, int y, int z) { - if (world.getTileEntity(x, y, z) instanceof TileEntityEtherealWall) { - TileEntityEtherealWall tile = (TileEntityEtherealWall) world.getTileEntity(x, y, z); + if (world.getTileEntity(x, y, z) instanceof TileEntityEtherealWall tile) { if (tile.camoID != null) return tile.camoID.getLightValue(); } - if (world.getTileEntity(x, y, z) instanceof TileEntityBlastfurnace) { - int pos = ((TileEntityBlastfurnace) world.getTileEntity(x, y, z)).position; + if (world.getTileEntity(x, y, z) instanceof TileEntityBlastfurnace blastfurnace) { + int pos = blastfurnace.position; return pos == 10 || pos == 12 || pos == 14 || pos == 16 ? 13 : pos == 22 ? 15 : 0; } return 0; @@ -147,21 +143,16 @@ public boolean shouldSideBeRendered(IBlockAccess iBlockAccess, int x, int y, int int xx = x - ForgeDirection.getOrientation(side).offsetX; int yy = y - ForgeDirection.getOrientation(side).offsetY; int zz = z - ForgeDirection.getOrientation(side).offsetZ; - if (iBlockAccess.getTileEntity(xx, yy, zz) instanceof TileEntityEtherealWall) { - TileEntityEtherealWall tile = (TileEntityEtherealWall) iBlockAccess.getTileEntity(xx, yy, zz); + if (iBlockAccess.getTileEntity(xx, yy, zz) instanceof TileEntityEtherealWall tile) { boolean sameBlock = iBlockAccess.getBlock(x, y, z).equals(this) && iBlockAccess.getBlockMetadata(x, y, z) == iBlockAccess.getBlockMetadata(xx, yy, zz); - boolean sameRenderBlock = tile.camoID != null - ? (iBlockAccess.getBlock(x, y, z).equals(tile.camoID) - && iBlockAccess.getBlockMetadata(x, y, z) == tile.camoMeta) - : false; + boolean sameRenderBlock = tile.camoID != null && (iBlockAccess.getBlock(x, y, z).equals(tile.camoID) + && iBlockAccess.getBlockMetadata(x, y, z) == tile.camoMeta); sameBlock |= sameRenderBlock; - if (iBlockAccess.getTileEntity(x, y, z) instanceof TileEntityEtherealWall) - sameBlock &= ((TileEntityEtherealWall) iBlockAccess.getTileEntity(x, y, z)).camoID != null - ? (((TileEntityEtherealWall) iBlockAccess.getTileEntity(x, y, z)).camoID.equals(tile.camoID) - && ((TileEntityEtherealWall) iBlockAccess.getTileEntity(x, y, z)).camoMeta - == tile.camoMeta) - : false; + if (iBlockAccess.getTileEntity(x, y, z) instanceof TileEntityEtherealWall etherealWall) { + sameBlock &= etherealWall.camoID != null && etherealWall.camoID.equals(tile.camoID) + && etherealWall.camoMeta == tile.camoMeta; + } return !sameBlock; } @@ -172,12 +163,11 @@ public boolean shouldSideBeRendered(IBlockAccess iBlockAccess, int x, int y, int } @Override - public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB aabb, List list, + public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB aabb, List list, Entity entity) { - if (world.getTileEntity(x, y, z) instanceof TileEntityEtherealWall) { - TileEntityEtherealWall tile = (TileEntityEtherealWall) world.getTileEntity(x, y, z); + if (world.getTileEntity(x, y, z) instanceof TileEntityEtherealWall tile) { - if (tile != null && tile.master != null && tile.master.isAnyTileInNetPowered()) return; + if (tile.master != null && tile.master.isAnyTileInNetPowered()) return; } if (world.getTileEntity(x, y, z) instanceof TileEntityBlastfurnace) { int pos = ((TileEntityBlastfurnace) world.getTileEntity(x, y, z)).position; @@ -223,25 +213,23 @@ public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, i @Override public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) { - if (world.getTileEntity(x, y, z) instanceof TileEntityBlastfurnace - && ((TileEntityBlastfurnace) world.getTileEntity(x, y, z)).position == 22) - return false; - return true; + return !(world.getTileEntity(x, y, z) instanceof TileEntityBlastfurnace blastfurnace) + || blastfurnace.position != 22; } @Override public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { - if (!world.isRemote && world.getTileEntity(x, y, z) instanceof TileEntityBlastfurnace - && ((TileEntityBlastfurnace) world.getTileEntity(x, y, z)).position == 22) - if (entity instanceof EntityItem) { - ItemStack input = ((EntityItem) entity).getEntityItem(); + if (!world.isRemote && world.getTileEntity(x, y, z) instanceof TileEntityBlastfurnace blastfurnace + && blastfurnace.position == 22) + if (entity instanceof EntityItem entityItem) { + ItemStack input = entityItem.getEntityItem(); if (InfernalBlastfurnaceRecipe.getRecipeForInput(input) == null) { world.addBlockEvent(x, y, z, this, 5, 0); entity.setDead(); return; } - int[] mPos = ((TileEntityBlastfurnace) world.getTileEntity(x, y, z)).masterPos; + int[] mPos = blastfurnace.masterPos; TileEntityBlastfurnace master = (TileEntityBlastfurnace) world.getTileEntity(mPos[0], mPos[1], mPos[2]); master.addStackToInputs(input); entity.setDead(); @@ -253,36 +241,22 @@ public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity e @Override public TileEntity createNewTileEntity(World world, int metadata) { - switch (metadata) { - case 0: - return new TileEntityEtherealWall(); - case 1: - return new TileEntityAgeingStone(); - case 2: - return new TileEntityBlastfurnace(); - } - return null; - } - - @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack stack) { - int playerViewQuarter = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - int meta = world.getBlockMetadata(x, y, z); - int f = playerViewQuarter == 0 ? 2 : playerViewQuarter == 1 ? 5 : playerViewQuarter == 2 ? 3 : 4; - /* - * if(meta == 0) ((TileEntityEtherealWall)world.getTileEntity(x,y,z)).facing = f; else - */ - + return switch (metadata) { + case 0 -> new TileEntityEtherealWall(); + case 1 -> new TileEntityAgeingStone(); + case 2 -> new TileEntityBlastfurnace(); + default -> null; + }; } @Override public void breakBlock(World world, int x, int y, int z, Block b, int side) { - if (world.getTileEntity(x, y, z) instanceof TileEntityBlastfurnace) { + if (world.getTileEntity(x, y, z) instanceof TileEntityBlastfurnace blastFurnace) { - int[] mPos = ((TileEntityBlastfurnace) world.getTileEntity(x, y, z)).masterPos; + int[] mPos = blastFurnace.masterPos; if (mPos != null && mPos.length > 2 && world.getBlock(mPos[0], mPos[1], mPos[2]).equals(this)) { - byte pos = ((TileEntityBlastfurnace) world.getTileEntity(x, y, z)).position; + byte pos = blastFurnace.position; removeBlastfurnace(world, mPos[0], mPos[1], mPos[2], x, y, z); if (pos != 22) { EntityItem blockDrop = new EntityItem( @@ -307,15 +281,14 @@ public void breakBlock(World world, int x, int y, int z, Block b, int side) { @Override public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { - if (metadata == 2) return new ArrayList(); + if (metadata == 2) return new ArrayList<>(); return super.getDrops(world, x, y, z, metadata, fortune); } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - if (world.getTileEntity(x, y, z) instanceof TileEntityEtherealWall) { - TileEntityEtherealWall tile = (TileEntityEtherealWall) world.getTileEntity(x, y, z); + if (world.getTileEntity(x, y, z) instanceof TileEntityEtherealWall tile) { ItemStack currentStack = player.getCurrentEquippedItem(); Block camoID = null; int camoMeta = -1; @@ -334,7 +307,7 @@ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer p blockMeta = blockMeta & 12 | 2; break; case 3: - blockMeta = blockMeta & 12 | 0; + blockMeta = blockMeta & 12; break; case 4: blockMeta = blockMeta & 12 | 1; @@ -343,38 +316,26 @@ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer p blockMeta = blockMeta & 12 | 3; break; } - if (block.getRenderType() == 39 && blockMeta == 2) switch (side) { - case 0: - case 1: - blockMeta = 2; - break; - case 2: - case 3: - blockMeta = 4; - break; - case 4: - case 5: - blockMeta = 3; + + if (block.getRenderType() == 39 && blockMeta == 2) { + blockMeta = switch (side) { + case 0, 1 -> 2; + case 2, 3 -> 4; + case 4, 5 -> 3; + default -> blockMeta; + }; } + if (block.getRenderType() == 31) { int j1 = blockMeta & 3; - byte b0 = 0; - - switch (side) { - case 0: - case 1: - b0 = 0; - break; - case 2: - case 3: - b0 = 8; - break; - case 4: - case 5: - b0 = 4; - } + byte b0 = switch (side) { + case 2, 3 -> 8; + case 4, 5 -> 4; + default -> 0; + }; blockMeta = j1 | b0; } + camoID = block; camoMeta = blockMeta; changeTexture = true; @@ -384,8 +345,6 @@ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer p tile.camoID = camoID; tile.camoMeta = camoMeta; world.markBlockRangeForRenderUpdate(x, y, z, x, y, z); - // PacketDispatcher.sendPacketToAllInDimension(tile.getDescriptionPacket(), - // world.provider.dimensionId); } return changeTexture; } @@ -395,9 +354,8 @@ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer p @Override public void onNeighborChange(IBlockAccess world, int x, int y, int z, int tileX, int tileY, int tileZ) { - if (world.getTileEntity(x, y, z) instanceof TileEntityEtherealWall) { - TileEntityEtherealWall tile = (TileEntityEtherealWall) world.getTileEntity(x, y, z); - if (tile != null) if (tile.master != null) tile.master.freeSlaves(); + if (world.getTileEntity(x, y, z) instanceof TileEntityEtherealWall tile) { + if (tile.master != null) tile.master.freeSlaves(); } } @@ -444,8 +402,7 @@ public boolean canRenderInPass(int pass) { @Override public int colorMultiplier(IBlockAccess world, int x, int y, int z) { - if (world.getTileEntity(x, y, z) instanceof TileEntityEtherealWall) { - TileEntityEtherealWall tile = (TileEntityEtherealWall) world.getTileEntity(x, y, z); + if (world.getTileEntity(x, y, z) instanceof TileEntityEtherealWall tile) { if (tile.camoID != null) return tile.camoID instanceof BlockWGStoneDevice ? 0xFFFFFF : tile.camoID.colorMultiplier(world, x, y, z); } diff --git a/src/main/java/witchinggadgets/common/blocks/BlockWGWoodenDevice.java b/src/main/java/witchinggadgets/common/blocks/BlockWGWoodenDevice.java index 72ab38a62..632a07eb5 100644 --- a/src/main/java/witchinggadgets/common/blocks/BlockWGWoodenDevice.java +++ b/src/main/java/witchinggadgets/common/blocks/BlockWGWoodenDevice.java @@ -100,7 +100,7 @@ public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int } @Override - public void getSubBlocks(Item item, CreativeTabs par2CreativeTabs, List list) { + public void getSubBlocks(Item item, CreativeTabs par2CreativeTabs, List list) { for (int i = 0; i < subNames.length; i++) list.add(new ItemStack(item, 1, i)); } @@ -165,19 +165,13 @@ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer p @Override public void setBlockBoundsBasedOnState(IBlockAccess iBlockAccess, int x, int y, int z) { int meta = iBlockAccess.getBlockMetadata(x, y, z); - if (meta == 0 && iBlockAccess.getTileEntity(x, y, z) instanceof TileEntitySpinningWheel) { - switch (((TileEntitySpinningWheel) iBlockAccess.getTileEntity(x, y, z)).facing) { + if (meta == 0 && iBlockAccess.getTileEntity(x, y, z) instanceof TileEntitySpinningWheel spinningWheel) { + switch (spinningWheel.facing) { case 2: default: this.setBlockBounds(0F, 0F, 0.3125F, 1F, 1.25F, 0.6875F); break; - case 3: - this.setBlockBounds(0F, 0F, 0.3125F, 1F, 1.25F, 0.6875F); - break; - case 4: - this.setBlockBounds(0.3125F, 0F, 0F, 0.6875F, 1.25F, 1F); - break; - case 5: + case 4, 5: this.setBlockBounds(0.3125F, 0F, 0F, 0.6875F, 1.25F, 1F); break; } @@ -243,23 +237,16 @@ public void randomDisplayTick(World world, int x, int y, int z, Random rand) { @Override public TileEntity createNewTileEntity(World world, int metadata) { - switch (metadata) { - case 0: - return new TileEntitySpinningWheel(); - case 1: - return new TileEntitySnowGen(); - case 2: - return new TileEntityCobbleGen(); - case 3: - return new TileEntityCuttingTable(); - case 4: - return new TileEntitySaunaStove(); - case 5: - return new TileEntityLabelLibrary(); - case 6: - return new TileEntityIceGen(); - } - return null; + return switch (metadata) { + case 0 -> new TileEntitySpinningWheel(); + case 1 -> new TileEntitySnowGen(); + case 2 -> new TileEntityCobbleGen(); + case 3 -> new TileEntityCuttingTable(); + case 4 -> new TileEntitySaunaStove(); + case 5 -> new TileEntityLabelLibrary(); + case 6 -> new TileEntityIceGen(); + default -> null; + }; } @Override @@ -274,8 +261,7 @@ public ArrayList getDrops(World world, int x, int y, int z, int metad @Override public void breakBlock(World world, int x, int y, int z, Block par5, int par6) { - if (world.getTileEntity(x, y, z) instanceof TileEntitySpinningWheel) { - TileEntitySpinningWheel tile = (TileEntitySpinningWheel) world.getTileEntity(x, y, z); + if (world.getTileEntity(x, y, z) instanceof TileEntitySpinningWheel tile) { for (int i = 0; i < 4; i++) { ItemStack stack = tile.getStackInSlot(i); @@ -306,8 +292,7 @@ public void breakBlock(World world, int x, int y, int z, Block par5, int par6) { } } } - if (world.getTileEntity(x, y, z) instanceof TileEntityCuttingTable) { - TileEntityCuttingTable tile = (TileEntityCuttingTable) world.getTileEntity(x, y, z); + if (world.getTileEntity(x, y, z) instanceof TileEntityCuttingTable tile) { for (int i = 0; i < tile.getSizeInventory(); i++) { ItemStack stack = tile.getStackInSlot(i); @@ -338,8 +323,7 @@ public void breakBlock(World world, int x, int y, int z, Block par5, int par6) { } } } - if (world.getTileEntity(x, y, z) instanceof TileEntityLabelLibrary) { - TileEntityLabelLibrary tile = (TileEntityLabelLibrary) world.getTileEntity(x, y, z); + if (world.getTileEntity(x, y, z) instanceof TileEntityLabelLibrary tile) { for (int i = 0; i < tile.getSizeInventory(); i++) { ItemStack stack = tile.getStackInSlot(i); diff --git a/src/main/java/witchinggadgets/common/blocks/BlockWallMirror.java b/src/main/java/witchinggadgets/common/blocks/BlockWallMirror.java index eb9a48acd..40dd4ecce 100644 --- a/src/main/java/witchinggadgets/common/blocks/BlockWallMirror.java +++ b/src/main/java/witchinggadgets/common/blocks/BlockWallMirror.java @@ -36,7 +36,7 @@ public void registerBlockIcons(IIconRegister iconRegister) { @Override @SideOnly(Side.CLIENT) - public void getSubBlocks(Item item, CreativeTabs tab, List list) {} + public void getSubBlocks(Item item, CreativeTabs tab, List list) {} @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, @@ -47,7 +47,6 @@ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer p tile = (TileEntityWallMirror) world.getTileEntity(x, y, z); else tile = (TileEntityWallMirror) world.getTileEntity(x, y - 1, z); - // tile.toggleState(); } return true; } @@ -77,9 +76,9 @@ public void onNeighborBlockChange(World world, int x, int y, int z, Block par5) super.onNeighborBlockChange(world, x, y, z, par5); TileEntityWallMirror tile = (TileEntityWallMirror) world.getTileEntity(x, y, z); if (tile.isDummy) { - if (world.isAirBlock(x, y - 1, z)) world.setBlockToAir(x, y, z); // ,false); + if (world.isAirBlock(x, y - 1, z)) world.setBlockToAir(x, y, z); } else { - if (world.isAirBlock(x, y + 1, z)) world.setBlockToAir(x, y, z); // ,true); + if (world.isAirBlock(x, y + 1, z)) world.setBlockToAir(x, y, z); } } @@ -91,7 +90,7 @@ public void onBlockHarvested(World world, int x, int y, int z, int par5, EntityP @Override public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { - ArrayList ret = new ArrayList(); + ArrayList ret = new ArrayList<>(); TileEntityWallMirror tile = (TileEntityWallMirror) world.getTileEntity(x, y, z); if (tile != null && !tile.isDummy) ret.add(new ItemStack(this, 1, damageDropped(metadata))); diff --git a/src/main/java/witchinggadgets/common/blocks/ItemBlockMetalDevice.java b/src/main/java/witchinggadgets/common/blocks/ItemBlockMetalDevice.java index b20748764..b4eb2ec69 100644 --- a/src/main/java/witchinggadgets/common/blocks/ItemBlockMetalDevice.java +++ b/src/main/java/witchinggadgets/common/blocks/ItemBlockMetalDevice.java @@ -21,7 +21,7 @@ public int getMetadata(int damageValue) { } @Override - public void getSubItems(Item item, CreativeTabs tab, List itemList) { + public void getSubItems(Item item, CreativeTabs tab, List itemList) { this.field_150939_a.getSubBlocks(item, tab, itemList); } diff --git a/src/main/java/witchinggadgets/common/blocks/ItemBlockStoneDevice.java b/src/main/java/witchinggadgets/common/blocks/ItemBlockStoneDevice.java index 9354010d2..f59ef7294 100644 --- a/src/main/java/witchinggadgets/common/blocks/ItemBlockStoneDevice.java +++ b/src/main/java/witchinggadgets/common/blocks/ItemBlockStoneDevice.java @@ -21,7 +21,7 @@ public int getMetadata(int damageValue) { } @Override - public void getSubItems(Item item, CreativeTabs tab, List itemList) { + public void getSubItems(Item item, CreativeTabs tab, List itemList) { itemList.add(new ItemStack(item, 1, 0)); itemList.add(new ItemStack(item, 1, 1)); } diff --git a/src/main/java/witchinggadgets/common/blocks/ItemBlockWoodenDevice.java b/src/main/java/witchinggadgets/common/blocks/ItemBlockWoodenDevice.java index c0b945496..e5320ed3d 100644 --- a/src/main/java/witchinggadgets/common/blocks/ItemBlockWoodenDevice.java +++ b/src/main/java/witchinggadgets/common/blocks/ItemBlockWoodenDevice.java @@ -21,7 +21,7 @@ public int getMetadata(int damageValue) { } @Override - public void getSubItems(Item item, CreativeTabs tab, List itemList) { + public void getSubItems(Item item, CreativeTabs tab, List itemList) { this.field_150939_a.getSubBlocks(item, tab, itemList); } diff --git a/src/main/java/witchinggadgets/common/blocks/tiles/MultipartEssentiaBuffer.java b/src/main/java/witchinggadgets/common/blocks/tiles/MultipartEssentiaBuffer.java index 61fac5d63..11938a287 100644 --- a/src/main/java/witchinggadgets/common/blocks/tiles/MultipartEssentiaBuffer.java +++ b/src/main/java/witchinggadgets/common/blocks/tiles/MultipartEssentiaBuffer.java @@ -71,23 +71,12 @@ public Cuboid6 getBounds() { TileEntity te = ThaumcraftApiHelper.getConnectableTile(world(), x(), y(), z(), fd); if (te != null) { switch (side) { - case 0: - miny = 0.0F; - break; - case 1: - maxy = 1.0F; - break; - case 2: - minz = 0.0F; - break; - case 3: - maxz = 1.0F; - break; - case 4: - minx = 0.0F; - break; - case 5: - maxx = 1.0F; + case 0 -> miny = 0.0F; + case 1 -> maxy = 1.0F; + case 2 -> minz = 0.0F; + case 3 -> maxz = 1.0F; + case 4 -> minx = 0.0F; + case 5 -> maxx = 1.0F; } } } @@ -96,7 +85,7 @@ public Cuboid6 getBounds() { @Override public Iterable getSubParts() { - ArrayList t = new ArrayList(); + ArrayList t = new ArrayList<>(); if (world().isRemote && (Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem() == null || !(Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem().getItem() instanceof ItemWandCasting || Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem() @@ -119,14 +108,14 @@ public Iterable getSubParts() { @Override public Iterable getOcclusionBoxes() { - ArrayList t = new ArrayList(); + ArrayList t = new ArrayList<>(); t.add(new Cuboid6(.25, .25, .25, .75, .75, .75)); return t; } @Override public Iterable getCollisionBoxes() { - ArrayList t = new ArrayList(); + ArrayList t = new ArrayList<>(); t.add(getBounds()); return t; } @@ -135,10 +124,10 @@ public Iterable getCollisionBoxes() { public void invalidateConvertedTile() { super.invalidateConvertedTile(); TileEntity te = world().getTileEntity(x(), y(), z()); - if (te instanceof TileTubeBuffer) { - this.aspects = ((TileTubeBuffer) te).aspects; - this.openSides = ((TileTubeBuffer) te).openSides; - this.chokedSides = ((TileTubeBuffer) te).chokedSides; + if (te instanceof TileTubeBuffer buffer) { + this.aspects = buffer.aspects; + this.openSides = buffer.openSides; + this.chokedSides = buffer.chokedSides; } } @@ -160,12 +149,10 @@ public void update() { } void fillBuffer() { - TileEntity te = null; - IEssentiaTransport ic = null; for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { - te = ThaumcraftApiHelper.getConnectableTile(world(), x(), y(), z(), dir); + TileEntity te = ThaumcraftApiHelper.getConnectableTile(world(), x(), y(), z(), dir); if (te != null) { - ic = (IEssentiaTransport) te; + IEssentiaTransport ic = (IEssentiaTransport) te; if (ic.getEssentiaAmount(dir.getOpposite()) > 0 && ic.getSuctionAmount(dir.getOpposite()) < getSuctionAmount(dir) && getSuctionAmount(dir) >= ic.getMinimumSuction()) { @@ -338,8 +325,7 @@ public int onWandRightClick(World world, ItemStack wand, EntityPlayer player, Mo if (ibox.min.x <= localHit.xCoord && ibox.max.x >= localHit.xCoord) if (ibox.min.y <= localHit.yCoord && ibox.max.y >= localHit.yCoord) if (ibox.min.z <= localHit.zCoord && ibox.max.z >= localHit.zCoord) { - if (ibox.data instanceof ForgeDirection) { - ForgeDirection fd = (ForgeDirection) ibox.data; + if (ibox.data instanceof ForgeDirection fd) { player.swingItem(); if (player.isSneaking()) { diff --git a/src/main/java/witchinggadgets/common/blocks/tiles/MultipartEssentiaTube.java b/src/main/java/witchinggadgets/common/blocks/tiles/MultipartEssentiaTube.java index bb972b20a..d74eb0ef3 100644 --- a/src/main/java/witchinggadgets/common/blocks/tiles/MultipartEssentiaTube.java +++ b/src/main/java/witchinggadgets/common/blocks/tiles/MultipartEssentiaTube.java @@ -87,23 +87,12 @@ public Cuboid6 getBounds() { TileEntity te = ThaumcraftApiHelper.getConnectableTile(world(), x(), y(), z(), fd); if (te != null) { switch (side) { - case 0: - miny = 0.0F; - break; - case 1: - maxy = 1.0F; - break; - case 2: - minz = 0.0F; - break; - case 3: - maxz = 1.0F; - break; - case 4: - minx = 0.0F; - break; - case 5: - maxx = 1.0F; + case 0 -> miny = 0.0F; + case 1 -> maxy = 1.0F; + case 2 -> minz = 0.0F; + case 3 -> maxz = 1.0F; + case 4 -> minx = 0.0F; + case 5 -> maxx = 1.0F; } } } @@ -112,21 +101,21 @@ public Cuboid6 getBounds() { @Override public Iterable getOcclusionBoxes() { - ArrayList t = new ArrayList(); + ArrayList t = new ArrayList<>(); t.add(new Cuboid6(.375, .375, .375, .625, .625, .625)); return t; } @Override public Iterable getCollisionBoxes() { - ArrayList t = new ArrayList(); + ArrayList t = new ArrayList<>(); t.add(getBounds()); return t; } @Override public Iterable getSubParts() { - ArrayList t = new ArrayList(); + ArrayList t = new ArrayList<>(); if (world().isRemote && (Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem() == null || !(Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem().getItem() instanceof ItemWandCasting || Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem() @@ -139,7 +128,6 @@ public Iterable getSubParts() { x() + fd.offsetX, y() + fd.offsetY, z() + fd.offsetZ) instanceof IEssentiaTransport) - // if(getConnectableTile(world(), x(), y(), z(), ForgeDirection.getOrientation(i))!=null) t.add(getConnectionPipe(ForgeDirection.getOrientation(i))); } t.add(new IndexedCuboid6(null, new Cuboid6(.375, .375, .375, .625, .625, .625))); @@ -189,9 +177,9 @@ public void update() { Random r = new Random(hashCode() * 4); float rp = r.nextFloat() * 360.0F; float ry = r.nextFloat() * 360.0F; - double fx = -MathHelper.sin(ry / 180.0F * 3.141593F) * MathHelper.cos(rp / 180.0F * 3.141593F); - double fz = MathHelper.cos(ry / 180.0F * 3.141593F) * MathHelper.cos(rp / 180.0F * 3.141593F); - double fy = -MathHelper.sin(rp / 180.0F * 3.141593F); + double fx = -MathHelper.sin(ry / 180.0F * (float) Math.PI) * MathHelper.cos(rp / 180.0F * (float) Math.PI); + double fz = MathHelper.cos(ry / 180.0F * (float) Math.PI) * MathHelper.cos(rp / 180.0F * (float) Math.PI); + double fy = -MathHelper.sin(rp / 180.0F * (float) Math.PI); Thaumcraft.proxy.drawVentParticles( this.world(), @@ -292,9 +280,6 @@ void equalizeWithNeighbours(boolean directional) { } int am = addEssentia(a, ic.takeEssentia(a, 1, fd.getOpposite()), fd); if (am > 0) { - // if (this.world().rand.nextInt(100) == 0) - // this.world().addBlockEvent(this.x(), this.y(), this.z(), - // ConfigBlocks.blockTube, 0, 0); return; } } @@ -393,10 +378,10 @@ public void renderDynamic(Vector3 pos, float partialRenderTick, int pass) { public TileEntity getConnectableTile(IBlockAccess world, int x, int y, int z, ForgeDirection face) { TileEntity te = world.getTileEntity(x + face.offsetX, y + face.offsetY, z + face.offsetZ); - if (((te instanceof IEssentiaTransport)) && (((IEssentiaTransport) te).isConnectable(face.getOpposite()))) { + if (te instanceof IEssentiaTransport transport && transport.isConnectable(face.getOpposite())) { return te; } - if (((te instanceof TileBellows)) && (((TileBellows) te).orientation == face.getOpposite().ordinal())) { + if (te instanceof TileBellows bellow && bellow.orientation == face.getOpposite().ordinal()) { return te; } return null; @@ -465,8 +450,7 @@ public int onWandRightClick(World world, ItemStack wand, EntityPlayer player, Mo if (ibox.min.x <= localHit.xCoord && ibox.max.x >= localHit.xCoord) if (ibox.min.y <= localHit.yCoord && ibox.max.y >= localHit.yCoord) if (ibox.min.z <= localHit.zCoord && ibox.max.z >= localHit.zCoord) { - if (ibox.data instanceof ForgeDirection) { - ForgeDirection fd = (ForgeDirection) ibox.data; + if (ibox.data instanceof ForgeDirection fd) { player.worldObj.playSound( x() + .5, y() + .5, diff --git a/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityAgeingStone.java b/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityAgeingStone.java index b7680fac6..d125133d4 100644 --- a/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityAgeingStone.java +++ b/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityAgeingStone.java @@ -13,18 +13,18 @@ public class TileEntityAgeingStone extends TileEntityWGBase { public void updateEntity() { AxisAlignedBB box = AxisAlignedBB .getBoundingBox(xCoord - 3, yCoord - 2, zCoord - 3, xCoord + 4, yCoord + 3, zCoord + 4); - List hitEntities = worldObj.getEntitiesWithinAABB(Entity.class, box); + List hitEntities = worldObj.getEntitiesWithinAABB(Entity.class, box); for (int i = 0; i < hitEntities.size(); i++) { - Object ent = hitEntities.get(i); - if (ent instanceof EntityAgeable) { - int age = ((EntityAgeable) ent).getGrowingAge(); + Entity ent = hitEntities.get(i); + if (ent instanceof EntityAgeable ageable) { + int age = ageable.getGrowingAge(); if (age < 0) { ++age; - ((EntityAgeable) ent).setGrowingAge(age); + ageable.setGrowingAge(age); } else if (age > 0) { --age; - ((EntityAgeable) ent).setGrowingAge(age); + ageable.setGrowingAge(age); } } } diff --git a/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityBlastfurnace.java b/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityBlastfurnace.java index ba857de91..14f52aca9 100644 --- a/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityBlastfurnace.java +++ b/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityBlastfurnace.java @@ -53,14 +53,6 @@ public void updateEntity() { && position != 16) || this.worldObj.isRemote) return; - /* - * if(worldObj.getWorldTime()%5==0 && position==1||position==3||position==5||position==7 && masterPos!=null && - * worldObj.getTileEntity(masterPos[0],masterPos[1],masterPos[2]) instanceof TileEntityBlastfurnace) { - * TileEntityBlastfurnace master = (TileEntityBlastfurnace) - * worldObj.getTileEntity(masterPos[0],masterPos[1],masterPos[2]); if(drawEssentia()) master.speedupTick += 600; - * } - */ - if (position == 10 || position == 12 || position == 14 || position == 16) { TileEntityBlastfurnace master = (TileEntityBlastfurnace) worldObj .getTileEntity(masterPos[0], masterPos[1], masterPos[2]); @@ -134,8 +126,7 @@ void storeFuel() { for (int y = this.yCoord - 5; y < this.yCoord + 5; y++) { for (int z = this.zCoord - 5; z < this.zCoord + 5; z++) { TileEntity tile = this.worldObj.getTileEntity(x, y, z); - if (tile instanceof IAspectSource) { - IAspectSource as = (IAspectSource) tile; + if (tile instanceof IAspectSource as) { if (as.takeFromContainer(Aspect.FIRE, 1)) { PacketHandler.INSTANCE.sendToAllAround( new PacketFXEssentiaSource( @@ -164,21 +155,16 @@ int calculateTime() { return Math.max(1, recipeTime / (speedupTick > 0 ? 2 : 1) - getBellows() * 40); } - /* - * boolean drawEssentia() { TileEntity tile = ThaumcraftApiHelper.getConnectableTile(worldObj, xCoord,yCoord,zCoord, - * this.facing); if(tile!=null) { ForgeDirection fd = position==1?ForgeDirection.NORTH: - * position==7?ForgeDirection.SOUTH: position==3?ForgeDirection.WEST: ForgeDirection.EAST; IEssentiaTransport et = - * (IEssentiaTransport)tile; if (!et.canOutputTo(fd.getOpposite())) return false; if - * ((et.getSuctionAmount(fd.getOpposite()) < getSuctionAmount(fd)) && (et.takeEssentia(getSuctionType(fd), 1, - * fd.getOpposite())==1)) return true; } return false; } - */ - void outputItem(ItemStack item) { TileEntity inventory = this.worldObj .getTileEntity(this.xCoord + facing.offsetX * 2, this.yCoord + 1, this.zCoord + facing.offsetZ * 2); - if ((inventory != null) && ((inventory instanceof IInventory))) item = InventoryUtils - .placeItemStackIntoInventory(item, (IInventory) inventory, this.facing.getOpposite().ordinal(), true); - + if (inventory instanceof IInventory) { + item = InventoryUtils.placeItemStackIntoInventory( + item, + (IInventory) inventory, + this.facing.getOpposite().ordinal(), + true); + } if (item != null) { EntityItem ei = new EntityItem( this.worldObj, @@ -297,8 +283,7 @@ public boolean canOutputTo(ForgeDirection fd) { @Override public int getEssentiaAmount(ForgeDirection fd) { TileEntity te = worldObj.getTileEntity(masterPos[0], masterPos[1], masterPos[2]); - if (te != null && te instanceof TileEntityBlastfurnace) - return ((TileEntityBlastfurnace) worldObj.getTileEntity(masterPos[0], masterPos[1], masterPos[2])).fuel; + if (te instanceof TileEntityBlastfurnace blastfurnace) return blastfurnace.fuel; return 0; } @@ -330,28 +315,8 @@ public boolean receiveClientEvent(int eventNum, int arg) { if (eventNum == 3) { this.specialFuel = arg == 1; worldObj.markBlockRangeForRenderUpdate(xCoord - 1, yCoord, zCoord - 1, xCoord + 1, yCoord + 2, zCoord + 1); - return true; - } - if (eventNum == 4) { - this.active = arg == 1; - worldObj.markBlockRangeForRenderUpdate(xCoord - 1, yCoord, zCoord - 1, xCoord + 1, yCoord + 2, zCoord + 1); - return true; - } - if (eventNum == 3) { for (int i = 0; i < 5; i++) { WitchingGadgets.proxy.createFurnaceOutputBlobFx(worldObj, xCoord, yCoord, zCoord, facing); - // float xx = xCoord+.5f+facing.offsetX*1.66f + worldObj.rand.nextFloat()*.3f; - // float zz = zCoord+.5f+facing.offsetZ*1.66f + worldObj.rand.nextFloat()*.3f; - // - // EntityLavaFX fb = new EntityLavaFX(worldObj, xx,yCoord+1.3f,zz); - // fb.motionY = .2f*worldObj.rand.nextFloat(); - // float mx = facing.offsetX!=0?(worldObj.rand.nextFloat() - worldObj.rand.nextFloat())*.5f : - // facing.offsetX*worldObj.rand.nextFloat(); - // float mz = facing.offsetZ!=0?(worldObj.rand.nextFloat() - worldObj.rand.nextFloat())*.5f : - // facing.offsetZ*worldObj.rand.nextFloat(); - // fb.motionX = (0.15f * mx); - // fb.motionZ = (0.15f * mz); - // FMLClientHandler.instance().getClient().effectRenderer.addEffect(fb); } worldObj.playSound( xCoord + .5f + facing.offsetX * 1.66f, @@ -363,19 +328,18 @@ public boolean receiveClientEvent(int eventNum, int arg) { false); return true; } + + if (eventNum == 4) { + this.active = arg == 1; + worldObj.markBlockRangeForRenderUpdate(xCoord - 1, yCoord, zCoord - 1, xCoord + 1, yCoord + 2, zCoord + 1); + return true; + } + if (eventNum == 5) { for (int i = 0; i < 3; i++) { worldObj.spawnParticle("lava", xCoord + .5, yCoord + .9, zCoord + .5, 0.0D, 0.0D, 0.0D); - // WitchingGadgets.proxy.createFurnaceDestructionBlobFx(worldObj, xCoord, yCoord, zCoord); - // float xx = xCoord+.5f+ worldObj.rand.nextFloat()*.3f; - // float zz = zCoord+.5f+ worldObj.rand.nextFloat()*.3f; - // - // EntityLavaFX fb = new EntityLavaFX(worldObj, xx,yCoord+1.5f,zz); - // fb.motionY = .2F; - // fb.motionX = (worldObj.rand.nextFloat() - worldObj.rand.nextFloat())*.5f*.15f; - // fb.motionZ = (worldObj.rand.nextFloat() - worldObj.rand.nextFloat())*.5f*.15f; - // FMLClientHandler.instance().getClient().effectRenderer.addEffect(fb); } + worldObj.playSound( xCoord + .5f, yCoord + 2.5f, @@ -404,59 +368,38 @@ public boolean receiveClientEvent(int eventNum, int arg) { public IIcon getTexture(int side) { int i = (masterPos == null || masterPos.length < 3) ? 0 - : (worldObj.getTileEntity(masterPos[0], masterPos[1], masterPos[2]) instanceof TileEntityBlastfurnace - && ((TileEntityBlastfurnace) worldObj - .getTileEntity(masterPos[0], masterPos[1], masterPos[2])).active) - ? (((TileEntityBlastfurnace) worldObj - .getTileEntity(masterPos[0], masterPos[1], masterPos[2])).specialFuel - ? 2 - : 1) - : 0; - switch (position) { - case 0: - return side == 2 ? icon_cornerBottomR[i] - : side == 4 ? icon_cornerBottomL[i] : side == 0 ? icon_cornerTopL[0] : icon_bricks; - case 1: - return side == 2 ? icon_sideBottom[i] : side == 0 ? icon_bottomTBLR[0] : icon_bricks; - case 2: - return side == 2 ? icon_cornerBottomL[i] - : side == 5 ? icon_cornerBottomR[i] : side == 0 ? icon_cornerTopR[0] : icon_bricks; - case 3: - return side == 4 ? icon_sideBottom[i] : side == 0 ? icon_bottomTBLR[2] : icon_bricks; - case 4: - return icon_bottom; - case 5: - return side == 5 ? icon_sideBottom[i] : side == 0 ? icon_bottomTBLR[3] : icon_bricks; - case 6: - return side == 3 ? icon_cornerBottomL[i] - : side == 4 ? icon_cornerBottomR[i] : side == 0 ? icon_cornerBottomL[0] : icon_bricks; - case 7: - return side == 3 ? icon_sideBottom[i] : side == 0 ? icon_bottomTBLR[1] : icon_bricks; - case 8: - return side == 3 ? icon_cornerBottomR[i] - : side == 5 ? icon_cornerBottomL[i] : side == 0 ? icon_cornerBottomR[0] : icon_bricks; - - case 9: - return side == 2 ? icon_cornerTopR[i] : icon_cornerTopL[i]; - case 10: - return side == 2 ? icon_sideTop[i] : i == 1 ? icon_internal : icon_bricks; - case 11: - return side == 2 ? icon_cornerTopL[i] : icon_cornerTopR[i]; - case 12: - return side == 4 ? icon_sideTop[i] : i == 1 ? icon_internal : icon_bricks; - case 14: - return side == 5 ? icon_sideTop[i] : i == 1 ? icon_internal : icon_bricks; - case 15: - return side == 3 ? icon_cornerTopL[i] : icon_cornerTopR[i]; - case 16: - return side == 3 ? icon_sideTop[i] : i == 1 ? icon_internal : icon_bricks; - case 17: - return side == 3 ? icon_cornerTopR[i] : icon_cornerTopL[i]; - case 22: - return icon_lava; - } + : (worldObj.getTileEntity( + masterPos[0], + masterPos[1], + masterPos[2]) instanceof TileEntityBlastfurnace blastfurnace && blastfurnace.active) + ? (blastfurnace.specialFuel ? 2 : 1) + : 0; + return switch (position) { + case 0 -> side == 2 ? icon_cornerBottomR[i] + : side == 4 ? icon_cornerBottomL[i] : side == 0 ? icon_cornerTopL[0] : icon_bricks; + case 1 -> side == 2 ? icon_sideBottom[i] : side == 0 ? icon_bottomTBLR[0] : icon_bricks; + case 2 -> side == 2 ? icon_cornerBottomL[i] + : side == 5 ? icon_cornerBottomR[i] : side == 0 ? icon_cornerTopR[0] : icon_bricks; + case 3 -> side == 4 ? icon_sideBottom[i] : side == 0 ? icon_bottomTBLR[2] : icon_bricks; + case 4 -> icon_bottom; + case 5 -> side == 5 ? icon_sideBottom[i] : side == 0 ? icon_bottomTBLR[3] : icon_bricks; + case 6 -> side == 3 ? icon_cornerBottomL[i] + : side == 4 ? icon_cornerBottomR[i] : side == 0 ? icon_cornerBottomL[0] : icon_bricks; + case 7 -> side == 3 ? icon_sideBottom[i] : side == 0 ? icon_bottomTBLR[1] : icon_bricks; + case 8 -> side == 3 ? icon_cornerBottomR[i] + : side == 5 ? icon_cornerBottomL[i] : side == 0 ? icon_cornerBottomR[0] : icon_bricks; + case 9 -> side == 2 ? icon_cornerTopR[i] : icon_cornerTopL[i]; + case 10 -> side == 2 ? icon_sideTop[i] : i == 1 ? icon_internal : icon_bricks; + case 11 -> side == 2 ? icon_cornerTopL[i] : icon_cornerTopR[i]; + case 12 -> side == 4 ? icon_sideTop[i] : i == 1 ? icon_internal : icon_bricks; + case 14 -> side == 5 ? icon_sideTop[i] : i == 1 ? icon_internal : icon_bricks; + case 15 -> side == 3 ? icon_cornerTopL[i] : icon_cornerTopR[i]; + case 16 -> side == 3 ? icon_sideTop[i] : i == 1 ? icon_internal : icon_bricks; + case 17 -> side == 3 ? icon_cornerTopR[i] : icon_cornerTopL[i]; + case 22 -> icon_lava; + default -> icon_bricks; + }; - return icon_bricks; } public static Block[] brickBlock = new Block[18]; diff --git a/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityCuttingTable.java b/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityCuttingTable.java index 6d23dc10c..a0bb34c3f 100644 --- a/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityCuttingTable.java +++ b/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityCuttingTable.java @@ -67,13 +67,12 @@ public void writeCustomNBT(NBTTagCompound tag) { public ItemStack getOutput() { if (this.inventory[0] == null || !InfusedGemHandler.isGem(this.inventory[0])) return null; - ItemStack stack = new ItemStack(WGContent.ItemInfusedGem); Aspect aspect = getInfusingAspect(); if (aspect != null) { int amplifier = (this.inventory[1] != null ? 1 : 0) + (this.inventory[2] != null ? 1 : 0) + (this.inventory[3] != null ? 1 : 0); int brittle = ItemInfusedGem.GemCut.getValue(targetGemCut) == GemCut.OVAL ? 1 : 0; - stack = ItemInfusedGem.createGem(aspect, ItemInfusedGem.GemCut.getValue(targetGemCut), false); + ItemStack stack = ItemInfusedGem.createGem(aspect, ItemInfusedGem.GemCut.getValue(targetGemCut), false); if (amplifier > 0) { if (Arrays.asList(InfusedGemHandler.getNaturalAffinities(inventory[0])).contains(aspect)) { if (amplifier - brittle > 0) @@ -99,7 +98,7 @@ public Aspect getInfusingAspect() { return l.getAspectsSortedAmount()[0]; } - static Set acceptedAspects = new HashSet(); + static Set acceptedAspects = new HashSet<>(); static { acceptedAspects.add(Aspect.AIR); diff --git a/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityEssentiaPump.java b/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityEssentiaPump.java index a1b892ba2..0dcdf3d93 100644 --- a/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityEssentiaPump.java +++ b/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityEssentiaPump.java @@ -86,9 +86,11 @@ ArrayList getMirrors() { yy += h; zz += l * fd.offsetZ; } + TileEntity te = worldObj.getTileEntity(xx, yy, zz); - if (te != null && te instanceof TileMirrorEssentia && canSeeMirror((TileMirrorEssentia) te)) - list.add((TileMirrorEssentia) te); + if (te instanceof TileMirrorEssentia mirror && canSeeMirror(mirror)) { + list.add(mirror); + } } return list; } diff --git a/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityEtherealWall.java b/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityEtherealWall.java index 5ccc8bd68..8786179ec 100644 --- a/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityEtherealWall.java +++ b/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityEtherealWall.java @@ -2,6 +2,7 @@ import net.minecraft.block.Block; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; import thaumcraft.common.config.ConfigBlocks; import witchinggadgets.common.util.EtherealWallMaster; @@ -22,36 +23,36 @@ public EtherealWallMaster getMaster() { EtherealWallMaster masterZmax = null; EtherealWallMaster masterXmin = null; EtherealWallMaster masterXmax = null; - if (worldObj.getTileEntity(xCoord, yCoord - 1, zCoord) != null - && worldObj.getTileEntity(xCoord, yCoord - 1, zCoord) instanceof TileEntityEtherealWall - && ((TileEntityEtherealWall) worldObj.getTileEntity(xCoord, yCoord - 1, zCoord)).master != null) { - masterYmin = ((TileEntityEtherealWall) worldObj.getTileEntity(xCoord, yCoord - 1, zCoord)).master; + TileEntity tile = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord); + if (tile instanceof TileEntityEtherealWall etherealWall && etherealWall.master != null) { + masterYmin = etherealWall.master; } - if (worldObj.getTileEntity(xCoord, yCoord + 1, zCoord) != null - && worldObj.getTileEntity(xCoord, yCoord + 1, zCoord) instanceof TileEntityEtherealWall - && ((TileEntityEtherealWall) worldObj.getTileEntity(xCoord, yCoord + 1, zCoord)).master != null) { - masterYmax = ((TileEntityEtherealWall) worldObj.getTileEntity(xCoord, yCoord + 1, zCoord)).master; + + tile = worldObj.getTileEntity(xCoord, yCoord + 1, zCoord); + if (tile instanceof TileEntityEtherealWall etherealWall && etherealWall.master != null) { + masterYmax = etherealWall.master; } - if (worldObj.getTileEntity(xCoord, yCoord, zCoord - 1) != null - && worldObj.getTileEntity(xCoord, yCoord, zCoord - 1) instanceof TileEntityEtherealWall - && ((TileEntityEtherealWall) worldObj.getTileEntity(xCoord, yCoord, zCoord - 1)).master != null) { - masterZmin = ((TileEntityEtherealWall) worldObj.getTileEntity(xCoord, yCoord, zCoord - 1)).master; + + tile = worldObj.getTileEntity(xCoord, yCoord, zCoord - 1); + if (tile instanceof TileEntityEtherealWall etherealWall && etherealWall.master != null) { + masterZmin = etherealWall.master; } - if (worldObj.getTileEntity(xCoord, yCoord, zCoord + 1) != null - && worldObj.getTileEntity(xCoord, yCoord, zCoord + 1) instanceof TileEntityEtherealWall - && ((TileEntityEtherealWall) worldObj.getTileEntity(xCoord, yCoord, zCoord + 1)).master != null) { - masterZmax = ((TileEntityEtherealWall) worldObj.getTileEntity(xCoord, yCoord, zCoord + 1)).master; + + tile = worldObj.getTileEntity(xCoord, yCoord, zCoord + 1); + if (tile instanceof TileEntityEtherealWall etherealWall && etherealWall.master != null) { + masterZmax = etherealWall.master; } - if (worldObj.getTileEntity(xCoord - 1, yCoord, zCoord) != null - && worldObj.getTileEntity(xCoord - 1, yCoord, zCoord) instanceof TileEntityEtherealWall - && ((TileEntityEtherealWall) worldObj.getTileEntity(xCoord - 1, yCoord, zCoord)).master != null) { - masterXmin = ((TileEntityEtherealWall) worldObj.getTileEntity(xCoord - 1, yCoord, zCoord)).master; + + tile = worldObj.getTileEntity(xCoord - 1, yCoord, zCoord); + if (tile instanceof TileEntityEtherealWall etherealWall && etherealWall.master != null) { + masterXmin = etherealWall.master; } - if (worldObj.getTileEntity(xCoord + 1, yCoord, zCoord) != null - && worldObj.getTileEntity(xCoord + 1, yCoord, zCoord) instanceof TileEntityEtherealWall - && ((TileEntityEtherealWall) worldObj.getTileEntity(xCoord + 1, yCoord, zCoord)).master != null) { - masterXmax = ((TileEntityEtherealWall) worldObj.getTileEntity(xCoord + 1, yCoord, zCoord)).master; + + tile = worldObj.getTileEntity(xCoord + 1, yCoord, zCoord); + if (tile instanceof TileEntityEtherealWall etherealWall && etherealWall.master != null) { + masterXmax = etherealWall.master; } + // get Overall Master if (masterYmin != null) masterOV = masterYmin; else if (masterYmax != null) masterOV = masterYmax; @@ -91,8 +92,7 @@ public EtherealWallMaster getMaster() { @Override public void updateEntity() { super.updateEntity(); - if (this.master == null) // || !this.master.tileMap.containsKey(this)) - { + if (this.master == null) { this.master = getMaster(); if (this.master == null) this.master = new EtherealWallMaster(); this.master.addTileToNet(this); @@ -119,7 +119,6 @@ public boolean isRenderTypeValid(int renderType, int blockMeta) { if (renderType == ConfigBlocks.blockStoneDeviceRI) return blockMeta == 0; if (renderType == ConfigBlocks.blockMetalDeviceRI) return blockMeta == 9; if (renderType == ConfigBlocks.blockCustomOreRI) return blockMeta == 0 || blockMeta == 7; - if (renderType == ConfigBlocks.blockCosmeticOpaqueRI) return true; - return false; + return renderType == ConfigBlocks.blockCosmeticOpaqueRI; } } diff --git a/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityIceGen.java b/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityIceGen.java index affd9eb8b..e6625f2ba 100644 --- a/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityIceGen.java +++ b/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityIceGen.java @@ -84,11 +84,8 @@ private boolean canOutput() { this.xCoord + this.facing.offsetX, this.yCoord + this.facing.offsetY, this.zCoord + this.facing.offsetZ); - if (inventory instanceof IInventory) return InventoryUtils.insertStack( - (IInventory) inventory, - new ItemStack(Blocks.ice), - this.facing.getOpposite().ordinal(), - false) == null; + if (inventory instanceof IInventory inv) return InventoryUtils + .insertStack(inv, new ItemStack(Blocks.ice), this.facing.getOpposite().ordinal(), false) == null; return true; } diff --git a/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityMagicBed.java b/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityMagicBed.java deleted file mode 100644 index 05211a134..000000000 --- a/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityMagicBed.java +++ /dev/null @@ -1,143 +0,0 @@ -package witchinggadgets.common.blocks.tiles; - -import java.util.Iterator; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayer.EnumStatus; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; - -public class TileEntityMagicBed extends TileEntity { - - public boolean isHead = false; - public boolean isOccupied = false; - - public boolean activate(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, - float hitZ) { - if (world.isRemote) return true; - - if (world.provider.canRespawnHere() && world.getBiomeGenForCoords(x, z) != BiomeGenBase.hell) { - if (isOccupied) { - EntityPlayer entityplayer1 = null; - Iterator iterator = world.playerEntities.iterator(); - - while (iterator.hasNext()) { - EntityPlayer entityplayer2 = (EntityPlayer) iterator.next(); - - if (entityplayer2.isPlayerSleeping()) { - ChunkCoordinates chunkcoordinates = entityplayer2.playerLocation; - - if (chunkcoordinates.posX == x && chunkcoordinates.posY == y && chunkcoordinates.posZ == z) { - entityplayer1 = entityplayer2; - } - } - } - - if (entityplayer1 != null) { - // player.addChatMessage("tile.bed.occupied"); - return true; - } - - this.isOccupied = false; - } - - EnumStatus enumstatus = player.sleepInBedAt(x, y, z); - - if (enumstatus == EnumStatus.OK) { - this.isOccupied = true; - return true; - } - // if (enumstatus == EnumStatus.NOT_POSSIBLE_NOW) - // player.addChatMessage("tile.bed.noSleep"); - // else if (enumstatus == EnumStatus.NOT_SAFE) - // player.addChatMessage("tile.bed.notSafe"); - - return true; - } - return true; - } - - /** - * Gets the nearest empty chunk coordinates for the player to wake up from a bed into. - */ - public static ChunkCoordinates getNearestEmptyChunkCoordinates(World par0World, int par1, int par2, int par3, - int par4) { - // int i1 = par0World.getBlockMetadata(par1, par2, par3); - // int j1 = BlockDirectional.getDirection(i1); - - for (int k1 = 0; k1 <= 1; ++k1) { - // int l1 = par1 - footBlockToHeadBlockMap[j1][0] * k1 - 1; - // int i2 = par3 - footBlockToHeadBlockMap[j1][1] * k1 - 1; - // int j2 = l1 + 2; - // int k2 = i2 + 2; - // - // for (int l2 = l1; l2 <= j2; ++l2) - // { - // for (int i3 = i2; i3 <= k2; ++i3) - // { - // if (par0World.doesBlockHaveSolidTopSurface(l2, par2 - 1, i3) && !par0World.getBlockMaterial(l2, par2, - // i3).isOpaque() && !par0World.getBlockMaterial(l2, par2 + 1, i3).isOpaque()) - // { - // if (par4 <= 0) - // { - // return new ChunkCoordinates(l2, par2, i3); - // } - // - // --par4; - // } - // } - // } - } - - return null; - } - - /** - * Drops the block items with a specified chance of dropping the specified items - */ - public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, - int par7) { - // if (!isBlockHeadOfBed(par5)) - // { - // super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0); - // } - } - - /** - * Returns the mobility information of the block, 0 = free, 1 = can't push but can move over, 2 = total immobility - * and stop pistons - */ - public int getMobilityFlag() { - return 1; - } - - // @SideOnly(Side.CLIENT) - // - // /** - // * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) - // */ - // public int idPicked(World par1World, int par2, int par3, int par4) - // { - // return Item.bed.itemID; - // } - - /** - * Called when the block is attempted to be harvested - */ - public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5, - EntityPlayer par6EntityPlayer) { - // if (par6EntityPlayer.capabilities.isCreativeMode && isBlockHeadOfBed(par5)) - // { - // int i1 = getDirection(par5); - // par2 -= footBlockToHeadBlockMap[i1][0]; - // par4 -= footBlockToHeadBlockMap[i1][1]; - // - // if (par1World.getBlockId(par2, par3, par4) == this.blockID) - // { - // par1World.setBlockToAir(par2, par3, par4); - // } - // } - } -} diff --git a/src/main/java/witchinggadgets/common/blocks/tiles/TileEntitySaunaStove.java b/src/main/java/witchinggadgets/common/blocks/tiles/TileEntitySaunaStove.java index 82261b7dc..d8de18f51 100644 --- a/src/main/java/witchinggadgets/common/blocks/tiles/TileEntitySaunaStove.java +++ b/src/main/java/witchinggadgets/common/blocks/tiles/TileEntitySaunaStove.java @@ -71,9 +71,9 @@ public void updateEntity() { } boolean recheck = false; - List openList = new ArrayList(); - List closedList = new ArrayList(); - List checked = new ArrayList(); + List openList = new ArrayList<>(); + List closedList = new ArrayList<>(); + List checked = new ArrayList<>(); int outlineMinX = xCoord; int outlineMaxX = xCoord; int outlineMinY = yCoord; @@ -82,12 +82,11 @@ public void updateEntity() { int outlineMaxZ = zCoord; public void checkArea() { - ChunkCoordinates next = null; final int closedListMax = 1200; int timeout = 0; while (timeout < 30 && closedList.size() < closedListMax && !openList.isEmpty()) { timeout++; - next = openList.get(0); + ChunkCoordinates next = openList.get(0); if (!checked.contains(next)) { boolean overWater = worldObj.isAABBInMaterial( AxisAlignedBB.getBoundingBox( @@ -97,7 +96,7 @@ public void checkArea() { next.posX + 1, yCoord + 6, next.posZ + 1), - Material.water); // waterColumns.contains(new ChunkCoordIntPair(cc.posX,cc.posZ)); + Material.water); if (isBlockValidForSteamPassing(next.posX, next.posY, next.posZ) && ((xCoord - next.posX) * (xCoord - next.posX) + (zCoord - next.posZ) * (zCoord - next.posZ)) < 64 @@ -131,8 +130,8 @@ && isBlockValidForSteamPassing(cc2.posX, cc2.posY, cc2.posZ)) } } - List aabbList = new ArrayList(); - Set aabbUsedBlocks = new HashSet(); + List aabbList = new ArrayList<>(); + Set aabbUsedBlocks = new HashSet<>(); Vec3 start = null; boolean recreate = false; @@ -141,7 +140,6 @@ void createAABBs() { while (aabbUsedBlocks.size() < closedList.size() && timeoutAABB < 1) { start = null; timeoutAABB++; - // int boxCol=0xffffff; boolean flag = false; for (int yy = outlineMinY; yy <= outlineMaxY; yy++) { for (int zz = outlineMinZ; zz <= outlineMaxZ; zz++) { @@ -149,7 +147,6 @@ void createAABBs() { if (closedList.contains(new ChunkCoordinates(xx, yy, zz)) && !aabbUsedBlocks.contains(new ChunkCoordinates(xx, yy, zz))) { start = Vec3.createVectorHelper(xx, yy, zz); - // boxCol = pixels[yy][zz][xx]; flag = true; break; } @@ -165,30 +162,23 @@ void createAABBs() { int maxX = (int) start.xCoord; int maxY = (int) start.yCoord; int maxZ = (int) start.zCoord; - for (; maxY < minY + 32; maxY++) - // if(pixels[maxY][minZ][minX]<0 || usedBlocks.contains(new PixelCoords(minX,maxY,minZ))) - if (!closedList.contains(new ChunkCoordinates(minX, maxY, minZ)) - || aabbUsedBlocks.contains(new ChunkCoordinates(minX, maxY, minZ))) - break; - for (; maxZ < minZ + 32; maxZ++) if ( - /* pixels[minY][maxZ][minX]<0 */ !closedList.contains(new ChunkCoordinates(minX, maxY, minZ)) + for (; maxY < minY + 32; maxY++) if (!closedList.contains(new ChunkCoordinates(minX, maxY, minZ)) + || aabbUsedBlocks.contains(new ChunkCoordinates(minX, maxY, minZ))) + break; + for (; maxZ < minZ + 32; maxZ++) if (!closedList.contains(new ChunkCoordinates(minX, maxY, minZ)) || aabbUsedBlocks.contains(new ChunkCoordinates(minX, minY, maxZ))) if (!closedList.contains(new ChunkCoordinates(minX, minY, maxZ)) || aabbUsedBlocks.contains(new ChunkCoordinates(minX, minY, maxZ))) break; - for (; maxX < minX + 32; maxX++) - // if(pixels[minY][minZ][maxX]<0 || usedBlocks.contains(new PixelCoords(maxX,minY,minZ))) - if (!closedList.contains(new ChunkCoordinates(maxX, minY, minZ)) - || aabbUsedBlocks.contains(new ChunkCoordinates(maxX, minY, minZ))) - break; + for (; maxX < minX + 32; maxX++) if (!closedList.contains(new ChunkCoordinates(maxX, minY, minZ)) + || aabbUsedBlocks.contains(new ChunkCoordinates(maxX, minY, minZ))) + break; for (int zz = minZ; zz < maxZ; zz++) { boolean row = true; - for (int xx = minX; xx < maxX; xx++) - // if(pixels[minY][zz][xx]<0 || usedBlocks.contains(new PixelCoords(xx,minY,zz))) - if (!closedList.contains(new ChunkCoordinates(xx, minY, zz)) - || aabbUsedBlocks.contains(new ChunkCoordinates(xx, minY, zz))) - row = false; + for (int xx = minX; xx < maxX; xx++) if (!closedList.contains(new ChunkCoordinates(xx, minY, zz)) + || aabbUsedBlocks.contains(new ChunkCoordinates(xx, minY, zz))) + row = false; if (!row) { maxZ = zz; break; @@ -196,9 +186,8 @@ void createAABBs() { } for (int yy = minY; yy < maxY; yy++) { boolean layer = true; - for (int zz = minZ; zz < maxZ; zz++) for (int xx = minX; xx < maxX; xx++) - // if(pixels[yy][zz][xx]<0 || usedBlocks.contains(new PixelCoords(xx,yy,zz))) - if (!closedList.contains(new ChunkCoordinates(xx, yy, zz)) + for (int zz = minZ; zz < maxZ; zz++) + for (int xx = minX; xx < maxX; xx++) if (!closedList.contains(new ChunkCoordinates(xx, yy, zz)) || aabbUsedBlocks.contains(new ChunkCoordinates(xx, yy, zz))) layer = false; if (!layer) { diff --git a/src/main/java/witchinggadgets/common/blocks/tiles/TileEntitySpinningWheel.java b/src/main/java/witchinggadgets/common/blocks/tiles/TileEntitySpinningWheel.java index d4b5a6ab9..1a22d9d74 100644 --- a/src/main/java/witchinggadgets/common/blocks/tiles/TileEntitySpinningWheel.java +++ b/src/main/java/witchinggadgets/common/blocks/tiles/TileEntitySpinningWheel.java @@ -60,8 +60,7 @@ private boolean hasWork() { private boolean canWork() { SpinningRecipe s = getRecipe(); ItemStack out = s.getOutput(); - if (!this.canStack(inv[5], out)) return false; - return true; + return this.canStack(inv[5], out); } private SpinningRecipe getRecipe() { @@ -77,10 +76,8 @@ private boolean canStack(ItemStack par1, ItemStack par2) { if (par2 == null) return true; if (par1 == null) return true; if (!(par1.isItemEqual(par2))) return false; - if (((par1.stackSize + par2.stackSize) <= par1.getMaxStackSize()) - && ((par1.stackSize + par2.stackSize) <= par2.getMaxStackSize())) - return true; - return false; + return ((par1.stackSize + par2.stackSize) <= par1.getMaxStackSize()) + && ((par1.stackSize + par2.stackSize) <= par2.getMaxStackSize()); } public int getProgressScaled(int max) { diff --git a/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityTerraformer.java b/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityTerraformer.java index 4db9de3d4..8d141c332 100644 --- a/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityTerraformer.java +++ b/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityTerraformer.java @@ -77,9 +77,8 @@ boolean drawEssentia() { if (te != null) { IEssentiaTransport ic = (IEssentiaTransport) te; if (!ic.canOutputTo(ForgeDirection.UP)) return false; - if ((ic.getSuctionAmount(ForgeDirection.UP) < getSuctionAmount(ForgeDirection.DOWN)) - && (ic.takeEssentia(this.currentSuction, 1, ForgeDirection.UP) == 1)) - return true; + return (ic.getSuctionAmount(ForgeDirection.UP) < getSuctionAmount(ForgeDirection.DOWN)) + && (ic.takeEssentia(this.currentSuction, 1, ForgeDirection.UP) == 1); } return false; } diff --git a/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityThaumicApplicator.java b/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityThaumicApplicator.java deleted file mode 100644 index bd84a7798..000000000 --- a/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityThaumicApplicator.java +++ /dev/null @@ -1,253 +0,0 @@ -// package witchinggadgets.common.blocks.tiles; -// -// import net.minecraft.block.Block; -// import net.minecraft.client.Minecraft; -// import net.minecraft.entity.player.EntityPlayer; -// import net.minecraft.inventory.ISidedInventory; -// import net.minecraft.item.ItemBlock; -// import net.minecraft.item.ItemStack; -// import net.minecraft.nbt.NBTTagCompound; -// import net.minecraft.tileentity.TileEntity; -// import net.minecraftforge.common.MinecraftForge; -// import net.minecraftforge.common.util.FakePlayerFactory; -// import net.minecraftforge.common.util.ForgeDirection; -// import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; -// import thaumcraft.common.lib.FakeThaumcraftPlayer; -// -// public class TileEntityThaumicApplicator extends TileEntity implements ISidedInventory -// { -// public ForgeDirection facing; -// FakeThaumcraftPlayer fakePlayer; -// ItemStack[] inv = new ItemStack[9]; -// -// @Override -// public void updateEntity() -// { -// if(fakePlayer == null) -// fakePlayer = FakePlayerFactory.get(worldObj, "wg.fakePlayer.ThaumicApplicator"); -// if(facing == null) -// facing = ForgeDirection.NORTH; -// useStack(); -// } -// -// private boolean useStack() -// { -// int targetX = this.xCoord + facing.offsetX; -// int targetY = this.yCoord + facing.offsetY; -// int targetZ = this.zCoord + facing.offsetZ; -// boolean flagNoBlock = false; -// int side = facing.getOpposite().ordinal(); -// if(worldObj.isAirBlock(targetX, targetY, targetZ)) -// { -// targetY -= 1; -// side = 1; -// if(worldObj.isAirBlock(targetX, targetY, targetZ)) -// { -// targetY += 2; -// side = 0; -// if(worldObj.isAirBlock(targetX, targetY, targetZ)) -// { -// flagNoBlock = true; -// targetY -= 1; -// } -// } -// } -// -// int slot=0; -// ItemStack stack = getStackInSlot(slot); -// -// boolean flag = false; -// int i1; -// if (stack != null && stack.getItem() != null && !flagNoBlock) -// if(stack.getItem().onItemUseFirst(stack, fakePlayer, worldObj, targetX, targetY, targetZ, side, 0.5f, 0.5f, 0.5f)) -// return true; -// -// if (!fakePlayer.isSneaking() || (fakePlayer.getHeldItem() == null || -// fakePlayer.getHeldItem().getItem().shouldPassSneakingClickToBlock(worldObj, targetX, targetY, targetZ))) -// { -// i1 = worldObj.getBlockId(targetX, targetY, targetZ); -// -// if (i1 > 0 && Block.blocksList[i1].onBlockActivated(worldObj, targetX, targetY, targetZ, fakePlayer, side, 0.5f, -// 0.5f, 0.5f)) -// { -// flag = true; -// } -// } -// -// if (!flag && stack != null && stack.getItem() instanceof ItemBlock) -// { -// ItemBlock itemblock = (ItemBlock)stack.getItem(); -// -// if (!itemblock.canPlaceItemBlockOnSide(worldObj, targetX, targetY, targetZ, side, fakePlayer, stack)) -// { -// return false; -// } -// } -// -// if(worldObj.isRemote) -// Minecraft.getMinecraft().getNetHandler().addToSendQueue(new Packet15Place(targetX, targetY, targetZ, side, stack, -// 0.5f, 0.5f, 0.5f)); -// -// if (flag) -// { -// return true; -// } -// else if (stack == null) -// { -// return false; -// } -// else -// { -// if (!stack.tryPlaceItemIntoWorld(fakePlayer, worldObj, targetX, targetY, targetZ, side, 0.5f, 0.5f, 0.5f)) -// { -// return false; -// } -// if (stack.stackSize <= 0) -// { -// MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(fakePlayer, stack)); -// } -// return true; -// } -// } -// -// @Override -// public int getSizeInventory() -// { -// return this.inv.length; -// } -// -// @Override -// public ItemStack getStackInSlot(int slot) -// { -// return this.inv[slot]; -// } -// -// @Override -// public ItemStack decrStackSize(int slot, int amount) -// { -// if (this.inv[slot] != null) -// { -// if (this.inv[slot].stackSize <= amount) -// { -// ItemStack itemstack = this.inv[slot]; -// this.inv[slot] = null; -// return itemstack; -// } -// ItemStack itemstack = this.inv[slot].splitStack(amount); -// if (this.inv[slot].stackSize == 0) { -// this.inv[slot] = null; -// } -// return itemstack; -// } -// return null; -// } -// -// @Override -// public ItemStack getStackInSlotOnClosing(int slot) -// { -// if (this.inv[slot] != null) -// { -// ItemStack itemstack = this.inv[slot]; -// this.inv[slot] = null; -// return itemstack; -// } -// return null; -// } -// -// @Override -// public void setInventorySlotContents(int slot, ItemStack stack) -// { -// this.inv[slot] = stack; -// if ((stack != null) && (stack.stackSize > getInventoryStackLimit())) { -// stack.stackSize = getInventoryStackLimit(); -// } -// } -// -// @Override -// public String getInventoryName() -// { -// return "container.thaumicapplicator"; -// } -// -// @Override -// public boolean hasCustomInventoryName() -// { -// return true; -// } -// -// @Override -// public int getInventoryStackLimit() -// { -// return 64; -// } -// -// @Override -// public boolean isUseableByPlayer(EntityPlayer entityplayer) -// { -// return true; -// } -// -// @Override -// public void openInventory() -// {} -// -// @Override -// public void closeInventory() -// {} -// -// @Override -// public boolean isItemValidForSlot(int slot, ItemStack stack) -// { -// return true; -// } -// -// @Override -// public int[] getAccessibleSlotsFromSide(int side) -// { -// return new int[]{0,1,2,3,4,5,6,7,8}; -// } -// -// @Override -// public boolean canInsertItem(int slot, ItemStack stack, int side) { -// return true; -// } -// -// @Override -// public boolean canExtractItem(int slot, ItemStack stack, int side) { -// return true; -// } -// -// -// @Override -// public void writeToNBT(NBTTagCompound tag) -// { -// super.writeToNBT(tag); -// writeCustomNBT(tag); -// } -// private void writeCustomNBT(NBTTagCompound tag) -// { -// tag.setInteger("facing", this.facing.ordinal()); -// } -// @Override -// public void readFromNBT(NBTTagCompound tag) -// { -// super.readFromNBT(tag); -// readCustomNBT(tag); -// } -// private void readCustomNBT(NBTTagCompound tag) -// { -// this.facing = ForgeDirection.getOrientation(tag.getInteger("facing")); -// } -//// @Override -//// public Packet getDescriptionPacket() -//// { -//// NBTTagCompound tag = new NBTTagCompound(); -//// writeToNBT(tag); -//// return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 1, tag); -//// } -//// @Override -//// public void onDataPacket(INetworkManager net, Packet132TileEntityData packet) -//// { -//// readCustomNBT(packet.data); -//// } -// } diff --git a/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityVoidWalkway.java b/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityVoidWalkway.java index 055261f5f..7086f7e35 100644 --- a/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityVoidWalkway.java +++ b/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityVoidWalkway.java @@ -1,6 +1,5 @@ package witchinggadgets.common.blocks.tiles; -import java.util.Iterator; import java.util.List; import net.minecraft.entity.player.EntityPlayer; @@ -20,17 +19,13 @@ public void updateEntity() { AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ); - List list = worldObj.getEntitiesWithinAABB(EntityPlayer.class, aabb); + List list = worldObj.getEntitiesWithinAABB(EntityPlayer.class, aabb); boolean flag = false; - Iterator i = list.iterator(); - while (i.hasNext()) { - EntityPlayer p = (EntityPlayer) i.next(); + for (EntityPlayer p : list) { if (p.isSneaking()) flag = true; } if (list.isEmpty() || flag) { worldObj.setBlockToAir(xCoord, yCoord, zCoord); - } else { - } } } diff --git a/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityWallMirror.java b/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityWallMirror.java index 69fa63f4b..d8063cd37 100644 --- a/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityWallMirror.java +++ b/src/main/java/witchinggadgets/common/blocks/tiles/TileEntityWallMirror.java @@ -40,104 +40,6 @@ public void updateEntity() { animation = 0; } - // if(isActive && !temp_isActivating && !temp_isDeActivating) - // { - // if(animation < 32)animation++; - // else animation=0; - // - // int l = this.facing; - // - // double minX; - // double maxX; - // double minZ; - // double maxZ; - // double minY = this.yCoord; - // double maxY = this.yCoord+2; - // - // switch (l) - // { - // case 2: - // default: - // minX = this.xCoord; - // maxX = this.xCoord+1; - // minZ = this.zCoord+0.75; - // maxZ = this.zCoord+1; - // break; - // case 3: - // minX = this.xCoord; - // maxX = this.xCoord+1; - // minZ = this.zCoord; - // maxZ = this.zCoord+0.25; - // break; - // case 4: - // minX = this.xCoord+0.75; - // maxX = this.xCoord+1; - // minZ = this.zCoord; - // maxZ = this.zCoord+1; - // break; - // case 5: - // minX = this.xCoord; - // maxX = this.xCoord+0.25; - // minZ = this.zCoord; - // maxZ = this.zCoord+1; - // break; - // } - // - // AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(minX,minY,minZ,maxX,maxY,maxZ); - // - // List list = worldObj.getEntitiesWithinAABB(EntityPlayer.class, aabb); - // Iterator i = list.iterator(); - // while(i.hasNext()) - // { - // EntityPlayer p = (EntityPlayer)i.next(); - // this.teleportPlayer(p); - // } - // } - } - - // public void teleportPlayer(EntityPlayer player) - // { - // if ((player.ridingEntity == null) && (player.riddenByEntity == null) && ((player instanceof EntityPlayerMP))) - // { - // //System.out.println("Heyo!"); - // EntityPlayerMP playerMP = (EntityPlayerMP) player; - // MinecraftServer mServer = MinecraftServer.getServer(); - // - // if (playerMP.timeUntilPortal > 0) - // { - // playerMP.timeUntilPortal = 10; - // } - // else - // { - // int dimID = playerMP.dimension; - // playerMP.timeUntilPortal = 10; - // playerMP.mcServer.getConfigurationManager().transferPlayerToDimension(playerMP, WGConfig.dimensionMirrorID, - // new TeleporterMirror(mServer.worldServerForDimension(WGConfig.dimensionMirrorID))); - // TileEntityMirrorPortal tile = null; - // try{ - // tile = - // (TileEntityMirrorPortal)playerMP.worldObj.getTileEntity((int)playerMP.posX,(int)playerMP.posY,(int)playerMP.posZ); - // } catch (ClassCastException e) { - // WitchingGadgets.logger.log(Level.ERROR, "[WitchingGadgets] No Portal Tile found on player Arrival in Crystal - // Void"); - // e.printStackTrace(); - // } - // if(tile != null) - // { - // tile.linkedDimension = dimID; - // if(!player.worldObj.isRemote) - // { - // tile.linkedDimensionName = MinecraftServer.getServer().worldServers[dimID].provider.getDimensionName(); - // WGPacketPipeline.INSTANCE.sendToAll(new PacketTileUpdate(tile)); - // } - // } - // } - // } - // } - - public void toggleState() { - if (this.isActive && !this.temp_isDeActivating) this.temp_isDeActivating = true; - else if (!this.isActive && !this.temp_isActivating) this.temp_isActivating = true; } @Override @@ -155,7 +57,6 @@ public void writeCustomNBT(NBTTagCompound tags) { } public List getMirroredPlayers() { - // System.out.println(facing); double minX = facing == 2 || facing == 3 ? -2 : facing == 4 ? -8 : -.5; double maxX = facing == 2 || facing == 3 ? 2 : facing == 4 ? .5 : 8; double minZ = facing == 4 || facing == 5 ? -2 : facing == 2 ? -8 : -.5; diff --git a/src/main/java/witchinggadgets/common/gui/ContainerBag.java b/src/main/java/witchinggadgets/common/gui/ContainerBag.java index ec455fdfa..e613dc475 100644 --- a/src/main/java/witchinggadgets/common/gui/ContainerBag.java +++ b/src/main/java/witchinggadgets/common/gui/ContainerBag.java @@ -13,12 +13,12 @@ public class ContainerBag extends Container { - private World worldObj; - private int blockedSlot; + private final World worldObj; + private final int blockedSlot; + private final int pouchSlotAmount = 18; + private final ItemStack pouch; + private final EntityPlayer player; public IInventory input = new InventoryBag(this); - ItemStack pouch = null; - EntityPlayer player = null; - private int pouchSlotAmount = 18; private final int hotbarSlot; public ContainerBag(InventoryPlayer iinventory, World world) { @@ -35,7 +35,7 @@ public ContainerBag(InventoryPlayer iinventory, World world) { bindPlayerInventory(iinventory); if (!world.isRemote) try { - ((InventoryBag) this.input).stackList = ((ItemBag) this.pouch.getItem()).getStoredItems(this.pouch); + ((InventoryBag) this.input).stackList = ItemBag.getStoredItems(this.pouch); } catch (Exception e) { e.printStackTrace(); } @@ -55,9 +55,9 @@ protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) { @Override public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int slot) { ItemStack stack = null; - Slot slotObject = (Slot) this.inventorySlots.get(slot); + Slot slotObject = this.inventorySlots.get(slot); - if ((slotObject != null) && (slotObject.getHasStack())) { + if (slotObject != null && slotObject.getHasStack()) { ItemStack stackInSlot = slotObject.getStack(); stack = stackInSlot.copy(); @@ -98,11 +98,7 @@ public ItemStack slotClick(int slotId, int clickedButton, int mode, EntityPlayer public void onContainerClosed(EntityPlayer par1EntityPlayer) { super.onContainerClosed(par1EntityPlayer); if (!this.worldObj.isRemote) { - ((ItemBag) this.pouch.getItem()).setStoredItems(this.pouch, ((InventoryBag) this.input).stackList); - /* - * if (!this.player.getCurrentEquippedItem().equals(this.pouch)) this.player.setCurrentItemOrArmor(0, - * this.pouch); - */ + ItemBag.setStoredItems(this.pouch, ((InventoryBag) this.input).stackList); this.player.inventory.markDirty(); } } @@ -122,8 +118,6 @@ public void detectAndSendChanges() { public void saveCharmPouch() { if (!this.player.worldObj.isRemote && this.isHoldingPouch()) { this.player.setCurrentItemOrArmor(0, this.pouch); - // ItemBag.setStoredItems(this.player.getHeldItem(), new ItemStack[] { this.charmInv.getStackInSlot(0), - // this.charmInv.getStackInSlot(1), this.charmInv.getStackInSlot(2) }); } } } diff --git a/src/main/java/witchinggadgets/common/gui/ContainerCuttingTable.java b/src/main/java/witchinggadgets/common/gui/ContainerCuttingTable.java index 494450781..b280c6512 100644 --- a/src/main/java/witchinggadgets/common/gui/ContainerCuttingTable.java +++ b/src/main/java/witchinggadgets/common/gui/ContainerCuttingTable.java @@ -86,15 +86,13 @@ public ItemStack transferStackInSlot(EntityPlayer player, int slot) { // merges the item into player inventory since its in the tileEntity if (slot < slotCount) { if (slot == 4) { - int maxStuff = ((Slot) inventorySlots.get(0)).getHasStack() - ? ((Slot) inventorySlots.get(0)).getStack().stackSize - : 0; - if (((Slot) inventorySlots.get(1)).getHasStack()) - maxStuff = Math.min(maxStuff, ((Slot) inventorySlots.get(1)).getStack().stackSize); - if (((Slot) inventorySlots.get(2)).getHasStack()) - maxStuff = Math.min(maxStuff, ((Slot) inventorySlots.get(2)).getStack().stackSize); - if (((Slot) inventorySlots.get(3)).getHasStack()) - maxStuff = Math.min(maxStuff, ((Slot) inventorySlots.get(3)).getStack().stackSize); + int maxStuff = inventorySlots.get(0).getHasStack() ? inventorySlots.get(0).getStack().stackSize : 0; + if (inventorySlots.get(1).getHasStack()) + maxStuff = Math.min(maxStuff, inventorySlots.get(1).getStack().stackSize); + if (inventorySlots.get(2).getHasStack()) + maxStuff = Math.min(maxStuff, inventorySlots.get(2).getStack().stackSize); + if (inventorySlots.get(3).getHasStack()) + maxStuff = Math.min(maxStuff, inventorySlots.get(3).getStack().stackSize); stackInSlot.stackSize = maxStuff; diff --git a/src/main/java/witchinggadgets/common/gui/ContainerLabelLibrary.java b/src/main/java/witchinggadgets/common/gui/ContainerLabelLibrary.java index c64570590..71dd33e2e 100644 --- a/src/main/java/witchinggadgets/common/gui/ContainerLabelLibrary.java +++ b/src/main/java/witchinggadgets/common/gui/ContainerLabelLibrary.java @@ -61,7 +61,7 @@ protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) { @Override public ItemStack transferStackInSlot(EntityPlayer player, int slot) { - Slot clickedSlot = (Slot) inventorySlots.get(slot); + Slot clickedSlot = inventorySlots.get(slot); switch (slot) { case LABEL_INPUT_SLOT: return transferLabelsWithAspect(new AspectList()); @@ -81,7 +81,7 @@ public ItemStack transferStackInSlot(EntityPlayer player, int slot) { private void transferInventoryToLabels(Slot clickedSlot) { ItemStack clickedItem = clickedSlot.getStack(); if (isLabel(clickedItem)) { - Slot labelSlot = (Slot) inventorySlots.get(LABEL_INPUT_SLOT); + Slot labelSlot = inventorySlots.get(LABEL_INPUT_SLOT); ItemStack labels = labelSlot.getStack(); if (labels == null) { ((IEssentiaContainerItem) clickedItem.getItem()).setAspects(clickedItem, new AspectList()); @@ -101,7 +101,7 @@ private void transferInventoryToLabels(Slot clickedSlot) { } private ItemStack transferLabelsWithAspect(AspectList aspects) { - Slot labelSlot = (Slot) inventorySlots.get(LABEL_INPUT_SLOT); + Slot labelSlot = inventorySlots.get(LABEL_INPUT_SLOT); ItemStack labels = labelSlot.getStack(); ItemStack returnStack = null; if (labelSlot.getHasStack()) { @@ -128,7 +128,7 @@ private ItemStack transferLabelsWithAspect(AspectList aspects) { public ItemStack slotClick(int slotId, int dragType, int clickTypeIn, EntityPlayer player) { ItemStack heldStack = player.inventory.getItemStack(); if (slotId == LABEL_INPUT_SLOT && heldStack != null) { - Slot labelSlot = (Slot) inventorySlots.get(slotId); + Slot labelSlot = inventorySlots.get(slotId); ItemStack labels = labelSlot.getStack(); // Accept all label items no matter their aspect, and clear their aspect if (labelSlot.isItemValid(heldStack)) { diff --git a/src/main/java/witchinggadgets/common/items/ItemClusters.java b/src/main/java/witchinggadgets/common/items/ItemClusters.java index f28297976..9f880c41a 100644 --- a/src/main/java/witchinggadgets/common/items/ItemClusters.java +++ b/src/main/java/witchinggadgets/common/items/ItemClusters.java @@ -35,10 +35,10 @@ public class ItemClusters extends Item { "Beryllium", "Cobalt", "Iridium", "Molybdenum", "Naquadah", "Neodymium", "Nickel", "Palladium", "Platinum", "Thorium", "Uranium235", "Uranium238", "Zinc", "Casserite" }; - public static HashMap loccodename = new HashMap(); + public static HashMap loccodename = new HashMap<>(); @Deprecated - public static HashMap materialMap = new HashMap(); + public static HashMap materialMap = new HashMap<>(); IIcon iconMetal; IIcon[] iconOverlay = new IIcon[3]; @@ -98,49 +98,16 @@ public IIcon getIcon(ItemStack stack, int pass) { @Override public String getItemStackDisplayName(ItemStack stack) { - String ss = ""; - /* - * if(!OreDictionary.getOres("ingot"+witchinggadgets.common.WGContent.GT_Cluster[stack.getItemDamage()]).isEmpty - * ()) { ItemStack ingot = - * OreDictionary.getOres("ingot"+witchinggadgets.common.WGContent.GT_Cluster[stack.getItemDamage()]).get(0); int - * limit = ingot.getDisplayName().lastIndexOf(" "); ss = ingot.getDisplayName().substring(0, Math.max(0, - * limit)); } else - * if(!OreDictionary.getOres("gem"+witchinggadgets.common.WGContent.GT_Cluster[stack.getItemDamage()]).isEmpty() - * ) { ItemStack ingot = - * OreDictionary.getOres("gem"+witchinggadgets.common.WGContent.GT_Cluster[stack.getItemDamage()]).get(0); int - * limit = ingot.getDisplayName().lastIndexOf(" "); ss = ingot.getDisplayName().substring(0, Math.max(0, - * limit)); } else - * if(!OreDictionary.getOres("dust"+witchinggadgets.common.WGContent.GT_Cluster[stack.getItemDamage()]).isEmpty( - * )) { ItemStack ingot = - * OreDictionary.getOres("dust"+witchinggadgets.common.WGContent.GT_Cluster[stack.getItemDamage()]).get(0); int - * limit = ingot.getDisplayName().lastIndexOf(" "); ss = ingot.getDisplayName().substring(0, Math.max(0, - * limit)); } - */ - ss = Materials.get(witchinggadgets.common.WGContent.GT_Cluster[stack.getItemDamage()]).mLocalizedName; + String ss = Materials.get(witchinggadgets.common.WGContent.GT_Cluster[stack.getItemDamage()]).mLocalizedName; return StatCollector.translateToLocalFormatted(this.getUnlocalizedNameInefficiently(stack) + ".name", ss) .trim(); } @Override - public void getSubItems(Item item, CreativeTabs tab, List itemList) { + public void getSubItems(Item item, CreativeTabs tab, List itemList) { if (WGConfig.allowClusters) for (int iOre = 0; iOre < witchinggadgets.common.WGContent.GT_Cluster.length; iOre++) if (!OreDictionary.getOres("ore" + witchinggadgets.common.WGContent.GT_Cluster[iOre]).isEmpty()) // && - // !OreDictionary.getOres("ingot"+witchinggadgets.common.WGContent.GT_Cluster[iOre]).isEmpty()) itemList.add(new ItemStack(item, 1, iOre)); } - - /* - * public static void setupClusters() { if(WGConfig.allowClusters) for(String ore : - * witchinggadgets.common.WGContent.GT_Cluster) { materialMap.put(ore, new - * Integer[]{ClientUtilities.getVibrantColourToInt(witchinggadgets.common.WGContent.GT_Cluster_Color.get(ore)),0}); - * try{ List colList = ClientUtilities.getItemColours( OreDictionary.getOres("ore"+ore).get(0) ); - * if(!colList.isEmpty()) { int oreBlockColour = colList.get(0); int[] rgb = {oreBlockColour>>16&0xff, - * oreBlockColour>>8&0xff, oreBlockColour&0xff}; int clustertype = rgb[0]>rgb[2]&&rgb[1]>rgb[2]?2 - * :rgb[0]>rgb[1]&&rgb[0]>rgb[2]?1 : 0; List colours = - * ClientUtilities.getItemColours(OreDictionary.getOres("ingot"+ore).get(0)); int colour = - * ClientUtilities.getVibrantColourToInt(colours.get((int)(colours.size()*.65))); colour = - * ClientUtilities.getVibrantColourToInt(colour); materialMap.put(ore, new Integer[]{colour, clustertype} ); } - * }catch(Exception e){ WitchingGadgets.logger.log(Level.ERROR, "Error setting up cluster for "+ore); } } } - */ } diff --git a/src/main/java/witchinggadgets/common/items/ItemCrystalCapsule.java b/src/main/java/witchinggadgets/common/items/ItemCrystalCapsule.java index c5d612054..c705cf0bb 100644 --- a/src/main/java/witchinggadgets/common/items/ItemCrystalCapsule.java +++ b/src/main/java/witchinggadgets/common/items/ItemCrystalCapsule.java @@ -90,8 +90,7 @@ public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer pla boolean tryFillTank(ItemStack stack, World world, int x, int y, int z, int side, EntityPlayer player) { TileEntity te = world.getTileEntity(x, y, z); - if (te instanceof IFluidHandler) { - IFluidHandler handler = (IFluidHandler) te; + if (te instanceof IFluidHandler handler) { ForgeDirection dir = ForgeDirection.getOrientation(side); FluidStack fs = getFluid(stack); if (fs == null) { @@ -176,7 +175,7 @@ public FluidStack drain(ItemStack container, int maxDrain, boolean doDrain) { } @Override - public void addInformation(ItemStack item, EntityPlayer player, List list, boolean adv) { + public void addInformation(ItemStack item, EntityPlayer player, List list, boolean adv) { Fluid f = this.getFluidStored(item); if (f != null) { String fluidName = "ERROR"; @@ -191,7 +190,7 @@ public void addInformation(ItemStack item, EntityPlayer player, List list, boole } @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { + public void getSubItems(Item item, CreativeTabs tab, List list) { list.add(new ItemStack(item)); for (Map.Entry f : FluidRegistry.getRegisteredFluids().entrySet()) { ItemStack s = new ItemStack(item); @@ -247,14 +246,7 @@ public ItemStack dispenseStack(IBlockSource dispenser, ItemStack stack) { stack); s = InventoryUtils.insertStack((IInventory) dispenser.getBlockTileEntity(), s, enumfacing.ordinal(), true); if (s != null) this.deafultBehaviour.dispense(dispenser, s); - // if(!dispenser.getWorld().isRemote) - // dispenser.getWorld().spawnEntityInWorld(new EntityFireworkRocket(dispenser.getWorld(), - // x+enumfacing.getFrontOffsetX(), y+enumfacing.getFrontOffsetY(), z+enumfacing.getFrontOffsetZ(), null)); - // if(s == stack) return stack; - // else - // return this.deafultBehaviour.dispense(dispenser, capsule.useCapsule(dispenser.getWorld(), - // x+enumfacing.getFrontOffsetX(), y+enumfacing.getFrontOffsetY(), z+enumfacing.getFrontOffsetZ(), stack)); } } } diff --git a/src/main/java/witchinggadgets/common/items/ItemInfusedGem.java b/src/main/java/witchinggadgets/common/items/ItemInfusedGem.java index 2aecdef9a..27fa2f7bf 100644 --- a/src/main/java/witchinggadgets/common/items/ItemInfusedGem.java +++ b/src/main/java/witchinggadgets/common/items/ItemInfusedGem.java @@ -1,6 +1,5 @@ package witchinggadgets.common.items; -import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -113,15 +112,16 @@ public boolean performEffect(String cut, Aspect aspect, int potency, int brittle if (!world.isRemote) world.setBlock(x + xoff, y, z + zoff, WGContent.BlockCustomAiry); world.scheduleBlockUpdate(x + xoff, y, z + zoff, WGContent.BlockCustomAiry, 10); te = world.getTileEntity(x + xoff, y, z + zoff); - if (te != null && te instanceof TileEntityTempLight) - ((TileEntityTempLight) te).tickMax = 3600 + potency * 800; // 3m + Potency*40s + if (te instanceof TileEntityTempLight tempLight) tempLight.tickMax = 3600 + potency * 800; // 3m + // + + // Potency*40s } if (world.isAirBlock(x, y + 2, z) && world.getBlockLightValue(x, y + 2, z) < 10) { if (!world.isRemote) world.setBlock(x, y + 2, z, WGContent.BlockCustomAiry); world.scheduleBlockUpdate(x, y + 2, z, WGContent.BlockCustomAiry, 10); te = world.getTileEntity(x, y + 2, z); - if (te != null && te instanceof TileEntityTempLight) - ((TileEntityTempLight) te).tickMax = 3600 + potency * 800; // 3m + Potency*40s + if (te instanceof TileEntityTempLight tempLight) tempLight.tickMax = 3600 + potency * 800; // 3m + + // Potency*40s } } if (aspect.equals(Aspect.WATER)) { @@ -204,9 +204,6 @@ public boolean performEffect(String cut, Aspect aspect, int potency, int brittle } else { if (!world.isRemote) { - int x = (int) player.posX; - int y = (int) player.posY; - int z = (int) player.posZ; if (potency == 0) { if (world.getBlock((int) player.posX, (int) player.posY + 2, (int) player.posZ) .equals(Blocks.air)) @@ -526,7 +523,7 @@ public boolean performEffect(String cut, Aspect aspect, int potency, int brittle double xOff = fnX - player.posX; double zOff = fnZ - player.posZ; double yOff = fnY - (player.posY + (double) player.getEyeHeight()); - double d3 = (double) MathHelper.sqrt_double(xOff * xOff + zOff * zOff); + double d3 = MathHelper.sqrt_double(xOff * xOff + zOff * zOff); float yaw = (float) (Math.atan2(zOff, xOff) * 180.0D / Math.PI) - 90.0F; float f3 = MathHelper.wrapAngleTo180_float(yaw - player.rotationYaw); yaw = player.rotationYaw + f3; @@ -643,7 +640,7 @@ public int getConsumedCharge(String cut, Aspect aspect, EntityPlayer player) { return 32; } - static HashMap powerBeams = new HashMap(); + static HashMap powerBeams = new HashMap<>(); @Override public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean selected) { @@ -651,18 +648,16 @@ public void onUpdate(ItemStack stack, World world, Entity entity, int slot, bool stack.getTagCompound().setByte("GemCut", (byte) 1); int brittle = EnchantmentHelper.getEnchantmentLevel(WGContent.enc_gemstoneBrittle.effectId, stack); - if (entity instanceof EntityPlayer) + if (entity instanceof EntityPlayer player) if (world.rand.nextInt(1000) < brittle || (getCut(stack) == GemCut.POINT && stack.getItemDamage() != 0)) { if (!world.isRemote) { - if (!((EntityPlayer) entity).inventory - .addItemStackToInventory(new ItemStack(WGContent.ItemMaterial, 1, 13))) - ((EntityPlayer) entity) - .dropPlayerItemWithRandomChoice(new ItemStack(WGContent.ItemMaterial, 1, 13), false); - ((EntityPlayer) entity).addChatMessage(new ChatComponentTranslation(Lib.CHAT + "gem.shatter")); + if (!player.inventory.addItemStackToInventory(new ItemStack(WGContent.ItemMaterial, 1, 13))) + player.dropPlayerItemWithRandomChoice(new ItemStack(WGContent.ItemMaterial, 1, 13), false); + player.addChatMessage(new ChatComponentTranslation(Lib.CHAT + "gem.shatter")); } stack.stackSize--; if (stack.stackSize <= 0) stack = null; - ((EntityPlayer) entity).inventory.setInventorySlotContents(slot, stack); + player.inventory.setInventorySlotContents(slot, stack); return; } if (world.rand.nextInt(20) < brittle) return; @@ -671,63 +666,47 @@ public void onUpdate(ItemStack stack, World world, Entity entity, int slot, bool && selected && entity.ticksExisted % 4 == 0 && this.getDamage(stack) > 0) { - if (TileVisRelay.nearbyPlayers.containsKey(Integer.valueOf(entity.getEntityId()))) - if ((((WeakReference) TileVisRelay.nearbyPlayers.get(Integer.valueOf(entity.getEntityId()))).get() - != null) - && (((TileVisRelay) ((WeakReference) TileVisRelay.nearbyPlayers - .get(Integer.valueOf(entity.getEntityId()))).get()) - .getDistanceFrom(entity.posX, entity.posY, entity.posZ) - < 26.0D)) { - Aspect aspect = getAspect(stack); - int amt = ((TileVisRelay) ((WeakReference) TileVisRelay.nearbyPlayers - .get(Integer.valueOf(entity.getEntityId()))).get()).consumeVis(aspect, 1); - if (amt > 0) { - this.setDamage(stack, getDamage(stack) - amt); - ((TileVisRelay) ((WeakReference) TileVisRelay.nearbyPlayers - .get(Integer.valueOf(entity.getEntityId()))).get()) - .triggerConsumeEffect(aspect); - if (world.isRemote) { - ForgeDirection d2 = ForgeDirection.getOrientation( - ((TileVisRelay) ((WeakReference) TileVisRelay.nearbyPlayers - .get(Integer.valueOf(entity.getEntityId()))) - .get()).orientation); - double x = ((TileVisRelay) ((WeakReference) TileVisRelay.nearbyPlayers - .get(Integer.valueOf(entity.getEntityId()))).get()).xCoord + .5 - + d2.offsetX * .05; - double y = ((TileVisRelay) ((WeakReference) TileVisRelay.nearbyPlayers - .get(Integer.valueOf(entity.getEntityId()))).get()).yCoord + .5 - + d2.offsetY * .05; - double z = ((TileVisRelay) ((WeakReference) TileVisRelay.nearbyPlayers - .get(Integer.valueOf(entity.getEntityId()))).get()).zCoord + .5 - + d2.offsetZ * .05; - double[] playerPos = ClientUtilities - .getPlayerHandPos((EntityPlayer) entity, true); - powerBeams.put( - entity.getEntityId(), - Thaumcraft.proxy.beamPower( - world, - x, - y, - z, - playerPos[0], - playerPos[1], - playerPos[2], - ((aspect.getColor() >> 16) & 0xff) / 255f, - ((aspect.getColor() >> 8) & 0xff) / 255f, - (aspect.getColor() & 0xff) / 255f, - false, - powerBeams.get(entity.getEntityId()))); - } - } - } else { - powerBeams.remove(entity.getEntityId()); - TileVisRelay.nearbyPlayers.remove(Integer.valueOf(entity.getEntityId())); - } + if (TileVisRelay.nearbyPlayers.containsKey(entity.getEntityId())) { + TileVisRelay relay = TileVisRelay.nearbyPlayers.get(entity.getEntityId()).get(); + if (relay != null && relay.getDistanceFrom(entity.posX, entity.posY, entity.posZ) < 26.0D) { + Aspect aspect = getAspect(stack); + int amt = relay.consumeVis(aspect, 1); + if (amt > 0) { + this.setDamage(stack, getDamage(stack) - amt); + relay.triggerConsumeEffect(aspect); + if (world.isRemote) { + ForgeDirection d2 = ForgeDirection.getOrientation(relay.orientation); + double x = relay.xCoord + .5 + d2.offsetX * .05; + double y = relay.yCoord + .5 + d2.offsetY * .05; + double z = relay.zCoord + .5 + d2.offsetZ * .05; + double[] playerPos = ClientUtilities.getPlayerHandPos((EntityPlayer) entity, true); + powerBeams.put( + entity.getEntityId(), + Thaumcraft.proxy.beamPower( + world, + x, + y, + z, + playerPos[0], + playerPos[1], + playerPos[2], + ((aspect.getColor() >> 16) & 0xff) / 255f, + ((aspect.getColor() >> 8) & 0xff) / 255f, + (aspect.getColor() & 0xff) / 255f, + false, + powerBeams.get(entity.getEntityId()))); + } + } + } else { + powerBeams.remove(entity.getEntityId()); + TileVisRelay.nearbyPlayers.remove(entity.getEntityId()); + } + } } } @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { + public void getSubItems(Item item, CreativeTabs tab, List list) { list.add(createGem(null, ItemInfusedGem.GemCut.POINT, true)); list.add(createGem(Aspect.ORDER, ItemInfusedGem.GemCut.POINT, false)); list.add(createGem(Aspect.ENTROPY, ItemInfusedGem.GemCut.POINT, false)); @@ -744,7 +723,7 @@ public void getSubItems(Item item, CreativeTabs tab, List list) { } @Override - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { if (getCut(stack) != null) list.add(StatCollector.translateToLocal(Lib.DESCRIPTION + "gemcut." + getCut(stack))); } @@ -802,11 +781,11 @@ public boolean isItemTool(ItemStack stack) { List getOres(World world, int x, int y, int z) { Block search = world.getBlock(x, y, z); - List ores = new ArrayList(); + List ores = new ArrayList<>(); - List openList = new ArrayList(); - List closedList = new ArrayList(); - List checked = new ArrayList(); + List openList = new ArrayList<>(); + List closedList = new ArrayList<>(); + List checked = new ArrayList<>(); openList.add(new ChunkCoordinates(x, y, z)); diff --git a/src/main/java/witchinggadgets/common/items/ItemMagicFood.java b/src/main/java/witchinggadgets/common/items/ItemMagicFood.java index 601b1f4e2..926ac09e6 100644 --- a/src/main/java/witchinggadgets/common/items/ItemMagicFood.java +++ b/src/main/java/witchinggadgets/common/items/ItemMagicFood.java @@ -65,14 +65,14 @@ public void onFoodEaten(ItemStack stack, World world, EntityPlayer player) { Thaumcraft.proxy.playerKnowledge.addAspectPool(player.getCommandSenderName(), a, q); Thaumcraft.proxy.getResearchManager(); ResearchManager.scheduleSave(player); - PacketHandler.INSTANCE.sendTo( - new PacketAspectPool( - a.getTag(), - Short.valueOf(q), - Short.valueOf( + PacketHandler.INSTANCE + .sendTo( + new PacketAspectPool( + a.getTag(), + q, Thaumcraft.proxy.playerKnowledge - .getAspectPoolFor(player.getCommandSenderName(), a))), - (EntityPlayerMP) player); + .getAspectPoolFor(player.getCommandSenderName(), a)), + (EntityPlayerMP) player); } } } @@ -95,7 +95,7 @@ public String getUnlocalizedName(ItemStack itemstack) { @SideOnly(Side.CLIENT) @Override - public void getSubItems(Item item, CreativeTabs tab, List itemList) { + public void getSubItems(Item item, CreativeTabs tab, List itemList) { for (int i = 0; i < subNames.length; i++) if (i != 2 || WGModCompat.loaded_TCon) itemList.add(new ItemStack(item, 1, i)); } diff --git a/src/main/java/witchinggadgets/common/items/ItemMaterials.java b/src/main/java/witchinggadgets/common/items/ItemMaterials.java index f175b0b7c..7b1516d8a 100644 --- a/src/main/java/witchinggadgets/common/items/ItemMaterials.java +++ b/src/main/java/witchinggadgets/common/items/ItemMaterials.java @@ -173,7 +173,7 @@ public boolean hasEffect(ItemStack stack, int pass) { @SideOnly(Side.CLIENT) @Override - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { try { if (stack.getItemDamage() == 11 && stack.hasTagCompound() && stack.getTagCompound().getBoolean("active")) list.add(Lib.DESCRIPTION + "active"); @@ -196,8 +196,7 @@ public void addInformation(ItemStack stack, EntityPlayer player, List list, bool .getBonusTags(new ItemStack(Item.getItemById(scan.id), 1, scan.meta), aspects); break; case 2: - if ((scan.entity instanceof EntityItem)) { - EntityItem item = (EntityItem) scan.entity; + if ((scan.entity instanceof EntityItem item)) { name = "\u00a7" + item.getEntityItem().getRarity().rarityColor.getFormattingCode() + item.getEntityItem().getDisplayName(); aspects = ThaumcraftCraftingManager.getObjectTags( @@ -263,7 +262,7 @@ public IIcon getIconFromDamage(int metadata) { @Override public IIcon getIconFromDamageForRenderPass(int meta, int pass) { - if (pass == 99) return meta == 9 ? iconPlateOverlay : iconPlateOverlay; + if (pass == 99) return iconPlateOverlay; return getIconFromDamage(meta); } @@ -283,7 +282,7 @@ public String getUnlocalizedName(ItemStack itemstack) { } @Override - public void getSubItems(Item item, CreativeTabs tab, List itemList) { + public void getSubItems(Item item, CreativeTabs tab, List itemList) { for (int i = 0; i < subNames.length; i++) itemList.add(new ItemStack(item, 1, i)); ItemStack luckyCoin = new ItemStack(ConfigItems.itemResource, 1, 18); luckyCoin.addEnchantment(Enchantment.fortune, 1); @@ -310,10 +309,10 @@ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, return true; } if (world.getTileEntity(targetX, targetY, targetZ) instanceof TileInfusionMatrix) { - ArrayList stabilizers = new ArrayList(); - ArrayList pedestals = new ArrayList(); - ArrayList warnings = new ArrayList(); - ArrayList components = new ArrayList(); + ArrayList stabilizers = new ArrayList<>(); + ArrayList pedestals = new ArrayList<>(); + ArrayList warnings = new ArrayList<>(); + ArrayList components = new ArrayList<>(); for (int xx = -12; xx <= 12; xx++) for (int zz = -12; zz <= 12; zz++) { boolean skip = false; @@ -323,7 +322,7 @@ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int z = targetZ + zz; TileEntity te = world.getTileEntity(x, y, z); - if (!skip && te != null && te instanceof TilePedestal) { + if (!skip && te instanceof TilePedestal) { if (yy >= 0) warnings.add(new Object[] { "pedestalHeight", x, y, z }); else if (Math.abs(xx) > 8 || Math.abs(zz) > 8) warnings.add(new Object[] { "pedestalPos", x, y, z }); @@ -346,7 +345,7 @@ else if (Math.abs(xx) > 8 || Math.abs(zz) > 8) int dz = targetZ - cc.posZ; TileEntity te = world.getTileEntity(cc.posX, cc.posY, cc.posZ); - if (te != null && te instanceof TilePedestal) { + if (te instanceof TilePedestal) { symmetry += 2; if (((TilePedestal) te).getStackInSlot(0) != null) { symmetry += 1; @@ -357,7 +356,7 @@ else if (Math.abs(xx) > 8 || Math.abs(zz) > 8) int xx = targetX + dx; int zz = targetZ + dz; te = world.getTileEntity(xx, cc.posY, zz); - if (te != null && te instanceof TilePedestal) { + if (te instanceof TilePedestal) { symmetry -= 2; if (((TilePedestal) te).getStackInSlot(0) != null) { if (items) symmetry -= 1; @@ -465,12 +464,13 @@ else if (Math.abs(xx) > 8 || Math.abs(zz) > 8) @Override public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { - if (subNames[stack.getItemDamage()] == "cuttingTools" && world.getTileEntity(x, y, z) instanceof TileTable) { + if (subNames[stack.getItemDamage()].equals("cuttingTools") + && world.getTileEntity(x, y, z) instanceof TileTable) { world.setBlock(x, y, z, WGContent.BlockWoodenDevice, 3, 0x3); - if (world.getTileEntity(x, y, z) instanceof TileEntityCuttingTable) { + if (world.getTileEntity(x, y, z) instanceof TileEntityCuttingTable cuttingTable) { int playerViewQuarter = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - int f = playerViewQuarter == 0 ? 2 : playerViewQuarter == 1 ? 5 : playerViewQuarter == 2 ? 3 : 4; - ((TileEntityCuttingTable) world.getTileEntity(x, y, z)).facing = f; + cuttingTable.facing = playerViewQuarter == 0 ? 2 + : playerViewQuarter == 1 ? 5 : playerViewQuarter == 2 ? 3 : 4; } return true; } @@ -483,7 +483,7 @@ public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer pla if (stack.hasTagCompound()) { ScanResult scan = Utilities .readScanResultFromNBT(stack.getTagCompound().getCompoundTag("scanResult"), world); - if (scan != null && !ScanManager.hasBeenScanned(player, scan)) { + if (!ScanManager.hasBeenScanned(player, scan)) { if (world.isRemote && ScanManager.completeScan(player, scan, "@")) PacketHandler.INSTANCE.sendToServer(new PacketScannedToServer(scan, player, "@")); player.inventory.decrStackSize(player.inventory.currentItem, 1); diff --git a/src/main/java/witchinggadgets/common/items/ItemPrimordialGem.java b/src/main/java/witchinggadgets/common/items/ItemPrimordialGem.java deleted file mode 100644 index 487cc2354..000000000 --- a/src/main/java/witchinggadgets/common/items/ItemPrimordialGem.java +++ /dev/null @@ -1,186 +0,0 @@ -package witchinggadgets.common.items; - -import java.util.HashMap; -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.IIcon; -import net.minecraft.util.StatCollector; -import net.minecraft.util.Vec3; -import net.minecraft.world.World; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import thaumcraft.api.aspects.Aspect; -import witchinggadgets.WitchingGadgets; - -public class ItemPrimordialGem extends Item { - - String[] subNames = { "perfodio", "vacuos", "sano", "aer" }; - HashMap subItems = new HashMap(); - - IIcon iconFrame; - - public ItemPrimordialGem() { - super(); - this.setMaxStackSize(1); - this.setHasSubtypes(true); - this.setCreativeTab(WitchingGadgets.tabWG); - - subItems.put(subNames[0], new Object[] { true, false }); - subItems.put(subNames[1], new Object[] { false, true }); - subItems.put(subNames[2], new Object[] { true, true }); - subItems.put(subNames[3], new Object[] { true, false }); - } - - @SideOnly(Side.CLIENT) - @Override - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { - String sA = null; - String sP = null; - if (isActiveGem(stack)) sA = StatCollector.translateToLocal("wg.gui.primordialGem.activeAbility") + " " - + StatCollector - .translateToLocal("wg.gui.primordialGem." + subNames[stack.getItemDamage()] + ".desc.active"); - if (isPassiveGem(stack)) sP = StatCollector.translateToLocal("wg.gui.primordialGem.passiveAbility") + " " - + StatCollector - .translateToLocal("wg.gui.primordialGem." + subNames[stack.getItemDamage()] + ".desc.passive"); - if (sA != null) list.add(sA); - if (sP != null) list.add(sP); - // if(stack.hasTagCompound() && stack.getTagCompound().hasKey("BraceletSlot")) - // list.add("Slot: "+stack.getTagCompound().getInteger("BraceletSlot")); - } - - @Override - public int getColorFromItemStack(ItemStack stack, int pass) { - if (pass == 0) { - String key = subNames[stack.getItemDamage()]; - Aspect a = Aspect.getAspect(key); - if (a != null) return a.getColor(); - else if (subItems.get(key).length > 2 && subItems.get(key)[2] != null - && subItems.get(key)[2] instanceof Integer) - return (Integer) subItems.get(key)[2]; - return 16777215; - } - return super.getColorFromItemStack(stack, pass); - } - - @Override - public void registerIcons(IIconRegister iconRegister) { - this.itemIcon = iconRegister.registerIcon("witchinggadgets:primordialGem"); - this.iconFrame = iconRegister.registerIcon("witchinggadgets:primordialGem_frame"); - } - - @Override - public boolean requiresMultipleRenderPasses() { - return true; - } - - @Override - public int getRenderPasses(int meta) { - return 2; - } - - @Override - public IIcon getIconFromDamageForRenderPass(int par1, int pass) { - if (pass == 0) return itemIcon; - return iconFrame; - } - - public void tickGem(World world, ItemStack bracelet, ItemStack gem, EntityLivingBase living) { - String tag = subNames[gem.getItemDamage()]; - if (tag.equalsIgnoreCase("sano")) { - if (living.getActivePotionEffect(Potion.regeneration) == null) { - living.addPotionEffect(new PotionEffect(Potion.regeneration.id, 20)); - } - } - } - - public boolean useGem(World world, ItemStack bracelet, ItemStack gem, EntityPlayer player) { - String tag = subNames[gem.getItemDamage()]; - if (tag.equalsIgnoreCase("aer")) { - AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox( - player.posX - 6, - player.posY - 2, - player.posZ - 6, - player.posX + 6, - player.posY + 3, - player.posZ + 6); - aabb.expand(6, 6, 6); - List targets = world.getEntitiesWithinAABBExcludingEntity(player, aabb); - for (Entity ent : targets) if (player.canEntityBeSeen(ent)) { - double distX = ent.posX - player.posX; - double distZ = ent.posZ - player.posZ; - double dist = Math.sqrt(distX * distX + distZ * distZ); - double force = Math.max(0, 1.0 - dist / 10.0); - Vec3 look = player.getLookVec(); - ent.motionX += force * look.xCoord; - ent.motionY = 0.25; - ent.motionZ += force * look.zCoord; - } - } - return false; - } - - public boolean useGemOnEntity(World world, ItemStack bracelet, ItemStack gem, EntityPlayer player, Entity target) { - - return false; - } - - public boolean useGemOnBlock(World world, ItemStack bracelet, ItemStack gem, EntityPlayer player, int x, int y, - int z, int side, float hitX, float hitY, float hitZ) { - String tag = subNames[gem.getItemDamage()]; - - if (tag.equalsIgnoreCase("perfodio")) { - int xMin = side == 0 || side == 1 || side == 2 || side == 3 ? x - 1 : x; - int xMax = side == 0 || side == 1 || side == 2 || side == 3 ? x + 1 : x; - int yMin = side == 2 || side == 3 || side == 4 || side == 5 ? y - 1 : y; - int yMax = side == 2 || side == 3 || side == 4 || side == 5 ? y + 1 : y; - int zMin = side == 0 || side == 1 || side == 4 || side == 5 ? z - 1 : z; - int zMax = side == 0 || side == 1 || side == 4 || side == 5 ? z + 1 : z; - for (int xx = xMin; xx <= xMax; xx++) - for (int yy = yMin; yy <= yMax; yy++) for (int zz = zMin; zz <= zMax; zz++) { - Block b = world.getBlock(xx, yy, zz); - int bMeta = world.getBlockMetadata(xx, yy, zz); - if (b != null) - if (!player.capabilities.isCreativeMode && b.canEntityDestroy(world, xx, yy, zz, player)) { - if (b.removedByPlayer(world, player, xx, yy, zz, true)) - b.onBlockDestroyedByPlayer(world, xx, yy, zz, bMeta); - b.harvestBlock(world, player, xx, yy, zz, bMeta); - b.onBlockHarvested(world, xx, yy, zz, bMeta, player); - } else world.setBlockToAir(xx, yy, zz); - } - } - return false; - } - - public boolean isActiveGem(ItemStack gem) { - return (Boolean) subItems.get(subNames[gem.getItemDamage()])[0]; - } - - public boolean isPassiveGem(ItemStack gem) { - return (Boolean) subItems.get(subNames[gem.getItemDamage()])[1]; - } - - @Override - public String getUnlocalizedName(ItemStack itemstack) { - return getUnlocalizedName() + "." + subNames[itemstack.getItemDamage()]; - } - - @SideOnly(Side.CLIENT) - @Override - public void getSubItems(Item item, CreativeTabs tab, List itemList) { - for (int i = 0; i < subNames.length; i++) { - itemList.add(new ItemStack(this, 1, i)); - } - } -} diff --git a/src/main/java/witchinggadgets/common/items/ItemRelic.java b/src/main/java/witchinggadgets/common/items/ItemRelic.java deleted file mode 100644 index 6ae4a62c0..000000000 --- a/src/main/java/witchinggadgets/common/items/ItemRelic.java +++ /dev/null @@ -1,175 +0,0 @@ -package witchinggadgets.common.items; - -import java.util.List; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class ItemRelic extends Item { - - public IIcon[] icon = new IIcon[64]; - - private static final String[] subNames = { "hourglass", "dawnStone", "duskStone", "homewardBone" }; - - public ItemRelic() { - super(); - this.setHasSubtypes(true); - this.setMaxStackSize(1); - } - - @Override - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { - player.setItemInUse(stack, this.getMaxItemUseDuration(stack)); - return stack; - } - - @Override - public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int useTime) { - double[] itemPos = { player.posX, player.posY, player.posZ }; - if (useTime > 0) return; - switch (stack.getItemDamage()) { - case 0: - List l = world.getEntitiesWithinAABBExcludingEntity( - player, - AxisAlignedBB.getBoundingBox( - player.posX - 4, - player.posY - 3, - player.posZ - 4, - player.posX + 4, - player.posY + 3, - player.posZ + 4)); - for (Entity ent : l) if (ent instanceof EntityLiving) - ((EntityLiving) ent).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 120, 6)); - player.worldObj.playSound( - player.posX, - player.posY, - player.posZ, - "random.glass", - 0.4F, - 1.9F + player.worldObj.rand.nextFloat() * 0.2F, - false); - player.worldObj.playSound( - player.posX, - player.posY, - player.posZ, - "fireworks.twinkle_far", - 0.05F, - 1.9F + player.worldObj.rand.nextFloat() * 0.2F, - false); - break; - case 1: - if (!world.isRemote) MinecraftServer.getServer().worldServers[player.dimension].setWorldTime(0); - player.worldObj.playSound( - player.posX, - player.posY, - player.posZ, - "random.glass", - 0.4F, - 1.9F + player.worldObj.rand.nextFloat() * 0.2F, - false); - player.worldObj.playSound( - player.posX, - player.posY, - player.posZ, - "fireworks.twinkle_far", - 0.05F, - 1.9F + player.worldObj.rand.nextFloat() * 0.2F, - false); - break; - case 2: - if (!world.isRemote) MinecraftServer.getServer().worldServers[player.dimension].setWorldTime(12500); - player.worldObj.playSound( - player.posX, - player.posY, - player.posZ, - "random.glass", - 0.4F, - 1.9F + player.worldObj.rand.nextFloat() * 0.2F, - false); - player.worldObj.playSound( - player.posX, - player.posY, - player.posZ, - "fireworks.twinkle_far", - 0.05F, - 1.9F + player.worldObj.rand.nextFloat() * 0.2F, - false); - break; - case 3: - ChunkCoordinates cc = player.getBedLocation(player.dimension); - player.setPositionAndUpdate(cc.posX, cc.posY, cc.posZ); - player.worldObj.playSound( - cc.posX, - cc.posY, - cc.posZ, - "portal.trigger", - 0.4F, - 1.9F + player.worldObj.rand.nextFloat() * 0.2F, - false); - player.worldObj.playSound( - cc.posX, - cc.posY, - cc.posZ, - "fireworks.twinkle_far", - 0.05F, - 1.9F + player.worldObj.rand.nextFloat() * 0.2F, - false); - itemPos = new double[] { cc.posX, cc.posY, cc.posZ }; - break; - } - - if (!world.isRemote) - world.spawnEntityInWorld(new EntityItemReforming(world, itemPos[0], itemPos[1], itemPos[2], stack.copy())); - --stack.stackSize; - } - - @Override - public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { - par3EntityPlayer.stopUsingItem(); - return par1ItemStack; - } - - @Override - public int getMaxItemUseDuration(ItemStack stack) { - return 60; - } - - @Override - public void registerIcons(IIconRegister iconRegister) { - for (int i = 0; i < subNames.length; i++) - this.icon[i] = iconRegister.registerIcon("witchinggadgets:relic_" + subNames[i]); - } - - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(int metadata) { - return icon[metadata]; - } - - @Override - public String getUnlocalizedName(ItemStack itemstack) { - return getUnlocalizedName() + "." + subNames[itemstack.getItemDamage()]; - } - - @SideOnly(Side.CLIENT) - @Override - public void getSubItems(Item item, CreativeTabs tab, List itemList) { - for (int i = 0; i < subNames.length; i++) { - itemList.add(new ItemStack(this, 1, i)); - } - } -} diff --git a/src/main/java/witchinggadgets/common/items/armor/ItemAdvancedRobes.java b/src/main/java/witchinggadgets/common/items/armor/ItemAdvancedRobes.java index 1bfe0ddab..185ed80cd 100644 --- a/src/main/java/witchinggadgets/common/items/armor/ItemAdvancedRobes.java +++ b/src/main/java/witchinggadgets/common/items/armor/ItemAdvancedRobes.java @@ -90,7 +90,7 @@ public String getArmorTexture(ItemStack stack, Entity entity, int slot, String t } @Override - public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List list, boolean par4) { + public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List list, boolean par4) { list.add( EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("tc.visdiscount") + ": " @@ -99,8 +99,8 @@ public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List } public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) { - return par2ItemStack.isItemEqual(ItemApi.getItem("itemResource", 7)) ? true - : super.getIsRepairable(par1ItemStack, par2ItemStack); + return par2ItemStack.isItemEqual(ItemApi.getItem("itemResource", 7)) + || super.getIsRepairable(par1ItemStack, par2ItemStack); } @Override diff --git a/src/main/java/witchinggadgets/common/items/armor/ItemPrimordialArmor.java b/src/main/java/witchinggadgets/common/items/armor/ItemPrimordialArmor.java index 8ad930f69..5e5eaac72 100644 --- a/src/main/java/witchinggadgets/common/items/armor/ItemPrimordialArmor.java +++ b/src/main/java/witchinggadgets/common/items/armor/ItemPrimordialArmor.java @@ -90,16 +90,15 @@ public void onUpdate(ItemStack stack, World world, Entity entity, int slot, bool @SubscribeEvent public void onLivingUpdateEvent(LivingUpdateEvent event) { - if (event.entityLiving instanceof EntityPlayer) { - EntityPlayer player = (EntityPlayer) event.entityLiving; + if (event.entityLiving instanceof EntityPlayer player) { int amorcounter = 0; int modescounter = 0; - boolean helmet = player.getCurrentArmor(0) != null ? isThis(player.getCurrentArmor(0)) : false; - boolean chestplate = player.getCurrentArmor(1) != null ? isThis(player.getCurrentArmor(1)) : false; - boolean leggings = player.getCurrentArmor(2) != null ? isThis(player.getCurrentArmor(2)) : false; - boolean boots = player.getCurrentArmor(3) != null ? isThis(player.getCurrentArmor(3)) : false; + boolean helmet = player.getCurrentArmor(0) != null && isThis(player.getCurrentArmor(0)); + boolean chestplate = player.getCurrentArmor(1) != null && isThis(player.getCurrentArmor(1)); + boolean leggings = player.getCurrentArmor(2) != null && isThis(player.getCurrentArmor(2)); + boolean boots = player.getCurrentArmor(3) != null && isThis(player.getCurrentArmor(3)); int[] modes = new int[] { helmet ? getAbility(player.getCurrentArmor(0)) : 0, chestplate ? getAbility(player.getCurrentArmor(1)) : 0, @@ -113,11 +112,6 @@ public void onLivingUpdateEvent(LivingUpdateEvent event) { for (int i : modes) if (i == 1) ++modescounter; - /* - * if(leggings && getAbility(player.getCurrentArmor(2))==3) player.capabilities.setPlayerWalkSpeed(0.75F); - * else player.capabilities.setPlayerWalkSpeed(0.1F); if(boots && player.capabilities.isFlying && - * getAbility(player.getCurrentArmor(3)) == 6) player.noClip=true; else player.noClip=false; - */ } } @@ -128,10 +122,10 @@ public void onArmorTick(World world, EntityPlayer player, ItemStack stack) { byte amorcounter = 0; byte[] modescounter = { 0, 0, 0, 0, 0, 0 }; - boolean helmet = player.getCurrentArmor(0) != null ? isThis(player.getCurrentArmor(0)) : false; - boolean chestplate = player.getCurrentArmor(1) != null ? isThis(player.getCurrentArmor(1)) : false; - boolean leggings = player.getCurrentArmor(2) != null ? isThis(player.getCurrentArmor(2)) : false; - boolean boots = player.getCurrentArmor(3) != null ? isThis(player.getCurrentArmor(3)) : false; + boolean helmet = player.getCurrentArmor(0) != null && isThis(player.getCurrentArmor(0)); + boolean chestplate = player.getCurrentArmor(1) != null && isThis(player.getCurrentArmor(1)); + boolean leggings = player.getCurrentArmor(2) != null && isThis(player.getCurrentArmor(2)); + boolean boots = player.getCurrentArmor(3) != null && isThis(player.getCurrentArmor(3)); int[] modes = new int[] { helmet ? getAbility(player.getCurrentArmor(0)) : 0, chestplate ? getAbility(player.getCurrentArmor(1)) : 0, @@ -155,10 +149,8 @@ public void onArmorTick(World world, EntityPlayer player, ItemStack stack) { if (this.armorType == 3) { if (!player.capabilities.isFlying && player.moveForward > 0.0F) { if (player.worldObj.isRemote && !player.isSneaking()) { - if (!Thaumcraft.instance.entityEventHandler.prevStep - .containsKey(Integer.valueOf(player.getEntityId()))) - Thaumcraft.instance.entityEventHandler.prevStep - .put(Integer.valueOf(player.getEntityId()), Float.valueOf(player.stepHeight)); + if (!Thaumcraft.instance.entityEventHandler.prevStep.containsKey(player.getEntityId())) + Thaumcraft.instance.entityEventHandler.prevStep.put(player.getEntityId(), player.stepHeight); player.stepHeight = 1.0F; } if (player.onGround) { @@ -186,12 +178,6 @@ public void onArmorTick(World world, EntityPlayer player, ItemStack stack) { player.capabilities.isFlying = false; } - /* - * if (modes[2]==3) { player.capabilities.setPlayerWalkSpeed(0.75F); } else if (modes[2]!=3) { - * player.capabilities.setPlayerWalkSpeed(0.1F); } if(player.capabilities.isFlying && modes[3]==6) - * player.noClip=true; else if(!player.capabilities.isFlying || modes[3]!=6) player.noClip=false; - */ - switch (getAbility(stack)) // cur 1 = aer,2=terra,3=ignis, 4=aqua, 5=ordo, 6=perdidito, { @@ -204,7 +190,7 @@ public void onArmorTick(World world, EntityPlayer player, ItemStack stack) { player.posX + .5, player.posY + .5, player.posZ + .5).expand(4, 4, 4); - for (Entity projectile : (List) world.getEntitiesWithinAABB(Entity.class, aabb)) { + for (Entity projectile : world.getEntitiesWithinAABB(Entity.class, aabb)) { if (projectile == null) continue; if (!(projectile instanceof IProjectile) || projectile.getClass().getSimpleName().equalsIgnoreCase("IManaBurst")) @@ -274,8 +260,6 @@ else if (projectile instanceof EntityThrowable) case 5: player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 202, 0, true)); break; - case 6: - break; default: break; } @@ -322,43 +306,13 @@ public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, D @Override public boolean canActivate(EntityPlayer player, ItemStack stack, boolean isInHand) { return true; - // return getUpgrade(stack)!=null; } @Override public void activate(EntityPlayer player, ItemStack stack) { if (!player.worldObj.isRemote) cycleAbilities(stack); - // toggleActive(stack); } - // public PrimordialArmorUpgrade getUpgrade(ItemStack stack) - // { - // return PrimordialArmorUpgrade.AIR; - // // if(stack.hasTagCompound() && stack.getTagCompound().hasKey("primordialUpgrade")) - // // { - // // int i = stack.getTagCompound().getByte("primordialUpgrade"); - // // if(i>=0&&i=0&&ab<6? " "+EnumChatFormatting.DARK_GRAY+"- \u00a7"+Aspect.getPrimalAspects().get(ab).getChatcolor()+Aspect. - * getPrimalAspects().get(ab).getName()+EnumChatFormatting.RESET : ""; return - * super.getItemStackDisplayName(stack)+add; } - */ - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { int ab = (getAbility(stack) - 1); String add = ab >= 0 && ab < 6 ? " " + EnumChatFormatting.DARK_GRAY @@ -450,16 +404,15 @@ private boolean isThis(ItemStack stack) { @Override public void onUserDamaged(LivingHurtEvent event, ItemStack stack) { - if (event.entityLiving instanceof EntityPlayer) { - EntityPlayer player = (EntityPlayer) event.entityLiving; + if (event.entityLiving instanceof EntityPlayer player) { int amorcounter = 0; int[] modescounter = { 0, 0, 0, 0, 0, 0 }; - boolean helmet = player.getCurrentArmor(0) != null ? isThis(player.getCurrentArmor(0)) : false; - boolean chestplate = player.getCurrentArmor(1) != null ? isThis(player.getCurrentArmor(1)) : false; - boolean leggings = player.getCurrentArmor(2) != null ? isThis(player.getCurrentArmor(2)) : false; - boolean boots = player.getCurrentArmor(3) != null ? isThis(player.getCurrentArmor(3)) : false; + boolean helmet = player.getCurrentArmor(0) != null && isThis(player.getCurrentArmor(0)); + boolean chestplate = player.getCurrentArmor(1) != null && isThis(player.getCurrentArmor(1)); + boolean leggings = player.getCurrentArmor(2) != null && isThis(player.getCurrentArmor(2)); + boolean boots = player.getCurrentArmor(3) != null && isThis(player.getCurrentArmor(3)); int[] modes = new int[] { helmet ? getAbility(player.getCurrentArmor(0)) : 0, chestplate ? getAbility(player.getCurrentArmor(1)) : 0, @@ -490,22 +443,16 @@ public void onUserDamaged(LivingHurtEvent event, ItemStack stack) { player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 202, 1 + modescounter[1], true)); break; case 3: { - if (event.source.getSourceOfDamage() instanceof EntityLivingBase) { - ((EntityLivingBase) event.source.getSourceOfDamage()).setFire(5 * modescounter[2]); + if (event.source.getSourceOfDamage() instanceof EntityLivingBase source) { + source.setFire(5 * modescounter[2]); } break; } - case 4: - break; - case 5: - break; case 6: { - if (event.source.getSourceOfDamage() instanceof EntityLivingBase) { - ((EntityLivingBase) event.source.getSourceOfDamage()) - .addPotionEffect(new PotionEffect(Potion.blindness.id, 200 * modescounter[5], 0)); - ((EntityLivingBase) event.source.getSourceOfDamage()) - .addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200 * modescounter[5], 3)); + if (event.source.getSourceOfDamage() instanceof EntityLivingBase source) { + source.addPotionEffect(new PotionEffect(Potion.blindness.id, 200 * modescounter[5], 0)); + source.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200 * modescounter[5], 3)); } break; } @@ -534,60 +481,4 @@ public int getArmorDisplay(EntityPlayer p, ItemStack s, int slot) { @Override public void onUserTargeted(LivingSetAttackTargetEvent event, ItemStack stack) {} - // public enum PrimordialArmorUpgrade - // { - // AIR(new AspectList().add(Aspect.AIR,32).add(Aspect.MOTION,32).add(Aspect.ARMOR,32), new - // ItemStack(ConfigItems.itemShard,1,0),new ItemStack(ConfigItems.itemWispEssence),new ItemStack(Items.arrow),new - // ItemStack(ConfigItems.itemWispEssence),new ItemStack(Items.arrow),new ItemStack(ConfigItems.itemWispEssence),new - // ItemStack(ConfigItems.itemShard,1,0),new ItemStack(ConfigItems.itemWispEssence),new ItemStack(Items.arrow),new - // ItemStack(ConfigItems.itemWispEssence),new ItemStack(Items.arrow),new ItemStack(ConfigItems.itemWispEssence)), - // FIRE(new AspectList().add(Aspect.FIRE,32).add(Aspect.LIGHT,32).add(Aspect.ENERGY,32), new - // ItemStack(ConfigItems.itemShard,1,1),new ItemStack(ConfigItems.itemWispEssence),new ItemStack(Items.arrow),new - // ItemStack(ConfigItems.itemWispEssence),new ItemStack(Items.arrow),new ItemStack(ConfigItems.itemWispEssence),new - // ItemStack(ConfigItems.itemShard,1,1),new ItemStack(ConfigItems.itemWispEssence),new ItemStack(Items.arrow),new - // ItemStack(ConfigItems.itemWispEssence),new ItemStack(Items.arrow),new ItemStack(ConfigItems.itemWispEssence)), - // EARTH(new AspectList().add(Aspect.EARTH,32).add(Aspect.ARMOR,32).add(Aspect.METAL,32), new - // ItemStack(ConfigItems.itemShard,1,2),new ItemStack(ConfigItems.itemWispEssence),new - // ItemStack(Blocks.obsidian),new ItemStack(ConfigItems.itemWispEssence),new ItemStack(Blocks.obsidian),new - // ItemStack(ConfigItems.itemWispEssence),new ItemStack(ConfigItems.itemShard,1,2),new - // ItemStack(ConfigItems.itemWispEssence),new ItemStack(Blocks.obsidian),new - // ItemStack(ConfigItems.itemWispEssence),new ItemStack(Blocks.obsidian),new - // ItemStack(ConfigItems.itemWispEssence)), - // WATER(new AspectList().add(Aspect.WATER,32).add(Aspect.POISON,32).add(Aspect.HEAL,32), new - // ItemStack(ConfigItems.itemShard,1,3),new ItemStack(ConfigItems.itemWispEssence),new - // ItemStack(Items.milk_bucket),new ItemStack(ConfigItems.itemWispEssence),new ItemStack(Items.milk_bucket),new - // ItemStack(ConfigItems.itemWispEssence),new ItemStack(ConfigItems.itemShard,1,3),new - // ItemStack(ConfigItems.itemWispEssence),new ItemStack(Items.milk_bucket),new - // ItemStack(ConfigItems.itemWispEssence),new ItemStack(Items.milk_bucket),new - // ItemStack(ConfigItems.itemWispEssence)), - // ORDER(new AspectList().add(Aspect.ORDER,32).add(Aspect.HEAL,32).add(Aspect.EXCHANGE,32), new - // ItemStack(ConfigItems.itemShard,1,4),new ItemStack(ConfigItems.itemWispEssence),new ItemStack(Items.arrow),new - // ItemStack(ConfigItems.itemWispEssence),new ItemStack(Items.arrow),new ItemStack(ConfigItems.itemWispEssence),new - // ItemStack(ConfigItems.itemShard,1,4),new ItemStack(ConfigItems.itemWispEssence),new ItemStack(Items.arrow),new - // ItemStack(ConfigItems.itemWispEssence),new ItemStack(Items.arrow),new ItemStack(ConfigItems.itemWispEssence)), - // ENTROPY(new AspectList().add(Aspect.ENTROPY,32).add(Aspect.TRAP,32).add(Aspect.DARKNESS,32), new - // ItemStack(ConfigItems.itemShard,1,5),new ItemStack(ConfigItems.itemWispEssence),new - // ItemStack(Blocks.soul_sand),new ItemStack(ConfigItems.itemWispEssence),new ItemStack(Blocks.soul_sand),new - // ItemStack(ConfigItems.itemWispEssence),new ItemStack(ConfigItems.itemShard,1,5),new - // ItemStack(ConfigItems.itemWispEssence),new ItemStack(Blocks.soul_sand),new - // ItemStack(ConfigItems.itemWispEssence),new ItemStack(Blocks.soul_sand),new - // ItemStack(ConfigItems.itemWispEssence)); - // - // final ItemStack[] components; - // final AspectList aspects; - // PrimordialArmorUpgrade(AspectList aspects, ItemStack... components) - // { - // this.components = components; - // this.aspects = aspects; - // } - // - // public ItemStack[] getCompenents() - // { - // return components; - // } - // public AspectList getAspects() - // { - // return aspects; - // } - // } } diff --git a/src/main/java/witchinggadgets/common/items/baubles/ItemCloak.java b/src/main/java/witchinggadgets/common/items/baubles/ItemCloak.java index 9ef9b10a4..e0891a55e 100644 --- a/src/main/java/witchinggadgets/common/items/baubles/ItemCloak.java +++ b/src/main/java/witchinggadgets/common/items/baubles/ItemCloak.java @@ -161,7 +161,7 @@ public String getUnlocalizedName(ItemStack stack) { } @Override - public void getSubItems(Item item, CreativeTabs tab, List itemList) { + public void getSubItems(Item item, CreativeTabs tab, List itemList) { for (int i = 0; i < subNames.length; i++) if (i != 4 || WGModCompat.loaded_Twilight) itemList.add(new ItemStack(item, 1, i)); } @@ -202,7 +202,7 @@ public void setStoredItems(ItemStack item, ItemStack[] stackList) { } @Override - public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List list, boolean par4) { + public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List list, boolean par4) { if (stack.hasTagCompound() && stack.getTagCompound().getBoolean("noGlide")) list.add(StatCollector.translateToLocal(Lib.DESCRIPTION + "noGlide")); list.add(StatCollector.translateToLocalFormatted(Lib.DESCRIPTION + "gearSlot.tg." + getSlot(stack))); @@ -360,9 +360,7 @@ public void onUserTargeted(LivingSetAttackTargetEvent event, ItemStack stack) { @Optional.Method(modid = "Botania") public ItemStack getCosmeticItem(ItemStack stack) { if (!stack.hasTagCompound()) return null; - ItemStack cosmetic = ItemStack - .loadItemStackFromNBT(stack.getTagCompound().getCompoundTag("botaniaCosmeticOverride")); - return cosmetic; + return ItemStack.loadItemStackFromNBT(stack.getTagCompound().getCompoundTag("botaniaCosmeticOverride")); } @Optional.Method(modid = "Botania") diff --git a/src/main/java/witchinggadgets/common/items/baubles/ItemKama.java b/src/main/java/witchinggadgets/common/items/baubles/ItemKama.java index bb0c81bea..dff39fa33 100644 --- a/src/main/java/witchinggadgets/common/items/baubles/ItemKama.java +++ b/src/main/java/witchinggadgets/common/items/baubles/ItemKama.java @@ -85,7 +85,7 @@ public BaubleType getBaubleType(ItemStack stack) { } @Override - public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List list, boolean par4) { + public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List list, boolean par4) { if (stack.hasTagCompound() && stack.getTagCompound().getBoolean("noGlide")) list.add(StatCollector.translateToLocal(Lib.DESCRIPTION + "noGlide")); list.add(StatCollector.translateToLocalFormatted(Lib.DESCRIPTION + "gearSlot.bauble." + getBaubleType(stack))); diff --git a/src/main/java/witchinggadgets/common/items/baubles/ItemMagicalBaubles.java b/src/main/java/witchinggadgets/common/items/baubles/ItemMagicalBaubles.java index b1632b9a8..f58df7cc7 100644 --- a/src/main/java/witchinggadgets/common/items/baubles/ItemMagicalBaubles.java +++ b/src/main/java/witchinggadgets/common/items/baubles/ItemMagicalBaubles.java @@ -66,7 +66,7 @@ public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer pla @SideOnly(Side.CLIENT) @Override - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { String type = getSlot(stack) > 0 ? ("tg." + getSlot(stack)) : "bauble." + getBaubleType(stack); list.add(StatCollector.translateToLocalFormatted(Lib.DESCRIPTION + "gearSlot." + type)); @@ -128,7 +128,7 @@ public String getUnlocalizedName(ItemStack itemstack) { } @Override - public void getSubItems(Item item, CreativeTabs tab, List itemList) { + public void getSubItems(Item item, CreativeTabs tab, List itemList) { for (int i = 0; i < subNames.length; i++) if (i == 5) { itemList.add(getItemWithTitle(new ItemStack(this, 1, i), Lib.TITLE + "crimsonCultist")); itemList.add(getItemWithTitle(new ItemStack(this, 1, i), Lib.TITLE + "crimsonKnight")); @@ -261,9 +261,7 @@ public static ItemStack setInlaidGem(ItemStack ring, ItemStack gem) { @Optional.Method(modid = "Botania") public ItemStack getCosmeticItem(ItemStack stack) { if (!stack.hasTagCompound()) return null; - ItemStack cosmetic = ItemStack - .loadItemStackFromNBT(stack.getTagCompound().getCompoundTag("botaniaCosmeticOverride")); - return cosmetic; + return ItemStack.loadItemStackFromNBT(stack.getTagCompound().getCompoundTag("botaniaCosmeticOverride")); } @Optional.Method(modid = "Botania") diff --git a/src/main/java/witchinggadgets/common/items/tools/ItemBag.java b/src/main/java/witchinggadgets/common/items/tools/ItemBag.java index 9f71174b6..d7d01e6cb 100644 --- a/src/main/java/witchinggadgets/common/items/tools/ItemBag.java +++ b/src/main/java/witchinggadgets/common/items/tools/ItemBag.java @@ -165,17 +165,17 @@ public String getUnlocalizedName(ItemStack itemstack) { } @Override - public void getSubItems(Item item, CreativeTabs tab, List itemList) { + public void getSubItems(Item item, CreativeTabs tab, List itemList) { for (int i = 0; i < subNames.length; i++) itemList.add(new ItemStack(this, 1, i)); } @SideOnly(Side.CLIENT) @Override - public void addInformation(ItemStack item, EntityPlayer par2EntityPlayer, List list, boolean par4) { + public void addInformation(ItemStack item, EntityPlayer par2EntityPlayer, List list, boolean par4) { if (item.getItemDamage() == 1) { list.add( EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal(Lib.DESCRIPTION + "filteredItems")); - for (ItemStack stack : this.getStoredItems(item)) + for (ItemStack stack : getStoredItems(item)) if (stack != null) list.add(EnumChatFormatting.DARK_GRAY + " " + stack.getDisplayName()); } } @@ -190,7 +190,7 @@ public static ItemStack[] getStoredItems(ItemStack item) { NBTTagCompound tag = inv.getCompoundTagAt(i); int slot = tag.getByte("Slot") & 0xFF; - if ((slot >= 0) && (slot < stackList.length)) { + if (slot < stackList.length) { stackList[slot] = ItemStack.loadItemStackFromNBT(tag); } } diff --git a/src/main/java/witchinggadgets/common/items/tools/ItemPrimordialAxe.java b/src/main/java/witchinggadgets/common/items/tools/ItemPrimordialAxe.java index b9bcde411..9795f0b61 100644 --- a/src/main/java/witchinggadgets/common/items/tools/ItemPrimordialAxe.java +++ b/src/main/java/witchinggadgets/common/items/tools/ItemPrimordialAxe.java @@ -61,29 +61,30 @@ public ItemPrimordialAxe(ToolMaterial mat) { @Override public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean equipped) { super.onUpdate(stack, world, entity, slot, equipped); - if ((stack.isItemDamaged()) && (entity != null) - && (entity.ticksExisted % 40 == 0) - && ((entity instanceof EntityLivingBase))) - stack.damageItem(-1, (EntityLivingBase) entity); + if (stack.isItemDamaged() && entity != null + && entity.ticksExisted % 40 == 0 + && entity instanceof EntityLivingBase entityLiving) { + stack.damageItem(-1, entityLiving); + } } @Override public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity target) { - if (target instanceof EntityLivingBase) { - for (int i = 1; i < 4; i++) if (((EntityLivingBase) target).getEquipmentInSlot(i) != null - && ((EntityLivingBase) target).getEquipmentInSlot(i).getItem() instanceof ItemArmor) { - ItemStack armor = ((EntityLivingBase) target).getEquipmentInSlot(i); - if (armor.getItem() instanceof ISpecialArmor) ((ISpecialArmor) armor.getItem()).damageArmor( + if (target instanceof EntityLivingBase targetEntity) { + for (int i = 1; i < 4; i++) if (targetEntity.getEquipmentInSlot(i) != null + && targetEntity.getEquipmentInSlot(i).getItem() instanceof ItemArmor) { + ItemStack armor = targetEntity.getEquipmentInSlot(i); + if (armor.getItem() instanceof ISpecialArmor specialArmor) specialArmor.damageArmor( (EntityLivingBase) target, armor, DamageSource.causePlayerDamage(player), 4, EntityLiving.getArmorPosition(armor) - 1); - else stack.damageItem(5, (EntityLivingBase) target); - if (stack.stackSize <= 0) ((EntityLivingBase) target).setCurrentItemOrArmor(i, null); + else stack.damageItem(5, targetEntity); + if (stack.stackSize <= 0) target.setCurrentItemOrArmor(i, null); } if (getAbility(stack) == 0) { - for (EntityLivingBase e : (List) player.worldObj.getEntitiesWithinAABB( + for (EntityLivingBase e : player.worldObj.getEntitiesWithinAABB( EntityLivingBase.class, AxisAlignedBB.getBoundingBox( target.posX - 2, @@ -95,8 +96,8 @@ public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity ta if (e.canAttackWithItem() && !e.hitByEntity(player) && !e.equals(player)) { float f = (float) player.getEntityAttribute(SharedMonsterAttributes.attackDamage) .getAttributeValue(); - int i = EnchantmentHelper.getKnockbackModifier(player, (EntityLivingBase) e); - float f1 = EnchantmentHelper.getEnchantmentModifierLiving(player, (EntityLivingBase) e); + int i = EnchantmentHelper.getKnockbackModifier(player, e); + float f1 = EnchantmentHelper.getEnchantmentModifierLiving(player, e); if (player.isSprinting()) ++i; if (f > 0 || f1 > 0) { boolean flag = player.fallDistance > 0.0F && !player.onGround @@ -121,13 +122,11 @@ public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity ta if (flag2) { if (i > 0) { e.addVelocity( - (double) (-MathHelper.sin(player.rotationYaw * (float) Math.PI / 180.0F) - * (float) i - * 0.5F), + -MathHelper.sin(player.rotationYaw * (float) Math.PI / 180.0F) * (float) i + * 0.5F, 0.1D, - (double) (MathHelper.cos(player.rotationYaw * (float) Math.PI / 180.0F) - * (float) i - * 0.5F)); + MathHelper.cos(player.rotationYaw * (float) Math.PI / 180.0F) * (float) i + * 0.5F); player.motionX *= 0.6D; player.motionZ *= 0.6D; player.setSprinting(false); @@ -138,7 +137,7 @@ public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity ta if (f >= 18) player.triggerAchievement(AchievementList.overkill); player.setLastAttacker(e); - EnchantmentHelper.func_151384_a((EntityLivingBase) e, player); + EnchantmentHelper.func_151384_a(e, player); EnchantmentHelper.func_151385_b(player, e); player.addStat(StatList.damageDealtStat, Math.round(f * 10.0F)); if (j > 0) e.setFire(j * 4); @@ -148,14 +147,14 @@ public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity ta } } if (getAbility(stack) == 2) { - ((EntityLivingBase) target).addPotionEffect(new PotionEffect(WGContent.pot_cinderCoat.id, 80, 1)); + targetEntity.addPotionEffect(new PotionEffect(WGContent.pot_cinderCoat.id, 80, 1)); target.setFire(4); } if (getAbility(stack) == 3) - ((EntityLivingBase) target).addPotionEffect(new PotionEffect(WGContent.pot_dissolve.id, 80, 2)); + targetEntity.addPotionEffect(new PotionEffect(WGContent.pot_dissolve.id, 80, 2)); if (getAbility(stack) == 5) { - ((EntityLivingBase) target).addPotionEffect(new PotionEffect(Potion.weakness.getId(), 60)); - ((EntityLivingBase) target).addPotionEffect(new PotionEffect(Potion.hunger.getId(), 120)); + targetEntity.addPotionEffect(new PotionEffect(Potion.weakness.getId(), 60)); + targetEntity.addPotionEffect(new PotionEffect(Potion.hunger.getId(), 120)); } } return false; @@ -191,14 +190,7 @@ public int getReturnedPearls(ItemStack stack) { return 2; } - /* - * @Override public String getItemStackDisplayName(ItemStack stack) { int ab = getAbility(stack); String add = - * ab>=0&&ab<6? " "+EnumChatFormatting.DARK_GRAY+"- \u00a7"+Aspect.getPrimalAspects().get(ab).getChatcolor()+Aspect. - * getPrimalAspects().get(ab).getName()+EnumChatFormatting.RESET : ""; return - * super.getItemStackDisplayName(stack)+add; } - */ - - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { int ab = getAbility(stack); String add = ab >= 0 && ab < 6 ? " " + EnumChatFormatting.DARK_GRAY + "- \u00a7" diff --git a/src/main/java/witchinggadgets/common/items/tools/ItemPrimordialGlove.java b/src/main/java/witchinggadgets/common/items/tools/ItemPrimordialGlove.java index 261fd26ef..ba6a6c8ae 100644 --- a/src/main/java/witchinggadgets/common/items/tools/ItemPrimordialGlove.java +++ b/src/main/java/witchinggadgets/common/items/tools/ItemPrimordialGlove.java @@ -49,7 +49,7 @@ public void registerIcons(IIconRegister iconRegister) { } @Override - public void addInformation(ItemStack item, EntityPlayer par2EntityPlayer, List list, boolean par4) { + public void addInformation(ItemStack item, EntityPlayer par2EntityPlayer, List list, boolean par4) { super.addInformation(item, par2EntityPlayer, list, par4); } @@ -66,7 +66,7 @@ public static ItemStack[] getSetGems(ItemStack bracelet) { for (int i = 0; i < list.tagCount(); i++) { NBTTagCompound tag = list.getCompoundTagAt(i); int slot = tag.getByte("Slot") & 0xFF; - if ((slot >= 0) && (slot < gems.length)) gems[slot] = ItemStack.loadItemStackFromNBT(tag); + if (slot < gems.length) gems[slot] = ItemStack.loadItemStackFromNBT(tag); } return gems; } @@ -74,8 +74,9 @@ public static ItemStack[] getSetGems(ItemStack bracelet) { public static ItemStack setSetGems(ItemStack bracelet, ItemStack[] gems) { if (bracelet == null || (!(bracelet.getItem() instanceof ItemPrimordialGlove)) || gems == null - || gems.length > 5) + || gems.length > 5) { return bracelet; + } if (bracelet.getTagCompound() == null) bracelet.setTagCompound(new NBTTagCompound()); @@ -127,7 +128,7 @@ public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer pla ItemStack[] gems = getSetGems(stack); boolean b = false; - if (gems != null && sel >= 0 && sel < gems.length && gems[sel] != null /* && !player.isSneaking() */) { + if (gems != null && sel >= 0 && sel < gems.length && gems[sel] != null) { ItemStack gem = gems[sel]; if (gem.getItem() instanceof IInfusedGem && gem.getItemDamage() + ((IInfusedGem) gem.getItem()) .getConsumedCharge(ItemInfusedGem.getCut(gem).toString(), ItemInfusedGem.getAspect(gem), player) @@ -160,8 +161,8 @@ public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer pla } @Override - public Multimap getAttributeModifiers(ItemStack stack) { - Multimap multimap = super.getAttributeModifiers(stack); + public Multimap getAttributeModifiers(ItemStack stack) { + Multimap multimap = super.getAttributeModifiers(stack); multimap.put( SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier( @@ -176,8 +177,7 @@ public Multimap getAttributeModifiers(ItemStack stack) { public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { TileEntity tile = world.getTileEntity(x, y, z); - if (!world.isRemote && tile != null && tile instanceof INode) { - INode node = (INode) tile; + if (!world.isRemote && tile instanceof INode node) { AspectList primals = new AspectList(); AspectList temp = ResearchManager.reduceToPrimals(node.getAspects(), true); for (Aspect aspect : temp.getAspects()) { diff --git a/src/main/java/witchinggadgets/common/items/tools/ItemPrimordialHammer.java b/src/main/java/witchinggadgets/common/items/tools/ItemPrimordialHammer.java index 6e45bbc0f..199bd16e0 100644 --- a/src/main/java/witchinggadgets/common/items/tools/ItemPrimordialHammer.java +++ b/src/main/java/witchinggadgets/common/items/tools/ItemPrimordialHammer.java @@ -67,11 +67,11 @@ public void onUpdate(ItemStack stack, World world, Entity entity, int slot, bool @Override public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity target) { - if (target instanceof EntityLivingBase) { - ((EntityLivingBase) target).addPotionEffect(new PotionEffect(Potion.confusion.id, 20)); + if (target instanceof EntityLivingBase targetEntity) { + targetEntity.addPotionEffect(new PotionEffect(Potion.confusion.id, 20)); if (getAbility(stack) == 0) { - for (EntityLivingBase e : (List) player.worldObj.getEntitiesWithinAABB( + for (EntityLivingBase e : player.worldObj.getEntitiesWithinAABB( EntityLivingBase.class, AxisAlignedBB.getBoundingBox( target.posX - 2, @@ -136,14 +136,14 @@ public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity ta } } if (getAbility(stack) == 2) { - ((EntityLivingBase) target).addPotionEffect(new PotionEffect(WGContent.pot_cinderCoat.id, 80, 1)); + targetEntity.addPotionEffect(new PotionEffect(WGContent.pot_cinderCoat.id, 80, 1)); target.setFire(4); } if (getAbility(stack) == 3) - ((EntityLivingBase) target).addPotionEffect(new PotionEffect(WGContent.pot_dissolve.id, 80, 2)); + targetEntity.addPotionEffect(new PotionEffect(WGContent.pot_dissolve.id, 80, 2)); if (getAbility(stack) == 5) { - ((EntityLivingBase) target).addPotionEffect(new PotionEffect(Potion.weakness.getId(), 60)); - ((EntityLivingBase) target).addPotionEffect(new PotionEffect(Potion.hunger.getId(), 120)); + targetEntity.addPotionEffect(new PotionEffect(Potion.weakness.getId(), 60)); + targetEntity.addPotionEffect(new PotionEffect(Potion.hunger.getId(), 120)); } } return false; @@ -179,14 +179,7 @@ public int getReturnedPearls(ItemStack stack) { return 2; } - /* - * @Override public String getItemStackDisplayName(ItemStack stack) { int ab = getAbility(stack); String add = - * ab>=0&&ab<6? " "+EnumChatFormatting.DARK_GRAY+"- \u00a7"+Aspect.getPrimalAspects().get(ab).getChatcolor()+Aspect. - * getPrimalAspects().get(ab).getName()+EnumChatFormatting.RESET : ""; return - * super.getItemStackDisplayName(stack)+add; } - */ - - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { int ab = getAbility(stack); String add = ab >= 0 && ab < 6 ? " " + EnumChatFormatting.DARK_GRAY + "- \u00a7" diff --git a/src/main/java/witchinggadgets/common/items/tools/ItemPrimordialSword.java b/src/main/java/witchinggadgets/common/items/tools/ItemPrimordialSword.java index f891a7758..6d596bb6a 100644 --- a/src/main/java/witchinggadgets/common/items/tools/ItemPrimordialSword.java +++ b/src/main/java/witchinggadgets/common/items/tools/ItemPrimordialSword.java @@ -59,9 +59,9 @@ public void onUpdate(ItemStack stack, World world, Entity entity, int slot, bool @Override public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity target) { - if (target instanceof EntityLivingBase) { + if (target instanceof EntityLivingBase targetEntity) { if (getAbility(stack) == 0) { - for (EntityLivingBase e : (List) player.worldObj.getEntitiesWithinAABB( + for (EntityLivingBase e : player.worldObj.getEntitiesWithinAABB( EntityLivingBase.class, AxisAlignedBB.getBoundingBox( target.posX - 2, @@ -73,8 +73,8 @@ public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity ta if (e.canAttackWithItem() && !e.hitByEntity(player) && !e.equals(player)) { float f = (float) player.getEntityAttribute(SharedMonsterAttributes.attackDamage) .getAttributeValue(); - int i = EnchantmentHelper.getKnockbackModifier(player, (EntityLivingBase) e); - float f1 = EnchantmentHelper.getEnchantmentModifierLiving(player, (EntityLivingBase) e); + int i = EnchantmentHelper.getKnockbackModifier(player, e); + float f1 = EnchantmentHelper.getEnchantmentModifierLiving(player, e); if (player.isSprinting()) ++i; if (f > 0 || f1 > 0) { boolean flag = player.fallDistance > 0.0F && !player.onGround @@ -99,13 +99,11 @@ public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity ta if (flag2) { if (i > 0) { e.addVelocity( - (double) (-MathHelper.sin(player.rotationYaw * (float) Math.PI / 180.0F) - * (float) i - * 0.5F), + -MathHelper.sin(player.rotationYaw * (float) Math.PI / 180.0F) * (float) i + * 0.5F, 0.1D, - (double) (MathHelper.cos(player.rotationYaw * (float) Math.PI / 180.0F) - * (float) i - * 0.5F)); + MathHelper.cos(player.rotationYaw * (float) Math.PI / 180.0F) * (float) i + * 0.5F); player.motionX *= 0.6D; player.motionZ *= 0.6D; player.setSprinting(false); @@ -116,7 +114,7 @@ public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity ta if (f >= 18) player.triggerAchievement(AchievementList.overkill); player.setLastAttacker(e); - EnchantmentHelper.func_151384_a((EntityLivingBase) e, player); + EnchantmentHelper.func_151384_a(e, player); EnchantmentHelper.func_151385_b(player, e); player.addStat(StatList.damageDealtStat, Math.round(f * 10.0F)); if (j > 0) e.setFire(j * 4); @@ -126,14 +124,14 @@ public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity ta } } if (getAbility(stack) == 2) { - ((EntityLivingBase) target).addPotionEffect(new PotionEffect(WGContent.pot_cinderCoat.id, 80, 1)); + targetEntity.addPotionEffect(new PotionEffect(WGContent.pot_cinderCoat.id, 80, 1)); target.setFire(4); } if (getAbility(stack) == 3) - ((EntityLivingBase) target).addPotionEffect(new PotionEffect(WGContent.pot_dissolve.id, 80, 2)); + targetEntity.addPotionEffect(new PotionEffect(WGContent.pot_dissolve.id, 80, 2)); if (getAbility(stack) == 5) { - ((EntityLivingBase) target).addPotionEffect(new PotionEffect(Potion.weakness.getId(), 60)); - ((EntityLivingBase) target).addPotionEffect(new PotionEffect(Potion.hunger.getId(), 120)); + targetEntity.addPotionEffect(new PotionEffect(Potion.weakness.getId(), 60)); + targetEntity.addPotionEffect(new PotionEffect(Potion.hunger.getId(), 120)); } } return false; @@ -169,14 +167,7 @@ public int getReturnedPearls(ItemStack stack) { return 2; } - /* - * @Override public String getItemStackDisplayName(ItemStack stack) { int ab = getAbility(stack); String add = - * ab>=0&&ab<6? " "+EnumChatFormatting.DARK_GRAY+"- \u00a7"+Aspect.getPrimalAspects().get(ab).getChatcolor()+Aspect. - * getPrimalAspects().get(ab).getName()+EnumChatFormatting.RESET : ""; return - * super.getItemStackDisplayName(stack)+add; } - */ - - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { int ab = getAbility(stack); String add = ab >= 0 && ab < 6 ? " " + EnumChatFormatting.DARK_GRAY + "- \u00a7" diff --git a/src/main/java/witchinggadgets/common/items/tools/ItemVorpalSword.java b/src/main/java/witchinggadgets/common/items/tools/ItemVorpalSword.java deleted file mode 100644 index 12a079f8a..000000000 --- a/src/main/java/witchinggadgets/common/items/tools/ItemVorpalSword.java +++ /dev/null @@ -1,47 +0,0 @@ -package witchinggadgets.common.items.tools; - -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemSword; -import net.minecraft.world.World; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import witchinggadgets.WitchingGadgets; - -public class ItemVorpalSword extends ItemSword { // TODO: Extend Avarita Sword - - public ItemVorpalSword() { - super(ToolMaterial.IRON); - this.setHarvestLevel("Sword", Integer.MAX_VALUE); - this.setMaxDamage(Integer.MAX_VALUE); - this.setMaxStackSize(1); - this.setCreativeTab(WitchingGadgets.tabWG); - } - - public boolean hitEntity(ItemStack p_77644_1_, EntityLivingBase p_77644_2_, EntityLivingBase p_77644_3_) { - p_77644_2_.setHealth(0); - return true; - } - - public boolean onBlockDestroyed(ItemStack p_150894_1_, World p_150894_2_, Block p_150894_3_, int p_150894_4_, - int p_150894_5_, int p_150894_6_, EntityLivingBase p_150894_7_) { - return true; - } - - public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) { - return false; - } - - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) { - if (!p_77624_2_.getDisplayName().contains("Alice")) { - p_77624_3_.add("Are you Alice?"); - p_77624_3_.add("You seem to be " + p_77624_2_.getDisplayName() + "!"); - } else p_77624_3_.add("You are Alice!"); - } -} diff --git a/src/main/java/witchinggadgets/common/pouch/ContainerPatchedFocusPouch.java b/src/main/java/witchinggadgets/common/pouch/ContainerPatchedFocusPouch.java index 03e0f264b..271bfb0cb 100644 --- a/src/main/java/witchinggadgets/common/pouch/ContainerPatchedFocusPouch.java +++ b/src/main/java/witchinggadgets/common/pouch/ContainerPatchedFocusPouch.java @@ -37,15 +37,6 @@ public ContainerPatchedFocusPouch(InventoryPlayer iinventory, World world, int p public void onContainerClosed(EntityPlayer player) { super.onContainerClosed(player); if (!player.worldObj.isRemote) { - // ((ItemFocusPouch)this.pouch.getItem()).setInventory(this.pouch, - // ((InventoryFocusPouch)this.input).stackList); - // if (this.player == null) { - // return; - // } - // if ((this.player.getHeldItem() != null) && (this.player.getHeldItem().isItemEqual(this.pouch))) { - // this.player.setCurrentItemOrArmor(0, this.pouch); - // } - // this.player.inventory.markDirty(); ItemStack beltPouch = ((ContainerFocusPouchAccessor) this).getPouch(); if (beltPouch != null) { if (BaublesApi.getBaubles(player).getStackInSlot(3) != null diff --git a/src/main/java/witchinggadgets/common/pouch/GuiPatchedFocusPouch.java b/src/main/java/witchinggadgets/common/pouch/GuiPatchedFocusPouch.java index 4f4bad731..0b2164cd3 100644 --- a/src/main/java/witchinggadgets/common/pouch/GuiPatchedFocusPouch.java +++ b/src/main/java/witchinggadgets/common/pouch/GuiPatchedFocusPouch.java @@ -12,7 +12,6 @@ public class GuiPatchedFocusPouch extends GuiContainer { public GuiPatchedFocusPouch(InventoryPlayer inventoryPlayer, World world, int x, int y, int z) { super(new ContainerPatchedFocusPouch(inventoryPlayer, world, x, y, z)); - // this.blockSlot = par1InventoryPlayer.currentItem; this.xSize = 175; this.ySize = 232; } @@ -28,8 +27,8 @@ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); int var5 = (this.width - this.xSize) / 2; int var6 = (this.height - this.ySize) / 2; - GL11.glEnable(3042); + GL11.glEnable(GL11.GL_BLEND); drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize); - GL11.glDisable(3042); + GL11.glDisable(GL11.GL_BLEND); } } diff --git a/src/main/java/witchinggadgets/common/util/Cloak.java b/src/main/java/witchinggadgets/common/util/Cloak.java deleted file mode 100644 index 096679c96..000000000 --- a/src/main/java/witchinggadgets/common/util/Cloak.java +++ /dev/null @@ -1,128 +0,0 @@ -// package witchinggadgets.common.util; -// -// import net.minecraft.entity.player.EntityPlayer; -// import net.minecraft.item.ItemStack; -// import net.minecraft.potion.Potion; -// import net.minecraft.potion.PotionEffect; -// import net.minecraft.util.DamageSource; -// import net.minecraft.util.MathHelper; -// -// import org.apache.logging.log4j.Level; -// -// import thaumcraft.api.aspects.Aspect; -// import thaumcraft.api.aspects.AspectList; -// import witchinggadgets.WitchingGadgets; -// import witchinggadgets.client.ClientUtilities; -// -// public class Cloak -// { -// public static Cloak standard = new Cloak("STANDARD",100,"witchinggadgets:textures/models/cloak.png", -// ClientUtilities.colour_CloakBlue, 3); -// public static Cloak invisible = new Cloak("INVISIBILITY",30,"witchinggadgets:textures/models/cloakInvisibility.png", -// ClientUtilities.colour_CloakNil, new AspectList().add(Aspect.ORDER, 4).add(Aspect.ENTROPY, 4).add(Aspect.AIR, 2)); -// public static Cloak raven = new Cloak("RAVEN",0,"witchinggadgets:textures/models/cloakRaven.png", -// ClientUtilities.colour_CloakRaven, new AspectList().add(Aspect.ENTROPY, 5).add(Aspect.AIR, 6)); -// public static Cloak storage = new Cloak("STORAGE",0,"witchinggadgets:textures/models/cloak.png", -// ClientUtilities.colour_CloakStorage, new AspectList().add(Aspect.ORDER, 5).add(Aspect.EARTH, 5)); -// public static Cloak wolf = new Cloak("WOLF",0,"witchinggadgets:textures/models/cloakWolf.png", -// ClientUtilities.colour_CloakStorage, new AspectList().add(Aspect.ORDER, 6).add(Aspect.ENTROPY, 6)); -// -// public static String[] cloakTagList = {"STANDARD","INVISIBILITY","RAVEN","STORAGE","WOLF"}; -// -// private String unlocalizedName; -// private int maxDurability; -// private String texture; -// private int defaultColour; -// private AspectList visDiscount; -// -// -// public Cloak(String tag, int maxDmg, String texPath, int c, Object vD) -// { -// this.unlocalizedName = tag; -// this.maxDurability = maxDmg; -// this.texture = texPath; -// this.defaultColour = c; -// if(vD instanceof AspectList) -// this.visDiscount = (AspectList)vD; -// else if(vD instanceof Integer) -// { -// AspectList al = new AspectList(); -// for(Aspect a:Aspect.getPrimalAspects()) -// al.add(a, (Integer)vD); -// this.visDiscount = al; -// } -// else -// { -// String error = "Error on initializing Cloak with tag: "+tag+". Vis Discounter must either be an AspectList or an -// Integer for overall discount."; -// WitchingGadgets.logger.log(Level.ERROR, error); -// } -// } -// -// public void onItemUpdate(EntityPlayer user, ItemStack stack) -// { -// if(this.getUnlocalizedName().equals(invisible.getUnlocalizedName())) -// if(user.getActivePotionEffect(Potion.invisibility) == null || -// user.getActivePotionEffect(Potion.invisibility).getDuration()<2) -// user.addPotionEffect(new PotionEffect(Potion.invisibility.id, 3)); -// } -// -// public void onPlayerTakenDamage(EntityPlayer user, ItemStack stack, DamageSource source, float damage) -// { -// if(source == null || damage <= 0) -// return; -// if(this.getUnlocalizedName().equals(wolf.getUnlocalizedName())) -// { -// int amp = 1; -// if(damage >= 8) -// amp++; -// if(damage >= 12) -// amp++; -// if(user.getActivePotionEffect(Potion.damageBoost) == null || -// user.getActivePotionEffect(Potion.damageBoost).getDuration()<2) -// user.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 60, amp)); -// if(user.getActivePotionEffect(Potion.moveSpeed) == null || -// user.getActivePotionEffect(Potion.moveSpeed).getDuration()<2) -// user.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 60, amp)); -// if(user.getActivePotionEffect(Potion.resistance) == null || -// user.getActivePotionEffect(Potion.resistance).getDuration()<2) -// user.addPotionEffect(new PotionEffect(Potion.resistance.id, 60, amp)); -// } -// } -// -// public void onCloakUsed(EntityPlayer user, ItemStack stack) -// { -// //user.addChatMessage("Cloak was used"); -// -// if(this.getUnlocalizedName().equals(storage.getUnlocalizedName())) -// { -// user.openGui(WitchingGadgets.instance, 4, user.worldObj, MathHelper.floor_double(user.posX), -// MathHelper.floor_double(user.posY), MathHelper.floor_double(user.posZ)); -// } -// if(this.getUnlocalizedName().equals(raven.getUnlocalizedName())) -// { -// user.openGui(WitchingGadgets.instance, 5, user.worldObj, MathHelper.floor_double(user.posX), -// MathHelper.floor_double(user.posY), MathHelper.floor_double(user.posZ)); -// } -// } -// public String getUnlocalizedName() -// { -// return this.unlocalizedName; -// } -// public String getTexture() -// { -// return this.texture; -// } -// public int getMaxDamage() -// { -// return this.maxDurability; -// } -// public int getDefaultColour() -// { -// return this.defaultColour; -// } -// public AspectList getVisDiscount() -// { -// return this.visDiscount; -// } -// } diff --git a/src/main/java/witchinggadgets/common/util/EtherealWallMaster.java b/src/main/java/witchinggadgets/common/util/EtherealWallMaster.java index 4c99c8ecc..3252bcc2c 100644 --- a/src/main/java/witchinggadgets/common/util/EtherealWallMaster.java +++ b/src/main/java/witchinggadgets/common/util/EtherealWallMaster.java @@ -45,35 +45,6 @@ public void freeSlaves() { this.tileMap = new ArrayList(); } - public void checkNetIntegrity(TileEntityEtherealWall tile) { - // //Get adjacent tiles - // TileEntityEtherealWall adjYneg = null; - // TileEntityEtherealWall adjYpos = null; - // TileEntityEtherealWall adjZneg = null; - // TileEntityEtherealWall adjZpos = null; - // TileEntityEtherealWall adjXneg = null; - // TileEntityEtherealWall adjXpos = null; - // - // if(tile.getWorldObj().getTileEntity(tile.xCoord,tile.yCoord-1,tile.zCoord) instanceof - // TileEntityEtherealWall)adjYneg = - // (TileEntityEtherealWall)tile.getWorldObj().getTileEntity(tile.xCoord,tile.yCoord-1,tile.zCoord); - // if(tile.getWorldObj().getTileEntity(tile.xCoord,tile.yCoord+1,tile.zCoord) instanceof - // TileEntityEtherealWall)adjYpos = - // (TileEntityEtherealWall)tile.getWorldObj().getTileEntity(tile.xCoord,tile.yCoord+1,tile.zCoord); - // if(tile.getWorldObj().getTileEntity(tile.xCoord,tile.yCoord,tile.zCoord-1) instanceof - // TileEntityEtherealWall)adjZneg = - // (TileEntityEtherealWall)tile.getWorldObj().getTileEntity(tile.xCoord,tile.yCoord,tile.zCoord-1); - // if(tile.getWorldObj().getTileEntity(tile.xCoord,tile.yCoord,tile.zCoord+1) instanceof - // TileEntityEtherealWall)adjZpos = - // (TileEntityEtherealWall)tile.getWorldObj().getTileEntity(tile.xCoord,tile.yCoord,tile.zCoord+1); - // if(tile.getWorldObj().getTileEntity(tile.xCoord-1,tile.yCoord,tile.zCoord) instanceof - // TileEntityEtherealWall)adjXneg = - // (TileEntityEtherealWall)tile.getWorldObj().getTileEntity(tile.xCoord-1,tile.yCoord,tile.zCoord); - // if(tile.getWorldObj().getTileEntity(tile.xCoord+1,tile.yCoord,tile.zCoord) instanceof - // TileEntityEtherealWall)adjXpos = - // (TileEntityEtherealWall)tile.getWorldObj().getTileEntity(tile.xCoord+1,tile.yCoord,tile.zCoord); - } - public TileEntityEtherealWall[] sortTilesByDistanceTo(int x, int y, int z) { TileEntityEtherealWall[] result = new TileEntityEtherealWall[tileMap.size()]; int counter = 0; diff --git a/src/main/java/witchinggadgets/common/util/handler/EventHandler.java b/src/main/java/witchinggadgets/common/util/handler/EventHandler.java index 1f47ae114..ba2da930a 100644 --- a/src/main/java/witchinggadgets/common/util/handler/EventHandler.java +++ b/src/main/java/witchinggadgets/common/util/handler/EventHandler.java @@ -81,9 +81,8 @@ public void entityHurt(LivingHurtEvent event) { event.ammount *= 2 + event.entityLiving.getActivePotionEffect(WGContent.pot_cinderCoat).getAmplifier(); } - if (event.source.getSourceOfDamage() instanceof EntityPlayer + if (event.source.getSourceOfDamage() instanceof EntityPlayer player && ((EntityPlayer) event.source.getSourceOfDamage()).getCurrentEquippedItem() != null) { - EntityPlayer player = (EntityPlayer) event.source.getSourceOfDamage(); if (WGContent.ItemPrimordialHammer.equals(player.getCurrentEquippedItem().getItem()) && (event.entityLiving instanceof EntitySlime || event.entityLiving.getClass().getName().endsWith("BlueSlime") @@ -196,8 +195,7 @@ public void onPlayerBreaking(PlayerEvent.BreakSpeed event) { @SubscribeEvent(priority = EventPriority.LOWEST) public void onLivingDrop(LivingDropsEvent event) { - if (event.entityLiving instanceof EntityWolf) { - EntityWolf enemy = (EntityWolf) event.entityLiving; + if (event.entityLiving instanceof EntityWolf enemy) { for (int i = 0; i < 2 + Math.min(4, event.lootingLevel); i++) if (enemy.worldObj.rand.nextInt(Math.max(1, 3 - event.lootingLevel)) == 0) { EntityItem entityitem = new EntityItem( @@ -211,25 +209,8 @@ public void onLivingDrop(LivingDropsEvent event) { } } - // here resides the cancer of crimson titles. begone - /* - * if(event.entityLiving instanceof EntityCultistCleric && - * event.entityLiving.worldObj.rand.nextInt(10)<1+event.lootingLevel) event.drops.add(new - * EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, - * event.entityLiving.posZ, ItemMagicalBaubles.getItemWithTitle(new - * ItemStack(WGContent.ItemMagicalBaubles,1,4),Lib.TITLE+"crimsonCultist"))); if(event.entityLiving instanceof - * EntityCultistKnight && event.entityLiving.worldObj.rand.nextInt(10)<1+event.lootingLevel) event.drops.add(new - * EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, - * event.entityLiving.posZ, ItemMagicalBaubles.getItemWithTitle(new - * ItemStack(WGContent.ItemMagicalBaubles,1,4),Lib.TITLE+"crimsonKnight"))); if(event.entityLiving instanceof - * EntityCultistLeader && event.entityLiving.worldObj.rand.nextInt(2)==0) event.drops.add(new - * EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, - * event.entityLiving.posZ, ItemMagicalBaubles.getItemWithTitle(new - * ItemStack(WGContent.ItemMagicalBaubles,1,4),Lib.TITLE+"crimsonPraetor"))); - */ - - if (event.recentlyHit && event.source != null && event.source.getSourceOfDamage() instanceof EntityPlayer) { - EntityPlayer player = (EntityPlayer) event.source.getSourceOfDamage(); + if (event.recentlyHit && event.source != null + && event.source.getSourceOfDamage() instanceof EntityPlayer player) { if (player.getCurrentEquippedItem() != null && WGContent.ItemPrimordialSword.equals(player.getCurrentEquippedItem().getItem()) && player.getRNG().nextInt(6) < EnchantmentHelper.getLootingModifier(player)) { @@ -275,11 +256,10 @@ else if (EntityList.getEntityString(event.entityLiving).equals("Blizz")) @SubscribeEvent public void onLivingDies(LivingDeathEvent event) { - if (event.source != null && event.source.getSourceOfDamage() instanceof EntityPlayer + if (event.source != null && event.source.getSourceOfDamage() instanceof EntityPlayer player && event.entityLiving instanceof EntityLiving && !event.entityLiving.worldObj.isRemote && event.entityLiving.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) { - EntityPlayer player = (EntityPlayer) event.source.getSourceOfDamage(); if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof IPrimordialGear @@ -312,7 +292,7 @@ public void onItemPickup(EntityItemPickupEvent event) { for (ItemStack f : filter) if (OreDictionary.itemMatches(f, event.item.getEntityItem(), true)) { AspectList al = ThaumcraftCraftingManager.getObjectTags(event.item.getEntityItem()); al = ThaumcraftCraftingManager.getBonusTags(event.item.getEntityItem(), al); - if (al != null && al.size() >= 0) { + if (al.size() >= 0) { AspectList primals = ResearchManager.reduceToPrimals(al); Aspect a = primals.getAspects()[event.entityPlayer.getRNG() .nextInt(primals.getAspects().length)]; @@ -424,7 +404,6 @@ public void onCrafted(ItemCraftedEvent event) { @SubscribeEvent public void playerLogin(PlayerLoggedInEvent event) { WitchingGadgets.packetHandler.sendTo(new MessageClientNotifier(0), (EntityPlayerMP) event.player); - // WGPacketPipeline.INSTANCE.sendTo(new PacketClientNotifier(0), (EntityPlayerMP) event.player); } // TODO SOULBOUND diff --git a/src/main/java/witchinggadgets/common/util/handler/WGMultiPartHandler.java b/src/main/java/witchinggadgets/common/util/handler/WGMultiPartHandler.java index 77c0f8f9f..1a777c46e 100644 --- a/src/main/java/witchinggadgets/common/util/handler/WGMultiPartHandler.java +++ b/src/main/java/witchinggadgets/common/util/handler/WGMultiPartHandler.java @@ -70,8 +70,6 @@ else if (world.getTileEntity(coord.x, coord.y, coord.z) instanceof TileTubeBuffe @Override public TMultiPart createPart(String name, boolean client) { - // if (name.equals("witchingGadgets:vis_relay")) - // return new MultipartVisRelay(0); if (name.equals("witchingGadgets:essentia_tube")) return new MultipartEssentiaTube(0); if (name.equals("witchingGadgets:essentia_tube_valve")) return new MultipartEssentiaTube_Valve(0); if (name.equals("witchingGadgets:essentia_tube_filtered")) return new MultipartEssentiaTube_Filtered(0); @@ -93,8 +91,7 @@ public static void handleWorldInteraction(PlayerInteractEvent event) { && event.entityPlayer.getCurrentEquippedItem().getItemDamage() != 7 && event.entityPlayer.getCurrentEquippedItem().getItemDamage() != 2) if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK - && event.world.getTileEntity(event.x, event.y, event.z) instanceof TileMultipart) { - TileMultipart mp = (TileMultipart) event.world.getTileEntity(event.x, event.y, event.z); + && event.world.getTileEntity(event.x, event.y, event.z) instanceof TileMultipart mp) { int meta = event.entityPlayer.getCurrentEquippedItem().getItemDamage(); TMultiPart part = meta == 1 ? new MultipartEssentiaTube_Valve(meta) : meta == 3 ? new MultipartEssentiaTube_Filtered(meta) diff --git a/src/main/java/witchinggadgets/common/util/network/message/MessagePrimordialGlove.java b/src/main/java/witchinggadgets/common/util/network/message/MessagePrimordialGlove.java index 3d50899e1..fef67e8d9 100644 --- a/src/main/java/witchinggadgets/common/util/network/message/MessagePrimordialGlove.java +++ b/src/main/java/witchinggadgets/common/util/network/message/MessagePrimordialGlove.java @@ -51,8 +51,7 @@ public IMessage onMessage(MessagePrimordialGlove message, MessageContext ctx) { World world = DimensionManager.getWorld(message.dim); if (world != null) { Entity ent = world.getEntityByID(message.playerid); - if (ent instanceof EntityPlayer) { - EntityPlayer player = (EntityPlayer) ent; + if (ent instanceof EntityPlayer player) { if (message.type == (byte) 0 && player.getCurrentEquippedItem() != null) { if (!player.getCurrentEquippedItem().hasTagCompound()) player.getCurrentEquippedItem().setTagCompound(new NBTTagCompound()); diff --git a/src/main/java/witchinggadgets/common/util/network/message/MessageTileUpdate.java b/src/main/java/witchinggadgets/common/util/network/message/MessageTileUpdate.java index a9ddc2643..77a603a4d 100644 --- a/src/main/java/witchinggadgets/common/util/network/message/MessageTileUpdate.java +++ b/src/main/java/witchinggadgets/common/util/network/message/MessageTileUpdate.java @@ -54,8 +54,9 @@ public static class HandlerClient implements IMessageHandler arraylist = new ArrayList(); + ArrayList arraylist = new ArrayList<>(); for (int i = 0; i < par1InventoryCrafting.getSizeInventory(); i++) { ItemStack itemstack1 = par1InventoryCrafting.getStackInSlot(i); diff --git a/src/main/java/witchinggadgets/common/util/recipe/CloakColourizationRecipe.java b/src/main/java/witchinggadgets/common/util/recipe/CloakColourizationRecipe.java index e644e31ba..9d5821770 100644 --- a/src/main/java/witchinggadgets/common/util/recipe/CloakColourizationRecipe.java +++ b/src/main/java/witchinggadgets/common/util/recipe/CloakColourizationRecipe.java @@ -22,10 +22,7 @@ public boolean matches(InventoryCrafting par1InventoryCrafting, World par2World) if (itemstack1 != null) { if ((itemstack1.getItem() instanceof ItemCloak)) { - boolean flag_wonttakecolour = itemstack1.getItemDamage() != 0; // ItemCloak.getCloakFromStack(itemstack1)!=null - // && - // ItemCloak.getCloakFromStack(itemstack1).getUnlocalizedName() != - // Cloak.standard.getUnlocalizedName(); + boolean flag_wonttakecolour = itemstack1.getItemDamage() != 0; if (itemstack != null || flag_wonttakecolour) return false; itemstack = itemstack1; } else { @@ -53,10 +50,7 @@ public ItemStack getCraftingResult(InventoryCrafting par1InventoryCrafting) { if ((itemstack1.getItem() instanceof ItemCloak)) { itemcloak = (ItemCloak) itemstack1.getItem(); - boolean flag_wonttakecolour = itemstack1.getItemDamage() != 0; // ItemCloak.getCloakFromStack(itemstack1)!=null - // && - // ItemCloak.getCloakFromStack(itemstack1).getUnlocalizedName() != - // Cloak.standard.getUnlocalizedName(); + boolean flag_wonttakecolour = itemstack1.getItemDamage() != 0; if (itemstack != null || flag_wonttakecolour) return null; diff --git a/src/main/java/witchinggadgets/common/util/recipe/InfernalBlastfurnaceRecipe.java b/src/main/java/witchinggadgets/common/util/recipe/InfernalBlastfurnaceRecipe.java index eb00a7077..d7c8b6220 100644 --- a/src/main/java/witchinggadgets/common/util/recipe/InfernalBlastfurnaceRecipe.java +++ b/src/main/java/witchinggadgets/common/util/recipe/InfernalBlastfurnaceRecipe.java @@ -18,11 +18,11 @@ public class InfernalBlastfurnaceRecipe { private final boolean isSpecial; private ItemStack bonus; - public static List recipes = new ArrayList(); + public static List recipes = new ArrayList<>(); public InfernalBlastfurnaceRecipe(ItemStack output, Object input, int time, boolean isSpecial) { - if (input instanceof ItemStack) this.input = (ItemStack) input; - else if (input instanceof OreDictStack) this.input = (OreDictStack) input; + if (input instanceof ItemStack) this.input = input; + else if (input instanceof OreDictStack) this.input = input; else if (input instanceof String) this.input = new OreDictStack((String) input, 1); else throw new RuntimeException( "Infernal Blast Furance Recipes MUST be initialized with ItemStack, OreDictStack or String"); @@ -145,8 +145,7 @@ public static void tryAddIngotImprovement(String base, String result, boolean is @Override public boolean equals(Object o) { - if (!(o instanceof InfernalBlastfurnaceRecipe)) return false; - InfernalBlastfurnaceRecipe r = (InfernalBlastfurnaceRecipe) o; + if (!(o instanceof InfernalBlastfurnaceRecipe r)) return false; boolean b_out = ItemStack.areItemStacksEqual(r.output, this.output); boolean b_in_IS = (this.input instanceof ItemStack && r.input instanceof ItemStack) diff --git a/src/main/java/witchinggadgets/common/util/recipe/PhotoDevelopingRecipe.java b/src/main/java/witchinggadgets/common/util/recipe/PhotoDevelopingRecipe.java index 93192d151..52eada48c 100644 --- a/src/main/java/witchinggadgets/common/util/recipe/PhotoDevelopingRecipe.java +++ b/src/main/java/witchinggadgets/common/util/recipe/PhotoDevelopingRecipe.java @@ -21,12 +21,14 @@ public PhotoDevelopingRecipe() { "SCANCAMERA", new ItemStack(WGContent.ItemMaterial, 1, 10), new AspectList().add(Aspect.AIR, 5).add(Aspect.WATER, 5).add(Aspect.ORDER, 5), - new Object[] { new ItemStack(WGContent.ItemMaterial, 1, 9), "dyeBlack", Items.paper }); + new ItemStack(WGContent.ItemMaterial, 1, 9), + "dyeBlack", + Items.paper); } @Override public AspectList getAspects(IInventory iinventoryCrafting) { - ArrayList paper = new ArrayList(); + ArrayList paper = new ArrayList<>(); for (int i = 0; i < iinventoryCrafting.getSizeInventory(); i++) { ItemStack stackInSlot = iinventoryCrafting.getStackInSlot(i); diff --git a/src/main/java/witchinggadgets/common/util/recipe/RobeColourizationRecipe.java b/src/main/java/witchinggadgets/common/util/recipe/RobeColourizationRecipe.java index 037dc3190..71f17d55e 100644 --- a/src/main/java/witchinggadgets/common/util/recipe/RobeColourizationRecipe.java +++ b/src/main/java/witchinggadgets/common/util/recipe/RobeColourizationRecipe.java @@ -2,6 +2,8 @@ import java.util.ArrayList; +import net.minecraft.block.BlockColored; +import net.minecraft.entity.passive.EntitySheep; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; @@ -22,8 +24,7 @@ public boolean matches(InventoryCrafting par1InventoryCrafting, World par2World) ItemStack itemstack1 = par1InventoryCrafting.getStackInSlot(i); if (itemstack1 != null) { - if ((itemstack1.getItem() instanceof ItemArmor)) { - ItemArmor itemarmor = (ItemArmor) itemstack1.getItem(); + if ((itemstack1.getItem() instanceof ItemArmor itemarmor)) { if ((!(itemarmor instanceof ItemAdvancedRobes)) || (itemstack != null)) { return false; @@ -77,7 +78,7 @@ public ItemStack getCraftingResult(InventoryCrafting par1InventoryCrafting) { } else { if (!Utilities.isDye(itemstack1)) return null; - float[] afloat = net.minecraft.entity.passive.EntitySheep.fleeceColorTable[net.minecraft.block.BlockColored + float[] afloat = EntitySheep.fleeceColorTable[BlockColored .func_150032_b(Utilities.getDamageForDye(itemstack1))]; int j1 = (int) (afloat[0] * 255.0F); int k1 = (int) (afloat[1] * 255.0F); diff --git a/src/main/java/witchinggadgets/common/util/registry/MetalFluidData.java b/src/main/java/witchinggadgets/common/util/registry/MetalFluidData.java index 7d665f605..9b9dff4f0 100644 --- a/src/main/java/witchinggadgets/common/util/registry/MetalFluidData.java +++ b/src/main/java/witchinggadgets/common/util/registry/MetalFluidData.java @@ -6,29 +6,10 @@ public class MetalFluidData { - static HashMap oreFluidName = new HashMap(); - static HashMap oreFluidTemp = new HashMap(); + static HashMap oreFluidName = new HashMap<>(); + static HashMap oreFluidTemp = new HashMap<>(); static { - // TODO: TCON Fluids - /* - * addOreFluid("Aluminum", "aluminum.molten", 350); addOreFluid("Cobalt", "cobalt.molten", 650); - * addOreFluid("Ardite", "ardite.molten", 650); addOreFluid("Nickel", "nickel.molten", 400); - * addOreFluid("FzDarkIron", "fzdarkiron.molten", 600); addOreFluid("Manganese", "manganese.molten", 700); - * addOreFluid("Zinc", "zinc.molten", 550); addOreFluid("Platinum", "platinum.molten", 550); - * addOreFluid("Ignatius", "ignatius.molten", 550); addOreFluid("ShadowIron", "shadow.iron.molten", 550); - * addOreFluid("Lemurite", "lemurite.molten", 550); addOreFluid("Midasium", "midasium.molten", 550); - * addOreFluid("Vyroxeres", "vyroxeres.molten", 550); addOreFluid("Ceruclase", "ceruclase.molten", 550); - * addOreFluid("Alduorite", "alduorite.molten", 550); addOreFluid("Kalendrite", "kalendrite.molten", 550); - * addOreFluid("Vulcanite", "vulcanite.molten", 550); addOreFluid("Sanguinite", "sanguinite.molten", 550); - * addOreFluid("Prometheum", "prometheum.molten", 550); addOreFluid("DeepIron", "deep.iron.molten", 550); - * addOreFluid("Infuscolium", "infuscolium.molten", 550); addOreFluid("Oureclase", "oureclase.molten", 550); - * addOreFluid("AstralSilver", "astral.silver.molten", 550); addOreFluid("Carmot", "carmot.molten", 550); - * addOreFluid("Mithril", "mithril.molten", 550); addOreFluid("Rubracium", "rubracium.molten", 550); - * addOreFluid("Orichalcum", "orichalcum.molten", 550); addOreFluid("Adamantine", "adamantine.molten", 550); - * addOreFluid("Atlarus", "atlarus.molten", 550); addOreFluid("Eximite", "eximite.molten", 600); - * addOreFluid("Meutoite", "meutoite.molten", 600); - */ for (String s : WGContent.ClusterSmeltable.keySet()) addOreFluid( s, WGContent.ClusterSmeltable.get(s).getUnlocalizedName(), diff --git a/src/main/java/witchinggadgets/common/util/research/WGFakeResearchItem.java b/src/main/java/witchinggadgets/common/util/research/WGFakeResearchItem.java deleted file mode 100644 index f84040c9b..000000000 --- a/src/main/java/witchinggadgets/common/util/research/WGFakeResearchItem.java +++ /dev/null @@ -1,73 +0,0 @@ -package witchinggadgets.common.util.research; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; - -import thaumcraft.api.aspects.AspectList; -import thaumcraft.api.research.ResearchCategories; -import thaumcraft.api.research.ResearchCategoryList; -import thaumcraft.api.research.ResearchItem; -import thaumcraft.api.research.ResearchPage; - -public class WGFakeResearchItem extends ResearchItem { - - public ResearchItem original; - - public WGFakeResearchItem(String key, String category, String original, String originalCategory, int displayX, - int displayY, ResourceLocation icon) { - super(key, category, new AspectList(), displayX, displayY, 1, icon); - this.original = ((ResearchCategoryList) ResearchCategories.researchCategories.get(originalCategory)).research - .get(original); - this.setupOriginal(); - } - - public WGFakeResearchItem(String key, String category, String original, String originalCategory, int displayX, - int displayY, ItemStack icon) { - super(key, category, new AspectList(), displayX, displayY, 1, icon); - this.original = ((ResearchCategoryList) ResearchCategories.researchCategories.get(originalCategory)).research - .get(original); - this.setupOriginal(); - } - - private void setupOriginal() { - if (this.original.siblings == null) this.original.setSiblings(new String[] { this.key }); - else { - String[] newSiblings = new String[this.original.siblings.length + 1]; - System.arraycopy(this.original.siblings, 0, newSiblings, 0, this.original.siblings.length); - newSiblings[this.original.siblings.length] = this.key; - this.original.setSiblings(newSiblings); - } - // if(this.original.isSecondary()) - // setSecondary(); - } - - @Override - public String getName() { - return this.original.getName(); - } - - @Override - public String getText() { - return this.original.getText(); - } - - @Override - public boolean isStub() { - return true; - } - - @Override - public boolean isHidden() { - return true; - } - - @Override - public int getComplexity() { - return 1; - } - - @Override - public ResearchPage[] getPages() { - return this.original.getPages(); - } -} diff --git a/src/main/java/witchinggadgets/common/world/WorldProviderMirror.java b/src/main/java/witchinggadgets/common/world/WorldProviderMirror.java deleted file mode 100644 index 4229dbdcd..000000000 --- a/src/main/java/witchinggadgets/common/world/WorldProviderMirror.java +++ /dev/null @@ -1,208 +0,0 @@ -// package witchinggadgets.common.world; -// -// import net.minecraft.entity.Entity; -// import net.minecraft.util.MathHelper; -// import net.minecraft.util.Vec3; -// import net.minecraft.world.WorldProvider; -// import net.minecraft.world.biome.WorldChunkManagerHell; -// import net.minecraft.world.chunk.Chunk; -// import net.minecraft.world.chunk.IChunkProvider; -// import net.minecraftforge.client.IRenderHandler; -// import witchinggadgets.WitchingGadgets; -// import witchinggadgets.client.render.NotRenderer; -// import witchinggadgets.common.WGConfig; -// -// public class WorldProviderMirror extends WorldProvider -// { -// @Override -// public String getDimensionName() -// { -// return "Crystal Void"; -// } -// -// @Override -// public void registerWorldChunkManager() -// { -// this.worldChunkMgr = new WorldChunkManagerHell(WitchingGadgets.BiomeMirror, 0.0F); -// this.dimensionId = WGConfig.dimensionMirrorID; -// } -// -// -// -// @Override -// public IChunkProvider createChunkGenerator() -// { -// return new ChunkProviderMirror(worldObj, worldObj.getSeed(), true); -// } -// -// @Override -// public float calculateCelestialAngle(long par1, float par3) -// { -// //this.worldObj.setRainStrength(0); -// //return super.calculateCelestialAngle(par1, par3); -// return -0.28F; -// } -// -// @Override -// public int getMoonPhase(long par1) -// { -// return 4; -// //return (int)(par1 / 24000L) % 8; -// } -// -// @Override -// public Vec3 drawClouds(float partialTicks) -// { -// int x = 0; -// int y = 0; -// return Vec3.createVectorHelper(x, y, y); -// //return worldObj.drawCloudsBody(partialTicks); -// } -// -// @Override -// public long getWorldTime() -// { -// return 18000; -// } -// -// @Override -// public Vec3 getSkyColor(Entity cameraEntity, float partialTicks) -// { -// double r = 176; -// double g = 230; -// double b = 224; -// -// float f3 = (float) (r/255.0); -// float f4 = (float) (g/255.0); -// float f5 = (float) (b/255.0); -// -// //return super.getSkyColor(cameraEntity, partialTicks); -// -// return Vec3.createVectorHelper(f3, f4, f5); -// } -// -// @Override -// public Vec3 getFogColor(float par1, float par2) -// { -// //System.out.println("FogColour: par1="+par1+", par2="+par2); -// float f2 = MathHelper.cos(par1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; -// -// if (f2 < 0.0F) -// { -// f2 = 0.0F; -// } -// -// if (f2 > 1.0F) -// { -// f2 = 1.0F; -// } -// -// float f3 = 0.7529412F; -// float f4 = 0.84705883F; -// float f5 = 1.0F; -// f3 *= f2 * 0.94F + 0.06F; -// f4 *= f2 * 0.94F + 0.06F; -// f5 *= f2 * 0.91F + 0.09F; -// -// double r = 45; -// double g = 119; -// double b = 161; -// -// f3 = (float) (r/255.0); -// f4 = (float) (g/255.0); -// f5 = (float) (b/255.0); -// -// //DimensionManager.getProvider(dim) -// -// //this.worldObj.provider.getFogColor(par1, par2) -// -// return Vec3.createVectorHelper(f3, f4, f5); -// } -// -// @Override -// public float[] calcSunriseSunsetColors(float par1, float par2) -// { -// //return super.calcSunriseSunsetColors(par1, par2); -// return null; -// } -// -// @Override -// public boolean isSkyColored() -// { -// //return super.isSkyColored(); -// return false; -// } -// -// @Override -// public boolean canRespawnHere() -// { -// return false; -// } -// -// @Override -// public boolean isSurfaceWorld() -// { -// return super.isSurfaceWorld(); -// //return false; -// } -// -// @Override -// public float getCloudHeight() -// { -// //return super.getCloudHeight(); -// return -200.0F; -// } -// -// @Override -// public IRenderHandler getSkyRenderer() -// { -// return null;//new BetweenSkyRenderer(this); -// } -// -// @Override -// public IRenderHandler getCloudRenderer() -// { -// return new NotRenderer(); -// } -// -// @Override -// public double getHorizon() -// { -// return -256.0; -// //return worldObj.worldInfo.getTerrainType().getHorizon(worldObj); -// } -// -// @Override -// public boolean doesXZShowFog(int par1, int par2) -// { -// //return true; -// //return super.doesXZShowFog(par1, par2); -// return false; -// } -// -// @Override -// public boolean getWorldHasVoidParticles() -// { -// return false; -// } -// -// @Override -// public double getVoidFogYFactor() -// { -// return 1f; -// } -// -// -// @Override -// public boolean canDoRainSnowIce(Chunk chunk) -// { -// return false; -// } -// -// @Override -// public boolean canSnowAt(int x, int y, int z, boolean checkLight) -// { -// return false; -// } -// -// }