Search in sources :

Example 1 with TileEntitySkull

use of net.minecraft.tileentity.TileEntitySkull in project SpongeCommon by SpongePowered.

the class SkullRepresentedPlayerDataProcessor method removeFrom.

@Override
public DataTransactionResult removeFrom(ValueContainer<?> container) {
    if (supports(container)) {
        TileEntitySkull skull = (TileEntitySkull) container;
        Optional<GameProfile> old = getVal(skull);
        if (!old.isPresent()) {
            return DataTransactionResult.successNoData();
        }
        if (SkullUtils.setProfile(skull, null)) {
            return DataTransactionResult.successRemove(constructImmutableValue(old.get()));
        }
        return DataTransactionResult.builder().result(DataTransactionResult.Type.ERROR).build();
    }
    return DataTransactionResult.failNoData();
}
Also used : GameProfile(org.spongepowered.api.profile.GameProfile) TileEntitySkull(net.minecraft.tileentity.TileEntitySkull)

Example 2 with TileEntitySkull

use of net.minecraft.tileentity.TileEntitySkull in project Bewitchment by Um-Mitternacht.

the class TileEntityWitchAltar method getGain.

private int getGain(BlockPos pos, boolean[] types) {
    IBlockState blockState = getWorld().getBlockState(pos);
    if (blockState.getBlock().equals(Blocks.SKULL)) {
        if (types[0])
            return 0;
        types[0] = true;
        TileEntitySkull tes = (TileEntitySkull) world.getTileEntity(pos);
        switch(tes.getSkullType()) {
            case 0:
            case 2:
            case 4:
                // Zombie, Skeleton and creeper
                return 1;
            case 1:
            case 3:
                // Wither skull and player skull
                return 2;
            case 5:
                // Ender dragon
                return 4;
            default:
                return 0;
        }
    } else if (blockState.getBlock().equals(Blocks.TORCH)) {
        if (types[1])
            return 0;
        types[1] = true;
        return 1;
    } else if (blockState.getBlock().equals(Blocks.FLOWER_POT)) {
        if (blockState.getBlock().hasTileEntity(blockState)) {
            TileEntityFlowerPot tefp = (TileEntityFlowerPot) world.getTileEntity(pos);
            if (!tefp.getFlowerItemStack().isEmpty()) {
                if (types[2])
                    return 0;
                types[2] = true;
                return 1;
            }
        }
    // TODO: Change the way gems are stored on an altar. Use a ritual plate. Pick them up via the oredict, to increase mod support.
    } else if (blockState.getBlock().equals(Blocks.DIAMOND_BLOCK)) {
        return 325;
    } else if (blockState.getBlock().equals(Blocks.EMERALD_BLOCK)) {
        return 275;
    } else if (blockState.getBlock().equals(ModBlocks.moldavite_block)) {
        return 225;
    } else if (blockState.getBlock().equals(ModBlocks.alexandrite_block)) {
        return 225;
    } else if (blockState.getBlock().equals(ModBlocks.nuummite_block)) {
        return 225;
    } else if (blockState.getBlock().equals(ModBlocks.garnet_block)) {
        return 225;
    } else if (blockState.getBlock().equals(ModBlocks.amethyst_block)) {
        return 225;
    } else if (blockState.getBlock().equals(ModBlocks.tourmaline_block)) {
        return 225;
    } else if (blockState.getBlock().equals(ModBlocks.tigers_eye_block)) {
        return 225;
    } else if (blockState.getBlock().equals(ModBlocks.malachite_block)) {
        return 225;
    } else if (blockState.getBlock().equals(ModBlocks.bloodstone_block)) {
        return 225;
    } else if (blockState.getBlock().equals(ModBlocks.jasper_block)) {
        return 225;
    } else if (blockState.getBlock().equals(Blocks.LAPIS_BLOCK)) {
        return 225;
    } else if (blockState.getBlock().equals(Blocks.QUARTZ_BLOCK)) {
        return 225;
    } else if (blockState.getBlock().equals(Blocks.REDSTONE_BLOCK)) {
        return 200;
    } else if (blockState.getBlock() instanceof BlockCandle) {
        if (types[1])
            return 0;
        types[1] = true;
        return 2;
    // } else if (blockState.getBlock().equals(ModBlocks.ritual_candle)) {
    // if (types[1]) return 0;
    // types[1]=true;
    // return 2;
    }
    return 0;
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) BlockCandle(com.bewitchment.common.block.tools.BlockCandle) TileEntitySkull(net.minecraft.tileentity.TileEntitySkull) TileEntityFlowerPot(net.minecraft.tileentity.TileEntityFlowerPot)

Example 3 with TileEntitySkull

use of net.minecraft.tileentity.TileEntitySkull in project BetterWithAddons by DaedalusGame.

the class RenewablesHandler method makeBlazeGolem.

