forked from KryptonCaptain/MagicBees
-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Apimancers Drainer #34
Merged
Dream-Master
merged 69 commits into
GTNewHorizons:master
from
Quantumlyy:bring-closer-to-forestry
Jan 28, 2024
Merged
Changes from 65 commits
Commits
Show all changes
69 commits
Select commit
Hold shift + click to select a range
481c22a
use apiary inventory and beelistener
Quantumlyy 5e912b6
remove unused methods
Quantumlyy 7345669
remove pointless arithmetic
Quantumlyy c8aaeba
edit frame and product slots
Quantumlyy ae246d8
extract MagicApiaryInventory into file
Quantumlyy bdd7630
revert slot move
Quantumlyy 4c47f77
why was that there?
Quantumlyy e03d4da
add basics for phialing cabinet
Quantumlyy c23401e
add tc essentia bee
Quantumlyy 07a9871
differentiate essentia based on first inserted
Quantumlyy 0578441
check for beehousing instead of apiary
Quantumlyy d3ad57a
sa
Quantumlyy 7416d21
use config for phialing cabinet values
Quantumlyy 02c7fc7
sa
Quantumlyy 29e72ed
make phialing cabinet capacity configurable
Quantumlyy 6529e72
correctly check for the species
Quantumlyy c79503d
remove stubs
Quantumlyy e7e5292
read and write nbt
Quantumlyy f366dcd
finish up cabinet logic
Quantumlyy 974e459
oops
Quantumlyy b19979e
revert container slots
Quantumlyy e88eb17
lower potential operations if the cabinet is full
Quantumlyy af2d06a
take into account the production multiplier
Quantumlyy 98c0810
sa
Quantumlyy 2935df3
fix multiplication by 0 issue
Quantumlyy ac68e40
add lang strings for phialing cabinet and essentia bee
Quantumlyy aa25a50
sa
Quantumlyy 27ea81c
handle null aspect
Quantumlyy ae73677
age queen for every essentia generated
Quantumlyy 906b970
remove queen aging
Quantumlyy 121fe1c
sa
Quantumlyy 4c64395
tweak default config values
Quantumlyy fc9ebd6
add phialing cabinet research
Quantumlyy 89acb72
add textures
Quantumlyy ec44919
add bee ageing
Quantumlyy b7a928b
debug
Quantumlyy 2ade3e5
use instanceof
Quantumlyy ff20b5f
change housing detection
Quantumlyy fb98d68
create method for detecting if housing is present
Quantumlyy b965d50
oops
Quantumlyy 6e6cbba
rename phialing cabinet to apiamancers drainer
Quantumlyy 123ff12
implement alternative housing checker for industrial apiary
Quantumlyy 65b698f
perform standard check alongside gt check
Quantumlyy f55a9f7
address review
Quantumlyy 4823e44
add some scanner data
Quantumlyy 06571c1
check for queen in industrial apiary
Quantumlyy edf3ff7
add prod multiplier based on industrial apiary speed
Quantumlyy b5165b3
Update Config.java
Dream-Master df0761c
Update dependencies.gradle
Dream-Master 4f5358b
Update Config.java
Dream-Master b82ce5e
update
Dream-Master 573c089
Merge pull request #1 from GTNewHorizons/dev
Quantumlyy 9d36165
cursed shit
Quantumlyy 3da4083
localize
Quantumlyy 9fb5e3d
reword
Quantumlyy cfe1cad
Merge branch 'master' into bring-closer-to-forestry
Dream-Master 25c04ce
Update dependencies.gradle
Alastors 9bae327
Update build.gradle
Alastors aed51fb
add infusion recipe
Quantumlyy 828231c
Merge branch 'bring-closer-to-forestry' of https://github.com/Quantum…
Quantumlyy a9948fc
sa
Quantumlyy b011688
GTu no transitive
Quantumlyy e2080bc
sa
Quantumlyy 67dfeb7
requested changes
Quantumlyy 9d2c667
the grand rename
Quantumlyy fb43f46
fix: check for gtnh coremod to determine drainer functionality
Quantumlyy a64bd5f
check that block side is not top
Quantumlyy 38bc8a1
fixing the block side
Alastors 99c3cb6
minor cleanup
Alastors File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -186,6 +186,8 @@ public enum BeeSpecies { | |
EnumTemperature.NORMAL, EnumHumidity.NORMAL, true, true), | ||
TC_CHAOS("TCChaos", "tenebrarum", BeeClassification.THAUMIC, 0xCCCCCC, BodyColours.THAUMCRAFT_SHARD, | ||
EnumTemperature.NORMAL, EnumHumidity.NORMAL, true, false), | ||
TC_ESSENTIA("TCEssentia", "defaultium essentia apis", BeeClassification.THAUMIC, 0xCCCCCC, | ||
Quantumlyy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
BodyColours.THAUMCRAFT_SHARD, EnumTemperature.NORMAL, EnumHumidity.NORMAL, true, false), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there's a part of me that wishes it had a unique texture, but eh, no point for it, lotta work when all of the bees practically already look the same. |
||
|
||
TC_VIS("TCVis", "arcanus saecula", BeeClassification.THAUMIC, 0x004c99, BodyColours.THAUMCRAFT_NODE, | ||
EnumTemperature.NORMAL, EnumHumidity.NORMAL, false, false), | ||
|
@@ -398,6 +400,7 @@ public static void setupBeeSpecies() { | |
TC_EARTH.registerGenomeTemplate(BeeGenomeManager.getTemplateTCEarth()); | ||
TC_ORDER.registerGenomeTemplate(BeeGenomeManager.getTemplateTCOrder()); | ||
TC_CHAOS.registerGenomeTemplate(BeeGenomeManager.getTemplateTCChaos()); | ||
TC_ESSENTIA.registerGenomeTemplate(BeeGenomeManager.getTemplateTCEssentia()); | ||
TC_VIS.registerGenomeTemplate(BeeGenomeManager.getTemplateTCVis()); | ||
TC_REJUVENATING.registerGenomeTemplate(BeeGenomeManager.getTemplateTCRejuvinating()); | ||
TC_EMPOWERING.registerGenomeTemplate(BeeGenomeManager.getTemplateTCEmpowering()); | ||
|
@@ -461,6 +464,7 @@ public static void setupBeeSpecies() { | |
TC_WATER.setInactive(); | ||
TC_EARTH.setInactive(); | ||
TC_ORDER.setInactive(); | ||
TC_ESSENTIA.setInactive(); | ||
|
||
TC_VIS.setInactive(); | ||
TC_REJUVENATING.setInactive(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
package magicbees.bees; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
|
||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.nbt.NBTTagCompound; | ||
import net.minecraft.nbt.NBTTagList; | ||
import net.minecraftforge.common.util.Constants; | ||
|
||
import forestry.api.apiculture.IBee; | ||
import forestry.api.apiculture.IBeeHousing; | ||
import forestry.api.apiculture.IBeekeepingMode; | ||
import forestry.api.apiculture.IHiveFrame; | ||
import forestry.apiculture.inventory.IApiaryInventory; | ||
import magicbees.main.utils.ItemStackUtils; | ||
import magicbees.tileentity.TileEntityMagicApiary; | ||
|
||
public class MagicApiaryInventory implements IApiaryInventory { | ||
|
||
public static final int SLOT_QUEEN = 0; | ||
public static final int SLOT_DRONE = 1; | ||
public static final int SLOT_FRAME_START = 2; | ||
public static final int SLOT_FRAME_COUNT = 3; | ||
public static final int SLOT_PRODUCTS_START = 5; | ||
public static final int SLOT_PRODUCTS_COUNT = 7; | ||
|
||
private final TileEntityMagicApiary magicApiary; | ||
private final ItemStack[] items; | ||
|
||
public MagicApiaryInventory(TileEntityMagicApiary magicApiary) { | ||
this.magicApiary = magicApiary; | ||
this.items = new ItemStack[12]; | ||
} | ||
|
||
@Override | ||
public ItemStack getQueen() { | ||
return magicApiary.getStackInSlot(SLOT_QUEEN); | ||
} | ||
|
||
@Override | ||
public ItemStack getDrone() { | ||
return magicApiary.getStackInSlot(SLOT_DRONE); | ||
} | ||
|
||
@Override | ||
public void setQueen(ItemStack itemstack) { | ||
magicApiary.setInventorySlotContents(SLOT_QUEEN, itemstack); | ||
} | ||
|
||
@Override | ||
public void setDrone(ItemStack itemstack) { | ||
magicApiary.setInventorySlotContents(SLOT_DRONE, itemstack); | ||
} | ||
|
||
@Override | ||
public boolean addProduct(ItemStack product, boolean all) { | ||
int countAdded = ItemStackUtils | ||
.addItemToInventory(magicApiary, product, SLOT_PRODUCTS_START, SLOT_PRODUCTS_COUNT); | ||
|
||
if (all) { | ||
return countAdded == product.stackSize; | ||
} else { | ||
return countAdded > 0; | ||
} | ||
} | ||
|
||
public int getSizeInventory() { | ||
return items.length; | ||
} | ||
|
||
public ItemStack getStackInSlot(int i) { | ||
return items[i]; | ||
} | ||
|
||
public void setInventorySlotContents(int i, ItemStack itemStack) { | ||
items[i] = itemStack; | ||
|
||
if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()) { | ||
itemStack.stackSize = getInventoryStackLimit(); | ||
} | ||
} | ||
|
||
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; | ||
} | ||
} | ||
|
||
public boolean canInsertItem(int slot, ItemStack itemStack, int side) { | ||
if (slot == SLOT_QUEEN && BeeManager.beeRoot.isMember(itemStack) && !BeeManager.beeRoot.isDrone(itemStack)) { | ||
return true; | ||
} else if (slot == SLOT_DRONE && BeeManager.beeRoot.isDrone(itemStack)) { | ||
return true; | ||
} | ||
return slot == SLOT_DRONE && BeeManager.beeRoot.isDrone(itemStack); | ||
} | ||
|
||
public boolean canExtractItem(int slot, ItemStack itemStack, int side) { | ||
return slot >= SLOT_FRAME_START && slot <= SLOT_FRAME_START + 2; | ||
} | ||
|
||
public int getInventoryStackLimit() { | ||
return 64; | ||
} | ||
|
||
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) { | ||
continue; | ||
} | ||
|
||
Item itemInSlot = stackInSlot.getItem(); | ||
if (itemInSlot instanceof IHiveFrame) { | ||
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); | ||
itemStack.writeToNBT(item); | ||
itemsNBT.appendTag(item); | ||
} | ||
} | ||
compound.setTag("Items", itemsNBT); | ||
} | ||
|
||
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)); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
based