Skip to content

Commit

Permalink
Update to 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
Patbox committed Jun 12, 2024
1 parent 45aa558 commit 48b884b
Show file tree
Hide file tree
Showing 58 changed files with 44 additions and 44 deletions.
22 changes: 11 additions & 11 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.20.6
yarn_mappings=1.20.6+build.1
loader_version=0.15.10
minecraft_version=1.21-rc1
yarn_mappings=1.21-rc1+build.1
loader_version=0.15.11

#Fabric api
fabric_version=0.97.6+1.20.6
fabric_version=0.100.1+1.21

# Mod Properties
mod_version = 1.12.2
mod_version = 1.13.0
maven_group = eu.pb4
archives_base_name = goml

# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
rtree_version=0.3.0
cca_version=6.0.0-beta.1
pal_version=1.9.0
polymer_version=0.8.2+1.20.6
sgui_version=1.5.1+1.20.5
stapi_version=2.3.0+1.20.5-rc2
placeholder_version=2.4.0-pre.1+1.20.5
cca_version=6.1.0
pal_version=1.10.0
polymer_version=0.9.0+1.21-rc1
sgui_version=1.6.0+1.21
stapi_version=2.3.1+1.21-pre2
placeholder_version=2.4.0-pre.2+1.21
common-protection-api_version=1.0.0

