Eternal Crystal item & model
This commit is contained in:
parent
7192df49d1
commit
3b31532fea
10 changed files with 225 additions and 19 deletions
|
@ -12,6 +12,7 @@ import net.minecraft.util.Tickable;
|
|||
import net.minecraft.world.World;
|
||||
import ru.betterend.blocks.basis.BlockPedestal;
|
||||
import ru.betterend.registry.EndBlockEntities;
|
||||
import ru.betterend.registry.EndItems;
|
||||
|
||||
public class PedestalBlockEntity extends BlockEntity implements Inventory, Tickable {
|
||||
private ItemStack activeItem = ItemStack.EMPTY;
|
||||
|
@ -70,7 +71,8 @@ public class PedestalBlockEntity extends BlockEntity implements Inventory, Ticka
|
|||
}
|
||||
|
||||
public void removeStack(World world, BlockState state) {
|
||||
world.setBlockState(pos, state.with(BlockPedestal.HAS_ITEM, false));
|
||||
world.setBlockState(pos, state.with(BlockPedestal.HAS_ITEM, false)
|
||||
.with(BlockPedestal.HAS_LIGHT, false));
|
||||
this.removeStack(0);
|
||||
}
|
||||
|
||||
|
@ -82,6 +84,11 @@ public class PedestalBlockEntity extends BlockEntity implements Inventory, Ticka
|
|||
|
||||
public void setStack(World world, BlockState state, ItemStack stack) {
|
||||
world.setBlockState(pos, state.with(BlockPedestal.HAS_ITEM, true));
|
||||
if (stack.getItem() == EndItems.ETERNAL_CRYSTAL) {
|
||||
world.setBlockState(pos, state.with(BlockPedestal.HAS_LIGHT, true));
|
||||
} else {
|
||||
world.setBlockState(pos, state.with(BlockPedestal.HAS_LIGHT, false));
|
||||
}
|
||||
this.setStack(0, stack);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import net.minecraft.item.Items;
|
|||
import net.minecraft.util.DyeColor;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import ru.betterend.blocks.EternalPedestal;
|
||||
import ru.betterend.blocks.basis.BlockPedestal;
|
||||
import ru.betterend.blocks.entities.PedestalBlockEntity;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue