diff --git a/src/minecraft/net/minecraft/src/BlockDoor.java.patch b/src/minecraft/net/minecraft/src/BlockDoor.java.patch new file mode 100644 index 0000000..b8ae53f --- /dev/null +++ b/src/minecraft/net/minecraft/src/BlockDoor.java.patch @@ -0,0 +1,136 @@ +--- src/BlockDoor.java.bak 2025-04-11 18:43:25.963101170 +0300 ++++ src/BlockDoor.java 2025-04-12 13:00:03.655089309 +0300 +@@ -5,6 +5,8 @@ + package net.minecraft.src; + + import java.util.Random; ++import net.minecraft.src.finalbeta.ModConfig; ++import net.minecraft.src.finalbeta.WyHelper; + + // Referenced classes of package net.minecraft.src: + // Block, Material, IBlockAccess, World, +@@ -113,6 +115,28 @@ + { + return true; + } ++ ++ if (ModConfig.FIX_DOUBLE_DOORS.get()) { ++ int tileMeta = world.getBlockMetadata(i, j, k); ++ int yOffset = 0; ++ ++ if ((tileMeta & 8) != 0) { ++ setDoorTileMeta(world, i, j - 1, k, (tileMeta ^ 4) - 8); ++ yOffset = 1; ++ } ++ else { ++ setDoorTileMeta(world, i, j, k, tileMeta ^ 4); ++ } ++ ++ boolean state = false; ++ int hash = generatePosHash(i, j - yOffset, k); ++ if (WyHelper.DOOR_STATES.containsKey(hash)) { ++ state = WyHelper.DOOR_STATES.get(hash); ++ } ++ WyHelper.DOOR_STATES.put(hash, !state); ++ return true; ++ } ++ + int l = world.getBlockMetadata(i, j, k); + if((l & 8) != 0) + { +@@ -134,6 +158,42 @@ + + public void onPoweredBlockChange(World world, int i, int j, int k, boolean flag) + { ++ if (ModConfig.FIX_DOUBLE_DOORS.get()) { ++ // Top Tile Meta ++ // Open: 12 11 - 13 8 - 14 9 - 15 10 ++ // Close: 8 15 - 9 12 - 10 13 - 11 14 ++ ++ // Bottom Tile Meta ++ // Open: 4 3 - 5 0 - 6 1 - 7 2 ++ // Close: 0 7 - 1 4 - 2 5 - 3 6 ++ ++ int hash = generatePosHash(i, j, k); ++ if (WyHelper.DOOR_UPDATES.containsKey(hash)) { ++ long lastUpdate = System.currentTimeMillis() - WyHelper.DOOR_UPDATES.get(hash); ++ if (lastUpdate < 200) { ++ return; ++ } ++ } ++ ++ int tileMeta = world.getBlockMetadata(i, j, k); ++ ++ if (flag) { ++ if (WyHelper.DOOR_STATES.containsKey(hash) && WyHelper.DOOR_STATES.get(hash)) { ++ return; ++ } ++ setDoorTileMeta(world, i, j, k, Math.floorMod((tileMeta + 4), 8)); ++ WyHelper.DOOR_STATES.put(hash, true); ++ } ++ else { ++ if (WyHelper.DOOR_STATES.containsKey(hash) && !WyHelper.DOOR_STATES.get(hash)) { ++ return; ++ } ++ setDoorTileMeta(world, i, j, k, Math.floorMod((tileMeta - 4), 8)); ++ WyHelper.DOOR_STATES.put(hash, false); ++ } ++ return; ++ } ++ + int l = world.getBlockMetadata(i, j, k); + if((l & 8) != 0) + { +@@ -201,6 +261,25 @@ + } + } + } ++ ++ public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f) { ++ int tileMeta = world.getBlockMetadata(i, j, k); ++ int yOffset = 0; ++ ++ if ((tileMeta & 8) != 0) { ++ yOffset = 1; ++ } ++ ++ int hash = generatePosHash(i, j - yOffset, k); ++ WyHelper.DOOR_UPDATES.remove(hash); ++ WyHelper.DOOR_STATES.remove(hash); ++ super.dropBlockAsItemWithChance(world, i, j, k, l, f); ++ } ++ ++ public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving) { ++ int hash = generatePosHash(i, j, k); ++ WyHelper.DOOR_STATES.put(hash, false); ++ } + + public int idDropped(int i, Random random) + { +@@ -254,4 +333,26 @@ + { + return 1; + } ++ ++ private void setDoorTileMeta(World level, int x, int y, int z, int meta) { ++ int tileId = level.getBlockId(x, y, z); ++ level.setBlockMetadata(x, y, z, meta); ++ generateAndSaveHash(x, y, z); ++ if (level.getBlockId(x, y + 1, z) == tileId) { ++ level.setBlockMetadata(x, y + 1, z, meta + 8); ++ generateAndSaveHash(x, y, z); ++ } ++ ++ level.markBlocksDirty(x, y - 1, z, x, y, z); ++ level.func_28107_a((EntityPlayer) null, 1003, x, y, z, 0); ++ } ++ ++ public int generatePosHash(int x, int y, int z) { ++ return (y * 31) + (z * 15) + x; ++ } ++ ++ private void generateAndSaveHash(int x, int y, int z) { ++ WyHelper.DOOR_UPDATES.put(generatePosHash(x, y, z), System.currentTimeMillis()); ++ } ++ + } diff --git a/src/minecraft/net/minecraft/src/EntityBoat.java.patch b/src/minecraft/net/minecraft/src/EntityBoat.java.patch new file mode 100644 index 0000000..7c483d1 --- /dev/null +++ b/src/minecraft/net/minecraft/src/EntityBoat.java.patch @@ -0,0 +1,48 @@ +--- src/EntityBoat.java.bak 2025-04-11 18:43:26.998087650 +0300 ++++ src/EntityBoat.java 2025-04-12 13:49:06.831634480 +0300 +@@ -6,6 +6,8 @@ + + import java.util.List; + import java.util.Random; ++import net.minecraft.src.finalbeta.ModConfig; ++import net.minecraft.src.finalbeta.WyHelper; + + // Referenced classes of package net.minecraft.src: + // Entity, World, Block, Item, +@@ -233,6 +235,17 @@ + } + moveEntity(motionX, motionY, motionZ); + double d8 = Math.sqrt(motionX * motionX + motionZ * motionZ); ++ ++ if (this.isCollidedHorizontally && this.canSurvive(this)) { ++ this.isCollidedHorizontally = false; ++ } ++ ++ if (this.riddenByEntity != null && this.ticksExisted % 39 == 1) { ++ float speed = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); ++ float volume = 0.3f + WyHelper.lerp(WyHelper.clamp(speed, 0.0F, 0.25F), 0.0F, 0.7f); ++ this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "sound3.liquid.water", volume, 0.0f); ++ } ++ + if(d8 > 0.14999999999999999D) + { + double d12 = Math.cos(((double)rotationYaw * 3.1415926535897931D) / 180D); +@@ -367,6 +380,18 @@ + } + return true; + } ++ ++ private boolean canSurvive(EntityBoat boat) { ++ double velocity = Math.sqrt(boat.motionX * boat.motionX + boat.motionZ * boat.motionZ); ++ boolean survives = false; ++ if (ModConfig.BOAT_BREAKING_LOGIC.get() == 1) { ++ survives = true; ++ } else if (ModConfig.BOAT_BREAKING_LOGIC.get() == 2 && velocity < 0.22) { ++ survives = true; ++ } ++ ++ return survives; ++ } + + public int boatCurrentDamage; + public int boatTimeSinceHit; diff --git a/src/minecraft/net/minecraft/src/EntityMinecart.java.patch b/src/minecraft/net/minecraft/src/EntityMinecart.java.patch new file mode 100644 index 0000000..13f1c6c --- /dev/null +++ b/src/minecraft/net/minecraft/src/EntityMinecart.java.patch @@ -0,0 +1,127 @@ +--- src/EntityMinecart.java.bak 2025-04-11 18:43:27.270084097 +0300 ++++ src/EntityMinecart.java 2025-04-12 13:42:29.031819118 +0300 +@@ -7,6 +7,8 @@ + import java.io.PrintStream; + import java.util.List; + import java.util.Random; ++import net.minecraft.src.finalbeta.ModConfig; ++import net.minecraft.src.finalbeta.WyHelper; + + // Referenced classes of package net.minecraft.src: + // Entity, IInventory, ItemStack, World, +@@ -17,6 +19,9 @@ + public class EntityMinecart extends Entity + implements IInventory + { ++ private static final double EXTRA_MINECART_XZ_SIZE = 0.4; ++ private static final double EXTRA_MINECART_Y_SIZE = 0.0; ++ private static final int COAL_FUEL = 1200; + + public EntityMinecart(World world) + { +@@ -42,6 +47,20 @@ + + public AxisAlignedBB getCollisionBox(Entity entity) + { ++ if (ModConfig.FIX_MINECART_STOPPING_ON_ITEMS.get()) { ++ if (entity instanceof EntityItem || entity instanceof EntityArrow) { ++ return null; ++ } ++ } ++ ++ if (ModConfig.FURNACE_MINECART_PUSH.get()) { ++ if (this.minecartType == 2 && entity instanceof EntityMinecart) { ++ EntityMinecart otherMinecart = (EntityMinecart) entity; ++ otherMinecart.motionX = this.pushX * 1.02; ++ otherMinecart.motionZ = this.pushZ * 1.02; ++ } ++ } ++ + return entity.boundingBox; + } + +@@ -75,11 +94,26 @@ + } + + public boolean attackEntityFrom(Entity entity, int i) +- { ++ { + if(worldObj.multiplayerWorld || isDead) + { + return true; + } ++ ++ if (this.minecartType == 2) { ++ int coal = this.fuel / COAL_FUEL; ++ if (coal > 0) { ++ while (coal > 0) { ++ if (coal < 64) { ++ this.dropItemWithOffset(Item.coal.shiftedIndex, coal, 0.0F); ++ break; ++ } ++ this.dropItemWithOffset(Item.coal.shiftedIndex, 64, 0.0F); ++ coal -= 64; ++ } ++ } ++ } ++ + minecartRockDirection = -minecartRockDirection; + minecartTimeSinceHit = 10; + setBeenAttacked(); +@@ -139,7 +173,7 @@ + + public void performHurtAnimation() + { +- System.out.println("Animating hurt"); ++// System.out.println("Animating hurt"); + minecartRockDirection = -minecartRockDirection; + minecartTimeSinceHit = 10; + minecartCurrentDamage += minecartCurrentDamage * 10; +@@ -230,7 +264,7 @@ + { + j--; + } +- double d2 = 0.40000000000000002D; ++ double d2 = ModConfig.MINECART_MAX_SPEED.get(); + boolean flag = false; + double d5 = 0.0078125D; + int l = worldObj.getBlockId(i, j, k); +@@ -457,7 +491,37 @@ + motionZ = -0.02D; + } + } +- } ++ ++ this.motionX = Math.min(this.motionX * ModConfig.MINECART_POWERED_BOOST.get(), ModConfig.MINECART_MAX_SPEED.get()); ++ this.motionZ = Math.min(this.motionZ * ModConfig.MINECART_POWERED_BOOST.get(), ModConfig.MINECART_MAX_SPEED.get()); ++ } ++ ++ float speed = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); ++ float volume = 0; ++ float pitch = 0; ++ if (speed >= 0.01D) { ++ if (this.riddenByEntity != null && ModConfig.FIX_MINECART_FLICKERING.get()) { ++ this.boundingBox.setBounds(this.boundingBox.minX - EXTRA_MINECART_XZ_SIZE, ++ this.boundingBox.minY, ++ this.boundingBox.minZ - EXTRA_MINECART_XZ_SIZE, ++ this.boundingBox.maxX + EXTRA_MINECART_XZ_SIZE, ++ this.boundingBox.maxY + EXTRA_MINECART_Y_SIZE, ++ this.boundingBox.maxZ + EXTRA_MINECART_XZ_SIZE); ++ } ++ ++this.ticksExisted; ++ pitch = WyHelper.clamp(pitch + 0.0025F, 0.0F, 1.0F); ++ volume = WyHelper.lerp(WyHelper.clamp(speed, 0.0F, 0.5F), 0.0F, 0.7F); ++ } else { ++ volume = 0.0f; ++ pitch = 0.0f; ++ } ++ ++ if (speed >= 0.01D && ModConfig.ADD_MORE_SOUNDS.get()) { ++ if (this.ticksExisted % 39 == 1) { ++ this.worldObj.playSoundEffect(i, j, k, "sound3.minecart.base", volume, pitch); ++ } ++ } ++ + } else + { + if(motionX < -d2) diff --git a/src/minecraft/net/minecraft/src/WorldInfo.java.patch b/src/minecraft/net/minecraft/src/WorldInfo.java.patch index 23b98dc..215c23c 100644 --- a/src/minecraft/net/minecraft/src/WorldInfo.java.patch +++ b/src/minecraft/net/minecraft/src/WorldInfo.java.patch @@ -1,9 +1,11 @@ --- src/WorldInfo.java.bak 2025-04-07 00:31:25.816162873 +0300 -+++ src/WorldInfo.java 2025-04-07 00:41:09.294367286 +0300 -@@ -5,12 +5,14 @@ ++++ src/WorldInfo.java 2025-04-12 13:04:56.819644983 +0300 +@@ -5,12 +5,16 @@ package net.minecraft.src; import java.util.List; ++import java.util.Map.Entry; ++import net.minecraft.src.finalbeta.ModConfig; +import net.minecraft.src.finalbeta.WyHelper; // Referenced classes of package net.minecraft.src: @@ -15,7 +17,7 @@ public WorldInfo(NBTTagCompound nbttagcompound) { -@@ -32,6 +34,13 @@ +@@ -32,6 +36,24 @@ playerTag = nbttagcompound.getCompoundTag("Player"); dimension = playerTag.getInteger("Dimension"); } @@ -26,16 +28,38 @@ + this.spawnTime = nbttagcompound.getLong(WyHelper.SPAWN_TIME_TAG); + } + WyHelper.playTime = nbttagcompound.getLong(WyHelper.PLAY_TIME_TAG); ++ ++ if (ModConfig.FIX_DOUBLE_DOORS.get()) { ++ WyHelper.DOOR_STATES.clear(); ++ NBTTagList doorStates = nbttagcompound.getTagList("DoorStates"); ++ for (int i = 0; i < doorStates.tagCount(); i++) { ++ NBTTagCompound doorTag = (NBTTagCompound) doorStates.tagAt(i); ++ int hash = doorTag.getInteger("hash"); ++ boolean state = doorTag.getBoolean("state"); ++ WyHelper.DOOR_STATES.put(hash, state); ++ } ++ } } public WorldInfo(long l, String s) -@@ -103,6 +112,9 @@ +@@ -103,6 +125,20 @@ { nbttagcompound.setCompoundTag("Player", nbttagcompound1); } + + nbttagcompound.setLong(WyHelper.SPAWN_TIME_TAG, this.spawnTime); + nbttagcompound.setLong(WyHelper.PLAY_TIME_TAG, WyHelper.playTime); ++ ++ if (ModConfig.FIX_DOUBLE_DOORS.get()) { ++ NBTTagList doorStates = new NBTTagList(); ++ for (Entry entry : WyHelper.DOOR_STATES.entrySet()) { ++ NBTTagCompound doorTag = new NBTTagCompound(); ++ doorTag.setInteger("hash", entry.getKey()); ++ doorTag.setBoolean("state", entry.getValue()); ++ doorStates.setTag(doorTag); ++ } ++ nbttagcompound.setTag("DoorStates", doorStates); ++ } } public long getRandomSeed() diff --git a/src/minecraft/net/minecraft/src/finalbeta/WyHelper.java b/src/minecraft/net/minecraft/src/finalbeta/WyHelper.java index 429bd21..4e18779 100644 --- a/src/minecraft/net/minecraft/src/finalbeta/WyHelper.java +++ b/src/minecraft/net/minecraft/src/finalbeta/WyHelper.java @@ -3,11 +3,17 @@ package net.minecraft.src.finalbeta; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.time.Duration; +import java.util.HashMap; import net.minecraft.src.ModLoader; public class WyHelper { public static final String SPAWN_TIME_TAG = "SpawnTime"; public static final String PLAY_TIME_TAG = "PlayTime"; + // Look if they're allowed to hold all block and item data in fucking arrays + // I am also allowed to abuse maps to extend the shitty metadata excuse + // doors have ok ? I don't even care about the overhead at this point. + public static final HashMap DOOR_UPDATES = new HashMap<>(); + public static final HashMap DOOR_STATES = new HashMap<>(); public static long playTime; diff --git a/src/minecraft/net/minecraft/src/mod_FinalBeta.java b/src/minecraft/net/minecraft/src/mod_FinalBeta.java index b3c7ac3..e12746e 100644 --- a/src/minecraft/net/minecraft/src/mod_FinalBeta.java +++ b/src/minecraft/net/minecraft/src/mod_FinalBeta.java @@ -81,8 +81,11 @@ public class mod_FinalBeta extends BaseMod { // DEBUG stuff if (this.canPressKey(Keyboard.KEY_O)) { -// minecraft.thePlayer.dropItem(Block.oreLapis.blockID, 64); -// minecraft.theWorld.setWorldTime(0); + minecraft.thePlayer.dropItem(Item.doorWood.shiftedIndex, 2); + minecraft.thePlayer.dropItem(Block.pressurePlatePlanks.blockID, 4); + minecraft.thePlayer.dropItem(Item.redstone.shiftedIndex, 64); + + minecraft.theWorld.setWorldTime(0); } else { if (keyTimer > 0) {