# compat
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/draylar/goml/GetOffMyLawn.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class GetOffMyLawn implements ModInitializer, WorldComponentInitializer {
public static GOMLConfig CONFIG = new GOMLConfig();

public static Identifier id(String name) {
return new Identifier("goml", name);
return Identifier.of("goml", name);
}

@Override
Expand All @@ -68,7 +68,7 @@ public void onInitialize() {

PolymerItemGroupUtils.registerPolymerItemGroup(id("group"), GROUP);

CommonProtection.register(new Identifier("goml", "claim_protection"), GomlProtectionProvider.INSTANCE);
CommonProtection.register(Identifier.of("goml", "claim_protection"), GomlProtectionProvider.INSTANCE);

ServerLifecycleEvents.SERVER_STARTING.register((s) -> {
CardboardWarning.checkAndAnnounce();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/draylar/goml/api/Claim.java
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ public static Claim fromNbt(MinecraftServer server, NbtCompound nbt, int version
}

public Identifier getWorld() {
return this.world != null ? this.world : new Identifier("undefined");
return this.world != null ? this.world : Identifier.of("undefined");
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Items;
import net.minecraft.network.packet.s2c.play.EntityVelocityUpdateS2CPacket;
import net.minecraft.network.packet.s2c.play.PositionFlag;
import net.minecraft.particle.BlockStateParticleEffect;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.screen.ScreenHandlerType;
Expand Down Expand Up @@ -91,12 +92,12 @@ public void onPlayerEnter(Claim claim, PlayerEntity player) {
y = player.getWorld().getTopY(Heightmap.Type.MOTION_BLOCKING, (int) pos.x, (int) pos.z);
}

player.teleport(pos.x, y, pos.z);
player.teleport(pos.x, y, pos.z, true);

player.setVelocity(Vec3d.of(dir.getVector()).multiply(0.2));

if (player.hasVehicle()) {
player.getVehicle().teleport(pos.x, y, pos.z);
player.getVehicle().teleport((ServerWorld) player.getVehicle().getWorld(), pos.x, y, pos.z, PositionFlag.VALUES, player.getVehicle().getYaw(), player.getVehicle().getPitch());
player.getVehicle().setVelocity(Vec3d.of(dir.getVector()).multiply(0.2));
}

Expand Down
5 changes: 3 additions & 2 deletions src/main/java/draylar/goml/cca/WorldClaimComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.fabricmc.fabric.api.util.NbtType;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtList;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -36,7 +37,7 @@ public void remove(Claim info) {
}

@Override
public void readFromNbt(NbtCompound tag) {
public void readFromNbt(NbtCompound tag, RegistryWrapper.WrapperLookup lookup) {
this.claims = RTreeMap.create(new ConfigurationBuilder().star().build(), ClaimBox::rtree3iBox);
var world = this.world.getRegistryKey().getValue();

Expand Down Expand Up @@ -72,7 +73,7 @@ public void readFromNbt(NbtCompound tag) {
}

@Override
public void writeToNbt(NbtCompound tag) {
public void writeToNbt(NbtCompound tag, RegistryWrapper.WrapperLookup lookup) {
NbtList nbtListClaims = new NbtList();
tag.putInt("Version", 1);

Expand Down
1 change: 0 additions & 1 deletion src/main/java/draylar/goml/config/BaseGson.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public class BaseGson {

.registerTypeHierarchyAdapter(Item.class, new RegistrySerializer<>(Registries.ITEM))
.registerTypeHierarchyAdapter(Block.class, new RegistrySerializer<>(Registries.BLOCK))
.registerTypeHierarchyAdapter(Enchantment.class, new RegistrySerializer<>(Registries.ENCHANTMENT))
.registerTypeHierarchyAdapter(SoundEvent.class, new RegistrySerializer<>(Registries.SOUND_EVENT))
.registerTypeHierarchyAdapter(StatusEffect.class, new RegistrySerializer<>(Registries.STATUS_EFFECT))
.registerTypeHierarchyAdapter(EntityType.class, new RegistrySerializer<>(Registries.ENTITY_TYPE))
Expand Down
12 changes: 5 additions & 7 deletions src/main/java/draylar/goml/item/GogglesItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import draylar.goml.api.WorldParticleUtils;
import eu.pb4.polymer.core.api.item.PolymerItem;
import net.minecraft.block.BlockState;
import net.minecraft.client.item.TooltipType;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.item.*;
import net.minecraft.item.tooltip.TooltipType;
import net.minecraft.particle.BlockStateParticleEffect;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.registry.Registries;
Expand Down Expand Up @@ -57,14 +57,12 @@ public void inventoryTick(ItemStack stack, World world, Entity entity, int slot,
}

@Override
public Item getPolymerItem(ItemStack itemStack, @Nullable ServerPlayerEntity player) {
return Items.IRON_HELMET;
public boolean hasGlint(ItemStack stack) {
return true;
}

@Override
public ItemStack getPolymerItemStack(ItemStack itemStack, TooltipType context, @Nullable ServerPlayerEntity player) {
var clientStack = PolymerItem.super.getPolymerItemStack(itemStack, context, player);
clientStack.addEnchantment(Enchantments.LURE, 64);
return clientStack;
public Item getPolymerItem(ItemStack itemStack, @Nullable ServerPlayerEntity player) {
return Items.IRON_HELMET;
}
}
2 changes: 1 addition & 1 deletion src/main/java/draylar/goml/item/ToggleableBlockItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import eu.pb4.polymer.core.api.block.PolymerHeadBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.client.item.TooltipType;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
import net.minecraft.item.tooltip.TooltipType;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.world.World;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/draylar/goml/item/TooltippedBlockItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import eu.pb4.polymer.core.api.block.PolymerHeadBlock;
import eu.pb4.polymer.core.api.item.PolymerHeadBlockItem;
import net.minecraft.block.Block;
import net.minecraft.client.item.TooltipType;
import net.minecraft.item.ItemStack;
import net.minecraft.item.tooltip.TooltipType;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.world.World;
Expand Down
13 changes: 6 additions & 7 deletions src/main/java/draylar/goml/item/UpgradeKitItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
import eu.pb4.polymer.core.api.item.PolymerItem;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.item.TooltipType;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsageContext;
import net.minecraft.item.tooltip.TooltipType;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.text.Text;
Expand Down Expand Up @@ -149,14 +150,12 @@ public void appendTooltip(ItemStack stack, TooltipContext context, List<Text> to
}

@Override
public Item getPolymerItem(ItemStack itemStack, @Nullable ServerPlayerEntity player) {
return this.clientItem;
public boolean hasGlint(ItemStack stack) {
return true;
}

@Override
public ItemStack getPolymerItemStack(ItemStack itemStack, TooltipType context, @Nullable ServerPlayerEntity player) {
var clientStack = PolymerItem.super.getPolymerItemStack(itemStack, context, player);
clientStack.addEnchantment(Enchantments.LURE, 68);
return clientStack;
public Item getPolymerItem(ItemStack itemStack, @Nullable ServerPlayerEntity player) {
return this.clientItem;
}
}
5 changes: 3 additions & 2 deletions src/main/java/draylar/goml/mixin/ShapedRecipeMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import net.minecraft.inventory.RecipeInputInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.recipe.ShapedRecipe;
import net.minecraft.recipe.input.CraftingRecipeInput;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -17,8 +18,8 @@
public class ShapedRecipeMixin {
@Shadow @Final private ItemStack result;

@Inject(method = "matches(Lnet/minecraft/inventory/RecipeInputInventory;Lnet/minecraft/world/World;)Z", at = @At("HEAD"), cancellable = true)
private void goml_cancelIfDisabled(RecipeInputInventory recipeInputInventory, World world, CallbackInfoReturnable<Boolean> cir) {
@Inject(method = "matches(Lnet/minecraft/recipe/input/CraftingRecipeInput;Lnet/minecraft/world/World;)Z", at = @At("HEAD"), cancellable = true)
private void goml_cancelIfDisabled(CraftingRecipeInput craftingRecipeInput, World world, CallbackInfoReturnable<Boolean> cir) {
if (this.result.getItem() instanceof ToggleableBlockItem item && !item.isEnabled()) {
cir.setReturnValue(false);
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/draylar/goml/other/ClaimCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import net.minecraft.command.argument.GameProfileArgumentType;
import net.minecraft.nbt.NbtHelper;
import net.minecraft.network.packet.s2c.play.EntityVelocityUpdateS2CPacket;
import net.minecraft.network.packet.s2c.play.PositionFlag;
import net.minecraft.particle.BlockStateParticleEffect;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.server.MinecraftServer;
Expand Down Expand Up @@ -183,12 +184,12 @@ private static int escape(CommandContext<ServerCommandSource> context, ServerPla
y = player.getWorld().getTopY(Heightmap.Type.MOTION_BLOCKING, (int) pos.x, (int) pos.z);
}

player.teleport(pos.x, y, pos.z);
player.teleport(pos.x, y, pos.z, true);

player.setVelocity(Vec3d.of(dir.getVector()).multiply(0.2));

if (player.hasVehicle()) {
player.getVehicle().teleport(pos.x, y, pos.z);
player.getVehicle().teleport((ServerWorld) player.getVehicle().getWorld(), pos.x, y, pos.z, PositionFlag.VALUES, player.getVehicle().getYaw(), player.getVehicle().getPitch());
player.getVehicle().setVelocity(Vec3d.of(dir.getVector()).multiply(0.2));
}

Expand Down
10 changes: 5 additions & 5 deletions src/main/java/draylar/goml/other/PlaceholdersReg.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@ApiStatus.Internal
public class PlaceholdersReg {
public static void init() {
Placeholders.register(new Identifier("goml", "claim_owners"), (ctx, arg) -> {
Placeholders.register(Identifier.of("goml", "claim_owners"), (ctx, arg) -> {
if (!ctx.hasPlayer()) {
return PlaceholderResult.invalid("No player!");
}
Expand Down Expand Up @@ -47,7 +47,7 @@ public static void init() {
}
});

Placeholders.register(new Identifier("goml", "claim_owners"), (ctx, arg) -> {
Placeholders.register(Identifier.of("goml", "claim_owners"), (ctx, arg) -> {
if (!ctx.hasPlayer()) {
return PlaceholderResult.invalid("No player!");
}
Expand Down Expand Up @@ -78,7 +78,7 @@ public static void init() {
}
});

Placeholders.register(new Identifier("goml", "claim_trusted"), (ctx, arg) -> {
Placeholders.register(Identifier.of("goml", "claim_trusted"), (ctx, arg) -> {
if (!ctx.hasPlayer()) {
return PlaceholderResult.invalid("No player!");
}
Expand Down Expand Up @@ -110,7 +110,7 @@ public static void init() {
}
});

Placeholders.register(new Identifier("goml", "claim_trusted_uuid"), (ctx, arg) -> {
Placeholders.register(Identifier.of("goml", "claim_trusted_uuid"), (ctx, arg) -> {
if (!ctx.hasPlayer()) {
return PlaceholderResult.invalid("No player!");
}
Expand Down Expand Up @@ -142,7 +142,7 @@ public static void init() {
}
});

Placeholders.register(new Identifier("goml", "claim_info"), (ctx, arg) -> {
Placeholders.register(Identifier.of("goml", "claim_info"), (ctx, arg) -> {
if (!ctx.hasPlayer()) {
return PlaceholderResult.invalid("No player!");
}
Expand Down

0 comments on commit 48b884b

Please sign in to comment.