mirror of
https://github.com/GTNewHorizons/MagicBees.git
synced 2026-11-12 08:17:29 +00:00
Updating Botania version.
Fixing bugs with the Hibeescus: -Mana bar not showing -Bee stack not dropping on flower break Fixing Forestry NEI plugin crash.
This commit is contained in:
1 parent
3d61472a7e
commit
aa2ef7f24d
6 files changed
+61
-28
No files matched your search
@@ -553,7 +553,7 @@ public class BeeMutation implements IBeeMutation {
|
||||
}
|
||||
else if (this.requiredBlockOreDictEntry != null) {
|
||||
ArrayList<ItemStack> ores = OreDictionary.getOres(this.requiredBlockOreDictEntry);
|
||||
if (ores.size() > 0) {
|
||||
if (ores != null && 0 < ores.size()) {
|
||||
conditions.add(String.format(LocalizationManager.getLocalizedString("research.requiresBlock"), ores.get(0).getDisplayName()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -472,7 +472,12 @@ public enum BeeSpecies implements IAlleleBeeSpecies, IIconProvider
|
||||
TC_ORDER.setInactive();
|
||||
|
||||
TC_VIS.setInactive();
|
||||
TC_REJUVENATING.setInactive();
|
||||
TC_EMPOWERING.setInactive();
|
||||
TC_NEXUS.setInactive();
|
||||
TC_TAINT.setInactive();
|
||||
TC_PURE.setInactive();
|
||||
TC_HUNGRY.setInactive();
|
||||
|
||||
TC_BRAINY.setInactive();
|
||||
TC_BATTY.setInactive();
|
||||
@@ -482,10 +487,6 @@ public enum BeeSpecies implements IAlleleBeeSpecies, IIconProvider
|
||||
|
||||
TC_WISPY.setInactive();
|
||||
}
|
||||
// These species should be fixed. ¯\_(ツ)_/¯
|
||||
TC_TAINT.setInactive();
|
||||
TC_EMPOWERING.setInactive();
|
||||
//TC_REJUVENATING.setInactive();
|
||||
|
||||
BeeProductHelper.initEquivalentExchange3Species();
|
||||
if (!EquivalentExchangeHelper.isActive()) {
|
||||
|
||||
@@ -33,6 +33,7 @@ public class SpeciesRecipeManaInfusion extends RecipeManaInfusion {
|
||||
IBee bee = BeeManager.beeRoot.getMember(stack);
|
||||
if (bee.getGenome().getPrimary().equals(inputSpecies)) {
|
||||
outputCache = ForestryHelper.replaceSpecies(stack, outputSpecies);
|
||||
outputCache.stackSize = 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,10 +9,12 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.bees.BeeManager;
|
||||
import magicbees.main.utils.compat.BotaniaHelper;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.subtile.SubTileFunctional;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
@@ -24,10 +26,16 @@ public class SubTileHibeescus extends SubTileFunctional {
|
||||
private final int MANA_PER_OPERATION = 10000;
|
||||
// Ticks per second * seconds per minute * real-time minutes
|
||||
private final int OPERATION_TICKS_TIME = 20 * 60 * 15;
|
||||
private final int RANGE = 1;
|
||||
private final double RANGE = 0.75;
|
||||
|
||||
private ItemStack beeSlot;
|
||||
private long operationTicksRemaining;
|
||||
private float manaCostRollover;
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return 0xF94F4F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
@@ -36,19 +44,29 @@ public class SubTileHibeescus extends SubTileFunctional {
|
||||
return;
|
||||
}
|
||||
|
||||
if (beeSlot != null && this.mana >= MANA_PER_OPERATION) {
|
||||
if (beeSlot != null) {
|
||||
progressOperation();
|
||||
}
|
||||
else if (beeSlot == null && this.supertile.getWorldObj().getTotalWorldTime() % 10 == 0 && redstoneSignal == 0) {
|
||||
else if (beeSlot == null && isTimeToPickUpItem() && redstoneSignal == 0) {
|
||||
findBeeItemToHold();
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isTimeToPickUpItem() {
|
||||
return (this.supertile.getWorldObj().getTotalWorldTime() ^ supertile.xCoord ^ supertile.zCoord) % 11 == 0;
|
||||
}
|
||||
|
||||
private void progressOperation() {
|
||||
operationTicksRemaining--;
|
||||
|
||||
if (operationTicksRemaining <= 0) {
|
||||
mana -= MANA_PER_OPERATION;
|
||||
if (0 < operationTicksRemaining && 0 < this.mana) {
|
||||
operationTicksRemaining--;
|
||||
manaCostRollover += getManaPerOpTick();
|
||||
if (1f <= manaCostRollover) {
|
||||
int amount = (int)manaCostRollover;
|
||||
mana -= amount;
|
||||
manaCostRollover -= amount;
|
||||
}
|
||||
}
|
||||
else if (operationTicksRemaining <= 0) {
|
||||
IBee bee = BeeManager.beeRoot.getMember(beeSlot);
|
||||
bee.setIsNatural(true);
|
||||
EnumBeeType beeType = EnumBeeType.QUEEN;
|
||||
@@ -56,18 +74,23 @@ public class SubTileHibeescus extends SubTileFunctional {
|
||||
beeType = EnumBeeType.PRINCESS;
|
||||
}
|
||||
ItemStack outputStack = BeeManager.beeRoot.getMemberStack(bee, beeType.ordinal());
|
||||
Random r = supertile.getWorldObj().rand;
|
||||
EntityItem entity = new EntityItem(supertile.getWorldObj(),
|
||||
supertile.xCoord - RANGE + r.nextInt(RANGE * 2 + 1), supertile.yCoord + 1, supertile.zCoord - RANGE + r.nextInt(RANGE * 2 + 1),
|
||||
outputStack);
|
||||
entity.motionX = 0;
|
||||
entity.motionY = 0;
|
||||
entity.motionZ = 0;
|
||||
EntityItem entity = dropItemStackInRange(outputStack);
|
||||
|
||||
supertile.getWorldObj().spawnEntityInWorld(entity);
|
||||
beeSlot = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected EntityItem dropItemStackInRange(ItemStack outputStack) {
|
||||
Random r = supertile.getWorldObj().rand;
|
||||
EntityItem entity = new EntityItem(supertile.getWorldObj(),
|
||||
supertile.xCoord - RANGE + r.nextInt((int)(RANGE * 2 + 1)), supertile.yCoord + 1, supertile.zCoord - RANGE + r.nextInt((int)(RANGE * 2 + 1)),
|
||||
outputStack);
|
||||
entity.motionX = 0;
|
||||
entity.motionY = 0;
|
||||
entity.motionZ = 0;
|
||||
return entity;
|
||||
}
|
||||
|
||||
private void findBeeItemToHold() {
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -76,12 +99,10 @@ public class SubTileHibeescus extends SubTileFunctional {
|
||||
for (EntityItem itemEntity : items) {
|
||||
ItemStack item = itemEntity.getEntityItem();
|
||||
if (!itemEntity.isDead && isItemPrincessOrQueen(item)) {
|
||||
beeSlot = itemEntity.getEntityItem();
|
||||
itemEntity.setDead();
|
||||
operationTicksRemaining = (long)(OPERATION_TICKS_TIME * BotaniaHelper.hibeescusTicksMultiplier);
|
||||
if (operationTicksRemaining > 0) {
|
||||
operationTicksRemaining += supertile.getWorldObj().rand.nextInt((int)(operationTicksRemaining * 0.02));
|
||||
}
|
||||
beeSlot = itemEntity.getEntityItem().copy();
|
||||
beeSlot.stackSize = 1;
|
||||
operationTicksRemaining = (long)(OPERATION_TICKS_TIME * BotaniaHelper.hibeescusTicksMultiplier) + supertile.getWorldObj().rand.nextInt(200);
|
||||
manaCostRollover = 0f;
|
||||
|
||||
// Princesses and Queens don't stack, but YOU NEVER KNOW.
|
||||
item.stackSize -= 1;
|
||||
@@ -94,7 +115,7 @@ public class SubTileHibeescus extends SubTileFunctional {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean isItemPrincessOrQueen(ItemStack stack) {
|
||||
boolean isBee = BeeManager.beeRoot.isMember(stack, EnumBeeType.PRINCESS.ordinal())
|
||||
|| BeeManager.beeRoot.isMember(stack, EnumBeeType.QUEEN.ordinal());
|
||||
@@ -121,6 +142,7 @@ public class SubTileHibeescus extends SubTileFunctional {
|
||||
beeSlot = ItemStack.loadItemStackFromNBT(itemTag);
|
||||
}
|
||||
operationTicksRemaining = cmp.getLong("operationTicks");
|
||||
manaCostRollover = cmp.getFloat("manaRollover");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -132,6 +154,7 @@ public class SubTileHibeescus extends SubTileFunctional {
|
||||
cmp.setTag("slot", itemTag);
|
||||
}
|
||||
cmp.setLong("operationTicks", operationTicksRemaining);
|
||||
cmp.setFloat("manaRollover", manaCostRollover);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -144,8 +167,16 @@ public class SubTileHibeescus extends SubTileFunctional {
|
||||
|
||||
@Override
|
||||
public int getMaxMana() {
|
||||
return getFinalOperationManaCost() / 20;
|
||||
}
|
||||
|
||||
protected int getFinalOperationManaCost() {
|
||||
return (int)(MANA_PER_OPERATION * BotaniaHelper.hibeescusManaCostMultiplier);
|
||||
}
|
||||
|
||||
protected float getManaPerOpTick() {
|
||||
return getFinalOperationManaCost() / OPERATION_TICKS_TIME;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
Reference in new issue
Block a user