Jump to content

[1.14.4] Making a Trident like item


MineModder2000

Recommended Posts

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.

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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);
        }
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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




  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • If you're seeking an unparalleled solution to recover lost or stolen cryptocurrency, let me introduce you to GearHead Engineers Solutions. Their exceptional team of cybersecurity experts doesn't just restore your funds; they restore your peace of mind. With a blend of cutting-edge technology and unparalleled expertise, GearHead Engineers swiftly navigates the intricate web of the digital underworld to reclaim what's rightfully yours. In your moment of distress, they become your steadfast allies, guiding you through the intricate process of recovery with transparency, trustworthiness, and unwavering professionalism. Their team of seasoned web developers and cyber specialists possesses the acumen to dissect the most sophisticated schemes, leaving no stone unturned in their quest for justice. They don't just stop at recovering your assets; they go the extra mile to identify and track down the perpetrators, ensuring they face the consequences of their deceitful actions. What sets  GearHead Engineers apart is not just their technical prowess, but their unwavering commitment to their clients. From the moment you reach out to them, you're met with compassion, understanding, and a resolute determination to right the wrongs inflicted upon you. It's not just about reclaiming lost funds; it's about restoring faith in the digital landscape and empowering individuals to reclaim control over their financial futures. If you find yourself ensnared in the clutches of cybercrime, don't despair. Reach out to GearHead Engineers and let them weave their magic. With their expertise by your side, you can turn the tide against adversity and emerge stronger than ever before. In the realm of cybersecurity, GearHead Engineers reigns supreme. Don't just take my word for it—experience their unparalleled excellence for yourself. Your journey to recovery starts here.
    • Ok so this specific code freezes the game on world creation. This is what gets me so confused, i get that it might not be the best thing, but is it really so generation heavy?
    • Wizard web recovery has exhibited unparalleled strength in the realm of recovery. They stand out as the premier team to collaborate with if you encounter withdrawal difficulties from the platform where you’ve invested. Recently, I engaged with them to recover over a million dollars trapped in an investment platform I’d been involved with for months. I furnished their team with every detail of the investment, including accounts, names, and wallet addresses to which I sent the funds. This decision proved to be the best I’ve made, especially after realizing the company had scammed me.   Wizard web recovery ensures exemplary service delivery and ensures the perpetrators face justice. They employ advanced techniques to ensure you regain access to your funds. Understandably, many individuals who have fallen victim to investment scams may still regret engaging in online services again due to the trauma of being scammed. However, I implore you to take action. Seek assistance from Wizard Web Recovery today and witness their remarkable capabilities. I am grateful that I resisted their enticements, and despite the time it took me to discover Wizard web recovery, they ultimately fulfilled my primary objective. Without wizard web recovery intervention, I would have remained despondent and perplexed indefinitely.
    • I've tested the same code on three different envionrments (Desktop win10, desktop Linux and Laptop Linux) and it kinda blows up all the same. Gonna try this code and see if i can tune it
  • Topics

×
×
  • Create New...

Important Information

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