Finished adding all of the dungeon blocks and localized them. Added the appropriate models for rotated pillars/pillar caps.
This commit is contained in:
parent
b08c7fd7ae
commit
afcba54df4
21 changed files with 569 additions and 60 deletions
|
@ -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);
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -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())));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue