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();
}
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;
}
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);
}
}
}
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;
}
Aggregations