Compare commits

..
Author SHA1 Message Date
Martin Robertz fd50df3abd update deps 2024-01-27 17:49:14 +01:00
Martin Robertz 421f07203e Merge remote-tracking branch 'Quantumlyy/bring-closer-to-forestry' into dev 2024-01-27 17:46:32 +01:00
Martin Robertz 8b41b92359 Revert "Add GT version checks to avoid crash with GT6"
This reverts commit 0c4239c954.
2024-01-27 17:46:16 +01:00
Martin Robertz fd531035ab update deps 2024-01-27 10:48:11 +01:00
kappa_maintainer 0c4239c954 Add GT version checks to avoid crash with GT6 2024-01-27 12:56:31 +08:00
Martin Robertz 075caff6c2 update bs+deps 2024-01-22 18:25:11 +01:00
Martin Robertz dca553a13d Merge remote-tracking branch 'Quantumlyy/bring-closer-to-forestry' into dev
# Conflicts:
#	build.gradle
#	dependencies.gradle
2024-01-22 18:24:31 +01:00
Martin Robertz 96b526e982 update bs+deps 2024-01-12 19:06:20 +01:00
Martin Robertz d738730898 Merge remote-tracking branch 'origin/dev' into dev
# Conflicts:
#	build.gradle
#	dependencies.gradle
2024-01-12 19:04:55 +01:00
5 changed files with 51 additions and 32 deletions

No files matched your search

