Finished adding the standard blocks and localized them - pillars are next
This commit is contained in:
parent
d52240813e
commit
1286efbca7
10 changed files with 285 additions and 33 deletions
|
@ -0,0 +1,41 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.block.base.BlockString;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockDemonLight extends BlockString implements IVariantProvider
|
||||
{
|
||||
public static final String[] names = { "raw", "corrosive", "destructive", "vengeful", "steadfast" };
|
||||
|
||||
public BlockDemonLight()
|
||||
{
|
||||
super(Material.ROCK, names);
|
||||
|
||||
setUnlocalizedName(Constants.Mod.MODID + ".demonlight.");
|
||||
setCreativeTab(BloodMagic.tabBloodMagic);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setSoundType(SoundType.STONE);
|
||||
setHarvestLevel("pickaxe", 2);
|
||||
setLightLevel(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pair<Integer, String>> getVariants()
|
||||
{
|
||||
List<Pair<Integer, String>> ret = new ArrayList<Pair<Integer, String>>();
|
||||
for (int i = 0; i < names.length; i++)
|
||||
ret.add(new ImmutablePair<Integer, String>(i, "type=" + names[i]));
|
||||
return ret;
|
||||
}
|
||||
}
|
|
@ -35,21 +35,15 @@ public class BlockDemonPillar extends BlockStringPillar implements IVariantProvi
|
|||
public List<Pair<Integer, String>> getVariants()
|
||||
{
|
||||
List<Pair<Integer, String>> ret = new ArrayList<Pair<Integer, String>>();
|
||||
// for (int i = 0; i < 3; i++)
|
||||
// {
|
||||
// ret.add(new ImmutablePair<Integer, String>(i, "axis=" + EnumFacing.Axis.values()[i]));
|
||||
// }
|
||||
//
|
||||
// for (int i = 0; i < names.length; i++)
|
||||
// {
|
||||
// ret.add(new ImmutablePair<Integer, String>(i + 3, "type=" + names[i]));
|
||||
// }
|
||||
|
||||
//This is done to make the ItemBlocks have the proper model
|
||||
EnumFacing.Axis[] axis = new EnumFacing.Axis[] { EnumFacing.Axis.Y, EnumFacing.Axis.X, EnumFacing.Axis.Z };
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
for (int j = 0; j < names.length; j++)
|
||||
{
|
||||
ret.add(new ImmutablePair<Integer, String>(j * 3 + i, "axis=" + EnumFacing.Axis.values()[i] + ",type=" + names[j]));
|
||||
ret.add(new ImmutablePair<Integer, String>(i * 4 + j, "axis=" + axis[i] + ",type=" + names[j]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,11 +6,9 @@ import net.minecraft.block.properties.IProperty;
|
|||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -29,16 +27,6 @@ public class BlockStringPillar extends BlockString
|
|||
this(material, values, "type");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
// System.out.println(state);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given metadata into a BlockState for this Block
|
||||
*/
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
|
@ -60,8 +48,6 @@ public class BlockStringPillar extends BlockString
|
|||
break;
|
||||
}
|
||||
|
||||
// System.out.println(iblockstate);
|
||||
|
||||
return iblockstate;
|
||||
}
|
||||
|
||||
|
@ -70,18 +56,16 @@ public class BlockStringPillar extends BlockString
|
|||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
int i = 0;
|
||||
i = i | this.getValues().indexOf(String.valueOf(state.getValue(this.getStringProp())));
|
||||
i = this.getValues().indexOf(String.valueOf(state.getValue(this.getStringProp())));
|
||||
|
||||
switch ((EnumFacing.Axis) state.getValue(BlockRotatedPillar.AXIS))
|
||||
{
|
||||
case X:
|
||||
i |= 4;
|
||||
i = i + 4;
|
||||
break;
|
||||
case Z:
|
||||
i |= 8;
|
||||
i = i + 8;
|
||||
break;
|
||||
// case NONE:
|
||||
// i |= 12;
|
||||
}
|
||||
|
||||
return i;
|
||||
|
@ -90,8 +74,8 @@ public class BlockStringPillar extends BlockString
|
|||
@Override
|
||||
public boolean rotateBlock(net.minecraft.world.World world, BlockPos pos, EnumFacing axis)
|
||||
{
|
||||
net.minecraft.block.state.IBlockState state = world.getBlockState(pos);
|
||||
for (net.minecraft.block.properties.IProperty<?> prop : state.getProperties().keySet())
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
for (IProperty<?> prop : state.getProperties().keySet())
|
||||
{
|
||||
if (prop == BlockRotatedPillar.AXIS)
|
||||
{
|
||||
|
@ -153,4 +137,10 @@ public class BlockStringPillar extends BlockString
|
|||
{
|
||||
return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(BlockRotatedPillar.AXIS, facing.getAxis());
|
||||
}
|
||||
|
||||
@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