old-bugs

Minecraft: Better than Adventure! mod that brings back bugs from older versions
git clone git://memoryshards.xyz/old-bugs.git
Log | Files | Refs | README | LICENSE

commit dcd58397b0d29bd5971cc1dfc18616c334589425
parent 1a22724c734d481dca8122089841658ea656b894
Author: BuildTools <unconfigured@null.spigotmc.org>
Date:   Sun,  5 Feb 2023 21:19:08 +0300

Add alpha fire spreading

Diffstat:
MREADME.md | 1+
Mgradle.properties | 2+-
Msrc/main/java/eosl/minecart_boosters_fix/LadderGaps.java | 15+++++++--------
Asrc/main/java/eosl/minecart_boosters_fix/OldFireSpread.java | 41+++++++++++++++++++++++++++++++++++++++++
Msrc/main/resources/nostalgic_bugs.mixins.json | 1+
5 files changed, 51 insertions(+), 9 deletions(-)

diff --git a/README.md b/README.md @@ -7,5 +7,6 @@ Brings back some old nostalgic bugs from older Minecraft versions: 2. Boat water lifts; 3. Ladder gaps: player can climb ladders with gaps in them; 4. [Water ladders](https://minecraft.fandom.com/wiki/Tutorials/Water_ladder): entities can get into water/lava through corners (or signs) on west and north sides of them (also known as south-east rule). +5. Fast and infinite fire spreading from alpha Minecraft (Thanks to [Amb0s](https://github.com/Amb0s) for the solution). Thanks to [OldDays mod](https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/minecraft-mods/1275907-olddays-nbxlite-spawnhuman-ssp-sspc) ([on GitHub](https://github.com/Exalm/Minecraft-mods)) for hints. \ No newline at end of file diff --git a/gradle.properties b/gradle.properties @@ -14,6 +14,6 @@ loader_version=0.14.6-babric.1 halplibe_version=1.1.3 # Mod -mod_version=1.0 +mod_version=1.1 mod_group=eosl mod_name=nostalgic_bugs diff --git a/src/main/java/eosl/minecart_boosters_fix/LadderGaps.java b/src/main/java/eosl/minecart_boosters_fix/LadderGaps.java @@ -3,19 +3,18 @@ package eosl.minecart_boosters_fix; import net.minecraft.src.Block; import net.minecraft.src.EntityLiving; import net.minecraft.src.MathHelper; +import org.jetbrains.annotations.NotNull; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(value = EntityLiving.class, remap = false) public class LadderGaps { - /** - * @author Eosl - * @reason For beta 1.2 ladder gaps bug. - */ - @Overwrite(remap = false) - public boolean isOnLadder() + @Inject(method = "isOnLadder", at = @At("HEAD"), cancellable = true) + public void increaseLadderCoverage(@NotNull CallbackInfoReturnable<Boolean> cir) { EntityLiving self = ((EntityLiving) ((Object) this)); int i = MathHelper.floor_double(self.posX); @@ -25,6 +24,6 @@ public class LadderGaps int id1 = self.worldObj.getBlockId(i, j, k); int id2 = self.worldObj.getBlockId(i, j + 1, k); - return id1 == Block.ladderOak.blockID || id2 == Block.ladderOak.blockID; + cir.setReturnValue(id1 == Block.ladderOak.blockID || id2 == Block.ladderOak.blockID); } } diff --git a/src/main/java/eosl/minecart_boosters_fix/OldFireSpread.java b/src/main/java/eosl/minecart_boosters_fix/OldFireSpread.java @@ -0,0 +1,41 @@ +package eosl.minecart_boosters_fix; + +import net.minecraft.src.Block; +import net.minecraft.src.BlockFire; +import net.minecraft.src.World; +import org.jetbrains.annotations.NotNull; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.*; + + +/* + * Thanks to Amb0s for the code: https://github.com/Amb0s + */ +@Mixin(value = BlockFire.class, remap = false) +public class OldFireSpread +{ + @ModifyConstant(method = "tickRate", constant = @Constant(intValue = 40)) + private int changeTickRate(int a) + { + // It is 10 in beta before 1.6: + return 10; + } + + + @Redirect(method = "tryToCatchBlockOnFire", at = @At(value = "INVOKE", + target = "Lnet/minecraft/src/World;setBlockAndMetadataWithNotify(IIIII)Z")) + private boolean infiniteSpreading(@NotNull World world, int x, int y, int z, int id, int meta) + { + // Make new fire blocks spawn with zero old: + world.setBlockAndMetadataWithNotify(x, y, z, Block.fire.blockID, 0); + return false; + } + + + @Redirect(method = "tryToCatchBlockOnFire", at = @At(value = "INVOKE", + target = "Lnet/minecraft/src/BlockFire;setBurnResult(Lnet/minecraft/src/World;III)V")) + private void cancelSetBurnResult(BlockFire instance, World world, int x, int y, int z) + { + // Remove a chance to burn a block before the fire block old will reach 15. + } +} diff --git a/src/main/resources/nostalgic_bugs.mixins.json b/src/main/resources/nostalgic_bugs.mixins.json @@ -7,6 +7,7 @@ "BoatWaterLift", "LadderGaps", "MinecartBooster", + "OldFireSpread", "SouthEastRuleForLiquids" ], "client": [],