Skip to content

Commit

Permalink
Fix patching for BTW v4.ABBBBURNBABYBURNAHAHAHAHAHA
Browse files Browse the repository at this point in the history
  • Loading branch information
grompe committed Jun 5, 2018
1 parent 2e68f51 commit fd25b49
Show file tree
Hide file tree
Showing 11 changed files with 97 additions and 41 deletions.
9 changes: 7 additions & 2 deletions diffs/Item.diff
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/src/minecraft/net/minecraft/src/Item.java b/src/minecraft/net/minecraft/src/Item.java
index 337c513..9bc1325 100644
index 337c513..48fbe75 100644
--- a/src/minecraft/net/minecraft/src/Item.java
+++ b/src/minecraft/net/minecraft/src/Item.java
@@ -776,0 +777,20 @@ public Item SetDefaultFurnaceBurnTime(int var1)
@@ -776,0 +777,25 @@ public Item SetDefaultFurnaceBurnTime(int var1)
+ public boolean IsPistonPackable(ItemStack stack)
+ {
+ return false;
Expand All @@ -23,3 +23,8 @@ index 337c513..9bc1325 100644
+ return 0;
+ }
+
+ public boolean CanItemBeUsedByPlayer(World world, int x, int y, int z, int side, EntityPlayer player, ItemStack stack)
+ {
+ return true;
+ }
+
10 changes: 10 additions & 0 deletions diffs/ItemBlock.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
diff --git a/src/minecraft/net/minecraft/src/ItemBlock.java b/src/minecraft/net/minecraft/src/ItemBlock.java
index 8f64000..0254e30 100644
--- a/src/minecraft/net/minecraft/src/ItemBlock.java
+++ b/src/minecraft/net/minecraft/src/ItemBlock.java
@@ -212,0 +213,5 @@ public void registerIcons(IconRegister par1IconRegister)
+
+ public boolean CanItemBeUsedByPlayer(World world, int x, int y, int z, int side, EntityPlayer player, ItemStack stack)
+ {
+ return canPlaceItemBlockOnSide(world, x, y, z, side, player, stack);
+ }
7 changes: 7 additions & 0 deletions diffs/ThreadDownloadImageData.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
diff --git a/src/minecraft/net/minecraft/src/ThreadDownloadImageData.java b/src/minecraft/net/minecraft/src/ThreadDownloadImageData.java
index 40d8470..a9f32b5 100644
--- a/src/minecraft/net/minecraft/src/ThreadDownloadImageData.java
+++ b/src/minecraft/net/minecraft/src/ThreadDownloadImageData.java
@@ -26 +26 @@ public ThreadDownloadImageData(String par1, IImageBuffer par2IImageBuffer)
- (new ThreadDownloadImage(this, par1, par2IImageBuffer)).start();
+ (new GPEThreadDownloadImage(this, par1, par2IImageBuffer)).start();
Binary file modified patcher/GPEBTWTweak_files.zip
Binary file not shown.
6 changes: 5 additions & 1 deletion patcher/readme.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
Grom PE's Better Than Wolves Total Conversion tweak mod v1.1
Grom PE's Better Than Wolves Total Conversion tweak mod v1.1a
(Compatible with Better Than Wolves V4.8911+)

[********** Change Log ************]

v1.1a

- Fixed compatibility with BTW version "4.ABBBBURNBABYBURNAHAHAHAHAHA".

v1.1

