diff --git a/build.gradle b/build.gradle index f6eb03a..c177234 100755 --- a/build.gradle +++ b/build.gradle @@ -25,7 +25,7 @@ repositories { maven { name "mvnmrtjp" - url "http://projectredwiki.com/maven" + url "http://files.projectredwiki.com/maven" } } diff --git a/build.properties b/build.properties index 9c9c834..6afb20f 100755 --- a/build.properties +++ b/build.properties @@ -3,5 +3,5 @@ mod.version=0.0.1 mc.version=1.7.10 forge.version=10.13.3.1399-1.7.10 -mrtjp.version=1.1.0.26 +mrtjp.version=1.1.0.31 ccl.version=1.1.3.136 \ No newline at end of file diff --git a/resources/Changelog b/resources/Changelog index ddc55a0..7a8c0e1 100755 --- a/resources/Changelog +++ b/resources/Changelog @@ -1,3 +1,7 @@ +v0.0.1.4 +- FIX: Entities falling through frames during movement +- FIX: Crash when configs try to register mod names with certain characters + v0.0.1.3 - FIX: Frame render crash when all 6 sides have no crosses diff --git a/resources/dependancies.info b/resources/dependancies.info index 2c97467..5e98358 100755 --- a/resources/dependancies.info +++ b/resources/dependancies.info @@ -1,5 +1,5 @@ [{ - "repo": "http://projectredwiki.com/maven/mrtjp/MrTJPCore/@MC_VERSION@-@MRTJP_VERSION@/", + "repo": "http://files.projectredwiki.com/maven/mrtjp/MrTJPCore/@MC_VERSION@-@MRTJP_VERSION@/", "file": "MrTJPCore-@MC_VERSION@-@MRTJP_VERSION@-universal.jar", "dev": "MrTJPCore-@MC_VERSION@-@MRTJP_VERSION@-dev.jar", "class": "mrtjp.core.handler.MrTJPCoreMod" diff --git a/src/mrtjp/relocation/blocks.scala b/src/mrtjp/relocation/blocks.scala index ab01a63..4670b03 100755 --- a/src/mrtjp/relocation/blocks.scala +++ b/src/mrtjp/relocation/blocks.scala @@ -51,10 +51,11 @@ object TileMovingRow class TileMovingRow extends InstancedBlockTile { + var prevProg = 0.0 + override def update() { if (!MovementManager2.isMoving(world, x, y, z)) world.setBlockToAir(x, y, z) - else pushEntities() } override def getBlock = RelocationMod.blockMovingRow @@ -72,24 +73,20 @@ class TileMovingRow extends InstancedBlockTile override def getCollisionBounds = getBlockBounds - def pushEntities() + def pushEntities(r:BlockRow, progress:Double) { - val s = MovementManager2.getEnclosedStructure(world, x, y, z) - if (s != null) + val box = Cuboid6.full.copy.add(new Vector3(r.preMoveBlocks.head)) + .add(new Vector3(BlockCoord.sideOffsets(r.moveDir)).multiply(progress)).toAABB + + val dp = (if (progress >= 1.0) progress+0.1 else progress)-prevProg + val d = new Vector3(BlockCoord.sideOffsets(r.moveDir))*dp + world.getEntitiesWithinAABBExcludingEntity(null, box) match { - val r = s.rows.find(_.contains(x, y, z)).get - val box = TileMovingRow.getBoxFor(world, r, s.progress).add(new Vector3(r.pos)) - val d = new Vector3(BlockCoord.sideOffsets(r.moveDir))*s.speed - world.getEntitiesWithinAABBExcludingEntity(null, box.toAABB) match - { - case list:JList[_] => for (e <- list.asInstanceOf[JList[Entity]]) - { - e.moveEntity(0, d.y max 0, 0) - e.addVelocity(d.x, d.y, d.z) - e.velocityChanged = true - } - case _ => - } + case list:JList[_] => + for (e <- list.asInstanceOf[JList[Entity]]) e.moveEntity(d.x, d.y max 0, d.z) + case _ => } + + prevProg = progress } } \ No newline at end of file diff --git a/src/mrtjp/relocation/handler/proxies.scala b/src/mrtjp/relocation/handler/proxies.scala index 5ab073e..aab33d6 100755 --- a/src/mrtjp/relocation/handler/proxies.scala +++ b/src/mrtjp/relocation/handler/proxies.scala @@ -36,6 +36,15 @@ class RelocationProxy_server API.registerPreferredMover("mod:EnderStorage", "coordpush") API.registerPreferredMover("mod:ChickenChunks", "coordpush") API.registerPreferredMover("mod:Translocator", "coordpush") + API.registerPreferredMover("mod:ProjRed|Compatibility", "coordpush") + API.registerPreferredMover("mod:ProjRed|Core", "coordpush") + API.registerPreferredMover("mod:ProjRed|Expansion", "coordpush") + API.registerPreferredMover("mod:ProjRed|Exploration", "coordpush") + API.registerPreferredMover("mod:ProjRed|Fabrication", "coordpush") + API.registerPreferredMover("mod:ProjRed|Illumination", "coordpush") + API.registerPreferredMover("mod:ProjRed|Integration", "coordpush") + API.registerPreferredMover("mod:ProjRed|Transmission", "coordpush") + API.registerPreferredMover("mod:ProjRed|Transportation", "coordpush") } def init() diff --git a/src/mrtjp/relocation/movement.scala b/src/mrtjp/relocation/movement.scala index 0e41041..0fc66c8 100755 --- a/src/mrtjp/relocation/movement.scala +++ b/src/mrtjp/relocation/movement.scala @@ -8,10 +8,12 @@ package mrtjp.relocation import codechicken.lib.data.{MCDataInput, MCDataOutput} import codechicken.lib.packet.PacketCustom import codechicken.lib.vec.BlockCoord +import cpw.mods.fml.relauncher.{Side, SideOnly} import mrtjp.core.math.MathLib import mrtjp.core.world.WorldLib import mrtjp.relocation.api.{IMovementCallback, IMovementDescriptor} import mrtjp.relocation.handler.{RelocationConfig, RelocationSPH} +import net.minecraft.client.Minecraft import net.minecraft.init.Blocks import net.minecraft.world.{ChunkCoordIntPair, World} import net.minecraftforge.common.DimensionManager @@ -24,11 +26,22 @@ object MovementManager2 val serverRelocations = MHashMap[Int, WorldStructs]() val clientRelocations = MHashMap[Int, WorldStructs]() - def relocationMap(client:Boolean) = if (client) clientRelocations else serverRelocations + def relocationMap(isClient:Boolean) = if (isClient) clientRelocations else serverRelocations def getWorldStructs(w:World) = relocationMap(w.isRemote).getOrElseUpdate(w.provider.dimensionId, new WorldStructs) + def getWorld(dim:Int, isClient:Boolean) = + if (!isClient) DimensionManager.getWorld(dim) + else getClientWorld(dim) + + @SideOnly(Side.CLIENT) + private def getClientWorld(dim:Int):World = + { + val w = Minecraft.getMinecraft.theWorld + if (w.provider.dimensionId == dim) w else null + } + def writeDesc(w:World, chunks:Set[ChunkCoordIntPair], out:MCDataOutput) = { var send = false @@ -135,16 +148,23 @@ object MovementManager2 true } - def onTick(client:Boolean) + def onTick(isClient:Boolean) { - val map = relocationMap(client) - map.values.foreach(_.pushAll()) - if (!client) + val map = relocationMap(isClient) + for ((dim, ws) <- map) if (ws.nonEmpty) + { + ws.pushAll() + val world = getWorld(dim, isClient) + if (world != null) for (bs <- ws.structs) for (br <- bs.rows) + br.pushEntities(world, bs.progress) + } + + if (!isClient) { val fin = map.map(pair => (pair._1, pair._2.removeFinished())).filter(_._2.nonEmpty) for ((dim, b) <- fin) { - val w = DimensionManager.getWorld(dim) + val w = getWorld(dim, false) if (w != null) for (s <- b) { cycleMove(w, s) @@ -162,6 +182,7 @@ object MovementManager2 def clientCycleMove(w:World, struct:BlockStruct) { getWorldStructs(w).removeStruct(struct) + struct.rows.foreach(_.pushEntities(w, 1.0)) cycleMove(w, struct) } @@ -187,6 +208,8 @@ class WorldStructs def isEmpty = structs.isEmpty + def nonEmpty = !isEmpty + def contains(x:Int, y:Int, z:Int) = structs.exists(_.contains(x, y, z)) def addStruct(b:BlockStruct){ structs += b } @@ -355,6 +378,15 @@ class BlockRow(val pos:BlockCoord, val moveDir:Int, val size:Int) else false } + def pushEntities(w:World, progress:Double) + { + WorldLib.uncheckedGetTileEntity(w, pos.x, pos.y, pos.z) match + { + case te:TileMovingRow => te.pushEntities(this, progress) + case _ => + } + } + def doMove(w:World) { if (pos.y < 0 || pos.y >= 256) return diff --git a/src/mrtjp/relocation/registry.scala b/src/mrtjp/relocation/registry.scala index 680f985..cb92134 100755 --- a/src/mrtjp/relocation/registry.scala +++ b/src/mrtjp/relocation/registry.scala @@ -22,10 +22,10 @@ import scala.collection.immutable.ListMap object MovingTileRegistry extends ITileMover { - val rKeyVal = raw"([\w:]+)\s*->\s*(.+)".r - val rName = raw"(.+)".r - val rNameMetaM = raw"(.+)m(\d+)".r - val rMod = raw"mod:(\w+)".r + val rKeyVal = raw"([^\s]+.+[^\s]+)\s*->\s*([^\s]+.+[^\s]+)".r + val rName = raw"([^\s]+.+[^\s]+)".r + val rNameMetaM = raw"([^\s]+.+[^\s]+)m(\d+)".r + val rMod = raw"mod:([^\s]+.+[^\s]+)".r var blockMetaMap = Map[(Block, Int), ITileMover]() var modMap = Map[String, ITileMover]()