Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

how to render aura around player [1.12.2]


Recommended Posts

so basically i wanna render an aura around the player when the player activates his aura, i created a capability for the player which stores all the information about the aura (how much he has left, has activated his aura and stuff)

now im wondering what would be the best approach to do this? i thought you could either just render it on every client when the player has his aura activated based on the value stored in the capability but for that i think you need to inform every other player via packets that the player activated his aura to render it properly on every client player, but wouldnt that be much data traffic to send it every time a player activates/deactives his aura e.g. when you have a server with alot of players? another possibility could be just to spawn an entity which moves with the player that would automatically sync with every client when done properly and i would spawn the entity based on the value stored in the player capability for that player and kill it when the player deactivates it (server side). so any ideas what would be the best approach?

 

but NOW to my main question as i never rly did much with rendering and stuff how would i render it are there any render tutorials or stuff i could read for that? i never rendered stuff in minecraft besides like custom guis so how does it work?

cuz i will have to write my own render(er) code for this.

im tryin to recreate this in minecraft:

 

232324831_HunterXHunter-89-Large02.thumb.jpg.dac50fe17d51a03b064ccb89a5f5c7fe.jpg

 

i know the dragon block c mod does this somewhat close to what im trying to do:

screen-2.thumb.jpg.ccb659812e95f62575a1ea4f04b46f2d.jpg

 

but how do you render stuff like this in minecraft do you use a custom model and render it like an entity or how do you do it?

would be glad if someone can help me out to how to LEARN to do this as i want to understand what im doing 

 

i know basic to advanced java coding so i think that should be no problem as long as i have something where i actually understand what everything does.

thanks for any help

-eatthenight <33

 

Link to post
Share on other sites

Subscribe toRenderPlayerEvent.Post and do your render there.

You might want to look up on OpenGL basics in order to do the rendering, then check out Minecraft’s Tessellator and BufferBuilder.

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 post
Share on other sites
2 hours ago, DavidM said:

Subscribe toRenderPlayerEvent.Post and do your render there.

You might want to look up on OpenGL basics in order to do the rendering, then check out Minecraft’s Tessellator and BufferBuilder.

hi thanks first of all!

now the thing is when i do it in renderplayerevent would it automatically sync with every other client or how would that work? i was wondering because later on i want every player to be able to change the color of the aura too i was also thinkin about adding like tails n stuff based on the players race.. so when you add new render stuff to that specific player it will be visible for every other player too or would i have to send packets to all clients to let them know when to render and what..? i will try to look up some opengl basics :))

Link to post
Share on other sites

RenderPlayerEvent is fired when a player is rendered. This includes the rendering of other players in multiplayer. You will have fetch data from the player in the event and determine the color of the aura.

Edited by DavidM

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 post
Share on other sites

thanks that sounds perfect! i will try it out after learning the opengl stuff. still one question i dont want to change the player model due to compatibility with other mods but is it also possible to add models to the player like a tail, hats and so on based on the capability data? what would be the best approach there?

Link to post
Share on other sites
  • 1 year later...

😃 Man, this topic is exactly what I need! I'm trying to create an aura for my mod (It would look exactly like the one from Dragon Block C... Yet, I'm still very confused... is there any way someone could relate this to me in baby language? 😅 

Quote
On 8/20/2019 at 8:56 AM, eatthenight said:

thanks man thats exactly what i needed! ill update later if i have any problems understanding.

 

Did you ever get what you needed? If so, can you tell me how to make this for my mod? (I use Mcreator, but you can still make stuff by custom code) Thanks so much! It's greatly appreciated!

Link to post
Share on other sites
Guest
This topic is now closed to further replies.


  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • I'm currently trying to make a new cauldron-type block, and I'm having difficulty implementing blockstates. Here's the relevant part of the alchemical cauldron's code:   public class AlchemicalCauldronBlock extends Block { public static final IntegerProperty LEVEL = IntegerProperty.create("level", 1, 3); private static final VoxelShape INSIDE = box(2.0D, 4.0D, 2.0D, 14.0D, 16.0D, 14.0D); protected static final VoxelShape SHAPE = VoxelShapes.join(VoxelShapes.block(), VoxelShapes.or(box(0.0D, 0.0D, 4.0D, 16.0D, 3.0D, 12.0D), box(4.0D, 0.0D, 0.0D, 12.0D, 3.0D, 16.0D), box(2.0D, 0.0D, 2.0D, 14.0D, 3.0D, 14.0D), INSIDE), IBooleanFunction.ONLY_FIRST); public AlchemicalCauldronBlock() { super(Properties.of(Material.METAL).sound(SoundType.METAL).harvestLevel(3).strength(2F,2F)); // this.registerDefaultState(this.stateDefinition.any().setValue(LEVEL, 0)); // this.registerDefaultState(this.stateDefinition.any().setValue(LEVEL, Integer.valueOf(0))); } ... When I try to run this with either of the two attempts at registerDefaultState uncommented, I get this error: https://pastebin.com/vPf3UryC. For convenience, I believe this part is most relevant: How can I avoid this? My registry classes look like this, if it helps: public class registry { public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, AlchemyPlus.MODID); public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, AlchemyPlus.MODID); public static void register() { IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); BLOCKS.register(modEventBus); ITEMS.register(modEventBus); registerItems.register(); registerBlocks.register(); } } public class registerBlocks { public static final RegistryObject<Block> ALCHEMICAL_CAULDRON = register("alchemical_cauldron", AlchemicalCauldronBlock::new); static void register() {} private static <T extends Block> RegistryObject<T> registerNoItem(String name, Supplier<T> block) { return registry.BLOCKS.register(name, block); } private static <T extends Block> RegistryObject<T> register(String name, Supplier<T> block) { RegistryObject<T> ret = registerNoItem(name, block); registry.ITEMS.register(name, () -> new BlockItem(ret.get(), new Item.Properties().tab(ItemGroup.TAB_BREWING))); return ret; } } Full GitHub repository available here.   (Other minor problem(?):  I copied the methods getShape and getInteractionShape from net.minecraft.block.CauldronBlock and I'm getting these weird warnings. What's up with that? Do I need to worry about it?)  
    • Personally I use IForgeRegistryEntry#getRegistryName and then ResourceLocation#getNameSpace to get the id of the object.
    • you can get a block form a ResourceLocation, take a look at NBTUtil#readBlockState, do somthing like that
    • I am running forge version 1.16.5 36.1.31 on a server with a lot of mods and when a player refreshes the server list, it sends a long error in the server console. Additionally, the server list displays "Can't connect to server", despite refreshing and actually being able to connect to the server. here's the links to the logs: https://gist.github.com/WaffleTraits/83885b1539d5711fabff73a91924e665 https://gist.github.com/WaffleTraits/5ae78e6eaa330422bbc9f7226faf60ce Here's what's displayed in console when a player refreshes server listing: https://hastebin.com/ativexeyoy.properties server is running on ubuntu 20.04 and is using java 8 for this forge instance.
    • I kept getting this error whenever I tried joining my modded server I want to find a solution to this I checked every mod and it all matched Client : https://mclo.gs/Q39SSu5 server : https://mclo.gs/UO2kbDz
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.