阻止钢管物品上下浮动
This commit is contained in:
parent
b70dc45286
commit
b71a639814
1 changed files with 17 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
|||
package com.atsuishio.superbwarfare.item;
|
||||
|
||||
import com.atsuishio.superbwarfare.Mod;
|
||||
import com.atsuishio.superbwarfare.init.ModItems;
|
||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||
import com.atsuishio.superbwarfare.tiers.ModItemTier;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
|
@ -7,8 +9,13 @@ import net.minecraft.world.entity.LivingEntity;
|
|||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.SwordItem;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.common.EventBusSubscriber;
|
||||
import net.neoforged.neoforge.client.extensions.common.IClientItemExtensions;
|
||||
import net.neoforged.neoforge.client.extensions.common.RegisterClientExtensionsEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@EventBusSubscriber(modid = Mod.MODID, bus = EventBusSubscriber.Bus.MOD)
|
||||
public class SteelPipe extends SwordItem {
|
||||
public SteelPipe() {
|
||||
super(ModItemTier.STEEL, new Item.Properties()
|
||||
|
@ -22,4 +29,14 @@ public class SteelPipe extends SwordItem {
|
|||
pAttacker.level().playSound(null, pTarget.getOnPos(), ModSounds.STEEL_PIPE_HIT.get(), SoundSource.PLAYERS, 1, (float) ((2 * org.joml.Math.random() - 1) * 0.1f + 1.0f));
|
||||
return super.hurtEnemy(pStack, pTarget, pAttacker);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
private static void registerItemExtensions(RegisterClientExtensionsEvent event) {
|
||||
event.registerItem(new IClientItemExtensions() {
|
||||
@Override
|
||||
public boolean shouldBobAsEntity(@NotNull ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
}, ModItems.STEEL_PIPE);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue