Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by 3mptysl

  1. Yes idk. i look TickEvent.ServerTickEvent class and i didnt see how i take MinecraftServer, because if i use WorldTickEvent i can take server with event.world.getServer() maybe i'm tired and i don't see it.
  2. Okayy, thats works perfect and how can i get MinecraftServer in ServerTickEvent, its possible?
  3. or i need to change the value reading and writing de json?
  4. Okay, i did the access transformer and now how i get the player by uuids, because i need to restart a stats and i need a player parameter, i try to create a Player.createPlayerUUID(uuids) but i think is not the correct form.
  5. I don't know how to use accesstransformers, I have put this in my accesstransformer.cfg: public net.minecraft.world.level.storage.PlayerDataStorage <init>(Lnet/minecraft/world/level/storage/LevelStorageSource$LevelStorageAccess;Lcom/mojang/datafixers/DataFixer;)V # PlayerDataStorage but I still don't know what I should do since the server.playerDataStorage doesn't exist idk. what i need to put in accesstranformer.cfg? and how do i get playerDataStorage?
  6. I need to ban a person when they have played 6 hours in a day and when the day is over, reset the time played so that they can play again. I have done it through a stats timeplayed when it reaches 6h it bans you and resets your time played but I don't know how to make it unban you when the day is over and also if you haven't been banned I reset your stat
  7. Im using this but doesnt work @SubscribeEvent public static void serverStart(ServerStartedEvent event) { MinecraftServer server = event.getServer(); Stat<ResourceLocation> stat = Stats.CUSTOM.get(StatsInit.MY_PLAY_TIME.get()); server.getPlayerList().getPlayers().forEach(serverPlayer -> serverPlayer.resetStat(stat)); }
  8. if i use player stats i need to set a value. how i setvalue? im using player.getstats().setvalue(What i put here?); i need Play Time = 0
  9. how i create a timer for every player?, i use value = Dist.Dedicated_Server, i dont need it in local player. but it works in Servers but only in 1 player because all players re updating the same timer
  10. @SubscribeEvent public static void timerEventKick(TickEvent.PlayerTickEvent event) throws ParseException { ServerPlayer player = (ServerPlayer) event.player; System.err.println(timerToKick); if (event.phase == TickEvent.Phase.END){ timerToKick++; System.err.println(timerToKick); } if (event.phase == TickEvent.Phase.END && timerToKick == 200) { timerToKick = 0; UserBanList userbanlist = player.getServer().getPlayerList().getBans(); GameProfile gameprofile = player.getGameProfile(); Date date = date(); UserBanListEntry userbanlistentry = new UserBanListEntry(gameprofile, null, player.getName().getContents(), (Date)date, ""); userbanlist.add(userbanlistentry); player.connection.disconnect(new TextComponent("SE TE ACABO EL TIEMPO").withStyle(ChatFormatting.RED)); }
  11. I need help to do this well, I have managed to get the program to ban when a specific time passes but it works 1 in 1 and I need it to count the time players spend on the server and if he exceeds a certain number of hours temporarily ban him. I got the ban but it doesn't control more than one player at a time
  12. im modding a server side mod i need to ban a player who has reached the time limit player, im counting player ticks and then kick him but idk how ban him
  13. I have searched and I have come to the conclusion that I need to use a TickHandler but I don't know how to implement it in the context of my action, I need that when a player uses an item in a block, it removes the item on the fly and, after some time passes, spawns at the coordinates of the block.
  14. I create an item when you use it, it plays music, so I need a fade/attenuation distance with other players. it only plays in 16 blocks but has the same volume whether you're near or far.
  15. So i need 1 more packet to server side?
  16. Aah i though Minecraft.level.getIstance().getEntity(playerid) sincronice what is happen with player using getEntity() i was wrong. So u said playerid is not the correct player? And how i get the correct player id? Or im wrong too? Sry if is a stupid question Minecraft is not difficult but im lerning
  17. Okay, i think i understand but im getting issues, i create another packet to sync entity to another players like this package com.naim.belloto.networking.packet; import com.naim.belloto.networking.handler.ClientSyncHandler; import net.minecraft.client.Minecraft; import net.minecraft.network.FriendlyByteBuf; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.network.NetworkEvent; import java.util.Objects; import java.util.function.Supplier; public class ClientSyncPacket { public ClientSyncPacket() { } public ClientSyncPacket(FriendlyByteBuf buf) { } public void toBytes(FriendlyByteBuf buf) { } public boolean handle(Supplier<NetworkEvent.Context> ctx) { NetworkEvent.Context context = ctx.get(); context.enqueueWork(() -> { assert Minecraft.getInstance().player != null; int idplayer = Minecraft.getInstance().player.getId(); DistExecutor.unsafeCallWhenOn(Dist.CLIENT,() -> () -> ClientSyncHandler.handlePacket(ctx, idplayer)); }); return true; } } And in the handler: public class ClientSyncHandler { public static boolean handlePacket(Supplier<NetworkEvent.Context> ctx, int idPlayer) { Minecraft.getInstance().level.getEntity(idPlayer); return true; } } But is not working ://
  18. Yes, but this only work in client side i need another player see it too
  19. Im creating the totem of undying so i need to put the particles into an entity, but i dont know how, to use addParticles but dont work.
  20. i just build my mod and i put in my mods folder but some textures dont work, and i cant see steve
  21. i think i need to use appendHoverText but idk how to use it
  • Create New...

Important Information

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