Jump to content

ErfinderLabyrinth

Members
  • Posts

    48
  • Joined

  • Last visited

Recent Profile Visitors

7275 profile views

ErfinderLabyrinth's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I have fixed the Problem, I have not use the Codec to much
  2. But I have no Level and no MinecraftServer Variable, what do i now? Is there a Option to get the active MinecraftServer Variable?
  3. Hi, i would like to get the Biome Variable or the a Holder with the Biome Variable from a Resourcekey<Biome>, but I see no Methode. How I get the Variable
  4. And how i can say, that my Custom Dimenson should use this Chunk Generator
  5. I dont know, that i can use A Registry Object in a DefferedRegister. Another question about the codec: Can I also say that the constructor does not require a value And how I create the Level? Which LevelType(Level, ServerLevel, ClientLevel) must I use and which Varialbles do I have to pass
  6. I know how to do this, but I don't have an entry in ForgeRegistries(Requires the DeferredRegister) and I can't pass a ChunkGenerator in the ResourceKey variant
  7. How do I register the ChunkGenerator?
  8. I understand this to mean generation with datapacks or similar functions. I want to say that at block 0 0 0 is Bedrock, 0 1 0 is Deepslate, 0 2 0 is Stone, ... which I can only solve via a custom chunk generator though
  9. Hi, i would like create a custom Dimension with a custom Generation(not the Vanilla generation), but i found nothink for the Version 1.19.2, only 1.15.2 like this but this is outdated and didn't work in the newer Version. How make I that in the 1.19.2? Or is that no longer supported?
  10. Dieser ganze Code überprüft, ob die Nachricht vom Client zum Server oder vom Server zum Client geschickt worden ist
  11. Hi, I created a SimpleChannel and sent a few messages about it. The problem is that when I'm on the multiplayer (external server), I don't receive the message. My guess is that I read the message before the message is received. But how can I receive the message, I did not come to a solution SimpleChannelMessage: package net.lager.system.client; import java.util.function.Supplier; import net.lager.system.register.ConnectionHandlerRegister; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.network.PacketBuffer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.common.thread.SidedThreadGroups; import net.minecraftforge.fml.network.NetworkEvent; public class SimpleChannelMessage { public String msg; private ResourceLocation rl; public BlockPos bpos; public SimpleChannelMessage(ResourceLocation rl, String msg) { this.rl = rl; this.msg = msg; } public SimpleChannelMessage(ResourceLocation rl, String msg, BlockPos bpos) { this.rl = rl; this.msg = msg; this.bpos = bpos; } public static void encode(SimpleChannelMessage msg, PacketBuffer buffer) { java.lang.System.out.println("encode"); buffer.writeBytes(("." + msg.rl.getNamespace() + ":" + msg.rl.getPath() + " " + msg.msg).getBytes()); buffer.writeBlockPos(msg.bpos); java.lang.System.out.println(msg.rl.getNamespace() + ":" + msg.rl.getPath() + " " + msg.msg); } public static SimpleChannelMessage decode(PacketBuffer buffer) { java.lang.System.out.println("decode"); buffer.capacity(17000); buffer.writerIndex(16000); String[] list = new String(buffer.readByteArray()).split(" "); String rls = list[0]; java.lang.System.out.println(new String(buffer.readByteArray(16000))); ResourceLocation rl = new ResourceLocation(rls.split(":")[0], rls.split(":")[1]); String msg = list[1]; BlockPos bpos = buffer.readBlockPos(); if (bpos == null) { return new SimpleChannelMessage(rl, msg); } else { return new SimpleChannelMessage(rl, msg, bpos); } } public static void handle(SimpleChannelMessage msg, Supplier<NetworkEvent.Context> ctx) { java.lang.System.out.println("handle"); ctx.get().enqueueWork(() -> { DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> {if (Thread.currentThread().getThreadGroup() == SidedThreadGroups.SERVER) { SimpleChannelMessage.handleServer(msg, ctx); } else if(Thread.currentThread().getThreadGroup() == SidedThreadGroups.CLIENT) { SimpleChannelMessage.handleClient(msg, ctx); }}); DistExecutor.unsafeRunWhenOn(Dist.DEDICATED_SERVER, () -> () -> SimpleChannelMessage.handleServer(msg, ctx)); }); ctx.get().setPacketHandled(true); } public static void handleServer(SimpleChannelMessage msg, Supplier<NetworkEvent.Context> ctx) { java.lang.System.out.println("handle server"); ctx.get().enqueueWork(() -> { ServerPlayerEntity sender = ctx.get().getSender(); if(ConnectionHandlerRegister.runServer(msg, msg.rl, sender)) { ctx.get().setPacketHandled(true); } }); } public static void handleClient(SimpleChannelMessage msg, Supplier<NetworkEvent.Context> ctx) { java.lang.System.out.println("handle client"); ctx.get().enqueueWork(() -> { if(ConnectionHandlerRegister.runClient(msg, msg.rl)) { ctx.get().setPacketHandled(true); } }); } }
  12. I liked to get the Overworld Variable(Type World), abe don't know how to get it
  13. 1. Die drei Sekunden sind dafür da, da wenn ClientModLoader.isLoading() false ist, es trotzdem noch kurz braucht, bis man mit der Methode Minecraft#setScreen erfolgreich einen Screen anzeigen kann. 2. Der Thread fragt dauerhaft, ob Forge mit dem Laden fertig sei und wenn Forge mit dem Laden fertig ist wartet es 3 Sekunden(Begründung siehe 1.) und lädt den Load Screen. Wenn die Load-Engine fertig ist, wird die Methode finished() aufgerufen, dieser dann den Hauptbildschirm ladet.
×
×
  • Create New...

Important Information

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