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 7f6e87f commit 650b558
Show file tree
Hide file tree
Showing 55 changed files with 212 additions and 342 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ jobs:
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: build
run: ./gradlew downloadTranslations build
run: ./gradlew build
- name: capture build artifacts
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,7 +30,7 @@ jobs:
run: chmod +x gradlew

- name: Build and publish with Gradle
run: ./gradlew downloadTranslations build publish
run: ./gradlew build publish
env:
MAVEN_URL: ${{ secrets.MAVEN_URL }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
Expand All @@ -39,7 +39,7 @@ jobs:
MODRINTH: ${{ secrets.MODRINTH }}
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 }}
21 changes: 3 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
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 @@ -24,11 +13,6 @@ archivesBaseName = project.archives_base_name
version = project.mod_version + "+" + project.minecraft_version
group = project.maven_group

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

loom {
accessWidenerPath = file("src/main/resources/goml.accesswidener")
Expand Down Expand Up @@ -103,7 +87,8 @@ dependencies {
modImplementation include("eu.pb4:sgui:${project.sgui_version}")
modImplementation include("eu.pb4:placeholder-api:${project.placeholder_version}")
modImplementation include("xyz.nucleoid:server-translations-api:${project.stapi_version}")
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")
modImplementation include("eu.pb4:common-protection-api:1.0.0")

compileOnly "us.dynmap:DynmapCoreAPI:${dynmap_version}"
Expand Down
20 changes: 10 additions & 10 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.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 api
fabric_version=0.100.1+1.21
fabric_version=0.106.0+1.21.2

# Mod Properties
mod_version = 1.13.1
mod_version = 1.14.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.1.0
cca_version=6.1.1
pal_version=1.10.0
polymer_version=0.9.6+1.21
sgui_version=1.6.0+1.21
stapi_version=2.3.1+1.21-pre2
placeholder_version=2.4.1+1.21
polymer_version=0.10.0+1.21.2
sgui_version=1.7.2+1.21.2
stapi_version=2.4.0+1.21.2-rc1
placeholder_version=2.5.0+1.21.2
common-protection-api_version=1.0.0

# compat
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
4 changes: 2 additions & 2 deletions src/main/java/draylar/goml/EventHandlers.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ private static void registerInteractEntityCallback() {
if (claims.isEmpty()) {
return GetOffMyLawn.CONFIG.enablePvPinClaims ? ActionResult.PASS : ActionResult.FAIL;
} else {
var obj = new MutableObject<>(ActionResult.PASS);
var obj = new MutableObject<ActionResult>(ActionResult.PASS);
claims.forEach((e) -> {
if (obj.getValue() == ActionResult.FAIL) {
if (obj.getValue() instanceof ActionResult.Fail) {
return;
}
var claim = e.getValue();
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/draylar/goml/block/ClaimAnchorBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
import xyz.nucleoid.packettweaker.PacketContext;

import java.util.Collections;
import java.util.function.IntSupplier;
Expand Down Expand Up @@ -151,7 +152,7 @@ public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, Block
}

@Override
public String getPolymerSkinValue(BlockState state, BlockPos pos, ServerPlayerEntity player) {
public String getPolymerSkinValue(BlockState state, BlockPos pos, PacketContext player) {
return this.texture;
}
}
3 changes: 2 additions & 1 deletion src/main/java/draylar/goml/block/ClaimAugmentBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import net.minecraft.world.WorldView;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;
import xyz.nucleoid.packettweaker.PacketContext;

import java.util.function.BooleanSupplier;

Expand Down Expand Up @@ -204,7 +205,7 @@ public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, Block
}

@Override
public String getPolymerSkinValue(BlockState state, BlockPos pos, ServerPlayerEntity player) {
public String getPolymerSkinValue(BlockState state, BlockPos pos, PacketContext player) {
return this.texture;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void onPlayerEnter(Claim claim, PlayerEntity player) {
player.setVelocity(Vec3d.of(dir.getVector()).multiply(0.2));

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

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/draylar/goml/config/GOMLConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class GOMLConfig {

public Set<Block> allowedBlockInteraction = new HashSet<>();

public Set<EntityType<?>> allowedEntityInteraction = Set.of(EntityType.BOAT, EntityType.CHEST_BOAT, EntityType.MINECART);
public Set<EntityType<?>> allowedEntityInteraction = Set.of();

public WrappedText messagePrefix = WrappedText.of("<dark_gray>[<#a1ff59>GOML</color>]");

Expand Down
17 changes: 13 additions & 4 deletions src/main/java/draylar/goml/item/GogglesItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,25 @@
import net.minecraft.entity.Entity;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.item.*;
import net.minecraft.item.equipment.ArmorMaterials;
import net.minecraft.item.equipment.EquipmentType;
import net.minecraft.item.tooltip.TooltipType;
import net.minecraft.particle.BlockStateParticleEffect;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.registry.Registries;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.registry.Registry;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
import xyz.nucleoid.packettweaker.PacketContext;

import java.util.stream.Collectors;

public class GogglesItem extends ArmorItem implements PolymerItem {
public GogglesItem() {
super(ArmorMaterials.IRON, Type.HELMET, new Item.Settings().maxDamage(-1));
public GogglesItem(Settings settings) {
super(ArmorMaterials.IRON, EquipmentType.HELMET, settings.maxDamage(-1));
}

@Override
Expand All @@ -39,7 +43,7 @@ public void inventoryTick(ItemStack stack, World world, Entity entity, int slot,
claim -> {
var box = claim.getKey().toBox();
var minPos = new BlockPos(box.x1(), Math.max(box.y1(), world.getBottomY()), box.z1());
var maxPos = new BlockPos(box.x2() - 1, Math.min(box.y2() - 1, world.getTopY()), box.z2() - 1);
var maxPos = new BlockPos(box.x2() - 1, Math.min(box.y2() - 1, world.getTopYInclusive()), box.z2() - 1);

BlockState state = ClaimUtils.gogglesClaimColor(claim.getValue());

Expand All @@ -58,7 +62,12 @@ public boolean hasGlint(ItemStack stack) {
}

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

@Override
public @Nullable Identifier getPolymerItemModel(ItemStack stack, PacketContext context) {
return null;
}
}
10 changes: 0 additions & 10 deletions src/main/java/draylar/goml/item/TooltippedBlockItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,6 @@ public <T extends Block & PolymerHeadBlock> TooltippedBlockItem(T block, Setting
this.lines = lines;
}

@Override
public Text getName() {
return this.getBlock().getName();
}

@Override
public Text getName(ItemStack stack) {
return this.getName();
}

@Override
public void appendTooltip(ItemStack stack, TooltipContext context, List<Text> tooltip, TooltipType type) {
super.appendTooltip(stack, context, tooltip, type);
Expand Down
13 changes: 10 additions & 3 deletions src/main/java/draylar/goml/item/UpgradeKitItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
import xyz.nucleoid.packettweaker.PacketContext;

import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
Expand All @@ -37,8 +39,8 @@ public class UpgradeKitItem extends Item implements PolymerItem {
private final ClaimAnchorBlock to;
private final Item clientItem;

public UpgradeKitItem(ClaimAnchorBlock from, ClaimAnchorBlock to, Item display) {
super(new Item.Settings());
public UpgradeKitItem(Settings settings, ClaimAnchorBlock from, ClaimAnchorBlock to, Item display) {
super(settings);
this.clientItem = display;

this.from = from;
Expand Down Expand Up @@ -155,7 +157,12 @@ public boolean hasGlint(ItemStack stack) {
}

@Override
public Item getPolymerItem(ItemStack itemStack, @Nullable ServerPlayerEntity player) {
public Item getPolymerItem(ItemStack itemStack, PacketContext context) {
return this.clientItem;
}

@Override
public @Nullable Identifier getPolymerItemModel(ItemStack stack, PacketContext context) {
return null;
}
}
6 changes: 3 additions & 3 deletions src/main/java/draylar/goml/mixin/BucketItemMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.BlockPos;
Expand All @@ -40,7 +40,7 @@ public BucketItemMixin(Settings settings) {
}

@Inject(at = @At("HEAD"), method = "use", cancellable = true)
private void goml_preventBucketUsageInClaims(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable<TypedActionResult<ItemStack>> cir) {
private void goml_preventBucketUsageInClaims(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable<ActionResult> cir) {
HitResult hitResult = raycast(world, user, this.fluid == Fluids.EMPTY ? RaycastContext.FluidHandling.SOURCE_ONLY : RaycastContext.FluidHandling.NONE);
BlockHitResult blockHitResult = (BlockHitResult) hitResult;
BlockPos blockPos = blockHitResult.getBlockPos();
Expand All @@ -52,7 +52,7 @@ private void goml_preventBucketUsageInClaims(World world, PlayerEntity user, Han

if(noPermission) {
user.sendMessage(Text.literal("This block is protected by a claim."), true);
cir.setReturnValue(TypedActionResult.fail(user.getStackInHand(hand)));
cir.setReturnValue(ActionResult.FAIL);
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/draylar/goml/mixin/DispenserBlockMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
import net.minecraft.block.BlockState;
import net.minecraft.block.DispenserBlock;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.state.property.DirectionProperty;
import net.minecraft.state.property.EnumProperty;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.random.Random;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Final;
Expand All @@ -18,7 +19,8 @@

@Mixin(DispenserBlock.class)
public class DispenserBlockMixin {
@Shadow @Final public static DirectionProperty FACING;

@Shadow @Final public static EnumProperty<Direction> FACING;

@Inject(method = "scheduledTick", at = @At("HEAD"), cancellable = true)
private void safeSetBlock(BlockState state, ServerWorld world, BlockPos pos, Random random, CallbackInfo ci) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/draylar/goml/mixin/EntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public abstract class EntityMixin implements OriginOwner {
@Unique
private BlockPos originPos;

@Inject(method = "isInvulnerableTo", at = @At("HEAD"), cancellable = true)
@Inject(method = "isAlwaysInvulnerableTo", at = @At("HEAD"), cancellable = true)
private void goml$isInvulnerable(DamageSource damageSource, CallbackInfoReturnable<Boolean> cir) {
if (!ClaimUtils.canDamageEntity(this.world, (Entity) (Object) this, damageSource)) {
cir.setReturnValue(true);
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/draylar/goml/mixin/ExplosionMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.explosion.Explosion;
import net.minecraft.world.explosion.ExplosionImpl;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -15,25 +17,23 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import java.util.List;

@Mixin(Explosion.class)
@Mixin(ExplosionImpl.class)
public abstract class ExplosionMixin {
@Shadow
@Final
private ObjectArrayList<BlockPos> affectedBlocks;

@Shadow @Final public World world;

@Shadow @Nullable public abstract LivingEntity getCausingEntity();

@Inject(method = "collectBlocksAndDamageEntities", at = @At("TAIL"))
private void goml_clearBlocks(CallbackInfo ci) {
this.affectedBlocks.removeIf((b) -> !ClaimUtils.canExplosionDestroy(this.world, b, this.getCausingEntity()));
@Shadow @Final private ServerWorld world;

@Inject(method = "getBlocksToDestroy", at = @At("TAIL"))
private void goml_clearBlocks(CallbackInfoReturnable<List<BlockPos>> cir) {
cir.getReturnValue().removeIf((b) -> !ClaimUtils.canExplosionDestroy(this.world, b, this.getCausingEntity()));
}

@ModifyVariable(method = "collectBlocksAndDamageEntities", at = @At("STORE"), ordinal = 0)
@ModifyVariable(method = "damageEntities", at = @At("STORE"), ordinal = 0)
private List<Entity> goml_clearEntities(List<Entity> x) {
x.removeIf((e) -> !ClaimUtils.canExplosionDestroy(this.world, e.getBlockPos(), this.getCausingEntity()));
return x;
Expand Down
Loading

0 comments on commit 650b558

Please sign in to comment.