Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

mnn

Members
  • Posts

    298
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • URL
    http://366.hopto.org/blog/

mnn's Achievements

Diamond Finder

Diamond Finder (5/8)

76

Reputation

  1. That's unfortunate nobody provides support for Forge Gradle. I kinda wonder why Forge moved to it when there's no help even with trivial tasks like this one. Alrighty then, time to hack together some script to repack jars - it will be ugly, but at least working...
  2. Glad to see some tutorials in Scala . I found a bug and some cosmetic blemishes. Highlighted version on gist github - https://gist.github.com/mnn/57cc01980312289f39e9 (it's a working Scala script). import scala.runtime.ScalaRunTime.stringOf import scala.collection.JavaConverters._ // stuff for verifying results, skip to case defs (comment -- 1 --) def doVerify[A](name: String, origRes: A, myRes: A) { val equals = origRes match { case a: Array[_] => a.sameElements(myRes.asInstanceOf[Array[_]]) case _ => origRes.equals(myRes) } if (equals) println(s"Case '$name' fine: ${stringOf(myRes)}") else println(s"Case '$name' wrong:\n${stringOf(origRes)}\nvs.\n${stringOf(myRes)}") } def verify[A, R](name: String, orig: (A) => R, mine: (A) => R, testVal: A) { doVerify(name, orig(testVal), mine(testVal)) } def verify[R](name: String, orig: () => R, mine: () => R) { doVerify(name, orig(), mine()) } // -- 1 -- def case1orig(oBounds: Seq[int]) = { var boxes = Seq(oBounds(6)) for (s <- 0 until 6) boxes :+= oBounds(s) boxes } def case1mine(oBounds: Seq[int]) = oBounds.last +: oBounds.init verify("1", case1orig, case1mine, 0 to 6) // ------- // -- 2 -- def case2orig() = { val w = "someExpression" w } def case2mine() = "someExpression" verify("2", case2orig, case2mine) // same with returning in generateBoxes, generateCollisionBoxes // ------- // -- 3 -- // Does getOcclusionBoxes even compile? There is no return value in "if" branch. /* override def getOcclusionBoxes = { import mlb.technica.experience.PipeBoxes._ if (true) else Seq(oBounds(6)).asJava } */ // Possibly what you meant: def case3orig(oBounds: Seq[int]) = { if (true) Seq().asJava else Seq(oBounds(6)).asJava } def case3mine(oBounds: Seq[int]) = Seq().asJava verify("3", case3orig, case3mine, 0 to 6) // ------- // -- 4 -- // Some implementation of used classes in snippet class Cuboid6(var a: Double, var b: Double, var c: Double, var d: Double, var e: Double, var f: Double) { def apply(r: Rotation): Cuboid6 = { a -= r.x b -= r.y c -= r.z d -= 7 * r.x e -= 9 * r.y f -= 13 * r.x this } override def equals(that: Any) = that match { case t: Cuboid6 => t.a == a && t.b == b && t.c == c && t.d == d && t.e == e && t.f == f case _ => false } override def toString() = s"Cuboid6($a, $b, $c, $d, $e, $f)" } class Rotation(val x: Double, val y: Double, val z: Double) { def at(v: Vector3): Rotation = new Rotation(x + v.x, y + 2 * v.y, z + 3 * v.z) } object Rotation { val sideRotations = (0 to 6).map(v => new Rotation(1.0 / (v + .1), 5.0 / (v + 2), 5 * (v - 3))) } class Vector3(val x: Double, val y: Double, val z: Double) object Vector3 { lazy val center = new Vector3(11, 23, 27) } // PipeBoxes.oBounds def case4orig() = { val boxes = new Array[Cuboid6](7) val w = 2 / 8D boxes(6) = new Cuboid6(0.5 - w, 0.5 - w, 0.5 - w, 0.5 + w, 0.5 + w, 0.5 + w) for (s <- 0 until 6) boxes(s) = new Cuboid6(0.5 - w, 0, 0.5 - w, 0.5 + w, 0.5 - w, 0.5 + w).apply(Rotation.sideRotations(s).at(Vector3.center)) boxes } def case4mine() = { val w = 2 / 8D val (m, p) = (.5 - w, .5 + w) ((for (s <- 0 until 6) yield new Cuboid6(m, 0, m, p, m, p).apply(Rotation.sideRotations(s).at(Vector3.center))) :+ new Cuboid6(m, m, m, p, p, p)).toArray } verify("4", case4orig, case4mine)
  3. I would like to have a second (obfuscated) jar generated from certain packages. I have almost no experiences with Gradle (but I guess this is rather Forge Gradle question, because I don't know where/how obfuscation is going on). How to achieve this? I tried looking for some Forge Gradle documentation, but without luck. PS: I found some examples of generating API and dev (not obfuscated) jars, but not a one with obfuscated stuff.
  4. Update: in older version 1060 it's working fine - full log at eclipse\logs\fml-client-latest.log . In version 1121 (recommended build) it seems to be broken (fixing transformer crash hasn't change a thing). "Solving" the issue by outputting all to info level feels very dirty, but I don't have a slightest idea how to fix it :'(.
  5. I can't find location of full logs (it used to be in mcp\jars\ForgeModLoader-client-0.log ). I saw some references to fml-client/server-latest.log on this forum, I found only eclipse\logs\latest.log and it's just a copy of console output (no more detailed levels). What needs to be setup to get those full logs or where are they hidden (search for *.log was fruitless)? Or another possibility, FML isn't logging from start so crash on transformer results in no detailed logs?
  6. The penalty is not always high as shown for example here. Also if reflection is used not that often (e.g. few calls after an entity spawn or after world is created) it really doesn't matter what technique is used (but ATs are more difficult to setup and can change a lot in future versions, just as changed now with gradle).
  7. I'm curious where in JavaDocs is this described, because my local Forge sources look like this (load event, #1060): /* * Forge Mod Loader * Copyright (c) 2012-2013 cpw. * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Lesser Public License v2.1 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html * * Contributors: * cpw - implementation */ package cpw.mods.fml.common.event; import cpw.mods.fml.common.LoaderState.ModState; public class FMLInitializationEvent extends FMLStateEvent { public FMLInitializationEvent(Object... data) { super(data); } @Override public ModState getModState() { return ModState.INITIALIZED; } } No hint whatsoever what exactly should be going on there (nothing in LoaderState as well). PS: PreInit is considerably longer, but there are no comments about this too.
  8. This mod can be combined with some on-crash-restart script/app (e.g. MineStart). But yes, if you're looking for auto-restart then this mod isn't doing that exactly - it's supposed to be part of an "on demand" service. This mod handles auto-shuttingdown, but if you want players to be able to start server, you have to add another part - in OP is a link to the blog post which describes already working solution (the "starting" part there is a simple web page in php).
  9. Any news about this problem? Current "solution" - double compilation (with tossing away errors) is not optimal.
  10. It should be simple - make a new ItemStack with head item. Modify NBT of this ItemStack . Add a recipe in which this ItemStack will be an output.
  11. I'm totally ignoring your crafting system and writing it from a perspective of vanilla crafting (if you are doing it same/similar way all of this should apply). To make a recipe you implement IRecipe and register it - e.g. GameRegistry.addRecipe(new MyRecipe(params)) . In this custom recipe you can specify what is a result of crafting depending on a current crafting matrix (input items = ItemStacks). Then you simply copy generic crafting result and add/modify needed NBT tags. example I haven't tried it, but if you override public Icon getIconIndex(ItemStack par1ItemStack) you should be able to get icons depending on NBT. I'm not sure what this mean. If you want initialize the item, you can do it from recipe. If you want custom damage or other attribute you can change/set it in recipe when creating item as well.
  12. I think even using the other FML loader you still need to add zips/jars to the classpath. I'm curious why the urlclassloader isn't working (the snippet in the answer expects jar/zip file, not a directory - that can be otained e.g. new File("dirPath").listFiles() ). Do you have good path? Do you have properly organized insides of the jar/zip?
  13. Do you set internal name - e.g. via setUnlocalizedName ? It should be unique for every item (and by that internal name it also maps translations - the names shown in-game).
  14. That is strange, I'm using virtually same code (isn't the getMinecraft() redundant?) and it spawns particles normally.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.