diff --git a/src/main/java/com/wenxin2/marioverse/blocks/ClearWarpPipeBlock.java b/src/main/java/com/wenxin2/marioverse/blocks/ClearWarpPipeBlock.java index c60a0751..63347488 100644 --- a/src/main/java/com/wenxin2/marioverse/blocks/ClearWarpPipeBlock.java +++ b/src/main/java/com/wenxin2/marioverse/blocks/ClearWarpPipeBlock.java @@ -5,7 +5,7 @@ import com.wenxin2.marioverse.blocks.entities.WarpPipeBlockEntity; import com.wenxin2.marioverse.init.BlockRegistry; import com.wenxin2.marioverse.init.ConfigRegistry; -import com.wenxin2.marioverse.init.ModTags; +import com.wenxin2.marioverse.init.TagRegistry; import com.wenxin2.marioverse.items.LinkerItem; import java.util.Collection; import java.util.Map; @@ -416,14 +416,14 @@ public void entityInside(BlockState state, Level world, BlockPos pos, Entity ent int blockY = pos.getY(); int blockZ = pos.getZ(); - if (!entity.isShiftKeyDown() && ConfigRegistry.ALLOW_FAST_TRAVEL.get() && !entity.getType().is(ModTags.QUICK_TRAVEL_BLACKLIST)) + if (!entity.isShiftKeyDown() && ConfigRegistry.ALLOW_FAST_TRAVEL.get() && !entity.getType().is(TagRegistry.QUICK_TRAVEL_BLACKLIST)) entity.setSwimming(true); if ((entityY < blockY + 0.98 && entityY > blockY + 0.02) && (entityX < blockX + 0.98 && entityX > blockX + 0.02) && (entityZ < blockZ + 0.98 && entityZ > blockZ + 0.02) && !entity.isShiftKeyDown() && ConfigRegistry.ALLOW_FAST_TRAVEL.get() - && !entity.getType().is(ModTags.QUICK_TRAVEL_BLACKLIST)) { + && !entity.getType().is(TagRegistry.QUICK_TRAVEL_BLACKLIST)) { this.moveEntityInPipe(entity); if (!world.isClientSide) { diff --git a/src/main/java/com/wenxin2/marioverse/blocks/QuestionBlock.java b/src/main/java/com/wenxin2/marioverse/blocks/QuestionBlock.java index f0a660de..f0f7801b 100644 --- a/src/main/java/com/wenxin2/marioverse/blocks/QuestionBlock.java +++ b/src/main/java/com/wenxin2/marioverse/blocks/QuestionBlock.java @@ -2,7 +2,7 @@ import com.wenxin2.marioverse.blocks.entities.QuestionBlockEntity; import com.wenxin2.marioverse.init.ConfigRegistry; -import com.wenxin2.marioverse.init.ModTags; +import com.wenxin2.marioverse.init.TagRegistry; import com.wenxin2.marioverse.init.SoundRegistry; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -113,7 +113,7 @@ public void spawnEntity(Level world, Entity entity, BlockPos pos, ItemStack stac if (stack.getItem() instanceof SpawnEggItem spawnEgg && ConfigRegistry.QUESTION_SPAWNS_MOBS.get()) { EntityType entityType = spawnEgg.getType(stack); - if (world instanceof ServerLevel serverWorld && !entityType.is(ModTags.QUESTION_BLOCK_BLACKLIST)) { // Check this + if (world instanceof ServerLevel serverWorld && !entityType.is(TagRegistry.QUESTION_BLOCK_BLACKLIST)) { // Check this if (world.getBlockState(pos.above()).isAir()) entityType.spawn(serverWorld, stack, null, pos.above(2), MobSpawnType.SPAWN_EGG, true, true); else entityType.spawn(serverWorld, stack, null, pos.below((int) entityType.getHeight()), MobSpawnType.SPAWN_EGG, true, true); diff --git a/src/main/java/com/wenxin2/marioverse/blocks/entities/QuestionBlockEntity.java b/src/main/java/com/wenxin2/marioverse/blocks/entities/QuestionBlockEntity.java index 0b727a60..2f761129 100644 --- a/src/main/java/com/wenxin2/marioverse/blocks/entities/QuestionBlockEntity.java +++ b/src/main/java/com/wenxin2/marioverse/blocks/entities/QuestionBlockEntity.java @@ -45,7 +45,7 @@ public void loadAdditional(CompoundTag tag, HolderLookup.Provider provider) { public void addItem(ItemStack stack) { ItemStack existingStack = items.getStackInSlot(0); if (existingStack.isEmpty()) { - items.setStackInSlot(0, stack); + items.setStackInSlot(0, stack.split(stack.getMaxStackSize())); } else if (ItemStack.isSameItemSameComponents(existingStack, stack)) { int countToAdd = Math.min(stack.getMaxStackSize() - existingStack.getCount(), stack.getCount()); existingStack.grow(countToAdd); diff --git a/src/main/java/com/wenxin2/marioverse/init/ModTags.java b/src/main/java/com/wenxin2/marioverse/init/TagRegistry.java similarity index 98% rename from src/main/java/com/wenxin2/marioverse/init/ModTags.java rename to src/main/java/com/wenxin2/marioverse/init/TagRegistry.java index d7204f36..184c5798 100644 --- a/src/main/java/com/wenxin2/marioverse/init/ModTags.java +++ b/src/main/java/com/wenxin2/marioverse/init/TagRegistry.java @@ -8,7 +8,7 @@ import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; -public class ModTags { +public class TagRegistry { public static final TagKey DYEABLE_WARP_PIPE_BLOCKS = blockTags(Marioverse.MOD_ID, "dyeable_marioverse"); public static final TagKey WARP_PIPE_BLOCKS = blockTags(Marioverse.MOD_ID, "marioverse"); public static final TagKey WRENCH_EFFICIENT = blockTags(Marioverse.MOD_ID, "wrench_efficient"); diff --git a/src/main/java/com/wenxin2/marioverse/items/WrenchItem.java b/src/main/java/com/wenxin2/marioverse/items/WrenchItem.java index 119ac368..c0425f75 100644 --- a/src/main/java/com/wenxin2/marioverse/items/WrenchItem.java +++ b/src/main/java/com/wenxin2/marioverse/items/WrenchItem.java @@ -1,14 +1,12 @@ package com.wenxin2.marioverse.items; -import com.wenxin2.marioverse.init.ModTags; +import com.wenxin2.marioverse.init.TagRegistry; import java.util.List; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.screens.Screen; import net.minecraft.core.BlockPos; import net.minecraft.core.component.DataComponents; -import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; -import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.EquipmentSlotGroup; import net.minecraft.world.entity.LivingEntity; @@ -21,9 +19,7 @@ import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.item.component.ItemAttributeModifiers; import net.minecraft.world.item.component.Tool; -import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.neoforged.neoforge.common.Tags; @@ -77,7 +73,7 @@ public boolean canAttackBlock(BlockState state, Level world, BlockPos pos, Playe } public static Tool createToolProperties() { - return new Tool(List.of(Tool.Rule.overrideSpeed(ModTags.WRENCH_EFFICIENT, 1.5F)), 1.0F, 2); + return new Tool(List.of(Tool.Rule.overrideSpeed(TagRegistry.WRENCH_EFFICIENT, 1.5F)), 1.0F, 2); } public static ItemAttributeModifiers createAttributes(Tier tier, int attackDamage, float attackSpeed) { diff --git a/src/main/java/com/wenxin2/marioverse/mixin/EntityMixin.java b/src/main/java/com/wenxin2/marioverse/mixin/EntityMixin.java index 65ca68a5..de710927 100644 --- a/src/main/java/com/wenxin2/marioverse/mixin/EntityMixin.java +++ b/src/main/java/com/wenxin2/marioverse/mixin/EntityMixin.java @@ -3,7 +3,7 @@ import com.wenxin2.marioverse.blocks.WarpPipeBlock; import com.wenxin2.marioverse.blocks.entities.WarpPipeBlockEntity; import com.wenxin2.marioverse.init.ConfigRegistry; -import com.wenxin2.marioverse.init.ModTags; +import com.wenxin2.marioverse.init.TagRegistry; import java.util.Collection; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -136,7 +136,7 @@ public void baseTick(CallbackInfo ci) { int blockZ = pos.getZ(); if (!stateAboveEntity.getValue(WarpPipeBlock.CLOSED) && blockEntity instanceof WarpPipeBlockEntity warpPipeBE && warpPipeBE.getLevel() != null - && !warpPipeBE.preventWarp && ConfigRegistry.TELEPORT_PLAYERS.get() && !this.getType().is(ModTags.WARP_BLACKLIST)) { + && !warpPipeBE.preventWarp && ConfigRegistry.TELEPORT_PLAYERS.get() && !this.getType().is(TagRegistry.WARP_BLACKLIST)) { warpPos = warpPipeBE.destinationPos; int entityId = this.getId(); @@ -176,7 +176,7 @@ else if (warpPipeBE.getUuid() != null && warpPipeBE.getWarpUuid() != null && War int blockZ = pos.getZ(); if (!state.getValue(WarpPipeBlock.CLOSED) && blockEntity instanceof WarpPipeBlockEntity warpPipeBE - && !warpPipeBE.preventWarp && ConfigRegistry.TELEPORT_NON_MOBS.get() && !this.getType().is(ModTags.WARP_BLACKLIST)) { + && !warpPipeBE.preventWarp && ConfigRegistry.TELEPORT_NON_MOBS.get() && !this.getType().is(TagRegistry.WARP_BLACKLIST)) { warpPos = warpPipeBE.destinationPos; int entityId = this.getId(); diff --git a/src/main/java/com/wenxin2/marioverse/mixin/LivingEntityMixin.java b/src/main/java/com/wenxin2/marioverse/mixin/LivingEntityMixin.java index b8cce095..1c57c661 100644 --- a/src/main/java/com/wenxin2/marioverse/mixin/LivingEntityMixin.java +++ b/src/main/java/com/wenxin2/marioverse/mixin/LivingEntityMixin.java @@ -3,7 +3,7 @@ import com.wenxin2.marioverse.blocks.WarpPipeBlock; import com.wenxin2.marioverse.blocks.entities.WarpPipeBlockEntity; import com.wenxin2.marioverse.init.ConfigRegistry; -import com.wenxin2.marioverse.init.ModTags; +import com.wenxin2.marioverse.init.TagRegistry; import java.util.Collection; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -127,7 +127,7 @@ public void baseTick(CallbackInfo ci) { int blockZ = pos.getZ(); if (!stateAboveEntity.getValue(WarpPipeBlock.CLOSED) && blockEntity instanceof WarpPipeBlockEntity warpPipeBE && warpPipeBE.getLevel() != null - && !warpPipeBE.preventWarp && this.getType() != EntityType.PLAYER && ConfigRegistry.TELEPORT_PLAYERS.get() && !this.getType().is(ModTags.WARP_BLACKLIST) + && !warpPipeBE.preventWarp && this.getType() != EntityType.PLAYER && ConfigRegistry.TELEPORT_PLAYERS.get() && !this.getType().is(TagRegistry.WARP_BLACKLIST) && !this.getPersistentData().getBoolean("marioverse:prevent_warp")) { warpPos = warpPipeBE.destinationPos; int entityId = this.getId(); @@ -168,7 +168,7 @@ else if (warpPipeBE.getUuid() != null && warpPipeBE.getWarpUuid() != null && War int blockZ = pos.getZ(); if (!state.getValue(WarpPipeBlock.CLOSED) && blockEntity instanceof WarpPipeBlockEntity warpPipeBE && this.getType() != EntityType.PLAYER - && !warpPipeBE.preventWarp && ConfigRegistry.TELEPORT_MOBS.get() && !this.getType().is(ModTags.WARP_BLACKLIST) + && !warpPipeBE.preventWarp && ConfigRegistry.TELEPORT_MOBS.get() && !this.getType().is(TagRegistry.WARP_BLACKLIST) && !this.getPersistentData().getBoolean("marioverse:prevent_warp")) { warpPos = warpPipeBE.destinationPos; int entityId = this.getId(); diff --git a/src/main/java/com/wenxin2/marioverse/mixin/PlayerMixin.java b/src/main/java/com/wenxin2/marioverse/mixin/PlayerMixin.java index 9e7fbab6..34826397 100644 --- a/src/main/java/com/wenxin2/marioverse/mixin/PlayerMixin.java +++ b/src/main/java/com/wenxin2/marioverse/mixin/PlayerMixin.java @@ -5,7 +5,7 @@ import com.wenxin2.marioverse.blocks.entities.QuestionBlockEntity; import com.wenxin2.marioverse.blocks.entities.WarpPipeBlockEntity; import com.wenxin2.marioverse.init.ConfigRegistry; -import com.wenxin2.marioverse.init.ModTags; +import com.wenxin2.marioverse.init.TagRegistry; import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -140,7 +140,7 @@ public void baseTick() { int blockZ = pos.getZ(); if (!stateAboveEntity.getValue(WarpPipeBlock.CLOSED) && blockEntity instanceof WarpPipeBlockEntity warpPipeBE && warpPipeBE.getLevel() != null - && !warpPipeBE.preventWarp && ConfigRegistry.TELEPORT_PLAYERS.get() && !this.getType().is(ModTags.WARP_BLACKLIST) + && !warpPipeBE.preventWarp && ConfigRegistry.TELEPORT_PLAYERS.get() && !this.getType().is(TagRegistry.WARP_BLACKLIST) && !this.getPersistentData().getBoolean("marioverse:prevent_warp")) { warpPos = warpPipeBE.destinationPos; int entityId = this.getId(); @@ -183,7 +183,7 @@ else if (warpPipeBE.getUuid() != null && warpPipeBE.getWarpUuid() != null && War int blockZ = pos.getZ(); if (!state.getValue(WarpPipeBlock.CLOSED) && blockEntity instanceof WarpPipeBlockEntity warpPipeBE && warpPipeBE.getLevel() != null - && !warpPipeBE.preventWarp && ConfigRegistry.TELEPORT_PLAYERS.get() && !this.getType().is(ModTags.WARP_BLACKLIST) + && !warpPipeBE.preventWarp && ConfigRegistry.TELEPORT_PLAYERS.get() && !this.getType().is(TagRegistry.WARP_BLACKLIST) && !this.getPersistentData().getBoolean("marioverse:prevent_warp")) { // WarpData warpData = WarpProxy.getInstance().getWarp(warpPipeBE.warpUuid); warpPos = warpPipeBE.destinationPos; @@ -251,7 +251,7 @@ else if (warpPipeBE.getUuid() != null && warpPipeBE.getWarpUuid() != null && War } /* else if (this.getWarpCooldown() <= 10) displayDestinationMissingMessage(); */ else if (warpPipeBE.hasDestinationPos()) this.marioverse$displayCooldownMessage(); } - } else if (!state.getValue(WarpPipeBlock.CLOSED) && (!ConfigRegistry.TELEPORT_PLAYERS.get() || this.getType().is(ModTags.WARP_BLACKLIST))) { + } else if (!state.getValue(WarpPipeBlock.CLOSED) && (!ConfigRegistry.TELEPORT_PLAYERS.get() || this.getType().is(TagRegistry.WARP_BLACKLIST))) { if (state.getValue(WarpPipeBlock.FACING) == Direction.UP && this.isShiftKeyDown() && (entityY + this.getBbHeight() >= blockY - 1) && (entityX < blockX + 1 && entityX > blockX) && (entityZ < blockZ + 1 && entityZ > blockZ)) { this.marioverse$displayNoTeleportMessage(); @@ -296,7 +296,7 @@ else if (warpPipeBE.getUuid() != null && warpPipeBE.getWarpUuid() != null && War @Unique public void marioverse$displayNoTeleportMessage() { - if (!ConfigRegistry.TELEPORT_PLAYERS.get() || this.getType().is(ModTags.WARP_BLACKLIST)) { + if (!ConfigRegistry.TELEPORT_PLAYERS.get() || this.getType().is(TagRegistry.WARP_BLACKLIST)) { this.displayClientMessage(Component.translatable("display.marioverse.players_cannot_teleport") .withStyle(ChatFormatting.RED), true); }