kami-blue / client

ARCHIVED - KAMI Blue: a continuation of 1.12.2 KAMI
https://kamiblue.org
GNU Lesser General Public License v3.0
361 stars 385 forks source link

Option to not load excessive amounts of TileEntities #2180

Closed joeyjumper94 closed 3 years ago

joeyjumper94 commented 3 years ago

Is your feature request related to a problem? Please describe. people are placing so many furnaces in a chunk that if you load said chunk, your game will freeze long enough for you to time out, effectively banning you from the server Describe the solution you'd like if i could turn on an option in the NoRender module to replace the furnaces with another block clientside, that would be great Describe alternatives you've considered i have looked through dozens of other mods, but nothing seems to work Additional context

5HT2 commented 3 years ago

As far as I know, too many tile entities causes you to be kicked from Minecraft's chunk limit, not from timing out? If that's the case, I'd much prefer to just bring back the old AntiChunkBan module and clean up the code, as it just didn't load any chunk that had too much data

joeyjumper94 commented 3 years ago

normally a chunk ban happens because of the large amount of tile entites causing a chunk to send over 1MB of data, this causes a network error that is handled by disconnecting the client. 2b2t has a plugin to split such chunks so that does not happen.

the bakery has found that if you have enough tile entites in a chunk, loading it would cause your game to freeze for an amount of time when trying to render them all. during the time your client is frozen, it is not "talking" to the server, so the server times you out.

5HT2 commented 3 years ago

Do you know what's the limit of tile entities before that happens?

joeyjumper94 commented 3 years ago

no idea, i have heard that they put 69,420 furnaces in the chunk

joeyjumper94 commented 3 years ago

one idea may be to make it so that furnaces turn into coal_ore

joeyjumper94 commented 3 years ago

ok so i think my fork is failing due to it not knowing that the block is a furnace.

    fun TryReplaceFurnace(tileEntity: TileEntity): Boolean {
        if (!furnaceCoalOre.value || tileEntity !is TileEntityFurnace) return false
        runSafe {
            val blockState = Blocks.COAL_ORE.getDefaultState()
            //val blockState = Blocks.SNOW_LAYER.defaultState.withProperty(BlockSnow.LAYERS, 7)
            world.setBlockState(tileEntity.pos, blockState)
            world.markTileEntityForRemoval(tileEntity)
        }
        return true
    }
joeyjumper94 commented 3 years ago
public class MixinTileEntityRendererDispatcher {
    @Inject(method = "render(Lnet/minecraft/tileentity/TileEntity;FI)V", at = @At("HEAD"), cancellable = true)
    public void render(TileEntity entity, float partialTicks, int destroyStage, CallbackInfo ci) {
        if (NoRender.INSTANCE.isEnabled()) {
            if (NoRender.INSTANCE.tryReplaceEnchantingTable(entity) || NoRender.INSTANCE.getEntityList().contains(entity.getClass())) {
                ci.cancel();
            }
        }
    }
}

is not called for furnaces

joeyjumper94 commented 3 years ago

can you bump this to high priority? it has gotten to about 400 bans using furnace lag

KBenster commented 3 years ago

Without using non-forge mediums, chunkbanning is hard to patch. You're better off giving Hausemaster an artifact and pray he isn't overdosing before his slaves mark your email as spam.

In forgehax, it should reach 69 megabytes for it to be a chunkban, but that's not the size of the actual packet.

c0mmie commented 3 years ago

This isn't a huge problem at all, went to one of these """""ban locations""""" in vanilla, nothing happened.

czho commented 3 years ago

the ban method was from skylight, this should be closed as i just made a pr with that fix