Skip to content

Commit 9eb8b01

Browse files
authored
Fix NetherAPI (#22)
* Fix NetherAPI Mohist is really dumb, I helped them fix this and got nothing * Fix CB check conditions
1 parent 4874dfa commit 9eb8b01

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

patches/minecraft/net/minecraft/block/BlockStaticLiquid.java.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
if (this.func_176369_e(p_180650_1_, blockpos))
4444
{
4545
- p_180650_1_.func_175656_a(blockpos, Blocks.field_150480_ab.func_176223_P());
46-
+ if (p_180650_1_.func_180495_p(blockpos) != Blocks.field_150480_ab) {
46+
+ if (p_180650_1_.func_180495_p(blockpos).func_177230_c() != Blocks.field_150480_ab) { // CatRoom - Fix condition
4747
+ if (CraftEventFactory.callBlockIgniteEvent(p_180650_1_, blockpos.func_177958_n(), blockpos.func_177956_o(), blockpos.func_177952_p(), p_180650_2_.func_177958_n(), p_180650_2_.func_177956_o(), p_180650_2_.func_177952_p()).isCancelled()) {
4848
+ continue;
4949
+ }

patches/minecraft/net/minecraft/entity/ai/EntityAIMate.java.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
entityplayermp = this.field_75391_e.func_191993_do();
8383
}
8484

85-
+ int experience = this.field_75390_d.func_70681_au().nextInt(7) + 1;
85+
+ int experience = this.field_75390_d.func_70681_au().nextInt(catserver.server.utils.ModFixUtils.fixNetherAPI()) + 1; // CatRoom - Fix NetherAPI
8686
+ org.bukkit.event.entity.EntityBreedEvent entityBreedEvent = org.bukkit.craftbukkit.v1_12_R1.event.CraftEventFactory.callEntityBreedEvent(entityageable, field_75390_d, field_75391_e, entityplayermp, this.field_75390_d.breedItem, experience);
8787
+ if (entityBreedEvent.isCancelled()) {
8888
+ return;

src/main/java/catserver/server/utils/ModFixUtils.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,19 @@
1212
public class ModFixUtils {
1313
public static void doBlockCollisions() { }
1414

15+
/**
16+
* Logic: NetherAPI transformer locates constant 7 in EntityAIMate#spawnBaby,
17+
* and replace it with its own Hooks.spawnParticles call, which always returns 0.
18+
* CraftBukkit inserted another constant 7 in Random instance for calculating experience drops,
19+
* NetherAPI accidentally replaced it, leading to IllegalArgumentException.
20+
*
21+
* @see <a href="https://github.com/jbredwards/Nether-API/blob/1.12.2/src/main/java/git/jbredwards/nether_api/mod/asm/transformers/vanilla/Transformer_MC_10369.java#L230-L264">NetherAPI</a>
22+
* @see net.minecraft.entity.ai.EntityAIMate#spawnBaby
23+
*/
24+
public static int fixNetherAPI() {
25+
return 7;
26+
}
27+
1528
public static void fixNetherex() {
1629
if (Loader.instance().getIndexedModList().containsKey("netherex")) {
1730
World netherWorld = DimensionManager.getWorld(-1);

0 commit comments

Comments
 (0)