Jump to content

Recommended Posts

Posted

Probably make it extend the class that already controls the trident.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
46 minutes ago, Draco18s said:

Probably make it extend the class that already controls the trident.

 

Yes I figured that, but then I need a parameter to put in the constructor for that (Properties builder), and I don't know which Properties to put. 

Posted
32 minutes ago, MineModder2000 said:

 

Yes I figured that, but then I need a parameter to put in the constructor for that (Properties builder), and I don't know which Properties to put. 

Check out what property vanilla Minecraft passed in and alter the values to your need.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Posted
31 minutes ago, DavidM said:

Check out what property vanilla Minecraft passed in and alter the values to your need.

Well it just gets the Properties from the Item.class, which is the start..... I had this already :

 

ItemList.spear = new Spear(new Item.Properties().group(ItemGroup.COMBAT)).setRegistryName(location("spear"))

 

Spear extends TridentItem, but still doesn't behave like it. I even tried making ItemList.spear a new TridentItem and that didn't work. 

Posted
4 hours ago, MineModder2000 said:

but still doesn't behave like it.

Describe behave. Does it not throw the item? Does it not render the item when thrown. Does it not show up at all?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
10 hours ago, Animefan8888 said:

Describe behave. Does it not throw the item? Does it not render the item when thrown. Does it not show up at all?

Can't throw it basically. It just acts like any other hand held, you can only attack with it. 

Posted

Show your code.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
Just now, Draco18s said:

Show your code.

package mymod;

import net.minecraft.item.TridentItem;

public class Spear extends TridentItem {

	public Spear(Properties builder) {
		
		super(builder);
	}
}
package lists;

import net.minecraft.item.Item;

public class ItemList {

	public static Item spear;
}
    @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
    public static class RegistryEvents {
    	
        @SubscribeEvent
        public static void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent) {
            // register a new block here
            LOGGER.info("HELLO from Register Block");
        }
        
        @SubscribeEvent
        public static void registerItems(final RegistryEvent.Register<Item> event) {
        	
        	LOGGER.info("HELLO from Register Items");
        	
        	event.getRegistry().registerAll(
        			
        		ItemList.spear = new Spear(new Item.Properties().group(ItemGroup.COMBAT)).setRegistryName(location("spear"))
        	);
        }
        
        private static ResourceLocation location(String name) {
        	
        	return new ResourceLocation("mymod", name);
        }
Posted
On 8/19/2019 at 12:44 PM, MineModder2000 said:

Can't throw it basically.

How did you test this? Did you stand right in front of the entity and right click to throw it?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
5 hours ago, Animefan8888 said:

How did you test this? Did you stand right in front of the entity and right click to throw it?

I tried throwing it at everything. The trident can be thrown whether you are aimed at an entity or not, so that shouldn't matter.

Posted (edited)

You need to set the max damage when registering the item. E.g. 

new Spear(new Item.Properties().group(group).maxDamage(250).setRegistryName(name))

 

Source: net.minecraft.item.Items

If you don't, the first if statement in TridentItem#onItemRightClick will trigger and return a FAIL.

Edited by TheMikeste1
  • Thanks 1
Posted
6 hours ago, TheMikeste1 said:

You need to set the max damage when registering the item. E.g. 


new Spear(new Item.Properties().group(group).maxDamage(250).setRegistryName(name))

 

Source: net.minecraft.item.Items

If you don't, the first if statement in TridentItem#onItemRightClick will trigger and return a FAIL.

May you be blessed with many fortunes, thanks a lot this worked!

Posted (edited)

Though it throws like a spear / trident now, still need some help with the model side of things, I just copied the trident.jsons, but clearly I need to more, probably with code.

 

Spear

Spoiler

{
    "parent": "item/generated",
    "textures": {
    
        "layer0": "mymod:item/spear"
    }
}

Spear_Throwing

Spoiler

