Skip to content

Commit

Permalink
Update to 1.21.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Patbox committed Oct 22, 2024
1 parent 66660c7 commit 99d89e7
Show file tree
Hide file tree
Showing 34 changed files with 220 additions and 199 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ jobs:
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: build
run: ./gradlew downloadTranslations build
run: ./gradlew build
- name: capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '21' }} # Only upload artifacts built from latest java on one OS
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Artifacts
path: build/libs/
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ jobs:
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew downloadTranslations build
run: ./gradlew build
env:
MODRINTH: ${{ secrets.MODRINTH }}
CURSEFORGE: ${{ secrets.CURSEFORGE }}
CHANGELOG: ${{ github.event.release.body }}

- name: Upload GitHub release
uses: AButler/upload-release-assets@v2.0
uses: AButler/upload-release-assets@v3.0
with:
files: 'build/libs/*.jar;!build/libs/*-sources.jar;!build/libs/*-dev.jar'
repo-token: ${{ secrets.GITHUB_TOKEN }}
39 changes: 10 additions & 29 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
buildscript {
dependencies {
classpath "de.guntram.mcmod:crowdin-translate:1.4+1.19.3"
}
repositories {
maven {
name = 'CrowdinTranslate source'
url = "https://minecraft.guntram.de/maven/"
}
}
}


