#texture not loading into game
1 messages · Page 1 of 1 (latest)
@vapid perch what part of the code do you want me to send
What texture do you create? Item, Block? The registration of that thing and all code related to the texture
item
So please send the item registration
package github.mmgxmer21.daggermod21;
import github.mmgxmer21.daggermod21.init.Iteminit;
import net.fabricmc.api.ModInitializer;
import net.minecraft.util.Identifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Dagger implements ModInitializer {
// This logger is used to write text to the console and the log file.
// It is considered best practice to use your mod id as the logger's name.
// That way, it's clear which mod wrote info, warnings, and errors.
public static final Logger LOGGER = LoggerFactory.getLogger("dagger");
public static final String MODID = "daggermod";
@Override
public void onInitialize() {
// This code runs as soon as Minecraft is in a mod-load-ready state.
// However, some things (like resources) may still be uninitialized.
// Proceed with mild caution.
LOGGER.info("Loading...");
Iteminit.load();
}
public static Identifier id(String path) {
return Identifier.of(MODID, path);
}
}
!!code
You can use codeblocks in discord as shown below:
```java
code
```
You can also specify the syntax highlighting to use by specifying the language after the last backtick (`) on the top.
Turty Wurty's tutorial?
I need the item init class as well
package github.mmgxmer21.daggermod21.init;
import github.mmgxmer21.daggermod21.Dagger;
import net.minecraft.item.Item;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import java.util.jar.Attributes;
public class Iteminit {
public static final Item DAGGER = register("dagger", new Item(new Item.Settings()));
public static <T extends Item> T register(String name, T item) {
return Registry.register(Registries.ITEM, Dagger.id(name), item );
}
public static void load() {}
}
please use the code block as shown by the bot next time.
its not letting me send
can you sennd an image of your assets folder, with the item png path
what's your mod id?
so the textures.item folders are outside the assets folder, to fix that drag them and releas when your cursor is on assets.daggermod21 then it will ask you if you want to refactor, confirm that you do
saw that too, but now the textures folder is not even correct
yeah it's outside of the mod namespace dir
Did you manage to move the folder?
launching in a sec
Will not work, because the namespace in code is daggermod but the foldername is daggermod21
. Yeah step by step
do you have the textures.item in the assets folder now?
yes
Now you modid is inconsistent,in your code you wrote daggermod, but your folders are daggermod21, simply change the value of MODID to "daggermod21" to make it work
yea i changed my mod id
now it should work
ok one more question
it works with pngs but how do you import a block bench model to work
for what reason do you need the block bench model?
i want it to look like this
Model jsons go into src/main/resources/assets/daggermod21/models/item
if your item texture is the same this isnt needed, simply register its model as handheld
If you want a specific model (that is not like the item) than you can follow kaupenjoe's tutorial for 3d models of 2d items: https://youtu.be/0OtQqtquxMM?list=PLKGarocXCE1EO43Dlf5JGh7Yk-kRAXUEJ
In this Minecraft Modding Tutorial, we are creating an item similar to the spyglass.
== MODDING COURSES ==
FORGE ▶️ https://url.kaupenjoe.net/CourseForge120X
FABRIC ▶️ https://url.kaupenjoe.net/CourseFabric120X
== COMPATIBILITY ==
✅ Compatible with 1.20, 1.20.1, 1.20.2
== ASSETS & DOWNLOAD LINKS ==
GitHub Repo: https://github.com/Tutori...
before i go into that because it looks hard
how do you make the attack speed faster
i made the damage higher
but i dont see anything for attackspeed
@vapid perch
checking
I see that SwordItem uses AttributeModifiersComponent.builder() and adds EntittyAttributes.GENERICATTACK_SPEED I reccomend you create a helper class that represents your item, DaggerItem
also the damage didnt actualy change
Implement in you helper class a fnction similar to this:
public static AttributeModifiersComponent createAttributeModifiers(ToolMaterial material, int baseAttackDamage, float attackSpeed) {
return AttributeModifiersComponent.builder()
.add(
EntityAttributes.GENERIC_ATTACK_DAMAGE,
new EntityAttributeModifier(
BASE_ATTACK_DAMAGE_MODIFIER_ID, (double)((float)baseAttackDamage + material.getAttackDamage()), EntityAttributeModifier.Operation.ADD_VALUE
),
AttributeModifierSlot.MAINHAND
)
.add(
EntityAttributes.GENERIC_ATTACK_SPEED,
new EntityAttributeModifier(BASE_ATTACK_SPEED_MODIFIER_ID, (double)attackSpeed, EntityAttributeModifier.Operation.ADD_VALUE),
AttributeModifierSlot.MAINHAND
)
.build();
}
like any class
im sorry im very very new to this
!!learnjava
To start modding Minecraft using Fabric, it's strongly recommended to know Java.
Minecraft, in its codebase, and mods, using Fabric API, use more advanced Java concepts like lambdas, generics and polymorphism.
If you don't know all of these concepts, you may have some difficulties modding.
Here are some online resources that will help learning Java
JetBrains Academy (free online course): https://www.jetbrains.com/academy/
Codecademy (free online course): https://www.codecademy.com/learn/learn-java
University of Helsinki (free online course): https://java-programming.mooc.fi/
Basic Java Tutorials: https://docs.oracle.com/javase/tutorial/
Introduction to Programming using Java by David J. Eck (free online textbook): http://math.hws.edu/javanotes/
After Learning Java
For most mods you will want to make, you will have to use the Spongepowered Mixin Java library.
To learn more about Mixin, you can use the faq/mixin bot tag by typing !!faq/mixin in #bot-posting .
where shold i make the class
add a folder near your iteminit called custom
add a class in the folder?
add a folder than inside it add a class
do i add the folder inside the init folder or not
in init
named it custom. class goes inside custom?
yeah its like that since that item is you custom item
okay now you simply make the class similar to SwordItem, do you know how to see mojang classes?
no
Simply write their name, tab to auto complete import and ctrl + click
mojangblock list supplier?
you can follow kaupenjoe's tutorial (realy recommend to use his tutorial) for advanced items, there instead of the use on block function you can add whatever functionality you want to your dagger (such as maybe giving poison)
SwordItem is the class
In this Minecraft Modding Tutorial for Fabric, we are adding custom Advanced Item to Minecraft 1.20. Basically an Item with a custom Item Class associated with it :)
== MODDING COURSES ==
FORGE ▶️ https://url.kaupenjoe.net/CourseForge120XLaunch
FABRIC ▶️ https://url.kaupenjoe.net/CourseFabric120XLaunch
== COMPATIBILITY ==
✅ Compatible with ...