mirror of
https://github.com/GTNewHorizons/MagicBees.git
synced 2026-11-21 20:52:24 +00:00
Merge branch 'thaumicApiary-dev'
Conflicts: gradle.properties
This commit is contained in:
commit
d921717965
50 files changed
+2777
-1111
No files matched your search
@@ -0,0 +1,4 @@
|
||||
package magicbees.api.bees;
|
||||
|
||||
public interface IAuraChargeType {
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package magicbees.api.bees;
|
||||
|
||||
/**
|
||||
* Allows a tile entity to provide a Magic Apiary with 'aura' to boost bee production, mutation rate,
|
||||
* or decrease bee lifespan.
|
||||
*
|
||||
* @author MysteriousAges
|
||||
*/
|
||||
public interface IMagicApiaryAuraProvider {
|
||||
|
||||
/**
|
||||
* Requests a mutation charge from the aura provider. If true is returned, the
|
||||
* aura provider should decrement its internal charge by one. If there are no
|
||||
* charges remaining, it should return false.
|
||||
*
|
||||
* @return True if a charge is given; false otherwise.
|
||||
*/
|
||||
boolean getMutationCharge();
|
||||
|
||||
/**
|
||||
* Requests a mutation charge from the aura provider. If true is returned, the
|
||||
* aura provider should decrement its internal charge by one. If there are no
|
||||
* charges remaining, it should return false.
|
||||
*
|
||||
* @return True if a charge is given; false otherwise.
|
||||
*/
|
||||
boolean getDeathRateCharge();
|
||||
|
||||
/**
|
||||
* Requests a mutation charge from the aura provider. If true is returned, the
|
||||
* aura provider should decrement its internal charge by one. If there are no
|
||||
* charges remaining, it should return false.
|
||||
*
|
||||
* @return True if a charge is given; false otherwise.
|
||||
*/
|
||||
boolean getProductionCharge();
|
||||
|
||||
/**
|
||||
* Requests a mutation charge from the aura provider. If true is returned, the
|
||||
* aura provider should decrement its internal charge by one. If there are no
|
||||
* charges remaining, it should return false.
|
||||
*
|
||||
* @return True if a charge is given; false otherwise.
|
||||
*/
|
||||
boolean getCharge(IAuraChargeType auraChargeType);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import magicbees.api.bees.IAuraChargeType;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
|
||||
public enum AuraChargeType implements IAuraChargeType {
|
||||
MUTATION(Aspect.WATER, 850, 11),
|
||||
DEATH(Aspect.ENTROPY, 400, 5),
|
||||
PRODUCTION(Aspect.AIR, 300, 3);
|
||||
|
||||
public final int duration;
|
||||
public final Aspect aspect;
|
||||
/** The number of ticks to count between draining vis from the environment **/
|
||||
public final int tickRate;
|
||||
public final int flag = 1 << ordinal();
|
||||
|
||||
AuraChargeType(Aspect aspect, int duration, int tickRate) {
|
||||
this.aspect = aspect;
|
||||
this.duration = duration;
|
||||
this.tickRate = tickRate;
|
||||
}
|
||||
}
|
||||
@@ -6,9 +6,6 @@ import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.item.types.CombType;
|
||||
import magicbees.item.types.DropType;
|
||||
import magicbees.item.types.NuggetType;
|
||||
@@ -32,6 +29,11 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
@@ -42,7 +44,9 @@ import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.IIconProvider;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleTolerance;
|
||||
import forestry.api.genetics.IClassification;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IMutation;
|
||||
@@ -1250,7 +1254,7 @@ public enum BeeSpecies implements IAlleleBeeSpecies, IIconProvider
|
||||
int highest = 0;
|
||||
excludeSpecies.add(species);
|
||||
|
||||
for (IMutation mutation : getRoot().getPaths(species, EnumBeeChromosome.SPECIES.ordinal()))
|
||||
for (IMutation mutation : getRoot().getPaths(species, EnumBeeChromosome.SPECIES))
|
||||
{
|
||||
if (!excludeSpecies.contains(mutation.getAllele0()))
|
||||
{
|
||||
@@ -1417,6 +1421,20 @@ public enum BeeSpecies implements IAlleleBeeSpecies, IIconProvider
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public boolean canWorkInTemperature(EnumTemperature temp) {
|
||||
IAlleleTolerance tolerance = (IAlleleTolerance)genomeTemplate[EnumBeeChromosome.TEMPERATURE_TOLERANCE.ordinal()];
|
||||
return AlleleManager.climateHelper.isWithinLimits(temp, EnumHumidity.NORMAL,
|
||||
temperature, tolerance.getValue(),
|
||||
EnumHumidity.NORMAL, EnumTolerance.NONE);
|
||||
}
|
||||
|
||||
public boolean canWorkInHumidity(EnumHumidity humid) {
|
||||
IAlleleTolerance tolerance = (IAlleleTolerance)genomeTemplate[EnumBeeChromosome.HUMIDITY_TOLERANCE.ordinal()];
|
||||
return AlleleManager.climateHelper.isWithinLimits(EnumTemperature.NORMAL, humid,
|
||||
EnumTemperature.NORMAL, EnumTolerance.NONE,
|
||||
humidity, tolerance.getValue());
|
||||
}
|
||||
|
||||
/// --------- Unused Functions ---------------------------------------------
|
||||
|
||||
|
||||
@@ -185,13 +185,13 @@ public enum HiveDescription implements IHiveDescription {
|
||||
@Override
|
||||
public boolean isGoodHumidity(EnumHumidity humidity)
|
||||
{
|
||||
return true;
|
||||
return hiveType.getOccupant().canWorkInHumidity(humidity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGoodTemperature(EnumTemperature temperature)
|
||||
{
|
||||
return true;
|
||||
return hiveType.getOccupant().canWorkInTemperature(temperature);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+5
-5
@@ -6,7 +6,7 @@ import magicbees.client.gui.UIScreens;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.MagicBees;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
import magicbees.tileentity.TileEntityThaumicApiary;
|
||||
import magicbees.tileentity.TileEntityMagicApiary;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -21,16 +21,16 @@ import net.minecraft.world.World;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class BlockThaumicApiary extends BlockContainer
|
||||
public class BlockMagicApiary extends BlockContainer
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] icons;
|
||||
|
||||
public BlockThaumicApiary()
|
||||
public BlockMagicApiary()
|
||||
{
|
||||
super(Material.wood);
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
this.setBlockName("thaumicApiary");
|
||||
this.setBlockName("magicApiary");
|
||||
this.setHardness(1f);
|
||||
this.setResistance(1.5f);
|
||||
this.setHarvestLevel("axe", 0);
|
||||
@@ -79,7 +79,7 @@ public class BlockThaumicApiary extends BlockContainer
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int metadata) {
|
||||
return new TileEntityThaumicApiary();
|
||||
return new TileEntityMagicApiary();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -0,0 +1,49 @@
|
||||
package magicbees.block;
|
||||
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
import magicbees.tileentity.TileEntityVisAuraProvider;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockVisAuraProvider extends BlockContainer {
|
||||
|
||||
public BlockVisAuraProvider() {
|
||||
super(Material.glass);
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
this.setBlockName("visAuraProvider");
|
||||
this.setHardness(0.5f);
|
||||
this.setResistance(1.5f);
|
||||
this.setLightLevel(8);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int metadata) {
|
||||
return new TileEntityVisAuraProvider();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return CommonProxy.RenderIdVisAuraProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = Blocks.planks.getIcon(0, 5);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,17 +2,6 @@ package magicbees.block.types;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.apiculture.IHiveDrop;
|
||||
|
||||
import magicbees.bees.BeeGenomeManager;
|
||||
import magicbees.bees.BeeSpecies;
|
||||
import magicbees.bees.HiveDrop;
|
||||
@@ -20,20 +9,29 @@ import magicbees.item.types.CombType;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.utils.compat.ForestryHelper;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.apiculture.IHiveDrop;
|
||||
|
||||
public enum HiveType
|
||||
{
|
||||
CURIOUS("curious", 12, true),
|
||||
UNUSUAL("unusual", 12, true),
|
||||
RESONANT("resonant", 12, true),
|
||||
DEEP("deep", 4, false),
|
||||
INFERNAL("infernal", 15, false),
|
||||
OBLIVION("oblivion", 7, false),
|
||||
CURIOUS("curious", BeeSpecies.MYSTICAL, 12, true),
|
||||
UNUSUAL("unusual", BeeSpecies.UNUSUAL, 12, true),
|
||||
RESONANT("resonant", BeeSpecies.SORCEROUS, 12, true),
|
||||
DEEP("deep", BeeSpecies.ATTUNED, 4, false),
|
||||
INFERNAL("infernal", BeeSpecies.INFERNAL, 15, false),
|
||||
OBLIVION("oblivion", BeeSpecies.OBLIVION, 7, false),
|
||||
;
|
||||
|
||||
private static String[] nameList;
|
||||
|
||||
private String name;
|
||||
private BeeSpecies occupant;
|
||||
public boolean show;
|
||||
private int lightLevel;
|
||||
private ArrayList<IHiveDrop> drops;
|
||||
@@ -85,9 +83,10 @@ public enum HiveType
|
||||
OBLIVION.drops.add(new HiveDrop(ForestryHelper.getTemplateForestryForSpecies("Steadfast"), combs, 9));
|
||||
}
|
||||
|
||||
private HiveType(String hiveName, int light, boolean visible)
|
||||
private HiveType(String hiveName, BeeSpecies occupant, int light, boolean visible)
|
||||
{
|
||||
this.name = hiveName;
|
||||
this.occupant = occupant;
|
||||
this.lightLevel = light;
|
||||
this.show = visible;
|
||||
this.drops = new ArrayList<IHiveDrop>();
|
||||
@@ -173,6 +172,10 @@ public enum HiveType
|
||||
return (nameList == null) ? nameList = generateNames() : nameList;
|
||||
}
|
||||
|
||||
public BeeSpecies getOccupant() {
|
||||
return this.occupant;
|
||||
}
|
||||
|
||||
private static String[] generateNames()
|
||||
{
|
||||
String[] names = new String[values().length];
|
||||
|
||||
@@ -13,12 +13,12 @@ public class ContainerMB extends Container
|
||||
public void addPlayerInventory(InventoryPlayer inventoryPlayer, int xStart, int yStart)
|
||||
{
|
||||
for (int x = 0; x < PLAYER_INVENTORY_COLUMNS; x++){
|
||||
addSlotToContainer(new Slot(inventoryPlayer, x, 8 + 18 * x, yStart + 4 + PLAYER_INVENTORY_ROWS * 18));
|
||||
addSlotToContainer(new Slot(inventoryPlayer, x, xStart + 8 + 18 * x, yStart + 4 + PLAYER_INVENTORY_ROWS * 18));
|
||||
}
|
||||
|
||||
for (int y = 0; y < PLAYER_INVENTORY_ROWS; y++){
|
||||
for (int x = 0; x < PLAYER_INVENTORY_COLUMNS; x++){
|
||||
addSlotToContainer(new Slot(inventoryPlayer, x + y * 9 + 9, 8 + 18 * x, yStart + y * 18));
|
||||
addSlotToContainer(new Slot(inventoryPlayer, x + y * 9 + 9, xStart + 8 + 18 * x, yStart + y * 18));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+11
-11
@@ -3,16 +3,16 @@ package magicbees.client.gui;
|
||||
import forestry.api.apiculture.IHiveFrame;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import magicbees.main.utils.ItemInterface;
|
||||
import magicbees.tileentity.TileEntityThaumicApiary;
|
||||
import magicbees.tileentity.TileEntityMagicApiary;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerThaumicApiary extends ContainerMB {
|
||||
public class ContainerMagicApiary extends ContainerMB {
|
||||
|
||||
private TileEntityThaumicApiary thaumicApiary;
|
||||
public TileEntityMagicApiary apiary;
|
||||
public int maxSlot = 0;
|
||||
|
||||
// Constants
|
||||
@@ -23,13 +23,13 @@ public class ContainerThaumicApiary extends ContainerMB {
|
||||
private static final int SLOT_FRAME_COUNT = 3;
|
||||
private static final int SLOT_INVENTORY_COUNT = 7;
|
||||
|
||||
public ContainerThaumicApiary(InventoryPlayer inventoryPlayer, TileEntityThaumicApiary thaumicApiary){
|
||||
this.thaumicApiary = thaumicApiary;
|
||||
public ContainerMagicApiary(InventoryPlayer inventoryPlayer, TileEntityMagicApiary thaumicApiary){
|
||||
this.apiary = thaumicApiary;
|
||||
|
||||
// Queen/Princess slot
|
||||
addSlotToContainer(new SlotCustomItems(this.thaumicApiary, 0, 29, 39, ItemInterface.getItemStack("Forestry", "beeQueenGE", 1), ItemInterface.getItemStack("Forestry", "beePrincessGE", 1)));
|
||||
addSlotToContainer(new SlotCustomItems(this.apiary, 0, 29, 39, ItemInterface.getItemStack("Forestry", "beeQueenGE", 1), ItemInterface.getItemStack("Forestry", "beePrincessGE", 1)));
|
||||
// Drone slot
|
||||
addSlotToContainer(new SlotCustomItems(this.thaumicApiary, 1, 29, 65, ItemInterface.getItemStack("Forestry", "beeDroneGE", 64)));
|
||||
addSlotToContainer(new SlotCustomItems(this.apiary, 1, 29, 65, ItemInterface.getItemStack("Forestry", "beeDroneGE", 64)));
|
||||
|
||||
int currentSlot = 1;
|
||||
|
||||
@@ -56,7 +56,7 @@ public class ContainerThaumicApiary extends ContainerMB {
|
||||
j++;
|
||||
}
|
||||
|
||||
addPlayerInventory(inventoryPlayer, 0, 108);
|
||||
addPlayerInventory(inventoryPlayer, 0, 110);
|
||||
|
||||
maxSlot = currentSlot;
|
||||
|
||||
@@ -105,13 +105,13 @@ public class ContainerThaumicApiary extends ContainerMB {
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityPlayer) {
|
||||
return thaumicApiary.isUseableByPlayer(entityPlayer);
|
||||
return apiary.isUseableByPlayer(entityPlayer);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateProgressBar(int i, int j) {
|
||||
thaumicApiary.getGUINetworkData(i, j);
|
||||
apiary.getGUINetworkData(i, j);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -119,7 +119,7 @@ public class ContainerThaumicApiary extends ContainerMB {
|
||||
super.detectAndSendChanges();
|
||||
|
||||
for (Object crafter : crafters) {
|
||||
thaumicApiary.sendGUINetworkData(this, (ICrafting) crafter);
|
||||
apiary.sendGUINetworkData(this, (ICrafting) crafter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package magicbees.client.gui;
|
||||
|
||||
import magicbees.tileentity.TileEntityEffectJar;
|
||||
import magicbees.tileentity.TileEntityThaumicApiary;
|
||||
import magicbees.tileentity.TileEntityMagicApiary;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
@@ -21,8 +21,8 @@ public class GUIHandler implements IGuiHandler
|
||||
}
|
||||
else if (ID == UIScreens.THAUMIC_APIARY.ordinal())
|
||||
{
|
||||
TileEntityThaumicApiary tileEntityThaumicApiary = (TileEntityThaumicApiary) world.getTileEntity(x, y, z);
|
||||
value = new ContainerThaumicApiary(player.inventory, tileEntityThaumicApiary);
|
||||
TileEntityMagicApiary tileEntityThaumicApiary = (TileEntityMagicApiary) world.getTileEntity(x, y, z);
|
||||
value = new ContainerMagicApiary(player.inventory, tileEntityThaumicApiary);
|
||||
}
|
||||
|
||||
return value;
|
||||
@@ -38,8 +38,8 @@ public class GUIHandler implements IGuiHandler
|
||||
value = new GUIEffectJar((TileEntityEffectJar)world.getTileEntity(x, y, z), player);
|
||||
}else if (ID == UIScreens.THAUMIC_APIARY.ordinal())
|
||||
{
|
||||
TileEntityThaumicApiary tileEntityThaumicApiary = (TileEntityThaumicApiary) world.getTileEntity(x, y, z);
|
||||
value = new GuiThaumicApiary(player.inventory, tileEntityThaumicApiary);
|
||||
TileEntityMagicApiary tileEntityThaumicApiary = (TileEntityMagicApiary) world.getTileEntity(x, y, z);
|
||||
value = new GuiMagicApiary(player.inventory, tileEntityThaumicApiary);
|
||||
}
|
||||
|
||||
return value;
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
package magicbees.client.gui;
|
||||
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.tileentity.TileEntityMagicApiary;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiMagicApiary extends GuiContainer
|
||||
{
|
||||
public static final ResourceLocation BACKGROUND_LOCATION = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.GUI_TEXTURE + "apiary.png");
|
||||
|
||||
private static final int WIDTH = 176;
|
||||
private static final int HEIGHT = 190;
|
||||
|
||||
private static final int LIFEBAR_WIDTH = 2;
|
||||
private static final int LIFEBAR_HEIGHT = 46;
|
||||
|
||||
private static final int LIFEBAR_DEST_X = 21;
|
||||
private static final int LIFEBAR_DEST_Y = 37;
|
||||
|
||||
private static final int LIFEBAR_SRC_Y = 0;
|
||||
private static final int LIFEBAR_SRC_STAGE1_X = 184;
|
||||
private static final int LIFEBAR_SRC_STAGE2_X = 182;
|
||||
private static final int LIFEBAR_SRC_STAGE3_X = 180;
|
||||
private static final int LIFEBAR_SRC_STAGE4_X = 178;
|
||||
private static final int LIFEBAR_SRC_STAGE5_X = 176;
|
||||
|
||||
private static final int WORKBOOST_WIDTH = 16;
|
||||
private static final int WORKBOOST_HEIGHT = 12;
|
||||
private static final int WORKBOOST_DEST_X = 37;
|
||||
private static final int WORKBOOST_DEST_Y = 18;
|
||||
private static final int WORKBOOST_SRC_X = 176;
|
||||
private static final int WORKBOOST_SRC_Y = 46;
|
||||
|
||||
private static final int DEATHBOOST_WIDTH = 11;
|
||||
private static final int DEATHBOOST_HEIGHT = 13;
|
||||
private static final int DEATHBOOST_DEST_X = 25;
|
||||
private static final int DEATHBOOST_DEST_Y = 17;
|
||||
private static final int DEATHBOOST_SRC_X = 176;
|
||||
private static final int DEATHBOOST_SRC_Y = 58;
|
||||
|
||||
private static final int MUTATIONBOOST_WIDTH = 9;
|
||||
private static final int MUTATIONBOOST_HEIGHT = 13;
|
||||
private static final int MUTATIONBOOST_DEST_X = 15;
|
||||
private static final int MUTATIONBOOST_DEST_Y = 17;
|
||||
private static final int MUTATIONBOOST_SRC_X = 176;
|
||||
private static final int MUTATIONBOOST_SRC_Y = 71;
|
||||
|
||||
private GuiButton mutationButton;
|
||||
|
||||
public GuiMagicApiary(InventoryPlayer inventoryPlayer, TileEntityMagicApiary thaumicApiary) {
|
||||
super(new ContainerMagicApiary(inventoryPlayer, thaumicApiary));
|
||||
|
||||
this.xSize = WIDTH;
|
||||
this.ySize = HEIGHT;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
{
|
||||
fontRendererObj.drawString("Inventory", 9, 99, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) {
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
this.mc.getTextureManager().bindTexture(BACKGROUND_LOCATION);
|
||||
|
||||
this.drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
TileEntityMagicApiary apiary = ((ContainerMagicApiary)this.inventorySlots).apiary;
|
||||
|
||||
drawLifebar(apiary);
|
||||
|
||||
drawWorkBoostIcon(apiary);
|
||||
drawDeathRateIcon(apiary);
|
||||
drawMutationIcon(apiary);
|
||||
}
|
||||
|
||||
private void drawMutationIcon(TileEntityMagicApiary apiary) {
|
||||
if (apiary.isMutationBoosted()) {
|
||||
this.drawTexturedModalRect(this.guiLeft + MUTATIONBOOST_DEST_X, this.guiTop + MUTATIONBOOST_DEST_Y,
|
||||
MUTATIONBOOST_SRC_X, MUTATIONBOOST_SRC_Y, MUTATIONBOOST_WIDTH, MUTATIONBOOST_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawDeathRateIcon(TileEntityMagicApiary apiary) {
|
||||
if (apiary.isDeathRateBoosted()) {
|
||||
this.drawTexturedModalRect(this.guiLeft + DEATHBOOST_DEST_X, this.guiTop + DEATHBOOST_DEST_Y,
|
||||
DEATHBOOST_SRC_X, DEATHBOOST_SRC_Y, DEATHBOOST_WIDTH, DEATHBOOST_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawWorkBoostIcon(TileEntityMagicApiary apiary) {
|
||||
if (apiary.isProductionBoosted()) {
|
||||
this.drawTexturedModalRect(this.guiLeft + WORKBOOST_DEST_X, this.guiTop + WORKBOOST_DEST_Y,
|
||||
WORKBOOST_SRC_X, WORKBOOST_SRC_Y, WORKBOOST_WIDTH, WORKBOOST_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawLifebar(TileEntityMagicApiary apiary) {
|
||||
int value = LIFEBAR_HEIGHT - apiary.getHealthScaled(LIFEBAR_HEIGHT);
|
||||
int lifebarSrc = getLifebarSrc(apiary);
|
||||
this.drawTexturedModalRect(this.guiLeft + LIFEBAR_DEST_X, this.guiTop + value + LIFEBAR_DEST_Y,
|
||||
lifebarSrc, LIFEBAR_SRC_Y, LIFEBAR_WIDTH, LIFEBAR_HEIGHT - value);
|
||||
}
|
||||
|
||||
private int getLifebarSrc(TileEntityMagicApiary apiary) {
|
||||
int value = apiary.getHealthScaled(5);
|
||||
if (value >= 5) {
|
||||
return LIFEBAR_SRC_STAGE1_X;
|
||||
}
|
||||
else if (value >= 4) {
|
||||
return LIFEBAR_SRC_STAGE2_X;
|
||||
}
|
||||
else if (value >= 3) {
|
||||
return LIFEBAR_SRC_STAGE3_X;
|
||||
}
|
||||
else if (value >= 2) {
|
||||
return LIFEBAR_SRC_STAGE4_X;
|
||||
}
|
||||
else {
|
||||
return LIFEBAR_SRC_STAGE5_X;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int p_73864_1_, int p_73864_2_, int p_73864_3_) {
|
||||
// TODO Auto-generated method stub
|
||||
super.mouseClicked(p_73864_1_, p_73864_2_, p_73864_3_);
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package magicbees.client.gui;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.tileentity.TileEntityThaumicApiary;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiThaumicApiary extends GuiContainer
|
||||
{
|
||||
public static final ResourceLocation BACKGROUND_LOCATION = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.GUI_TEXTURE + "apiary.png");
|
||||
|
||||
private static final int WIDTH = 176;
|
||||
private static final int HEIGHT = 190;
|
||||
|
||||
public GuiThaumicApiary(InventoryPlayer inventoryPlayer, TileEntityThaumicApiary thaumicApiary) {
|
||||
super(new ContainerThaumicApiary(inventoryPlayer, thaumicApiary));
|
||||
|
||||
this.xSize = WIDTH;
|
||||
this.ySize = HEIGHT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) {
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
this.mc.getTextureManager().bindTexture(BACKGROUND_LOCATION);
|
||||
|
||||
this.drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import org.lwjgl.opengl.GL11;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ModelEffectJar
|
||||
{
|
||||
public static final String objFile = CommonProxy.MODEL_PATH + "effectJar.obj";
|
||||
public static final ResourceLocation objFile = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.MODEL + "effectJar.obj");
|
||||
public static final ResourceLocation textureLocation = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.MODEL + "jarTexture.png");
|
||||
|
||||
public static final ModelEffectJar model = new ModelEffectJar();
|
||||
@@ -20,7 +20,7 @@ public class ModelEffectJar
|
||||
|
||||
public ModelEffectJar()
|
||||
{
|
||||
this.effectJarObj = AdvancedModelLoader.loadModel(new ResourceLocation("magicbees", "model/effectJar.obj"));
|
||||
this.effectJarObj = AdvancedModelLoader.loadModel(objFile);
|
||||
}
|
||||
|
||||
public void render()
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package magicbees.client.model;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import magicbees.main.CommonProxy;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ModelVisAuraProvider {
|
||||
public static final ResourceLocation objFile = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.MODEL + "visAuraConverter.obj");
|
||||
public static final ResourceLocation textureLocation = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.MODEL + "visAuraProvider.png");
|
||||
|
||||
public static final ModelVisAuraProvider model = new ModelVisAuraProvider();
|
||||
|
||||
private IModelCustom visAuraProviderObj;
|
||||
|
||||
public ModelVisAuraProvider() {
|
||||
this.visAuraProviderObj = AdvancedModelLoader.loadModel(objFile);
|
||||
}
|
||||
|
||||
public void render(long tick) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotated(Math.sin(tick * Math.PI * 2 / 80) * 0.7, 0, 1, 0);
|
||||
GL11.glRotated(Math.sin((tick + 25) * Math.PI * 2 / 150) * 0.75, 0.5, 0, 0.5);
|
||||
GL11.glTranslated(Math.sin(tick * Math.PI * 2 / 1000) * 0.025, 0, Math.sin((tick + 30) * Math.PI * 2 / 650) * 0.03);
|
||||
float red = (float)(Math.sin(tick * Math.PI * 2 / 130) * 0.2 + 0.8);
|
||||
float green = (float)(Math.cos((tick + 2) * Math.PI * 2 / 140) * 0.2 + 0.8);
|
||||
float blue = (float)(Math.sin((tick + 5) * Math.PI * 2 / 99) * 0.2 + 0.8);
|
||||
GL11.glColor3f(red, green, blue);
|
||||
this.visAuraProviderObj.renderPart("centre");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glColor3f(1f, 1f, 1f);
|
||||
this.visAuraProviderObj.renderPart("frame");
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -9,9 +9,9 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class EffectJarRenderer extends TileEntitySpecialRenderer implements IItemRenderer
|
||||
public class RendererEffectJar extends TileEntitySpecialRenderer implements IItemRenderer
|
||||
{
|
||||
public static EffectJarRenderer instance = new EffectJarRenderer();
|
||||
public static RendererEffectJar instance = new RendererEffectJar();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick)
|
||||
@@ -0,0 +1,50 @@
|
||||
package magicbees.client.render;
|
||||
|
||||
import magicbees.client.model.ModelVisAuraProvider;
|
||||
import magicbees.tileentity.TileEntityVisAuraProvider;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
||||
public class RendererVisAuraProvider extends TileEntitySpecialRenderer implements IItemRenderer {
|
||||
public static RendererVisAuraProvider instance = new RendererVisAuraProvider();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float tick) {
|
||||
if (entity instanceof TileEntityVisAuraProvider) {
|
||||
this.doRender(x, y, z, 1f, entity.getWorldObj().getTotalWorldTime());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
doRender(0, 0, 0, 1f, 0);
|
||||
}
|
||||
|
||||
private void doRender(double x, double y, double z, float scale, long tick) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ModelVisAuraProvider.textureLocation);
|
||||
ModelVisAuraProvider.model.render(tick);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +1,15 @@
|
||||
package magicbees.main;
|
||||
|
||||
import magicbees.client.render.RendererEffectJar;
|
||||
import magicbees.client.render.RendererVisAuraProvider;
|
||||
import magicbees.tileentity.TileEntityEffectJar;
|
||||
import magicbees.tileentity.TileEntityVisAuraProvider;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.client.render.EffectJarRenderer;
|
||||
import magicbees.tileentity.TileEntityEffectJar;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ClientProxy extends CommonProxy
|
||||
@@ -18,7 +20,11 @@ public class ClientProxy extends CommonProxy
|
||||
super.registerRenderers();
|
||||
|
||||
RenderIdEffectJar = RenderingRegistry.getNextAvailableRenderId();
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(Config.effectJar), EffectJarRenderer.instance);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityEffectJar.class, EffectJarRenderer.instance);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(Config.effectJar), RendererEffectJar.instance);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityEffectJar.class, RendererEffectJar.instance);
|
||||
|
||||
RenderIdVisAuraProvider = RenderingRegistry.getNextAvailableRenderId();
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(Config.visAuraProvider), RendererVisAuraProvider.instance);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityVisAuraProvider.class, RendererVisAuraProvider.instance);
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ public class CommonProxy
|
||||
public static final String GUI_PATH = TEXTURE_PATH + "gui/";
|
||||
|
||||
public static int RenderIdEffectJar;
|
||||
public static int RenderIdVisAuraProvider;
|
||||
|
||||
public void registerRenderers() { }
|
||||
|
||||
|
||||
@@ -3,11 +3,12 @@ package magicbees.main;
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import cpw.mods.fml.client.event.ConfigChangedEvent;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import magicbees.block.*;
|
||||
import magicbees.block.BlockEffectJar;
|
||||
import magicbees.block.BlockHive;
|
||||
import magicbees.block.BlockMagicApiary;
|
||||
import magicbees.block.BlockPlanks;
|
||||
import magicbees.block.BlockVisAuraProvider;
|
||||
import magicbees.block.BlockWoodSlab;
|
||||
import magicbees.block.types.HiveType;
|
||||
import magicbees.item.ItemCapsule;
|
||||
import magicbees.item.ItemComb;
|
||||
@@ -35,7 +36,8 @@ import magicbees.main.utils.VersionInfo;
|
||||
import magicbees.main.utils.compat.ThaumcraftHelper;
|
||||
import magicbees.storage.BackpackDefinition;
|
||||
import magicbees.tileentity.TileEntityEffectJar;
|
||||
import magicbees.tileentity.TileEntityThaumicApiary;
|
||||
import magicbees.tileentity.TileEntityMagicApiary;
|
||||
import magicbees.tileentity.TileEntityVisAuraProvider;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemFood;
|
||||
@@ -47,6 +49,10 @@ import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import cpw.mods.fml.client.event.ConfigChangedEvent;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.storage.BackpackManager;
|
||||
import forestry.api.storage.EnumBackpackType;
|
||||
@@ -92,7 +98,8 @@ public class Config
|
||||
public static BlockWoodSlab slabWoodFull;
|
||||
public static BlockEffectJar effectJar;
|
||||
public static BlockHive hive;
|
||||
public static BlockThaumicApiary thaumicApiary;
|
||||
public static BlockMagicApiary magicApiary;
|
||||
public static BlockVisAuraProvider visAuraProvider;
|
||||
|
||||
public static ItemComb combs;
|
||||
public static ItemWax wax;
|
||||
@@ -129,6 +136,7 @@ public class Config
|
||||
//----- Forestry Blocks ------------------------------------
|
||||
public static Block fHiveBlock;
|
||||
public static Block fAlvearyBlock;
|
||||
public static Block fApicultureBlock;
|
||||
//----- Forestry Items -------------------------------------
|
||||
public static Item fBeeComb;
|
||||
public static Item fHoneydew;
|
||||
@@ -144,6 +152,8 @@ public class Config
|
||||
public static Block tcLog;
|
||||
public static Block tcLeaf;
|
||||
public static Block tcWarded;
|
||||
public static Block tcWooden;
|
||||
public static Block tcMetal;
|
||||
//----- Thaumcraft Items -----------------------------------
|
||||
public static Item tcFilledJar;
|
||||
public static Item tcMiscResource;
|
||||
@@ -240,6 +250,9 @@ public class Config
|
||||
{
|
||||
setupEffectJar();
|
||||
setupHives();
|
||||
setupApiary();
|
||||
|
||||
setupThaumcraftBlocks();
|
||||
}
|
||||
|
||||
public void setupItems()
|
||||
@@ -258,8 +271,7 @@ public class Config
|
||||
setupThaumcraftItems();
|
||||
setupFrames();
|
||||
setupJellyBaby();
|
||||
voidCapsule = new ItemCapsule(CapsuleType.VOID, capsuleStackSizeMax);
|
||||
setupThaumcraftTools();
|
||||
voidCapsule = new ItemCapsule(CapsuleType.VOID, capsuleStackSizeMax);
|
||||
moonDial = new ItemMoonDial();
|
||||
|
||||
setupNuggets();
|
||||
@@ -388,6 +400,12 @@ public class Config
|
||||
GameRegistry.registerBlock(effectJar, "effectJar");
|
||||
GameRegistry.registerTileEntity(TileEntityEffectJar.class, TileEntityEffectJar.tileEntityName);
|
||||
}
|
||||
|
||||
private void setupApiary() {
|
||||
magicApiary = new BlockMagicApiary();
|
||||
GameRegistry.registerBlock(magicApiary, "magicApiary");
|
||||
GameRegistry.registerTileEntity(TileEntityMagicApiary.class, TileEntityMagicApiary.tileEntityName);
|
||||
}
|
||||
|
||||
private void setupFrames() {
|
||||
hiveFrameMagic = new ItemMagicHiveFrame(HiveFrameType.MAGIC);
|
||||
@@ -488,36 +506,24 @@ public class Config
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setupThaumcraftBlocks() {
|
||||
if (ThaumcraftHelper.isActive()) {
|
||||
visAuraProvider = new BlockVisAuraProvider();
|
||||
GameRegistry.registerBlock(visAuraProvider, "visAuraProvider");
|
||||
GameRegistry.registerTileEntity(TileEntityVisAuraProvider.class, "visAuraProvider");
|
||||
}
|
||||
}
|
||||
|
||||
private void setupThaumcraftItems() {
|
||||
if (ThaumcraftHelper.isActive())
|
||||
{
|
||||
// Items
|
||||
solidFlux = new ItemCrystalAspect();
|
||||
|
||||
// Blocks
|
||||
thaumicApiary = new BlockThaumicApiary();
|
||||
GameRegistry.registerBlock(thaumicApiary, "thaumicApiary");
|
||||
GameRegistry.registerTileEntity(TileEntityThaumicApiary.class, TileEntityThaumicApiary.tileEntityName);
|
||||
}
|
||||
}
|
||||
|
||||
private void setupThaumcraftTools() {
|
||||
if (ThaumcraftHelper.isActive())
|
||||
{
|
||||
try
|
||||
{
|
||||
thaumiumScoop = new ItemThaumiumScoop();
|
||||
GameRegistry.registerItem(thaumiumScoop, thaumiumScoop.getUnlocalizedName(), CommonProxy.DOMAIN);
|
||||
|
||||
thaumiumGrafter = new ItemThaumiumGrafter();
|
||||
GameRegistry.registerItem(thaumiumGrafter, thaumiumGrafter.getUnlocalizedName(), CommonProxy.DOMAIN);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHelper.warn("Couldn't register Thaumium tools!");
|
||||
LogHelper.debug(e);
|
||||
}
|
||||
thaumiumScoop = new ItemThaumiumScoop();
|
||||
GameRegistry.registerItem(thaumiumScoop, thaumiumScoop.getUnlocalizedName(), CommonProxy.DOMAIN);
|
||||
|
||||
thaumiumGrafter = new ItemThaumiumGrafter();
|
||||
GameRegistry.registerItem(thaumiumGrafter, thaumiumGrafter.getUnlocalizedName(), CommonProxy.DOMAIN);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,5 @@
|
||||
package magicbees.main;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
|
||||
import magicbees.bees.BeeManager;
|
||||
import magicbees.bees.TransmutationEffectController;
|
||||
import magicbees.client.gui.GUIHandler;
|
||||
@@ -17,6 +8,17 @@ import magicbees.main.utils.IMCManager;
|
||||
import magicbees.main.utils.LogHelper;
|
||||
import magicbees.main.utils.VersionInfo;
|
||||
import magicbees.main.utils.compat.ModHelper;
|
||||
import magicbees.main.utils.net.NetworkEventHandler;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent;
|
||||
import cpw.mods.fml.common.event.FMLMissingMappingsEvent;
|
||||
import cpw.mods.fml.common.event.FMLMissingMappingsEvent.MissingMapping;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
|
||||
@Mod(
|
||||
modid = VersionInfo.ModName,
|
||||
@@ -34,10 +36,12 @@ public class MagicBees
|
||||
|
||||
public GUIHandler guiHandler;
|
||||
private Config modConfig;
|
||||
public final NetworkEventHandler netHandler = new NetworkEventHandler();
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
LogHelper.info("Preinit started");
|
||||
this.modConfig = new Config(event.getSuggestedConfigurationFile());
|
||||
FMLCommonHandler.instance().bus().register(modConfig);
|
||||
|
||||
@@ -88,5 +92,14 @@ public class MagicBees
|
||||
{
|
||||
IMCManager.handle(event);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void handleMissingMapping(FMLMissingMappingsEvent event) {
|
||||
for (MissingMapping mapping : event.get()) {
|
||||
// TODO: ... maybe not this.
|
||||
LogHelper.info(String.format("Missing mapping: %s - ignoring.", mapping.name));
|
||||
mapping.ignore();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,17 +1,93 @@
|
||||
package magicbees.main.utils;
|
||||
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ChunkCoords
|
||||
{
|
||||
public int dimension;
|
||||
public int xCoord;
|
||||
public int zCoord;
|
||||
public final int dimension;
|
||||
public final int x;
|
||||
public final int y;
|
||||
public final int z;
|
||||
|
||||
public ChunkCoords(Chunk chunk)
|
||||
{
|
||||
this.dimension = chunk.worldObj.provider.dimensionId;
|
||||
this.xCoord = chunk.xPosition;
|
||||
this.zCoord = chunk.zPosition;
|
||||
public ChunkCoords(TileEntity entity) {
|
||||
this(entity.getWorldObj(), entity.xCoord, entity.yCoord, entity.zCoord);
|
||||
}
|
||||
|
||||
public ChunkCoords(Entity entity) {
|
||||
this(entity.worldObj, entity.chunkCoordX, entity.chunkCoordY, entity.chunkCoordZ);
|
||||
}
|
||||
|
||||
public ChunkCoords(World world, int xCoord, int yCoord, int zCoord)
|
||||
{
|
||||
this(world.provider.dimensionId, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
public ChunkCoords(int dimId, int xCoord, int yCoord, int zCoord)
|
||||
{
|
||||
this.dimension = dimId;
|
||||
this.x = xCoord;
|
||||
this.y = yCoord;
|
||||
this.z = zCoord;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds chunk coords together & returns the result within the same dimension.
|
||||
*/
|
||||
public ChunkCoords add(ChunkCoords coords) {
|
||||
return new ChunkCoords(coords.dimension, this.x + coords.x, this.y + coords.y, this.z + coords.z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Subtracts chunk coords (a.subtract(b) == a - b) & returns the result within the same dimension.
|
||||
*/
|
||||
public ChunkCoords subtract(ChunkCoords coords) {
|
||||
return new ChunkCoords(coords.dimension, this.x - coords.x, this.y - coords.y, this.z - coords.z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChunkCoords in the specified dimension.
|
||||
*/
|
||||
public ChunkCoords inDimension(int dimId) {
|
||||
return new ChunkCoords(dimId, x, y, z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChunkCoords in the specified world.
|
||||
*/
|
||||
public ChunkCoords inDimension(World world) {
|
||||
return new ChunkCoords(world.provider.dimensionId, x, y, z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes obj to the given tag compound as a subtag. Writes nothing if obj is null.
|
||||
*/
|
||||
public static void writeToNBT(ChunkCoords obj, NBTTagCompound tagRoot) {
|
||||
if (obj != null) {
|
||||
NBTTagCompound coordsTag = new NBTTagCompound();
|
||||
coordsTag.setInteger("dim", obj.dimension);
|
||||
coordsTag.setInteger("xPos", obj.x);
|
||||
coordsTag.setInteger("yPos", obj.y);
|
||||
coordsTag.setInteger("zPos", obj.z);
|
||||
tagRoot.setTag("chunkCoords", coordsTag);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a ChunkCoords from an NBT tag. If no ChunkCoords subtag exists, returns null.
|
||||
*/
|
||||
public static ChunkCoords readFromNBT(NBTTagCompound tagRoot) {
|
||||
if (tagRoot.hasKey("chunkCoords")) {
|
||||
NBTTagCompound coordsTag = (NBTTagCompound)tagRoot.getTag("chunkCoords");
|
||||
int dim = coordsTag.getInteger("dim");
|
||||
int x = coordsTag.getInteger("xPos");
|
||||
int y = coordsTag.getInteger("yPos");
|
||||
int z = coordsTag.getInteger("zPos");
|
||||
return new ChunkCoords(dim, x, y, z);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package magicbees.main.utils;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import magicbees.item.ItemCapsule;
|
||||
import magicbees.item.types.CombType;
|
||||
import magicbees.item.types.DropType;
|
||||
@@ -23,6 +22,7 @@ import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
|
||||
public class CraftingManager
|
||||
@@ -351,38 +351,16 @@ public class CraftingManager
|
||||
'S', Config.miscResources.getStackForType(ResourceType.DIMENSIONAL_SINGULARITY)
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
// TODO: Finalize recipe.
|
||||
output = new ItemStack(Config.magicApiary);
|
||||
GameRegistry.addShapelessRecipe(output, new Object[] {
|
||||
Config.pollen.getStackForType(PollenType.UNUSUAL, 2),
|
||||
new ItemStack(Config.fApicultureBlock, 1, ForestryHelper.ApicultureBlock.APIARY.ordinal())
|
||||
});
|
||||
|
||||
if (ThaumcraftHelper.isActive())
|
||||
{
|
||||
// Slabs
|
||||
/*for (int i = 0; i < PlankType.values().length; ++i)
|
||||
{
|
||||
input = new ItemStack(Config.planksWood, 1, i);
|
||||
output = new ItemStack(Config.slabWoodHalf, 6, i);
|
||||
GameRegistry.addRecipe(output, new Object[] {
|
||||
"PPP",
|
||||
'P', input
|
||||
});
|
||||
}*/
|
||||
|
||||
// Essentia bottles
|
||||
/*output = new ItemStack(Config.tcEssentiaBottle);
|
||||
output.stackSize = 8;
|
||||
GameRegistry.addRecipe(output, new Object[] {
|
||||
" C ", "GPG", "PGP",
|
||||
'G', Config.wax,
|
||||
'C', Item.clay,
|
||||
'P', Block.thinGlass
|
||||
});
|
||||
|
||||
output = new ItemStack(Config.tcEssentiaBottle);
|
||||
output.stackSize = 4;
|
||||
GameRegistry.addRecipe(output, new Object[] {
|
||||
" W ", "W W", " W ",
|
||||
'W', Config.wax
|
||||
});*/
|
||||
|
||||
input = Config.miscResources.getStackForType(ResourceType.LORE_FRAGMENT);
|
||||
output = new ItemStack(Config.tcMiscResource, 1, ThaumcraftHelper.MiscResource.KNOWLEDGE_FRAGMENT.ordinal());
|
||||
GameRegistry.addShapelessRecipe(output, new Object[] {
|
||||
@@ -400,20 +378,6 @@ public class CraftingManager
|
||||
'C', Blocks.chest
|
||||
});
|
||||
}
|
||||
|
||||
// "bottling" Crystal aspects.
|
||||
/*for (EnumTag tag : EnumTag.values())
|
||||
{
|
||||
if (tag != EnumTag.UNKNOWN)
|
||||
{
|
||||
output = new ItemStack(Config.tcEssentiaBottle, 1, tag.id + 1);
|
||||
GameRegistry.addRecipe(output, new Object[] {
|
||||
"ccc", "cxc", "ccc",
|
||||
'c', new ItemStack(Config.solidFlux, 1, tag.id),
|
||||
'x', Config.tcEssentiaBottle
|
||||
});
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
if (ArsMagicaHelper.isActive())
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
package magicbees.main.utils;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemStackUtils {
|
||||
|
||||
/**
|
||||
* Attempts to add all items to the inventory, starting at startSlot and considering slotCount item slots.
|
||||
* @return Number of items successfully added to the inventory.
|
||||
*/
|
||||
public static int tryAddItemStacksToInvenotry(IInventory inventory, ItemStack[] items, int startSlot, int slotCount) {
|
||||
int itemsAdded = 0;
|
||||
|
||||
for (ItemStack item : items) {
|
||||
itemsAdded += addItemToInventory(inventory, item, startSlot, slotCount);
|
||||
}
|
||||
|
||||
return itemsAdded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to add all items to the inventory, starting at startSlot and considering slotCount item slots.
|
||||
* @return true if and only if all items were successfully added to the inventory.
|
||||
*/
|
||||
public static boolean tryAddAllItemStacksToInventory(IInventory inventory, ItemStack[] items, int startSlot, int slotCount) {
|
||||
int itemsToAdd = 0;
|
||||
int itemsAdded = 0;
|
||||
|
||||
for (ItemStack item : items) {
|
||||
itemsToAdd += item.stackSize;
|
||||
itemsAdded += addItemToInventory(inventory, item, startSlot, slotCount);
|
||||
}
|
||||
|
||||
return itemsToAdd == itemsAdded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to add an item to an inventory, starting at startSlot and considering slotCount item slots.
|
||||
* @return number of items in the stack successfully added to the inventory.
|
||||
*/
|
||||
public static int addItemToInventory(IInventory inventory, ItemStack item, int startSlot, int slotCount) {
|
||||
int itemsAdded = 0;
|
||||
|
||||
itemsAdded = addToExistingSlot(inventory, item, startSlot, slotCount);
|
||||
if (itemsAdded < item.stackSize) {
|
||||
item.stackSize -= itemsAdded;
|
||||
itemsAdded += addToEmptySlot(inventory, item, startSlot, slotCount);
|
||||
}
|
||||
|
||||
return itemsAdded;
|
||||
}
|
||||
|
||||
private static int addToExistingSlot(IInventory inventory, ItemStack item, int startSlot, int slotCount) {
|
||||
int itemsAdded = 0;
|
||||
|
||||
for (int slotIndex = startSlot; slotIndex < (startSlot + slotCount); ++slotIndex) {
|
||||
ItemStack slotStack = inventory.getStackInSlot(slotIndex);
|
||||
|
||||
// Skip empty slots.
|
||||
if (slotStack != null && areItemsEqualNBT(item, slotStack)) {
|
||||
int spaceAvailable = slotStack.getMaxStackSize() - slotStack.stackSize;
|
||||
|
||||
if (spaceAvailable > item.stackSize) {
|
||||
slotStack.stackSize += item.stackSize;
|
||||
inventory.setInventorySlotContents(slotIndex, slotStack);
|
||||
itemsAdded += item.stackSize;
|
||||
item.stackSize = 0;
|
||||
}
|
||||
else if (spaceAvailable > 0) {
|
||||
slotStack.stackSize = slotStack.getMaxStackSize();
|
||||
inventory.setInventorySlotContents(slotIndex, slotStack);
|
||||
itemsAdded += spaceAvailable;
|
||||
item.stackSize -= spaceAvailable;
|
||||
}
|
||||
}
|
||||
|
||||
// Don't add beyond what we have.
|
||||
if (item.stackSize == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return itemsAdded;
|
||||
}
|
||||
|
||||
private static int addToEmptySlot(IInventory inventory, ItemStack item, int startSlot, int slotCount) {
|
||||
for (int slotIndex = startSlot; slotIndex < (startSlot + slotCount); ++slotIndex) {
|
||||
ItemStack slotStack = inventory.getStackInSlot(slotIndex);
|
||||
|
||||
if (slotStack == null) {
|
||||
inventory.setInventorySlotContents(slotIndex, item);
|
||||
return item.stackSize;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static boolean areItemsEqualNBT(ItemStack item, ItemStack otherItem) {
|
||||
return item.isItemEqual(otherItem) && ItemStack.areItemStackTagsEqual(item, otherItem);
|
||||
}
|
||||
}
|
||||
@@ -9,11 +9,12 @@ import magicbees.main.Config;
|
||||
import magicbees.main.utils.BlockInterface;
|
||||
import magicbees.main.utils.ItemInterface;
|
||||
import magicbees.main.utils.VersionInfo;
|
||||
|
||||
import forestry.api.apiculture.hives.HiveManager;
|
||||
import forestry.api.apiculture.hives.IHiveRegistry;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import forestry.api.genetics.IAllele;
|
||||
|
||||
public class ForestryHelper
|
||||
@@ -93,6 +94,11 @@ public class ForestryHelper
|
||||
APATITE,
|
||||
LAPIS,;
|
||||
}
|
||||
|
||||
public enum ApicultureBlock {
|
||||
APIARY,
|
||||
;
|
||||
}
|
||||
|
||||
public static final String Name = "Forestry";
|
||||
|
||||
@@ -138,6 +144,7 @@ public class ForestryHelper
|
||||
Class c = Class.forName("forestry.core.config.ForestryBlock");
|
||||
Config.fAlvearyBlock = BlockInterface.getBlock("alveary");
|
||||
Config.fHiveBlock = BlockInterface.getBlock("beehives");
|
||||
Config.fApicultureBlock = BlockInterface.getBlock("apiculture");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -168,4 +175,9 @@ public class ForestryHelper
|
||||
{
|
||||
return EnumHumidity.getFromValue(rawHumidity);
|
||||
}
|
||||
|
||||
public static boolean isHumidityWithinTolerance(EnumHumidity humid, EnumHumidity beeHumidityBase, EnumTolerance value) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -31,10 +31,8 @@ import thaumcraft.api.research.ResearchPage;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.config.ForestryItem;
|
||||
|
||||
public class ThaumcraftHelper
|
||||
{
|
||||
public enum MiscResource
|
||||
{
|
||||
public class ThaumcraftHelper {
|
||||
public enum MiscResource {
|
||||
ALUMENTUM,
|
||||
NITOR,
|
||||
THAUMIUM,
|
||||
@@ -45,92 +43,119 @@ public class ThaumcraftHelper
|
||||
ENCHANTED_FABRIC,
|
||||
FLUX_FILTER,
|
||||
KNOWLEDGE_FRAGMENT,
|
||||
MIRRORED_GLASS,;
|
||||
MIRRORED_GLASS,
|
||||
;
|
||||
}
|
||||
|
||||
public enum NuggetType
|
||||
{
|
||||
public enum NuggetType {
|
||||
IRON,
|
||||
COPPER,
|
||||
TIN,
|
||||
SILVER,
|
||||
LEAD,
|
||||
QUICKSILVER,
|
||||
THAUMIUM, _7, _8, _9, _10, _11, _12, _13, _14, _15,
|
||||
THAUMIUM,
|
||||
_7, _8, _9, _10, _11, _12, _13, _14, _15,
|
||||
NATIVE_IRON,
|
||||
NATIVE_COPPER,
|
||||
NATIVE_TIN,
|
||||
NATIVE_SILVER,
|
||||
NATIVE_LEAD, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30,
|
||||
NATIVE_GOLD,;
|
||||
NATIVE_LEAD,
|
||||
_21, _22, _23, _24, _25, _26, _27, _28, _29, _30,
|
||||
NATIVE_GOLD,
|
||||
;
|
||||
}
|
||||
|
||||
public enum ShardType
|
||||
{
|
||||
public enum ShardType {
|
||||
AIR,
|
||||
FIRE,
|
||||
WATER,
|
||||
EARTH,
|
||||
ORDER,
|
||||
CHAOS,;
|
||||
CHAOS,
|
||||
BALANCED,
|
||||
;
|
||||
}
|
||||
|
||||
public enum Entity
|
||||
{
|
||||
public enum MetalDeviceType {
|
||||
CRUCIBLE,
|
||||
ALEMBIC,
|
||||
VIS_CHARGE_RELAY,
|
||||
ADVANCED_ALCHEMICAL_CONSTRUCT,
|
||||
_4,
|
||||
ITEM_GRATE,
|
||||
_6,
|
||||
ARCANE_LAMP,
|
||||
LAMP_OF_GROWTH,
|
||||
ALCHEMICAL_CONSTRUCT,
|
||||
THAUMATORIUM,
|
||||
_11,
|
||||
MNEMONIC_MATRIX,
|
||||
LAMP_OF_FERTILITY,
|
||||
VIS_RELAY,
|
||||
;
|
||||
}
|
||||
|
||||
public enum WoodenDeviceType {
|
||||
BELLOWS,
|
||||
EAR,
|
||||
PRESSURE_PLATE,
|
||||
BORE_BASE,
|
||||
BORE,
|
||||
PLANKS_GREATWOOD,
|
||||
PLANKS_SILVERWOOD,
|
||||
BANNER,
|
||||
;
|
||||
}
|
||||
|
||||
public enum Entity {
|
||||
BRAINY_ZOMBIE("entBrainyZombie", "EntityBrainyZombie"),
|
||||
GIANT_BRAINY_ZOMBIE("entGiantBrainyZombie", "EntityGiantBrainyZombie"),
|
||||
WISP("entWisp", "EntityWisp"),
|
||||
FIREBAT("entFirebat", "EntityFireBat"),;
|
||||
FIREBAT("entFirebat", "EntityFireBat"),
|
||||
;
|
||||
|
||||
private static String packageName = "thaumcraft.common.entities.monster.";
|
||||
|
||||
public String entityID;
|
||||
private String className;
|
||||
|
||||
private Entity(String id, String clazz)
|
||||
{
|
||||
private Entity(String id, String clazz) {
|
||||
this.entityID = id;
|
||||
this.className = clazz;
|
||||
}
|
||||
|
||||
public String getClassName()
|
||||
{
|
||||
public String getClassName() {
|
||||
return packageName + this.className;
|
||||
}
|
||||
}
|
||||
|
||||
public enum BlockPlant
|
||||
{
|
||||
public enum BlockPlant {
|
||||
GREATWOOD_SAPLING,
|
||||
SILVERWOOD_SAPLING,
|
||||
SHIMMERLEAF,
|
||||
CINDERPEARL,
|
||||
PURIFYING_PLANT,;
|
||||
PURIFYING_PLANT,
|
||||
;
|
||||
}
|
||||
|
||||
public enum TreeType
|
||||
{
|
||||
public enum TreeType {
|
||||
GREATWOOD,
|
||||
SILVERWOOD,;
|
||||
SILVERWOOD,
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
public static final String Name = "Thaumcraft";
|
||||
private static boolean isThaumcraftPresent = false;
|
||||
|
||||
public static boolean isActive()
|
||||
{
|
||||
public static boolean isActive() {
|
||||
return isThaumcraftPresent;
|
||||
}
|
||||
|
||||
public static void preInit()
|
||||
{
|
||||
if (Loader.isModLoaded(Name) && Config.thaumcraftActive)
|
||||
{
|
||||
public static void preInit() {
|
||||
if (Loader.isModLoaded(Name) && Config.thaumcraftActive) {
|
||||
isThaumcraftPresent = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// Switch off TC-dependant items.
|
||||
ResourceType.LORE_FRAGMENT.setHidden();
|
||||
ResourceType.TC_DUST_AIR.setHidden();
|
||||
@@ -142,23 +167,22 @@ public class ThaumcraftHelper
|
||||
}
|
||||
}
|
||||
|
||||
public static void init()
|
||||
{
|
||||
//if (isActive()) { }
|
||||
public static void init() {
|
||||
// if (isActive()) { }
|
||||
}
|
||||
|
||||
public static void postInit()
|
||||
{
|
||||
if (isActive())
|
||||
{
|
||||
public static void postInit() {
|
||||
if (isActive()) {
|
||||
// Apparently the Game Registry isn't populated until now. ):
|
||||
getBlocks();
|
||||
getItems();
|
||||
|
||||
aspectTime = new Aspect("tempus", 0xB68CFF, new Aspect[] { Aspect.VOID, Aspect.ORDER },
|
||||
new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.TEXTURE + "aspects/tempus.png"), 1);
|
||||
aspectTime = new Aspect("tempus", 0xB68CFF, new Aspect[] {
|
||||
Aspect.VOID, Aspect.ORDER }, new ResourceLocation(
|
||||
CommonProxy.DOMAIN, CommonProxy.TEXTURE
|
||||
+ "aspects/tempus.png"), 1);
|
||||
|
||||
//addItemsToBackpack();
|
||||
// addItemsToBackpack();
|
||||
setupItemAspects();
|
||||
setupCrafting();
|
||||
setupResearch();
|
||||
@@ -167,159 +191,6 @@ public class ThaumcraftHelper
|
||||
|
||||
private static Object aspectTime;
|
||||
|
||||
private static void getBlocks()
|
||||
{
|
||||
Config.tcPlant = BlockInterface.getBlock(Name, "blockCustomPlant");
|
||||
Config.tcCandle = BlockInterface.getBlock(Name, "blockCandle");
|
||||
Config.tcCrystal = BlockInterface.getBlock(Name, "blockCrystal");
|
||||
Config.tcMarker = BlockInterface.getBlock(Name, "blockMarker");
|
||||
Config.tcJar = BlockInterface.getBlock(Name, "blockJar");
|
||||
Config.tcLog = BlockInterface.getBlock(Name, "blockMagicalLog");
|
||||
Config.tcLeaf = BlockInterface.getBlock(Name, "blockMagicalLeaves");
|
||||
Config.tcWarded = BlockInterface.getBlock(Name, "blockWarded");
|
||||
}
|
||||
|
||||
private static void getItems()
|
||||
{
|
||||
Config.tcFilledJar = ItemInterface.getItem(Name, "BlockJarFilledItem");
|
||||
Config.tcMiscResource = ItemInterface.getItem(Name, "ItemResource");
|
||||
//Config.tcEssentiaBottle = ItemInterface.getItem(Name, "BlockJarFilledItem");
|
||||
Config.tcShard = ItemInterface.getItem(Name, "ItemShard");
|
||||
Config.tcGolem = ItemInterface.getItem(Name, "ItemGolemPlacer");
|
||||
//Config.tcWispEssence = ItemApi.getItem("itemWispEssence", 0).getItem();
|
||||
Config.tcNuggets = ItemInterface.getItem(Name, "ItemNugget");
|
||||
Config.tcShard = ItemInterface.getItem(Name, "ItemShard");
|
||||
Config.tcNuggetChicken = ItemInterface.getItem(Name, "ItemNuggetChicken");
|
||||
Config.tcNuggetBeef = ItemInterface.getItem(Name, "ItemNuggetBeef");
|
||||
Config.tcNuggetPork = ItemInterface.getItem(Name, "ItemNuggetPork");
|
||||
}
|
||||
|
||||
private static void addItemsToBackpack()
|
||||
{
|
||||
// if (Config.addThaumcraftItemsToBackpacks)
|
||||
// {
|
||||
// // Add all shards and Thaumium to miner's backpack
|
||||
// String ids = Config.tcShard.itemID + ":" + -1 + ";"
|
||||
// + Config.tcMiscResource.itemID + ":" + ThaumcraftHelper.MiscResource.THAUMIUM.ordinal();
|
||||
// FMLInterModComms.sendMessage("Forestry", "add-backpack-items", "miner@" + ids);
|
||||
//
|
||||
// // All resources go into Thaumaturge's backpack
|
||||
// ids = Config.tcMiscResource.itemID + ":" + -1 + ";"
|
||||
// + Config.tcShard.itemID + ":" + -1 + ";"
|
||||
// + Config.tcFilledJar.itemID + ":" + -1 + ";"
|
||||
// + Config.tcCrystal.blockID + ":" + -1 + ";"
|
||||
// + Config.tcJar.blockID + ":" + -1 + ";"
|
||||
// + Config.tcGolem.itemID + ":" + -1 + ";";
|
||||
// FMLInterModComms.sendMessage("Forestry", "add-backpack-items", "thaumaturge@" + ids);
|
||||
//
|
||||
// // Add some plants & saplings to Forester's
|
||||
// ids = Config.tcPlant.blockID + ":" + "-1" + ";"
|
||||
// + Config.tcLeaf.blockID + ":" + -1 + ";"
|
||||
// + Config.tcLog.blockID + ":" + "-1";
|
||||
// FMLInterModComms.sendMessage("Forestry", "add-backpack-items", "forester@" + ids);
|
||||
//
|
||||
// // Add Wisp & brains to Hunter's
|
||||
// ids = /*Config.tcWispEssence.itemID + ":" + -1 + ";"
|
||||
// +*/ Config.tcMiscResource.itemID + ":" + ThaumcraftHelper.MiscResource.ZOMBIE_BRAIN.ordinal();
|
||||
// FMLInterModComms.sendMessage("Forestry", "add-backpack-items", "hunter@" + ids);
|
||||
//
|
||||
// // Add Marker, warded stone, candle to builder
|
||||
// ids = Config.tcCandle.blockID + ":" + -1 + ";"
|
||||
// + Config.tcMarker.blockID + ":" + -1 + ";"
|
||||
// + Config.tcWarded.blockID + ":" + -1;
|
||||
// FMLInterModComms.sendMessage("Forestry", "add-backpack-items", "builder@" + ids);
|
||||
// }
|
||||
}
|
||||
|
||||
private static void setupCrafting()
|
||||
{
|
||||
ItemStack input, output;
|
||||
|
||||
input = Config.miscResources.getStackForType(ResourceType.TC_DUST_AIR);
|
||||
output = new ItemStack(Config.tcShard, 1, ShardType.AIR.ordinal());
|
||||
GameRegistry.addShapelessRecipe(output, input, input, input, input);
|
||||
|
||||
input = Config.miscResources.getStackForType(ResourceType.TC_DUST_WATER);
|
||||
output = new ItemStack(Config.tcShard, 1, ShardType.WATER.ordinal());
|
||||
GameRegistry.addShapelessRecipe(output, input, input, input, input);
|
||||
|
||||
input = Config.miscResources.getStackForType(ResourceType.TC_DUST_FIRE);
|
||||
output = new ItemStack(Config.tcShard, 1, ShardType.FIRE.ordinal());
|
||||
GameRegistry.addShapelessRecipe(output, input, input, input, input);
|
||||
|
||||
input = Config.miscResources.getStackForType(ResourceType.TC_DUST_EARTH);
|
||||
output = new ItemStack(Config.tcShard, 1, ShardType.EARTH.ordinal());
|
||||
GameRegistry.addShapelessRecipe(output, input, input, input, input);
|
||||
|
||||
input = Config.miscResources.getStackForType(ResourceType.TC_DUST_ORDER);
|
||||
output = new ItemStack(Config.tcShard, 1, ShardType.ORDER.ordinal());
|
||||
GameRegistry.addShapelessRecipe(output, input, input, input, input);
|
||||
|
||||
input = Config.miscResources.getStackForType(ResourceType.TC_DUST_CHAOS);
|
||||
output = new ItemStack(Config.tcShard, 1, ShardType.CHAOS.ordinal());
|
||||
GameRegistry.addShapelessRecipe(output, input, input, input, input);
|
||||
|
||||
thaumScoop = ThaumcraftApi.addArcaneCraftingRecipe("MB_Scoop", new ItemStack(Config.thaumiumScoop),
|
||||
new AspectList().add(Aspect.ORDER, 2), new Object[] {
|
||||
"sWs", "sTs", " T ",
|
||||
's', Items.stick,
|
||||
'W', Blocks.wool,
|
||||
'T', new ItemStack(Config.tcMiscResource, 1, MiscResource.THAUMIUM.ordinal())
|
||||
});
|
||||
|
||||
thaumGrafter = ThaumcraftApi.addArcaneCraftingRecipe("MB_Grafter", new ItemStack(Config.thaumiumGrafter),
|
||||
new AspectList().add(Aspect.ORDER, 5), new Object[] {
|
||||
" T", " s ", "s ",
|
||||
's', Items.stick,
|
||||
'T', new ItemStack(Config.tcMiscResource, 1, MiscResource.THAUMIUM.ordinal())
|
||||
});
|
||||
|
||||
frameMagic = ThaumcraftApi.addArcaneCraftingRecipe("MB_FrameMagic", new ItemStack(Config.hiveFrameMagic),
|
||||
new AspectList().add(Aspect.ORDER, 5).add(Aspect.AIR, 2).add(Aspect.EARTH, 2), new Object[] {
|
||||
"sss", "sCs", "sss",
|
||||
's', Items.stick,
|
||||
'C', new ItemStack(Config.tcMiscResource, 1, MiscResource.ENCHANTED_FABRIC.ordinal())
|
||||
});
|
||||
|
||||
essenceLife = ThaumcraftApi.addCrucibleRecipe("MB_EssenceLife", Config.miscResources.getStackForType(ResourceType.ESSENCE_FALSE_LIFE),
|
||||
new ItemStack(Blocks.red_flower), new AspectList().add(Aspect.EXCHANGE, 4).add(Aspect.PLANT, 4));
|
||||
|
||||
essenceDeath = ThaumcraftApi.addCrucibleRecipe("MB_EssenceDeath", Config.miscResources.getStackForType(ResourceType.ESSENCE_SHALLOW_GRAVE),
|
||||
new ItemStack(Items.rotten_flesh), new AspectList().add(Aspect.DEATH, 4).add(Aspect.ENTROPY, 4));
|
||||
|
||||
essenceArmor = ThaumcraftApi.addCrucibleRecipe("MB_EssenceArmor", Config.miscResources.getStackForType(ResourceType.ESSENCE_EVERLASTING_DURABILITY),
|
||||
new ItemStack(Items.leather), new AspectList().add(Aspect.ARMOR, 4).add(Aspect.MAGIC, 2));
|
||||
|
||||
output = Config.miscResources.getStackForType(ResourceType.ESSENCE_FICKLE_PERMANENCE);
|
||||
essenceUnstableA = ThaumcraftApi.addCrucibleRecipe("MB_EssenceUnstable", output,
|
||||
Config.propolis.getStackForType(PropolisType.UNSTABLE), new AspectList().add(Aspect.ENTROPY, 2).add(Aspect.EXCHANGE, 1));
|
||||
|
||||
essenceUnstableB = ThaumcraftApi.addCrucibleRecipe("MB_EssenceUnstable", output,
|
||||
new ItemStack(Blocks.netherrack), new AspectList().add(Aspect.ENTROPY, 8).add(Aspect.EXCHANGE, 5));
|
||||
|
||||
essenceTime = ThaumcraftApi.addCrucibleRecipe("MB_EssenceTime", Config.miscResources.getStackForType(ResourceType.ESSENCE_LOST_TIME),
|
||||
new ItemStack(Items.clock), new AspectList().add(Aspect.ORDER, 10).add(Aspect.VOID,
|
||||
10).add(Aspect.TRAP, 4));
|
||||
|
||||
input = new ItemStack(Items.ender_pearl);
|
||||
singularityA = ThaumcraftApi.addInfusionCraftingRecipe("MB_DimensionalSingularity", Config.miscResources.getStackForType(ResourceType.DIMENSIONAL_SINGULARITY, 3),
|
||||
5, new AspectList().add(Aspect.ELDRITCH, 10).add(Aspect.EXCHANGE, 20),
|
||||
new ItemStack(Blocks.gold_block),
|
||||
new ItemStack[] { input, input });
|
||||
|
||||
ItemStack in2 = new ItemStack(Items.diamond);
|
||||
singularityB = ThaumcraftApi.addInfusionCraftingRecipe("MB_DimensionalSingularity", Config.miscResources.getStackForType(ResourceType.DIMENSIONAL_SINGULARITY, 3),
|
||||
6, new AspectList().add(Aspect.ELDRITCH, 10).add(Aspect.EXCHANGE, 20).add(Aspect.VOID, 15),
|
||||
Config.propolis.getStackForType(PropolisType.UNSTABLE),
|
||||
new ItemStack[] { input, input, in2 });
|
||||
|
||||
essenceOblivion = ThaumcraftApi.addShapelessArcaneCraftingRecipe("MB_EssenceOblivion", Config.miscResources.getStackForType(ResourceType.ESSENCE_SCORNFUL_OBLIVION),
|
||||
new AspectList().add(Aspect.ENTROPY, 25).add(Aspect.AIR, 40).add(Aspect.ORDER, 15), new Object[] {
|
||||
Config.miscResources.getStackForType(ResourceType.DIMENSIONAL_SINGULARITY),
|
||||
Blocks.dragon_egg,
|
||||
});
|
||||
}
|
||||
|
||||
private static Object frameMagic;
|
||||
private static Object thaumScoop;
|
||||
private static Object thaumGrafter;
|
||||
@@ -332,58 +203,203 @@ public class ThaumcraftHelper
|
||||
private static Object essenceUnstableB;
|
||||
private static Object essenceTime;
|
||||
private static Object essenceOblivion;
|
||||
private static Object visAuraProvider;
|
||||
|
||||
private static void setupResearch()
|
||||
{
|
||||
private static void getBlocks() {
|
||||
Config.tcPlant = BlockInterface.getBlock(Name, "blockCustomPlant");
|
||||
Config.tcCandle = BlockInterface.getBlock(Name, "blockCandle");
|
||||
Config.tcCrystal = BlockInterface.getBlock(Name, "blockCrystal");
|
||||
Config.tcMarker = BlockInterface.getBlock(Name, "blockMarker");
|
||||
Config.tcJar = BlockInterface.getBlock(Name, "blockJar");
|
||||
Config.tcLog = BlockInterface.getBlock(Name, "blockMagicalLog");
|
||||
Config.tcLeaf = BlockInterface.getBlock(Name, "blockMagicalLeaves");
|
||||
Config.tcWarded = BlockInterface.getBlock(Name, "blockWarded");
|
||||
Config.tcWooden = BlockInterface.getBlock(Name, "blockWoodenDevice");
|
||||
Config.tcMetal = BlockInterface.getBlock(Name, "blockMetalDevice");
|
||||
}
|
||||
|
||||
private static void getItems() {
|
||||
Config.tcFilledJar = ItemInterface.getItem(Name, "BlockJarFilledItem");
|
||||
Config.tcMiscResource = ItemInterface.getItem(Name, "ItemResource");
|
||||
// Config.tcEssentiaBottle = ItemInterface.getItem(Name,
|
||||
// "BlockJarFilledItem");
|
||||
Config.tcShard = ItemInterface.getItem(Name, "ItemShard");
|
||||
Config.tcGolem = ItemInterface.getItem(Name, "ItemGolemPlacer");
|
||||
// Config.tcWispEssence = ItemApi.getItem("itemWispEssence",
|
||||
// 0).getItem();
|
||||
Config.tcNuggets = ItemInterface.getItem(Name, "ItemNugget");
|
||||
Config.tcShard = ItemInterface.getItem(Name, "ItemShard");
|
||||
Config.tcNuggetChicken = ItemInterface.getItem(Name,
|
||||
"ItemNuggetChicken");
|
||||
Config.tcNuggetBeef = ItemInterface.getItem(Name, "ItemNuggetBeef");
|
||||
Config.tcNuggetPork = ItemInterface.getItem(Name, "ItemNuggetPork");
|
||||
}
|
||||
|
||||
private static void setupCrafting() {
|
||||
ItemStack input, output;
|
||||
|
||||
input = Config.miscResources.getStackForType(ResourceType.TC_DUST_AIR);
|
||||
output = new ItemStack(Config.tcShard, 1, ShardType.AIR.ordinal());
|
||||
GameRegistry.addShapelessRecipe(output, input, input, input, input);
|
||||
|
||||
input = Config.miscResources
|
||||
.getStackForType(ResourceType.TC_DUST_WATER);
|
||||
output = new ItemStack(Config.tcShard, 1, ShardType.WATER.ordinal());
|
||||
GameRegistry.addShapelessRecipe(output, input, input, input, input);
|
||||
|
||||
input = Config.miscResources.getStackForType(ResourceType.TC_DUST_FIRE);
|
||||
output = new ItemStack(Config.tcShard, 1, ShardType.FIRE.ordinal());
|
||||
GameRegistry.addShapelessRecipe(output, input, input, input, input);
|
||||
|
||||
input = Config.miscResources
|
||||
.getStackForType(ResourceType.TC_DUST_EARTH);
|
||||
output = new ItemStack(Config.tcShard, 1, ShardType.EARTH.ordinal());
|
||||
GameRegistry.addShapelessRecipe(output, input, input, input, input);
|
||||
|
||||
input = Config.miscResources
|
||||
.getStackForType(ResourceType.TC_DUST_ORDER);
|
||||
output = new ItemStack(Config.tcShard, 1, ShardType.ORDER.ordinal());
|
||||
GameRegistry.addShapelessRecipe(output, input, input, input, input);
|
||||
|
||||
input = Config.miscResources
|
||||
.getStackForType(ResourceType.TC_DUST_CHAOS);
|
||||
output = new ItemStack(Config.tcShard, 1, ShardType.CHAOS.ordinal());
|
||||
GameRegistry.addShapelessRecipe(output, input, input, input, input);
|
||||
|
||||
thaumScoop = ThaumcraftApi.addArcaneCraftingRecipe("MB_Scoop", new ItemStack(Config.thaumiumScoop),
|
||||
new AspectList().add(Aspect.ORDER, 2), new Object[] {
|
||||
"sWs", "sTs", " T ",
|
||||
's', Items.stick,
|
||||
'W', Blocks.wool,
|
||||
'T', new ItemStack(Config.tcMiscResource, 1, MiscResource.THAUMIUM.ordinal()) });
|
||||
|
||||
thaumGrafter = ThaumcraftApi.addArcaneCraftingRecipe("MB_Grafter",
|
||||
new ItemStack(Config.thaumiumGrafter),
|
||||
new AspectList().add(Aspect.ORDER, 5), new Object[] {
|
||||
" T", " s ", "s ",
|
||||
's', Items.stick,
|
||||
'T', new ItemStack(Config.tcMiscResource, 1, MiscResource.THAUMIUM.ordinal()) });
|
||||
|
||||
frameMagic = ThaumcraftApi.addArcaneCraftingRecipe("MB_FrameMagic", new ItemStack(Config.hiveFrameMagic),
|
||||
new AspectList().add(Aspect.ORDER, 5).add(Aspect.AIR, 2).add(Aspect.EARTH, 2), new Object[] {
|
||||
"sss", "sCs", "sss",
|
||||
's', Items.stick,
|
||||
'C', new ItemStack(Config.tcMiscResource, 1, MiscResource.ENCHANTED_FABRIC.ordinal()) });
|
||||
|
||||
visAuraProvider = ThaumcraftApi.addArcaneCraftingRecipe("MB_VisAuraProvider", new ItemStack(Config.visAuraProvider),
|
||||
new AspectList().add(Aspect.ORDER, 60).add(Aspect.AIR, 60).add(Aspect.ENTROPY, 60).add(Aspect.WATER, 60),
|
||||
new Object[] {
|
||||
"ngn", "gvg", "npn",
|
||||
'n', Items.gold_nugget,
|
||||
'g', new ItemStack(Config.tcWooden, 1, ThaumcraftHelper.WoodenDeviceType.PLANKS_GREATWOOD.ordinal()),
|
||||
'v', new ItemStack(Config.tcMetal, 1, ThaumcraftHelper.MetalDeviceType.VIS_RELAY.ordinal()),
|
||||
'p', Config.pollen.getStackForType(PollenType.UNUSUAL)});
|
||||
|
||||
essenceLife = ThaumcraftApi.addCrucibleRecipe("MB_EssenceLife", Config.miscResources.getStackForType(ResourceType.ESSENCE_FALSE_LIFE),
|
||||
new ItemStack(Blocks.red_flower),
|
||||
new AspectList().add(Aspect.EXCHANGE, 4).add(Aspect.PLANT, 4));
|
||||
|
||||
essenceDeath = ThaumcraftApi.addCrucibleRecipe("MB_EssenceDeath",
|
||||
Config.miscResources
|
||||
.getStackForType(ResourceType.ESSENCE_SHALLOW_GRAVE),
|
||||
new ItemStack(Items.rotten_flesh),
|
||||
new AspectList().add(Aspect.DEATH, 4).add(Aspect.ENTROPY, 4));
|
||||
|
||||
essenceArmor = ThaumcraftApi.addCrucibleRecipe("MB_EssenceArmor", Config.miscResources.getStackForType(ResourceType.ESSENCE_EVERLASTING_DURABILITY),
|
||||
new ItemStack(Items.leather),
|
||||
new AspectList().add(Aspect.ARMOR, 4).add(Aspect.MAGIC, 2));
|
||||
|
||||
output = Config.miscResources.getStackForType(ResourceType.ESSENCE_FICKLE_PERMANENCE);
|
||||
essenceUnstableA = ThaumcraftApi.addCrucibleRecipe("MB_EssenceUnstable", output,
|
||||
Config.propolis.getStackForType(PropolisType.UNSTABLE),
|
||||
new AspectList().add(Aspect.ENTROPY, 2).add(Aspect.EXCHANGE, 1));
|
||||
|
||||
essenceUnstableB = ThaumcraftApi.addCrucibleRecipe("MB_EssenceUnstable",output,
|
||||
new ItemStack(Blocks.netherrack),
|
||||
new AspectList().add(Aspect.ENTROPY, 8).add(Aspect.EXCHANGE, 5));
|
||||
|
||||
essenceTime = ThaumcraftApi.addCrucibleRecipe("MB_EssenceTime", Config.miscResources.getStackForType(ResourceType.ESSENCE_LOST_TIME),
|
||||
new ItemStack(Items.clock),
|
||||
new AspectList().add(Aspect.ORDER, 10).add(Aspect.VOID, 10).add(Aspect.TRAP, 4));
|
||||
|
||||
input = new ItemStack(Items.ender_pearl);
|
||||
singularityA = ThaumcraftApi.addInfusionCraftingRecipe("MB_DimensionalSingularity",
|
||||
Config.miscResources.getStackForType(ResourceType.DIMENSIONAL_SINGULARITY,3),
|
||||
5,
|
||||
new AspectList().add(Aspect.ELDRITCH, 10).add(Aspect.EXCHANGE, 20),
|
||||
new ItemStack(Blocks.gold_block), new ItemStack[] { input,
|
||||
input });
|
||||
|
||||
ItemStack in2 = new ItemStack(Items.diamond);
|
||||
singularityB = ThaumcraftApi.addInfusionCraftingRecipe("MB_DimensionalSingularity",
|
||||
Config.miscResources.getStackForType(ResourceType.DIMENSIONAL_SINGULARITY, 3),
|
||||
6,
|
||||
new AspectList().add(Aspect.ELDRITCH, 10).add(Aspect.EXCHANGE, 20).add(Aspect.VOID, 15),
|
||||
Config.propolis.getStackForType(PropolisType.UNSTABLE),
|
||||
new ItemStack[] { input, input, in2 });
|
||||
|
||||
essenceOblivion = ThaumcraftApi.addShapelessArcaneCraftingRecipe("MB_EssenceOblivion",
|
||||
Config.miscResources.getStackForType(ResourceType.ESSENCE_SCORNFUL_OBLIVION),
|
||||
new AspectList().add(Aspect.ENTROPY, 25).add(Aspect.AIR, 40).add(Aspect.ORDER, 15),
|
||||
new Object[] {
|
||||
Config.miscResources.getStackForType(ResourceType.DIMENSIONAL_SINGULARITY),
|
||||
Blocks.dragon_egg, });
|
||||
}
|
||||
|
||||
private static void setupResearch() {
|
||||
|
||||
ArrayList<Object> list;
|
||||
ItemStack input;
|
||||
IRecipe recipe;
|
||||
String category = "MAGICBEES";
|
||||
ResearchCategories.registerCategory(category, new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.ITEM_TEXTURE + "beeInfusion.png"),
|
||||
ResearchCategories.registerCategory(category, new ResourceLocation(
|
||||
CommonProxy.DOMAIN, CommonProxy.ITEM_TEXTURE + "beeInfusion.png"),
|
||||
new ResourceLocation("thaumcraft", "textures/gui/gui_researchback.png"));
|
||||
|
||||
ResearchItem rootNodeR = new ResearchItem("MB_Root", category, new AspectList(),
|
||||
ResearchItem rootNodeR = new ResearchItem("MB_Root", category,
|
||||
new AspectList(),
|
||||
0, 0, 0,
|
||||
Config.miscResources.getStackForType(ResourceType.RESEARCH_BEEINFUSION))
|
||||
.setRound().setStub().setAutoUnlock()
|
||||
.setPages(getResearchPage("MB_Root.1"), getResearchPage("MB_Root.2"))
|
||||
.registerResearchItem();
|
||||
.setRound()
|
||||
.setStub()
|
||||
.setAutoUnlock()
|
||||
.setPages(getResearchPage("MB_Root.1"), getResearchPage("MB_Root.2")).registerResearchItem();
|
||||
|
||||
list = new ArrayList<Object>(4);
|
||||
list.add(Config.miscResources.getStackForType(ResourceType.LORE_FRAGMENT));
|
||||
list.add(Config.miscResources.getStackForType(ResourceType.LORE_FRAGMENT));
|
||||
list.add(Config.miscResources.getStackForType(ResourceType.LORE_FRAGMENT));
|
||||
list.add(Config.miscResources.getStackForType(ResourceType.LORE_FRAGMENT));
|
||||
recipe = new ShapelessRecipes(new ItemStack(Config.tcMiscResource, 1, MiscResource.KNOWLEDGE_FRAGMENT.ordinal()), list);
|
||||
recipe = new ShapelessRecipes(new ItemStack(Config.tcMiscResource, 1,
|
||||
MiscResource.KNOWLEDGE_FRAGMENT.ordinal()), list);
|
||||
|
||||
ResearchItem researchFragment = new ResearchItem("MB_LoreFragment", category, new AspectList(),
|
||||
0, -3, 0,
|
||||
ResearchItem researchFragment = new ResearchItem("MB_LoreFragment", category,
|
||||
new AspectList(),
|
||||
0, -3, 1,
|
||||
Config.miscResources.getStackForType(ResourceType.LORE_FRAGMENT))
|
||||
.setPages(getResearchPage("MB_LoreFragment.1"), new ResearchPage(recipe))
|
||||
.setParents("MB_Root")
|
||||
.setStub().setAutoUnlock().setRound()
|
||||
.registerResearchItem();
|
||||
.setPages(getResearchPage("MB_LoreFragment.1"), new ResearchPage(recipe)).setParents("MB_Root")
|
||||
.setStub().setAutoUnlock().setRound().registerResearchItem();
|
||||
|
||||
ResearchItem thaumiumScoopR = new ResearchItem("MB_Scoop", category, new AspectList().add(Aspect.TOOL, 1).add(Aspect.MAGIC, 1).add(Aspect.AIR, 1),
|
||||
ResearchItem thaumiumScoopR = new ResearchItem("MB_Scoop", category,
|
||||
new AspectList().add(Aspect.TOOL, 1).add(Aspect.MAGIC, 1).add(Aspect.AIR, 1),
|
||||
-2, -3, 1,
|
||||
new ItemStack(Config.thaumiumScoop))
|
||||
.setPages(getResearchPage("MB_Scoop.1"), new ResearchPage((IArcaneRecipe)thaumScoop))
|
||||
.setParentsHidden("THAUMIUM")
|
||||
.registerResearchItem();
|
||||
.setPages(getResearchPage("MB_Scoop.1"), new ResearchPage((IArcaneRecipe) thaumScoop))
|
||||
.setParentsHidden("THAUMIUM").registerResearchItem();
|
||||
|
||||
ResearchItem thaumiumGrafterR = new ResearchItem("MB_Grafter", category, new AspectList().add(Aspect.TOOL, 2).add(Aspect.TREE, 1).add(Aspect.GREED, 1),
|
||||
-2, -1, 4,
|
||||
ResearchItem thaumiumGrafterR = new ResearchItem("MB_Grafter", category,
|
||||
new AspectList().add(Aspect.TOOL, 1).add(Aspect.TREE, 1).add(Aspect.GREED, 1),
|
||||
-2, -1, 2,
|
||||
new ItemStack(Config.thaumiumGrafter))
|
||||
.setPages(getResearchPage("MB_Grafter.1"), new ResearchPage((IArcaneRecipe)thaumGrafter))
|
||||
.setParents("MB_Scoop")
|
||||
.registerResearchItem();
|
||||
.setPages(getResearchPage("MB_Grafter.1"), new ResearchPage((IArcaneRecipe) thaumGrafter))
|
||||
.setParents("MB_Scoop").registerResearchItem();
|
||||
|
||||
ResearchItem frameMagicR = new ResearchItem("MB_FrameMagic", category, new AspectList().add(Aspect.TOOL, 2).add(Aspect.ARMOR, 1),
|
||||
-2, 1, 2,
|
||||
ResearchItem frameMagicR = new ResearchItem("MB_FrameMagic", category,
|
||||
new AspectList().add(Aspect.TOOL, 1).add(Aspect.ARMOR, 1),
|
||||
-2, 1, 1,
|
||||
new ItemStack(Config.hiveFrameMagic))
|
||||
.setPages(getResearchPage("MB_FrameMagic"), new ResearchPage((IArcaneRecipe)frameMagic))
|
||||
.registerResearchItem();
|
||||
.setPages(getResearchPage("MB_FrameMagic"), new ResearchPage((IArcaneRecipe) frameMagic))
|
||||
.registerResearchItem();
|
||||
|
||||
input = new ItemStack(Config.hiveFrameMagic);
|
||||
list = new ArrayList<Object>(2);
|
||||
@@ -391,125 +407,138 @@ public class ThaumcraftHelper
|
||||
list.add(input);
|
||||
recipe = new ShapelessRecipes(new ItemStack(Config.hiveFrameGentle), list);
|
||||
|
||||
ResearchItem essenceFalseLifeR = new ResearchItem("MB_EssenceLife", category, new AspectList().add(Aspect.LIFE, 2).add(Aspect.MAGIC, 1),
|
||||
2, -1, 2,
|
||||
ResearchItem essenceFalseLifeR = new ResearchItem("MB_EssenceLife", category,
|
||||
new AspectList().add(Aspect.LIFE, 1).add(Aspect.MAGIC, 1),
|
||||
2, -1, 1,
|
||||
Config.miscResources.getStackForType(ResourceType.ESSENCE_FALSE_LIFE))
|
||||
.setPages(getResearchPage("MB_EssenceLife.1"), new ResearchPage((CrucibleRecipe)essenceLife), new ResearchPage(recipe))
|
||||
.setParentsHidden("CRUCIBLE")
|
||||
.registerResearchItem();
|
||||
.setPages(getResearchPage("MB_EssenceLife.1"),
|
||||
new ResearchPage((CrucibleRecipe) essenceLife),
|
||||
new ResearchPage(recipe)).setParentsHidden("CRUCIBLE")
|
||||
.registerResearchItem();
|
||||
|
||||
list = new ArrayList<Object>(2);
|
||||
list.add(Config.miscResources.getStackForType(ResourceType.ESSENCE_EVERLASTING_DURABILITY));
|
||||
list.add(input);
|
||||
recipe = new ShapelessRecipes(new ItemStack(Config.hiveFrameResilient), list);
|
||||
|
||||
ResearchItem essenceDurabilityR = new ResearchItem("MB_EssenceArmor", category, new AspectList().add(Aspect.ARMOR, 1).add(Aspect.MAGIC, 1),
|
||||
5, 0, 3,
|
||||
ResearchItem essenceDurabilityR = new ResearchItem("MB_EssenceArmor", category,
|
||||
new AspectList().add(Aspect.ARMOR, 1).add(Aspect.MAGIC, 1),
|
||||
5, 0, 2,
|
||||
Config.miscResources.getStackForType(ResourceType.ESSENCE_EVERLASTING_DURABILITY))
|
||||
.setPages(getResearchPage("MB_EssenceArmor.1"), new ResearchPage((CrucibleRecipe)essenceArmor), new ResearchPage(recipe))
|
||||
.setParents("MB_EssenceLife")
|
||||
.registerResearchItem();
|
||||
.setPages(getResearchPage("MB_EssenceArmor.1"),
|
||||
new ResearchPage((CrucibleRecipe) essenceArmor),
|
||||
new ResearchPage(recipe)).setParents("MB_EssenceLife")
|
||||
.registerResearchItem();
|
||||
|
||||
list = new ArrayList<Object>(2);
|
||||
list.add(Config.miscResources.getStackForType(ResourceType.ESSENCE_FICKLE_PERMANENCE));
|
||||
list.add(Config.miscResources .getStackForType(ResourceType.ESSENCE_FICKLE_PERMANENCE));
|
||||
list.add(input);
|
||||
recipe = new ShapelessRecipes(new ItemStack(Config.hiveFrameMetabolic), list);
|
||||
|
||||
ResearchItem essenceUnstableR = new ResearchItem("MB_EssenceUnstable", category, new AspectList().add(Aspect.ENTROPY, 2).add(Aspect.ORDER, 1),
|
||||
3, 1, 4,
|
||||
ResearchItem essenceUnstableR = new ResearchItem( "MB_EssenceUnstable", category,
|
||||
new AspectList().add(Aspect.ENTROPY, 1).add(Aspect.ORDER, 1),
|
||||
3, 1, 2,
|
||||
Config.miscResources.getStackForType(ResourceType.ESSENCE_FICKLE_PERMANENCE))
|
||||
.setPages(getResearchPage("MB_EssenceUnstable.1"), new ResearchPage((CrucibleRecipe)essenceUnstableA),
|
||||
new ResearchPage((CrucibleRecipe)essenceUnstableB), new ResearchPage(recipe))
|
||||
.setParents("MB_EssenceLife")
|
||||
.setConcealed()
|
||||
.registerResearchItem();
|
||||
.setPages(getResearchPage("MB_EssenceUnstable.1"),
|
||||
new ResearchPage((CrucibleRecipe) essenceUnstableA),
|
||||
new ResearchPage((CrucibleRecipe) essenceUnstableB),
|
||||
new ResearchPage(recipe))
|
||||
.setParents("MB_EssenceLife")
|
||||
.setConcealed()
|
||||
.registerResearchItem();
|
||||
|
||||
list = new ArrayList<Object>(2);
|
||||
list.add(Config.miscResources.getStackForType(ResourceType.ESSENCE_SHALLOW_GRAVE));
|
||||
list.add(Config.miscResources .getStackForType(ResourceType.ESSENCE_SHALLOW_GRAVE));
|
||||
list.add(input);
|
||||
recipe = new ShapelessRecipes(new ItemStack(Config.hiveFrameNecrotic), list);
|
||||
|
||||
ResearchItem essenceShallowGraveR = new ResearchItem("MB_EssenceDeath", category, new AspectList().add(Aspect.DEATH, 2).add(Aspect.MAGIC, 1),
|
||||
2, 3, 2,
|
||||
Config.miscResources.getStackForType(ResourceType.ESSENCE_SHALLOW_GRAVE))
|
||||
.setPages(getResearchPage("MB_EssenceDeath.1"), new ResearchPage((CrucibleRecipe)essenceDeath), new ResearchPage(recipe))
|
||||
.setParents("MB_EssenceUnstable")
|
||||
.setConcealed()
|
||||
.registerResearchItem();
|
||||
ResearchItem essenceShallowGraveR = new ResearchItem("MB_EssenceDeath", category,
|
||||
new AspectList().add(Aspect.DEATH, 1).add(Aspect.MAGIC, 1),
|
||||
2, 3, 1,
|
||||
Config.miscResources .getStackForType(ResourceType.ESSENCE_SHALLOW_GRAVE))
|
||||
.setPages(getResearchPage("MB_EssenceDeath.1"),
|
||||
new ResearchPage((CrucibleRecipe) essenceDeath),
|
||||
new ResearchPage(recipe))
|
||||
.setParents("MB_EssenceUnstable")
|
||||
.setConcealed()
|
||||
.registerResearchItem();
|
||||
|
||||
list = new ArrayList<Object>(2);
|
||||
list.add(Config.miscResources.getStackForType(ResourceType.ESSENCE_LOST_TIME));
|
||||
list.add(input);
|
||||
recipe = new ShapelessRecipes(new ItemStack(Config.hiveFrameTemporal), list);
|
||||
|
||||
ResearchItem essenceTimeR = new ResearchItem("MB_EssenceTime", category, new AspectList().add((Aspect)aspectTime, 2).add(Aspect.MAGIC, 1),
|
||||
0, 2, 5,
|
||||
ResearchItem essenceTimeR = new ResearchItem("MB_EssenceTime", category,
|
||||
new AspectList().add((Aspect) aspectTime, 1).add(Aspect.MAGIC, 1),
|
||||
0, 2, 2,
|
||||
Config.miscResources.getStackForType(ResourceType.ESSENCE_LOST_TIME))
|
||||
.setPages(getResearchPage("MB_EssenceTime.1"), new ResearchPage((CrucibleRecipe)essenceTime), new ResearchPage(recipe))
|
||||
.setParents("MB_EssenceUnstable")
|
||||
.setConcealed()
|
||||
.registerResearchItem();
|
||||
.setPages(getResearchPage("MB_EssenceTime.1"),
|
||||
new ResearchPage((CrucibleRecipe) essenceTime),
|
||||
new ResearchPage(recipe))
|
||||
.setParents("MB_EssenceUnstable")
|
||||
.setConcealed()
|
||||
.registerResearchItem();
|
||||
|
||||
ResearchItem singularityR = new ResearchItem("MB_DimensionalSingularity", category, new AspectList().add(Aspect.ELDRITCH, 2).add((Aspect)aspectTime, 1).add(Aspect.VOID, 1),
|
||||
-1, 4, 5,
|
||||
ResearchItem singularityR = new ResearchItem("MB_DimensionalSingularity", category,
|
||||
new AspectList().add(Aspect.ELDRITCH, 1).add((Aspect) aspectTime, 1).add(Aspect.VOID, 1),
|
||||
-1, 4, 3,
|
||||
Config.miscResources.getStackForType(ResourceType.DIMENSIONAL_SINGULARITY))
|
||||
.setPages(getResearchPage("MB_DimensionalSingularity.1"), new ResearchPage((InfusionRecipe)singularityA), new ResearchPage((InfusionRecipe)singularityB))
|
||||
.setParents("MB_FrameMagic", "MB_EssenceTime", "MB_EssenceDeath")
|
||||
.setConcealed()
|
||||
.setSpecial()
|
||||
.registerResearchItem();
|
||||
.setPages(getResearchPage("MB_DimensionalSingularity.1"),
|
||||
new ResearchPage((InfusionRecipe) singularityA),
|
||||
new ResearchPage((InfusionRecipe) singularityB))
|
||||
.setParents("MB_FrameMagic", "MB_EssenceTime", "MB_EssenceDeath")
|
||||
.setConcealed()
|
||||
.setSpecial()
|
||||
.registerResearchItem();
|
||||
|
||||
list = new ArrayList<Object>(2);
|
||||
list.add(Config.miscResources.getStackForType(ResourceType.ESSENCE_SCORNFUL_OBLIVION));
|
||||
list.add(ItemInterface.getItemStack("frameProven"));
|
||||
recipe = new ShapelessRecipes(new ItemStack(Config.hiveFrameOblivion), list);
|
||||
|
||||
ResearchItem essenceOblivionR = new ResearchItem("MB_EssenceOblivion", category, new AspectList().add(Aspect.VOID, 2).add(Aspect.HUNGER, 1).add((Aspect)aspectTime, 1),
|
||||
-3, 3, 5,
|
||||
ResearchItem essenceOblivionR = new ResearchItem("MB_EssenceOblivion", category,
|
||||
new AspectList().add(Aspect.VOID, 1).add(Aspect.HUNGER, 1).add((Aspect) aspectTime, 1),
|
||||
-3, 3, 3,
|
||||
Config.miscResources.getStackForType(ResourceType.ESSENCE_SCORNFUL_OBLIVION))
|
||||
.setPages(getResearchPage("MB_EssenceOblivion.1"), new ResearchPage((IArcaneRecipe)essenceOblivion), new ResearchPage(recipe))
|
||||
.setParents("MB_DimensionalSingularity")
|
||||
.setConcealed()
|
||||
.registerResearchItem();
|
||||
.setPages(getResearchPage("MB_EssenceOblivion.1"),
|
||||
new ResearchPage((IArcaneRecipe) essenceOblivion),
|
||||
new ResearchPage(recipe))
|
||||
.setParents("MB_DimensionalSingularity").setConcealed()
|
||||
.registerResearchItem();
|
||||
|
||||
ResearchItem visAuraProviderR = new ResearchItem("MB_VisAuraProvider", category,
|
||||
new AspectList().add(Aspect.MAGIC, 1).add(Aspect.ENERGY, 1).add(Aspect.AURA, 1),
|
||||
-5, 5, 3,
|
||||
new ItemStack(Config.visAuraProvider))
|
||||
.setPages(getResearchPage("MB_VisAuraProvider.1"),
|
||||
new ResearchPage((IArcaneRecipe) visAuraProvider))
|
||||
.setParentsHidden("NodeRelay")
|
||||
.registerResearchItem();
|
||||
}
|
||||
|
||||
private static ResearchPage getResearchPage(String ident)
|
||||
{
|
||||
// Helps get around all the stupid XML Doctype restrictions.
|
||||
return new ResearchPage(LocalizationManager.getLocalizedString("tc.research_page." + ident)
|
||||
.replaceAll("##lineBreak##", "<BR>")
|
||||
.replaceAll("##horizontalRule##", "<LINE>")
|
||||
.replaceAll("##img##", "<IMG>")
|
||||
.replaceAll("##/img##", "</IMG>"));
|
||||
private static ResearchPage getResearchPage(String ident) {
|
||||
return new ResearchPage(LocalizationManager.getLocalizedString("tc.research_page." + ident));
|
||||
}
|
||||
|
||||
private static void setupItemAspects()
|
||||
{
|
||||
private static void setupItemAspects() {
|
||||
ItemStack item;
|
||||
AspectList list;
|
||||
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Items.clock), new AspectList(new ItemStack(Items.clock)).add(
|
||||
(Aspect)aspectTime, 4));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Items.repeater), new AspectList(new ItemStack(Items.repeater)).add(
|
||||
(Aspect)aspectTime, 2));
|
||||
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Items.clock), new AspectList(new ItemStack(Items.clock)).add((Aspect) aspectTime, 4));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Items.repeater), new AspectList(new ItemStack(Items.repeater)).add((Aspect) aspectTime, 2));
|
||||
|
||||
list = new AspectList(new ItemStack(Blocks.log));
|
||||
for (int i = 1; i <= 8; i++)
|
||||
{
|
||||
for (int i = 1; i <= 8; i++) {
|
||||
item = ItemInterface.getItemStack("log" + i);
|
||||
if (item != null)
|
||||
{
|
||||
if (item != null) {
|
||||
ThaumcraftApi.registerObjectTag(item, list);
|
||||
}
|
||||
}
|
||||
|
||||
list = new AspectList(new ItemStack(Blocks.planks));
|
||||
for (int i = 1; i <= 2; i++)
|
||||
{
|
||||
for (int i = 1; i <= 2; i++) {
|
||||
item = ItemInterface.getItemStack("planks" + i);
|
||||
if (item != null)
|
||||
{
|
||||
if (item != null) {
|
||||
ThaumcraftApi.registerObjectTag(item, list);
|
||||
}
|
||||
}
|
||||
@@ -543,18 +572,15 @@ public class ThaumcraftHelper
|
||||
item = ForestryBlock.saplingGE.getItemStack();
|
||||
ThaumcraftApi.registerObjectTag(item, list);
|
||||
|
||||
list = new AspectList()/*.add(Aspect.SEED, 1)*/.add(Aspect.PLANT, 1);
|
||||
list = new AspectList()/* .add(Aspect.SEED, 1) */.add(Aspect.PLANT, 1);
|
||||
item = ForestryItem.pollenFertile.getItemStack();
|
||||
ThaumcraftApi.registerObjectTag(item, list);
|
||||
|
||||
list = new AspectList().add(Aspect.CRYSTAL, 1).add(Aspect.EARTH, 2);
|
||||
item = ForestryItem.apatite.getItemStack();
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(item.getItem(), 1, ForestryHelper.BlockResource.APATITE.ordinal()),
|
||||
list.copy()/*.add(Aspect.STONE, 2)*/);
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(item.getItem(), 1,ForestryHelper.BlockResource.APATITE.ordinal()), list.copy());
|
||||
item = ForestryItem.apatite.getItemStack();
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(item.getItem(), 1, item.getItemDamage()),
|
||||
list.copy().add(Aspect.CRYSTAL, 2));
|
||||
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(item.getItem(), 1, item.getItemDamage()), list.copy().add(Aspect.CRYSTAL, 2));
|
||||
|
||||
list = new AspectList().add(Aspect.MOTION, 2).add(Aspect.FLIGHT, 1);
|
||||
item = ItemInterface.getItemStack("beeDroneGE");
|
||||
@@ -585,47 +611,30 @@ public class ThaumcraftHelper
|
||||
|
||||
list = new AspectList().add(Aspect.SLIME, 1);
|
||||
item = ItemInterface.getItemStack("propolis");
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(item.getItem(), 1, ForestryHelper.Propolis.NORMAL.ordinal()),
|
||||
list);
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(item.getItem(), 1, ForestryHelper.Propolis.SILKY.ordinal()),
|
||||
list.copy().add(Aspect.SLIME, 2));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(item.getItem(), 1, ForestryHelper.Propolis.PULSATING.ordinal()),
|
||||
list.copy().add(Aspect.ELDRITCH, 2));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Config.propolis, 1, PropolisType.UNSTABLE.ordinal()),
|
||||
list.copy().add(Aspect.ENTROPY, 1).add(Aspect.EXCHANGE, 1));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Config.propolis, 1, PropolisType.AIR.ordinal()),
|
||||
list.copy().add(Aspect.AIR, 2));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Config.propolis, 1, PropolisType.WATER.ordinal()),
|
||||
list.copy().add(Aspect.WATER, 2));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Config.propolis, 1, PropolisType.FIRE.ordinal()),
|
||||
list.copy().add(Aspect.FIRE, 2));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Config.propolis, 1, PropolisType.EARTH.ordinal()),
|
||||
list.copy().add(Aspect.EARTH, 2));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Config.propolis, 1, PropolisType.ORDER.ordinal()),
|
||||
list.copy().add(Aspect.ORDER, 2));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Config.propolis, 1, PropolisType.CHAOS.ordinal()),
|
||||
list.copy().add(Aspect.ENTROPY, 2));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(item.getItem(), 1, ForestryHelper.Propolis.NORMAL.ordinal()), list);
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(item.getItem(), 1, ForestryHelper.Propolis.SILKY.ordinal()), list.copy().add(Aspect.SLIME, 2));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(item.getItem(), 1, ForestryHelper.Propolis.PULSATING.ordinal()), list.copy().add(Aspect.ELDRITCH, 2));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Config.propolis, 1, PropolisType.UNSTABLE.ordinal()), list.copy().add(Aspect.ENTROPY, 1).add(Aspect.EXCHANGE, 1));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Config.propolis, 1, PropolisType.AIR.ordinal()), list.copy().add(Aspect.AIR, 2));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Config.propolis, 1, PropolisType.WATER.ordinal()), list.copy().add(Aspect.WATER, 2));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Config.propolis, 1, PropolisType.FIRE.ordinal()), list.copy().add(Aspect.FIRE, 2));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Config.propolis, 1, PropolisType.EARTH.ordinal()), list.copy().add(Aspect.EARTH, 2));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Config.propolis, 1, PropolisType.ORDER.ordinal()), list.copy().add(Aspect.ORDER, 2));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Config.propolis, 1, PropolisType.CHAOS.ordinal()), list.copy().add(Aspect.ENTROPY, 2));
|
||||
|
||||
list = new AspectList().add(Aspect.PLANT, 2);
|
||||
item = ItemInterface.getItemStack("pollen");
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(item.getItem(), 1, ForestryHelper.Pollen.NORMAL.ordinal()), list);
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(item.getItem(), 1, ForestryHelper.Pollen.CRYSTALLINE.ordinal()),
|
||||
list.copy()/*.add(Aspect.ICE, 2)*/);
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Config.pollen, 1, PollenType.UNUSUAL.ordinal()),
|
||||
list.copy().add(Aspect.MAGIC, 2));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Config.pollen, 1, PollenType.PHASED.ordinal()),
|
||||
list.copy().add((Aspect)aspectTime, 2));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(item.getItem(), 1, ForestryHelper.Pollen.CRYSTALLINE.ordinal()), list.copy());
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Config.pollen, 1, PollenType.UNUSUAL.ordinal()), list.copy().add(Aspect.MAGIC, 2));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Config.pollen, 1, PollenType.PHASED.ordinal()), list.copy().add((Aspect) aspectTime, 2));
|
||||
|
||||
list = new AspectList().add(Aspect.ORDER, 1);
|
||||
item = ItemInterface.getItemStack("beeswax");
|
||||
ThaumcraftApi.registerObjectTag(item, new int[] { item.getItemDamage() }, list.copy().add(Aspect.ORDER,
|
||||
2));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Config.wax, 1, WaxType.MAGIC.ordinal()),
|
||||
list.copy().add(Aspect.MAGIC, 2));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Config.wax, 1, WaxType.SOUL.ordinal()),
|
||||
list.copy().add(Aspect.SOUL, 2));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Config.wax, 1, WaxType.AMNESIC.ordinal()),
|
||||
list.copy().add(Aspect.MIND, 2));
|
||||
ThaumcraftApi.registerObjectTag(item, new int[] { item.getItemDamage() }, list.copy().add(Aspect.ORDER, 2));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Config.wax, 1, WaxType.MAGIC.ordinal()), list.copy().add(Aspect.MAGIC, 2));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Config.wax, 1, WaxType.SOUL.ordinal()), list.copy().add(Aspect.SOUL, 2));
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Config.wax, 1, WaxType.AMNESIC.ordinal()), list.copy().add(Aspect.MIND, 2));
|
||||
|
||||
list = new AspectList().add(Aspect.EXCHANGE, 2).add(Aspect.LIFE, 2);
|
||||
item = ItemInterface.getItemStack("honeyDrop");
|
||||
@@ -653,7 +662,6 @@ public class ThaumcraftHelper
|
||||
ThaumcraftApi.registerObjectTag(item, new int[] { item.getItemDamage() }, new AspectList().add(Aspect.ARMOR, 6));
|
||||
|
||||
item = Config.miscResources.getStackForType(ResourceType.ESSENCE_LOST_TIME);
|
||||
ThaumcraftApi.registerObjectTag(item, new int[] { item.getItemDamage() }, new AspectList().add(Aspect.VOID,
|
||||
6).add((Aspect)aspectTime, 8));
|
||||
ThaumcraftApi.registerObjectTag(item, new int[] { item.getItemDamage() }, new AspectList().add(Aspect.VOID, 6).add((Aspect) aspectTime, 8));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package magicbees.main.utils.error;
|
||||
|
||||
public class InvalidEventTypeIndexException extends RuntimeException {
|
||||
private static final long serialVersionUID = 8920019214439088440L;
|
||||
|
||||
public InvalidEventTypeIndexException(String message) {
|
||||
this(message, null);
|
||||
}
|
||||
|
||||
public InvalidEventTypeIndexException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package magicbees.main.utils.net;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
||||
import magicbees.main.utils.ChunkCoords;
|
||||
import magicbees.main.utils.LogHelper;
|
||||
import magicbees.main.utils.net.NetworkEventHandler.EventType;
|
||||
import magicbees.tileentity.AuraCharges;
|
||||
import magicbees.tileentity.ITileEntityAuraCharged;
|
||||
|
||||
public class EventAuraChargeUpdate extends EventCoords {
|
||||
|
||||
private int flags;
|
||||
|
||||
public EventAuraChargeUpdate(ChunkCoords position, AuraCharges auraCharges) {
|
||||
super(EventType.AURA_CHARGE_UPDATE, position);
|
||||
flags = auraCharges.writeToFlags();
|
||||
}
|
||||
|
||||
public EventAuraChargeUpdate(DataInputStream byteStream) {
|
||||
super(EventType.FLAGS_UPDATE, byteStream);
|
||||
|
||||
this.readDataFromInputStream(byteStream);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeDataToOutputStream(DataOutputStream byteStream) {
|
||||
super.writeDataToOutputStream(byteStream);
|
||||
|
||||
try {
|
||||
byteStream.writeInt(flags);
|
||||
}
|
||||
catch (IOException e) {
|
||||
LogHelper.error("Could not write EventAuraChargeUpdate data to stream.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readDataFromInputStream(DataInputStream byteStream) {
|
||||
super.readDataFromInputStream(byteStream);
|
||||
|
||||
try {
|
||||
this.flags = byteStream.readInt();
|
||||
}
|
||||
catch (IOException e) {
|
||||
LogHelper.error("Could not read EventAuraChargeUpdate data from stream.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(EntityPlayerMP player) {
|
||||
TileEntity tile = FMLClientHandler.instance().getClient().theWorld.getTileEntity(getCoords().x, getCoords().y, getCoords().z);
|
||||
|
||||
if (tile != null && tile instanceof ITileEntityAuraCharged) {
|
||||
AuraCharges auraCharges = ((ITileEntityAuraCharged) tile).getAuraCharges();
|
||||
auraCharges.readFromFlags(flags);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package magicbees.main.utils.net;
|
||||
|
||||
import forestry.core.proxy.Proxies;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import magicbees.main.utils.LogHelper;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
|
||||
public class EventBase {
|
||||
|
||||
private NetworkEventHandler.EventType eventType;
|
||||
|
||||
public EventBase() {
|
||||
this.eventType = NetworkEventHandler.EventType.UNKNOWN;
|
||||
}
|
||||
|
||||
public EventBase(NetworkEventHandler.EventType type) {
|
||||
this.eventType = type;
|
||||
}
|
||||
|
||||
public FMLProxyPacket getPacket() {
|
||||
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
|
||||
DataOutputStream data = new DataOutputStream(bytes);
|
||||
|
||||
try {
|
||||
data.writeInt(eventType.ordinal());
|
||||
writeDataToOutputStream(data);
|
||||
}
|
||||
catch (IOException e) {
|
||||
LogHelper.error("Could not write EventBase data.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return new FMLProxyPacket(Unpooled.wrappedBuffer(bytes.toByteArray()), NetworkEventHandler.CHANNEL_NAME);
|
||||
}
|
||||
|
||||
public void process(EntityPlayerMP player) {
|
||||
|
||||
}
|
||||
|
||||
protected void writeDataToOutputStream(DataOutputStream data) {
|
||||
return;
|
||||
}
|
||||
|
||||
protected void readDataFromInputStream(DataInputStream data) {
|
||||
return;
|
||||
}
|
||||
|
||||
protected ItemStack readItemStackFromData(DataInputStream data) throws IOException {
|
||||
ItemStack itemstack = null;
|
||||
|
||||
String itemName = data.readUTF();
|
||||
|
||||
if (!itemName.isEmpty()) {
|
||||
Item item = GameData.getItemRegistry().getRaw(itemName);
|
||||
byte stackSize = data.readByte();
|
||||
short meta = data.readShort();
|
||||
itemstack = new ItemStack(item, stackSize, meta);
|
||||
|
||||
if (item.isDamageable() || Proxies.common.needsTagCompoundSynched(item)) {
|
||||
itemstack.stackTagCompound = this.readNBTTagCompound(data);
|
||||
}
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
protected void writeItemStackToData(ItemStack itemstack, DataOutputStream data) throws IOException {
|
||||
if (itemstack == null) {
|
||||
data.writeUTF("");
|
||||
} else {
|
||||
data.writeUTF(GameData.getItemRegistry().getNameForObject(itemstack.getItem()));
|
||||
data.writeByte(itemstack.stackSize);
|
||||
data.writeShort(itemstack.getItemDamage());
|
||||
|
||||
if (itemstack.getItem().isDamageable() || Proxies.common.needsTagCompoundSynched(itemstack.getItem())) {
|
||||
this.writeNBTTagCompound(itemstack.stackTagCompound, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected NBTTagCompound readNBTTagCompound(DataInputStream data) throws IOException {
|
||||
|
||||
short length = data.readShort();
|
||||
|
||||
if (length < 0) {
|
||||
return null;
|
||||
} else {
|
||||
byte[] compressed = new byte[length];
|
||||
data.readFully(compressed);
|
||||
return CompressedStreamTools.readCompressed(new ByteArrayInputStream(compressed));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void writeNBTTagCompound(NBTTagCompound nbttagcompound, DataOutputStream data) throws IOException {
|
||||
|
||||
if (nbttagcompound == null) {
|
||||
data.writeShort(-1);
|
||||
} else {
|
||||
byte[] compressed = CompressedStreamTools.compress(nbttagcompound);
|
||||
data.writeShort((short) compressed.length);
|
||||
data.write(compressed);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package magicbees.main.utils.net;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import magicbees.main.utils.ChunkCoords;
|
||||
import magicbees.main.utils.LogHelper;
|
||||
|
||||
public class EventCoords extends EventBase {
|
||||
|
||||
private ChunkCoords coords;
|
||||
|
||||
public EventCoords(NetworkEventHandler.EventType type, ChunkCoords position) {
|
||||
super(type);
|
||||
this.coords = position;
|
||||
}
|
||||
|
||||
public EventCoords(NetworkEventHandler.EventType type, DataInputStream byteStream) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
public ChunkCoords getCoords() {
|
||||
return this.coords;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeDataToOutputStream(DataOutputStream byteStream) {
|
||||
super.writeDataToOutputStream(byteStream);
|
||||
|
||||
try {
|
||||
byteStream.writeInt(coords.dimension);
|
||||
byteStream.writeInt(coords.x);
|
||||
byteStream.writeInt(coords.y);
|
||||
byteStream.writeInt(coords.z);
|
||||
}
|
||||
catch (IOException e) {
|
||||
LogHelper.error("Could not write EventCoords data to stream.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readDataFromInputStream(DataInputStream byteStream) {
|
||||
super.readDataFromInputStream(byteStream);
|
||||
|
||||
try {
|
||||
int dim = byteStream.readInt();
|
||||
int x = byteStream.readInt();
|
||||
int y = byteStream.readInt();
|
||||
int z = byteStream.readInt();
|
||||
|
||||
this.coords = new ChunkCoords(dim, x, y, z);
|
||||
}
|
||||
catch (IOException e) {
|
||||
LogHelper.error("Could not read EventCoords data from stream.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package magicbees.main.utils.net;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import magicbees.main.utils.ChunkCoords;
|
||||
import magicbees.main.utils.LogHelper;
|
||||
import magicbees.main.utils.net.NetworkEventHandler.EventType;
|
||||
import magicbees.tileentity.ITileEntityFlags;
|
||||
|
||||
public class EventFlagsUpdate extends EventCoords {
|
||||
|
||||
private int[] flags;
|
||||
|
||||
public EventFlagsUpdate(ChunkCoords position, int[] flagValues) {
|
||||
super(EventType.FLAGS_UPDATE, position);
|
||||
flags = flagValues;
|
||||
}
|
||||
|
||||
public EventFlagsUpdate(DataInputStream byteStream) {
|
||||
super(EventType.FLAGS_UPDATE, byteStream);
|
||||
|
||||
this.readDataFromInputStream(byteStream);
|
||||
}
|
||||
|
||||
public int[] getFlags() {
|
||||
return flags;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeDataToOutputStream(DataOutputStream byteStream) {
|
||||
super.writeDataToOutputStream(byteStream);
|
||||
|
||||
try {
|
||||
byteStream.writeByte(flags.length);
|
||||
for (int index = 0; index < flags.length; ++index) {
|
||||
byteStream.writeInt(flags[index]);
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
LogHelper.error("Could not write EventFlagsUpdate data to stream.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readDataFromInputStream(DataInputStream byteStream) {
|
||||
super.readDataFromInputStream(byteStream);
|
||||
|
||||
try {
|
||||
byte length = byteStream.readByte();
|
||||
|
||||
this.flags = new int[length];
|
||||
for (int index = 0; index < length; ++index) {
|
||||
flags[index] = byteStream.readInt();
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
LogHelper.error("Could not read EventFlagsUpdate data from stream.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(EntityPlayerMP player) {
|
||||
TileEntity tile = FMLClientHandler.instance().getClient().theWorld.getTileEntity(getCoords().x, getCoords().y, getCoords().z);
|
||||
|
||||
if (tile != null && tile instanceof ITileEntityFlags) {
|
||||
((ITileEntityFlags) tile).setFlags(this.flags);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package magicbees.main.utils.net;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import magicbees.main.utils.ChunkCoords;
|
||||
import magicbees.main.utils.LogHelper;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class EventInventoryUpdate extends EventCoords {
|
||||
|
||||
private int slotIndex;
|
||||
private ItemStack itemStack;
|
||||
|
||||
public EventInventoryUpdate(ChunkCoords position, int slot, ItemStack item) {
|
||||
super(NetworkEventHandler.EventType.INVENTORY_UPDATE, position);
|
||||
|
||||
this.slotIndex = slot;
|
||||
this.itemStack = item;
|
||||
}
|
||||
|
||||
public EventInventoryUpdate(DataInputStream byteStream) {
|
||||
super(NetworkEventHandler.EventType.INVENTORY_UPDATE, byteStream);
|
||||
|
||||
this.readDataFromInputStream(byteStream);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeDataToOutputStream(DataOutputStream byteStream) {
|
||||
super.writeDataToOutputStream(byteStream);
|
||||
|
||||
try {
|
||||
byteStream.writeInt(this.slotIndex);
|
||||
this.writeItemStackToData(this.itemStack, byteStream);
|
||||
} catch (IOException e) {
|
||||
LogHelper.error("Could not write EventInventoryUpdate to byte stream.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readDataFromInputStream(DataInputStream byteStream) {
|
||||
super.readDataFromInputStream(byteStream);
|
||||
|
||||
try {
|
||||
this.slotIndex = byteStream.readInt();
|
||||
this.itemStack = this.readItemStackFromData(byteStream);
|
||||
} catch (IOException e) {
|
||||
LogHelper.error("Could not read EventInventoryUpdate to byte stream.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(EntityPlayerMP player) {
|
||||
TileEntity tile = FMLClientHandler.instance().getClient().theWorld.getTileEntity(getCoords().x, getCoords().y, getCoords().z);
|
||||
|
||||
if (tile != null && tile instanceof IInventory) {
|
||||
((IInventory) tile).setInventorySlotContents(slotIndex, itemStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package magicbees.main.utils.net;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.ByteBufInputStream;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import magicbees.main.MagicBees;
|
||||
import magicbees.main.utils.ChunkCoords;
|
||||
import magicbees.main.utils.LogHelper;
|
||||
import magicbees.main.utils.VersionInfo;
|
||||
import magicbees.main.utils.error.InvalidEventTypeIndexException;
|
||||
import magicbees.tileentity.AuraCharges;
|
||||
import magicbees.tileentity.ITileEntityAuraCharged;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.NetHandlerPlayServer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.network.FMLEventChannel;
|
||||
import cpw.mods.fml.common.network.FMLNetworkEvent.ClientCustomPacketEvent;
|
||||
import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
||||
|
||||
public class NetworkEventHandler {
|
||||
|
||||
public static final String CHANNEL_NAME = VersionInfo.ModName;
|
||||
|
||||
public static NetworkEventHandler getInstance() {
|
||||
return MagicBees.object.netHandler;
|
||||
}
|
||||
|
||||
public enum EventType {
|
||||
UNKNOWN,
|
||||
INVENTORY_UPDATE,
|
||||
FLAGS_UPDATE,
|
||||
AURA_CHARGE_UPDATE
|
||||
;
|
||||
}
|
||||
|
||||
private FMLEventChannel channel;
|
||||
|
||||
public NetworkEventHandler() {
|
||||
channel = NetworkRegistry.INSTANCE.newEventDrivenChannel(CHANNEL_NAME);
|
||||
channel.register(this);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPacket(ServerCustomPacketEvent event) {
|
||||
this.parseAndDispatchPacket(event.packet.payload(), ((NetHandlerPlayServer)event.handler).playerEntity);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPacket(ClientCustomPacketEvent event) {
|
||||
this.parseAndDispatchPacket(event.packet.payload(), null);
|
||||
}
|
||||
|
||||
public void sendInventoryUpdate(TileEntity entity, int slotIndex, ItemStack itemStack) {
|
||||
EventInventoryUpdate event = new EventInventoryUpdate(new ChunkCoords(entity), slotIndex, itemStack);
|
||||
FMLProxyPacket packet = event.getPacket();
|
||||
|
||||
sendPacket(packet);
|
||||
}
|
||||
|
||||
public void sendFlagsUpdate(TileEntity entity, int[] flags) {
|
||||
EventFlagsUpdate event = new EventFlagsUpdate(new ChunkCoords(entity), flags);
|
||||
FMLProxyPacket packet = event.getPacket();
|
||||
|
||||
sendPacket(packet);
|
||||
}
|
||||
|
||||
public <T extends TileEntity & ITileEntityAuraCharged> void sendAuraChargeUpdate(T entity, AuraCharges auraCharges) {
|
||||
EventAuraChargeUpdate event = new EventAuraChargeUpdate(new ChunkCoords(entity), auraCharges);
|
||||
FMLProxyPacket packet = event.getPacket();
|
||||
|
||||
sendPacket(packet);
|
||||
}
|
||||
|
||||
private void sendPacket(FMLProxyPacket packet) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
|
||||
channel.sendToAll(packet);
|
||||
}
|
||||
else {
|
||||
channel.sendToServer(packet);
|
||||
}
|
||||
}
|
||||
|
||||
private void parseAndDispatchPacket(ByteBuf packetPayload, EntityPlayerMP player) {
|
||||
try {
|
||||
DataInputStream data = new DataInputStream(new ByteBufInputStream(packetPayload));
|
||||
|
||||
processEventData(data, player);
|
||||
|
||||
data.close();
|
||||
} catch (IOException e) {
|
||||
LogHelper.info("DataInputStream had a problem closing. Good for it.");
|
||||
//e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void processEventData(DataInputStream data, EntityPlayerMP player) throws IOException {
|
||||
int eventId = data.readInt();
|
||||
|
||||
if (eventId == EventType.INVENTORY_UPDATE.ordinal()) {
|
||||
EventInventoryUpdate eventData = new EventInventoryUpdate(data);
|
||||
eventData.process(player);
|
||||
}
|
||||
else if (eventId == EventType.FLAGS_UPDATE.ordinal()) {
|
||||
EventFlagsUpdate eventData = new EventFlagsUpdate(data);
|
||||
eventData.process(player);
|
||||
}
|
||||
else if (eventId == EventType.AURA_CHARGE_UPDATE.ordinal()) {
|
||||
EventAuraChargeUpdate evenData = new EventAuraChargeUpdate(data);
|
||||
evenData.process(player);
|
||||
}
|
||||
else {
|
||||
throw new InvalidEventTypeIndexException("");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package magicbees.reference;
|
||||
|
||||
public class Names {
|
||||
public static final class Blocks
|
||||
{
|
||||
public static final String THAUMIC_APIARY = "thaumicApiary";
|
||||
}
|
||||
|
||||
public static final class Containers
|
||||
{
|
||||
public static final String THAUMIC_APIARY = "container.mb." + Blocks.THAUMIC_APIARY;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package magicbees.tileentity;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import magicbees.bees.AuraChargeType;
|
||||
|
||||
public class AuraCharges {
|
||||
private static final String auraChargesTagName = "AuraCharges";
|
||||
|
||||
private final Map<AuraChargeType, Long> charges = new HashMap<AuraChargeType, Long>(AuraChargeType.values().length);
|
||||
|
||||
public void start(AuraChargeType auraChargeType, World worldObj) {
|
||||
charges.put(auraChargeType, worldObj.getTotalWorldTime());
|
||||
}
|
||||
|
||||
public boolean isActive(AuraChargeType auraChargeType) {
|
||||
return charges.keySet().contains(auraChargeType);
|
||||
}
|
||||
|
||||
public boolean isExpired(AuraChargeType auraChargeType, World worldObj) {
|
||||
Long chargeStart = charges.get(auraChargeType);
|
||||
return chargeStart == null || chargeStart + auraChargeType.duration <= worldObj.getTotalWorldTime();
|
||||
}
|
||||
|
||||
public void stop(AuraChargeType AuraChargeType) {
|
||||
charges.remove(AuraChargeType);
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound nbtTagCompound) {
|
||||
NBTTagCompound auraChargeTags = new NBTTagCompound();
|
||||
for (Map.Entry<AuraChargeType, Long> chargeEntry : charges.entrySet()) {
|
||||
String chargeName = chargeEntry.getKey().toString();
|
||||
Long chargeStart = chargeEntry.getValue();
|
||||
auraChargeTags.setLong(chargeName, chargeStart);
|
||||
}
|
||||
nbtTagCompound.setTag(auraChargesTagName, auraChargeTags);
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbtTagCompound) {
|
||||
NBTTagCompound auraChargeTags = nbtTagCompound.getCompoundTag(auraChargesTagName);
|
||||
for (AuraChargeType auraCharge : AuraChargeType.values()) {
|
||||
String chargeName = auraCharge.toString();
|
||||
Long chargeStart = auraChargeTags.getLong(chargeName);
|
||||
if (chargeStart > 0) {
|
||||
charges.put(auraCharge, chargeStart);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int writeToFlags() {
|
||||
int flags = 0;
|
||||
for (AuraChargeType auraChargeType : charges.keySet()) {
|
||||
flags |= auraChargeType.flag;
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
public void readFromFlags(int flags) {
|
||||
charges.clear();
|
||||
for (AuraChargeType auraCharge : AuraChargeType.values()) {
|
||||
if ((flags & auraCharge.flag) > 0) {
|
||||
charges.put(auraCharge, 0L);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package magicbees.tileentity;
|
||||
|
||||
public interface ITileEntityAuraCharged {
|
||||
AuraCharges getAuraCharges();
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package magicbees.tileentity;
|
||||
|
||||
public interface ITileEntityFlags {
|
||||
|
||||
public void setFlags(int[] flags);
|
||||
}
|
||||
@@ -0,0 +1,769 @@
|
||||
package magicbees.tileentity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import magicbees.bees.AuraChargeType;
|
||||
import magicbees.api.bees.IMagicApiaryAuraProvider;
|
||||
import magicbees.bees.BeeManager;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.MagicBees;
|
||||
import magicbees.main.utils.ChunkCoords;
|
||||
import magicbees.main.utils.ItemStackUtils;
|
||||
import magicbees.main.utils.net.EventAuraChargeUpdate;
|
||||
import magicbees.main.utils.net.NetworkEventHandler;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeekeepingLogic;
|
||||
import forestry.api.apiculture.IHiveFrame;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ErrorStateRegistry;
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.core.utils.Utils;
|
||||
|
||||
public class TileEntityMagicApiary extends TileEntity implements ISidedInventory, IBeeHousing, ITileEntityAuraCharged {
|
||||
|
||||
public static final String tileEntityName = CommonProxy.DOMAIN + ".magicApiary";
|
||||
private GameProfile ownerProfile;
|
||||
|
||||
// Constants
|
||||
private static final int SLOT_QUEEN = 0;
|
||||
private static final int SLOT_DRONE = 1;
|
||||
private static final int SLOT_FRAME_START = 2;
|
||||
private static final int SLOT_FRAME_COUNT = 3;
|
||||
private static final int SLOT_PRODUCTS_START = 5;
|
||||
private static final int SLOT_PRODUCTS_COUNT = 7;
|
||||
|
||||
private static final int AURAPROVIDER_SEARCH_RADIUS = 6;
|
||||
|
||||
private IBeekeepingLogic logic;
|
||||
private IMagicApiaryAuraProvider auraProvider;
|
||||
private ChunkCoords auraProviderPosition;
|
||||
private BiomeGenBase biome;
|
||||
private int displayHealthMax = 0;
|
||||
private int displayHealth = 0;
|
||||
private boolean init = false;
|
||||
|
||||
private final AuraCharges auraCharges = new AuraCharges();
|
||||
|
||||
private IErrorState errorState = ErrorStateRegistry.getErrorState("ok");
|
||||
|
||||
private ItemStack[] items;
|
||||
|
||||
public TileEntityMagicApiary(){
|
||||
items = new ItemStack[12];
|
||||
logic = BeeManager.beeRoot.createBeekeepingLogic(this);
|
||||
}
|
||||
|
||||
public void setOwner(EntityPlayer player) {
|
||||
this.ownerProfile = player.getGameProfile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getQueen() {
|
||||
return getStackInSlot(SLOT_QUEEN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getDrone() {
|
||||
return getStackInSlot(SLOT_DRONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setQueen(ItemStack itemstack) {
|
||||
setInventorySlotContents(SLOT_QUEEN, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDrone(ItemStack itemstack) {
|
||||
setInventorySlotContents(SLOT_DRONE, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBreed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onQueenChange(ItemStack queenStack) {
|
||||
if (!worldObj.isRemote) {
|
||||
MagicBees.object.netHandler.sendInventoryUpdate(this, SLOT_QUEEN, queenStack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wearOutEquipment(int amount) {
|
||||
int wear = Math.round(amount * BeeManager.beeRoot.getBeekeepingMode(worldObj).getWearModifier());
|
||||
|
||||
for (int i = SLOT_FRAME_START; i < SLOT_FRAME_START + SLOT_FRAME_COUNT; i++) {
|
||||
if (getStackInSlot(i) == null) {
|
||||
continue;
|
||||
}
|
||||
if (!(getStackInSlot(i).getItem() instanceof IHiveFrame)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
setInventorySlotContents(i, ((IHiveFrame) getStackInSlot(i).getItem()).frameUsed(this, getStackInSlot(i),
|
||||
BeeManager.beeRoot.getMember(getStackInSlot(SLOT_QUEEN)), wear));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onQueenDeath(IBee queen) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPostQueenDeath(IBee queen) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPollenRetrieved(IBee queen, IIndividual pollen, boolean isHandled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onEggLaid(IBee queen) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isItemStackFrame(int i) {
|
||||
return getStackInSlot(i) != null && getStackInSlot(i).getItem() instanceof IHiveFrame;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTerritoryModifier(IBeeGenome genome, float currentModifier) {
|
||||
float mod = 1.0f;
|
||||
for (int slotIndex = SLOT_FRAME_START; slotIndex < SLOT_FRAME_START + SLOT_FRAME_COUNT; slotIndex++) {
|
||||
if (isItemStackFrame(slotIndex)) {
|
||||
mod *= ((IHiveFrame) getStackInSlot(slotIndex).getItem()).getTerritoryModifier(genome, mod);
|
||||
}
|
||||
}
|
||||
return mod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) {
|
||||
float mod = 1.0f;
|
||||
for (int slotIndex = SLOT_FRAME_START; slotIndex < SLOT_FRAME_START + SLOT_FRAME_COUNT; slotIndex++) {
|
||||
if (isItemStackFrame(slotIndex)) {
|
||||
mod *= ((IHiveFrame) getStackInSlot(slotIndex).getItem()).getMutationModifier(genome, mate, mod);
|
||||
}
|
||||
}
|
||||
if (this.isMutationBoosted()) {
|
||||
mod = mod * 2f;
|
||||
}
|
||||
return mod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) {
|
||||
float mod = 1.0f;
|
||||
for (int slotIndex = SLOT_FRAME_START; slotIndex < SLOT_FRAME_START + SLOT_FRAME_COUNT; slotIndex++) {
|
||||
if (isItemStackFrame(slotIndex)) {
|
||||
mod *= ((IHiveFrame) getStackInSlot(slotIndex).getItem()).getLifespanModifier(genome, mate, mod);
|
||||
}
|
||||
}
|
||||
if (this.isDeathRateBoosted()) {
|
||||
mod = mod / 2f;
|
||||
}
|
||||
return mod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getProductionModifier(IBeeGenome genome, float currentModifier) {
|
||||
float mod = 0.9f;
|
||||
for (int slotIndex = SLOT_FRAME_START; slotIndex < SLOT_FRAME_START + SLOT_FRAME_COUNT; slotIndex++){
|
||||
if (isItemStackFrame(slotIndex)) {
|
||||
mod *= ((IHiveFrame) getStackInSlot(slotIndex).getItem()).getProductionModifier(genome, mod);
|
||||
}
|
||||
}
|
||||
if (this.isProductionBoosted()) {
|
||||
mod = mod * 2f;
|
||||
}
|
||||
return mod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFloweringModifier(IBeeGenome genome, float currentModifier) {
|
||||
float mod = 1.0f;
|
||||
for (int slotIndex = SLOT_FRAME_START; slotIndex < SLOT_FRAME_START + SLOT_FRAME_COUNT; slotIndex++) {
|
||||
if (isItemStackFrame(slotIndex)) {
|
||||
mod *= ((IHiveFrame) getStackInSlot(slotIndex).getItem()).getFloweringModifier(genome, mod);
|
||||
}
|
||||
}
|
||||
return mod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getGeneticDecay(IBeeGenome genome, float currentModifier) {
|
||||
float mod = 0.8f;
|
||||
for (int slotIndex = SLOT_FRAME_START; slotIndex < SLOT_FRAME_START + SLOT_FRAME_COUNT; slotIndex++) {
|
||||
if (isItemStackFrame(slotIndex)) {
|
||||
mod *= ((IHiveFrame) getStackInSlot(slotIndex).getItem()).getGeneticDecay(genome, mod);
|
||||
}
|
||||
}
|
||||
return mod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSealed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelfLighted() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSunlightSimulated() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHellish() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameProfile getOwnerName() {
|
||||
return this.ownerProfile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld() {
|
||||
return worldObj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getXCoord() {
|
||||
return xCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getYCoord() {
|
||||
return yCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getZCoord() {
|
||||
return zCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBiomeId() {
|
||||
return biome.biomeID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeGenBase getBiome() {
|
||||
return biome;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumTemperature getTemperature() {
|
||||
return EnumTemperature.getFromValue(getExactTemperature());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumHumidity getHumidity() {
|
||||
return EnumHumidity.getFromValue(getExactHumidity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setErrorState(int state) {
|
||||
this.errorState = ErrorStateRegistry.getErrorState((short) state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setErrorState(IErrorState state) {
|
||||
this.errorState = state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getErrorOrdinal() {
|
||||
return this.errorState.getID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IErrorState getErrorState() {
|
||||
return this.errorState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addProduct(ItemStack product, boolean all) {
|
||||
int countAdded = ItemStackUtils.addItemToInventory(this, product, SLOT_PRODUCTS_START, SLOT_PRODUCTS_COUNT);
|
||||
|
||||
if (all) {
|
||||
return countAdded == product.stackSize;
|
||||
}
|
||||
else {
|
||||
return countAdded > 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return items.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return items[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
ItemStack itemStack = getStackInSlot(i);
|
||||
|
||||
if (itemStack != null) {
|
||||
if (itemStack.stackSize <= j) {
|
||||
setInventorySlotContents(i, null);
|
||||
}else{
|
||||
itemStack = itemStack.splitStack(j);
|
||||
markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
ItemStack item = getStackInSlot(i);
|
||||
setInventorySlotContents(i, null);
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemStack) {
|
||||
items[i] = itemStack;
|
||||
|
||||
if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()){
|
||||
itemStack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
|
||||
markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return tileEntityName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityPlayer) {
|
||||
return entityPlayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) <= 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack itemStack, int side) {
|
||||
if(slot == SLOT_QUEEN && BeeManager.beeRoot.isMember(itemStack)
|
||||
&& !BeeManager.beeRoot.isDrone(itemStack)) {
|
||||
return true;
|
||||
}
|
||||
else if (slot == SLOT_DRONE && BeeManager.beeRoot.isDrone(itemStack)) {
|
||||
return true;
|
||||
}
|
||||
return slot == SLOT_DRONE && BeeManager.beeRoot.isDrone(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack itemStack, int side) {
|
||||
switch (slot){
|
||||
case SLOT_QUEEN:
|
||||
case SLOT_DRONE:
|
||||
case SLOT_FRAME_START:
|
||||
case SLOT_FRAME_START + 1:
|
||||
case SLOT_FRAME_START + 2:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private int getHealthDisplay() {
|
||||
if (getStackInSlot(SLOT_QUEEN) == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (BeeManager.beeRoot.isMated(getStackInSlot(SLOT_QUEEN))) {
|
||||
return BeeManager.beeRoot.getMember(getStackInSlot(SLOT_QUEEN)).getHealth();
|
||||
}
|
||||
else if (!BeeManager.beeRoot.isDrone(getStackInSlot(SLOT_QUEEN))) {
|
||||
return displayHealth;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private int getMaxHealthDisplay() {
|
||||
if (getStackInSlot(SLOT_QUEEN) == null) {
|
||||
return 0;
|
||||
}
|
||||
if (BeeManager.beeRoot.isMated(getStackInSlot(SLOT_QUEEN))) {
|
||||
return BeeManager.beeRoot.getMember(getStackInSlot(SLOT_QUEEN)).getMaxHealth();
|
||||
}
|
||||
else if (!BeeManager.beeRoot.isDrone(getStackInSlot(SLOT_QUEEN))) {
|
||||
return displayHealthMax;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public int getHealthScaled(int i) {
|
||||
if (getMaxHealthDisplay() == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (getHealthDisplay() * i) / getMaxHealthDisplay();
|
||||
}
|
||||
|
||||
public int getTemperatureScaled(int i) {
|
||||
return Math.round(i * (getExactTemperature() / 2));
|
||||
}
|
||||
|
||||
public int getHumidityScaled(int i) {
|
||||
return Math.round(i * getExactHumidity());
|
||||
}
|
||||
|
||||
/* Saving and loading */
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound) {
|
||||
super.writeToNBT(compound);
|
||||
|
||||
NBTTagList items = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < getSizeInventory(); i++) {
|
||||
ItemStack itemStack = getStackInSlot(i);
|
||||
|
||||
if (itemStack != null) {
|
||||
NBTTagCompound item = new NBTTagCompound();
|
||||
item.setByte("Slot", (byte)i);
|
||||
itemStack.writeToNBT(item);
|
||||
items.appendTag(item);
|
||||
}
|
||||
}
|
||||
compound.setTag("Items", items);
|
||||
|
||||
compound.setInteger("BiomeId", biome.biomeID);
|
||||
if (logic != null) {
|
||||
logic.writeToNBT(compound);
|
||||
}
|
||||
|
||||
ChunkCoords.writeToNBT(this.auraProviderPosition, compound);
|
||||
|
||||
auraCharges.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
super.readFromNBT(compound);
|
||||
|
||||
NBTTagList items = compound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
|
||||
|
||||
for (int i = 0; i < items.tagCount(); i++) {
|
||||
NBTTagCompound item = items.getCompoundTagAt(i);
|
||||
int slot = item.getByte("Slot");
|
||||
|
||||
if (slot >= 0 && slot < getSizeInventory()) {
|
||||
setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(item));
|
||||
}
|
||||
}
|
||||
|
||||
int biomeId = compound.getInteger("BiomeId");
|
||||
biome = BiomeGenBase.getBiome(biomeId);
|
||||
logic.readFromNBT(compound);
|
||||
|
||||
this.auraProviderPosition = ChunkCoords.readFromNBT(compound);
|
||||
|
||||
auraCharges.readFromNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
EventAuraChargeUpdate event = new EventAuraChargeUpdate(new ChunkCoords(this), auraCharges);
|
||||
return event.getPacket();
|
||||
}
|
||||
|
||||
public float getExactTemperature() {
|
||||
return biome.temperature;
|
||||
}
|
||||
|
||||
public float getExactHumidity() {
|
||||
return biome.rainfall;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (!init) {
|
||||
init = true;
|
||||
updateBiome();
|
||||
}
|
||||
|
||||
if (worldObj.isRemote) {
|
||||
updateClientSide();
|
||||
}
|
||||
else {
|
||||
updateServerSide();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateBiome() {
|
||||
if (worldObj != null) {
|
||||
if (biome == null) {
|
||||
BiomeGenBase biome = Utils.getBiomeAt(worldObj, xCoord, yCoord);
|
||||
if (biome != null) {
|
||||
this.biome = biome;
|
||||
setErrorState(ErrorStateRegistry.getErrorState("OK"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateClientSide() {
|
||||
if (BeeManager.beeRoot.isMated(getStackInSlot(SLOT_QUEEN))) {
|
||||
if (getErrorState() == ErrorStateRegistry.getErrorState("OK") && worldObj.getTotalWorldTime() % 10 == 0) {
|
||||
IBee displayQueen = BeeManager.beeRoot.getMember(getStackInSlot(SLOT_QUEEN));
|
||||
displayQueen.doFX(logic.getEffectData(), this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateServerSide() {
|
||||
if (this.auraProvider == null) {
|
||||
findAuraProvider();
|
||||
}
|
||||
else {
|
||||
updateAuraProvider();
|
||||
}
|
||||
tickCharges();
|
||||
|
||||
logic.update();
|
||||
|
||||
IBee queen = logic.getQueen();
|
||||
if (queen == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (worldObj.getTotalWorldTime() % 5 == 0) {
|
||||
onQueenChange(getStackInSlot(SLOT_QUEEN));
|
||||
}
|
||||
}
|
||||
|
||||
public void getGUINetworkData(int i, int j) {
|
||||
if (logic == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch(i) {
|
||||
case 0:
|
||||
displayHealth = j;
|
||||
break;
|
||||
case 1: displayHealthMax = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void sendGUINetworkData(Container container, ICrafting iCrafting) {
|
||||
if (logic == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
iCrafting.sendProgressBarUpdate(container, 0, logic.getBreedingTime());
|
||||
iCrafting.sendProgressBarUpdate(container, 1, logic.getTotalBreedingTime());
|
||||
}
|
||||
|
||||
public boolean isProductionBoosted() {
|
||||
return auraCharges.isActive(AuraChargeType.PRODUCTION);
|
||||
}
|
||||
|
||||
public boolean isDeathRateBoosted() {
|
||||
return auraCharges.isActive(AuraChargeType.DEATH);
|
||||
}
|
||||
|
||||
public boolean isMutationBoosted() {
|
||||
return auraCharges.isActive(AuraChargeType.MUTATION);
|
||||
}
|
||||
|
||||
private void updateAuraProvider() {
|
||||
if (worldObj.getTotalWorldTime() % 10 != 0) {
|
||||
return;
|
||||
}
|
||||
if (getAuraProvider(auraProviderPosition) == null) {
|
||||
this.auraProvider = null;
|
||||
this.auraProviderPosition = null;
|
||||
return;
|
||||
}
|
||||
|
||||
boolean auraChargesChanged = false;
|
||||
for (AuraChargeType chargeType : AuraChargeType.values()) {
|
||||
if (!auraCharges.isActive(chargeType) && auraProvider.getCharge(chargeType)) {
|
||||
auraCharges.start(chargeType, worldObj);
|
||||
auraChargesChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (auraChargesChanged) {
|
||||
NetworkEventHandler.getInstance().sendAuraChargeUpdate(this, auraCharges);
|
||||
}
|
||||
}
|
||||
|
||||
private void tickCharges() {
|
||||
boolean auraChargesChanged = false;
|
||||
|
||||
for (AuraChargeType chargeType : AuraChargeType.values()) {
|
||||
if (auraCharges.isActive(chargeType) && auraCharges.isExpired(chargeType, worldObj) && (auraProvider == null || !auraProvider.getCharge(chargeType))) {
|
||||
auraCharges.stop(chargeType);
|
||||
auraChargesChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (auraChargesChanged) {
|
||||
NetworkEventHandler.getInstance().sendAuraChargeUpdate(this, auraCharges);
|
||||
}
|
||||
}
|
||||
|
||||
private void findAuraProvider() {
|
||||
if (worldObj.getTotalWorldTime() % 5 != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.auraProviderPosition == null) {
|
||||
List<Chunk> chunks = getChunksInSearchRange();
|
||||
for (Chunk chunk : chunks) {
|
||||
if (searchChunkForBooster(chunk)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.auraProvider = getAuraProvider(auraProviderPosition);
|
||||
if (auraProvider == null) {
|
||||
this.auraProviderPosition = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<Chunk> getChunksInSearchRange() {
|
||||
List<Chunk> chunks = new ArrayList<Chunk>(4);
|
||||
chunks.add(worldObj.getChunkFromBlockCoords(xCoord - AURAPROVIDER_SEARCH_RADIUS, zCoord - AURAPROVIDER_SEARCH_RADIUS));
|
||||
Chunk chunk = worldObj.getChunkFromBlockCoords(xCoord + AURAPROVIDER_SEARCH_RADIUS, zCoord - AURAPROVIDER_SEARCH_RADIUS);
|
||||
if (!chunks.contains(chunk)) {
|
||||
chunks.add(chunk);
|
||||
}
|
||||
chunk = worldObj.getChunkFromBlockCoords(xCoord - AURAPROVIDER_SEARCH_RADIUS, zCoord + AURAPROVIDER_SEARCH_RADIUS);
|
||||
if (!chunks.contains(chunk)) {
|
||||
chunks.add(chunk);
|
||||
}
|
||||
chunk = worldObj.getChunkFromBlockCoords(xCoord + AURAPROVIDER_SEARCH_RADIUS, zCoord + AURAPROVIDER_SEARCH_RADIUS);
|
||||
if (!chunks.contains(chunk)) {
|
||||
chunks.add(chunk);
|
||||
}
|
||||
return chunks;
|
||||
}
|
||||
|
||||
private boolean searchChunkForBooster(Chunk chunk) {
|
||||
Vec3 apiaryPos = Vec3.createVectorHelper(xCoord, yCoord, zCoord);
|
||||
for (Map.Entry<ChunkPosition, TileEntity> entry : ((Map<ChunkPosition, TileEntity>)chunk.chunkTileEntityMap).entrySet()) {
|
||||
TileEntity entity = entry.getValue();
|
||||
if (entity instanceof IMagicApiaryAuraProvider) {
|
||||
Vec3 tePos = Vec3.createVectorHelper(entity.xCoord, entity.yCoord, entity.zCoord);
|
||||
Vec3 result = apiaryPos.subtract(tePos);
|
||||
if (result.lengthVector() <= AURAPROVIDER_SEARCH_RADIUS) {
|
||||
saveAuraProviderPosition(entity.xCoord, entity.yCoord, entity.zCoord);
|
||||
this.auraProvider = (IMagicApiaryAuraProvider)entity;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void saveAuraProviderPosition(int x, int y, int z) {
|
||||
auraProviderPosition = new ChunkCoords(worldObj.provider.dimensionId, x, y, z);
|
||||
}
|
||||
|
||||
private IMagicApiaryAuraProvider getAuraProvider(ChunkCoords coords) {
|
||||
return getAuraProvider(coords.x, coords.y, coords.z);
|
||||
}
|
||||
|
||||
private IMagicApiaryAuraProvider getAuraProvider(int x, int y, int z) {
|
||||
Chunk chunk = worldObj.getChunkFromBlockCoords(x, z);
|
||||
x %= 16;
|
||||
z %= 16;
|
||||
if (x < 0) {
|
||||
x += 16;
|
||||
}
|
||||
if (z < 0) {
|
||||
z += 16;
|
||||
}
|
||||
ChunkPosition cPos = new ChunkPosition(x, y, z);
|
||||
TileEntity entity = (TileEntity)chunk.chunkTileEntityMap.get(cPos);
|
||||
if (!(entity instanceof IMagicApiaryAuraProvider)) {
|
||||
return null;
|
||||
}
|
||||
return (IMagicApiaryAuraProvider)entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuraCharges getAuraCharges() {
|
||||
return auraCharges;
|
||||
}
|
||||
}
|
||||
@@ -1,564 +0,0 @@
|
||||
package magicbees.tileentity;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.apiculture.*;
|
||||
import forestry.api.core.ErrorStateRegistry;
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.inventory.InvTools;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.utils.Utils;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.utils.LogHelper;
|
||||
import magicbees.reference.Names;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
|
||||
public class TileEntityThaumicApiary extends TileEntity implements ISidedInventory, IBeeHousing {
|
||||
|
||||
public static final String tileEntityName = CommonProxy.DOMAIN + ".thaumicApiary";
|
||||
private GameProfile ownerName;
|
||||
|
||||
// Constants
|
||||
private static final int SLOT_QUEEN = 0;
|
||||
private static final int SLOT_DRONE = 1;
|
||||
private static final int SLOT_FRAME_START = 2;
|
||||
private static final int SLOT_INVENTORY_START = 5;
|
||||
private static final int SLOT_FRAME_COUNT = 3;
|
||||
private static final int SLOT_INVENTORY_COUNT = 7;
|
||||
|
||||
|
||||
private final IBeekeepingLogic logic;
|
||||
private BiomeGenBase biome;
|
||||
private int displayHealthMax = 0;
|
||||
private int displayHealth = 0;
|
||||
private boolean init = false;
|
||||
|
||||
private ItemStack[] items;
|
||||
|
||||
protected final InventoryAdapter inventory = new InventoryAdapter(12, "Items");
|
||||
|
||||
public TileEntityThaumicApiary()
|
||||
{
|
||||
items = new ItemStack[12];
|
||||
logic = PluginApiculture.beeInterface.createBeekeepingLogic(this);
|
||||
}
|
||||
|
||||
public void setOwner(EntityPlayer player) { this.ownerName = player.getGameProfile(); }
|
||||
|
||||
@Override
|
||||
public ItemStack getQueen() {
|
||||
return getStackInSlot(SLOT_QUEEN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getDrone() {
|
||||
return getStackInSlot(SLOT_DRONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setQueen(ItemStack itemstack) {
|
||||
setInventorySlotContents(SLOT_QUEEN, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDrone(ItemStack itemstack) {
|
||||
setInventorySlotContents(SLOT_DRONE, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBreed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO: Investigate this :D
|
||||
@Override
|
||||
public void onQueenChange(ItemStack queenStack) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wearOutEquipment(int amount) {
|
||||
int wear = Math.round(amount * PluginApiculture.beeInterface.getBeekeepingMode(worldObj).getWearModifier());
|
||||
|
||||
for (int i = SLOT_FRAME_START; i < SLOT_FRAME_START + SLOT_FRAME_COUNT; i++){
|
||||
if (getStackInSlot(i) == null)
|
||||
continue;
|
||||
if (!(getStackInSlot(i).getItem() instanceof IHiveFrame))
|
||||
continue;
|
||||
|
||||
setInventorySlotContents(
|
||||
i,
|
||||
((IHiveFrame) getStackInSlot(i).getItem()).frameUsed(this, getStackInSlot(i),
|
||||
PluginApiculture.beeInterface.getMember(getStackInSlot(SLOT_QUEEN)), wear));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onQueenDeath(IBee queen) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPostQueenDeath(IBee queen) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPollenRetrieved(IBee queen, IIndividual pollen, boolean isHandled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onEggLaid(IBee queen) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTerritoryModifier(IBeeGenome genome, float currentModifier) {
|
||||
float mod = 1.0f;
|
||||
for (int i = SLOT_FRAME_START; i < SLOT_FRAME_START + SLOT_FRAME_COUNT; i++){
|
||||
if (getStackInSlot(i) == null)
|
||||
continue;
|
||||
if (getStackInSlot(i).getItem() instanceof IHiveFrame)
|
||||
mod *= ((IHiveFrame) getStackInSlot(i).getItem()).getTerritoryModifier(genome, mod);
|
||||
}
|
||||
return mod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) {
|
||||
float mod = 1.0f;
|
||||
for (int i = SLOT_FRAME_START; i < SLOT_FRAME_START + SLOT_FRAME_COUNT; i++){
|
||||
if (getStackInSlot(i) == null)
|
||||
continue;
|
||||
if (getStackInSlot(i).getItem() instanceof IHiveFrame)
|
||||
mod *= ((IHiveFrame) getStackInSlot(i).getItem()).getMutationModifier(genome, mate, mod);
|
||||
}
|
||||
return mod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) {
|
||||
float mod = 1.0f;
|
||||
for (int i = SLOT_FRAME_START; i < SLOT_FRAME_START + SLOT_FRAME_COUNT; i++){
|
||||
if (getStackInSlot(i) == null)
|
||||
continue;
|
||||
if (getStackInSlot(i).getItem() instanceof IHiveFrame)
|
||||
mod *= ((IHiveFrame) getStackInSlot(i).getItem()).getLifespanModifier(genome, mate, mod);
|
||||
}
|
||||
return mod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getProductionModifier(IBeeGenome genome, float currentModifier) {
|
||||
float mod = 1.0f;
|
||||
for (int i = SLOT_FRAME_START; i < SLOT_FRAME_START + SLOT_FRAME_COUNT; i++){
|
||||
if (getStackInSlot(i) == null)
|
||||
continue;
|
||||
if (getStackInSlot(i).getItem() instanceof IHiveFrame)
|
||||
mod *= ((IHiveFrame) getStackInSlot(i).getItem()).getProductionModifier(genome, mod);
|
||||
}
|
||||
return mod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFloweringModifier(IBeeGenome genome, float currentModifier) {
|
||||
float mod = 1.0f;
|
||||
for (int i = SLOT_FRAME_START; i < SLOT_FRAME_START + SLOT_FRAME_COUNT; i++){
|
||||
if (getStackInSlot(i) == null)
|
||||
continue;
|
||||
if (getStackInSlot(i).getItem() instanceof IHiveFrame)
|
||||
mod *= ((IHiveFrame) getStackInSlot(i).getItem()).getFloweringModifier(genome, mod);
|
||||
}
|
||||
return mod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getGeneticDecay(IBeeGenome genome, float currentModifier) {
|
||||
float mod = 1.0f;
|
||||
for (int i = SLOT_FRAME_START; i < SLOT_FRAME_START + SLOT_FRAME_COUNT; i++){
|
||||
if (getStackInSlot(i) == null)
|
||||
continue;
|
||||
if (getStackInSlot(i).getItem() instanceof IHiveFrame)
|
||||
mod *= ((IHiveFrame) getStackInSlot(i).getItem()).getGeneticDecay(genome, mod);
|
||||
}
|
||||
return mod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSealed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelfLighted() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSunlightSimulated() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHellish() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameProfile getOwnerName() {
|
||||
return this.ownerName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld() {
|
||||
return worldObj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getXCoord() {
|
||||
return xCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getYCoord() {
|
||||
return yCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getZCoord() {
|
||||
return zCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBiomeId() {
|
||||
return biome.biomeID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeGenBase getBiome() {
|
||||
return biome;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumTemperature getTemperature() {
|
||||
return EnumTemperature.getFromValue(getExactTemperature());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumHumidity getHumidity() {
|
||||
return EnumHumidity.getFromValue(getExactHumidity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setErrorState(int state) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setErrorState(IErrorState state) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getErrorOrdinal() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IErrorState getErrorState() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public InventoryAdapter getInternalInventory() {
|
||||
return inventory;
|
||||
}
|
||||
|
||||
// TODO: Implement own version of this
|
||||
@Override
|
||||
public boolean addProduct(ItemStack product, boolean all) {
|
||||
LogHelper.info("Trying to add " + product.getDisplayName() + " to thaumicApiary");
|
||||
return InvTools.tryAddStack(getInternalInventory(), product, SLOT_INVENTORY_START, SLOT_INVENTORY_COUNT, all, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return items.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return items[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
ItemStack itemStack = getStackInSlot(i);
|
||||
|
||||
if (itemStack != null) {
|
||||
if (itemStack.stackSize <= j) {
|
||||
setInventorySlotContents(i, null);
|
||||
}else{
|
||||
itemStack = itemStack.splitStack(j);
|
||||
markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
ItemStack item = getStackInSlot(i);
|
||||
setInventorySlotContents(i, null);
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemStack) {
|
||||
items[i] = itemStack;
|
||||
|
||||
if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()){
|
||||
itemStack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
|
||||
markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return Names.Containers.THAUMIC_APIARY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityPlayer) {
|
||||
return entityPlayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) <= 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack itemStack, int side) {
|
||||
if(slot == SLOT_QUEEN && PluginApiculture.beeInterface.isMember(itemStack)
|
||||
&& !PluginApiculture.beeInterface.isDrone(itemStack))
|
||||
return true;
|
||||
return slot == SLOT_DRONE && PluginApiculture.beeInterface.isDrone(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack itemStack, int side) {
|
||||
switch (slot){
|
||||
case SLOT_QUEEN:
|
||||
case SLOT_DRONE:
|
||||
case SLOT_FRAME_START:
|
||||
case SLOT_FRAME_START + 1:
|
||||
case SLOT_FRAME_START + 2:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Health display */
|
||||
private int getHealthDisplay(){
|
||||
if (getStackInSlot(SLOT_QUEEN) == null)
|
||||
return 0;
|
||||
|
||||
if (ForestryItem.beeQueenGE.isItemEqual(inventory.getStackInSlot(SLOT_QUEEN)))
|
||||
return PluginApiculture.beeInterface.getMember(getStackInSlot(SLOT_QUEEN)).getHealth();
|
||||
else if (ForestryItem.beePrincessGE.isItemEqual(getStackInSlot(SLOT_QUEEN)))
|
||||
return displayHealth;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int getMaxHealthDisplay(){
|
||||
if (getStackInSlot(SLOT_QUEEN) == null)
|
||||
return 0;
|
||||
if (ForestryItem.beeQueenGE.isItemEqual(getStackInSlot(SLOT_QUEEN)))
|
||||
return PluginApiculture.beeInterface.getMember(getStackInSlot(SLOT_QUEEN)).getMaxHealth();
|
||||
else if (ForestryItem.beePrincessGE.isItemEqual(getStackInSlot(SLOT_QUEEN)))
|
||||
return displayHealthMax;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int getHealthScaled(int i){
|
||||
if (getMaxHealthDisplay() == 0)
|
||||
return 0;
|
||||
|
||||
return (getHealthDisplay() * i) / getMaxHealthDisplay();
|
||||
}
|
||||
|
||||
public int getTemperatureScaled(int i) {
|
||||
return Math.round(i * (getExactTemperature() / 2));
|
||||
}
|
||||
|
||||
public int getHumidityScaled(int i) {
|
||||
return Math.round(i * getExactHumidity());
|
||||
}
|
||||
|
||||
/* Saving and loading */
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
|
||||
NBTTagList items = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < getSizeInventory(); i++){
|
||||
ItemStack itemStack = getStackInSlot(i);
|
||||
|
||||
if (itemStack != null){
|
||||
NBTTagCompound item = new NBTTagCompound();
|
||||
item.setByte("Slot", (byte)i);
|
||||
itemStack.writeToNBT(item);
|
||||
items.appendTag(item);
|
||||
}
|
||||
}
|
||||
|
||||
compound.setInteger("BiomeId", biome.biomeID);
|
||||
if (logic != null)
|
||||
logic.writeToNBT(compound);
|
||||
|
||||
compound.setTag("Items", items);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
|
||||
NBTTagList items = compound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
|
||||
|
||||
for (int i = 0; i < items.tagCount(); i++){
|
||||
NBTTagCompound item = (NBTTagCompound)items.getCompoundTagAt(i);
|
||||
int slot = item.getByte("Slot");
|
||||
|
||||
if (slot >= 0 && slot < getSizeInventory()){
|
||||
setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(item));
|
||||
}
|
||||
}
|
||||
|
||||
int biomeId = compound.getInteger("BiomeId");
|
||||
biome = BiomeGenBase.getBiome(biomeId);
|
||||
logic.readFromNBT(compound);
|
||||
}
|
||||
|
||||
public float getExactTemperature(){
|
||||
return biome.temperature;
|
||||
}
|
||||
|
||||
public float getExactHumidity(){
|
||||
return biome.rainfall;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity(){
|
||||
if (init == false){
|
||||
init = true;
|
||||
updateBiome();
|
||||
}
|
||||
|
||||
if (!Proxies.common.isSimulating(worldObj))
|
||||
updateClientSide();
|
||||
else
|
||||
updateServerSide();
|
||||
}
|
||||
|
||||
public void updateBiome(){
|
||||
if (worldObj != null){
|
||||
if (biome == null){
|
||||
BiomeGenBase biome = Utils.getBiomeAt(worldObj, xCoord, yCoord);
|
||||
if (biome != null){
|
||||
this.biome = biome;
|
||||
setErrorState(ErrorStateRegistry.getErrorState("OK"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateClientSide(){
|
||||
if (PluginApiculture.beeInterface.isMated(getStackInSlot(SLOT_QUEEN))) {
|
||||
if (getErrorState() == ErrorStateRegistry.getErrorState("OK") && worldObj.getTotalWorldTime() % 2 % 2 == 0) {
|
||||
IBee displayQueen = PluginApiculture.beeInterface.getMember(getStackInSlot(SLOT_QUEEN));
|
||||
displayQueen.doFX(logic.getEffectData(), this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateServerSide(){
|
||||
logic.update();
|
||||
|
||||
IBee queen = logic.getQueen();
|
||||
if (queen == null)
|
||||
return;
|
||||
|
||||
// Swarm effects
|
||||
if (worldObj.getTotalWorldTime() % 200 * 10 == 0)
|
||||
onQueenChange(getStackInSlot(SLOT_QUEEN));
|
||||
}
|
||||
|
||||
public void getGUINetworkData(int i, int j){
|
||||
if (logic == null)
|
||||
return;
|
||||
|
||||
switch(i) {
|
||||
case 0:
|
||||
displayHealth = j;
|
||||
break;
|
||||
case 1: displayHealthMax = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void sendGUINetworkData(Container container, ICrafting iCrafting) {
|
||||
if (logic == null)
|
||||
return;
|
||||
|
||||
iCrafting.sendProgressBarUpdate(container, 0, logic.getBreedingTime());
|
||||
iCrafting.sendProgressBarUpdate(container, 1, logic.getTotalBreedingTime());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package magicbees.tileentity;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import magicbees.api.bees.IAuraChargeType;
|
||||
import magicbees.bees.AuraChargeType;
|
||||
import magicbees.api.bees.IMagicApiaryAuraProvider;
|
||||
import magicbees.main.CommonProxy;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.visnet.VisNetHandler;
|
||||
|
||||
public class TileEntityVisAuraProvider extends TileEntity implements IMagicApiaryAuraProvider {
|
||||
|
||||
public static final String tileEntityName = CommonProxy.DOMAIN + ".visAuraProvider";
|
||||
|
||||
private static final int MAX_CHARGES = 10;
|
||||
private static final int VIS_PER_CHARGE = 8;
|
||||
|
||||
private static class AuraCharge {
|
||||
int charges;
|
||||
int vis;
|
||||
|
||||
public int[] toArray() {
|
||||
return new int[]{charges, vis};
|
||||
}
|
||||
|
||||
public void fromArray(int[] array) {
|
||||
if (array.length == 2) {
|
||||
charges = array[0];
|
||||
vis = array[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final Map<AuraChargeType, AuraCharge> currentCharges;
|
||||
|
||||
public TileEntityVisAuraProvider() {
|
||||
super();
|
||||
|
||||
AuraChargeType[] auraChargeTypes = AuraChargeType.values();
|
||||
currentCharges = new HashMap<AuraChargeType, AuraCharge>(auraChargeTypes.length);
|
||||
for (AuraChargeType auraChargeType : auraChargeTypes) {
|
||||
currentCharges.put(auraChargeType, new AuraCharge());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
long tick = worldObj.getTotalWorldTime();
|
||||
|
||||
for (Map.Entry<AuraChargeType, AuraCharge> currentCharge : currentCharges.entrySet()) {
|
||||
AuraChargeType type = currentCharge.getKey();
|
||||
AuraCharge auraCharge = currentCharge.getValue();
|
||||
|
||||
if (auraCharge.charges < MAX_CHARGES && (tick % type.tickRate) == 0) {
|
||||
auraCharge.vis += getVisFromNet(type.aspect);
|
||||
if (auraCharge.vis >= VIS_PER_CHARGE) {
|
||||
auraCharge.vis -= VIS_PER_CHARGE;
|
||||
auraCharge.charges++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int getVisFromNet(Aspect aspect) {
|
||||
return VisNetHandler.drainVis(worldObj, xCoord, yCoord, zCoord, aspect, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getMutationCharge() {
|
||||
return getCharge(AuraChargeType.MUTATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getDeathRateCharge() {
|
||||
return getCharge(AuraChargeType.DEATH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getProductionCharge() {
|
||||
return getCharge(AuraChargeType.PRODUCTION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getCharge(IAuraChargeType auraChargeType) {
|
||||
AuraCharge auraCharge = currentCharges.get(auraChargeType);
|
||||
if (auraCharge == null) {
|
||||
return false;
|
||||
}
|
||||
if (auraCharge.charges > 0) {
|
||||
auraCharge.charges--;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
super.readFromNBT(tag);
|
||||
|
||||
for (Map.Entry<AuraChargeType, AuraCharge> charge : currentCharges.entrySet()) {
|
||||
String auraName = charge.getKey().toString();
|
||||
int[] array = tag.getIntArray(auraName);
|
||||
AuraCharge auraCharge = charge.getValue();
|
||||
auraCharge.fromArray(array);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
super.writeToNBT(tag);
|
||||
|
||||
for (Map.Entry<AuraChargeType, AuraCharge> charge : currentCharges.entrySet()) {
|
||||
String auraName = charge.getKey().toString();
|
||||
AuraCharge auraCharge = charge.getValue();
|
||||
int[] array = auraCharge.toArray();
|
||||
tag.setIntArray(auraName, array);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user