Jump to content

anonymusdennis

Members
  • Posts

    17
  • Joined

  • Last visited

Everything posted by anonymusdennis

  1. What kind of wifi connection are you using If it is a public wifi or has some kind of proxy I would suggest you to try again with an active vpn connection; That would be my suggestion also i would suggest you to not share any gradle scans because they contain all the information of your pc like your Ip adress, username and computer components This is not very safe please yust paste the needed logs and infos on a site like pastebin.com and then share that link so that you can be sure not to share any critical data
  2. I want to send a message to all players like the tellraw command, but without using any commands I want a Message like this: '<misterx>: Hello World' to be shown to every player as if the player misterx sent this message. each message sender instance is it's own object public class virtual_user { static ArrayList users = new ArrayList<String>(); private String username; public virtual_user(String name) { String original = name; int adder = 0; while(users.contains(name)) { adder++; name = original + adder; } this.username = name; users.add(name); } public void delete () { int index = users.indexOf(this.username); if(index != -1) users.remove(index); } public void sendMessage(String message) { //send message to all players using this players name etc. } } this is what i got so far now i need the content of sendmessage, but i don't know how to send any messages to a client from a server sided viewpoint
  3. Am i doing this right? //in server Start event: System.setOut(new PrintStream(new consolesub(System.out))); //------- private static class consolesub extends OutputStream { PrintStream original; public consolesub(PrintStream out) { original = out; } public consolesub() { super(); } @Override public void write(byte[] b) throws IOException { original.write(b); super.write(b); } @Override public void write(byte[] b, int off, int len) throws IOException { original.write(b,off,len); super.write(b, off, len); } @Override public void flush() throws IOException { original.flush(); super.flush(); } @Override public void close() throws IOException { original.close(); super.close(); } @Override public void write(int b) throws IOException { original.write(b); } }
  4. just like an external server console I dont Really get how to use youre solution while not deleting all the output of the server console this method of seems to leave me two choices: either never using the server console (cmd) again because there won't be any output anymore ... did i get that right? If i set my own conloe output, won't then the original System.out vanish? please help i don't want to overwrite my server's root console thats because i don't want the user to input any commands .... I want them to only communicate.... please help!
  5. I don't want to put it in a File I want to resend the message directly via websockets
  6. Every time a message in the server console is displayed what i want to do is to get this message as a String... I don't want to change the message i know that wouldn't be possible but i want to get the Message and reformat it and then send it to my http server..... (my website is supposed to give me an server console and so far i got messages from users but not messages from the server or any message the players might get in chat which are not by a player) If there in an better way then trying to listen to the log4j instance i would rather use that, but currently I don't even get how to listen to the log4j instance.... please help I have no clue of what i am doing....
  7. I installed the plugin and ran it via console when i Installed the mod it wasn't recognized anymore I am not sure how to understand the docs of Shadowjar I think I need to set something up... has anyone experience with this plugin cause all it did was creating a jar file with the following file Structure: its the big html donnow any better method of displaying the tree I think it's the entire project Folder.....
  8. I need to use some libaries: grizzly * tyrus * cause I want do mod something for my server with websockets I can't figure out how to add these depndencies correctly so that in the end I have but one jar file to put on my server (the size doesn't matter) could you help me? I searched everywhere but If i add it to my gradele dependencies it only uses them to compile and they do not end up in my final jar..... if i put it on my server I get the following error and the websocket thread gets closed: [19:13:49] [Thread-3/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: java.lang.NoClassDefFoundError: javax/websocket/DeploymentException [19:13:49] [Thread-3/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: at com.example.examplemod.WebsocketServer.run(WebsocketServer.java:10) [19:13:49] [Thread-3/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: Caused by: java.lang.ClassNotFoundException: javax.websocket.DeploymentException [19:13:49] [Thread-3/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: at java.lang.ClassLoader.findClass(Unknown Source) [19:13:49] [Thread-3/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: at java.lang.ClassLoader.loadClass(Unknown Source) [19:13:49] [Thread-3/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: at cpw.mods.modlauncher.TransformingClassLoader.loadClass(TransformingClassLoader.java:94) [19:13:49] [Thread-3/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: at java.lang.ClassLoader.loadClass(Unknown Source) [19:13:49] [Thread-3/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: ... 1 more If you need mor information please say so
  9. okay i got it now and here is my code for anyone who is interested: ModItemGroups.java package com.anonymusdennis.annomod.init; import com.anonymusdennis.annomod.annomod; import net.minecraft.block.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.NonNullList; import net.minecraft.util.registry.Registry; import java.util.ArrayList; import java.util.function.Supplier; import java.util.logging.Logger; import static net.minecraft.world.biome.Biome.LOGGER; public class ModItemGroups { public static class ModItemGroup extends ItemGroup { public String namer = ""; private final Supplier<ItemStack> iconSupplier; public ModItemGroup(final String name, final Supplier<ItemStack> iconSupplier, String skull) { super(name); this.namer = skull; namer = skull; this.iconSupplier = iconSupplier; } @Override public void fill(NonNullList<ItemStack> items) { if(namer == "skull"){ annomod.online_player_names.forEach((playername)-> { ItemStack head = (new ItemStack(Blocks.PLAYER_HEAD)); CompoundNBT nbt = head.getOrCreateTag(); nbt.putString("SkullOwner", playername); nbt.put("display", new CompoundNBT() {{ putString("text", playername); }}); head.setTag(nbt); Item heads = head.getItem(); items.add(head); }); } for(Item item : Registry.ITEM) { item.fillItemGroup(this, items); } } @Override public ItemStack createIcon() { return iconSupplier.get(); } } public static final ItemGroup MOD_ITEM_GROUP_Blocks = new ModItemGroup("jolo", () -> new ItemStack(Items.LIGHT_BLUE_BANNER), "banner"); public static final ItemGroup MOD_ITEM_GROUP_Skulls = new ModItemGroup("Heads", () -> new ItemStack(Items.PLAYER_HEAD),"skull"); public static final ItemGroup MOD_ITEM_GROUP_Standart = new ModItemGroup(annomod.MOD_ID, () -> new ItemStack(ItemInit.erstes_item), "standard"); public static final ItemGroup MOD_ITEM_GROUP_Food = new ModItemGroup("Rest", () -> new ItemStack(Items.LIGHT_BLUE_BANNER), "rest"); } annomod.java package com.anonymusdennis.annomod; import com.anonymusdennis.annomod.init.ModItemGroups; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.block.SkullBlock; import net.minecraft.block.SkullPlayerBlock; import net.minecraft.client.Minecraft; import net.minecraft.client.network.play.NetworkPlayerInfo; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.NonNullList; import net.minecraftforge.client.event.GuiOpenEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.Tags; import net.minecraftforge.common.util.Constants; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.server.FMLServerStartingEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.fml.network.NetworkRegistry; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.ArrayList; // The value here should match an entry in the META-INF/mods.toml file @Mod("annomod") public class annomod { private int online_players = 0; // Directly reference a log4j logger. public static ArrayList<String> online_player_names = new ArrayList<String>() {{ add("anonymusdennis"); add("Steve"); //List of heads to be added by default }}; private static final Logger LOGGER = LogManager.getLogger(); public static final String MOD_ID = "annomod"; public static annomod instance; public annomod() { // Register the setup method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); // Register the enqueueIMC method for modloading //FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC); // Register the processIMC method for modloading //FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC); // Register the doClientStuff method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); instance = this; // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); } private void setup(final FMLCommonSetupEvent event) { // some preinit code } private void doClientStuff(final FMLClientSetupEvent event) { // do something that can only be done on the client } // You can use SubscribeEvent and let the Event Bus discover methods to call @SubscribeEvent public void onServerStarting(FMLServerStartingEvent event) { // do something when the server starts } // You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD // Event bus for receiving Registry Events) @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { @SubscribeEvent public static void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent) { // register a new block here LOGGER.info("HELLO from Register Block"); } @SubscribeEvent public static void updateHeads(final GuiOpenEvent event){ Collection<NetworkPlayerInfo> playersC= Minecraft.getInstance().getConnection().getPlayerInfoMap(); playersC.forEach((loadedPlayer)->{ String LoadedPlayerName = loadedPlayer.getGameProfile().getName(); if(!online_player_names.contains(LoadedPlayerName)){ online_player_names.add(LoadedPlayerName); } LoadedPlayerName = loadedPlayer.getDisplayName().getString(); if(!online_player_names.contains(LoadedPlayerName)) { online_player_names.add(LoadedPlayerName); } }); String LoadedPlayerName = Minecraft.getInstance().player.getDisplayName().getString(); if(!online_player_names.contains(LoadedPlayerName)) { online_player_names.add(LoadedPlayerName); } } } } Thanks to everyone !!!!!!!!
  10. okay i think I got it started without any errors: package com.anonymusdennis.annomod.init; import com.anonymusdennis.annomod.annomod; import net.minecraft.block.Blocks; import net.minecraft.client.gui.screen.inventory.CreativeScreen; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.container.Container; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.NonNullList; import net.minecraft.util.registry.Registry; import java.util.ArrayList; import java.util.function.Supplier; import net.minecraft.client.gui.screen.inventory.CreativeScreen; import static net.minecraft.world.biome.Biome.LOGGER; public class ModItemGroups { public static class ModItemGroup extends ItemGroup { public String name = ""; public ItemGroup UpdateName(String name) { this.name = ""; return this; } public static ArrayList<String> player_names = new ArrayList<String>() {{}}; private final Supplier<ItemStack> iconSupplier; public ModItemGroup(final String name, final Supplier<ItemStack> iconSupplier) { super(name); this.iconSupplier = iconSupplier; } @Override public void fill(NonNullList<ItemStack> items) { LOGGER.info(this.name); if(this.name == "skull"){ LOGGER.info(this.name + "success"); player_names.forEach((playername)-> { ItemStack head = (new ItemStack(Blocks.PLAYER_HEAD)); CompoundNBT nbt = head.getTag(); nbt.putString("Skullowner", playername); head.setTag(nbt); Item heads = head.getItem(); items.add(head); }); for(Item item : Registry.ITEM) { item.fillItemGroup(this, items); } } } @Override public ItemStack createIcon() { return iconSupplier.get(); } } public static final ItemGroup MOD_ITEM_GROUP_Banner = new ModItemGroup("jolo", () -> new ItemStack(Items.LIGHT_BLUE_BANNER)); public ItemGroup MOD_ITEM_GROUP_Skulls = ((new ModItemGroup("Heads", () -> new ItemStack(Items.LIGHT_BLUE_BANNER))).UpdateName("skull")); public static final ItemGroup MOD_ITEM_GROUP_Standart = new ModItemGroup(annomod.MOD_ID, () -> new ItemStack(ItemInit.erstes_item)); public static final ItemGroup MOD_ITEM_GROUP_Rest = new ModItemGroup("Rest", () -> new ItemStack(Items.LIGHT_BLUE_BANNER)); } this does somehow cause the creative Tab "Heads" not to show up why? I am truly sorry If I am stressing you..
  11. public static class ModItemGroup extends ItemGroup { public String name = ""; public ItemGroup UpdateName(String name) { this.name = ""; return this; } public static ArrayList<String> player_names = new ArrayList<String>() {{}}; private final Supplier<ItemStack> iconSupplier; public ModItemGroup(final String name, final Supplier<ItemStack> iconSupplier) { super(name); this.iconSupplier = iconSupplier; } @Override public void fill(NonNullList<ItemStack> items) { LOGGER.info(this.name); if(this.name == "skull"){ LOGGER.info(this.name + "success"); items = new NonNullList<ItemStack>() {{ player_names.forEach((playername)->{ ItemStack head = (new ItemStack(Blocks.PLAYER_HEAD)); CompoundNBT nbt = head.getTag(); nbt.putString("Skullowner", playername); head.setTag(nbt); Item heads = head.getItem(); add(head); });}}; } } @Override public ItemStack createIcon() { return iconSupplier.get(); } } Now I got this is this better? I also removed the call of the fill function Now I got another error : [10:34:56] [Render thread/ERROR] [ne.mi.fm.ja.FMLModContainer/]: Exception caught during firing event: Unable to have damage AND stack. Index: 2 And below there is this error: Caught exception during event RegistryEvent.Register<minecraft:item> dispatch for modid annomod here is the complete Error https://pastebin.com/4W14KiMv
  12. @Override public void fill(NonNullList<ItemStack> items) { for(Item item : Registry.ITEM) { item.fillItemGroup(this, items); } } so far I got this but what is the list of Items I am supposed to get? I am new to this topic please forgive my stupidity
  13. If I remember correctliiy there are some nbt tags about how much an container is filled with fluids. I wouldn't recommend doing the graphical interface yourself. I am sure there are some libaries which could handle the graphics for you. If you want to find out which blockdata to add to your block: Download any mod which adds fluid containers place one of them in your world then read out the blockdata of the block /blockdata x y z x y and z can be retrieved by typing out / blockdata and then pressing [Tab] for each coordinate whilst looking directly at the block of your destination I hope I could help I am going to research an fluid interface https://gist.github.com/WesCook/c9e282e49580588dd397350283e7e4e1 here is an topic discussion explaining how to do it here you can find a list of libaries: https://www.curseforge.com/minecraft/mc-mods/library-api I hope I could help... Dennis out!
  14. Minecraft version: 1.15.1 So I want my mod to add an Creative Tab in which one can use all the heads of the current online Players. so far I got this: public static ArrayList<String> online_player_names = new ArrayList<String>() {{ add("Steve"); add("my_name"); add("Alex"); add("Herobrine"); add("Cake"); add("CaptainSparkles"); add("Steve"); add("Steve"); add("Steve"); add("Steve"); add("Steve"); add("Steve"); add("Steve"); add("Steve"); add("Steve"); }}; //this is a list of predefined heads @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { @SubscribeEvent public static void updateHeads(final GuiOpenEvent event){ Collection<NetworkPlayerInfo> playersC= Minecraft.getInstance().getConnection().getPlayerInfoMap(); playersC.forEach((loadedPlayer)->{ String LoadedPlayerName = loadedPlayer.getGameProfile().getName(); if(!online_player_names.contains(LoadedPlayerName)){ online_player_names.add(LoadedPlayerName); } }); online_player_names.forEach((playername)->{ ItemStack head = (new ItemStack(Blocks.PLAYER_HEAD)); CompoundNBT nbt = head.getTag(); nbt.putString("Skullowner", playername); head.setTag(nbt); Item heads = head.getItem(); //Put Itemstack to Creative Tab ModItemGroups.MOD_ITEM_GROUP_Skulls.fill(new NonNullList<ItemStack>() {{add(head);}}); }); } this code gives an error when it tries to put the ItemStack into a new Creative Tab: Error Code From pastebin here I don't know how to solve this I didn't fin any references on how to add Already exsisting Items to a new CreativeTab but with changed NBT here is my code for the creative Tabs: package com.anonymusdennis.annomod.init; import com.anonymusdennis.annomod.annomod; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.util.NonNullList; import net.minecraft.util.registry.Registry; import java.util.function.Supplier; public class ModItemGroups { public static class ModItemGroup extends ItemGroup { private final Supplier<ItemStack> iconSupplier; public ModItemGroup(final String name, final Supplier<ItemStack> iconSupplier) { super(name); this.iconSupplier = iconSupplier; } @Override public ItemStack createIcon() { return iconSupplier.get(); } @Override public void fill(NonNullList<ItemStack> items) { for(Item item : Registry.ITEM) { item.fillItemGroup(this, items); } } } public static final ItemGroup MOD_ITEM_GROUP_Banner = new ModItemGroup("jolo", () -> new ItemStack(Items.LIGHT_BLUE_BANNER)); public static ItemGroup MOD_ITEM_GROUP_Skulls = (new ModItemGroup("Heads", () -> new ItemStack(Items.LIGHT_BLUE_BANNER))); public static final ItemGroup MOD_ITEM_GROUP_Standart = new ModItemGroup(annomod.MOD_ID, () -> new ItemStack(ItemInit.erstes_item)); public static final ItemGroup MOD_ITEM_GROUP_Rest = new ModItemGroup("Rest", () -> new ItemStack(Items.LIGHT_BLUE_BANNER)); } or here from pastebin: https://pastebin.com/EMm8BqyA
×
×
  • Create New...

Important Information

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