Search in sources :

Example 6 with TileEntityAncientChestMP

use of stevekung.mods.moreplanets.util.tileentity.TileEntityAncientChestMP in project MorePlanets by SteveKunG.

the class DoubleAncientChestItemHandlerMP method insertItem.

@Override
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
    boolean accessingUpperChest = slot < 27;
    int targetSlot = accessingUpperChest ? slot : slot - 27;
    TileEntityAncientChestMP chest = this.getChest(accessingUpperChest);
    return chest != null ? chest.getSingleChestHandler().insertItem(targetSlot, stack, simulate) : stack;
}
Also used : TileEntityAncientChestMP(stevekung.mods.moreplanets.util.tileentity.TileEntityAncientChestMP)

Example 7 with TileEntityAncientChestMP

use of stevekung.mods.moreplanets.util.tileentity.TileEntityAncientChestMP in project MorePlanets by SteveKunG.

the class DoubleAncientChestItemHandlerMP method extractItem.

@Override
public ItemStack extractItem(int slot, int amount, boolean simulate) {
    boolean accessingUpperChest = slot < 27;
    int targetSlot = accessingUpperChest ? slot : slot - 27;
    TileEntityAncientChestMP chest = this.getChest(accessingUpperChest);
    return chest != null ? chest.getSingleChestHandler().extractItem(targetSlot, amount, simulate) : ItemStack.EMPTY;
}
Also used : TileEntityAncientChestMP(stevekung.mods.moreplanets.util.tileentity.TileEntityAncientChestMP)

Example 8 with TileEntityAncientChestMP

use of stevekung.mods.moreplanets.util.tileentity.TileEntityAncientChestMP in project MorePlanets by SteveKunG.

the class RoomChestNibiru method addComponentParts.

@Override
public boolean addComponentParts(World world, Random rand, StructureBoundingBox boundingBox) {
    if (super.addComponentParts(world, rand, boundingBox)) {
        int chestX = this.sizeX / 2;
        int chestY = 1;
        int chestZ = this.sizeZ / 2;
        this.setBlockState(world, this.configuration.getAncientChestBlock().withProperty(BlockStateHelper.FACING_HORIZON, this.getDirection().getOpposite()), chestX, chestY, chestZ, boundingBox);
        BlockPos blockpos = new BlockPos(this.getXWithOffset(chestX, chestZ), this.getYWithOffset(chestY), this.getZWithOffset(chestX, chestZ));
        TileEntityAncientChestMP chest = (TileEntityAncientChestMP) world.getTileEntity(blockpos);
        if (chest != null) {
            chest.setLootTable(MPLootTables.COMMON_SPACE_DUNGEON, rand.nextLong());
        }
        return true;
    }
    return false;
}
Also used : TileEntityAncientChestMP(stevekung.mods.moreplanets.util.tileentity.TileEntityAncientChestMP) BlockPos(net.minecraft.util.math.BlockPos)

Aggregations

TileEntityAncientChestMP (stevekung.mods.moreplanets.util.tileentity.TileEntityAncientChestMP)8 BlockPos (net.minecraft.util.math.BlockPos)4 TileEntity (net.minecraft.tileentity.TileEntity)2 EnumFacing (net.minecraft.util.EnumFacing)2 Iterator (java.util.Iterator)1 Block (net.minecraft.block.Block)1 Material (net.minecraft.block.material.Material)1 TileEntityMobSpawner (net.minecraft.tileentity.TileEntityMobSpawner)1 World (net.minecraft.world.World)1