{
    "parent": "builtin/entity",
    "textures": {
        "mymod:item/spear"
    },
    "display": {
        "thirdperson_righthand": {
            "rotation": [ 0, 90, 180 ],
            "translation": [ 8, -17, 9 ],
            "scale": [ 1, 1, 1 ]
        },
        "thirdperson_lefthand": {
            "rotation": [ 0, 90, 180 ],
            "translation": [ 8, -17, -7 ],
            "scale": [ 1, 1, 1 ]
        },
        "firstperson_righthand": {
            "rotation": [ 0, -90, 25 ],
            "translation": [ -3, 17, 1],
            "scale": [ 1, 1, 1 ]
        },
        "firstperson_lefthand": {
            "rotation": [ 0, 90, -25 ],
            "translation": [  13, 17, 1],
            "scale": [ 1, 1, 1 ]
        },
        "gui": {
            "rotation": [ 15, -25, -5 ],
            "translation": [ 2, 3, 0 ],
            "scale": [ 0.65, 0.65, 0.65 ]
        },
        "fixed": {
            "rotation": [ 0, 180, 0 ],
            "translation": [ -2, 4, -5],
            "scale":[ 0.5, 0.5, 0.5]
        },
        "ground": {
            "rotation": [ 0, 0, 0 ],
            "translation": [ 4, 4, 2],
            "scale":[ 0.25, 0.25, 0.25]
        }
    }
}

Spear_Hand

Spoiler

{
    "parent": "builtin/entity",
    "textures": {
        "mymod:item/spear"
    },
    "display": {
        "thirdperson_righthand": {
            "rotation": [ 0, 60, 0 ],
            "translation": [ 11, 17, -2 ],
            "scale": [ 1, 1, 1 ]
        },
        "thirdperson_lefthand": {
            "rotation": [ 0, 60, 0 ],
            "translation": [ 3, 17, 12 ],
            "scale": [ 1, 1, 1 ]
        },
        "firstperson_righthand": {
            "rotation": [ 0, -90, 25 ],
            "translation": [ -3, 17, 1],
            "scale": [ 1, 1, 1 ]
        },
        "firstperson_lefthand": {
            "rotation": [ 0, 90, -25 ],
            "translation": [ 13, 17, 1],
            "scale": [ 1, 1, 1 ]
        },
        "gui": {
            "rotation": [ 15, -25, -5 ],
            "translation": [ 2, 3, 0 ],
            "scale": [ 0.65, 0.65, 0.65 ]
        },
        "fixed": {
            "rotation": [ 0, 180, 0 ],
            "translation": [ -2, 4, -5],
            "scale":[ 0.5, 0.5, 0.5]
        },
        "ground": {
            "rotation": [ 0, 0, 0 ],
            "translation": [ 4, 4, 2],
            "scale":[ 0.25, 0.25, 0.25]
        }
    },
    "overrides": [
        {
            "predicate": {
                "throwing": 1
            },
            "model": "mymod:item/spear_throwing"
        }
    ]
}

 

It doesn't hold in the hand correctly, especially when primed for throwing in which its not even in the hand but well above. When I toss it, it turns into trident. 

Edited by MineModder2000
Posted
1 hour ago, TheMikeste1 said:

You'll need to make a special Renderer. Try taking a look at net.minecraft.client.renderer.entity.TridentRenderer to get started.

Okay so I can just extend or copy that class, but how do I link it to the item?

Posted (edited)

I'm not very familiar with Renderers, so it's probably best to get someone else's input.

If you dig around in Minecraft's files (as it seems you've done a couple posts prior), you'll notice there's a model/trident.json and a model/trident_in_hand.json. I assume  "in_hand" is the one representing the item you hold. You'll notice the parent is builtin/entity, which means it is using a registered Entity as a model. This means you'll need to create and register an Entity to serve as the model of your Item, as well as hold other important information. If you want to see vanilla example of creating Entities, check Minecraft's EntityType (You want to do this. There a a couple things I'm leaving out, such as defining hitboxes).

With Forge you register an Entity (or rather, an EntityType) a little differently than vanilla. It's basically the same as other Objects in Forge, and nearly identical to TileEntityTypes. Since I couldn't find any specific documentation on registering them, here's an example:

    //Entities
    @ObjectHolder("wabbit")
    public static final EntityType<WabbitEntity> wabbit = null;

    @SubscribeEvent
    public static void registerEntities(final RegistryEvent.Register<EntityType<?>> event) {
        LOGGER.debug("Wabbits: Registering Entities...");
        event.getRegistry().registerAll(
                EntityType.Builder.create(WabbitEntity::new, EntityClassification.AMBIENT)
                .build("wabbit").setRegistryName(Constants.MOD_ID, "wabbit");
        );
    } //registerEntities()

