From c82c89dfecf078ba860178094a5be05040e064b6 Mon Sep 17 00:00:00 2001
From: DBotThePony <dbotthepony@yandex.ru>
Date: Sun, 20 Feb 2022 14:38:42 +0700
Subject: [PATCH] Misc fixes

---
 .../kotlin/ru/dbotthepony/kbox2d/dynamics/B2Body.kt | 13 +++++++------
 .../kotlin/ru/dbotthepony/kstarbound/world/Chunk.kt |  2 +-
 .../kotlin/ru/dbotthepony/kstarbound/world/World.kt |  2 --
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/kbox2d/kotlin/ru/dbotthepony/kbox2d/dynamics/B2Body.kt b/src/kbox2d/kotlin/ru/dbotthepony/kbox2d/dynamics/B2Body.kt
index 9ab5d1be..baf9f335 100644
--- a/src/kbox2d/kotlin/ru/dbotthepony/kbox2d/dynamics/B2Body.kt
+++ b/src/kbox2d/kotlin/ru/dbotthepony/kbox2d/dynamics/B2Body.kt
@@ -1,3 +1,6 @@
+
+@file:Suppress("unused")
+
 package ru.dbotthepony.kbox2d.dynamics
 
 import ru.dbotthepony.kbox2d.api.*
@@ -273,7 +276,7 @@ class B2Body(def: BodyDef, world: B2World) {
 				val broadPhase = world.contactManager.broadPhase
 
 				for (fixture in fixtureIterator) {
-					(fixture as B2Fixture).createProxies(broadPhase, transform)
+					fixture.createProxies(broadPhase, transform)
 				}
 
 				world.notifyNewContacts()
@@ -284,7 +287,7 @@ class B2Body(def: BodyDef, world: B2World) {
 				val broadPhase = world.contactManager.broadPhase
 
 				for (fixture in fixtureIterator) {
-					(fixture as B2Fixture).destroyProxies(broadPhase)
+					fixture.destroyProxies(broadPhase)
 				}
 
 				// Destroy the attached contacts.
@@ -478,8 +481,6 @@ class B2Body(def: BodyDef, world: B2World) {
 			}
 		}
 
-		fixture as B2Fixture
-
 		if (isEnabled) {
 			fixture.destroyProxies(world.contactManager.broadPhase)
 		}
@@ -868,11 +869,11 @@ class B2Body(def: BodyDef, world: B2World) {
 			transform1.position = sweep.c0 - transform1.rotation.times(sweep.localCenter)
 
 			for (fixture in fixtureIterator) {
-				(fixture as B2Fixture).synchronize(broadPhase, transform1, transform)
+				fixture.synchronize(broadPhase, transform1, transform)
 			}
 		} else {
 			for (fixture in fixtureIterator) {
-				(fixture as B2Fixture).synchronize(broadPhase, transform, transform)
+				fixture.synchronize(broadPhase, transform, transform)
 			}
 		}
 	}
diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/world/Chunk.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/world/Chunk.kt
index 2096f061..c113d1f6 100644
--- a/src/main/kotlin/ru/dbotthepony/kstarbound/world/Chunk.kt
+++ b/src/main/kotlin/ru/dbotthepony/kstarbound/world/Chunk.kt
@@ -464,7 +464,7 @@ abstract class Chunk<WorldType : World<WorldType, This>, This : Chunk<WorldType,
 		}
 
 		override fun randomLongFor(x: Int, y: Int): Long {
-			return super.randomLongFor(x, y) xor (world?.seed ?: 0L)
+			return super.randomLongFor(x, y) xor world.seed
 		}
 	}
 
diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/world/World.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/world/World.kt
index ab0b1321..bc5a3d73 100644
--- a/src/main/kotlin/ru/dbotthepony/kstarbound/world/World.kt
+++ b/src/main/kotlin/ru/dbotthepony/kstarbound/world/World.kt
@@ -442,8 +442,6 @@ abstract class World<This : World<This, ChunkType>, ChunkType : Chunk<This, Chun
 								}
 							}
 						}
-
-						potentialAABB = worldaabb + deltaMovement
 					}
 				}