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

tubez

Members
  • Posts

    16
  • Joined

  • Last visited

tubez's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Hi, im trying to make a server rules section on the left side of the inventory, only problem being is that it does not look that great with the default Minecraft font. I have been looking all over the place for a tutorial or an API that can assist me with this, but to no luck. I want to know if using a TTF file is possible in forge so I can probably try to develop the system my self. Thank you in advance.
  2. I know this is an old post but holy shit, use switch statements, PLEASE.
  3. Alright, I've got this, but I feel like i'm being really stupid. public class ApeData implements BiConsumer<MSG, FriendlyByteBuf>, Function<FriendlyByteBuf, MSG> { BlockPos blockPos = null; public ApeData(BlockPos blockPos) { this.blockPos = blockPos; } public FriendlyByteBuf getFriendlyByteBuf() { ByteBuf bb = null; FriendlyByteBuf fbb = new FriendlyByteBuf(bb); fbb.writeBlockPos(this.blockPos); return fbb; } public void setBlockPos(BlockPos blockPos) { this.blockPos = blockPos; } public BlockPos getBlockPos() { return this.blockPos; } @Override public void accept(MSG t, FriendlyByteBuf u) { // TODO Auto-generated method stub } @Override public MSG apply(FriendlyByteBuf t) { // TODO Auto-generated method stub return null; } } Then I do this to try to register it ByteBuffer bb; ApeData data = new ApeData(new BlockPos(0,0,0)); ApeDataNetwork dataNetwork = new ApeDataNetwork(); INSTANCE.registerMessage(0, new MSG(bb), data, dataNetwork); // ERROR But on the line where I commented "ERROR" I get this. The method registerMessage(int, Class<MSG>, BiConsumer<MSG,FriendlyByteBuf>, Function<FriendlyByteBuf,MSG>, BiConsumer<MSG,Supplier<NetworkEvent.Context>>) in the type SimpleChannel is not applicable for the arguments (int, MSG, ApeData, ApeDataNetwork) Ignore the first 2 parameters I'm lacking a bit of java knowledge here. I did as you said and made a new class that implements all that stuff.
  4. Ah, that's what you mean, interface implementations. I'll see what I can do and I'll come back.
  5. Ben that doesn't really help me, I know how to write a class that contains data but what do you mean by provide implementations?
  6. ByteBuffer bb; ByteBuf bb2; bb2.writeInt(3); bb.putChar('C'); FriendlyByteBuf fbb = new FriendlyByteBuf(bb2); INSTANCE.registerMessage(0, new MSG(bb), new BiConsumer() { @Override public void accept(Object t, Object u) { // TODO Auto-generated method stub System.out.println(t.toString() + " " + u.toString()); }}, fbb); Don't laugh LOL
  7. Completely forgot half of java for a moment. Can you show me an example of registering a message? I spent long enough fiddling with it and I can't get it to be correct. This is really embarrassing.
  8. That doesn't answer my question though. I know about the first parameter, the ID. For the second parameter should the class extend MSG or something? I don't understand there Third parameter, where do I get the BiConsumer from? Do I just reference it using BiConsumer.class (which doesn't make sense to me)? Fourth parameter, same thing as Third, where do I get the FriendlyByteBuf from? I'm really only looking to trade "Hello World"'s between spigot and forge, I don't have a very big understanding of this.
  9. How do I use it with the registerMessage method from the SimpleChannel object? Do I need to initialise it with certain parameters? or...?
  10. Okay I understand the difference now, however the parameters don't make much sense to me (other than the first one). what is a FriendlyByteBuf? is it a static class? How do I use it with the registerMessage method within the simpleChannel object? same thing with BiConsumor.
  11. Helped me getting the SimpleChannel correct, thank you for that. I'm getting a little confused though on the difference between Registering packets and handling packets, can you explain this to me? Well, multiple reasons, but the main one is that I want knowledge on this topic (communication between forge and spigot).
  12. Hi, I feel really stupid asking this question because there are already multiple topics on this, however received no guidance from any of them at all. I already tried using sponge but I need the server to be 1.18, so Spigot is my only option since I actually know how to use it. In spigot, I am running this piece of code when a player joins the server: // Inside onPlayerJoin Event e.getPlayer().sendPluginMessage(instance, MOD_CHANNEL, "MESSAGE".getBytes()); And now in forge I have no idea what to do to capture that plugin message. I have tried looking through the event list, I looked at different posts, and had no luck. I know it is something to do with the SimpleChannel object, but have no idea where to start from. This is the only thing I have in my forge mod. SimpleChannel HANDLER = NetworkRegistry.ChannelBuilder .named(new ResourceLocation(MOD_ID, MOD_CHANNEL)) .simpleChannel(); // What the hell do I do next?? Any help would be appreciated, Thank you in advance.
  13. Hello, I have heard about the ViewProjection class and kind of gotten an idea of it. I wanted to know if it is possible to get an X and Y coordinate from that, if it is, then how would it be done? What I am trying to achieve is drawing a 2D square pointing at an X Y Z coordinate. To be specific in what I am creating, I want to make a spinning hollow rectangle that points to where a waypoint is. I have already figured out how to draw the rectangle, now I need to figure out how to actually draw it to the position of where it is in the 3d world in a 2d form if that makes sense.
×
×
  • Create New...

Important Information

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