This commit is contained in:
gnembon committed 2024-05-04 00:33:16 +02:00
1 parent 76b876446c
commit 0e799bbc3e
7 files changed
+18 -15

No files matched your search

+3 -3
View File
@@ -3,8 +3,8 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties # Fabric Properties
# check https://fabricmc.net/develop/ # check https://fabricmc.net/develop/
minecraft_version=1.20.6 minecraft_version=24w18a
loader_version=0.15.10 loader_version=0.15.11
jsr305_version=3.0.2 jsr305_version=3.0.2
fabric_version=0.97.8+1.20.6 fabric_version=0.97.8+1.20.6
@@ -17,7 +17,7 @@ org.gradle.jvmargs=-Xmx1G
# The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5) # The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5)
# This is needed because CF uses too vague names for prereleases and release candidates # This is needed because CF uses too vague names for prereleases and release candidates
# Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN]
release-curse-versions = Minecraft 1.20:1.20.6 release-curse-versions = Minecraft 1.21:1.21-Snapshot
# Whether or not to build another branch on release # Whether or not to build another branch on release
release-extra-branch = false release-extra-branch = false
# The name of the second branch to release # The name of the second branch to release
@@ -16,11 +16,11 @@ import net.minecraft.sounds.SoundSource;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.item.PrimedTnt; import net.minecraft.world.entity.item.PrimedTnt;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.enchantment.ProtectionEnchantment;
import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
@@ -172,8 +172,8 @@ public class OptimizedExplosion
} }
double d11 = d10; double d11 = d10;
if (entity instanceof LivingEntity) { if (entity instanceof LivingEntity lev) {
d11 = ProtectionEnchantment.getExplosionKnockbackAfterDampener((LivingEntity) entity, d10); d11 = d10 * Mth.clamp(1.0 - lev.getAttributeValue(Attributes.EXPLOSION_KNOCKBACK_RESISTANCE), 0.0, 1.0);
} }
if (eLogger != null) { if (eLogger != null) {
@@ -20,8 +20,8 @@ public abstract class AbstractArrowMixin extends Entity
private TrajectoryLogHelper logHelper; private TrajectoryLogHelper logHelper;
public AbstractArrowMixin(EntityType<?> entityType_1, Level world_1) { super(entityType_1, world_1); } public AbstractArrowMixin(EntityType<?> entityType_1, Level world_1) { super(entityType_1, world_1); }
@Inject(method = "<init>(Lnet/minecraft/world/entity/EntityType;Lnet/minecraft/world/level/Level;Lnet/minecraft/world/item/ItemStack;)V", at = @At("RETURN")) @Inject(method = "<init>(Lnet/minecraft/world/entity/EntityType;Lnet/minecraft/world/level/Level;Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/item/ItemStack;)V", at = @At("RETURN"))
private void addLogger(final EntityType entityType, final Level level, final ItemStack itemStack, final CallbackInfo ci) private void addLogger(final EntityType entityType, final Level level, final ItemStack itemStack, final ItemStack weapon, final CallbackInfo ci)
{ {
if (LoggerRegistry.__projectiles && !level.isClientSide) if (LoggerRegistry.__projectiles && !level.isClientSide)
logHelper = new TrajectoryLogHelper("projectiles"); logHelper = new TrajectoryLogHelper("projectiles");
@@ -2,6 +2,7 @@ package carpet.mixins;
import carpet.CarpetSettings; import carpet.CarpetSettings;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.registries.Registries;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items; import net.minecraft.world.item.Items;
@@ -33,7 +34,7 @@ public class BuddingAmethystBlock_movableAmethystMixin extends Block {
// drawback - not controlled via loottables, but hey // drawback - not controlled via loottables, but hey
if (CarpetSettings.movableAmethyst && if (CarpetSettings.movableAmethyst &&
stack.getItem() instanceof PickaxeItem && stack.getItem() instanceof PickaxeItem &&
EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, stack) > 0 EnchantmentHelper.getItemEnchantmentLevel(world.registryAccess().registryOrThrow(Registries.ENCHANTMENT).getHolderOrThrow(Enchantments.SILK_TOUCH), stack) > 0
) )
popResource(world, pos, Items.BUDDING_AMETHYST.getDefaultInstance()); popResource(world, pos, Items.BUDDING_AMETHYST.getDefaultInstance());
} }
@@ -1,6 +1,7 @@
package carpet.mixins; package carpet.mixins;
import carpet.CarpetSettings; import carpet.CarpetSettings;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.ExperienceOrb; import net.minecraft.world.entity.ExperienceOrb;
@@ -27,7 +28,7 @@ public abstract class ExperienceOrb_xpNoCooldownMixin extends Entity
} }
@Shadow @Shadow
protected abstract int repairPlayerItems(Player player, int amount); protected abstract int repairPlayerItems(ServerPlayer player, int amount);
@Inject(method = "playerTouch", at = @At("HEAD")) @Inject(method = "playerTouch", at = @At("HEAD"))
private void addXP(Player player, CallbackInfo ci) { private void addXP(Player player, CallbackInfo ci) {
@@ -35,7 +36,7 @@ public abstract class ExperienceOrb_xpNoCooldownMixin extends Entity
player.takeXpDelay = 0; player.takeXpDelay = 0;
// reducing the count to 1 and leaving vanilla to deal with it // reducing the count to 1 and leaving vanilla to deal with it
while (this.count > 1) { while (this.count > 1) {
int remainder = this.repairPlayerItems(player, this.value); int remainder = this.repairPlayerItems((ServerPlayer) player, this.value);
if (remainder > 0) { if (remainder > 0) {
player.giveExperiencePoints(remainder); player.giveExperiencePoints(remainder);
} }
@@ -4,6 +4,7 @@ import carpet.fakes.EntityInterface;
import carpet.script.EntityEventsGroup; import carpet.script.EntityEventsGroup;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.decoration.BlockAttachedEntity;
import net.minecraft.world.entity.decoration.HangingEntity; import net.minecraft.world.entity.decoration.HangingEntity;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
@@ -11,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(HangingEntity.class) @Mixin(BlockAttachedEntity.class)
public abstract class HangingEntity_scarpetEventsMixin extends Entity public abstract class HangingEntity_scarpetEventsMixin extends Entity
{ {
public HangingEntity_scarpetEventsMixin(EntityType<?> type, Level world) public HangingEntity_scarpetEventsMixin(EntityType<?> type, Level world)
@@ -921,7 +921,7 @@ public class WorldAccess
damageAmount = 2; damageAmount = 2;
} }
final int finalDamageAmount = damageAmount; final int finalDamageAmount = damageAmount;
tool.hurtAndBreak(damageAmount, world.getRandom(), null, () -> { if (finalDamageAmount > 0) toolBroke.setTrue(); } ); tool.hurtAndBreak(damageAmount, world, null, () -> { if (finalDamageAmount > 0) toolBroke.setTrue(); } );
if (!isUsingEffectiveTool) if (!isUsingEffectiveTool)
{ {
dropLoot = false; dropLoot = false;
@@ -930,7 +930,7 @@ public class WorldAccess
if (dropLoot) if (dropLoot)
{ {
if (how < 0 || (tag != null && EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0)) if (how < 0 || (tag != null && EnchantmentHelper.getItemEnchantmentLevel(world.registryAccess().registryOrThrow(Registries.ENCHANTMENT).getHolderOrThrow(Enchantments.SILK_TOUCH), tool) > 0))
{ {
Block.popResource(world, where, new ItemStack(state.getBlock())); Block.popResource(world, where, new ItemStack(state.getBlock()));
} }
@@ -938,7 +938,7 @@ public class WorldAccess
{ {
if (how > 0) if (how > 0)
{ {
tool.enchant(Enchantments.FORTUNE, (int) how); tool.enchant(world.registryAccess().registryOrThrow(Registries.ENCHANTMENT).getHolderOrThrow(Enchantments.FORTUNE), (int) how);
} }
if (DUMMY_ENTITY == null) if (DUMMY_ENTITY == null)
{ {