Items (update 7 of 20)

This commit is contained in:
SD 2021-02-11 22:30:38 +05:30
parent 56af6420af
commit 424993db2d
No known key found for this signature in database
GPG key ID: E36B57EE08544BC5
5 changed files with 6 additions and 8 deletions

View file

@ -1,5 +1,6 @@
package org.dimdev.dimdoors.item;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@ -18,8 +19,8 @@ import org.dimdev.dimdoors.ModConfig;
import org.dimdev.dimdoors.block.entity.RiftBlockEntity;
import org.dimdev.dimdoors.sound.ModSoundEvents;
public class DimensionalEraser extends Item {
public DimensionalEraser(Settings settings) {
public class DimensionalEraserItem extends Item {
public DimensionalEraserItem(Settings settings) {
super(settings);
}
@ -30,7 +31,7 @@ public class DimensionalEraser extends Item {
HitResult hit = RaycastHelper.raycast(player, RaycastHelper.REACH_DISTANCE, 1.0F, a -> !(a instanceof PlayerEntity));
if (hit != null && hit.getType() == HitResult.Type.ENTITY) {
((EntityHitResult) hit).getEntity().remove();
((EntityHitResult) hit).getEntity().remove(Entity.RemovalReason.KILLED);
player.playSound(ModSoundEvents.BLOOP, 1.0f, 1.0f);
return new TypedActionResult<>(ActionResult.SUCCESS, stack);
}

View file

@ -21,7 +21,6 @@ public class DimensionalTrapdoorItem extends BlockItem {
this.setupFunction = setupFunction;
}
@Override
public ActionResult place(ItemPlacementContext context) {
World world = context.getWorld();

View file

@ -19,7 +19,6 @@ import org.dimdev.dimdoors.util.registry.RegistryObject;
import org.dimdev.dimdoors.world.ModDimensions;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.BlockItem;
@ -149,7 +148,7 @@ public final class ModItems {
public static final Item RIFT_STABILIZER = create(new RiftStabilizerItem(new Item.Settings().maxCount(1).maxDamage(6).group(DIMENSIONAL_DOORS)));
@RegistryObject("dimensional_eraser")
public static final Item DIMENSIONAL_ERASER = create(new DimensionalEraser(new Item.Settings().maxDamage(100).group(DIMENSIONAL_DOORS)));
public static final Item DIMENSIONAL_ERASER = create(new DimensionalEraserItem(new Item.Settings().maxDamage(100).group(DIMENSIONAL_DOORS)));
@RegistryObject("monolith_spawner")
public static final Item MONOLITH_SPAWNER = new SpawnEggItem(ModEntityTypes.MONOLITH, 0xffffff, 0xffffff, new Item.Settings().group(ItemGroup.MISC));

View file

@ -151,7 +151,7 @@ public class RiftConfigurationToolItem extends Item {
if (hand == Hand.OFF_HAND) {
packet = new PlayerInventorySlotUpdateS2CPacket(45, stack);
} else {
packet = new PlayerInventorySlotUpdateS2CPacket(serverPlayer.inventory.selectedSlot, stack);
packet = new PlayerInventorySlotUpdateS2CPacket(serverPlayer.getInventory().selectedSlot, stack);
}
PacketByteBuf buf = PacketByteBufs.create();
try {

View file

@ -38,7 +38,6 @@ public class RiftRemoverItem extends Item {
list.add(new TranslatableText(this.getTranslationKey() + ".info"));
}
@Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) {
ItemStack stack = player.getStackInHand(hand);