Search in sources :

Example 1 with IEntangledStack

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);
}
Also used : TileMechanicalTranslocator(arekkuusu.solar.common.block.tile.TileMechanicalTranslocator) IEntangledStack(arekkuusu.solar.api.entanglement.IEntangledStack) ItemStack(net.minecraft.item.ItemStack)

Example 2 with IEntangledStack

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);
        });
    }
}
Also used : TileMechanicalTranslocator(arekkuusu.solar.common.block.tile.TileMechanicalTranslocator) IEntangledStack(arekkuusu.solar.api.entanglement.IEntangledStack)

Example 3 with IEntangledStack

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);
        });
    }
}
Also used : IEntangledStack(arekkuusu.solar.api.entanglement.IEntangledStack) TileQuantumMirror(arekkuusu.solar.common.block.tile.TileQuantumMirror)

Example 4 with IEntangledStack

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);
}
Also used : IEntangledStack(arekkuusu.solar.api.entanglement.IEntangledStack) TileAlternator(arekkuusu.solar.common.block.tile.TileAlternator) ItemStack(net.minecraft.item.ItemStack)

Example 5 with IEntangledStack

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);
}
Also used : IEntangledStack(arekkuusu.solar.api.entanglement.IEntangledStack) TileBlinker(arekkuusu.solar.common.block.tile.TileBlinker) ItemStack(net.minecraft.item.ItemStack)

Aggregations

IEntangledStack (arekkuusu.solar.api.entanglement.IEntangledStack)15 ItemStack (net.minecraft.item.ItemStack)8 TileQelaion (arekkuusu.solar.common.block.tile.TileQelaion)3 TileAlternator (arekkuusu.solar.common.block.tile.TileAlternator)2 TileBlinker (arekkuusu.solar.common.block.tile.TileBlinker)2 TileMechanicalTranslocator (arekkuusu.solar.common.block.tile.TileMechanicalTranslocator)2 TileNeutronBattery (arekkuusu.solar.common.block.tile.TileNeutronBattery)2 TileQimranut (arekkuusu.solar.common.block.tile.TileQimranut)2 TileQuantumMirror (arekkuusu.solar.common.block.tile.TileQuantumMirror)2 UUID (java.util.UUID)2 EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 ILumen (arekkuusu.solar.api.entanglement.energy.data.ILumen)1 NBTHelper (arekkuusu.solar.api.helper.NBTHelper)1 Direction (arekkuusu.solar.api.state.Direction)1 FixedMaterial (arekkuusu.solar.api.util.FixedMaterial)1 FXUtil (arekkuusu.solar.client.effect.FXUtil)1 Light (arekkuusu.solar.client.effect.Light)1 DummyBakedRegistry (arekkuusu.solar.client.util.baker.DummyBakedRegistry)1 BakedQelaion (arekkuusu.solar.client.util.baker.baked.BakedQelaion)1 ModelHandler (arekkuusu.solar.client.util.helper.ModelHandler)1