Skip to content

Commit

Permalink
Fixed #76 Added compost levels for Growthcraft items.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alatyami committed Feb 10, 2024
1 parent 90d2636 commit d76ba16
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 48 deletions.
4 changes: 1 addition & 3 deletions src/main/java/growthcraft/apiary/GrowthcraftApiary.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ private void clientSetupEvent(final FMLClientSetupEvent event) {
}

private void setup(final FMLCommonSetupEvent event) {
//event.enqueueWork( () -> {
// GrowthcraftOreGeneration.registerConfiguredFeatures();
//});
GrowthcraftApiaryItems.registerCompostables();
}

@SubscribeEvent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package growthcraft.apiary.init;

import growthcraft.apiary.shared.Reference;
import growthcraft.core.utils.CompostableUtils;
import growthcraft.lib.item.GrowthcraftItem;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
Expand Down Expand Up @@ -100,6 +101,12 @@ private GrowthcraftApiaryItems() {
/* Prevent default public constructor */
}

public static void registerCompostables() {
CompostableUtils.registerCompostable(HONEY_COMB_FULL.get(), CompostableUtils.COMPOSTABLE.HIGHEST);
CompostableUtils.registerCompostable(HONEY_COMB_EMPTY.get(), CompostableUtils.COMPOSTABLE.LOW);
CompostableUtils.registerCompostable(BEE.get(), CompostableUtils.COMPOSTABLE.HIGH);
}

