Added basics for the pillars. Still need to do ALOT of work.
This commit is contained in:
parent
f9593b1d8a
commit
7d49448a22
6 changed files with 170 additions and 34 deletions
|
|
@ -20,12 +20,17 @@ public class BlockHandler {
|
|||
public static Block bush;
|
||||
public static Block lightCube;
|
||||
|
||||
public static Block pillarPlatform;
|
||||
public static Block pillarTower;
|
||||
|
||||
public static void init() {
|
||||
|
||||
oreImbuedStone = new BlockImbuedStone(BlockIds.ORE_STONE_1).setUnlocalizedName(Strings.IMBUED_STONE_NAME);
|
||||
bush = new BlockBush(BlockIds.BUSH).setUnlocalizedName(Strings.BUSH_NAME);
|
||||
lightCube = new BlockLightCube(BlockIds.LIGHT_CUBE).setUnlocalizedName(Strings.LIGHT_CUBE_NAME);
|
||||
|
||||
pillarPlatform = new BlockPillarPlatform(614).setUnlocalizedName("pillarPlatform");
|
||||
pillarTower = new BlockPillarTower(615).setUnlocalizedName("pillarTower");
|
||||
|
||||
registerBlocks();
|
||||
setBlockHarvestLevels();
|
||||
}
|
||||
|
|
@ -35,11 +40,8 @@ public class BlockHandler {
|
|||
GameRegistry.registerBlock(bush, ItemBlockBush.class, Strings.BUSH_NAME);
|
||||
GameRegistry.registerBlock(lightCube, Strings.LIGHT_CUBE_NAME);
|
||||
|
||||
if(Booleans.ENABLE_BUSH_GEN)
|
||||
{
|
||||
GameRegistry.registerWorldGenerator(new WorldGenBushes());
|
||||
}
|
||||
GameRegistry.registerWorldGenerator(new WorldGenStones());
|
||||
GameRegistry.registerBlock(pillarPlatform, "pillarPlatform");
|
||||
GameRegistry.registerBlock(pillarTower, "pillarTower");
|
||||
}
|
||||
|
||||
private static void setBlockHarvestLevels() {
|
||||
|
|
|
|||
84
common/MysticWorld/Blocks/BlockPillarPlatform.java
Normal file
84
common/MysticWorld/Blocks/BlockPillarPlatform.java
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
package MysticWorld.Blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import MysticWorld.MysticWorld;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockPillarPlatform extends Block {
|
||||
|
||||
public BlockPillarPlatform(int id) {
|
||||
super(id, Material.rock);
|
||||
this.setBlockUnbreakable();
|
||||
this.setResistance(6000000.0F);
|
||||
this.setTickRandomly(true);
|
||||
setCreativeTab(MysticWorld.MysticWorldTab);
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.15F, 1.0F);
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public int tickRate(World par1World)
|
||||
{
|
||||
return 30;
|
||||
}
|
||||
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
|
||||
{
|
||||
double posX = (double)x;
|
||||
double posY = (double)y;
|
||||
double posZ = (double)z;
|
||||
|
||||
if (this.isTowersNearby(world, x, y, z))
|
||||
{
|
||||
MysticWorld.proxy.fireFX(world, posX + rand.nextDouble(), posY + 0.20, posZ + rand.nextDouble(), 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
if (this.isTowersNearby(world, x, y, z))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void onEntityWalking(World world, int x, int y, int z, Entity entity)
|
||||
{
|
||||
if (this.isTowersNearby(world, x, y, z))
|
||||
{
|
||||
|
||||
|
||||
super.onEntityWalking(world, x, y, z, entity);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isTowersNearby(World world, int x, int y, int z)
|
||||
{
|
||||
int block = BlockHandler.pillarTower.blockID;
|
||||
|
||||
if (world.getBlockId(x - 2, y, z - 2) == block && world.getBlockId(x - 2, y, z + 2) == block && world.getBlockId(x + 2, y, z + 2) == block && world.getBlockId(x + 2, y, z - 2) == block
|
||||
&& world.getBlockId(x - 2, y + 1, z - 2) == block && world.getBlockId(x - 2, y + 1, z + 2) == block && world.getBlockId(x + 2, y + 1, z + 2) == block && world.getBlockId(x + 2, y + 1, z - 2) == block
|
||||
&& world.getBlockId(x - 2, y + 2, z - 2) == block && world.getBlockId(x - 2, y + 2, z + 2) == block && world.getBlockId(x + 2, y + 2, z + 2) == block && world.getBlockId(x + 2, y + 2, z - 2) == block)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
27
common/MysticWorld/Blocks/BlockPillarTower.java
Normal file
27
common/MysticWorld/Blocks/BlockPillarTower.java
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
package MysticWorld.Blocks;
|
||||
|
||||
import MysticWorld.MysticWorld;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockPillarTower extends Block {
|
||||
|
||||
public BlockPillarTower(int id) {
|
||||
super(id, Material.rock);
|
||||
setBlockUnbreakable();
|
||||
setResistance(6000000.0F);
|
||||
setCreativeTab(MysticWorld.MysticWorldTab);
|
||||
setBlockBounds(0.15F, 0.0F, 0.15F, 0.85F, 1.0F, 0.85F);
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in a new issue