diff --git a/common/MysticWorld/Blocks/BlockHandler.java b/common/MysticWorld/Blocks/BlockHandler.java index af91f2d..ef2ae61 100644 --- a/common/MysticWorld/Blocks/BlockHandler.java +++ b/common/MysticWorld/Blocks/BlockHandler.java @@ -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() { diff --git a/common/MysticWorld/Blocks/BlockPillarPlatform.java b/common/MysticWorld/Blocks/BlockPillarPlatform.java new file mode 100644 index 0000000..ca13066 --- /dev/null +++ b/common/MysticWorld/Blocks/BlockPillarPlatform.java @@ -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; + } + +} diff --git a/common/MysticWorld/Blocks/BlockPillarTower.java b/common/MysticWorld/Blocks/BlockPillarTower.java new file mode 100644 index 0000000..cc4c272 --- /dev/null +++ b/common/MysticWorld/Blocks/BlockPillarTower.java @@ -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; + } + +} diff --git a/common/MysticWorld/Items/ItemVoidShard.java b/common/MysticWorld/Items/ItemVoidShard.java index d8b4cb6..8cb4689 100644 --- a/common/MysticWorld/Items/ItemVoidShard.java +++ b/common/MysticWorld/Items/ItemVoidShard.java @@ -12,10 +12,12 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.Icon; +import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class ItemVoidShard extends Item { - + public ItemVoidShard(int id) { super(id); this.setMaxStackSize(1); @@ -82,11 +84,12 @@ public class ItemVoidShard extends Item { return false; } } - - @Override - public void registerIcons(IconRegister iconRegister) - { - itemIcon = iconRegister.registerIcon("MysticTextures:ShardVoid"); - } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IconRegister iconRegister) + { + itemIcon = iconRegister.registerIcon("MysticTextures:ShardVoid"); + } } diff --git a/common/MysticWorld/Lang.java b/common/MysticWorld/Lang.java index d8e4e16..86fb2a3 100644 --- a/common/MysticWorld/Lang.java +++ b/common/MysticWorld/Lang.java @@ -34,6 +34,9 @@ public class Lang 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 LanguageRegistry.instance().addName(new ItemStack(ItemHandler$1.staffParts, 1, 0), "Staff"); LanguageRegistry.instance().addName(new ItemStack(ItemHandler$1.staffParts, 1, 1), "Staff Hilt"); diff --git a/common/MysticWorld/TickHandler.java b/common/MysticWorld/TickHandler.java index 4c892e4..dfbeb5e 100644 --- a/common/MysticWorld/TickHandler.java +++ b/common/MysticWorld/TickHandler.java @@ -25,19 +25,55 @@ import cpw.mods.fml.common.TickType; public class TickHandler implements IScheduledTickHandler { private EnumSet ticks; - - Random rand = new Random(); public TickHandler(){ this.ticks = EnumSet.of(TickType.PLAYER); } public void tickStart(EnumSet type, Object... tickData){ + Random rand = new Random(); EntityPlayer player = (EntityPlayer)tickData[0]; World world = player.worldObj; InventoryPlayer inventory = player.inventory; ItemStack itemstack = inventory.getCurrentItem(); + staffAndOrbTick(player, world, itemstack, rand); + + pillarTick(player, world); + } + + public void tickEnd(EnumSet 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)){ 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); @@ -60,24 +96,5 @@ public class TickHandler implements IScheduledTickHandler 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); } - - } - - public void tickEnd(EnumSet 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; } } \ No newline at end of file