26.1-snap-3
This commit is contained in:
1 parent
10be902bcc
commit
9158f96b9b
7 files changed
+17
-12
No files matched your search
@@ -3,6 +3,7 @@ package carpet.mixins;
|
||||
import carpet.CarpetSettings;
|
||||
import net.minecraft.core.component.DataComponents;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.ItemInstance;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.component.ItemContainerContents;
|
||||
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.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(ItemStack.class)
|
||||
public class ItemStack_stackableShulkerBoxesMixin
|
||||
@Mixin(ItemInstance.class)
|
||||
public interface ItemStack_stackableShulkerBoxesMixin
|
||||
{
|
||||
@Inject(method = "getMaxStackSize", at = @At("HEAD"), cancellable = true)
|
||||
private void getCMMAxStackSize(CallbackInfoReturnable<Integer> cir)
|
||||
{
|
||||
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
|
||||
&& ((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);
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public abstract class MinecraftServer_scarpetMixin extends ReentrantBlockableEve
|
||||
@Override
|
||||
public void reloadAfterReload(RegistryAccess newRegs)
|
||||
{
|
||||
resources.managers().updateStaticRegistryTags();
|
||||
resources.managers().updateComponentsAndStaticRegistryTags();
|
||||
getPlayerList().saveAll();
|
||||
getPlayerList().reloadResources();
|
||||
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.player.Player;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
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"))
|
||||
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())
|
||||
{
|
||||
// consider using pos now?
|
||||
if(PLAYER_INTERACTS_WITH_ENTITY.onEntityHandAction((ServerPlayer) (Object)this, entity, hand)) {
|
||||
cir.setReturnValue(InteractionResult.PASS);
|
||||
cir.cancel();
|
||||
|
||||
Reference in new issue
Block a user