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

@ -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);