mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 17:14:44 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a67e147dc | ||
|
|
c726e219d7 | ||
|
|
707a07511f | ||
|
|
d64c332266 | ||
|
|
800bb21bc8 | ||
|
|
1931d4fc09 | ||
|
|
17c9f9bf9b | ||
|
|
db1f438c2d | ||
|
|
d67cda76b8 | ||
|
|
b883254220 | ||
|
|
8a4636cba3 | ||
|
|
9c6f5bd8ee | ||
|
|
a2c606e98c | ||
|
|
6c578cd84d | ||
|
|
e35435abd5 | ||
|
|
5c7978d347 | ||
|
|
68cc1d315b | ||
|
|
96c05bbd25 | ||
|
|
d2cf70f8d5 | ||
|
|
f1a6f45353 | ||
|
|
8acaaa0e53 | ||
|
|
384da1b222 | ||
|
|
2be3e5845a | ||
|
|
600b2b86a6 | ||
|
|
6fb7b777ce | ||
|
|
28345bf839 | ||
|
|
56f612c186 | ||
|
|
80882bec9c | ||
|
|
f1f672b5fd | ||
|
|
bf5e706f06 | ||
|
|
c12b2c5b11 | ||
|
|
a64a47b24c | ||
|
|
8a7c087e34 | ||
|
|
756c3ce812 | ||
|
|
b8a84f2c29 | ||
|
|
ebc09a72db | ||
|
|
579f4de295 | ||
|
|
9f56b1cc03 | ||
|
|
141805d5bb | ||
|
|
d00a837635 | ||
|
|
da695e774f | ||
|
|
b3d605cd9d | ||
|
|
56438eb585 | ||
|
|
b763c73b74 | ||
|
|
ff7055fdb2 | ||
|
|
07dfc35e0e | ||
|
|
d290970b49 | ||
|
|
47749d454a | ||
|
|
ed7c343647 | ||
|
|
a386d0a8dc | ||
|
|
1a8d32f7de | ||
|
|
7a242e9562 | ||
|
|
afdbc4064b | ||
|
|
0392ecd8da | ||
|
|
cab70ce17a | ||
|
|
9fa40cb432 | ||
|
|
c9b6cdef1f | ||
|
|
5ecff4e5a1 | ||
|
|
115de819b3 | ||
|
|
bb6751cc59 | ||
|
|
0a874de91d | ||
|
|
3b61068a3c | ||
|
|
cfe5a542fc | ||
|
|
4f4a75d865 | ||
|
|
5c74f5efb9 | ||
|
|
878cac2697 | ||
|
|
8b5440b351 | ||
|
|
71c77d9e9a | ||
|
|
8ced84d8d3 | ||
|
|
3e09d92cd4 | ||
|
|
17132962c9 | ||
|
|
e7ca40009e | ||
|
|
62e7bdf805 | ||
|
|
705e5e62a0 | ||
|
|
a6ed5709ef | ||
|
|
aead41197f | ||
|
|
e9cd63abf7 | ||
|
|
d2878faa33 | ||
|
|
1c11f0eeb0 | ||
|
|
33bd0947e3 | ||
|
|
0457d8057f | ||
|
|
b0efd106bd | ||
|
|
9d22e76927 | ||
|
|
6ac2161f36 | ||
|
|
4cdb1cb3d0 | ||
|
|
651af86795 | ||
|
|
622f536f80 | ||
|
|
231c65da06 | ||
|
|
72864e4bc2 | ||
|
|
1d19069203 | ||
|
|
12b64fa287 | ||
|
|
fb5f9373c5 | ||
|
|
08b0913f04 | ||
|
|
8d9e0879d8 | ||
|
|
adf31e33fd | ||
|
|
61b8107ba4 | ||
|
|
cfda01b9ff | ||
|
|
4c259ce5d5 | ||
|
|
53dd73f2a5 | ||
|
|
691b87e876 | ||
|
|
b813f609a6 |
No files matched your search
@@ -0,0 +1,11 @@
|
||||
package net.minecraft.src;
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface MLProp {
|
||||
String name() default "";
|
||||
String info() default "";
|
||||
double min() default Double.NEGATIVE_INFINITY;
|
||||
double max() default Double.POSITIVE_INFINITY;
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,99 @@
|
||||
package net.minecraft.src.forge;
|
||||
|
||||
import net.minecraft.src.EnumJsonNodeType;
|
||||
import net.minecraft.src.EnumOS2;
|
||||
import net.minecraft.src.EnumOptions;
|
||||
import net.minecraft.src.EnumRarity;
|
||||
|
||||
public class EnumHelperClient extends EnumHelper {
|
||||
|
||||
private static Class[][] ctrs = {
|
||||
{EnumJsonNodeType.class},
|
||||
{EnumOptions.class, String.class, boolean.class, boolean.class},
|
||||
{EnumOS2.class},
|
||||
{EnumRarity.class, int.class, String.class}
|
||||
};
|
||||
|
||||
private static boolean[] decompiled = new boolean[ctrs.length];
|
||||
private static boolean isSetup = false;
|
||||
|
||||
public static EnumJsonNodeType addJsonNodeType(String name)
|
||||
{
|
||||
if (!isSetup)
|
||||
{
|
||||
setup();
|
||||
}
|
||||
|
||||
return addEnum(decompiled[0], EnumJsonNodeType.class, name,
|
||||
new Class[] {},
|
||||
new Object[]{});
|
||||
}
|
||||
public static EnumOptions addOptions(String name, String langName, boolean isSlider, boolean isToggle)
|
||||
{
|
||||
if (!isSetup)
|
||||
{
|
||||
setup();
|
||||
}
|
||||
|
||||
return addEnum(decompiled[1], EnumOptions.class, name,
|
||||
new Class[] {String.class, boolean.class, boolean.class},
|
||||
new Object[]{langName, isSlider, isToggle });
|
||||
}
|
||||
public static EnumOS2 addOS2(String name)
|
||||
{
|
||||
if (!isSetup)
|
||||
{
|
||||
setup();
|
||||
}
|
||||
|
||||
return addEnum(decompiled[2], EnumOS2.class, name,
|
||||
new Class[] {},
|
||||
new Object[]{});
|
||||
}
|
||||
public static EnumRarity addRarity(String name, int color, String displayName)
|
||||
{
|
||||
if (!isSetup)
|
||||
{
|
||||
setup();
|
||||
}
|
||||
|
||||
return addEnum(decompiled[3], EnumRarity.class, name,
|
||||
new Class[] {int.class, String.class},
|
||||
new Object[]{color, displayName });
|
||||
}
|
||||
|
||||
private static void setup()
|
||||
{
|
||||
//System.out.println("Enum Helper Initalizing: ");
|
||||
for(int x = 0; x < ctrs.length; x++)
|
||||
{
|
||||
try {
|
||||
Class<?>[] enumHeaders = new Class[ctrs[x].length + 3];
|
||||
enumHeaders[0] = String.class;
|
||||
enumHeaders[1] = int.class;
|
||||
enumHeaders[2] = String.class;
|
||||
enumHeaders[3] = int.class;
|
||||
|
||||
for (int y = 1; y < ctrs[x].length; y++)
|
||||
enumHeaders[3 + y] = ctrs[x][y];
|
||||
|
||||
ctrs[x][0].getDeclaredConstructor(enumHeaders);
|
||||
decompiled[x] = true;
|
||||
|
||||
} catch(Exception e) {
|
||||
//Nom Nom Nom
|
||||
}
|
||||
//System.out.format("\t%-25s %s\r\n", ctrs[x][0].getName().replace("net.minecraft.src.", ""), decompiled[x]);
|
||||
}
|
||||
isSetup = true;
|
||||
}
|
||||
|
||||
static
|
||||
{
|
||||
if (!isSetup)
|
||||
{
|
||||
setup();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,11 +9,29 @@ import net.minecraft.src.Block;
|
||||
import net.minecraft.src.ModLoader;
|
||||
import net.minecraft.src.RenderBlocks;
|
||||
import net.minecraft.src.Tessellator;
|
||||
import net.minecraft.src.RenderGlobal;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.MovingObjectPosition;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class ForgeHooksClient {
|
||||
|
||||
public static boolean onBlockHighlight(RenderGlobal renderglobal,
|
||||
EntityPlayer player, MovingObjectPosition mop, int i,
|
||||
ItemStack itemstack, float f) {
|
||||
for (IHighlightHandler handler : highlightHandlers) {
|
||||
if(handler.onBlockHighlight(renderglobal,player,mop,
|
||||
i,itemstack,f))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static LinkedList<IHighlightHandler> highlightHandlers = new LinkedList<IHighlightHandler>();
|
||||
|
||||
public static boolean canRenderInPass(Block block, int pass) {
|
||||
if(block instanceof IMultipassRender) {
|
||||
IMultipassRender impr = (IMultipassRender) block;
|
||||
@@ -23,12 +41,12 @@ public class ForgeHooksClient {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static HashMap tessellators=new HashMap();
|
||||
static HashMap textures=new HashMap();
|
||||
static boolean inWorld=false;
|
||||
static HashSet renderTextureTest=new HashSet();
|
||||
static ArrayList<List> renderTextureList=new ArrayList();
|
||||
static Tessellator defaultTessellator=null;
|
||||
|
||||
protected static void bindTessellator(int tex, int sub) {
|
||||
List key=Arrays.asList(tex,sub);
|
||||
@@ -43,9 +61,9 @@ public class ForgeHooksClient {
|
||||
renderTextureTest.add(key);
|
||||
renderTextureList.add(key);
|
||||
t.startDrawingQuads();
|
||||
t.setTranslationD(Tessellator.firstInstance.xOffset,
|
||||
Tessellator.firstInstance.yOffset,
|
||||
Tessellator.firstInstance.zOffset);
|
||||
t.setTranslationD(defaultTessellator.xOffset,
|
||||
defaultTessellator.yOffset,
|
||||
defaultTessellator.zOffset);
|
||||
}
|
||||
Tessellator.instance=t;
|
||||
}
|
||||
@@ -60,7 +78,11 @@ public class ForgeHooksClient {
|
||||
n=(Integer)textures.get(name);
|
||||
}
|
||||
if(!inWorld) {
|
||||
Tessellator.instance=Tessellator.firstInstance;
|
||||
if(Tessellator.instance.isDrawing) {
|
||||
int mode=Tessellator.instance.drawMode;
|
||||
Tessellator.instance.draw();
|
||||
Tessellator.instance.startDrawing(mode);
|
||||
}
|
||||
GL11.glBindTexture(3553 /* GL_TEXTURE_2D */,n);
|
||||
return;
|
||||
}
|
||||
@@ -68,8 +90,14 @@ public class ForgeHooksClient {
|
||||
}
|
||||
|
||||
protected static void unbindTexture() {
|
||||
Tessellator.instance=Tessellator.firstInstance;
|
||||
if(!inWorld) {
|
||||
if(inWorld) {
|
||||
Tessellator.instance=defaultTessellator;
|
||||
} else {
|
||||
if(Tessellator.instance.isDrawing) {
|
||||
int mode=Tessellator.instance.drawMode;
|
||||
Tessellator.instance.draw();
|
||||
Tessellator.instance.startDrawing(mode);
|
||||
}
|
||||
GL11.glBindTexture(3553 /* GL_TEXTURE_2D */, ModLoader
|
||||
.getMinecraftInstance().renderEngine
|
||||
.getTexture("/terrain.png"));
|
||||
@@ -77,8 +105,11 @@ public class ForgeHooksClient {
|
||||
}
|
||||
}
|
||||
|
||||
static int renderPass=-1;
|
||||
public static void beforeRenderPass(int pass) {
|
||||
Tessellator.instance=Tessellator.firstInstance;
|
||||
renderPass=pass;
|
||||
defaultTessellator=Tessellator.instance;
|
||||
Tessellator.renderingWorldRenderer=true;
|
||||
GL11.glBindTexture(3553 /* GL_TEXTURE_2D */, ModLoader
|
||||
.getMinecraftInstance().renderEngine
|
||||
.getTexture("/terrain.png"));
|
||||
@@ -88,6 +119,7 @@ public class ForgeHooksClient {
|
||||
}
|
||||
|
||||
public static void afterRenderPass(int pass) {
|
||||
renderPass=-1;
|
||||
inWorld=false;
|
||||
for(List l : renderTextureList) {
|
||||
// TODO: call appropriate client hooks
|
||||
@@ -99,7 +131,7 @@ public class ForgeHooksClient {
|
||||
GL11.glBindTexture(3553 /* GL_TEXTURE_2D */, ModLoader
|
||||
.getMinecraftInstance().renderEngine
|
||||
.getTexture("/terrain.png"));
|
||||
Tessellator.instance=Tessellator.firstInstance;
|
||||
Tessellator.renderingWorldRenderer=false;
|
||||
}
|
||||
|
||||
public static void beforeBlockRender(Block block,
|
||||
@@ -115,7 +147,7 @@ public class ForgeHooksClient {
|
||||
RenderBlocks renderblocks) {
|
||||
if (block instanceof ITextureProvider
|
||||
&& renderblocks.overrideBlockTexture == -1) {
|
||||
Tessellator.instance=Tessellator.firstInstance;
|
||||
unbindTexture();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,5 +159,19 @@ public class ForgeHooksClient {
|
||||
.getTextureFile()));
|
||||
}
|
||||
}
|
||||
|
||||
public static void renderCustomItem(ICustomItemRenderer customRenderer, RenderBlocks renderBlocks,int itemID, int meta, float f) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
if (renderBlocks.useInventoryTint) {
|
||||
int j = 0xffffff;//block.getRenderColor(i);
|
||||
float f1 = (float) (j >> 16 & 0xff) / 255F;
|
||||
float f3 = (float) (j >> 8 & 0xff) / 255F;
|
||||
float f5 = (float) (j & 0xff) / 255F;
|
||||
GL11.glColor4f(f1 * f, f3 * f, f5 * f, 1.0F);
|
||||
}
|
||||
|
||||
// ModLoader.RenderInvBlock(this, block, i, k);
|
||||
customRenderer.renderInventory(renderBlocks, itemID, meta);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* This software is provided under the terms of the Minecraft Forge Public
|
||||
* License v1.0.
|
||||
*/
|
||||
|
||||
package net.minecraft.src.forge;
|
||||
|
||||
import net.minecraft.src.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.
|
||||
*/
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package net.minecraft.src.forge;
|
||||
|
||||
import net.minecraft.src.RenderBlocks;
|
||||
|
||||
public interface ICustomItemRenderer {
|
||||
public void renderInventory (RenderBlocks renderblocks, int itemID, int meta);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* This software is provided under the terms of the Minecraft Forge Public
|
||||
* License v1.0.
|
||||
*/
|
||||
package net.minecraft.src.forge;
|
||||
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.EnumStatus;
|
||||
import net.minecraft.src.RenderGlobal;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.MovingObjectPosition;
|
||||
import net.minecraft.src.ItemStack;
|
||||
|
||||
public interface IHighlightHandler {
|
||||
/**
|
||||
* Allow custom handling of highlights. Return true if the hilight has
|
||||
* been handled.
|
||||
*/
|
||||
public boolean onBlockHighlight(RenderGlobal renderglobal,
|
||||
EntityPlayer player, MovingObjectPosition mop, int i,
|
||||
ItemStack itemstack, float f);
|
||||
}
|
||||
|
||||
@@ -6,26 +6,71 @@
|
||||
package net.minecraft.src.forge;
|
||||
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.Item;
|
||||
import net.minecraft.src.ModLoader;
|
||||
import net.minecraft.src.RenderBlocks;
|
||||
import net.minecraft.src.Tessellator;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class MinecraftForgeClient {
|
||||
/**
|
||||
* Registers a new block highlight handler.
|
||||
*/
|
||||
public static void registerHighlightHandler(IHighlightHandler handler) {
|
||||
ForgeHooksClient.highlightHandlers.add(handler);
|
||||
}
|
||||
|
||||
/** Bind a texture. This is used to bind a texture file when
|
||||
* performing your own rendering, rather than using ITextureProvider.
|
||||
*
|
||||
* This variation is reserved for future expansion.
|
||||
*/
|
||||
public static void bindTexture(String name, int sub) {
|
||||
ForgeHooksClient.bindTexture(name,sub);
|
||||
}
|
||||
|
||||
/** Bind a texture. This is used to bind a texture file when
|
||||
* performing your own rendering, rather than using ITextureProvider.
|
||||
*/
|
||||
public static void bindTexture(String name) {
|
||||
ForgeHooksClient.bindTexture(name,0);
|
||||
}
|
||||
|
||||
/** Unbind a texture. This binds the default texture, when you are
|
||||
* finished performing custom rendering.
|
||||
*/
|
||||
public static void unbindTexture() {
|
||||
ForgeHooksClient.unbindTexture();
|
||||
}
|
||||
|
||||
/** Preload a texture. Textures must be preloaded before the first
|
||||
* use, or they will cause visual anomalies.
|
||||
*/
|
||||
public static void preloadTexture(String texture) {
|
||||
ModLoader.getMinecraftInstance().renderEngine
|
||||
.getTexture(texture);
|
||||
}
|
||||
|
||||
/** Render a block. Render a block which may have a custom texture.
|
||||
*/
|
||||
public static void renderBlock(RenderBlocks rb, Block bl, int i, int
|
||||
j, int k) {
|
||||
ForgeHooksClient.beforeBlockRender(bl,rb);
|
||||
rb.renderBlockByRenderType(bl,i,j,k);
|
||||
ForgeHooksClient.afterBlockRender(bl,rb);
|
||||
}
|
||||
|
||||
/** Get the current render pass.
|
||||
*/
|
||||
public static int getRenderPass() {
|
||||
return ForgeHooksClient.renderPass;
|
||||
}
|
||||
|
||||
private static ICustomItemRenderer [] customItemRenderers = new ICustomItemRenderer [Item.itemsList.length];
|
||||
|
||||
public static void registerCustomItemRenderer (int itemID, ICustomItemRenderer renderer) {
|
||||
customItemRenderers [itemID] = renderer;
|
||||
}
|
||||
|
||||
public static ICustomItemRenderer getCustomItemRenderer (int itemID) {
|
||||
return customItemRenderers [itemID];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* This software is provided under the terms of the Minecraft Forge Public
|
||||
* License v1.0.
|
||||
*/
|
||||
|
||||
package net.minecraft.src.forge;
|
||||
|
||||
public class ArmorProperties {
|
||||
public int damageRemove = 0;
|
||||
public boolean allowRegularComputation = false;
|
||||
|
||||
public ArmorProperties () {
|
||||
|
||||
}
|
||||
|
||||
public ArmorProperties (int damageRemove, boolean allowRegularCompuation) {
|
||||
this.damageRemove = damageRemove;
|
||||
this.allowRegularComputation = allowRegularCompuation;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,342 @@
|
||||
package net.minecraft.src.forge;
|
||||
|
||||
import net.minecraft.src.*;
|
||||
import java.lang.reflect.*;
|
||||
import java.util.*;
|
||||
|
||||
public class EnumHelper {
|
||||
private static Object reflectionFactory = null;
|
||||
private static Method newConstructorAccessor = null;
|
||||
private static Method newInstance = null;
|
||||
private static Method newFieldAccessor = null;
|
||||
private static Method fieldAccessorSet = null;
|
||||
private static boolean isSetup = false;
|
||||
|
||||
//Some enums are decompiled with extra arguments, so lets check for that
|
||||
private static Class[][] ctrs = {
|
||||
{EnumAction.class},
|
||||
{EnumArmorMaterial.class, int.class, int[].class, int.class},
|
||||
{EnumArt.class, String.class, int.class, int.class, int.class, int.class},
|
||||
{EnumCreatureAttribute.class},
|
||||
{EnumCreatureType.class, Class.class, int.class, Material.class, boolean.class},
|
||||
{EnumDoor.class},
|
||||
{EnumEnchantmentType.class},
|
||||
{EnumMobType.class},
|
||||
{EnumMovingObjectType.class},
|
||||
{EnumSkyBlock.class, int.class},
|
||||
{EnumStatus.class},
|
||||
{EnumToolMaterial.class, int.class, int.class, float.class, int.class, int.class}
|
||||
};
|
||||
|
||||
private static boolean[] decompiled = new boolean[ctrs.length];
|
||||
|
||||
public static EnumAction addAction(String name)
|
||||
{
|
||||
if (!isSetup)
|
||||
{
|
||||
setup();
|
||||
}
|
||||
|
||||
return addEnum(decompiled[0], EnumAction.class, name,
|
||||
new Class[] {},
|
||||
new Object[]{});
|
||||
}
|
||||
public static EnumArmorMaterial addArmorMaterial(String name, int durability, int[] reductionAmounts, int enchantability)
|
||||
{
|
||||
if (!isSetup)
|
||||
{
|
||||
setup();
|
||||
}
|
||||
|
||||
return addEnum(decompiled[1], EnumArmorMaterial.class, name,
|
||||
new Class[] { int.class, int[].class, int.class },
|
||||
new Object[]{ durability, reductionAmounts, enchantability });
|
||||
}
|
||||
public static EnumArt addArt(String name, String tile, int sizeX, int sizeY, int offsetX, int offsetY)
|
||||
{
|
||||
if (!isSetup)
|
||||
{
|
||||
setup();
|
||||
}
|
||||
|
||||
return addEnum(decompiled[2], EnumArt.class, name,
|
||||
new Class[] {String.class, int.class, int.class, int.class, int.class},
|
||||
new Object[]{tile, sizeX, sizeY, offsetX, offsetY});
|
||||
}
|
||||
public static EnumCreatureAttribute addCreatureAttribute(String name)
|
||||
{
|
||||
if (!isSetup)
|
||||
{
|
||||
setup();
|
||||
}
|
||||
|
||||
return addEnum(decompiled[3], EnumCreatureAttribute.class, name,
|
||||
new Class[] {},
|
||||
new Object[]{});
|
||||
}
|
||||
public static EnumCreatureType addCreatureType(String name, Class typeClass, int maxNumber, Material material, boolean peaceful)
|
||||
{
|
||||
if (!isSetup)
|
||||
{
|
||||
setup();
|
||||
}
|
||||
|
||||
return addEnum(decompiled[4], EnumCreatureType.class, name,
|
||||
new Class[] {Class.class, int.class, Material.class, boolean.class},
|
||||
new Object[]{typeClass, maxNumber, material, peaceful});
|
||||
}
|
||||
public static EnumDoor addDoor(String name)
|
||||
{
|
||||
if (!isSetup)
|
||||
{
|
||||
setup();
|
||||
}
|
||||
|
||||
return addEnum(decompiled[5], EnumDoor.class, name,
|
||||
new Class[] {},
|
||||
new Object[]{});
|
||||
}
|
||||
public static EnumEnchantmentType addEnchantmentType(String name)
|
||||
{
|
||||
if (!isSetup)
|
||||
{
|
||||
setup();
|
||||
}
|
||||
|
||||
return addEnum(decompiled[6], EnumEnchantmentType.class, name,
|
||||
new Class[] {},
|
||||
new Object[]{});
|
||||
}
|
||||
public static EnumMobType addMobType(String name)
|
||||
{
|
||||
if (!isSetup)
|
||||
{
|
||||
setup();
|
||||
}
|
||||
|
||||
return addEnum(decompiled[7], EnumMobType.class, name,
|
||||
new Class[] {},
|
||||
new Object[]{});
|
||||
}
|
||||
public static EnumMovingObjectType addMovingObjectType(String name)
|
||||
{
|
||||
if (!isSetup)
|
||||
{
|
||||
setup();
|
||||
}
|
||||
|
||||
return addEnum(decompiled[8], EnumMovingObjectType.class, name,
|
||||
new Class[] {},
|
||||
new Object[]{});
|
||||
}
|
||||
public static EnumSkyBlock addSkyBlock(String name, int lightValue)
|
||||
{
|
||||
if (!isSetup)
|
||||
{
|
||||
setup();
|
||||
}
|
||||
|
||||
return addEnum(decompiled[9], EnumSkyBlock.class, name,
|
||||
new Class[] {int.class },
|
||||
new Object[]{lightValue});
|
||||
}
|
||||
public static EnumStatus addStatus(String name)
|
||||
{
|
||||
if (!isSetup)
|
||||
{
|
||||
setup();
|
||||
}
|
||||
|
||||
return addEnum(decompiled[10], EnumStatus.class, name,
|
||||
new Class[] {},
|
||||
new Object[]{});
|
||||
}
|
||||
public static EnumToolMaterial addToolMaterial(String name, int harvestLevel, int maxUses, float efficiency, int damage, int enchantability)
|
||||
{
|
||||
if (!isSetup)
|
||||
{
|
||||
setup();
|
||||
}
|
||||
|
||||
return addEnum(decompiled[11], EnumToolMaterial.class, name,
|
||||
new Class[] { int.class, int.class, float.class, int.class, int.class },
|
||||
new Object[]{ harvestLevel, maxUses, efficiency, damage, enchantability });
|
||||
}
|
||||
|
||||
private static void setup()
|
||||
{
|
||||
if (isSetup)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//System.out.println("Enum Helper Initalizing: ");
|
||||
for(int x = 0; x < ctrs.length; x++)
|
||||
{
|
||||
try {
|
||||
Class<?>[] enumHeaders = new Class[ctrs[x].length + 3];
|
||||
enumHeaders[0] = String.class;
|
||||
enumHeaders[1] = int.class;
|
||||
enumHeaders[2] = String.class;
|
||||
enumHeaders[3] = int.class;
|
||||
|
||||
for (int y = 1; y < ctrs[x].length; y++)
|
||||
enumHeaders[3 + y] = ctrs[x][y];
|
||||
|
||||
ctrs[x][0].getDeclaredConstructor(enumHeaders);
|
||||
decompiled[x] = true;
|
||||
|
||||
} catch(Exception e) {
|
||||
//Nom Nom Nom
|
||||
}
|
||||
//System.out.format("\t%-25s %s\r\n", ctrs[x][0].getName().replace("net.minecraft.src.", ""), decompiled[x]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
try {
|
||||
Method getReflectionFactory = Class.forName("sun.reflect.ReflectionFactory").getDeclaredMethod("getReflectionFactory");
|
||||
reflectionFactory = getReflectionFactory.invoke(null);
|
||||
newConstructorAccessor = Class.forName("sun.reflect.ReflectionFactory").getDeclaredMethod("newConstructorAccessor", Constructor.class);
|
||||
newInstance = Class.forName("sun.reflect.ConstructorAccessor").getDeclaredMethod("newInstance", Object[].class);
|
||||
newFieldAccessor = Class.forName("sun.reflect.ReflectionFactory").getDeclaredMethod("newFieldAccessor", Field.class, boolean.class);
|
||||
fieldAccessorSet = Class.forName("sun.reflect.FieldAccessor").getDeclaredMethod("set", Object.class, Object.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
isSetup = true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Everything below this is found at the site below, and updated to be able to compile in Eclipse/Java 1.6+
|
||||
* Also modified for use in decompiled code.
|
||||
* Found at: http://niceideas.ch/roller2/badtrash/entry/java_create_enum_instances_dynamically
|
||||
*/
|
||||
|
||||
private static Object getConstructorAccessor(boolean decompiled, Class<?> enumClass, Class<?>[] additionalParameterTypes) throws Exception {
|
||||
Class<?>[] parameterTypes = null;
|
||||
if (decompiled)
|
||||
{
|
||||
parameterTypes = new Class[additionalParameterTypes.length + 4];
|
||||
parameterTypes[0] = String.class;
|
||||
parameterTypes[1] = int.class;
|
||||
parameterTypes[2] = String.class;
|
||||
parameterTypes[3] = int.class;
|
||||
System.arraycopy(additionalParameterTypes, 0, parameterTypes, 4, additionalParameterTypes.length);
|
||||
}
|
||||
else
|
||||
{
|
||||
parameterTypes = new Class[additionalParameterTypes.length + 2];
|
||||
parameterTypes[0] = String.class;
|
||||
parameterTypes[1] = int.class;
|
||||
System.arraycopy(additionalParameterTypes, 0, parameterTypes, 2, additionalParameterTypes.length);
|
||||
}
|
||||
return newConstructorAccessor.invoke(reflectionFactory, enumClass.getDeclaredConstructor(parameterTypes));
|
||||
}
|
||||
|
||||
private static <T extends Enum<?>> T makeEnum(boolean decompiled, Class<T> enumClass, String value, int ordinal, Class<?>[] additionalTypes, Object[] additionalValues) throws Exception {
|
||||
Object[] parms = null;
|
||||
if (decompiled)
|
||||
{
|
||||
parms = new Object[additionalValues.length + 4];
|
||||
parms[0] = value;
|
||||
parms[1] = Integer.valueOf(ordinal);
|
||||
parms[2] = value;
|
||||
parms[3] = Integer.valueOf(ordinal);
|
||||
System.arraycopy(additionalValues, 0, parms, 4, additionalValues.length);
|
||||
}
|
||||
else
|
||||
{
|
||||
parms = new Object[additionalValues.length + 2];
|
||||
parms[0] = value;
|
||||
parms[1] = Integer.valueOf(ordinal);
|
||||
System.arraycopy(additionalValues, 0, parms, 2, additionalValues.length);
|
||||
}
|
||||
return enumClass.cast(newInstance.invoke(getConstructorAccessor(decompiled, enumClass, additionalTypes), new Object[]{parms}));
|
||||
}
|
||||
|
||||
private static void setFailsafeFieldValue(Field field, Object target, Object value) throws Exception {
|
||||
field.setAccessible(true);
|
||||
Field modifiersField = Field.class.getDeclaredField("modifiers");
|
||||
modifiersField.setAccessible(true);
|
||||
modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
|
||||
Object fieldAccessor = newFieldAccessor.invoke(reflectionFactory, field, false);
|
||||
fieldAccessorSet.invoke(fieldAccessor, target, value);
|
||||
}
|
||||
|
||||
private static void blankField(Class<?> enumClass, String fieldName) throws Exception {
|
||||
for (Field field : Class.class.getDeclaredFields()) {
|
||||
if (field.getName().contains(fieldName)) {
|
||||
field.setAccessible(true);
|
||||
setFailsafeFieldValue(field, enumClass, null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void cleanEnumCache(Class<?> enumClass) throws Exception {
|
||||
blankField(enumClass, "enumConstantDirectory");
|
||||
blankField(enumClass, "enumConstants");
|
||||
}
|
||||
|
||||
public static <T extends Enum<?>> T addEnum(Class<T> enumType, String enumName, boolean decompiled) {
|
||||
return addEnum(decompiled, enumType, enumName, new Class<?>[]{}, new Object[]{});
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T extends Enum<?>> T addEnum(boolean decompiled, Class<T> enumType, String enumName, Class<?>[] paramTypes, Object[] paramValues) {
|
||||
if (!isSetup)
|
||||
{
|
||||
setup();
|
||||
}
|
||||
|
||||
Field valuesField = null;
|
||||
Field[] fields = enumType.getDeclaredFields();
|
||||
int flags = Modifier.PRIVATE | Modifier.STATIC | Modifier.FINAL | 0x1000 /*SYNTHETIC*/;
|
||||
String valueType = String.format("[L%s;", enumType.getName().replace('.', '/'));
|
||||
|
||||
for (Field field : fields) {
|
||||
if (decompiled)
|
||||
{
|
||||
if (field.getName().contains("$VALUES"))
|
||||
{
|
||||
valuesField = field;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((field.getModifiers() & flags) == flags &&
|
||||
field.getType().getName().equals(valueType))
|
||||
{
|
||||
valuesField = field;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
valuesField.setAccessible(true);
|
||||
|
||||
try {
|
||||
T[] previousValues = (T[])valuesField.get(enumType);
|
||||
List<T> values = new ArrayList<T>(Arrays.asList(previousValues));
|
||||
T newValue = (T)makeEnum(decompiled, enumType, enumName, values.size(), paramTypes, paramValues);
|
||||
values.add(newValue);
|
||||
setFailsafeFieldValue(valuesField, null, values.toArray((T[]) Array.newInstance(enumType, 0)));
|
||||
cleanEnumCache(enumType);
|
||||
|
||||
return newValue;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
if (!isSetup)
|
||||
{
|
||||
setup();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,255 @@
|
||||
/**
|
||||
* This software is provided under the terms of the Minecraft Forge Public
|
||||
* License v1.0.
|
||||
*/
|
||||
|
||||
package net.minecraft.src.forge;
|
||||
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.IInventory;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.Item;
|
||||
import net.minecraft.src.EnumStatus;
|
||||
import net.minecraft.src.World;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class ForgeHooks {
|
||||
// TODO: move all app-side hooks from MinecraftForge
|
||||
|
||||
|
||||
// List Handling Hooks
|
||||
// ------------------------------------------------------------
|
||||
public static void onTakenFromCrafting(EntityPlayer player, ItemStack ist,
|
||||
IInventory craftMatrix) {
|
||||
for (ICraftingHandler handler : craftingHandlers) {
|
||||
handler.onTakenFromCrafting(player,ist,craftMatrix);
|
||||
}
|
||||
}
|
||||
|
||||
static LinkedList<ICraftingHandler> craftingHandlers = new LinkedList<ICraftingHandler>();
|
||||
|
||||
public static void onDestroyCurrentItem(EntityPlayer player, ItemStack orig) {
|
||||
for (IDestroyToolHandler handler : destroyToolHandlers) {
|
||||
handler.onDestroyCurrentItem(player,orig);
|
||||
}
|
||||
}
|
||||
|
||||
static LinkedList<IDestroyToolHandler> destroyToolHandlers = new LinkedList<IDestroyToolHandler>();
|
||||
|
||||
public static boolean onUseBonemeal(World world,
|
||||
int bid, int i, int j, int k) {
|
||||
for(IBonemealHandler handler : bonemealHandlers) {
|
||||
if(handler.onUseBonemeal(world,bid,i,j,k))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static LinkedList<IBonemealHandler> bonemealHandlers = new LinkedList<IBonemealHandler>();
|
||||
|
||||
public static boolean onUseHoe(ItemStack hoe, EntityPlayer player,
|
||||
World world, int i, int j, int k) {
|
||||
for(IHoeHandler handler : hoeHandlers) {
|
||||
if(handler.onUseHoe(hoe,player,world,i,j,k))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static LinkedList<IHoeHandler> hoeHandlers = new LinkedList<IHoeHandler>();
|
||||
|
||||
public static EnumStatus sleepInBedAt(EntityPlayer player, int i, int j, int k) {
|
||||
for (ISleepHandler handler : sleepHandlers) {
|
||||
EnumStatus status = handler.sleepInBedAt(player, i, j, k);
|
||||
if (status != null)
|
||||
return status;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static LinkedList<ISleepHandler> sleepHandlers = new LinkedList<ISleepHandler>();
|
||||
|
||||
// Plant Management
|
||||
// ------------------------------------------------------------
|
||||
static class ProbableItem {
|
||||
public ProbableItem(int item, int md, int q, int st, int e) {
|
||||
wstart=st; wend=e;
|
||||
itemid=item; meta=md;
|
||||
qty=q;
|
||||
}
|
||||
int wstart, wend;
|
||||
int itemid, meta;
|
||||
int qty;
|
||||
}
|
||||
|
||||
static ProbableItem getRandomItem(List<ProbableItem> list, int prop) {
|
||||
int n=Collections.binarySearch(list,prop,new Comparator(){
|
||||
public int compare(Object o1, Object o2) {
|
||||
ProbableItem pi=(ProbableItem)o1;
|
||||
Integer i1=(Integer)o2;
|
||||
if(i1<pi.wstart) return 1;
|
||||
if(i1>=pi.wend) return -1;
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
if(n<0) return null;
|
||||
return list.get(n);
|
||||
}
|
||||
|
||||
static List<ProbableItem> plantGrassList;
|
||||
static int plantGrassWeight;
|
||||
|
||||
static List<ProbableItem> seedGrassList;
|
||||
static int seedGrassWeight;
|
||||
|
||||
static {
|
||||
plantGrassList=new ArrayList<ProbableItem>();
|
||||
plantGrassList.add(new ProbableItem(
|
||||
Block.plantYellow.blockID,0,1,0,20));
|
||||
plantGrassList.add(new ProbableItem(
|
||||
Block.plantRed.blockID,0,1,20,30));
|
||||
plantGrassWeight=30;
|
||||
|
||||
seedGrassList=new ArrayList<ProbableItem>();
|
||||
seedGrassList.add(new ProbableItem(
|
||||
Item.seeds.shiftedIndex,0,1,0,10));
|
||||
seedGrassWeight=10;
|
||||
}
|
||||
|
||||
public static void plantGrassPlant(World world, int i, int j, int k) {
|
||||
int n=world.rand.nextInt(plantGrassWeight);
|
||||
ProbableItem pi=getRandomItem(plantGrassList,n);
|
||||
if(pi==null) return;
|
||||
world.setBlockAndMetadataWithNotify(i,j,k,pi.itemid,pi.meta);
|
||||
}
|
||||
|
||||
public static void addPlantGrass(int item, int md, int prop) {
|
||||
plantGrassList.add(new ProbableItem(
|
||||
item,md,1,plantGrassWeight,plantGrassWeight+prop));
|
||||
plantGrassWeight+=prop;
|
||||
}
|
||||
|
||||
public static ItemStack getGrassSeed(World world) {
|
||||
int n=world.rand.nextInt(seedGrassWeight);
|
||||
ProbableItem pi=getRandomItem(seedGrassList,n);
|
||||
if(pi==null) return null;
|
||||
return new ItemStack(pi.itemid,pi.qty,pi.meta);
|
||||
}
|
||||
|
||||
public static void addGrassSeed(int item, int md, int qty, int prop) {
|
||||
seedGrassList.add(new ProbableItem(
|
||||
item,md,qty,seedGrassWeight,seedGrassWeight+prop));
|
||||
seedGrassWeight+=prop;
|
||||
}
|
||||
|
||||
// Tool Path
|
||||
// ------------------------------------------------------------
|
||||
public static boolean canHarvestBlock(Block bl,
|
||||
EntityPlayer player, int md) {
|
||||
if(bl.blockMaterial.getIsHarvestable())
|
||||
return true;
|
||||
ItemStack itemstack = player.inventory.getCurrentItem();
|
||||
if(itemstack == null) return false;
|
||||
|
||||
List tc=(List)toolClasses.get(itemstack.itemID);
|
||||
if(tc==null) return itemstack.canHarvestBlock(bl);
|
||||
Object[] ta=tc.toArray();
|
||||
String cls=(String)ta[0]; int hvl=(Integer)ta[1];
|
||||
|
||||
Integer bhl=(Integer)toolHarvestLevels.get(Arrays.asList(
|
||||
bl.blockID,md,cls));
|
||||
if(bhl==null) return itemstack.canHarvestBlock(bl);
|
||||
if(bhl>hvl) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static float blockStrength(Block bl,
|
||||
EntityPlayer player, int md) {
|
||||
float bh=bl.getHardness(md);
|
||||
if(bh < 0.0F) return 0.0F;
|
||||
|
||||
if(!canHarvestBlock(bl,player,md)) {
|
||||
return 1.0F / bh / 100F;
|
||||
} else {
|
||||
return player.getCurrentPlayerStrVsBlock(bl,md) /
|
||||
bh / 30F;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isToolEffective(ItemStack ist, Block bl, int md) {
|
||||
List tc=(List)toolClasses.get(ist.itemID);
|
||||
if(tc==null) return false;
|
||||
Object[] ta=tc.toArray();
|
||||
String cls=(String)ta[0];
|
||||
|
||||
return toolEffectiveness.contains(Arrays.asList(
|
||||
bl.blockID,md,cls));
|
||||
}
|
||||
|
||||
static void initTools() {
|
||||
if(toolInit) return;
|
||||
toolInit=true;
|
||||
|
||||
MinecraftForge.setToolClass(Item.pickaxeWood,"pickaxe",0);
|
||||
MinecraftForge.setToolClass(Item.pickaxeStone,"pickaxe",1);
|
||||
MinecraftForge.setToolClass(Item.pickaxeSteel,"pickaxe",2);
|
||||
MinecraftForge.setToolClass(Item.pickaxeGold,"pickaxe",0);
|
||||
MinecraftForge.setToolClass(Item.pickaxeDiamond,"pickaxe",3);
|
||||
|
||||
MinecraftForge.setToolClass(Item.axeWood,"axe",0);
|
||||
MinecraftForge.setToolClass(Item.axeStone,"axe",1);
|
||||
MinecraftForge.setToolClass(Item.axeSteel,"axe",2);
|
||||
MinecraftForge.setToolClass(Item.axeGold,"axe",0);
|
||||
MinecraftForge.setToolClass(Item.axeDiamond,"axe",3);
|
||||
|
||||
MinecraftForge.setToolClass(Item.shovelWood,"shovel",0);
|
||||
MinecraftForge.setToolClass(Item.shovelStone,"shovel",1);
|
||||
MinecraftForge.setToolClass(Item.shovelSteel,"shovel",2);
|
||||
MinecraftForge.setToolClass(Item.shovelGold,"shovel",0);
|
||||
MinecraftForge.setToolClass(Item.shovelDiamond,"shovel",3);
|
||||
|
||||
MinecraftForge.setBlockHarvestLevel(Block.obsidian,"pickaxe",3);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.oreDiamond,"pickaxe",2);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.blockDiamond,"pickaxe",2);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.oreGold,"pickaxe",2);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.blockGold,"pickaxe",2);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.oreIron,"pickaxe",1);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.blockSteel,"pickaxe",1);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.oreLapis,"pickaxe",1);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.blockLapis,"pickaxe",1);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.oreRedstone,"pickaxe",2);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.oreRedstoneGlowing,"pickaxe",2);
|
||||
MinecraftForge.removeBlockEffectiveness(Block.oreRedstone,"pickaxe");
|
||||
MinecraftForge.removeBlockEffectiveness(Block.oreRedstoneGlowing,"pickaxe");
|
||||
MinecraftForge.removeBlockEffectiveness(Block.obsidian,"pickaxe");
|
||||
|
||||
Block[] pickeff ={
|
||||
Block.cobblestone, Block.stairDouble,
|
||||
Block.stairSingle, Block.stone, Block.sandStone,
|
||||
Block.cobblestoneMossy,
|
||||
Block.oreCoal,
|
||||
Block.ice, Block.netherrack, Block.oreLapis,
|
||||
Block.blockLapis
|
||||
};
|
||||
for(Block bl : pickeff) {
|
||||
MinecraftForge.setBlockHarvestLevel(bl,"pickaxe",0);
|
||||
}
|
||||
|
||||
// TODO: add other tool tables.
|
||||
}
|
||||
|
||||
public static final int majorVersion=1;
|
||||
public static final int minorVersion=2;
|
||||
public static final int revisionVersion=1;
|
||||
static {
|
||||
System.out.printf("MinecraftForge V%d.%d.%d Initialized\n",majorVersion,minorVersion,revisionVersion);
|
||||
}
|
||||
|
||||
static boolean toolInit=false;
|
||||
static HashMap toolClasses=new HashMap();
|
||||
static HashMap toolHarvestLevels=new HashMap();
|
||||
static HashSet toolEffectiveness=new HashSet();
|
||||
}
|
||||
|
||||
@@ -5,12 +5,14 @@
|
||||
|
||||
package net.minecraft.src.forge;
|
||||
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.World;
|
||||
|
||||
/**
|
||||
* This interface provides access to a number of secondary block properties through providing
|
||||
* overrides to methods within world.class.
|
||||
*
|
||||
* This interface is DEPRECATED. The functions are now provided directly by
|
||||
* Block.
|
||||
*/
|
||||
|
||||
public interface IBlockSecondaryProperties
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* This software is provided under the terms of the Minecraft Forge Public
|
||||
* License v1.0.
|
||||
*/
|
||||
|
||||
package net.minecraft.src.forge;
|
||||
|
||||
import net.minecraft.src.World;
|
||||
|
||||
public interface IBonemealHandler {
|
||||
/** Called when bonemeal is used on a block. This is also called for
|
||||
* multiplayer servers, which must still return true if appropriate but
|
||||
* shouldn't actually perform world manipulation.
|
||||
* @return true to use up the bonemeal and stop processing.
|
||||
*/
|
||||
public boolean onUseBonemeal(World world, int bid, int i, int j, int k);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* This software is provided under the terms of the Minecraft Forge Public
|
||||
* License v1.0.
|
||||
*/
|
||||
|
||||
package net.minecraft.src.forge;
|
||||
|
||||
import net.minecraft.src.IInventory;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.ItemStack;
|
||||
|
||||
public interface ICraftingHandler {
|
||||
|
||||
/**
|
||||
* Called after an item is taken from crafting.
|
||||
*/
|
||||
public void onTakenFromCrafting(EntityPlayer player, ItemStack ist,
|
||||
IInventory craftMatrix);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* This software is provided under the terms of the Minecraft Forge Public
|
||||
* License v1.0.
|
||||
*/
|
||||
|
||||
package net.minecraft.src.forge;
|
||||
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
|
||||
public interface IDestroyToolHandler {
|
||||
/** Called when the user's currently equipped item is destroyed.
|
||||
*/
|
||||
public void onDestroyCurrentItem(EntityPlayer player, ItemStack orig);
|
||||
}
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
/**
|
||||
* This software is provided under the terms of the Minecraft Forge Public
|
||||
* License v1.0.
|
||||
*/
|
||||
|
||||
package net.minecraft.src.forge;
|
||||
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.ItemTool;
|
||||
|
||||
public interface IHarvestHandler {
|
||||
|
||||
/**
|
||||
* Return true if the tool in parameter is known to be able to harvest
|
||||
* the given block, false if this handler does not know of any particular
|
||||
* harvesting. Other rules may activate the harvesting outside of this
|
||||
* handler. This is typically used to add e.g. blocks only extracted by
|
||||
* diamond pickaxe
|
||||
*
|
||||
* @see MinecraftForge#registerHarvestHandler(IHarvestHandler)
|
||||
*/
|
||||
public boolean canHarvestBlock(ItemTool item, Block block);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* This software is provided under the terms of the Minecraft Forge Public
|
||||
* License v1.0.
|
||||
*/
|
||||
|
||||
package net.minecraft.src.forge;
|
||||
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
|
||||
public interface IHoeHandler {
|
||||
/** Called when a hoe is used on a block. This is called on both sides
|
||||
* in SMP.
|
||||
* @return true to consume a use of the hoe and return.
|
||||
*/
|
||||
public boolean onUseHoe(ItemStack hoe, EntityPlayer player, World world,
|
||||
int i, int j, int k);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* This software is provided under the terms of the Minecraft Forge Public
|
||||
* License v1.0.
|
||||
*/
|
||||
|
||||
package net.minecraft.src.forge;
|
||||
|
||||
import net.minecraft.src.ItemStack;
|
||||
|
||||
/** The current list of known classes.
|
||||
* oreTin, oreCopper, oreSilver, oreUranium
|
||||
* ingotTin, ingotCopper, ingotSilver, ingotBrass, ingotBronze
|
||||
* ingotUranium, ingotRefinedIron
|
||||
* dyeBlue
|
||||
* gemRuby, gemEmerald, gemSapphire
|
||||
* itemDropUranium
|
||||
* woodRubber
|
||||
* itemRubber
|
||||
*/
|
||||
|
||||
public interface IOreHandler {
|
||||
/** Called when a new ore is registered with the ore dictionary.
|
||||
* @param oreClass The string class of the ore.
|
||||
* @param ore The ItemStack for the ore.
|
||||
*/
|
||||
public void registerOre(String oreClass, ItemStack ore);
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import net.minecraft.src.World;
|
||||
* to control how it can be replaced
|
||||
*
|
||||
* @see Block
|
||||
* @deprecated. This functionality will be removed soon.
|
||||
*/
|
||||
public interface IOverrideReplace {
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* This software is provided under the terms of the Minecraft Forge Public
|
||||
* License v1.0.
|
||||
*/
|
||||
|
||||
package net.minecraft.src.forge;
|
||||
|
||||
import net.minecraft.src.IInventory;
|
||||
|
||||
/** Inventory ranges mapped by side. This class is implemented by TileEntities
|
||||
* that provide different inventory slot ranges to different sides.
|
||||
*/
|
||||
public interface ISidedInventory extends IInventory {
|
||||
|
||||
/**
|
||||
* Get the start of the side inventory.
|
||||
* @param side The global side to get the start of range.
|
||||
* 0: -Y (bottom side)
|
||||
* 1: +Y (top side)
|
||||
* 2: -Z
|
||||
* 3: +Z
|
||||
* 4: -X
|
||||
* 5: +x
|
||||
*/
|
||||
int getStartInventorySide(int side);
|
||||
|
||||
/**
|
||||
* Get the size of the side inventory.
|
||||
* @param side The global side.
|
||||
*/
|
||||
int getSizeInventorySide(int side);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* This software is provided under the terms of the Minecraft Forge Public
|
||||
* License v1.0.
|
||||
*/
|
||||
|
||||
package net.minecraft.src.forge;
|
||||
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.EnumStatus;
|
||||
|
||||
public interface ISleepHandler {
|
||||
/**
|
||||
* This is called before a player sleeps in a bed. If it returns a
|
||||
* non-null result, then the normal sleeping process will be skipped, and
|
||||
* the value returned by this method will be returned to
|
||||
* BlockBed.blockActivated.
|
||||
*
|
||||
* @see MinecraftForge#registerSleepHandler(ISleepHandler)
|
||||
*/
|
||||
public EnumStatus sleepInBedAt(EntityPlayer player, int i, int j, int k);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
package net.minecraft.src.forge;
|
||||
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.ItemArmor;
|
||||
|
||||
/**
|
||||
@@ -15,13 +16,10 @@ import net.minecraft.src.ItemArmor;
|
||||
* @see ItemArmor
|
||||
*/
|
||||
public interface ISpecialArmor {
|
||||
/**
|
||||
* This interface will adjust the amount of damage received by the entity.
|
||||
*/
|
||||
public int adjustArmorDamage (int damage);
|
||||
|
||||
/**
|
||||
* When this return true, the regular armor computation will be cancelled
|
||||
* Return extra properties for the armor
|
||||
*/
|
||||
public boolean allowRegularComputation ();
|
||||
public ArmorProperties getProperties(EntityPlayer player,
|
||||
int intitialDamage, int currentDamage);
|
||||
}
|
||||
@@ -5,32 +5,56 @@
|
||||
|
||||
package net.minecraft.src.forge;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.src.BiomeGenBase;
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.Item;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.ItemTool;
|
||||
import net.minecraft.src.World;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class MinecraftForge {
|
||||
|
||||
private static LinkedList<IBucketHandler> bucketHandlers = new LinkedList<IBucketHandler>();
|
||||
private static LinkedList<IHarvestHandler> harvestHandlers = new LinkedList<IHarvestHandler>();
|
||||
|
||||
/**
|
||||
* Registers a new custom bucket handler.
|
||||
* Register a new custom bucket handler.
|
||||
*/
|
||||
public static void registerCustomBucketHander(IBucketHandler handler) {
|
||||
public static void registerCustomBucketHandler(IBucketHandler handler) {
|
||||
bucketHandlers.add(handler);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Registers a new harvest handler.
|
||||
* Registers a new sleeping handler.
|
||||
*/
|
||||
public static void registerHarvestHandler(IHarvestHandler handler) {
|
||||
harvestHandlers.add(handler);
|
||||
public static void registerSleepHandler(ISleepHandler handler) {
|
||||
ForgeHooks.sleepHandlers.add(handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a new bonemeal handler.
|
||||
*/
|
||||
public static void registerBonemealHandler(IBonemealHandler handler) {
|
||||
ForgeHooks.bonemealHandlers.add(handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a new hoe handler.
|
||||
*/
|
||||
public static void registerHoeHandler(IHoeHandler handler) {
|
||||
ForgeHooks.hoeHandlers.add(handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a new destroy tool handler.
|
||||
*/
|
||||
public static void registerDestroyToolHandler(IDestroyToolHandler handler) {
|
||||
ForgeHooks.destroyToolHandlers.add(handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a new crafting handler.
|
||||
*/
|
||||
public static void registerCraftingHandler(ICraftingHandler handler) {
|
||||
ForgeHooks.craftingHandlers.add(handler);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,28 +72,297 @@ public class MinecraftForge {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is not supposed to be called outside of Minecraft internals.
|
||||
// Ore Dictionary
|
||||
// ------------------------------------------------------------
|
||||
private static LinkedList<IOreHandler> oreHandlers = new LinkedList<IOreHandler>();
|
||||
private static TreeMap<String,List<ItemStack>> oreDict=
|
||||
new TreeMap<String,List<ItemStack>>();
|
||||
|
||||
/** Register a new ore handler. This will automatically call the handler
|
||||
* with all current ores during registration, and every time a new ore is
|
||||
* added later.
|
||||
*/
|
||||
public static boolean canHarvestBlock(ItemTool item, Block block) {
|
||||
for (IHarvestHandler handler : harvestHandlers) {
|
||||
if (handler.canHarvestBlock(item, block)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
public static void registerOreHandler(IOreHandler handler) {
|
||||
oreHandlers.add(handler);
|
||||
|
||||
for(String key : oreDict.keySet()) {
|
||||
List<ItemStack> val=oreDict.get(key);
|
||||
for(ItemStack ist : val) {
|
||||
handler.registerOre(key,ist);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Register a new item with the ore dictionary.
|
||||
* @param oreClass The string class of the ore.
|
||||
* @param ore The ItemStack for the ore.
|
||||
*/
|
||||
public static void registerOre(String oreClass, ItemStack ore) {
|
||||
List<ItemStack> orelist=oreDict.get(oreClass);
|
||||
if(orelist==null) {
|
||||
orelist=new ArrayList<ItemStack>();
|
||||
oreDict.put(oreClass,orelist);
|
||||
}
|
||||
orelist.add(ore);
|
||||
for(IOreHandler ioh : oreHandlers) {
|
||||
ioh.registerOre(oreClass,ore);
|
||||
}
|
||||
}
|
||||
|
||||
/** Get the list of ores in a given class.
|
||||
*/
|
||||
public static List<ItemStack> getOreClass(String oreClass) {
|
||||
return oreDict.get(oreClass);
|
||||
}
|
||||
|
||||
public static class OreQuery implements Iterable<Object[]> {
|
||||
Object[] proto;
|
||||
|
||||
public class OreQueryIterator implements Iterator<Object[]> {
|
||||
LinkedList itering;
|
||||
LinkedList output;
|
||||
|
||||
private OreQueryIterator() {
|
||||
itering=new LinkedList();
|
||||
output=new LinkedList();
|
||||
|
||||
for(int i=0; i<proto.length; i++) {
|
||||
if(proto[i] instanceof Collection) {
|
||||
Iterator it=((Collection)proto[i])
|
||||
.iterator();
|
||||
if(!it.hasNext()) {
|
||||
output=null; break;
|
||||
}
|
||||
itering.addLast(it);
|
||||
output.addLast(it.next());
|
||||
} else {
|
||||
itering.addLast(proto[i]);
|
||||
output.addLast(proto[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasNext() {
|
||||
return output!=null;
|
||||
}
|
||||
|
||||
public Object[] next() {
|
||||
Object[] tr=output.toArray();
|
||||
|
||||
Object to;
|
||||
while(true) {
|
||||
if(itering.size()==0) {
|
||||
output=null;
|
||||
return tr;
|
||||
}
|
||||
to=itering.getLast();
|
||||
output.removeLast();
|
||||
if(to instanceof Iterator) {
|
||||
Iterator it=(Iterator)to;
|
||||
if(it.hasNext()) {
|
||||
output.addLast(it.next());
|
||||
break;
|
||||
}
|
||||
}
|
||||
itering.removeLast();
|
||||
}
|
||||
for(int i=itering.size(); i<proto.length; i++) {
|
||||
if(proto[i] instanceof Collection) {
|
||||
Iterator it=((Collection)proto[i])
|
||||
.iterator();
|
||||
if(!it.hasNext()) {
|
||||
output=null; break;
|
||||
}
|
||||
itering.addLast(it);
|
||||
output.addLast(it.next());
|
||||
} else {
|
||||
itering.addLast(proto[i]);
|
||||
output.addLast(proto[i]);
|
||||
}
|
||||
}
|
||||
return tr;
|
||||
}
|
||||
|
||||
public void remove() {}
|
||||
}
|
||||
|
||||
private OreQuery(Object[] pattern) {
|
||||
proto=pattern;
|
||||
}
|
||||
|
||||
public Iterator<Object[]> iterator() {
|
||||
return new OreQueryIterator();
|
||||
}
|
||||
}
|
||||
|
||||
/** Generate all valid legal recipe combinations. Any Lists in pattern
|
||||
* will be fully expanded to all valid combinations.
|
||||
*/
|
||||
public static OreQuery generateRecipes(Object... pattern) {
|
||||
return new OreQuery(pattern);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
|
||||
/** Register a new plant to be planted when bonemeal is used on grass.
|
||||
* @param bid The block ID to plant.
|
||||
* @param md The metadata to plant.
|
||||
* @param prop The relative probability of the plant, where red flowers are
|
||||
* 10 and yellow flowers are 20.
|
||||
*/
|
||||
public static void addGrassPlant(int item, int md, int prop) {
|
||||
ForgeHooks.addPlantGrass(item,md,prop);
|
||||
}
|
||||
|
||||
/** Register a new seed to be dropped when breaking tall grass.
|
||||
* @param bid The item ID of the seeds.
|
||||
* @param md The metadata of the seeds.
|
||||
* @param qty The quantity of seeds to drop.
|
||||
* @param prop The relative probability of the seeds, where wheat seeds are
|
||||
* 10.
|
||||
*/
|
||||
public static void addGrassSeed(int item, int md, int qty, int prop) {
|
||||
ForgeHooks.addGrassSeed(item,md,qty,prop);
|
||||
}
|
||||
|
||||
/** Register a tool as a tool class with a given harvest level.
|
||||
*
|
||||
* @param tool The custom tool to register.
|
||||
* @param tclass The tool class to register as. The predefined tool
|
||||
* clases are "pickaxe", "shovel", "axe". You can add others for custom
|
||||
* tools.
|
||||
* @param hlevel The harvest level of the tool.
|
||||
*/
|
||||
public static void setToolClass(Item tool, String tclass, int hlevel) {
|
||||
ForgeHooks.initTools();
|
||||
ForgeHooks.toolClasses.put(tool.shiftedIndex,
|
||||
Arrays.asList(tclass,hlevel));
|
||||
}
|
||||
|
||||
/** Register a block to be harvested by a tool class. This is the metadata
|
||||
* sensitive version, use it if your blocks are using metadata variants.
|
||||
* By default, this sets the block class as effective against that type.
|
||||
*
|
||||
* @param bl The block to register.
|
||||
* @param md The metadata for the block subtype.
|
||||
* @param tclass The tool class to register as able to remove this block.
|
||||
* You may register the same block multiple times with different tool
|
||||
* classes, if multiple tool types can be used to harvest this block.
|
||||
* @param hlevel The minimum tool harvest level required to successfully
|
||||
* harvest the block.
|
||||
* @see setToolClass for details on tool classes.
|
||||
*/
|
||||
public static void setBlockHarvestLevel(Block bl, int md, String tclass,
|
||||
int hlevel) {
|
||||
ForgeHooks.initTools();
|
||||
List key=Arrays.asList(bl.blockID,md,tclass);
|
||||
ForgeHooks.toolHarvestLevels.put(key,hlevel);
|
||||
ForgeHooks.toolEffectiveness.add(key);
|
||||
}
|
||||
|
||||
/** Remove a block effectiveness mapping. Since setBlockHarvestLevel
|
||||
* makes the tool class effective against the block by default, this can be
|
||||
* used to remove that mapping. This will force a block to be harvested at
|
||||
* the same speed regardless of tool quality, while still requiring a given
|
||||
* harvesting level.
|
||||
* @param bl The block to remove effectiveness from.
|
||||
* @param md The metadata for the block subtype.
|
||||
* @param tclass The tool class to remove the effectiveness mapping from.
|
||||
* @see setToolClass for details on tool classes.
|
||||
*/
|
||||
public static void removeBlockEffectiveness(Block bl, int md,
|
||||
String tclass) {
|
||||
ForgeHooks.initTools();
|
||||
List key=Arrays.asList(bl.blockID,md,tclass);
|
||||
ForgeHooks.toolEffectiveness.remove(key);
|
||||
}
|
||||
|
||||
/** Register a block to be harvested by a tool class.
|
||||
* By default, this sets the block class as effective against that type.
|
||||
*
|
||||
* @param bl The block to register.
|
||||
* @param tclass The tool class to register as able to remove this block.
|
||||
* You may register the same block multiple times with different tool
|
||||
* classes, if multiple tool types can be used to harvest this block.
|
||||
* @param hlevel The minimum tool harvest level required to successfully
|
||||
* harvest the block.
|
||||
* @see setToolClass for details on tool classes.
|
||||
*/
|
||||
public static void setBlockHarvestLevel(Block bl, String tclass,
|
||||
int hlevel) {
|
||||
ForgeHooks.initTools();
|
||||
for(int md=0; md<16; md++) {
|
||||
List key=Arrays.asList(bl.blockID,md,tclass);
|
||||
ForgeHooks.toolHarvestLevels.put(key,hlevel);
|
||||
ForgeHooks.toolEffectiveness.add(key);
|
||||
}
|
||||
}
|
||||
|
||||
/** Remove a block effectiveness mapping. Since setBlockHarvestLevel
|
||||
* makes the tool class effective against the block by default, this can be
|
||||
* used to remove that mapping. This will force a block to be harvested at
|
||||
* the same speed regardless of tool quality, while still requiring a given
|
||||
* harvesting level.
|
||||
* @param bl The block to remove effectiveness from.
|
||||
* @param tclass The tool class to remove the effectiveness mapping from.
|
||||
* @see setToolClass for details on tool classes.
|
||||
*/
|
||||
public static void removeBlockEffectiveness(Block bl, String tclass) {
|
||||
ForgeHooks.initTools();
|
||||
for(int md=0; md<16; md++) {
|
||||
List key=Arrays.asList(bl.blockID,md,tclass);
|
||||
ForgeHooks.toolEffectiveness.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a block to the list of blocks to which the pickaxe is know to be
|
||||
* effective.
|
||||
* Kill minecraft with an error message.
|
||||
*/
|
||||
public static void addPickaxeBlockEffectiveAgainst (Block block) {
|
||||
((ItemTool) Item.pickaxeWood).addBlockEffectiveAgainst(block);
|
||||
((ItemTool) Item.pickaxeStone).addBlockEffectiveAgainst(block);
|
||||
((ItemTool) Item.pickaxeSteel).addBlockEffectiveAgainst(block);
|
||||
((ItemTool) Item.pickaxeGold).addBlockEffectiveAgainst(block);
|
||||
((ItemTool) Item.pickaxeDiamond).addBlockEffectiveAgainst(block);
|
||||
public static void killMinecraft(String modname, String msg) {
|
||||
throw new RuntimeException(modname+": "+msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Version checking. Ensures that a sufficiently recent version of Forge
|
||||
* is installed. Will result in a fatal error if the major versions
|
||||
* mismatch or if the version is too old. Will print a warning message if
|
||||
* the minor versions don't match.
|
||||
*/
|
||||
public static void versionDetect(String modname,
|
||||
int major, int minor, int revision) {
|
||||
if(major!=ForgeHooks.majorVersion) {
|
||||
killMinecraft(modname,"MinecraftForge Major Version Mismatch, expecting "+major+".x.x");
|
||||
} else if(minor!=ForgeHooks.minorVersion) {
|
||||
if(minor>ForgeHooks.minorVersion) {
|
||||
killMinecraft(modname,"MinecraftForge Too Old, need at least "+major+"."+minor+"."+revision);
|
||||
} else {
|
||||
System.out.println(modname + ": MinecraftForge minor version mismatch, expecting "+major+"."+minor+".x, may lead to unexpected behavior");
|
||||
}
|
||||
} else if(revision>ForgeHooks.revisionVersion) {
|
||||
killMinecraft(modname,"MinecraftForge Too Old, need at least "+major+"."+minor+"."+revision);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Strict version checking. Ensures that a sufficiently recent version of
|
||||
* Forge is installed. Will result in a fatal error if the major or minor
|
||||
* versions mismatch or if the version is too old. Use this function for
|
||||
* mods that use recent, new, or unstable APIs to prevent
|
||||
* incompatibilities.
|
||||
*/
|
||||
public static void versionDetectStrict(String modname,
|
||||
int major, int minor, int revision) {
|
||||
if(major!=ForgeHooks.majorVersion) {
|
||||
killMinecraft(modname,"MinecraftForge Major Version Mismatch, expecting "+major+".x.x");
|
||||
} else if(minor!=ForgeHooks.minorVersion) {
|
||||
if(minor>ForgeHooks.minorVersion) {
|
||||
killMinecraft(modname,"MinecraftForge Too Old, need at least "+major+"."+minor+"."+revision);
|
||||
} else {
|
||||
killMinecraft(modname,"MinecraftForge minor version mismatch, expecting "+major+"."+minor+".x");
|
||||
}
|
||||
} else if(revision>ForgeHooks.revisionVersion) {
|
||||
killMinecraft(modname,"MinecraftForge Too Old, need at least "+major+"."+minor+"."+revision);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
*** HOW TO INSTALL ***
|
||||
|
||||
The forge directory should have been uncompacted right under your MCP root
|
||||
directory.
|
||||
Extract the download archive directly into your MCP-directiory.
|
||||
It should create a folder "forge" within that directory, containing all
|
||||
extracted files.
|
||||
|
||||
You should a a fresh minecraft and minecraft_server.jar freshly decompiled
|
||||
with ModLoader and ModLoaderMP.
|
||||
You should use freshly decompiled jars, solely including ModLoader &
|
||||
ModLoaderMP respectively. Anything else can eventually cause conflicts.
|
||||
|
||||
Now just start the install-bat, MCForge will install itself into the proper
|
||||
locations and copy all ned files, as well as modifying the ned baseclasses.
|
||||
|
||||
Just run the script install.bat. It will copy the Minecraft Forge source on your
|
||||
src directory, and modify the Minecraft source files.
|
||||
@@ -1,8 +1,31 @@
|
||||
set HOME=%CD%
|
||||
set MCP=%HOME%\..
|
||||
xcopy /Y /E src\* ..\src
|
||||
echo off
|
||||
|
||||
cd %MCP%\src
|
||||
%MCP%\runtime\bin\python\python_mcp %HOME%\lfcr.py %HOME%\minecraft.patch %HOME%\minecraft-win.patch
|
||||
%MCP%\runtime\bin\applydiff.exe -uf -p2 < %HOME%\minecraft-win.patch
|
||||
pause
|
||||
echo MinecraftForge Windows Setup Program
|
||||
echo:
|
||||
|
||||
pushd .. >nul
|
||||
|
||||
cmd /C cleanup.bat
|
||||
cmd /C decompile.bat
|
||||
|
||||
pushd src >nul
|
||||
del minecraft\net\minecraft\src\MLProp.java
|
||||
copy ..\forge\MLProp.java minecraft\net\minecraft\src\MLProp.java
|
||||
del minecraft_server\net\minecraft\src\MLProp.java
|
||||
copy ..\forge\MLProp.java minecraft_server\net\minecraft\src\MLProp.java
|
||||
|
||||
..\runtime\bin\python\python_mcp ..\forge\lfcr.py ../forge/modLoaderMP.patch ../forge/modLoaderMP.patch
|
||||
..\runtime\bin\applydiff.exe -uf -p2 -i ../forge/modLoaderMP.patch
|
||||
|
||||
for /f "delims=" %%a in ('dir /a -d /b /S ..\forge\patches') do (
|
||||
pushd "%%a" 2>nul
|
||||
if errorlevel 1 (
|
||||
..\runtime\bin\python\python_mcp ..\forge\lfcr.py "%%a" "%%a"
|
||||
..\runtime\bin\applydiff.exe -uf -p2 -i "%%a"
|
||||
) else popd
|
||||
)
|
||||
popd >nul
|
||||
|
||||
xcopy /Y /E forge\src\* src
|
||||
|
||||
cmd /C updatemd5.bat
|
||||
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "MinecraftForge Linux Setup Program"
|
||||
echo
|
||||
|
||||
pushd .. > /dev/null
|
||||
|
||||
./cleanup.sh
|
||||
./decompile.sh
|
||||
|
||||
pushd src > /dev/null
|
||||
find . -name *.java -exec sed -i 's/\r//g' \{\} \;
|
||||
cp ../forge/MLProp.java minecraft/net/minecraft/src/MLProp.java
|
||||
cp ../forge/MLProp.java minecraft_server/net/minecraft/src/MLProp.java
|
||||
patch -p2 -i ../forge/modLoaderMP.patch
|
||||
#patch -p1 -i ../forge/mlprop.patch
|
||||
for i in `find ../forge/patches/ -type f`
|
||||
do
|
||||
patch -p2 -i $i
|
||||
done
|
||||
popd > /dev/null
|
||||
|
||||
cp -r forge/src/* src
|
||||
|
||||
./updatemd5.sh
|
||||
File diff suppressed because it is too large.
Load diff
Executable
+18
@@ -0,0 +1,18 @@
|
||||
* Eloraam *
|
||||
|
||||
* FlowerChild *
|
||||
|
||||
* Hawkye *
|
||||
|
||||
* MALfunction84 *
|
||||
|
||||
Submitted the sleep handler code for his mod (Somnia) and others to use.
|
||||
|
||||
* Scokeev9 *
|
||||
|
||||
Gave permission for ScotTools API to be integrated into MCF, and also supported the Forge by converting his mods to use it.
|
||||
|
||||
ScotTools Background: ScotTools was an API that enabled modders to add blocks to harvesting levels (and many other ease-of-use features to create new tools), and the first tool API that used block material for block breaking efficiency which allowed blocks from mods that didn't use ScotTools API to break with the correct speed.
|
||||
|
||||
* SpaceToad *
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
diff -ru src/minecraft/net/minecraft/src/MLProp.java src_fix/minecraft/net/minecraft/src/MLProp.java
|
||||
--- src/minecraft/net/minecraft/src/MLProp.java 2011-08-04 20:10:17.000000000 -0400
|
||||
+++ src_fix/minecraft/net/minecraft/src/MLProp.java 2011-08-04 20:12:55.000000000 -0400
|
||||
@@ -1,20 +1,11 @@
|
||||
-// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
|
||||
-// Jad home page: http://www.kpdus.com/jad.html
|
||||
-// Decompiler options: packimports(3) braces deadcode
|
||||
-
|
||||
-package net.minecraft.src;
|
||||
-
|
||||
-import java.lang.annotation.Annotation;
|
||||
-
|
||||
-public interface MLProp
|
||||
- extends Annotation
|
||||
-{
|
||||
-
|
||||
- public abstract String name();
|
||||
-
|
||||
- public abstract String info();
|
||||
-
|
||||
- public abstract double min();
|
||||
-
|
||||
- public abstract double max();
|
||||
-}
|
||||
+package net.minecraft.src;
|
||||
+import java.lang.annotation.*;
|
||||
+
|
||||
+@Retention(RetentionPolicy.RUNTIME)
|
||||
+@Target(ElementType.FIELD)
|
||||
+public @interface MLProp {
|
||||
+ String name() default "";
|
||||
+ String info() default "";
|
||||
+ double min() default Double.NEGATIVE_INFINITY;
|
||||
+ double max() default Double.POSITIVE_INFINITY;
|
||||
+}
|
||||
diff -ru src/minecraft_server/net/minecraft/src/MLProp.java src_fix/minecraft_server/net/minecraft/src/MLProp.java
|
||||
--- src/minecraft_server/net/minecraft/src/MLProp.java 2011-08-04 20:10:17.000000000 -0400
|
||||
+++ src_fix/minecraft_server/net/minecraft/src/MLProp.java 2011-08-04 20:13:00.000000000 -0400
|
||||
@@ -1,20 +1,11 @@
|
||||
-// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
|
||||
-// Jad home page: http://www.kpdus.com/jad.html
|
||||
-// Decompiler options: packimports(3) braces deadcode
|
||||
-
|
||||
-package net.minecraft.src;
|
||||
-
|
||||
-import java.lang.annotation.Annotation;
|
||||
-
|
||||
-public interface MLProp
|
||||
- extends Annotation
|
||||
-{
|
||||
-
|
||||
- public abstract String name();
|
||||
-
|
||||
- public abstract String info();
|
||||
-
|
||||
- public abstract double min();
|
||||
-
|
||||
- public abstract double max();
|
||||
-}
|
||||
+package net.minecraft.src;
|
||||
+import java.lang.annotation.*;
|
||||
+
|
||||
+@Retention(RetentionPolicy.RUNTIME)
|
||||
+@Target(ElementType.FIELD)
|
||||
+public @interface MLProp {
|
||||
+ String name() default "";
|
||||
+ String info() default "";
|
||||
+ double min() default Double.NEGATIVE_INFINITY;
|
||||
+ double max() default Double.POSITIVE_INFINITY;
|
||||
+}
|
||||
@@ -57,3 +57,14 @@ diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/server
|
||||
|
||||
private void doTick()
|
||||
{
|
||||
diff U3 ../src_base/minecraft_server/net/minecraft/src/MLProp.java ../src_work/minecraft_server/net/minecraft/src/MLProp.java
|
||||
--- ../src_base/minecraft_server/net/minecraft/src/MLProp.java Wed Nov 30 22:27:22 2011
|
||||
+++ ../src_work/minecraft_server/net/minecraft/src/MLProp.java Sun Dec 04 14:31:04 2011
|
||||
@@ -8,4 +8,6 @@
|
||||
String info() default "";
|
||||
double min() default Double.NEGATIVE_INFINITY;
|
||||
double max() default Double.POSITIVE_INFINITY;
|
||||
+
|
||||
+ public int reobf() default 0;
|
||||
}
|
||||
\ No newline at end of file
|
||||
+11
-1
@@ -22,7 +22,10 @@ function remove_svn () {
|
||||
function package_all () {
|
||||
qual=$1
|
||||
|
||||
cp $build_dir/minecraftforge_credits.txt .
|
||||
|
||||
zip -r $dir/minecraftforge$qual-$version.zip \
|
||||
minecraftforge_credits.txt \
|
||||
*.class \
|
||||
forge
|
||||
}
|
||||
@@ -51,18 +54,25 @@ cd forge
|
||||
mkdir src
|
||||
mkdir src/minecraft
|
||||
mkdir src/minecraft_server
|
||||
mkdir patches
|
||||
cp -r ../forge_client/src/* src/minecraft
|
||||
cp -r ../forge_server/src/* src/minecraft_server
|
||||
cp -r ../forge_common/* src/minecraft
|
||||
cp -r ../forge_common/* src/minecraft_server
|
||||
cp ../minecraft.patch .
|
||||
cp -r ../patches/* patches
|
||||
cp ../lfcr.py .
|
||||
cp ../install/install.cmd .
|
||||
cp ../install/install.sh .
|
||||
cp ../modLoaderMP.patch .
|
||||
cp ../MLProp.java .
|
||||
cp ../install/README.txt .
|
||||
cp ../minecraftforge_credits.txt .
|
||||
cp -r ../doc .
|
||||
|
||||
cd src
|
||||
remove_svn .
|
||||
cd ../patches
|
||||
remove_svn .
|
||||
cd ..
|
||||
|
||||
cd ..
|
||||
|
||||
@@ -0,0 +1,226 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/Block.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/Block.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
package net.minecraft.src;
|
||||
|
||||
+import net.minecraft.src.forge.ForgeHooks;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
@@ -312,12 +313,14 @@
|
||||
|
||||
public float getBlockBrightness(IBlockAccess iblockaccess, int i, int j, int k)
|
||||
{
|
||||
- return iblockaccess.getBrightness(i, j, k, lightValue[blockID]);
|
||||
+ return iblockaccess.getBrightness(i, j, k,
|
||||
+ getLightValue(iblockaccess,i,j,k));
|
||||
}
|
||||
|
||||
public int getMixedBrightnessForBlock(IBlockAccess iblockaccess, int i, int j, int k)
|
||||
{
|
||||
- return iblockaccess.getLightBrightnessForSkyBlocks(i, j, k, lightValue[blockID]);
|
||||
+ return iblockaccess.getLightBrightnessForSkyBlocks(i, j, k,
|
||||
+ getLightValue(iblockaccess,i,j,k));
|
||||
}
|
||||
|
||||
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
|
||||
@@ -438,25 +441,56 @@
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
-
|
||||
+
|
||||
+ /* FORGE: Metadata-sensitive version.
|
||||
+ */
|
||||
+ public int quantityDropped(int meta, int fortune, Random random)
|
||||
+ {
|
||||
+ return func_40198_a(fortune, random);
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Metadata-sensitive version.
|
||||
+ */
|
||||
+ public int quantityDropped(int meta, Random random)
|
||||
+ {
|
||||
+ return quantityDropped(meta, 0, random);
|
||||
+ }
|
||||
+
|
||||
public int idDropped(int i, Random random, int j)
|
||||
{
|
||||
return blockID;
|
||||
}
|
||||
|
||||
+ /* FORGE: This function isnt called by Minecraft anymore. Use
|
||||
+ * blockStrength(EntityPlayer,int) instead.
|
||||
+ */
|
||||
public float blockStrength(EntityPlayer entityplayer)
|
||||
{
|
||||
- if(blockHardness < 0.0F)
|
||||
- {
|
||||
- return 0.0F;
|
||||
- }
|
||||
- if(!entityplayer.canHarvestBlock(this))
|
||||
- {
|
||||
- return 1.0F / blockHardness / 100F;
|
||||
- } else
|
||||
- {
|
||||
- return entityplayer.getCurrentPlayerStrVsBlock(this) / blockHardness / 30F;
|
||||
- }
|
||||
+ return blockStrength(entityplayer,0);
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: This function returns the complete list of drops for a block.
|
||||
+ */
|
||||
+ public ArrayList<ItemStack> getBlockDropped(World world,
|
||||
+ int i, int j, int k, int md, int fortune) {
|
||||
+
|
||||
+ ArrayList<ItemStack> tr = new ArrayList<ItemStack>();
|
||||
+
|
||||
+ int q = quantityDropped(md, fortune, world.rand);
|
||||
+ for (int n = 0; n < q; n++) {
|
||||
+ int id = idDropped(md, world.rand, 0);
|
||||
+ if(id > 0) {
|
||||
+ tr.add(new ItemStack(id, 1, damageDropped(md)));
|
||||
+ }
|
||||
+ }
|
||||
+ return tr;
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: This function returns the complete list of drops for a block.
|
||||
+ */
|
||||
+ public ArrayList<ItemStack> getBlockDropped(World world,
|
||||
+ int i, int j, int k, int md) {
|
||||
+ return getBlockDropped (world, i, j, k, md);
|
||||
}
|
||||
|
||||
public final void dropBlockAsItem(World world, int i, int j, int k, int l, int i1)
|
||||
@@ -470,18 +504,13 @@
|
||||
{
|
||||
return;
|
||||
}
|
||||
- int j1 = func_40198_a(i1, world.rand);
|
||||
- for(int k1 = 0; k1 < j1; k1++)
|
||||
- {
|
||||
+ ArrayList<ItemStack> ar = getBlockDropped(world, i, j, k, l, i1);
|
||||
+ for (ItemStack ist : ar) {
|
||||
if(world.rand.nextFloat() > f)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
- int l1 = idDropped(l, world.rand, i1);
|
||||
- if(l1 > 0)
|
||||
- {
|
||||
- dropBlockAsItem_do(world, i, j, k, new ItemStack(l1, 1, damageDropped(l)));
|
||||
- }
|
||||
+ dropBlockAsItem_do(world, i, j, k, ist);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -805,6 +834,107 @@
|
||||
return iblockaccess.isBlockNormalCube(i, j, k) ? 0.2F : 1.0F;
|
||||
}
|
||||
|
||||
+ /* FORGE: Allow a block to set illumination on a coordinate basis.
|
||||
+ */
|
||||
+ public int getLightValue(IBlockAccess iba, int i, int j, int k) {
|
||||
+ return lightValue[blockID];
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Implement and return true if you wish this block to behave
|
||||
+ * like a ladder when the player is inside.
|
||||
+ */
|
||||
+ public boolean isLadder() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Return true if the block is a normal, solid cube. This
|
||||
+ * determines indirect power state, entity ejection from blocks, and a few
|
||||
+ * others.
|
||||
+ */
|
||||
+ public boolean isBlockNormalCube(World world, int i, int j, int k) {
|
||||
+ return blockMaterial.getIsOpaque() && renderAsNormalBlock();
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Return true if the block is solid on the given side. This
|
||||
+ * is used by placement logic. */
|
||||
+ public boolean isBlockSolidOnSide( World world, int i, int j, int k,
|
||||
+ int side ) {
|
||||
+ return isBlockNormalCube(world,i,j,k);
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Return true if the player can place a new block in the block
|
||||
+ * occupied by this one, like water, lava, fire, etc.
|
||||
+ */
|
||||
+ public boolean isBlockReplaceable( World world, int i, int j, int k ) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Return true if this block should set fire and deal fire damage
|
||||
+ * to entities coming into contact with it, false otherwise.
|
||||
+ */
|
||||
+ public boolean isBlockBurning( World world, int i, int j, int k ) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Return true if this block should be treated as an air block
|
||||
+ * by the rest of the code, false otherwise. This method is primarily
|
||||
+ * useful for creating pure logic-blocks that will be invisible
|
||||
+ * to the player and otherwise interact as air would.
|
||||
+ */
|
||||
+ public boolean isAirBlock( World world, int i, int j, int k ) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Return the block hardness with metadata md.
|
||||
+ */
|
||||
+ public float getHardness(int md) {
|
||||
+ return blockHardness;
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Return the block strength of the block at i,j,k against the
|
||||
+ * player.
|
||||
+ */
|
||||
+ public float blockStrength(World world, EntityPlayer player,
|
||||
+ int i, int j, int k) {
|
||||
+ int md=world.getBlockMetadata(i,j,k);
|
||||
+ return blockStrength(player,md);
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Return the block strength of a prototypical block with metadata
|
||||
+ * md against the player.
|
||||
+ */
|
||||
+ public float blockStrength(EntityPlayer player, int md) {
|
||||
+ return ForgeHooks.blockStrength(this,player,md);
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Return true if the player can harvest a prototypical block with
|
||||
+ * metadata md.
|
||||
+ */
|
||||
+ public boolean canHarvestBlock(EntityPlayer player, int md) {
|
||||
+ return ForgeHooks.canHarvestBlock(this,player,md);
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Called when a player removes a block. This is responsible for
|
||||
+ * actually destroying the block, and the block is intact at time of call.
|
||||
+ * This is called regardless of whether the player can harvest the block or
|
||||
+ * not. Return true if the block is actually destroyed.
|
||||
+ *
|
||||
+ * Note: When used in multiplayer, this is called on both client and
|
||||
+ * server sides!
|
||||
+ */
|
||||
+ public boolean removeBlockByPlayer(World world, EntityPlayer player,
|
||||
+ int i, int j, int k) {
|
||||
+ return world.setBlockWithNotify(i, j, k, 0);
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Called when a new CreativeContainer is opened, populate the list
|
||||
+ * with all of the items for this block you want a player in creative mode
|
||||
+ * to have access to.
|
||||
+ */
|
||||
+ public void addCreativeItems(ArrayList itemList)
|
||||
+ {
|
||||
+ }
|
||||
+
|
||||
static Class _mthclass$(String s)
|
||||
{
|
||||
try
|
||||
@@ -0,0 +1,119 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/BlockButton.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/BlockButton.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -41,36 +41,36 @@
|
||||
|
||||
public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l)
|
||||
{
|
||||
- if(l == 2 && world.isBlockNormalCube(i, j, k + 1))
|
||||
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(l == 3 && world.isBlockNormalCube(i, j, k - 1))
|
||||
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(l == 4 && world.isBlockNormalCube(i + 1, j, k))
|
||||
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- return l == 5 && world.isBlockNormalCube(i - 1, j, k);
|
||||
+ return l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5);
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World world, int i, int j, int k)
|
||||
{
|
||||
- if(world.isBlockNormalCube(i - 1, j, k))
|
||||
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(world.isBlockNormalCube(i + 1, j, k))
|
||||
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(world.isBlockNormalCube(i, j, k - 1))
|
||||
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- return world.isBlockNormalCube(i, j, k + 1);
|
||||
+ return world.isBlockSolidOnSide(i, j, k + 1,2);
|
||||
}
|
||||
|
||||
public void onBlockPlaced(World world, int i, int j, int k, int l)
|
||||
@@ -78,19 +78,19 @@
|
||||
int i1 = world.getBlockMetadata(i, j, k);
|
||||
int j1 = i1 & 8;
|
||||
i1 &= 7;
|
||||
- if(l == 2 && world.isBlockNormalCube(i, j, k + 1))
|
||||
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
|
||||
{
|
||||
i1 = 4;
|
||||
} else
|
||||
- if(l == 3 && world.isBlockNormalCube(i, j, k - 1))
|
||||
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
|
||||
{
|
||||
i1 = 3;
|
||||
} else
|
||||
- if(l == 4 && world.isBlockNormalCube(i + 1, j, k))
|
||||
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
|
||||
{
|
||||
i1 = 2;
|
||||
} else
|
||||
- if(l == 5 && world.isBlockNormalCube(i - 1, j, k))
|
||||
+ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5))
|
||||
{
|
||||
i1 = 1;
|
||||
} else
|
||||
@@ -102,19 +102,19 @@
|
||||
|
||||
private int getOrientation(World world, int i, int j, int k)
|
||||
{
|
||||
- if(world.isBlockNormalCube(i - 1, j, k))
|
||||
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
- if(world.isBlockNormalCube(i + 1, j, k))
|
||||
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
- if(world.isBlockNormalCube(i, j, k - 1))
|
||||
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
- return !world.isBlockNormalCube(i, j, k + 1) ? 1 : 4;
|
||||
+ return !world.isBlockSolidOnSide(i, j, k + 1,2) ? 1 : 4;
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
|
||||
@@ -123,19 +123,19 @@
|
||||
{
|
||||
int i1 = world.getBlockMetadata(i, j, k) & 7;
|
||||
boolean flag = false;
|
||||
- if(!world.isBlockNormalCube(i - 1, j, k) && i1 == 1)
|
||||
+ if(!world.isBlockSolidOnSide(i - 1, j, k,5) && i1 == 1)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(!world.isBlockNormalCube(i + 1, j, k) && i1 == 2)
|
||||
+ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(!world.isBlockNormalCube(i, j, k - 1) && i1 == 3)
|
||||
+ if(!world.isBlockSolidOnSide(i, j, k - 1,3) && i1 == 3)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(!world.isBlockNormalCube(i, j, k + 1) && i1 == 4)
|
||||
+ if(!world.isBlockSolidOnSide(i, j, k + 1,2) && i1 == 4)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/BlockChest.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/BlockChest.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -429,23 +429,23 @@
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(world.isBlockNormalCube(i, j + 1, k))
|
||||
+ if(world.isBlockSolidOnSide(i, j + 1, k,0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(world.getBlockId(i - 1, j, k) == blockID && world.isBlockNormalCube(i - 1, j + 1, k))
|
||||
+ if(world.getBlockId(i - 1, j, k) == blockID && world.isBlockSolidOnSide(i - 1, j + 1, k,0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(world.getBlockId(i + 1, j, k) == blockID && world.isBlockNormalCube(i + 1, j + 1, k))
|
||||
+ if(world.getBlockId(i + 1, j, k) == blockID && world.isBlockSolidOnSide(i + 1, j + 1, k,0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(world.getBlockId(i, j, k - 1) == blockID && world.isBlockNormalCube(i, j + 1, k - 1))
|
||||
+ if(world.getBlockId(i, j, k - 1) == blockID && world.isBlockSolidOnSide(i, j + 1, k - 1,0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(world.getBlockId(i, j, k + 1) == blockID && world.isBlockNormalCube(i, j + 1, k + 1))
|
||||
+ if(world.getBlockId(i, j, k + 1) == blockID && world.isBlockSolidOnSide(i, j + 1, k + 1,0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/BlockContainer.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/BlockContainer.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -26,7 +26,7 @@
|
||||
public void onBlockAdded(World world, int i, int j, int k)
|
||||
{
|
||||
super.onBlockAdded(world, i, j, k);
|
||||
- world.setBlockTileEntity(i, j, k, getBlockEntity());
|
||||
+ world.setBlockTileEntity(i, j, k, getBlockEntity(world.getBlockMetadata(i,j,k)));
|
||||
}
|
||||
|
||||
public void onBlockRemoval(World world, int i, int j, int k)
|
||||
@@ -37,6 +37,12 @@
|
||||
|
||||
public abstract TileEntity getBlockEntity();
|
||||
|
||||
+ /* FORGE: Metadata-sensitive version, to fix 1.8.1 regression.
|
||||
+ */
|
||||
+ public TileEntity getBlockEntity(int md) {
|
||||
+ return getBlockEntity();
|
||||
+ }
|
||||
+
|
||||
public void powerBlock(World world, int i, int j, int k, int l, int i1)
|
||||
{
|
||||
super.powerBlock(world, i, j, k, l, i1);
|
||||
@@ -0,0 +1,48 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/BlockCrops.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/BlockCrops.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -5,6 +5,7 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
+import java.util.ArrayList;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
// BlockFlower, Block, World, EntityItem,
|
||||
@@ -108,28 +109,16 @@
|
||||
return 6;
|
||||
}
|
||||
|
||||
- public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f, int i1)
|
||||
- {
|
||||
- super.dropBlockAsItemWithChance(world, i, j, k, l, f, 0);
|
||||
- if(world.multiplayerWorld)
|
||||
- {
|
||||
- return;
|
||||
+ public ArrayList<ItemStack> getBlockDropped(World world,
|
||||
+ int i, int j, int k, int md) {
|
||||
+ ArrayList<ItemStack> tr = new ArrayList<ItemStack>();
|
||||
+ if (md == 7) tr.add(new ItemStack(Item.wheat));
|
||||
+
|
||||
+ for(int n = 0; n < 3; n++) {
|
||||
+ if (world.rand.nextInt(15) <= md)
|
||||
+ tr.add(new ItemStack(Item.seeds));
|
||||
}
|
||||
- int j1 = 3 + i1;
|
||||
- for(int k1 = 0; k1 < j1; k1++)
|
||||
- {
|
||||
- if(world.rand.nextInt(15) <= l)
|
||||
- {
|
||||
- float f1 = 0.7F;
|
||||
- float f2 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
|
||||
- float f3 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
|
||||
- float f4 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
|
||||
- EntityItem entityitem = new EntityItem(world, (float)i + f2, (float)j + f3, (float)k + f4, new ItemStack(Item.seeds));
|
||||
- entityitem.delayBeforeCanPickup = 10;
|
||||
- world.entityJoinedWorld(entityitem);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
+ return tr;
|
||||
}
|
||||
|
||||
public int idDropped(int i, Random random, int j)
|
||||
@@ -0,0 +1,29 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/BlockDoor.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/BlockDoor.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -111,7 +111,7 @@
|
||||
{
|
||||
if(blockMaterial == Material.iron)
|
||||
{
|
||||
- return true;
|
||||
+ return false;
|
||||
}
|
||||
int l = world.getBlockMetadata(i, j, k);
|
||||
if((l & 8) != 0)
|
||||
@@ -178,7 +178,7 @@
|
||||
world.setBlockWithNotify(i, j, k, 0);
|
||||
flag = true;
|
||||
}
|
||||
- if(!world.isBlockNormalCube(i, j - 1, k))
|
||||
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1))
|
||||
{
|
||||
world.setBlockWithNotify(i, j, k, 0);
|
||||
flag = true;
|
||||
@@ -241,7 +241,7 @@
|
||||
return false;
|
||||
} else
|
||||
{
|
||||
- return world.isBlockNormalCube(i, j - 1, k) && super.canPlaceBlockAt(world, i, j, k) && super.canPlaceBlockAt(world, i, j + 1, k);
|
||||
+ return world.isBlockSolidOnSide(i, j - 1, k,1) && super.canPlaceBlockAt(world, i, j, k) && super.canPlaceBlockAt(world, i, j + 1, k);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/BlockLadder.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/BlockLadder.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -63,6 +63,11 @@
|
||||
return super.getSelectedBoundingBoxFromPool(world, i, j, k);
|
||||
}
|
||||
|
||||
+ /* FORGE: Implemented base method, see Block.isLadder */
|
||||
+ public boolean isLadder() {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
@@ -80,37 +85,37 @@
|
||||
|
||||
public boolean canPlaceBlockAt(World world, int i, int j, int k)
|
||||
{
|
||||
- if(world.isBlockNormalCube(i - 1, j, k))
|
||||
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(world.isBlockNormalCube(i + 1, j, k))
|
||||
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(world.isBlockNormalCube(i, j, k - 1))
|
||||
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- return world.isBlockNormalCube(i, j, k + 1);
|
||||
+ return world.isBlockSolidOnSide(i, j, k + 1,2);
|
||||
}
|
||||
|
||||
public void onBlockPlaced(World world, int i, int j, int k, int l)
|
||||
{
|
||||
int i1 = world.getBlockMetadata(i, j, k);
|
||||
- if((i1 == 0 || l == 2) && world.isBlockNormalCube(i, j, k + 1))
|
||||
+ if((i1 == 0 || l == 2) && world.isBlockSolidOnSide(i, j, k + 1,2))
|
||||
{
|
||||
i1 = 2;
|
||||
}
|
||||
- if((i1 == 0 || l == 3) && world.isBlockNormalCube(i, j, k - 1))
|
||||
+ if((i1 == 0 || l == 3) && world.isBlockSolidOnSide(i, j, k - 1,3))
|
||||
{
|
||||
i1 = 3;
|
||||
}
|
||||
- if((i1 == 0 || l == 4) && world.isBlockNormalCube(i + 1, j, k))
|
||||
+ if((i1 == 0 || l == 4) && world.isBlockSolidOnSide(i + 1, j, k,4))
|
||||
{
|
||||
i1 = 4;
|
||||
}
|
||||
- if((i1 == 0 || l == 5) && world.isBlockNormalCube(i - 1, j, k))
|
||||
+ if((i1 == 0 || l == 5) && world.isBlockSolidOnSide(i - 1, j, k,5))
|
||||
{
|
||||
i1 = 5;
|
||||
}
|
||||
@@ -121,19 +126,19 @@
|
||||
{
|
||||
int i1 = world.getBlockMetadata(i, j, k);
|
||||
boolean flag = false;
|
||||
- if(i1 == 2 && world.isBlockNormalCube(i, j, k + 1))
|
||||
+ if(i1 == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(i1 == 3 && world.isBlockNormalCube(i, j, k - 1))
|
||||
+ if(i1 == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(i1 == 4 && world.isBlockNormalCube(i + 1, j, k))
|
||||
+ if(i1 == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(i1 == 5 && world.isBlockNormalCube(i - 1, j, k))
|
||||
+ if(i1 == 5 && world.isBlockSolidOnSide(i - 1, j, k,5))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/BlockLever.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/BlockLever.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -40,44 +40,44 @@
|
||||
|
||||
public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l)
|
||||
{
|
||||
- if(l == 1 && world.isBlockNormalCube(i, j - 1, k))
|
||||
+ if(l == 1 && world.isBlockSolidOnSide(i, j - 1, k,1))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(l == 2 && world.isBlockNormalCube(i, j, k + 1))
|
||||
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(l == 3 && world.isBlockNormalCube(i, j, k - 1))
|
||||
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(l == 4 && world.isBlockNormalCube(i + 1, j, k))
|
||||
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- return l == 5 && world.isBlockNormalCube(i - 1, j, k);
|
||||
+ return l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5);
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World world, int i, int j, int k)
|
||||
{
|
||||
- if(world.isBlockNormalCube(i - 1, j, k))
|
||||
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(world.isBlockNormalCube(i + 1, j, k))
|
||||
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(world.isBlockNormalCube(i, j, k - 1))
|
||||
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(world.isBlockNormalCube(i, j, k + 1))
|
||||
+ if(world.isBlockSolidOnSide(i, j, k + 1,2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- return world.isBlockNormalCube(i, j - 1, k);
|
||||
+ return world.isBlockSolidOnSide(i, j - 1, k,1);
|
||||
}
|
||||
|
||||
public void onBlockPlaced(World world, int i, int j, int k, int l)
|
||||
@@ -86,23 +86,23 @@
|
||||
int j1 = i1 & 8;
|
||||
i1 &= 7;
|
||||
i1 = -1;
|
||||
- if(l == 1 && world.isBlockNormalCube(i, j - 1, k))
|
||||
+ if(l == 1 && world.isBlockSolidOnSide(i, j - 1, k,1))
|
||||
{
|
||||
i1 = 5 + world.rand.nextInt(2);
|
||||
}
|
||||
- if(l == 2 && world.isBlockNormalCube(i, j, k + 1))
|
||||
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
|
||||
{
|
||||
i1 = 4;
|
||||
}
|
||||
- if(l == 3 && world.isBlockNormalCube(i, j, k - 1))
|
||||
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
|
||||
{
|
||||
i1 = 3;
|
||||
}
|
||||
- if(l == 4 && world.isBlockNormalCube(i + 1, j, k))
|
||||
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
|
||||
{
|
||||
i1 = 2;
|
||||
}
|
||||
- if(l == 5 && world.isBlockNormalCube(i - 1, j, k))
|
||||
+ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5))
|
||||
{
|
||||
i1 = 1;
|
||||
}
|
||||
@@ -124,27 +124,27 @@
|
||||
{
|
||||
int i1 = world.getBlockMetadata(i, j, k) & 7;
|
||||
boolean flag = false;
|
||||
- if(!world.isBlockNormalCube(i - 1, j, k) && i1 == 1)
|
||||
+ if(!world.isBlockSolidOnSide(i - 1, j, k,5) && i1 == 1)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(!world.isBlockNormalCube(i + 1, j, k) && i1 == 2)
|
||||
+ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(!world.isBlockNormalCube(i, j, k - 1) && i1 == 3)
|
||||
+ if(!world.isBlockSolidOnSide(i, j, k - 1,3) && i1 == 3)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(!world.isBlockNormalCube(i, j, k + 1) && i1 == 4)
|
||||
+ if(!world.isBlockSolidOnSide(i, j, k + 1,2) && i1 == 4)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(!world.isBlockNormalCube(i, j - 1, k) && i1 == 5)
|
||||
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1) && i1 == 5)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(!world.isBlockNormalCube(i, j - 1, k) && i1 == 6)
|
||||
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1) && i1 == 6)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/BlockPressurePlate.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/BlockPressurePlate.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -48,7 +48,8 @@
|
||||
|
||||
public boolean canPlaceBlockAt(World world, int i, int j, int k)
|
||||
{
|
||||
- return world.isBlockNormalCube(i, j - 1, k) || world.getBlockId(i, j - 1, k) == Block.fence.blockID;
|
||||
+ return world.isBlockSolidOnSide(i, j - 1, k,1)
|
||||
+ || world.getBlockId(i, j - 1, k) == Block.fence.blockID;
|
||||
}
|
||||
|
||||
public void onBlockAdded(World world, int i, int j, int k)
|
||||
@@ -58,7 +59,8 @@
|
||||
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
|
||||
{
|
||||
boolean flag = false;
|
||||
- if(!world.isBlockNormalCube(i, j - 1, k) && world.getBlockId(i, j - 1, k) != Block.fence.blockID)
|
||||
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1)
|
||||
+ && world.getBlockId(i, j - 1, k) != Block.fence.blockID)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/BlockRail.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/BlockRail.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -18,12 +18,12 @@
|
||||
public static final boolean isRailBlockAt(World world, int i, int j, int k)
|
||||
{
|
||||
int l = world.getBlockId(i, j, k);
|
||||
- return l == Block.rail.blockID || l == Block.railPowered.blockID || l == Block.railDetector.blockID;
|
||||
+ return Block.blocksList[l] instanceof BlockRail;
|
||||
}
|
||||
|
||||
public static final boolean isRailBlock(int i)
|
||||
{
|
||||
- return i == Block.rail.blockID || i == Block.railPowered.blockID || i == Block.railDetector.blockID;
|
||||
+ return Block.blocksList[i] instanceof BlockRail;
|
||||
}
|
||||
|
||||
protected BlockRail(int i, int j, boolean flag)
|
||||
@@ -99,7 +99,7 @@
|
||||
|
||||
public boolean canPlaceBlockAt(World world, int i, int j, int k)
|
||||
{
|
||||
- return world.isBlockNormalCube(i, j - 1, k);
|
||||
+ return world.isBlockSolidOnSide(i, j - 1, k,1);
|
||||
}
|
||||
|
||||
public void onBlockAdded(World world, int i, int j, int k)
|
||||
@@ -123,23 +123,23 @@
|
||||
j1 &= 7;
|
||||
}
|
||||
boolean flag = false;
|
||||
- if(!world.isBlockNormalCube(i, j - 1, k))
|
||||
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(j1 == 2 && !world.isBlockNormalCube(i + 1, j, k))
|
||||
+ if(j1 == 2 && !world.isBlockSolidOnSide(i + 1, j, k,1))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(j1 == 3 && !world.isBlockNormalCube(i - 1, j, k))
|
||||
+ if(j1 == 3 && !world.isBlockSolidOnSide(i - 1, j, k,1))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(j1 == 4 && !world.isBlockNormalCube(i, j, k - 1))
|
||||
+ if(j1 == 4 && !world.isBlockSolidOnSide(i, j, k - 1,1))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(j1 == 5 && !world.isBlockNormalCube(i, j, k + 1))
|
||||
+ if(j1 == 5 && !world.isBlockSolidOnSide(i, j, k + 1,1))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/BlockRedstoneRepeater.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/BlockRedstoneRepeater.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
public boolean canPlaceBlockAt(World world, int i, int j, int k)
|
||||
{
|
||||
- if(!world.isBlockNormalCube(i, j - 1, k))
|
||||
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1))
|
||||
{
|
||||
return false;
|
||||
} else
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
public boolean canBlockStay(World world, int i, int j, int k)
|
||||
{
|
||||
- if(!world.isBlockNormalCube(i, j - 1, k))
|
||||
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1))
|
||||
{
|
||||
return false;
|
||||
} else
|
||||
@@ -0,0 +1,31 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/BlockRedstoneWire.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/BlockRedstoneWire.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
import java.util.*;
|
||||
|
||||
+import net.minecraft.src.forge.*;
|
||||
+
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
// Block, Material, World, ChunkPosition,
|
||||
// Item, IBlockAccess, Direction, AxisAlignedBB
|
||||
@@ -56,7 +58,7 @@
|
||||
|
||||
public boolean canPlaceBlockAt(World world, int i, int j, int k)
|
||||
{
|
||||
- return world.isBlockNormalCube(i, j - 1, k);
|
||||
+ return world.isBlockSolidOnSide(i, j - 1, k, 1);
|
||||
}
|
||||
|
||||
private void updateAndPropagateCurrentStrength(World world, int i, int j, int k)
|
||||
@@ -454,6 +456,10 @@
|
||||
{
|
||||
return false;
|
||||
}
|
||||
+ if (Block.blocksList[i1] instanceof IConnectRedstone) {
|
||||
+ IConnectRedstone icr = (IConnectRedstone)Block.blocksList[i1];
|
||||
+ return icr.canConnectRedstone(iblockaccess, i, j, k, l);
|
||||
+ }
|
||||
if(Block.blocksList[i1].canProvidePower() && l != -1)
|
||||
{
|
||||
return true;
|
||||
@@ -0,0 +1,38 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/BlockTallGrass.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/BlockTallGrass.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -4,7 +4,10 @@
|
||||
|
||||
package net.minecraft.src;
|
||||
|
||||
+import net.minecraft.src.forge.ForgeHooks;
|
||||
+
|
||||
import java.util.Random;
|
||||
+import java.util.ArrayList;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
// BlockFlower, ColorizerGrass, ColorizerFoliage, IBlockAccess,
|
||||
@@ -73,13 +76,17 @@
|
||||
|
||||
public int idDropped(int i, Random random, int j)
|
||||
{
|
||||
- if(random.nextInt(8) == 0)
|
||||
- {
|
||||
- return Item.seeds.shiftedIndex;
|
||||
- } else
|
||||
- {
|
||||
- return -1;
|
||||
- }
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ public ArrayList<ItemStack> getBlockDropped(World world,
|
||||
+ int i, int j, int k, int md) {
|
||||
+ ArrayList<ItemStack> tr=new ArrayList<ItemStack>();
|
||||
+ if(world.rand.nextInt(8)!=0)
|
||||
+ return tr;
|
||||
+ ItemStack ist=ForgeHooks.getGrassSeed(world);
|
||||
+ if(ist!=null) tr.add(ist);
|
||||
+ return tr;
|
||||
}
|
||||
|
||||
public int func_40198_a(int i, Random random)
|
||||
@@ -0,0 +1,107 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/BlockTorch.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/BlockTorch.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
private boolean func_31032_h(World world, int i, int j, int k)
|
||||
{
|
||||
- if(world.func_41082_b(i, j, k, true))
|
||||
+ if(world.isBlockSolidOnSide(i, j, k, 1))
|
||||
{
|
||||
return true;
|
||||
} else
|
||||
@@ -53,19 +53,19 @@
|
||||
|
||||
public boolean canPlaceBlockAt(World world, int i, int j, int k)
|
||||
{
|
||||
- if(world.func_41082_b(i - 1, j, k, true))
|
||||
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(world.func_41082_b(i + 1, j, k, true))
|
||||
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(world.func_41082_b(i, j, k - 1, true))
|
||||
+ if(world.isBlockSolidOnSide(i, j, k-1,3))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(world.func_41082_b(i, j, k + 1, true))
|
||||
+ if(world.isBlockSolidOnSide(i, j, k+1,2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -79,19 +79,19 @@
|
||||
{
|
||||
i1 = 5;
|
||||
}
|
||||
- if(l == 2 && world.func_41082_b(i, j, k + 1, true))
|
||||
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k+1,2))
|
||||
{
|
||||
i1 = 4;
|
||||
}
|
||||
- if(l == 3 && world.func_41082_b(i, j, k - 1, true))
|
||||
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k-1,3))
|
||||
{
|
||||
i1 = 3;
|
||||
}
|
||||
- if(l == 4 && world.func_41082_b(i + 1, j, k, true))
|
||||
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
|
||||
{
|
||||
i1 = 2;
|
||||
}
|
||||
- if(l == 5 && world.func_41082_b(i - 1, j, k, true))
|
||||
+ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5))
|
||||
{
|
||||
i1 = 1;
|
||||
}
|
||||
@@ -109,19 +109,19 @@
|
||||
|
||||
public void onBlockAdded(World world, int i, int j, int k)
|
||||
{
|
||||
- if(world.func_41082_b(i - 1, j, k, true))
|
||||
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
|
||||
{
|
||||
world.setBlockMetadataWithNotify(i, j, k, 1);
|
||||
} else
|
||||
- if(world.func_41082_b(i + 1, j, k, true))
|
||||
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
|
||||
{
|
||||
world.setBlockMetadataWithNotify(i, j, k, 2);
|
||||
} else
|
||||
- if(world.func_41082_b(i, j, k - 1, true))
|
||||
+ if(world.isBlockSolidOnSide(i, j, k-1,3))
|
||||
{
|
||||
world.setBlockMetadataWithNotify(i, j, k, 3);
|
||||
} else
|
||||
- if(world.func_41082_b(i, j, k + 1, true))
|
||||
+ if(world.isBlockSolidOnSide(i, j, k+1,2))
|
||||
{
|
||||
world.setBlockMetadataWithNotify(i, j, k, 4);
|
||||
} else
|
||||
@@ -138,19 +138,19 @@
|
||||
{
|
||||
int i1 = world.getBlockMetadata(i, j, k);
|
||||
boolean flag = false;
|
||||
- if(!world.func_41082_b(i - 1, j, k, true) && i1 == 1)
|
||||
+ if(!world.isBlockSolidOnSide(i - 1, j, k,5) && i1 == 1)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(!world.func_41082_b(i + 1, j, k, true) && i1 == 2)
|
||||
+ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(!world.func_41082_b(i, j, k - 1, true) && i1 == 3)
|
||||
+ if(!world.isBlockSolidOnSide(i, j, k-1,3) && i1 == 3)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(!world.func_41082_b(i, j, k + 1, true) && i1 == 4)
|
||||
+ if(!world.isBlockSolidOnSide(i, j, k+1,2) && i1 == 4)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/BlockTrapDoor.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/BlockTrapDoor.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -11,7 +11,10 @@
|
||||
|
||||
public class BlockTrapDoor extends Block
|
||||
{
|
||||
-
|
||||
+ /* FORGE: Set this to allow trapdoors to remain free-floating
|
||||
+ */
|
||||
+ public static boolean disableValidation=false;
|
||||
+
|
||||
protected BlockTrapDoor(int i, Material material)
|
||||
{
|
||||
super(i, material);
|
||||
@@ -147,7 +150,7 @@
|
||||
{
|
||||
j1--;
|
||||
}
|
||||
- if(!func_41052_f(world.getBlockId(j1, j, k1)))
|
||||
+ if(!(func_41052_f(world.getBlockId(j1, j, k1)) || world.isBlockSolidOnSide(j1, j, k1, (i1&3)+2)))
|
||||
{
|
||||
world.setBlockWithNotify(i, j, k, 0);
|
||||
dropBlockAsItem(world, i, j, k, i1, 0);
|
||||
@@ -192,6 +195,7 @@
|
||||
|
||||
public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l)
|
||||
{
|
||||
+ if(disableValidation) return true;
|
||||
if(l == 0)
|
||||
{
|
||||
return false;
|
||||
@@ -216,7 +220,7 @@
|
||||
{
|
||||
i--;
|
||||
}
|
||||
- return func_41052_f(world.getBlockId(i, j, k));
|
||||
+ return func_41052_f(world.getBlockId(i, j, k)) || world.isBlockSolidOnSide(i, j, k, l);
|
||||
}
|
||||
|
||||
public static boolean isTrapdoorOpen(int i)
|
||||
@@ -226,6 +230,10 @@
|
||||
|
||||
private static boolean func_41052_f(int i)
|
||||
{
|
||||
+ if (disableValidation)
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
if(i <= 0)
|
||||
{
|
||||
return false;
|
||||
@@ -0,0 +1,179 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/Chunk.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/Chunk.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -3,6 +3,7 @@
|
||||
// Decompiler options: packimports(3) braces deadcode fieldsfirst
|
||||
|
||||
package net.minecraft.src;
|
||||
+import net.minecraft.src.forge.*;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.util.*;
|
||||
@@ -390,7 +391,7 @@
|
||||
TileEntity tileentity = getChunkBlockTileEntity(i, j, k);
|
||||
if(tileentity == null)
|
||||
{
|
||||
- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity();
|
||||
+ tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(i1);
|
||||
worldObj.setBlockTileEntity(i, j, k, tileentity);
|
||||
}
|
||||
if(tileentity != null)
|
||||
@@ -398,14 +399,6 @@
|
||||
tileentity.func_35144_b();
|
||||
}
|
||||
}
|
||||
- } else
|
||||
- if(l1 > 0 && (Block.blocksList[l1] instanceof BlockContainer))
|
||||
- {
|
||||
- TileEntity tileentity1 = getChunkBlockTileEntity(i, j, k);
|
||||
- if(tileentity1 != null)
|
||||
- {
|
||||
- tileentity1.func_35144_b();
|
||||
- }
|
||||
}
|
||||
isModified = true;
|
||||
return true;
|
||||
@@ -430,7 +423,11 @@
|
||||
blocks[i << worldObj.xShift | k << worldObj.heightShift | j] = (byte)(byte0 & 0xff);
|
||||
if(k1 != 0)
|
||||
{
|
||||
- Block.blocksList[k1].onBlockRemoval(worldObj, l1, j, i2);
|
||||
+ if (!worldObj.multiplayerWorld)
|
||||
+ {
|
||||
+ Block.blocksList[k1].onBlockRemoval(worldObj, l1, j, i2);
|
||||
+ }
|
||||
+ removeChunkBlockTileEntity(i, j, k);
|
||||
}
|
||||
data.setNibble(i, j, k, 0);
|
||||
if(Block.lightOpacity[byte0 & 0xff] != 0)
|
||||
@@ -458,7 +455,7 @@
|
||||
TileEntity tileentity = getChunkBlockTileEntity(i, j, k);
|
||||
if(tileentity == null)
|
||||
{
|
||||
- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity();
|
||||
+ tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(0);
|
||||
worldObj.setBlockTileEntity(i, j, k, tileentity);
|
||||
}
|
||||
if(tileentity != null)
|
||||
@@ -466,14 +463,6 @@
|
||||
tileentity.func_35144_b();
|
||||
}
|
||||
}
|
||||
- } else
|
||||
- if(k1 > 0 && (Block.blocksList[k1] instanceof BlockContainer))
|
||||
- {
|
||||
- TileEntity tileentity1 = getChunkBlockTileEntity(i, j, k);
|
||||
- if(tileentity1 != null)
|
||||
- {
|
||||
- tileentity1.func_35144_b();
|
||||
- }
|
||||
}
|
||||
isModified = true;
|
||||
return true;
|
||||
@@ -609,6 +598,11 @@
|
||||
{
|
||||
ChunkPosition chunkposition = new ChunkPosition(i, j, k);
|
||||
TileEntity tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition);
|
||||
+ if(tileentity != null && tileentity.isInvalid())
|
||||
+ {
|
||||
+ chunkTileEntityMap.remove(chunkposition);
|
||||
+ tileentity=null;
|
||||
+ }
|
||||
if(tileentity == null)
|
||||
{
|
||||
int l = getBlockID(i, j, k);
|
||||
@@ -618,18 +612,23 @@
|
||||
}
|
||||
if(tileentity == null)
|
||||
{
|
||||
- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity();
|
||||
+ tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(getBlockMetadata(i,j,k));
|
||||
worldObj.setBlockTileEntity(xPosition * 16 + i, j, zPosition * 16 + k, tileentity);
|
||||
}
|
||||
tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition);
|
||||
}
|
||||
- if(tileentity != null && tileentity.isInvalid())
|
||||
- {
|
||||
- chunkTileEntityMap.remove(chunkposition);
|
||||
- return null;
|
||||
- } else
|
||||
+ return tileentity;
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Used to remove only invalid TileEntities */
|
||||
+ public void cleanChunkBlockTileEntity(int i, int j, int k)
|
||||
+ {
|
||||
+ ChunkPosition chunkposition = new ChunkPosition(i, j, k);
|
||||
+ if(isChunkLoaded)
|
||||
{
|
||||
- return tileentity;
|
||||
+ TileEntity tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition);
|
||||
+ if(tileentity != null && tileentity.isInvalid())
|
||||
+ chunkTileEntityMap.remove(chunkposition);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -641,7 +640,7 @@
|
||||
setChunkBlockTileEntity(i, j, k, tileentity);
|
||||
if(isChunkLoaded)
|
||||
{
|
||||
- worldObj.loadedTileEntityList.add(tileentity);
|
||||
+ worldObj.addTileEntity(tileentity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -657,6 +656,8 @@
|
||||
return;
|
||||
} else
|
||||
{
|
||||
+ TileEntity old = (TileEntity)chunkTileEntityMap.get(chunkposition);
|
||||
+ if (old != null) old.invalidate();
|
||||
tileentity.validate();
|
||||
chunkTileEntityMap.put(chunkposition, tileentity);
|
||||
return;
|
||||
@@ -810,6 +811,15 @@
|
||||
public int setChunkData(byte abyte0[], int i, int j, int k, int l, int i1, int j1,
|
||||
int k1)
|
||||
{
|
||||
+ TileEntity te;
|
||||
+ Iterator iterator = chunkTileEntityMap.values().iterator();
|
||||
+ while (iterator.hasNext()){
|
||||
+ te = (TileEntity)iterator.next();
|
||||
+ te.func_35144_b();
|
||||
+ te.getBlockMetadata();
|
||||
+ te.getBlockType();
|
||||
+ }
|
||||
+
|
||||
for(int l1 = i; l1 < l; l1++)
|
||||
{
|
||||
for(int l2 = k; l2 < j1; l2++)
|
||||
@@ -859,12 +869,25 @@
|
||||
|
||||
}
|
||||
|
||||
- TileEntity tileentity;
|
||||
- for(Iterator iterator = chunkTileEntityMap.values().iterator(); iterator.hasNext(); tileentity.func_35144_b())
|
||||
- {
|
||||
- tileentity = (TileEntity)iterator.next();
|
||||
+ List<TileEntity> invalidList=new ArrayList();
|
||||
+ iterator = chunkTileEntityMap.values().iterator();
|
||||
+ while(iterator.hasNext()) {
|
||||
+ te = (TileEntity)iterator.next();
|
||||
+ if ((te.xCoord & 15) >= i && (te.xCoord & 15) <= l &&
|
||||
+ (te.yCoord >= j) && (te.yCoord <= i1) &&
|
||||
+ (te.zCoord & 15) >= k && (te.zCoord & 15) <=j1) {
|
||||
+
|
||||
+ Block bl = te.getBlockType();
|
||||
+ if (bl != null &&
|
||||
+ bl.blockID == worldObj.getBlockId(te.xCoord, te.yCoord, te.zCoord) &&
|
||||
+ te.getBlockMetadata() == worldObj.getBlockMetadata(te.xCoord, te.yCoord, te.zCoord))
|
||||
+ continue;
|
||||
+
|
||||
+ invalidList.add(te);
|
||||
+ }
|
||||
}
|
||||
-
|
||||
+ for(TileEntity te2 : invalidList)
|
||||
+ te2.invalidate();
|
||||
return k1;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/ContainerCreative.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/ContainerCreative.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -74,20 +74,23 @@
|
||||
}
|
||||
itemList.add(new ItemStack(ablock[l1], 1, k2));
|
||||
}
|
||||
+
|
||||
+ for(int x = 0; x < 256; x++)
|
||||
+ {
|
||||
+ if (Block.blocksList[x] != null)
|
||||
+ {
|
||||
+ Block.blocksList[x].addCreativeItems((ArrayList)itemList);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
for(int i2 = 256; i2 < Item.itemsList.length; i2++)
|
||||
{
|
||||
- if(Item.itemsList[i2] != null && Item.itemsList[i2].shiftedIndex != Item.potion.shiftedIndex)
|
||||
+ if(Item.itemsList[i2] != null)
|
||||
{
|
||||
- itemList.add(new ItemStack(Item.itemsList[i2]));
|
||||
+ Item.itemsList[i2].addCreativeItems((ArrayList)itemList);
|
||||
}
|
||||
}
|
||||
|
||||
- for(int j2 = 1; j2 < 16; j2++)
|
||||
- {
|
||||
- itemList.add(new ItemStack(Item.dyePowder.shiftedIndex, 1, j2));
|
||||
- }
|
||||
-
|
||||
InventoryPlayer inventoryplayer = entityplayer.inventory;
|
||||
for(int l2 = 0; l2 < 9; l2++)
|
||||
{
|
||||
@@ -0,0 +1,11 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/CraftingManager.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/CraftingManager.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -363,7 +363,7 @@
|
||||
i++;
|
||||
}
|
||||
|
||||
- if(i == 2 && itemstack.itemID == itemstack1.itemID && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && Item.itemsList[itemstack.itemID].isDamageable())
|
||||
+ if(i == 2 && itemstack.itemID == itemstack1.itemID && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && Item.itemsList[itemstack.itemID].isRepairable())
|
||||
{
|
||||
Item item = Item.itemsList[itemstack.itemID];
|
||||
int l = item.getMaxDamage() - itemstack.getItemDamageForDisplay();
|
||||
@@ -0,0 +1,145 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/EffectRenderer.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/EffectRenderer.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -7,6 +7,9 @@
|
||||
import java.util.*;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
+import net.minecraft.src.forge.BlockTextureParticles;
|
||||
+import net.minecraft.src.forge.ITextureProvider;
|
||||
+
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
// EntityFX, ActiveRenderInfo, Entity, RenderEngine,
|
||||
// Tessellator, MathHelper, Block, EntityDiggingFX,
|
||||
@@ -17,11 +20,13 @@
|
||||
|
||||
protected World worldObj;
|
||||
private List fxLayers[];
|
||||
+ private List effectList;
|
||||
private RenderEngine renderer;
|
||||
private Random rand;
|
||||
|
||||
public EffectRenderer(World world, RenderEngine renderengine)
|
||||
{
|
||||
+ effectList = new ArrayList();
|
||||
fxLayers = new List[4];
|
||||
rand = new Random();
|
||||
if(world != null)
|
||||
@@ -61,7 +66,18 @@
|
||||
}
|
||||
|
||||
}
|
||||
-
|
||||
+ for (int x = 0; x < effectList.size(); x++) {
|
||||
+ BlockTextureParticles entry = (BlockTextureParticles) effectList
|
||||
+ .get(x);
|
||||
+ for (int y = 0; y < entry.effects.size(); y++) {
|
||||
+ EntityFX entityfx = (EntityFX) entry.effects.get(y);
|
||||
+ if (entityfx.isDead) {
|
||||
+ entry.effects.remove(y--);
|
||||
+ }
|
||||
+ }
|
||||
+ if (effectList.size() == 0)
|
||||
+ effectList.remove(x--);
|
||||
+ }
|
||||
}
|
||||
|
||||
public void renderParticles(Entity entity, float f)
|
||||
@@ -100,6 +116,7 @@
|
||||
for(int k = 0; k < fxLayers[i].size(); k++)
|
||||
{
|
||||
EntityFX entityfx = (EntityFX)fxLayers[i].get(k);
|
||||
+ if (entityfx instanceof EntityDiggingFX) continue;
|
||||
tessellator.setBrightness(entityfx.getEntityBrightnessForRender(f));
|
||||
entityfx.renderParticle(tessellator, f, f1, f5, f2, f3, f4);
|
||||
}
|
||||
@@ -107,6 +124,21 @@
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
+ Tessellator tessellator = Tessellator.instance;
|
||||
+ for (int x = 0; x < effectList.size(); x++) {
|
||||
+ BlockTextureParticles entry = (BlockTextureParticles) effectList
|
||||
+ .get(x);
|
||||
+ GL11.glBindTexture(3553 /* GL_TEXTURE_2D */,
|
||||
+ renderer.getTexture(entry.texture));
|
||||
+ tessellator.startDrawingQuads();
|
||||
+ for (int y = 0; y < entry.effects.size(); y++) {
|
||||
+ EntityFX entityfx = (EntityFX) entry.effects.get(y);
|
||||
+ tessellator.setBrightness(entityfx.getEntityBrightnessForRender(f));
|
||||
+ entityfx.renderParticle(tessellator, f, f1, f5, f2, f3, f4);
|
||||
+ }
|
||||
+ tessellator.draw();
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
public void func_1187_b(Entity entity, float f)
|
||||
@@ -138,7 +170,12 @@
|
||||
{
|
||||
fxLayers[i].clear();
|
||||
}
|
||||
-
|
||||
+ for (int x = 0; x < effectList.size(); x++) {
|
||||
+ BlockTextureParticles entry = (BlockTextureParticles) effectList
|
||||
+ .get(x);
|
||||
+ entry.effects.clear();
|
||||
+ }
|
||||
+ effectList.clear();
|
||||
}
|
||||
|
||||
public void addBlockDestroyEffects(int i, int j, int k, int l, int i1)
|
||||
@@ -159,7 +196,12 @@
|
||||
double d1 = (double)j + ((double)l1 + 0.5D) / (double)j1;
|
||||
double d2 = (double)k + ((double)i2 + 0.5D) / (double)j1;
|
||||
int j2 = rand.nextInt(6);
|
||||
- addEffect((new EntityDiggingFX(worldObj, d, d1, d2, d - (double)i - 0.5D, d1 - (double)j - 0.5D, d2 - (double)k - 0.5D, block, j2, i1)).func_4041_a(i, j, k));
|
||||
+ EntityDiggingFX dig_effect = new EntityDiggingFX(worldObj,
|
||||
+ d, d1, d2, d - (double) i - 0.5D, d1 - (double) j
|
||||
+ - 0.5D, d2 - (double) k - 0.5D, block, j2,
|
||||
+ i1);
|
||||
+ dig_effect.func_4041_a(i, j, k);
|
||||
+ addDigParticleEffect(dig_effect, block);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -204,11 +246,39 @@
|
||||
{
|
||||
d = (double)i + block.maxX + (double)f;
|
||||
}
|
||||
- addEffect((new EntityDiggingFX(worldObj, d, d1, d2, 0.0D, 0.0D, 0.0D, block, l, worldObj.getBlockMetadata(i, j, k))).func_4041_a(i, j, k).multiplyVelocity(0.2F).func_405_d(0.6F));
|
||||
+ EntityDiggingFX dig_effect = new EntityDiggingFX(worldObj, d, d1, d2, 0.0D, 0.0D, 0.0D, block, l, worldObj.getBlockMetadata(i, j, k));
|
||||
+ dig_effect.func_4041_a(i, j, k);
|
||||
+ dig_effect.multiplyVelocity(0.4F);
|
||||
+ dig_effect.func_405_d(0.6F);
|
||||
+ addDigParticleEffect(dig_effect, block);
|
||||
}
|
||||
|
||||
public String getStatistics()
|
||||
{
|
||||
return (new StringBuilder()).append("").append(fxLayers[0].size() + fxLayers[1].size() + fxLayers[2].size()).toString();
|
||||
}
|
||||
+
|
||||
+ public void addDigParticleEffect(EntityDiggingFX dig_effect, Block block) {
|
||||
+ boolean added = false;
|
||||
+ String comp = "/terrain.png";
|
||||
+
|
||||
+ if (block instanceof ITextureProvider) {
|
||||
+ comp = ((ITextureProvider) block).getTextureFile();
|
||||
+ }
|
||||
+ for (int x = 0; x < effectList.size(); x++) {
|
||||
+ BlockTextureParticles entry = (BlockTextureParticles) effectList
|
||||
+ .get(x);
|
||||
+ if (entry.texture.equals(comp)) {
|
||||
+ entry.effects.add(dig_effect);
|
||||
+ added = true;
|
||||
+ }
|
||||
+ }
|
||||
+ if (!added) {
|
||||
+ BlockTextureParticles entry = new BlockTextureParticles();
|
||||
+ entry.texture = comp;
|
||||
+ entry.effects.add(dig_effect);
|
||||
+ effectList.add(entry);
|
||||
+ }
|
||||
+ addEffect(dig_effect);
|
||||
+ }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/EntityLiving.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/EntityLiving.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -794,7 +794,9 @@
|
||||
int i = MathHelper.floor_double(posX);
|
||||
int j = MathHelper.floor_double(boundingBox.minY);
|
||||
int k = MathHelper.floor_double(posZ);
|
||||
- return worldObj.getBlockId(i, j, k) == Block.ladder.blockID;
|
||||
+ Block block=Block.blocksList[worldObj.getBlockId(i,j,k)];
|
||||
+ if(block==null) return false;
|
||||
+ return block.isLadder();
|
||||
}
|
||||
|
||||
public void writeEntityToNBT(NBTTagCompound nbttagcompound)
|
||||
@@ -0,0 +1,11 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/EntityPigZombie.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/EntityPigZombie.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -94,7 +94,7 @@
|
||||
return super.attackEntityFrom(damagesource, i);
|
||||
}
|
||||
|
||||
- private void becomeAngryAt(Entity entity)
|
||||
+ public void becomeAngryAt(Entity entity)
|
||||
{
|
||||
entityToAttack = entity;
|
||||
angerLevel = 400 + rand.nextInt(400);
|
||||
@@ -0,0 +1,115 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/EntityPlayer.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/EntityPlayer.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -4,6 +4,10 @@
|
||||
|
||||
package net.minecraft.src;
|
||||
|
||||
+import net.minecraft.src.forge.ArmorProperties;
|
||||
+import net.minecraft.src.forge.ISpecialArmor;
|
||||
+import net.minecraft.src.forge.ForgeHooks;
|
||||
+
|
||||
import java.util.*;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
@@ -548,6 +552,8 @@
|
||||
worldObj.entityJoinedWorld(entityitem);
|
||||
}
|
||||
|
||||
+ /* FORGE: This isnt called anymore
|
||||
+ */
|
||||
public float getCurrentPlayerStrVsBlock(Block block)
|
||||
{
|
||||
float f = inventory.getStrVsBlock(block);
|
||||
@@ -576,6 +582,45 @@
|
||||
return f1;
|
||||
}
|
||||
|
||||
+ /* FORGE: Extended to allow metadata.
|
||||
+ */
|
||||
+ public float getCurrentPlayerStrVsBlock(Block block, int md)
|
||||
+ {
|
||||
+ float f = 1.0F;
|
||||
+ ItemStack ist = inventory.getCurrentItem();
|
||||
+ if(ist != null)
|
||||
+ {
|
||||
+ f = ist.getItem().getStrVsBlock(ist, block, md);
|
||||
+ }
|
||||
+
|
||||
+ int i = EnchantmentHelper.getEfficiencyModifier(inventory);
|
||||
+ if (i > 0 && ForgeHooks.canHarvestBlock(block, this, md))
|
||||
+ {
|
||||
+ f += i * i + 1;
|
||||
+ }
|
||||
+
|
||||
+ if(isPotionActive(Potion.digSpeed))
|
||||
+ {
|
||||
+ f *= 1.0F + (float)(getActivePotionEffect(Potion.digSpeed).getAmplifier() + 1) * 0.2F;
|
||||
+ }
|
||||
+
|
||||
+ if(isPotionActive(Potion.digSlowdown))
|
||||
+ {
|
||||
+ f *= 1.0F - (float)(getActivePotionEffect(Potion.digSlowdown).getAmplifier() + 1) * 0.2F;
|
||||
+ }
|
||||
+
|
||||
+ if(isInsideOfMaterial(Material.water) && !EnchantmentHelper.getAquaAffinityModifier(inventory))
|
||||
+ {
|
||||
+ f /= 5F;
|
||||
+ }
|
||||
+
|
||||
+ if(!onGround)
|
||||
+ {
|
||||
+ f /= 5F;
|
||||
+ }
|
||||
+ return f;
|
||||
+ }
|
||||
+
|
||||
public boolean canHarvestBlock(Block block)
|
||||
{
|
||||
return inventory.canHarvestBlock(block);
|
||||
@@ -774,6 +819,25 @@
|
||||
|
||||
protected void damageEntity(DamageSource damagesource, int i)
|
||||
{
|
||||
+ boolean doRegularComputation = true;
|
||||
+ int initialDamage = i;
|
||||
+
|
||||
+ for (ItemStack stack : inventory.armorInventory) {
|
||||
+ if (stack != null && stack.getItem() instanceof ISpecialArmor) {
|
||||
+ ISpecialArmor armor = (ISpecialArmor) stack.getItem();
|
||||
+
|
||||
+ ArmorProperties props = armor.getProperties(this, initialDamage, i);
|
||||
+ i = i - props.damageRemove;
|
||||
+ doRegularComputation = doRegularComputation
|
||||
+ && props.allowRegularComputation;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!doRegularComputation) {
|
||||
+ super.damageEntity(damagesource, i);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
if(!damagesource.unblockable() && func_35162_ad())
|
||||
{
|
||||
i = 1 + i >> 1;
|
||||
@@ -825,7 +889,9 @@
|
||||
|
||||
public void destroyCurrentEquippedItem()
|
||||
{
|
||||
+ ItemStack orig=inventory.getCurrentItem();
|
||||
inventory.setInventorySlotContents(inventory.currentItem, null);
|
||||
+ ForgeHooks.onDestroyCurrentItem(this,orig);
|
||||
}
|
||||
|
||||
public double getYOffset()
|
||||
@@ -957,6 +1023,10 @@
|
||||
|
||||
public EnumStatus sleepInBedAt(int i, int j, int k)
|
||||
{
|
||||
+ EnumStatus customSleep = ForgeHooks.sleepInBedAt(this, i, j, k);
|
||||
+ if (customSleep != null) {
|
||||
+ return customSleep;
|
||||
+ }
|
||||
if(!worldObj.multiplayerWorld)
|
||||
{
|
||||
if(isPlayerSleeping() || !isEntityAlive())
|
||||
@@ -0,0 +1,36 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/EntityRenderer.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/EntityRenderer.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
package net.minecraft.src;
|
||||
|
||||
+import net.minecraft.src.forge.ForgeHooksClient;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.Random;
|
||||
@@ -916,8 +917,10 @@
|
||||
EntityPlayer entityplayer = (EntityPlayer)entityliving;
|
||||
GL11.glDisable(3008 /*GL_ALPHA_TEST*/);
|
||||
Profiler.endStartSection("outline");
|
||||
- renderglobal.drawBlockBreaking(entityplayer, mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), f);
|
||||
- renderglobal.drawSelectionBox(entityplayer, mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), f);
|
||||
+ if (!ForgeHooksClient.onBlockHighlight(renderglobal, entityplayer, mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), f)) {
|
||||
+ renderglobal.drawBlockBreaking(entityplayer, mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), f);
|
||||
+ renderglobal.drawSelectionBox(entityplayer, mc.objectMouseOver, 0, entityplayer.inventory.getCurrentItem(), f);
|
||||
+ }
|
||||
GL11.glEnable(3008 /*GL_ALPHA_TEST*/);
|
||||
}
|
||||
}
|
||||
@@ -969,8 +972,10 @@
|
||||
EntityPlayer entityplayer1 = (EntityPlayer)entityliving;
|
||||
GL11.glDisable(3008 /*GL_ALPHA_TEST*/);
|
||||
Profiler.endStartSection("outline");
|
||||
- renderglobal.drawBlockBreaking(entityplayer1, mc.objectMouseOver, 0, entityplayer1.inventory.getCurrentItem(), f);
|
||||
- renderglobal.drawSelectionBox(entityplayer1, mc.objectMouseOver, 0, entityplayer1.inventory.getCurrentItem(), f);
|
||||
+ if (!ForgeHooksClient.onBlockHighlight(renderglobal, entityplayer1, mc.objectMouseOver, 0, entityplayer1.inventory.getCurrentItem(), f)) {
|
||||
+ renderglobal.drawBlockBreaking(entityplayer1, mc.objectMouseOver, 0, entityplayer1.inventory.getCurrentItem(), f);
|
||||
+ renderglobal.drawSelectionBox(entityplayer1, mc.objectMouseOver, 0, entityplayer1.inventory.getCurrentItem(), f);
|
||||
+ }
|
||||
GL11.glEnable(3008 /*GL_ALPHA_TEST*/);
|
||||
}
|
||||
Profiler.endStartSection("weather");
|
||||
@@ -0,0 +1,26 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/Explosion.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/Explosion.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -5,6 +5,7 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.*;
|
||||
+import net.minecraft.src.forge.ISpecialResistance;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
// World, MathHelper, Block, ChunkPosition,
|
||||
@@ -76,7 +77,14 @@
|
||||
int k3 = worldObj.getBlockId(l2, i3, j3);
|
||||
if(k3 > 0)
|
||||
{
|
||||
- f1 -= (Block.blocksList[k3].getExplosionResistance(exploder) + 0.3F) * f2;
|
||||
+ if (Block.blocksList[k3] instanceof ISpecialResistance){
|
||||
+ ISpecialResistance isr = (ISpecialResistance)Block.blocksList[k3];
|
||||
+ f1 -= (isr.getSpecialExplosionResistance(worldObj, l2, i3, j3,
|
||||
+ explosionX, explosionY, explosionZ, exploder) + 0.3F) * f2;
|
||||
+ } else {
|
||||
+ f1 -= (Block.blocksList[k3].getExplosionResistance(exploder) + 0.3F) * f2;
|
||||
+ }
|
||||
+
|
||||
}
|
||||
if(f1 > 0.0F)
|
||||
{
|
||||
@@ -0,0 +1,59 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/FurnaceRecipes.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/FurnaceRecipes.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
+import java.util.Arrays;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
// Block, ItemStack, Item
|
||||
@@ -15,6 +16,7 @@
|
||||
|
||||
private static final FurnaceRecipes smeltingBase = new FurnaceRecipes();
|
||||
private Map smeltingList;
|
||||
+ private Map metaSmeltingList;
|
||||
|
||||
public static final FurnaceRecipes smelting()
|
||||
{
|
||||
@@ -24,6 +26,7 @@
|
||||
private FurnaceRecipes()
|
||||
{
|
||||
smeltingList = new HashMap();
|
||||
+ metaSmeltingList = new HashMap();
|
||||
addSmelting(Block.oreIron.blockID, new ItemStack(Item.ingotIron));
|
||||
addSmelting(Block.oreGold.blockID, new ItemStack(Item.ingotGold));
|
||||
addSmelting(Block.oreDiamond.blockID, new ItemStack(Item.diamond));
|
||||
@@ -46,11 +49,32 @@
|
||||
smeltingList.put(Integer.valueOf(i), itemstack);
|
||||
}
|
||||
|
||||
+ /* FORGE: Add a metadata-sensitive furnace recipe.
|
||||
+ */
|
||||
+ public void addSmelting(int i, int meta, ItemStack itemstack)
|
||||
+ {
|
||||
+ metaSmeltingList.put(Arrays.asList(i,meta), itemstack);
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Not used anymore.
|
||||
+ */
|
||||
public ItemStack getSmeltingResult(int i)
|
||||
{
|
||||
return (ItemStack)smeltingList.get(Integer.valueOf(i));
|
||||
}
|
||||
|
||||
+ /* FORGE: Added to allow metadata-sensitive smelting.
|
||||
+ */
|
||||
+ public ItemStack getSmeltingResult(ItemStack src) {
|
||||
+ ItemStack tr;
|
||||
+
|
||||
+ if(src==null) return null;
|
||||
+ tr=(ItemStack)metaSmeltingList.get(
|
||||
+ Arrays.asList(src.itemID,src.getItemDamage()));
|
||||
+ if(tr!=null) return tr;
|
||||
+ return (ItemStack)smeltingList.get(Integer.valueOf(src.itemID));
|
||||
+ }
|
||||
+
|
||||
public Map getSmeltingList()
|
||||
{
|
||||
return smeltingList;
|
||||
@@ -0,0 +1,83 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/Item.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/Item.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -5,6 +5,7 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.io.PrintStream;
|
||||
+import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@@ -177,6 +178,9 @@
|
||||
private String field_39010_c;
|
||||
private String itemName;
|
||||
|
||||
+ // FORGE: To disable repair recipes.
|
||||
+ protected boolean canRepair=true;
|
||||
+
|
||||
protected Item(int i)
|
||||
{
|
||||
maxStackSize = 64;
|
||||
@@ -231,6 +235,13 @@
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
+ /* FORGE: Metadata-sensitive version of getStrVsBlock
|
||||
+ */
|
||||
+ public float getStrVsBlock(ItemStack itemstack, Block block, int md)
|
||||
+ {
|
||||
+ return getStrVsBlock(itemstack,block);
|
||||
+ }
|
||||
+
|
||||
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
|
||||
{
|
||||
return itemstack;
|
||||
@@ -278,6 +289,29 @@
|
||||
return maxDamage > 0 && !hasSubtypes;
|
||||
}
|
||||
|
||||
+ /* FORGE: Called by CraftingManager to determine if an item is repairable.
|
||||
+ */
|
||||
+ public boolean isRepairable() {
|
||||
+ return canRepair && isDamageable();
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Call to disable repair recipes.
|
||||
+ */
|
||||
+ public Item setNoRepair() {
|
||||
+ canRepair=false;
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Called before a block is broken. Return true to prevent default
|
||||
+ * block harvesting.
|
||||
+ *
|
||||
+ * Note: In SMP, this is called on both client and server sides!
|
||||
+ */
|
||||
+ public boolean onBlockStartBreak(ItemStack itemstack, int i, int j, int k,
|
||||
+ EntityPlayer player) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
|
||||
{
|
||||
return false;
|
||||
@@ -473,6 +507,18 @@
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+ /* FORGE: Called when a new CreativeContainer is opened, populate the list
|
||||
+ * with all of the items for this item you want a player in creative mode
|
||||
+ * to have access to.
|
||||
+ */
|
||||
+ public void addCreativeItems(ArrayList itemList)
|
||||
+ {
|
||||
+ if (this.shiftedIndex != Item.potion.shiftedIndex)
|
||||
+ {
|
||||
+ itemList.add(new ItemStack(this, 1));
|
||||
+ }
|
||||
+ }
|
||||
|
||||
static
|
||||
{
|
||||
@@ -0,0 +1,23 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/ItemBucket.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/ItemBucket.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
+import net.minecraft.src.forge.MinecraftForge;
|
||||
+
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
// Item, EntityPlayer, MovingObjectPosition, EnumMovingObjectType,
|
||||
// World, Material, PlayerCapabilities, ItemStack,
|
||||
@@ -50,6 +52,11 @@
|
||||
{
|
||||
return itemstack;
|
||||
}
|
||||
+ ItemStack customBucket = MinecraftForge.fillCustomBucket(world,
|
||||
+ i, j, k);
|
||||
+ if (customBucket != null) {
|
||||
+ return customBucket;
|
||||
+ }
|
||||
if(world.getBlockMaterial(i, j, k) == Material.water && world.getBlockMetadata(i, j, k) == 0)
|
||||
{
|
||||
world.setBlockWithNotify(i, j, k, 0);
|
||||
@@ -0,0 +1,65 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/ItemDye.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/ItemDye.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -3,7 +3,9 @@
|
||||
// Decompiler options: packimports(3) braces deadcode fieldsfirst
|
||||
|
||||
package net.minecraft.src;
|
||||
+import net.minecraft.src.forge.ForgeHooks;
|
||||
|
||||
+import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
@@ -45,13 +47,18 @@
|
||||
|
||||
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l)
|
||||
{
|
||||
- if(!entityplayer.func_35190_e(i, j, k))
|
||||
+ if(entityplayer!=null && !entityplayer.func_35190_e(i, j, k))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(itemstack.getItemDamage() == 15)
|
||||
{
|
||||
int i1 = world.getBlockId(i, j, k);
|
||||
+ if(ForgeHooks.onUseBonemeal(world,i1,i,j,k)) {
|
||||
+ if(!world.multiplayerWorld)
|
||||
+ itemstack.stackSize--;
|
||||
+ return true;
|
||||
+ }
|
||||
if(i1 == Block.sapling.blockID)
|
||||
{
|
||||
if(!world.multiplayerWorld)
|
||||
@@ -118,13 +125,7 @@
|
||||
world.setBlockAndMetadataWithNotify(k1, l1, i2, Block.tallGrass.blockID, 1);
|
||||
continue;
|
||||
}
|
||||
- if(itemRand.nextInt(3) != 0)
|
||||
- {
|
||||
- world.setBlockWithNotify(k1, l1, i2, Block.plantYellow.blockID);
|
||||
- } else
|
||||
- {
|
||||
- world.setBlockWithNotify(k1, l1, i2, Block.plantRed.blockID);
|
||||
- }
|
||||
+ ForgeHooks.plantGrassPlant(world,k1,l1,i2);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -147,5 +148,17 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+ /* FORGE: Called when a new CreativeContainer is opened, populate the list
|
||||
+ * with all of the items for this item you want a player in creative mode
|
||||
+ * to have access to.
|
||||
+ */
|
||||
+ public void addCreativeItems(ArrayList itemList)
|
||||
+ {
|
||||
+ for (int x = 0; x < 16; x++)
|
||||
+ {
|
||||
+ itemList.add(new ItemStack(this, 1, x));
|
||||
+ }
|
||||
+ }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/ItemHoe.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/ItemHoe.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
package net.minecraft.src;
|
||||
|
||||
+import net.minecraft.src.forge.ForgeHooks;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
// Item, EnumToolMaterial, EntityPlayer, World,
|
||||
@@ -25,6 +26,10 @@
|
||||
{
|
||||
return false;
|
||||
}
|
||||
+ if(ForgeHooks.onUseHoe(itemstack,entityplayer,world,i,j,k)) {
|
||||
+ itemstack.damageItem(1, entityplayer);
|
||||
+ return true;
|
||||
+ }
|
||||
int i1 = world.getBlockId(i, j, k);
|
||||
int j1 = world.getBlockId(i, j + 1, k);
|
||||
if(l != 0 && j1 == 0 && i1 == Block.grass.blockID || i1 == Block.dirt.blockID)
|
||||
@@ -0,0 +1,42 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/ItemRenderer.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/ItemRenderer.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -5,6 +5,10 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
+import net.minecraft.src.forge.ForgeHooksClient;
|
||||
+import net.minecraft.src.forge.ICustomItemRenderer;
|
||||
+import net.minecraft.src.forge.MinecraftForgeClient;
|
||||
+
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
@@ -40,18 +44,27 @@
|
||||
public void renderItem(EntityLiving entityliving, ItemStack itemstack, int i)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
- if(itemstack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
|
||||
+ ICustomItemRenderer customRenderer = MinecraftForgeClient.getCustomItemRenderer(itemstack.itemID);
|
||||
+
|
||||
+ if (customRenderer != null) {
|
||||
+ GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/terrain.png"));
|
||||
+ ForgeHooksClient.overrideTexture (itemstack.getItem());
|
||||
+ ForgeHooksClient.renderCustomItem(customRenderer, renderBlocksInstance, itemstack.itemID, itemstack.getItemDamage(), entityliving.getEntityBrightness(1.0F));
|
||||
+ } else if(itemstack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
|
||||
{
|
||||
GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/terrain.png"));
|
||||
+ ForgeHooksClient.overrideTexture (Block.blocksList[itemstack.itemID]);
|
||||
renderBlocksInstance.renderBlockAsItem(Block.blocksList[itemstack.itemID], itemstack.getItemDamage(), 1.0F);
|
||||
} else
|
||||
{
|
||||
if(itemstack.itemID < 256)
|
||||
{
|
||||
GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/terrain.png"));
|
||||
+ ForgeHooksClient.overrideTexture (Block.blocksList[itemstack.itemID]);
|
||||
} else
|
||||
{
|
||||
GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/gui/items.png"));
|
||||
+ ForgeHooksClient.overrideTexture (Item.itemsList[itemstack.itemID]);
|
||||
}
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
int j = entityliving.getItemIcon(itemstack, i);
|
||||
@@ -0,0 +1,37 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/ItemTool.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/ItemTool.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
package net.minecraft.src;
|
||||
|
||||
+import java.util.Arrays;
|
||||
+import net.minecraft.src.forge.ForgeHooks;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
// Item, EnumToolMaterial, ItemStack, Block,
|
||||
@@ -13,8 +15,8 @@
|
||||
{
|
||||
|
||||
private Block blocksEffectiveAgainst[];
|
||||
- protected float efficiencyOnProperMaterial;
|
||||
- private int damageVsEntity;
|
||||
+ public float efficiencyOnProperMaterial;
|
||||
+ public int damageVsEntity;
|
||||
protected EnumToolMaterial toolMaterial;
|
||||
|
||||
protected ItemTool(int i, int j, EnumToolMaterial enumtoolmaterial, Block ablock[])
|
||||
@@ -42,6 +44,14 @@
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
+ /* FORGE: Overridden to allow custom tool effectiveness
|
||||
+ */
|
||||
+ public float getStrVsBlock(ItemStack itemstack, Block block, int md) {
|
||||
+ if(ForgeHooks.isToolEffective(itemstack,block,md))
|
||||
+ return efficiencyOnProperMaterial;
|
||||
+ return getStrVsBlock(itemstack,block);
|
||||
+ }
|
||||
+
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
|
||||
{
|
||||
itemstack.damageItem(2, entityliving1);
|
||||
@@ -0,0 +1,12 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/MovingObjectPosition.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/MovingObjectPosition.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -18,6 +18,9 @@
|
||||
public int sideHit;
|
||||
public Vec3D hitVec;
|
||||
public Entity entityHit;
|
||||
+
|
||||
+ //Added for RedPower subblocks
|
||||
+ public int subHit = -1;
|
||||
|
||||
public MovingObjectPosition(int i, int j, int k, int l, Vec3D vec3d)
|
||||
{
|
||||
@@ -0,0 +1,14 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/Packet100OpenWindow.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/Packet100OpenWindow.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -30,9 +30,9 @@
|
||||
throws IOException
|
||||
{
|
||||
windowId = datainputstream.readByte();
|
||||
- inventoryType = datainputstream.readByte();
|
||||
+ inventoryType = datainputstream.readByte()&0xFF;
|
||||
windowTitle = readString(datainputstream, 16);
|
||||
- slotsCount = datainputstream.readByte();
|
||||
+ slotsCount = datainputstream.readByte()&0xFF;
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream dataoutputstream)
|
||||
@@ -0,0 +1,14 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/Packet230ModLoader.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/Packet230ModLoader.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -75,7 +75,10 @@
|
||||
}));
|
||||
}
|
||||
byte abyte0[] = new byte[k1];
|
||||
- datainputstream.read(abyte0, 0, k1);
|
||||
+ int bytesRead = 0;
|
||||
+ while (bytesRead < k1) {
|
||||
+ bytesRead += datainputstream.read(abyte0, bytesRead, k1 - bytesRead);
|
||||
+ }
|
||||
dataString[j1] = new String(abyte0);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/Packet24MobSpawn.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/Packet24MobSpawn.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -15,7 +15,7 @@
|
||||
{
|
||||
|
||||
public int entityId;
|
||||
- public byte type;
|
||||
+ public int type;
|
||||
public int xPosition;
|
||||
public int yPosition;
|
||||
public int zPosition;
|
||||
@@ -44,7 +44,7 @@
|
||||
throws IOException
|
||||
{
|
||||
entityId = datainputstream.readInt();
|
||||
- type = datainputstream.readByte();
|
||||
+ type = datainputstream.readByte() & 0xFF;
|
||||
xPosition = datainputstream.readInt();
|
||||
yPosition = datainputstream.readInt();
|
||||
zPosition = datainputstream.readInt();
|
||||
@@ -0,0 +1,34 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/PlayerController.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/PlayerController.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -3,6 +3,7 @@
|
||||
// Decompiler options: packimports(3) braces deadcode fieldsfirst
|
||||
|
||||
package net.minecraft.src;
|
||||
+import net.minecraft.src.forge.*;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
@@ -39,11 +40,10 @@
|
||||
}
|
||||
world.playAuxSFX(2001, i, j, k, block.blockID + world.getBlockMetadata(i, j, k) * 256);
|
||||
int i1 = world.getBlockMetadata(i, j, k);
|
||||
- boolean flag = world.setBlockWithNotify(i, j, k, 0);
|
||||
- if(block != null && flag)
|
||||
- {
|
||||
- block.onBlockDestroyedByPlayer(world, i, j, k, i1);
|
||||
- }
|
||||
+
|
||||
+ boolean flag = block.removeBlockByPlayer(world, mc.thePlayer, i, j, k);
|
||||
+ if(flag)
|
||||
+ block.onBlockDestroyedByPlayer(world, i, j, k, i1);
|
||||
return flag;
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
if(itemstack1.stackSize == 0)
|
||||
{
|
||||
entityplayer.inventory.mainInventory[entityplayer.inventory.currentItem] = null;
|
||||
+ ForgeHooks.onDestroyCurrentItem(entityplayer,itemstack1);
|
||||
}
|
||||
return true;
|
||||
} else
|
||||
@@ -0,0 +1,75 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/PlayerControllerMP.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/PlayerControllerMP.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -4,6 +4,9 @@
|
||||
|
||||
package net.minecraft.src;
|
||||
|
||||
+import net.minecraft.src.forge.IUseItemFirst;
|
||||
+import net.minecraft.src.forge.ForgeHooks;
|
||||
+
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
@@ -68,13 +71,16 @@
|
||||
|
||||
public boolean sendBlockRemoved(int i, int j, int k, int l)
|
||||
{
|
||||
+ ItemStack itemstack = mc.thePlayer.getCurrentEquippedItem();
|
||||
+ if(itemstack!=null && itemstack.getItem().onBlockStartBreak(itemstack,
|
||||
+ i,j,k,mc.thePlayer))
|
||||
+ return false;
|
||||
if(creativeMode)
|
||||
{
|
||||
return super.sendBlockRemoved(i, j, k, l);
|
||||
}
|
||||
int i1 = mc.theWorld.getBlockId(i, j, k);
|
||||
boolean flag = super.sendBlockRemoved(i, j, k, l);
|
||||
- ItemStack itemstack = mc.thePlayer.getCurrentEquippedItem();
|
||||
if(itemstack != null)
|
||||
{
|
||||
itemstack.onDestroyBlock(i1, i, j, k, mc.thePlayer);
|
||||
@@ -103,7 +109,7 @@
|
||||
{
|
||||
Block.blocksList[i1].onBlockClicked(mc.theWorld, i, j, k, mc.thePlayer);
|
||||
}
|
||||
- if(i1 > 0 && Block.blocksList[i1].blockStrength(mc.thePlayer) >= 1.0F)
|
||||
+ if(i1 > 0 && Block.blocksList[i1].blockStrength(mc.theWorld,mc.thePlayer,i,j,k) >= 1.0F)
|
||||
{
|
||||
sendBlockRemoved(i, j, k, l);
|
||||
} else
|
||||
@@ -149,7 +155,7 @@
|
||||
return;
|
||||
}
|
||||
Block block = Block.blocksList[i1];
|
||||
- curBlockDamageMP += block.blockStrength(mc.thePlayer);
|
||||
+ curBlockDamageMP += block.blockStrength(mc.theWorld,mc.thePlayer,i,j,k);
|
||||
if(stepSoundTickCounter % 4F == 0.0F && block != null)
|
||||
{
|
||||
mc.sndManager.playSound(block.stepSound.stepSoundDir2(), (float)i + 0.5F, (float)j + 0.5F, (float)k + 0.5F, (block.stepSound.getVolume() + 1.0F) / 8F, block.stepSound.getPitch() * 0.5F);
|
||||
@@ -216,6 +222,13 @@
|
||||
{
|
||||
syncCurrentPlayItem();
|
||||
netClientHandler.addToSendQueue(new Packet15Place(i, j, k, l, entityplayer.inventory.getCurrentItem()));
|
||||
+
|
||||
+ if (itemstack != null && itemstack.getItem() instanceof IUseItemFirst) {
|
||||
+ IUseItemFirst iuif = (IUseItemFirst) itemstack.getItem();
|
||||
+ if (iuif.onItemUseFirst(itemstack, entityplayer, world, i, j, k, l)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
int i1 = world.getBlockId(i, j, k);
|
||||
if(i1 > 0 && Block.blocksList[i1].blockActivated(world, i, j, k, entityplayer))
|
||||
{
|
||||
@@ -235,7 +248,11 @@
|
||||
return flag;
|
||||
} else
|
||||
{
|
||||
- return itemstack.useItem(entityplayer, world, i, j, k, l);
|
||||
+ if(!itemstack.useItem(entityplayer, world, i, j, k, l))
|
||||
+ return false;
|
||||
+ if(itemstack.stackSize == 0)
|
||||
+ ForgeHooks.onDestroyCurrentItem(entityplayer,itemstack);
|
||||
+ return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/PlayerControllerSP.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/PlayerControllerSP.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -3,6 +3,8 @@
|
||||
// Decompiler options: packimports(3) braces deadcode fieldsfirst
|
||||
|
||||
package net.minecraft.src;
|
||||
+import net.minecraft.src.forge.IUseItemFirst;
|
||||
+import net.minecraft.src.forge.ForgeHooks;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
@@ -46,11 +48,14 @@
|
||||
|
||||
public boolean sendBlockRemoved(int i, int j, int k, int l)
|
||||
{
|
||||
+ ItemStack itemstack = mc.thePlayer.getCurrentEquippedItem();
|
||||
+ if(itemstack!=null && itemstack.getItem().onBlockStartBreak(itemstack,
|
||||
+ i,j,k,mc.thePlayer))
|
||||
+ return false;
|
||||
int i1 = mc.theWorld.getBlockId(i, j, k);
|
||||
int j1 = mc.theWorld.getBlockMetadata(i, j, k);
|
||||
boolean flag = super.sendBlockRemoved(i, j, k, l);
|
||||
- ItemStack itemstack = mc.thePlayer.getCurrentEquippedItem();
|
||||
- boolean flag1 = mc.thePlayer.canHarvestBlock(Block.blocksList[i1]);
|
||||
+ boolean flag1 = Block.blocksList[i1].canHarvestBlock(mc.thePlayer,j1);
|
||||
if(itemstack != null)
|
||||
{
|
||||
itemstack.onDestroyBlock(i1, i, j, k, mc.thePlayer);
|
||||
@@ -79,7 +84,7 @@
|
||||
{
|
||||
Block.blocksList[i1].onBlockClicked(mc.theWorld, i, j, k, mc.thePlayer);
|
||||
}
|
||||
- if(i1 > 0 && Block.blocksList[i1].blockStrength(mc.thePlayer) >= 1.0F)
|
||||
+ if(i1 > 0 && Block.blocksList[i1].blockStrength(mc.theWorld,mc.thePlayer,i,j,k) >= 1.0F)
|
||||
{
|
||||
sendBlockRemoved(i, j, k, l);
|
||||
}
|
||||
@@ -110,7 +115,7 @@
|
||||
return;
|
||||
}
|
||||
Block block = Block.blocksList[i1];
|
||||
- curBlockDamage += block.blockStrength(mc.thePlayer);
|
||||
+ curBlockDamage += block.blockStrength(mc.theWorld,mc.thePlayer,i,j,k);
|
||||
if(field_1069_h % 4F == 0.0F && block != null)
|
||||
{
|
||||
mc.sndManager.playSound(block.stepSound.stepSoundDir2(), (float)i + 0.5F, (float)j + 0.5F, (float)k + 0.5F, (block.stepSound.getVolume() + 1.0F) / 8F, block.stepSound.getPitch() * 0.5F);
|
||||
@@ -173,6 +178,12 @@
|
||||
|
||||
public boolean sendPlaceBlock(EntityPlayer entityplayer, World world, ItemStack itemstack, int i, int j, int k, int l)
|
||||
{
|
||||
+ if (itemstack != null && itemstack.getItem() instanceof IUseItemFirst) {
|
||||
+ IUseItemFirst iuif = (IUseItemFirst) itemstack.getItem();
|
||||
+ if (iuif.onItemUseFirst(itemstack, entityplayer, world, i, j, k, l)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
int i1 = world.getBlockId(i, j, k);
|
||||
if(i1 > 0 && Block.blocksList[i1].blockActivated(world, i, j, k, entityplayer))
|
||||
{
|
||||
@@ -183,7 +194,11 @@
|
||||
return false;
|
||||
} else
|
||||
{
|
||||
- return itemstack.useItem(entityplayer, world, i, j, k, l);
|
||||
+ if(!itemstack.useItem(entityplayer, world, i, j, k, l))
|
||||
+ return false;
|
||||
+ if(itemstack.stackSize == 0)
|
||||
+ ForgeHooks.onDestroyCurrentItem(entityplayer,itemstack);
|
||||
+ return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/RenderBlocks.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/RenderBlocks.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -3301,7 +3301,7 @@
|
||||
colorBlueTopRight *= f27;
|
||||
int k2 = block.getBlockTexture(blockAccess, i, j, k, 2);
|
||||
renderEastFace(block, i, j, k, k2);
|
||||
- if(cfgGrassFix && k2 == 3 && overrideBlockTexture < 0)
|
||||
+ if(Tessellator.instance.defaultTexture && cfgGrassFix && k2 == 3 && overrideBlockTexture < 0)
|
||||
{
|
||||
colorRedTopLeft *= f;
|
||||
colorRedBottomLeft *= f;
|
||||
@@ -3412,7 +3412,7 @@
|
||||
colorBlueTopRight *= f28;
|
||||
int l2 = block.getBlockTexture(blockAccess, i, j, k, 3);
|
||||
renderWestFace(block, i, j, k, block.getBlockTexture(blockAccess, i, j, k, 3));
|
||||
- if(cfgGrassFix && l2 == 3 && overrideBlockTexture < 0)
|
||||
+ if(Tessellator.instance.defaultTexture && cfgGrassFix && l2 == 3 && overrideBlockTexture < 0)
|
||||
{
|
||||
colorRedTopLeft *= f;
|
||||
colorRedBottomLeft *= f;
|
||||
@@ -3523,7 +3523,7 @@
|
||||
colorBlueTopRight *= f29;
|
||||
int i3 = block.getBlockTexture(blockAccess, i, j, k, 4);
|
||||
renderNorthFace(block, i, j, k, i3);
|
||||
- if(cfgGrassFix && i3 == 3 && overrideBlockTexture < 0)
|
||||
+ if(Tessellator.instance.defaultTexture && cfgGrassFix && i3 == 3 && overrideBlockTexture < 0)
|
||||
{
|
||||
colorRedTopLeft *= f;
|
||||
colorRedBottomLeft *= f;
|
||||
@@ -3634,7 +3634,7 @@
|
||||
colorBlueTopRight *= f30;
|
||||
int j3 = block.getBlockTexture(blockAccess, i, j, k, 5);
|
||||
renderSouthFace(block, i, j, k, j3);
|
||||
- if(cfgGrassFix && j3 == 3 && overrideBlockTexture < 0)
|
||||
+ if(Tessellator.instance.defaultTexture && cfgGrassFix && j3 == 3 && overrideBlockTexture < 0)
|
||||
{
|
||||
colorRedTopLeft *= f;
|
||||
colorRedBottomLeft *= f;
|
||||
@@ -3727,7 +3727,7 @@
|
||||
tessellator.setColorOpaque_F(f11, f14, f17);
|
||||
int i1 = block.getBlockTexture(blockAccess, i, j, k, 2);
|
||||
renderEastFace(block, i, j, k, i1);
|
||||
- if(cfgGrassFix && i1 == 3 && overrideBlockTexture < 0)
|
||||
+ if(Tessellator.instance.defaultTexture && cfgGrassFix && i1 == 3 && overrideBlockTexture < 0)
|
||||
{
|
||||
tessellator.setColorOpaque_F(f11 * f, f14 * f1, f17 * f2);
|
||||
renderEastFace(block, i, j, k, 38);
|
||||
@@ -3740,7 +3740,7 @@
|
||||
tessellator.setColorOpaque_F(f11, f14, f17);
|
||||
int j1 = block.getBlockTexture(blockAccess, i, j, k, 3);
|
||||
renderWestFace(block, i, j, k, j1);
|
||||
- if(cfgGrassFix && j1 == 3 && overrideBlockTexture < 0)
|
||||
+ if(Tessellator.instance.defaultTexture && cfgGrassFix && j1 == 3 && overrideBlockTexture < 0)
|
||||
{
|
||||
tessellator.setColorOpaque_F(f11 * f, f14 * f1, f17 * f2);
|
||||
renderWestFace(block, i, j, k, 38);
|
||||
@@ -3753,7 +3753,7 @@
|
||||
tessellator.setColorOpaque_F(f12, f15, f18);
|
||||
int k1 = block.getBlockTexture(blockAccess, i, j, k, 4);
|
||||
renderNorthFace(block, i, j, k, k1);
|
||||
- if(cfgGrassFix && k1 == 3 && overrideBlockTexture < 0)
|
||||
+ if(Tessellator.instance.defaultTexture && cfgGrassFix && k1 == 3 && overrideBlockTexture < 0)
|
||||
{
|
||||
tessellator.setColorOpaque_F(f12 * f, f15 * f1, f18 * f2);
|
||||
renderNorthFace(block, i, j, k, 38);
|
||||
@@ -3766,7 +3766,7 @@
|
||||
tessellator.setColorOpaque_F(f12, f15, f18);
|
||||
int l1 = block.getBlockTexture(blockAccess, i, j, k, 5);
|
||||
renderSouthFace(block, i, j, k, l1);
|
||||
- if(cfgGrassFix && l1 == 3 && overrideBlockTexture < 0)
|
||||
+ if(Tessellator.instance.defaultTexture && cfgGrassFix && l1 == 3 && overrideBlockTexture < 0)
|
||||
{
|
||||
tessellator.setColorOpaque_F(f12 * f, f15 * f1, f18 * f2);
|
||||
renderSouthFace(block, i, j, k, 38);
|
||||
@@ -0,0 +1,21 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/RenderEngine.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/RenderEngine.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -39,7 +39,7 @@
|
||||
private GameSettings options;
|
||||
public boolean clampTexture;
|
||||
public boolean blurTexture;
|
||||
- private TexturePackList texturePack;
|
||||
+ public TexturePackList texturePack;
|
||||
private BufferedImage missingTextureImage;
|
||||
|
||||
public RenderEngine(TexturePackList texturepacklist, GameSettings gamesettings)
|
||||
@@ -142,6 +142,9 @@
|
||||
}
|
||||
try
|
||||
{
|
||||
+ if(Tessellator.renderingWorldRenderer) {
|
||||
+ System.out.printf("Warning: Texture %s not preloaded, will cause render glitches!\n",s);
|
||||
+ }
|
||||
singleIntBuffer.clear();
|
||||
GLAllocation.generateTextureNames(singleIntBuffer);
|
||||
int i = singleIntBuffer.get(0);
|
||||
@@ -0,0 +1,24 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/RenderGlobal.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/RenderGlobal.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -34,8 +34,8 @@
|
||||
{
|
||||
|
||||
public List tileEntities;
|
||||
- private World worldObj;
|
||||
- private RenderEngine renderEngine;
|
||||
+ public World worldObj;
|
||||
+ public RenderEngine renderEngine;
|
||||
private List worldRenderersToUpdate;
|
||||
private WorldRenderer sortedWorldRenderers[];
|
||||
private WorldRenderer worldRenderers[];
|
||||
@@ -43,8 +43,8 @@
|
||||
private int renderChunksTall;
|
||||
private int renderChunksDeep;
|
||||
private int glRenderListBase;
|
||||
- private Minecraft mc;
|
||||
- private RenderBlocks globalRenderBlocks;
|
||||
+ public Minecraft mc;
|
||||
+ public RenderBlocks globalRenderBlocks;
|
||||
private IntBuffer glOcclusionQueryBase;
|
||||
private boolean occlusionEnabled;
|
||||
private int cloudOffsetX;
|
||||
@@ -0,0 +1,114 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/RenderItem.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/RenderItem.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -4,6 +4,10 @@
|
||||
|
||||
package net.minecraft.src;
|
||||
|
||||
+import net.minecraft.src.forge.ForgeHooksClient;
|
||||
+import net.minecraft.src.forge.ICustomItemRenderer;
|
||||
+import net.minecraft.src.forge.MinecraftForgeClient;
|
||||
+
|
||||
import java.util.Random;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -54,10 +58,36 @@
|
||||
}
|
||||
GL11.glTranslatef((float)d, (float)d1 + f2, (float)d2);
|
||||
GL11.glEnable(32826 /*GL_RESCALE_NORMAL_EXT*/);
|
||||
- if(itemstack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
|
||||
+
|
||||
+ ICustomItemRenderer customRenderer = MinecraftForgeClient.getCustomItemRenderer(itemstack.itemID);
|
||||
+
|
||||
+ if (customRenderer != null) {
|
||||
+ GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F);
|
||||
+ loadTexture("/terrain.png");
|
||||
+ ForgeHooksClient.overrideTexture(itemstack.getItem());
|
||||
+ float f4 = 0.25F;
|
||||
+ f4 = 0.5F;
|
||||
+ GL11.glScalef(f4, f4, f4);
|
||||
+ for(int j = 0; j < byte0; j++)
|
||||
+ {
|
||||
+ GL11.glPushMatrix();
|
||||
+ if(j > 0)
|
||||
+ {
|
||||
+ float f5 = ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / f4;
|
||||
+ float f7 = ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / f4;
|
||||
+ float f9 = ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / f4;
|
||||
+ GL11.glTranslatef(f5, f7, f9);
|
||||
+ }
|
||||
+ ForgeHooksClient.renderCustomItem(customRenderer, renderBlocks,
|
||||
+ itemstack.itemID, itemstack.getItemDamage(),
|
||||
+ entityitem.getEntityBrightness(f1));
|
||||
+ GL11.glPopMatrix();
|
||||
+ }
|
||||
+ } else if(itemstack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
|
||||
{
|
||||
GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F);
|
||||
loadTexture("/terrain.png");
|
||||
+ ForgeHooksClient.overrideTexture(Block.blocksList[itemstack.itemID]);
|
||||
float f4 = 0.25F;
|
||||
int j = Block.blocksList[itemstack.itemID].getRenderType();
|
||||
if(j == 1 || j == 19 || j == 12 || j == 2)
|
||||
@@ -108,9 +138,11 @@
|
||||
if(itemstack.itemID < 256)
|
||||
{
|
||||
loadTexture("/terrain.png");
|
||||
+ ForgeHooksClient.overrideTexture(Block.blocksList[itemstack.itemID]);
|
||||
} else
|
||||
{
|
||||
loadTexture("/gui/items.png");
|
||||
+ ForgeHooksClient.overrideTexture(Item.itemsList[itemstack.itemID]);
|
||||
}
|
||||
if(field_27004_a)
|
||||
{
|
||||
@@ -162,10 +194,37 @@
|
||||
|
||||
public void drawItemIntoGui(FontRenderer fontrenderer, RenderEngine renderengine, int i, int j, int k, int l, int i1)
|
||||
{
|
||||
- if(i < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[i].getRenderType()))
|
||||
+ ICustomItemRenderer customRenderer = MinecraftForgeClient.getCustomItemRenderer(i);
|
||||
+ if (customRenderer != null) {
|
||||
+ int j1 = i;
|
||||
+ renderengine.bindTexture(renderengine.getTexture("/terrain.png"));
|
||||
+ Item item = Item.itemsList[i];
|
||||
+ ForgeHooksClient.overrideTexture (Item.itemsList [i]);
|
||||
+ GL11.glPushMatrix();
|
||||
+ GL11.glTranslatef(l - 2, i1 + 3, -3F);
|
||||
+ GL11.glScalef(10F, 10F, 10F);
|
||||
+ GL11.glTranslatef(1.0F, 0.5F, 1.0F);
|
||||
+ GL11.glScalef(1.0F, 1.0F, -1F);
|
||||
+ GL11.glRotatef(210F, 1.0F, 0.0F, 0.0F);
|
||||
+ GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F);
|
||||
+ int l1 = Item.itemsList[i].getColorFromDamage(j);
|
||||
+ float f2 = (float)(l1 >> 16 & 0xff) / 255F;
|
||||
+ float f4 = (float)(l1 >> 8 & 0xff) / 255F;
|
||||
+ float f5 = (float)(l1 & 0xff) / 255F;
|
||||
+ if(field_27004_a)
|
||||
+ {
|
||||
+ GL11.glColor4f(f2, f4, f5, 1.0F);
|
||||
+ }
|
||||
+ GL11.glRotatef(-90F, 0.0F, 1.0F, 0.0F);
|
||||
+ renderBlocks.useInventoryTint = field_27004_a;
|
||||
+ ForgeHooksClient.renderCustomItem(customRenderer, renderBlocks, i, j, 1.0F);
|
||||
+ renderBlocks.useInventoryTint = true;
|
||||
+ GL11.glPopMatrix();
|
||||
+ } else if(i < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[i].getRenderType()))
|
||||
{
|
||||
int j1 = i;
|
||||
renderengine.bindTexture(renderengine.getTexture("/terrain.png"));
|
||||
+ ForgeHooksClient.overrideTexture (Block.blocksList[i]);
|
||||
Block block = Block.blocksList[j1];
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(l - 2, i1 + 3, -3F + zLevel);
|
||||
@@ -215,9 +274,11 @@
|
||||
if(i < 256)
|
||||
{
|
||||
renderengine.bindTexture(renderengine.getTexture("/terrain.png"));
|
||||
+ ForgeHooksClient.overrideTexture (Block.blocksList[i]);
|
||||
} else
|
||||
{
|
||||
renderengine.bindTexture(renderengine.getTexture("/gui/items.png"));
|
||||
+ ForgeHooksClient.overrideTexture(Item.itemsList[i]);
|
||||
}
|
||||
int k1 = Item.itemsList[i].getColorFromDamage(j);
|
||||
float f = (float)(k1 >> 16 & 0xff) / 255F;
|
||||
@@ -0,0 +1,26 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/RenderPlayer.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/RenderPlayer.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
package net.minecraft.src;
|
||||
|
||||
+import net.minecraft.src.forge.IArmorTextureProvider;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -41,7 +42,14 @@
|
||||
if(item instanceof ItemArmor)
|
||||
{
|
||||
ItemArmor itemarmor = (ItemArmor)item;
|
||||
- loadTexture((new StringBuilder()).append("/armor/").append(armorFilenamePrefix[itemarmor.renderIndex]).append("_").append(i != 2 ? 1 : 2).append(".png").toString());
|
||||
+ if ( item instanceof IArmorTextureProvider )
|
||||
+ {
|
||||
+ loadTexture( ((IArmorTextureProvider)item).getArmorTextureFile(itemstack) );
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ loadTexture((new StringBuilder()).append("/armor/").append(armorFilenamePrefix[itemarmor.renderIndex]).append("_").append(i != 2 ? 1 : 2).append(".png").toString());
|
||||
+ }
|
||||
ModelBiped modelbiped = i != 2 ? modelArmorChestplate : modelArmor;
|
||||
modelbiped.bipedHead.showModel = i == 0;
|
||||
modelbiped.bipedHeadwear.showModel = i == 0;
|
||||
@@ -0,0 +1,18 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/SlotCrafting.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/SlotCrafting.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -3,6 +3,7 @@
|
||||
// Decompiler options: packimports(3) braces deadcode fieldsfirst
|
||||
|
||||
package net.minecraft.src;
|
||||
+import net.minecraft.src.forge.ForgeHooks;
|
||||
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
@@ -71,6 +72,7 @@
|
||||
thePlayer.addStat(AchievementList.bookcase, 1);
|
||||
}
|
||||
ModLoader.TakenFromCrafting(thePlayer, itemstack, craftMatrix);
|
||||
+ ForgeHooks.onTakenFromCrafting(thePlayer, itemstack, craftMatrix);
|
||||
for(int i = 0; i < craftMatrix.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack itemstack1 = craftMatrix.getStackInSlot(i);
|
||||
@@ -0,0 +1,187 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/Tessellator.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/Tessellator.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -5,6 +5,7 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.nio.*;
|
||||
+import java.util.*;
|
||||
import org.lwjgl.opengl.*;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
@@ -12,13 +13,9 @@
|
||||
|
||||
public class Tessellator
|
||||
{
|
||||
-
|
||||
private static boolean convertQuadsToTriangles = false;
|
||||
private static boolean tryVBO = false;
|
||||
- private ByteBuffer byteBuffer;
|
||||
- private IntBuffer intBuffer;
|
||||
- private FloatBuffer floatBuffer;
|
||||
- private ShortBuffer shortBuffer;
|
||||
+ private static boolean useVBO = false;
|
||||
private int rawBuffer[];
|
||||
private int vertexCount;
|
||||
private double textureU;
|
||||
@@ -32,21 +29,47 @@
|
||||
private int rawBufferIndex;
|
||||
private int addedVertices;
|
||||
private boolean isColorDisabled;
|
||||
- private int drawMode;
|
||||
- private double xOffset;
|
||||
- private double yOffset;
|
||||
- private double zOffset;
|
||||
+ public int drawMode;
|
||||
+ public double xOffset;
|
||||
+ public double yOffset;
|
||||
+ public double zOffset;
|
||||
private int normal;
|
||||
- public static final Tessellator instance = new Tessellator(0x200000);
|
||||
- private boolean isDrawing;
|
||||
- private boolean useVBO;
|
||||
- private IntBuffer vertexBuffers;
|
||||
+ public boolean isDrawing;
|
||||
private int vboIndex;
|
||||
- private int vboCount;
|
||||
- private int bufferSize;
|
||||
+
|
||||
+ public static boolean renderingWorldRenderer=false;
|
||||
+ public boolean defaultTexture=false;
|
||||
+ private int rawBufferSize;
|
||||
+ private static int vboCount;
|
||||
+ private static IntBuffer vertexBuffers;
|
||||
+ private static int nativeBufferSize;
|
||||
+ private static int trivertsInBuffer;
|
||||
+ private static ByteBuffer byteBuffer;
|
||||
+ private static IntBuffer intBuffer;
|
||||
+ private static FloatBuffer floatBuffer;
|
||||
+ private static ShortBuffer shortBuffer;
|
||||
+ public static Tessellator instance;
|
||||
+
|
||||
+ static {
|
||||
+ instance=new Tessellator();
|
||||
+ instance.defaultTexture=true;
|
||||
+
|
||||
+ nativeBufferSize = 0x200000;
|
||||
+ trivertsInBuffer = (nativeBufferSize/48)*6;
|
||||
+ byteBuffer = GLAllocation.createDirectByteBuffer(nativeBufferSize * 4);
|
||||
+ intBuffer = byteBuffer.asIntBuffer();
|
||||
+ floatBuffer = byteBuffer.asFloatBuffer();
|
||||
+ shortBuffer = byteBuffer.asShortBuffer();
|
||||
+ useVBO = tryVBO && GLContext.getCapabilities().GL_ARB_vertex_buffer_object;
|
||||
+ vboCount = 10;
|
||||
+ if(useVBO)
|
||||
+ {
|
||||
+ vertexBuffers = GLAllocation.createDirectIntBuffer(vboCount);
|
||||
+ ARBVertexBufferObject.glGenBuffersARB(vertexBuffers);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- private Tessellator(int i)
|
||||
- {
|
||||
+ public Tessellator() {
|
||||
vertexCount = 0;
|
||||
hasColor = false;
|
||||
hasTexture = false;
|
||||
@@ -56,21 +79,10 @@
|
||||
addedVertices = 0;
|
||||
isColorDisabled = false;
|
||||
isDrawing = false;
|
||||
- useVBO = false;
|
||||
vboIndex = 0;
|
||||
- vboCount = 10;
|
||||
- bufferSize = i;
|
||||
- byteBuffer = GLAllocation.createDirectByteBuffer(i * 4);
|
||||
- intBuffer = byteBuffer.asIntBuffer();
|
||||
- floatBuffer = byteBuffer.asFloatBuffer();
|
||||
- shortBuffer = byteBuffer.asShortBuffer();
|
||||
- rawBuffer = new int[i];
|
||||
- useVBO = tryVBO && GLContext.getCapabilities().GL_ARB_vertex_buffer_object;
|
||||
- if(useVBO)
|
||||
- {
|
||||
- vertexBuffers = GLAllocation.createDirectIntBuffer(vboCount);
|
||||
- ARBVertexBufferObject.glGenBuffersARB(vertexBuffers);
|
||||
- }
|
||||
+
|
||||
+ rawBuffer=null;
|
||||
+ rawBufferSize=0;
|
||||
}
|
||||
|
||||
public int draw()
|
||||
@@ -80,12 +92,20 @@
|
||||
throw new IllegalStateException("Not tesselating!");
|
||||
}
|
||||
isDrawing = false;
|
||||
- if(vertexCount > 0)
|
||||
- {
|
||||
+ int offs=0;
|
||||
+ while(offs < vertexCount) {
|
||||
+ int vtc;
|
||||
+ if(drawMode == 7 && convertQuadsToTriangles) {
|
||||
+ vtc=Math.min(vertexCount-offs,trivertsInBuffer);
|
||||
+ } else {
|
||||
+ vtc=Math.min(vertexCount-offs,nativeBufferSize>>5);
|
||||
+ }
|
||||
+
|
||||
intBuffer.clear();
|
||||
- intBuffer.put(rawBuffer, 0, rawBufferIndex);
|
||||
+ intBuffer.put(rawBuffer, offs*8, vtc*8);
|
||||
byteBuffer.position(0);
|
||||
- byteBuffer.limit(rawBufferIndex * 4);
|
||||
+ byteBuffer.limit(vtc*32);
|
||||
+ offs+=vtc;
|
||||
if(useVBO)
|
||||
{
|
||||
vboIndex = (vboIndex + 1) % vboCount;
|
||||
@@ -153,10 +173,10 @@
|
||||
GL11.glEnableClientState(32884 /*GL_VERTEX_ARRAY_EXT*/);
|
||||
if(drawMode == 7 && convertQuadsToTriangles)
|
||||
{
|
||||
- GL11.glDrawArrays(4, 0, vertexCount);
|
||||
+ GL11.glDrawArrays(4, 0, vtc);
|
||||
} else
|
||||
{
|
||||
- GL11.glDrawArrays(drawMode, 0, vertexCount);
|
||||
+ GL11.glDrawArrays(drawMode, 0, vtc);
|
||||
}
|
||||
GL11.glDisableClientState(32884 /*GL_VERTEX_ARRAY_EXT*/);
|
||||
if(hasTexture)
|
||||
@@ -178,6 +198,10 @@
|
||||
GL11.glDisableClientState(32885 /*GL_NORMAL_ARRAY_EXT*/);
|
||||
}
|
||||
}
|
||||
+ if (rawBufferSize > 0x20000 && rawBufferIndex < (rawBufferSize<<3)) {
|
||||
+ rawBufferSize=0;
|
||||
+ rawBuffer=null;
|
||||
+ }
|
||||
int i = rawBufferIndex * 4;
|
||||
reset();
|
||||
return i;
|
||||
@@ -299,6 +323,15 @@
|
||||
|
||||
public void addVertex(double d, double d1, double d2)
|
||||
{
|
||||
+ if (rawBufferIndex >= rawBufferSize-32) {
|
||||
+ if (rawBufferSize == 0) {
|
||||
+ rawBufferSize = 0x10000;
|
||||
+ rawBuffer = new int[rawBufferSize];
|
||||
+ } else {
|
||||
+ rawBufferSize *= 2;
|
||||
+ rawBuffer = Arrays.copyOf(rawBuffer, rawBufferSize);
|
||||
+ }
|
||||
+ }
|
||||
addedVertices++;
|
||||
if(drawMode == 7 && convertQuadsToTriangles && addedVertices % 4 == 0)
|
||||
{
|
||||
@@ -348,11 +381,6 @@
|
||||
rawBuffer[rawBufferIndex + 2] = Float.floatToRawIntBits((float)(d2 + zOffset));
|
||||
rawBufferIndex += 8;
|
||||
vertexCount++;
|
||||
- if(vertexCount % 4 == 0 && rawBufferIndex >= bufferSize - 32)
|
||||
- {
|
||||
- draw();
|
||||
- isDrawing = true;
|
||||
- }
|
||||
}
|
||||
|
||||
public void setColorOpaque_I(int i)
|
||||
@@ -0,0 +1,16 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/TileEntity.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/TileEntity.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -72,6 +72,13 @@
|
||||
{
|
||||
}
|
||||
|
||||
+ /* FORGE: Return false if this TileEntity does not require updateEntity()
|
||||
+ * calls.
|
||||
+ */
|
||||
+ public boolean canUpdate() {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
public static TileEntity createAndLoadEntity(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
TileEntity tileentity = null;
|
||||
@@ -0,0 +1,86 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/TileEntityFurnace.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/TileEntityFurnace.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
package net.minecraft.src;
|
||||
|
||||
+import net.minecraft.src.forge.ISidedInventory;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
// TileEntity, IInventory, ItemStack, NBTTagCompound,
|
||||
@@ -12,7 +13,7 @@
|
||||
// EntityPlayer
|
||||
|
||||
public class TileEntityFurnace extends TileEntity
|
||||
- implements IInventory
|
||||
+ implements IInventory, ISidedInventory
|
||||
{
|
||||
|
||||
private ItemStack furnaceItemStacks[];
|
||||
@@ -33,6 +34,16 @@
|
||||
return furnaceItemStacks.length;
|
||||
}
|
||||
|
||||
+ public int getStartInventorySide(int side) {
|
||||
+ if(side==0) return 1;
|
||||
+ if(side==1) return 0;
|
||||
+ return 2;
|
||||
+ }
|
||||
+
|
||||
+ public int getSizeInventorySide(int side) {
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
public ItemStack getStackInSlot(int i)
|
||||
{
|
||||
return furnaceItemStacks[i];
|
||||
@@ -201,7 +212,7 @@
|
||||
{
|
||||
return false;
|
||||
}
|
||||
- ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0].getItem().shiftedIndex);
|
||||
+ ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0]);
|
||||
if(itemstack == null)
|
||||
{
|
||||
return false;
|
||||
@@ -214,11 +225,8 @@
|
||||
{
|
||||
return false;
|
||||
}
|
||||
- if(furnaceItemStacks[2].stackSize < getInventoryStackLimit() && furnaceItemStacks[2].stackSize < furnaceItemStacks[2].getMaxStackSize())
|
||||
- {
|
||||
- return true;
|
||||
- }
|
||||
- return furnaceItemStacks[2].stackSize < itemstack.getMaxStackSize();
|
||||
+ int st = furnaceItemStacks[2].stackSize + itemstack.stackSize;
|
||||
+ return (st <= getInventoryStackLimit() && st <= itemstack.getMaxStackSize());
|
||||
}
|
||||
|
||||
public void smeltItem()
|
||||
@@ -227,14 +235,14 @@
|
||||
{
|
||||
return;
|
||||
}
|
||||
- ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0].getItem().shiftedIndex);
|
||||
+ ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0]);
|
||||
if(furnaceItemStacks[2] == null)
|
||||
{
|
||||
furnaceItemStacks[2] = itemstack.copy();
|
||||
} else
|
||||
- if(furnaceItemStacks[2].itemID == itemstack.itemID)
|
||||
+ if(furnaceItemStacks[2].isItemEqual(itemstack))
|
||||
{
|
||||
- furnaceItemStacks[2].stackSize++;
|
||||
+ furnaceItemStacks[2].stackSize += itemstack.stackSize;
|
||||
}
|
||||
if(furnaceItemStacks[0].getItem().hasContainerItem())
|
||||
{
|
||||
@@ -249,7 +257,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- private int getItemBurnTime(ItemStack itemstack)
|
||||
+ public static int getItemBurnTime(ItemStack itemstack)
|
||||
{
|
||||
if(itemstack == null)
|
||||
{
|
||||
@@ -0,0 +1,26 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/TileEntityRendererPiston.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/TileEntityRendererPiston.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
package net.minecraft.src;
|
||||
|
||||
+import net.minecraft.src.forge.ForgeHooksClient;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -40,6 +41,7 @@
|
||||
{
|
||||
GL11.glShadeModel(7424 /*GL_FLAT*/);
|
||||
}
|
||||
+ ForgeHooksClient.beforeBlockRender(block,field_31071_b);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setTranslationD(((float)d - (float)tileentitypiston.xCoord) + tileentitypiston.func_31017_b(f), ((float)d1 - (float)tileentitypiston.yCoord) + tileentitypiston.func_31014_c(f), ((float)d2 - (float)tileentitypiston.zCoord) + tileentitypiston.func_31013_d(f));
|
||||
tessellator.setColorOpaque(1, 1, 1);
|
||||
@@ -60,6 +62,7 @@
|
||||
}
|
||||
tessellator.setTranslationD(0.0D, 0.0D, 0.0D);
|
||||
tessellator.draw();
|
||||
+ ForgeHooksClient.afterBlockRender(block,field_31071_b);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/World.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/World.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -51,7 +51,7 @@
|
||||
public int lightningFlash;
|
||||
public boolean editingBlocks;
|
||||
private long lockTimestamp;
|
||||
- protected int autosavePeriod;
|
||||
+ public int autosavePeriod;
|
||||
public int difficultySetting;
|
||||
public Random rand;
|
||||
public boolean isNewWorld;
|
||||
@@ -406,7 +406,10 @@
|
||||
|
||||
public boolean isAirBlock(int i, int j, int k)
|
||||
{
|
||||
- return getBlockId(i, j, k) == 0;
|
||||
+ int iBlockID = getBlockId( i, j, k );
|
||||
+ if ( iBlockID == 0 )
|
||||
+ return true;
|
||||
+ return Block.blocksList[iBlockID].isAirBlock(this,i,j,k);
|
||||
}
|
||||
|
||||
public boolean blockExists(int i, int j, int k)
|
||||
@@ -1576,7 +1579,7 @@
|
||||
Chunk chunk = getChunkFromChunkCoords(tileentity.xCoord >> 4, tileentity.zCoord >> 4);
|
||||
if(chunk != null)
|
||||
{
|
||||
- chunk.removeChunkBlockTileEntity(tileentity.xCoord & 0xf, tileentity.yCoord, tileentity.zCoord & 0xf);
|
||||
+ chunk.cleanChunkBlockTileEntity(tileentity.xCoord & 0xf, tileentity.yCoord, tileentity.zCoord & 0xf);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1604,16 +1607,16 @@
|
||||
{
|
||||
loadedTileEntityList.add(tileentity1);
|
||||
}
|
||||
+ } else {
|
||||
if(chunkExists(tileentity1.xCoord >> 4, tileentity1.zCoord >> 4))
|
||||
{
|
||||
Chunk chunk1 = getChunkFromChunkCoords(tileentity1.xCoord >> 4, tileentity1.zCoord >> 4);
|
||||
if(chunk1 != null)
|
||||
{
|
||||
- chunk1.setChunkBlockTileEntity(tileentity1.xCoord & 0xf, tileentity1.yCoord, tileentity1.zCoord & 0xf, tileentity1);
|
||||
+ chunk1.cleanChunkBlockTileEntity(tileentity1.xCoord & 0xf, tileentity1.yCoord, tileentity1.zCoord & 0xf);
|
||||
}
|
||||
}
|
||||
- markBlockNeedsUpdate(tileentity1.xCoord, tileentity1.yCoord, tileentity1.zCoord);
|
||||
- }
|
||||
+ }
|
||||
} while(true);
|
||||
addedTileEntityList.clear();
|
||||
}
|
||||
@@ -1623,13 +1626,17 @@
|
||||
|
||||
public void addTileEntity(Collection collection)
|
||||
{
|
||||
- if(scanningTileEntities)
|
||||
- {
|
||||
- addedTileEntityList.addAll(collection);
|
||||
- } else
|
||||
- {
|
||||
- loadedTileEntityList.addAll(collection);
|
||||
- }
|
||||
+ List dest=scanningTileEntities ? addedTileEntityList : loadedTileEntityList;
|
||||
+ for(Object ob : collection) {
|
||||
+ TileEntity te = (TileEntity)ob;
|
||||
+ if(te.canUpdate()) dest.add(te);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Used as a bugfix */
|
||||
+ public void addTileEntity(TileEntity te) {
|
||||
+ List dest=scanningTileEntities ? addedTileEntityList : loadedTileEntityList;
|
||||
+ if(te.canUpdate()) dest.add(te);
|
||||
}
|
||||
|
||||
public void updateEntity(Entity entity)
|
||||
@@ -1789,7 +1796,10 @@
|
||||
if(j2 == Block.fire.blockID || j2 == Block.lavaMoving.blockID || j2 == Block.lavaStill.blockID)
|
||||
{
|
||||
return true;
|
||||
- }
|
||||
+ } else {
|
||||
+ if(j2>0 && Block.blocksList[j2].isBlockBurning(this,k1,l1,i2))
|
||||
+ return true;
|
||||
+ }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2044,46 +2054,22 @@
|
||||
|
||||
public void setBlockTileEntity(int i, int j, int k, TileEntity tileentity)
|
||||
{
|
||||
- if(tileentity != null && !tileentity.isInvalid())
|
||||
- {
|
||||
- if(scanningTileEntities)
|
||||
- {
|
||||
- tileentity.xCoord = i;
|
||||
- tileentity.yCoord = j;
|
||||
- tileentity.zCoord = k;
|
||||
- addedTileEntityList.add(tileentity);
|
||||
- } else
|
||||
- {
|
||||
- loadedTileEntityList.add(tileentity);
|
||||
- Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4);
|
||||
- if(chunk != null)
|
||||
- {
|
||||
- chunk.setChunkBlockTileEntity(i & 0xf, j, k & 0xf, tileentity);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
+ if(tileentity==null || tileentity.isInvalid())
|
||||
+ return;
|
||||
+ List dest=scanningTileEntities ? addedTileEntityList : loadedTileEntityList;
|
||||
+ if(tileentity.canUpdate()) dest.add(tileentity);
|
||||
+ Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4);
|
||||
+ if(chunk != null) {
|
||||
+ chunk.setChunkBlockTileEntity(i & 0xf, j, k & 0xf, tileentity);
|
||||
+ }
|
||||
}
|
||||
|
||||
public void removeBlockTileEntity(int i, int j, int k)
|
||||
{
|
||||
- TileEntity tileentity = getBlockTileEntity(i, j, k);
|
||||
- if(tileentity != null && scanningTileEntities)
|
||||
- {
|
||||
- tileentity.invalidate();
|
||||
- addedTileEntityList.remove(tileentity);
|
||||
- } else
|
||||
- {
|
||||
- if(tileentity != null)
|
||||
- {
|
||||
- addedTileEntityList.remove(tileentity);
|
||||
- loadedTileEntityList.remove(tileentity);
|
||||
- }
|
||||
- Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4);
|
||||
- if(chunk != null)
|
||||
- {
|
||||
- chunk.removeChunkBlockTileEntity(i & 0xf, j, k & 0xf);
|
||||
- }
|
||||
- }
|
||||
+ Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4);
|
||||
+ if(chunk != null) {
|
||||
+ chunk.removeChunkBlockTileEntity(i & 0xf, j, k & 0xf);
|
||||
+ }
|
||||
}
|
||||
|
||||
public void func_35455_a(TileEntity tileentity)
|
||||
@@ -2106,13 +2092,18 @@
|
||||
public boolean isBlockNormalCube(int i, int j, int k)
|
||||
{
|
||||
Block block = Block.blocksList[getBlockId(i, j, k)];
|
||||
- if(block == null)
|
||||
- {
|
||||
- return false;
|
||||
- } else
|
||||
- {
|
||||
- return block.blockMaterial.getIsOpaque() && block.renderAsNormalBlock();
|
||||
- }
|
||||
+ if(block == null) return false;
|
||||
+ return block.isBlockNormalCube(this,i,j,k);
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Determine if the given block is considered solid on the
|
||||
+ * specified side. Used by placement logic.
|
||||
+ */
|
||||
+ public boolean isBlockSolidOnSide(int i, int j, int k, int side)
|
||||
+ {
|
||||
+ Block block = Block.blocksList[getBlockId(i, j, k)];
|
||||
+ if(block == null) return false;
|
||||
+ return block.isBlockSolidOnSide(this,i,j,k,side);
|
||||
}
|
||||
|
||||
public boolean func_41082_b(int i, int j, int k, boolean flag)
|
||||
@@ -2531,7 +2522,7 @@
|
||||
|
||||
private int computeBlockLightValue(int i, int j, int k, int l, int i1, int j1)
|
||||
{
|
||||
- int k1 = Block.lightValue[i1];
|
||||
+ int k1 = (i1==0) ? 0 : Block.blocksList[i1].getLightValue(this,j,k,l);
|
||||
int l1 = getSavedLightValue(EnumSkyBlock.Block, j - 1, k, l) - j1;
|
||||
int i2 = getSavedLightValue(EnumSkyBlock.Block, j + 1, k, l) - j1;
|
||||
int j2 = getSavedLightValue(EnumSkyBlock.Block, j, k - 1, l) - j1;
|
||||
@@ -2940,6 +2931,7 @@
|
||||
{
|
||||
block = null;
|
||||
}
|
||||
+ if (block != null && block.isBlockReplaceable(this,j,k,l)) block = null;
|
||||
return i > 0 && block == null && block1.canPlaceBlockOnSide(this, j, k, l, i1);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/WorldRenderer.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/WorldRenderer.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
package net.minecraft.src;
|
||||
|
||||
+import net.minecraft.src.forge.ForgeHooksClient;
|
||||
+
|
||||
import java.util.*;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -18,7 +20,6 @@
|
||||
|
||||
public World worldObj;
|
||||
private int glRenderList;
|
||||
- private static Tessellator tessellator;
|
||||
public static int chunksUpdated = 0;
|
||||
public int posX;
|
||||
public int posY;
|
||||
@@ -160,8 +161,9 @@
|
||||
GL11.glTranslatef((float)(-sizeDepth) / 2.0F, (float)(-sizeHeight) / 2.0F, (float)(-sizeDepth) / 2.0F);
|
||||
GL11.glScalef(f, f, f);
|
||||
GL11.glTranslatef((float)sizeDepth / 2.0F, (float)sizeHeight / 2.0F, (float)sizeDepth / 2.0F);
|
||||
- tessellator.startDrawingQuads();
|
||||
- tessellator.setTranslationD(-posX, -posY, -posZ);
|
||||
+ ForgeHooksClient.beforeRenderPass(i2);
|
||||
+ Tessellator.instance.startDrawingQuads();
|
||||
+ Tessellator.instance.setTranslationD(-posX, -posY, -posZ);
|
||||
}
|
||||
if(i2 == 0 && Block.isBlockContainer[i3])
|
||||
{
|
||||
@@ -177,15 +179,13 @@
|
||||
{
|
||||
flag1 = true;
|
||||
}
|
||||
- if(j3 != i2)
|
||||
- {
|
||||
- flag = true;
|
||||
- continue;
|
||||
- }
|
||||
- if(j3 == i2)
|
||||
- {
|
||||
- flag1 |= renderblocks.renderBlockByRenderType(block, l2, j2, k2);
|
||||
- }
|
||||
+ if (j3 > i2) flag = true;
|
||||
+ if(!ForgeHooksClient.canRenderInPass(block,i2))
|
||||
+ continue;
|
||||
+
|
||||
+ ForgeHooksClient.beforeBlockRender(block, renderblocks);
|
||||
+ flag1 |= renderblocks.renderBlockByRenderType(block, l2, j2, k2);
|
||||
+ ForgeHooksClient.afterBlockRender(block, renderblocks);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -194,10 +194,11 @@
|
||||
|
||||
if(flag2)
|
||||
{
|
||||
- bytesDrawn += tessellator.draw();
|
||||
+ ForgeHooksClient.afterRenderPass(i2);
|
||||
+ bytesDrawn += Tessellator.instance.draw();
|
||||
GL11.glPopMatrix();
|
||||
GL11.glEndList();
|
||||
- tessellator.setTranslationD(0.0D, 0.0D, 0.0D);
|
||||
+ Tessellator.instance.setTranslationD(0.0D, 0.0D, 0.0D);
|
||||
} else
|
||||
{
|
||||
flag1 = false;
|
||||
@@ -288,8 +289,4 @@
|
||||
needsUpdate = true;
|
||||
}
|
||||
|
||||
- static
|
||||
- {
|
||||
- tessellator = Tessellator.instance;
|
||||
- }
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
--- ../src_base/minecraft_server/net/minecraft/src/Block.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft_server/net/minecraft/src/Block.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -3,6 +3,7 @@
|
||||
// Decompiler options: packimports(3) braces deadcode fieldsfirst
|
||||
|
||||
package net.minecraft.src;
|
||||
+import net.minecraft.src.forge.ForgeHooks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
@@ -384,26 +385,57 @@
|
||||
return 1;
|
||||
}
|
||||
|
||||
+ /* FORGE: Metadata-sensitive version.
|
||||
+ */
|
||||
+ public int quantityDropped(int meta, int fortune, Random random)
|
||||
+ {
|
||||
+ return func_40162_a(fortune, random);
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Metadata-sensitive version.
|
||||
+ */
|
||||
+ public int quantityDropped(int meta, Random random)
|
||||
+ {
|
||||
+ return quantityDropped(meta, 0, random);
|
||||
+ }
|
||||
+
|
||||
public int idDropped(int i, Random random, int j)
|
||||
{
|
||||
return blockID;
|
||||
}
|
||||
-
|
||||
+
|
||||
+ /* FORGE: This function isnt called by Minecraft anymore. Use
|
||||
+ * blockStrength(EntityPlayer,int) instead.
|
||||
+ */
|
||||
public float blockStrength(EntityPlayer entityplayer)
|
||||
{
|
||||
- if(blockHardness < 0.0F)
|
||||
- {
|
||||
- return 0.0F;
|
||||
- }
|
||||
- if(!entityplayer.canHarvestBlock(this))
|
||||
- {
|
||||
- return 1.0F / blockHardness / 100F;
|
||||
- } else
|
||||
- {
|
||||
- return entityplayer.getCurrentPlayerStrVsBlock(this) / blockHardness / 30F;
|
||||
- }
|
||||
+ return blockStrength(entityplayer);
|
||||
}
|
||||
-
|
||||
+
|
||||
+ /* FORGE: This function returns the complete list of drops for a block.
|
||||
+ */
|
||||
+ public ArrayList<ItemStack> getBlockDropped(World world,
|
||||
+ int i, int j, int k, int md, int fortune) {
|
||||
+
|
||||
+ ArrayList<ItemStack> tr = new ArrayList<ItemStack>();
|
||||
+
|
||||
+ int q = quantityDropped(md, fortune, world.rand);
|
||||
+ for(int n = 0; n < q; n++) {
|
||||
+ int id = idDropped(md, world.rand, 0);
|
||||
+ if (id > 0) {
|
||||
+ tr.add(new ItemStack(id, 1, damageDropped(md)));
|
||||
+ }
|
||||
+ }
|
||||
+ return tr;
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: This function returns the complete list of drops for a block.
|
||||
+ */
|
||||
+ public ArrayList<ItemStack> getBlockDropped(World world,
|
||||
+ int i, int j, int k, int md) {
|
||||
+ return getBlockDropped (world, i, j, k, md);
|
||||
+ }
|
||||
+
|
||||
public final void dropBlockAsItem(World world, int i, int j, int k, int l, int i1)
|
||||
{
|
||||
dropBlockAsItemWithChance(world, i, j, k, l, 1.0F, i1);
|
||||
@@ -415,18 +447,14 @@
|
||||
{
|
||||
return;
|
||||
}
|
||||
- int j1 = func_40162_a(i1, world.rand);
|
||||
- for(int k1 = 0; k1 < j1; k1++)
|
||||
+ ArrayList<ItemStack> ar = getBlockDropped(world, i, j, k, l, i1);
|
||||
+ for (ItemStack ist : ar)
|
||||
{
|
||||
if(world.rand.nextFloat() > f)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
- int l1 = idDropped(l, world.rand, i1);
|
||||
- if(l1 > 0)
|
||||
- {
|
||||
- dropBlockAsItem_do(world, i, j, k, new ItemStack(l1, 1, damageDropped(l)));
|
||||
- }
|
||||
+ dropBlockAsItem_do(world, i, j, k, ist);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -725,6 +753,99 @@
|
||||
return blockMaterial.getMaterialMobility();
|
||||
}
|
||||
|
||||
+ /* FORGE: Allow a block to set illumination on a coordinate basis.
|
||||
+ */
|
||||
+ public int getLightValue(IBlockAccess iba, int i, int j, int k) {
|
||||
+ return lightValue[blockID];
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Implement and return true if you wish this block to behave
|
||||
+ * like a ladder when the player is inside.
|
||||
+ */
|
||||
+ public boolean isLadder() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Return true if the block is a normal, solid cube. This
|
||||
+ * determines indirect power state, entity ejection from blocks, and a few
|
||||
+ * others.
|
||||
+ */
|
||||
+ public boolean isBlockNormalCube(World world, int i, int j, int k) {
|
||||
+ return blockMaterial.getIsOpaque() && isACube();
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Return true if the block is solid on the given side. This
|
||||
+ * is used by placement logic. */
|
||||
+ public boolean isBlockSolidOnSide( World world, int i, int j, int k,
|
||||
+ int side ) {
|
||||
+ return isBlockNormalCube(world,i,j,k);
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Return true if the player can place a new block in the block
|
||||
+ * occupied by this one, like water, lava, fire, etc.
|
||||
+ */
|
||||
+ public boolean isBlockReplaceable( World world, int i, int j, int k ) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Return true if this block should set fire and deal fire damage
|
||||
+ * to entities coming into contact with it, false otherwise.
|
||||
+ */
|
||||
+ public boolean isBlockBurning( World world, int i, int j, int k ) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Return true if this block should be treated as an air block
|
||||
+ * by the rest of the code, false otherwise. This method is primarily
|
||||
+ * useful for creating pure logic-blocks that will be invisible
|
||||
+ * to the player and otherwise interact as air would.
|
||||
+ */
|
||||
+ public boolean isAirBlock( World world, int i, int j, int k ) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Return the block hardness with metadata md.
|
||||
+ */
|
||||
+ public float getHardness(int md) {
|
||||
+ return blockHardness;
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Return the block strength of the block at i,j,k against the
|
||||
+ * player.
|
||||
+ */
|
||||
+ public float blockStrength(World world, EntityPlayer player,
|
||||
+ int i, int j, int k) {
|
||||
+ int md=world.getBlockMetadata(i,j,k);
|
||||
+ return blockStrength(player,md);
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Return the block strength of a prototypical block with metadata
|
||||
+ * md against the player.
|
||||
+ */
|
||||
+ public float blockStrength(EntityPlayer player, int md) {
|
||||
+ return ForgeHooks.blockStrength(this,player,md);
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Return true if the player can harvest a prototypical block with
|
||||
+ * metadata md.
|
||||
+ */
|
||||
+ public boolean canHarvestBlock(EntityPlayer player, int md) {
|
||||
+ return ForgeHooks.canHarvestBlock(this,player,md);
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Called when a player removes a block. This is responsible for
|
||||
+ * actually destroying the block, and the block is intact at time of call.
|
||||
+ * This is called regardless of whether the player can harvest the block or
|
||||
+ * not. Return true if the block is actually destroyed.
|
||||
+ *
|
||||
+ * Note: When used in multiplayer, this is called on both client and
|
||||
+ * server sides!
|
||||
+ */
|
||||
+ public boolean removeBlockByPlayer(World world, EntityPlayer player,
|
||||
+ int i, int j, int k) {
|
||||
+ return world.setBlockWithNotify(i, j, k, 0);
|
||||
+ }
|
||||
+
|
||||
static Class _mthclass$(String s)
|
||||
{
|
||||
try
|
||||
@@ -0,0 +1,119 @@
|
||||
--- ../src_base/minecraft_server/net/minecraft/src/BlockButton.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft_server/net/minecraft/src/BlockButton.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -41,36 +41,36 @@
|
||||
|
||||
public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l)
|
||||
{
|
||||
- if(l == 2 && world.isBlockNormalCube(i, j, k + 1))
|
||||
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(l == 3 && world.isBlockNormalCube(i, j, k - 1))
|
||||
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(l == 4 && world.isBlockNormalCube(i + 1, j, k))
|
||||
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- return l == 5 && world.isBlockNormalCube(i - 1, j, k);
|
||||
+ return l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5);
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World world, int i, int j, int k)
|
||||
{
|
||||
- if(world.isBlockNormalCube(i - 1, j, k))
|
||||
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(world.isBlockNormalCube(i + 1, j, k))
|
||||
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(world.isBlockNormalCube(i, j, k - 1))
|
||||
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- return world.isBlockNormalCube(i, j, k + 1);
|
||||
+ return world.isBlockSolidOnSide(i, j, k + 1,2);
|
||||
}
|
||||
|
||||
public void onBlockPlaced(World world, int i, int j, int k, int l)
|
||||
@@ -78,19 +78,19 @@
|
||||
int i1 = world.getBlockMetadata(i, j, k);
|
||||
int j1 = i1 & 8;
|
||||
i1 &= 7;
|
||||
- if(l == 2 && world.isBlockNormalCube(i, j, k + 1))
|
||||
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
|
||||
{
|
||||
i1 = 4;
|
||||
} else
|
||||
- if(l == 3 && world.isBlockNormalCube(i, j, k - 1))
|
||||
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
|
||||
{
|
||||
i1 = 3;
|
||||
} else
|
||||
- if(l == 4 && world.isBlockNormalCube(i + 1, j, k))
|
||||
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
|
||||
{
|
||||
i1 = 2;
|
||||
} else
|
||||
- if(l == 5 && world.isBlockNormalCube(i - 1, j, k))
|
||||
+ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5))
|
||||
{
|
||||
i1 = 1;
|
||||
} else
|
||||
@@ -102,19 +102,19 @@
|
||||
|
||||
private int getOrientation(World world, int i, int j, int k)
|
||||
{
|
||||
- if(world.isBlockNormalCube(i - 1, j, k))
|
||||
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
- if(world.isBlockNormalCube(i + 1, j, k))
|
||||
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
- if(world.isBlockNormalCube(i, j, k - 1))
|
||||
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
- return !world.isBlockNormalCube(i, j, k + 1) ? 1 : 4;
|
||||
+ return !world.isBlockSolidOnSide(i, j, k + 1,2) ? 1 : 4;
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
|
||||
@@ -123,19 +123,19 @@
|
||||
{
|
||||
int i1 = world.getBlockMetadata(i, j, k) & 7;
|
||||
boolean flag = false;
|
||||
- if(!world.isBlockNormalCube(i - 1, j, k) && i1 == 1)
|
||||
+ if(!world.isBlockSolidOnSide(i - 1, j, k,5) && i1 == 1)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(!world.isBlockNormalCube(i + 1, j, k) && i1 == 2)
|
||||
+ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(!world.isBlockNormalCube(i, j, k - 1) && i1 == 3)
|
||||
+ if(!world.isBlockSolidOnSide(i, j, k - 1,3) && i1 == 3)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(!world.isBlockNormalCube(i, j, k + 1) && i1 == 4)
|
||||
+ if(!world.isBlockSolidOnSide(i, j, k + 1,2) && i1 == 4)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
--- ../src_base/minecraft_server/net/minecraft/src/BlockChest.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft_server/net/minecraft/src/BlockChest.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -339,23 +339,23 @@
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(world.isBlockNormalCube(i, j + 1, k))
|
||||
+ if(world.isBlockSolidOnSide(i, j + 1, k,0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(world.getBlockId(i - 1, j, k) == blockID && world.isBlockNormalCube(i - 1, j + 1, k))
|
||||
+ if(world.getBlockId(i - 1, j, k) == blockID && world.isBlockSolidOnSide(i - 1, j + 1, k,0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(world.getBlockId(i + 1, j, k) == blockID && world.isBlockNormalCube(i + 1, j + 1, k))
|
||||
+ if(world.getBlockId(i + 1, j, k) == blockID && world.isBlockSolidOnSide(i + 1, j + 1, k,0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(world.getBlockId(i, j, k - 1) == blockID && world.isBlockNormalCube(i, j + 1, k - 1))
|
||||
+ if(world.getBlockId(i, j, k - 1) == blockID && world.isBlockSolidOnSide(i, j + 1, k - 1,0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(world.getBlockId(i, j, k + 1) == blockID && world.isBlockNormalCube(i, j + 1, k + 1))
|
||||
+ if(world.getBlockId(i, j, k + 1) == blockID && world.isBlockSolidOnSide(i, j + 1, k + 1,0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
--- ../src_base/minecraft_server/net/minecraft/src/BlockContainer.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft_server/net/minecraft/src/BlockContainer.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -26,7 +26,7 @@
|
||||
public void onBlockAdded(World world, int i, int j, int k)
|
||||
{
|
||||
super.onBlockAdded(world, i, j, k);
|
||||
- world.setBlockTileEntity(i, j, k, getBlockEntity());
|
||||
+ world.setBlockTileEntity(i, j, k, getBlockEntity(world.getBlockMetadata(i,j,k)));
|
||||
}
|
||||
|
||||
public void onBlockRemoval(World world, int i, int j, int k)
|
||||
@@ -37,6 +37,12 @@
|
||||
|
||||
public abstract TileEntity getBlockEntity();
|
||||
|
||||
+ /* FORGE: Metadata-sensitive version, to fix 1.8.1 regression.
|
||||
+ */
|
||||
+ public TileEntity getBlockEntity(int md) {
|
||||
+ return getBlockEntity();
|
||||
+ }
|
||||
+
|
||||
public void playBlock(World world, int i, int j, int k, int l, int i1)
|
||||
{
|
||||
super.playBlock(world, i, j, k, l, i1);
|
||||
@@ -0,0 +1,48 @@
|
||||
--- ../src_base/minecraft_server/net/minecraft/src/BlockCrops.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft_server/net/minecraft/src/BlockCrops.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -5,6 +5,7 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
+import java.util.ArrayList;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
// BlockFlower, Block, World, EntityItem,
|
||||
@@ -108,28 +109,16 @@
|
||||
return 6;
|
||||
}
|
||||
|
||||
- public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f, int i1)
|
||||
- {
|
||||
- super.dropBlockAsItemWithChance(world, i, j, k, l, f, 0);
|
||||
- if(world.singleplayerWorld)
|
||||
- {
|
||||
- return;
|
||||
+ public ArrayList<ItemStack> getBlockDropped(World world,
|
||||
+ int i, int j, int k, int md) {
|
||||
+ ArrayList<ItemStack> tr = new ArrayList<ItemStack>();
|
||||
+ if (md == 7) tr.add(new ItemStack(Item.wheat));
|
||||
+
|
||||
+ for(int n = 0; n < 3; n++) {
|
||||
+ if (world.rand.nextInt(15) <= md)
|
||||
+ tr.add(new ItemStack(Item.seeds));
|
||||
}
|
||||
- int j1 = 3 + i1;
|
||||
- for(int k1 = 0; k1 < j1; k1++)
|
||||
- {
|
||||
- if(world.rand.nextInt(15) <= l)
|
||||
- {
|
||||
- float f1 = 0.7F;
|
||||
- float f2 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
|
||||
- float f3 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
|
||||
- float f4 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
|
||||
- EntityItem entityitem = new EntityItem(world, (float)i + f2, (float)j + f3, (float)k + f4, new ItemStack(Item.seeds));
|
||||
- entityitem.delayBeforeCanPickup = 10;
|
||||
- world.entityJoinedWorld(entityitem);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
+ return tr;
|
||||
}
|
||||
|
||||
public int idDropped(int i, Random random, int j)
|
||||
@@ -0,0 +1,29 @@
|
||||
--- ../src_base/minecraft_server/net/minecraft/src/BlockDoor.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft_server/net/minecraft/src/BlockDoor.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -105,7 +105,7 @@
|
||||
{
|
||||
if(blockMaterial == Material.iron)
|
||||
{
|
||||
- return true;
|
||||
+ return false;
|
||||
}
|
||||
int l = world.getBlockMetadata(i, j, k);
|
||||
if((l & 8) != 0)
|
||||
@@ -172,7 +172,7 @@
|
||||
world.setBlockWithNotify(i, j, k, 0);
|
||||
flag = true;
|
||||
}
|
||||
- if(!world.isBlockNormalCube(i, j - 1, k))
|
||||
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1))
|
||||
{
|
||||
world.setBlockWithNotify(i, j, k, 0);
|
||||
flag = true;
|
||||
@@ -235,7 +235,7 @@
|
||||
return false;
|
||||
} else
|
||||
{
|
||||
- return world.isBlockNormalCube(i, j - 1, k) && super.canPlaceBlockAt(world, i, j, k) && super.canPlaceBlockAt(world, i, j + 1, k);
|
||||
+ return world.isBlockSolidOnSide(i, j - 1, k,1) && super.canPlaceBlockAt(world, i, j, k) && super.canPlaceBlockAt(world, i, j + 1, k);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
--- ../src_base/minecraft_server/net/minecraft/src/BlockLadder.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft_server/net/minecraft/src/BlockLadder.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -40,6 +40,11 @@
|
||||
return super.getCollisionBoundingBoxFromPool(world, i, j, k);
|
||||
}
|
||||
|
||||
+ /* FORGE: Implemented base method, see Block.isLadder */
|
||||
+ public boolean isLadder() {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
@@ -57,37 +62,37 @@
|
||||
|
||||
public boolean canPlaceBlockAt(World world, int i, int j, int k)
|
||||
{
|
||||
- if(world.isBlockNormalCube(i - 1, j, k))
|
||||
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(world.isBlockNormalCube(i + 1, j, k))
|
||||
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(world.isBlockNormalCube(i, j, k - 1))
|
||||
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- return world.isBlockNormalCube(i, j, k + 1);
|
||||
+ return world.isBlockSolidOnSide(i, j, k + 1,2);
|
||||
}
|
||||
|
||||
public void onBlockPlaced(World world, int i, int j, int k, int l)
|
||||
{
|
||||
int i1 = world.getBlockMetadata(i, j, k);
|
||||
- if((i1 == 0 || l == 2) && world.isBlockNormalCube(i, j, k + 1))
|
||||
+ if((i1 == 0 || l == 2) && world.isBlockSolidOnSide(i, j, k + 1,2))
|
||||
{
|
||||
i1 = 2;
|
||||
}
|
||||
- if((i1 == 0 || l == 3) && world.isBlockNormalCube(i, j, k - 1))
|
||||
+ if((i1 == 0 || l == 3) && world.isBlockSolidOnSide(i, j, k - 1,3))
|
||||
{
|
||||
i1 = 3;
|
||||
}
|
||||
- if((i1 == 0 || l == 4) && world.isBlockNormalCube(i + 1, j, k))
|
||||
+ if((i1 == 0 || l == 4) && world.isBlockSolidOnSide(i + 1, j, k,4))
|
||||
{
|
||||
i1 = 4;
|
||||
}
|
||||
- if((i1 == 0 || l == 5) && world.isBlockNormalCube(i - 1, j, k))
|
||||
+ if((i1 == 0 || l == 5) && world.isBlockSolidOnSide(i - 1, j, k,5))
|
||||
{
|
||||
i1 = 5;
|
||||
}
|
||||
@@ -98,19 +103,19 @@
|
||||
{
|
||||
int i1 = world.getBlockMetadata(i, j, k);
|
||||
boolean flag = false;
|
||||
- if(i1 == 2 && world.isBlockNormalCube(i, j, k + 1))
|
||||
+ if(i1 == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(i1 == 3 && world.isBlockNormalCube(i, j, k - 1))
|
||||
+ if(i1 == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(i1 == 4 && world.isBlockNormalCube(i + 1, j, k))
|
||||
+ if(i1 == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(i1 == 5 && world.isBlockNormalCube(i - 1, j, k))
|
||||
+ if(i1 == 5 && world.isBlockSolidOnSide(i - 1, j, k,5))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
--- ../src_base/minecraft_server/net/minecraft/src/BlockLever.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft_server/net/minecraft/src/BlockLever.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -40,44 +40,44 @@
|
||||
|
||||
public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l)
|
||||
{
|
||||
- if(l == 1 && world.isBlockNormalCube(i, j - 1, k))
|
||||
+ if(l == 1 && world.isBlockSolidOnSide(i, j - 1, k,1))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(l == 2 && world.isBlockNormalCube(i, j, k + 1))
|
||||
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(l == 3 && world.isBlockNormalCube(i, j, k - 1))
|
||||
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(l == 4 && world.isBlockNormalCube(i + 1, j, k))
|
||||
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- return l == 5 && world.isBlockNormalCube(i - 1, j, k);
|
||||
+ return l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5);
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World world, int i, int j, int k)
|
||||
{
|
||||
- if(world.isBlockNormalCube(i - 1, j, k))
|
||||
+ if(world.isBlockSolidOnSide(i - 1, j, k,5))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(world.isBlockNormalCube(i + 1, j, k))
|
||||
+ if(world.isBlockSolidOnSide(i + 1, j, k,4))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(world.isBlockNormalCube(i, j, k - 1))
|
||||
+ if(world.isBlockSolidOnSide(i, j, k - 1,3))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- if(world.isBlockNormalCube(i, j, k + 1))
|
||||
+ if(world.isBlockSolidOnSide(i, j, k + 1,2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
- return world.isBlockNormalCube(i, j - 1, k);
|
||||
+ return world.isBlockSolidOnSide(i, j - 1, k,1);
|
||||
}
|
||||
|
||||
public void onBlockPlaced(World world, int i, int j, int k, int l)
|
||||
@@ -86,23 +86,23 @@
|
||||
int j1 = i1 & 8;
|
||||
i1 &= 7;
|
||||
i1 = -1;
|
||||
- if(l == 1 && world.isBlockNormalCube(i, j - 1, k))
|
||||
+ if(l == 1 && world.isBlockSolidOnSide(i, j - 1, k,1))
|
||||
{
|
||||
i1 = 5 + world.rand.nextInt(2);
|
||||
}
|
||||
- if(l == 2 && world.isBlockNormalCube(i, j, k + 1))
|
||||
+ if(l == 2 && world.isBlockSolidOnSide(i, j, k + 1,2))
|
||||
{
|
||||
i1 = 4;
|
||||
}
|
||||
- if(l == 3 && world.isBlockNormalCube(i, j, k - 1))
|
||||
+ if(l == 3 && world.isBlockSolidOnSide(i, j, k - 1,3))
|
||||
{
|
||||
i1 = 3;
|
||||
}
|
||||
- if(l == 4 && world.isBlockNormalCube(i + 1, j, k))
|
||||
+ if(l == 4 && world.isBlockSolidOnSide(i + 1, j, k,4))
|
||||
{
|
||||
i1 = 2;
|
||||
}
|
||||
- if(l == 5 && world.isBlockNormalCube(i - 1, j, k))
|
||||
+ if(l == 5 && world.isBlockSolidOnSide(i - 1, j, k,5))
|
||||
{
|
||||
i1 = 1;
|
||||
}
|
||||
@@ -124,27 +124,27 @@
|
||||
{
|
||||
int i1 = world.getBlockMetadata(i, j, k) & 7;
|
||||
boolean flag = false;
|
||||
- if(!world.isBlockNormalCube(i - 1, j, k) && i1 == 1)
|
||||
+ if(!world.isBlockSolidOnSide(i - 1, j, k,5) && i1 == 1)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(!world.isBlockNormalCube(i + 1, j, k) && i1 == 2)
|
||||
+ if(!world.isBlockSolidOnSide(i + 1, j, k,4) && i1 == 2)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(!world.isBlockNormalCube(i, j, k - 1) && i1 == 3)
|
||||
+ if(!world.isBlockSolidOnSide(i, j, k - 1,3) && i1 == 3)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(!world.isBlockNormalCube(i, j, k + 1) && i1 == 4)
|
||||
+ if(!world.isBlockSolidOnSide(i, j, k + 1,2) && i1 == 4)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(!world.isBlockNormalCube(i, j - 1, k) && i1 == 5)
|
||||
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1) && i1 == 5)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(!world.isBlockNormalCube(i, j - 1, k) && i1 == 6)
|
||||
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1) && i1 == 6)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
--- ../src_base/minecraft_server/net/minecraft/src/BlockPressurePlate.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft_server/net/minecraft/src/BlockPressurePlate.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -48,7 +48,8 @@
|
||||
|
||||
public boolean canPlaceBlockAt(World world, int i, int j, int k)
|
||||
{
|
||||
- return world.isBlockNormalCube(i, j - 1, k) || world.getBlockId(i, j - 1, k) == Block.fence.blockID;
|
||||
+ return world.isBlockSolidOnSide(i, j - 1, k,1) ||
|
||||
+ world.getBlockId(i, j - 1, k) == Block.fence.blockID;
|
||||
}
|
||||
|
||||
public void onBlockAdded(World world, int i, int j, int k)
|
||||
@@ -58,7 +59,8 @@
|
||||
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
|
||||
{
|
||||
boolean flag = false;
|
||||
- if(!world.isBlockNormalCube(i, j - 1, k) && world.getBlockId(i, j - 1, k) != Block.fence.blockID)
|
||||
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1)
|
||||
+ && world.getBlockId(i, j - 1, k) != Block.fence.blockID)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
--- ../src_base/minecraft_server/net/minecraft/src/BlockRail.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft_server/net/minecraft/src/BlockRail.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -18,12 +18,12 @@
|
||||
public static final boolean isRailBlockAt(World world, int i, int j, int k)
|
||||
{
|
||||
int l = world.getBlockId(i, j, k);
|
||||
- return l == Block.rail.blockID || l == Block.railPowered.blockID || l == Block.railDetector.blockID;
|
||||
+ return Block.blocksList[l] instanceof BlockRail;
|
||||
}
|
||||
|
||||
public static final boolean isRailBlock(int i)
|
||||
{
|
||||
- return i == Block.rail.blockID || i == Block.railPowered.blockID || i == Block.railDetector.blockID;
|
||||
+ return Block.blocksList[i] instanceof BlockRail;
|
||||
}
|
||||
|
||||
protected BlockRail(int i, int j, boolean flag)
|
||||
@@ -99,7 +99,7 @@
|
||||
|
||||
public boolean canPlaceBlockAt(World world, int i, int j, int k)
|
||||
{
|
||||
- return world.isBlockNormalCube(i, j - 1, k);
|
||||
+ return world.isBlockSolidOnSide(i, j - 1, k,1);
|
||||
}
|
||||
|
||||
public void onBlockAdded(World world, int i, int j, int k)
|
||||
@@ -123,23 +123,23 @@
|
||||
j1 &= 7;
|
||||
}
|
||||
boolean flag = false;
|
||||
- if(!world.isBlockNormalCube(i, j - 1, k))
|
||||
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(j1 == 2 && !world.isBlockNormalCube(i + 1, j, k))
|
||||
+ if(j1 == 2 && !world.isBlockSolidOnSide(i + 1, j, k,1))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(j1 == 3 && !world.isBlockNormalCube(i - 1, j, k))
|
||||
+ if(j1 == 3 && !world.isBlockSolidOnSide(i - 1, j, k,1))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(j1 == 4 && !world.isBlockNormalCube(i, j, k - 1))
|
||||
+ if(j1 == 4 && !world.isBlockSolidOnSide(i, j, k - 1,1))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(j1 == 5 && !world.isBlockNormalCube(i, j, k + 1))
|
||||
+ if(j1 == 5 && !world.isBlockSolidOnSide(i, j, k + 1,1))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
--- ../src_base/minecraft_server/net/minecraft/src/BlockRedstoneRepeater.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft_server/net/minecraft/src/BlockRedstoneRepeater.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
public boolean canPlaceBlockAt(World world, int i, int j, int k)
|
||||
{
|
||||
- if(!world.isBlockNormalCube(i, j - 1, k))
|
||||
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1))
|
||||
{
|
||||
return false;
|
||||
} else
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
public boolean canBlockStay(World world, int i, int j, int k)
|
||||
{
|
||||
- if(!world.isBlockNormalCube(i, j - 1, k))
|
||||
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1))
|
||||
{
|
||||
return false;
|
||||
} else
|
||||
@@ -0,0 +1,30 @@
|
||||
--- ../src_base/minecraft_server/net/minecraft/src/BlockRedstoneWire.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft_server/net/minecraft/src/BlockRedstoneWire.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -3,6 +3,7 @@
|
||||
// Decompiler options: packimports(3) braces deadcode fieldsfirst
|
||||
|
||||
package net.minecraft.src;
|
||||
+import net.minecraft.src.forge.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -51,7 +52,7 @@
|
||||
|
||||
public boolean canPlaceBlockAt(World world, int i, int j, int k)
|
||||
{
|
||||
- return world.isBlockNormalCube(i, j - 1, k);
|
||||
+ return world.isBlockSolidOnSide(i, j - 1, k, 1);
|
||||
}
|
||||
|
||||
private void updateAndPropagateCurrentStrength(World world, int i, int j, int k)
|
||||
@@ -421,6 +422,10 @@
|
||||
{
|
||||
return false;
|
||||
}
|
||||
+ if(Block.blocksList[i1] instanceof IConnectRedstone) {
|
||||
+ IConnectRedstone icr=(IConnectRedstone)Block.blocksList[i1];
|
||||
+ return icr.canConnectRedstone(iblockaccess,i,j,k,l);
|
||||
+ }
|
||||
if(Block.blocksList[i1].canProvidePower() && l != -1)
|
||||
{
|
||||
return true;
|
||||
Loaded 100 of 132 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user