public static boolean excludeItemRegistry(ResourceLocation registryName) {
ArrayList<String> excludeItems = new ArrayList<>();
//excludeItems.add(Reference.MODID + ":" + Reference.UnlocalizedName.APPLE_TREE_FRUIT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import growthcraft.apples.item.AppleSeedsItem;
import growthcraft.apples.shared.Reference;
import growthcraft.core.utils.CompostableUtils;
import growthcraft.lib.item.GrowthcraftItem;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.ComposterBlock;
Expand All @@ -23,13 +25,7 @@ public class GrowthcraftApplesItems {
);

public static void registerCompostables() {
float f = 0.3F;
float f1 = 0.5F;
float f2 = 0.65F;
float f3 = 0.85F;
float f4 = 1.0F;

ComposterBlock.COMPOSTABLES.put(GrowthcraftApplesItems.APPLE_SEEDS.get(), f1);
CompostableUtils.registerCompostable(GrowthcraftApplesItems.APPLE_SEEDS.get(), CompostableUtils.COMPOSTABLE.LOW);
}

public static boolean excludeItemRegistry(ResourceLocation registryName) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/growthcraft/bamboo/GrowthcraftBamboo.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private void clientSetupEvent(final FMLClientSetupEvent event) {
}

private void setup(final FMLCommonSetupEvent event) {
// Do Nothing for now ...
GrowthcraftBambooItems.registerCompostables();
}

@SubscribeEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,7 @@ public class GrowthcraftBambooItems {
);

public static void registerCompostables() {
float f = 0.3F;
float f1 = 0.5F;
float f2 = 0.65F;
float f3 = 0.85F;
float f4 = 1.0F;

// ComposterBlock.COMPOSTABLES.put(GrowthcraftRiceItems.RICE.get(), f2);

// Do nothing at this time.
}

public static boolean excludeItemRegistry(ResourceLocation registryName) {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/growthcraft/cellar/GrowthcraftCellar.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ private void clientSetupEvent(final FMLClientSetupEvent event) {

private void setup(final FMLCommonSetupEvent event) {
GrowthcraftCellarMessages.register();
GrowthcraftCellarItems.registerCompostables();
}

public void buildCreativeTabContents(BuildCreativeModeTabContentsEvent event) {
Expand Down
37 changes: 29 additions & 8 deletions src/main/java/growthcraft/cellar/init/GrowthcraftCellarItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import growthcraft.cellar.item.GrapeSeedsItem;
import growthcraft.cellar.item.HopsSeedsItem;
import growthcraft.cellar.shared.Reference;
import growthcraft.core.utils.CompostableUtils;
import growthcraft.lib.item.GrowthcraftFoodItem;
import growthcraft.lib.item.GrowthcraftItem;
import net.minecraft.resources.ResourceLocation;
Expand Down Expand Up @@ -69,7 +70,7 @@ public class GrowthcraftCellarItems {
Reference.UnlocalizedName.GRAPE_PURPLE, GrowthcraftFoodItem::new
);

public static final RegistryObject<GrapeSeedsItem> PURPLE_RED_SEEDS = ITEMS.register(
public static final RegistryObject<GrapeSeedsItem> GRAPE_PURPLE_SEEDS = ITEMS.register(
Reference.UnlocalizedName.GRAPE_SEEDS_PURPLE,
() -> new GrapeSeedsItem(
GrowthcraftCellarBlocks.PURPLE_GRAPE_VINE.get(),
Expand All @@ -93,7 +94,7 @@ public class GrowthcraftCellarItems {
Reference.UnlocalizedName.GRAPE_WHITE, GrowthcraftFoodItem::new
);

public static final RegistryObject<GrapeSeedsItem> WHITE_RED_SEEDS = ITEMS.register(
public static final RegistryObject<GrapeSeedsItem> GRAPE_WHITE_SEEDS = ITEMS.register(
Reference.UnlocalizedName.GRAPE_SEEDS_WHITE,
() -> new GrapeSeedsItem(
GrowthcraftCellarBlocks.WHITE_GRAPE_VINE.get(),
Expand Down Expand Up @@ -159,14 +160,34 @@ public class GrowthcraftCellarItems {
GRAIN_DEEP_COPPER, GRAIN_GOLDEN, GRAIN_PALE_GOLDEN
);

/**
* Registers the compostable items for GrowthcraftCellarItems.
*/
public static void registerCompostables() {
float f = 0.3F;
float f1 = 0.5F;
float f2 = 0.65F;
float f3 = 0.85F;
float f4 = 1.0F;

// ComposterBlock.COMPOSTABLES.put(GrowthcraftRiceItems.RICE.get(), f2);
for (RegistryObject<? extends Item> grain : GrowthcraftCellarItems.GRAINS) {
CompostableUtils.registerCompostable(grain.get(), CompostableUtils.COMPOSTABLE.HIGH);
}

CompostableUtils.registerCompostable(GRAIN.get(), CompostableUtils.COMPOSTABLE.NORMAL);

CompostableUtils.registerCompostable(GRAPE_PURPLE.get(), CompostableUtils.COMPOSTABLE.HIGHEST);
CompostableUtils.registerCompostable(GRAPE_RED.get(), CompostableUtils.COMPOSTABLE.HIGHEST);
CompostableUtils.registerCompostable(GRAPE_WHITE.get(), CompostableUtils.COMPOSTABLE.HIGHEST);
CompostableUtils.registerCompostable(GRAPE_PURPLE_SEEDS.get(), CompostableUtils.COMPOSTABLE.NORMAL);
CompostableUtils.registerCompostable(GRAPE_RED_SEEDS.get(), CompostableUtils.COMPOSTABLE.NORMAL);
CompostableUtils.registerCompostable(GRAPE_WHITE_SEEDS.get(), CompostableUtils.COMPOSTABLE.NORMAL);

CompostableUtils.registerCompostable(HOPS.get(), CompostableUtils.COMPOSTABLE.HIGHEST);
CompostableUtils.registerCompostable(HOPS_SEED.get(), CompostableUtils.COMPOSTABLE.NORMAL);

CompostableUtils.registerCompostable(YEAST_BAYANUS.get(), CompostableUtils.COMPOSTABLE.NORMAL);
CompostableUtils.registerCompostable(YEAST_BAYANUS_ETHEREAL.get(), CompostableUtils.COMPOSTABLE.HIGHEST);
CompostableUtils.registerCompostable(YEAST_BREWERS.get(), CompostableUtils.COMPOSTABLE.NORMAL);
CompostableUtils.registerCompostable(YEAST_BREWERS_ETHEREAL.get(), CompostableUtils.COMPOSTABLE.HIGHEST);
CompostableUtils.registerCompostable(YEAST_ETHEREAL.get(), CompostableUtils.COMPOSTABLE.HIGHEST);
CompostableUtils.registerCompostable(YEAST_LAGER.get(), CompostableUtils.COMPOSTABLE.NORMAL);
CompostableUtils.registerCompostable(YEAST_LAGER_ETHEREAL.get(), CompostableUtils.COMPOSTABLE.HIGHEST);

}

Expand Down
23 changes: 15 additions & 8 deletions src/main/java/growthcraft/milk/init/GrowthcraftMilkItems.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package growthcraft.milk.init;

import growthcraft.core.utils.CompostableUtils;
import growthcraft.lib.item.GrowthcraftBowlFoodItem;
import growthcraft.lib.item.GrowthcraftFoodItem;
import growthcraft.lib.item.GrowthcraftItem;
Expand Down Expand Up @@ -239,14 +240,20 @@ public class GrowthcraftMilkItems {
);

public static void registerCompostables() {
float f = 0.3F;
float f1 = 0.5F;
float f2 = 0.65F;
float f3 = 0.85F;
float f4 = 1.0F;

// ComposterBlock.COMPOSTABLES.put(GrowthcraftRiceItems.RICE.get(), f2);

CompostableUtils.registerCompostable(THISTLE.get(), CompostableUtils.COMPOSTABLE.HIGH);
CompostableUtils.registerCompostable(THISTLE_SEED.get(), CompostableUtils.COMPOSTABLE.NORMAL);
CompostableUtils.registerCompostable(STARTER_CULTURE.get(), CompostableUtils.COMPOSTABLE.LOW);
CompostableUtils.registerCompostable(CHEESE_APPENZELLER_SLICE.get(), CompostableUtils.COMPOSTABLE.HIGH);
CompostableUtils.registerCompostable(CHEESE_ASIAGO_SLICE.get(), CompostableUtils.COMPOSTABLE.HIGH);
CompostableUtils.registerCompostable(CHEESE_CASU_MARZU_SLICE.get(), CompostableUtils.COMPOSTABLE.HIGH);
CompostableUtils.registerCompostable(CHEESE_CHEDDAR_SLICE.get(), CompostableUtils.COMPOSTABLE.HIGH);
CompostableUtils.registerCompostable(CHEESE_EMMENTALER_SLICE.get(), CompostableUtils.COMPOSTABLE.HIGH);
CompostableUtils.registerCompostable(CHEESE_GORGONZOLA_SLICE.get(), CompostableUtils.COMPOSTABLE.HIGH);
CompostableUtils.registerCompostable(CHEESE_GOUDA_SLICE.get(), CompostableUtils.COMPOSTABLE.HIGH);
CompostableUtils.registerCompostable(CHEESE_MONTEREY_SLICE.get(), CompostableUtils.COMPOSTABLE.HIGH);
CompostableUtils.registerCompostable(CHEESE_PARMESAN_SLICE.get(), CompostableUtils.COMPOSTABLE.HIGH);
CompostableUtils.registerCompostable(CHEESE_PROVOLONE_SLICE.get(), CompostableUtils.COMPOSTABLE.HIGH);
CompostableUtils.registerCompostable(CHEESE_RICOTTA_SLICE.get(), CompostableUtils.COMPOSTABLE.HIGH);
}

public static boolean excludeItemRegistry(ResourceLocation registryName) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/growthcraft/rice/GrowthcraftRice.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private void clientSetupEvent(final FMLClientSetupEvent event) {
}

private void setup(final FMLCommonSetupEvent event) {
// Do Nothing for now ...
GrowthcraftRiceItems.registerCompostables();
}

public void buildCreativeTabContents(BuildCreativeModeTabContentsEvent event) {
Expand Down
24 changes: 12 additions & 12 deletions src/main/java/growthcraft/rice/init/GrowthcraftRiceItems.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package growthcraft.rice.init;

import growthcraft.core.utils.CompostableUtils;
import growthcraft.lib.item.GrowthcraftFoodItem;
import growthcraft.lib.item.GrowthcraftItem;
import growthcraft.rice.item.CultivatorItem;
Expand Down Expand Up @@ -54,18 +55,17 @@ public class GrowthcraftRiceItems {
);

public static void registerCompostables() {
float f = 0.3F;
float f1 = 0.5F;
float f2 = 0.65F;
float f3 = 0.85F;
float f4 = 1.0F;

// Add rice as a compostable
ComposterBlock.COMPOSTABLES.put(GrowthcraftRiceItems.RICE.get(), f2);
ComposterBlock.COMPOSTABLES.put(GrowthcraftRiceItems.RICE_COOKED.get(), f3);
ComposterBlock.COMPOSTABLES.put(GrowthcraftRiceItems.RICE_STALK.get(), f1);
ComposterBlock.COMPOSTABLES.put(GrowthcraftRiceItems.SUSHI_ROLL.get(), f4);
ComposterBlock.COMPOSTABLES.put(GrowthcraftRiceItems.YEAST_SEISHU.get(), f4);
// Add rice as a compostables
CompostableUtils.registerCompostable(
GrowthcraftRiceItems.RICE.get(), CompostableUtils.COMPOSTABLE.NORMAL);
CompostableUtils.registerCompostable(
GrowthcraftRiceItems.RICE_COOKED.get(), CompostableUtils.COMPOSTABLE.HIGH);
CompostableUtils.registerCompostable(
GrowthcraftRiceItems.RICE_STALK.get(), CompostableUtils.COMPOSTABLE.LOW);
CompostableUtils.registerCompostable(
GrowthcraftRiceItems.SUSHI_ROLL.get(), CompostableUtils.COMPOSTABLE.HIGHEST);
CompostableUtils.registerCompostable(
GrowthcraftRiceItems.YEAST_SEISHU.get(), CompostableUtils.COMPOSTABLE.HIGHEST);
}

public static boolean excludeItemRegistry(ResourceLocation registryName) {
Expand Down

0 comments on commit d76ba16

Please sign in to comment.