More progress
This commit is contained in:
parent
00d6f8eb46
commit
d80afb18f0
64 changed files with 410 additions and 976 deletions
|
@ -10,6 +10,7 @@ import net.minecraft.creativetab.CreativeTabs;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -69,7 +70,7 @@ public class BlockEnum<E extends Enum<E> & IStringSerializable> extends Block
|
|||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> subBlocks)
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, NonNullList<ItemStack> subBlocks)
|
||||
{
|
||||
for (E type : types)
|
||||
subBlocks.add(new ItemStack(item, 1, type.ordinal()));
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
package WayofTime.bloodmagic.block.base;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class BlockEnumContainer<E extends Enum<E> & IStringSerializable> extends BlockEnum<E>
|
||||
{
|
||||
public BlockEnumContainer(Material material, Class<E> enumClass, String propName)
|
||||
{
|
||||
super(material, enumClass, propName);
|
||||
}
|
||||
|
||||
public BlockEnumContainer(Material material, Class<E> enumClass)
|
||||
{
|
||||
this(material, enumClass, "type");
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract boolean hasTileEntity(IBlockState state);
|
||||
|
||||
@Override
|
||||
public abstract TileEntity createTileEntity(World world, IBlockState state);
|
||||
|
||||
@Override
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
super.breakBlock(worldIn, pos, state);
|
||||
worldIn.removeTileEntity(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventReceived(IBlockState state, World worldIn, BlockPos pos, int eventID, int eventParam)
|
||||
{
|
||||
super.eventReceived(state, worldIn, pos, eventID, eventParam);
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
return tileentity != null && tileentity.receiveClientEvent(eventID, eventParam);
|
||||
}
|
||||
}
|
|
@ -9,6 +9,7 @@ import net.minecraft.entity.EntityLivingBase;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -122,15 +123,17 @@ public class BlockEnumPillar<E extends Enum<E> & IStringSerializable> extends Bl
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack createStackedBlock(IBlockState state)
|
||||
protected ItemStack getSilkTouchDrop(IBlockState state)
|
||||
{
|
||||
return new ItemStack(this, 1, damageDropped(state));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
|
||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand)
|
||||
{
|
||||
return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(BlockRotatedPillar.AXIS, facing.getAxis());
|
||||
return super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, placer, hand).withProperty(BlockRotatedPillar.AXIS, facing.getAxis());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,10 +7,7 @@ import net.minecraft.block.state.IBlockState;
|
|||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -70,15 +67,15 @@ public class BlockEnumPillarCap<E extends Enum<E> & IStringSerializable> extends
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack createStackedBlock(IBlockState state)
|
||||
protected ItemStack getSilkTouchDrop(IBlockState state)
|
||||
{
|
||||
return new ItemStack(this, 1, damageDropped(state));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
|
||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand)
|
||||
{
|
||||
return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(FACING, facing);
|
||||
return super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, placer, hand).withProperty(FACING, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,10 +16,7 @@ import net.minecraft.entity.Entity;
|
|||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
|
@ -172,9 +169,9 @@ public class BlockEnumStairs<E extends Enum<E> & IStringSerializable> extends Bl
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
|
||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand)
|
||||
{
|
||||
IBlockState state = super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer);
|
||||
IBlockState state = super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, placer, hand);
|
||||
state = state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(BlockStairs.SHAPE, BlockStairs.EnumShape.STRAIGHT);
|
||||
return facing != EnumFacing.DOWN && (facing == EnumFacing.UP || (double) hitY <= 0.5D) ? state.withProperty(BlockStairs.HALF, BlockStairs.EnumHalf.BOTTOM) : state.withProperty(BlockStairs.HALF, BlockStairs.EnumHalf.TOP);
|
||||
}
|
||||
|
@ -349,7 +346,7 @@ public class BlockEnumStairs<E extends Enum<E> & IStringSerializable> extends Bl
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack createStackedBlock(IBlockState state)
|
||||
protected ItemStack getSilkTouchDrop(IBlockState state)
|
||||
{
|
||||
return new ItemStack(this, 1, damageDropped(state));
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ import net.minecraft.util.IStringSerializable;
|
|||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -54,7 +53,7 @@ public class BlockEnumWall<E extends Enum<E> & IStringSerializable> extends Bloc
|
|||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos)
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
blockState = blockState.getActualState(worldIn, pos);
|
||||
return CLIP_AABB_BY_INDEX[getAABBIndex(blockState)];
|
||||
|
@ -129,7 +128,7 @@ public class BlockEnumWall<E extends Enum<E> & IStringSerializable> extends Bloc
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack createStackedBlock(IBlockState state)
|
||||
protected ItemStack getSilkTouchDrop(IBlockState state)
|
||||
{
|
||||
return new ItemStack(this, 1, damageDropped(state));
|
||||
}
|
||||
|
|
|
@ -9,11 +9,10 @@ import net.minecraft.block.state.IBlockState;
|
|||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Creates a block that has multiple meta-based states.
|
||||
*
|
||||
|
@ -68,7 +67,7 @@ public class BlockInteger extends Block
|
|||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> subBlocks) {
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, NonNullList<ItemStack> subBlocks) {
|
||||
for (int i = 0; i < maxMeta; i++)
|
||||
subBlocks.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
package WayofTime.bloodmagic.block.base;
|
||||
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class BlockIntegerContainer extends BlockInteger implements ITileEntityProvider
|
||||
{
|
||||
public BlockIntegerContainer(Material material, int maxMeta, String propName)
|
||||
{
|
||||
super(material, maxMeta, propName);
|
||||
|
||||
this.isBlockContainer = true;
|
||||
}
|
||||
|
||||
public BlockIntegerContainer(Material material, int maxMeta)
|
||||
{
|
||||
this(material, maxMeta, "meta");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
super.breakBlock(worldIn, pos, state);
|
||||
worldIn.removeTileEntity(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventReceived(IBlockState state, World worldIn, BlockPos pos, int eventID, int eventParam)
|
||||
{
|
||||
super.eventReceived(state, worldIn, pos, eventID, eventParam);
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
return tileentity != null && tileentity.receiveClientEvent(eventID, eventParam);
|
||||
}
|
||||
}
|
|
@ -1,7 +1,5 @@
|
|||
package WayofTime.bloodmagic.block.base;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -11,6 +9,7 @@ import net.minecraft.creativetab.CreativeTabs;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import WayofTime.bloodmagic.block.property.PropertyString;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
@ -79,7 +78,7 @@ public class BlockString extends Block
|
|||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> subBlocks)
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, NonNullList<ItemStack> subBlocks)
|
||||
{
|
||||
for (int i = 0; i < maxMeta; i++)
|
||||
subBlocks.add(new ItemStack(item, 1, i));
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
package WayofTime.bloodmagic.block.base;
|
||||
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class BlockStringContainer extends BlockString implements ITileEntityProvider
|
||||
{
|
||||
public BlockStringContainer(Material material, String[] values, String propName)
|
||||
{
|
||||
super(material, values, propName);
|
||||
|
||||
this.isBlockContainer = true;
|
||||
}
|
||||
|
||||
public BlockStringContainer(Material material, String[] values)
|
||||
{
|
||||
this(material, values, "type");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
super.breakBlock(worldIn, pos, state);
|
||||
worldIn.removeTileEntity(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventReceived(IBlockState state, World worldIn, BlockPos pos, int eventID, int eventParam)
|
||||
{
|
||||
super.eventReceived(state, worldIn, pos, eventID, eventParam);
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
return tileentity != null && tileentity.receiveClientEvent(eventID, eventParam);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue