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 bush;
|
||||||
public static Block lightCube;
|
public static Block lightCube;
|
||||||
|
|
||||||
public static void init() {
|
public static Block pillarPlatform;
|
||||||
|
public static Block pillarTower;
|
||||||
|
|
||||||
|
public static void init() {
|
||||||
oreImbuedStone = new BlockImbuedStone(BlockIds.ORE_STONE_1).setUnlocalizedName(Strings.IMBUED_STONE_NAME);
|
oreImbuedStone = new BlockImbuedStone(BlockIds.ORE_STONE_1).setUnlocalizedName(Strings.IMBUED_STONE_NAME);
|
||||||
bush = new BlockBush(BlockIds.BUSH).setUnlocalizedName(Strings.BUSH_NAME);
|
bush = new BlockBush(BlockIds.BUSH).setUnlocalizedName(Strings.BUSH_NAME);
|
||||||
lightCube = new BlockLightCube(BlockIds.LIGHT_CUBE).setUnlocalizedName(Strings.LIGHT_CUBE_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();
|
registerBlocks();
|
||||||
setBlockHarvestLevels();
|
setBlockHarvestLevels();
|
||||||
}
|
}
|
||||||
|
|
@ -35,11 +40,8 @@ public class BlockHandler {
|
||||||
GameRegistry.registerBlock(bush, ItemBlockBush.class, Strings.BUSH_NAME);
|
GameRegistry.registerBlock(bush, ItemBlockBush.class, Strings.BUSH_NAME);
|
||||||
GameRegistry.registerBlock(lightCube, Strings.LIGHT_CUBE_NAME);
|
GameRegistry.registerBlock(lightCube, Strings.LIGHT_CUBE_NAME);
|
||||||
|
|
||||||
if(Booleans.ENABLE_BUSH_GEN)
|
GameRegistry.registerBlock(pillarPlatform, "pillarPlatform");
|
||||||
{
|
GameRegistry.registerBlock(pillarTower, "pillarTower");
|
||||||
GameRegistry.registerWorldGenerator(new WorldGenBushes());
|
|
||||||
}
|
|
||||||
GameRegistry.registerWorldGenerator(new WorldGenStones());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setBlockHarvestLevels() {
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -12,6 +12,8 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.Icon;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class ItemVoidShard extends Item {
|
public class ItemVoidShard extends Item {
|
||||||
|
|
@ -83,10 +85,11 @@ public class ItemVoidShard extends Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerIcons(IconRegister iconRegister)
|
@SideOnly(Side.CLIENT)
|
||||||
{
|
public void registerIcons(IconRegister iconRegister)
|
||||||
itemIcon = iconRegister.registerIcon("MysticTextures:ShardVoid");
|
{
|
||||||
}
|
itemIcon = iconRegister.registerIcon("MysticTextures:ShardVoid");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,9 @@ public class Lang
|
||||||
|
|
||||||
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.lightCube, 1), "Light Cube");
|
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.lightCube, 1), "Light Cube");
|
||||||
|
|
||||||
|
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.pillarPlatform, 1), "Pillar Platform");
|
||||||
|
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.pillarTower, 1), "Pillar Tower");
|
||||||
|
|
||||||
//Items
|
//Items
|
||||||
LanguageRegistry.instance().addName(new ItemStack(ItemHandler$1.staffParts, 1, 0), "Staff");
|
LanguageRegistry.instance().addName(new ItemStack(ItemHandler$1.staffParts, 1, 0), "Staff");
|
||||||
LanguageRegistry.instance().addName(new ItemStack(ItemHandler$1.staffParts, 1, 1), "Staff Hilt");
|
LanguageRegistry.instance().addName(new ItemStack(ItemHandler$1.staffParts, 1, 1), "Staff Hilt");
|
||||||
|
|
|
||||||
|
|
@ -26,18 +26,54 @@ public class TickHandler implements IScheduledTickHandler
|
||||||
{
|
{
|
||||||
private EnumSet ticks;
|
private EnumSet ticks;
|
||||||
|
|
||||||
Random rand = new Random();
|
|
||||||
|
|
||||||
public TickHandler(){
|
public TickHandler(){
|
||||||
this.ticks = EnumSet.of(TickType.PLAYER);
|
this.ticks = EnumSet.of(TickType.PLAYER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tickStart(EnumSet<TickType> type, Object... tickData){
|
public void tickStart(EnumSet<TickType> type, Object... tickData){
|
||||||
|
Random rand = new Random();
|
||||||
EntityPlayer player = (EntityPlayer)tickData[0];
|
EntityPlayer player = (EntityPlayer)tickData[0];
|
||||||
World world = player.worldObj;
|
World world = player.worldObj;
|
||||||
InventoryPlayer inventory = player.inventory;
|
InventoryPlayer inventory = player.inventory;
|
||||||
ItemStack itemstack = inventory.getCurrentItem();
|
ItemStack itemstack = inventory.getCurrentItem();
|
||||||
|
|
||||||
|
staffAndOrbTick(player, world, itemstack, rand);
|
||||||
|
|
||||||
|
pillarTick(player, world);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void tickEnd(EnumSet<TickType> type, Object... tickData){
|
||||||
|
EntityPlayer player = (EntityPlayer)tickData[0];
|
||||||
|
World world = player.worldObj;
|
||||||
|
InventoryPlayer inventory = player.inventory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnumSet ticks(){
|
||||||
|
return this.ticks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel(){
|
||||||
|
return "mystic world tick";
|
||||||
|
}
|
||||||
|
|
||||||
|
public int nextTickSpacing(){
|
||||||
|
return 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void pillarTick(EntityPlayer player, World world)
|
||||||
|
{
|
||||||
|
int block = world.getBlockId((int)player.posX, (int)player.posY, (int)player.posZ);
|
||||||
|
int foodLevel = player.getFoodStats().getFoodLevel();
|
||||||
|
|
||||||
|
if (block == BlockHandler.pillarPlatform.blockID)
|
||||||
|
{
|
||||||
|
player.getFoodStats().setFoodLevel(foodLevel + 1);
|
||||||
|
player.getFoodStats().setFoodSaturationLevel(20);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void staffAndOrbTick(EntityPlayer player, World world, ItemStack itemstack, Random rand)
|
||||||
|
{
|
||||||
if (itemstack != null && (itemstack.itemID == ItemHandler$1.fireOrb.itemID || itemstack.itemID == ItemHandler$1.fireStaff.itemID)){
|
if (itemstack != null && (itemstack.itemID == ItemHandler$1.fireOrb.itemID || itemstack.itemID == ItemHandler$1.fireStaff.itemID)){
|
||||||
player.addPotionEffect(new PotionEffect(Potion.fireResistance.getId(), 20, 0));
|
player.addPotionEffect(new PotionEffect(Potion.fireResistance.getId(), 20, 0));
|
||||||
MysticWorld.proxy.fireFX(world, (player.posX - 0.5D) + rand.nextDouble(), player.posY, (player.posZ - 0.5D) + rand.nextDouble(), 1.0F);
|
MysticWorld.proxy.fireFX(world, (player.posX - 0.5D) + rand.nextDouble(), player.posY, (player.posZ - 0.5D) + rand.nextDouble(), 1.0F);
|
||||||
|
|
@ -60,24 +96,5 @@ public class TickHandler implements IScheduledTickHandler
|
||||||
if (itemstack != null && (itemstack.itemID == ItemHandler$1.waterOrb.itemID || itemstack.itemID == ItemHandler$1.waterStaff.itemID)){
|
if (itemstack != null && (itemstack.itemID == ItemHandler$1.waterOrb.itemID || itemstack.itemID == ItemHandler$1.waterStaff.itemID)){
|
||||||
MysticWorld.proxy.waterFX(world, (player.posX - 0.5D) + rand.nextDouble(), player.posY, (player.posZ - 0.5D) + rand.nextDouble(), 1.0F);
|
MysticWorld.proxy.waterFX(world, (player.posX - 0.5D) + rand.nextDouble(), player.posY, (player.posZ - 0.5D) + rand.nextDouble(), 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void tickEnd(EnumSet<TickType> type, Object... tickData){
|
|
||||||
EntityPlayer player = (EntityPlayer)tickData[0];
|
|
||||||
World world = player.worldObj;
|
|
||||||
InventoryPlayer inventory = player.inventory;
|
|
||||||
}
|
|
||||||
|
|
||||||
public EnumSet ticks(){
|
|
||||||
return this.ticks;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLabel(){
|
|
||||||
return "mystic world tick";
|
|
||||||
}
|
|
||||||
|
|
||||||
public int nextTickSpacing(){
|
|
||||||
return 10;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue