mirror of
https://github.com/GTNewHorizons/MagicBees.git
synced 2026-11-19 20:00:03 +00:00
Upgraded to 1.7.2. List of currently-known issues are in CURRENT_ISSUES.txt file.
This commit is contained in:
1 parent
02655f092e
commit
02659b2816
227 files changed
+1350
-1222
No files matched your search
@@ -0,0 +1,9 @@
|
||||
package magicbees.api;
|
||||
|
||||
import magicbees.api.bees.ITransmutationEffectController;
|
||||
|
||||
public class MagicBeesAPI
|
||||
{
|
||||
// Use this object during or after the Mod.Init phase to add your logic to the Transmutation bee effect.
|
||||
public static ITransmutationEffectController transmutationEffectController;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package magicbees.api.bees;
|
||||
|
||||
/**
|
||||
* Manages adding custom ITransmutationEffectLogic instances into the bee effect
|
||||
* system.
|
||||
*
|
||||
* @author MysteriousAges
|
||||
*
|
||||
*/
|
||||
public interface ITransmutationEffectController
|
||||
{
|
||||
public void addEffectLogic(ITransmutationEffectLogic logic);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package magicbees.api.bees;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
/**
|
||||
* Class to control plugin logic for the Transmutation bee effect. Turns blocks
|
||||
* into other blocks based on biome, time of day, or whatever is deemed
|
||||
* appropriate at the time.
|
||||
*
|
||||
* @author MysteriousAges
|
||||
*
|
||||
*/
|
||||
public interface ITransmutationEffectLogic
|
||||
{
|
||||
/**
|
||||
* Allows an external mod to add transmutation logic to the Transmuting bee effect.
|
||||
* Called from a list of ITransmutationEffectLogic until one returns true. You can
|
||||
* implement more than one transmutation effect in a single implementation of the
|
||||
* interface. Function checks for a series of conditions based on block ID/meta, or
|
||||
* biome information, or world information.
|
||||
*
|
||||
* @param world World object
|
||||
* @param biome Biome information for current coordinates
|
||||
* @param sourceBlock ItemStack representing the block at current coordinates
|
||||
* @param x Current X coordinate to attempt a transmute
|
||||
* @param y Current Y coordinate to attempt a transmute
|
||||
* @param z Current Z coordinate to attempt a transmute
|
||||
* @return true if a block was changed.
|
||||
*/
|
||||
public boolean tryTransmutation(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z);
|
||||
}
|
||||
@@ -0,0 +1,263 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import magicbees.main.utils.compat.ArsMagicaHelper;
|
||||
import magicbees.main.utils.compat.ThaumcraftHelper;
|
||||
import magicbees.main.utils.compat.ThermalExpansionHelper;
|
||||
import net.minecraft.potion.Potion;
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleEffect;
|
||||
import forestry.api.genetics.IAlleleFlowers;
|
||||
import forestry.api.genetics.IAlleleRegistry;
|
||||
|
||||
public class Allele implements IAllele
|
||||
{
|
||||
public static AlleleFloat speedBlinding;
|
||||
|
||||
public static IAlleleBeeEffect forestryBaseEffect;
|
||||
|
||||
public static IAlleleFlowers flowerBookshelf;
|
||||
public static IAlleleFlowers flowerThaumcraft;
|
||||
public static IAlleleFlowers flowerArsMagica;
|
||||
public static IAlleleFlowers flowerAuraNode;
|
||||
|
||||
public static IAlleleEffect effectCleansing;
|
||||
public static IAlleleEffect effectDigSpeed;
|
||||
public static IAlleleEffect effectMoveSpeed;
|
||||
public static IAlleleEffect effectSlowSpeed;
|
||||
public static IAlleleEffect effectWithering;
|
||||
public static IAlleleEffect effectTransmuting;
|
||||
public static IAlleleEffect effectCrumbling;
|
||||
public static IAlleleEffect effectInvisibility;
|
||||
|
||||
public static IAlleleEffect spawnBrainyZombie;
|
||||
public static IAlleleEffect spawnWisp;
|
||||
public static IAlleleEffect spawnBats;
|
||||
public static IAlleleEffect spawnGhast;
|
||||
public static IAlleleEffect spawnSpider;
|
||||
public static IAlleleEffect spawnBlaze;
|
||||
public static IAlleleEffect spawnBlizz;
|
||||
public static IAlleleEffect spawnManaDrainer;
|
||||
public static IAlleleEffect spawnWispOrHecate;
|
||||
|
||||
/*public static IAlleleEffect effectNodeAttract;
|
||||
public static IAlleleEffect effectNodePurify;
|
||||
public static IAlleleEffect effectNodeFlux;
|
||||
public static IAlleleEffect effectNodeCharge;*/
|
||||
|
||||
public static void setupAdditionalAlleles()
|
||||
{
|
||||
forestryBaseEffect = (IAlleleBeeEffect)getBaseAllele("effectNone");
|
||||
|
||||
Allele.speedBlinding = new AlleleFloat("speedBlinding", 2f, false);
|
||||
|
||||
Allele.flowerBookshelf = new AlleleFlower("Bookshelf", new FlowerProviderBookshelf(), true);
|
||||
|
||||
if (ThaumcraftHelper.isActive())
|
||||
{
|
||||
Allele.flowerThaumcraft = new AlleleFlower("ThaumcraftPlant", new FlowerProviderThaumcraftFlower(), false);
|
||||
Allele.flowerAuraNode = new AlleleFlower("AuraNode", new FlowerProviderAuraNode(), true);
|
||||
|
||||
Allele.spawnBrainyZombie = new AlleleEffectSpawnMob("Brainy", false, ThaumcraftHelper.Entity.BRAINY_ZOMBIE.entityID)
|
||||
.setAggrosPlayerOnSpawn().setThrottle(800).setSpawnsOnPlayerNear(null).setMaxMobsInSpawnZone(2);
|
||||
|
||||
Allele.spawnBats = new AlleleEffectSpawnMob("Batty", false, ThaumcraftHelper.Entity.FIREBAT.entityID)
|
||||
.setThrottle(300).setSpawnsOnPlayerNear("Bat");
|
||||
|
||||
Allele.spawnWisp = new AlleleEffectSpawnWisp("Wispy", false, ThaumcraftHelper.Entity.WISP.entityID, "thaumcraft.wisplive")
|
||||
.setThrottle(1800).setChanceToSpawn(79);
|
||||
}
|
||||
else
|
||||
{
|
||||
Allele.flowerThaumcraft = Allele.flowerAuraNode = (IAlleleFlowers)Allele.getBaseAllele("flowersVanilla");
|
||||
}
|
||||
|
||||
if (ArsMagicaHelper.isActive())
|
||||
{
|
||||
Allele.flowerArsMagica = new AlleleFlower("flowerArsMagicaPlant", new FlowerProviderArsMagicaFlower(), false);
|
||||
//String id, boolean isDominant, int throttle, String[] mobs, int[] chance
|
||||
Allele.spawnManaDrainer = new AlleleEffectSpawnMobWeighted("ManaDrain", true, 20,
|
||||
new String[] { ArsMagicaHelper.Name + ".MobManaCreeper", ArsMagicaHelper.Name + ".ManaVortex" },
|
||||
new int[] { 60, 2 });
|
||||
|
||||
Allele.spawnWispOrHecate = new AlleleEffectSpawnMobWeighted("AMWisp", true, 20,
|
||||
new String[] { ArsMagicaHelper.Name + ".MobWisp", ArsMagicaHelper.Name + ".MobHecate" },
|
||||
new int[] { 40, 3 });
|
||||
}
|
||||
else
|
||||
{
|
||||
Allele.flowerArsMagica = (IAlleleFlowers)Allele.getBaseAllele("flowersVanilla");
|
||||
Allele.spawnManaDrainer = Allele.spawnWispOrHecate = (IAlleleEffect)Allele.getBaseAllele("effectNone");
|
||||
}
|
||||
|
||||
/*Allele.effectNodeAttract = new AlleleEffectAuraNodeAttract("NodeAttract", false, 400);
|
||||
Allele.effectNodePurify = new AlleleEffectAuraNodePurify("NodePurify", false, 600, 150);
|
||||
Allele.effectNodeFlux = new AlleleEffectAuraNodeFlux("NodeFlux", true, 300, 300);
|
||||
Allele.effectNodeCharge = new AlleleEffectAuraNodeCharge("NodeCharge", true, 1200);*/
|
||||
|
||||
if (ThermalExpansionHelper.isActive())
|
||||
{
|
||||
Allele.spawnBlizz = new AlleleEffectSpawnMob("TEBlizzy", true, ThermalExpansionHelper.Entity.BLIZZ.entityID)
|
||||
.setThrottle(100).setChanceToSpawn(80);
|
||||
}
|
||||
else
|
||||
{
|
||||
Allele.spawnBlizz = (IAlleleEffect)Allele.getBaseAllele("effectNone");
|
||||
}
|
||||
|
||||
Allele.effectCleansing = new AlleleEffectCure("Curative", false);
|
||||
Allele.effectDigSpeed = new AlleleEffectPotion("DigSpeed", Potion.digSpeed, 15, false);
|
||||
Allele.effectMoveSpeed = new AlleleEffectPotion("MoveSpeed", Potion.moveSpeed, 10, false);
|
||||
Allele.effectSlowSpeed = new AlleleEffectPotion("SlowSpeed", Potion.moveSlowdown, 3, false).setMalicious();
|
||||
Allele.effectWithering = new AlleleEffectPotion("Withering", Potion.wither, 10, false).setMalicious();
|
||||
|
||||
Allele.effectTransmuting = new AlleleEffectTransmuting("Transmuting", true);
|
||||
Allele.effectCrumbling = new AlleleEffectCrumbling("Crumbling", true);
|
||||
|
||||
Allele.effectInvisibility = new AlleleEffectPotion("Invisibility", Potion.invisibility, 10, false);
|
||||
|
||||
Allele.spawnGhast = new AlleleEffectSpawnMob("Ghastly", false, "Ghast", "mob.ghast.moan")
|
||||
.setThrottle(2060).setChanceToSpawn(10).setMaxMobsInSpawnZone(1);
|
||||
|
||||
Allele.spawnSpider = new AlleleEffectSpawnMob("Spidery", false, "Spider", "mob.spider.step")
|
||||
.setThrottle(400).setChanceToSpawn(70).setMaxMobsInSpawnZone(4);
|
||||
|
||||
Allele.spawnBlaze = new AlleleEffectSpawnMob("Ablaze", false, "Blaze", "mob.blaze.breathe")
|
||||
.setThrottle(800).setChanceToSpawn(60).setMaxMobsInSpawnZone(2);
|
||||
}
|
||||
|
||||
public static void registerDeprecatedAlleleReplacements()
|
||||
{
|
||||
IAlleleRegistry registry = AlleleManager.alleleRegistry;
|
||||
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.fertilityHighDominant", Allele.getBaseAllele("fertilityHigh"));
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.flowerflowerBookshelf", flowerBookshelf);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speedBlinding", speedBlinding);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.effectNodeAttract", Allele.getBaseAllele("effectBeatific"));
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.effectNodePurify", Allele.getBaseAllele("effectBeatific"));
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.effectNodeFlux", Allele.getBaseAllele("effectBeatific"));
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.effectNodeCharge", Allele.getBaseAllele("effectBeatific"));
|
||||
registry.registerDeprecatedAlleleReplacement("magicbees.effectNodeAttract", Allele.getBaseAllele("effectBeatific"));
|
||||
registry.registerDeprecatedAlleleReplacement("magicbees.effectNodePurify", Allele.getBaseAllele("effectBeatific"));
|
||||
registry.registerDeprecatedAlleleReplacement("magicbees.effectNodeFlux", Allele.getBaseAllele("effectBeatific"));
|
||||
registry.registerDeprecatedAlleleReplacement("magicbees.effectNodeCharge", Allele.getBaseAllele("effectBeatific"));
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.effectCurative", effectCleansing);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.effecteffectDigSpeed", effectDigSpeed);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.effecteffectMoveSpeed", effectMoveSpeed);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.effecteffectSlowSpeed", effectSlowSpeed);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.Ghast", spawnGhast);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.Spider", spawnSpider);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesEsoteric", BeeSpecies.ESOTERIC);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesMysterious", BeeSpecies.MYSTERIOUS);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesArcane", BeeSpecies.ARCANE);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesCharmed", BeeSpecies.CHARMED);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesEnchanted", BeeSpecies.ENCHANTED);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesSupernatural", BeeSpecies.SUPERNATURAL);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesPupil", BeeSpecies.PUPIL);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesScholarly", BeeSpecies.SCHOLARLY);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesSavant", BeeSpecies.SAVANT);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesAware", BeeSpecies.AWARE);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesSpirit", BeeSpecies.SPIRIT);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesSoul", BeeSpecies.SOUL);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesSkulking", BeeSpecies.SKULKING);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesGhastly", BeeSpecies.GHASTLY);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesSpidery", BeeSpecies.SPIDERY);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesTimely", BeeSpecies.TIMELY);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesLordly", BeeSpecies.LORDLY);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesDoctoral", BeeSpecies.DOCTORAL);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesIron", BeeSpecies.IRON);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesGold", BeeSpecies.GOLD);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesCopper", BeeSpecies.COPPER);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesTin", BeeSpecies.TIN);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesSilver", BeeSpecies.SILVER);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesLead", BeeSpecies.LEAD);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesDiamond", BeeSpecies.DIAMOND);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesEmerald", BeeSpecies.EMERALD);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesApatite", BeeSpecies.APATITE);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesStark", BeeSpecies.TC_CHAOS);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesAura", BeeSpecies.TC_AIR);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesIgnis", BeeSpecies.TC_FIRE);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesAqua", BeeSpecies.TC_WATER);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesSolum", BeeSpecies.TC_EARTH);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesPraecantatio", BeeSpecies.TC_ORDER);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesVis", BeeSpecies.TC_VIS);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesPure", BeeSpecies.TC_PURE);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesFlux", BeeSpecies.TC_TAINT);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesNode", BeeSpecies.TC_ATTRACT);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesRejuvenating", BeeSpecies.TC_REJUVENATING);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesBrainy", BeeSpecies.TC_BRAINY);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesGossamer", BeeSpecies.TC_WISPY);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesWispy", BeeSpecies.TC_WISPY);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesBatty", BeeSpecies.TC_BATTY);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesChicken", BeeSpecies.TC_CHICKEN);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesBeef", BeeSpecies.TC_BEEF);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesPork", BeeSpecies.TC_PORK);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesMinium", BeeSpecies.EE_MINIUM);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesEssence", BeeSpecies.AM_ESSENCE);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesQuintessence", BeeSpecies.AM_QUINTESSENCE);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesErde", BeeSpecies.AM_EARTH);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesLuft", BeeSpecies.AM_AIR);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesFeuer", BeeSpecies.AM_FIRE);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesWasser", BeeSpecies.AM_WATER);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesBlitz", BeeSpecies.AM_LIGHTNING);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesStaude", BeeSpecies.AM_PLANT);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesEis", BeeSpecies.AM_ICE);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesMagma", BeeSpecies.AM_FIRE);
|
||||
registry.registerDeprecatedAlleleReplacement("magicbees.speciesMagma", BeeSpecies.AM_FIRE);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesArkanen", BeeSpecies.AM_ARCANE);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesVortex", BeeSpecies.AM_VORTEX);
|
||||
registry.registerDeprecatedAlleleReplacement("thaumicbees.speciesWight", BeeSpecies.AM_WIGHT);
|
||||
}
|
||||
|
||||
public static IAlleleBeeSpecies getBaseSpecies(String name)
|
||||
{
|
||||
return (IAlleleBeeSpecies) AlleleManager.alleleRegistry.getAllele((new StringBuilder()).append("forestry.species").append(name).toString());
|
||||
}
|
||||
|
||||
public static IAlleleBeeSpecies getExtraSpecies(String name)
|
||||
{
|
||||
return (IAlleleBeeSpecies) AlleleManager.alleleRegistry.getAllele((new StringBuilder()).append("extrabees.species.").append(name).toString());
|
||||
}
|
||||
|
||||
public static IAllele getBaseAllele(String name)
|
||||
{
|
||||
return AlleleManager.alleleRegistry.getAllele("forestry." + name);
|
||||
}
|
||||
|
||||
public static IAllele getAllele(String name)
|
||||
{
|
||||
return AlleleManager.alleleRegistry.getAllele(name);
|
||||
}
|
||||
|
||||
private String uid;
|
||||
private boolean dominant;
|
||||
|
||||
public Allele(String id, boolean isDominant)
|
||||
{
|
||||
this.uid = "magicbees." + id;
|
||||
this.dominant = isDominant;
|
||||
AlleleManager.alleleRegistry.registerAllele(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUID()
|
||||
{
|
||||
return this.uid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDominant()
|
||||
{
|
||||
return this.dominant;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return LocalizationManager.getLocalizedString(getUID());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
import magicbees.main.MagicBees;
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
|
||||
public abstract class AlleleEffect extends Allele implements IAlleleBeeEffect
|
||||
{
|
||||
protected int throttle;
|
||||
|
||||
public AlleleEffect(String id, boolean isDominant, int timeout)
|
||||
{
|
||||
super("effect" + id, isDominant);
|
||||
this.throttle = timeout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCombinable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract IEffectData validateStorage(IEffectData storedData);
|
||||
|
||||
@Override
|
||||
public final IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing)
|
||||
{
|
||||
int count = storedData.getInteger(0);
|
||||
if (count >= this.throttle)
|
||||
{
|
||||
storedData = this.doEffectThrottled(genome, storedData, housing);
|
||||
}
|
||||
else
|
||||
{
|
||||
storedData.setInteger(0, count + 1);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param genome
|
||||
* @param storedData
|
||||
* @param housing
|
||||
* @return
|
||||
*/
|
||||
protected abstract IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing);
|
||||
|
||||
@Override
|
||||
public IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing)
|
||||
{
|
||||
return Allele.forestryBaseEffect.doFX(genome, storedData, housing);
|
||||
}
|
||||
|
||||
protected List<Entity> getEntitiesWithinRange(IBeeGenome genome, IBeeHousing housing)
|
||||
{
|
||||
// Get the size of the affected area
|
||||
int[] area = genome.getTerritory();
|
||||
|
||||
// Calculate offset
|
||||
int[] min = new int[3];
|
||||
int[] max = new int[3];
|
||||
min[0] = housing.getXCoord() - area[0] / 2;
|
||||
max[0] = housing.getXCoord() + area[0] / 2;
|
||||
|
||||
min[1] = housing.getYCoord() - area[1] / 2;
|
||||
max[1] = housing.getYCoord() + area[1] / 2;
|
||||
|
||||
min[2] = housing.getZCoord() - area[2] / 2;
|
||||
max[2] = housing.getZCoord() + area[2] / 2;
|
||||
|
||||
AxisAlignedBB bounds = AxisAlignedBB.getAABBPool().getAABB(min[0], min[1], min[2], max[0], max[1], max[2]);
|
||||
return housing.getWorld().getEntitiesWithinAABB(EntityPlayer.class, bounds);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
|
||||
public class AlleleEffectCrumbling extends AlleleEffect
|
||||
{
|
||||
private static HashMap<ItemStack, ItemStack> crumbleMap = new HashMap<ItemStack, ItemStack>();
|
||||
|
||||
public static void addPairToMap(ItemStack source, ItemStack target)
|
||||
{
|
||||
boolean add = true;
|
||||
for (ItemStack i : crumbleMap.keySet())
|
||||
{
|
||||
if (OreDictionary.itemMatches(i, source, false))
|
||||
{
|
||||
add = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (add)
|
||||
{
|
||||
crumbleMap.put(source, target);
|
||||
}
|
||||
}
|
||||
|
||||
public AlleleEffectCrumbling(String id, boolean isDominant)
|
||||
{
|
||||
super(id, isDominant, 600);
|
||||
|
||||
addPairToMap(new ItemStack(Blocks.stone), new ItemStack(Blocks.cobblestone));
|
||||
addPairToMap(new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.mossy_cobblestone));
|
||||
addPairToMap(new ItemStack(Blocks.stonebrick, 1, 0), new ItemStack(Blocks.stonebrick, 1, 2));
|
||||
addPairToMap(new ItemStack(Blocks.stonebrick, 1, 2), new ItemStack(Blocks.stonebrick, 1, 1));
|
||||
addPairToMap(new ItemStack(Blocks.cobblestone_wall), new ItemStack(Blocks.cobblestone_wall, 1, 1));
|
||||
addPairToMap(new ItemStack(Blocks.gravel), new ItemStack(Blocks.sand));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData)
|
||||
{
|
||||
if (storedData == null || !(storedData instanceof magicbees.bees.EffectData))
|
||||
{
|
||||
storedData = new magicbees.bees.EffectData(1, 0, 0);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing)
|
||||
{
|
||||
World world = housing.getWorld();
|
||||
// Get random coords within territory
|
||||
int xCoord = (int)(housing.getTerritoryModifier(genome, 1f) * genome.getTerritory()[0]);
|
||||
xCoord = housing.getXCoord() + world.rand.nextInt(xCoord) - xCoord / 2;
|
||||
int yCoord = (int)(housing.getTerritoryModifier(genome, 1f) * genome.getTerritory()[1]);
|
||||
yCoord = housing.getYCoord() + world.rand.nextInt(yCoord) - yCoord / 2;
|
||||
int zCoord = (int)(housing.getTerritoryModifier(genome, 1f) * genome.getTerritory()[0]);
|
||||
zCoord = housing.getZCoord() + world.rand.nextInt(zCoord) - zCoord / 2;
|
||||
|
||||
boolean success = false;
|
||||
Block block = world.getBlock(xCoord, yCoord, zCoord);
|
||||
if (block != null)
|
||||
{
|
||||
ItemStack source = new ItemStack(block, 1, world.getBlockMetadata(xCoord, yCoord, zCoord));
|
||||
for (ItemStack key : crumbleMap.keySet())
|
||||
{
|
||||
if (OreDictionary.itemMatches(source, key, false))
|
||||
{
|
||||
ItemStack target = crumbleMap.get(key);
|
||||
world.setBlock(xCoord, yCoord, zCoord, Block.getBlockFromItem(target.getItem()),
|
||||
target.getItemDamage(), 2);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
storedData.setInteger(0, 0);
|
||||
|
||||
return storedData;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import magicbees.main.MagicBees;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
|
||||
public class AlleleEffectCure extends AlleleEffect
|
||||
{
|
||||
|
||||
public AlleleEffectCure(String id, boolean isDominant)
|
||||
{
|
||||
super(id, isDominant, 200);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData)
|
||||
{
|
||||
if (storedData == null)
|
||||
{
|
||||
storedData = new EffectData(1, 0, 0);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing)
|
||||
{
|
||||
List<Entity> entityList = this.getEntitiesWithinRange(genome, housing);
|
||||
|
||||
for (Entity e : entityList)
|
||||
{
|
||||
if (e instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer)e;
|
||||
player.curePotionEffects(new ItemStack(Items.milk_bucket));
|
||||
}
|
||||
}
|
||||
storedData.setInteger(0, 0);
|
||||
|
||||
return storedData;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import magicbees.item.ItemArmorApiarist;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
|
||||
public class AlleleEffectPotion extends AlleleEffect
|
||||
{
|
||||
private int potionId;
|
||||
private int duration;
|
||||
private boolean isMalicious;
|
||||
|
||||
public AlleleEffectPotion(String name, Potion potionApplied, int effectDuration, boolean isDominant)
|
||||
{
|
||||
super(name, isDominant, 200);
|
||||
this.potionId = potionApplied.id;
|
||||
this.duration = 20 * effectDuration;
|
||||
this.isMalicious = false;
|
||||
}
|
||||
|
||||
public AlleleEffectPotion setMalicious()
|
||||
{
|
||||
this.isMalicious = true;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData)
|
||||
{
|
||||
if (storedData == null)
|
||||
{
|
||||
storedData = new EffectData(1, 0, 0);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing)
|
||||
{
|
||||
List<Entity> entityList = this.getEntitiesWithinRange(genome, housing);
|
||||
|
||||
for (Entity e : entityList)
|
||||
{
|
||||
if (e instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer)e;
|
||||
if (this.isMalicious)
|
||||
{
|
||||
int armorPieces = ItemArmorApiarist.getNumberPiecesWorn(player);
|
||||
int finalDuration = this.duration / 4 * (4 - armorPieces);
|
||||
if (finalDuration > 0)
|
||||
{
|
||||
player.addPotionEffect(new PotionEffect(this.potionId, finalDuration, 0));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.addPotionEffect(new PotionEffect(this.potionId, this.duration, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
storedData.setInteger(0, 0);
|
||||
|
||||
return storedData;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import magicbees.item.ItemArmorApiarist;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
|
||||
public class AlleleEffectSpawnMob extends AlleleEffect
|
||||
{
|
||||
protected boolean aggosOnPlayer;
|
||||
protected boolean spawnsWhilePlayerNear;
|
||||
protected String alternateMob;
|
||||
protected String mobName;
|
||||
protected String mobSound;
|
||||
protected int chanceToSpawn;
|
||||
protected int maxMobsInArea;
|
||||
|
||||
public AlleleEffectSpawnMob(String id, boolean isDominant, String mobToSpawn)
|
||||
{
|
||||
this(id, isDominant, mobToSpawn, null);
|
||||
}
|
||||
|
||||
public AlleleEffectSpawnMob(String id, boolean isDominant, String mobToSpawn, String mobSoundFx)
|
||||
{
|
||||
super(id, isDominant, 200);
|
||||
this.aggosOnPlayer = false;
|
||||
this.mobName = mobToSpawn;
|
||||
this.chanceToSpawn = 100;
|
||||
this.maxMobsInArea = 6;
|
||||
this.mobSound = mobSoundFx;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData)
|
||||
{
|
||||
if (storedData == null || !(storedData instanceof magicbees.bees.EffectData))
|
||||
{
|
||||
// Throttle; Ready to spawn
|
||||
storedData = new EffectData(1, 1, 0);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing)
|
||||
{
|
||||
// Check if we're ready to spawn the mob.
|
||||
if (storedData.getBoolean(0))
|
||||
{
|
||||
World w = housing.getWorld();
|
||||
|
||||
int roll = w.rand.nextInt(100);
|
||||
|
||||
if (roll <= this.chanceToSpawn)
|
||||
{
|
||||
if (this.spawnsWhilePlayerNear)
|
||||
{
|
||||
List<Entity> entities = this.getEntitiesWithinRange(genome, housing);
|
||||
EntityPlayer target = null;
|
||||
for (Entity e : entities)
|
||||
{
|
||||
if (e instanceof EntityPlayer)
|
||||
{
|
||||
target = (EntityPlayer)e;
|
||||
// Check for wearing armor & cancel
|
||||
if (ItemArmorApiarist.getNumberPiecesWorn(target) >= 4)
|
||||
{
|
||||
// Full armor suit is treated as "invisible."
|
||||
target = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Let's spawn a mob. =D
|
||||
if (target != null)
|
||||
{
|
||||
storedData.setBoolean(0, !this.spawnMob(genome, target, w, housing, false));
|
||||
}
|
||||
else if (this.alternateMob != null)
|
||||
{
|
||||
storedData.setBoolean(0, !this.spawnMob(genome, null, w, housing, true));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
storedData.setBoolean(0, !this.spawnMob(genome, null, w, housing, true));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.mobSound != null && w.rand.nextInt(100) < 35)
|
||||
{
|
||||
int range = genome.getTerritory()[0];
|
||||
double x = housing.getXCoord() + w.rand.nextDouble() * (range * 2) - range;
|
||||
range = genome.getTerritory()[1];
|
||||
double y = housing.getYCoord() + w.rand.nextDouble() * (range * 2) - range;
|
||||
range = genome.getTerritory()[2];
|
||||
double z = housing.getZCoord() + w.rand.nextDouble() * (range * 2) - range;
|
||||
w.playSoundEffect(x, y, z, this.mobSound, 0.5f,
|
||||
(w.rand.nextFloat() - w.rand.nextFloat()) * 0.2f + 1.0f);
|
||||
}
|
||||
storedData.setBoolean(0, true);
|
||||
}
|
||||
}
|
||||
|
||||
return storedData;
|
||||
}
|
||||
|
||||
protected boolean spawnMob(IBeeGenome bee, EntityPlayer player, World world, IBeeHousing housing, boolean spawnAlternate)
|
||||
{
|
||||
boolean spawnedFlag = false;
|
||||
|
||||
|
||||
EntityLiving mob;
|
||||
if (spawnAlternate && this.alternateMob != null)
|
||||
{
|
||||
mob = (EntityLiving) EntityList.createEntityByName(this.alternateMob, world);
|
||||
}
|
||||
else
|
||||
{
|
||||
mob = (EntityLiving) EntityList.createEntityByName(this.mobName, world);
|
||||
}
|
||||
|
||||
if (mob != null)
|
||||
{
|
||||
double pos[] = this.randomMobSpawnCoords(world, bee, housing);
|
||||
|
||||
int entitiesCount = world.getEntitiesWithinAABB(mob.getClass(),
|
||||
AxisAlignedBB.getBoundingBox((int)pos[0], (int)pos[1], (int)pos[2], (int)pos[0] + 1, (int)pos[1] + 1, (int)pos[2] + 1)
|
||||
.expand(8.0D, 4.0D, 8.0D)).size();
|
||||
|
||||
mob.setPositionAndRotation(pos[0], pos[1], pos[2], world.rand.nextFloat() * 360f, 0f);
|
||||
|
||||
if (entitiesCount < this.maxMobsInArea && mob.getCanSpawnHere())
|
||||
{
|
||||
spawnedFlag = world.spawnEntityInWorld(mob);
|
||||
if (this.aggosOnPlayer && player != null)
|
||||
{
|
||||
if (ItemArmorApiarist.getNumberPiecesWorn(player) < 4)
|
||||
{
|
||||
// Protect fully suited player from initial murder intent.
|
||||
mob.setAttackTarget(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return spawnedFlag;
|
||||
}
|
||||
|
||||
public AlleleEffectSpawnMob setSpawnsOnPlayerNear(String alternateMobToSpawn)
|
||||
{
|
||||
this.spawnsWhilePlayerNear = true;
|
||||
this.alternateMob = alternateMobToSpawn;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public AlleleEffectSpawnMob setAggrosPlayerOnSpawn()
|
||||
{
|
||||
this.aggosOnPlayer = true;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public AlleleEffectSpawnMob setThrottle(int val)
|
||||
{
|
||||
this.throttle = val;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public AlleleEffectSpawnMob setChanceToSpawn(int value)
|
||||
{
|
||||
this.chanceToSpawn = value;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public AlleleEffectSpawnMob setMaxMobsInSpawnZone(int value)
|
||||
{
|
||||
this.maxMobsInArea = value;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
protected double[] randomMobSpawnCoords(World world, IBeeGenome bee, IBeeHousing housing)
|
||||
{
|
||||
double pos[] = new double[3];
|
||||
pos[0] = housing.getXCoord() + (world.rand.nextDouble() * (bee.getTerritory()[0] * housing.getTerritoryModifier(bee, 1f)) - bee.getTerritory()[0] / 2);
|
||||
pos[1] = housing.getYCoord() + world.rand.nextInt(3) - 1;
|
||||
pos[2] = housing.getZCoord() + (world.rand.nextDouble() * (bee.getTerritory()[2] * housing.getTerritoryModifier(bee, 1f)) - bee.getTerritory()[2] / 2);
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.world.World;
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
|
||||
public class AlleleEffectSpawnMobWeighted extends AlleleEffect
|
||||
{
|
||||
private String[] entityNames;
|
||||
private int[] spawnChance;
|
||||
|
||||
public AlleleEffectSpawnMobWeighted(String id, boolean isDominant, int throttle, String[] mobs, int[] chance)
|
||||
{
|
||||
super(id, isDominant, throttle);
|
||||
if (mobs.length != chance.length)
|
||||
{
|
||||
throw new IllegalArgumentException("Array lengths must be equal!");
|
||||
}
|
||||
this.entityNames = mobs;
|
||||
this.spawnChance = chance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData)
|
||||
{
|
||||
if (storedData == null || !(storedData instanceof magicbees.bees.EffectData))
|
||||
{
|
||||
storedData = new EffectData(1, 0, 0);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing)
|
||||
{
|
||||
if (this.spawnMob(genome, housing))
|
||||
{
|
||||
storedData.setInteger(0, 0);
|
||||
}
|
||||
|
||||
return storedData;
|
||||
}
|
||||
|
||||
protected boolean spawnMob(IBeeGenome genome, IBeeHousing housing)
|
||||
{
|
||||
boolean flag = false;
|
||||
|
||||
World w = housing.getWorld();
|
||||
int roll = 0;
|
||||
|
||||
for (int i = 0; i < this.spawnChance.length && !flag; ++i)
|
||||
{
|
||||
roll = 100 - w.rand.nextInt(100)+1;
|
||||
if (roll < this.spawnChance[i])
|
||||
{
|
||||
flag = true;
|
||||
Entity mob = EntityList.createEntityByName(this.entityNames[i], w);
|
||||
double[] coords = this.randomMobSpawnCoords(w, genome, housing);
|
||||
|
||||
mob.setPositionAndRotation(coords[0], coords[1], coords[2], w.rand.nextFloat() * 360f, 0f);
|
||||
if (mob instanceof EntityLiving)
|
||||
{
|
||||
if (((EntityLiving)mob).getCanSpawnHere())
|
||||
{
|
||||
w.spawnEntityInWorld(mob);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
w.spawnEntityInWorld(mob);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
protected double[] randomMobSpawnCoords(World world, IBeeGenome bee, IBeeHousing housing)
|
||||
{
|
||||
double pos[] = new double[3];
|
||||
pos[0] = housing.getXCoord() + world.rand.nextDouble() * (bee.getTerritory()[0] * housing.getTerritoryModifier(bee, 1f)) - bee.getTerritory()[0] / 2;
|
||||
pos[1] = housing.getYCoord() + world.rand.nextDouble() * (bee.getTerritory()[1] * housing.getTerritoryModifier(bee, 1f)) - bee.getTerritory()[1] / 2;
|
||||
pos[2] = housing.getZCoord() + world.rand.nextDouble() * (bee.getTerritory()[2] * housing.getTerritoryModifier(bee, 1f)) - bee.getTerritory()[2] / 2;
|
||||
return pos;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import magicbees.item.ItemArmorApiarist;
|
||||
import magicbees.main.utils.compat.ThaumcraftHelper;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class AlleleEffectSpawnWisp extends AlleleEffectSpawnMob
|
||||
{
|
||||
|
||||
private byte[] wispTypes = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47 };
|
||||
|
||||
public AlleleEffectSpawnWisp(String id, boolean isDominant, String mobToSpawn, String soundToPlay)
|
||||
{
|
||||
super(id, isDominant, mobToSpawn, soundToPlay);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean spawnMob(IBeeGenome bee, EntityPlayer player, World world, IBeeHousing housing, boolean spawnAlternate)
|
||||
{
|
||||
boolean spawnedFlag = false;
|
||||
|
||||
EntityLiving mob;
|
||||
if (spawnAlternate && this.alternateMob != null)
|
||||
{
|
||||
mob = (EntityLiving) EntityList.createEntityByName(this.alternateMob, world);
|
||||
}
|
||||
else
|
||||
{
|
||||
mob = (EntityLiving) EntityList.createEntityByName(this.mobName, world);
|
||||
}
|
||||
|
||||
if (mob != null)
|
||||
{
|
||||
double pos[] = this.randomMobSpawnCoords(world, bee, housing);
|
||||
|
||||
int entitiesCount = world.getEntitiesWithinAABB(mob.getClass(),
|
||||
AxisAlignedBB.getBoundingBox((int)pos[0], (int)pos[1], (int)pos[2], (int)pos[0] + 1, (int)pos[1] + 1, (int)pos[2] + 1)
|
||||
.expand(8.0D, 4.0D, 8.0D)).size();
|
||||
|
||||
mob.setPositionAndRotation(pos[0], pos[1], pos[2], world.rand.nextFloat() * 360f, 0f);
|
||||
|
||||
if (entitiesCount < this.maxMobsInArea && mob.getCanSpawnHere())
|
||||
{
|
||||
// Try some Reflection on TC code. This could be dangerous.
|
||||
try
|
||||
{
|
||||
Class wispEntity = Class.forName(ThaumcraftHelper.Entity.WISP.getClassName());
|
||||
Field type = wispEntity.getDeclaredField("type");
|
||||
type.setByte(mob, wispTypes[world.rand.nextInt(wispTypes.length)]);
|
||||
}
|
||||
catch (Exception e) { /*Last time I had a request to post error messages, I regretted it.*/ }
|
||||
|
||||
spawnedFlag = world.spawnEntityInWorld(mob);
|
||||
if (this.aggosOnPlayer && player != null)
|
||||
{
|
||||
if (ItemArmorApiarist.getNumberPiecesWorn(player) < 4)
|
||||
{
|
||||
// Protect fully suited player from initial murder intent.
|
||||
mob.setAttackTarget(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return spawnedFlag;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
|
||||
public class AlleleEffectTransmuting extends AlleleEffect
|
||||
{
|
||||
public AlleleEffectTransmuting(String id, boolean isDominant)
|
||||
{
|
||||
super(id, isDominant, 200);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData)
|
||||
{
|
||||
if (storedData == null || !(storedData instanceof magicbees.bees.EffectData))
|
||||
{
|
||||
storedData = new magicbees.bees.EffectData(1, 0, 0);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing)
|
||||
{
|
||||
World world = housing.getWorld();
|
||||
// Get random coords within territory
|
||||
int xCoord = (int)(housing.getTerritoryModifier(genome, 1f) * genome.getTerritory()[0]);
|
||||
xCoord = housing.getXCoord() + world.rand.nextInt(xCoord) - xCoord / 2;
|
||||
int yCoord = (int)(housing.getTerritoryModifier(genome, 1f) * genome.getTerritory()[1]);
|
||||
yCoord = housing.getYCoord() + world.rand.nextInt(yCoord) - yCoord / 2;
|
||||
int zCoord = (int)(housing.getTerritoryModifier(genome, 1f) * genome.getTerritory()[0]);
|
||||
zCoord = housing.getZCoord() + world.rand.nextInt(zCoord) - zCoord / 2;
|
||||
|
||||
BiomeGenBase biome = world.getBiomeGenForCoords(xCoord, zCoord);
|
||||
TransmutationEffectController.instance.attemptTransmutations(world, biome,
|
||||
new ItemStack(world.getBlock(xCoord, yCoord, zCoord), 1, world.getBlockMetadata(xCoord, yCoord, zCoord)),
|
||||
xCoord, yCoord, zCoord);
|
||||
|
||||
storedData.setInteger(0, 0);
|
||||
|
||||
return storedData;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import forestry.api.genetics.IAlleleFloat;
|
||||
|
||||
public class AlleleFloat extends Allele implements IAlleleFloat
|
||||
{
|
||||
private float value;
|
||||
|
||||
public AlleleFloat(String id, float val, boolean isDominant)
|
||||
{
|
||||
super(id, isDominant);
|
||||
this.value = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getValue()
|
||||
{
|
||||
return this.value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAlleleFlowers;
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
|
||||
public class AlleleFlower extends Allele implements IAlleleFlowers
|
||||
{
|
||||
private String uid;
|
||||
private IFlowerProvider provider;
|
||||
|
||||
public AlleleFlower(String uid, IFlowerProvider flowerProvider, boolean isDominant)
|
||||
{
|
||||
super("flower" + uid, isDominant);
|
||||
this.provider = flowerProvider;
|
||||
|
||||
AlleleManager.alleleRegistry.registerAllele(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerProvider getProvider()
|
||||
{
|
||||
return this.provider;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
|
||||
public class AlleleInteger extends Allele implements IAlleleInteger
|
||||
{
|
||||
private int value;
|
||||
|
||||
public AlleleInteger(String id, int val, boolean isDominant)
|
||||
{
|
||||
super(id, isDominant);
|
||||
this.value = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getValue()
|
||||
{
|
||||
return this.value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
|
||||
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IClassification;
|
||||
|
||||
public enum BeeClassification implements IClassification
|
||||
{
|
||||
VEILED("Veiled", "Velatapis"),
|
||||
ARCANE("Arcane", "Arcanapis"),
|
||||
SUPERNATURAL("Supernatural", "Occultapis"),
|
||||
SCHOLARLY("Scholarly", "Doctapis"),
|
||||
SKULKING("Skulking", "Malevolenapis"),
|
||||
MAGICAL("Magic", "Magicapis"),
|
||||
TIME("Time", "Tempestivapis"),
|
||||
SOUL("Soul", "Animapis"),
|
||||
|
||||
ABOMINABLE("Abominable", "Detestabilapis"),
|
||||
EXTRINSIC("Extrinsic", "Extrarapis"),
|
||||
|
||||
METALLIC("Metallic", "Metalliapis"),
|
||||
GEM("Gem", "Lapidapis"),
|
||||
TRANSMUTING("Transmuting", "Transmutapis"),
|
||||
|
||||
THAUMIC("Thaumic", "Thaumiapis"),
|
||||
FLESHY("Fleshy", "Carnosapis"),
|
||||
|
||||
ALCHEMICAL("Alchemical", "Alchimiapis"),
|
||||
|
||||
ESSENTIAL("Essential", "Essentiapis"),
|
||||
|
||||
THERMAL ("Thermal", "Thermametallic"),
|
||||
ADORABLE ("Adorable", "Amabilis"),
|
||||
;
|
||||
|
||||
private String uID;
|
||||
private String latin;
|
||||
private ArrayList<IAlleleSpecies> species;
|
||||
private IClassification parent;
|
||||
private EnumClassLevel level;
|
||||
|
||||
private BeeClassification(String name, String scientific)
|
||||
{
|
||||
this.uID = "classification." + name.toLowerCase();
|
||||
this.latin = scientific;
|
||||
this.level = EnumClassLevel.GENUS;
|
||||
this.species = new ArrayList();
|
||||
this.parent = AlleleManager.alleleRegistry.getClassification("family.apidae");
|
||||
AlleleManager.alleleRegistry.registerClassification(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumClassLevel getLevel()
|
||||
{
|
||||
return this.level;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUID()
|
||||
{
|
||||
return this.uID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return LocalizationManager.getLocalizedString(getUID());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getScientific()
|
||||
{
|
||||
return this.latin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription()
|
||||
{
|
||||
return LocalizationManager.getLocalizedString(getUID() + ".description");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IClassification[] getMemberGroups()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMemberGroup(IClassification group)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleSpecies[] getMemberSpecies()
|
||||
{
|
||||
return this.species.toArray(new IAlleleSpecies[this.species.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMemberSpecies(IAlleleSpecies species)
|
||||
{
|
||||
if (!this.species.contains(species))
|
||||
{
|
||||
this.species.add(species);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IClassification getParent()
|
||||
{
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParent(IClassification parent)
|
||||
{
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,26 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import forestry.api.apiculture.IBeeRoot;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import magicbees.block.types.HiveType;
|
||||
import magicbees.item.types.DropType;
|
||||
import magicbees.main.Config;
|
||||
|
||||
public class BeeManager
|
||||
{
|
||||
public static IBeeRoot beeRoot;
|
||||
|
||||
public static void ititializeBees()
|
||||
{
|
||||
beeRoot = (IBeeRoot)AlleleManager.alleleRegistry.getSpeciesRoot("rootBees");
|
||||
|
||||
Allele.setupAdditionalAlleles();
|
||||
BeeSpecies.setupBeeSpecies();
|
||||
Allele.registerDeprecatedAlleleReplacements();
|
||||
BeeMutation.setupMutations();
|
||||
|
||||
HiveType.initHiveData();
|
||||
|
||||
beeRoot.setResearchSuitability(Config.drops.getStackForType(DropType.INTELLECT), 0.5f);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,599 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import magicbees.main.utils.MoonPhase;
|
||||
import magicbees.main.utils.compat.ArsMagicaHelper;
|
||||
import magicbees.main.utils.compat.EquivalentExchangeHelper;
|
||||
import magicbees.main.utils.compat.ExtraBeesHelper;
|
||||
import magicbees.main.utils.compat.ForestryHelper;
|
||||
import magicbees.main.utils.compat.ThaumcraftHelper;
|
||||
import magicbees.main.utils.compat.ThermalExpansionHelper;
|
||||
import magicbees.main.utils.compat.RedstoneArsenalHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import net.minecraftforge.common.BiomeDictionary.Type;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeMutation;
|
||||
import forestry.api.apiculture.IBeeRoot;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IGenome;
|
||||
|
||||
public class BeeMutation implements IBeeMutation
|
||||
{
|
||||
public static void setupMutations()
|
||||
{
|
||||
IAlleleBeeSpecies baseA, baseB;
|
||||
BeeMutation mutation;
|
||||
|
||||
// Forestry + These -> Common
|
||||
|
||||
BeeSpecies[] magicMundane = new BeeSpecies[] { BeeSpecies.MYSTICAL, BeeSpecies.SORCEROUS, BeeSpecies.UNUSUAL, BeeSpecies.ATTUNED };
|
||||
String[] forestryMundane = new String[] { "Forest", "Meadows", "Modest", "Wintry", "Tropical", "Marshy" };
|
||||
String[] binnieMundane = new String[] { "marble", "rock", "water", "basalt" };
|
||||
|
||||
for (BeeSpecies species : magicMundane)
|
||||
{
|
||||
for (String str : forestryMundane)
|
||||
{
|
||||
new BeeMutation(species, Allele.getBaseSpecies(str), ForestryHelper.getTemplateForestryForSpecies("Common"), 15);
|
||||
}
|
||||
if (ExtraBeesHelper.isActive())
|
||||
{
|
||||
for (String str : binnieMundane)
|
||||
{
|
||||
FMLLog.info("Registering %s", str);
|
||||
try {
|
||||
new BeeMutation(species, Allele.getExtraSpecies(str), ForestryHelper.getTemplateForestryForSpecies("Common"), 15);
|
||||
} catch (Exception e) {
|
||||
FMLLog.info("Unable to register! This mutation will not be available.");
|
||||
}
|
||||
}
|
||||
}
|
||||
new BeeMutation(species, Allele.getBaseSpecies("Common"), ForestryHelper.getTemplateForestryForSpecies("Cultivated"), 12);
|
||||
new BeeMutation(species, Allele.getBaseSpecies("Cultivated"), BeeSpecies.ELDRITCH, 12);
|
||||
}
|
||||
|
||||
new BeeMutation(Allele.getBaseSpecies("Cultivated"), BeeSpecies.ELDRITCH, BeeSpecies.ESOTERIC, 10);
|
||||
new BeeMutation(BeeSpecies.ELDRITCH, BeeSpecies.ESOTERIC, BeeSpecies.MYSTERIOUS, 8);
|
||||
new BeeMutation(BeeSpecies.ESOTERIC, BeeSpecies.MYSTERIOUS, BeeSpecies.ARCANE, 8)
|
||||
.setMoonPhaseBonus(MoonPhase.WAXING_CRESCENT, MoonPhase.WAXING_GIBBOUS, 1.2f);
|
||||
|
||||
new BeeMutation(Allele.getBaseSpecies("Cultivated"), BeeSpecies.ELDRITCH, BeeSpecies.CHARMED, 10);
|
||||
new BeeMutation(BeeSpecies.ELDRITCH, BeeSpecies.CHARMED, BeeSpecies.ENCHANTED, 8);
|
||||
new BeeMutation(BeeSpecies.CHARMED, BeeSpecies.ENCHANTED, BeeSpecies.SUPERNATURAL, 8)
|
||||
.setMoonPhaseBonus(MoonPhase.WANING_GIBBOUS, MoonPhase.WANING_CRESCENT, 1.2f);
|
||||
|
||||
new BeeMutation(BeeSpecies.ARCANE, BeeSpecies.SUPERNATURAL, BeeSpecies.ETHEREAL, 7);
|
||||
|
||||
new BeeMutation(BeeSpecies.SUPERNATURAL, BeeSpecies.ETHEREAL, BeeSpecies.WINDY, 14)
|
||||
.setBlockRequired(Blocks.leaves);
|
||||
new BeeMutation(BeeSpecies.SUPERNATURAL, BeeSpecies.ETHEREAL, BeeSpecies.WATERY, 14)
|
||||
.setBlockRequired(Blocks.water);
|
||||
new BeeMutation(BeeSpecies.SUPERNATURAL, BeeSpecies.ETHEREAL, BeeSpecies.EARTHY, 100)//14)
|
||||
.setBlockRequired(Blocks.brick_block);
|
||||
new BeeMutation(BeeSpecies.SUPERNATURAL, BeeSpecies.ETHEREAL, BeeSpecies.FIREY, 14)
|
||||
.setBlockRequired(Blocks.lava);
|
||||
|
||||
new BeeMutation(BeeSpecies.ETHEREAL, BeeSpecies.ATTUNED, BeeSpecies.AWARE, 10);
|
||||
new BeeMutation(BeeSpecies.ETHEREAL, BeeSpecies.AWARE, BeeSpecies.SPIRIT, 8);
|
||||
new BeeMutation(BeeSpecies.ATTUNED, BeeSpecies.AWARE, BeeSpecies.SPIRIT, 8);
|
||||
new BeeMutation(BeeSpecies.AWARE, BeeSpecies.SPIRIT, BeeSpecies.SOUL, 7);
|
||||
|
||||
new BeeMutation(Allele.getBaseSpecies("Monastic"), BeeSpecies.ARCANE, BeeSpecies.PUPIL, 10);
|
||||
new BeeMutation(BeeSpecies.ARCANE, BeeSpecies.PUPIL, BeeSpecies.SCHOLARLY, 8);
|
||||
new BeeMutation(BeeSpecies.PUPIL, BeeSpecies.SCHOLARLY, BeeSpecies.SAVANT, 6);
|
||||
|
||||
new BeeMutation(Allele.getBaseSpecies("Imperial"), BeeSpecies.ETHEREAL, BeeSpecies.TIMELY, 8);
|
||||
new BeeMutation(Allele.getBaseSpecies("Imperial"), BeeSpecies.TIMELY, BeeSpecies.LORDLY, 8);
|
||||
new BeeMutation(BeeSpecies.TIMELY, BeeSpecies.LORDLY, BeeSpecies.DOCTORAL, 7);
|
||||
|
||||
new BeeMutation(BeeSpecies.INFERNAL, BeeSpecies.ELDRITCH, BeeSpecies.HATEFUL, 9)
|
||||
.setBiomeRequired(BiomeDictionary.Type.NETHER);
|
||||
new BeeMutation(BeeSpecies.INFERNAL, BeeSpecies.HATEFUL, BeeSpecies.SPITEFUL, 7)
|
||||
.setBiomeRequired(BiomeDictionary.Type.NETHER);
|
||||
new BeeMutation(Allele.getBaseSpecies("Demonic"), BeeSpecies.SPITEFUL, BeeSpecies.WITHERING, 6)
|
||||
.setBiomeRequired(BiomeDictionary.Type.NETHER);
|
||||
|
||||
new BeeMutation(Allele.getBaseSpecies("Modest"), BeeSpecies.ELDRITCH, BeeSpecies.SKULKING, 12);
|
||||
new BeeMutation(Allele.getBaseSpecies("Tropical"), BeeSpecies.SKULKING, BeeSpecies.SPIDERY, 10);
|
||||
new BeeMutation(BeeSpecies.SKULKING, BeeSpecies.ETHEREAL, BeeSpecies.GHASTLY, 9);
|
||||
new BeeMutation(BeeSpecies.SKULKING, BeeSpecies.HATEFUL, BeeSpecies.SMOULDERING, 7)
|
||||
.setBiomeRequired(BiomeDictionary.Type.NETHER);
|
||||
|
||||
new BeeMutation(BeeSpecies.ETHEREAL, BeeSpecies.OBLIVION, BeeSpecies.NAMELESS, 10);
|
||||
new BeeMutation(BeeSpecies.OBLIVION, BeeSpecies.NAMELESS, BeeSpecies.ABANDONED, 8);
|
||||
new BeeMutation(BeeSpecies.NAMELESS, BeeSpecies.ABANDONED, BeeSpecies.FORLORN, 6);
|
||||
new BeeMutation(Allele.getBaseSpecies("Imperial"), BeeSpecies.ABANDONED, BeeSpecies.DRACONIC, 6)
|
||||
.setBiomeRequired(BiomeDictionary.Type.END);
|
||||
|
||||
new BeeMutation(BeeSpecies.UNUSUAL, BeeSpecies.ELDRITCH, BeeSpecies.MUTABLE, 12);
|
||||
new BeeMutation(BeeSpecies.UNUSUAL, BeeSpecies.MUTABLE, BeeSpecies.TRANSMUTING, 9);
|
||||
new BeeMutation(BeeSpecies.UNUSUAL, BeeSpecies.MUTABLE, BeeSpecies.CRUMBLING, 9);
|
||||
|
||||
new BeeMutation(BeeSpecies.MYSTICAL, BeeSpecies.MUTABLE, BeeSpecies.INVISIBLE, 15);
|
||||
|
||||
if (BeeSpecies.COPPER.isActive())
|
||||
{
|
||||
new BeeMutation(Allele.getBaseSpecies("Industrious"), Allele.getBaseSpecies("Meadows"), BeeSpecies.COPPER, 12)
|
||||
.setBlockRequired("blockCopper");
|
||||
}
|
||||
if (BeeSpecies.TIN.isActive())
|
||||
{
|
||||
new BeeMutation(Allele.getBaseSpecies("Industrious"), Allele.getBaseSpecies("Forest"), BeeSpecies.TIN, 12)
|
||||
.setBlockRequired("blockTin");
|
||||
}
|
||||
new BeeMutation(Allele.getBaseSpecies("Common"), Allele.getBaseSpecies("Industrious"), BeeSpecies.IRON, 12)
|
||||
.setBlockRequired(Blocks.iron_block);
|
||||
if (BeeSpecies.LEAD.isActive())
|
||||
{
|
||||
baseA = (BeeSpecies.TIN.isActive()) ? BeeSpecies.TIN : (BeeSpecies.COPPER.isActive()) ? BeeSpecies.COPPER : BeeSpecies.IRON;
|
||||
mutation = new BeeMutation(baseA, Allele.getBaseSpecies("Common"), BeeSpecies.LEAD, 10);
|
||||
if (OreDictionary.getOres("blockLead").size() > 0)
|
||||
{
|
||||
mutation.setBlockRequired("blockLead");
|
||||
}
|
||||
}
|
||||
if (BeeSpecies.SILVER.isActive())
|
||||
{
|
||||
mutation = new BeeMutation(Allele.getBaseSpecies("Imperial"), Allele.getBaseSpecies("Modest"), BeeSpecies.SILVER, 8);
|
||||
if (OreDictionary.getOres("blockSilver").size() > 0)
|
||||
{
|
||||
mutation.setBlockRequired("blockSilver");
|
||||
}
|
||||
}
|
||||
baseA = (BeeSpecies.EE_MINIUM.isActive()) ? BeeSpecies.EE_MINIUM : Allele.getBaseSpecies("Imperial");
|
||||
baseB = (BeeSpecies.LEAD.isActive()) ? BeeSpecies.LEAD : BeeSpecies.IRON;
|
||||
new BeeMutation(baseA, baseB, BeeSpecies.GOLD, 8)
|
||||
.setBlockRequired(Blocks.gold_block);
|
||||
|
||||
if (BeeSpecies.ALUMINUM.isActive())
|
||||
{
|
||||
new BeeMutation(Allele.getBaseSpecies("Industrious"), Allele.getBaseSpecies("Cultivated"), BeeSpecies.ALUMINUM, 10)
|
||||
.setBlockRequired("blockAluminum");
|
||||
}
|
||||
if (BeeSpecies.ARDITE.isActive())
|
||||
{
|
||||
new BeeMutation(Allele.getBaseSpecies("Industrious"), BeeSpecies.INFERNAL, BeeSpecies.ARDITE, 9)
|
||||
.setBlockRequired("blockArdite");
|
||||
}
|
||||
if (BeeSpecies.COBALT.isActive())
|
||||
{
|
||||
new BeeMutation(Allele.getBaseSpecies("Imperial"), BeeSpecies.INFERNAL, BeeSpecies.COBALT, 9)
|
||||
.setBlockRequired("blockCobalt");
|
||||
}
|
||||
if (BeeSpecies.MANYULLYN.isActive())
|
||||
{
|
||||
new BeeMutation(BeeSpecies.ARDITE, BeeSpecies.COBALT, BeeSpecies.MANYULLYN, 9)
|
||||
.setBlockRequired("blockManyullyn");
|
||||
}
|
||||
|
||||
new BeeMutation(Allele.getBaseSpecies("Austere"), BeeSpecies.GOLD, BeeSpecies.DIAMOND, 7)
|
||||
.setBlockRequired(Blocks.diamond_block);
|
||||
baseA = (BeeSpecies.SILVER.isActive()) ? BeeSpecies.SILVER : Allele.getBaseSpecies("Imperial");
|
||||
new BeeMutation(Allele.getBaseSpecies("Austere"), baseA, BeeSpecies.EMERALD, 6)
|
||||
.setBlockRequired(Blocks.emerald_block);
|
||||
new BeeMutation(Allele.getBaseSpecies("Rural"), BeeSpecies.COPPER, BeeSpecies.APATITE, 12)
|
||||
.setBlockRequired("oreApatite");
|
||||
|
||||
if (ThaumcraftHelper.isActive())
|
||||
{
|
||||
new BeeMutation(BeeSpecies.WINDY, BeeSpecies.WINDY, BeeSpecies.TC_AIR, 8)
|
||||
.setBlockAndMetaRequired(Config.tcCrystal, ThaumcraftHelper.ShardType.AIR.ordinal());
|
||||
new BeeMutation(BeeSpecies.FIREY, BeeSpecies.FIREY, BeeSpecies.TC_FIRE, 8)
|
||||
.setBlockAndMetaRequired(Config.tcCrystal, ThaumcraftHelper.ShardType.FIRE.ordinal());
|
||||
new BeeMutation(BeeSpecies.WATERY, BeeSpecies.WATERY, BeeSpecies.TC_WATER, 8)
|
||||
.setBlockAndMetaRequired(Config.tcCrystal, ThaumcraftHelper.ShardType.WATER.ordinal());
|
||||
new BeeMutation(BeeSpecies.EARTHY, BeeSpecies.EARTHY, BeeSpecies.TC_EARTH, 8)
|
||||
.setBlockAndMetaRequired(Config.tcCrystal, ThaumcraftHelper.ShardType.EARTH.ordinal());
|
||||
new BeeMutation(BeeSpecies.ETHEREAL, BeeSpecies.ARCANE, BeeSpecies.TC_ORDER, 8)
|
||||
.setBlockAndMetaRequired(Config.tcCrystal, ThaumcraftHelper.ShardType.ORDER.ordinal());
|
||||
new BeeMutation(BeeSpecies.ETHEREAL, BeeSpecies.SUPERNATURAL, BeeSpecies.TC_CHAOS, 8)
|
||||
.setBlockAndMetaRequired(Config.tcCrystal, ThaumcraftHelper.ShardType.CHAOS.ordinal());
|
||||
|
||||
new BeeMutation(BeeSpecies.SKULKING, BeeSpecies.WINDY, BeeSpecies.TC_BATTY, 9);
|
||||
new BeeMutation(BeeSpecies.SKULKING, BeeSpecies.PUPIL, BeeSpecies.TC_BRAINY, 9);
|
||||
new BeeMutation(BeeSpecies.ETHEREAL, BeeSpecies.GHASTLY, BeeSpecies.TC_WISPY, 9)
|
||||
.setMoonPhaseRestricted(MoonPhase.WANING_CRESCENT, MoonPhase.WAXING_CRESCENT);
|
||||
|
||||
new BeeMutation(Allele.getBaseSpecies("Common"), BeeSpecies.SKULKING, BeeSpecies.TC_CHICKEN, 12)
|
||||
.setBiomeRequired(Type.FOREST);
|
||||
new BeeMutation(Allele.getBaseSpecies("Common"), BeeSpecies.SKULKING, BeeSpecies.TC_BEEF, 12)
|
||||
.setBiomeRequired(Type.PLAINS);
|
||||
new BeeMutation(Allele.getBaseSpecies("Common"), BeeSpecies.SKULKING, BeeSpecies.TC_PORK, 12)
|
||||
.setBiomeRequired(Type.MOUNTAIN);
|
||||
}
|
||||
|
||||
if (ArsMagicaHelper.isActive())
|
||||
{
|
||||
new BeeMutation(BeeSpecies.ARCANE, BeeSpecies.ETHEREAL, BeeSpecies.AM_ESSENCE, 10);
|
||||
new BeeMutation(BeeSpecies.ARCANE, BeeSpecies.AM_ESSENCE, BeeSpecies.AM_QUINTESSENCE, 7);
|
||||
|
||||
new BeeMutation(BeeSpecies.AM_ESSENCE, BeeSpecies.WINDY, BeeSpecies.AM_AIR, 10);
|
||||
new BeeMutation(BeeSpecies.AM_ESSENCE, BeeSpecies.EARTHY, BeeSpecies.AM_EARTH, 10);
|
||||
new BeeMutation(BeeSpecies.AM_ESSENCE, BeeSpecies.FIREY, BeeSpecies.AM_FIRE, 10);
|
||||
new BeeMutation(BeeSpecies.AM_ESSENCE, BeeSpecies.WATERY, BeeSpecies.AM_WATER, 10);
|
||||
new BeeMutation(BeeSpecies.AM_ESSENCE, BeeSpecies.ETHEREAL, BeeSpecies.AM_ARCANE, 10);
|
||||
|
||||
new BeeMutation(BeeSpecies.WINDY, BeeSpecies.AM_AIR, BeeSpecies.AM_LIGHTNING, 8);
|
||||
new BeeMutation(BeeSpecies.EARTHY, BeeSpecies.AM_EARTH, BeeSpecies.AM_PLANT, 8);
|
||||
new BeeMutation(BeeSpecies.WATERY, BeeSpecies.AM_WATER, BeeSpecies.AM_ICE, 8);
|
||||
|
||||
new BeeMutation(BeeSpecies.SKULKING, BeeSpecies.AM_ESSENCE, BeeSpecies.AM_VORTEX, 8);
|
||||
new BeeMutation(BeeSpecies.SKULKING, BeeSpecies.GHASTLY, BeeSpecies.AM_WIGHT, 8);
|
||||
}
|
||||
|
||||
if (EquivalentExchangeHelper.isActive())
|
||||
{
|
||||
new BeeMutation(Allele.getBaseSpecies("Frugal"), BeeSpecies.MUTABLE, BeeSpecies.EE_MINIUM, 8);
|
||||
}
|
||||
|
||||
if (RedstoneArsenalHelper.isActive())
|
||||
{
|
||||
new BeeMutation(BeeSpecies.TE_ELECTRUM, BeeSpecies.TE_DESTABILIZED, BeeSpecies.RSA_FLUXED, 10)
|
||||
.setBlockRequired("blockElectrumFlux");
|
||||
}
|
||||
|
||||
if (ThermalExpansionHelper.isActive())
|
||||
{
|
||||
new BeeMutation(BeeSpecies.TIN, BeeSpecies.COPPER, BeeSpecies.TE_BRONZE, 12)
|
||||
.setBlockRequired("blockBronze");
|
||||
|
||||
new BeeMutation(BeeSpecies.GOLD, BeeSpecies.SILVER, BeeSpecies.TE_ELECTRUM, 10)
|
||||
.setBlockRequired("blockElectrum");
|
||||
|
||||
new BeeMutation(BeeSpecies.IRON, BeeSpecies.ESOTERIC, BeeSpecies.TE_NICKEL, 14)
|
||||
.setBlockRequired("blockNickel");
|
||||
|
||||
new BeeMutation(BeeSpecies.IRON, BeeSpecies.TE_NICKEL, BeeSpecies.TE_INVAR, 14)
|
||||
.setBlockRequired("blockInvar");
|
||||
|
||||
new BeeMutation(BeeSpecies.TE_NICKEL, BeeSpecies.TE_INVAR, BeeSpecies.TE_PLATINUM, 10)
|
||||
.setBlockRequired("blockPlatinum");
|
||||
|
||||
new BeeMutation(BeeSpecies.TIN, BeeSpecies.COPPER, BeeSpecies.TE_BRONZE, 12)
|
||||
.setBlockRequired("blockBronze");
|
||||
|
||||
new BeeMutation(BeeSpecies.SPITEFUL, BeeSpecies.TIN, BeeSpecies.TE_COAL, 12)
|
||||
.setBlockRequired(Blocks.coal_ore);
|
||||
|
||||
new BeeMutation(BeeSpecies.SPITEFUL, Allele.getBaseSpecies("Industrious"), BeeSpecies.TE_DESTABILIZED, 12)
|
||||
.setBlockRequired(Blocks.redstone_ore);
|
||||
|
||||
new BeeMutation(BeeSpecies.SMOULDERING, BeeSpecies.INFERNAL, BeeSpecies.TE_LUX, 12)
|
||||
.setBlockRequired(Blocks.glowstone);
|
||||
|
||||
new BeeMutation(BeeSpecies.SMOULDERING, Allele.getBaseSpecies("Austere"), BeeSpecies.TE_DANTE, 12)
|
||||
.setBiomeRequired(BiomeDictionary.Type.NETHER);
|
||||
|
||||
new BeeMutation(BeeSpecies.TE_DANTE, BeeSpecies.TE_COAL, BeeSpecies.TE_PYRO, 8)
|
||||
.setBiomeRequired(BiomeDictionary.Type.NETHER);
|
||||
|
||||
new BeeMutation(BeeSpecies.SKULKING, Allele.getBaseSpecies("Wintry"), BeeSpecies.TE_BLIZZY, 12);
|
||||
|
||||
new BeeMutation(BeeSpecies.TE_BLIZZY, Allele.getBaseSpecies("Icy"), BeeSpecies.TE_GELID, 8);
|
||||
|
||||
new BeeMutation(BeeSpecies.TE_PLATINUM, BeeSpecies.OBLIVION, BeeSpecies.TE_WINSOME, 12);
|
||||
|
||||
new BeeMutation(BeeSpecies.TE_WINSOME, BeeSpecies.TE_COAL, BeeSpecies.TE_ENDEARING, 8)
|
||||
.setBlockRequired("blockEnderium");
|
||||
}
|
||||
}
|
||||
|
||||
private IAllele parent1;
|
||||
private IAllele parent2;
|
||||
private IAllele mutationTemplate[];
|
||||
private int baseChance;
|
||||
private boolean isSecret;
|
||||
private boolean isMoonRestricted;
|
||||
private MoonPhase moonPhaseStart;
|
||||
private MoonPhase moonPhaseEnd;
|
||||
private float moonPhaseMutationBonus;
|
||||
private boolean nodeRequired;
|
||||
private double nodeRange;
|
||||
private boolean requiresBlock;
|
||||
private Block requiredBlock;
|
||||
private int requiredBlockMeta;
|
||||
private String requiredBlockOreDictEntry;
|
||||
private String requiredBlockName;
|
||||
private BiomeDictionary.Type requiredBiomeType;
|
||||
|
||||
public BeeMutation(IAlleleBeeSpecies species0, IAlleleBeeSpecies species1, BeeSpecies resultSpecies, int percentChance)
|
||||
{
|
||||
this(species0, species1, resultSpecies.getGenome(), percentChance);
|
||||
}
|
||||
|
||||
public BeeMutation(IAlleleBeeSpecies species0, IAlleleBeeSpecies species1, IAllele[] resultSpeciesGenome, int percentChance)
|
||||
{
|
||||
this.parent1 = species0;
|
||||
this.parent2 = species1;
|
||||
this.mutationTemplate = resultSpeciesGenome;
|
||||
this.baseChance = percentChance;
|
||||
this.isSecret = false;
|
||||
this.isMoonRestricted = false;
|
||||
this.moonPhaseMutationBonus = -1f;
|
||||
//this.nodeType = null;
|
||||
this.requiresBlock = false;
|
||||
this.requiredBlockMeta = OreDictionary.WILDCARD_VALUE;
|
||||
this.requiredBlockOreDictEntry = null;
|
||||
this.requiredBiomeType = null;
|
||||
this.requiredBlockName = null;
|
||||
|
||||
BeeManager.beeRoot.registerMutation(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(IBeeHousing housing, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1)
|
||||
{
|
||||
float finalChance = 0f;
|
||||
float chance = this.baseChance * 1f;
|
||||
|
||||
if (this.arePartners(allele0, allele1))
|
||||
{
|
||||
// This mutation applies. Continue calculation.
|
||||
if (this.moonPhaseStart != null && this.moonPhaseEnd != null)
|
||||
{
|
||||
// Only occurs during the phases.
|
||||
if (this.isMoonRestricted && !MoonPhase.getMoonPhase(housing.getWorld()).isBetween(this.moonPhaseStart, this.moonPhaseEnd))
|
||||
{
|
||||
chance = 0;
|
||||
}
|
||||
else if (this.moonPhaseMutationBonus != -1f)
|
||||
{
|
||||
// There is a bonus to this mutation during moon phases...
|
||||
if (MoonPhase.getMoonPhase(housing.getWorld()).isBetween(this.moonPhaseStart, this.moonPhaseEnd))
|
||||
{
|
||||
chance = (int)(chance * this.moonPhaseMutationBonus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.requiresBlock)
|
||||
{
|
||||
Block blockBelow;
|
||||
int blockMeta;
|
||||
int i = 1;
|
||||
do
|
||||
{
|
||||
blockBelow = housing.getWorld().getBlock(housing.getXCoord(), housing.getYCoord() - i,
|
||||
housing.getZCoord());
|
||||
blockMeta = housing.getWorld().getBlockMetadata(housing.getXCoord(), housing.getYCoord() - i, housing.getZCoord());
|
||||
++i;
|
||||
}
|
||||
while (blockBelow != null && (blockBelow instanceof IBeeHousing || blockBelow == Config.fAlvearyBlock));
|
||||
|
||||
if (this.requiredBlockOreDictEntry != null)
|
||||
{
|
||||
int dicId = OreDictionary.getOreID(new ItemStack(blockBelow, 1, blockMeta));
|
||||
if (dicId != -1)
|
||||
{
|
||||
if (!OreDictionary.getOreName(dicId).equals(this.requiredBlockOreDictEntry))
|
||||
{
|
||||
chance = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
chance = 0;
|
||||
}
|
||||
}
|
||||
else if (this.requiredBlock != blockBelow || (this.requiredBlockMeta != OreDictionary.WILDCARD_VALUE &&
|
||||
this.requiredBlockMeta != blockMeta))
|
||||
{
|
||||
chance = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.requiredBiomeType != null)
|
||||
{
|
||||
BiomeDictionary.Type[] types = BiomeDictionary.getTypesForBiome(housing.getWorld().getBiomeGenForCoords(housing.getXCoord(), housing.getZCoord()));
|
||||
boolean found = false;
|
||||
for (int i = 0; i < types.length; ++i)
|
||||
{
|
||||
if (this.requiredBiomeType == types[i])
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
chance = 0;
|
||||
}
|
||||
}
|
||||
|
||||
finalChance = Math.round(chance
|
||||
* housing.getMutationModifier((IBeeGenome) genome0,
|
||||
(IBeeGenome) genome1, chance)
|
||||
* BeeManager.beeRoot.getBeekeepingMode(housing.getWorld())
|
||||
.getMutationModifier((IBeeGenome) genome0,
|
||||
(IBeeGenome) genome1, chance));
|
||||
}
|
||||
|
||||
return finalChance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllele getAllele0()
|
||||
{
|
||||
return parent1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllele getAllele1()
|
||||
{
|
||||
return parent2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllele[] getTemplate()
|
||||
{
|
||||
return mutationTemplate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBaseChance()
|
||||
{
|
||||
return baseChance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPartner(IAllele allele)
|
||||
{
|
||||
return parent1.getUID().equals(allele.getUID()) || parent2.getUID().equals(allele.getUID());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllele getPartner(IAllele allele)
|
||||
{
|
||||
IAllele val = parent1;
|
||||
if (val.getUID().equals(allele.getUID()))
|
||||
val = parent2;
|
||||
return val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getSpecialConditions()
|
||||
{
|
||||
ArrayList<String> conditions = new ArrayList<String>();
|
||||
|
||||
if (this.isMoonRestricted && moonPhaseStart != null && moonPhaseEnd != null)
|
||||
{
|
||||
if (moonPhaseStart != moonPhaseEnd)
|
||||
{
|
||||
conditions.add(String.format(LocalizationManager.getLocalizedString("research.requiresPhase"),
|
||||
moonPhaseStart.getLocalizedName(), moonPhaseEnd.getLocalizedName()));
|
||||
}
|
||||
else
|
||||
{
|
||||
conditions.add(String.format(LocalizationManager.getLocalizedString("research.requiresPhaseSingle"),
|
||||
moonPhaseStart.getLocalizedName()));
|
||||
}
|
||||
}
|
||||
|
||||
if (this.requiresBlock)
|
||||
{
|
||||
if (this.requiredBlockName != null)
|
||||
{
|
||||
conditions.add(String.format(LocalizationManager.getLocalizedString("research.requiresBlock"),
|
||||
LocalizationManager.getLocalizedString(this.requiredBlockName)));
|
||||
}
|
||||
else if (this.requiredBlockOreDictEntry != null)
|
||||
{
|
||||
ArrayList<ItemStack> ores = OreDictionary.getOres(this.requiredBlockOreDictEntry);
|
||||
if (ores.size() > 0)
|
||||
{
|
||||
conditions.add(String.format(LocalizationManager.getLocalizedString("research.requiresBlock"), ores.get(0).getDisplayName()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int meta = 0;
|
||||
if (this.requiredBlockMeta != OreDictionary.WILDCARD_VALUE)
|
||||
{
|
||||
meta = this.requiredBlockMeta;
|
||||
}
|
||||
conditions.add(String.format(LocalizationManager.getLocalizedString("research.requiresBlock"),
|
||||
new ItemStack(this.requiredBlock, 1, this.requiredBlockMeta).getDisplayName()));
|
||||
}
|
||||
}
|
||||
|
||||
if (this.requiredBiomeType != null)
|
||||
{
|
||||
String biomeName = this.requiredBiomeType.name().substring(0, 1) + this.requiredBiomeType.name().substring(1).toLowerCase();
|
||||
conditions.add(String.format(LocalizationManager.getLocalizedString("research.requiresBiome"), biomeName));
|
||||
}
|
||||
|
||||
return conditions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeeRoot getRoot()
|
||||
{
|
||||
return BeeManager.beeRoot;
|
||||
}
|
||||
|
||||
public boolean arePartners(IAllele alleleA, IAllele alleleB)
|
||||
{
|
||||
return (this.parent1.getUID().equals(alleleA.getUID())) && this.parent2.getUID().equals(alleleB.getUID()) ||
|
||||
this.parent1.getUID().equals(alleleB.getUID()) && this.parent2.getUID().equals(alleleA.getUID());
|
||||
}
|
||||
|
||||
public BeeMutation setSecret()
|
||||
{
|
||||
this.isSecret = true;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isSecret()
|
||||
{
|
||||
return isSecret;
|
||||
}
|
||||
|
||||
public BeeMutation setBlockRequired(Block block)
|
||||
{
|
||||
this.requiresBlock = true;
|
||||
this.requiredBlock = block;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public BeeMutation setBlockAndMetaRequired(Block block, int meta)
|
||||
{
|
||||
this.requiresBlock = true;
|
||||
this.requiredBlock = block;
|
||||
this.requiredBlockMeta = meta;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public BeeMutation setBlockRequired(String oreDictEntry)
|
||||
{
|
||||
this.requiresBlock = true;
|
||||
this.requiredBlockOreDictEntry = oreDictEntry;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public BeeMutation setBlockRequiredNameOverride(String blockName)
|
||||
{
|
||||
this.requiredBlockName = blockName;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public BeeMutation setMoonPhaseRestricted(MoonPhase begin, MoonPhase end)
|
||||
{
|
||||
this.isMoonRestricted = true;
|
||||
this.moonPhaseStart = begin;
|
||||
this.moonPhaseEnd = end;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public BeeMutation setMoonPhaseBonus(MoonPhase begin, MoonPhase end, float mutationBonus)
|
||||
{
|
||||
this.moonPhaseMutationBonus = mutationBonus;
|
||||
this.moonPhaseStart = begin;
|
||||
this.moonPhaseEnd = end;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public BeeMutation setBiomeRequired(BiomeDictionary.Type biomeType)
|
||||
{
|
||||
this.requiredBiomeType = biomeType;
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,87 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
|
||||
public class EffectData implements IEffectData
|
||||
{
|
||||
private int[] intData;
|
||||
private boolean[] boolData;
|
||||
private float[] floatData;
|
||||
|
||||
public EffectData(int intCount, int boolCount, int floatCount)
|
||||
{
|
||||
this.intData = new int[intCount];
|
||||
this.boolData = new boolean[boolCount];
|
||||
this.floatData = new float[floatCount];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound)
|
||||
{ }
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound)
|
||||
{ }
|
||||
|
||||
@Override
|
||||
public void setInteger(int index, int val)
|
||||
{
|
||||
if (index >= 0 && index < this.intData.length)
|
||||
{
|
||||
this.intData[index] = val;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFloat(int index, float val)
|
||||
{
|
||||
if (index >= 0 && index < this.floatData.length)
|
||||
{
|
||||
this.floatData[index] = val;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBoolean(int index, boolean val)
|
||||
{
|
||||
if (index >= 0 && index < this.boolData.length)
|
||||
{
|
||||
this.boolData[index] = val;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInteger(int index)
|
||||
{
|
||||
int val = 0;
|
||||
if (index >= 0 && index < this.intData.length)
|
||||
{
|
||||
val = this.intData[index];
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFloat(int index)
|
||||
{
|
||||
float val = 0f;
|
||||
if (index >= 0 && index < this.floatData.length)
|
||||
{
|
||||
val = this.floatData[index];
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBoolean(int index)
|
||||
{
|
||||
boolean val = false;
|
||||
if (index >= 0 && index < this.boolData.length)
|
||||
{
|
||||
val = this.boolData[index];
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
|
||||
public class FlowerProviderArsMagicaFlower implements IFlowerProvider
|
||||
{
|
||||
private ItemStack[] flowers = {new ItemStack(Config.amBlackOrchid), new ItemStack(Config.amDesertNova),
|
||||
new ItemStack(Config.amAum), new ItemStack(Config.amWakebloom),
|
||||
new ItemStack(Config.amTarmaRoot) };
|
||||
|
||||
@Override
|
||||
public boolean isAcceptedFlower(World world, IIndividual genome, int x, int y, int z)
|
||||
{
|
||||
boolean flag = false;
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (block == Config.amBlackOrchid || block == Config.amDesertNova ||
|
||||
block == Config.amAum || block == Config.amWakebloom ||
|
||||
block == Config.amTarmaRoot)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean growFlower(World world, IIndividual genome, int x, int y, int z)
|
||||
{
|
||||
boolean flag = false;
|
||||
x = -222; y = 70; z = -51;
|
||||
Block blockDown = world.getBlock(x, y - 1, z);
|
||||
if (world.getBlock(x, y, z).isAir(world, x, y, z))
|
||||
{
|
||||
if (blockDown == Blocks.dirt || blockDown == Blocks.grass)
|
||||
{
|
||||
int dart = world.rand.nextInt(100);
|
||||
Block block;
|
||||
if (dart > 60)
|
||||
{
|
||||
block = Config.amBlackOrchid;
|
||||
}
|
||||
else if (dart > 30)
|
||||
{
|
||||
block = Config.amAum;
|
||||
}
|
||||
else
|
||||
{
|
||||
block = Config.amTarmaRoot;
|
||||
}
|
||||
world.setBlock(x, y, z, block);
|
||||
flag = true;
|
||||
}
|
||||
else if (blockDown == Blocks.sand)
|
||||
{
|
||||
world.setBlock(x, y, z, Config.amDesertNova);
|
||||
flag = true;
|
||||
}
|
||||
else if (blockDown == Blocks.stone)
|
||||
{
|
||||
world.setBlock(x, y, z, Config.amTarmaRoot);
|
||||
flag = true;
|
||||
}
|
||||
else if (blockDown == Blocks.water || blockDown == Blocks.water)
|
||||
{
|
||||
world.setBlock(x, y, z, Config.amWakebloom);
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription()
|
||||
{
|
||||
return LocalizationManager.getLocalizedString("flowerProvider.arsmagica");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] affectProducts(World world, IIndividual genome, int x, int y, int z, ItemStack[] products)
|
||||
{
|
||||
return products;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] getItemStacks()
|
||||
{
|
||||
return this.flowers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable)
|
||||
{
|
||||
return pollinatable.getPlantType().size() > 1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
|
||||
public class FlowerProviderAuraNode implements IFlowerProvider
|
||||
{
|
||||
protected int nodeRange = 70;
|
||||
|
||||
@Override
|
||||
public boolean isAcceptedFlower(World world, IIndividual genome, int x, int y, int z)
|
||||
{
|
||||
return this.isNodeWithinRange(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable)
|
||||
{
|
||||
return pollinatable.getPlantType().size() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean growFlower(World world, IIndividual genome, int x, int y, int z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription()
|
||||
{
|
||||
return LocalizationManager.getLocalizedString("flowerProvider.node");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] affectProducts(World world, IIndividual genome, int x, int y, int z, ItemStack[] products)
|
||||
{
|
||||
return products;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] getItemStacks()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
protected boolean isNodeWithinRange(World w, int x, int y, int z)
|
||||
{
|
||||
boolean nodeNearby = false;
|
||||
/*if (ThaumcraftApi.getClosestAuraWithinRange(w, x, y, z, this.nodeRange) >= 0)
|
||||
{
|
||||
nodeNearby = true;
|
||||
}*/
|
||||
return nodeNearby;
|
||||
}
|
||||
|
||||
/*protected AuraNode getNodeWithinRange(World w, int x, int y, int z)
|
||||
{
|
||||
AuraNode node = null;
|
||||
|
||||
int nodeId = ThaumcraftApi.getClosestAuraWithinRange(w, x, y, z, this.nodeRange);
|
||||
if (nodeId >= 0)
|
||||
{
|
||||
node = ThaumcraftApi.getNodeCopy(nodeId);
|
||||
}
|
||||
|
||||
return node;
|
||||
}*/
|
||||
|
||||
protected ItemStack[] addItemToProducts(ItemStack[] products, ItemStack itemStack)
|
||||
{
|
||||
for (ItemStack stack : products)
|
||||
{
|
||||
if (stack.getItem() == itemStack.getItem() && stack.getItemDamage() == itemStack.getItemDamage())
|
||||
{
|
||||
if (stack.stackSize < stack.getItem().getItemStackLimit(stack))
|
||||
{
|
||||
stack.stackSize += itemStack.stackSize;
|
||||
itemStack.stackSize = Math.max(stack.stackSize - stack.getItem().getItemStackLimit(stack), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (itemStack.stackSize > 0)
|
||||
{
|
||||
ItemStack[] newProducts = new ItemStack[products.length + 1];
|
||||
for (int i = 0; i < products.length; ++i)
|
||||
{
|
||||
newProducts[i] = products[i];
|
||||
}
|
||||
newProducts[products.length] = itemStack;
|
||||
products = newProducts;
|
||||
}
|
||||
|
||||
return products;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
|
||||
public class FlowerProviderBookshelf implements IFlowerProvider
|
||||
{
|
||||
|
||||
public boolean isAcceptedFlower(World world, IIndividual genome, int x, int i, int j)
|
||||
{
|
||||
boolean flag = false;
|
||||
if (world.getBlock(x, i, j) == Blocks.bookshelf)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
public boolean growFlower(World world, IIndividual genome, int x, int i, int j)
|
||||
{
|
||||
// Always return true so the system thinks we grew a flower.
|
||||
// Bees can't grow bookshelves! Are you crazy?!
|
||||
return true;
|
||||
}
|
||||
|
||||
public ItemStack[] affectProducts(World world, IIndividual genome, int x, int i, int j, ItemStack products[])
|
||||
{
|
||||
return products;
|
||||
}
|
||||
|
||||
public ItemStack[] getItemStacks()
|
||||
{
|
||||
return new ItemStack[] { new ItemStack(Blocks.bookshelf) };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable)
|
||||
{
|
||||
EnumSet<EnumPlantType> types = pollinatable.getPlantType();
|
||||
return types.size() > 0 && !types.contains(EnumPlantType.Nether) && !types.contains(EnumPlantType.Water) ;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return LocalizationManager.getLocalizedString("flowerProvider.book");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import magicbees.main.utils.compat.ThaumcraftHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
|
||||
public class FlowerProviderThaumcraftFlower implements IFlowerProvider
|
||||
{
|
||||
private ItemStack[] flowers = {new ItemStack(Config.tcPlant, 1, 2), new ItemStack(Config.tcPlant, 1, 3) };
|
||||
|
||||
@Override
|
||||
public boolean isAcceptedFlower(World world, IIndividual genome, int x, int y, int z)
|
||||
{
|
||||
boolean flag = false;
|
||||
if (world.getBlock(x, y, z) == Config.tcPlant)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta == 2 || meta == 3)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean growFlower(World world, IIndividual genome, int x, int y, int z)
|
||||
{
|
||||
boolean flag = false;
|
||||
Block blockDown = world.getBlock(x, y - 1, z);
|
||||
if (world.getBlock(x, y, z).isAir(world, x, y, z))
|
||||
{
|
||||
if (blockDown == Blocks.dirt || blockDown == Blocks.grass)
|
||||
{
|
||||
world.setBlock(x, y, z, Config.tcPlant, ThaumcraftHelper.BlockPlant.SHIMMERLEAF.ordinal(), 2);
|
||||
flag = true;
|
||||
}
|
||||
else if (blockDown == Blocks.sand)
|
||||
{
|
||||
world.setBlock(x, y, z, Config.tcPlant, ThaumcraftHelper.BlockPlant.CINDERPEARL.ordinal(), 2);
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription()
|
||||
{
|
||||
return LocalizationManager.getLocalizedString("flowerProvider.magic");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] affectProducts(World world, IIndividual genome, int x, int y, int z, ItemStack[] products)
|
||||
{
|
||||
return products;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] getItemStacks()
|
||||
{
|
||||
return this.flowers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable)
|
||||
{
|
||||
return pollinatable.getPlantType().size() > 1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IHiveDrop;
|
||||
import forestry.api.genetics.IAllele;
|
||||
|
||||
public class HiveDrop implements IHiveDrop
|
||||
{
|
||||
private IAllele[] template;
|
||||
private int chance;
|
||||
private ItemStack[] bonus;
|
||||
private float ignoblePercent = 0f;
|
||||
|
||||
public HiveDrop(IAllele[] beeTemplate, ItemStack[] bonusDrops, int dropChance)
|
||||
{
|
||||
this.template = beeTemplate;
|
||||
this.bonus = bonusDrops;
|
||||
this.chance = dropChance;
|
||||
}
|
||||
|
||||
public HiveDrop setIgnoblePercentage(float f)
|
||||
{
|
||||
this.ignoblePercent = f;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private IBee getBee(World w)
|
||||
{
|
||||
IBee bee = BeeManager.beeRoot.getBee(w, BeeManager.beeRoot.templateAsGenome(this.template));
|
||||
if (w.rand.nextFloat() < this.ignoblePercent)
|
||||
{
|
||||
bee.setIsNatural(false);
|
||||
}
|
||||
|
||||
return bee;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPrincess(World world, int x, int y, int z, int fortune)
|
||||
{
|
||||
return BeeManager.beeRoot.getMemberStack(getBee(world), EnumBeeType.PRINCESS.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ItemStack> getDrones(World world, int x, int y, int z, int fortune)
|
||||
{
|
||||
ArrayList<ItemStack> value = new ArrayList<ItemStack>(1);
|
||||
value.add(BeeManager.beeRoot.getMemberStack(getBee(world), EnumBeeType.DRONE.ordinal()));
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ItemStack> getAdditional(World world, int x, int y, int z, int fortune)
|
||||
{
|
||||
ArrayList<ItemStack> value = new ArrayList<ItemStack>(bonus.length);
|
||||
|
||||
for (int i = 0; i < bonus.length; ++i)
|
||||
{
|
||||
value.add(bonus[i].copy());
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChance(World world, int x, int y, int z)
|
||||
{
|
||||
return this.chance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import magicbees.api.MagicBeesAPI;
|
||||
import magicbees.api.bees.ITransmutationEffectController;
|
||||
import magicbees.api.bees.ITransmutationEffectLogic;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
public class TransmutationEffectController implements ITransmutationEffectController
|
||||
{
|
||||
private ArrayList<ITransmutationEffectLogic> logicObjects;
|
||||
static TransmutationEffectController instance;
|
||||
|
||||
public TransmutationEffectController()
|
||||
{
|
||||
logicObjects = new ArrayList<ITransmutationEffectLogic>();
|
||||
logicObjects.add(new TransmutationEffectRailcraft());
|
||||
logicObjects.add(new TransmutationEffectVanilla());
|
||||
MagicBeesAPI.transmutationEffectController = instance = this;
|
||||
}
|
||||
|
||||
public void attemptTransmutations(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z)
|
||||
{
|
||||
boolean done = false;
|
||||
int i = 0;
|
||||
ITransmutationEffectLogic logic;
|
||||
while (!done && i < logicObjects.size())
|
||||
{
|
||||
logic = logicObjects.get(i++);
|
||||
try
|
||||
{
|
||||
done = logic.tryTransmutation(world, biome, sourceBlock, x, y, z);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
done = false;
|
||||
FMLLog.warning("Magic Bees encountered an issue with an ITransmutationEffectLogic provider %s. Debug information follows.", logic.getClass().getName());
|
||||
FMLLog.info(e.getMessage());
|
||||
}
|
||||
|
||||
if (done)
|
||||
{
|
||||
logicObjects.remove(i);
|
||||
logicObjects.add(logic);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addEffectLogic(ITransmutationEffectLogic logic)
|
||||
{
|
||||
if (logic != null && !logicObjects.contains(logic))
|
||||
{
|
||||
logicObjects.add(logic);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import magicbees.api.bees.ITransmutationEffectLogic;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class TransmutationEffectRailcraft implements ITransmutationEffectLogic
|
||||
{
|
||||
@Override
|
||||
public boolean tryTransmutation(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z)
|
||||
{
|
||||
boolean flag = false;
|
||||
if (OreDictionary.itemMatches(new ItemStack(Blocks.stone), sourceBlock, false) ||
|
||||
OreDictionary.itemMatches(new ItemStack(Blocks.cobblestone), sourceBlock, false))
|
||||
{
|
||||
flag = trySpawnQuarriedStone(world, biome, sourceBlock, x, y, z) ||
|
||||
trySpawnAbyssalStone(world, biome, sourceBlock, x, y, z);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
private boolean trySpawnQuarriedStone(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z)
|
||||
{
|
||||
boolean flag = false;
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.FOREST) &&
|
||||
!BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.FROZEN))
|
||||
{
|
||||
ItemStack item = GameRegistry.findItemStack("Railcraft", "cube.stone.quarried", 1);
|
||||
if (item != null)
|
||||
{
|
||||
world.setBlock(x, y, z, Block.getBlockFromItem(item.getItem()), item.getItemDamage(), 2);
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
private boolean trySpawnAbyssalStone(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z)
|
||||
{
|
||||
boolean flag = false;
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.WATER) &&
|
||||
!biome.biomeName.toLowerCase(Locale.ENGLISH).contains("river"))
|
||||
{
|
||||
ItemStack item = GameRegistry.findItemStack("Railcraft", "cube.stone.abyssal", 1);
|
||||
if (item != null)
|
||||
{
|
||||
world.setBlock(x, y, z, Block.getBlockFromItem(item.getItem()), item.getItemDamage(), 2);
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import magicbees.api.bees.ITransmutationEffectLogic;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class TransmutationEffectVanilla implements ITransmutationEffectLogic
|
||||
{
|
||||
@Override
|
||||
public boolean tryTransmutation(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z)
|
||||
{
|
||||
return trySpawnSandstone(world, biome, sourceBlock, x, y, z);
|
||||
}
|
||||
|
||||
private boolean trySpawnSandstone(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z)
|
||||
{
|
||||
boolean flag = false;
|
||||
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.DESERT) &&
|
||||
OreDictionary.itemMatches(new ItemStack(Blocks.sand), sourceBlock, false))
|
||||
{
|
||||
world.setBlock(x, y, z, Blocks.sandstone);
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package magicbees.block;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.client.gui.UIScreens;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.MagicBees;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
import magicbees.tileentity.TileEntityEffectJar;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockEffectJar extends BlockContainer
|
||||
{
|
||||
public BlockEffectJar()
|
||||
{
|
||||
super(Material.glass);
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
this.setBlockName("effectJar");
|
||||
this.setBlockBounds(0.25f, 0f, 0.25f, 0.75f, 0.81f, 0.74f);
|
||||
this.setHardness(0.1f);
|
||||
this.setResistance(1.5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
|
||||
{
|
||||
boolean activate = false;
|
||||
|
||||
if (!player.isSneaking())
|
||||
{
|
||||
player.openGui(MagicBees.object, UIScreens.EFFECT_JAR.ordinal(), world, x, y, z);
|
||||
activate = true;
|
||||
}
|
||||
|
||||
return activate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World w, int metadata)
|
||||
{
|
||||
return new TileEntityEffectJar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return CommonProxy.RenderIdEffectJar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
|
||||
{
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
this.dropInventory(world, x, y, z);
|
||||
}
|
||||
|
||||
private void dropInventory(World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity e = world.getTileEntity(x, y, z);
|
||||
|
||||
if (e != null && e instanceof TileEntityEffectJar)
|
||||
{
|
||||
TileEntityEffectJar jar = (TileEntityEffectJar)e;
|
||||
|
||||
// 0 is the only droppable stack.
|
||||
ItemStack stack = jar.getStackInSlot(0);
|
||||
|
||||
if (stack != null && stack.stackSize > 0)
|
||||
{
|
||||
float pX = world.rand.nextFloat() * 0.8f + 0.1f;
|
||||
float pY = world.rand.nextFloat() * 0.8f + 0.1f;
|
||||
float pZ = world.rand.nextFloat() * 0.8f + 0.1f;
|
||||
|
||||
EntityItem entityItem = new EntityItem(world, x + pX, y + pY, z + pZ, stack.copy());
|
||||
|
||||
entityItem.motionX = world.rand.nextGaussian() * 0.05f;
|
||||
entityItem.motionY = world.rand.nextGaussian() * 0.05f + 0.2f;
|
||||
entityItem.motionZ = world.rand.nextGaussian() * 0.05f;
|
||||
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
stack.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
this.blockIcon = Blocks.glass.getIcon(0, 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package magicbees.block;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.Tabs;
|
||||
import magicbees.block.types.HiveType;
|
||||
import magicbees.main.MagicBees;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.IWorldAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockHive extends Block
|
||||
{
|
||||
public BlockHive()
|
||||
{
|
||||
super(new MaterialHive());
|
||||
this.setLightLevel(0.8f);
|
||||
setHardness(1f);
|
||||
setCreativeTab(Tabs.tabApiculture);
|
||||
setBlockName("hive");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta < 0 || meta > HiveType.values().length)
|
||||
{
|
||||
meta = 0;
|
||||
}
|
||||
return HiveType.getHiveFromMeta(meta).getLightValue();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List itemsList)
|
||||
{
|
||||
for (HiveType type : HiveType.values())
|
||||
{
|
||||
if (type.show || MagicBees.getConfig().ForestryDebugEnabled)
|
||||
{
|
||||
itemsList.add(new ItemStack(this, 1, type.ordinal()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
|
||||
{
|
||||
return HiveType.getHiveFromMeta(metadata).getDrops(world, x, y, z, fortune);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register)
|
||||
{
|
||||
HiveType.registerIcons(register);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
if (meta < 0 || meta > HiveType.values().length)
|
||||
{
|
||||
meta = 0;
|
||||
}
|
||||
return HiveType.getHiveFromMeta(meta).getIconForSide(side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
|
||||
{
|
||||
Block block = world.getBlock(x, y, z);
|
||||
|
||||
if (block.isAir(world, x, y, z))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Item item = Item.getItemFromBlock(block);
|
||||
if (item == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ItemStack(item, 1, getDamageValue(world, x, y, z) & 7);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package magicbees.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import magicbees.block.types.PlankType;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.MagicBees;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockPlanks extends Block
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] IIcons;
|
||||
|
||||
public BlockPlanks()
|
||||
{
|
||||
super(Material.wood);
|
||||
this.setHardness(2.5f);
|
||||
this.setResistance(6.0f);
|
||||
this.setCreativeTab(CreativeTabs.tabBlock);
|
||||
if (MagicBees.getConfig().AreMagicPlanksFlammable)
|
||||
{
|
||||
Blocks.fire.setFireInfo(this, 5, 20);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List itemsList)
|
||||
{
|
||||
for (PlankType type : PlankType.values())
|
||||
{
|
||||
itemsList.add(new ItemStack(this, 1, type.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
return this.IIcons[Math.max(0, Math.min(meta & 7, IIcons.length-1))];
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IIconRegister)
|
||||
{
|
||||
this.IIcons = new IIcon[PlankType.values().length];
|
||||
for (PlankType t : PlankType.values())
|
||||
{
|
||||
this.IIcons[t.ordinal()] = par1IIconRegister.registerIcon(CommonProxy.DOMAIN + ":" + t.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package magicbees.block;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import magicbees.block.types.PlankType;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.MagicBees;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockWoodSlab extends BlockSlab
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] icons;
|
||||
|
||||
public BlockWoodSlab(boolean doubleSlab)
|
||||
{
|
||||
super(doubleSlab, Material.wood);
|
||||
this.setHardness(2.5f);
|
||||
this.setResistance(6.0f);
|
||||
this.setBlockName("tb.slab.wood");
|
||||
this.setCreativeTab(CreativeTabs.tabBlock);
|
||||
this.setLightOpacity(doubleSlab ? 255 : 0);
|
||||
if (MagicBees.getConfig().AreMagicPlanksFlammable)
|
||||
{
|
||||
Blocks.fire.setFireInfo(this, 5, 20);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int id, Random rand, int par3)
|
||||
{
|
||||
return Item.getItemFromBlock(Config.slabWoodHalf);
|
||||
}
|
||||
|
||||
protected ItemStack createStackedBlock(int meta)
|
||||
{
|
||||
return new ItemStack(Config.planksWood, 1, meta & 7);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String func_150002_b(int meta)
|
||||
{
|
||||
return this.getUnlocalizedName() + "." + PlankType.getType(meta).name;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List itemsList)
|
||||
{
|
||||
for (PlankType type : PlankType.values())
|
||||
{
|
||||
itemsList.add(new ItemStack(this, 1, type.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
return this.icons[Math.max(0, Math.min(meta & 7, icons.length-1))];
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
this.icons = new IIcon[PlankType.values().length];
|
||||
for (PlankType t : PlankType.values())
|
||||
{
|
||||
this.icons[t.ordinal()] = par1IconRegister.registerIcon(CommonProxy.DOMAIN + ":" + t.name);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
|
||||
{
|
||||
Block block = world.getBlock(x, y, z);
|
||||
|
||||
if (block.isAir(world, x, y, z))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Item item = Item.getItemFromBlock(block);
|
||||
if (item == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ItemStack(item, 1, getDamageValue(world, x, y, z) & 7);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package magicbees.block;
|
||||
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class MaterialHive extends Material
|
||||
{
|
||||
|
||||
public MaterialHive()
|
||||
{
|
||||
super(MapColor.stoneColor);
|
||||
this.setImmovableMobility();
|
||||
this.setRequiresTool();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,308 @@
|
||||
package magicbees.block.types;
|
||||
|
||||
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;
|
||||
import magicbees.item.types.CombType;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.utils.compat.ForestryHelper;
|
||||
import magicbees.world.feature.FeatureHive;
|
||||
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 net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import net.minecraftforge.common.BiomeDictionary.Type;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
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),
|
||||
;
|
||||
|
||||
private static String[] nameList;
|
||||
|
||||
private String name;
|
||||
public boolean show;
|
||||
private int lightLevel;
|
||||
private ArrayList<IHiveDrop> drops;
|
||||
private ArrayList<BiomeDictionary.Type> validBiomes;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] icons;
|
||||
|
||||
public static HiveType getHiveFromMeta(int meta)
|
||||
{
|
||||
HiveType type = CURIOUS;
|
||||
|
||||
if (meta > 0 && meta < HiveType.values().length)
|
||||
{
|
||||
type = HiveType.values()[meta];
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
public static void initHiveData()
|
||||
{
|
||||
ItemStack[] combs = new ItemStack[] {Config.combs.getStackForType(CombType.MUNDANE)};
|
||||
HiveDrop valiantDrop = new HiveDrop(BeeGenomeManager.addRainResist(ForestryHelper.getTemplateForestryForSpecies("Valiant")), combs, 5);
|
||||
|
||||
CURIOUS.validBiomes.add(Type.FOREST);
|
||||
CURIOUS.validBiomes.add(Type.JUNGLE);
|
||||
CURIOUS.validBiomes.add(Type.HILLS);
|
||||
CURIOUS.drops.add(new HiveDrop(BeeSpecies.MYSTICAL.getGenome(), combs, 80).setIgnoblePercentage(0.7f));
|
||||
CURIOUS.drops.add(new HiveDrop(BeeGenomeManager.addRainResist(BeeSpecies.MYSTICAL.getGenome()), combs, 15));
|
||||
CURIOUS.drops.add(valiantDrop);
|
||||
|
||||
UNUSUAL.validBiomes.add(Type.PLAINS);
|
||||
UNUSUAL.validBiomes.add(Type.MOUNTAIN);
|
||||
UNUSUAL.validBiomes.add(Type.HILLS);
|
||||
UNUSUAL.drops.add(new HiveDrop(BeeSpecies.UNUSUAL.getGenome(), combs, 80).setIgnoblePercentage(0.7f));
|
||||
UNUSUAL.drops.add(new HiveDrop(BeeGenomeManager.addRainResist(BeeSpecies.UNUSUAL.getGenome()), combs, 15));
|
||||
UNUSUAL.drops.add(valiantDrop);
|
||||
|
||||
RESONANT.validBiomes.add(Type.DESERT);
|
||||
RESONANT.validBiomes.add(Type.MAGICAL);
|
||||
RESONANT.drops.add(new HiveDrop(BeeSpecies.SORCEROUS.getGenome(), combs, 80).setIgnoblePercentage(0.7f));
|
||||
RESONANT.drops.add(new HiveDrop(BeeGenomeManager.addRainResist(BeeSpecies.SORCEROUS.getGenome()), combs, 20));
|
||||
RESONANT.drops.add(valiantDrop);
|
||||
|
||||
DEEP.validBiomes.add(Type.HILLS);
|
||||
DEEP.validBiomes.add(Type.MOUNTAIN);
|
||||
DEEP.validBiomes.add(Type.MAGICAL);
|
||||
DEEP.drops.add(new HiveDrop(BeeSpecies.ATTUNED.getGenome(), combs, 80).setIgnoblePercentage(0.65f));
|
||||
DEEP.drops.add(new HiveDrop(BeeGenomeManager.addRainResist(BeeSpecies.ATTUNED.getGenome()), combs, 20));
|
||||
DEEP.drops.add(valiantDrop);
|
||||
|
||||
combs = new ItemStack[] {Config.combs.getStackForType(CombType.MOLTEN), new ItemStack(Items.glowstone_dust, 6)};
|
||||
|
||||
INFERNAL.validBiomes.add(Type.NETHER);
|
||||
INFERNAL.validBiomes.add(Type.MAGICAL);
|
||||
INFERNAL.drops.add(new HiveDrop(BeeSpecies.INFERNAL.getGenome(), combs, 80).setIgnoblePercentage(0.5f));
|
||||
INFERNAL.drops.add(new HiveDrop(ForestryHelper.getTemplateForestryForSpecies("Steadfast"), combs, 3));
|
||||
|
||||
combs = new ItemStack[] {Config.combs.getStackForType(CombType.FORGOTTEN), new ItemStack(Items.ender_pearl, 1)};
|
||||
|
||||
OBLIVION.validBiomes.add(Type.END);
|
||||
OBLIVION.validBiomes.add(Type.MAGICAL);
|
||||
OBLIVION.drops.add(new HiveDrop(BeeSpecies.OBLIVION.getGenome(), combs, 80));
|
||||
OBLIVION.drops.add(new HiveDrop(ForestryHelper.getTemplateForestryForSpecies("Steadfast"), combs, 9));
|
||||
}
|
||||
|
||||
private HiveType(String hiveName, int light, boolean visible)
|
||||
{
|
||||
this.name = hiveName;
|
||||
this.lightLevel = light;
|
||||
this.show = visible;
|
||||
this.drops = new ArrayList<IHiveDrop>();
|
||||
this.validBiomes = new ArrayList<BiomeDictionary.Type>();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void registerIcons(IIconRegister register)
|
||||
{
|
||||
for (HiveType type : HiveType.values())
|
||||
{
|
||||
type.icons = new IIcon[2];
|
||||
|
||||
type.icons[0] = register.registerIcon(CommonProxy.DOMAIN + ":beehive." + type.ordinal() + ".top");
|
||||
type.icons[1] = register.registerIcon(CommonProxy.DOMAIN + ":beehive." + type.ordinal() + ".side");
|
||||
}
|
||||
}
|
||||
|
||||
private HiveType()
|
||||
{
|
||||
this.drops = new ArrayList<IHiveDrop>();
|
||||
}
|
||||
|
||||
public void addDrop(IHiveDrop drop)
|
||||
{
|
||||
this.drops.add(drop);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconForSide(int side)
|
||||
{
|
||||
IIcon i = this.icons[0];
|
||||
|
||||
if (side != 0 && side != 1)
|
||||
{
|
||||
i = this.icons[1];
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
public int getLightValue()
|
||||
{
|
||||
return this.lightLevel;
|
||||
}
|
||||
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int fortune)
|
||||
{
|
||||
ArrayList<ItemStack> hiveDrops = new ArrayList<ItemStack>();
|
||||
int dart;
|
||||
|
||||
// Get a princess.
|
||||
int throttle = 0;
|
||||
while (hiveDrops.size() <= 0 && throttle < 10)
|
||||
{
|
||||
++throttle;
|
||||
dart = world.rand.nextInt(100);
|
||||
for (IHiveDrop drop : drops)
|
||||
{
|
||||
if (dart <= drop.getChance(world, x, y, z))
|
||||
{
|
||||
hiveDrops.add(drop.getPrincess(world, x, y, z, fortune));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get a drone, maybe.
|
||||
dart = world.rand.nextInt(100);
|
||||
for (IHiveDrop drop : drops)
|
||||
{
|
||||
if (dart <= drop.getChance(world, x, y, z))
|
||||
{
|
||||
hiveDrops.addAll(drop.getDrones(world, x, y, z, fortune));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Get additional drops.
|
||||
dart = world.rand.nextInt(100);
|
||||
for (IHiveDrop drop : drops)
|
||||
{
|
||||
if (dart <= drop.getChance(world, x, y, z))
|
||||
{
|
||||
hiveDrops.addAll(drop.getAdditional(world, x, y, z, fortune));
|
||||
}
|
||||
}
|
||||
|
||||
return hiveDrops;
|
||||
}
|
||||
|
||||
public static String[] getAllNames()
|
||||
{
|
||||
return (nameList == null) ? nameList = generateNames() : nameList;
|
||||
}
|
||||
|
||||
private static String[] generateNames()
|
||||
{
|
||||
String[] names = new String[values().length];
|
||||
for (int i = 0; i < names.length; ++i)
|
||||
{
|
||||
names[i] = values()[i].name;
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
public void generateHive(World world, Random random, int chunkX, int chunkZ, boolean initialGen)
|
||||
{
|
||||
if (spawnsInBiome(world.getBiomeGenForCoordsBody(chunkX * 16, chunkZ * 16)))
|
||||
{
|
||||
switch (this)
|
||||
{
|
||||
case CURIOUS:
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
int coordX = chunkX * 16 + random.nextInt(16);
|
||||
int coordZ = chunkZ * 16 + random.nextInt(16);
|
||||
if (FeatureHive.generateHiveCurious(world, random, coordX, coordZ, initialGen))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case UNUSUAL:
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
int coordX = chunkX * 16 + random.nextInt(16);
|
||||
int coordZ = chunkZ * 16 + random.nextInt(16);
|
||||
if (FeatureHive.generateHiveUnusual(world, random, coordX, coordZ, initialGen))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RESONANT:
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
int coordX = chunkX * 16 + random.nextInt(16);
|
||||
int coordZ = chunkZ * 16 + random.nextInt(16);
|
||||
if (FeatureHive.generateHiveResonant(world, random, coordX, coordZ, initialGen))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DEEP:
|
||||
if (chunkX % 2 == 0 && chunkZ % 2 == 0)
|
||||
{
|
||||
for (int i = 0; i < 1; ++i)
|
||||
{
|
||||
int coordX = chunkX * 16 + random.nextInt(16);
|
||||
int coordZ = chunkZ * 16 + random.nextInt(16);
|
||||
if (FeatureHive.generateHiveDeep(world, random, coordX, coordZ, initialGen))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case INFERNAL:
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
int coordX = chunkX * 16 + random.nextInt(16);
|
||||
int coordZ = chunkZ * 16 + random.nextInt(16);
|
||||
if (FeatureHive.generateHiveInfernal(world, random, coordX, coordZ, initialGen))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OBLIVION:
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
int coordX = chunkX * 16 + random.nextInt(16);
|
||||
int coordZ = chunkZ * 16 + random.nextInt(16);
|
||||
if (FeatureHive.generateHiveOblivion(world, random, coordX, coordZ, initialGen))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean spawnsInBiome(BiomeGenBase biomeGen)
|
||||
{
|
||||
boolean found = false;
|
||||
BiomeDictionary.Type[] types = BiomeDictionary.getTypesForBiome(biomeGen);
|
||||
for (int i = 0; i < types.length; ++i)
|
||||
{
|
||||
if (this.validBiomes.contains(types[i]))
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package magicbees.block.types;
|
||||
|
||||
public enum PlankType
|
||||
{
|
||||
GREATWOOD("greatwood", 48),
|
||||
SILVERWOOD("silverwood", 49),
|
||||
;
|
||||
|
||||
public String name;
|
||||
public int textureIdx;
|
||||
private static String[] nameList;
|
||||
|
||||
private PlankType(String n, int idx)
|
||||
{
|
||||
this.name = n;
|
||||
this.textureIdx = idx;
|
||||
}
|
||||
|
||||
public static PlankType getType(int meta)
|
||||
{
|
||||
PlankType type = null;
|
||||
|
||||
if (meta >= 0 && meta <= values().length)
|
||||
{
|
||||
type = values()[meta];
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
public static String[] getAllNames()
|
||||
{
|
||||
return (nameList == null) ? nameList = generateNames() : nameList;
|
||||
}
|
||||
|
||||
private static String[] generateNames()
|
||||
{
|
||||
String[] names = new String[values().length];
|
||||
for (int i = 0; i < names.length; ++i)
|
||||
{
|
||||
names[i] = values()[i].name;
|
||||
}
|
||||
return names;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package magicbees.client.gui;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.tileentity.TileEntityEffectJar;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerEffectJar extends Container
|
||||
{
|
||||
public TileEntityEffectJar jar;
|
||||
|
||||
public int lastBeeHealth = 0;
|
||||
public int speciesColour = 0xffffff;
|
||||
|
||||
public ContainerEffectJar(TileEntityEffectJar tileEntityEffectJar, EntityPlayer player)
|
||||
{
|
||||
this.jar = tileEntityEffectJar;
|
||||
this.addSlotToContainer(new SlotCustomItems(this.jar, 0, 80, 22, GameRegistry.findItemStack
|
||||
("forestry", "beeDroneGE", 1)));
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
for (int j = 0; j < 9; ++j)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 74 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; ++i)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 132));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting crafting)
|
||||
{
|
||||
super.addCraftingToCrafters(crafting);
|
||||
|
||||
crafting.sendProgressBarUpdate(this, 0, this.jar.currentBeeHealth);
|
||||
crafting.sendProgressBarUpdate(this, 1, this.jar.currentBeeColour);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
super.detectAndSendChanges();
|
||||
|
||||
for (int i = 0; i < this.crafters.size(); ++i)
|
||||
{
|
||||
ICrafting crafting = (ICrafting)this.crafters.get(i);
|
||||
|
||||
if (this.lastBeeHealth != this.jar.currentBeeHealth)
|
||||
{
|
||||
crafting.sendProgressBarUpdate(this, 0, this.jar.currentBeeHealth);
|
||||
this.lastBeeHealth = this.jar.currentBeeHealth;
|
||||
}
|
||||
if (this.speciesColour != this.jar.currentBeeColour)
|
||||
{
|
||||
crafting.sendProgressBarUpdate(this, 1, this.jar.currentBeeColour);
|
||||
this.speciesColour = this.jar.currentBeeColour;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateProgressBar(int craftingId, int value)
|
||||
{
|
||||
if (craftingId == 0)
|
||||
{
|
||||
this.jar.currentBeeHealth = value;
|
||||
}
|
||||
else if (craftingId == 1)
|
||||
{
|
||||
this.jar.currentBeeColour = value;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||
{
|
||||
return this.jar.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slot)
|
||||
{
|
||||
Slot itemSlot = this.getSlot(slot);
|
||||
boolean clearSlot = false;
|
||||
|
||||
if (itemSlot != null && itemSlot.getHasStack())
|
||||
{
|
||||
ItemStack srcStack = itemSlot.getStack();
|
||||
if (slot == 0 && srcStack != null)
|
||||
{
|
||||
clearSlot = this.mergeItemStack(srcStack, 1, 36 + 1, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.getSlot(0).isItemValid(srcStack))
|
||||
{
|
||||
clearSlot = this.mergeItemStack(srcStack, 0, 1, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (clearSlot)
|
||||
{
|
||||
itemSlot.putStack(null);
|
||||
}
|
||||
itemSlot.onSlotChanged();
|
||||
player.inventory.markDirty();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package magicbees.client.gui;
|
||||
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.tileentity.TileEntityEffectJar;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
||||
public class GUIEffectJar extends GuiContainer
|
||||
{
|
||||
public static final String BACKGROUND_FILE = "jarScreen.png";
|
||||
public static final ResourceLocation BACKGROUND_LOCATION = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.GUI_TEXTURE + "jarScreen.png");
|
||||
|
||||
private static final int WIDTH = 176;
|
||||
private static final int HEIGHT = 156;
|
||||
|
||||
private static final int SLOT_JAR_X = 80;
|
||||
private static final int SLOT_JAR_Y = 22;
|
||||
private static final int SLOT_INVENTORY_X = 8;
|
||||
private static final int SLOT_INVENTORY_Y = 74;
|
||||
private static final int BAR_DEST_X = 117;
|
||||
private static final int BAR_DEST_Y = 10;
|
||||
|
||||
private static final int BAR_SRC_X = 176;
|
||||
private static final int BAR_SRC_Y = 0;
|
||||
|
||||
private static final int BAR_WIDTH = 10;
|
||||
private static final int BAR_HEIGHT = 40;
|
||||
|
||||
public GUIEffectJar(TileEntityEffectJar jar, EntityPlayer player)
|
||||
{
|
||||
super(new ContainerEffectJar(jar, player));
|
||||
this.xSize = WIDTH;
|
||||
this.ySize = HEIGHT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
{
|
||||
fontRendererObj.drawString("Inventory", 9, 63, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
|
||||
{
|
||||
GL11.glColor4f(1f, 1f, 1f, 1f);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_SRC_ALPHA);
|
||||
this.mc.getTextureManager().bindTexture(BACKGROUND_LOCATION);
|
||||
|
||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
TileEntityEffectJar jar = ((ContainerEffectJar)this.inventorySlots).jar;
|
||||
float r = ((jar.currentBeeColour >> 16) & 255) / 255f;
|
||||
float g = ((jar.currentBeeColour >> 8) & 255) / 255f;
|
||||
float b = (jar.currentBeeColour & 255) / 255f;
|
||||
|
||||
GL11.glColor3f(r, g, b);
|
||||
|
||||
int value = BAR_HEIGHT - (jar.currentBeeHealth * BAR_HEIGHT) / 100;
|
||||
this.drawTexturedModalRect(this.guiLeft + BAR_DEST_X, this.guiTop + value + BAR_DEST_Y, BAR_SRC_X, BAR_SRC_Y, BAR_WIDTH, BAR_HEIGHT - value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package magicbees.client.gui;
|
||||
|
||||
import magicbees.tileentity.TileEntityEffectJar;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
|
||||
public class GUIHandler implements IGuiHandler
|
||||
{
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
Object value = null;
|
||||
|
||||
if (ID == UIScreens.EFFECT_JAR.ordinal())
|
||||
{
|
||||
value = new ContainerEffectJar((TileEntityEffectJar)world.getTileEntity(x, y, z), player);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
Object value = null;
|
||||
|
||||
if (ID == UIScreens.EFFECT_JAR.ordinal())
|
||||
{
|
||||
value = new GUIEffectJar((TileEntityEffectJar)world.getTileEntity(x, y, z), player);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package magicbees.client.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author MysteriousAges
|
||||
*
|
||||
*/
|
||||
public class SlotCustomItems extends Slot
|
||||
{
|
||||
private List<ItemStack> items;
|
||||
|
||||
public SlotCustomItems(IInventory inventory, int slotIndex, int xPos, int yPos)
|
||||
{
|
||||
this(inventory, slotIndex, xPos, yPos, new ItemStack[0]);
|
||||
}
|
||||
|
||||
public SlotCustomItems(IInventory inventory, int slotIndex, int xPos, int yPos, ItemStack... items)
|
||||
{
|
||||
super(inventory, slotIndex, xPos, yPos);
|
||||
this.items = new ArrayList<ItemStack>();
|
||||
|
||||
for (ItemStack i : items)
|
||||
{
|
||||
this.items.add(i);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return List of valid ItemStacks
|
||||
*/
|
||||
public List<ItemStack> getValidItems()
|
||||
{
|
||||
return this.items;
|
||||
}
|
||||
|
||||
public void addValidItem(ItemStack newItem)
|
||||
{
|
||||
boolean contains = false;
|
||||
for (int i = 0; i < this.items.size(); ++i)
|
||||
{
|
||||
ItemStack s = this.items.get(i);
|
||||
if (s.getItem() == newItem.getItem())
|
||||
{
|
||||
if (s.getItemDamage() == OreDictionary.WILDCARD_VALUE)
|
||||
{
|
||||
contains = true;
|
||||
break;
|
||||
}
|
||||
else if (s.getItemDamage() == newItem.getItemDamage())
|
||||
{
|
||||
contains = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!contains)
|
||||
{
|
||||
this.items.add(newItem);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param removeItem ItemStack to remove.
|
||||
*/
|
||||
public void removeValidItem(ItemStack removeItem)
|
||||
{
|
||||
for (int i = 0; i < this.items.size(); ++i)
|
||||
{
|
||||
ItemStack s = this.items.get(i);
|
||||
if (s.getItem() == removeItem.getItem())
|
||||
{
|
||||
if (s.getItemDamage() == OreDictionary.WILDCARD_VALUE)
|
||||
{
|
||||
this.items.remove(i);
|
||||
break;
|
||||
}
|
||||
else if (s.getItemDamage() == removeItem.getItemDamage())
|
||||
{
|
||||
this.items.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack itemStack)
|
||||
{
|
||||
boolean flag = false;
|
||||
for (int i = 0; i < this.items.size(); ++i)
|
||||
{
|
||||
if (this.items.get(i).getItem() == itemStack.getItem())
|
||||
{
|
||||
if (this.items.get(i).getItemDamage() == itemStack.getItemDamage())
|
||||
{
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
flag = this.items.get(i).getItemDamage() ==OreDictionary.WILDCARD_VALUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package magicbees.client.gui;
|
||||
|
||||
public enum UIScreens
|
||||
{
|
||||
EFFECT_JAR,
|
||||
;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package magicbees.client.model;
|
||||
|
||||
import magicbees.main.CommonProxy;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ModelEffectJar
|
||||
{
|
||||
public static final String objFile = CommonProxy.MODEL_PATH + "effectJar.obj";
|
||||
public static final ResourceLocation textureLocation = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.MODEL + "jarTexture.png");
|
||||
|
||||
public static final ModelEffectJar model = new ModelEffectJar();
|
||||
|
||||
private IModelCustom effectJarObj;
|
||||
|
||||
public ModelEffectJar()
|
||||
{
|
||||
this.effectJarObj = AdvancedModelLoader.loadModel(new ResourceLocation("magicbees", "model/effectJar.obj"));
|
||||
}
|
||||
|
||||
public void render()
|
||||
{
|
||||
this.effectJarObj.renderPart("jarLid");
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
this.effectJarObj.renderPart("jarBase");
|
||||
GL11.glPopAttrib();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package magicbees.client.render;
|
||||
|
||||
import magicbees.client.model.ModelEffectJar;
|
||||
import magicbees.tileentity.TileEntityEffectJar;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
||||
public class EffectJarRenderer extends TileEntitySpecialRenderer implements IItemRenderer
|
||||
{
|
||||
public static EffectJarRenderer instance = new EffectJarRenderer();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick)
|
||||
{
|
||||
if (tileEntity instanceof TileEntityEffectJar)
|
||||
{
|
||||
this.doRender(x, y, z, 1f);
|
||||
}
|
||||
}
|
||||
|
||||
@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)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
default:
|
||||
case ENTITY:
|
||||
doRender(0, 0, 0, 1.8f);
|
||||
break;
|
||||
|
||||
case EQUIPPED:
|
||||
doRender(0, 0, 0, 1.5f);
|
||||
break;
|
||||
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
doRender(-.5, .5, 0.25, 1f);
|
||||
break;
|
||||
|
||||
case INVENTORY:
|
||||
doRender(0.3, 0.25, 0.3, 1.5f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void doRender(double x, double y, double z, float scale)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ModelEffectJar.textureLocation);
|
||||
|
||||
ModelEffectJar.model.render();
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package magicbees.item;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import forestry.api.apiculture.IArmorApiarist;
|
||||
|
||||
public class ItemArmorApiarist extends Item implements IArmorApiarist
|
||||
{
|
||||
|
||||
public ItemArmorApiarist()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static int getNumberPiecesWorn(EntityPlayer player)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
if (wearsHelmet(player)) {
|
||||
count++;
|
||||
}
|
||||
if (wearsChest(player)) {
|
||||
count++;
|
||||
}
|
||||
if (wearsLegs(player)) {
|
||||
count++;
|
||||
}
|
||||
if (wearsBoots(player)) {
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
public static boolean wearsHelmet(EntityPlayer player)
|
||||
{
|
||||
ItemStack armorItem = player.inventory.armorInventory[3];
|
||||
return armorItem != null && armorItem.getItem() instanceof IArmorApiarist;
|
||||
}
|
||||
|
||||
public static boolean wearsChest(EntityPlayer player)
|
||||
{
|
||||
ItemStack armorItem = player.inventory.armorInventory[2];
|
||||
return armorItem != null && armorItem.getItem() instanceof IArmorApiarist;
|
||||
}
|
||||
|
||||
public static boolean wearsLegs(EntityPlayer player)
|
||||
{
|
||||
ItemStack armorItem = player.inventory.armorInventory[1];
|
||||
return armorItem != null && armorItem.getItem() instanceof IArmorApiarist;
|
||||
}
|
||||
|
||||
public static boolean wearsBoots(EntityPlayer player)
|
||||
{
|
||||
ItemStack armorItem = player.inventory.armorInventory[0];
|
||||
return armorItem != null && armorItem.getItem() instanceof IArmorApiarist;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean protectPlayer(EntityPlayer player, ItemStack armor, String cause, boolean doProtect)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package magicbees.item;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.item.types.CapsuleType;
|
||||
import magicbees.item.types.FluidType;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemCapsule extends Item
|
||||
{
|
||||
private CapsuleType capsuleType;
|
||||
|
||||
public ItemCapsule(CapsuleType type, int maxStackSize)
|
||||
{
|
||||
super();
|
||||
this.capsuleType = type;
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxStackSize(maxStackSize);
|
||||
this.setUnlocalizedName("capsule." + type.toString().toLowerCase());
|
||||
GameRegistry.registerItem(this, "capsule." + type.toString().toLowerCase());
|
||||
}
|
||||
|
||||
public CapsuleType getType()
|
||||
{
|
||||
return this.capsuleType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack itemStack)
|
||||
{
|
||||
return String.format(this.capsuleType.getLocalizedName(), FluidType.values()[itemStack.getItemDamage()].getDisplayName());
|
||||
}
|
||||
|
||||
public ItemStack getCapsuleForLiquid(FluidType l)
|
||||
{
|
||||
return new ItemStack(this, 1, l.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List itemList)
|
||||
{
|
||||
for (FluidType l : FluidType.values())
|
||||
{
|
||||
if (l.available)
|
||||
{
|
||||
itemList.add(new ItemStack(this, 1, l.ordinal()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
this.itemIcon = par1IconRegister.registerIcon(CommonProxy.DOMAIN + ":capsule" + this.capsuleType.getName().substring(0, 1).toUpperCase()
|
||||
+ this.capsuleType.getName().substring(1));
|
||||
for (FluidType t : FluidType.values())
|
||||
{
|
||||
if (t != FluidType.EMPTY && t.liquidIcon == null)
|
||||
{
|
||||
t.liquidIcon = par1IconRegister.registerIcon(CommonProxy.DOMAIN + ":liquids/" + t.liquidID.toLowerCase());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamageForRenderPass(int metadata, int pass)
|
||||
{
|
||||
IIcon i = this.itemIcon;
|
||||
if (metadata != 0 && pass == 0)
|
||||
{
|
||||
i = FluidType.values()[Math.max(0, Math.min(metadata, FluidType.values().length - 1))].liquidIcon;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderPasses(int metadata)
|
||||
{
|
||||
return (metadata == 0) ? 1 : 2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package magicbees.item;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.Tabs;
|
||||
import magicbees.item.types.CombType;
|
||||
import magicbees.main.MagicBees;
|
||||
import magicbees.main.utils.compat.ForestryHelper;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemComb extends Item
|
||||
{
|
||||
public ItemComb()
|
||||
{
|
||||
super();
|
||||
this.setCreativeTab(Tabs.tabApiculture);
|
||||
this.setHasSubtypes(true);
|
||||
this.setUnlocalizedName("comb");
|
||||
GameRegistry.registerItem(this, "comb");
|
||||
}
|
||||
|
||||
public ItemStack getStackForType(CombType type)
|
||||
{
|
||||
return new ItemStack(this, 1, type.ordinal());
|
||||
}
|
||||
|
||||
public ItemStack getStackForType(CombType type, int count)
|
||||
{
|
||||
return new ItemStack(this, count, type.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List list)
|
||||
{
|
||||
for (CombType type : CombType.values())
|
||||
{
|
||||
if (type.showInList || MagicBees.getConfig().ForestryDebugEnabled)
|
||||
{
|
||||
list.add(this.getStackForType(type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderPasses(int meta)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon secondIcon;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
this.itemIcon = par1IconRegister.registerIcon(ForestryHelper.Name.toLowerCase() + ":beeCombs.0");
|
||||
this.secondIcon= par1IconRegister.registerIcon(ForestryHelper.Name.toLowerCase() + ":beeCombs.1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int pass)
|
||||
{
|
||||
return (pass == 0) ? itemIcon : secondIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int pass)
|
||||
{
|
||||
int meta = Math.max(0, Math.min(CombType.values().length - 1, stack.getItemDamage()));
|
||||
int colour = CombType.values()[meta].getColours()[0];
|
||||
|
||||
if (pass >= 1)
|
||||
{
|
||||
colour = CombType.values()[meta].getColours()[1];
|
||||
}
|
||||
|
||||
return colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack)
|
||||
{
|
||||
return CombType.values()[stack.getItemDamage()].getName();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package magicbees.item;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemCrystalAspect extends Item
|
||||
{
|
||||
public ItemCrystalAspect()
|
||||
{
|
||||
super();
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
this.setHasSubtypes(true);
|
||||
this.setUnlocalizedName("crystalAspect");
|
||||
GameRegistry.registerItem(this, "crystalAspect");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list)
|
||||
{
|
||||
/*for (EnumTag tag : EnumTag.values())
|
||||
{
|
||||
if (tag == EnumTag.UNKNOWN)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
list.add(new ItemStack(this.itemID, 1, tag.id));
|
||||
}*/
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
this.itemIcon = par1IconRegister.registerIcon(CommonProxy.DOMAIN + ":crystalAspect");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int pass)
|
||||
{
|
||||
return 0;
|
||||
//return EnumTag.get(stack.getItemDamage()).color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack)
|
||||
{
|
||||
return LocalizationManager.getLocalizedString("resource.crystalAspect");
|
||||
//return String.format(LocalizationManager.getLocalizedString("resource.crystalAspect"), EnumTag.get(stack.getItemDamage()).name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package magicbees.item;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.Tabs;
|
||||
import magicbees.item.types.DropType;
|
||||
import magicbees.main.utils.compat.ForestryHelper;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemDrop extends Item
|
||||
{
|
||||
public ItemDrop()
|
||||
{
|
||||
super();
|
||||
this.setCreativeTab(Tabs.tabApiculture);
|
||||
this.setHasSubtypes(true);
|
||||
this.setUnlocalizedName("drop");
|
||||
GameRegistry.registerItem(this, "drop");
|
||||
}
|
||||
|
||||
public ItemStack getStackForType(DropType type)
|
||||
{
|
||||
return new ItemStack(this, 1, type.ordinal());
|
||||
}
|
||||
|
||||
public ItemStack getStackForType(DropType type, int count)
|
||||
{
|
||||
return new ItemStack(this, count, type.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List list)
|
||||
{
|
||||
for (DropType type : DropType.values())
|
||||
{
|
||||
list.add(this.getStackForType(type));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderPasses(int metadata)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon secondIcon;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
this.itemIcon = par1IconRegister.registerIcon(ForestryHelper.Name.toLowerCase() + ":honeyDrop.0");
|
||||
this.secondIcon= par1IconRegister.registerIcon(ForestryHelper.Name.toLowerCase() + ":honeyDrop.1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int pass)
|
||||
{
|
||||
return (pass == 0) ? this.itemIcon : this.secondIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int pass)
|
||||
{
|
||||
int meta = Math.max(0, Math.min(DropType.values().length - 1, stack.getItemDamage()));
|
||||
int colour = DropType.values()[meta].combColour[0];
|
||||
|
||||
if (pass >= 1)
|
||||
{
|
||||
colour = DropType.values()[meta].combColour[1];
|
||||
}
|
||||
|
||||
return colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack)
|
||||
{
|
||||
return DropType.values()[stack.getItemDamage()].getName();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
package magicbees.item;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IHiveFrame;
|
||||
import magicbees.item.types.HiveFrameType;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemMagicHiveFrame extends Item implements IHiveFrame
|
||||
{
|
||||
private HiveFrameType type;
|
||||
|
||||
public ItemMagicHiveFrame(HiveFrameType frameType)
|
||||
{
|
||||
super();
|
||||
this.type = frameType;
|
||||
this.setMaxDamage(this.type.maxDamage);
|
||||
this.setMaxStackSize(1);
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
this.setUnlocalizedName("frame" + frameType.getName());
|
||||
GameRegistry.registerItem(this, "frame" + frameType.getName());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
this.itemIcon = par1IconRegister.registerIcon(CommonProxy.DOMAIN + ":frame" + type.getName());
|
||||
}
|
||||
|
||||
// --------- IHiveFrame functions -----------------------------------------
|
||||
|
||||
@Override
|
||||
public ItemStack frameUsed(IBeeHousing housing, ItemStack frame, IBee queen, int wear)
|
||||
{
|
||||
return this.doWear(housing.getWorld(), housing.getXCoord(), housing.getYCoord(), housing.getZCoord(), frame, wear);
|
||||
}
|
||||
|
||||
private ItemStack doWear(World w, int x, int y, int z, ItemStack frame, int wear)
|
||||
{
|
||||
int damage = wear;
|
||||
|
||||
frame.setItemDamage(frame.getItemDamage() + damage);
|
||||
|
||||
if (frame.getItemDamage() >= frame.getMaxDamage())
|
||||
{
|
||||
// Break the frame.
|
||||
frame = null;
|
||||
}
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTerritoryModifier(IBeeGenome genome, float currentModifier)
|
||||
{
|
||||
return this.type.territoryMod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier)
|
||||
{
|
||||
return this.type.mutationMod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier)
|
||||
{
|
||||
return this.type.lifespanMod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getProductionModifier(IBeeGenome genome, float currentModifier)
|
||||
{
|
||||
return this.type.productionMod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFloweringModifier(IBeeGenome genome, float currentModifier)
|
||||
{
|
||||
return this.type.floweringMod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSealed()
|
||||
{
|
||||
return this.type.isSealed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelfLighted()
|
||||
{
|
||||
return this.type.isLit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSunlightSimulated()
|
||||
{
|
||||
return this.type.isSunlit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHellish()
|
||||
{
|
||||
return this.type.isHellish;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getGeneticDecay(IBeeGenome genome, float currentModifier)
|
||||
{
|
||||
return this.type.geneticDecayMod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package magicbees.item;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.item.types.ResourceType;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemMiscResources extends Item
|
||||
{
|
||||
private IIcon[] icons = new IIcon[ResourceType.values().length];
|
||||
|
||||
public ItemMiscResources()
|
||||
{
|
||||
super();
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
this.setHasSubtypes(true);
|
||||
this.setUnlocalizedName("miscResources");
|
||||
GameRegistry.registerItem(this, "miscResources");
|
||||
}
|
||||
|
||||
public ItemStack getStackForType(ResourceType type)
|
||||
{
|
||||
return new ItemStack(this, 1, type.ordinal());
|
||||
}
|
||||
|
||||
public ItemStack getStackForType(ResourceType type, int count)
|
||||
{
|
||||
return new ItemStack(this, count, type.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List list)
|
||||
{
|
||||
for (ResourceType type : ResourceType.values())
|
||||
{
|
||||
if (type.showInList)
|
||||
{
|
||||
list.add(this.getStackForType(type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
for (int i = 0; i < ResourceType.values().length; i++)
|
||||
{
|
||||
this.icons[i] = par1IconRegister.registerIcon(CommonProxy.DOMAIN + ":" + ResourceType.values()[i].getName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int meta)
|
||||
{
|
||||
return icons[meta];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack)
|
||||
{
|
||||
return ResourceType.values()[stack.getItemDamage()].getLocalizedName();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package magicbees.item;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.MagicBees;
|
||||
import magicbees.main.utils.MoonPhase;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemMoonDial extends Item
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] icons;
|
||||
|
||||
public ItemMoonDial()
|
||||
{
|
||||
super();
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
this.setUnlocalizedName("moonDial");
|
||||
GameRegistry.registerItem(this, "moonDial");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
this.icons = new IIcon[MoonPhase.values().length];
|
||||
for (int i = 0; i < MoonPhase.values().length; ++i)
|
||||
{
|
||||
this.icons[i] = par1IconRegister.registerIcon(CommonProxy.DOMAIN + ":moonDial." + i);
|
||||
}
|
||||
this.itemIcon = this.icons[4];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
|
||||
{
|
||||
return this.icons[MoonPhase.getMoonPhaseFromTime(player.worldObj.getWorldTime()).ordinal()];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack itemStack, EntityPlayer entityPlayer, List infoList, boolean par4)
|
||||
{
|
||||
if (MagicBees.getConfig().MoonDialShowsPhaseInText &&
|
||||
entityPlayer.getCurrentEquippedItem() != null &&
|
||||
entityPlayer.getCurrentEquippedItem().getItem() == this)
|
||||
{
|
||||
infoList.add("\u00A77" + MoonPhase.getMoonPhaseFromTime(entityPlayer.worldObj.getWorldTime()).getLocalizedName());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
package magicbees.item;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemMysteriousMagnet extends Item
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon activeIcon;
|
||||
|
||||
private float rangeBase;
|
||||
private float multiplier;
|
||||
private int maxLevel;
|
||||
private final float fudgeFactor = 0.2f;
|
||||
|
||||
public ItemMysteriousMagnet()
|
||||
{
|
||||
super();
|
||||
this.setNoRepair();
|
||||
this.setHasSubtypes(true);
|
||||
this.rangeBase = 3f;
|
||||
this.multiplier = 0.75f;
|
||||
this.maxLevel = 8;
|
||||
this.setUnlocalizedName(CommonProxy.DOMAIN + ":mysteriousMagnet");
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
}
|
||||
|
||||
public void setBaseRange(float value)
|
||||
{
|
||||
this.rangeBase = value;
|
||||
}
|
||||
|
||||
public void setLevelMultiplier(float value)
|
||||
{
|
||||
this.multiplier = value;
|
||||
}
|
||||
|
||||
public void setMaximumLevel(int value)
|
||||
{
|
||||
this.maxLevel = value;
|
||||
}
|
||||
|
||||
public int getMaximumLevel()
|
||||
{
|
||||
return this.maxLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
String s = LocalizationManager.getLocalizedString("misc.level", itemStack.getItemDamage() >> 1);
|
||||
if (isMagnetActive(itemStack))
|
||||
{
|
||||
list.add(LocalizationManager.getLocalizedString("misc.magnetActive", s));
|
||||
}
|
||||
else
|
||||
{
|
||||
list.add(LocalizationManager.getLocalizedString("misc.magnetInactive", s));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List list)
|
||||
{
|
||||
for (int i = 0; i <= this.maxLevel; i++)
|
||||
{
|
||||
list.add(new ItemStack(this, 1, i * 2));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.itemIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":magnetInactive");
|
||||
this.activeIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":magnetActive");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int damage)
|
||||
{
|
||||
return isMagnetActive(damage) ? this.activeIcon : this.itemIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean hasEffect(ItemStack itemStack, int pass)
|
||||
{
|
||||
return isMagnetActive(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player)
|
||||
{
|
||||
if (player.isSneaking())
|
||||
{
|
||||
itemStack.setItemDamage(itemStack.getItemDamage() ^ 1);
|
||||
}
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack itemStack, World world, Entity entity, int par4, boolean par5)
|
||||
{
|
||||
if (isMagnetActive(itemStack) && entity instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer)entity;
|
||||
int dragCount = player.getCommandSenderName().hashCode();
|
||||
float radius = getRadius(itemStack.getItemDamage()) - fudgeFactor;
|
||||
AxisAlignedBB bounds = player.boundingBox.expand(radius, radius, radius);
|
||||
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER)
|
||||
{
|
||||
bounds.expand(fudgeFactor, fudgeFactor, fudgeFactor);
|
||||
|
||||
if ((itemStack.getItemDamage() >> 1) >= 7)
|
||||
{
|
||||
List<EntityArrow> arrows = world.getEntitiesWithinAABB(EntityArrow.class, bounds);
|
||||
|
||||
for (EntityArrow arrow : arrows)
|
||||
{
|
||||
if (arrow.canBePickedUp == 1 && world.rand.nextInt(6) == 0)
|
||||
{
|
||||
EntityItem replacement = new EntityItem(world, arrow.posX, arrow.posY, arrow.posZ,
|
||||
new ItemStack(Items.arrow));
|
||||
world.spawnEntityInWorld(replacement);
|
||||
}
|
||||
world.removeEntity(arrow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<EntityItem> list = world.getEntitiesWithinAABB(EntityItem.class, bounds);
|
||||
|
||||
for (EntityItem e : list)
|
||||
{
|
||||
if (e.age >= 10)
|
||||
{
|
||||
double x = player.posX - e.posX;
|
||||
double y = player.posY - e.posY;
|
||||
double z = player.posZ - e.posZ;
|
||||
|
||||
double length = Math.sqrt(x * x + y * y + z * z) * 2;
|
||||
|
||||
x = x / length + player.motionX / 2;
|
||||
y = y / length + player.motionY / 2;
|
||||
z = z / length + player.motionZ / 2;
|
||||
|
||||
e.motionX =+ x;
|
||||
e.motionY =+ y;
|
||||
e.motionZ =+ z;
|
||||
e.isAirBorne = true;
|
||||
|
||||
if (e.isCollidedHorizontally)
|
||||
{
|
||||
e.motionY += 1;
|
||||
}
|
||||
|
||||
if (world.rand.nextInt(20) == 0)
|
||||
{
|
||||
float pitch = 0.85f - world.rand.nextFloat() * 3f / 10f;
|
||||
world.playSoundEffect(e.posX, e.posY, e.posZ, "mob.endermen.portal", 0.6f, pitch);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isMagnetActive(ItemStack itemStack)
|
||||
{
|
||||
return isMagnetActive(itemStack.getItemDamage());
|
||||
}
|
||||
|
||||
private boolean isMagnetActive(int damage)
|
||||
{
|
||||
return (damage & 0x01) == 1;
|
||||
}
|
||||
|
||||
private float getRadius(int damageValue)
|
||||
{
|
||||
return this.rangeBase + (multiplier * (damageValue >> 1));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package magicbees.item;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.item.types.NuggetType;
|
||||
import magicbees.main.CommonProxy;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemNugget extends Item
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] icons;
|
||||
|
||||
public ItemNugget()
|
||||
{
|
||||
super();
|
||||
this.setCreativeTab(CreativeTabs.tabMaterials);
|
||||
this.setHasSubtypes(true);
|
||||
this.setUnlocalizedName("beeNugget");
|
||||
}
|
||||
|
||||
public ItemStack getStackForType(NuggetType type)
|
||||
{
|
||||
return new ItemStack(this, 1, type.ordinal());
|
||||
}
|
||||
|
||||
public ItemStack getStackForType(NuggetType type, int count)
|
||||
{
|
||||
return new ItemStack(this, count, type.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list)
|
||||
{
|
||||
for (NuggetType type : NuggetType.values())
|
||||
{
|
||||
if (type.isActive())
|
||||
{
|
||||
list.add(new ItemStack(item, 1, type.ordinal()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
this.icons = new IIcon[NuggetType.values().length];
|
||||
for (int i = 0; i < NuggetType.values().length; i++)
|
||||
{
|
||||
this.icons[i] = par1IconRegister.registerIcon(CommonProxy.DOMAIN + ":nugget"
|
||||
+ NuggetType.values()[i].name().substring(0, 1)
|
||||
+ NuggetType.values()[i].name().substring(1).toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int meta)
|
||||
{
|
||||
return icons[meta];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack)
|
||||
{
|
||||
return NuggetType.values()[stack.getItemDamage()].getName();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package magicbees.item;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.Tabs;
|
||||
import magicbees.item.types.PollenType;
|
||||
import magicbees.main.utils.compat.ForestryHelper;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemPollen extends Item
|
||||
{
|
||||
public ItemPollen()
|
||||
{
|
||||
super();
|
||||
this.setCreativeTab(Tabs.tabApiculture);
|
||||
this.setHasSubtypes(true);
|
||||
this.setUnlocalizedName("pollen");
|
||||
GameRegistry.registerItem(this, "pollen");
|
||||
}
|
||||
public ItemStack getStackForType(PollenType type)
|
||||
{
|
||||
return new ItemStack(this, 1, type.ordinal());
|
||||
}
|
||||
|
||||
public ItemStack getStackForType(PollenType type, int count)
|
||||
{
|
||||
return new ItemStack(this, count, type.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List list)
|
||||
{
|
||||
for (PollenType type : PollenType.values())
|
||||
{
|
||||
list.add(this.getStackForType(type));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderPasses(int metadata)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon secondIcon;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
this.itemIcon = par1IconRegister.registerIcon(ForestryHelper.Name.toLowerCase() + ":pollen.0");
|
||||
this.secondIcon= par1IconRegister.registerIcon(ForestryHelper.Name.toLowerCase() + ":pollen.1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int pass)
|
||||
{
|
||||
return (pass == 0) ? this.itemIcon : this.secondIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int pass)
|
||||
{
|
||||
int meta = Math.max(0, Math.min(PollenType.values().length - 1, stack.getItemDamage()));
|
||||
int colour = PollenType.values()[meta].colour[0];
|
||||
|
||||
if (pass >= 1)
|
||||
{
|
||||
colour = PollenType.values()[meta].colour[1];
|
||||
}
|
||||
|
||||
return colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack)
|
||||
{
|
||||
return PollenType.values()[stack.getItemDamage()].getName();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package magicbees.item;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.Tabs;
|
||||
import magicbees.item.types.PropolisType;
|
||||
import magicbees.main.utils.compat.ForestryHelper;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemPropolis extends Item
|
||||
{
|
||||
public ItemPropolis()
|
||||
{
|
||||
super();
|
||||
this.setCreativeTab(Tabs.tabApiculture);
|
||||
this.setHasSubtypes(true);
|
||||
this.setUnlocalizedName("propolis");
|
||||
GameRegistry.registerItem(this, "propolis");
|
||||
}
|
||||
|
||||
public ItemStack getStackForType(PropolisType type)
|
||||
{
|
||||
return new ItemStack(this, 1, type.ordinal());
|
||||
}
|
||||
|
||||
public ItemStack getStackForType(PropolisType type, int count)
|
||||
{
|
||||
return new ItemStack(this, count, type.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List list)
|
||||
{
|
||||
for (PropolisType type : PropolisType.values())
|
||||
{
|
||||
list.add(this.getStackForType(type));
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
this.itemIcon = par1IconRegister.registerIcon(ForestryHelper.Name.toLowerCase() + ":propolis.0");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColorFromItemStack(ItemStack stack, int pass)
|
||||
{
|
||||
int colour = 0xffffff;
|
||||
int meta = stack.getItemDamage();
|
||||
if (meta >= 0 && meta < PropolisType.values().length)
|
||||
{
|
||||
colour = PropolisType.values()[meta].colour;
|
||||
}
|
||||
return colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack)
|
||||
{
|
||||
return PropolisType.values()[stack.getItemDamage()].getName();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package magicbees.item;
|
||||
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.utils.compat.ThaumcraftHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import thaumcraft.api.IRepairableExtended;
|
||||
import thaumcraft.api.ThaumcraftApi;
|
||||
import forestry.api.arboriculture.IToolGrafter;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class ItemThaumiumGrafter extends Item implements IRepairableExtended, IToolGrafter
|
||||
{
|
||||
public ItemThaumiumGrafter()
|
||||
{
|
||||
super();
|
||||
this.setMaxStackSize(1);
|
||||
this.setMaxDamage(15);
|
||||
this.setCreativeTab(forestry.api.core.Tabs.tabArboriculture);
|
||||
this.setUnlocalizedName(this.iconString = CommonProxy.DOMAIN + ":thaumiumGrafter");
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSaplingModifier(ItemStack stack, World world, EntityPlayer player, int x, int y, int z)
|
||||
{
|
||||
return 100f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getToolClasses(ItemStack itemStack) {
|
||||
HashSet<String> classes = new HashSet<String>(1);
|
||||
classes.add("grafter");
|
||||
return classes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHarvestLevel(ItemStack itemStack, String toolClass) {
|
||||
return toolClass.equals("grafter") ? 3 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float func_150893_a(ItemStack itemStack, Block block)
|
||||
{
|
||||
return 1f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDigSpeed(ItemStack itemStack, Block block, int metadata)
|
||||
{
|
||||
return ForgeHooks.isToolEffective(itemStack, block, metadata) ? 4.8f : func_150893_a(itemStack, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack itemstack, World world, Block block, int x, int y, int z,
|
||||
EntityLivingBase entityLiving) {
|
||||
int damage = 1;
|
||||
if (block == Config.tcLeaf)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z) & 1;
|
||||
if (meta == 0 || meta == 1)
|
||||
{
|
||||
this.dropItem(world, x, y, z, new ItemStack(Config.tcPlant, 1, meta));
|
||||
}
|
||||
}
|
||||
itemstack.damageItem(damage, entityLiving);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void dropItem(World world, int x, int y, int z, ItemStack item)
|
||||
{
|
||||
if (!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops"))
|
||||
{
|
||||
float f = 0.7F;
|
||||
double d0 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
|
||||
double d1 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
|
||||
double d2 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
|
||||
EntityItem entityitem = new EntityItem(world, (double)x + d0, (double)y + d1, (double)z + d2, item);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the enchantability factor of the item, most of the time is based on material.
|
||||
*/
|
||||
public int getItemEnchantability()
|
||||
{
|
||||
return ThaumcraftApi.toolMatThaumium.getEnchantability();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name for this tool's material.
|
||||
*/
|
||||
public String getToolMaterialName()
|
||||
{
|
||||
return ThaumcraftApi.toolMatThaumium.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether this item is repairable in an anvil.
|
||||
*/
|
||||
public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack)
|
||||
{
|
||||
return ThaumcraftApi.toolMatThaumium.customCraftingMaterial == par2ItemStack.getItem() ? true : super.getIsRepairable
|
||||
(par1ItemStack, par2ItemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doRepair(ItemStack stack, EntityPlayer player, int enchantLevel)
|
||||
{
|
||||
boolean flag = false;
|
||||
if (stack.getItemDamage() > 0)
|
||||
{
|
||||
flag = true;
|
||||
player.addExhaustion(0.6f * (enchantLevel * enchantLevel));
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package magicbees.item;
|
||||
|
||||
import magicbees.main.CommonProxy;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import thaumcraft.api.IRepairable;
|
||||
import thaumcraft.api.ThaumcraftApi;
|
||||
import forestry.api.core.IToolScoop;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class ItemThaumiumScoop extends Item implements IRepairable, IToolScoop
|
||||
{
|
||||
public ItemThaumiumScoop()
|
||||
{
|
||||
super();
|
||||
this.setMaxStackSize(1);
|
||||
this.setMaxDamage(30);
|
||||
this.setCreativeTab(forestry.api.core.Tabs.tabApiculture);
|
||||
this.setUnlocalizedName(this.iconString = CommonProxy.DOMAIN + ":thaumiumScoop");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getToolClasses(ItemStack itemStack) {
|
||||
HashSet<String> classes = new HashSet<String>(1);
|
||||
classes.add("scoop");
|
||||
return classes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHarvestLevel(ItemStack itemStack, String toolClass) {
|
||||
return toolClass.equals("scoop") ? 3 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float func_150893_a(ItemStack itemStack, Block block)
|
||||
{
|
||||
return 1f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDigSpeed(ItemStack itemStack, Block block, int metadata)
|
||||
{
|
||||
return ForgeHooks.isToolEffective(itemStack, block, metadata) ? 4.8f : func_150893_a(itemStack, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack itemstack, World world, Block block, int j, int k, int l,
|
||||
EntityLivingBase entityliving) {
|
||||
itemstack.damageItem(1, entityliving);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the enchantability factor of the item, most of the time is based on material.
|
||||
*/
|
||||
public int getItemEnchantability()
|
||||
{
|
||||
return ThaumcraftApi.toolMatThaumium.getEnchantability();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name for this tool's material.
|
||||
*/
|
||||
public String getToolMaterialName()
|
||||
{
|
||||
return ThaumcraftApi.toolMatThaumium.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether this item is repairable in an anvil.
|
||||
*/
|
||||
public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack)
|
||||
{
|
||||
return ThaumcraftApi.toolMatThaumium.customCraftingMaterial == par2ItemStack.getItem() ? true : super
|
||||
.getIsRepairable(par1ItemStack, par2ItemStack);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package magicbees.item;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.Tabs;
|
||||
import magicbees.item.types.WaxType;
|
||||
import magicbees.main.CommonProxy;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemWax extends Item
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon secondaryIcon;
|
||||
|
||||
public ItemWax()
|
||||
{
|
||||
super();
|
||||
this.setCreativeTab(Tabs.tabApiculture);
|
||||
this.setHasSubtypes(true);
|
||||
this.setUnlocalizedName("wax");
|
||||
GameRegistry.registerItem(this, "wax");
|
||||
}
|
||||
|
||||
public ItemStack getStackForType(WaxType type)
|
||||
{
|
||||
return new ItemStack(this, 1, type.ordinal());
|
||||
}
|
||||
|
||||
public ItemStack getStackForType(WaxType type, int count)
|
||||
{
|
||||
return new ItemStack(this, count, type.ordinal());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
this.itemIcon = par1IconRegister.registerIcon(CommonProxy.DOMAIN + ":wax.0");
|
||||
this.secondaryIcon = par1IconRegister.registerIcon(CommonProxy.DOMAIN + ":wax.1");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int meta)
|
||||
{
|
||||
return (WaxType.values()[meta].sparkly) ? this.itemIcon : this.secondaryIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List list)
|
||||
{
|
||||
for (WaxType type : WaxType.values())
|
||||
{
|
||||
list.add(this.getStackForType(type));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int pass)
|
||||
{
|
||||
int colour = 0xffffff;
|
||||
int meta = stack.getItemDamage();
|
||||
if (meta >= 0 && meta < WaxType.values().length)
|
||||
{
|
||||
colour = WaxType.values()[meta].colour;
|
||||
}
|
||||
return colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack)
|
||||
{
|
||||
return WaxType.values()[stack.getItemDamage()].getName();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package magicbees.item.types;
|
||||
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
public enum CapsuleType
|
||||
{
|
||||
MAGIC("magic", 2000, 0),
|
||||
VOID("void", 8000, 1),
|
||||
;
|
||||
private String name;
|
||||
public int capacity;
|
||||
public int iconIdx;
|
||||
|
||||
private CapsuleType(String n, int c, int idx)
|
||||
{
|
||||
this.name = n;
|
||||
this.capacity = c;
|
||||
this.iconIdx = idx;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getLocalizedName()
|
||||
{
|
||||
return LocalizationManager.getLocalizedString("capsule." + name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package magicbees.item.types;
|
||||
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public enum CombType
|
||||
{
|
||||
MUNDANE("mundane", true),
|
||||
MOLTEN("molten", true),
|
||||
OCCULT("occult", true),
|
||||
OTHERWORLDLY("otherworldly", true),
|
||||
TRANSMUTED("transmuted", true),
|
||||
|
||||
PAPERY("paper", true),
|
||||
SOUL("soul", true),
|
||||
FURTIVE("furtive", false),
|
||||
INTELLECT("aware", false),
|
||||
TEMPORAL("time", false),
|
||||
FORGOTTEN("forgotten", false),
|
||||
|
||||
AIRY("air", false),
|
||||
FIREY("fire", false),
|
||||
WATERY("water", false),
|
||||
EARTHY("earth", false),
|
||||
|
||||
TC_AIR("TCair", false),
|
||||
TC_FIRE("TCfire", false),
|
||||
TC_WATER("TCwater", false),
|
||||
TC_EARTH("TCearth", false),
|
||||
TC_ORDER("TCorder", false),
|
||||
TC_CHAOS("TCchaos", false),
|
||||
|
||||
AM_ESSENCE("essence", false),
|
||||
AM_POTENT("potent", false),
|
||||
|
||||
TE_DESTABILIZED("TEelectric", false),
|
||||
TE_CARBON("TEcarbon", false),
|
||||
TE_LUX("TElux", false),
|
||||
TE_ENDEARING("TEendearing", false),
|
||||
;
|
||||
|
||||
private static int[][] colours = new int[][] {
|
||||
{0xFF9859, 0xFFC58E},
|
||||
{0xcc3333, 0x1E160E},
|
||||
{0x9872FF, 0x2D2D2D},
|
||||
{0x3EE0D8, 0x3A3820},
|
||||
{0xE5425D, 0x323291},
|
||||
|
||||
{0xBCA664, 0x35332E},
|
||||
{0x7F7171, 0x876D53},
|
||||
{0xB7ACB7, 0x636363},
|
||||
{0x0092e9, 0x618fff},
|
||||
{0x2F9381, 0x773C31},
|
||||
{0xB191D8, 0x35443B},
|
||||
|
||||
{0xffff7e, 0x606308},
|
||||
{0xff3C01, 0x5B0D10},
|
||||
{0x0090ff, 0x102F6B},
|
||||
{0x00a000, 0x043004},
|
||||
|
||||
{0xFFDF14, 0x707019},
|
||||
{0xE21802, 0x3F0E12},
|
||||
{0x00B6FF, 0x0F373D},
|
||||
{0x28D328, 0x333004},
|
||||
{0xDDDDFF, 0x9D9DB5},
|
||||
{0x555577, 0x2D2D56},
|
||||
|
||||
{0xCC8604, 0x41046F},
|
||||
{0xCCCC04, 0x41046F},
|
||||
|
||||
{0xCC002C, 0x6B0118},
|
||||
{0x454545, 0x0F0F0F},
|
||||
{0xF5F3A4, 0xC9C87D},
|
||||
{0x12E3D9, 0x069E97},
|
||||
};
|
||||
|
||||
private CombType(String pName, boolean show)
|
||||
{
|
||||
this.name = pName;
|
||||
|
||||
this.showInList = show;
|
||||
}
|
||||
|
||||
public void setHidden()
|
||||
{
|
||||
this.showInList = false;
|
||||
}
|
||||
|
||||
private String name;
|
||||
public boolean showInList;
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return LocalizationManager.getLocalizedString("comb." + this.name);
|
||||
}
|
||||
|
||||
public int[] getColours()
|
||||
{
|
||||
return colours[this.ordinal()];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package magicbees.item.types;
|
||||
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
public enum DropType
|
||||
{
|
||||
ENCHANTED("enchanting", 0x6e1c6d, 0xff8fff),
|
||||
INTELLECT("intellect", 0x25914D, 0x18E072),
|
||||
DESTABILIZED("destabilized", 0xCC002C, 0x6B0118),
|
||||
CARBON("carbon", 0x454545, 0x0F0F0F),
|
||||
LUX("lux", 0xF5F3A4, 0xC9C87D),
|
||||
ENDEARING("endearing", 0x12E3D9, 0x069E97),
|
||||
|
||||
;
|
||||
|
||||
private DropType(String pName, int colourA, int colourB)
|
||||
{
|
||||
this.name = pName;
|
||||
this.combColour[0] = colourA;
|
||||
this.combColour[1] = colourB;
|
||||
}
|
||||
|
||||
private final String name;
|
||||
public int[] combColour = new int[2];
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return LocalizationManager.getLocalizedString("drop." + this.name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package magicbees.item.types;
|
||||
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public enum FluidType
|
||||
{
|
||||
// Incidentally, Item meta is the liquid ID.
|
||||
|
||||
// Args are: forgeLiquidID, Display Name, Icon idx
|
||||
EMPTY(""),
|
||||
|
||||
// Vanilla
|
||||
WATER("water"),
|
||||
LAVA("lava"),
|
||||
|
||||
// Forestry
|
||||
BIOMASS("biomass"),
|
||||
ETHANOL("bioethanol"),
|
||||
|
||||
// Buildcraft
|
||||
OIL("oil"),
|
||||
FUEL("fuel"),
|
||||
|
||||
// More Forestry
|
||||
SEEDOIL("seedoil"),
|
||||
HONEY("honey"),
|
||||
JUICE("juice"),
|
||||
CRUSHEDICE("ice"),
|
||||
MILK("milk"),
|
||||
|
||||
// ExtraBees liquids
|
||||
ACID("acid"),
|
||||
POISON("poison"),
|
||||
LIQUIDNITROGEN("liquidnitrogen"),
|
||||
DNA("liquiddna"),
|
||||
|
||||
// Railcraft
|
||||
CREOSOTEOIL("creosote"),
|
||||
STEAM("steam"),
|
||||
;
|
||||
public String liquidID;
|
||||
public int iconIdx;
|
||||
public boolean available = false;
|
||||
public IIcon liquidIcon;
|
||||
|
||||
private FluidType(String l)
|
||||
{
|
||||
this.liquidID = l;
|
||||
}
|
||||
|
||||
public String getDisplayName()
|
||||
{
|
||||
return LocalizationManager.getLocalizedString("liquid." + liquidID);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package magicbees.item.types;
|
||||
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
|
||||
public enum HiveFrameType
|
||||
{
|
||||
MAGIC("Magic", 240, 1f, 1f, 1f, 2f, 0.6f),
|
||||
RESILIENT("Resilient", 800, 1f, 1f, 1f, 2f, 0.5f),
|
||||
GENTLE("Gentle", 200, 1f, 0.7f, 1.5f, 1.4f, 0.01f),
|
||||
METABOLIC("Metabolic", 130, 1f, 1.8f, 1f, 1.2f, 1f),
|
||||
NECROTIC("Necrotic", 280, 1f, 1f, 0.3f, 0.75f, 1.2f),
|
||||
TEMPORAL("Temporal", 300, 1f, 1f, 2.5f, 1f, 0.8f),
|
||||
OBLIVION("Oblivion", 50, 1f, 1f, 0.0001f, 0f, 1f),
|
||||
;
|
||||
|
||||
private HiveFrameType(String name, int damage,
|
||||
float territory, float mutation, float lifespan, float production, float geneticDecay)
|
||||
{
|
||||
this(name, damage, territory, mutation, lifespan, production, 1f, geneticDecay, false, false, false, false);
|
||||
}
|
||||
|
||||
private HiveFrameType(String name, int damage,
|
||||
float territory, float mutation, float lifespan, float production, float flowering, float geneticDecay,
|
||||
boolean sealed, boolean lit, boolean sunlit, boolean hellish)
|
||||
{
|
||||
this.frameName = name;
|
||||
this.maxDamage = damage;
|
||||
|
||||
this.territoryMod = territory;
|
||||
this.mutationMod = mutation;
|
||||
this.lifespanMod = lifespan;
|
||||
this.productionMod = production;
|
||||
this.floweringMod = flowering;
|
||||
this.geneticDecayMod = geneticDecay;
|
||||
this.isSealed = sealed;
|
||||
this.isLit = lit;
|
||||
this.isSunlit = sunlit;
|
||||
this.isHellish = hellish;
|
||||
}
|
||||
|
||||
private String frameName;
|
||||
public int maxDamage;
|
||||
|
||||
public float territoryMod;
|
||||
public float mutationMod;
|
||||
public float lifespanMod;
|
||||
public float productionMod;
|
||||
public float floweringMod;
|
||||
public float geneticDecayMod;
|
||||
public boolean isSealed;
|
||||
public boolean isLit;
|
||||
public boolean isSunlit;
|
||||
public boolean isHellish;
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this.frameName;
|
||||
}
|
||||
|
||||
public String getLocalizedName()
|
||||
{
|
||||
return LocalizationManager.getLocalizedString("frame." + this.frameName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package magicbees.item.types;
|
||||
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public enum NuggetType
|
||||
{
|
||||
IRON,
|
||||
COPPER,
|
||||
TIN,
|
||||
SILVER,
|
||||
LEAD,
|
||||
DIAMOND,
|
||||
EMERALD,
|
||||
APATITE,
|
||||
ELECTRUM,
|
||||
PLATINUM,
|
||||
NICKEL,
|
||||
INVAR,
|
||||
BRONZE,
|
||||
ENDERIUM,
|
||||
;
|
||||
|
||||
private Item targetIngot;
|
||||
private boolean active;
|
||||
|
||||
private NuggetType()
|
||||
{
|
||||
this.active = true;
|
||||
}
|
||||
|
||||
public void setIngotItem(Item target)
|
||||
{
|
||||
this.targetIngot = target;
|
||||
}
|
||||
|
||||
public Item getIngotItem()
|
||||
{
|
||||
return this.targetIngot;
|
||||
}
|
||||
|
||||
public void setInactive()
|
||||
{
|
||||
this.active = false;
|
||||
}
|
||||
|
||||
public boolean isActive()
|
||||
{
|
||||
return this.active;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return LocalizationManager.getLocalizedString("nugget." + this.toString().toLowerCase());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package magicbees.item.types;
|
||||
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
public enum PollenType
|
||||
{
|
||||
UNUSUAL("unusual", 0xD8417B, 0xA03059),
|
||||
PHASED("phased", 0x4974B4, 0x456BA5),
|
||||
;
|
||||
|
||||
private PollenType(String pName, int colourA, int colourB)
|
||||
{
|
||||
this.name = pName;
|
||||
this.colour[0] = colourA;
|
||||
this.colour[1] = colourB;
|
||||
}
|
||||
|
||||
private String name;
|
||||
public int[] colour = new int[2];
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return LocalizationManager.getLocalizedString("pollen." + this.name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package magicbees.item.types;
|
||||
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
public enum PropolisType
|
||||
{
|
||||
UNSTABLE("unstable", 0xEFB492),
|
||||
|
||||
AIR("air", 0xA19E10),
|
||||
FIRE("fire", 0x95132F),
|
||||
WATER("water", 0x1054A1),
|
||||
EARTH("earth", 0x00a000),
|
||||
ORDER("dull", 0xDDDDFF),
|
||||
CHAOS("magic", 0x555577),
|
||||
;
|
||||
|
||||
private PropolisType(String pName, int overlayColour)
|
||||
{
|
||||
this.name = pName;
|
||||
this.colour = overlayColour;
|
||||
}
|
||||
|
||||
private String name;
|
||||
public int colour;
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return LocalizationManager.getLocalizedString("propolis." + this.name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package magicbees.item.types;
|
||||
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
public enum ResourceType
|
||||
{
|
||||
LORE_FRAGMENT("fragment", true),
|
||||
AROMATIC_LUMP("lump", true),
|
||||
EXTENDED_FERTILIZER("fertilizer", true),
|
||||
SKULL_CHIP("skullChip", true),
|
||||
SKULL_FRAGMENT("skullFragment", true),
|
||||
DRAGON_DUST("dragonDust", true),
|
||||
DRAGON_CHUNK("dragonChunk", true),
|
||||
ESSENCE_FALSE_LIFE("essenceLife", true),//
|
||||
ESSENCE_SHALLOW_GRAVE("essenceDeath", true),//
|
||||
ESSENCE_LOST_TIME("essenceTime", true),
|
||||
ESSENCE_EVERLASTING_DURABILITY("essenceDurability", true),//
|
||||
ESSENCE_SCORNFUL_OBLIVION("essenceOblivion", true),
|
||||
ESSENCE_FICKLE_PERMANENCE("essenceMutable", true),//
|
||||
z_2("lump", false), // Using lump for the name to avoid missing texture warnings.
|
||||
z_3("lump", false),
|
||||
z_4("lump", false),
|
||||
z_5("lump", false),
|
||||
DIMENSIONAL_SINGULARITY("dimensionalSingularity", true),
|
||||
TC_DUST_AIR("TCairDust", true),
|
||||
TC_DUST_WATER("TCwaterDust", true),
|
||||
TC_DUST_FIRE("TCfireDust", true),
|
||||
TC_DUST_EARTH("TCearthDust", true),
|
||||
TC_DUST_ORDER("TCorderDust", true),
|
||||
TC_DUST_CHAOS("TCchaosDust", true),
|
||||
|
||||
|
||||
// Dummy items for Thaumanomicon research icons.
|
||||
// These won't ever actually exist in-game, and so they can be moved around.
|
||||
RESEARCH_STARTNODE("startNode", false),
|
||||
RESEARCH_BEEINFUSION("beeInfusion", false),
|
||||
;
|
||||
|
||||
private ResourceType(String n, boolean show)
|
||||
{
|
||||
this.name = n;
|
||||
this.showInList = show;
|
||||
}
|
||||
private String name;
|
||||
public boolean showInList;
|
||||
|
||||
public void setHidden()
|
||||
{
|
||||
this.showInList = false;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getLocalizedName()
|
||||
{
|
||||
return LocalizationManager.getLocalizedString("resource." + this.name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package magicbees.item.types;
|
||||
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
public enum WaxType
|
||||
{
|
||||
MAGIC("magic", true, 0xd242df),
|
||||
SOUL("soul", false, 0x967C63),
|
||||
AMNESIC("amnesic", true, 0x856DFF)
|
||||
;
|
||||
|
||||
private WaxType(String n, boolean sp, int c)
|
||||
{
|
||||
this.name = n;
|
||||
this.sparkly = sp;
|
||||
this.colour = c;
|
||||
}
|
||||
|
||||
private String name;
|
||||
public boolean sparkly;
|
||||
public int colour;
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return LocalizationManager.getLocalizedString("wax." + this.name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package magicbees.main;
|
||||
|
||||
import magicbees.client.render.EffectJarRenderer;
|
||||
import magicbees.tileentity.TileEntityEffectJar;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.world.World;
|
||||
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;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ClientProxy extends CommonProxy
|
||||
{ @Override
|
||||
public void registerRenderers()
|
||||
{
|
||||
super.registerRenderers();
|
||||
|
||||
RenderIdEffectJar = RenderingRegistry.getNextAvailableRenderId();
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(Config.effectJar), EffectJarRenderer.instance);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityEffectJar.class, EffectJarRenderer.instance);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package magicbees.main;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
||||
public class CommonProxy
|
||||
{
|
||||
public static final String DOMAIN = "magicbees";
|
||||
public static final String TEXTURE = "textures/";
|
||||
public static final String GUI_TEXTURE = TEXTURE + "gui/";
|
||||
public static final String ITEM_TEXTURE = TEXTURE + "items/";
|
||||
public static final String MODEL = "model/";
|
||||
public static final String LANGS = "lang/";
|
||||
|
||||
@Deprecated
|
||||
public static final String RESOURCE_PATH = "/assets/magicbees/";
|
||||
@Deprecated
|
||||
public static final String TEXTURE_PATH = RESOURCE_PATH + "textures/";
|
||||
@Deprecated
|
||||
public static final String MODEL_PATH = RESOURCE_PATH + "model/";
|
||||
@Deprecated
|
||||
public static final String TCBEES_RESEARCH = RESOURCE_PATH + "research/";
|
||||
@Deprecated
|
||||
public static final String TCBEES_LOCDIR = RESOURCE_PATH + "lang/";
|
||||
|
||||
public static String FORESTRY_GFX_ITEMS;
|
||||
public static String FORESTRY_GFX_BEEEFFECTS;
|
||||
|
||||
@Deprecated
|
||||
public static final String GUI_PATH = TEXTURE_PATH + "gui/";
|
||||
|
||||
public static int RenderIdEffectJar;
|
||||
|
||||
public void registerRenderers() { }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,436 @@
|
||||
package magicbees.main;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.storage.BackpackManager;
|
||||
import forestry.api.storage.EnumBackpackType;
|
||||
import forestry.api.storage.IBackpackDefinition;
|
||||
import magicbees.block.BlockEffectJar;
|
||||
import magicbees.block.BlockHive;
|
||||
import magicbees.block.BlockPlanks;
|
||||
import magicbees.block.BlockWoodSlab;
|
||||
import magicbees.block.types.HiveType;
|
||||
import magicbees.block.types.PlankType;
|
||||
import magicbees.item.*;
|
||||
import magicbees.item.types.*;
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import magicbees.main.utils.compat.ThaumcraftHelper;
|
||||
import magicbees.storage.BackpackDefinition;
|
||||
import magicbees.tileentity.TileEntityEffectJar;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemMultiTexture;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.util.WeightedRandomChestContent;
|
||||
import net.minecraftforge.common.ChestGenHooks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
/**
|
||||
* A class to hold some data related to mod state & functions.
|
||||
* @author MysteriousAges
|
||||
*
|
||||
*/
|
||||
public class Config
|
||||
{
|
||||
public boolean DrawParticleEffects;
|
||||
public boolean BeeInfusionsAdded;
|
||||
public boolean AddThaumcraftItemsToBackpacks;
|
||||
public boolean DisableUpdateNotification;
|
||||
public boolean AreMagicPlanksFlammable;
|
||||
public boolean UseImpregnatedStickInTools;
|
||||
public boolean MoonDialShowsPhaseInText;
|
||||
public boolean DoSpecialHiveGen;
|
||||
public String ThaumaturgeExtraItems;
|
||||
public int CapsuleStackSizeMax;
|
||||
public boolean DoHiveRetrogen;
|
||||
public boolean ForceHiveRegen;
|
||||
|
||||
public float MagnetBaseRange;
|
||||
public float MagnetLevelMultiplier;
|
||||
public int MagnetMaxLevel;
|
||||
|
||||
public boolean ForestryDebugEnabled;
|
||||
|
||||
public static BlockPlanks planksWood;
|
||||
public static BlockWoodSlab slabWoodHalf;
|
||||
public static BlockWoodSlab slabWoodFull;
|
||||
public static BlockEffectJar effectJar;
|
||||
public static BlockHive hive;
|
||||
|
||||
public static ItemComb combs;
|
||||
public static ItemWax wax;
|
||||
public static ItemPropolis propolis;
|
||||
public static ItemDrop drops;
|
||||
public static ItemPollen pollen;
|
||||
public static ItemCrystalAspect solidFlux;
|
||||
public static ItemMiscResources miscResources;
|
||||
public static ItemFood jellyBaby;
|
||||
public static Item thaumiumScoop;
|
||||
public static Item thaumiumGrafter;
|
||||
public static ItemNugget nuggets;
|
||||
public static ItemMoonDial moonDial;
|
||||
public static ItemMysteriousMagnet magnet;
|
||||
|
||||
//----- Liquid Capsules --------------------
|
||||
public static ItemCapsule magicCapsule;
|
||||
public static ItemCapsule voidCapsule;
|
||||
|
||||
//----- Apiary Frames ----------------------
|
||||
public static ItemMagicHiveFrame hiveFrameMagic;
|
||||
public static ItemMagicHiveFrame hiveFrameResilient;
|
||||
public static ItemMagicHiveFrame hiveFrameGentle;
|
||||
public static ItemMagicHiveFrame hiveFrameMetabolic;
|
||||
public static ItemMagicHiveFrame hiveFrameNecrotic;
|
||||
public static ItemMagicHiveFrame hiveFrameTemporal;
|
||||
public static ItemMagicHiveFrame hiveFrameOblivion;
|
||||
|
||||
//----- Backpacks ------------------------------------------
|
||||
public static Item thaumaturgeBackpackT1;
|
||||
public static Item thaumaturgeBackpackT2;
|
||||
public static BackpackDefinition thaumaturgeBackpackDef;
|
||||
|
||||
//----- Forestry Blocks ------------------------------------
|
||||
public static Block fHiveBlock;
|
||||
public static Block fAlvearyBlock;
|
||||
//----- Forestry Items -------------------------------------
|
||||
public static Item fBeeComb;
|
||||
public static Item fHoneydew;
|
||||
public static Item fHoneyDrop;
|
||||
public static Item fPollen;
|
||||
public static Item fCraftingResource;
|
||||
//----- Thaumcraft Blocks ----------------------------------
|
||||
public static Block tcPlant;
|
||||
public static Block tcCandle;
|
||||
public static Block tcCrystal;
|
||||
public static Block tcMarker;
|
||||
public static Block tcJar;
|
||||
public static Block tcLog;
|
||||
public static Block tcLeaf;
|
||||
public static Block tcWarded;
|
||||
//----- Thaumcraft Items -----------------------------------
|
||||
public static Item tcFilledJar;
|
||||
public static Item tcMiscResource;
|
||||
//public static Item tcEssentiaBottle;
|
||||
public static Item tcShard;
|
||||
public static Item tcGolem;
|
||||
//public static Item tcWispEssence;
|
||||
public static Item tcNuggets;
|
||||
public static Item tcNuggetChicken;
|
||||
public static Item tcNuggetBeef;
|
||||
public static Item tcNuggetPork;
|
||||
//----- Equivalent Exchange Blocks -------------------------
|
||||
//----- Equivalent Exchange Items --------------------------
|
||||
public static Item eeMinuimShard;
|
||||
//----- Ars Magica Blocks ----------------------------------
|
||||
public static Block amResourceBlock;
|
||||
public static Block amBlackOrchid;
|
||||
public static Block amDesertNova;
|
||||
public static Block amAum;
|
||||
public static Block amWakebloom;
|
||||
public static Block amTarmaRoot;
|
||||
//----- Ars Magica Items -----------------------------------
|
||||
public static Item amItemResource;
|
||||
public static Item amEssence;
|
||||
//----Redstone Arsenal Items---
|
||||
public static ItemStack rsaFluxBlock;
|
||||
public static ItemStack rsaFluxNugget;
|
||||
//---ThermalExpansion Items ---
|
||||
public static ItemStack teEnderiumBlock;
|
||||
public static ItemStack teElectrumBlock;
|
||||
public static ItemStack teInvarBlock;
|
||||
public static ItemStack teNickelBlock;
|
||||
public static ItemStack tePlatinumBlock;
|
||||
public static ItemStack teBronzeBlock;
|
||||
public static ItemStack teEnderiumNugget;
|
||||
public static ItemStack teInvarNugget;
|
||||
public static ItemStack teElectrumNugget;
|
||||
public static ItemStack teNickelNugget;
|
||||
public static ItemStack tePlatinumNugget;
|
||||
public static ItemStack teDustCryotheum;
|
||||
public static ItemStack teDustBlizz;
|
||||
public static ItemStack teDustPyrotheum;
|
||||
public static ItemStack teDustSulfur;
|
||||
public static ItemStack teDustPlatinum;
|
||||
public static FluidStack teFluidGlowstone;
|
||||
public static FluidStack teFluidCoal;
|
||||
public static FluidStack teFluidRedstone;
|
||||
public static FluidStack teFluidEnder;
|
||||
|
||||
|
||||
|
||||
|
||||
//----- Config State info ----------------------------------
|
||||
private Configuration configuration;
|
||||
|
||||
public Config(File configFile)
|
||||
{
|
||||
this.configuration = new Configuration(configFile);
|
||||
this.configuration.load();
|
||||
this.doMiscConfig();
|
||||
|
||||
this.ForestryDebugEnabled = (new File("./config/forestry/DEBUG.ON")).exists();
|
||||
}
|
||||
|
||||
public void saveConfigs()
|
||||
{
|
||||
this.configuration.save();
|
||||
}
|
||||
|
||||
public void setupBlocks()
|
||||
{
|
||||
{
|
||||
if (ThaumcraftHelper.isActive())
|
||||
{
|
||||
planksWood = new BlockPlanks();
|
||||
planksWood.setBlockName("planks");
|
||||
|
||||
//Item.itemsList[planksWood.blockID] = null;
|
||||
//Item.itemsList[planksWood.blockID] = new ItemMultiTexture(planksWood.blockID - 256, planksWood,
|
||||
// PlankType.getAllNames());
|
||||
|
||||
//FMLInterModComms.sendMessage("BuildCraft|Transport", "add-facade", MagicBees.getConfig().planksWood
|
||||
// .blockID + "@" + PlankType.GREATWOOD.ordinal());
|
||||
//FMLInterModComms.sendMessage("BuildCraft|Transport", "add-facade", MagicBees.getConfig().planksWood
|
||||
// .blockID + "@" + PlankType.SILVERWOOD.ordinal());
|
||||
|
||||
slabWoodFull = new BlockWoodSlab(true);
|
||||
slabWoodHalf = new BlockWoodSlab(false);
|
||||
|
||||
slabWoodFull.setBlockName("planks");
|
||||
slabWoodHalf.setBlockName("planks");
|
||||
|
||||
/*Item.itemsList[slabWoodHalf.blockID] = null;
|
||||
Item.itemsList[slabWoodHalf.blockID] = new ItemSlab(slabWoodHalf.blockID - 256, slabWoodHalf, slabWoodFull, false);
|
||||
Item.itemsList[slabWoodFull.blockID] = null;
|
||||
Item.itemsList[slabWoodFull.blockID] = new ItemSlab(slabWoodFull.blockID - 256, slabWoodHalf,
|
||||
slabWoodFull, true);*/
|
||||
|
||||
OreDictionary.registerOre("plankWood", new ItemStack(planksWood, 1, -1));
|
||||
OreDictionary.registerOre("slabWood", new ItemStack(slabWoodHalf, 1, -1));
|
||||
}
|
||||
}
|
||||
|
||||
effectJar = new BlockEffectJar();
|
||||
GameRegistry.registerBlock(effectJar, "effectJar");
|
||||
GameRegistry.registerTileEntity(TileEntityEffectJar.class, TileEntityEffectJar.tileEntityName);
|
||||
|
||||
hive = new BlockHive();
|
||||
GameRegistry.registerBlock(hive, "hive");
|
||||
|
||||
for (HiveType t : HiveType.values())
|
||||
{
|
||||
hive.setHarvestLevel("scoop", t.ordinal(), 0);
|
||||
}
|
||||
|
||||
FMLLog.info("Replacing stupid-block with 'Here, have some delicious textures' ItemBlock. This is 100%% normal.");
|
||||
/*Item.itemsList[hive.blockID] = null;
|
||||
Item.itemsList[hive.blockID] = new ItemMultiTextureTile(hive.blockID - 256, hive, HiveType.getAllNames());*/
|
||||
}
|
||||
|
||||
public void setupItems()
|
||||
{
|
||||
combs = new ItemComb();
|
||||
wax = new ItemWax();
|
||||
propolis = new ItemPropolis();
|
||||
drops = new ItemDrop();
|
||||
miscResources = new ItemMiscResources();
|
||||
|
||||
// Make Aromatic Lumps a swarmer inducer. Chance is /1000.
|
||||
BeeManager.inducers.put(miscResources.getStackForType(ResourceType.AROMATIC_LUMP), 95);
|
||||
|
||||
{
|
||||
if (ThaumcraftHelper.isActive())
|
||||
{
|
||||
try
|
||||
{
|
||||
// 0x8700C6 = purpleish.
|
||||
String backpackName = LocalizationManager.getLocalizedString("backpack.thaumaturge");
|
||||
BackpackDefinition def = new BackpackDefinition("thaumaturge", backpackName, 0x8700C6);
|
||||
thaumaturgeBackpackT1 = BackpackManager.backpackInterface.addBackpack(def, EnumBackpackType.T1);
|
||||
thaumaturgeBackpackT1.setUnlocalizedName("backpack.thaumaturgeT1");
|
||||
thaumaturgeBackpackT2 = BackpackManager.backpackInterface.addBackpack(def, EnumBackpackType.T2);
|
||||
thaumaturgeBackpackT2.setUnlocalizedName("backpack.thaumaturgeT2");
|
||||
// Add additional items from configs to backpack.
|
||||
if (MagicBees.getConfig().ThaumaturgeExtraItems.length() > 0)
|
||||
{
|
||||
FMLLog.info("Attempting to add extra items to Thaumaturge's backpack. If you get an error, check your MagicBees.conf.");
|
||||
FMLInterModComms.sendMessage("Forestry", "add-backpack-items", "thaumaturge@" + MagicBees.getConfig().ThaumaturgeExtraItems);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
FMLLog.severe("MagicBees encountered a problem during loading!");
|
||||
FMLLog.severe("Could not register backpacks via Forestry. Check your FML Client log and see if Forestry crashed silently.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
magicCapsule = new ItemCapsule(CapsuleType.MAGIC, this.CapsuleStackSizeMax);
|
||||
pollen = new ItemPollen();
|
||||
|
||||
{
|
||||
if (ThaumcraftHelper.isActive())
|
||||
{
|
||||
solidFlux = new ItemCrystalAspect();
|
||||
}
|
||||
}
|
||||
|
||||
hiveFrameMagic = new ItemMagicHiveFrame(HiveFrameType.MAGIC);
|
||||
hiveFrameResilient = new ItemMagicHiveFrame(HiveFrameType.RESILIENT);
|
||||
hiveFrameGentle = new ItemMagicHiveFrame(HiveFrameType.GENTLE);
|
||||
hiveFrameMetabolic = new ItemMagicHiveFrame(HiveFrameType.METABOLIC);
|
||||
hiveFrameNecrotic = new ItemMagicHiveFrame(HiveFrameType.NECROTIC);
|
||||
hiveFrameTemporal = new ItemMagicHiveFrame(HiveFrameType.TEMPORAL);
|
||||
hiveFrameOblivion = new ItemMagicHiveFrame(HiveFrameType.OBLIVION);
|
||||
|
||||
ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CORRIDOR, new WeightedRandomChestContent(new ItemStack(hiveFrameOblivion), 1, 1, 18));
|
||||
ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_LIBRARY, new WeightedRandomChestContent(new ItemStack(hiveFrameOblivion), 1, 3, 23));
|
||||
|
||||
jellyBaby = new ItemFood(1, false).setAlwaysEdible()
|
||||
.setPotionEffect(Potion.moveSpeed.id, 5, 1, 1f);
|
||||
jellyBaby.setUnlocalizedName(CommonProxy.DOMAIN + ":jellyBabies").setTextureName(CommonProxy.DOMAIN + ":jellyBabies");
|
||||
GameRegistry.registerItem(jellyBaby, CommonProxy.DOMAIN + ":jellyBabies");
|
||||
|
||||
|
||||
voidCapsule = new ItemCapsule(CapsuleType.VOID, this.CapsuleStackSizeMax);
|
||||
|
||||
{
|
||||
if (ThaumcraftHelper.isActive())
|
||||
{
|
||||
try {
|
||||
// Reflecting avoids the need to directly include the Thaumcraft API in the jar. BAM!
|
||||
Constructor ctor1 = Class.forName("magicbees.item.ItemThaumiumScoop").getConstructor();
|
||||
thaumiumScoop = (Item)ctor1.newInstance();
|
||||
GameRegistry.registerItem(thaumiumScoop, thaumiumScoop.getUnlocalizedName());
|
||||
|
||||
Constructor ctor2 = Class.forName("magicbees.item.ItemThaumiumGrafter").getConstructor();
|
||||
thaumiumGrafter = (Item)ctor2.newInstance();
|
||||
GameRegistry.registerItem(thaumiumGrafter, thaumiumGrafter.getUnlocalizedName());
|
||||
} catch (Exception e) { }
|
||||
}
|
||||
}
|
||||
|
||||
moonDial = new ItemMoonDial();
|
||||
|
||||
nuggets = new ItemNugget();
|
||||
|
||||
magnet = new ItemMysteriousMagnet();
|
||||
magnet.setBaseRange(MagnetBaseRange);
|
||||
magnet.setLevelMultiplier(MagnetLevelMultiplier);
|
||||
magnet.setMaximumLevel(MagnetMaxLevel);
|
||||
|
||||
for (int level = 0; level <= 8; level++)
|
||||
{
|
||||
OreDictionary.registerOre("mb.magnet.level" + level, new ItemStack(magnet, 1, level * 2));
|
||||
OreDictionary.registerOre("mb.magnet.level" + level, new ItemStack(magnet, 1, level * 2 + 1));
|
||||
}
|
||||
|
||||
OreDictionary.registerOre("beeComb", new ItemStack(combs, 1, OreDictionary.WILDCARD_VALUE));
|
||||
OreDictionary.registerOre("waxMagical", wax.getStackForType(WaxType.MAGIC));
|
||||
OreDictionary.registerOre("waxMagical", wax.getStackForType(WaxType.AMNESIC));
|
||||
OreDictionary.registerOre("nuggetIron", nuggets.getStackForType(NuggetType.IRON));
|
||||
OreDictionary.registerOre("nuggetCopper", nuggets.getStackForType(NuggetType.COPPER));
|
||||
OreDictionary.registerOre("nuggetTin", nuggets.getStackForType(NuggetType.TIN));
|
||||
OreDictionary.registerOre("nuggetSilver", nuggets.getStackForType(NuggetType.SILVER));
|
||||
OreDictionary.registerOre("nuggetLead", nuggets.getStackForType(NuggetType.LEAD));
|
||||
OreDictionary.registerOre("shardDiamond", nuggets.getStackForType(NuggetType.DIAMOND));
|
||||
OreDictionary.registerOre("shardEmerald", nuggets.getStackForType(NuggetType.EMERALD));
|
||||
OreDictionary.registerOre("shardApatite", nuggets.getStackForType(NuggetType.APATITE));
|
||||
}
|
||||
|
||||
private void doMiscConfig()
|
||||
{
|
||||
Property p;
|
||||
|
||||
// Pull config from Forestry via reflection
|
||||
Field f;
|
||||
try
|
||||
{
|
||||
f = Class.forName("forestry.core.config.Config").getField("enableParticleFX");
|
||||
this.DrawParticleEffects = f.getBoolean(null);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
p = configuration.get("general", "backpack.thaumaturge.additionalItems", "");
|
||||
p.comment = "Add additional items to the Thaumaturge's Backpack." +
|
||||
"\n Format is the same as Forestry's: id:meta;id;id:meta (etc)";
|
||||
this.ThaumaturgeExtraItems = p.getString();
|
||||
|
||||
p = configuration.get("general", "backpack.forestry.addThaumcraftItems", true);
|
||||
p.comment = "Set to true if you want MagicBees to add several Thaumcraft blocks & items to Forestry backpacks." +
|
||||
"\n Set to false to disable.";
|
||||
this.AddThaumcraftItemsToBackpacks = p.getBoolean(true);
|
||||
|
||||
p = configuration.get("general", "capsuleStackSize", 64);
|
||||
p.comment = "Allows you to edit the stack size of the capsules in MagicBees if using GregTech, \n" +
|
||||
"or the reduced capsule size in Forestry & Railcraft. Default: 64";
|
||||
this.CapsuleStackSizeMax = p.getInt();
|
||||
|
||||
p = configuration.get("general", "disableVersionNotification", false);
|
||||
p.comment = "Set to true to stop ThaumicBees from notifying you when new updates are available. (Does not supress critical updates)";
|
||||
this.DisableUpdateNotification = p.getBoolean(false);
|
||||
|
||||
p = configuration.get("general", "areMagicPlanksFlammable", false);
|
||||
p.comment = "Set to true to allow Greatwood & Silverwood planks to burn in a fire.";
|
||||
this.AreMagicPlanksFlammable = p.getBoolean(false);
|
||||
|
||||
p = configuration.get("general", "useImpregnatedStickInTools", false);
|
||||
p.comment = "Set to true to make Thaumium Grafter & Scoop require impregnated sticks in the recipe.";
|
||||
this.UseImpregnatedStickInTools = p.getBoolean(false);
|
||||
|
||||
p = configuration.get("general", "moonDialShowText", false);
|
||||
p.comment = "set to true to show the current moon phase in mouse-over text.";
|
||||
this.MoonDialShowsPhaseInText = p.getBoolean(false);
|
||||
|
||||
p = configuration.get("general", "doSpecialHiveGen", true);
|
||||
p.comment = "Set to false if you hate fun and do not want special hives generating in Magic biomes.";
|
||||
this.DoSpecialHiveGen = p.getBoolean(true);
|
||||
|
||||
p = configuration.get("Retrogen", "doHiveRetrogen", false);
|
||||
p.comment = "Set to true to enable retroactive worldgen of Magic Bees hives.";
|
||||
this.DoHiveRetrogen = p.getBoolean(false);
|
||||
|
||||
p = configuration.get("Retrogen", "forceHiveRegen", false);
|
||||
p.comment = "Set to true to force a regeneration of Magic Bees hives. Will set config option to false after parsed. (Implies doHiveRetrogen=true)";
|
||||
this.ForceHiveRegen = p.getBoolean(false);
|
||||
|
||||
if (this.ForceHiveRegen)
|
||||
{
|
||||
FMLLog.info("Magic Bees will aggressively regenerate hives in all chunks for this game instance. Config option set to false.");
|
||||
p.set(false);
|
||||
this.DoHiveRetrogen = true;
|
||||
}
|
||||
else if (this.DoHiveRetrogen)
|
||||
{
|
||||
FMLLog.info("Magic Bees will attempt to regenerate hives in chunks that were generated before the mod was added.");
|
||||
}
|
||||
|
||||
p = configuration.get("general", "magnetRangeBase", 3.0);
|
||||
p.comment = "Base range (in blocks) of the Mysterious Magnet";
|
||||
this.MagnetBaseRange = (float)p.getDouble(3.0);
|
||||
|
||||
p = configuration.get("general", "magnetRangeMultiplier", 0.75);
|
||||
p.comment = "Range multiplier per level of the Mysterious Magnet. Total range = base range + level * multiplier";
|
||||
this.MagnetLevelMultiplier = (float)p.getDouble(0.75);
|
||||
|
||||
p = configuration.get("general", "magnetMaximumLevel", 8);
|
||||
p.comment = "Maximum level of the magnets.";
|
||||
this.MagnetMaxLevel = p.getInt();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package magicbees.main;
|
||||
|
||||
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 cpw.mods.fml.common.registry.GameRegistry;
|
||||
import magicbees.bees.BeeManager;
|
||||
import magicbees.bees.TransmutationEffectController;
|
||||
import magicbees.client.gui.GUIHandler;
|
||||
import magicbees.main.utils.CraftingManager;
|
||||
import magicbees.main.utils.IMCManager;
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import magicbees.main.utils.VersionInfo;
|
||||
import magicbees.main.utils.compat.*;
|
||||
import magicbees.world.WorldGeneratorHandler;
|
||||
|
||||
@Mod(
|
||||
modid=VersionInfo.ModName,
|
||||
dependencies=VersionInfo.Depends
|
||||
)
|
||||
public class MagicBees
|
||||
{
|
||||
|
||||
@Mod.Instance(VersionInfo.ModName)
|
||||
public static MagicBees object;
|
||||
|
||||
@SidedProxy(serverSide="magicbees.main.CommonProxy", clientSide="magicbees.main.ClientProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
public GUIHandler guiHandler;
|
||||
private String configsPath;
|
||||
private Config modConfig;
|
||||
private WorldGeneratorHandler worldHandler;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
this.configsPath = event.getModConfigurationDirectory().getAbsolutePath();
|
||||
this.modConfig = new Config(event.getSuggestedConfigurationFile());
|
||||
|
||||
// Compatibility Helpers setup time.
|
||||
ForestryHelper.preInit();
|
||||
ExtraBeesHelper.preInit();
|
||||
ThaumcraftHelper.preInit();
|
||||
EquivalentExchangeHelper.preInit();
|
||||
ArsMagicaHelper.preInit();
|
||||
ThermalExpansionHelper.preInit();
|
||||
RedstoneArsenalHelper.preInit();
|
||||
|
||||
this.modConfig.setupBlocks();
|
||||
this.modConfig.setupItems();
|
||||
|
||||
LocalizationManager.setupLocalizationInfo();
|
||||
|
||||
new TransmutationEffectController();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent event)
|
||||
{
|
||||
ForestryHelper.init();
|
||||
ExtraBeesHelper.init();
|
||||
ThaumcraftHelper.init();
|
||||
EquivalentExchangeHelper.init();
|
||||
ArsMagicaHelper.init();
|
||||
ThermalExpansionHelper.init();
|
||||
RedstoneArsenalHelper.init();
|
||||
|
||||
worldHandler = new WorldGeneratorHandler();
|
||||
GameRegistry.registerWorldGenerator(worldHandler, 0);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event)
|
||||
{
|
||||
ForestryHelper.postInit();
|
||||
ExtraBeesHelper.postInit();
|
||||
ThaumcraftHelper.postInit();
|
||||
EquivalentExchangeHelper.postInit();
|
||||
ArsMagicaHelper.postInit();
|
||||
ThermalExpansionHelper.postInit();
|
||||
RedstoneArsenalHelper.postInit();
|
||||
|
||||
this.guiHandler = new GUIHandler();
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(this, this.guiHandler);
|
||||
|
||||
proxy.registerRenderers();
|
||||
|
||||
BeeManager.ititializeBees();
|
||||
|
||||
this.modConfig.saveConfigs();
|
||||
|
||||
CraftingManager.setupCrafting();
|
||||
CraftingManager.registerLiquidContainers();
|
||||
|
||||
VersionInfo.doVersionCheck();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void handleIMCMessage(IMCEvent event)
|
||||
{
|
||||
IMCManager.handle(event);
|
||||
}
|
||||
|
||||
public static Config getConfig()
|
||||
{
|
||||
return object.modConfig;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package magicbees.main.utils;
|
||||
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
||||
public class ChunkCoords
|
||||
{
|
||||
public int dimension;
|
||||
public int xCoord;
|
||||
public int zCoord;
|
||||
|
||||
public ChunkCoords(Chunk chunk)
|
||||
{
|
||||
this.dimension = chunk.worldObj.provider.dimensionId;
|
||||
this.xCoord = chunk.xPosition;
|
||||
this.zCoord = chunk.zPosition;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,660 @@
|
||||
package magicbees.main.utils;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import forestry.api.core.BlockInterface;
|
||||
import forestry.api.core.ItemInterface;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import magicbees.item.ItemCapsule;
|
||||
import magicbees.item.types.*;
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.utils.compat.ArsMagicaHelper;
|
||||
import magicbees.main.utils.compat.ForestryHelper;
|
||||
import magicbees.main.utils.compat.ThaumcraftHelper;
|
||||
import magicbees.main.utils.compat.ThermalExpansionHelper;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
|
||||
public class CraftingManager
|
||||
{
|
||||
public static void registerLiquidContainers()
|
||||
{
|
||||
registerLiquidContainer(Config.magicCapsule);
|
||||
registerLiquidContainer(Config.voidCapsule);
|
||||
}
|
||||
|
||||
public static void setupCrafting()
|
||||
{
|
||||
// Broken up into seperate sections to make things a bit easier to find.
|
||||
setupVanillaCrafting();
|
||||
setupCentrifugeRecipes();
|
||||
setupCarpenterRecipes();
|
||||
}
|
||||
|
||||
private static void setupVanillaCrafting()
|
||||
{
|
||||
ItemStack input;
|
||||
ItemStack output;
|
||||
|
||||
// Magic capsules
|
||||
output = new ItemStack(Config.magicCapsule); output.stackSize = 4;
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(output, new Object[] {
|
||||
"WWW",
|
||||
'W', "waxMagical"
|
||||
}));
|
||||
|
||||
// Concentrated Fertilizer -> Forestry fertilizer
|
||||
input = Config.miscResources.getStackForType(ResourceType.EXTENDED_FERTILIZER);
|
||||
output = ItemInterface.getItem("fertilizerCompound");
|
||||
output.stackSize = 6;
|
||||
GameRegistry.addRecipe(output, new Object[] {
|
||||
" S ", " F ", " S ",
|
||||
'F', input,
|
||||
'S', Blocks.sand
|
||||
});
|
||||
GameRegistry.addRecipe(output, new Object[] {
|
||||
" ", "SFS", " ",
|
||||
'F', input,
|
||||
'S', Blocks.sand
|
||||
});
|
||||
|
||||
output = output.copy();
|
||||
output.stackSize = 12;
|
||||
GameRegistry.addRecipe(output, new Object[] {
|
||||
"aaa", "aFa", "aaa",
|
||||
'F', input,
|
||||
'a', ItemInterface.getItem("ash")
|
||||
});
|
||||
|
||||
// "bottling" Intellect drops
|
||||
GameRegistry.addRecipe(new ItemStack(Items.experience_bottle), new Object[] {
|
||||
"DDD", "DBD", "DDD",
|
||||
'D', Config.drops.getStackForType(DropType.INTELLECT),
|
||||
'B', Items.glass_bottle
|
||||
});
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(Blocks.soul_sand, 4), new Object[] {
|
||||
"SwS", "wDw", "SwS",
|
||||
'S', Blocks.sand,
|
||||
'D', Blocks.dirt,
|
||||
'w', Config.wax.getStackForType(WaxType.SOUL)
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(Blocks.soul_sand, 4), new Object[] {
|
||||
"wSw", "SDS", "wSw",
|
||||
'S', Blocks.sand,
|
||||
'D', Blocks.dirt,
|
||||
'w', Config.wax.getStackForType(WaxType.SOUL)
|
||||
});
|
||||
|
||||
output = new ItemStack(Config.hiveFrameMagic);
|
||||
input = ItemInterface.getItem("frameUntreated");
|
||||
GameRegistry.addRecipe(output, new Object[] {
|
||||
"www", "wfw", "www",
|
||||
'w', Config.wax.getStackForType(WaxType.MAGIC),
|
||||
'f', input
|
||||
});
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(Config.hiveFrameTemporal), new Object[] {
|
||||
"sPs", "PfP", "sPs",
|
||||
's', Blocks.sand,
|
||||
'P', Config.pollen.getStackForType(PollenType.PHASED),
|
||||
'f', Config.hiveFrameMagic
|
||||
});
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Config.effectJar), new Object[] {
|
||||
"GSG", "QPQ", "GGG",
|
||||
'G', Blocks.glass,
|
||||
'S', "slabWood",
|
||||
'P', Config.pollen.getStackForType(PollenType.UNUSUAL),
|
||||
'Q', Items.quartz
|
||||
}));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Config.moonDial), new Object[] {
|
||||
"DqD", "qrq", "DqD",
|
||||
'r', Items.redstone,
|
||||
'q', Items.quartz,
|
||||
'D', "dyeGreen"
|
||||
}));
|
||||
|
||||
GameRegistry.addRecipe(Config.miscResources.getStackForType(ResourceType.SKULL_FRAGMENT), new Object[] {
|
||||
"xxx", "xxx", "xxx",
|
||||
'x', Config.miscResources.getStackForType(ResourceType.SKULL_CHIP)
|
||||
});
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(Items.skull, 1, 1), new Object[] {
|
||||
"xxx", "xxx",
|
||||
'x', Config.miscResources.getStackForType(ResourceType.SKULL_FRAGMENT)
|
||||
});
|
||||
|
||||
GameRegistry.addRecipe(Config.miscResources.getStackForType(ResourceType.DRAGON_CHUNK), new Object[] {
|
||||
"xxx", "xxx",
|
||||
'x', Config.miscResources.getStackForType(ResourceType.DRAGON_DUST)
|
||||
});
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(Blocks.dragon_egg, 1), new Object[] {
|
||||
"ccc", "cec", "ccc",
|
||||
'c', Config.miscResources.getStackForType(ResourceType.DRAGON_CHUNK),
|
||||
'e', Config.miscResources.getStackForType(ResourceType.ESSENCE_FALSE_LIFE)
|
||||
});
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(Config.miscResources.getStackForType(ResourceType.ESSENCE_EVERLASTING_DURABILITY), new Object[] {
|
||||
"gwg", "wiw", "gwg",
|
||||
'g', Blocks.glass,
|
||||
'w', "waxMagical",
|
||||
'i', Blocks.iron_block
|
||||
}));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(Config.miscResources.getStackForType(ResourceType.ESSENCE_EVERLASTING_DURABILITY), new Object[] {
|
||||
"wgw", "gig", "wgw",
|
||||
'g', Blocks.glass,
|
||||
'w', "waxMagical",
|
||||
'i', Blocks.iron_block
|
||||
}));
|
||||
|
||||
GameRegistry.addRecipe(Config.miscResources.getStackForType(ResourceType.ESSENCE_FALSE_LIFE), new Object[] {
|
||||
"gwg", "wfw", "gwg",
|
||||
'g', Blocks.glass,
|
||||
'w', Config.wax.getStackForType(WaxType.SOUL),
|
||||
'f', Blocks.red_flower
|
||||
});
|
||||
GameRegistry.addRecipe(Config.miscResources.getStackForType(ResourceType.ESSENCE_FALSE_LIFE), new Object[] {
|
||||
"wgw", "gfg", "wgw",
|
||||
'g', Blocks.glass,
|
||||
'w', Config.wax.getStackForType(WaxType.SOUL),
|
||||
'f', Blocks.red_flower
|
||||
});
|
||||
|
||||
GameRegistry.addRecipe(Config.miscResources.getStackForType(ResourceType.ESSENCE_SHALLOW_GRAVE), new Object[] {
|
||||
"gwg", "wfw", "gwg",
|
||||
'g', Blocks.glass,
|
||||
'w', Config.wax.getStackForType(WaxType.SOUL),
|
||||
'f', Items.rotten_flesh
|
||||
});
|
||||
GameRegistry.addRecipe(Config.miscResources.getStackForType(ResourceType.ESSENCE_SHALLOW_GRAVE), new Object[] {
|
||||
"wgw", "gfg", "wgw",
|
||||
'g', Blocks.glass,
|
||||
'w', Config.wax.getStackForType(WaxType.SOUL),
|
||||
'f', Items.rotten_flesh
|
||||
});
|
||||
|
||||
GameRegistry.addRecipe(Config.miscResources.getStackForType(ResourceType.ESSENCE_LOST_TIME), new Object[] {
|
||||
"wgw", "gcg", "wgw",
|
||||
'g', Blocks.glass,
|
||||
'w', Config.wax.getStackForType(WaxType.SOUL),
|
||||
'c', Items.clock
|
||||
});
|
||||
GameRegistry.addRecipe(Config.miscResources.getStackForType(ResourceType.ESSENCE_LOST_TIME), new Object[] {
|
||||
"gwg", "wcw", "gwg",
|
||||
'g', Blocks.glass,
|
||||
'w', Config.wax.getStackForType(WaxType.SOUL),
|
||||
'c', Items.clock
|
||||
});
|
||||
|
||||
GameRegistry.addRecipe(Config.miscResources.getStackForType(ResourceType.ESSENCE_FICKLE_PERMANENCE), new Object[] {
|
||||
"wew", "gcg", "wew",
|
||||
'w', Config.wax.getStackForType(WaxType.SOUL),
|
||||
'c', Items.magma_cream,
|
||||
'e', Items.egg,
|
||||
'g', Blocks.glowstone
|
||||
});
|
||||
|
||||
GameRegistry.addRecipe(Config.miscResources.getStackForType(ResourceType.ESSENCE_SCORNFUL_OBLIVION), new Object[] {
|
||||
"gst", "sEs", "tsg",
|
||||
'g', Config.miscResources.getStackForType(ResourceType.ESSENCE_SHALLOW_GRAVE),
|
||||
't', Config.miscResources.getStackForType(ResourceType.ESSENCE_LOST_TIME),
|
||||
's', new ItemStack(Items.skull, 1, 1),
|
||||
'E', Blocks.dragon_egg,
|
||||
});
|
||||
|
||||
// IF YOU UPDATE THESE, CHANGE THE RECIPES IN THAUMCRAFT HELPER, YOU IDIOT.
|
||||
input = new ItemStack(Config.hiveFrameMagic);
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(Config.hiveFrameResilient), new Object[] {
|
||||
Config.miscResources.getStackForType(ResourceType.ESSENCE_EVERLASTING_DURABILITY),
|
||||
input
|
||||
});
|
||||
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(Config.hiveFrameGentle), new Object[] {
|
||||
Config.miscResources.getStackForType(ResourceType.ESSENCE_FALSE_LIFE),
|
||||
input
|
||||
});
|
||||
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(Config.hiveFrameNecrotic), new Object[] {
|
||||
Config.miscResources.getStackForType(ResourceType.ESSENCE_SHALLOW_GRAVE),
|
||||
input
|
||||
});
|
||||
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(Config.hiveFrameMetabolic), new Object[] {
|
||||
Config.miscResources.getStackForType(ResourceType.ESSENCE_FICKLE_PERMANENCE),
|
||||
input
|
||||
});
|
||||
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(Config.hiveFrameTemporal), new Object[] {
|
||||
Config.miscResources.getStackForType(ResourceType.ESSENCE_LOST_TIME),
|
||||
input
|
||||
});
|
||||
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(Config.hiveFrameOblivion), new Object[] {
|
||||
Config.miscResources.getStackForType(ResourceType.ESSENCE_SCORNFUL_OBLIVION),
|
||||
ItemInterface.getItem("frameProven")
|
||||
});
|
||||
// </idiot>
|
||||
|
||||
if (OreDictionary.getOres("ingotCopper").size() <= 0)
|
||||
{
|
||||
NuggetType.COPPER.setInactive();
|
||||
}
|
||||
else
|
||||
{
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(OreDictionary.getOres("ingotCopper").get(0), new Object[] {
|
||||
"xxx", "xxx", "xxx",
|
||||
'x', "nuggetCopper"
|
||||
}));
|
||||
}
|
||||
if (OreDictionary.getOres("ingotTin").size() <= 0)
|
||||
{
|
||||
NuggetType.TIN.setInactive();
|
||||
}
|
||||
else
|
||||
{
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(OreDictionary.getOres("ingotTin").get(0), new Object[] {
|
||||
"xxx", "xxx", "xxx",
|
||||
'x', "nuggetTin"
|
||||
}));
|
||||
}
|
||||
if (OreDictionary.getOres("ingotSilver").size() <= 0)
|
||||
{
|
||||
NuggetType.SILVER.setInactive();
|
||||
}
|
||||
else
|
||||
{
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(OreDictionary.getOres("ingotSilver").get(0), new Object[] {
|
||||
"xxx", "xxx", "xxx",
|
||||
'x', "nuggetSilver"
|
||||
}));
|
||||
}
|
||||
if (OreDictionary.getOres("ingotLead").size() <= 0)
|
||||
{
|
||||
NuggetType.LEAD.setInactive();
|
||||
}
|
||||
else
|
||||
{
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(OreDictionary.getOres("ingotLead").get(0), new Object[] {
|
||||
"xxx", "xxx", "xxx",
|
||||
'x', "nuggetLead"
|
||||
}));
|
||||
}
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.iron_ingot), new Object[] {
|
||||
"xxx", "xxx", "xxx",
|
||||
'x', "nuggetIron"
|
||||
}));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.diamond), new Object[] {
|
||||
"xxx", "xxx", "xxx",
|
||||
'x', "shardDiamond"
|
||||
}));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.emerald), new Object[] {
|
||||
"xxx", "xxx", "xxx",
|
||||
'x', "shardEmerald"
|
||||
}));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(ItemInterface.getItem("apatite"), new Object[] {
|
||||
"xxx", "xxx", "xxx",
|
||||
'x', Config.nuggets.getStackForType(NuggetType.APATITE)
|
||||
}));
|
||||
|
||||
output = Config.miscResources.getStackForType(ResourceType.DIMENSIONAL_SINGULARITY);
|
||||
GameRegistry.addRecipe(output, new Object[] {
|
||||
" G ", "QEQ", " W ",
|
||||
'E', Items.ender_eye,
|
||||
'Q', Blocks.quartz_block,
|
||||
'W', Blocks.end_stone,
|
||||
'G', Blocks.gold_block
|
||||
});
|
||||
|
||||
output = Config.voidCapsule.getCapsuleForLiquid(FluidType.EMPTY);
|
||||
output.stackSize = 4;
|
||||
GameRegistry.addRecipe(output, new Object[] {
|
||||
"T T", "GFG", "T T",
|
||||
'G', Blocks.glass_pane,
|
||||
'F', Config.miscResources.getStackForType(ResourceType.DIMENSIONAL_SINGULARITY),
|
||||
'T', Items.gold_nugget
|
||||
});
|
||||
|
||||
output = new ItemStack(Config.magnet);
|
||||
GameRegistry.addRecipe(output, new Object[] {
|
||||
" i ", "cSc", " d ",
|
||||
'i', Items.iron_ingot,
|
||||
'c', Items.compass,
|
||||
'd', Items.diamond,
|
||||
'S', Config.miscResources.getStackForType(ResourceType.DIMENSIONAL_SINGULARITY)
|
||||
});
|
||||
|
||||
for (int level = 1; level <= 8; level++)
|
||||
{
|
||||
output = new ItemStack(Config.magnet, 1, level * 2);
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(output, new Object[] {
|
||||
" d ", "mSm", " B ",
|
||||
'd', Items.diamond,
|
||||
'm', "mb.magnet.level" + (level - 1),
|
||||
'B', Blocks.redstone_block,
|
||||
'S', Config.miscResources.getStackForType(ResourceType.DIMENSIONAL_SINGULARITY)
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
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[] {
|
||||
input, input, input, input
|
||||
});
|
||||
|
||||
// T1 Thaumaturge's backpack
|
||||
GameRegistry.addRecipe(new ItemStack(Config.thaumaturgeBackpackT1), new Object[] {
|
||||
"SWS", "NCN", "SWS",
|
||||
'S', Items.string,
|
||||
'W', Blocks.wool,
|
||||
'N', new ItemStack(Config.tcMiscResource, 1, ThaumcraftHelper.MiscResource.AMBER.ordinal()),
|
||||
'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())
|
||||
{
|
||||
input = ItemInterface.getItem("apatite");
|
||||
output = Config.miscResources.getStackForType(ResourceType.EXTENDED_FERTILIZER, 4);
|
||||
GameRegistry.addShapelessRecipe(output, new Object[] {
|
||||
new ItemStack(Config.amEssence, 1, ArsMagicaHelper.EssenceType.EARTH.ordinal()),
|
||||
input, input
|
||||
});
|
||||
GameRegistry.addShapelessRecipe(output, new Object[] {
|
||||
new ItemStack(Config.amEssence, 1, ArsMagicaHelper.EssenceType.PLANT.ordinal()),
|
||||
input, input
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static void setupCentrifugeRecipes()
|
||||
{
|
||||
ItemStack beeswax = ItemInterface.getItem("beeswax");
|
||||
ItemStack propolis = ItemInterface.getItem("propolis");
|
||||
propolis.setItemDamage(ForestryHelper.Propolis.PULSATING.ordinal());
|
||||
|
||||
// 20 is the 'average' time to centrifuge a comb.
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, Config.combs.getStackForType(CombType.MUNDANE),
|
||||
new ItemStack[] {beeswax, ItemInterface.getItem("honeyDrop"),
|
||||
Config.wax.getStackForType(WaxType.MAGIC)},
|
||||
new int[] {90, 60, 10});
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, Config.combs.getStackForType(CombType.MOLTEN),
|
||||
new ItemStack[] {ItemInterface.getItem("refractoryWax"),
|
||||
ItemInterface.getItem("honeyDrop")},
|
||||
new int[] {86, 8});
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, Config.combs.getStackForType(CombType.FORGOTTEN),
|
||||
new ItemStack[] {Config.wax.getStackForType(WaxType.AMNESIC), propolis,
|
||||
ItemInterface.getItem("honeyDrop")},
|
||||
new int[] {50, 50, 22});
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, Config.combs.getStackForType(CombType.OCCULT),
|
||||
new ItemStack[] {Config.wax.getStackForType(WaxType.MAGIC), GameRegistry.findItemStack("forestry",
|
||||
"honeyDrop", 1) },
|
||||
new int[] { 100, 60 });
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, Config.combs.getStackForType(CombType.OTHERWORLDLY),
|
||||
new ItemStack[] {beeswax, Config.wax.getStackForType(WaxType.MAGIC),
|
||||
ItemInterface.getItem("honeyDrop") },
|
||||
new int[] { 50, 20, 100 });
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, Config.combs.getStackForType(CombType.PAPERY),
|
||||
new ItemStack[] {ItemInterface.getItem("beeswax"),
|
||||
Config.wax.getStackForType(WaxType.MAGIC),
|
||||
new ItemStack(Items.paper) },
|
||||
new int[] { 80, 20, 5 });
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, Config.combs.getStackForType(CombType.INTELLECT),
|
||||
new ItemStack[] { Config.wax.getStackForType(WaxType.MAGIC), GameRegistry.findItemStack("forestry",
|
||||
"honeydew", 1), Config.drops.getStackForType(DropType.INTELLECT) },
|
||||
new int[] { 90, 40, 10 });
|
||||
propolis.setItemDamage(ForestryHelper.Propolis.NORMAL.ordinal());
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, Config.combs.getStackForType(CombType.FURTIVE),
|
||||
new ItemStack[] {ItemInterface.getItem("beeswax"), propolis,
|
||||
ItemInterface.getItem("honeydew") },
|
||||
new int[] { 90, 20, 35 });
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, Config.combs.getStackForType(CombType.SOUL),
|
||||
new ItemStack[] {Config.wax.getStackForType(WaxType.SOUL), GameRegistry.findItemStack("forestry",
|
||||
"honeydew", 1) },
|
||||
new int[] { 95, 26 });
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, Config.combs.getStackForType(CombType.TEMPORAL),
|
||||
new ItemStack[] {Config.wax.getStackForType(WaxType.MAGIC), Config.pollen.getStackForType(PollenType.PHASED), new ItemStack(Config.fHoneydew, 1)},
|
||||
new int[] {100, 5, 60});
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, Config.combs.getStackForType(CombType.TRANSMUTED),
|
||||
new ItemStack[] {ItemInterface.getItem("beeswax"),
|
||||
Config.wax.getStackForType(WaxType.MAGIC), Config.propolis.getStackForType(PropolisType.UNSTABLE)},
|
||||
new int[] {80, 80, 15});
|
||||
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, Config.combs.getStackForType(CombType.AIRY),
|
||||
new ItemStack[] {Config.wax.getStackForType(WaxType.MAGIC), new ItemStack(Items.feather) },
|
||||
new int[] { 100, 60 });
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, Config.combs.getStackForType(CombType.FIREY),
|
||||
new ItemStack[] {Config.wax.getStackForType(WaxType.MAGIC), new ItemStack(Items.blaze_powder) },
|
||||
new int[] { 100, 60 });
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, Config.combs.getStackForType(CombType.WATERY),
|
||||
new ItemStack[] {Config.wax.getStackForType(WaxType.MAGIC), new ItemStack(Items.dye) },
|
||||
new int[] { 100, 60 });
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, Config.combs.getStackForType(CombType.EARTHY),
|
||||
new ItemStack[] {Config.wax.getStackForType(WaxType.MAGIC), new ItemStack(Items.clay_ball) },
|
||||
new int[] { 100, 60 });
|
||||
|
||||
if (ThaumcraftHelper.isActive())
|
||||
{
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, Config.combs.getStackForType(CombType.TC_AIR),
|
||||
new ItemStack[] {Config.wax.getStackForType(WaxType.MAGIC), new ItemStack(Items.feather),
|
||||
Config.propolis.getStackForType(PropolisType.AIR) },
|
||||
new int[] { 100, 60, 80 });
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, Config.combs.getStackForType(CombType.TC_FIRE),
|
||||
new ItemStack[] {Config.wax.getStackForType(WaxType.MAGIC), new ItemStack(Items.blaze_powder),
|
||||
Config.propolis.getStackForType(PropolisType.FIRE) },
|
||||
new int[] { 100, 60, 80 });
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, Config.combs.getStackForType(CombType.TC_WATER),
|
||||
new ItemStack[] {Config.wax.getStackForType(WaxType.MAGIC), new ItemStack(Items.dye),
|
||||
Config.propolis.getStackForType(PropolisType.WATER) },
|
||||
new int[] { 100, 60, 80 });
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, Config.combs.getStackForType(CombType.TC_EARTH),
|
||||
new ItemStack[] {Config.wax.getStackForType(WaxType.MAGIC), new ItemStack(Items.clay_ball),
|
||||
Config.propolis.getStackForType(PropolisType.EARTH) },
|
||||
new int[] { 100, 60, 80 });
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, Config.combs.getStackForType(CombType.TC_ORDER),
|
||||
new ItemStack[] {Config.wax.getStackForType(WaxType.MAGIC), Config.propolis.getStackForType(PropolisType.ORDER) },
|
||||
new int[] { 100, 80 });
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, Config.combs.getStackForType(CombType.TC_CHAOS),
|
||||
new ItemStack[] {Config.wax.getStackForType(WaxType.MAGIC), Config.propolis.getStackForType(PropolisType.CHAOS) },
|
||||
new int[] { 100, 80 });
|
||||
|
||||
RecipeManagers.centrifugeManager.addRecipe(8, Config.propolis.getStackForType(PropolisType.AIR),
|
||||
new ItemStack[] {propolis, Config.miscResources.getStackForType(ResourceType.TC_DUST_AIR) },
|
||||
new int[] { 100, 65 } );
|
||||
RecipeManagers.centrifugeManager.addRecipe(8, Config.propolis.getStackForType(PropolisType.FIRE),
|
||||
new ItemStack[] {propolis, Config.miscResources.getStackForType(ResourceType.TC_DUST_FIRE) },
|
||||
new int[] { 100, 65 } );
|
||||
RecipeManagers.centrifugeManager.addRecipe(8, Config.propolis.getStackForType(PropolisType.WATER),
|
||||
new ItemStack[] {propolis, Config.miscResources.getStackForType(ResourceType.TC_DUST_WATER) },
|
||||
new int[] { 100, 65 } );
|
||||
RecipeManagers.centrifugeManager.addRecipe(8, Config.propolis.getStackForType(PropolisType.EARTH),
|
||||
new ItemStack[] {propolis, Config.miscResources.getStackForType(ResourceType.TC_DUST_EARTH) },
|
||||
new int[] { 100, 65 } );
|
||||
RecipeManagers.centrifugeManager.addRecipe(8, Config.propolis.getStackForType(PropolisType.ORDER),
|
||||
new ItemStack[] {propolis, Config.miscResources.getStackForType(ResourceType.TC_DUST_ORDER) },
|
||||
new int[] { 100, 65 } );
|
||||
RecipeManagers.centrifugeManager.addRecipe(8, Config.propolis.getStackForType(PropolisType.CHAOS),
|
||||
new ItemStack[] {propolis, Config.miscResources.getStackForType(ResourceType.TC_DUST_CHAOS) },
|
||||
new int[] { 100, 65 } );
|
||||
}
|
||||
|
||||
if (ArsMagicaHelper.isActive())
|
||||
{
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, Config.combs.getStackForType(CombType.AM_ESSENCE),
|
||||
new ItemStack[] {Config.wax.getStackForType(WaxType.MAGIC), new ItemStack(Config.amItemResource), new ItemStack(Config.amItemResource) },
|
||||
new int[] { 85, 10, 2 } );
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, Config.combs.getStackForType(CombType.AM_POTENT),
|
||||
new ItemStack[] {ItemInterface.getItem("beeswax"),
|
||||
ItemInterface.getItem("refractoryWax"),
|
||||
ItemInterface.getItem("honeydew")},
|
||||
new int[] { 50, 50, 65 } );
|
||||
}
|
||||
if (ThermalExpansionHelper.isActive())
|
||||
{
|
||||
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, Config.combs.getStackForType(CombType.TE_DESTABILIZED),
|
||||
new ItemStack[] {Config.wax.getStackForType(WaxType.MAGIC), Config.drops.getStackForType(DropType.DESTABILIZED)},
|
||||
new int[] {50, 22});
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, Config.combs.getStackForType(CombType.TE_CARBON),
|
||||
new ItemStack[] {Config.wax.getStackForType(WaxType.MAGIC), Config.drops.getStackForType(DropType.CARBON)},
|
||||
new int[] {50, 22});
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, Config.combs.getStackForType(CombType.TE_LUX),
|
||||
new ItemStack[] {Config.wax.getStackForType(WaxType.MAGIC), Config.drops.getStackForType(DropType.LUX)},
|
||||
new int[] {50, 22});
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, Config.combs.getStackForType(CombType.TE_ENDEARING),
|
||||
new ItemStack[] {Config.wax.getStackForType(WaxType.MAGIC), Config.drops.getStackForType(DropType.ENDEARING)},
|
||||
new int[] {50, 22});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void setupCarpenterRecipes()
|
||||
{
|
||||
ItemStack input;
|
||||
ItemStack output;
|
||||
|
||||
output = BlockInterface.getBlock("candle");
|
||||
output.stackSize = 24;
|
||||
RecipeManagers.carpenterManager.addRecipe(30, new FluidStack(FluidRegistry.WATER, 600), null, output, new Object[] {
|
||||
" S ", "WWW", "WWW",
|
||||
'W', Config.wax,
|
||||
'S', Items.string
|
||||
});
|
||||
|
||||
output = BlockInterface.getBlock("candle");
|
||||
output.stackSize = 6;
|
||||
input = ItemInterface.getItem("craftingMaterial");
|
||||
input.setItemDamage(ForestryHelper.CraftingMaterial.SILK_WISP.ordinal()); // Set to Silk Wisp
|
||||
RecipeManagers.carpenterManager.addRecipe(30, new FluidStack(FluidRegistry.WATER, 600), null, output, new Object[] {
|
||||
"WSW",
|
||||
'W', Config.wax,
|
||||
'S', input
|
||||
});
|
||||
|
||||
output = Config.miscResources.getStackForType(ResourceType.AROMATIC_LUMP, 2);
|
||||
RecipeManagers.carpenterManager.addRecipe(30, FluidRegistry.getFluidStack("honey", 1000), null, output, new Object[] {
|
||||
" P ", "JDJ", " P ",
|
||||
'P', ItemInterface.getItem("pollen"),
|
||||
'J', ItemInterface.getItem("royalJelly"),
|
||||
'D', Config.drops.getStackForType(DropType.ENCHANTED)
|
||||
});
|
||||
|
||||
RecipeManagers.carpenterManager.addRecipe(30, FluidRegistry.getFluidStack("honey", 1000), null, output, new Object[] {
|
||||
" J ", "PDP", " J ",
|
||||
'P', ItemInterface.getItem("pollen"),
|
||||
'J', ItemInterface.getItem("royalJelly"),
|
||||
'D', Config.drops.getStackForType(DropType.ENCHANTED)
|
||||
});
|
||||
|
||||
if (ThaumcraftHelper.isActive())
|
||||
{
|
||||
// Carpenter recipes
|
||||
input = ItemInterface.getItem("craftingMaterial");
|
||||
input.setItemDamage(3); // Set to Silk Mesh
|
||||
output = new ItemStack(Config.thaumaturgeBackpackT2);
|
||||
RecipeManagers.carpenterManager.addRecipe(200, new FluidStack(FluidRegistry.WATER, 1000), null, output, new Object[] {
|
||||
"WXW", "WTW", "WWW",
|
||||
'X', Items.diamond,
|
||||
'W', input,
|
||||
'T', new ItemStack(Config.thaumaturgeBackpackT1)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerLiquidContainer(ItemCapsule baseCapsule)
|
||||
{
|
||||
ItemStack empty = new ItemStack(baseCapsule, 1, 0);
|
||||
ItemStack filled;
|
||||
FluidStack liquid = null;
|
||||
|
||||
for (FluidType fluidType : FluidType.values())
|
||||
{
|
||||
switch (fluidType)
|
||||
{
|
||||
case EMPTY:
|
||||
liquid = null;
|
||||
break;
|
||||
case WATER:
|
||||
liquid = new FluidStack(FluidRegistry.WATER, baseCapsule.getType().capacity);
|
||||
break;
|
||||
case LAVA:
|
||||
liquid = new FluidStack(FluidRegistry.LAVA, baseCapsule.getType().capacity);
|
||||
break;
|
||||
default:
|
||||
liquid = FluidRegistry.getFluidStack(fluidType.liquidID, baseCapsule.getType().capacity);
|
||||
break;
|
||||
}
|
||||
|
||||
if (liquid != null)
|
||||
{
|
||||
filled = new ItemStack(baseCapsule, 1, fluidType.ordinal());
|
||||
FluidContainerRegistry.registerFluidContainer(liquid, filled, empty);
|
||||
|
||||
// Register with Squeezer/Bottler
|
||||
RecipeManagers.bottlerManager.addRecipe(5, liquid, empty, filled);
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] {filled} , liquid,
|
||||
Config.wax.getStackForType(WaxType.MAGIC), 20);
|
||||
fluidType.available = true;
|
||||
}
|
||||
}
|
||||
// Empty will be set to unavailable. Obviously, it always is.
|
||||
FluidType.EMPTY.available = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package magicbees.main.utils;
|
||||
|
||||
import magicbees.bees.AlleleEffectCrumbling;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
|
||||
public class IMCManager
|
||||
{
|
||||
public static void handle(IMCEvent event)
|
||||
{
|
||||
for (IMCMessage message : event.getMessages())
|
||||
{
|
||||
try
|
||||
{
|
||||
if (message.key.equals("addCrumblePair"))
|
||||
{
|
||||
handleCrumbleBlock(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
FMLLog.warning("Magic Bees recieved an IMC Message from a mod %s " +
|
||||
"but does not support messages keyed with %s.",
|
||||
message.getSender(), message.key);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
FMLLog.warning("Magic Bees recieved an invalid IMC Message from a mod %s! Please inform " +
|
||||
"the author of %s that they may not be correctly implementing message for key '%s'. Error details follow.",
|
||||
message.getSender(), message.key);
|
||||
FMLLog.info(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void handleCrumbleBlock(IMCMessage message) throws Exception
|
||||
{
|
||||
NBTTagCompound root = message.getNBTValue();
|
||||
NBTBase source = root.getTag("source");
|
||||
NBTBase target = root.getTag("target");
|
||||
|
||||
if (source != null && source instanceof NBTTagCompound)
|
||||
{
|
||||
ItemStack sourceItem = ItemStack.loadItemStackFromNBT((NBTTagCompound)source);
|
||||
if (target instanceof NBTTagCompound)
|
||||
{
|
||||
ItemStack targetItem = ItemStack.loadItemStackFromNBT((NBTTagCompound)target);
|
||||
AlleleEffectCrumbling.addPairToMap(sourceItem, targetItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Required tag 'target' was either empty, or not a valid ItemStack.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Required tag 'source' was either empty, or not a valid ItemStack.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package magicbees.main.utils;
|
||||
|
||||
import magicbees.main.CommonProxy;
|
||||
import net.minecraft.util.StringTranslate;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
public class LocalizationManager
|
||||
{
|
||||
private enum Locale
|
||||
{
|
||||
de_DE("de_DE"),
|
||||
en_US("en_US"),
|
||||
ru_RU("ru_RU"),
|
||||
zh_CN("zh_CN"),
|
||||
;
|
||||
public String locale;
|
||||
|
||||
private Locale(String loc)
|
||||
{
|
||||
this.locale = loc;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setupLocalizationInfo()
|
||||
{
|
||||
for (Locale l : Locale.values())
|
||||
{
|
||||
LanguageRegistry.instance().loadLocalization(CommonProxy.TCBEES_LOCDIR + l.locale + ".xml", l.locale, true);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getLocalizedString(String key)
|
||||
{
|
||||
String result = LanguageRegistry.instance().getStringLocalization(key);
|
||||
if (result.isEmpty())
|
||||
{
|
||||
result = LanguageRegistry.instance().getStringLocalization(key, "en_US");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String getLocalizedString(String key, Object ...objects)
|
||||
{
|
||||
String result = LanguageRegistry.instance().getStringLocalization(key);
|
||||
if (result.isEmpty())
|
||||
{
|
||||
result = LanguageRegistry.instance().getStringLocalization(key, "en_US");
|
||||
}
|
||||
return String.format(result, objects);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package magicbees.main.utils;
|
||||
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* Class to abstract the moon phase from the world time a bit.
|
||||
*/
|
||||
public enum MoonPhase
|
||||
{
|
||||
FULL("full"),
|
||||
WANING_GIBBOUS("gibbousWaning"),
|
||||
WANING_HALF("halfWaning"),
|
||||
WANING_CRESCENT("crescentWaning"),
|
||||
NEW("new"),
|
||||
WAXING_CRESCENT("crecentWaxing"),
|
||||
WAXING_HALF("halfWaxing"),
|
||||
WAXING_GIBBOUS("gibbousWaxing");
|
||||
|
||||
private String phaseName;
|
||||
private MoonPhase(String name)
|
||||
{
|
||||
this.phaseName = name;
|
||||
}
|
||||
|
||||
public boolean isBetween(MoonPhase first, MoonPhase second)
|
||||
{
|
||||
boolean flag = false;
|
||||
|
||||
if (first.ordinal() <= second.ordinal())
|
||||
{
|
||||
// Straightforward.
|
||||
flag = first.ordinal() <= this.ordinal() && this.ordinal() <= second.ordinal();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Wraps around the boundary.
|
||||
flag = (first.ordinal() <= this.ordinal() && this.ordinal() <= WAXING_GIBBOUS.ordinal()) ||
|
||||
(FULL.ordinal() <= this.ordinal() && this.ordinal() <= second.ordinal());
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
public String getLocalizedName()
|
||||
{
|
||||
return LocalizationManager.getLocalizedString("moon." + this.phaseName);
|
||||
}
|
||||
|
||||
public static MoonPhase getMoonPhase(World w)
|
||||
{
|
||||
return getMoonPhaseFromTime(w.getWorldTime());
|
||||
}
|
||||
|
||||
public static MoonPhase getMoonPhaseFromTime(long time)
|
||||
{
|
||||
return MoonPhase.values()[(int)((time - 6000) / 24000L) % 8];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package magicbees.main.utils;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.item.types.ResourceType;
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.MagicBees;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class TabMagicBees extends CreativeTabs
|
||||
{
|
||||
public static TabMagicBees tabMagicBees = new TabMagicBees();
|
||||
|
||||
public TabMagicBees()
|
||||
{
|
||||
super(getNextID(), "magicBees");
|
||||
}
|
||||
|
||||
public Item getTabIconItem()
|
||||
{
|
||||
return Config.miscResources.getStackForType(ResourceType.RESEARCH_BEEINFUSION).getItem();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
/*package magicbees.main.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import magicbees.main.MagicBees;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ChatMessageComponent;
|
||||
import cpw.mods.fml.common.IScheduledTickHandler;
|
||||
import cpw.mods.fml.common.TickType;
|
||||
|
||||
public class TickHandlerVersion implements IScheduledTickHandler
|
||||
{
|
||||
|
||||
public static TickHandlerVersion instance = new TickHandlerVersion();
|
||||
|
||||
private static ArrayList<VersionInfo> modVersionInfo = new ArrayList();
|
||||
private static boolean initialized;
|
||||
private static boolean sent;
|
||||
private static int modIndex = 0;
|
||||
|
||||
public static boolean initialize()
|
||||
{
|
||||
if (initialized)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
initialized = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isInitialized()
|
||||
{
|
||||
return initialized;
|
||||
}
|
||||
|
||||
public static boolean registerModVersionInfo(VersionInfo info)
|
||||
{
|
||||
if (modVersionInfo.contains(info))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
modVersionInfo.add(info);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tickStart(EnumSet<TickType> type, Object... tickData)
|
||||
{
|
||||
if (sent)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (modIndex < modVersionInfo.size())
|
||||
{
|
||||
VersionInfo anInfo = modVersionInfo.get(modIndex);
|
||||
|
||||
if ((!MagicBees.getConfig().DisableUpdateNotification || anInfo.isCriticalUpdate()) && anInfo.isNewVersionAvailable())
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) tickData[0];
|
||||
player.sendChatToPlayer(ChatMessageComponent.createFromText("[" + anInfo.modName + "] A new version is available: " + anInfo.getLatestVersion()));
|
||||
player.sendChatToPlayer(ChatMessageComponent.createFromText(anInfo.getVersionDescription()));
|
||||
}
|
||||
modIndex += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
sent = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tickEnd(EnumSet<TickType> type, Object... tickData)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<TickType> ticks()
|
||||
{
|
||||
if (TickHandlerVersion.sent)
|
||||
{
|
||||
return EnumSet.noneOf(TickType.class);
|
||||
}
|
||||
return EnumSet.of(TickType.PLAYER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLabel()
|
||||
{
|
||||
return "thaumicbees.version";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int nextTickSpacing()
|
||||
{
|
||||
if (!sent)
|
||||
{
|
||||
return 200;
|
||||
}
|
||||
return 72000;
|
||||
}
|
||||
}*/
|
||||
@@ -0,0 +1,253 @@
|
||||
package magicbees.main.utils;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* Using some of the VersionInfo code from cofh. (Thanks, Lemming!)
|
||||
* @author MysteriousAges
|
||||
*
|
||||
*/
|
||||
public class VersionInfo
|
||||
{
|
||||
public static final String ModName = "MagicBees";
|
||||
public static final String Version = "@VERSION@";
|
||||
public static final String Build = "@BUILD_NUMBER@";
|
||||
public static final String MCVersion = "@MCVERSION@";
|
||||
public static final String VersionURL = "http://bit.ly/magicbeesVersionInfo";
|
||||
|
||||
public static final String Logo = "/gfx/magicbees/logo.png";
|
||||
|
||||
public static final String Depends = "required-after:Forestry;after:Thaumcraft;after:ExtraBees;after:EE3;after:ArsMagica;after:TConstruct;after:Railcraft;after:ThermalExpansion";
|
||||
|
||||
boolean criticalUpdate;
|
||||
boolean newVersion;
|
||||
boolean newMinecraftVersion;
|
||||
boolean versionCheckComplete;
|
||||
|
||||
String latestModVersion;
|
||||
String latestMCVersion = MCVersion;
|
||||
String description = "";
|
||||
|
||||
String modName;
|
||||
String modVersion;
|
||||
String releaseURL;
|
||||
//Logger modLogger = FMLLog.getLogger();
|
||||
|
||||
public static int[] parseVersion(String rawVersion)
|
||||
{
|
||||
ArrayList<Integer> versionTokens = new ArrayList<Integer>();
|
||||
String[] tokens = rawVersion.trim().split("[\\. ]");
|
||||
|
||||
for (int i = 0; i < tokens.length; ++i)
|
||||
{
|
||||
tokens[i] = tokens[i].trim();
|
||||
if (tokens[i].matches("[0-9]+"))
|
||||
{
|
||||
versionTokens.add(Integer.valueOf(tokens[i]));
|
||||
}
|
||||
else if (tokens[i].matches("[0-9]+[a-z]"))
|
||||
{
|
||||
String numberString = tokens[i].substring(0, tokens[i].length()-1);
|
||||
versionTokens.add(Integer.valueOf(numberString));
|
||||
versionTokens.add(Character.getNumericValue(tokens[i].charAt(tokens[i].length()-1)));
|
||||
}
|
||||
}
|
||||
|
||||
// Can't use versionTokens.toArray 'cause that returns an Integer[], not int[]
|
||||
int[] value = new int[versionTokens.size()];
|
||||
for (int i = 0; i < value.length; ++i)
|
||||
{
|
||||
value[i] = versionTokens.get(i).intValue();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/* VERSION COMPARISON */
|
||||
public static boolean beforeTargetVersion(String version, String target)
|
||||
{
|
||||
boolean result = false;
|
||||
int[] versionTokens = parseVersion(version);
|
||||
int[] targetTokens = parseVersion(target);
|
||||
|
||||
for (int i = 0; i < versionTokens.length && i < targetTokens.length; ++i)
|
||||
{
|
||||
if (versionTokens[i] < targetTokens[i])
|
||||
{
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
else if (versionTokens[i] > targetTokens[i])
|
||||
{
|
||||
result = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == versionTokens.length-1 && versionTokens.length < targetTokens.length)
|
||||
{
|
||||
// If the versions compared are the same, but target has an extra token, it's probably a "letter" build
|
||||
// and is ahead of this one.
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static boolean afterTargetVersion(String version, String target)
|
||||
{
|
||||
boolean result = false;
|
||||
int[] versionTokens = parseVersion(version);
|
||||
int[] targetTokens = parseVersion(target);
|
||||
|
||||
for (int i = 0; i < versionTokens.length && i < targetTokens.length; ++i)
|
||||
{
|
||||
if (versionTokens[i] > targetTokens[i])
|
||||
{
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public VersionInfo(String name, String version, String url)
|
||||
{
|
||||
modName = name;
|
||||
modVersion = latestModVersion = version;
|
||||
releaseURL = url;
|
||||
}
|
||||
|
||||
public VersionInfo(String name, String version, String url, Logger logger)
|
||||
{
|
||||
modName = name;
|
||||
modVersion = latestModVersion = version;
|
||||
releaseURL = url;
|
||||
//modLogger = logger;
|
||||
}
|
||||
|
||||
public void checkForNewVersion()
|
||||
{
|
||||
Thread versionCheckThread = new VersionCheckThread();
|
||||
versionCheckThread.start();
|
||||
}
|
||||
|
||||
public String getCurrentVersion()
|
||||
{
|
||||
return modVersion;
|
||||
}
|
||||
|
||||
public String getLatestVersion()
|
||||
{
|
||||
return latestModVersion;
|
||||
}
|
||||
|
||||
public String getLatestMCVersion()
|
||||
{
|
||||
return latestMCVersion;
|
||||
}
|
||||
|
||||
public String getVersionDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public boolean isCriticalUpdate()
|
||||
{
|
||||
return criticalUpdate;
|
||||
}
|
||||
|
||||
public boolean isNewVersionAvailable()
|
||||
{
|
||||
return newVersion;
|
||||
}
|
||||
|
||||
public boolean isMinecraftOutdated()
|
||||
{
|
||||
return newMinecraftVersion;
|
||||
}
|
||||
|
||||
public boolean isVersionCheckComplete()
|
||||
{
|
||||
return versionCheckComplete;
|
||||
}
|
||||
|
||||
/* VERSION CHECK THREAD CLASS */
|
||||
private class VersionCheckThread extends Thread
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
String location = VersionURL;
|
||||
|
||||
HttpURLConnection connection = null;
|
||||
|
||||
// Used to "dereference" any location headers we may get.
|
||||
while (location != null && !location.isEmpty())
|
||||
{
|
||||
URL url = new URL(location);
|
||||
connection = (HttpURLConnection) url.openConnection();
|
||||
connection.setRequestProperty("User-Agent",
|
||||
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.60 Safari/537.17");
|
||||
connection.connect();
|
||||
location = connection.getHeaderField("Location");
|
||||
}
|
||||
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
latestModVersion = reader.readLine();
|
||||
criticalUpdate = Boolean.parseBoolean(reader.readLine());
|
||||
latestMCVersion = reader.readLine();
|
||||
description = reader.readLine();
|
||||
reader.close();
|
||||
|
||||
if (beforeTargetVersion(modVersion, latestModVersion))
|
||||
{
|
||||
FMLLog.info("An updated version of " + modName + " is available: " + latestModVersion + ".");
|
||||
//modLogger.log(Level.INFO, "An updated version of " + modName + " is available: " +
|
||||
// latestModVersion + ".");
|
||||
newVersion = true;
|
||||
if (criticalUpdate)
|
||||
{
|
||||
FMLLog.info("This update has been marked as CRITICAL and will ignore notification suppression" +
|
||||
".");
|
||||
//modLogger.log(Level.INFO, "This update has been marked as CRITICAL and will ignore " +
|
||||
// "notification suppression.");
|
||||
}
|
||||
if (beforeTargetVersion(MCVersion, latestMCVersion))
|
||||
{
|
||||
newMinecraftVersion = true;
|
||||
//modLogger.log(Level.INFO, "This update is for Minecraft " + latestMCVersion + ".");
|
||||
FMLLog.info("This update is for Minecraft " + latestMCVersion + ".");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//modLogger.log(Level.WARNING, "Version Check Failed: " + e.getMessage());
|
||||
FMLLog.warning("Version check Failed: " + e.getMessage());
|
||||
}
|
||||
versionCheckComplete = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void doVersionCheck()
|
||||
{
|
||||
VersionInfo main = new VersionInfo(ModName, Version, VersionURL);
|
||||
/*TickHandlerVersion.registerModVersionInfo(main);
|
||||
TickHandlerVersion.initialize();*/
|
||||
//TickRegistry.registerScheduledTickHandler(TickHandlerVersion.instance, Side.CLIENT);
|
||||
|
||||
VersionCheckThread thread = main.new VersionCheckThread();
|
||||
thread.start();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package magicbees.main.utils.compat;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import magicbees.main.Config;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class ArsMagicaHelper
|
||||
{
|
||||
public enum ResourceType
|
||||
{
|
||||
VINTEUM_DUST,
|
||||
ARCANE_COMPOUND,
|
||||
ARCANE_ASH,
|
||||
PURIFIED_VINTEUM,
|
||||
CHIMERITE,
|
||||
BLUE_TOPAZ,
|
||||
SUNSTONE,
|
||||
MOONSTONE,
|
||||
}
|
||||
|
||||
public enum EssenceType
|
||||
{
|
||||
ARCANE,
|
||||
EARTH,
|
||||
AIR,
|
||||
FIRE,
|
||||
WATER,
|
||||
PLANT,
|
||||
ICE,
|
||||
LIGHTNING,
|
||||
LIFE,
|
||||
ENDER,
|
||||
PURE,
|
||||
HIGH,
|
||||
BASE,
|
||||
}
|
||||
|
||||
private static boolean isArsMagicaPresent = false;
|
||||
public static final String Name = "arsmagica2";
|
||||
|
||||
public static boolean isActive()
|
||||
{
|
||||
return isArsMagicaPresent;
|
||||
}
|
||||
|
||||
public static void preInit()
|
||||
{
|
||||
if (Loader.isModLoaded(Name))
|
||||
{
|
||||
isArsMagicaPresent = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void init()
|
||||
{
|
||||
if (isActive())
|
||||
{
|
||||
getBlocks();
|
||||
getItems();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void postInit() {}
|
||||
|
||||
private static void getBlocks()
|
||||
{
|
||||
try
|
||||
{
|
||||
Class clazz = Class.forName("am2.blocks.BlocksCommonProxy");
|
||||
Config.amResourceBlock = (Block)(clazz.getField("AMOres").get(null));
|
||||
Config.amBlackOrchid = (Block)(clazz.getField("blueOrchid").get(null));
|
||||
Config.amDesertNova = (Block)(clazz.getField("desertNova").get(null));
|
||||
Config.amAum = (Block)(clazz.getField("aum").get(null));
|
||||
Config.amWakebloom = (Block)(clazz.getField("wakebloom").get(null));
|
||||
Config.amTarmaRoot = (Block)(clazz.getField("tarmaRoot").get(null));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static void getItems()
|
||||
{
|
||||
try
|
||||
{
|
||||
Class clazz = Class.forName("am2.items.ItemsCommonProxy");
|
||||
Config.amItemResource = (Item)(clazz.getField("itemOre").get(null));
|
||||
Config.amEssence = (Item)(clazz.getField("essence").get(null));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package magicbees.main.utils.compat;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import magicbees.main.Config;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class EquivalentExchangeHelper
|
||||
{
|
||||
private static boolean isEquivalentExchangePresent = false;
|
||||
|
||||
public static boolean isActive()
|
||||
{
|
||||
return isEquivalentExchangePresent;
|
||||
}
|
||||
|
||||
public static void preInit()
|
||||
{
|
||||
if (Loader.isModLoaded("EE3"))
|
||||
{
|
||||
isEquivalentExchangePresent = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void init()
|
||||
{
|
||||
if (isActive())
|
||||
{
|
||||
getBlocks();
|
||||
getItems();
|
||||
}
|
||||
}
|
||||
|
||||
public static void postInit() {}
|
||||
|
||||
private static void getBlocks() {}
|
||||
|
||||
private static void getItems()
|
||||
{
|
||||
try
|
||||
{
|
||||
Class itemClass = Class.forName("com.pahimar.ee3.item.ModItems");
|
||||
Config.eeMinuimShard = (Item)(itemClass.getField("miniumShard").get(null));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
FMLLog.info("Could not get Equivalent Exchange items.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package magicbees.main.utils.compat;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class ExtraBeesHelper
|
||||
{
|
||||
public enum CombType
|
||||
{
|
||||
BARREN,
|
||||
ROTTEN,
|
||||
BONE,
|
||||
OIL,
|
||||
COAL,
|
||||
FUEL,
|
||||
WATER,
|
||||
MILK,
|
||||
FRUIT,
|
||||
SEED,
|
||||
ALCOHOL,
|
||||
STONE,
|
||||
REDSTONE,
|
||||
RESIN,
|
||||
IC2,
|
||||
IRON,
|
||||
GOLD,
|
||||
COPPER,
|
||||
TIN,
|
||||
SILVER,
|
||||
BRONZE,
|
||||
URANIUM,
|
||||
CLAY,
|
||||
OLD,
|
||||
FUNGAL,
|
||||
CREOSOTE,
|
||||
LATEX,
|
||||
ACIDIC,
|
||||
VENOMOUS,
|
||||
SLIME,
|
||||
BLAZE,
|
||||
COFFEE,
|
||||
GLACIAL,
|
||||
MINT,
|
||||
CITRUS,
|
||||
PEAT,
|
||||
SHADOW,
|
||||
LEAD,
|
||||
BRASS,
|
||||
ELECTRUM,
|
||||
ZINC,
|
||||
TITANIUM,
|
||||
TUNGSTEN,
|
||||
STEEL,
|
||||
IRIDIUM,
|
||||
PLATINUM,
|
||||
LAPIS,
|
||||
SODALITE,
|
||||
PYRITE,
|
||||
BAUXITE,
|
||||
CINNABAR,
|
||||
SPHALERITE,
|
||||
EMERALD,
|
||||
RUBY,
|
||||
SAPPHIRE,
|
||||
OLIVINE,
|
||||
DIAMOND,
|
||||
RED,
|
||||
YELLOW,
|
||||
BLUE,
|
||||
GREEN,
|
||||
BLACK,
|
||||
WHITE,
|
||||
BROWN,
|
||||
ORANGE,
|
||||
CYAN,
|
||||
PURPLE,
|
||||
GRAY,
|
||||
LIGHTBLUE,
|
||||
PINK,
|
||||
LIMEGREEN,
|
||||
MAGENTA,
|
||||
LIGHTGRAY,
|
||||
NICKEL,
|
||||
INVAR,
|
||||
GLOWSTONE,
|
||||
SALTPETER,
|
||||
PULP,
|
||||
MULCH,
|
||||
COMPOST,
|
||||
SAWDUST,
|
||||
;
|
||||
}
|
||||
|
||||
private static boolean isEBPresent = false;
|
||||
|
||||
public static boolean isActive()
|
||||
{
|
||||
return isEBPresent;
|
||||
}
|
||||
|
||||
public static void preInit()
|
||||
{
|
||||
if (cpw.mods.fml.common.Loader.isModLoaded("ExtraBees"))
|
||||
{
|
||||
isEBPresent = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void init() {}
|
||||
public static void postInit() {}
|
||||
|
||||
public static ItemStack getExtraBeeItem(String field)
|
||||
{
|
||||
ItemStack value = null;
|
||||
try
|
||||
{
|
||||
Class src = Class.forName("binnie.extrabees.core.ExtraBeeItem");
|
||||
Field f = src.getDeclaredField(field);
|
||||
|
||||
Item i = (Item) f.get(null);
|
||||
value = new ItemStack(i);
|
||||
}
|
||||
catch (Exception e) { }
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
package magicbees.main.utils.compat;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ItemInterface;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import magicbees.bees.BeeManager;
|
||||
import magicbees.main.Config;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public class ForestryHelper
|
||||
{
|
||||
public enum BlockResource
|
||||
{
|
||||
APATITE,
|
||||
COPPER,
|
||||
TIN,
|
||||
;
|
||||
}
|
||||
|
||||
public enum CraftingMaterial
|
||||
{
|
||||
PULSATING_DUST, // unused
|
||||
PULSATING_MESH,
|
||||
SILK_WISP,
|
||||
WOVEN_SILK,
|
||||
DISSIPATION_CHARGE,
|
||||
ICE_SHARD,
|
||||
SCENTED_PANELING,
|
||||
;
|
||||
}
|
||||
|
||||
public enum Comb
|
||||
{
|
||||
HONEY,
|
||||
COCOA,
|
||||
SIMMERING,
|
||||
STRINGY,
|
||||
FROZEN,
|
||||
DRIPPING,
|
||||
SILKY,
|
||||
PARCHED,
|
||||
MYSTERIOUS,
|
||||
IRRADIATED,
|
||||
POWDERY,
|
||||
REDDENED,
|
||||
DARKENED,
|
||||
OMEGA,
|
||||
WHEATEN,
|
||||
MOSSY,
|
||||
;
|
||||
}
|
||||
|
||||
public enum Propolis
|
||||
{
|
||||
NORMAL,
|
||||
STICKY, // Unused.
|
||||
PULSATING,
|
||||
SILKY,
|
||||
;
|
||||
}
|
||||
|
||||
public enum Pollen
|
||||
{
|
||||
NORMAL,
|
||||
CRYSTALLINE,
|
||||
;
|
||||
}
|
||||
|
||||
public enum CircuitBoard
|
||||
{
|
||||
BASIC,
|
||||
ENHANCED,
|
||||
REFINED,
|
||||
INTRICATE,
|
||||
;
|
||||
}
|
||||
|
||||
public enum Tube
|
||||
{
|
||||
COPPER,
|
||||
TIN,
|
||||
BRONZE,
|
||||
IRON,
|
||||
GOLD,
|
||||
DIAMOND,
|
||||
OBSIDIAN,
|
||||
BLAZE,
|
||||
RUBBER,
|
||||
EMERALD,
|
||||
APATITE,
|
||||
LAPIS,
|
||||
;
|
||||
}
|
||||
|
||||
public static final String Name = "Forestry";
|
||||
|
||||
public static void preInit() {}
|
||||
|
||||
public static void init()
|
||||
{
|
||||
getBlocks();
|
||||
getItems();
|
||||
}
|
||||
|
||||
public static void postInit() {}
|
||||
|
||||
private static void getBlocks()
|
||||
{
|
||||
try
|
||||
{
|
||||
Class c = Class.forName("forestry.core.config.ForestryBlock");
|
||||
Config.fAlvearyBlock = (Block)(c.getField("alveary").get(null));
|
||||
Config.fHiveBlock = (Block)(c.getField("beehives").get(null));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static void getItems()
|
||||
{
|
||||
Config.fBeeComb = ItemInterface.getItem("beeComb").getItem();
|
||||
Config.fPollen = ItemInterface.getItem("pollen").getItem();
|
||||
Config.fCraftingResource = ItemInterface.getItem("craftingMaterial").getItem();
|
||||
Config.fHoneyDrop = ItemInterface.getItem("honeyDrop").getItem();
|
||||
Config.fHoneydew = ItemInterface.getItem("honeydew").getItem();
|
||||
}
|
||||
|
||||
public static IAllele[] getTemplateForestryForSpecies(String speciesName)
|
||||
{
|
||||
return BeeManager.beeRoot.getTemplate("forestry.species" + speciesName);
|
||||
}
|
||||
|
||||
public static EnumTemperature getEnumTemperatureFromValue(float rawTemp)
|
||||
{
|
||||
return EnumTemperature.getFromValue(rawTemp);
|
||||
}
|
||||
|
||||
public static EnumHumidity getEnumHumidityFromValue(float rawHumidity)
|
||||
{
|
||||
return EnumHumidity.getFromValue(rawHumidity);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package magicbees.main.utils.compat;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import magicbees.main.Config;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class RedstoneArsenalHelper
|
||||
{
|
||||
public enum MiscResource
|
||||
{
|
||||
FLUXED_ELECTRUMBLOCK,
|
||||
;
|
||||
}
|
||||
|
||||
public enum NuggetType
|
||||
{
|
||||
ELECTRUMFLUX,
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static final String Name = "RedstoneArsenal";
|
||||
private static boolean isRedstoneArsenalPresent = false;
|
||||
|
||||
public static boolean isActive()
|
||||
{
|
||||
return isRedstoneArsenalPresent;
|
||||
}
|
||||
|
||||
public static void preInit()
|
||||
{
|
||||
if (cpw.mods.fml.common.Loader.isModLoaded(Name))
|
||||
{
|
||||
isRedstoneArsenalPresent = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Switch off RSA-dependant items.
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static void init()
|
||||
{
|
||||
//if (isActive()) { }
|
||||
}
|
||||
|
||||
public static void postInit()
|
||||
{
|
||||
if (isActive())
|
||||
{
|
||||
// Apparently the Game Registry isn't populated until now. ):
|
||||
getBlocks();
|
||||
getItems();
|
||||
|
||||
//addItemsToBackpack();
|
||||
setupCrafting();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static void getBlocks()
|
||||
{
|
||||
Config.rsaFluxBlock = GameRegistry.findItemStack("RedstoneArsenal", "blockElectrumFlux", 1);
|
||||
}
|
||||
|
||||
private static void getItems()
|
||||
{
|
||||
Config.rsaFluxNugget = GameRegistry.findItemStack("RedstoneArsenal", "nuggetElectrumFlux", 1);
|
||||
}
|
||||
|
||||
|
||||
private static void setupCrafting()
|
||||
{
|
||||
ItemStack input, output;
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,661 @@
|
||||
package magicbees.main.utils.compat;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import forestry.api.core.BlockInterface;
|
||||
import forestry.api.core.ItemInterface;
|
||||
import magicbees.item.types.PollenType;
|
||||
import magicbees.item.types.PropolisType;
|
||||
import magicbees.item.types.ResourceType;
|
||||
import magicbees.item.types.WaxType;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.ShapelessRecipes;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import thaumcraft.api.ThaumcraftApi;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.crafting.CrucibleRecipe;
|
||||
import thaumcraft.api.crafting.IArcaneRecipe;
|
||||
import thaumcraft.api.crafting.InfusionRecipe;
|
||||
import thaumcraft.api.research.ResearchCategories;
|
||||
import thaumcraft.api.research.ResearchItem;
|
||||
import thaumcraft.api.research.ResearchPage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ThaumcraftHelper
|
||||
{
|
||||
public enum MiscResource
|
||||
{
|
||||
ALUMENTUM,
|
||||
NITOR,
|
||||
THAUMIUM,
|
||||
QUICKSILVER,
|
||||
MAGIC_TALLOW,
|
||||
ZOMBIE_BRAIN,
|
||||
AMBER,
|
||||
ENCHANTED_FABRIC,
|
||||
FLUX_FILTER,
|
||||
KNOWLEDGE_FRAGMENT,
|
||||
MIRRORED_GLASS,
|
||||
;
|
||||
}
|
||||
|
||||
public enum NuggetType
|
||||
{
|
||||
IRON,
|
||||
COPPER,
|
||||
TIN,
|
||||
SILVER,
|
||||
LEAD,
|
||||
QUICKSILVER,
|
||||
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,
|
||||
;
|
||||
}
|
||||
|
||||
public enum ShardType
|
||||
{
|
||||
AIR,
|
||||
FIRE,
|
||||
WATER,
|
||||
EARTH,
|
||||
ORDER,
|
||||
CHAOS,
|
||||
;
|
||||
}
|
||||
|
||||
public enum Entity
|
||||
{
|
||||
BRAINY_ZOMBIE("entBrainyZombie", "EntityBrainyZombie"),
|
||||
GIANT_BRAINY_ZOMBIE("entGiantBrainyZombie", "EntityGiantBrainyZombie"),
|
||||
WISP("entWisp", "EntityWisp"),
|
||||
FIREBAT("entFirebat", "EntityFireBat"),
|
||||
;
|
||||
|
||||
private static String packageName = "thaumcraft.common.entities.monster.";
|
||||
|
||||
public String entityID;
|
||||
private String className;
|
||||
|
||||
private Entity(String id, String clazz)
|
||||
{
|
||||
this.entityID = id;
|
||||
this.className = clazz;
|
||||
}
|
||||
|
||||
public String getClassName()
|
||||
{
|
||||
return packageName + this.className;
|
||||
}
|
||||
}
|
||||
|
||||
public enum BlockPlant
|
||||
{
|
||||
GREATWOOD_SAPLING,
|
||||
SILVERWOOD_SAPLING,
|
||||
SHIMMERLEAF,
|
||||
CINDERPEARL,
|
||||
PURIFYING_PLANT,
|
||||
;
|
||||
}
|
||||
|
||||
public enum TreeType
|
||||
{
|
||||
GREATWOOD,
|
||||
SILVERWOOD,
|
||||
;
|
||||
}
|
||||
|
||||
public static final String Name = "Thaumcraft";
|
||||
private static boolean isThaumcraftPresent = false;
|
||||
|
||||
public static boolean isActive()
|
||||
{
|
||||
return isThaumcraftPresent;
|
||||
}
|
||||
|
||||
public static void preInit()
|
||||
{
|
||||
if (cpw.mods.fml.common.Loader.isModLoaded(Name))
|
||||
{
|
||||
isThaumcraftPresent = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Switch off TC-dependant items.
|
||||
ResourceType.LORE_FRAGMENT.setHidden();
|
||||
ResourceType.TC_DUST_AIR.setHidden();
|
||||
ResourceType.TC_DUST_CHAOS.setHidden();
|
||||
ResourceType.TC_DUST_EARTH.setHidden();
|
||||
ResourceType.TC_DUST_FIRE.setHidden();
|
||||
ResourceType.TC_DUST_ORDER.setHidden();
|
||||
ResourceType.TC_DUST_WATER.setHidden();
|
||||
}
|
||||
}
|
||||
|
||||
public static void init()
|
||||
{
|
||||
//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);
|
||||
|
||||
//addItemsToBackpack();
|
||||
setupItemAspects();
|
||||
setupCrafting();
|
||||
setupResearch();
|
||||
}
|
||||
}
|
||||
|
||||
private static Object aspectTime;
|
||||
|
||||
private static void getBlocks()
|
||||
{
|
||||
Config.tcPlant = GameRegistry.findBlock(Name, "blockCustomPlant");
|
||||
Config.tcCandle = GameRegistry.findBlock(Name, "blockCandle");
|
||||
Config.tcCrystal = GameRegistry.findBlock(Name, "blockCrystal");
|
||||
Config.tcMarker = GameRegistry.findBlock(Name, "blockMarker");
|
||||
Config.tcJar = GameRegistry.findBlock(Name, "blockJar");
|
||||
Config.tcLog = GameRegistry.findBlock(Name, "blockMagicalLog");
|
||||
Config.tcLeaf = GameRegistry.findBlock(Name, "blockMagicalLeaves");
|
||||
Config.tcWarded = GameRegistry.findBlock(Name, "blockWarded");
|
||||
}
|
||||
|
||||
private static void getItems()
|
||||
{
|
||||
Config.tcFilledJar = GameRegistry.findItem(Name, "BlockJarFilledItem");
|
||||
Config.tcMiscResource = GameRegistry.findItem(Name, "ItemResource");
|
||||
//Config.tcEssentiaBottle = GameRegistry.findItem(Name, "BlockJarFilledItem");
|
||||
Config.tcShard = GameRegistry.findItem(Name, "ItemShard");
|
||||
Config.tcGolem = GameRegistry.findItem(Name, "ItemGolemPlacer");
|
||||
//Config.tcWispEssence = ItemApi.getItem("itemWispEssence", 0).getItem();
|
||||
Config.tcNuggets = GameRegistry.findItem(Name, "ItemNugget");
|
||||
Config.tcShard = GameRegistry.findItem(Name, "ItemShard");
|
||||
Config.tcNuggetChicken = GameRegistry.findItem(Name, "ItemNuggetChicken");
|
||||
Config.tcNuggetBeef = GameRegistry.findItem(Name, "ItemNuggetBeef");
|
||||
Config.tcNuggetPork = GameRegistry.findItem(Name, "ItemNuggetPork");
|
||||
}
|
||||
|
||||
private static void addItemsToBackpack()
|
||||
{
|
||||
// if (MagicBees.getConfig().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;
|
||||
private static Object singularityA;
|
||||
private static Object singularityB;
|
||||
private static Object essenceLife;
|
||||
private static Object essenceDeath;
|
||||
private static Object essenceArmor;
|
||||
private static Object essenceUnstableA;
|
||||
private static Object essenceUnstableB;
|
||||
private static Object essenceTime;
|
||||
private static Object essenceOblivion;
|
||||
|
||||
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"),
|
||||
new ResourceLocation("thaumcraft", "textures/gui/gui_researchback.png"));
|
||||
|
||||
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();
|
||||
|
||||
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);
|
||||
|
||||
ResearchItem researchFragment = new ResearchItem("MB_LoreFragment", category, new AspectList(),
|
||||
0, -3, 0,
|
||||
Config.miscResources.getStackForType(ResourceType.LORE_FRAGMENT))
|
||||
.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),
|
||||
-2, -3, 1,
|
||||
new ItemStack(Config.thaumiumScoop))
|
||||
.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,
|
||||
new ItemStack(Config.thaumiumGrafter))
|
||||
.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,
|
||||
new ItemStack(Config.hiveFrameMagic))
|
||||
.setPages(getResearchPage("MB_FrameMagic"), new ResearchPage((IArcaneRecipe)frameMagic) )
|
||||
.registerResearchItem();
|
||||
|
||||
input = new ItemStack(Config.hiveFrameMagic);
|
||||
list = new ArrayList<Object>(2);
|
||||
list.add(Config.miscResources.getStackForType(ResourceType.ESSENCE_FALSE_LIFE));
|
||||
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,
|
||||
Config.miscResources.getStackForType(ResourceType.ESSENCE_FALSE_LIFE))
|
||||
.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),
|
||||
5, 0, 3,
|
||||
Config.miscResources.getStackForType(ResourceType.ESSENCE_EVERLASTING_DURABILITY))
|
||||
.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(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,
|
||||
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();
|
||||
|
||||
list = new ArrayList<Object>(2);
|
||||
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();
|
||||
|
||||
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),
|
||||
0, 2, 5,
|
||||
Config.miscResources.getStackForType(ResourceType.ESSENCE_LOST_TIME))
|
||||
.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,
|
||||
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();
|
||||
|
||||
list = new ArrayList<Object>(2);
|
||||
list.add(Config.miscResources.getStackForType(ResourceType.ESSENCE_SCORNFUL_OBLIVION));
|
||||
list.add(ItemInterface.getItem("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,
|
||||
Config.miscResources.getStackForType(ResourceType.ESSENCE_SCORNFUL_OBLIVION))
|
||||
.setPages(getResearchPage("MB_EssenceOblivion.1"), new ResearchPage((IArcaneRecipe)essenceOblivion), new ResearchPage(recipe) )
|
||||
.setParents("MB_DimensionalSingularity")
|
||||
.setConcealed()
|
||||
.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 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));
|
||||
|
||||
|
||||
list = new AspectList(new ItemStack(Blocks.log));
|
||||
for (int i = 1; i <= 8; i++)
|
||||
{
|
||||
item = forestry.api.core.BlockInterface.getBlock("log" + i);
|
||||
if (item != null)
|
||||
{
|
||||
ThaumcraftApi.registerObjectTag(item, list);
|
||||
}
|
||||
}
|
||||
|
||||
list = new AspectList(new ItemStack(Blocks.planks));
|
||||
for (int i = 1; i <= 2; i++)
|
||||
{
|
||||
item = BlockInterface.getBlock("planks" + i);
|
||||
if (item != null)
|
||||
{
|
||||
ThaumcraftApi.registerObjectTag(item, list);
|
||||
}
|
||||
}
|
||||
|
||||
list = new AspectList().add(Aspect.ORDER, 5).add(Aspect.ARMOR, 2).add(Aspect.BEAST, 1);
|
||||
item = new ItemStack(Config.fHiveBlock);
|
||||
ThaumcraftApi.registerObjectTag(item, list);
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(Config.hive), list);
|
||||
|
||||
list = new AspectList().add(Aspect.LIGHT, 1);
|
||||
item = BlockInterface.getBlock("candle");
|
||||
ThaumcraftApi.registerObjectTag(item, new int[] { item.getItemDamage() }, list);
|
||||
|
||||
list = new AspectList().add(Aspect.DARKNESS, 1);
|
||||
item = BlockInterface.getBlock("stump");
|
||||
ThaumcraftApi.registerObjectTag(item, new int[] { item.getItemDamage() }, list);
|
||||
|
||||
list = new AspectList(new ItemStack(Blocks.glass)).add(Aspect.SENSES, 1);
|
||||
item = BlockInterface.getBlock("glass");
|
||||
ThaumcraftApi.registerObjectTag(item, list);
|
||||
|
||||
list = new AspectList().add(Aspect.EARTH, 2).add(Aspect.WATER, 2);
|
||||
item = BlockInterface.getBlock("soil");
|
||||
ThaumcraftApi.registerObjectTag(item, new int[]{1}, list);
|
||||
|
||||
list = new AspectList(new ItemStack(Blocks.leaves));
|
||||
item = BlockInterface.getBlock("leaves");
|
||||
ThaumcraftApi.registerObjectTag(item, new int[] { item.getItemDamage() }, list);
|
||||
|
||||
list = new AspectList(new ItemStack(Blocks.sapling));
|
||||
item = forestry.api.core.BlockInterface.getBlock("saplingGE");
|
||||
ThaumcraftApi.registerObjectTag(item, list);
|
||||
|
||||
list = new AspectList()/*.add(Aspect.SEED, 1)*/.add(Aspect.PLANT, 1);
|
||||
item = forestry.api.core.ItemInterface.getItem("pollenFertile");
|
||||
ThaumcraftApi.registerObjectTag(item, list);
|
||||
|
||||
list = new AspectList().add(Aspect.CRYSTAL, 1).add(Aspect.EARTH, 2);
|
||||
item = forestry.api.core.BlockInterface.getBlock("resources");
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(item.getItem(), 1, ForestryHelper.BlockResource.APATITE.ordinal()),
|
||||
list.copy()/*.add(Aspect.STONE, 2)*/);
|
||||
item = forestry.api.core.ItemInterface.getItem("apatite");
|
||||
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 = forestry.api.core.ItemInterface.getItem("beeDroneGE");
|
||||
ThaumcraftApi.registerObjectTag(item, list);
|
||||
list = list.copy().add(Aspect.GREED, 2).add(Aspect.EXCHANGE, 1);
|
||||
item = forestry.api.core.ItemInterface.getItem("beePrincessGE");
|
||||
ThaumcraftApi.registerObjectTag(item, list);
|
||||
item = forestry.api.core.ItemInterface.getItem("beeQueenGE");
|
||||
ThaumcraftApi.registerObjectTag(item, list);
|
||||
list = new AspectList().add(Aspect.LIFE, 2).add(Aspect.EXCHANGE, 5);
|
||||
item = forestry.api.core.ItemInterface.getItem("beeLarvaeGE");
|
||||
ThaumcraftApi.registerObjectTag(item, list);
|
||||
|
||||
item = forestry.api.core.ItemInterface.getItem("scoop");
|
||||
list = new AspectList(new ItemStack(item.getItem(), 1, 0)).add(Aspect.TOOL, 2);
|
||||
ThaumcraftApi.registerComplexObjectTag(item, list);
|
||||
|
||||
item = forestry.api.core.ItemInterface.getItem("grafter");
|
||||
list = new AspectList(new ItemStack(item.getItem(), 1, item.getItemDamage())).add(Aspect.TOOL, 2);
|
||||
ThaumcraftApi.registerComplexObjectTag(item, list);
|
||||
|
||||
item = forestry.api.core.ItemInterface.getItem("grafterProven");
|
||||
list = list.copy().add(Aspect.TOOL, 2).add(Aspect.EXCHANGE, 3);
|
||||
ThaumcraftApi.registerObjectTag(new ItemStack(item.getItem(), 1, item.getItemDamage()), list);
|
||||
|
||||
list = new AspectList().add(Aspect.TRAP, 2);
|
||||
ThaumcraftApi.registerObjectTag("beeComb", list);
|
||||
|
||||
list = new AspectList().add(Aspect.SLIME, 1);
|
||||
item = forestry.api.core.ItemInterface.getItem("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));
|
||||
|
||||
list = new AspectList().add(Aspect.PLANT, 2);
|
||||
item = forestry.api.core.ItemInterface.getItem("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));
|
||||
|
||||
list = new AspectList().add(Aspect.ORDER, 1);
|
||||
item = forestry.api.core.ItemInterface.getItem("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));
|
||||
|
||||
list = new AspectList().add(Aspect.EXCHANGE, 2).add(Aspect.LIFE, 2);
|
||||
item = forestry.api.core.ItemInterface.getItem("honeyDrop");
|
||||
ThaumcraftApi.registerObjectTag(item, new int[] {item.getItemDamage()}, list);
|
||||
|
||||
list = new AspectList().add(Aspect.LIFE, 2).add(Aspect.ENERGY, 2);
|
||||
item = forestry.api.core.ItemInterface.getItem("honeydew");
|
||||
ThaumcraftApi.registerObjectTag(item, new int[] {item.getItemDamage()}, list);
|
||||
|
||||
list = new AspectList().add(Aspect.GREED, 1).add(Aspect.LIFE, 4);
|
||||
item = forestry.api.core.ItemInterface.getItem("royalJelly");
|
||||
ThaumcraftApi.registerObjectTag(item, new int[] {item.getItemDamage()}, list);
|
||||
|
||||
list = new AspectList().add(Aspect.FIRE, 1).add(Aspect.TRAP, 2);
|
||||
item = forestry.api.core.ItemInterface.getItem("phosphor");
|
||||
ThaumcraftApi.registerObjectTag(item, new int[] {item.getItemDamage()}, list);
|
||||
|
||||
item = Config.miscResources.getStackForType(ResourceType.ESSENCE_FALSE_LIFE);
|
||||
ThaumcraftApi.registerObjectTag(item, new int[] {item.getItemDamage()}, new AspectList().add(Aspect.LIFE, 6));
|
||||
|
||||
item = Config.miscResources.getStackForType(ResourceType.ESSENCE_SHALLOW_GRAVE);
|
||||
ThaumcraftApi.registerObjectTag(item, new int[] {item.getItemDamage()}, new AspectList().add(Aspect.DEATH, 6));
|
||||
|
||||
item = Config.miscResources.getStackForType(ResourceType.ESSENCE_EVERLASTING_DURABILITY);
|
||||
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 ));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
package magicbees.main.utils.compat;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import magicbees.item.types.DropType;
|
||||
import magicbees.main.Config;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
public class ThermalExpansionHelper
|
||||
{
|
||||
public enum MiscResource
|
||||
{
|
||||
EnderiumBlock,
|
||||
ElectrumBlock,
|
||||
BronzeBlock,
|
||||
FluidCoal,
|
||||
FluidRedstone,
|
||||
FluidGlowstone,
|
||||
FluidEnder,
|
||||
;
|
||||
}
|
||||
|
||||
public enum NuggetType
|
||||
{
|
||||
ENDERIUM,
|
||||
ELECTRUM,
|
||||
BRONZE,
|
||||
INVAR,
|
||||
NICKEL,
|
||||
PLATINUM,
|
||||
;
|
||||
}
|
||||
|
||||
public enum Entity
|
||||
{
|
||||
BLIZZ("Blizz"),
|
||||
;
|
||||
|
||||
public final String entityID;
|
||||
private Entity(String s)
|
||||
{
|
||||
this.entityID = s;
|
||||
}
|
||||
}
|
||||
|
||||
public static final String Name = "ThermalExpansion";
|
||||
private static boolean isThermalExpansionPresent = false;
|
||||
|
||||
public static boolean isActive()
|
||||
{
|
||||
return isThermalExpansionPresent;
|
||||
}
|
||||
|
||||
public static void preInit()
|
||||
{
|
||||
if (cpw.mods.fml.common.Loader.isModLoaded(Name))
|
||||
{
|
||||
isThermalExpansionPresent = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void init()
|
||||
{
|
||||
if (isActive()) {
|
||||
getFluids();
|
||||
setupCrafting();
|
||||
}
|
||||
}
|
||||
|
||||
private static void getFluids()
|
||||
{
|
||||
Config.teFluidGlowstone = FluidRegistry.getFluidStack("glowstone", 50);
|
||||
Config.teFluidCoal = FluidRegistry.getFluidStack("coal", 50);
|
||||
Config.teFluidRedstone = FluidRegistry.getFluidStack("redstone", 50);
|
||||
Config.teFluidEnder = FluidRegistry.getFluidStack("ender", 50);
|
||||
}
|
||||
private static void setupCrafting()
|
||||
{
|
||||
//crucible recipes
|
||||
// carbon to liquid coal
|
||||
ItemStack carbonDrop = Config.drops.getStackForType(DropType.CARBON);
|
||||
|
||||
NBTTagCompound toSend = new NBTTagCompound();
|
||||
toSend.setInteger("energy", 4000);
|
||||
toSend.setTag("input", new NBTTagCompound());
|
||||
toSend.setTag("output", new NBTTagCompound());
|
||||
|
||||
carbonDrop.writeToNBT(toSend.getCompoundTag("input"));
|
||||
Config.teFluidCoal.writeToNBT(toSend.getCompoundTag("output"));
|
||||
FMLInterModComms.sendMessage("ThermalExpansion", "CrucibleRecipe", toSend);
|
||||
|
||||
//redstone drop to molten redstone
|
||||
|
||||
ItemStack destabilizedDrop = Config.drops.getStackForType(DropType.DESTABILIZED);
|
||||
|
||||
toSend = new NBTTagCompound();
|
||||
toSend.setInteger("energy", 4000);
|
||||
toSend.setTag("input", new NBTTagCompound());
|
||||
toSend.setTag("output", new NBTTagCompound());
|
||||
|
||||
destabilizedDrop.writeToNBT(toSend.getCompoundTag("input"));
|
||||
Config.teFluidRedstone.writeToNBT(toSend.getCompoundTag("output"));
|
||||
FMLInterModComms.sendMessage("ThermalExpansion", "CrucibleRecipe", toSend);
|
||||
|
||||
//endearing drop to molten ender
|
||||
|
||||
ItemStack endearingDrop = Config.drops.getStackForType(DropType.ENDEARING);
|
||||
|
||||
toSend = new NBTTagCompound();
|
||||
toSend.setInteger("energy", 4000);
|
||||
toSend.setTag("input", new NBTTagCompound());
|
||||
toSend.setTag("output", new NBTTagCompound());
|
||||
|
||||
endearingDrop.writeToNBT(toSend.getCompoundTag("input"));
|
||||
Config.teFluidEnder.writeToNBT(toSend.getCompoundTag("output"));
|
||||
FMLInterModComms.sendMessage("ThermalExpansion", "CrucibleRecipe", toSend);
|
||||
|
||||
//lux drop to molten glowstone
|
||||
|
||||
ItemStack luxDrop = Config.drops.getStackForType(DropType.LUX);
|
||||
|
||||
toSend = new NBTTagCompound();
|
||||
toSend.setInteger("energy", 4000);
|
||||
toSend.setTag("input", new NBTTagCompound());
|
||||
toSend.setTag("output", new NBTTagCompound());
|
||||
|
||||
luxDrop.writeToNBT(toSend.getCompoundTag("input"));
|
||||
Config.teFluidGlowstone.writeToNBT(toSend.getCompoundTag("output"));
|
||||
FMLInterModComms.sendMessage("ThermalExpansion", "CrucibleRecipe", toSend);
|
||||
}
|
||||
|
||||
public static void postInit()
|
||||
{
|
||||
if (isActive())
|
||||
{
|
||||
// Apparently the Game Registry isn't populated until now. ):
|
||||
getBlocks();
|
||||
getItems();
|
||||
}
|
||||
}
|
||||
|
||||
private static void getBlocks()
|
||||
{
|
||||
Config.teEnderiumBlock = GameRegistry.findItemStack("ThermalExpansion", "blockEnderium", 1);
|
||||
Config.teElectrumBlock = GameRegistry.findItemStack("ThermalExpansion", "blockElectrum", 1);
|
||||
Config.teInvarBlock = GameRegistry.findItemStack("ThermalExpansion", "blockInvar", 1);
|
||||
Config.teNickelBlock = GameRegistry.findItemStack("ThermalExpansion", "blockNickel", 1);
|
||||
Config.tePlatinumBlock = GameRegistry.findItemStack("ThermalExpansion", "blockPlatinum", 1);
|
||||
Config.teBronzeBlock = GameRegistry.findItemStack("ThermalExpansion", "blockBronze", 1);
|
||||
}
|
||||
|
||||
private static void getItems()
|
||||
{
|
||||
Config.teEnderiumNugget = GameRegistry.findItemStack("ThermalExpansion", "nuggetEnderium", 1);
|
||||
Config.teInvarNugget = GameRegistry.findItemStack("ThermalExpansion", "nuggetInvar", 1);
|
||||
Config.teElectrumNugget = GameRegistry.findItemStack("ThermalExpansion", "nuggetElectrum", 1);
|
||||
Config.teNickelNugget = GameRegistry.findItemStack("ThermalExpansion", "nuggetNickel", 1);
|
||||
Config.tePlatinumNugget = GameRegistry.findItemStack("ThermalExpansion", "nuggetPlatinum", 1);
|
||||
Config.teDustCryotheum = GameRegistry.findItemStack("ThermalExpansion", "dustCryotheum", 1);
|
||||
Config.teDustBlizz = GameRegistry.findItemStack("ThermalExpansion", "dustBlizz", 1);
|
||||
Config.teDustPyrotheum = GameRegistry.findItemStack("ThermalExpansion", "dustPyrotheum", 1);
|
||||
Config.teDustSulfur = GameRegistry.findItemStack("ThermalExpansion", "dustSulfur", 1);
|
||||
Config.teDustPlatinum = GameRegistry.findItemStack("ThermalExpansion", "dustPlatinum", 1);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package magicbees.storage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import forestry.api.storage.IBackpackDefinition;
|
||||
|
||||
/**
|
||||
* Backpack definition for Forestry.
|
||||
* @author MysteriousAges
|
||||
*
|
||||
*/
|
||||
public class BackpackDefinition implements IBackpackDefinition
|
||||
{
|
||||
private ArrayList<ItemStack> items;
|
||||
private String key;
|
||||
private String name;
|
||||
private int colour;
|
||||
|
||||
public BackpackDefinition(String backpackKey, String backpackName, int backpackColour)
|
||||
{
|
||||
items = new ArrayList<ItemStack>();
|
||||
this.name = backpackName;
|
||||
this.key = backpackKey;
|
||||
this.colour = backpackColour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey()
|
||||
{
|
||||
return this.key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPrimaryColour()
|
||||
{
|
||||
return this.colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSecondaryColour()
|
||||
{
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addValidItem(ItemStack validItem)
|
||||
{
|
||||
if (!this.items.contains(validItem))
|
||||
{
|
||||
this.items.add(validItem);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ItemStack> getValidItems(EntityPlayer player)
|
||||
{
|
||||
return this.items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidItem(EntityPlayer player, ItemStack itemStack)
|
||||
{
|
||||
boolean flag = false;
|
||||
|
||||
ItemStack stack;
|
||||
for (int i = 0; i < this.items.size() && !flag; i++)
|
||||
{
|
||||
stack = this.items.get(i);
|
||||
// If comparison stack has meta of -1
|
||||
if (stack.getItem() == itemStack.getItem())
|
||||
{
|
||||
flag = stack.getItemDamage() == -1 || stack.getItemDamage() == itemStack.getItemDamage();
|
||||
}
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,220 @@
|
||||
package magicbees.tileentity;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
|
||||
/**
|
||||
*
|
||||
* Singleton object to simulate enough of a bee house to fire the bee effects. =D
|
||||
*
|
||||
* @author MysteriousAges
|
||||
*
|
||||
*/
|
||||
public class EffectJarHousing implements IBeeHousing
|
||||
{
|
||||
private static EffectJarHousing instance = new EffectJarHousing();
|
||||
|
||||
TileEntityEffectJar jarEntity;
|
||||
|
||||
public static EffectJarHousing getFor(TileEntityEffectJar entity)
|
||||
{
|
||||
instance.jarEntity = entity;
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTerritoryModifier(IBeeGenome genome, float currentModifier)
|
||||
{
|
||||
return 0.9f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier)
|
||||
{
|
||||
return 0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier)
|
||||
{
|
||||
return 0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getProductionModifier(IBeeGenome genome, float currentModifier)
|
||||
{
|
||||
return 0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFloweringModifier(IBeeGenome genome, float currentModifier)
|
||||
{
|
||||
return 0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getXCoord()
|
||||
{
|
||||
return this.jarEntity.xCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getYCoord()
|
||||
{
|
||||
return this.jarEntity.yCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getZCoord()
|
||||
{
|
||||
return this.jarEntity.zCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSealed()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelfLighted()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSunlightSimulated()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHellish()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onQueenChange(ItemStack queen) { }
|
||||
|
||||
@Override
|
||||
public void wearOutEquipment(int amount) { }
|
||||
|
||||
@Override
|
||||
public void onQueenDeath(IBee queen) { }
|
||||
|
||||
@Override
|
||||
public void onPostQueenDeath(IBee queen) { }
|
||||
|
||||
@Override
|
||||
public ItemStack getQueen()
|
||||
{
|
||||
return this.jarEntity.getStackInSlot(TileEntityEffectJar.QUEEN_SLOT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getDrone()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setQueen(ItemStack itemStack)
|
||||
{
|
||||
this.jarEntity.setInventorySlotContents(TileEntityEffectJar.QUEEN_SLOT, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDrone(ItemStack itemstack) { }
|
||||
|
||||
@Override
|
||||
public int getBiomeId()
|
||||
{
|
||||
return this.jarEntity.getWorldObj().getBiomeGenForCoords(getXCoord(), getYCoord()).biomeID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumTemperature getTemperature()
|
||||
{
|
||||
EnumTemperature temp = EnumTemperature.NORMAL;
|
||||
ItemStack stack = this.jarEntity.getStackInSlot(TileEntityEffectJar.QUEEN_SLOT);
|
||||
if (stack != null)
|
||||
{
|
||||
IBee queen = magicbees.bees.BeeManager.beeRoot.getMember(stack);
|
||||
temp = queen.getGenome().getPrimary().getTemperature();
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumHumidity getHumidity()
|
||||
{
|
||||
EnumHumidity humid = EnumHumidity.NORMAL;
|
||||
ItemStack stack = this.jarEntity.getStackInSlot(TileEntityEffectJar.QUEEN_SLOT);
|
||||
if (stack != null)
|
||||
{
|
||||
IBee queen = magicbees.bees.BeeManager.beeRoot.getMember(stack);
|
||||
humid = queen.getGenome().getPrimary().getHumidity();
|
||||
}
|
||||
return humid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld()
|
||||
{
|
||||
return this.jarEntity.getWorldObj();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOwnerName()
|
||||
{
|
||||
return this.jarEntity.getOwner();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setErrorState(int state) { }
|
||||
|
||||
@Override
|
||||
public int getErrorOrdinal()
|
||||
{
|
||||
return 1; // EnumErrorCode.OK.ordinal() value.
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBreed()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addProduct(ItemStack product, boolean all)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPollenRetrieved(IBee queen, IIndividual pollen, boolean isHandled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onEggLaid(IBee queen)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getGeneticDecay(IBeeGenome genome, float currentModifier)
|
||||
{
|
||||
return 0f;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,257 @@
|
||||
package magicbees.tileentity;
|
||||
|
||||
import magicbees.main.CommonProxy;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
|
||||
public class TileEntityEffectJar extends TileEntity implements IInventory
|
||||
{
|
||||
public static final String tileEntityName = CommonProxy.DOMAIN + ".effectJar";
|
||||
|
||||
private String ownerName;
|
||||
private EffectJarHousing housingLogic;
|
||||
|
||||
private static final int SLOT_COUNT = 2;
|
||||
public static final int DRONE_SLOT = 0;
|
||||
public static final int QUEEN_SLOT = SLOT_COUNT - 1;
|
||||
|
||||
private ItemStack[] beeSlots;
|
||||
private IEffectData[] effectData = new IEffectData[2];
|
||||
|
||||
private int throttle;
|
||||
public int currentBeeHealth;
|
||||
public int currentBeeColour;
|
||||
|
||||
public TileEntityEffectJar()
|
||||
{
|
||||
super();
|
||||
this.beeSlots = new ItemStack[SLOT_COUNT];
|
||||
}
|
||||
|
||||
public void setOwner(EntityPlayer player)
|
||||
{
|
||||
this.ownerName = player.getCommandSenderName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRenderInPass(int pass)
|
||||
{
|
||||
return pass == 1;
|
||||
}
|
||||
|
||||
public String getOwner()
|
||||
{
|
||||
return this.ownerName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
{
|
||||
// Last slot reserved for "queen"
|
||||
return this.beeSlots.length - 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot)
|
||||
{
|
||||
return beeSlots[slot];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
if (this.beeSlots[QUEEN_SLOT] != null)
|
||||
{
|
||||
IBee queen = magicbees.bees.BeeManager.beeRoot.getMember(this.beeSlots[QUEEN_SLOT]);
|
||||
|
||||
currentBeeHealth = (queen.getHealth() * 100) / queen.getMaxHealth();
|
||||
currentBeeColour = ((IAlleleBeeSpecies)queen.getGenome().getPrimary()).getIconColour(0);
|
||||
|
||||
EffectJarHousing housingLogic = EffectJarHousing.getFor(this);
|
||||
this.effectData = queen.doEffect(this.effectData, housingLogic);
|
||||
if (this.worldObj.getWorldTime() % 5 == 0)
|
||||
{
|
||||
this.effectData = queen.doFX(this.effectData, housingLogic);
|
||||
}
|
||||
|
||||
// run the queen
|
||||
if (throttle > 550)
|
||||
{
|
||||
throttle = 0;
|
||||
queen.age(this.worldObj, 0.26f);
|
||||
|
||||
if (queen.getHealth() == 0)
|
||||
{
|
||||
this.beeSlots[QUEEN_SLOT] = null;
|
||||
currentBeeHealth = 0;
|
||||
currentBeeColour = 0x0ffffff;
|
||||
}
|
||||
else
|
||||
{
|
||||
queen.writeToNBT(this.beeSlots[QUEEN_SLOT].stackTagCompound);
|
||||
}
|
||||
this.markDirty();
|
||||
}
|
||||
else
|
||||
{
|
||||
throttle++;
|
||||
}
|
||||
}
|
||||
else if (this.beeSlots[DRONE_SLOT] != null)
|
||||
{
|
||||
// make a queen
|
||||
ItemStack droneStack = this.beeSlots[DRONE_SLOT];
|
||||
if (magicbees.bees.BeeManager.beeRoot.isDrone(droneStack))
|
||||
{
|
||||
IBee bee = magicbees.bees.BeeManager.beeRoot.getMember(droneStack);
|
||||
if (droneStack.stackSize == 1)
|
||||
{
|
||||
this.beeSlots[DRONE_SLOT] = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
droneStack.stackSize--;
|
||||
}
|
||||
|
||||
this.beeSlots[QUEEN_SLOT] = droneStack.copy();
|
||||
this.beeSlots[QUEEN_SLOT].stackSize = 1;
|
||||
|
||||
int current = bee.getHealth();
|
||||
int max = bee.getMaxHealth();
|
||||
currentBeeHealth = (current * 100) / max;
|
||||
currentBeeColour = ((IAlleleBeeSpecies)bee.getGenome().getPrimary()).getIconColour(0);
|
||||
}
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int count)
|
||||
{
|
||||
ItemStack value = null;
|
||||
if (this.beeSlots[slot] != null)
|
||||
{
|
||||
value = this.beeSlots[slot].copy();
|
||||
value.stackSize = Math.min(count, this.beeSlots[slot].stackSize);
|
||||
this.beeSlots[slot].stackSize -= value.stackSize;
|
||||
if (this.beeSlots[slot].stackSize == 0)
|
||||
{
|
||||
this.beeSlots[slot] = null;
|
||||
}
|
||||
}
|
||||
markDirty();
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot)
|
||||
{
|
||||
ItemStack value = null;
|
||||
if (this.beeSlots[slot] != null)
|
||||
{
|
||||
value = this.beeSlots[slot];
|
||||
this.beeSlots[slot] = null;
|
||||
}
|
||||
markDirty();
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagRoot)
|
||||
{
|
||||
super.readFromNBT(tagRoot);
|
||||
|
||||
NBTTagList nbttaglist = tagRoot.getTagList("Items", Constants.NBT.TAG_COMPOUND);
|
||||
this.beeSlots = new ItemStack[SLOT_COUNT];
|
||||
|
||||
for (int i = 0; i < nbttaglist.tagCount(); ++i)
|
||||
{
|
||||
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
|
||||
byte b0 = nbttagcompound1.getByte("Slot");
|
||||
|
||||
if (b0 >= 0 && b0 < this.beeSlots.length)
|
||||
{
|
||||
this.beeSlots[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
this.currentBeeHealth = tagRoot.getInteger("currentBeeHealth");
|
||||
this.throttle = tagRoot.getInteger("throttle");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tagRoot)
|
||||
{
|
||||
super.writeToNBT(tagRoot);
|
||||
|
||||
NBTTagList inventory = new NBTTagList();
|
||||
for (int i = 0; i < this.beeSlots.length; ++i)
|
||||
{
|
||||
if (this.beeSlots[i] != null)
|
||||
{
|
||||
NBTTagCompound itemTag = new NBTTagCompound();
|
||||
itemTag.setByte("Slot", (byte)i);
|
||||
this.beeSlots[i].writeToNBT(itemTag);
|
||||
inventory.appendTag(itemTag);
|
||||
}
|
||||
}
|
||||
tagRoot.setTag("Items", inventory);
|
||||
tagRoot.setInteger("currentBeeHealth", this.currentBeeHealth);
|
||||
tagRoot.setInteger("throttle", this.throttle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack itemStack)
|
||||
{
|
||||
this.beeSlots[slot] = itemStack;
|
||||
if (this.beeSlots[slot] != null)
|
||||
{
|
||||
this.beeSlots[slot].stackSize = Math.min(this.beeSlots[slot].stackSize,
|
||||
this.beeSlots[slot].getItem().getItemStackLimit(this.beeSlots[slot]));
|
||||
}
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName()
|
||||
{
|
||||
return "container.effectJar";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit()
|
||||
{
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemStack)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() { }
|
||||
|
||||
@Override
|
||||
public void closeInventory() { }
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package magicbees.world;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.IWorldGenerator;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import magicbees.main.MagicBees;
|
||||
import magicbees.main.utils.ChunkCoords;
|
||||
import magicbees.world.feature.FeatureHive;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldType;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.world.ChunkDataEvent;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class WorldGeneratorHandler implements IWorldGenerator
|
||||
{
|
||||
public WorldTicker ticker;
|
||||
|
||||
public WorldGeneratorHandler()
|
||||
{
|
||||
this.ticker = new WorldTicker(this);
|
||||
FMLCommonHandler.instance().bus().register(ticker);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
|
||||
FeatureHive.initialize();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void chunkSaveEventHandler(ChunkDataEvent.Save event)
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
if (MagicBees.getConfig().DoHiveRetrogen)
|
||||
{
|
||||
tag.setBoolean("hiveRetrogen", true);
|
||||
}
|
||||
|
||||
event.getData().setTag("MagicBees", tag);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void chunkLoadEventHandler(ChunkDataEvent.Load event)
|
||||
{
|
||||
boolean doRetrogen = false;
|
||||
|
||||
NBTTagCompound tag = (NBTTagCompound)event.getData().getTag("MagicBees");
|
||||
if (tag == null)
|
||||
{
|
||||
doRetrogen = true;
|
||||
}
|
||||
else if (MagicBees.getConfig().DoHiveRetrogen)
|
||||
{
|
||||
if (!tag.hasKey("hiveRetrogen") || MagicBees.getConfig().ForceHiveRegen)
|
||||
{
|
||||
doRetrogen = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (doRetrogen)
|
||||
{
|
||||
ChunkCoords coords = new ChunkCoords(event.getChunk());
|
||||
ticker.queueChunkCoords(coords);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
|
||||
{
|
||||
generateWorld(world, random, chunkX, chunkZ, true);
|
||||
}
|
||||
|
||||
public void generateWorld(World world, Random random, int chunkX, int chunkZ, boolean initialGen)
|
||||
{
|
||||
boolean modified = false;
|
||||
|
||||
if (world.provider.terrainType != WorldType.FLAT)
|
||||
{
|
||||
if (initialGen || MagicBees.getConfig().DoHiveRetrogen)
|
||||
{
|
||||
FeatureHive.generateHives(world, random, chunkX, chunkZ, initialGen);
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!initialGen && modified)
|
||||
{
|
||||
world.getChunkFromChunkCoords(chunkX, chunkZ).setChunkModified();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package magicbees.world;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import magicbees.main.utils.ChunkCoords;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Random;
|
||||
|
||||
public class WorldTicker
|
||||
{
|
||||
private WorldGeneratorHandler parent;
|
||||
private HashMap<Integer, LinkedList<ChunkCoords>> chunkRegenList;
|
||||
|
||||
public WorldTicker(WorldGeneratorHandler p)
|
||||
{
|
||||
this.parent = p;
|
||||
this.chunkRegenList = new HashMap<Integer, LinkedList<ChunkCoords>>();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTick(TickEvent.WorldTickEvent event) {
|
||||
if(event.phase == TickEvent.Phase.END) {
|
||||
World world = event.world;
|
||||
int dimensionID = world.provider.dimensionId;
|
||||
LinkedList<ChunkCoords> chunkList = chunkRegenList.get(dimensionID);
|
||||
|
||||
if (chunkList != null && chunkList.peekFirst() != null)
|
||||
{
|
||||
ChunkCoords coords = chunkList.removeFirst();
|
||||
|
||||
// This bit is from FML's GameRegistry.generateWorld where the seed is constructed.
|
||||
long worldSeed = world.getSeed();
|
||||
Random random = new Random(worldSeed);
|
||||
long xSeed = random.nextLong() >> 2 + 1L;
|
||||
long zSeed = random.nextLong() >> 2 + 1L;
|
||||
random.setSeed((xSeed * coords.xCoord + zSeed * coords.zCoord) ^ worldSeed);
|
||||
|
||||
parent.generateWorld(world, random, coords.xCoord, coords.zCoord, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void queueChunkCoords(ChunkCoords coords)
|
||||
{
|
||||
if (!chunkRegenList.containsKey(coords.dimension))
|
||||
{
|
||||
chunkRegenList.put(coords.dimension, new LinkedList<ChunkCoords>());
|
||||
}
|
||||
chunkRegenList.get(coords.dimension).addLast(coords);
|
||||
}
|
||||
|
||||
public LinkedList<ChunkCoords> getChunksToGen(int dimensionId)
|
||||
{
|
||||
return chunkRegenList.get(dimensionId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,316 @@
|
||||
package magicbees.world.feature;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import magicbees.block.types.HiveType;
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.MagicBees;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class FeatureHive
|
||||
{
|
||||
private static FeatureOreVein redstoneGen;
|
||||
private static FeatureOreVein netherQuartzGen;
|
||||
private static FeatureOreVein glowstoneGen;
|
||||
private static FeatureOreVein endStoneGen;
|
||||
|
||||
private static boolean logSpawns = true;
|
||||
|
||||
public static void initialize()
|
||||
{
|
||||
redstoneGen = new FeatureOreVein(Blocks.redstone_ore, Blocks.stone);
|
||||
netherQuartzGen = new FeatureOreVein(Blocks.quartz_ore, Blocks.netherrack);
|
||||
glowstoneGen = new FeatureOreVein(Blocks.glowstone, Blocks.stone);
|
||||
endStoneGen = new FeatureOreVein(Blocks.end_stone, Blocks.stone);
|
||||
}
|
||||
|
||||
public static void generateHives(World world, Random random, int chunkX, int chunkZ, boolean initialGen)
|
||||
{
|
||||
for (HiveType type : HiveType.values())
|
||||
{
|
||||
type.generateHive(world, random, chunkX, chunkZ, initialGen);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean generateHiveCurious(World world, Random random, int coordX, int coordZ, boolean initialGen)
|
||||
{
|
||||
int coordY = getHeight(world, random, coordX, coordZ);
|
||||
boolean doSpawn = false;
|
||||
|
||||
Block b = world.getBlock(coordX, coordY + 1, coordZ);
|
||||
if (world.isAirBlock(coordX, coordY - 1, coordZ) &&
|
||||
world.isAirBlock(coordX, coordY, coordZ) &&
|
||||
b != null && b.isLeaves(world, coordX, coordY + 1, coordZ))
|
||||
{
|
||||
world.setBlock(coordX, coordY, coordZ, Config.hive, HiveType.CURIOUS.ordinal(), 3);
|
||||
if (logSpawns) FMLLog.info("Spawning %s hive at: X %d, Z %d, Y %d", "Curious", coordX, coordZ, coordY);
|
||||
doSpawn = true;
|
||||
}
|
||||
|
||||
return doSpawn;
|
||||
}
|
||||
|
||||
public static boolean generateHiveUnusual(World world, Random random, int coordX, int coordZ, boolean initialGen)
|
||||
{
|
||||
int coordY = getHeight(world, random, coordX, coordZ);
|
||||
|
||||
boolean doSpawn = false;
|
||||
if (world.isAirBlock(coordX, coordY + 1, coordZ) &&
|
||||
world.isAirBlock(coordX, coordY, coordZ) &&
|
||||
canBlockReplaceAt(world, coordX, coordY - 1, coordZ, Blocks.dirt))
|
||||
{
|
||||
doSpawn = true;
|
||||
}
|
||||
|
||||
if (doSpawn)
|
||||
{
|
||||
world.setBlock(coordX, coordY, coordZ, Config.hive, HiveType.UNUSUAL.ordinal(), 3);
|
||||
if (logSpawns) FMLLog.info("Spawning %s hive at: X %d, Z %d, Y %d", "Unusual", coordX, coordZ, coordY);
|
||||
}
|
||||
|
||||
return doSpawn;
|
||||
}
|
||||
|
||||
public static boolean generateHiveResonant(World world, Random random, int coordX, int coordZ, boolean initialGen)
|
||||
{
|
||||
int coordY = getHeight(world, random, coordX, coordZ);
|
||||
boolean doSpawn = false;
|
||||
if (world.rand.nextInt() < 40 && world.isAirBlock(coordX, coordY + 1, coordZ) &&
|
||||
(world.isAirBlock(coordX, coordY, coordZ) || canBlockReplaceAt(world, coordX, coordY, coordZ,
|
||||
Blocks.tallgrass)) &&
|
||||
(canBlockReplaceAt(world, coordX, coordY - 1, coordZ, Blocks.dirt) ||
|
||||
canBlockReplaceAt(world, coordX, coordY - 1, coordZ, Blocks.sand)))
|
||||
{
|
||||
doSpawn = true;
|
||||
}
|
||||
|
||||
if (doSpawn)
|
||||
{
|
||||
world.setBlock(coordX, coordY, coordZ, Config.hive, HiveType.RESONANT.ordinal(), 3);
|
||||
if (logSpawns) FMLLog.info("Spawning %s hive at: X %d, Z %d, Y %d", "Resonant", coordX, coordZ, coordY);
|
||||
}
|
||||
|
||||
return doSpawn;
|
||||
}
|
||||
|
||||
public static boolean generateHiveDeep(World world, Random random, int coordX, int coordZ, boolean initialGen)
|
||||
{
|
||||
|
||||
BiomeGenBase biome = world.getBiomeGenForCoords(coordX, coordZ);
|
||||
int coordY = 10 + random.nextInt(10);
|
||||
|
||||
boolean doSpawn = false;
|
||||
|
||||
if (random.nextInt(100) < 40 &&
|
||||
!world.isAirBlock(coordX, coordY, coordZ) && canBlockReplaceAt(world, coordX, coordY, coordZ,
|
||||
Blocks.stone))
|
||||
{
|
||||
doSpawn = getSurroundCount(world, coordX, coordY, coordZ, Blocks.stone) >= 6;
|
||||
}
|
||||
|
||||
if (doSpawn)
|
||||
{
|
||||
world.setBlock(coordX, coordY, coordZ, Config.hive, HiveType.DEEP.ordinal(), 3);
|
||||
if (logSpawns) FMLLog.info("Spawning %s hive at: X %d, Z %d, Y %d", "Deep", coordX, coordZ, coordY);
|
||||
|
||||
|
||||
redstoneGen.generateVein(world, random, coordX + 1, coordY, coordZ, 2);
|
||||
redstoneGen.generateVein(world, random, coordX - 1, coordY, coordZ, 2);
|
||||
redstoneGen.generateVein(world, random, coordX, coordY + 1, coordZ, 2);
|
||||
redstoneGen.generateVein(world, random, coordX, coordY - 1, coordZ, 2);
|
||||
redstoneGen.generateVein(world, random, coordX, coordY, coordZ + 1, 2);
|
||||
redstoneGen.generateVein(world, random, coordX, coordY, coordZ - 1, 2);
|
||||
}
|
||||
|
||||
return doSpawn;
|
||||
}
|
||||
|
||||
public static boolean generateHiveInfernal(World world, Random random, int coordX, int coordZ, boolean initialGen)
|
||||
{
|
||||
boolean doSpawn = false;
|
||||
if (!world.provider.isSurfaceWorld())
|
||||
{
|
||||
int chop = random.nextInt(2) + 1;
|
||||
int coordY = random.nextInt(60 / chop) + random.nextInt(chop) * (120 / chop) - 5;
|
||||
|
||||
if(world.isAirBlock(coordX, coordY, coordZ) && world.getBlock(coordX, coordY, coordZ) != null &&
|
||||
world.getBlock(coordX, coordY, coordZ).isReplaceableOreGen(world, coordX, coordY, coordZ,
|
||||
Blocks.netherrack))
|
||||
{
|
||||
doSpawn = getSurroundCount(world, coordX, coordY, coordZ, Blocks.netherrack) >= 5;
|
||||
}
|
||||
|
||||
if (doSpawn)
|
||||
{
|
||||
world.setBlock(coordX, coordY, coordZ, Config.hive, HiveType.INFERNAL.ordinal(), 3);
|
||||
if (logSpawns) FMLLog.info("Spawning %s hive at: X %d, Z %d, Y %d", "Infernal", coordX, coordZ, coordY);
|
||||
|
||||
netherQuartzGen.generateVein(world, random, coordX + 1, coordY, coordZ, 4);
|
||||
netherQuartzGen.generateVein(world, random, coordX - 1, coordY, coordZ, 4);
|
||||
netherQuartzGen.generateVein(world, random, coordX, coordY + 1, coordZ, 4);
|
||||
netherQuartzGen.generateVein(world, random, coordX, coordY - 1, coordZ, 4);
|
||||
netherQuartzGen.generateVein(world, random, coordX, coordY, coordZ + 1, 4);
|
||||
netherQuartzGen.generateVein(world, random, coordX, coordY, coordZ - 1, 4);
|
||||
}
|
||||
}
|
||||
else if (MagicBees.getConfig().DoSpecialHiveGen && world.rand.nextInt() < 11)
|
||||
{
|
||||
int coordY = random.nextInt(13) + 5;
|
||||
|
||||
if (!world.isAirBlock(coordX, coordY, coordZ) &&
|
||||
canBlockReplaceAt(world, coordX, coordY, coordZ, Blocks.stone))
|
||||
{
|
||||
|
||||
doSpawn = getSurroundCount(world, coordX, coordY, coordZ, Blocks.stone) >= 6;
|
||||
}
|
||||
|
||||
if (doSpawn)
|
||||
{
|
||||
world.setBlock(coordX, coordY, coordZ, Config.hive, HiveType.INFERNAL.ordinal(), 3);
|
||||
if (logSpawns) FMLLog.info("Spawning %s hive at: X %d, Z %d, Y %d", "Infernal", coordX, coordZ, coordY);
|
||||
|
||||
glowstoneGen.generateVein(world, random, coordX + 1, coordY, coordZ, world.rand.nextInt(4) + 1);
|
||||
glowstoneGen.generateVein(world, random, coordX - 1, coordY, coordZ, world.rand.nextInt(4) + 1);
|
||||
|
||||
if (canBlockReplaceAt(world, coordX, coordY + 1, coordZ, Blocks.stone) ||
|
||||
canBlockReplaceAt(world, coordX, coordY + 1, coordZ, Blocks.netherrack))
|
||||
{
|
||||
world.setBlock(coordX, coordY + 1, coordZ, Blocks.glowstone, 0, 3);
|
||||
}
|
||||
|
||||
if (canBlockReplaceAt(world, coordX, coordY - 1, coordZ, Blocks.stone) ||
|
||||
canBlockReplaceAt(world, coordX, coordY + 1, coordZ, Blocks.netherrack))
|
||||
{
|
||||
world.setBlock(coordX, coordY - 1, coordZ, Blocks.glowstone, 0, 3);
|
||||
}
|
||||
|
||||
glowstoneGen.generateVein(world, random, coordX, coordY, coordZ + 1, world.rand.nextInt(4) + 1);
|
||||
glowstoneGen.generateVein(world, random, coordX, coordY, coordZ - 1, world.rand.nextInt(4) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
return doSpawn;
|
||||
}
|
||||
|
||||
public static boolean generateHiveOblivion(World world, Random random, int coordX, int coordZ, boolean initialGen)
|
||||
{
|
||||
boolean doSpawn = false;
|
||||
if (!world.provider.isSurfaceWorld())
|
||||
{
|
||||
// 1 per gen
|
||||
int coordY = 10 + random.nextInt(25);
|
||||
|
||||
if (world.isAirBlock(coordX, coordY - 2, coordZ) &&
|
||||
canBlockReplaceAt(world, coordX, coordY - 1, coordZ, Blocks.end_stone) &&
|
||||
canBlockReplaceAt(world, coordX, coordY, coordZ, Blocks.end_stone))
|
||||
{
|
||||
doSpawn = true;
|
||||
}
|
||||
|
||||
if (doSpawn)
|
||||
{
|
||||
world.setBlock(coordX, coordY, coordZ, Config.hive, HiveType.OBLIVION.ordinal(), 3);
|
||||
if (logSpawns) FMLLog.info("Spawning %s hive at: X %d, Z %d, Y %d", "Oblivion", coordX, coordZ, coordY);
|
||||
|
||||
int obsidianSpikeHeight = random.nextInt(8) + 2;
|
||||
|
||||
for (int i = 1; i < obsidianSpikeHeight && coordY - i > 0; ++i)
|
||||
{
|
||||
world.setBlock(coordX, coordY - i, coordZ, Blocks.obsidian, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (MagicBees.getConfig().DoSpecialHiveGen && world.rand.nextInt() < 8)
|
||||
{
|
||||
// 1 per gen
|
||||
int coordY = random.nextInt(5) + 5;
|
||||
|
||||
do
|
||||
{
|
||||
--coordY;
|
||||
|
||||
if (!world.isAirBlock(coordX, coordY, coordZ) &&
|
||||
canBlockReplaceAt(world, coordX, coordY, coordZ, Blocks.stone) ||
|
||||
canBlockReplaceAt(world, coordX, coordY, coordZ, Blocks.end_stone))
|
||||
{
|
||||
doSpawn = getSurroundCount(world, coordX, coordY, coordZ, Blocks.end_stone) >= 5 ||
|
||||
getSurroundCount(world, coordX, coordY, coordZ, Blocks.stone) >= 5;
|
||||
}
|
||||
}
|
||||
while (!doSpawn && coordY > 5);
|
||||
|
||||
if (doSpawn)
|
||||
{
|
||||
world.setBlock(coordX, coordY, coordZ, Config.hive, HiveType.OBLIVION.ordinal(), 3);
|
||||
if (logSpawns) FMLLog.info("Spawning %s hive at: X %d, Z %d, Y %d", "Oblivion", coordX, coordZ, coordY);
|
||||
|
||||
endStoneGen.generateVein(world, random, coordX + 1, coordY, coordZ, world.rand.nextInt(6) + 1);
|
||||
endStoneGen.generateVein(world, random, coordX - 1, coordY, coordZ, world.rand.nextInt(6) + 1);
|
||||
endStoneGen.generateVein(world, random, coordX, coordY + 1, coordZ, world.rand.nextInt(3) + 1);
|
||||
endStoneGen.generateVein(world, random, coordX, coordY - 1, coordZ, world.rand.nextInt(3) + 1);
|
||||
endStoneGen.generateVein(world, random, coordX, coordY, coordZ + 1, world.rand.nextInt(6) + 1);
|
||||
endStoneGen.generateVein(world, random, coordX, coordY, coordZ - 1, world.rand.nextInt(6) + 1);
|
||||
}
|
||||
}
|
||||
return doSpawn;
|
||||
}
|
||||
|
||||
private static int getHeight(World world, Random random, int coordX, int coordZ)
|
||||
{
|
||||
BiomeGenBase biome = world.getBiomeGenForCoords(coordX, coordZ);
|
||||
int min = (int)(biome.rootHeight/*minHeight*/ * 64 + 62);
|
||||
int max = (int)(biome.heightVariation/*maxHeight*/ * 64);
|
||||
// sanity
|
||||
min = (min > 1) ? min : 1;
|
||||
max = (max > 10) ? max : 10;
|
||||
return min + random.nextInt(max);
|
||||
}
|
||||
|
||||
// Determines if surrounding material is "equivalent" to provided block using isGenMineableReplaceable.
|
||||
private static int getSurroundCount(World world, int x, int y, int z, Block blockType)
|
||||
{
|
||||
int surroundCount = 0;
|
||||
|
||||
if (canBlockReplaceAt(world, x+1, y, z, blockType))
|
||||
{
|
||||
++surroundCount;
|
||||
}
|
||||
|
||||
if (canBlockReplaceAt(world, x-1, y, z, blockType))
|
||||
{
|
||||
++surroundCount;
|
||||
}
|
||||
|
||||
if (canBlockReplaceAt(world, x, y+1, z, blockType))
|
||||
{
|
||||
++surroundCount;
|
||||
}
|
||||
|
||||
if (canBlockReplaceAt(world, x, y-1, z, blockType))
|
||||
{
|
||||
++surroundCount;
|
||||
}
|
||||
|
||||
if (canBlockReplaceAt(world, x, y, z+1, blockType))
|
||||
{
|
||||
++surroundCount;
|
||||
}
|
||||
|
||||
if (canBlockReplaceAt(world, x, y, z-1, blockType))
|
||||
{
|
||||
++surroundCount;
|
||||
}
|
||||
|
||||
return surroundCount;
|
||||
}
|
||||
|
||||
private static boolean canBlockReplaceAt(World world, int x, int y, int z, Block block)
|
||||
{
|
||||
return world.getBlock(x, y, z) != null &&
|
||||
world.getBlock(x, y, z).isReplaceableOreGen(world, x, y, z, block);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package magicbees.world.feature;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class FeatureOreVein
|
||||
{
|
||||
private Block veinBlock;
|
||||
private int veinBlockMeta;
|
||||
private Block replacesBlock;
|
||||
|
||||
public FeatureOreVein(Block block, Block replacesBlock)
|
||||
{
|
||||
this(block, 0, replacesBlock);
|
||||
}
|
||||
|
||||
public FeatureOreVein(Block block, int meta, Block replacesBlock)
|
||||
{
|
||||
this.veinBlock = block;
|
||||
this.veinBlockMeta = meta;
|
||||
this.replacesBlock = replacesBlock;
|
||||
}
|
||||
|
||||
public void generateVein(World world, Random random, int startX, int startY, int startZ, int maxSpawnCount)
|
||||
{
|
||||
int currentX = startX;
|
||||
int currentY = startY;
|
||||
int currentZ = startZ;
|
||||
int spawnAttempts = 0;
|
||||
int spawnCount = 0;
|
||||
|
||||
while (spawnCount < maxSpawnCount && spawnAttempts < maxSpawnCount * 2)
|
||||
{
|
||||
++spawnAttempts;
|
||||
|
||||
if (!world.isAirBlock(currentX, currentY, currentZ) && canBlockReplaceAt(world, currentX, currentY, currentZ, replacesBlock))
|
||||
{
|
||||
world.setBlock(currentX, currentY, currentZ, this.veinBlock, this.veinBlockMeta, 2);
|
||||
++spawnCount;
|
||||
}
|
||||
|
||||
switch (random.nextInt(6))
|
||||
{
|
||||
case 0:
|
||||
++currentY;
|
||||
break;
|
||||
case 1:
|
||||
--currentY;
|
||||
break;
|
||||
case 2:
|
||||
++currentZ;
|
||||
break;
|
||||
case 3:
|
||||
--currentZ;
|
||||
break;
|
||||
case 4:
|
||||
++currentX;
|
||||
break;
|
||||
case 5:
|
||||
--currentX;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean canBlockReplaceAt(World world, int x, int y, int z, Block block)
|
||||
{
|
||||
return world.getBlock(x, y, z) != null &&
|
||||
world.getBlock(x, y, z).isReplaceableOreGen(world, x, y, z, block);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user