vanilla-fixes

Minecraft: Better than Adventure! mod that fixes some issues
git clone git://memoryshards.xyz/vanilla-fixes.git
Log | Files | Refs | README | LICENSE

commit 049d85b551555485990e29453f56464c38177581
parent 389c530c707d86cc00677e56354697f475d851ba
Author: Amb0s <ambos@disroot.org>
Date:   Fri, 17 Jul 2020 14:12:15 +0200

Minor addition/changes

- Renamed methods
- Changed indentation
- Added a new resources proxy
- Fixed fences placement

Diffstat:
Msrc/main/java/ambos/vanillafixes/MinecraftUtil.java | 9+++++----
Asrc/main/java/ambos/vanillafixes/mixin/FenceMixin.java | 16++++++++++++++++
Msrc/main/java/ambos/vanillafixes/mixin/HatchetMixin.java | 3++-
Msrc/main/java/ambos/vanillafixes/mixin/PickaxeMixin.java | 5+++--
Msrc/main/java/ambos/vanillafixes/mixin/ResourceDownloadThreadMixin.java | 2+-
Msrc/main/resources/vanillafixes.mixins.json | 5+++--
6 files changed, 30 insertions(+), 10 deletions(-)

diff --git a/src/main/java/ambos/vanillafixes/MinecraftUtil.java b/src/main/java/ambos/vanillafixes/MinecraftUtil.java @@ -16,9 +16,10 @@ import java.util.Arrays; import java.util.Optional; public final class MinecraftUtil { - private final static ArrayList<String> RESOURCES_PROXY_URLs = new ArrayList<>(Arrays.asList( + private final static ArrayList<String> PROXY_URLs = new ArrayList<>(Arrays.asList( "http://resourceproxy.pymcl.net/MinecraftResources/", - "https://betacraft.pl/MinecraftResources/" + "https://betacraft.pl/MinecraftResources/", + "http://mcresources.modification-station.net/MinecraftResources/" )); private static final Logger logger = LogManager.getLogger(MinecraftUtil.class); @@ -102,9 +103,9 @@ public final class MinecraftUtil { } public static String getResources() { - for (String url : RESOURCES_PROXY_URLs) { + for (String url : PROXY_URLs) { if (!isDown(url)) { - logger.info("Resource proxy found: " + url); + logger.info("Resources proxy found: " + url); return url; } } diff --git a/src/main/java/ambos/vanillafixes/mixin/FenceMixin.java b/src/main/java/ambos/vanillafixes/mixin/FenceMixin.java @@ -0,0 +1,16 @@ +package ambos.vanillafixes.mixin; + +import net.minecraft.level.Level; +import net.minecraft.tile.Fence; +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(Fence.class) +final class FenceMixin { + @Inject(method = "canPlaceAt", at = @At("RETURN"), cancellable = true) + private void onCanPlaceAt(Level level, int x, int y, int z, CallbackInfoReturnable cir) { + cir.setReturnValue(true); + } +} diff --git a/src/main/java/ambos/vanillafixes/mixin/HatchetMixin.java b/src/main/java/ambos/vanillafixes/mixin/HatchetMixin.java @@ -8,7 +8,8 @@ import org.spongepowered.asm.mixin.Shadow; @Mixin(Hatchet.class) public class HatchetMixin { @Shadow - private static Tile[] effectiveBlocks = new Tile[]{Tile.WOOD, Tile.BOOKSHELF, Tile.LOG, Tile.CHEST, Tile.WORKBENCH, + private static Tile[] effectiveBlocks = new Tile[]{ + Tile.WOOD, Tile.BOOKSHELF, Tile.LOG, Tile.CHEST, Tile.WORKBENCH, Tile.DOOR_WOOD, Tile.STAIRS_WOOD, Tile.WOODEN_PRESSURE_PLATE, Tile.FENCE, Tile.TRAPDOOR, Tile.JUKEBOX, Tile.PUMPKIN, Tile.LIT_PUMPKIN, Tile.STANDING_SIGN, Tile.WALL_SIGN, Tile.NOTEBLOCK, Tile.LADDER }; diff --git a/src/main/java/ambos/vanillafixes/mixin/PickaxeMixin.java b/src/main/java/ambos/vanillafixes/mixin/PickaxeMixin.java @@ -6,9 +6,10 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @Mixin(Pickaxe.class) -public class PickaxeMixin { +final class PickaxeMixin { @Shadow - private static Tile[] effectiveBlocks = new Tile[]{Tile.STONEBRICK, Tile.DOUBLE_STONE_SLAB, Tile.STONE_SLAB, + private static Tile[] effectiveBlocks = new Tile[]{ + Tile.STONEBRICK, Tile.DOUBLE_STONE_SLAB, Tile.STONE_SLAB, Tile.STONE, Tile.SANDSTONE, Tile.MOSSY_COBBLESTONE, Tile.IRON_ORE, Tile.BLOCK_IRON, Tile.COAL_ORE, Tile.BLOCK_GOLD, Tile.GOLD_ORE, Tile.ORE_DIAMOND, Tile.BLOCK_DIAMOND, Tile.ICE, Tile.NETHERRACK, Tile.LAPIS_LAZULI_ORE, Tile.LAPIS_LAZULI_BLOCK, Tile.REDSTONE_ORE, Tile.REDSTONE_ORE_LIT, Tile.STAIRS_STONE, diff --git a/src/main/java/ambos/vanillafixes/mixin/ResourceDownloadThreadMixin.java b/src/main/java/ambos/vanillafixes/mixin/ResourceDownloadThreadMixin.java @@ -9,7 +9,7 @@ import org.spongepowered.asm.mixin.injection.ModifyConstant; @Mixin(ResourceDownloadThread.class) final class ResourceDownloadThreadMixin { @ModifyConstant(method = "run", constant = @Constant(stringValue = "http://s3.amazonaws.com/MinecraftResources/"), remap = false) - private String changeResourcesURL(String def) { + private String changeURL(String url) { return MinecraftUtil.getResources(); } } diff --git a/src/main/resources/vanillafixes.mixins.json b/src/main/resources/vanillafixes.mixins.json @@ -10,10 +10,11 @@ "class_520Mixin", "ClientPlayNetworkHandlerMixin", "DeathScreenMixin", - "LoginThreadMixin", + "FenceMixin", "HatchetMixin", - "PickaxeMixin", + "LoginThreadMixin", "MinecraftMixin", + "PickaxeMixin", "PlayerMixin", "RemoteClientPlayerMixin", "ResourceDownloadThreadMixin",