- Fixed compatibility with BTW version "4.AACK".
Expand Down
2 changes: 1 addition & 1 deletion patcher/scripts/tweaks_bed.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ function(mn)
INSERT_BEFORE
).process(mn);
});
tweak("sq", "EntityPlayer", BOTH, "l_()V", [0xB4066F18, 0x99096FE7, 0x723C726B, 0xD6667B48, 0xD7AA7A79], "Player won't mind napping at day",
tweak("sq", "EntityPlayer", BOTH, "l_()V", [0xB4066F18, 0x99096FE7, 0x723C726B, 0xD6667B48, 0xD7AA7A79, 0xE5047B58], "Player won't mind napping at day",
function(mn)
{
for (var i = 0; i < mn.instructions.size(); i++)
Expand Down
8 changes: 4 additions & 4 deletions patcher/scripts/tweaks_gamelogic.js
Original file line number Diff line number Diff line change
Expand Up @@ -750,9 +750,9 @@ function(cn)
});
takeMicroblockOwnership("FCItemBlockMoulding", 0x411E0779);
takeMicroblockOwnership("FCItemBlockSidingAndCorner", 0x411E0779);
takeMicroblockOwnership("FCItemBlockWoodCornerStub", 0x2C60197);
takeMicroblockOwnership("FCItemBlockWoodMouldingStub", 0x2C60197);
takeMicroblockOwnership("FCItemBlockWoodSidingStub", 0x2C60197);
takeMicroblockOwnership("FCItemBlockWoodCornerStub", [0x2C60197, 0x9BB02C1]);
takeMicroblockOwnership("FCItemBlockWoodMouldingStub", [0x2C60197, 0x9BB02C1]);
takeMicroblockOwnership("FCItemBlockWoodSidingStub", [0x2C60197, 0x9BB02C1]);
add("Addon_Glass$BlockStainedGlass", null, BOTH, "Making Deco stained glass inherit from GPEBlockGlass",
function(cn)
{
Expand Down Expand Up @@ -955,7 +955,7 @@ function(mn)
}
}
});
tweak("ng", "EntityLiving", BOTH, "bE()F", [0x2F3E47DF, 0xB84C4738], "Restoring the effect of swiftness potions",
tweak("ng", "EntityLiving", BOTH, "bE()F", [0x2F3E47DF, 0xB84C4738, 0x56554569], "Restoring the effect of swiftness potions",
function(mn)
{
var label = LabelNode();
Expand Down
6 changes: 3 additions & 3 deletions patcher/scripts/tweaks_hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,20 +271,20 @@ if (isBTWVersionOrNewer("4.89666"))
return true;
});
}
tweak("bdr", "PlayerControllerMP", CLIENT, "a(Lsq;Laab;Lwm;IIIILarc;)Z", [0x5A6E2C5E, 0x48DE3024], "Hooking block placing decision",
tweak("bdr", "PlayerControllerMP", CLIENT, "a(Lsq;Laab;Lwm;IIIILarc;)Z", [0x5A6E2C5E, 0x48DE3024, 0xCA582922], "Hooking block placing decision",
function(mn)
{
for (var i = 0; i < mn.instructions.size(); i++)
{
var n = mn.instructions.get(i);
if (isInstance(n, "org.objectweb.asm.tree.MethodInsnNode") && n.owner.equals("xn") && n.name.equals("a") && n.desc.equals("(Laab;IIIILsq;Lwm;)Z"))
if (isInstance(n, "org.objectweb.asm.tree.MethodInsnNode") && /*n.owner.equals("xn") && n.name.equals("a") &&*/ n.desc.equals("(Laab;IIIILsq;Lwm;)Z"))
{
mn.instructions.insert(n, toInsnList(
[
VarInsnNode(FLOAD, 9),
VarInsnNode(FLOAD, 10),
VarInsnNode(FLOAD, 11),
MethodInsnNode(INVOKESTATIC, "GPEBTWTweak", "canPlaceItemBlock", "(Lxn;Laab;IIIILsq;Lwm;FFF)Z"),
MethodInsnNode(INVOKESTATIC, "GPEBTWTweak", "canPlaceItemBlock", "(Lwk;Laab;IIIILsq;Lwm;FFF)Z"),
]
));
mn.instructions.remove(n);
Expand Down
26 changes: 26 additions & 0 deletions patcher/scripts/tweaks_vercompat.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,29 @@ if (isBTWVersionOrNewer("4.AABABABA"))
// tweaking overrides adapting, so have to call it manually
add("GPEBlockChest", null, SERVER, "Removing client-only methods", removeClientOnlyMethods);
}
if (isBTWVersionOrNewer("4.ABBBBURNBABYBURNAHAHAHAHAHA"))
{
function changeOwner(mn)
{
for (var i = 0; i < mn.instructions.size(); i++)
{
var n = mn.instructions.get(i);
if (isInstance(n, "org.objectweb.asm.tree.MethodInsnNode") && n.owner.equals("FCItemBlockCustom"))
{
n.owner = "xn";
return true;
}
}
}
tweak("GPEItemBlockMicro", null, BOTH, "<init>(I)V", CHECKSUM_IGNORE, "(1/2) Changing inheritance from removed class",
changeOwner);
tweak("GPEItemBlockMicro", null, BOTH, "a(Lwm;Lsq;Laab;IIIIFFF)Z", CHECKSUM_IGNORE, "(1/3) Changing inheritance from removed class",
changeOwner);
add("GPEItemBlockMicro", null, BOTH, "(3/3) Changing inheritance from removed class",
function(cn)
{
cn.superName = "xn";
});
// tweaking overrides adapting, so have to call it manually
add("GPEItemBlockMicro", null, SERVER, "Removing client-only methods", removeClientOnlyMethods);
}
62 changes: 33 additions & 29 deletions tweaksrc/GPEBTWTweak.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class GPEBTWTweak extends FCAddOn
{
public static GPEBTWTweak instance;
private static GPEBTWTweakProxy proxy;
public static final String tweakVersion = "1.1";
public static final String tweakVersion = "1.1a";

private static boolean postPostInitialized = false;
public static boolean isDecoPresent;
Expand Down Expand Up @@ -1681,37 +1681,41 @@ private static void extendBlockIDs()
FCTileEntityBeacon.InitializeEffectsByBlockID();
}

public static boolean canPlaceItemBlock(ItemBlock ib, World world, int x, int y, int z, int side, EntityPlayer player, ItemStack stack, float hitX, float hitY, float hitZ)
public static boolean canPlaceItemBlock(Item item, World world, int x, int y, int z, int side, EntityPlayer player, ItemStack stack, float hitX, float hitY, float hitZ)
{
if (ib instanceof GPEItemBlockMicro)
if (item instanceof ItemBlock)
{
GPEItemBlockMicro mi = (GPEItemBlockMicro)ib;
if (mi.attemptToCombineWithBlock(stack, world, x, y, z, side, hitX, hitY, hitZ, false, true))
return true;
ItemBlock ib = (ItemBlock)item;
if (ib instanceof GPEItemBlockMicro)
{
GPEItemBlockMicro mi = (GPEItemBlockMicro)ib;
if (mi.attemptToCombineWithBlock(stack, world, x, y, z, side, hitX, hitY, hitZ, false, true))
return true;
}
int id = ib.getBlockID();
int meta = ib.getMetadata(stack.getItemDamage());
Block block = Block.blocksList[id];
if (block instanceof GPEBlockLadder || block instanceof FCIBlock)
{
switch (side)
{
case 0: --y; break;
case 1: ++y; break;
case 2: --z; break;
case 3: ++z; break;
case 4: --x; break;
case 5: ++x; break;
}
int newMeta = block.onBlockPlaced(world, x, y, z, side, hitX, hitY, hitZ, meta);
GPEWorldProxy4BB wp = new GPEWorldProxy4BB(world, x, y, z, id, newMeta);
block.setBlockBoundsBasedOnState(wp, x, y, z);
AxisAlignedBB bb = AxisAlignedBB.getAABBPool().getAABB(
(double)x + block.minX, (double)y + block.minY, (double)z + block.minZ,
(double)x + block.maxX, (double)y + block.maxY, (double)z + block.maxZ);
return world.checkNoEntityCollision(bb);
}
}
int id = ib.getBlockID();
int meta = ib.getMetadata(stack.getItemDamage());
Block block = Block.blocksList[id];
if (!(block instanceof GPEBlockLadder || block instanceof FCIBlock))
{
return ib.canPlaceItemBlockOnSide(world, x, y, z, side, player, stack);
}
switch (side)
{
case 0: --y; break;
case 1: ++y; break;
case 2: --z; break;
case 3: ++z; break;
case 4: --x; break;
case 5: ++x; break;
}
int newMeta = block.onBlockPlaced(world, x, y, z, side, hitX, hitY, hitZ, meta);
GPEWorldProxy4BB wp = new GPEWorldProxy4BB(world, x, y, z, id, newMeta);
block.setBlockBoundsBasedOnState(wp, x, y, z);
AxisAlignedBB bb = AxisAlignedBB.getAABBPool().getAABB(
(double)x + block.minX, (double)y + block.minY, (double)z + block.minZ,
(double)x + block.maxX, (double)y + block.maxY, (double)z + block.maxZ);
return world.checkNoEntityCollision(bb);
return item.CanItemBeUsedByPlayer(world, x, y, z, side, player, stack);
}

public static int getMinimumDifficulty()
Expand Down
2 changes: 1 addition & 1 deletion tweaksrc/GPEItemBlockMicro.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package net.minecraft.src;

public abstract class GPEItemBlockMicro extends FCItemBlockCustom
public abstract class GPEItemBlockMicro extends FCItemBlockCustom // NOTE: change to ItemBlock if it fails to compile in newer BTW version.
{
public GPEItemBlockMicro(int id)
{
Expand Down

0 comments on commit fd25b49

Please sign in to comment.