Changed formatting to have bracing on a new line

This commit is contained in:
WayofTime 2015-12-30 15:34:40 -05:00
parent e5eddd6c45
commit e48eedb874
189 changed files with 6092 additions and 4041 deletions

View file

@ -23,76 +23,90 @@ import WayofTime.bloodmagic.tile.TileAlchemyArray;
import WayofTime.bloodmagic.tile.TileAlchemyArray;
import WayofTime.bloodmagic.util.Utils;
public class BlockAlchemyArray extends BlockContainer {
public class BlockAlchemyArray extends BlockContainer
{
public BlockAlchemyArray() {
super(Material.cloth);
public BlockAlchemyArray()
{
super(Material.cloth);
setUnlocalizedName(Constants.Mod.MODID + ".alchemyArray");
setCreativeTab(BloodMagic.tabBloodMagic);
this.setHardness(0.1f);
}
setUnlocalizedName(Constants.Mod.MODID + ".alchemyArray");
setCreativeTab(BloodMagic.tabBloodMagic);
this.setHardness(0.1f);
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public EnumWorldBlockLayer getBlockLayer() {
return EnumWorldBlockLayer.CUTOUT;
}
@Override
@SideOnly(Side.CLIENT)
public EnumWorldBlockLayer getBlockLayer()
{
return EnumWorldBlockLayer.CUTOUT;
}
@Override
public boolean isFullCube() {
return false;
}
@Override
public boolean isFullCube()
{
return false;
}
@Override
public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) {
this.setBlockBounds(0, 0, 0, 1, 0.1f, 1);
}
@Override
public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity)
{
this.setBlockBounds(0, 0, 0, 1, 0.1f, 1);
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) {
TileAlchemyArray array = (TileAlchemyArray) world.getTileEntity(pos);
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
{
TileAlchemyArray array = (TileAlchemyArray) world.getTileEntity(pos);
if (array == null || player.isSneaking())
return false;
if (array == null || player.isSneaking())
return false;
ItemStack playerItem = player.getCurrentEquippedItem();
ItemStack playerItem = player.getCurrentEquippedItem();
if (playerItem != null) {
if (array.getStackInSlot(0) == null) {
Utils.insertItemToTile(array, player, 0);
} else {
Utils.insertItemToTile(array, player, 1);
array.attemptCraft();
}
}
if (playerItem != null)
{
if (array.getStackInSlot(0) == null)
{
Utils.insertItemToTile(array, player, 0);
} else
{
Utils.insertItemToTile(array, player, 1);
array.attemptCraft();
}
}
world.markBlockForUpdate(pos);
return true;
}
world.markBlockForUpdate(pos);
return true;
}
@Override
public int quantityDropped(Random random) {
return 0;
}
@Override
public int quantityDropped(Random random)
{
return 0;
}
@Override
public int getRenderType() {
return -1;
}
@Override
public int getRenderType()
{
return -1;
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
return new TileAlchemyArray();
}
@Override
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState) {
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileAlchemyArray();
}
@Override
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState)
{
TileAlchemyArray alchemyArray = (TileAlchemyArray) world.getTileEntity(blockPos);
if (alchemyArray != null)
alchemyArray.dropItems();

View file

@ -16,9 +16,11 @@ import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
public class BlockAltar extends BlockContainer {
public class BlockAltar extends BlockContainer
{
public BlockAltar() {
public BlockAltar()
{
super(Material.rock);
setUnlocalizedName(Constants.Mod.MODID + ".altar");
@ -26,32 +28,38 @@ public class BlockAltar extends BlockContainer {
}
@Override
public boolean isOpaqueCube() {
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean isFullCube() {
public boolean isFullCube()
{
return false;
}
@Override
public boolean isVisuallyOpaque() {
public boolean isVisuallyOpaque()
{
return false;
}
@Override
public int getRenderType() {
public int getRenderType()
{
return 3;
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
public TileEntity createNewTileEntity(World world, int meta)
{
return new TileAltar();
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) {
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
{
TileAltar altar = (TileAltar) world.getTileEntity(pos);
if (altar == null || player.isSneaking())
@ -59,8 +67,10 @@ public class BlockAltar extends BlockContainer {
ItemStack playerItem = player.getCurrentEquippedItem();
if (playerItem != null) {
if (playerItem.getItem() instanceof IAltarReader || playerItem.getItem() instanceof IAltarManipulator) {
if (playerItem != null)
{
if (playerItem.getItem() instanceof IAltarReader || playerItem.getItem() instanceof IAltarManipulator)
{
playerItem.getItem().onItemRightClick(playerItem, world, player);
return true;
}
@ -76,7 +86,8 @@ public class BlockAltar extends BlockContainer {
}
@Override
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState) {
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState)
{
TileAltar tileAltar = (TileAltar) world.getTileEntity(blockPos);
if (tileAltar != null)
tileAltar.dropItems();

View file

@ -17,9 +17,11 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List;
import java.util.Random;
public class BlockBloodLight extends Block {
public class BlockBloodLight extends Block
{
public BlockBloodLight() {
public BlockBloodLight()
{
super(Material.cloth);
setUnlocalizedName(Constants.Mod.MODID + ".bloodLight");
@ -27,30 +29,36 @@ public class BlockBloodLight extends Block {
}
@Override
public boolean isOpaqueCube() {
public boolean isOpaqueCube()
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public EnumWorldBlockLayer getBlockLayer() {
public EnumWorldBlockLayer getBlockLayer()
{
return EnumWorldBlockLayer.CUTOUT;
}
@Override
public boolean isFullCube() {
public boolean isFullCube()
{
return false;
}
@Override
public int getLightValue() {
public int getLightValue()
{
return 15;
}
@Override
@SideOnly(Side.CLIENT)
public boolean addDestroyEffects(World world, BlockPos pos, net.minecraft.client.particle.EffectRenderer effectRenderer) {
if (world.getBlockState(pos).getBlock() == this) {
public boolean addDestroyEffects(World world, BlockPos pos, net.minecraft.client.particle.EffectRenderer effectRenderer)
{
if (world.getBlockState(pos).getBlock() == this)
{
Random random = new Random();
float f = 1.0F;
float f1 = f * 0.6F + 0.4F;
@ -63,8 +71,10 @@ public class BlockBloodLight extends Block {
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
if (rand.nextInt(3) != 0) {
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
if (rand.nextInt(3) != 0)
{
float f = 1.0F;
float f1 = f * 0.6F + 0.4F;
float f2 = f * f * 0.7F - 0.5F;
@ -74,12 +84,14 @@ public class BlockBloodLight extends Block {
}
@Override
public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) {
public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity)
{
this.setBlockBounds(0.35F, 0.35F, 0.35F, 0.65F, 0.65F, 0.65F);
}
@Override
public int quantityDropped(Random par1Random) {
public int quantityDropped(Random par1Random)
{
return 0;
}
}

View file

@ -5,11 +5,13 @@ import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.block.base.BlockString;
import net.minecraft.block.material.Material;
public class BlockBloodRune extends BlockString {
public class BlockBloodRune extends BlockString
{
public static final String[] names = {"blank", "speed", "efficiency", "sacrifice", "selfSacrifice", "displacement", "capacity", "augCapacity", "orb", "acceleration"};
public static final String[] names = { "blank", "speed", "efficiency", "sacrifice", "selfSacrifice", "displacement", "capacity", "augCapacity", "orb", "acceleration" };
public BlockBloodRune() {
public BlockBloodRune()
{
super(Material.rock, names);
setUnlocalizedName(Constants.Mod.MODID + ".rune.");
@ -20,7 +22,8 @@ public class BlockBloodRune extends BlockString {
setHarvestLevel("pickaxe", 2);
}
public int getRuneEffect(int meta) {
public int getRuneEffect(int meta)
{
return meta;
}
}

View file

@ -5,11 +5,13 @@ import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.block.base.BlockString;
import net.minecraft.block.material.Material;
public class BlockBloodStoneBrick extends BlockString {
public class BlockBloodStoneBrick extends BlockString
{
public static final String[] names = {"normal", "large"};
public static final String[] names = { "normal", "large" };
public BlockBloodStoneBrick() {
public BlockBloodStoneBrick()
{
super(Material.rock, names);
setUnlocalizedName(Constants.Mod.MODID + ".bloodstonebrick.");

View file

@ -5,10 +5,12 @@ import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.block.base.BlockString;
import net.minecraft.block.material.Material;
public class BlockCrystal extends BlockString {
public static final String[] names = {"normal", "brick"};
public class BlockCrystal extends BlockString
{
public static final String[] names = { "normal", "brick" };
public BlockCrystal() {
public BlockCrystal()
{
super(Material.rock, names);
setUnlocalizedName(Constants.Mod.MODID + ".crystal.");

View file

@ -15,12 +15,14 @@ import net.minecraftforge.fluids.FluidStack;
import java.awt.*;
public class BlockLifeEssence extends BlockFluidClassic {
public class BlockLifeEssence extends BlockFluidClassic
{
@Getter
private static Fluid lifeEssence = new FluidLifeEssence();
public BlockLifeEssence() {
public BlockLifeEssence()
{
super(lifeEssence, Material.water);
setUnlocalizedName(Constants.Mod.MODID + ".fluid.lifeEssence");
@ -30,18 +32,22 @@ public class BlockLifeEssence extends BlockFluidClassic {
}
@Override
public boolean canDisplace(IBlockAccess world, BlockPos blockPos) {
public boolean canDisplace(IBlockAccess world, BlockPos blockPos)
{
return !world.getBlockState(blockPos).getBlock().getMaterial().isLiquid() && super.canDisplace(world, blockPos);
}
@Override
public boolean displaceIfPossible(World world, BlockPos blockPos) {
public boolean displaceIfPossible(World world, BlockPos blockPos)
{
return !world.getBlockState(blockPos).getBlock().getMaterial().isLiquid() && super.displaceIfPossible(world, blockPos);
}
public static class FluidLifeEssence extends Fluid {
public static class FluidLifeEssence extends Fluid
{
public FluidLifeEssence() {
public FluidLifeEssence()
{
super("lifeEssence", new ResourceLocation(Constants.Mod.DOMAIN + "blocks/lifeEssenceStill"), new ResourceLocation(Constants.Mod.DOMAIN + "blocks/lifeEssenceFlowing"));
setDensity(2000);
@ -49,12 +55,14 @@ public class BlockLifeEssence extends BlockFluidClassic {
}
@Override
public int getColor() {
public int getColor()
{
return Color.WHITE.getRGB();
}
@Override
public String getLocalizedName(FluidStack fluidStack) {
public String getLocalizedName(FluidStack fluidStack)
{
return StatCollector.translateToLocal("tile.BloodMagic.fluid.lifeEssence.name");
}
}

View file

@ -14,11 +14,13 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockPedestal extends BlockStringContainer {
public class BlockPedestal extends BlockStringContainer
{
public static String[] names = {"pedestal", "plinth"};
public static String[] names = { "pedestal", "plinth" };
public BlockPedestal() {
public BlockPedestal()
{
super(Material.rock, names);
setUnlocalizedName(Constants.Mod.MODID + ".");
@ -28,35 +30,41 @@ public class BlockPedestal extends BlockStringContainer {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) {
switch (getMetaFromState(state)) {
case 0: {
// TileEntity plinth = world.getTileEntity(pos);
//
// if (plinth!= null && plinth instanceof TilePlinth) {
// Utils.insertItemToTile((TilePlinth) plinth, player);
// }
}
case 1: {
TileEntity plinth = world.getTileEntity(pos);
if (plinth == null || player.isSneaking())
return false;
if (plinth instanceof TilePlinth) {
Utils.insertItemToTile((TilePlinth) plinth, player);
return true;
}
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
{
switch (getMetaFromState(state))
{
case 0:
{
// TileEntity plinth = world.getTileEntity(pos);
//
// if (plinth!= null && plinth instanceof TilePlinth) {
// Utils.insertItemToTile((TilePlinth) plinth, player);
// }
}
case 1:
{
TileEntity plinth = world.getTileEntity(pos);
if (plinth == null || player.isSneaking())
return false;
if (plinth instanceof TilePlinth)
{
Utils.insertItemToTile((TilePlinth) plinth, player);
return true;
}
}
}
world.markBlockForUpdate(pos);
return false;
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, BlockPos pos) {
public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, BlockPos pos)
{
IBlockState state = blockAccess.getBlockState(pos);
if (getMetaFromState(state) == 0)
@ -67,17 +75,20 @@ public class BlockPedestal extends BlockStringContainer {
}
@Override
public boolean isOpaqueCube() {
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean isFullCube() {
public boolean isFullCube()
{
return false;
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
public TileEntity createNewTileEntity(World world, int meta)
{
return meta == 0 ? null : new TilePlinth();
}
}

View file

@ -17,21 +17,25 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.Random;
public class BlockPhantom extends BlockContainer {
public class BlockPhantom extends BlockContainer
{
public BlockPhantom() {
public BlockPhantom()
{
super(Material.cloth);
setUnlocalizedName(Constants.Mod.MODID + ".phantom");
}
@Override
public boolean isOpaqueCube() {
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean isFullCube() {
public boolean isFullCube()
{
return false;
}
@ -44,17 +48,20 @@ public class BlockPhantom extends BlockContainer {
@Override
@SideOnly(Side.CLIENT)
public EnumWorldBlockLayer getBlockLayer() {
public EnumWorldBlockLayer getBlockLayer()
{
return EnumWorldBlockLayer.TRANSLUCENT;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) {
public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side)
{
IBlockState iblockstate = worldIn.getBlockState(pos);
Block block = iblockstate.getBlock();
if (worldIn.getBlockState(pos.offset(side.getOpposite())) != iblockstate) {
if (worldIn.getBlockState(pos.offset(side.getOpposite())) != iblockstate)
{
return true;
}
@ -62,12 +69,14 @@ public class BlockPhantom extends BlockContainer {
}
@Override
public int quantityDropped(Random par1Random) {
public int quantityDropped(Random par1Random)
{
return 0;
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
public TileEntity createNewTileEntity(World world, int meta)
{
return new TilePhantomBlock();
}
}

View file

@ -20,11 +20,13 @@ import WayofTime.bloodmagic.registry.ModItems;
import WayofTime.bloodmagic.tile.TileImperfectRitualStone;
import WayofTime.bloodmagic.tile.TileMasterRitualStone;
public class BlockRitualController extends BlockStringContainer {
public class BlockRitualController extends BlockStringContainer
{
public static final String[] names = {"master", "imperfect"};
public static final String[] names = { "master", "imperfect" };
public BlockRitualController() {
public BlockRitualController()
{
super(Material.rock, names);
setUnlocalizedName(Constants.Mod.MODID + ".stone.ritual.");
@ -36,21 +38,28 @@ public class BlockRitualController extends BlockStringContainer {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) {
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
{
TileEntity tile = world.getTileEntity(pos);
if (getMetaFromState(state) == 0 && tile instanceof TileMasterRitualStone) {
if (player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.activationCrystal) {
String key = RitualHelper.getValidRitual(world, pos);
EnumFacing direction = RitualHelper.getDirectionOfRitual(world, pos, key);
//TODO: Give a message stating that this ritual is not a valid ritual.
if (!key.isEmpty() && direction != null && RitualHelper.checkValidRitual(world, pos, key, direction)) {
if(((TileMasterRitualStone) tile).activateRitual(player.getHeldItem(), player, RitualRegistry.getRitualForId(key))) {
((TileMasterRitualStone) tile).setDirection(direction);
if (getMetaFromState(state) == 0 && tile instanceof TileMasterRitualStone)
{
if (player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.activationCrystal)
{
String key = RitualHelper.getValidRitual(world, pos);
EnumFacing direction = RitualHelper.getDirectionOfRitual(world, pos, key);
// TODO: Give a message stating that this ritual is not a valid
// ritual.
if (!key.isEmpty() && direction != null && RitualHelper.checkValidRitual(world, pos, key, direction))
{
if (((TileMasterRitualStone) tile).activateRitual(player.getHeldItem(), player, RitualRegistry.getRitualForId(key)))
{
((TileMasterRitualStone) tile).setDirection(direction);
}
}
}
} else if (getMetaFromState(state) == 1 && tile instanceof TileImperfectRitualStone) {
} else if (getMetaFromState(state) == 1 && tile instanceof TileImperfectRitualStone)
{
IBlockState determinerState = world.getBlockState(pos.up());
BlockStack determiner = new BlockStack(determinerState.getBlock(), determinerState.getBlock().getMetaFromState(determinerState));
@ -62,7 +71,8 @@ public class BlockRitualController extends BlockStringContainer {
}
@Override
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player)
{
TileEntity tile = world.getTileEntity(pos);
if (getMetaFromState(state) == 0 && tile instanceof TileMasterRitualStone)
@ -70,7 +80,8 @@ public class BlockRitualController extends BlockStringContainer {
}
@Override
public void onBlockDestroyedByExplosion(World world, BlockPos pos, Explosion explosion) {
public void onBlockDestroyedByExplosion(World world, BlockPos pos, Explosion explosion)
{
TileEntity tile = world.getTileEntity(pos);
IBlockState state = world.getBlockState(pos);
@ -79,7 +90,8 @@ public class BlockRitualController extends BlockStringContainer {
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
public TileEntity createNewTileEntity(World world, int meta)
{
return meta == 0 ? (new TileMasterRitualStone()) : (new TileImperfectRitualStone());
}
}

View file

@ -9,11 +9,13 @@ import net.minecraft.block.material.Material;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
public class BlockRitualStone extends BlockString implements IRitualStone {
public class BlockRitualStone extends BlockString implements IRitualStone
{
public static final String[] names = {"blank", "water", "fire", "earth", "air", "dusk", "dawn"};
public static final String[] names = { "blank", "water", "fire", "earth", "air", "dusk", "dawn" };
public BlockRitualStone() {
public BlockRitualStone()
{
super(Material.iron, names);
setUnlocalizedName(Constants.Mod.MODID + ".ritualStone.");
@ -25,7 +27,8 @@ public class BlockRitualStone extends BlockString implements IRitualStone {
}
@Override
public boolean isRuneType(World world, BlockPos pos, EnumRuneType runeType) {
public boolean isRuneType(World world, BlockPos pos, EnumRuneType runeType)
{
return runeType.toString().equals(names[getMetaFromState(world.getBlockState(pos))]);
}
}

View file

@ -10,9 +10,11 @@ import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
public class BlockSoulForge extends Block {
public class BlockSoulForge extends Block
{
public BlockSoulForge() {
public BlockSoulForge()
{
super(Material.iron);
setUnlocalizedName(Constants.Mod.MODID + ".soulforge.");
@ -24,11 +26,11 @@ public class BlockSoulForge extends Block {
}
@Override
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) {
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (world.isRemote)
return false;
return false;
}
}

View file

@ -18,9 +18,11 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List;
import java.util.Random;
public class BlockSpectral extends BlockContainer {
public class BlockSpectral extends BlockContainer
{
public BlockSpectral() {
public BlockSpectral()
{
super(Material.cloth);
setUnlocalizedName(Constants.Mod.MODID + ".spectral");
@ -28,42 +30,50 @@ public class BlockSpectral extends BlockContainer {
}
@Override
public boolean isOpaqueCube() {
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean isFullCube() {
public boolean isFullCube()
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public EnumWorldBlockLayer getBlockLayer() {
public EnumWorldBlockLayer getBlockLayer()
{
return EnumWorldBlockLayer.CUTOUT;
}
@Override
public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) {
public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity)
{
}
@Override
public int quantityDropped(Random par1Random) {
public int quantityDropped(Random par1Random)
{
return 0;
}
@Override
public boolean isReplaceable(World world, BlockPos blockPos) {
public boolean isReplaceable(World world, BlockPos blockPos)
{
return true;
}
@Override
public boolean isAir(IBlockAccess world, BlockPos blockPos) {
public boolean isAir(IBlockAccess world, BlockPos blockPos)
{
return true;
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
public TileEntity createNewTileEntity(World world, int meta)
{
return new TileSpectralBlock();
}
}

View file

@ -14,9 +14,11 @@ import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
public class BlockTeleposer extends BlockContainer {
public class BlockTeleposer extends BlockContainer
{
public BlockTeleposer() {
public BlockTeleposer()
{
super(Material.rock);
setCreativeTab(BloodMagic.tabBloodMagic);
@ -26,27 +28,32 @@ public class BlockTeleposer extends BlockContainer {
}
@Override
public int getRenderType() {
public int getRenderType()
{
return 3;
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) {
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
{
ItemStack playerItem = player.getCurrentEquippedItem();
if (playerItem != null && playerItem.getItem() instanceof ItemTelepositionFocus) {
if (playerItem != null && playerItem.getItem() instanceof ItemTelepositionFocus)
{
BindableHelper.checkAndSetItemOwner(playerItem, player);
((ItemTelepositionFocus) playerItem.getItem()).setBlockPos(playerItem, world, pos);
return true;
}
// player.openGui(AlchemicalWizardry.instance, 1, world, pos.getX(), pos.getY(), pos.getZ());
// player.openGui(AlchemicalWizardry.instance, 1, world, pos.getX(),
// pos.getY(), pos.getZ());
return true;
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return null;
}
}

View file

@ -12,57 +12,61 @@ import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
public class BlockTestSpellBlock extends Block {
public static final PropertyDirection INPUT = PropertyDirection
.create("input");
public static final PropertyDirection OUTPUT = PropertyDirection
.create("output");
public class BlockTestSpellBlock extends Block
{
public static final PropertyDirection INPUT = PropertyDirection.create("input");
public static final PropertyDirection OUTPUT = PropertyDirection.create("output");
public BlockTestSpellBlock() {
public BlockTestSpellBlock()
{
super(Material.rock);
setHardness(2.0F);
setResistance(5.0F);
setUnlocalizedName(Constants.Mod.MODID + ".testSpellBlock");
setCreativeTab(BloodMagic.tabBloodMagic);
this.setDefaultState(this.blockState.getBaseState()
.withProperty(INPUT, EnumFacing.DOWN)
.withProperty(OUTPUT, EnumFacing.UP));
this.setDefaultState(this.blockState.getBaseState().withProperty(INPUT, EnumFacing.DOWN).withProperty(OUTPUT, EnumFacing.UP));
}
@Override
public IBlockState getStateFromMeta(int meta) {
public IBlockState getStateFromMeta(int meta)
{
return this.getDefaultState();
}
@Override
public int getMetaFromState(IBlockState state) {
public int getMetaFromState(IBlockState state)
{
return 0;
}
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
return state.withProperty(INPUT, EnumFacing.DOWN)
.withProperty(OUTPUT, EnumFacing.UP);
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
{
return state.withProperty(INPUT, EnumFacing.DOWN).withProperty(OUTPUT, EnumFacing.UP);
}
@Override
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[]{INPUT, OUTPUT});
protected BlockState createBlockState()
{
return new BlockState(this, new IProperty[] { INPUT, OUTPUT });
}
@Override
public boolean isOpaqueCube() {
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean isFullCube() {
public boolean isFullCube()
{
return false;
}
@Override
public boolean isPassable(IBlockAccess blockAccess, BlockPos pos) {
public boolean isPassable(IBlockAccess blockAccess, BlockPos pos)
{
return false;
}
}

View file

@ -26,20 +26,23 @@ import java.util.List;
/**
* Creates a block that has multiple meta-based states.
*
*
* These states will be numbered 0 through {@code maxMeta}.
*
* For {@link net.minecraft.tileentity.TileEntity}'s, use {@link BlockIntegerContainer}.
*
* For {@link net.minecraft.tileentity.TileEntity}'s, use
* {@link BlockIntegerContainer}.
*/
@Getter
public class BlockInteger extends Block {
public class BlockInteger extends Block
{
private final int maxMeta;
private final PropertyInteger metaProp;
private final IUnlistedProperty unlistedMetaProp;
private final BlockState realBlockState;
public BlockInteger(Material material, int maxMeta, String propName) {
public BlockInteger(Material material, int maxMeta, String propName)
{
super(material);
this.maxMeta = maxMeta;
@ -50,60 +53,72 @@ public class BlockInteger extends Block {
setupStates();
}
public BlockInteger(Material material, int maxMeta) {
public BlockInteger(Material material, int maxMeta)
{
this(material, maxMeta, "meta");
}
@Override
public IBlockState getStateFromMeta(int meta) {
public IBlockState getStateFromMeta(int meta)
{
return getBlockState().getBaseState().withProperty(metaProp, meta);
}
@Override
public int getMetaFromState(IBlockState state) {
public int getMetaFromState(IBlockState state)
{
return (Integer) state.getValue(metaProp);
}
@Override
public int damageDropped(IBlockState state) {
public int damageDropped(IBlockState state)
{
return getMetaFromState(state);
}
@Override
public BlockState getBlockState() {
public BlockState getBlockState()
{
return this.realBlockState;
}
@Override
public BlockState createBlockState() {
public BlockState createBlockState()
{
return Blocks.air.getBlockState();
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) {
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player)
{
return new ItemStack(this, 1, this.getMetaFromState(world.getBlockState(pos)));
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List<ItemStack> list) {
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List<ItemStack> list)
{
for (int i = 0; i < maxMeta + 1; i++)
list.add(new ItemStack(this, 1, i));
}
private void setupStates() {
private void setupStates()
{
this.setDefaultState(getExtendedBlockState().withProperty(unlistedMetaProp, 0).withProperty(metaProp, 0));
}
public ExtendedBlockState getBaseExtendedState() {
public ExtendedBlockState getBaseExtendedState()
{
return (ExtendedBlockState) this.getBlockState();
}
public IExtendedBlockState getExtendedBlockState() {
public IExtendedBlockState getExtendedBlockState()
{
return (IExtendedBlockState) this.getBaseExtendedState().getBaseState();
}
private BlockState createRealBlockState() {
return new ExtendedBlockState(this, new IProperty[]{metaProp}, new IUnlistedProperty[]{unlistedMetaProp});
private BlockState createRealBlockState()
{
return new ExtendedBlockState(this, new IProperty[] { metaProp }, new IUnlistedProperty[] { unlistedMetaProp });
}
}

View file

@ -7,26 +7,31 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
public abstract class BlockIntegerContainer extends BlockInteger implements ITileEntityProvider {
public abstract class BlockIntegerContainer extends BlockInteger implements ITileEntityProvider
{
public BlockIntegerContainer(Material material, int maxMeta, String propName) {
public BlockIntegerContainer(Material material, int maxMeta, String propName)
{
super(material, maxMeta, propName);
this.isBlockContainer = true;
}
public BlockIntegerContainer(Material material, int maxMeta) {
public BlockIntegerContainer(Material material, int maxMeta)
{
this(material, maxMeta, "meta");
}
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
super.breakBlock(worldIn, pos, state);
worldIn.removeTileEntity(pos);
}
@Override
public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam) {
public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam)
{
super.onBlockEventReceived(worldIn, pos, state, eventID, eventParam);
TileEntity tileentity = worldIn.getTileEntity(pos);
return tileentity != null && tileentity.receiveClientEvent(eventID, eventParam);

View file

@ -27,14 +27,17 @@ import java.util.List;
/**
* Creates a block that has multiple meta-based states.
*
* These states will be named after the given string array. Somewhere along the way, each
* value is {@code toLowerCase()}'ed, so the blockstate JSON needs all values to be lowercase.
*
* For {@link net.minecraft.tileentity.TileEntity}'s, use {@link BlockStringContainer}.
*
* These states will be named after the given string array. Somewhere along the
* way, each value is {@code toLowerCase()}'ed, so the blockstate JSON needs all
* values to be lowercase.
*
* For {@link net.minecraft.tileentity.TileEntity}'s, use
* {@link BlockStringContainer}.
*/
@Getter
public class BlockString extends Block {
public class BlockString extends Block
{
private final int maxMeta;
private final List<String> values;
@ -42,7 +45,8 @@ public class BlockString extends Block {
private final IUnlistedProperty unlistedStringProp;
private final BlockState realBlockState;
public BlockString(Material material, String[] values, String propName) {
public BlockString(Material material, String[] values, String propName)
{
super(material);
this.maxMeta = values.length - 1;
@ -54,60 +58,72 @@ public class BlockString extends Block {
setupStates();
}
public BlockString(Material material, String[] values) {
public BlockString(Material material, String[] values)
{
this(material, values, "type");
}
@Override
public IBlockState getStateFromMeta(int meta) {
public IBlockState getStateFromMeta(int meta)
{
return getBlockState().getBaseState().withProperty(stringProp, values.get(meta));
}
@Override
public int getMetaFromState(IBlockState state) {
public int getMetaFromState(IBlockState state)
{
return values.indexOf(String.valueOf(state.getValue(stringProp)));
}
@Override
public int damageDropped(IBlockState state) {
public int damageDropped(IBlockState state)
{
return getMetaFromState(state);
}
@Override
public BlockState getBlockState() {
public BlockState getBlockState()
{
return this.realBlockState;
}
@Override
public BlockState createBlockState() {
public BlockState createBlockState()
{
return Blocks.air.getBlockState();
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) {
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player)
{
return new ItemStack(this, 1, this.getMetaFromState(world.getBlockState(pos)));
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List<ItemStack> list) {
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List<ItemStack> list)
{
for (int i = 0; i < maxMeta + 1; i++)
list.add(new ItemStack(this, 1, i));
}
private void setupStates() {
private void setupStates()
{
this.setDefaultState(getExtendedBlockState().withProperty(unlistedStringProp, values.get(0)).withProperty(stringProp, values.get(0)));
}
public ExtendedBlockState getBaseExtendedState() {
public ExtendedBlockState getBaseExtendedState()
{
return (ExtendedBlockState) this.getBlockState();
}
public IExtendedBlockState getExtendedBlockState() {
public IExtendedBlockState getExtendedBlockState()
{
return (IExtendedBlockState) this.getBaseExtendedState().getBaseState();
}
private BlockState createRealBlockState() {
return new ExtendedBlockState(this, new IProperty[]{stringProp}, new IUnlistedProperty[]{unlistedStringProp});
private BlockState createRealBlockState()
{
return new ExtendedBlockState(this, new IProperty[] { stringProp }, new IUnlistedProperty[] { unlistedStringProp });
}
}

View file

@ -7,26 +7,31 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
public abstract class BlockStringContainer extends BlockString implements ITileEntityProvider {
public abstract class BlockStringContainer extends BlockString implements ITileEntityProvider
{
public BlockStringContainer(Material material, String[] values, String propName) {
public BlockStringContainer(Material material, String[] values, String propName)
{
super(material, values, propName);
this.isBlockContainer = true;
}
public BlockStringContainer(Material material, String[] values) {
public BlockStringContainer(Material material, String[] values)
{
this(material, values, "type");
}
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
super.breakBlock(worldIn, pos, state);
worldIn.removeTileEntity(pos);
}
@Override
public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam) {
public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam)
{
super.onBlockEventReceived(worldIn, pos, state, eventID, eventParam);
TileEntity tileentity = worldIn.getTileEntity(pos);
return tileentity != null && tileentity.receiveClientEvent(eventID, eventParam);

View file

@ -8,11 +8,13 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
public class PropertyString extends PropertyHelper {
public class PropertyString extends PropertyHelper
{
private final ImmutableSet allowedValues;
protected PropertyString(String name, String[] values) {
protected PropertyString(String name, String[] values)
{
super(name, String.class);
HashSet<String> hashSet = Sets.newHashSet();
@ -20,21 +22,25 @@ public class PropertyString extends PropertyHelper {
allowedValues = ImmutableSet.copyOf(hashSet);
}
public static PropertyString create(String name, String[] values) {
public static PropertyString create(String name, String[] values)
{
return new PropertyString(name, values);
}
@Override
public Collection getAllowedValues() {
public Collection getAllowedValues()
{
return allowedValues;
}
public String getName0(String value) {
public String getName0(String value)
{
return value;
}
@Override
public String getName(Comparable value) {
public String getName(Comparable value)
{
return this.getName0(value.toString());
}
}

View file

@ -2,33 +2,39 @@ package WayofTime.bloodmagic.block.property;
import net.minecraftforge.common.property.IUnlistedProperty;
public class UnlistedPropertyInteger implements IUnlistedProperty<Integer> {
public class UnlistedPropertyInteger implements IUnlistedProperty<Integer>
{
private int maxMeta;
private String propName;
public UnlistedPropertyInteger(int maxMeta, String propName) {
public UnlistedPropertyInteger(int maxMeta, String propName)
{
this.maxMeta = maxMeta;
this.propName = propName;
}
@Override
public String getName() {
public String getName()
{
return propName;
}
@Override
public boolean isValid(Integer value) {
public boolean isValid(Integer value)
{
return value <= maxMeta;
}
@Override
public Class<Integer> getType() {
public Class<Integer> getType()
{
return Integer.class;
}
@Override
public String valueToString(Integer value) {
public String valueToString(Integer value)
{
return value.toString();
}
}

View file

@ -5,33 +5,39 @@ import net.minecraftforge.common.property.IUnlistedProperty;
import java.util.Arrays;
import java.util.List;
public class UnlistedPropertyString implements IUnlistedProperty<String> {
public class UnlistedPropertyString implements IUnlistedProperty<String>
{
private List values;
private String propName;
public UnlistedPropertyString(String[] values, String propName) {
public UnlistedPropertyString(String[] values, String propName)
{
this.values = Arrays.asList(values);
this.propName = propName;
}
@Override
public String getName() {
public String getName()
{
return propName;
}
@Override
public boolean isValid(String value) {
public boolean isValid(String value)
{
return values.contains(value);
}
@Override
public Class<String> getType() {
public Class<String> getType()
{
return String.class;
}
@Override
public String valueToString(String value) {
public String valueToString(String value)
{
return value;
}
}