mirror of
https://github.com/GTNewHorizons/ForgeMultipart.git
synced 2026-11-26 23:13:07 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a01a5bd21 | ||
|
|
83feeeec8e | ||
|
|
901dfcb5a0 | ||
|
|
794c3ca030 | ||
|
|
ee37e779fd | ||
|
|
5039fb8984 | ||
|
|
cb276d92f5 | ||
|
|
d336cfbb67 | ||
|
|
ce032ee9a8 | ||
|
|
819d28b993 | ||
|
|
f2dc70a3c9 | ||
|
|
75958e3892 | ||
|
|
2f6bd45e4f |
No files matched your search
+557
-214
File diff suppressed because it is too large.
Load diff
+2
-2
@@ -1,6 +1,6 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
compile("com.github.GTNewHorizons:CodeChickenLib:1.1.5.7:dev")
|
||||
compile("com.github.GTNewHorizons:NotEnoughItems:2.3.45-GTNH:dev")
|
||||
api("com.github.GTNewHorizons:CodeChickenLib:1.2.0:dev")
|
||||
devOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.5.3-GTNH:dev")
|
||||
}
|
||||
+2
-2
@@ -38,7 +38,7 @@ apiPackage =
|
||||
|
||||
# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
|
||||
# Example value: mymodid_at.cfg
|
||||
accessTransformersFile =
|
||||
accessTransformersFile = multipart_at.cfg
|
||||
|
||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||
usesMixins = false
|
||||
@@ -56,4 +56,4 @@ containsMixinsAndOrCoreModOnly = false
|
||||
|
||||
# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your
|
||||
# responsibility check the licence and request permission for distribution, if required.
|
||||
usesShadowedDependencies = false
|
||||
usesShadowedDependencies = false
|
||||
Vendored
BIN
Binary file not shown.
+2
-1
@@ -1,6 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -83,10 +83,8 @@ done
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -133,10 +131,13 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
@@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
@@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
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,
|
||||
# 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" \
|
||||
|
||||
@@ -1,11 +1,4 @@
|
||||
// Add any additional repositiroes for your dependencies here
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = "GTNH"
|
||||
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
||||
}
|
||||
maven {
|
||||
url = "https://jitpack.io"
|
||||
}
|
||||
}
|
||||
+4
-5
@@ -4,10 +4,9 @@ pluginManagement {
|
||||
maven {
|
||||
// RetroFuturaGradle
|
||||
name "GTNH Maven"
|
||||
url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
||||
allowInsecureProtocol = true
|
||||
url "https://nexus.gtnewhorizons.com/repository/public/"
|
||||
mavenContent {
|
||||
includeGroup("com.gtnewhorizons.retrofuturagradle")
|
||||
includeGroupByRegex("com\\.gtnewhorizons\\..+")
|
||||
}
|
||||
}
|
||||
gradlePluginPortal()
|
||||
@@ -17,8 +16,8 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.diffplug.blowdryerSetup' version '1.6.0'
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' // Provides java toolchains
|
||||
id 'com.diffplug.blowdryerSetup' version '1.7.1'
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' // Provides java toolchains
|
||||
}
|
||||
|
||||
blowdryerSetup {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
public net.minecraft.block.BlockButton func_150043_b(I)V #function that sets up hitboxes for that meta
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"repo": "https://github.com/GTNewHorizons/CodeChickenLib/releases/download/1.1.5.5/",
|
||||
"file": "CodeChickenLib-1.7.10-1.1.5.5.jar",
|
||||
"dev": "https://github.com/GTNewHorizons/CodeChickenLib/releases/download/1.1.5.5/CodeChickenLib-1.7.10-1.1.5.5-dev.jar",
|
||||
"class": "codechicken.lib.asm.ASMHelper",
|
||||
"coreLib": true
|
||||
}
|
||||
@@ -1,35 +1,53 @@
|
||||
package codechicken.core.launch;
|
||||
|
||||
import java.awt.*;
|
||||
import static java.awt.Component.LEFT_ALIGNMENT;
|
||||
|
||||
import java.awt.Desktop;
|
||||
import java.awt.Dialog.ModalityType;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.io.*;
|
||||
import java.io.Closeable;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.InterruptedIOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JEditorPane;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.WindowConstants;
|
||||
import javax.swing.event.HyperlinkEvent;
|
||||
import javax.swing.event.HyperlinkListener;
|
||||
|
||||
import net.minecraft.launchwrapper.LaunchClassLoader;
|
||||
|
||||
import sun.misc.URLClassPath;
|
||||
import sun.net.util.URLUtil;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
@@ -39,6 +57,8 @@ import cpw.mods.fml.relauncher.FMLInjectionData;
|
||||
import cpw.mods.fml.relauncher.FMLLaunchHandler;
|
||||
import cpw.mods.fml.relauncher.IFMLCallHook;
|
||||
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
|
||||
import sun.misc.URLClassPath;
|
||||
import sun.net.util.URLUtil;
|
||||
|
||||
/**
|
||||
* For autodownloading stuff. This is really unoriginal, mostly ripped off FML, credits to cpw.
|
||||
|
||||
@@ -24,7 +24,7 @@ object MaterialRenderHelper {
|
||||
|
||||
def start(pos: Vector3, pass: Int, uvt: UVTransformation) = {
|
||||
this.pass = pass
|
||||
builder = CCRenderState.pipeline.builder()
|
||||
builder = CCRenderState.instance().pipeline.builder()
|
||||
builder.add(pos.translation()).add(uvt)
|
||||
this
|
||||
}
|
||||
@@ -36,7 +36,7 @@ object MaterialRenderHelper {
|
||||
|
||||
def lighting() = {
|
||||
if (pass != -1)
|
||||
builder.add(CCRenderState.lightMatrix)
|
||||
builder.add(CCRenderState.instance().lightMatrix)
|
||||
this
|
||||
}
|
||||
|
||||
@@ -85,9 +85,10 @@ class BlockMicroMaterial(val block: Block, val meta: Int = 0)
|
||||
if (pass == -1)
|
||||
block.getBlockColor << 8 | 0xff
|
||||
else {
|
||||
val pos = CCRenderState.lightMatrix.pos
|
||||
val state = CCRenderState.instance
|
||||
val pos = state.lightMatrix.pos
|
||||
block.colorMultiplier(
|
||||
CCRenderState.lightMatrix.access,
|
||||
state.lightMatrix.access,
|
||||
pos.x,
|
||||
pos.y,
|
||||
pos.z
|
||||
|
||||
@@ -2,7 +2,7 @@ package codechicken.microblock
|
||||
|
||||
import codechicken.lib.vec.{Cuboid6, Vector3}
|
||||
import net.minecraft.block.Block
|
||||
import codechicken.lib.render.{ColourMultiplier, CCRenderState}
|
||||
import codechicken.lib.render.CCRenderState
|
||||
import net.minecraft.block.BlockGrass
|
||||
import net.minecraft.init.Blocks
|
||||
import codechicken.lib.render.uv.{UVTranslation, IconTransformation}
|
||||
@@ -17,7 +17,7 @@ class GrassMicroMaterial extends BlockMicroMaterial(Blocks.grass, 0) {
|
||||
}
|
||||
|
||||
override def renderMicroFace(pos: Vector3, pass: Int, bounds: Cuboid6) {
|
||||
val face = CCRenderState.model.asInstanceOf[BlockFace]
|
||||
val face = CCRenderState.instance().model.asInstanceOf[BlockFace]
|
||||
if (pass != -1)
|
||||
face.computeLightCoords()
|
||||
|
||||
@@ -42,7 +42,7 @@ class GrassMicroMaterial extends BlockMicroMaterial(Blocks.grass, 0) {
|
||||
class TopMicroMaterial($block: Block, $meta: Int = 0)
|
||||
extends BlockMicroMaterial($block, $meta) {
|
||||
override def renderMicroFace(pos: Vector3, pass: Int, bounds: Cuboid6) {
|
||||
val face = CCRenderState.model.asInstanceOf[BlockFace]
|
||||
val face = CCRenderState.instance().model.asInstanceOf[BlockFace]
|
||||
if (face.side <= 1)
|
||||
MaterialRenderHelper
|
||||
.start(pos, pass, icont)
|
||||
|
||||
@@ -14,7 +14,6 @@ import Vector3._
|
||||
import codechicken.lib.raytracer.IndexedCuboid6
|
||||
import org.lwjgl.opengl.GL11
|
||||
import codechicken.lib.render.uv.IconTransformation
|
||||
import codechicken.lib.lighting.LightMatrix
|
||||
|
||||
object HollowPlacement extends PlacementProperties {
|
||||
object HollowPlacementGrid extends FaceEdgeGrid(3 / 8d)
|
||||
@@ -74,8 +73,9 @@ trait HollowMicroblockClient
|
||||
}
|
||||
|
||||
override def drawBreaking(renderBlocks: RenderBlocks) {
|
||||
CCRenderState.reset()
|
||||
CCRenderState.setPipeline(
|
||||
val state = CCRenderState.instance
|
||||
state.reset()
|
||||
state.setPipeline(
|
||||
new Translation(x, y, z),
|
||||
new IconTransformation(renderBlocks.overrideBlockTexture)
|
||||
)
|
||||
|
||||
@@ -170,17 +170,17 @@ object ItemMicroPartRenderer extends IItemRenderer {
|
||||
GL11.glScaled(0.5, 0.5, 0.5)
|
||||
if (t == ItemRenderType.INVENTORY || t == ItemRenderType.ENTITY)
|
||||
GL11.glTranslatef(-0.5f, -0.5f, -0.5f)
|
||||
|
||||
TextureUtils.bindAtlas(0)
|
||||
CCRenderState.reset()
|
||||
CCRenderState.useNormals = true
|
||||
CCRenderState.pullLightmap()
|
||||
CCRenderState.startDrawing()
|
||||
val state = CCRenderState.instance
|
||||
state.reset()
|
||||
state.useNormals = true
|
||||
state.pullLightmap()
|
||||
state.startDrawing()
|
||||
val part =
|
||||
mcrClass.create(true, getMaterialID(item)).asInstanceOf[MicroblockClient]
|
||||
part.setShape(size, mcrClass.itemSlot)
|
||||
part.render(new Vector3(0.5, 0.5, 0.5).subtract(part.getBounds.center), -1)
|
||||
CCRenderState.draw()
|
||||
state.draw()
|
||||
GL11.glPopMatrix()
|
||||
}
|
||||
|
||||
|
||||
@@ -112,17 +112,17 @@ object ItemSawRenderer extends IItemRenderer {
|
||||
)
|
||||
case _ => return
|
||||
}
|
||||
|
||||
CCRenderState.reset()
|
||||
CCRenderState.useNormals = true
|
||||
CCRenderState.pullLightmap()
|
||||
val state = CCRenderState.instance
|
||||
state.reset()
|
||||
state.useNormals = true
|
||||
state.pullLightmap()
|
||||
CCRenderState.changeTexture("microblock:textures/items/saw.png")
|
||||
CCRenderState.startDrawing()
|
||||
state.startDrawing()
|
||||
handle.render(t)
|
||||
holder.render(t)
|
||||
CCRenderState.draw()
|
||||
state.draw()
|
||||
GL11.glDisable(GL11.GL_CULL_FACE)
|
||||
CCRenderState.startDrawing()
|
||||
state.startDrawing()
|
||||
blade.render(
|
||||
t,
|
||||
new UVTranslation(
|
||||
@@ -130,7 +130,7 @@ object ItemSawRenderer extends IItemRenderer {
|
||||
(item.getItem.asInstanceOf[Saw].getCuttingStrength(item) - 1) * 4 / 64d
|
||||
)
|
||||
)
|
||||
CCRenderState.draw()
|
||||
state.draw()
|
||||
GL11.glEnable(GL11.GL_CULL_FACE)
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,7 @@ object MicroblockRender {
|
||||
return
|
||||
val pos = placement.pos
|
||||
val part = placement.part.asInstanceOf[MicroblockClient]
|
||||
val state = CCRenderState.instance
|
||||
|
||||
glPushMatrix()
|
||||
glTranslated(pos.x + 0.5, pos.y + 0.5, pos.z + 0.5)
|
||||
@@ -40,14 +41,14 @@ object MicroblockRender {
|
||||
glEnable(GL_BLEND)
|
||||
glDepthMask(false)
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
|
||||
|
||||
// TODO: update to use a thread local copy
|
||||
TextureUtils.bindAtlas(0)
|
||||
CCRenderState.reset()
|
||||
CCRenderState.alphaOverride = 80
|
||||
CCRenderState.useNormals = true
|
||||
CCRenderState.startDrawing()
|
||||
state.reset()
|
||||
state.alphaOverride = 80
|
||||
state.useNormals = true
|
||||
state.startDrawing()
|
||||
part.render(Vector3.zero, -1)
|
||||
CCRenderState.draw()
|
||||
state.draw()
|
||||
|
||||
glDisable(GL_BLEND)
|
||||
glDepthMask(true)
|
||||
@@ -62,7 +63,7 @@ object MicroblockRender {
|
||||
c: Cuboid6,
|
||||
faces: Int
|
||||
) {
|
||||
CCRenderState.setModel(face)
|
||||
CCRenderState.instance().setModel(face)
|
||||
for (s <- 0 until 6 if (faces & 1 << s) == 0) {
|
||||
face.loadCuboidFace(c, s)
|
||||
mat.renderMicroFace(pos, pass, c)
|
||||
|
||||
@@ -276,9 +276,6 @@ object RedstoneInteractions {
|
||||
if (fullVanillaBlocks(block))
|
||||
return 0x1f
|
||||
|
||||
if (side == 0) // vanilla doesn't handle side 0
|
||||
return if (power) 0x1f else 0
|
||||
|
||||
/** so that these can be conducted to from face parts on the other side of
|
||||
* the block. Due to vanilla's in adequecy with redstone/logic on walls
|
||||
*/
|
||||
|
||||
@@ -36,9 +36,10 @@ object MultipartRenderer
|
||||
if (tmpart.partList.isEmpty)
|
||||
return
|
||||
|
||||
CCRenderState.reset()
|
||||
CCRenderState.pullLightmap()
|
||||
CCRenderState.useNormals = true
|
||||
val state = CCRenderState.instance
|
||||
state.reset()
|
||||
state.pullLightmap()
|
||||
state.useNormals = true
|
||||
|
||||
val pos = new Vector3(x, y, z)
|
||||
tmpart.renderDynamic(pos, f, pass)
|
||||
@@ -81,8 +82,9 @@ object MultipartRenderer
|
||||
return false
|
||||
}
|
||||
|
||||
CCRenderState.reset()
|
||||
CCRenderState.lightMatrix.locate(world, x, y, z)
|
||||
val state = CCRenderState.instance
|
||||
state.reset()
|
||||
state.lightMatrix.locate(world, x, y, z)
|
||||
return tmpart.renderStatic(new Vector3(x, y, z), pass)
|
||||
}
|
||||
|
||||
|
||||
@@ -31,8 +31,9 @@ trait TCuboidPart extends TMultiPart {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def drawBreaking(renderBlocks: RenderBlocks) {
|
||||
CCRenderState.reset()
|
||||
CCRenderState.setPipeline(
|
||||
val state = CCRenderState.instance
|
||||
state.reset()
|
||||
state.setPipeline(
|
||||
new Translation(x, y, z),
|
||||
new IconTransformation(renderBlocks.overrideBlockTexture)
|
||||
)
|
||||
|
||||
@@ -20,8 +20,31 @@ public class ButtonPart extends McSidedMetaPart implements IFaceRedstonePart {
|
||||
|
||||
public static BlockButton stoneButton = (BlockButton) Blocks.stone_button;
|
||||
public static BlockButton woodenButton = (BlockButton) Blocks.wooden_button;
|
||||
public static int[] metaSideMap = new int[] { -1, 4, 5, 2, 3 };
|
||||
public static int[] metaSideMap = new int[] { -1, 4, 5, 2, 3, -1, -1, -1 };
|
||||
public static int[] sideMetaMap = new int[] { -1, -1, 3, 4, 1, 2 };
|
||||
public static Cuboid6[] cuboidRegions = setupCuboids();
|
||||
|
||||
/**
|
||||
* Capture the boxes of all 16 button states, copying all button hitboxes directly We do this so any button mixins
|
||||
* will use the proper mixed hitbox size. So mods like Et Futurum Requiem which add floor/ceiling buttons need no
|
||||
* extra setup to have proper block bounds.
|
||||
*/
|
||||
private static Cuboid6[] setupCuboids() {
|
||||
Cuboid6[] regions = new Cuboid6[16];
|
||||
for (int i = 0; i < regions.length; i++) {
|
||||
woodenButton.setBlockBoundsForItemRender(); // Reset bounds
|
||||
woodenButton.func_150043_b(i); // Set button bounds based on meta; this is how buttons change their hitbox
|
||||
regions[i] = new Cuboid6(
|
||||
woodenButton.getBlockBoundsMinX(),
|
||||
woodenButton.getBlockBoundsMinY(),
|
||||
woodenButton.getBlockBoundsMinZ(),
|
||||
woodenButton.getBlockBoundsMaxX(),
|
||||
woodenButton.getBlockBoundsMaxY(),
|
||||
woodenButton.getBlockBoundsMaxZ()); // Use the button hitbox to generate a Cuboid6 region. This
|
||||
// isn't the actual instance, we'll copy from this later.
|
||||
}
|
||||
return regions;
|
||||
}
|
||||
|
||||
public static BlockButton getButton(int meta) {
|
||||
return (meta & 0x10) > 0 ? woodenButton : stoneButton;
|
||||
@@ -58,19 +81,12 @@ public class ButtonPart extends McSidedMetaPart implements IFaceRedstonePart {
|
||||
|
||||
@Override
|
||||
public Cuboid6 getBounds() {
|
||||
int m = meta & 7;
|
||||
double d = pressed() ? 0.0625 : 0.125;
|
||||
|
||||
if (m == 1) return new Cuboid6(0.0, 0.375, 0.5 - 0.1875, d, 0.625, 0.5 + 0.1875);
|
||||
if (m == 2) return new Cuboid6(1.0 - d, 0.375, 0.5 - 0.1875, 1.0, 0.625, 0.5 + 0.1875);
|
||||
if (m == 3) return new Cuboid6(0.5 - 0.1875, 0.375, 0.0, 0.5 + 0.1875, 0.625, d);
|
||||
if (m == 4) return new Cuboid6(0.5 - 0.1875, 0.375, 1.0 - d, 0.5 + 0.1875, 0.625, 1.0);
|
||||
|
||||
return null; // falloff
|
||||
// Somehow I got a crash here for meta 20? Let's wrap it to be safe
|
||||
return cuboidRegions[meta & 15].copy();// these objects get transformed I think, so we need to make a copy.
|
||||
}
|
||||
|
||||
public static McBlockPart placement(World world, BlockCoord pos, int side, int type) {
|
||||
if (side == 0 || side == 1) return null;
|
||||
if (sideMetaMap[side ^ 1] == -1) return null;
|
||||
|
||||
pos = pos.copy().offset(side ^ 1);
|
||||
if (!world.isSideSolid(pos.x, pos.y, pos.z, ForgeDirection.getOrientation(side))) return null;
|
||||
|
||||
@@ -24,8 +24,11 @@ public abstract class McSidedMetaPart extends McMetaPart implements TFacePart {
|
||||
}
|
||||
|
||||
public boolean canStay() {
|
||||
BlockCoord pos = new BlockCoord(tile()).offset(sideForMeta(meta));
|
||||
return world().isSideSolid(pos.x, pos.y, pos.z, ForgeDirection.getOrientation(sideForMeta(meta) ^ 1));
|
||||
int side = sideForMeta(meta);
|
||||
if (side < 0 || side > 5) return false;
|
||||
|
||||
BlockCoord pos = new BlockCoord(tile()).offset(side);
|
||||
return world().isSideSolid(pos.x, pos.y, pos.z, ForgeDirection.getOrientation(side ^ 1));
|
||||
}
|
||||
|
||||
public boolean dropIfCantStay() {
|
||||
|
||||
Reference in new issue
Block a user