plugins {
id 'fabric-loom' version '1.6.+'
id 'fabric-loom' version '1.7.+'
id 'maven-publish'
id "com.modrinth.minotaur" version "2.+"
id 'com.matthewprenger.cursegradle' version '1.4.0'
Expand All @@ -26,13 +13,6 @@ version = project.mod_version
group = project.maven_group


apply plugin: 'de.guntram.mcmod.crowdin-translate'
crowdintranslate.crowdinProjectName = 'patbox-mods'
crowdintranslate.jsonSourceName = 'universal_graves'
crowdintranslate.minecraftProjectName = '../data/universal_graves'
crowdintranslate.verbose = false


repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
Expand Down Expand Up @@ -83,16 +63,17 @@ dependencies {
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"


modImplementation include("eu.pb4:sgui:1.6.0+1.21")
modImplementation include("eu.pb4:placeholder-api:2.4.1+1.21")
modImplementation include('xyz.nucleoid:server-translations-api:2.3.1+1.21-pre2')
modImplementation include('eu.pb4:polymer-core:0.9.14+1.21.1')
modImplementation include('eu.pb4:polymer-resource-pack:0.9.14+1.21.1')
modImplementation include('eu.pb4:polymer-virtual-entity:0.9.14+1.21.1')
modImplementation include('eu.pb4:predicate-api:0.5.1+1.21')
modImplementation include("eu.pb4:sgui:1.7.1+1.21.2")
modImplementation include("eu.pb4:placeholder-api:2.5.0+1.21.2")
modImplementation include('xyz.nucleoid:server-translations-api:2.4.0+1.21.2-rc1')
modImplementation include('eu.pb4:polymer-core:0.10.0+1.21.2')
modImplementation include('eu.pb4:polymer-resource-pack:0.10.0+1.21.2')
modImplementation include('eu.pb4:polymer-virtual-entity:0.10.0+1.21.2')
modImplementation include('eu.pb4:predicate-api:0.6.0+1.21.2')
modImplementation include("eu.pb4:common-protection-api:1.0.0")

modImplementation include("me.lucko:fabric-permissions-api:0.2-SNAPSHOT")
//modImplementation include("me.lucko:fabric-permissions-api:0.2-SNAPSHOT")
modImplementation include("com.github.sakura-ryoko:fabric-permissions-api:dev~snapshot-jitpack-SNAPSHOT")

modCompileOnly "dev.emi:trinkets:3.10.0"
modCompileOnly "maven.modrinth:inventorio:1.10.3+1.20.2"
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.21
yarn_mappings=1.21+build.1
loader_version=0.15.11
minecraft_version=1.21.2
yarn_mappings=1.21.2+build.1
loader_version=0.16.7

fabric_version=0.100.1+1.21
fabric_version=0.106.0+1.21.2


# Mod Properties
mod_version = 3.4.4+1.21
mod_version = 3.5.0+1.21.2
maven_group = eu.pb4
archives_base_name = graves

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
23 changes: 4 additions & 19 deletions src/main/java/eu/pb4/graves/GravesMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerWorldEvents;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.ModContainer;
import net.minecraft.block.entity.BlockEntityType;
Expand Down Expand Up @@ -45,28 +46,12 @@ public void onInitialize() {
FabricLoader loader = FabricLoader.getInstance();
GenericModInfo.build(CONTAINER);

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);
PolymerComponent.registerDataComponent(GraveCompassComponent.TYPE, IconItem.TEXTURE);
PolymerEntityUtils.registerType(SafeXPEntity.TYPE);
GraveBlockEntity.BLOCK_ENTITY_TYPE = Registry.register(Registries.BLOCK_ENTITY_TYPE, "universal_graves:grave", BlockEntityType.Builder.create(GraveBlockEntity::new, GraveBlock.INSTANCE).build());
VisualGraveBlockEntity.BLOCK_ENTITY_TYPE = Registry.register(Registries.BLOCK_ENTITY_TYPE, "universal_graves:visual_grave", BlockEntityType.Builder.create(VisualGraveBlockEntity::new, VisualGraveBlock.INSTANCE).build());
ContainerGraveBlockEntity.BLOCK_ENTITY_TYPE = Registry.register(Registries.BLOCK_ENTITY_TYPE, "universal_graves:container_grave", BlockEntityType.Builder.create(ContainerGraveBlockEntity::new, ContainerGraveBlock.INSTANCE).build());

GravesRegistry.register();
Commands.register();
PolymerBlockUtils.registerBlockEntity(GraveBlockEntity.BLOCK_ENTITY_TYPE, VisualGraveBlockEntity.BLOCK_ENTITY_TYPE, ContainerGraveBlockEntity.BLOCK_ENTITY_TYPE);

ItemGroupEvents.modifyEntriesEvent(ItemGroups.FUNCTIONAL).register((e) -> {
if (!Thread.currentThread().getName().contains("client")) {
e.add(CointainerGraveBlockItem.INSTANCE);
}
e.add(GravesRegistry.CONTAINER_GRAVE_ITEM);
});

GraveTextures.initialize();
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/eu/pb4/graves/grave/Grave.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import eu.pb4.graves.other.*;
import eu.pb4.graves.registry.GraveBlock;
import eu.pb4.graves.registry.GraveBlockEntity;
import eu.pb4.graves.registry.GravesRegistry;
import eu.pb4.graves.ui.GraveGui;
import me.lucko.fabric.api.permissions.v0.Permissions;
import net.minecraft.entity.player.PlayerEntity;
Expand Down Expand Up @@ -307,11 +308,11 @@ public boolean canTakeFrom(GameProfile profile) {
}

public boolean canTakeFrom(PlayerEntity entity) {
return this.canTakeFrom(entity.getGameProfile()) || (entity.isCreative() && Permissions.check(entity, "graves.can_open_others", 3));
return this.canTakeFrom(entity.getGameProfile()) || (entity.isCreative() && Permissions.check(entity.getCommandSource((ServerWorld) entity.getWorld()), "graves.can_open_others", 3));
}

public boolean hasAccess(PlayerEntity entity) {
return hasAccess(entity.getGameProfile()) || (entity.isCreative() && Permissions.check(entity, "graves.can_open_others", 3));
return hasAccess(entity.getGameProfile()) || (entity.isCreative() && Permissions.check(entity.getCommandSource((ServerWorld) entity.getWorld()), "graves.can_open_others", 3));
}

public boolean hasAccess(GameProfile profile) {
Expand Down Expand Up @@ -380,7 +381,7 @@ public boolean moveTo(MinecraftServer server, Location location) {
var state = world.getBlockState(location.blockPos());

if (GraveUtils.canReplaceState(state, ConfigManager.getConfig().placement.replaceAnyBlock)
&& world.getWorldBorder().contains(location.blockPos()) && location.y() >= world.getBottomY() && location.y() < world.getTopY()) {
&& world.getWorldBorder().contains(location.blockPos()) && location.y() >= world.getBottomY() && location.y() <= world.getTopYInclusive()) {

var old = this.location;
this.setLocation(location);
Expand All @@ -398,7 +399,7 @@ public boolean moveTo(MinecraftServer server, Location location) {
}
}

world.setBlockState(location.blockPos(), GraveBlock.INSTANCE.getDefaultState());
world.setBlockState(location.blockPos(), GravesRegistry.GRAVE_BLOCK.getDefaultState());

if (world.getBlockEntity(location.blockPos()) instanceof GraveBlockEntity entity) {
entity.setGrave(this, state);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/eu/pb4/graves/grave/PositionedItemStack.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public record PositionedItemStack(ItemStack stack, int slot, @Nullable GraveInve

public NbtCompound toNbt(RegistryWrapper.WrapperLookup lookup) {
var nbt = new NbtCompound();
nbt.put(ITEM_TAG, stack.encodeAllowEmpty(lookup));
nbt.put(ITEM_TAG, stack.toNbtAllowEmpty(lookup));
nbt.putString(MASK_TAG, GravesApi.getInventoryMaskId(inventoryMask).toString());
nbt.putInt(SLOT_TAG, slot);
if (optionalData != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import eu.pb4.graves.registry.GraveBlock;
import eu.pb4.graves.registry.GravesRegistry;
import net.minecraft.block.BlockState;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Pseudo;
Expand All @@ -12,6 +13,6 @@
public class CreateBlockBreakingKineticBlockEntity {
@ModifyReturnValue(method = "isBreakable(Lnet/minecraft/block/BlockState;F)Z", at = @At("RETURN"), require = 0)
private static boolean graves$makeUnbreakable(boolean original, BlockState state, float f) {
return original && !state.isOf(GraveBlock.INSTANCE);
return original && !state.isOf(GravesRegistry.GRAVE_BLOCK);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import eu.pb4.graves.registry.GraveBlock;
import eu.pb4.graves.registry.GravesRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.world.gen.feature.EndPlatformFeature;
Expand All @@ -14,6 +15,6 @@
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);
return original.call(instance, block) || instance.isOf(GravesRegistry.GRAVE_BLOCK);
}
}
2 changes: 1 addition & 1 deletion src/main/java/eu/pb4/graves/mixin/LivingEntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@Mixin(LivingEntity.class)
public abstract class LivingEntityMixin {

@Inject(method = "drop", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;dropInventory()V", shift = At.Shift.BEFORE))
@Inject(method = "drop", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;dropInventory(Lnet/minecraft/server/world/ServerWorld;)V", shift = At.Shift.BEFORE))
private void replaceWithGrave(ServerWorld world, DamageSource damageSource, CallbackInfo ci) {
if (((Object) this) instanceof ServerPlayerEntity player) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtElement;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.text.Text;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
Expand Down Expand Up @@ -75,7 +76,7 @@ public ServerPlayerEntityMixin(World world, BlockPos pos, float yaw, GameProfile
}

@Inject(method = "isInvulnerableTo", at = @At("HEAD"), cancellable = true)
private void graves$isInvulnerableTo(DamageSource damageSource, CallbackInfoReturnable<Boolean> cir) {
private void graves$isInvulnerableTo(ServerWorld world, DamageSource source, CallbackInfoReturnable<Boolean> cir) {
if (this.graves$isInvulnerable) {
cir.setReturnValue(true);
}
Expand Down

This file was deleted.

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

@Mixin(value = ServerWorld.class, priority = 1005)
public abstract class ServerWorldMixin extends World {
protected ServerWorldMixin(MutableWorldProperties properties, RegistryKey<World> registryRef, DynamicRegistryManager registryManager, RegistryEntry<DimensionType> dimensionEntry, Supplier<Profiler> profiler, boolean isClient, boolean debugWorld, long biomeAccess, int maxChainedNeighborUpdates) {
super(properties, registryRef, registryManager, dimensionEntry, profiler, isClient, debugWorld, biomeAccess, maxChainedNeighborUpdates);
protected ServerWorldMixin(MutableWorldProperties properties, RegistryKey<World> registryRef, DynamicRegistryManager registryManager, RegistryEntry<DimensionType> dimensionEntry, boolean isClient, boolean debugWorld, long seed, int maxChainedNeighborUpdates) {
super(properties, registryRef, registryManager, dimensionEntry, isClient, debugWorld, seed, maxChainedNeighborUpdates);
}

@Inject(method = "canPlayerModifyAt", at = @At("HEAD"), cancellable = true)
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/eu/pb4/graves/model/GraveModelHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import eu.pb4.graves.model.parts.TextDisplayModelPart;
import eu.pb4.graves.registry.AbstractGraveBlock;
import eu.pb4.graves.registry.GraveBlock;
import eu.pb4.graves.registry.GravesRegistry;
import eu.pb4.placeholders.api.ParserContext;
import eu.pb4.placeholders.api.node.TextNode;
import eu.pb4.polymer.virtualentity.api.ElementHolder;
Expand Down Expand Up @@ -82,7 +83,7 @@ public void updateModel() {
flags.add(isProtected ? ModelTags.IF_UNPROTECTED : ModelTags.IF_PROTECTED);
flags.add(this.dataPrivider.isGravePlayerMade() ? ModelTags.IF_NOT_PLAYER_MADE : ModelTags.IF_PLAYER_MADE);
flags.add(this.dataPrivider.isGravePaymentRequired() ? ModelTags.IF_NOT_REQUIRE_PAYMENT : ModelTags.IF_REQUIRE_PAYMENT);
flags.add(this.blockState.isOf(GraveBlock.INSTANCE) ? ModelTags.IF_VISUAL : ModelTags.IF_NOT_VISUAL);
flags.add(this.blockState.isOf(GravesRegistry.GRAVE_BLOCK) ? ModelTags.IF_VISUAL : ModelTags.IF_NOT_VISUAL);


if (!isProtected || GraveManager.INSTANCE.getProtectionTime() <= 0) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/eu/pb4/graves/model/parts/EntityModelPart.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class EntityModelPart extends ModelPart<EntityElement<?>, EntityModelPart

@Override
public EntityElement<?> construct(ServerWorld world) {
var entity = entityType == EntityType.PLAYER ? createPlayer(world) : entityType.create(world);
var entity = entityType == EntityType.PLAYER ? createPlayer(world) : entityType.create(world, SpawnReason.COMMAND);

if (nbtCompound != null) {
entity.readNbt(this.nbtCompound);
Expand Down Expand Up @@ -96,7 +96,7 @@ public IntList getEntityIds() {

@Override
public void startWatching(ServerPlayerEntity player, Consumer<Packet<ClientPlayPacketListener>> packetConsumer) {
var entry = new PlayerListS2CPacket.Entry(this.entity().getUuid(), this.profile, false, -1, GameMode.SURVIVAL, null, null);
var entry = new PlayerListS2CPacket.Entry(this.entity().getUuid(), this.profile, false, -1, GameMode.SURVIVAL, null, 0, null);
{
var packet = PolymerEntityUtils.createMutablePlayerListPacket(EnumSet.of(PlayerListS2CPacket.Action.ADD_PLAYER, PlayerListS2CPacket.Action.UPDATE_GAME_MODE, PlayerListS2CPacket.Action.UPDATE_LISTED));
packet.getEntries().add(entry);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import com.google.gson.annotations.SerializedName;
import eu.pb4.polymer.virtualentity.api.elements.ItemDisplayElement;
import net.minecraft.client.render.model.json.ModelTransformationMode;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ModelTransformationMode;

public class ItemDisplayModelPart extends DisplayModelPart<ItemDisplayElement, ItemDisplayModelPart> {
@SerializedName("display_item")
Expand Down
Loading

0 comments on commit 99d89e7

Please sign in to comment.