Finished adding all of the dungeon blocks and localized them. Added the appropriate models for rotated pillars/pillar caps.

This commit is contained in:
WayofTime 2016-09-05 10:30:59 -04:00
parent b08c7fd7ae
commit afcba54df4
21 changed files with 569 additions and 60 deletions

View file

@ -296,6 +296,10 @@ public class Constants
DEMON_BRICK_2("BlockDemonBricks2"),
DEMON_BLOCK_EXTRA("BlockDemonExtra"),
DEMON_PILLAR_1("BlockPillar1"),
DEMON_PILLAR_2("BlockPillar2"),
DEMON_PILLAR_CAP_1("BlockPillarCap1"),
DEMON_PILLAR_CAP_2("BlockPillarCap2"),
DEMON_PILLAR_CAP_3("BlockPillarCap3"),
DEMON_LIGHT("BlockDemonLight");
@Getter

View file

@ -15,13 +15,14 @@ import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.block.base.BlockStringPillar;
import WayofTime.bloodmagic.client.IVariantProvider;
public class BlockDemonPillar extends BlockStringPillar implements IVariantProvider
public class BlockDemonPillarBase extends BlockStringPillar implements IVariantProvider
{
public static final String[] names = new String[] { "raw", "corrosive", "destructive", "vengeful", "steadfast" };
public final String[] names;
public BlockDemonPillar(String baseName, Material materialIn)
public BlockDemonPillarBase(String baseName, Material materialIn, String[] names)
{
super(materialIn, names);
this.names = names;
setUnlocalizedName(Constants.Mod.MODID + "." + baseName + ".");
setCreativeTab(BloodMagic.tabBloodMagic);

View file

@ -0,0 +1,52 @@
package WayofTime.bloodmagic.block;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.util.EnumFacing;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.block.base.BlockStringPillarCap;
import WayofTime.bloodmagic.client.IVariantProvider;
public class BlockDemonPillarCapBase extends BlockStringPillarCap implements IVariantProvider
{
public final String[] names;
public BlockDemonPillarCapBase(String baseName, Material materialIn, String[] names)
{
super(materialIn, names);
this.names = names;
setUnlocalizedName(Constants.Mod.MODID + "." + baseName + ".");
setCreativeTab(BloodMagic.tabBloodMagic);
setHardness(2.0F);
setResistance(5.0F);
setSoundType(SoundType.STONE);
setHarvestLevel("pickaxe", 2);
}
@Override
public List<Pair<Integer, String>> getVariants()
{
List<Pair<Integer, String>> ret = new ArrayList<Pair<Integer, String>>();
//This is done to make the ItemBlocks have the proper model
for (int i = 0; i < EnumFacing.values().length; i++)
{
for (int j = 0; j < names.length; j++)
{
ret.add(new ImmutablePair<Integer, String>(i * 2 + j, "facing=" + EnumFacing.values()[i] + ",type=" + names[j]));
}
}
return ret;
}
}

View file

@ -114,12 +114,6 @@ public class BlockStringPillar extends BlockString
this.setDefaultState(getExtendedBlockState().withProperty(this.getUnlistedStringProp(), this.getValues().get(0)).withProperty(this.getStringProp(), this.getValues().get(0)).withProperty(BlockRotatedPillar.AXIS, EnumFacing.Axis.Y));
}
// @Override
// protected BlockStateContainer createBlockState()
// {
// return new BlockStateContainer(this, new IProperty[] { this.getStringProp(), BlockRotatedPillar.AXIS });
// }
@Override
protected BlockStateContainer createRealBlockState()
{

View file

@ -0,0 +1,100 @@
package WayofTime.bloodmagic.block.base;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
public class BlockStringPillarCap extends BlockString
{
public static final PropertyDirection FACING = PropertyDirection.create("facing");
public BlockStringPillarCap(Material material, String[] values, String propName)
{
super(material, values, propName);
}
public BlockStringPillarCap(Material material, String[] values)
{
this(material, values, "type");
}
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState iblockstate = getBlockState().getBaseState().withProperty(this.getStringProp(), this.getValues().get(meta % 2));
int index = meta / 2;
EnumFacing facing = EnumFacing.getFront(index);
iblockstate = iblockstate.withProperty(FACING, facing);
return iblockstate;
}
@Override
public int getMetaFromState(IBlockState state)
{
int i = 0;
i = this.getValues().indexOf(String.valueOf(state.getValue(this.getStringProp())));
EnumFacing facing = (EnumFacing) state.getValue(FACING);
int index = facing.getIndex();
i = i + 2 * index;
return i;
}
@Override
public IBlockState withRotation(IBlockState state, Rotation rot)
{
return state.withProperty(FACING, rot.rotate((EnumFacing) state.getValue(FACING)));
}
@Override
public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
{
return state.withRotation(mirrorIn.toRotation((EnumFacing) state.getValue(FACING)));
}
@Override
protected void setupStates()
{
this.setDefaultState(getExtendedBlockState().withProperty(this.getUnlistedStringProp(), this.getValues().get(0)).withProperty(this.getStringProp(), this.getValues().get(0)).withProperty(FACING, EnumFacing.UP));
}
@Override
protected BlockStateContainer createRealBlockState()
{
return new ExtendedBlockState(this, new IProperty[] { this.getStringProp(), FACING }, new IUnlistedProperty[] { this.getUnlistedStringProp() });
}
@Override
protected ItemStack createStackedBlock(IBlockState state)
{
return new ItemStack(Item.getItemFromBlock(this), 1, this.getValues().indexOf(String.valueOf(state.getValue(this.getStringProp()))));
}
@Override
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
{
System.out.println("Facing: " + facing);
return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(FACING, facing);
}
@Override
public int damageDropped(IBlockState state)
{
return this.getValues().indexOf(String.valueOf(state.getValue(this.getStringProp())));
}
}

View file

@ -1,30 +1,29 @@
package WayofTime.bloodmagic.item.block;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import WayofTime.bloodmagic.block.BlockDemonPillar;
import WayofTime.bloodmagic.block.BlockDemonPillarBase;
public class ItemBlockDemonPillarBase extends ItemBlock
{
// public final BlockDemonBase demonBlock;
public final BlockDemonPillarBase demonBlock;
public ItemBlockDemonPillarBase(Block block)
public ItemBlockDemonPillarBase(BlockDemonPillarBase block)
{
super(block);
setHasSubtypes(true);
// demonBlock = block;
demonBlock = block;
}
@Override
public String getUnlocalizedName(ItemStack stack)
{
return super.getUnlocalizedName(stack) + BlockDemonPillar.names[stack.getItemDamage() % BlockDemonPillar.names.length];
return super.getUnlocalizedName(stack) + demonBlock.names[stack.getItemDamage() % demonBlock.names.length];
}
@Override
public int getMetadata(int meta)
{
return meta % BlockDemonPillar.names.length;
return meta % demonBlock.names.length;
}
}

View file

@ -0,0 +1,29 @@
package WayofTime.bloodmagic.item.block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import WayofTime.bloodmagic.block.BlockDemonPillarCapBase;
public class ItemBlockDemonPillarCapBase extends ItemBlock
{
public final BlockDemonPillarCapBase demonBlock;
public ItemBlockDemonPillarCapBase(BlockDemonPillarCapBase block)
{
super(block);
setHasSubtypes(true);
demonBlock = block;
}
@Override
public String getUnlocalizedName(ItemStack stack)
{
return super.getUnlocalizedName(stack) + demonBlock.names[stack.getItemDamage() % demonBlock.names.length];
}
@Override
public int getMetadata(int meta)
{
return meta % demonBlock.names.length;
}
}

View file

@ -24,7 +24,8 @@ import WayofTime.bloodmagic.block.BlockDemonCrucible;
import WayofTime.bloodmagic.block.BlockDemonCrystal;
import WayofTime.bloodmagic.block.BlockDemonCrystallizer;
import WayofTime.bloodmagic.block.BlockDemonLight;
import WayofTime.bloodmagic.block.BlockDemonPillar;
import WayofTime.bloodmagic.block.BlockDemonPillarBase;
import WayofTime.bloodmagic.block.BlockDemonPillarCapBase;
import WayofTime.bloodmagic.block.BlockDemonPylon;
import WayofTime.bloodmagic.block.BlockDimensionalPortal;
import WayofTime.bloodmagic.block.BlockIncenseAltar;
@ -51,6 +52,7 @@ import WayofTime.bloodmagic.item.block.ItemBlockDemonBase;
import WayofTime.bloodmagic.item.block.ItemBlockDemonCrystal;
import WayofTime.bloodmagic.item.block.ItemBlockDemonLight;
import WayofTime.bloodmagic.item.block.ItemBlockDemonPillarBase;
import WayofTime.bloodmagic.item.block.ItemBlockDemonPillarCapBase;
import WayofTime.bloodmagic.item.block.ItemBlockMimic;
import WayofTime.bloodmagic.item.block.ItemBlockPath;
import WayofTime.bloodmagic.item.block.ItemBlockPedestal;
@ -124,6 +126,11 @@ public class ModBlocks
public static Block demonBrick2;
public static Block demonExtras;
public static Block demonPillar1;
public static Block demonPillar2;
public static Block demonPillarCap1;
public static Block demonPillarCap2;
public static Block demonPillarCap3;
public static Block demonLight;
@ -168,7 +175,11 @@ public class ModBlocks
demonBrick2 = registerBlock(new ItemBlockDemonBase(new BlockDemonBase("bricks2", new String[] { "smallbrick_raw", "smallbrick_corrosive", "smallbrick_destructive", "smallbrick_vengeful", "smallbrick_steadfast", "tile_raw", "tile_corrosive", "tile_destructive", "tile_vengeful", "tile_steadfast", "tilespecial_raw", "tilespecial_corrosive", "tilespecial_destructive", "tilespecial_vengeful", "tilespecial_steadfast" })), Constants.BloodMagicBlock.DEMON_BRICK_2.getRegName());
demonExtras = registerBlock(new ItemBlockDemonBase(new BlockDemonBase("extras", new String[] { "stone_raw", "stone_corrosive", "stone_destructive", "stone_vengeful", "stone_steadfast", "polished_raw", "polished_corrosive", "polished_destructive", "polished_vengeful", "polished_steadfast", "metal_raw", "metal_corrosive", "metal_destructive", "metal_vengeful", "metal_steadfast" })), Constants.BloodMagicBlock.DEMON_BLOCK_EXTRA.getRegName());
demonPillar1 = registerBlock(new ItemBlockDemonPillarBase(new BlockDemonPillar("pillar1", Material.ROCK)), "BlockPillar1");
demonPillar1 = registerBlock(new ItemBlockDemonPillarBase(new BlockDemonPillarBase("pillar1", Material.ROCK, new String[] { "raw", "corrosive", "destructive", "vengeful", "steadfast" })), Constants.BloodMagicBlock.DEMON_PILLAR_1.getRegName());
demonPillar2 = registerBlock(new ItemBlockDemonPillarBase(new BlockDemonPillarBase("pillar2", Material.ROCK, new String[] { "raw", "corrosive", "destructive", "vengeful", "steadfast" })), Constants.BloodMagicBlock.DEMON_PILLAR_2.getRegName());
demonPillarCap1 = registerBlock(new ItemBlockDemonPillarCapBase(new BlockDemonPillarCapBase("pillarCap1", Material.ROCK, new String[] { "raw", "corrosive" })), Constants.BloodMagicBlock.DEMON_PILLAR_CAP_1.getRegName());
demonPillarCap2 = registerBlock(new ItemBlockDemonPillarCapBase(new BlockDemonPillarCapBase("pillarCap2", Material.ROCK, new String[] { "destructive", "vengeful" })), Constants.BloodMagicBlock.DEMON_PILLAR_CAP_2.getRegName());
demonPillarCap3 = registerBlock(new ItemBlockDemonPillarCapBase(new BlockDemonPillarCapBase("pillarCap3", Material.ROCK, new String[] { "steadfast" })), Constants.BloodMagicBlock.DEMON_PILLAR_CAP_3.getRegName());
// testSpellBlock = registerBlock(new BlockTestSpellBlock());
demonLight = registerBlock(new ItemBlockDemonLight(new BlockDemonLight()), Constants.BloodMagicBlock.DEMON_LIGHT.getRegName());