调整tag

This commit is contained in:
Atsuihsio 2024-11-29 11:14:52 +08:00
parent 24f5351c83
commit 43acf896cd
8 changed files with 15 additions and 13 deletions

View file

@ -1,4 +1,4 @@
// 1.20.1 2024-11-29T10:14:35.4350334 Tags for minecraft:item mod id superbwarfare
// 1.20.1 2024-11-29T11:09:46.7580865 Tags for minecraft:item mod id superbwarfare
cf8d49a8d2872286d1a9c3d4a7e1c2b7690db0b8 data/forge/tags/items/dusts.json
0fa06c2ff83bf09797e3ddff90f62d1124e645b4 data/forge/tags/items/dusts/coal_coke.json
295ddf906b7133a0558d03e9a60eea18281fe430 data/forge/tags/items/dusts/iron.json
@ -26,7 +26,6 @@ af6fd64b4a685c353f243763db268f7b2304c009 data/forge/tags/items/storage_blocks/le
30d1daa7590f7364b5bc2dc777a00caf2f5eecb0 data/forge/tags/items/storage_blocks/silver.json
3743c2790deca7e779d3e4b82f092de39b446988 data/forge/tags/items/storage_blocks/steel.json
144e54d908121dee498b2ebba3b24b09fd6f18d9 data/forge/tags/items/storage_blocks/tungsten.json
ce4893378c0c18730fabad876dba059e91e9a0b1 data/forge/tags/items/tools.json
4d4dfd25a2a749e000e1bb742c2f984d4e094e5d data/superbwarfare/tags/items/cannot_reload.json
cedce5ff7bbc95b40cbfced0f03a3da712118049 data/superbwarfare/tags/items/can_apply_barrel.json
4b0864ba4b2bb2ca3b30bdc2fefe3077f5020466 data/superbwarfare/tags/items/can_apply_grip.json
@ -49,6 +48,7 @@ aaa533157491a82b8e23b2914deef67c4078cbed data/superbwarfare/tags/items/rifle.jso
acd4d19dfadb71a1cec43e9c0f4a38fe8d3cf8cb data/superbwarfare/tags/items/shotgun.json
4aca0fa3f8b9f2a4920041e35e46dae7e93d5482 data/superbwarfare/tags/items/smg.json
13a23684e04832bea5dfbd2c0a9d9ed52dcb3422 data/superbwarfare/tags/items/sniper_rifle.json
ce4893378c0c18730fabad876dba059e91e9a0b1 data/superbwarfare/tags/items/tools.json
202756a5a9085f5883ca34424a79c1b7831101a9 data/superbwarfare/tags/items/use_handgun_ammo.json
2899774c6325135847a85b09121ce25587aa275e data/superbwarfare/tags/items/use_rifle_ammo.json
acd4d19dfadb71a1cec43e9c0f4a38fe8d3cf8cb data/superbwarfare/tags/items/use_shotgun_ammo.json

View file

@ -1,5 +0,0 @@
{
"values": [
"superbwarfare:crowbar"
]
}

View file

@ -0,0 +1,6 @@
{
"values": [
"superbwarfare:crowbar",
"create:wrench"
]
}

View file

@ -4,6 +4,7 @@ import com.atsuishio.superbwarfare.block.entity.ContainerBlockEntity;
import com.atsuishio.superbwarfare.entity.ICannonEntity;
import com.atsuishio.superbwarfare.init.ModBlockEntities;
import com.atsuishio.superbwarfare.init.ModEntities;
import com.atsuishio.superbwarfare.init.ModTags;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
@ -32,7 +33,6 @@ import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.common.Tags;
import javax.annotation.Nullable;
import java.util.List;
@ -52,7 +52,7 @@ public class ContainerBlock extends BaseEntityBlock {
public InteractionResult use(BlockState pState, Level pLevel, BlockPos pPos, Player pPlayer, InteractionHand pHand, BlockHitResult pHit) {
if (!pLevel.isClientSide) {
ItemStack stack = pPlayer.getItemInHand(pHand);
if (stack.is(Tags.Items.TOOLS)) {
if (stack.is(ModTags.Items.TOOLS)) {
BlockEntity blockEntity = pLevel.getBlockEntity(pPos);
if (!(blockEntity instanceof ContainerBlockEntity containerBlockEntity)) return InteractionResult.PASS;

View file

@ -60,13 +60,13 @@ public class ModItemTagProvider extends ItemTagsProvider {
this.tag(Tags.Items.ORES_IN_GROUND_STONE).add(ModItems.GALENA_ORE.get(), ModItems.SCHEELITE_ORE.get(), ModItems.SILVER_ORE.get());
this.tag(Tags.Items.ORES_IN_GROUND_DEEPSLATE).add(ModItems.DEEPSLATE_GALENA_ORE.get(), ModItems.DEEPSLATE_SCHEELITE_ORE.get(), ModItems.DEEPSLATE_SILVER_ORE.get());
this.tag(Tags.Items.TOOLS).add(ModItems.CROWBAR.get());
this.tag(forgeTag("plates")).addTags(forgeTag("plates/copper"));
this.tag(forgeTag("plates/copper")).add(ModItems.COPPER_PLATE.get());
ModItems.GUNS.getEntries().forEach(registryObject -> this.tag(ModTags.Items.GUN).add(registryObject.get()));
this.tag(ModTags.Items.TOOLS).add(ModItems.CROWBAR.get());
this.tag(ModTags.Items.SMG).add(ModItems.VECTOR.get());
this.tag(ModTags.Items.HANDGUN).add(ModItems.TRACHELIUM.get(), ModItems.GLOCK_17.get(), ModItems.GLOCK_18.get(), ModItems.M_1911.get());

View file

@ -156,7 +156,7 @@ public class Mk42Entity extends Entity implements GeoEntity, ICannonEntity {
@Override
public InteractionResult interact(Player player, InteractionHand hand) {
if (player.isShiftKeyDown()) {
if (player.getMainHandItem().getItem() == ModItems.CROWBAR.get() && this.getFirstPassenger() == null) {
if (player.getMainHandItem().is(ModTags.Items.TOOLS) && this.getFirstPassenger() == null) {
ItemStack stack = ContainerBlockItem.createInstance(this);
if (!player.addItem(stack)){
player.drop(stack, false);

View file

@ -163,7 +163,7 @@ public class Mle1934Entity extends Entity implements GeoEntity, ICannonEntity {
@Override
public InteractionResult interact(Player player, InteractionHand hand) {
if (player.isShiftKeyDown()) {
if (player.getMainHandItem().getItem() == ModItems.CROWBAR.get() && this.getFirstPassenger() == null) {
if (player.getMainHandItem().is(ModTags.Items.TOOLS) && this.getFirstPassenger() == null) {
ItemStack stack = ContainerBlockItem.createInstance(this);
if (!player.addItem(stack)) {
player.drop(stack, false);

View file

@ -44,6 +44,7 @@ public class ModTags {
public static final TagKey<Item> MILITARY_ARMOR = tag("military_armor");
public static final TagKey<Item> MILITARY_ARMOR_HEAVY = tag("military_armor_heavy");
public static final TagKey<Item> TOOLS = tag("tools");
private static TagKey<Item> tag(String name) {
return ItemTags.create(new ResourceLocation(ModUtils.MODID, name));