Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Spacerulerwill

Members
  • Posts

    6
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Spacerulerwill's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Hello! I am making a special pickaxe made out of crimson wood. What's the best way to make a recipe so when you make a wooden pickaxe out of crimson planks, it gives you my pickaxe instead of a generic wooden one. I would like it to be other mod compatible too.
  2. Hello, does anyone know how I can generate my block, some crystals, in caves. I have tried generating it as an ore in 1 block veins but I would like my crystals to only spawn on cave floors and not inside chunks of stone like most ores do. Sort of like how grass or flowers generates in plains biomes. I am very clueless, any help is appreciated
  3. I have tried to copy the code for the wheat thing exactly as in the documentation, just to see If I can get it to work on anything and it doesn't work. All I have changed is the name of the registry event to tattered_book_dungeons in prep for when I make it affect the dungeons, and the class names to TatteredBookModifier. Do apply is not being called, i tested using a print. @EventBusSubscriber(modid = mod_id, bus = EventBusSubscriber.Bus.MOD) public static class EventHandlers { @SubscribeEvent public static void registerModifierSerializers(@Nonnull final RegistryEvent.Register<GlobalLootModifierSerializer<?>> event) { if (ENABLE) { event.getRegistry().register( new TatteredBookModifier.Serializer().setRegistryName(new ResourceLocation(mod_id,"tattered_book_dungeons")) ); } } } private static class TatteredBookModifier extends LootModifier { private final int numSeedsToConvert; private final Item itemToCheck; private final Item itemReward; public TatteredBookModifier(ILootCondition[] conditionsIn, int numSeeds, Item itemCheck, Item reward) { super(conditionsIn); numSeedsToConvert = numSeeds; itemToCheck = itemCheck; itemReward = reward; } @Nonnull @Override public List<ItemStack> doApply(List<ItemStack> generatedLoot, LootContext context) { // // Additional conditions can be checked, though as much as possible should be parameterized via JSON data. // It is better to write a new ILootCondition implementation than to do things here. // System.out.println("BRUHHHH"); int numSeeds = 0; for(ItemStack stack : generatedLoot) { if(stack.getItem() == itemToCheck) numSeeds+=stack.getCount(); } if(numSeeds >= numSeedsToConvert) { generatedLoot.removeIf(x -> x.getItem() == itemToCheck); generatedLoot.add(new ItemStack(itemReward, (numSeeds/numSeedsToConvert))); numSeeds = numSeeds%numSeedsToConvert; if(numSeeds > 0) generatedLoot.add(new ItemStack(itemToCheck, numSeeds)); } return generatedLoot; } private static class Serializer extends GlobalLootModifierSerializer<TatteredBookModifier> { @Override public TatteredBookModifier read(ResourceLocation name, JsonObject object, ILootCondition[] conditionsIn) { int numSeeds = JSONUtils.getInt(object, "numSeeds"); Item seed = ForgeRegistries.ITEMS.getValue(new ResourceLocation((JSONUtils.getString(object, "seedItem")))); Item wheat = ForgeRegistries.ITEMS.getValue(new ResourceLocation(JSONUtils.getString(object, "replacement"))); return new TatteredBookModifier(conditionsIn, numSeeds, seed, wheat); } @Override public JsonObject write(TatteredBookModifier instance) { // TODO Auto-generated method stub return null; } } } { "replace": false, "entries": [ "spacerulerwillmagicmod:tattered_book_dungeons" ] } { "conditions": [ { "condition": "minecraft:match_tool", "predicate": { "item": "minecraft:shears" } }, { "condition": "block_state_property", "block":"minecraft:wheat" } ], "seedItem": "minecraft:wheat_seeds", "numSeeds": 10, "replacement": "minecraft:wheat" } Maybe my JSON files are stored in the wrong directory?
  4. At the moment doApply is not being called, I'm going to copy exactly how the wheat one works and see If i can get that to work.
  5. Well okay but I removed all my main Java code Here is my global_loot_modifiers.json { "replace": false, "entries": [ "spacerulerwillmagicmod:tatted_book_dungeons" ] } { "conditions": [ { "condition": "minecraft:match_tool", "predicate": { "item": "minecraft:shears" } }, { "condition": "block_state_property", "block":"minecraft:wheat" } ], "seedItem": "minecraft:wheat_seeds", "numSeeds": 3, "replacement": "minecraft:wheat" } Here is my other JSON. You'll immediately notice it has nothing to do with dungeons, thats because I copied it straight from the docs. I don't know how to change the condition to make it affect a simple dungeon chest and my json doesn't have like an autocorrect when you start typing so I didn't know if what I tried would change anything at all. I also looked for the simple dungeon loot table in the game files to help me, but I couldn't find it it seems to be in a different place than all the other structures. I have basically emptied the java code of anything so they are like empty methods at the moment. I do not know how to make it related to simple dungeons public static class EventHandlers { @SubscribeEvent public static void registerModifierSerializers(@Nonnull final RegistryEvent.Register<GlobalLootModifierSerializer<?>> event) { if (ENABLE) { event.getRegistry().register( new TatteredBookModifier.Serializer().setRegistryName(new ResourceLocation(mod_id, "tattered_book_dungeons")) ); } } } private static class TatteredBookModifier extends LootModifier { public TatteredBookModifier(ILootCondition[] conditionsIn) { super(conditionsIn); } @Nonnull @Override public List<ItemStack> doApply(List<ItemStack> generatedLoot, LootContext context) { return generatedLoot; } private static class Serializer extends GlobalLootModifierSerializer<TatteredBookModifier> { @Override public TatteredBookModifier read(ResourceLocation name, JsonObject object, ILootCondition[] conditionsIn) { return new TatteredBookModifier(conditionsIn); } @Override public JsonObject write(TatteredBookModifier instance) { // TODO Auto-generated method stub return null; } } }
  6. Hello I feel like I have been looking forever now, I am attempting to make my item spawn in simple mob spawner dungeons and need help. I know I have to use global loot modifiers and have tried using the forge documentation but I cannot make any sense of it and would really appreciate some help. HELPP
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.