26.1-snap-3

This commit is contained in:
gnembon committed 2026-01-13 23:09:32 +01:00
1 parent 10be902bcc
commit 9158f96b9b
7 files changed
+17 -12

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@ org.gradle.configuration-cache=false
# Fabric Properties # Fabric Properties
# check https://fabricmc.net/develop/ # check https://fabricmc.net/develop/
minecraft_version=26.1-snapshot-2 minecraft_version=26.1-snapshot-3
loader_version=0.18.4 loader_version=0.18.4
loom_version=1.14-SNAPSHOT loom_version=1.14-SNAPSHOT
@@ -334,13 +334,13 @@ public class EntityPlayerActionPack
boolean handWasEmpty = player.getItemInHand(hand).isEmpty(); boolean handWasEmpty = player.getItemInHand(hand).isEmpty();
boolean itemFrameEmpty = (entity instanceof ItemFrame) && ((ItemFrame) entity).getItem().isEmpty(); boolean itemFrameEmpty = (entity instanceof ItemFrame) && ((ItemFrame) entity).getItem().isEmpty();
Vec3 relativeHitPos = entityHit.getLocation().subtract(entity.getX(), entity.getY(), entity.getZ()); Vec3 relativeHitPos = entityHit.getLocation().subtract(entity.getX(), entity.getY(), entity.getZ());
if (entity.interactAt(player, relativeHitPos, hand).consumesAction()) if (entity.interact(player, hand, relativeHitPos).consumesAction())
{ {
ap.itemUseCooldown = 3; ap.itemUseCooldown = 3;
return true; return true;
} }
// fix for SS itemframe always returns CONSUME even if no action is performed // fix for SS itemframe always returns CONSUME even if no action is performed
if (player.interactOn(entity, hand).consumesAction() && !(handWasEmpty && itemFrameEmpty)) if (player.interactOn(entity, hand, relativeHitPos).consumesAction() && !(handWasEmpty && itemFrameEmpty))
{ {
ap.itemUseCooldown = 3; ap.itemUseCooldown = 3;
return true; return true;
@@ -3,6 +3,7 @@ package carpet.mixins;
import carpet.CarpetSettings; import carpet.CarpetSettings;
import net.minecraft.core.component.DataComponents; import net.minecraft.core.component.DataComponents;
import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.ItemInstance;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.component.ItemContainerContents; import net.minecraft.world.item.component.ItemContainerContents;
import net.minecraft.world.level.block.ShulkerBoxBlock; import net.minecraft.world.level.block.ShulkerBoxBlock;
@@ -11,16 +12,17 @@ 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.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(ItemStack.class) @Mixin(ItemInstance.class)
public class ItemStack_stackableShulkerBoxesMixin public interface ItemStack_stackableShulkerBoxesMixin
{ {
@Inject(method = "getMaxStackSize", at = @At("HEAD"), cancellable = true) @Inject(method = "getMaxStackSize", at = @At("HEAD"), cancellable = true)
private void getCMMAxStackSize(CallbackInfoReturnable<Integer> cir) private void getCMMAxStackSize(CallbackInfoReturnable<Integer> cir)
{ {
if (CarpetSettings.shulkerBoxStackSize > 1 if (CarpetSettings.shulkerBoxStackSize > 1
&& ((ItemStack)((Object)this)).getItem() instanceof BlockItem blockItem && ((ItemInstance)((Object)this)) instanceof final ItemStack itemStack
&& itemStack.getItem() instanceof BlockItem blockItem
&& blockItem.getBlock() instanceof ShulkerBoxBlock && blockItem.getBlock() instanceof ShulkerBoxBlock
&& ((ItemStack) ((Object) this)).getOrDefault(DataComponents.CONTAINER, ItemContainerContents.EMPTY).stream().findAny().isEmpty() && ((ItemStack) ((Object) this)).getOrDefault(DataComponents.CONTAINER, ItemContainerContents.EMPTY).allItemsCopyStream().findAny().isEmpty()
) { ) {
cir.setReturnValue(CarpetSettings.shulkerBoxStackSize); cir.setReturnValue(CarpetSettings.shulkerBoxStackSize);
} }
@@ -102,7 +102,7 @@ public abstract class MinecraftServer_scarpetMixin extends ReentrantBlockableEve
@Override @Override
public void reloadAfterReload(RegistryAccess newRegs) public void reloadAfterReload(RegistryAccess newRegs)
{ {
resources.managers().updateStaticRegistryTags(); resources.managers().updateComponentsAndStaticRegistryTags();
getPlayerList().saveAll(); getPlayerList().saveAll();
getPlayerList().reloadResources(); getPlayerList().reloadResources();
functionManager.replaceLibrary(this.resources.managers().getFunctionLibrary()); functionManager.replaceLibrary(this.resources.managers().getFunctionLibrary());
@@ -12,6 +12,7 @@ import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
@@ -66,10 +67,11 @@ public abstract class Player_scarpetEventsMixin extends LivingEntity
} }
@Inject(method = "interactOn", cancellable = true, at = @At("HEAD")) @Inject(method = "interactOn", cancellable = true, at = @At("HEAD"))
private void doInteract(Entity entity, InteractionHand hand, CallbackInfoReturnable<InteractionResult> cir) private void doInteract(Entity entity, InteractionHand hand, Vec3 pos, CallbackInfoReturnable<InteractionResult> cir)
{ {
if (!level().isClientSide() && PLAYER_INTERACTS_WITH_ENTITY.isNeeded()) if (!level().isClientSide() && PLAYER_INTERACTS_WITH_ENTITY.isNeeded())
{ {
// consider using pos now?
if(PLAYER_INTERACTS_WITH_ENTITY.onEntityHandAction((ServerPlayer) (Object)this, entity, hand)) { if(PLAYER_INTERACTS_WITH_ENTITY.onEntityHandAction((ServerPlayer) (Object)this, entity, hand)) {
cir.setReturnValue(InteractionResult.PASS); cir.setReturnValue(InteractionResult.PASS);
cir.cancel(); cir.cancel();
@@ -64,6 +64,7 @@ import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
import net.minecraft.stats.Stat; import net.minecraft.stats.Stat;
import net.minecraft.stats.StatType; import net.minecraft.stats.StatType;
import net.minecraft.world.clock.WorldClocks;
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.EquipmentSlot; import net.minecraft.world.entity.EquipmentSlot;
@@ -729,7 +730,7 @@ public class Auxiliary
expression.addContextFunction("day_time", -1, (c, t, lv) -> expression.addContextFunction("day_time", -1, (c, t, lv) ->
{ {
Value time = new NumericValue(((CarpetContext) c).level().getDayTime()); Value time = new NumericValue(((CarpetContext) c).level().getOverworldClockTime());
if (!lv.isEmpty()) if (!lv.isEmpty())
{ {
long newTime = NumericValue.asNumber(lv.get(0)).getLong(); long newTime = NumericValue.asNumber(lv.get(0)).getLong();
@@ -737,7 +738,7 @@ public class Auxiliary
{ {
newTime = 0; newTime = 0;
} }
((CarpetContext) c).level().setDayTime(newTime); ((CarpetContext) c).level().clockManager().setTotalTicks(((CarpetContext) c).registryAccess().getOrThrow(WorldClocks.OVERWORLD), newTime);
} }
return time; return time;
}); });
@@ -200,7 +200,7 @@ public class Inventories
CarpetContext cc = (CarpetContext) c; CarpetContext cc = (CarpetContext) c;
Registry<Item> registry = cc.registry(Registries.ITEM); Registry<Item> registry = cc.registry(Registries.ITEM);
Item item = registry.getOptional(id).orElseThrow(() -> new ThrowStatement(itemStr, Throwables.UNKNOWN_ITEM)); Item item = registry.getOptional(id).orElseThrow(() -> new ThrowStatement(itemStr, Throwables.UNKNOWN_ITEM));
ItemStack reminder = item.getCraftingRemainder(); ItemStack reminder = item.getCraftingRemainder().create();
return reminder.isEmpty() ? Value.NULL : ValueConversions.of(reminder, cc.registryAccess()); return reminder.isEmpty() ? Value.NULL : ValueConversions.of(reminder, cc.registryAccess());
}); });