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 f7f6bd20521b67a43e1b06a0f86cc76a345b705c
parent fef1bfd7a5d03a1c1df38eb2a157a19d10f9b759
Author: Amb0s <ambos@disroot.org>
Date:   Mon,  7 Aug 2023 01:43:20 +0200

Changed mod, package name and updated to BTA 1.7.7.0

Diffstat:
M.gitignore | 35++++++++++++++++++++++++++++++++---
MREADME.md | 21+++++++++------------
Mbuild.gradle | 37++++++++++++++++++++++++++++++++-----
Mgradle.properties | 17+++++------------
Dsrc/main/java/eosl/nostalgic_bugs/NostalgicBugsMod.java | 45---------------------------------------------
Dsrc/main/java/eosl/nostalgic_bugs/Settings.java | 179-------------------------------------------------------------------------------
Dsrc/main/java/eosl/nostalgic_bugs/features/BoatWaterLift.java | 21---------------------
Dsrc/main/java/eosl/nostalgic_bugs/features/LadderGaps.java | 34----------------------------------
Dsrc/main/java/eosl/nostalgic_bugs/features/MinecartBooster.java | 25-------------------------
Dsrc/main/java/eosl/nostalgic_bugs/features/OldFireSpread.java | 43-------------------------------------------
Dsrc/main/java/eosl/nostalgic_bugs/features/SouthEastRuleForLiquids.java | 44--------------------------------------------
Asrc/main/java/turniplabs/oldbugs/OldBugs.java | 15+++++++++++++++
Asrc/main/java/turniplabs/oldbugs/mixin/BlockFireMixin.java | 30++++++++++++++++++++++++++++++
Asrc/main/java/turniplabs/oldbugs/mixin/EntityBoatMixin.java | 14++++++++++++++
Asrc/main/java/turniplabs/oldbugs/mixin/EntityLivingMixin.java | 25+++++++++++++++++++++++++
Asrc/main/java/turniplabs/oldbugs/mixin/EntityMinecartMixin.java | 14++++++++++++++
Asrc/main/java/turniplabs/oldbugs/mixin/EntityMixin.java | 22++++++++++++++++++++++
Msrc/main/resources/fabric.mod.json | 21++++++++++++---------
Dsrc/main/resources/nostalgic_bugs.mixins.json | 17-----------------
Asrc/main/resources/oldbugs.mixins.json | 17+++++++++++++++++
20 files changed, 227 insertions(+), 449 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -1,5 +1,34 @@ +# gradle + .gradle/ -.idea/ build/ out/ -run/ -\ No newline at end of file +classes/ + +# eclipse + +*.launch + +# idea + +.idea/ +*.iml +*.ipr +*.iws + +# vscode + +.settings/ +.vscode/ +bin/ +.classpath +.project + +# macos + +*.DS_Store + +# fabric + +run/ +libs/*.jar +\ No newline at end of file diff --git a/README.md b/README.md @@ -1,14 +1,12 @@ -# Minecraft BTA Old Nostalgic bugs mod +# Old Bugs -A Babric mod for [Better Than Adventure mod](https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/minecraft-mods/3106066-better-than-adventure-for-beta-1-7-3-timely) 1.7.6.2_02. +## Additions +* Minecart boosters +* Boat water lifts +* Ladder gaps +* Water ladders +* Fast and infinite fire spreading -Brings back some old nostalgic bugs from older Minecraft versions: -1. [Minecart boosters](https://minecraft.fandom.com/wiki/Tutorials/Minecart_booster); -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 +[eosl](https://github.com/EOfSL), for his [mod](https://github.com/EOfSL/bta-old-nostalgic-bugs). -Use file "nostalgic_bugs.cfg" in a root of server/client to configure the mod. It will be generated on first run. - -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/build.gradle b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'babric-loom' version '0.12-SNAPSHOT' + id 'babric-loom' version '1.1.+' id 'java' } @@ -40,6 +40,14 @@ repositories { metadataSources { artifact() } } ivy { + url = "https://github.com/Turnip-Labs" + patternLayout { + artifact "[organisation]/releases/download/[revision]/[module]-bta-[revision].jar" + m2compatible = true + } + metadataSources { artifact() } + } + ivy { url = "https://piston-data.mojang.com" patternLayout { artifact "v1/[organisation]/[revision]/[module].jar" @@ -47,6 +55,14 @@ repositories { } metadataSources { artifact() } } + ivy { + url = "https://github.com/MartinSVK12" + patternLayout { + artifact "[organisation]/releases/download/[revision]/[module]-[revision].jar" + m2compatible = true + } + metadataSources { artifact() } + } } dependencies { @@ -54,10 +70,21 @@ dependencies { mappings loom.layered() {} modRuntimeOnly "objects:client:43db9b498cb67058d2e12d394e6507722e71bb45" // https://piston-data.mojang.com/v1/objects/43db9b498cb67058d2e12d394e6507722e71bb45/client.jar - modImplementation "babric:fabric-loader:${project.loader_version}" + modImplementation "fabric-loader:fabric-loader:${project.loader_version}" + + modImplementation "ModMenu:ModMenu:2.0.0" + + implementation "org.slf4j:slf4j-api:1.8.0-beta4" + implementation "org.apache.logging.log4j:log4j-slf4j18-impl:2.16.0" + + implementation 'com.google.guava:guava:30.0-jre' + implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.9' - modImplementation "org.slf4j:slf4j-api:1.8.0-beta4" - modImplementation "org.apache.logging.log4j:log4j-slf4j18-impl:2.16.0" + var log4jVersion = "2.20.0" + implementation("org.apache.logging.log4j:log4j-core:${log4jVersion}") + implementation("org.apache.logging.log4j:log4j-api:${log4jVersion}") + implementation("org.apache.logging.log4j:log4j-1.2-api:${log4jVersion}") + implementation("log4j:apache-log4j-extras:1.2.17") } java { @@ -66,7 +93,7 @@ java { withSourcesJar() } -tasks.withType(JavaCompile).configureEach { +tasks.withType(JavaCompile) { options.release.set 8 } diff --git a/gradle.properties b/gradle.properties @@ -1,19 +1,12 @@ org.gradle.jvmargs=-Xmx2G # BTA -bta_version=1.7.6.2_02 - -# Loader Dependencies -asm_version=9.3 -mixin_version=0.11.4+mixin.0.8.5 +bta_version=1.7.7.0 # Loader -loader_version=0.14.6-babric.1 - -# HalpLibe -halplibe_version=1.1.3 +loader_version=0.14.19-babric.1-bta # Mod -mod_version=1.3 -mod_group=eosl -mod_name=nostalgic_bugs +mod_version=2.0 +mod_group=turniplabs +mod_name=old-bugs diff --git a/src/main/java/eosl/nostalgic_bugs/NostalgicBugsMod.java b/src/main/java/eosl/nostalgic_bugs/NostalgicBugsMod.java @@ -1,45 +0,0 @@ -package eosl.nostalgic_bugs; - -import net.fabricmc.api.ModInitializer; -import org.jetbrains.annotations.NotNull; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.*; - - -public class NostalgicBugsMod implements ModInitializer -{ - public static final Logger g_logger = LoggerFactory.getLogger("nostalgic_bugs"); - private static final String g_settingsFileName = "./nostalgic_bugs.cfg"; - public static @NotNull Settings g_settings = new Settings(); - - - @Override - public void onInitialize() - { - reset(); - } - - - public static void reset() - { - File file = new File(g_settingsFileName); - - try { - if (file.createNewFile()) { - g_logger.info("Create default settings file [" + g_settingsFileName + "]"); - g_settings = new Settings(); - g_settings.write(new FileWriter(file)); - } - else { - g_logger.info("Using setting file [" + g_settingsFileName + "]"); - g_settings = new Settings(new FileReader(file)); - } - } catch (IOException e) { - g_settings = new Settings(); - g_logger.error("Can not read settings file [" + g_settingsFileName + "]. The default one is using now"); - } - } - -} diff --git a/src/main/java/eosl/nostalgic_bugs/Settings.java b/src/main/java/eosl/nostalgic_bugs/Settings.java @@ -1,179 +0,0 @@ -package eosl.nostalgic_bugs; - -import net.minecraft.src.NBTTagCompound; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Range; - -import java.io.*; -import java.util.Properties; - - -// Can't use GameSettings and Option classes, so I need to write own little code: -public class Settings -{ - public final boolean m_boatWaterLift; - public final boolean m_ladderGaps; - public final boolean m_minecartBoosters; - public final boolean m_southEastRuleForLiquids; - @Range(from = 1, to = Integer.MAX_VALUE) - public final int m_fireTickRate; - public final boolean m_infiniteFireSpread; - - - /** - * Get default settings. - */ - public Settings() - { - m_boatWaterLift = true; - m_ladderGaps = true; - m_minecartBoosters = true; - m_southEastRuleForLiquids = true; - m_fireTickRate = 10; - m_infiniteFireSpread = true; - } - - - /** - * Get settings from a Reader. - * @param a_settings Reader. - */ - public Settings(@NotNull Reader a_settings) throws IOException - { - Properties properties = new Properties(); - properties.load(a_settings); - - m_boatWaterLift = getProperty(properties, "boatWaterLift", true); - m_ladderGaps = getProperty(properties, "ladderGaps", true); - m_minecartBoosters = getProperty(properties, "minecartBoosters", true); - m_southEastRuleForLiquids = getProperty(properties, "southEastRuleForLiquids", true); - int fireTickRate = getProperty(properties, "fireTickRate", 10); - m_infiniteFireSpread = getProperty(properties, "infiniteFireSpread", true); - - if (fireTickRate < 1) { - NostalgicBugsMod.g_logger.error("Option [" + "fireTickRate" + "] must be greater than 0. It set now ot 10"); - m_fireTickRate = 10; - } - else - m_fireTickRate = fireTickRate; - } - - - /** - * Get settings from an NBT. - * @param a_settings An NBT. - */ - @SuppressWarnings("unused") // for the future - public Settings(@NotNull NBTTagCompound a_settings) - { - m_boatWaterLift = getProperty(a_settings, "boatWaterLift", true); - m_ladderGaps = getProperty(a_settings, "ladderGaps", true); - m_minecartBoosters = getProperty(a_settings, "minecartBoosters", true); - m_southEastRuleForLiquids = getProperty(a_settings, "southEastRuleForLiquids", true); - int fireTickRate = getProperty(a_settings, "fireTickRate", 10); - m_infiniteFireSpread = getProperty(a_settings, "infiniteFireSpread", true); - - if (fireTickRate < 1) { - NostalgicBugsMod.g_logger.error("Option [" + "fireTickRate" + "] must be greater than 0. It set now ot 10"); - m_fireTickRate = 10; - } - else - m_fireTickRate = fireTickRate; - } - - - public void write(@NotNull Writer a_settings) throws IOException - { - Properties properties = new Properties(); - - properties.setProperty("boatWaterLift", String.valueOf(m_boatWaterLift)); - properties.setProperty("ladderGaps", String.valueOf(m_ladderGaps)); - properties.setProperty("minecartBoosters", String.valueOf(m_minecartBoosters)); - properties.setProperty("southEastRuleForLiquids", String.valueOf(m_southEastRuleForLiquids)); - properties.setProperty("fireTickRate", String.valueOf(m_fireTickRate)); - properties.setProperty("infiniteFireSpread", String.valueOf(m_infiniteFireSpread)); - - properties.store(a_settings, null); - } - - - /** - * Write the settings into an NBT. - * @param a_settings An NBT. - */ - @SuppressWarnings("unused") // for the future - public void writeToNBT(@NotNull NBTTagCompound a_settings) - { - a_settings.setBoolean("boatWaterLift", m_boatWaterLift); - a_settings.setBoolean("ladderGaps", m_ladderGaps); - a_settings.setBoolean("minecartBoosters", m_minecartBoosters); - a_settings.setBoolean("southEastRuleForLiquids", m_southEastRuleForLiquids); - a_settings.setInteger("fireTickRate", m_fireTickRate); - a_settings.setBoolean("infiniteFireSpread", m_infiniteFireSpread); - } - - - @SuppressWarnings("SameParameterValue") - private static boolean getProperty( - @NotNull Properties a_properties, - @NotNull String a_key, - boolean a_defaultValue) - { - String res = a_properties.getProperty(a_key); - - if (res == null) { - NostalgicBugsMod.g_logger.error("Missing [" + a_key + "] param in client settings"); - return a_defaultValue; - } - - return Boolean.parseBoolean(res); - } - - - @SuppressWarnings("SameParameterValue") - private static int getProperty( - @NotNull Properties a_properties, - @NotNull String a_key, - @Range(from = 0, to = Integer.MAX_VALUE) int a_defaultValue) - { - String res = a_properties.getProperty(a_key); - - if (res == null) { - NostalgicBugsMod.g_logger.error("Missing [" + a_key + "] param in client settings"); - return a_defaultValue; - } - - return Integer.parseInt(res); - } - - - @SuppressWarnings("SameParameterValue") - private static boolean getProperty( - @NotNull NBTTagCompound a_properties, - @NotNull String a_key, - boolean a_defaultValue) - { - if (!a_properties.hasKey(a_key)) { - NostalgicBugsMod.g_logger.error("Missing [" + a_key + "] param in server settings"); - return a_defaultValue; - } - - return a_properties.getBoolean(a_key); - } - - - @SuppressWarnings("SameParameterValue") - private static int getProperty( - @NotNull NBTTagCompound a_properties, - @NotNull String a_key, - @Range(from = 0, to = Integer.MAX_VALUE) int a_defaultValue) - { - if (!a_properties.hasKey(a_key)) { - NostalgicBugsMod.g_logger.error("Missing [" + a_key + "] param in server settings"); - return a_defaultValue; - } - - return a_properties.getInteger(a_key); - } -} - diff --git a/src/main/java/eosl/nostalgic_bugs/features/BoatWaterLift.java b/src/main/java/eosl/nostalgic_bugs/features/BoatWaterLift.java @@ -1,21 +0,0 @@ -package eosl.nostalgic_bugs.features; - -import eosl.nostalgic_bugs.NostalgicBugsMod; -import net.minecraft.src.*; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.Constant; -import org.spongepowered.asm.mixin.injection.ModifyConstant; - - -@Mixin(value = EntityBoat.class, remap = false) -public class BoatWaterLift -{ - @ModifyConstant(method = "onUpdate", constant = @Constant(doubleValue = 1.0, ordinal = 1)) - private double dConditionDestroyer(double d) - { - if (NostalgicBugsMod.g_settings.m_boatWaterLift) - return Double.MAX_VALUE; - else - return d; - } -} diff --git a/src/main/java/eosl/nostalgic_bugs/features/LadderGaps.java b/src/main/java/eosl/nostalgic_bugs/features/LadderGaps.java @@ -1,34 +0,0 @@ -package eosl.nostalgic_bugs.features; - -import eosl.nostalgic_bugs.NostalgicBugsMod; -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.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 -{ - @Inject(method = "isOnLadder", at = @At("HEAD"), cancellable = true) - public void increaseLadderCoverage(@NotNull CallbackInfoReturnable<Boolean> cir) - { - if (!NostalgicBugsMod.g_settings.m_ladderGaps) - return; - - EntityLiving self = ((EntityLiving) ((Object) this)); - int x = MathHelper.floor_double(self.posX); - int yd = MathHelper.floor_double(self.boundingBox.minY); - int yu = yd + 1; - int z = MathHelper.floor_double(self.posZ); - - int id1 = self.worldObj.getBlockId(x, yd, z); - int id2 = self.worldObj.getBlockId(x, yu, z); - - cir.setReturnValue(id1 == Block.ladderOak.blockID || id2 == Block.ladderOak.blockID); - } -} diff --git a/src/main/java/eosl/nostalgic_bugs/features/MinecartBooster.java b/src/main/java/eosl/nostalgic_bugs/features/MinecartBooster.java @@ -1,25 +0,0 @@ -package eosl.nostalgic_bugs.features; - -import eosl.nostalgic_bugs.NostalgicBugsMod; -import net.minecraft.src.*; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.ModifyVariable; - - -@Mixin(value = EntityMinecart.class, remap = false) -public class MinecartBooster -{ - @ModifyVariable( - method = "applyEntityCollision", - at = @At(value = "STORE"), - ordinal = 6 - ) - private double d6ConditionDestroyer(double d6) - { - if (NostalgicBugsMod.g_settings.m_minecartBoosters) - return 0; - else - return d6; - } -} diff --git a/src/main/java/eosl/nostalgic_bugs/features/OldFireSpread.java b/src/main/java/eosl/nostalgic_bugs/features/OldFireSpread.java @@ -1,43 +0,0 @@ -package eosl.nostalgic_bugs.features; - -import eosl.nostalgic_bugs.NostalgicBugsMod; -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 NostalgicBugsMod.g_settings.m_fireTickRate; - } - - - @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: - if (NostalgicBugsMod.g_settings.m_infiniteFireSpread) - 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/java/eosl/nostalgic_bugs/features/SouthEastRuleForLiquids.java b/src/main/java/eosl/nostalgic_bugs/features/SouthEastRuleForLiquids.java @@ -1,44 +0,0 @@ -package eosl.nostalgic_bugs.features; - -import eosl.nostalgic_bugs.NostalgicBugsMod; -import net.minecraft.src.AxisAlignedBB; -import net.minecraft.src.Entity; -import net.minecraft.src.Material; -import org.jetbrains.annotations.NotNull; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - - -@Mixin(value = Entity.class, remap = false) -public class SouthEastRuleForLiquids -{ - @Inject(method = "handleWaterMovement", at = @At("HEAD"), cancellable = true) - private void waterInject(@NotNull CallbackInfoReturnable<Boolean> cir) - { - if (!NostalgicBugsMod.g_settings.m_southEastRuleForLiquids) - return; - - // Just remove negative expanding of aabb: - Entity self = ((Entity) ((Object) this)); - AxisAlignedBB aabb = self.boundingBox.expand(0.0, -0.4000000059604645, 0.0); - boolean res = self.worldObj.handleMaterialAcceleration(aabb, Material.water, self); - cir.setReturnValue(res); - } - - - @Inject(method = "handleLavaMovement", at = @At("HEAD"), cancellable = true) - private void lavaInject(@NotNull CallbackInfoReturnable<Boolean> cir) - { - if (!NostalgicBugsMod.g_settings.m_southEastRuleForLiquids) - return; - - // Just remove negative expanding of aabb: - Entity self = ((Entity) ((Object) this)); - AxisAlignedBB aabb = self.boundingBox.expand(0.0, -0.4000000059604645, 0.0); - boolean res = self.worldObj.isMaterialInBB(aabb, Material.lava); - cir.setReturnValue(res); - } - -} diff --git a/src/main/java/turniplabs/oldbugs/OldBugs.java b/src/main/java/turniplabs/oldbugs/OldBugs.java @@ -0,0 +1,15 @@ +package turniplabs.oldbugs; + +import net.fabricmc.api.ModInitializer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class OldBugs implements ModInitializer { + public static final String MOD_ID = "oldbugs"; + public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID); + + @Override + public void onInitialize() { + LOGGER.info("OldBugs initialized"); + } +} diff --git a/src/main/java/turniplabs/oldbugs/mixin/BlockFireMixin.java b/src/main/java/turniplabs/oldbugs/mixin/BlockFireMixin.java @@ -0,0 +1,30 @@ +package turniplabs.oldbugs.mixin; + +import net.minecraft.core.block.Block; +import net.minecraft.core.block.BlockFire; +import net.minecraft.core.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.*; + +@Mixin(value = BlockFire.class, remap = false) +final class BlockFireMixin { + @ModifyConstant(method = "tickRate", constant = @Constant(intValue = 40)) + private int changeTickRate(int a) { + return 10; + } + + + @Redirect(method = "tryToCatchBlockOnFire", at = @At(value = "INVOKE", + target = "Lnet/minecraft/core/world/World;setBlockAndMetadataWithNotify(IIIII)Z")) + private boolean infiniteSpreading(World world, int x, int y, int z, int id, int meta) { + world.setBlockAndMetadataWithNotify(x, y, z, Block.fire.id, 0); + + return false; + } + + @Redirect(method = "tryToCatchBlockOnFire", at = @At(value = "INVOKE", + target = "Lnet/minecraft/core/block/BlockFire;setBurnResult(Lnet/minecraft/core/world/World;III)V")) + private void cancelSetBurnResult(BlockFire instance, World world, int x, int y, int z) { + + } +} diff --git a/src/main/java/turniplabs/oldbugs/mixin/EntityBoatMixin.java b/src/main/java/turniplabs/oldbugs/mixin/EntityBoatMixin.java @@ -0,0 +1,14 @@ +package turniplabs.oldbugs.mixin; + +import net.minecraft.core.entity.vehicle.EntityBoat; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.Constant; +import org.spongepowered.asm.mixin.injection.ModifyConstant; + +@Mixin(value = EntityBoat.class, remap = false) +final class EntityBoatMixin { + @ModifyConstant(method = "tick", constant = @Constant(doubleValue = 1.0, ordinal = 1)) + private double change(double d) { + return Double.MAX_VALUE; + } +} diff --git a/src/main/java/turniplabs/oldbugs/mixin/EntityLivingMixin.java b/src/main/java/turniplabs/oldbugs/mixin/EntityLivingMixin.java @@ -0,0 +1,25 @@ +package turniplabs.oldbugs.mixin; + +import net.minecraft.core.block.Block; +import net.minecraft.core.entity.EntityLiving; +import net.minecraft.core.util.helper.MathHelper; +import org.spongepowered.asm.mixin.Mixin; +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) +final class EntityLivingMixin { + @Inject(method = "canClimb", at = @At("HEAD"), cancellable = true) + public void increaseLadderCoverage(CallbackInfoReturnable<Boolean> cir) { + EntityLiving self = ((EntityLiving) ((Object) this)); + + int x = MathHelper.floor_double(self.x); + int y = MathHelper.floor_double(self.bb.minY); + int z = MathHelper.floor_double(self.z); + + cir.setReturnValue(self.world.getBlockId(x, y, z) == Block.ladderOak.id || + self.world.getBlockId(x, y + 1, z) == Block.ladderOak.id); + } +} diff --git a/src/main/java/turniplabs/oldbugs/mixin/EntityMinecartMixin.java b/src/main/java/turniplabs/oldbugs/mixin/EntityMinecartMixin.java @@ -0,0 +1,14 @@ +package turniplabs.oldbugs.mixin; + +import net.minecraft.core.entity.vehicle.EntityMinecart; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyVariable; + +@Mixin(value = EntityMinecart.class, remap = false) +final class EntityMinecartMixin { + @ModifyVariable(method = "push", at = @At(value = "STORE"), ordinal = 6) + private double change(double d6) { + return 0; + } +} diff --git a/src/main/java/turniplabs/oldbugs/mixin/EntityMixin.java b/src/main/java/turniplabs/oldbugs/mixin/EntityMixin.java @@ -0,0 +1,22 @@ +package turniplabs.oldbugs.mixin; + +import net.minecraft.core.block.material.Material; +import net.minecraft.core.entity.Entity; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import net.minecraft.core.util.phys.AABB; + +@Mixin(value = Entity.class, remap = false) +final class EntityMixin { + @Inject(method = "checkAndHandleWater", at = @At("HEAD"), cancellable = true) + private void onCheckAndHandleWater(CallbackInfoReturnable<Boolean> cir) { + Entity self = ((Entity) ((Object) this)); + + AABB aabb = self.bb.expand(0.0, -0.4000000059604645, 0.0); + boolean res = self.world.handleMaterialAcceleration(aabb, Material.water, self); + + cir.setReturnValue(res); + } +} diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json @@ -1,24 +1,27 @@ { "schemaVersion": 1, - "id": "nostalgic_bugs", + "id": "oldbugs", "version": "${version}", - "name": "Minecart BTA Nostalgic Bugs Mod", - "description": "Returns a few old beta minecart bugs.", - "authors": ["eosl"], + "name": "Old Bugs", + "description": "Brings back bugs from older Minecraft versions.", + "authors": [ + "eosl", + "Ambos" + ], "contact": { - "homepage": "", - "sources": "https://github.com/EOfSL/bta-old-nostalgic-bugs", - "steam": "https://steamcommunity.com/id/true_eosl/" + "homepage": "https://github.com/Turnip-Labs/", + "sources": "https://github.com/Turnip-Labs/old-bugs", + "issues": "https://github.com/Turnip-Labs/old-bugs/issues" }, "license": "CC0-1.0", "environment": "*", "entrypoints": { "main": [ - "eosl.nostalgic_bugs.NostalgicBugsMod" + "turniplabs.oldbugs.OldBugs" ] }, "mixins": [ - "nostalgic_bugs.mixins.json" + "oldbugs.mixins.json" ], "depends": { "fabricloader": ">=0.13.3" diff --git a/src/main/resources/nostalgic_bugs.mixins.json b/src/main/resources/nostalgic_bugs.mixins.json @@ -1,17 +0,0 @@ -{ - "required": true, - "minVersion": "0.8", - "package": "eosl.nostalgic_bugs.features", - "compatibilityLevel": "JAVA_8", - "mixins": [ - "BoatWaterLift", - "LadderGaps", - "MinecartBooster", - "OldFireSpread", - "SouthEastRuleForLiquids" - ], - "client": [], - "injectors": { - "defaultRequire": 1 - } -} diff --git a/src/main/resources/oldbugs.mixins.json b/src/main/resources/oldbugs.mixins.json @@ -0,0 +1,17 @@ +{ + "required": true, + "minVersion": "0.8", + "package": "turniplabs.oldbugs.mixin", + "compatibilityLevel": "JAVA_8", + "mixins": [ + "BlockFireMixin", + "EntityBoatMixin", + "EntityLivingMixin", + "EntityMinecartMixin", + "EntityMixin" + ], + "client": [], + "injectors": { + "defaultRequire": 1 + } +}