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

how do you change the player model


Skarte
 Share

Recommended Posts

1 minute ago, Skarte said:

somebody help

Use the RenderPlayerEvent.Post and render your hair there when you want to.

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

No. We won't be writing your code for you.

 

https://mcforge.readthedocs.io/en/latest/events/intro/
This is what you need to get started with events. Look for open source mods that use the RenderPlayer event for examples.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

21 minutes ago, Skarte said:

i never said write my code for me there is a difference between an example and writing my code

Well he gave you the documentation which is equivalent to what you want.

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

1 minute ago, Animefan8888 said:

Well he gave you the documentation which is equivalent to what you want.

not really anyways make my model a child of biped body and in the event just say

ModelCustomArmour model = new ModelCustomArmour();

 

model.bipedBody.showModel = true;

Link to comment
Share on other sites

5 minutes ago, Skarte said:

not really anyways make my model a child of biped body and in the event just say

ModelCustomArmour model = new ModelCustomArmour();

 

model.bipedBody.showModel = true;

Potentially

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

https://github.com/search?q=RenderPlayerEvent&type=Code

Here are a lot of examples. Could've found these yourself...

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

8 hours ago, Skarte said:

how do i make it render my model

Look at how all other entities render their models.

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

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

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Capability class: public class ManaCapability { public static final ResourceLocation LOCATION=new ResourceLocation(ElderNorseGods.MOD_ID, "mana"); @CapabilityInject(IManaHandler.class) public static Capability<IManaHandler> CAP_INSTANCE=null; public static class ManaStorage implements IStorage<IManaHandler> { @Override public INBT writeNBT(Capability<IManaHandler> cap, IManaHandler manaHandler, Direction side) { CompoundNBT tag=new CompoundNBT(); tag.putFloat("Mana", manaHandler.getMana()); tag.putBoolean("Status", manaHandler.getStatus()); return tag; } @Override public void readNBT(Capability<IManaHandler> cap, IManaHandler manaHandler, Direction side, INBT nbt) { manaHandler.setMana(((CompoundNBT)nbt).getFloat("Mana")); manaHandler.setStatus(((CompoundNBT)nbt).getBoolean("Status")); } } public static class ManaProvider implements ICapabilitySerializable<CompoundNBT> { private final ManaHandler mana=new ManaHandler(); private final LazyOptional<IManaHandler> manaOptional=LazyOptional.of(()->this.mana); public void invalidate() { this.manaOptional.invalidate(); } @Override public CompoundNBT serializeNBT() { if(ManaCapability.CAP_INSTANCE==null) return new CompoundNBT(); else return (CompoundNBT)ManaCapability.CAP_INSTANCE.writeNBT(this.mana, null); } @Override public void deserializeNBT(CompoundNBT nbt) { if(ManaCapability.CAP_INSTANCE!=null) ManaCapability.CAP_INSTANCE.readNBT(this.mana, null, nbt); } @Override public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) { return cap==ManaCapability.CAP_INSTANCE?this.manaOptional.cast():LazyOptional.empty(); } } } Capability handler class: public class ManaHandler implements IManaHandler { private float mana; private boolean active; public ManaHandler() { this.mana=0F; this.active=false; } @Override public void setMana(float amount) { if(amount<0F) this.mana=0F; else if(amount>20F) this.mana=20F; else this.mana=amount; } @Override public float getMana() { return this.mana; } @Override public void setStatus(boolean value) { this.active=value; } @Override public boolean getStatus() { return this.active; } @Override public void update(ServerPlayerEntity player) { NetworkHandler.sendToPlayer(player, new ManaDataPacket(this.getMana(), this.getStatus())); } } Capability event handler class: @EventBusSubscriber(modid=ElderNorseGods.MOD_ID, bus=EventBusSubscriber.Bus.FORGE) public abstract class ManaEventHandler { private static void sendUpdates(ServerPlayerEntity player) { if(!player.getCommandSenderWorld().isClientSide()) { player.getCapability(ManaCapability.CAP_INSTANCE).ifPresent(mana->mana.update(player)); } } @SubscribeEvent public static void onPlayerChangedDimension(PlayerChangedDimensionEvent event) { ManaEventHandler.sendUpdates((ServerPlayerEntity)event.getPlayer()); } @SubscribeEvent public static void onPlayerRespawn(PlayerRespawnEvent event) { ManaEventHandler.sendUpdates((ServerPlayerEntity)event.getPlayer()); } @SubscribeEvent public static void onPlayerLoggedIn(PlayerLoggedInEvent event) { ManaEventHandler.sendUpdates((ServerPlayerEntity)event.getPlayer()); } @SubscribeEvent public static void onPlayerClone(PlayerEvent.Clone event) { if(!event.isWasDeath()) return; IManaHandler oldMana=event.getOriginal().getCapability(ManaCapability.CAP_INSTANCE).orElse(null); IManaHandler newMana=event.getPlayer().getCapability(ManaCapability.CAP_INSTANCE).orElse(null); if(oldMana!=null&&newMana!=null) { newMana.setMana(oldMana.getMana()); newMana.setStatus(oldMana.getStatus()); } } } Packet class: public class ManaDataPacket { private float value; private boolean status; public ManaDataPacket(float value, boolean status) { this.value=value; this.status=status; } public static void encode(ManaDataPacket packet, PacketBuffer buffer) { buffer.writeFloat(packet.value); buffer.writeBoolean(packet.status); } public static ManaDataPacket decode(PacketBuffer buffer) { return new ManaDataPacket(buffer.readFloat(), buffer.readBoolean()); } public static void handle(ManaDataPacket packet, Supplier<NetworkEvent.Context> ctx) { ctx.get().enqueueWork(()->DistExecutor.unsafeRunWhenOn(Dist.CLIENT, ()->()->PacketHandler.handlePacket(packet, ctx))); ctx.get().setPacketHandled(true); } private static class PacketHandler { private static void handlePacket(ManaDataPacket packet, Supplier<NetworkEvent.Context> ctx) { Minecraft mc=Minecraft.getInstance(); mc.player.getCapability(ManaCapability.CAP_INSTANCE).ifPresent ( mana-> { mana.setMana(packet.value); mana.setStatus(packet.status); } ); } } }
    • 1.12 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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