Skip to content

Commit

Permalink
Re-implement opt-in stick variants
Browse files Browse the repository at this point in the history
  • Loading branch information
ACGaming committed Oct 6, 2024
1 parent 97ccb81 commit fe17296
Show file tree
Hide file tree
Showing 32 changed files with 416 additions and 22 deletions.
3 changes: 3 additions & 0 deletions src/main/java/com/progwml6/natura/common/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ public static boolean syncConfig()
generateGlowshroomtree = configFile.get(ENABLE_DISABLE, "Generate Glowshroom Trees", generateGlowshroomtree).getBoolean(generateGlowshroomtree);
dropCotton = configFile.get(ENABLE_DISABLE, "Drop cotton seeds from grass", dropCotton).getBoolean(dropCotton);
dropBarley = configFile.get(ENABLE_DISABLE, "Drop barley seeds from grass", dropBarley).getBoolean(dropBarley);
enableStickVariants = configFile.get(ENABLE_DISABLE, "Enable stick variants", enableStickVariants).getBoolean(enableStickVariants);
try
{
Class.forName("chococraft.common.ModChocoCraft");
Expand Down Expand Up @@ -444,6 +445,8 @@ public static boolean syncConfig()
public static boolean dropBarley = true;
public static boolean dropCotton = true;

public static boolean enableStickVariants = false;

public static int[] overworldWorldGenBlacklist = new int[] {};
public static int[] netherWorldGenBlacklist = new int[] {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public class ItemIDFixer implements IFixableData
// Initialize the item mappings
ITEM_NAME_MAPPINGS.put(new ResourceLocation(Natura.modID, "empty_bowls"), new ResourceLocation("minecraft", "bowl"));
ITEM_NAME_MAPPINGS.put(new ResourceLocation(Natura.modID, "soups"), new ResourceLocation("minecraft", "mushroom_stew"));
ITEM_NAME_MAPPINGS.put(new ResourceLocation(Natura.modID, "sticks"), new ResourceLocation("minecraft", "stick"));
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/progwml6/natura/oredict/NaturaOredict.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ private static void registerCommons() {

oredict(NaturaCommons.sulfurPowder, "dustSulphur");
oredict(NaturaCommons.sulfurPowder, "dustSulfur");

oredict(NaturaCommons.sticks, "stickWood");
}

private static void registerOverworld() {
Expand Down
17 changes: 9 additions & 8 deletions src/main/java/com/progwml6/natura/shared/CommonsClientProxy.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
package com.progwml6.natura.shared;

import com.progwml6.natura.common.ClientProxy;
import com.progwml6.natura.common.config.Config;

import static com.progwml6.natura.common.ModelRegisterUtil.registerItemBlockMeta;
import static com.progwml6.natura.common.ModelRegisterUtil.registerItemModel;
import static com.progwml6.natura.shared.NaturaCommons.berryMedley;
import static com.progwml6.natura.shared.NaturaCommons.boneMealBag;
import static com.progwml6.natura.shared.NaturaCommons.clouds;
import static com.progwml6.natura.shared.NaturaCommons.edibles;
import static com.progwml6.natura.shared.NaturaCommons.glowshroom_stew;
import static com.progwml6.natura.shared.NaturaCommons.materials;
import static com.progwml6.natura.shared.NaturaCommons.seed_bags;
import com.progwml6.natura.common.ClientProxy;
import static com.progwml6.natura.shared.NaturaCommons.*;

public class CommonsClientProxy extends ClientProxy
{
Expand All @@ -28,6 +24,11 @@ protected void registerModels()
edibles.registerItemModels();
seed_bags.registerItemModels();

if (Config.enableStickVariants)
{
sticks.registerItemModels();
}

registerItemModel(berryMedley);
registerItemModel(boneMealBag);
registerItemModel(glowshroom_stew);
Expand Down
68 changes: 55 additions & 13 deletions src/main/java/com/progwml6/natura/shared/NaturaCommons.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
package com.progwml6.natura.shared;

import org.apache.logging.log4j.Logger;

import com.google.common.eventbus.Subscribe;
import com.progwml6.natura.Natura;
import com.progwml6.natura.common.CommonProxy;
import com.progwml6.natura.common.NaturaPulse;
import com.progwml6.natura.library.Util;
import com.progwml6.natura.shared.block.clouds.BlockCloud;
import com.progwml6.natura.shared.item.bags.ItemBoneBag;
import com.progwml6.natura.shared.item.bags.ItemSeedBag;
import com.progwml6.natura.shared.item.food.ItemNaturaEdible;
import com.progwml6.natura.shared.item.food.ItemNaturaEdibleSoup;

import org.apache.logging.log4j.Logger;
import net.minecraft.block.Block;
import net.minecraft.block.BlockCrops;
import net.minecraft.block.BlockNetherWart;
Expand All @@ -29,6 +18,17 @@
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.registries.IForgeRegistry;

import com.progwml6.natura.Natura;
import com.progwml6.natura.common.CommonProxy;
import com.progwml6.natura.common.NaturaPulse;
import com.progwml6.natura.common.config.Config;
import com.progwml6.natura.library.Util;
import com.progwml6.natura.shared.block.clouds.BlockCloud;
import com.progwml6.natura.shared.item.bags.ItemBoneBag;
import com.progwml6.natura.shared.item.bags.ItemSeedBag;
import com.progwml6.natura.shared.item.food.ItemNaturaEdible;
import com.progwml6.natura.shared.item.food.ItemNaturaEdibleSoup;
import slimeknights.mantle.item.ItemMetaDynamic;
import slimeknights.mantle.pulsar.pulse.Pulse;

Expand All @@ -54,6 +54,7 @@ public class NaturaCommons extends NaturaPulse
public static ItemNaturaEdible edibles;
public static ItemSeedBag seed_bags;
public static ItemBoneBag boneMealBag;
public static ItemMetaDynamic sticks;

// Material Itemstacks
public static ItemStack barley;
Expand Down Expand Up @@ -96,7 +97,21 @@ public class NaturaCommons extends NaturaPulse
public static ItemStack carrots_seed_bag;
public static ItemStack potatoes_seed_bag;
public static ItemStack nether_wart_seed_bag;


//Wood Sticks
public static ItemStack maple_stick;
public static ItemStack silverbell_stick;
public static ItemStack amaranth_stick;
public static ItemStack tiger_stick;
public static ItemStack willow_stick;
public static ItemStack eucalyptus_stick;
public static ItemStack hopseed_stick;
public static ItemStack sakura_stick;
public static ItemStack redwood_stick;
public static ItemStack ghostwood_stick;
public static ItemStack darkwood_stick;
public static ItemStack fusewood_stick;
public static ItemStack bloodwood_stick;
//@formatter:on

@SubscribeEvent
Expand Down Expand Up @@ -132,6 +147,12 @@ public void registerItems(Register<Item> event)
ghostwoodFletching = materials.addMeta(5, "ghostwood_fletching");
blueDye = materials.addMeta(8, "blue_dye");

if (Config.enableStickVariants)
{
sticks = registerItem(registry, new ItemMetaDynamic(), "sticks");
sticks.setCreativeTab(Natura.TAB);
}

if (isEntitiesLoaded())
{
impLeather = materials.addMeta(6, "imp_leather");
Expand Down Expand Up @@ -170,6 +191,27 @@ public void registerItems(Register<Item> event)
nether_wart_seed_bag = seed_bags.addMeta(3, "nether_wart_seed_bag", Blocks.NETHER_WART.getDefaultState().withProperty(BlockNetherWart.AGE, Integer.valueOf(0)));

boneMealBag = registerItem(registry, new ItemBoneBag(), "bonemeal_bag");

if (isOverworldLoaded() && Config.enableStickVariants)
{
maple_stick = sticks.addMeta(0, "maple_stick");
silverbell_stick = sticks.addMeta(1, "silverbell_stick");
amaranth_stick = sticks.addMeta(2, "amaranth_stick");
tiger_stick = sticks.addMeta(3, "tiger_stick");
willow_stick = sticks.addMeta(4, "willow_stick");
eucalyptus_stick = sticks.addMeta(5, "eucalyptus_stick");
hopseed_stick = sticks.addMeta(6, "hopseed_stick");
sakura_stick = sticks.addMeta(7, "sakura_stick");
redwood_stick = sticks.addMeta(8, "redwood_stick");
}

if (isNetherLoaded() && Config.enableStickVariants)
{
ghostwood_stick = sticks.addMeta(9, "ghostwood_stick");
darkwood_stick = sticks.addMeta(10, "darkwood_stick");
fusewood_stick = sticks.addMeta(11, "fusewood_stick");
bloodwood_stick = sticks.addMeta(12, "bloodwood_stick");
}
}

@SubscribeEvent
Expand Down
22 changes: 22 additions & 0 deletions src/main/resources/assets/natura/blockstates/sticks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"forge_marker": 1,
"defaults": {
"transform": "forge:default-item",
"model": "forge:item-layer"
},
"variants": {
"maple_stick": [{ "textures": { "layer0": "natura:items/sticks/maple_stick" }}],
"silverbell_stick": [{ "textures": { "layer0": "natura:items/sticks/silverbell_stick" }}],
"amaranth_stick": [{ "textures": { "layer0": "natura:items/sticks/amaranth_stick" }}],
"tiger_stick": [{ "textures": { "layer0": "natura:items/sticks/tiger_stick" }}],
"willow_stick": [{ "textures": { "layer0": "natura:items/sticks/willow_stick" }}],
"eucalyptus_stick": [{ "textures": { "layer0": "natura:items/sticks/eucalyptus_stick" }}],
"hopseed_stick": [{ "textures": { "layer0": "natura:items/sticks/hopseed_stick" }}],
"sakura_stick": [{ "textures": { "layer0": "natura:items/sticks/sakura_stick" }}],
"redwood_stick": [{ "textures": { "layer0": "natura:items/sticks/redwood_stick" }}],
"ghostwood_stick": [{ "textures": { "layer0": "natura:items/sticks/ghostwood_stick" }}],
"darkwood_stick": [{ "textures": { "layer0": "natura:items/sticks/darkwood_stick" }}],
"fusewood_stick": [{ "textures": { "layer0": "natura:items/sticks/fusewood_stick" }}],
"bloodwood_stick": [{ "textures": { "layer0": "natura:items/sticks/bloodwood_stick" }}]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"conditions": [
{
"type": "natura:is_pulse_loaded",
"pulse_name": "NaturaNether"
}
],
"type": "minecraft:crafting_shaped",
"group": "natura:nether_sticks",
"pattern": [
"A ",
" A"
],
"key": {
"A": {
"item": "natura:nether_planks",
"data": 1
}
},
"result": {
"item": "natura:sticks",
"count": 4,
"data": 12
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"conditions": [
{
"type": "natura:is_pulse_loaded",
"pulse_name": "NaturaNether"
}
],
"type": "minecraft:crafting_shaped",
"group": "natura:nether_sticks",
"pattern": [
"A ",
" A"
],
"key": {
"A": {
"item": "natura:nether_planks",
"data": 2
}
},
"result": {
"item": "natura:sticks",
"count": 4,
"data": 10
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"conditions": [
{
"type": "natura:is_pulse_loaded",
"pulse_name": "NaturaNether"
}
],
"type": "minecraft:crafting_shaped",
"group": "natura:nether_sticks",
"pattern": [
"A ",
" A"
],
"key": {
"A": {
"item": "natura:nether_planks",
"data": 3
}
},
"result": {
"item": "natura:sticks",
"count": 4,
"data": 11
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"conditions": [
{
"type": "natura:is_pulse_loaded",
"pulse_name": "NaturaNether"
}
],
"type": "minecraft:crafting_shaped",
"group": "natura:nether_sticks",
"pattern": [
"A ",
" A"
],
"key": {
"A": {
"item": "natura:nether_planks",
"data": 0
}
},
"result": {
"item": "natura:sticks",
"count": 4,
"data": 9
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"conditions": [
{
"type": "natura:is_pulse_loaded",
"pulse_name": "NaturaOverworld"
}
],
"type": "minecraft:crafting_shaped",
"group": "natura:overworld_sticks",
"pattern": [
"A ",
" A"
],
"key": {
"A": {
"item": "natura:overworld_planks",
"data": 2
}
},
"result": {
"item": "natura:sticks",
"count": 4,
"data": 2
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"conditions": [
{
"type": "natura:is_pulse_loaded",
"pulse_name": "NaturaOverworld"
}
],
"type": "minecraft:crafting_shaped",
"group": "natura:overworld_sticks",
"pattern": [
"A ",
" A"
],
"key": {
"A": {
"item": "natura:overworld_planks",
"data": 5
}
},
"result": {
"item": "natura:sticks",
"count": 4,
"data": 5
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"conditions": [
{
"type": "natura:is_pulse_loaded",
"pulse_name": "NaturaOverworld"
}
],
"type": "minecraft:crafting_shaped",
"group": "natura:overworld_sticks",
"pattern": [
"A ",
" A"
],
"key": {
"A": {
"item": "natura:overworld_planks",
"data": 6
}
},
"result": {
"item": "natura:sticks",
"count": 4,
"data": 6
}
}
Loading

0 comments on commit fe17296

Please sign in to comment.