Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into dev
Browse files Browse the repository at this point in the history
# Conflicts:
#	build.gradle
#	dependencies.gradle
  • Loading branch information
Dream-Master committed Jan 12, 2024
2 parents 766a440 + 9fb5e3d commit d738730
Show file tree
Hide file tree
Showing 16 changed files with 1,038 additions and 474 deletions.
35 changes: 20 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//version: 1704751096
//version: 1702141377
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
Expand Down Expand Up @@ -31,7 +31,8 @@ buildscript {
maven {
// GTNH RetroFuturaGradle and ASM Fork
name "GTNH Maven"
url "https://nexus.gtnewhorizons.com/repository/public/"
url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
allowInsecureProtocol = true
}
mavenLocal()
}
Expand All @@ -48,12 +49,12 @@ plugins {
id 'org.ajoberstar.grgit' version '4.1.1' // 4.1.1 is the last jvm8 supporting version, unused, available for addon.gradle
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
id 'com.palantir.git-version' version '3.0.0' apply false
id 'de.undercouch.download' version '5.5.0'
id 'de.undercouch.download' version '5.4.0'
id 'com.github.gmazzo.buildconfig' version '3.1.0' apply false // Unused, available for addon.gradle
id 'com.diffplug.spotless' version '6.13.0' apply false // 6.13.0 is the last jvm8 supporting version
id 'com.modrinth.minotaur' version '2.+' apply false
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.27'
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.26'
}

print("You might want to check out './gradlew :faq' if your build fails.\n")
Expand Down Expand Up @@ -117,7 +118,7 @@ propertyDefaultIfUnset("forceEnableMixins", false)
propertyDefaultIfUnset("channel", "stable")
propertyDefaultIfUnset("mappingsVersion", "12")
propertyDefaultIfUnset("usesMavenPublishing", true)
propertyDefaultIfUnset("mavenPublishUrl", "https://nexus.gtnewhorizons.com/repository/releases/")
propertyDefaultIfUnset("mavenPublishUrl", "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases")
propertyDefaultIfUnset("modrinthProjectId", "")
propertyDefaultIfUnset("modrinthRelations", "")
propertyDefaultIfUnset("curseForgeProjectId", "")
Expand Down Expand Up @@ -571,17 +572,15 @@ afterEvaluate {
}

repositories {
maven {
name = "GTNH Maven"
url = "https://nexus.gtnewhorizons.com/repository/public/"
// Links for convenience:
// Simple HTML browsing: https://nexus.gtnewhorizons.com/service/rest/repository/browse/releases/
// Rich web UI browsing: https://nexus.gtnewhorizons.com/#browse/browse:releases
}
maven {
name 'Overmind forge repo mirror'
url 'https://gregtech.overminddl1.com/'
}
maven {
name = "GTNH Maven"
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
allowInsecureProtocol = true
}
maven {
name 'sonatype'
url 'https://oss.sonatype.org/content/repositories/snapshots/'
Expand Down Expand Up @@ -786,7 +785,7 @@ dependencies {
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
}
if (modId != 'hodgepodge') {
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.4.4')
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.3.35')
}

java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") {transitive = false}
Expand Down Expand Up @@ -961,7 +960,8 @@ if (usesShadowedDependencies.toBoolean()) {
configurations.runtimeElements.outgoing.artifact(tasks.named("shadowJar", ShadowJar))
configurations.apiElements.outgoing.artifact(tasks.named("shadowJar", ShadowJar))
tasks.named("jar", Jar) {
archiveClassifier.set('dev-preshadow')
enabled = false
finalizedBy(tasks.shadowJar)
}
tasks.named("reobfJar", ReobfuscatedJar) {
inputJar.set(tasks.named("shadowJar", ShadowJar).flatMap({it.archiveFile}))
Expand All @@ -970,6 +970,11 @@ if (usesShadowedDependencies.toBoolean()) {
javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements) {
skip()
}
for (runTask in ["runClient", "runServer", "runClient17", "runServer17"]) {
tasks.named(runTask).configure {
dependsOn("shadowJar")
}
}
}
ext.publishableDevJar = usesShadowedDependencies.toBoolean() ? tasks.shadowJar : tasks.jar
ext.publishableObfJar = tasks.reobfJar
Expand Down Expand Up @@ -1173,7 +1178,7 @@ publishing {
if (usesMavenPublishing.toBoolean() && System.getenv("MAVEN_USER") != null) {
maven {
url = mavenPublishUrl
allowInsecureProtocol = mavenPublishUrl.startsWith("http://")
allowInsecureProtocol = mavenPublishUrl.startsWith("http://") // Mostly for the GTNH maven
credentials {
username = System.getenv("MAVEN_USER") ?: "NONE"
password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
Expand Down
13 changes: 6 additions & 7 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
// Add your dependencies here

dependencies {
compile('com.github.GTNewHorizons:ForestryMC:4.8.2:dev')
compile('com.github.GTNewHorizons:ForestryMC:4.8.1:dev')

compileOnly('com.github.GTNewHorizons:BloodMagic:1.5.0:dev')
compileOnly('com.github.GTNewHorizons:ThaumicHorizons:1.5.0: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:BloodMagic:1.4.3:dev')
compileOnly('com.github.GTNewHorizons:ThaumicHorizons:1.4.2:dev')
compileOnly('com.github.GTNewHorizons:Baubles:1.0.3:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:Botania:1.10.3-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.15: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(),
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,
BodyColours.THAUMCRAFT_SHARD, EnumTemperature.NORMAL, EnumHumidity.NORMAL, true, false),

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

0 comments on commit d738730

Please sign in to comment.