Skip to content
This repository has been archived by the owner on Feb 14, 2024. It is now read-only.

Commit

Permalink
update to 1.20.1
Browse files Browse the repository at this point in the history
  • Loading branch information
deirn committed Sep 19, 2023
1 parent a24cc69 commit 8a6d1ec
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 17 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ archivesBaseName = "wthitharvestability-mc" + "${minecraft_version}"
java.toolchain.languageVersion = JavaLanguageVersion.of(17)

repositories {
maven { url "https://maven.bai.lol" }
maven { url "https://maven2.bai.lol" }
maven { url "https://dvs1.progwml6.com/files/maven" }
}

Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
mod_version=2.1.0
minecraft_version=1.19.2
forge_version= 43.1.3
mod_version=2.2.0
minecraft_version=1.20.1
forge_version= 47.1.0
mappings_version=20200723-1.16.1
wthit_version=5.11.3
badpackets_version=0.2.0
wthit_version=8.4.0
badpackets_version=0.4.2
mantle_version=1.18.2-1.9.28
tconstruct_version=1.18.2-3.5.1.35

Expand Down
9 changes: 4 additions & 5 deletions java/squeek/wthitharvestability/WailaHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.ArrayList;
import java.util.List;

import mcp.mobius.waila.api.IBlockAccessor;
import mcp.mobius.waila.api.IBlockComponentProvider;
import mcp.mobius.waila.api.IEventListener;
Expand All @@ -10,7 +11,6 @@
import mcp.mobius.waila.api.ITooltip;
import mcp.mobius.waila.api.IWailaPlugin;
import mcp.mobius.waila.api.TooltipPosition;
import mcp.mobius.waila.api.WailaPlugin;
import net.minecraft.ChatFormatting;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.core.BlockPos;
Expand All @@ -34,7 +34,6 @@
import squeek.wthitharvestability.helpers.ToolHelper;
import squeek.wthitharvestability.helpers.ToolType;

@WailaPlugin(id = WailaHarvestability.MOD_ID + ":plugin")
public class WailaHandler implements IBlockComponentProvider, IEventListener, IWailaPlugin {

@Override
Expand Down Expand Up @@ -89,7 +88,7 @@ public void getHarvestability(List<Component> stringList, Player player, BlockSt
return;
}

if (BlockHelper.isAdventureModeAndBlockIsUnbreakable(player, pos) || BlockHelper.isBlockUnbreakable(player.level, pos, state)) {
if (BlockHelper.isAdventureModeAndBlockIsUnbreakable(player, pos) || BlockHelper.isBlockUnbreakable(player.level(), pos, state)) {
Component unbreakableString = Component.literal(ColorHelper.getBooleanColor(false)).append(config.getString(HARVESTABLE_FALSE_STRING)).append(" ").append(!minimalLayout ? Component.translatable("waila.h12y.harvestable").withStyle(ChatFormatting.RESET) : Component.literal(""));
stringList.add(unbreakableString);
return;
Expand All @@ -102,7 +101,7 @@ public void getHarvestability(List<Component> stringList, Player player, BlockSt
break;
}
}
ToolType effectiveTool = BlockHelper.getEffectiveToolOf(player.level, pos, state);
ToolType effectiveTool = BlockHelper.getEffectiveToolOf(player.level(), pos, state);
if (effectiveTool == null)
harvestTier = null;

Expand Down Expand Up @@ -173,7 +172,7 @@ public String getShearabilityString(Player player, BlockState state, BlockPos po
if (showShearability && canBeSheared) {
ItemStack heldStack = player.getMainHandItem();
boolean isHoldingShears = !heldStack.isEmpty() && heldStack.getItem() instanceof ShearsItem;
boolean isShearable = isHoldingShears && (isDoublePlant || ((IForgeShearable) state.getBlock()).isShearable(heldStack, player.level, pos));
boolean isShearable = isHoldingShears && (isDoublePlant || ((IForgeShearable) state.getBlock()).isShearable(heldStack, player.level(), pos));
return ColorHelper.getBooleanColor(isShearable, !isShearable && isHoldingShears) + config.getString(SHEARABILITY_STRING);
}
return "";
Expand Down
7 changes: 4 additions & 3 deletions java/squeek/wthitharvestability/helpers/BlockHelper.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package squeek.wthitharvestability.helpers;

import java.util.Map;

import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientPacketListener;
import net.minecraft.client.multiplayer.PlayerInfo;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraft.tags.TagKey;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
Expand Down Expand Up @@ -53,9 +54,9 @@ public static boolean isAdventureModeAndBlockIsUnbreakable(Player player, BlockP
return false;

ItemStack heldItem = player.getMainHandItem();
Level world = player.level;
Level world = player.level();

return gameType == GameType.SPECTATOR || heldItem.isEmpty() || !heldItem.hasAdventureModeBreakTagForBlock(world.registryAccess().registryOrThrow(Registry.BLOCK_REGISTRY), new BlockInWorld(world, pos, false));
return gameType == GameType.SPECTATOR || heldItem.isEmpty() || !heldItem.hasAdventureModeBreakTagForBlock(world.registryAccess().registryOrThrow(Registries.BLOCK), new BlockInWorld(world, pos, false));
}

/**
Expand Down
5 changes: 3 additions & 2 deletions java/squeek/wthitharvestability/helpers/ToolType.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import java.util.HashMap;
import java.util.Map;
import net.minecraft.core.Registry;

import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.TagKey;
Expand All @@ -26,7 +27,7 @@ public record ToolType(
register(new ToolType(BlockTags.MINEABLE_WITH_SHOVEL, new ItemStack(Items.WOODEN_SHOVEL), ToolActions.SHOVEL_DIG, "shovel"));
register(new ToolType(BlockTags.MINEABLE_WITH_AXE, new ItemStack(Items.WOODEN_AXE), ToolActions.AXE_DIG, "axe"));
register(new ToolType(BlockTags.MINEABLE_WITH_HOE, new ItemStack(Items.WOODEN_HOE), ToolActions.HOE_DIG, "hoe"));
register(new ToolType(TagKey.create(Registry.BLOCK_REGISTRY, new ResourceLocation("forge:mineable/sword")), new ItemStack(Items.WOODEN_SWORD), ToolActions.SWORD_DIG, "sword"));
register(new ToolType(TagKey.create(Registries.BLOCK, new ResourceLocation("forge:mineable/sword")), new ItemStack(Items.WOODEN_SWORD), ToolActions.SWORD_DIG, "sword"));
}

public static void register(ToolType toolType) {
Expand Down
2 changes: 1 addition & 1 deletion resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ license="The Unlicense"
[[dependencies.wthitharvestability]]
modId="wthit"
mandatory=true
versionRange="[5.11,)"
versionRange="[8.4.0,)"
ordering="AFTER"
side="BOTH"

Expand Down
5 changes: 5 additions & 0 deletions resources/waila_plugins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"wthitharvestability:plugin": {
"initializer": "squeek.wthitharvestability.WailaHandler"
}
}

0 comments on commit 8a6d1ec

Please sign in to comment.