@SubscribeEvent
public void makeBlazeGolem(BlockEvent.NeighborNotifyEvent event) {
    World world = event.getWorld();
    BlockPos pos = event.getPos();
    IBlockState head = event.getState();
    if (!world.isRemote && InteractionBWR.BLAZE_GOLEMS && head.getBlock() == Blocks.SKULL) {
        TileEntity te = world.getTileEntity(pos);
        if (!(te instanceof TileEntitySkull) || ((TileEntitySkull) te).getSkullType() != 0)
            return;
        BlockPos body = pos.down();
        BlockPos feet = pos.down(2);
        if (world.getBlockState(body).getBlock() == Blocks.GOLD_BLOCK && world.getBlockState(body.north()).getBlock() == Blocks.IRON_BARS && world.getBlockState(body.south()).getBlock() == Blocks.IRON_BARS && world.getBlockState(body.east()).getBlock() == Blocks.IRON_BARS && world.getBlockState(body.west()).getBlock() == Blocks.IRON_BARS && world.getBlockState(feet).getMaterial() == Material.FIRE) {
            world.setBlockToAir(pos);
            world.setBlockToAir(body);
            world.setBlockToAir(body.north());
            world.setBlockToAir(body.south());
            world.setBlockToAir(body.east());
            world.setBlockToAir(body.west());
            world.setBlockToAir(feet);
            spawnArtificalBlaze(world, feet, true);
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) IBlockState(net.minecraft.block.state.IBlockState) TileEntitySkull(net.minecraft.tileentity.TileEntitySkull) BlockPos(net.minecraft.util.math.BlockPos) World(net.minecraft.world.World) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 4 with TileEntitySkull

use of net.minecraft.tileentity.TileEntitySkull in project Bewitchment by Um-Mitternacht.

the class TileEntityWitchAltar method getMultiplier.

private double getMultiplier(BlockPos pos, boolean[] typesMult) {
    IBlockState blockState = getWorld().getBlockState(pos);
    if (blockState.getBlock().equals(Blocks.SKULL)) {
        if (typesMult[0])
            return 0;
        typesMult[0] = true;
        TileEntitySkull tes = (TileEntitySkull) world.getTileEntity(pos);
        switch(tes.getSkullType()) {
            case 0:
                // Skeleton
                return 0.05;
            case 1:
            case 3:
                // Wither skull and player skull
                return 0.3;
            case 5:
                // Ender dragon
                return 0.8;
            default:
                return 0;
        }
    } else if (blockState.getBlock().equals(Blocks.DIAMOND_BLOCK)) {
        return 125;
    } else if (blockState.getBlock().equals(Blocks.EMERALD_BLOCK)) {
        return 100;
    } else if (blockState.getBlock().equals(ModBlocks.moldavite_block)) {
        return 75;
    } else if (blockState.getBlock().equals(ModBlocks.alexandrite_block)) {
        return 75;
    } else if (blockState.getBlock().equals(ModBlocks.nuummite_block)) {
        return 75;
    } else if (blockState.getBlock().equals(ModBlocks.garnet_block)) {
        return 75;
    } else if (blockState.getBlock().equals(ModBlocks.amethyst_block)) {
        return 75;
    } else if (blockState.getBlock().equals(ModBlocks.tourmaline_block)) {
        return 75;
    } else if (blockState.getBlock().equals(ModBlocks.tigers_eye_block)) {
        return 75;
    } else if (blockState.getBlock().equals(ModBlocks.malachite_block)) {
        return 75;
    } else if (blockState.getBlock().equals(ModBlocks.bloodstone_block)) {
        return 75;
    } else if (blockState.getBlock().equals(ModBlocks.jasper_block)) {
        return 75;
    } else if (blockState.getBlock().equals(Blocks.LAPIS_BLOCK)) {
        return 75;
    } else if (blockState.getBlock().equals(Blocks.QUARTZ_BLOCK)) {
        return 75;
    } else if (blockState.getBlock().equals(Blocks.REDSTONE_BLOCK)) {
        return 50;
    } else if (blockState.getBlock().equals(ModBlocks.goblet)) {
        if (typesMult[1])
            return 0;
        typesMult[1] = true;
        if (blockState.getValue(BlockGoblet.FULL)) {
            return 0.6;
        }
        return 0.3;
    }
    return 0;
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) TileEntitySkull(net.minecraft.tileentity.TileEntitySkull)

Aggregations

TileEntitySkull (net.minecraft.tileentity.TileEntitySkull)4 IBlockState (net.minecraft.block.state.IBlockState)3 BlockCandle (com.bewitchment.common.block.tools.BlockCandle)1 TileEntity (net.minecraft.tileentity.TileEntity)1 TileEntityFlowerPot (net.minecraft.tileentity.TileEntityFlowerPot)1 BlockPos (net.minecraft.util.math.BlockPos)1 World (net.minecraft.world.World)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1 GameProfile (org.spongepowered.api.profile.GameProfile)1