There are other files you'll likely want to create, such as a SpearModel (since it looks like you're making a spear). The best thing to do is just search "Trident" in you IDE and look at all the .java and .json files. Piece together what each thing does, and do your best to throw a spear together. You'll learn more as you go along and be able to come back to improve your spear.

EDIT: Also, note that when you make your Renderer, you'll also need to register it. you do that like this:

RenderingRegistry.registerEntityRenderingHandler(WabbitEntity.class, RenderWabbitFactory.INSTANCE);

The second value is a factory. Take a look at this for more info. (https://stackoverflow.com/questions/37126170/irenderfactory-help-in-minecraft-forge)

Edited by TheMikeste1
More details
Posted
12 hours ago, MineModder2000 said:

Bumpity bump bump. 

I think the Trident when held uses a TEISR(TileEntityItemRenderer). Which is attached via the Item Properties you provide in your constructor. As for when it is thrown that's an entity and you need to make your own entity and attach a renderer to it normally, You can probably just extend the TridentRenderer and override getEntityTexture.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
5 hours ago, Animefan8888 said:

I think the Trident when held uses a TEISR(TileEntityItemRenderer). Which is attached via the Item Properties you provide in your constructor. As for when it is thrown that's an entity and you need to make your own entity and attach a renderer to it normally, You can probably just extend the TridentRenderer and override getEntityTexture.

I looked through the vanilla files and the Trident Item class doesn't set it's own TileEntityitemRenderer. As far as extending / copying Trident Renderer, I already figured that, but I don't understand how to link my new Spear Renderer class to the Spear class / objects.

Posted
1 minute ago, MineModder2000 said:

I looked through the vanilla files and the Trident Item class doesn't set it's own TileEntityitemRenderer.

Adding them is a forge addon. Vanilla has them hard coded.

 

2 minutes ago, MineModder2000 said:

but I don't understand how to link my new Spear Renderer class to the Spear class / objects.

What? Spawn your own entity?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
24 minutes ago, Animefan8888 said:

Adding them is a forge addon. Vanilla has them hard coded.

 

What? Spawn your own entity?

Right but there is no class pertaining to Trident within net.minecraft.client.renderer.tileentity, only the Trident Render class within net.minecraft.client.renderer.entity. 

What I am asking is how do I attach or associate my Spear class with that extended Renderer class. 

Posted
3 minutes ago, MineModder2000 said:

Right but there is no class pertaining to Trident within net.minecraft.client.renderer.tileentity, only the Trident Render class

I wonder if it is in the ItemStackTileEntityRenderer class

 

4 minutes ago, MineModder2000 said:

What I am asking is how do I attach or associate my Spear class with that extended Renderer class.

 

7 hours ago, Animefan8888 said:

I think the Trident when held uses a TEISR(TileEntityItemRenderer). Which is attached via the Item Properties you provide in your constructor.

 

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
29 minutes ago, Animefan8888 said:

I wonder if it is in the ItemStackTileEntityRenderer class

 

 

 

Great what am I suppose to do with it? There is a private final trident (TridentModel()) in there. There is also an if statement that checks if it's a trident, and if it is, it sets the texture to the trident one, so know I see why that is. But I change this stuff.....

 

8 hours ago, Animefan8888 said:

I think the Trident when held uses a TEISR(TileEntityItemRenderer). Which is attached via the Item Properties you provide in your constructor. As for when it is thrown that's an entity and you need to make your own entity and attach a renderer to it normally, You can probably just extend the TridentRenderer and override getEntityTexture.

When I said extended Renderer class, I mean the TridentRenderer class. The setTEISR method in Item.Properties only accepts : Supplier<Callable<ItemStackTileEntityRenderer>>, can't pass an extended or copied version of that class. 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements




×
×
  • Create New...

Important Information

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