Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21da7aae0e | ||
|
|
eacf6f7dd7 | ||
|
|
cd90218a37 | ||
|
|
93b3283d8b | ||
|
|
51cc5d1cd1 | ||
|
|
614b2d4e3e | ||
|
|
aebd3ebf8c | ||
|
|
ccb66ee3b1 | ||
|
|
d37209b9e1 | ||
|
|
972ccacc69 | ||
|
|
e58530f587 | ||
|
|
c75c509fda | ||
|
|
b2c051b597 |
No files matched your search
@@ -0,0 +1,17 @@
|
||||
name: Optimize images
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master, main, release/** ]
|
||||
paths:
|
||||
- "**/*.png"
|
||||
|
||||
push:
|
||||
branches: [ master, main, release/** ]
|
||||
paths:
|
||||
- "**/*.png"
|
||||
|
||||
jobs:
|
||||
optimize-images:
|
||||
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/optimize-images.yml@master
|
||||
secrets: inherit
|
||||
@@ -30,3 +30,4 @@ src/main/resources/mixins.*.json
|
||||
*.bat
|
||||
*.DS_Store
|
||||
!gradlew.bat
|
||||
layout.json
|
||||
@@ -1,6 +0,0 @@
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'FMLCorePlugin': 'mrtjp.relocation.asm.RelocationPlugin'
|
||||
attributes 'FMLCorePluginContainsFMLMod': true
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
dependencies {
|
||||
api 'com.github.GTNewHorizons:MrTJPCore:1.3.0:dev'
|
||||
api('com.github.GTNewHorizons:CodeChickenCore:1.4.17:dev')
|
||||
api 'com.github.GTNewHorizons:MrTJPCore:1.3.7:dev'
|
||||
}
|
||||
@@ -14,7 +14,7 @@ modId = ForgeRelocation
|
||||
modGroup = mrtjp.relocation
|
||||
|
||||
# Whether to use modGroup as the maven publishing group.
|
||||
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
|
||||
# When false, com.github.GTNewHorizons is used.
|
||||
useModGroupForPublishing = false
|
||||
|
||||
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
|
||||
@@ -39,10 +39,34 @@ remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/co
|
||||
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
||||
developmentEnvironmentUserName = Developer
|
||||
|
||||
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
|
||||
# See https://github.com/bsideup/jabel for details on how this works.
|
||||
# Enables modern Java syntax support. Valid values:
|
||||
# - false: No modern syntax, Java 8 only
|
||||
# - jabel: Jabel syntax-only support, compiles to J8 bytecode
|
||||
# - jvmDowngrader: Full modern Java via JVM Downgrader (syntax + stdlib APIs)
|
||||
# - modern: Native modern Java bytecode, no downgrading
|
||||
enableModernJavaSyntax = false
|
||||
|
||||
# If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues,
|
||||
# and should *not* be used in most situations. -1 disables this.
|
||||
# forceToolchainVersion = -1
|
||||
|
||||
# Target JVM version for JVM Downgrader bytecode downgrading.
|
||||
# Only used when enableModernJavaSyntax = jvmDowngrader
|
||||
# downgradeTargetVersion = 8
|
||||
|
||||
# Comma-separated list of Java versions for multi-release jar support (JVM Downgrader only).
|
||||
# Classes will be available in META-INF/versions/N/ for each version N in this list.
|
||||
# Default: "21,25" (J25+ gets native classes, J21-24 gets partial downgrade, J8-20 gets full downgrade).
|
||||
# jvmDowngraderMultiReleaseVersions = 21,25
|
||||
|
||||
# Specifies how JVM Downgrader API stubs are provided. Options:
|
||||
# - shade: Shade minimized stubs into the jar
|
||||
# - gtnhlib: GTNHLib provides stubs at runtime (adds version constraint)
|
||||
# - external: Another dependency provides stubs (no constraint, no warning)
|
||||
# - (empty): Warning reminding you to configure stubs
|
||||
# Note: 'shade' option requires you to verify license compliance, see: https://github.com/unimined/JvmDowngrader/blob/main/LICENSE.md
|
||||
# jvmDowngraderStubsProvider =
|
||||
|
||||
# Enables injecting missing generics into the decompiled source code for a better coding experience.
|
||||
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
|
||||
enableGenericInjection = false
|
||||
@@ -96,13 +120,15 @@ usesMixinDebug = false
|
||||
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||
mixinPlugin =
|
||||
|
||||
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
||||
# Specify the package that contains all of your Mixins. The package must exist or
|
||||
# the build will fail. If you have a package property defined in your mixins.<modid>.json,
|
||||
# it must match with this or the build will fail.
|
||||
mixinsPackage =
|
||||
|
||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||
# This parameter is for legacy compatibility only
|
||||
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
|
||||
coreModClass =
|
||||
coreModClass = asm.RelocationPlugin
|
||||
|
||||
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
|
||||
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
||||
@@ -151,7 +177,7 @@ modrinthProjectId =
|
||||
# type can be one of [project, version],
|
||||
# and the name is the Modrinth project or version slug/id of the other mod.
|
||||
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
|
||||
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
|
||||
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
||||
modrinthRelations =
|
||||
|
||||
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
||||
@@ -172,6 +198,12 @@ curseForgeRelations =
|
||||
# projects. New projects should not use this parameter.
|
||||
# customArchiveBaseName =
|
||||
|
||||
# Optional parameter to customize the default working directory used by the runClient* tasks. Relative to the project directory.
|
||||
# runClientWorkingDirectory = run/client
|
||||
|
||||
# Optional parameter to customize the default working directory used by the runServer* tasks. Relative to the project directory.
|
||||
# runServerWorkingDirectory = run/server
|
||||
|
||||
# Optional parameter to have the build automatically fail if an illegal version is used.
|
||||
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
|
||||
# The check is ONLY performed if the version is a git tag.
|
||||
@@ -201,3 +233,6 @@ curseForgeRelations =
|
||||
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||
# ideaCheckSpotlessOnBuild = true
|
||||
|
||||
# Non-GTNH properties
|
||||
org.gradle.configuration-cache = true
|
||||
org.gradle.parallel = true
|
||||
@@ -0,0 +1,12 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/97d46b5ff4df0bf61e95652a190a5567/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/9ef54a08e06b0754cee9fc95ed3a3134/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/97d46b5ff4df0bf61e95652a190a5567/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/9ef54a08e06b0754cee9fc95ed3a3134/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1df82b76031285ef2e6a4f59ffe9299d/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/c7d5be6a02945ac2e045048ee54a7d32/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/97d46b5ff4df0bf61e95652a190a5567/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/9ef54a08e06b0754cee9fc95ed3a3134/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/643f404f769811f5f265fd66f7af5d89/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/38256085a73e137cb4937ea9c4807fec/redirect
|
||||
toolchainVersion=25
|
||||
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
# Copyright © 2015 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -57,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/b631911858264c0b6e4d6603d677ff5218766cee/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -86,8 +86,7 @@ done
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
||||
' "$PWD" ) || exit
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -115,7 +114,6 @@ case "$( uname )" in #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
@@ -173,7 +171,6 @@ fi
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
@@ -206,15 +203,14 @@ fi
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
|
||||
@@ -70,11 +70,10 @@ goto fail
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
|
||||
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.30'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.27'
|
||||
}
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
@@ -1,6 +0,0 @@
|
||||
[{
|
||||
"repo": "https://github.com/GTNewHorizons/MrTJPCore/releases/download/1.1.1/",
|
||||
"file": "MrTJPCore-1.7.10-1.1.1.jar",
|
||||
"dev": "MrTJPCore-1.7.10-1.1.1-dev.jar",
|
||||
"class": "mrtjp.core.handler.MrTJPCoreMod"
|
||||
}]
|
||||
|
Before Width: | Height: | Size: 274 KiB After Width: | Height: | Size: 205 KiB |
@@ -177,30 +177,20 @@ object RenderFrame extends ISimpleBlockRenderingHandler {
|
||||
id: Int,
|
||||
rb: RenderBlocks
|
||||
) = {
|
||||
renderWorldBlock(rb, world, x, y, z, world.getBlockMetadata(x, y, z))
|
||||
true
|
||||
}
|
||||
|
||||
def renderWorldBlock(
|
||||
r: RenderBlocks,
|
||||
w: IBlockAccess,
|
||||
x: Int,
|
||||
y: Int,
|
||||
z: Int,
|
||||
meta: Int
|
||||
) {
|
||||
TextureUtils.bindAtlas(0)
|
||||
val state = CCRenderState.instance
|
||||
state.resetInstance()
|
||||
state.lightMatrix.locate(w, x, y, z)
|
||||
state.setBrightnessInstance(w, x, y, z)
|
||||
state.lightMatrix.locate(world, x, y, z)
|
||||
state.setBrightnessInstance(world, x, y, z)
|
||||
|
||||
if (r.hasOverrideBlockTexture) {
|
||||
if (rb.hasOverrideBlockTexture) {
|
||||
getOrGenerateModel(0).render(
|
||||
new Translation(x, y, z),
|
||||
new IconTransformation(r.overrideBlockTexture)
|
||||
new IconTransformation(rb.overrideBlockTexture)
|
||||
)
|
||||
} else RenderFrame.render(new Vector3(x, y, z), 0)
|
||||
state.lightMatrix.access = null
|
||||
true
|
||||
}
|
||||
|
||||
def renderInvBlock(r: RenderBlocks, meta: Int) {
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package mrtjp.relocation.asm
|
||||
|
||||
import java.util.{Map => JMap}
|
||||
import cpw.mods.fml.relauncher.IFMLLoadingPlugin
|
||||
|
||||
@IFMLLoadingPlugin.MCVersion("1.7.10")
|
||||
@IFMLLoadingPlugin.TransformerExclusions(value =
|
||||
Array("mrtjp.relocation.asm.*", "scala")
|
||||
)
|
||||
class RelocationPlugin extends IFMLLoadingPlugin {
|
||||
|
||||
override def getASMTransformerClass = Array(
|
||||
"mrtjp.relocation.asm.Transformer"
|
||||
)
|
||||
override def getSetupClass = null
|
||||
override def getModContainerClass = null
|
||||
override def getAccessTransformerClass = null
|
||||
override def injectData(data: JMap[String, AnyRef]): Unit = {}
|
||||
}
|
||||
@@ -5,12 +5,9 @@
|
||||
*/
|
||||
package mrtjp.relocation.asm
|
||||
|
||||
import java.util.{Map => JMap}
|
||||
|
||||
import cpw.mods.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper.{
|
||||
INSTANCE => mapper
|
||||
}
|
||||
import cpw.mods.fml.relauncher.{IFMLCallHook, IFMLLoadingPlugin}
|
||||
import mrtjp.relocation.handler.RelocationMod
|
||||
import net.minecraft.launchwrapper.{IClassTransformer, Launch}
|
||||
import org.objectweb.asm.Opcodes._
|
||||
@@ -19,24 +16,6 @@ import org.objectweb.asm.{ClassReader, ClassWriter}
|
||||
|
||||
import scala.collection.JavaConversions._
|
||||
|
||||
/** Add "Dfml.coreMods.load=mrtjp.relocation.asm.RelocationPlugin" to launch
|
||||
* configs to enable in a development workspace.
|
||||
*/
|
||||
@IFMLLoadingPlugin.MCVersion("1.7.10")
|
||||
@IFMLLoadingPlugin.TransformerExclusions(value =
|
||||
Array("mrtjp.relocation.asm.*", "scala")
|
||||
)
|
||||
class RelocationPlugin extends IFMLLoadingPlugin with IFMLCallHook {
|
||||
override def getASMTransformerClass = Array(
|
||||
"mrtjp.relocation.asm.Transformer"
|
||||
)
|
||||
override def getSetupClass = "mrtjp.relocation.asm.RelocationPlugin"
|
||||
override def getModContainerClass = null
|
||||
override def getAccessTransformerClass = null
|
||||
override def injectData(data: JMap[String, AnyRef]): Unit = {}
|
||||
override def call(): Void = null
|
||||
}
|
||||
|
||||
class Transformer extends IClassTransformer {
|
||||
type MethodChecker = (String, MethodNode) => Boolean
|
||||
type InsTransformer = MethodNode => Unit
|
||||
|
||||
@@ -52,7 +52,9 @@ object RelocationClientEventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
def clientTick(event: TickEvent.ClientTickEvent) {
|
||||
if (event.phase == TickEvent.Phase.END)
|
||||
if (event.phase == TickEvent.Phase.END) {
|
||||
MovementManager2.onTick(true)
|
||||
MovingRenderer.onTick()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,6 @@ import net.minecraft.client.Minecraft
|
||||
import net.minecraft.init.Blocks
|
||||
import net.minecraft.world.{ChunkCoordIntPair, World}
|
||||
import net.minecraftforge.common.DimensionManager
|
||||
import scala.collection.concurrent.TrieMap
|
||||
import scala.collection.mutable.{
|
||||
HashMap => MHashMap,
|
||||
MultiMap => MMultiMap,
|
||||
@@ -27,15 +26,14 @@ import scala.collection.mutable.{
|
||||
import scala.ref.WeakReference
|
||||
|
||||
object MovementManager2 {
|
||||
val serverRelocations = MHashMap[Int, WorldStructs]()
|
||||
val clientRelocations = TrieMap[Int, WorldStructs]()
|
||||
val serverRelocations = new WorldStructsMap
|
||||
val clientRelocations = new WorldStructsMap
|
||||
|
||||
def relocationMap(isClient: Boolean) =
|
||||
if (isClient) clientRelocations else serverRelocations
|
||||
|
||||
def getWorldStructs(w: World) =
|
||||
relocationMap(w.isRemote)
|
||||
.getOrElseUpdate(w.provider.dimensionId, new WorldStructs)
|
||||
relocationMap(w.isRemote).getOrCreate(w.provider.dimensionId)
|
||||
|
||||
def getWorld(dim: Int, isClient: Boolean) =
|
||||
if (!isClient) DimensionManager.getWorld(dim)
|
||||
@@ -135,7 +133,7 @@ object MovementManager2 {
|
||||
map.addBinding(MathLib.normal(b, moveDir), MathLib.basis(b, moveDir))
|
||||
|
||||
val shift = if ((moveDir & 1) == 1) 1 else -1
|
||||
val rowB = Set.newBuilder[BlockRow]
|
||||
val rowB = Array.newBuilder[BlockRow]
|
||||
for (normal <- map.keys) {
|
||||
val line = map(normal).toArray
|
||||
val sline =
|
||||
@@ -167,24 +165,26 @@ object MovementManager2 {
|
||||
|
||||
def onTick(isClient: Boolean) {
|
||||
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)
|
||||
map.foreach { (dim, ws) =>
|
||||
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 = getWorld(dim, false)
|
||||
if (w != null) for (s <- b) {
|
||||
cycleMove(w, s)
|
||||
sendCycle(w, s)
|
||||
map.foreach { (dim, ws) =>
|
||||
val finished = ws.removeFinished()
|
||||
if (finished.nonEmpty) {
|
||||
val w = getWorld(dim, false)
|
||||
if (w != null) for (s <- finished) {
|
||||
cycleMove(w, s)
|
||||
sendCycle(w, s)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -221,33 +221,171 @@ object MovementManager2 {
|
||||
}
|
||||
}
|
||||
|
||||
class WorldStructsMap {
|
||||
private var dims = new Array[Int](4)
|
||||
private var structs = new Array[WorldStructs](4)
|
||||
private var size = 0
|
||||
|
||||
def getOrCreate(dim: Int): WorldStructs = synchronized {
|
||||
var i = 0
|
||||
while (i < size) {
|
||||
if (dims(i) == dim) return structs(i)
|
||||
i += 1
|
||||
}
|
||||
val ws = new WorldStructs
|
||||
if (size == dims.length) {
|
||||
val nd = new Array[Int](dims.length * 2)
|
||||
val ns = new Array[WorldStructs](dims.length * 2)
|
||||
System.arraycopy(dims, 0, nd, 0, size)
|
||||
System.arraycopy(structs, 0, ns, 0, size)
|
||||
dims = nd
|
||||
structs = ns
|
||||
}
|
||||
dims(size) = dim
|
||||
structs(size) = ws
|
||||
size += 1
|
||||
ws
|
||||
}
|
||||
|
||||
def foreach(f: (Int, WorldStructs) => Unit) {
|
||||
val n = synchronized { size }
|
||||
val ds = new Array[Int](n)
|
||||
val ss = new Array[WorldStructs](n)
|
||||
synchronized {
|
||||
System.arraycopy(dims, 0, ds, 0, n)
|
||||
System.arraycopy(structs, 0, ss, 0, n)
|
||||
}
|
||||
var i = 0
|
||||
while (i < n) {
|
||||
f(ds(i), ss(i))
|
||||
i += 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class WorldStructs {
|
||||
var structs: Set[BlockStruct] = Set.empty
|
||||
private val noStructs = new Array[BlockStruct](0)
|
||||
private var structsArr = new Array[BlockStruct](4)
|
||||
private var numStructs = 0
|
||||
|
||||
def isEmpty = structs.isEmpty
|
||||
def isEmpty = synchronized { numStructs == 0 }
|
||||
|
||||
def nonEmpty = !isEmpty
|
||||
def nonEmpty = synchronized { numStructs > 0 }
|
||||
|
||||
def contains(x: Int, y: Int, z: Int) = structs.exists(_.contains(x, y, z))
|
||||
def contains(x: Int, y: Int, z: Int): Boolean = synchronized {
|
||||
var i = 0
|
||||
while (i < numStructs) {
|
||||
if (structsArr(i).contains(x, y, z)) return true
|
||||
i += 1
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
def addStruct(b: BlockStruct) { structs += b }
|
||||
def addStruct(b: BlockStruct): Unit = synchronized {
|
||||
var i = 0
|
||||
while (i < numStructs) {
|
||||
if (structsArr(i).id == b.id) return
|
||||
i += 1
|
||||
}
|
||||
if (numStructs == structsArr.length) {
|
||||
val ns = new Array[BlockStruct](structsArr.length * 2)
|
||||
System.arraycopy(structsArr, 0, ns, 0, numStructs)
|
||||
structsArr = ns
|
||||
}
|
||||
structsArr(numStructs) = b
|
||||
numStructs += 1
|
||||
}
|
||||
|
||||
def pushAll() { structs.foreach(_.push()) }
|
||||
def pushAll() = synchronized {
|
||||
var i = 0
|
||||
while (i < numStructs) {
|
||||
structsArr(i).push()
|
||||
i += 1
|
||||
}
|
||||
}
|
||||
|
||||
def removeFinished() = {
|
||||
val finished = structs.filter(_.isFinished)
|
||||
structs = structs.filterNot(_.isFinished)
|
||||
def removeFinished(): Array[BlockStruct] = synchronized {
|
||||
var nf = 0
|
||||
var i = 0
|
||||
while (i < numStructs) {
|
||||
if (structsArr(i).isFinished) nf += 1
|
||||
i += 1
|
||||
}
|
||||
|
||||
if (nf == 0) return noStructs
|
||||
|
||||
val finished = new Array[BlockStruct](nf)
|
||||
var finish = 0
|
||||
var keep = 0
|
||||
i = 0
|
||||
while (i < numStructs) {
|
||||
val s = structsArr(i)
|
||||
if (s.isFinished) {
|
||||
finished(finish) = s
|
||||
finish += 1
|
||||
} else {
|
||||
structsArr(keep) = s
|
||||
keep += 1
|
||||
}
|
||||
i += 1
|
||||
}
|
||||
var j = keep
|
||||
while (j < numStructs) {
|
||||
structsArr(j) = null
|
||||
j += 1
|
||||
}
|
||||
numStructs = keep
|
||||
finished
|
||||
}
|
||||
|
||||
def removeStruct(s: BlockStruct) {
|
||||
structs = structs.filterNot(_ == s)
|
||||
def removeStruct(s: BlockStruct) = synchronized {
|
||||
var keep = 0
|
||||
var i = 0
|
||||
while (i < numStructs) {
|
||||
val cur = structsArr(i)
|
||||
if (cur != s) {
|
||||
structsArr(keep) = cur
|
||||
keep += 1
|
||||
}
|
||||
i += 1
|
||||
}
|
||||
var j = keep
|
||||
while (j < numStructs) {
|
||||
structsArr(j) = null
|
||||
j += 1
|
||||
}
|
||||
numStructs = keep
|
||||
}
|
||||
|
||||
def clear() { structs = Set.empty }
|
||||
def clear() = synchronized {
|
||||
var i = 0
|
||||
while (i < numStructs) {
|
||||
structsArr(i) = null
|
||||
i += 1
|
||||
}
|
||||
numStructs = 0
|
||||
}
|
||||
|
||||
def getChunks: Set[ChunkCoordIntPair] = {
|
||||
structs.flatMap(_.getChunks)
|
||||
def foreachStruct(f: BlockStruct => Unit) = synchronized {
|
||||
var i = 0
|
||||
while (i < numStructs) {
|
||||
f(structsArr(i))
|
||||
i += 1
|
||||
}
|
||||
}
|
||||
|
||||
def structs: Array[BlockStruct] = synchronized {
|
||||
java.util.Arrays.copyOf(structsArr, numStructs)
|
||||
}
|
||||
|
||||
def getChunks: Set[ChunkCoordIntPair] = synchronized {
|
||||
val c = Set.newBuilder[ChunkCoordIntPair]
|
||||
var i = 0
|
||||
while (i < numStructs) {
|
||||
c ++= structsArr(i).getChunks
|
||||
i += 1
|
||||
}
|
||||
c.result()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,18 +421,27 @@ class MoveDesc(b: WeakReference[BlockStruct]) extends IMovementDescriptor {
|
||||
class BlockStruct {
|
||||
var id = -1
|
||||
var speed = 1 / 16d
|
||||
var rows: Set[BlockRow] = Set.empty
|
||||
var rows: Array[BlockRow] = Array.empty
|
||||
var callback = WeakReference[IMovementCallback](null)
|
||||
|
||||
var progress = 0.0d
|
||||
|
||||
lazy val allBlocks = rows.flatMap(_.allBlocks)
|
||||
lazy val preMoveBlocks = rows.flatMap(_.preMoveBlocks)
|
||||
lazy val postMoveBlocks = rows.flatMap(_.postMoveBlocks)
|
||||
lazy val allBlocks: Set[BlockCoord] = rows.iterator.flatMap(_.allBlocks).toSet
|
||||
lazy val preMoveBlocks: Set[BlockCoord] =
|
||||
rows.iterator.flatMap(_.preMoveBlocks).toSet
|
||||
lazy val postMoveBlocks: Set[BlockCoord] =
|
||||
rows.iterator.flatMap(_.postMoveBlocks).toSet
|
||||
|
||||
def moveDir = rows.head.moveDir
|
||||
def moveDir = rows(0).moveDir
|
||||
|
||||
def contains(x: Int, y: Int, z: Int) = rows.exists(_.contains(x, y, z))
|
||||
def contains(x: Int, y: Int, z: Int): Boolean = {
|
||||
var i = 0
|
||||
while (i < rows.length) {
|
||||
if (rows(i).contains(x, y, z)) return true
|
||||
i += 1
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
def push() { progress = math.min(1.0, progress + speed) }
|
||||
|
||||
@@ -337,10 +484,12 @@ class BlockStruct {
|
||||
case _ => false
|
||||
}
|
||||
|
||||
override def hashCode() = id
|
||||
|
||||
def writeDesc(out: MCDataOutput) {
|
||||
out.writeFloat(progress.toFloat)
|
||||
out.writeFloat(speed.toFloat)
|
||||
out.writeByte(rows.size)
|
||||
out.writeByte(rows.length)
|
||||
for (r <- rows) {
|
||||
out.writeLong(WorldLib.packCoords(r.pos))
|
||||
out.writeByte(r.moveDir)
|
||||
@@ -351,7 +500,7 @@ class BlockStruct {
|
||||
def readDesc(in: MCDataInput) {
|
||||
progress = in.readFloat()
|
||||
speed = in.readFloat()
|
||||
val rb = Set.newBuilder[BlockRow]
|
||||
val rb = Array.newBuilder[BlockRow]
|
||||
for (i <- 0 until in.readUByte())
|
||||
rb += new BlockRow(
|
||||
WorldLib.unpackCoords(in.readLong()),
|
||||
@@ -370,12 +519,11 @@ class BlockRow(val pos: BlockCoord, val moveDir: Int, val size: Int) {
|
||||
def contains(x: Int, y: Int, z: Int) = {
|
||||
import MathLib.{basis, normal, shift}
|
||||
|
||||
import math.{max, min}
|
||||
|
||||
if (normal(x, y, z, moveDir) == normal(pos, moveDir)) {
|
||||
val b1 = basis(pos, moveDir)
|
||||
val b2 = b1 + size * shift(moveDir ^ 1)
|
||||
min(b1, b2) to max(b1, b2) contains basis(x, y, z, moveDir)
|
||||
val b = basis(x, y, z, moveDir)
|
||||
b >= math.min(b1, b2) && b <= math.max(b1, b2)
|
||||
} else false
|
||||
}
|
||||
|
||||
|
||||
@@ -30,9 +30,13 @@ object MovingRenderer {
|
||||
private var frame = 0.0f
|
||||
private var renderBlocks: RenderBlocks = null
|
||||
|
||||
private val renderStruct: BlockStruct => Unit = { s =>
|
||||
for (b <- s.preMoveBlocks)
|
||||
render(b.x, b.y, b.z, renderPos(s, frame))
|
||||
}
|
||||
|
||||
private def mc = Minecraft.getMinecraft
|
||||
private def world = mc.theWorld
|
||||
private def tes = Tessellator.instance
|
||||
|
||||
private def render(x: Int, y: Int, z: Int, rpos: Vector3) {
|
||||
val oldOcclusion = mc.gameSettings.ambientOcclusion
|
||||
@@ -65,8 +69,9 @@ object MovingRenderer {
|
||||
)
|
||||
|
||||
for (pass <- 0 to 1) {
|
||||
tes.startDrawingQuads()
|
||||
tes.setTranslation(
|
||||
val tess = Tessellator.instance
|
||||
tess.startDrawingQuads()
|
||||
tess.setTranslation(
|
||||
-TileEntityRendererDispatcher.staticPlayerX + MathLib
|
||||
.clamp(-1f, 1f, rpos.x.toFloat),
|
||||
-TileEntityRendererDispatcher.staticPlayerY + MathLib
|
||||
@@ -77,7 +82,7 @@ object MovingRenderer {
|
||||
rpos.z.toFloat
|
||||
)
|
||||
)
|
||||
tes.setColorOpaque(1, 1, 1)
|
||||
tess.setColorOpaque(1, 1, 1)
|
||||
|
||||
block.getRenderBlockPass
|
||||
if (block.canRenderInPass(pass)) {
|
||||
@@ -86,8 +91,8 @@ object MovingRenderer {
|
||||
renderHack = true
|
||||
}
|
||||
|
||||
tes.setTranslation(0, 0, 0)
|
||||
tes.draw()
|
||||
tess.setTranslation(0, 0, 0)
|
||||
tess.draw()
|
||||
}
|
||||
RenderHelper.enableStandardItemLighting()
|
||||
mc.entityRenderer.disableLightmap(frame)
|
||||
@@ -101,9 +106,14 @@ object MovingRenderer {
|
||||
renderBlocks.renderAllFaces = true
|
||||
}
|
||||
|
||||
for (s <- MovementManager2.getWorldStructs(world).structs)
|
||||
for (b <- s.preMoveBlocks)
|
||||
render(b.x, b.y, b.z, renderPos(s, frame))
|
||||
MovementManager2.getWorldStructs(world).foreachStruct(renderStruct)
|
||||
}
|
||||
|
||||
def onTick() = {
|
||||
if (oldWorld != null && world == null) {
|
||||
oldWorld = null
|
||||
renderBlocks = null
|
||||
}
|
||||
}
|
||||
|
||||
def onPreRenderTick(time: Float) {
|
||||
|
||||