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

    • Ngamenslot adalah pilihan terbaik bagi Anda yang mencari situs terpercaya untuk bermain slot dan taruhan bola. Berikut adalah beberapa alasan mengapa Anda harus memilih Ngamenslot: Kombinasi Slot & Bola Kami menyajikan kombinasi terbaik antara permainan slot yang seru dan taruhan bola yang menegangkan. Dengan pilihan permainan yang beragam, setiap pemain dapat menikmati pengalaman bermain yang unik dan menyenangkan. Transaksi Mudah melalui Bank Ekonomi Kami menyediakan layanan transaksi yang mudah dan aman melalui Bank Ekonomi. Dengan dukungan dari sistem pembayaran yang terpercaya, Anda dapat melakukan deposit dan penarikan dana dengan cepat dan tanpa hambatan. Terpercaya dan Terjamin Ngamenslot telah terbukti sebagai situs terpercaya dengan ribuan pemain yang puas. Kami mengutamakan keamanan dan kenyamanan para pemain, sehingga Anda dapat bermain dengan tenang dan fokus pada permainan.  
    • Tambang88 adalah pilihan terbaik bagi Anda yang mencari pengalaman bermain slot gacor dengan transaksi mudah menggunakan Bank Sinarmas. Berikut adalah beberapa alasan mengapa Anda harus memilih Tambang88: Raja Slot Gacor Kami merupakan raja slot gacor dengan koleksi permainan terbaik yang menawarkan kesenangan bermain dan peluang kemenangan besar. Dengan fitur-fitur unggulan dan tema-tema menarik, setiap putaran permainan akan memberikan Anda pengalaman yang tak terlupakan. Transaksi Mudah dengan Bank Sinarmas Kami menyediakan layanan transaksi mudah melalui Bank Sinarmas untuk kenyamanan dan keamanan Anda. Dengan proses yang cepat dan efisien, Anda dapat melakukan deposit dan penarikan dana dengan lancar dan tanpa hambatan. Profesional dan Menguntungkan Tambang88 mengutamakan profesionalitas dalam memberikan layanan kepada para pemainnya. Kami juga menawarkan kesempatan untuk meraih keuntungan yang besar dengan jackpot dan hadiah-hadiah menarik lainnya.    
    • TRIK POLA SL0T GAC0R MAHJONG WAYS 1 DAN 2 HARI INI Sekarang Anda dapat meningkatkan peluang Bermain dengan langsung menggunakan situs resmi dari permainan Mahjong (PG SOFT). Cukup daftar dan siapkan hanya mulai dari 50K hingga 200K, Anda sudah memiliki peluang untuk memenangkan hadiah besar. Jika tidak memiliki dana sebanyak itu, Anda dapat mencoba dengan dana 50K dan memanfaatkan bonus member baru untuk menambah modal. Berikut adalah Situs Resmi Mahjong yang dapat Anda kunjungi: >> SITUS RESMI MAHJONG YANG TERBUKTI << >> SITUS RESMI MAHJONG YANG TERBUKTI << Setelah mendaftar, Anda dapat menggunakan pola yang sering saya gunakan: 🔥 25 Manual TURBO OFF 🔥 15 Manual TURBO ON 🔥 30 Auto TURBO OFF 🔥 10 Manual TURBO ON Pola ini biasanya memberikan hasil yang konsisten.
    • OLO4D adalah pilihan terbaik bagi Anda yang mencari pengalaman bermain slot gacor dengan transaksi mudah menggunakan Bank Bukopin. Berikut adalah beberapa alasan mengapa Anda harus memilih OLO4D: Slot Gacor Terbaik Kami menyajikan koleksi slot gacor terbaik yang menawarkan kesenangan bermain dan peluang kemenangan besar. Dengan fitur-fitur unggulan dan tema-tema menarik, setiap putaran permainan akan memberikan Anda pengalaman yang tak terlupakan. Transaksi Mudah dengan Bank Bukopin Kami menyediakan layanan transaksi mudah melalui Bank Bukopin untuk kenyamanan dan keamanan Anda. Dengan proses yang cepat dan efisien, Anda dapat melakukan deposit dan penarikan dana dengan lancar dan tanpa hambatan. Pasti Jackpot OLO4D memberikan jaminan bahwa setiap pemain pasti mendapatkan jackpot. Dengan peluang kemenangan yang tinggi, setiap putaran permainan bisa menjadi peluang untuk meraih keberuntungan besar.  
    • Balon168: Gampang Banjir Scatter Hitam Malam Ini Balon168 telah menjadi sorotan dalam dunia perjudian online, dan ada alasan kuat mengapa pemain semakin tertarik. Salah satu permainan unggulannya, yang dikenal dengan tingkat kemenangan yang tinggi, adalah varian "Gampang Banjir Scatter Hitam Malam Ini". Mari kita selami lebih dalam mengenai fenomena ini. Balon168: Destinasi Utama bagi Pecinta Slot     DAFTAR SEKARANG LINK VIP MAXWIN  
  • Topics

×
×
  • Create New...

Important Information

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