Search in sources :

Example 6 with TileEntityChestMP

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

the class SpaceDoubleChestItemHandlerMP method equals.

@Override
public boolean equals(Object o) {
    if (this == o) {
        return true;
    }
    if (o == null || this.getClass() != o.getClass()) {
        return false;
    }
    SpaceDoubleChestItemHandlerMP that = (SpaceDoubleChestItemHandlerMP) o;
    if (this.hashCode != that.hashCode) {
        return false;
    }
    TileEntityChestMP otherChest = this.getOtherChest();
    if (this.mainChestIsUpper == that.mainChestIsUpper) {
        return Objects.equal(this.mainChest, that.mainChest) && Objects.equal(otherChest, that.getOtherChest());
    } else {
        return Objects.equal(this.mainChest, that.getOtherChest()) && Objects.equal(otherChest, that.mainChest);
    }
}
Also used : TileEntityChestMP(stevekung.mods.moreplanets.util.tileentity.TileEntityChestMP)

Example 7 with TileEntityChestMP

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

the class StructureNibiruJungleTemplePieces method generateChest.

@Override
protected boolean generateChest(World world, StructureBoundingBox box, Random rand, int x, int y, int z, ResourceLocation loot) {
    BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));
    if (box.isVecInside(blockpos) && world.getBlockState(blockpos).getBlock() != NibiruBlocks.INFECTED_CHEST) {
        IBlockState iblockstate = NibiruBlocks.INFECTED_CHEST.getDefaultState();
        world.setBlockState(blockpos, NibiruBlocks.INFECTED_CHEST.correctFacing(world, blockpos, iblockstate), 2);
        TileEntity tileentity = world.getTileEntity(blockpos);
        if (tileentity instanceof TileEntityChestMP) {
            ((TileEntityChestMP) tileentity).setLootTable(loot, rand.nextLong());
        }
        return true;
    } else {
        return false;
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) IBlockState(net.minecraft.block.state.IBlockState) TileEntityChestMP(stevekung.mods.moreplanets.util.tileentity.TileEntityChestMP) BlockPos(net.minecraft.util.math.BlockPos)

Example 8 with TileEntityChestMP

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

the class StructureNibiruPyramidPieces method generateChest.

@Override
protected boolean generateChest(World world, StructureBoundingBox box, Random randomIn, int x, int y, int z, ResourceLocation loot) {
    BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));
    if (box.isVecInside(blockpos) && world.getBlockState(blockpos).getBlock() != NibiruBlocks.INFECTED_CHEST) {
        IBlockState iblockstate = NibiruBlocks.INFECTED_CHEST.getDefaultState();
        world.setBlockState(blockpos, NibiruBlocks.INFECTED_CHEST.correctFacing(world, blockpos, iblockstate), 2);
        TileEntity tileentity = world.getTileEntity(blockpos);
        if (tileentity instanceof TileEntityChestMP) {
            ((TileEntityChestMP) tileentity).setLootTable(loot, randomIn.nextLong());
        }
        return true;
    } else {
        return false;
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) IBlockState(net.minecraft.block.state.IBlockState) TileEntityChestMP(stevekung.mods.moreplanets.util.tileentity.TileEntityChestMP) BlockPos(net.minecraft.util.math.BlockPos)

Aggregations

TileEntityChestMP (stevekung.mods.moreplanets.util.tileentity.TileEntityChestMP)8 TileEntity (net.minecraft.tileentity.TileEntity)4 BlockPos (net.minecraft.util.math.BlockPos)4 IBlockState (net.minecraft.block.state.IBlockState)2 Block (net.minecraft.block.Block)1 EnumFacing (net.minecraft.util.EnumFacing)1 World (net.minecraft.world.World)1