use of moriyashiine.bewitchment.api.item.PoppetItem in project bewitchment by MoriyaShiine.
the class ItemEntityMixin method bewitchment$stopPoppetsFromFloating.
@Inject(method = "applyWaterBuoyancy", at = @At("HEAD"), cancellable = true)
private void bewitchment$stopPoppetsFromFloating(CallbackInfo ci) {
if (getStack().getItem() instanceof PoppetItem) {
Vec3d velocity = getVelocity();
setVelocity(velocity.x * 0.99, velocity.y * 0.9, velocity.z * 0.99);
ci.cancel();
}
}
use of moriyashiine.bewitchment.api.item.PoppetItem in project bewitchment by MoriyaShiine.
the class PoppetShelfBlockEntity method onUse.
public void onUse(World world, BlockPos pos, PlayerEntity player, Hand hand) {
BWWorldState worldState = BWWorldState.get(world);
ItemStack stack = player.getStackInHand(hand);
if (stack.getItem() instanceof PoppetItem) {
int firstEmpty = getFirstEmptySlot();
if (firstEmpty != -1) {
DefaultedList<ItemStack> inventory = worldState.poppetShelves.get(pos.asLong());
inventory.set(firstEmpty, stack.split(1));
sync();
worldState.markDirty();
}
} else {
DefaultedList<ItemStack> inventory = worldState.poppetShelves.get(pos.asLong());
if (inventory != null) {
ItemScatterer.spawn(world, pos, inventory);
worldState.poppetShelves.remove(pos.asLong());
sync();
worldState.markDirty();
}
}
}
Aggregations