From 27d922d4708f5033ecf18a8ab62e9dc166a5ce9e Mon Sep 17 00:00:00 2001 From: richardg867 Date: Sun, 21 Apr 2013 21:32:23 -0300 Subject: [PATCH 001/146] Techne model loader (incomplete for debugging) --- .../client/model/AdvancedModelLoader.java | 4 +- .../client/model/techne/TechneModel.java | 308 ++++++++++++++++++ .../model/techne/TechneModelLoader.java | 34 ++ 3 files changed, 345 insertions(+), 1 deletion(-) create mode 100644 client/net/minecraftforge/client/model/techne/TechneModel.java create mode 100644 client/net/minecraftforge/client/model/techne/TechneModelLoader.java diff --git a/client/net/minecraftforge/client/model/AdvancedModelLoader.java b/client/net/minecraftforge/client/model/AdvancedModelLoader.java index d2e888237..b29ca1cdc 100644 --- a/client/net/minecraftforge/client/model/AdvancedModelLoader.java +++ b/client/net/minecraftforge/client/model/AdvancedModelLoader.java @@ -6,6 +6,7 @@ import java.util.Collection; import java.util.Map; import net.minecraftforge.client.model.obj.ObjModelLoader; +import net.minecraftforge.client.model.techne.TechneModelLoader; import com.google.common.collect.Maps; @@ -52,7 +53,7 @@ public class AdvancedModelLoader { FMLLog.severe("The resource name %s is not valid", resourceName); throw new IllegalArgumentException("The resource name is not valid"); } - String suffix = resourceName.substring(i); + String suffix = resourceName.substring(i + 1); IModelCustomLoader loader = instances.get(suffix); if (loader == null) { @@ -78,5 +79,6 @@ public class AdvancedModelLoader { static { registerModelHandler(new ObjModelLoader()); + registerModelHandler(new TechneModelLoader()); } } diff --git a/client/net/minecraftforge/client/model/techne/TechneModel.java b/client/net/minecraftforge/client/model/techne/TechneModel.java new file mode 100644 index 000000000..4e5565080 --- /dev/null +++ b/client/net/minecraftforge/client/model/techne/TechneModel.java @@ -0,0 +1,308 @@ +package net.minecraftforge.client.model.techne; + +import java.awt.image.BufferedImage; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.URL; +import java.util.Arrays; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.zip.ZipEntry; +import java.util.zip.ZipException; +import java.util.zip.ZipFile; +import java.util.zip.ZipInputStream; + +import javax.imageio.ImageIO; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.lwjgl.opengl.GL11; +import org.w3c.dom.Document; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +import cpw.mods.fml.common.FMLLog; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.RenderEngine; +import net.minecraftforge.client.model.IModelCustom; +import net.minecraftforge.client.model.ModelFormatException; + +@SideOnly(Side.CLIENT) +public class TechneModel extends ModelBase implements IModelCustom { + public static final List cubeTypes = Arrays.asList( + "d9e621f7-957f-4b77-b1ae-20dcd0da7751", + "de81aa14-bd60-4228-8d8d-5238bcd3caaa" + ); + + private String fileName; + private Map zipFile = new HashMap(); + + private Map parts = new LinkedHashMap(); + private String texture = null; + private int textureName; + private boolean textureNameSet = false; + + public TechneModel(String fileName, URL resource) throws ModelFormatException + { + this.fileName = fileName; + loadTechneModel(resource); + } + + private void loadTechneModel(URL fileURL) throws ModelFormatException + { + try + { + ZipInputStream zipInput = new ZipInputStream(fileURL.openStream()); + + ZipEntry entry; + while ((entry = zipInput.getNextEntry()) != null) + { + byte[] data = new byte[(int) entry.getSize()]; + zipInput.read(data); + zipFile.put(entry.getName(), data); + } + + byte[] modelXml = zipFile.get("model.xml"); + if (modelXml == null) + { + throw new ModelFormatException("Model " + fileName + " contains no model.xml file"); + } + + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); + Document document = documentBuilder.parse(new ByteArrayInputStream(modelXml)); + + NodeList nodeListTechne = document.getElementsByTagName("Techne"); + if (nodeListTechne.getLength() < 1) + { + throw new ModelFormatException("Model " + fileName + " contains no Techne tag"); + } + + NodeList nodeListModel = document.getElementsByTagName("Model"); + if (nodeListModel.getLength() < 1) + { + throw new ModelFormatException("Model " + fileName + " contains no Model tag"); + } + + NamedNodeMap modelAttributes = nodeListModel.item(0).getAttributes(); + if (modelAttributes == null) + { + throw new ModelFormatException("Model " + fileName + " contains a Model tag with no attributes"); + } + + Node modelTexture = modelAttributes.getNamedItem("texture"); + if (modelTexture != null) + { + texture = modelTexture.getTextContent(); + } + + NodeList shapes = document.getElementsByTagName("Shape"); + for (int i = 0; i < shapes.getLength(); i++) + { + Node shape = shapes.item(i); + NamedNodeMap shapeAttributes = shape.getAttributes(); + if (shapeAttributes == null) + { + throw new ModelFormatException("Shape #" + (i + 1) + " in " + fileName + " has no attributes"); + } + + Node name = shapeAttributes.getNamedItem("name"); + String shapeName = null; + if (name != null) + { + shapeName = name.getNodeValue(); + } + if (shapeName == null) + { + shapeName = "Shape #" + (i + 1); + } + + Node type = shapeAttributes.getNamedItem("type"); + if (type == null) + { + throw new ModelFormatException("Shape [" + shapeName + "] in " + fileName + " has no type"); + } + String shapeType = type.getNodeValue(); + if (shapeType == null) + { + throw new ModelFormatException("Shape [" + shapeName + "] in " + fileName + " has an invalid type"); + } + if (!cubeTypes.contains(shapeType)) + { + FMLLog.warning("Model shape [" + shapeName + "] in " + fileName + " is not a cube, ignoring"); + continue; + } + + try + { + boolean mirrored = false; + String[] offset = new String[3]; + String[] position = new String[3]; + String[] rotation = new String[3]; + String[] size = new String[3]; + String[] textureOffset = new String[2]; + + NodeList shapeChildren = shape.getChildNodes(); + for (int j = 0; j < shapeChildren.getLength(); j++) + { + Node shapeChild = shapeChildren.item(j); + + String shapeChildName = shapeChild.getNodeName(); + String shapeChildValue = shapeChild.getTextContent(); + if (shapeChildValue != null) + { + shapeChildValue = shapeChildValue.trim(); + + if (shapeChildName.equals("IsMirrored")) + { + mirrored = !shapeChildValue.equals("False"); + } + else if (shapeChildName.equals("Offset")) + { + offset = shapeChildValue.split(","); + } + else if (shapeChildName.equals("Position")) + { + position = shapeChildValue.split(","); + } + else if (shapeChildName.equals("Rotation")) + { + rotation = shapeChildValue.split(","); + } + else if (shapeChildName.equals("Size")) + { + size = shapeChildValue.split(","); + } + else if (shapeChildName.equals("TextureOffset")) + { + textureOffset = shapeChildValue.split(","); + } + } + } + + // That's what the ModelBase subclassing is needed for + ModelRenderer cube = new ModelRenderer(this, Integer.parseInt(textureOffset[0]), Integer.parseInt(textureOffset[1])); + cube.mirror = mirrored; + cube.addBox(Float.parseFloat(offset[0]), Float.parseFloat(offset[1]), Float.parseFloat(offset[2]), Integer.parseInt(size[0]), Integer.parseInt(size[1]), Integer.parseInt(size[2])); + cube.setRotationPoint(Float.parseFloat(position[0]), Float.parseFloat(position[1]) - 23.4F, Float.parseFloat(position[2])); + + cube.rotateAngleX = (float)Math.toRadians(Float.parseFloat(rotation[0])); + cube.rotateAngleY = (float)Math.toRadians(Float.parseFloat(rotation[1])); + cube.rotateAngleZ = (float)Math.toRadians(Float.parseFloat(rotation[2])); + + parts.put(shapeName, cube); + } + catch (NumberFormatException e) + { + FMLLog.warning("Model shape [" + shapeName + "] in " + fileName + " contains malformed integers within its data, ignoring"); + e.printStackTrace(); + } + } + } + catch (ZipException e) + { + throw new ModelFormatException("Model " + fileName + " is not a valid zip file"); + } + catch (IOException e) + { + throw new ModelFormatException("Model " + fileName + " could not be read", e); + } + catch (ParserConfigurationException e) + { + // hush + } + catch (SAXException e) + { + throw new ModelFormatException("Model " + fileName + " contains invalid XML", e); + } + } + + private void bindTexture() + { + if (texture != null) + { + if (!textureNameSet) + { + + try + { + byte[] textureEntry = zipFile.get(texture); + if (textureEntry == null) + { + throw new ModelFormatException("Model " + fileName + " has no such texture " + texture); + } + System.out.println(textureEntry.length); + BufferedImage image = ImageIO.read(new ByteArrayInputStream(textureEntry)); + textureName = Minecraft.getMinecraft().renderEngine.allocateAndSetupTexture(image); + textureNameSet = true; + } + catch (ZipException e) + { + throw new ModelFormatException("Model " + fileName + " is not a valid zip file"); + } + catch (IOException e) + { + try + { + FileOutputStream fileOutput = new FileOutputStream("techne_texture_debug.png"); + fileOutput.write(zipFile.get(texture)); + fileOutput.flush(); + fileOutput.close(); + } + catch (Throwable e1) + { + } + + throw new ModelFormatException("Texture for model " + fileName + " could not be read", e); + } + } + + if (textureNameSet) + { + GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureName); + Minecraft.getMinecraft().renderEngine.resetBoundTexture(); + } + } + } + + @Override + public String getType() + { + return "tcn"; + } + + @Override + public void renderAll() + { + bindTexture(); + + for (ModelRenderer part : parts.values()) + { + part.renderWithRotation(1.0F); + } + } + + @Override + public void renderPart(String partName) + { + bindTexture(); + + ModelRenderer part = parts.get(partName); + if (part != null) + { + part.renderWithRotation(1.0F); + } + } +} diff --git a/client/net/minecraftforge/client/model/techne/TechneModelLoader.java b/client/net/minecraftforge/client/model/techne/TechneModelLoader.java new file mode 100644 index 000000000..0c9f182c8 --- /dev/null +++ b/client/net/minecraftforge/client/model/techne/TechneModelLoader.java @@ -0,0 +1,34 @@ +package net.minecraftforge.client.model.techne; + +import java.net.URL; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +import net.minecraftforge.client.model.IModelCustom; +import net.minecraftforge.client.model.IModelCustomLoader; +import net.minecraftforge.client.model.ModelFormatException; + +@SideOnly(Side.CLIENT) +public class TechneModelLoader implements IModelCustomLoader { + + @Override + public String getType() + { + return "Techne model"; + } + + private static final String[] types = { "tcn" }; + @Override + public String[] getSuffixes() + { + return types; + } + + @Override + public IModelCustom loadInstance(String resourceName, URL resource) throws ModelFormatException + { + return new TechneModel(resourceName, resource); + } + +} From f3caada13abdc5ea151ce6c63555350665ab4440 Mon Sep 17 00:00:00 2001 From: richardg867 Date: Mon, 22 Apr 2013 13:08:59 -0300 Subject: [PATCH 002/146] Complete it, got the bug figured out --- .../client/model/AdvancedModelLoader.java | 2 +- .../client/model/techne/TechneModel.java | 50 ++++++++----------- .../model/techne/TechneModelLoader.java | 1 - 3 files changed, 22 insertions(+), 31 deletions(-) diff --git a/client/net/minecraftforge/client/model/AdvancedModelLoader.java b/client/net/minecraftforge/client/model/AdvancedModelLoader.java index b29ca1cdc..4f2b2deb0 100644 --- a/client/net/minecraftforge/client/model/AdvancedModelLoader.java +++ b/client/net/minecraftforge/client/model/AdvancedModelLoader.java @@ -53,7 +53,7 @@ public class AdvancedModelLoader { FMLLog.severe("The resource name %s is not valid", resourceName); throw new IllegalArgumentException("The resource name is not valid"); } - String suffix = resourceName.substring(i + 1); + String suffix = resourceName.substring(i); IModelCustomLoader loader = instances.get(suffix); if (loader == null) { diff --git a/client/net/minecraftforge/client/model/techne/TechneModel.java b/client/net/minecraftforge/client/model/techne/TechneModel.java index 4e5565080..09d48410e 100644 --- a/client/net/minecraftforge/client/model/techne/TechneModel.java +++ b/client/net/minecraftforge/client/model/techne/TechneModel.java @@ -39,6 +39,9 @@ import net.minecraft.client.renderer.RenderEngine; import net.minecraftforge.client.model.IModelCustom; import net.minecraftforge.client.model.ModelFormatException; +/** + * Techne model importer, based on iChun's Hats importer + */ @SideOnly(Side.CLIENT) public class TechneModel extends ModelBase implements IModelCustom { public static final List cubeTypes = Arrays.asList( @@ -47,7 +50,7 @@ public class TechneModel extends ModelBase implements IModelCustom { ); private String fileName; - private Map zipFile = new HashMap(); + private Map zipContents = new HashMap(); private Map parts = new LinkedHashMap(); private String texture = null; @@ -70,11 +73,16 @@ public class TechneModel extends ModelBase implements IModelCustom { while ((entry = zipInput.getNextEntry()) != null) { byte[] data = new byte[(int) entry.getSize()]; - zipInput.read(data); - zipFile.put(entry.getName(), data); + // For some reason, using read(byte[]) makes reading stall upon reaching a 0x1E byte + int i = 0; + while (zipInput.available() > 0 && i < data.length) + { + data[i++] = (byte)zipInput.read(); + } + zipContents.put(entry.getName(), data); } - byte[] modelXml = zipFile.get("model.xml"); + byte[] modelXml = zipContents.get("model.xml"); if (modelXml == null) { throw new ModelFormatException("Model " + fileName + " contains no model.xml file"); @@ -129,17 +137,13 @@ public class TechneModel extends ModelBase implements IModelCustom { shapeName = "Shape #" + (i + 1); } + String shapeType = null; Node type = shapeAttributes.getNamedItem("type"); - if (type == null) + if (type != null) { - throw new ModelFormatException("Shape [" + shapeName + "] in " + fileName + " has no type"); + shapeType = type.getNodeValue(); } - String shapeType = type.getNodeValue(); - if (shapeType == null) - { - throw new ModelFormatException("Shape [" + shapeName + "] in " + fileName + " has an invalid type"); - } - if (!cubeTypes.contains(shapeType)) + if (shapeType != null && !cubeTypes.contains(shapeType)) { FMLLog.warning("Model shape [" + shapeName + "] in " + fileName + " is not a cube, ignoring"); continue; @@ -235,15 +239,14 @@ public class TechneModel extends ModelBase implements IModelCustom { { if (!textureNameSet) { - try { - byte[] textureEntry = zipFile.get(texture); + byte[] textureEntry = zipContents.get(texture); if (textureEntry == null) { throw new ModelFormatException("Model " + fileName + " has no such texture " + texture); } - System.out.println(textureEntry.length); + BufferedImage image = ImageIO.read(new ByteArrayInputStream(textureEntry)); textureName = Minecraft.getMinecraft().renderEngine.allocateAndSetupTexture(image); textureNameSet = true; @@ -254,17 +257,6 @@ public class TechneModel extends ModelBase implements IModelCustom { } catch (IOException e) { - try - { - FileOutputStream fileOutput = new FileOutputStream("techne_texture_debug.png"); - fileOutput.write(zipFile.get(texture)); - fileOutput.flush(); - fileOutput.close(); - } - catch (Throwable e1) - { - } - throw new ModelFormatException("Texture for model " + fileName + " could not be read", e); } } @@ -296,12 +288,12 @@ public class TechneModel extends ModelBase implements IModelCustom { @Override public void renderPart(String partName) - { - bindTexture(); - + { ModelRenderer part = parts.get(partName); if (part != null) { + bindTexture(); + part.renderWithRotation(1.0F); } } diff --git a/client/net/minecraftforge/client/model/techne/TechneModelLoader.java b/client/net/minecraftforge/client/model/techne/TechneModelLoader.java index 0c9f182c8..c9dd469b3 100644 --- a/client/net/minecraftforge/client/model/techne/TechneModelLoader.java +++ b/client/net/minecraftforge/client/model/techne/TechneModelLoader.java @@ -9,7 +9,6 @@ import net.minecraftforge.client.model.IModelCustom; import net.minecraftforge.client.model.IModelCustomLoader; import net.minecraftforge.client.model.ModelFormatException; -@SideOnly(Side.CLIENT) public class TechneModelLoader implements IModelCustomLoader { @Override From 6cd56ebed61b9c0683cc0320b05dddb0141d1297 Mon Sep 17 00:00:00 2001 From: King Lemming Date: Thu, 23 May 2013 01:01:19 -0400 Subject: [PATCH 003/146] Forge Fluid System! Signed-off-by: King Lemming --- .../client/ForgeHooksClient.java | 15 + .../common/ForgeDummyContainer.java | 16 +- .../network/ForgeConnectionHandler.java | 8 +- .../common/network/ForgePacket.java | 6 +- .../minecraftforge/fluids/BlockFluidBase.java | 416 ++++++++++++++++++ .../fluids/BlockFluidClassic.java | 309 +++++++++++++ .../fluids/BlockFluidFinite.java | 271 ++++++++++++ common/net/minecraftforge/fluids/Fluid.java | 327 ++++++++++++++ .../fluids/FluidContainerRegistry.java | 260 +++++++++++ .../net/minecraftforge/fluids/FluidEvent.java | 100 +++++ .../fluids/FluidIdMapPacket.java | 52 +++ .../minecraftforge/fluids/FluidRegistry.java | 142 ++++++ .../net/minecraftforge/fluids/FluidStack.java | 177 ++++++++ .../net/minecraftforge/fluids/FluidTank.java | 161 +++++++ .../minecraftforge/fluids/FluidTankInfo.java | 27 ++ .../minecraftforge/fluids/IFluidBlock.java | 41 ++ .../fluids/IFluidContainerItem.java | 61 +++ .../minecraftforge/fluids/IFluidHandler.java | 84 ++++ .../net/minecraftforge/fluids/IFluidTank.java | 59 +++ .../fluids/ItemFluidContainer.java | 132 ++++++ .../fluids/RenderBlockFluid.java | 290 ++++++++++++ .../fluids/TileFluidHandler.java | 72 +++ 22 files changed, 3021 insertions(+), 5 deletions(-) create mode 100644 common/net/minecraftforge/fluids/BlockFluidBase.java create mode 100644 common/net/minecraftforge/fluids/BlockFluidClassic.java create mode 100644 common/net/minecraftforge/fluids/BlockFluidFinite.java create mode 100644 common/net/minecraftforge/fluids/Fluid.java create mode 100644 common/net/minecraftforge/fluids/FluidContainerRegistry.java create mode 100644 common/net/minecraftforge/fluids/FluidEvent.java create mode 100644 common/net/minecraftforge/fluids/FluidIdMapPacket.java create mode 100644 common/net/minecraftforge/fluids/FluidRegistry.java create mode 100644 common/net/minecraftforge/fluids/FluidStack.java create mode 100644 common/net/minecraftforge/fluids/FluidTank.java create mode 100644 common/net/minecraftforge/fluids/FluidTankInfo.java create mode 100644 common/net/minecraftforge/fluids/IFluidBlock.java create mode 100644 common/net/minecraftforge/fluids/IFluidContainerItem.java create mode 100644 common/net/minecraftforge/fluids/IFluidHandler.java create mode 100644 common/net/minecraftforge/fluids/IFluidTank.java create mode 100644 common/net/minecraftforge/fluids/ItemFluidContainer.java create mode 100644 common/net/minecraftforge/fluids/RenderBlockFluid.java create mode 100644 common/net/minecraftforge/fluids/TileFluidHandler.java diff --git a/client/net/minecraftforge/client/ForgeHooksClient.java b/client/net/minecraftforge/client/ForgeHooksClient.java index b47ae3b4f..4efe3792e 100644 --- a/client/net/minecraftforge/client/ForgeHooksClient.java +++ b/client/net/minecraftforge/client/ForgeHooksClient.java @@ -11,9 +11,11 @@ import org.lwjgl.opengl.GL12; import org.lwjgl.opengl.PixelFormat; import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.client.registry.RenderingRegistry; import net.minecraft.client.Minecraft; import net.minecraft.block.Block; +import net.minecraft.block.BlockFluid; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; @@ -38,6 +40,8 @@ import net.minecraftforge.client.event.TextureLoadEvent; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.common.IArmorTextureProvider; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.RenderBlockFluid; import static net.minecraftforge.client.IItemRenderer.ItemRenderType.*; import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.*; @@ -251,6 +255,9 @@ public class ForgeHooksClient public static void onTextureStitchedPost(TextureMap map) { MinecraftForge.EVENT_BUS.post(new TextureStitchEvent.Post(map)); + + FluidRegistry.WATER.setIcons(BlockFluid.func_94424_b("water"), BlockFluid.func_94424_b("water_flow")); + FluidRegistry.LAVA.setIcons(BlockFluid.func_94424_b("lava"), BlockFluid.func_94424_b("lava_flow")); } /** @@ -305,4 +312,12 @@ public class ForgeHooksClient stencilBits = 0; } } + + /** + * Initialization of Forge Renderers. + */ + static { + FluidRegistry.renderIdFluid = RenderingRegistry.getNextAvailableRenderId(); + RenderingRegistry.registerBlockHandler(RenderBlockFluid.instance); + } } diff --git a/common/net/minecraftforge/common/ForgeDummyContainer.java b/common/net/minecraftforge/common/ForgeDummyContainer.java index 140ac978e..2815eeb8b 100644 --- a/common/net/minecraftforge/common/ForgeDummyContainer.java +++ b/common/net/minecraftforge/common/ForgeDummyContainer.java @@ -45,6 +45,7 @@ public class ForgeDummyContainer extends DummyModContainer implements WorldAcces public static boolean removeErroringEntities = false; public static boolean removeErroringTileEntities = false; public static boolean disableStitchedFileSaving = false; + public static boolean forceDuplicateFluidBlockCrash = true; public ForgeDummyContainer() { @@ -99,7 +100,7 @@ public class ForgeDummyContainer extends DummyModContainer implements WorldAcces } prop = config.get(Configuration.CATEGORY_GENERAL, "legacyFurnaceOutput", false); - prop.comment = "Controls the sides of vanilla furnaces for Forge's ISidedInventroy, Vanilla defines the output as the bottom, but mods/Forge define it as the sides. Settings this to true will restore the old side relations."; + prop.comment = "Controls the sides of vanilla furnaces for Forge's ISidedInventory, Vanilla defines the output as the bottom, but mods/Forge define it as the sides. Settings this to true will restore the old side relations."; legacyFurnaceSides = prop.getBoolean(false); prop = config.get(Configuration.CATEGORY_GENERAL, "removeErroringEntities", false); @@ -108,7 +109,7 @@ public class ForgeDummyContainer extends DummyModContainer implements WorldAcces if (removeErroringEntities) { - FMLLog.warning("Enableing removal of erroring Entities USE AT YOUR OWN RISK"); + FMLLog.warning("Enabling removal of erroring Entities - USE AT YOUR OWN RISK"); } prop = config.get(Configuration.CATEGORY_GENERAL, "removeErroringTileEntities", false); @@ -117,13 +118,22 @@ public class ForgeDummyContainer extends DummyModContainer implements WorldAcces if (removeErroringTileEntities) { - FMLLog.warning("Enableing removal of erroring Tile Entities USE AT YOUR OWN RISK"); + FMLLog.warning("Enabling removal of erroring Tile Entities - USE AT YOUR OWN RISK"); } prop = config.get(Configuration.CATEGORY_GENERAL, "disableStitchedFileSaving", true); prop.comment = "Set this to just disable the texture stitcher from writing the 'debug.stitched_{name}.png file to disc. Just a small performance tweak. Default: true"; disableStitchedFileSaving = prop.getBoolean(true); + prop = config.get(Configuration.CATEGORY_GENERAL, "forceDuplicateFluidBlockCrash", true); + prop.comment = "Set this to force a crash if more than one block attempts to link back to the same Fluid. Enabled by default."; + forceDuplicateFluidBlockCrash = prop.getBoolean(true); + + if (!forceDuplicateFluidBlockCrash) + { + FMLLog.warning("Disabling forced crashes on duplicate Fluid Blocks - USE AT YOUR OWN RISK"); + } + if (config.hasChanged()) { config.save(); diff --git a/common/net/minecraftforge/common/network/ForgeConnectionHandler.java b/common/net/minecraftforge/common/network/ForgeConnectionHandler.java index eae6d19f5..42ff849bb 100644 --- a/common/net/minecraftforge/common/network/ForgeConnectionHandler.java +++ b/common/net/minecraftforge/common/network/ForgeConnectionHandler.java @@ -4,8 +4,11 @@ import net.minecraft.network.INetworkManager; import net.minecraft.network.NetLoginHandler; import net.minecraft.network.packet.NetHandler; import net.minecraft.network.packet.Packet1Login; +import net.minecraft.network.packet.Packet250CustomPayload; import net.minecraft.server.MinecraftServer; +import net.minecraftforge.fluids.FluidIdMapPacket; import cpw.mods.fml.common.network.IConnectionHandler; +import cpw.mods.fml.common.network.PacketDispatcher; import cpw.mods.fml.common.network.Player; public class ForgeConnectionHandler implements IConnectionHandler { @@ -13,7 +16,10 @@ public class ForgeConnectionHandler implements IConnectionHandler { @Override public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager) { - + Packet250CustomPayload[] fluidPackets = ForgePacket.makePacketSet(new FluidIdMapPacket()); + for (int i = 0; i < fluidPackets.length; i++) { + PacketDispatcher.sendPacketToPlayer(fluidPackets[i], player); + } } @Override diff --git a/common/net/minecraftforge/common/network/ForgePacket.java b/common/net/minecraftforge/common/network/ForgePacket.java index ee7df1f47..fdda42cf6 100644 --- a/common/net/minecraftforge/common/network/ForgePacket.java +++ b/common/net/minecraftforge/common/network/ForgePacket.java @@ -8,6 +8,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.network.INetworkManager; import net.minecraft.network.packet.NetHandler; import net.minecraft.network.packet.Packet250CustomPayload; +import net.minecraftforge.fluids.FluidIdMapPacket; import com.google.common.base.Throwables; import com.google.common.collect.MapMaker; @@ -25,7 +26,10 @@ public abstract class ForgePacket public static final String CHANNEL_ID = "FORGE"; enum Type { - FAKE_TEMP(ForgePacket.class); + /** + * The Fluid ID map to send to the client + */ + FLUID_IDMAP(FluidIdMapPacket.class); private Class packetType; private ConcurrentMap partTracker; diff --git a/common/net/minecraftforge/fluids/BlockFluidBase.java b/common/net/minecraftforge/fluids/BlockFluidBase.java new file mode 100644 index 000000000..529a6b2c2 --- /dev/null +++ b/common/net/minecraftforge/fluids/BlockFluidBase.java @@ -0,0 +1,416 @@ + +package net.minecraftforge.fluids; + +import java.util.HashMap; +import java.util.Map; +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.Vec3; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +/** + * This is a base implementation for Fluid blocks. + * + * It is highly recommended that you extend this class or one of the Forge-provided child classes. + * + * @author King Lemming, OvermindDL1 + * + */ +public abstract class BlockFluidBase extends Block implements IFluidBlock { + + protected final static Map defaultDisplacementIds = new HashMap(); + + static { + defaultDisplacementIds.put(Block.doorWood.blockID, false); + defaultDisplacementIds.put(Block.doorIron.blockID, false); + defaultDisplacementIds.put(Block.signPost.blockID, false); + defaultDisplacementIds.put(Block.signWall.blockID, false); + defaultDisplacementIds.put(Block.reed.blockID, false); + } + protected Map displacementIds = new HashMap(); + + protected int quantaPerBlock = 8; + protected float quantaPerBlockFloat = 8F; + protected int density = 1; + protected int densityDir = -1; + + protected int tickRate = 20; + protected int renderPass = 1; + protected int maxScaledLight = 0; + + protected final String fluidName; + + public BlockFluidBase(int id, Fluid fluid, Material material) { + + super(id, material); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + this.setTickRandomly(true); + this.disableStats(); + + this.fluidName = fluid.getName(); + this.density = fluid.density; + this.maxScaledLight = fluid.luminosity; + this.tickRate = fluid.viscosity / 200; + fluid.setBlockID(id); + + displacementIds.putAll(defaultDisplacementIds); + } + + public BlockFluidBase setQuantaPerBlock(int quantaPerBlock) { + + if (quantaPerBlock > 16 || quantaPerBlock < 1) { + quantaPerBlock = 8; + } + this.quantaPerBlock = quantaPerBlock; + this.quantaPerBlockFloat = quantaPerBlock; + return this; + } + + public BlockFluidBase setDensity(int density) { + + if (density == 0) { + density = 1; + } + this.density = density; + this.densityDir = density > 0 ? -1 : 1; + return this; + } + + public BlockFluidBase setTickRate(int tickRate) { + + if (tickRate <= 0) { + tickRate = 20; + } + this.tickRate = tickRate; + return this; + } + + public BlockFluidBase setRenderPass(int renderPass) { + + this.renderPass = renderPass; + return this; + } + + public BlockFluidBase setMaxScaledLight(int maxScaledLight) { + + this.maxScaledLight = maxScaledLight; + return this; + } + + /** + * Returns true if the block at (x, y, z) is displaceable. Does not displace the block. + */ + public boolean canDisplace(IBlockAccess world, int x, int y, int z) { + + int bId = world.getBlockId(x, y, z); + + if (bId == 0) { + return true; + } + if (bId == blockID) { + return false; + } + if (displacementIds.containsKey(bId)) { + return displacementIds.get(bId); + } + Material material = Block.blocksList[bId].blockMaterial; + + if (material.blocksMovement() || material == Material.portal) { + return false; + } + return true; + } + + /** + * Attempt to displace the block at (x, y, z), return true if it was displaced. + */ + public boolean displaceIfPossible(World world, int x, int y, int z) { + + int bId = world.getBlockId(x, y, z); + + if (bId == 0) { + return true; + } + if (bId == blockID) { + return false; + } + if (displacementIds.containsKey(bId)) { + if (displacementIds.get(bId)) { + Block.blocksList[bId].dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); + return true; + } + return false; + } + Material material = Block.blocksList[bId].blockMaterial; + + if (material.blocksMovement() || material == Material.portal) { + return false; + } + Block.blocksList[bId].dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); + return true; + } + + public abstract int getQuantaValue(IBlockAccess world, int x, int y, int z); + + @Override + public abstract boolean canCollideCheck(int meta, boolean fullHit); + + public abstract int getMaxRenderHeightMeta(); + + /* BLOCK FUNCTIONS */ + @Override + public void onBlockAdded(World world, int x, int y, int z) { + + world.scheduleBlockUpdate(x, y, z, blockID, tickRate); + } + + @Override + public void onNeighborBlockChange(World world, int x, int y, int z, int blockId) { + + world.scheduleBlockUpdate(x, y, z, blockID, tickRate); + } + + // Used to prevent updates on chunk generation + @Override + public boolean func_82506_l() { + + return false; + } + + @Override + public boolean getBlocksMovement(IBlockAccess world, int x, int y, int z) { + + return true; + } + + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { + + return null; + } + + @Override + public int idDropped(int par1, Random par2Random, int par3) { + + return 0; + } + + @Override + public int quantityDropped(Random par1Random) { + + return 0; + } + + @Override + public int tickRate(World world) { + + return tickRate; + } + + @Override + public void velocityToAddToEntity(World world, int x, int y, int z, Entity entity, Vec3 vec) { + + if (densityDir > 0) { + return; + } + Vec3 vec_flow = this.getFlowVector(world, x, y, z); + vec.xCoord += vec_flow.xCoord * (quantaPerBlock * 4); + vec.yCoord += vec_flow.yCoord * (quantaPerBlock * 4); + vec.zCoord += vec_flow.zCoord * (quantaPerBlock * 4); + } + + @Override + public int getLightValue(IBlockAccess world, int x, int y, int z) { + + if (maxScaledLight == 0) { + return super.getLightValue(world, x, y, z); + } + int data = world.getBlockMetadata(x, y, z); + return (int) (data / quantaPerBlockFloat * maxScaledLight); + } + + @Override + public int getRenderType() { + + return FluidRegistry.renderIdFluid; + } + + @Override + public boolean isOpaqueCube() { + + return false; + } + + @Override + public boolean renderAsNormalBlock() { + + return false; + } + + @Override + public float getBlockBrightness(IBlockAccess world, int x, int y, int z) { + + float lightThis = world.getLightBrightness(x, y, z); + float lightUp = world.getLightBrightness(x, y + 1, z); + + return lightThis > lightUp ? lightThis : lightUp; + } + + @Override + public int getMixedBrightnessForBlock(IBlockAccess world, int x, int y, int z) { + + int lightThis = world.getLightBrightnessForSkyBlocks(x, y, z, 0); + int lightUp = world.getLightBrightnessForSkyBlocks(x, y + 1, z, 0); + int lightThisBase = lightThis & 255; + int lightUpBase = lightUp & 255; + int lightThisExt = lightThis >> 16 & 255; + int lightUpExt = lightUp >> 16 & 255; + + return (lightThisBase > lightUpBase ? lightThisBase : lightUpBase) | (lightThisExt > lightUpExt ? lightThisExt : lightUpExt) << 16; + } + + @Override + public int getRenderBlockPass() { + + return renderPass; + } + + @Override + public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) { + + if (world.getBlockId(x, y, z) != blockID) { + return !world.isBlockOpaqueCube(x, y, z); + } + Material mat = world.getBlockMaterial(x, y, z); + return mat == this.blockMaterial ? false : super.shouldSideBeRendered(world, x, y, z, side); + } + + /* FLUID FUNCTIONS */ + public static final int getDensity(IBlockAccess world, int x, int y, int z) { + + Block block = Block.blocksList[world.getBlockId(x, y, z)]; + + if (!(block instanceof BlockFluidBase)) { + return Integer.MAX_VALUE; + } + return ((BlockFluidBase) block).density; + } + + public static double getFlowDirection(IBlockAccess world, int x, int y, int z) { + + Block block = Block.blocksList[world.getBlockId(x, y, z)]; + + if (!(Block.blocksList[world.getBlockId(x, y, z)] instanceof BlockFluidBase)) { + return -1000.0; + } + Vec3 vec = ((BlockFluidBase) block).getFlowVector(world, x, y, z); + return vec.xCoord == 0.0D && vec.zCoord == 0.0D ? -1000.0D : Math.atan2(vec.zCoord, vec.xCoord) - Math.PI / 2D; + } + + public final int getQuantaValueBelow(IBlockAccess world, int x, int y, int z, int belowThis) { + + int quantaRemaining = getQuantaValue(world, x, y, z); + + if (quantaRemaining >= belowThis) { + return -1; + } + return quantaRemaining; + } + + public final int getQuantaValueAbove(IBlockAccess world, int x, int y, int z, int aboveThis) { + + int quantaRemaining = getQuantaValue(world, x, y, z); + + if (quantaRemaining <= aboveThis) { + return -1; + } + return quantaRemaining; + } + + public final float getQuantaPercentage(IBlockAccess world, int x, int y, int z) { + + int quantaRemaining = getQuantaValue(world, x, y, z); + return quantaRemaining / quantaPerBlockFloat; + } + + public Vec3 getFlowVector(IBlockAccess world, int x, int y, int z) { + + Vec3 vec = world.getWorldVec3Pool().getVecFromPool(0.0D, 0.0D, 0.0D); + int decay = quantaPerBlock - getQuantaValue(world, x, y, z); + + for (int side = 0; side < 4; ++side) { + int x2 = x; + int z2 = z; + + switch (side) { + case 0: + --x2; + break; + case 1: + --z2; + break; + case 2: + ++x2; + break; + case 3: + ++z2; + break; + } + + int otherDecay = quantaPerBlock - getQuantaValue(world, x2, y, z2); + + if (otherDecay >= quantaPerBlock) { + if (!world.getBlockMaterial(x2, y, z2).blocksMovement()) { + otherDecay = quantaPerBlock - getQuantaValue(world, x2, y - 1, z2); + + if (otherDecay >= 0) { + int power = otherDecay - (decay - quantaPerBlock); + vec = vec.addVector((x2 - x) * power, (y - y) * power, (z2 - z) * power); + } + } + } else if (otherDecay >= 0) { + int power = otherDecay - decay; + vec = vec.addVector((x2 - x) * power, (y - y) * power, (z2 - z) * power); + } + } + if (world.getBlockId(x, y + 1, z) == blockID) { + boolean flag = false; + + if (this.isBlockSolid(world, x, y, z - 1, 2)) { + flag = true; + } else if (this.isBlockSolid(world, x, y, z + 1, 3)) { + flag = true; + } else if (this.isBlockSolid(world, x - 1, y, z, 4)) { + flag = true; + } else if (this.isBlockSolid(world, x + 1, y, z, 5)) { + flag = true; + } else if (this.isBlockSolid(world, x, y + 1, z - 1, 2)) { + flag = true; + } else if (this.isBlockSolid(world, x, y + 1, z + 1, 3)) { + flag = true; + } else if (this.isBlockSolid(world, x - 1, y + 1, z, 4)) { + flag = true; + } else if (this.isBlockSolid(world, x + 1, y + 1, z, 5)) { + flag = true; + } + if (flag) { + vec = vec.normalize().addVector(0.0D, -6.0D, 0.0D); + } + } + vec = vec.normalize(); + return vec; + } + + /* IFluidBlock */ + @Override + public Fluid getFluid() { + + return FluidRegistry.getFluid(fluidName); + } + +} diff --git a/common/net/minecraftforge/fluids/BlockFluidClassic.java b/common/net/minecraftforge/fluids/BlockFluidClassic.java new file mode 100644 index 000000000..60a1958f7 --- /dev/null +++ b/common/net/minecraftforge/fluids/BlockFluidClassic.java @@ -0,0 +1,309 @@ + +package net.minecraftforge.fluids; + +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +/** + * This is a fluid block implementation which emulates vanilla Minecraft fluid behavior. + * + * It is highly recommended that you use/extend this class for "classic" fluid blocks. + * + * @author King Lemming + * + */ +public class BlockFluidClassic extends BlockFluidBase { + + protected boolean[] isOptimalFlowDirection = new boolean[4]; + protected int[] flowCost = new int[4]; + + protected FluidStack stack; + + public BlockFluidClassic(int id, Fluid fluid, Material material) { + + super(id, fluid, material); + stack = new FluidStack(fluid, FluidContainerRegistry.BUCKET_VOLUME); + } + + public BlockFluidClassic setFluidStack(FluidStack stack) { + + this.stack = stack; + return this; + } + + public BlockFluidClassic setFluidStackAmount(int amount) { + + this.stack.amount = amount; + return this; + } + + @Override + public int getQuantaValue(IBlockAccess world, int x, int y, int z) { + + if (world.getBlockId(x, y, z) == 0) { + return 0; + } + if (world.getBlockId(x, y, z) != blockID) { + return -1; + } + int quantaRemaining = quantaPerBlock - world.getBlockMetadata(x, y, z); + return quantaRemaining; + } + + @Override + public boolean canCollideCheck(int meta, boolean fullHit) { + + return fullHit && meta == 0; + } + + @Override + public int getMaxRenderHeightMeta() { + + return 0; + } + + @Override + public int getLightValue(IBlockAccess world, int x, int y, int z) { + + if (maxScaledLight == 0) { + return super.getLightValue(world, x, y, z); + } + int data = quantaPerBlock - world.getBlockMetadata(x, y, z) - 1; + return (int) (data / quantaPerBlockFloat * maxScaledLight); + } + + @Override + public void updateTick(World world, int x, int y, int z, Random rand) { + + int quantaRemaining = quantaPerBlock - world.getBlockMetadata(x, y, z); + int expQuanta = -101; + + // check adjacent block levels if non-source + if (quantaRemaining < quantaPerBlock) { + int y2 = y - densityDir; + + if (world.getBlockId(x, y2, z) == blockID || world.getBlockId(x - 1, y2, z) == blockID || world.getBlockId(x + 1, y2, z) == blockID + || world.getBlockId(x, y2, z - 1) == blockID || world.getBlockId(x, y2, z + 1) == blockID) { + expQuanta = quantaPerBlock - 1; + + } else { + int maxQuanta = -100; + maxQuanta = getLargerQuanta(world, x - 1, y, z, maxQuanta); + maxQuanta = getLargerQuanta(world, x + 1, y, z, maxQuanta); + maxQuanta = getLargerQuanta(world, x, y, z - 1, maxQuanta); + maxQuanta = getLargerQuanta(world, x, y, z + 1, maxQuanta); + + expQuanta = maxQuanta - 1; + } + // decay calculation + if (expQuanta != quantaRemaining) { + quantaRemaining = expQuanta; + + if (expQuanta <= 0) { + world.setBlockToAir(x, y, z); + } else { + world.setBlockMetadataWithNotify(x, y, z, quantaPerBlock - expQuanta, 3); + world.scheduleBlockUpdate(x, y, z, blockID, tickRate); + world.notifyBlocksOfNeighborChange(x, y, z, blockID); + } + } + } else if (quantaRemaining > quantaPerBlock) { + world.setBlockMetadataWithNotify(x, y, z, 0, 3); + } + // Flow vertically if possible + if (canDisplace(world, x, y + densityDir, z)) { + flowIntoBlock(world, x, y + densityDir, z, 1); + return; + } + // Flow outward if possible + int flowMeta = quantaPerBlock - quantaRemaining + 1; + if (flowMeta >= quantaPerBlock) { + return; + } + + if (isSourceBlock(world, x, y, z) || !isFlowingVertically(world, x, y, z)) { + + if (world.getBlockId(x, y - densityDir, z) == blockID) { + flowMeta = 1; + } + boolean flowTo[] = getOptimalFlowDirections(world, x, y, z); + + if (flowTo[0]) { + flowIntoBlock(world, x - 1, y, z, flowMeta); + } + if (flowTo[1]) { + flowIntoBlock(world, x + 1, y, z, flowMeta); + } + if (flowTo[2]) { + flowIntoBlock(world, x, y, z - 1, flowMeta); + } + if (flowTo[3]) { + flowIntoBlock(world, x, y, z + 1, flowMeta); + } + } + } + + public boolean isFlowingVertically(IBlockAccess world, int x, int y, int z) { + + return world.getBlockId(x, y + densityDir, z) == blockID || world.getBlockId(x, y, z) == blockID && canFlowInto(world, x, y + densityDir, z); + } + + public boolean isSourceBlock(IBlockAccess world, int x, int y, int z) { + + return world.getBlockId(x, y, z) == blockID && world.getBlockMetadata(x, y, z) == 0; + } + + protected boolean[] getOptimalFlowDirections(World world, int x, int y, int z) { + + for (int side = 0; side < 4; side++) { + flowCost[side] = 1000; + + int x2 = x; + int y2 = y; + int z2 = z; + + switch (side) { + case 0: + --x2; + break; + case 1: + ++x2; + break; + case 2: + --z2; + break; + case 3: + ++z2; + break; + } + + if (!canFlowInto(world, x2, y2, z2) || isSourceBlock(world, x2, y2, z2)) { + continue; + } + if (canFlowInto(world, x2, y2 + densityDir, z2)) { + flowCost[side] = 0; + } else { + flowCost[side] = calculateFlowCost(world, x2, y2, z2, 1, side); + } + } + + int min = flowCost[0]; + for (int side = 1; side < 4; side++) { + if (flowCost[side] < min) { + min = flowCost[side]; + } + } + for (int side = 0; side < 4; side++) { + isOptimalFlowDirection[side] = flowCost[side] == min; + } + return isOptimalFlowDirection; + } + + protected int calculateFlowCost(World world, int x, int y, int z, int recurseDepth, int side) { + + int cost = 1000; + + for (int adjSide = 0; adjSide < 4; adjSide++) { + if (adjSide == 0 && side == 1 || adjSide == 1 && side == 0 || adjSide == 2 && side == 3 || adjSide == 3 && side == 2) { + continue; + } + + int x2 = x; + int y2 = y; + int z2 = z; + + switch (adjSide) { + case 0: + --x2; + break; + case 1: + ++x2; + break; + case 2: + --z2; + break; + case 3: + ++z2; + break; + } + + if (!canFlowInto(world, x2, y2, z2) || isSourceBlock(world, x2, y2, z2)) { + continue; + } + if (canFlowInto(world, x2, y2 + densityDir, z2)) { + return recurseDepth; + } + if (recurseDepth >= 4) { + continue; + } + int min = calculateFlowCost(world, x2, y2, z2, recurseDepth + 1, adjSide); + if (min < cost) { + cost = min; + } + } + return cost; + } + + protected void flowIntoBlock(World world, int x, int y, int z, int meta) { + + if (meta < 0) { + return; + } + if (displaceIfPossible(world, x, y, z)) { + world.setBlock(x, y, z, this.blockID, meta, 3); + } + } + + protected boolean canFlowInto(IBlockAccess world, int x, int y, int z) { + + int bId = world.getBlockId(x, y, z); + if (bId == 0) { + return true; + } + if (bId == blockID) { + return true; + } + if (displacementIds.containsKey(bId)) { + return displacementIds.get(bId); + } + Material material = Block.blocksList[bId].blockMaterial; + if (material.blocksMovement() || material == Material.water || material == Material.lava || material == Material.portal) { + return false; + } + return true; + } + + protected int getLargerQuanta(IBlockAccess world, int x, int y, int z, int compare) { + + int quantaRemaining = getQuantaValue(world, x, y, z); + + if (quantaRemaining <= 0) { + return compare; + } + return quantaRemaining >= compare ? quantaRemaining : compare; + } + + /* IFluidBlock */ + @Override + public FluidStack drain(World world, int x, int y, int z, boolean doDrain) { + + if (!isSourceBlock(world, x, y, z)) { + return null; + } + if (doDrain) { + world.setBlockToAir(x, y, z); + } + return stack.copy(); + } + + @Override + public boolean canDrain(World world, int x, int y, int z) { + + return isSourceBlock(world, x, y, z); + } + +} diff --git a/common/net/minecraftforge/fluids/BlockFluidFinite.java b/common/net/minecraftforge/fluids/BlockFluidFinite.java new file mode 100644 index 000000000..1d0e4b945 --- /dev/null +++ b/common/net/minecraftforge/fluids/BlockFluidFinite.java @@ -0,0 +1,271 @@ + +package net.minecraftforge.fluids; + +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +/** + * This is a cellular-automata based finite fluid block implementation. + * + * It is highly recommended that you use/extend this class for finite fluid blocks. + * + * @author OvermindDL1, KingLemming + * + */ +public class BlockFluidFinite extends BlockFluidBase { + + public BlockFluidFinite(int id, Fluid fluid, Material material) { + + super(id, fluid, material); + } + + @Override + public int getQuantaValue(IBlockAccess world, int x, int y, int z) { + + if (world.getBlockId(x, y, z) == 0) { + return 0; + } + if (world.getBlockId(x, y, z) != blockID) { + return -1; + } + int quantaRemaining = world.getBlockMetadata(x, y, z) + 1; + return quantaRemaining; + } + + @Override + public boolean canCollideCheck(int meta, boolean fullHit) { + + return fullHit && meta == quantaPerBlock - 1; + } + + @Override + public int getMaxRenderHeightMeta() { + + return quantaPerBlock - 1; + } + + @Override + public void updateTick(World world, int x, int y, int z, Random rand) { + + boolean changed = false; + int quantaRemaining = world.getBlockMetadata(x, y, z) + 1; + + // Flow vertically if possible + int prevRemaining = quantaRemaining; + quantaRemaining = tryToFlowVerticallyInto(world, x, y, z, quantaRemaining); + + if (quantaRemaining < 1) { + return; + } else if (quantaRemaining != prevRemaining) { + changed = true; + + if (quantaRemaining == 1) { + world.setBlockMetadataWithNotify(x, y, z, quantaRemaining - 1, 2); + return; + } + } else if (quantaRemaining == 1) { + return; + } + + // Flow out if possible + int lowerthan = quantaRemaining - 1; + + if (displaceIfPossible(world, x, y, z - 1)) { + world.setBlock(x, y, z - 1, 0); + } + if (displaceIfPossible(world, x, y, z + 1)) { + world.setBlock(x, y, z + 1, 0); + } + if (displaceIfPossible(world, x - 1, y, z)) { + world.setBlock(x - 1, y, z, 0); + } + if (displaceIfPossible(world, x + 1, y, z)) { + world.setBlock(x + 1, y, z, 0); + } + int north = getQuantaValueBelow(world, x, y, z - 1, lowerthan); + int south = getQuantaValueBelow(world, x, y, z + 1, lowerthan); + int west = getQuantaValueBelow(world, x - 1, y, z, lowerthan); + int east = getQuantaValueBelow(world, x + 1, y, z, lowerthan); + int total = quantaRemaining; + int count = 1; + + if (north >= 0) { + ++count; + total += north; + } + if (south >= 0) { + ++count; + total += south; + } + if (west >= 0) { + ++count; + total += west; + } + if (east >= 0) { + ++count; + total += east; + } + if (count == 1) { + if (changed) { + world.setBlockMetadataWithNotify(x, y, z, quantaRemaining - 1, 2); + } + return; + } + int each = total / count; + int rem = total % count; + if (north >= 0) { + int newnorth = each; + + if (rem == count || rem > 1 && rand.nextInt(count - rem) != 0) { + ++newnorth; + --rem; + } + if (newnorth != north) { + if (newnorth == 0) { + world.setBlock(x, y, z - 1, 0); + } else { + world.setBlock(x, y, z - 1, blockID, newnorth - 1, 2); + } + world.scheduleBlockUpdate(x, y, z - 1, blockID, tickRate); + } + --count; + } + if (south >= 0) { + int newsouth = each; + + if (rem == count || rem > 1 && rand.nextInt(count - rem) != 0) { + ++newsouth; + --rem; + } + if (newsouth != south) { + if (newsouth == 0) { + world.setBlock(x, y, z + 1, 0); + } else { + world.setBlock(x, y, z + 1, blockID, newsouth - 1, 2); + } + world.scheduleBlockUpdate(x, y, z + 1, blockID, tickRate); + } + --count; + } + if (west >= 0) { + int newwest = each; + + if (rem == count || rem > 1 && rand.nextInt(count - rem) != 0) { + ++newwest; + --rem; + } + if (newwest != west) { + if (newwest == 0) { + world.setBlock(x - 1, y, z, 0); + } else { + world.setBlock(x - 1, y, z, blockID, newwest - 1, 2); + } + world.scheduleBlockUpdate(x - 1, y, z, blockID, tickRate); + } + --count; + } + if (east >= 0) { + int neweast = each; + + if (rem == count || rem > 1 && rand.nextInt(count - rem) != 0) { + ++neweast; + --rem; + } + if (neweast != east) { + if (neweast == 0) { + world.setBlock(x + 1, y, z, 0); + } else { + world.setBlock(x + 1, y, z, blockID, neweast - 1, 2); + } + world.scheduleBlockUpdate(x + 1, y, z, blockID, tickRate); + } + --count; + } + if (rem > 0) { + ++each; + } + world.setBlockMetadataWithNotify(x, y, z, each - 1, 2); + } + + public int tryToFlowVerticallyInto(World world, int x, int y, int z, int amtToInput) { + + int otherY = y + densityDir; + + if (otherY < 0 || otherY >= world.getHeight()) { + world.setBlockToAir(x, y, z); + return 0; + } + int amt = getQuantaValueBelow(world, x, otherY, z, quantaPerBlock); + + if (amt >= 0) { + amt += amtToInput; + if (amt > quantaPerBlock) { + world.setBlock(x, otherY, z, blockID, quantaPerBlock - 1, 3); + world.scheduleBlockUpdate(x, otherY, z, blockID, tickRate); + return amt - quantaPerBlock; + } else if (amt > 0) { + world.setBlock(x, otherY, z, blockID, amt - 1, 3); + world.scheduleBlockUpdate(x, otherY, z, blockID, tickRate); + world.setBlockToAir(x, y, z); + return 0; + } + return amtToInput; + } else { + int density_other = getDensity(world, x, otherY, z); + + if (density_other == Integer.MAX_VALUE) { + if (displaceIfPossible(world, x, otherY, z)) { + world.setBlock(x, otherY, z, blockID, amtToInput - 1, 3); + world.scheduleBlockUpdate(x, otherY, z, blockID, tickRate); + world.setBlockToAir(x, y, z); + return 0; + } else { + return amtToInput; + } + } + if (densityDir < 0) { + if (density_other < density) // then swap + { + int bId = world.getBlockId(x, otherY, z); + BlockFluidBase block = (BlockFluidBase) Block.blocksList[bId]; + int otherData = world.getBlockMetadata(x, otherY, z); + world.setBlock(x, otherY, z, blockID, amtToInput - 1, 3); + world.setBlock(x, y, z, bId, otherData, 3); + world.scheduleBlockUpdate(x, otherY, z, blockID, tickRate); + world.scheduleBlockUpdate(x, y, z, bId, block.tickRate(world)); + return 0; + } + } else { + if (density_other > density) { + int bId = world.getBlockId(x, otherY, z); + BlockFluidBase block = (BlockFluidBase) Block.blocksList[bId]; + int otherData = world.getBlockMetadata(x, otherY, z); + world.setBlock(x, otherY, z, blockID, amtToInput - 1, 3); + world.setBlock(x, y, z, bId, otherData, 3); + world.scheduleBlockUpdate(x, otherY, z, blockID, tickRate); + world.scheduleBlockUpdate(x, y, z, bId, block.tickRate(world)); + return 0; + } + } + return amtToInput; + } + } + + /* IFluidBlock */ + @Override + public FluidStack drain(World world, int x, int y, int z, boolean doDrain) { + + return null; + } + + @Override + public boolean canDrain(World world, int x, int y, int z) { + + return false; + } + +} diff --git a/common/net/minecraftforge/fluids/Fluid.java b/common/net/minecraftforge/fluids/Fluid.java new file mode 100644 index 000000000..2c29fe19e --- /dev/null +++ b/common/net/minecraftforge/fluids/Fluid.java @@ -0,0 +1,327 @@ + +package net.minecraftforge.fluids; + +import java.util.Locale; + +import net.minecraft.block.Block; +import net.minecraft.util.Icon; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; +import net.minecraftforge.common.ForgeDummyContainer; +import cpw.mods.fml.common.FMLLog; +import cpw.mods.fml.common.LoaderException; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +/** + * Minecraft Forge Fluid Implementation + * + * This class is a fluid (liquid or gas) equivalent to "Item." It describes the nature of a fluid + * and contains its general properties. + * + * These properties do not have inherent gameplay mechanics - they are provided so that mods may + * choose to take advantage of them. + * + * Fluid implementations are not required to actively use these properties, nor are objects + * interfacing with fluids required to make use of them, but it is encouraged. + * + * The default values can be used as a reference point for mods adding fluids such as oil or heavy + * water. + * + * @author King Lemming + * + */ +public class Fluid { + + /** The unique identification name for this fluid. */ + protected final String fluidName; + + /** The unlocalized name of this fluid. */ + protected String unlocalizedName; + + /** The Icons for this fluid. */ + @SideOnly(Side.CLIENT) + protected Icon stillIcon; + @SideOnly(Side.CLIENT) + protected Icon flowingIcon; + + /** + * The light level emitted by this fluid. + * + * Default value is 0, as most fluids do not actively emit light. + */ + protected int luminosity = 0; + + /** + * Density of the fluid - completely arbitrary; negative density indicates that the fluid is + * lighter than air. + * + * Default value is approximately the real-life density of water in kg/m^3. + */ + protected int density = 1000; + + /** + * Viscosity ("thickness") of the fluid - completely arbitrary; negative values are not + * permissible. + * + * Default value is approximately the real-life density of water in m/s^2 (x10^-3). + */ + protected int viscosity = 1000; + + /** + * This indicates if the fluid is gaseous. + * + * Useful for rendering the fluid in containers and the world. + * + * Generally this is associated with negative density fluids. + */ + protected boolean isGaseous; + + /** + * If there is a Block implementation of the Fluid, the BlockID is linked here. + * + * The default value of -1 should remain for any Fluid without a Block implementation. + */ + protected int blockID = -1; + + public Fluid(String fluidName) { + + this.fluidName = fluidName.toLowerCase(Locale.ENGLISH); + this.unlocalizedName = fluidName; + } + + public Fluid setUnlocalizedName(String unlocalizedName) { + + this.unlocalizedName = unlocalizedName; + return this; + } + + public Fluid setBlockID(int blockID) { + + if (this.blockID == -1 || this.blockID == blockID) { + this.blockID = blockID; + } else if (!ForgeDummyContainer.forceDuplicateFluidBlockCrash) { + FMLLog.warning("A mod has attempted to assign BlockID " + blockID + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID " + + this.blockID + ". Configure your mods to prevent this from happening."); + } else { + FMLLog.severe("A mod has attempted to assign BlockID " + blockID + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID " + + this.blockID + ". Configure your mods to prevent this from happening."); + throw new LoaderException(new RuntimeException("A mod has attempted to assign BlockID " + blockID + " to the Fluid '" + fluidName + + "' but this Fluid has already been linked to BlockID " + this.blockID + ". Configure your mods to prevent this from happening.")); + } + return this; + } + + public Fluid setBlockID(Block block) { + + return setBlockID(block.blockID); + } + + public Fluid setLuminosity(int luminosity) { + + this.luminosity = luminosity; + return this; + } + + public Fluid setDensity(int density) { + + this.density = density; + return this; + } + + public Fluid setViscosity(int viscosity) { + + this.viscosity = viscosity; + return this; + } + + public Fluid setGaseous(boolean isGaseous) { + + this.isGaseous = isGaseous; + return this; + } + + public final String getName() { + + return this.fluidName; + } + + public final int getID() { + + return FluidRegistry.getFluidID(this.fluidName); + } + + public final int getBlockID() { + + return blockID; + } + + public final boolean canBePlacedInWorld() { + + return blockID != -1; + } + + /** + * Returns the localized name of this fluid. + */ + public String getLocalizedName() { + + String s = this.getUnlocalizedName(); + return s == null ? "" : StatCollector.translateToLocal(s); + } + + /** + * Returns the unlocalized name of this fluid. + */ + public String getUnlocalizedName() { + + return "fluid." + this.unlocalizedName; + } + + /** + * Returns 0 for "/terrain.png". ALL FLUID TEXTURES MUST BE ON THIS SHEET. + */ + public final int getSpriteNumber() { + + return 0; + } + + /* Default Accessors */ + public final int getLuminosity() { + + return this.luminosity; + } + + public final int getDensity() { + + return this.density; + } + + public final int getViscosity() { + + return this.viscosity; + } + + public final boolean isGaseous() { + + return this.isGaseous; + } + + public int getColor() { + + return 0xFFFFFF; + } + + /* Stack-based Accessors */ + public int getLuminosity(FluidStack stack) { + + return getLuminosity(); + } + + public int getDensity(FluidStack stack) { + + return getDensity(); + } + + public int getViscosity(FluidStack stack) { + + return getViscosity(); + } + + public boolean isGaseous(FluidStack stack) { + + return isGaseous(); + } + + public int getColor(FluidStack stack) { + + return getColor(); + } + + /* World-based Accessors */ + public int getLuminosity(World world, int x, int y, int z) { + + return getLuminosity(); + } + + public int getDensity(World world, int x, int y, int z) { + + return getDensity(); + } + + public int getViscosity(World world, int x, int y, int z) { + + return getViscosity(); + } + + public boolean isGaseous(World world, int x, int y, int z) { + + return isGaseous(); + } + + public int getColor(World world, int x, int y, int z) { + + return getColor(); + } + + @SideOnly(Side.CLIENT) + public final Fluid setStillIcon(Icon stillIcon) { + + this.stillIcon = stillIcon; + return this; + } + + @SideOnly(Side.CLIENT) + public final Fluid setFlowingIcon(Icon flowingIcon) { + + this.flowingIcon = flowingIcon; + return this; + } + + @SideOnly(Side.CLIENT) + public final Fluid setIcons(Icon stillIcon, Icon flowingIcon) { + + this.stillIcon = stillIcon; + this.flowingIcon = flowingIcon; + return this; + } + + @SideOnly(Side.CLIENT) + public final Fluid setIcons(Icon commonIcon) { + + this.stillIcon = commonIcon; + this.flowingIcon = commonIcon; + return this; + } + + @SideOnly(Side.CLIENT) + public Icon getIcon() { + + return getStillIcon(); + } + + @SideOnly(Side.CLIENT) + public Icon getIcon(FluidStack stack) { + + return getIcon(); + } + + @SideOnly(Side.CLIENT) + public Icon getIcon(World world, int x, int y, int z) { + + return getIcon(); + } + + @SideOnly(Side.CLIENT) + public Icon getStillIcon() { + + return this.stillIcon; + } + + @SideOnly(Side.CLIENT) + public Icon getFlowingIcon() { + + return this.flowingIcon; + } + +} diff --git a/common/net/minecraftforge/fluids/FluidContainerRegistry.java b/common/net/minecraftforge/fluids/FluidContainerRegistry.java new file mode 100644 index 000000000..c94880e32 --- /dev/null +++ b/common/net/minecraftforge/fluids/FluidContainerRegistry.java @@ -0,0 +1,260 @@ + +package net.minecraftforge.fluids; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.Event; + +/** + * Register simple items that contain fluids here. Useful for buckets, bottles, and things that have + * ID/metadata mappings. + * + * For more complex items, use {@link IFluidContainerItem} instead. + * + * @author King Lemming + * + */ +public abstract class FluidContainerRegistry { + + private static Map containerFluidMap = new HashMap(); + private static Map filledContainerMap = new HashMap(); + private static Set emptyContainers = new HashSet(); + + public static final int BUCKET_VOLUME = 1000; + public static final ItemStack EMPTY_BUCKET = new ItemStack(Item.bucketEmpty); + public static final ItemStack EMPTY_BOTTLE = new ItemStack(Item.glassBottle); + + static { + registerFluidContainer(FluidRegistry.WATER, new ItemStack(Item.bucketWater), EMPTY_BUCKET); + registerFluidContainer(FluidRegistry.LAVA, new ItemStack(Item.bucketLava), EMPTY_BUCKET); + registerFluidContainer(FluidRegistry.WATER, new ItemStack(Item.potion), EMPTY_BOTTLE); + } + + private FluidContainerRegistry() { + + } + + /** + * Register a new fluid containing item. + * + * @param stack + * FluidStack containing the type and amount of the fluid stored in the item. + * @param filledContainer + * ItemStack representing the container when it is full. + * @param emptyContainer + * ItemStack representing the container when it is empty. + * @return True if container was successfully registered; false if it already is. + */ + public static boolean registerFluidContainer(FluidStack stack, ItemStack filledContainer, ItemStack emptyContainer) { + + return registerFluidContainer(new FluidContainerData(stack, filledContainer, emptyContainer)); + } + + /** + * Register a new fluid containing item. The item is assumed to hold 1000 mB of fluid. Also + * registers the Fluid if possible. + * + * @param fluid + * Fluid type that is stored in the item. + * @param filledContainer + * ItemStack representing the container when it is full. + * @param emptyContainer + * ItemStack representing the container when it is empty. + * @return True if container was successfully registered; false if it already is. + */ + public static boolean registerFluidContainer(Fluid fluid, ItemStack filledContainer, ItemStack emptyContainer) { + + if (!FluidRegistry.isFluidRegistered(fluid)) { + FluidRegistry.registerFluid(fluid); + } + return registerFluidContainer(new FluidStack(fluid, BUCKET_VOLUME), filledContainer, emptyContainer); + } + + /** + * Register a new fluid containing item that does not have an empty container. + * + * @param stack + * FluidStack containing the type and amount of the fluid stored in the item. + * @param filledContainer + * ItemStack representing the container when it is full. + * @return True if container was successfully registered; false if it already is. + */ + public static boolean registerFluidContainer(FluidStack stack, ItemStack filledContainer) { + + return registerFluidContainer(new FluidContainerData(stack, filledContainer, null, true)); + } + + /** + * Register a new fluid containing item that does not have an empty container. The item is + * assumed to hold 1000 mB of fluid. Also registers the Fluid if possible. + * + * @param fluid + * Fluid type that is stored in the item. + * @param filledContainer + * ItemStack representing the container when it is full. + * @return True if container was successfully registered; false if it already is. + */ + public static boolean registerFluidContainer(Fluid fluid, ItemStack filledContainer) { + + if (!FluidRegistry.isFluidRegistered(fluid)) { + FluidRegistry.registerFluid(fluid); + } + return registerFluidContainer(new FluidStack(fluid, BUCKET_VOLUME), filledContainer); + } + + /** + * Register a new fluid containing item. + * + * @param data + * See {@link FluidContainerData}. + * @return True if container was successfully registered; false if it already is. + */ + public static boolean registerFluidContainer(FluidContainerData data) { + + if (isFilledContainer(data.filledContainer)) { + return false; + } + containerFluidMap.put(Arrays.asList(data.filledContainer.itemID, data.filledContainer.getItemDamage()), data); + + if (data.emptyContainer != null) { + filledContainerMap.put(Arrays.asList(data.emptyContainer.itemID, data.emptyContainer.getItemDamage(), data.fluid.fluidID), data); + emptyContainers.add(Arrays.asList(data.emptyContainer.itemID, data.emptyContainer.getItemDamage())); + } + MinecraftForge.EVENT_BUS.post(new FluidContainerRegisterEvent(data)); + return true; + } + + /** + * Determines the fluid type and amount inside a container. + * + * @param container + * The fluid container. + * @return FluidStack representing stored fluid. + */ + public static FluidStack getFluidForFilledItem(ItemStack container) { + + if (container == null) { + return null; + } + FluidContainerData data = containerFluidMap.get(Arrays.asList(container.itemID, container.getItemDamage())); + return data == null ? null : data.fluid.copy(); + } + + /** + * Attempts to fill an empty container with a fluid. + * + * NOTE: Returns null on fail, NOT the empty container. + * + * @param fluid + * FluidStack containing the type and amount of fluid to fill. + * @param container + * ItemStack representing the empty container. + * @return Filled container if successful, otherwise null. + */ + public static ItemStack fillFluidContainer(FluidStack fluid, ItemStack container) { + + if (container == null || fluid == null) { + return null; + } + FluidContainerData data = filledContainerMap.get(Arrays.asList(container.itemID, container.getItemDamage(), fluid.fluidID)); + if (data != null && fluid.amount >= data.fluid.amount) { + return data.filledContainer.copy(); + } + return null; + } + + /** + * Determines if a container holds a specific fluid. + */ + public static boolean containsFluid(ItemStack container, FluidStack fluid) { + + if (container == null || fluid == null) { + return false; + } + FluidContainerData data = filledContainerMap.get(Arrays.asList(container.itemID, container.getItemDamage(), fluid.fluidID)); + return data == null ? false : data.fluid.isFluidEqual(fluid); + } + + public static boolean isBucket(ItemStack container) { + + if (container == null) { + return false; + } + if (container.isItemEqual(EMPTY_BUCKET)) { + return true; + } + FluidContainerData data = containerFluidMap.get(Arrays.asList(container.itemID, container.getItemDamage())); + return data != null && data.emptyContainer.isItemEqual(EMPTY_BUCKET); + } + + public static boolean isContainer(ItemStack container) { + + return isEmptyContainer(container) || isFilledContainer(container); + } + + public static boolean isEmptyContainer(ItemStack container) { + + return container != null && emptyContainers.contains(Arrays.asList(container.itemID, container.getItemDamage())); + } + + public static boolean isFilledContainer(ItemStack container) { + + return container != null && getFluidForFilledItem(container) != null; + } + + public static FluidContainerData[] getRegisteredFluidContainerData() { + + return (FluidContainerData[]) containerFluidMap.values().toArray(); + } + + /** + * Wrapper class for the registry entries. Ensures that none of the attempted registrations + * contain null references unless permitted. + */ + public static class FluidContainerData { + + public final FluidStack fluid; + public final ItemStack filledContainer; + public final ItemStack emptyContainer; + + public FluidContainerData(FluidStack stack, ItemStack filledContainer, ItemStack emptyContainer) { + + this(stack, filledContainer, emptyContainer, false); + } + + public FluidContainerData(FluidStack stack, ItemStack filledContainer, ItemStack emptyContainer, boolean nullEmpty) { + + this.fluid = stack; + this.filledContainer = filledContainer; + this.emptyContainer = emptyContainer; + + if (stack == null || filledContainer == null || emptyContainer == null && !nullEmpty) { + throw new RuntimeException("Invalid FluidContainerData - a parameter was null."); + } + } + + public FluidContainerData copy() { + + return new FluidContainerData(fluid, filledContainer, emptyContainer, true); + } + } + + public static class FluidContainerRegisterEvent extends Event { + + public final FluidContainerData data; + + public FluidContainerRegisterEvent(FluidContainerData data) { + + this.data = data.copy(); + } + } + +} diff --git a/common/net/minecraftforge/fluids/FluidEvent.java b/common/net/minecraftforge/fluids/FluidEvent.java new file mode 100644 index 000000000..328ba706b --- /dev/null +++ b/common/net/minecraftforge/fluids/FluidEvent.java @@ -0,0 +1,100 @@ + +package net.minecraftforge.fluids; + +import net.minecraft.world.World; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.Event; + +public class FluidEvent extends Event { + + public final FluidStack fluid; + public final int x; + public final int y; + public final int z; + public final World world; + + public FluidEvent(FluidStack fluid, World world, int x, int y, int z) { + + this.fluid = fluid; + this.world = world; + this.x = x; + this.y = y; + this.z = z; + } + + /** + * Mods should fire this event when they move fluids around. + * + * @author cpw + * + */ + public static class FluidMotionEvent extends FluidEvent { + + public FluidMotionEvent(FluidStack fluid, World world, int x, int y, int z) { + + super(fluid, world, x, y, z); + } + } + + /** + * Mods should fire this event when a fluid is {@link IFluidTank#fill(FluidStack, boolean)} + * their tank implementation. {@link FluidTank} does. + * + * @author cpw + * + */ + public static class FluidFillingEvent extends FluidEvent { + + public final IFluidTank tank; + + public FluidFillingEvent(FluidStack fluid, World world, int x, int y, int z, IFluidTank tank) { + + super(fluid, world, x, y, z); + this.tank = tank; + } + } + + /** + * Mods should fire this event when a fluid is {@link IFluidTank#drain(int, boolean)} from their + * tank. + * + * @author cpw + * + */ + public static class FluidDrainingEvent extends FluidEvent { + + public final IFluidTank tank; + + public FluidDrainingEvent(FluidStack fluid, World world, int x, int y, int z, IFluidTank tank) { + + super(fluid, world, x, y, z); + this.tank = tank; + } + } + + /** + * Mods should fire this event when a fluid "spills", for example, if a block containing fluid + * is broken. + * + * @author cpw + * + */ + public static class FluidSpilledEvent extends FluidEvent { + + public FluidSpilledEvent(FluidStack fluid, World world, int x, int y, int z) { + + super(fluid, world, x, y, z); + } + } + + /** + * A handy shortcut for firing the various fluid events. + * + * @param event + */ + public static final void fireEvent(FluidEvent event) { + + MinecraftForge.EVENT_BUS.post(event); + } + +} diff --git a/common/net/minecraftforge/fluids/FluidIdMapPacket.java b/common/net/minecraftforge/fluids/FluidIdMapPacket.java new file mode 100644 index 000000000..2baead08d --- /dev/null +++ b/common/net/minecraftforge/fluids/FluidIdMapPacket.java @@ -0,0 +1,52 @@ + +package net.minecraftforge.fluids; + +import java.util.Map; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.network.INetworkManager; +import net.minecraftforge.common.network.ForgePacket; + +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; +import com.google.common.io.ByteArrayDataInput; +import com.google.common.io.ByteArrayDataOutput; +import com.google.common.io.ByteStreams; + +public class FluidIdMapPacket extends ForgePacket { + + private BiMap fluidIds = HashBiMap.create(); + + @Override + public byte[] generatePacket(Object... data) { + + ByteArrayDataOutput dat = ByteStreams.newDataOutput(); + + dat.writeInt(FluidRegistry.maxID); + for (Map.Entry entry : FluidRegistry.fluidIDs.entrySet()) { + dat.writeUTF(entry.getKey()); + dat.writeInt(entry.getValue()); + } + return dat.toByteArray(); + } + + @Override + public ForgePacket consumePacket(byte[] data) { + + ByteArrayDataInput dat = ByteStreams.newDataInput(data); + int listSize = dat.readInt(); + for (int i = 0; i < listSize; i++) { + String fluidName = dat.readUTF(); + int fluidId = dat.readInt(); + fluidIds.put(fluidName, fluidId); + } + return this; + } + + @Override + public void execute(INetworkManager network, EntityPlayer player) { + + FluidRegistry.initFluidIDs(fluidIds); + } + +} diff --git a/common/net/minecraftforge/fluids/FluidRegistry.java b/common/net/minecraftforge/fluids/FluidRegistry.java new file mode 100644 index 000000000..34bd87fc1 --- /dev/null +++ b/common/net/minecraftforge/fluids/FluidRegistry.java @@ -0,0 +1,142 @@ + +package net.minecraftforge.fluids; + +import java.util.HashMap; +import java.util.Map; + +import net.minecraft.block.Block; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.Event; + +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; +import com.google.common.collect.ImmutableMap; + +/** + * Handles Fluid registrations. Fluids MUST be registered in order to function. + * + * @author King Lemming, CovertJaguar (LiquidDictionary) + * + */ +public abstract class FluidRegistry { + + static int maxID = 0; + + static HashMap fluids = new HashMap(); + static BiMap fluidIDs = HashBiMap.create(); + + public static final Fluid WATER = new Fluid("water").setBlockID(Block.waterStill.blockID); + public static final Fluid LAVA = new Fluid("lava").setBlockID(Block.lavaStill.blockID).setLuminosity(15).setDensity(3000).setViscosity(6000); + + public static int renderIdFluid = -1; + + static { + registerFluid(WATER); + registerFluid(LAVA); + } + + private FluidRegistry() { + + } + + /** + * Called by Forge to prepare the ID map for server -> client sync. + */ + static void initFluidIDs(BiMap newfluidIDs) { + + maxID = newfluidIDs.size(); + fluidIDs.clear(); + fluidIDs.putAll(newfluidIDs); + } + + /** + * Register a new Fluid. If a fluid with the same name already exists, registration is denied. + * + * @param fluid + * The fluid to register. + * @return True if the fluid was successfully registered; false if there is a name clash. + */ + public static boolean registerFluid(Fluid fluid) { + + if (fluidIDs.containsKey(fluid.getName())) { + return false; + } + fluids.put(fluid.getName(), fluid); + fluidIDs.put(fluid.getName(), ++maxID); + + MinecraftForge.EVENT_BUS.post(new FluidRegisterEvent(fluid.getName(), maxID)); + return true; + } + + public static boolean isFluidRegistered(Fluid fluid) { + + return fluidIDs.containsKey(fluid.getName()); + } + + public static boolean isFluidRegistered(String fluidName) { + + return fluidIDs.containsKey(fluidName); + } + + public static Fluid getFluid(String fluidName) { + + return fluids.get(fluidName); + } + + public static Fluid getFluid(int fluidID) { + + return fluids.get(getFluidName(fluidID)); + } + + public static String getFluidName(int fluidID) { + + return fluidIDs.inverse().get(fluidID); + } + + public static String getFluidName(FluidStack stack) { + + return getFluidName(stack.fluidID); + } + + public static int getFluidID(String fluidName) { + + return fluidIDs.get(fluidName); + } + + public static FluidStack getFluidStack(String fluidName, int amount) { + + if (!fluidIDs.containsKey(fluidName)) { + return null; + } + return new FluidStack(getFluidID(fluidName), amount); + } + + /** + * Returns a read-only map containing Fluid Names and their associated Fluids. + */ + public static Map getRegisteredFluids() { + + return ImmutableMap.copyOf(fluids); + } + + /** + * Returns a read-only map containing Fluid Names and their associated IDs. + */ + public static Map getRegisteredFluidIDs() { + + return ImmutableMap.copyOf(fluidIDs); + } + + public static class FluidRegisterEvent extends Event { + + public final String fluidName; + public final int fluidID; + + public FluidRegisterEvent(String fluidName, int fluidID) { + + this.fluidName = fluidName; + this.fluidID = fluidID; + } + } + +} diff --git a/common/net/minecraftforge/fluids/FluidStack.java b/common/net/minecraftforge/fluids/FluidStack.java new file mode 100644 index 000000000..ede8942b1 --- /dev/null +++ b/common/net/minecraftforge/fluids/FluidStack.java @@ -0,0 +1,177 @@ + +package net.minecraftforge.fluids; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +/** + * ItemStack substitute for Fluids. + * + * NOTE: Equality is based on the Fluid, not the amount. Use + * {@link #isFluidStackIdentical(FluidStack)} to determine if FluidID, Amount and NBT Tag are all + * equal. + * + * @author King Lemming, SirSengir (LiquidStack) + * + */ +public class FluidStack { + + public int fluidID; + public int amount; + public NBTTagCompound tag; + + public FluidStack(Fluid fluid, int amount) { + + this.fluidID = fluid.getID(); + this.amount = amount; + } + + public FluidStack(int fluidID, int amount) { + + this.fluidID = fluidID; + this.amount = amount; + } + + public FluidStack(int fluidID, int amount, NBTTagCompound nbt) { + + this(fluidID, amount); + + if (nbt != null) { + tag = (NBTTagCompound) nbt.copy(); + } + } + + public FluidStack(FluidStack stack, int amount) { + + this(stack.fluidID, amount, stack.tag); + } + + /** + * This provides a safe method for retrieving a FluidStack - if the Fluid is invalid, the stack + * will return as null. + */ + public static FluidStack loadFluidStackFromNBT(NBTTagCompound nbt) { + + if (nbt == null || FluidRegistry.getFluid(nbt.getString("FluidName")) == null) { + return null; + } + FluidStack stack = new FluidStack(FluidRegistry.getFluidID(nbt.getString("FluidName")), nbt.getInteger("Amount")); + + if (nbt.hasKey("Tag")) { + stack.tag = nbt.getCompoundTag("Tag"); + } + return stack; + } + + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { + + nbt.setString("FluidName", FluidRegistry.getFluidName(fluidID)); + nbt.setInteger("Amount", amount); + + if (tag != null) { + nbt.setTag("Tag", tag); + } + return nbt; + } + + public final Fluid getFluid() { + + return FluidRegistry.getFluid(fluidID); + } + + /** + * @return A copy of this FluidStack + */ + public FluidStack copy() { + + return new FluidStack(fluidID, amount, tag); + } + + /** + * Determines if the FluidIDs and NBT Tags are equal. This does not check amounts. + * + * @param other + * The FluidStack for comparison + * @return true if the Fluids (IDs and NBT Tags) are the same + */ + public boolean isFluidEqual(FluidStack other) { + + return other != null && fluidID == other.fluidID && isFluidStackTagEqual(other); + } + + private boolean isFluidStackTagEqual(FluidStack other) { + + return tag == null ? other.tag == null : other.tag == null ? false : tag.equals(other.tag); + } + + /** + * Determines if the NBT Tags are equal. Useful if the FluidIDs are known to be equal. + */ + public static boolean areFluidStackTagsEqual(FluidStack stack1, FluidStack stack2) { + + return stack1 == null && stack2 == null ? true : stack1 == null || stack2 == null ? false : stack1.isFluidStackTagEqual(stack2); + } + + /** + * Determines if the Fluids are equal and this stack is larger. + * + * @param other + * @return true if this FluidStack contains the other FluidStack (same fluid and >= amount) + */ + public boolean containsFluid(FluidStack other) { + + return isFluidEqual(other) && amount >= other.amount; + } + + /** + * Determines if the FluidIDs, Amounts, and NBT Tags are all equal. + * + * @param other + * - the FluidStack for comparison + * @return true if the two FluidStacks are exactly the same + */ + public boolean isFluidStackIdentical(FluidStack other) { + + return isFluidEqual(other) && amount == other.amount; + } + + /** + * Determines if the FluidIDs and NBT Tags are equal compared to a registered container + * ItemStack. This does not check amounts. + * + * @param other + * The ItemStack for comparison + * @return true if the Fluids (IDs and NBT Tags) are the same + */ + public boolean isFluidEqual(ItemStack other) { + + if (other == null) { + return false; + } + if (other.getItem() instanceof IFluidContainerItem) { + return isFluidEqual(((IFluidContainerItem) other.getItem()).getFluid(other)); + } + return isFluidEqual(FluidContainerRegistry.getFluidForFilledItem(other)); + } + + @Override + public final int hashCode() { + + return fluidID; + } + + /** + * Default equality comparison for a FluidStack. Same functionality as isFluidEqual(). + * + * This is included for use in data structures. + */ + @Override + public final boolean equals(Object o) { + + if (!(o instanceof FluidStack)) { + return false; + } + return isFluidEqual((FluidStack) o); + } + +} diff --git a/common/net/minecraftforge/fluids/FluidTank.java b/common/net/minecraftforge/fluids/FluidTank.java new file mode 100644 index 000000000..ee39fa515 --- /dev/null +++ b/common/net/minecraftforge/fluids/FluidTank.java @@ -0,0 +1,161 @@ + +package net.minecraftforge.fluids; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; + +/** + * Reference implementation of {@link IFluidTank}. Use/extend this or implement your own. + * + * @author King Lemming, cpw (LiquidTank) + * + */ +public class FluidTank implements IFluidTank { + + protected FluidStack fluid; + protected int capacity; + protected TileEntity tile; + + public FluidTank(int capacity) { + + this(null, capacity); + } + + public FluidTank(FluidStack stack, int capacity) { + + this.fluid = stack; + this.capacity = capacity; + } + + public FluidTank(Fluid fluid, int amount, int capacity) { + + this(new FluidStack(fluid, amount), capacity); + } + + public FluidTank readFromNBT(NBTTagCompound nbt) { + + if (!nbt.hasKey("Empty")) { + FluidStack fluid = FluidStack.loadFluidStackFromNBT(nbt); + + if (fluid != null) { + setFluid(fluid); + } + } + return this; + } + + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { + + if (fluid != null) { + fluid.writeToNBT(nbt); + } else { + nbt.setString("Empty", ""); + } + return nbt; + } + + public void setFluid(FluidStack fluid) { + + this.fluid = fluid; + } + + public void setCapacity(int capacity) { + + this.capacity = capacity; + } + + /* IFluidTank */ + @Override + public FluidStack getFluid() { + + return fluid; + } + + @Override + public int getFluidAmount() { + + if (fluid == null) { + return 0; + } + return fluid.amount; + } + + @Override + public int getCapacity() { + + return capacity; + } + + @Override + public FluidTankInfo getInfo() { + + return new FluidTankInfo(this); + } + + @Override + public int fill(FluidStack resource, boolean doFill) { + + if (resource == null) { + return 0; + } + if (!doFill) { + if (fluid == null) { + return Math.min(capacity, resource.amount); + } + if (!fluid.isFluidEqual(resource)) { + return 0; + } + return Math.min(capacity - fluid.amount, resource.amount); + } + if (fluid == null) { + fluid = new FluidStack(resource, Math.min(capacity, resource.amount)); + + if (tile != null) { + FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluid, tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord, this)); + } + return fluid.amount; + } + if (!fluid.isFluidEqual(resource)) { + return 0; + } + int filled = capacity - fluid.amount; + + if (resource.amount < filled) { + fluid.amount += resource.amount; + filled = resource.amount; + } else { + fluid.amount = capacity; + } + if (tile != null) { + FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluid, tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord, this)); + } + return filled; + } + + @Override + public FluidStack drain(int maxDrain, boolean doDrain) { + + if (fluid == null) { + return null; + } + int drained = maxDrain; + + if (fluid.amount < drained) { + drained = fluid.amount; + } + FluidStack stack = new FluidStack(fluid, drained); + + if (doDrain) { + fluid.amount -= drained; + + if (fluid.amount <= 0) { + fluid = null; + } + if (tile != null) { + FluidEvent.fireEvent(new FluidEvent.FluidDrainingEvent(fluid, tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord, this)); + } + } + return stack; + } + +} diff --git a/common/net/minecraftforge/fluids/FluidTankInfo.java b/common/net/minecraftforge/fluids/FluidTankInfo.java new file mode 100644 index 000000000..8443f1452 --- /dev/null +++ b/common/net/minecraftforge/fluids/FluidTankInfo.java @@ -0,0 +1,27 @@ + +package net.minecraftforge.fluids; + +/** + * Wrapper class used to encapsulate information about an IFluidTank. + * + * @author King Lemming + * + */ +public final class FluidTankInfo { + + public final FluidStack fluid; + public final int capacity; + + public FluidTankInfo(FluidStack fluid, int capacity) { + + this.fluid = fluid; + this.capacity = capacity; + } + + public FluidTankInfo(IFluidTank tank) { + + this.fluid = tank.getFluid(); + this.capacity = tank.getCapacity(); + } + +} diff --git a/common/net/minecraftforge/fluids/IFluidBlock.java b/common/net/minecraftforge/fluids/IFluidBlock.java new file mode 100644 index 000000000..5d66980a6 --- /dev/null +++ b/common/net/minecraftforge/fluids/IFluidBlock.java @@ -0,0 +1,41 @@ + +package net.minecraftforge.fluids; + +import net.minecraft.world.World; + +/** + * Implement this interface on Block classes which represent world-placeable Fluids. + * + * NOTE: Using/extending the reference implementations {@link BlockFluidBase} is encouraged. + * + * @author King Lemming + * + */ +public interface IFluidBlock { + + /** + * Returns the Fluid associated with this Block. + */ + Fluid getFluid(); + + /** + * Attempt to drain the block. This method should be called by devices such as pumps. + * + * NOTE: The block is intended to handle its own state changes. + * + * @param doDrain + * If false, the drain will only be simulated. + * @return + */ + FluidStack drain(World world, int x, int y, int z, boolean doDrain); + + /** + * Check to see if a block can be drained. This method should be called by devices such as + * pumps. + * + * @param doDrain + * If false, the drain will only be simulated. + * @return + */ + boolean canDrain(World world, int x, int y, int z); +} diff --git a/common/net/minecraftforge/fluids/IFluidContainerItem.java b/common/net/minecraftforge/fluids/IFluidContainerItem.java new file mode 100644 index 000000000..c3ab9924a --- /dev/null +++ b/common/net/minecraftforge/fluids/IFluidContainerItem.java @@ -0,0 +1,61 @@ + +package net.minecraftforge.fluids; + +import net.minecraft.item.ItemStack; + +/** + * Implement this interface on Item classes that support external manipulation of their internal + * fluid storage. + * + * A reference implementation is provided {@link ItemFluidContainer}. + * + * NOTE: Use of NBT data on the containing ItemStack is encouraged. + * + * @author King Lemming + * + */ +public interface IFluidContainerItem { + + /** + * + * @param container + * ItemStack which is the fluid container. + * @return FluidStack representing the fluid in the container, null if the container is empty. + */ + FluidStack getFluid(ItemStack container); + + /** + * + * @param container + * ItemStack which is the fluid container. + * @return Capacity of this fluid container. + */ + int getCapacity(ItemStack container); + + /** + * + * @param container + * ItemStack which is the fluid container. + * @param resource + * FluidStack attempting to fill the container. + * @param doFill + * If false, the fill will only be simulated. + * @return Amount of fluid that was (or would have been, if simulated) filled into the + * container. + */ + int fill(ItemStack container, FluidStack resource, boolean doFill); + + /** + * + * @param container + * ItemStack which is the fluid container. + * @param maxDrain + * Maximum amount of fluid to be removed from the container. + * @param doFill + * If false, the drain will only be simulated. + * @return Amount of fluid that was (or would have been, if simulated) drained from the + * container. + */ + FluidStack drain(ItemStack container, int maxDrain, boolean doDrain); + +} diff --git a/common/net/minecraftforge/fluids/IFluidHandler.java b/common/net/minecraftforge/fluids/IFluidHandler.java new file mode 100644 index 000000000..17e96343e --- /dev/null +++ b/common/net/minecraftforge/fluids/IFluidHandler.java @@ -0,0 +1,84 @@ + +package net.minecraftforge.fluids; + +import net.minecraftforge.common.ForgeDirection; + +/** + * Implement this interface on TileEntities which should handle fluids, generally storing them in + * one or more internal {@link IFluidTank} objects. + * + * A reference implementation is provided {@link TileFluidHandler}. + * + * @author King Lemming + * + */ +public interface IFluidHandler { + + /** + * Fills fluid into internal tanks, distribution is left entirely to the IFluidHandler. + * + * @param from + * Orientation the Fluid is pumped in from. + * @param resource + * FluidStack representing the Fluid and maximum amount of fluid to be filled. + * @param doFill + * If false, fill will only be simulated. + * @return Amount of resource that was (or would have been, if simulated) filled. + */ + int fill(ForgeDirection from, FluidStack resource, boolean doFill); + + /** + * Drains fluid out of internal tanks, distribution is left entirely to the IFluidHandler. + * + * @param from + * Orientation the Fluid is drained to. + * @param resource + * FluidStack representing the Fluid and maximum amount of fluid to be drained. + * @param doDrain + * If false, drain will only be simulated. + * @return FluidStack representing the Fluid and amount that was (or would have been, if + * simulated) drained. + */ + FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain); + + /** + * Drains fluid out of internal tanks, distribution is left entirely to the IFluidHandler. + * + * This method is not Fluid-sensitive. + * + * @param from + * Orientation the fluid is drained to. + * @param maxDrain + * Maximum amount of fluid to drain. + * @param doDrain + * If false, drain will only be simulated. + * @return FluidStack representing the Fluid and amount that was (or would have been, if + * simulated) drained. + */ + FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain); + + /** + * Returns true if the given fluid can be inserted into the given direction. + * + * More formally, this should return true if fluid is able to enter from the given direction. + */ + boolean canFill(ForgeDirection from, Fluid fluid); + + /** + * Returns true if the given fluid can be extracted from the given direction. + * + * More formally, this should return true if fluid is able to leave from the given direction. + */ + boolean canDrain(ForgeDirection from, Fluid fluid); + + /** + * Returns an array of objects which represent the internal tanks. These objects cannot be used + * to manipulate the internal tanks. See {@link FluidTankInfo}. + * + * @param from + * Orientation determining which tanks should be queried. + * @return Info for the relevant internal tanks. + */ + FluidTankInfo[] getTankInfo(ForgeDirection from); + +} diff --git a/common/net/minecraftforge/fluids/IFluidTank.java b/common/net/minecraftforge/fluids/IFluidTank.java new file mode 100644 index 000000000..f88564857 --- /dev/null +++ b/common/net/minecraftforge/fluids/IFluidTank.java @@ -0,0 +1,59 @@ + +package net.minecraftforge.fluids; + +/** + * A tank is the unit of interaction with Fluid inventories. + * + * A reference implementation can be found at {@link FluidTank}. + * + * @author King Lemming, cpw (ILiquidTank) + * + */ +public interface IFluidTank { + + /** + * @return FluidStack representing the fluid in the tank, null if the tank is empty. + */ + FluidStack getFluid(); + + /** + * @return Current amount of fluid in the tank. + */ + int getFluidAmount(); + + /** + * @return Capacity of this fluid tank. + */ + int getCapacity(); + + /** + * Returns a wrapper object {@link FluidTankInfo } containing the capacity of the tank and the + * FluidStack it holds. + * + * Should prevent manipulation of the IFluidTank. See {@link FluidTank}. + * + * @return State information for the IFluidTank. + */ + FluidTankInfo getInfo(); + + /** + * + * @param resource + * FluidStack attempting to fill the tank. + * @param doFill + * If false, the fill will only be simulated. + * @return Amount of fluid that was accepted by the tank. + */ + int fill(FluidStack resource, boolean doFill); + + /** + * + * @param maxDrain + * Maximum amount of fluid to be removed from the container. + * @param doFill + * If false, the fill will only be simulated. + * @return Amount of fluid that was removed from the tank. + */ + FluidStack drain(int maxDrain, boolean doDrain); + +} diff --git a/common/net/minecraftforge/fluids/ItemFluidContainer.java b/common/net/minecraftforge/fluids/ItemFluidContainer.java new file mode 100644 index 000000000..5503cf423 --- /dev/null +++ b/common/net/minecraftforge/fluids/ItemFluidContainer.java @@ -0,0 +1,132 @@ + +package net.minecraftforge.fluids; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +/** + * Reference implementation of {@link IFluidContainerItem}. Use/extend this or implement your own. + * + * @author King Lemming + * + */ +public class ItemFluidContainer extends Item implements IFluidContainerItem { + + protected int capacity; + + public ItemFluidContainer(int itemID) { + + super(itemID); + } + + public ItemFluidContainer(int itemID, int capacity) { + + super(itemID); + this.capacity = capacity; + } + + public ItemFluidContainer setCapacity(int capacity) { + + this.capacity = capacity; + return this; + } + + /* IFluidContainerItem */ + @Override + public FluidStack getFluid(ItemStack container) { + + if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Fluid")) { + return null; + } + return FluidStack.loadFluidStackFromNBT(container.stackTagCompound.getCompoundTag("Fluid")); + } + + @Override + public int getCapacity(ItemStack container) { + + return capacity; + } + + @Override + public int fill(ItemStack container, FluidStack resource, boolean doFill) { + + if (resource == null) { + return 0; + } + if (!doFill) { + if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Fluid")) { + return Math.min(capacity, resource.amount); + } + FluidStack stack = FluidStack.loadFluidStackFromNBT(container.stackTagCompound.getCompoundTag("Fluid")); + + if (stack == null) { + return Math.min(capacity, resource.amount); + } + if (!stack.isFluidEqual(resource)) { + return 0; + } + return Math.min(capacity - stack.amount, resource.amount); + } + if (container.stackTagCompound == null) { + container.stackTagCompound = new NBTTagCompound(); + } + if (!container.stackTagCompound.hasKey("Fluid")) { + NBTTagCompound fluidTag = resource.writeToNBT(new NBTTagCompound()); + + if (capacity < resource.amount) { + fluidTag.setInteger("Amount", capacity); + container.stackTagCompound.setTag("Fluid", fluidTag); + return capacity; + } + container.stackTagCompound.setTag("Fluid", fluidTag); + return resource.amount; + } + NBTTagCompound fluidTag = container.stackTagCompound.getCompoundTag("Fluid"); + FluidStack stack = FluidStack.loadFluidStackFromNBT(fluidTag); + + if (!stack.isFluidEqual(resource)) { + return 0; + } + int filled = capacity - resource.amount; + + if (resource.amount < filled) { + stack.amount += resource.amount; + filled = resource.amount; + } else { + stack.amount = capacity; + } + container.stackTagCompound.setTag("Fluid", stack.writeToNBT(fluidTag)); + return filled; + } + + @Override + public FluidStack drain(ItemStack container, int maxDrain, boolean doDrain) { + + if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Fluid")) { + return null; + } + FluidStack stack = FluidStack.loadFluidStackFromNBT(container.stackTagCompound.getCompoundTag("Fluid")); + + if (stack == null) { + return null; + } + stack.amount = Math.min(stack.amount, maxDrain); + + if (doDrain) { + if (maxDrain >= capacity) { + container.stackTagCompound.removeTag("Fluid"); + + if (container.stackTagCompound.hasNoTags()) { + container.stackTagCompound = null; + } + return stack; + } + NBTTagCompound fluidTag = container.stackTagCompound.getCompoundTag("Fluid"); + fluidTag.setInteger("Amount", fluidTag.getInteger("Amount") - maxDrain); + container.stackTagCompound.setTag("Fluid", fluidTag); + } + return stack; + } + +} diff --git a/common/net/minecraftforge/fluids/RenderBlockFluid.java b/common/net/minecraftforge/fluids/RenderBlockFluid.java new file mode 100644 index 000000000..971d62fbb --- /dev/null +++ b/common/net/minecraftforge/fluids/RenderBlockFluid.java @@ -0,0 +1,290 @@ + +package net.minecraftforge.fluids; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.util.Icon; +import net.minecraft.util.MathHelper; +import net.minecraft.world.IBlockAccess; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; + +/** + * Default renderer for Forge fluid blocks. + * + * @author King Lemming + * + */ +public class RenderBlockFluid implements ISimpleBlockRenderingHandler { + + public static RenderBlockFluid instance = new RenderBlockFluid(); + + static final float LIGHT_Y_NEG = 0.5F; + static final float LIGHT_Y_POS = 1.0F; + static final float LIGHT_XZ_NEG = 0.8F; + static final float LIGHT_XZ_POS = 0.6F; + static final double RENDER_OFFSET = 0.0010000000474974513D; + + public float getFluidHeightAverage(float[] flow) { + + float total = 0; + int count = 0; + + for (int i = 0; i < flow.length; i++) { + if (flow[i] >= 0.875F) { + return flow[i]; + } + if (flow[i] >= 0) { + total += flow[i]; + count++; + } + } + return total / count; + } + + public float getFluidHeightForRender(IBlockAccess world, int x, int y, int z, BlockFluidBase block) { + + if (world.getBlockId(x, y, z) == block.blockID) { + + if (world.getBlockId(x, y - block.densityDir, z) == block.blockID) { + return 1; + } + if (world.getBlockMetadata(x, y, z) == block.getMaxRenderHeightMeta()) { + return 0.875F; + } + } + return !world.getBlockMaterial(x, y, z).isSolid() && world.getBlockId(x, y - block.densityDir, z) == block.blockID ? 1 : block.getQuantaPercentage(world, x, y, z) * 0.875F; + } + + /* ISimpleBlockRenderingHandler */ + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + + } + + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + + if (!(block instanceof BlockFluidBase)) { + return false; + } + Tessellator tessellator = Tessellator.instance; + int color = block.colorMultiplier(world, x, y, z); + float red = (color >> 16 & 255) / 255.0F; + float green = (color >> 8 & 255) / 255.0F; + float blue = (color & 255) / 255.0F; + + BlockFluidBase theFluid = (BlockFluidBase) block; + int bMeta = world.getBlockMetadata(x, y, z); + + boolean renderTop = world.getBlockId(x, y - theFluid.densityDir, z) != theFluid.blockID; + + boolean renderBottom = block.shouldSideBeRendered(world, x, y + theFluid.densityDir, z, 0) && world.getBlockId(x, y + theFluid.densityDir, z) != theFluid.blockID; + + boolean[] renderSides = new boolean[] { block.shouldSideBeRendered(world, x, y, z - 1, 2), block.shouldSideBeRendered(world, x, y, z + 1, 3), + block.shouldSideBeRendered(world, x - 1, y, z, 4), block.shouldSideBeRendered(world, x + 1, y, z, 5) }; + + if (!renderTop && !renderBottom && !renderSides[0] && !renderSides[1] && !renderSides[2] && !renderSides[3]) { + return false; + } else { + boolean rendered = false; + + double heightNW, heightSW, heightSE, heightNE; + + float flow11 = getFluidHeightForRender(world, x, y, z, theFluid); + + if (flow11 != 1) { + float flow00 = getFluidHeightForRender(world, x - 1, y, z - 1, theFluid); + float flow01 = getFluidHeightForRender(world, x - 1, y, z, theFluid); + float flow02 = getFluidHeightForRender(world, x - 1, y, z + 1, theFluid); + float flow10 = getFluidHeightForRender(world, x, y, z - 1, theFluid); + float flow12 = getFluidHeightForRender(world, x, y, z + 1, theFluid); + float flow20 = getFluidHeightForRender(world, x + 1, y, z - 1, theFluid); + float flow21 = getFluidHeightForRender(world, x + 1, y, z, theFluid); + float flow22 = getFluidHeightForRender(world, x + 1, y, z + 1, theFluid); + + heightNW = getFluidHeightAverage(new float[] { flow00, flow01, flow10, flow11 }); + heightSW = getFluidHeightAverage(new float[] { flow01, flow02, flow12, flow11 }); + heightSE = getFluidHeightAverage(new float[] { flow12, flow21, flow22, flow11 }); + heightNE = getFluidHeightAverage(new float[] { flow10, flow20, flow21, flow11 }); + } else { + heightNW = flow11; + heightSW = flow11; + heightSE = flow11; + heightNE = flow11; + } + + boolean rises = theFluid.densityDir == 1; + + if (renderer.renderAllFaces || renderTop) { + rendered = true; + + Icon iconStill = block.getIcon(1, bMeta); + float flowDir = (float) BlockFluidBase.getFlowDirection(world, x, y, z); + + if (flowDir > -999.0F) { + iconStill = block.getIcon(2, bMeta); + } + heightNW -= RENDER_OFFSET; + heightSW -= RENDER_OFFSET; + heightSE -= RENDER_OFFSET; + heightNE -= RENDER_OFFSET; + + double u1, u2, u3, u4, v1, v2, v3, v4; + + if (flowDir < -999.0F) { + u2 = iconStill.getInterpolatedU(0.0D); + v2 = iconStill.getInterpolatedV(0.0D); + u1 = u2; + v1 = iconStill.getInterpolatedV(16.0D); + u4 = iconStill.getInterpolatedU(16.0D); + v4 = v1; + u3 = u4; + v3 = v2; + } else { + float xFlow = MathHelper.sin(flowDir) * 0.25F; + float zFlow = MathHelper.cos(flowDir) * 0.25F; + u2 = iconStill.getInterpolatedU(8.0F + (-zFlow - xFlow) * 16.0F); + v2 = iconStill.getInterpolatedV(8.0F + (-zFlow + xFlow) * 16.0F); + u1 = iconStill.getInterpolatedU(8.0F + (-zFlow + xFlow) * 16.0F); + v1 = iconStill.getInterpolatedV(8.0F + (zFlow + xFlow) * 16.0F); + u4 = iconStill.getInterpolatedU(8.0F + (zFlow + xFlow) * 16.0F); + v4 = iconStill.getInterpolatedV(8.0F + (zFlow - xFlow) * 16.0F); + u3 = iconStill.getInterpolatedU(8.0F + (zFlow - xFlow) * 16.0F); + v3 = iconStill.getInterpolatedV(8.0F + (-zFlow - xFlow) * 16.0F); + } + tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z)); + tessellator.setColorOpaque_F(LIGHT_Y_POS * red, LIGHT_Y_POS * green, LIGHT_Y_POS * blue); + + if (!rises) { + tessellator.addVertexWithUV(x + 0, y + heightNW, z + 0, u2, v2); + tessellator.addVertexWithUV(x + 0, y + heightSW, z + 1, u1, v1); + tessellator.addVertexWithUV(x + 1, y + heightSE, z + 1, u4, v4); + tessellator.addVertexWithUV(x + 1, y + heightNE, z + 0, u3, v3); + } else { + tessellator.addVertexWithUV(x + 1, y + 1 - heightNE, z + 0, u3, v3); + tessellator.addVertexWithUV(x + 1, y + 1 - heightSE, z + 1, u4, v4); + tessellator.addVertexWithUV(x + 0, y + 1 - heightSW, z + 1, u1, v1); + tessellator.addVertexWithUV(x + 0, y + 1 - heightNW, z + 0, u2, v2); + } + } + + if (renderer.renderAllFaces || renderBottom) { + rendered = true; + + tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y - 1, z)); + + if (!rises) { + tessellator.setColorOpaque_F(LIGHT_Y_NEG, LIGHT_Y_NEG, LIGHT_Y_NEG); + renderer.renderFaceYNeg(block, x, y + RENDER_OFFSET, z, block.getIcon(0, bMeta)); + } else { + tessellator.setColorOpaque_F(LIGHT_Y_POS, LIGHT_Y_POS, LIGHT_Y_POS); + renderer.renderFaceYPos(block, x, y + RENDER_OFFSET, z, block.getIcon(1, bMeta)); + } + } + for (int side = 0; side < 4; ++side) { + int x2 = x; + int z2 = z; + + switch (side) { + case 0: + --z2; + break; + case 1: + ++z2; + break; + case 2: + --x2; + break; + case 3: + ++x2; + break; + } + Icon iconFlow = block.getIcon(side + 2, bMeta); + + if (renderer.renderAllFaces || renderSides[side]) { + rendered = true; + + double ty1; + double tx1; + double ty2; + double tx2; + double tz1; + double tz2; + + if (side == 0) { + ty1 = heightNW; + ty2 = heightNE; + tx1 = x; + tx2 = x + 1; + tz1 = z + RENDER_OFFSET; + tz2 = z + RENDER_OFFSET; + } else if (side == 1) { + ty1 = heightSE; + ty2 = heightSW; + tx1 = x + 1; + tx2 = x; + tz1 = z + 1 - RENDER_OFFSET; + tz2 = z + 1 - RENDER_OFFSET; + } else if (side == 2) { + ty1 = heightSW; + ty2 = heightNW; + tx1 = x + RENDER_OFFSET; + tx2 = x + RENDER_OFFSET; + tz1 = z + 1; + tz2 = z; + } else { + ty1 = heightNE; + ty2 = heightSE; + tx1 = x + 1 - RENDER_OFFSET; + tx2 = x + 1 - RENDER_OFFSET; + tz1 = z; + tz2 = z + 1; + } + float u1Flow = iconFlow.getInterpolatedU(0.0D); + float u2Flow = iconFlow.getInterpolatedU(8.0D); + float v1Flow = iconFlow.getInterpolatedV((1.0D - ty1) * 16.0D * 0.5D); + float v2Flow = iconFlow.getInterpolatedV((1.0D - ty2) * 16.0D * 0.5D); + float v3Flow = iconFlow.getInterpolatedV(8.0D); + tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x2, y, z2)); + float sideLighting = 1.0F; + + if (side < 2) { + sideLighting = LIGHT_XZ_NEG; + } else { + sideLighting = LIGHT_XZ_POS; + } + tessellator.setColorOpaque_F(LIGHT_Y_POS * sideLighting * red, LIGHT_Y_POS * sideLighting * green, LIGHT_Y_POS * sideLighting * blue); + + if (!rises) { + tessellator.addVertexWithUV(tx1, y + ty1, tz1, u1Flow, v1Flow); + tessellator.addVertexWithUV(tx2, y + ty2, tz2, u2Flow, v2Flow); + tessellator.addVertexWithUV(tx2, y + 0, tz2, u2Flow, v3Flow); + tessellator.addVertexWithUV(tx1, y + 0, tz1, u1Flow, v3Flow); + } else { + tessellator.addVertexWithUV(tx1, y + 1 - 0, tz1, u1Flow, v3Flow); + tessellator.addVertexWithUV(tx2, y + 1 - 0, tz2, u2Flow, v3Flow); + tessellator.addVertexWithUV(tx2, y + 1 - ty2, tz2, u2Flow, v2Flow); + tessellator.addVertexWithUV(tx1, y + 1 - ty1, tz1, u1Flow, v1Flow); + } + } + } + renderer.renderMinY = 0; + renderer.renderMaxY = 1; + return rendered; + } + } + + @Override + public boolean shouldRender3DInInventory() { + + return false; + } + + @Override + public int getRenderId() { + + return FluidRegistry.renderIdFluid; + } + +} diff --git a/common/net/minecraftforge/fluids/TileFluidHandler.java b/common/net/minecraftforge/fluids/TileFluidHandler.java new file mode 100644 index 000000000..988c80f66 --- /dev/null +++ b/common/net/minecraftforge/fluids/TileFluidHandler.java @@ -0,0 +1,72 @@ + +package net.minecraftforge.fluids; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.ForgeDirection; + +/** + * Reference Tile Entity implementation of {@link IFluidHandler}. Use/extend this or write your own. + * + * @author King Lemming + * + */ +public class TileFluidHandler extends TileEntity implements IFluidHandler { + + protected FluidTank tank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME); + + @Override + public void readFromNBT(NBTTagCompound tag) { + + super.readFromNBT(tag); + tank.writeToNBT(tag); + } + + @Override + public void writeToNBT(NBTTagCompound tag) { + + super.writeToNBT(tag); + tank.readFromNBT(tag); + } + + /* IFluidHandler */ + @Override + public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { + + return tank.fill(resource, doFill); + } + + @Override + public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { + + if (resource == null || !resource.isFluidEqual(tank.getFluid())) { + return null; + } + return tank.drain(resource.amount, doDrain); + } + + @Override + public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { + + return tank.drain(maxDrain, doDrain); + } + + @Override + public boolean canFill(ForgeDirection from, Fluid fluid) { + + return true; + } + + @Override + public boolean canDrain(ForgeDirection from, Fluid fluid) { + + return true; + } + + @Override + public FluidTankInfo[] getTankInfo(ForgeDirection from) { + + return new FluidTankInfo[] { tank.getInfo() }; + } + +} From 0c308a5f07efc5769e570e9f93a6c331b5af6ac8 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 7 Jun 2013 17:42:41 +0200 Subject: [PATCH 004/146] Added rotation support for all vanilla blocks that can be rotated. --- .../minecraftforge/common/RotationHelper.java | 381 +++++++++++++++++- 1 file changed, 371 insertions(+), 10 deletions(-) diff --git a/common/net/minecraftforge/common/RotationHelper.java b/common/net/minecraftforge/common/RotationHelper.java index daef3f75a..9c306978f 100644 --- a/common/net/minecraftforge/common/RotationHelper.java +++ b/common/net/minecraftforge/common/RotationHelper.java @@ -1,19 +1,82 @@ package net.minecraftforge.common; +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; import net.minecraft.block.Block; +import net.minecraft.block.BlockAnvil; +import net.minecraft.block.BlockBed; +import net.minecraft.block.BlockButton; import net.minecraft.block.BlockChest; +import net.minecraft.block.BlockCocoa; +import net.minecraft.block.BlockComparator; +import net.minecraft.block.BlockDetectorRail; import net.minecraft.block.BlockDispenser; -import net.minecraft.block.BlockDropper; +import net.minecraft.block.BlockDoor; +import net.minecraft.block.BlockEndPortalFrame; +import net.minecraft.block.BlockEnderChest; +import net.minecraft.block.BlockFenceGate; +import net.minecraft.block.BlockFurnace; +import net.minecraft.block.BlockHopper; +import net.minecraft.block.BlockLadder; +import net.minecraft.block.BlockLever; +import net.minecraft.block.BlockLog; +import net.minecraft.block.BlockMushroomCap; import net.minecraft.block.BlockPistonBase; +import net.minecraft.block.BlockPistonExtension; +import net.minecraft.block.BlockPumpkin; +import net.minecraft.block.BlockRail; +import net.minecraft.block.BlockRailPowered; +import net.minecraft.block.BlockRedstoneRepeater; +import net.minecraft.block.BlockSkull; +import net.minecraft.block.BlockStairs; +import net.minecraft.block.BlockTorch; +import net.minecraft.block.BlockTrapDoor; +import net.minecraft.block.BlockTripWireSource; +import net.minecraft.block.BlockVine; import net.minecraft.world.World; + +import java.util.HashMap; +import java.util.Map; + import static net.minecraftforge.common.ForgeDirection.*; public class RotationHelper { + /** + * Some blocks have the same rotation. + * The first of these blocks (sorted by itemID) should be listed as a type. + * Some of the types aren't actual blocks (helper types). + */ + private static enum BlockType { + LOG, + DISPENSER, + BED, + RAIL, + RAIL_POWERED, + RAIL_ASCENDING, + RAIL_CORNER, + TORCH, + STAIR, + CHEST, + SIGNPOST, + DOOR, + LEVER, + BUTTON, + REDSTONE_REPEATER, + TRAPDOOR, + MUSHROOM_CAP, + MUSHROOM_CAP_CORNER, + MUSHROOM_CAP_SIDE, + VINE, + SKULL, + ANVIL + } private static final ForgeDirection[] UP_DOWN_AXES = new ForgeDirection[] { UP, DOWN }; + private static final Map> MAPPINGS = new HashMap>(); + public static ForgeDirection[] getValidVanillaBlockRotations(Block block) { - return block instanceof BlockChest ? UP_DOWN_AXES : VALID_DIRECTIONS; + return (block instanceof BlockBed || block instanceof BlockPumpkin || block instanceof BlockFenceGate || block instanceof BlockEndPortalFrame || block instanceof BlockTripWireSource || block instanceof BlockCocoa || block instanceof BlockRailPowered || block instanceof BlockDetectorRail || block instanceof BlockStairs || block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockFurnace || block instanceof BlockLadder || block.blockID == Block.signWall.blockID || block.blockID == Block.signPost.blockID || block instanceof BlockDoor || block instanceof BlockRail || block instanceof BlockButton || block instanceof BlockRedstoneRepeater || block instanceof BlockComparator || block instanceof BlockTrapDoor || block instanceof BlockMushroomCap || block instanceof BlockVine || block instanceof BlockSkull || block instanceof BlockAnvil) ? UP_DOWN_AXES : VALID_DIRECTIONS; } public static boolean rotateVanillaBlock(Block block, World worldObj, int x, int y, int z, ForgeDirection axis) @@ -23,25 +86,323 @@ public class RotationHelper { return false; } - if (block instanceof BlockChest && (axis == UP || axis == DOWN)) + if (axis == UP || axis == DOWN) { - return rotateBlock(worldObj, x, y, z, axis, 0x7); + if (block instanceof BlockBed || block instanceof BlockPumpkin || block instanceof BlockFenceGate || block instanceof BlockEndPortalFrame || block instanceof BlockTripWireSource || block instanceof BlockCocoa) + { + return rotateBlock(worldObj, x, y, z, axis, 0x3, BlockType.BED); + } + if (block instanceof BlockRail) + { + return rotateBlock(worldObj, x, y, z, axis, 0xF, BlockType.RAIL); + } + if (block instanceof BlockRailPowered || block instanceof BlockDetectorRail) + { + return rotateBlock(worldObj, x, y, z, axis, 0x7, BlockType.RAIL_POWERED); + } + if (block instanceof BlockStairs) + { + return rotateBlock(worldObj, x, y, z, axis, 0x3, BlockType.STAIR); + } + if (block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockFurnace || block instanceof BlockLadder || block.blockID == Block.signWall.blockID) + { + return rotateBlock(worldObj, x, y, z, axis, 0x7, BlockType.CHEST); + } + if (block.blockID == Block.signPost.blockID) + { + return rotateBlock(worldObj, x, y, z, axis, 0xF, BlockType.SIGNPOST); + } + if (block instanceof BlockDoor) + { + return rotateBlock(worldObj, x, y, z, axis, 0x3, BlockType.DOOR); + } + if (block instanceof BlockButton) + { + return rotateBlock(worldObj, x, y, z, axis, 0x7, BlockType.BUTTON); + } + if (block instanceof BlockRedstoneRepeater || block instanceof BlockComparator) + { + return rotateBlock(worldObj, x, y, z, axis, 0x3, BlockType.REDSTONE_REPEATER); + } + if (block instanceof BlockTrapDoor) + { + return rotateBlock(worldObj, x, y, z, axis, 0x3, BlockType.TRAPDOOR); + } + if (block instanceof BlockMushroomCap) + { + return rotateBlock(worldObj, x, y, z, axis, 0xF, BlockType.MUSHROOM_CAP); + } + if (block instanceof BlockVine) + { + return rotateBlock(worldObj, x, y, z, axis, 0xF, BlockType.VINE); + } + if (block instanceof BlockSkull) + { + return rotateBlock(worldObj, x, y, z, axis, 0x7, BlockType.SKULL); + } + if (block instanceof BlockAnvil) + { + return rotateBlock(worldObj, x, y, z, axis, 0x1, BlockType.ANVIL); + } } - if (block instanceof BlockPistonBase || block instanceof BlockDropper || block instanceof BlockDispenser) + + if (block instanceof BlockLog) { - return rotateBlock(worldObj, x, y, z, axis, 0x7); + return rotateBlock(worldObj, x, y, z, axis, 0xC, BlockType.LOG); } + if (block instanceof BlockDispenser || block instanceof BlockPistonBase || block instanceof BlockPistonExtension || block instanceof BlockHopper) + { + return rotateBlock(worldObj, x, y, z, axis, 0x7, BlockType.DISPENSER); + } + if (block instanceof BlockTorch) + { + return rotateBlock(worldObj, x, y, z, axis, 0xF, BlockType.TORCH); + } + if (block instanceof BlockLever) + { + return rotateBlock(worldObj, x, y, z, axis, 0x7, BlockType.LEVER); + } + return false; } - private static boolean rotateBlock(World worldObj, int x, int y, int z, ForgeDirection axis, int mask) + private static boolean rotateBlock(World worldObj, int x, int y, int z, ForgeDirection axis, int mask, BlockType blockType) { int rotMeta = worldObj.getBlockMetadata(x, y, z); + if (blockType == BlockType.DOOR && (rotMeta & 0x8) == 0x8) + { + return false; + } int masked = rotMeta & ~mask; - ForgeDirection orientation = ForgeDirection.getOrientation(rotMeta & mask); - ForgeDirection rotated = orientation.getRotation(axis); - worldObj.setBlockMetadataWithNotify(x,y,z,rotated.ordinal() & mask | masked,3); + int meta = rotateMetadata(axis, blockType, rotMeta & mask); + if (meta == -1) + { + return false; + } + worldObj.setBlockMetadataWithNotify(x, y, z, meta & mask | masked, 3); return true; } + private static int rotateMetadata(ForgeDirection axis, BlockType blockType, int meta) + { + if (blockType == BlockType.RAIL || blockType == BlockType.RAIL_POWERED) + { + if (meta == 0x0 || meta == 0x1) + { + return ~meta & 0x1; + } + if (meta >= 0x2 && meta <= 0x5) + { + blockType = BlockType.RAIL_ASCENDING; + } + if (meta >= 0x6 && meta <= 0x9 && blockType == BlockType.RAIL) + { + blockType = BlockType.RAIL_CORNER; + } + } + if (blockType == BlockType.SIGNPOST) + { + return (axis == UP) ? (meta + 0x4) % 0x10 : (meta + 0xC) % 0x10; + } + if (blockType == BlockType.LEVER && (axis == UP || axis == DOWN)) + { + switch (meta) + { + case 0x5: + return 0x6; + case 0x6: + return 0x5; + case 0x7: + return 0x0; + case 0x0: + return 0x7; + } + } + if (blockType == BlockType.MUSHROOM_CAP) + { + if (meta % 0x2 == 0) + { + blockType = BlockType.MUSHROOM_CAP_SIDE; + } + else + { + blockType = BlockType.MUSHROOM_CAP_CORNER; + } + } + if (blockType == BlockType.VINE) + { + return ((meta << 1) | ((meta & 0x8) >> 3)); + } + + ForgeDirection orientation = metadataToDirection(blockType, meta); + ForgeDirection rotated = orientation.getRotation(axis); + return directionToMetadata(blockType, rotated); + } + + private static ForgeDirection metadataToDirection(BlockType blockType, int meta) + { + if (blockType == BlockType.LEVER) + { + if (meta == 0x6) + { + meta = 0x5; + } + else if (meta == 0x0) + { + meta = 0x7; + } + } + + if (MAPPINGS.containsKey(blockType)) + { + BiMap biMap = MAPPINGS.get(blockType); + if (biMap.containsKey(meta)) + { + return biMap.get(meta); + } + } + + if (blockType == BlockType.TORCH) + { + return ForgeDirection.getOrientation(6 - meta); + } + if (blockType == BlockType.STAIR) + { + return ForgeDirection.getOrientation(5 - meta); + } + if (blockType == BlockType.CHEST || blockType == BlockType.DISPENSER || blockType == BlockType.SKULL) + { + return ForgeDirection.getOrientation(meta); + } + if (blockType == BlockType.BUTTON) + { + return ForgeDirection.getOrientation(6 - meta); + } + if (blockType == BlockType.TRAPDOOR) + { + return ForgeDirection.getOrientation(meta + 2).getOpposite(); + } + + return ForgeDirection.UNKNOWN; + } + + private static int directionToMetadata(BlockType blockType, ForgeDirection direction) + { + if ((blockType == BlockType.LOG || blockType == BlockType.ANVIL) && (direction.offsetX + direction.offsetY + direction.offsetZ) < 0) + { + direction = direction.getOpposite(); + } + + if (MAPPINGS.containsKey(blockType)) + { + BiMap biMap = MAPPINGS.get(blockType).inverse(); + if (biMap.containsKey(direction)) + { + return biMap.get(direction); + } + } + + if (blockType == BlockType.TORCH) + { + if (direction.ordinal() >= 1) + { + return 6 - direction.ordinal(); + } + } + if (blockType == BlockType.STAIR) + { + return 5 - direction.ordinal(); + } + if (blockType == BlockType.CHEST || blockType == BlockType.DISPENSER || blockType == BlockType.SKULL) + { + return direction.ordinal(); + } + if (blockType == BlockType.BUTTON) + { + if (direction.ordinal() >= 2) + { + return 6 - direction.ordinal(); + } + } + if (blockType == BlockType.TRAPDOOR) + { + return direction.getOpposite().ordinal() - 2; + } + + return -1; + } + + static + { + BiMap biMap; + + biMap = HashBiMap.create(3); + biMap.put(0x0, UP); + biMap.put(0x4, EAST); + biMap.put(0x8, SOUTH); + MAPPINGS.put(BlockType.LOG, biMap); + + biMap = HashBiMap.create(4); + biMap.put(0x0, SOUTH); + biMap.put(0x1, WEST); + biMap.put(0x2, NORTH); + biMap.put(0x3, EAST); + MAPPINGS.put(BlockType.BED, biMap); + + biMap = HashBiMap.create(4); + biMap.put(0x2, EAST); + biMap.put(0x3, WEST); + biMap.put(0x4, NORTH); + biMap.put(0x5, SOUTH); + MAPPINGS.put(BlockType.RAIL_ASCENDING, biMap); + + biMap = HashBiMap.create(4); + biMap.put(0x6, WEST); + biMap.put(0x7, NORTH); + biMap.put(0x8, EAST); + biMap.put(0x9, SOUTH); + MAPPINGS.put(BlockType.RAIL_CORNER, biMap); + + biMap = HashBiMap.create(6); + biMap.put(0x1, EAST); + biMap.put(0x2, WEST); + biMap.put(0x3, SOUTH); + biMap.put(0x4, NORTH); + biMap.put(0x5, UP); + biMap.put(0x7, DOWN); + MAPPINGS.put(BlockType.LEVER, biMap); + + biMap = HashBiMap.create(4); + biMap.put(0x0, WEST); + biMap.put(0x1, NORTH); + biMap.put(0x2, EAST); + biMap.put(0x3, SOUTH); + MAPPINGS.put(BlockType.DOOR, biMap); + + biMap = HashBiMap.create(4); + biMap.put(0x0, NORTH); + biMap.put(0x1, EAST); + biMap.put(0x2, SOUTH); + biMap.put(0x3, WEST); + MAPPINGS.put(BlockType.REDSTONE_REPEATER, biMap); + + biMap = HashBiMap.create(4); + biMap.put(0x1, EAST); + biMap.put(0x3, SOUTH); + biMap.put(0x7, NORTH); + biMap.put(0x9, WEST); + MAPPINGS.put(BlockType.MUSHROOM_CAP_CORNER, biMap); + + biMap = HashBiMap.create(4); + biMap.put(0x2, NORTH); + biMap.put(0x4, WEST); + biMap.put(0x6, EAST); + biMap.put(0x8, SOUTH); + MAPPINGS.put(BlockType.MUSHROOM_CAP_SIDE, biMap); + + biMap = HashBiMap.create(2); + biMap.put(0x0, SOUTH); + biMap.put(0x1, EAST); + MAPPINGS.put(BlockType.ANVIL, biMap); + } } From 05b2a19bacf2cd1b5e2f7a740c2758445cc40435 Mon Sep 17 00:00:00 2001 From: Ross Swartz Date: Tue, 11 Jun 2013 23:58:05 -0300 Subject: [PATCH 005/146] Add stone and cobblestone to Ore Dictionary --- common/net/minecraftforge/oredict/OreDictionary.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/net/minecraftforge/oredict/OreDictionary.java b/common/net/minecraftforge/oredict/OreDictionary.java index e3abd058d..53d8d6646 100644 --- a/common/net/minecraftforge/oredict/OreDictionary.java +++ b/common/net/minecraftforge/oredict/OreDictionary.java @@ -56,12 +56,16 @@ public class OreDictionary registerOre("oreRedstone", Block.oreRedstone); registerOre("oreEmerald", Block.oreEmerald); registerOre("oreQuartz", Block.oreNetherQuartz); + registerOre("stone", Block.stone); + registerOre("cobblestone", Block.cobblestone); } // Build our list of items to replace with ore tags Map replacements = new HashMap(); replacements.put(new ItemStack(Block.planks, 1, WILDCARD_VALUE), "plankWood"); replacements.put(new ItemStack(Item.stick), "stickWood"); + replacements.put(new ItemStack(Block.stone), "stone"); + replacements.put(new ItemStack(Block.cobblestone), "cobblestone"); // Register dyes String[] dyes = From b207111c506b8fd4b10eb15a768437a8227dfcae Mon Sep 17 00:00:00 2001 From: Ross Swartz Date: Mon, 17 Jun 2013 19:09:40 -0300 Subject: [PATCH 006/146] Update OreDictionary.java --- common/net/minecraftforge/oredict/OreDictionary.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/net/minecraftforge/oredict/OreDictionary.java b/common/net/minecraftforge/oredict/OreDictionary.java index 53d8d6646..3557e1619 100644 --- a/common/net/minecraftforge/oredict/OreDictionary.java +++ b/common/net/minecraftforge/oredict/OreDictionary.java @@ -106,6 +106,10 @@ public class OreDictionary { new ItemStack(Block.blockLapis), new ItemStack(Item.cookie), + new ItemStack(Block.stoneBrick), + new ItemStack(Block.stoneSingleSlab), + new ItemStack(Block.stairsCobblestone), + new ItemStack(Block.cobblestoneWall) }; List recipes = CraftingManager.getInstance().getRecipeList(); From af2b5eb6f60efbf1e3243ad6585856c245cfb8fa Mon Sep 17 00:00:00 2001 From: James Date: Wed, 19 Jun 2013 15:57:44 -0600 Subject: [PATCH 007/146] Add an InputStream constructor to WavefrontObject It is said that Resource Packs will return InputStreams. And I like putting my models into texture packs which, obviously, give InputStreams rather than URLs. --- .../client/model/obj/WavefrontObject.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/client/net/minecraftforge/client/model/obj/WavefrontObject.java b/client/net/minecraftforge/client/model/obj/WavefrontObject.java index 55603fbbb..d80a1cff5 100644 --- a/client/net/minecraftforge/client/model/obj/WavefrontObject.java +++ b/client/net/minecraftforge/client/model/obj/WavefrontObject.java @@ -49,20 +49,32 @@ public class WavefrontObject implements IModelCustom public WavefrontObject(String fileName, URL resource) throws ModelFormatException { this.fileName = fileName; - loadObjModel(resource); + + try + { + loadObjModel(resource.openStream()); + } + catch (IOException e) + { + throw new ModelFormatException("IO Exception reading model format", e); + } + } + + public WavefrontObject(String filename, InputStream inputStream) throws ModelFormatException + { + this.fileName = filename; + loadObjModel(inputStream); } - private void loadObjModel(URL fileURL) throws ModelFormatException + private void loadObjModel(InputStream inputStream) throws ModelFormatException { BufferedReader reader = null; - InputStream inputStream = null; String currentLine = null; int lineCount = 0; try { - inputStream = fileURL.openStream(); reader = new BufferedReader(new InputStreamReader(inputStream)); while ((currentLine = reader.readLine()) != null) From f5747824eb77512f4526a6e17b5102d24f01ffd6 Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 30 Jun 2013 05:25:53 -0700 Subject: [PATCH 008/146] Update workspace for new library structure. --- eclipse-workspace-dev.zip | Bin 22860 -> 23702 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/eclipse-workspace-dev.zip b/eclipse-workspace-dev.zip index 3567dfea5b91749cf24ee620bc553737474d7e08..23b724dd546add1b818744cd98ea2153d246d892 100644 GIT binary patch delta 4323 zcmb7HcU)6R*G?z_BT`h5CL&;vCK!686PlqDigc-lUIj%6MFf{7TtK7*l_Es~0!mwH zx>V^R9i#~ul;R2qf?r5B-+r#&{(kS9Kjz8IJ!hVoGiRQA&znkcdL8(fA&Q#jBPcc_g38fq4BB(Oql3|yn;`fJpI zG~!9>*$K)451|miKnu#^=j|OJPT`{mc?VQg(iD@aY#|0D^9qP1(fKId064O0iY^CC z?1UU4fTOBhq2G^yW2&4^LYRqT?gDc}1O0Pn4-I@^*(6^kLA}2yEx-X)wSxD-L@*S> zlNrDwy2P%&NGQ46D{2T1tU4oBa+KurMotKO_2rb>)C2SJbt({OmJtMEC&t9t(F5b- z?<}tF;e6Fg{DPy$ReyhU^S!7l9j zd~vir&O0=NJJ*918+XH$IVUIWm^wd%SX&mJW0i9N6x!tN5}i1eErj_?^6X|by1Bwg}L!CyBP=Z3)8GPHdV5Wvfl|lo#%JDGF0AB zeo_wqaxV2vN-B!Y4e>l*x6OJ;)G>3Xw&t_y`!OTT6<$b3;?&Feb<>A)L6^G=;~GZA zb(mVSR60$pO8;0-Ns zw_E#+&Tjtmm4){^I zwmUO;k`rt4_#I0_LV9hqo?mx#F^>{jJLm{=ID~d6qd4%*^Fh(x>e2I8WU$~nr4mM0 zy^ht(n-Yr5zs4CVBgok7n8MtrRO4&^uqP!PJ-Ag0})? zgM)W2vWK2#(#)IP`TXIFkHjtRQ#iuj!1@5;O;Jb0{ACH@yZPyT85`PCDLcxS1o$){$sY)}^v$?;1wcekm7+ zu<80HuA5KF;+8?Ka2rrhxr$L|r8S)v-I)sBBS>mSq`i|z)PR(Z$^wgKFLv;~unh;7 zX%40(_*NEpIPnVvkq|oyN<5q9f9AaF11c=bl9FD5Oh-!U2CrD19DsHz1;@H2Wnb&W?iIIWJaUm zWuUE(O<(kQIet+zqt9U-h+Oip7(_(wej5oIlN7*-75>gK3!N;tqT$DeeQ8th<7)5P zz27>03BBwxK0&|QgtQN?G>=$Z3EhWWe`VXya05v=4HDhDT&-c7@gaxl_Pr{-N!f<;PEaCXBMW51OW=4U-kP^_1+gFgr!hiOEP-J-jwy6lzY)?_H&+i+%ELn zQA!4p-Zp@}8V5j7;37&no#J`2F29lE08mQIjOIi!t~k>>OhXL$SUlz@_{mqTQfqt*+P<*@zU8;^w4Jjd5DCag=JvqNxS zzV+%P_1T&XWJ!9~rU>Ga_H2_n4K=LW1gFb8&mlH@^|uq%RTDakLJ?DYmFSG>n*$*q z;E0WQ#+NurTyTwbrQwhk0h=t7WG8%DGT?$7FmaHrbbc-*n=fu{xCEnHoT&twTCzXz%F4 ze3UfH5v5Z8%SAFY0eaG|Z7e6g9zRs#v%)kS4o&GS9qiV>b!P=AwZtri~dA`>*T$MYp=xFr4owZUJXg^ z-)xt^C#?2tj_DR)Lz7kP)ViF|@ZIK}Fi4tYZjY#KibYX;%Z8E9c2eXloqrK-PhiVI z$K|Rh>U5d9vInP;=j4N=j}~d_;Zgf5{8(qBM|lO)_|3Q#t)R>%>d+{H?V%30Y?5@i zFf;mrnSUy>@1QZor-OlMX6#;-r*#XyImdiq>yjB(7}7=5VZ0_bcCR2dyY}M2b%~t3 zK+I!~=%7MJ-C2+FHElxNWt?3QZ+~mq<67qod0RLQNI4T4Z})j?Zf`4V0c%48PH^0`btqR-8`Ds$ zpRX*3a_~!eR{7G#rb8Kiu%X?8%6$D0|G_K9qaGq|3y3&|H_e3!@!zvTd!n+5Dr~Ym zB76*`{viMogEmon*` zosJ2gXKyv)V`Jv^B(Uquu?Mq3utgQ<3eo%Hnt`tACTvrMDyb&H>ZW&YO&i^23QRg393bo#tT6%E@-fy&VF z*oH^kvCUuD#I-xqBNe{uzUKd}n`MBP0;_D6eQfgnz=1*-?w(=tBl>i*JHcZ#Wf}cG5E}- z(}*O<0j4JCvD22_pnM*;^l9e?o55F}8tEU}2C9v_qg@&B#cy*@nLbR>x8C>c|Ww^aP#Y@-i_?F`IV80&OiDWco;5FJEg4hI?q62l{~UoZbnv${H8PBU*{vN z2)?=EPGF*B7e%9`i29tSCQR1nR&_~OoE^m6Jg^r`!Azf{kv~Rzh-nF?QU)Cs6ZD|_ zkpLIcf%I)1j#Ly>F{UQDQ1Dk5GTQ=DQ_zitJUs>f&DKccD&r}ATGG5^1e!J2NR(q5 z?t*lJN-OCt8omb?|kue2zidYA+ zqsobG2dbFZ`svn!qW}@TVsH#FtoMXC5~^QHY=sOC{|^{ECJ|jXv|+UTNS=v|z^oye zWLBFCU^UYH_3`0afdC-J=pi@&IB%RwnyAaz3Pw3D3YOgeH7lM404NjOUz@c1k6gL} z0bg`7$%WQb9!|+Q3N|$U%JOp|2l$xE(K+JQnQQ`k0ed7DA3f;juU8O=4J1H1Vi1Uz zh%5@gs;K}ID?Q%Hf|%tz#iYCeS~OUBiB+-MUzQ|b|6fODV&6pxm{s5eyv!JWxgwt= z|CxNGEAr5cn<|^^WktsTG@qma`qZGnw*E=rm>wsVl%PKmGX6x^ru=t>s_E_L>MRZ= z?EnM<6RX$kJLG#r!T&E*KYwN&*1Z2G64angWx!L36Ua7Ypu=ZXLjI26&+naoMo?58 zV6YHiLPtr7{C5$|(Ez;FIDte91{h`46#SP6Hd}C04UxT?h@OX$gAuFIea*x3`5&wE BN=X0! delta 3364 zcmZ`*dmz*68{c;`sVavbp z2KO{cEEM&t9t}cpH{b%K&BIp6fQJyA!b2yxI}Z~P6d;870g3|S2zyX&^8+9XiLE^G z<(-D`c3wC`kS8V#LaoJs6bUIIFewTP4X&;dD&br66t?3@vxMEay5b^_ps4D8ksOG- ziC#4UMOXWaEv$kV)%(!G(%iEk>@ZirR&~R&0A1}8Pge>@TCwN?1y{3inGhGq8kKwt zkQR}HKza*maf=)u|o*}1*-KaZvXS`dnF3)4@F;Wp!$eCk;{A8X{*r^~V z+&?s7Fo$lfafAO>qV8|6f4+-R7w#DEJc%kA4>WGa$yaYO$|7}*ZM0QyIRm#Qc>a|V zHPbwr$XUmfAx6gJ?$~BxoFMngL8go0<%qTTwVWwTD>P>^{z&%JX`gXY^G22Rmgn~J7YjVF6AuaWYE{hdk@tkY(R zURTO`xS^v80}T^JMuQW@?zyh?iS>F^!2?-m}8^r3kM`m>PlXYvq{R^Cy6D3`6$8UH+1si({ehV=v&Lc84O zk?&Yj%r9?(w7W{sZ{$)Wh))9E<;Q+-Y|k?I!g(7bdEeQluUDmNSR!>!ZyqcVa8Lb5 zemPbC!nRZP0OJ~1(|+SM-TJA~R#Th&*dT-7+;wfzLOaIN4eSkRU-ZWvt;C~bCp&L% zOxbr?=F{<)tv?OS^=GurV!TwkU20)xk}ROG9xJUqxuvQu4Uq>^RIthBTUL{@^gHo~ zhZ0|oYsc)fz$G0kTR$vT8929?pML9JW!h2sgb}P9Yw-@_#PM?W4Y7$focxid8t>Xu zTYaV-*g{e1mLrp&G*EX6sY*DE6@F^n!bL^@;-$?6KH=Lqi@A1Z9hB;i(#?~l#Lk2t z`SILfdC1k`hKqi*;6OS^#;@nL2qs>g zU+-;(Yr*7BY1AEVkv}2dS1sUX${Z4inXdn5f#3YDz+1zJbb2$dzzvIv5(*w4?1?ma z{a4%C$g7Nny$|zV_KG4A=(HF#-MdtpjOrvs#iw@8u%7y-D|C_Pbtm6yBT&>vp;UMZ zq<1ktuU;{a09^`<3Z<|m7j}=QkEEd)iV-ws9hDW=bUcDHEp#UfeP-y2=BBi6D0*7$ zexx2}k2BE6XP*YsTDGw-6_{9Lhllm03tMZ|90>V&b?gSBm%{qouJg7nhAK-2+@in5 zWES+Es*PpIbQ%(lpEe1-W>@h<<>+~gQe`vLc`>v~uP&*$Yr=3x`>;N#>SspvlJ%uN zzv}E6Ea@G&(|-J~n{h*yt4u2bYRAPs#Sa}o;uj|O;X-FiH2q$cpKE+JFjYg{oXD=e z(VzLT<=h+lA;hf6d|1vFMB%0V3(@z^hGr{typnd%nAwngOLUWuhfK8msFVKl#>>@v z$|7_qvZ;@}kcP%4ZketH&S5!)jD9rX^^L^h^qBIVraF$XaAR@1RE`5@uBhtVY|a=< zYsu$XG(r$^QJ6Wm)?H-vyFYRxh!=su~uSk<^9++CP%#9as9jIXia0!dzDd1A?%{@kusYo`Cc>6z3BBAU&-f6lU)-j z&%K>oXm}T9&{bqMfh{eZx?s?0bFd>lxTfu;ZCchO( zSZ+oAMAEeXNtOfg5s)n9xr2nCr7v$7cwo5$2bb002?+2aT|9p2Svy1~K=7Tg|IbW7 z$7&BQLXCf!0RKxi+sX&E+Jt{EA3+`w&7Cxs=dF#_LAb9Ua-hwf68~y++6DtUt*Iyh zIX;3=!m<}cn|z)Z(>7t>S`!E;f zeG>mptBVw<=JbqznE=0+6@_I+0bko|T&gm5CEWF<9UF=UN5~}*11M37xhE}@GVXfV ze)&Jfp@2u^wu1*waH#;>UjBPfw1^nsKM2iYV;s;bytvVOPF(%3Nd{18tKvz}8hlWFUsH@zb+*;N!ZE zXEDwd1OMFwjaig%1=foWGcc=EEYK6p!( Date: Sun, 30 Jun 2013 05:29:49 -0700 Subject: [PATCH 009/146] Update FML to 16launch branch --- .../client/ModCompatibilityClient.java | 278 ------------------ .../common/IArmorTextureProvider.java | 27 -- fml | 2 +- .../client/audio/SoundPool.java.patch | 53 ---- .../client/gui/RunnableTitleScreen.java.patch | 13 - .../texture/TextureManager.java.patch | 50 ---- .../texture/TextureStitched.java.patch | 45 --- .../util/ChunkCoordinates.java.patch | 17 -- .../util/ThreadDownloadResources.java.patch | 37 --- 9 files changed, 1 insertion(+), 521 deletions(-) delete mode 100644 client/net/minecraftforge/client/ModCompatibilityClient.java delete mode 100644 common/net/minecraftforge/common/IArmorTextureProvider.java delete mode 100644 patches/minecraft/net/minecraft/client/audio/SoundPool.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/gui/RunnableTitleScreen.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/renderer/texture/TextureStitched.java.patch delete mode 100644 patches/minecraft/net/minecraft/util/ChunkCoordinates.java.patch delete mode 100644 patches/minecraft/net/minecraft/util/ThreadDownloadResources.java.patch diff --git a/client/net/minecraftforge/client/ModCompatibilityClient.java b/client/net/minecraftforge/client/ModCompatibilityClient.java deleted file mode 100644 index d3203d6ce..000000000 --- a/client/net/minecraftforge/client/ModCompatibilityClient.java +++ /dev/null @@ -1,278 +0,0 @@ -package net.minecraftforge.client; - -import java.io.File; -import java.io.IOException; -import java.lang.reflect.Field; -import java.util.logging.Level; - -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.common.FMLLog; - -import paulscode.sound.SoundSystemConfig; -import paulscode.sound.codecs.CodecIBXM; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.audio.SoundManager; -import net.minecraft.client.audio.SoundPool; -import net.minecraft.client.audio.SoundPoolEntry; -import net.minecraft.entity.Entity; -import net.minecraft.network.packet.Packet100OpenWindow; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; - -public class ModCompatibilityClient -{ - /** - * Tries to get the class for the specified name, will also try the - * net.minecraft.src package in case we are in MCP - * Returns null if not found. - * - * @param name The class name - * @return The Class, or null if not found - */ - private static Class getClass(String name) - { - try - { - return Class.forName(name); - } - catch (Exception e) - { - try - { - return Class.forName("net.minecraft.src." + name); - } - catch (Exception e2) - { - return null; - } - } - } - - /************************************************************************************************ - * Risugami's AudioMod Compatibility - * http://www.minecraftforum.net/topic/75440- - * - * AudioMod adds a few extra codecs, loads audio from /resources/mods/*, - * introduces the concept of 'cave' sounds, which are determined by if - * the player is underneath a solid block. - * - * It also lowers the interval between background music songs to 6000 - */ - public static SoundPool audioModSoundPoolCave; - - /** - * Populates the sound pools with with sounds from the /resources/mods folder - * And sets the interval between background music to 6000 - * - * @param mngr The SoundManager instance - */ - public static void audioModLoad(SoundManager mngr) - { - audioModSoundPoolCave = new SoundPool(); - audioModLoadModAudio("resources/mod/sound", mngr.soundPoolSounds); - audioModLoadModAudio("resources/mod/streaming", mngr.soundPoolStreaming); - audioModLoadModAudio("resources/mod/music", mngr.soundPoolMusic); - audioModLoadModAudio("resources/mod/cavemusic", audioModSoundPoolCave); - - if (mngr.MUSIC_INTERVAL == 12000) - { - mngr.MUSIC_INTERVAL = 6000; - } - } - - /** - * Walks the given path in the Minecraft app directory and adds audio to the SoundPool - * - * @param path The path to walk - * @param pool The pool to add sound to - */ - private static void audioModLoadModAudio(String path, SoundPool pool) - { - File folder = new File(Minecraft.getMinecraftDir(), path); - - try - { - audioModWalkFolder(folder, folder, pool); - } - catch (IOException ex) - { - FMLLog.log(Level.FINE, ex, "Loading Mod audio failed for folder: %s", path); - ex.printStackTrace(); - } - } - - /** - * Walks the folder path recursively and calls pool.addSound on any file it finds. - * - * @param base The base path for the folder, determines the name when calling addSound - * @param folder The current folder - * @param pool The SoundPool to add the sound to - * @throws IOException - */ - private static void audioModWalkFolder(File base, File folder, SoundPool pool) throws IOException - { - if (folder.exists() || folder.mkdirs()) - { - for (File file : folder.listFiles()) - { - if (!file.getName().startsWith(".")) - { - if (file.isDirectory()) - { - audioModWalkFolder(base, file, pool); - } - else if (file.isFile()) - { - String subpath = file.getPath().substring(base.getPath().length() + 1).replace('\\', '/'); - pool.addSound(subpath, file); - } - } - } - } - } - - /** - * Adds the IBXM codec and associates it with .xm, .s3m, and .mod - */ - public static void audioModAddCodecs() - { - SoundSystemConfig.setCodec("xm", CodecIBXM.class); - SoundSystemConfig.setCodec("s3m", CodecIBXM.class); - SoundSystemConfig.setCodec("mod", CodecIBXM.class); - } - - /** - * If the current player is underground, it picks a random song from the cave sound pool, - * if they are not it returns the passed in entry. - * - * @param soundManager The SoundManager instance - * @param current The currently selected entry - * @return A soundPool entry to be played as the background music - */ - public static SoundPoolEntry audioModPickBackgroundMusic(SoundManager soundManager, SoundPoolEntry current) - { - Minecraft mc = FMLClientHandler.instance().getClient(); - if (mc != null && mc.theWorld != null && audioModSoundPoolCave != null) - { - Entity ent = mc.renderViewEntity; - int x = MathHelper.truncateDoubleToInt(ent.posX); - int y = MathHelper.truncateDoubleToInt(ent.posY); - int z = MathHelper.truncateDoubleToInt(ent.posZ); - return (mc.theWorld.canBlockSeeTheSky(x, y, z) ? current : audioModSoundPoolCave.getRandomSound()); - } - return current; - } - - /*********************************************************************************************************** - * SDK's ModLoaderMP - * http://www.minecraftforum.net/topic/86765- - * - * ModLoaderMP was supposed to be a reliable server side version of ModLoader, however it has - * gotten the reputation of being really slow to update. Never having bugfixes, breaking compatibility - * with the client side ModLoader. - * - * So we have replaced it with our own system called FML (Forge ModLoader) - * it is a stand alone mod, that Forge relies on, and that is open source/community driven. - * https://github.com/cpw/FML - * - * However, for compatibilities sake, we provide the ModLoaderMP's hooks so that the end user - * does not need to make a choice between the two on the client side. - **/ - private static int isMLMPInstalled = -1; - - /** - * Determine if ModLoaderMP is installed by checking for the existence of the BaseModMp class. - * @return True if BaseModMp was installed (indicating the existance of MLMP) - */ - public static boolean isMLMPInstalled() - { - if (isMLMPInstalled == -1) - { - isMLMPInstalled = (getClass("ModLoaderMp") != null ? 1 : 0); - } - return isMLMPInstalled == 1; - } - - /** - * Attempts to spawn a vehicle using ModLoaderMP's vehicle spawn registry, if MLMP is not installed - * it returns the passed in currentEntity - * - * @param type The Type ID of the vehicle - * @param world The current world - * @param x The spawn X position - * @param y The spawn Y position - * @param z The spawn Z position - * @param thrower The entity that spawned the vehicle {possibly null} - * @param currentEntity The current value to return if MLMP is not installed - * @return The new spawned entity - * @throws Exception - */ - public static Object mlmpVehicleSpawn(int type, World world, double x, double y, double z, Entity thrower, Object currentEntity) throws Exception - { - Class mlmp = getClass("ModLoaderMp"); - if (!isMLMPInstalled() || mlmp == null) - { - return currentEntity; - } - - Object entry = mlmp.getDeclaredMethod("handleNetClientHandlerEntities", int.class).invoke(null, type); - if (entry == null) - { - return currentEntity; - } - - Class entityClass = (Class)entry.getClass().getDeclaredField("entityClass").get(entry); - Object ret = (Entity)entityClass.getConstructor(World.class, Double.TYPE, Double.TYPE, Double.TYPE).newInstance(world, x, y, z); - - if (entry.getClass().getDeclaredField("entityHasOwner").getBoolean(entry)) - { - Field owner = entityClass.getField("owner"); - - if (!Entity.class.isAssignableFrom(owner.getType())) - { - throw new Exception(String.format("Entity\'s owner field must be of type Entity, but it is of type %s.", owner.getType())); - } - - if (thrower == null) - { - System.out.println("Received spawn packet for entity with owner, but owner was not found."); - FMLLog.fine("Received spawn packet for entity with owner, but owner was not found."); - } - else - { - if (!owner.getType().isAssignableFrom(thrower.getClass())) - { - throw new Exception(String.format("Tried to assign an entity of type %s to entity owner, which is of type %s.", thrower.getClass(), owner.getType())); - } - - owner.set(ret, thrower); - } - } - return ret; - } - - /** - * Attempts to invoke ModLoaderMp.handleGUI if ModLoaderMP is installed. - * If not, it does nothing - * - * @param pkt The open window packet - */ - public static void mlmpOpenWindow(Packet100OpenWindow pkt) - { - Class mlmp = getClass("ModLoaderMp"); - if (!isMLMPInstalled() || mlmp == null) - { - return; - } - - try - { - mlmp.getDeclaredMethod("handleGUI", Packet100OpenWindow.class).invoke(null, pkt); - } - catch (Exception e) - { - e.printStackTrace(); - } - } -} diff --git a/common/net/minecraftforge/common/IArmorTextureProvider.java b/common/net/minecraftforge/common/IArmorTextureProvider.java deleted file mode 100644 index 4106d170e..000000000 --- a/common/net/minecraftforge/common/IArmorTextureProvider.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This software is provided under the terms of the Minecraft Forge Public - * License v1.0. - */ - -package net.minecraftforge.common; - -import net.minecraft.item.ItemStack; - -/** - * This interface has to be implemented by an instance of ItemArmor. - * It allows for the application of a custom texture file to the player skin - * when the armor is worn. - */ -@Deprecated //See Item.getArmorTexture -public interface IArmorTextureProvider -{ - - /** - * This interface has to return the path to a file that is the same - * format as iron_1.png (or any of the other armor files). It will be - * applied to the player skin when the armor is worn. - */ - public String getArmorTextureFile(ItemStack itemstack); - -} - diff --git a/fml b/fml index 05a854cd2..2766f9a29 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 05a854cd2af53ca822ee8b249b0b3bbe44f94675 +Subproject commit 2766f9a293f3e1da650693991d16a43a089ae65b diff --git a/patches/minecraft/net/minecraft/client/audio/SoundPool.java.patch b/patches/minecraft/net/minecraft/client/audio/SoundPool.java.patch deleted file mode 100644 index 996a89563..000000000 --- a/patches/minecraft/net/minecraft/client/audio/SoundPool.java.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- ../src_base/minecraft/net/minecraft/client/audio/SoundPool.java -+++ ../src_work/minecraft/net/minecraft/client/audio/SoundPool.java -@@ -4,6 +4,7 @@ - import cpw.mods.fml.relauncher.SideOnly; - import java.io.File; - import java.net.MalformedURLException; -+import java.net.URL; - import java.util.ArrayList; - import java.util.HashMap; - import java.util.List; -@@ -36,6 +37,26 @@ - */ - public SoundPoolEntry addSound(String par1Str, File par2File) - { -+ try -+ { -+ return addSound(par1Str, par2File.toURI().toURL()); -+ } -+ catch (MalformedURLException ex) -+ { -+ ex.printStackTrace(); -+ throw new RuntimeException(ex); -+ } -+ } -+ -+ /** -+ * URL version of addSound, as the back-end sound engine has full support for various types of URLs -+ * -+ * @param par1Str The name of the sound to add -+ * @param url The url of the sound resource -+ * @return A SoundPoolEntry for the newly added sound -+ */ -+ public SoundPoolEntry addSound(String par1Str, URL url) -+ { - try - { - String s1 = par1Str; -@@ -56,13 +77,13 @@ - this.nameToSoundPoolEntriesMapping.put(par1Str, new ArrayList()); - } - -- SoundPoolEntry soundpoolentry = new SoundPoolEntry(s1, par2File.toURI().toURL()); -+ SoundPoolEntry soundpoolentry = new SoundPoolEntry(s1, url); - ((List)this.nameToSoundPoolEntriesMapping.get(par1Str)).add(soundpoolentry); - this.allSoundPoolEntries.add(soundpoolentry); - ++this.numberOfSoundPoolEntries; - return soundpoolentry; - } -- catch (MalformedURLException malformedurlexception) -+ catch (Exception malformedurlexception) - { - malformedurlexception.printStackTrace(); - throw new RuntimeException(malformedurlexception); diff --git a/patches/minecraft/net/minecraft/client/gui/RunnableTitleScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/RunnableTitleScreen.java.patch deleted file mode 100644 index 23c473d43..000000000 --- a/patches/minecraft/net/minecraft/client/gui/RunnableTitleScreen.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src_base/minecraft/net/minecraft/client/gui/RunnableTitleScreen.java -+++ ../src_work/minecraft/net/minecraft/client/gui/RunnableTitleScreen.java -@@ -40,6 +40,10 @@ - } - } - } -+ catch (java.io.FileNotFoundException e) -+ { -+ //NomNomNom, Don't print the error when the flag isn't found. -+ } - catch (Throwable throwable) - { - throwable.printStackTrace(); diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch deleted file mode 100644 index cdc1e6649..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- ../src_base/minecraft/net/minecraft/client/renderer/texture/TextureManager.java -+++ ../src_work/minecraft/net/minecraft/client/renderer/texture/TextureManager.java -@@ -66,17 +66,42 @@ - - public List createTexture(String par1Str) - { -+ return createNewTexture(par1Str, par1Str, null); -+ } -+ -+ public List createNewTexture(String textureName, String textureFile, TextureStitched stitched) -+ { -+ String par1Str = textureFile; - ArrayList arraylist = new ArrayList(); - ITexturePack itexturepack = Minecraft.getMinecraft().texturePackList.getSelectedTexturePack(); - - try - { -- BufferedImage bufferedimage = ImageIO.read(itexturepack.getResourceAsStream("/" + par1Str)); -- int i = bufferedimage.getHeight(); -- int j = bufferedimage.getWidth(); -- String s1 = this.getBasename(par1Str); -+ BufferedImage bufferedimage = null; -+ int i = 0; -+ int j = 0; -+ FileNotFoundException fnfe = null; -+ try -+ { -+ bufferedimage = ImageIO.read(itexturepack.getResourceAsStream("/" + textureFile)); -+ i = bufferedimage.getHeight(); -+ j = bufferedimage.getWidth(); -+ } -+ catch (FileNotFoundException e) -+ { -+ fnfe = e; -+ } -+ String s1 = textureName; - -- if (this.hasAnimationTxt(par1Str, itexturepack)) -+ if (stitched != null && stitched.loadTexture(this, itexturepack, textureName, textureFile, bufferedimage, arraylist)) -+ { -+ ; -+ } -+ else if (fnfe != null) -+ { -+ throw fnfe; -+ } -+ else if (this.hasAnimationTxt(par1Str, itexturepack)) - { - int k = j; - int l = j; diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureStitched.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureStitched.java.patch deleted file mode 100644 index 2337b1ecd..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureStitched.java.patch +++ /dev/null @@ -1,45 +0,0 @@ ---- ../src_base/minecraft/net/minecraft/client/renderer/texture/TextureStitched.java -+++ ../src_work/minecraft/net/minecraft/client/renderer/texture/TextureStitched.java -@@ -3,9 +3,13 @@ - import cpw.mods.fml.client.TextureFXManager; - import cpw.mods.fml.relauncher.Side; - import cpw.mods.fml.relauncher.SideOnly; -+ -+import java.awt.image.BufferedImage; - import java.io.BufferedReader; - import java.util.ArrayList; - import java.util.List; -+ -+import net.minecraft.client.texturepacks.ITexturePack; - import net.minecraft.util.Icon; - import net.minecraft.util.Tuple; - -@@ -252,4 +256,28 @@ - t.createAndUploadTexture(); - } - } -+ -+ //=================================================================================================== -+ // Forge Start -+ //=================================================================================================== -+ /** -+ * Called when texture packs are refreshed, from TextureManager.createNewTexture, -+ * allows for finer control over loading the animation lists and verification of the image. -+ * If the return value from this is true, no further loading will be done by vanilla code. -+ * -+ * You need to add all Texture's to the textures argument. At the end of this function at least one -+ * entry should be in that argument, or a error should of been thrown. -+ * -+ * @param manager The invoking manager -+ * @param texturepack Current texture pack -+ * @param name The name of the texture -+ * @param fileName Resource path for this texture -+ * @param image Buffered image of the loaded resource -+ * @param textures ArrayList of element type Texture, split textures should be added to this list for the stitcher to handle. -+ * @return Return true to skip further vanilla texture loading for this texture -+ */ -+ public boolean loadTexture(TextureManager manager, ITexturePack texturepack, String name, String fileName, BufferedImage image, ArrayList textures) -+ { -+ return false; -+ } - } diff --git a/patches/minecraft/net/minecraft/util/ChunkCoordinates.java.patch b/patches/minecraft/net/minecraft/util/ChunkCoordinates.java.patch deleted file mode 100644 index df4f80f89..000000000 --- a/patches/minecraft/net/minecraft/util/ChunkCoordinates.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src_base/minecraft/net/minecraft/util/ChunkCoordinates.java -+++ ../src_work/minecraft/net/minecraft/util/ChunkCoordinates.java -@@ -64,10 +64,10 @@ - */ - public float getDistanceSquared(int par1, int par2, int par3) - { -- int l = this.posX - par1; -- int i1 = this.posY - par2; -- int j1 = this.posZ - par3; -- return (float)(l * l + i1 * i1 + j1 * j1); -+ float l = this.posX - par1; -+ float i1 = this.posY - par2; -+ float j1 = this.posZ - par3; -+ return l * l + i1 * i1 + j1 * j1; - } - - /** diff --git a/patches/minecraft/net/minecraft/util/ThreadDownloadResources.java.patch b/patches/minecraft/net/minecraft/util/ThreadDownloadResources.java.patch deleted file mode 100644 index cf4942a11..000000000 --- a/patches/minecraft/net/minecraft/util/ThreadDownloadResources.java.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- ../src_base/minecraft/net/minecraft/util/ThreadDownloadResources.java -+++ ../src_work/minecraft/net/minecraft/util/ThreadDownloadResources.java -@@ -8,6 +8,8 @@ - import java.io.FileOutputStream; - import java.io.IOException; - import java.net.URL; -+import java.net.URLConnection; -+ - import javax.xml.parsers.DocumentBuilder; - import javax.xml.parsers.DocumentBuilderFactory; - import net.minecraft.client.Minecraft; -@@ -48,7 +50,11 @@ - URL url = new URL("http://s3.amazonaws.com/MinecraftResources/"); - DocumentBuilderFactory documentbuilderfactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder documentbuilder = documentbuilderfactory.newDocumentBuilder(); -- Document document = documentbuilder.parse(url.openStream()); -+ //Add a timeout of 60 seconds to getting the list, MC stalls without sound for some users. -+ URLConnection con = url.openConnection(); -+ con.setConnectTimeout(60000); -+ con.setReadTimeout(60000); -+ Document document = documentbuilder.parse(con.getInputStream()); - NodeList nodelist = document.getElementsByTagName("Contents"); - - for (int i = 0; i < 2; ++i) -@@ -168,7 +174,11 @@ - private void downloadResource(URL par1URL, File par2File, long par3) throws IOException - { - byte[] abyte = new byte[4096]; -- DataInputStream datainputstream = new DataInputStream(par1URL.openStream()); -+ //Add a timeout of 60 seconds to getting the list, MC stalls without sound for some users. -+ URLConnection con = par1URL.openConnection(); -+ con.setConnectTimeout(60000); -+ con.setReadTimeout(60000); -+ DataInputStream datainputstream = new DataInputStream(con.getInputStream()); - DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(par2File)); - boolean flag = false; - From d2144f274b7d806f8ba8294565a37b27d98ad306 Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 30 Jun 2013 05:50:11 -0700 Subject: [PATCH 010/146] Initial patch update to 1.6, Does not compile, need to update references to the old TexturePack system. --- .../client/ForgeHooksClient.java | 41 +--- .../client/GuiControlsScrollPanel.java | 5 +- .../minecraftforge/client/GuiIngameForge.java | 8 +- .../client/event/RenderLivingEvent.java | 18 +- common/forge_at.cfg | 220 +++++++++--------- .../net/minecraftforge/common/FakePlayer.java | 7 +- .../net/minecraftforge/common/ForgeHooks.java | 60 +++-- .../minecraftforge/common/ISpecialArmor.java | 14 +- .../minecraftforge/event/ServerChatEvent.java | 7 +- .../entity/living/EnderTeleportEvent.java | 5 +- .../entity/living/LivingAttackEvent.java | 6 +- .../event/entity/living/LivingDeathEvent.java | 4 +- .../event/entity/living/LivingDropsEvent.java | 4 +- .../event/entity/living/LivingEvent.java | 10 +- .../event/entity/living/LivingFallEvent.java | 4 +- .../event/entity/living/LivingHurtEvent.java | 6 +- .../living/LivingSetAttackTargetEvent.java | 6 +- .../transformers/EventTransformer.java | 3 +- .../net/minecraft/block/Block.java.patch | 31 ++- .../block/BlockBaseRailLogic.java.patch | 12 +- .../minecraft/block/BlockCactus.java.patch | 4 +- .../net/minecraft/block/BlockCocoa.java.patch | 8 +- .../net/minecraft/block/BlockDoor.java.patch | 2 +- .../net/minecraft/block/BlockFire.java.patch | 28 +-- .../minecraft/block/BlockLadder.java.patch | 4 +- .../minecraft/block/BlockLeaves.java.patch | 2 +- .../net/minecraft/block/BlockLog.java.patch | 6 +- .../minecraft/block/BlockMushroom.java.patch | 6 +- .../block/BlockNetherStalk.java.patch | 8 +- .../block/BlockPistonBase.java.patch | 8 +- .../minecraft/block/BlockSapling.java.patch | 2 +- .../net/minecraft/block/BlockVine.java.patch | 6 +- .../net/minecraft/client/Minecraft.java.patch | 28 +-- .../client/audio/SoundManager.java.patch | 99 ++++---- .../client/entity/EntityPlayerSP.java.patch | 10 +- .../client/gui/GuiControls.java.patch | 25 +- .../client/gui/GuiCreateWorld.java.patch | 7 +- .../minecraft/client/gui/GuiIngame.java.patch | 33 ++- .../minecraft/client/gui/GuiSlot.java.patch | 30 +-- .../achievement/GuiAchievements.java.patch | 18 +- .../gui/inventory/GuiContainer.java.patch | 20 +- .../inventory/GuiContainerCreative.java.patch | 46 ++-- .../client/model/ModelBase.java.patch | 2 +- .../client/model/ModelRenderer.java.patch | 8 +- .../multiplayer/NetClientHandler.java.patch | 12 +- .../multiplayer/PlayerControllerMP.java.patch | 12 +- .../client/multiplayer/WorldClient.java.patch | 2 +- .../client/particle/EffectRenderer.java.patch | 20 +- .../particle/EntityDiggingFX.java.patch | 15 +- .../entity/RendererLivingEntity.java.patch | 45 ++++ .../client/renderer/EntityRenderer.java.patch | 82 ++++--- .../client/renderer/ItemRenderer.java.patch | 72 +++--- .../client/renderer/OpenGlHelper.java.patch | 2 +- .../client/renderer/RenderBlocks.java.patch | 24 +- .../client/renderer/RenderGlobal.java.patch | 54 ++--- .../client/renderer/Tessellator.java.patch | 8 +- .../client/renderer/WorldRenderer.java.patch | 18 +- .../renderer/entity/RenderBiped.java.patch | 81 +++++-- .../renderer/entity/RenderItem.java.patch | 64 ++--- .../renderer/entity/RenderLiving.java.patch | 44 ---- .../renderer/entity/RenderManager.java.patch | 18 +- .../renderer/entity/RenderPlayer.java.patch | 109 ++++----- .../renderer/entity/RenderSnowMan.java.patch | 8 +- .../renderer/texture/Stitcher.java.patch | 2 +- .../renderer/texture/TextureMap.java.patch | 109 ++------- .../TileEntityChestRenderer.java.patch | 2 +- .../command/CommandHandler.java.patch | 6 +- .../minecraft/crash/CrashReport.java.patch | 2 +- .../creativetab/CreativeTabs.java.patch | 25 +- .../enchantment/Enchantment.java.patch | 2 +- .../net/minecraft/entity/Entity.java.patch | 59 ++--- .../minecraft/entity/EntityLiving.java.patch | 218 +---------------- .../entity/EntityLivingBase.java.patch | 198 ++++++++++++++++ .../entity/boss/EntityDragon.java.patch | 2 +- .../entity/item/EntityEnderPearl.java.patch | 26 ++- .../entity/item/EntityItem.java.patch | 12 +- .../entity/item/EntityMinecart.java.patch | 40 ++-- .../item/EntityMinecartContainer.java.patch | 6 +- .../item/EntityMinecartEmpty.java.patch | 6 +- .../item/EntityMinecartFurnace.java.patch | 6 +- .../item/EntityMinecartHopper.java.patch | 6 +- .../entity/monster/EntityEnderman.java.patch | 6 +- .../entity/passive/EntityMooshroom.java.patch | 8 +- .../entity/passive/EntityOcelot.java.patch | 2 +- .../entity/passive/EntitySheep.java.patch | 6 +- .../entity/player/EntityPlayer.java.patch | 145 +++++------- .../entity/player/EntityPlayerMP.java.patch | 21 +- .../entity/player/InventoryPlayer.java.patch | 2 +- .../inventory/ContainerRepair.java.patch | 4 +- .../net/minecraft/inventory/Slot.java.patch | 35 ++- .../item/BehaviorDispenseArmor.java.patch | 12 +- .../item/EnumToolMaterial.java.patch | 2 +- .../net/minecraft/item/Item.java.patch | 59 ++--- .../net/minecraft/item/ItemBucket.java.patch | 8 +- .../net/minecraft/item/ItemDye.java.patch | 2 +- .../net/minecraft/item/ItemHoe.java.patch | 11 +- .../item/ItemInWorldManager.java.patch | 10 +- .../net/minecraft/item/ItemShears.java.patch | 12 +- .../net/minecraft/item/ItemStack.java.patch | 23 +- .../net/minecraft/item/ItemTool.java.patch | 12 +- .../item/crafting/CraftingManager.java.patch | 2 +- .../item/crafting/FurnaceRecipes.java.patch | 4 +- .../net/minecraft/nbt/NBTTagList.java.patch | 2 +- .../network/NetServerHandler.java.patch | 56 ++--- .../packet/Packet51MapChunk.java.patch | 14 +- .../Packet52MultiBlockChange.java.patch | 4 +- .../packet/Packet56MapChunks.java.patch | 13 +- .../minecraft/potion/PotionEffect.java.patch | 4 +- .../server/MinecraftServer.java.patch | 26 +-- .../server/gui/StatsComponent.java.patch | 43 ++++ .../integrated/IntegratedServer.java.patch | 2 +- .../management/PlayerInstance.java.patch | 14 +- .../ServerConfigurationManager.java.patch | 16 +- .../tileentity/TileEntityFurnace.java.patch | 2 +- .../village/VillageCollection.java.patch | 13 -- .../minecraft/world/SpawnerAnimals.java.patch | 41 ++-- .../net/minecraft/world/World.java.patch | 122 +++++----- .../minecraft/world/WorldProvider.java.patch | 4 +- .../minecraft/world/WorldServer.java.patch | 20 +- .../world/biome/BiomeDecorator.java.patch | 34 +-- .../minecraft/world/chunk/Chunk.java.patch | 26 +-- .../gen/ChunkProviderGenerate.java.patch | 10 +- .../gen/feature/WorldGenDungeons.java.patch | 35 +-- .../ComponentMineshaftCorridor.java.patch | 2 +- .../ComponentStrongholdLibrary.java.patch | 2 +- .../ComponentVillageStartPiece.java.patch | 4 +- 126 files changed, 1527 insertions(+), 1666 deletions(-) create mode 100644 patches/minecraft/net/minecraft/client/render/entity/RendererLivingEntity.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/renderer/entity/RenderLiving.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch create mode 100644 patches/minecraft/net/minecraft/server/gui/StatsComponent.java.patch diff --git a/client/net/minecraftforge/client/ForgeHooksClient.java b/client/net/minecraftforge/client/ForgeHooksClient.java index 08ed002e8..01b276348 100644 --- a/client/net/minecraftforge/client/ForgeHooksClient.java +++ b/client/net/minecraftforge/client/ForgeHooksClient.java @@ -19,8 +19,8 @@ import net.minecraft.block.Block; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.client.texturepacks.ITexturePack; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; @@ -28,47 +28,34 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.RenderEngine; import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraftforge.client.IItemRenderer.ItemRenderType; import net.minecraftforge.client.event.DrawBlockHighlightEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.client.event.TextureLoadEvent; import net.minecraftforge.client.event.TextureStitchEvent; -import net.minecraftforge.common.IArmorTextureProvider; import net.minecraftforge.common.MinecraftForge; import static net.minecraftforge.client.IItemRenderer.ItemRenderType.*; import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.*; public class ForgeHooksClient { - static RenderEngine engine() + static TextureManager engine() { return FMLClientHandler.instance().getClient().renderEngine; } - @Deprecated //Deprecated in 1.5.1, move to the more detailed one below. - @SuppressWarnings("deprecation") - public static String getArmorTexture(ItemStack armor, String _default) - { - String result = null; - if (armor.getItem() instanceof IArmorTextureProvider) - { - result = ((IArmorTextureProvider)armor.getItem()).getArmorTextureFile(armor); - } - return result != null ? result : _default; - } - - public static String getArmorTexture(Entity entity, ItemStack armor, String _default, int slot, int layer) + public static String getArmorTexture(Entity entity, ItemStack armor, String _default, int slot, int layer, String type) { String result = armor.getItem().getArmorTexture(armor, entity, slot, layer); return result != null ? result : _default; } - public static boolean renderEntityItem(EntityItem entity, ItemStack item, float bobing, float rotation, Random random, RenderEngine engine, RenderBlocks renderBlocks) + public static boolean renderEntityItem(EntityItem entity, ItemStack item, float bobing, float rotation, Random random, TextureManager engine, RenderBlocks renderBlocks) { IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, ENTITY); if (customRenderer == null) @@ -86,7 +73,7 @@ public class ForgeHooksClient } boolean is3D = customRenderer.shouldUseRenderHelper(ENTITY, item, BLOCK_3D); - engine.bindTexture(item.getItemSpriteNumber() == 0 ? "/terrain.png" : "/gui/items.png"); + engine.func_110577_a(item.getItemSpriteNumber() == 0 ? TextureMap.field_110575_b : TextureMap.field_110576_c); Block block = (item.itemID < Block.blocksList.length ? Block.blocksList[item.itemID] : null); if (is3D || (block != null && RenderBlocks.renderItemIn3d(block.getRenderType()))) { @@ -127,7 +114,7 @@ public class ForgeHooksClient return true; } - public static boolean renderInventoryItem(RenderBlocks renderBlocks, RenderEngine engine, ItemStack item, boolean inColor, float zLevel, float x, float y) + public static boolean renderInventoryItem(RenderBlocks renderBlocks, TextureManager engine, ItemStack item, boolean inColor, float zLevel, float x, float y) { IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, INVENTORY); if (customRenderer == null) @@ -135,7 +122,7 @@ public class ForgeHooksClient return false; } - engine.bindTexture(item.getItemSpriteNumber() == 0 ? "/terrain.png" : "/gui/items.png"); + engine.func_110577_a(item.getItemSpriteNumber() == 0 ? TextureMap.field_110575_b : TextureMap.field_110576_c); if (customRenderer.shouldUseRenderHelper(INVENTORY, item, INVENTORY_BLOCK)) { GL11.glPushMatrix(); @@ -182,14 +169,8 @@ public class ForgeHooksClient } return true; } - - @Deprecated - public static void renderEquippedItem(IItemRenderer customRenderer, RenderBlocks renderBlocks, EntityLiving entity, ItemStack item) - { - renderEquippedItem(ItemRenderType.EQUIPPED, customRenderer, renderBlocks, entity, item); - } - public static void renderEquippedItem(ItemRenderType type, IItemRenderer customRenderer, RenderBlocks renderBlocks, EntityLiving entity, ItemStack item) + public static void renderEquippedItem(ItemRenderType type, IItemRenderer customRenderer, RenderBlocks renderBlocks, EntityLivingBase entity, ItemStack item) { if (customRenderer.shouldUseRenderHelper(type, item, EQUIPPED_BLOCK)) { @@ -216,7 +197,7 @@ public class ForgeHooksClient //Optifine Helper Functions u.u, these are here specifically for Optifine //Note: When using Optfine, these methods are invoked using reflection, which //incurs a major performance penalty. - public static void orientBedCamera(Minecraft mc, EntityLiving entity) + public static void orientBedCamera(Minecraft mc, EntityLivingBase entity) { int x = MathHelper.floor_double(entity.posX); int y = MathHelper.floor_double(entity.posY); @@ -285,7 +266,7 @@ public class ForgeHooksClient renderPass = pass; } - public static ModelBiped getArmorModel(EntityLiving entityLiving, ItemStack itemStack, int slotID, ModelBiped _default) + public static ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int slotID, ModelBiped _default) { ModelBiped modelbiped = itemStack.getItem().getArmorModel(entityLiving, itemStack, slotID); return modelbiped == null ? _default : modelbiped; diff --git a/client/net/minecraftforge/client/GuiControlsScrollPanel.java b/client/net/minecraftforge/client/GuiControlsScrollPanel.java index bfdda45a2..bff159ffa 100644 --- a/client/net/minecraftforge/client/GuiControlsScrollPanel.java +++ b/client/net/minecraftforge/client/GuiControlsScrollPanel.java @@ -9,6 +9,7 @@ import net.minecraft.client.gui.GuiControls; import net.minecraft.client.gui.GuiSlot; import net.minecraft.client.settings.KeyBinding; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.EnumChatFormatting; public class GuiControlsScrollPanel extends GuiSlot @@ -60,7 +61,7 @@ public class GuiControlsScrollPanel extends GuiSlot } @Override - protected void drawBackground() {} + protected void func_130003_c() {} @Override public void drawScreen(int mX, int mY, float f) @@ -91,7 +92,7 @@ public class GuiControlsScrollPanel extends GuiSlot boolean flag = _mouseX >= xPosition && _mouseY >= yPosition && _mouseX < xPosition + width && _mouseY < yPosition + height; int k = (flag ? 2 : 1); - mc.renderEngine.bindTexture("/gui/gui.png"); + mc.renderEngine.func_110577_a(TextureMap.field_110576_c); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); controls.drawTexturedModalRect(xPosition, yPosition, 0, 46 + k * 20, width / 2, height); controls.drawTexturedModalRect(xPosition + width / 2, yPosition, 200 - width / 2, 46 + k * 20, width / 2, height); diff --git a/client/net/minecraftforge/client/GuiIngameForge.java b/client/net/minecraftforge/client/GuiIngameForge.java index e8cad6d05..7fafa44c8 100644 --- a/client/net/minecraftforge/client/GuiIngameForge.java +++ b/client/net/minecraftforge/client/GuiIngameForge.java @@ -24,6 +24,8 @@ import net.minecraft.client.multiplayer.NetClientHandler; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.resources.ResourceLocation; import net.minecraft.crash.CallableMinecraftVersion; import net.minecraft.entity.boss.BossStatus; import net.minecraft.entity.player.InventoryPlayer; @@ -112,7 +114,7 @@ public class GuiIngameForge extends GuiIngame GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); zLevel = -90.0F; rand.setSeed((long)(updateCounter * 312871)); - mc.renderEngine.bindTexture("/gui/icons.png"); + mc.renderEngine.func_110577_a(TextureMap.field_110576_c); if (renderCrosshairs) renderCrosshairs(width, height); if (renderBossHealth) renderBossHealth(); @@ -167,7 +169,7 @@ public class GuiIngameForge extends GuiIngame GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - mc.renderEngine.bindTexture("/gui/gui.png"); + mc.renderEngine.func_110577_a("/gui/gui.png"); InventoryPlayer inv = mc.thePlayer.inventory; drawTexturedModalRect(width / 2 - 91, height - 22, 0, 0, 182, 22); @@ -311,7 +313,7 @@ public class GuiIngameForge extends GuiIngame } int health = mc.thePlayer.getHealth(); - int healthLast = mc.thePlayer.prevHealth; + float healthLast = mc.thePlayer.prevHealth; int left = width / 2 - 91; int top = height - 39; diff --git a/client/net/minecraftforge/client/event/RenderLivingEvent.java b/client/net/minecraftforge/client/event/RenderLivingEvent.java index 8f42ed2cd..a0a7a0519 100644 --- a/client/net/minecraftforge/client/event/RenderLivingEvent.java +++ b/client/net/minecraftforge/client/event/RenderLivingEvent.java @@ -1,18 +1,16 @@ package net.minecraftforge.client.event; -import net.minecraft.client.renderer.entity.RenderLiving; -import net.minecraft.client.renderer.entity.RenderPlayer; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.client.render.entity.RendererLivingEntity; +import net.minecraft.entity.EntityLivingBase; import net.minecraftforge.event.Cancelable; import net.minecraftforge.event.Event; public abstract class RenderLivingEvent extends Event { - public final EntityLiving entity; - public final RenderLiving renderer; + public final EntityLivingBase entity; + public final RendererLivingEntity renderer; - public RenderLivingEvent(EntityLiving entity, RenderLiving renderer) + public RenderLivingEvent(EntityLivingBase entity, RendererLivingEntity renderer) { this.entity = entity; this.renderer = renderer; @@ -20,16 +18,16 @@ public abstract class RenderLivingEvent extends Event public abstract static class Specials extends RenderLivingEvent { - public Specials(EntityLiving entity, RenderLiving renderer){ super(entity, renderer); } + public Specials(EntityLivingBase entity, RendererLivingEntity renderer){ super(entity, renderer); } @Cancelable public static class Pre extends Specials { - public Pre(EntityLiving entity, RenderLiving renderer){ super(entity, renderer); } + public Pre(EntityLivingBase entity, RendererLivingEntity renderer){ super(entity, renderer); } } public static class Post extends Specials { - public Post(EntityLiving entity, RenderLiving renderer){ super(entity, renderer); } + public Post(EntityLivingBase entity, RendererLivingEntity renderer){ super(entity, renderer); } } } } diff --git a/common/forge_at.cfg b/common/forge_at.cfg index 6f813d127..b6eb4d812 100644 --- a/common/forge_at.cfg +++ b/common/forge_at.cfg @@ -1,158 +1,162 @@ #Main Forge Access Transformer configuration file # Tessellator -public-f bgd.a #FD:Tessellator/field_78398_a #instance -public bgd.u #FD:Tessellator/field_78409_u #drawMode -public bgd.v #FD:Tessellator/field_78408_v #xOffset -public bgd.w #FD:Tessellator/field_78407_w #yOffset -public bgd.x #FD:Tessellator/field_78417_x #zOffset -public bgd.z #FD:Tessellator/field_78415_z #isDrawing +public-f bfc.a #FD:Tessellator/field_78398_a #instance +public bfc.u #FD:Tessellator/field_78409_u #drawMode +public bfc.v #FD:Tessellator/field_78408_v #xOffset +public bfc.w #FD:Tessellator/field_78407_w #yOffset +public bfc.x #FD:Tessellator/field_78417_x #zOffset +public bfc.z #FD:Tessellator/field_78415_z #isDrawing # ItemPickaxe -public wu.(ILwl;)V #MD:ItemPickaxe/(ILnet/minecraft/src/EnumToolMaterial;) #constructor -public+f wu.c #FD:ItemPickaxe/field_77867_c #blocksEffectiveAgainst +public yh.(ILxx;)V #MD:ItemPickaxe/(ILnet/minecraft/src/EnumToolMaterial;) #constructor +public+f yh.c #FD:ItemPickaxe/field_77867_c #blocksEffectiveAgainst # ItemAxe -public wi.(ILwl;)V #MD:ItemAxe/(ILnet/minecraft/src/EnumToolMaterial;) #constructor -public+f wi.c #FD:ItemAxe/field_77868_c #blocksEffectiveAgainst +public xu.(ILxx;)V #MD:ItemAxe/(ILnet/minecraft/src/EnumToolMaterial;) #constructor +public+f xu.c #FD:ItemAxe/field_77868_c #blocksEffectiveAgainst # ItemSpade -public xf.(ILwl;)V #MD:ItemSpade/(ILnet/minecraft/src/EnumToolMaterial;) #constructor -public+f xf.c #FD:ItemSpade/field_77866_c #blocksEffectiveAgainst +public ys.(ILxx;)V #MD:ItemSpade/(ILnet/minecraft/src/EnumToolMaterial;) #constructor +public+f ys.c #FD:ItemSpade/field_77866_c #blocksEffectiveAgainst # ItemTool -public vr.a #FD:ItemTool/field_77864_a #efficiencyOnProperMaterial -public vr.d #FD:ItemTool/field_77865_bY #damageVsEntity +public xd.a #FD:ItemTool/field_77864_a #efficiencyOnProperMaterial +public xd.d #FD:ItemTool/field_77865_bY #damageVsEntity # EntityEnderman -public rv.d #FD:EntityEnderman/field_70827_d #carriableBlocks +public tc.br #FD:EntityEnderman/field_70827_d #carriableBlocks # RenderEngine -public bge.f(Ljava/lang/String;)I #MD:RenderEngine/func_78341_b #getTexture -public bge.i #FD:RenderEngine/field_94154_l #terrainTextureMap -public bge.j #FD:RenderEngine/field_94155_m #itemTextureMap +# -- MISSING MAPPING public bge.f(Ljava/lang/String;)I #MD:RenderEngine/func_78341_b #getTexture +# -- MISSING MAPPING public bge.i #FD:RenderEngine/field_94154_l #terrainTextureMap +# -- MISSING MAPPING public bge.j #FD:RenderEngine/field_94155_m #itemTextureMap # RenderGlobal -public bfy.h #FD:RenderGlobal/field_72769_h #theWorld -public bfy.i #FD:RenderGlobal/field_72770_i #renderEngine -public bfy.q #FD:RenderGlobal/field_72777_q #mc -public bfy.r #FD:RenderGlobal/field_72776_r #globalRenderBlocks -public bfy.E #FD:RenderGlobal/field_72738_E #damagedBlocks +public bex.k #FD:RenderGlobal/field_72769_h #theWorld +public bex.l #FD:RenderGlobal/field_72770_i #renderEngine +public bex.t #FD:RenderGlobal/field_72777_q #mc +public bex.u #FD:RenderGlobal/field_72776_r #globalRenderBlocks +public bex.H #FD:RenderGlobal/field_72738_E #damagedBlocks # SoundManager -public bkc.a #FD:SoundManager/field_77381_a #sndSystem -public bkc.b #FD:SoundManager/field_77379_b #soundPoolSounds -public bkc.c #FD:SoundManager/field_77380_c #soundPoolStreaming -public bkc.d #FD:SoundManager/field_77377_d #soundPoolMusic +public bla.b #FD:SoundManager/field_77381_a #sndSystem +public bla.d #FD:SoundManager/field_77379_b #soundPoolSounds +public bla.e #FD:SoundManager/field_77380_c #soundPoolStreaming +public bla.f #FD:SoundManager/field_77377_d #soundPoolMusic # EntityMinecart -protected ri.* #FD:EntityMinecart/* # All private -> protected +protected sp.* #FD:EntityMinecart/* # All private -> protected # -- MISSING MAPPING public py.h()Z #MD:EntityMinecart/func_70490_h #isMinecartPowered # Block -public apa.(ILaif;)V #MD:Block/(ILnet/minecraft/src/Material;) #Constructor -public apa.(IILaif;)V #MD:Block/(IILnet/minecraft/src/Material;) #Constructor -public apa.cB #FD:Block/field_72029_cc #blockResistance -public apa.cA #FD:Block/field_71989_cb #blockHardness +public aqr.(ILaju;)V #MD:Block/(ILnet/minecraft/src/Material;) #Constructor +public aqr.(IILaju;)V #MD:Block/(IILnet/minecraft/src/Material;) #Constructor +public aqr.cH #FD:Block/field_72029_cc #blockResistance +public aqr.cG #FD:Block/field_71989_cb #blockHardness # -- MISSING MAPPING public amq.r()Lamq; #MD:Block/func_71912_p #setRequiresSelfNotify -public apa.a(Lape;)Lapa; #MD:Block/func_71884_a #setStepSound -public apa.b(F)Lapa; #MD:Block/func_71894_b #setResistance -public apa.c(F)Lapa; #MD:Block/func_71848_c #setHardness -public apa.k(I)Lapa; #MD:Block/func_71868_h #setLightOpacity -public apa.a(F)Lapa; #MD:Block/func_71900_a #setLightValue -public apa.r()Lapa; #MD:Block/func_71875_q #setBlockUnbreakable -public apa.b(Z)Lapa; #MD:Block/func_71907_b #setTickRandomly -public apa.a(FFFFFF)V #MD:Block/func_71905_a #setBlockBounds +public aqr.a(Laqv;)Laqr; #MD:Block/func_71884_a #setStepSound +public aqr.b(F)Laqr; #MD:Block/func_71894_b #setResistance +public aqr.c(F)Laqr; #MD:Block/func_71848_c #setHardness +public aqr.k(I)Laqr; #MD:Block/func_71868_h #setLightOpacity +public aqr.a(F)Laqr; #MD:Block/func_71900_a #setLightValue +public aqr.r()Laqr; #MD:Block/func_71875_q #setBlockUnbreakable +public aqr.b(Z)Laqr; #MD:Block/func_71907_b #setTickRandomly +public aqr.a(FFFFFF)V #MD:Block/func_71905_a #setBlockBounds # NetServerHandler -public jh.f #FD:NetServerHandler/field_72572_g #playerInAirTime +public jw.f #FD:NetServerHandler/field_72572_g #playerInAirTime # TileEntity -public aqp.k #FD:TileEntity/field_70331_k #worldObj +public ash.k #FD:TileEntity/field_70331_k #worldObj # BlockLeavesBase -public api.d #FD:BlockLeavesBase/field_72131_c #graphicsLevel +public aqz.d #FD:BlockLeavesBase/field_72131_c #graphicsLevel # Item -public wk.(I)V #MD:Item/(I) #Constructor -public wk.e(I)Lwk; #MD:Item/func_77656_e #setMaxDamage -public-f wk.h(Lwm;)Llx; #MD:Item/func_77650_f #getIconIndex -public wk.c(Ljava/lang/String;)Lwk; #MD:Item/func_77631_c #setPotionEffect +public xw.(I)V #MD:Item/(I) #Constructor +public xw.e(I)Lxw; #MD:Item/func_77656_e #setMaxDamage +public-f xw.h(Lxy;)Lmo; #MD:Item/func_77650_f #getIconIndex +public xw.c(Ljava/lang/String;)Lxw; #MD:Item/func_77631_c #setPotionEffect # RailLogic -public alc #CL:BlockBaseRailLogic -public alc.a()I #MD:BlockBaseRailLogic/func_94505_a #getNAdjacentTiles +public amr #CL:BlockBaseRailLogic +public amr.a()I #MD:BlockBaseRailLogic/func_94505_a #getNAdjacentTiles # EntityPlayer -public sq.a(Lrh;)V #MD:EntityPlayer/func_71012_a #joinEntityItemWithWorld -public sq.h()V #MD:EntityPlayer/func_71053_j #closeScreen -public sq.b #FD:EntityPlayer/field_71076_b #sleepTimer +public tz.a(Lso;)V #MD:EntityPlayer/func_71012_a #joinEntityItemWithWorld +public tz.i()V #MD:EntityPlayer/func_71053_j #closeScreen +public tz.b #FD:EntityPlayer/field_71076_b #sleepTimer # EntityPlayerMP -public bdv.a(Lrh;)V #MD:EntityClientPlayerMP/func_71012_a #joinEntityItemWithWorld +public bcu.a(Lso;)V #MD:EntityClientPlayerMP/func_71012_a #joinEntityItemWithWorld # World Gen Chests Related -public lp.* #FD:WeightedRandomChestContent/* #all -public iz.S #FD:WorldServer/field_73069_S #bonusChestContent -public aem.a #FD:StructureMineshaftPieces/field_78818_a #mineshaftChestContents -public afq.i #FD:ComponentScatteredFeatureDesertPyramid/field_74941_i #itemsToGenerateInTemple -public afr.l #FD:ComponentScatteredFeatureJunglePyramid/field_74943_l #junglePyramidsChestContents -public afr.m #FD:ComponentScatteredFeatureJunglePyramid/field_74944_m #junglePyramidsDispenserContents -public agb.a #FD:ComponentStrongholdChestCorridor/field_75003_a #strongholdChestContents -public agf.b #FD:ComponentStrongholdLibrary/field_75007_b #strongholdLibraryChestContents -public agk.c #FD:ComponentStrongholdRoomCrossing/field_75014_c #strongholdCorridorChestContents -public ahl.a #FD:ComponentVillageHouse2/field_74918_a #villageBlacksmithChestContents +public mg.* #FD:WeightedRandomChestContent/* #all +public jo.T #FD:WorldServer/field_73069_S #bonusChestContent +public agb.a #FD:StructureMineshaftPieces/field_78818_a #mineshaftChestContents +public ahf.i #FD:ComponentScatteredFeatureDesertPyramid/field_74941_i #itemsToGenerateInTemple +public ahg.l #FD:ComponentScatteredFeatureJunglePyramid/field_74943_l #junglePyramidsChestContents +public ahg.m #FD:ComponentScatteredFeatureJunglePyramid/field_74944_m #junglePyramidsDispenserContents +public ahq.a #FD:ComponentStrongholdChestCorridor/field_75003_a #strongholdChestContents +public ahu.b #FD:ComponentStrongholdLibrary/field_75007_b #strongholdLibraryChestContents +public ahz.c #FD:ComponentStrongholdRoomCrossing/field_75014_c #strongholdCorridorChestContents +public aja.a #FD:ComponentVillageHouse2/field_74918_a #villageBlacksmithChestContents # AnvilChunkLoader.chunkSaveLocation -public acj.d #FD:AnvilChunkLoader/field_75825_d +public ady.d #FD:AnvilChunkLoader/field_75825_d # ChunkProviderServer.currentChunkLoader -public iy.e #FD:ChunkProviderServer/field_73247_e +public jn.e #FD:ChunkProviderServer/field_73247_e # PlayerManager -public iw.a(IIZ)Lix; #MD:PlayerManager/func_72690_a #getOrCreateChunkWatcher +public jl.a(IIZ)Ljm; #MD:PlayerManager/func_72690_a #getOrCreateChunkWatcher # PlayerInstance -public ix #CL:PlayerInstance +public jm #CL:PlayerInstance # World -public-f aab.A #FD:World/field_72982_D #villageCollectionObj -public aab.G #FD:World/field_72993_I #activeChunkSet +public-f abq.A #FD:World/field_72982_D #villageCollectionObj +public abq.G #FD:World/field_72993_I #activeChunkSet # EntityLiving -public ng.be #FD:EntityLiving/field_70728_aV #experienceValue -public ng.bt #FD:EntityLiving/field_94063_bt #combatTracker -public ng.bp #FD:EntityLiving/field_70715_bh #targetTasks +public oc.b #FD:EntityLiving/field_70728_aV #experienceValue +# -- MISSING MAPPING public ng.bt #FD:EntityLiving/field_94063_bt #combatTracker +public oc.d #FD:EntityLiving/field_70715_bh #targetTasks # GuiFlatPresets -public axm.a(Ljava/lang/String;ILaav;Ljava/util/List;[Laei;)V #MD:GuiFlatPresets/func_82294_a -public axm.a(Ljava/lang/String;ILaav;[Laei;)V #MD:GuiFlatPresets/func_82297_a +public avp.a(Ljava/lang/String;ILack;Ljava/util/List;[Lafx;)V #MD:GuiFlatPresets/func_82294_a +public avp.a(Ljava/lang/String;ILack;[Lafx;)V #MD:GuiFlatPresets/func_82297_a # BiomeGenBase -public aav.*() #MD:BiomeGenBase/* #Everything protected->public +public ack.*() #MD:BiomeGenBase/* #Everything protected->public # MapGenVillage -public-f agz.e #FD:MapGenVillage/field_75055_e #villageSpawnBiomes +public-f aio.e #FD:MapGenVillage/field_75055_e #villageSpawnBiomes # ShapedRecipes -public+f yn.d #FD:ShapedRecipes/field_77574_d #recipeItems -public+f yn.b #FD:ShapedRecipes/field_77576_b #recipeWidth -public+f yn.c #FD:ShapedRecipes/field_77577_c #recipeHeight +public+f aac.d #FD:ShapedRecipes/field_77574_d #recipeItems +public+f aac.b #FD:ShapedRecipes/field_77576_b #recipeWidth +public+f aac.c #FD:ShapedRecipes/field_77577_c #recipeHeight # ShapelessRecipes -public yo.b #FD:ShapelessRecipes/field_77579_b #recipeItems +public aad.b #FD:ShapelessRecipes/field_77579_b #recipeItems # GuiContainer -protected ayl.a(Lul;)V #MD:GuiContainer/func_74192_a #drawSlotInventory +protected awo.a(Lvy;)V #MD:GuiContainer/func_74192_a #drawSlotInventory # ContainerPlayer -protected tz.h #FD:ContainerPlayer/field_82862_h #player +protected vp.h #FD:ContainerPlayer/field_82862_h #player # BlockButton -protected ali.n(Laab;III)V #MD:BlockButton/func_82535_o #checkActivation -protected-f ali.a #FD:BlockButton/field_82537_a #sensible +protected amx.n(Labq;III)V #MD:BlockButton/func_82535_o #checkActivation +protected-f amx.a #FD:BlockButton/field_82537_a #sensible # BiomeDecorator -public aaz.* #FD:BiomeDecorator/* # All private -> protected +public aco.* #FD:BiomeDecorator/* # All private -> protected # CreativeTabs -public-f ve.a #FD:CreativeTabs/field_78032_a # creativeTabArray non-final +public-f wq.a #FD:CreativeTabs/field_78032_a # creativeTabArray non-final # Packet -public ei.a(IZZLjava/lang/Class;)V #MD:Packet/func_73285_a #addIdClassMapping +public ew.a(IZZLjava/lang/Class;)V #MD:Packet/func_73285_a #addIdClassMapping # SaveHandler -public ajt.b()Ljava/io/File; #MD:SaveHandler/func_75765_b +public ali.b()Ljava/io/File; #MD:SaveHandler/func_75765_b # World stuff -public aab.b(Lmp;)V #MD:World/func_72847_b #releaseEntitySkin -public aab.m #FD:World/field_73003_n #prevRainingStrength -public aab.n #FD:World/field_73004_o #rainingStrength -public aab.p #FD:World/field_73017_q #thunderingStrength -public aab.o #FD:World/field_73018_p #prevThunderingStrength +public abq.b(Lnj;)V #MD:World/func_72847_b #releaseEntitySkin +public abq.m #FD:World/field_73003_n #prevRainingStrength +public abq.n #FD:World/field_73004_o #rainingStrength +public abq.p #FD:World/field_73017_q #thunderingStrength +public abq.o #FD:World/field_73018_p #prevThunderingStrength #WorldClient -public bds.b(Lmp;)V #MD:WorldClient/func_72847_b #releaseEntitySkin +public bcr.b(Lnj;)V #MD:WorldClient/func_72847_b #releaseEntitySkin #WorldServer -public iz.b(Lmp;)V #MD:WorldServer/func_72847_b #releaseEntitySkin -public iz.N #FD:WorldServer/field_73068_P #allPlayersSleeping +public jo.b(Lnj;)V #MD:WorldServer/func_72847_b #releaseEntitySkin +public jo.N #FD:WorldServer/field_73068_P #allPlayersSleeping #TextureMap -public bir.a #FD:TextureMap/field_94255_a -public bir.b #FD:TextureMap/field_94253_b -public bir.c #FD:TextureMap/field_94254_c -public bir.d #FD:TextureMap/field_94251_d +public bhw.g #FD:TextureMap/field_94255_a +# -- MISSING MAPPING public bir.b #FD:TextureMap/field_94253_b +public bhw.h #FD:TextureMap/field_94254_c +# -- MISSING MAPPING public bir.d #FD:TextureMap/field_94251_d #Potion -public mk.b(II)Lmk; #MD:Potion/func_76399_b #setIconIndex +public ne.b(II)Lne; #MD:Potion/func_76399_b #setIconIndex #PotionHelper -public xu.m #FD:PotionHelper/field_77927_l #potionRequirements -public xu.n #FD:PotionHelper/field_77928_m #potionAmplifiers +public zj.m #FD:PotionHelper/field_77927_l #potionRequirements +public zj.n #FD:PotionHelper/field_77928_m #potionAmplifiers #PotionEffect -public ml.b #FD:PotionEffect/field_76460_b #duration +public nf.b #FD:PotionEffect/field_76460_b #duration #BlockFluid -protected ane.a #FD:BlockFluid/field_94425_a #theIcon +protected aou.a #FD:BlockFluid/field_94425_a #theIcon #GuiIngame -protected aww.* #FD:GuiIngame/* # All private -> protected -protected aww.*() #MD:GuiIngame/* # All private -> protected +protected auz.* #FD:GuiIngame/* # All private -> protected +protected auz.*() #MD:GuiIngame/* # All private -> protected #ItemStack -default wm.e #FD:ItemStack/field_77991_e # make default access for itemDamage +default xy.f #FD:ItemStack/field_77991_e # make default access for itemDamage +#GuiSlot +protected avw.b(IIII)V #MD:GuiSlot/func_77206_b #overlayBackground +#EntityPlayer +public tz.bu #FD:EntityPlayer/field_71092_bJ #username diff --git a/common/net/minecraftforge/common/FakePlayer.java b/common/net/minecraftforge/common/FakePlayer.java index 2c118f9f8..91b60a33f 100644 --- a/common/net/minecraftforge/common/FakePlayer.java +++ b/common/net/minecraftforge/common/FakePlayer.java @@ -1,6 +1,7 @@ package net.minecraftforge.common; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ChatMessageComponent; import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.World; @@ -9,8 +10,7 @@ public class FakePlayer extends EntityPlayer { public FakePlayer(World world, String name) { - super(world); - this.username = name; + super(world, name); } public void sendChatToPlayer(String s){} @@ -19,4 +19,7 @@ public class FakePlayer extends EntityPlayer { return new ChunkCoordinates(0,0,0); } + + @Override + public void func_110122_a(ChatMessageComponent chatmessagecomponent){} } diff --git a/common/net/minecraftforge/common/ForgeHooks.java b/common/net/minecraftforge/common/ForgeHooks.java index a76c3a911..8fa371847 100644 --- a/common/net/minecraftforge/common/ForgeHooks.java +++ b/common/net/minecraftforge/common/ForgeHooks.java @@ -1,16 +1,14 @@ package net.minecraftforge.common; -import java.util.*; -import java.util.Map.Entry; - -import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.ListMultimap; - -import cpw.mods.fml.common.FMLLog; -import cpw.mods.fml.common.Loader; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -19,6 +17,8 @@ import net.minecraft.item.ItemAxe; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemSpade; import net.minecraft.item.ItemStack; +import net.minecraft.network.NetServerHandler; +import net.minecraft.util.ChatMessageComponent; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumMovingObjectType; import net.minecraft.util.MovingObjectPosition; @@ -26,9 +26,16 @@ import net.minecraft.util.WeightedRandom; import net.minecraft.util.WeightedRandomItem; import net.minecraft.world.World; import net.minecraftforge.event.ForgeEventFactory; +import net.minecraftforge.event.ServerChatEvent; import net.minecraftforge.event.entity.item.ItemTossEvent; -import net.minecraftforge.event.entity.living.*; -import net.minecraftforge.event.entity.living.LivingEvent.*; +import net.minecraftforge.event.entity.living.LivingAttackEvent; +import net.minecraftforge.event.entity.living.LivingDeathEvent; +import net.minecraftforge.event.entity.living.LivingDropsEvent; +import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent; +import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; +import net.minecraftforge.event.entity.living.LivingFallEvent; +import net.minecraftforge.event.entity.living.LivingHurtEvent; +import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent; public class ForgeHooks { @@ -307,54 +314,49 @@ public class ForgeHooks //Optifine Helper Functions u.u, these are here specifically for Optifine //Note: When using Optfine, these methods are invoked using reflection, which //incurs a major performance penalty. - public static void onLivingSetAttackTarget(EntityLiving entity, EntityLiving target) + public static void onLivingSetAttackTarget(EntityLivingBase entity, EntityLivingBase target) { MinecraftForge.EVENT_BUS.post(new LivingSetAttackTargetEvent(entity, target)); } - public static boolean onLivingUpdate(EntityLiving entity) + public static boolean onLivingUpdate(EntityLivingBase entity) { return MinecraftForge.EVENT_BUS.post(new LivingUpdateEvent(entity)); } - public static boolean onLivingAttack(EntityLiving entity, DamageSource src, int amount) + public static boolean onLivingAttack(EntityLivingBase entity, DamageSource src, float amount) { return MinecraftForge.EVENT_BUS.post(new LivingAttackEvent(entity, src, amount)); } - public static int onLivingHurt(EntityLiving entity, DamageSource src, int amount) + public static float onLivingHurt(EntityLivingBase entity, DamageSource src, float amount) { LivingHurtEvent event = new LivingHurtEvent(entity, src, amount); return (MinecraftForge.EVENT_BUS.post(event) ? 0 : event.ammount); } - public static boolean onLivingDeath(EntityLiving entity, DamageSource src) + public static boolean onLivingDeath(EntityLivingBase entity, DamageSource src) { return MinecraftForge.EVENT_BUS.post(new LivingDeathEvent(entity, src)); } - public static boolean onLivingDrops(EntityLiving entity, DamageSource source, ArrayList drops, int lootingLevel, boolean recentlyHit, int specialDropValue) + public static boolean onLivingDrops(EntityLivingBase entity, DamageSource source, ArrayList drops, int lootingLevel, boolean recentlyHit, int specialDropValue) { return MinecraftForge.EVENT_BUS.post(new LivingDropsEvent(entity, source, drops, lootingLevel, recentlyHit, specialDropValue)); } - public static float onLivingFall(EntityLiving entity, float distance) + public static float onLivingFall(EntityLivingBase entity, float distance) { LivingFallEvent event = new LivingFallEvent(entity, distance); return (MinecraftForge.EVENT_BUS.post(event) ? 0.0f : event.distance); } - public static boolean isLivingOnLadder(Block block, World world, int x, int y, int z, EntityLiving entity) + public static boolean isLivingOnLadder(Block block, World world, int x, int y, int z, EntityLivingBase entity) { return block != null && block.isLadder(world, x, y, z, entity); } - @Deprecated //See above - public static boolean isLivingOnLadder(Block block, World world, int x, int y, int z) - { - return block != null && block.isLadder(world, x, y, z); - } - public static void onLivingJump(EntityLiving entity) + public static void onLivingJump(EntityLivingBase entity) { MinecraftForge.EVENT_BUS.post(new LivingJumpEvent(entity)); } @@ -386,4 +388,14 @@ public class ForgeHooks Block block = Block.blocksList[world.getBlockId(x, y, z)]; return (block == null ? 0 : block.getEnchantPowerBonus(world, x, y, z)); } + + public static ChatMessageComponent onServerChatEvent(NetServerHandler net, String raw, ChatMessageComponent comp) + { + ServerChatEvent event = new ServerChatEvent(net.playerEntity, raw, comp); + if (MinecraftForge.EVENT_BUS.post(event)) + { + return null; + } + return event.component; + } } diff --git a/common/net/minecraftforge/common/ISpecialArmor.java b/common/net/minecraftforge/common/ISpecialArmor.java index 3ae2d6ac9..dc3c9aa36 100644 --- a/common/net/minecraftforge/common/ISpecialArmor.java +++ b/common/net/minecraftforge/common/ISpecialArmor.java @@ -9,7 +9,7 @@ import java.util.ArrayList; import java.util.Arrays; import net.minecraft.util.DamageSource; -import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; @@ -39,7 +39,7 @@ public interface ISpecialArmor * @param slot The armor slot the item is in. * @return A ArmorProperties instance holding information about how the armor effects damage. */ - public ArmorProperties getProperties(EntityLiving player, ItemStack armor, DamageSource source, double damage, int slot); + public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot); /** * Get the displayed effective armor. @@ -63,7 +63,7 @@ public interface ISpecialArmor * @param damage The amount of damage being applied to the armor * @param slot The armor slot the item is in. */ - public abstract void damageArmor(EntityLiving entity, ItemStack stack, DamageSource source, int damage, int slot); + public abstract void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot); public static class ArmorProperties implements Comparable { @@ -90,7 +90,7 @@ public interface ISpecialArmor * @param damage The total damage being done * @return The left over damage that has not been absorbed by the armor */ - public static int ApplyArmor(EntityLiving entity, ItemStack[] inventory, DamageSource source, double damage) + public static float ApplyArmor(EntityLivingBase entity, ItemStack[] inventory, DamageSource source, double damage) { if (DEBUG) { @@ -167,13 +167,11 @@ public interface ISpecialArmor } damage -= (damage * ratio); } - damage += entity.carryoverDamage; if (DEBUG) { - System.out.println("Return: " + (int)(damage / 25D) + " " + damage); + System.out.println("Return: " + (int)(damage / 25.0F) + " " + damage); } - entity.carryoverDamage = (int)damage % 25; - return (int)(damage / 25D); + return (float)(damage / 25.0F); } /** diff --git a/common/net/minecraftforge/event/ServerChatEvent.java b/common/net/minecraftforge/event/ServerChatEvent.java index 0d7f6aaf7..efce522ef 100644 --- a/common/net/minecraftforge/event/ServerChatEvent.java +++ b/common/net/minecraftforge/event/ServerChatEvent.java @@ -1,19 +1,20 @@ package net.minecraftforge.event; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.util.ChatMessageComponent; @Cancelable public class ServerChatEvent extends Event { public final String message, username; public final EntityPlayerMP player; - public String line; - public ServerChatEvent(EntityPlayerMP player, String message, String line) + public ChatMessageComponent component; + public ServerChatEvent(EntityPlayerMP player, String message, ChatMessageComponent line) { super(); this.message = message; this.player = player; this.username = player.username; - this.line = line; + this.component = component; } } diff --git a/common/net/minecraftforge/event/entity/living/EnderTeleportEvent.java b/common/net/minecraftforge/event/entity/living/EnderTeleportEvent.java index b556e7546..b90725e0d 100644 --- a/common/net/minecraftforge/event/entity/living/EnderTeleportEvent.java +++ b/common/net/minecraftforge/event/entity/living/EnderTeleportEvent.java @@ -1,6 +1,7 @@ package net.minecraftforge.event.entity.living; import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; import net.minecraftforge.event.Cancelable; import net.minecraftforge.event.Event; @@ -16,9 +17,9 @@ public class EnderTeleportEvent extends LivingEvent public double targetX; public double targetY; public double targetZ; - public int attackDamage; + public float attackDamage; - public EnderTeleportEvent(EntityLiving entity, double targetX, double targetY, double targetZ, int attackDamage) + public EnderTeleportEvent(EntityLivingBase entity, double targetX, double targetY, double targetZ, float attackDamage) { super(entity); this.targetX = targetX; diff --git a/common/net/minecraftforge/event/entity/living/LivingAttackEvent.java b/common/net/minecraftforge/event/entity/living/LivingAttackEvent.java index e8ddbce35..2b1567b32 100644 --- a/common/net/minecraftforge/event/entity/living/LivingAttackEvent.java +++ b/common/net/minecraftforge/event/entity/living/LivingAttackEvent.java @@ -1,15 +1,15 @@ package net.minecraftforge.event.entity.living; import net.minecraft.util.DamageSource; -import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; import net.minecraftforge.event.Cancelable; @Cancelable public class LivingAttackEvent extends LivingEvent { public final DamageSource source; - public final int ammount; - public LivingAttackEvent(EntityLiving entity, DamageSource source, int ammount) + public final float ammount; + public LivingAttackEvent(EntityLivingBase entity, DamageSource source, float ammount) { super(entity); this.source = source; diff --git a/common/net/minecraftforge/event/entity/living/LivingDeathEvent.java b/common/net/minecraftforge/event/entity/living/LivingDeathEvent.java index ad7899347..709380c46 100644 --- a/common/net/minecraftforge/event/entity/living/LivingDeathEvent.java +++ b/common/net/minecraftforge/event/entity/living/LivingDeathEvent.java @@ -1,14 +1,14 @@ package net.minecraftforge.event.entity.living; import net.minecraft.util.DamageSource; -import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; import net.minecraftforge.event.Cancelable; @Cancelable public class LivingDeathEvent extends LivingEvent { public final DamageSource source; - public LivingDeathEvent(EntityLiving entity, DamageSource source) + public LivingDeathEvent(EntityLivingBase entity, DamageSource source) { super(entity); this.source = source; diff --git a/common/net/minecraftforge/event/entity/living/LivingDropsEvent.java b/common/net/minecraftforge/event/entity/living/LivingDropsEvent.java index 445501df0..0de2175e3 100644 --- a/common/net/minecraftforge/event/entity/living/LivingDropsEvent.java +++ b/common/net/minecraftforge/event/entity/living/LivingDropsEvent.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import net.minecraft.util.DamageSource; import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; import net.minecraftforge.event.Cancelable; @Cancelable @@ -16,7 +16,7 @@ public class LivingDropsEvent extends LivingEvent public final boolean recentlyHit; public final int specialDropValue; - public LivingDropsEvent(EntityLiving entity, DamageSource source, ArrayList drops, int lootingLevel, boolean recentlyHit, int specialDropValue) + public LivingDropsEvent(EntityLivingBase entity, DamageSource source, ArrayList drops, int lootingLevel, boolean recentlyHit, int specialDropValue) { super(entity); this.source = source; diff --git a/common/net/minecraftforge/event/entity/living/LivingEvent.java b/common/net/minecraftforge/event/entity/living/LivingEvent.java index a3f6519d8..971cd0642 100644 --- a/common/net/minecraftforge/event/entity/living/LivingEvent.java +++ b/common/net/minecraftforge/event/entity/living/LivingEvent.java @@ -1,13 +1,13 @@ package net.minecraftforge.event.entity.living; -import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; import net.minecraftforge.event.Cancelable; import net.minecraftforge.event.entity.EntityEvent; public class LivingEvent extends EntityEvent { - public final EntityLiving entityLiving; - public LivingEvent(EntityLiving entity) + public final EntityLivingBase entityLiving; + public LivingEvent(EntityLivingBase entity) { super(entity); entityLiving = entity; @@ -16,11 +16,11 @@ public class LivingEvent extends EntityEvent @Cancelable public static class LivingUpdateEvent extends LivingEvent { - public LivingUpdateEvent(EntityLiving e){ super(e); } + public LivingUpdateEvent(EntityLivingBase e){ super(e); } } public static class LivingJumpEvent extends LivingEvent { - public LivingJumpEvent(EntityLiving e){ super(e); } + public LivingJumpEvent(EntityLivingBase e){ super(e); } } } diff --git a/common/net/minecraftforge/event/entity/living/LivingFallEvent.java b/common/net/minecraftforge/event/entity/living/LivingFallEvent.java index 64363198a..4c32b7acf 100644 --- a/common/net/minecraftforge/event/entity/living/LivingFallEvent.java +++ b/common/net/minecraftforge/event/entity/living/LivingFallEvent.java @@ -1,13 +1,13 @@ package net.minecraftforge.event.entity.living; -import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; import net.minecraftforge.event.Cancelable; @Cancelable public class LivingFallEvent extends LivingEvent { public float distance; - public LivingFallEvent(EntityLiving entity, float distance) + public LivingFallEvent(EntityLivingBase entity, float distance) { super(entity); this.distance = distance; diff --git a/common/net/minecraftforge/event/entity/living/LivingHurtEvent.java b/common/net/minecraftforge/event/entity/living/LivingHurtEvent.java index 7afcaea1c..243723115 100644 --- a/common/net/minecraftforge/event/entity/living/LivingHurtEvent.java +++ b/common/net/minecraftforge/event/entity/living/LivingHurtEvent.java @@ -1,15 +1,15 @@ package net.minecraftforge.event.entity.living; import net.minecraft.util.DamageSource; -import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; import net.minecraftforge.event.Cancelable; @Cancelable public class LivingHurtEvent extends LivingEvent { public final DamageSource source; - public int ammount; - public LivingHurtEvent(EntityLiving entity, DamageSource source, int ammount) + public float ammount; + public LivingHurtEvent(EntityLivingBase entity, DamageSource source, float ammount) { super(entity); this.source = source; diff --git a/common/net/minecraftforge/event/entity/living/LivingSetAttackTargetEvent.java b/common/net/minecraftforge/event/entity/living/LivingSetAttackTargetEvent.java index 6a5b734ad..efff5ec2f 100644 --- a/common/net/minecraftforge/event/entity/living/LivingSetAttackTargetEvent.java +++ b/common/net/minecraftforge/event/entity/living/LivingSetAttackTargetEvent.java @@ -1,12 +1,12 @@ package net.minecraftforge.event.entity.living; -import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; public class LivingSetAttackTargetEvent extends LivingEvent { - public final EntityLiving target; - public LivingSetAttackTargetEvent(EntityLiving entity, EntityLiving target) + public final EntityLivingBase target; + public LivingSetAttackTargetEvent(EntityLivingBase entity, EntityLivingBase target) { super(entity); this.target = target; diff --git a/common/net/minecraftforge/transformers/EventTransformer.java b/common/net/minecraftforge/transformers/EventTransformer.java index 149f30df2..d3f8b34b1 100644 --- a/common/net/minecraftforge/transformers/EventTransformer.java +++ b/common/net/minecraftforge/transformers/EventTransformer.java @@ -2,6 +2,7 @@ package net.minecraftforge.transformers; import java.util.List; +import net.minecraft.launchwrapper.IClassTransformer; import net.minecraftforge.event.Event; import net.minecraftforge.event.ListenerList; @@ -11,8 +12,6 @@ import static org.objectweb.asm.Opcodes.*; import static org.objectweb.asm.Type.*; import static org.objectweb.asm.ClassWriter.*; -import cpw.mods.fml.relauncher.IClassTransformer; - public class EventTransformer implements IClassTransformer { public EventTransformer() diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index c1ca758f5..d0bc2d742 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -18,7 +18,7 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; - import net.minecraft.entity.EntityLiving; + import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityXPOrb; @@ -54,7 +54,7 @@ /** * used as foreach item, if item.tab = current tab, display it on the screen */ -@@ -454,9 +471,10 @@ +@@ -460,9 +477,10 @@ return this.needsRandomTick; } @@ -66,7 +66,7 @@ } /** -@@ -479,7 +497,7 @@ +@@ -485,7 +503,7 @@ */ public float getBlockBrightness(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { @@ -75,7 +75,7 @@ } @SideOnly(Side.CLIENT) -@@ -489,7 +507,7 @@ +@@ -495,7 +513,7 @@ */ public int getMixedBrightnessForBlock(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { @@ -84,7 +84,7 @@ } @SideOnly(Side.CLIENT) -@@ -639,7 +657,13 @@ +@@ -645,7 +663,13 @@ /** * ejects contained items into the world, and notifies neighbours of an update, as appropriate */ @@ -99,7 +99,7 @@ /** * Returns the quantity of items to drop on block destruction. -@@ -664,7 +688,7 @@ +@@ -670,7 +694,7 @@ public float getPlayerRelativeBlockHardness(EntityPlayer par1EntityPlayer, World par2World, int par3, int par4, int par5) { float f = this.getBlockHardness(par2World, par3, par4, par5); @@ -108,7 +108,7 @@ } /** -@@ -682,18 +706,13 @@ +@@ -688,18 +712,13 @@ { if (!par1World.isRemote) { @@ -131,7 +131,7 @@ } } } -@@ -926,7 +945,8 @@ +@@ -932,7 +951,8 @@ public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) { int l = par1World.getBlockId(par2, par3, par4); @@ -141,7 +141,7 @@ } /** -@@ -1086,7 +1106,7 @@ +@@ -1092,7 +1112,7 @@ par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); par2EntityPlayer.addExhaustion(0.025F); @@ -150,7 +150,7 @@ { ItemStack itemstack = this.createStackedBlock(par6); -@@ -1102,12 +1122,13 @@ +@@ -1108,12 +1128,13 @@ } } @@ -165,7 +165,7 @@ } /** -@@ -1443,4 +1464,950 @@ +@@ -1453,4 +1474,945 @@ canBlockGrass[0] = true; StatList.initBreakableStats(); } @@ -200,12 +200,7 @@ + * @param entity The entity trying to use the ladder, CAN be null. + * @return True if the block should act like a ladder + */ -+ public boolean isLadder(World world, int x, int y, int z, EntityLiving entity) -+ { -+ return isLadder(world, x, y, z); -+ } -+ @Deprecated //See EntityLiving sensitive version above -+ public boolean isLadder(World world, int x, int y, int z) ++ public boolean isLadder(World world, int x, int y, int z, EntityLivingBase entity) + { + return false; + } @@ -575,7 +570,7 @@ + * @param player The player or camera entity, null in some cases. + * @return True to treat this as a bed + */ -+ public boolean isBed(World world, int x, int y, int z, EntityLiving player) ++ public boolean isBed(World world, int x, int y, int z, EntityLivingBase player) + { + return blockID == Block.bed.blockID; + } diff --git a/patches/minecraft/net/minecraft/block/BlockBaseRailLogic.java.patch b/patches/minecraft/net/minecraft/block/BlockBaseRailLogic.java.patch index 1d35f6eb3..47b610cc1 100644 --- a/patches/minecraft/net/minecraft/block/BlockBaseRailLogic.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockBaseRailLogic.java.patch @@ -8,12 +8,12 @@ + final BlockRailBase theRail; - public BlockBaseRailLogic(BlockRailBase par1, World par2, int par3, int par4, int par5) + public BlockBaseRailLogic(BlockRailBase par1BlockRailBase, World par2World, int par3, int par4, int par5) @@ -27,17 +29,11 @@ this.railY = par4; this.railZ = par5; - int l = par2.getBlockId(par3, par4, par5); -- int i1 = par2.getBlockMetadata(par3, par4, par5); + int l = par2World.getBlockId(par3, par4, par5); +- int i1 = par2World.getBlockMetadata(par3, par4, par5); - - if (((BlockRailBase)Block.blocksList[l]).isPowered) - { @@ -26,9 +26,9 @@ - } + + BlockRailBase target = (BlockRailBase)Block.blocksList[l]; -+ int i1 = target.getBasicRailMetadata(par2, null, par3, par4, par5); -+ isStraightRail = !target.isFlexibleRail(par2, par3, par4, par5); -+ canMakeSlopes = target.canMakeSlopes(par2, par3, par4, par5); ++ int i1 = target.getBasicRailMetadata(par2World, null, par3, par4, par5); ++ isStraightRail = !target.isFlexibleRail(par2World, par3, par4, par5); ++ canMakeSlopes = target.canMakeSlopes(par2World, par3, par4, par5); this.setBasicRail(i1); } diff --git a/patches/minecraft/net/minecraft/block/BlockCactus.java.patch b/patches/minecraft/net/minecraft/block/BlockCactus.java.patch index 796e19d2a..73060e10f 100644 --- a/patches/minecraft/net/minecraft/block/BlockCactus.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockCactus.java.patch @@ -23,8 +23,8 @@ } @@ -182,4 +186,22 @@ - this.cactusTopIcon = par1IconRegister.registerIcon("cactus_top"); - this.cactusBottomIcon = par1IconRegister.registerIcon("cactus_bottom"); + this.cactusTopIcon = par1IconRegister.registerIcon(this.func_111023_E() + "_top"); + this.cactusBottomIcon = par1IconRegister.registerIcon(this.func_111023_E() + "_bottom"); } + + @Override diff --git a/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch b/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch index 17513fe7d..a1587d8dc 100644 --- a/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch @@ -9,7 +9,7 @@ import java.util.Random; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; -@@ -202,7 +204,14 @@ +@@ -201,7 +203,14 @@ */ public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) { @@ -25,7 +25,7 @@ byte b0 = 1; if (j1 >= 2) -@@ -212,8 +221,9 @@ +@@ -211,8 +220,9 @@ for (int k1 = 0; k1 < b0; ++k1) { @@ -37,8 +37,8 @@ } @SideOnly(Side.CLIENT) -@@ -249,4 +259,10 @@ - this.iconArray[i] = par1IconRegister.registerIcon(cocoaIcons[i]); +@@ -248,4 +258,10 @@ + this.iconArray[i] = par1IconRegister.registerIcon(this.func_111023_E() + "_stage_" + i); } } + diff --git a/patches/minecraft/net/minecraft/block/BlockDoor.java.patch b/patches/minecraft/net/minecraft/block/BlockDoor.java.patch index 6e354d3c4..8c2b8006e 100644 --- a/patches/minecraft/net/minecraft/block/BlockDoor.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockDoor.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/block/BlockDoor.java +++ ../src_work/minecraft/net/minecraft/block/BlockDoor.java -@@ -303,7 +303,7 @@ +@@ -290,7 +290,7 @@ { if (this.blockMaterial == Material.iron) { diff --git a/patches/minecraft/net/minecraft/block/BlockFire.java.patch b/patches/minecraft/net/minecraft/block/BlockFire.java.patch index 303b28458..dceb641c7 100644 --- a/patches/minecraft/net/minecraft/block/BlockFire.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockFire.java.patch @@ -19,7 +19,7 @@ this.setBurnRate(Block.planks.blockID, 5, 20); this.setBurnRate(Block.woodDoubleSlab.blockID, 5, 20); this.setBurnRate(Block.woodSingleSlab.blockID, 5, 20); -@@ -60,8 +65,7 @@ +@@ -62,8 +67,7 @@ */ private void setBurnRate(int par1, int par2, int par3) { @@ -29,7 +29,7 @@ } /** -@@ -121,12 +125,8 @@ +@@ -123,12 +127,8 @@ { if (par1World.getGameRules().getGameRuleBooleanValue("doFireTick")) { @@ -44,7 +44,7 @@ if (!this.canPlaceBlockAt(par1World, par2, par3, par4)) { -@@ -155,7 +155,7 @@ +@@ -157,7 +157,7 @@ par1World.setBlockToAir(par2, par3, par4); } } @@ -53,7 +53,7 @@ { par1World.setBlockToAir(par2, par3, par4); } -@@ -169,12 +169,12 @@ +@@ -171,12 +171,12 @@ b0 = -50; } @@ -72,7 +72,7 @@ for (int i1 = par2 - 1; i1 <= par2 + 1; ++i1) { -@@ -228,9 +228,20 @@ +@@ -230,9 +230,20 @@ return false; } @@ -94,7 +94,7 @@ if (par6Random.nextInt(par5) < j1) { -@@ -264,7 +275,12 @@ +@@ -266,7 +277,12 @@ */ private boolean canNeighborBurn(World par1World, int par2, int par3, int par4) { @@ -108,7 +108,7 @@ } /** -@@ -280,12 +296,12 @@ +@@ -282,12 +298,12 @@ } else { @@ -127,7 +127,7 @@ return l; } } -@@ -300,21 +316,24 @@ +@@ -302,21 +318,24 @@ /** * Checks the specified block coordinate to see if it can catch fire. Args: blockAccess, x, y, z @@ -157,7 +157,7 @@ } /** -@@ -372,9 +391,9 @@ +@@ -374,9 +393,9 @@ float f1; float f2; @@ -170,7 +170,7 @@ { for (l = 0; l < 2; ++l) { -@@ -385,7 +404,7 @@ +@@ -387,7 +406,7 @@ } } @@ -179,7 +179,7 @@ { for (l = 0; l < 2; ++l) { -@@ -396,7 +415,7 @@ +@@ -398,7 +417,7 @@ } } @@ -188,7 +188,7 @@ { for (l = 0; l < 2; ++l) { -@@ -407,7 +426,7 @@ +@@ -409,7 +428,7 @@ } } @@ -197,7 +197,7 @@ { for (l = 0; l < 2; ++l) { -@@ -418,7 +437,7 @@ +@@ -420,7 +439,7 @@ } } @@ -206,7 +206,7 @@ { for (l = 0; l < 2; ++l) { -@@ -467,4 +486,46 @@ +@@ -469,4 +488,46 @@ { return this.iconArray[0]; } diff --git a/patches/minecraft/net/minecraft/block/BlockLadder.java.patch b/patches/minecraft/net/minecraft/block/BlockLadder.java.patch index 44d1a1c6b..e5ee3915c 100644 --- a/patches/minecraft/net/minecraft/block/BlockLadder.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLadder.java.patch @@ -4,7 +4,7 @@ import java.util.Random; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; -+import net.minecraft.entity.EntityLiving; ++import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -86,7 +86,7 @@ } + + @Override -+ public boolean isLadder(World world, int x, int y, int z, EntityLiving entity) ++ public boolean isLadder(World world, int x, int y, int z, EntityLivingBase entity) + { + return true; + } diff --git a/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch b/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch index 96faee9f8..5c3dc0c10 100644 --- a/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch @@ -19,7 +19,7 @@ +public class BlockLeaves extends BlockLeavesBase implements IShearable { public static final String[] LEAF_TYPES = new String[] {"oak", "spruce", "birch", "jungle"}; - public static final String[][] field_94396_b = new String[][] {{"leaves", "leaves_spruce", "leaves", "leaves_jungle"}, {"leaves_opaque", "leaves_spruce_opaque", "leaves_opaque", "leaves_jungle_opaque"}}; + public static final String[][] field_94396_b = new String[][] {{"leaves_oak", "leaves_spruce", "leaves_birch", "leaves_jungle"}, {"leaves_oak_opaque", "leaves_spruce_opaque", "leaves_birch_opaque", "leaves_jungle_opaque"}}; @@ -107,10 +111,9 @@ { int j2 = par1World.getBlockId(par2 + k1, par3 + l1, par4 + i2); diff --git a/patches/minecraft/net/minecraft/block/BlockLog.java.patch b/patches/minecraft/net/minecraft/block/BlockLog.java.patch index f06fc4db7..4672a0522 100644 --- a/patches/minecraft/net/minecraft/block/BlockLog.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLog.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/block/BlockLog.java +++ ../src_work/minecraft/net/minecraft/block/BlockLog.java -@@ -69,14 +69,9 @@ +@@ -60,14 +60,9 @@ { int j2 = par1World.getBlockId(par2 + k1, par3 + l1, par4 + i2); @@ -17,8 +17,8 @@ } } } -@@ -176,4 +171,16 @@ - this.iconArray[i] = par1IconRegister.registerIcon(treeTextureTypes[i]); +@@ -125,4 +120,16 @@ + this.tree_top[i] = par1IconRegister.registerIcon(this.func_111023_E() + "_" + woodType[i] + "_top"); } } + diff --git a/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch b/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch index 113f9af07..a47d2ff80 100644 --- a/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch @@ -1,7 +1,7 @@ --- ../src_base/minecraft/net/minecraft/block/BlockMushroom.java +++ ../src_work/minecraft/net/minecraft/block/BlockMushroom.java -@@ -6,6 +6,8 @@ - import net.minecraft.client.renderer.texture.IconRegister; +@@ -3,6 +3,8 @@ + import java.util.Random; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenBigMushroom; + @@ -9,7 +9,7 @@ public class BlockMushroom extends BlockFlower { -@@ -102,7 +104,9 @@ +@@ -96,7 +98,9 @@ if (par3 >= 0 && par3 < 256) { int l = par1World.getBlockId(par2, par3 - 1, par4); diff --git a/patches/minecraft/net/minecraft/block/BlockNetherStalk.java.patch b/patches/minecraft/net/minecraft/block/BlockNetherStalk.java.patch index edc095cf5..e19096e34 100644 --- a/patches/minecraft/net/minecraft/block/BlockNetherStalk.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockNetherStalk.java.patch @@ -17,7 +17,7 @@ public class BlockNetherStalk extends BlockFlower { -@@ -39,7 +42,8 @@ +@@ -38,7 +41,8 @@ */ public boolean canBlockStay(World par1World, int par2, int par3, int par4) { @@ -27,7 +27,7 @@ } /** -@@ -81,25 +85,7 @@ +@@ -80,25 +84,7 @@ */ public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) { @@ -54,8 +54,8 @@ } /** -@@ -143,4 +129,23 @@ - this.iconArray[i] = par1IconRegister.registerIcon(field_94373_a[i]); +@@ -142,4 +128,23 @@ + this.iconArray[i] = par1IconRegister.registerIcon(this.func_111023_E() + "_stage_" + i); } } + diff --git a/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch b/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch index 758ab7966..03c3ebcf3 100644 --- a/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/block/BlockPistonBase.java +++ ../src_work/minecraft/net/minecraft/block/BlockPistonBase.java -@@ -437,7 +437,7 @@ +@@ -439,7 +439,7 @@ return false; } @@ -9,7 +9,7 @@ } } -@@ -455,14 +455,14 @@ +@@ -457,14 +457,14 @@ { if (l1 < 13) { @@ -26,7 +26,7 @@ { if (!canPushBlock(i2, par0World, i1, j1, k1, true)) { -@@ -505,14 +505,14 @@ +@@ -507,14 +507,14 @@ if (l1 < 13) { @@ -43,7 +43,7 @@ { if (!canPushBlock(i2, par1World, i1, j1, k1, true)) { -@@ -533,7 +533,9 @@ +@@ -535,7 +535,9 @@ continue; } diff --git a/patches/minecraft/net/minecraft/block/BlockSapling.java.patch b/patches/minecraft/net/minecraft/block/BlockSapling.java.patch index 59c0b4a06..c0b596496 100644 --- a/patches/minecraft/net/minecraft/block/BlockSapling.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockSapling.java.patch @@ -9,7 +9,7 @@ public class BlockSapling extends BlockFlower { public static final String[] WOOD_TYPES = new String[] {"oak", "spruce", "birch", "jungle"}; -@@ -77,6 +79,8 @@ +@@ -76,6 +78,8 @@ */ public void growTree(World par1World, int par2, int par3, int par4, Random par5Random) { diff --git a/patches/minecraft/net/minecraft/block/BlockVine.java.patch b/patches/minecraft/net/minecraft/block/BlockVine.java.patch index 3ee985bde..1042d045c 100644 --- a/patches/minecraft/net/minecraft/block/BlockVine.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockVine.java.patch @@ -9,7 +9,7 @@ import java.util.Random; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; -+import net.minecraft.entity.EntityLiving; ++import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -24,7 +24,7 @@ { public BlockVine(int par1) { -@@ -439,14 +444,26 @@ +@@ -440,14 +445,26 @@ */ public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) { @@ -55,7 +55,7 @@ + } + + @Override -+ public boolean isLadder(World world, int x, int y, int z, EntityLiving entity) ++ public boolean isLadder(World world, int x, int y, int z, EntityLivingBase entity) + { + return true; } diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index e5d59881a..f091e404d 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/client/Minecraft.java +++ ../src_work/minecraft/net/minecraft/client/Minecraft.java -@@ -123,6 +123,14 @@ +@@ -136,6 +136,14 @@ import com.google.common.collect.MapDifference; @@ -13,9 +13,9 @@ +import net.minecraftforge.event.world.WorldEvent; + @SideOnly(Side.CLIENT) - public abstract class Minecraft implements Runnable, IPlayerUsage + public class Minecraft implements IPlayerUsage { -@@ -372,7 +380,7 @@ +@@ -414,7 +422,7 @@ try { @@ -24,16 +24,16 @@ } catch (LWJGLException lwjglexception) { -@@ -450,7 +458,7 @@ - } - +@@ -493,7 +501,7 @@ + this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine); + FMLClientHandler.instance().finishMinecraftLoading(); this.checkGLError("Post startup"); - this.ingameGUI = new GuiIngame(this); + this.ingameGUI = new GuiIngameForge(this); if (this.serverName != null) { -@@ -1238,7 +1246,7 @@ +@@ -1292,7 +1300,7 @@ if (this.thePlayer.canCurrentToolHarvestBlock(j, k, l)) { @@ -42,7 +42,7 @@ this.thePlayer.swingItem(); } } -@@ -1304,7 +1312,8 @@ +@@ -1358,7 +1366,8 @@ { int j1 = itemstack != null ? itemstack.stackSize : 0; @@ -52,7 +52,7 @@ { flag = false; this.thePlayer.swingItem(); -@@ -1330,7 +1339,8 @@ +@@ -1384,7 +1393,8 @@ { ItemStack itemstack1 = this.thePlayer.inventory.getCurrentItem(); @@ -62,7 +62,7 @@ { this.entityRenderer.itemRenderer.resetEquippedProgress2(); } -@@ -2010,6 +2020,11 @@ +@@ -2032,6 +2042,11 @@ { this.statFileWriter.syncStats(); @@ -74,7 +74,7 @@ if (par1WorldClient == null) { NetClientHandler netclienthandler = this.getNetHandler(); -@@ -2027,6 +2042,18 @@ +@@ -2049,6 +2064,18 @@ if (this.theIntegratedServer != null) { this.theIntegratedServer.initiateShutdown(); @@ -93,7 +93,7 @@ } this.theIntegratedServer = null; -@@ -2354,103 +2381,12 @@ +@@ -2219,103 +2246,12 @@ if (this.objectMouseOver != null) { boolean flag = this.thePlayer.capabilities.isCreativeMode; @@ -201,7 +201,7 @@ if (flag) { -@@ -2539,11 +2475,18 @@ +@@ -2397,11 +2333,18 @@ par1PlayerUsageSnooper.addData("gl_max_texture_size", Integer.valueOf(getGLMaximumTextureSize())); } @@ -220,7 +220,7 @@ for (int i = 16384; i > 0; i >>= 1) { GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null); -@@ -2551,6 +2494,7 @@ +@@ -2409,6 +2352,7 @@ if (j != 0) { diff --git a/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch b/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch index aef9c3638..9130df90d 100644 --- a/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch +++ b/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch @@ -10,52 +10,49 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import java.io.File; -@@ -53,9 +57,11 @@ +@@ -61,9 +65,11 @@ private Random rand = new Random(); private int ticksBeforeMusic; + public static int MUSIC_INTERVAL = 12000; + - public SoundManager() + public SoundManager(ResourceManager par1ResourceManager, GameSettings par2GameSettings, File par3File) { - this.ticksBeforeMusic = this.rand.nextInt(12000); + this.ticksBeforeMusic = this.rand.nextInt(MUSIC_INTERVAL); - } - - /** -@@ -70,6 +76,8 @@ - { - this.tryToSetLibraryAndCodecs(); + this.options = par2GameSettings; + this.field_130085_i = par3File; + this.soundPoolSounds = new SoundPool(par1ResourceManager, "sound", true); +@@ -75,6 +81,7 @@ + SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class); + SoundSystemConfig.setCodec("ogg", CodecJOrbis.class); + SoundSystemConfig.setCodec("wav", CodecWav.class); ++ MinecraftForge.EVENT_BUS.post(new SoundSetupEvent(this)); } -+ ModCompatibilityClient.audioModLoad(this); + catch (SoundSystemException soundsystemexception) + { +@@ -90,6 +97,7 @@ + this.stopAllSounds(); + this.closeMinecraft(); + this.tryToSetLibraryAndCodecs(); + MinecraftForge.EVENT_BUS.post(new SoundLoadEvent(this)); } - /** -@@ -89,6 +97,8 @@ - SoundSystemConfig.setCodec("ogg", CodecJOrbis.class); - SoundSystemConfig.setCodec("mus", CodecMus.class); - SoundSystemConfig.setCodec("wav", CodecWav.class); -+ ModCompatibilityClient.audioModAddCodecs(); -+ MinecraftForge.EVENT_BUS.post(new SoundSetupEvent(this)); - sndSystem = new SoundSystem(); - this.options.soundVolume = f; - this.options.musicVolume = f1; -@@ -179,10 +189,12 @@ - } - - SoundPoolEntry soundpoolentry = this.soundPoolMusic.getRandomSound(); -+ soundpoolentry = ModCompatibilityClient.audioModPickBackgroundMusic(this, soundpoolentry); -+ soundpoolentry = SoundEvent.getResult(new PlayBackgroundMusicEvent(this, soundpoolentry)); - - if (soundpoolentry != null) + private void func_130083_h() +@@ -236,10 +244,11 @@ + else { -- this.ticksBeforeMusic = this.rand.nextInt(12000) + 12000; -+ this.ticksBeforeMusic = this.rand.nextInt(MUSIC_INTERVAL) + MUSIC_INTERVAL; - sndSystem.backgroundMusic("BgMusic", soundpoolentry.soundUrl, soundpoolentry.soundName, false); - sndSystem.setVolume("BgMusic", this.options.musicVolume); - sndSystem.play("BgMusic"); -@@ -249,6 +261,7 @@ + SoundPoolEntry soundpoolentry = this.soundPoolMusic.getRandomSound(); ++ soundpoolentry = SoundEvent.getResult(new PlayBackgroundMusicEvent(this, soundpoolentry)); + + if (soundpoolentry != null) + { +- this.ticksBeforeMusic = this.rand.nextInt(12000) + 12000; ++ this.ticksBeforeMusic = this.rand.nextInt(MUSIC_INTERVAL) + MUSIC_INTERVAL; + this.sndSystem.backgroundMusic("BgMusic", soundpoolentry.func_110457_b(), soundpoolentry.func_110458_a(), false); + this.sndSystem.setVolume("BgMusic", this.options.musicVolume); + this.sndSystem.play("BgMusic"); +@@ -307,6 +316,7 @@ if (par1Str != null) { SoundPoolEntry soundpoolentry = this.soundPoolStreaming.getRandomSoundFromSoundPool(par1Str); @@ -63,43 +60,43 @@ if (soundpoolentry != null) { -@@ -260,6 +273,7 @@ - float f3 = 16.0F; - sndSystem.newStreamingSource(true, s1, soundpoolentry.soundUrl, soundpoolentry.soundName, false, par2, par3, par4, 2, f3 * 4.0F); - sndSystem.setVolume(s1, 0.5F * this.options.soundVolume); +@@ -317,6 +327,7 @@ + + this.sndSystem.newStreamingSource(true, s1, soundpoolentry.func_110457_b(), soundpoolentry.func_110458_a(), false, par2, par3, par4, 2, 64.0F); + this.sndSystem.setVolume(s1, 0.5F * this.options.soundVolume); + MinecraftForge.EVENT_BUS.post(new PlayStreamingSourceEvent(this, s1, par2, par3, par4)); - sndSystem.play(s1); + this.sndSystem.play(s1); } } -@@ -439,6 +453,7 @@ - if (loaded && this.options.soundVolume != 0.0F) +@@ -485,6 +496,7 @@ + if (this.loaded && this.options.soundVolume != 0.0F) { SoundPoolEntry soundpoolentry = this.soundPoolSounds.getRandomSoundFromSoundPool(par1Str); + soundpoolentry = SoundEvent.getResult(new PlaySoundEvent(this, soundpoolentry, par1Str, par2, par3, par4, par5, par6)); if (soundpoolentry != null && par5 > 0.0F) { -@@ -460,6 +475,7 @@ - } +@@ -506,6 +518,7 @@ - sndSystem.setVolume(s1, par5 * this.options.soundVolume); + this.sndSystem.setPitch(s1, par6); + this.sndSystem.setVolume(s1, par5 * this.options.soundVolume); + MinecraftForge.EVENT_BUS.post(new PlaySoundSourceEvent(this, s1, par2, par3, par4)); - sndSystem.play(s1); + this.sndSystem.play(s1); } } -@@ -474,6 +490,7 @@ - if (loaded && this.options.soundVolume != 0.0F) +@@ -520,6 +533,7 @@ + if (this.loaded && this.options.soundVolume != 0.0F) { SoundPoolEntry soundpoolentry = this.soundPoolSounds.getRandomSoundFromSoundPool(par1Str); + soundpoolentry = SoundEvent.getResult(new PlaySoundEffectEvent(this, soundpoolentry, par1Str, par2, par3)); - if (soundpoolentry != null) + if (soundpoolentry != null && par2 > 0.0F) { -@@ -489,6 +506,7 @@ +@@ -535,6 +549,7 @@ par2 *= 0.25F; - sndSystem.setPitch(s1, par3); - sndSystem.setVolume(s1, par2 * this.options.soundVolume); + this.sndSystem.setPitch(s1, par3); + this.sndSystem.setVolume(s1, par2 * this.options.soundVolume); + MinecraftForge.EVENT_BUS.post(new PlaySoundEffectSourceEvent(this, s1)); - sndSystem.play(s1); + this.sndSystem.play(s1); } } diff --git a/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch b/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch index 2006c6436..eb71fca16 100644 --- a/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch +++ b/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch @@ -1,15 +1,15 @@ --- ../src_base/minecraft/net/minecraft/client/entity/EntityPlayerSP.java +++ ../src_work/minecraft/net/minecraft/client/entity/EntityPlayerSP.java -@@ -46,6 +46,8 @@ +@@ -49,6 +49,8 @@ + import net.minecraft.util.MovementInput; import net.minecraft.util.Session; - import net.minecraft.util.StringUtils; import net.minecraft.world.World; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.PlaySoundAtEntityEvent; @SideOnly(Side.CLIENT) - public class EntityPlayerSP extends EntityPlayer -@@ -661,6 +663,12 @@ + public class EntityPlayerSP extends AbstractClientPlayer +@@ -685,6 +687,12 @@ public void playSound(String par1Str, float par2, float par3) { @@ -21,4 +21,4 @@ + par1Str = event.name; this.worldObj.playSound(this.posX, this.posY - (double)this.yOffset, this.posZ, par1Str, par2, par3, false); } - } + diff --git a/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch index 9e0a06085..42e3b8844 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch @@ -1,9 +1,9 @@ --- ../src_base/minecraft/net/minecraft/client/gui/GuiControls.java +++ ../src_work/minecraft/net/minecraft/client/gui/GuiControls.java @@ -6,6 +6,8 @@ + import net.minecraft.client.settings.GameSettings; import net.minecraft.client.settings.KeyBinding; import net.minecraft.util.EnumChatFormatting; - import net.minecraft.util.StringTranslate; + +import net.minecraftforge.client.GuiControlsScrollPanel; @@ -18,12 +18,10 @@ public GuiControls(GuiScreen par1GuiScreen, GameSettings par2GameSettings) { -@@ -43,15 +47,10 @@ +@@ -43,14 +47,9 @@ */ public void initGui() { -+ scrollPane = new GuiControlsScrollPanel(this, options, mc); - StringTranslate stringtranslate = StringTranslate.getInstance(); - int i = this.getLeftBorder(); - - for (int j = 0; j < this.options.keyBindings.length; ++j) @@ -31,13 +29,14 @@ - this.buttonList.add(new GuiSmallButton(j, i + j % 2 * 160, this.height / 6 + 24 * (j >> 1), 70, 20, this.options.getOptionDisplayString(j))); - } - -- this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, stringtranslate.translateKey("gui.done"))); -+ this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height - 28, stringtranslate.translateKey("gui.done"))); -+ scrollPane.registerScrollButtons(buttonList, 7, 8); - this.screenTitle = stringtranslate.translateKey("controls.title"); +- this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, I18n.func_135053_a("gui.done"))); ++ scrollPane = new GuiControlsScrollPanel(this, options, mc); ++ this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height - 28, I18n.func_135053_a("gui.done"))); ++ scrollPane.func_110509_d(7, 8); + this.screenTitle = I18n.func_135053_a("controls.title"); } -@@ -59,20 +58,10 @@ +@@ -58,20 +57,10 @@ * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). */ protected void actionPerformed(GuiButton par1GuiButton) @@ -59,7 +58,7 @@ } } -@@ -81,17 +70,7 @@ +@@ -80,17 +69,7 @@ */ protected void mouseClicked(int par1, int par2, int par3) { @@ -78,7 +77,7 @@ } /** -@@ -99,14 +78,7 @@ +@@ -98,14 +77,7 @@ */ protected void keyTyped(char par1, int par2) { @@ -94,7 +93,7 @@ { super.keyTyped(par1, par2); } -@@ -118,6 +90,7 @@ +@@ -117,6 +89,7 @@ public void drawScreen(int par1, int par2, float par3) { this.drawDefaultBackground(); @@ -102,7 +101,7 @@ this.drawCenteredString(this.fontRenderer, this.screenTitle, this.width / 2, 20, 16777215); int k = this.getLeftBorder(); int l = 0; -@@ -158,6 +131,10 @@ +@@ -157,6 +130,10 @@ break; } } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch index f5d3ee699..26f56825c 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/client/gui/GuiCreateWorld.java +++ ../src_work/minecraft/net/minecraft/client/gui/GuiCreateWorld.java -@@ -377,7 +377,7 @@ +@@ -376,7 +376,7 @@ } else if (par1GuiButton.id == 8) { @@ -9,13 +9,12 @@ } } } -@@ -395,7 +395,8 @@ +@@ -394,7 +394,7 @@ this.buttonBonusItems.drawButton = this.moreOptions; this.buttonWorldType.drawButton = this.moreOptions; this.buttonAllowCommands.drawButton = this.moreOptions; - this.buttonCustomize.drawButton = this.moreOptions && WorldType.worldTypes[this.worldTypeId] == WorldType.FLAT; + this.buttonCustomize.drawButton = this.moreOptions && (WorldType.worldTypes[this.worldTypeId].isCustomizable()); -+ - StringTranslate stringtranslate; if (this.moreOptions) + { diff --git a/patches/minecraft/net/minecraft/client/gui/GuiIngame.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiIngame.java.patch index 5490f7241..37ed0182c 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiIngame.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiIngame.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/client/gui/GuiIngame.java +++ ../src_work/minecraft/net/minecraft/client/gui/GuiIngame.java -@@ -34,6 +34,8 @@ +@@ -40,6 +40,8 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; @@ -9,7 +9,7 @@ @SideOnly(Side.CLIENT) public class GuiIngame extends Gui { -@@ -90,9 +92,16 @@ +@@ -99,9 +101,16 @@ ItemStack itemstack = this.mc.thePlayer.inventory.armorItemInSlot(3); @@ -29,30 +29,29 @@ } if (!this.mc.thePlayer.isPotionActive(Potion.confusion)) -@@ -174,7 +183,7 @@ - - k3 = l - 39; - l2 = k3 - 10; -- k2 = this.mc.thePlayer.getTotalArmorValue(); -+ k2 = ForgeHooks.getTotalArmorValue(mc.thePlayer); - i3 = -1; - - if (this.mc.thePlayer.isPotionActive(Potion.regeneration)) -@@ -435,7 +444,16 @@ - GL11.glPushMatrix(); +@@ -275,6 +284,16 @@ GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); -- fontrenderer.drawStringWithShadow(s1, i1, j1, 16777215 + (j5 << 24)); + fontrenderer.drawStringWithShadow(s1, k1, i2, 16777215 + (j2 << 24)); + FontRenderer font = highlightingItemStack.getItem().getFontRenderer(highlightingItemStack); + if (font != null) + { -+ i1 = (k - font.getStringWidth(s1)) / 2; -+ font.drawStringWithShadow(s1, i1, j1, 16777215 + (j5 << 24)); ++ k1 = (k - font.getStringWidth(s1)) / 2; ++ font.drawStringWithShadow(s1, k1, i2, 16777215 + (j2 << 24)); + } + else + { -+ fontrenderer.drawStringWithShadow(s1, i1, j1, 16777215 + (j5 << 24)); ++ fontrenderer.drawStringWithShadow(s1, k1, i2, 16777215 + (j2 << 24)); + } GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); } +@@ -563,7 +582,7 @@ + int k2 = Math.max(10 - (j2 - 2), 3); + int l2 = i2 - (j2 - 1) * k2 - 10; + float f2 = f1; +- int i3 = this.mc.thePlayer.getTotalArmorValue(); ++ int i3 = ForgeHooks.getTotalArmorValue(mc.thePlayer); + int j3 = -1; + + if (this.mc.thePlayer.isPotionActive(Potion.regeneration)) diff --git a/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch index ad1a80e04..44c5abcf6 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch @@ -1,19 +1,10 @@ --- ../src_base/minecraft/net/minecraft/client/gui/GuiSlot.java +++ ../src_work/minecraft/net/minecraft/client/gui/GuiSlot.java -@@ -68,6 +68,8 @@ - private boolean showSelectionBox = true; - private boolean field_77243_s; - private int field_77242_t; -+ -+ public String BACKGROUND_IMAGE = "/gui/background.png"; - - public GuiSlot(Minecraft par1Minecraft, int par2, int par3, int par4, int par5, int par6) - { -@@ -332,16 +334,7 @@ +@@ -325,16 +325,7 @@ GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_FOG); Tessellator tessellator = Tessellator.instance; -- this.mc.renderEngine.bindTexture("/gui/background.png"); +- this.mc.func_110434_K().func_110577_a(Gui.field_110325_k); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - float f1 = 32.0F; - tessellator.startDrawingQuads(); @@ -27,27 +18,14 @@ j1 = this.width / 2 - 92 - 16; k1 = this.top + 4 - (int)this.amountScrolled; -@@ -470,10 +463,10 @@ - /** - * Overlays the background to hide scrolled items - */ -- private void overlayBackground(int par1, int par2, int par3, int par4) -+ protected void overlayBackground(int par1, int par2, int par3, int par4) - { - Tessellator tessellator = Tessellator.instance; -- this.mc.renderEngine.bindTexture("/gui/background.png"); -+ this.mc.renderEngine.bindTexture(BACKGROUND_IMAGE); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - float f = 32.0F; - tessellator.startDrawingQuads(); -@@ -485,4 +478,18 @@ +@@ -478,4 +469,18 @@ tessellator.addVertexWithUV(0.0D, (double)par1, 0.0D, 0.0D, (double)((float)par1 / f)); tessellator.draw(); } + + protected void drawContainerBackground(Tessellator tess) + { -+ this.mc.renderEngine.bindTexture(BACKGROUND_IMAGE); ++ this.mc.func_110434_K().func_110577_a(Gui.field_110325_k); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + float height = 32.0F; + tess.startDrawingQuads(); diff --git a/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch b/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch index 207acf878..6300fe0c0 100644 --- a/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch @@ -10,7 +10,7 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; -@@ -20,6 +23,8 @@ +@@ -22,6 +25,8 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; @@ -19,8 +19,8 @@ @SideOnly(Side.CLIENT) public class GuiAchievements extends GuiScreen { -@@ -57,6 +62,10 @@ - private int isMouseButtonDown = 0; +@@ -60,6 +65,10 @@ + private int isMouseButtonDown; private StatFileWriter statFileWriter; + private int currentPage = -1; @@ -30,7 +30,7 @@ public GuiAchievements(StatFileWriter par1StatFileWriter) { this.statFileWriter = par1StatFileWriter; -@@ -64,6 +73,14 @@ +@@ -67,6 +76,14 @@ short short2 = 141; this.field_74117_m = this.guiMapX = this.field_74124_q = (double)(AchievementList.openInventory.displayColumn * 24 - short1 / 2 - 12); this.field_74115_n = this.guiMapY = this.field_74123_r = (double)(AchievementList.openInventory.displayRow * 24 - short2 / 2); @@ -45,15 +45,15 @@ } /** -@@ -73,6 +90,7 @@ +@@ -76,6 +93,7 @@ { this.buttonList.clear(); - this.buttonList.add(new GuiSmallButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, StatCollector.translateToLocal("gui.done"))); + this.buttonList.add(new GuiSmallButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, I18n.func_135053_a("gui.done"))); + this.buttonList.add(button = new GuiSmallButton(2, (width - achievementsPaneWidth) / 2 + 24, height / 2 + 74, 125, 20, AchievementPage.getTitle(currentPage))); } /** -@@ -84,6 +102,16 @@ +@@ -87,6 +105,16 @@ { this.mc.displayGuiScreen((GuiScreen)null); this.mc.setIngameFocus(); @@ -70,7 +70,7 @@ } super.actionPerformed(par1GuiButton); -@@ -306,11 +334,12 @@ +@@ -314,11 +342,12 @@ int i4; int j4; @@ -88,7 +88,7 @@ { k3 = achievement.displayColumn * 24 - k + 11 + k1; j3 = achievement.displayRow * 24 - l + 11 + l1; -@@ -344,9 +373,9 @@ +@@ -352,9 +381,9 @@ int l4; int i5; diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch index aaf40dd18..4e1d227d0 100644 --- a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch @@ -8,7 +8,7 @@ import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderHelper; -@@ -139,7 +140,11 @@ +@@ -143,7 +144,11 @@ } } @@ -20,21 +20,21 @@ InventoryPlayer inventoryplayer = this.mc.thePlayer.inventory; ItemStack itemstack = this.draggedStack == null ? inventoryplayer.getItemStack() : this.draggedStack; -@@ -203,8 +208,11 @@ +@@ -207,8 +212,11 @@ GL11.glTranslatef(0.0F, 0.0F, 32.0F); this.zLevel = 200.0F; itemRenderer.zLevel = 200.0F; -- itemRenderer.renderItemAndEffectIntoGUI(this.fontRenderer, this.mc.renderEngine, par1ItemStack, par2, par3); -- itemRenderer.renderItemOverlayIntoGUI(this.fontRenderer, this.mc.renderEngine, par1ItemStack, par2, par3 - (this.draggedStack == null ? 0 : 8), par4Str); +- itemRenderer.func_110797_b(this.fontRenderer, this.mc.func_110434_K(), par1ItemStack, par2, par3); +- itemRenderer.func_110793_a(this.fontRenderer, this.mc.func_110434_K(), par1ItemStack, par2, par3 - (this.draggedStack == null ? 0 : 8), par4Str); + FontRenderer font = null; + if (par1ItemStack != null) font = par1ItemStack.getItem().getFontRenderer(par1ItemStack); + if (font == null) font = fontRenderer; -+ itemRenderer.renderItemAndEffectIntoGUI(font, this.mc.renderEngine, par1ItemStack, par2, par3); -+ itemRenderer.renderItemOverlayIntoGUI(font, this.mc.renderEngine, par1ItemStack, par2, par3 - (this.draggedStack == null ? 0 : 8), par4Str); ++ itemRenderer.func_110797_b(font, this.mc.func_110434_K(), par1ItemStack, par2, par3); ++ itemRenderer.func_110793_a(font, this.mc.func_110434_K(), par1ItemStack, par2, par3 - (this.draggedStack == null ? 0 : 8), par4Str); this.zLevel = 0.0F; itemRenderer.zLevel = 0.0F; } -@@ -225,7 +233,8 @@ +@@ -229,7 +237,8 @@ } } @@ -44,7 +44,7 @@ } /** -@@ -238,6 +247,11 @@ +@@ -242,6 +251,11 @@ } protected void func_102021_a(List par1List, int par2, int par3) @@ -56,7 +56,7 @@ { if (!par1List.isEmpty()) { -@@ -251,7 +265,7 @@ +@@ -255,7 +269,7 @@ while (iterator.hasNext()) { String s = (String)iterator.next(); @@ -65,7 +65,7 @@ if (l > k) { -@@ -296,7 +310,7 @@ +@@ -300,7 +314,7 @@ for (int k2 = 0; k2 < par1List.size(); ++k2) { String s1 = (String)par1List.get(k2); diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch index b399126ec..8ec560c7f 100644 --- a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch @@ -1,15 +1,15 @@ --- ../src_base/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java +++ ../src_work/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java -@@ -56,6 +56,8 @@ - private Slot field_74235_v = null; - private boolean field_74234_w = false; +@@ -61,6 +61,8 @@ + private Slot field_74235_v; + private boolean field_74234_w; private CreativeCrafting field_82324_x; + private static int tabPage = 0; + private int maxPages = 0; public GuiContainerCreative(EntityPlayer par1EntityPlayer) { -@@ -196,7 +198,7 @@ +@@ -201,7 +203,7 @@ return; } @@ -18,7 +18,7 @@ { if (par3 == 0) { -@@ -274,6 +276,13 @@ +@@ -279,6 +281,13 @@ this.setCurrentCreativeTab(CreativeTabs.creativeTabArray[i]); this.field_82324_x = new CreativeCrafting(this.mc); this.mc.thePlayer.inventoryContainer.addCraftingToCrafters(this.field_82324_x); @@ -32,16 +32,16 @@ } else { -@@ -408,7 +417,7 @@ +@@ -413,7 +422,7 @@ { CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex]; - if (creativetabs.drawInForegroundOfTab()) + if (creativetabs != null && creativetabs.drawInForegroundOfTab()) { - this.fontRenderer.drawString(creativetabs.getTranslatedTabLabel(), 8, 6, 4210752); + this.fontRenderer.drawString(I18n.func_135053_a(creativetabs.getTranslatedTabLabel()), 8, 6, 4210752); } -@@ -457,7 +466,7 @@ +@@ -462,7 +471,7 @@ { CreativeTabs creativetabs = acreativetabs[k1]; @@ -50,7 +50,7 @@ { this.setCurrentCreativeTab(creativetabs); return; -@@ -473,11 +482,17 @@ +@@ -478,11 +487,17 @@ */ private boolean needsScrollBars() { @@ -68,7 +68,7 @@ int i = selectedTabIndex; selectedTabIndex = par1CreativeTabs.getTabIndex(); ContainerCreative containercreative = (ContainerCreative)this.inventorySlots; -@@ -648,21 +663,42 @@ +@@ -653,21 +668,42 @@ super.drawScreen(par1, par2, par3); CreativeTabs[] acreativetabs = CreativeTabs.creativeTabArray; @@ -86,7 +86,7 @@ - if (this.renderCreativeInventoryHoveringText(creativetabs, par1, par2)) - { -+ if (creativetabs != null && renderCreativeInventoryHoveringText(creativetabs, par1, par2)) ++ if (creativetabs != null && this.renderCreativeInventoryHoveringText(creativetabs, par1, par2)) + { + rendered = true; break; @@ -100,7 +100,7 @@ + if (this.field_74235_v != null && selectedTabIndex == CreativeTabs.tabInventory.getTabIndex() && this.isPointInRegion(this.field_74235_v.xDisplayPosition, this.field_74235_v.yDisplayPosition, 16, 16, par1, par2)) { - this.drawCreativeTabHoveringText(StringTranslate.getInstance().translateKey("inventory.binSlot"), par1, par2); + this.drawCreativeTabHoveringText(I18n.func_135053_a("inventory.binSlot"), par1, par2); + } + + if (maxPages != 0) @@ -116,7 +116,7 @@ } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); -@@ -681,14 +717,32 @@ +@@ -741,14 +777,32 @@ int k = acreativetabs.length; int l; @@ -128,7 +128,7 @@ + for (l = start; l < k; ++l) { CreativeTabs creativetabs1 = acreativetabs[l]; - this.mc.renderEngine.bindTexture("/gui/allitems.png"); + this.mc.func_110434_K().func_110577_a(field_110424_t); - if (creativetabs1.getTabIndex() != selectedTabIndex) + if (creativetabs1 != null && creativetabs1.getTabIndex() != selectedTabIndex) @@ -141,17 +141,17 @@ + { + if (creativetabs != CreativeTabs.tabAllSearch) + { -+ mc.renderEngine.bindTexture("/gui/allitems.png"); ++ this.mc.func_110434_K().func_110577_a(field_110424_t); + renderCreativeTab(CreativeTabs.tabAllSearch); + } + if (creativetabs != CreativeTabs.tabInventory) + { -+ mc.renderEngine.bindTexture("/gui/allitems.png"); ++ this.mc.func_110434_K().func_110577_a(field_110424_t); + renderCreativeTab(CreativeTabs.tabInventory); } } -@@ -706,6 +760,14 @@ +@@ -766,6 +820,14 @@ this.drawTexturedModalRect(i1, k + (int)((float)(l - k - 17) * this.currentScroll), 232 + (this.needsScrollBars() ? 0 : 12), 0, 12, 15); } @@ -166,7 +166,7 @@ this.renderCreativeTab(creativetabs); if (creativetabs == CreativeTabs.tabInventory) -@@ -716,6 +778,15 @@ +@@ -776,6 +838,15 @@ protected boolean func_74232_a(CreativeTabs par1CreativeTabs, int par2, int par3) { @@ -182,7 +182,7 @@ int k = par1CreativeTabs.getTabColumn(); int l = 28 * k; byte b0 = 0; -@@ -823,6 +894,7 @@ +@@ -883,6 +954,7 @@ } GL11.glDisable(GL11.GL_LIGHTING); @@ -190,16 +190,16 @@ this.drawTexturedModalRect(l, i1, j, k, 28, b0); this.zLevel = 100.0F; itemRenderer.zLevel = 100.0F; -@@ -830,7 +902,7 @@ +@@ -890,7 +962,7 @@ i1 += 8 + (flag1 ? 1 : -1); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL12.GL_RESCALE_NORMAL); - ItemStack itemstack = new ItemStack(par1CreativeTabs.getTabIconItem()); + ItemStack itemstack = par1CreativeTabs.getIconItemStack(); - itemRenderer.renderItemAndEffectIntoGUI(this.fontRenderer, this.mc.renderEngine, itemstack, l, i1); - itemRenderer.renderItemOverlayIntoGUI(this.fontRenderer, this.mc.renderEngine, itemstack, l, i1); + itemRenderer.func_110797_b(this.fontRenderer, this.mc.func_110434_K(), itemstack, l, i1); + itemRenderer.func_110794_c(this.fontRenderer, this.mc.func_110434_K(), itemstack, l, i1); GL11.glDisable(GL11.GL_LIGHTING); -@@ -852,6 +924,15 @@ +@@ -912,6 +984,15 @@ { this.mc.displayGuiScreen(new GuiStats(this, this.mc.statFileWriter)); } diff --git a/patches/minecraft/net/minecraft/client/model/ModelBase.java.patch b/patches/minecraft/net/minecraft/client/model/ModelBase.java.patch index 569490132..d8c9903b7 100644 --- a/patches/minecraft/net/minecraft/client/model/ModelBase.java.patch +++ b/patches/minecraft/net/minecraft/client/model/ModelBase.java.patch @@ -2,7 +2,7 @@ +++ ../src_work/minecraft/net/minecraft/client/model/ModelBase.java @@ -10,7 +10,6 @@ import net.minecraft.entity.Entity; - import net.minecraft.entity.EntityLiving; + import net.minecraft.entity.EntityLivingBase; -@SideOnly(Side.CLIENT) public abstract class ModelBase diff --git a/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch b/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch index 198154c5e..85723365d 100644 --- a/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch @@ -8,7 +8,7 @@ public class ModelRenderer { /** The size of the texture file's width in pixels. */ -@@ -121,7 +120,8 @@ +@@ -117,7 +116,8 @@ this.rotationPointY = par2; this.rotationPointZ = par3; } @@ -18,7 +18,7 @@ public void render(float par1) { if (!this.isHidden) -@@ -204,6 +204,7 @@ +@@ -200,6 +200,7 @@ } } @@ -26,7 +26,7 @@ public void renderWithRotation(float par1) { if (!this.isHidden) -@@ -242,6 +243,7 @@ +@@ -238,6 +239,7 @@ /** * Allows the changing of Angles after a box has been rendered */ @@ -34,7 +34,7 @@ public void postRender(float par1) { if (!this.isHidden) -@@ -286,6 +288,7 @@ +@@ -282,6 +284,7 @@ /** * Compiles a GL display list for this model */ diff --git a/patches/minecraft/net/minecraft/client/multiplayer/NetClientHandler.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/NetClientHandler.java.patch index e14ae7ac4..1b062e2c3 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/NetClientHandler.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/NetClientHandler.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/client/multiplayer/NetClientHandler.java +++ ../src_work/minecraft/net/minecraft/client/multiplayer/NetClientHandler.java -@@ -176,6 +176,11 @@ +@@ -186,6 +186,11 @@ import net.minecraft.world.storage.MapStorage; import org.lwjgl.input.Keyboard; @@ -12,7 +12,7 @@ @SideOnly(Side.CLIENT) public class NetClientHandler extends NetHandler { -@@ -762,7 +767,7 @@ +@@ -778,7 +783,7 @@ public void handleKickDisconnect(Packet255KickDisconnect par1Packet255KickDisconnect) { @@ -21,20 +21,20 @@ this.disconnected = true; this.mc.loadWorld((WorldClient)null); -@@ -844,7 +849,11 @@ +@@ -860,7 +865,11 @@ public void handleChat(Packet3Chat par1Packet3Chat) { par1Packet3Chat = FMLNetworkHandler.handleChatMessage(this, par1Packet3Chat); -- this.mc.ingameGUI.getChatGUI().printChatMessage(par1Packet3Chat.message); +- this.mc.ingameGUI.getChatGUI().printChatMessage(ChatMessageComponent.func_111078_c(par1Packet3Chat.message).func_111068_a(true)); + ClientChatReceivedEvent event = new ClientChatReceivedEvent(par1Packet3Chat.message); + if (!MinecraftForge.EVENT_BUS.post(event) && event.message != null) + { -+ this.mc.ingameGUI.getChatGUI().printChatMessage(par1Packet3Chat.message); ++ this.mc.ingameGUI.getChatGUI().printChatMessage(ChatMessageComponent.func_111078_c(event.message).func_111068_a(true)); + } } public void handleAnimation(Packet18Animation par1Packet18Animation) -@@ -1278,6 +1287,10 @@ +@@ -1329,6 +1338,10 @@ { tileentity.readFromNBT(par1Packet132TileEntityData.customParam1); } diff --git a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch index 4a5c81cdd..f7171d163 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java +++ ../src_work/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java -@@ -20,6 +20,10 @@ +@@ -22,6 +22,10 @@ import net.minecraft.world.EnumGameType; import net.minecraft.world.World; @@ -11,7 +11,7 @@ @SideOnly(Side.CLIENT) public class PlayerControllerMP { -@@ -124,6 +128,12 @@ +@@ -125,6 +129,12 @@ */ public boolean onPlayerDestroyBlock(int par1, int par2, int par3, int par4) { @@ -24,7 +24,7 @@ if (this.currentGameType.isAdventure() && !this.mc.thePlayer.canCurrentToolHarvestBlock(par1, par2, par3)) { return false; -@@ -141,7 +151,7 @@ +@@ -146,7 +156,7 @@ { worldclient.playAuxSFX(2001, par1, par2, par3, block.blockID + (worldclient.getBlockMetadata(par1, par2, par3) << 12)); int i1 = worldclient.getBlockMetadata(par1, par2, par3); @@ -33,7 +33,7 @@ if (flag) { -@@ -342,6 +352,12 @@ +@@ -347,6 +357,12 @@ float f2 = (float)par8Vec3.zCoord - (float)par6; boolean flag = false; int i1; @@ -46,7 +46,7 @@ if (!par1EntityPlayer.isSneaking() || par1EntityPlayer.getHeldItem() == null) { -@@ -384,7 +400,15 @@ +@@ -389,7 +405,15 @@ } else { @@ -63,7 +63,7 @@ } } -@@ -406,9 +430,10 @@ +@@ -411,9 +435,10 @@ { par1EntityPlayer.inventory.mainInventory[par1EntityPlayer.inventory.currentItem] = itemstack1; diff --git a/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch index 124915f7f..5a0f5e5cd 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch @@ -23,7 +23,7 @@ } /** -@@ -291,6 +297,12 @@ +@@ -296,6 +302,12 @@ */ protected void updateWeather() { diff --git a/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch b/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch index 2c83d010a..d472b2ce5 100644 --- a/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch @@ -1,14 +1,14 @@ --- ../src_base/minecraft/net/minecraft/client/particle/EffectRenderer.java +++ ../src_work/minecraft/net/minecraft/client/particle/EffectRenderer.java -@@ -11,6 +11,7 @@ - import net.minecraft.client.renderer.Tessellator; +@@ -13,6 +13,7 @@ + import net.minecraft.client.resources.ResourceLocation; import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import org.lwjgl.opengl.GL11; -@@ -59,9 +60,13 @@ +@@ -63,9 +64,13 @@ for (int j = 0; j < this.fxLayers[i].size(); ++j) { EntityFX entityfx = (EntityFX)this.fxLayers[i].get(j); @@ -25,7 +25,7 @@ { this.fxLayers[i].remove(j--); } -@@ -111,6 +116,7 @@ +@@ -115,6 +120,7 @@ for (int j = 0; j < this.fxLayers[i].size(); ++j) { EntityFX entityfx = (EntityFX)this.fxLayers[i].get(j); @@ -33,15 +33,15 @@ tessellator.setBrightness(entityfx.getBrightnessForRender(par2)); entityfx.renderParticle(tessellator, par2, f1, f5, f2, f3, f4); } -@@ -139,6 +145,7 @@ - for (int i = 0; i < this.fxLayers[b0].size(); ++i) +@@ -145,6 +151,7 @@ + for (int i = 0; i < list.size(); ++i) { - EntityFX entityfx = (EntityFX)this.fxLayers[b0].get(i); + EntityFX entityfx = (EntityFX)list.get(i); + if (entityfx == null) continue; tessellator.setBrightness(entityfx.getBrightnessForRender(par2)); - entityfx.renderParticle(tessellator, par2, f1, f5, f2, f3, f4); + entityfx.renderParticle(tessellator, par2, f2, f6, f3, f4, f5); } -@@ -157,9 +164,9 @@ +@@ -163,9 +170,9 @@ public void addBlockDestroyEffects(int par1, int par2, int par3, int par4, int par5) { @@ -54,7 +54,7 @@ byte b0 = 4; for (int j1 = 0; j1 < b0; ++j1) -@@ -232,4 +239,13 @@ +@@ -237,4 +244,13 @@ { return "" + (this.fxLayers[0].size() + this.fxLayers[1].size() + this.fxLayers[2].size()); } diff --git a/patches/minecraft/net/minecraft/client/particle/EntityDiggingFX.java.patch b/patches/minecraft/net/minecraft/client/particle/EntityDiggingFX.java.patch index 55fbd0320..adeb00887 100644 --- a/patches/minecraft/net/minecraft/client/particle/EntityDiggingFX.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/EntityDiggingFX.java.patch @@ -1,21 +1,26 @@ --- ../src_base/minecraft/net/minecraft/client/particle/EntityDiggingFX.java +++ ../src_work/minecraft/net/minecraft/client/particle/EntityDiggingFX.java -@@ -11,20 +11,22 @@ +@@ -10,20 +10,27 @@ public class EntityDiggingFX extends EntityFX { private Block blockInstance; + private int side; - public EntityDiggingFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, Block par14Block, int par15, int par16, RenderEngine par17RenderEngine) + public EntityDiggingFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, Block par14Block, int par15) { ++ this(par1World, par2, par4, par6, par8, par10, par12, par14Block, par15, par1World.rand.nextInt(6)); ++ } ++ ++ public EntityDiggingFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, Block par14Block, int par15, int side) ++ { super(par1World, par2, par4, par6, par8, par10, par12); this.blockInstance = par14Block; -- this.setParticleIcon(par17RenderEngine, par14Block.getIcon(0, par16)); -+ this.setParticleIcon(par17RenderEngine, par14Block.getIcon(par15, par16)); +- this.func_110125_a(par14Block.getIcon(0, par15)); ++ this.func_110125_a(par14Block.getIcon(side, par15)); this.particleGravity = par14Block.blockParticleGravity; this.particleRed = this.particleGreen = this.particleBlue = 0.6F; this.particleScale /= 2.0F; -+ this.side = par15; ++ this.side = side; } public EntityDiggingFX func_70596_a(int par1, int par2, int par3) diff --git a/patches/minecraft/net/minecraft/client/render/entity/RendererLivingEntity.java.patch b/patches/minecraft/net/minecraft/client/render/entity/RendererLivingEntity.java.patch new file mode 100644 index 000000000..29ef9b69a --- /dev/null +++ b/patches/minecraft/net/minecraft/client/render/entity/RendererLivingEntity.java.patch @@ -0,0 +1,45 @@ +--- ../src_base/minecraft/net/minecraft/client/render/entity/RendererLivingEntity.java ++++ ../src_work/minecraft/net/minecraft/client/render/entity/RendererLivingEntity.java +@@ -18,6 +18,9 @@ + import net.minecraft.entity.player.EntityPlayer; + import net.minecraft.entity.projectile.EntityArrow; + import net.minecraft.util.MathHelper; ++import net.minecraftforge.client.event.RenderLivingEvent; ++import net.minecraftforge.common.MinecraftForge; ++ + import org.lwjgl.opengl.GL11; + import org.lwjgl.opengl.GL12; + +@@ -29,6 +32,9 @@ + + /** The model to be used during the render passes. */ + protected ModelBase renderPassModel; ++ ++ public static float NAME_TAG_RANGE = 64.0f; ++ public static float NAME_TAG_RANGE_SNEAK = 32.0f; + + public RendererLivingEntity(ModelBase par1ModelBase, float par2) + { +@@ -440,12 +446,13 @@ + + protected void func_130008_a(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6) + { ++ if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Specials.Pre(par1EntityLivingBase, this))) return; + if (this.func_110813_b(par1EntityLivingBase)) + { + float f = 1.6F; + float f1 = 0.016666668F * f; + double d3 = par1EntityLivingBase.getDistanceSqToEntity(this.renderManager.livingPlayer); +- float f2 = par1EntityLivingBase.isSneaking() ? 32.0F : 64.0F; ++ float f2 = par1EntityLivingBase.isSneaking() ? NAME_TAG_RANGE_SNEAK : NAME_TAG_RANGE; + + if (d3 < (double)(f2 * f2)) + { +@@ -489,6 +496,7 @@ + } + } + } ++ MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Specials.Post(par1EntityLivingBase, this)); + } + + protected boolean func_110813_b(EntityLivingBase par1EntityLivingBase) diff --git a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch index 6b1e65a13..ad8f31660 100644 --- a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch @@ -1,8 +1,8 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/EntityRenderer.java +++ ../src_work/minecraft/net/minecraft/client/renderer/EntityRenderer.java -@@ -37,6 +37,11 @@ +@@ -40,6 +40,11 @@ import org.lwjgl.opengl.GLContext; - import org.lwjgl.util.glu.GLU; + import org.lwjgl.util.glu.Project; +import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.client.event.DrawBlockHighlightEvent; @@ -12,7 +12,7 @@ @SideOnly(Side.CLIENT) public class EntityRenderer { -@@ -339,8 +344,15 @@ +@@ -354,8 +359,15 @@ */ private void updateFovModifierHand() { @@ -30,87 +30,84 @@ this.fovModifierHandPrev = this.fovModifierHand; this.fovModifierHand += (this.fovMultiplierTemp - this.fovModifierHand) * 0.5F; -@@ -366,7 +378,7 @@ +@@ -381,7 +393,7 @@ } else { - EntityPlayer entityplayer = (EntityPlayer)this.mc.renderViewEntity; -+ EntityLiving entityplayer = (EntityLiving)this.mc.renderViewEntity; ++ EntityLivingBase entityplayer = (EntityLivingBase)this.mc.renderViewEntity; float f1 = 70.0F; if (par2) -@@ -453,15 +465,7 @@ +@@ -468,15 +480,7 @@ if (!this.mc.gameSettings.debugCamEnable) { -- int i = this.mc.theWorld.getBlockId(MathHelper.floor_double(entityliving.posX), MathHelper.floor_double(entityliving.posY), MathHelper.floor_double(entityliving.posZ)); +- int i = this.mc.theWorld.getBlockId(MathHelper.floor_double(entitylivingbase.posX), MathHelper.floor_double(entitylivingbase.posY), MathHelper.floor_double(entitylivingbase.posZ)); - - if (i == Block.bed.blockID) - { -- int j = this.mc.theWorld.getBlockMetadata(MathHelper.floor_double(entityliving.posX), MathHelper.floor_double(entityliving.posY), MathHelper.floor_double(entityliving.posZ)); +- int j = this.mc.theWorld.getBlockMetadata(MathHelper.floor_double(entitylivingbase.posX), MathHelper.floor_double(entitylivingbase.posY), MathHelper.floor_double(entitylivingbase.posZ)); - int k = j & 3; - GL11.glRotatef((float)(k * 90), 0.0F, 1.0F, 0.0F); - } - -+ ForgeHooksClient.orientBedCamera(mc, entityliving); - GL11.glRotatef(entityliving.prevRotationYaw + (entityliving.rotationYaw - entityliving.prevRotationYaw) * par1 + 180.0F, 0.0F, -1.0F, 0.0F); - GL11.glRotatef(entityliving.prevRotationPitch + (entityliving.rotationPitch - entityliving.prevRotationPitch) * par1, -1.0F, 0.0F, 0.0F); ++ ForgeHooksClient.orientBedCamera(mc, entitylivingbase); + GL11.glRotatef(entitylivingbase.prevRotationYaw + (entitylivingbase.rotationYaw - entitylivingbase.prevRotationYaw) * par1 + 180.0F, 0.0F, -1.0F, 0.0F); + GL11.glRotatef(entitylivingbase.prevRotationPitch + (entitylivingbase.rotationPitch - entitylivingbase.prevRotationPitch) * par1, -1.0F, 0.0F, 0.0F); } -@@ -1142,23 +1146,20 @@ +@@ -1152,7 +1156,10 @@ { RenderHelper.enableStandardItemLighting(); this.mc.mcProfiler.endStartSection("entities"); + ForgeHooksClient.setRenderPass(0); - renderglobal.renderEntities(entityliving.getPosition(par1), frustrum, par1); -- this.enableLightmap((double)par1); -- this.mc.mcProfiler.endStartSection("litParticles"); -- effectrenderer.renderLitParticles(entityliving, par1); -- RenderHelper.disableStandardItemLighting(); -- this.setupFog(0, par1); -- this.mc.mcProfiler.endStartSection("particles"); -- effectrenderer.renderParticles(entityliving, par1); -- this.disableLightmap((double)par1); -+ ForgeHooksClient.setRenderPass(-1); + renderglobal.renderEntities(entitylivingbase.getPosition(par1), frustrum, par1); ++ ForgeHooksClient.setRenderPass(0); ++ /* Forge: Moved down + this.enableLightmap((double)par1); + this.mc.mcProfiler.endStartSection("litParticles"); + effectrenderer.renderLitParticles(entitylivingbase, par1); +@@ -1161,13 +1168,17 @@ + this.mc.mcProfiler.endStartSection("particles"); + effectrenderer.renderParticles(entitylivingbase, par1); + this.disableLightmap((double)par1); ++ */ - if (this.mc.objectMouseOver != null && entityliving.isInsideOfMaterial(Material.water) && entityliving instanceof EntityPlayer && !this.mc.gameSettings.hideGUI) + if (this.mc.objectMouseOver != null && entitylivingbase.isInsideOfMaterial(Material.water) && entitylivingbase instanceof EntityPlayer && !this.mc.gameSettings.hideGUI) { - entityplayer = (EntityPlayer)entityliving; + entityplayer = (EntityPlayer)entitylivingbase; GL11.glDisable(GL11.GL_ALPHA_TEST); this.mc.mcProfiler.endStartSection("outline"); -- renderglobal.drawBlockBreaking(entityplayer, this.mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), par1); -- renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), par1); +- renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, par1); + if (!ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), par1)) + { -+ renderglobal.drawBlockBreaking(entityplayer, this.mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), par1); -+ renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), par1); ++ renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, par1); + } GL11.glEnable(GL11.GL_ALPHA_TEST); } } -@@ -1213,6 +1214,13 @@ - renderglobal.sortAndRender(entityliving, 1, (double)par1); +@@ -1222,6 +1233,13 @@ + renderglobal.sortAndRender(entitylivingbase, 1, (double)par1); } + RenderHelper.enableStandardItemLighting(); + this.mc.mcProfiler.endStartSection("entities"); + ForgeHooksClient.setRenderPass(1); -+ renderglobal.renderEntities(entityliving.getPosition(par1), frustrum, par1); ++ renderglobal.renderEntities(entitylivingbase.getPosition(par1), frustrum, par1); + ForgeHooksClient.setRenderPass(-1); + RenderHelper.disableStandardItemLighting(); + GL11.glDepthMask(true); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); -@@ -1222,15 +1230,18 @@ - entityplayer = (EntityPlayer)entityliving; +@@ -1231,14 +1249,17 @@ + entityplayer = (EntityPlayer)entitylivingbase; GL11.glDisable(GL11.GL_ALPHA_TEST); this.mc.mcProfiler.endStartSection("outline"); -- renderglobal.drawBlockBreaking(entityplayer, this.mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), par1); -- renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), par1); +- renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, par1); + if (!ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), par1)) + { -+ renderglobal.drawBlockBreaking(entityplayer, this.mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), par1); -+ renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), par1); ++ renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, par1); + } GL11.glEnable(GL11.GL_ALPHA_TEST); } @@ -118,12 +115,12 @@ this.mc.mcProfiler.endStartSection("destroyProgress"); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); -- renderglobal.drawBlockDamageTexture(Tessellator.instance, (EntityPlayer)entityliving, par1); -+ renderglobal.drawBlockDamageTexture(Tessellator.instance, entityliving, par1); +- renderglobal.drawBlockDamageTexture(Tessellator.instance, (EntityPlayer)entitylivingbase, par1); ++ renderglobal.drawBlockDamageTexture(Tessellator.instance, entitylivingbase, par1); GL11.glDisable(GL11.GL_BLEND); this.mc.mcProfiler.endStartSection("weather"); this.renderRainSnow(par1); -@@ -1240,6 +1251,19 @@ +@@ -1248,6 +1269,20 @@ { this.renderCloudsCheck(renderglobal, par1); } @@ -131,12 +128,13 @@ + //Forge: Moved section from above, now particles are the last thing to render. + this.enableLightmap((double)par1); + this.mc.mcProfiler.endStartSection("litParticles"); -+ effectrenderer.renderLitParticles(entityliving, par1); ++ effectrenderer.renderLitParticles(entitylivingbase, par1); + RenderHelper.disableStandardItemLighting(); + this.setupFog(0, par1); + this.mc.mcProfiler.endStartSection("particles"); -+ effectrenderer.renderParticles(entityliving, par1); ++ effectrenderer.renderParticles(entitylivingbase, par1); + this.disableLightmap((double)par1); ++ //Forge: End Move + + this.mc.mcProfiler.endStartSection("FRenderLast"); + ForgeHooksClient.dispatchRenderLast(renderglobal, par1); diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch index d9d2342f1..253e17709 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch @@ -1,7 +1,7 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/ItemRenderer.java +++ ../src_work/minecraft/net/minecraft/client/renderer/ItemRenderer.java -@@ -14,6 +14,8 @@ - import net.minecraft.entity.EntityLiving; +@@ -17,6 +17,8 @@ + import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.EnumAction; import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; @@ -9,7 +9,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.Icon; import net.minecraft.util.MathHelper; -@@ -21,6 +23,13 @@ +@@ -24,6 +26,13 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; @@ -23,25 +23,25 @@ @SideOnly(Side.CLIENT) public class ItemRenderer { -@@ -46,15 +55,40 @@ - this.mc = par1Minecraft; - this.mapItemRenderer = new MapItemRenderer(par1Minecraft.fontRenderer, par1Minecraft.gameSettings, par1Minecraft.renderEngine); +@@ -54,15 +63,32 @@ + this.mapItemRenderer = new MapItemRenderer(par1Minecraft.gameSettings, par1Minecraft.func_110434_K()); } -+ -+ public void renderItem(EntityLiving par1EntityLiving, ItemStack par2ItemStack, int par3) -+ { -+ this.renderItem(par1EntityLiving, par2ItemStack, par3, ItemRenderType.EQUIPPED); -+ } ++ public void renderItem(EntityLivingBase par1EntityLivingBase, ItemStack par2ItemStack, int par3) ++ { ++ this.renderItem(par1EntityLivingBase, par2ItemStack, par3, ItemRenderType.EQUIPPED); ++ } ++ /** * Renders the item stack for being in an entity's hand Args: itemStack */ -- public void renderItem(EntityLiving par1EntityLiving, ItemStack par2ItemStack, int par3) -+ public void renderItem(EntityLiving par1EntityLiving, ItemStack par2ItemStack, int par3, ItemRenderType type) +- public void renderItem(EntityLivingBase par1EntityLivingBase, ItemStack par2ItemStack, int par3) ++ public void renderItem(EntityLivingBase par1EntityLivingBase, ItemStack par2ItemStack, int par3, ItemRenderType type) { GL11.glPushMatrix(); + TextureManager texturemanager = this.mc.func_110434_K(); -- if (par2ItemStack.getItemSpriteNumber() == 0 && Block.blocksList[par2ItemStack.itemID] != null && RenderBlocks.renderItemIn3d(Block.blocksList[par2ItemStack.itemID].getRenderType())) +- if (par2ItemStack.getItemSpriteNumber() == 0 && par2ItemStack.itemID < Block.blocksList.length && Block.blocksList[par2ItemStack.itemID] != null && RenderBlocks.renderItemIn3d(Block.blocksList[par2ItemStack.itemID].getRenderType())) + Block block = null; + if (par2ItemStack.getItem() instanceof ItemBlock && par2ItemStack.itemID < Block.blocksList.length) + { @@ -49,24 +49,16 @@ + } + + IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(par2ItemStack, type); -+ //Backwards compatibility, Remove in 1.6, For 1.5 if they implement EQUIPPED then -+ //they must handle it how it was when 1.5 began. -+ if (customRenderer == null && type == ItemRenderType.EQUIPPED_FIRST_PERSON) -+ { -+ type = ItemRenderType.EQUIPPED; -+ customRenderer = MinecraftForgeClient.getItemRenderer(par2ItemStack, type); -+ } -+ + if (customRenderer != null) + { -+ this.mc.renderEngine.bindTexture(par2ItemStack.getItemSpriteNumber() == 0 ? "/terrain.png" : "/gui/items.png"); -+ ForgeHooksClient.renderEquippedItem(type, customRenderer, renderBlocksInstance, par1EntityLiving, par2ItemStack); ++ texturemanager.func_110577_a(texturemanager.func_130087_a(par2ItemStack.getItemSpriteNumber())); ++ ForgeHooksClient.renderEquippedItem(type, customRenderer, renderBlocksInstance, par1EntityLivingBase, par2ItemStack); + } + else if (block != null && par2ItemStack.getItemSpriteNumber() == 0 && RenderBlocks.renderItemIn3d(Block.blocksList[par2ItemStack.itemID].getRenderType())) { - this.mc.renderEngine.bindTexture("/terrain.png"); + texturemanager.func_110577_a(texturemanager.func_130087_a(0)); this.renderBlocksInstance.renderBlockAsItem(Block.blocksList[par2ItemStack.itemID], par2ItemStack.getItemDamage(), 1.0F); -@@ -272,7 +306,7 @@ +@@ -266,7 +292,7 @@ Render render; RenderPlayer renderplayer; @@ -74,8 +66,8 @@ + if (itemstack != null && itemstack.getItem() instanceof ItemMap) { GL11.glPushMatrix(); - f4 = 0.8F; -@@ -340,11 +374,20 @@ + f12 = 0.8F; +@@ -333,11 +359,20 @@ tessellator.addVertexWithUV((double)(128 + b0), (double)(0 - b0), 0.0D, 1.0D, 0.0D); tessellator.addVertexWithUV((double)(0 - b0), (double)(0 - b0), 0.0D, 0.0D, 0.0D); tessellator.draw(); @@ -83,7 +75,7 @@ - - if (mapdata != null) - { -- this.mapItemRenderer.renderMap(this.mc.thePlayer, this.mc.renderEngine, mapdata); +- this.mapItemRenderer.func_111275_a(this.mc.thePlayer, this.mc.func_110434_K(), mapdata); + + IItemRenderer custom = MinecraftForgeClient.getItemRenderer(itemstack, FIRST_PERSON_MAP); + MapData mapdata = ((ItemMap)itemstack.getItem()).getMapData(itemstack, this.mc.theWorld); @@ -92,34 +84,34 @@ + { + if (mapdata != null) + { -+ this.mapItemRenderer.renderMap(this.mc.thePlayer, this.mc.renderEngine, mapdata); ++ this.mapItemRenderer.func_111275_a(this.mc.thePlayer, this.mc.func_110434_K(), mapdata); + } + } + else + { -+ custom.renderItem(FIRST_PERSON_MAP, itemstack, mc.thePlayer, mc.renderEngine, mapdata); ++ custom.renderItem(FIRST_PERSON_MAP, itemstack, mc.thePlayer, mc.func_110434_K(), mapdata); } GL11.glPopMatrix(); -@@ -446,17 +489,20 @@ +@@ -439,17 +474,20 @@ if (itemstack.getItem().requiresMultipleRenderPasses()) { - this.renderItem(entityclientplayermp, itemstack, 0); - int i1 = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, 1); -- f10 = (float)(i1 >> 16 & 255) / 255.0F; -- f11 = (float)(i1 >> 8 & 255) / 255.0F; -- f12 = (float)(i1 & 255) / 255.0F; -- GL11.glColor4f(f3 * f10, f3 * f11, f3 * f12, 1.0F); +- f11 = (float)(i1 >> 16 & 255) / 255.0F; +- f13 = (float)(i1 >> 8 & 255) / 255.0F; +- f14 = (float)(i1 & 255) / 255.0F; +- GL11.glColor4f(f5 * f11, f5 * f13, f5 * f14, 1.0F); - this.renderItem(entityclientplayermp, itemstack, 1); + this.renderItem(entityclientplayermp, itemstack, 0, ItemRenderType.EQUIPPED_FIRST_PERSON); + for (int x = 1; x < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); x++) + { + int i1 = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, x); -+ f10 = (float)(i1 >> 16 & 255) / 255.0F; -+ f11 = (float)(i1 >> 8 & 255) / 255.0F; -+ f12 = (float)(i1 & 255) / 255.0F; -+ GL11.glColor4f(f3 * f10, f3 * f11, f3 * f12, 1.0F); ++ f11 = (float)(i1 >> 16 & 255) / 255.0F; ++ f13 = (float)(i1 >> 8 & 255) / 255.0F; ++ f14 = (float)(i1 & 255) / 255.0F; ++ GL11.glColor4f(f5 * f11, f5 * f13, f5 * f14, 1.0F); + this.renderItem(entityclientplayermp, itemstack, x, ItemRenderType.EQUIPPED_FIRST_PERSON); + } } diff --git a/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch b/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch index 4cddf89ef..f2af3b8a8 100644 --- a/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch @@ -3,7 +3,7 @@ @@ -25,6 +25,10 @@ * True if the renderer supports multitextures and the OpenGL version != 1.3 */ - private static boolean useMultitextureARB = false; + private static boolean useMultitextureARB; + + /* Stores the last values sent into setLightmapTextureCoords */ + public static float lastBrightnessX = 0.0f; diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderBlocks.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderBlocks.java.patch index d8f2dc673..460445999 100644 --- a/patches/minecraft/net/minecraft/client/renderer/RenderBlocks.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/RenderBlocks.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/RenderBlocks.java +++ ../src_work/minecraft/net/minecraft/client/renderer/RenderBlocks.java -@@ -44,6 +44,8 @@ +@@ -45,6 +45,8 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; @@ -9,7 +9,7 @@ @SideOnly(Side.CLIENT) public class RenderBlocks { -@@ -533,9 +535,8 @@ +@@ -534,9 +536,8 @@ public boolean renderBlockBed(Block par1Block, int par2, int par3, int par4) { Tessellator tessellator = Tessellator.instance; @@ -21,7 +21,7 @@ float f = 0.5F; float f1 = 1.0F; float f2 = 0.8F; -@@ -544,6 +545,7 @@ +@@ -545,6 +546,7 @@ tessellator.setBrightness(j1); tessellator.setColorOpaque_F(f, f, f); Icon icon = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 0); @@ -29,7 +29,7 @@ double d0 = (double)icon.getMinU(); double d1 = (double)icon.getMaxU(); double d2 = (double)icon.getMinV(); -@@ -560,6 +562,7 @@ +@@ -561,6 +563,7 @@ tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4)); tessellator.setColorOpaque_F(f1, f1, f1); icon = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 1); @@ -37,7 +37,7 @@ d0 = (double)icon.getMinU(); d1 = (double)icon.getMaxU(); d2 = (double)icon.getMinV(); -@@ -2351,7 +2354,7 @@ +@@ -2358,7 +2361,7 @@ double d9; double d10; @@ -46,7 +46,7 @@ { float f1 = 0.2F; float f2 = 0.0625F; -@@ -2371,7 +2374,7 @@ +@@ -2378,7 +2381,7 @@ d0 = d5; } @@ -55,7 +55,7 @@ { tessellator.addVertexWithUV((double)((float)par2 + f1), (double)((float)par3 + f + f2), (double)(par4 + 1), d2, d1); tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + f2), (double)(par4 + 1), d2, d3); -@@ -2383,7 +2386,7 @@ +@@ -2390,7 +2393,7 @@ tessellator.addVertexWithUV((double)((float)par2 + f1), (double)((float)par3 + f + f2), (double)(par4 + 1), d2, d1); } @@ -64,7 +64,7 @@ { tessellator.addVertexWithUV((double)((float)(par2 + 1) - f1), (double)((float)par3 + f + f2), (double)(par4 + 0), d0, d1); tessellator.addVertexWithUV((double)(par2 + 1 - 0), (double)((float)(par3 + 0) + f2), (double)(par4 + 0), d0, d3); -@@ -2395,7 +2398,7 @@ +@@ -2402,7 +2405,7 @@ tessellator.addVertexWithUV((double)((float)(par2 + 1) - f1), (double)((float)par3 + f + f2), (double)(par4 + 0), d0, d1); } @@ -73,7 +73,7 @@ { tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + f + f2), (double)((float)par4 + f1), d2, d1); tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + f2), (double)(par4 + 0), d2, d3); -@@ -2407,7 +2410,7 @@ +@@ -2414,7 +2417,7 @@ tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + f + f2), (double)((float)par4 + f1), d2, d1); } @@ -82,7 +82,7 @@ { tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + f + f2), (double)((float)(par4 + 1) - f1), d0, d1); tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)(par3 + 0) + f2), (double)(par4 + 1 - 0), d0, d3); -@@ -2419,7 +2422,7 @@ +@@ -2426,7 +2429,7 @@ tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + f + f2), (double)((float)(par4 + 1) - f1), d0, d1); } @@ -91,7 +91,7 @@ { d5 = (double)par2 + 0.5D + 0.5D; d6 = (double)par2 + 0.5D - 0.5D; -@@ -3050,10 +3053,10 @@ +@@ -3057,10 +3060,10 @@ double d17 = (double)par2 + 0.5D + 0.0625D; double d18 = (double)par4 + 0.5D - 0.0625D; double d19 = (double)par4 + 0.5D + 0.0625D; @@ -105,4 +105,4 @@ + boolean flag3 = par1BlockPane.canPaneConnectTo(this.blockAccess,par2, par3, par4, EAST); boolean flag4 = par1BlockPane.shouldSideBeRendered(this.blockAccess, par2, par3 + 1, par4, 1); boolean flag5 = par1BlockPane.shouldSideBeRendered(this.blockAccess, par2, par3 - 1, par4, 0); - + double d20 = 0.01D; diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch index c5e5bf901..7922399bd 100644 --- a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/RenderGlobal.java +++ ../src_work/minecraft/net/minecraft/client/renderer/RenderGlobal.java -@@ -65,6 +65,9 @@ +@@ -67,6 +67,9 @@ import org.lwjgl.opengl.ARBOcclusionQuery; import org.lwjgl.opengl.GL11; @@ -10,7 +10,7 @@ @SideOnly(Side.CLIENT) public class RenderGlobal implements IWorldAccess { -@@ -443,35 +446,47 @@ +@@ -446,35 +449,47 @@ */ public void renderEntities(Vec3 par1Vec3, ICamera par2ICamera, float par3) { @@ -26,32 +26,32 @@ else { this.theWorld.theProfiler.startSection("prepare"); -- TileEntityRenderer.instance.cacheActiveRenderInfo(this.theWorld, this.renderEngine, this.mc.fontRenderer, this.mc.renderViewEntity, par3); -- RenderManager.instance.cacheActiveRenderInfo(this.theWorld, this.renderEngine, this.mc.fontRenderer, this.mc.renderViewEntity, this.mc.pointedEntityLiving, this.mc.gameSettings, par3); +- TileEntityRenderer.instance.cacheActiveRenderInfo(this.theWorld, this.mc.func_110434_K(), this.mc.fontRenderer, this.mc.renderViewEntity, par3); +- RenderManager.instance.cacheActiveRenderInfo(this.theWorld, this.mc.func_110434_K(), this.mc.fontRenderer, this.mc.renderViewEntity, this.mc.pointedEntityLiving, this.mc.gameSettings, par3); - this.countEntitiesTotal = 0; - this.countEntitiesRendered = 0; - this.countEntitiesHidden = 0; -- EntityLiving entityliving = this.mc.renderViewEntity; -- RenderManager.renderPosX = entityliving.lastTickPosX + (entityliving.posX - entityliving.lastTickPosX) * (double)par3; -- RenderManager.renderPosY = entityliving.lastTickPosY + (entityliving.posY - entityliving.lastTickPosY) * (double)par3; -- RenderManager.renderPosZ = entityliving.lastTickPosZ + (entityliving.posZ - entityliving.lastTickPosZ) * (double)par3; -- TileEntityRenderer.staticPlayerX = entityliving.lastTickPosX + (entityliving.posX - entityliving.lastTickPosX) * (double)par3; -- TileEntityRenderer.staticPlayerY = entityliving.lastTickPosY + (entityliving.posY - entityliving.lastTickPosY) * (double)par3; -- TileEntityRenderer.staticPlayerZ = entityliving.lastTickPosZ + (entityliving.posZ - entityliving.lastTickPosZ) * (double)par3; +- EntityLivingBase entitylivingbase = this.mc.renderViewEntity; +- RenderManager.renderPosX = entitylivingbase.lastTickPosX + (entitylivingbase.posX - entitylivingbase.lastTickPosX) * (double)par3; +- RenderManager.renderPosY = entitylivingbase.lastTickPosY + (entitylivingbase.posY - entitylivingbase.lastTickPosY) * (double)par3; +- RenderManager.renderPosZ = entitylivingbase.lastTickPosZ + (entitylivingbase.posZ - entitylivingbase.lastTickPosZ) * (double)par3; +- TileEntityRenderer.staticPlayerX = entitylivingbase.lastTickPosX + (entitylivingbase.posX - entitylivingbase.lastTickPosX) * (double)par3; +- TileEntityRenderer.staticPlayerY = entitylivingbase.lastTickPosY + (entitylivingbase.posY - entitylivingbase.lastTickPosY) * (double)par3; +- TileEntityRenderer.staticPlayerZ = entitylivingbase.lastTickPosZ + (entitylivingbase.posZ - entitylivingbase.lastTickPosZ) * (double)par3; + if (pass == 0) + { -+ TileEntityRenderer.instance.cacheActiveRenderInfo(this.theWorld, this.renderEngine, this.mc.fontRenderer, this.mc.renderViewEntity, par3); -+ RenderManager.instance.cacheActiveRenderInfo(this.theWorld, this.renderEngine, this.mc.fontRenderer, this.mc.renderViewEntity, this.mc.pointedEntityLiving, this.mc.gameSettings, par3); ++ TileEntityRenderer.instance.cacheActiveRenderInfo(this.theWorld, this.mc.func_110434_K(), this.mc.fontRenderer, this.mc.renderViewEntity, par3); ++ RenderManager.instance.cacheActiveRenderInfo(this.theWorld, this.mc.func_110434_K(), this.mc.fontRenderer, this.mc.renderViewEntity, this.mc.pointedEntityLiving, this.mc.gameSettings, par3); + this.countEntitiesTotal = 0; + this.countEntitiesRendered = 0; + this.countEntitiesHidden = 0; -+ EntityLiving entityliving = this.mc.renderViewEntity; -+ RenderManager.renderPosX = entityliving.lastTickPosX + (entityliving.posX - entityliving.lastTickPosX) * (double)par3; -+ RenderManager.renderPosY = entityliving.lastTickPosY + (entityliving.posY - entityliving.lastTickPosY) * (double)par3; -+ RenderManager.renderPosZ = entityliving.lastTickPosZ + (entityliving.posZ - entityliving.lastTickPosZ) * (double)par3; -+ TileEntityRenderer.staticPlayerX = entityliving.lastTickPosX + (entityliving.posX - entityliving.lastTickPosX) * (double)par3; -+ TileEntityRenderer.staticPlayerY = entityliving.lastTickPosY + (entityliving.posY - entityliving.lastTickPosY) * (double)par3; -+ TileEntityRenderer.staticPlayerZ = entityliving.lastTickPosZ + (entityliving.posZ - entityliving.lastTickPosZ) * (double)par3; ++ EntityLivingBase entitylivingbase = this.mc.renderViewEntity; ++ RenderManager.renderPosX = entitylivingbase.lastTickPosX + (entitylivingbase.posX - entitylivingbase.lastTickPosX) * (double)par3; ++ RenderManager.renderPosY = entitylivingbase.lastTickPosY + (entitylivingbase.posY - entitylivingbase.lastTickPosY) * (double)par3; ++ RenderManager.renderPosZ = entitylivingbase.lastTickPosZ + (entitylivingbase.posZ - entitylivingbase.lastTickPosZ) * (double)par3; ++ TileEntityRenderer.staticPlayerX = entitylivingbase.lastTickPosX + (entitylivingbase.posX - entitylivingbase.lastTickPosX) * (double)par3; ++ TileEntityRenderer.staticPlayerY = entitylivingbase.lastTickPosY + (entitylivingbase.posY - entitylivingbase.lastTickPosY) * (double)par3; ++ TileEntityRenderer.staticPlayerZ = entitylivingbase.lastTickPosZ + (entitylivingbase.posZ - entitylivingbase.lastTickPosZ) * (double)par3; + } this.mc.entityRenderer.enableLightmap((double)par3); this.theWorld.theProfiler.endStartSection("global"); @@ -71,7 +71,7 @@ ++this.countEntitiesRendered; if (entity.isInRangeToRenderVec3D(par1Vec3)) -@@ -485,6 +500,7 @@ +@@ -488,6 +503,7 @@ for (i = 0; i < list.size(); ++i) { entity = (Entity)list.get(i); @@ -79,7 +79,7 @@ if (entity.isInRangeToRenderVec3D(par1Vec3) && (entity.ignoreFrustumCheck || par2ICamera.isBoundingBoxInFrustum(entity.boundingBox) || entity.riddenByEntity == this.mc.thePlayer) && (entity != this.mc.renderViewEntity || this.mc.gameSettings.thirdPersonView != 0 || this.mc.renderViewEntity.isPlayerSleeping()) && this.theWorld.blockExists(MathHelper.floor_double(entity.posX), 0, MathHelper.floor_double(entity.posZ))) { -@@ -498,7 +514,11 @@ +@@ -501,7 +517,11 @@ for (i = 0; i < this.tileEntities.size(); ++i) { @@ -92,7 +92,7 @@ } this.mc.entityRenderer.disableLightmap((double)par3); -@@ -933,6 +953,12 @@ +@@ -936,6 +956,12 @@ */ public void renderSky(float par1) { @@ -105,7 +105,7 @@ if (this.mc.theWorld.provider.dimensionId == 1) { GL11.glDisable(GL11.GL_FOG); -@@ -1171,6 +1197,13 @@ +@@ -1174,6 +1200,13 @@ public void renderClouds(float par1) { @@ -119,15 +119,15 @@ if (this.mc.theWorld.provider.isSurfaceWorld()) { if (this.mc.gameSettings.fancyGraphics) -@@ -1599,6 +1632,11 @@ +@@ -1582,6 +1615,11 @@ } public void drawBlockDamageTexture(Tessellator par1Tessellator, EntityPlayer par2EntityPlayer, float par3) + { -+ drawBlockDamageTexture(par1Tessellator, (EntityLiving)par2EntityPlayer, par3); ++ drawBlockDamageTexture(par1Tessellator, (EntityLivingBase)par2EntityPlayer, par3); + } + -+ public void drawBlockDamageTexture(Tessellator par1Tessellator, EntityLiving par2EntityPlayer, float par3) ++ public void drawBlockDamageTexture(Tessellator par1Tessellator, EntityLivingBase par2EntityPlayer, float par3) { double d0 = par2EntityPlayer.lastTickPosX + (par2EntityPlayer.posX - par2EntityPlayer.lastTickPosX) * (double)par3; double d1 = par2EntityPlayer.lastTickPosY + (par2EntityPlayer.posY - par2EntityPlayer.lastTickPosY) * (double)par3; diff --git a/patches/minecraft/net/minecraft/client/renderer/Tessellator.java.patch b/patches/minecraft/net/minecraft/client/renderer/Tessellator.java.patch index a735c65ef..82dbc93aa 100644 --- a/patches/minecraft/net/minecraft/client/renderer/Tessellator.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/Tessellator.java.patch @@ -23,7 +23,7 @@ * Boolean used to check whether quads should be drawn as two triangles. Initialized to false and never changed. */ @@ -25,16 +33,16 @@ - private static boolean tryVBO = false; + private static boolean tryVBO; /** The byte buffer used for GL allocation. */ - private ByteBuffer byteBuffer; @@ -44,10 +44,10 @@ /** Raw integer array. */ private int[] rawBuffer; @@ -110,10 +118,10 @@ - public boolean isDrawing = false; + public boolean isDrawing; /** Whether we are currently using VBO or not. */ -- private boolean useVBO = false; +- private boolean useVBO; + private static boolean useVBO = false; /** An IntBuffer used to store the indices of vertex buffer objects. */ @@ -57,7 +57,7 @@ /** * The index of the last VBO used. This is used in round-robin fashion, sequentially, through the vboCount vertex @@ -122,25 +130,28 @@ - private int vboIndex = 0; + private int vboIndex; /** Number of vertex buffer objects allocated for use. */ - private int vboCount = 10; diff --git a/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch index 2329907e8..49e9cd3ea 100644 --- a/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch @@ -1,23 +1,15 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/WorldRenderer.java +++ ../src_work/minecraft/net/minecraft/client/renderer/WorldRenderer.java -@@ -17,13 +17,15 @@ - import net.minecraft.world.chunk.Chunk; - import org.lwjgl.opengl.GL11; - -+import net.minecraftforge.client.ForgeHooksClient; -+ - @SideOnly(Side.CLIENT) - public class WorldRenderer - { +@@ -23,7 +23,7 @@ /** Reference to the World object. */ public World worldObj; private int glRenderList = -1; - private static Tessellator tessellator = Tessellator.instance; + //private static Tessellator tessellator = Tessellator.instance; - public static int chunksUpdated = 0; + public static int chunksUpdated; public int posX; public int posY; -@@ -192,15 +194,16 @@ +@@ -192,15 +192,16 @@ GL11.glTranslatef(-8.0F, -8.0F, -8.0F); GL11.glScalef(f, f, f); GL11.glTranslatef(8.0F, 8.0F, 8.0F); @@ -37,7 +29,7 @@ { TileEntity tileentity = chunkcache.getBlockTileEntity(k2, i2, j2); -@@ -212,14 +215,15 @@ +@@ -212,14 +213,15 @@ int i3 = block.getRenderBlockPass(); @@ -56,7 +48,7 @@ } } } -@@ -228,10 +232,11 @@ +@@ -228,10 +230,11 @@ if (flag2) { diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch index a095f896c..0a66ac622 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch @@ -1,7 +1,7 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java +++ ../src_work/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java -@@ -11,9 +11,15 @@ - import net.minecraft.entity.EntityLiving; +@@ -14,9 +14,15 @@ + import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.EnumArmorMaterial; import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; @@ -16,25 +16,72 @@ @SideOnly(Side.CLIENT) public class RenderBiped extends RenderLiving -@@ -59,7 +65,7 @@ +@@ -49,11 +55,13 @@ + this.field_82425_h = new ModelBiped(0.5F); + } + ++ @Deprecated //Use the more sensitve version getArmorResource below + public static ResourceLocation func_110857_a(ItemArmor par0ItemArmor, int par1) + { + return func_110858_a(par0ItemArmor, par1, (String)null); + } + ++ @Deprecated //Use the more sensitve version getArmorResource below + public static ResourceLocation func_110858_a(ItemArmor par0ItemArmor, int par1, String par2Str) + { + String s1 = String.format("textures/models/armor/%s_layer_%d%s.png", new Object[] {bipedArmorFilenamePrefix[par0ItemArmor.renderIndex], Integer.valueOf(par1 == 2 ? 2 : 1), par2Str == null ? "" : String.format("_%s", new Object[]{par2Str})}); +@@ -68,6 +76,33 @@ + return resourcelocation; + } + ++ /** ++ * More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide. ++ * ++ * @param entity Entity wearing the armor ++ * @param stack ItemStack for the armor ++ * @param slot Slot ID that the item is in ++ * @param type Subtype, can be null or "overlay" ++ * @return ResourceLocation pointing at the armor's texture ++ */ ++ public static ResourceLocation getArmorResource(Entity entity, ItemStack stack, int slot, String type) ++ { ++ ItemArmor item = (ItemArmor)stack.getItem(); ++ String s1 = String.format("textures/models/armor/%s_layer_%d%s.png", ++ bipedArmorFilenamePrefix[item.renderIndex], (slot == 2 ? 2 : 1), type == null ? "" : String.format("_%s", type)); ++ ++ s1 = ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, (slot == 2 ? 2 : 1), type); ++ ResourceLocation resourcelocation = (ResourceLocation)field_110859_k.get(s1); ++ ++ if (resourcelocation == null) ++ { ++ resourcelocation = new ResourceLocation(s1); ++ field_110859_k.put(s1, resourcelocation); ++ } ++ ++ return resourcelocation; ++ } ++ + protected int func_130006_a(EntityLiving par1EntityLiving, int par2, float par3) + { + ItemStack itemstack = par1EntityLiving.getCurrentArmor(3 - par2); +@@ -79,7 +114,7 @@ if (item instanceof ItemArmor) { ItemArmor itemarmor = (ItemArmor)item; -- this.loadTexture("/armor/" + bipedArmorFilenamePrefix[itemarmor.renderIndex] + "_" + (par2 == 2 ? 2 : 1) + ".png"); -+ this.loadTexture(ForgeHooksClient.getArmorTexture(par1EntityLiving, itemstack, "/armor/" + bipedArmorFilenamePrefix[itemarmor.renderIndex] + "_" + (par2 == 2 ? 2 : 1) + ".png", par2, 1)); +- this.func_110776_a(func_110857_a(itemarmor, par2)); ++ this.func_110776_a(getArmorResource(par1EntityLiving, itemstack, par2, null)); ModelBiped modelbiped = par2 == 2 ? this.field_82425_h : this.field_82423_g; modelbiped.bipedHead.showModel = par2 == 0; modelbiped.bipedHeadwear.showModel = par2 == 0; -@@ -68,6 +74,7 @@ +@@ -88,15 +123,17 @@ modelbiped.bipedLeftArm.showModel = par2 == 1; modelbiped.bipedRightLeg.showModel = par2 == 2 || par2 == 3; modelbiped.bipedLeftLeg.showModel = par2 == 2 || par2 == 3; + modelbiped = ForgeHooksClient.getArmorModel(par1EntityLiving, itemstack, par2, modelbiped); this.setRenderPassModel(modelbiped); - - if (modelbiped != null) -@@ -87,9 +94,10 @@ - + modelbiped.onGround = this.mainModel.onGround; + modelbiped.isRiding = this.mainModel.isRiding; + modelbiped.isChild = this.mainModel.isChild; float f1 = 1.0F; - if (itemarmor.getArmorMaterial() == EnumArmorMaterial.CLOTH) @@ -47,16 +94,16 @@ float f2 = (float)(j >> 16 & 255) / 255.0F; float f3 = (float)(j >> 8 & 255) / 255.0F; float f4 = (float)(j & 255) / 255.0F; -@@ -128,7 +136,7 @@ +@@ -134,7 +171,7 @@ + if (item instanceof ItemArmor) { - ItemArmor itemarmor = (ItemArmor)item; -- this.loadTexture("/armor/" + bipedArmorFilenamePrefix[itemarmor.renderIndex] + "_" + (par2 == 2 ? 2 : 1) + "_b.png"); -+ this.loadTexture(ForgeHooksClient.getArmorTexture(par1EntityLiving, itemstack, "/armor/" + bipedArmorFilenamePrefix[itemarmor.renderIndex] + "_" + (par2 == 2 ? 2 : 1) + "_b.png", par2, 2)); +- this.func_110776_a(func_110858_a((ItemArmor)item, par2, "overlay")); ++ this.func_110776_a(getArmorResource(par1EntityLiving, itemstack, par2, "overlay")); float f1 = 1.0F; GL11.glColor3f(f1, f1, f1); } -@@ -174,9 +182,12 @@ +@@ -185,9 +222,12 @@ GL11.glPushMatrix(); this.modelBipedMain.bipedHead.postRender(0.0625F); @@ -72,7 +119,7 @@ { f2 = 0.625F; GL11.glTranslatef(0.0F, -0.25F, 0.0F); -@@ -218,7 +229,10 @@ +@@ -229,7 +269,10 @@ this.modelBipedMain.bipedRightArm.postRender(0.0625F); GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F); @@ -84,7 +131,7 @@ { f2 = 0.5F; GL11.glTranslatef(0.0F, 0.1875F, -0.3125F); -@@ -265,7 +279,10 @@ +@@ -276,7 +319,10 @@ if (itemstack.getItem().requiresMultipleRenderPasses()) { diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch index fc6859159..30fa5a333 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/entity/RenderItem.java +++ ../src_work/minecraft/net/minecraft/client/renderer/entity/RenderItem.java -@@ -19,6 +19,8 @@ +@@ -21,6 +21,8 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; @@ -9,7 +9,7 @@ @SideOnly(Side.CLIENT) public class RenderItem extends Render { -@@ -49,29 +51,9 @@ +@@ -53,29 +55,9 @@ if (itemstack.getItem() != null) { GL11.glPushMatrix(); @@ -41,11 +41,11 @@ GL11.glTranslatef((float)par2, (float)par4 + f2, (float)par6); GL11.glEnable(GL12.GL_RESCALE_NORMAL); -@@ -80,9 +62,18 @@ - float f5; +@@ -84,9 +66,18 @@ float f6; + int i; -- if (itemstack.getItemSpriteNumber() == 0 && Block.blocksList[itemstack.itemID] != null && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) +- if (itemstack.getItemSpriteNumber() == 0 && itemstack.itemID < Block.blocksList.length && Block.blocksList[itemstack.itemID] != null && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) - { - Block block = Block.blocksList[itemstack.itemID]; + Block block = null; @@ -63,9 +63,9 @@ GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F); if (renderInFrame) -@@ -138,10 +129,10 @@ - - this.loadTexture("/gui/items.png"); +@@ -139,10 +130,10 @@ + GL11.glScalef(0.5F, 0.5F, 0.5F); + } - for (int k = 0; k <= 1; ++k) + for (int k = 0; k < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++k) @@ -76,7 +76,7 @@ f8 = 1.0F; if (this.renderWithColor) -@@ -241,32 +232,26 @@ +@@ -240,32 +231,26 @@ f11 = 0.021875F; ItemStack itemstack = par1EntityItem.getEntityItem(); int j = itemstack.stackSize; @@ -122,9 +122,9 @@ + + if (itemstack.getItemSpriteNumber() == 0) { - this.loadTexture("/terrain.png"); + this.func_110776_a(TextureMap.field_110575_b); } -@@ -356,10 +341,10 @@ +@@ -353,10 +338,10 @@ float f1; float f2; @@ -132,41 +132,41 @@ + Block block = (k < Block.blocksList.length ? Block.blocksList[k] : null); + if (par3ItemStack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d(Block.blocksList[k].getRenderType())) { - par2RenderEngine.bindTexture("/terrain.png"); + par2TextureManager.func_110577_a(TextureMap.field_110575_b); - Block block = Block.blocksList[k]; GL11.glPushMatrix(); GL11.glTranslatef((float)(par4 - 2), (float)(par5 + 3), -3.0F + this.zLevel); GL11.glScalef(10.0F, 10.0F, 10.0F); -@@ -390,11 +375,11 @@ - if (Item.itemsList[k].requiresMultipleRenderPasses()) - { - GL11.glDisable(GL11.GL_LIGHTING); -- par2RenderEngine.bindTexture("/gui/items.png"); +@@ -383,11 +368,11 @@ + else if (Item.itemsList[k].requiresMultipleRenderPasses()) + { + GL11.glDisable(GL11.GL_LIGHTING); +- par2TextureManager.func_110577_a(TextureMap.field_110576_c); - -- for (j1 = 0; j1 <= 1; ++j1) -- { -- Icon icon1 = Item.itemsList[k].getIconFromDamageForRenderPass(l, j1); -+ par2RenderEngine.bindTexture(par3ItemStack.getItemSpriteNumber() == 0 ? "/terrain.png" : "/gui/items.png"); +- for (int j1 = 0; j1 <= 1; ++j1) +- { +- Icon icon = Item.itemsList[k].getIconFromDamageForRenderPass(l, j1); ++ par2TextureManager.func_110577_a(par3ItemStack.getItemSpriteNumber() == 0 ? TextureMap.field_110575_b : TextureMap.field_110576_c); + -+ for (j1 = 0; j1 < Item.itemsList[k].getRenderPasses(l); ++j1) -+ { -+ Icon icon1 = Item.itemsList[k].getIcon(par3ItemStack, j1); - int k1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, j1); - f = (float)(k1 >> 16 & 255) / 255.0F; - f1 = (float)(k1 >> 8 & 255) / 255.0F; -@@ -453,7 +438,10 @@ ++ for (int j1 = 0; j1 <= Item.itemsList[k].getRenderPasses(l); ++j1) ++ { ++ Icon icon = Item.itemsList[k].getIcon(par3ItemStack, j1); + int k1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, j1); + f1 = (float)(k1 >> 16 & 255) / 255.0F; + f2 = (float)(k1 >> 8 & 255) / 255.0F; +@@ -435,7 +420,10 @@ { if (par3ItemStack != null) { -- this.renderItemIntoGUI(par1FontRenderer, par2RenderEngine, par3ItemStack, par4, par5); -+ if (!ForgeHooksClient.renderInventoryItem(renderBlocks, par2RenderEngine, par3ItemStack, renderWithColor, zLevel, (float)par4, (float)par5)) +- this.func_110795_a(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5); ++ if (!ForgeHooksClient.renderInventoryItem(renderBlocks, par2TextureManager, par3ItemStack, renderWithColor, zLevel, (float)par4, (float)par5)) + { -+ this.renderItemIntoGUI(par1FontRenderer, par2RenderEngine, par3ItemStack, par4, par5); ++ this.func_110795_a(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5); + } if (par3ItemStack.hasEffect()) { -@@ -590,4 +578,47 @@ +@@ -573,4 +561,47 @@ { this.doRenderItem((EntityItem)par1Entity, par2, par4, par6, par8, par9); } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderLiving.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderLiving.java.patch deleted file mode 100644 index e0c91b751..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderLiving.java.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- ../src_base/minecraft/net/minecraft/client/renderer/entity/RenderLiving.java -+++ ../src_work/minecraft/net/minecraft/client/renderer/entity/RenderLiving.java -@@ -15,6 +15,9 @@ - import net.minecraft.entity.EntityLiving; - import net.minecraft.entity.projectile.EntityArrow; - import net.minecraft.util.MathHelper; -+import net.minecraftforge.client.event.RenderLivingEvent; -+import net.minecraftforge.common.MinecraftForge; -+ - import org.lwjgl.opengl.GL11; - import org.lwjgl.opengl.GL12; - -@@ -25,6 +28,8 @@ - - /** The model to be used during the render passes. */ - protected ModelBase renderPassModel; -+ public static float NAME_TAG_RANGE = 64.0f; -+ public static float NAME_TAG_RANGE_SNEAK = 32.0f; - - public RenderLiving(ModelBase par1ModelBase, float par2) - { -@@ -413,12 +418,13 @@ - */ - protected void passSpecialRender(EntityLiving par1EntityLiving, double par2, double par4, double par6) - { -+ if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Specials.Pre(par1EntityLiving, this))) return; - if (Minecraft.isGuiEnabled() && par1EntityLiving != this.renderManager.livingPlayer && !par1EntityLiving.func_98034_c(Minecraft.getMinecraft().thePlayer) && (par1EntityLiving.func_94059_bO() || par1EntityLiving.func_94056_bM() && par1EntityLiving == this.renderManager.field_96451_i)) - { - float f = 1.6F; - float f1 = 0.016666668F * f; - double d3 = par1EntityLiving.getDistanceSqToEntity(this.renderManager.livingPlayer); -- float f2 = par1EntityLiving.isSneaking() ? 32.0F : 64.0F; -+ float f2 = par1EntityLiving.isSneaking() ? NAME_TAG_RANGE_SNEAK : NAME_TAG_RANGE; - - if (d3 < (double)(f2 * f2)) - { -@@ -462,6 +468,7 @@ - } - } - } -+ MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Specials.Post(par1EntityLiving, this)); - } - - protected void func_96449_a(EntityLiving par1EntityLiving, double par2, double par4, double par6, String par8Str, float par9, double par10) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch index 3bf896870..d547f37a4 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch @@ -1,22 +1,22 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/entity/RenderManager.java +++ ../src_work/minecraft/net/minecraft/client/renderer/entity/RenderManager.java -@@ -221,12 +221,14 @@ +@@ -227,12 +227,14 @@ - if (par4EntityLiving.isPlayerSleeping()) + if (par4EntityLivingBase.isPlayerSleeping()) { -- int i = par1World.getBlockId(MathHelper.floor_double(par4EntityLiving.posX), MathHelper.floor_double(par4EntityLiving.posY), MathHelper.floor_double(par4EntityLiving.posZ)); +- int i = par1World.getBlockId(MathHelper.floor_double(par4EntityLivingBase.posX), MathHelper.floor_double(par4EntityLivingBase.posY), MathHelper.floor_double(par4EntityLivingBase.posZ)); - - if (i == Block.bed.blockID) -+ int x = MathHelper.floor_double(par4EntityLiving.posX); -+ int y = MathHelper.floor_double(par4EntityLiving.posY); -+ int z = MathHelper.floor_double(par4EntityLiving.posZ); ++ int x = MathHelper.floor_double(par4EntityLivingBase.posX); ++ int y = MathHelper.floor_double(par4EntityLivingBase.posY); ++ int z = MathHelper.floor_double(par4EntityLivingBase.posZ); + Block block = Block.blocksList[par1World.getBlockId(x, y, z)]; + -+ if (block != null && block.isBed(par1World, x, y, z, par4EntityLiving)) ++ if (block != null && block.isBed(par1World, x, y, z, par4EntityLivingBase)) { -- int j = par1World.getBlockMetadata(MathHelper.floor_double(par4EntityLiving.posX), MathHelper.floor_double(par4EntityLiving.posY), MathHelper.floor_double(par4EntityLiving.posZ)); +- int j = par1World.getBlockMetadata(MathHelper.floor_double(par4EntityLivingBase.posX), MathHelper.floor_double(par4EntityLivingBase.posY), MathHelper.floor_double(par4EntityLivingBase.posZ)); - int k = j & 3; -+ int k = block.getBedDirection(par1World, x, y, z);; ++ int k = block.getBedDirection(par1World, x, y, z); this.playerViewY = (float)(k * 90 + 180); this.playerViewX = 0.0F; } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch index 724baf72e..0d50cd9cd 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java +++ ../src_work/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java -@@ -19,7 +19,16 @@ +@@ -22,7 +22,16 @@ import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.scoreboard.Scoreboard; import net.minecraft.util.MathHelper; @@ -16,23 +16,12 @@ +import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D; @SideOnly(Side.CLIENT) - public class RenderPlayer extends RenderLiving -@@ -28,6 +37,10 @@ - private ModelBiped modelArmorChestplate; - private ModelBiped modelArmor; - public static String[] armorFilenamePrefix = new String[] {"cloth", "chain", "iron", "diamond", "gold"}; -+ @Deprecated //Old dead code, tags are now in RenderLiving -+ public static float NAME_TAG_RANGE = 64.0f; -+ @Deprecated //Old dead code, tags are now in RenderLiving -+ public static float NAME_TAG_RANGE_SNEAK = 32.0f; - - public RenderPlayer() + public class RenderPlayer extends RendererLivingEntity +@@ -44,6 +53,13 @@ { -@@ -49,6 +62,13 @@ - { - ItemStack itemstack = par1EntityPlayer.inventory.armorItemInSlot(3 - par2); + ItemStack itemstack = par1AbstractClientPlayer.inventory.armorItemInSlot(3 - par2); -+ RenderPlayerEvent.SetArmorModel event = new RenderPlayerEvent.SetArmorModel(par1EntityPlayer, this, 3 - par2, par3, itemstack); ++ RenderPlayerEvent.SetArmorModel event = new RenderPlayerEvent.SetArmorModel(par1AbstractClientPlayer, this, 3 - par2, par3, itemstack); + MinecraftForge.EVENT_BUS.post(event); + if (event.result != -1) + { @@ -42,25 +31,24 @@ if (itemstack != null) { Item item = itemstack.getItem(); -@@ -56,7 +76,7 @@ +@@ -51,7 +67,7 @@ if (item instanceof ItemArmor) { ItemArmor itemarmor = (ItemArmor)item; -- this.loadTexture("/armor/" + armorFilenamePrefix[itemarmor.renderIndex] + "_" + (par2 == 2 ? 2 : 1) + ".png"); -+ this.loadTexture(ForgeHooksClient.getArmorTexture(par1EntityPlayer, itemstack, "/armor/" + armorFilenamePrefix[itemarmor.renderIndex] + "_" + (par2 == 2 ? 2 : 1) + ".png", par2, 1)); +- this.func_110776_a(RenderBiped.func_110857_a(itemarmor, par2)); ++ this.func_110776_a(RenderBiped.getArmorResource(par1AbstractClientPlayer, itemstack, par2, null)); ModelBiped modelbiped = par2 == 2 ? this.modelArmor : this.modelArmorChestplate; modelbiped.bipedHead.showModel = par2 == 0; modelbiped.bipedHeadwear.showModel = par2 == 0; -@@ -65,6 +85,7 @@ +@@ -60,15 +76,17 @@ modelbiped.bipedLeftArm.showModel = par2 == 1; modelbiped.bipedRightLeg.showModel = par2 == 2 || par2 == 3; modelbiped.bipedLeftLeg.showModel = par2 == 2 || par2 == 3; -+ modelbiped = ForgeHooksClient.getArmorModel(par1EntityPlayer, itemstack, par2, modelbiped); ++ modelbiped = ForgeHooksClient.getArmorModel(par1AbstractClientPlayer, itemstack, par2, modelbiped); this.setRenderPassModel(modelbiped); - - if (modelbiped != null) -@@ -84,9 +105,10 @@ - + modelbiped.onGround = this.mainModel.onGround; + modelbiped.isRiding = this.mainModel.isRiding; + modelbiped.isChild = this.mainModel.isChild; float f1 = 1.0F; - if (itemarmor.getArmorMaterial() == EnumArmorMaterial.CLOTH) @@ -73,36 +61,36 @@ float f2 = (float)(j >> 16 & 255) / 255.0F; float f3 = (float)(j >> 8 & 255) / 255.0F; float f4 = (float)(j & 255) / 255.0F; -@@ -125,7 +147,7 @@ +@@ -106,7 +124,7 @@ + if (item instanceof ItemArmor) { - ItemArmor itemarmor = (ItemArmor)item; -- this.loadTexture("/armor/" + armorFilenamePrefix[itemarmor.renderIndex] + "_" + (par2 == 2 ? 2 : 1) + "_b.png"); -+ this.loadTexture(ForgeHooksClient.getArmorTexture(par1EntityPlayer, itemstack, "/armor/" + armorFilenamePrefix[itemarmor.renderIndex] + "_" + (par2 == 2 ? 2 : 1) + "_b.png", par2, 2)); +- this.func_110776_a(RenderBiped.func_110858_a((ItemArmor)item, par2, "overlay")); ++ this.func_110776_a(RenderBiped.getArmorResource(par1AbstractClientPlayer, itemstack, par2, "overlay")); float f1 = 1.0F; GL11.glColor3f(f1, f1, f1); } -@@ -134,6 +156,7 @@ +@@ -115,6 +133,7 @@ - public void renderPlayer(EntityPlayer par1EntityPlayer, double par2, double par4, double par6, float par8, float par9) + public void func_110819_a(AbstractClientPlayer par1AbstractClientPlayer, double par2, double par4, double par6, float par8, float par9) { -+ if (MinecraftForge.EVENT_BUS.post(new RenderPlayerEvent.Pre(par1EntityPlayer, this))) return; ++ if (MinecraftForge.EVENT_BUS.post(new RenderPlayerEvent.Pre(par1AbstractClientPlayer, this))) return; float f2 = 1.0F; GL11.glColor3f(f2, f2, f2); - ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem(); -@@ -165,6 +188,7 @@ + ItemStack itemstack = par1AbstractClientPlayer.inventory.getCurrentItem(); +@@ -146,6 +165,7 @@ this.modelArmorChestplate.aimedBow = this.modelArmor.aimedBow = this.modelBipedMain.aimedBow = false; this.modelArmorChestplate.isSneak = this.modelArmor.isSneak = this.modelBipedMain.isSneak = false; this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = 0; -+ MinecraftForge.EVENT_BUS.post(new RenderPlayerEvent.Post(par1EntityPlayer, this)); ++ MinecraftForge.EVENT_BUS.post(new RenderPlayerEvent.Post(par1AbstractClientPlayer, this)); } - /** -@@ -172,21 +196,30 @@ - */ - protected void renderSpecials(EntityPlayer par1EntityPlayer, float par2) + protected ResourceLocation func_110817_a(AbstractClientPlayer par1AbstractClientPlayer) +@@ -155,21 +175,30 @@ + + protected void func_110820_a(AbstractClientPlayer par1AbstractClientPlayer, float par2) { -+ RenderPlayerEvent.Specials.Pre event = new RenderPlayerEvent.Specials.Pre(par1EntityPlayer, this, par2); ++ RenderPlayerEvent.Specials.Pre event = new RenderPlayerEvent.Specials.Pre(par1AbstractClientPlayer, this, par2); + if (MinecraftForge.EVENT_BUS.post(event)) + { + return; @@ -110,9 +98,9 @@ + float f1 = 1.0F; GL11.glColor3f(f1, f1, f1); - super.renderEquippedItems(par1EntityPlayer, par2); - super.renderArrowsStuckInEntity(par1EntityPlayer, par2); - ItemStack itemstack = par1EntityPlayer.inventory.armorItemInSlot(3); + super.renderEquippedItems(par1AbstractClientPlayer, par2); + super.renderArrowsStuckInEntity(par1AbstractClientPlayer, par2); + ItemStack itemstack = par1AbstractClientPlayer.inventory.armorItemInSlot(3); - if (itemstack != null) + if (itemstack != null && event.renderHelmet) @@ -133,27 +121,26 @@ { f2 = 0.625F; GL11.glTranslatef(0.0F, -0.25F, 0.0F); -@@ -238,7 +271,7 @@ - +@@ -221,6 +250,7 @@ + boolean flag = par1AbstractClientPlayer.func_110310_o().func_110557_a(); + boolean flag1 = !par1AbstractClientPlayer.isInvisible(); + boolean flag2 = !par1AbstractClientPlayer.getHideCape(); ++ flag = event.renderCape && flag; float f6; -- if (this.loadDownloadableImageTexture(par1EntityPlayer.cloakUrl, (String)null) && !par1EntityPlayer.isInvisible() && !par1EntityPlayer.getHideCape()) -+ if (event.renderCape && this.loadDownloadableImageTexture(par1EntityPlayer.cloakUrl, (String)null) && !par1EntityPlayer.isInvisible() && !par1EntityPlayer.getHideCape()) - { - GL11.glPushMatrix(); - GL11.glTranslatef(0.0F, 0.0F, 0.125F); -@@ -286,7 +319,7 @@ + if (flag && flag1 && flag2) +@@ -272,7 +302,7 @@ - ItemStack itemstack1 = par1EntityPlayer.inventory.getCurrentItem(); + ItemStack itemstack1 = par1AbstractClientPlayer.inventory.getCurrentItem(); - if (itemstack1 != null) + if (itemstack1 != null && event.renderItem) { GL11.glPushMatrix(); this.modelBipedMain.bipedRightArm.postRender(0.0625F); -@@ -304,7 +337,11 @@ - enumaction = itemstack1.getItemUseAction(); - } +@@ -292,7 +322,11 @@ + + float f11; - if (itemstack1.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack1.itemID].getRenderType())) + IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack1, EQUIPPED); @@ -162,9 +149,9 @@ + + if (is3D || (isBlock && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack1.itemID].getRenderType()))) { - f3 = 0.5F; + f11 = 0.5F; GL11.glTranslatef(0.0F, 0.1875F, -0.3125F); -@@ -361,7 +398,7 @@ +@@ -349,7 +383,7 @@ if (itemstack1.getItem().requiresMultipleRenderPasses()) { @@ -172,12 +159,12 @@ + for (j = 0; j < itemstack1.getItem().getRenderPasses(itemstack1.getItemDamage()); ++j) { int k = itemstack1.getItem().getColorFromItemStack(itemstack1, j); - f12 = (float)(k >> 16 & 255) / 255.0F; -@@ -383,6 +420,7 @@ + f13 = (float)(k >> 16 & 255) / 255.0F; +@@ -371,6 +405,7 @@ GL11.glPopMatrix(); } -+ MinecraftForge.EVENT_BUS.post(new RenderPlayerEvent.Specials.Post(par1EntityPlayer, this, par2)); ++ MinecraftForge.EVENT_BUS.post(new RenderPlayerEvent.Specials.Post(par1AbstractClientPlayer, this, par2)); } - protected void renderPlayerScale(EntityPlayer par1EntityPlayer, float par2) + protected void renderPlayerScale(AbstractClientPlayer par1AbstractClientPlayer, float par2) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java.patch index bbf94b4ea..79c49ea4e 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java.patch @@ -1,8 +1,8 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java +++ ../src_work/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java -@@ -7,8 +7,14 @@ - import net.minecraft.client.renderer.RenderBlocks; - import net.minecraft.entity.EntityLiving; +@@ -9,8 +9,14 @@ + import net.minecraft.entity.Entity; + import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntitySnowman; +import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; @@ -15,7 +15,7 @@ @SideOnly(Side.CLIENT) public class RenderSnowMan extends RenderLiving -@@ -31,12 +37,15 @@ +@@ -35,12 +41,15 @@ super.renderEquippedItems(par1EntitySnowman, par2); ItemStack itemstack = new ItemStack(Block.pumpkin, 1); diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch index 2ad1b84aa..d67c90cbb 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/texture/Stitcher.java +++ ../src_work/minecraft/net/minecraft/client/renderer/texture/Stitcher.java -@@ -182,7 +182,7 @@ +@@ -184,7 +184,7 @@ if (flag4 ^ flag5) { diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch index f48eacd90..713b936be 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -1,105 +1,40 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/texture/TextureMap.java +++ ../src_work/minecraft/net/minecraft/client/renderer/texture/TextureMap.java -@@ -20,6 +20,8 @@ - import net.minecraft.client.texturepacks.ITexturePack; +@@ -21,6 +21,7 @@ import net.minecraft.item.Item; import net.minecraft.util.Icon; + import net.minecraft.util.ReportedException; +import net.minecraftforge.client.ForgeHooksClient; -+import net.minecraftforge.common.ForgeDummyContainer; @SideOnly(Side.CLIENT) - public class TextureMap implements IconRegister -@@ -48,6 +50,7 @@ - public void refreshTextures() - { - this.textureStichedMap.clear(); + public class TextureMap extends AbstractTexture implements TickableTextureObject, IconRegister +@@ -62,6 +63,7 @@ + Stitcher stitcher = new Stitcher(i, i, true); + this.mapTexturesStiched.clear(); + this.listTextureStiched.clear(); + ForgeHooksClient.onTextureStitchedPre(this); - int i; - int j; - -@@ -91,14 +94,22 @@ - StitchHolder stitchholder = new StitchHolder(texture); - stitcher.addStitchHolder(stitchholder); - hashmap.put(stitchholder, Arrays.asList(new Texture[] {texture})); -- Iterator iterator = this.textureStichedMap.keySet().iterator(); -- -- while (iterator.hasNext()) -- { -- String s = (String)iterator.next(); -- String s1 = this.basePath + s + this.textureExt; -- List list = TextureManager.instance().createTexture(s1); -- -+ -+ for (Map.Entry entry : ((Map)textureStichedMap).entrySet()) -+ { -+ String name = entry.getKey(); -+ String path; -+ if (name.indexOf(':') == -1) -+ { -+ path = this.basePath + name + this.textureExt; -+ } -+ else -+ { -+ String domain = name.substring(0, name.indexOf(':')); -+ String file = name.substring(name.indexOf(':') + 1); -+ path = "mods/" + domain +"/" + basePath + file + textureExt; -+ } -+ List list = TextureManager.instance().createNewTexture(name, path, entry.getValue()); - if (!list.isEmpty()) - { - StitchHolder stitchholder1 = new StitchHolder((Texture)list.get(0)); -@@ -117,7 +128,7 @@ - } - - this.atlasTexture = stitcher.getTexture(); -- iterator = stitcher.getStichSlots().iterator(); -+ Iterator iterator = stitcher.getStichSlots().iterator(); + Iterator iterator = this.field_110574_e.entrySet().iterator(); while (iterator.hasNext()) - { -@@ -151,7 +162,17 @@ - if (list1.size() > 1) - { - this.listTextureStiched.add(texturestitched); -- String s3 = this.basePath + s2 + ".txt"; -+ String s3; -+ if (s2.indexOf(':') == -1) -+ { -+ s3 = basePath + s2 + ".txt"; -+ } -+ else -+ { -+ String domain = s2.substring(0, s2.indexOf(':')); -+ String file = s2.substring(s2.indexOf(':') + 1); -+ s3 = "mods/" + domain + "/" + basePath + file + ".txt"; -+ } - ITexturePack itexturepack = Minecraft.getMinecraft().texturePackList.getSelectedTexturePack(); - boolean flag1 = !itexturepack.func_98138_b("/" + this.basePath + s2 + ".png", false); - -@@ -177,7 +198,11 @@ - texturestitched1.copyFrom(this.missingTextureStiched); +@@ -142,6 +144,7 @@ + textureatlassprite1 = (TextureAtlasSprite)iterator1.next(); + textureatlassprite1.copyFrom(this.missingImage); } - -- this.atlasTexture.writeImage("debug.stitched_" + this.textureName + ".png"); -+ if (!ForgeDummyContainer.disableStitchedFileSaving) -+ { -+ this.atlasTexture.writeImage("debug.stitched_" + this.textureName + ".png"); -+ } + ForgeHooksClient.onTextureStitchedPost(this); - this.atlasTexture.uploadTexture(); } -@@ -202,6 +227,7 @@ + private void func_110573_f() +@@ -212,6 +215,7 @@ if (par1Str == null) { (new RuntimeException("Don\'t register null!")).printStackTrace(); + par1Str = "null"; //Don't allow things to actually register null.. } - TextureStitched texturestitched = (TextureStitched)this.textureStichedMap.get(par1Str); -@@ -219,4 +245,37 @@ + Object object = (TextureAtlasSprite)this.field_110574_e.get(par1Str); +@@ -253,4 +257,37 @@ { - return this.missingTextureStiched; + this.updateAnimations(); } + + //=================================================================================================== @@ -107,14 +42,14 @@ + //=================================================================================================== + /** + * Grabs the registered entry for the specified name, returning null if there was not a entry. -+ * Opposed to func_94245_a, this will not instantiate the entry, useful to test if a maping exists. ++ * Opposed to registerIcon, this will not instantiate the entry, useful to test if a mapping exists. + * + * @param name The name of the entry to find + * @return The registered entry, null if nothing was registered. + */ -+ public TextureStitched getTextureExtry(String name) ++ public TextureAtlasSprite getTextureExtry(String name) + { -+ return (TextureStitched)textureStichedMap.get(name); ++ return (TextureAtlasSprite)field_110574_e.get(name); + } + + /** @@ -125,11 +60,11 @@ + * @param entry Entry instance + * @return True if the entry was added to the map, false otherwise. + */ -+ public boolean setTextureEntry(String name, TextureStitched entry) ++ public boolean setTextureEntry(String name, TextureAtlasSprite entry) + { -+ if (!textureStichedMap.containsKey(name)) ++ if (!field_110574_e.containsKey(name)) + { -+ textureStichedMap.put(name, entry); ++ field_110574_e.put(name, entry); + return true; + } + return false; diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityChestRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityChestRenderer.java.patch index 14ac1a9e6..62171239b 100644 --- a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityChestRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityChestRenderer.java.patch @@ -7,7 +7,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import java.util.Calendar; -@@ -52,7 +53,15 @@ +@@ -60,7 +61,15 @@ if (block instanceof BlockChest && i == 0) { diff --git a/patches/minecraft/net/minecraft/command/CommandHandler.java.patch b/patches/minecraft/net/minecraft/command/CommandHandler.java.patch index a54a0df8b..8529ac966 100644 --- a/patches/minecraft/net/minecraft/command/CommandHandler.java.patch +++ b/patches/minecraft/net/minecraft/command/CommandHandler.java.patch @@ -1,7 +1,7 @@ --- ../src_base/minecraft/net/minecraft/command/CommandHandler.java +++ ../src_work/minecraft/net/minecraft/command/CommandHandler.java -@@ -11,6 +11,9 @@ - import net.minecraft.entity.player.EntityPlayerMP; +@@ -12,6 +12,9 @@ + import net.minecraft.util.ChatMessageComponent; import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.common.MinecraftForge; @@ -10,7 +10,7 @@ public class CommandHandler implements ICommandManager { /** Map of Strings to the ICommand objects they represent */ -@@ -44,6 +47,16 @@ +@@ -45,6 +48,16 @@ if (icommand.canCommandSenderUseCommand(par1ICommandSender)) { diff --git a/patches/minecraft/net/minecraft/crash/CrashReport.java.patch b/patches/minecraft/net/minecraft/crash/CrashReport.java.patch index 3a96ecdee..78fd5a696 100644 --- a/patches/minecraft/net/minecraft/crash/CrashReport.java.patch +++ b/patches/minecraft/net/minecraft/crash/CrashReport.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/crash/CrashReport.java +++ ../src_work/minecraft/net/minecraft/crash/CrashReport.java -@@ -253,7 +253,8 @@ +@@ -245,7 +245,8 @@ StackTraceElement stacktraceelement = null; StackTraceElement stacktraceelement1 = null; diff --git a/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch b/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch index fec57d5c5..378a68cc9 100644 --- a/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch +++ b/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch @@ -5,12 +5,12 @@ import net.minecraft.enchantment.EnumEnchantmentType; import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; - import net.minecraft.util.StringTranslate; public class CreativeTabs + { @@ -34,8 +35,22 @@ - /** Whether to draw the title in the foreground of the creative GUI */ private boolean drawTitle = true; + private EnumEnchantmentType[] field_111230_s; + public CreativeTabs(String label) + { @@ -53,29 +53,31 @@ return this.tabIndex < 6; } -@@ -149,11 +172,41 @@ +@@ -187,9 +210,17 @@ { Item item = aitem[j]; - if (item != null && item.getCreativeTab() == this) - { - item.getSubItems(item.itemID, this, par1List); -- } -- } + if (item == null) + { + continue; + } + -+ for(CreativeTabs tab : item.getCreativeTabs()) ++ for (CreativeTabs tab : item.getCreativeTabs()) + { + if (tab == this) + { + item.getSubItems(item.itemID, this, par1List); + } -+ } -+ } -+ } + } + } + +@@ -228,4 +259,26 @@ + } + } + } + + public int getTabPage() + { @@ -97,6 +99,5 @@ + public ItemStack getIconItemStack() + { + return new ItemStack(getTabIconItem()); - } - - @SideOnly(Side.CLIENT) ++ } + } diff --git a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch index 303845dac..ba8fb5409 100644 --- a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch @@ -7,7 +7,7 @@ + +import com.google.common.collect.ObjectArrays; + - import net.minecraft.entity.EntityLiving; + import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; @@ -205,6 +208,27 @@ diff --git a/patches/minecraft/net/minecraft/entity/Entity.java.patch b/patches/minecraft/net/minecraft/entity/Entity.java.patch index 2ca66d9be..beb0443d0 100644 --- a/patches/minecraft/net/minecraft/entity/Entity.java.patch +++ b/patches/minecraft/net/minecraft/entity/Entity.java.patch @@ -25,7 +25,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagDouble; -@@ -25,12 +33,16 @@ +@@ -26,12 +34,16 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.Direction; import net.minecraft.util.MathHelper; @@ -42,7 +42,7 @@ public abstract class Entity { -@@ -225,6 +237,13 @@ +@@ -218,6 +230,13 @@ private boolean invulnerable; private UUID entityUniqueID; public EnumEntitySize myEntitySize; @@ -56,7 +56,7 @@ public Entity(World par1World) { -@@ -274,6 +293,15 @@ +@@ -245,6 +264,15 @@ this.dataWatcher.addObject(0, Byte.valueOf((byte)0)); this.dataWatcher.addObject(1, Short.valueOf((short)300)); this.entityInit(); @@ -72,16 +72,7 @@ } protected abstract void entityInit(); -@@ -554,7 +582,7 @@ - if (!this.worldObj.isRemote) - { - this.setFlag(0, this.fire > 0); -- this.setFlag(2, this.ridingEntity != null); -+ this.setFlag(2, this.ridingEntity != null && ridingEntity.shouldRiderSit()); - } - - this.firstUpdate = false; -@@ -1534,6 +1562,21 @@ +@@ -1515,6 +1543,21 @@ par1NBTTagCompound.setInteger("PortalCooldown", this.timeUntilPortal); par1NBTTagCompound.setLong("UUIDMost", this.entityUniqueID.getMostSignificantBits()); par1NBTTagCompound.setLong("UUIDLeast", this.entityUniqueID.getLeastSignificantBits()); @@ -103,7 +94,7 @@ this.writeEntityToNBT(par1NBTTagCompound); if (this.ridingEntity != null) -@@ -1604,6 +1647,26 @@ +@@ -1585,6 +1628,26 @@ this.setPosition(this.posX, this.posY, this.posZ); this.setRotation(this.rotationYaw, this.rotationPitch); @@ -130,32 +121,32 @@ this.readEntityFromNBT(par1NBTTagCompound); } catch (Throwable throwable) -@@ -1698,7 +1761,14 @@ - { - EntityItem entityitem = new EntityItem(this.worldObj, this.posX, this.posY + (double)par2, this.posZ, par1ItemStack); - entityitem.delayBeforeCanPickup = 10; -- this.worldObj.spawnEntityInWorld(entityitem); -+ if (captureDrops) -+ { -+ capturedDrops.add(entityitem); -+ } -+ else -+ { -+ this.worldObj.spawnEntityInWorld(entityitem); -+ } - return entityitem; +@@ -1687,7 +1750,14 @@ + { + EntityItem entityitem = new EntityItem(this.worldObj, this.posX, this.posY + (double)par2, this.posZ, par1ItemStack); + entityitem.delayBeforeCanPickup = 10; +- this.worldObj.spawnEntityInWorld(entityitem); ++ if (captureDrops) ++ { ++ capturedDrops.add(entityitem); ++ } ++ else ++ { ++ this.worldObj.spawnEntityInWorld(entityitem); ++ } + return entityitem; + } } - -@@ -2056,7 +2126,7 @@ +@@ -1985,7 +2055,7 @@ */ public boolean isRiding() { -- return this.ridingEntity != null || this.getFlag(2); -+ return (this.ridingEntity != null && ridingEntity.shouldRiderSit()) || this.getFlag(2); +- return this.ridingEntity != null; ++ return this.ridingEntity != null && ridingEntity.shouldRiderSit(); } /** -@@ -2400,7 +2470,7 @@ +@@ -2344,7 +2414,7 @@ public float func_82146_a(Explosion par1Explosion, World par2World, int par3, int par4, int par5, Block par6Block) { @@ -164,7 +155,7 @@ } public boolean func_96091_a(Explosion par1Explosion, World par2World, int par3, int par4, int par5, int par6, float par7) -@@ -2458,4 +2528,145 @@ +@@ -2407,4 +2477,145 @@ { return this.getEntityName(); } diff --git a/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch b/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch index 2b18b8754..970fa5915 100644 --- a/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch @@ -1,223 +1,27 @@ --- ../src_base/minecraft/net/minecraft/entity/EntityLiving.java +++ ../src_work/minecraft/net/minecraft/entity/EntityLiving.java -@@ -22,6 +22,7 @@ - import net.minecraft.entity.item.EntityXPOrb; - import net.minecraft.entity.monster.EntityCreeper; - import net.minecraft.entity.monster.EntityGhast; -+import net.minecraft.entity.passive.EntityPig; - import net.minecraft.entity.passive.EntityWolf; - import net.minecraft.entity.player.EntityPlayer; - import net.minecraft.entity.projectile.EntityArrow; -@@ -50,6 +51,11 @@ +@@ -31,6 +31,7 @@ + import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.WorldServer; - +import net.minecraftforge.common.ForgeHooks; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.entity.living.*; -+import static net.minecraftforge.event.entity.living.LivingEvent.*; -+ - public abstract class EntityLiving extends Entity + + public abstract class EntityLiving extends EntityLivingBase { - /** -@@ -400,6 +406,7 @@ - public void setAttackTarget(EntityLiving par1EntityLiving) +@@ -141,6 +142,7 @@ + public void setAttackTarget(EntityLivingBase par1EntityLivingBase) { - this.attackTarget = par1EntityLiving; -+ ForgeHooks.onLivingSetAttackTarget(this, par1EntityLiving); + this.attackTarget = par1EntityLivingBase; ++ ForgeHooks.onLivingSetAttackTarget(this, par1EntityLivingBase); } /** -@@ -496,6 +503,7 @@ - { - this.entityLivingToAttack = par1EntityLiving; - this.revengeTimer = this.entityLivingToAttack != null ? 100 : 0; -+ ForgeHooks.onLivingSetAttackTarget(this, par1EntityLiving); - } - - protected void entityInit() -@@ -807,6 +815,11 @@ - */ - public void onUpdate() - { -+ if (ForgeHooks.onLivingUpdate(this)) -+ { -+ return; -+ } -+ - super.onUpdate(); - - if (!this.worldObj.isRemote) -@@ -992,6 +1005,11 @@ - */ - public boolean attackEntityFrom(DamageSource par1DamageSource, int par2) - { -+ if (ForgeHooks.onLivingAttack(this, par1DamageSource, par2)) -+ { -+ return false; -+ } -+ - if (this.isEntityInvulnerable()) - { - return false; -@@ -1229,6 +1247,11 @@ - { - if (!this.isEntityInvulnerable()) - { -+ par2 = ForgeHooks.onLivingHurt(this, par1DamageSource, par2); -+ if (par2 <= 0) -+ { -+ return; -+ } - par2 = this.applyArmorCalculations(par1DamageSource, par2); - par2 = this.applyPotionDamageCalculations(par1DamageSource, par2); - int j = this.getHealth(); -@@ -1295,6 +1318,11 @@ - */ - public void onDeath(DamageSource par1DamageSource) - { -+ if (ForgeHooks.onLivingDeath(this, par1DamageSource)) -+ { -+ return; -+ } -+ - Entity entity = par1DamageSource.getEntity(); - EntityLiving entityliving = this.func_94060_bK(); - -@@ -1319,6 +1347,10 @@ - i = EnchantmentHelper.getLootingModifier((EntityLiving)entity); - } - -+ captureDrops = true; -+ capturedDrops.clear(); -+ int j = 0; -+ - if (!this.isChild() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) - { - this.dropFewItems(this.recentlyHit > 0, i); -@@ -1326,7 +1358,7 @@ - - if (this.recentlyHit > 0) - { -- int j = this.rand.nextInt(200) - i; -+ j = this.rand.nextInt(200) - i; - - if (j < 5) - { -@@ -1334,6 +1366,16 @@ - } - } - } -+ -+ captureDrops = false; -+ -+ if (!ForgeHooks.onLivingDrops(this, par1DamageSource, capturedDrops, i, recentlyHit > 0, j)) -+ { -+ for (EntityItem item : capturedDrops) -+ { -+ worldObj.spawnEntityInWorld(item); -+ } -+ } - } - - this.worldObj.setEntityState(this, (byte)3); -@@ -1378,6 +1420,12 @@ - */ - protected void fall(float par1) - { -+ par1 = ForgeHooks.onLivingFall(this, par1); -+ if (par1 <= 0) -+ { -+ return; -+ } -+ - super.fall(par1); - int i = MathHelper.ceiling_float_int(par1 - 3.0F); - -@@ -1580,7 +1628,7 @@ - int j = MathHelper.floor_double(this.boundingBox.minY); - int k = MathHelper.floor_double(this.posZ); - int l = this.worldObj.getBlockId(i, j, k); -- return l == Block.ladder.blockID || l == Block.vine.blockID; -+ return ForgeHooks.isLivingOnLadder(Block.blocksList[l], worldObj, i, j, k, this); - } - - /** -@@ -2002,6 +2050,7 @@ - } - - this.isAirBorne = true; -+ ForgeHooks.onLivingJump(this); - } - - /** -@@ -2554,8 +2603,6 @@ - return this.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD; +@@ -726,8 +728,6 @@ + return this.worldObj.checkNoEntityCollision(this.boundingBox) && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(this.boundingBox); } - @SideOnly(Side.CLIENT) - /** - * Remove the speified potion effect from this entity. + * Returns render size modifier */ -@@ -2984,6 +3031,17 @@ - */ - public void swingItem() - { -+ ItemStack stack = this.getHeldItem(); -+ -+ if (stack != null && stack.getItem() != null) -+ { -+ Item item = stack.getItem(); -+ if (item.onEntitySwing(this, stack)) -+ { -+ return; -+ } -+ } -+ - if (!this.isSwingInProgress || this.swingProgressInt >= this.getArmSwingAnimationEnd() / 2 || this.swingProgressInt < 0) - { - this.swingProgressInt = -1; -@@ -3084,4 +3142,42 @@ - { - return this.persistenceRequired; - } -+ -+ /*** -+ * Removes all potion effects that have curativeItem as a curative item for its effect -+ * @param curativeItem The itemstack we are using to cure potion effects -+ */ -+ public void curePotionEffects(ItemStack curativeItem) -+ { -+ Iterator potionKey = activePotionsMap.keySet().iterator(); -+ -+ if (worldObj.isRemote) -+ { -+ return; -+ } -+ -+ while (potionKey.hasNext()) -+ { -+ Integer key = potionKey.next(); -+ PotionEffect effect = (PotionEffect)activePotionsMap.get(key); -+ -+ if (effect.isCurativeItem(curativeItem)) -+ { -+ potionKey.remove(); -+ onFinishedPotionEffect(effect); -+ } -+ } -+ } -+ -+ /** -+ * Returns true if the entity's rider (EntityPlayer) should face forward when mounted. -+ * currently only used in vanilla code by pigs. -+ * -+ * @param player The player who is riding the entity. -+ * @return If the player should orient the same direction as this entity. -+ */ -+ public boolean shouldRiderFaceForward(EntityPlayer player) -+ { -+ return this instanceof EntityPig; -+ } - } diff --git a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch new file mode 100644 index 000000000..294439ab0 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -0,0 +1,198 @@ +--- ../src_base/minecraft/net/minecraft/entity/EntityLivingBase.java ++++ ../src_work/minecraft/net/minecraft/entity/EntityLivingBase.java +@@ -21,9 +21,11 @@ + import net.minecraft.entity.item.EntityItem; + import net.minecraft.entity.item.EntityXPOrb; + import net.minecraft.entity.monster.EntityZombie; ++import net.minecraft.entity.passive.EntityPig; + import net.minecraft.entity.passive.EntityWolf; + import net.minecraft.entity.player.EntityPlayer; + import net.minecraft.entity.projectile.EntityArrow; ++import net.minecraft.item.Item; + import net.minecraft.item.ItemArmor; + import net.minecraft.item.ItemStack; + import net.minecraft.nbt.NBTBase; +@@ -46,6 +48,7 @@ + import net.minecraft.util.Vec3; + import net.minecraft.world.World; + import net.minecraft.world.WorldServer; ++import net.minecraftforge.common.ForgeHooks; + + public abstract class EntityLivingBase extends Entity + { +@@ -451,6 +454,7 @@ + { + this.entityLivingToAttack = par1EntityLivingBase; + this.revengeTimer = this.entityLivingToAttack != null ? 100 : 0; ++ ForgeHooks.onLivingSetAttackTarget(this, par1EntityLivingBase); + } + + public EntityLivingBase func_110144_aD() +@@ -738,8 +742,6 @@ + return this.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD; + } + +- @SideOnly(Side.CLIENT) +- + /** + * Remove the speified potion effect from this entity. + */ +@@ -824,6 +826,7 @@ + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { ++ if (ForgeHooks.onLivingAttack(this, par1DamageSource, par2)) return false; + if (this.isEntityInvulnerable()) + { + return false; +@@ -974,6 +977,7 @@ + */ + public void onDeath(DamageSource par1DamageSource) + { ++ if (ForgeHooks.onLivingDeath(this, par1DamageSource)) return; + Entity entity = par1DamageSource.getEntity(); + EntityLivingBase entitylivingbase = this.func_94060_bK(); + +@@ -998,6 +1002,10 @@ + i = EnchantmentHelper.getLootingModifier((EntityLivingBase)entity); + } + ++ captureDrops = true; ++ capturedDrops.clear(); ++ int j = 0; ++ + if (!this.isChild() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) + { + this.dropFewItems(this.recentlyHit > 0, i); +@@ -1005,12 +1013,22 @@ + + if (this.recentlyHit > 0) + { +- int j = this.rand.nextInt(200) - i; ++ j = this.rand.nextInt(200) - i; + + if (j < 5) + { + this.dropRareDrop(j <= 0 ? 1 : 0); + } ++ } ++ } ++ ++ captureDrops = false; ++ ++ if (!ForgeHooks.onLivingDrops(this, par1DamageSource, capturedDrops, i, recentlyHit > 0, j)) ++ { ++ for (EntityItem item : capturedDrops) ++ { ++ worldObj.spawnEntityInWorld(item); + } + } + } +@@ -1080,7 +1098,7 @@ + int j = MathHelper.floor_double(this.boundingBox.minY); + int k = MathHelper.floor_double(this.posZ); + int l = this.worldObj.getBlockId(i, j, k); +- return l == Block.ladder.blockID || l == Block.vine.blockID; ++ return ForgeHooks.isLivingOnLadder(Block.blocksList[l], worldObj, i, j, k, this); + } + + /** +@@ -1096,6 +1114,8 @@ + */ + protected void fall(float par1) + { ++ par1 = ForgeHooks.onLivingFall(this, par1); ++ if (par1 <= 0) return; + super.fall(par1); + PotionEffect potioneffect = this.getActivePotionEffect(Potion.jump); + float f1 = potioneffect != null ? (float)(potioneffect.getAmplifier() + 1) : 0.0F; +@@ -1229,6 +1249,8 @@ + { + if (!this.isEntityInvulnerable()) + { ++ par2 = ForgeHooks.onLivingHurt(this, par1DamageSource, par2); ++ if (par2 <= 0) return; + par2 = this.applyArmorCalculations(par1DamageSource, par2); + par2 = this.applyPotionDamageCalculations(par1DamageSource, par2); + float f1 = par2; +@@ -1290,6 +1312,17 @@ + */ + public void swingItem() + { ++ ItemStack stack = this.getHeldItem(); ++ ++ if (stack != null && stack.getItem() != null) ++ { ++ Item item = stack.getItem(); ++ if (item.onEntitySwing(this, stack)) ++ { ++ return; ++ } ++ } ++ + if (!this.isSwingInProgress || this.field_110158_av >= this.getArmSwingAnimationEnd() / 2 || this.field_110158_av < 0) + { + this.field_110158_av = -1; +@@ -1531,6 +1564,7 @@ + } + + this.isAirBorne = true; ++ ForgeHooks.onLivingJump(this); + } + + /** +@@ -1735,6 +1769,11 @@ + */ + public void onUpdate() + { ++ if (ForgeHooks.onLivingUpdate(this)) ++ { ++ return; ++ } ++ + super.onUpdate(); + + if (!this.worldObj.isRemote) +@@ -2255,4 +2294,42 @@ + + this.field_110151_bq = par1; + } ++ ++ /*** ++ * Removes all potion effects that have curativeItem as a curative item for its effect ++ * @param curativeItem The itemstack we are using to cure potion effects ++ */ ++ public void curePotionEffects(ItemStack curativeItem) ++ { ++ Iterator potionKey = activePotionsMap.keySet().iterator(); ++ ++ if (worldObj.isRemote) ++ { ++ return; ++ } ++ ++ while (potionKey.hasNext()) ++ { ++ Integer key = potionKey.next(); ++ PotionEffect effect = (PotionEffect)activePotionsMap.get(key); ++ ++ if (effect.isCurativeItem(curativeItem)) ++ { ++ potionKey.remove(); ++ onFinishedPotionEffect(effect); ++ } ++ } ++ } ++ ++ /** ++ * Returns true if the entity's rider (EntityPlayer) should face forward when mounted. ++ * currently only used in vanilla code by pigs. ++ * ++ * @param player The player who is riding the entity. ++ * @return If the player should orient the same direction as this entity. ++ */ ++ public boolean shouldRiderFaceForward(EntityPlayer player) ++ { ++ return this instanceof EntityPig; ++ } + } diff --git a/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch b/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch index 4b4217a2e..f8170bdad 100644 --- a/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch +++ b/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/entity/boss/EntityDragon.java +++ ../src_work/minecraft/net/minecraft/entity/boss/EntityDragon.java -@@ -531,10 +531,11 @@ +@@ -527,10 +527,11 @@ for (int i2 = k; i2 <= j1; ++i2) { int j2 = this.worldObj.getBlockId(k1, l1, i2); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch index 5d631ad75..5695a078f 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/entity/item/EntityEnderPearl.java +++ ../src_work/minecraft/net/minecraft/entity/item/EntityEnderPearl.java -@@ -8,6 +8,8 @@ +@@ -9,6 +9,8 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; @@ -9,20 +9,28 @@ public class EntityEnderPearl extends EntityThrowable { -@@ -50,9 +52,13 @@ +@@ -51,14 +53,18 @@ if (!entityplayermp.playerNetServerHandler.connectionClosed && entityplayermp.worldObj == this.worldObj) { -- this.getThrower().setPositionAndUpdate(this.posX, this.posY, this.posZ); -- this.getThrower().fallDistance = 0.0F; -- this.getThrower().attackEntityFrom(DamageSource.fall, 5); -+ EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, this.posX, this.posY, this.posZ, 5); -+ if (!MinecraftForge.EVENT_BUS.post(event)){ +- if (this.getThrower().isRiding()) ++ EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, this.posX, this.posY, this.posZ, 5.0F); ++ if (!MinecraftForge.EVENT_BUS.post(event)) + { +- this.getThrower().mountEntity((Entity)null); ++ if (this.getThrower().isRiding()) ++ { ++ this.getThrower().mountEntity((Entity)null); ++ } ++ + this.getThrower().setPositionAndUpdate(event.targetX, event.targetY, event.targetZ); + this.getThrower().fallDistance = 0.0F; + this.getThrower().attackEntityFrom(DamageSource.fall, event.attackDamage); -+ } -+ + } +- +- this.getThrower().setPositionAndUpdate(this.posX, this.posY, this.posZ); +- this.getThrower().fallDistance = 0.0F; +- this.getThrower().attackEntityFrom(DamageSource.fall, 5.0F); } } diff --git a/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch index 9fc290366..eedc3671c 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch @@ -24,7 +24,7 @@ public EntityItem(World par1World, double par2, double par4, double par6) { super(par1World); -@@ -49,6 +59,7 @@ +@@ -48,6 +58,7 @@ { this(par1World, par2, par4, par6); this.setEntityItemStack(par8ItemStack); @@ -32,7 +32,7 @@ } /** -@@ -80,6 +91,15 @@ +@@ -78,6 +89,15 @@ */ public void onUpdate() { @@ -48,7 +48,7 @@ super.onUpdate(); if (this.delayBeforeCanPickup > 0) -@@ -135,7 +155,29 @@ +@@ -133,7 +153,29 @@ ++this.age; @@ -79,7 +79,7 @@ { this.setDead(); } -@@ -270,6 +312,7 @@ +@@ -268,6 +310,7 @@ { par1NBTTagCompound.setShort("Health", (short)((byte)this.health)); par1NBTTagCompound.setShort("Age", (short)this.age); @@ -87,7 +87,7 @@ if (this.getEntityItem() != null) { -@@ -287,10 +330,17 @@ +@@ -285,10 +328,17 @@ NBTTagCompound nbttagcompound1 = par1NBTTagCompound.getCompoundTag("Item"); this.setEntityItemStack(ItemStack.loadItemStackFromNBT(nbttagcompound1)); @@ -106,7 +106,7 @@ } /** -@@ -300,10 +350,22 @@ +@@ -298,10 +348,22 @@ { if (!this.worldObj.isRemote) { diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch index 3d3872d8a..a43ef0e88 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch @@ -32,7 +32,7 @@ public EntityMinecart(World par1World) { super(par1World); -@@ -105,6 +123,10 @@ +@@ -104,6 +122,10 @@ */ public AxisAlignedBB getCollisionBox(Entity par1Entity) { @@ -43,7 +43,7 @@ return par1Entity.canBePushed() ? par1Entity.boundingBox : null; } -@@ -113,6 +135,10 @@ +@@ -112,6 +134,10 @@ */ public AxisAlignedBB getBoundingBox() { @@ -54,7 +54,7 @@ return null; } -@@ -121,7 +147,7 @@ +@@ -120,7 +146,7 @@ */ public boolean canBePushed() { @@ -63,7 +63,7 @@ } public EntityMinecart(World par1World, double par2, double par4, double par6) -@@ -353,19 +379,21 @@ +@@ -352,19 +378,21 @@ double d5 = 0.0078125D; int l = this.worldObj.getBlockId(j, i, k); @@ -92,7 +92,7 @@ } this.doBlockCollisions(); -@@ -392,7 +420,18 @@ +@@ -391,7 +419,18 @@ } this.setRotation(this.rotationYaw, this.rotationPitch); @@ -112,7 +112,7 @@ if (list != null && !list.isEmpty()) { -@@ -416,6 +455,8 @@ +@@ -415,6 +454,8 @@ this.riddenByEntity = null; } @@ -121,7 +121,7 @@ } } -@@ -444,6 +485,17 @@ +@@ -443,6 +484,17 @@ if (this.motionZ > par1) { this.motionZ = par1; @@ -139,7 +139,7 @@ } if (this.onGround) -@@ -453,13 +505,13 @@ +@@ -452,13 +504,13 @@ this.motionZ *= 0.5D; } @@ -157,7 +157,7 @@ } } -@@ -473,7 +525,7 @@ +@@ -472,7 +524,7 @@ if (par8 == Block.railPowered.blockID) { @@ -166,7 +166,7 @@ flag1 = !flag; } -@@ -544,7 +596,7 @@ +@@ -551,7 +603,7 @@ } } @@ -175,7 +175,7 @@ { d7 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); -@@ -592,36 +644,8 @@ +@@ -599,36 +651,8 @@ this.posX = d8 + d2 * d7; this.posZ = d9 + d3 * d7; this.setPosition(this.posX, this.posY + (double)this.yOffset, this.posZ); @@ -214,7 +214,7 @@ if (aint[0][1] != 0 && MathHelper.floor_double(this.posX) - par1 == aint[0][0] && MathHelper.floor_double(this.posZ) - par3 == aint[0][2]) { -@@ -659,7 +683,12 @@ +@@ -666,7 +690,12 @@ this.motionZ = d6 * (double)(k1 - par3); } @@ -228,7 +228,7 @@ { double d15 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); -@@ -730,12 +759,7 @@ +@@ -737,12 +766,7 @@ } else { @@ -242,7 +242,7 @@ par3 = (double)j; -@@ -781,13 +805,8 @@ +@@ -788,13 +812,8 @@ if (BlockRailBase.isRailBlock(l)) { @@ -257,7 +257,7 @@ if (i1 >= 2 && i1 <= 5) { -@@ -893,11 +912,17 @@ +@@ -900,11 +919,17 @@ */ public void applyEntityCollision(Entity par1Entity) { @@ -271,12 +271,12 @@ { if (par1Entity != this.riddenByEntity) { -- if (par1Entity instanceof EntityLiving && !(par1Entity instanceof EntityPlayer) && !(par1Entity instanceof EntityIronGolem) && this.getMinecartType() == 0 && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && par1Entity.ridingEntity == null) -+ if (par1Entity instanceof EntityLiving && !(par1Entity instanceof EntityPlayer) && !(par1Entity instanceof EntityIronGolem) && canBeRidden() && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && par1Entity.ridingEntity == null) +- if (par1Entity instanceof EntityLivingBase && !(par1Entity instanceof EntityPlayer) && !(par1Entity instanceof EntityIronGolem) && this.getMinecartType() == 0 && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && par1Entity.ridingEntity == null) ++ if (par1Entity instanceof EntityLivingBase && !(par1Entity instanceof EntityPlayer) && !(par1Entity instanceof EntityIronGolem) && canBeRidden() && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && par1Entity.ridingEntity == null) { par1Entity.mountEntity(this); } -@@ -943,7 +968,7 @@ +@@ -950,7 +975,7 @@ double d7 = par1Entity.motionX + this.motionX; double d8 = par1Entity.motionZ + this.motionZ; @@ -285,7 +285,7 @@ { this.motionX *= 0.20000000298023224D; this.motionZ *= 0.20000000298023224D; -@@ -951,7 +976,7 @@ +@@ -958,7 +983,7 @@ par1Entity.motionX *= 0.949999988079071D; par1Entity.motionZ *= 0.949999988079071D; } @@ -294,7 +294,7 @@ { par1Entity.motionX *= 0.20000000298023224D; par1Entity.motionZ *= 0.20000000298023224D; -@@ -1158,4 +1183,211 @@ +@@ -1165,4 +1190,211 @@ { return this.entityName; } diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch index e90ecb610..d582c2aa2 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch @@ -9,9 +9,9 @@ public abstract class EntityMinecartContainer extends EntityMinecart implements IInventory { -@@ -283,6 +285,10 @@ - */ - public boolean interact(EntityPlayer par1EntityPlayer) +@@ -280,6 +282,10 @@ + + public boolean func_130002_c(EntityPlayer par1EntityPlayer) { + if(MinecraftForge.EVENT_BUS.post(new MinecartInteractEvent(this, par1EntityPlayer))) + { diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch index 7944835ed..89caea5f2 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch @@ -9,9 +9,9 @@ public class EntityMinecartEmpty extends EntityMinecart { -@@ -20,6 +22,10 @@ - */ - public boolean interact(EntityPlayer par1EntityPlayer) +@@ -17,6 +19,10 @@ + + public boolean func_130002_c(EntityPlayer par1EntityPlayer) { + if(MinecraftForge.EVENT_BUS.post(new MinecartInteractEvent(this, par1EntityPlayer))) + { diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch index cd938f3e3..c1dd20b00 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch @@ -9,9 +9,9 @@ public class EntityMinecartFurnace extends EntityMinecart { -@@ -126,6 +128,10 @@ - */ - public boolean interact(EntityPlayer par1EntityPlayer) +@@ -123,6 +125,10 @@ + + public boolean func_130002_c(EntityPlayer par1EntityPlayer) { + if(MinecraftForge.EVENT_BUS.post(new MinecartInteractEvent(this, par1EntityPlayer))) + { diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch index 104f919c3..36550b48c 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch @@ -9,9 +9,9 @@ public class EntityMinecartHopper extends EntityMinecartContainer implements Hopper { -@@ -54,6 +56,10 @@ - */ - public boolean interact(EntityPlayer par1EntityPlayer) +@@ -51,6 +53,10 @@ + + public boolean func_130002_c(EntityPlayer par1EntityPlayer) { + if(MinecraftForge.EVENT_BUS.post(new MinecartInteractEvent(this, par1EntityPlayer))) + { diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch index 8c18e40a1..a4b705feb 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/entity/monster/EntityEnderman.java +++ ../src_work/minecraft/net/minecraft/entity/monster/EntityEnderman.java -@@ -12,6 +12,8 @@ +@@ -16,6 +16,8 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; import net.minecraft.world.World; @@ -9,7 +9,7 @@ public class EntityEnderman extends EntityMob { -@@ -275,12 +277,17 @@ +@@ -291,12 +293,17 @@ */ protected boolean teleportTo(double par1, double par3, double par5) { @@ -30,7 +30,7 @@ boolean flag = false; int i = MathHelper.floor_double(this.posX); int j = MathHelper.floor_double(this.posY); -@@ -457,7 +464,7 @@ +@@ -473,7 +480,7 @@ } } diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch index cc6af1ed1..a448204ad 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch @@ -13,7 +13,7 @@ { public EntityMooshroom(World par1World) { -@@ -39,31 +43,7 @@ +@@ -38,31 +42,7 @@ } } @@ -26,7 +26,7 @@ - { - EntityCow entitycow = new EntityCow(this.worldObj); - entitycow.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); -- entitycow.setEntityHealth(this.getHealth()); +- entitycow.setEntityHealth(this.func_110143_aJ()); - entitycow.renderYawOffset = this.renderYawOffset; - this.worldObj.spawnEntityInWorld(entitycow); - @@ -46,7 +46,7 @@ } public EntityMooshroom func_94900_c(EntityAgeable par1EntityAgeable) -@@ -83,4 +63,29 @@ +@@ -82,4 +62,29 @@ { return this.func_94900_c(par1EntityAgeable); } @@ -63,7 +63,7 @@ + setDead(); + EntityCow entitycow = new EntityCow(worldObj); + entitycow.setLocationAndAngles(posX, posY, posZ, rotationYaw, rotationPitch); -+ entitycow.setEntityHealth(getHealth()); ++ entitycow.setEntityHealth(func_110143_aJ()); + entitycow.renderYawOffset = renderYawOffset; + worldObj.spawnEntityInWorld(entitycow); + worldObj.spawnParticle("largeexplode", posX, posY + (double)(height / 2.0F), posZ, 0.0D, 0.0D, 0.0D); diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch index 7f264450f..2237df0f6 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/entity/passive/EntityOcelot.java +++ ../src_work/minecraft/net/minecraft/entity/passive/EntityOcelot.java -@@ -355,8 +355,9 @@ +@@ -334,8 +334,9 @@ } int l = this.worldObj.getBlockId(i, j - 1, k); diff --git a/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch index ee9c14bd7..980d333b0 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch @@ -9,7 +9,7 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.entity.EntityAgeable; -@@ -24,7 +26,9 @@ +@@ -26,7 +28,9 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; @@ -20,7 +20,7 @@ { private final InventoryCrafting field_90016_e = new InventoryCrafting(new ContainerSheep(this), 2, 1); -@@ -159,28 +163,6 @@ +@@ -141,28 +145,6 @@ */ public boolean interact(EntityPlayer par1EntityPlayer) { @@ -49,7 +49,7 @@ return super.interact(par1EntityPlayer); } -@@ -349,4 +331,24 @@ +@@ -343,4 +325,24 @@ { return this.func_90015_b(par1EntityAgeable); } diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch index e8603c6eb..582b79133 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/entity/player/EntityPlayer.java +++ ../src_work/minecraft/net/minecraft/entity/player/EntityPlayer.java -@@ -66,8 +66,23 @@ +@@ -68,8 +68,21 @@ import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; @@ -16,24 +16,13 @@ +import net.minecraftforge.event.entity.player.PlayerFlyableFallEvent; +import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent; + - public abstract class EntityPlayer extends EntityLiving implements ICommandSender + public abstract class EntityPlayer extends EntityLivingBase implements ICommandSender { + public static final String PERSISTED_NBT_TAG = "PlayerPersisted"; -+ public int maxHealth = 20; -+ /** Inventory of the player */ public InventoryPlayer inventory = new InventoryPlayer(this); private InventoryEnderChest theInventoryEnderChest = new InventoryEnderChest(); -@@ -181,7 +196,7 @@ - - public int getMaxHealth() - { -- return 20; -+ return maxHealth <= 0 ? 20 : maxHealth; - } - - protected void entityInit() -@@ -268,6 +283,7 @@ +@@ -269,6 +282,7 @@ if (itemstack == this.itemInUse) { @@ -41,21 +30,27 @@ if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0) { this.updateItemUse(itemstack, 5); -@@ -528,11 +544,11 @@ - this.cameraYaw = 0.0F; - this.addMountedMovementStat(this.posX - d0, this.posY - d1, this.posZ - d2); +@@ -539,11 +553,11 @@ + this.cameraYaw = 0.0F; + this.addMountedMovementStat(this.posX - d0, this.posY - d1, this.posZ - d2); -- if (this.ridingEntity instanceof EntityPig) -+ if (this.ridingEntity instanceof EntityLiving && ((EntityLiving)ridingEntity).shouldRiderFaceForward(this)) - { - this.rotationPitch = f1; - this.rotationYaw = f; -- this.renderYawOffset = ((EntityPig)this.ridingEntity).renderYawOffset; -+ this.renderYawOffset = ((EntityLiving)this.ridingEntity).renderYawOffset; +- if (this.ridingEntity instanceof EntityPig) ++ if (this.ridingEntity instanceof EntityLivingBase && ((EntityLivingBase)ridingEntity).shouldRiderFaceForward(this)) + { + this.rotationPitch = f1; + this.rotationYaw = f; +- this.renderYawOffset = ((EntityPig)this.ridingEntity).renderYawOffset; ++ this.renderYawOffset = ((EntityLivingBase)this.ridingEntity).renderYawOffset; + } } } - -@@ -661,6 +677,9 @@ +@@ -686,11 +700,15 @@ + */ + public void onDeath(DamageSource par1DamageSource) + { ++ if (ForgeHooks.onLivingDeath(this, par1DamageSource)) return; + super.onDeath(par1DamageSource); + this.setSize(0.2F, 0.2F); this.setPosition(this.posX, this.posY, this.posZ); this.motionY = 0.10000000149011612D; @@ -65,7 +60,7 @@ if (this.username.equals("Notch")) { this.dropPlayerItemWithRandomChoice(new ItemStack(Item.appleRed, 1), true); -@@ -669,6 +688,20 @@ +@@ -699,6 +717,20 @@ if (!this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) { this.inventory.dropAllItems(); @@ -86,7 +81,7 @@ } if (par1DamageSource != null) -@@ -719,7 +752,20 @@ +@@ -749,7 +781,20 @@ */ public EntityItem dropOneItem(boolean par1) { @@ -108,7 +103,7 @@ } /** -@@ -728,7 +774,7 @@ +@@ -758,7 +803,7 @@ */ public EntityItem dropPlayerItem(ItemStack par1ItemStack) { @@ -117,7 +112,7 @@ } /** -@@ -780,15 +826,28 @@ +@@ -814,15 +859,28 @@ */ public void joinEntityItemWithWorld(EntityItem par1EntityItem) { @@ -148,7 +143,7 @@ if (f > 1.0F) { -@@ -799,7 +858,9 @@ +@@ -833,7 +891,9 @@ { float f1 = (float)(i * i + 1); @@ -159,7 +154,7 @@ { f += f1 * 0.08F; } -@@ -830,7 +891,8 @@ +@@ -864,7 +924,8 @@ f /= 5.0F; } @@ -169,7 +164,7 @@ } /** -@@ -838,7 +900,7 @@ +@@ -872,7 +933,7 @@ */ public boolean canHarvestBlock(Block par1Block) { @@ -178,60 +173,40 @@ } /** -@@ -857,6 +919,9 @@ - this.experienceTotal = par1NBTTagCompound.getInteger("XpTotal"); - this.setScore(par1NBTTagCompound.getInteger("Score")); - -+ int tmp = par1NBTTagCompound.getInteger("MaxHealth"); -+ maxHealth = (tmp <= 0 ? 20 : tmp); -+ - if (this.sleeping) +@@ -982,6 +1043,7 @@ + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { ++ if (ForgeHooks.onLivingAttack(this, par1DamageSource, par2)) return false; + if (this.isEntityInvulnerable()) { - this.playerLocation = new ChunkCoordinates(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)); -@@ -893,6 +958,7 @@ - par1NBTTagCompound.setInteger("XpLevel", this.experienceLevel); - par1NBTTagCompound.setInteger("XpTotal", this.experienceTotal); - par1NBTTagCompound.setInteger("Score", this.getScore()); -+ par1NBTTagCompound.setInteger("MaxHealth", maxHealth); - - if (this.spawnChunk != null) - { -@@ -1096,12 +1162,22 @@ + return false; +@@ -1135,12 +1197,15 @@ { if (!this.isEntityInvulnerable()) { + par2 = ForgeHooks.onLivingHurt(this, par1DamageSource, par2); -+ if (par2 <= 0) -+ { -+ return; -+ } -+ - if (!par1DamageSource.isUnblockable() && this.isBlocking()) ++ if (par2 <= 0) return; + if (!par1DamageSource.isUnblockable() && this.isBlocking() && par2 > 0.0F) { - par2 = 1 + par2 >> 1; + par2 = (1.0F + par2) * 0.5F; } - par2 = this.applyArmorCalculations(par1DamageSource, par2); + par2 = ArmorProperties.ApplyArmor(this, inventory.armorInventory, par1DamageSource, par2); -+ if (par2 <= 0) -+ { -+ return; -+ } ++ if (par2 <= 0) return; par2 = this.applyPotionDamageCalculations(par1DamageSource, par2); - this.addExhaustion(par1DamageSource.getHungerDamage()); - int j = this.getHealth(); -@@ -1144,6 +1220,10 @@ + float f1 = par2; + par2 = Math.max(par2 - this.func_110139_bj(), 0.0F); +@@ -1190,6 +1255,7 @@ public boolean interactWith(Entity par1Entity) { -+ if (MinecraftForge.EVENT_BUS.post(new EntityInteractEvent(this, par1Entity))) -+ { -+ return false; -+ } - if (par1Entity.interact(this)) - { - return true; -@@ -1187,7 +1267,9 @@ ++ if (MinecraftForge.EVENT_BUS.post(new EntityInteractEvent(this, par1Entity))) return false; + ItemStack itemstack = this.getCurrentEquippedItem(); + ItemStack itemstack1 = itemstack != null ? itemstack.copy() : null; + +@@ -1246,7 +1312,9 @@ */ public void destroyCurrentEquippedItem() { @@ -241,7 +216,7 @@ } /** -@@ -1204,6 +1286,15 @@ +@@ -1263,6 +1331,15 @@ */ public void attackTargetEntityWithCurrentItem(Entity par1Entity) { @@ -257,7 +232,7 @@ if (par1Entity.canAttackWithItem()) { if (!par1Entity.func_85031_j(this)) -@@ -1378,6 +1469,12 @@ +@@ -1421,6 +1498,12 @@ */ public EnumStatus sleepInBedAt(int par1, int par2, int par3) { @@ -270,7 +245,7 @@ if (!this.worldObj.isRemote) { if (this.isPlayerSleeping() || !this.isEntityAlive()) -@@ -1417,6 +1514,11 @@ +@@ -1465,6 +1548,11 @@ { int l = this.worldObj.getBlockMetadata(par1, par2, par3); int i1 = BlockBed.getDirection(l); @@ -282,7 +257,7 @@ float f = 0.5F; float f1 = 0.5F; -@@ -1487,10 +1589,12 @@ +@@ -1535,10 +1623,12 @@ ChunkCoordinates chunkcoordinates = this.playerLocation; ChunkCoordinates chunkcoordinates1 = this.playerLocation; @@ -299,7 +274,7 @@ if (chunkcoordinates1 == null) { -@@ -1527,7 +1631,9 @@ +@@ -1575,7 +1665,9 @@ */ private boolean isInBed() { @@ -310,7 +285,7 @@ } /** -@@ -1542,9 +1648,12 @@ +@@ -1590,9 +1682,12 @@ ichunkprovider.loadChunk(par1ChunkCoordinates.posX - 3 >> 4, par1ChunkCoordinates.posZ + 3 >> 4); ichunkprovider.loadChunk(par1ChunkCoordinates.posX + 3 >> 4, par1ChunkCoordinates.posZ + 3 >> 4); @@ -326,7 +301,7 @@ return chunkcoordinates1; } else -@@ -1566,10 +1675,13 @@ +@@ -1614,10 +1709,13 @@ { if (this.playerLocation != null) { @@ -344,7 +319,7 @@ { case 0: return 90.0F; -@@ -1835,6 +1947,10 @@ +@@ -1891,6 +1989,10 @@ super.fall(par1); } @@ -355,7 +330,7 @@ } /** -@@ -1876,7 +1992,7 @@ +@@ -1932,7 +2034,7 @@ { if (par1ItemStack.getItem().requiresMultipleRenderPasses()) { @@ -364,7 +339,7 @@ } if (this.itemInUse != null && par1ItemStack.itemID == Item.bow.itemID) -@@ -1898,6 +2014,7 @@ +@@ -1954,6 +2056,7 @@ return Item.bow.getItemIconForUseDuration(0); } } @@ -372,7 +347,7 @@ } return icon; -@@ -2137,6 +2254,14 @@ +@@ -2176,6 +2279,14 @@ } this.theInventoryEnderChest = par1EntityPlayer.theInventoryEnderChest; @@ -387,7 +362,7 @@ } /** -@@ -2208,7 +2333,14 @@ +@@ -2239,7 +2350,14 @@ */ public void setCurrentItemOrArmor(int par1, ItemStack par2ItemStack) { diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch index 15a2607ed..23d515ab1 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/entity/player/EntityPlayerMP.java +++ ../src_work/minecraft/net/minecraft/entity/player/EntityPlayerMP.java -@@ -87,6 +87,12 @@ +@@ -90,6 +90,12 @@ import net.minecraft.world.WorldServer; import net.minecraft.world.chunk.Chunk; @@ -12,8 +12,8 @@ + public class EntityPlayerMP extends EntityPlayer implements ICrafting { - private StringTranslate translator = new StringTranslate("en_US"); -@@ -158,18 +164,10 @@ + private String translator = "en_US"; +@@ -162,18 +168,10 @@ par4ItemInWorldManager.thisPlayerMP = this; this.theItemInWorldManager = par4ItemInWorldManager; this.renderDistance = par1MinecraftServer.getConfigurationManager().getViewDistance(); @@ -33,7 +33,7 @@ this.mcServer = par1MinecraftServer; this.stepHeight = 0.0F; -@@ -278,7 +276,10 @@ +@@ -287,7 +285,10 @@ if (chunkcoordintpair != null && this.worldObj.blockExists(chunkcoordintpair.chunkXPos << 4, 0, chunkcoordintpair.chunkZPos << 4)) { arraylist.add(this.worldObj.getChunkFromChunkCoords(chunkcoordintpair.chunkXPos, chunkcoordintpair.chunkZPos)); @@ -45,7 +45,7 @@ } } -@@ -299,6 +300,7 @@ +@@ -308,6 +309,7 @@ { Chunk chunk = (Chunk)iterator2.next(); this.getServerForPlayer().getEntityTracker().func_85172_a(this, chunk); @@ -53,16 +53,12 @@ } } } -@@ -366,11 +368,29 @@ +@@ -375,11 +377,24 @@ */ public void onDeath(DamageSource par1DamageSource) { -+ if (ForgeHooks.onLivingDeath(this, par1DamageSource)) -+ { -+ return; -+ } -+ - this.mcServer.getConfigurationManager().sendChatMsg(this.field_94063_bt.func_94546_b()); ++ if (ForgeHooks.onLivingDeath(this, par1DamageSource)) return; + this.mcServer.getConfigurationManager().func_110460_a(this.func_110142_aN().func_111182_b()); if (!this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) { @@ -70,7 +66,6 @@ + capturedDrops.clear(); + this.inventory.dropAllItems(); -+ + captureDrops = false; + PlayerDropsEvent event = new PlayerDropsEvent(this, par1DamageSource, capturedDrops, recentlyHit > 0); + if (!MinecraftForge.EVENT_BUS.post(event)) diff --git a/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch index acaddd6d2..0c5cc440b 100644 --- a/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/entity/player/InventoryPlayer.java +++ ../src_work/minecraft/net/minecraft/entity/player/InventoryPlayer.java -@@ -338,6 +338,14 @@ +@@ -357,6 +357,14 @@ if (this.mainInventory[i] != null) { this.mainInventory[i].updateAnimation(this.player.worldObj, this.player, i, this.currentItem == i); diff --git a/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch index a05ae4e79..0006d1437 100644 --- a/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch +++ b/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/inventory/ContainerRepair.java +++ ../src_work/minecraft/net/minecraft/inventory/ContainerRepair.java -@@ -305,6 +305,11 @@ +@@ -315,6 +315,11 @@ k = Math.max(1, k / 2); } @@ -12,7 +12,7 @@ this.maximumCost = k + i; if (i <= 0) -@@ -322,6 +327,7 @@ +@@ -331,6 +336,7 @@ { itemstack1 = null; } diff --git a/patches/minecraft/net/minecraft/inventory/Slot.java.patch b/patches/minecraft/net/minecraft/inventory/Slot.java.patch index 5371563e7..e18fd8e3c 100644 --- a/patches/minecraft/net/minecraft/inventory/Slot.java.patch +++ b/patches/minecraft/net/minecraft/inventory/Slot.java.patch @@ -1,6 +1,15 @@ --- ../src_base/minecraft/net/minecraft/inventory/Slot.java +++ ../src_work/minecraft/net/minecraft/inventory/Slot.java -@@ -22,6 +22,12 @@ +@@ -2,6 +2,8 @@ + + import cpw.mods.fml.relauncher.Side; + import cpw.mods.fml.relauncher.SideOnly; ++import net.minecraft.client.renderer.texture.TextureMap; ++import net.minecraft.client.resources.ResourceLocation; + import net.minecraft.entity.player.EntityPlayer; + import net.minecraft.item.ItemStack; + import net.minecraft.util.Icon; +@@ -22,6 +24,13 @@ /** display position of the inventory slot on the screen y axis */ public int yDisplayPosition; @@ -9,32 +18,40 @@ + protected Icon backgroundIcon = null; + + /** Background texture file assigned to this slot, if any. Vanilla "/gui/items.png" is used if this is null. */ -+ protected String texture = "/gui/items.png"; ++ @SideOnly(Side.CLIENT) ++ protected ResourceLocation texture; public Slot(IInventory par1IInventory, int par2, int par3, int par4) { -@@ -148,6 +154,45 @@ +@@ -148,7 +157,7 @@ */ public Icon getBackgroundIconIndex() { - return null; + return backgroundIcon; } + + @SideOnly(Side.CLIENT) +@@ -156,4 +165,44 @@ + { + return true; + } + + /** + * Gets the path of the texture file to use for the background image of this slot when drawing the GUI. + * @return String: The texture file that will be used in GuiContainer.drawSlotInventory for the slot background. + */ -+ public String getBackgroundIconTexture() ++ @SideOnly(Side.CLIENT) ++ public ResourceLocation getBackgroundIconTexture() + { -+ return (texture == null ? "/gui/items.png" : texture); ++ return (texture == null ? TextureMap.field_110576_c : texture); + } + + /** + * Sets which icon index to use as the background image of the slot when it's empty. + * @param icon The icon to use, null for none + */ -+ public void setBackgroundIconIndex(Icon icon) ++ public void setBackgroundIcon(Icon icon) + { + backgroundIcon = icon; + } @@ -43,9 +60,10 @@ + * Sets the texture file to use for the background image of the slot when it's empty. + * @param textureFilename String: Path of texture file to use, or null to use "/gui/items.png" + */ -+ public void setBackgroundIconTexture(String textureFilename) ++ @SideOnly(Side.CLIENT) ++ public void setBackgroundIconTexture(ResourceLocation texture) + { -+ texture = textureFilename; ++ this.texture = texture; + } + + /** @@ -58,5 +76,4 @@ + { + return slotIndex; + } -+ } diff --git a/patches/minecraft/net/minecraft/item/BehaviorDispenseArmor.java.patch b/patches/minecraft/net/minecraft/item/BehaviorDispenseArmor.java.patch index e308481f4..26d558f06 100644 --- a/patches/minecraft/net/minecraft/item/BehaviorDispenseArmor.java.patch +++ b/patches/minecraft/net/minecraft/item/BehaviorDispenseArmor.java.patch @@ -1,11 +1,11 @@ --- ../src_base/minecraft/net/minecraft/item/BehaviorDispenseArmor.java +++ ../src_work/minecraft/net/minecraft/item/BehaviorDispenseArmor.java -@@ -31,7 +31,7 @@ +@@ -32,7 +32,7 @@ int i1 = EntityLiving.getArmorPosition(par2ItemStack); ItemStack itemstack1 = par2ItemStack.copy(); itemstack1.stackSize = 1; -- entityliving.setCurrentItemOrArmor(i1 - l, itemstack1); -+ entityliving.setCurrentItemOrArmor(i1, itemstack1); //Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players. - entityliving.func_96120_a(i1, 2.0F); - --par2ItemStack.stackSize; - return par2ItemStack; +- entitylivingbase.setCurrentItemOrArmor(i1 - l, itemstack1); ++ entitylivingbase.setCurrentItemOrArmor(i1, itemstack1); //BUGFIX Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players. + + if (entitylivingbase instanceof EntityLiving) + { diff --git a/patches/minecraft/net/minecraft/item/EnumToolMaterial.java.patch b/patches/minecraft/net/minecraft/item/EnumToolMaterial.java.patch index a99f5a41f..4fe0bbb27 100644 --- a/patches/minecraft/net/minecraft/item/EnumToolMaterial.java.patch +++ b/patches/minecraft/net/minecraft/item/EnumToolMaterial.java.patch @@ -8,7 +8,7 @@ + //Added by forge for custom Armor materials. + public Item customCraftingMaterial = null; - private EnumToolMaterial(int par3, int par4, float par5, int par6, int par7) + private EnumToolMaterial(int par3, int par4, float par5, float par6, int par7) { @@ -86,6 +89,14 @@ */ diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches/minecraft/net/minecraft/item/Item.java.patch index 5dca48a9f..6652e03b7 100644 --- a/patches/minecraft/net/minecraft/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -1,17 +1,16 @@ --- ../src_base/minecraft/net/minecraft/item/Item.java +++ ../src_work/minecraft/net/minecraft/item/Item.java -@@ -7,13 +7,19 @@ - import java.util.Random; +@@ -11,13 +11,18 @@ + import java.util.UUID; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -+import net.minecraft.client.entity.EntityClientPlayerMP; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; - import net.minecraft.entity.EntityLiving; + import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItemFrame; import net.minecraft.entity.item.EntityPainting; @@ -20,20 +19,19 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionHelper; import net.minecraft.stats.StatList; -@@ -23,7 +29,10 @@ +@@ -26,7 +31,9 @@ + import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.StatCollector; - import net.minecraft.util.StringTranslate; import net.minecraft.util.Vec3; +import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.world.World; +import net.minecraftforge.common.ChestGenHooks; -+import net.minecraftforge.common.IArmorTextureProvider; public class Item { -@@ -238,13 +247,16 @@ - /** Icon index in the icons table. */ +@@ -248,13 +255,16 @@ protected Icon itemIcon; + protected String field_111218_cA; + /** FORGE: To disable repair recipes. */ + protected boolean canRepair = true; @@ -49,7 +47,7 @@ } itemsList[256 + par1] = this; -@@ -640,6 +652,10 @@ +@@ -639,6 +649,10 @@ float f7 = f4 * f5; float f8 = f3 * f5; double d3 = 5.0D; @@ -60,7 +58,7 @@ Vec3 vec31 = vec3.addVector((double)f7 * d3, (double)f6 * d3, (double)f8 * d3); return par1World.rayTraceBlocks_do_do(vec3, vec31, par3, !par3); } -@@ -720,4 +736,534 @@ +@@ -736,4 +750,509 @@ { StatList.initStats(); } @@ -422,12 +420,11 @@ + * @param itemStack The itemstack + * @return the damage + */ -+ public int getDamageVsEntity(Entity par1Entity, ItemStack itemStack) ++ @Deprecated //Need to find a new place to hook this ++ public float getDamageVsEntity(Entity par1Entity, ItemStack itemStack) + { -+ return getDamageVsEntity(par1Entity); ++ return 0.0F; //getDamageVsEntity(par1Entity); + } -+ -+ @Deprecated private final boolean isArmorProvider = this instanceof IArmorTextureProvider; + /** + * Called by RenderBiped and RenderPlayer to determine the armor texture that + * should be use for the currently equiped item. @@ -443,9 +440,10 @@ + */ + public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer) + { -+ return isArmorProvider ? ((IArmorTextureProvider)this).getArmorTextureFile(stack) : null; ++ return null; + } + ++ + /** + * Returns the font renderer used to render tooltips and overlays for this item. + * Returning null will use the standard font renderer. @@ -469,7 +467,7 @@ + * @return A ModelBiped to render instead of the default + */ + @SideOnly(Side.CLIENT) -+ public ModelBiped getArmorModel(EntityLiving entityLiving, ItemStack itemStack, int armorSlot) ++ public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) + { + return null; + } @@ -481,7 +479,7 @@ + * @param stack The Item stack + * @return True to cancel any further processing by EntityLiving + */ -+ public boolean onEntitySwing(EntityLiving entityLiving, ItemStack stack) ++ public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) + { + return false; + } @@ -509,11 +507,6 @@ + */ + public int getDamage(ItemStack stack) + { -+ return getItemDamageFromStack(stack); -+ } -+ @Deprecated -+ public int getItemDamageFromStack(ItemStack stack) -+ { + return stack.itemDamage; + } + @@ -524,11 +517,6 @@ + */ + public int getDisplayDamage(ItemStack stack) + { -+ return getItemDamageFromStackForDisplay(stack); -+ } -+ @Deprecated -+ public int getItemDamageFromStackForDisplay(ItemStack stack) -+ { + return stack.itemDamage; + } + @@ -541,11 +529,6 @@ + */ + public int getMaxDamage(ItemStack stack) + { -+ return getItemMaxDamageFromStack(stack); -+ } -+ @Deprecated -+ public int getItemMaxDamageFromStack(ItemStack stack) -+ { + return getMaxDamage(); + } + @@ -556,11 +539,6 @@ + */ + public boolean isDamaged(ItemStack stack) + { -+ return isItemStackDamaged(stack); -+ } -+ @Deprecated -+ public boolean isItemStackDamaged(ItemStack stack) -+ { + return stack.itemDamage > 0; + } + @@ -571,11 +549,6 @@ + */ + public void setDamage(ItemStack stack, int damage) + { -+ setItemDamageForStack(stack, damage); -+ } -+ @Deprecated -+ public void setItemDamageForStack(ItemStack stack, int damage) -+ { + stack.itemDamage = damage; + + if (stack.itemDamage < 0) diff --git a/patches/minecraft/net/minecraft/item/ItemBucket.java.patch b/patches/minecraft/net/minecraft/item/ItemBucket.java.patch index 785d5cdad..c266b01f9 100644 --- a/patches/minecraft/net/minecraft/item/ItemBucket.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBucket.java.patch @@ -1,17 +1,17 @@ --- ../src_base/minecraft/net/minecraft/item/ItemBucket.java +++ ../src_work/minecraft/net/minecraft/item/ItemBucket.java @@ -8,6 +8,10 @@ - import net.minecraft.util.EnumMovingObjectType; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; -+ + +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.Event; +import net.minecraftforge.event.entity.player.FillBucketEvent; - ++ public class ItemBucket extends Item { -@@ -40,6 +44,32 @@ + /** field for checking if the bucket has been filled. */ +@@ -35,6 +39,32 @@ } else { diff --git a/patches/minecraft/net/minecraft/item/ItemDye.java.patch b/patches/minecraft/net/minecraft/item/ItemDye.java.patch index ba4fec69d..ec65db841 100644 --- a/patches/minecraft/net/minecraft/item/ItemDye.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemDye.java.patch @@ -85,4 +85,4 @@ + } } - /** + public boolean func_111207_a(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, EntityLivingBase par3EntityLivingBase) diff --git a/patches/minecraft/net/minecraft/item/ItemHoe.java.patch b/patches/minecraft/net/minecraft/item/ItemHoe.java.patch index 6d190ae72..b837ae6d7 100644 --- a/patches/minecraft/net/minecraft/item/ItemHoe.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemHoe.java.patch @@ -10,7 +10,7 @@ public class ItemHoe extends Item { -@@ -32,10 +35,23 @@ +@@ -32,10 +35,22 @@ } else { @@ -30,9 +30,8 @@ - int j1 = par3World.getBlockId(par4, par5 + 1, par6); + boolean air = par3World.isAirBlock(par4, par5 + 1, par6); -- if ((par7 == 0 || j1 != 0 || i1 != Block.grass.blockID) && i1 != Block.dirt.blockID) -+ //Forge: Change 0 to air, also BugFix: parens mismatch causing you to be able to hoe dirt under dirt/grass -+ if (par7 == 0 || !air || (i1 != Block.grass.blockID && i1 != Block.dirt.blockID)) +- if (par7 != 0 && j1 == 0 && (i1 == Block.grass.blockID || i1 == Block.dirt.blockID)) ++ if (par7 != 0 && air && (i1 == Block.grass.blockID || i1 == Block.dirt.blockID)) { - return false; - } + Block block = Block.tilledField; + par3World.playSoundEffect((double)((float)par4 + 0.5F), (double)((float)par5 + 0.5F), (double)((float)par6 + 0.5F), block.stepSound.getStepSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F); diff --git a/patches/minecraft/net/minecraft/item/ItemInWorldManager.java.patch b/patches/minecraft/net/minecraft/item/ItemInWorldManager.java.patch index d888c1859..b17bb9490 100644 --- a/patches/minecraft/net/minecraft/item/ItemInWorldManager.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemInWorldManager.java.patch @@ -82,7 +82,7 @@ if (block != null && flag) { -@@ -257,19 +293,30 @@ +@@ -261,19 +297,30 @@ } else { @@ -115,7 +115,7 @@ if (itemstack != null) { -@@ -281,6 +328,7 @@ +@@ -285,6 +332,7 @@ } } @@ -123,7 +123,7 @@ if (flag && flag1) { Block.blocksList[l].harvestBlock(this.theWorld, this.thisPlayerMP, par1, par2, par3, i1); -@@ -321,6 +369,7 @@ +@@ -325,6 +373,7 @@ if (itemstack1.stackSize == 0) { par1EntityPlayer.inventory.mainInventory[par1EntityPlayer.inventory.currentItem] = null; @@ -131,7 +131,7 @@ } if (!par1EntityPlayer.isUsingItem()) -@@ -338,35 +387,56 @@ +@@ -342,35 +391,56 @@ */ public boolean activateBlockOrUseItem(EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { @@ -215,7 +215,7 @@ } /** -@@ -376,4 +446,13 @@ +@@ -380,4 +450,13 @@ { this.theWorld = par1WorldServer; } diff --git a/patches/minecraft/net/minecraft/item/ItemShears.java.patch b/patches/minecraft/net/minecraft/item/ItemShears.java.patch index 0a3c8c82b..b355b4c1a 100644 --- a/patches/minecraft/net/minecraft/item/ItemShears.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemShears.java.patch @@ -10,28 +10,28 @@ import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentHelper; - import net.minecraft.entity.EntityLiving; ++import net.minecraft.entity.EntityLiving; + import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.stats.StatList; import net.minecraft.world.World; -+ +import net.minecraftforge.common.IShearable; public class ItemShears extends Item { @@ -17,13 +27,12 @@ - public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLiving par7EntityLiving) + public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase) { - if (par3 != Block.leaves.blockID && par3 != Block.web.blockID && par3 != Block.tallGrass.blockID && par3 != Block.vine.blockID && par3 != Block.tripWire.blockID) + if (par3 != Block.leaves.blockID && par3 != Block.web.blockID && par3 != Block.tallGrass.blockID && par3 != Block.vine.blockID && par3 != Block.tripWire.blockID && !(Block.blocksList[par3] instanceof IShearable)) { - return super.onBlockDestroyed(par1ItemStack, par2World, par3, par4, par5, par6, par7EntityLiving); + return super.onBlockDestroyed(par1ItemStack, par2World, par3, par4, par5, par6, par7EntityLivingBase); } else { -- par1ItemStack.damageItem(1, par7EntityLiving); +- par1ItemStack.damageItem(1, par7EntityLivingBase); return true; } } @@ -41,7 +41,7 @@ } + + @Override -+ public boolean itemInteractionForEntity(ItemStack itemstack, EntityLiving entity) ++ public boolean func_111207_a(ItemStack itemstack, EntityPlayer player, EntityLivingBase entity) + { + if (entity.worldObj.isRemote) + { diff --git a/patches/minecraft/net/minecraft/item/ItemStack.java.patch b/patches/minecraft/net/minecraft/item/ItemStack.java.patch index 0b58ee565..a9b7b1a56 100644 --- a/patches/minecraft/net/minecraft/item/ItemStack.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemStack.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/item/ItemStack.java +++ ../src_work/minecraft/net/minecraft/item/ItemStack.java -@@ -249,7 +249,9 @@ +@@ -252,7 +252,9 @@ */ public boolean isItemDamaged() { @@ -11,7 +11,7 @@ } /** -@@ -257,6 +259,10 @@ +@@ -260,6 +262,10 @@ */ public int getItemDamageForDisplay() { @@ -22,7 +22,7 @@ return this.itemDamage; } -@@ -265,6 +271,10 @@ +@@ -268,6 +274,10 @@ */ public int getItemDamage() { @@ -33,7 +33,7 @@ return this.itemDamage; } -@@ -273,6 +283,12 @@ +@@ -276,6 +286,12 @@ */ public void setItemDamage(int par1) { @@ -46,7 +46,7 @@ this.itemDamage = par1; if (this.itemDamage < 0) -@@ -286,7 +302,7 @@ +@@ -289,7 +305,7 @@ */ public int getMaxDamage() { @@ -55,7 +55,7 @@ } /** -@@ -324,8 +340,8 @@ +@@ -327,8 +343,8 @@ } } @@ -66,15 +66,6 @@ } } -@@ -388,7 +404,7 @@ - */ - public int getDamageVsEntity(Entity par1Entity) - { -- return Item.itemsList[this.itemID].getDamageVsEntity(par1Entity); -+ return Item.itemsList[this.itemID].getDamageVsEntity(par1Entity, this); - } - - /** @@ -396,7 +412,7 @@ */ public boolean canHarvestBlock(Block par1Block) @@ -83,4 +74,4 @@ + return Item.itemsList[this.itemID].canHarvestBlock(par1Block, this); } - public boolean interactWith(EntityLiving par1EntityLiving) + public boolean func_111282_a(EntityPlayer par1EntityPlayer, EntityLivingBase par2EntityLivingBase) diff --git a/patches/minecraft/net/minecraft/item/ItemTool.java.patch b/patches/minecraft/net/minecraft/item/ItemTool.java.patch index 2d80fea42..a833ff6ac 100644 --- a/patches/minecraft/net/minecraft/item/ItemTool.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemTool.java.patch @@ -1,16 +1,16 @@ --- ../src_base/minecraft/net/minecraft/item/ItemTool.java +++ ../src_work/minecraft/net/minecraft/item/ItemTool.java -@@ -7,6 +7,7 @@ - import net.minecraft.entity.Entity; - import net.minecraft.entity.EntityLiving; +@@ -9,6 +9,7 @@ + import net.minecraft.entity.SharedMonsterAttributes; + import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.world.World; +import net.minecraftforge.common.ForgeHooks; public class ItemTool extends Item { -@@ -110,4 +111,15 @@ - { - return this.toolMaterial.getToolCraftingMaterial() == par2ItemStack.itemID ? true : super.getIsRepairable(par1ItemStack, par2ItemStack); +@@ -111,4 +112,15 @@ + multimap.put(SharedMonsterAttributes.field_111264_e.func_111108_a(), new AttributeModifier(field_111210_e, "Tool modifier", (double)this.damageVsEntity, 0)); + return multimap; } + + /** FORGE: Overridden to allow custom tool effectiveness */ diff --git a/patches/minecraft/net/minecraft/item/crafting/CraftingManager.java.patch b/patches/minecraft/net/minecraft/item/crafting/CraftingManager.java.patch index 9f78a316f..1b10fb147 100644 --- a/patches/minecraft/net/minecraft/item/crafting/CraftingManager.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/CraftingManager.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/item/crafting/CraftingManager.java +++ ../src_work/minecraft/net/minecraft/item/crafting/CraftingManager.java -@@ -282,7 +282,7 @@ +@@ -284,7 +284,7 @@ } } diff --git a/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch b/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch index f2ce70b23..fd593450e 100644 --- a/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch @@ -18,7 +18,7 @@ /** * Used to call methods addSmelting and getSmeltingResult. -@@ -56,7 +60,9 @@ +@@ -57,7 +61,9 @@ /** * Returns the smelting result of an item. @@ -28,7 +28,7 @@ public ItemStack getSmeltingResult(int par1) { return (ItemStack)this.smeltingList.get(Integer.valueOf(par1)); -@@ -67,8 +73,63 @@ +@@ -68,8 +74,63 @@ return this.smeltingList; } diff --git a/patches/minecraft/net/minecraft/nbt/NBTTagList.java.patch b/patches/minecraft/net/minecraft/nbt/NBTTagList.java.patch index a744f0b16..298a132db 100644 --- a/patches/minecraft/net/minecraft/nbt/NBTTagList.java.patch +++ b/patches/minecraft/net/minecraft/nbt/NBTTagList.java.patch @@ -8,7 +8,7 @@ import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; -@@ -92,8 +90,6 @@ +@@ -99,8 +97,6 @@ this.tagList.add(par1NBTBase); } diff --git a/patches/minecraft/net/minecraft/network/NetServerHandler.java.patch b/patches/minecraft/net/minecraft/network/NetServerHandler.java.patch index 656c74ae2..f84ab1514 100644 --- a/patches/minecraft/net/minecraft/network/NetServerHandler.java.patch +++ b/patches/minecraft/net/minecraft/network/NetServerHandler.java.patch @@ -1,9 +1,10 @@ --- ../src_base/minecraft/net/minecraft/network/NetServerHandler.java +++ ../src_work/minecraft/net/minecraft/network/NetServerHandler.java -@@ -65,6 +65,13 @@ - import net.minecraft.util.ReportedException; +@@ -69,6 +69,14 @@ import net.minecraft.world.WorldServer; + import org.apache.commons.lang3.StringUtils; ++import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.Event; +import net.minecraftforge.event.ForgeEventFactory; @@ -14,7 +15,7 @@ public class NetServerHandler extends NetHandler { /** The underlying network manager for this server handler. */ -@@ -233,6 +240,11 @@ +@@ -242,6 +250,11 @@ if (this.playerEntity.ridingEntity != null) { this.playerEntity.ridingEntity.updateRiderPosition(); @@ -26,7 +27,7 @@ } this.mcServer.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity); -@@ -305,9 +317,9 @@ +@@ -319,9 +332,9 @@ d4 = d1 - this.playerEntity.posX; double d6 = d2 - this.playerEntity.posY; double d7 = d3 - this.playerEntity.posZ; @@ -38,8 +39,8 @@ + double d10 = Math.max(Math.abs(d7), Math.abs(this.playerEntity.motionZ)); double d11 = d8 * d8 + d9 * d9 + d10 * d10; - if (d11 > 100.0D && (!this.mcServer.isSinglePlayer() || !this.mcServer.getServerOwner().equals(this.playerEntity.username))) -@@ -323,6 +335,11 @@ + if (d11 > 100.0D && (!this.mcServer.isSinglePlayer() || !this.mcServer.getServerOwner().equals(this.playerEntity.getCommandSenderName()))) +@@ -337,6 +350,11 @@ if (this.playerEntity.onGround && !par1Packet10Flying.onGround && d6 > 0.0D) { this.playerEntity.addExhaustion(0.2F); @@ -51,8 +52,8 @@ } this.playerEntity.moveEntity(d4, d6, d7); -@@ -347,10 +364,15 @@ - this.mcServer.getLogAgent().logWarning(this.playerEntity.username + " moved wrongly!"); +@@ -361,10 +379,15 @@ + this.mcServer.getLogAgent().logWarning(this.playerEntity.getCommandSenderName() + " moved wrongly!"); } + if (!this.hasMoved) //Fixes "Moved Too Fast" kick when being teleported while moving @@ -68,7 +69,7 @@ { this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ, f2, f3); return; -@@ -358,7 +380,7 @@ +@@ -372,7 +395,7 @@ AxisAlignedBB axisalignedbb = this.playerEntity.boundingBox.copy().expand((double)f4, (double)f4, (double)f4).addCoord(0.0D, -0.55D, 0.0D); @@ -77,7 +78,7 @@ { if (d12 >= -0.03125D) { -@@ -377,6 +399,11 @@ +@@ -391,6 +414,11 @@ this.ticksForFloatKick = 0; } @@ -89,7 +90,7 @@ this.playerEntity.onGround = par1Packet10Flying.onGround; this.mcServer.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity); this.playerEntity.updateFlyingState(this.playerEntity.posY - d0, par1Packet10Flying.onGround); -@@ -443,7 +470,10 @@ +@@ -461,7 +489,10 @@ double d2 = this.playerEntity.posZ - ((double)k + 0.5D); double d3 = d0 * d0 + d1 * d1 + d2 * d2; @@ -101,7 +102,7 @@ { return; } -@@ -503,7 +533,11 @@ +@@ -521,7 +552,11 @@ return; } @@ -114,7 +115,7 @@ } else if (par1Packet15Place.getYPosition() >= this.mcServer.getBuildLimit() - 1 && (par1Packet15Place.getDirection() == 1 || par1Packet15Place.getYPosition() >= this.mcServer.getBuildLimit())) { -@@ -512,7 +546,9 @@ +@@ -530,7 +565,9 @@ } else { @@ -125,22 +126,16 @@ { this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, worldserver, itemstack, i, j, k, l, par1Packet15Place.getXOffset(), par1Packet15Place.getYOffset(), par1Packet15Place.getZOffset()); } -@@ -691,7 +727,14 @@ - return; +@@ -710,6 +747,8 @@ } -+ String old = s; - s = "<" + this.playerEntity.getTranslatedEntityName() + "> " + s; -+ ServerChatEvent event = new ServerChatEvent(this.playerEntity, old, s); -+ if (MinecraftForge.EVENT_BUS.post(event)) -+ { -+ return; -+ } -+ s = event.line; - this.mcServer.getLogAgent().logInfo(s); - this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new Packet3Chat(s, false)); + ChatMessageComponent chatmessagecomponent = ChatMessageComponent.func_111082_b("chat.type.text", new Object[] {this.playerEntity.getTranslatedEntityName(), s}); ++ chatmessagecomponent = ForgeHooks.onServerChatEvent(this, s, chatmessagecomponent); ++ if (chatmessagecomponent == null) return; + this.mcServer.getConfigurationManager().func_110459_a(chatmessagecomponent, false); } -@@ -822,7 +865,7 @@ + +@@ -850,7 +889,7 @@ return; } @@ -149,12 +144,3 @@ } } } -@@ -1220,7 +1263,7 @@ - } - } - } -- -+ - - @Override - diff --git a/patches/minecraft/net/minecraft/network/packet/Packet51MapChunk.java.patch b/patches/minecraft/net/minecraft/network/packet/Packet51MapChunk.java.patch index e8d50c754..3c6c38fb5 100644 --- a/patches/minecraft/net/minecraft/network/packet/Packet51MapChunk.java.patch +++ b/patches/minecraft/net/minecraft/network/packet/Packet51MapChunk.java.patch @@ -1,8 +1,8 @@ --- ../src_base/minecraft/net/minecraft/network/packet/Packet51MapChunk.java +++ ../src_work/minecraft/net/minecraft/network/packet/Packet51MapChunk.java @@ -5,6 +5,7 @@ - import java.io.DataInputStream; - import java.io.DataOutputStream; + import java.io.DataInput; + import java.io.DataOutput; import java.io.IOException; +import java.util.concurrent.Semaphore; import java.util.zip.DataFormatException; @@ -47,7 +47,7 @@ finally { @@ -97,13 +105,16 @@ - par1DataInputStream.readFully(temp, 0, this.tempLength); + par1DataInput.readFully(temp, 0, this.tempLength); int i = 0; int j; + int msb = 0; //BugFix: MC does not read the MSB array from the packet properly, causing issues for servers that use blocks > 256 @@ -65,7 +65,7 @@ { @@ -133,6 +144,16 @@ */ - public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException + public void writePacketData(DataOutput par1DataOutput) throws IOException { + if (chunkData == null) + { @@ -77,6 +77,6 @@ + deflateGate.release(); + } + - par1DataOutputStream.writeInt(this.xCh); - par1DataOutputStream.writeInt(this.zCh); - par1DataOutputStream.writeBoolean(this.includeInitialize); + par1DataOutput.writeInt(this.xCh); + par1DataOutput.writeInt(this.zCh); + par1DataOutput.writeBoolean(this.includeInitialize); diff --git a/patches/minecraft/net/minecraft/network/packet/Packet52MultiBlockChange.java.patch b/patches/minecraft/net/minecraft/network/packet/Packet52MultiBlockChange.java.patch index 829228274..12dca7774 100644 --- a/patches/minecraft/net/minecraft/network/packet/Packet52MultiBlockChange.java.patch +++ b/patches/minecraft/net/minecraft/network/packet/Packet52MultiBlockChange.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/network/packet/Packet52MultiBlockChange.java +++ ../src_work/minecraft/net/minecraft/network/packet/Packet52MultiBlockChange.java -@@ -6,6 +6,8 @@ +@@ -7,6 +7,8 @@ import java.io.IOException; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; @@ -9,7 +9,7 @@ public class Packet52MultiBlockChange extends Packet { -@@ -38,10 +40,8 @@ +@@ -39,10 +41,8 @@ try { diff --git a/patches/minecraft/net/minecraft/network/packet/Packet56MapChunks.java.patch b/patches/minecraft/net/minecraft/network/packet/Packet56MapChunks.java.patch index f89f2651b..1ef0a9d8b 100644 --- a/patches/minecraft/net/minecraft/network/packet/Packet56MapChunks.java.patch +++ b/patches/minecraft/net/minecraft/network/packet/Packet56MapChunks.java.patch @@ -1,7 +1,7 @@ --- ../src_base/minecraft/net/minecraft/network/packet/Packet56MapChunks.java +++ ../src_work/minecraft/net/minecraft/network/packet/Packet56MapChunks.java @@ -6,6 +6,7 @@ - import java.io.DataOutputStream; + import java.io.DataOutput; import java.io.IOException; import java.util.List; +import java.util.concurrent.Semaphore; @@ -67,9 +67,9 @@ } finally { -@@ -155,6 +164,16 @@ +@@ -155,6 +164,15 @@ */ - public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException + public void writePacketData(DataOutput par1DataOutput) throws IOException { + if (this.chunkDataBuffer == null) + { @@ -80,7 +80,6 @@ + } + deflateGate.release(); + } -+ - par1DataOutputStream.writeShort(this.chunkPostX.length); - par1DataOutputStream.writeInt(this.dataLength); - par1DataOutputStream.writeBoolean(this.skyLightSent); + par1DataOutput.writeShort(this.chunkPostX.length); + par1DataOutput.writeInt(this.dataLength); + par1DataOutput.writeBoolean(this.skyLightSent); diff --git a/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch b/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch index 5504c8ee4..0a52e4c3f 100644 --- a/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch +++ b/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch @@ -8,7 +8,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; - import net.minecraft.entity.EntityLiving; + import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -104,4 +104,4 @@ + } } - public boolean isSplashPotionEffect() + /** diff --git a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch index f6c504c0e..4b7218d2c 100644 --- a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch +++ b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/server/MinecraftServer.java +++ ../src_work/minecraft/net/minecraft/server/MinecraftServer.java -@@ -12,6 +12,7 @@ +@@ -11,6 +11,7 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; @@ -8,7 +8,7 @@ import java.util.Iterator; import java.util.List; import java.util.logging.Level; -@@ -56,6 +57,10 @@ +@@ -54,6 +55,10 @@ import net.minecraft.world.storage.ISaveHandler; import net.minecraft.world.storage.WorldInfo; @@ -19,7 +19,7 @@ public abstract class MinecraftServer implements ICommandSender, Runnable, IPlayerUsage { /** Instance of Minecraft Server. */ -@@ -80,7 +85,7 @@ +@@ -78,7 +83,7 @@ private int serverPort = -1; /** The server world instances. */ @@ -28,8 +28,8 @@ /** The ServerConfigurationManager instance. */ private ServerConfigurationManager serverConfigManager; -@@ -133,7 +138,8 @@ - public final long[] tickTimeArray = new long[100]; +@@ -132,7 +137,8 @@ + public final long[] tickTimeArray; /** Stats are [dimension][tick%100] system.nanoTime is stored. */ - public long[][] timeOfLastDimensionTick; @@ -38,7 +38,7 @@ private KeyPair serverKeyPair; /** Username of the server owner (for integrated servers) */ -@@ -210,8 +216,6 @@ +@@ -216,8 +222,6 @@ { this.convertMapIfNeeded(par1Str); this.setUserMessage("menu.loadingLevel"); @@ -47,7 +47,7 @@ ISaveHandler isavehandler = this.anvilConverterForAnvilFile.getSaveLoader(par1Str, true); WorldInfo worldinfo = isavehandler.loadWorldInfo(); WorldSettings worldsettings; -@@ -231,46 +235,23 @@ +@@ -237,46 +241,23 @@ worldsettings.enableBonusChest(); } @@ -105,7 +105,7 @@ this.setDifficultyForAllWorlds(this.getDifficulty()); this.initialWorldChunkLoad(); } -@@ -346,6 +327,7 @@ +@@ -358,6 +339,7 @@ if (!this.worldIsBeingDeleted) { WorldServer[] aworldserver = this.worldServers; @@ -113,7 +113,7 @@ int i = aworldserver.length; for (int j = 0; j < i; ++j) -@@ -399,7 +381,14 @@ +@@ -411,7 +393,14 @@ for (int i = 0; i < this.worldServers.length; ++i) { WorldServer worldserver = this.worldServers[i]; @@ -128,7 +128,7 @@ } if (this.usageSnooper != null && this.usageSnooper.isSnooperRunning()) -@@ -624,13 +613,15 @@ +@@ -636,13 +625,15 @@ this.theProfiler.startSection("levels"); int i; @@ -149,7 +149,7 @@ this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName()); this.theProfiler.startSection("pools"); worldserver.getWorldVec3Pool().clear(); -@@ -677,9 +668,11 @@ +@@ -689,9 +680,11 @@ this.theProfiler.endSection(); } @@ -164,7 +164,7 @@ this.theProfiler.endStartSection("connection"); this.getNetworkThread().networkTick(); this.theProfiler.endStartSection("players"); -@@ -733,7 +726,13 @@ +@@ -745,7 +738,13 @@ */ public WorldServer worldServerForDimension(int par1) { @@ -179,7 +179,7 @@ } @SideOnly(Side.SERVER) -@@ -1104,6 +1103,7 @@ +@@ -1108,6 +1107,7 @@ if (worldserver != null) { diff --git a/patches/minecraft/net/minecraft/server/gui/StatsComponent.java.patch b/patches/minecraft/net/minecraft/server/gui/StatsComponent.java.patch new file mode 100644 index 000000000..05baecfa2 --- /dev/null +++ b/patches/minecraft/net/minecraft/server/gui/StatsComponent.java.patch @@ -0,0 +1,43 @@ +--- ../src_base/minecraft/net/minecraft/server/gui/StatsComponent.java ++++ ../src_work/minecraft/net/minecraft/server/gui/StatsComponent.java +@@ -10,6 +10,8 @@ + import javax.swing.Timer; + import net.minecraft.network.TcpConnection; + import net.minecraft.server.MinecraftServer; ++import net.minecraft.world.WorldServer; ++import net.minecraftforge.common.DimensionManager; + + @SideOnly(Side.SERVER) + public class StatsComponent extends JComponent +@@ -32,6 +34,7 @@ + + private void func_120034_a() + { ++ this.field_120036_d = new String[5 + DimensionManager.getIDs().length]; + long i = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); + System.gc(); + this.field_120036_d[0] = "Memory use: " + i / 1024L / 1024L + " mb (" + Runtime.getRuntime().freeMemory() * 100L / Runtime.getRuntime().maxMemory() + "% free)"; +@@ -42,15 +45,18 @@ + + if (this.field_120037_e.worldServers != null) + { +- for (int j = 0; j < this.field_120037_e.worldServers.length; ++j) ++ int j = 0; ++ for (Integer id : DimensionManager.getIDs()) + { +- this.field_120036_d[5 + j] = "Lvl " + j + " tick: " + field_120040_a.format(this.func_120035_a(this.field_120037_e.timeOfLastDimensionTick[j]) * 1.0E-6D) + " ms"; ++ this.field_120036_d[5 + j] = "Lvl " + id + " tick: " + field_120040_a.format(this.func_120035_a(this.field_120037_e.worldTickTimes.get(id)) * 1.0E-6D) + " ms"; + +- if (this.field_120037_e.worldServers[j] != null && this.field_120037_e.worldServers[j].theChunkProviderServer != null) ++ WorldServer world = DimensionManager.getWorld(id); ++ if (world != null && world.theChunkProviderServer != null) + { +- this.field_120036_d[5 + j] = this.field_120036_d[5 + j] + ", " + this.field_120037_e.worldServers[j].theChunkProviderServer.makeString(); +- this.field_120036_d[5 + j] = this.field_120036_d[5 + j] + ", Vec3: " + this.field_120037_e.worldServers[j].getWorldVec3Pool().func_82590_d() + " / " + this.field_120037_e.worldServers[j].getWorldVec3Pool().getPoolSize(); ++ this.field_120036_d[5 + j] = this.field_120036_d[5 + j] + ", " + world.theChunkProviderServer.makeString(); ++ this.field_120036_d[5 + j] = this.field_120036_d[5 + j] + ", Vec3: " + world.getWorldVec3Pool().func_82590_d() + " / " + world.getWorldVec3Pool().getPoolSize(); + } ++ j++; + } + } + diff --git a/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch b/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch index 51c02e4b5..db0fe6d6c 100644 --- a/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch +++ b/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch @@ -11,7 +11,7 @@ @SideOnly(Side.CLIENT) public class IntegratedServer extends MinecraftServer { -@@ -63,44 +67,23 @@ +@@ -65,44 +69,23 @@ protected void loadAllWorlds(String par1Str, String par2Str, long par3, WorldType par5WorldType, String par6Str) { this.convertMapIfNeeded(par1Str); diff --git a/patches/minecraft/net/minecraft/server/management/PlayerInstance.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerInstance.java.patch index eb3679c79..3b10eecf9 100644 --- a/patches/minecraft/net/minecraft/server/management/PlayerInstance.java.patch +++ b/patches/minecraft/net/minecraft/server/management/PlayerInstance.java.patch @@ -8,17 +8,17 @@ import java.util.List; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.packet.Packet; -@@ -9,6 +10,9 @@ - import net.minecraft.network.packet.Packet53BlockChange; +@@ -10,6 +11,9 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.ChunkCoordIntPair; + import net.minecraft.world.chunk.Chunk; +import net.minecraftforge.common.ForgeDummyContainer; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.world.ChunkWatchEvent; public class PlayerInstance { -@@ -56,6 +60,8 @@ +@@ -63,6 +67,8 @@ this.playersInChunk.remove(par1EntityPlayerMP); par1EntityPlayerMP.loadedChunks.remove(this.chunkLocation); @@ -27,7 +27,7 @@ if (this.playersInChunk.isEmpty()) { long i = (long)this.chunkLocation.chunkXPos + 2147483647L | (long)this.chunkLocation.chunkZPos + 2147483647L << 32; -@@ -80,7 +86,7 @@ +@@ -100,7 +106,7 @@ this.field_73260_f |= 1 << (par2 >> 4); @@ -36,7 +36,7 @@ { short short1 = (short)(par1 << 12 | par3 << 8 | par2); -@@ -92,6 +98,10 @@ +@@ -112,6 +118,10 @@ } } @@ -47,7 +47,7 @@ this.locationOfBlockChange[this.numberOfTilesToUpdate++] = short1; } } -@@ -133,12 +143,13 @@ +@@ -153,12 +163,13 @@ { int l; @@ -62,7 +62,7 @@ for (k = 0; k < 16; ++k) { if ((this.field_73260_f & 1 << k) != 0) -@@ -152,11 +163,14 @@ +@@ -172,11 +183,14 @@ } } } diff --git a/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch b/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch index b7657c7af..2fe38a1dc 100644 --- a/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/server/management/ServerConfigurationManager.java +++ ../src_work/minecraft/net/minecraft/server/management/ServerConfigurationManager.java -@@ -47,10 +47,14 @@ +@@ -48,10 +48,14 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.MathHelper; import net.minecraft.world.EnumGameType; @@ -15,7 +15,7 @@ public abstract class ServerConfigurationManager { -@@ -386,6 +390,16 @@ +@@ -387,6 +391,16 @@ */ public EntityPlayerMP respawnPlayer(EntityPlayerMP par1EntityPlayerMP, int par2, boolean par3) { @@ -32,15 +32,15 @@ par1EntityPlayerMP.getServerForPlayer().getEntityTracker().removePlayerFromTrackers(par1EntityPlayerMP); par1EntityPlayerMP.getServerForPlayer().getEntityTracker().removeEntityFromAllTrackingPlayers(par1EntityPlayerMP); par1EntityPlayerMP.getServerForPlayer().getPlayerManager().removePlayer(par1EntityPlayerMP); -@@ -408,6 +422,7 @@ - EntityPlayerMP entityplayermp1 = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension), par1EntityPlayerMP.username, (ItemInWorldManager)object); +@@ -409,6 +423,7 @@ + EntityPlayerMP entityplayermp1 = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension), par1EntityPlayerMP.getCommandSenderName(), (ItemInWorldManager)object); entityplayermp1.playerNetServerHandler = par1EntityPlayerMP.playerNetServerHandler; entityplayermp1.clonePlayer(par1EntityPlayerMP, par3); + entityplayermp1.dimension = par2; entityplayermp1.entityId = par1EntityPlayerMP.entityId; WorldServer worldserver = this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension); this.func_72381_a(entityplayermp1, par1EntityPlayerMP, worldserver); -@@ -452,6 +467,11 @@ +@@ -453,6 +468,11 @@ public void transferPlayerToDimension(EntityPlayerMP par1EntityPlayerMP, int par2) { @@ -52,7 +52,7 @@ int j = par1EntityPlayerMP.dimension; WorldServer worldserver = this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension); par1EntityPlayerMP.dimension = par2; -@@ -459,7 +479,7 @@ +@@ -460,7 +480,7 @@ par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet9Respawn(par1EntityPlayerMP.dimension, (byte)par1EntityPlayerMP.worldObj.difficultySetting, worldserver1.getWorldInfo().getTerrainType(), worldserver1.getHeight(), par1EntityPlayerMP.theItemInWorldManager.getGameType())); worldserver.removePlayerEntityDangerously(par1EntityPlayerMP); par1EntityPlayerMP.isDead = false; @@ -61,7 +61,7 @@ this.func_72375_a(par1EntityPlayerMP, worldserver); par1EntityPlayerMP.playerNetServerHandler.setPlayerLocation(par1EntityPlayerMP.posX, par1EntityPlayerMP.posY, par1EntityPlayerMP.posZ, par1EntityPlayerMP.rotationYaw, par1EntityPlayerMP.rotationPitch); par1EntityPlayerMP.theItemInWorldManager.setWorld(worldserver1); -@@ -481,38 +501,23 @@ +@@ -482,38 +502,23 @@ */ public void transferEntityToWorld(Entity par1Entity, int par2, WorldServer par3WorldServer, WorldServer par4WorldServer) { @@ -111,7 +111,7 @@ { ChunkCoordinates chunkcoordinates; -@@ -549,7 +554,7 @@ +@@ -550,7 +555,7 @@ par4WorldServer.spawnEntityInWorld(par1Entity); par1Entity.setLocationAndAngles(d0, par1Entity.posY, d1, par1Entity.rotationYaw, par1Entity.rotationPitch); par4WorldServer.updateEntityWithOptionalForce(par1Entity, false); diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch index 24545aa78..e30701e53 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch @@ -75,7 +75,7 @@ { Block block = Block.blocksList[i]; -@@ -451,4 +457,50 @@ +@@ -456,4 +462,50 @@ { return par3 != 0 || par1 != 1 || par2ItemStack.itemID == Item.bucketEmpty.itemID; } diff --git a/patches/minecraft/net/minecraft/village/VillageCollection.java.patch b/patches/minecraft/net/minecraft/village/VillageCollection.java.patch index b0870dfaf..f4811e403 100644 --- a/patches/minecraft/net/minecraft/village/VillageCollection.java.patch +++ b/patches/minecraft/net/minecraft/village/VillageCollection.java.patch @@ -1,18 +1,5 @@ --- ../src_base/minecraft/net/minecraft/village/VillageCollection.java +++ ../src_work/minecraft/net/minecraft/village/VillageCollection.java -@@ -128,9 +128,9 @@ - - if (f1 < f) - { -- int i1 = par4 + village1.getVillageRadius(); -- -- if (f1 <= (float)(i1 * i1)) -+ float i1 = par4 + village1.getVillageRadius(); -+ -+ if (f1 <= i1 * i1) - { - village = village1; - f = f1; @@ -165,7 +165,7 @@ { Village village = (Village)iterator.next(); diff --git a/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch b/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch index d820f9872..d42d2f211 100644 --- a/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch +++ b/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch @@ -8,7 +8,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; -@@ -19,6 +21,10 @@ +@@ -17,6 +19,10 @@ import net.minecraft.world.biome.SpawnListEntry; import net.minecraft.world.chunk.Chunk; @@ -19,38 +19,43 @@ public final class SpawnerAnimals { /** The 17x17 area around the player where mobs can spawn */ -@@ -90,9 +96,12 @@ +@@ -85,9 +91,12 @@ { EnumCreatureType enumcreaturetype = aenumcreaturetype[j1]; -- if ((!enumcreaturetype.getPeacefulCreature() || par2) && (enumcreaturetype.getPeacefulCreature() || par1) && (!enumcreaturetype.getAnimal() || par3) && par0WorldServer.countEntities(enumcreaturetype.getCreatureClass()) <= enumcreaturetype.getMaxNumberOfCreature() * eligibleChunksForSpawning.size() / 256) -+ if ((!enumcreaturetype.getPeacefulCreature() || par2) && (enumcreaturetype.getPeacefulCreature() || par1) && (!enumcreaturetype.getAnimal() || par3) && par0WorldServer.countEntities(enumcreaturetype, true) <= enumcreaturetype.getMaxNumberOfCreature() * eligibleChunksForSpawning.size() / 256) +- if ((!enumcreaturetype.getPeacefulCreature() || par3) && (enumcreaturetype.getPeacefulCreature() || par2) && (!enumcreaturetype.getAnimal() || par4) && par1WorldServer.countEntities(enumcreaturetype.getCreatureClass()) <= enumcreaturetype.getMaxNumberOfCreature() * this.eligibleChunksForSpawning.size() / 256) ++ if ((!enumcreaturetype.getPeacefulCreature() || par3) && (enumcreaturetype.getPeacefulCreature() || par2) && (!enumcreaturetype.getAnimal() || par4) && par1WorldServer.countEntities(enumcreaturetype, true) <= enumcreaturetype.getMaxNumberOfCreature() * this.eligibleChunksForSpawning.size() / 256) { - Iterator iterator = eligibleChunksForSpawning.keySet().iterator(); + Iterator iterator = this.eligibleChunksForSpawning.keySet().iterator(); + ArrayList tmp = new ArrayList(eligibleChunksForSpawning.keySet()); + Collections.shuffle(tmp); + iterator = tmp.iterator(); label110: while (iterator.hasNext()) -@@ -169,13 +178,14 @@ +@@ -165,13 +174,17 @@ - entityliving.setLocationAndAngles((double)f, (double)f1, (double)f2, par0WorldServer.rand.nextFloat() * 360.0F, 0.0F); + entityliving.setLocationAndAngles((double)f, (double)f1, (double)f2, par1WorldServer.rand.nextFloat() * 360.0F, 0.0F); - if (entityliving.getCanSpawnHere()) -+ Result canSpawn = ForgeEventFactory.canEntitySpawn(entityliving, par0WorldServer, f, f1, f2); ++ Result canSpawn = ForgeEventFactory.canEntitySpawn(entityliving, par1WorldServer, f, f1, f2); + if (canSpawn == Result.ALLOW || (canSpawn == Result.DEFAULT && entityliving.getCanSpawnHere())) { ++j2; - par0WorldServer.spawnEntityInWorld(entityliving); - creatureSpecificInit(entityliving, par0WorldServer, f, f1, f2); - + par1WorldServer.spawnEntityInWorld(entityliving); +- entitylivingdata = entityliving.func_110161_a(entitylivingdata); +- - if (j2 >= entityliving.getMaxSpawnedInChunk()) ++ if (!ForgeEventFactory.doSpecialSpawn(entityliving, par1WorldServer, f, f1, f2)) ++ { ++ entitylivingdata = entityliving.func_110161_a(entitylivingdata); ++ } ++ + if (j2 >= ForgeEventFactory.getMaxSpawnPackSize(entityliving)) { continue label110; } -@@ -221,7 +231,8 @@ +@@ -217,7 +230,8 @@ else { int l = par1World.getBlockId(par2, par3 - 1, par4); @@ -60,15 +65,3 @@ } } -@@ -230,6 +241,11 @@ - */ - private static void creatureSpecificInit(EntityLiving par0EntityLiving, World par1World, float par2, float par3, float par4) - { -+ if (ForgeEventFactory.doSpecialSpawn(par0EntityLiving, par1World, par2, par3, par4)) -+ { -+ return; -+ } -+ - par0EntityLiving.initCreature(); - } - diff --git a/patches/minecraft/net/minecraft/world/World.java.patch b/patches/minecraft/net/minecraft/world/World.java.patch index cb8dae659..27f1ff912 100644 --- a/patches/minecraft/net/minecraft/world/World.java.patch +++ b/patches/minecraft/net/minecraft/world/World.java.patch @@ -7,7 +7,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; -@@ -52,8 +53,32 @@ +@@ -53,8 +54,32 @@ import net.minecraft.world.storage.MapStorage; import net.minecraft.world.storage.WorldInfo; @@ -40,18 +40,18 @@ /** * boolean; if true updates scheduled by scheduleBlockUpdate happen immediately */ -@@ -165,6 +190,11 @@ - * Gets the biome for a given set of x/z coordinates +@@ -167,6 +192,11 @@ */ public BiomeGenBase getBiomeGenForCoords(int par1, int par2) -+ { + { + return provider.getBiomeGenForCoords(par1, par2); + } + + public BiomeGenBase getBiomeGenForCoordsBody(int par1, int par2) - { ++ { if (this.blockExists(par1, 0, par2)) { + Chunk chunk = this.getChunkFromBlockCoords(par1, par2); @@ -194,8 +224,15 @@ this.theProfiler = par5Profiler; this.worldInfo = new WorldInfo(par4WorldSettings, par2Str); @@ -82,8 +82,8 @@ this.chunkProvider = this.createChunkProvider(); this.calculateInitialSkylight(); this.calculateInitialWeather(); -@@ -222,7 +261,7 @@ - this.isRemote = false; +@@ -221,7 +260,7 @@ + this.lightUpdateBlockList = new int[32768]; this.saveHandler = par1ISaveHandler; this.theProfiler = par5Profiler; - this.mapStorage = new MapStorage(par1ISaveHandler); @@ -91,7 +91,7 @@ this.worldLogAgent = par6ILogAgent; this.worldInfo = par1ISaveHandler.loadWorldInfo(); -@@ -276,12 +315,20 @@ +@@ -275,12 +314,20 @@ this.worldInfo.setServerInitialized(true); } @@ -114,7 +114,7 @@ } else { -@@ -291,6 +338,19 @@ +@@ -290,6 +337,19 @@ this.calculateInitialSkylight(); this.calculateInitialWeather(); @@ -134,7 +134,7 @@ } /** -@@ -374,7 +434,8 @@ +@@ -373,7 +433,8 @@ */ public boolean isAirBlock(int par1, int par2, int par3) { @@ -144,7 +144,7 @@ } /** -@@ -383,7 +444,8 @@ +@@ -382,7 +443,8 @@ public boolean blockHasTileEntity(int par1, int par2, int par3) { int l = this.getBlockId(par1, par2, par3); @@ -154,7 +154,7 @@ } /** -@@ -1158,7 +1220,7 @@ +@@ -1157,7 +1219,7 @@ */ public boolean isDaytime() { @@ -163,7 +163,7 @@ } /** -@@ -1190,7 +1252,7 @@ +@@ -1189,7 +1251,7 @@ int l1 = this.getBlockMetadata(l, i1, j1); Block block = Block.blocksList[k1]; @@ -172,7 +172,7 @@ { MovingObjectPosition movingobjectposition = block.collisionRayTrace(this, l, i1, j1, par1Vec3, par2Vec3); -@@ -1390,6 +1452,12 @@ +@@ -1389,6 +1451,12 @@ */ public void playSoundAtEntity(Entity par1Entity, String par2Str, float par3, float par4) { @@ -185,7 +185,7 @@ if (par1Entity != null && par2Str != null) { for (int i = 0; i < this.worldAccesses.size(); ++i) -@@ -1404,6 +1472,12 @@ +@@ -1403,6 +1471,12 @@ */ public void playSoundToNearExcept(EntityPlayer par1EntityPlayer, String par2Str, float par3, float par4) { @@ -198,7 +198,7 @@ if (par1EntityPlayer != null && par2Str != null) { for (int i = 0; i < this.worldAccesses.size(); ++i) -@@ -1490,6 +1564,11 @@ +@@ -1489,6 +1563,11 @@ EntityPlayer entityplayer = (EntityPlayer)par1Entity; this.playerEntities.add(entityplayer); this.updateAllPlayersSleepingFlag(); @@ -210,7 +210,7 @@ } this.getChunkFromChunkCoords(i, j).addEntity(par1Entity); -@@ -1736,6 +1815,12 @@ +@@ -1735,6 +1814,12 @@ * Calculates the color for the skybox */ public Vec3 getSkyColor(Entity par1Entity, float par2) @@ -223,7 +223,7 @@ { float f1 = this.getCelestialAngle(par2); float f2 = MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; -@@ -1828,6 +1913,12 @@ +@@ -1833,6 +1918,12 @@ @SideOnly(Side.CLIENT) public Vec3 getCloudColour(float par1) { @@ -236,7 +236,7 @@ float f1 = this.getCelestialAngle(par1); float f2 = MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; -@@ -1899,6 +1990,8 @@ +@@ -1904,6 +1995,8 @@ public int getTopSolidOrLiquidBlock(int par1, int par2) { Chunk chunk = this.getChunkFromBlockCoords(par1, par2); @@ -245,7 +245,7 @@ int k = chunk.getTopFilledSegment() + 15; par1 &= 15; -@@ -1906,7 +1999,7 @@ +@@ -1911,7 +2004,7 @@ { int l = chunk.getBlockID(par1, k, par2); @@ -254,7 +254,7 @@ { return k + 1; } -@@ -1921,6 +2014,12 @@ +@@ -1926,6 +2019,12 @@ * How bright are stars in the sky */ public float getStarBrightness(float par1) @@ -267,7 +267,7 @@ { float f1 = this.getCelestialAngle(par1); float f2 = 1.0F - (MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.25F); -@@ -1985,7 +2084,15 @@ +@@ -1990,7 +2089,15 @@ entity.func_85029_a(crashreportcategory); } @@ -284,7 +284,7 @@ } if (entity.isDead) -@@ -2047,7 +2154,16 @@ +@@ -2052,7 +2159,16 @@ crashreport = CrashReport.makeCrashReport(throwable1, "Ticking entity"); crashreportcategory = crashreport.makeCategory("Entity being ticked"); entity.func_85029_a(crashreportcategory); @@ -302,7 +302,7 @@ } } -@@ -2090,7 +2206,16 @@ +@@ -2095,7 +2211,16 @@ crashreport = CrashReport.makeCrashReport(throwable2, "Ticking tile entity"); crashreportcategory = crashreport.makeCategory("Tile entity being ticked"); tileentity.func_85027_a(crashreportcategory); @@ -320,7 +320,7 @@ } } -@@ -2104,7 +2229,7 @@ +@@ -2109,7 +2234,7 @@ if (chunk != null) { @@ -329,7 +329,7 @@ } } } -@@ -2113,6 +2238,10 @@ +@@ -2118,6 +2243,10 @@ if (!this.entityRemoval.isEmpty()) { @@ -340,7 +340,7 @@ this.loadedTileEntityList.removeAll(this.entityRemoval); this.entityRemoval.clear(); } -@@ -2133,18 +2262,18 @@ +@@ -2138,18 +2267,18 @@ { this.loadedTileEntityList.add(tileentity1); } @@ -363,7 +363,7 @@ } } -@@ -2157,13 +2286,13 @@ +@@ -2162,13 +2291,13 @@ public void addTileEntity(Collection par1Collection) { @@ -384,7 +384,7 @@ } } -@@ -2183,9 +2312,17 @@ +@@ -2188,9 +2317,17 @@ { int i = MathHelper.floor_double(par1Entity.posX); int j = MathHelper.floor_double(par1Entity.posZ); @@ -405,7 +405,7 @@ { par1Entity.lastTickPosX = par1Entity.posX; par1Entity.lastTickPosY = par1Entity.posY; -@@ -2418,6 +2555,14 @@ +@@ -2423,6 +2560,14 @@ { return true; } @@ -420,7 +420,7 @@ } } } -@@ -2740,15 +2885,16 @@ +@@ -2745,15 +2890,16 @@ */ public void setBlockTileEntity(int par1, int par2, int par3, TileEntity par4TileEntity) { @@ -446,7 +446,7 @@ while (iterator.hasNext()) { TileEntity tileentity1 = (TileEntity)iterator.next(); -@@ -2759,19 +2905,18 @@ +@@ -2764,19 +2910,18 @@ iterator.remove(); } } @@ -475,7 +475,7 @@ } } -@@ -2780,27 +2925,10 @@ +@@ -2785,27 +2930,10 @@ */ public void removeBlockTileEntity(int par1, int par2, int par3) { @@ -507,7 +507,7 @@ } } -@@ -2826,7 +2954,8 @@ +@@ -2831,7 +2959,8 @@ */ public boolean isBlockNormalCube(int par1, int par2, int par3) { @@ -517,7 +517,7 @@ } public boolean func_85174_u(int par1, int par2, int par3) -@@ -2849,16 +2978,17 @@ +@@ -2854,16 +2983,17 @@ */ public boolean doesBlockHaveSolidTopSurface(int par1, int par2, int par3) { @@ -537,7 +537,7 @@ return par1Block == null ? false : (par1Block.blockMaterial.isOpaque() && par1Block.renderAsNormalBlock() ? true : (par1Block instanceof BlockStairs ? (par2 & 4) == 4 : (par1Block instanceof BlockHalfSlab ? (par2 & 8) == 8 : (par1Block instanceof BlockHopper ? true : (par1Block instanceof BlockSnow ? (par2 & 7) == 7 : false))))); } -@@ -2875,7 +3005,7 @@ +@@ -2880,7 +3010,7 @@ if (chunk != null && !chunk.isEmpty()) { Block block = Block.blocksList[this.getBlockId(par1, par2, par3)]; @@ -546,7 +546,7 @@ } else { -@@ -2906,8 +3036,7 @@ +@@ -2911,8 +3041,7 @@ */ public void setAllowedSpawnTypes(boolean par1, boolean par2) { @@ -556,7 +556,7 @@ } /** -@@ -2923,6 +3052,11 @@ +@@ -2928,6 +3057,11 @@ */ private void calculateInitialWeather() { @@ -568,7 +568,7 @@ if (this.worldInfo.isRaining()) { this.rainingStrength = 1.0F; -@@ -2938,6 +3072,11 @@ +@@ -2943,6 +3077,11 @@ * Updates all weather states. */ protected void updateWeather() @@ -580,7 +580,7 @@ { if (!this.provider.hasNoSky) { -@@ -3035,12 +3174,14 @@ +@@ -3040,12 +3179,14 @@ public void toggleRain() { @@ -596,7 +596,7 @@ this.theProfiler.startSection("buildList"); int i; EntityPlayer entityplayer; -@@ -3147,6 +3288,11 @@ +@@ -3152,6 +3293,11 @@ */ public boolean canBlockFreeze(int par1, int par2, int par3, boolean par4) { @@ -608,7 +608,7 @@ BiomeGenBase biomegenbase = this.getBiomeGenForCoords(par1, par3); float f = biomegenbase.getFloatTemperature(); -@@ -3205,6 +3351,11 @@ +@@ -3210,6 +3356,11 @@ */ public boolean canSnowAt(int par1, int par2, int par3) { @@ -620,7 +620,7 @@ BiomeGenBase biomegenbase = this.getBiomeGenForCoords(par1, par3); float f = biomegenbase.getFloatTemperature(); -@@ -3248,10 +3399,12 @@ +@@ -3253,10 +3404,12 @@ else { int l = this.getBlockId(par1, par2, par3); @@ -637,7 +637,7 @@ { j1 = 1; } -@@ -3347,7 +3500,9 @@ +@@ -3352,7 +3505,9 @@ int j4 = i2 + Facing.offsetsXForSide[i4]; int k4 = j2 + Facing.offsetsYForSide[i4]; int l4 = k2 + Facing.offsetsZForSide[i4]; @@ -648,7 +648,7 @@ i3 = this.getSavedLightValue(par1EnumSkyBlock, j4, k4, l4); if (i3 == l2 - i5 && i1 < this.lightUpdateBlockList.length) -@@ -3450,10 +3605,10 @@ +@@ -3455,10 +3610,10 @@ public List getEntitiesWithinAABBExcludingEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB, IEntitySelector par3IEntitySelector) { ArrayList arraylist = new ArrayList(); @@ -663,7 +663,7 @@ for (int i1 = i; i1 <= j; ++i1) { -@@ -3479,10 +3634,10 @@ +@@ -3484,10 +3639,10 @@ public List selectEntitiesWithinAABB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, IEntitySelector par3IEntitySelector) { @@ -678,7 +678,7 @@ ArrayList arraylist = new ArrayList(); for (int i1 = i; i1 <= j; ++i1) -@@ -3575,11 +3730,14 @@ +@@ -3580,11 +3735,14 @@ */ public void addLoadedEntities(List par1List) { @@ -696,7 +696,7 @@ } } -@@ -3613,6 +3771,11 @@ +@@ -3618,6 +3776,11 @@ else { if (block != null && (block == Block.waterMoving || block == Block.waterStill || block == Block.lavaMoving || block == Block.lavaStill || block == Block.fire || block.blockMaterial.isReplaceable())) @@ -708,7 +708,7 @@ { block = null; } -@@ -3907,7 +4070,7 @@ +@@ -3912,7 +4075,7 @@ */ public long getSeed() { @@ -717,7 +717,7 @@ } public long getTotalWorldTime() -@@ -3917,7 +4080,7 @@ +@@ -3922,7 +4085,7 @@ public long getWorldTime() { @@ -726,7 +726,7 @@ } /** -@@ -3925,7 +4088,7 @@ +@@ -3930,7 +4093,7 @@ */ public void setWorldTime(long par1) { @@ -735,7 +735,7 @@ } /** -@@ -3933,13 +4096,13 @@ +@@ -3938,13 +4101,13 @@ */ public ChunkCoordinates getSpawnPoint() { @@ -751,7 +751,7 @@ } @SideOnly(Side.CLIENT) -@@ -3963,7 +4126,10 @@ +@@ -3968,7 +4131,10 @@ if (!this.loadedEntityList.contains(par1Entity)) { @@ -763,7 +763,7 @@ } } -@@ -3971,6 +4137,11 @@ +@@ -3976,6 +4142,11 @@ * Called when checking if a certain block can be mined or not. The 'spawn safe zone' check is located here. */ public boolean canMineBlock(EntityPlayer par1EntityPlayer, int par2, int par3, int par4) @@ -775,7 +775,7 @@ { return true; } -@@ -4091,8 +4262,7 @@ +@@ -4096,8 +4267,7 @@ */ public boolean isBlockHighHumidity(int par1, int par2, int par3) { @@ -785,7 +785,7 @@ } /** -@@ -4167,7 +4337,7 @@ +@@ -4172,7 +4342,7 @@ */ public int getHeight() { @@ -794,7 +794,7 @@ } /** -@@ -4175,7 +4345,7 @@ +@@ -4180,7 +4350,7 @@ */ public int getActualHeight() { @@ -803,7 +803,7 @@ } public IUpdatePlayerListBox func_82735_a(EntityMinecart par1EntityMinecart) -@@ -4218,7 +4388,7 @@ +@@ -4223,7 +4393,7 @@ */ public double getHorizon() { @@ -812,9 +812,9 @@ } /** -@@ -4321,4 +4491,115 @@ - { - return this.worldLogAgent; +@@ -4351,4 +4521,115 @@ + + return MathHelper.clamp_float(f, 0.0F, flag ? 1.5F : 1.0F); } + + /** diff --git a/patches/minecraft/net/minecraft/world/WorldProvider.java.patch b/patches/minecraft/net/minecraft/world/WorldProvider.java.patch index 3131361df..827dd9d40 100644 --- a/patches/minecraft/net/minecraft/world/WorldProvider.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldProvider.java.patch @@ -24,7 +24,7 @@ public abstract class WorldProvider { -@@ -197,7 +204,7 @@ +@@ -199,7 +206,7 @@ public static WorldProvider getProviderForDimension(int par0) { @@ -33,7 +33,7 @@ } @SideOnly(Side.CLIENT) -@@ -266,4 +273,277 @@ +@@ -268,4 +275,277 @@ * Returns the dimension's name, e.g. "The End", "Nether", or "Overworld". */ public abstract String getDimensionName(); diff --git a/patches/minecraft/net/minecraft/world/WorldServer.java.patch b/patches/minecraft/net/minecraft/world/WorldServer.java.patch index dec806634..b0a6d6067 100644 --- a/patches/minecraft/net/minecraft/world/WorldServer.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldServer.java.patch @@ -29,7 +29,7 @@ public class WorldServer extends World { -@@ -88,6 +98,10 @@ +@@ -89,6 +99,10 @@ /** An IntHashMap of entity IDs (integers) to their Entity objects. */ private IntHashMap entityIdMap; @@ -40,7 +40,7 @@ public WorldServer(MinecraftServer par1MinecraftServer, ISaveHandler par2ISaveHandler, String par3Str, int par4, WorldSettings par5WorldSettings, Profiler par6Profiler, ILogAgent par7ILogAgent) { super(par2ISaveHandler, par3Str, par5WorldSettings, WorldProvider.getProviderForDimension(par4), par6Profiler, par7ILogAgent); -@@ -120,8 +134,12 @@ +@@ -121,8 +135,12 @@ this.mapStorage.setData("scoreboard", scoreboardsavedata); } @@ -140,7 +140,7 @@ byte b0 = 0; if (this.scheduledUpdatesAreImmediate && par4 > 0) -@@ -496,7 +531,7 @@ +@@ -498,7 +533,7 @@ */ public void updateEntities() { @@ -149,7 +149,7 @@ { if (this.updateEntityTick++ >= 1200) { -@@ -562,6 +597,9 @@ +@@ -564,6 +599,9 @@ { nextticklistentry = (NextTickListEntry)iterator.next(); iterator.remove(); @@ -159,7 +159,7 @@ byte b0 = 0; if (this.checkChunksExist(nextticklistentry.xCoord - b0, nextticklistentry.yCoord - b0, nextticklistentry.zCoord - b0, nextticklistentry.xCoord + b0, nextticklistentry.yCoord + b0, nextticklistentry.zCoord + b0)) -@@ -705,16 +743,28 @@ +@@ -717,16 +755,28 @@ { ArrayList arraylist = new ArrayList(); @@ -198,7 +198,7 @@ return arraylist; } -@@ -722,6 +772,11 @@ +@@ -734,6 +784,11 @@ * Called when checking if a certain block can be mined or not. The 'spawn safe zone' check is located here. */ public boolean canMineBlock(EntityPlayer par1EntityPlayer, int par2, int par3, int par4) @@ -210,7 +210,7 @@ { return !this.mcServer.func_96290_a(this, par2, par3, par4, par1EntityPlayer); } -@@ -806,7 +861,7 @@ +@@ -818,7 +873,7 @@ */ protected void createBonusChest() { @@ -219,7 +219,7 @@ for (int i = 0; i < 10; ++i) { -@@ -849,6 +904,7 @@ +@@ -861,6 +916,7 @@ } this.chunkProvider.saveChunks(par1, par2IProgressUpdate); @@ -227,7 +227,7 @@ } } -@@ -868,6 +924,7 @@ +@@ -880,6 +936,7 @@ this.checkSessionLock(); this.saveHandler.saveWorldInfoWithPlayer(this.worldInfo, this.mcServer.getConfigurationManager().getHostPlayerData()); this.mapStorage.saveAllData(); @@ -235,7 +235,7 @@ } /** -@@ -1081,4 +1138,9 @@ +@@ -1093,4 +1150,9 @@ { return this.field_85177_Q; } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch index 9a3e8e58b..f7e827ab3 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch @@ -12,7 +12,7 @@ public class BiomeDecorator { -@@ -206,26 +211,31 @@ +@@ -199,26 +204,31 @@ */ protected void decorate() { @@ -48,7 +48,7 @@ { j = this.chunk_X + this.randomGenerator.nextInt(16) + 8; k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; -@@ -241,7 +251,8 @@ +@@ -234,7 +244,8 @@ int l; @@ -58,7 +58,7 @@ { k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; -@@ -250,7 +261,8 @@ +@@ -243,7 +254,8 @@ worldgenerator.generate(this.currentWorld, this.randomGenerator, k, this.currentWorld.getHeightValue(k, l), l); } @@ -68,7 +68,7 @@ { k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; -@@ -259,7 +271,8 @@ +@@ -252,7 +264,8 @@ int i1; @@ -78,7 +78,7 @@ { k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; l = this.randomGenerator.nextInt(128); -@@ -275,7 +288,8 @@ +@@ -268,7 +281,8 @@ } } @@ -88,7 +88,7 @@ { k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; l = this.randomGenerator.nextInt(128); -@@ -284,7 +298,8 @@ +@@ -277,7 +291,8 @@ worldgenerator1.generate(this.currentWorld, this.randomGenerator, k, l, i1); } @@ -98,7 +98,7 @@ { k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; l = this.randomGenerator.nextInt(128); -@@ -292,7 +307,8 @@ +@@ -285,7 +300,8 @@ (new WorldGenDeadBush(Block.deadBush.blockID)).generate(this.currentWorld, this.randomGenerator, k, l, i1); } @@ -108,7 +108,7 @@ { k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; -@@ -305,7 +321,8 @@ +@@ -298,7 +314,8 @@ this.waterlilyGen.generate(this.currentWorld, this.randomGenerator, k, i1, l); } @@ -118,7 +118,7 @@ { if (this.randomGenerator.nextInt(4) == 0) { -@@ -324,7 +341,7 @@ +@@ -317,7 +334,7 @@ } } @@ -127,7 +127,7 @@ { j = this.chunk_X + this.randomGenerator.nextInt(16) + 8; k = this.randomGenerator.nextInt(128); -@@ -332,7 +349,7 @@ +@@ -325,7 +342,7 @@ this.mushroomBrownGen.generate(this.currentWorld, this.randomGenerator, j, k, l); } @@ -136,7 +136,7 @@ { j = this.chunk_X + this.randomGenerator.nextInt(16) + 8; k = this.randomGenerator.nextInt(128); -@@ -340,7 +357,8 @@ +@@ -333,7 +350,8 @@ this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, j, k, l); } @@ -146,7 +146,7 @@ { k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; -@@ -348,7 +366,7 @@ +@@ -341,7 +359,7 @@ this.reedGen.generate(this.currentWorld, this.randomGenerator, k, i1, l); } @@ -155,7 +155,7 @@ { k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; l = this.randomGenerator.nextInt(128); -@@ -356,7 +374,8 @@ +@@ -349,7 +367,8 @@ this.reedGen.generate(this.currentWorld, this.randomGenerator, k, l, i1); } @@ -165,7 +165,7 @@ { j = this.chunk_X + this.randomGenerator.nextInt(16) + 8; k = this.randomGenerator.nextInt(128); -@@ -364,7 +383,8 @@ +@@ -357,7 +376,8 @@ (new WorldGenPumpkin()).generate(this.currentWorld, this.randomGenerator, j, k, l); } @@ -175,7 +175,7 @@ { k = this.chunk_X + this.randomGenerator.nextInt(16) + 8; l = this.randomGenerator.nextInt(128); -@@ -372,7 +392,8 @@ +@@ -365,7 +385,8 @@ this.cactusGen.generate(this.currentWorld, this.randomGenerator, k, l, i1); } @@ -185,7 +185,7 @@ { for (j = 0; j < 50; ++j) { -@@ -390,6 +411,8 @@ +@@ -383,6 +404,8 @@ (new WorldGenLiquids(Block.lavaMoving.blockID)).generate(this.currentWorld, this.randomGenerator, k, l, i1); } } @@ -194,7 +194,7 @@ } /** -@@ -425,13 +448,23 @@ +@@ -418,13 +441,23 @@ */ protected void generateOres() { diff --git a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch index 6d67b1952..a1c294286 100644 --- a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch @@ -11,7 +11,7 @@ public class Chunk { /** -@@ -146,7 +150,9 @@ +@@ -138,7 +142,9 @@ { for (int j1 = 0; j1 < k; ++j1) { @@ -22,7 +22,7 @@ if (b0 != 0) { -@@ -165,6 +171,90 @@ +@@ -157,6 +163,90 @@ } /** @@ -113,7 +113,7 @@ * Checks whether the chunk is at the X/Z location specified */ public boolean isAtLocation(int par1, int par2) -@@ -228,7 +318,7 @@ +@@ -220,7 +310,7 @@ { int i1 = this.getBlockID(j, l - 1, k); @@ -122,7 +122,7 @@ { --l; continue; -@@ -534,7 +624,10 @@ +@@ -526,7 +616,10 @@ public int getBlockLightOpacity(int par1, int par2, int par3) { @@ -134,7 +134,7 @@ } /** -@@ -621,9 +714,13 @@ +@@ -613,9 +706,13 @@ { Block.blocksList[l1].breakBlock(this.worldObj, j2, par2, k2, l1, i2); } @@ -151,7 +151,7 @@ } } -@@ -641,7 +738,7 @@ +@@ -633,7 +730,7 @@ } else { @@ -160,7 +160,7 @@ { if (par2 >= k1) { -@@ -665,29 +762,21 @@ +@@ -657,29 +754,21 @@ Block.blocksList[par4].onBlockAdded(this.worldObj, j2, par2, k2); } @@ -193,7 +193,7 @@ } } -@@ -722,7 +811,7 @@ +@@ -714,7 +803,7 @@ extendedblockstorage.setExtBlockMetadata(par1, par2 & 15, par3, par4); int j1 = extendedblockstorage.getExtBlockID(par1, par2 & 15, par3); @@ -202,7 +202,7 @@ { TileEntity tileentity = this.getChunkBlockTileEntity(par1, par2, par3); -@@ -835,6 +924,7 @@ +@@ -827,6 +916,7 @@ k = this.entityLists.length - 1; } @@ -210,7 +210,7 @@ par1Entity.addedToChunk = true; par1Entity.chunkCoordX = this.xPosition; par1Entity.chunkCoordY = k; -@@ -884,33 +974,32 @@ +@@ -876,33 +966,32 @@ ChunkPosition chunkposition = new ChunkPosition(par1, par2, par3); TileEntity tileentity = (TileEntity)this.chunkTileEntityMap.get(chunkposition); @@ -255,7 +255,7 @@ } /** -@@ -925,7 +1014,7 @@ +@@ -917,7 +1006,7 @@ if (this.isChunkLoaded) { @@ -264,7 +264,7 @@ } } -@@ -940,7 +1029,8 @@ +@@ -932,7 +1021,8 @@ par4TileEntity.yCoord = par2; par4TileEntity.zCoord = this.zPosition * 16 + par3; @@ -275,7 +275,7 @@ if (this.chunkTileEntityMap.containsKey(chunkposition)) { @@ -982,6 +1072,7 @@ - { + this.worldObj.addLoadedEntities(this.entityLists[i]); } + MinecraftForge.EVENT_BUS.post(new ChunkEvent.Load(this)); diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch index 9cf69ffd4..2d7987bff 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch @@ -81,9 +81,9 @@ int l1; int i2; -- if (!flag && this.rand.nextInt(4) == 0) -+ if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAKE) && -+ !flag && this.rand.nextInt(4) == 0) +- if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && !flag && this.rand.nextInt(4) == 0) ++ if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && !flag && this.rand.nextInt(4) == 0 ++ && TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAKE)) { k1 = k + this.rand.nextInt(16) + 8; l1 = this.rand.nextInt(128); @@ -107,7 +107,7 @@ { l1 = k + this.rand.nextInt(16) + 8; i2 = this.rand.nextInt(128); -@@ -541,7 +579,8 @@ +@@ -537,7 +575,8 @@ k += 8; l += 8; @@ -117,7 +117,7 @@ { for (l1 = 0; l1 < 16; ++l1) { -@@ -558,6 +597,8 @@ +@@ -554,6 +593,8 @@ } } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch index 91161f8d9..f1048e3a8 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch @@ -1,48 +1,25 @@ --- ../src_base/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java +++ ../src_work/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java -@@ -7,7 +7,13 @@ - import net.minecraft.item.ItemStack; - import net.minecraft.tileentity.TileEntityChest; +@@ -8,6 +8,8 @@ import net.minecraft.tileentity.TileEntityMobSpawner; -+import net.minecraft.util.WeightedRandom; -+import net.minecraft.util.WeightedRandomChestContent; + import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.world.World; -+ +import net.minecraftforge.common.ChestGenHooks; +import net.minecraftforge.common.DungeonHooks; -+import net.minecraftforge.common.MinecraftForge; public class WorldGenDungeons extends WorldGenerator { -@@ -124,15 +130,8 @@ +@@ -127,7 +129,8 @@ if (tileentitychest != null) { -- for (int l2 = 0; l2 < 8; ++l2) -- { -- ItemStack itemstack = this.pickCheckLootItem(par2Random); -- -- if (itemstack != null) -- { -- tileentitychest.setInventorySlotContents(par2Random.nextInt(tileentitychest.getSizeInventory()), itemstack); -- } -- } +- WeightedRandomChestContent.generateChestContents(par2Random, aweightedrandomchestcontent, tileentitychest, 8); + ChestGenHooks info = ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST); + WeightedRandomChestContent.generateChestContents(par2Random, info.getItems(par2Random), tileentitychest, info.getCount(par2Random)); } - break label210; -@@ -174,8 +173,7 @@ - */ - private ItemStack pickCheckLootItem(Random par1Random) - { -- int i = par1Random.nextInt(12); -- return i == 0 ? new ItemStack(Item.saddle) : (i == 1 ? new ItemStack(Item.ingotIron, par1Random.nextInt(4) + 1) : (i == 2 ? new ItemStack(Item.bread) : (i == 3 ? new ItemStack(Item.wheat, par1Random.nextInt(4) + 1) : (i == 4 ? new ItemStack(Item.gunpowder, par1Random.nextInt(4) + 1) : (i == 5 ? new ItemStack(Item.silk, par1Random.nextInt(4) + 1) : (i == 6 ? new ItemStack(Item.bucketEmpty) : (i == 7 && par1Random.nextInt(100) == 0 ? new ItemStack(Item.appleGold) : (i == 8 && par1Random.nextInt(2) == 0 ? new ItemStack(Item.redstone, par1Random.nextInt(4) + 1) : (i == 9 && par1Random.nextInt(10) == 0 ? new ItemStack(Item.itemsList[Item.record13.itemID + par1Random.nextInt(2)]) : (i == 10 ? new ItemStack(Item.dyePowder, 1, 3) : (i == 11 ? Item.enchantedBook.func_92109_a(par1Random) : null))))))))))); -+ return ChestGenHooks.getOneItem(ChestGenHooks.DUNGEON_CHEST, par1Random); - } - - /** -@@ -183,7 +181,6 @@ + break label101; +@@ -169,7 +172,6 @@ */ private String pickMobSpawner(Random par1Random) { diff --git a/patches/minecraft/net/minecraft/world/gen/structure/ComponentMineshaftCorridor.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/ComponentMineshaftCorridor.java.patch index cfc71ccf0..c61ed6eca 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/ComponentMineshaftCorridor.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/ComponentMineshaftCorridor.java.patch @@ -10,7 +10,7 @@ public class ComponentMineshaftCorridor extends StructureComponent { -@@ -260,14 +263,16 @@ +@@ -264,14 +267,16 @@ this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.05F, 1, 2, k - 1, Block.torchWood.blockID, 0); this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.05F, 1, 2, k + 1, Block.torchWood.blockID, 0); diff --git a/patches/minecraft/net/minecraft/world/gen/structure/ComponentStrongholdLibrary.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/ComponentStrongholdLibrary.java.patch index 1e2705608..8b33acfaf 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/ComponentStrongholdLibrary.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/ComponentStrongholdLibrary.java.patch @@ -10,7 +10,7 @@ public class ComponentStrongholdLibrary extends ComponentStronghold { -@@ -145,12 +148,14 @@ +@@ -147,12 +150,14 @@ this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, b1, 8, b2 + 1, par3StructureBoundingBox); } diff --git a/patches/minecraft/net/minecraft/world/gen/structure/ComponentVillageStartPiece.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/ComponentVillageStartPiece.java.patch index 22c51f7aa..62a064c90 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/ComponentVillageStartPiece.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/ComponentVillageStartPiece.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/world/gen/structure/ComponentVillageStartPiece.java +++ ../src_work/minecraft/net/minecraft/world/gen/structure/ComponentVillageStartPiece.java -@@ -11,6 +11,7 @@ +@@ -12,6 +12,7 @@ /** Boolean that determines if the village is in a desert or not. */ public final boolean inDesert; @@ -8,7 +8,7 @@ /** World terrain type, 0 for normal, 1 for flap map */ public final int terrainType; -@@ -32,6 +33,7 @@ +@@ -33,6 +34,7 @@ this.terrainType = par7; BiomeGenBase biomegenbase = par1WorldChunkManager.getBiomeGenAt(par4, par5); this.inDesert = biomegenbase == BiomeGenBase.desert || biomegenbase == BiomeGenBase.desertHills; From 63dfed9d83c99b6851a305a50c794d525559f85c Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 30 Jun 2013 18:13:01 -0700 Subject: [PATCH 011/146] Small fixup, need to Update GuiIngameForge for new HUD changes. --- .../client/ForgeHooksClient.java | 6 ----- .../minecraftforge/client/GuiIngameForge.java | 22 ++++++++++++++----- .../client/event/TextureLoadEvent.java | 17 -------------- .../minecraftforge/event/ServerChatEvent.java | 2 +- 4 files changed, 17 insertions(+), 30 deletions(-) delete mode 100644 client/net/minecraftforge/client/event/TextureLoadEvent.java diff --git a/client/net/minecraftforge/client/ForgeHooksClient.java b/client/net/minecraftforge/client/ForgeHooksClient.java index 01b276348..91319b407 100644 --- a/client/net/minecraftforge/client/ForgeHooksClient.java +++ b/client/net/minecraftforge/client/ForgeHooksClient.java @@ -36,7 +36,6 @@ import net.minecraft.client.renderer.texture.TextureMap; import net.minecraftforge.client.IItemRenderer.ItemRenderType; import net.minecraftforge.client.event.DrawBlockHighlightEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; -import net.minecraftforge.client.event.TextureLoadEvent; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.common.MinecraftForge; import static net.minecraftforge.client.IItemRenderer.ItemRenderType.*; @@ -221,11 +220,6 @@ public class ForgeHooksClient MinecraftForge.EVENT_BUS.post(new RenderWorldLastEvent(context, partialTicks)); } - public static void onTextureLoad(String texture, ITexturePack pack) - { - MinecraftForge.EVENT_BUS.post(new TextureLoadEvent(texture, pack)); - } - public static void onTextureStitchedPre(TextureMap map) { MinecraftForge.EVENT_BUS.post(new TextureStitchEvent.Pre(map)); diff --git a/client/net/minecraftforge/client/GuiIngameForge.java b/client/net/minecraftforge/client/GuiIngameForge.java index 7fafa44c8..c8fae1276 100644 --- a/client/net/minecraftforge/client/GuiIngameForge.java +++ b/client/net/minecraftforge/client/GuiIngameForge.java @@ -16,6 +16,7 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiIngame; import net.minecraft.client.gui.GuiNewChat; import net.minecraft.client.gui.GuiPlayerInfo; @@ -27,6 +28,8 @@ import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.resources.ResourceLocation; import net.minecraft.crash.CallableMinecraftVersion; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.attributes.AttributeInstance; import net.minecraft.entity.boss.BossStatus; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; @@ -52,6 +55,10 @@ import static net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType public class GuiIngameForge extends GuiIngame { + private static final ResourceLocation VIGNETTE = new ResourceLocation("textures/misc/vignette.png"); + private static final ResourceLocation WIDGITS = new ResourceLocation("textures/gui/widgets.png"); + private static final ResourceLocation PUMPKIN_BLUR = new ResourceLocation("textures/misc/pumpkinblur.png"); + private static final int WHITE = 0xFFFFFF; //Flags to toggle the rendering of certain aspects of the HUD, valid conditions @@ -169,7 +176,7 @@ public class GuiIngameForge extends GuiIngame GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - mc.renderEngine.func_110577_a("/gui/gui.png"); + mc.renderEngine.func_110577_a(WIDGITS); InventoryPlayer inv = mc.thePlayer.inventory; drawTexturedModalRect(width / 2 - 91, height - 22, 0, 0, 182, 22); @@ -271,7 +278,7 @@ public class GuiIngameForge extends GuiIngame if (f1 > 0.0F) { - renderPortalOverlay(f1, width, height); + func_130015_b(f1, width, height); } post(PORTAL); @@ -312,8 +319,11 @@ public class GuiIngameForge extends GuiIngame highlight = false; } - int health = mc.thePlayer.getHealth(); - float healthLast = mc.thePlayer.prevHealth; + AttributeInstance attrMaxHealth = this.mc.thePlayer.func_110148_a(SharedMonsterAttributes.field_111267_a); + float maxHealth = (float)attrMaxHealth.func_111126_e(); + + int health = MathHelper.ceiling_float_int(mc.thePlayer.func_110143_aJ()); + int healthLast = MathHelper.ceiling_float_int(mc.thePlayer.prevHealth); int left = width / 2 - 91; int top = height - 39; @@ -449,7 +459,7 @@ public class GuiIngameForge extends GuiIngame if (mc.playerController.shouldDrawHUD()) { mc.mcProfiler.startSection("expBar"); - mc.renderEngine.bindTexture("/gui/icons.png"); + mc.func_110434_K().func_110577_a(WIDGITS); int cap = this.mc.thePlayer.xpBarCap(); int left = width / 2 - 91; @@ -721,7 +731,7 @@ public class GuiIngameForge extends GuiIngame GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - mc.renderEngine.bindTexture("/gui/icons.png"); + mc.func_110434_K().func_110577_a(Gui.field_110324_m); int pingIndex = 4; int ping = player.responseTime; if (ping < 0) pingIndex = 5; diff --git a/client/net/minecraftforge/client/event/TextureLoadEvent.java b/client/net/minecraftforge/client/event/TextureLoadEvent.java deleted file mode 100644 index b483db111..000000000 --- a/client/net/minecraftforge/client/event/TextureLoadEvent.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.minecraftforge.client.event; - -import net.minecraft.client.texturepacks.ITexturePack; -import net.minecraftforge.event.Event; - -public class TextureLoadEvent extends Event -{ - - public final String texture; - public final ITexturePack pack; - - public TextureLoadEvent(String texture, ITexturePack pack) - { - this.texture = texture; - this.pack = pack; - } -} diff --git a/common/net/minecraftforge/event/ServerChatEvent.java b/common/net/minecraftforge/event/ServerChatEvent.java index efce522ef..9d50a1496 100644 --- a/common/net/minecraftforge/event/ServerChatEvent.java +++ b/common/net/minecraftforge/event/ServerChatEvent.java @@ -9,7 +9,7 @@ public class ServerChatEvent extends Event public final String message, username; public final EntityPlayerMP player; public ChatMessageComponent component; - public ServerChatEvent(EntityPlayerMP player, String message, ChatMessageComponent line) + public ServerChatEvent(EntityPlayerMP player, String message, ChatMessageComponent component) { super(); this.message = message; From be47ccfc7e3a877c0aaa6c627485b8e11fccdbb2 Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 30 Jun 2013 18:14:19 -0700 Subject: [PATCH 012/146] Updated FML: MinecraftForge/FML@6a318ddb784ca8b2bef0f6718089f7beb4d404e0 Fix typo in new packages. MinecraftForge/FML@3711da9c456d20865a965734cc5aeaf7f5cb5e5d Another typo MinecraftForge/FML@e35e4b16ff3d6dea547c41f02f2ca31ebe1f74aa More fixups MinecraftForge/FML@18371bd8c9bd107f774289da35519f593ccc8ee7 Some fixes for updated mcp code MinecraftForge/FML@ef646d3146e1f285d2cb8e79a74373beffa84774 Merge branch '16launch' MinecraftForge/FML@7406b38d8ad1bc5c2c641c74f1614b946f246588 1.6.1 MinecraftForge/FML@12c928c538c1c04d3a21255c747d15468328ace9 Tweak commands patch MinecraftForge/FML@3f15cd54c2d776ea161aaedbecad9e188d66578f Functional client @ 1.6.1 MinecraftForge/FML@71a92de5d95fccc4fe17cc39d0836891c6622f4d Client launch for eclipse --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index 2766f9a29..71a92de5d 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 2766f9a293f3e1da650693991d16a43a089ae65b +Subproject commit 71a92de5d95fccc4fe17cc39d0836891c6622f4d From e0d7b9e2c6120ad8baecc0a1fe9cb2bef7dfc57d Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 30 Jun 2013 19:23:51 -0700 Subject: [PATCH 013/146] Updated FML: MinecraftForge/FML@8960f6869fbe30d358a40997c47999025c3eae68 Add windows lzma executable http://tukaani.org/xz/ He states that most things are under public domai n, But I couldn't find an exact reference to this executable. I'm going to assume it under public domain and distribuiting it here is fine. If not someone pleas e direct me to the apropriate license and I will act accordingly. MinecraftForge/FML@70cfe24e67adf6872ef1501599e2115e420c2539 Fix wrong project name in distro eclipse launch. MinecraftForge/FML@7a004087f79b94bc92f29d50eb71288b6c1c968c Add deobf data to src dist. Dont create deobf jar as we ship the lzma Added *.lzma to .gitignore --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index 71a92de5d..7a004087f 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 71a92de5d95fccc4fe17cc39d0836891c6622f4d +Subproject commit 7a004087f79b94bc92f29d50eb71288b6c1c968c From be88b0f22ffd5fa8a68547646c117bd59c5e662b Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 30 Jun 2013 19:42:47 -0700 Subject: [PATCH 014/146] Updated FML: MinecraftForge/FML@110cf372eb5aa85df20b248976f1acdefa85e102 Add deobf data to merge-common, workspace is now actually runnable! --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index 7a004087f..110cf372e 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 7a004087f79b94bc92f29d50eb71288b6c1c968c +Subproject commit 110cf372eb5aa85df20b248976f1acdefa85e102 From fa965e5f7cc0a96c8b01c3bd0dd4756d983a3357 Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 30 Jun 2013 19:43:09 -0700 Subject: [PATCH 015/146] Support dirty submodules in changelog script. --- submodule_changlog.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/submodule_changlog.py b/submodule_changlog.py index 411c864db..e81fb1300 100644 --- a/submodule_changlog.py +++ b/submodule_changlog.py @@ -28,11 +28,16 @@ def main(options, args): start = line[19:] elif line[0:18] == '+Subproject commit': end = line[19:] + if end.endswith('-dirty'): + end = end[0:len(end)-6] if start == None or end == None: print('Could not extract start and end range') sys.exit(1) + print('Start: %s' % start) + print('End: %s' % end) + output = run_command(['git', 'log', '--reverse', '--pretty=oneline', '%s...%s' % (start, end)], './fml') print('Updated FML:') for line in output: From ab1ddd99b6d8ce95cc544f0542b71b06ce1d6a9d Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 30 Jun 2013 19:43:27 -0700 Subject: [PATCH 016/146] 1.6.1 Update --- .../client/event/RenderLivingEvent.java | 2 +- common/forge_at.cfg | 208 +++++++++--------- .../net/minecraft/client/Minecraft.java.patch | 16 +- .../client/renderer/RenderEngine.java.patch | 43 ---- .../renderer/entity/RenderManager.java.patch | 2 +- .../renderer/entity/RenderPlayer.java.patch | 26 +-- .../entity/RendererLivingEntity.java.patch | 12 +- .../server/gui/GuiStatsComponent.java.patch | 43 ---- 8 files changed, 133 insertions(+), 219 deletions(-) delete mode 100644 patches/minecraft/net/minecraft/client/renderer/RenderEngine.java.patch rename patches/minecraft/net/minecraft/client/{render => renderer}/entity/RendererLivingEntity.java.patch (85%) delete mode 100644 patches/minecraft/net/minecraft/server/gui/GuiStatsComponent.java.patch diff --git a/client/net/minecraftforge/client/event/RenderLivingEvent.java b/client/net/minecraftforge/client/event/RenderLivingEvent.java index a0a7a0519..6c64db9c3 100644 --- a/client/net/minecraftforge/client/event/RenderLivingEvent.java +++ b/client/net/minecraftforge/client/event/RenderLivingEvent.java @@ -1,6 +1,6 @@ package net.minecraftforge.client.event; -import net.minecraft.client.render.entity.RendererLivingEntity; +import net.minecraft.client.renderer.entity.RendererLivingEntity; import net.minecraft.entity.EntityLivingBase; import net.minecraftforge.event.Cancelable; import net.minecraftforge.event.Event; diff --git a/common/forge_at.cfg b/common/forge_at.cfg index b6eb4d812..b94cd9212 100644 --- a/common/forge_at.cfg +++ b/common/forge_at.cfg @@ -1,162 +1,162 @@ #Main Forge Access Transformer configuration file # Tessellator -public-f bfc.a #FD:Tessellator/field_78398_a #instance -public bfc.u #FD:Tessellator/field_78409_u #drawMode -public bfc.v #FD:Tessellator/field_78408_v #xOffset -public bfc.w #FD:Tessellator/field_78407_w #yOffset -public bfc.x #FD:Tessellator/field_78417_x #zOffset -public bfc.z #FD:Tessellator/field_78415_z #isDrawing +public-f bff.a #FD:Tessellator/field_78398_a #instance +public bff.u #FD:Tessellator/field_78409_u #drawMode +public bff.v #FD:Tessellator/field_78408_v #xOffset +public bff.w #FD:Tessellator/field_78407_w #yOffset +public bff.x #FD:Tessellator/field_78417_x #zOffset +public bff.z #FD:Tessellator/field_78415_z #isDrawing # ItemPickaxe -public yh.(ILxx;)V #MD:ItemPickaxe/(ILnet/minecraft/src/EnumToolMaterial;) #constructor -public+f yh.c #FD:ItemPickaxe/field_77867_c #blocksEffectiveAgainst +public yi.(ILxy;)V #MD:ItemPickaxe/(ILnet/minecraft/src/EnumToolMaterial;) #constructor +public+f yi.c #FD:ItemPickaxe/field_77867_c #blocksEffectiveAgainst # ItemAxe -public xu.(ILxx;)V #MD:ItemAxe/(ILnet/minecraft/src/EnumToolMaterial;) #constructor -public+f xu.c #FD:ItemAxe/field_77868_c #blocksEffectiveAgainst +public xv.(ILxy;)V #MD:ItemAxe/(ILnet/minecraft/src/EnumToolMaterial;) #constructor +public+f xv.c #FD:ItemAxe/field_77868_c #blocksEffectiveAgainst # ItemSpade -public ys.(ILxx;)V #MD:ItemSpade/(ILnet/minecraft/src/EnumToolMaterial;) #constructor -public+f ys.c #FD:ItemSpade/field_77866_c #blocksEffectiveAgainst +public yt.(ILxy;)V #MD:ItemSpade/(ILnet/minecraft/src/EnumToolMaterial;) #constructor +public+f yt.c #FD:ItemSpade/field_77866_c #blocksEffectiveAgainst # ItemTool -public xd.a #FD:ItemTool/field_77864_a #efficiencyOnProperMaterial -public xd.d #FD:ItemTool/field_77865_bY #damageVsEntity +public xe.a #FD:ItemTool/field_77864_a #efficiencyOnProperMaterial +public xe.d #FD:ItemTool/field_77865_bY #damageVsEntity # EntityEnderman -public tc.br #FD:EntityEnderman/field_70827_d #carriableBlocks +public td.br #FD:EntityEnderman/field_70827_d #carriableBlocks # RenderEngine # -- MISSING MAPPING public bge.f(Ljava/lang/String;)I #MD:RenderEngine/func_78341_b #getTexture # -- MISSING MAPPING public bge.i #FD:RenderEngine/field_94154_l #terrainTextureMap # -- MISSING MAPPING public bge.j #FD:RenderEngine/field_94155_m #itemTextureMap # RenderGlobal -public bex.k #FD:RenderGlobal/field_72769_h #theWorld -public bex.l #FD:RenderGlobal/field_72770_i #renderEngine -public bex.t #FD:RenderGlobal/field_72777_q #mc -public bex.u #FD:RenderGlobal/field_72776_r #globalRenderBlocks -public bex.H #FD:RenderGlobal/field_72738_E #damagedBlocks +public bfa.k #FD:RenderGlobal/field_72769_h #theWorld +public bfa.l #FD:RenderGlobal/field_72770_i #renderEngine +public bfa.t #FD:RenderGlobal/field_72777_q #mc +public bfa.u #FD:RenderGlobal/field_72776_r #globalRenderBlocks +public bfa.H #FD:RenderGlobal/field_72738_E #damagedBlocks # SoundManager -public bla.b #FD:SoundManager/field_77381_a #sndSystem -public bla.d #FD:SoundManager/field_77379_b #soundPoolSounds -public bla.e #FD:SoundManager/field_77380_c #soundPoolStreaming -public bla.f #FD:SoundManager/field_77377_d #soundPoolMusic +public blc.b #FD:SoundManager/field_77381_a #sndSystem +public blc.d #FD:SoundManager/field_77379_b #soundPoolSounds +public blc.e #FD:SoundManager/field_77380_c #soundPoolStreaming +public blc.f #FD:SoundManager/field_77377_d #soundPoolMusic # EntityMinecart -protected sp.* #FD:EntityMinecart/* # All private -> protected +protected sq.* #FD:EntityMinecart/* # All private -> protected # -- MISSING MAPPING public py.h()Z #MD:EntityMinecart/func_70490_h #isMinecartPowered # Block -public aqr.(ILaju;)V #MD:Block/(ILnet/minecraft/src/Material;) #Constructor -public aqr.(IILaju;)V #MD:Block/(IILnet/minecraft/src/Material;) #Constructor -public aqr.cH #FD:Block/field_72029_cc #blockResistance -public aqr.cG #FD:Block/field_71989_cb #blockHardness +public aqs.(ILajv;)V #MD:Block/(ILnet/minecraft/src/Material;) #Constructor +public aqs.(IILajv;)V #MD:Block/(IILnet/minecraft/src/Material;) #Constructor +public aqs.cH #FD:Block/field_72029_cc #blockResistance +public aqs.cG #FD:Block/field_71989_cb #blockHardness # -- MISSING MAPPING public amq.r()Lamq; #MD:Block/func_71912_p #setRequiresSelfNotify -public aqr.a(Laqv;)Laqr; #MD:Block/func_71884_a #setStepSound -public aqr.b(F)Laqr; #MD:Block/func_71894_b #setResistance -public aqr.c(F)Laqr; #MD:Block/func_71848_c #setHardness -public aqr.k(I)Laqr; #MD:Block/func_71868_h #setLightOpacity -public aqr.a(F)Laqr; #MD:Block/func_71900_a #setLightValue -public aqr.r()Laqr; #MD:Block/func_71875_q #setBlockUnbreakable -public aqr.b(Z)Laqr; #MD:Block/func_71907_b #setTickRandomly -public aqr.a(FFFFFF)V #MD:Block/func_71905_a #setBlockBounds +public aqs.a(Laqw;)Laqs; #MD:Block/func_71884_a #setStepSound +public aqs.b(F)Laqs; #MD:Block/func_71894_b #setResistance +public aqs.c(F)Laqs; #MD:Block/func_71848_c #setHardness +public aqs.k(I)Laqs; #MD:Block/func_71868_h #setLightOpacity +public aqs.a(F)Laqs; #MD:Block/func_71900_a #setLightValue +public aqs.r()Laqs; #MD:Block/func_71875_q #setBlockUnbreakable +public aqs.b(Z)Laqs; #MD:Block/func_71907_b #setTickRandomly +public aqs.a(FFFFFF)V #MD:Block/func_71905_a #setBlockBounds # NetServerHandler -public jw.f #FD:NetServerHandler/field_72572_g #playerInAirTime +public jx.f #FD:NetServerHandler/field_72572_g #playerInAirTime # TileEntity -public ash.k #FD:TileEntity/field_70331_k #worldObj +public asi.k #FD:TileEntity/field_70331_k #worldObj # BlockLeavesBase -public aqz.d #FD:BlockLeavesBase/field_72131_c #graphicsLevel +public ara.d #FD:BlockLeavesBase/field_72131_c #graphicsLevel # Item -public xw.(I)V #MD:Item/(I) #Constructor -public xw.e(I)Lxw; #MD:Item/func_77656_e #setMaxDamage -public-f xw.h(Lxy;)Lmo; #MD:Item/func_77650_f #getIconIndex -public xw.c(Ljava/lang/String;)Lxw; #MD:Item/func_77631_c #setPotionEffect +public xx.(I)V #MD:Item/(I) #Constructor +public xx.e(I)Lxx; #MD:Item/func_77656_e #setMaxDamage +public-f xx.h(Lxz;)Lmp; #MD:Item/func_77650_f #getIconIndex +public xx.c(Ljava/lang/String;)Lxx; #MD:Item/func_77631_c #setPotionEffect # RailLogic -public amr #CL:BlockBaseRailLogic -public amr.a()I #MD:BlockBaseRailLogic/func_94505_a #getNAdjacentTiles +public ams #CL:BlockBaseRailLogic +public ams.a()I #MD:BlockBaseRailLogic/func_94505_a #getNAdjacentTiles # EntityPlayer -public tz.a(Lso;)V #MD:EntityPlayer/func_71012_a #joinEntityItemWithWorld -public tz.i()V #MD:EntityPlayer/func_71053_j #closeScreen -public tz.b #FD:EntityPlayer/field_71076_b #sleepTimer +public ua.a(Lsp;)V #MD:EntityPlayer/func_71012_a #joinEntityItemWithWorld +public ua.i()V #MD:EntityPlayer/func_71053_j #closeScreen +public ua.b #FD:EntityPlayer/field_71076_b #sleepTimer # EntityPlayerMP -public bcu.a(Lso;)V #MD:EntityClientPlayerMP/func_71012_a #joinEntityItemWithWorld +public bcx.a(Lsp;)V #MD:EntityClientPlayerMP/func_71012_a #joinEntityItemWithWorld # World Gen Chests Related -public mg.* #FD:WeightedRandomChestContent/* #all -public jo.T #FD:WorldServer/field_73069_S #bonusChestContent -public agb.a #FD:StructureMineshaftPieces/field_78818_a #mineshaftChestContents -public ahf.i #FD:ComponentScatteredFeatureDesertPyramid/field_74941_i #itemsToGenerateInTemple -public ahg.l #FD:ComponentScatteredFeatureJunglePyramid/field_74943_l #junglePyramidsChestContents -public ahg.m #FD:ComponentScatteredFeatureJunglePyramid/field_74944_m #junglePyramidsDispenserContents -public ahq.a #FD:ComponentStrongholdChestCorridor/field_75003_a #strongholdChestContents -public ahu.b #FD:ComponentStrongholdLibrary/field_75007_b #strongholdLibraryChestContents -public ahz.c #FD:ComponentStrongholdRoomCrossing/field_75014_c #strongholdCorridorChestContents -public aja.a #FD:ComponentVillageHouse2/field_74918_a #villageBlacksmithChestContents +public mh.* #FD:WeightedRandomChestContent/* #all +public jp.T #FD:WorldServer/field_73069_S #bonusChestContent +public agc.a #FD:StructureMineshaftPieces/field_78818_a #mineshaftChestContents +public ahg.i #FD:ComponentScatteredFeatureDesertPyramid/field_74941_i #itemsToGenerateInTemple +public ahh.l #FD:ComponentScatteredFeatureJunglePyramid/field_74943_l #junglePyramidsChestContents +public ahh.m #FD:ComponentScatteredFeatureJunglePyramid/field_74944_m #junglePyramidsDispenserContents +public ahr.a #FD:ComponentStrongholdChestCorridor/field_75003_a #strongholdChestContents +public ahv.b #FD:ComponentStrongholdLibrary/field_75007_b #strongholdLibraryChestContents +public aia.c #FD:ComponentStrongholdRoomCrossing/field_75014_c #strongholdCorridorChestContents +public ajb.a #FD:ComponentVillageHouse2/field_74918_a #villageBlacksmithChestContents # AnvilChunkLoader.chunkSaveLocation -public ady.d #FD:AnvilChunkLoader/field_75825_d +public adz.d #FD:AnvilChunkLoader/field_75825_d # ChunkProviderServer.currentChunkLoader -public jn.e #FD:ChunkProviderServer/field_73247_e +public jo.e #FD:ChunkProviderServer/field_73247_e # PlayerManager -public jl.a(IIZ)Ljm; #MD:PlayerManager/func_72690_a #getOrCreateChunkWatcher +public jm.a(IIZ)Ljn; #MD:PlayerManager/func_72690_a #getOrCreateChunkWatcher # PlayerInstance -public jm #CL:PlayerInstance +public jn #CL:PlayerInstance # World -public-f abq.A #FD:World/field_72982_D #villageCollectionObj -public abq.G #FD:World/field_72993_I #activeChunkSet +public-f abr.A #FD:World/field_72982_D #villageCollectionObj +public abr.G #FD:World/field_72993_I #activeChunkSet # EntityLiving -public oc.b #FD:EntityLiving/field_70728_aV #experienceValue +public od.b #FD:EntityLiving/field_70728_aV #experienceValue # -- MISSING MAPPING public ng.bt #FD:EntityLiving/field_94063_bt #combatTracker -public oc.d #FD:EntityLiving/field_70715_bh #targetTasks +public od.d #FD:EntityLiving/field_70715_bh #targetTasks # GuiFlatPresets -public avp.a(Ljava/lang/String;ILack;Ljava/util/List;[Lafx;)V #MD:GuiFlatPresets/func_82294_a -public avp.a(Ljava/lang/String;ILack;[Lafx;)V #MD:GuiFlatPresets/func_82297_a +public avq.a(Ljava/lang/String;ILacl;Ljava/util/List;[Lafy;)V #MD:GuiFlatPresets/func_82294_a +public avq.a(Ljava/lang/String;ILacl;[Lafy;)V #MD:GuiFlatPresets/func_82297_a # BiomeGenBase -public ack.*() #MD:BiomeGenBase/* #Everything protected->public +public acl.*() #MD:BiomeGenBase/* #Everything protected->public # MapGenVillage -public-f aio.e #FD:MapGenVillage/field_75055_e #villageSpawnBiomes +public-f aip.e #FD:MapGenVillage/field_75055_e #villageSpawnBiomes # ShapedRecipes -public+f aac.d #FD:ShapedRecipes/field_77574_d #recipeItems -public+f aac.b #FD:ShapedRecipes/field_77576_b #recipeWidth -public+f aac.c #FD:ShapedRecipes/field_77577_c #recipeHeight +public+f aad.d #FD:ShapedRecipes/field_77574_d #recipeItems +public+f aad.b #FD:ShapedRecipes/field_77576_b #recipeWidth +public+f aad.c #FD:ShapedRecipes/field_77577_c #recipeHeight # ShapelessRecipes -public aad.b #FD:ShapelessRecipes/field_77579_b #recipeItems +public aae.b #FD:ShapelessRecipes/field_77579_b #recipeItems # GuiContainer -protected awo.a(Lvy;)V #MD:GuiContainer/func_74192_a #drawSlotInventory +protected awp.a(Lvz;)V #MD:GuiContainer/func_74192_a #drawSlotInventory # ContainerPlayer -protected vp.h #FD:ContainerPlayer/field_82862_h #player +protected vq.h #FD:ContainerPlayer/field_82862_h #player # BlockButton -protected amx.n(Labq;III)V #MD:BlockButton/func_82535_o #checkActivation -protected-f amx.a #FD:BlockButton/field_82537_a #sensible +protected amy.n(Labr;III)V #MD:BlockButton/func_82535_o #checkActivation +protected-f amy.a #FD:BlockButton/field_82537_a #sensible # BiomeDecorator -public aco.* #FD:BiomeDecorator/* # All private -> protected +public acp.* #FD:BiomeDecorator/* # All private -> protected # CreativeTabs -public-f wq.a #FD:CreativeTabs/field_78032_a # creativeTabArray non-final +public-f wr.a #FD:CreativeTabs/field_78032_a # creativeTabArray non-final # Packet -public ew.a(IZZLjava/lang/Class;)V #MD:Packet/func_73285_a #addIdClassMapping +public ex.a(IZZLjava/lang/Class;)V #MD:Packet/func_73285_a #addIdClassMapping # SaveHandler -public ali.b()Ljava/io/File; #MD:SaveHandler/func_75765_b +public alj.b()Ljava/io/File; #MD:SaveHandler/func_75765_b # World stuff -public abq.b(Lnj;)V #MD:World/func_72847_b #releaseEntitySkin -public abq.m #FD:World/field_73003_n #prevRainingStrength -public abq.n #FD:World/field_73004_o #rainingStrength -public abq.p #FD:World/field_73017_q #thunderingStrength -public abq.o #FD:World/field_73018_p #prevThunderingStrength +public abr.b(Lnk;)V #MD:World/func_72847_b #releaseEntitySkin +public abr.m #FD:World/field_73003_n #prevRainingStrength +public abr.n #FD:World/field_73004_o #rainingStrength +public abr.p #FD:World/field_73017_q #thunderingStrength +public abr.o #FD:World/field_73018_p #prevThunderingStrength #WorldClient -public bcr.b(Lnj;)V #MD:WorldClient/func_72847_b #releaseEntitySkin +public bcu.b(Lnk;)V #MD:WorldClient/func_72847_b #releaseEntitySkin #WorldServer -public jo.b(Lnj;)V #MD:WorldServer/func_72847_b #releaseEntitySkin -public jo.N #FD:WorldServer/field_73068_P #allPlayersSleeping +public jp.b(Lnk;)V #MD:WorldServer/func_72847_b #releaseEntitySkin +public jp.N #FD:WorldServer/field_73068_P #allPlayersSleeping #TextureMap -public bhw.g #FD:TextureMap/field_94255_a +public bhz.g #FD:TextureMap/field_94255_a # -- MISSING MAPPING public bir.b #FD:TextureMap/field_94253_b -public bhw.h #FD:TextureMap/field_94254_c +public bhz.h #FD:TextureMap/field_94254_c # -- MISSING MAPPING public bir.d #FD:TextureMap/field_94251_d #Potion -public ne.b(II)Lne; #MD:Potion/func_76399_b #setIconIndex +public nf.b(II)Lnf; #MD:Potion/func_76399_b #setIconIndex #PotionHelper -public zj.m #FD:PotionHelper/field_77927_l #potionRequirements -public zj.n #FD:PotionHelper/field_77928_m #potionAmplifiers +public zk.m #FD:PotionHelper/field_77927_l #potionRequirements +public zk.n #FD:PotionHelper/field_77928_m #potionAmplifiers #PotionEffect -public nf.b #FD:PotionEffect/field_76460_b #duration +public ng.b #FD:PotionEffect/field_76460_b #duration #BlockFluid -protected aou.a #FD:BlockFluid/field_94425_a #theIcon +protected aov.a #FD:BlockFluid/field_94425_a #theIcon #GuiIngame -protected auz.* #FD:GuiIngame/* # All private -> protected -protected auz.*() #MD:GuiIngame/* # All private -> protected +protected ava.* #FD:GuiIngame/* # All private -> protected +protected ava.*() #MD:GuiIngame/* # All private -> protected #ItemStack -default xy.f #FD:ItemStack/field_77991_e # make default access for itemDamage +default xz.f #FD:ItemStack/field_77991_e # make default access for itemDamage #GuiSlot -protected avw.b(IIII)V #MD:GuiSlot/func_77206_b #overlayBackground +protected avx.b(IIII)V #MD:GuiSlot/func_77206_b #overlayBackground #EntityPlayer -public tz.bu #FD:EntityPlayer/field_71092_bJ #username +public ua.bu #FD:EntityPlayer/field_71092_bJ #username diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index f091e404d..f4f50ea91 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -33,7 +33,7 @@ if (this.serverName != null) { -@@ -1292,7 +1300,7 @@ +@@ -1296,7 +1304,7 @@ if (this.thePlayer.canCurrentToolHarvestBlock(j, k, l)) { @@ -42,7 +42,7 @@ this.thePlayer.swingItem(); } } -@@ -1358,7 +1366,8 @@ +@@ -1362,7 +1370,8 @@ { int j1 = itemstack != null ? itemstack.stackSize : 0; @@ -52,7 +52,7 @@ { flag = false; this.thePlayer.swingItem(); -@@ -1384,7 +1393,8 @@ +@@ -1388,7 +1397,8 @@ { ItemStack itemstack1 = this.thePlayer.inventory.getCurrentItem(); @@ -62,7 +62,7 @@ { this.entityRenderer.itemRenderer.resetEquippedProgress2(); } -@@ -2032,6 +2042,11 @@ +@@ -2036,6 +2046,11 @@ { this.statFileWriter.syncStats(); @@ -74,7 +74,7 @@ if (par1WorldClient == null) { NetClientHandler netclienthandler = this.getNetHandler(); -@@ -2049,6 +2064,18 @@ +@@ -2053,6 +2068,18 @@ if (this.theIntegratedServer != null) { this.theIntegratedServer.initiateShutdown(); @@ -93,7 +93,7 @@ } this.theIntegratedServer = null; -@@ -2219,103 +2246,12 @@ +@@ -2223,103 +2250,12 @@ if (this.objectMouseOver != null) { boolean flag = this.thePlayer.capabilities.isCreativeMode; @@ -201,7 +201,7 @@ if (flag) { -@@ -2397,11 +2333,18 @@ +@@ -2401,11 +2337,18 @@ par1PlayerUsageSnooper.addData("gl_max_texture_size", Integer.valueOf(getGLMaximumTextureSize())); } @@ -220,7 +220,7 @@ for (int i = 16384; i > 0; i >>= 1) { GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null); -@@ -2409,6 +2352,7 @@ +@@ -2413,6 +2356,7 @@ if (j != 0) { diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderEngine.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderEngine.java.patch deleted file mode 100644 index 76198d5cf..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/RenderEngine.java.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- ../src_base/minecraft/net/minecraft/client/renderer/RenderEngine.java -+++ ../src_work/minecraft/net/minecraft/client/renderer/RenderEngine.java -@@ -28,6 +28,8 @@ - import org.lwjgl.opengl.GL11; - import org.lwjgl.opengl.GL12; - -+import net.minecraftforge.client.ForgeHooksClient; -+ - @SideOnly(Side.CLIENT) - public class RenderEngine - { -@@ -186,6 +188,7 @@ - - try - { -+ ForgeHooksClient.onTextureLoadPre(par1Str); - int i = GLAllocation.generateTextureNames(); - TextureFXManager.instance().bindTextureToName(par1Str, i); - boolean flag = par1Str.startsWith("%blur%"); -@@ -216,6 +219,7 @@ - } - - this.textureMap.put(s1, Integer.valueOf(i)); -+ ForgeHooksClient.onTextureLoad(par1Str, texturePack.getSelectedTexturePack()); - return i; - } - catch (Exception exception) -@@ -417,6 +421,7 @@ - { - this.textureMapBlocks.updateAnimations(); - this.textureMapItems.updateAnimations(); -+ this.resetBoundTexture(); //Forge: BugFix, Animations don't use our bindTexture, and thus don't change the cached texture. - } - - /** -@@ -515,6 +520,7 @@ - { - this.textureMapBlocks.refreshTextures(); - this.textureMapItems.refreshTextures(); -+ this.resetBoundTexture(); //Forge: BugFix, Animations don't use our bindTexture, and thus don't change the cached texture. - } - - public Icon getMissingIcon(int par1) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch index d547f37a4..e749a29d6 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/entity/RenderManager.java +++ ../src_work/minecraft/net/minecraft/client/renderer/entity/RenderManager.java -@@ -227,12 +227,14 @@ +@@ -224,12 +224,14 @@ if (par4EntityLivingBase.isPlayerSleeping()) { diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch index 0d50cd9cd..247739af0 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java +++ ../src_work/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java -@@ -22,7 +22,16 @@ +@@ -21,7 +21,16 @@ import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.scoreboard.Scoreboard; import net.minecraft.util.MathHelper; @@ -17,7 +17,7 @@ @SideOnly(Side.CLIENT) public class RenderPlayer extends RendererLivingEntity -@@ -44,6 +53,13 @@ +@@ -43,6 +52,13 @@ { ItemStack itemstack = par1AbstractClientPlayer.inventory.armorItemInSlot(3 - par2); @@ -31,7 +31,7 @@ if (itemstack != null) { Item item = itemstack.getItem(); -@@ -51,7 +67,7 @@ +@@ -50,7 +66,7 @@ if (item instanceof ItemArmor) { ItemArmor itemarmor = (ItemArmor)item; @@ -40,7 +40,7 @@ ModelBiped modelbiped = par2 == 2 ? this.modelArmor : this.modelArmorChestplate; modelbiped.bipedHead.showModel = par2 == 0; modelbiped.bipedHeadwear.showModel = par2 == 0; -@@ -60,15 +76,17 @@ +@@ -59,15 +75,17 @@ modelbiped.bipedLeftArm.showModel = par2 == 1; modelbiped.bipedRightLeg.showModel = par2 == 2 || par2 == 3; modelbiped.bipedLeftLeg.showModel = par2 == 2 || par2 == 3; @@ -61,7 +61,7 @@ float f2 = (float)(j >> 16 & 255) / 255.0F; float f3 = (float)(j >> 8 & 255) / 255.0F; float f4 = (float)(j & 255) / 255.0F; -@@ -106,7 +124,7 @@ +@@ -105,7 +123,7 @@ if (item instanceof ItemArmor) { @@ -70,7 +70,7 @@ float f1 = 1.0F; GL11.glColor3f(f1, f1, f1); } -@@ -115,6 +133,7 @@ +@@ -114,6 +132,7 @@ public void func_110819_a(AbstractClientPlayer par1AbstractClientPlayer, double par2, double par4, double par6, float par8, float par9) { @@ -78,7 +78,7 @@ float f2 = 1.0F; GL11.glColor3f(f2, f2, f2); ItemStack itemstack = par1AbstractClientPlayer.inventory.getCurrentItem(); -@@ -146,6 +165,7 @@ +@@ -145,6 +164,7 @@ this.modelArmorChestplate.aimedBow = this.modelArmor.aimedBow = this.modelBipedMain.aimedBow = false; this.modelArmorChestplate.isSneak = this.modelArmor.isSneak = this.modelBipedMain.isSneak = false; this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = 0; @@ -86,7 +86,7 @@ } protected ResourceLocation func_110817_a(AbstractClientPlayer par1AbstractClientPlayer) -@@ -155,21 +175,30 @@ +@@ -154,21 +174,30 @@ protected void func_110820_a(AbstractClientPlayer par1AbstractClientPlayer, float par2) { @@ -121,7 +121,7 @@ { f2 = 0.625F; GL11.glTranslatef(0.0F, -0.25F, 0.0F); -@@ -221,6 +250,7 @@ +@@ -220,6 +249,7 @@ boolean flag = par1AbstractClientPlayer.func_110310_o().func_110557_a(); boolean flag1 = !par1AbstractClientPlayer.isInvisible(); boolean flag2 = !par1AbstractClientPlayer.getHideCape(); @@ -129,7 +129,7 @@ float f6; if (flag && flag1 && flag2) -@@ -272,7 +302,7 @@ +@@ -271,7 +301,7 @@ ItemStack itemstack1 = par1AbstractClientPlayer.inventory.getCurrentItem(); @@ -138,7 +138,7 @@ { GL11.glPushMatrix(); this.modelBipedMain.bipedRightArm.postRender(0.0625F); -@@ -292,7 +322,11 @@ +@@ -291,7 +321,11 @@ float f11; @@ -151,7 +151,7 @@ { f11 = 0.5F; GL11.glTranslatef(0.0F, 0.1875F, -0.3125F); -@@ -349,7 +383,7 @@ +@@ -348,7 +382,7 @@ if (itemstack1.getItem().requiresMultipleRenderPasses()) { @@ -160,7 +160,7 @@ { int k = itemstack1.getItem().getColorFromItemStack(itemstack1, j); f13 = (float)(k >> 16 & 255) / 255.0F; -@@ -371,6 +405,7 @@ +@@ -370,6 +404,7 @@ GL11.glPopMatrix(); } diff --git a/patches/minecraft/net/minecraft/client/render/entity/RendererLivingEntity.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch similarity index 85% rename from patches/minecraft/net/minecraft/client/render/entity/RendererLivingEntity.java.patch rename to patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch index 29ef9b69a..da943a9c2 100644 --- a/patches/minecraft/net/minecraft/client/render/entity/RendererLivingEntity.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch @@ -1,6 +1,6 @@ ---- ../src_base/minecraft/net/minecraft/client/render/entity/RendererLivingEntity.java -+++ ../src_work/minecraft/net/minecraft/client/render/entity/RendererLivingEntity.java -@@ -18,6 +18,9 @@ +--- ../src_base/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java ++++ ../src_work/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java +@@ -17,6 +17,9 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.util.MathHelper; @@ -10,7 +10,7 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; -@@ -29,6 +32,9 @@ +@@ -28,6 +31,9 @@ /** The model to be used during the render passes. */ protected ModelBase renderPassModel; @@ -20,7 +20,7 @@ public RendererLivingEntity(ModelBase par1ModelBase, float par2) { -@@ -440,12 +446,13 @@ +@@ -439,12 +445,13 @@ protected void func_130008_a(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6) { @@ -35,7 +35,7 @@ if (d3 < (double)(f2 * f2)) { -@@ -489,6 +496,7 @@ +@@ -488,6 +495,7 @@ } } } diff --git a/patches/minecraft/net/minecraft/server/gui/GuiStatsComponent.java.patch b/patches/minecraft/net/minecraft/server/gui/GuiStatsComponent.java.patch deleted file mode 100644 index 8ec5539a9..000000000 --- a/patches/minecraft/net/minecraft/server/gui/GuiStatsComponent.java.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- ../src_base/minecraft/net/minecraft/server/gui/GuiStatsComponent.java -+++ ../src_work/minecraft/net/minecraft/server/gui/GuiStatsComponent.java -@@ -10,6 +10,8 @@ - import javax.swing.Timer; - import net.minecraft.network.TcpConnection; - import net.minecraft.server.MinecraftServer; -+import net.minecraft.world.WorldServer; -+import net.minecraftforge.common.DimensionManager; - - @SideOnly(Side.SERVER) - public class GuiStatsComponent extends JComponent -@@ -43,6 +45,7 @@ - */ - private void updateStats() - { -+ this.displayStrings = new String[5 + DimensionManager.getIDs().length]; - long i = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); - System.gc(); - this.displayStrings[0] = "Memory use: " + i / 1024L / 1024L + " mb (" + Runtime.getRuntime().freeMemory() * 100L / Runtime.getRuntime().maxMemory() + "% free)"; -@@ -53,15 +56,18 @@ - - if (this.field_79017_e.worldServers != null) - { -- for (int j = 0; j < this.field_79017_e.worldServers.length; ++j) -+ int j = 0; -+ for (Integer id : DimensionManager.getIDs()) - { -- this.displayStrings[5 + j] = "Lvl " + j + " tick: " + field_79020_a.format(this.calcArrayAverage(this.field_79017_e.timeOfLastDimensionTick[j]) * 1.0E-6D) + " ms"; -+ this.displayStrings[5 + j] = "Lvl " + id + " tick: " + field_79020_a.format(this.calcArrayAverage(this.field_79017_e.worldTickTimes.get(id)) * 1.0E-6D) + " ms"; - -- if (this.field_79017_e.worldServers[j] != null && this.field_79017_e.worldServers[j].theChunkProviderServer != null) -+ WorldServer world = DimensionManager.getWorld(id); -+ if (world != null && world.theChunkProviderServer != null) - { -- this.displayStrings[5 + j] = this.displayStrings[5 + j] + ", " + this.field_79017_e.worldServers[j].theChunkProviderServer.makeString(); -- this.displayStrings[5 + j] = this.displayStrings[5 + j] + ", Vec3: " + this.field_79017_e.worldServers[j].getWorldVec3Pool().func_82590_d() + " / " + this.field_79017_e.worldServers[j].getWorldVec3Pool().getPoolSize(); -+ this.displayStrings[5 + j] = this.displayStrings[5 + j] + ", " + world.theChunkProviderServer.makeString(); -+ this.displayStrings[5 + j] = this.displayStrings[5 + j] + ", Vec3: " + world.getWorldVec3Pool().func_82590_d() + " / " + world.getWorldVec3Pool().getPoolSize(); - } -+ j++; - } - } - From 27779f096bfd31c346cd3d22db581e49f9ebd663 Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 30 Jun 2013 22:31:54 -0700 Subject: [PATCH 017/146] Add new launch configs to dev workspace. --- eclipse-workspace-dev.zip | Bin 23702 -> 24501 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/eclipse-workspace-dev.zip b/eclipse-workspace-dev.zip index 23b724dd546add1b818744cd98ea2153d246d892..449b04b4b9ac1aa3c5cb0c08145cb1ad5b2805a1 100644 GIT binary patch delta 1278 zcmbQXlX2^Q#tqxl1$*Y+b2{?0Z~X#B28P?r3=F=L4>D;@?g|mDck}g8aL&n0%`4H% zNi5Av&R9D6zW;3lf#dhp-_~zfv-g;W4hYZU!#y0tH7)G($|Ay8r0>;A<=mnHrLH z)IA`x;?w8H?a7|eNBn|*Gn&WvfqHmpd`#bHua+78SR{EKn zWJzg8eCI4nI<)JArSi13j}y+8J5QaYf1ArN*TQSDj<+B8q%-N$Ygl z%|_m-Yo8z3_$1_Ec9zbxq|6n9cao0Eu4{dC=EBs&-*cj!XSYeqEYd&h^T7B7cfG@& z@&n9gz85|ZkNm_{{$tkcuNzmf)#dx#j`mwNm%k?D+up_d%1vH~#FprH@Ee>uk>j&y zOUH?diE5W??n$#9Je<}jP|NK2VB4H^$)0Oj*W6qbHC=3N)=T%0>ru8IRWmk!QMy09 zs957drO*wW)9yK)-`VUA zi&uYGyiT5{$u^lsgRdTYYxIpb*i`&ieuu$P&|dD;?Vlz8>g>yR zS=;SgsdA$rxiySgVv#b(j-*`zt7HzinsL=RCCG-dPL2A=7$Pc8xc*tgnSGzHUxu1s58|N79vcCYpAOVUE-UF7Y36~%R}u4(Oz4SGfAI#M57 zM0}2oU;5zmG8Z4|zDXLsk1x+T^7&>H&tse3P4=Jtl*7)wInZ|MSn-32*B|_tCDpw& zLMn@8dqiQo_CgEelBXY-Z(qBx>ls`7i)ee{A3UF!1m4RQ@PAIeb2C+H|3TS(Pt$7a z*PNPn-}>^mX_GTwGtZw=`+mi1*{@cv&);%CV(tktlAf$_QrRd@<)g{$@;1j0J0cZa z>>UJl=q`V~aLF~Mu>8QK+}&YQzbLQLS}Uh&dq%_Z{I{idWVlMi_&3{}GP<;J%k6>* zclL)z?-uBq%EKal)wkly*Xm9EInuHzpX%NI`7Kj={HMgp=2uTlnO}U~_FHRmeI?KT zW&K+f_j>no-^$8vyL$f3E}GriSaRrt5WfWU%*n-|0E~AA21W)6hWTrrKVd05$M`u} z`#Lfm;LXTn&wwL+FsOj_Gl0$6t~og|#15KNcqcoA@~}UhE0OrO^xWj&P-~_m+F}wB;rQ9~+q&c}JJep}TjLAEhKO&mR-gyDL z_2e@V8B7!HChOWrO!kZPV|wN=d0u1&lZ+#flA0XN&NKOd2+QQh0pgPb0u(22@D!RH z6T!#i<}|q{DvqhhX)>RK)MU13Kc+RVlf$CZm}EUBzju|Id;=&F3}Tv0ejC6G)XF}& UAVz{ulR=X~NsNJ^))VAO00ECX-T(jq delta 578 zcmdnGpK;nw#tqxl`6iciI-Wf6{<}6K149qfz;qPV?A&0-h$-|y^J;05?IzZ zI@Hj7&c6O;8==Q1cB%(0Rvj^Y0F#{1)uuBgQ1t9_Z;)(WAFnh)1p z5}CHMvE8$~Ii_Cd%=8@x<3bDFtOS1~8Rps~i`>52W>tObo1*32tE?(Pfjd4uvY3&s z;jxJKQ?t&uOTV9VaI^%jy_^ttTjbp#r4_qBwcDkKNSGT&NJd1JKZt6)ZM;{*Wmj+W zXGOQ?Yq!*PElU69oqJ6`rd;j8iMRil?(AQjB%;e~e|C?Ft9sORoh$Vj{eo2-*UN9( zxQIzDe9Kw+^`F+&xbPVl&gA|5wxLHz`|rotljlFr7^wwh@lMu@j%M0#F}XWBj_I|<%%`G5$^)I(d39_Y z( Date: Sun, 30 Jun 2013 22:32:11 -0700 Subject: [PATCH 018/146] Update GuiIngameForge to reflect Mojang changes in 1.6.1 --- .../minecraftforge/client/GuiIngameForge.java | 285 ++++++++++++------ .../client/event/RenderGameOverlayEvent.java | 4 +- 2 files changed, 201 insertions(+), 88 deletions(-) diff --git a/client/net/minecraftforge/client/GuiIngameForge.java b/client/net/minecraftforge/client/GuiIngameForge.java index c8fae1276..d06e8733f 100644 --- a/client/net/minecraftforge/client/GuiIngameForge.java +++ b/client/net/minecraftforge/client/GuiIngameForge.java @@ -1,16 +1,10 @@ package net.minecraftforge.client; +import static net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType.*; + import java.awt.Color; import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; import java.util.List; -import java.util.Random; - -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import cpw.mods.fml.common.FMLCommonHandler; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -18,30 +12,26 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiIngame; -import net.minecraft.client.gui.GuiNewChat; import net.minecraft.client.gui.GuiPlayerInfo; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.multiplayer.NetClientHandler; import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.resources.ResourceLocation; import net.minecraft.crash.CallableMinecraftVersion; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeInstance; -import net.minecraft.entity.boss.BossStatus; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.scoreboard.Score; import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.scoreboard.Scoreboard; import net.minecraft.util.Direction; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.FoodStats; -import net.minecraft.util.Icon; import net.minecraft.util.MathHelper; import net.minecraft.util.StatCollector; import net.minecraft.util.StringUtils; @@ -51,7 +41,11 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.MinecraftForge; -import static net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType.*; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import cpw.mods.fml.common.FMLCommonHandler; public class GuiIngameForge extends GuiIngame { @@ -72,9 +66,14 @@ public class GuiIngameForge extends GuiIngame public static boolean renderHealth = true; public static boolean renderArmor = true; public static boolean renderFood = true; + public static boolean renderHealthMount = true; public static boolean renderAir = true; public static boolean renderExperiance = true; + public static boolean renderJumpBar = true; public static boolean renderObjective = true; + + public static int left_height = 39; + public static int right_height = 39; private ScaledResolution res = null; private FontRenderer fontrenderer = null; @@ -93,6 +92,12 @@ public class GuiIngameForge extends GuiIngame eventParent = new RenderGameOverlayEvent(partialTicks, res, mouseX, mouseY); int width = res.getScaledWidth(); int height = res.getScaledHeight(); + renderHealthMount = mc.thePlayer.ridingEntity instanceof EntityLivingBase; + renderFood = mc.thePlayer.ridingEntity == null; + renderJumpBar = mc.thePlayer.func_110317_t(); + + right_height = 39; + left_height = 39; if (pre(ALL)) return; @@ -121,22 +126,30 @@ public class GuiIngameForge extends GuiIngame GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); zLevel = -90.0F; rand.setSeed((long)(updateCounter * 312871)); - mc.renderEngine.func_110577_a(TextureMap.field_110576_c); if (renderCrosshairs) renderCrosshairs(width, height); if (renderBossHealth) renderBossHealth(); - + if (this.mc.playerController.shouldDrawHUD()) { - if (renderArmor) renderArmor(width, height); if (renderHealth) renderHealth(width, height); + if (renderArmor) renderArmor(width, height); if (renderFood) renderFood(width, height); + if (renderHealthMount) renderHealthMount(width, height); if (renderAir) renderAir(width, height); } if (renderHotbar) renderHotbar(width, height, partialTicks); } - if (renderExperiance) renderExperience(width, height); + if (renderJumpBar) + { + renderJumpBar(width, height); + } + else if (renderExperiance) + { + renderExperience(width, height); + } + renderSleepFade(width, height); renderToolHightlight(width, height); renderHUDText(width, height); @@ -202,6 +215,7 @@ public class GuiIngameForge extends GuiIngame protected void renderCrosshairs(int width, int height) { if (pre(CROSSHAIRS)) return; + bind(Gui.field_110324_m); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_ONE_MINUS_DST_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR); drawTexturedModalRect(width / 2 - 7, height / 2 - 7, 0, 0, 16, 16); @@ -246,7 +260,7 @@ public class GuiIngameForge extends GuiIngame mc.mcProfiler.startSection("armor"); int left = width / 2 - 91; - int top = height - 49; + int top = height - left_height; int level = ForgeHooks.getTotalArmorValue(mc.thePlayer); for (int i = 1; level > 0 && i < 20; i += 2) @@ -265,6 +279,7 @@ public class GuiIngameForge extends GuiIngame } left += 8; } + left_height += 10; mc.mcProfiler.endSection(); post(ARMOR); @@ -289,7 +304,7 @@ public class GuiIngameForge extends GuiIngame if (pre(AIR)) return; mc.mcProfiler.startSection("air"); int left = width / 2 + 91; - int top = height - 49; + int top = height - right_height; if (mc.thePlayer.isInsideOfMaterial(Material.water)) { @@ -301,6 +316,7 @@ public class GuiIngameForge extends GuiIngame { drawTexturedModalRect(left - i * 8 - 9, top, (i < full ? 16 : 25), 18, 9, 9); } + right_height += 10; } mc.mcProfiler.endSection(); @@ -309,6 +325,7 @@ public class GuiIngameForge extends GuiIngame public void renderHealth(int width, int height) { + bind(field_110324_m); if (pre(HEALTH)) return; mc.mcProfiler.startSection("health"); @@ -320,49 +337,71 @@ public class GuiIngameForge extends GuiIngame } AttributeInstance attrMaxHealth = this.mc.thePlayer.func_110148_a(SharedMonsterAttributes.field_111267_a); - float maxHealth = (float)attrMaxHealth.func_111126_e(); - int health = MathHelper.ceiling_float_int(mc.thePlayer.func_110143_aJ()); int healthLast = MathHelper.ceiling_float_int(mc.thePlayer.prevHealth); + float healthMax = (float)attrMaxHealth.func_111126_e(); + float absorb = this.mc.thePlayer.func_110139_bj(); + + int healthRows = MathHelper.ceiling_float_int((healthMax + absorb) / 2.0F / 10.0F); + int rowHeight = Math.max(10 - (healthRows - 2), 3); + + this.rand.setSeed((long)(updateCounter * 312871)); + int left = width / 2 - 91; - int top = height - 39; + int top = height - left_height; + left_height += (healthRows * rowHeight); + if (rowHeight != 10) left_height += 10 - rowHeight; int regen = -1; if (mc.thePlayer.isPotionActive(Potion.regeneration)) { - regen = this.updateCounter % 25; + regen = updateCounter % 25; } - - for (int i = 0; i < 10; ++i) + + final int TOP = 9 * (mc.theWorld.getWorldInfo().isHardcoreModeEnabled() ? 5 : 0); + final int BACKGROUND = (highlight ? 25 : 16); + int MARGIN = 16; + if (mc.thePlayer.isPotionActive(Potion.poison)) MARGIN += 36; + else if (mc.thePlayer.isPotionActive(Potion.wither)) MARGIN += 72; + float absorbRemaining = absorb; + + for (int i = MathHelper.ceiling_float_int((healthMax + absorb) / 2.0F) - 1; i >= 0; --i) { - int idx = i * 2 + 1; - int iconX = 16; - if (mc.thePlayer.isPotionActive(Potion.poison)) iconX += 36; - else if (mc.thePlayer.isPotionActive(Potion.wither)) iconX += 72; + int b0 = (highlight ? 1 : 0); + int row = MathHelper.ceiling_float_int((float)(i + 1) / 10.0F) - 1; + int x = left + i % 10 * 8; + int y = top - row * rowHeight; - int x = left + i * 8; - int y = top; - if (health <= 4) y = top + rand.nextInt(2); - if (i == regen) y -= 2; + if (health <= 4) y += rand.nextInt(2); + if (i == regen) y -= 2; - byte iconY = 0; - if (mc.theWorld.getWorldInfo().isHardcoreModeEnabled()) iconY = 5; - - drawTexturedModalRect(x, y, 16 + (highlight ? 9 : 0), 9 * iconY, 9, 9); + drawTexturedModalRect(x, y, BACKGROUND, TOP, 9, 9); if (highlight) { - if (idx < healthLast) - drawTexturedModalRect(x, y, iconX + 54, 9 * iconY, 9, 9); - else if (idx == healthLast) - drawTexturedModalRect(x, y, iconX + 63, 9 * iconY, 9, 9); + if (i * 2 + 1 < healthLast) + drawTexturedModalRect(x, y, MARGIN + 54, TOP, 9, 9); //6 + else if (i * 2 + 1 == healthLast) + drawTexturedModalRect(x, y, MARGIN + 63, TOP, 9, 9); //7 } - if (idx < health) - drawTexturedModalRect(x, y, iconX + 36, 9 * iconY, 9, 9); - else if (idx == health) - drawTexturedModalRect(x, y, iconX + 45, 9 * iconY, 9, 9); + if (absorbRemaining > 0.0F) + { + if (absorbRemaining == absorb && absorb % 2.0F == 1.0F) + drawTexturedModalRect(x, y, MARGIN + 153, TOP, 9, 9); //17 + else + drawTexturedModalRect(x, y, MARGIN + 144, TOP, 9, 9); //16 + absorbRemaining -= 2.0F; + } + else + { + if (i * 2 + 1 < health) + drawTexturedModalRect(x, y, MARGIN + 36, TOP, 9, 9); //4 + else if (i * 2 + 1 == health) + drawTexturedModalRect(x, y, MARGIN + 45, TOP, 9, 9); //5 + } } + mc.mcProfiler.endSection(); post(HEALTH); } @@ -373,7 +412,8 @@ public class GuiIngameForge extends GuiIngame mc.mcProfiler.startSection("food"); int left = width / 2 + 91; - int top = height - 39; + int top = height - right_height; + right_height += 10; boolean unused = false;// Unused flag in vanilla, seems to be part of a 'fade out' mechanic FoodStats stats = mc.thePlayer.getFoodStats(); @@ -400,30 +440,20 @@ public class GuiIngameForge extends GuiIngame y = top + (rand.nextInt(3) - 1); } - this.drawTexturedModalRect(x, y, 16 + backgound * 9, 27, 9, 9); + drawTexturedModalRect(x, y, 16 + backgound * 9, 27, 9, 9); if (unused) { if (idx < levelLast) - { drawTexturedModalRect(x, y, icon + 54, 27, 9, 9); - } - - if (idx == levelLast) - { + else if (idx == levelLast) drawTexturedModalRect(x, y, icon + 63, 27, 9, 9); - } } if (idx < level) - { drawTexturedModalRect(x, y, icon + 36, 27, 9, 9); - } - - if (idx == level) - { + else if (idx == level) drawTexturedModalRect(x, y, icon + 45, 27, 9, 9); - } } mc.mcProfiler.endSection(); post(FOOD); @@ -454,50 +484,79 @@ public class GuiIngameForge extends GuiIngame protected void renderExperience(int width, int height) { + bind(field_110324_m); if (pre(EXPERIENCE)) return; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - if (mc.playerController.shouldDrawHUD()) + + if (mc.playerController.func_78763_f()) { mc.mcProfiler.startSection("expBar"); - mc.func_110434_K().func_110577_a(WIDGITS); int cap = this.mc.thePlayer.xpBarCap(); int left = width / 2 - 91; - + if (cap > 0) { - short short1 = 182; - int l2 = (int)(this.mc.thePlayer.experience * (float)(short1 + 1)); - int k2 = height - 32 + 3; - this.drawTexturedModalRect(left, k2, 0, 64, short1, 5); - - if (l2 > 0) + short barWidth = 182; + int filled = (int)(mc.thePlayer.experience * (float)(barWidth + 1)); + int top = height - 32 + 3; + drawTexturedModalRect(left, top, 0, 64, barWidth, 5); + + if (filled > 0) { - this.drawTexturedModalRect(left, k2, 0, 69, l2, 5); + drawTexturedModalRect(left, top, 0, 69, filled, 5); } } - mc.mcProfiler.endSection(); - } - if (mc.playerController.func_78763_f() && mc.thePlayer.experienceLevel > 0) - { - mc.mcProfiler.startSection("expLevel"); - boolean flag1 = false; - int color = flag1 ? 16777215 : 8453920; - String text = "" + mc.thePlayer.experienceLevel; - int x = (width - fontrenderer.getStringWidth(text)) / 2; - int y = height - 31 - 4; - fontrenderer.drawString(text, x + 1, y, 0); - fontrenderer.drawString(text, x - 1, y, 0); - fontrenderer.drawString(text, x, y + 1, 0); - fontrenderer.drawString(text, x, y - 1, 0); - fontrenderer.drawString(text, x, y, color); - mc.mcProfiler.endSection(); + this.mc.mcProfiler.endSection(); + + + if (mc.playerController.func_78763_f() && mc.thePlayer.experienceLevel > 0) + { + mc.mcProfiler.startSection("expLevel"); + boolean flag1 = false; + int color = flag1 ? 16777215 : 8453920; + String text = "" + mc.thePlayer.experienceLevel; + int x = (width - fontrenderer.getStringWidth(text)) / 2; + int y = height - 31 - 4; + fontrenderer.drawString(text, x + 1, y, 0); + fontrenderer.drawString(text, x - 1, y, 0); + fontrenderer.drawString(text, x, y + 1, 0); + fontrenderer.drawString(text, x, y - 1, 0); + fontrenderer.drawString(text, x, y, color); + mc.mcProfiler.endSection(); + } } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); post(EXPERIENCE); } + protected void renderJumpBar(int width, int height) + { + bind(field_110324_m); + if (pre(JUMPBAR)) return; + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + mc.mcProfiler.startSection("jumpBar"); + float charge = mc.thePlayer.func_110319_bJ(); + final int barWidth = 182; + int x = (width / 2) - (barWidth / 2); + int filled = (int)(charge * (float)(barWidth + 1)); + int top = height - 32 + 3; + + drawTexturedModalRect(x, top, 0, 84, barWidth, 5); + + if (filled > 0) + { + this.drawTexturedModalRect(x, top, 0, 89, filled, 5); + } + + mc.mcProfiler.endSection(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + post(JUMPBAR); + } + protected void renderToolHightlight(int width, int height) { if (this.mc.gameSettings.heldItemTooltips) @@ -748,6 +807,54 @@ public class GuiIngameForge extends GuiIngame } } + protected void renderHealthMount(int width, int height) + { + Entity tmp = mc.thePlayer.ridingEntity; + if (!(tmp instanceof EntityLivingBase)) return; + + bind(field_110324_m); + + if (pre(HEALTHMOUNT)) return; + + boolean unused = false; + int left_align = width / 2 + 91; + + mc.mcProfiler.endStartSection("mountHealth"); + EntityLivingBase mount = (EntityLivingBase)tmp; + int health = (int)Math.ceil((double)mount.func_110143_aJ()); + float healthMax = mount.func_110138_aP(); + int hearts = (int)(healthMax + 0.5F) / 2; + + if (hearts > 30) hearts = 30; + + final int MARGIN = 52; + final int BACKGROUND = MARGIN + (unused ? 1 : 0); + final int HALF = MARGIN + 45; + final int FULL = MARGIN + 36; + + for (int heart = 0; hearts > 0; heart += 20) + { + int top = height - right_height; + + int rowCount = Math.min(hearts, 10); + hearts -= rowCount; + + for (int i = 0; i < rowCount; ++i) + { + int x = left_align - i * 8 - 9; + drawTexturedModalRect(x, top, BACKGROUND, 9, 9, 9); + + if (i * 2 + 1 + heart < health) + drawTexturedModalRect(x, top, FULL, 9, 9, 9); + else if (i * 2 + 1 + heart == health) + drawTexturedModalRect(x, top, HALF, 9, 9, 9); + } + + right_height += 10; + } + post(HEALTHMOUNT); + } + //Helper macros private boolean pre(ElementType type) { @@ -757,4 +864,8 @@ public class GuiIngameForge extends GuiIngame { MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Post(eventParent, type)); } + private void bind(ResourceLocation res) + { + mc.func_110434_K().func_110577_a(res); + } } diff --git a/client/net/minecraftforge/client/event/RenderGameOverlayEvent.java b/client/net/minecraftforge/client/event/RenderGameOverlayEvent.java index d35137bdc..68ab5f73f 100644 --- a/client/net/minecraftforge/client/event/RenderGameOverlayEvent.java +++ b/client/net/minecraftforge/client/event/RenderGameOverlayEvent.java @@ -22,7 +22,9 @@ public class RenderGameOverlayEvent extends Event AIR, HOTBAR, EXPERIENCE, - TEXT + TEXT, + HEALTHMOUNT, + JUMPBAR } public final float partialTicks; From 17a539e1730c3e0ef8b57e8f8bc650f23dcaa8fb Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 30 Jun 2013 23:20:56 -0700 Subject: [PATCH 019/146] Updated FML: MinecraftForge/FML@c418da353f6a8420b095fa737e8b0eae270d31ae Cleanup coremod code, server side working now. --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index 110cf372e..c418da353 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 110cf372eb5aa85df20b248976f1acdefa85e102 +Subproject commit c418da353f6a8420b095fa737e8b0eae270d31ae From 3df47c0250df8aa3132dda8021916a2da65dfc6b Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 30 Jun 2013 23:21:28 -0700 Subject: [PATCH 020/146] Update release script to generate binary patches and include deobf data. --- release.py | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/release.py b/release.py index 5da673f41..024772329 100644 --- a/release.py +++ b/release.py @@ -1,6 +1,7 @@ import os, os.path, sys, glob import shutil, fnmatch -import logging, zipfile, re +import logging, zipfile, re, subprocess +from pprint import pformat from optparse import OptionParser from urllib2 import HTTPError @@ -81,7 +82,9 @@ def main(): error_level = e.code extract_fml_obfed(fml_dir, mcp_dir, reobf_dir, client_dir) - extract_paulscode(mcp_dir, client_dir) + #extract_paulscode(mcp_dir, client_dir) + gen_bin_patches(mcp_dir, os.path.join(forge_dir, 'fml'), build_num, client_dir) + version = load_version(build_num) version_forge = '%d.%d.%d.%d' % (version['major'], version['minor'], version['revision'], version['build']) version_mc = load_mc_version(fml_dir) @@ -141,7 +144,8 @@ def main(): 'common/fml_marker.cfg', 'common/fmlversion.properties', 'common/mcpmod.info', - 'client/mcp.png' + 'client/mcp.png', + 'common/deobfuscation_data-%s.lzma' % version_mc ] for file in FML_FILES: zip_add(os.path.join(fml_dir, file)) @@ -321,5 +325,37 @@ def zip_folder_filter(path, key, zip, filter): print file_key zip.write(file_path, file_key) +def gen_bin_patches(mcp_dir, fml_dir, build_num, client_dir): + print('Creating Binary patches') + os.environ['WORKSPACE'] = os.path.join(mcp_dir, '..') + os.environ['BUILD_NUMBER'] = str(build_num) + + BUILD = ['ant', 'makebinpatches'] + if sys.platform.startswith('win'): + BUILD = ['cmd', '/C'] + BUILD + + if not run_command(BUILD, cwd=fml_dir): + print('Could not crate binary patches') + sys.exit(1) + + fml_lzma = os.path.join(fml_dir, 'binpatches.pack.lzma') + obf_lzma = os.path.join(client_dir, 'binpatches.pack.lzma') + shutil.move(fml_lzma, obf_lzma) + +def run_command(command, cwd='.', verbose=True): + print('Running command: ') + print(pformat(command)) + + process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=1, cwd=cwd) + while process.poll() is None: + line = process.stdout.readline() + if line: + line = line.rstrip() + print(line) + if process.returncode: + print "failed: {0}".format(process.returncode) + return False + return True + if __name__ == '__main__': main() From f1dde02853f7d224239ec0f21438c95a8f2b31a7 Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 30 Jun 2013 23:29:43 -0700 Subject: [PATCH 021/146] Deprecation sweep and update version to 8.9 to reflect 1.6.1 update. --- .../client/MinecraftForgeClient.java | 9 -------- .../minecraftforge/common/ForgeVersion.java | 6 ++--- .../common/IThrowableEntity.java | 23 ------------------- .../minecraftforge/liquids/LiquidStack.java | 11 --------- .../net/minecraft/block/Block.java.patch | 8 +------ .../net/minecraft/item/Item.java.patch | 7 +----- 6 files changed, 5 insertions(+), 59 deletions(-) delete mode 100644 common/net/minecraftforge/common/IThrowableEntity.java diff --git a/client/net/minecraftforge/client/MinecraftForgeClient.java b/client/net/minecraftforge/client/MinecraftForgeClient.java index a74c48484..585d8da8c 100644 --- a/client/net/minecraftforge/client/MinecraftForgeClient.java +++ b/client/net/minecraftforge/client/MinecraftForgeClient.java @@ -20,15 +20,6 @@ import net.minecraftforge.common.MinecraftForge; public class MinecraftForgeClient { - /** - * NO-OP now. Not needed with new texturing system in MC 1.5 - */ - @Deprecated // without replacement - public static void preloadTexture(String texture) - { -// ForgeHooksClient.engine().getTexture(texture); - } - private static IItemRenderer[] customItemRenderers = new IItemRenderer[Item.itemsList.length]; /** diff --git a/common/net/minecraftforge/common/ForgeVersion.java b/common/net/minecraftforge/common/ForgeVersion.java index d22eebfe0..e162a21ab 100644 --- a/common/net/minecraftforge/common/ForgeVersion.java +++ b/common/net/minecraftforge/common/ForgeVersion.java @@ -8,11 +8,11 @@ package net.minecraftforge.common; public class ForgeVersion { //This number is incremented every time we remove deprecated code/major API changes, never reset - public static final int majorVersion = 7; + public static final int majorVersion = 8; //This number is incremented every minecraft release, never reset - public static final int minorVersion = 8; + public static final int minorVersion = 9; //This number is incremented every time a interface changes or new major feature is added, and reset every Minecraft version - public static final int revisionVersion = 1; + public static final int revisionVersion = 0; //This number is incremented every time Jenkins builds Forge, and never reset. Should always be 0 in the repo code. public static final int buildVersion = 0; diff --git a/common/net/minecraftforge/common/IThrowableEntity.java b/common/net/minecraftforge/common/IThrowableEntity.java deleted file mode 100644 index b4a0e5c1a..000000000 --- a/common/net/minecraftforge/common/IThrowableEntity.java +++ /dev/null @@ -1,23 +0,0 @@ -package net.minecraftforge.common; - -import net.minecraft.entity.Entity; - -/** - * This interface should be implemented by an Entity that can be 'thrown', like snowballs. - * This was created to mimic ModLoaderMP's 'owner' functionality. - */ -@Deprecated //Moved to FML cpw.mods.fml.common.registry.IThrowableEntity -public interface IThrowableEntity -{ - /** - * Gets the entity that threw/created this entity. - * @return The owner instance, Null if none. - */ - public Entity getThrower(); - - /** - * Sets the entity that threw/created this entity. - * @param entity The new thrower/creator. - */ - public void setThrower(Entity entity); -} diff --git a/common/net/minecraftforge/liquids/LiquidStack.java b/common/net/minecraftforge/liquids/LiquidStack.java index a52a9b36f..c641c6cfd 100644 --- a/common/net/minecraftforge/liquids/LiquidStack.java +++ b/common/net/minecraftforge/liquids/LiquidStack.java @@ -66,17 +66,6 @@ public class LiquidStack return nbt; } - - /** - * NO-OP now. Use {@link #loadLiquidStackFromNBT(NBTTagCompound)} to get a new instance - * - * @param nbt - */ - @Deprecated - public void readFromNBT(NBTTagCompound nbt) - { - } - /** * @return A copy of this LiquidStack */ diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index d0bc2d742..ad842c06b 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -165,7 +165,7 @@ } /** -@@ -1453,4 +1474,945 @@ +@@ -1453,4 +1474,939 @@ canBlockGrass[0] = true; StatList.initBreakableStats(); } @@ -1079,12 +1079,6 @@ + */ + public float getEnchantPowerBonus(World world, int x, int y, int z) + { -+ return getEnchantPower(world, x, y, z); -+ } -+ -+ @Deprecated //Changed return to float, see above. -+ public int getEnchantPower(World world, int x, int y, int z) -+ { + return blockID == bookShelf.blockID ? 1 : 0; + } + /** diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches/minecraft/net/minecraft/item/Item.java.patch index 6652e03b7..bfab3f36c 100644 --- a/patches/minecraft/net/minecraft/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -58,7 +58,7 @@ Vec3 vec31 = vec3.addVector((double)f7 * d3, (double)f6 * d3, (double)f8 * d3); return par1World.rayTraceBlocks_do_do(vec3, vec31, par3, !par3); } -@@ -736,4 +750,509 @@ +@@ -736,4 +750,504 @@ { StatList.initStats(); } @@ -360,11 +360,6 @@ + */ + public boolean isValidArmor(ItemStack stack, int armorType, Entity entity) + { -+ return isValidArmor(stack, armorType); -+ } -+ @Deprecated //Deprecated in 1.5.2, remove in 1.6, see EntityPlayer sensitive version above. -+ public boolean isValidArmor(ItemStack stack, int armorType) -+ { + if (this instanceof ItemArmor) + { + return ((ItemArmor)this).armorType == armorType; From df03ece63f44e518d3e8e1f9ca1ad6865e2a06b6 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 1 Jul 2013 12:04:46 -0700 Subject: [PATCH 022/146] MinecraftForge/FML@7fecf2ad6bdd918149a3c43453f6a78bd11e5404 Update mcp URL. --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index c418da353..7fecf2ad6 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit c418da353f6a8420b095fa737e8b0eae270d31ae +Subproject commit 7fecf2ad6bdd918149a3c43453f6a78bd11e5404 From b8b708aab66ef8c12a057510e8db5e168fc62fe8 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 1 Jul 2013 12:30:19 -0700 Subject: [PATCH 023/146] Try absolute path, to not confuse jenkins. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index dd39e9470..f4556d915 100644 --- a/setup.py +++ b/setup.py @@ -53,7 +53,7 @@ def main(): def setup_fml(mcp_dir, fml_dir, build_num=0): print 'Setting up Forge ModLoader' - os.environ['WORKSPACE'] = os.path.join(mcp_dir, '..') + os.environ['WORKSPACE'] = os.path.abspath(os.path.join(mcp_dir, '..')) os.environ['BUILD_NUMBER'] = str(build_num) BUILD = ['ant', 'jenkinsbuild'] From fde224e83b8dfc5a12a363ae19c8827df73c7327 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 1 Jul 2013 16:33:34 -0700 Subject: [PATCH 024/146] Updated FML: MinecraftForge/FML@1229c4c4ea888f4f69272eed94ef5a53ce79ccda Fix src distrabution, and got rid of pesky common folder in eclipse workspace. src is now installable. MinecraftForge/FML@902772ed0cb6c22c4cd7ad9b0ec7a02961b5e016 Revert common folder fix, Common folder does nothing, feel free to delete it after first load. --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index 7fecf2ad6..902772ed0 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 7fecf2ad6bdd918149a3c43453f6a78bd11e5404 +Subproject commit 902772ed0cb6c22c4cd7ad9b0ec7a02961b5e016 From ba4637f5a3fbcf99224c5b29023c906037b701f4 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 1 Jul 2013 16:38:02 -0700 Subject: [PATCH 025/146] Update src distro installer script. Source distro works now! --- install/install.py | 77 +++++++++++++++++++++++++++++++--------------- 1 file changed, 53 insertions(+), 24 deletions(-) diff --git a/install/install.py b/install/install.py index eecd55c7e..aac857fdc 100644 --- a/install/install.py +++ b/install/install.py @@ -4,30 +4,37 @@ import shutil, glob, fnmatch import subprocess, logging from optparse import OptionParser -forge_dir = os.path.dirname(os.path.abspath(__file__)) -fml_dir = os.path.join(forge_dir, 'fml') - -sys.path.append(fml_dir) -from forge import apply_forge_patches -from fml import setup_fml, finish_setup_fml, apply_fml_patches, setup_mcp, reset_logger - -def main(mcp_dir): - src_dir = os.path.join(mcp_dir, 'src') - +def fml_main(fml_dir, mcp_dir, gen_conf=True, disable_patches=False, disable_at=False, disable_merge=False, enable_server=False, + disable_client=False, disable_rename=False, disable_assets=False, decompile=False): + sys.path.append(fml_dir) + from fml import download_mcp, setup_mcp, decompile_minecraft, apply_fml_patches, finish_setup_fml print '================ Forge ModLoader Setup Start ===================' - setup_mcp(fml_dir, mcp_dir, True) - setup_fml(fml_dir, mcp_dir) - apply_fml_patches(fml_dir, mcp_dir, os.path.join(mcp_dir, 'src')) - finish_setup_fml(fml_dir, mcp_dir) + download_mcp(fml_dir, mcp_dir) + setup_mcp(fml_dir, mcp_dir, gen_conf) + if decompile: + decompile_minecraft(fml_dir, mcp_dir, disable_at=disable_at, disable_merge=disable_merge, + enable_server=enable_server, disable_client=disable_client, + disable_assets=disable_assets) + if disable_patches: + print 'Patching disabled' + else: + apply_fml_patches(fml_dir, mcp_dir, os.path.join(mcp_dir, 'src')) + finish_setup_fml(fml_dir, mcp_dir, enable_server=enable_server, disable_client=disable_client, disable_rename=disable_rename) + else: + print 'Decompile free install is on the to-do!' print '================ Forge ModLoader Setup End ===================' - - sys.path.append(mcp_dir) + +def forge_main(forge_dir, fml_dir, mcp_dir): + sys.path.append(mcp_dir) + sys.path.append(fml_dir) from runtime.updatenames import updatenames from runtime.updatemd5 import updatemd5 + from forge import apply_forge_patches + from fml import reset_logger print '=============================== Minecraft Forge Setup Start =====================================' print 'Applying forge patches' - apply_forge_patches(os.path.join(forge_dir, 'fml'), mcp_dir, forge_dir, src_dir, True) + apply_forge_patches(fml_dir, mcp_dir, forge_dir, os.path.join(mcp_dir, 'src'), True) os.chdir(mcp_dir) updatenames(None, True, True, False) reset_logger() @@ -35,15 +42,37 @@ def main(mcp_dir): reset_logger() os.chdir(forge_dir) print '=============================== Minecraft Forge Setup Finished =================================' - + if __name__ == '__main__': parser = OptionParser() - parser.add_option('-m', '--mcp-dir', action='store', dest='mcp_dir', help='Path to download/extract MCP to', default=None) + parser.add_option('-m', '--mcp-dir', action='store', dest='mcp_dir', help='Path to download/extract MCP to', default=None ) + parser.add_option('-p', '--no-patch', action="store_true", dest='no_patch', help='Disable application of FML patches', default=False) + parser.add_option('-a', '--no-access', action="store_true", dest='no_access', help='Disable access transformers', default=False) + parser.add_option('-s', '--server', action="store_true", dest='enable_server', help='Enable decompilation of server', default=False) + parser.add_option('-c', '--no-client', action="store_true", dest='no_client', help='Disable decompilation of server', default=False) + parser.add_option('-e', '--no-merge', action="store_true", dest='no_merge', help='Disable merging server code into client', default=False) + parser.add_option('-n', '--no-rename', action="store_true", dest='no_rename', help='Disable running updatenames', default=False) + parser.add_option( '--no-assets', action="store_true", dest='no_assets', help='Disable downloading of assets folder', default=False) + parser.add_option('-d', '--decompile', action="store_true", dest='decompile', help='Decompile minecraft and apply patches', default=True) options, _ = parser.parse_args() + + forge_dir = os.path.dirname(os.path.abspath(__file__)) + fml_dir = os.path.abspath('fml') + mcp_dir = os.path.abspath('mcp') if not options.mcp_dir is None: - main(os.path.abspath(options.mcp_dir)) - elif os.path.isfile(os.path.join('..', 'runtime', 'commands.py')): - main(os.path.abspath('..')) - else: - main(os.path.abspath('mcp')) + mcp_dir = os.path.abspath(options.mcp_dir) + + if options.no_client: + options.no_patch = True + + if options.no_merge: + options.no_patch = True + + fml_main(fml_dir, mcp_dir, disable_patches=options.no_patch, + disable_at=options.no_access, disable_merge=options.no_merge, + enable_server=options.enable_server, disable_client=options.no_client, + disable_rename=options.no_rename, disable_assets=options.no_assets, + decompile=options.decompile, gen_conf=False) + + forge_main(forge_dir, fml_dir, mcp_dir) \ No newline at end of file From e156ec2940c55013b1b6319b258ba97b89c9151c Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 1 Jul 2013 21:41:47 -0700 Subject: [PATCH 026/146] Update ToolMaterial enum helper. --- common/net/minecraftforge/common/EnumHelper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/net/minecraftforge/common/EnumHelper.java b/common/net/minecraftforge/common/EnumHelper.java index 979899b7d..54fee617b 100644 --- a/common/net/minecraftforge/common/EnumHelper.java +++ b/common/net/minecraftforge/common/EnumHelper.java @@ -46,7 +46,7 @@ public class EnumHelper {EnumMovingObjectType.class}, {EnumSkyBlock.class, int.class}, {EnumStatus.class}, - {EnumToolMaterial.class, int.class, int.class, float.class, int.class, int.class} + {EnumToolMaterial.class, int.class, int.class, float.class, float.class, int.class} }; public static EnumAction addAction(String name) @@ -102,7 +102,7 @@ public class EnumHelper { return addEnum(EnumStatus.class, name); } - public static EnumToolMaterial addToolMaterial(String name, int harvestLevel, int maxUses, float efficiency, int damage, int enchantability) + public static EnumToolMaterial addToolMaterial(String name, int harvestLevel, int maxUses, float efficiency, float damage, int enchantability) { return addEnum(EnumToolMaterial.class, name, harvestLevel, maxUses, efficiency, damage, enchantability); } From d072d9108110b4ec1e44c2cfa2d537a37ad2d328 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 1 Jul 2013 21:42:33 -0700 Subject: [PATCH 027/146] Release will now build a installer jar and use the standard 'target' output folder. --- .gitignore | 1 + release.py | 59 ++++++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 54 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 2e2f5df59..d421b4b09 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ /patches-old/ /mcp/ /eclipse/ +/target/ diff --git a/release.py b/release.py index 024772329..5505e6567 100644 --- a/release.py +++ b/release.py @@ -1,9 +1,11 @@ import os, os.path, sys, glob -import shutil, fnmatch +import shutil, fnmatch, time import logging, zipfile, re, subprocess from pprint import pformat from optparse import OptionParser from urllib2 import HTTPError +from contextlib import closing +from datetime import datetime forge_dir = os.path.dirname(os.path.abspath(__file__)) from forge import reset_logger, load_version, zip_folder, zip_create, inject_version, build_forge_dev @@ -94,7 +96,7 @@ def main(): if not branch == "": version_str = '%s-%s' % (version_str, branch) - out_folder = os.path.join(forge_dir, 'forge-%s' % version_str) + out_folder = os.path.join(forge_dir, 'target') if os.path.isdir(out_folder): shutil.rmtree(out_folder) @@ -102,7 +104,7 @@ def main(): # options.skip_changelog = True #Disable till jenkins fixes its shit if not options.skip_changelog: - changelog_file = 'forge-%s/minecraftforge-changelog-%s.txt' % (version_str, version_str) + changelog_file = 'target/minecraftforge-changelog-%s.txt' % (version_str) try: make_changelog("http://jenkins.minecraftforge.net:81/job/minecraftforge/", build_num, changelog_file, version_str) except HTTPError, e: @@ -120,9 +122,9 @@ def main(): fh.write('forge.build.number=%d\n' % version['build']) if not options.sign_jar is None: - sign_jar(forge_dir, options.sign_jar, client_dir, 'minecraftforge-universal-%s.zip' % version_str) + sign_jar(forge_dir, options.sign_jar, client_dir, 'minecraftforge-universal-%s.jar' % version_str) else: - zip_start('minecraftforge-universal-%s.zip' % version_str) + zip_start('minecraftforge-universal-%s.jar' % version_str) zip_folder(client_dir, '', zip) zip_add('MANIFEST.MF','META-INF/MANIFEST.MF') zip_add('client/forge_logo.png') @@ -152,6 +154,8 @@ def main(): zip_end() + build_installer(forge_dir, version_str, version_forge, version_mc, out_folder) + inject_version(os.path.join(forge_dir, 'common/net/minecraftforge/common/ForgeVersion.java'.replace('/', os.sep)), build_num) zip_start('minecraftforge-src-%s.zip' % version_str, 'forge') zip_add('client', 'client') @@ -173,6 +177,49 @@ def main(): print '=================================== Release Finished %d =================================' % error_level sys.exit(error_level) +def build_installer(forge_dir, version_str, version_forge, version_minecraft, out_folder): + file_name = 'minecraftforge-installer-%s.jar' % version_str + universal_name = 'minecraftforge-universal-%s.jar' % version_str + + def getTZ(): + ret = '-' + t = time.timezone + print t + if (t < 0): + ret = '+' + t *= -1 + + h = int(t/60/60) + t -= (h*60*60) + m = int(t/60) + return '%s%02d%02d' % (ret, h, m) + timestamp = datetime.now().replace(microsecond=0).isoformat() + getTZ() + + print '================== %s Start ==================' % file_name + with closing(zipfile.ZipFile(os.path.join(forge_dir, 'fml', 'installer_base.jar'), mode='a')) as zip_in: + with closing(zipfile.ZipFile(os.path.join(out_folder, file_name), 'w', zipfile.ZIP_DEFLATED)) as zip_out: + # Copy everything over + for i in zip_in.filelist: + if not i.filename in ['install_profile.json', 'big_logo.png']: + print(' %s' % i.filename) + zip_out.writestr(i.filename, zip_in.read(i.filename)) + print(' %s' % universal_name) + zip_out.write(os.path.join(out_folder, universal_name), universal_name) + print(' big_logo.png') + zip_out.write(os.path.join(forge_dir, 'client', 'forge_logo.png'), 'big_logo.png') + with closing(open(os.path.join(forge_dir, 'fml', 'jsons', '%s-rel.json' % version_minecraft), 'r')) as fh: + data = fh.read() + data = data.replace('@version@', version_forge) + data = data.replace('@timestamp@', timestamp) + data = data.replace('@minecraft_version@', version_minecraft) + data = data.replace('@universal_jar@', universal_name) + data = data.replace('FML', 'Forge') + data = data.replace('cpw.mods:fml:', 'net.minecraftforge:minecraftforge:') + print(' install_profile.json') + zip_out.writestr('install_profile.json', data) + + print '================== %s Finished ==================' % file_name + def zip_add(file, key=None): if key == None: key = os.path.basename(file) @@ -193,7 +240,7 @@ def zip_start(name, base=None): zip_name = name print '================== %s Start ==================' % zip_name - zip_file = os.path.join(forge_dir, 'forge-%s' % version_str, name) + zip_file = os.path.join(forge_dir, 'target', name) zip = zipfile.ZipFile(zip_file, 'w', zipfile.ZIP_DEFLATED) zip_base = base From dac329bcf1d625f529e9750ca0bbee8e454c46e8 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 1 Jul 2013 21:42:52 -0700 Subject: [PATCH 028/146] Updated FML: MinecraftForge/FML@29d6c875d0675ffa14428c511bd6ebe9232a486c Add FML Installer logo crated by @ZaverSLO https://twitter.com/ZaverSLO/status/349947190300508162 MinecraftForge/FML@3d17434510e890574b68c8a181b80c830b5d043a Build installer package for the new client launcher. MinecraftForge/FML@bf38d947569911dab03319a8b0f1964f36b195b2 Update json samples MinecraftForge/FML@7037184a4e724300001dfc1f8df2e76a0ec30368 Fix up release JSON MinecraftForge/FML@dc7d02ebf6c9fc5965344a9aeca79f230a40afb4 Fix json syntax error. --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index 902772ed0..dc7d02ebf 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 902772ed0cb6c22c4cd7ad9b0ec7a02961b5e016 +Subproject commit dc7d02ebf6c9fc5965344a9aeca79f230a40afb4 From c157875ecd553987fd91f211018c267f4f044fd0 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 1 Jul 2013 21:54:10 -0700 Subject: [PATCH 029/146] Fix installer unintended replace. Updated FML: MinecraftForge/FML@9b6525e80504ff72a1798cf5797bf148295db776 Point scala downloads to our servers, Launcher doesn't like standard maven repos. --- fml | 2 +- release.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/fml b/fml index dc7d02ebf..9b6525e80 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit dc7d02ebf6c9fc5965344a9aeca79f230a40afb4 +Subproject commit 9b6525e80504ff72a1798cf5797bf148295db776 diff --git a/release.py b/release.py index 5505e6567..516833e94 100644 --- a/release.py +++ b/release.py @@ -213,7 +213,9 @@ def build_installer(forge_dir, version_str, version_forge, version_minecraft, ou data = data.replace('@timestamp@', timestamp) data = data.replace('@minecraft_version@', version_minecraft) data = data.replace('@universal_jar@', universal_name) + data = data.replace('FMLTweaker', 'F_M_L_Tweaker') data = data.replace('FML', 'Forge') + data = data.replace('F_M_L_Tweaker', 'FMLTweaker') data = data.replace('cpw.mods:fml:', 'net.minecraftforge:minecraftforge:') print(' install_profile.json') zip_out.writestr('install_profile.json', data) From 7864f2c8eaf19eb83c74931551c2a0690c35901f Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 1 Jul 2013 22:54:19 -0700 Subject: [PATCH 030/146] Updated FML: MinecraftForge/FML@91ecf711092e1610dd10e77cdd517c3324e62d8d Fix -rel json MinecraftForge/FML@efc369ee83a7b62f605c13e16efad66b63b4bd8c Fix EventHandler annotation. MinecraftForge/FML@fbd57b32641b540d609314d91fd64350d50b9013 Mods are now loaded as resource packs. Vanilla will scan for valid prefixes based on subdirs of 'ass ets' which can then be referenced as ResourceLocations with the ":path" notation. --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index 9b6525e80..fbd57b326 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 9b6525e80504ff72a1798cf5797bf148295db776 +Subproject commit fbd57b32641b540d609314d91fd64350d50b9013 From 4034cfe9dc6e7623463a565bd1e8b160026ef6a6 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 1 Jul 2013 23:33:48 -0700 Subject: [PATCH 031/146] Updated FML: MinecraftForge/FML@5a97d183dfb13b0f831172a1afef7407347ea7bc Remember to update your patches!!!! MinecraftForge/FML@f1b533ad87ea08d6e62259c59779bcec1636e2fe Keep these on our servers until the launcher is actually fixed -.- --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index fbd57b326..f1b533ad8 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit fbd57b32641b540d609314d91fd64350d50b9013 +Subproject commit f1b533ad87ea08d6e62259c59779bcec1636e2fe From d5549d770d0d0949218313f7e58d20182d9dc077 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 1 Jul 2013 23:35:03 -0700 Subject: [PATCH 032/146] Fix bound texture in Controls screen, Closes #631 and #629 --- client/net/minecraftforge/client/GuiControlsScrollPanel.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/net/minecraftforge/client/GuiControlsScrollPanel.java b/client/net/minecraftforge/client/GuiControlsScrollPanel.java index bff159ffa..ec3276564 100644 --- a/client/net/minecraftforge/client/GuiControlsScrollPanel.java +++ b/client/net/minecraftforge/client/GuiControlsScrollPanel.java @@ -10,10 +10,12 @@ import net.minecraft.client.gui.GuiSlot; import net.minecraft.client.settings.KeyBinding; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.resources.ResourceLocation; import net.minecraft.util.EnumChatFormatting; public class GuiControlsScrollPanel extends GuiSlot { + protected static final ResourceLocation WIDGITS = new ResourceLocation("textures/gui/widgets.png"); private GuiControls controls; private GameSettings options; private Minecraft mc; @@ -73,7 +75,6 @@ public class GuiControlsScrollPanel extends GuiSlot { if (Mouse.next() && Mouse.getEventButtonState()) { - System.out.println(Mouse.getEventButton()); options.setKeyBinding(selected, -100 + Mouse.getEventButton()); selected = -1; KeyBinding.resetKeyBindingArrayAndHash(); @@ -92,7 +93,7 @@ public class GuiControlsScrollPanel extends GuiSlot boolean flag = _mouseX >= xPosition && _mouseY >= yPosition && _mouseX < xPosition + width && _mouseY < yPosition + height; int k = (flag ? 2 : 1); - mc.renderEngine.func_110577_a(TextureMap.field_110576_c); + mc.renderEngine.func_110577_a(WIDGITS); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); controls.drawTexturedModalRect(xPosition, yPosition, 0, 46 + k * 20, width / 2, height); controls.drawTexturedModalRect(xPosition + width / 2, yPosition, 200 - width / 2, 46 + k * 20, width / 2, height); From 3e9349bf7ba3336625a699dfaaf4484ef60cf886 Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 2 Jul 2013 02:04:04 -0700 Subject: [PATCH 033/146] Make Block.setIconName public --- common/forge_at.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/common/forge_at.cfg b/common/forge_at.cfg index b94cd9212..f6e6029b1 100644 --- a/common/forge_at.cfg +++ b/common/forge_at.cfg @@ -43,6 +43,7 @@ public aqs.(ILajv;)V #MD:Block/(ILnet/minecraft/src/Material;) #Cons public aqs.(IILajv;)V #MD:Block/(IILnet/minecraft/src/Material;) #Constructor public aqs.cH #FD:Block/field_72029_cc #blockResistance public aqs.cG #FD:Block/field_71989_cb #blockHardness +public aqs.d(Ljava/lang/String;)Laqs; #MD:Block/func_111022_d #setIconName # -- MISSING MAPPING public amq.r()Lamq; #MD:Block/func_71912_p #setRequiresSelfNotify public aqs.a(Laqw;)Laqs; #MD:Block/func_71884_a #setStepSound public aqs.b(F)Laqs; #MD:Block/func_71894_b #setResistance From b0520f3656787fad928f3d2ad4b561a6e4c7f54d Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 2 Jul 2013 02:04:28 -0700 Subject: [PATCH 034/146] Update filler block to prevent useless console warning. --- common/net/minecraftforge/common/MinecraftForge.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/net/minecraftforge/common/MinecraftForge.java b/common/net/minecraftforge/common/MinecraftForge.java index b07c957d4..942df06c0 100644 --- a/common/net/minecraftforge/common/MinecraftForge.java +++ b/common/net/minecraftforge/common/MinecraftForge.java @@ -187,7 +187,9 @@ public class MinecraftForge Block filler = new Block(0, Material.air) { - @SideOnly(Side.CLIENT) public void func_94332_a(IconRegister register){} + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IconRegister register){} }; Block.blocksList[0] = null; Block.opaqueCubeLookup[0] = false; From e57886e05a760989b28676cf1beee7705120a358 Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 2 Jul 2013 02:06:12 -0700 Subject: [PATCH 035/146] Fix resource domain when loading icon. Textures should be located in /assets/{domain}/textures/{block|item}/{name}.png Same strcutre as before except 'assets' instead of 'mods'. --- .../renderer/texture/TextureMap.java.patch | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch index 713b936be..9db4e417b 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -16,6 +16,15 @@ Iterator iterator = this.field_110574_e.entrySet().iterator(); while (iterator.hasNext()) +@@ -69,7 +71,7 @@ + Entry entry = (Entry)iterator.next(); + String s = (String)entry.getKey(); + TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)entry.getValue(); +- ResourceLocation resourcelocation = new ResourceLocation(this.basePath + s + ".png"); ++ ResourceLocation resourcelocation = new ResourceLocation(fixDomain(basePath, s) + ".png"); + + try + { @@ -142,6 +144,7 @@ textureatlassprite1 = (TextureAtlasSprite)iterator1.next(); textureatlassprite1.copyFrom(this.missingImage); @@ -32,7 +41,7 @@ } Object object = (TextureAtlasSprite)this.field_110574_e.get(par1Str); -@@ -253,4 +257,37 @@ +@@ -253,4 +257,58 @@ { this.updateAnimations(); } @@ -68,5 +77,26 @@ + return true; + } + return false; ++ } ++ ++ //This properly moves the domain, if provided, to the front of the string before concatenating ++ private String fixDomain(String base, String complex) ++ { ++ int idx = complex.indexOf(':'); ++ if (idx == -1) ++ { ++ return base + complex; ++ } ++ ++ String name = complex.substring(idx + 1, complex.length()); ++ if (idx > 1) ++ { ++ String domain = complex.substring(0, idx); ++ return domain + ':' + base + name; ++ } ++ else ++ { ++ return base + name; ++ } + } } From 2b61ea417b3888a87a17a014f5040d6604170cd9 Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 2 Jul 2013 02:37:05 -0700 Subject: [PATCH 036/146] Update ChestGenHooks for new Dungeon chest strcture. --- common/forge_at.cfg | 1 + .../minecraftforge/common/ChestGenHooks.java | 22 +++---------------- .../gen/feature/WorldGenDungeons.java.patch | 9 ++++++-- 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/common/forge_at.cfg b/common/forge_at.cfg index f6e6029b1..7063cee1a 100644 --- a/common/forge_at.cfg +++ b/common/forge_at.cfg @@ -84,6 +84,7 @@ public ahr.a #FD:ComponentStrongholdChestCorridor/field_75003_a #strongholdChest public ahv.b #FD:ComponentStrongholdLibrary/field_75007_b #strongholdLibraryChestContents public aia.c #FD:ComponentStrongholdRoomCrossing/field_75014_c #strongholdCorridorChestContents public ajb.a #FD:ComponentVillageHouse2/field_74918_a #villageBlacksmithChestContents +public afk.a #FD:WorldGenDungeons/field_111189_a #chestContents # AnvilChunkLoader.chunkSaveLocation public adz.d #FD:AnvilChunkLoader/field_75825_d # ChunkProviderServer.currentChunkLoader diff --git a/common/net/minecraftforge/common/ChestGenHooks.java b/common/net/minecraftforge/common/ChestGenHooks.java index 7ce6d6654..68c326c44 100644 --- a/common/net/minecraftforge/common/ChestGenHooks.java +++ b/common/net/minecraftforge/common/ChestGenHooks.java @@ -7,6 +7,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.WeightedRandom; import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.world.WorldServer; +import net.minecraft.world.gen.feature.WorldGenDungeons; import net.minecraft.world.gen.structure.*; import net.minecraftforge.oredict.OreDictionary; @@ -49,6 +50,7 @@ public class ChestGenHooks addInfo(STRONGHOLD_CROSSING, ComponentStrongholdRoomCrossing.strongholdRoomCrossingChestContents, 1, 5); addInfo(VILLAGE_BLACKSMITH, ComponentVillageHouse2.villageBlacksmithChestContents, 3, 9); addInfo(BONUS_CHEST, WorldServer.bonusChestContent, 10, 10); + addInfo(DUNGEON_CHEST, WorldGenDungeons.field_111189_a, 8, 8); ItemStack book = new ItemStack(Item.enchantedBook, 1, 0); WeightedRandomChestContent tmp = new WeightedRandomChestContent(book, 1, 1, 1); @@ -58,25 +60,7 @@ public class ChestGenHooks getInfo(STRONGHOLD_CORRIDOR ).addItem(tmp); getInfo(STRONGHOLD_LIBRARY ).addItem(new WeightedRandomChestContent(book, 1, 5, 2)); getInfo(STRONGHOLD_CROSSING ).addItem(tmp); - - //Wish Dungeons would get on the same wave length as other world gen... - ChestGenHooks d = new ChestGenHooks(DUNGEON_CHEST); - d.countMin = 8; - d.countMax = 8; - chestInfo.put(DUNGEON_CHEST, d); - addDungeonLoot(d, new ItemStack(Item.saddle), 100, 1, 1); - addDungeonLoot(d, new ItemStack(Item.ingotIron), 100, 1, 4); - addDungeonLoot(d, new ItemStack(Item.bread), 100, 1, 1); - addDungeonLoot(d, new ItemStack(Item.wheat), 100, 1, 4); - addDungeonLoot(d, new ItemStack(Item.gunpowder), 100, 1, 4); - addDungeonLoot(d, new ItemStack(Item.silk), 100, 1, 4); - addDungeonLoot(d, new ItemStack(Item.bucketEmpty), 100, 1, 1); - addDungeonLoot(d, new ItemStack(Item.appleGold), 1, 1, 1); - addDungeonLoot(d, new ItemStack(Item.redstone), 50, 1, 4); - addDungeonLoot(d, new ItemStack(Item.record13), 5, 1, 1); - addDungeonLoot(d, new ItemStack(Item.recordCat), 5, 1, 1); - addDungeonLoot(d, new ItemStack(Item.dyePowder, 1, 3), 100, 1, 1); - addDungeonLoot(d, book, 100, 1, 1); + getInfo(DUNGEON_CHEST ).addItem(tmp); } static void addDungeonLoot(ChestGenHooks dungeon, ItemStack item, int weight, int min, int max) diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch index f1048e3a8..d9fe44071 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch @@ -9,7 +9,12 @@ public class WorldGenDungeons extends WorldGenerator { -@@ -127,7 +129,8 @@ +@@ -122,12 +124,12 @@ + if (k2 == 1) + { + par1World.setBlock(i2, par4, j2, Block.chest.blockID, 0, 2); +- WeightedRandomChestContent[] aweightedrandomchestcontent = WeightedRandomChestContent.func_92080_a(field_111189_a, new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}); + TileEntityChest tileentitychest = (TileEntityChest)par1World.getBlockTileEntity(i2, par4, j2); if (tileentitychest != null) { @@ -19,7 +24,7 @@ } break label101; -@@ -169,7 +172,6 @@ +@@ -169,7 +171,6 @@ */ private String pickMobSpawner(Random par1Random) { From c0b09854b32b78834439730ea06db5e115f921df Mon Sep 17 00:00:00 2001 From: Christian Date: Tue, 2 Jul 2013 13:53:28 -0400 Subject: [PATCH 037/146] Start: f1b533ad87ea08d6e62259c59779bcec1636e2fe End: f21cd286ca8e974b75536224a38cc0dacaca8454 Updated FML: MinecraftForge/FML@f21cd286ca8e974b75536224a38cc0dacaca8454 Resource packs, part two. FML mods are now resource packs. Vanilla will scan anything under 'assets' and turn it into a resource prefix. Use resourcelocations to look stuff up. --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index f1b533ad8..f21cd286c 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit f1b533ad87ea08d6e62259c59779bcec1636e2fe +Subproject commit f21cd286ca8e974b75536224a38cc0dacaca8454 From ae59f1abb4bde24b3c65878f546f1073a98c39af Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 2 Jul 2013 13:57:50 -0700 Subject: [PATCH 038/146] Move resource location resolution down to TextureAtlasSprite and allow for sprites that are not stitched. --- .../texture/TextureAtlasSprite.java.patch | 32 +++++++++++++++++++ .../renderer/texture/TextureMap.java.patch | 16 +++++++--- 2 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch new file mode 100644 index 000000000..0df267583 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch @@ -0,0 +1,32 @@ +--- ../src_base/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java ++++ ../src_work/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java +@@ -11,6 +11,8 @@ + import java.util.List; + import javax.imageio.ImageIO; + import net.minecraft.client.resources.Resource; ++import net.minecraft.client.resources.ResourceLocation; ++import net.minecraft.client.resources.ResourceManager; + import net.minecraft.client.resources.data.AnimationFrame; + import net.minecraft.client.resources.data.AnimationMetadataSection; + import net.minecraft.util.Icon; +@@ -184,6 +186,20 @@ + this.height = par1; + } + ++ /** ++ * Load the specified resource as this sprite's data. ++ * Returning false from this function will prevent this icon from being stitched onto the master texture. ++ * @param manager Main resource manager ++ * @param location File resource location ++ * @return False to prevent this Icon from being stitched ++ * @throws IOException ++ */ ++ public boolean load(ResourceManager manager, ResourceLocation location) throws IOException ++ { ++ func_130100_a(manager.func_110536_a(location)); ++ return true; ++ } ++ + public void func_130100_a(Resource par1Resource) throws IOException + { + this.func_130102_n(); diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch index 9db4e417b..1ac144655 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -16,7 +16,7 @@ Iterator iterator = this.field_110574_e.entrySet().iterator(); while (iterator.hasNext()) -@@ -69,7 +71,7 @@ +@@ -69,11 +71,14 @@ Entry entry = (Entry)iterator.next(); String s = (String)entry.getKey(); TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)entry.getValue(); @@ -25,7 +25,15 @@ try { -@@ -142,6 +144,7 @@ +- textureatlassprite.func_130100_a(par1ResourceManager.func_110536_a(resourcelocation)); ++ if (!textureatlassprite.load(par1ResourceManager, resourcelocation)) ++ { ++ continue; ++ } + } + catch (RuntimeException runtimeexception) + { +@@ -142,6 +147,7 @@ textureatlassprite1 = (TextureAtlasSprite)iterator1.next(); textureatlassprite1.copyFrom(this.missingImage); } @@ -33,7 +41,7 @@ } private void func_110573_f() -@@ -212,6 +215,7 @@ +@@ -212,6 +218,7 @@ if (par1Str == null) { (new RuntimeException("Don\'t register null!")).printStackTrace(); @@ -41,7 +49,7 @@ } Object object = (TextureAtlasSprite)this.field_110574_e.get(par1Str); -@@ -253,4 +257,58 @@ +@@ -253,4 +260,58 @@ { this.updateAnimations(); } From e74ef3e86e13b398c78f1a6bd53d25d7e3f0a798 Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 2 Jul 2013 15:18:23 -0700 Subject: [PATCH 039/146] Attempt to gather lastBuild information to fix ChangeLog's off-by-one issue. --- changelog.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/changelog.py b/changelog.py index 7956e239f..017cf544b 100644 --- a/changelog.py +++ b/changelog.py @@ -24,12 +24,16 @@ class PreemptiveBasicAuthHandler(urllib2.BaseHandler): def https_request(self,req): return self.http_request(req) -def getBuildInfo(url, current_version=None): +def read_url(url): handler = PreemptiveBasicAuthHandler() handler.add_password(None, 'jenkins.minecraftforge.net:81', 'console_script', 'fd584bffa72fcac12181f37f80001200') file = urllib2.build_opener(handler).open(url) data = file.read() file.close() + return data + +def getBuildInfo(url, current_version=None): + data = read_url(url) data = ast.literal_eval(data)['allBuilds'] data = sorted(data, key=lambda key: key['number'], reverse=False) @@ -57,9 +61,29 @@ def getBuildInfo(url, current_version=None): build.pop('changeSet') build.pop('actions') return sorted(output, key=lambda key: key['number'], reverse=True) + +def add_latest_build(url, builds, current_version=None): + data = read_url(url) + data = ast.literal_eval(data) + number = data['number'] + + if builds[0]['number'] == data['number']: + return builds + + for item in data['changeSet']['items']: + item['author'] = item['author']['fullName'] + + build = { + 'number' : data['number'], + 'result' : 'SUCCESS', #Currently build should always be success... Else things derp after words + 'version' : current_version, + 'items' : data['changeSet']['items'] + } + return [build] + builds def make_changelog(job_path, target_build, change_file, current_version=None): builds = getBuildInfo('%s/api/python?tree=allBuilds[result,number,actions[text],changeSet[items[author[fullName],comment]]]&pretty=true' % job_path, current_version) + builds = add_latest_build('%s/lastBuild/api/python?pretty=true&tree=number,changeSet[items[author[fullName],comment]]' % job_path, builds, current_version) log = [ "Changelog:" ] From f35783f0fb70aa3ad5fad23323d124109e35fcd9 Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 2 Jul 2013 18:16:04 -0700 Subject: [PATCH 040/146] Updated FML: MinecraftForge/FML@6f0eedc9a64e4e246c40335e91b4868ad7f5a9e2 Fixed ClassCastException when loading ModLoader mods MinecraftForge/FML@8844554da6d5d15756d7b0a9da2f5924006b3190 Merge pull request #243 from jrtc27/modclassloader MinecraftForge/FML@7aa7221756d62ea1fbc750d7cf7acfdb28d75f2e Fix transformer search MinecraftForge/FML@5f7df5e742cbc21565cee0d25709b5cb5462127c Revert "Keep these on our servers until the launcher is actually fixed -.-" MinecraftForge/FML@ad79b9ed86eaf8c2702d79505d78a931c1774560 Fix up some deprecation warnings, and clean up coremod code that's going away. MinecraftForge/FML@ba3707af22376f8f18103f63db56e4614a9c37db More javadoc cleanup --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index f21cd286c..ba3707af2 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit f21cd286ca8e974b75536224a38cc0dacaca8454 +Subproject commit ba3707af22376f8f18103f63db56e4614a9c37db From 7e5560e60dc8cba97c4fa3d69f03438aa7be1726 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 3 Jul 2013 06:25:40 -0700 Subject: [PATCH 041/146] Update dev worksapce: Proper natives location and new server launch profile. --- eclipse-workspace-dev.zip | Bin 24501 -> 24534 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/eclipse-workspace-dev.zip b/eclipse-workspace-dev.zip index 449b04b4b9ac1aa3c5cb0c08145cb1ad5b2805a1..38cd5269f2bccb44376db2fbd7dfdc3feffdf233 100644 GIT binary patch delta 2448 zcmZWr2{hE}8=je58ZzC&FjJPYH6s&Ib{RJkV;%bpV-01?(uC?~ltH%ivm~O$mgU+) zDhXYTeN9oext6guk**Q_ssBBvd+&G7_r33T&U?Q1dEaxM?|G~0p>OJ;W!18~KG7yC zYh`!CzB{imyfB3Sai*@^18ssa6ax7Z26kf%0HS-qCHDZFw{x(st7qfyZrGU$&-)jLYwOO?f-R>lkHGn*gwAU_QU-sKmkzstQJc~8Dp*;hjhv@E z00=Z1{CD|ry`_&Y`&P=#;%#1sDZ;p&&t<1JY=O~Rh8SAmG-b(O*uma&7J++bqzgEMk)DD{nk+&PL-}Ifn zLL7_cUz?RQj7L&qS`&;+IySp~)Z-s1k$o@B3>2SgpFF*shzesY-S5NmR3yez%gYnv z>s^@?7s&vcOXi+1bGgn&W#fd0gA2zRjp+;{>c`}&=P~&Rkd+j&Qf_|E>xBEQb*s>~ z-ekD^ zgkx|I;l#(Dop(->8G+p`KBa%S6&%Jf1D9uJ`P4t-w69(Uki6#!`iolORJqqVgRyUR zrS;Z&1kF}uRw^^vP3eY!wJBEA70H{0qJyn2_(0U?b@i8Gt1W3`erM{6Mz+GePqpN_ z+gs2iPcmFHSEdZ|*gX~~bJ0!CNqe_Aaz9FREh#aP!gu!LSs@GEszc!?1~XClgaJ*7 zft;nNf?soDH{0}`Ttz0U;@W~+*QRu){FzVJ_$-ebS>WsnSOdWAii3g1m2qB^%&t5h zng@VkYvj83H~TCI%V0Y;)g1mhXShGb&h7GDc(pT?-K(x2PEFlhOz!kJWQk#T;`VqS z)+YZAfThj>gJladH~1_>iz?v${>oXO&LD+EO8o0S zQ-VwqT7$w49bT;JSY!^nXMdnfb7@r!A(;=2JAa!Yu%eCg3lQB zCD#FK!C@i&2N1xjKBc9u*HhtTEk|>ff2lb#AJ9O*4=F(jsri$6^`(;rKB1JvFewbW z@^~j_k!VrVADcFLOwyj;#sAy=N!|5UH|u@7Adn<5Mpqo@v>};} z{Gde?cDXv^30bDWEJ|k=G{aCOCcn*?;P1cCdddD7rJhNib&sa!2@tJjuC%bfh>CBh zGI|+AtU57|-{#ZXm5W333aG;9_P^e4sHvZc8fB!JiYMyg;~524As?M-cbkk9wlk~r2%ZVxlVO2rDgAe;G8AJ3NJr4Y|eRm=wJm?cr6}CNO z`d$U%6*bKR+1Kh({5an(y4$8UPQL#(@4@o3V$4h%$@J!$)VAok*`d##S&9K?^Hqu8hl?bONv+j7^btedjf3eoutvO;8Glr4Rz%9AdE0{a`cC#8)zDSv;>(TSmo#ZZw zFUz}fU3MKFGkJGSNH^tn+;pQ(!|}uSL0p5HSu}O;^)0@u1xq6-R}?WyDyg|9L%rfh zHOv>^JKmbJO)(C?UdPq~T+C^`FqM&SdSB`^(uWMPS(nP@KR{JzTsKy3q4}zIn3A{6 zlufN2rid4BGsP#fvHJC5{-3Fu)>!UN)u?;qs%zo^)kr`skjZto_sQNN>6_;Sv%)1< zVz2UE9>%-Bm(*G)4K*vB0OuE3b!X+?aLOKxiOG#xH zdjLNC$JdEy`=WKJnhw<$3$q4yD~3jWO-s3JYEE%K@?$o5Dj%dcToFaksm#W}OG@a` zkb4**wIavDn4DD8bhg1`f^`nGblNW?`I+G{vAc3U;is6sUXo=8yhrJp%NbpVr{@IP zh2ChdwIl0@4_nLztx}N*))*j(U2m{eFKoyjo3C9DJ3WQOzQ{}e`005thI@xD#d?qS z?T9&OVRKow2|@!cIX1ArQ!J$WAQVCRFj?F@N8Gj{V1M0A||y3m<-V zWM%ok89*mvQBcPY0lfzH+9`n%b|%n{Z7&;Y1YWd{gx=deRX`kx1U(DhB;m#XD}7Si z*mjo0_6`Q;NV38lnaS0R?Mz+V#oufCzXgwwAGNoE*i`G9RdUb-PYr= zM{yPD+YrX&e?a)#{%8?crYFMx^9!9|kfR4o+W_=4K!aZ#O<+Mgt}^IDC6$};w)WE8T- zWXZmJvSmp^HH9dqL@&MPecq?{o^$W-e$Tz<_q*qw^SR$UPJ=w9K_1siGR5c2RX0c; zhB8^E&sBFwvqCwF1Mli&Gt}JlAOO${1&5@K$yS&BgD?Bbc{>G>T&@(SI9_a1;C?ax zjT^mqy5bpcd#;R&6k-x($aWF^UaorhDf(4@2V=HE&luxe(DHPknHDhk=@SRhbm7x^ zeyS@xXkBIFJSr`~?#r;K;8WiucbPQxk12k<+{61Mw;CU&g-=_5p7LLL0`(G$|~kLxS`Hz z^=E0$sRhKU38`;>kxzV&;*byfNJvMmO2t_!JrOSX@TIfbkXf)n4yk4EVwv+38mk{s z$t^h|&NkYAaqO-5c>g!~nl7nph@sW01+}ZgQg)OiT;-6d?*#*1SCTsk?%0q&{Vd%4 z^Q?o|BEptU#1Ux;xU9*a&D(6*h-_du_)6G3|vj5x!Bb!e5YM)v{BQ=yt*l`;( zn^!033cL?v`xrAj>ffWxoBQJ0t1%cClxMCS2izvor2IsVyIf(w(7R!}n!85|tp$O! zYc2~U$Jj6W-yO3fe2>uPo0)Nh_bi7I>`P7^S91o>cB(txbLG>v zMT$KvbeuPgi%-UD6v8LEySmo&#Ti9^O65;;KF{3yy@BWcqor?sV{!u{>I zrVSF-qZT7dtc?&3K_62O@cJ=u#omZaAJtc4oi{7ZXqzIQOU^^BCJSv%oGY7Hcd66# zp-*As2`>kLZ7)v93?JF5V4SNdA-z8Of`4E110gM}amW$QNZ6sVj0ZvePe)}2YbK@a z&Oq*zD_A&@*c;WY>1DWY3#dMyuZKlW8KENqX@mP59B{LHMpurqnVe%5r=i(~`&b_k{ z25D=xSvAkh-WUi%*_pkOv*KFTB^wujNbY`b@8TSRG$k%?_h%ej7AN z93oncWGVU7r$|x~cZi8S7z0A5my;yD2>nY z9L*FZN@yLS3NvOzCnujtbVLd&1gq?=D;43Ju8H66l|h{y zV8$oMgwh^}4Xcu-wvuu}6tL1gSLE0N)x}7Mj}^PmB;~EO%OjK%%21@HM6YkecRvz7 z4s1-B6_dl0&pYb&x?)k^pEDw0X-c^RGQ_iE4Qhz0NSlJJWc-+f+a zmYhvU%k3dw!|iQtBXDhO#1%!EBZTuOcEZQn{I9C=YKJzf zA6GALp&j6I|Fdx`Ix=f1kZiLAb!P730v^NpbVo7+c4?24v7pr#@NOrVdX?8>` zqtX?(#FI%iUuTU!@l%t3t~87csU9#WtKnI*7@PT+1HZanPA6&z-fJqJ-5JRxfK}Yzv_XPg`<@~|ZL`fEERu$~O6ej@Bjb+ From 02e857827d05fb8765e664d206e6a1633f34c093 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 3 Jul 2013 06:26:12 -0700 Subject: [PATCH 042/146] TEMPORARY fix for MCP mapping issue. --- .../entity/boss/BossStatus.java.patch | 11 ++++ .../entity/boss/EntityDragon.java.patch | 57 +++++++++++++++++++ .../entity/boss/EntityWither.java.patch | 46 +++++++++++++++ .../entity/boss/IBossDisplayData.java.patch | 14 +++++ 4 files changed, 128 insertions(+) create mode 100644 patches/minecraft/net/minecraft/entity/boss/BossStatus.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch diff --git a/patches/minecraft/net/minecraft/entity/boss/BossStatus.java.patch b/patches/minecraft/net/minecraft/entity/boss/BossStatus.java.patch new file mode 100644 index 000000000..8968cf85e --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/boss/BossStatus.java.patch @@ -0,0 +1,11 @@ +--- ../src_base/minecraft/net/minecraft/entity/boss/BossStatus.java ++++ ../src_work/minecraft/net/minecraft/entity/boss/BossStatus.java +@@ -13,7 +13,7 @@ + + public static void func_82824_a(IBossDisplayData par0IBossDisplayData, boolean par1) + { +- healthScale = par0IBossDisplayData.func_110183_aJ() / par0IBossDisplayData.getMaxHealth(); ++ healthScale = par0IBossDisplayData.func_110143_aJ() / par0IBossDisplayData.func_110138_aP(); + statusBarLength = 100; + bossName = par0IBossDisplayData.getEntityName(); + field_82825_d = par1; diff --git a/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch b/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch index f8170bdad..c04f282ea 100644 --- a/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch +++ b/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch @@ -1,5 +1,45 @@ --- ../src_base/minecraft/net/minecraft/entity/boss/EntityDragon.java +++ ../src_work/minecraft/net/minecraft/entity/boss/EntityDragon.java +@@ -75,7 +75,7 @@ + { + super(par1World); + this.dragonPartArray = new EntityDragonPart[] {this.dragonPartHead = new EntityDragonPart(this, "head", 6.0F, 6.0F), this.dragonPartBody = new EntityDragonPart(this, "body", 8.0F, 8.0F), this.dragonPartTail1 = new EntityDragonPart(this, "tail", 4.0F, 4.0F), this.dragonPartTail2 = new EntityDragonPart(this, "tail", 4.0F, 4.0F), this.dragonPartTail3 = new EntityDragonPart(this, "tail", 4.0F, 4.0F), this.dragonPartWing1 = new EntityDragonPart(this, "wing", 4.0F, 4.0F), this.dragonPartWing2 = new EntityDragonPart(this, "wing", 4.0F, 4.0F)}; +- this.setEntityHealth(this.getMaxHealth()); ++ this.setEntityHealth(this.func_110138_aP()); + this.setSize(16.0F, 8.0F); + this.noClip = true; + this.isImmuneToFire = true; +@@ -100,7 +100,7 @@ + */ + public double[] getMovementOffsets(int par1, float par2) + { +- if (this.func_110183_aJ() <= 0.0F) ++ if (this.func_110143_aJ() <= 0.0F) + { + par2 = 0.0F; + } +@@ -142,7 +142,7 @@ + this.prevAnimTime = this.animTime; + float f2; + +- if (this.func_110183_aJ() <= 0.0F) ++ if (this.func_110143_aJ() <= 0.0F) + { + f = (this.rand.nextFloat() - 0.5F) * 8.0F; + f1 = (this.rand.nextFloat() - 0.5F) * 4.0F; +@@ -396,9 +396,9 @@ + + this.healingEnderCrystal = null; + } +- else if (this.ticksExisted % 10 == 0 && this.func_110183_aJ() < this.getMaxHealth()) +- { +- this.setEntityHealth(this.func_110183_aJ() + 1.0F); ++ else if (this.ticksExisted % 10 == 0 && this.func_110143_aJ() < this.func_110138_aP()) ++ { ++ this.setEntityHealth(this.func_110143_aJ() + 1.0F); + } + } + @@ -527,10 +527,11 @@ for (int i2 = k; i2 <= j1; ++i2) { @@ -15,3 +55,20 @@ { flag1 = this.worldObj.setBlockToAir(k1, l1, i2) || flag1; } +@@ -753,16 +754,4 @@ + { + return 5.0F; + } +- +- @Override +- public float getMaxHealth() +- { +- return 0.0f; +- } +- +- @Override +- public float func_110183_aJ() +- { +- return 0.0f; +- } + } diff --git a/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch b/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch new file mode 100644 index 000000000..650de20a5 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch @@ -0,0 +1,46 @@ +--- ../src_base/minecraft/net/minecraft/entity/boss/EntityWither.java ++++ ../src_work/minecraft/net/minecraft/entity/boss/EntityWither.java +@@ -45,7 +45,7 @@ + public EntityWither(World par1World) + { + super(par1World); +- this.setEntityHealth(this.getMaxHealth()); ++ this.setEntityHealth(this.func_110138_aP()); + this.setSize(0.9F, 4.0F); + this.isImmuneToFire = true; + this.getNavigator().setCanSwim(true); +@@ -380,7 +380,7 @@ + public void func_82206_m() + { + this.func_82215_s(220); +- this.setEntityHealth(this.getMaxHealth() / 3.0F); ++ this.setEntityHealth(this.func_110138_aP() / 3.0F); + } + + /** +@@ -633,7 +633,7 @@ + */ + public boolean isArmored() + { +- return this.func_110183_aJ() <= this.getMaxHealth() / 2.0F; ++ return this.func_110143_aJ() <= this.func_110138_aP() / 2.0F; + } + + /** +@@ -651,16 +651,4 @@ + { + this.ridingEntity = null; + } +- +- @Override +- public float getMaxHealth() +- { +- return 0.0f; +- } +- +- @Override +- public float func_110183_aJ() +- { +- return 0.0f; +- } + } diff --git a/patches/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch b/patches/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch new file mode 100644 index 000000000..84b1f677e --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch @@ -0,0 +1,14 @@ +--- ../src_base/minecraft/net/minecraft/entity/boss/IBossDisplayData.java ++++ ../src_work/minecraft/net/minecraft/entity/boss/IBossDisplayData.java +@@ -2,9 +2,9 @@ + + public interface IBossDisplayData + { +- float getMaxHealth(); ++ float func_110138_aP(); + +- float func_110183_aJ(); ++ float func_110143_aJ(); + + /** + * Gets the username of the entity. From f9236c4c9816da5ebfad37688595c1b3734b2793 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 3 Jul 2013 06:26:47 -0700 Subject: [PATCH 043/146] Include MANIFEST file from FML's universal.jar, makes the jar runnable now! --- MANIFEST.MF | 6 ------ release.py | 12 ++++++++++++ 2 files changed, 12 insertions(+), 6 deletions(-) delete mode 100644 MANIFEST.MF diff --git a/MANIFEST.MF b/MANIFEST.MF deleted file mode 100644 index fab265cb7..000000000 --- a/MANIFEST.MF +++ /dev/null @@ -1,6 +0,0 @@ -Manifest-Version: 1.0 -Ant-Version: Apache Ant 1.8.2 -Created-By: 1.7.0_09-b30 (Oracle Corporation) -Main-Class: net.minecraft.server.MinecraftServer -Class-Path: minecraft_server.jar - diff --git a/release.py b/release.py index 516833e94..31d6bb012 100644 --- a/release.py +++ b/release.py @@ -70,6 +70,15 @@ def main(): zf.extractall(temp_dir) zf.close() + if os.path.isfile('MANIFEST.MF'): + os.remove('MANIFEST.MF') + + fml_name = os.path.basename(fml[0]).replace('src', 'universal').replace('.zip', '.jar').replace('-master.', '.') + print('Extracting %s MANIFEST.MF' % fml_name) + with closing(zipfile.ZipFile(os.path.join(forge_dir, 'fml', 'target', fml_name), mode='r')) as zip_in: + with closing(open('MANIFEST.MF', 'wb')) as out: + out.write(zip_in.read('META-INF/MANIFEST.MF')) + error_level = 0 try: sys.path.append(mcp_dir) @@ -83,6 +92,7 @@ def main(): print 'Reobfusicate Exception: %d ' % e.code error_level = e.code + extract_fml_obfed(fml_dir, mcp_dir, reobf_dir, client_dir) #extract_paulscode(mcp_dir, client_dir) gen_bin_patches(mcp_dir, os.path.join(forge_dir, 'fml'), build_num, client_dir) @@ -173,6 +183,8 @@ def main(): if os.path.exists(version_file): os.remove(version_file) shutil.rmtree(temp_dir) + if os.path.isfile('MANIFEST.MF'): + os.remove('MANIFEST.MF') print '=================================== Release Finished %d =================================' % error_level sys.exit(error_level) From 125b134d873492c15cc4fc91159551237005c7b0 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 3 Jul 2013 18:54:41 -0700 Subject: [PATCH 044/146] Updated FML: MinecraftForge/FML@155e8468180c93f1886a64028628764b1b22dd58 Add in support for mods/ as a mod location. Also drop coremods as a location. They go in mods too now. MinecraftForge/FML@3f4bf61ae6757605b27078c7321de9f640876836 Update key MinecraftForge/FML@4545beb49d5348d8632e42965627b9837115525b Add deobf-data to setup env. MinecraftForge/FML@e24f94951741709329208f738000b72933302a24 Fix eclipse workspaces and launch configurations. MinecraftForge/FML@532bee7ce1c4392ee11f0389d98f0c2be6240aa0 Update to new MCP bugfix version, Fixes: Missing Armor/Item rendering, and Boss health mapping issues. --- .gitignore | 1 + .../client/GuiControlsScrollPanel.java | 2 +- .../net/minecraftforge/common/FakePlayer.java | 2 +- fml | 2 +- .../client/gui/GuiControls.java.patch | 2 +- .../minecraft/client/gui/GuiSlot.java.patch | 4 +- .../gui/inventory/GuiContainer.java.patch | 8 +-- .../inventory/GuiContainerCreative.java.patch | 4 +- .../client/renderer/ItemRenderer.java.patch | 4 +- .../renderer/entity/RenderBiped.java.patch | 2 +- .../renderer/entity/RenderItem.java.patch | 12 ++-- .../renderer/entity/RenderManager.java.patch | 2 +- .../renderer/entity/RenderPlayer.java.patch | 38 ++++++------- .../entity/RendererLivingEntity.java.patch | 8 +-- .../renderer/texture/Stitcher.java.patch | 2 +- .../entity/boss/BossStatus.java.patch | 11 ---- .../entity/boss/EntityDragon.java.patch | 57 ------------------- .../entity/boss/EntityWither.java.patch | 46 --------------- .../entity/boss/IBossDisplayData.java.patch | 14 ----- .../entity/player/EntityPlayerMP.java.patch | 5 +- submodule_changlog.py | 4 +- 21 files changed, 52 insertions(+), 178 deletions(-) delete mode 100644 patches/minecraft/net/minecraft/entity/boss/BossStatus.java.patch delete mode 100644 patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch delete mode 100644 patches/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch diff --git a/.gitignore b/.gitignore index d421b4b09..b2054a98e 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ /mcp/ /eclipse/ /target/ +/temp/ diff --git a/client/net/minecraftforge/client/GuiControlsScrollPanel.java b/client/net/minecraftforge/client/GuiControlsScrollPanel.java index ec3276564..793830243 100644 --- a/client/net/minecraftforge/client/GuiControlsScrollPanel.java +++ b/client/net/minecraftforge/client/GuiControlsScrollPanel.java @@ -63,7 +63,7 @@ public class GuiControlsScrollPanel extends GuiSlot } @Override - protected void func_130003_c() {} + protected void drawBackground() {} @Override public void drawScreen(int mX, int mY, float f) diff --git a/common/net/minecraftforge/common/FakePlayer.java b/common/net/minecraftforge/common/FakePlayer.java index 91b60a33f..1d462593f 100644 --- a/common/net/minecraftforge/common/FakePlayer.java +++ b/common/net/minecraftforge/common/FakePlayer.java @@ -21,5 +21,5 @@ public class FakePlayer extends EntityPlayer } @Override - public void func_110122_a(ChatMessageComponent chatmessagecomponent){} + public void sendChatToPlayer(ChatMessageComponent chatmessagecomponent){} } diff --git a/fml b/fml index ba3707af2..532bee7ce 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit ba3707af22376f8f18103f63db56e4614a9c37db +Subproject commit 532bee7ce1c4392ee11f0389d98f0c2be6240aa0 diff --git a/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch index 42e3b8844..5123e8f65 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiControls.java.patch @@ -32,7 +32,7 @@ - this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, I18n.func_135053_a("gui.done"))); + scrollPane = new GuiControlsScrollPanel(this, options, mc); + this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height - 28, I18n.func_135053_a("gui.done"))); -+ scrollPane.func_110509_d(7, 8); ++ scrollPane.registerScrollButtons(7, 8); this.screenTitle = I18n.func_135053_a("controls.title"); } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch index 44c5abcf6..06b4ff689 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/client/gui/GuiSlot.java +++ ../src_work/minecraft/net/minecraft/client/gui/GuiSlot.java -@@ -325,16 +325,7 @@ +@@ -331,16 +331,7 @@ GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_FOG); Tessellator tessellator = Tessellator.instance; @@ -18,7 +18,7 @@ j1 = this.width / 2 - 92 - 16; k1 = this.top + 4 - (int)this.amountScrolled; -@@ -478,4 +469,18 @@ +@@ -484,4 +475,18 @@ tessellator.addVertexWithUV(0.0D, (double)par1, 0.0D, 0.0D, (double)((float)par1 / f)); tessellator.draw(); } diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch index 4e1d227d0..404817911 100644 --- a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch @@ -24,13 +24,13 @@ GL11.glTranslatef(0.0F, 0.0F, 32.0F); this.zLevel = 200.0F; itemRenderer.zLevel = 200.0F; -- itemRenderer.func_110797_b(this.fontRenderer, this.mc.func_110434_K(), par1ItemStack, par2, par3); -- itemRenderer.func_110793_a(this.fontRenderer, this.mc.func_110434_K(), par1ItemStack, par2, par3 - (this.draggedStack == null ? 0 : 8), par4Str); +- itemRenderer.renderItemAndEffectIntoGUI(this.fontRenderer, this.mc.func_110434_K(), par1ItemStack, par2, par3); +- itemRenderer.renderItemOverlayIntoGUI(this.fontRenderer, this.mc.func_110434_K(), par1ItemStack, par2, par3 - (this.draggedStack == null ? 0 : 8), par4Str); + FontRenderer font = null; + if (par1ItemStack != null) font = par1ItemStack.getItem().getFontRenderer(par1ItemStack); + if (font == null) font = fontRenderer; -+ itemRenderer.func_110797_b(font, this.mc.func_110434_K(), par1ItemStack, par2, par3); -+ itemRenderer.func_110793_a(font, this.mc.func_110434_K(), par1ItemStack, par2, par3 - (this.draggedStack == null ? 0 : 8), par4Str); ++ itemRenderer.renderItemAndEffectIntoGUI(font, this.mc.func_110434_K(), par1ItemStack, par2, par3); ++ itemRenderer.renderItemOverlayIntoGUI(font, this.mc.func_110434_K(), par1ItemStack, par2, par3 - (this.draggedStack == null ? 0 : 8), par4Str); this.zLevel = 0.0F; itemRenderer.zLevel = 0.0F; } diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch index 8ec560c7f..851230189 100644 --- a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch @@ -196,8 +196,8 @@ GL11.glEnable(GL12.GL_RESCALE_NORMAL); - ItemStack itemstack = new ItemStack(par1CreativeTabs.getTabIconItem()); + ItemStack itemstack = par1CreativeTabs.getIconItemStack(); - itemRenderer.func_110797_b(this.fontRenderer, this.mc.func_110434_K(), itemstack, l, i1); - itemRenderer.func_110794_c(this.fontRenderer, this.mc.func_110434_K(), itemstack, l, i1); + itemRenderer.renderItemAndEffectIntoGUI(this.fontRenderer, this.mc.func_110434_K(), itemstack, l, i1); + itemRenderer.renderItemOverlayIntoGUI(this.fontRenderer, this.mc.func_110434_K(), itemstack, l, i1); GL11.glDisable(GL11.GL_LIGHTING); @@ -912,6 +984,15 @@ { diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch index 253e17709..bead0da71 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch @@ -75,7 +75,7 @@ - - if (mapdata != null) - { -- this.mapItemRenderer.func_111275_a(this.mc.thePlayer, this.mc.func_110434_K(), mapdata); +- this.mapItemRenderer.renderMap(this.mc.thePlayer, this.mc.func_110434_K(), mapdata); + + IItemRenderer custom = MinecraftForgeClient.getItemRenderer(itemstack, FIRST_PERSON_MAP); + MapData mapdata = ((ItemMap)itemstack.getItem()).getMapData(itemstack, this.mc.theWorld); @@ -84,7 +84,7 @@ + { + if (mapdata != null) + { -+ this.mapItemRenderer.func_111275_a(this.mc.thePlayer, this.mc.func_110434_K(), mapdata); ++ this.mapItemRenderer.renderMap(this.mc.thePlayer, this.mc.func_110434_K(), mapdata); + } + } + else diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch index 0a66ac622..db7476538 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch @@ -99,7 +99,7 @@ if (item instanceof ItemArmor) { - this.func_110776_a(func_110858_a((ItemArmor)item, par2, "overlay")); -+ this.func_110776_a(getArmorResource(par1EntityLiving, itemstack, par2, "overlay")); ++ this.func_110776_a(getArmorResource(par1, itemstack, par2, "overlay")); float f1 = 1.0F; GL11.glColor3f(f1, f1, f1); } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch index 30fa5a333..55442a7cb 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch @@ -124,7 +124,7 @@ { this.func_110776_a(TextureMap.field_110575_b); } -@@ -353,10 +338,10 @@ +@@ -356,10 +341,10 @@ float f1; float f2; @@ -137,7 +137,7 @@ GL11.glPushMatrix(); GL11.glTranslatef((float)(par4 - 2), (float)(par5 + 3), -3.0F + this.zLevel); GL11.glScalef(10.0F, 10.0F, 10.0F); -@@ -383,11 +368,11 @@ +@@ -386,11 +371,11 @@ else if (Item.itemsList[k].requiresMultipleRenderPasses()) { GL11.glDisable(GL11.GL_LIGHTING); @@ -154,19 +154,19 @@ int k1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, j1); f1 = (float)(k1 >> 16 & 255) / 255.0F; f2 = (float)(k1 >> 8 & 255) / 255.0F; -@@ -435,7 +420,10 @@ +@@ -441,7 +426,10 @@ { if (par3ItemStack != null) { -- this.func_110795_a(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5); +- this.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5); + if (!ForgeHooksClient.renderInventoryItem(renderBlocks, par2TextureManager, par3ItemStack, renderWithColor, zLevel, (float)par4, (float)par5)) + { -+ this.func_110795_a(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5); ++ this.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5); + } if (par3ItemStack.hasEffect()) { -@@ -573,4 +561,47 @@ +@@ -583,4 +571,47 @@ { this.doRenderItem((EntityItem)par1Entity, par2, par4, par6, par8, par9); } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch index e749a29d6..d24e1117b 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/entity/RenderManager.java +++ ../src_work/minecraft/net/minecraft/client/renderer/entity/RenderManager.java -@@ -224,12 +224,14 @@ +@@ -223,12 +223,14 @@ if (par4EntityLivingBase.isPlayerSleeping()) { diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch index 247739af0..4c02a8ce7 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch @@ -17,7 +17,7 @@ @SideOnly(Side.CLIENT) public class RenderPlayer extends RendererLivingEntity -@@ -43,6 +52,13 @@ +@@ -46,6 +55,13 @@ { ItemStack itemstack = par1AbstractClientPlayer.inventory.armorItemInSlot(3 - par2); @@ -31,7 +31,7 @@ if (itemstack != null) { Item item = itemstack.getItem(); -@@ -50,7 +66,7 @@ +@@ -53,7 +69,7 @@ if (item instanceof ItemArmor) { ItemArmor itemarmor = (ItemArmor)item; @@ -40,7 +40,7 @@ ModelBiped modelbiped = par2 == 2 ? this.modelArmor : this.modelArmorChestplate; modelbiped.bipedHead.showModel = par2 == 0; modelbiped.bipedHeadwear.showModel = par2 == 0; -@@ -59,15 +75,17 @@ +@@ -62,15 +78,17 @@ modelbiped.bipedLeftArm.showModel = par2 == 1; modelbiped.bipedRightLeg.showModel = par2 == 2 || par2 == 3; modelbiped.bipedLeftLeg.showModel = par2 == 2 || par2 == 3; @@ -61,34 +61,34 @@ float f2 = (float)(j >> 16 & 255) / 255.0F; float f3 = (float)(j >> 8 & 255) / 255.0F; float f4 = (float)(j & 255) / 255.0F; -@@ -105,7 +123,7 @@ +@@ -108,7 +126,7 @@ if (item instanceof ItemArmor) { - this.func_110776_a(RenderBiped.func_110858_a((ItemArmor)item, par2, "overlay")); -+ this.func_110776_a(RenderBiped.getArmorResource(par1AbstractClientPlayer, itemstack, par2, "overlay")); ++ this.func_110776_a(RenderBiped.getArmorResource(par1, itemstack, par2, "overlay")); float f1 = 1.0F; GL11.glColor3f(f1, f1, f1); } -@@ -114,6 +132,7 @@ +@@ -117,6 +135,7 @@ - public void func_110819_a(AbstractClientPlayer par1AbstractClientPlayer, double par2, double par4, double par6, float par8, float par9) + public void renderPlayer(AbstractClientPlayer par1, double par2, double par4, double par6, float par8, float par9) { -+ if (MinecraftForge.EVENT_BUS.post(new RenderPlayerEvent.Pre(par1AbstractClientPlayer, this))) return; ++ if (MinecraftForge.EVENT_BUS.post(new RenderPlayerEvent.Pre(par1, this))) return; float f2 = 1.0F; GL11.glColor3f(f2, f2, f2); - ItemStack itemstack = par1AbstractClientPlayer.inventory.getCurrentItem(); -@@ -145,6 +164,7 @@ + ItemStack itemstack = par1.inventory.getCurrentItem(); +@@ -148,6 +167,7 @@ this.modelArmorChestplate.aimedBow = this.modelArmor.aimedBow = this.modelBipedMain.aimedBow = false; this.modelArmorChestplate.isSneak = this.modelArmor.isSneak = this.modelBipedMain.isSneak = false; this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = 0; -+ MinecraftForge.EVENT_BUS.post(new RenderPlayerEvent.Post(par1AbstractClientPlayer, this)); ++ MinecraftForge.EVENT_BUS.post(new RenderPlayerEvent.Post(par1, this)); } protected ResourceLocation func_110817_a(AbstractClientPlayer par1AbstractClientPlayer) -@@ -154,21 +174,30 @@ - - protected void func_110820_a(AbstractClientPlayer par1AbstractClientPlayer, float par2) +@@ -160,21 +180,30 @@ + */ + protected void renderSpecials(AbstractClientPlayer par1AbstractClientPlayer, float par2) { + RenderPlayerEvent.Specials.Pre event = new RenderPlayerEvent.Specials.Pre(par1AbstractClientPlayer, this, par2); + if (MinecraftForge.EVENT_BUS.post(event)) @@ -121,7 +121,7 @@ { f2 = 0.625F; GL11.glTranslatef(0.0F, -0.25F, 0.0F); -@@ -220,6 +249,7 @@ +@@ -226,6 +255,7 @@ boolean flag = par1AbstractClientPlayer.func_110310_o().func_110557_a(); boolean flag1 = !par1AbstractClientPlayer.isInvisible(); boolean flag2 = !par1AbstractClientPlayer.getHideCape(); @@ -129,7 +129,7 @@ float f6; if (flag && flag1 && flag2) -@@ -271,7 +301,7 @@ +@@ -277,7 +307,7 @@ ItemStack itemstack1 = par1AbstractClientPlayer.inventory.getCurrentItem(); @@ -138,7 +138,7 @@ { GL11.glPushMatrix(); this.modelBipedMain.bipedRightArm.postRender(0.0625F); -@@ -291,7 +321,11 @@ +@@ -297,7 +327,11 @@ float f11; @@ -151,7 +151,7 @@ { f11 = 0.5F; GL11.glTranslatef(0.0F, 0.1875F, -0.3125F); -@@ -348,7 +382,7 @@ +@@ -354,7 +388,7 @@ if (itemstack1.getItem().requiresMultipleRenderPasses()) { @@ -160,7 +160,7 @@ { int k = itemstack1.getItem().getColorFromItemStack(itemstack1, j); f13 = (float)(k >> 16 & 255) / 255.0F; -@@ -370,6 +404,7 @@ +@@ -376,6 +410,7 @@ GL11.glPopMatrix(); } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch index da943a9c2..3fad37302 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch @@ -20,9 +20,9 @@ public RendererLivingEntity(ModelBase par1ModelBase, float par2) { -@@ -439,12 +445,13 @@ - - protected void func_130008_a(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6) +@@ -442,12 +448,13 @@ + */ + protected void passSpecialRender(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6) { + if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Specials.Pre(par1EntityLivingBase, this))) return; if (this.func_110813_b(par1EntityLivingBase)) @@ -35,7 +35,7 @@ if (d3 < (double)(f2 * f2)) { -@@ -488,6 +495,7 @@ +@@ -491,6 +498,7 @@ } } } diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch index d67c90cbb..4a095b302 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/texture/Stitcher.java +++ ../src_work/minecraft/net/minecraft/client/renderer/texture/Stitcher.java -@@ -184,7 +184,7 @@ +@@ -186,7 +186,7 @@ if (flag4 ^ flag5) { diff --git a/patches/minecraft/net/minecraft/entity/boss/BossStatus.java.patch b/patches/minecraft/net/minecraft/entity/boss/BossStatus.java.patch deleted file mode 100644 index 8968cf85e..000000000 --- a/patches/minecraft/net/minecraft/entity/boss/BossStatus.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src_base/minecraft/net/minecraft/entity/boss/BossStatus.java -+++ ../src_work/minecraft/net/minecraft/entity/boss/BossStatus.java -@@ -13,7 +13,7 @@ - - public static void func_82824_a(IBossDisplayData par0IBossDisplayData, boolean par1) - { -- healthScale = par0IBossDisplayData.func_110183_aJ() / par0IBossDisplayData.getMaxHealth(); -+ healthScale = par0IBossDisplayData.func_110143_aJ() / par0IBossDisplayData.func_110138_aP(); - statusBarLength = 100; - bossName = par0IBossDisplayData.getEntityName(); - field_82825_d = par1; diff --git a/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch b/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch index c04f282ea..f8170bdad 100644 --- a/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch +++ b/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch @@ -1,45 +1,5 @@ --- ../src_base/minecraft/net/minecraft/entity/boss/EntityDragon.java +++ ../src_work/minecraft/net/minecraft/entity/boss/EntityDragon.java -@@ -75,7 +75,7 @@ - { - super(par1World); - this.dragonPartArray = new EntityDragonPart[] {this.dragonPartHead = new EntityDragonPart(this, "head", 6.0F, 6.0F), this.dragonPartBody = new EntityDragonPart(this, "body", 8.0F, 8.0F), this.dragonPartTail1 = new EntityDragonPart(this, "tail", 4.0F, 4.0F), this.dragonPartTail2 = new EntityDragonPart(this, "tail", 4.0F, 4.0F), this.dragonPartTail3 = new EntityDragonPart(this, "tail", 4.0F, 4.0F), this.dragonPartWing1 = new EntityDragonPart(this, "wing", 4.0F, 4.0F), this.dragonPartWing2 = new EntityDragonPart(this, "wing", 4.0F, 4.0F)}; -- this.setEntityHealth(this.getMaxHealth()); -+ this.setEntityHealth(this.func_110138_aP()); - this.setSize(16.0F, 8.0F); - this.noClip = true; - this.isImmuneToFire = true; -@@ -100,7 +100,7 @@ - */ - public double[] getMovementOffsets(int par1, float par2) - { -- if (this.func_110183_aJ() <= 0.0F) -+ if (this.func_110143_aJ() <= 0.0F) - { - par2 = 0.0F; - } -@@ -142,7 +142,7 @@ - this.prevAnimTime = this.animTime; - float f2; - -- if (this.func_110183_aJ() <= 0.0F) -+ if (this.func_110143_aJ() <= 0.0F) - { - f = (this.rand.nextFloat() - 0.5F) * 8.0F; - f1 = (this.rand.nextFloat() - 0.5F) * 4.0F; -@@ -396,9 +396,9 @@ - - this.healingEnderCrystal = null; - } -- else if (this.ticksExisted % 10 == 0 && this.func_110183_aJ() < this.getMaxHealth()) -- { -- this.setEntityHealth(this.func_110183_aJ() + 1.0F); -+ else if (this.ticksExisted % 10 == 0 && this.func_110143_aJ() < this.func_110138_aP()) -+ { -+ this.setEntityHealth(this.func_110143_aJ() + 1.0F); - } - } - @@ -527,10 +527,11 @@ for (int i2 = k; i2 <= j1; ++i2) { @@ -55,20 +15,3 @@ { flag1 = this.worldObj.setBlockToAir(k1, l1, i2) || flag1; } -@@ -753,16 +754,4 @@ - { - return 5.0F; - } -- -- @Override -- public float getMaxHealth() -- { -- return 0.0f; -- } -- -- @Override -- public float func_110183_aJ() -- { -- return 0.0f; -- } - } diff --git a/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch b/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch deleted file mode 100644 index 650de20a5..000000000 --- a/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch +++ /dev/null @@ -1,46 +0,0 @@ ---- ../src_base/minecraft/net/minecraft/entity/boss/EntityWither.java -+++ ../src_work/minecraft/net/minecraft/entity/boss/EntityWither.java -@@ -45,7 +45,7 @@ - public EntityWither(World par1World) - { - super(par1World); -- this.setEntityHealth(this.getMaxHealth()); -+ this.setEntityHealth(this.func_110138_aP()); - this.setSize(0.9F, 4.0F); - this.isImmuneToFire = true; - this.getNavigator().setCanSwim(true); -@@ -380,7 +380,7 @@ - public void func_82206_m() - { - this.func_82215_s(220); -- this.setEntityHealth(this.getMaxHealth() / 3.0F); -+ this.setEntityHealth(this.func_110138_aP() / 3.0F); - } - - /** -@@ -633,7 +633,7 @@ - */ - public boolean isArmored() - { -- return this.func_110183_aJ() <= this.getMaxHealth() / 2.0F; -+ return this.func_110143_aJ() <= this.func_110138_aP() / 2.0F; - } - - /** -@@ -651,16 +651,4 @@ - { - this.ridingEntity = null; - } -- -- @Override -- public float getMaxHealth() -- { -- return 0.0f; -- } -- -- @Override -- public float func_110183_aJ() -- { -- return 0.0f; -- } - } diff --git a/patches/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch b/patches/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch deleted file mode 100644 index 84b1f677e..000000000 --- a/patches/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../src_base/minecraft/net/minecraft/entity/boss/IBossDisplayData.java -+++ ../src_work/minecraft/net/minecraft/entity/boss/IBossDisplayData.java -@@ -2,9 +2,9 @@ - - public interface IBossDisplayData - { -- float getMaxHealth(); -+ float func_110138_aP(); - -- float func_110183_aJ(); -+ float func_110143_aJ(); - - /** - * Gets the username of the entity. diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch index 23d515ab1..42c1ddec7 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch @@ -53,12 +53,12 @@ } } } -@@ -375,11 +377,24 @@ +@@ -375,11 +377,25 @@ */ public void onDeath(DamageSource par1DamageSource) { + if (ForgeHooks.onLivingDeath(this, par1DamageSource)) return; - this.mcServer.getConfigurationManager().func_110460_a(this.func_110142_aN().func_111182_b()); + this.mcServer.getConfigurationManager().sendChatMsg(this.func_110142_aN().func_94546_b()); if (!this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) { @@ -66,6 +66,7 @@ + capturedDrops.clear(); + this.inventory.dropAllItems(); ++ + captureDrops = false; + PlayerDropsEvent event = new PlayerDropsEvent(this, par1DamageSource, capturedDrops, recentlyHit > 0); + if (!MinecraftForge.EVENT_BUS.post(event)) diff --git a/submodule_changlog.py b/submodule_changlog.py index e81fb1300..73063a6f0 100644 --- a/submodule_changlog.py +++ b/submodule_changlog.py @@ -35,8 +35,8 @@ def main(options, args): print('Could not extract start and end range') sys.exit(1) - print('Start: %s' % start) - print('End: %s' % end) + #print('Start: %s' % start) + #print('End: %s' % end) output = run_command(['git', 'log', '--reverse', '--pretty=oneline', '%s...%s' % (start, end)], './fml') print('Updated FML:') From 68ba3a84d6c83cef3f3435ff2156e1114bf6d423 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 3 Jul 2013 19:31:31 -0700 Subject: [PATCH 045/146] Updated FML: MinecraftForge/FML@7ce84491d1d4eada442944e02fc0e50c51f8045c Fix missing argument and startclient/startserver support. --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index 532bee7ce..7ce84491d 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 532bee7ce1c4392ee11f0389d98f0c2be6240aa0 +Subproject commit 7ce84491d1d4eada442944e02fc0e50c51f8045c From 7f5ec0eaef40a307699e71aa20faea4d1b443c6c Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 3 Jul 2013 19:31:54 -0700 Subject: [PATCH 046/146] Fix domain issue with SoundPool entries. --- .../client/ForgeHooksClient.java | 21 ++++++++++++++++ .../client/audio/SoundPool.java.patch | 20 +++++++++++++++ .../renderer/texture/TextureMap.java.patch | 25 ++----------------- 3 files changed, 43 insertions(+), 23 deletions(-) create mode 100644 patches/minecraft/net/minecraft/client/audio/SoundPool.java.patch diff --git a/client/net/minecraftforge/client/ForgeHooksClient.java b/client/net/minecraftforge/client/ForgeHooksClient.java index 91319b407..34c83d765 100644 --- a/client/net/minecraftforge/client/ForgeHooksClient.java +++ b/client/net/minecraftforge/client/ForgeHooksClient.java @@ -283,4 +283,25 @@ public class ForgeHooksClient stencilBits = 0; } } + + //This properly moves the domain, if provided, to the front of the string before concatenating + public static String fixDomain(String base, String complex) + { + int idx = complex.indexOf(':'); + if (idx == -1) + { + return base + complex; + } + + String name = complex.substring(idx + 1, complex.length()); + if (idx > 1) + { + String domain = complex.substring(0, idx); + return domain + ':' + base + name; + } + else + { + return base + name; + } + } } diff --git a/patches/minecraft/net/minecraft/client/audio/SoundPool.java.patch b/patches/minecraft/net/minecraft/client/audio/SoundPool.java.patch new file mode 100644 index 000000000..456e957e2 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/audio/SoundPool.java.patch @@ -0,0 +1,20 @@ +--- ../src_base/minecraft/net/minecraft/client/audio/SoundPool.java ++++ ../src_work/minecraft/net/minecraft/client/audio/SoundPool.java +@@ -11,6 +11,7 @@ + import java.util.Map; + import java.util.Random; + import net.minecraft.client.resources.ResourceManager; ++import net.minecraftforge.client.ForgeHooksClient; + + @SideOnly(Side.CLIENT) + public class SoundPool +@@ -71,7 +72,8 @@ + + private URL func_110654_c(String par1Str) throws MalformedURLException + { +- return new URL((URL)null, "minecraft:" + this.field_110656_d + "/" + par1Str, new SoundPoolProtocolHandler(this)); ++ String path = ForgeHooksClient.fixDomain(field_110656_d + "/", par1Str); ++ return new URL((URL)null, "minecraft:" + path, new SoundPoolProtocolHandler(this)); + } + + /** diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch index 1ac144655..8ccfa7629 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -21,7 +21,7 @@ String s = (String)entry.getKey(); TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)entry.getValue(); - ResourceLocation resourcelocation = new ResourceLocation(this.basePath + s + ".png"); -+ ResourceLocation resourcelocation = new ResourceLocation(fixDomain(basePath, s) + ".png"); ++ ResourceLocation resourcelocation = new ResourceLocation(ForgeHooksClient.fixDomain(basePath, s) + ".png"); try { @@ -49,7 +49,7 @@ } Object object = (TextureAtlasSprite)this.field_110574_e.get(par1Str); -@@ -253,4 +260,58 @@ +@@ -253,4 +260,37 @@ { this.updateAnimations(); } @@ -85,26 +85,5 @@ + return true; + } + return false; -+ } -+ -+ //This properly moves the domain, if provided, to the front of the string before concatenating -+ private String fixDomain(String base, String complex) -+ { -+ int idx = complex.indexOf(':'); -+ if (idx == -1) -+ { -+ return base + complex; -+ } -+ -+ String name = complex.substring(idx + 1, complex.length()); -+ if (idx > 1) -+ { -+ String domain = complex.substring(0, idx); -+ return domain + ':' + base + name; -+ } -+ else -+ { -+ return base + name; -+ } + } } From d4ba95f6069ca2a241f664a12b237f57e8acb29a Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 3 Jul 2013 20:29:41 -0700 Subject: [PATCH 047/146] Add hook for EntityWither trying to destroy a block. --- .../net/minecraft/block/Block.java.patch | 45 ++++++++++++------- .../entity/boss/EntityDragon.java.patch | 2 +- .../entity/boss/EntityWither.java.patch | 12 +++++ 3 files changed, 43 insertions(+), 16 deletions(-) create mode 100644 patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index ad842c06b..0e43329d8 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/block/Block.java +++ ../src_work/minecraft/net/minecraft/block/Block.java -@@ -1,15 +1,20 @@ +@@ -1,15 +1,22 @@ package net.minecraft.block; -import cpw.mods.fml.relauncher.Side; @@ -20,10 +20,12 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.EnumCreatureType; ++import net.minecraft.entity.boss.EntityDragon; ++import net.minecraft.entity.boss.EntityWither; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityXPOrb; import net.minecraft.entity.player.EntityPlayer; -@@ -26,8 +31,10 @@ +@@ -26,8 +33,10 @@ import net.minecraft.item.ItemSnow; import net.minecraft.item.ItemStack; import net.minecraft.stats.StatList; @@ -34,7 +36,7 @@ import net.minecraft.util.Icon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.StatCollector; -@@ -35,9 +42,19 @@ +@@ -35,9 +44,19 @@ import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -54,7 +56,7 @@ /** * used as foreach item, if item.tab = current tab, display it on the screen */ -@@ -460,9 +477,10 @@ +@@ -460,9 +479,10 @@ return this.needsRandomTick; } @@ -66,7 +68,7 @@ } /** -@@ -485,7 +503,7 @@ +@@ -485,7 +505,7 @@ */ public float getBlockBrightness(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { @@ -75,7 +77,7 @@ } @SideOnly(Side.CLIENT) -@@ -495,7 +513,7 @@ +@@ -495,7 +515,7 @@ */ public int getMixedBrightnessForBlock(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { @@ -84,7 +86,7 @@ } @SideOnly(Side.CLIENT) -@@ -645,7 +663,13 @@ +@@ -645,7 +665,13 @@ /** * ejects contained items into the world, and notifies neighbours of an update, as appropriate */ @@ -99,7 +101,7 @@ /** * Returns the quantity of items to drop on block destruction. -@@ -670,7 +694,7 @@ +@@ -670,7 +696,7 @@ public float getPlayerRelativeBlockHardness(EntityPlayer par1EntityPlayer, World par2World, int par3, int par4, int par5) { float f = this.getBlockHardness(par2World, par3, par4, par5); @@ -108,7 +110,7 @@ } /** -@@ -688,18 +712,13 @@ +@@ -688,18 +714,13 @@ { if (!par1World.isRemote) { @@ -131,7 +133,7 @@ } } } -@@ -932,7 +951,8 @@ +@@ -932,7 +953,8 @@ public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) { int l = par1World.getBlockId(par2, par3, par4); @@ -141,7 +143,7 @@ } /** -@@ -1092,7 +1112,7 @@ +@@ -1092,7 +1114,7 @@ par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); par2EntityPlayer.addExhaustion(0.025F); @@ -150,7 +152,7 @@ { ItemStack itemstack = this.createStackedBlock(par6); -@@ -1108,12 +1128,13 @@ +@@ -1108,12 +1130,13 @@ } } @@ -165,7 +167,7 @@ } /** -@@ -1453,4 +1474,939 @@ +@@ -1453,4 +1476,952 @@ canBlockGrass[0] = true; StatList.initBreakableStats(); } @@ -1006,8 +1008,7 @@ + } + + /** -+ * Determines if this block is destroyed when a ender dragon tries to fly through it. -+ * The block will be set to 0, nothing will drop. ++ * Determines if this block is can be destroyed by the specified entities normal behavior. + * + * @param world The current world + * @param x X Position @@ -1015,6 +1016,20 @@ + * @param z Z position + * @return True to allow the ender dragon to destroy this block + */ ++ public boolean canEntityDestroy(World world, int x, int y, int z, Entity entity) ++ { ++ if (entity instanceof EntityWither) ++ { ++ return blockID != Block.bedrock.blockID && blockID != Block.endPortal.blockID && blockID != Block.endPortalFrame.blockID; ++ } ++ else if (entity instanceof EntityDragon) ++ { ++ return canDragonDestroy(world, x, y, z); ++ } ++ ++ return true; ++ } ++ @Deprecated + public boolean canDragonDestroy(World world, int x, int y, int z) + { + return blockID != obsidian.blockID && blockID != whiteStone.blockID && blockID != bedrock.blockID; diff --git a/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch b/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch index f8170bdad..1adbe8327 100644 --- a/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch +++ b/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch @@ -11,7 +11,7 @@ + if (block != null) { - if (j2 != Block.obsidian.blockID && j2 != Block.whiteStone.blockID && j2 != Block.bedrock.blockID && this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) -+ if (block.canDragonDestroy(worldObj, k1, l1, i2) && this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) ++ if (block.canEntityDestroy(worldObj, k1, l1, i2, this) && this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) { flag1 = this.worldObj.setBlockToAir(k1, l1, i2) || flag1; } diff --git a/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch b/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch new file mode 100644 index 000000000..1808b3220 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch @@ -0,0 +1,12 @@ +--- ../src_base/minecraft/net/minecraft/entity/boss/EntityWither.java ++++ ../src_work/minecraft/net/minecraft/entity/boss/EntityWither.java +@@ -355,7 +355,8 @@ + int l2 = j1 + l1; + int i3 = this.worldObj.getBlockId(j2, k2, l2); + +- if (i3 > 0 && i3 != Block.bedrock.blockID && i3 != Block.endPortal.blockID && i3 != Block.endPortalFrame.blockID) ++ Block block = Block.blocksList[i3]; ++ if (block != null && block.canEntityDestroy(worldObj, j2, k2, l2, this)) + { + flag = this.worldObj.destroyBlock(j2, k2, l2, true) || flag; + } From 2b588ebce606228709f050014562ec81c0baecf0 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 3 Jul 2013 20:41:27 -0700 Subject: [PATCH 048/146] Fix lether item rendering colors. --- .../net/minecraft/client/renderer/entity/RenderItem.java.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch index 55442a7cb..6fb4bf098 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch @@ -148,7 +148,7 @@ - Icon icon = Item.itemsList[k].getIconFromDamageForRenderPass(l, j1); + par2TextureManager.func_110577_a(par3ItemStack.getItemSpriteNumber() == 0 ? TextureMap.field_110575_b : TextureMap.field_110576_c); + -+ for (int j1 = 0; j1 <= Item.itemsList[k].getRenderPasses(l); ++j1) ++ for (int j1 = 0; j1 < Item.itemsList[k].getRenderPasses(l); ++j1) + { + Icon icon = Item.itemsList[k].getIcon(par3ItemStack, j1); int k1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, j1); From 98aab2083b9326005f1377a3c517cab8c0421da7 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 3 Jul 2013 21:14:59 -0700 Subject: [PATCH 049/146] Render pass sensitive version of Item.hasEffect, Closes #517 --- .../client/ForgeHooksClient.java | 7 ++ .../client/renderer/ItemRenderer.java.patch | 9 ++ .../renderer/entity/RenderItem.java.patch | 97 +++++++++++++++++-- .../net/minecraft/item/Item.java.patch | 22 ++++- .../net/minecraft/item/ItemStack.java.patch | 18 ++++ 5 files changed, 143 insertions(+), 10 deletions(-) diff --git a/client/net/minecraftforge/client/ForgeHooksClient.java b/client/net/minecraftforge/client/ForgeHooksClient.java index 34c83d765..55d2cde35 100644 --- a/client/net/minecraftforge/client/ForgeHooksClient.java +++ b/client/net/minecraftforge/client/ForgeHooksClient.java @@ -33,6 +33,7 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.resources.ResourceLocation; import net.minecraftforge.client.IItemRenderer.ItemRenderType; import net.minecraftforge.client.event.DrawBlockHighlightEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; @@ -43,6 +44,7 @@ import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.*; public class ForgeHooksClient { + private static final ResourceLocation ITEM_GLINT = new ResourceLocation("textures/misc/enchanted_item_glint.png"); static TextureManager engine() { return FMLClientHandler.instance().getClient().renderEngine; @@ -166,9 +168,14 @@ public class ForgeHooksClient GL11.glPopMatrix(); GL11.glEnable(GL11.GL_LIGHTING); } + return true; } + public static void renderEffectOverlay(TextureManager manager, RenderItem render) + { + } + public static void renderEquippedItem(ItemRenderType type, IItemRenderer customRenderer, RenderBlocks renderBlocks, EntityLivingBase entity, ItemStack item) { if (customRenderer.shouldUseRenderHelper(type, item, EQUIPPED_BLOCK)) diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch index bead0da71..ecb571232 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch @@ -58,6 +58,15 @@ { texturemanager.func_110577_a(texturemanager.func_130087_a(0)); this.renderBlocksInstance.renderBlockAsItem(Block.blocksList[par2ItemStack.itemID], par2ItemStack.getItemDamage(), 1.0F); +@@ -94,7 +120,7 @@ + GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F); + renderItemIn2D(tessellator, f1, f2, f, f3, icon.getOriginX(), icon.getOriginY(), 0.0625F); + +- if (par2ItemStack.hasEffect() && par3 == 0) ++ if (par2ItemStack.hasEffect(par3)) + { + GL11.glDepthFunc(GL11.GL_EQUAL); + GL11.glDisable(GL11.GL_LIGHTING); @@ -266,7 +292,7 @@ Render render; RenderPlayer renderplayer; diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch index 6fb4bf098..0dfa50699 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch @@ -76,7 +76,32 @@ f8 = 1.0F; if (this.renderWithColor) -@@ -240,32 +231,26 @@ +@@ -152,11 +143,11 @@ + f4 = (float)(i >> 8 & 255) / 255.0F; + f6 = (float)(i & 255) / 255.0F; + GL11.glColor4f(f5 * f8, f4 * f8, f6 * f8, 1.0F); +- this.renderDroppedItem(par1EntityItem, icon, b0, par9, f5 * f8, f4 * f8, f6 * f8); ++ this.renderDroppedItem(par1EntityItem, icon, b0, par9, f5 * f8, f4 * f8, f6 * f8, k); + } + else + { +- this.renderDroppedItem(par1EntityItem, icon, b0, par9, 1.0F, 1.0F, 1.0F); ++ this.renderDroppedItem(par1EntityItem, icon, b0, par9, 1.0F, 1.0F, 1.0F, k); + } + } + } +@@ -204,6 +195,10 @@ + * Renders a dropped item + */ + private void renderDroppedItem(EntityItem par1EntityItem, Icon par2Icon, int par3, float par4, float par5, float par6, float par7) ++ { ++ renderDroppedItem(par1EntityItem, par2Icon, par3, par4, par5, par6, par7, 0); ++ } ++ private void renderDroppedItem(EntityItem par1EntityItem, Icon par2Icon, int par3, float par4, float par5, float par6, float par7, int pass) + { + Tessellator tessellator = Tessellator.instance; + +@@ -240,32 +235,26 @@ f11 = 0.021875F; ItemStack itemstack = par1EntityItem.getEntityItem(); int j = itemstack.stackSize; @@ -124,7 +149,27 @@ { this.func_110776_a(TextureMap.field_110575_b); } -@@ -356,10 +341,10 @@ +@@ -277,7 +266,7 @@ + GL11.glColor4f(par5, par6, par7, 1.0F); + ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, ((Icon)par2Icon).getOriginX(), ((Icon)par2Icon).getOriginY(), f12); + +- if (itemstack.hasEffect()) ++ if (itemstack.hasEffect(pass)) + { + GL11.glDepthFunc(GL11.GL_EQUAL); + GL11.glDisable(GL11.GL_LIGHTING); +@@ -348,6 +337,10 @@ + */ + public void renderItemIntoGUI(FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5) + { ++ renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, false); ++ } ++ public void renderItemIntoGUI(FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5, boolean renderEffect) ++ { + int k = par3ItemStack.itemID; + int l = par3ItemStack.getItemDamage(); + Object object = par3ItemStack.getIconIndex(); +@@ -356,10 +349,10 @@ float f1; float f2; @@ -137,7 +182,7 @@ GL11.glPushMatrix(); GL11.glTranslatef((float)(par4 - 2), (float)(par5 + 3), -3.0F + this.zLevel); GL11.glScalef(10.0F, 10.0F, 10.0F); -@@ -386,11 +371,11 @@ +@@ -386,11 +379,11 @@ else if (Item.itemsList[k].requiresMultipleRenderPasses()) { GL11.glDisable(GL11.GL_LIGHTING); @@ -146,27 +191,63 @@ - for (int j1 = 0; j1 <= 1; ++j1) - { - Icon icon = Item.itemsList[k].getIconFromDamageForRenderPass(l, j1); -+ par2TextureManager.func_110577_a(par3ItemStack.getItemSpriteNumber() == 0 ? TextureMap.field_110575_b : TextureMap.field_110576_c); + + for (int j1 = 0; j1 < Item.itemsList[k].getRenderPasses(l); ++j1) + { ++ par2TextureManager.func_110577_a(par3ItemStack.getItemSpriteNumber() == 0 ? TextureMap.field_110575_b : TextureMap.field_110576_c); + Icon icon = Item.itemsList[k].getIcon(par3ItemStack, j1); int k1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, j1); f1 = (float)(k1 >> 16 & 255) / 255.0F; f2 = (float)(k1 >> 8 & 255) / 255.0F; -@@ -441,7 +426,10 @@ +@@ -402,6 +395,24 @@ + } + + this.renderIcon(par4, par5, icon, 16, 16); ++ ++ if (par3ItemStack.hasEffect(j1)) ++ { ++ GL11.glDepthFunc(GL11.GL_GREATER); ++ GL11.glDisable(GL11.GL_LIGHTING); ++ GL11.glDepthMask(false); ++ par2TextureManager.func_110577_a(field_110798_h); ++ this.zLevel -= 50.0F; ++ GL11.glEnable(GL11.GL_BLEND); ++ GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR); ++ GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F); ++ this.renderGlint(par4 * 431278612 + par5 * 32178161, par4 - 2, par5 - 2, 20, 20); ++ GL11.glDisable(GL11.GL_BLEND); ++ GL11.glDepthMask(true); ++ this.zLevel += 50.0F; ++ GL11.glEnable(GL11.GL_LIGHTING); ++ GL11.glDepthFunc(GL11.GL_LEQUAL); ++ } + } + + GL11.glEnable(GL11.GL_LIGHTING); +@@ -441,8 +452,12 @@ { if (par3ItemStack != null) { - this.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5); +- + if (!ForgeHooksClient.renderInventoryItem(renderBlocks, par2TextureManager, par3ItemStack, renderWithColor, zLevel, (float)par4, (float)par5)) + { -+ this.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5); ++ this.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, true); + } - ++ ++ /* Modders must handle this themselves if they use custom renderers! if (par3ItemStack.hasEffect()) { -@@ -583,4 +571,47 @@ + GL11.glDepthFunc(GL11.GL_GREATER); +@@ -460,6 +475,7 @@ + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glDepthFunc(GL11.GL_LEQUAL); + } ++ */ + } + } + +@@ -583,4 +599,47 @@ { this.doRenderItem((EntityItem)par1Entity, par2, par4, par6, par8, par9); } diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches/minecraft/net/minecraft/item/Item.java.patch index bfab3f36c..9f9f13587 100644 --- a/patches/minecraft/net/minecraft/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -47,7 +47,15 @@ } itemsList[256 + par1] = this; -@@ -639,6 +649,10 @@ +@@ -600,6 +610,7 @@ + } + + @SideOnly(Side.CLIENT) ++ @Deprecated //Render pass sensitive version below. + public boolean hasEffect(ItemStack par1ItemStack) + { + return par1ItemStack.isItemEnchanted(); +@@ -639,6 +650,10 @@ float f7 = f4 * f5; float f8 = f3 * f5; double d3 = 5.0D; @@ -58,7 +66,7 @@ Vec3 vec31 = vec3.addVector((double)f7 * d3, (double)f6 * d3, (double)f8 * d3); return par1World.rayTraceBlocks_do_do(vec3, vec31, par3, !par3); } -@@ -736,4 +750,504 @@ +@@ -736,4 +751,514 @@ { StatList.initStats(); } @@ -561,5 +569,15 @@ + public boolean canHarvestBlock(Block par1Block, ItemStack itemStack) + { + return canHarvestBlock(par1Block); ++ } ++ ++ ++ /** ++ * Render Pass sensitive version of hasEffect() ++ */ ++ @SideOnly(Side.CLIENT) ++ public boolean hasEffect(ItemStack par1ItemStack, int pass) ++ { ++ return hasEffect(par1ItemStack) && (pass == 0 || itemID != Item.potion.itemID); + } } diff --git a/patches/minecraft/net/minecraft/item/ItemStack.java.patch b/patches/minecraft/net/minecraft/item/ItemStack.java.patch index a9b7b1a56..0a0f0f63f 100644 --- a/patches/minecraft/net/minecraft/item/ItemStack.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemStack.java.patch @@ -75,3 +75,21 @@ } public boolean func_111282_a(EntityPlayer par1EntityPlayer, EntityLivingBase par2EntityLivingBase) +@@ -737,10 +753,16 @@ + return arraylist; + } + ++ @Deprecated + @SideOnly(Side.CLIENT) + public boolean hasEffect() + { +- return this.getItem().hasEffect(this); ++ return hasEffect(0); ++ } ++ @SideOnly(Side.CLIENT) ++ public boolean hasEffect(int pass) ++ { ++ return this.getItem().hasEffect(this, pass); + } + + @SideOnly(Side.CLIENT) From b12872eed1d66d4f8e50191808db2f60a7414ac0 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 3 Jul 2013 21:34:49 -0700 Subject: [PATCH 050/146] Fix compile errors temporarily, dont use till updated to new system. --- client/net/minecraftforge/client/model/techne/TechneModel.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/net/minecraftforge/client/model/techne/TechneModel.java b/client/net/minecraftforge/client/model/techne/TechneModel.java index 09d48410e..66a32aa9b 100644 --- a/client/net/minecraftforge/client/model/techne/TechneModel.java +++ b/client/net/minecraftforge/client/model/techne/TechneModel.java @@ -35,7 +35,6 @@ import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; -import net.minecraft.client.renderer.RenderEngine; import net.minecraftforge.client.model.IModelCustom; import net.minecraftforge.client.model.ModelFormatException; @@ -235,6 +234,7 @@ public class TechneModel extends ModelBase implements IModelCustom { private void bindTexture() { + /* TODO: Update to 1.6 if (texture != null) { if (!textureNameSet) @@ -267,6 +267,7 @@ public class TechneModel extends ModelBase implements IModelCustom { Minecraft.getMinecraft().renderEngine.resetBoundTexture(); } } + */ } @Override From be14c33ed127de82d7837f5560a430d206322fe8 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 3 Jul 2013 21:48:51 -0700 Subject: [PATCH 051/146] Add missing air checks to WorldGenTrees and ChunkCache Closes #593 --- .../net/minecraft/world/ChunkCache.java.patch | 11 +++++ .../gen/feature/WorldGenTrees.java.patch | 45 ++++++++++++++++--- 2 files changed, 49 insertions(+), 7 deletions(-) diff --git a/patches/minecraft/net/minecraft/world/ChunkCache.java.patch b/patches/minecraft/net/minecraft/world/ChunkCache.java.patch index b88c07db1..8bf965f66 100644 --- a/patches/minecraft/net/minecraft/world/ChunkCache.java.patch +++ b/patches/minecraft/net/minecraft/world/ChunkCache.java.patch @@ -49,6 +49,17 @@ } /** +@@ -325,8 +338,8 @@ + */ + public boolean isAirBlock(int par1, int par2, int par3) + { +- Block block = Block.blocksList[this.getBlockId(par1, par2, par3)]; +- return block == null; ++ int id = getBlockId(par1, par2, par3); ++ return id == 0 || Block.blocksList[id] == null || Block.blocksList[id].isAirBlock(this.worldObj, par1, par2, par3); + } + + @SideOnly(Side.CLIENT) @@ -449,4 +462,22 @@ int i1 = this.getBlockId(par1, par2, par3); return i1 == 0 ? 0 : Block.blocksList[i1].isProvidingStrongPower(this, par1, par2, par3, par4); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch index 24939b8d2..8eb716c3b 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch @@ -11,14 +11,15 @@ public class WorldGenTrees extends WorldGenerator { -@@ -67,7 +69,13 @@ +@@ -67,7 +69,14 @@ { k1 = par1World.getBlockId(l1, i1, j1); - if (k1 != 0 && k1 != Block.leaves.blockID && k1 != Block.grass.blockID && k1 != Block.dirt.blockID && k1 != Block.wood.blockID) + Block block = Block.blocksList[k1]; ++ boolean isAir = par1World.isAirBlock(l1, i1, j1); + -+ if (k1 != 0 && ++ if (!isAir && + !block.isLeaves(par1World, l1, i1, j1) && + k1 != Block.grass.blockID && + k1 != Block.dirt.blockID && @@ -26,7 +27,7 @@ { flag = false; } -@@ -87,10 +95,12 @@ +@@ -87,10 +96,12 @@ else { i1 = par1World.getBlockId(par3, par4 - 1, par5); @@ -43,7 +44,7 @@ b0 = 3; byte b1 = 0; int i2; -@@ -113,8 +123,9 @@ +@@ -113,8 +124,9 @@ if (Math.abs(k2) != i2 || Math.abs(i3) != i2 || par2Random.nextInt(2) != 0 && k1 != 0) { int j3 = par1World.getBlockId(j2, j1, l2); @@ -55,7 +56,7 @@ { this.setBlockAndMetadata(par1World, j2, j1, l2, Block.leaves.blockID, this.metaLeaves); } -@@ -127,7 +138,9 @@ +@@ -127,7 +139,9 @@ { k1 = par1World.getBlockId(par3, par4 + j1, par5); @@ -66,7 +67,7 @@ { this.setBlockAndMetadata(par1World, par3, par4 + j1, par5, Block.wood.blockID, this.metaWood); -@@ -167,7 +180,8 @@ +@@ -167,24 +181,25 @@ { for (k2 = par5 - i2; k2 <= par5 + i2; ++k2) { @@ -74,5 +75,35 @@ + Block block = Block.blocksList[par1World.getBlockId(j2, j1, k2)]; + if (block != null && block.isLeaves(par1World, j2, j1, k2)) { - if (par2Random.nextInt(4) == 0 && par1World.getBlockId(j2 - 1, j1, k2) == 0) +- if (par2Random.nextInt(4) == 0 && par1World.getBlockId(j2 - 1, j1, k2) == 0) ++ if (par2Random.nextInt(4) == 0 && par1World.isAirBlock(j2 - 1, j1, k2)) { + this.growVines(par1World, j2 - 1, j1, k2, 8); + } + +- if (par2Random.nextInt(4) == 0 && par1World.getBlockId(j2 + 1, j1, k2) == 0) ++ if (par2Random.nextInt(4) == 0 && par1World.isAirBlock(j2 + 1, j1, k2)) + { + this.growVines(par1World, j2 + 1, j1, k2, 2); + } + +- if (par2Random.nextInt(4) == 0 && par1World.getBlockId(j2, j1, k2 - 1) == 0) ++ if (par2Random.nextInt(4) == 0 && par1World.isAirBlock(j2, j1, k2 - 1)) + { + this.growVines(par1World, j2, j1, k2 - 1, 1); + } + +- if (par2Random.nextInt(4) == 0 && par1World.getBlockId(j2, j1, k2 + 1) == 0) ++ if (par2Random.nextInt(4) == 0 && par1World.isAirBlock(j2, j1, k2 + 1)) + { + this.growVines(par1World, j2, j1, k2 + 1, 4); + } +@@ -235,7 +250,7 @@ + { + --par3; + +- if (par1World.getBlockId(par2, par3, par4) != 0 || i1 <= 0) ++ if (!par1World.isAirBlock(par2, par3, par4) || i1 <= 0) + { + return; + } From 33ec5cdc44015a4ad29e7dc174875a634483fa0f Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 3 Jul 2013 22:29:42 -0700 Subject: [PATCH 052/146] Updated FML: MinecraftForge/FML@54e06e841d1c8df24fc30e1ec3a51def67f58858 Move Resource refreshing until affter postInit. --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index 7ce84491d..54e06e841 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 7ce84491d1d4eada442944e02fc0e50c51f8045c +Subproject commit 54e06e841d1c8df24fc30e1ec3a51def67f58858 From e9f1c83ff86bc7f51ea083e2bafaf5427692e1a5 Mon Sep 17 00:00:00 2001 From: LexManos Date: Thu, 4 Jul 2013 12:39:49 -0700 Subject: [PATCH 053/146] Mark old liquid system as deperated to be removed next Minecraft release. --- common/net/minecraftforge/liquids/IBlockLiquid.java | 1 + common/net/minecraftforge/liquids/ILiquid.java | 1 + common/net/minecraftforge/liquids/ILiquidTank.java | 1 + common/net/minecraftforge/liquids/ITankContainer.java | 2 +- common/net/minecraftforge/liquids/LiquidContainerData.java | 2 +- common/net/minecraftforge/liquids/LiquidContainerRegistry.java | 2 +- common/net/minecraftforge/liquids/LiquidDictionary.java | 1 + common/net/minecraftforge/liquids/LiquidEvent.java | 2 +- common/net/minecraftforge/liquids/LiquidStack.java | 1 + common/net/minecraftforge/liquids/LiquidTank.java | 1 + 10 files changed, 10 insertions(+), 4 deletions(-) diff --git a/common/net/minecraftforge/liquids/IBlockLiquid.java b/common/net/minecraftforge/liquids/IBlockLiquid.java index 5be422419..9569e6bd5 100644 --- a/common/net/minecraftforge/liquids/IBlockLiquid.java +++ b/common/net/minecraftforge/liquids/IBlockLiquid.java @@ -8,6 +8,7 @@ import net.minecraft.nbt.NBTTagCompound; * @author cpw * */ +@Deprecated //See new net.minecraftforge.fluids public interface IBlockLiquid extends ILiquid { /** * Controls the type of block that is generated by this IBlockLiquid diff --git a/common/net/minecraftforge/liquids/ILiquid.java b/common/net/minecraftforge/liquids/ILiquid.java index 91a8286ac..f7943b2ff 100644 --- a/common/net/minecraftforge/liquids/ILiquid.java +++ b/common/net/minecraftforge/liquids/ILiquid.java @@ -13,6 +13,7 @@ package net.minecraftforge.liquids; * Liquids implement this interface * */ +@Deprecated //See new net.minecraftforge.fluids public interface ILiquid { /** diff --git a/common/net/minecraftforge/liquids/ILiquidTank.java b/common/net/minecraftforge/liquids/ILiquidTank.java index 7c195d6b4..7bbb4c6d2 100644 --- a/common/net/minecraftforge/liquids/ILiquidTank.java +++ b/common/net/minecraftforge/liquids/ILiquidTank.java @@ -5,6 +5,7 @@ package net.minecraftforge.liquids; * * @author cpw */ +@Deprecated //See new net.minecraftforge.fluids public interface ILiquidTank { /** diff --git a/common/net/minecraftforge/liquids/ITankContainer.java b/common/net/minecraftforge/liquids/ITankContainer.java index 992d0e1fe..d9ace05ce 100644 --- a/common/net/minecraftforge/liquids/ITankContainer.java +++ b/common/net/minecraftforge/liquids/ITankContainer.java @@ -1,7 +1,7 @@ package net.minecraftforge.liquids; import net.minecraftforge.common.ForgeDirection; - +@Deprecated //See new net.minecraftforge.fluids public interface ITankContainer { /** diff --git a/common/net/minecraftforge/liquids/LiquidContainerData.java b/common/net/minecraftforge/liquids/LiquidContainerData.java index 4df6d6713..3b9e2fbc9 100644 --- a/common/net/minecraftforge/liquids/LiquidContainerData.java +++ b/common/net/minecraftforge/liquids/LiquidContainerData.java @@ -11,7 +11,7 @@ package net.minecraftforge.liquids; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; - +@Deprecated //See new net.minecraftforge.fluids public class LiquidContainerData { public final LiquidStack stillLiquid; diff --git a/common/net/minecraftforge/liquids/LiquidContainerRegistry.java b/common/net/minecraftforge/liquids/LiquidContainerRegistry.java index d539fb05d..ea4b5de8e 100644 --- a/common/net/minecraftforge/liquids/LiquidContainerRegistry.java +++ b/common/net/minecraftforge/liquids/LiquidContainerRegistry.java @@ -12,7 +12,7 @@ import java.util.Set; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; - +@Deprecated //See new net.minecraftforge.fluids public class LiquidContainerRegistry { public static final int BUCKET_VOLUME = 1000; diff --git a/common/net/minecraftforge/liquids/LiquidDictionary.java b/common/net/minecraftforge/liquids/LiquidDictionary.java index e0644b683..a7a5925af 100644 --- a/common/net/minecraftforge/liquids/LiquidDictionary.java +++ b/common/net/minecraftforge/liquids/LiquidDictionary.java @@ -16,6 +16,7 @@ import com.google.common.collect.ImmutableMap; * * @author CovertJaguar */ +@Deprecated //See new net.minecraftforge.fluids public abstract class LiquidDictionary { diff --git a/common/net/minecraftforge/liquids/LiquidEvent.java b/common/net/minecraftforge/liquids/LiquidEvent.java index 2c2ac7eec..1667f54a3 100644 --- a/common/net/minecraftforge/liquids/LiquidEvent.java +++ b/common/net/minecraftforge/liquids/LiquidEvent.java @@ -4,7 +4,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.Event; - +@Deprecated //See new net.minecraftforge.fluids public class LiquidEvent extends Event { public final LiquidStack liquid; public final int x; diff --git a/common/net/minecraftforge/liquids/LiquidStack.java b/common/net/minecraftforge/liquids/LiquidStack.java index c641c6cfd..881a10b6a 100644 --- a/common/net/minecraftforge/liquids/LiquidStack.java +++ b/common/net/minecraftforge/liquids/LiquidStack.java @@ -22,6 +22,7 @@ import net.minecraft.util.Icon; * * @author SirSengir */ +@Deprecated //See new net.minecraftforge.fluids public class LiquidStack { public final int itemID; diff --git a/common/net/minecraftforge/liquids/LiquidTank.java b/common/net/minecraftforge/liquids/LiquidTank.java index b9ed153b4..6832ef695 100644 --- a/common/net/minecraftforge/liquids/LiquidTank.java +++ b/common/net/minecraftforge/liquids/LiquidTank.java @@ -6,6 +6,7 @@ import net.minecraft.tileentity.TileEntity; /** * Reference implementation of ILiquidTank. Use this or implement your own. */ +@Deprecated //See new net.minecraftforge.fluids public class LiquidTank implements ILiquidTank { private LiquidStack liquid; private int capacity; From 22be4b49d52fac60717e1c624345e91f397acf5a Mon Sep 17 00:00:00 2001 From: LexManos Date: Fri, 5 Jul 2013 16:55:42 -0700 Subject: [PATCH 054/146] Fix enchantment effect on single pass items. Closes #644 --- .../renderer/entity/RenderItem.java.patch | 57 +++++++++++++------ 1 file changed, 39 insertions(+), 18 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch index 0dfa50699..55fa0f85e 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch @@ -199,32 +199,53 @@ int k1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, j1); f1 = (float)(k1 >> 16 & 255) / 255.0F; f2 = (float)(k1 >> 8 & 255) / 255.0F; -@@ -402,6 +395,24 @@ +@@ -402,6 +395,11 @@ } this.renderIcon(par4, par5, icon, 16, 16); + + if (par3ItemStack.hasEffect(j1)) + { -+ GL11.glDepthFunc(GL11.GL_GREATER); -+ GL11.glDisable(GL11.GL_LIGHTING); -+ GL11.glDepthMask(false); -+ par2TextureManager.func_110577_a(field_110798_h); -+ this.zLevel -= 50.0F; -+ GL11.glEnable(GL11.GL_BLEND); -+ GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR); -+ GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F); -+ this.renderGlint(par4 * 431278612 + par5 * 32178161, par4 - 2, par5 - 2, 20, 20); -+ GL11.glDisable(GL11.GL_BLEND); -+ GL11.glDepthMask(true); -+ this.zLevel += 50.0F; -+ GL11.glEnable(GL11.GL_LIGHTING); -+ GL11.glDepthFunc(GL11.GL_LEQUAL); ++ renderEffect(par2TextureManager, par4, par5); + } } GL11.glEnable(GL11.GL_LIGHTING); -@@ -441,8 +452,12 @@ +@@ -429,10 +427,33 @@ + + this.renderIcon(par4, par5, (Icon)object, 16, 16); + GL11.glEnable(GL11.GL_LIGHTING); ++ ++ if (par3ItemStack.hasEffect(0)) ++ { ++ renderEffect(par2TextureManager, par4, par5); ++ } + } + + GL11.glEnable(GL11.GL_CULL_FACE); + } ++ ++ private void renderEffect(TextureManager manager, int x, int y) ++ { ++ GL11.glDepthFunc(GL11.GL_GREATER); ++ GL11.glDisable(GL11.GL_LIGHTING); ++ GL11.glDepthMask(false); ++ manager.func_110577_a(field_110798_h); ++ this.zLevel -= 50.0F; ++ GL11.glEnable(GL11.GL_BLEND); ++ GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR); ++ GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F); ++ this.renderGlint(x * 431278612 + y * 32178161, x - 2, y - 2, 20, 20); ++ GL11.glDisable(GL11.GL_BLEND); ++ GL11.glDepthMask(true); ++ this.zLevel += 50.0F; ++ GL11.glEnable(GL11.GL_LIGHTING); ++ GL11.glDepthFunc(GL11.GL_LEQUAL); ++ } + + /** + * Render the item's icon or block into the GUI, including the glint effect. +@@ -441,8 +462,12 @@ { if (par3ItemStack != null) { @@ -239,7 +260,7 @@ if (par3ItemStack.hasEffect()) { GL11.glDepthFunc(GL11.GL_GREATER); -@@ -460,6 +475,7 @@ +@@ -460,6 +485,7 @@ GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } @@ -247,7 +268,7 @@ } } -@@ -583,4 +599,47 @@ +@@ -583,4 +609,47 @@ { this.doRenderItem((EntityItem)par1Entity, par2, par4, par6, par8, par9); } From dfc26937ca172e1c432a6ac8d31ac120cf9af120 Mon Sep 17 00:00:00 2001 From: LexManos Date: Fri, 5 Jul 2013 22:50:55 -0700 Subject: [PATCH 055/146] Re-gather list of Icons when atlas textures are stitched, allows for addition/removal of blocks/items after the atlas's inital constrction. --- .../renderer/texture/TextureMap.java.patch | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch index 8ccfa7629..4731005d1 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -8,7 +8,13 @@ @SideOnly(Side.CLIENT) public class TextureMap extends AbstractTexture implements TickableTextureObject, IconRegister -@@ -62,6 +63,7 @@ +@@ -58,10 +59,13 @@ + + public void func_110571_b(ResourceManager par1ResourceManager) + { ++ func_110573_f(); //Re-gather list of Icons, allows for addition/removal of blocks/items after this map was inital constrcuted. ++ + int i = Minecraft.getGLMaximumTextureSize(); Stitcher stitcher = new Stitcher(i, i, true); this.mapTexturesStiched.clear(); this.listTextureStiched.clear(); @@ -16,7 +22,7 @@ Iterator iterator = this.field_110574_e.entrySet().iterator(); while (iterator.hasNext()) -@@ -69,11 +71,14 @@ +@@ -69,11 +73,14 @@ Entry entry = (Entry)iterator.next(); String s = (String)entry.getKey(); TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)entry.getValue(); @@ -33,7 +39,7 @@ } catch (RuntimeException runtimeexception) { -@@ -142,6 +147,7 @@ +@@ -142,6 +149,7 @@ textureatlassprite1 = (TextureAtlasSprite)iterator1.next(); textureatlassprite1.copyFrom(this.missingImage); } @@ -41,7 +47,7 @@ } private void func_110573_f() -@@ -212,6 +218,7 @@ +@@ -212,6 +220,7 @@ if (par1Str == null) { (new RuntimeException("Don\'t register null!")).printStackTrace(); @@ -49,7 +55,7 @@ } Object object = (TextureAtlasSprite)this.field_110574_e.get(par1Str); -@@ -253,4 +260,37 @@ +@@ -253,4 +262,37 @@ { this.updateAnimations(); } From 5f203ce8089bf8284dc6d736c0b1b64fb6327063 Mon Sep 17 00:00:00 2001 From: XCompWiz Date: Sat, 6 Jul 2013 15:39:28 +0300 Subject: [PATCH 056/146] Makes player-specific spawnpoints dimension aware Makes ServerConfigurationManager correctly get player-specific spawn point for the target dimension Changes EntityPlayer to store and save a (bed) spawn point for every dimension, as well as transfer them to respawn "clones" --- .../entity/player/EntityPlayer.java.patch | 210 +++++++++++++++--- .../ServerConfigurationManager.java.patch | 11 +- 2 files changed, 193 insertions(+), 28 deletions(-) diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch index 582b79133..7e9ccb2ac 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -1,6 +1,18 @@ --- ../src_base/minecraft/net/minecraft/entity/player/EntityPlayer.java +++ ../src_work/minecraft/net/minecraft/entity/player/EntityPlayer.java -@@ -68,8 +68,21 @@ +@@ -5,8 +5,11 @@ + import cpw.mods.fml.relauncher.Side; + import cpw.mods.fml.relauncher.SideOnly; + import java.util.Collection; ++import java.util.HashMap; + import java.util.Iterator; + import java.util.List; ++import java.util.Map.Entry; ++ + import net.minecraft.block.Block; + import net.minecraft.block.BlockBed; + import net.minecraft.block.material.Material; +@@ -68,8 +71,21 @@ import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; @@ -22,7 +34,21 @@ /** Inventory of the player */ public InventoryPlayer inventory = new InventoryPlayer(this); private InventoryEnderChest theInventoryEnderChest = new InventoryEnderChest(); -@@ -269,6 +282,7 @@ +@@ -122,11 +138,13 @@ + * Holds the last coordinate to spawn based on last bed that the player sleep. + */ + private ChunkCoordinates spawnChunk; ++ private HashMap spawnChunkMap = new HashMap(); + + /** + * Whether this player's spawn point is forced, preventing execution of bed checks. + */ + private boolean spawnForced; ++ private HashMap spawnForcedMap = new HashMap(); + + /** Holds the coordinate of the player when enter a minecraft to ride. */ + private ChunkCoordinates startMinecartRidingCoordinate; +@@ -269,6 +287,7 @@ if (itemstack == this.itemInUse) { @@ -30,7 +56,7 @@ if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0) { this.updateItemUse(itemstack, 5); -@@ -539,11 +553,11 @@ +@@ -539,11 +558,11 @@ this.cameraYaw = 0.0F; this.addMountedMovementStat(this.posX - d0, this.posY - d1, this.posZ - d2); @@ -44,7 +70,7 @@ } } } -@@ -686,11 +700,15 @@ +@@ -686,11 +705,15 @@ */ public void onDeath(DamageSource par1DamageSource) { @@ -60,7 +86,7 @@ if (this.username.equals("Notch")) { this.dropPlayerItemWithRandomChoice(new ItemStack(Item.appleRed, 1), true); -@@ -699,6 +717,20 @@ +@@ -699,6 +722,20 @@ if (!this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) { this.inventory.dropAllItems(); @@ -81,7 +107,7 @@ } if (par1DamageSource != null) -@@ -749,7 +781,20 @@ +@@ -749,7 +786,20 @@ */ public EntityItem dropOneItem(boolean par1) { @@ -103,7 +129,7 @@ } /** -@@ -758,7 +803,7 @@ +@@ -758,7 +808,7 @@ */ public EntityItem dropPlayerItem(ItemStack par1ItemStack) { @@ -112,7 +138,7 @@ } /** -@@ -814,15 +859,28 @@ +@@ -814,15 +864,28 @@ */ public void joinEntityItemWithWorld(EntityItem par1EntityItem) { @@ -143,7 +169,7 @@ if (f > 1.0F) { -@@ -833,7 +891,9 @@ +@@ -833,7 +896,9 @@ { float f1 = (float)(i * i + 1); @@ -154,7 +180,7 @@ { f += f1 * 0.08F; } -@@ -864,7 +924,8 @@ +@@ -864,7 +929,8 @@ f /= 5.0F; } @@ -164,7 +190,7 @@ } /** -@@ -872,7 +933,7 @@ +@@ -872,7 +938,7 @@ */ public boolean canHarvestBlock(Block par1Block) { @@ -173,7 +199,44 @@ } /** -@@ -982,6 +1043,7 @@ +@@ -902,6 +968,14 @@ + this.spawnChunk = new ChunkCoordinates(par1NBTTagCompound.getInteger("SpawnX"), par1NBTTagCompound.getInteger("SpawnY"), par1NBTTagCompound.getInteger("SpawnZ")); + this.spawnForced = par1NBTTagCompound.getBoolean("SpawnForced"); + } ++ NBTTagList spawnlist = null; ++ spawnlist = par1NBTTagCompound.getTagList("Spawns"); ++ for (int i = 0; i < spawnlist.tagCount(); ++i) { ++ NBTTagCompound spawndata = (NBTTagCompound)spawnlist.tagAt(i); ++ int spawndim = spawndata.getInteger("Dim"); ++ this.spawnChunkMap.put(spawndim, new ChunkCoordinates(spawndata.getInteger("SpawnX"), spawndata.getInteger("SpawnY"), spawndata.getInteger("SpawnZ"))); ++ this.spawnForcedMap.put(spawndim, spawndata.getBoolean("SpawnForced")); ++ } + + this.foodStats.readNBT(par1NBTTagCompound); + this.capabilities.readCapabilitiesFromNBT(par1NBTTagCompound); +@@ -935,6 +1009,21 @@ + par1NBTTagCompound.setInteger("SpawnZ", this.spawnChunk.posZ); + par1NBTTagCompound.setBoolean("SpawnForced", this.spawnForced); + } ++ NBTTagList spawnlist = new NBTTagList(); ++ for (Entry entry : this.spawnChunkMap.entrySet()) { ++ NBTTagCompound spawndata = new NBTTagCompound(); ++ ChunkCoordinates spawn = entry.getValue(); ++ if (spawn == null) continue; ++ Boolean forced = spawnForcedMap.get(entry.getKey()); ++ if (forced == null) forced = false; ++ spawndata.setInteger("Dim", entry.getKey()); ++ spawndata.setInteger("SpawnX", spawn.posX); ++ spawndata.setInteger("SpawnY", spawn.posY); ++ spawndata.setInteger("SpawnZ", spawn.posZ); ++ spawndata.setBoolean("SpawnForced", forced); ++ spawnlist.appendTag(spawndata); ++ } ++ par1NBTTagCompound.setTag("Spawns", spawnlist); + + this.foodStats.writeNBT(par1NBTTagCompound); + this.capabilities.writeCapabilitiesToNBT(par1NBTTagCompound); +@@ -982,6 +1071,7 @@ */ public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) { @@ -181,7 +244,7 @@ if (this.isEntityInvulnerable()) { return false; -@@ -1135,12 +1197,15 @@ +@@ -1135,12 +1225,15 @@ { if (!this.isEntityInvulnerable()) { @@ -198,7 +261,7 @@ par2 = this.applyPotionDamageCalculations(par1DamageSource, par2); float f1 = par2; par2 = Math.max(par2 - this.func_110139_bj(), 0.0F); -@@ -1190,6 +1255,7 @@ +@@ -1190,6 +1283,7 @@ public boolean interactWith(Entity par1Entity) { @@ -206,7 +269,7 @@ ItemStack itemstack = this.getCurrentEquippedItem(); ItemStack itemstack1 = itemstack != null ? itemstack.copy() : null; -@@ -1246,7 +1312,9 @@ +@@ -1246,7 +1340,9 @@ */ public void destroyCurrentEquippedItem() { @@ -216,7 +279,7 @@ } /** -@@ -1263,6 +1331,15 @@ +@@ -1263,6 +1359,15 @@ */ public void attackTargetEntityWithCurrentItem(Entity par1Entity) { @@ -232,7 +295,7 @@ if (par1Entity.canAttackWithItem()) { if (!par1Entity.func_85031_j(this)) -@@ -1421,6 +1498,12 @@ +@@ -1421,6 +1526,12 @@ */ public EnumStatus sleepInBedAt(int par1, int par2, int par3) { @@ -245,7 +308,7 @@ if (!this.worldObj.isRemote) { if (this.isPlayerSleeping() || !this.isEntityAlive()) -@@ -1465,6 +1548,11 @@ +@@ -1465,6 +1576,11 @@ { int l = this.worldObj.getBlockMetadata(par1, par2, par3); int i1 = BlockBed.getDirection(l); @@ -257,7 +320,7 @@ float f = 0.5F; float f1 = 0.5F; -@@ -1535,10 +1623,12 @@ +@@ -1535,10 +1651,12 @@ ChunkCoordinates chunkcoordinates = this.playerLocation; ChunkCoordinates chunkcoordinates1 = this.playerLocation; @@ -274,7 +337,7 @@ if (chunkcoordinates1 == null) { -@@ -1575,7 +1665,9 @@ +@@ -1575,7 +1693,9 @@ */ private boolean isInBed() { @@ -285,7 +348,7 @@ } /** -@@ -1590,9 +1682,12 @@ +@@ -1590,9 +1710,12 @@ ichunkprovider.loadChunk(par1ChunkCoordinates.posX - 3 >> 4, par1ChunkCoordinates.posZ + 3 >> 4); ichunkprovider.loadChunk(par1ChunkCoordinates.posX + 3 >> 4, par1ChunkCoordinates.posZ + 3 >> 4); @@ -301,7 +364,7 @@ return chunkcoordinates1; } else -@@ -1614,10 +1709,13 @@ +@@ -1614,10 +1737,13 @@ { if (this.playerLocation != null) { @@ -319,7 +382,97 @@ { case 0: return 90.0F; -@@ -1891,6 +1989,10 @@ +@@ -1683,14 +1809,40 @@ + /** + * Returns the location of the bed the player will respawn at, or null if the player has not slept in a bed. + */ ++ @Deprecated + public ChunkCoordinates getBedLocation() + { +- return this.spawnChunk; +- } +- ++ return getBedLocation(this.dimension); ++ } ++ ++ @Deprecated + public boolean isSpawnForced() + { +- return this.spawnForced; ++ return isSpawnForced(this.dimension); ++ } ++ ++ /** ++ * A dimension aware version of getBedLocation. ++ * @param dimension The dimension to get the bed spawn for ++ * @return The player specific spawn location for the dimension. May be null. ++ */ ++ public ChunkCoordinates getBedLocation(int dimension) { ++ if (dimension == 0) return this.spawnChunk; ++ return this.spawnChunkMap.get(dimension); ++ } ++ ++ /** ++ * A dimension aware version of isSpawnForced. ++ * Noramally isSpawnForced is used to determine if the respawn system should check for a bed or not. ++ * This just extends that to be dimension aware. ++ * @param dimension The dimension to get whether to check for a bed before spawning for ++ * @return The player specific spawn location for the dimension. May be null. ++ */ ++ public boolean isSpawnForced(int dimension) { ++ if (dimension == 0) return this.spawnForced; ++ Boolean forced = this.spawnForcedMap.get(dimension); ++ if (forced == null) return false; ++ return forced; + } + + /** +@@ -1698,6 +1850,10 @@ + */ + public void setSpawnChunk(ChunkCoordinates par1ChunkCoordinates, boolean par2) + { ++ if (this.dimension != 0) { ++ setSpawnChunk(par1ChunkCoordinates, par2, this.dimension); ++ return; ++ } + if (par1ChunkCoordinates != null) + { + this.spawnChunk = new ChunkCoordinates(par1ChunkCoordinates); +@@ -1709,7 +1865,32 @@ + this.spawnForced = false; + } + } +- ++ /** ++ * A dimension aware version of setSpawnChunk. ++ * This functions identically, but allows you to specify which dimension to affect, rather than affecting the player's current dimension. ++ * @param chunkCoordinates The spawn point to set as the player-specific spawn point for the dimension ++ * @param forced Whether or not the respawn code should check for a bed at this location (true means it won't check for a bed) ++ * @param dimension Which dimension to apply the player-specific respawn point to ++ */ ++ public void setSpawnChunk(ChunkCoordinates chunkCoordinates, boolean forced, int dimension) { ++ if (dimension == 0) { ++ if (chunkCoordinates != null) { ++ this.spawnChunk = new ChunkCoordinates(chunkCoordinates); ++ this.spawnForced = forced; ++ } else { ++ this.spawnChunk = null; ++ this.spawnForced = false; ++ } ++ return; ++ } ++ if (chunkCoordinates != null) { ++ this.spawnChunkMap.put(dimension, new ChunkCoordinates(chunkCoordinates)); ++ this.spawnForcedMap.put(dimension, forced); ++ } else { ++ this.spawnChunkMap.remove(dimension); ++ this.spawnForcedMap.remove(dimension); ++ } ++ } + /** + * Will trigger the specified trigger. + */ +@@ -1891,6 +2072,10 @@ super.fall(par1); } @@ -330,7 +483,7 @@ } /** -@@ -1932,7 +2034,7 @@ +@@ -1932,7 +2117,7 @@ { if (par1ItemStack.getItem().requiresMultipleRenderPasses()) { @@ -339,7 +492,7 @@ } if (this.itemInUse != null && par1ItemStack.itemID == Item.bow.itemID) -@@ -1954,6 +2056,7 @@ +@@ -1954,6 +2139,7 @@ return Item.bow.getItemIconForUseDuration(0); } } @@ -347,9 +500,12 @@ } return icon; -@@ -2176,6 +2279,14 @@ +@@ -2175,7 +2361,17 @@ + this.setScore(par1EntityPlayer.getScore()); } ++ this.spawnChunkMap = par1EntityPlayer.spawnChunkMap; ++ this.spawnForcedMap = par1EntityPlayer.spawnForcedMap; this.theInventoryEnderChest = par1EntityPlayer.theInventoryEnderChest; + + //Copy over a section of the Entity Data from the old player. @@ -362,7 +518,7 @@ } /** -@@ -2239,7 +2350,14 @@ +@@ -2239,7 +2435,14 @@ */ public void setCurrentItemOrArmor(int par1, ItemStack par2ItemStack) { diff --git a/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch b/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch index 2fe38a1dc..331f53fd2 100644 --- a/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch @@ -15,7 +15,7 @@ public abstract class ServerConfigurationManager { -@@ -387,6 +391,16 @@ +@@ -387,13 +391,23 @@ */ public EntityPlayerMP respawnPlayer(EntityPlayerMP par1EntityPlayerMP, int par2, boolean par3) { @@ -32,6 +32,15 @@ par1EntityPlayerMP.getServerForPlayer().getEntityTracker().removePlayerFromTrackers(par1EntityPlayerMP); par1EntityPlayerMP.getServerForPlayer().getEntityTracker().removeEntityFromAllTrackingPlayers(par1EntityPlayerMP); par1EntityPlayerMP.getServerForPlayer().getPlayerManager().removePlayer(par1EntityPlayerMP); + this.playerEntityList.remove(par1EntityPlayerMP); + this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension).removePlayerEntityDangerously(par1EntityPlayerMP); +- ChunkCoordinates chunkcoordinates = par1EntityPlayerMP.getBedLocation(); +- boolean flag1 = par1EntityPlayerMP.isSpawnForced(); ++ ChunkCoordinates chunkcoordinates = par1EntityPlayerMP.getBedLocation(par2); ++ boolean flag1 = par1EntityPlayerMP.isSpawnForced(par2); + par1EntityPlayerMP.dimension = par2; + Object object; + @@ -409,6 +423,7 @@ EntityPlayerMP entityplayermp1 = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension), par1EntityPlayerMP.getCommandSenderName(), (ItemInWorldManager)object); entityplayermp1.playerNetServerHandler = par1EntityPlayerMP.playerNetServerHandler; From 499610e44f8a30ed9e22d8c480983075c7bd460f Mon Sep 17 00:00:00 2001 From: Christian Date: Sun, 7 Jul 2013 00:58:32 -0400 Subject: [PATCH 057/146] Updated FML: MinecraftForge/FML@c97ac284a5e7dbdbccbad2f7ccc95252c4aef239 Update ModLoaderFuelHelper.java MinecraftForge/FML@3a200e901e34ade679e4485307f57bee725bbe94 Fix coremod injection into main system. Should stop double-dipping coremods. MinecraftForge/FML@2676c8999cbede05b5475ba68bfc25467a67d4fc Update mcp data. fixes #248 MinecraftForge/FML@5990e29af7b70e343dfd9cf38bb3e033e71a4489 Merge pull request #247 from jk-5/patch-1 MinecraftForge/FML@adc89722770b7319884619cadc6f10cc9050df24 Add cascadedTweaks. This will allow simple coexistence for any other mod framework using the tweaker system as well. Hi Voxel and LiteLoader! --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index 54e06e841..adc897227 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 54e06e841d1c8df24fc30e1ec3a51def67f58858 +Subproject commit adc89722770b7319884619cadc6f10cc9050df24 From 85fd1d010dd408d988fbe4cab7226f432f316365 Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 7 Jul 2013 14:03:19 -0700 Subject: [PATCH 058/146] Updated FML: MinecraftForge/FML@1d0384f8f664d7002019b865675a5fddf2963b3d Update for 1.6.2 and MCP 8.04 MinecraftForge/FML@111b0216fdc55f56a8361a584141bca7c9c3f070 Add the jsons for 1.6.2 MinecraftForge/FML@6f96d89e2bf9313b26eeb4c334a208bf3e1c9ad4 Update eclipse workspaces for 1.6.2 --- .../minecraftforge/client/GuiIngameForge.java | 4 +- common/forge_at.cfg | 211 +++++++++--------- eclipse-workspace-dev.zip | Bin 24534 -> 24492 bytes fml | 2 +- .../net/minecraft/block/Block.java.patch | 14 +- .../net/minecraft/client/Minecraft.java.patch | 28 ++- .../inventory/GuiContainerCreative.java.patch | 2 +- .../multiplayer/NetClientHandler.java.patch | 8 +- .../multiplayer/PlayerControllerMP.java.patch | 2 +- .../client/multiplayer/WorldClient.java.patch | 2 +- .../particle/EntityDiggingFX.java.patch | 7 +- .../client/renderer/RenderGlobal.java.patch | 18 +- .../renderer/entity/RenderBiped.java.patch | 4 +- .../renderer/entity/RenderPlayer.java.patch | 10 +- .../renderer/texture/Stitcher.java.patch | 2 +- .../texture/TextureAtlasSprite.java.patch | 2 +- .../creativetab/CreativeTabs.java.patch | 2 +- .../enchantment/Enchantment.java.patch | 4 +- .../net/minecraft/entity/Entity.java.patch | 20 +- .../entity/EntityLivingBase.java.patch | 34 +-- .../entity/item/EntityMinecart.java.patch | 2 +- .../entity/player/EntityPlayer.java.patch | 66 +++--- .../entity/player/EntityPlayerMP.java.patch | 10 +- .../net/minecraft/item/Item.java.patch | 2 +- .../item/ItemInWorldManager.java.patch | 2 +- .../item/crafting/CraftingManager.java.patch | 2 +- .../network/NetServerHandler.java.patch | 51 ++--- .../management/PlayerInstance.java.patch | 10 +- .../ServerConfigurationManager.java.patch | 14 +- .../tileentity/TileEntity.java.patch | 2 +- .../TileEntityBrewingStand.java.patch | 2 +- .../tileentity/TileEntityFurnace.java.patch | 14 +- .../net/minecraft/world/World.java.patch | 100 ++++----- .../minecraft/world/WorldServer.java.patch | 16 +- 34 files changed, 341 insertions(+), 328 deletions(-) diff --git a/client/net/minecraftforge/client/GuiIngameForge.java b/client/net/minecraftforge/client/GuiIngameForge.java index d06e8733f..008a04bc4 100644 --- a/client/net/minecraftforge/client/GuiIngameForge.java +++ b/client/net/minecraftforge/client/GuiIngameForge.java @@ -772,7 +772,7 @@ public class GuiIngameForge extends GuiIngame { GuiPlayerInfo player = (GuiPlayerInfo)players.get(i); ScorePlayerTeam team = mc.theWorld.getScoreboard().getPlayersTeam(player.name); - String displayName = ScorePlayerTeam.func_96667_a(team, player.name); + String displayName = ScorePlayerTeam.formatPlayerName(team, player.name); fontrenderer.drawStringWithShadow(displayName, xPos, yPos, 16777215); if (scoreobjective != null) @@ -783,7 +783,7 @@ public class GuiIngameForge extends GuiIngame if (maxX - endX > 5) { Score score = scoreobjective.getScoreboard().func_96529_a(player.name, scoreobjective); - String scoreDisplay = EnumChatFormatting.YELLOW + "" + score.func_96652_c(); + String scoreDisplay = EnumChatFormatting.YELLOW + "" + score.getScorePoints(); fontrenderer.drawStringWithShadow(scoreDisplay, maxX - fontrenderer.getStringWidth(scoreDisplay), yPos, 16777215); } } diff --git a/common/forge_at.cfg b/common/forge_at.cfg index 7063cee1a..e38b06932 100644 --- a/common/forge_at.cfg +++ b/common/forge_at.cfg @@ -1,164 +1,165 @@ #Main Forge Access Transformer configuration file # Tessellator -public-f bff.a #FD:Tessellator/field_78398_a #instance -public bff.u #FD:Tessellator/field_78409_u #drawMode -public bff.v #FD:Tessellator/field_78408_v #xOffset -public bff.w #FD:Tessellator/field_78407_w #yOffset -public bff.x #FD:Tessellator/field_78417_x #zOffset -public bff.z #FD:Tessellator/field_78415_z #isDrawing +public-f bfn.a #FD:Tessellator/field_78398_a #instance +public bfn.u #FD:Tessellator/field_78409_u #drawMode +public bfn.v #FD:Tessellator/field_78408_v #xOffset +public bfn.w #FD:Tessellator/field_78407_w #yOffset +public bfn.x #FD:Tessellator/field_78417_x #zOffset +public bfn.z #FD:Tessellator/field_78415_z #isDrawing # ItemPickaxe -public yi.(ILxy;)V #MD:ItemPickaxe/(ILnet/minecraft/src/EnumToolMaterial;) #constructor -public+f yi.c #FD:ItemPickaxe/field_77867_c #blocksEffectiveAgainst +public ym.(ILyc;)V #MD:ItemPickaxe/(ILnet/minecraft/src/EnumToolMaterial;) #constructor +public+f ym.c #FD:ItemPickaxe/field_77867_c #blocksEffectiveAgainst # ItemAxe -public xv.(ILxy;)V #MD:ItemAxe/(ILnet/minecraft/src/EnumToolMaterial;) #constructor -public+f xv.c #FD:ItemAxe/field_77868_c #blocksEffectiveAgainst +public xz.(ILyc;)V #MD:ItemAxe/(ILnet/minecraft/src/EnumToolMaterial;) #constructor +public+f xz.c #FD:ItemAxe/field_77868_c #blocksEffectiveAgainst # ItemSpade -public yt.(ILxy;)V #MD:ItemSpade/(ILnet/minecraft/src/EnumToolMaterial;) #constructor -public+f yt.c #FD:ItemSpade/field_77866_c #blocksEffectiveAgainst +public yx.(ILyc;)V #MD:ItemSpade/(ILnet/minecraft/src/EnumToolMaterial;) #constructor +public+f yx.c #FD:ItemSpade/field_77866_c #blocksEffectiveAgainst # ItemTool -public xe.a #FD:ItemTool/field_77864_a #efficiencyOnProperMaterial -public xe.d #FD:ItemTool/field_77865_bY #damageVsEntity +public xi.a #FD:ItemTool/field_77864_a #efficiencyOnProperMaterial +public xi.d #FD:ItemTool/field_77865_bY #damageVsEntity # EntityEnderman -public td.br #FD:EntityEnderman/field_70827_d #carriableBlocks +public tf.br #FD:EntityEnderman/field_70827_d #carriableBlocks # RenderEngine # -- MISSING MAPPING public bge.f(Ljava/lang/String;)I #MD:RenderEngine/func_78341_b #getTexture # -- MISSING MAPPING public bge.i #FD:RenderEngine/field_94154_l #terrainTextureMap # -- MISSING MAPPING public bge.j #FD:RenderEngine/field_94155_m #itemTextureMap # RenderGlobal -public bfa.k #FD:RenderGlobal/field_72769_h #theWorld -public bfa.l #FD:RenderGlobal/field_72770_i #renderEngine -public bfa.t #FD:RenderGlobal/field_72777_q #mc -public bfa.u #FD:RenderGlobal/field_72776_r #globalRenderBlocks -public bfa.H #FD:RenderGlobal/field_72738_E #damagedBlocks +public bfi.k #FD:RenderGlobal/field_72769_h #theWorld +public bfi.l #FD:RenderGlobal/field_72770_i #renderEngine +public bfi.t #FD:RenderGlobal/field_72777_q #mc +public bfi.u #FD:RenderGlobal/field_72776_r #globalRenderBlocks +public bfi.H #FD:RenderGlobal/field_72738_E #damagedBlocks # SoundManager -public blc.b #FD:SoundManager/field_77381_a #sndSystem -public blc.d #FD:SoundManager/field_77379_b #soundPoolSounds -public blc.e #FD:SoundManager/field_77380_c #soundPoolStreaming -public blc.f #FD:SoundManager/field_77377_d #soundPoolMusic +public blk.b #FD:SoundManager/field_77381_a #sndSystem +public blk.d #FD:SoundManager/field_77379_b #soundPoolSounds +public blk.e #FD:SoundManager/field_77380_c #soundPoolStreaming +public blk.f #FD:SoundManager/field_77377_d #soundPoolMusic # EntityMinecart -protected sq.* #FD:EntityMinecart/* # All private -> protected +protected ss.* #FD:EntityMinecart/* # All private -> protected # -- MISSING MAPPING public py.h()Z #MD:EntityMinecart/func_70490_h #isMinecartPowered # Block -public aqs.(ILajv;)V #MD:Block/(ILnet/minecraft/src/Material;) #Constructor -public aqs.(IILajv;)V #MD:Block/(IILnet/minecraft/src/Material;) #Constructor -public aqs.cH #FD:Block/field_72029_cc #blockResistance -public aqs.cG #FD:Block/field_71989_cb #blockHardness -public aqs.d(Ljava/lang/String;)Laqs; #MD:Block/func_111022_d #setIconName +public aqw.(ILajz;)V #MD:Block/(ILnet/minecraft/src/Material;) #Constructor +public aqw.(IILajz;)V #MD:Block/(IILnet/minecraft/src/Material;) #Constructor +public aqw.cH #FD:Block/field_72029_cc #blockResistance +public aqw.cG #FD:Block/field_71989_cb #blockHardness +public aqw.d(Ljava/lang/String;)Laqw; #MD:Block/func_111022_d #setIconName # -- MISSING MAPPING public amq.r()Lamq; #MD:Block/func_71912_p #setRequiresSelfNotify -public aqs.a(Laqw;)Laqs; #MD:Block/func_71884_a #setStepSound -public aqs.b(F)Laqs; #MD:Block/func_71894_b #setResistance -public aqs.c(F)Laqs; #MD:Block/func_71848_c #setHardness -public aqs.k(I)Laqs; #MD:Block/func_71868_h #setLightOpacity -public aqs.a(F)Laqs; #MD:Block/func_71900_a #setLightValue -public aqs.r()Laqs; #MD:Block/func_71875_q #setBlockUnbreakable -public aqs.b(Z)Laqs; #MD:Block/func_71907_b #setTickRandomly -public aqs.a(FFFFFF)V #MD:Block/func_71905_a #setBlockBounds +public aqw.a(Lara;)Laqw; #MD:Block/func_71884_a #setStepSound +public aqw.b(F)Laqw; #MD:Block/func_71894_b #setResistance +public aqw.c(F)Laqw; #MD:Block/func_71848_c #setHardness +public aqw.k(I)Laqw; #MD:Block/func_71868_h #setLightOpacity +public aqw.a(F)Laqw; #MD:Block/func_71900_a #setLightValue +public aqw.r()Laqw; #MD:Block/func_71875_q #setBlockUnbreakable +public aqw.b(Z)Laqw; #MD:Block/func_71907_b #setTickRandomly +public aqw.a(FFFFFF)V #MD:Block/func_71905_a #setBlockBounds # NetServerHandler -public jx.f #FD:NetServerHandler/field_72572_g #playerInAirTime +public jz.f #FD:NetServerHandler/field_72572_g #playerInAirTime # TileEntity -public asi.k #FD:TileEntity/field_70331_k #worldObj +public asm.k #FD:TileEntity/field_70331_k #worldObj # BlockLeavesBase -public ara.d #FD:BlockLeavesBase/field_72131_c #graphicsLevel +public are.d #FD:BlockLeavesBase/field_72131_c #graphicsLevel # Item -public xx.(I)V #MD:Item/(I) #Constructor -public xx.e(I)Lxx; #MD:Item/func_77656_e #setMaxDamage -public-f xx.h(Lxz;)Lmp; #MD:Item/func_77650_f #getIconIndex -public xx.c(Ljava/lang/String;)Lxx; #MD:Item/func_77631_c #setPotionEffect +public yb.(I)V #MD:Item/(I) #Constructor +public yb.e(I)Lyb; #MD:Item/func_77656_e #setMaxDamage +public-f yb.h(Lyd;)Lmr; #MD:Item/func_77650_f #getIconIndex +public yb.c(Ljava/lang/String;)Lyb; #MD:Item/func_77631_c #setPotionEffect +public yb.d(Ljava/lang/String;)Lyb; #MD:Item/func_111206_d #setIconName # RailLogic -public ams #CL:BlockBaseRailLogic -public ams.a()I #MD:BlockBaseRailLogic/func_94505_a #getNAdjacentTiles +public amw #CL:BlockBaseRailLogic +public amw.a()I #MD:BlockBaseRailLogic/func_94505_a #getNAdjacentTiles # EntityPlayer -public ua.a(Lsp;)V #MD:EntityPlayer/func_71012_a #joinEntityItemWithWorld -public ua.i()V #MD:EntityPlayer/func_71053_j #closeScreen -public ua.b #FD:EntityPlayer/field_71076_b #sleepTimer +public ue.a(Lsr;)V #MD:EntityPlayer/func_71012_a #joinEntityItemWithWorld +public ue.i()V #MD:EntityPlayer/func_71053_j #closeScreen +public ue.b #FD:EntityPlayer/field_71076_b #sleepTimer # EntityPlayerMP -public bcx.a(Lsp;)V #MD:EntityClientPlayerMP/func_71012_a #joinEntityItemWithWorld +public bdf.a(Lsr;)V #MD:EntityClientPlayerMP/func_71012_a #joinEntityItemWithWorld # World Gen Chests Related -public mh.* #FD:WeightedRandomChestContent/* #all -public jp.T #FD:WorldServer/field_73069_S #bonusChestContent -public agc.a #FD:StructureMineshaftPieces/field_78818_a #mineshaftChestContents -public ahg.i #FD:ComponentScatteredFeatureDesertPyramid/field_74941_i #itemsToGenerateInTemple -public ahh.l #FD:ComponentScatteredFeatureJunglePyramid/field_74943_l #junglePyramidsChestContents -public ahh.m #FD:ComponentScatteredFeatureJunglePyramid/field_74944_m #junglePyramidsDispenserContents -public ahr.a #FD:ComponentStrongholdChestCorridor/field_75003_a #strongholdChestContents -public ahv.b #FD:ComponentStrongholdLibrary/field_75007_b #strongholdLibraryChestContents -public aia.c #FD:ComponentStrongholdRoomCrossing/field_75014_c #strongholdCorridorChestContents -public ajb.a #FD:ComponentVillageHouse2/field_74918_a #villageBlacksmithChestContents -public afk.a #FD:WorldGenDungeons/field_111189_a #chestContents +public mj.* #FD:WeightedRandomChestContent/* #all +public jr.T #FD:WorldServer/field_73069_S #bonusChestContent +public agg.a #FD:StructureMineshaftPieces/field_78818_a #mineshaftChestContents +public ahk.i #FD:ComponentScatteredFeatureDesertPyramid/field_74941_i #itemsToGenerateInTemple +public ahl.l #FD:ComponentScatteredFeatureJunglePyramid/field_74943_l #junglePyramidsChestContents +public ahl.m #FD:ComponentScatteredFeatureJunglePyramid/field_74944_m #junglePyramidsDispenserContents +public ahv.a #FD:ComponentStrongholdChestCorridor/field_75003_a #strongholdChestContents +public ahz.b #FD:ComponentStrongholdLibrary/field_75007_b #strongholdLibraryChestContents +public aie.c #FD:ComponentStrongholdRoomCrossing/field_75014_c #strongholdCorridorChestContents +public ajf.a #FD:ComponentVillageHouse2/field_74918_a #villageBlacksmithChestContents +public afo.a #FD:WorldGenDungeons/field_111189_a #chestContents # AnvilChunkLoader.chunkSaveLocation -public adz.d #FD:AnvilChunkLoader/field_75825_d +public aed.d #FD:AnvilChunkLoader/field_75825_d # ChunkProviderServer.currentChunkLoader -public jo.e #FD:ChunkProviderServer/field_73247_e +public jq.e #FD:ChunkProviderServer/field_73247_e # PlayerManager -public jm.a(IIZ)Ljn; #MD:PlayerManager/func_72690_a #getOrCreateChunkWatcher +public jo.a(IIZ)Ljp; #MD:PlayerManager/func_72690_a #getOrCreateChunkWatcher # PlayerInstance -public jn #CL:PlayerInstance +public jp #CL:PlayerInstance # World -public-f abr.A #FD:World/field_72982_D #villageCollectionObj -public abr.G #FD:World/field_72993_I #activeChunkSet +public-f abv.A #FD:World/field_72982_D #villageCollectionObj +public abv.G #FD:World/field_72993_I #activeChunkSet # EntityLiving -public od.b #FD:EntityLiving/field_70728_aV #experienceValue +public of.b #FD:EntityLiving/field_70728_aV #experienceValue # -- MISSING MAPPING public ng.bt #FD:EntityLiving/field_94063_bt #combatTracker -public od.d #FD:EntityLiving/field_70715_bh #targetTasks +public of.d #FD:EntityLiving/field_70715_bh #targetTasks # GuiFlatPresets -public avq.a(Ljava/lang/String;ILacl;Ljava/util/List;[Lafy;)V #MD:GuiFlatPresets/func_82294_a -public avq.a(Ljava/lang/String;ILacl;[Lafy;)V #MD:GuiFlatPresets/func_82297_a +public avw.a(Ljava/lang/String;ILacp;Ljava/util/List;[Lagc;)V #MD:GuiFlatPresets/func_82294_a +public avw.a(Ljava/lang/String;ILacp;[Lagc;)V #MD:GuiFlatPresets/func_82297_a # BiomeGenBase -public acl.*() #MD:BiomeGenBase/* #Everything protected->public +public acp.*() #MD:BiomeGenBase/* #Everything protected->public # MapGenVillage -public-f aip.e #FD:MapGenVillage/field_75055_e #villageSpawnBiomes +public-f ait.e #FD:MapGenVillage/field_75055_e #villageSpawnBiomes # ShapedRecipes -public+f aad.d #FD:ShapedRecipes/field_77574_d #recipeItems -public+f aad.b #FD:ShapedRecipes/field_77576_b #recipeWidth -public+f aad.c #FD:ShapedRecipes/field_77577_c #recipeHeight +public+f aah.d #FD:ShapedRecipes/field_77574_d #recipeItems +public+f aah.b #FD:ShapedRecipes/field_77576_b #recipeWidth +public+f aah.c #FD:ShapedRecipes/field_77577_c #recipeHeight # ShapelessRecipes -public aae.b #FD:ShapelessRecipes/field_77579_b #recipeItems +public aai.b #FD:ShapelessRecipes/field_77579_b #recipeItems # GuiContainer -protected awp.a(Lvz;)V #MD:GuiContainer/func_74192_a #drawSlotInventory +protected awv.a(Lwd;)V #MD:GuiContainer/func_74192_a #drawSlotInventory # ContainerPlayer -protected vq.h #FD:ContainerPlayer/field_82862_h #player +protected vu.h #FD:ContainerPlayer/field_82862_h #player # BlockButton -protected amy.n(Labr;III)V #MD:BlockButton/func_82535_o #checkActivation -protected-f amy.a #FD:BlockButton/field_82537_a #sensible +protected anc.n(Labv;III)V #MD:BlockButton/func_82535_o #checkActivation +protected-f anc.a #FD:BlockButton/field_82537_a #sensible # BiomeDecorator -public acp.* #FD:BiomeDecorator/* # All private -> protected +public act.* #FD:BiomeDecorator/* # All private -> protected # CreativeTabs -public-f wr.a #FD:CreativeTabs/field_78032_a # creativeTabArray non-final +public-f wv.a #FD:CreativeTabs/field_78032_a # creativeTabArray non-final # Packet public ex.a(IZZLjava/lang/Class;)V #MD:Packet/func_73285_a #addIdClassMapping # SaveHandler -public alj.b()Ljava/io/File; #MD:SaveHandler/func_75765_b +public aln.b()Ljava/io/File; #MD:SaveHandler/func_75765_b # World stuff -public abr.b(Lnk;)V #MD:World/func_72847_b #releaseEntitySkin -public abr.m #FD:World/field_73003_n #prevRainingStrength -public abr.n #FD:World/field_73004_o #rainingStrength -public abr.p #FD:World/field_73017_q #thunderingStrength -public abr.o #FD:World/field_73018_p #prevThunderingStrength +public abv.b(Lnm;)V #MD:World/func_72847_b #releaseEntitySkin +public abv.m #FD:World/field_73003_n #prevRainingStrength +public abv.n #FD:World/field_73004_o #rainingStrength +public abv.p #FD:World/field_73017_q #thunderingStrength +public abv.o #FD:World/field_73018_p #prevThunderingStrength #WorldClient -public bcu.b(Lnk;)V #MD:WorldClient/func_72847_b #releaseEntitySkin +public bda.b(Lnm;)V #MD:WorldClient/func_72847_b #releaseEntitySkin #WorldServer -public jp.b(Lnk;)V #MD:WorldServer/func_72847_b #releaseEntitySkin -public jp.N #FD:WorldServer/field_73068_P #allPlayersSleeping +public jr.b(Lnm;)V #MD:WorldServer/func_72847_b #releaseEntitySkin +public jr.N #FD:WorldServer/field_73068_P #allPlayersSleeping #TextureMap -public bhz.g #FD:TextureMap/field_94255_a +public bih.g #FD:TextureMap/field_94255_a # -- MISSING MAPPING public bir.b #FD:TextureMap/field_94253_b -public bhz.h #FD:TextureMap/field_94254_c +public bih.h #FD:TextureMap/field_94254_c # -- MISSING MAPPING public bir.d #FD:TextureMap/field_94251_d #Potion -public nf.b(II)Lnf; #MD:Potion/func_76399_b #setIconIndex +public nh.b(II)Lnh; #MD:Potion/func_76399_b #setIconIndex #PotionHelper -public zk.m #FD:PotionHelper/field_77927_l #potionRequirements -public zk.n #FD:PotionHelper/field_77928_m #potionAmplifiers +public zo.m #FD:PotionHelper/field_77927_l #potionRequirements +public zo.n #FD:PotionHelper/field_77928_m #potionAmplifiers #PotionEffect -public ng.b #FD:PotionEffect/field_76460_b #duration +public ni.b #FD:PotionEffect/field_76460_b #duration #BlockFluid -protected aov.a #FD:BlockFluid/field_94425_a #theIcon +protected aoz.a #FD:BlockFluid/field_94425_a #theIcon #GuiIngame -protected ava.* #FD:GuiIngame/* # All private -> protected -protected ava.*() #MD:GuiIngame/* # All private -> protected +protected avg.* #FD:GuiIngame/* # All private -> protected +protected avg.*() #MD:GuiIngame/* # All private -> protected #ItemStack -default xz.f #FD:ItemStack/field_77991_e # make default access for itemDamage +default yd.f #FD:ItemStack/field_77991_e # make default access for itemDamage #GuiSlot -protected avx.b(IIII)V #MD:GuiSlot/func_77206_b #overlayBackground +protected awd.b(IIII)V #MD:GuiSlot/func_77206_b #overlayBackground #EntityPlayer -public ua.bu #FD:EntityPlayer/field_71092_bJ #username +public ue.bu #FD:EntityPlayer/field_71092_bJ #username diff --git a/eclipse-workspace-dev.zip b/eclipse-workspace-dev.zip index 38cd5269f2bccb44376db2fbd7dfdc3feffdf233..049c406efae55b5e00f5bcdcc47762cacdfbbf5f 100644 GIT binary patch delta 3815 zcmZ{nc|26@`^RU-zRQ-S#*!tZWIT3b3E2$>F@&r`b|Tv(kCdH*?38^MQOI7DVeCyA zwCHIpA<7aDzM9GJ^{UtNJO8}T>wK62TBt5-lJo67Nu$0+bY(U+1GF+KVXwMJAk0Wt7e2Bv+|TehN(u z)V2bo2o^CT(gk}laca^@ywu=vs6tc9g+2ySn5D8fbD9THGy9bQejNe=EiwU#%1}(R zm7UMDG)Kf-$v#bbFhO`US#L$cGRUU7F87wv61&Vjy?mt`&dP|b<>34jHU!G7m*c}s z!0Ez(`iPa3rucGX;Aca=x=*dd`8vF#4D!VN_15jMf0^<_PujyHR2ZoK5-r{WcgOy9 zZG6dvn2KGPfhm1g!dd5h+7!DaQZ0tbNV>>CHNx1Z=lrOsm62cl^gG6S(fev^{n5+q z)q-y$lMJwrOCXo8=L{$it5XfAEe9q-~VO5g^66dEcAYPr*Yju851~VAMEM9TX zaWQ1)-d0cRJS?qZNT_eZuz{&PIeCd2Jg2y_R(`#U z{(-)pPJp8W`^Aqr(x#zR@neOP`4#@F7j%Pa21UDj z#+>^LuOJ;B_YW_1Efn<7J#W!1Tx3RUuHMS+rTiP4!pjim$?Iw}Y|5s(ds)Bt$AsG3 z4M8FyySMZCin+f5RFX5=HSdy0y-ingd+EKrR#=p)>`Gq{yEcs8M_nvi0)wtnW<&O? zj`tmu(QNW|w$7Ol;Q4WB)oncQBbkJ5DYLulPr{v_5ZIoy=y|tFPYuTkE!Ke`qeZT~ zux6Gv%YqkUTzn!}(QaQ(QHh~^Q~7ca{;kkEPlxvC->v< zW*tywrl^c79ibaPLFaUHD*UEmp< zA7kp1E6o~t6{F2rdm*DcO4vxU6?xjL3_Z&>W*JtK(CUm!(2&z2bQLBF3L1_7wZySW zwF+NdZ6AR%?koilCZ81G#6EW!2x!lDVwE+>%Cfrw<=4U8BuXgswhnz(kLN=m8=sB# z^o-G*)1}vV8AY3r;3b_?Dt=d}yP`$*4W>lWsknvxeuCJxB4TCoYQ@A|T}A}V+5a=- zpL164aX@cr_9V4+iUhPo7H?OdTbUax5;nu$p`v*&=cJVs zitUxU{6@I<{h9tpjR&Q^Uzs^yi(#;bCltaH)epZEL1Lh9Ul8OQ)>zv1z0SmC!Wt_l zl`F>0t+u~W=g&UCj4c;>W=DG|Ift~3q2xEYQz(ibTiK==2#8E5uHOch8{$-X<{XezZ*_9oltpxh7Ta=r z14ohC;={qny8H}iLd!nGzf{LB4aw9216`gb0Szs()4FMjGrRc^H9PZ4!zn31APZ)o zK=Y@$dYKTUSr4A+?Xg&N61>MZWa#cFQS#EhLAL3ISIs=9q!~!MUOu|NoBvI7g5KR- zNjqp2*Gg<{8o3b>xRDn(mxu1lP}vHf*$y?lBk@rNz7=VL8+#DEv4SNQBM?q99{lP* z9#3XH4jl{oB%`#Iz}!&)gNEU48xa#>%a~NlcZHItVSy3~0Dqt3Ce&>hI&P2YyJG{Y7e751t`_4wR|p+ zawc3W8lP3DS%G8>r9CciHe((D%B=fk*Vi4UZg)4TX6)pSH!jY@w-`=ve%#7BA0A-B zmSOE2l0(-b#Ikr0-EipWpLjVKaW#()>JV%X69pcsJ-1m$i}PNzrTUl^p4K$0sS3+WVoK5 zT)zxAOuzR4rgEi8(2bDQ+tNL2?r(l%xD;+jhHF);_Iw{>re!>nrLLT{`k^iAAx{iD z>)BcG^(FZu!=;evKB%H%vMI3Tk6kG+W_o2|&iJ+Afe=Dobd;+i?4@_Jh_^Q|mB;7Fred27BV84AyI(-T|>CK@~N= zp{6NWvZ{e;Z$_Rn80O0A{1_>ICIyv#*&y$b<15Ef{WTP?Qp|zGwE^L(WdJ3+r*M`4 z>C*^TdidG{j+KHL`|ySy8E!||tHr5>tu4I!hLci`VgE#R{M!83j|@Y5akranblJ@&}CuQRUmtO|NUgXP4;*uBnx>8G?Tw~@jyfw!ExLhd=0Js*0? zZ_RV}Mhca&3V1DZ>wV-7;i9f+KsFfOpVkR-%QNSiEmg;)n}?`o+__moL8Sq<6-X#! zo3T!B6+SW89dNxry1_U1)(crY5^ab4*4%D58dU{0!uo?l-5tBSTShpiXN+nkR2|aQ zG-M&!pKfQRB%+JqKE}zWQ+9S5Tkh7aUFr*qj(t7954EaR+|aan zwP}DHMe`2k?=E_GnP3pEA%zg_9d;>t%vxEU`}7(Pp{Fe1Elwl!)j8HhLc=U&;N86t zO+Ra=Ggds+?V?$T%&05OnWpijrVGt&oy5Y&xbXTZ`joh5&uAqc%!MStHn8bUo0)PE z#&*0>e8h9b5z$g0tWU0z;wdJ->lYUdr2&NPR3HQ9+}R49g04b_mK!xShvHwt)ni`J z?ZP4L1lsQ=TM{YNQp%V;NXx!)Q-^o_!xvC%i=`Ed#Yfe7L#Ayq9+7=cZzGT_!^^&kUkcZNs7{%{D@n%Vt<1^U}_bianPQ#kK>#wGiA$ z&%)kcvtJwC`k_Jf5NGPQI)iO|0=o^f38SaeEldr^nKBs4$JvX54pk08$L|oyf13<+ z?aAI-s|RBq?f30NhT*_u0;_tVq&=^vzN#4ghBrw%W{xkz?ZY?2V1xk}q6YfEO*$~5 zuOn7yN=|dk|1Va>z>!%}-G`KyOhChggNpoNcy8b+_PdA!Ul?Wl&p}g-_y9jcOJ-gk zaxyXjR%2O!&M1b|L#mPApJTBax00kGV>f1HH}aii9+go=l2%RZ#eSD?;2FmME+P6kCWXX!yMu2!}3^ oqRR{H*fO#l7xRmxj&$vz5dEJavOtnK6RDd9djaY|y`Qu7KUQ+pqyPW_ delta 3893 zcma)AIE1bV;_XEkCE-#W#7Y_laa#I+<`dl$nc zYs$VPJ4vW1`e`P=-|KdNzt`(`{&}A{-_Q9z-{(Bf^O@&)(h7am3S}@iBBx-5e7|&_ zPyfyk2PHoym;e*Q8M|7RB=Nq1ryde`MGDcQ>8U7_ z3D)`CZRMkufFx-e5BB88p8c7MXnerSZr{p3-AhkPEe32auh6OPNon2;0uZ#n8S8Co zgyY0t6pqEeBF`9V@VK^8ms=x`?=y=r1Z>U3c-;`Rd7Lp|kE?b7=S-Ap3-V)k#;o7@ z=JLs-aG$f?MOX*R2mwXBTkh_Xe(}zrC8q`NAwki>Jpnz!$-AGDoQ$C}cyGXFsZ+-v zt}vF%SzPp>%Z=xL3^+ zU{aIdwXir)Ocmh)i0-HrVMn@rH`s;6{yJ1~`gFfpI*>isF$yo7~Cu&2(Z(OAEm~%(ofD_>IoMjP^(smSChA&P1 zsC~7GDoukb1FK;@;orQ6xn?#`;p$juc8$t@Z!0`U3)*o`KQX#lfkv+4(l57>Uj>Bbzpm!_ ze7?K8X?zj0@J_TrG&${#w%ou)A!*0f_{pN%xeam=A@cp5fzgjRqm>?jfN`4q7%z?3 zB7D^a7>QC!M zu*!KHJm}q5qdehS;Qoe!<7tO(bc5U)!MeZG*(R<}qJB&={1J~Nl+1jW`ypaPZ&2zT z&STV}U!(!sH6M81XgIYQ*bfX19^r-qAN4TZ%|o6tEe!LV;U=Io1_OlLo3 zTw0Sq|7=?!@Uw(>#mE_t1@;##=3e|>G#8#c`c1pA?0VieJc{e+{ zl6s?6*CnXhE@El*<{|8Qr*l(NuqW5sfj~P_xxs*@$et z-mvSfteDOD5!ZWq|A3IOn-T z4wIIdBxzYH?1sfR+5*`g#p<$2EmzoOx#(3F8#W<%@6wIjI%Gl~f%Y@q$t)uJJ;<-m zSwpX_OEO_A9Z~qN4;FMj_qf|KlS3dWjNly|B+zf?cs#9$z8fpH{Vb;zE!=J%t3?jY zF;u!;(raSu@4wM=-JucFx`Et~SlKM!=-xTt<@=(HAHrLSsah2?*nN1tdu4oG zhO;cL@6+oqDyrvWXYd(je91c6iTKi+koOlOGHXL-g5S!j?kB*TlLC;Ty(1{^}IWs!aBW7N(+I|on!zg2QLq(lCKdhCLLF)2A zjQgRcl;p@gTAtqxkc+u?0$E-4>Ai7lE8}~fd1tN~lziN${~YwK?k+|CD8G<3H<`Uv zf7X>=-F`A1leMEbT5ZDXN?!`a7=CAs(ApmW%jxzHLc2iXgX%S<^RRY&vQ8 z65e%awaYGK%UFbTFwit=evO=|X0aJSc<)5cC79-qB7Tk)aBcPr+5a%{!ExgF15 zY?i!DSGN^|^()8TN7se%0XQQTm4HQx?4er5aiKexSo6YBtH`$EmebnUDFKa*$`JF) zd2oHRcC*CF>S~=2?0G8%b6X;dr{SokyPfZC$4S9@bS7b;Q+U-D0`;u&;F7Cj4Dkv@ zoOkp|mB@i~R(}6x35_Z?U#i$S7i9ZiD22Q_QW9egirMcgSXtsLPZ9Zm` zj!3c<1yXie^^aQR40mSN8$O5XE+NGJD9(ESp(#)lcI?L|3+dQ@kL|d^d=8~?Y{z9Z zL_79z<^bo;F#(x{l9Zwpzw4BERoPP3o`0)4KJe$2(`u{FzJ(p7+^uDL)n>g})X+3F zz1(tTLsUF4h84t%82Fi3u(wr__d`Q3=JT zrm(3Eg3P^b;yxd=?Vn4wxu$rR)k>9po^TRb(NYL6#x_9iJG`!}+PoR9Xg5+W#>lah z%w(c1+<+2xcbh0ZtK`vBn*H=C>dSqd6)JtFcxof+SIJ+)2tquGCHa-er`^Bm-szoi zDz^y8j&QgEbj(u7r%8qzNxa>EkTd_n<(ds0bwSNOz0D|DyUhgc%rEC^C=jfI)i)>N znjZ4Rwe2FL_3`PE>R*jt2;AvICZe(G047QW%Ne)l!dYj}743|h3q87WFnZ894SC$N z-d9Px7S*jRaMoCD($BYPX|#y>`IP}#RoT~MRV^>afUG6YIJX=FkEE zoWEVcE57bW`{moij)jdQB{Hf>>W|4dvB8b(18J9++kAV9n4vue0{U^iRZ;BI>}6in zWZ02cJ?@eFK4w^@fJcEB+vGId>3c5yUDr^pWnZ)h{nN*z`Rq0i?x7F;G`tjoC1T$% zw$F{cb=3^n+Z@=*-CkTBpTz$;_!dboMecrY1BIQ1#cBHFFo#4|i{CMr7;Nwt(}0Go zdapB{%qpTi*YN9ONY)%>AjcAqf!Wyw4nR+s?N0}yEZM*r0~g}9S=&%UM9Y$#s5#-W zCi2_seyF(-lV%cd63IAnkZ?q350XdN~9see1 zfk-DVZ~#qz>ZGC*Zpwjtmh7OoHUr4yL=Tk#d7ZF)KWBsgEt>=Q(24ig+!)e?I^loo z;@|fd5XgV3LLFBX145leV6z1Y)mb=D${ES`PisBt#CLf== 0; i >>= 1) { GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null); -@@ -2413,6 +2356,7 @@ +@@ -2431,6 +2370,7 @@ if (j != 0) { diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch index 851230189..3725f9acc 100644 --- a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch @@ -214,4 +214,4 @@ + } } - public int func_74230_h() + /** diff --git a/patches/minecraft/net/minecraft/client/multiplayer/NetClientHandler.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/NetClientHandler.java.patch index 1b062e2c3..9728fc793 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/NetClientHandler.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/NetClientHandler.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/client/multiplayer/NetClientHandler.java +++ ../src_work/minecraft/net/minecraft/client/multiplayer/NetClientHandler.java -@@ -186,6 +186,11 @@ +@@ -191,6 +191,11 @@ import net.minecraft.world.storage.MapStorage; import org.lwjgl.input.Keyboard; @@ -12,7 +12,7 @@ @SideOnly(Side.CLIENT) public class NetClientHandler extends NetHandler { -@@ -778,7 +783,7 @@ +@@ -784,7 +789,7 @@ public void handleKickDisconnect(Packet255KickDisconnect par1Packet255KickDisconnect) { @@ -21,7 +21,7 @@ this.disconnected = true; this.mc.loadWorld((WorldClient)null); -@@ -860,7 +865,11 @@ +@@ -866,7 +871,11 @@ public void handleChat(Packet3Chat par1Packet3Chat) { par1Packet3Chat = FMLNetworkHandler.handleChatMessage(this, par1Packet3Chat); @@ -34,7 +34,7 @@ } public void handleAnimation(Packet18Animation par1Packet18Animation) -@@ -1329,6 +1338,10 @@ +@@ -1354,6 +1363,10 @@ { tileentity.readFromNBT(par1Packet132TileEntityData.customParam1); } diff --git a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch index f7171d163..c6c9920f7 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch @@ -21,7 +21,7 @@ + return false; + } + - if (this.currentGameType.isAdventure() && !this.mc.thePlayer.canCurrentToolHarvestBlock(par1, par2, par3)) + if (this.currentGameType.isAdventure() && !this.mc.thePlayer.isCurrentToolAdventureModeExempt(par1, par2, par3)) { return false; @@ -146,7 +156,7 @@ diff --git a/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch index 5a0f5e5cd..e9f19b6c1 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch @@ -23,7 +23,7 @@ } /** -@@ -296,6 +302,12 @@ +@@ -290,6 +296,12 @@ */ protected void updateWeather() { diff --git a/patches/minecraft/net/minecraft/client/particle/EntityDiggingFX.java.patch b/patches/minecraft/net/minecraft/client/particle/EntityDiggingFX.java.patch index adeb00887..29caf30eb 100644 --- a/patches/minecraft/net/minecraft/client/particle/EntityDiggingFX.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/EntityDiggingFX.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/client/particle/EntityDiggingFX.java +++ ../src_work/minecraft/net/minecraft/client/particle/EntityDiggingFX.java -@@ -10,20 +10,27 @@ +@@ -10,15 +10,22 @@ public class EntityDiggingFX extends EntityFX { private Block blockInstance; @@ -23,7 +23,10 @@ + this.side = side; } - public EntityDiggingFX func_70596_a(int par1, int par2, int par3) + /** +@@ -26,7 +33,7 @@ + */ + public EntityDiggingFX applyColourMultiplier(int par1, int par2, int par3) { - if (this.blockInstance == Block.grass) + if (this.blockInstance == Block.grass && this.side != 1) diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch index 7922399bd..84493179c 100644 --- a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/RenderGlobal.java +++ ../src_work/minecraft/net/minecraft/client/renderer/RenderGlobal.java -@@ -67,6 +67,9 @@ +@@ -68,6 +68,9 @@ import org.lwjgl.opengl.ARBOcclusionQuery; import org.lwjgl.opengl.GL11; @@ -10,7 +10,7 @@ @SideOnly(Side.CLIENT) public class RenderGlobal implements IWorldAccess { -@@ -446,35 +449,47 @@ +@@ -447,35 +450,47 @@ */ public void renderEntities(Vec3 par1Vec3, ICamera par2ICamera, float par3) { @@ -71,15 +71,15 @@ ++this.countEntitiesRendered; if (entity.isInRangeToRenderVec3D(par1Vec3)) -@@ -488,6 +503,7 @@ +@@ -489,6 +504,7 @@ for (i = 0; i < list.size(); ++i) { entity = (Entity)list.get(i); + if (!entity.shouldRenderInPass(pass)) continue; + boolean flag = entity.isInRangeToRenderVec3D(par1Vec3) && (entity.ignoreFrustumCheck || par2ICamera.isBoundingBoxInFrustum(entity.boundingBox) || entity.riddenByEntity == this.mc.thePlayer); - if (entity.isInRangeToRenderVec3D(par1Vec3) && (entity.ignoreFrustumCheck || par2ICamera.isBoundingBoxInFrustum(entity.boundingBox) || entity.riddenByEntity == this.mc.thePlayer) && (entity != this.mc.renderViewEntity || this.mc.gameSettings.thirdPersonView != 0 || this.mc.renderViewEntity.isPlayerSleeping()) && this.theWorld.blockExists(MathHelper.floor_double(entity.posX), 0, MathHelper.floor_double(entity.posZ))) - { -@@ -501,7 +517,11 @@ + if (!flag && entity instanceof EntityLiving) +@@ -514,7 +530,11 @@ for (i = 0; i < this.tileEntities.size(); ++i) { @@ -92,7 +92,7 @@ } this.mc.entityRenderer.disableLightmap((double)par3); -@@ -936,6 +956,12 @@ +@@ -949,6 +969,12 @@ */ public void renderSky(float par1) { @@ -105,7 +105,7 @@ if (this.mc.theWorld.provider.dimensionId == 1) { GL11.glDisable(GL11.GL_FOG); -@@ -1174,6 +1200,13 @@ +@@ -1187,6 +1213,13 @@ public void renderClouds(float par1) { @@ -119,7 +119,7 @@ if (this.mc.theWorld.provider.isSurfaceWorld()) { if (this.mc.gameSettings.fancyGraphics) -@@ -1582,6 +1615,11 @@ +@@ -1595,6 +1628,11 @@ } public void drawBlockDamageTexture(Tessellator par1Tessellator, EntityPlayer par2EntityPlayer, float par3) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch index db7476538..4d5daf039 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch @@ -63,7 +63,7 @@ + protected int func_130006_a(EntityLiving par1EntityLiving, int par2, float par3) { - ItemStack itemstack = par1EntityLiving.getCurrentArmor(3 - par2); + ItemStack itemstack = par1EntityLiving.func_130225_q(3 - par2); @@ -79,7 +114,7 @@ if (item instanceof ItemArmor) { @@ -99,7 +99,7 @@ if (item instanceof ItemArmor) { - this.func_110776_a(func_110858_a((ItemArmor)item, par2, "overlay")); -+ this.func_110776_a(getArmorResource(par1, itemstack, par2, "overlay")); ++ this.func_110776_a(getArmorResource(par1EntityLiving, itemstack, par2, "overlay")); float f1 = 1.0F; GL11.glColor3f(f1, f1, f1); } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch index 4c02a8ce7..9fb843102 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch @@ -66,23 +66,23 @@ if (item instanceof ItemArmor) { - this.func_110776_a(RenderBiped.func_110858_a((ItemArmor)item, par2, "overlay")); -+ this.func_110776_a(RenderBiped.getArmorResource(par1, itemstack, par2, "overlay")); ++ this.func_110776_a(RenderBiped.getArmorResource(par1AbstractClientPlayer, itemstack, par2, "overlay")); float f1 = 1.0F; GL11.glColor3f(f1, f1, f1); } @@ -117,6 +135,7 @@ - public void renderPlayer(AbstractClientPlayer par1, double par2, double par4, double par6, float par8, float par9) + public void func_130009_a(AbstractClientPlayer par1AbstractClientPlayer, double par2, double par4, double par6, float par8, float par9) { -+ if (MinecraftForge.EVENT_BUS.post(new RenderPlayerEvent.Pre(par1, this))) return; ++ if (MinecraftForge.EVENT_BUS.post(new RenderPlayerEvent.Pre(par1AbstractClientPlayer, this))) return; float f2 = 1.0F; GL11.glColor3f(f2, f2, f2); - ItemStack itemstack = par1.inventory.getCurrentItem(); + ItemStack itemstack = par1AbstractClientPlayer.inventory.getCurrentItem(); @@ -148,6 +167,7 @@ this.modelArmorChestplate.aimedBow = this.modelArmor.aimedBow = this.modelBipedMain.aimedBow = false; this.modelArmorChestplate.isSneak = this.modelArmor.isSneak = this.modelBipedMain.isSneak = false; this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = 0; -+ MinecraftForge.EVENT_BUS.post(new RenderPlayerEvent.Post(par1, this)); ++ MinecraftForge.EVENT_BUS.post(new RenderPlayerEvent.Post(par1AbstractClientPlayer, this)); } protected ResourceLocation func_110817_a(AbstractClientPlayer par1AbstractClientPlayer) diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch index 4a095b302..8eae647b0 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/texture/Stitcher.java +++ ../src_work/minecraft/net/minecraft/client/renderer/texture/Stitcher.java -@@ -186,7 +186,7 @@ +@@ -187,7 +187,7 @@ if (flag4 ^ flag5) { diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch index 0df267583..f01464714 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch @@ -10,7 +10,7 @@ import net.minecraft.client.resources.data.AnimationMetadataSection; import net.minecraft.util.Icon; @@ -184,6 +186,20 @@ - this.height = par1; + this.field_130224_d = par1; } + /** diff --git a/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch b/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch index 378a68cc9..aa89ba867 100644 --- a/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch +++ b/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch @@ -74,7 +74,7 @@ } } -@@ -228,4 +259,26 @@ +@@ -232,4 +263,26 @@ } } } diff --git a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch index ba8fb5409..8b1261622 100644 --- a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch @@ -10,7 +10,7 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; -@@ -205,6 +208,27 @@ +@@ -207,6 +210,27 @@ return this.type.canEnchantItem(par1ItemStack.getItem()); } @@ -32,7 +32,7 @@ + */ + public static void addToBookList(Enchantment enchantment) + { -+ ObjectArrays.concat(field_92090_c, enchantment); ++ ObjectArrays.concat(enchantmentsBookList, enchantment); + } + static diff --git a/patches/minecraft/net/minecraft/entity/Entity.java.patch b/patches/minecraft/net/minecraft/entity/Entity.java.patch index beb0443d0..9185eb779 100644 --- a/patches/minecraft/net/minecraft/entity/Entity.java.patch +++ b/patches/minecraft/net/minecraft/entity/Entity.java.patch @@ -72,7 +72,7 @@ } protected abstract void entityInit(); -@@ -1515,6 +1543,21 @@ +@@ -1523,6 +1551,21 @@ par1NBTTagCompound.setInteger("PortalCooldown", this.timeUntilPortal); par1NBTTagCompound.setLong("UUIDMost", this.entityUniqueID.getMostSignificantBits()); par1NBTTagCompound.setLong("UUIDLeast", this.entityUniqueID.getLeastSignificantBits()); @@ -94,7 +94,7 @@ this.writeEntityToNBT(par1NBTTagCompound); if (this.ridingEntity != null) -@@ -1585,6 +1628,26 @@ +@@ -1593,6 +1636,26 @@ this.setPosition(this.posX, this.posY, this.posZ); this.setRotation(this.rotationYaw, this.rotationPitch); @@ -119,9 +119,9 @@ + this.entityUniqueID = new UUID(par1NBTTagCompound.getLong("PersistentIDMSB"), par1NBTTagCompound.getLong("PersistentIDLSB")); + } this.readEntityFromNBT(par1NBTTagCompound); - } - catch (Throwable throwable) -@@ -1687,7 +1750,14 @@ + + if (this.func_142008_O()) +@@ -1705,7 +1768,14 @@ { EntityItem entityitem = new EntityItem(this.worldObj, this.posX, this.posY + (double)par2, this.posZ, par1ItemStack); entityitem.delayBeforeCanPickup = 10; @@ -137,7 +137,7 @@ return entityitem; } } -@@ -1985,7 +2055,7 @@ +@@ -2001,7 +2071,7 @@ */ public boolean isRiding() { @@ -146,7 +146,7 @@ } /** -@@ -2344,7 +2414,7 @@ +@@ -2363,7 +2433,7 @@ public float func_82146_a(Explosion par1Explosion, World par2World, int par3, int par4, int par5, Block par6Block) { @@ -155,7 +155,7 @@ } public boolean func_96091_a(Explosion par1Explosion, World par2World, int par3, int par4, int par5, int par6, float par7) -@@ -2407,4 +2477,145 @@ +@@ -2426,4 +2496,149 @@ { return this.getEntityName(); } @@ -216,6 +216,10 @@ + return held.copy(); + } + } ++ else if (this instanceof EntityLeashKnot) ++ { ++ return new ItemStack(Item.field_111214_ch); ++ } + else + { + int id = EntityList.getEntityID(this); diff --git a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch index 294439ab0..02b126c4d 100644 --- a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/entity/EntityLivingBase.java +++ ../src_work/minecraft/net/minecraft/entity/EntityLivingBase.java -@@ -21,9 +21,11 @@ +@@ -20,9 +20,11 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityXPOrb; import net.minecraft.entity.monster.EntityZombie; @@ -20,15 +20,15 @@ public abstract class EntityLivingBase extends Entity { -@@ -451,6 +454,7 @@ +@@ -446,6 +449,7 @@ { this.entityLivingToAttack = par1EntityLivingBase; - this.revengeTimer = this.entityLivingToAttack != null ? 100 : 0; + this.revengeTimer = this.ticksExisted; + ForgeHooks.onLivingSetAttackTarget(this, par1EntityLivingBase); } public EntityLivingBase func_110144_aD() -@@ -738,8 +742,6 @@ +@@ -744,8 +748,6 @@ return this.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD; } @@ -37,7 +37,7 @@ /** * Remove the speified potion effect from this entity. */ -@@ -824,6 +826,7 @@ +@@ -826,6 +828,7 @@ */ public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) { @@ -45,7 +45,7 @@ if (this.isEntityInvulnerable()) { return false; -@@ -974,6 +977,7 @@ +@@ -976,6 +979,7 @@ */ public void onDeath(DamageSource par1DamageSource) { @@ -53,7 +53,7 @@ Entity entity = par1DamageSource.getEntity(); EntityLivingBase entitylivingbase = this.func_94060_bK(); -@@ -998,6 +1002,10 @@ +@@ -1000,6 +1004,10 @@ i = EnchantmentHelper.getLootingModifier((EntityLivingBase)entity); } @@ -64,7 +64,7 @@ if (!this.isChild() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) { this.dropFewItems(this.recentlyHit > 0, i); -@@ -1005,12 +1013,22 @@ +@@ -1007,12 +1015,22 @@ if (this.recentlyHit > 0) { @@ -88,7 +88,7 @@ } } } -@@ -1080,7 +1098,7 @@ +@@ -1082,7 +1100,7 @@ int j = MathHelper.floor_double(this.boundingBox.minY); int k = MathHelper.floor_double(this.posZ); int l = this.worldObj.getBlockId(i, j, k); @@ -97,7 +97,7 @@ } /** -@@ -1096,6 +1114,8 @@ +@@ -1098,6 +1116,8 @@ */ protected void fall(float par1) { @@ -106,7 +106,7 @@ super.fall(par1); PotionEffect potioneffect = this.getActivePotionEffect(Potion.jump); float f1 = potioneffect != null ? (float)(potioneffect.getAmplifier() + 1) : 0.0F; -@@ -1229,6 +1249,8 @@ +@@ -1231,6 +1251,8 @@ { if (!this.isEntityInvulnerable()) { @@ -115,7 +115,7 @@ par2 = this.applyArmorCalculations(par1DamageSource, par2); par2 = this.applyPotionDamageCalculations(par1DamageSource, par2); float f1 = par2; -@@ -1290,6 +1312,17 @@ +@@ -1292,6 +1314,17 @@ */ public void swingItem() { @@ -133,7 +133,7 @@ if (!this.isSwingInProgress || this.field_110158_av >= this.getArmSwingAnimationEnd() / 2 || this.field_110158_av < 0) { this.field_110158_av = -1; -@@ -1531,6 +1564,7 @@ +@@ -1526,6 +1559,7 @@ } this.isAirBorne = true; @@ -141,7 +141,7 @@ } /** -@@ -1735,6 +1769,11 @@ +@@ -1730,6 +1764,11 @@ */ public void onUpdate() { @@ -153,9 +153,9 @@ super.onUpdate(); if (!this.worldObj.isRemote) -@@ -2255,4 +2294,42 @@ - - this.field_110151_bq = par1; +@@ -2265,4 +2304,42 @@ + { + return this.getTeam() != null ? this.getTeam().func_142054_a(par1Team) : false; } + + /*** diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch index a43ef0e88..c1d216a14 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch @@ -294,7 +294,7 @@ { par1Entity.motionX *= 0.20000000298023224D; par1Entity.motionZ *= 0.20000000298023224D; -@@ -1165,4 +1190,211 @@ +@@ -1168,4 +1193,211 @@ { return this.entityName; } diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch index 7e9ccb2ac..b7df911fc 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -12,7 +12,7 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockBed; import net.minecraft.block.material.Material; -@@ -68,8 +71,21 @@ +@@ -66,8 +69,21 @@ import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; @@ -34,7 +34,7 @@ /** Inventory of the player */ public InventoryPlayer inventory = new InventoryPlayer(this); private InventoryEnderChest theInventoryEnderChest = new InventoryEnderChest(); -@@ -122,11 +138,13 @@ +@@ -120,11 +136,13 @@ * Holds the last coordinate to spawn based on last bed that the player sleep. */ private ChunkCoordinates spawnChunk; @@ -48,7 +48,7 @@ /** Holds the coordinate of the player when enter a minecraft to ride. */ private ChunkCoordinates startMinecartRidingCoordinate; -@@ -269,6 +287,7 @@ +@@ -267,6 +285,7 @@ if (itemstack == this.itemInUse) { @@ -56,7 +56,7 @@ if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0) { this.updateItemUse(itemstack, 5); -@@ -539,11 +558,11 @@ +@@ -537,11 +556,11 @@ this.cameraYaw = 0.0F; this.addMountedMovementStat(this.posX - d0, this.posY - d1, this.posZ - d2); @@ -70,7 +70,7 @@ } } } -@@ -686,11 +705,15 @@ +@@ -684,11 +703,15 @@ */ public void onDeath(DamageSource par1DamageSource) { @@ -86,7 +86,7 @@ if (this.username.equals("Notch")) { this.dropPlayerItemWithRandomChoice(new ItemStack(Item.appleRed, 1), true); -@@ -699,6 +722,20 @@ +@@ -697,6 +720,20 @@ if (!this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) { this.inventory.dropAllItems(); @@ -107,7 +107,7 @@ } if (par1DamageSource != null) -@@ -749,7 +786,20 @@ +@@ -747,7 +784,20 @@ */ public EntityItem dropOneItem(boolean par1) { @@ -129,7 +129,7 @@ } /** -@@ -758,7 +808,7 @@ +@@ -756,7 +806,7 @@ */ public EntityItem dropPlayerItem(ItemStack par1ItemStack) { @@ -138,7 +138,7 @@ } /** -@@ -814,15 +864,28 @@ +@@ -812,15 +862,28 @@ */ public void joinEntityItemWithWorld(EntityItem par1EntityItem) { @@ -169,7 +169,7 @@ if (f > 1.0F) { -@@ -833,7 +896,9 @@ +@@ -831,7 +894,9 @@ { float f1 = (float)(i * i + 1); @@ -180,7 +180,7 @@ { f += f1 * 0.08F; } -@@ -864,7 +929,8 @@ +@@ -862,7 +927,8 @@ f /= 5.0F; } @@ -190,7 +190,7 @@ } /** -@@ -872,7 +938,7 @@ +@@ -870,7 +936,7 @@ */ public boolean canHarvestBlock(Block par1Block) { @@ -199,7 +199,7 @@ } /** -@@ -902,6 +968,14 @@ +@@ -900,6 +966,14 @@ this.spawnChunk = new ChunkCoordinates(par1NBTTagCompound.getInteger("SpawnX"), par1NBTTagCompound.getInteger("SpawnY"), par1NBTTagCompound.getInteger("SpawnZ")); this.spawnForced = par1NBTTagCompound.getBoolean("SpawnForced"); } @@ -214,7 +214,7 @@ this.foodStats.readNBT(par1NBTTagCompound); this.capabilities.readCapabilitiesFromNBT(par1NBTTagCompound); -@@ -935,6 +1009,21 @@ +@@ -933,6 +1007,21 @@ par1NBTTagCompound.setInteger("SpawnZ", this.spawnChunk.posZ); par1NBTTagCompound.setBoolean("SpawnForced", this.spawnForced); } @@ -236,7 +236,7 @@ this.foodStats.writeNBT(par1NBTTagCompound); this.capabilities.writeCapabilitiesToNBT(par1NBTTagCompound); -@@ -982,6 +1071,7 @@ +@@ -980,6 +1069,7 @@ */ public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) { @@ -244,7 +244,7 @@ if (this.isEntityInvulnerable()) { return false; -@@ -1135,12 +1225,15 @@ +@@ -1088,12 +1178,15 @@ { if (!this.isEntityInvulnerable()) { @@ -261,7 +261,7 @@ par2 = this.applyPotionDamageCalculations(par1DamageSource, par2); float f1 = par2; par2 = Math.max(par2 - this.func_110139_bj(), 0.0F); -@@ -1190,6 +1283,7 @@ +@@ -1143,6 +1236,7 @@ public boolean interactWith(Entity par1Entity) { @@ -269,7 +269,7 @@ ItemStack itemstack = this.getCurrentEquippedItem(); ItemStack itemstack1 = itemstack != null ? itemstack.copy() : null; -@@ -1246,7 +1340,9 @@ +@@ -1199,7 +1293,9 @@ */ public void destroyCurrentEquippedItem() { @@ -279,7 +279,7 @@ } /** -@@ -1263,6 +1359,15 @@ +@@ -1216,6 +1312,15 @@ */ public void attackTargetEntityWithCurrentItem(Entity par1Entity) { @@ -295,7 +295,7 @@ if (par1Entity.canAttackWithItem()) { if (!par1Entity.func_85031_j(this)) -@@ -1421,6 +1526,12 @@ +@@ -1369,6 +1474,12 @@ */ public EnumStatus sleepInBedAt(int par1, int par2, int par3) { @@ -308,7 +308,7 @@ if (!this.worldObj.isRemote) { if (this.isPlayerSleeping() || !this.isEntityAlive()) -@@ -1465,6 +1576,11 @@ +@@ -1413,6 +1524,11 @@ { int l = this.worldObj.getBlockMetadata(par1, par2, par3); int i1 = BlockBed.getDirection(l); @@ -320,7 +320,7 @@ float f = 0.5F; float f1 = 0.5F; -@@ -1535,10 +1651,12 @@ +@@ -1483,10 +1599,12 @@ ChunkCoordinates chunkcoordinates = this.playerLocation; ChunkCoordinates chunkcoordinates1 = this.playerLocation; @@ -337,7 +337,7 @@ if (chunkcoordinates1 == null) { -@@ -1575,7 +1693,9 @@ +@@ -1523,7 +1641,9 @@ */ private boolean isInBed() { @@ -348,7 +348,7 @@ } /** -@@ -1590,9 +1710,12 @@ +@@ -1538,9 +1658,12 @@ ichunkprovider.loadChunk(par1ChunkCoordinates.posX - 3 >> 4, par1ChunkCoordinates.posZ + 3 >> 4); ichunkprovider.loadChunk(par1ChunkCoordinates.posX + 3 >> 4, par1ChunkCoordinates.posZ + 3 >> 4); @@ -364,7 +364,7 @@ return chunkcoordinates1; } else -@@ -1614,10 +1737,13 @@ +@@ -1562,10 +1685,13 @@ { if (this.playerLocation != null) { @@ -382,7 +382,7 @@ { case 0: return 90.0F; -@@ -1683,14 +1809,40 @@ +@@ -1631,14 +1757,40 @@ /** * Returns the location of the bed the player will respawn at, or null if the player has not slept in a bed. */ @@ -427,7 +427,7 @@ } /** -@@ -1698,6 +1850,10 @@ +@@ -1646,6 +1798,10 @@ */ public void setSpawnChunk(ChunkCoordinates par1ChunkCoordinates, boolean par2) { @@ -438,7 +438,7 @@ if (par1ChunkCoordinates != null) { this.spawnChunk = new ChunkCoordinates(par1ChunkCoordinates); -@@ -1709,7 +1865,32 @@ +@@ -1657,7 +1813,32 @@ this.spawnForced = false; } } @@ -472,7 +472,7 @@ /** * Will trigger the specified trigger. */ -@@ -1891,6 +2072,10 @@ +@@ -1839,6 +2020,10 @@ super.fall(par1); } @@ -483,7 +483,7 @@ } /** -@@ -1932,7 +2117,7 @@ +@@ -1880,7 +2065,7 @@ { if (par1ItemStack.getItem().requiresMultipleRenderPasses()) { @@ -492,7 +492,7 @@ } if (this.itemInUse != null && par1ItemStack.itemID == Item.bow.itemID) -@@ -1954,6 +2139,7 @@ +@@ -1902,6 +2087,7 @@ return Item.bow.getItemIconForUseDuration(0); } } @@ -500,7 +500,7 @@ } return icon; -@@ -2175,7 +2361,17 @@ +@@ -2123,7 +2309,17 @@ this.setScore(par1EntityPlayer.getScore()); } @@ -518,7 +518,7 @@ } /** -@@ -2239,7 +2435,14 @@ +@@ -2187,7 +2383,14 @@ */ public void setCurrentItemOrArmor(int par1, ItemStack par2ItemStack) { diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch index 42c1ddec7..47870a682 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/entity/player/EntityPlayerMP.java +++ ../src_work/minecraft/net/minecraft/entity/player/EntityPlayerMP.java -@@ -90,6 +90,12 @@ +@@ -92,6 +92,12 @@ import net.minecraft.world.WorldServer; import net.minecraft.world.chunk.Chunk; @@ -13,7 +13,7 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting { private String translator = "en_US"; -@@ -162,18 +168,10 @@ +@@ -164,18 +170,10 @@ par4ItemInWorldManager.thisPlayerMP = this; this.theItemInWorldManager = par4ItemInWorldManager; this.renderDistance = par1MinecraftServer.getConfigurationManager().getViewDistance(); @@ -33,7 +33,7 @@ this.mcServer = par1MinecraftServer; this.stepHeight = 0.0F; -@@ -287,7 +285,10 @@ +@@ -289,7 +287,10 @@ if (chunkcoordintpair != null && this.worldObj.blockExists(chunkcoordintpair.chunkXPos << 4, 0, chunkcoordintpair.chunkZPos << 4)) { arraylist.add(this.worldObj.getChunkFromChunkCoords(chunkcoordintpair.chunkXPos, chunkcoordintpair.chunkZPos)); @@ -45,7 +45,7 @@ } } -@@ -308,6 +309,7 @@ +@@ -310,6 +311,7 @@ { Chunk chunk = (Chunk)iterator2.next(); this.getServerForPlayer().getEntityTracker().func_85172_a(this, chunk); @@ -53,7 +53,7 @@ } } } -@@ -375,11 +377,25 @@ +@@ -377,11 +379,25 @@ */ public void onDeath(DamageSource par1DamageSource) { diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches/minecraft/net/minecraft/item/Item.java.patch index 9f9f13587..3a8c1c914 100644 --- a/patches/minecraft/net/minecraft/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -66,7 +66,7 @@ Vec3 vec31 = vec3.addVector((double)f7 * d3, (double)f6 * d3, (double)f8 * d3); return par1World.rayTraceBlocks_do_do(vec3, vec31, par3, !par3); } -@@ -736,4 +751,514 @@ +@@ -740,4 +755,514 @@ { StatList.initStats(); } diff --git a/patches/minecraft/net/minecraft/item/ItemInWorldManager.java.patch b/patches/minecraft/net/minecraft/item/ItemInWorldManager.java.patch index b17bb9490..61c281d30 100644 --- a/patches/minecraft/net/minecraft/item/ItemInWorldManager.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemInWorldManager.java.patch @@ -22,7 +22,7 @@ @@ -145,6 +156,13 @@ { - if (!this.gameType.isAdventure() || this.thisPlayerMP.canCurrentToolHarvestBlock(par1, par2, par3)) + if (!this.gameType.isAdventure() || this.thisPlayerMP.isCurrentToolAdventureModeExempt(par1, par2, par3)) { + PlayerInteractEvent event = ForgeEventFactory.onPlayerInteract(thisPlayerMP, Action.LEFT_CLICK_BLOCK, par1, par2, par3, par4); + if (event.isCanceled()) diff --git a/patches/minecraft/net/minecraft/item/crafting/CraftingManager.java.patch b/patches/minecraft/net/minecraft/item/crafting/CraftingManager.java.patch index 1b10fb147..14d3f9784 100644 --- a/patches/minecraft/net/minecraft/item/crafting/CraftingManager.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/CraftingManager.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/item/crafting/CraftingManager.java +++ ../src_work/minecraft/net/minecraft/item/crafting/CraftingManager.java -@@ -284,7 +284,7 @@ +@@ -283,7 +283,7 @@ } } diff --git a/patches/minecraft/net/minecraft/network/NetServerHandler.java.patch b/patches/minecraft/net/minecraft/network/NetServerHandler.java.patch index f84ab1514..4fcb41b71 100644 --- a/patches/minecraft/net/minecraft/network/NetServerHandler.java.patch +++ b/patches/minecraft/net/minecraft/network/NetServerHandler.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/network/NetServerHandler.java +++ ../src_work/minecraft/net/minecraft/network/NetServerHandler.java -@@ -69,6 +69,14 @@ +@@ -71,6 +71,14 @@ import net.minecraft.world.WorldServer; import org.apache.commons.lang3.StringUtils; @@ -15,7 +15,7 @@ public class NetServerHandler extends NetHandler { /** The underlying network manager for this server handler. */ -@@ -242,6 +250,11 @@ +@@ -221,6 +229,11 @@ if (this.playerEntity.ridingEntity != null) { this.playerEntity.ridingEntity.updateRiderPosition(); @@ -27,21 +27,22 @@ } this.mcServer.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity); -@@ -319,9 +332,9 @@ +@@ -300,9 +313,10 @@ d4 = d1 - this.playerEntity.posX; - double d6 = d2 - this.playerEntity.posY; - double d7 = d3 - this.playerEntity.posZ; -- double d8 = Math.min(Math.abs(d4), Math.abs(this.playerEntity.motionX)); -- double d9 = Math.min(Math.abs(d6), Math.abs(this.playerEntity.motionY)); -- double d10 = Math.min(Math.abs(d7), Math.abs(this.playerEntity.motionZ)); -+ double d8 = Math.max(Math.abs(d4), Math.abs(this.playerEntity.motionX)); -+ double d9 = Math.max(Math.abs(d6), Math.abs(this.playerEntity.motionY)); -+ double d10 = Math.max(Math.abs(d7), Math.abs(this.playerEntity.motionZ)); - double d11 = d8 * d8 + d9 * d9 + d10 * d10; + double d5 = d2 - this.playerEntity.posY; + double d6 = d3 - this.playerEntity.posZ; +- double d7 = Math.min(Math.abs(d4), Math.abs(this.playerEntity.motionX)); +- double d8 = Math.min(Math.abs(d5), Math.abs(this.playerEntity.motionY)); +- double d9 = Math.min(Math.abs(d6), Math.abs(this.playerEntity.motionZ)); ++ //BUGFIX: min -> max, grabs the highest distance ++ double d7 = Math.max(Math.abs(d4), Math.abs(this.playerEntity.motionX)); ++ double d8 = Math.max(Math.abs(d5), Math.abs(this.playerEntity.motionY)); ++ double d9 = Math.max(Math.abs(d6), Math.abs(this.playerEntity.motionZ)); + double d10 = d7 * d7 + d8 * d8 + d9 * d9; - if (d11 > 100.0D && (!this.mcServer.isSinglePlayer() || !this.mcServer.getServerOwner().equals(this.playerEntity.getCommandSenderName()))) -@@ -337,6 +350,11 @@ - if (this.playerEntity.onGround && !par1Packet10Flying.onGround && d6 > 0.0D) + if (d10 > 100.0D && (!this.mcServer.isSinglePlayer() || !this.mcServer.getServerOwner().equals(this.playerEntity.getCommandSenderName()))) +@@ -318,6 +332,11 @@ + if (this.playerEntity.onGround && !par1Packet10Flying.onGround && d5 > 0.0D) { this.playerEntity.addExhaustion(0.2F); + } @@ -51,8 +52,8 @@ + return; } - this.playerEntity.moveEntity(d4, d6, d7); -@@ -361,10 +379,15 @@ + this.playerEntity.moveEntity(d4, d5, d6); +@@ -342,10 +361,15 @@ this.mcServer.getLogAgent().logWarning(this.playerEntity.getCommandSenderName() + " moved wrongly!"); } @@ -69,16 +70,16 @@ { this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ, f2, f3); return; -@@ -372,7 +395,7 @@ +@@ -353,7 +377,7 @@ AxisAlignedBB axisalignedbb = this.playerEntity.boundingBox.copy().expand((double)f4, (double)f4, (double)f4).addCoord(0.0D, -0.55D, 0.0D); - if (!this.mcServer.isFlightAllowed() && !this.playerEntity.theItemInWorldManager.isCreative() && !worldserver.checkBlockCollision(axisalignedbb)) + if (!this.mcServer.isFlightAllowed() && !this.playerEntity.theItemInWorldManager.isCreative() && !worldserver.checkBlockCollision(axisalignedbb) && !this.playerEntity.capabilities.allowFlying) { - if (d12 >= -0.03125D) + if (d11 >= -0.03125D) { -@@ -391,6 +414,11 @@ +@@ -372,6 +396,11 @@ this.ticksForFloatKick = 0; } @@ -90,7 +91,7 @@ this.playerEntity.onGround = par1Packet10Flying.onGround; this.mcServer.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity); this.playerEntity.updateFlyingState(this.playerEntity.posY - d0, par1Packet10Flying.onGround); -@@ -461,7 +489,10 @@ +@@ -442,7 +471,10 @@ double d2 = this.playerEntity.posZ - ((double)k + 0.5D); double d3 = d0 * d0 + d1 * d1 + d2 * d2; @@ -102,7 +103,7 @@ { return; } -@@ -521,7 +552,11 @@ +@@ -502,7 +534,11 @@ return; } @@ -115,7 +116,7 @@ } else if (par1Packet15Place.getYPosition() >= this.mcServer.getBuildLimit() - 1 && (par1Packet15Place.getDirection() == 1 || par1Packet15Place.getYPosition() >= this.mcServer.getBuildLimit())) { -@@ -530,7 +565,9 @@ +@@ -511,7 +547,9 @@ } else { @@ -126,7 +127,7 @@ { this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, worldserver, itemstack, i, j, k, l, par1Packet15Place.getXOffset(), par1Packet15Place.getYOffset(), par1Packet15Place.getZOffset()); } -@@ -710,6 +747,8 @@ +@@ -691,6 +729,8 @@ } ChatMessageComponent chatmessagecomponent = ChatMessageComponent.func_111082_b("chat.type.text", new Object[] {this.playerEntity.getTranslatedEntityName(), s}); @@ -135,7 +136,7 @@ this.mcServer.getConfigurationManager().func_110459_a(chatmessagecomponent, false); } -@@ -850,7 +889,7 @@ +@@ -838,7 +878,7 @@ return; } diff --git a/patches/minecraft/net/minecraft/server/management/PlayerInstance.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerInstance.java.patch index 3b10eecf9..5e1704aa5 100644 --- a/patches/minecraft/net/minecraft/server/management/PlayerInstance.java.patch +++ b/patches/minecraft/net/minecraft/server/management/PlayerInstance.java.patch @@ -18,7 +18,7 @@ public class PlayerInstance { -@@ -63,6 +67,8 @@ +@@ -60,6 +64,8 @@ this.playersInChunk.remove(par1EntityPlayerMP); par1EntityPlayerMP.loadedChunks.remove(this.chunkLocation); @@ -27,7 +27,7 @@ if (this.playersInChunk.isEmpty()) { long i = (long)this.chunkLocation.chunkXPos + 2147483647L | (long)this.chunkLocation.chunkZPos + 2147483647L << 32; -@@ -100,7 +106,7 @@ +@@ -97,7 +103,7 @@ this.field_73260_f |= 1 << (par2 >> 4); @@ -36,7 +36,7 @@ { short short1 = (short)(par1 << 12 | par3 << 8 | par2); -@@ -112,6 +118,10 @@ +@@ -109,6 +115,10 @@ } } @@ -47,7 +47,7 @@ this.locationOfBlockChange[this.numberOfTilesToUpdate++] = short1; } } -@@ -153,12 +163,13 @@ +@@ -150,12 +160,13 @@ { int l; @@ -62,7 +62,7 @@ for (k = 0; k < 16; ++k) { if ((this.field_73260_f & 1 << k) != 0) -@@ -172,11 +183,14 @@ +@@ -169,11 +180,14 @@ } } } diff --git a/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch b/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch index 331f53fd2..337f3c861 100644 --- a/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/server/management/ServerConfigurationManager.java +++ ../src_work/minecraft/net/minecraft/server/management/ServerConfigurationManager.java -@@ -48,10 +48,14 @@ +@@ -52,10 +52,14 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.MathHelper; import net.minecraft.world.EnumGameType; @@ -15,7 +15,7 @@ public abstract class ServerConfigurationManager { -@@ -387,13 +391,23 @@ +@@ -392,13 +396,23 @@ */ public EntityPlayerMP respawnPlayer(EntityPlayerMP par1EntityPlayerMP, int par2, boolean par3) { @@ -41,7 +41,7 @@ par1EntityPlayerMP.dimension = par2; Object object; -@@ -409,6 +423,7 @@ +@@ -414,6 +428,7 @@ EntityPlayerMP entityplayermp1 = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension), par1EntityPlayerMP.getCommandSenderName(), (ItemInWorldManager)object); entityplayermp1.playerNetServerHandler = par1EntityPlayerMP.playerNetServerHandler; entityplayermp1.clonePlayer(par1EntityPlayerMP, par3); @@ -49,7 +49,7 @@ entityplayermp1.entityId = par1EntityPlayerMP.entityId; WorldServer worldserver = this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension); this.func_72381_a(entityplayermp1, par1EntityPlayerMP, worldserver); -@@ -453,6 +468,11 @@ +@@ -458,6 +473,11 @@ public void transferPlayerToDimension(EntityPlayerMP par1EntityPlayerMP, int par2) { @@ -61,7 +61,7 @@ int j = par1EntityPlayerMP.dimension; WorldServer worldserver = this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension); par1EntityPlayerMP.dimension = par2; -@@ -460,7 +480,7 @@ +@@ -465,7 +485,7 @@ par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet9Respawn(par1EntityPlayerMP.dimension, (byte)par1EntityPlayerMP.worldObj.difficultySetting, worldserver1.getWorldInfo().getTerrainType(), worldserver1.getHeight(), par1EntityPlayerMP.theItemInWorldManager.getGameType())); worldserver.removePlayerEntityDangerously(par1EntityPlayerMP); par1EntityPlayerMP.isDead = false; @@ -70,7 +70,7 @@ this.func_72375_a(par1EntityPlayerMP, worldserver); par1EntityPlayerMP.playerNetServerHandler.setPlayerLocation(par1EntityPlayerMP.posX, par1EntityPlayerMP.posY, par1EntityPlayerMP.posZ, par1EntityPlayerMP.rotationYaw, par1EntityPlayerMP.rotationPitch); par1EntityPlayerMP.theItemInWorldManager.setWorld(worldserver1); -@@ -482,38 +502,23 @@ +@@ -487,38 +507,23 @@ */ public void transferEntityToWorld(Entity par1Entity, int par2, WorldServer par3WorldServer, WorldServer par4WorldServer) { @@ -120,7 +120,7 @@ { ChunkCoordinates chunkcoordinates; -@@ -550,7 +555,7 @@ +@@ -555,7 +560,7 @@ par4WorldServer.spawnEntityInWorld(par1Entity); par1Entity.setLocationAndAngles(d0, par1Entity.posY, d1, par1Entity.rotationYaw, par1Entity.rotationPitch); par4WorldServer.updateEntityWithOptionalForce(par1Entity, false); diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch index 31a154441..12f2d86b8 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch @@ -12,7 +12,7 @@ import net.minecraft.world.World; public class TileEntity -@@ -308,4 +311,93 @@ +@@ -311,4 +314,93 @@ addMapping(TileEntityHopper.class, "Hopper"); addMapping(TileEntityComparator.class, "Comparator"); } diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch index 570091bca..1ad51bf08 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch @@ -47,7 +47,7 @@ @@ -343,7 +347,7 @@ */ - public boolean isStackValidForSlot(int par1, ItemStack par2ItemStack) + public boolean isItemValidForSlot(int par1, ItemStack par2ItemStack) { - return par1 == 3 ? Item.itemsList[par2ItemStack.itemID].isPotionIngredient() : par2ItemStack.itemID == Item.potion.itemID || par2ItemStack.itemID == Item.glassBottle.itemID; + return par1 == 3 ? Item.itemsList[par2ItemStack.itemID].isPotionIngredient() : par2ItemStack.getItem() instanceof ItemPotion || par2ItemStack.itemID == Item.glassBottle.itemID; diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch index e30701e53..d4bccd0b1 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch @@ -19,9 +19,9 @@ + +public class TileEntityFurnace extends TileEntity implements ISidedInventory, net.minecraftforge.common.ISidedInventory { - private static final int[] field_102010_d = new int[] {0}; - private static final int[] field_102011_e = new int[] {2, 1}; -@@ -276,8 +279,7 @@ + private static final int[] slots_top = new int[] {0}; + private static final int[] slots_bottom = new int[] {2, 1}; +@@ -279,8 +282,7 @@ if (this.furnaceItemStacks[1].stackSize == 0) { @@ -31,7 +31,7 @@ } } } -@@ -323,8 +325,12 @@ +@@ -326,8 +328,12 @@ } else { @@ -46,7 +46,7 @@ } } -@@ -335,15 +341,15 @@ +@@ -338,15 +344,15 @@ { if (this.canSmelt()) { @@ -66,7 +66,7 @@ } --this.furnaceItemStacks[0].stackSize; -@@ -370,7 +376,7 @@ +@@ -373,7 +379,7 @@ int i = par0ItemStack.getItem().itemID; Item item = par0ItemStack.getItem(); @@ -75,7 +75,7 @@ { Block block = Block.blocksList[i]; -@@ -456,4 +462,50 @@ +@@ -459,4 +465,50 @@ { return par3 != 0 || par1 != 1 || par2ItemStack.itemID == Item.bucketEmpty.itemID; } diff --git a/patches/minecraft/net/minecraft/world/World.java.patch b/patches/minecraft/net/minecraft/world/World.java.patch index 27f1ff912..24994b6ac 100644 --- a/patches/minecraft/net/minecraft/world/World.java.patch +++ b/patches/minecraft/net/minecraft/world/World.java.patch @@ -163,7 +163,7 @@ } /** -@@ -1189,7 +1251,7 @@ +@@ -1192,7 +1254,7 @@ int l1 = this.getBlockMetadata(l, i1, j1); Block block = Block.blocksList[k1]; @@ -172,7 +172,7 @@ { MovingObjectPosition movingobjectposition = block.collisionRayTrace(this, l, i1, j1, par1Vec3, par2Vec3); -@@ -1389,6 +1451,12 @@ +@@ -1392,6 +1454,12 @@ */ public void playSoundAtEntity(Entity par1Entity, String par2Str, float par3, float par4) { @@ -185,7 +185,7 @@ if (par1Entity != null && par2Str != null) { for (int i = 0; i < this.worldAccesses.size(); ++i) -@@ -1403,6 +1471,12 @@ +@@ -1406,6 +1474,12 @@ */ public void playSoundToNearExcept(EntityPlayer par1EntityPlayer, String par2Str, float par3, float par4) { @@ -198,7 +198,7 @@ if (par1EntityPlayer != null && par2Str != null) { for (int i = 0; i < this.worldAccesses.size(); ++i) -@@ -1489,6 +1563,11 @@ +@@ -1492,6 +1566,11 @@ EntityPlayer entityplayer = (EntityPlayer)par1Entity; this.playerEntities.add(entityplayer); this.updateAllPlayersSleepingFlag(); @@ -210,7 +210,7 @@ } this.getChunkFromChunkCoords(i, j).addEntity(par1Entity); -@@ -1735,6 +1814,12 @@ +@@ -1732,6 +1811,12 @@ * Calculates the color for the skybox */ public Vec3 getSkyColor(Entity par1Entity, float par2) @@ -223,7 +223,7 @@ { float f1 = this.getCelestialAngle(par2); float f2 = MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; -@@ -1833,6 +1918,12 @@ +@@ -1830,6 +1915,12 @@ @SideOnly(Side.CLIENT) public Vec3 getCloudColour(float par1) { @@ -236,7 +236,7 @@ float f1 = this.getCelestialAngle(par1); float f2 = MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; -@@ -1904,6 +1995,8 @@ +@@ -1901,6 +1992,8 @@ public int getTopSolidOrLiquidBlock(int par1, int par2) { Chunk chunk = this.getChunkFromBlockCoords(par1, par2); @@ -245,7 +245,7 @@ int k = chunk.getTopFilledSegment() + 15; par1 &= 15; -@@ -1911,7 +2004,7 @@ +@@ -1908,7 +2001,7 @@ { int l = chunk.getBlockID(par1, k, par2); @@ -254,7 +254,7 @@ { return k + 1; } -@@ -1926,6 +2019,12 @@ +@@ -1923,6 +2016,12 @@ * How bright are stars in the sky */ public float getStarBrightness(float par1) @@ -267,7 +267,7 @@ { float f1 = this.getCelestialAngle(par1); float f2 = 1.0F - (MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.25F); -@@ -1990,7 +2089,15 @@ +@@ -1987,7 +2086,15 @@ entity.func_85029_a(crashreportcategory); } @@ -284,7 +284,7 @@ } if (entity.isDead) -@@ -2052,7 +2159,16 @@ +@@ -2049,7 +2156,16 @@ crashreport = CrashReport.makeCrashReport(throwable1, "Ticking entity"); crashreportcategory = crashreport.makeCategory("Entity being ticked"); entity.func_85029_a(crashreportcategory); @@ -302,7 +302,7 @@ } } -@@ -2095,7 +2211,16 @@ +@@ -2092,7 +2208,16 @@ crashreport = CrashReport.makeCrashReport(throwable2, "Ticking tile entity"); crashreportcategory = crashreport.makeCategory("Tile entity being ticked"); tileentity.func_85027_a(crashreportcategory); @@ -320,7 +320,7 @@ } } -@@ -2109,7 +2234,7 @@ +@@ -2106,7 +2231,7 @@ if (chunk != null) { @@ -329,7 +329,7 @@ } } } -@@ -2118,6 +2243,10 @@ +@@ -2115,6 +2240,10 @@ if (!this.entityRemoval.isEmpty()) { @@ -340,7 +340,7 @@ this.loadedTileEntityList.removeAll(this.entityRemoval); this.entityRemoval.clear(); } -@@ -2138,18 +2267,18 @@ +@@ -2135,18 +2264,18 @@ { this.loadedTileEntityList.add(tileentity1); } @@ -363,7 +363,7 @@ } } -@@ -2162,13 +2291,13 @@ +@@ -2159,13 +2288,13 @@ public void addTileEntity(Collection par1Collection) { @@ -384,7 +384,7 @@ } } -@@ -2188,9 +2317,17 @@ +@@ -2185,9 +2314,17 @@ { int i = MathHelper.floor_double(par1Entity.posX); int j = MathHelper.floor_double(par1Entity.posZ); @@ -405,7 +405,7 @@ { par1Entity.lastTickPosX = par1Entity.posX; par1Entity.lastTickPosY = par1Entity.posY; -@@ -2423,6 +2560,14 @@ +@@ -2421,6 +2558,14 @@ { return true; } @@ -420,7 +420,7 @@ } } } -@@ -2745,15 +2890,16 @@ +@@ -2743,15 +2888,16 @@ */ public void setBlockTileEntity(int par1, int par2, int par3, TileEntity par4TileEntity) { @@ -446,7 +446,7 @@ while (iterator.hasNext()) { TileEntity tileentity1 = (TileEntity)iterator.next(); -@@ -2764,19 +2910,18 @@ +@@ -2762,19 +2908,18 @@ iterator.remove(); } } @@ -475,7 +475,7 @@ } } -@@ -2785,27 +2930,10 @@ +@@ -2783,27 +2928,10 @@ */ public void removeBlockTileEntity(int par1, int par2, int par3) { @@ -507,7 +507,7 @@ } } -@@ -2831,7 +2959,8 @@ +@@ -2829,7 +2957,8 @@ */ public boolean isBlockNormalCube(int par1, int par2, int par3) { @@ -516,8 +516,8 @@ + return block != null && block.isBlockNormalCube(this, par1, par2, par3); } - public boolean func_85174_u(int par1, int par2, int par3) -@@ -2854,16 +2983,17 @@ + public boolean isBlockFullCube(int par1, int par2, int par3) +@@ -2852,16 +2981,17 @@ */ public boolean doesBlockHaveSolidTopSurface(int par1, int par2, int par3) { @@ -537,7 +537,7 @@ return par1Block == null ? false : (par1Block.blockMaterial.isOpaque() && par1Block.renderAsNormalBlock() ? true : (par1Block instanceof BlockStairs ? (par2 & 4) == 4 : (par1Block instanceof BlockHalfSlab ? (par2 & 8) == 8 : (par1Block instanceof BlockHopper ? true : (par1Block instanceof BlockSnow ? (par2 & 7) == 7 : false))))); } -@@ -2880,7 +3010,7 @@ +@@ -2878,7 +3008,7 @@ if (chunk != null && !chunk.isEmpty()) { Block block = Block.blocksList[this.getBlockId(par1, par2, par3)]; @@ -546,7 +546,7 @@ } else { -@@ -2911,8 +3041,7 @@ +@@ -2909,8 +3039,7 @@ */ public void setAllowedSpawnTypes(boolean par1, boolean par2) { @@ -556,7 +556,7 @@ } /** -@@ -2928,6 +3057,11 @@ +@@ -2926,6 +3055,11 @@ */ private void calculateInitialWeather() { @@ -568,7 +568,7 @@ if (this.worldInfo.isRaining()) { this.rainingStrength = 1.0F; -@@ -2943,6 +3077,11 @@ +@@ -2941,6 +3075,11 @@ * Updates all weather states. */ protected void updateWeather() @@ -580,7 +580,7 @@ { if (!this.provider.hasNoSky) { -@@ -3040,12 +3179,14 @@ +@@ -3038,12 +3177,14 @@ public void toggleRain() { @@ -596,7 +596,7 @@ this.theProfiler.startSection("buildList"); int i; EntityPlayer entityplayer; -@@ -3152,6 +3293,11 @@ +@@ -3150,6 +3291,11 @@ */ public boolean canBlockFreeze(int par1, int par2, int par3, boolean par4) { @@ -608,7 +608,7 @@ BiomeGenBase biomegenbase = this.getBiomeGenForCoords(par1, par3); float f = biomegenbase.getFloatTemperature(); -@@ -3210,6 +3356,11 @@ +@@ -3208,6 +3354,11 @@ */ public boolean canSnowAt(int par1, int par2, int par3) { @@ -620,7 +620,7 @@ BiomeGenBase biomegenbase = this.getBiomeGenForCoords(par1, par3); float f = biomegenbase.getFloatTemperature(); -@@ -3253,10 +3404,12 @@ +@@ -3251,10 +3402,12 @@ else { int l = this.getBlockId(par1, par2, par3); @@ -637,7 +637,7 @@ { j1 = 1; } -@@ -3352,7 +3505,9 @@ +@@ -3350,7 +3503,9 @@ int j4 = i2 + Facing.offsetsXForSide[i4]; int k4 = j2 + Facing.offsetsYForSide[i4]; int l4 = k2 + Facing.offsetsZForSide[i4]; @@ -648,7 +648,7 @@ i3 = this.getSavedLightValue(par1EnumSkyBlock, j4, k4, l4); if (i3 == l2 - i5 && i1 < this.lightUpdateBlockList.length) -@@ -3455,10 +3610,10 @@ +@@ -3453,10 +3608,10 @@ public List getEntitiesWithinAABBExcludingEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB, IEntitySelector par3IEntitySelector) { ArrayList arraylist = new ArrayList(); @@ -663,7 +663,7 @@ for (int i1 = i; i1 <= j; ++i1) { -@@ -3484,10 +3639,10 @@ +@@ -3482,10 +3637,10 @@ public List selectEntitiesWithinAABB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, IEntitySelector par3IEntitySelector) { @@ -678,7 +678,7 @@ ArrayList arraylist = new ArrayList(); for (int i1 = i; i1 <= j; ++i1) -@@ -3580,11 +3735,14 @@ +@@ -3578,11 +3733,14 @@ */ public void addLoadedEntities(List par1List) { @@ -686,17 +686,17 @@ - for (int i = 0; i < par1List.size(); ++i) { -- this.obtainEntitySkin((Entity)par1List.get(i)); +- this.onEntityAdded((Entity)par1List.get(i)); + Entity entity = (Entity)par1List.get(i); + if (!MinecraftForge.EVENT_BUS.post(new EntityJoinWorldEvent(entity, this))) + { + loadedEntityList.add(entity); -+ this.obtainEntitySkin(entity); ++ this.onEntityAdded(entity); + } } } -@@ -3618,6 +3776,11 @@ +@@ -3616,6 +3774,11 @@ else { if (block != null && (block == Block.waterMoving || block == Block.waterStill || block == Block.lavaMoving || block == Block.lavaStill || block == Block.fire || block.blockMaterial.isReplaceable())) @@ -708,7 +708,7 @@ { block = null; } -@@ -3912,7 +4075,7 @@ +@@ -3910,7 +4073,7 @@ */ public long getSeed() { @@ -717,7 +717,7 @@ } public long getTotalWorldTime() -@@ -3922,7 +4085,7 @@ +@@ -3920,7 +4083,7 @@ public long getWorldTime() { @@ -726,7 +726,7 @@ } /** -@@ -3930,7 +4093,7 @@ +@@ -3928,7 +4091,7 @@ */ public void setWorldTime(long par1) { @@ -735,7 +735,7 @@ } /** -@@ -3938,13 +4101,13 @@ +@@ -3936,13 +4099,13 @@ */ public ChunkCoordinates getSpawnPoint() { @@ -751,7 +751,7 @@ } @SideOnly(Side.CLIENT) -@@ -3968,7 +4131,10 @@ +@@ -3966,7 +4129,10 @@ if (!this.loadedEntityList.contains(par1Entity)) { @@ -763,7 +763,7 @@ } } -@@ -3976,6 +4142,11 @@ +@@ -3974,6 +4140,11 @@ * Called when checking if a certain block can be mined or not. The 'spawn safe zone' check is located here. */ public boolean canMineBlock(EntityPlayer par1EntityPlayer, int par2, int par3, int par4) @@ -775,7 +775,7 @@ { return true; } -@@ -4096,8 +4267,7 @@ +@@ -4094,8 +4265,7 @@ */ public boolean isBlockHighHumidity(int par1, int par2, int par3) { @@ -785,7 +785,7 @@ } /** -@@ -4172,7 +4342,7 @@ +@@ -4170,7 +4340,7 @@ */ public int getHeight() { @@ -794,7 +794,7 @@ } /** -@@ -4180,7 +4350,7 @@ +@@ -4178,7 +4348,7 @@ */ public int getActualHeight() { @@ -803,7 +803,7 @@ } public IUpdatePlayerListBox func_82735_a(EntityMinecart par1EntityMinecart) -@@ -4223,7 +4393,7 @@ +@@ -4221,7 +4391,7 @@ */ public double getHorizon() { @@ -812,7 +812,7 @@ } /** -@@ -4351,4 +4521,115 @@ +@@ -4349,4 +4519,115 @@ return MathHelper.clamp_float(f, 0.0F, flag ? 1.5F : 1.0F); } diff --git a/patches/minecraft/net/minecraft/world/WorldServer.java.patch b/patches/minecraft/net/minecraft/world/WorldServer.java.patch index b0a6d6067..c9463df4c 100644 --- a/patches/minecraft/net/minecraft/world/WorldServer.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldServer.java.patch @@ -131,7 +131,7 @@ this.updateLCG = this.updateLCG * 3 + 1013904223; i1 = this.updateLCG >> 2; @@ -433,6 +465,9 @@ - public void func_82740_a(int par1, int par2, int par3, int par4, int par5, int par6) + public void scheduleBlockUpdateWithPriority(int par1, int par2, int par3, int par4, int par5, int par6) { NextTickListEntry nextticklistentry = new NextTickListEntry(par1, par2, par3, par4); + //Keeping here as a note for future when it may be restored. @@ -159,7 +159,7 @@ byte b0 = 0; if (this.checkChunksExist(nextticklistentry.xCoord - b0, nextticklistentry.yCoord - b0, nextticklistentry.zCoord - b0, nextticklistentry.xCoord + b0, nextticklistentry.yCoord + b0, nextticklistentry.zCoord + b0)) -@@ -717,16 +755,28 @@ +@@ -696,16 +734,28 @@ { ArrayList arraylist = new ArrayList(); @@ -198,7 +198,7 @@ return arraylist; } -@@ -734,6 +784,11 @@ +@@ -713,6 +763,11 @@ * Called when checking if a certain block can be mined or not. The 'spawn safe zone' check is located here. */ public boolean canMineBlock(EntityPlayer par1EntityPlayer, int par2, int par3, int par4) @@ -210,7 +210,7 @@ { return !this.mcServer.func_96290_a(this, par2, par3, par4, par1EntityPlayer); } -@@ -818,7 +873,7 @@ +@@ -797,7 +852,7 @@ */ protected void createBonusChest() { @@ -219,7 +219,7 @@ for (int i = 0; i < 10; ++i) { -@@ -861,6 +916,7 @@ +@@ -840,6 +895,7 @@ } this.chunkProvider.saveChunks(par1, par2IProgressUpdate); @@ -227,15 +227,15 @@ } } -@@ -880,6 +936,7 @@ +@@ -859,6 +915,7 @@ this.checkSessionLock(); this.saveHandler.saveWorldInfoWithPlayer(this.worldInfo, this.mcServer.getConfigurationManager().getHostPlayerData()); this.mapStorage.saveAllData(); + this.perWorldStorage.saveAllData(); } - /** -@@ -1093,4 +1150,9 @@ + protected void onEntityAdded(Entity par1Entity) +@@ -1066,4 +1123,9 @@ { return this.field_85177_Q; } From 9b5208fa308f22c24e295ce3be38dcafea2857ea Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 7 Jul 2013 14:05:23 -0700 Subject: [PATCH 059/146] Remove deprecated Liquids API, Use new Fluids system as replacement. --- .../minecraftforge/liquids/IBlockLiquid.java | 59 ---- .../net/minecraftforge/liquids/ILiquid.java | 36 --- .../minecraftforge/liquids/ILiquidTank.java | 45 --- .../liquids/ITankContainer.java | 56 ---- .../liquids/LiquidContainerData.java | 31 --- .../liquids/LiquidContainerRegistry.java | 131 --------- .../liquids/LiquidDictionary.java | 124 --------- .../minecraftforge/liquids/LiquidEvent.java | 96 ------- .../minecraftforge/liquids/LiquidStack.java | 257 ------------------ .../minecraftforge/liquids/LiquidTank.java | 181 ------------ 10 files changed, 1016 deletions(-) delete mode 100644 common/net/minecraftforge/liquids/IBlockLiquid.java delete mode 100644 common/net/minecraftforge/liquids/ILiquid.java delete mode 100644 common/net/minecraftforge/liquids/ILiquidTank.java delete mode 100644 common/net/minecraftforge/liquids/ITankContainer.java delete mode 100644 common/net/minecraftforge/liquids/LiquidContainerData.java delete mode 100644 common/net/minecraftforge/liquids/LiquidContainerRegistry.java delete mode 100644 common/net/minecraftforge/liquids/LiquidDictionary.java delete mode 100644 common/net/minecraftforge/liquids/LiquidEvent.java delete mode 100644 common/net/minecraftforge/liquids/LiquidStack.java delete mode 100644 common/net/minecraftforge/liquids/LiquidTank.java diff --git a/common/net/minecraftforge/liquids/IBlockLiquid.java b/common/net/minecraftforge/liquids/IBlockLiquid.java deleted file mode 100644 index 9569e6bd5..000000000 --- a/common/net/minecraftforge/liquids/IBlockLiquid.java +++ /dev/null @@ -1,59 +0,0 @@ -package net.minecraftforge.liquids; - -import net.minecraft.nbt.NBTTagCompound; - -/** - * Implementors of this interface are a liquid which may receive a block implementation and can be placed in the world. - * - * @author cpw - * - */ -@Deprecated //See new net.minecraftforge.fluids -public interface IBlockLiquid extends ILiquid { - /** - * Controls the type of block that is generated by this IBlockLiquid - * - */ - public enum BlockType { - /** - * No block. Completeness really. - */ - NONE, - /** - * Vanilla style block, up to 8 flowing states. May be able to generate new sources. - */ - VANILLA, - /** - * Finite liquid style, uses cellular automata to model flowing behaviour. - */ - FINITE; - } - - /** - * Can this liquid, when placed in a specific configuration, generate new source blocks of the liquid. - * @return if this liquid will generate new sources - */ - public boolean willGenerateSources(); - - /** - * @return the distance this liquid will flow if placed in the world. Maximum of 7 levels for vanilla types. - */ - public int getFlowDistance(); - - /** - * @return the RGB rendering for this liquid - */ - public byte[] getLiquidRGB(); - - /** - * Get the texture file for rendering the liquid - * @return the texture file for this liquid - */ - public String getLiquidBlockTextureFile(); - /** - * Custom properties of the liquid. - * @return a compound tag of custom liquid properties - */ - public NBTTagCompound getLiquidProperties(); - -} diff --git a/common/net/minecraftforge/liquids/ILiquid.java b/common/net/minecraftforge/liquids/ILiquid.java deleted file mode 100644 index f7943b2ff..000000000 --- a/common/net/minecraftforge/liquids/ILiquid.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (c) SpaceToad, 2011 - * http://www.mod-buildcraft.com - * - * BuildCraft is distributed under the terms of the Minecraft Mod Public - * License 1.0, or MMPL. Please check the contents of the license located in - * http://www.mod-buildcraft.com/MMPL-1.0.txt - */ - -package net.minecraftforge.liquids; - -/** - * Liquids implement this interface - * - */ -@Deprecated //See new net.minecraftforge.fluids -public interface ILiquid { - - /** - * The itemId of the liquid item - * @return the itemId - */ - public int stillLiquidId(); - - /** - * Is this liquid a metadata based liquid - * @return if this is a metadata liquid - */ - public boolean isMetaSensitive(); - - /** - * The item metadata of the liquid - * @return the metadata of the liquid - */ - public int stillLiquidMeta(); -} diff --git a/common/net/minecraftforge/liquids/ILiquidTank.java b/common/net/minecraftforge/liquids/ILiquidTank.java deleted file mode 100644 index 7bbb4c6d2..000000000 --- a/common/net/minecraftforge/liquids/ILiquidTank.java +++ /dev/null @@ -1,45 +0,0 @@ -package net.minecraftforge.liquids; - -/** - * A tank is the unit of interaction with liquid inventories. - * - * @author cpw - */ -@Deprecated //See new net.minecraftforge.fluids -public interface ILiquidTank { - - /** - * @return LiquidStack representing the liquid contained in the tank, null if empty. - */ - LiquidStack getLiquid(); - - /** - * @return capacity of this tank - */ - int getCapacity(); - - /** - * - * @param resource - * @param doFill - * @return Amount of liquid used for filling. - */ - int fill(LiquidStack resource, boolean doFill); - /** - * - * @param maxDrain - * @param doDrain - * @return Null if nothing was drained, otherwise a LiquidStack containing the drained. - */ - LiquidStack drain(int maxDrain, boolean doDrain); - - /** - * Positive values indicate a positive liquid pressure (liquid wants to leave this tank) - * Negative values indicate a negative liquid pressure (liquid wants to fill this tank) - * Zero indicates no pressure - * - * @return a number indicating tank pressure - */ - public int getTankPressure(); - -} diff --git a/common/net/minecraftforge/liquids/ITankContainer.java b/common/net/minecraftforge/liquids/ITankContainer.java deleted file mode 100644 index d9ace05ce..000000000 --- a/common/net/minecraftforge/liquids/ITankContainer.java +++ /dev/null @@ -1,56 +0,0 @@ -package net.minecraftforge.liquids; - -import net.minecraftforge.common.ForgeDirection; -@Deprecated //See new net.minecraftforge.fluids -public interface ITankContainer { - - /** - * Fills liquid into internal tanks, distribution is left to the ITankContainer. - * @param from Orientation the liquid is pumped in from. - * @param resource LiquidStack representing the maximum amount of liquid filled into the ITankContainer - * @param doFill If false filling will only be simulated. - * @return Amount of resource that was filled into internal tanks. - */ - int fill(ForgeDirection from, LiquidStack resource, boolean doFill); - /** - * Fills liquid into the specified internal tank. - * @param tankIndex the index of the tank to fill - * @param resource LiquidStack representing the maximum amount of liquid filled into the ITankContainer - * @param doFill If false filling will only be simulated. - * @return Amount of resource that was filled into internal tanks. - */ - int fill(int tankIndex, LiquidStack resource, boolean doFill); - - /** - * Drains liquid out of internal tanks, distribution is left to the ITankContainer. - * @param from Orientation the liquid is drained to. - * @param maxDrain Maximum amount of liquid to drain. - * @param doDrain If false draining will only be simulated. - * @return LiquidStack representing the liquid and amount actually drained from the ITankContainer - */ - LiquidStack drain(ForgeDirection from, int maxDrain, boolean doDrain); - /** - * Drains liquid out of the specified internal tank. - * @param tankIndex the index of the tank to drain - * @param maxDrain Maximum amount of liquid to drain. - * @param doDrain If false draining will only be simulated. - * @return LiquidStack representing the liquid and amount actually drained from the ITankContainer - */ - LiquidStack drain(int tankIndex, int maxDrain, boolean doDrain); - - /** - * @param direction tank side: UNKNOWN for default tank set - * @return Array of {@link LiquidTank}s contained in this ITankContainer for this direction - */ - ILiquidTank[] getTanks(ForgeDirection direction); - - /** - * Return the tank that this tank container desired to be used for the specified liquid type from the specified direction - * - * @param direction the direction - * @param type the liquid type, null is always an acceptable value - * @return a tank or null for no such tank - */ - ILiquidTank getTank(ForgeDirection direction, LiquidStack type); - -} diff --git a/common/net/minecraftforge/liquids/LiquidContainerData.java b/common/net/minecraftforge/liquids/LiquidContainerData.java deleted file mode 100644 index 3b9e2fbc9..000000000 --- a/common/net/minecraftforge/liquids/LiquidContainerData.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) SpaceToad, 2011 - * http://www.mod-buildcraft.com - * - * BuildCraft is distributed under the terms of the Minecraft Mod Public - * License 1.0, or MMPL. Please check the contents of the license located in - * http://www.mod-buildcraft.com/MMPL-1.0.txt - */ - -package net.minecraftforge.liquids; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -@Deprecated //See new net.minecraftforge.fluids -public class LiquidContainerData { - - public final LiquidStack stillLiquid; - public final ItemStack filled; - public final ItemStack container; - - - public LiquidContainerData(LiquidStack stillLiquid, ItemStack filled, ItemStack container) { - this.stillLiquid = stillLiquid; - this.filled = filled; - this.container = container; - - if(stillLiquid == null || filled == null || container == null) - throw new RuntimeException("stillLiquid, filled, or container is null, this is an error"); - } - -} diff --git a/common/net/minecraftforge/liquids/LiquidContainerRegistry.java b/common/net/minecraftforge/liquids/LiquidContainerRegistry.java deleted file mode 100644 index ea4b5de8e..000000000 --- a/common/net/minecraftforge/liquids/LiquidContainerRegistry.java +++ /dev/null @@ -1,131 +0,0 @@ - -package net.minecraftforge.liquids; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -@Deprecated //See new net.minecraftforge.fluids -public class LiquidContainerRegistry -{ - public static final int BUCKET_VOLUME = 1000; - public static final ItemStack EMPTY_BUCKET = new ItemStack(Item.bucketEmpty); - - private static Map mapFilledItemFromLiquid = new HashMap(); - private static Map mapLiquidFromFilledItem = new HashMap(); - private static Set setContainerValidation = new HashSet(); - private static Set setLiquidValidation = new HashSet(); - private static ArrayList liquids = new ArrayList(); - - /** - * Default registrations - */ - static - { - registerLiquid(new LiquidContainerData(new LiquidStack(Block.waterStill, LiquidContainerRegistry.BUCKET_VOLUME), new ItemStack(Item.bucketWater), new ItemStack(Item.bucketEmpty))); - registerLiquid(new LiquidContainerData(new LiquidStack(Block.lavaStill, LiquidContainerRegistry.BUCKET_VOLUME), new ItemStack(Item.bucketLava), new ItemStack(Item.bucketEmpty))); - registerLiquid(new LiquidContainerData(new LiquidStack(Block.waterStill, LiquidContainerRegistry.BUCKET_VOLUME), new ItemStack(Item.potion), new ItemStack(Item.glassBottle))); - // registerLiquid(new LiquidContainerData(new LiquidStack(Item.bucketMilk, LiquidContainerRegistry.BUCKET_VOLUME), new ItemStack(Item.bucketMilk), new ItemStack(Item.bucketEmpty))); - } - - /** - * To register a container with a non-bucket size, the LiquidContainerData entry simply needs to use a size other than LiquidManager.BUCKET_VOLUME - */ - public static void registerLiquid(LiquidContainerData data) - { - mapFilledItemFromLiquid.put(Arrays.asList(data.container.itemID, data.container.getItemDamage(), data.stillLiquid.itemID, data.stillLiquid.itemMeta), data); - mapLiquidFromFilledItem.put(Arrays.asList(data.filled.itemID, data.filled.getItemDamage()), data); - setContainerValidation.add(Arrays.asList(data.container.itemID, data.container.getItemDamage())); - setLiquidValidation.add(Arrays.asList(data.stillLiquid.itemID, data.stillLiquid.itemMeta)); - - liquids.add(data); - } - - public static LiquidStack getLiquidForFilledItem(ItemStack filledContainer) - { - if (filledContainer == null) - { - return null; - } - - LiquidContainerData ret = mapLiquidFromFilledItem.get(Arrays.asList(filledContainer.itemID, filledContainer.getItemDamage())); - return ret == null ? null : ret.stillLiquid.copy(); - } - - public static ItemStack fillLiquidContainer(LiquidStack liquid, ItemStack emptyContainer) - { - if (emptyContainer == null || liquid == null) - { - return null; - } - - LiquidContainerData ret = mapFilledItemFromLiquid.get(Arrays.asList(emptyContainer.itemID, emptyContainer.getItemDamage(), liquid.itemID, liquid.itemMeta)); - - if (ret != null && liquid.amount >= ret.stillLiquid.amount) - { - return ret.filled.copy(); - } - - return null; - } - - public static boolean containsLiquid(ItemStack filledContainer, LiquidStack liquid) - { - if (filledContainer == null || liquid == null) - { - return false; - } - - LiquidContainerData ret = mapLiquidFromFilledItem.get(Arrays.asList(filledContainer.itemID, filledContainer.getItemDamage())); - - return ret != null && ret.stillLiquid.isLiquidEqual(liquid); - } - - public static boolean isBucket(ItemStack container) - { - if (container == null) - { - return false; - } - - if (container.isItemEqual(EMPTY_BUCKET)) - { - return true; - } - - LiquidContainerData ret = mapLiquidFromFilledItem.get(Arrays.asList(container.itemID, container.getItemDamage())); - return ret != null && ret.container.isItemEqual(EMPTY_BUCKET); - } - - public static boolean isContainer(ItemStack container) - { - return isEmptyContainer(container) || isFilledContainer(container); - } - - public static boolean isEmptyContainer(ItemStack emptyContainer) - { - return emptyContainer != null && setContainerValidation.contains(Arrays.asList(emptyContainer.itemID, emptyContainer.getItemDamage())); - } - - public static boolean isFilledContainer(ItemStack filledContainer) - { - return filledContainer != null && getLiquidForFilledItem(filledContainer) != null; - } - - public static boolean isLiquid(ItemStack item) - { - return item != null && setLiquidValidation.contains(Arrays.asList(item.itemID, item.getItemDamage())); - } - - public static LiquidContainerData[] getRegisteredLiquidContainerData() - { - return liquids.toArray(new LiquidContainerData[liquids.size()]); - } -} diff --git a/common/net/minecraftforge/liquids/LiquidDictionary.java b/common/net/minecraftforge/liquids/LiquidDictionary.java deleted file mode 100644 index a7a5925af..000000000 --- a/common/net/minecraftforge/liquids/LiquidDictionary.java +++ /dev/null @@ -1,124 +0,0 @@ -package net.minecraftforge.liquids; - -import java.util.HashMap; -import java.util.Map; - -import net.minecraft.block.Block; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.Event; - -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; -import com.google.common.collect.ImmutableMap; - -/** - * When creating liquids you should register them with this class. - * - * @author CovertJaguar - */ -@Deprecated //See new net.minecraftforge.fluids -public abstract class LiquidDictionary -{ - - private static BiMap liquids = HashBiMap.create(); - - /** - * When creating liquids you should call this function. - * - * Upon passing it a name and liquid item it will return either - * a preexisting implementation of that liquid or the liquid passed in. - * - * - * @param name the name of the liquid - * @param liquid the liquid to use if one doesn't exist - * @return the matching liquid stack - */ - public static LiquidStack getOrCreateLiquid(String name, LiquidStack liquid) - { - if (liquid == null) - { - throw new NullPointerException("You cannot register a null LiquidStack"); - } - LiquidStack existing = liquids.get(name); - if(existing != null) { - return existing.copy(); - } - liquids.put(name, liquid.copy()); - - MinecraftForge.EVENT_BUS.post(new LiquidRegisterEvent(name, liquid)); - return liquid; - } - - /** - * Returns the liquid matching the name, - * if such a liquid exists. - * - * Can return null. - * - * @param name the name of the liquid - * @param amount the amout of liquid - * @return a liquidstack for the requested liquid - */ - public static LiquidStack getLiquid(String name, int amount) - { - LiquidStack liquid = liquids.get(name); - if(liquid == null) - return null; - - liquid = liquid.copy(); - liquid.amount = amount; - return liquid; - } - - public static LiquidStack getCanonicalLiquid(String name) - { - return liquids.get(name); - } - /** - * Get an immutable list of the liquids defined - * - * @return the defined liquids - */ - public static Map getLiquids() - { - return ImmutableMap.copyOf(liquids); - } - /** - * Fired when a new liquid is created - * - */ - public static class LiquidRegisterEvent extends Event - { - public final String Name; - public final LiquidStack Liquid; - - public LiquidRegisterEvent(String name, LiquidStack liquid) - { - this.Name = name; - this.Liquid = liquid.copy(); - } - } - - static - { - getOrCreateLiquid("Water", new LiquidStack(Block.waterStill, LiquidContainerRegistry.BUCKET_VOLUME)); - getOrCreateLiquid("Lava", new LiquidStack(Block.lavaStill, LiquidContainerRegistry.BUCKET_VOLUME)); - } - - public static String findLiquidName(LiquidStack reference) - { - if (reference != null) - { - return liquids.inverse().get(reference); - } - else - { - return null; - } - } - - public static LiquidStack getCanonicalLiquid(LiquidStack liquidStack) - { - return liquids.get(liquids.inverse().get(liquidStack)); - } -} diff --git a/common/net/minecraftforge/liquids/LiquidEvent.java b/common/net/minecraftforge/liquids/LiquidEvent.java deleted file mode 100644 index 1667f54a3..000000000 --- a/common/net/minecraftforge/liquids/LiquidEvent.java +++ /dev/null @@ -1,96 +0,0 @@ -package net.minecraftforge.liquids; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.Event; -@Deprecated //See new net.minecraftforge.fluids -public class LiquidEvent extends Event { - public final LiquidStack liquid; - public final int x; - public final int y; - public final int z; - public final World world; - - public LiquidEvent(LiquidStack liquid, World world, int x, int y, int z) - { - this.liquid = liquid; - this.world = world; - this.x = x; - this.y = y; - this.z = z; - } - - /** - * Mods should fire this event when they move liquids around (pipe networks etc) - * - * @author cpw - * - */ - public static class LiquidMotionEvent extends LiquidEvent - { - public LiquidMotionEvent(LiquidStack liquid, World world, int x, int y, int z) - { - super(liquid, world, x, y, z); - } - } - - /** - * Mods should fire this event when a liquid is {@link ILiquidTank#fill(LiquidStack, boolean)} their tank implementation. - * {@link LiquidTank} does. - * - * @author cpw - * - */ - public static class LiquidFillingEvent extends LiquidEvent - { - public final ILiquidTank tank; - - public LiquidFillingEvent(LiquidStack liquid, World world, int x, int y, int z, ILiquidTank tank) - { - super(liquid, world, x, y, z); - this.tank = tank; - } - } - - /** - * Mods should fire this event when a liquid is {@link ILiquidTank#drain(int, boolean)} from their tank. - * @author cpw - * - */ - public static class LiquidDrainingEvent extends LiquidEvent - { - public final ILiquidTank tank; - - public LiquidDrainingEvent(LiquidStack liquid, World world, int x, int y, int z, ILiquidTank tank) - { - super(liquid, world, x, y, z); - this.tank = tank; - } - } - - - /** - * Mods should fire this event when a liquid "spills", for example, if a block containing liquid is broken. - * - * @author cpw - * - */ - public static class LiquidSpilledEvent extends LiquidEvent - { - public LiquidSpilledEvent(LiquidStack liquid, World world, int x, int y, int z) - { - super(liquid, world, x, y, z); - } - } - - /** - * A handy shortcut for firing the various liquid events - * - * @param event - */ - public static final void fireEvent(LiquidEvent event) - { - MinecraftForge.EVENT_BUS.post(event); - } -} diff --git a/common/net/minecraftforge/liquids/LiquidStack.java b/common/net/minecraftforge/liquids/LiquidStack.java deleted file mode 100644 index 881a10b6a..000000000 --- a/common/net/minecraftforge/liquids/LiquidStack.java +++ /dev/null @@ -1,257 +0,0 @@ -package net.minecraftforge.liquids; - -import static cpw.mods.fml.relauncher.Side.CLIENT; - -import com.google.common.base.Objects; - -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.block.Block; -import net.minecraft.block.BlockFluid; -import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.Icon; - -/** - * ItemStack substitute for liquids - * Things of note: they are equal if their items are equal. Amount does NOT matter for java equals() testing - *
- * The canonical liquidstack is probably the only one that has a lot of the rendering data on it. Use {@link #canonical()} - * to get it. - * - * @author SirSengir - */ -@Deprecated //See new net.minecraftforge.fluids -public class LiquidStack -{ - public final int itemID; - public int amount; - public final int itemMeta; - public NBTTagCompound extra; - - public LiquidStack(int itemID, int amount) { this(itemID, amount, 0); } - public LiquidStack(Item item, int amount) { this(item.itemID, amount, 0); } - public LiquidStack(Block block, int amount) { this(block.blockID, amount, 0); } - - public LiquidStack(int itemID, int amount, int itemDamage) - { - this.itemID = itemID; - this.amount = amount; - this.itemMeta = itemDamage; - } - - public LiquidStack(int itemID, int amount, int itemDamage, NBTTagCompound nbt) - { - this(itemID, amount, itemDamage); - if (nbt != null) - { - extra = (NBTTagCompound)nbt.copy(); - } - } - - public NBTTagCompound writeToNBT(NBTTagCompound nbt) - { - nbt.setInteger("Amount", amount); - nbt.setShort("Id", (short)itemID); - nbt.setShort("Meta", (short)itemMeta); - String name = LiquidDictionary.findLiquidName(this); - if(name != null) - { - nbt.setString("LiquidName", name); - } - if (extra != null) - { - nbt.setTag("extra", extra); - } - return nbt; - } - - /** - * @return A copy of this LiquidStack - */ - public LiquidStack copy() - { - return new LiquidStack(itemID, amount, itemMeta, extra); - } - - /** - * @param other - * @return true if this LiquidStack contains the same liquid as the one passed in. - */ - public boolean isLiquidEqual(LiquidStack other) - { - return other != null && itemID == other.itemID && itemMeta == other.itemMeta && (extra == null ? other.extra == null : extra.equals(other.extra)); - } - - /** - * @param other - * @return true if this LiquidStack contains the other liquid (liquids are equal and amount >= other.amount). - */ - public boolean containsLiquid(LiquidStack other) - { - return isLiquidEqual(other) && amount >= other.amount; - } - - /** - * @param other ItemStack containing liquids. - * @return true if this LiquidStack contains the same liquid as the one passed in. - */ - public boolean isLiquidEqual(ItemStack other) - { - if (other == null) - { - return false; - } - - if (itemID == other.itemID && itemMeta == other.getItemDamage()) - { - return true; - } - - return isLiquidEqual(LiquidContainerRegistry.getLiquidForFilledItem(other)); - } - - /** - * @return ItemStack representation of this LiquidStack - */ - public ItemStack asItemStack() - { - ItemStack stack = new ItemStack(itemID, 1, itemMeta); - if (extra != null) - { - stack.stackTagCompound = (NBTTagCompound)extra.copy(); - } - return stack; - } - - /** - * Reads a liquid stack from the passed nbttagcompound and returns it. - * - * @param nbt - * @return the liquid stack - */ - public static LiquidStack loadLiquidStackFromNBT(NBTTagCompound nbt) - { - if (nbt == null) - { - return null; - } - String liquidName = nbt.getString("LiquidName"); - int itemID = nbt.getShort("Id"); - int itemMeta = nbt.getShort("Meta"); - LiquidStack liquid = LiquidDictionary.getCanonicalLiquid(liquidName); - if(liquid != null) { - itemID = liquid.itemID; - itemMeta = liquid.itemMeta; - } - // if the item is not existent, and no liquid dictionary is found, null returns - else if (Item.itemsList[itemID] == null) - { - return null; - } - int amount = nbt.getInteger("Amount"); - LiquidStack liquidstack = new LiquidStack(itemID, amount, itemMeta); - if (nbt.hasKey("extra")) - { - liquidstack.extra = nbt.getCompoundTag("extra"); - } - return liquidstack.itemID == 0 ? null : liquidstack; - } - - private String textureSheet = "/terrain.png"; - - /** - * Return the textureSheet used for this liquid stack's texture Icon - * Defaults to '/terrain.png' - * - * See {@link #getRenderingIcon()} for the actual icon - * - * @return The texture sheet - */ - public String getTextureSheet() - { - return textureSheet; - } - - /** - * Set the texture sheet for this icon (usually /terrain.png or /gui/items.png) - * - * See also the {@link #setRenderingIcon(Icon)} for the icon itself - * - * @param textureSheet - * @return the liquid stack - */ - public LiquidStack setTextureSheet(String textureSheet) - { - this.textureSheet = textureSheet; - return this; - } - @SideOnly(CLIENT) - private Icon renderingIcon; - - /** - * Get the rendering icon for this liquid stack, for presentation in the world or in GUIs. - * Defaults to handling water and lava, and returns the set rendering icon otherwise. - * - * See {@link #getTextureSheet()} to get the texture sheet this icon is associated with - * - * @return The icon for rendering this liquid - */ - @SideOnly(CLIENT) - public Icon getRenderingIcon() - { - if (itemID == Block.waterStill.blockID) - { - return BlockFluid.func_94424_b("water"); - } - else if (itemID == Block.lavaStill.blockID) - { - return BlockFluid.func_94424_b("lava"); - } - return renderingIcon; - } - - /** - * Set the icon for rendering this liquid - * It should be refreshed whenever textures are refreshed. - * - * See also {@link #setTextureSheet(String)} for setting the sheet this icon is associated with - * - * @param icon The icon to render - * @return The liquid stack - */ - @SideOnly(CLIENT) - public LiquidStack setRenderingIcon(Icon icon) - { - this.renderingIcon = icon; - return this; - } - - @Override - public final int hashCode() - { - return 31 * itemMeta + itemID; - } - - @Override - public final boolean equals(Object ob) - { - if (ob instanceof LiquidStack) - { - LiquidStack ls = (LiquidStack)ob; - return ls.itemID == itemID && ls.itemMeta == itemMeta && (extra == null ? ls.extra == null : extra.equals(ls.extra)); - } - return false; - } - - - /** - * Get the canonical version of this liquid stack (will contain things like icons and texturesheets) - * @return The canonical liquidstack - */ - public LiquidStack canonical() - { - return LiquidDictionary.getCanonicalLiquid(this); - } -} diff --git a/common/net/minecraftforge/liquids/LiquidTank.java b/common/net/minecraftforge/liquids/LiquidTank.java deleted file mode 100644 index 6832ef695..000000000 --- a/common/net/minecraftforge/liquids/LiquidTank.java +++ /dev/null @@ -1,181 +0,0 @@ -package net.minecraftforge.liquids; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; - -/** - * Reference implementation of ILiquidTank. Use this or implement your own. - */ -@Deprecated //See new net.minecraftforge.fluids -public class LiquidTank implements ILiquidTank { - private LiquidStack liquid; - private int capacity; - private int tankPressure; - private TileEntity tile; - - public LiquidTank(int capacity) - { - this(null, capacity); - } - - public LiquidTank(int liquidId, int quantity, int capacity) - { - this(new LiquidStack(liquidId, quantity), capacity); - } - - public LiquidTank(int liquidId, int quantity, int capacity, TileEntity tile) - { - this(liquidId, quantity, capacity); - this.tile = tile; - } - - public LiquidTank(LiquidStack liquid, int capacity) - { - this.liquid = liquid; - this.capacity = capacity; - } - - public LiquidTank(LiquidStack liquid, int capacity, TileEntity tile) - { - this(liquid, capacity); - this.tile = tile; - } - - @Override - public LiquidStack getLiquid() - { - return this.liquid; - } - - @Override - public int getCapacity() - { - return this.capacity; - } - - public void setLiquid(LiquidStack liquid) - { - this.liquid = liquid; - } - - public void setCapacity(int capacity) - { - this.capacity = capacity; - } - - @Override - public int fill(LiquidStack resource, boolean doFill) - { - if (resource == null || resource.itemID <= 0) return 0; - - if (liquid == null || liquid.itemID <= 0) - { - if (resource.amount <= capacity) - { - if (doFill) this.liquid = resource.copy(); - return resource.amount; - } - else - { - if (doFill) - { - this.liquid = resource.copy(); - this.liquid.amount = capacity; - if (tile != null) - LiquidEvent.fireEvent(new LiquidEvent.LiquidFillingEvent(liquid, tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord, this)); - } - return capacity; - } - } - - if (!liquid.isLiquidEqual(resource)) return 0; - - int space = capacity - liquid.amount; - if (resource.amount <= space) - { - if (doFill) this.liquid.amount += resource.amount; - return resource.amount; - } - else - { - - if (doFill) this.liquid.amount = capacity; - return space; - } - - } - - @Override - public LiquidStack drain(int maxDrain, boolean doDrain) - { - if (liquid == null || liquid.itemID <= 0) return null; - if (liquid.amount <= 0) return null; - - int used = maxDrain; - if (liquid.amount < used) used = liquid.amount; - - if (doDrain) - { - liquid.amount -= used; - } - - LiquidStack drained = new LiquidStack(liquid.itemID, used, liquid.itemMeta); - - // Reset liquid if emptied - if (liquid.amount <= 0) liquid = null; - - if (doDrain && tile != null) - LiquidEvent.fireEvent(new LiquidEvent.LiquidDrainingEvent(drained, tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord, this)); - - return drained; - } - - @Override - public int getTankPressure() - { - return tankPressure; - } - - public void setTankPressure(int pressure) - { - this.tankPressure = pressure; - } - - - public String getLiquidName() - { - return liquid!= null ? LiquidDictionary.findLiquidName(liquid) : null; - } - - public boolean containsValidLiquid() - { - return LiquidDictionary.findLiquidName(liquid) != null; - } - - - public NBTTagCompound writeToNBT(NBTTagCompound nbt) - { - if (containsValidLiquid()) - { - liquid.writeToNBT(nbt); - } - else - { - nbt.setString("emptyTank", ""); - } - return nbt; - } - - public LiquidTank readFromNBT(NBTTagCompound nbt) - { - if (!nbt.hasKey("emptyTank")) - { - LiquidStack liquid = LiquidStack.loadLiquidStackFromNBT(nbt); - if (liquid != null) - { - setLiquid(liquid); - } - } - return this; - } -} From 51ca5e028b6b0e9bacf5eb42cde082de6e8d4148 Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 7 Jul 2013 14:05:48 -0700 Subject: [PATCH 060/146] Bump version to 9.10 for new MC version and removal of Fluids. --- common/net/minecraftforge/common/ForgeVersion.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/net/minecraftforge/common/ForgeVersion.java b/common/net/minecraftforge/common/ForgeVersion.java index e162a21ab..cc81eb881 100644 --- a/common/net/minecraftforge/common/ForgeVersion.java +++ b/common/net/minecraftforge/common/ForgeVersion.java @@ -8,9 +8,9 @@ package net.minecraftforge.common; public class ForgeVersion { //This number is incremented every time we remove deprecated code/major API changes, never reset - public static final int majorVersion = 8; + public static final int majorVersion = 9; //This number is incremented every minecraft release, never reset - public static final int minorVersion = 9; + public static final int minorVersion = 10; //This number is incremented every time a interface changes or new major feature is added, and reset every Minecraft version public static final int revisionVersion = 0; //This number is incremented every time Jenkins builds Forge, and never reset. Should always be 0 in the repo code. From 033eedb50f488d28e88cb36f4e0bc0a9a0224ab8 Mon Sep 17 00:00:00 2001 From: Christian Date: Mon, 8 Jul 2013 14:44:47 -0400 Subject: [PATCH 061/146] Drop two domain related fixes that have been applied in vanilla. Updated FML: MinecraftForge/FML@c47d08c89dfcacb96e36c427593174e08dcb4224 Tweak debug data on patched classes MinecraftForge/FML@dbf5fe38cee04288e92d57f8782114b452245bce We now generate an adler32 checksum for each patched file and verify at load time that they match. Mismatch won't crash, but will emit a big warning.. MinecraftForge/FML@e88a0cd13f63904f7317e1a73880611f58820389 Update for stealth update. Thanks mojang! MinecraftForge/FML@2336002f20e9412a7663781b23c51de0eff6a692 The game is going to exit in face of patch mismatch, unless you force it to run with fml.ignorePatchDiscrepancies in the system properties. --- fml | 2 +- .../client/audio/SoundPool.java.patch | 14 ++--------- .../renderer/texture/TextureMap.java.patch | 23 +++---------------- 3 files changed, 6 insertions(+), 33 deletions(-) diff --git a/fml b/fml index 6f96d89e2..2336002f2 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 6f96d89e2bf9313b26eeb4c334a208bf3e1c9ad4 +Subproject commit 2336002f20e9412a7663781b23c51de0eff6a692 diff --git a/patches/minecraft/net/minecraft/client/audio/SoundPool.java.patch b/patches/minecraft/net/minecraft/client/audio/SoundPool.java.patch index 456e957e2..fbf82fb28 100644 --- a/patches/minecraft/net/minecraft/client/audio/SoundPool.java.patch +++ b/patches/minecraft/net/minecraft/client/audio/SoundPool.java.patch @@ -1,20 +1,10 @@ --- ../src_base/minecraft/net/minecraft/client/audio/SoundPool.java +++ ../src_work/minecraft/net/minecraft/client/audio/SoundPool.java -@@ -11,6 +11,7 @@ - import java.util.Map; +@@ -12,6 +12,7 @@ import java.util.Random; + import net.minecraft.client.resources.ResourceLocation; import net.minecraft.client.resources.ResourceManager; +import net.minecraftforge.client.ForgeHooksClient; @SideOnly(Side.CLIENT) public class SoundPool -@@ -71,7 +72,8 @@ - - private URL func_110654_c(String par1Str) throws MalformedURLException - { -- return new URL((URL)null, "minecraft:" + this.field_110656_d + "/" + par1Str, new SoundPoolProtocolHandler(this)); -+ String path = ForgeHooksClient.fixDomain(field_110656_d + "/", par1Str); -+ return new URL((URL)null, "minecraft:" + path, new SoundPoolProtocolHandler(this)); - } - - /** diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch index 4731005d1..e0a511cd1 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -22,24 +22,7 @@ Iterator iterator = this.field_110574_e.entrySet().iterator(); while (iterator.hasNext()) -@@ -69,11 +73,14 @@ - Entry entry = (Entry)iterator.next(); - String s = (String)entry.getKey(); - TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)entry.getValue(); -- ResourceLocation resourcelocation = new ResourceLocation(this.basePath + s + ".png"); -+ ResourceLocation resourcelocation = new ResourceLocation(ForgeHooksClient.fixDomain(basePath, s) + ".png"); - - try - { -- textureatlassprite.func_130100_a(par1ResourceManager.func_110536_a(resourcelocation)); -+ if (!textureatlassprite.load(par1ResourceManager, resourcelocation)) -+ { -+ continue; -+ } - } - catch (RuntimeException runtimeexception) - { -@@ -142,6 +149,7 @@ +@@ -142,6 +146,7 @@ textureatlassprite1 = (TextureAtlasSprite)iterator1.next(); textureatlassprite1.copyFrom(this.missingImage); } @@ -47,7 +30,7 @@ } private void func_110573_f() -@@ -212,6 +220,7 @@ +@@ -212,6 +217,7 @@ if (par1Str == null) { (new RuntimeException("Don\'t register null!")).printStackTrace(); @@ -55,7 +38,7 @@ } Object object = (TextureAtlasSprite)this.field_110574_e.get(par1Str); -@@ -253,4 +262,37 @@ +@@ -253,4 +259,37 @@ { this.updateAnimations(); } From 38bd039a93ae2ff4f65d85055ad4387d34583c30 Mon Sep 17 00:00:00 2001 From: Christian Date: Mon, 8 Jul 2013 17:30:25 -0400 Subject: [PATCH 062/146] Make resourcelocation the class available on the server. --- .../client/ForgeHooksClient.java | 8 ++-- .../client/GuiControlsScrollPanel.java | 2 +- .../minecraftforge/client/GuiIngameForge.java | 46 +++++++++---------- fml | 2 +- .../client/audio/SoundPool.java.patch | 10 ---- .../client/particle/EffectRenderer.java.patch | 6 +-- .../client/renderer/ItemRenderer.java.patch | 2 +- .../renderer/entity/RenderBiped.java.patch | 10 ++-- .../renderer/entity/RenderPlayer.java.patch | 12 +++-- .../renderer/entity/RenderSnowMan.java.patch | 6 +-- .../entity/RendererLivingEntity.java.patch | 2 +- .../texture/TextureAtlasSprite.java.patch | 11 +++-- .../renderer/texture/TextureMap.java.patch | 2 +- .../net/minecraft/inventory/Slot.java.patch | 15 +++--- update_patches.py | 6 ++- 15 files changed, 72 insertions(+), 68 deletions(-) delete mode 100644 patches/minecraft/net/minecraft/client/audio/SoundPool.java.patch diff --git a/client/net/minecraftforge/client/ForgeHooksClient.java b/client/net/minecraftforge/client/ForgeHooksClient.java index 13d33094c..8e7ea312d 100644 --- a/client/net/minecraftforge/client/ForgeHooksClient.java +++ b/client/net/minecraftforge/client/ForgeHooksClient.java @@ -28,6 +28,7 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.ResourceLocation; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.RenderGlobal; @@ -35,7 +36,6 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.client.resources.ResourceLocation; import net.minecraftforge.client.IItemRenderer.ItemRenderType; import net.minecraftforge.client.event.DrawBlockHighlightEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; @@ -93,7 +93,7 @@ public class ForgeHooksClient } GL11.glScalef(scale, scale, scale); - + int size = item.stackSize; int count = (size > 40 ? 5 : (size > 20 ? 4 : (size > 5 ? 3 : (size > 1 ? 2 : 1)))); @@ -172,7 +172,7 @@ public class ForgeHooksClient GL11.glPopMatrix(); GL11.glEnable(GL11.GL_LIGHTING); } - + return true; } @@ -239,7 +239,7 @@ public class ForgeHooksClient public static void onTextureStitchedPost(TextureMap map) { MinecraftForge.EVENT_BUS.post(new TextureStitchEvent.Post(map)); - + FluidRegistry.WATER.setIcons(BlockFluid.func_94424_b("water"), BlockFluid.func_94424_b("water_flow")); FluidRegistry.LAVA.setIcons(BlockFluid.func_94424_b("lava"), BlockFluid.func_94424_b("lava_flow")); } diff --git a/client/net/minecraftforge/client/GuiControlsScrollPanel.java b/client/net/minecraftforge/client/GuiControlsScrollPanel.java index 793830243..a9566c4dc 100644 --- a/client/net/minecraftforge/client/GuiControlsScrollPanel.java +++ b/client/net/minecraftforge/client/GuiControlsScrollPanel.java @@ -10,8 +10,8 @@ import net.minecraft.client.gui.GuiSlot; import net.minecraft.client.settings.KeyBinding; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.client.resources.ResourceLocation; import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.ResourceLocation; public class GuiControlsScrollPanel extends GuiSlot { diff --git a/client/net/minecraftforge/client/GuiIngameForge.java b/client/net/minecraftforge/client/GuiIngameForge.java index 008a04bc4..0e6a21a6b 100644 --- a/client/net/minecraftforge/client/GuiIngameForge.java +++ b/client/net/minecraftforge/client/GuiIngameForge.java @@ -17,7 +17,6 @@ import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.multiplayer.NetClientHandler; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.client.resources.ResourceLocation; import net.minecraft.crash.CallableMinecraftVersion; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -33,6 +32,7 @@ import net.minecraft.util.Direction; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.FoodStats; import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import net.minecraft.util.StringUtils; import net.minecraft.world.EnumSkyBlock; @@ -52,7 +52,7 @@ public class GuiIngameForge extends GuiIngame private static final ResourceLocation VIGNETTE = new ResourceLocation("textures/misc/vignette.png"); private static final ResourceLocation WIDGITS = new ResourceLocation("textures/gui/widgets.png"); private static final ResourceLocation PUMPKIN_BLUR = new ResourceLocation("textures/misc/pumpkinblur.png"); - + private static final int WHITE = 0xFFFFFF; //Flags to toggle the rendering of certain aspects of the HUD, valid conditions @@ -71,7 +71,7 @@ public class GuiIngameForge extends GuiIngame public static boolean renderExperiance = true; public static boolean renderJumpBar = true; public static boolean renderObjective = true; - + public static int left_height = 39; public static int right_height = 39; @@ -95,7 +95,7 @@ public class GuiIngameForge extends GuiIngame renderHealthMount = mc.thePlayer.ridingEntity instanceof EntityLivingBase; renderFood = mc.thePlayer.ridingEntity == null; renderJumpBar = mc.thePlayer.func_110317_t(); - + right_height = 39; left_height = 39; @@ -129,7 +129,7 @@ public class GuiIngameForge extends GuiIngame if (renderCrosshairs) renderCrosshairs(width, height); if (renderBossHealth) renderBossHealth(); - + if (this.mc.playerController.shouldDrawHUD()) { if (renderHealth) renderHealth(width, height); @@ -145,7 +145,7 @@ public class GuiIngameForge extends GuiIngame { renderJumpBar(width, height); } - else if (renderExperiance) + else if (renderExperiance) { renderExperience(width, height); } @@ -344,9 +344,9 @@ public class GuiIngameForge extends GuiIngame int healthRows = MathHelper.ceiling_float_int((healthMax + absorb) / 2.0F / 10.0F); int rowHeight = Math.max(10 - (healthRows - 2), 3); - + this.rand.setSeed((long)(updateCounter * 312871)); - + int left = width / 2 - 91; int top = height - left_height; left_height += (healthRows * rowHeight); @@ -357,14 +357,14 @@ public class GuiIngameForge extends GuiIngame { regen = updateCounter % 25; } - + final int TOP = 9 * (mc.theWorld.getWorldInfo().isHardcoreModeEnabled() ? 5 : 0); final int BACKGROUND = (highlight ? 25 : 16); int MARGIN = 16; if (mc.thePlayer.isPotionActive(Potion.poison)) MARGIN += 36; else if (mc.thePlayer.isPotionActive(Potion.wither)) MARGIN += 72; float absorbRemaining = absorb; - + for (int i = MathHelper.ceiling_float_int((healthMax + absorb) / 2.0F) - 1; i >= 0; --i) { int b0 = (highlight ? 1 : 0); @@ -373,7 +373,7 @@ public class GuiIngameForge extends GuiIngame int y = top - row * rowHeight; if (health <= 4) y += rand.nextInt(2); - if (i == regen) y -= 2; + if (i == regen) y -= 2; drawTexturedModalRect(x, y, BACKGROUND, TOP, 9, 9); @@ -401,7 +401,7 @@ public class GuiIngameForge extends GuiIngame drawTexturedModalRect(x, y, MARGIN + 45, TOP, 9, 9); //5 } } - + mc.mcProfiler.endSection(); post(HEALTH); } @@ -487,20 +487,20 @@ public class GuiIngameForge extends GuiIngame bind(field_110324_m); if (pre(EXPERIENCE)) return; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - + if (mc.playerController.func_78763_f()) { mc.mcProfiler.startSection("expBar"); int cap = this.mc.thePlayer.xpBarCap(); int left = width / 2 - 91; - + if (cap > 0) { short barWidth = 182; int filled = (int)(mc.thePlayer.experience * (float)(barWidth + 1)); int top = height - 32 + 3; drawTexturedModalRect(left, top, 0, 64, barWidth, 5); - + if (filled > 0) { drawTexturedModalRect(left, top, 0, 69, filled, 5); @@ -508,8 +508,8 @@ public class GuiIngameForge extends GuiIngame } this.mc.mcProfiler.endSection(); - - + + if (mc.playerController.func_78763_f() && mc.thePlayer.experienceLevel > 0) { mc.mcProfiler.startSection("expLevel"); @@ -536,7 +536,7 @@ public class GuiIngameForge extends GuiIngame bind(field_110324_m); if (pre(JUMPBAR)) return; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - + mc.mcProfiler.startSection("jumpBar"); float charge = mc.thePlayer.func_110319_bJ(); final int barWidth = 182; @@ -813,12 +813,12 @@ public class GuiIngameForge extends GuiIngame if (!(tmp instanceof EntityLivingBase)) return; bind(field_110324_m); - + if (pre(HEALTHMOUNT)) return; - + boolean unused = false; int left_align = width / 2 + 91; - + mc.mcProfiler.endStartSection("mountHealth"); EntityLivingBase mount = (EntityLivingBase)tmp; int health = (int)Math.ceil((double)mount.func_110143_aJ()); @@ -826,7 +826,7 @@ public class GuiIngameForge extends GuiIngame int hearts = (int)(healthMax + 0.5F) / 2; if (hearts > 30) hearts = 30; - + final int MARGIN = 52; final int BACKGROUND = MARGIN + (unused ? 1 : 0); final int HALF = MARGIN + 45; @@ -835,7 +835,7 @@ public class GuiIngameForge extends GuiIngame for (int heart = 0; hearts > 0; heart += 20) { int top = height - right_height; - + int rowCount = Math.min(hearts, 10); hearts -= rowCount; diff --git a/fml b/fml index 2336002f2..26e5f4b4f 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 2336002f20e9412a7663781b23c51de0eff6a692 +Subproject commit 26e5f4b4ff5c8e95f9307a893e626e355162241f diff --git a/patches/minecraft/net/minecraft/client/audio/SoundPool.java.patch b/patches/minecraft/net/minecraft/client/audio/SoundPool.java.patch deleted file mode 100644 index fbf82fb28..000000000 --- a/patches/minecraft/net/minecraft/client/audio/SoundPool.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src_base/minecraft/net/minecraft/client/audio/SoundPool.java -+++ ../src_work/minecraft/net/minecraft/client/audio/SoundPool.java -@@ -12,6 +12,7 @@ - import java.util.Random; - import net.minecraft.client.resources.ResourceLocation; - import net.minecraft.client.resources.ResourceManager; -+import net.minecraftforge.client.ForgeHooksClient; - - @SideOnly(Side.CLIENT) - public class SoundPool diff --git a/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch b/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch index d472b2ce5..face476c9 100644 --- a/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch @@ -1,13 +1,13 @@ --- ../src_base/minecraft/net/minecraft/client/particle/EffectRenderer.java +++ ../src_work/minecraft/net/minecraft/client/particle/EffectRenderer.java -@@ -13,6 +13,7 @@ - import net.minecraft.client.resources.ResourceLocation; +@@ -12,6 +12,7 @@ + import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; + import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import org.lwjgl.opengl.GL11; - @@ -63,9 +64,13 @@ for (int j = 0; j < this.fxLayers[i].size(); ++j) { diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch index ecb571232..ecddbbc19 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch @@ -1,6 +1,6 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/ItemRenderer.java +++ ../src_work/minecraft/net/minecraft/client/renderer/ItemRenderer.java -@@ -17,6 +17,8 @@ +@@ -16,6 +16,8 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.EnumAction; import net.minecraft.item.Item; diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch index 4d5daf039..ee8d641cf 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch @@ -1,12 +1,12 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java +++ ../src_work/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java @@ -14,9 +14,15 @@ - import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.EnumArmorMaterial; import net.minecraft.item.Item; -+import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemArmor; ++import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; + import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; +import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED; +import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D; @@ -36,7 +36,7 @@ + /** + * More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide. -+ * ++ * + * @param entity Entity wearing the armor + * @param stack ItemStack for the armor + * @param slot Slot ID that the item is in @@ -46,9 +46,9 @@ + public static ResourceLocation getArmorResource(Entity entity, ItemStack stack, int slot, String type) + { + ItemArmor item = (ItemArmor)stack.getItem(); -+ String s1 = String.format("textures/models/armor/%s_layer_%d%s.png", ++ String s1 = String.format("textures/models/armor/%s_layer_%d%s.png", + bipedArmorFilenamePrefix[item.renderIndex], (slot == 2 ? 2 : 1), type == null ? "" : String.format("_%s", type)); -+ ++ + s1 = ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, (slot == 2 ? 2 : 1), type); + ResourceLocation resourcelocation = (ResourceLocation)field_110859_k.get(s1); + diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch index 9fb843102..3e8f5122f 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch @@ -1,9 +1,16 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java +++ ../src_work/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java -@@ -21,7 +21,16 @@ +@@ -15,13 +15,22 @@ + import net.minecraft.item.EnumArmorMaterial; + import net.minecraft.item.Item; + import net.minecraft.item.ItemArmor; ++import net.minecraft.item.ItemBlock; + import net.minecraft.item.ItemStack; + import net.minecraft.scoreboard.Score; import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.scoreboard.Scoreboard; import net.minecraft.util.MathHelper; + import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.client.IItemRenderer; +import net.minecraftforge.client.MinecraftForgeClient; @@ -11,7 +18,6 @@ +import net.minecraftforge.common.MinecraftForge; + import org.lwjgl.opengl.GL11; -+import net.minecraft.item.ItemBlock; +import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED; +import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D; @@ -125,7 +131,7 @@ boolean flag = par1AbstractClientPlayer.func_110310_o().func_110557_a(); boolean flag1 = !par1AbstractClientPlayer.isInvisible(); boolean flag2 = !par1AbstractClientPlayer.getHideCape(); -+ flag = event.renderCape && flag; ++ flag = event.renderCape && flag; float f6; if (flag && flag1 && flag2) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java.patch index 79c49ea4e..7b8e50683 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java.patch @@ -1,13 +1,13 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java +++ ../src_work/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java -@@ -9,8 +9,14 @@ +@@ -8,9 +8,14 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntitySnowman; +import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; + import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; -+ +import net.minecraftforge.client.IItemRenderer; +import static net.minecraftforge.client.IItemRenderer.ItemRenderType.*; +import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.*; @@ -15,7 +15,7 @@ @SideOnly(Side.CLIENT) public class RenderSnowMan extends RenderLiving -@@ -35,12 +41,15 @@ +@@ -35,12 +40,15 @@ super.renderEquippedItems(par1EntitySnowman, par2); ItemStack itemstack = new ItemStack(Block.pumpkin, 1); diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch index 3fad37302..59d63e9a6 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch @@ -1,9 +1,9 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java +++ ../src_work/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java @@ -17,6 +17,9 @@ - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.util.MathHelper; + import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.event.RenderLivingEvent; +import net.minecraftforge.common.MinecraftForge; + diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch index f01464714..e109085a0 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch @@ -1,21 +1,24 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java +++ ../src_work/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java -@@ -11,6 +11,8 @@ +@@ -11,9 +11,11 @@ import java.util.List; import javax.imageio.ImageIO; import net.minecraft.client.resources.Resource; -+import net.minecraft.client.resources.ResourceLocation; +import net.minecraft.client.resources.ResourceManager; import net.minecraft.client.resources.data.AnimationFrame; import net.minecraft.client.resources.data.AnimationMetadataSection; import net.minecraft.util.Icon; ++import net.minecraft.util.ResourceLocation; + + @SideOnly(Side.CLIENT) + public class TextureAtlasSprite implements Icon @@ -184,6 +186,20 @@ this.field_130224_d = par1; } + /** + * Load the specified resource as this sprite's data. -+ * Returning false from this function will prevent this icon from being stitched onto the master texture. ++ * Returning false from this function will prevent this icon from being stitched onto the master texture. + * @param manager Main resource manager + * @param location File resource location + * @return False to prevent this Icon from being stitched @@ -26,7 +29,7 @@ + func_130100_a(manager.func_110536_a(location)); + return true; + } -+ ++ public void func_130100_a(Resource par1Resource) throws IOException { this.func_130102_n(); diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch index e0a511cd1..0559af7d7 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -1,9 +1,9 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/texture/TextureMap.java +++ ../src_work/minecraft/net/minecraft/client/renderer/texture/TextureMap.java @@ -21,6 +21,7 @@ - import net.minecraft.item.Item; import net.minecraft.util.Icon; import net.minecraft.util.ReportedException; + import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.ForgeHooksClient; @SideOnly(Side.CLIENT) diff --git a/patches/minecraft/net/minecraft/inventory/Slot.java.patch b/patches/minecraft/net/minecraft/inventory/Slot.java.patch index e18fd8e3c..b9e0a8a1d 100644 --- a/patches/minecraft/net/minecraft/inventory/Slot.java.patch +++ b/patches/minecraft/net/minecraft/inventory/Slot.java.patch @@ -1,14 +1,17 @@ --- ../src_base/minecraft/net/minecraft/inventory/Slot.java +++ ../src_work/minecraft/net/minecraft/inventory/Slot.java -@@ -2,6 +2,8 @@ +@@ -2,9 +2,11 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.renderer.texture.TextureMap; -+import net.minecraft.client.resources.ResourceLocation; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.Icon; ++import net.minecraft.util.ResourceLocation; + + public class Slot + { @@ -22,6 +24,13 @@ /** display position of the inventory slot on the screen y axis */ @@ -39,7 +42,7 @@ + + /** + * Gets the path of the texture file to use for the background image of this slot when drawing the GUI. -+ * @return String: The texture file that will be used in GuiContainer.drawSlotInventory for the slot background. ++ * @return String: The texture file that will be used in GuiContainer.drawSlotInventory for the slot background. + */ + @SideOnly(Side.CLIENT) + public ResourceLocation getBackgroundIconTexture() @@ -49,7 +52,7 @@ + + /** + * Sets which icon index to use as the background image of the slot when it's empty. -+ * @param icon The icon to use, null for none ++ * @param icon The icon to use, null for none + */ + public void setBackgroundIcon(Icon icon) + { @@ -67,9 +70,9 @@ + } + + /** -+ * Retrieves the index in the inventory for this slot, this value should typically not ++ * Retrieves the index in the inventory for this slot, this value should typically not + * be used, but can be useful for some occasions. -+ * ++ * + * @return Index in associated inventory for this slot. + */ + public int getSlotIndex() diff --git a/update_patches.py b/update_patches.py index d89d08166..cc520c204 100644 --- a/update_patches.py +++ b/update_patches.py @@ -49,7 +49,9 @@ def main(): for cur_file in fnmatch.filter(filelist, '*.java'): file_base = os.path.normpath(os.path.join(base, path[len(work)+1:], cur_file)).replace(os.path.sep, '/') file_work = os.path.normpath(os.path.join(work, path[len(work)+1:], cur_file)).replace(os.path.sep, '/') - + if not os.path.isfile(file_base): + print("Missing base file %s"%(file_base)) + continue fromlines = open(file_base, 'U').readlines() tolines = open(file_work, 'U').readlines() @@ -74,4 +76,4 @@ def main(): cleanDirs(patchd) if __name__ == '__main__': - main() \ No newline at end of file + main() From 34bcca2640bbfd84e9b294074677326ca11cfca1 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 8 Jul 2013 18:35:34 -0700 Subject: [PATCH 063/146] Fix accedential reverted patch. --- .../renderer/texture/TextureMap.java.patch | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch index 0559af7d7..cf6a060cb 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -22,7 +22,19 @@ Iterator iterator = this.field_110574_e.entrySet().iterator(); while (iterator.hasNext()) -@@ -142,6 +146,7 @@ +@@ -73,7 +77,10 @@ + + try + { +- textureatlassprite.func_130100_a(par1ResourceManager.func_110536_a(resourcelocation1)); ++ if (!textureatlassprite.load(par1ResourceManager, resourcelocation1)) ++ { ++ continue; ++ } + } + catch (RuntimeException runtimeexception) + { +@@ -142,6 +149,7 @@ textureatlassprite1 = (TextureAtlasSprite)iterator1.next(); textureatlassprite1.copyFrom(this.missingImage); } @@ -30,7 +42,7 @@ } private void func_110573_f() -@@ -212,6 +217,7 @@ +@@ -212,6 +220,7 @@ if (par1Str == null) { (new RuntimeException("Don\'t register null!")).printStackTrace(); @@ -38,7 +50,7 @@ } Object object = (TextureAtlasSprite)this.field_110574_e.get(par1Str); -@@ -253,4 +259,37 @@ +@@ -253,4 +262,37 @@ { this.updateAnimations(); } From 29fabb12e05d23076ff5b0d24169733044229565 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 8 Jul 2013 18:54:03 -0700 Subject: [PATCH 064/146] Proper return for getRegisteredFluidContainerData thanks Soaryn. Ref issue #634 --- common/net/minecraftforge/fluids/FluidContainerRegistry.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/common/net/minecraftforge/fluids/FluidContainerRegistry.java b/common/net/minecraftforge/fluids/FluidContainerRegistry.java index c94880e32..e6fba89fa 100644 --- a/common/net/minecraftforge/fluids/FluidContainerRegistry.java +++ b/common/net/minecraftforge/fluids/FluidContainerRegistry.java @@ -211,8 +211,7 @@ public abstract class FluidContainerRegistry { } public static FluidContainerData[] getRegisteredFluidContainerData() { - - return (FluidContainerData[]) containerFluidMap.values().toArray(); + return containerFluidMap.values().toArray(new FluidContainerData[containerFluidMap.size()]); } /** From 8eddb7f1b9fe9d1b486676a443c561561a7262e2 Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 9 Jul 2013 01:30:22 -0700 Subject: [PATCH 065/146] Updated FML: MinecraftForge/FML@c997f2adbc4c11cd8c2abe5f82ccd00b0e954b68 FML now verifies that the minecraft jar is correct and intact. This is intended to discourage those who think that modifying the minecraft jar is still acceptable. MinecraftForge/FML@0db4624b27a5ecf59ed506ccfc26459ca26ee408 Don't initialize the server. MinecraftForge/FML@4fa375683fdb7edff67c951fb371ab4a23435308 Fix NPE in new debug line when patch targets don't exist. --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index 26e5f4b4f..4fa375683 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 26e5f4b4ff5c8e95f9307a893e626e355162241f +Subproject commit 4fa375683fdb7edff67c951fb371ab4a23435308 From ae97ad2bcaa5c992bfcd2ea87973edc03a5abe04 Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 9 Jul 2013 03:35:52 -0700 Subject: [PATCH 066/146] Updated FML: MinecraftForge/FML@dfa3a2665d6782b87713cea26dda558ac990a72a Add MC Version to installed version name. MinecraftForge/FML@e91431fb707ce3e7e4296ccb8f3b2e5208b4dfac Don't validate signatures on servers, they are not signed. MinecraftForge/FML@c7ab872c85dd057a4e44e12e34089dfd1a1184b6 Temporarily disable GuiModList's Mod logos. --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index 4fa375683..c7ab872c8 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 4fa375683fdb7edff67c951fb371ab4a23435308 +Subproject commit c7ab872c85dd057a4e44e12e34089dfd1a1184b6 From a85d82a859059f966bed1a44bdfd6e46c6d43184 Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 9 Jul 2013 05:04:50 -0700 Subject: [PATCH 067/146] MinecraftForge/FML@c913258ca38e662264bdf4aafbfbef86881c9290 Disable signature check of client for now, it's broken. --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index c7ab872c8..c913258ca 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit c7ab872c85dd057a4e44e12e34089dfd1a1184b6 +Subproject commit c913258ca38e662264bdf4aafbfbef86881c9290 From 475918a1cadbe9d12f4cdefc5e0a8fa0f7a350f2 Mon Sep 17 00:00:00 2001 From: Christian Date: Tue, 9 Jul 2013 08:33:05 -0400 Subject: [PATCH 068/146] Updated FML: MinecraftForge/FML@97269a5e3dc0a0e2e1a79183f9f5f2ee120e90bd Decode the file URL. Hopefully will make things work more.. MinecraftForge/FML@d4d522c5978ecd7a9195977b3327b441901bb5b4 And don't forget to remove the test code --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index c913258ca..d4d522c59 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit c913258ca38e662264bdf4aafbfbef86881c9290 +Subproject commit d4d522c5978ecd7a9195977b3327b441901bb5b4 From 561b0fbe55461c8b6c6af9f40597666f4b11368e Mon Sep 17 00:00:00 2001 From: Christian Date: Tue, 9 Jul 2013 11:22:21 -0400 Subject: [PATCH 069/146] Allow optional rider interaction for entities, thanks for the suggestion Vswe. Updated FML: MinecraftForge/FML@7af5c21d74679d1a53550f9719bba22b2f28dd13 @InstanceFactory was set to look for Fields instead of methods MinecraftForge/FML@bc9d1fe657c7a0953adc7d4c5ed81c575bdfb0f1 Merge pull request #254 from CaptainShadows/patch-1 --- fml | 2 +- .../client/renderer/EntityRenderer.java.patch | 9 +++++++++ .../renderer/texture/TextureMap.java.patch | 18 +++--------------- .../net/minecraft/entity/Entity.java.patch | 13 ++++++++++++- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/fml b/fml index d4d522c59..bc9d1fe65 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit d4d522c5978ecd7a9195977b3327b441901bb5b4 +Subproject commit bc9d1fe657c7a0953adc7d4c5ed81c575bdfb0f1 diff --git a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch index ad8f31660..d80636f98 100644 --- a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch @@ -12,6 +12,15 @@ @SideOnly(Side.CLIENT) public class EntityRenderer { +@@ -319,7 +324,7 @@ + + if (d3 < d2 || d2 == 0.0D) + { +- if (entity == this.mc.renderViewEntity.ridingEntity) ++ if (entity == this.mc.renderViewEntity.ridingEntity && !entity.canRiderInteract()) + { + if (d2 == 0.0D) + { @@ -354,8 +359,15 @@ */ private void updateFovModifierHand() diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch index cf6a060cb..0559af7d7 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -22,19 +22,7 @@ Iterator iterator = this.field_110574_e.entrySet().iterator(); while (iterator.hasNext()) -@@ -73,7 +77,10 @@ - - try - { -- textureatlassprite.func_130100_a(par1ResourceManager.func_110536_a(resourcelocation1)); -+ if (!textureatlassprite.load(par1ResourceManager, resourcelocation1)) -+ { -+ continue; -+ } - } - catch (RuntimeException runtimeexception) - { -@@ -142,6 +149,7 @@ +@@ -142,6 +146,7 @@ textureatlassprite1 = (TextureAtlasSprite)iterator1.next(); textureatlassprite1.copyFrom(this.missingImage); } @@ -42,7 +30,7 @@ } private void func_110573_f() -@@ -212,6 +220,7 @@ +@@ -212,6 +217,7 @@ if (par1Str == null) { (new RuntimeException("Don\'t register null!")).printStackTrace(); @@ -50,7 +38,7 @@ } Object object = (TextureAtlasSprite)this.field_110574_e.get(par1Str); -@@ -253,4 +262,37 @@ +@@ -253,4 +259,37 @@ { this.updateAnimations(); } diff --git a/patches/minecraft/net/minecraft/entity/Entity.java.patch b/patches/minecraft/net/minecraft/entity/Entity.java.patch index 9185eb779..a38d7c938 100644 --- a/patches/minecraft/net/minecraft/entity/Entity.java.patch +++ b/patches/minecraft/net/minecraft/entity/Entity.java.patch @@ -155,7 +155,7 @@ } public boolean func_96091_a(Explosion par1Explosion, World par2World, int par3, int par4, int par5, int par6, float par7) -@@ -2426,4 +2496,149 @@ +@@ -2426,4 +2496,160 @@ { return this.getEntityName(); } @@ -303,5 +303,16 @@ + public IExtendedEntityProperties getExtendedProperties(String identifier) + { + return this.extendedProperties.get(identifier); ++ } ++ ++ /** ++ * If a rider of this entity can interact with this entity. Should return true on the ++ * ridden entity if so. ++ * ++ * @return if the entity can be interacted with from a rider ++ */ ++ public boolean canRiderInteract() ++ { ++ return false; + } } From a990c0bdc82eb29932d8af05d9fac1a39c7cbbe3 Mon Sep 17 00:00:00 2001 From: Christian Date: Tue, 9 Jul 2013 11:38:54 -0400 Subject: [PATCH 070/146] Remove forge ISidedInventory, deprecated since 1.5. --- .../common/ForgeDummyContainer.java | 5 -- .../common/ISidedInventory.java | 31 ---------- .../tileentity/TileEntityFurnace.java.patch | 61 +------------------ 3 files changed, 3 insertions(+), 94 deletions(-) delete mode 100644 common/net/minecraftforge/common/ISidedInventory.java diff --git a/common/net/minecraftforge/common/ForgeDummyContainer.java b/common/net/minecraftforge/common/ForgeDummyContainer.java index 2815eeb8b..d62a69c24 100644 --- a/common/net/minecraftforge/common/ForgeDummyContainer.java +++ b/common/net/minecraftforge/common/ForgeDummyContainer.java @@ -41,7 +41,6 @@ import static net.minecraftforge.common.ForgeVersion.*; public class ForgeDummyContainer extends DummyModContainer implements WorldAccessContainer { public static int clumpingThreshold = 64; - public static boolean legacyFurnaceSides = false; public static boolean removeErroringEntities = false; public static boolean removeErroringTileEntities = false; public static boolean disableStitchedFileSaving = false; @@ -99,10 +98,6 @@ public class ForgeDummyContainer extends DummyModContainer implements WorldAcces prop.set(64); } - prop = config.get(Configuration.CATEGORY_GENERAL, "legacyFurnaceOutput", false); - prop.comment = "Controls the sides of vanilla furnaces for Forge's ISidedInventory, Vanilla defines the output as the bottom, but mods/Forge define it as the sides. Settings this to true will restore the old side relations."; - legacyFurnaceSides = prop.getBoolean(false); - prop = config.get(Configuration.CATEGORY_GENERAL, "removeErroringEntities", false); prop.comment = "Set this to just remove any TileEntity that throws a error in there update method instead of closing the server and reporting a crash log. BE WARNED THIS COULD SCREW UP EVERYTHING USE SPARINGLY WE ARE NOT RESPONSIBLE FOR DAMAGES."; removeErroringEntities = prop.getBoolean(false); diff --git a/common/net/minecraftforge/common/ISidedInventory.java b/common/net/minecraftforge/common/ISidedInventory.java deleted file mode 100644 index 028b09c2a..000000000 --- a/common/net/minecraftforge/common/ISidedInventory.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This software is provided under the terms of the Minecraft Forge Public - * License v1.0. - */ - -package net.minecraftforge.common; - -import net.minecraft.inventory.IInventory; - -/** Inventory ranges mapped by side. This class is implemented by TileEntities - * that provide different inventory slot ranges to different sides. - */ -@Deprecated //A equivalent Interface is now in Minecraft Vanilla will be removed next major MC version -public interface ISidedInventory extends IInventory -{ - - /** - * Get the start of the side inventory. - * @param side The global side to get the start of range. - */ - @Deprecated - int getStartInventorySide(ForgeDirection side); - - /** - * Get the size of the side inventory. - * @param side The global side. - */ - @Deprecated - int getSizeInventorySide(ForgeDirection side); -} - diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch index d4bccd0b1..4487d07f9 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch @@ -8,19 +8,15 @@ import net.minecraft.item.ItemHoe; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; -@@ -16,8 +17,10 @@ +@@ -16,6 +17,8 @@ import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -- --public class TileEntityFurnace extends TileEntity implements ISidedInventory +import net.minecraftforge.common.ForgeDirection; +import net.minecraftforge.common.ForgeDummyContainer; -+ -+public class TileEntityFurnace extends TileEntity implements ISidedInventory, net.minecraftforge.common.ISidedInventory + + public class TileEntityFurnace extends TileEntity implements ISidedInventory { - private static final int[] slots_top = new int[] {0}; - private static final int[] slots_bottom = new int[] {2, 1}; @@ -279,8 +282,7 @@ if (this.furnaceItemStacks[1].stackSize == 0) @@ -75,54 +71,3 @@ { Block block = Block.blocksList[i]; -@@ -459,4 +465,50 @@ - { - return par3 != 0 || par1 != 1 || par2ItemStack.itemID == Item.bucketEmpty.itemID; - } -+ -+ /*********************************************************************************** -+ * This function is here for compatibilities sake, Modders should Check for -+ * Sided before ContainerWorldly, Vanilla Minecraft does not follow the sided standard -+ * that Modding has for a while. -+ * -+ * In vanilla: -+ * -+ * Top: Ores -+ * Sides: Fuel -+ * Bottom: Output -+ * -+ * Standard Modding: -+ * Top: Ores -+ * Sides: Output -+ * Bottom: Fuel -+ * -+ * The Modding one is designed after the GUI, the vanilla one is designed because its -+ * intended use is for the hopper, which logically would take things in from the top. -+ * -+ * This will possibly be removed in future updates, and make vanilla the definitive -+ * standard. -+ */ -+ -+ @Override -+ public int getStartInventorySide(ForgeDirection side) -+ { -+ if (ForgeDummyContainer.legacyFurnaceSides) -+ { -+ if (side == ForgeDirection.DOWN) return 1; -+ if (side == ForgeDirection.UP) return 0; -+ return 2; -+ } -+ else -+ { -+ if (side == ForgeDirection.DOWN) return 2; -+ if (side == ForgeDirection.UP) return 0; -+ return 1; -+ } -+ } -+ -+ @Override -+ public int getSizeInventorySide(ForgeDirection side) -+ { -+ return 1; -+ } - } From c3fbd27a8dd3e6fa8f06f143cb71132c79721b50 Mon Sep 17 00:00:00 2001 From: Christian Date: Tue, 9 Jul 2013 15:36:47 -0400 Subject: [PATCH 071/146] Updated FML: MinecraftForge/FML@bab4d87ce76baa40200939cc46780b1d3b2ff466 Update FML for new stealth update for 1.6.2 --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index bc9d1fe65..bab4d87ce 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit bc9d1fe657c7a0953adc7d4c5ed81c575bdfb0f1 +Subproject commit bab4d87ce76baa40200939cc46780b1d3b2ff466 From 562e8e8021b6e2604cc7bea01bd6e15e862acb55 Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 9 Jul 2013 12:56:34 -0700 Subject: [PATCH 072/146] Re-add reverted patch AGAIN cpw check your commits -.- --- .../client/renderer/texture/TextureMap.java.patch | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch index 0559af7d7..4e123f342 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -22,6 +22,15 @@ Iterator iterator = this.field_110574_e.entrySet().iterator(); while (iterator.hasNext()) +@@ -73,7 +77,7 @@ + + try + { +- textureatlassprite.func_130100_a(par1ResourceManager.func_110536_a(resourcelocation1)); ++ if (!textureatlassprite.load(par1ResourceManager, resourcelocation1)) continue; + } + catch (RuntimeException runtimeexception) + { @@ -142,6 +146,7 @@ textureatlassprite1 = (TextureAtlasSprite)iterator1.next(); textureatlassprite1.copyFrom(this.missingImage); From c4ad7c3e2cc5bc515d1f2f78abdefc26fe1ffd4f Mon Sep 17 00:00:00 2001 From: Adubbz Date: Wed, 10 Jul 2013 20:06:23 +1000 Subject: [PATCH 073/146] Made eating particles compatible with metadata Removed extra spaces Made eating particles compatible with metadata --- .../net/minecraft/entity/player/EntityPlayer.java.patch | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch index b7df911fc..59f12f917 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -56,6 +56,15 @@ if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0) { this.updateItemUse(itemstack, 5); +@@ -448,7 +448,7 @@ + vec31.rotateAroundX(-this.rotationPitch * (float)Math.PI / 180.0F); + vec31.rotateAroundY(-this.rotationYaw * (float)Math.PI / 180.0F); + vec31 = vec31.addVector(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ); +- this.worldObj.spawnParticle("iconcrack_" + par1ItemStack.getItem().itemID, vec31.xCoord, vec31.yCoord, vec31.zCoord, vec3.xCoord, vec3.yCoord + 0.05D, vec3.zCoord); ++ this.worldObj.spawnParticle("iconcrack_" + par1ItemStack.getItem().itemID + "_" + par1ItemStack.getItemDamage(), vec31.xCoord, vec31.yCoord, vec31.zCoord, vec3.xCoord, vec3.yCoord + 0.05D, vec3.zCoord); + } + + this.playSound("random.eat", 0.5F + 0.5F * (float)this.rand.nextInt(2), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); @@ -537,11 +556,11 @@ this.cameraYaw = 0.0F; this.addMountedMovementStat(this.posX - d0, this.posY - d1, this.posZ - d2); From 75907e3815b77665b1bbac2b1c918bed288bf428 Mon Sep 17 00:00:00 2001 From: Christian Date: Wed, 10 Jul 2013 17:30:45 -0400 Subject: [PATCH 074/146] Updated FML: MinecraftForge/FML@e44e8b3112bd56c716a00c19d0be2f15d9128b70 Force a global asset scan prior to mod construction : you should be able to reference assets anywhere in your mod now. MinecraftForge/FML@20e93a412ee13498babef02d404f57bf5e0fd919 Fix up logos in the mod screen. Clean up some unnecessary casts and suppressions, use the -debug asm library at dev time, since it contains full symbols and code in compiled form. --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index bab4d87ce..20e93a412 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit bab4d87ce76baa40200939cc46780b1d3b2ff466 +Subproject commit 20e93a412ee13498babef02d404f57bf5e0fd919 From e418dddbcff0fc4d31ab891cb0a91fc122add0f1 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 10 Jul 2013 15:24:53 -0700 Subject: [PATCH 075/146] MinecraftForge/FML@b9f4b02cb0b041594656f05de70225df702a8ddd Kill mcp's truncate method, for more useful logs. --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index 20e93a412..b9f4b02cb 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 20e93a412ee13498babef02d404f57bf5e0fd919 +Subproject commit b9f4b02cb0b041594656f05de70225df702a8ddd From 70a6a316d7f11b5a7132e517fe4c113ae515818d Mon Sep 17 00:00:00 2001 From: LexManos Date: Fri, 12 Jul 2013 00:34:25 -0700 Subject: [PATCH 076/146] Updated FML: MinecraftForge/FML@7348929819b0ae8ad35419ef5dbf66e66b442858 Kill release time scala libraries, to be re-evaluated after all movement is done and shit is fixed. May require manual instalation for mods that use scala. MinecraftForge/FML@6de36d78f57f6f08ec586b67b684d0e5406cd436 Coremods now have a primitive dependency capability. Also, we search mods dir for special "TweakClass" manifests. These are using the vanilla tweak mechanism to inject into Minecraft. Helpful for other "platform" systems, when you don't want to have to deal with json changes! MinecraftForge/FML@d4b30422b64a62a2f8a8c2cccd94cb0fd06154e0 Update build and eclipse workspaces for debug asm. --- eclipse-workspace-dev.zip | Bin 24492 -> 24498 bytes fml | 2 +- .../entity/player/EntityPlayer.java.patch | 4 ++-- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eclipse-workspace-dev.zip b/eclipse-workspace-dev.zip index 049c406efae55b5e00f5bcdcc47762cacdfbbf5f..bae5bfc89b7cec4d5ca8716e7d12fb6614ee4845 100644 GIT binary patch delta 2515 zcmai$dpuO>AIE3LHF3y&1`XwsYl@0OJ5pxMOye>rmzgw;OVY-K&80!xBxzk9B$r4f zmv-g0g|JGOQ8ZgBEha@pL|bBGCp(>E_V=pS@AvwhKhFDko$u#)p6~OV@8>+{Qaie? z9j)X}mXcOSeYu`uCTf*Z(Nbc9e6%IZJLvT=(HIYy-WY$FJSh(#EyZ1I3t%!$?7$FN zrT(mRGcpK6mi8r3e_1v_A66)vP~itm6H{5Zal*1oBDJf}Tzz9HEc4l93cbWkICqE6 z?3>1*P-qC8+~g%6UsS}YNsItsbkizsk#cwjsrpp0tJOKq{ZYZV-DO+;IF0A#Lo?H3 zX)2t-^1z+l1P<0IX=59fLABxvPs%-s_1#h@(mjV+R6)ThI5YlN&i^TD{?nTtx!3iA)-oi(J9ZP zYgqJOw#3Lg(LJ%ZTbP*ao!L=*XKF}Z&W#3v?cIE1r^$#F@|mIwozHUes9LeL%=`-L z+1Cf37h*~D;H>9i#(liO+pf|0ln&lv45$u4}qqf*DgUOW)QmJ3IwC zesCxnU~u&y-Ymd0HR~u(we}RH>DpPzoXft3gR*XopW7nN_YYa-w743N|2O>lFzuNNsyLn<`C+%Q-ZrbG@7t3Kap4I~#BVY5msf ziNf=uV`fvo7B(bMQqDrjvY7R``&DVVh5186eOYhSo0;w734#U;u3)=IaeT%wXR@)T z_|@o$y+*73L!SAeiBDIjKISWWcd`>EL}!Z5ZJ8SBKXu>rZ0W5%y-rCV!p7EweJq>3 z!#+5H)r)hKTOR);pw9ha{CJiR_kM}Fp3OlsJAl_MdqC&U@_rNqDkU$=KbjK4du~{_ zLlD4I&NOY)Euqr5LdrI+4I!+$&l2xgh`m#tMH%)dvt6R6U&qzm(QZ1=iHqkYTw7oe zQ|`aXRIO4%GrhV`M|Qb5%KYn{J*gsZX>>}^)hApVvnK}qGI+Df^x;7(G~a?We$(Wo ztz%dLo1%tS_E{!9O{X+zBn$ej zp@dbP^T#^gR&*#R*NsxvvBJc%FcHU_k4?n*zj(Z!Z>d$@_Q~B))I}I-s5t$YGI(TvPDo_K&29X; zCDs8)k1KFky>Baq}ZLvs}yC*+H9sHG-i@Vol0IUpLyFjK*w6{d=x~3vSy?MnZ#Nt%Uzet4a=n6eF0h79mI`Yr<0& zki(V#-im}4320OeIA%eKgvOU6F@&I+(zF=T0Vz};=x;@4;-RKlG4*#1I0o^Vh|6n2=;E5rQVaN;t&! zw_mFvM0!cs()R6}kw<-V$P4`KWJ!^SDg=iC6ySg^0ptLZzW4{i8U8(4ylJBh7h5V~ zj(rD~2jW0afTF6TOeB131Mr?&z?`52R00*zc%T=^#(z5+^wnr2a5hkHi>nt>cM|@$ z%)k1cLnzdLveFl46%Eh~6InNn%v$kMtQZdHIuOqIe@np;fi)2aCK-yVl9?rhm!b)F c5FudARK&O=$|SMc*FzofnEJADq%WKD4;P|Vg#Z8m delta 2498 zcmZvec|4SB8^>qHk}N~E7+K4HDw%oFU@&DJ%U~i#mW+L0D#yqqClrZ!QuZ|wIT9(9 zZ90^(FHN1Hg?a~tLm8zHy*$&L_dUJMKi}swzw5rP-#qjDp8LMr0lnP;6~W_pcqJj* zAD0MLgGd^bXNy2CbU(-^P(6@Pm?OwzFe1nl9!G$ehw}Y;7^IiF0U%~4)>y{d%4y=s z@31X2-r@I90xLw-?Z7X*)HV6Ri}d|{+){(atb;Tmu*}6!6HX0gVe_6UF_vKv$eaiO zHIo9$4KV^S@+C3#XBV=7SwjsE4 zWm?K&(5+YuCQ*A|SJg4Aof9dLXM`C4LS4u7b9kUtu^gL)VQb4JUG|}*F%D@ll$qCg za%h)l{yd0(`ipf7sq7{a*Ee@OFyGHsLUB#cSitBj?qY}L{(=LGCp&Z;eHMr2y7iIN z>V6g4nC%^rwkucWWuPw)FDzAsb_kZ)SX;#ScuO3b&ew5_?-SYCit#Y3Up%TEkbW=D zEYgfM6g*U%jLX^dgMAgE_}f`j-VmiSjjKN#e$aG$Ujtq?Ii^%>shEFb_d0&!jK&ug z%|_I+9?Thq+o=pdY)ELjiET9$9R;sd2`1qqP^v%0~1qpiCWt#`#MoX<(#2Jpv^dj zbe}1Hzu7vxMQ36lRb}pX2yD32AA!6l+UipL$B49?DqXEJQc6v$zsOO)Dp-*npYotT znm7f^y;>n<3PEgAECU~pV*>AAzr=8Q#8)}=fcU4t2mW^>Su7Jiqoj4>tvdNSEG4_a zPrTLvaX%R$BSxNcHcxM*H-YL(Go!j=0($oP*^>5ZbQWCP)n44zx1SJ{vw4+%zCll6 z*rc%pLx6z~HrwBh1JqHboy-UO5vrKg+a6& zBX+{%TD)zF*0e5$o#-$)Qg&u#fzGPH<9&656-~c1jpsJSkC5N$qS+bnN5x15GQ;C8 zevJG++lBI~L|Yyit7QNv#ySSoyd@t{j&(ioI>}8V&R@n}C7o};?=vKCn!fzv(AHyDI5ZE6I-HlYY6LYpyX-Scv=DLoby05*yl^C6Cm6?n#MbzbLy>N%`iFx^{*rc&~ zc*H5f^_%(HBW51M)a&(W{Aze|K^Nq=^sU5%gh+o+4B4i86KQn3Q8|E_+uhtbAwQ?@n%1Rx9u6LO<$TB`5f+kd@x*X#;{($N+n?8RN6yXICXsGFj7I&S4G<_sXc#| z*-|@+&3QIABpmnaTJYy&w&?ce1K4`XG!B}(aDt<5<;4lkMQfzQa8D$SKpup0nI9_z-jl$B#7%sRH4%To8e6x`TrCJ*cc!?utIfs8sGB_V~ZPN&F6_*OPgwKC_ zJ^;nzpfD52-}@m@iVOL_+JnPCuMM-41MF;F;0RexZw`S5+ZNDKm|YZ{JC4IG2?Z$G zUjXGU7de1tZwogJ;H>5lkaws7s(B%>U&(z}d9`Spyw4r((m=gi>37?5K$!bc zczqmaIfp=p`z=roAs*K4Ea6C8wzdE0LICo^Y2X>rfWPDqrw9i!An9QQEd(4rtigUo z9&)gMn*xSr2!tR+2|U$6Au;or4z{$~AARCJi|6d!pfx{C7GJx_lg5CzAJpXH1(h3N* hLI8DmVK{dnhXC9Q1+&>!xmI@o8D2{KvDVv@{sTJCV{`xj diff --git a/fml b/fml index b9f4b02cb..d4b30422b 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit b9f4b02cb0b041594656f05de70225df702a8ddd +Subproject commit d4b30422b64a62a2f8a8c2cccd94cb0fd06154e0 diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch index 59f12f917..a1d0e4a84 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -56,14 +56,14 @@ if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0) { this.updateItemUse(itemstack, 5); -@@ -448,7 +448,7 @@ +@@ -429,7 +448,7 @@ vec31.rotateAroundX(-this.rotationPitch * (float)Math.PI / 180.0F); vec31.rotateAroundY(-this.rotationYaw * (float)Math.PI / 180.0F); vec31 = vec31.addVector(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ); - this.worldObj.spawnParticle("iconcrack_" + par1ItemStack.getItem().itemID, vec31.xCoord, vec31.yCoord, vec31.zCoord, vec3.xCoord, vec3.yCoord + 0.05D, vec3.zCoord); + this.worldObj.spawnParticle("iconcrack_" + par1ItemStack.getItem().itemID + "_" + par1ItemStack.getItemDamage(), vec31.xCoord, vec31.yCoord, vec31.zCoord, vec3.xCoord, vec3.yCoord + 0.05D, vec3.zCoord); } - + this.playSound("random.eat", 0.5F + 0.5F * (float)this.rand.nextInt(2), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); @@ -537,11 +556,11 @@ this.cameraYaw = 0.0F; From 2e1aa99f5482d6a005c3666a3236a4b10bc20c65 Mon Sep 17 00:00:00 2001 From: LexManos Date: Fri, 12 Jul 2013 03:09:24 -0700 Subject: [PATCH 077/146] MinecraftForge/FML@c625ef30093abb0755985c74d1f31e2c4cf6cfdd Update Forge signature for new private key --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index d4b30422b..c625ef300 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit d4b30422b64a62a2f8a8c2cccd94cb0fd06154e0 +Subproject commit c625ef30093abb0755985c74d1f31e2c4cf6cfdd From c40499ab0547c80ebcb5f1477b510785577691ef Mon Sep 17 00:00:00 2001 From: LexManos Date: Fri, 12 Jul 2013 03:09:54 -0700 Subject: [PATCH 078/146] Update changelog generator to point to new jenkins. --- changelog.py | 4 ++-- release.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/changelog.py b/changelog.py index 017cf544b..bd4f2b900 100644 --- a/changelog.py +++ b/changelog.py @@ -26,7 +26,7 @@ class PreemptiveBasicAuthHandler(urllib2.BaseHandler): def read_url(url): handler = PreemptiveBasicAuthHandler() - handler.add_password(None, 'jenkins.minecraftforge.net:81', 'console_script', 'fd584bffa72fcac12181f37f80001200') + handler.add_password(None, 'ci.jenkins.minecraftforge.net', 'console_script', 'dc6d48ca20a474beeac280a9a16a926e') file = urllib2.build_opener(handler).open(url) data = file.read() file.close() @@ -110,4 +110,4 @@ def make_changelog(job_path, target_build, change_file, current_version=None): file.close() if __name__ == '__main__': - make_changelog("http://jenkins.minecraftforge.net:81/job/minecraftforge/", 70000, 'changelog.txt', 'pinecone') \ No newline at end of file + make_changelog("http://ci.jenkins.minecraftforge.net/job/minecraftforge/", 70000, 'changelog.txt', 'pinecone') \ No newline at end of file diff --git a/release.py b/release.py index 31d6bb012..dfb72ab91 100644 --- a/release.py +++ b/release.py @@ -116,7 +116,7 @@ def main(): if not options.skip_changelog: changelog_file = 'target/minecraftforge-changelog-%s.txt' % (version_str) try: - make_changelog("http://jenkins.minecraftforge.net:81/job/minecraftforge/", build_num, changelog_file, version_str) + make_changelog("http://ci.jenkins.minecraftforge.net/job/minecraftforge/", build_num, changelog_file, version_str) except HTTPError, e: print 'Changelog failed to generate: %s' % e options.skip_changelog = True From c5af747da9f817571dce2db5b6675cc0cac36faa Mon Sep 17 00:00:00 2001 From: LexManos Date: Fri, 12 Jul 2013 04:08:29 -0700 Subject: [PATCH 079/146] Monkey patch to try and make print flush properly. --- release.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/release.py b/release.py index dfb72ab91..8965759fe 100644 --- a/release.py +++ b/release.py @@ -6,7 +6,7 @@ from optparse import OptionParser from urllib2 import HTTPError from contextlib import closing from datetime import datetime - +sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) forge_dir = os.path.dirname(os.path.abspath(__file__)) from forge import reset_logger, load_version, zip_folder, zip_create, inject_version, build_forge_dev from changelog import make_changelog diff --git a/setup.py b/setup.py index f4556d915..89389e4a2 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ import os, os.path, sys, zipfile import shutil, glob, fnmatch, subprocess from pprint import pformat from optparse import OptionParser - +sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) forge_dir = os.path.dirname(os.path.abspath(__file__)) from forge import apply_forge_patches From 745fa93f3f221623ccc62fa3e14d5754bb18cd1b Mon Sep 17 00:00:00 2001 From: Christian Date: Sun, 14 Jul 2013 13:47:53 -0400 Subject: [PATCH 080/146] Updated FML: MinecraftForge/FML@0378355c3720d587652b7792665a8b70bf104eb3 The server.classpath generates the runtime manifest, so it needs the non-debug asm jars. MinecraftForge/FML@a3f48734ffbbb2eccffdafcd3cbe73824bd1afd6 Fix up jar sanity check code. FML validation of the jar works now and doesn't derp classloading. MinecraftForge/FML@9947ba85036542a3231e25328d3300f2a5337370 Fix logo handling. no more NPE if the logo can't be found. Also, fix location of mcp logo now. --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index c625ef300..9947ba850 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit c625ef30093abb0755985c74d1f31e2c4cf6cfdd +Subproject commit 9947ba85036542a3231e25328d3300f2a5337370 From 81cce7b6ac2f35fee53eadd81189e5d09959edaa Mon Sep 17 00:00:00 2001 From: Christian Date: Sun, 14 Jul 2013 14:22:57 -0400 Subject: [PATCH 081/146] Fix for new location of mcp logo. --- release.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release.py b/release.py index 8965759fe..08af323ef 100644 --- a/release.py +++ b/release.py @@ -156,7 +156,7 @@ def main(): 'common/fml_marker.cfg', 'common/fmlversion.properties', 'common/mcpmod.info', - 'client/mcp.png', + 'client/mcplogo.png', 'common/deobfuscation_data-%s.lzma' % version_mc ] for file in FML_FILES: From 56ab2fd7978ee0d2c8bc6a98f6969bb5a2bf1ac4 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 15 Jul 2013 10:58:11 -0700 Subject: [PATCH 082/146] Updated FML: MinecraftForge/FML@c48b48ee15f38d3e794b6eb3499c536226ca5a79 Fix server launching. --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index 9947ba850..c48b48ee1 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 9947ba85036542a3231e25328d3300f2a5337370 +Subproject commit c48b48ee15f38d3e794b6eb3499c536226ca5a79 From 88e0ecf2cf3f74b9a597fefa2cc68a7093dd79c2 Mon Sep 17 00:00:00 2001 From: Soaryn Date: Tue, 16 Jul 2013 01:27:39 -0400 Subject: [PATCH 083/146] Fixes Vanilla Fluid Still Icon Setters Fixes null icons from being set for both the still water/lava icons, and sets the correct Icon. --- client/net/minecraftforge/client/ForgeHooksClient.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/net/minecraftforge/client/ForgeHooksClient.java b/client/net/minecraftforge/client/ForgeHooksClient.java index 8e7ea312d..c527bdc5a 100644 --- a/client/net/minecraftforge/client/ForgeHooksClient.java +++ b/client/net/minecraftforge/client/ForgeHooksClient.java @@ -240,8 +240,8 @@ public class ForgeHooksClient { MinecraftForge.EVENT_BUS.post(new TextureStitchEvent.Post(map)); - FluidRegistry.WATER.setIcons(BlockFluid.func_94424_b("water"), BlockFluid.func_94424_b("water_flow")); - FluidRegistry.LAVA.setIcons(BlockFluid.func_94424_b("lava"), BlockFluid.func_94424_b("lava_flow")); + FluidRegistry.WATER.setIcons(BlockFluid.func_94424_b("water_still"), BlockFluid.func_94424_b("water_flow")); + FluidRegistry.LAVA.setIcons(BlockFluid.func_94424_b("lava_still"), BlockFluid.func_94424_b("lava_flow")); } /** From 380c4ad2da547c3c6fa9e465d700922d1d78eace Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 16 Jul 2013 10:34:54 -0700 Subject: [PATCH 084/146] Updated FML: MinecraftForge/FML@4981aa3421262c3c1c4705468fe202df8198b9f0 Fix potential NPE in villager skin registry. Closes #678 --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index c48b48ee1..4981aa342 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit c48b48ee15f38d3e794b6eb3499c536226ca5a79 +Subproject commit 4981aa3421262c3c1c4705468fe202df8198b9f0 From 5d5d4cb4488d1d4b834d740d36cc48d04c017a40 Mon Sep 17 00:00:00 2001 From: Chicken Bones Date: Wed, 17 Jul 2013 04:42:45 +1000 Subject: [PATCH 085/146] Add onNeighborTileChange callback to block by generalizing func_96440_m to all blocks rather than just comparators. --- .../net/minecraft/block/Block.java.patch | 24 +++- .../block/BlockComparator.java.patch | 20 +++ .../net/minecraft/world/World.java.patch | 120 +++++++++++++----- 3 files changed, 133 insertions(+), 31 deletions(-) create mode 100644 patches/minecraft/net/minecraft/block/BlockComparator.java.patch diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index 6435acadf..19a774135 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -167,7 +167,7 @@ } /** -@@ -1454,4 +1477,952 @@ +@@ -1454,4 +1477,974 @@ canBlockGrass[0] = true; StatList.initBreakableStats(); } @@ -1118,5 +1118,27 @@ + } + } + return false; ++ } ++ ++ /** ++ * Called when a tile entity on a side of this block changes is created or is destroyed. ++ * @param world The world ++ * @param x The x position of this block instance ++ * @param y The y position of this block instance ++ * @param z The z position of this block instance ++ * @param tileX The x position of the tile that changed ++ * @param tileY The y position of the tile that changed ++ * @param tileZ The z position of the tile that changed ++ */ ++ public void onNeighborTileChange(World world, int x, int y, int z, int tileX, int tileY, int tileZ) ++ { ++ } ++ ++ /** ++ * @return true if this block is to be notified of TileEntity changes directly through one solid block like comparators ++ */ ++ public boolean weakTileChanges() ++ { ++ return false; + } } diff --git a/patches/minecraft/net/minecraft/block/BlockComparator.java.patch b/patches/minecraft/net/minecraft/block/BlockComparator.java.patch new file mode 100644 index 000000000..f057d7851 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockComparator.java.patch @@ -0,0 +1,20 @@ +--- ../src_base/minecraft/net/minecraft/block/BlockComparator.java ++++ ../src_work/minecraft/net/minecraft/block/BlockComparator.java +@@ -266,4 +266,17 @@ + { + return new TileEntityComparator(); + } ++ ++ @Override ++ public void onNeighborTileChange(World world, int x, int y, int z, int tileX, int tileY, int tileZ) ++ { ++ if(y == tileY) ++ onNeighborBlockChange(world, x, y, z, world.getBlockId(tileX, tileY, tileZ)); ++ } ++ ++ @Override ++ public boolean weakTileChanges() ++ { ++ return true; ++ } + } diff --git a/patches/minecraft/net/minecraft/world/World.java.patch b/patches/minecraft/net/minecraft/world/World.java.patch index 24994b6ac..e3b62d71e 100644 --- a/patches/minecraft/net/minecraft/world/World.java.patch +++ b/patches/minecraft/net/minecraft/world/World.java.patch @@ -446,7 +446,7 @@ while (iterator.hasNext()) { TileEntity tileentity1 = (TileEntity)iterator.next(); -@@ -2762,19 +2908,18 @@ +@@ -2762,20 +2908,21 @@ iterator.remove(); } } @@ -464,6 +464,7 @@ - chunk.setChunkBlockTileEntity(par1 & 15, par2, par3 & 15, par4TileEntity); - } - } +- } + loadedTileEntityList.add(par4TileEntity); + } + } @@ -472,10 +473,13 @@ + if (chunk != null) + { + chunk.setChunkBlockTileEntity(par1 & 15, par2, par3 & 15, par4TileEntity); - } ++ } ++ //notify tile changes ++ func_96440_m(par1, par2, par3, 0); } -@@ -2783,27 +2928,10 @@ + /** +@@ -2783,28 +2930,13 @@ */ public void removeBlockTileEntity(int par1, int par2, int par3) { @@ -500,14 +504,18 @@ - { - chunk.removeChunkBlockTileEntity(par1 & 15, par2, par3 & 15); - } +- } + Chunk chunk = getChunkFromChunkCoords(par1 >> 4, par3 >> 4); + if (chunk != null) + { + chunk.removeChunkBlockTileEntity(par1 & 15, par2, par3 & 15); - } ++ } ++ //notify tile changes ++ func_96440_m(par1, par2, par3, 0); } -@@ -2829,7 +2957,8 @@ + /** +@@ -2829,7 +2961,8 @@ */ public boolean isBlockNormalCube(int par1, int par2, int par3) { @@ -517,7 +525,7 @@ } public boolean isBlockFullCube(int par1, int par2, int par3) -@@ -2852,16 +2981,17 @@ +@@ -2852,16 +2985,17 @@ */ public boolean doesBlockHaveSolidTopSurface(int par1, int par2, int par3) { @@ -537,7 +545,7 @@ return par1Block == null ? false : (par1Block.blockMaterial.isOpaque() && par1Block.renderAsNormalBlock() ? true : (par1Block instanceof BlockStairs ? (par2 & 4) == 4 : (par1Block instanceof BlockHalfSlab ? (par2 & 8) == 8 : (par1Block instanceof BlockHopper ? true : (par1Block instanceof BlockSnow ? (par2 & 7) == 7 : false))))); } -@@ -2878,7 +3008,7 @@ +@@ -2878,7 +3012,7 @@ if (chunk != null && !chunk.isEmpty()) { Block block = Block.blocksList[this.getBlockId(par1, par2, par3)]; @@ -546,7 +554,7 @@ } else { -@@ -2909,8 +3039,7 @@ +@@ -2909,8 +3043,7 @@ */ public void setAllowedSpawnTypes(boolean par1, boolean par2) { @@ -556,7 +564,7 @@ } /** -@@ -2926,6 +3055,11 @@ +@@ -2926,6 +3059,11 @@ */ private void calculateInitialWeather() { @@ -568,7 +576,7 @@ if (this.worldInfo.isRaining()) { this.rainingStrength = 1.0F; -@@ -2941,6 +3075,11 @@ +@@ -2941,6 +3079,11 @@ * Updates all weather states. */ protected void updateWeather() @@ -580,7 +588,7 @@ { if (!this.provider.hasNoSky) { -@@ -3038,12 +3177,14 @@ +@@ -3038,12 +3181,14 @@ public void toggleRain() { @@ -596,7 +604,7 @@ this.theProfiler.startSection("buildList"); int i; EntityPlayer entityplayer; -@@ -3150,6 +3291,11 @@ +@@ -3150,6 +3295,11 @@ */ public boolean canBlockFreeze(int par1, int par2, int par3, boolean par4) { @@ -608,7 +616,7 @@ BiomeGenBase biomegenbase = this.getBiomeGenForCoords(par1, par3); float f = biomegenbase.getFloatTemperature(); -@@ -3208,6 +3354,11 @@ +@@ -3208,6 +3358,11 @@ */ public boolean canSnowAt(int par1, int par2, int par3) { @@ -620,7 +628,7 @@ BiomeGenBase biomegenbase = this.getBiomeGenForCoords(par1, par3); float f = biomegenbase.getFloatTemperature(); -@@ -3251,10 +3402,12 @@ +@@ -3251,10 +3406,12 @@ else { int l = this.getBlockId(par1, par2, par3); @@ -637,7 +645,7 @@ { j1 = 1; } -@@ -3350,7 +3503,9 @@ +@@ -3350,7 +3507,9 @@ int j4 = i2 + Facing.offsetsXForSide[i4]; int k4 = j2 + Facing.offsetsYForSide[i4]; int l4 = k2 + Facing.offsetsZForSide[i4]; @@ -648,7 +656,7 @@ i3 = this.getSavedLightValue(par1EnumSkyBlock, j4, k4, l4); if (i3 == l2 - i5 && i1 < this.lightUpdateBlockList.length) -@@ -3453,10 +3608,10 @@ +@@ -3453,10 +3612,10 @@ public List getEntitiesWithinAABBExcludingEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB, IEntitySelector par3IEntitySelector) { ArrayList arraylist = new ArrayList(); @@ -663,7 +671,7 @@ for (int i1 = i; i1 <= j; ++i1) { -@@ -3482,10 +3637,10 @@ +@@ -3482,10 +3641,10 @@ public List selectEntitiesWithinAABB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, IEntitySelector par3IEntitySelector) { @@ -678,7 +686,7 @@ ArrayList arraylist = new ArrayList(); for (int i1 = i; i1 <= j; ++i1) -@@ -3578,11 +3733,14 @@ +@@ -3578,11 +3737,14 @@ */ public void addLoadedEntities(List par1List) { @@ -696,7 +704,7 @@ } } -@@ -3616,6 +3774,11 @@ +@@ -3616,6 +3778,11 @@ else { if (block != null && (block == Block.waterMoving || block == Block.waterStill || block == Block.lavaMoving || block == Block.lavaStill || block == Block.fire || block.blockMaterial.isReplaceable())) @@ -708,7 +716,7 @@ { block = null; } -@@ -3910,7 +4073,7 @@ +@@ -3910,7 +4077,7 @@ */ public long getSeed() { @@ -717,7 +725,7 @@ } public long getTotalWorldTime() -@@ -3920,7 +4083,7 @@ +@@ -3920,7 +4087,7 @@ public long getWorldTime() { @@ -726,7 +734,7 @@ } /** -@@ -3928,7 +4091,7 @@ +@@ -3928,7 +4095,7 @@ */ public void setWorldTime(long par1) { @@ -735,7 +743,7 @@ } /** -@@ -3936,13 +4099,13 @@ +@@ -3936,13 +4103,13 @@ */ public ChunkCoordinates getSpawnPoint() { @@ -751,7 +759,7 @@ } @SideOnly(Side.CLIENT) -@@ -3966,7 +4129,10 @@ +@@ -3966,7 +4133,10 @@ if (!this.loadedEntityList.contains(par1Entity)) { @@ -763,7 +771,7 @@ } } -@@ -3974,6 +4140,11 @@ +@@ -3974,6 +4144,11 @@ * Called when checking if a certain block can be mined or not. The 'spawn safe zone' check is located here. */ public boolean canMineBlock(EntityPlayer par1EntityPlayer, int par2, int par3, int par4) @@ -775,7 +783,7 @@ { return true; } -@@ -4094,8 +4265,7 @@ +@@ -4094,8 +4269,7 @@ */ public boolean isBlockHighHumidity(int par1, int par2, int par3) { @@ -785,7 +793,7 @@ } /** -@@ -4170,7 +4340,7 @@ +@@ -4170,7 +4344,7 @@ */ public int getHeight() { @@ -794,7 +802,7 @@ } /** -@@ -4178,7 +4348,7 @@ +@@ -4178,7 +4352,7 @@ */ public int getActualHeight() { @@ -803,7 +811,7 @@ } public IUpdatePlayerListBox func_82735_a(EntityMinecart par1EntityMinecart) -@@ -4221,7 +4391,7 @@ +@@ -4221,7 +4395,7 @@ */ public double getHorizon() { @@ -812,7 +820,59 @@ } /** -@@ -4349,4 +4519,115 @@ +@@ -4290,30 +4464,28 @@ + + public void func_96440_m(int par1, int par2, int par3, int par4) + { +- for (int i1 = 0; i1 < 4; ++i1) +- { +- int j1 = par1 + Direction.offsetX[i1]; +- int k1 = par3 + Direction.offsetZ[i1]; +- int l1 = this.getBlockId(j1, par2, k1); +- +- if (l1 != 0) +- { +- Block block = Block.blocksList[l1]; +- +- if (Block.redstoneComparatorIdle.func_94487_f(l1)) +- { +- block.onNeighborBlockChange(this, j1, par2, k1, par4); +- } +- else if (Block.isNormalCube(l1)) +- { +- j1 += Direction.offsetX[i1]; +- k1 += Direction.offsetZ[i1]; +- l1 = this.getBlockId(j1, par2, k1); ++ for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) ++ { ++ int j1 = par1 + dir.offsetX; ++ int y = par2 + dir.offsetY; ++ int k1 = par3 + dir.offsetZ; ++ int l1 = getBlockId(j1, y, k1); ++ Block block = Block.blocksList[l1]; ++ ++ if(block != null) ++ { ++ block.onNeighborTileChange(this, j1, y, k1, par1, par2, par3); ++ ++ if(Block.isNormalCube(l1)) ++ { ++ j1 += dir.offsetX; ++ y += dir.offsetY; ++ k1 += dir.offsetZ; ++ l1 = getBlockId(j1, y, k1); + block = Block.blocksList[l1]; +- +- if (Block.redstoneComparatorIdle.func_94487_f(l1)) +- { +- block.onNeighborBlockChange(this, j1, par2, k1, par4); ++ if(block != null && block.weakTileChanges()) ++ { ++ block.onNeighborTileChange(this, j1, y, k1, par1, par2, par3); + } + } + } +@@ -4349,4 +4521,115 @@ return MathHelper.clamp_float(f, 0.0F, flag ? 1.5F : 1.0F); } From 094c2bca2e874474064cbef3e490cfff0f51defe Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 16 Jul 2013 13:12:46 -0700 Subject: [PATCH 086/146] MinecraftForge/FML@9520978b81d4cba5d8b0af0d5f155bd115023795 Use a temporary file for recompile's command line to combat command length to long issues. --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index 4981aa342..9520978b8 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 4981aa3421262c3c1c4705468fe202df8198b9f0 +Subproject commit 9520978b81d4cba5d8b0af0d5f155bd115023795 From f72d672e0d24e472d2e1b46c29ec3bd242e8ed17 Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 16 Jul 2013 13:54:08 -0700 Subject: [PATCH 087/146] MinecraftForge/FML@b2958c9066db8c95bb4260893fbfe00103fc4ba1 Add quotes for paths with spaces -.- --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index 9520978b8..b2958c906 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 9520978b81d4cba5d8b0af0d5f155bd115023795 +Subproject commit b2958c9066db8c95bb4260893fbfe00103fc4ba1 From 8a8af5265e4d71b2549cf8cf4303a25922c3e30c Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 16 Jul 2013 13:55:31 -0700 Subject: [PATCH 088/146] Package 'version.json' with universal jar for maunchers to use. It's the json used by the vanilla Minecraft launcher for Forge. --- release.py | 80 +++++++++++++++++++++++++----------------------------- 1 file changed, 37 insertions(+), 43 deletions(-) diff --git a/release.py b/release.py index 08af323ef..6ce93a694 100644 --- a/release.py +++ b/release.py @@ -1,7 +1,7 @@ import os, os.path, sys, glob -import shutil, fnmatch, time +import shutil, fnmatch, time, json import logging, zipfile, re, subprocess -from pprint import pformat +from pprint import pformat, pprint from optparse import OptionParser from urllib2 import HTTPError from contextlib import closing @@ -92,9 +92,7 @@ def main(): print 'Reobfusicate Exception: %d ' % e.code error_level = e.code - extract_fml_obfed(fml_dir, mcp_dir, reobf_dir, client_dir) - #extract_paulscode(mcp_dir, client_dir) gen_bin_patches(mcp_dir, os.path.join(forge_dir, 'fml'), build_num, client_dir) version = load_version(build_num) @@ -107,12 +105,14 @@ def main(): version_str = '%s-%s' % (version_str, branch) out_folder = os.path.join(forge_dir, 'target') - if os.path.isdir(out_folder): - shutil.rmtree(out_folder) - - os.makedirs(out_folder) + if not os.path.isdir(out_folder): + os.makedirs(out_folder) + + for f in ['minecraftforge-changelog-%s.txt', 'minecraftforge-universal-%s.jar', 'minecraftforge-installer-%s.jar']: + fn = os.path.join(out_folder, f % version_str) + if os.path.isfile(fn): + os.remove(fn) -# options.skip_changelog = True #Disable till jenkins fixes its shit if not options.skip_changelog: changelog_file = 'target/minecraftforge-changelog-%s.txt' % (version_str) try: @@ -130,6 +130,8 @@ def main(): fh.write('forge.minor.number=%d\n' % version['minor']) fh.write('forge.revision.number=%d\n' % version['revision']) fh.write('forge.build.number=%d\n' % version['build']) + + json_data = gather_json(forge_dir, version_mc, version_forge, version_str) if not options.sign_jar is None: sign_jar(forge_dir, options.sign_jar, client_dir, 'minecraftforge-universal-%s.jar' % version_str) @@ -146,6 +148,8 @@ def main(): zip_add(version_file) if not options.skip_changelog: zip_add(changelog_file, 'MinecraftForge-Changelog.txt') + print(' version.json') + zip.writestr('version.json', json.dumps(json_data['versionInfo'], indent=4, separators=(',', ': '))) #Add dependancy and licenses from FML FML_FILES = [ @@ -164,7 +168,7 @@ def main(): zip_end() - build_installer(forge_dir, version_str, version_forge, version_mc, out_folder) + build_installer(forge_dir, version_str, version_forge, version_mc, out_folder, json.dumps(json_data, indent=4, separators=(',', ': '))) inject_version(os.path.join(forge_dir, 'common/net/minecraftforge/common/ForgeVersion.java'.replace('/', os.sep)), build_num) zip_start('minecraftforge-src-%s.zip' % version_str, 'forge') @@ -188,15 +192,11 @@ def main(): print '=================================== Release Finished %d =================================' % error_level sys.exit(error_level) - -def build_installer(forge_dir, version_str, version_forge, version_minecraft, out_folder): - file_name = 'minecraftforge-installer-%s.jar' % version_str - universal_name = 'minecraftforge-universal-%s.jar' % version_str - + +def gather_json(forge_dir, version_mc, version_forge, version_str): def getTZ(): ret = '-' t = time.timezone - print t if (t < 0): ret = '+' t *= -1 @@ -206,31 +206,38 @@ def build_installer(forge_dir, version_str, version_forge, version_minecraft, ou m = int(t/60) return '%s%02d%02d' % (ret, h, m) timestamp = datetime.now().replace(microsecond=0).isoformat() + getTZ() - + json_data = {} + with closing(open(os.path.join(forge_dir, 'fml', 'jsons', '%s-rel.json' % version_mc), 'r')) as fh: + data = fh.read() + data = data.replace('@version@', version_forge) + data = data.replace('@timestamp@', timestamp) + data = data.replace('@minecraft_version@', version_mc) + data = data.replace('@universal_jar@', 'minecraftforge-universal-%s.jar' % version_str) + data = data.replace('FMLTweaker', 'F_M_L_Tweaker') + data = data.replace('FML', 'Forge') + data = data.replace('F_M_L_Tweaker', 'FMLTweaker') + data = data.replace('cpw.mods:fml:', 'net.minecraftforge:minecraftforge:') + json_data = json.loads(data) + pprint(json_data) + return json_data + +def build_installer(forge_dir, version_str, version_forge, version_minecraft, out_folder, json_data): + file_name = 'minecraftforge-installer-%s.jar' % version_str + universal_name = 'minecraftforge-universal-%s.jar' % version_str print '================== %s Start ==================' % file_name with closing(zipfile.ZipFile(os.path.join(forge_dir, 'fml', 'installer_base.jar'), mode='a')) as zip_in: with closing(zipfile.ZipFile(os.path.join(out_folder, file_name), 'w', zipfile.ZIP_DEFLATED)) as zip_out: # Copy everything over for i in zip_in.filelist: if not i.filename in ['install_profile.json', 'big_logo.png']: - print(' %s' % i.filename) + #print(' %s' % i.filename) zip_out.writestr(i.filename, zip_in.read(i.filename)) print(' %s' % universal_name) zip_out.write(os.path.join(out_folder, universal_name), universal_name) print(' big_logo.png') zip_out.write(os.path.join(forge_dir, 'client', 'forge_logo.png'), 'big_logo.png') - with closing(open(os.path.join(forge_dir, 'fml', 'jsons', '%s-rel.json' % version_minecraft), 'r')) as fh: - data = fh.read() - data = data.replace('@version@', version_forge) - data = data.replace('@timestamp@', timestamp) - data = data.replace('@minecraft_version@', version_minecraft) - data = data.replace('@universal_jar@', universal_name) - data = data.replace('FMLTweaker', 'F_M_L_Tweaker') - data = data.replace('FML', 'Forge') - data = data.replace('F_M_L_Tweaker', 'FMLTweaker') - data = data.replace('cpw.mods:fml:', 'net.minecraftforge:minecraftforge:') - print(' install_profile.json') - zip_out.writestr('install_profile.json', data) + print(' install_profile.json') + zip_out.writestr('install_profile.json', json_data) print '================== %s Finished ==================' % file_name @@ -303,19 +310,6 @@ def extract_fml_obfed(fml_dir, mcp_dir, reobf_dir, client_dir): client.extract(line[10:].replace(os.sep, '/'), client_dir) client.close() - -def extract_paulscode(mcp_dir, client_dir): - client = zipfile.ZipFile(os.path.join(mcp_dir, 'temp', 'client_reobf.jar')) - - print 'Extracting Reobfed Paulscode for mac users -.-' - - for i in client.filelist: - if i.filename.startswith('paulscode'): - if not os.path.isfile(os.path.join(client_dir, i.filename)): - print ' %s' % i.filename - client.extract(i.filename, client_dir) - - client.close() def get_branch_name(): from subprocess import Popen, PIPE, STDOUT From f7ab5684e97310080cae47fba16fe0bafa8408f5 Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 16 Jul 2013 14:35:22 -0700 Subject: [PATCH 089/146] MinecraftForge/FML@3f21a2c1b413e591f61f2906c3adbadd9c5b09e3 Stupid spaces and windows escaping -.- --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index b2958c906..3f21a2c1b 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit b2958c9066db8c95bb4260893fbfe00103fc4ba1 +Subproject commit 3f21a2c1b413e591f61f2906c3adbadd9c5b09e3 From acb6777ab5ed565d5358cbb38cc8106651c88934 Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 16 Jul 2013 21:40:49 -0700 Subject: [PATCH 090/146] General code cleanup of Fluid system. Made Fluid icons and associated functions non-sided. --- .../minecraftforge/fluids/BlockFluidBase.java | 301 +++++++++--------- .../fluids/BlockFluidClassic.java | 279 ++++++++-------- .../fluids/BlockFluidFinite.java | 218 ++++++++----- common/net/minecraftforge/fluids/Fluid.java | 219 +++++-------- .../fluids/FluidContainerRegistry.java | 129 ++++---- .../net/minecraftforge/fluids/FluidEvent.java | 47 ++- .../fluids/FluidIdMapPacket.java | 20 +- .../minecraftforge/fluids/FluidRegistry.java | 74 ++--- .../net/minecraftforge/fluids/FluidStack.java | 93 +++--- .../net/minecraftforge/fluids/FluidTank.java | 131 +++++--- .../minecraftforge/fluids/FluidTankInfo.java | 14 +- .../minecraftforge/fluids/IFluidBlock.java | 5 +- .../fluids/IFluidContainerItem.java | 6 +- .../minecraftforge/fluids/IFluidHandler.java | 6 +- .../net/minecraftforge/fluids/IFluidTank.java | 6 +- .../fluids/ItemFluidContainer.java | 102 +++--- .../fluids/RenderBlockFluid.java | 192 ++++++----- .../fluids/TileFluidHandler.java | 40 +-- 18 files changed, 995 insertions(+), 887 deletions(-) diff --git a/common/net/minecraftforge/fluids/BlockFluidBase.java b/common/net/minecraftforge/fluids/BlockFluidBase.java index 529a6b2c2..5aea68e42 100644 --- a/common/net/minecraftforge/fluids/BlockFluidBase.java +++ b/common/net/minecraftforge/fluids/BlockFluidBase.java @@ -21,16 +21,17 @@ import net.minecraft.world.World; * @author King Lemming, OvermindDL1 * */ -public abstract class BlockFluidBase extends Block implements IFluidBlock { - +public abstract class BlockFluidBase extends Block implements IFluidBlock +{ protected final static Map defaultDisplacementIds = new HashMap(); - static { + static + { defaultDisplacementIds.put(Block.doorWood.blockID, false); defaultDisplacementIds.put(Block.doorIron.blockID, false); defaultDisplacementIds.put(Block.signPost.blockID, false); defaultDisplacementIds.put(Block.signWall.blockID, false); - defaultDisplacementIds.put(Block.reed.blockID, false); + defaultDisplacementIds.put(Block.reed.blockID, false); } protected Map displacementIds = new HashMap(); @@ -45,8 +46,8 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock { protected final String fluidName; - public BlockFluidBase(int id, Fluid fluid, Material material) { - + public BlockFluidBase(int id, Fluid fluid, Material material) + { super(id, material); this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); this.setTickRandomly(true); @@ -61,43 +62,37 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock { displacementIds.putAll(defaultDisplacementIds); } - public BlockFluidBase setQuantaPerBlock(int quantaPerBlock) { - - if (quantaPerBlock > 16 || quantaPerBlock < 1) { - quantaPerBlock = 8; - } + public BlockFluidBase setQuantaPerBlock(int quantaPerBlock) + { + if (quantaPerBlock > 16 || quantaPerBlock < 1) quantaPerBlock = 8; this.quantaPerBlock = quantaPerBlock; this.quantaPerBlockFloat = quantaPerBlock; return this; } - public BlockFluidBase setDensity(int density) { - - if (density == 0) { - density = 1; - } + public BlockFluidBase setDensity(int density) + { + if (density == 0) density = 1; this.density = density; this.densityDir = density > 0 ? -1 : 1; return this; } - public BlockFluidBase setTickRate(int tickRate) { - - if (tickRate <= 0) { - tickRate = 20; - } + public BlockFluidBase setTickRate(int tickRate) + { + if (tickRate <= 0) tickRate = 20; this.tickRate = tickRate; return this; } - public BlockFluidBase setRenderPass(int renderPass) { - + public BlockFluidBase setRenderPass(int renderPass) + { this.renderPass = renderPass; return this; } - public BlockFluidBase setMaxScaledLight(int maxScaledLight) { - + public BlockFluidBase setMaxScaledLight(int maxScaledLight) + { this.maxScaledLight = maxScaledLight; return this; } @@ -105,22 +100,25 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock { /** * Returns true if the block at (x, y, z) is displaceable. Does not displace the block. */ - public boolean canDisplace(IBlockAccess world, int x, int y, int z) { + public boolean canDisplace(IBlockAccess world, int x, int y, int z) + { + if (world.isAirBlock(x, y, z)) return true; int bId = world.getBlockId(x, y, z); - if (bId == 0) { - return true; - } - if (bId == blockID) { + if (bId == blockID) + { return false; } - if (displacementIds.containsKey(bId)) { + + if (displacementIds.containsKey(bId)) + { return displacementIds.get(bId); } - Material material = Block.blocksList[bId].blockMaterial; - if (material.blocksMovement() || material == Material.portal) { + Material material = Block.blocksList[bId].blockMaterial; + if (material.blocksMovement() || material == Material.portal) + { return false; } return true; @@ -129,26 +127,32 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock { /** * Attempt to displace the block at (x, y, z), return true if it was displaced. */ - public boolean displaceIfPossible(World world, int x, int y, int z) { - - int bId = world.getBlockId(x, y, z); - - if (bId == 0) { + public boolean displaceIfPossible(World world, int x, int y, int z) + { + if (world.isAirBlock(x, y, z)) + { return true; } - if (bId == blockID) { + + int bId = world.getBlockId(x, y, z); + if (bId == blockID) + { return false; } - if (displacementIds.containsKey(bId)) { - if (displacementIds.get(bId)) { + + if (displacementIds.containsKey(bId)) + { + if (displacementIds.get(bId)) + { Block.blocksList[bId].dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); return true; } return false; } - Material material = Block.blocksList[bId].blockMaterial; - if (material.blocksMovement() || material == Material.portal) { + Material material = Block.blocksList[bId].blockMaterial; + if (material.blocksMovement() || material == Material.portal) + { return false; } Block.blocksList[bId].dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); @@ -164,60 +168,58 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock { /* BLOCK FUNCTIONS */ @Override - public void onBlockAdded(World world, int x, int y, int z) { - + public void onBlockAdded(World world, int x, int y, int z) + { world.scheduleBlockUpdate(x, y, z, blockID, tickRate); } @Override - public void onNeighborBlockChange(World world, int x, int y, int z, int blockId) { - + public void onNeighborBlockChange(World world, int x, int y, int z, int blockId) + { world.scheduleBlockUpdate(x, y, z, blockID, tickRate); } // Used to prevent updates on chunk generation @Override - public boolean func_82506_l() { - + public boolean func_82506_l() + { return false; } @Override - public boolean getBlocksMovement(IBlockAccess world, int x, int y, int z) { - + public boolean getBlocksMovement(IBlockAccess world, int x, int y, int z) + { return true; } @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { - + public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) + { return null; } @Override - public int idDropped(int par1, Random par2Random, int par3) { - + public int idDropped(int par1, Random par2Random, int par3) + { return 0; } @Override - public int quantityDropped(Random par1Random) { - + public int quantityDropped(Random par1Random) + { return 0; } @Override - public int tickRate(World world) { - + public int tickRate(World world) + { return tickRate; } @Override - public void velocityToAddToEntity(World world, int x, int y, int z, Entity entity, Vec3 vec) { - - if (densityDir > 0) { - return; - } + public void velocityToAddToEntity(World world, int x, int y, int z, Entity entity, Vec3 vec) + { + if (densityDir > 0) return; Vec3 vec_flow = this.getFlowVector(world, x, y, z); vec.xCoord += vec_flow.xCoord * (quantaPerBlock * 4); vec.yCoord += vec_flow.yCoord * (quantaPerBlock * 4); @@ -225,9 +227,10 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock { } @Override - public int getLightValue(IBlockAccess world, int x, int y, int z) { - - if (maxScaledLight == 0) { + public int getLightValue(IBlockAccess world, int x, int y, int z) + { + if (maxScaledLight == 0) + { return super.getLightValue(world, x, y, z); } int data = world.getBlockMetadata(x, y, z); @@ -235,55 +238,55 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock { } @Override - public int getRenderType() { - + public int getRenderType() + { return FluidRegistry.renderIdFluid; } @Override - public boolean isOpaqueCube() { - + public boolean isOpaqueCube() + { return false; } @Override - public boolean renderAsNormalBlock() { - + public boolean renderAsNormalBlock() + { return false; } @Override - public float getBlockBrightness(IBlockAccess world, int x, int y, int z) { - + public float getBlockBrightness(IBlockAccess world, int x, int y, int z) + { float lightThis = world.getLightBrightness(x, y, z); float lightUp = world.getLightBrightness(x, y + 1, z); - return lightThis > lightUp ? lightThis : lightUp; } @Override - public int getMixedBrightnessForBlock(IBlockAccess world, int x, int y, int z) { - - int lightThis = world.getLightBrightnessForSkyBlocks(x, y, z, 0); - int lightUp = world.getLightBrightnessForSkyBlocks(x, y + 1, z, 0); + public int getMixedBrightnessForBlock(IBlockAccess world, int x, int y, int z) + { + int lightThis = world.getLightBrightnessForSkyBlocks(x, y, z, 0); + int lightUp = world.getLightBrightnessForSkyBlocks(x, y + 1, z, 0); int lightThisBase = lightThis & 255; - int lightUpBase = lightUp & 255; - int lightThisExt = lightThis >> 16 & 255; - int lightUpExt = lightUp >> 16 & 255; - - return (lightThisBase > lightUpBase ? lightThisBase : lightUpBase) | (lightThisExt > lightUpExt ? lightThisExt : lightUpExt) << 16; + int lightUpBase = lightUp & 255; + int lightThisExt = lightThis >> 16 & 255; + int lightUpExt = lightUp >> 16 & 255; + return (lightThisBase > lightUpBase ? lightThisBase : lightUpBase) | + ((lightThisExt > lightUpExt ? lightThisExt : lightUpExt) << 16); } @Override - public int getRenderBlockPass() { - + public int getRenderBlockPass() + { return renderPass; } @Override - public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) { - - if (world.getBlockId(x, y, z) != blockID) { + public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) + { + if (world.getBlockId(x, y, z) != blockID) + { return !world.isBlockOpaqueCube(x, y, z); } Material mat = world.getBlockMaterial(x, y, z); @@ -291,114 +294,105 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock { } /* FLUID FUNCTIONS */ - public static final int getDensity(IBlockAccess world, int x, int y, int z) { - + public static final int getDensity(IBlockAccess world, int x, int y, int z) + { Block block = Block.blocksList[world.getBlockId(x, y, z)]; - - if (!(block instanceof BlockFluidBase)) { + if (!(block instanceof BlockFluidBase)) + { return Integer.MAX_VALUE; } - return ((BlockFluidBase) block).density; + return ((BlockFluidBase)block).density; } - public static double getFlowDirection(IBlockAccess world, int x, int y, int z) { - + public static double getFlowDirection(IBlockAccess world, int x, int y, int z) + { Block block = Block.blocksList[world.getBlockId(x, y, z)]; - - if (!(Block.blocksList[world.getBlockId(x, y, z)] instanceof BlockFluidBase)) { + if (!(block instanceof BlockFluidBase)) + { return -1000.0; } Vec3 vec = ((BlockFluidBase) block).getFlowVector(world, x, y, z); return vec.xCoord == 0.0D && vec.zCoord == 0.0D ? -1000.0D : Math.atan2(vec.zCoord, vec.xCoord) - Math.PI / 2D; } - public final int getQuantaValueBelow(IBlockAccess world, int x, int y, int z, int belowThis) { - + public final int getQuantaValueBelow(IBlockAccess world, int x, int y, int z, int belowThis) + { int quantaRemaining = getQuantaValue(world, x, y, z); - - if (quantaRemaining >= belowThis) { + if (quantaRemaining >= belowThis) + { return -1; } return quantaRemaining; } - public final int getQuantaValueAbove(IBlockAccess world, int x, int y, int z, int aboveThis) { - + public final int getQuantaValueAbove(IBlockAccess world, int x, int y, int z, int aboveThis) + { int quantaRemaining = getQuantaValue(world, x, y, z); - - if (quantaRemaining <= aboveThis) { + if (quantaRemaining <= aboveThis) + { return -1; } return quantaRemaining; } - public final float getQuantaPercentage(IBlockAccess world, int x, int y, int z) { - + public final float getQuantaPercentage(IBlockAccess world, int x, int y, int z) + { int quantaRemaining = getQuantaValue(world, x, y, z); return quantaRemaining / quantaPerBlockFloat; } - public Vec3 getFlowVector(IBlockAccess world, int x, int y, int z) { - + public Vec3 getFlowVector(IBlockAccess world, int x, int y, int z) + { Vec3 vec = world.getWorldVec3Pool().getVecFromPool(0.0D, 0.0D, 0.0D); int decay = quantaPerBlock - getQuantaValue(world, x, y, z); - for (int side = 0; side < 4; ++side) { + for (int side = 0; side < 4; ++side) + { int x2 = x; int z2 = z; - switch (side) { - case 0: - --x2; - break; - case 1: - --z2; - break; - case 2: - ++x2; - break; - case 3: - ++z2; - break; + switch (side) + { + case 0: --x2; break; + case 1: --z2; break; + case 2: ++x2; break; + case 3: ++z2; break; } int otherDecay = quantaPerBlock - getQuantaValue(world, x2, y, z2); - - if (otherDecay >= quantaPerBlock) { - if (!world.getBlockMaterial(x2, y, z2).blocksMovement()) { + if (otherDecay >= quantaPerBlock) + { + if (!world.getBlockMaterial(x2, y, z2).blocksMovement()) + { otherDecay = quantaPerBlock - getQuantaValue(world, x2, y - 1, z2); - - if (otherDecay >= 0) { + if (otherDecay >= 0) + { int power = otherDecay - (decay - quantaPerBlock); vec = vec.addVector((x2 - x) * power, (y - y) * power, (z2 - z) * power); } } - } else if (otherDecay >= 0) { + } + else if (otherDecay >= 0) + { int power = otherDecay - decay; vec = vec.addVector((x2 - x) * power, (y - y) * power, (z2 - z) * power); } } - if (world.getBlockId(x, y + 1, z) == blockID) { - boolean flag = false; - if (this.isBlockSolid(world, x, y, z - 1, 2)) { - flag = true; - } else if (this.isBlockSolid(world, x, y, z + 1, 3)) { - flag = true; - } else if (this.isBlockSolid(world, x - 1, y, z, 4)) { - flag = true; - } else if (this.isBlockSolid(world, x + 1, y, z, 5)) { - flag = true; - } else if (this.isBlockSolid(world, x, y + 1, z - 1, 2)) { - flag = true; - } else if (this.isBlockSolid(world, x, y + 1, z + 1, 3)) { - flag = true; - } else if (this.isBlockSolid(world, x - 1, y + 1, z, 4)) { - flag = true; - } else if (this.isBlockSolid(world, x + 1, y + 1, z, 5)) { - flag = true; - } - if (flag) { + if (world.getBlockId(x, y + 1, z) == blockID) + { + boolean flag = + isBlockSolid(world, x, y, z - 1, 2) || + isBlockSolid(world, x, y, z + 1, 3) || + isBlockSolid(world, x - 1, y, z, 4) || + isBlockSolid(world, x + 1, y, z, 5) || + isBlockSolid(world, x, y + 1, z - 1, 2) || + isBlockSolid(world, x, y + 1, z + 1, 3) || + isBlockSolid(world, x - 1, y + 1, z, 4) || + isBlockSolid(world, x + 1, y + 1, z, 5); + + if (flag) + { vec = vec.normalize().addVector(0.0D, -6.0D, 0.0D); } } @@ -408,9 +402,8 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock { /* IFluidBlock */ @Override - public Fluid getFluid() { - + public Fluid getFluid() + { return FluidRegistry.getFluid(fluidName); } - } diff --git a/common/net/minecraftforge/fluids/BlockFluidClassic.java b/common/net/minecraftforge/fluids/BlockFluidClassic.java index 60a1958f7..ae63e2ceb 100644 --- a/common/net/minecraftforge/fluids/BlockFluidClassic.java +++ b/common/net/minecraftforge/fluids/BlockFluidClassic.java @@ -16,60 +16,65 @@ import net.minecraft.world.World; * @author King Lemming * */ -public class BlockFluidClassic extends BlockFluidBase { - +public class BlockFluidClassic extends BlockFluidBase +{ protected boolean[] isOptimalFlowDirection = new boolean[4]; protected int[] flowCost = new int[4]; protected FluidStack stack; - public BlockFluidClassic(int id, Fluid fluid, Material material) { - + public BlockFluidClassic(int id, Fluid fluid, Material material) + { super(id, fluid, material); stack = new FluidStack(fluid, FluidContainerRegistry.BUCKET_VOLUME); } - public BlockFluidClassic setFluidStack(FluidStack stack) { - + public BlockFluidClassic setFluidStack(FluidStack stack) + { this.stack = stack; return this; } - public BlockFluidClassic setFluidStackAmount(int amount) { - + public BlockFluidClassic setFluidStackAmount(int amount) + { this.stack.amount = amount; return this; } @Override - public int getQuantaValue(IBlockAccess world, int x, int y, int z) { - - if (world.getBlockId(x, y, z) == 0) { + public int getQuantaValue(IBlockAccess world, int x, int y, int z) + { + if (world.getBlockId(x, y, z) == 0) + { return 0; } - if (world.getBlockId(x, y, z) != blockID) { + + if (world.getBlockId(x, y, z) != blockID) + { return -1; } + int quantaRemaining = quantaPerBlock - world.getBlockMetadata(x, y, z); return quantaRemaining; } @Override - public boolean canCollideCheck(int meta, boolean fullHit) { - + public boolean canCollideCheck(int meta, boolean fullHit) + { return fullHit && meta == 0; } @Override - public int getMaxRenderHeightMeta() { - + public int getMaxRenderHeightMeta() + { return 0; } @Override - public int getLightValue(IBlockAccess world, int x, int y, int z) { - - if (maxScaledLight == 0) { + public int getLightValue(IBlockAccess world, int x, int y, int z) + { + if (maxScaledLight == 0) + { return super.getLightValue(world, x, y, z); } int data = quantaPerBlock - world.getBlockMetadata(x, y, z) - 1; @@ -77,138 +82,155 @@ public class BlockFluidClassic extends BlockFluidBase { } @Override - public void updateTick(World world, int x, int y, int z, Random rand) { - + public void updateTick(World world, int x, int y, int z, Random rand) + { int quantaRemaining = quantaPerBlock - world.getBlockMetadata(x, y, z); int expQuanta = -101; // check adjacent block levels if non-source - if (quantaRemaining < quantaPerBlock) { + if (quantaRemaining < quantaPerBlock) + { int y2 = y - densityDir; - if (world.getBlockId(x, y2, z) == blockID || world.getBlockId(x - 1, y2, z) == blockID || world.getBlockId(x + 1, y2, z) == blockID - || world.getBlockId(x, y2, z - 1) == blockID || world.getBlockId(x, y2, z + 1) == blockID) { + if (world.getBlockId(x, y2, z ) == blockID || + world.getBlockId(x - 1, y2, z ) == blockID || + world.getBlockId(x + 1, y2, z ) == blockID || + world.getBlockId(x, y2, z - 1) == blockID || + world.getBlockId(x, y2, z + 1) == blockID) + { expQuanta = quantaPerBlock - 1; - - } else { + } + else + { int maxQuanta = -100; - maxQuanta = getLargerQuanta(world, x - 1, y, z, maxQuanta); - maxQuanta = getLargerQuanta(world, x + 1, y, z, maxQuanta); - maxQuanta = getLargerQuanta(world, x, y, z - 1, maxQuanta); - maxQuanta = getLargerQuanta(world, x, y, z + 1, maxQuanta); + maxQuanta = getLargerQuanta(world, x - 1, y, z, maxQuanta); + maxQuanta = getLargerQuanta(world, x + 1, y, z, maxQuanta); + maxQuanta = getLargerQuanta(world, x, y, z - 1, maxQuanta); + maxQuanta = getLargerQuanta(world, x, y, z + 1, maxQuanta); expQuanta = maxQuanta - 1; } + // decay calculation - if (expQuanta != quantaRemaining) { + if (expQuanta != quantaRemaining) + { quantaRemaining = expQuanta; - if (expQuanta <= 0) { + if (expQuanta <= 0) + { world.setBlockToAir(x, y, z); - } else { + } + else + { world.setBlockMetadataWithNotify(x, y, z, quantaPerBlock - expQuanta, 3); world.scheduleBlockUpdate(x, y, z, blockID, tickRate); world.notifyBlocksOfNeighborChange(x, y, z, blockID); } } - } else if (quantaRemaining > quantaPerBlock) { + } + else if (quantaRemaining > quantaPerBlock) + { world.setBlockMetadataWithNotify(x, y, z, 0, 3); } + // Flow vertically if possible - if (canDisplace(world, x, y + densityDir, z)) { + if (canDisplace(world, x, y + densityDir, z)) + { flowIntoBlock(world, x, y + densityDir, z, 1); return; } + // Flow outward if possible int flowMeta = quantaPerBlock - quantaRemaining + 1; - if (flowMeta >= quantaPerBlock) { + if (flowMeta >= quantaPerBlock) + { return; } - if (isSourceBlock(world, x, y, z) || !isFlowingVertically(world, x, y, z)) { - - if (world.getBlockId(x, y - densityDir, z) == blockID) { + if (isSourceBlock(world, x, y, z) || !isFlowingVertically(world, x, y, z)) + { + if (world.getBlockId(x, y - densityDir, z) == blockID) + { flowMeta = 1; } boolean flowTo[] = getOptimalFlowDirections(world, x, y, z); - if (flowTo[0]) { - flowIntoBlock(world, x - 1, y, z, flowMeta); - } - if (flowTo[1]) { - flowIntoBlock(world, x + 1, y, z, flowMeta); - } - if (flowTo[2]) { - flowIntoBlock(world, x, y, z - 1, flowMeta); - } - if (flowTo[3]) { - flowIntoBlock(world, x, y, z + 1, flowMeta); - } + if (flowTo[0]) flowIntoBlock(world, x - 1, y, z, flowMeta); + if (flowTo[1]) flowIntoBlock(world, x + 1, y, z, flowMeta); + if (flowTo[2]) flowIntoBlock(world, x, y, z - 1, flowMeta); + if (flowTo[3]) flowIntoBlock(world, x, y, z + 1, flowMeta); } } - public boolean isFlowingVertically(IBlockAccess world, int x, int y, int z) { - - return world.getBlockId(x, y + densityDir, z) == blockID || world.getBlockId(x, y, z) == blockID && canFlowInto(world, x, y + densityDir, z); + public boolean isFlowingVertically(IBlockAccess world, int x, int y, int z) + { + return world.getBlockId(x, y + densityDir, z) == blockID || + (world.getBlockId(x, y, z) == blockID && canFlowInto(world, x, y + densityDir, z)); } - public boolean isSourceBlock(IBlockAccess world, int x, int y, int z) { - + public boolean isSourceBlock(IBlockAccess world, int x, int y, int z) + { return world.getBlockId(x, y, z) == blockID && world.getBlockMetadata(x, y, z) == 0; } - protected boolean[] getOptimalFlowDirections(World world, int x, int y, int z) { - - for (int side = 0; side < 4; side++) { + protected boolean[] getOptimalFlowDirections(World world, int x, int y, int z) + { + for (int side = 0; side < 4; side++) + { flowCost[side] = 1000; int x2 = x; int y2 = y; int z2 = z; - switch (side) { - case 0: - --x2; - break; - case 1: - ++x2; - break; - case 2: - --z2; - break; - case 3: - ++z2; - break; + switch (side) + { + case 0: --x2; break; + case 1: ++x2; break; + case 2: --z2; break; + case 3: ++z2; break; } - if (!canFlowInto(world, x2, y2, z2) || isSourceBlock(world, x2, y2, z2)) { + if (!canFlowInto(world, x2, y2, z2) || isSourceBlock(world, x2, y2, z2)) + { continue; } - if (canFlowInto(world, x2, y2 + densityDir, z2)) { + + if (canFlowInto(world, x2, y2 + densityDir, z2)) + { flowCost[side] = 0; - } else { + } + else + { flowCost[side] = calculateFlowCost(world, x2, y2, z2, 1, side); } } int min = flowCost[0]; - for (int side = 1; side < 4; side++) { - if (flowCost[side] < min) { + for (int side = 1; side < 4; side++) + { + if (flowCost[side] < min) + { min = flowCost[side]; } } - for (int side = 0; side < 4; side++) { + for (int side = 0; side < 4; side++) + { isOptimalFlowDirection[side] = flowCost[side] == min; } return isOptimalFlowDirection; } - protected int calculateFlowCost(World world, int x, int y, int z, int recurseDepth, int side) { - + protected int calculateFlowCost(World world, int x, int y, int z, int recurseDepth, int side) + { int cost = 1000; - - for (int adjSide = 0; adjSide < 4; adjSide++) { - if (adjSide == 0 && side == 1 || adjSide == 1 && side == 0 || adjSide == 2 && side == 3 || adjSide == 3 && side == 2) { + for (int adjSide = 0; adjSide < 4; adjSide++) + { + if ((adjSide == 0 && side == 1) || + (adjSide == 1 && side == 0) || + (adjSide == 2 && side == 3) || + (adjSide == 3 && side == 2)) + { continue; } @@ -216,72 +238,78 @@ public class BlockFluidClassic extends BlockFluidBase { int y2 = y; int z2 = z; - switch (adjSide) { - case 0: - --x2; - break; - case 1: - ++x2; - break; - case 2: - --z2; - break; - case 3: - ++z2; - break; + switch (adjSide) + { + case 0: --x2; break; + case 1: ++x2; break; + case 2: --z2; break; + case 3: ++z2; break; } - if (!canFlowInto(world, x2, y2, z2) || isSourceBlock(world, x2, y2, z2)) { + if (!canFlowInto(world, x2, y2, z2) || isSourceBlock(world, x2, y2, z2)) + { continue; } - if (canFlowInto(world, x2, y2 + densityDir, z2)) { + + if (canFlowInto(world, x2, y2 + densityDir, z2)) + { return recurseDepth; } - if (recurseDepth >= 4) { + + if (recurseDepth >= 4) + { continue; } + int min = calculateFlowCost(world, x2, y2, z2, recurseDepth + 1, adjSide); - if (min < cost) { + if (min < cost) + { cost = min; } } return cost; } - protected void flowIntoBlock(World world, int x, int y, int z, int meta) { - - if (meta < 0) { - return; - } - if (displaceIfPossible(world, x, y, z)) { + protected void flowIntoBlock(World world, int x, int y, int z, int meta) + { + if (meta < 0) return; + if (displaceIfPossible(world, x, y, z)) + { world.setBlock(x, y, z, this.blockID, meta, 3); } } - protected boolean canFlowInto(IBlockAccess world, int x, int y, int z) { + protected boolean canFlowInto(IBlockAccess world, int x, int y, int z) + { + if (world.isAirBlock(x, y, z)) return true; int bId = world.getBlockId(x, y, z); - if (bId == 0) { + if (bId == blockID) + { return true; } - if (bId == blockID) { - return true; - } - if (displacementIds.containsKey(bId)) { + + if (displacementIds.containsKey(bId)) + { return displacementIds.get(bId); } + Material material = Block.blocksList[bId].blockMaterial; - if (material.blocksMovement() || material == Material.water || material == Material.lava || material == Material.portal) { + if (material.blocksMovement() || + material == Material.water || + material == Material.lava || + material == Material.portal) + { return false; } return true; } - protected int getLargerQuanta(IBlockAccess world, int x, int y, int z, int compare) { - + protected int getLargerQuanta(IBlockAccess world, int x, int y, int z, int compare) + { int quantaRemaining = getQuantaValue(world, x, y, z); - - if (quantaRemaining <= 0) { + if (quantaRemaining <= 0) + { return compare; } return quantaRemaining >= compare ? quantaRemaining : compare; @@ -289,21 +317,24 @@ public class BlockFluidClassic extends BlockFluidBase { /* IFluidBlock */ @Override - public FluidStack drain(World world, int x, int y, int z, boolean doDrain) { - - if (!isSourceBlock(world, x, y, z)) { + public FluidStack drain(World world, int x, int y, int z, boolean doDrain) + { + if (!isSourceBlock(world, x, y, z)) + { return null; } - if (doDrain) { + + if (doDrain) + { world.setBlockToAir(x, y, z); } + return stack.copy(); } @Override - public boolean canDrain(World world, int x, int y, int z) { - + public boolean canDrain(World world, int x, int y, int z) + { return isSourceBlock(world, x, y, z); } - } diff --git a/common/net/minecraftforge/fluids/BlockFluidFinite.java b/common/net/minecraftforge/fluids/BlockFluidFinite.java index 1d0e4b945..6a6edf72d 100644 --- a/common/net/minecraftforge/fluids/BlockFluidFinite.java +++ b/common/net/minecraftforge/fluids/BlockFluidFinite.java @@ -16,41 +16,44 @@ import net.minecraft.world.World; * @author OvermindDL1, KingLemming * */ -public class BlockFluidFinite extends BlockFluidBase { - - public BlockFluidFinite(int id, Fluid fluid, Material material) { - +public class BlockFluidFinite extends BlockFluidBase +{ + public BlockFluidFinite(int id, Fluid fluid, Material material) + { super(id, fluid, material); } @Override - public int getQuantaValue(IBlockAccess world, int x, int y, int z) { - - if (world.getBlockId(x, y, z) == 0) { + public int getQuantaValue(IBlockAccess world, int x, int y, int z) + { + if (world.isAirBlock(x, y, z)) + { return 0; } + if (world.getBlockId(x, y, z) != blockID) { return -1; } + int quantaRemaining = world.getBlockMetadata(x, y, z) + 1; return quantaRemaining; } @Override - public boolean canCollideCheck(int meta, boolean fullHit) { - + public boolean canCollideCheck(int meta, boolean fullHit) + { return fullHit && meta == quantaPerBlock - 1; } @Override - public int getMaxRenderHeightMeta() { - + public int getMaxRenderHeightMeta() + { return quantaPerBlock - 1; } @Override - public void updateTick(World world, int x, int y, int z, Random rand) { - + public void updateTick(World world, int x, int y, int z, Random rand) + { boolean changed = false; int quantaRemaining = world.getBlockMetadata(x, y, z) + 1; @@ -58,103 +61,124 @@ public class BlockFluidFinite extends BlockFluidBase { int prevRemaining = quantaRemaining; quantaRemaining = tryToFlowVerticallyInto(world, x, y, z, quantaRemaining); - if (quantaRemaining < 1) { + if (quantaRemaining < 1) + { return; - } else if (quantaRemaining != prevRemaining) { + } + else if (quantaRemaining != prevRemaining) + { changed = true; - - if (quantaRemaining == 1) { + if (quantaRemaining == 1) + { world.setBlockMetadataWithNotify(x, y, z, quantaRemaining - 1, 2); return; } - } else if (quantaRemaining == 1) { + } + else if (quantaRemaining == 1) + { return; } // Flow out if possible int lowerthan = quantaRemaining - 1; - - if (displaceIfPossible(world, x, y, z - 1)) { - world.setBlock(x, y, z - 1, 0); - } - if (displaceIfPossible(world, x, y, z + 1)) { - world.setBlock(x, y, z + 1, 0); - } - if (displaceIfPossible(world, x - 1, y, z)) { - world.setBlock(x - 1, y, z, 0); - } - if (displaceIfPossible(world, x + 1, y, z)) { - world.setBlock(x + 1, y, z, 0); - } - int north = getQuantaValueBelow(world, x, y, z - 1, lowerthan); - int south = getQuantaValueBelow(world, x, y, z + 1, lowerthan); - int west = getQuantaValueBelow(world, x - 1, y, z, lowerthan); - int east = getQuantaValueBelow(world, x + 1, y, z, lowerthan); + if (displaceIfPossible(world, x, y, z - 1)) world.setBlock(x, y, z - 1, 0); + if (displaceIfPossible(world, x, y, z + 1)) world.setBlock(x, y, z + 1, 0); + if (displaceIfPossible(world, x - 1, y, z )) world.setBlock(x - 1, y, z, 0); + if (displaceIfPossible(world, x + 1, y, z )) world.setBlock(x + 1, y, z, 0); + int north = getQuantaValueBelow(world, x, y, z - 1, lowerthan); + int south = getQuantaValueBelow(world, x, y, z + 1, lowerthan); + int west = getQuantaValueBelow(world, x - 1, y, z, lowerthan); + int east = getQuantaValueBelow(world, x + 1, y, z, lowerthan); int total = quantaRemaining; int count = 1; - if (north >= 0) { - ++count; + if (north >= 0) + { + count++; total += north; } - if (south >= 0) { - ++count; + + if (south >= 0) + { + count++; total += south; } - if (west >= 0) { - ++count; + + if (west >= 0) + { + count++; total += west; } + if (east >= 0) { ++count; total += east; } - if (count == 1) { - if (changed) { + + if (count == 1) + { + if (changed) + { world.setBlockMetadataWithNotify(x, y, z, quantaRemaining - 1, 2); } return; } + int each = total / count; int rem = total % count; - if (north >= 0) { + if (north >= 0) + { int newnorth = each; - - if (rem == count || rem > 1 && rand.nextInt(count - rem) != 0) { + if (rem == count || rem > 1 && rand.nextInt(count - rem) != 0) + { ++newnorth; --rem; } - if (newnorth != north) { - if (newnorth == 0) { + + if (newnorth != north) + { + if (newnorth == 0) + { world.setBlock(x, y, z - 1, 0); - } else { + } + else + { world.setBlock(x, y, z - 1, blockID, newnorth - 1, 2); } world.scheduleBlockUpdate(x, y, z - 1, blockID, tickRate); } --count; } - if (south >= 0) { - int newsouth = each; - if (rem == count || rem > 1 && rand.nextInt(count - rem) != 0) { + if (south >= 0) + { + int newsouth = each; + if (rem == count || rem > 1 && rand.nextInt(count - rem) != 0) + { ++newsouth; --rem; } - if (newsouth != south) { - if (newsouth == 0) { + + if (newsouth != south) + { + if (newsouth == 0) + { world.setBlock(x, y, z + 1, 0); - } else { + } + else + { world.setBlock(x, y, z + 1, blockID, newsouth - 1, 2); } world.scheduleBlockUpdate(x, y, z + 1, blockID, tickRate); } --count; } - if (west >= 0) { - int newwest = each; - if (rem == count || rem > 1 && rand.nextInt(count - rem) != 0) { + if (west >= 0) + { + int newwest = each; + if (rem == count || rem > 1 && rand.nextInt(count - rem) != 0) + { ++newwest; --rem; } @@ -168,66 +192,86 @@ public class BlockFluidFinite extends BlockFluidBase { } --count; } - if (east >= 0) { - int neweast = each; - if (rem == count || rem > 1 && rand.nextInt(count - rem) != 0) { + if (east >= 0) + { + int neweast = each; + if (rem == count || rem > 1 && rand.nextInt(count - rem) != 0) + { ++neweast; --rem; } - if (neweast != east) { - if (neweast == 0) { + + if (neweast != east) + { + if (neweast == 0) + { world.setBlock(x + 1, y, z, 0); - } else { + } + else + { world.setBlock(x + 1, y, z, blockID, neweast - 1, 2); } world.scheduleBlockUpdate(x + 1, y, z, blockID, tickRate); } --count; } - if (rem > 0) { + + if (rem > 0) + { ++each; } world.setBlockMetadataWithNotify(x, y, z, each - 1, 2); } - public int tryToFlowVerticallyInto(World world, int x, int y, int z, int amtToInput) { - + public int tryToFlowVerticallyInto(World world, int x, int y, int z, int amtToInput) + { int otherY = y + densityDir; - - if (otherY < 0 || otherY >= world.getHeight()) { + if (otherY < 0 || otherY >= world.getHeight()) + { world.setBlockToAir(x, y, z); return 0; } - int amt = getQuantaValueBelow(world, x, otherY, z, quantaPerBlock); - if (amt >= 0) { + int amt = getQuantaValueBelow(world, x, otherY, z, quantaPerBlock); + if (amt >= 0) + { amt += amtToInput; - if (amt > quantaPerBlock) { + if (amt > quantaPerBlock) + { world.setBlock(x, otherY, z, blockID, quantaPerBlock - 1, 3); world.scheduleBlockUpdate(x, otherY, z, blockID, tickRate); return amt - quantaPerBlock; - } else if (amt > 0) { + } + else if (amt > 0) + { world.setBlock(x, otherY, z, blockID, amt - 1, 3); world.scheduleBlockUpdate(x, otherY, z, blockID, tickRate); world.setBlockToAir(x, y, z); return 0; } return amtToInput; - } else { + } + else + { int density_other = getDensity(world, x, otherY, z); - - if (density_other == Integer.MAX_VALUE) { - if (displaceIfPossible(world, x, otherY, z)) { + if (density_other == Integer.MAX_VALUE) + { + if (displaceIfPossible(world, x, otherY, z)) + { world.setBlock(x, otherY, z, blockID, amtToInput - 1, 3); world.scheduleBlockUpdate(x, otherY, z, blockID, tickRate); world.setBlockToAir(x, y, z); return 0; - } else { + } + else + { return amtToInput; } } - if (densityDir < 0) { + + if (densityDir < 0) + { if (density_other < density) // then swap { int bId = world.getBlockId(x, otherY, z); @@ -239,8 +283,11 @@ public class BlockFluidFinite extends BlockFluidBase { world.scheduleBlockUpdate(x, y, z, bId, block.tickRate(world)); return 0; } - } else { - if (density_other > density) { + } + else + { + if (density_other > density) + { int bId = world.getBlockId(x, otherY, z); BlockFluidBase block = (BlockFluidBase) Block.blocksList[bId]; int otherData = world.getBlockMetadata(x, otherY, z); @@ -257,15 +304,14 @@ public class BlockFluidFinite extends BlockFluidBase { /* IFluidBlock */ @Override - public FluidStack drain(World world, int x, int y, int z, boolean doDrain) { - + public FluidStack drain(World world, int x, int y, int z, boolean doDrain) + { return null; } @Override - public boolean canDrain(World world, int x, int y, int z) { - + public boolean canDrain(World world, int x, int y, int z) + { return false; } - } diff --git a/common/net/minecraftforge/fluids/Fluid.java b/common/net/minecraftforge/fluids/Fluid.java index 2c29fe19e..b7c6f9147 100644 --- a/common/net/minecraftforge/fluids/Fluid.java +++ b/common/net/minecraftforge/fluids/Fluid.java @@ -31,8 +31,8 @@ import cpw.mods.fml.relauncher.SideOnly; * @author King Lemming * */ -public class Fluid { - +public class Fluid +{ /** The unique identification name for this fluid. */ protected final String fluidName; @@ -40,9 +40,7 @@ public class Fluid { protected String unlocalizedName; /** The Icons for this fluid. */ - @SideOnly(Side.CLIENT) protected Icon stillIcon; - @SideOnly(Side.CLIENT) protected Icon flowingIcon; /** @@ -84,26 +82,31 @@ public class Fluid { */ protected int blockID = -1; - public Fluid(String fluidName) { - + public Fluid(String fluidName) + { this.fluidName = fluidName.toLowerCase(Locale.ENGLISH); this.unlocalizedName = fluidName; } - public Fluid setUnlocalizedName(String unlocalizedName) { - + public Fluid setUnlocalizedName(String unlocalizedName) + { this.unlocalizedName = unlocalizedName; return this; } - public Fluid setBlockID(int blockID) { - - if (this.blockID == -1 || this.blockID == blockID) { + public Fluid setBlockID(int blockID) + { + if (this.blockID == -1 || this.blockID == blockID) + { this.blockID = blockID; - } else if (!ForgeDummyContainer.forceDuplicateFluidBlockCrash) { + } + else if (!ForgeDummyContainer.forceDuplicateFluidBlockCrash) + { FMLLog.warning("A mod has attempted to assign BlockID " + blockID + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID " + this.blockID + ". Configure your mods to prevent this from happening."); - } else { + } + else + { FMLLog.severe("A mod has attempted to assign BlockID " + blockID + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID " + this.blockID + ". Configure your mods to prevent this from happening."); throw new LoaderException(new RuntimeException("A mod has attempted to assign BlockID " + blockID + " to the Fluid '" + fluidName @@ -112,60 +115,60 @@ public class Fluid { return this; } - public Fluid setBlockID(Block block) { - + public Fluid setBlockID(Block block) + { return setBlockID(block.blockID); } - public Fluid setLuminosity(int luminosity) { - + public Fluid setLuminosity(int luminosity) + { this.luminosity = luminosity; return this; } - public Fluid setDensity(int density) { - + public Fluid setDensity(int density) + { this.density = density; return this; } - public Fluid setViscosity(int viscosity) { - + public Fluid setViscosity(int viscosity) + { this.viscosity = viscosity; return this; } - public Fluid setGaseous(boolean isGaseous) { - + public Fluid setGaseous(boolean isGaseous) + { this.isGaseous = isGaseous; return this; } - public final String getName() { - + public final String getName() + { return this.fluidName; } - public final int getID() { - + public final int getID() + { return FluidRegistry.getFluidID(this.fluidName); } - public final int getBlockID() { - + public final int getBlockID() + { return blockID; } - public final boolean canBePlacedInWorld() { - + public final boolean canBePlacedInWorld() + { return blockID != -1; } /** * Returns the localized name of this fluid. */ - public String getLocalizedName() { - + public String getLocalizedName() + { String s = this.getUnlocalizedName(); return s == null ? "" : StatCollector.translateToLocal(s); } @@ -173,155 +176,91 @@ public class Fluid { /** * Returns the unlocalized name of this fluid. */ - public String getUnlocalizedName() { - + public String getUnlocalizedName() + { return "fluid." + this.unlocalizedName; } /** * Returns 0 for "/terrain.png". ALL FLUID TEXTURES MUST BE ON THIS SHEET. */ - public final int getSpriteNumber() { - + public final int getSpriteNumber() + { return 0; } /* Default Accessors */ - public final int getLuminosity() { - + public final int getLuminosity() + { return this.luminosity; } - public final int getDensity() { - + public final int getDensity() + { return this.density; } - public final int getViscosity() { - + public final int getViscosity() + { return this.viscosity; } - public final boolean isGaseous() { - + public final boolean isGaseous() + { return this.isGaseous; } - public int getColor() { - + public int getColor() + { return 0xFFFFFF; } - /* Stack-based Accessors */ - public int getLuminosity(FluidStack stack) { - - return getLuminosity(); - } - - public int getDensity(FluidStack stack) { - - return getDensity(); - } - - public int getViscosity(FluidStack stack) { - - return getViscosity(); - } - - public boolean isGaseous(FluidStack stack) { - - return isGaseous(); - } - - public int getColor(FluidStack stack) { - - return getColor(); - } - - /* World-based Accessors */ - public int getLuminosity(World world, int x, int y, int z) { - - return getLuminosity(); - } - - public int getDensity(World world, int x, int y, int z) { - - return getDensity(); - } - - public int getViscosity(World world, int x, int y, int z) { - - return getViscosity(); - } - - public boolean isGaseous(World world, int x, int y, int z) { - - return isGaseous(); - } - - public int getColor(World world, int x, int y, int z) { - - return getColor(); - } - - @SideOnly(Side.CLIENT) - public final Fluid setStillIcon(Icon stillIcon) { - + public final Fluid setStillIcon(Icon stillIcon) + { this.stillIcon = stillIcon; return this; } - @SideOnly(Side.CLIENT) - public final Fluid setFlowingIcon(Icon flowingIcon) { - + public final Fluid setFlowingIcon(Icon flowingIcon) + { this.flowingIcon = flowingIcon; return this; } - @SideOnly(Side.CLIENT) - public final Fluid setIcons(Icon stillIcon, Icon flowingIcon) { - - this.stillIcon = stillIcon; - this.flowingIcon = flowingIcon; - return this; + public final Fluid setIcons(Icon stillIcon, Icon flowingIcon) + { + return this.setStillIcon(stillIcon).setFlowingIcon(flowingIcon); } - @SideOnly(Side.CLIENT) - public final Fluid setIcons(Icon commonIcon) { - - this.stillIcon = commonIcon; - this.flowingIcon = commonIcon; - return this; + public final Fluid setIcons(Icon commonIcon) + { + return this.setStillIcon(commonIcon).setFlowingIcon(commonIcon); } - @SideOnly(Side.CLIENT) - public Icon getIcon() { - - return getStillIcon(); - } - - @SideOnly(Side.CLIENT) - public Icon getIcon(FluidStack stack) { - - return getIcon(); - } - - @SideOnly(Side.CLIENT) - public Icon getIcon(World world, int x, int y, int z) { - - return getIcon(); - } - - @SideOnly(Side.CLIENT) - public Icon getStillIcon() { + public Icon getIcon(){ return getStillIcon(); } + public Icon getStillIcon() + { return this.stillIcon; } - @SideOnly(Side.CLIENT) - public Icon getFlowingIcon() { - + public Icon getFlowingIcon() + { return this.flowingIcon; } + /* Stack-based Accessors */ + public int getLuminosity(FluidStack stack){ return getLuminosity(); } + public int getDensity(FluidStack stack){ return getDensity(); } + public int getViscosity(FluidStack stack){ return getViscosity(); } + public boolean isGaseous(FluidStack stack){ return isGaseous(); } + public int getColor(FluidStack stack){ return getColor(); } + public Icon getIcon(FluidStack stack){ return getIcon(); } + /* World-based Accessors */ + public int getLuminosity(World world, int x, int y, int z){ return getLuminosity(); } + public int getDensity(World world, int x, int y, int z){ return getDensity(); } + public int getViscosity(World world, int x, int y, int z){ return getViscosity(); } + public boolean isGaseous(World world, int x, int y, int z){ return isGaseous(); } + public int getColor(World world, int x, int y, int z){ return getColor(); } + public Icon getIcon(World world, int x, int y, int z){ return getIcon(); } } diff --git a/common/net/minecraftforge/fluids/FluidContainerRegistry.java b/common/net/minecraftforge/fluids/FluidContainerRegistry.java index e6fba89fa..cf37e565b 100644 --- a/common/net/minecraftforge/fluids/FluidContainerRegistry.java +++ b/common/net/minecraftforge/fluids/FluidContainerRegistry.java @@ -22,8 +22,8 @@ import net.minecraftforge.event.Event; * @author King Lemming * */ -public abstract class FluidContainerRegistry { - +public abstract class FluidContainerRegistry +{ private static Map containerFluidMap = new HashMap(); private static Map filledContainerMap = new HashMap(); private static Set emptyContainers = new HashSet(); @@ -32,15 +32,14 @@ public abstract class FluidContainerRegistry { public static final ItemStack EMPTY_BUCKET = new ItemStack(Item.bucketEmpty); public static final ItemStack EMPTY_BOTTLE = new ItemStack(Item.glassBottle); - static { + static + { registerFluidContainer(FluidRegistry.WATER, new ItemStack(Item.bucketWater), EMPTY_BUCKET); - registerFluidContainer(FluidRegistry.LAVA, new ItemStack(Item.bucketLava), EMPTY_BUCKET); - registerFluidContainer(FluidRegistry.WATER, new ItemStack(Item.potion), EMPTY_BOTTLE); + registerFluidContainer(FluidRegistry.LAVA, new ItemStack(Item.bucketLava), EMPTY_BUCKET); + registerFluidContainer(FluidRegistry.WATER, new ItemStack(Item.potion), EMPTY_BOTTLE); } - private FluidContainerRegistry() { - - } + private FluidContainerRegistry(){} /** * Register a new fluid containing item. @@ -53,8 +52,8 @@ public abstract class FluidContainerRegistry { * ItemStack representing the container when it is empty. * @return True if container was successfully registered; false if it already is. */ - public static boolean registerFluidContainer(FluidStack stack, ItemStack filledContainer, ItemStack emptyContainer) { - + public static boolean registerFluidContainer(FluidStack stack, ItemStack filledContainer, ItemStack emptyContainer) + { return registerFluidContainer(new FluidContainerData(stack, filledContainer, emptyContainer)); } @@ -70,9 +69,10 @@ public abstract class FluidContainerRegistry { * ItemStack representing the container when it is empty. * @return True if container was successfully registered; false if it already is. */ - public static boolean registerFluidContainer(Fluid fluid, ItemStack filledContainer, ItemStack emptyContainer) { - - if (!FluidRegistry.isFluidRegistered(fluid)) { + public static boolean registerFluidContainer(Fluid fluid, ItemStack filledContainer, ItemStack emptyContainer) + { + if (!FluidRegistry.isFluidRegistered(fluid)) + { FluidRegistry.registerFluid(fluid); } return registerFluidContainer(new FluidStack(fluid, BUCKET_VOLUME), filledContainer, emptyContainer); @@ -87,8 +87,8 @@ public abstract class FluidContainerRegistry { * ItemStack representing the container when it is full. * @return True if container was successfully registered; false if it already is. */ - public static boolean registerFluidContainer(FluidStack stack, ItemStack filledContainer) { - + public static boolean registerFluidContainer(FluidStack stack, ItemStack filledContainer) + { return registerFluidContainer(new FluidContainerData(stack, filledContainer, null, true)); } @@ -102,9 +102,10 @@ public abstract class FluidContainerRegistry { * ItemStack representing the container when it is full. * @return True if container was successfully registered; false if it already is. */ - public static boolean registerFluidContainer(Fluid fluid, ItemStack filledContainer) { - - if (!FluidRegistry.isFluidRegistered(fluid)) { + public static boolean registerFluidContainer(Fluid fluid, ItemStack filledContainer) + { + if (!FluidRegistry.isFluidRegistered(fluid)) + { FluidRegistry.registerFluid(fluid); } return registerFluidContainer(new FluidStack(fluid, BUCKET_VOLUME), filledContainer); @@ -117,17 +118,20 @@ public abstract class FluidContainerRegistry { * See {@link FluidContainerData}. * @return True if container was successfully registered; false if it already is. */ - public static boolean registerFluidContainer(FluidContainerData data) { - - if (isFilledContainer(data.filledContainer)) { + public static boolean registerFluidContainer(FluidContainerData data) + { + if (isFilledContainer(data.filledContainer)) + { return false; } containerFluidMap.put(Arrays.asList(data.filledContainer.itemID, data.filledContainer.getItemDamage()), data); - if (data.emptyContainer != null) { + if (data.emptyContainer != null) + { filledContainerMap.put(Arrays.asList(data.emptyContainer.itemID, data.emptyContainer.getItemDamage(), data.fluid.fluidID), data); emptyContainers.add(Arrays.asList(data.emptyContainer.itemID, data.emptyContainer.getItemDamage())); } + MinecraftForge.EVENT_BUS.post(new FluidContainerRegisterEvent(data)); return true; } @@ -139,11 +143,13 @@ public abstract class FluidContainerRegistry { * The fluid container. * @return FluidStack representing stored fluid. */ - public static FluidStack getFluidForFilledItem(ItemStack container) { - - if (container == null) { + public static FluidStack getFluidForFilledItem(ItemStack container) + { + if (container == null) + { return null; } + FluidContainerData data = containerFluidMap.get(Arrays.asList(container.itemID, container.getItemDamage())); return data == null ? null : data.fluid.copy(); } @@ -159,13 +165,16 @@ public abstract class FluidContainerRegistry { * ItemStack representing the empty container. * @return Filled container if successful, otherwise null. */ - public static ItemStack fillFluidContainer(FluidStack fluid, ItemStack container) { - - if (container == null || fluid == null) { + public static ItemStack fillFluidContainer(FluidStack fluid, ItemStack container) + { + if (container == null || fluid == null) + { return null; } + FluidContainerData data = filledContainerMap.get(Arrays.asList(container.itemID, container.getItemDamage(), fluid.fluidID)); - if (data != null && fluid.amount >= data.fluid.amount) { + if (data != null && fluid.amount >= data.fluid.amount) + { return data.filledContainer.copy(); } return null; @@ -174,43 +183,50 @@ public abstract class FluidContainerRegistry { /** * Determines if a container holds a specific fluid. */ - public static boolean containsFluid(ItemStack container, FluidStack fluid) { - - if (container == null || fluid == null) { + public static boolean containsFluid(ItemStack container, FluidStack fluid) + { + if (container == null || fluid == null) + { return false; } + FluidContainerData data = filledContainerMap.get(Arrays.asList(container.itemID, container.getItemDamage(), fluid.fluidID)); return data == null ? false : data.fluid.isFluidEqual(fluid); } - public static boolean isBucket(ItemStack container) { - - if (container == null) { + public static boolean isBucket(ItemStack container) + { + if (container == null) + { return false; } - if (container.isItemEqual(EMPTY_BUCKET)) { + + if (container.isItemEqual(EMPTY_BUCKET)) + { return true; } + FluidContainerData data = containerFluidMap.get(Arrays.asList(container.itemID, container.getItemDamage())); return data != null && data.emptyContainer.isItemEqual(EMPTY_BUCKET); } - public static boolean isContainer(ItemStack container) { - + public static boolean isContainer(ItemStack container) + { return isEmptyContainer(container) || isFilledContainer(container); } - public static boolean isEmptyContainer(ItemStack container) { - + public static boolean isEmptyContainer(ItemStack container) + { return container != null && emptyContainers.contains(Arrays.asList(container.itemID, container.getItemDamage())); } - public static boolean isFilledContainer(ItemStack container) { - + public static boolean isFilledContainer(ItemStack container) + { return container != null && getFluidForFilledItem(container) != null; } - public static FluidContainerData[] getRegisteredFluidContainerData() { + public static FluidContainerData[] getRegisteredFluidContainerData() + { return containerFluidMap.values().toArray(new FluidContainerData[containerFluidMap.size()]); } @@ -218,40 +234,41 @@ public abstract class FluidContainerRegistry { * Wrapper class for the registry entries. Ensures that none of the attempted registrations * contain null references unless permitted. */ - public static class FluidContainerData { - + public static class FluidContainerData + { public final FluidStack fluid; public final ItemStack filledContainer; public final ItemStack emptyContainer; - public FluidContainerData(FluidStack stack, ItemStack filledContainer, ItemStack emptyContainer) { - + public FluidContainerData(FluidStack stack, ItemStack filledContainer, ItemStack emptyContainer) + { this(stack, filledContainer, emptyContainer, false); } - public FluidContainerData(FluidStack stack, ItemStack filledContainer, ItemStack emptyContainer, boolean nullEmpty) { - + public FluidContainerData(FluidStack stack, ItemStack filledContainer, ItemStack emptyContainer, boolean nullEmpty) + { this.fluid = stack; this.filledContainer = filledContainer; this.emptyContainer = emptyContainer; - if (stack == null || filledContainer == null || emptyContainer == null && !nullEmpty) { + if (stack == null || filledContainer == null || emptyContainer == null && !nullEmpty) + { throw new RuntimeException("Invalid FluidContainerData - a parameter was null."); } } - public FluidContainerData copy() { - + public FluidContainerData copy() + { return new FluidContainerData(fluid, filledContainer, emptyContainer, true); } } - public static class FluidContainerRegisterEvent extends Event { - + public static class FluidContainerRegisterEvent extends Event + { public final FluidContainerData data; - public FluidContainerRegisterEvent(FluidContainerData data) { - + public FluidContainerRegisterEvent(FluidContainerData data) + { this.data = data.copy(); } } diff --git a/common/net/minecraftforge/fluids/FluidEvent.java b/common/net/minecraftforge/fluids/FluidEvent.java index 328ba706b..c9cff4ff5 100644 --- a/common/net/minecraftforge/fluids/FluidEvent.java +++ b/common/net/minecraftforge/fluids/FluidEvent.java @@ -5,16 +5,16 @@ import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.Event; -public class FluidEvent extends Event { - +public class FluidEvent extends Event +{ public final FluidStack fluid; public final int x; public final int y; public final int z; public final World world; - public FluidEvent(FluidStack fluid, World world, int x, int y, int z) { - + public FluidEvent(FluidStack fluid, World world, int x, int y, int z) + { this.fluid = fluid; this.world = world; this.x = x; @@ -28,10 +28,10 @@ public class FluidEvent extends Event { * @author cpw * */ - public static class FluidMotionEvent extends FluidEvent { - - public FluidMotionEvent(FluidStack fluid, World world, int x, int y, int z) { - + public static class FluidMotionEvent extends FluidEvent + { + public FluidMotionEvent(FluidStack fluid, World world, int x, int y, int z) + { super(fluid, world, x, y, z); } } @@ -43,12 +43,11 @@ public class FluidEvent extends Event { * @author cpw * */ - public static class FluidFillingEvent extends FluidEvent { - + public static class FluidFillingEvent extends FluidEvent + { public final IFluidTank tank; - - public FluidFillingEvent(FluidStack fluid, World world, int x, int y, int z, IFluidTank tank) { - + public FluidFillingEvent(FluidStack fluid, World world, int x, int y, int z, IFluidTank tank) + { super(fluid, world, x, y, z); this.tank = tank; } @@ -61,12 +60,11 @@ public class FluidEvent extends Event { * @author cpw * */ - public static class FluidDrainingEvent extends FluidEvent { - + public static class FluidDrainingEvent extends FluidEvent + { public final IFluidTank tank; - - public FluidDrainingEvent(FluidStack fluid, World world, int x, int y, int z, IFluidTank tank) { - + public FluidDrainingEvent(FluidStack fluid, World world, int x, int y, int z, IFluidTank tank) + { super(fluid, world, x, y, z); this.tank = tank; } @@ -79,10 +77,10 @@ public class FluidEvent extends Event { * @author cpw * */ - public static class FluidSpilledEvent extends FluidEvent { - - public FluidSpilledEvent(FluidStack fluid, World world, int x, int y, int z) { - + public static class FluidSpilledEvent extends FluidEvent + { + public FluidSpilledEvent(FluidStack fluid, World world, int x, int y, int z) + { super(fluid, world, x, y, z); } } @@ -92,9 +90,8 @@ public class FluidEvent extends Event { * * @param event */ - public static final void fireEvent(FluidEvent event) { - + public static final void fireEvent(FluidEvent event) + { MinecraftForge.EVENT_BUS.post(event); } - } diff --git a/common/net/minecraftforge/fluids/FluidIdMapPacket.java b/common/net/minecraftforge/fluids/FluidIdMapPacket.java index 7859c61d4..9c8cc8ae7 100644 --- a/common/net/minecraftforge/fluids/FluidIdMapPacket.java +++ b/common/net/minecraftforge/fluids/FluidIdMapPacket.java @@ -13,17 +13,18 @@ import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteStreams; -public class FluidIdMapPacket extends ForgePacket { - +public class FluidIdMapPacket extends ForgePacket +{ private BiMap fluidIds = HashBiMap.create(); @Override - public byte[] generatePacket() { - + public byte[] generatePacket() + { ByteArrayDataOutput dat = ByteStreams.newDataOutput(); dat.writeInt(FluidRegistry.maxID); - for (Map.Entry entry : FluidRegistry.fluidIDs.entrySet()) { + for (Map.Entry entry : FluidRegistry.fluidIDs.entrySet()) + { dat.writeUTF(entry.getKey()); dat.writeInt(entry.getValue()); } @@ -31,8 +32,8 @@ public class FluidIdMapPacket extends ForgePacket { } @Override - public ForgePacket consumePacket(byte[] data) { - + public ForgePacket consumePacket(byte[] data) + { ByteArrayDataInput dat = ByteStreams.newDataInput(data); int listSize = dat.readInt(); for (int i = 0; i < listSize; i++) { @@ -44,9 +45,8 @@ public class FluidIdMapPacket extends ForgePacket { } @Override - public void execute(INetworkManager network, EntityPlayer player) { - + public void execute(INetworkManager network, EntityPlayer player) + { FluidRegistry.initFluidIDs(fluidIds); } - } diff --git a/common/net/minecraftforge/fluids/FluidRegistry.java b/common/net/minecraftforge/fluids/FluidRegistry.java index 34bd87fc1..4eba91c67 100644 --- a/common/net/minecraftforge/fluids/FluidRegistry.java +++ b/common/net/minecraftforge/fluids/FluidRegistry.java @@ -18,8 +18,8 @@ import com.google.common.collect.ImmutableMap; * @author King Lemming, CovertJaguar (LiquidDictionary) * */ -public abstract class FluidRegistry { - +public abstract class FluidRegistry +{ static int maxID = 0; static HashMap fluids = new HashMap(); @@ -30,20 +30,19 @@ public abstract class FluidRegistry { public static int renderIdFluid = -1; - static { + static + { registerFluid(WATER); registerFluid(LAVA); } - private FluidRegistry() { - - } + private FluidRegistry(){} /** * Called by Forge to prepare the ID map for server -> client sync. */ - static void initFluidIDs(BiMap newfluidIDs) { - + static void initFluidIDs(BiMap newfluidIDs) + { maxID = newfluidIDs.size(); fluidIDs.clear(); fluidIDs.putAll(newfluidIDs); @@ -56,9 +55,10 @@ public abstract class FluidRegistry { * The fluid to register. * @return True if the fluid was successfully registered; false if there is a name clash. */ - public static boolean registerFluid(Fluid fluid) { - - if (fluidIDs.containsKey(fluid.getName())) { + public static boolean registerFluid(Fluid fluid) + { + if (fluidIDs.containsKey(fluid.getName())) + { return false; } fluids.put(fluid.getName(), fluid); @@ -68,44 +68,45 @@ public abstract class FluidRegistry { return true; } - public static boolean isFluidRegistered(Fluid fluid) { - + public static boolean isFluidRegistered(Fluid fluid) + { return fluidIDs.containsKey(fluid.getName()); } - public static boolean isFluidRegistered(String fluidName) { - + public static boolean isFluidRegistered(String fluidName) + { return fluidIDs.containsKey(fluidName); } - public static Fluid getFluid(String fluidName) { - + public static Fluid getFluid(String fluidName) + { return fluids.get(fluidName); } - public static Fluid getFluid(int fluidID) { - + public static Fluid getFluid(int fluidID) + { return fluids.get(getFluidName(fluidID)); } - public static String getFluidName(int fluidID) { - + public static String getFluidName(int fluidID) + { return fluidIDs.inverse().get(fluidID); } - public static String getFluidName(FluidStack stack) { - + public static String getFluidName(FluidStack stack) + { return getFluidName(stack.fluidID); } - public static int getFluidID(String fluidName) { - + public static int getFluidID(String fluidName) + { return fluidIDs.get(fluidName); } - public static FluidStack getFluidStack(String fluidName, int amount) { - - if (!fluidIDs.containsKey(fluidName)) { + public static FluidStack getFluidStack(String fluidName, int amount) + { + if (!fluidIDs.containsKey(fluidName)) + { return null; } return new FluidStack(getFluidID(fluidName), amount); @@ -114,29 +115,28 @@ public abstract class FluidRegistry { /** * Returns a read-only map containing Fluid Names and their associated Fluids. */ - public static Map getRegisteredFluids() { - + public static Map getRegisteredFluids() + { return ImmutableMap.copyOf(fluids); } /** * Returns a read-only map containing Fluid Names and their associated IDs. */ - public static Map getRegisteredFluidIDs() { - + public static Map getRegisteredFluidIDs() + { return ImmutableMap.copyOf(fluidIDs); } - public static class FluidRegisterEvent extends Event { - + public static class FluidRegisterEvent extends Event + { public final String fluidName; public final int fluidID; - public FluidRegisterEvent(String fluidName, int fluidID) { - + public FluidRegisterEvent(String fluidName, int fluidID) + { this.fluidName = fluidName; this.fluidID = fluidID; } } - } diff --git a/common/net/minecraftforge/fluids/FluidStack.java b/common/net/minecraftforge/fluids/FluidStack.java index ede8942b1..99615501b 100644 --- a/common/net/minecraftforge/fluids/FluidStack.java +++ b/common/net/minecraftforge/fluids/FluidStack.java @@ -14,35 +14,36 @@ import net.minecraft.nbt.NBTTagCompound; * @author King Lemming, SirSengir (LiquidStack) * */ -public class FluidStack { - +public class FluidStack +{ public int fluidID; public int amount; public NBTTagCompound tag; - public FluidStack(Fluid fluid, int amount) { - + public FluidStack(Fluid fluid, int amount) + { this.fluidID = fluid.getID(); this.amount = amount; } - public FluidStack(int fluidID, int amount) { - + public FluidStack(int fluidID, int amount) + { this.fluidID = fluidID; this.amount = amount; } - public FluidStack(int fluidID, int amount, NBTTagCompound nbt) { - + public FluidStack(int fluidID, int amount, NBTTagCompound nbt) + { this(fluidID, amount); - if (nbt != null) { + if (nbt != null) + { tag = (NBTTagCompound) nbt.copy(); } } - public FluidStack(FluidStack stack, int amount) { - + public FluidStack(FluidStack stack, int amount) + { this(stack.fluidID, amount, stack.tag); } @@ -50,40 +51,43 @@ public class FluidStack { * This provides a safe method for retrieving a FluidStack - if the Fluid is invalid, the stack * will return as null. */ - public static FluidStack loadFluidStackFromNBT(NBTTagCompound nbt) { - - if (nbt == null || FluidRegistry.getFluid(nbt.getString("FluidName")) == null) { + public static FluidStack loadFluidStackFromNBT(NBTTagCompound nbt) + { + if (nbt == null || FluidRegistry.getFluid(nbt.getString("FluidName")) == null) + { return null; } FluidStack stack = new FluidStack(FluidRegistry.getFluidID(nbt.getString("FluidName")), nbt.getInteger("Amount")); - if (nbt.hasKey("Tag")) { + if (nbt.hasKey("Tag")) + { stack.tag = nbt.getCompoundTag("Tag"); } return stack; } - public NBTTagCompound writeToNBT(NBTTagCompound nbt) { - + public NBTTagCompound writeToNBT(NBTTagCompound nbt) + { nbt.setString("FluidName", FluidRegistry.getFluidName(fluidID)); nbt.setInteger("Amount", amount); - if (tag != null) { + if (tag != null) + { nbt.setTag("Tag", tag); } return nbt; } - public final Fluid getFluid() { - + public final Fluid getFluid() + { return FluidRegistry.getFluid(fluidID); } /** * @return A copy of this FluidStack */ - public FluidStack copy() { - + public FluidStack copy() + { return new FluidStack(fluidID, amount, tag); } @@ -94,21 +98,21 @@ public class FluidStack { * The FluidStack for comparison * @return true if the Fluids (IDs and NBT Tags) are the same */ - public boolean isFluidEqual(FluidStack other) { - + public boolean isFluidEqual(FluidStack other) + { return other != null && fluidID == other.fluidID && isFluidStackTagEqual(other); } - private boolean isFluidStackTagEqual(FluidStack other) { - + private boolean isFluidStackTagEqual(FluidStack other) + { return tag == null ? other.tag == null : other.tag == null ? false : tag.equals(other.tag); } /** * Determines if the NBT Tags are equal. Useful if the FluidIDs are known to be equal. */ - public static boolean areFluidStackTagsEqual(FluidStack stack1, FluidStack stack2) { - + public static boolean areFluidStackTagsEqual(FluidStack stack1, FluidStack stack2) + { return stack1 == null && stack2 == null ? true : stack1 == null || stack2 == null ? false : stack1.isFluidStackTagEqual(stack2); } @@ -118,8 +122,8 @@ public class FluidStack { * @param other * @return true if this FluidStack contains the other FluidStack (same fluid and >= amount) */ - public boolean containsFluid(FluidStack other) { - + public boolean containsFluid(FluidStack other) + { return isFluidEqual(other) && amount >= other.amount; } @@ -130,8 +134,8 @@ public class FluidStack { * - the FluidStack for comparison * @return true if the two FluidStacks are exactly the same */ - public boolean isFluidStackIdentical(FluidStack other) { - + public boolean isFluidStackIdentical(FluidStack other) + { return isFluidEqual(other) && amount == other.amount; } @@ -143,20 +147,24 @@ public class FluidStack { * The ItemStack for comparison * @return true if the Fluids (IDs and NBT Tags) are the same */ - public boolean isFluidEqual(ItemStack other) { - - if (other == null) { + public boolean isFluidEqual(ItemStack other) + { + if (other == null) + { return false; } - if (other.getItem() instanceof IFluidContainerItem) { + + if (other.getItem() instanceof IFluidContainerItem) + { return isFluidEqual(((IFluidContainerItem) other.getItem()).getFluid(other)); } + return isFluidEqual(FluidContainerRegistry.getFluidForFilledItem(other)); } @Override - public final int hashCode() { - + public final int hashCode() + { return fluidID; } @@ -166,12 +174,13 @@ public class FluidStack { * This is included for use in data structures. */ @Override - public final boolean equals(Object o) { - - if (!(o instanceof FluidStack)) { + public final boolean equals(Object o) + { + if (!(o instanceof FluidStack)) + { return false; } + return isFluidEqual((FluidStack) o); } - } diff --git a/common/net/minecraftforge/fluids/FluidTank.java b/common/net/minecraftforge/fluids/FluidTank.java index ee39fa515..4aa7a9cab 100644 --- a/common/net/minecraftforge/fluids/FluidTank.java +++ b/common/net/minecraftforge/fluids/FluidTank.java @@ -10,152 +10,179 @@ import net.minecraft.tileentity.TileEntity; * @author King Lemming, cpw (LiquidTank) * */ -public class FluidTank implements IFluidTank { - +public class FluidTank implements IFluidTank +{ protected FluidStack fluid; protected int capacity; protected TileEntity tile; - public FluidTank(int capacity) { - + public FluidTank(int capacity) + { this(null, capacity); } - public FluidTank(FluidStack stack, int capacity) { - + public FluidTank(FluidStack stack, int capacity) + { this.fluid = stack; this.capacity = capacity; } - public FluidTank(Fluid fluid, int amount, int capacity) { - + public FluidTank(Fluid fluid, int amount, int capacity) + { this(new FluidStack(fluid, amount), capacity); } - public FluidTank readFromNBT(NBTTagCompound nbt) { - - if (!nbt.hasKey("Empty")) { + public FluidTank readFromNBT(NBTTagCompound nbt) + { + if (!nbt.hasKey("Empty")) + { FluidStack fluid = FluidStack.loadFluidStackFromNBT(nbt); - if (fluid != null) { + if (fluid != null) + { setFluid(fluid); } } return this; } - public NBTTagCompound writeToNBT(NBTTagCompound nbt) { - - if (fluid != null) { + public NBTTagCompound writeToNBT(NBTTagCompound nbt) + { + if (fluid != null) + { fluid.writeToNBT(nbt); - } else { + } + else + { nbt.setString("Empty", ""); } return nbt; } - public void setFluid(FluidStack fluid) { - + public void setFluid(FluidStack fluid) + { this.fluid = fluid; } - public void setCapacity(int capacity) { - + public void setCapacity(int capacity) + { this.capacity = capacity; } /* IFluidTank */ @Override - public FluidStack getFluid() { - + public FluidStack getFluid() + { return fluid; } @Override - public int getFluidAmount() { - - if (fluid == null) { + public int getFluidAmount() + { + if (fluid == null) + { return 0; } return fluid.amount; } @Override - public int getCapacity() { - + public int getCapacity() + { return capacity; } @Override - public FluidTankInfo getInfo() { - + public FluidTankInfo getInfo() + { return new FluidTankInfo(this); } @Override - public int fill(FluidStack resource, boolean doFill) { - - if (resource == null) { + public int fill(FluidStack resource, boolean doFill) + { + if (resource == null) + { return 0; } - if (!doFill) { - if (fluid == null) { + + if (!doFill) + { + if (fluid == null) + { return Math.min(capacity, resource.amount); } - if (!fluid.isFluidEqual(resource)) { + + if (!fluid.isFluidEqual(resource)) + { return 0; } + return Math.min(capacity - fluid.amount, resource.amount); } - if (fluid == null) { + + if (fluid == null) + { fluid = new FluidStack(resource, Math.min(capacity, resource.amount)); - if (tile != null) { + if (tile != null) + { FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluid, tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord, this)); } return fluid.amount; } - if (!fluid.isFluidEqual(resource)) { + + if (!fluid.isFluidEqual(resource)) + { return 0; } int filled = capacity - fluid.amount; - if (resource.amount < filled) { + if (resource.amount < filled) + { fluid.amount += resource.amount; filled = resource.amount; - } else { + } + else + { fluid.amount = capacity; } - if (tile != null) { + + if (tile != null) + { FluidEvent.fireEvent(new FluidEvent.FluidFillingEvent(fluid, tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord, this)); } return filled; } @Override - public FluidStack drain(int maxDrain, boolean doDrain) { - - if (fluid == null) { + public FluidStack drain(int maxDrain, boolean doDrain) + { + if (fluid == null) + { return null; } - int drained = maxDrain; - if (fluid.amount < drained) { + int drained = maxDrain; + if (fluid.amount < drained) + { drained = fluid.amount; } + FluidStack stack = new FluidStack(fluid, drained); - - if (doDrain) { + if (doDrain) + { fluid.amount -= drained; - - if (fluid.amount <= 0) { + if (fluid.amount <= 0) + { fluid = null; } - if (tile != null) { + + if (tile != null) + { FluidEvent.fireEvent(new FluidEvent.FluidDrainingEvent(fluid, tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord, this)); } } return stack; } - } diff --git a/common/net/minecraftforge/fluids/FluidTankInfo.java b/common/net/minecraftforge/fluids/FluidTankInfo.java index 8443f1452..a61ca4e4c 100644 --- a/common/net/minecraftforge/fluids/FluidTankInfo.java +++ b/common/net/minecraftforge/fluids/FluidTankInfo.java @@ -1,4 +1,3 @@ - package net.minecraftforge.fluids; /** @@ -7,21 +6,20 @@ package net.minecraftforge.fluids; * @author King Lemming * */ -public final class FluidTankInfo { - +public final class FluidTankInfo +{ public final FluidStack fluid; public final int capacity; - public FluidTankInfo(FluidStack fluid, int capacity) { - + public FluidTankInfo(FluidStack fluid, int capacity) + { this.fluid = fluid; this.capacity = capacity; } - public FluidTankInfo(IFluidTank tank) { - + public FluidTankInfo(IFluidTank tank) + { this.fluid = tank.getFluid(); this.capacity = tank.getCapacity(); } - } diff --git a/common/net/minecraftforge/fluids/IFluidBlock.java b/common/net/minecraftforge/fluids/IFluidBlock.java index 5d66980a6..f2f13b23e 100644 --- a/common/net/minecraftforge/fluids/IFluidBlock.java +++ b/common/net/minecraftforge/fluids/IFluidBlock.java @@ -1,4 +1,3 @@ - package net.minecraftforge.fluids; import net.minecraft.world.World; @@ -11,8 +10,8 @@ import net.minecraft.world.World; * @author King Lemming * */ -public interface IFluidBlock { - +public interface IFluidBlock +{ /** * Returns the Fluid associated with this Block. */ diff --git a/common/net/minecraftforge/fluids/IFluidContainerItem.java b/common/net/minecraftforge/fluids/IFluidContainerItem.java index c3ab9924a..04957b9cd 100644 --- a/common/net/minecraftforge/fluids/IFluidContainerItem.java +++ b/common/net/minecraftforge/fluids/IFluidContainerItem.java @@ -1,4 +1,3 @@ - package net.minecraftforge.fluids; import net.minecraft.item.ItemStack; @@ -14,8 +13,8 @@ import net.minecraft.item.ItemStack; * @author King Lemming * */ -public interface IFluidContainerItem { - +public interface IFluidContainerItem +{ /** * * @param container @@ -57,5 +56,4 @@ public interface IFluidContainerItem { * container. */ FluidStack drain(ItemStack container, int maxDrain, boolean doDrain); - } diff --git a/common/net/minecraftforge/fluids/IFluidHandler.java b/common/net/minecraftforge/fluids/IFluidHandler.java index 17e96343e..bc443e957 100644 --- a/common/net/minecraftforge/fluids/IFluidHandler.java +++ b/common/net/minecraftforge/fluids/IFluidHandler.java @@ -1,4 +1,3 @@ - package net.minecraftforge.fluids; import net.minecraftforge.common.ForgeDirection; @@ -12,8 +11,8 @@ import net.minecraftforge.common.ForgeDirection; * @author King Lemming * */ -public interface IFluidHandler { - +public interface IFluidHandler +{ /** * Fills fluid into internal tanks, distribution is left entirely to the IFluidHandler. * @@ -80,5 +79,4 @@ public interface IFluidHandler { * @return Info for the relevant internal tanks. */ FluidTankInfo[] getTankInfo(ForgeDirection from); - } diff --git a/common/net/minecraftforge/fluids/IFluidTank.java b/common/net/minecraftforge/fluids/IFluidTank.java index f88564857..741676185 100644 --- a/common/net/minecraftforge/fluids/IFluidTank.java +++ b/common/net/minecraftforge/fluids/IFluidTank.java @@ -1,4 +1,3 @@ - package net.minecraftforge.fluids; /** @@ -9,8 +8,8 @@ package net.minecraftforge.fluids; * @author King Lemming, cpw (ILiquidTank) * */ -public interface IFluidTank { - +public interface IFluidTank +{ /** * @return FluidStack representing the fluid in the tank, null if the tank is empty. */ @@ -55,5 +54,4 @@ public interface IFluidTank { * @return Amount of fluid that was removed from the tank. */ FluidStack drain(int maxDrain, boolean doDrain); - } diff --git a/common/net/minecraftforge/fluids/ItemFluidContainer.java b/common/net/minecraftforge/fluids/ItemFluidContainer.java index 5503cf423..e42703aa4 100644 --- a/common/net/minecraftforge/fluids/ItemFluidContainer.java +++ b/common/net/minecraftforge/fluids/ItemFluidContainer.java @@ -1,4 +1,3 @@ - package net.minecraftforge.fluids; import net.minecraft.item.Item; @@ -11,122 +10,149 @@ import net.minecraft.nbt.NBTTagCompound; * @author King Lemming * */ -public class ItemFluidContainer extends Item implements IFluidContainerItem { - +public class ItemFluidContainer extends Item implements IFluidContainerItem +{ protected int capacity; - public ItemFluidContainer(int itemID) { - + public ItemFluidContainer(int itemID) + { super(itemID); } - public ItemFluidContainer(int itemID, int capacity) { - + public ItemFluidContainer(int itemID, int capacity) + { super(itemID); this.capacity = capacity; } - public ItemFluidContainer setCapacity(int capacity) { - + public ItemFluidContainer setCapacity(int capacity) + { this.capacity = capacity; return this; } /* IFluidContainerItem */ @Override - public FluidStack getFluid(ItemStack container) { - - if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Fluid")) { + public FluidStack getFluid(ItemStack container) + { + if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Fluid")) + { return null; } return FluidStack.loadFluidStackFromNBT(container.stackTagCompound.getCompoundTag("Fluid")); } @Override - public int getCapacity(ItemStack container) { - + public int getCapacity(ItemStack container) + { return capacity; } @Override - public int fill(ItemStack container, FluidStack resource, boolean doFill) { - - if (resource == null) { + public int fill(ItemStack container, FluidStack resource, boolean doFill) + { + if (resource == null) + { return 0; } - if (!doFill) { - if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Fluid")) { + + if (!doFill) + { + if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Fluid")) + { return Math.min(capacity, resource.amount); } + FluidStack stack = FluidStack.loadFluidStackFromNBT(container.stackTagCompound.getCompoundTag("Fluid")); - if (stack == null) { + if (stack == null) + { return Math.min(capacity, resource.amount); } - if (!stack.isFluidEqual(resource)) { + + if (!stack.isFluidEqual(resource)) + { return 0; } + return Math.min(capacity - stack.amount, resource.amount); } - if (container.stackTagCompound == null) { + + if (container.stackTagCompound == null) + { container.stackTagCompound = new NBTTagCompound(); } - if (!container.stackTagCompound.hasKey("Fluid")) { + + if (!container.stackTagCompound.hasKey("Fluid")) + { NBTTagCompound fluidTag = resource.writeToNBT(new NBTTagCompound()); - if (capacity < resource.amount) { + if (capacity < resource.amount) + { fluidTag.setInteger("Amount", capacity); container.stackTagCompound.setTag("Fluid", fluidTag); return capacity; } + container.stackTagCompound.setTag("Fluid", fluidTag); return resource.amount; } + NBTTagCompound fluidTag = container.stackTagCompound.getCompoundTag("Fluid"); FluidStack stack = FluidStack.loadFluidStackFromNBT(fluidTag); - if (!stack.isFluidEqual(resource)) { + if (!stack.isFluidEqual(resource)) + { return 0; } - int filled = capacity - resource.amount; - if (resource.amount < filled) { + int filled = capacity - resource.amount; + if (resource.amount < filled) + { stack.amount += resource.amount; filled = resource.amount; - } else { + } + else + { stack.amount = capacity; } + container.stackTagCompound.setTag("Fluid", stack.writeToNBT(fluidTag)); return filled; } @Override - public FluidStack drain(ItemStack container, int maxDrain, boolean doDrain) { - - if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Fluid")) { + public FluidStack drain(ItemStack container, int maxDrain, boolean doDrain) + { + if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Fluid")) + { return null; } + FluidStack stack = FluidStack.loadFluidStackFromNBT(container.stackTagCompound.getCompoundTag("Fluid")); - - if (stack == null) { + if (stack == null) + { return null; } - stack.amount = Math.min(stack.amount, maxDrain); - if (doDrain) { - if (maxDrain >= capacity) { + stack.amount = Math.min(stack.amount, maxDrain); + if (doDrain) + { + if (maxDrain >= capacity) + { container.stackTagCompound.removeTag("Fluid"); - if (container.stackTagCompound.hasNoTags()) { + if (container.stackTagCompound.hasNoTags()) + { container.stackTagCompound = null; } return stack; } + NBTTagCompound fluidTag = container.stackTagCompound.getCompoundTag("Fluid"); fluidTag.setInteger("Amount", fluidTag.getInteger("Amount") - maxDrain); container.stackTagCompound.setTag("Fluid", fluidTag); } return stack; } - } diff --git a/common/net/minecraftforge/fluids/RenderBlockFluid.java b/common/net/minecraftforge/fluids/RenderBlockFluid.java index 971d62fbb..5a0e6b180 100644 --- a/common/net/minecraftforge/fluids/RenderBlockFluid.java +++ b/common/net/minecraftforge/fluids/RenderBlockFluid.java @@ -15,8 +15,8 @@ import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; * @author King Lemming * */ -public class RenderBlockFluid implements ISimpleBlockRenderingHandler { - +public class RenderBlockFluid implements ISimpleBlockRenderingHandler +{ public static RenderBlockFluid instance = new RenderBlockFluid(); static final float LIGHT_Y_NEG = 0.5F; @@ -25,16 +25,20 @@ public class RenderBlockFluid implements ISimpleBlockRenderingHandler { static final float LIGHT_XZ_POS = 0.6F; static final double RENDER_OFFSET = 0.0010000000474974513D; - public float getFluidHeightAverage(float[] flow) { - + public float getFluidHeightAverage(float[] flow) + { float total = 0; int count = 0; - for (int i = 0; i < flow.length; i++) { - if (flow[i] >= 0.875F) { + for (int i = 0; i < flow.length; i++) + { + if (flow[i] >= 0.875F) + { return flow[i]; } - if (flow[i] >= 0) { + + if (flow[i] >= 0) + { total += flow[i]; count++; } @@ -42,14 +46,17 @@ public class RenderBlockFluid implements ISimpleBlockRenderingHandler { return total / count; } - public float getFluidHeightForRender(IBlockAccess world, int x, int y, int z, BlockFluidBase block) { - - if (world.getBlockId(x, y, z) == block.blockID) { - - if (world.getBlockId(x, y - block.densityDir, z) == block.blockID) { + public float getFluidHeightForRender(IBlockAccess world, int x, int y, int z, BlockFluidBase block) + { + if (world.getBlockId(x, y, z) == block.blockID) + { + if (world.getBlockId(x, y - block.densityDir, z) == block.blockID) + { return 1; } - if (world.getBlockMetadata(x, y, z) == block.getMaxRenderHeightMeta()) { + + if (world.getBlockMetadata(x, y, z) == block.getMaxRenderHeightMeta()) + { return 0.875F; } } @@ -58,16 +65,16 @@ public class RenderBlockFluid implements ISimpleBlockRenderingHandler { /* ISimpleBlockRenderingHandler */ @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { - - } + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer){} @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - - if (!(block instanceof BlockFluidBase)) { + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) + { + if (!(block instanceof BlockFluidBase)) + { return false; } + Tessellator tessellator = Tessellator.instance; int color = block.colorMultiplier(world, x, y, z); float red = (color >> 16 & 255) / 255.0F; @@ -81,33 +88,42 @@ public class RenderBlockFluid implements ISimpleBlockRenderingHandler { boolean renderBottom = block.shouldSideBeRendered(world, x, y + theFluid.densityDir, z, 0) && world.getBlockId(x, y + theFluid.densityDir, z) != theFluid.blockID; - boolean[] renderSides = new boolean[] { block.shouldSideBeRendered(world, x, y, z - 1, 2), block.shouldSideBeRendered(world, x, y, z + 1, 3), - block.shouldSideBeRendered(world, x - 1, y, z, 4), block.shouldSideBeRendered(world, x + 1, y, z, 5) }; + boolean[] renderSides = new boolean[] + { + block.shouldSideBeRendered(world, x, y, z - 1, 2), + block.shouldSideBeRendered(world, x, y, z + 1, 3), + block.shouldSideBeRendered(world, x - 1, y, z, 4), + block.shouldSideBeRendered(world, x + 1, y, z, 5) + }; - if (!renderTop && !renderBottom && !renderSides[0] && !renderSides[1] && !renderSides[2] && !renderSides[3]) { + if (!renderTop && !renderBottom && !renderSides[0] && !renderSides[1] && !renderSides[2] && !renderSides[3]) + { return false; - } else { + } + else + { boolean rendered = false; - double heightNW, heightSW, heightSE, heightNE; - float flow11 = getFluidHeightForRender(world, x, y, z, theFluid); - if (flow11 != 1) { + if (flow11 != 1) + { float flow00 = getFluidHeightForRender(world, x - 1, y, z - 1, theFluid); - float flow01 = getFluidHeightForRender(world, x - 1, y, z, theFluid); + float flow01 = getFluidHeightForRender(world, x - 1, y, z, theFluid); float flow02 = getFluidHeightForRender(world, x - 1, y, z + 1, theFluid); - float flow10 = getFluidHeightForRender(world, x, y, z - 1, theFluid); - float flow12 = getFluidHeightForRender(world, x, y, z + 1, theFluid); + float flow10 = getFluidHeightForRender(world, x, y, z - 1, theFluid); + float flow12 = getFluidHeightForRender(world, x, y, z + 1, theFluid); float flow20 = getFluidHeightForRender(world, x + 1, y, z - 1, theFluid); - float flow21 = getFluidHeightForRender(world, x + 1, y, z, theFluid); + float flow21 = getFluidHeightForRender(world, x + 1, y, z, theFluid); float flow22 = getFluidHeightForRender(world, x + 1, y, z + 1, theFluid); - heightNW = getFluidHeightAverage(new float[] { flow00, flow01, flow10, flow11 }); - heightSW = getFluidHeightAverage(new float[] { flow01, flow02, flow12, flow11 }); - heightSE = getFluidHeightAverage(new float[] { flow12, flow21, flow22, flow11 }); - heightNE = getFluidHeightAverage(new float[] { flow10, flow20, flow21, flow11 }); - } else { + heightNW = getFluidHeightAverage(new float[]{ flow00, flow01, flow10, flow11 }); + heightSW = getFluidHeightAverage(new float[]{ flow01, flow02, flow12, flow11 }); + heightSE = getFluidHeightAverage(new float[]{ flow12, flow21, flow22, flow11 }); + heightNE = getFluidHeightAverage(new float[]{ flow10, flow20, flow21, flow11 }); + } + else + { heightNW = flow11; heightSW = flow11; heightSE = flow11; @@ -115,16 +131,17 @@ public class RenderBlockFluid implements ISimpleBlockRenderingHandler { } boolean rises = theFluid.densityDir == 1; - - if (renderer.renderAllFaces || renderTop) { + if (renderer.renderAllFaces || renderTop) + { rendered = true; - Icon iconStill = block.getIcon(1, bMeta); float flowDir = (float) BlockFluidBase.getFlowDirection(world, x, y, z); - if (flowDir > -999.0F) { + if (flowDir > -999.0F) + { iconStill = block.getIcon(2, bMeta); } + heightNW -= RENDER_OFFSET; heightSW -= RENDER_OFFSET; heightSE -= RENDER_OFFSET; @@ -132,7 +149,8 @@ public class RenderBlockFluid implements ISimpleBlockRenderingHandler { double u1, u2, u3, u4, v1, v2, v3, v4; - if (flowDir < -999.0F) { + if (flowDir < -999.0F) + { u2 = iconStill.getInterpolatedU(0.0D); v2 = iconStill.getInterpolatedV(0.0D); u1 = u2; @@ -141,7 +159,9 @@ public class RenderBlockFluid implements ISimpleBlockRenderingHandler { v4 = v1; u3 = u4; v3 = v2; - } else { + } + else + { float xFlow = MathHelper.sin(flowDir) * 0.25F; float zFlow = MathHelper.cos(flowDir) * 0.25F; u2 = iconStill.getInterpolatedU(8.0F + (-zFlow - xFlow) * 16.0F); @@ -153,15 +173,19 @@ public class RenderBlockFluid implements ISimpleBlockRenderingHandler { u3 = iconStill.getInterpolatedU(8.0F + (zFlow - xFlow) * 16.0F); v3 = iconStill.getInterpolatedV(8.0F + (-zFlow - xFlow) * 16.0F); } + tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z)); tessellator.setColorOpaque_F(LIGHT_Y_POS * red, LIGHT_Y_POS * green, LIGHT_Y_POS * blue); - if (!rises) { + if (!rises) + { tessellator.addVertexWithUV(x + 0, y + heightNW, z + 0, u2, v2); tessellator.addVertexWithUV(x + 0, y + heightSW, z + 1, u1, v1); tessellator.addVertexWithUV(x + 1, y + heightSE, z + 1, u4, v4); tessellator.addVertexWithUV(x + 1, y + heightNE, z + 0, u3, v3); - } else { + } + else + { tessellator.addVertexWithUV(x + 1, y + 1 - heightNE, z + 0, u3, v3); tessellator.addVertexWithUV(x + 1, y + 1 - heightSE, z + 1, u4, v4); tessellator.addVertexWithUV(x + 0, y + 1 - heightSW, z + 1, u1, v1); @@ -169,40 +193,38 @@ public class RenderBlockFluid implements ISimpleBlockRenderingHandler { } } - if (renderer.renderAllFaces || renderBottom) { + if (renderer.renderAllFaces || renderBottom) + { rendered = true; - tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y - 1, z)); - - if (!rises) { + if (!rises) + { tessellator.setColorOpaque_F(LIGHT_Y_NEG, LIGHT_Y_NEG, LIGHT_Y_NEG); renderer.renderFaceYNeg(block, x, y + RENDER_OFFSET, z, block.getIcon(0, bMeta)); - } else { + } + else + { tessellator.setColorOpaque_F(LIGHT_Y_POS, LIGHT_Y_POS, LIGHT_Y_POS); renderer.renderFaceYPos(block, x, y + RENDER_OFFSET, z, block.getIcon(1, bMeta)); } } - for (int side = 0; side < 4; ++side) { + + for (int side = 0; side < 4; ++side) + { int x2 = x; int z2 = z; - switch (side) { - case 0: - --z2; - break; - case 1: - ++z2; - break; - case 2: - --x2; - break; - case 3: - ++x2; - break; + switch (side) + { + case 0: --z2; break; + case 1: ++z2; break; + case 2: --x2; break; + case 3: ++x2; break; } - Icon iconFlow = block.getIcon(side + 2, bMeta); - if (renderer.renderAllFaces || renderSides[side]) { + Icon iconFlow = block.getIcon(side + 2, bMeta); + if (renderer.renderAllFaces || renderSides[side]) + { rendered = true; double ty1; @@ -212,28 +234,35 @@ public class RenderBlockFluid implements ISimpleBlockRenderingHandler { double tz1; double tz2; - if (side == 0) { + if (side == 0) + { ty1 = heightNW; ty2 = heightNE; tx1 = x; tx2 = x + 1; tz1 = z + RENDER_OFFSET; tz2 = z + RENDER_OFFSET; - } else if (side == 1) { + } + else if (side == 1) + { ty1 = heightSE; ty2 = heightSW; tx1 = x + 1; tx2 = x; tz1 = z + 1 - RENDER_OFFSET; tz2 = z + 1 - RENDER_OFFSET; - } else if (side == 2) { + } + else if (side == 2) + { ty1 = heightSW; ty2 = heightNW; tx1 = x + RENDER_OFFSET; tx2 = x + RENDER_OFFSET; tz1 = z + 1; tz2 = z; - } else { + } + else + { ty1 = heightNE; ty2 = heightSE; tx1 = x + 1 - RENDER_OFFSET; @@ -241,6 +270,7 @@ public class RenderBlockFluid implements ISimpleBlockRenderingHandler { tz1 = z; tz2 = z + 1; } + float u1Flow = iconFlow.getInterpolatedU(0.0D); float u2Flow = iconFlow.getInterpolatedU(8.0D); float v1Flow = iconFlow.getInterpolatedV((1.0D - ty1) * 16.0D * 0.5D); @@ -249,19 +279,26 @@ public class RenderBlockFluid implements ISimpleBlockRenderingHandler { tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x2, y, z2)); float sideLighting = 1.0F; - if (side < 2) { + if (side < 2) + { sideLighting = LIGHT_XZ_NEG; - } else { + } + else + { sideLighting = LIGHT_XZ_POS; } + tessellator.setColorOpaque_F(LIGHT_Y_POS * sideLighting * red, LIGHT_Y_POS * sideLighting * green, LIGHT_Y_POS * sideLighting * blue); - if (!rises) { + if (!rises) + { tessellator.addVertexWithUV(tx1, y + ty1, tz1, u1Flow, v1Flow); tessellator.addVertexWithUV(tx2, y + ty2, tz2, u2Flow, v2Flow); tessellator.addVertexWithUV(tx2, y + 0, tz2, u2Flow, v3Flow); tessellator.addVertexWithUV(tx1, y + 0, tz1, u1Flow, v3Flow); - } else { + } + else + { tessellator.addVertexWithUV(tx1, y + 1 - 0, tz1, u1Flow, v3Flow); tessellator.addVertexWithUV(tx2, y + 1 - 0, tz2, u2Flow, v3Flow); tessellator.addVertexWithUV(tx2, y + 1 - ty2, tz2, u2Flow, v2Flow); @@ -276,15 +313,10 @@ public class RenderBlockFluid implements ISimpleBlockRenderingHandler { } @Override - public boolean shouldRender3DInInventory() { - - return false; - } - + public boolean shouldRender3DInInventory(){ return false; } @Override - public int getRenderId() { - + public int getRenderId() + { return FluidRegistry.renderIdFluid; } - } diff --git a/common/net/minecraftforge/fluids/TileFluidHandler.java b/common/net/minecraftforge/fluids/TileFluidHandler.java index 988c80f66..b39948624 100644 --- a/common/net/minecraftforge/fluids/TileFluidHandler.java +++ b/common/net/minecraftforge/fluids/TileFluidHandler.java @@ -11,62 +11,62 @@ import net.minecraftforge.common.ForgeDirection; * @author King Lemming * */ -public class TileFluidHandler extends TileEntity implements IFluidHandler { - +public class TileFluidHandler extends TileEntity implements IFluidHandler +{ protected FluidTank tank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME); @Override - public void readFromNBT(NBTTagCompound tag) { - + public void readFromNBT(NBTTagCompound tag) + { super.readFromNBT(tag); tank.writeToNBT(tag); } @Override - public void writeToNBT(NBTTagCompound tag) { - + public void writeToNBT(NBTTagCompound tag) + { super.writeToNBT(tag); tank.readFromNBT(tag); } /* IFluidHandler */ @Override - public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { - + public int fill(ForgeDirection from, FluidStack resource, boolean doFill) + { return tank.fill(resource, doFill); } @Override - public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { - - if (resource == null || !resource.isFluidEqual(tank.getFluid())) { + public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) + { + if (resource == null || !resource.isFluidEqual(tank.getFluid())) + { return null; } return tank.drain(resource.amount, doDrain); } @Override - public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { - + public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) + { return tank.drain(maxDrain, doDrain); } @Override - public boolean canFill(ForgeDirection from, Fluid fluid) { - + public boolean canFill(ForgeDirection from, Fluid fluid) + { return true; } @Override - public boolean canDrain(ForgeDirection from, Fluid fluid) { - + public boolean canDrain(ForgeDirection from, Fluid fluid) + { return true; } @Override - public FluidTankInfo[] getTankInfo(ForgeDirection from) { - + public FluidTankInfo[] getTankInfo(ForgeDirection from) + { return new FluidTankInfo[] { tank.getInfo() }; } - } From ee70b214600d48848af79b90a1d3a43985df8eb0 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 17 Jul 2013 12:38:53 -0700 Subject: [PATCH 091/146] MinecraftForge/FML@10b16d32da4b7c32b15e69cf1c636505ebbe2540 Use json 2.9.1 nightly for OSX in release json like vanilla does. --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index 3f21a2c1b..10b16d32d 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 3f21a2c1b413e591f61f2906c3adbadd9c5b09e3 +Subproject commit 10b16d32da4b7c32b15e69cf1c636505ebbe2540 From 8c3ebc7f87b4183d84e2cae899f927665e29f84d Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 21 Jul 2013 11:01:38 -0700 Subject: [PATCH 092/146] Remove SideOnly(Client) in IBlockAccess.isAirBlock --- .../net/minecraft/world/ChunkCache.java.patch | 11 +++++++++-- .../net/minecraft/world/IBlockAccess.java.patch | 11 ++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/patches/minecraft/net/minecraft/world/ChunkCache.java.patch b/patches/minecraft/net/minecraft/world/ChunkCache.java.patch index 8bf965f66..e088306c9 100644 --- a/patches/minecraft/net/minecraft/world/ChunkCache.java.patch +++ b/patches/minecraft/net/minecraft/world/ChunkCache.java.patch @@ -49,7 +49,14 @@ } /** -@@ -325,8 +338,8 @@ +@@ -318,15 +331,13 @@ + return this.worldObj.getWorldVec3Pool(); + } + +- @SideOnly(Side.CLIENT) +- + /** + * Returns true if the block at the specified coordinates is empty */ public boolean isAirBlock(int par1, int par2, int par3) { @@ -60,7 +67,7 @@ } @SideOnly(Side.CLIENT) -@@ -449,4 +462,22 @@ +@@ -449,4 +460,22 @@ int i1 = this.getBlockId(par1, par2, par3); return i1 == 0 ? 0 : Block.blocksList[i1].isProvidingStrongPower(this, par1, par2, par3, par4); } diff --git a/patches/minecraft/net/minecraft/world/IBlockAccess.java.patch b/patches/minecraft/net/minecraft/world/IBlockAccess.java.patch index eddd893e4..a38857bb6 100644 --- a/patches/minecraft/net/minecraft/world/IBlockAccess.java.patch +++ b/patches/minecraft/net/minecraft/world/IBlockAccess.java.patch @@ -8,7 +8,16 @@ public interface IBlockAccess { -@@ -103,4 +104,16 @@ +@@ -59,8 +60,6 @@ + */ + boolean isBlockNormalCube(int i, int j, int k); + +- @SideOnly(Side.CLIENT) +- + /** + * Returns true if the block at the specified coordinates is empty + */ +@@ -103,4 +102,16 @@ * Is this block powering in the specified direction Args: x, y, z, direction */ int isBlockProvidingPowerTo(int i, int j, int k, int l); From b6d543f15e95636137183e544dc6465892e1c5c6 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 22 Jul 2013 15:19:35 -0700 Subject: [PATCH 093/146] Re-added deprecated liquids system. To be removed next major MC versions after issues with Fluids are fixed. (reverse-merged from commit 9b5208fa308f22c24e295ce3be38dcafea2857ea) This WILL be removed and should not be developed against aside for a temporary 1.6 release. --- .../minecraftforge/liquids/IBlockLiquid.java | 59 ++++ .../net/minecraftforge/liquids/ILiquid.java | 36 +++ .../minecraftforge/liquids/ILiquidTank.java | 45 +++ .../liquids/ITankContainer.java | 56 ++++ .../liquids/LiquidContainerData.java | 31 +++ .../liquids/LiquidContainerRegistry.java | 131 +++++++++ .../liquids/LiquidDictionary.java | 124 +++++++++ .../minecraftforge/liquids/LiquidEvent.java | 96 +++++++ .../minecraftforge/liquids/LiquidStack.java | 257 ++++++++++++++++++ .../minecraftforge/liquids/LiquidTank.java | 181 ++++++++++++ 10 files changed, 1016 insertions(+) create mode 100644 common/net/minecraftforge/liquids/IBlockLiquid.java create mode 100644 common/net/minecraftforge/liquids/ILiquid.java create mode 100644 common/net/minecraftforge/liquids/ILiquidTank.java create mode 100644 common/net/minecraftforge/liquids/ITankContainer.java create mode 100644 common/net/minecraftforge/liquids/LiquidContainerData.java create mode 100644 common/net/minecraftforge/liquids/LiquidContainerRegistry.java create mode 100644 common/net/minecraftforge/liquids/LiquidDictionary.java create mode 100644 common/net/minecraftforge/liquids/LiquidEvent.java create mode 100644 common/net/minecraftforge/liquids/LiquidStack.java create mode 100644 common/net/minecraftforge/liquids/LiquidTank.java diff --git a/common/net/minecraftforge/liquids/IBlockLiquid.java b/common/net/minecraftforge/liquids/IBlockLiquid.java new file mode 100644 index 000000000..9569e6bd5 --- /dev/null +++ b/common/net/minecraftforge/liquids/IBlockLiquid.java @@ -0,0 +1,59 @@ +package net.minecraftforge.liquids; + +import net.minecraft.nbt.NBTTagCompound; + +/** + * Implementors of this interface are a liquid which may receive a block implementation and can be placed in the world. + * + * @author cpw + * + */ +@Deprecated //See new net.minecraftforge.fluids +public interface IBlockLiquid extends ILiquid { + /** + * Controls the type of block that is generated by this IBlockLiquid + * + */ + public enum BlockType { + /** + * No block. Completeness really. + */ + NONE, + /** + * Vanilla style block, up to 8 flowing states. May be able to generate new sources. + */ + VANILLA, + /** + * Finite liquid style, uses cellular automata to model flowing behaviour. + */ + FINITE; + } + + /** + * Can this liquid, when placed in a specific configuration, generate new source blocks of the liquid. + * @return if this liquid will generate new sources + */ + public boolean willGenerateSources(); + + /** + * @return the distance this liquid will flow if placed in the world. Maximum of 7 levels for vanilla types. + */ + public int getFlowDistance(); + + /** + * @return the RGB rendering for this liquid + */ + public byte[] getLiquidRGB(); + + /** + * Get the texture file for rendering the liquid + * @return the texture file for this liquid + */ + public String getLiquidBlockTextureFile(); + /** + * Custom properties of the liquid. + * @return a compound tag of custom liquid properties + */ + public NBTTagCompound getLiquidProperties(); + +} diff --git a/common/net/minecraftforge/liquids/ILiquid.java b/common/net/minecraftforge/liquids/ILiquid.java new file mode 100644 index 000000000..f7943b2ff --- /dev/null +++ b/common/net/minecraftforge/liquids/ILiquid.java @@ -0,0 +1,36 @@ +/** + * Copyright (c) SpaceToad, 2011 + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ + +package net.minecraftforge.liquids; + +/** + * Liquids implement this interface + * + */ +@Deprecated //See new net.minecraftforge.fluids +public interface ILiquid { + + /** + * The itemId of the liquid item + * @return the itemId + */ + public int stillLiquidId(); + + /** + * Is this liquid a metadata based liquid + * @return if this is a metadata liquid + */ + public boolean isMetaSensitive(); + + /** + * The item metadata of the liquid + * @return the metadata of the liquid + */ + public int stillLiquidMeta(); +} diff --git a/common/net/minecraftforge/liquids/ILiquidTank.java b/common/net/minecraftforge/liquids/ILiquidTank.java new file mode 100644 index 000000000..7bbb4c6d2 --- /dev/null +++ b/common/net/minecraftforge/liquids/ILiquidTank.java @@ -0,0 +1,45 @@ +package net.minecraftforge.liquids; + +/** + * A tank is the unit of interaction with liquid inventories. + * + * @author cpw + */ +@Deprecated //See new net.minecraftforge.fluids +public interface ILiquidTank { + + /** + * @return LiquidStack representing the liquid contained in the tank, null if empty. + */ + LiquidStack getLiquid(); + + /** + * @return capacity of this tank + */ + int getCapacity(); + + /** + * + * @param resource + * @param doFill + * @return Amount of liquid used for filling. + */ + int fill(LiquidStack resource, boolean doFill); + /** + * + * @param maxDrain + * @param doDrain + * @return Null if nothing was drained, otherwise a LiquidStack containing the drained. + */ + LiquidStack drain(int maxDrain, boolean doDrain); + + /** + * Positive values indicate a positive liquid pressure (liquid wants to leave this tank) + * Negative values indicate a negative liquid pressure (liquid wants to fill this tank) + * Zero indicates no pressure + * + * @return a number indicating tank pressure + */ + public int getTankPressure(); + +} diff --git a/common/net/minecraftforge/liquids/ITankContainer.java b/common/net/minecraftforge/liquids/ITankContainer.java new file mode 100644 index 000000000..d9ace05ce --- /dev/null +++ b/common/net/minecraftforge/liquids/ITankContainer.java @@ -0,0 +1,56 @@ +package net.minecraftforge.liquids; + +import net.minecraftforge.common.ForgeDirection; +@Deprecated //See new net.minecraftforge.fluids +public interface ITankContainer { + + /** + * Fills liquid into internal tanks, distribution is left to the ITankContainer. + * @param from Orientation the liquid is pumped in from. + * @param resource LiquidStack representing the maximum amount of liquid filled into the ITankContainer + * @param doFill If false filling will only be simulated. + * @return Amount of resource that was filled into internal tanks. + */ + int fill(ForgeDirection from, LiquidStack resource, boolean doFill); + /** + * Fills liquid into the specified internal tank. + * @param tankIndex the index of the tank to fill + * @param resource LiquidStack representing the maximum amount of liquid filled into the ITankContainer + * @param doFill If false filling will only be simulated. + * @return Amount of resource that was filled into internal tanks. + */ + int fill(int tankIndex, LiquidStack resource, boolean doFill); + + /** + * Drains liquid out of internal tanks, distribution is left to the ITankContainer. + * @param from Orientation the liquid is drained to. + * @param maxDrain Maximum amount of liquid to drain. + * @param doDrain If false draining will only be simulated. + * @return LiquidStack representing the liquid and amount actually drained from the ITankContainer + */ + LiquidStack drain(ForgeDirection from, int maxDrain, boolean doDrain); + /** + * Drains liquid out of the specified internal tank. + * @param tankIndex the index of the tank to drain + * @param maxDrain Maximum amount of liquid to drain. + * @param doDrain If false draining will only be simulated. + * @return LiquidStack representing the liquid and amount actually drained from the ITankContainer + */ + LiquidStack drain(int tankIndex, int maxDrain, boolean doDrain); + + /** + * @param direction tank side: UNKNOWN for default tank set + * @return Array of {@link LiquidTank}s contained in this ITankContainer for this direction + */ + ILiquidTank[] getTanks(ForgeDirection direction); + + /** + * Return the tank that this tank container desired to be used for the specified liquid type from the specified direction + * + * @param direction the direction + * @param type the liquid type, null is always an acceptable value + * @return a tank or null for no such tank + */ + ILiquidTank getTank(ForgeDirection direction, LiquidStack type); + +} diff --git a/common/net/minecraftforge/liquids/LiquidContainerData.java b/common/net/minecraftforge/liquids/LiquidContainerData.java new file mode 100644 index 000000000..3b9e2fbc9 --- /dev/null +++ b/common/net/minecraftforge/liquids/LiquidContainerData.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) SpaceToad, 2011 + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ + +package net.minecraftforge.liquids; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +@Deprecated //See new net.minecraftforge.fluids +public class LiquidContainerData { + + public final LiquidStack stillLiquid; + public final ItemStack filled; + public final ItemStack container; + + + public LiquidContainerData(LiquidStack stillLiquid, ItemStack filled, ItemStack container) { + this.stillLiquid = stillLiquid; + this.filled = filled; + this.container = container; + + if(stillLiquid == null || filled == null || container == null) + throw new RuntimeException("stillLiquid, filled, or container is null, this is an error"); + } + +} diff --git a/common/net/minecraftforge/liquids/LiquidContainerRegistry.java b/common/net/minecraftforge/liquids/LiquidContainerRegistry.java new file mode 100644 index 000000000..ea4b5de8e --- /dev/null +++ b/common/net/minecraftforge/liquids/LiquidContainerRegistry.java @@ -0,0 +1,131 @@ + +package net.minecraftforge.liquids; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +@Deprecated //See new net.minecraftforge.fluids +public class LiquidContainerRegistry +{ + public static final int BUCKET_VOLUME = 1000; + public static final ItemStack EMPTY_BUCKET = new ItemStack(Item.bucketEmpty); + + private static Map mapFilledItemFromLiquid = new HashMap(); + private static Map mapLiquidFromFilledItem = new HashMap(); + private static Set setContainerValidation = new HashSet(); + private static Set setLiquidValidation = new HashSet(); + private static ArrayList liquids = new ArrayList(); + + /** + * Default registrations + */ + static + { + registerLiquid(new LiquidContainerData(new LiquidStack(Block.waterStill, LiquidContainerRegistry.BUCKET_VOLUME), new ItemStack(Item.bucketWater), new ItemStack(Item.bucketEmpty))); + registerLiquid(new LiquidContainerData(new LiquidStack(Block.lavaStill, LiquidContainerRegistry.BUCKET_VOLUME), new ItemStack(Item.bucketLava), new ItemStack(Item.bucketEmpty))); + registerLiquid(new LiquidContainerData(new LiquidStack(Block.waterStill, LiquidContainerRegistry.BUCKET_VOLUME), new ItemStack(Item.potion), new ItemStack(Item.glassBottle))); + // registerLiquid(new LiquidContainerData(new LiquidStack(Item.bucketMilk, LiquidContainerRegistry.BUCKET_VOLUME), new ItemStack(Item.bucketMilk), new ItemStack(Item.bucketEmpty))); + } + + /** + * To register a container with a non-bucket size, the LiquidContainerData entry simply needs to use a size other than LiquidManager.BUCKET_VOLUME + */ + public static void registerLiquid(LiquidContainerData data) + { + mapFilledItemFromLiquid.put(Arrays.asList(data.container.itemID, data.container.getItemDamage(), data.stillLiquid.itemID, data.stillLiquid.itemMeta), data); + mapLiquidFromFilledItem.put(Arrays.asList(data.filled.itemID, data.filled.getItemDamage()), data); + setContainerValidation.add(Arrays.asList(data.container.itemID, data.container.getItemDamage())); + setLiquidValidation.add(Arrays.asList(data.stillLiquid.itemID, data.stillLiquid.itemMeta)); + + liquids.add(data); + } + + public static LiquidStack getLiquidForFilledItem(ItemStack filledContainer) + { + if (filledContainer == null) + { + return null; + } + + LiquidContainerData ret = mapLiquidFromFilledItem.get(Arrays.asList(filledContainer.itemID, filledContainer.getItemDamage())); + return ret == null ? null : ret.stillLiquid.copy(); + } + + public static ItemStack fillLiquidContainer(LiquidStack liquid, ItemStack emptyContainer) + { + if (emptyContainer == null || liquid == null) + { + return null; + } + + LiquidContainerData ret = mapFilledItemFromLiquid.get(Arrays.asList(emptyContainer.itemID, emptyContainer.getItemDamage(), liquid.itemID, liquid.itemMeta)); + + if (ret != null && liquid.amount >= ret.stillLiquid.amount) + { + return ret.filled.copy(); + } + + return null; + } + + public static boolean containsLiquid(ItemStack filledContainer, LiquidStack liquid) + { + if (filledContainer == null || liquid == null) + { + return false; + } + + LiquidContainerData ret = mapLiquidFromFilledItem.get(Arrays.asList(filledContainer.itemID, filledContainer.getItemDamage())); + + return ret != null && ret.stillLiquid.isLiquidEqual(liquid); + } + + public static boolean isBucket(ItemStack container) + { + if (container == null) + { + return false; + } + + if (container.isItemEqual(EMPTY_BUCKET)) + { + return true; + } + + LiquidContainerData ret = mapLiquidFromFilledItem.get(Arrays.asList(container.itemID, container.getItemDamage())); + return ret != null && ret.container.isItemEqual(EMPTY_BUCKET); + } + + public static boolean isContainer(ItemStack container) + { + return isEmptyContainer(container) || isFilledContainer(container); + } + + public static boolean isEmptyContainer(ItemStack emptyContainer) + { + return emptyContainer != null && setContainerValidation.contains(Arrays.asList(emptyContainer.itemID, emptyContainer.getItemDamage())); + } + + public static boolean isFilledContainer(ItemStack filledContainer) + { + return filledContainer != null && getLiquidForFilledItem(filledContainer) != null; + } + + public static boolean isLiquid(ItemStack item) + { + return item != null && setLiquidValidation.contains(Arrays.asList(item.itemID, item.getItemDamage())); + } + + public static LiquidContainerData[] getRegisteredLiquidContainerData() + { + return liquids.toArray(new LiquidContainerData[liquids.size()]); + } +} diff --git a/common/net/minecraftforge/liquids/LiquidDictionary.java b/common/net/minecraftforge/liquids/LiquidDictionary.java new file mode 100644 index 000000000..a7a5925af --- /dev/null +++ b/common/net/minecraftforge/liquids/LiquidDictionary.java @@ -0,0 +1,124 @@ +package net.minecraftforge.liquids; + +import java.util.HashMap; +import java.util.Map; + +import net.minecraft.block.Block; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.Event; + +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; +import com.google.common.collect.ImmutableMap; + +/** + * When creating liquids you should register them with this class. + * + * @author CovertJaguar + */ +@Deprecated //See new net.minecraftforge.fluids +public abstract class LiquidDictionary +{ + + private static BiMap liquids = HashBiMap.create(); + + /** + * When creating liquids you should call this function. + * + * Upon passing it a name and liquid item it will return either + * a preexisting implementation of that liquid or the liquid passed in. + * + * + * @param name the name of the liquid + * @param liquid the liquid to use if one doesn't exist + * @return the matching liquid stack + */ + public static LiquidStack getOrCreateLiquid(String name, LiquidStack liquid) + { + if (liquid == null) + { + throw new NullPointerException("You cannot register a null LiquidStack"); + } + LiquidStack existing = liquids.get(name); + if(existing != null) { + return existing.copy(); + } + liquids.put(name, liquid.copy()); + + MinecraftForge.EVENT_BUS.post(new LiquidRegisterEvent(name, liquid)); + return liquid; + } + + /** + * Returns the liquid matching the name, + * if such a liquid exists. + * + * Can return null. + * + * @param name the name of the liquid + * @param amount the amout of liquid + * @return a liquidstack for the requested liquid + */ + public static LiquidStack getLiquid(String name, int amount) + { + LiquidStack liquid = liquids.get(name); + if(liquid == null) + return null; + + liquid = liquid.copy(); + liquid.amount = amount; + return liquid; + } + + public static LiquidStack getCanonicalLiquid(String name) + { + return liquids.get(name); + } + /** + * Get an immutable list of the liquids defined + * + * @return the defined liquids + */ + public static Map getLiquids() + { + return ImmutableMap.copyOf(liquids); + } + /** + * Fired when a new liquid is created + * + */ + public static class LiquidRegisterEvent extends Event + { + public final String Name; + public final LiquidStack Liquid; + + public LiquidRegisterEvent(String name, LiquidStack liquid) + { + this.Name = name; + this.Liquid = liquid.copy(); + } + } + + static + { + getOrCreateLiquid("Water", new LiquidStack(Block.waterStill, LiquidContainerRegistry.BUCKET_VOLUME)); + getOrCreateLiquid("Lava", new LiquidStack(Block.lavaStill, LiquidContainerRegistry.BUCKET_VOLUME)); + } + + public static String findLiquidName(LiquidStack reference) + { + if (reference != null) + { + return liquids.inverse().get(reference); + } + else + { + return null; + } + } + + public static LiquidStack getCanonicalLiquid(LiquidStack liquidStack) + { + return liquids.get(liquids.inverse().get(liquidStack)); + } +} diff --git a/common/net/minecraftforge/liquids/LiquidEvent.java b/common/net/minecraftforge/liquids/LiquidEvent.java new file mode 100644 index 000000000..1667f54a3 --- /dev/null +++ b/common/net/minecraftforge/liquids/LiquidEvent.java @@ -0,0 +1,96 @@ +package net.minecraftforge.liquids; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.Event; +@Deprecated //See new net.minecraftforge.fluids +public class LiquidEvent extends Event { + public final LiquidStack liquid; + public final int x; + public final int y; + public final int z; + public final World world; + + public LiquidEvent(LiquidStack liquid, World world, int x, int y, int z) + { + this.liquid = liquid; + this.world = world; + this.x = x; + this.y = y; + this.z = z; + } + + /** + * Mods should fire this event when they move liquids around (pipe networks etc) + * + * @author cpw + * + */ + public static class LiquidMotionEvent extends LiquidEvent + { + public LiquidMotionEvent(LiquidStack liquid, World world, int x, int y, int z) + { + super(liquid, world, x, y, z); + } + } + + /** + * Mods should fire this event when a liquid is {@link ILiquidTank#fill(LiquidStack, boolean)} their tank implementation. + * {@link LiquidTank} does. + * + * @author cpw + * + */ + public static class LiquidFillingEvent extends LiquidEvent + { + public final ILiquidTank tank; + + public LiquidFillingEvent(LiquidStack liquid, World world, int x, int y, int z, ILiquidTank tank) + { + super(liquid, world, x, y, z); + this.tank = tank; + } + } + + /** + * Mods should fire this event when a liquid is {@link ILiquidTank#drain(int, boolean)} from their tank. + * @author cpw + * + */ + public static class LiquidDrainingEvent extends LiquidEvent + { + public final ILiquidTank tank; + + public LiquidDrainingEvent(LiquidStack liquid, World world, int x, int y, int z, ILiquidTank tank) + { + super(liquid, world, x, y, z); + this.tank = tank; + } + } + + + /** + * Mods should fire this event when a liquid "spills", for example, if a block containing liquid is broken. + * + * @author cpw + * + */ + public static class LiquidSpilledEvent extends LiquidEvent + { + public LiquidSpilledEvent(LiquidStack liquid, World world, int x, int y, int z) + { + super(liquid, world, x, y, z); + } + } + + /** + * A handy shortcut for firing the various liquid events + * + * @param event + */ + public static final void fireEvent(LiquidEvent event) + { + MinecraftForge.EVENT_BUS.post(event); + } +} diff --git a/common/net/minecraftforge/liquids/LiquidStack.java b/common/net/minecraftforge/liquids/LiquidStack.java new file mode 100644 index 000000000..881a10b6a --- /dev/null +++ b/common/net/minecraftforge/liquids/LiquidStack.java @@ -0,0 +1,257 @@ +package net.minecraftforge.liquids; + +import static cpw.mods.fml.relauncher.Side.CLIENT; + +import com.google.common.base.Objects; + +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.block.BlockFluid; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.Icon; + +/** + * ItemStack substitute for liquids + * Things of note: they are equal if their items are equal. Amount does NOT matter for java equals() testing + *
+ * The canonical liquidstack is probably the only one that has a lot of the rendering data on it. Use {@link #canonical()} + * to get it. + * + * @author SirSengir + */ +@Deprecated //See new net.minecraftforge.fluids +public class LiquidStack +{ + public final int itemID; + public int amount; + public final int itemMeta; + public NBTTagCompound extra; + + public LiquidStack(int itemID, int amount) { this(itemID, amount, 0); } + public LiquidStack(Item item, int amount) { this(item.itemID, amount, 0); } + public LiquidStack(Block block, int amount) { this(block.blockID, amount, 0); } + + public LiquidStack(int itemID, int amount, int itemDamage) + { + this.itemID = itemID; + this.amount = amount; + this.itemMeta = itemDamage; + } + + public LiquidStack(int itemID, int amount, int itemDamage, NBTTagCompound nbt) + { + this(itemID, amount, itemDamage); + if (nbt != null) + { + extra = (NBTTagCompound)nbt.copy(); + } + } + + public NBTTagCompound writeToNBT(NBTTagCompound nbt) + { + nbt.setInteger("Amount", amount); + nbt.setShort("Id", (short)itemID); + nbt.setShort("Meta", (short)itemMeta); + String name = LiquidDictionary.findLiquidName(this); + if(name != null) + { + nbt.setString("LiquidName", name); + } + if (extra != null) + { + nbt.setTag("extra", extra); + } + return nbt; + } + + /** + * @return A copy of this LiquidStack + */ + public LiquidStack copy() + { + return new LiquidStack(itemID, amount, itemMeta, extra); + } + + /** + * @param other + * @return true if this LiquidStack contains the same liquid as the one passed in. + */ + public boolean isLiquidEqual(LiquidStack other) + { + return other != null && itemID == other.itemID && itemMeta == other.itemMeta && (extra == null ? other.extra == null : extra.equals(other.extra)); + } + + /** + * @param other + * @return true if this LiquidStack contains the other liquid (liquids are equal and amount >= other.amount). + */ + public boolean containsLiquid(LiquidStack other) + { + return isLiquidEqual(other) && amount >= other.amount; + } + + /** + * @param other ItemStack containing liquids. + * @return true if this LiquidStack contains the same liquid as the one passed in. + */ + public boolean isLiquidEqual(ItemStack other) + { + if (other == null) + { + return false; + } + + if (itemID == other.itemID && itemMeta == other.getItemDamage()) + { + return true; + } + + return isLiquidEqual(LiquidContainerRegistry.getLiquidForFilledItem(other)); + } + + /** + * @return ItemStack representation of this LiquidStack + */ + public ItemStack asItemStack() + { + ItemStack stack = new ItemStack(itemID, 1, itemMeta); + if (extra != null) + { + stack.stackTagCompound = (NBTTagCompound)extra.copy(); + } + return stack; + } + + /** + * Reads a liquid stack from the passed nbttagcompound and returns it. + * + * @param nbt + * @return the liquid stack + */ + public static LiquidStack loadLiquidStackFromNBT(NBTTagCompound nbt) + { + if (nbt == null) + { + return null; + } + String liquidName = nbt.getString("LiquidName"); + int itemID = nbt.getShort("Id"); + int itemMeta = nbt.getShort("Meta"); + LiquidStack liquid = LiquidDictionary.getCanonicalLiquid(liquidName); + if(liquid != null) { + itemID = liquid.itemID; + itemMeta = liquid.itemMeta; + } + // if the item is not existent, and no liquid dictionary is found, null returns + else if (Item.itemsList[itemID] == null) + { + return null; + } + int amount = nbt.getInteger("Amount"); + LiquidStack liquidstack = new LiquidStack(itemID, amount, itemMeta); + if (nbt.hasKey("extra")) + { + liquidstack.extra = nbt.getCompoundTag("extra"); + } + return liquidstack.itemID == 0 ? null : liquidstack; + } + + private String textureSheet = "/terrain.png"; + + /** + * Return the textureSheet used for this liquid stack's texture Icon + * Defaults to '/terrain.png' + * + * See {@link #getRenderingIcon()} for the actual icon + * + * @return The texture sheet + */ + public String getTextureSheet() + { + return textureSheet; + } + + /** + * Set the texture sheet for this icon (usually /terrain.png or /gui/items.png) + * + * See also the {@link #setRenderingIcon(Icon)} for the icon itself + * + * @param textureSheet + * @return the liquid stack + */ + public LiquidStack setTextureSheet(String textureSheet) + { + this.textureSheet = textureSheet; + return this; + } + @SideOnly(CLIENT) + private Icon renderingIcon; + + /** + * Get the rendering icon for this liquid stack, for presentation in the world or in GUIs. + * Defaults to handling water and lava, and returns the set rendering icon otherwise. + * + * See {@link #getTextureSheet()} to get the texture sheet this icon is associated with + * + * @return The icon for rendering this liquid + */ + @SideOnly(CLIENT) + public Icon getRenderingIcon() + { + if (itemID == Block.waterStill.blockID) + { + return BlockFluid.func_94424_b("water"); + } + else if (itemID == Block.lavaStill.blockID) + { + return BlockFluid.func_94424_b("lava"); + } + return renderingIcon; + } + + /** + * Set the icon for rendering this liquid + * It should be refreshed whenever textures are refreshed. + * + * See also {@link #setTextureSheet(String)} for setting the sheet this icon is associated with + * + * @param icon The icon to render + * @return The liquid stack + */ + @SideOnly(CLIENT) + public LiquidStack setRenderingIcon(Icon icon) + { + this.renderingIcon = icon; + return this; + } + + @Override + public final int hashCode() + { + return 31 * itemMeta + itemID; + } + + @Override + public final boolean equals(Object ob) + { + if (ob instanceof LiquidStack) + { + LiquidStack ls = (LiquidStack)ob; + return ls.itemID == itemID && ls.itemMeta == itemMeta && (extra == null ? ls.extra == null : extra.equals(ls.extra)); + } + return false; + } + + + /** + * Get the canonical version of this liquid stack (will contain things like icons and texturesheets) + * @return The canonical liquidstack + */ + public LiquidStack canonical() + { + return LiquidDictionary.getCanonicalLiquid(this); + } +} diff --git a/common/net/minecraftforge/liquids/LiquidTank.java b/common/net/minecraftforge/liquids/LiquidTank.java new file mode 100644 index 000000000..6832ef695 --- /dev/null +++ b/common/net/minecraftforge/liquids/LiquidTank.java @@ -0,0 +1,181 @@ +package net.minecraftforge.liquids; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; + +/** + * Reference implementation of ILiquidTank. Use this or implement your own. + */ +@Deprecated //See new net.minecraftforge.fluids +public class LiquidTank implements ILiquidTank { + private LiquidStack liquid; + private int capacity; + private int tankPressure; + private TileEntity tile; + + public LiquidTank(int capacity) + { + this(null, capacity); + } + + public LiquidTank(int liquidId, int quantity, int capacity) + { + this(new LiquidStack(liquidId, quantity), capacity); + } + + public LiquidTank(int liquidId, int quantity, int capacity, TileEntity tile) + { + this(liquidId, quantity, capacity); + this.tile = tile; + } + + public LiquidTank(LiquidStack liquid, int capacity) + { + this.liquid = liquid; + this.capacity = capacity; + } + + public LiquidTank(LiquidStack liquid, int capacity, TileEntity tile) + { + this(liquid, capacity); + this.tile = tile; + } + + @Override + public LiquidStack getLiquid() + { + return this.liquid; + } + + @Override + public int getCapacity() + { + return this.capacity; + } + + public void setLiquid(LiquidStack liquid) + { + this.liquid = liquid; + } + + public void setCapacity(int capacity) + { + this.capacity = capacity; + } + + @Override + public int fill(LiquidStack resource, boolean doFill) + { + if (resource == null || resource.itemID <= 0) return 0; + + if (liquid == null || liquid.itemID <= 0) + { + if (resource.amount <= capacity) + { + if (doFill) this.liquid = resource.copy(); + return resource.amount; + } + else + { + if (doFill) + { + this.liquid = resource.copy(); + this.liquid.amount = capacity; + if (tile != null) + LiquidEvent.fireEvent(new LiquidEvent.LiquidFillingEvent(liquid, tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord, this)); + } + return capacity; + } + } + + if (!liquid.isLiquidEqual(resource)) return 0; + + int space = capacity - liquid.amount; + if (resource.amount <= space) + { + if (doFill) this.liquid.amount += resource.amount; + return resource.amount; + } + else + { + + if (doFill) this.liquid.amount = capacity; + return space; + } + + } + + @Override + public LiquidStack drain(int maxDrain, boolean doDrain) + { + if (liquid == null || liquid.itemID <= 0) return null; + if (liquid.amount <= 0) return null; + + int used = maxDrain; + if (liquid.amount < used) used = liquid.amount; + + if (doDrain) + { + liquid.amount -= used; + } + + LiquidStack drained = new LiquidStack(liquid.itemID, used, liquid.itemMeta); + + // Reset liquid if emptied + if (liquid.amount <= 0) liquid = null; + + if (doDrain && tile != null) + LiquidEvent.fireEvent(new LiquidEvent.LiquidDrainingEvent(drained, tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord, this)); + + return drained; + } + + @Override + public int getTankPressure() + { + return tankPressure; + } + + public void setTankPressure(int pressure) + { + this.tankPressure = pressure; + } + + + public String getLiquidName() + { + return liquid!= null ? LiquidDictionary.findLiquidName(liquid) : null; + } + + public boolean containsValidLiquid() + { + return LiquidDictionary.findLiquidName(liquid) != null; + } + + + public NBTTagCompound writeToNBT(NBTTagCompound nbt) + { + if (containsValidLiquid()) + { + liquid.writeToNBT(nbt); + } + else + { + nbt.setString("emptyTank", ""); + } + return nbt; + } + + public LiquidTank readFromNBT(NBTTagCompound nbt) + { + if (!nbt.hasKey("emptyTank")) + { + LiquidStack liquid = LiquidStack.loadLiquidStackFromNBT(nbt); + if (liquid != null) + { + setLiquid(liquid); + } + } + return this; + } +} From c9af365d44ce07363f3025e192104c5f089ea747 Mon Sep 17 00:00:00 2001 From: copyboy Date: Wed, 24 Jul 2013 22:12:38 +0200 Subject: [PATCH 094/146] Fix getArmorTexture by passing it the subtype --- .../client/ForgeHooksClient.java | 8 ++++++- .../renderer/entity/RenderBiped.java.patch | 2 +- .../net/minecraft/item/Item.java.patch | 22 ++++++++++++++++++- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/client/net/minecraftforge/client/ForgeHooksClient.java b/client/net/minecraftforge/client/ForgeHooksClient.java index 8e7ea312d..bb922722c 100644 --- a/client/net/minecraftforge/client/ForgeHooksClient.java +++ b/client/net/minecraftforge/client/ForgeHooksClient.java @@ -54,9 +54,15 @@ public class ForgeHooksClient return FMLClientHandler.instance().getClient().renderEngine; } + @Deprecated public static String getArmorTexture(Entity entity, ItemStack armor, String _default, int slot, int layer, String type) { - String result = armor.getItem().getArmorTexture(armor, entity, slot, layer); + return getArmorTexture(entity, armor, _default, slot, type); + } + + public static String getArmorTexture(Entity entity, ItemStack armor, String _default, int slot, String type) + { + String result = armor.getItem().getArmorTexture(armor, entity, slot, type); return result != null ? result : _default; } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch index ee8d641cf..1d1f1c5ee 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java.patch @@ -49,7 +49,7 @@ + String s1 = String.format("textures/models/armor/%s_layer_%d%s.png", + bipedArmorFilenamePrefix[item.renderIndex], (slot == 2 ? 2 : 1), type == null ? "" : String.format("_%s", type)); + -+ s1 = ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, (slot == 2 ? 2 : 1), type); ++ s1 = ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, type); + ResourceLocation resourcelocation = (ResourceLocation)field_110859_k.get(s1); + + if (resourcelocation == null) diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches/minecraft/net/minecraft/item/Item.java.patch index 3a8c1c914..8d647f685 100644 --- a/patches/minecraft/net/minecraft/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -66,7 +66,7 @@ Vec3 vec31 = vec3.addVector((double)f7 * d3, (double)f6 * d3, (double)f8 * d3); return par1World.rayTraceBlocks_do_do(vec3, vec31, par3, !par3); } -@@ -740,4 +755,514 @@ +@@ -740,4 +755,534 @@ { StatList.initStats(); } @@ -428,6 +428,7 @@ + { + return 0.0F; //getDamageVsEntity(par1Entity); + } ++ + /** + * Called by RenderBiped and RenderPlayer to determine the armor texture that + * should be use for the currently equiped item. @@ -441,10 +442,29 @@ + * @param layer The render layer, either 1 or 2, 2 is only used for CLOTH armor by default + * @return Path of texture to bind, or null to use default + */ ++ @Deprecated //Replaced with more useful version below + public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer) + { + return null; + } ++ ++ /** ++ * Called by RenderBiped and RenderPlayer to determine the armor texture that ++ * should be use for the currently equiped item. ++ * This will only be called on instances of ItemArmor. ++ * ++ * Returning null from this function will use the default value. ++ * ++ * @param stack ItemStack for the equpt armor ++ * @param entity The entity wearing the armor ++ * @param slot The slot the armor is in ++ * @param type The subtype, can be null or "overlay" ++ * @return Path of texture to bind, or null to use default ++ */ ++ public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) ++ { ++ return getArmorTexture(stack, entity, slot, (slot == 2 ? 2 : 1)); ++ } + + + /** From a42369e0816eae321b3f5b4588fa6fea1042ef7f Mon Sep 17 00:00:00 2001 From: tommy1019 Date: Thu, 25 Jul 2013 18:38:29 -0500 Subject: [PATCH 095/146] Fluid Render Fix Formatting --- .../minecraftforge/fluids/RenderBlockFluid.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/common/net/minecraftforge/fluids/RenderBlockFluid.java b/common/net/minecraftforge/fluids/RenderBlockFluid.java index 5a0e6b180..6a065c554 100644 --- a/common/net/minecraftforge/fluids/RenderBlockFluid.java +++ b/common/net/minecraftforge/fluids/RenderBlockFluid.java @@ -1,4 +1,3 @@ - package net.minecraftforge.fluids; import net.minecraft.block.Block; @@ -29,12 +28,14 @@ public class RenderBlockFluid implements ISimpleBlockRenderingHandler { float total = 0; int count = 0; + + float end = 0; for (int i = 0; i < flow.length; i++) { - if (flow[i] >= 0.875F) + if (flow[i] >= 0.875F && end != 1F) { - return flow[i]; + end = flow[i]; } if (flow[i] >= 0) @@ -43,7 +44,11 @@ public class RenderBlockFluid implements ISimpleBlockRenderingHandler count++; } } - return total / count; + + if (end == 0) + end = total / count; + + return end; } public float getFluidHeightForRender(IBlockAccess world, int x, int y, int z, BlockFluidBase block) @@ -319,4 +324,4 @@ public class RenderBlockFluid implements ISimpleBlockRenderingHandler { return FluidRegistry.renderIdFluid; } -} +} \ No newline at end of file From f48dafda7ea20bf7fe70d66a6590b765dea7833f Mon Sep 17 00:00:00 2001 From: iChun Date: Fri, 26 Jul 2013 12:38:17 +0800 Subject: [PATCH 096/146] Add Pre and Post events for RenderLivingEvent --- .../minecraftforge/client/event/RenderLivingEvent.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/client/net/minecraftforge/client/event/RenderLivingEvent.java b/client/net/minecraftforge/client/event/RenderLivingEvent.java index 6c64db9c3..7b028e1f5 100644 --- a/client/net/minecraftforge/client/event/RenderLivingEvent.java +++ b/client/net/minecraftforge/client/event/RenderLivingEvent.java @@ -15,6 +15,16 @@ public abstract class RenderLivingEvent extends Event this.entity = entity; this.renderer = renderer; } + + @Cancelable + public static class Pre extends RenderLivingEvent + { + public Pre(EntityLivingBase entity, RendererLivingEntity renderer){ super(entity, renderer); } + } + public static class Post extends RenderLivingEvent + { + public Post(EntityLivingBase entity, RendererLivingEntity renderer){ super(entity, renderer); } + } public abstract static class Specials extends RenderLivingEvent { From 3e8711580e5d305d9e7474580931e7a31d85e535 Mon Sep 17 00:00:00 2001 From: iChun Date: Fri, 26 Jul 2013 12:46:52 +0800 Subject: [PATCH 097/146] Add Pre and Post events firing for RendererLivingEntity --- .../renderer/entity/RendererLivingEntity.java.patch | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch index 59d63e9a6..990032eb8 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch @@ -43,3 +43,12 @@ } protected boolean func_110813_b(EntityLivingBase par1EntityLivingBase) +@@ -570,7 +578,9 @@ + */ + public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) + { ++ MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Pre((EntityLivingBase)par1Entity, this)); + this.func_130000_a((EntityLivingBase)par1Entity, par2, par4, par6, par8, par9); ++ MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Post((EntityLivingBase)par1Entity, this)); + } +} From fb04d108867bbdeaf030d34307f9af06d807337f Mon Sep 17 00:00:00 2001 From: iChun Date: Fri, 26 Jul 2013 12:49:14 +0800 Subject: [PATCH 098/146] if statement added --- .../client/renderer/entity/RendererLivingEntity.java.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch index 990032eb8..c0f9df38e 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch @@ -47,7 +47,7 @@ */ public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) { -+ MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Pre((EntityLivingBase)par1Entity, this)); ++ if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Pre((EntityLivingBase)par1Entity, this))) return; this.func_130000_a((EntityLivingBase)par1Entity, par2, par4, par6, par8, par9); + MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Post((EntityLivingBase)par1Entity, this)); } From abdcd23d8b0c274d55dfd6b79022c95428e663aa Mon Sep 17 00:00:00 2001 From: iChun Date: Fri, 26 Jul 2013 12:51:42 +0800 Subject: [PATCH 099/146] Update RendererLivingEntity.java.patch --- .../client/renderer/entity/RendererLivingEntity.java.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch index c0f9df38e..4a92efc5f 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch @@ -43,7 +43,7 @@ } protected boolean func_110813_b(EntityLivingBase par1EntityLivingBase) -@@ -570,7 +578,9 @@ +@@ -570,6 +578,8 @@ */ public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) { From 077e05e0ed358de6f9f6b3520714a10fc593a875 Mon Sep 17 00:00:00 2001 From: tommy1019 Date: Fri, 26 Jul 2013 16:25:40 -0500 Subject: [PATCH 100/146] Fixed fluids eating each other Fluids check for other fluids density before flowing, if their density is higher they can flow into the other fluid, if not they can't. --- .../minecraftforge/fluids/BlockFluidBase.java | 20 +++++++++++++++++-- .../fluids/BlockFluidClassic.java | 10 +++++++++- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/common/net/minecraftforge/fluids/BlockFluidBase.java b/common/net/minecraftforge/fluids/BlockFluidBase.java index 5aea68e42..a3bc54f76 100644 --- a/common/net/minecraftforge/fluids/BlockFluidBase.java +++ b/common/net/minecraftforge/fluids/BlockFluidBase.java @@ -121,7 +121,15 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock { return false; } - return true; + + if (this.density > getDensity(world, x, y, z)) + { + return true; + } + else + { + return false; + } } /** @@ -156,7 +164,15 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock return false; } Block.blocksList[bId].dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); - return true; + + if (this.density > getDensity(world, x, y, z)) + { + return true; + } + else + { + return false; + } } public abstract int getQuantaValue(IBlockAccess world, int x, int y, int z); diff --git a/common/net/minecraftforge/fluids/BlockFluidClassic.java b/common/net/minecraftforge/fluids/BlockFluidClassic.java index ae63e2ceb..4defe7f6e 100644 --- a/common/net/minecraftforge/fluids/BlockFluidClassic.java +++ b/common/net/minecraftforge/fluids/BlockFluidClassic.java @@ -302,7 +302,15 @@ public class BlockFluidClassic extends BlockFluidBase { return false; } - return true; + + if (this.density > getDensity(world, x, y, z)) + { + return true; + } + else + { + return false; + } } protected int getLargerQuanta(IBlockAccess world, int x, int y, int z, int compare) From fd5b7359e2a8ea958e62a1e0138ea6cbb1519992 Mon Sep 17 00:00:00 2001 From: CovertJaguar Date: Sat, 27 Jul 2013 00:30:54 -0700 Subject: [PATCH 101/146] Add SneakClick bypass to client --- .../client/multiplayer/PlayerControllerMP.java.patch | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch index c6c9920f7..18f79e8d5 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch @@ -33,19 +33,23 @@ if (flag) { -@@ -347,6 +357,12 @@ +@@ -347,8 +357,14 @@ float f2 = (float)par8Vec3.zCoord - (float)par6; boolean flag = false; int i1; +- +- if (!par1EntityPlayer.isSneaking() || par1EntityPlayer.getHeldItem() == null) + if (par3ItemStack != null && + par3ItemStack.getItem() != null && + par3ItemStack.getItem().onItemUseFirst(par3ItemStack, par1EntityPlayer, par2World, par4, par5, par6, par7, f, f1, f2)) + { + return true; + } - - if (!par1EntityPlayer.isSneaking() || par1EntityPlayer.getHeldItem() == null) ++ ++ if (!par1EntityPlayer.isSneaking() || (par1EntityPlayer.getHeldItem() == null || par1EntityPlayer.getHeldItem().getItem().shouldPassSneakingClickToBlock(par2World, par4, par5, par6))) { + i1 = par2World.getBlockId(par4, par5, par6); + @@ -389,7 +405,15 @@ } else From 8a8f5af084c1faacab815ec5309c08d4eba8c114 Mon Sep 17 00:00:00 2001 From: cpw Date: Sat, 27 Jul 2013 23:36:27 +0200 Subject: [PATCH 102/146] Fix names for water/lava fluids. Closes #689 --- common/net/minecraftforge/fluids/FluidRegistry.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/common/net/minecraftforge/fluids/FluidRegistry.java b/common/net/minecraftforge/fluids/FluidRegistry.java index 4eba91c67..62c86d05d 100644 --- a/common/net/minecraftforge/fluids/FluidRegistry.java +++ b/common/net/minecraftforge/fluids/FluidRegistry.java @@ -14,9 +14,9 @@ import com.google.common.collect.ImmutableMap; /** * Handles Fluid registrations. Fluids MUST be registered in order to function. - * + * * @author King Lemming, CovertJaguar (LiquidDictionary) - * + * */ public abstract class FluidRegistry { @@ -25,8 +25,8 @@ public abstract class FluidRegistry static HashMap fluids = new HashMap(); static BiMap fluidIDs = HashBiMap.create(); - public static final Fluid WATER = new Fluid("water").setBlockID(Block.waterStill.blockID); - public static final Fluid LAVA = new Fluid("lava").setBlockID(Block.lavaStill.blockID).setLuminosity(15).setDensity(3000).setViscosity(6000); + public static final Fluid WATER = new Fluid("water").setBlockID(Block.waterStill.blockID).setUnlocalizedName(Block.waterStill.getUnlocalizedName()); + public static final Fluid LAVA = new Fluid("lava").setBlockID(Block.lavaStill.blockID).setLuminosity(15).setDensity(3000).setViscosity(6000).setUnlocalizedName(Block.lavaStill.getUnlocalizedName()); public static int renderIdFluid = -1; @@ -50,7 +50,7 @@ public abstract class FluidRegistry /** * Register a new Fluid. If a fluid with the same name already exists, registration is denied. - * + * * @param fluid * The fluid to register. * @return True if the fluid was successfully registered; false if there is a name clash. From 31bd8d438d58ae1f295af98385d596c500096130 Mon Sep 17 00:00:00 2001 From: cpw Date: Sun, 28 Jul 2013 00:53:23 +0200 Subject: [PATCH 103/146] Add support for loading legacy liquid stacks as new fluid stacks. Requires having been written with the "liquidname" code from forge 1.5.x --- .../net/minecraftforge/fluids/FluidStack.java | 35 +++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/common/net/minecraftforge/fluids/FluidStack.java b/common/net/minecraftforge/fluids/FluidStack.java index 99615501b..22ceed9ee 100644 --- a/common/net/minecraftforge/fluids/FluidStack.java +++ b/common/net/minecraftforge/fluids/FluidStack.java @@ -1,18 +1,20 @@ package net.minecraftforge.fluids; +import java.util.Locale; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; /** * ItemStack substitute for Fluids. - * + * * NOTE: Equality is based on the Fluid, not the amount. Use * {@link #isFluidStackIdentical(FluidStack)} to determine if FluidID, Amount and NBT Tag are all * equal. - * + * * @author King Lemming, SirSengir (LiquidStack) - * + * */ public class FluidStack { @@ -53,16 +55,29 @@ public class FluidStack */ public static FluidStack loadFluidStackFromNBT(NBTTagCompound nbt) { - if (nbt == null || FluidRegistry.getFluid(nbt.getString("FluidName")) == null) + if (nbt == null) { return null; } - FluidStack stack = new FluidStack(FluidRegistry.getFluidID(nbt.getString("FluidName")), nbt.getInteger("Amount")); + String fluidName = nbt.getString("FluidName"); + if (fluidName == null) + { + fluidName = nbt.hasKey("LiquidName") ? nbt.getString("LiquidName").toLowerCase(Locale.ENGLISH) : null; + } + if (fluidName ==null || FluidRegistry.getFluid(fluidName) == null) + { + return null; + } + FluidStack stack = new FluidStack(FluidRegistry.getFluidID(fluidName), nbt.getInteger("Amount")); if (nbt.hasKey("Tag")) { stack.tag = nbt.getCompoundTag("Tag"); } + else if (nbt.hasKey("extra")) + { + stack.tag = nbt.getCompoundTag("extra"); + } return stack; } @@ -93,7 +108,7 @@ public class FluidStack /** * Determines if the FluidIDs and NBT Tags are equal. This does not check amounts. - * + * * @param other * The FluidStack for comparison * @return true if the Fluids (IDs and NBT Tags) are the same @@ -118,7 +133,7 @@ public class FluidStack /** * Determines if the Fluids are equal and this stack is larger. - * + * * @param other * @return true if this FluidStack contains the other FluidStack (same fluid and >= amount) */ @@ -129,7 +144,7 @@ public class FluidStack /** * Determines if the FluidIDs, Amounts, and NBT Tags are all equal. - * + * * @param other * - the FluidStack for comparison * @return true if the two FluidStacks are exactly the same @@ -142,7 +157,7 @@ public class FluidStack /** * Determines if the FluidIDs and NBT Tags are equal compared to a registered container * ItemStack. This does not check amounts. - * + * * @param other * The ItemStack for comparison * @return true if the Fluids (IDs and NBT Tags) are the same @@ -170,7 +185,7 @@ public class FluidStack /** * Default equality comparison for a FluidStack. Same functionality as isFluidEqual(). - * + * * This is included for use in data structures. */ @Override From b317d10ade2822f55ebf08905d6dd09ea37e78c8 Mon Sep 17 00:00:00 2001 From: cpw Date: Sun, 28 Jul 2013 01:06:16 +0200 Subject: [PATCH 104/146] Add a translation map for looking up legacy liquid names to convert to new fluid names. --- common/net/minecraftforge/fluids/Fluid.java | 43 +++++++++++++------ .../net/minecraftforge/fluids/FluidStack.java | 2 + 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/common/net/minecraftforge/fluids/Fluid.java b/common/net/minecraftforge/fluids/Fluid.java index b7c6f9147..8fa1e755e 100644 --- a/common/net/minecraftforge/fluids/Fluid.java +++ b/common/net/minecraftforge/fluids/Fluid.java @@ -2,6 +2,9 @@ package net.minecraftforge.fluids; import java.util.Locale; +import java.util.Map; + +import com.google.common.collect.Maps; import net.minecraft.block.Block; import net.minecraft.util.Icon; @@ -15,21 +18,21 @@ import cpw.mods.fml.relauncher.SideOnly; /** * Minecraft Forge Fluid Implementation - * + * * This class is a fluid (liquid or gas) equivalent to "Item." It describes the nature of a fluid * and contains its general properties. - * + * * These properties do not have inherent gameplay mechanics - they are provided so that mods may * choose to take advantage of them. - * + * * Fluid implementations are not required to actively use these properties, nor are objects * interfacing with fluids required to make use of them, but it is encouraged. - * + * * The default values can be used as a reference point for mods adding fluids such as oil or heavy * water. - * + * * @author King Lemming - * + * */ public class Fluid { @@ -45,7 +48,7 @@ public class Fluid /** * The light level emitted by this fluid. - * + * * Default value is 0, as most fluids do not actively emit light. */ protected int luminosity = 0; @@ -53,7 +56,7 @@ public class Fluid /** * Density of the fluid - completely arbitrary; negative density indicates that the fluid is * lighter than air. - * + * * Default value is approximately the real-life density of water in kg/m^3. */ protected int density = 1000; @@ -61,23 +64,23 @@ public class Fluid /** * Viscosity ("thickness") of the fluid - completely arbitrary; negative values are not * permissible. - * + * * Default value is approximately the real-life density of water in m/s^2 (x10^-3). */ protected int viscosity = 1000; /** * This indicates if the fluid is gaseous. - * + * * Useful for rendering the fluid in containers and the world. - * + * * Generally this is associated with negative density fluids. */ protected boolean isGaseous; /** * If there is a Block implementation of the Fluid, the BlockID is linked here. - * + * * The default value of -1 should remain for any Fluid without a Block implementation. */ protected int blockID = -1; @@ -263,4 +266,20 @@ public class Fluid public boolean isGaseous(World world, int x, int y, int z){ return isGaseous(); } public int getColor(World world, int x, int y, int z){ return getColor(); } public Icon getIcon(World world, int x, int y, int z){ return getIcon(); } + + private static Map legacyNames = Maps.newHashMap(); + static String convertLegacyName(String fluidName) + { + return fluidName != null && legacyNames.containsKey(fluidName) ? legacyNames.get(fluidName) : fluidName; + } + + /** + * Register a legacy liquid name with the Fluids system + * @param legacyName The legacy name to recognize + * @param canonicalName The canonical fluid name it will become + */ + public static void registerLegacyName(String legacyName, String canonicalName) + { + legacyNames.put(legacyName.toLowerCase(Locale.ENGLISH), canonicalName); + } } diff --git a/common/net/minecraftforge/fluids/FluidStack.java b/common/net/minecraftforge/fluids/FluidStack.java index 22ceed9ee..c41a9fccc 100644 --- a/common/net/minecraftforge/fluids/FluidStack.java +++ b/common/net/minecraftforge/fluids/FluidStack.java @@ -63,7 +63,9 @@ public class FluidStack if (fluidName == null) { fluidName = nbt.hasKey("LiquidName") ? nbt.getString("LiquidName").toLowerCase(Locale.ENGLISH) : null; + fluidName = Fluid.convertLegacyName(fluidName); } + if (fluidName ==null || FluidRegistry.getFluid(fluidName) == null) { return null; From e15c596e42330029849a2a46087b486432b00a46 Mon Sep 17 00:00:00 2001 From: tommy1019 Date: Sat, 27 Jul 2013 20:32:21 -0500 Subject: [PATCH 105/146] Fluid Rendering Fixes --- common/net/minecraftforge/fluids/BlockFluidBase.java | 2 +- common/net/minecraftforge/fluids/RenderBlockFluid.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/net/minecraftforge/fluids/BlockFluidBase.java b/common/net/minecraftforge/fluids/BlockFluidBase.java index a3bc54f76..c81e9e237 100644 --- a/common/net/minecraftforge/fluids/BlockFluidBase.java +++ b/common/net/minecraftforge/fluids/BlockFluidBase.java @@ -323,7 +323,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock public static double getFlowDirection(IBlockAccess world, int x, int y, int z) { Block block = Block.blocksList[world.getBlockId(x, y, z)]; - if (!(block instanceof BlockFluidBase)) + if (world.getBlockMaterial(x, y, z).isLiquid()) { return -1000.0; } diff --git a/common/net/minecraftforge/fluids/RenderBlockFluid.java b/common/net/minecraftforge/fluids/RenderBlockFluid.java index 6a065c554..bb2116db2 100644 --- a/common/net/minecraftforge/fluids/RenderBlockFluid.java +++ b/common/net/minecraftforge/fluids/RenderBlockFluid.java @@ -55,7 +55,7 @@ public class RenderBlockFluid implements ISimpleBlockRenderingHandler { if (world.getBlockId(x, y, z) == block.blockID) { - if (world.getBlockId(x, y - block.densityDir, z) == block.blockID) + if (world.getBlockMaterial(x, y - block.densityDir, z).isLiquid()) { return 1; } From 5c5cf3e7e783bfe24e6c88cc0c99647903009e0b Mon Sep 17 00:00:00 2001 From: cpw Date: Sun, 28 Jul 2013 19:15:00 +0200 Subject: [PATCH 106/146] Fix formatting error in PR --- .../minecraftforge/fluids/BlockFluidBase.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/common/net/minecraftforge/fluids/BlockFluidBase.java b/common/net/minecraftforge/fluids/BlockFluidBase.java index c81e9e237..dfcd7eb58 100644 --- a/common/net/minecraftforge/fluids/BlockFluidBase.java +++ b/common/net/minecraftforge/fluids/BlockFluidBase.java @@ -15,11 +15,11 @@ import net.minecraft.world.World; /** * This is a base implementation for Fluid blocks. - * + * * It is highly recommended that you extend this class or one of the Forge-provided child classes. - * + * * @author King Lemming, OvermindDL1 - * + * */ public abstract class BlockFluidBase extends Block implements IFluidBlock { @@ -121,8 +121,8 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock { return false; } - - if (this.density > getDensity(world, x, y, z)) + + if (this.density > getDensity(world, x, y, z)) { return true; } @@ -164,7 +164,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock return false; } Block.blocksList[bId].dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); - + if (this.density > getDensity(world, x, y, z)) { return true; @@ -288,7 +288,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock int lightUpBase = lightUp & 255; int lightThisExt = lightThis >> 16 & 255; int lightUpExt = lightUp >> 16 & 255; - return (lightThisBase > lightUpBase ? lightThisBase : lightUpBase) | + return (lightThisBase > lightUpBase ? lightThisBase : lightUpBase) | ((lightThisExt > lightUpExt ? lightThisExt : lightUpExt) << 16); } @@ -397,7 +397,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock if (world.getBlockId(x, y + 1, z) == blockID) { - boolean flag = + boolean flag = isBlockSolid(world, x, y, z - 1, 2) || isBlockSolid(world, x, y, z + 1, 3) || isBlockSolid(world, x - 1, y, z, 4) || @@ -406,7 +406,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock isBlockSolid(world, x, y + 1, z + 1, 3) || isBlockSolid(world, x - 1, y + 1, z, 4) || isBlockSolid(world, x + 1, y + 1, z, 5); - + if (flag) { vec = vec.normalize().addVector(0.0D, -6.0D, 0.0D); From c3f62ed8bff9d1a5ea1e441a5325fd987d7aa545 Mon Sep 17 00:00:00 2001 From: cpw Date: Sun, 28 Jul 2013 19:25:51 +0200 Subject: [PATCH 107/146] Tweak setBlock in update tick - it should only send serverside updates for source blocks. Experimental attempt to fix worldgen issues for fluid blocks --- .../fluids/BlockFluidClassic.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/common/net/minecraftforge/fluids/BlockFluidClassic.java b/common/net/minecraftforge/fluids/BlockFluidClassic.java index 4defe7f6e..b5349ca6f 100644 --- a/common/net/minecraftforge/fluids/BlockFluidClassic.java +++ b/common/net/minecraftforge/fluids/BlockFluidClassic.java @@ -10,11 +10,11 @@ import net.minecraft.world.World; /** * This is a fluid block implementation which emulates vanilla Minecraft fluid behavior. - * + * * It is highly recommended that you use/extend this class for "classic" fluid blocks. - * + * * @author King Lemming - * + * */ public class BlockFluidClassic extends BlockFluidBase { @@ -92,8 +92,8 @@ public class BlockFluidClassic extends BlockFluidBase { int y2 = y - densityDir; - if (world.getBlockId(x, y2, z ) == blockID || - world.getBlockId(x - 1, y2, z ) == blockID || + if (world.getBlockId(x, y2, z ) == blockID || + world.getBlockId(x - 1, y2, z ) == blockID || world.getBlockId(x + 1, y2, z ) == blockID || world.getBlockId(x, y2, z - 1) == blockID || world.getBlockId(x, y2, z + 1) == blockID) @@ -128,9 +128,10 @@ public class BlockFluidClassic extends BlockFluidBase } } } - else if (quantaRemaining > quantaPerBlock) + // This is a "source" block, set meta to zero, and send a server only update + else if (quantaRemaining >= quantaPerBlock) { - world.setBlockMetadataWithNotify(x, y, z, 0, 3); + world.setBlockMetadataWithNotify(x, y, z, 0, 2); } // Flow vertically if possible @@ -226,7 +227,7 @@ public class BlockFluidClassic extends BlockFluidBase int cost = 1000; for (int adjSide = 0; adjSide < 4; adjSide++) { - if ((adjSide == 0 && side == 1) || + if ((adjSide == 0 && side == 1) || (adjSide == 1 && side == 0) || (adjSide == 2 && side == 3) || (adjSide == 3 && side == 2)) @@ -302,7 +303,7 @@ public class BlockFluidClassic extends BlockFluidBase { return false; } - + if (this.density > getDensity(world, x, y, z)) { return true; From 89d9fb3556ba93f08ac9fb9cbad467625c0d5d3d Mon Sep 17 00:00:00 2001 From: cpw Date: Sun, 28 Jul 2013 22:40:13 +0200 Subject: [PATCH 108/146] Updated FML: MinecraftForge/FML@57befa89bbbf2bc2fcc4a97b78e07b3f9e23ef9d Fix keybindings being derped MinecraftForge/FML@1d84e8063e9d0dc73928dba006e6001201285cad Temporarily add a version of 'reobfuscate.py' that will resolve complex reobfuscation graph issues with specialsource. Copy it over 'reobfuscate.py' in the mcp runtime dir. Hopefully will have an MCP/specialsource fix in the coming days. --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index 10b16d32d..1d84e8063 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 10b16d32da4b7c32b15e69cf1c636505ebbe2540 +Subproject commit 1d84e8063e9d0dc73928dba006e6001201285cad From 7b9971b20f6e085a95e633ece4a5c3b1b3b26f7f Mon Sep 17 00:00:00 2001 From: iChun Date: Wed, 31 Jul 2013 08:03:10 +0800 Subject: [PATCH 109/146] Fix RenderLivingEvent.Pre/Post not being fired by most Renders. --- .../entity/RendererLivingEntity.java.patch | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch index 4a92efc5f..9df5e61cf 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch @@ -20,7 +20,23 @@ public RendererLivingEntity(ModelBase par1ModelBase, float par2) { -@@ -442,12 +448,13 @@ +@@ -68,6 +74,7 @@ + + public void func_130000_a(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6, float par8, float par9) + { ++ if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Pre(par1EntityLivingBase, this))) return; + GL11.glPushMatrix(); + GL11.glDisable(GL11.GL_CULL_FACE); + this.mainModel.onGround = this.renderSwingProgress(par1EntityLivingBase, par9); +@@ -277,6 +284,7 @@ + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glPopMatrix(); + this.passSpecialRender(par1EntityLivingBase, par2, par4, par6); ++ MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Post(par1EntityLivingBase, this)); + } + + /** +@@ -442,12 +450,13 @@ */ protected void passSpecialRender(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6) { @@ -35,7 +51,7 @@ if (d3 < (double)(f2 * f2)) { -@@ -491,6 +498,7 @@ +@@ -491,6 +500,7 @@ } } } @@ -43,12 +59,3 @@ } protected boolean func_110813_b(EntityLivingBase par1EntityLivingBase) -@@ -570,6 +578,8 @@ - */ - public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) - { -+ if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Pre((EntityLivingBase)par1Entity, this))) return; - this.func_130000_a((EntityLivingBase)par1Entity, par2, par4, par6, par8, par9); -+ MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Post((EntityLivingBase)par1Entity, this)); - } -} From 9564575d77d3433bf3bb0e34852fde589e85ea31 Mon Sep 17 00:00:00 2001 From: MrMasochism Date: Thu, 1 Aug 2013 08:02:19 +1200 Subject: [PATCH 110/146] Added a new function to allow control over whether an entity is dismounted when the entity it is riding goes under water --- .../minecraft/net/minecraft/entity/Entity.java.patch | 12 +++++++++++- .../net/minecraft/entity/EntityLivingBase.java.patch | 9 +++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/entity/Entity.java.patch b/patches/minecraft/net/minecraft/entity/Entity.java.patch index a38d7c938..9eada4431 100644 --- a/patches/minecraft/net/minecraft/entity/Entity.java.patch +++ b/patches/minecraft/net/minecraft/entity/Entity.java.patch @@ -155,7 +155,7 @@ } public boolean func_96091_a(Explosion par1Explosion, World par2World, int par3, int par4, int par5, int par6, float par7) -@@ -2426,4 +2496,160 @@ +@@ -2426,4 +2496,170 @@ { return this.getEntityName(); } @@ -314,5 +314,15 @@ + public boolean canRiderInteract() + { + return false; ++ } ++ ++ /** ++ * If the rider should be dismounted from the entity when the entity goes under water ++ * ++ * @param rider The entity that is riding ++ * @return if the entity should be dismounted when under water ++ */ ++ public boolean shouldDismountInWater(Entity rider){ ++ return this instanceof EntityLivingBase; + } } diff --git a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch index 02b126c4d..1a3dc1445 100644 --- a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -20,6 +20,15 @@ public abstract class EntityLivingBase extends Entity { +@@ -299,7 +302,7 @@ + + this.extinguish(); + +- if (!this.worldObj.isRemote && this.isRiding() && this.ridingEntity instanceof EntityLivingBase) ++ if (!this.worldObj.isRemote && this.isRiding() && ridingEntity!=null && ridingEntity.shouldDismountInWater(this)) + { + this.mountEntity((Entity)null); + } @@ -446,6 +449,7 @@ { this.entityLivingToAttack = par1EntityLivingBase; From bf8f5aa306036b8a1d9411ecff3b6beea9c4547e Mon Sep 17 00:00:00 2001 From: Matthew Warren Date: Wed, 31 Jul 2013 22:15:42 -0500 Subject: [PATCH 111/146] added temperature to fluids it could be useful for blocks that are affected by temperature --- .../minecraftforge/fluids/BlockFluidBase.java | 18 ++++++++++++++++ common/net/minecraftforge/fluids/Fluid.java | 21 +++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/common/net/minecraftforge/fluids/BlockFluidBase.java b/common/net/minecraftforge/fluids/BlockFluidBase.java index 5aea68e42..fbb30d073 100644 --- a/common/net/minecraftforge/fluids/BlockFluidBase.java +++ b/common/net/minecraftforge/fluids/BlockFluidBase.java @@ -39,6 +39,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock protected float quantaPerBlockFloat = 8F; protected int density = 1; protected int densityDir = -1; + protected int temperature = 295; protected int tickRate = 20; protected int renderPass = 1; @@ -55,6 +56,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock this.fluidName = fluid.getName(); this.density = fluid.density; + this.temperature = fluid.temperature; this.maxScaledLight = fluid.luminosity; this.tickRate = fluid.viscosity / 200; fluid.setBlockID(id); @@ -78,6 +80,12 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock return this; } + public BlockFluidBase setTemperature(int temperature) + { + this.temperature = temperature; + return this; + } + public BlockFluidBase setTickRate(int tickRate) { if (tickRate <= 0) tickRate = 20; @@ -303,6 +311,16 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock } return ((BlockFluidBase)block).density; } + + public static final int getTemperature(IBlockAccess world, int x, int y, int z) + { + Block block = Block.blocksList[world.getBlockId(x, y, z)]; + if (!(block instanceof BlockFluidBase)) + { + return Integer.MAX_VALUE; + } + return ((BlockFluidBase)block).temperature; + } public static double getFlowDirection(IBlockAccess world, int x, int y, int z) { diff --git a/common/net/minecraftforge/fluids/Fluid.java b/common/net/minecraftforge/fluids/Fluid.java index b7c6f9147..d9dbbbf81 100644 --- a/common/net/minecraftforge/fluids/Fluid.java +++ b/common/net/minecraftforge/fluids/Fluid.java @@ -58,6 +58,14 @@ public class Fluid */ protected int density = 1000; + /** + * Temperature of the fluid - completely arbitrary; higher temperature indicates that the fluid is + * hotter than air. + * + * Default value is approximately the real-life room temperature of water in degrees Kelvin. + */ + protected int temperature = 295; + /** * Viscosity ("thickness") of the fluid - completely arbitrary; negative values are not * permissible. @@ -132,6 +140,12 @@ public class Fluid return this; } + public Fluid setTemperature(int temperature) + { + this.temperature = temperature; + return this; + } + public Fluid setViscosity(int viscosity) { this.viscosity = viscosity; @@ -200,6 +214,11 @@ public class Fluid return this.density; } + public final int getTemperature() + { + return this.temperature; + } + public final int getViscosity() { return this.viscosity; @@ -252,6 +271,7 @@ public class Fluid /* Stack-based Accessors */ public int getLuminosity(FluidStack stack){ return getLuminosity(); } public int getDensity(FluidStack stack){ return getDensity(); } + public int getTemperature(FluidStack stack){ return getTemperature(); } public int getViscosity(FluidStack stack){ return getViscosity(); } public boolean isGaseous(FluidStack stack){ return isGaseous(); } public int getColor(FluidStack stack){ return getColor(); } @@ -259,6 +279,7 @@ public class Fluid /* World-based Accessors */ public int getLuminosity(World world, int x, int y, int z){ return getLuminosity(); } public int getDensity(World world, int x, int y, int z){ return getDensity(); } + public int getTemperature(World world, int x, int y, int z){ return getTemperature(); } public int getViscosity(World world, int x, int y, int z){ return getViscosity(); } public boolean isGaseous(World world, int x, int y, int z){ return isGaseous(); } public int getColor(World world, int x, int y, int z){ return getColor(); } From 4ea7e8d828f9fc990f82f8a4e89d53a39b848ae1 Mon Sep 17 00:00:00 2001 From: StormTiberius <7of9@netikka.fi> Date: Sat, 3 Aug 2013 05:45:22 +0300 Subject: [PATCH 112/146] Add cloud height to WorldType --- .../net/minecraft/world/WorldProvider.java.patch | 9 +++++++++ .../net/minecraft/world/WorldType.java.patch | 12 +++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/world/WorldProvider.java.patch b/patches/minecraft/net/minecraft/world/WorldProvider.java.patch index 827dd9d40..d9035628e 100644 --- a/patches/minecraft/net/minecraft/world/WorldProvider.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldProvider.java.patch @@ -32,6 +32,15 @@ + return DimensionManager.createProviderFor(par0); } + @SideOnly(Side.CLIENT) +@@ -209,7 +216,7 @@ + */ + public float getCloudHeight() + { +- return 128.0F; ++ return this.terrainType.getCloudHeight(); + } + @SideOnly(Side.CLIENT) @@ -268,4 +275,277 @@ * Returns the dimension's name, e.g. "The End", "Nether", or "Overworld". diff --git a/patches/minecraft/net/minecraft/world/WorldType.java.patch b/patches/minecraft/net/minecraft/world/WorldType.java.patch index 8040a7734..e9be8615f 100644 --- a/patches/minecraft/net/minecraft/world/WorldType.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldType.java.patch @@ -10,7 +10,7 @@ import net.minecraft.world.*; import net.minecraft.world.gen.*; import net.minecraft.world.biome.*; -@@ -224,4 +227,37 @@ +@@ -224,4 +227,47 @@ * Called when 'Create New World' button is pressed before starting game */ public void onGUICreateWorldPress() { } @@ -46,5 +46,15 @@ + public boolean isCustomizable() + { + return this == FLAT; ++ } ++ ++ @SideOnly(Side.CLIENT) ++ ++ /** ++ * the y level at which clouds are rendered. ++ */ ++ public float getCloudHeight() ++ { ++ return 128.0F; + } } From 90e0eaf5f5af099893f2ec1520e0e6442163356f Mon Sep 17 00:00:00 2001 From: Heldplayer Date: Sat, 3 Aug 2013 23:20:34 +0200 Subject: [PATCH 113/146] Fix render colour on bottom of fluids --- common/net/minecraftforge/fluids/RenderBlockFluid.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/net/minecraftforge/fluids/RenderBlockFluid.java b/common/net/minecraftforge/fluids/RenderBlockFluid.java index bb2116db2..7386f52ba 100644 --- a/common/net/minecraftforge/fluids/RenderBlockFluid.java +++ b/common/net/minecraftforge/fluids/RenderBlockFluid.java @@ -204,12 +204,12 @@ public class RenderBlockFluid implements ISimpleBlockRenderingHandler tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y - 1, z)); if (!rises) { - tessellator.setColorOpaque_F(LIGHT_Y_NEG, LIGHT_Y_NEG, LIGHT_Y_NEG); + tessellator.setColorOpaque_F(LIGHT_Y_NEG * red, LIGHT_Y_NEG * green, LIGHT_Y_NEG * blue); renderer.renderFaceYNeg(block, x, y + RENDER_OFFSET, z, block.getIcon(0, bMeta)); } else { - tessellator.setColorOpaque_F(LIGHT_Y_POS, LIGHT_Y_POS, LIGHT_Y_POS); + tessellator.setColorOpaque_F(LIGHT_Y_POS * red, LIGHT_Y_POS * green, LIGHT_Y_POS * blue); renderer.renderFaceYPos(block, x, y + RENDER_OFFSET, z, block.getIcon(1, bMeta)); } } From 647f6fdf346384fd66c9773f7c971b59dd533433 Mon Sep 17 00:00:00 2001 From: Heldplayer Date: Sat, 3 Aug 2013 23:42:38 +0200 Subject: [PATCH 114/146] Fix small derp --- common/net/minecraftforge/fluids/BlockFluidBase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/net/minecraftforge/fluids/BlockFluidBase.java b/common/net/minecraftforge/fluids/BlockFluidBase.java index 7961b0a11..826ec6c07 100644 --- a/common/net/minecraftforge/fluids/BlockFluidBase.java +++ b/common/net/minecraftforge/fluids/BlockFluidBase.java @@ -341,7 +341,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock public static double getFlowDirection(IBlockAccess world, int x, int y, int z) { Block block = Block.blocksList[world.getBlockId(x, y, z)]; - if (world.getBlockMaterial(x, y, z).isLiquid()) + if (!world.getBlockMaterial(x, y, z).isLiquid()) { return -1000.0; } From 18c8ac0b31c3218cb9ad7249809ecd8670c6731b Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 6 Aug 2013 11:49:39 -0700 Subject: [PATCH 115/146] Updated FML: MinecraftForge/FML@f275a24b43559cfdced243ff77e9848c9d458362 Add in some reverse lookup methods for game registry data MinecraftForge/FML@cb05c8c4aa60a131de92f0a21c06697c8f8896a8 Add missing SideOnly in BaseMod MinecraftForge/FML@1857064afa9ace796440c19f3275637a6e659375 Merge pull request #266 from grompe/patch-1 MinecraftForge/FML@182aa9c0cbe61ac69b0d428ead1dc817dd2a2e71 Fixed install.sh not passing arguments to install.py MinecraftForge/FML@f46a538b41157081c840f647f123513ac4c5a071 Merge pull request #268 from Bo98/sh-args-fix MinecraftForge/FML@29ef3d5ab412dcabbd67695558880c45011ace82 Update installer. --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index 1d84e8063..29ef3d5ab 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 1d84e8063e9d0dc73928dba006e6001201285cad +Subproject commit 29ef3d5ab412dcabbd67695558880c45011ace82 From 571e441502ce800262c5ca9d427ad9c7332c3fa1 Mon Sep 17 00:00:00 2001 From: LexManos Date: Wed, 7 Aug 2013 18:24:50 -0700 Subject: [PATCH 116/146] Only refresh vanilla tile entities when IDs change. --- .../renderer/entity/RendererLivingEntity.java.patch | 8 ++++---- .../net/minecraft/tileentity/TileEntity.java.patch | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch index 9df5e61cf..9c507d2c2 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch @@ -10,16 +10,16 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; -@@ -28,6 +31,9 @@ - +@@ -29,6 +32,9 @@ /** The model to be used during the render passes. */ protected ModelBase renderPassModel; -+ + + public static float NAME_TAG_RANGE = 64.0f; + public static float NAME_TAG_RANGE_SNEAK = 32.0f; - ++ public RendererLivingEntity(ModelBase par1ModelBase, float par2) { + this.mainModel = par1ModelBase; @@ -68,6 +74,7 @@ public void func_130000_a(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6, float par8, float par9) diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch index 12f2d86b8..fab68f5ae 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch @@ -12,7 +12,7 @@ import net.minecraft.world.World; public class TileEntity -@@ -311,4 +314,93 @@ +@@ -311,4 +314,94 @@ addMapping(TileEntityHopper.class, "Hopper"); addMapping(TileEntityComparator.class, "Comparator"); } @@ -47,6 +47,7 @@ + { + } + ++ private boolean isVanilla = getClass().getName().startsWith("net.minecraft.tileentity"); + /** + * Called from Chunk.setBlockIDWithMetadata, determines if this tile entity should be re-created when the ID, or Metadata changes. + * Use with caution as this will leave straggler TileEntities, or create conflicts with other TileEntities if not used properly. @@ -63,7 +64,7 @@ + */ + public boolean shouldRefresh(int oldID, int newID, int oldMeta, int newMeta, World world, int x, int y, int z) + { -+ return true; ++ return !isVanilla || (oldID != newID); + } + + public boolean shouldRenderInPass(int pass) From 9e732ee9356daa0843d1265b447806ba046c3d2d Mon Sep 17 00:00:00 2001 From: tommy1019 Date: Thu, 8 Aug 2013 18:38:46 -0500 Subject: [PATCH 117/146] Fixed Fluid Non-Solid Block Duplication --- .../minecraftforge/fluids/BlockFluidBase.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/common/net/minecraftforge/fluids/BlockFluidBase.java b/common/net/minecraftforge/fluids/BlockFluidBase.java index 826ec6c07..d96a47e2f 100644 --- a/common/net/minecraftforge/fluids/BlockFluidBase.java +++ b/common/net/minecraftforge/fluids/BlockFluidBase.java @@ -1,4 +1,3 @@ - package net.minecraftforge.fluids; import java.util.HashMap; @@ -130,7 +129,13 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock return false; } - if (this.density > getDensity(world, x, y, z)) + int density = getDensity(world, x, y, z); + if (density == Integer.MAX_VALUE) + { + return true; + } + + if (this.density > density) { return true; } @@ -173,7 +178,14 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock } Block.blocksList[bId].dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); - if (this.density > getDensity(world, x, y, z)) + int density = getDensity(world, x, y, z); + if (density == Integer.MAX_VALUE) + { + Block.blocksList[bId].dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); + return true; + } + + if (this.density > density) { return true; } From aab3385c2d91e64ba4a17e8b321d9f8ed9603d19 Mon Sep 17 00:00:00 2001 From: tommy1019 Date: Fri, 9 Aug 2013 12:23:05 -0500 Subject: [PATCH 118/146] Fixed Double Item Drop --- common/net/minecraftforge/fluids/BlockFluidBase.java | 1 - 1 file changed, 1 deletion(-) diff --git a/common/net/minecraftforge/fluids/BlockFluidBase.java b/common/net/minecraftforge/fluids/BlockFluidBase.java index d96a47e2f..5ec9f9234 100644 --- a/common/net/minecraftforge/fluids/BlockFluidBase.java +++ b/common/net/minecraftforge/fluids/BlockFluidBase.java @@ -176,7 +176,6 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock { return false; } - Block.blocksList[bId].dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); int density = getDensity(world, x, y, z); if (density == Integer.MAX_VALUE) From efb27ed1ea547b6ec2869beefd42ffe99f38ca1a Mon Sep 17 00:00:00 2001 From: tommy1019 Date: Fri, 9 Aug 2013 12:25:56 -0500 Subject: [PATCH 119/146] Fixed Classic Checking --- .../net/minecraftforge/fluids/BlockFluidClassic.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/common/net/minecraftforge/fluids/BlockFluidClassic.java b/common/net/minecraftforge/fluids/BlockFluidClassic.java index b5349ca6f..5af4160ec 100644 --- a/common/net/minecraftforge/fluids/BlockFluidClassic.java +++ b/common/net/minecraftforge/fluids/BlockFluidClassic.java @@ -1,4 +1,3 @@ - package net.minecraftforge.fluids; import java.util.Random; @@ -304,9 +303,15 @@ public class BlockFluidClassic extends BlockFluidBase return false; } - if (this.density > getDensity(world, x, y, z)) + int density = getDensity(world, x, y, z); + if (density == Integer.MAX_VALUE) { - return true; + return true; + } + + if (this.density > density) + { + return true; } else { From ffd4b38801c5c0e0f9047b2c92ea8420432a09f8 Mon Sep 17 00:00:00 2001 From: LexManos Date: Sat, 10 Aug 2013 19:39:06 -0700 Subject: [PATCH 120/146] Add optional feature to check entire bounding box for ladders. Closes #709 --- .../common/ForgeDummyContainer.java | 11 +++++-- .../net/minecraftforge/common/ForgeHooks.java | 29 ++++++++++++++++++- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/common/net/minecraftforge/common/ForgeDummyContainer.java b/common/net/minecraftforge/common/ForgeDummyContainer.java index d62a69c24..d3b82ae05 100644 --- a/common/net/minecraftforge/common/ForgeDummyContainer.java +++ b/common/net/minecraftforge/common/ForgeDummyContainer.java @@ -45,6 +45,7 @@ public class ForgeDummyContainer extends DummyModContainer implements WorldAcces public static boolean removeErroringTileEntities = false; public static boolean disableStitchedFileSaving = false; public static boolean forceDuplicateFluidBlockCrash = true; + public static boolean fullBoundingBoxLadders = false; public ForgeDummyContainer() { @@ -116,9 +117,13 @@ public class ForgeDummyContainer extends DummyModContainer implements WorldAcces FMLLog.warning("Enabling removal of erroring Tile Entities - USE AT YOUR OWN RISK"); } - prop = config.get(Configuration.CATEGORY_GENERAL, "disableStitchedFileSaving", true); - prop.comment = "Set this to just disable the texture stitcher from writing the 'debug.stitched_{name}.png file to disc. Just a small performance tweak. Default: true"; - disableStitchedFileSaving = prop.getBoolean(true); + //prop = config.get(Configuration.CATEGORY_GENERAL, "disableStitchedFileSaving", true); + //prop.comment = "Set this to just disable the texture stitcher from writing the 'debug.stitched_{name}.png file to disc. Just a small performance tweak. Default: true"; + //disableStitchedFileSaving = prop.getBoolean(true); + + prop = config.get(Configuration.CATEGORY_GENERAL, "fullBoundingBoxLadders", false); + prop.comment = "Set this to check the entire entity's collision bounding box for ladders instead of just the block they are in. Causes noticable differences in mechanics so default is vanilla behavior. Default: false"; + fullBoundingBoxLadders = prop.getBoolean(false); prop = config.get(Configuration.CATEGORY_GENERAL, "forceDuplicateFluidBlockCrash", true); prop.comment = "Set this to force a crash if more than one block attempts to link back to the same Fluid. Enabled by default."; diff --git a/common/net/minecraftforge/common/ForgeHooks.java b/common/net/minecraftforge/common/ForgeHooks.java index 8fa371847..2ff467546 100644 --- a/common/net/minecraftforge/common/ForgeHooks.java +++ b/common/net/minecraftforge/common/ForgeHooks.java @@ -18,9 +18,11 @@ import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemSpade; import net.minecraft.item.ItemStack; import net.minecraft.network.NetServerHandler; +import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.ChatMessageComponent; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumMovingObjectType; +import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.WeightedRandom; import net.minecraft.util.WeightedRandomItem; @@ -353,7 +355,32 @@ public class ForgeHooks public static boolean isLivingOnLadder(Block block, World world, int x, int y, int z, EntityLivingBase entity) { - return block != null && block.isLadder(world, x, y, z, entity); + if (!ForgeDummyContainer.fullBoundingBoxLadders) + { + return block != null && block.isLadder(world, x, y, z, entity); + } + else + { + AxisAlignedBB bb = entity.boundingBox; + int mX = MathHelper.floor_double(bb.minX); + int mY = MathHelper.floor_double(bb.minY); + int mZ = MathHelper.floor_double(bb.minZ); + for (int y2 = mY; y < bb.maxY; y2++) + { + for (int x2 = mX; x2 < bb.maxX; x2++) + { + for (int z2 = mZ; z2 < bb.maxZ; z2++) + { + block = Block.blocksList[world.getBlockId(x2, y2, z2)]; + if (block != null && block.isLadder(world, x2, y2, z2, entity)) + { + return true; + } + } + } + } + return false; + } } public static void onLivingJump(EntityLivingBase entity) From ffd4d4afc3c80fe8a6c435f6f81c654ad65ff24c Mon Sep 17 00:00:00 2001 From: LexManos Date: Sat, 10 Aug 2013 22:04:58 -0700 Subject: [PATCH 121/146] Allow creative tabs to have a search box if they want to Closes #592 --- .../inventory/GuiContainerCreative.java.patch | 68 ++++++++++++++++--- .../creativetab/CreativeTabs.java.patch | 12 +++- 2 files changed, 69 insertions(+), 11 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch index 3725f9acc..565406b87 100644 --- a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch @@ -32,7 +32,46 @@ } else { -@@ -413,7 +422,7 @@ +@@ -306,7 +315,7 @@ + */ + protected void keyTyped(char par1, int par2) + { +- if (selectedTabIndex != CreativeTabs.tabAllSearch.getTabIndex()) ++ if (CreativeTabs.creativeTabArray[selectedTabIndex].hasSearchBar()) + { + if (GameSettings.isKeyDown(this.mc.gameSettings.keyBindChat)) + { +@@ -343,6 +352,15 @@ + { + ContainerCreative containercreative = (ContainerCreative)this.inventorySlots; + containercreative.itemList.clear(); ++ ++ CreativeTabs tab = CreativeTabs.creativeTabArray[selectedTabIndex]; ++ if (tab.hasSearchBar() && tab != CreativeTabs.tabAllSearch) ++ { ++ tab.displayAllReleventItems(containercreative.itemList); ++ updateFilteredItems(containercreative); ++ return; ++ } ++ + Item[] aitem = Item.itemsList; + int i = aitem.length; + int j; +@@ -369,7 +387,12 @@ + Item.enchantedBook.func_92113_a(enchantment, containercreative.itemList); + } + } +- ++ updateFilteredItems(containercreative); ++ } ++ ++ //split from above for custom search tabs ++ private void updateFilteredItems(ContainerCreative containercreative) ++ { + Iterator iterator = containercreative.itemList.iterator(); + String s = this.searchField.getText().toLowerCase(); + +@@ -413,7 +436,7 @@ { CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex]; @@ -41,7 +80,7 @@ { this.fontRenderer.drawString(I18n.func_135053_a(creativetabs.getTranslatedTabLabel()), 8, 6, 4210752); } -@@ -462,7 +471,7 @@ +@@ -462,7 +485,7 @@ { CreativeTabs creativetabs = acreativetabs[k1]; @@ -50,7 +89,7 @@ { this.setCurrentCreativeTab(creativetabs); return; -@@ -478,11 +487,17 @@ +@@ -478,11 +501,17 @@ */ private boolean needsScrollBars() { @@ -68,7 +107,16 @@ int i = selectedTabIndex; selectedTabIndex = par1CreativeTabs.getTabIndex(); ContainerCreative containercreative = (ContainerCreative)this.inventorySlots; -@@ -653,21 +668,42 @@ +@@ -551,7 +580,7 @@ + + if (this.searchField != null) + { +- if (par1CreativeTabs == CreativeTabs.tabAllSearch) ++ if (par1CreativeTabs.hasSearchBar()) + { + this.searchField.setVisible(true); + this.searchField.setCanLoseFocus(false); +@@ -653,21 +682,42 @@ super.drawScreen(par1, par2, par3); CreativeTabs[] acreativetabs = CreativeTabs.creativeTabArray; @@ -116,7 +164,7 @@ } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); -@@ -741,14 +777,32 @@ +@@ -741,14 +791,32 @@ int k = acreativetabs.length; int l; @@ -151,7 +199,7 @@ } } -@@ -766,6 +820,14 @@ +@@ -766,6 +834,14 @@ this.drawTexturedModalRect(i1, k + (int)((float)(l - k - 17) * this.currentScroll), 232 + (this.needsScrollBars() ? 0 : 12), 0, 12, 15); } @@ -166,7 +214,7 @@ this.renderCreativeTab(creativetabs); if (creativetabs == CreativeTabs.tabInventory) -@@ -776,6 +838,15 @@ +@@ -776,6 +852,15 @@ protected boolean func_74232_a(CreativeTabs par1CreativeTabs, int par2, int par3) { @@ -182,7 +230,7 @@ int k = par1CreativeTabs.getTabColumn(); int l = 28 * k; byte b0 = 0; -@@ -883,6 +954,7 @@ +@@ -883,6 +968,7 @@ } GL11.glDisable(GL11.GL_LIGHTING); @@ -190,7 +238,7 @@ this.drawTexturedModalRect(l, i1, j, k, 28, b0); this.zLevel = 100.0F; itemRenderer.zLevel = 100.0F; -@@ -890,7 +962,7 @@ +@@ -890,7 +976,7 @@ i1 += 8 + (flag1 ? 1 : -1); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL12.GL_RESCALE_NORMAL); @@ -199,7 +247,7 @@ itemRenderer.renderItemAndEffectIntoGUI(this.fontRenderer, this.mc.func_110434_K(), itemstack, l, i1); itemRenderer.renderItemOverlayIntoGUI(this.fontRenderer, this.mc.func_110434_K(), itemstack, l, i1); GL11.glDisable(GL11.GL_LIGHTING); -@@ -912,6 +984,15 @@ +@@ -912,6 +998,15 @@ { this.mc.displayGuiScreen(new GuiStats(this, this.mc.statFileWriter)); } diff --git a/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch b/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch index aa89ba867..5b1f85db5 100644 --- a/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch +++ b/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch @@ -74,7 +74,7 @@ } } -@@ -232,4 +263,26 @@ +@@ -232,4 +263,36 @@ } } } @@ -99,5 +99,15 @@ + public ItemStack getIconItemStack() + { + return new ItemStack(getTabIconItem()); ++ } ++ ++ /** ++ * Determines if the search bar should be shown for this tab. ++ * ++ * @return True to show the bar ++ */ ++ public boolean hasSearchBar() ++ { ++ return tabIndex == CreativeTabs.tabAllSearch.tabIndex; + } } From 7ad79b42bca5fd808079a6cd908a8019c48b989a Mon Sep 17 00:00:00 2001 From: LexManos Date: Sat, 10 Aug 2013 23:07:49 -0700 Subject: [PATCH 122/146] Deprecate Block.addCreativeItems, Kill in 1.6.3+ Closes #655 --- patches/minecraft/net/minecraft/block/Block.java.patch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index 19a774135..07ccb81a6 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -167,7 +167,7 @@ } /** -@@ -1454,4 +1477,974 @@ +@@ -1454,4 +1477,975 @@ canBlockGrass[0] = true; StatList.initBreakableStats(); } @@ -349,6 +349,7 @@ + * + * @param itemList The list of items to display on the creative inventory. + */ ++ @Deprecated + public void addCreativeItems(ArrayList itemList) + { + } From f65f042910b26e9d10de09acf6da494ade4eb081 Mon Sep 17 00:00:00 2001 From: LexManos Date: Sat, 10 Aug 2013 23:23:41 -0700 Subject: [PATCH 123/146] Addition: Added isAllowedOnBooks hook to Enchantments Closes #589 --- .../net/minecraft/enchantment/Enchantment.java.patch | 11 ++++++++++- .../enchantment/EnchantmentHelper.java.patch | 3 ++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch index 8b1261622..1bf46b0b6 100644 --- a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch @@ -10,7 +10,7 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; -@@ -207,6 +210,27 @@ +@@ -207,6 +210,36 @@ return this.type.canEnchantItem(par1ItemStack.getItem()); } @@ -34,6 +34,15 @@ + { + ObjectArrays.concat(enchantmentsBookList, enchantment); + } ++ ++ /** ++ * Is this enchantment allowed to be enchanted on books via Enchantment Table ++ * @return false to disable the vanilla feature ++ */ ++ public boolean isAllowedOnBooks() ++ { ++ return true; ++ } + static { diff --git a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch index 8aebb7f5a..33fbe30e8 100644 --- a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch @@ -1,10 +1,11 @@ --- ../src_base/minecraft/net/minecraft/enchantment/EnchantmentHelper.java +++ ../src_work/minecraft/net/minecraft/enchantment/EnchantmentHelper.java -@@ -463,7 +463,7 @@ +@@ -463,7 +463,8 @@ { Enchantment enchantment = aenchantment[k]; - if (enchantment != null && (enchantment.type.canEnchantItem(item) || flag)) ++ flag = (par1ItemStack.itemID == Item.book.itemID) && enchantment.isAllowedOnBooks(); + if (enchantment != null && (enchantment.canApplyAtEnchantingTable(par1ItemStack) || flag)) { for (int l = enchantment.getMinLevel(); l <= enchantment.getMaxLevel(); ++l) From b0f4497bbebc3e9484d03653e939fd02b2f8ac09 Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 11 Aug 2013 16:01:27 -0700 Subject: [PATCH 124/146] Fix inverted case, search works now. --- .../client/gui/inventory/GuiContainerCreative.java.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch index 565406b87..c9a2009cf 100644 --- a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch @@ -37,7 +37,7 @@ protected void keyTyped(char par1, int par2) { - if (selectedTabIndex != CreativeTabs.tabAllSearch.getTabIndex()) -+ if (CreativeTabs.creativeTabArray[selectedTabIndex].hasSearchBar()) ++ if (!CreativeTabs.creativeTabArray[selectedTabIndex].hasSearchBar()) { if (GameSettings.isKeyDown(this.mc.gameSettings.keyBindChat)) { From ffd2fbcc84056d603902386e797b06c67023a1c3 Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 13 Aug 2013 15:25:09 -0700 Subject: [PATCH 125/146] Fix NPE in enchangint books. --- .../net/minecraft/enchantment/EnchantmentHelper.java.patch | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch index 33fbe30e8..8fe6cc8cf 100644 --- a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch @@ -1,12 +1,14 @@ --- ../src_base/minecraft/net/minecraft/enchantment/EnchantmentHelper.java +++ ../src_work/minecraft/net/minecraft/enchantment/EnchantmentHelper.java -@@ -463,7 +463,8 @@ +@@ -463,7 +463,10 @@ { Enchantment enchantment = aenchantment[k]; - if (enchantment != null && (enchantment.type.canEnchantItem(item) || flag)) ++ if (enchantment == null) continue; ++ + flag = (par1ItemStack.itemID == Item.book.itemID) && enchantment.isAllowedOnBooks(); -+ if (enchantment != null && (enchantment.canApplyAtEnchantingTable(par1ItemStack) || flag)) ++ if (enchantment.canApplyAtEnchantingTable(par1ItemStack) || flag) { for (int l = enchantment.getMinLevel(); l <= enchantment.getMaxLevel(); ++l) { From 8c762223a436fc196b501ac078c1a6d08f298ea4 Mon Sep 17 00:00:00 2001 From: Soaryn Date: Thu, 15 Aug 2013 19:55:15 -0400 Subject: [PATCH 126/146] Adds Temperature to Lava Missing lava temperature. Feel free to change it to any value. 1300K is the typical max for Magma so wasn't sure what was desired. Regardless, better than the same temp as water at 295K :smile: --- common/net/minecraftforge/fluids/FluidRegistry.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/net/minecraftforge/fluids/FluidRegistry.java b/common/net/minecraftforge/fluids/FluidRegistry.java index 62c86d05d..b55d21505 100644 --- a/common/net/minecraftforge/fluids/FluidRegistry.java +++ b/common/net/minecraftforge/fluids/FluidRegistry.java @@ -26,7 +26,7 @@ public abstract class FluidRegistry static BiMap fluidIDs = HashBiMap.create(); public static final Fluid WATER = new Fluid("water").setBlockID(Block.waterStill.blockID).setUnlocalizedName(Block.waterStill.getUnlocalizedName()); - public static final Fluid LAVA = new Fluid("lava").setBlockID(Block.lavaStill.blockID).setLuminosity(15).setDensity(3000).setViscosity(6000).setUnlocalizedName(Block.lavaStill.getUnlocalizedName()); + public static final Fluid LAVA = new Fluid("lava").setBlockID(Block.lavaStill.blockID).setLuminosity(15).setDensity(3000).setViscosity(6000).setTemperature(1300).setUnlocalizedName(Block.lavaStill.getUnlocalizedName()); public static int renderIdFluid = -1; From 9741d6348f77e4450339d7293ac4e40eb664f10e Mon Sep 17 00:00:00 2001 From: Christian Date: Sat, 17 Aug 2013 11:13:02 -0400 Subject: [PATCH 127/146] Updated FML: MinecraftForge/FML@9a5e24e338c6172531efb086a4b584c26d4f1435 Fix stupid derp is stupid. Closes #275 and means sp614x can do his thing MinecraftForge/FML@ba90b616070ce15793eb05e5afaed62a6f07c6e7 Make sure we only add args to the argument list if a tweaker hasn't already. Should fix LiteLoader compatibility issue. --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index 29ef3d5ab..ba90b6160 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 29ef3d5ab412dcabbd67695558880c45011ace82 +Subproject commit ba90b616070ce15793eb05e5afaed62a6f07c6e7 From 8f66346aeb0e69c2a32d77c41a9f06146bd08a24 Mon Sep 17 00:00:00 2001 From: Christian Date: Sat, 17 Aug 2013 11:44:06 -0400 Subject: [PATCH 128/146] Updated FML: MinecraftForge/FML@24701206808a43b9c7b10d7130c47b5d1e841bb6 Clean up a couple of resources. Also, don't parse jars just because they're in the mods dir --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index ba90b6160..247012068 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit ba90b616070ce15793eb05e5afaed62a6f07c6e7 +Subproject commit 24701206808a43b9c7b10d7130c47b5d1e841bb6 From ea31a5128554b62ccbb4e8e1b66c77e4f2d957a1 Mon Sep 17 00:00:00 2001 From: Christian Date: Sat, 17 Aug 2013 12:49:37 -0400 Subject: [PATCH 129/146] Updated FML: MinecraftForge/FML@dec9a3924d361bc016cb7f6b3e95764158cf5ae1 Add in "FMLCorePluginContainsMod" in the manifest. If this value is present, FML will attempt to parse your mod jar file as a normal mod file as well, instantiating mod containers there. --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index 247012068..dec9a3924 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 24701206808a43b9c7b10d7130c47b5d1e841bb6 +Subproject commit dec9a3924d361bc016cb7f6b3e95764158cf5ae1 From 92c095412ddf7bf630005991f50f115d37e57b4f Mon Sep 17 00:00:00 2001 From: Christian Date: Sat, 17 Aug 2013 12:57:37 -0400 Subject: [PATCH 130/146] Updated FML: MinecraftForge/FML@03989166665956df03aa85472eb13dca2d74a38d And actually instantiate the collection *sigh* --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index dec9a3924..039891666 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit dec9a3924d361bc016cb7f6b3e95764158cf5ae1 +Subproject commit 03989166665956df03aa85472eb13dca2d74a38d From bafbac3d513b87349c114a38ee956a184c66384f Mon Sep 17 00:00:00 2001 From: Christian Date: Sat, 17 Aug 2013 13:10:43 -0400 Subject: [PATCH 131/146] Updated FML: MinecraftForge/FML@4a9d0f9bd522e543b76daaf9c49b6214443c595f Add in some log information --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index 039891666..4a9d0f9bd 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 03989166665956df03aa85472eb13dca2d74a38d +Subproject commit 4a9d0f9bd522e543b76daaf9c49b6214443c595f From 667db45b1decfe8f0694a2a8428c93f1804ec868 Mon Sep 17 00:00:00 2001 From: Christian Date: Sat, 17 Aug 2013 13:15:18 -0400 Subject: [PATCH 132/146] Updated FML: MinecraftForge/FML@f157e7a6ecdeac2758fc0eaf547d3e8a763fb15b And more coremod logging --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index 4a9d0f9bd..f157e7a6e 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 4a9d0f9bd522e543b76daaf9c49b6214443c595f +Subproject commit f157e7a6ecdeac2758fc0eaf547d3e8a763fb15b From 8533f974e82ae42e6118b8d0f6478f01865cf502 Mon Sep 17 00:00:00 2001 From: Christian Date: Sat, 17 Aug 2013 13:28:06 -0400 Subject: [PATCH 133/146] Updated FML: MinecraftForge/FML@ffdd056a18eddb8f28b74435d40e69c956b9dd48 Check keys, not values *sigh* --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index f157e7a6e..ffdd056a1 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit f157e7a6ecdeac2758fc0eaf547d3e8a763fb15b +Subproject commit ffdd056a18eddb8f28b74435d40e69c956b9dd48 From 4b64c15ae86710db22e4eef66f196dfa12a24d00 Mon Sep 17 00:00:00 2001 From: Christian Date: Sun, 18 Aug 2013 19:02:20 -0400 Subject: [PATCH 134/146] Updated FML: MinecraftForge/FML@9468e41bbf3ea425c50daa710cf3ada11c82b238 Fix up scala refs, for better results --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index ffdd056a1..9468e41bb 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit ffdd056a18eddb8f28b74435d40e69c956b9dd48 +Subproject commit 9468e41bbf3ea425c50daa710cf3ada11c82b238 From 461a30812be9a8f9e648590e6dc293c6e26c7ccf Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 18 Aug 2013 23:16:36 -0700 Subject: [PATCH 135/146] Fix bug with custom Fluids. You can now drown in them! --- .../minecraftforge/fluids/BlockFluidBase.java | 9 +++ .../minecraftforge/fluids/IFluidBlock.java | 11 ++++ .../net/minecraft/block/Block.java.patch | 6 +- .../net/minecraft/block/BlockFluid.java.patch | 14 +++++ .../net/minecraft/entity/Entity.java.patch | 55 +++++++++++++++---- 5 files changed, 83 insertions(+), 12 deletions(-) diff --git a/common/net/minecraftforge/fluids/BlockFluidBase.java b/common/net/minecraftforge/fluids/BlockFluidBase.java index 5ec9f9234..91716d0c4 100644 --- a/common/net/minecraftforge/fluids/BlockFluidBase.java +++ b/common/net/minecraftforge/fluids/BlockFluidBase.java @@ -451,4 +451,13 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock { return FluidRegistry.getFluid(fluidName); } + + @Override + public float getFilledPercentage(World world, int x, int y, int z) + { + int quantaRemaining = getQuantaValue(world, x, y, z) + 1; + float remaining = quantaRemaining / quantaPerBlockFloat; + if (remaining > 1) remaining = 1.0f; + return remaining * (density > 0 ? 1 : -1); + } } diff --git a/common/net/minecraftforge/fluids/IFluidBlock.java b/common/net/minecraftforge/fluids/IFluidBlock.java index f2f13b23e..3f5bec69d 100644 --- a/common/net/minecraftforge/fluids/IFluidBlock.java +++ b/common/net/minecraftforge/fluids/IFluidBlock.java @@ -37,4 +37,15 @@ public interface IFluidBlock * @return */ boolean canDrain(World world, int x, int y, int z); + + /** + * Returns the amount of a single block is filled. Value between 0 and 1. + * 1 meaning the entire 1x1x1 cube is full, 0 meaning completely empty. + * + * If the return value is negative. It will be treated as filling the block + * from the top down instead of bottom up. + * + * @return + */ + float getFilledPercentage(World world, int x, int y, int z); } diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index 07ccb81a6..df12f2016 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -167,7 +167,7 @@ } /** -@@ -1454,4 +1477,975 @@ +@@ -1454,4 +1477,979 @@ canBlockGrass[0] = true; StatList.initBreakableStats(); } @@ -1142,4 +1142,8 @@ + { + return false; + } ++ ++ @Deprecated //Implemented here as we changed the IFluidBlock interface, and this allows us to do so without breaking exisitng mods. ++ // To be removed next MC version {1.6.3+} ++ public float getFilledPercentage(World world, int x, int y, int z){ return 1; } } diff --git a/patches/minecraft/net/minecraft/block/BlockFluid.java.patch b/patches/minecraft/net/minecraft/block/BlockFluid.java.patch index 5c0bfbc93..5aa1d6cdd 100644 --- a/patches/minecraft/net/minecraft/block/BlockFluid.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockFluid.java.patch @@ -9,3 +9,17 @@ l += (i2 & 16711680) >> 16; i1 += (i2 & 65280) >> 8; j1 += i2 & 255; +@@ -81,6 +81,13 @@ + } + + return (float)(par0 + 1) / 9.0F; ++ } ++ ++ ++ @Deprecated //Implemented here for compatibility, need to change this when we make vanilla fluids use our fluid methods. ++ public float getFilledPercentage(IBlockAccess world, int x, int y, int z) ++ { ++ return 1 - BlockFluid.getFluidHeightPercent(world.getBlockMetadata(x, y, z)); + } + + @SideOnly(Side.CLIENT) diff --git a/patches/minecraft/net/minecraft/entity/Entity.java.patch b/patches/minecraft/net/minecraft/entity/Entity.java.patch index 9eada4431..3a732896e 100644 --- a/patches/minecraft/net/minecraft/entity/Entity.java.patch +++ b/patches/minecraft/net/minecraft/entity/Entity.java.patch @@ -1,17 +1,22 @@ --- ../src_base/minecraft/net/minecraft/entity/Entity.java +++ ../src_work/minecraft/net/minecraft/entity/Entity.java -@@ -1,7 +1,10 @@ +@@ -1,10 +1,15 @@ package net.minecraft.entity; +import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; ++ +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Random; import java.util.UUID; -@@ -13,8 +16,13 @@ ++ + import net.minecraft.block.Block; + import net.minecraft.block.BlockFluid; + import net.minecraft.block.StepSound; +@@ -13,8 +18,13 @@ import net.minecraft.crash.CrashReportCategory; import net.minecraft.enchantment.EnchantmentProtection; import net.minecraft.entity.effect.EntityLightningBolt; @@ -25,7 +30,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagDouble; -@@ -26,12 +34,16 @@ +@@ -26,12 +36,18 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.Direction; import net.minecraft.util.MathHelper; @@ -39,10 +44,12 @@ +import net.minecraftforge.common.IExtendedEntityProperties; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.EntityEvent; ++import net.minecraftforge.fluids.Fluid; ++import net.minecraftforge.fluids.IFluidBlock; public abstract class Entity { -@@ -218,6 +230,13 @@ +@@ -218,6 +234,13 @@ private boolean invulnerable; private UUID entityUniqueID; public EnumEntitySize myEntitySize; @@ -56,7 +63,7 @@ public Entity(World par1World) { -@@ -245,6 +264,15 @@ +@@ -245,6 +268,15 @@ this.dataWatcher.addObject(0, Byte.valueOf((byte)0)); this.dataWatcher.addObject(1, Short.valueOf((short)300)); this.entityInit(); @@ -72,7 +79,33 @@ } protected abstract void entityInit(); -@@ -1523,6 +1551,21 @@ +@@ -1164,11 +1196,20 @@ + int k = MathHelper.floor_double(this.posZ); + int l = this.worldObj.getBlockId(i, j, k); + +- if (l != 0 && Block.blocksList[l].blockMaterial == par1Material) +- { +- float f = BlockFluid.getFluidHeightPercent(this.worldObj.getBlockMetadata(i, j, k)) - 0.11111111F; +- float f1 = (float)(j + 1) - f; +- return d0 < (double)f1; ++ Block block = Block.blocksList[l]; ++ if (block != null && block.blockMaterial == par1Material) ++ { ++ double filled = block.getFilledPercentage(worldObj, i, j, k); ++ if (filled < 0) ++ { ++ filled *= -1; ++ //filled -= 0.11111111F; //Why this is needed.. not sure... ++ return d0 > (double)(j + (1 - filled)); ++ } ++ else ++ { ++ return d0 < (double)(j + filled); ++ } + } + else + { +@@ -1523,6 +1564,21 @@ par1NBTTagCompound.setInteger("PortalCooldown", this.timeUntilPortal); par1NBTTagCompound.setLong("UUIDMost", this.entityUniqueID.getMostSignificantBits()); par1NBTTagCompound.setLong("UUIDLeast", this.entityUniqueID.getLeastSignificantBits()); @@ -94,7 +127,7 @@ this.writeEntityToNBT(par1NBTTagCompound); if (this.ridingEntity != null) -@@ -1593,6 +1636,26 @@ +@@ -1593,6 +1649,26 @@ this.setPosition(this.posX, this.posY, this.posZ); this.setRotation(this.rotationYaw, this.rotationPitch); @@ -121,7 +154,7 @@ this.readEntityFromNBT(par1NBTTagCompound); if (this.func_142008_O()) -@@ -1705,7 +1768,14 @@ +@@ -1705,7 +1781,14 @@ { EntityItem entityitem = new EntityItem(this.worldObj, this.posX, this.posY + (double)par2, this.posZ, par1ItemStack); entityitem.delayBeforeCanPickup = 10; @@ -137,7 +170,7 @@ return entityitem; } } -@@ -2001,7 +2071,7 @@ +@@ -2001,7 +2084,7 @@ */ public boolean isRiding() { @@ -146,7 +179,7 @@ } /** -@@ -2363,7 +2433,7 @@ +@@ -2363,7 +2446,7 @@ public float func_82146_a(Explosion par1Explosion, World par2World, int par3, int par4, int par5, Block par6Block) { @@ -155,7 +188,7 @@ } public boolean func_96091_a(Explosion par1Explosion, World par2World, int par3, int par4, int par5, int par6, float par7) -@@ -2426,4 +2496,170 @@ +@@ -2426,4 +2509,170 @@ { return this.getEntityName(); } From baf1e771e96a7683f4eb4afd857e04acb0edcec1 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 19 Aug 2013 10:45:29 -0700 Subject: [PATCH 136/146] Cache world on all render passes in case some mod disables the first pass. --- .../client/renderer/EntityRenderer.java.patch | 22 +++++++++++-------- .../client/renderer/RenderGlobal.java.patch | 10 ++++----- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch index d80636f98..df979bdbd 100644 --- a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch @@ -95,21 +95,25 @@ GL11.glEnable(GL11.GL_ALPHA_TEST); } } -@@ -1222,6 +1233,13 @@ +@@ -1222,6 +1233,17 @@ renderglobal.sortAndRender(entitylivingbase, 1, (double)par1); } -+ RenderHelper.enableStandardItemLighting(); -+ this.mc.mcProfiler.endStartSection("entities"); -+ ForgeHooksClient.setRenderPass(1); -+ renderglobal.renderEntities(entitylivingbase.getPosition(par1), frustrum, par1); -+ ForgeHooksClient.setRenderPass(-1); -+ RenderHelper.disableStandardItemLighting(); ++ ++ if (this.debugViewDirection == 0) //Only render if render pass 0 happens as well. ++ { ++ RenderHelper.enableStandardItemLighting(); ++ this.mc.mcProfiler.endStartSection("entities"); ++ ForgeHooksClient.setRenderPass(1); ++ renderglobal.renderEntities(entitylivingbase.getPosition(par1), frustrum, par1); ++ ForgeHooksClient.setRenderPass(-1); ++ RenderHelper.disableStandardItemLighting(); ++ } + GL11.glDepthMask(true); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); -@@ -1231,14 +1249,17 @@ +@@ -1231,14 +1253,17 @@ entityplayer = (EntityPlayer)entitylivingbase; GL11.glDisable(GL11.GL_ALPHA_TEST); this.mc.mcProfiler.endStartSection("outline"); @@ -129,7 +133,7 @@ GL11.glDisable(GL11.GL_BLEND); this.mc.mcProfiler.endStartSection("weather"); this.renderRainSnow(par1); -@@ -1248,6 +1269,20 @@ +@@ -1248,6 +1273,20 @@ { this.renderCloudsCheck(renderglobal, par1); } diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch index 84493179c..04a7766d2 100644 --- a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch @@ -10,7 +10,7 @@ @SideOnly(Side.CLIENT) public class RenderGlobal implements IWorldAccess { -@@ -447,35 +450,47 @@ +@@ -447,8 +450,13 @@ */ public void renderEntities(Vec3 par1Vec3, ICamera par2ICamera, float par3) { @@ -24,10 +24,10 @@ --this.renderEntitiesStartupCounter; } else - { +@@ -456,26 +464,33 @@ this.theWorld.theProfiler.startSection("prepare"); -- TileEntityRenderer.instance.cacheActiveRenderInfo(this.theWorld, this.mc.func_110434_K(), this.mc.fontRenderer, this.mc.renderViewEntity, par3); -- RenderManager.instance.cacheActiveRenderInfo(this.theWorld, this.mc.func_110434_K(), this.mc.fontRenderer, this.mc.renderViewEntity, this.mc.pointedEntityLiving, this.mc.gameSettings, par3); + TileEntityRenderer.instance.cacheActiveRenderInfo(this.theWorld, this.mc.func_110434_K(), this.mc.fontRenderer, this.mc.renderViewEntity, par3); + RenderManager.instance.cacheActiveRenderInfo(this.theWorld, this.mc.func_110434_K(), this.mc.fontRenderer, this.mc.renderViewEntity, this.mc.pointedEntityLiving, this.mc.gameSettings, par3); - this.countEntitiesTotal = 0; - this.countEntitiesRendered = 0; - this.countEntitiesHidden = 0; @@ -40,8 +40,6 @@ - TileEntityRenderer.staticPlayerZ = entitylivingbase.lastTickPosZ + (entitylivingbase.posZ - entitylivingbase.lastTickPosZ) * (double)par3; + if (pass == 0) + { -+ TileEntityRenderer.instance.cacheActiveRenderInfo(this.theWorld, this.mc.func_110434_K(), this.mc.fontRenderer, this.mc.renderViewEntity, par3); -+ RenderManager.instance.cacheActiveRenderInfo(this.theWorld, this.mc.func_110434_K(), this.mc.fontRenderer, this.mc.renderViewEntity, this.mc.pointedEntityLiving, this.mc.gameSettings, par3); + this.countEntitiesTotal = 0; + this.countEntitiesRendered = 0; + this.countEntitiesHidden = 0; From faba7e2a07b7f223a859a47fc433cbfd75a33b4e Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 19 Aug 2013 10:45:57 -0700 Subject: [PATCH 137/146] Skipp toss event for null entity items. Closes #732 --- common/net/minecraftforge/common/ForgeHooks.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/net/minecraftforge/common/ForgeHooks.java b/common/net/minecraftforge/common/ForgeHooks.java index 2ff467546..4a54f72d7 100644 --- a/common/net/minecraftforge/common/ForgeHooks.java +++ b/common/net/minecraftforge/common/ForgeHooks.java @@ -395,6 +395,11 @@ public class ForgeHooks player.capturedDrops.clear(); player.captureDrops = false; + if (ret == null) + { + return null; + } + ItemTossEvent event = new ItemTossEvent(ret, player); if (MinecraftForge.EVENT_BUS.post(event)) { From 8d6f8930830cbe8e34e01d74bfc617757039b84a Mon Sep 17 00:00:00 2001 From: Christian Date: Mon, 19 Aug 2013 15:28:38 -0400 Subject: [PATCH 138/146] Updated FML: MinecraftForge/FML@913f6f6d36bd179db7c147db0485e99dee693933 Try and use the relaunch log, which should be classloaded.. MinecraftForge/FML@ac065ff5f76b6c512b346366107efde66e9e1c88 Reset the IWorldGenerator seed for each mod, before calling. That should mean worldgen is consistent and not dependent on mod ordering, or mod sideeffects. --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index 9468e41bb..ac065ff5f 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 9468e41bbf3ea425c50daa710cf3ada11c82b238 +Subproject commit ac065ff5f76b6c512b346366107efde66e9e1c88 From b2d309b17e447710c0de8d6913365c9cbd8a4019 Mon Sep 17 00:00:00 2001 From: Christian Date: Mon, 19 Aug 2013 16:32:47 -0400 Subject: [PATCH 139/146] Allow multipass RenderItem rendering for terrain icons too. Should fix sengir's saplings. --- .../client/renderer/entity/RenderItem.java.patch | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch index 55fa0f85e..cd68abb9a 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch @@ -63,6 +63,15 @@ GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F); if (renderInFrame) +@@ -127,7 +118,7 @@ + { + float f8; + +- if (itemstack.getItemSpriteNumber() == 1 && itemstack.getItem().requiresMultipleRenderPasses()) ++ if (itemstack.getItem().requiresMultipleRenderPasses()) + { + if (renderInFrame) + { @@ -139,10 +130,10 @@ GL11.glScalef(0.5F, 0.5F, 0.5F); } From 8fed42725110fd517b8f6919492be9f61a798349 Mon Sep 17 00:00:00 2001 From: Christian Date: Tue, 20 Aug 2013 11:55:57 -0400 Subject: [PATCH 140/146] In the time honoured tradition of trying to fix vanilla, we today attempt to patch the pathfinding AI so that it doesn't lag when there's a lot of entities. Basically, if the zombie can't reach the villager, backoff subsequent pathfinding attempts. Hopefully should really help with lag caused by zombie swarms. --- .../ai/EntityAIAttackOnCollide.java.patch | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch diff --git a/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch b/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch new file mode 100644 index 000000000..6be2dfe92 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch @@ -0,0 +1,64 @@ +--- ../src_base/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java ++++ ../src_work/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java +@@ -3,6 +3,7 @@ + import net.minecraft.entity.EntityCreature; + import net.minecraft.entity.EntityLivingBase; + import net.minecraft.pathfinding.PathEntity; ++import net.minecraft.pathfinding.PathPoint; + import net.minecraft.util.MathHelper; + import net.minecraft.world.World; + +@@ -22,6 +23,8 @@ + PathEntity entityPathEntity; + Class classTarget; + private int field_75445_i; ++ ++ private int failedPathFindingPenalty; + + public EntityAIAttackOnCollide(EntityCreature par1EntityCreature, Class par2Class, double par3, boolean par5) + { +@@ -59,8 +62,16 @@ + } + else + { +- this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); +- return this.entityPathEntity != null; ++ if (-- this.field_75445_i <= 0) ++ { ++ this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); ++ this.field_75445_i = 4 + this.attacker.getRNG().nextInt(7); ++ return this.entityPathEntity != null; ++ } ++ else ++ { ++ return true; ++ } + } + } + +@@ -100,8 +111,24 @@ + + if ((this.field_75437_f || this.attacker.getEntitySenses().canSee(entitylivingbase)) && --this.field_75445_i <= 0) + { +- this.field_75445_i = 4 + this.attacker.getRNG().nextInt(7); ++ this.field_75445_i = failedPathFindingPenalty + 4 + this.attacker.getRNG().nextInt(7); + this.attacker.getNavigator().tryMoveToEntityLiving(entitylivingbase, this.field_75440_e); ++ if (this.attacker.getNavigator().getPath() != null) ++ { ++ PathPoint finalPathPoint = this.attacker.getNavigator().getPath().getFinalPathPoint(); ++ if (entitylivingbase.getDistanceSq(finalPathPoint.xCoord, finalPathPoint.yCoord, finalPathPoint.zCoord) < 1) ++ { ++ failedPathFindingPenalty = 0; ++ } ++ else ++ { ++ failedPathFindingPenalty += 10; ++ } ++ } ++ else ++ { ++ failedPathFindingPenalty += 10; ++ } + } + + this.attackTick = Math.max(this.attackTick - 1, 0); From b2c1eae652b65db2aa511d7aafa3530c6a267e78 Mon Sep 17 00:00:00 2001 From: Christian Date: Tue, 20 Aug 2013 21:01:02 -0400 Subject: [PATCH 141/146] Updated FML: MinecraftForge/FML@b993cf4a9825865b3a8a0c7b083c23d56dbd1d6f More exception handling for less derpiness. --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index ac065ff5f..b993cf4a9 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit ac065ff5f76b6c512b346366107efde66e9e1c88 +Subproject commit b993cf4a9825865b3a8a0c7b083c23d56dbd1d6f From 0c06d3b47a8cc2f3f2aeae5ce8d3974e922cb7a0 Mon Sep 17 00:00:00 2001 From: Christian Date: Tue, 27 Aug 2013 23:04:48 -0400 Subject: [PATCH 142/146] Updated FML: MinecraftForge/FML@1c9a853868f7df0daa5f67b99401dfab44ae18e6 Allow coremods to properly inject asset readers. MinecraftForge/FML@40b54013b4c9b01686411cd47a7866eeb650ea2b Allow server side lang file injection, hopefully --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index b993cf4a9..40b54013b 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit b993cf4a9825865b3a8a0c7b083c23d56dbd1d6f +Subproject commit 40b54013b4c9b01686411cd47a7866eeb650ea2b From dddb9b3189c2a552407bbd13fc0ffac9decfc109 Mon Sep 17 00:00:00 2001 From: Christian Date: Tue, 27 Aug 2013 23:03:33 -0400 Subject: [PATCH 143/146] Add some starting work for a forge tps command. Also update coremod for new FML behaviour --- common/assets/forge/lang/en_US.lang | 5 + .../classloading/FMLForgePlugin.java | 3 + .../common/ForgeChunkManager.java | 3 + .../common/ForgeDummyContainer.java | 28 ++++ .../server/ForgeTimeTracker.java | 113 ++++++++++++++ .../server/command/ForgeCommand.java | 147 ++++++++++++++++++ 6 files changed, 299 insertions(+) create mode 100644 common/assets/forge/lang/en_US.lang create mode 100644 common/net/minecraftforge/server/ForgeTimeTracker.java create mode 100644 common/net/minecraftforge/server/command/ForgeCommand.java diff --git a/common/assets/forge/lang/en_US.lang b/common/assets/forge/lang/en_US.lang new file mode 100644 index 000000000..2f9368d41 --- /dev/null +++ b/common/assets/forge/lang/en_US.lang @@ -0,0 +1,5 @@ +commands.forge.usage=Use /forge . Subcommands are tps, track +commands.forge.usage.tracking=Use /forge track . Valid types are te (Tile Entities). Duration is < 60. +commands.forge.tps.summary=%s : Mean tick time: %d ms. Mean TPS: %d + +commands.forge.tracking.te.enabled=Tile Entity tracking enabled for %d seconds. \ No newline at end of file diff --git a/common/net/minecraftforge/classloading/FMLForgePlugin.java b/common/net/minecraftforge/classloading/FMLForgePlugin.java index f5bfae55c..c6a4a84e7 100644 --- a/common/net/minecraftforge/classloading/FMLForgePlugin.java +++ b/common/net/minecraftforge/classloading/FMLForgePlugin.java @@ -1,5 +1,6 @@ package net.minecraftforge.classloading; +import java.io.File; import java.util.Map; import cpw.mods.fml.relauncher.IFMLLoadingPlugin; @@ -7,6 +8,7 @@ import cpw.mods.fml.relauncher.IFMLLoadingPlugin; public class FMLForgePlugin implements IFMLLoadingPlugin { public static boolean RUNTIME_DEOBF = false; + public static File forgeLocation; @Override public String[] getLibraryRequestClass() @@ -39,5 +41,6 @@ public class FMLForgePlugin implements IFMLLoadingPlugin public void injectData(Map data) { RUNTIME_DEOBF = (Boolean)data.get("runtimeDeobfuscationEnabled"); + forgeLocation = (File)data.get("coremodLocation"); } } diff --git a/common/net/minecraftforge/common/ForgeChunkManager.java b/common/net/minecraftforge/common/ForgeChunkManager.java index d5741d8a3..5b96f96f8 100644 --- a/common/net/minecraftforge/common/ForgeChunkManager.java +++ b/common/net/minecraftforge/common/ForgeChunkManager.java @@ -22,8 +22,10 @@ import com.google.common.collect.BiMap; import com.google.common.collect.ForwardingSet; import com.google.common.collect.HashBiMap; import com.google.common.collect.HashMultimap; +import com.google.common.collect.HashMultiset; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableListMultimap; +import com.google.common.collect.ImmutableMultiset; import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSetMultimap; import com.google.common.collect.LinkedHashMultimap; @@ -34,6 +36,7 @@ import com.google.common.collect.Maps; import com.google.common.collect.Multimap; import com.google.common.collect.Multimaps; import com.google.common.collect.Multiset; +import com.google.common.collect.Multisets; import com.google.common.collect.SetMultimap; import com.google.common.collect.Sets; import com.google.common.collect.TreeMultiset; diff --git a/common/net/minecraftforge/common/ForgeDummyContainer.java b/common/net/minecraftforge/common/ForgeDummyContainer.java index d3b82ae05..93deec9b5 100644 --- a/common/net/minecraftforge/common/ForgeDummyContainer.java +++ b/common/net/minecraftforge/common/ForgeDummyContainer.java @@ -10,14 +10,18 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.management.PlayerInstance; import net.minecraft.world.storage.SaveHandler; import net.minecraft.world.storage.WorldInfo; +import net.minecraftforge.classloading.FMLForgePlugin; import net.minecraftforge.common.network.ForgeConnectionHandler; import net.minecraftforge.common.network.ForgeNetworkHandler; import net.minecraftforge.common.network.ForgePacketHandler; import net.minecraftforge.common.network.ForgeTinyPacketHandler; +import net.minecraftforge.server.command.ForgeCommand; import com.google.common.eventbus.EventBus; import com.google.common.eventbus.Subscribe; +import cpw.mods.fml.client.FMLFileResourcePack; +import cpw.mods.fml.client.FMLFolderResourcePack; import cpw.mods.fml.common.DummyModContainer; import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.LoadController; @@ -27,6 +31,7 @@ import cpw.mods.fml.common.WorldAccessContainer; import cpw.mods.fml.common.event.FMLConstructionEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.event.FMLServerStartingEvent; import cpw.mods.fml.common.network.FMLNetworkHandler; import cpw.mods.fml.common.network.NetworkMod; @@ -174,6 +179,11 @@ public class ForgeDummyContainer extends DummyModContainer implements WorldAcces ForgeChunkManager.loadConfiguration(); } + @Subscribe + public void serverStarting(FMLServerStartingEvent evt) + { + evt.registerServerCommand(new ForgeCommand(evt.getServer())); + } @Override public NBTTagCompound getDataForWriting(SaveHandler handler, WorldInfo info) { @@ -191,4 +201,22 @@ public class ForgeDummyContainer extends DummyModContainer implements WorldAcces DimensionManager.loadDimensionDataMap(tag.hasKey("DimensionData") ? tag.getCompoundTag("DimensionData") : null); } } + + @Override + public File getSource() + { + return FMLForgePlugin.forgeLocation; + } + @Override + public Class getCustomResourcePackClass() + { + if (getSource().isDirectory()) + { + return FMLFolderResourcePack.class; + } + else + { + return FMLFileResourcePack.class; + } + } } diff --git a/common/net/minecraftforge/server/ForgeTimeTracker.java b/common/net/minecraftforge/server/ForgeTimeTracker.java new file mode 100644 index 000000000..e6357b0a7 --- /dev/null +++ b/common/net/minecraftforge/server/ForgeTimeTracker.java @@ -0,0 +1,113 @@ +package net.minecraftforge.server; + +import java.lang.ref.WeakReference; +import java.util.Arrays; +import java.util.Map; +import java.util.Map.Entry; + +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; +import com.google.common.collect.MapMaker; + +import net.minecraft.entity.Entity; +import net.minecraft.tileentity.TileEntity; + +public class ForgeTimeTracker { + public static boolean tileEntityTracking; + public static int tileEntityTrackingDuration; + public static long tileEntityTrackingTime; + + private Map tileEntityTimings; + private Map entityTimings; + + private static final ForgeTimeTracker INSTANCE = new ForgeTimeTracker(); + + private WeakReference tile; + private WeakReference entity; + + private long timing; + + private ForgeTimeTracker() + { + MapMaker mm = new MapMaker(); + mm.weakKeys(); + tileEntityTimings = mm.makeMap(); + entityTimings = mm.makeMap(); + } + + + private void trackTileStart(TileEntity tileEntity, long nanoTime) + { + if (tileEntityTrackingTime == 0) + { + tileEntityTrackingTime = nanoTime; + } + else if (tileEntityTrackingTime + tileEntityTrackingDuration < nanoTime) + { + tileEntityTracking = false; + tileEntityTrackingTime = 0; + + return; + } + tile = new WeakReference(tileEntity); + timing = nanoTime; + } + + + private void trackTileEnd(TileEntity tileEntity, long nanoTime) + { + if (tile == null || tile.get() != tileEntity) + { + tile = null; + // race, exit + return; + } + int[] timings = tileEntityTimings.get(tileEntity); + if (timings == null) + { + timings = new int[101]; + tileEntityTimings.put(tileEntity, timings); + } + int idx = timings[100] = (timings[100] + 1) % 100; + timings[idx] = (int) (nanoTime - timing); + } + + public static ImmutableMap getTileTimings() + { + return INSTANCE.buildImmutableTileEntityTimingMap(); + } + + private ImmutableMap buildImmutableTileEntityTimingMap() + { + Builder builder = ImmutableMap.builder(); + for (Entry entry : tileEntityTimings.entrySet()) + { + builder.put(entry.getKey(), Arrays.copyOfRange(entry.getValue(), 0, 100)); + } + return builder.build(); + } + + + public static void trackStart(TileEntity tileEntity) + { + if (!tileEntityTracking) return; + INSTANCE.trackTileStart(tileEntity, System.nanoTime()); + } + + public static void trackEnd(TileEntity tileEntity) + { + if (!tileEntityTracking) return; + INSTANCE.trackTileEnd(tileEntity, System.nanoTime()); + } + + public static void trackStart(Entity par1Entity) + { + + } + + public static void trackEnd(Entity par1Entity) + { + + } + +} diff --git a/common/net/minecraftforge/server/command/ForgeCommand.java b/common/net/minecraftforge/server/command/ForgeCommand.java new file mode 100644 index 000000000..23e7cd63a --- /dev/null +++ b/common/net/minecraftforge/server/command/ForgeCommand.java @@ -0,0 +1,147 @@ +package net.minecraftforge.server.command; + +import java.text.DecimalFormat; +import java.util.List; + +import com.google.common.collect.Multiset; + +import net.minecraft.command.CommandBase; +import net.minecraft.command.ICommand; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.WrongUsageException; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.ChatMessageComponent; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.common.ForgeChunkManager; +import net.minecraftforge.server.ForgeTimeTracker; + +public class ForgeCommand extends CommandBase { + + private MinecraftServer server; + + public ForgeCommand(MinecraftServer server) + { + this.server = server; + } + private static final DecimalFormat timeFormatter = new DecimalFormat("########0.000"); + + @Override + public String getCommandName() + { + return "forge"; + } + + @Override + public String getCommandUsage(ICommandSender icommandsender) + { + return "commands.forge.usage"; + } + + @Override + public int getRequiredPermissionLevel() + { + return 2; + } + @Override + public void processCommand(ICommandSender sender, String[] args) + { + if (args.length == 0) + { + throw new WrongUsageException("commands.forge.usage"); + } + else if ("help".equals(args[0])) + { + throw new WrongUsageException("commands.forge.usage"); + } + else if ("tps".equals(args[0])) + { + displayTPS(sender,args); + } + else if ("tpslog".equals(args[0])) + { + doTPSLog(sender,args); + } + else if ("track".equals(args[0])) + { + handleTracking(sender, args); + } + else + { + throw new WrongUsageException("commands.forge.usage"); + } + } + + private void handleTracking(ICommandSender sender, String[] args) + { + if (args.length != 3) + { + throw new WrongUsageException("commands.forge.usage.tracking"); + } + String type = args[1]; + int duration = parseIntBounded(sender, args[2], 1, 60); + + if ("te".equals(type)) + { + doTurnOnTileEntityTracking(sender, duration); + } + else + { + throw new WrongUsageException("commands.forge.usage.tracking"); + } + } + + private void doTurnOnTileEntityTracking(ICommandSender sender, int duration) + { + ForgeTimeTracker.tileEntityTrackingDuration = duration; + ForgeTimeTracker.tileEntityTracking = true; + sender.sendChatToPlayer(ChatMessageComponent.func_111082_b("commands.forge.tracking.te.enabled", duration)); + } + + private void doTPSLog(ICommandSender sender, String[] args) + { + + } + + private void displayTPS(ICommandSender sender, String[] args) + { + int dim = 0; + boolean summary = true; + if (args.length > 1) + { + dim = parseInt(sender, args[1]); + summary = false; + } + if (summary) + { + for (Integer dimId : DimensionManager.getIDs()) + { + double worldTickTime = ForgeCommand.mean(this.server.worldTickTimes.get(dimId)) * 1.0E-6D; + double worldTPS = Math.min(1000.0/worldTickTime, 20); + sender.sendChatToPlayer(ChatMessageComponent.func_111082_b("commands.forge.tps.summary",String.format("Dim %d", dimId), timeFormatter.format(worldTickTime), timeFormatter.format(worldTPS))); + } + double meanTickTime = ForgeCommand.mean(this.server.tickTimeArray) * 1.0E-6D; + double meanTPS = Math.min(1000.0/meanTickTime, 20); + sender.sendChatToPlayer(ChatMessageComponent.func_111082_b("commands.forge.tps.summary","Overall", timeFormatter.format(meanTickTime), timeFormatter.format(meanTPS))); + } + else + { + double worldTickTime = ForgeCommand.mean(this.server.worldTickTimes.get(dim)) * 1.0E-6D; + double worldTPS = Math.min(1000.0/worldTickTime, 20); + sender.sendChatToPlayer(ChatMessageComponent.func_111082_b("commands.forge.tps.summary",String.format("Dim %d", dim), timeFormatter.format(worldTickTime), timeFormatter.format(worldTPS))); + } + } + + private static long mean(long[] values) + { + long sum = 0l; + for (long v : values) + { + sum+=v; + } + + return sum / values.length; + } +} From 5a8def7d00df2d407cf02a278f9f04dd7689155c Mon Sep 17 00:00:00 2001 From: Christian Date: Wed, 28 Aug 2013 07:59:45 -0400 Subject: [PATCH 144/146] Tweak the release to add in assets to the distributable. *sigh* --- release.py | 1 + 1 file changed, 1 insertion(+) diff --git a/release.py b/release.py index 6ce93a694..39607213b 100644 --- a/release.py +++ b/release.py @@ -145,6 +145,7 @@ def main(): zip_add('install/Paulscode IBXM Library License.txt') zip_add('install/Paulscode SoundSystem CodecIBXM License.txt') zip_add('common/forge_at.cfg') + zip_add('common/assets','assets') zip_add(version_file) if not options.skip_changelog: zip_add(changelog_file, 'MinecraftForge-Changelog.txt') From 4eb05ed5716085784c8ea0c29747f97d5b6ad2ae Mon Sep 17 00:00:00 2001 From: Christian Date: Wed, 28 Aug 2013 22:16:59 -0400 Subject: [PATCH 145/146] Small fix to container registry. emptyContainer is not null, it's "NULL_EMPTYCONTAINER" now and won't match any valid container. --- .../net/minecraftforge/fluids/FluidContainerRegistry.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/net/minecraftforge/fluids/FluidContainerRegistry.java b/common/net/minecraftforge/fluids/FluidContainerRegistry.java index cf37e565b..64f8bff4a 100644 --- a/common/net/minecraftforge/fluids/FluidContainerRegistry.java +++ b/common/net/minecraftforge/fluids/FluidContainerRegistry.java @@ -31,6 +31,7 @@ public abstract class FluidContainerRegistry public static final int BUCKET_VOLUME = 1000; public static final ItemStack EMPTY_BUCKET = new ItemStack(Item.bucketEmpty); public static final ItemStack EMPTY_BOTTLE = new ItemStack(Item.glassBottle); + private static final ItemStack NULL_EMPTYCONTAINER = new ItemStack(Item.bucketEmpty); static { @@ -126,7 +127,7 @@ public abstract class FluidContainerRegistry } containerFluidMap.put(Arrays.asList(data.filledContainer.itemID, data.filledContainer.getItemDamage()), data); - if (data.emptyContainer != null) + if (data.emptyContainer != null && data.emptyContainer != NULL_EMPTYCONTAINER) { filledContainerMap.put(Arrays.asList(data.emptyContainer.itemID, data.emptyContainer.getItemDamage(), data.fluid.fluidID), data); emptyContainers.add(Arrays.asList(data.emptyContainer.itemID, data.emptyContainer.getItemDamage())); @@ -240,6 +241,7 @@ public abstract class FluidContainerRegistry public final ItemStack filledContainer; public final ItemStack emptyContainer; + public FluidContainerData(FluidStack stack, ItemStack filledContainer, ItemStack emptyContainer) { this(stack, filledContainer, emptyContainer, false); @@ -249,7 +251,7 @@ public abstract class FluidContainerRegistry { this.fluid = stack; this.filledContainer = filledContainer; - this.emptyContainer = emptyContainer; + this.emptyContainer = emptyContainer == null ? NULL_EMPTYCONTAINER : emptyContainer; if (stack == null || filledContainer == null || emptyContainer == null && !nullEmpty) { From d9b72a2282b62bac88981d03a0cf28c5b195ff75 Mon Sep 17 00:00:00 2001 From: Christian Date: Mon, 2 Sep 2013 00:13:23 -0400 Subject: [PATCH 146/146] Updated FML: MinecraftForge/FML@a13598b17ea9637c054d867a76298d6c080c5e32 Use java 1.6 compatible method of closing the zip file. Stops stupid compile error. --- fml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml b/fml index 40b54013b..a13598b17 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 40b54013b4c9b01686411cd47a7866eeb650ea2b +Subproject commit a13598b17ea9637c054d867a76298d6c080c5e32