First pass on Pedestal/Plinth

I just want this out of my uncommitted file list...
This commit is contained in:
Nick 2015-11-22 14:03:51 -08:00
parent a12c72092a
commit cbd4f8c75f
7 changed files with 257 additions and 13 deletions

View file

@ -0,0 +1,82 @@
package WayofTime.bloodmagic.block;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.block.base.BlockStringContainer;
import WayofTime.bloodmagic.tile.TilePlinth;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockPedestal extends BlockStringContainer {
public static String[] names = { "pedestal", "plinth" };
public BlockPedestal() {
super(Material.rock, names);
setUnlocalizedName(BloodMagic.MODID + ".");
setCreativeTab(BloodMagic.tabBloodMagic);
setHardness(2.0F);
setResistance(5.0F);
}
@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;
}
}
}
world.markBlockForUpdate(pos);
return false;
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, BlockPos pos) {
IBlockState state = blockAccess.getBlockState(pos);
if (getMetaFromState(state) == 0)
setBlockBounds(0.5F - 0.3125F, 0.0F, 0.5F - 0.3125F, 0.5F + 0.3125F, 0.6F, 0.5F + 0.3125F);
else if (getMetaFromState(state) == 1)
setBlockBounds(0.1F, 0.0F, 0.1F, 1.0F - 0.1F, 0.8F, 1.0F - 0.1F);
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean isFullCube() {
return false;
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return meta == 0 ? null : new TilePlinth();
}
}

View file

@ -0,0 +1,25 @@
package WayofTime.bloodmagic.item.block;
import WayofTime.bloodmagic.block.BlockPedestal;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
public class ItemBlockPedestal extends ItemBlock {
public ItemBlockPedestal(Block block) {
super(block);
setHasSubtypes(true);
}
@Override
public String getUnlocalizedName(ItemStack stack) {
return super.getUnlocalizedName(stack) + BlockPedestal.names[stack.getItemDamage()];
}
@Override
public int getMetadata(int meta) {
return meta;
}
}

View file

