use of pl.asie.charset.lib.material.ItemMaterial in project Charset by CharsetMC.
the class EntityBoatCharset method updateFallState.
@Override
protected void updateFallState(double y, boolean onGroundIn, IBlockState state, BlockPos pos) {
captureDrops = true;
super.updateFallState(y, onGroundIn, state, pos);
captureDrops = false;
if (!world.isRemote) {
ItemMaterial stickMaterial = material.getRelated("stick");
if (stickMaterial == null) {
stickMaterial = ItemMaterialRegistry.INSTANCE.getOrCreateMaterial(new ItemStack(Items.STICK));
}
for (EntityItem entityItem : capturedDrops) {
if (entityItem.getItem().getItem() == Item.getItemFromBlock(Blocks.PLANKS)) {
ItemStack newStack = material.getStack().copy();
newStack.setCount(entityItem.getItem().getCount());
entityItem.setItem(newStack);
} else if (entityItem.getItem().getItem() == Items.STICK) {
ItemStack newStack = stickMaterial.getStack().copy();
newStack.setCount(entityItem.getItem().getCount());
entityItem.setItem(newStack);
}
world.spawnEntity(entityItem);
}
}
capturedDrops.clear();
}
Aggregations