Skip to content
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
merged 69 commits into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
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 Dec 7, 2023
5e912b6
remove unused methods
Quantumlyy Dec 7, 2023
7345669
remove pointless arithmetic
Quantumlyy Dec 7, 2023
c8aaeba
edit frame and product slots
Quantumlyy Dec 7, 2023
ae246d8
extract MagicApiaryInventory into file
Quantumlyy Dec 7, 2023
bdd7630
revert slot move
Quantumlyy Dec 7, 2023
4c47f77
why was that there?
Quantumlyy Dec 7, 2023
e03d4da
add basics for phialing cabinet
Quantumlyy Dec 8, 2023
c23401e
add tc essentia bee
Quantumlyy Dec 8, 2023
07a9871
differentiate essentia based on first inserted
Quantumlyy Dec 8, 2023
0578441
check for beehousing instead of apiary
Quantumlyy Dec 8, 2023
d3ad57a
sa
Quantumlyy Dec 8, 2023
7416d21
use config for phialing cabinet values
Quantumlyy Dec 8, 2023
02c7fc7
sa
Quantumlyy Dec 8, 2023
29e72ed
make phialing cabinet capacity configurable
Quantumlyy Dec 8, 2023
6529e72
correctly check for the species
Quantumlyy Dec 8, 2023
c79503d
remove stubs
Quantumlyy Dec 9, 2023
e7e5292
read and write nbt
Quantumlyy Dec 9, 2023
f366dcd
finish up cabinet logic
Quantumlyy Dec 9, 2023
974e459
oops
Quantumlyy Dec 9, 2023
b19979e
revert container slots
Quantumlyy Dec 9, 2023
e88eb17
lower potential operations if the cabinet is full
Quantumlyy Dec 9, 2023
af2d06a
take into account the production multiplier
Quantumlyy Dec 9, 2023
98c0810
sa
Quantumlyy Dec 9, 2023
2935df3
fix multiplication by 0 issue
Quantumlyy Dec 9, 2023
ac68e40
add lang strings for phialing cabinet and essentia bee
Quantumlyy Dec 10, 2023
aa25a50
sa
Quantumlyy Dec 10, 2023
27ea81c
handle null aspect
Quantumlyy Dec 12, 2023
ae73677
age queen for every essentia generated
Quantumlyy Dec 12, 2023
906b970
remove queen aging
Quantumlyy Dec 12, 2023
121fe1c
sa
Quantumlyy Dec 12, 2023
4c64395
tweak default config values
Quantumlyy Dec 12, 2023
fc9ebd6
add phialing cabinet research
Quantumlyy Dec 12, 2023
89acb72
add textures
Quantumlyy Dec 12, 2023
ec44919
add bee ageing
Quantumlyy Dec 12, 2023
b7a928b
debug
Quantumlyy Dec 13, 2023
2ade3e5
use instanceof
Quantumlyy Dec 13, 2023
ff20b5f
change housing detection
Quantumlyy Dec 13, 2023
fb98d68
create method for detecting if housing is present
Quantumlyy Dec 13, 2023
b965d50
oops
Quantumlyy Dec 13, 2023
6e6cbba
rename phialing cabinet to apiamancers drainer
Quantumlyy Dec 13, 2023
123ff12
implement alternative housing checker for industrial apiary
Quantumlyy Dec 13, 2023
65b698f
perform standard check alongside gt check
Quantumlyy Dec 13, 2023
f55a9f7
address review
Quantumlyy Dec 13, 2023
4823e44
add some scanner data
Quantumlyy Dec 13, 2023
06571c1
check for queen in industrial apiary
Quantumlyy Dec 13, 2023
edf3ff7
add prod multiplier based on industrial apiary speed
Quantumlyy Dec 14, 2023
b5165b3
Update Config.java
Dream-Master Dec 24, 2023
df0761c
Update dependencies.gradle
Dream-Master Dec 24, 2023
4f5358b
Update Config.java
Dream-Master Dec 24, 2023
b82ce5e
update
Dream-Master Dec 31, 2023
573c089
Merge pull request #1 from GTNewHorizons/dev
Quantumlyy Dec 31, 2023
9d36165
cursed shit
Quantumlyy Dec 31, 2023
3da4083
localize
Quantumlyy Dec 31, 2023
9fb5e3d
reword
Quantumlyy Dec 31, 2023
cfe1cad
Merge branch 'master' into bring-closer-to-forestry
Dream-Master Jan 12, 2024
25c04ce
Update dependencies.gradle
Alastors Jan 21, 2024
9bae327
Update build.gradle
Alastors Jan 21, 2024
aed51fb
add infusion recipe
Quantumlyy Jan 21, 2024
828231c
Merge branch 'bring-closer-to-forestry' of https://github.com/Quantum…
Quantumlyy Jan 21, 2024
a9948fc
sa
Quantumlyy Jan 21, 2024
b011688
GTu no transitive
Quantumlyy Jan 21, 2024
e2080bc
sa
Quantumlyy Jan 21, 2024
67dfeb7
requested changes
Quantumlyy Jan 21, 2024
9d2c667
the grand rename
Quantumlyy Jan 21, 2024
fb43f46
fix: check for gtnh coremod to determine drainer functionality
Quantumlyy Jan 27, 2024
a64bd5f
check that block side is not top
Quantumlyy Jan 27, 2024
38bc8a1
fixing the block side
Alastors Jan 28, 2024
99c3cb6
minor cleanup
Alastors Jan 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//version: 1704751096
//version: 1705357285
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
Expand Down Expand Up @@ -122,6 +122,7 @@ propertyDefaultIfUnset("modrinthProjectId", "")
propertyDefaultIfUnset("modrinthRelations", "")
propertyDefaultIfUnset("curseForgeProjectId", "")
propertyDefaultIfUnset("curseForgeRelations", "")
propertyDefaultIfUnset("versionPattern", "")
propertyDefaultIfUnset("minimizeShadowedDependencies", true)
propertyDefaultIfUnset("relocateShadowedDependencies", true)
// Deprecated properties (kept for backwards compat)
Expand Down Expand Up @@ -370,6 +371,7 @@ catch (Exception ignored) {
// Pulls version first from the VERSION env and then git tag
String identifiedVersion
String versionOverride = System.getenv("VERSION") ?: null
boolean checkVersion = false
try {
// Produce a version based on the tag, or for branches something like 0.2.2-configurable-maven-and-extras.38+43090270b6-dirty
if (versionOverride == null) {
Expand All @@ -388,6 +390,8 @@ try {
}
} else if (isDirty) {
identifiedVersion += "-${branchName}+${gitDetails.gitHash}-dirty"
} else {
checkVersion = true
}
} else {
identifiedVersion = versionOverride
Expand All @@ -409,6 +413,8 @@ ext {

if (identifiedVersion == versionOverride) {
out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7')
} else if (checkVersion && versionPattern && !(identifiedVersion ==~ versionPattern)) {
throw new GradleException("Invalid version: '$identifiedVersion' does not match version pattern '$versionPattern'")
}

group = "com.github.GTNewHorizons"
Expand All @@ -428,18 +434,31 @@ minecraft {
for (f in replaceGradleTokenInFile.split(',')) {
tagReplacementFiles.add f
}
out.style(Style.Info).text('replaceGradleTokenInFile is deprecated! Consider using generateGradleTokenClass.').println()
}
if (gradleTokenModId) {
injectedTags.put gradleTokenModId, modId
if (replaceGradleTokenInFile) {
injectedTags.put gradleTokenModId, modId
} else {
out.style(Style.Failure).text('gradleTokenModId is deprecated! The field will no longer be generated.').println()
}
}
if (gradleTokenModName) {
injectedTags.put gradleTokenModName, modName
if (replaceGradleTokenInFile) {
injectedTags.put gradleTokenModName, modName
} else {
out.style(Style.Failure).text('gradleTokenModName is deprecated! The field will no longer be generated.').println()
}
}
if (gradleTokenVersion) {
injectedTags.put gradleTokenVersion, modVersion
}
if (gradleTokenGroupName) {
injectedTags.put gradleTokenGroupName, modGroup
if (replaceGradleTokenInFile) {
injectedTags.put gradleTokenGroupName, modGroup
} else {
out.style(Style.Failure).text('gradleTokenGroupName is deprecated! The field will no longer be generated.').println()
}
}
if (enableGenericInjection.toBoolean()) {
injectMissingGenerics.set(true)
Expand Down
7 changes: 3 additions & 4 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ dependencies {
compile('com.github.GTNewHorizons:ForestryMC:4.8.2:dev')

compileOnly('com.github.GTNewHorizons:BloodMagic:1.5.0:dev')
compileOnly('com.github.GTNewHorizons:ThaumicHorizons:1.5.0:dev')
compileOnly('com.github.GTNewHorizons:ThaumicHorizons:1.5.1:dev')
compileOnly('com.github.GTNewHorizons:Baubles:1.0.4:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:Botania:1.10.4-GTNH:api') {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.25:dev') { transitive = false }

compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.41:dev')
}

9 changes: 9 additions & 0 deletions src/main/java/magicbees/bees/BeeGenomeManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,15 @@ public static IAllele[] getTemplateTCChaos() {
return genome;
}

public static IAllele[] getTemplateTCEssentia() {
IAllele[] genome = getTemplateTCBase();

genome[EnumBeeChromosome.SPECIES.ordinal()] = BeeSpecies.TC_ESSENTIA.getSpecies();
genome[EnumBeeChromosome.FERTILITY.ordinal()] = Allele.getBaseAllele("fertilityNormal");

return genome;
}

public static IAllele[] getTemplateTCAir() {
IAllele[] genome = getTemplateTCBase();

Expand Down
5 changes: 5 additions & 0 deletions src/main/java/magicbees/bees/BeeMutation.java
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,11 @@ public static void setupMutations() {
BeeSpecies.SUPERNATURAL.getSpecies(),
BeeSpecies.TC_CHAOS.getGenome(),
8).requireResource(ThaumcraftHelper.crystal, ThaumcraftHelper.ShardType.CHAOS.ordinal());
beeMutationFactory.createMutation(
BeeSpecies.TC_ORDER.getSpecies(),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

based

BeeSpecies.TC_CHAOS.getSpecies(),
BeeSpecies.TC_ESSENTIA.getGenome(),
8).requireResource(ThaumcraftHelper.crystal, ThaumcraftHelper.ShardType.CHAOS.ordinal());

beeMutationFactory.createMutation(
BeeSpecies.ETHEREAL.getSpecies(),
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/magicbees/bees/BeeSpecies.java
Original file line number Diff line number Diff line change
Expand Up @@ -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),

Choose a reason for hiding this comment

The 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),
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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();
Expand Down
186 changes: 186 additions & 0 deletions src/main/java/magicbees/bees/MagicApiaryInventory.java
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));
}
}
}
}
Loading