Working on an Incense mechanic... You'll find out!
This commit is contained in:
parent
b90db3857b
commit
f1ebade718
|
@ -254,6 +254,7 @@ import WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator;
|
||||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
|
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
|
||||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEBellJar;
|
import WayofTime.alchemicalWizardry.common.tileEntity.TEBellJar;
|
||||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEConduit;
|
import WayofTime.alchemicalWizardry.common.tileEntity.TEConduit;
|
||||||
|
import WayofTime.alchemicalWizardry.common.tileEntity.TECrucible;
|
||||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEHomHeart;
|
import WayofTime.alchemicalWizardry.common.tileEntity.TEHomHeart;
|
||||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMimicBlock;
|
import WayofTime.alchemicalWizardry.common.tileEntity.TEMimicBlock;
|
||||||
|
@ -276,10 +277,10 @@ import WayofTime.alchemicalWizardry.common.tweaker.MineTweakerIntegration;
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
import cpw.mods.fml.common.Loader;
|
import cpw.mods.fml.common.Loader;
|
||||||
import cpw.mods.fml.common.Mod;
|
import cpw.mods.fml.common.Mod;
|
||||||
import cpw.mods.fml.common.Optional;
|
|
||||||
import cpw.mods.fml.common.Mod.EventHandler;
|
import cpw.mods.fml.common.Mod.EventHandler;
|
||||||
import cpw.mods.fml.common.Mod.Instance;
|
import cpw.mods.fml.common.Mod.Instance;
|
||||||
import cpw.mods.fml.common.ModContainer;
|
import cpw.mods.fml.common.ModContainer;
|
||||||
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.common.SidedProxy;
|
import cpw.mods.fml.common.SidedProxy;
|
||||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||||
|
@ -769,6 +770,7 @@ public class AlchemicalWizardry
|
||||||
GameRegistry.registerTileEntity(TEAlchemicCalcinator.class, "containerAlchemicCalcinator");
|
GameRegistry.registerTileEntity(TEAlchemicCalcinator.class, "containerAlchemicCalcinator");
|
||||||
GameRegistry.registerTileEntity(TEDemonChest.class, "containerDemonChest");
|
GameRegistry.registerTileEntity(TEDemonChest.class, "containerDemonChest");
|
||||||
GameRegistry.registerTileEntity(TEMimicBlock.class, "containerMimic");
|
GameRegistry.registerTileEntity(TEMimicBlock.class, "containerMimic");
|
||||||
|
GameRegistry.registerTileEntity(TECrucible.class, "containerCrucible");
|
||||||
ModBlocks.bloodRune.setHarvestLevel("pickaxe", 2);
|
ModBlocks.bloodRune.setHarvestLevel("pickaxe", 2);
|
||||||
ModBlocks.speedRune.setHarvestLevel("pickaxe", 2);
|
ModBlocks.speedRune.setHarvestLevel("pickaxe", 2);
|
||||||
ModBlocks.efficiencyRune.setHarvestLevel("pickaxe", 2);
|
ModBlocks.efficiencyRune.setHarvestLevel("pickaxe", 2);
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class ModBlocks
|
||||||
public static Block blockMimic;
|
public static Block blockMimic;
|
||||||
public static Block blockEnchantmentGlyph;
|
public static Block blockEnchantmentGlyph;
|
||||||
public static Block blockStabilityGlyph;
|
public static Block blockStabilityGlyph;
|
||||||
public static Block blockIncence;
|
public static Block blockCrucible;
|
||||||
|
|
||||||
public static void init()
|
public static void init()
|
||||||
{
|
{
|
||||||
|
@ -142,7 +142,7 @@ public class ModBlocks
|
||||||
blockLifeEssence = new LifeEssenceBlock();
|
blockLifeEssence = new LifeEssenceBlock();
|
||||||
blockEnchantmentGlyph = new BlockEnchantmentGlyph();
|
blockEnchantmentGlyph = new BlockEnchantmentGlyph();
|
||||||
blockStabilityGlyph = new BlockStabilityGlyph();
|
blockStabilityGlyph = new BlockStabilityGlyph();
|
||||||
blockIncence = new BlockCrucible();
|
blockCrucible = new BlockCrucible();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerBlocksInPre()
|
public static void registerBlocksInPre()
|
||||||
|
@ -189,7 +189,7 @@ public class ModBlocks
|
||||||
GameRegistry.registerBlock(ModBlocks.blockEnchantmentGlyph, ItemEnchantmentGlyphBlock.class, "blockEnchantmentGlyph");
|
GameRegistry.registerBlock(ModBlocks.blockEnchantmentGlyph, ItemEnchantmentGlyphBlock.class, "blockEnchantmentGlyph");
|
||||||
GameRegistry.registerBlock(ModBlocks.blockStabilityGlyph, ItemStabilityGlyphBlock.class, "blockStabilityGlyph");
|
GameRegistry.registerBlock(ModBlocks.blockStabilityGlyph, ItemStabilityGlyphBlock.class, "blockStabilityGlyph");
|
||||||
|
|
||||||
// GameRegistry.registerBlock(ModBlocks.blockIncence, "blockIncence");
|
GameRegistry.registerBlock(ModBlocks.blockCrucible, "blockCrucible");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerBlocksInInit()
|
public static void registerBlocksInInit()
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package WayofTime.alchemicalWizardry.api.sacrifice;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
public interface IIncense
|
||||||
|
{
|
||||||
|
public int getMinLevel(ItemStack stack);
|
||||||
|
|
||||||
|
public int getMaxLevel(ItemStack stack);
|
||||||
|
|
||||||
|
public int getIncenseDuration(ItemStack stack);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param stack
|
||||||
|
* @return a float from 0 to 1
|
||||||
|
*/
|
||||||
|
public float getRedColour(ItemStack stack);
|
||||||
|
public float getGreenColour(ItemStack stack);
|
||||||
|
public float getBlueColour(ItemStack stack);
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package WayofTime.alchemicalWizardry.api.sacrifice;
|
||||||
|
|
||||||
|
import WayofTime.alchemicalWizardry.api.spell.APISpellHelper;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
|
||||||
|
public class PlayerSacrificeHandler
|
||||||
|
{
|
||||||
|
public int getPlayerIncense(EntityPlayer player)
|
||||||
|
{
|
||||||
|
return APISpellHelper.getCurrentIncense(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlayerIncense(EntityPlayer player, int amount)
|
||||||
|
{
|
||||||
|
APISpellHelper.setCurrentIncense(player, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean incrementIncense(EntityPlayer player, int min, int max)
|
||||||
|
{
|
||||||
|
int amount = this.getPlayerIncense(player);
|
||||||
|
if(amount < min || amount >= max)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
amount++;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean sacrificePlayerHealth(EntityPlayer player)
|
||||||
|
{
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -42,6 +42,23 @@ public class APISpellHelper
|
||||||
return beaconData;
|
return beaconData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getCurrentIncense(EntityPlayer player)
|
||||||
|
{
|
||||||
|
NBTTagCompound data = player.getEntityData();
|
||||||
|
if(data.hasKey("BM:CurrentIncense"))
|
||||||
|
{
|
||||||
|
return data.getInteger("BM:CurrentIncense");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setCurrentIncense(EntityPlayer player, int amount)
|
||||||
|
{
|
||||||
|
NBTTagCompound data = player.getEntityData();
|
||||||
|
data.setInteger("BM:CurrentIncense", amount);
|
||||||
|
}
|
||||||
|
|
||||||
public static int getPlayerLPTag(EntityPlayer player)
|
public static int getPlayerLPTag(EntityPlayer player)
|
||||||
{
|
{
|
||||||
NBTTagCompound data = APISpellHelper.getPersistentDataTag(player);
|
NBTTagCompound data = APISpellHelper.getPersistentDataTag(player);
|
||||||
|
|
|
@ -1,19 +1,23 @@
|
||||||
package WayofTime.alchemicalWizardry.common.block;
|
package WayofTime.alchemicalWizardry.common.block;
|
||||||
|
|
||||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
import java.util.Random;
|
||||||
import net.minecraft.block.Block;
|
|
||||||
|
import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||||
|
import WayofTime.alchemicalWizardry.common.tileEntity.TECrucible;
|
||||||
|
|
||||||
public class BlockCrucible extends Block
|
public class BlockCrucible extends BlockContainer
|
||||||
{
|
{
|
||||||
public BlockCrucible()
|
public BlockCrucible()
|
||||||
{
|
{
|
||||||
super(Material.anvil);
|
super(Material.anvil);
|
||||||
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||||
this.setBlockName("blockIncence");
|
this.setBlockName("blockCrucible");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -39,4 +43,20 @@ public class BlockCrucible extends Block
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TileEntity createNewTileEntity(World world, int meta)
|
||||||
|
{
|
||||||
|
return new TECrucible();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
|
||||||
|
{
|
||||||
|
if (rand.nextInt(3) != 0)
|
||||||
|
{
|
||||||
|
TECrucible tile = (TECrucible)world.getTileEntity(x, y, z);
|
||||||
|
tile.spawnClientParticle(world, x, y, z, rand);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,118 @@
|
||||||
|
package WayofTime.alchemicalWizardry.common.tileEntity;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.network.NetworkManager;
|
||||||
|
import net.minecraft.network.Packet;
|
||||||
|
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import WayofTime.alchemicalWizardry.api.sacrifice.IIncense;
|
||||||
|
|
||||||
|
public class TECrucible extends TEInventory
|
||||||
|
{
|
||||||
|
public float rColour;
|
||||||
|
public float gColour;
|
||||||
|
public float bColour;
|
||||||
|
|
||||||
|
public int ticksRemaining = 0;
|
||||||
|
|
||||||
|
public TECrucible()
|
||||||
|
{
|
||||||
|
super(1);
|
||||||
|
float f = (float) 1.0F;
|
||||||
|
float f1 = f * 0.6F + 0.4F;
|
||||||
|
float f2 = f * f * 0.7F - 0.5F;
|
||||||
|
float f3 = f * f * 0.6F - 0.7F;
|
||||||
|
rColour = f1;
|
||||||
|
gColour = f2;
|
||||||
|
bColour = f3;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateEntity()
|
||||||
|
{
|
||||||
|
if(ticksRemaining <= 0)
|
||||||
|
{
|
||||||
|
ItemStack stack = this.getStackInSlot(0);
|
||||||
|
if(stack != null && stack.getItem() instanceof IIncense)
|
||||||
|
{
|
||||||
|
IIncense incense = (IIncense)stack.getItem();
|
||||||
|
|
||||||
|
rColour = incense.getRedColour(stack);
|
||||||
|
gColour = incense.getGreenColour(stack);
|
||||||
|
bColour = incense.getBlueColour(stack);
|
||||||
|
ticksRemaining = incense.getIncenseDuration(stack);
|
||||||
|
|
||||||
|
stack.stackSize--;
|
||||||
|
if(stack.stackSize <= 0)
|
||||||
|
{
|
||||||
|
this.setInventorySlotContents(0, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
ticksRemaining--;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void spawnClientParticle(World world, int x, int y, int z, Random rand)
|
||||||
|
{
|
||||||
|
world.spawnParticle("reddust", x + 0.5D + rand.nextGaussian() / 8, y + 0.5D, z + 0.5D + rand.nextGaussian() / 8, rColour, gColour, bColour);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound tag)
|
||||||
|
{
|
||||||
|
super.writeToNBT(tag);
|
||||||
|
this.writeClientNBT(tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readFromNBT(NBTTagCompound tag)
|
||||||
|
{
|
||||||
|
super.readFromNBT(tag);
|
||||||
|
this.readClientNBT(tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void readClientNBT(NBTTagCompound tag)
|
||||||
|
{
|
||||||
|
rColour = tag.getFloat("rColour");
|
||||||
|
gColour = tag.getFloat("gColour");
|
||||||
|
bColour = tag.getFloat("bColour");
|
||||||
|
|
||||||
|
ticksRemaining = tag.getInteger("ticksRemaining");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeClientNBT(NBTTagCompound tag)
|
||||||
|
{
|
||||||
|
tag.setFloat("rColour", rColour);
|
||||||
|
tag.setFloat("gColour", gColour);
|
||||||
|
tag.setFloat("bColour", bColour);
|
||||||
|
|
||||||
|
tag.setInteger("ticksRemaining", ticksRemaining);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Packet getDescriptionPacket()
|
||||||
|
{
|
||||||
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||||
|
writeClientNBT(nbttagcompound);
|
||||||
|
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 90210, nbttagcompound);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
|
||||||
|
{
|
||||||
|
super.onDataPacket(net, packet);
|
||||||
|
readClientNBT(packet.func_148857_g());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getInventoryName()
|
||||||
|
{
|
||||||
|
return "TECrucible";
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue