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 0584238 commit c383a01
Show file tree
Hide file tree
Showing 29 changed files with 113 additions and 103 deletions.
21 changes: 10 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ repositories {

loom {
accessWidenerPath = file("src/main/resources/universalgraves.accesswidener")

}

dependencies {
Expand All @@ -61,24 +60,24 @@ dependencies {
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"


modImplementation include("eu.pb4:sgui:1.5.0+1.20.5")
modImplementation include("eu.pb4:placeholder-api:2.4.0-pre.1+1.20.5")
modImplementation include('xyz.nucleoid:server-translations-api:2.3.0+1.20.5-rc2')
modImplementation include('eu.pb4:polymer-core:0.8.0-beta.7+1.20.5')
modImplementation include('eu.pb4:polymer-resource-pack:0.8.0-beta.7+1.20.5')
modImplementation include('eu.pb4:polymer-virtual-entity:0.8.0-beta.7+1.20.5')
modImplementation include('eu.pb4:predicate-api:0.4.0+1.20.5')
modImplementation include("eu.pb4:sgui:1.6.0+1.21")
modImplementation include("eu.pb4:placeholder-api:2.4.0-pre.2+1.21")
modImplementation include('xyz.nucleoid:server-translations-api:2.3.1+1.21-pre2')
modImplementation include('eu.pb4:polymer-core:0.9.0+1.21-rc1')
modImplementation include('eu.pb4:polymer-resource-pack:0.9.0+1.21-rc1')
modImplementation include('eu.pb4:polymer-virtual-entity:0.9.0+1.21-rc1')
modImplementation include('eu.pb4:predicate-api:0.5.1+1.21')
modImplementation include("eu.pb4:common-protection-api:1.0.0")

modImplementation include("me.lucko:fabric-permissions-api:0.2-SNAPSHOT")

modCompileOnly "dev.emi:trinkets:3.7.1"
modCompileOnly "dev.emi:trinkets:3.9.0"
//modCompileOnly "modrinth.maven:trinkets:3.0.4"
modCompileOnly files("modsWithCompat/inventorio-1.17-fabric-1.6.2.jar")

modCompileOnly "draylar:get-off-my-lawn:1.17-1.4.0-beta"
modCompileOnly 'com.jamieswhiteshirt:rtree-3i-lite:0.3.0'
modCompileOnly "io.github.onyxstudios.Cardinal-Components-API:cardinal-components-base:3.0.0-nightly.21w19a"
modCompileOnly "org.ladysnake.cardinal-components-api:cardinal-components-base:6.1.0"

modCompileOnly("com.terraformersmc:modmenu:7.2.2")

Expand All @@ -102,7 +101,7 @@ tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"

// Minecraft 1.17 (21w19a) upwards uses Java 16.
it.options.release = 17
it.options.release = 21
}

java {
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.20.5
yarn_mappings=1.20.5+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_version=0.95.6+1.20.5
fabric_version=0.100.1+1.21


# Mod Properties
mod_version = 3.3.2+1.20.5
mod_version = 3.4.0+1.21
maven_group = eu.pb4
archives_base_name = graves

Expand Down
1 change: 0 additions & 1 deletion models/generic_model.bbmodel

This file was deleted.

4 changes: 2 additions & 2 deletions src/main/java/eu/pb4/graves/GraveTextures.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@


public final class GraveTextures {
private static final Identifier IDENTIFIER = new Identifier("universal_graves", "has_rp");
private static final Supplier<Text> DEV_TEXTURE = () -> Text.literal("-1.").setStyle(Style.EMPTY.withColor(Formatting.WHITE).withFont(new Identifier("universal_graves", "gui")));
private static final Identifier IDENTIFIER = Identifier.of("universal_graves", "has_rp");
private static final Supplier<Text> DEV_TEXTURE = () -> Text.literal("-1.").setStyle(Style.EMPTY.withColor(Formatting.WHITE).withFont(Identifier.of("universal_graves", "gui")));
private static final Supplier<Text> TEXTURE = GravesMod.DEV ? DEV_TEXTURE : Suppliers.memoize(DEV_TEXTURE::get);

public static Text get(ServerPlayerEntity player, Text text) {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/eu/pb4/graves/GravesApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import eu.pb4.graves.other.Location;
import eu.pb4.graves.other.VanillaInventoryMask;
import net.fabricmc.fabric.api.event.Event;
import net.minecraft.component.EnchantmentEffectComponentTypes;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.server.network.ServerPlayerEntity;
Expand Down Expand Up @@ -47,7 +48,7 @@ public static boolean canAddItem(ServerPlayerEntity player, ItemStack itemStack)
return !itemStack.isEmpty()
&& PlayerGraveItemAddedEvent.EVENT.invoker().canAddItem(player, itemStack) != ActionResult.FAIL
&& !GraveUtils.hasSkippedEnchantment(itemStack)
&& !EnchantmentHelper.hasVanishingCurse(itemStack);
&& !EnchantmentHelper.hasAnyEnchantmentsWith(itemStack, EnchantmentEffectComponentTypes.PREVENT_EQUIPMENT_DROP);
}

@Nullable
Expand Down
24 changes: 12 additions & 12 deletions src/main/java/eu/pb4/graves/GravesMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ public void onInitialize() {
FabricLoader loader = FabricLoader.getInstance();
GenericModInfo.build(CONTAINER);

Registry.register(Registries.ITEM, new Identifier("universal_graves", "grave_compass"), GraveCompassItem.INSTANCE);
Registry.register(Registries.ITEM, new Identifier("universal_graves", "visual_grave"), CointainerGraveBlockItem.INSTANCE);
Registry.register(Registries.ITEM, new Identifier("universal_graves", "icon"), IconItem.INSTANCE);
Registry.register(Registries.BLOCK, new Identifier("universal_graves", "grave"), GraveBlock.INSTANCE);
Registry.register(Registries.BLOCK, new Identifier("universal_graves", "visual_grave"), VisualGraveBlock.INSTANCE);
Registry.register(Registries.BLOCK, new Identifier("universal_graves", "container_grave"), ContainerGraveBlock.INSTANCE);
Registry.register(Registries.BLOCK, new Identifier("universal_graves", "temp_block"), TempBlock.INSTANCE);
Registry.register(Registries.ENTITY_TYPE, new Identifier("universal_graves", "xp"), SafeXPEntity.TYPE);
Registry.register(Registries.DATA_COMPONENT_TYPE, new Identifier("universal_graves", "compass"), GraveCompassComponent.TYPE);
Registry.register(Registries.DATA_COMPONENT_TYPE, new Identifier("universal_graves", "texture"), IconItem.TEXTURE);
Registry.register(Registries.ITEM, Identifier.of("universal_graves", "grave_compass"), GraveCompassItem.INSTANCE);
Registry.register(Registries.ITEM, Identifier.of("universal_graves", "visual_grave"), CointainerGraveBlockItem.INSTANCE);
Registry.register(Registries.ITEM, Identifier.of("universal_graves", "icon"), IconItem.INSTANCE);
Registry.register(Registries.BLOCK, Identifier.of("universal_graves", "grave"), GraveBlock.INSTANCE);
Registry.register(Registries.BLOCK, Identifier.of("universal_graves", "visual_grave"), VisualGraveBlock.INSTANCE);
Registry.register(Registries.BLOCK, Identifier.of("universal_graves", "container_grave"), ContainerGraveBlock.INSTANCE);
Registry.register(Registries.BLOCK, Identifier.of("universal_graves", "temp_block"), TempBlock.INSTANCE);
Registry.register(Registries.ENTITY_TYPE, Identifier.of("universal_graves", "xp"), SafeXPEntity.TYPE);
Registry.register(Registries.DATA_COMPONENT_TYPE, Identifier.of("universal_graves", "compass"), GraveCompassComponent.TYPE);
Registry.register(Registries.DATA_COMPONENT_TYPE, Identifier.of("universal_graves", "texture"), IconItem.TEXTURE);
PolymerItemUtils.markAsPolymer(GraveCompassComponent.TYPE, IconItem.TEXTURE);
PolymerEntityUtils.registerType(SafeXPEntity.TYPE);
GraveBlockEntity.BLOCK_ENTITY_TYPE = Registry.register(Registries.BLOCK_ENTITY_TYPE, "universal_graves:grave", FabricBlockEntityTypeBuilder.create(GraveBlockEntity::new, GraveBlock.INSTANCE).build(null));
Expand All @@ -81,9 +81,9 @@ public void onInitialize() {
PolymerResourcePackUtils.addModAssets("universal-graves");
}

CommonProtection.register(new Identifier("universal_graves", "graves"), GraveProtectionProvider.INSTANCE);
CommonProtection.register(Identifier.of("universal_graves", "graves"), GraveProtectionProvider.INSTANCE);

GravesApi.registerInventoryMask(new Identifier("vanilla"), VanillaInventoryMask.INSTANCE);
GravesApi.registerInventoryMask(Identifier.of("vanilla"), VanillaInventoryMask.INSTANCE);

if (loader.isModLoaded("goml")) {
GomlCompat.register();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/eu/pb4/graves/compat/InventorioCompat.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class InventorioCompat implements GraveInventoryMask {
public static final GraveInventoryMask INSTANCE = new InventorioCompat();

public static void register() {
GravesApi.registerInventoryMask(new Identifier("universal_graves", "inventorio"), INSTANCE);
GravesApi.registerInventoryMask(Identifier.of("universal_graves", "inventorio"), INSTANCE);
}

@Override
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/eu/pb4/graves/compat/TrinketsCompat.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import eu.pb4.graves.GravesApi;
import eu.pb4.graves.grave.GraveInventoryMask;
import eu.pb4.graves.other.VanillaInventoryMask;
import net.minecraft.component.EnchantmentEffectComponentTypes;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
Expand All @@ -20,7 +21,7 @@ public class TrinketsCompat extends VanillaInventoryMask {
private static final String SLOT_TAG = "Slot";

public static void register() {
GravesApi.registerInventoryMask(new Identifier("universal_graves", "trinkets"), INSTANCE);
GravesApi.registerInventoryMask(Identifier.of("universal_graves", "trinkets"), INSTANCE);
}

@Override
Expand All @@ -41,7 +42,7 @@ public void addToGrave(ServerPlayerEntity player, ItemConsumer consumer) {
}

if (dropRule == TrinketEnums.DropRule.DEFAULT) {
if (EnchantmentHelper.hasVanishingCurse(stack)) {
if (EnchantmentHelper.hasAnyEnchantmentsWith(stack, EnchantmentEffectComponentTypes.PREVENT_EQUIPMENT_DROP)) {
dropRule = TrinketEnums.DropRule.DESTROY;
} else {
dropRule = TrinketEnums.DropRule.DROP;
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/eu/pb4/graves/config/BaseGson.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public static Gson getGson(RegistryWrapper.WrapperLookup lookup) {

.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 All @@ -66,7 +65,7 @@ public static Gson getGson(RegistryWrapper.WrapperLookup lookup) {
.registerTypeHierarchyAdapter(ComponentMap.class, new CodecSerializer<>(ComponentMap.CODEC, lookup))
.registerTypeHierarchyAdapter(NbtCompound.class, new CodecSerializer<>(NbtCompound.CODEC, lookup))
.registerTypeHierarchyAdapter(BlockPos.class, new CodecSerializer<>(BlockPos.CODEC, lookup))
.registerTypeHierarchyAdapter(MinecraftPredicate.class, GsonPredicateSerializer.INSTANCE)
.registerTypeHierarchyAdapter(MinecraftPredicate.class, GsonPredicateSerializer.create(lookup))
.registerTypeHierarchyAdapter(Vec3d.class, new CodecSerializer<>(Vec3d.CODEC, lookup))
.registerTypeHierarchyAdapter(Vec2f.class, new CodecSerializer<>(Codec.list(Codec.DOUBLE).xmap(x -> new Vec2f(x.get(0).floatValue(), x.get(1).floatValue()), x -> List.of((double) x.x, (double) x.y)), lookup))
.registerTypeHierarchyAdapter(EntityDimensions.class, new CodecSerializer<>(Codec.list(Codec.DOUBLE).xmap(x -> EntityDimensions.fixed(x.get(0).floatValue(), x.get(1).floatValue()), x -> List.of((double) x.width(), (double) x.height())), lookup))
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/eu/pb4/graves/mixin/EndPlatformFeatureMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package eu.pb4.graves.mixin;

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import eu.pb4.graves.registry.GraveBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.world.gen.feature.EndPlatformFeature;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

@Mixin(EndPlatformFeature.class)
public class EndPlatformFeatureMixin {
@WrapOperation(method = "generate(Lnet/minecraft/world/ServerWorldAccess;Lnet/minecraft/util/math/BlockPos;Z)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;isOf(Lnet/minecraft/block/Block;)Z"))
private static boolean grave_dontBreak(BlockState instance, Block block, Operation<Boolean> original) {
return original.call(instance, block) || instance.isOf(GraveBlock.INSTANCE);
}
}
5 changes: 3 additions & 2 deletions src/main/java/eu/pb4/graves/mixin/LivingEntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -14,10 +15,10 @@
public abstract class LivingEntityMixin {

@Inject(method = "drop", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;dropInventory()V", shift = At.Shift.BEFORE), cancellable = true)
private void replaceWithGrave(DamageSource source, CallbackInfo ci) {
private void replaceWithGrave(ServerWorld world, DamageSource damageSource, CallbackInfo ci) {
if (((Object) this) instanceof ServerPlayerEntity player) {
try {
GraveUtils.createGrave(player, source);
GraveUtils.createGrave(player, world, damageSource);
} catch (Exception e) {
e.printStackTrace();
}
Expand Down
Loading

0 comments on commit c383a01

Please sign in to comment.