使用撬棍标签代替撬棍物品判断
This commit is contained in:
parent
07950ecf6f
commit
1056bfc97b
14 changed files with 31 additions and 24 deletions
|
@ -2,8 +2,8 @@ package com.atsuishio.superbwarfare.block;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.block.entity.ContainerBlockEntity;
|
import com.atsuishio.superbwarfare.block.entity.ContainerBlockEntity;
|
||||||
import com.atsuishio.superbwarfare.init.ModBlockEntities;
|
import com.atsuishio.superbwarfare.init.ModBlockEntities;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
|
||||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.mojang.serialization.MapCodec;
|
import com.mojang.serialization.MapCodec;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -64,7 +64,7 @@ public class ContainerBlock extends BaseEntityBlock {
|
||||||
|| !(level.getBlockEntity(pos) instanceof ContainerBlockEntity containerBlockEntity)
|
|| !(level.getBlockEntity(pos) instanceof ContainerBlockEntity containerBlockEntity)
|
||||||
) return ItemInteractionResult.FAIL;
|
) return ItemInteractionResult.FAIL;
|
||||||
|
|
||||||
if (!stack.is(ModItems.CROWBAR.get())) {
|
if (!stack.is(ModTags.Items.CROWBAR)) {
|
||||||
player.displayClientMessage(Component.translatable("des.superbwarfare.container.fail.crowbar"), true);
|
player.displayClientMessage(Component.translatable("des.superbwarfare.container.fail.crowbar"), true);
|
||||||
return ItemInteractionResult.FAIL;
|
return ItemInteractionResult.FAIL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,8 @@ package com.atsuishio.superbwarfare.block;
|
||||||
import com.atsuishio.superbwarfare.Mod;
|
import com.atsuishio.superbwarfare.Mod;
|
||||||
import com.atsuishio.superbwarfare.block.entity.SmallContainerBlockEntity;
|
import com.atsuishio.superbwarfare.block.entity.SmallContainerBlockEntity;
|
||||||
import com.atsuishio.superbwarfare.init.ModBlockEntities;
|
import com.atsuishio.superbwarfare.init.ModBlockEntities;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
|
||||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.mojang.serialization.MapCodec;
|
import com.mojang.serialization.MapCodec;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -62,7 +62,7 @@ public class SmallContainerBlock extends BaseEntityBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack stack = player.getItemInHand(player.getUsedItemHand());
|
ItemStack stack = player.getItemInHand(player.getUsedItemHand());
|
||||||
if (!stack.is(ModItems.CROWBAR.get())) {
|
if (!stack.is(ModTags.Items.CROWBAR)) {
|
||||||
player.displayClientMessage(Component.translatable("des.superbwarfare.container.fail.crowbar"), true);
|
player.displayClientMessage(Component.translatable("des.superbwarfare.container.fail.crowbar"), true);
|
||||||
return InteractionResult.PASS;
|
return InteractionResult.PASS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.atsuishio.superbwarfare.block;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.block.entity.SuperbItemInterfaceBlockEntity;
|
import com.atsuishio.superbwarfare.block.entity.SuperbItemInterfaceBlockEntity;
|
||||||
import com.atsuishio.superbwarfare.init.ModBlockEntities;
|
import com.atsuishio.superbwarfare.init.ModBlockEntities;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
|
||||||
import com.atsuishio.superbwarfare.init.ModTags;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.mojang.serialization.MapCodec;
|
import com.mojang.serialization.MapCodec;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
|
@ -82,7 +81,7 @@ public class SuperbItemInterfaceBlock extends BaseEntityBlock {
|
||||||
@Override
|
@Override
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
protected @NotNull ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult) {
|
protected @NotNull ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult) {
|
||||||
if (stack.is(ModItems.CROWBAR.get()) || stack.is(ModTags.Items.WRENCHES_TAG) || stack.is(ModTags.Items.WRENCH_TAG)) {
|
if (stack.is(ModTags.Items.CROWBAR) || stack.is(ModTags.Items.WRENCHES) || stack.is(ModTags.Items.WRENCH)) {
|
||||||
var facing = hitResult.getDirection();
|
var facing = hitResult.getDirection();
|
||||||
if (state.getValue(FACING) == facing) {
|
if (state.getValue(FACING) == facing) {
|
||||||
facing = facing.getOpposite();
|
facing = facing.getOpposite();
|
||||||
|
|
|
@ -75,6 +75,8 @@ public class ModItemTagProvider extends ItemTagsProvider {
|
||||||
this.tag(cTag("plates")).addTags(cTag("plates/copper"));
|
this.tag(cTag("plates")).addTags(cTag("plates/copper"));
|
||||||
this.tag(cTag("plates/copper")).add(ModItems.COPPER_PLATE.get());
|
this.tag(cTag("plates/copper")).add(ModItems.COPPER_PLATE.get());
|
||||||
|
|
||||||
|
this.tag(cTag("tools/crowbar")).add(ModItems.CROWBAR.get());
|
||||||
|
|
||||||
// TODO 清理枪械Tag
|
// TODO 清理枪械Tag
|
||||||
ModItems.GUNS.getEntries().forEach(registryObject -> this.tag(ModTags.Items.GUN).add(registryObject.get()));
|
ModItems.GUNS.getEntries().forEach(registryObject -> this.tag(ModTags.Items.GUN).add(registryObject.get()));
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.atsuishio.superbwarfare.Mod;
|
||||||
import com.atsuishio.superbwarfare.capability.energy.SyncedEntityEnergyStorage;
|
import com.atsuishio.superbwarfare.capability.energy.SyncedEntityEnergyStorage;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.tools.FormatTool;
|
import com.atsuishio.superbwarfare.tools.FormatTool;
|
||||||
import com.atsuishio.superbwarfare.tools.SoundTool;
|
import com.atsuishio.superbwarfare.tools.SoundTool;
|
||||||
import net.minecraft.commands.arguments.EntityAnchorArgument;
|
import net.minecraft.commands.arguments.EntityAnchorArgument;
|
||||||
|
@ -35,8 +36,8 @@ import net.neoforged.neoforge.event.entity.living.LivingDeathEvent;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import software.bernie.geckolib.animatable.GeoEntity;
|
import software.bernie.geckolib.animatable.GeoEntity;
|
||||||
import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache;
|
import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache;
|
||||||
import software.bernie.geckolib.animation.AnimationState;
|
|
||||||
import software.bernie.geckolib.animation.*;
|
import software.bernie.geckolib.animation.*;
|
||||||
|
import software.bernie.geckolib.animation.AnimationState;
|
||||||
import software.bernie.geckolib.util.GeckoLibUtil;
|
import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
|
|
||||||
@EventBusSubscriber(modid = Mod.MODID)
|
@EventBusSubscriber(modid = Mod.MODID)
|
||||||
|
@ -161,7 +162,7 @@ public class DPSGeneratorEntity extends LivingEntity implements GeoEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull InteractionResult interact(Player player, @NotNull InteractionHand hand) {
|
public @NotNull InteractionResult interact(Player player, @NotNull InteractionHand hand) {
|
||||||
if (player.getMainHandItem() != ItemStack.EMPTY && player.getMainHandItem().getItem() != ModItems.CROWBAR.get()) {
|
if (player.getMainHandItem() != ItemStack.EMPTY && player.getMainHandItem().is(ModTags.Items.CROWBAR)) {
|
||||||
return InteractionResult.PASS;
|
return InteractionResult.PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.atsuishio.superbwarfare.Mod;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.tools.FormatTool;
|
import com.atsuishio.superbwarfare.tools.FormatTool;
|
||||||
import com.atsuishio.superbwarfare.tools.SoundTool;
|
import com.atsuishio.superbwarfare.tools.SoundTool;
|
||||||
import net.minecraft.commands.arguments.EntityAnchorArgument;
|
import net.minecraft.commands.arguments.EntityAnchorArgument;
|
||||||
|
@ -31,8 +32,8 @@ import net.neoforged.neoforge.event.entity.living.LivingDeathEvent;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import software.bernie.geckolib.animatable.GeoEntity;
|
import software.bernie.geckolib.animatable.GeoEntity;
|
||||||
import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache;
|
import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache;
|
||||||
import software.bernie.geckolib.animation.AnimationState;
|
|
||||||
import software.bernie.geckolib.animation.*;
|
import software.bernie.geckolib.animation.*;
|
||||||
|
import software.bernie.geckolib.animation.AnimationState;
|
||||||
import software.bernie.geckolib.util.GeckoLibUtil;
|
import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
|
|
||||||
@EventBusSubscriber(modid = Mod.MODID)
|
@EventBusSubscriber(modid = Mod.MODID)
|
||||||
|
@ -137,7 +138,7 @@ public class TargetEntity extends LivingEntity implements GeoEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull InteractionResult interact(Player player, @NotNull InteractionHand hand) {
|
public @NotNull InteractionResult interact(Player player, @NotNull InteractionHand hand) {
|
||||||
if (player.getMainHandItem() != ItemStack.EMPTY && player.getMainHandItem().getItem() != ModItems.CROWBAR.get()) {
|
if (player.getMainHandItem() != ItemStack.EMPTY && !player.getMainHandItem().is(ModTags.Items.CROWBAR)) {
|
||||||
return InteractionResult.PASS;
|
return InteractionResult.PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ import com.atsuishio.superbwarfare.event.ClientMouseHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.network.message.receive.ShakeClientMessage;
|
import com.atsuishio.superbwarfare.network.message.receive.ShakeClientMessage;
|
||||||
import com.atsuishio.superbwarfare.tools.*;
|
import com.atsuishio.superbwarfare.tools.*;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
|
@ -50,8 +51,8 @@ import net.neoforged.neoforge.capabilities.Capabilities;
|
||||||
import net.neoforged.neoforge.event.EventHooks;
|
import net.neoforged.neoforge.event.EventHooks;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.joml.Math;
|
|
||||||
import org.joml.*;
|
import org.joml.*;
|
||||||
|
import org.joml.Math;
|
||||||
import software.bernie.geckolib.animatable.GeoEntity;
|
import software.bernie.geckolib.animatable.GeoEntity;
|
||||||
import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache;
|
import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache;
|
||||||
import software.bernie.geckolib.animation.*;
|
import software.bernie.geckolib.animation.*;
|
||||||
|
@ -143,7 +144,7 @@ public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity,
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.is(ModItems.CROWBAR.get()) && !player.isCrouching()) {
|
if (stack.is(ModTags.Items.CROWBAR) && !player.isCrouching()) {
|
||||||
if (this.entityData.get(COOL_DOWN) == 0) {
|
if (this.entityData.get(COOL_DOWN) == 0) {
|
||||||
vehicleShoot(player, 0);
|
vehicleShoot(player, 0);
|
||||||
entityData.set(SHOOTER_UUID, player.getStringUUID());
|
entityData.set(SHOOTER_UUID, player.getStringUUID());
|
||||||
|
|
|
@ -340,7 +340,7 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (player.isCrouching()) {
|
} else if (player.isCrouching()) {
|
||||||
if (stack.is(ModItems.CROWBAR.get())) {
|
if (stack.is(ModTags.Items.CROWBAR)) {
|
||||||
// 无人机拆除
|
// 无人机拆除
|
||||||
ItemHandlerHelper.giveItemToPlayer(player, new ItemStack(ModItems.DRONE.get()));
|
ItemHandlerHelper.giveItemToPlayer(player, new ItemStack(ModItems.DRONE.get()));
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import com.atsuishio.superbwarfare.entity.vehicle.weapon.VehicleWeapon;
|
||||||
import com.atsuishio.superbwarfare.event.ClientMouseHandler;
|
import com.atsuishio.superbwarfare.event.ClientMouseHandler;
|
||||||
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.ContainerBlockItem;
|
import com.atsuishio.superbwarfare.item.ContainerBlockItem;
|
||||||
import com.atsuishio.superbwarfare.tools.*;
|
import com.atsuishio.superbwarfare.tools.*;
|
||||||
import com.mojang.math.Axis;
|
import com.mojang.math.Axis;
|
||||||
|
@ -155,7 +156,7 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
public @NotNull InteractionResult interact(Player player, @NotNull InteractionHand hand) {
|
public @NotNull InteractionResult interact(Player player, @NotNull InteractionHand hand) {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
if (player.isCrouching()) {
|
if (player.isCrouching()) {
|
||||||
if (stack.is(ModItems.CROWBAR.get()) && (getOwner() == null || player == getOwner())) {
|
if (stack.is(ModTags.Items.CROWBAR) && (getOwner() == null || player == getOwner())) {
|
||||||
ItemStack container = ContainerBlockItem.createInstance(this);
|
ItemStack container = ContainerBlockItem.createInstance(this);
|
||||||
if (!player.addItem(container)) {
|
if (!player.addItem(container)) {
|
||||||
player.drop(container, false);
|
player.drop(container, false);
|
||||||
|
|
|
@ -7,8 +7,8 @@ import com.atsuishio.superbwarfare.entity.vehicle.base.AutoAimable;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.EnergyVehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.EnergyVehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
||||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
|
||||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.ContainerBlockItem;
|
import com.atsuishio.superbwarfare.item.ContainerBlockItem;
|
||||||
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
||||||
import com.atsuishio.superbwarfare.tools.EntityFindUtil;
|
import com.atsuishio.superbwarfare.tools.EntityFindUtil;
|
||||||
|
@ -41,8 +41,8 @@ import org.jetbrains.annotations.Nullable;
|
||||||
import org.joml.Math;
|
import org.joml.Math;
|
||||||
import software.bernie.geckolib.animatable.GeoEntity;
|
import software.bernie.geckolib.animatable.GeoEntity;
|
||||||
import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache;
|
import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache;
|
||||||
import software.bernie.geckolib.animation.AnimationState;
|
|
||||||
import software.bernie.geckolib.animation.*;
|
import software.bernie.geckolib.animation.*;
|
||||||
|
import software.bernie.geckolib.animation.AnimationState;
|
||||||
import software.bernie.geckolib.util.GeckoLibUtil;
|
import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
@ -135,7 +135,7 @@ public class LaserTowerEntity extends EnergyVehicleEntity implements GeoEntity,
|
||||||
public @NotNull InteractionResult interact(Player player, @NotNull InteractionHand hand) {
|
public @NotNull InteractionResult interact(Player player, @NotNull InteractionHand hand) {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
if (player.isCrouching()) {
|
if (player.isCrouching()) {
|
||||||
if (stack.is(ModItems.CROWBAR.get()) && (getOwner() == null || player == getOwner())) {
|
if (stack.is(ModTags.Items.CROWBAR) && (getOwner() == null || player == getOwner())) {
|
||||||
ItemStack container = ContainerBlockItem.createInstance(this);
|
ItemStack container = ContainerBlockItem.createInstance(this);
|
||||||
if (!player.addItem(container)) {
|
if (!player.addItem(container)) {
|
||||||
player.drop(container, false);
|
player.drop(container, false);
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.item.ArtilleryIndicator;
|
import com.atsuishio.superbwarfare.item.ArtilleryIndicator;
|
||||||
import com.atsuishio.superbwarfare.item.Monitor;
|
import com.atsuishio.superbwarfare.item.Monitor;
|
||||||
import com.atsuishio.superbwarfare.item.common.ammo.MortarShell;
|
import com.atsuishio.superbwarfare.item.common.ammo.MortarShell;
|
||||||
|
@ -181,7 +182,7 @@ public class MortarEntity extends VehicleEntity implements GeoEntity, Container
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.isShiftKeyDown()) {
|
if (player.isShiftKeyDown()) {
|
||||||
if (mainHandItem.getItem() == ModItems.CROWBAR.get()) {
|
if (mainHandItem.is(ModTags.Items.CROWBAR)) {
|
||||||
this.discard();
|
this.discard();
|
||||||
ItemHandlerHelper.giveItemToPlayer(player, new ItemStack(ModItems.MORTAR_DEPLOYER.get()));
|
ItemHandlerHelper.giveItemToPlayer(player, new ItemStack(ModItems.MORTAR_DEPLOYER.get()));
|
||||||
if (entityData.get(INTELLIGENT)) {
|
if (entityData.get(INTELLIGENT)) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.atsuishio.superbwarfare.entity.vehicle.base;
|
package com.atsuishio.superbwarfare.entity.vehicle.base;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModTags;
|
||||||
import com.atsuishio.superbwarfare.menu.VehicleMenu;
|
import com.atsuishio.superbwarfare.menu.VehicleMenu;
|
||||||
import com.atsuishio.superbwarfare.tools.InventoryTool;
|
import com.atsuishio.superbwarfare.tools.InventoryTool;
|
||||||
import net.minecraft.core.NonNullList;
|
import net.minecraft.core.NonNullList;
|
||||||
|
@ -54,7 +54,7 @@ public abstract class ContainerMobileVehicleEntity extends MobileVehicleEntity i
|
||||||
if (player.getVehicle() == this) return InteractionResult.PASS;
|
if (player.getVehicle() == this) return InteractionResult.PASS;
|
||||||
|
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
if (player.isShiftKeyDown() && !stack.is(ModItems.CROWBAR.get())) {
|
if (player.isShiftKeyDown() && !stack.is(ModTags.Items.CROWBAR)) {
|
||||||
player.openMenu(this);
|
player.openMenu(this);
|
||||||
return !player.level().isClientSide ? InteractionResult.CONSUME : InteractionResult.SUCCESS;
|
return !player.level().isClientSide ? InteractionResult.CONSUME : InteractionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -416,7 +416,7 @@ public abstract class VehicleEntity extends Entity {
|
||||||
var data = data();
|
var data = data();
|
||||||
|
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
if (player.isShiftKeyDown() && stack.is(ModItems.CROWBAR.get()) && this.getPassengers().isEmpty()) {
|
if (player.isShiftKeyDown() && stack.is(ModTags.Items.CROWBAR) && this.getPassengers().isEmpty()) {
|
||||||
ItemStack container = ContainerBlockItem.createInstance(this);
|
ItemStack container = ContainerBlockItem.createInstance(this);
|
||||||
if (!player.addItem(container)) {
|
if (!player.addItem(container)) {
|
||||||
player.drop(container, false);
|
player.drop(container, false);
|
||||||
|
|
|
@ -43,8 +43,9 @@ public class ModTags {
|
||||||
public static final TagKey<Item> LEGENDARY_BLUEPRINT = tag("blueprint/legendary");
|
public static final TagKey<Item> LEGENDARY_BLUEPRINT = tag("blueprint/legendary");
|
||||||
public static final TagKey<Item> CANNON_BLUEPRINT = tag("blueprint/cannon");
|
public static final TagKey<Item> CANNON_BLUEPRINT = tag("blueprint/cannon");
|
||||||
|
|
||||||
public static final TagKey<Item> WRENCHES_TAG = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "wrenches"));
|
public static final TagKey<Item> WRENCHES = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "wrenches"));
|
||||||
public static final TagKey<Item> WRENCH_TAG = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "tools/wrench"));
|
public static final TagKey<Item> WRENCH = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "tools/wrench"));
|
||||||
|
public static final TagKey<Item> CROWBAR = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "tools/crowbar"));
|
||||||
|
|
||||||
private static TagKey<Item> tag(String name) {
|
private static TagKey<Item> tag(String name) {
|
||||||
return ItemTags.create(Mod.loc(name));
|
return ItemTags.create(Mod.loc(name));
|
||||||
|
|
Loading…
Add table
Reference in a new issue