mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-11-10 12:34:11 +01:00
Fix vanishing minecarts
This commit is contained in:
parent
a3ee39099a
commit
56150b2645
@ -12,6 +12,7 @@ import com.jozufozu.flywheel.event.BeginFrameEvent;
|
||||
import com.jozufozu.flywheel.event.RenderLayerEvent;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
|
||||
@ -100,4 +101,14 @@ public class InstanceWorld {
|
||||
public void renderLayer(RenderLayerEvent event) {
|
||||
engine.render(event, event.buffers.bufferSource());
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiate all the necessary instances to render the given world.
|
||||
*/
|
||||
public void loadEntities(ClientLevel world) {
|
||||
// Block entities are loaded while chunks are baked.
|
||||
// Entities are loaded with the world, so when chunks are reloaded they need to be re-added.
|
||||
world.entitiesForRendering()
|
||||
.forEach(entityInstanceManager::add);
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +93,8 @@ public class InstancedRenderDispatcher {
|
||||
}
|
||||
|
||||
public static void resetInstanceWorld(ClientLevel world) {
|
||||
instanceWorlds.replace(world, InstanceWorld::delete);
|
||||
instanceWorlds.replace(world, InstanceWorld::delete)
|
||||
.loadEntities(world);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user