Compare commits

...
5 Commits
12 changed files with 92 additions and 72 deletions

No files matched your search

+2 -2
View File
@@ -3,9 +3,9 @@ name: Build and test
on: on:
pull_request: pull_request:
branches: [ master, main ] branches: [ master, main, release/** ]
push: push:
branches: [ master, main ] branches: [ master, main, release/** ]
jobs: jobs:
build-and-test: build-and-test:
@@ -1,6 +1,9 @@
package binnie.core.machines; package binnie.core.machines;
import java.util.List;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@@ -24,4 +27,13 @@ public class ItemMachine extends ItemBlock {
public String getItemStackDisplayName(ItemStack itemstack) { public String getItemStackDisplayName(ItemStack itemstack) {
return associatedBlock.getMachineName(itemstack.getItemDamage()); return associatedBlock.getMachineName(itemstack.getItemDamage());
} }
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) {
super.addInformation(stack, player, tooltip, advanced);
final MachinePackage pkg = associatedBlock.getPackage(stack.getItemDamage());
if (pkg != null) {
pkg.addTooltip(tooltip);
}
}
} }
@@ -1,5 +1,7 @@
package binnie.core.machines; package binnie.core.machines;
import java.util.List;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import binnie.core.util.I18N; import binnie.core.util.I18N;
@@ -71,4 +73,6 @@ public abstract class MachinePackage {
public String getInformation() { public String getInformation() {
return I18N.localise(group.getMod().getModID() + ".machine." + group.getShortUID() + "." + getUID() + ".info"); return I18N.localise(group.getMod().getModID() + ".machine." + group.getShortUID() + "." + getUID() + ".info");
} }
public void addTooltip(List<String> tooltip) {}
} }
@@ -1,15 +1,19 @@
package binnie.core.machines.storage; package binnie.core.machines.storage;
import java.util.List;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import binnie.core.BinnieCore; import binnie.core.BinnieCore;
import binnie.core.gui.BinnieCoreGUI;
import binnie.core.machines.IMachineType; import binnie.core.machines.IMachineType;
import binnie.core.machines.Machine; import binnie.core.machines.Machine;
import binnie.core.machines.MachinePackage; import binnie.core.machines.MachinePackage;
import binnie.core.machines.TileEntityMachine; import binnie.core.machines.TileEntityMachine;
import binnie.core.resource.BinnieResource; import binnie.core.resource.BinnieResource;
import binnie.core.resource.IBinnieTexture; import binnie.core.resource.IBinnieTexture;
import binnie.core.util.I18N;
enum Compartment implements IMachineType { enum Compartment implements IMachineType {
@@ -37,11 +41,36 @@ enum Compartment implements IMachineType {
public abstract static class PackageCompartment extends MachinePackage { public abstract static class PackageCompartment extends MachinePackage {
private final BinnieResource renderTexture; static final int ROWS_PER_TAB = 5;
protected PackageCompartment(String uid, IBinnieTexture renderTexture) { private final BinnieResource renderTexture;
private final int tabs;
private final int slotsPerTab;
protected PackageCompartment(String uid, IBinnieTexture renderTexture, int tabs, int slotsPerTab) {
super(uid, false); super(uid, false);
this.renderTexture = renderTexture.getTexture(); this.renderTexture = renderTexture.getTexture();
this.tabs = tabs;
this.slotsPerTab = slotsPerTab;
}
@Override
public void createMachine(Machine machine) {
new ComponentBinnieCoreGUI(machine, BinnieCoreGUI.Compartment);
new ComponentCompartmentInventory(machine, tabs, slotsPerTab);
}
@Override
public void addTooltip(List<String> tooltip) {
final int slotsPerRow = slotsPerTab / ROWS_PER_TAB;
final int slotsTotal = this.tabs * slotsPerTab;
tooltip.add(
I18N.localise(
"binniecore.machine.storage.tooltip.size",
slotsPerRow,
ROWS_PER_TAB,
this.tabs,
slotsTotal));
} }
@Override @Override
@@ -1,7 +1,5 @@
package binnie.core.machines.storage; package binnie.core.machines.storage;
import binnie.core.gui.BinnieCoreGUI;
import binnie.core.machines.Machine;
import binnie.core.texture.BinnieCoreTexture; import binnie.core.texture.BinnieCoreTexture;
public class StandardCompartment { public class StandardCompartment {
@@ -9,84 +7,42 @@ public class StandardCompartment {
public static class PackageCompartment extends Compartment.PackageCompartment { public static class PackageCompartment extends Compartment.PackageCompartment {
public PackageCompartment() { public PackageCompartment() {
super("compartment", BinnieCoreTexture.Compartment); super("compartment", BinnieCoreTexture.Compartment, 4, 25);
} }
@Override
public void createMachine(Machine machine) {
new ComponentBinnieCoreGUI(machine, BinnieCoreGUI.Compartment);
new ComponentCompartmentInventory(machine, 4, 25);
}
} }
public static class PackageCompartmentCopper extends Compartment.PackageCompartment { public static class PackageCompartmentCopper extends Compartment.PackageCompartment {
public PackageCompartmentCopper() { public PackageCompartmentCopper() {
super("compartmentCopper", BinnieCoreTexture.CompartmentCopper); super("compartmentCopper", BinnieCoreTexture.CompartmentCopper, 6, 25);
} }
@Override
public void createMachine(Machine machine) {
new ComponentBinnieCoreGUI(machine, BinnieCoreGUI.Compartment);
new ComponentCompartmentInventory(machine, 6, 25);
}
} }
public static class PackageCompartmentBronze extends Compartment.PackageCompartment { public static class PackageCompartmentBronze extends Compartment.PackageCompartment {
public PackageCompartmentBronze() { public PackageCompartmentBronze() {
super("compartmentBronze", BinnieCoreTexture.CompartmentBronze); super("compartmentBronze", BinnieCoreTexture.CompartmentBronze, 8, 25);
} }
@Override
public void createMachine(Machine machine) {
new ComponentBinnieCoreGUI(machine, BinnieCoreGUI.Compartment);
new ComponentCompartmentInventory(machine, 8, 25);
}
} }
public static class PackageCompartmentIron extends Compartment.PackageCompartment { public static class PackageCompartmentIron extends Compartment.PackageCompartment {
public PackageCompartmentIron() { public PackageCompartmentIron() {
super("compartmentIron", BinnieCoreTexture.CompartmentIron); super("compartmentIron", BinnieCoreTexture.CompartmentIron, 4, 50);
} }
@Override
public void createMachine(Machine machine) {
new ComponentBinnieCoreGUI(machine, BinnieCoreGUI.Compartment);
new ComponentCompartmentInventory(machine, 4, 50);
}
} }
public static class PackageCompartmentGold extends Compartment.PackageCompartment { public static class PackageCompartmentGold extends Compartment.PackageCompartment {
public PackageCompartmentGold() { public PackageCompartmentGold() {
super("compartmentGold", BinnieCoreTexture.CompartmentGold); super("compartmentGold", BinnieCoreTexture.CompartmentGold, 6, 50);
} }
@Override
public void createMachine(Machine machine) {
new ComponentBinnieCoreGUI(machine, BinnieCoreGUI.Compartment);
new ComponentCompartmentInventory(machine, 6, 50);
}
} }
public static class PackageCompartmentDiamond extends Compartment.PackageCompartment { public static class PackageCompartmentDiamond extends Compartment.PackageCompartment {
public PackageCompartmentDiamond() { public PackageCompartmentDiamond() {
super("compartmentDiamond", BinnieCoreTexture.CompartmentDiamond); super("compartmentDiamond", BinnieCoreTexture.CompartmentDiamond, 8, 50);
} }
@Override
public void createMachine(Machine machine) {
new ComponentBinnieCoreGUI(machine, BinnieCoreGUI.Compartment);
new ComponentCompartmentInventory(machine, 8, 50);
}
} }
} }
@@ -104,7 +104,7 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
tabs2 = new Integer[] { 4, 5, 6, 7 }; tabs2 = new Integer[] { 4, 5, 6, 7 };
} }
boolean doubleTabbed = tabs2.length > 0; boolean doubleTabbed = tabs2.length > 0;
int compartmentPageWidth = 16 + 18 * inv.getPageSize() / 5; int compartmentPageWidth = 16 + 18 * inv.getPageSize() / Compartment.PackageCompartment.ROWS_PER_TAB;
int compartmentPageHeight = 106; int compartmentPageHeight = 106;
int compartmentWidth = compartmentPageWidth + (doubleTabbed ? 48 : 24); int compartmentWidth = compartmentPageWidth + (doubleTabbed ? 48 : 24);
@@ -193,8 +193,12 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
slotsIDs[k] = i++; slotsIDs[k] = i++;
} }
new ControlSlotArray(thisPage, 8, 8, inv.getPageSize() / 5, 5) new ControlSlotArray(
.create(actions, InventoryType.Machine, slotsIDs); thisPage,
8,
8,
inv.getPageSize() / Compartment.PackageCompartment.ROWS_PER_TAB,
Compartment.PackageCompartment.ROWS_PER_TAB).create(actions, InventoryType.Machine, slotsIDs);
} }
MessageCraftGUI.sendToServer(actions); MessageCraftGUI.sendToServer(actions);
x += compartmentPageWidth; x += compartmentPageWidth;
@@ -82,7 +82,7 @@ public enum EnumHoneyDrop implements IItemEnum {
@Override @Override
public boolean isActive() { public boolean isActive() {
return liquidName == null || FluidRegistry.isFluidRegistered(liquidName); return liquidName == null || liquidName.isEmpty() || FluidRegistry.isFluidRegistered(liquidName);
} }
@Override @Override
@@ -34,14 +34,14 @@ public class ItemHoneyComb extends ItemProduct {
OreDictionary.registerOre("gemEmerald", Items.emerald); OreDictionary.registerOre("gemEmerald", Items.emerald);
OreDictionary.registerOre("gemLapis", new ItemStack(Items.dye, 1, 4)); OreDictionary.registerOre("gemLapis", new ItemStack(Items.dye, 1, 4));
EnumHoneyComb.BARREN.addProduct(beeswax, 1.00f); EnumHoneyComb.BARREN.tryAddProduct(beeswax, 1.00f);
EnumHoneyComb.BARREN.addProduct(honeyDrop, 0.50f); EnumHoneyComb.BARREN.addProduct(honeyDrop, 0.50f);
EnumHoneyComb.ROTTEN.addProduct(beeswax, 0.20f); EnumHoneyComb.ROTTEN.tryAddProduct(beeswax, 0.20f);
EnumHoneyComb.ROTTEN.addProduct(honeyDrop, 0.20f); EnumHoneyComb.ROTTEN.addProduct(honeyDrop, 0.20f);
EnumHoneyComb.ROTTEN.addProduct(new ItemStack(Items.rotten_flesh, 1, 0), 0.80f); EnumHoneyComb.ROTTEN.addProduct(new ItemStack(Items.rotten_flesh, 1, 0), 0.80f);
EnumHoneyComb.BONE.addProduct(beeswax, 0.20f); EnumHoneyComb.BONE.tryAddProduct(beeswax, 0.20f);
EnumHoneyComb.BONE.addProduct(honeyDrop, 0.20f); EnumHoneyComb.BONE.addProduct(honeyDrop, 0.20f);
EnumHoneyComb.BONE.addProduct(new ItemStack(Items.dye, 1, 15), 0.80f); EnumHoneyComb.BONE.addProduct(new ItemStack(Items.dye, 1, 15), 0.80f);
@@ -55,7 +55,7 @@ public class ItemHoneyComb extends ItemProduct {
EnumHoneyComb.WATER.tryAddProduct(EnumPropolis.WATER, 1.00f); EnumHoneyComb.WATER.tryAddProduct(EnumPropolis.WATER, 1.00f);
EnumHoneyComb.WATER.addProduct(honeyDrop, 0.90f); EnumHoneyComb.WATER.addProduct(honeyDrop, 0.90f);
EnumHoneyComb.STONE.addProduct(beeswax, 0.50f); EnumHoneyComb.STONE.tryAddProduct(beeswax, 0.50f);
EnumHoneyComb.STONE.addProduct(honeyDrop, 0.25f); EnumHoneyComb.STONE.addProduct(honeyDrop, 0.25f);
EnumHoneyComb.MILK.tryAddProduct(EnumHoneyDrop.MILK, 1.00f); EnumHoneyComb.MILK.tryAddProduct(EnumHoneyDrop.MILK, 1.00f);
@@ -84,7 +84,7 @@ public class ItemHoneyComb extends ItemProduct {
EnumHoneyComb.LATEX.active = false; EnumHoneyComb.LATEX.active = false;
} }
EnumHoneyComb.REDSTONE.addProduct(beeswax, 0.80f); EnumHoneyComb.REDSTONE.tryAddProduct(beeswax, 0.80f);
EnumHoneyComb.REDSTONE.addProduct(new ItemStack(Items.redstone, 1, 0), 1.00f); EnumHoneyComb.REDSTONE.addProduct(new ItemStack(Items.redstone, 1, 0), 1.00f);
EnumHoneyComb.REDSTONE.addProduct(honeyDrop, 0.50f); EnumHoneyComb.REDSTONE.addProduct(honeyDrop, 0.50f);
@@ -119,14 +119,14 @@ public class ItemHoneyComb extends ItemProduct {
EnumHoneyComb.URANIUM.tryAddProduct(OreDictionary.getOres("crushedUranium").get(0), 0.50f); EnumHoneyComb.URANIUM.tryAddProduct(OreDictionary.getOres("crushedUranium").get(0), 0.50f);
} }
EnumHoneyComb.CLAY.addProduct(beeswax, 0.25f); EnumHoneyComb.CLAY.tryAddProduct(beeswax, 0.25f);
EnumHoneyComb.CLAY.addProduct(honeyDrop, 0.80f); EnumHoneyComb.CLAY.addProduct(honeyDrop, 0.80f);
EnumHoneyComb.CLAY.addProduct(new ItemStack(Items.clay_ball), 0.80f); EnumHoneyComb.CLAY.addProduct(new ItemStack(Items.clay_ball), 0.80f);
EnumHoneyComb.OLD.addProduct(beeswax, 1.00f); EnumHoneyComb.OLD.tryAddProduct(beeswax, 1.00f);
EnumHoneyComb.OLD.addProduct(honeyDrop, 0.90f); EnumHoneyComb.OLD.addProduct(honeyDrop, 0.90f);
EnumHoneyComb.FUNGAL.addProduct(beeswax, 0.90f); EnumHoneyComb.FUNGAL.tryAddProduct(beeswax, 0.90f);
EnumHoneyComb.FUNGAL.addProduct(new ItemStack(Blocks.brown_mushroom_block, 1, 0), 1.00f); EnumHoneyComb.FUNGAL.addProduct(new ItemStack(Blocks.brown_mushroom_block, 1, 0), 1.00f);
EnumHoneyComb.FUNGAL.addProduct(new ItemStack(Blocks.red_mushroom_block, 1, 0), 0.75f); EnumHoneyComb.FUNGAL.addProduct(new ItemStack(Blocks.red_mushroom_block, 1, 0), 0.75f);
@@ -139,11 +139,11 @@ public class ItemHoneyComb extends ItemProduct {
EnumHoneyComb.VENOMOUS.addProduct(beeswax, 0.80f); EnumHoneyComb.VENOMOUS.addProduct(beeswax, 0.80f);
EnumHoneyComb.VENOMOUS.tryAddProduct(EnumHoneyDrop.POISON, 0.80f); EnumHoneyComb.VENOMOUS.tryAddProduct(EnumHoneyDrop.POISON, 0.80f);
EnumHoneyComb.SLIME.addProduct(beeswax, 1.00f); EnumHoneyComb.SLIME.tryAddProduct(beeswax, 1.00f);
EnumHoneyComb.SLIME.addProduct(honeyDrop, 0.75f); EnumHoneyComb.SLIME.addProduct(honeyDrop, 0.75f);
EnumHoneyComb.SLIME.addProduct(new ItemStack(Items.slime_ball, 1, 0), 0.75f); EnumHoneyComb.SLIME.addProduct(new ItemStack(Items.slime_ball, 1, 0), 0.75f);
EnumHoneyComb.BLAZE.addProduct(beeswax, 0.75f); EnumHoneyComb.BLAZE.tryAddProduct(beeswax, 0.75f);
EnumHoneyComb.BLAZE.addProduct(new ItemStack(Items.blaze_powder, 1, 0), 1.00f); EnumHoneyComb.BLAZE.addProduct(new ItemStack(Items.blaze_powder, 1, 0), 1.00f);
EnumHoneyComb.COFFEE.addProduct(beeswax, 0.90f); EnumHoneyComb.COFFEE.addProduct(beeswax, 0.90f);
@@ -178,7 +178,7 @@ public class ItemHoneyComb extends ItemProduct {
EnumHoneyComb.PLATINUM.tryAddProduct(ExtraBeeItems.PlatinumDust, 1.00f); EnumHoneyComb.PLATINUM.tryAddProduct(ExtraBeeItems.PlatinumDust, 1.00f);
EnumHoneyComb.LAPIS.copyProducts(EnumHoneyComb.STONE); EnumHoneyComb.LAPIS.copyProducts(EnumHoneyComb.STONE);
EnumHoneyComb.LAPIS.addProduct(new ItemStack(Items.dye, 6, 4), 1.00f); EnumHoneyComb.LAPIS.tryAddProduct(new ItemStack(Items.dye, 6, 4), 1.00f);
EnumHoneyComb.EMERALD.copyProducts(EnumHoneyComb.STONE); EnumHoneyComb.EMERALD.copyProducts(EnumHoneyComb.STONE);
EnumHoneyComb.EMERALD.tryAddProduct(ExtraBeeItems.EmeraldShard, 1.00f); EnumHoneyComb.EMERALD.tryAddProduct(ExtraBeeItems.EmeraldShard, 1.00f);
@@ -195,7 +195,7 @@ public class ItemHoneyComb extends ItemProduct {
EnumHoneyComb.RED.addProduct(honeyDrop, 0.80f); EnumHoneyComb.RED.addProduct(honeyDrop, 0.80f);
EnumHoneyComb.RED.addProduct(beeswax, 0.80f); EnumHoneyComb.RED.addProduct(beeswax, 0.80f);
EnumHoneyComb.GLOWSTONE.addProduct(honeyDrop, 0.25f); EnumHoneyComb.GLOWSTONE.tryAddProduct(honeyDrop, 0.25f);
EnumHoneyComb.GLOWSTONE.addProduct(new ItemStack(Items.glowstone_dust), 1.00f); EnumHoneyComb.GLOWSTONE.addProduct(new ItemStack(Items.glowstone_dust), 1.00f);
EnumHoneyComb.SALTPETER.addProduct(honeyDrop, 0.25f); EnumHoneyComb.SALTPETER.addProduct(honeyDrop, 0.25f);
@@ -254,7 +254,7 @@ public class ItemHoneyComb extends ItemProduct {
case 15 -> ExtraBeeItems.WhiteDye.get(1); case 15 -> ExtraBeeItems.WhiteDye.get(1);
default -> new ItemStack(Items.dye, 1, k); default -> new ItemStack(Items.dye, 1, k);
}; };
type.addProduct(drop.get(1), 1.00f); type.tryAddProduct(drop.get(1), 1.00f);
drop.addRemenant(dye); drop.addRemenant(dye);
} }
} }
@@ -39,6 +39,13 @@ public class Inoculator {
NBTTagList chromosomes = genomeNBT.getTagList("Chromosomes", 10); NBTTagList chromosomes = genomeNBT.getTagList("Chromosomes", 10);
NBTTagCompound chromosomeNBT = chromosomes.getCompoundTagAt(chromosomeID); NBTTagCompound chromosomeNBT = chromosomes.getCompoundTagAt(chromosomeID);
chromosomeNBT.setString("UID" + chromoN, gene.getAllele().getUID()); chromosomeNBT.setString("UID" + chromoN, gene.getAllele().getUID());
if (gene.getChromosome() == EnumBeeChromosome.LIFESPAN && gene.getSpeciesRoot() instanceof IBeeRoot beeRoot) {
int lifespan = beeRoot.getMember(target).getGenome().getLifespan();
beeNBT.setInteger(
"Health",
Math.max(0, beeNBT.getInteger("Health") + lifespan - beeNBT.getInteger("MaxH")));
beeNBT.setInteger("MaxH", lifespan);
}
target.setTagCompound(beeNBT); target.setTagCompound(beeNBT);
} }
} }
@@ -37,6 +37,13 @@ public class Splicer {
NBTTagList chromosomes = genomeNBT.getTagList("Chromosomes", 10); NBTTagList chromosomes = genomeNBT.getTagList("Chromosomes", 10);
NBTTagCompound chromosomeNBT = chromosomes.getCompoundTagAt(chromosomeID); NBTTagCompound chromosomeNBT = chromosomes.getCompoundTagAt(chromosomeID);
chromosomeNBT.setString("UID" + chromoN, gene.getAllele().getUID()); chromosomeNBT.setString("UID" + chromoN, gene.getAllele().getUID());
if (gene.getChromosome() == EnumBeeChromosome.LIFESPAN && gene.getSpeciesRoot() instanceof IBeeRoot beeRoot) {
int lifespan = beeRoot.getMember(target).getGenome().getLifespan();
beeNBT.setInteger(
"Health",
Math.max(0, beeNBT.getInteger("Health") + lifespan - beeNBT.getInteger("MaxH")));
beeNBT.setInteger("MaxH", lifespan);
}
target.setTagCompound(beeNBT); target.setTagCompound(beeNBT);
} }
} }
@@ -282,6 +282,7 @@ binniecore.machine.storage.tab.properties=Tab Properties
binniecore.machine.storage.tab.properties.desc=The label, color and icon of the Tab can be altered here. Clicking on the icon with a held item will change it binniecore.machine.storage.tab.properties.desc=The label, color and icon of the Tab can be altered here. Clicking on the icon with a held item will change it
binniecore.machine.storage.tab.name=Tab Name: binniecore.machine.storage.tab.name=Tab Name:
binniecore.machine.storage.tab.icon=Tab Icon: binniecore.machine.storage.tab.icon=Tab Icon:
binniecore.machine.storage.tooltip.size=Inventory %s*%s*%s - %s Slots
binniecore.machine.storage.tooltip.icon=Icon for Current Tab binniecore.machine.storage.tooltip.icon=Icon for Current Tab
binniecore.machine.storage.tooltip.icon.desc=Click here with an item to change binniecore.machine.storage.tooltip.icon.desc=Click here with an item to change
binniecore.machine.storage.tab.color=Color: binniecore.machine.storage.tab.color=Color:
@@ -1,4 +1,4 @@
fluid.binnie.dna.raw=Liquid DNA fluid.binnie.dna.raw=Raw DNA
fluid.binnie.bacteria=Bacteria fluid.binnie.bacteria=Bacteria
fluid.binnie.growthMedium=Growth Medium fluid.binnie.growthMedium=Growth Medium
fluid.binnie.bacteriaPoly=Polymerizing Bacteria fluid.binnie.bacteriaPoly=Polymerizing Bacteria