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

Gianka1485

Members
  • Posts

    52
  • Joined

  • Last visited

Everything posted by Gianka1485

  1. When you want a block to have a texture, it must have the following information (although it may vary): { "parent": "examplemod:block/example_block" }
  2. I was in the bathroom so I couldn't respond quickly, hahaha... I think the problem may come from the .json files of assets /% modid% / models / item
  3. I think you should do it the old way, you should register the item in the items initializer, example: public class GWorldItems { public static final DeferredRegister<Item> ITEMS; public static final RegistryObject<Item> EXAMPLE_DUST; public static final RegistryObject<Item> EXAMPLE_GEM; public static final RegistryObject<Item> EXAMPLE_BLOCK; static { ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, "examplemod"); EXAMPLE_DUST = ITEMS.register("example_dust", () -> { return new Item((new Properties()).tab(ExampleMod.examplemod)); }); EXAMPLE_GEM = ITEMS.register("example_gem", () -> { return new Item((new Properties()).tab(ExampleMod.examplemod)); }); EXAMPLE_BLOCK = ITEMS.register("example_ore", () -> { return new BlockItem((Block) ExampleBlocks.EXAMPLE_ORE.get(), (new Properties()).tab(ExampleMod.examplemod)); }); } } This is how it has always worked and will always work.
  4. But I remember some mods, which added that type of textures, I think I'll look inside their files, to see how they do it ...
  5. Just in case, the configuration files: The ExampleArmorTiers: public enum ExampleArmorMaterials implements ArmorMaterial { EXAMPLE("example", 200, new int[]{4, 7, 9, 4}, 30, SoundEvents.ARMOR_EQUIP_DIAMOND, 4.0F, 0.2F, () -> { return Ingredient.of(new ItemLike[]{(ItemLike) ExampleItems.EXAMPLE_GEM.get()}); }); private static final int[] baseDurability = new int[]{13, 15, 16, 11}; private final String name; private final int durabilityMultiplier; private final int[] slotProtections; private final int enchantmentValue; private final SoundEvent sound; private final float toughness; private final float knockBackResistance; private final Ingredient repairIngredient; private ExampleArmorMaterials(String name, int durabilityMultiplier, int[] defenseForSlot, int enchantmentValue, SoundEvent equipSound, float toughness, float knockBackResistance, Supplier<Ingredient> repairIngredient) { this.name = name; this.durabilityMultiplier = durabilityMultiplier; this.slotProtections = defenseForSlot; this.enchantmentValue = enchantmentValue; this.sound = equipSound; this.toughness = toughness; this.knockBackResistance = knockBackResistance; this.repairIngredient = (Ingredient) repairIngredient.get(); } public int getDurabilityForSlot(EquipmentSlot slot) { return baseDurability[slot.getIndex()] * this.durabilityMultiplier; } public int getDefenseForSlot(EquipmentSlot slot) { return this.slotProtections[slot.getIndex()]; } public int getEnchantmentValue() { return this.enchantmentValue; } public SoundEvent getEquipSound() { return this.sound; } public Ingredient getRepairIngredient() { return this.repairIngredient; } public String getName() { return ExampleMod.modid + ":" + this.name; } public float getToughness() { return this.toughness; } public float getKnockbackResistance() { return this.knockBackResistance; } } And the ExampleItems: public class ExampleItems { public static final DeferredRegister<Item> ITEMS; public static final RegistryObject<Item> EXAMPLE_DUST; public static final RegistryObject<Item> EXAMPLE_GEM; public static final RegistryObject<Item> EXAMPLE_ORE; public static final RegistryObject<ArmorItem> EXAMPLE_HELMET; public static final RegistryObject<ArmorItem> EXAMPLE_CHESTPLATE; public static final RegistryObject<ArmorItem> EXAMPLE_LEGGINGS; public static final RegistryObject<ArmorItem> EXAMPLE_BOOTS; public static final RegistryObject<AxeItem> EXAMPLE_AXE; public static final RegistryObject<HoeItem> EXAMPLE_HOE; public static final RegistryObject<PickaxeItem> EXAMPLE_PICKAXE; public static final RegistryObject<ShovelItem> EXAMPLE_SHOVEL; public static final RegistryObject<SwordItem> EXAMPLE_SWORD; static { ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, "examplemod"); EXAMPLE_DUST = ITEMS.register("example_dust", () -> { return new Item((new Properties()).tab(ExampleMod.examplemod)); }); EXAMPLE_GEM = ITEMS.register("example_gem", () -> { return new Item((new Properties()).tab(ExampleMod.examplemod)); }); EXAMPLE_ORE = ITEMS.register("example_ore", () -> { return new BlockItem((Block) ExampleBlocks.EXAMPLE_ORE.get(), (new Properties()).tab(ExampleMod.examplemod)); }); EXAMPLE_HELMET = ITEMS.register("example_helmet", () -> { return new ArmorItem(ExampleArmorMaterials.EXAMPLE, EquipmentSlot.HEAD, (new Properties()).tab(ExampleMod.examplemod)); }); EXAMPLE_CHESTPLATE = ITEMS.register("example_chestplate", () -> { return new ArmorItem(ExampleArmorMaterials.EXAMPLE, EquipmentSlot.CHEST, (new Properties()).tab(ExampleMod.examplemod)); }); EXAMPLE_LEGGINGS = ITEMS.register("example_leggings", () -> { return new ArmorItem(ExampleArmorMaterials.EXAMPLE, EquipmentSlot.LEGS, (new Properties()).tab(ExampleMod.examplemod)); }); EXAMPLE_BOOTS = ITEMS.register("example_boots", () -> { return new ArmorItem(ExampleArmorMaterials.EXAMPLE, EquipmentSlot.FEET, (new Properties()).tab(ExampleMod.examplemod)); }); EXAMPLE_AXE = ITEMS.register("example_axe", () -> { return new AxeItem(ExampleTiers.EXAMPLE_TOOL, 5.0F, -3.0F, (new Properties()).tab(ExampleMod.examplemod)); }); EXAMPLE_HOE = ITEMS.register("example_hoe", () -> { return new HoeItem(ExampleTiers.EXAMPLE_TOOL, -5, 0.0F, (new Properties()).tab(ExampleMod.examplemod)); }); EXAMPLE_PICKAXE = ITEMS.register("example_pickaxe", () -> { return new PickaxeItem(ExampleTiers.EXAMPLE_TOOL, 1, -2.8F, (new Properties()).tab(ExampleMod.examplemod)); }); EXAMPLE_SHOVEL = ITEMS.register("example_shovel", () -> { return new ShovelItem(ExampleTiers.EXAMPLE_TOOL, 1.5F, -3.0F, (new Properties()).tab(ExampleMod.examplemod)); }); EXAMPLE_SWORD = ITEMS.register("example_sword", () -> { return new SwordItem(ExampleTiers.EXAMPLE_TOOL, 3, -2.4F, (new Properties()).tab(ExampleMod.examplemod)); }); } }
  6. I made an armor which I want to change color, but when adding the texture, the texture in the game is bugged, not as if there is no texture, and obviously it does not change color, I think it is a problem with the .mcmeta files for animated textures, since if I change the texture to a normal one without animation then it works fine within the game. The .mcmeta files: { "animation": { "frametime": 1, "interpolate": false, "frames": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] } }
  7. I already explained to him in another thread, and he no longer has errors, it seems that they failed to tell him what information to put in "pickaxe.json" ... hahaha
  8. What surprised me the most was that it was using the same code that minecraft vanilla used, and it still crashed.
  9. After doing what diesieben07 said, the problem still continued, so I thought "what if we change the position of the axe variable so that it is not the first to be registered?" and boom, solved ...
  10. But it only happens with the ax, everything else works fine, the sword, the shovel, the pick, the hoe, I'm going to test what you say, see how it goes ...
  11. You must register the name of the object in your lang file, the id of the item and then the translation, example: { "block.examplemod.example_block": "Example block", "item.examplemod.example_item": "Example item", "itemgroup.examplemod": "Example Mod" } These are examples of translating a block, an item and a group of items in creative mode respectively. Lang files are normally named after the language type, for example, for US English it would be en_us.json, for English for England en_uk.json, for Spanish for Spain it would be es_es.json, you can find several examples if you unzip the file from version 1.17.1.jar, in practically the same folder, lang.
  12. I will do that, thank you very much, by the way, did it work?
  13. I'm also a very newbie, my programming knowledge is almost nil (or so it was before), I spent a whole month deciphering how variables, classes, int and float values worked, and other things, and after that, now I understand pretty good most of the code, but it was like 2 weeks trying to make an ore appear in the world, hahaha ... The good thing is that I am someone that if you explain with an example he will understand almost immediately, so I It seems good to explain to others, so that they do not go through the same difficulties that I went through ... haha
  14. You have to put as a value inside the files, it has to be in your case: mdg:ruby_block That is, your mod id followed by a colon ":" to then put the name of the object or block (Or the id of the item)
  15. I just opened a thread about that but no one has replied yet and I really don't know what to do ... haha
  16. By the way, in your case, you have the block registered in BlockInit, and I called it ModBlocks, forgive the confusion.
  17. But I think this can lead to problems later, such as problems creating tools.
  18. Delete it and leave it like this: @SubscribeEvent public static void registerItems(final RegistryEvent.Register<Item> event) { LOGGER.info("Hello from Register Item"); } The variable "LOGGER" only serves to guide me, so it is not necessary.
  19. I think that error is caused by the following line of code in the main class: @SubscribeEvent public static void onRegisterItems(final RegistryEvent.Register<Item> event) { BlockInit.BLOCKS.getEntries().stream().map(RegistryObject::get).forEach(block -> { event.getRegistry().register(new BlockItem(block, new Item.Properties().tab(CreativeModeTab.TAB_MISC)) .setRegistryName(block.getRegistryName())); }); }
  20. After seeing your work, you must also create the properties of the block, but as an item, example: public class ItemInit { public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MDG.MOD_ID); public static final RegistryObject<Item> RUBY = ITEMS.register("ruby", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MATERIALS))); public static final RegistryObjet<Item> RUBY_BLOCK = ITEMS.register("ruby_block", () -> new BlockItem((Block) ModBlocks.RUBY_BLOCK.get(), (new Item.Properties()).tab(CreativeModeTab.TAB_BUILDING_BLOCKS)); } And if it still does not appear, create a folder where you save the mod elements, called a block, and inside you put the information of the block. Example: package com.sotsuu.mdg.core.blocks; public class RubyBlock extends Block { public RubyBlock(Properties properties) { super(properties); } }
  21. And as for the textures, the information for the block to use a specific texture is saved in a .json file that is stored in src / main / resources / assets /% modid% / blockstates (example: example_ore.json) With the following information: { "variants": { "": { "model": "examplemod:block/example_ore" } } } Just for the blocks. And you need to save another .json file which will recognize the texture in src / main / resources / assets /% modid% / models / blocks (example: example_ore.json) (The information stored varies depending on what you want to use as a texture, whether you need one texture to cover all 6 faces, or just one on the top and a different one on the bottom). And you also need to create another .json file stored in src / main / resources / assets /% modid% / models / items for the block texture when in player inventory. (example: example_ore.json) Generally, you use the following information, but it can also vary: { "parent": "examplemod:block/example_ore" }
  22. You have to create a "loot table" of the block stored in src / main / resources / data /% modid% / loot_tables / blocks /% block_name%.json with the information you need depending on your needs (such as flowers, plants, etc), normally generator loot tables are used. If you want the block to be broken by a spike, then you create a file called "needs_% material_tool_need% _tool.json" (example: needs_diamond_tool.json, needs_wood_tool.json) and inside you enter the following values: { "replace": false, "values": [ "examplemod:example_ore" ] } For instance. (The file is stored in src / main / resources / data / minecraft / tags / blocks ) And you also need a file that specifies what kind of tool it will use, for example: pickaxe.json (With the same information I gave as an example before.) And it has to be located in src / main / resources / data / minecraft / tags / blocks / mineable. And that's it.
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.