-
[1.15] Synchronize a float between the server and client.
My mistake, I didn't properly read your post (it's late here!). So yes, you have to use the packets with capabilities. This time, if I correctly read your post you don't know where you should recieve the packet. I've never really done what you want to do, but I have some basics. You need to follow this in the documation. The principle is to create a class that gathers everything you need for the network A fast example : public class Packet { private float temperature; public Packet(int temperature_) { this.temperature = temperature_; } // "responsible for encoding the message" public static void encode(Packet packet, PacketBuffer buffer) { buffer.writeInt(packet.temperature); } // "responsible for decoding the message" public static Packet decode(PacketBuffer buffer) { int temperature = buffer.readInt(); Packet instance = new Packet(temperature); return instance; } // What's INSTANCE ? Check Getting Started in the doc public static void registerMessage() { INSTANCE.messageBuilder(Packet.class, 0) .encoder(Packet::encode) .decoder(Packet::decode) .consumer(Packet::handle) .add(); // "Registering Packets" section } // "responsible for handling the message" public static void handle(Packet msg, Supplier<NetworkEvent.Context> ctx) { ctx.get().enqueueWork(() -> { // Work that needs to be threadsafe (most work) EntityPlayerMP sender = ctx.get().getSender(); // the client that sent this packet // do stuff }); ctx.get().setPacketHandled(true); } } } There's probably some things missing, but this should help. EDIT : Oh, I forgot! You need to call registerMessage() in the setup function of your mod.
-
[1.16] Trying to have my player spawn in the end?
Check this mod which nearly perform what you want to do : https://github.com/mcenderdragon/DefaultDimension/blob/1.15.x/src/main/java/mcenderdragon/defaultdimension/DDMain.java
-
[1.15] Synchronize a float between the server and client.
How do you store the float ? You absolutety need to use a custom packet ? In fact, without further details I would say maybe use the dataManager for client-side synchronization and override the writeAdditional and readAdditional methods to make your data persistent.
-
Yohann changed their profile photo
-
Custom Entity Child size?
In fact, it's really simple. The problem is that your model inheirits from EntityModel. So first extends with AgeableModel : public class YourModel<T extends YourEntity> extends AgeableModel<T> Then, delete your render method and add : @Override protected Iterable<ModelRenderer> getHeadParts() { return ImmutableList.of(this.head); } @Override protected Iterable<ModelRenderer> getBodyParts() { return ImmutableList.of(this.body, this.legBackRight, this.legBackLeft, this.legFrontRight, this.legFrontLeft); } The AgeableModel class will render automatically your mob and scale it correctly if it's a baby.
-
[1.16.1] correct use of DeferredWorkQueue
I had misunderstood this nuance thank you for this clarification and explanation!
-
[1.16.1] correct use of DeferredWorkQueue
Hello! It's been a very short time that I've been trying to develop mods with Forge. I understand after reading a lot of things on this forum that FMLCommonSetupEvent is not thread safe. It was advised to use DeferredWorkQueue to overcome this problem. But I don't understand exactly how to use this function properly and I can't find any resource explaining it clearly enough. Can you help me? Thank you!
-
Yohann joined the community
-
1.16.1 Custom Entity attributes
Hi Daniel, I don't understand the meaning of the "MyEntities.myCustomEntity" argument. Could you explain it?
IPS spam blocked by CleanTalk.