mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-15 01:24:59 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7a68e04053 | ||
|
|
3c37a81617 | ||
|
|
a9cc367623 | ||
|
|
7757790b84 | ||
|
|
bcdbec5b89 | ||
|
|
3fcb927201 | ||
|
|
b374f0b23c |
No files matched your search
@@ -2,4 +2,4 @@ mcversion=1.7.10
|
||||
forgeversion=10.13.3.1370-1.7.10
|
||||
version_major=3
|
||||
version_minor=6
|
||||
version_patch=1
|
||||
version_patch=4
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
|
||||
@@ -36,7 +37,7 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
|
||||
private static final int MAX_POLLINATION_ATTEMPTS = 20;
|
||||
private static final int totalBreedingTime = Defaults.APIARY_BREEDING_TIME;
|
||||
private static final int ticksPerCheckCanWork = 10;
|
||||
private static final int ticksPerCheckQueenCanWork = 10;
|
||||
|
||||
private final IBeeHousing housing;
|
||||
private final boolean housingSupportsMultipleErrorStates;
|
||||
@@ -53,8 +54,8 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
// Cached flowers check
|
||||
private boolean hasFlowersCached = false;
|
||||
private int hasFlowersCooldown = 0;
|
||||
private boolean canWorkCached = false;
|
||||
private int canWorkCooldown = 0;
|
||||
private Set<IErrorState> queenCanWorkCached = Collections.emptySet();
|
||||
private int queenCanWorkCooldown = 0;
|
||||
|
||||
public BeekeepingLogic(IBeeHousing housing) {
|
||||
this.housing = housing;
|
||||
@@ -128,16 +129,6 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
|
||||
@Override
|
||||
public boolean canWork() {
|
||||
if (canWorkCooldown > 0) {
|
||||
canWorkCooldown--;
|
||||
} else {
|
||||
canWorkCached = checkCanWork();
|
||||
canWorkCooldown = ticksPerCheckCanWork;
|
||||
}
|
||||
return canWorkCached;
|
||||
}
|
||||
|
||||
private boolean checkCanWork() {
|
||||
if (housingSupportsMultipleErrorStates) {
|
||||
Set<IErrorState> errorStates = housing.getErrorStates();
|
||||
for (IErrorState errorState : errorStates) {
|
||||
@@ -183,7 +174,7 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
|
||||
if (hasFlowersCooldown <= 0) {
|
||||
hasFlowersCached = queen.hasFlower(housing);
|
||||
hasFlowersCooldown = PluginApiculture.ticksPerBeeWorkCycle / ticksPerCheckCanWork;
|
||||
hasFlowersCooldown = PluginApiculture.ticksPerBeeWorkCycle;
|
||||
|
||||
// check more often if we haven't found flowers
|
||||
if (!hasFlowersCached) {
|
||||
@@ -318,7 +309,7 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
|
||||
ItemStack queenStack = housing.getQueen();
|
||||
|
||||
if (queenStack == null || !ForestryItem.beeQueenGE.isItemEqual(housing.getQueen())) {
|
||||
if (queenStack == null || !ForestryItem.beeQueenGE.isItemEqual(queenStack)) {
|
||||
housingErrorState = EnumErrorCode.NOQUEEN;
|
||||
hasQueen = false;
|
||||
queen = null;
|
||||
@@ -367,30 +358,46 @@ public class BeekeepingLogic implements IBeekeepingLogic {
|
||||
}
|
||||
|
||||
private boolean queenCanWork() {
|
||||
if (queen == null) {
|
||||
return false;
|
||||
if (queenCanWorkCooldown > 0) {
|
||||
queenCanWorkCooldown--;
|
||||
} else {
|
||||
if (queen == null) {
|
||||
return false;
|
||||
}
|
||||
queenCanWorkCached = checkQueenCanWork();
|
||||
queenCanWorkCooldown = ticksPerCheckQueenCanWork;
|
||||
}
|
||||
|
||||
if (housingSupportsMultipleErrorStates) {
|
||||
try {
|
||||
Set<IErrorState> errorStates = queen.getCanWork(housing);
|
||||
Set<IErrorState> errorStates = queenCanWorkCached;
|
||||
|
||||
if (errorStates.size() > 0) {
|
||||
if (housingSupportsMultipleErrorStates) {
|
||||
for (IErrorState errorState : errorStates) {
|
||||
housing.setErrorCondition(true, errorState);
|
||||
}
|
||||
|
||||
return (errorStates.size() == 0);
|
||||
} catch (Throwable ignored) {
|
||||
// queen might not support getCanWork(housing)
|
||||
} else {
|
||||
IErrorState state = errorStates.iterator().next();
|
||||
housing.setErrorState(state);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private Set<IErrorState> checkQueenCanWork() {
|
||||
try {
|
||||
return queen.getCanWork(housing);
|
||||
} catch (Throwable ignored) {
|
||||
// queen might not support getCanWork
|
||||
}
|
||||
|
||||
IErrorState state = queen.canWork(housing);
|
||||
if (state != EnumErrorCode.OK) {
|
||||
housing.setErrorState(state);
|
||||
return false;
|
||||
return Collections.singleton(state);
|
||||
}
|
||||
|
||||
return true;
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
// / BREEDING
|
||||
|
||||
@@ -141,10 +141,12 @@ public abstract class TileAlvearyClimatiser extends TileAlveary implements IEner
|
||||
|
||||
this.active = active;
|
||||
|
||||
if (worldObj.isRemote) {
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
} else {
|
||||
Proxies.net.sendNetworkPacket(new PacketActiveUpdate(this));
|
||||
if (worldObj != null) {
|
||||
if (worldObj.isRemote) {
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
} else {
|
||||
Proxies.net.sendNetworkPacket(new PacketActiveUpdate(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IB
|
||||
}
|
||||
this.active = active;
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
if (worldObj != null && !worldObj.isRemote) {
|
||||
Proxies.net.sendNetworkPacket(new PacketActiveUpdate(this));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ public class TileAlvearySwarmer extends TileAlveary implements ISidedInventory,
|
||||
|
||||
this.active = active;
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
if (worldObj != null && !worldObj.isRemote) {
|
||||
Proxies.net.sendNetworkPacket(new PacketActiveUpdate(this));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -456,7 +456,7 @@ public class TileBeehouse extends TileBase implements IBeeHousing, IClimatised,
|
||||
}
|
||||
this.active = active;
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
if (worldObj != null && !worldObj.isRemote) {
|
||||
Proxies.net.sendNetworkPacket(new PacketActiveUpdate(this));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,6 +77,10 @@ public class BeeGenome extends Genome implements IBeeGenome {
|
||||
|
||||
// NBT RETRIEVAL
|
||||
public static IAlleleBeeSpecies getSpecies(ItemStack itemStack) {
|
||||
if (!BeeManager.beeRoot.isMember(itemStack)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
IAlleleSpecies species = getSpeciesDirectly(itemStack);
|
||||
if (species instanceof IAlleleBeeSpecies) {
|
||||
return (IAlleleBeeSpecies) species;
|
||||
|
||||
@@ -46,6 +46,10 @@ public class TreeGenome extends Genome implements ITreeGenome {
|
||||
|
||||
// NBT RETRIEVAL
|
||||
public static IAlleleTreeSpecies getSpecies(ItemStack itemStack) {
|
||||
if (!PluginArboriculture.treeInterface.isMember(itemStack)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
IAlleleSpecies species = getSpeciesDirectly(itemStack);
|
||||
if (species instanceof IAlleleTreeSpecies) {
|
||||
return (IAlleleTreeSpecies) species;
|
||||
|
||||
@@ -172,7 +172,7 @@ public abstract class Engine extends TileBase implements IEnergyConnection, IAct
|
||||
}
|
||||
this.active = active;
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
if (worldObj != null && !worldObj.isRemote) {
|
||||
Proxies.net.sendNetworkPacket(new PacketActiveUpdate(this));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public class MachineCarpenter extends TilePowered implements ISidedInventory, IL
|
||||
craftPreviewInventory = new InventoryCraftResult();
|
||||
setInternalInventory(new CarpenterInventoryAdapter(this));
|
||||
|
||||
InvTools.configureSided(getInternalInventory(), Defaults.FACINGS, SLOT_BOX, 20);
|
||||
InvTools.configureSided(getInternalInventory(), Defaults.FACINGS, SLOT_BOX, 21);
|
||||
|
||||
tankManager = new TankManager(resourceTank);
|
||||
}
|
||||
|
||||
@@ -43,6 +43,10 @@ public class ButterflyGenome extends Genome implements IButterflyGenome {
|
||||
|
||||
// NBT RETRIEVAL
|
||||
public static IAlleleButterflySpecies getSpecies(ItemStack itemStack) {
|
||||
if (!PluginLepidopterology.butterflyInterface.isMember(itemStack)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
IAlleleSpecies species = getSpeciesDirectly(itemStack);
|
||||
if (species instanceof IAlleleButterflySpecies) {
|
||||
return (IAlleleButterflySpecies) species;
|
||||
|
||||
@@ -297,6 +297,8 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
createAlleles();
|
||||
BeeDefinition.initBees();
|
||||
|
||||
AlleleManager.alleleRegistry.registerDeprecatedAlleleReplacement("forestry.speciesArgrarian", BeeDefinition.AGRARIAN.getGenome().getPrimary());
|
||||
|
||||
// Hives
|
||||
createHives();
|
||||
registerBeehiveDrops();
|
||||
|
||||
Reference in new issue
Block a user