1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00

Fixed Organic food/fertilizer not being recognized

This commit is contained in:
TheBusyBiscuit 2020-05-15 16:47:01 +02:00
parent 6aeee8f4be
commit c4a3cdc833
5 changed files with 25 additions and 8 deletions

View File

@ -42,6 +42,7 @@
* Fixed #1897
* Fixed #1908
* Fixed #1903
* Fixed Organic Food/Fertilizer not being recognized
## Release Candidate 11 (25 Apr 2020)

View File

@ -13,6 +13,7 @@ import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetComponent;
import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
@ -32,6 +33,9 @@ public class AnimalGrowthAccelerator extends SlimefunItem implements InventoryBl
private static final int ENERGY_CONSUMPTION = 14;
// We wanna strip the Slimefun Item id here
private static final ItemStack organicFood = new ItemStackWrapper(SlimefunItems.ORGANIC_FOOD);
public AnimalGrowthAccelerator(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
@ -99,7 +103,7 @@ public class AnimalGrowthAccelerator extends SlimefunItem implements InventoryBl
for (Entity n : b.getWorld().getNearbyEntities(b.getLocation(), 3.0, 3.0, 3.0, n -> n instanceof Ageable && n.isValid() && !((Ageable) n).isAdult())) {
for (int slot : getInputSlots()) {
if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(slot), SlimefunItems.ORGANIC_FOOD, false)) {
if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(slot), organicFood, false)) {
if (ChargableBlock.getCharge(b) < ENERGY_CONSUMPTION) return;
ChargableBlock.addCharge(b, -ENERGY_CONSUMPTION);

View File

@ -12,6 +12,7 @@ import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetComponent;
import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
@ -31,6 +32,9 @@ public class AutoBreeder extends SlimefunItem implements InventoryBlock, EnergyN
private static final int ENERGY_CONSUMPTION = 60;
// We wanna strip the Slimefun Item id here
private static final ItemStack organicFood = new ItemStackWrapper(SlimefunItems.ORGANIC_FOOD);
public AutoBreeder(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
@ -99,7 +103,7 @@ public class AutoBreeder extends SlimefunItem implements InventoryBlock, EnergyN
for (Entity n : b.getWorld().getNearbyEntities(b.getLocation(), 4.0, 2.0, 4.0, this::canBreed)) {
for (int slot : getInputSlots()) {
if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(slot), SlimefunItems.ORGANIC_FOOD, false)) {
if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(slot), organicFood, false)) {
if (ChargableBlock.getCharge(b) < ENERGY_CONSUMPTION) {
return;
}

View File

@ -15,6 +15,7 @@ import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetComponent;
import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
@ -34,6 +35,9 @@ public abstract class CropGrowthAccelerator extends SlimefunItem implements Inve
private final int[] border = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 };
private final Set<Material> crops = new HashSet<>();
// We wanna strip the Slimefun Item id here
private static final ItemStack organicFertilizer = new ItemStackWrapper(SlimefunItems.FERTILIZER);
public CropGrowthAccelerator(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
@ -118,7 +122,7 @@ public abstract class CropGrowthAccelerator extends SlimefunItem implements Inve
if (work(b, inv) > 0) {
for (int slot : getInputSlots()) {
if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(slot), SlimefunItems.FERTILIZER, false)) {
if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(slot), organicFertilizer, false)) {
inv.consumeItem(slot);
break;
}
@ -138,7 +142,7 @@ public abstract class CropGrowthAccelerator extends SlimefunItem implements Inve
if (ageable.getAge() < ageable.getMaximumAge()) {
for (int slot : getInputSlots()) {
if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(slot), SlimefunItems.FERTILIZER, false)) {
if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(slot), organicFertilizer, false)) {
if (work > (getSpeed() - 1) || ChargableBlock.getCharge(b) < getEnergyConsumption()) return work;
ChargableBlock.addCharge(b, -getEnergyConsumption());

View File

@ -12,6 +12,7 @@ import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetComponent;
import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
@ -38,10 +39,13 @@ import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
public class TreeGrowthAccelerator extends SlimefunItem implements InventoryBlock, EnergyNetComponent {
private static final int[] border = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 };
private static final int ENERGY_CONSUMPTION = 24;
private static final int RADIUS = 9;
// We wanna strip the Slimefun Item id here
private static final ItemStack organicFertilizer = new ItemStackWrapper(SlimefunItems.FERTILIZER);
public TreeGrowthAccelerator(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
@ -110,7 +114,7 @@ public class TreeGrowthAccelerator extends SlimefunItem implements InventoryBloc
if (work(b, inv) > 0) {
for (int slot : getInputSlots()) {
if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(slot), SlimefunItems.FERTILIZER, false)) {
if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(slot), organicFertilizer, false)) {
inv.consumeItem(slot);
break;
}
@ -130,7 +134,7 @@ public class TreeGrowthAccelerator extends SlimefunItem implements InventoryBloc
if (sapling.getStage() < sapling.getMaximumStage()) {
for (int slot : getInputSlots()) {
if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(slot), SlimefunItems.FERTILIZER, false)) {
if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(slot), organicFertilizer, false)) {
if (work > 3 || ChargableBlock.getCharge(b) < ENERGY_CONSUMPTION) return work;
ChargableBlock.addCharge(b, -ENERGY_CONSUMPTION);