made initial setup, implemented custom bucket, for #1

This commit is contained in:
Space Toad 2011-07-14 11:10:21 +00:00
parent b858205145
commit 859a0d1dee
9 changed files with 243 additions and 0 deletions

12
forge/forge_client/.classpath Executable file
View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="forge_common"/>
<classpathentry kind="src" path="minecraft"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="lib" path="../../jars/bin/jinput.jar"/>
<classpathentry kind="lib" path="../../jars/bin/lwjgl.jar"/>
<classpathentry kind="lib" path="../../jars/bin/lwjgl_util.jar"/>
<classpathentry kind="lib" path="../../jars/bin/minecraft.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

29
forge/forge_client/.project Executable file
View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>forge_client</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<linkedResources>
<link>
<name>forge_common</name>
<type>2</type>
<locationURI>PARENT-1-PROJECT_LOC/forge_common</locationURI>
</link>
<link>
<name>minecraft</name>
<type>2</type>
<locationURI>PARENT-1-WORKSPACE_LOC/src_work/minecraft</locationURI>
</link>
</linkedResources>
</projectDescription>

View file

@ -0,0 +1,10 @@
package net.minecraft.src.forge;
import net.minecraft.src.ItemStack;
import net.minecraft.src.World;
public interface IBucketHandler {
public ItemStack fillCustomBucket (World w, int i, int j, int k);
}

View file

@ -0,0 +1,28 @@
package net.minecraft.src.forge;
import java.util.LinkedList;
import net.minecraft.src.ItemStack;
import net.minecraft.src.World;
public class MinecraftForge {
private static LinkedList<IBucketHandler> bucketHandlers = new LinkedList<IBucketHandler>();
public static ItemStack fillCustomBucket (World w, int i, int j, int k) {
for (IBucketHandler handler : bucketHandlers) {
ItemStack stack = handler.fillCustomBucket(w, i, j, k);
if (stack != null) {
return stack;
}
}
return null;
}
public static void registerCustomBucketHander (IBucketHandler handler) {
bucketHandlers.add(handler);
}
}

12
forge/forge_server/.classpath Executable file
View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="forge_common"/>
<classpathentry kind="src" path="minecraft_server"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="lib" path="../../jars/bin/jinput.jar"/>
<classpathentry kind="lib" path="../../jars/bin/lwjgl.jar"/>
<classpathentry kind="lib" path="../../jars/bin/lwjgl_util.jar"/>
<classpathentry kind="lib" path="../../jars/minecraft_server.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

29
forge/forge_server/.project Executable file
View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>forge_server</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<linkedResources>
<link>
<name>forge_common</name>
<type>2</type>
<locationURI>PARENT-1-PROJECT_LOC/forge_common</locationURI>
</link>
<link>
<name>minecraft_server</name>
<type>2</type>
<locationURI>PARENT-1-WORKSPACE_LOC/src_work/minecraft_server</locationURI>
</link>
</linkedResources>
</projectDescription>

111
forge/minecraft.patch Normal file
View file

@ -0,0 +1,111 @@
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/ItemBucket.java ../src_work/minecraft/net/minecraft/src/ItemBucket.java
--- ../src_base/minecraft/net/minecraft/src/ItemBucket.java 2011-07-11 21:58:45.174682000 +0200
+++ ../src_work/minecraft/net/minecraft/src/ItemBucket.java 2011-07-14 13:03:34.748396700 +0200
@@ -6,6 +6,8 @@
import java.util.Random;
+import net.minecraft.src.forge.MinecraftForge;
+
// Referenced classes of package net.minecraft.src:
// Item, EntityPlayer, Vec3D, MathHelper,
// World, MovingObjectPosition, EnumMovingObjectType, Material,
@@ -55,6 +57,13 @@
}
if(isFull == 0)
{
+ 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);
diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/server/MinecraftServer.java ../src_work/minecraft_server/net/minecraft/server/MinecraftServer.java
--- ../src_base/minecraft_server/net/minecraft/server/MinecraftServer.java 2011-07-11 21:58:45.468698800 +0200
+++ ../src_work/minecraft_server/net/minecraft/server/MinecraftServer.java 2011-07-11 22:00:55.619143000 +0200
@@ -333,41 +333,22 @@
}
finally
{
- System.exit(0);
+ try
+ {
+ stopServer();
+ serverStopped = true;
+ }
+ catch(Throwable throwable2)
+ {
+ throwable2.printStackTrace();
+ }
+ finally
+ {
+ System.exit(0);
+ }
}
- break MISSING_BLOCK_LABEL_350;
- }
- try
- {
- stopServer();
- serverStopped = true;
- }
- catch(Throwable throwable)
- {
- throwable.printStackTrace();
- }
- finally
- {
- System.exit(0);
- }
- break MISSING_BLOCK_LABEL_350;
- Exception exception2;
- exception2;
- try
- {
- stopServer();
- serverStopped = true;
- }
- catch(Throwable throwable3)
- {
- throwable3.printStackTrace();
- }
- finally
- {
- System.exit(0);
- }
- throw exception2;
}
+}
private void doTick()
{
diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/ItemBucket.java ../src_work/minecraft_server/net/minecraft/src/ItemBucket.java
--- ../src_base/minecraft_server/net/minecraft/src/ItemBucket.java 2011-07-11 21:58:45.765715800 +0200
+++ ../src_work/minecraft_server/net/minecraft/src/ItemBucket.java 2011-07-14 13:03:49.701251900 +0200
@@ -6,6 +6,8 @@
import java.util.Random;
+import net.minecraft.src.forge.MinecraftForge;
+
// Referenced classes of package net.minecraft.src:
// Item, EntityPlayer, Vec3D, MathHelper,
// World, MovingObjectPosition, EnumMovingObjectType, Material,
@@ -55,6 +57,13 @@
}
if(isFull == 0)
{
+ 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);

7
forge/setup.sh Executable file
View file

@ -0,0 +1,7 @@
if [ ! -f ../src_base ]; then
cp -r ../src ../src_base
#patch -p0 < minecraft.patch
cp -r ../src ../src_work
else
echo "patch already applied - remove src and src_base and decompile again"
fi

5
forge/update_patch.sh Executable file
View file

@ -0,0 +1,5 @@
rm minecraft.patch
touch minecraft.patch
diff -u ../src_base ../src_work -r --strip-trailing-cr | tr -d '\r' \
>> minecraft.patch