+1 -2
View File
@@ -8,7 +8,6 @@ dependencies {
compileOnly('com.github.GTNewHorizons:Baubles:1.0.4:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:Botania:1.10.5-GTNH:api') {transitive = false}
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.53:dev')
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.6.2-GTNH:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.50:dev')
}
@@ -61,8 +61,9 @@ public class MagicApiaryInventory implements IApiaryInventory {
if (all) {
return countAdded == product.stackSize;
} else {
return countAdded > 0;
}
return countAdded > 0;
}
public int getSizeInventory() {
@@ -75,6 +76,7 @@ public class MagicApiaryInventory implements IApiaryInventory {
public void setInventorySlotContents(int i, ItemStack itemStack) {
items[i] = itemStack;
if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()) {
itemStack.stackSize = getInventoryStackLimit();
}
@@ -83,12 +85,13 @@ public class MagicApiaryInventory implements IApiaryInventory {
public int[] getAccessibleSlotsFromSide(int side) {
if (side == 0 || side == 1) {
return new int[] { SLOT_QUEEN, SLOT_DRONE };
} else {
int[] slots = new int[SLOT_PRODUCTS_COUNT];
for (int i = 0, slot = SLOT_PRODUCTS_START; i < SLOT_PRODUCTS_COUNT; ++i, ++slot) {
slots[i] = slot;
}
return slots;
}
int[] slots = new int[SLOT_PRODUCTS_COUNT];
for (int i = 0, slot = SLOT_PRODUCTS_START; i < SLOT_PRODUCTS_COUNT; ++i, ++slot) {
slots[i] = slot;
}
return slots;
}
public boolean canInsertItem(int slot, ItemStack itemStack, int side) {
@@ -110,6 +113,7 @@ public class MagicApiaryInventory implements IApiaryInventory {
public Collection<IHiveFrame> getFrames() {
Collection<IHiveFrame> hiveFrames = new ArrayList<IHiveFrame>(SLOT_FRAME_COUNT);
for (int i = SLOT_FRAME_START; i < SLOT_FRAME_START + SLOT_FRAME_COUNT; i++) {
ItemStack stackInSlot = magicApiary.getStackInSlot(i);
if (stackInSlot == null) {
@@ -121,34 +125,42 @@ public class MagicApiaryInventory implements IApiaryInventory {
hiveFrames.add((IHiveFrame) itemInSlot);
}
}
return hiveFrames;
}
public void wearOutFrames(IBeeHousing beeHousing, int amount) {
IBeekeepingMode beekeepingMode = BeeManager.beeRoot.getBeekeepingMode(magicApiary.getWorldObj());
int wear = Math.round(amount * beekeepingMode.getWearModifier());
for (int i = MagicApiaryInventory.SLOT_FRAME_START; i
< MagicApiaryInventory.SLOT_FRAME_START + MagicApiaryInventory.SLOT_FRAME_COUNT; i++) {
ItemStack hiveFrameStack = magicApiary.getStackInSlot(i);
if (hiveFrameStack == null) {
continue;
}
Item hiveFrameItem = hiveFrameStack.getItem();
if (!(hiveFrameItem instanceof IHiveFrame)) {
continue;
}
IHiveFrame hiveFrame = (IHiveFrame) hiveFrameItem;
ItemStack queenStack = magicApiary.getBeeInventory().getQueen();
IBee queen = BeeManager.beeRoot.getMember(queenStack);
ItemStack usedFrame = hiveFrame.frameUsed(magicApiary, hiveFrameStack, queen, wear);
magicApiary.setInventorySlotContents(i, usedFrame);
}
}
public void writeToNBT(NBTTagCompound compound) {
NBTTagList itemsNBT = new NBTTagList();
for (int i = 0; i < items.length; i++) {
ItemStack itemStack = items[i];
if (itemStack != null) {
NBTTagCompound item = new NBTTagCompound();
item.setByte("Slot", (byte) i);
@@ -161,9 +173,11 @@ public class MagicApiaryInventory implements IApiaryInventory {
public void readFromNBT(NBTTagCompound compound) {
NBTTagList items = compound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
for (int i = 0; i < items.tagCount(); i++) {
NBTTagCompound item = items.getCompoundTagAt(i);
int slot = item.getByte("Slot");
if (slot >= 0 && slot < getSizeInventory()) {
setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(item));
}
@@ -51,7 +51,7 @@ public class BlockApimancersDrainer extends BlockContainer {
return false;
} else {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileEntityApimancersDrainerCommon && side != 1) {
if (tile instanceof TileEntityApimancersDrainerCommon && side != 0) {
ItemStack tItemStack = player.getHeldItem();
if (tItemStack != null) {
Item tItem = tItemStack.getItem();
@@ -71,8 +71,9 @@ public class BlockApimancersDrainer extends BlockContainer {
}
world.markBlockForUpdate(x, y, z);
return true;
} else {
return false;
}
return false;
}
}
@@ -86,6 +87,7 @@ public class BlockApimancersDrainer extends BlockContainer {
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister register) {
icons = new IIcon[4];
for (int i = 0; i < icons.length; i++) {
icons[i] = register.registerIcon(CommonProxy.DOMAIN + ":apimancersdrainer." + i);
}
@@ -7,7 +7,6 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.common.Optional;
import forestry.api.apiculture.EnumBeeType;
import forestry.api.apiculture.IAlleleBeeSpecies;
import forestry.api.apiculture.IBee;
@@ -23,12 +22,8 @@ import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.aspects.IAspectContainer;
import thaumcraft.api.aspects.IEssentiaTransport;
import thaumicenergistics.api.storage.IAspectStorage;
@Optional.InterfaceList({
@Optional.Interface(iface = "thaumicenergistics.api.storage.IAspectStorage", modid = "thaumicenergistics") })
public class TileEntityApimancersDrainerCommon extends TileEntity
implements IEssentiaTransport, IAspectContainer, IAspectStorage {
public class TileEntityApimancersDrainerCommon extends TileEntity implements IAspectContainer, IEssentiaTransport {
public Aspect aspect;
public AspectList essentia = new AspectList();
@@ -43,7 +38,6 @@ public class TileEntityApimancersDrainerCommon extends TileEntity
@Override
public void updateEntity() {
super.updateEntity();
// If there's no stored aspect we shouldn't even check for the above block.
// We also don't need to run all the logic if the cabinet is full.
if (aspect == null || essentia.visSize() == maxAmount) return;
@@ -57,16 +51,21 @@ public class TileEntityApimancersDrainerCommon extends TileEntity
// This performs all the checks to see if the bee is a living queen and if the species conditions
// are met.
if (!canWork(beeHousing, above)) return;
// The beeRoot.isMember call will treat null the same as EnumBeeType.NONE which leads getSpecies to
// return null.
ItemStack queenStack = getQueen(beeHousing, above);
IAlleleBeeSpecies queenSpecies = BeeGenome.getSpecies(queenStack);
if (queenSpecies == null) return;
if (BeeManager.beeRoot.getType(queenStack) != EnumBeeType.QUEEN) return;
if (Objects.equals(queenSpecies.getUID(), BeeSpecies.TC_ESSENTIA.getSpecies().getUID())) {
IBeeModifier modifier = BeeManager.beeRoot.createBeeHousingModifier(beeHousing);
IBee queen = BeeManager.beeRoot.getMember(queenStack);
int amount = Config.drainerAmount * getProductionMultiplier(modifier, queen, above);
addToContainer(aspect, amount);
drainQueen(beeHousing, modifier, queen);
}
@@ -94,30 +93,20 @@ public class TileEntityApimancersDrainerCommon extends TileEntity
IBeeGenome queenGenome = queen.getGenome();
float productionMultiplier = modifier.getProductionModifier(queenGenome, 1.0F);
float minimum = Math.max(productionMultiplier, 1.0F);
return (int) Math.ceil(minimum);
}
private void drainQueen(IBeeHousing housing, IBeeModifier modifier, IBee queen) {
float lifespanModifier = modifier.getLifespanModifier(queen.getGenome(), queen.getMate(), 1.0f);
queen.age(housing.getWorld(), lifespanModifier);
// Write the changed queen back into the item stack.
NBTTagCompound nbttagcompound = new NBTTagCompound();
queen.writeToNBT(nbttagcompound);
housing.getBeeInventory().getQueen().setTagCompound(nbttagcompound);
}
@Override
@Optional.Method(modid = "thaumicenergistics")
public int getContainerCapacity() {
return maxAmount;
}
@Override
@Optional.Method(modid = "thaumicenergistics")
public boolean doesShareCapacity() {
return true;
}
@Override
public AspectList getAspects() {
return this.essentia;
@@ -136,11 +125,13 @@ public class TileEntityApimancersDrainerCommon extends TileEntity
@Override
public int addToContainer(Aspect tag, int am) {
int toAdd = Math.min(maxAmount - essentia.visSize(), am);
if (aspect.equals(tag) && toAdd > 0) {
essentia.add(aspect, toAdd);
markDirty();
return am - toAdd;
}
markDirty();
return am;
}
@@ -220,11 +211,14 @@ public class TileEntityApimancersDrainerCommon extends TileEntity
int total = this.essentia.getAmount(aspect);
this.essentia.reduce(aspect, total);
return total;
} else {
this.essentia.reduce(aspect, amount);
return amount;
}
this.essentia.reduce(aspect, amount);
return amount;
} else {
return 0;
}
return 0;
}
@Override
@@ -280,6 +274,7 @@ public class TileEntityApimancersDrainerCommon extends TileEntity
@Override
public void readFromNBT(NBTTagCompound compound) {
super.readFromNBT(compound);
this.essentia.readFromNBT(compound);
if (this.essentia.visSize() > this.maxAmount) {
this.essentia = new AspectList();
@@ -40,10 +40,13 @@ public class TileEntityApimancersDrainerGT extends TileEntityApimancersDrainerCo
protected IBeeHousing beeHousing(TileEntity above) {
IBeeHousing regularCheck = super.beeHousing(above);
if (regularCheck != null) return regularCheck;
BaseMetaTileEntity GTMetaTileEntity = getGTTileEntity(above);
if (GTMetaTileEntity != null) {
IMetaTileEntity underlyingMetaTileEntity = GTMetaTileEntity.getMetaTileEntity();
if (!(underlyingMetaTileEntity instanceof GT_MetaTileEntity_IndustrialApiary)) return null;
return (IBeeHousing) underlyingMetaTileEntity;
}
@@ -53,6 +56,7 @@ public class TileEntityApimancersDrainerGT extends TileEntityApimancersDrainerCo
@Override
protected boolean canWork(IBeeHousing beeHousing, TileEntity te) {
BaseMetaTileEntity GTMetaTileEntity = getGTTileEntity(te);
return GTMetaTileEntity != null ? GTMetaTileEntity.isActive() : super.canWork(beeHousing, te);
}
@@ -60,6 +64,7 @@ public class TileEntityApimancersDrainerGT extends TileEntityApimancersDrainerCo
protected ItemStack getQueen(IBeeHousing beeHousing, TileEntity te) {
BaseMetaTileEntity GTMetaTileEntity = getGTTileEntity(te);
GT_MetaTileEntity_IndustrialApiary industrialApiary = getGTIndustrialApiary(GTMetaTileEntity);
return industrialApiary != null ? industrialApiary.getUsedQueen() : super.getQueen(beeHousing, te);
}
@@ -67,7 +72,9 @@ public class TileEntityApimancersDrainerGT extends TileEntityApimancersDrainerCo
protected int getProductionMultiplier(IBeeModifier modifier, IBee queen, TileEntity te) {
BaseMetaTileEntity GTMetaTileEntity = getGTTileEntity(te);
GT_MetaTileEntity_IndustrialApiary industrialApiary = getGTIndustrialApiary(GTMetaTileEntity);
int housingProductionMultiplier = super.getProductionMultiplier(modifier, queen, te);
return industrialApiary != null
? housingProductionMultiplier * (int) Math.ceil(Math.sqrt(industrialApiary.mSpeed))
: housingProductionMultiplier;
@@ -75,6 +82,7 @@ public class TileEntityApimancersDrainerGT extends TileEntityApimancersDrainerCo
private BaseMetaTileEntity getGTTileEntity(TileEntity te) {
boolean isGTMetaTileEntity = te instanceof BaseMetaTileEntity;
return isGTMetaTileEntity ? (BaseMetaTileEntity) te : null;
}
@@ -82,6 +90,7 @@ public class TileEntityApimancersDrainerGT extends TileEntityApimancersDrainerCo
if (bmte != null) {
IMetaTileEntity underlyingMetaTileEntity = bmte.getMetaTileEntity();
if (!(underlyingMetaTileEntity instanceof GT_MetaTileEntity_IndustrialApiary)) return null;
return (GT_MetaTileEntity_IndustrialApiary) underlyingMetaTileEntity;
}
return null;