mirror of
https://github.com/GTNewHorizons/MagicBees.git
synced 2026-11-22 21:20:02 +00:00
Update for Forestry 4.0
This commit is contained in:
1 parent
2503c94b83
commit
f1086f3095
24 files changed
+778
-983
No files matched your search
@@ -9,10 +9,10 @@ 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;
|
||||
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IHiveFrame;
|
||||
|
||||
public class ItemMagicHiveFrame extends Item implements IHiveFrame
|
||||
@@ -39,91 +39,26 @@ public class ItemMagicHiveFrame extends Item implements IHiveFrame
|
||||
// --------- 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())
|
||||
{
|
||||
public ItemStack frameUsed(IBeeHousing housing, ItemStack frame, IBee queen, int wear) {
|
||||
frame.setItemDamage(frame.getItemDamage() + wear);
|
||||
|
||||
if (frame.getItemDamage() >= frame.getMaxDamage()) {
|
||||
// Break the frame.
|
||||
frame = null;
|
||||
}
|
||||
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeeModifier getBeeModifier() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
package magicbees.item.types;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
|
||||
public enum HiveFrameType
|
||||
public enum HiveFrameType implements IBeeModifier
|
||||
{
|
||||
MAGIC("Magic", 240, 1f, 1f, 1f, 2f, 0.6f),
|
||||
RESILIENT("Resilient", 800, 1f, 1f, 1f, 2f, 0.5f),
|
||||
@@ -12,14 +15,26 @@ public enum HiveFrameType
|
||||
TEMPORAL("Temporal", 300, 1f, 1f, 2.5f, 1f, 0.8f),
|
||||
OBLIVION("Oblivion", 50, 1f, 1f, 0.0001f, 0f, 1f),
|
||||
;
|
||||
|
||||
private final String frameName;
|
||||
public final int maxDamage;
|
||||
|
||||
private final float territoryMod;
|
||||
private final float mutationMod;
|
||||
private final float lifespanMod;
|
||||
private final float productionMod;
|
||||
private final float floweringMod;
|
||||
private final float geneticDecayMod;
|
||||
private final boolean isSealed;
|
||||
private final boolean isLit;
|
||||
private final boolean isSunlit;
|
||||
private final boolean isHellish;
|
||||
|
||||
private HiveFrameType(String name, int damage,
|
||||
float territory, float mutation, float lifespan, float production, float geneticDecay)
|
||||
{
|
||||
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,
|
||||
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)
|
||||
{
|
||||
@@ -37,21 +52,7 @@ public enum HiveFrameType
|
||||
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;
|
||||
@@ -61,4 +62,54 @@ public enum HiveFrameType
|
||||
{
|
||||
return LocalizationManager.getLocalizedString("frame." + this.frameName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTerritoryModifier(IBeeGenome genome, float currentModifier) {
|
||||
return territoryMod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) {
|
||||
return mutationMod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) {
|
||||
return lifespanMod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getProductionModifier(IBeeGenome genome, float currentModifier) {
|
||||
return productionMod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFloweringModifier(IBeeGenome genome, float currentModifier) {
|
||||
return floweringMod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getGeneticDecay(IBeeGenome genome, float currentModifier) {
|
||||
return geneticDecayMod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSealed() {
|
||||
return isSealed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelfLighted() {
|
||||
return isLit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSunlightSimulated() {
|
||||
return isSunlit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHellish() {
|
||||
return isHellish;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user