Jump to content

LizNet

Members
  • Posts

    17
  • Joined

  • Last visited

Posts posted by LizNet

  1. Solved the problem with some help from Discord. The problem was in my BaseBinBlock.java file:

    I had this in my place logic which was causing the bug:

    protected void checkPoweredState(Level level, BlockPos pos, BlockState state) 
    {
      boolean flag = level.hasNeighborSignal(pos);
      if (flag != state.getValue(POWERED))
        level.setBlock(pos, state.setValue(POWERED, Boolean.valueOf(flag)), Block.UPDATE_INVISIBLE);
    }

    and changing it to like this fixed it:

    protected void checkPoweredState(Level level, BlockPos pos, BlockState state) 
    {
      boolean flag = level.hasNeighborSignal(pos);
      if (flag != state.getValue(POWERED))
        level.setBlock(pos, state.setValue(POWERED, Boolean.valueOf(flag)), Block.UPDATE_ALL);
    }

    Now the onLoad override is no longer needed either.

     

    So in short: I needed to use Block.UPDATE_ALL, not Block.UPDATE_INVISIBLE in Level#setBlock().

  2. 14 hours ago, ChampionAsh5357 said:

    I think that's a good enough solution since block entities are updated on the client before they actually get the data from the server iirc. You can try syncing on block update though.

    Okay, if that's fine then I'll use it. I already sync on block update because I have custom data with the blocks. Should I still add this:

    @Override
    public void onLoad()
    {
      super.onLoad();
      this.level.updateNeighborsAt(getBlockPos(), getBlockState().getBlock());
      this.level.sendBlockUpdated(getBlockPos(), getBlockState(), getBlockState(), 2) // Not sure about the 2
    }

     

    Also, that whole bug seems weird because it seems to be something that needs to be exclusively coded. I'm very confused about how I even broke the vanilla mechanic in the first place..

  3. I have been updating my mod to a newer versions but encountered a very weird bug that I cannot solve: my block does not inform surrounding blocks nor other players when it is placed to ground.

     

    For example:

    1. I put my block to the ground; no other player can see it but it has collision, so it behaves like a "ghost block". If other player right-clicks the block then it turns visible.

    2. I put my block (with fluid capability) to the ground under a pipe, the pipe does not connect to the block. I put pipe top of my block, it connects normally. It seems that the pip doesn't know that my block is there if the block is placed afterwards.

     

    I managed to "fix" the second problem by adding this to my BlockEntity class, but it seems just a workaround:

    @Override
    public void onLoad()
    {
      super.onLoad();
      this.level.updateNeighborsAt(getBlockPos(), getBlockState().getBlock());
    }

     

    Full WIP source available in GitHub.

  4. 4 hours ago, Matryoshika said:

    The network I'm part of, makes use of TickProfiler, a Forge mod that lists resource-hogging Tile-Entities and Entities, per time/tick average, per tps%¹ they are draining, per chunk² and per type³

     

    ¹Take this with a bit of salt. If something states it is causing 50% of the drain, it may very well be a big drain, but the profile cannot see everything, yet tries to stretch what it can see to how much is drained.

    ²allows you to see the chunks with highest activity, most of the time player-bases centered in a single chunk, for example

    ³Shows the tile-entities and entities that collectively stand for the most drain. Take this with a bit of salt as well, as it does not take into account -how many- of said type there are.

    While this may not solve your issue, it should enable you to find the largest TPS-drains on your server.

    Tried th TickProfiler, then removed Forge Essentials and I have saw none of thse warnings anymore. So it was caused by Forge Essentials, don't know why it used so much resources that the server was unplayable. But thanks to you (and TickProfiler) I managed to solve this!

     

    Now I can even use Sponge at the same time.

  5. 1 minute ago, LexManos said:

    There is nothing we can do to tell you what is lagging your server.

    Something is either the number of mods you have on it or the machine you have in the world.

    Start removing mods, start unloading chunks.

    I just hoped that there's some kind of timings function like Paper has. It's so handy for situations like this. There's so many mods that it would be nice if Forge has some mods which can do timings report.

  6. I've noticed that my server constantly gives that annoying "Can't keep up!" warning and the whole server freezes at little time when server is skipping ticks. This happens few time in five minutes so it's frustrating.

     

    My modlist is this:

    Spoiler

    # --- ModList ---
    # Generated: 10-3-2017 (Server time)
    # Change the location of this file in main.cfg

    Minecraft Coder Pack;9.19;http://www.modcoderpack.com/website/
    Forge Mod Loader;8.0.99.99;https://github.com/MinecraftForge/FML/wiki
    Minecraft Forge;12.18.3.2272;http://minecraftforge.net
    Applied Energistics 2 Core;rv4-alpha-11;http://ae2.ae-mod.info
    Aroma1997Core;${version};http://www.minecraftforum.net/topic/1679684-
    CoFH ASM;000;
    ccl-entityhook;1.0;
    Forge Creeper Heal 2.0.1;2.0.1;http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/2482250-forge-creeper-heal
    Applied Energistics 2;rv4-alpha-11;http://ae2.ae-mod.info
    BD Lib;1.12.4.24;bdew.net/mods/
    AE2 Stuff;0.6.0.9;bdew.net
    Aroma1997Core|Helper;1.1.1.2;http://www.minecraftforum.net/topic/1679684-
    Aroma1997's Dimensional World;1.0;
    Chameleon;1.10-2.2.2;http://www.jaquadro.com/
    Chisel;MC1.10.2-0.0.8.11;https://minecraft.curseforge.com/projects/chisel
    CodeChicken Lib;2.5.4.218;http://chickenbones.net/Pages/links.html
    CodeChicken Core;2.4.0.101;http://www.minecraftforum.net/topic/909223
    CoFH Core;4.1.1;http://www.teamcofh.com
    CompactStorage;v2.0.0a;http:/github.com/Workshop-Development/CompactChests/
    CXLibrary;1.2.3;
    Death Quotes;1.0.1;https://minecraft.curseforge.com/members/andrenoel1/projects
    DrugsGalore;1.2.4;https://decmods.weebly.com/
    Dynmap;2.4-8;http://www.minecraftforum.net/topic/1543523-dynmap-dynmap-web-maps-for-minecraft/
    Elevator Mod;1.3.0;
    Logical Drops;0.9.4;TBD
    EnderCore;1.10.2-0.4.1.65-beta;http://enderio.com
    Ender IO;1.10.2-3.1.156;http://enderio.com
    EnderStorage;2.2.1.103;http://www.minecraftforum.net/topic/909223
    Extra Utilities 2;1.0;
    Forge Essentials;10.1.0;https://github.com/ForgeEssentials/ForgeEssentials
    Forge Multipart CBE;2.0.0.24;https://github.com/Chicken-Bones/ForgeMultipart
    Forge Microblocks;2.0.0.24;https://github.com/Chicken-Bones/ForgeMultipart
    Minecraft Multipart Plugin;2.0.0.24;https://github.com/Chicken-Bones/ForgeMultipart
    Gravestone;1.5.12;
    HelpFixer;1.0;
    Mantle;1.10.2-1.1.5.205;https://github.com/SlimeKnights/Mantle
    Tinkers' Construct;1.10.2-2.6.3.500;https://github.com/SlimeKnights/TinkersConstruct
    Immersive Engineering;0.10-56;https://github.com/BluSunrize/ImmersiveEngineering
    Iron Backpacks;1.10.2-2.2.22;
    Iron Chest;1.10.2-7.0.11.797;http://www.minecraftforum.net/topic/981855-
    Particle generator;1.10.2-0.1.2-hotfix;https://minecraft.curseforge.com/projects/particlesgenerator
    LlamaMod;1.5;
    MCMultiPart;1.4.0;
    Mekanism;9.2.2;
    More Furnaces;1.8.6;http://www.minecraftforum.net/topic/506109-
    MorePlayerModels;1.10.2;http://www.kodevelopment.nl/minecraft/moreplayermodels/
    Morpheus;1.10.2-3.1.13;http://www.curse.com/mc-mods/Minecraft/morpheus
    Placeable Gunpowder;1.1_1.9.4;
    QuantumFlux;2.0.11;
    Reptile Mod;3.5.2;
    RikMuld's Core;1.2e-1.9.4;rikmuld.com
    Roguelike Dungeons;1.5.6;
    Realistic Terrain Generation;4.1.2.4;https://github.com/Team-RTG/Realistic-Terrain-Generation
    SafeJoin;1.3;https://minecraft.curseforge.com/projects/safejoin
    Server Tick Monitor;1.0.1;http://minecraft.curseforge.com/projects/server-tick-monitor
    Simulated Nights;1.11.2-1.1.2;https://minecraft.curseforge.com/projects/simulated-nights
    Soul Shards - The Old Ways;1.10.2-2.6.7-48;
    Storage Drawers;1.10.2-3.5.17;http://www.jaquadro.com/
    The Camping Mod 2;2.3d-1.9.4;rikmuld.com
    Thermal Foundation;2.0.5;http://www.teamcofh.com
    Toby Mod Chest;1.2;
    WorldEdit;6.1.4;http://wiki.sk89q.com/wiki/WorldEdit
    WirelessRedsone-CBE;2.0.0;http://chickenbones.net/pages/Links.html

    and my server's specs are:

    Intel Core i7-2700K

    20Gb DDR3 1600MHz

    750 & 500 Gb HDD

    100/50 Mbps Internet speed

     

     

    Those warnings happens after srver boot and even if there's no even players online. I have limited the server to allow maximum 20 players byt for now only one is too much.

     

     

    Is there anythin I can do to make my server run smooth? I've searched some timings mod so I can see which causes the lag but didn't find anything.

  7. 8 hours ago, OreCruncher said:

    I have not implemented anything within the Sponge framework so I don't really know.  I suspect, though, there will be some work porting the code from the Bukkit plugin framework to the Sponge plugin framework.

    I made a littlebit googling and it seems that it's easier to port it as a Sponge plugin. I'll try different methods and report which is better.

  8. 4 hours ago, OreCruncher said:

    Actually it is capped at +/- 30M if my memory serves.  May as well be infinite. :)  And based on my recollection of Worldborder it is possible to have similar functionality as a server side Forge mod.

    I was thinking that is it easier to port Bukkit plugin to Sponge plugin instead of Forge mod? In my opinion it can make sense because they're both plugins. Correct me if I'm wrong.

  9. 1 hour ago, Awesome_Spider said:

    Umm. Why are you even trying to "port" a bukkit plugin to a forge mod in the first place? They are not the same thing, they are way different. That said, if you want to make a mod, there are many tutorials. Here is a good one:

    http://shadowfacts.net/tutorials/forge-modding-111/

    I need it for my server, there's apparently zero mods which can do same as this plugin. My only choice is try to make one myself or "port" the plugin. Thanks for the link, I'll check it tomorrow.

  10. I've been searching a mod which can do same as one Bukkit plugin can, generate round world. Apparently I didn't find any and no one wanted to port it so I decided to do it myself. I have experience about programming on multiple languages including C#, Java, PHP etc, but I don't have any experience about Bukkit plugins or Forge mods. So where to start exactly? It's very hard to find how to use Forge for creating mods (or I'm just dumb) and even harder to find corresponding structure so I can make the Plugin work as expected. I tried to port the main java file but I can't do even that.

     

    There's the original java file (Bukkit):

    Spoiler
    
    package com.wimbli.WorldBorder;
    
    import org.bukkit.Location;
    import org.bukkit.plugin.java.JavaPlugin;
    
    
    public class WorldBorder extends JavaPlugin
    {
    	public static volatile WorldBorder plugin = null;
    	public static volatile WBCommand wbCommand = null;
    	private BlockPlaceListener blockPlaceListener = null;
    	private MobSpawnListener mobSpawnListener = null;
    
    	@Override
    	public void onEnable()
    	{
    		if (plugin == null)
    			plugin = this;
    		if (wbCommand == null)
    			wbCommand = new WBCommand();
    
    		// Load (or create new) config file
    		Config.load(this, false);
    
    		// our one real command, though it does also have aliases "wb" and "worldborder"
    		getCommand("wborder").setExecutor(wbCommand);
    
    		// keep an eye on teleports, to redirect them to a spot inside the border if necessary
    		getServer().getPluginManager().registerEvents(new WBListener(), this);
    		
    		if (Config.preventBlockPlace()) 
    			enableBlockPlaceListener(true);
    
    		if (Config.preventMobSpawn())
    			enableMobSpawnListener(true);
    
    		// integrate with DynMap if it's available
    		DynMapFeatures.setup();
    
    		// Well I for one find this info useful, so...
    		Location spawn = getServer().getWorlds().get(0).getSpawnLocation();
    		Config.log("For reference, the main world's spawn location is at X: " + Config.coord.format(spawn.getX()) + " Y: " + Config.coord.format(spawn.getY()) + " Z: " + Config.coord.format(spawn.getZ()));
    	}
    
    	@Override
    	public void onDisable()
    	{
    		DynMapFeatures.removeAllBorders();
    		Config.StopBorderTimer();
    		Config.StoreFillTask();
    		Config.StopFillTask();
    	}
    
    	// for other plugins to hook into
    	public BorderData getWorldBorder(String worldName)
    	{
    		return Config.Border(worldName);
    	}
    
    	/**
    	 * @deprecated  Replaced by {@link #getWorldBorder(String worldName)};
    	 * this method name starts with an uppercase letter, which it shouldn't
    	 */
    	public BorderData GetWorldBorder(String worldName)
    	{
    		return getWorldBorder(worldName);
    	}
    
    	public void enableBlockPlaceListener(boolean enable)
    	{
    		if (enable) 
    			getServer().getPluginManager().registerEvents(this.blockPlaceListener = new BlockPlaceListener(), this);
    		else if (blockPlaceListener != null)
    			blockPlaceListener.unregister();
    	}
    
    	public void enableMobSpawnListener(boolean enable)
    	{
    		if (enable)
    			getServer().getPluginManager().registerEvents(this.mobSpawnListener = new MobSpawnListener(), this);
    		else if (mobSpawnListener != null)
    			mobSpawnListener.unregister();
    	}
    }

     

    An there's my version of it (Forge):

    Spoiler

    Yes, I commented the lines which I have no idea what to do..

    
    package fi.liznet.WorldBorderForge;
    
    import net.minecraftforge.fml.common.Mod.EventHandler;
    import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
    
    // import org.bukkit.Location;
    // import org.bukkit.plugin.java.JavaPlugin;
    
    
    public class WorldBorder
    {
    	public static volatile WorldBorder plugin = null;
    	public static volatile WBCommand wbCommand = null;
    	private BlockPlaceListener blockPlaceListener = null;
    	private MobSpawnListener mobSpawnListener = null;
    
    	@EventHandler
    	public void onEnable(FMLPreInitializationEvent event)
    	{
    		if (plugin == null)
    			plugin = this;
    		if (wbCommand == null)
    			wbCommand = new WBCommand();
    
    		// Load (or create new) config file
    		Config.load(this, false);
    
    		// our one real command, though it does also have aliases "wb" and "worldborder"
    		//getCommand("wborder").setExecutor(wbCommand);
    
    		// keep an eye on teleports, to redirect them to a spot inside the border if necessary
    		//getServer().getPluginManager().registerEvents(new WBListener(), this);
    		
    		if (Config.preventBlockPlace()) 
    			enableBlockPlaceListener(true);
    
    		if (Config.preventMobSpawn())
    			enableMobSpawnListener(true);
    
    		// integrate with DynMap if it's available
    		DynMapFeatures.setup();
    
    		// Well I for one find this info useful, so...
    		
    		//Location spawn = getServer().getWorlds().get(0).getSpawnLocation();
    		//World world = Minecraft.getMinecraft().theWorld;
    		//MinecraftServer.getServer()
    		//getSpawnPoint()
    		
    		//Config.log("For reference, the main world's spawn location is at X: " + Config.coord.format(spawn.getX()) + " Y: " + Config.coord.format(spawn.getY()) + " Z: " + Config.coord.format(spawn.getZ()));
    	}
    
    	public void onDisable()
    	{
    		DynMapFeatures.removeAllBorders();
    		Config.StopBorderTimer();
    		Config.StoreFillTask();
    		Config.StopFillTask();
    	}
    
    	// for other plugins to hook into
    	public BorderData getWorldBorder(String worldName)
    	{
    		return Config.Border(worldName);
    	}
    
    	/**
    	 * @deprecated  Replaced by {@link #getWorldBorder(String worldName)};
    	 * this method name starts with an uppercase letter, which it shouldn't
    	 */
    	public BorderData GetWorldBorder(String worldName)
    	{
    		return getWorldBorder(worldName);
    	}
    
    	public void enableBlockPlaceListener(boolean enable)
    	{
    		if (enable) {
    			//getServer().getPluginManager().registerEvents(this.blockPlaceListener = new BlockPlaceListener(), this);
    		}else if (blockPlaceListener != null)
    			blockPlaceListener.unregister();
    	}
    
    	public void enableMobSpawnListener(boolean enable)
    	{
    		if (enable){
    			//getServer().getPluginManager().registerEvents(this.mobSpawnListener = new MobSpawnListener(), this);
    		}else if (mobSpawnListener != null)
    			mobSpawnListener.unregister();
    	}
    }

     

     

    So can you guys help me to make some progress? I'm totally noob what comes to modding Minecraft, so any kind of advice is welcome.

  11. On 16.2.2017 at 7:07 AM, Leomelonseeds said:

    For keepdeathdrop, you could try the gravestone mod...

    For the others, you could just do a quick google search, or are you lazy and post here just to make other people do that for you...

    Thanks, I'll check that and report back if it's the one!

     

    For the laziness, are you refering to dynmap? Last time I checked there was only unofficial version for MC 1.9.4, though it worked, it also glitched/bugged a lot. I checked it now and seems that it's updated to 1.10.2, so it's my bad it isn't on the list. I've googled already for other corresponding mods, but it's difficult to google mods if you don't know their names, like I said before, this is first time for me setting up a Forge server. I've planned this server upgrade for months now, so I'm done some research already.

     

    EDIT :

    Tried the Grave Stone Mod and it's great, thanks again!

  12. I've searched a server that supports both, the Bukkit plugins and the Forge mods but apparently there's none at the moment of writing. So what I'm asking for is that I want to know if there's an alternative mods to replace the plugins I need for my server. I'll update the list when I found a compatible mod for that plugin.

     

    I'm using Minecraft version 1.10.2 (might update to 1.11 if there's enough support for it)

     

    My plugins are:

    ClearLag (important, my server isn't a super-xeon-server powerful)

    Dynmap (important, I totally need a map) [DynmapForge]

    WorldEdit (not so important, but it's good for a little "fixing")

    GiantTrees (kinda important, this is one of my servers "trademarks" and people really like it)

    WorldBorder (very important, needed for pre-generating a circle shaped map)

    EntityWatch (important for same reasons that ClearLag)

    KeepDeathDrop (important because of ClearLag) [GraveStone Mod]

    PurpleIRC (not so important, used only to merge two minecraft servers chat)

    BackupManager (kinda important, you never know what might happen)

    UltimateCore (not so important, only used for nice messages for player events. also causes lag) [SpongeForge with Nucleus]

    PetMaster (not important)

    WorldGuard (important, I don't want to know what kind of things the players try to do) [SpongeForge with FoxGuard]

     

    Best solution is to be able to run both, the Forge and the Bukkit, but if that's not possible anymore then I'll switch fully to Forge. I originally posted this to the Minecraft Forum but then realize that here, on the Forge forums, might be a little more knowledge about Forge... I've never ran Forge server before so any tricks and tips are also welcome.

     

    Thanks you guys in advance!

     

    Spoiler

    For moderators: If there's better place to this, please move or tell me.

     

  13. I tried to communicate with Minecraft Server by using C#. What I try to do is receive information about server (name, motd, icon etc.) by pinging it like a client. I used information from http://stackoverflow.com/questions/15693583/c-sharp-ping-minecraft and http://wiki.vg/Server_List_Ping but I can't get this to work.

     

    I can connect and send bytes to it but when I read the response from server I get only a byte "00FF". There's no error's or anything.

     

    What am I doing wrong?  ???

     

    Sample code I'm using:

     

    try
            {
                Console.WriteLine("Connecting...");
                TcpClient tcpClient = new TcpClient("127.0.0.1", 25565);
                NetworkStream netStream = tcpClient.GetStream();
                Console.WriteLine("Connected.");
    
                if (netStream.CanWrite)
                {
                    Console.WriteLine("Writing...");
                    byte[] bytes = { 0xFE };
                    netStream.Write(bytes, 0, bytes.Length);
                    Console.WriteLine("Written.");
                }
                else
                {
                    Console.WriteLine("Can't write to the stream!");
                }
    
                if (netStream.CanRead)
                {
                    Console.WriteLine("Reading...");
                    byte[] bytes = new byte[tcpClient.ReceiveBufferSize];
                    netStream.Read(bytes, 0, bytes.Length);
    
                    richTextBox1.AppendText(Encoding.Default.GetString(bytes));
    
                    Console.WriteLine("Read.");
                }
                else
                {
                    Console.WriteLine("Can't read from the stream!");
                }
    
                Console.WriteLine("Closing...");
                netStream.Close();
                tcpClient.Close();
                Console.WriteLine("Closed.");
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
    

     

     

    EDIT:

     

    Turned out that I was trying to ping the server by using the legacy way and that's not working anymore.

     

    Found a proper connection info, but I don't know how to do it in C#:

     

    Client to Server:
    
    1. FE — packet identifier for a server list ping
    2. 01 — server list ping's payload (always 1)
    3. FA — packet identifier for a plugin message
    4. 00 0B — length of following string, in characters, as a short (always 11)
    5. 00 4D 00 43 00 7C 00 50 00 69 00 6E 00 67 00 48 00 6F 00 73 00 74 — the string MC|PingHost encoded as a UTF-16BE string
    6. XX XX — length of the rest of the data, as a short. Compute as 7 + len(hostname), where len(hostname) is the number of bytes in the UTF-16BE encoded hostname.
    7. XX — protocol version, e.g. 4a for the last version (74)
    8. XX XX — length of following string, in characters, as a short
    9. ... — hostname the client is connecting to, encoded as a UTF-16BE string
    10. XX XX XX XX — port the client is connecting to, as an int. 
    
    
    Server to Client:
    
    The server responds with a 0xFF kick packet. The packet begins with a single byte identifier ff, then a two-byte big endian short giving the length of the following string in characters. You can actually ignore the length because the server closes the connection after the response is sent.
    
    After the first 3 bytes, the packet is a UTF-16BE string. It begins with two characters: §1, followed by a null character. On the wire these look like 00 a7 00 31 00 00.
    
    The remainder is null character (that is 00 00) delimited fields:
    
    1. Protocol version (e.g. 74)
    2. Minecraft server version (e.g. 1.8.7)
    3. Message of the day (e.g. A Minecraft Server)
    4. Current player count
    5. Max players 
    

     

    Source: http://wiki.vg/Server_List_Ping#1.6

     

    If anyone knows how to send right information to the server with C# I'll appreciate it. A lot.  ;D

     

    This is also my first post here, so if there's a better section for this please move this topic.  :)

×
×
  • Create New...

Important Information

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