Added energy orb stuff
This commit is contained in:
parent
d62e0d07ab
commit
0c5beb60b9
16 changed files with 256 additions and 18 deletions
|
|
@ -15,32 +15,34 @@ import net.minecraftforge.common.MinecraftForge;
|
|||
|
||||
public class BlockHandler {
|
||||
|
||||
public static Block OreImbuedStone;
|
||||
public static Block oreImbuedStone;
|
||||
public static Block bush;
|
||||
public static Block lightCube;
|
||||
|
||||
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);
|
||||
lightCube = new BlockLightCube(BlockIds.LIGHT_CUBE).setUnlocalizedName(Strings.LIGHT_CUBE_NAME);
|
||||
|
||||
registerBlocks();
|
||||
setBlockHarvestLevels();
|
||||
}
|
||||
|
||||
private static void registerBlocks() {
|
||||
GameRegistry.registerBlock(OreImbuedStone, ItemBlockImbuedStone.class, Strings.IMBUED_STONE_NAME);
|
||||
GameRegistry.registerBlock(oreImbuedStone, ItemBlockImbuedStone.class, Strings.IMBUED_STONE_NAME);
|
||||
GameRegistry.registerBlock(bush, ItemBlockBush.class, Strings.BUSH_NAME);
|
||||
GameRegistry.registerBlock(lightCube, Strings.LIGHT_CUBE_NAME);
|
||||
|
||||
GameRegistry.registerWorldGenerator(new WorldGenBushes());
|
||||
GameRegistry.registerWorldGenerator(new WorldGenStones());
|
||||
|
||||
}
|
||||
|
||||
private static void setBlockHarvestLevels() {
|
||||
MinecraftForge.setBlockHarvestLevel(OreImbuedStone, 0, "pickaxe", 2);
|
||||
MinecraftForge.setBlockHarvestLevel(OreImbuedStone, 1, "pickaxe", 2);
|
||||
MinecraftForge.setBlockHarvestLevel(OreImbuedStone, 2, "pickaxe", 2);
|
||||
MinecraftForge.setBlockHarvestLevel(OreImbuedStone, 3, "pickaxe", 2);
|
||||
MinecraftForge.setBlockHarvestLevel(OreImbuedStone, 4, "pickaxe", 2);
|
||||
MinecraftForge.setBlockHarvestLevel(oreImbuedStone, 0, "pickaxe", 2);
|
||||
MinecraftForge.setBlockHarvestLevel(oreImbuedStone, 1, "pickaxe", 2);
|
||||
MinecraftForge.setBlockHarvestLevel(oreImbuedStone, 2, "pickaxe", 2);
|
||||
MinecraftForge.setBlockHarvestLevel(oreImbuedStone, 3, "pickaxe", 2);
|
||||
MinecraftForge.setBlockHarvestLevel(oreImbuedStone, 4, "pickaxe", 2);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
62
common/MysticWorld/Blocks/BlockLightCube.java
Normal file
62
common/MysticWorld/Blocks/BlockLightCube.java
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
package MysticWorld.Blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import MysticWorld.MysticWorld;
|
||||
import MysticWorld.Items.ItemHandler$1;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockLightCube extends Block {
|
||||
|
||||
public BlockLightCube(int id) {
|
||||
super(id, Material.circuits);
|
||||
setBlockBounds(0.25F, 0.25F, 0.25F, 0.75F, 0.75F, 0.75F);
|
||||
setLightValue(1.0F);
|
||||
this.setTickRandomly(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canSilkHarvest()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int idDropped(int par1, Random par2Random, int par3)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
MysticWorld.proxy.lightCubeFX(world, (double)x + random.nextDouble(), (double)y + 0.75D, (double)z + random.nextDouble(), 0.0D, 0.0D, 0.0D, 1.0F);
|
||||
MysticWorld.proxy.lightCubeFX(world, (double)x + random.nextDouble(), (double)y + 0.75D, (double)z + random.nextDouble(), 0.0D, 0.0D, 0.0D, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("MysticTextures" + ":" + "lightCube");
|
||||
}
|
||||
}
|
||||
|
|
@ -37,7 +37,7 @@ public class ItemBlockImbuedStone extends ItemBlock {
|
|||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIconFromDamage(int par1)
|
||||
{
|
||||
return BlockHandler.OreImbuedStone.getIcon(2, par1);
|
||||
return BlockHandler.oreImbuedStone.getIcon(2, par1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import MysticWorld.Client.FX.AirFX;
|
|||
import MysticWorld.Client.FX.EarthFX;
|
||||
import MysticWorld.Client.FX.EnergyFX;
|
||||
import MysticWorld.Client.FX.FireFX;
|
||||
import MysticWorld.Client.FX.LightCubeFX;
|
||||
import MysticWorld.Client.FX.WaterFX;
|
||||
import MysticWorld.Entity.EntityChargeAir;
|
||||
import MysticWorld.Entity.EntityChargeEarth;
|
||||
|
|
@ -72,4 +73,11 @@ public class ClientProxy extends CommonProxy {
|
|||
ModLoader.getMinecraftInstance().effectRenderer.addEffect(waterFX);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lightCubeFX(World worldObj, double x, double y, double z, double motionX, double motionY, double motionZ, float scale)
|
||||
{
|
||||
LightCubeFX lightCubeFX = new LightCubeFX(worldObj, x, y, z, motionX, motionY, motionZ, scale);
|
||||
ModLoader.getMinecraftInstance().effectRenderer.addEffect(lightCubeFX);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
101
common/MysticWorld/Client/FX/LightCubeFX.java
Normal file
101
common/MysticWorld/Client/FX/LightCubeFX.java
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
package MysticWorld.Client.FX;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class LightCubeFX extends EntityFX {
|
||||
|
||||
public LightCubeFX(World world, double x, double y, double z)
|
||||
{
|
||||
super(world, x, y, z);
|
||||
}
|
||||
|
||||
public LightCubeFX(World world, double x, double y, double z, double motionX, double motionY, double motionZ, float scale){
|
||||
super(world, x, y, z);
|
||||
this.motionX *= 0.10000000149011612D;
|
||||
this.motionY *= 0.10000000149011612D;
|
||||
this.motionZ *= 0.10000000149011612D;
|
||||
this.motionX += motionX;
|
||||
this.motionY += motionY;
|
||||
this.motionZ += motionZ;
|
||||
this.particleRed = 1.0F;
|
||||
this.particleGreen = 1.0F;
|
||||
this.particleBlue = 1.0F;
|
||||
this.particleScale = scale;
|
||||
this.noClip = true;
|
||||
this.particleMaxAge = rand.nextInt(25);
|
||||
}
|
||||
|
||||
public void onUpdate()
|
||||
{
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge)
|
||||
{
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
this.motionY += 0.004D;
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
|
||||
if (this.posY == this.prevPosY)
|
||||
{
|
||||
this.motionX *= 1.1D;
|
||||
this.motionZ *= 1.1D;
|
||||
}
|
||||
|
||||
this.motionX *= 0.9599999785423279D;
|
||||
this.motionY *= 0.9599999785423279D;
|
||||
this.motionZ *= 0.9599999785423279D;
|
||||
|
||||
if (this.onGround)
|
||||
{
|
||||
this.motionX *= 0.699999988079071D;
|
||||
this.motionZ *= 0.699999988079071D;
|
||||
}
|
||||
}
|
||||
|
||||
public void renderParticle(Tessellator tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
|
||||
{
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glEnable(3042);
|
||||
GL11.glBlendFunc(770, 1);
|
||||
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture("/mods/MysticTextures/textures/misc/lightCubeFX.png");
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F);
|
||||
|
||||
float scale = 0.1F * this.particleScale;
|
||||
float xPos = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) par2 - interpPosX);
|
||||
float yPos = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) par2 - interpPosY);
|
||||
float zPos = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) par2 - interpPosZ);
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setBrightness(240);
|
||||
|
||||
tessellator.setColorOpaque_F(this.particleRed, this.particleGreen, this.particleBlue);
|
||||
|
||||
tessellator.addVertexWithUV((double) (xPos - par3 * scale - par6 * scale), (double) (yPos - par4 * scale), (double) (zPos - par5 * scale - par7 * scale), 0D, 1D);
|
||||
tessellator.addVertexWithUV((double) (xPos - par3 * scale + par6 * scale), (double) (yPos + par4 * scale), (double) (zPos - par5 * scale + par7 * scale), 1D, 1D);
|
||||
tessellator.addVertexWithUV((double) (xPos + par3 * scale + par6 * scale), (double) (yPos + par4 * scale), (double) (zPos + par5 * scale + par7 * scale), 1D, 0D);
|
||||
tessellator.addVertexWithUV((double) (xPos + par3 * scale - par6 * scale), (double) (yPos - par4 * scale), (double) (zPos + par5 * scale - par7 * scale), 0D, 0D);
|
||||
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glDisable(3042);
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture("/particles.png");
|
||||
tessellator.startDrawingQuads();
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package MysticWorld;
|
|||
import net.minecraft.src.ModLoader;
|
||||
import net.minecraft.world.World;
|
||||
import MysticWorld.Client.FX.AirFX;
|
||||
import MysticWorld.Client.FX.LightCubeFX;
|
||||
|
||||
public class CommonProxy {
|
||||
|
||||
|
|
@ -30,4 +31,7 @@ public class CommonProxy {
|
|||
public void waterFX(World worldObj, double x, double y, double z, float scale){
|
||||
}
|
||||
|
||||
public void lightCubeFX(World worldObj, double x, double y, double z, double motionX, double motionY, double motionZ, float scale){
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public class Config
|
|||
//Block Configuration
|
||||
BlockIds.ORE_STONE_1 = config.getBlock(Strings.IMBUED_STONE_NAME, BlockIds.ORE_STONE_1_DEFAULT).getInt(BlockIds.ORE_STONE_1);
|
||||
BlockIds.BUSH = config.getBlock(Strings.BUSH_NAME, BlockIds.BUSH_DEFAULT).getInt(BlockIds.BUSH_DEFAULT);
|
||||
|
||||
BlockIds.LIGHT_CUBE = config.getBlock(Strings.LIGHT_CUBE_NAME, BlockIds.LIGHT_CUBE_DEFAULT).getInt(BlockIds.LIGHT_CUBE_DEFAULT);
|
||||
//Item Configuration
|
||||
|
||||
ItemIds.IMBUED_SHARD = config.getItem(Strings.IMBUED_SHARD_NAME, ItemIds.IMBUED_SHARD_DEFAULT).getInt(ItemIds.IMBUED_SHARD_DEFAULT);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package MysticWorld.Items;
|
||||
|
||||
import MysticWorld.MysticWorld;
|
||||
import MysticWorld.Blocks.BlockHandler;
|
||||
import MysticWorld.Entity.EntityChargeAir;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
|
@ -17,4 +19,55 @@ public class ItemOrbEnergy extends Item {
|
|||
this.setCreativeTab(MysticWorld.MysticWorldTab);
|
||||
}
|
||||
|
||||
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
|
||||
{
|
||||
if (par7 == 0)
|
||||
{
|
||||
--par5;
|
||||
}
|
||||
|
||||
if (par7 == 1)
|
||||
{
|
||||
++par5;
|
||||
}
|
||||
|
||||
if (par7 == 2)
|
||||
{
|
||||
--par6;
|
||||
}
|
||||
|
||||
if (par7 == 3)
|
||||
{
|
||||
++par6;
|
||||
}
|
||||
|
||||
if (par7 == 4)
|
||||
{
|
||||
--par4;
|
||||
}
|
||||
|
||||
if (par7 == 5)
|
||||
{
|
||||
++par4;
|
||||
}
|
||||
|
||||
if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i1 = par3World.getBlockId(par4, par5, par6);
|
||||
|
||||
if (i1 == 0)
|
||||
{
|
||||
par3World.playSoundEffect((double)par4 + 0.5D, (double)par5 + 0.5D, (double)par6 + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
|
||||
par3World.setBlock(par4, par5, par6, BlockHandler.lightCube.blockID);
|
||||
}
|
||||
|
||||
par1ItemStack.damageItem(1, par2EntityPlayer);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@ public class Lang
|
|||
LanguageRegistry.instance().addStringLocalization("itemGroup.MysticWorldTab", "en_US", "Mystic World!");
|
||||
|
||||
//Blocks
|
||||
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.OreImbuedStone, 1, 0), "Charred Stone");
|
||||
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.OreImbuedStone, 1, 1), "Moistened Stone");
|
||||
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.OreImbuedStone, 1, 2), "Mossified Stone");
|
||||
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.OreImbuedStone, 1, 3), "Oxygenated Stone");
|
||||
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.OreImbuedStone, 1, 4), "Energized Stone");
|
||||
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.oreImbuedStone, 1, 0), "Charred Stone");
|
||||
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.oreImbuedStone, 1, 1), "Moistened Stone");
|
||||
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.oreImbuedStone, 1, 2), "Mossified Stone");
|
||||
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.oreImbuedStone, 1, 3), "Oxygenated Stone");
|
||||
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.oreImbuedStone, 1, 4), "Energized Stone");
|
||||
|
||||
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.bush, 1, 0), "Bush");
|
||||
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.bush, 1, 1), "Poisonous Bush");
|
||||
|
|
@ -32,6 +32,8 @@ public class Lang
|
|||
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.bush, 1, 10), "Bush of Vision");
|
||||
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.bush, 1, 11), "Bush of Invisibility");
|
||||
|
||||
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.lightCube, 1), "Light Cube");
|
||||
|
||||
//Items
|
||||
LanguageRegistry.instance().addName(new ItemStack(ItemHandler$1.staffParts, 1, 0), "Staff");
|
||||
LanguageRegistry.instance().addName(new ItemStack(ItemHandler$1.staffParts, 1, 1), "Staff Hilt");
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ public class BlockIds {
|
|||
public static int REGEN_BUSH_DEFAULT = 610;
|
||||
public static int NIGHT_VISION_BUSH_DEFAULT = 611;
|
||||
public static int INVISIBILITY_BUSH_DEFAULT = 612;
|
||||
|
||||
public static int LIGHT_CUBE_DEFAULT = 613;
|
||||
|
||||
//Current Block IDs
|
||||
public static int ORE_STONE_1;
|
||||
|
|
@ -34,4 +36,6 @@ public class BlockIds {
|
|||
public static int NIGHT_VISION_BUSH;
|
||||
public static int INVISIBILITY_BUSH;
|
||||
|
||||
public static int LIGHT_CUBE;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ public class Strings {
|
|||
public static final String NIGHT_VISION_BUSH_NAME = "nightVisionBush";
|
||||
public static final String INVISIBILITY_BUSH_NAME = "invisibilityBush";
|
||||
|
||||
public static final String LIGHT_CUBE_NAME = "lightCube";
|
||||
|
||||
//Item Names
|
||||
public static final String STAFF_HILT_NAME = "staffHilt";
|
||||
public static final String STAFF_HANDLE_NAME = "staffHandle";
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@ public class StonesGen extends WorldGenerator
|
|||
int j1 = par4 + par2Random.nextInt(4) - par2Random.nextInt(4);
|
||||
int k1 = par5 + par2Random.nextInt(8) - par2Random.nextInt(8);
|
||||
|
||||
if (par1World.isAirBlock(i1, j1, k1) && par1World.getBlockId(i1, j1 - 1, k1) == Block.grass.blockID && BlockHandler.OreImbuedStone.canPlaceBlockAt(par1World, i1, j1, k1))
|
||||
if (par1World.isAirBlock(i1, j1, k1) && par1World.getBlockId(i1, j1 - 1, k1) == Block.grass.blockID && BlockHandler.oreImbuedStone.canPlaceBlockAt(par1World, i1, j1, k1))
|
||||
{
|
||||
par1World.setBlock(i1, j1, k1, BlockHandler.OreImbuedStone.blockID, par2Random.nextInt(5), 2);
|
||||
par1World.setBlock(i1, j1, k1, BlockHandler.oreImbuedStone.blockID, par2Random.nextInt(5), 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
BIN
mods/mods/MysticTextures/textures/blocks/Thumbs.db
Normal file
BIN
mods/mods/MysticTextures/textures/blocks/Thumbs.db
Normal file
Binary file not shown.
BIN
mods/mods/MysticTextures/textures/blocks/lightCube.png
Normal file
BIN
mods/mods/MysticTextures/textures/blocks/lightCube.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 290 B |
BIN
mods/mods/MysticTextures/textures/misc/Thumbs.db
Normal file
BIN
mods/mods/MysticTextures/textures/misc/Thumbs.db
Normal file
Binary file not shown.
BIN
mods/mods/MysticTextures/textures/misc/lightCubeFX.png
Normal file
BIN
mods/mods/MysticTextures/textures/misc/lightCubeFX.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 231 B |
Loading…
Reference in a new issue