#texture not loading into game

1 messages · Page 1 of 1 (latest)

vapid perch
#

code/

jovial stone
#

@vapid perch what part of the code do you want me to send

vapid perch
#

What texture do you create? Item, Block? The registration of that thing and all code related to the texture

jovial stone
#

item

vapid perch
#

So please send the item registration

jovial stone
#

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);
}

}

vapid perch
#

!!code

stiff flaxBOT
#

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.

vapid perch
#

Turty Wurty's tutorial?

jovial stone
#

yep

#

1.21

vapid perch
#

I need the item init class as well

jovial stone
#

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() {}

}

vapid perch
#

please use the code block as shown by the bot next time.

jovial stone
#

its not letting me send

vapid perch
#

can you sennd an image of your assets folder, with the item png path

jovial stone
wispy mauve
#

what's your mod id?

vapid perch
#

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

vapid perch
wispy mauve
#

yeah it's outside of the mod namespace dir

vapid perch
#

Did you manage to move the folder?

jovial stone
#

launching in a sec

twilit folio
#

Will not work, because the namespace in code is daggermod but the foldername is daggermod21

vapid perch
jovial stone
#

im back

#

lost my texture

#

then found it

vapid perch
#

do you have the textures.item in the assets folder now?

jovial stone
#

yes

vapid perch
#

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

jovial stone
#

yea i changed my mod id

vapid perch
#

now it should work

jovial stone
#

ok one more question

#

it works with pngs but how do you import a block bench model to work

vapid perch
#

for what reason do you need the block bench model?

jovial stone
#

i want it to look like this

twilit folio
#

Model jsons go into src/main/resources/assets/daggermod21/models/item

vapid perch
#

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...

▶ Play video
jovial stone
#

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

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

jovial stone
#

also the damage didnt actualy change

vapid perch
#

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();
    }
jovial stone
#

so umm'

#

how do you make a helper class

vapid perch
#

like any class

jovial stone
#

im sorry im very very new to this

vapid perch
#

!!learnjava

stiff flaxBOT
#

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 .

jovial stone
#

where shold i make the class

vapid perch
#

add a folder near your iteminit called custom

jovial stone
#

add a class in the folder?

vapid perch
#

add a folder than inside it add a class

jovial stone
#

do i add the folder inside the init folder or not

vapid perch
#

in init

jovial stone
#

named it custom. class goes inside custom?

vapid perch
#

yeah its like that since that item is you custom item

jovial stone
#

ok\

#

im in the class

vapid perch
#

okay now you simply make the class similar to SwordItem, do you know how to see mojang classes?

jovial stone
#

no

vapid perch
#

Simply write their name, tab to auto complete import and ctrl + click

jovial stone
#

mojangblock list supplier?

vapid perch
#

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)

vapid perch
#

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 ...

▶ Play video