@ -1,36 +1,33 @@
package WayofTime.bloodmagic.registry;
import WayofTime.bloodmagic.block.*;
import WayofTime.bloodmagic.item.block.ItemBlockBloodStoneBrick;
import WayofTime.bloodmagic.item.block.*;
import WayofTime.bloodmagic.tile.TilePlinth;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.ConfigHandler;
import WayofTime.bloodmagic.item.block.ItemBlockBloodRune;
import WayofTime.bloodmagic.item.block.ItemBlockRitualController;
import WayofTime.bloodmagic.item.block.ItemBlockRitualStone;
import WayofTime.bloodmagic.tile.TileAltar;
import WayofTime.bloodmagic.tile.TileImperfectRitualStone;
import WayofTime.bloodmagic.tile.TileMasterRitualStone;
import WayofTime.bloodmagic.util.helper.InventoryRenderHelper;
public class ModBlocks
{
public class ModBlocks {
public static Block altar;
public static Block bloodRune;
public static Block ritualController;
public static Block ritualStone;
public static Block testSpellBlock;
public static Block pedestal;
public static Block lifeEssence;
public static Block crystal;
public static Block bloodStoneBrick;
public static void init()
{
public static void init() {
FluidRegistry.registerFluid(BlockLifeEssence.getLifeEssence());
lifeEssence = registerBlock(new BlockLifeEssence());
@ -39,21 +36,20 @@ public class ModBlocks
ritualController = registerBlock(new BlockRitualController(), ItemBlockRitualController.class);
ritualStone = registerBlock(new BlockRitualStone(), ItemBlockRitualStone.class);
testSpellBlock = registerBlock(new BlockTestSpellBlock());
pedestal = registerBlock(new BlockPedestal(), ItemBlockPedestal.class);
bloodStoneBrick = registerBlock(new BlockBloodStoneBrick(), ItemBlockBloodStoneBrick.class);
initTiles();
}
public static void initTiles()
{
public static void initTiles() {
GameRegistry.registerTileEntity(TileAltar.class, BloodMagic.MODID + ":" + TileAltar.class.getSimpleName());
GameRegistry.registerTileEntity(TileImperfectRitualStone.class, BloodMagic.MODID + ":" + TileImperfectRitualStone.class.getSimpleName());
GameRegistry.registerTileEntity(TileMasterRitualStone.class, BloodMagic.MODID + ":" + TileMasterRitualStone.class.getSimpleName());
GameRegistry.registerTileEntity(TilePlinth.class, BloodMagic.MODID + ":" + TilePlinth.class.getSimpleName());
}
public static void initRenders()
{
public static void initRenders() {
InventoryRenderHelper renderHelper = BloodMagic.instance.getRenderHelper();
renderHelper.fluidRender(lifeEssence);
@ -78,6 +74,8 @@ public class ModBlocks
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(ritualStone), 6);
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(bloodStoneBrick), 0);
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(bloodStoneBrick), 1);
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(pedestal), 0);
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(pedestal), 1);
}
private static Block registerBlock(Block block, Class<? extends ItemBlock> itemBlock, String name) {

View file

@ -0,0 +1,8 @@
package WayofTime.bloodmagic.tile;
public class TilePlinth extends TileInventory {
public TilePlinth() {
super(1, "plinth");
}
}

View file

@ -0,0 +1,24 @@
{
"forge_marker": 1,
"defaults": {
"textures": { },
"model": "bloodmagic:BlockPedestal1",
"uvlock": true
},
"variants": {
"type": {
"pedestal": {
"model": "bloodmagic:BlockPedestal0",
"textures": {
"all": "bloodmagic:models/Pedestal"
}
},
"plinth": {
"model": "bloodmagic:BlockPedestal1",
"textures": {
"all": "bloodmagic:models/Plinth"
}
}
}
}
}

View file

@ -0,0 +1,97 @@
{
"textures": {
},
"elements": [
{
"name": "Base",
"from": [ 3.0, 0.0, 3.0 ],
"to": [ 13.0, 2.0, 13.0 ],
"faces": {
"north": { "texture": "#-1", "uv": [ 0.0, 0.0, 10.0, 2.0 ] },
"east": { "texture": "#-1", "uv": [ 0.0, 0.0, 10.0, 2.0 ] },
"south": { "texture": "#-1", "uv": [ 0.0, 0.0, 10.0, 2.0 ] },
"west": { "texture": "#-1", "uv": [ 0.0, 0.0, 10.0, 2.0 ] },
"up": { "texture": "#-1", "uv": [ 0.0, 0.0, 10.0, 10.0 ] },
"down": { "texture": "#-1", "uv": [ 0.0, 0.0, 10.0, 10.0 ] }
}
},
{
"name": "Leg",
"from": [ 5.0, 2.0, 5.0 ],
"to": [ 11.0, 11.0, 11.0 ],
"faces": {
"north": { "texture": "#-1", "uv": [ 0.0, 0.0, 6.0, 9.0 ] },
"east": { "texture": "#-1", "uv": [ 0.0, 0.0, 6.0, 9.0 ] },
"south": { "texture": "#-1", "uv": [ 0.0, 0.0, 6.0, 9.0 ] },
"west": { "texture": "#-1", "uv": [ 0.0, 0.0, 6.0, 9.0 ] },
"up": { "texture": "#-1", "uv": [ 0.0, 0.0, 6.0, 6.0 ] },
"down": { "texture": "#-1", "uv": [ 0.0, 0.0, 6.0, 6.0 ] }
}
},
{
"name": "Plate",
"from": [ 1.0, 11.0, 1.0 ],
"to": [ 15.0, 12.0, 15.0 ],
"faces": {
"north": { "texture": "#-1", "uv": [ 0.0, 0.0, 14.0, 1.0 ] },
"east": { "texture": "#-1", "uv": [ 0.0, 0.0, 14.0, 1.0 ] },
"south": { "texture": "#-1", "uv": [ 0.0, 0.0, 14.0, 1.0 ] },
"west": { "texture": "#-1", "uv": [ 0.0, 0.0, 14.0, 1.0 ] },
"up": { "texture": "#-1", "uv": [ 0.0, 0.0, 14.0, 14.0 ] },
"down": { "texture": "#-1", "uv": [ 0.0, 0.0, 14.0, 14.0 ] }
}
},
{
"name": "NWall",
"from": [ 0.0, 11.0, 0.0 ],
"to": [ 16.0, 13.0, 1.0 ],
"faces": {
"north": { "texture": "#-1", "uv": [ 0.0, 0.0, 16.0, 2.0 ] },
"east": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
"south": { "texture": "#-1", "uv": [ 0.0, 0.0, 16.0, 2.0 ] },
"west": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
"up": { "texture": "#-1", "uv": [ 0.0, 0.0, 16.0, 1.0 ] },
"down": { "texture": "#-1", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }
}
},
{
"name": "SWall",
"from": [ 0.0, 11.0, 15.0 ],
"to": [ 16.0, 13.0, 16.0 ],
"faces": {
"north": { "texture": "#-1", "uv": [ 0.0, 0.0, 16.0, 2.0 ] },
"east": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
"south": { "texture": "#-1", "uv": [ 0.0, 0.0, 16.0, 2.0 ] },
"west": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
"up": { "texture": "#-1", "uv": [ 0.0, 0.0, 16.0, 1.0 ] },
"down": { "texture": "#-1", "uv": [ 0.0, 0.0, 16.0, 1.0 ] }
}
},
{
"name": "WWall",
"from": [ 0.0, 11.0, 1.0 ],
"to": [ 1.0, 13.0, 15.0 ],
"faces": {
"north": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
"east": { "texture": "#-1", "uv": [ 0.0, 0.0, 14.0, 2.0 ] },
"south": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
"west": { "texture": "#-1", "uv": [ 0.0, 0.0, 14.0, 2.0 ] },
"up": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 14.0 ] },
"down": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 14.0 ] }
}
},
{
"name": "EWall",
"from": [ 15.0, 11.0, 1.0 ],
"to": [ 16.0, 13.0, 15.0 ],
"faces": {
"north": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
"east": { "texture": "#-1", "uv": [ 0.0, 0.0, 14.0, 2.0 ] },
"south": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 2.0 ] },
"west": { "texture": "#-1", "uv": [ 0.0, 0.0, 14.0, 2.0 ] },
"up": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 14.0 ] },
"down": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 14.0 ] }
}
}
]
}

View file

@ -0,0 +1,10 @@
{
"parent": "bloodmagic:block/BlockPedestal1",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}