use of arekkuusu.solar.api.entanglement.IEntangledStack in project Solar by ArekkuusuJerii.
the class BlockMechanicalTranslocator method getItem.
@Override
public ItemStack getItem(World world, BlockPos pos, IBlockState state) {
Optional<TileMechanicalTranslocator> optional = getTile(TileMechanicalTranslocator.class, world, pos);
if (optional.isPresent()) {
TileMechanicalTranslocator tile = optional.get();
ItemStack stack = new ItemStack(Item.getItemFromBlock(this));
tile.getKey().ifPresent(uuid -> {
((IEntangledStack) stack.getItem()).setKey(stack, uuid);
});
return stack;
}
return super.getItem(world, pos, state);
}
use of arekkuusu.solar.api.entanglement.IEntangledStack in project Solar by ArekkuusuJerii.
the class BlockMechanicalTranslocator method onBlockPlacedBy.
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
if (!world.isRemote) {
getTile(TileMechanicalTranslocator.class, world, pos).ifPresent(tile -> {
IEntangledStack entangled = (IEntangledStack) stack.getItem();
if (!entangled.getKey(stack).isPresent()) {
entangled.setKey(stack, UUID.randomUUID());
}
entangled.getKey(stack).ifPresent(tile::setKey);
});
}
}
use of arekkuusu.solar.api.entanglement.IEntangledStack in project Solar by ArekkuusuJerii.
the class BlockQuantumMirror method onBlockPlacedBy.
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
if (!world.isRemote) {
getTile(TileQuantumMirror.class, world, pos).ifPresent(mirror -> {
IEntangledStack entangled = (IEntangledStack) stack.getItem();
if (!entangled.getKey(stack).isPresent()) {
entangled.setKey(stack, UUID.randomUUID());
}
entangled.getKey(stack).ifPresent(mirror::setKey);
});
}
}
use of arekkuusu.solar.api.entanglement.IEntangledStack in project Solar by ArekkuusuJerii.
the class BlockAlternator method getItem.
@Override
public ItemStack getItem(World world, BlockPos pos, IBlockState state) {
Optional<TileAlternator> optional = getTile(TileAlternator.class, world, pos);
if (optional.isPresent()) {
TileAlternator alternator = optional.get();
ItemStack stack = new ItemStack(Item.getItemFromBlock(this));
alternator.getKey().ifPresent(uuid -> {
((IEntangledStack) stack.getItem()).setKey(stack, uuid);
});
return stack;
}
return super.getItem(world, pos, state);
}
use of arekkuusu.solar.api.entanglement.IEntangledStack in project Solar by ArekkuusuJerii.
the class BlockBlinker method getItem.
@Override
public ItemStack getItem(World world, BlockPos pos, IBlockState state) {
Optional<TileBlinker> optional = getTile(TileBlinker.class, world, pos);
if (optional.isPresent()) {
TileBlinker blinker = optional.get();
ItemStack stack = new ItemStack(Item.getItemFromBlock(this));
blinker.getKey().ifPresent(uuid -> {
((IEntangledStack) stack.getItem()).setKey(stack, uuid);
});
return stack;
}
return super.getItem(world, pos, state);
}
Aggregations