Compare commits

...
5 Commits
54 changed files with 420 additions and 841 deletions

No files matched your search

+2 -3
View File
@@ -59,8 +59,8 @@ ext {
}
MAPPING_CHANNEL = 'snapshot'
MAPPING_VERSION = '20190719-1.14.3'
MC_VERSION = '1.15'
MCP_VERSION = '20191212.203412'
MC_VERSION = '1.15.1'
MCP_VERSION = '20191217.105819'
}
project(':mcp') {
@@ -417,7 +417,6 @@ project(':forge') {
installer 'org.jline:jline:3.12.+'
installer 'org.apache.maven:maven-artifact:3.6.0'
installer 'net.jodah:typetools:0.6.1'
installer 'java3d:vecmath:1.5.2'
installer 'org.apache.logging.log4j:log4j-api:2.11.2'
installer 'org.apache.logging.log4j:log4j-core:2.11.2'
installer 'net.minecrell:terminalconsoleappender:1.2.+'
+3 -3
View File
@@ -6,7 +6,7 @@
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader="javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
loaderVersion="[28,)" #mandatory (28 is current forge version)
loaderVersion="[30,)" #mandatory (28 is current forge version)
# A URL to refer people to when problems occur with this mod
issueTrackerURL="http://my.issue.tracker/" #optional
# A list of mods - how many allowed here is determined by the individual mod loader
@@ -42,7 +42,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn
# Does this dependency have to exist - if not, ordering below must be specified
mandatory=true #mandatory
# The version range of the dependency
versionRange="[28,)" #mandatory
versionRange="[30,)" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT or SERVER
@@ -51,6 +51,6 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn
[[dependencies.examplemod]]
modId="minecraft"
mandatory=true
versionRange="[1.14.4]"
versionRange="[1.15.1]"
ordering="NONE"
side="BOTH"
+2 -2
View File
@@ -1,7 +1,7 @@
{
"pack": {
"description": "examplemod resources",
"pack_format": 4,
"_comment": "A pack_format of 4 requires json lang files. Note: we require v4 pack meta for all mods."
"pack_format": 5,
"_comment": "A pack_format of 5 requires json lang files and some texture changes from 1.15. Note: we require v5 pack meta for all mods."
}
}
@@ -86,7 +86,7 @@
}
+ private void func_228797_a_(IVertexBuilder p_228797_1_, double p_228797_2_, double p_228797_4_, double p_228797_6_, float p_228797_8_, float p_228797_9_, float p_228797_10_, float alpha, float p_228797_11_, float p_228797_12_, int p_228797_13_) {
+ p_228797_1_.func_225582_a_(p_228797_2_, p_228797_4_, p_228797_6_).func_227885_a_(p_228797_8_, p_228797_9_, p_228797_10_, alpha).func_225583_a_(p_228797_11_, p_228797_12_).func_227886_a_(p_228797_13_).func_225584_a_(0.0F, 1.0F, 0.0F).func_181675_d();
+ p_228797_1_.func_225582_a_(p_228797_2_, p_228797_4_, p_228797_6_).func_227885_a_(p_228797_8_, p_228797_9_, p_228797_10_, alpha).func_225583_a_(p_228797_11_, p_228797_12_).func_227886_a_(p_228797_13_).func_225584_a_(0.0F, 1.0F, 0.0F).func_181675_d();
+ }
+
private int func_228795_a_(ILightReader p_228795_1_, BlockPos p_228795_2_) {
@@ -0,0 +1,14 @@
--- a/net/minecraft/client/renderer/Matrix3f.java
+++ b/net/minecraft/client/renderer/Matrix3f.java
@@ -406,4 +406,11 @@
public Matrix3f func_226121_d_() {
return new Matrix3f(this);
}
+
+ // Forge start
+ public void multiplyBackward(Matrix3f other) {
+ Matrix3f copy = other.func_226121_d_();
+ copy.func_226118_b_(this);
+ this.func_226114_a_(copy);
+ }
}
@@ -1,12 +1,30 @@
--- a/net/minecraft/client/renderer/Matrix4f.java
+++ b/net/minecraft/client/renderer/Matrix4f.java
@@ -373,4 +373,88 @@
@@ -373,4 +373,78 @@
matrix4f.field_226586_l_ = p_226599_2_;
return matrix4f;
}
+
+ // Forge start
+ public Matrix4f(float[] values) { set(values); }
+ public Matrix4f(float[] values) {
+ field_226575_a_ = values[0];
+ field_226576_b_ = values[1];
+ field_226577_c_ = values[2];
+ field_226578_d_ = values[3];
+ field_226579_e_ = values[4];
+ field_226580_f_ = values[5];
+ field_226581_g_ = values[6];
+ field_226582_h_ = values[7];
+ field_226583_i_ = values[8];
+ field_226584_j_ = values[9];
+ field_226585_k_ = values[10];
+ field_226586_l_ = values[11];
+ field_226587_m_ = values[12];
+ field_226588_n_ = values[13];
+ field_226589_o_ = values[14];
+ field_226590_p_ = values[15];
+ }
+
+ public void set(Matrix4f mat) {
+ this.field_226575_a_ = mat.field_226575_a_;
+ this.field_226576_b_ = mat.field_226576_b_;
@@ -45,47 +63,19 @@
+ field_226590_p_ += other.field_226590_p_;
+ }
+
+ public void set(float[] others) {
+ field_226575_a_ = others[0];
+ field_226576_b_ = others[1];
+ field_226577_c_ = others[2];
+ field_226578_d_ = others[3];
+ field_226579_e_ = others[4];
+ field_226580_f_ = others[5];
+ field_226581_g_ = others[6];
+ field_226582_h_ = others[7];
+ field_226583_i_ = others[8];
+ field_226584_j_ = others[9];
+ field_226585_k_ = others[10];
+ field_226586_l_ = others[11];
+ field_226587_m_ = others[12];
+ field_226588_n_ = others[13];
+ field_226589_o_ = others[14];
+ field_226590_p_ = others[15];
+ }
+
+ public void write(float[] dest) {
+ dest[0] = field_226575_a_;
+ dest[1] = field_226576_b_;
+ dest[2] = field_226577_c_;
+ dest[3] = field_226578_d_;
+ dest[4] = field_226579_e_;
+ dest[5] = field_226580_f_;
+ dest[6] = field_226581_g_;
+ dest[7] = field_226582_h_;
+ dest[8] = field_226583_i_;
+ dest[9] = field_226584_j_;
+ dest[10] = field_226585_k_;
+ dest[11] = field_226586_l_;
+ dest[12] = field_226587_m_;
+ dest[13] = field_226588_n_;
+ dest[14] = field_226589_o_;
+ dest[15] = field_226590_p_;
+ }
+
+ public void multiplyBackward(Matrix4f other) {
+ Matrix4f copy = other.func_226601_d_();
+ copy.func_226595_a_(this);
+ this.set(copy);
+ }
+
+ public void setTranslation(float x, float y, float z) {
+ this.field_226575_a_ = 1.0F;
+ this.field_226580_f_ = 1.0F;
+ this.field_226585_k_ = 1.0F;
+ this.field_226590_p_ = 1.0F;
+ this.field_226578_d_ = x;
+ this.field_226582_h_ = y;
+ this.field_226586_l_ = z;
+ }
}
@@ -1,15 +0,0 @@
--- a/net/minecraft/client/renderer/Quaternion.java
+++ b/net/minecraft/client/renderer/Quaternion.java
@@ -176,4 +176,12 @@
public Quaternion func_227068_g_() {
return new Quaternion(this);
}
+
+ // Forge start
+ public Quaternion(float[] values) {
+ this.field_227061_b_ = values[0];
+ this.field_227062_c_ = values[1];
+ this.field_227063_d_ = values[2];
+ this.field_227064_e_ = values[3];
+ }
}
@@ -9,7 +9,7 @@
private final Matrix4f field_227976_a_;
private boolean field_227977_b_;
@Nullable
@@ -133,4 +133,33 @@
@@ -133,4 +133,32 @@
public int hashCode() {
return Objects.hash(this.field_227976_a_);
}
@@ -29,17 +29,16 @@
+ return field_227981_f_.func_227068_g_();
+ }
+
+ private javax.vecmath.Matrix3f normalTransform = null;
+ public javax.vecmath.Matrix3f getNormalMatrix() {
+ private Matrix3f normalTransform = null;
+ public Matrix3f getNormalMatrix() {
+ checkNormalTransform();
+ return normalTransform;
+ }
+ private void checkNormalTransform() {
+ if (normalTransform == null) {
+ normalTransform = new javax.vecmath.Matrix3f();
+ net.minecraftforge.common.model.TransformationHelper.toVecmath(field_227976_a_).getRotationScale(normalTransform);
+ normalTransform.invert();
+ normalTransform.transpose();
+ normalTransform = new Matrix3f(field_227976_a_);
+ normalTransform.func_226123_f_();
+ normalTransform.func_226110_a_();
+ }
+ }
}
@@ -1,12 +1,15 @@
--- a/net/minecraft/client/renderer/Vector3f.java
+++ b/net/minecraft/client/renderer/Vector3f.java
@@ -198,4 +198,14 @@
@@ -198,4 +198,17 @@
public String toString() {
return "[" + this.field_229184_g_ + ", " + this.field_229185_h_ + ", " + this.field_229186_i_ + "]";
}
+
+ // Forge start
+ public Vector3f(float[] values) {
+ set(values);
+ }
+ public void set(float[] values) {
+ this.field_229184_g_ = values[0];
+ this.field_229185_h_ = values[1];
+ this.field_229186_i_ = values[2];
@@ -1,24 +1,19 @@
--- a/net/minecraft/client/renderer/Vector4f.java
+++ b/net/minecraft/client/renderer/Vector4f.java
@@ -129,4 +129,21 @@
@@ -129,4 +129,16 @@
public String toString() {
return "[" + this.field_229368_a_ + ", " + this.field_229369_b_ + ", " + this.field_229370_c_ + ", " + this.field_229371_d_ + "]";
}
+
+ // Forge start
+ public Vector4f(float[] values) {
+ set(values);
+ }
+ public void set(float[] values) {
+ this.field_229368_a_ = values[0];
+ this.field_229369_b_ = values[1];
+ this.field_229370_c_ = values[2];
+ this.field_229371_d_ = values[3];
+ }
+ public void write(float[] values) {
+ values[0] = this.field_229368_a_;
+ values[1] = this.field_229369_b_;
+ values[2] = this.field_229370_c_;
+ values[3] = this.field_229371_d_;
+ }
+ public void setX(float x) { this.field_229368_a_ = x; }
+ public void setY(float y) { this.field_229369_b_ = y; }
+ public void setZ(float z) { this.field_229370_c_ = z; }
+ public void setW(float z) { this.field_229371_d_ = z; }
}
@@ -9,7 +9,7 @@
if (this.func_70631_g_()) {
this.func_213756_es();
return super.func_184645_a(p_184645_1_, p_184645_2_);
@@ -604,7 +604,8 @@
@@ -607,7 +607,8 @@
}
protected ITextComponent func_225513_by_() {
@@ -190,7 +190,7 @@
}
}
@@ -648,6 +671,7 @@
@@ -652,6 +675,7 @@
}
}
@@ -198,7 +198,7 @@
return list;
}
@@ -768,7 +792,7 @@
@@ -772,7 +796,7 @@
}
}
} else {
@@ -207,7 +207,7 @@
}
multimap.values().forEach((p_226631_0_) -> {
@@ -911,6 +935,35 @@
@@ -915,6 +939,35 @@
return this.func_77973_b().func_219971_r();
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/server/ChunkManager.java
+++ b/net/minecraft/world/server/ChunkManager.java
@@ -364,6 +364,7 @@
@@ -368,6 +368,7 @@
iprofiler.func_219895_b("chunk_unload");
if (!this.field_219255_i.func_217402_u()) {
this.func_223155_b(p_219204_1_);
@@ -8,7 +8,7 @@
}
iprofiler.func_76319_b();
@@ -400,6 +401,7 @@
@@ -404,6 +405,7 @@
if (this.field_219253_g.remove(p_219212_1_, p_219212_3_) && p_219185_5_ != null) {
if (p_219185_5_ instanceof Chunk) {
((Chunk)p_219185_5_).func_177417_c(false);
@@ -16,7 +16,7 @@
}
this.func_219229_a(p_219185_5_);
@@ -477,6 +479,7 @@
@@ -481,6 +483,7 @@
if (flag) {
IChunk ichunk = ChunkSerializer.func_222656_a(this.field_219255_i, this.field_219269_w, this.field_219260_n, p_223172_1_, compoundnbt);
ichunk.func_177432_b(this.field_219255_i.func_82737_E());
@@ -24,7 +24,7 @@
return Either.left(ichunk);
}
@@ -586,6 +589,7 @@
@@ -590,6 +593,7 @@
if (list != null) {
list.forEach(chunk::func_76622_b);
}
@@ -32,7 +32,7 @@
}
return chunk;
@@ -670,6 +674,7 @@
@@ -674,6 +678,7 @@
}
CompoundNBT compoundnbt1 = ChunkSerializer.func_222645_a(this.field_219255_i, p_219229_1_);
@@ -40,7 +40,7 @@
this.func_219100_a(chunkpos, compoundnbt1);
return true;
} catch (Exception exception) {
@@ -806,6 +811,7 @@
@@ -810,6 +815,7 @@
for(int l = i - this.field_219247_A; l <= i + this.field_219247_A; ++l) {
for(int k = j - this.field_219247_A; k <= j + this.field_219247_A; ++k) {
ChunkPos chunkpos = new ChunkPos(l, k);
@@ -40,26 +40,22 @@ import static org.lwjgl.opengl.GL20.glVertexAttribPointer;
import java.io.File;
import java.lang.reflect.Field;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Random;
import java.util.Set;
import java.util.stream.Stream;
import javax.annotation.Nonnull;
import javax.vecmath.Matrix3f;
import javax.vecmath.Matrix4f;
import javax.vecmath.Vector3f;
import javax.vecmath.Vector4f;
import net.minecraft.client.renderer.*;
import net.minecraftforge.client.model.pipeline.LightUtil;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.async.ThreadNameCachingStrategy;
import org.apache.logging.log4j.core.impl.ReusableLogEventFactory;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL13;
import com.google.common.collect.ImmutableList;
@@ -78,13 +74,7 @@ import net.minecraft.client.gui.ClientBossInfo;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.screen.MainMenuScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.client.renderer.FogRenderer.FogType;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.color.BlockColors;
import net.minecraft.client.renderer.color.ItemColors;
import net.minecraft.client.renderer.entity.model.BipedModel;
@@ -95,7 +85,6 @@ import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.model.ItemTransformVec3f;
import net.minecraft.client.renderer.model.Material;
import net.minecraft.client.renderer.model.ModelManager;
import net.minecraft.client.renderer.model.ModelRotation;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.texture.NativeImage;
import net.minecraft.client.renderer.texture.OverlayTexture;
@@ -108,6 +97,7 @@ import net.minecraft.client.resources.I18n;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.IFluidState;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.ItemStack;
@@ -400,38 +390,11 @@ public class ForgeHooksClient
modelLoader.onPostBakeEvent(modelRegistry);
}
@SuppressWarnings("deprecation")
public static Matrix4f getMatrix(ItemTransformVec3f transform)
{
Matrix4f m = new Matrix4f(), t = new Matrix4f();
m.setIdentity();
m.setTranslation(TransformationHelper.toVecmath(transform.translation));
t.setIdentity();
t.rotY(transform.rotation.getY());
m.mul(t);
t.setIdentity();
t.rotX(transform.rotation.getX());
m.mul(t);
t.setIdentity();
t.rotZ(transform.rotation.getZ());
m.mul(t);
t.setIdentity();
t.m00 = transform.scale.getX();
t.m11 = transform.scale.getY();
t.m22 = transform.scale.getZ();
m.mul(t);
return m;
}
private static final net.minecraft.client.renderer.Matrix4f flipX;
private static final net.minecraft.client.renderer.Matrix3f flipXNormal;
static {
flipX = new net.minecraft.client.renderer.Matrix4f(new float[]{
-1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
});
flipX = Matrix4f.func_226593_a_(-1,1,1);
flipXNormal = new net.minecraft.client.renderer.Matrix3f(flipX);
}
public static IBakedModel handleCameraTransforms(MatrixStack matrixStack, IBakedModel model, ItemCameraTransforms.TransformType cameraTransformType, boolean leftHandHackery)
@@ -442,34 +405,22 @@ public class ForgeHooksClient
// If the stack is not empty, the code has added a matrix for us to use.
if (!stack.func_227867_d_())
{
// TODO normal matrix?
// Apply the transformation to the real matrix stack, flipping for left hand
net.minecraft.client.renderer.Matrix4f tMat = stack.func_227866_c_().func_227870_a_();
net.minecraft.client.renderer.Matrix3f nMat = stack.func_227866_c_().func_227872_b_();
if (leftHandHackery)
{
tMat.multiplyBackward(flipX);
tMat.func_226595_a_(flipX);
nMat.multiplyBackward(flipXNormal);
nMat.func_226118_b_(flipXNormal);
}
matrixStack.func_227866_c_().func_227870_a_().func_226595_a_(tMat);
matrixStack.func_227866_c_().func_227872_b_().func_226118_b_(nMat);
}
return model;
}
private static final FloatBuffer matrixBuf = BufferUtils.createFloatBuffer(16);
@Deprecated
public static void multiplyCurrentGlMatrix(Matrix4f matrix)
{
matrixBuf.clear();
float[] t = new float[4];
for(int i = 0; i < 4; i++)
{
matrix.getColumn(i, t);
matrixBuf.put(t);
}
matrixBuf.flip();
glMultMatrixf(matrixBuf);
}
// moved and expanded from WorldVertexBufferUploader.draw
public static void preDraw(Usage attrType, VertexFormat format, int element, int stride, ByteBuffer buffer)
@@ -542,26 +493,6 @@ public class ForgeHooksClient
}
}
public static void transform(net.minecraft.client.renderer.Vector3f vec, Matrix4f m)
{
Vector4f tmp = new Vector4f(vec.getX(), vec.getY(), vec.getZ(), 1f);
m.transform(tmp);
if(Math.abs(tmp.w - 1f) > 1e-5) tmp.scale(1f / tmp.w);
vec.set(tmp.x, tmp.y, tmp.z);
}
public static Matrix4f getMatrix(ModelRotation modelRotation)
{
Matrix4f ret = TransformationHelper.toVecmath(modelRotation.func_225615_b_().func_227988_c_()), tmp = new Matrix4f();
tmp.setIdentity();
tmp.m03 = tmp.m13 = tmp.m23 = .5f;
ret.mul(tmp, ret);
tmp.invert();
//tmp.m03 = tmp.m13 = tmp.m23 = -.5f;
ret.mul(tmp);
return ret;
}
public static int getColorIndex(VertexFormat fmt)
{
ImmutableList<VertexFormatElement> elements = fmt.func_227894_c_();
@@ -596,22 +527,35 @@ public class ForgeHooksClient
}
}*/
@SuppressWarnings("deprecation")
public static TextureAtlasSprite[] getFluidSprites(ILightReader world, BlockPos pos, IFluidState fluidStateIn)
{
return new TextureAtlasSprite[] {
fluidStateIn.getFluid().getAttributes().getStillMaterial(world, pos).func_229314_c_(),
fluidStateIn.getFluid().getAttributes().getFlowingMaterial(world, pos).func_229314_c_(),
Minecraft.getInstance().func_228015_a_(AtlasTexture.LOCATION_BLOCKS_TEXTURE).apply(fluidStateIn.getFluid().getAttributes().getStillTexture(world, pos)),
Minecraft.getInstance().func_228015_a_(AtlasTexture.LOCATION_BLOCKS_TEXTURE).apply(fluidStateIn.getFluid().getAttributes().getFlowingTexture(world, pos)),
};
}
public static void gatherFluidTextures(Set<Material> textures)
{
ForgeRegistries.FLUIDS.getValues().stream()
.flatMap(f -> f.getAttributes().getTextures())
.filter(Objects::nonNull)
.flatMap(ForgeHooksClient::getFluidMaterials)
.forEach(textures::add);
}
public static Stream<Material> getFluidMaterials(Fluid fluid)
{
return fluid.getAttributes().getTextures()
.filter(Objects::nonNull)
.map(ForgeHooksClient::getBlockMaterial);
}
@SuppressWarnings("deprecation")
public static Material getBlockMaterial(ResourceLocation loc)
{
return new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, loc);
}
private static class LightGatheringTransformer extends QuadGatheringTransformer {
private static final VertexFormat FORMAT = new VertexFormat(ImmutableList.of(DefaultVertexFormats.TEX_2F, DefaultVertexFormats.TEX_2S));
@@ -781,17 +725,17 @@ public class ForgeHooksClient
public static void fillNormal(int[] faceData, Direction facing)
{
Vector3f v1 = getVertexPos(faceData, 3);
Vector3f t = getVertexPos(faceData, 1);
Vector3f t1 = getVertexPos(faceData, 1);
Vector3f v2 = getVertexPos(faceData, 2);
v1.sub(t);
t.set(getVertexPos(faceData, 0));
v2.sub(t);
v1.cross(v2, v1);
v1.normalize();
Vector3f t2 = getVertexPos(faceData, 0);
v1.sub(t1);
v2.sub(t2);
v2.cross(v1);
v2.func_229194_d_();
int x = ((byte) Math.round(v1.x * 127)) & 0xFF;
int y = ((byte) Math.round(v1.y * 127)) & 0xFF;
int z = ((byte) Math.round(v1.z * 127)) & 0xFF;
int x = ((byte) Math.round(v2.getX() * 127)) & 0xFF;
int y = ((byte) Math.round(v2.getY() * 127)) & 0xFF;
int z = ((byte) Math.round(v2.getZ() * 127)) & 0xFF;
int normal = x | (y << 0x08) | (z << 0x10);
@@ -846,24 +790,19 @@ public class ForgeHooksClient
public static BlockFaceUV applyUVLock(BlockFaceUV blockFaceUV, Direction originalSide, TransformationMatrix rotation, ResourceLocation p_228824_9_)
{
TransformationMatrix global = new TransformationMatrix(rotation.func_227988_c_());
Matrix4f uv = TransformationHelper.toVecmath(TransformationHelper.getUVLockTransform(global, originalSide).func_227988_c_());
Vector4f vec = new Vector4f(0, 0, 0, 1);
Matrix4f uv = TransformationHelper.getUVLockTransform(global, originalSide).func_227988_c_();
float u0 = blockFaceUV.getVertexU(blockFaceUV.getVertexRotatedRev(0));
float v0 = blockFaceUV.getVertexV(blockFaceUV.getVertexRotatedRev(0));
vec.x = u0 / 16;
vec.y = v0 / 16;
uv.transform(vec);
float uMin = 16 * vec.x; // / vec.w;
float vMin = 16 * vec.y; // / vec.w;
Vector4f vec = new Vector4f(u0 / 16, v0 / 16, 0, 1);
vec.func_229372_a_(uv);
float uMin = 16 * vec.getX(); // / vec.w;
float vMin = 16 * vec.getY(); // / vec.w;
float u1 = blockFaceUV.getVertexU(blockFaceUV.getVertexRotatedRev(2));
float v1 = blockFaceUV.getVertexV(blockFaceUV.getVertexRotatedRev(2));
vec.x = u1 / 16;
vec.y = v1 / 16;
vec.z = 0;
vec.w = 1;
uv.transform(vec);
float uMax = 16 * vec.x; // / vec.w;
float vMax = 16 * vec.y; // / vec.w;
vec.set(u1 / 16,v1 / 16,0,1);
vec.func_229372_a_(uv);
float uMax = 16 * vec.getX(); // / vec.w;
float vMax = 16 * vec.getY(); // / vec.w;
if (uMin > uMax && u0 < u1 || uMin < uMax && u0 > u1)
{
float t = uMin;
@@ -878,10 +817,9 @@ public class ForgeHooksClient
}
float a = (float)Math.toRadians(blockFaceUV.rotation);
Vector3f rv = new Vector3f(MathHelper.cos(a), MathHelper.sin(a), 0);
Matrix3f rot = new Matrix3f();
uv.getRotationScale(rot);
rot.transform(rv);
int angle = MathHelper.normalizeAngle(-(int)Math.round(Math.toDegrees(Math.atan2(rv.y, rv.x)) / 90) * 90, 360);
Matrix3f rot = new Matrix3f(uv);
rv.func_229188_a_(rot);
int angle = MathHelper.normalizeAngle(-(int)Math.round(Math.toDegrees(Math.atan2(rv.getY(), rv.getX())) / 90) * 90, 360);
return new BlockFaceUV(new float[]{ uMin, vMin, uMax, vMax }, angle);
}
@@ -24,7 +24,6 @@ import java.util.Random;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.vecmath.Matrix4f;
import com.mojang.blaze3d.matrix.MatrixStack;
@@ -37,7 +36,6 @@ import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ILightReader;
import net.minecraftforge.client.model.data.IModelData;
import org.apache.commons.lang3.tuple.Pair;
public interface IForgeBakedModel
{
@@ -20,12 +20,8 @@
package net.minecraftforge.client.extensions;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.Vector4f;
import net.minecraft.client.renderer.*;
import net.minecraft.util.Direction;
import net.minecraftforge.common.model.TransformationHelper;
/*
* Replacement interface for ModelRotation to allow custom transformations of vanilla models.
@@ -66,27 +62,20 @@ public interface IForgeTransformationMatrix
default TransformationMatrix inverse()
{
if (isIdentity()) return getTransformaion();
javax.vecmath.Matrix4f m = TransformationHelper.toVecmath(getTransformaion().func_227988_c_());
m.invert();
return new TransformationMatrix(TransformationHelper.toMojang(m));
Matrix4f m = getTransformaion().func_227988_c_().func_226601_d_();
m.func_226600_c_();
return new TransformationMatrix(m);
}
default void transformPosition(Vector4f position)
{
TransformationHelper.transform(getTransformaion().func_227988_c_(), position);
position.func_229372_a_(getTransformaion().func_227988_c_());
}
default void transformNormal(Vector3f normal)
{
javax.vecmath.Vector3f copy = TransformationHelper.toVecmath(normal);
transformNormal(copy);
normal.set(copy.x, copy.y, copy.z);
}
default void transformNormal(javax.vecmath.Vector3f normal)
{
getTransformaion().getNormalMatrix().transform(normal);
normal.normalize();
normal.func_229188_a_(getTransformaion().getNormalMatrix());
normal.func_229194_d_();
}
default Direction rotateTransform(Direction facing)
@@ -94,4 +83,38 @@ public interface IForgeTransformationMatrix
return Direction.func_229385_a_(getTransformaion().func_227988_c_(), facing);
}
/**
* convert transformation from assuming center-block system to corner-block system
*/
default TransformationMatrix blockCenterToCorner()
{
TransformationMatrix transform = getTransformaion();
if (transform.isIdentity()) return TransformationMatrix.func_227983_a_();
Matrix4f ret = transform.func_227988_c_();
Matrix4f tmp = Matrix4f.func_226599_b_(.5f, .5f, .5f);
ret.multiplyBackward(tmp);
tmp.func_226591_a_();
tmp.setTranslation(-.5f, -.5f, -.5f);
ret.func_226595_a_(tmp);
return new TransformationMatrix(ret);
}
/**
* convert transformation from assuming corner-block system to center-block system
*/
default TransformationMatrix blockCornerToCenter()
{
TransformationMatrix transform = getTransformaion();
if (transform.isIdentity()) return TransformationMatrix.func_227983_a_();
Matrix4f ret = transform.func_227988_c_();
Matrix4f tmp = Matrix4f.func_226599_b_(-.5f, -.5f, -.5f);
ret.multiplyBackward(tmp);
tmp.func_226591_a_();
tmp.setTranslation(.5f, .5f, .5f);
ret.func_226595_a_(tmp);
return new TransformationMatrix(ret);
}
}
@@ -20,7 +20,6 @@
package net.minecraftforge.client.model;
import javax.annotation.Nullable;
import javax.vecmath.Matrix4f;
import java.util.List;
import java.util.Random;
@@ -36,7 +35,6 @@ import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.model.ItemOverrideList;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.Direction;
import org.apache.commons.lang3.tuple.Pair;
public class BakedItemModel implements IBakedModel
{
@@ -21,7 +21,6 @@ package net.minecraftforge.client.model;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.vecmath.Matrix4f;
import java.util.List;
import java.util.Random;
@@ -35,9 +34,7 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ILightReader;
import net.minecraft.world.IWorldReader;
import net.minecraftforge.client.model.data.IModelData;
import org.apache.commons.lang3.tuple.Pair;
public abstract class BakedModelWrapper<T extends IBakedModel> implements IBakedModel
{
@@ -54,7 +54,8 @@ final class FancyMissingModel implements IUnbakedModel
{
private static final ResourceLocation font = new ResourceLocation("minecraft", "textures/font/ascii.png");
private static final Material font2 = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation("minecraft", "font/ascii"));
private static final TransformationMatrix smallTransformation = TransformationHelper.blockCenterToCorner(new TransformationMatrix(null, null, new Vector3f(.25f, .25f, .25f), null));
private static final TransformationMatrix smallTransformation = new TransformationMatrix(null, null, new Vector3f(.25f, .25f, .25f), null)
.blockCenterToCorner();
private static final LoadingCache<VertexFormat, SimpleModelFontRenderer> fontCache = CacheBuilder.newBuilder().maximumSize(3).build(new CacheLoader<VertexFormat, SimpleModelFontRenderer>()
{
@Override
@@ -46,6 +46,7 @@ import net.minecraft.resources.IResourceManager;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.model.geometry.IModelGeometry;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.resource.IResourceType;
@@ -71,9 +72,6 @@ public final class ModelDynBucket implements IModelGeometry<ModelDynBucket>
private static final float NORTH_Z_FLUID = 7.498f / 16f;
private static final float SOUTH_Z_FLUID = 8.502f / 16f;
@Deprecated
public static final ModelDynBucket MODEL = new ModelDynBucket();
@Nonnull
private final Fluid fluid;
@@ -81,12 +79,6 @@ public final class ModelDynBucket implements IModelGeometry<ModelDynBucket>
private final boolean tint;
private final boolean coverIsMask;
@Deprecated
public ModelDynBucket()
{
this(Fluids.EMPTY, false, true, false);
}
public ModelDynBucket(Fluid fluid, boolean flipGas, boolean tint, boolean coverIsMask)
{
this.fluid = fluid;
@@ -96,24 +88,12 @@ public final class ModelDynBucket implements IModelGeometry<ModelDynBucket>
}
/**
* Sets the fluid in the model.
* "fluid" - Name of the fluid in the fluid registry.
* "flipGas" - If "true" the model will be flipped upside down if the fluid is lighter than air. If "false" it won't.
* "applyTint" - If "true" the model will tint the fluid quads according to the fluid's base color.
* <p/>
* If the fluid can't be found, water is used.
* Returns a new ModelDynBucket representing the given fluid, but with the same
* other properties (flipGas, tint, coverIsMask).
*/
@Deprecated
public ModelDynBucket withFluid(String newFluid)
public ModelDynBucket withFluid(Fluid newFluid)
{
ResourceLocation fluidName = new ResourceLocation(newFluid);
Fluid fluid = ForgeRegistries.FLUIDS.getValue(fluidName);
if (fluid == null)
fluid = this.fluid;
// create new model with correct liquid
return new ModelDynBucket(fluid, flipGas, tint, coverIsMask);
return new ModelDynBucket(newFluid, flipGas, tint, coverIsMask);
}
@Nullable
@@ -179,17 +159,16 @@ public final class ModelDynBucket implements IModelGeometry<ModelDynBucket>
TextureAtlasSprite particleSprite = particleLocation != null ? spriteGetter.apply(particleLocation) : null;
// if the fluid is lighter than air, will manipulate the initial state to be rotated 180° to turn it upside down
// if the fluid is lighter than air, will manipulate the initial state to be rotated 180deg to turn it upside down
if (flipGas && fluid != Fluids.EMPTY && fluid.getAttributes().isLighterThanAir())
{
sprite = new ModelTransformComposition(state, new SimpleModelTransform(TransformationHelper.blockCenterToCorner(new TransformationMatrix(null, new Quaternion(0, 0, 1, 0), null, null))));
sprite = new ModelTransformComposition(state, new SimpleModelTransform(new TransformationMatrix(null, new Quaternion(0, 0, 1, 0), null, null).blockCenterToCorner()));
state = sprite;
}
TransformationMatrix transform = state.func_225615_b_();
Material fluidLocation = fluid != Fluids.EMPTY ? fluid.getAttributes().getStillMaterial() : null;
TextureAtlasSprite fluidSprite = fluidLocation != null ? spriteGetter.apply(fluidLocation) : null;
TextureAtlasSprite fluidSprite = fluid != Fluids.EMPTY ? spriteGetter.apply(ForgeHooksClient.getBlockMaterial(fluid.getAttributes().getStillTexture())) : null;
if (particleSprite == null) particleSprite = fluidSprite;
@@ -438,7 +417,7 @@ public final class ModelDynBucket implements IModelGeometry<ModelDynBucket>
if (!model.cache.containsKey(name))
{
ModelDynBucket parent = model.parent.withFluid(name);
ModelDynBucket parent = model.parent.withFluid(fluid);
IBakedModel bakedModel = parent.bake(model.owner, bakery, ModelLoader.defaultTextureGetter(), new SimpleModelTransform(model.transforms), model.getOverrides(), new ResourceLocation("forge:bucket_override"));
model.cache.put(name, bakedModel);
return bakedModel;
@@ -20,6 +20,7 @@
package net.minecraftforge.client.model;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.Collection;
import java.util.EnumMap;
import java.util.List;
@@ -43,6 +44,7 @@ import net.minecraft.fluid.Fluids;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.model.data.IModelData;
import net.minecraftforge.client.model.geometry.IModelGeometry;
import net.minecraftforge.client.model.pipeline.IVertexConsumer;
@@ -74,10 +76,7 @@ public final class ModelFluid implements IModelGeometry<ModelFluid>
@Override
public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<com.mojang.datafixers.util.Pair<String, String>> missingTextureErrors)
{
FluidAttributes attrs = fluid.getAttributes();
return attrs.getOverlayMaterial() != null
? ImmutableSet.of(attrs.getStillMaterial(), attrs.getFlowingMaterial(), attrs.getOverlayMaterial())
: ImmutableSet.of(attrs.getStillMaterial(), attrs.getFlowingMaterial());
return ForgeHooksClient.getFluidMaterials(fluid).collect(Collectors.toList());
}
@Override
@@ -89,9 +88,9 @@ public final class ModelFluid implements IModelGeometry<ModelFluid>
PerspectiveMapWrapper.getTransforms(sprite),
modelLocation,
attrs.getColor(),
spriteGetter.apply(attrs.getStillMaterial()),
spriteGetter.apply(attrs.getFlowingMaterial()),
Optional.ofNullable(attrs.getOverlayMaterial()).map(spriteGetter),
spriteGetter.apply(ForgeHooksClient.getBlockMaterial(attrs.getStillTexture())),
spriteGetter.apply(ForgeHooksClient.getBlockMaterial(attrs.getFlowingTexture())),
Optional.ofNullable(attrs.getOverlayTexture()).map(ForgeHooksClient::getBlockMaterial).map(spriteGetter),
attrs.isLighterThanAir(),
null
);
@@ -157,7 +157,7 @@ public class ModelLoaderRegistry
try
{
TransformationMatrix base = context.deserialize(transformData, TransformationMatrix.class);
return Optional.of(new SimpleModelTransform(ImmutableMap.of(), TransformationHelper.blockCenterToCorner(base)));
return Optional.of(new SimpleModelTransform(ImmutableMap.of(), base.blockCenterToCorner()));
}
catch (JsonParseException e)
{
@@ -196,7 +196,7 @@ public class ModelLoaderRegistry
if(!transform.entrySet().isEmpty())
{
base = context.deserialize(transform, TransformationMatrix.class);
base = TransformationHelper.blockCenterToCorner(base);
base = base.blockCenterToCorner();
}
IModelTransform state = new SimpleModelTransform(Maps.immutableEnumMap(transforms), base);
return Optional.of(state);
@@ -208,7 +208,7 @@ public class ModelLoaderRegistry
if(transform.has(name))
{
TransformationMatrix t = context.deserialize(transform.remove(name), TransformationMatrix.class);
transforms.put(itemCameraTransform, TransformationHelper.blockCenterToCorner(t));
transforms.put(itemCameraTransform, t.blockCenterToCorner());
}
}
@@ -24,7 +24,6 @@ import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
import javax.vecmath.Matrix4f;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.TransformationMatrix;
@@ -35,7 +34,6 @@ import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.MinecraftForgeClient;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -77,7 +77,7 @@ public class PerspectiveMapWrapper implements IBakedModel
{
if (transforms.hasCustomTransform(type))
{
map.put(type, TransformationHelper.blockCenterToCorner(TransformationHelper.toTransformation(transforms.getTransform(type))));
map.put(type, TransformationHelper.toTransformation(transforms.getTransform(type)).blockCenterToCorner());
}
}
return ImmutableMap.copyOf(map);
@@ -96,7 +96,7 @@ public class PerspectiveMapWrapper implements IBakedModel
}
else if (transforms.hasCustomTransform(type))
{
map.put(type, TransformationHelper.blockCenterToCorner(TransformationHelper.toTransformation(transforms.getTransform(type))));
map.put(type, TransformationHelper.toTransformation(transforms.getTransform(type)).blockCenterToCorner());
}
}
return ImmutableMap.copyOf(map);
@@ -109,7 +109,7 @@ public class PerspectiveMapWrapper implements IBakedModel
{
// Push to the matrix to make it not empty and indicate that we want to transform things
mat.func_227860_a_();
mat.func_227866_c_().func_227870_a_().func_226595_a_(TransformationHelper.blockCornerToCenter(tr).func_227988_c_());
mat.func_227866_c_().func_227870_a_().func_226595_a_(tr.blockCornerToCenter().func_227988_c_());
}
return model;
}
@@ -121,7 +121,7 @@ public class PerspectiveMapWrapper implements IBakedModel
{
// Push to the matrix to make it not empty and indicate that we want to transform things
mat.func_227860_a_();
mat.func_227866_c_().func_227870_a_().func_226595_a_(TransformationHelper.blockCornerToCenter(tr).func_227988_c_());
mat.func_227866_c_().func_227870_a_().func_226595_a_(tr.blockCornerToCenter().func_227988_c_());
}
return model;
}
@@ -21,12 +21,12 @@ package net.minecraftforge.client.model;
import com.google.common.collect.Lists;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.Vector4f;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.renderer.vertex.VertexFormatElement;
import javax.vecmath.Vector3f;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -32,12 +32,8 @@ import java.util.Optional;
import java.util.TreeMap;
import javax.annotation.Nullable;
import javax.vecmath.AxisAngle4f;
import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.Quaternion;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.*;
import net.minecraft.client.renderer.model.IModelTransform;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -334,7 +330,8 @@ public class ModelBlockAnimation
Vector3f translation = new Vector3f(0, 0, 0);
Vector3f scale = new Vector3f(1, 1, 1);
Vector3f origin = new Vector3f(0, 0, 0);
AxisAngle4f rotation = new AxisAngle4f(0, 0, 0, 0);
Vector3f rotation_axis = new Vector3f(0, 0, 0);
float rotation_angle = 0;
for(MBVariableClip var : variables)
{
int length = loop ? var.samples.length : (var.samples.length - 1);
@@ -375,16 +372,16 @@ public class ModelBlockAnimation
translation.setZ(value);
break;
case XROT:
rotation.x = value;
rotation_axis.setX(value);
break;
case YROT:
rotation.y = value;
rotation_axis.setY(value);
break;
case ZROT:
rotation.z = value;
rotation_axis.setZ(value);
break;
case ANGLE:
rotation.angle = (float)Math.toRadians(value);
rotation_angle = (float)Math.toRadians(value);
break;
case SCALE:
scale.set(value, value, value);
@@ -409,12 +406,12 @@ public class ModelBlockAnimation
break;
}
}
Quaternion rot = new Quaternion(new Vector3f(rotation.x, rotation.y, rotation.z), rotation.angle, false);
Quaternion rot = new Quaternion(rotation_axis, rotation_angle, false);
TransformationMatrix base = new TransformationMatrix(translation, rot, scale, null);
Vector3f negOrigin = origin.func_229195_e_();
negOrigin.func_229192_b_(-1,-1,-1);
base = new TransformationMatrix(origin, null, null, null).compose(base).compose(new TransformationMatrix(negOrigin, null, null, null));
return TransformationHelper.blockCenterToCorner(base);
return base.blockCenterToCorner();
}
}
}
@@ -68,20 +68,20 @@ public enum B3DClip implements IClip
TransformationMatrix ret = TransformationMatrix.func_227983_a_();
if(node.getAnimation() == null)
{
return ret.compose(B3DLoader.fromVecmath(node.getPos(), node.getRot(), node.getScale(), null));
return ret.compose(new TransformationMatrix(node.getPos(), node.getRot(), node.getScale(), null));
}
int start = Math.max(1, (int)Math.round(Math.floor(time)));
int end = Math.min(start + 1, (int)Math.round(Math.ceil(time)));
float progress = time - (float)Math.floor(time);
Key keyStart = node.getAnimation().getKeys().get(start, node);
Key keyEnd = node.getAnimation().getKeys().get(end, node);
TransformationMatrix startTr = keyStart == null ? null : B3DLoader.fromVecmath(keyStart.getPos(), keyStart.getRot(),keyStart.getScale(), null);
TransformationMatrix endTr = keyEnd == null ? null : B3DLoader.fromVecmath(keyEnd.getPos(), keyEnd.getRot(),keyEnd.getScale(), null);
TransformationMatrix startTr = keyStart == null ? null : new TransformationMatrix(keyStart.getPos(), keyStart.getRot(),keyStart.getScale(), null);
TransformationMatrix endTr = keyEnd == null ? null : new TransformationMatrix(keyEnd.getPos(), keyEnd.getRot(),keyEnd.getScale(), null);
if(keyStart == null)
{
if(keyEnd == null)
{
ret = ret.compose(B3DLoader.fromVecmath(node.getPos(), node.getRot(), node.getScale(), null));
ret = ret.compose(new TransformationMatrix(node.getPos(), node.getRot(), node.getScale(), null));
}
// TODO animated TRSRTransformation for speed?
else
@@ -36,11 +36,11 @@ import java.util.function.Predicate;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
import javax.vecmath.Matrix4f;
import javax.vecmath.Vector3f;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.model.*;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.texture.MissingTextureSprite;
@@ -156,12 +156,6 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
return new ModelWrapper(modelLocation, model, ImmutableSet.of(model.getRoot().getName()), true, true, 1);
}
@Deprecated // TODO: Does a lot of unnecessary work converting things, should use the TransformationMatrix constructor directly with mojang vector classes instead.
public static TransformationMatrix fromVecmath(javax.vecmath.Vector3f pos, javax.vecmath.Quat4f rot, javax.vecmath.Vector3f scale, javax.vecmath.Quat4f rot2)
{
return new TransformationMatrix(TransformationHelper.toMojang(pos), TransformationHelper.toMojang(rot), TransformationHelper.toMojang(scale), TransformationHelper.toMojang(rot2));
}
public static final class B3DState implements IModelTransform
{
@Nullable
@@ -310,10 +304,10 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
TransformationMatrix pm = cache.getUnchecked(Triple.of(animation, node.getParent(), frame));
ret = ret.compose(pm);
// joint offset in the parent coords
ret = ret.compose(fromVecmath(parent.getPos(), parent.getRot(), parent.getScale(), null));
ret = ret.compose(new TransformationMatrix(parent.getPos(), parent.getRot(), parent.getScale(), null));
}
// current node local pose
ret = ret.compose(fromVecmath(key.getPos(), key.getRot(), key.getScale(), null));
ret = ret.compose(new TransformationMatrix(key.getPos(), key.getRot(), key.getScale(), null));
// this part moved inside the model
// inverse bind of the current node
/*Matrix4f rm = new TRSRTransformation(node.getPos(), node.getRot(), node.getScale(), null).getMatrix();
@@ -339,9 +333,9 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
TransformationMatrix pm = cache.getUnchecked(Triple.of(animation, node.getParent(), frame));
ret = ret.compose(pm);
// joint offset in the parent coords
ret = ret.compose(fromVecmath(parent.getPos(), parent.getRot(), parent.getScale(), null));
ret = ret.compose(new TransformationMatrix(parent.getPos(), parent.getRot(), parent.getScale(), null));
}
ret = ret.compose(fromVecmath(node.getPos(), node.getRot(), node.getScale(), null));
ret = ret.compose(new TransformationMatrix(node.getPos(), node.getRot(), node.getScale(), null));
// TODO cache
TransformationMatrix invBind = new NodeJoint(node).getInvBindPose();
ret = ret.compose(invBind);
@@ -362,9 +356,9 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
@Override
public TransformationMatrix getInvBindPose()
{
Matrix4f m = TransformationHelper.toVecmath(fromVecmath(node.getPos(), node.getRot(), node.getScale(), null).func_227988_c_());
m.invert();
TransformationMatrix pose = new TransformationMatrix(TransformationHelper.toMojang(m));
Matrix4f m = new TransformationMatrix(node.getPos(), node.getRot(), node.getScale(), null).func_227988_c_();
m.func_226600_c_();
TransformationMatrix pose = new TransformationMatrix(m);
if(node.getParent() != null)
{
@@ -714,14 +708,14 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
@Override
public Matrix4f apply(Node<?> node)
{
return TransformationHelper.toVecmath(global.compose(localCache.getUnchecked(node)).func_227988_c_());
return global.compose(localCache.getUnchecked(node)).func_227988_c_();
}
});
for(Face f : faces)
{
UnpackedBakedQuad.Builder quadBuilder = new UnpackedBakedQuad.Builder(format);
quadBuilder.setContractUVs(true);
quadBuilder.setQuadOrientation(Direction.getFacingFromVector(f.getNormal().x, f.getNormal().y, f.getNormal().z));
quadBuilder.setQuadOrientation(Direction.getFacingFromVector(f.getNormal().getX(), f.getNormal().getY(), f.getNormal().getZ()));
List<Texture> textures = null;
if(f.getBrush() != null) textures = f.getBrush().getTextures();
TextureAtlasSprite sprite;
@@ -747,12 +741,12 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
switch(vertexFormatElements.get(e).getUsage())
{
case POSITION:
builder.put(e, v.getPos().x, v.getPos().y, v.getPos().z, 1);
builder.put(e, v.getPos().getX(), v.getPos().getY(), v.getPos().getZ(), 1);
break;
case COLOR:
if(v.getColor() != null)
{
builder.put(e, v.getColor().x, v.getColor().y, v.getColor().z, v.getColor().w);
builder.put(e, v.getColor().getX(), v.getColor().getY(), v.getColor().getZ(), v.getColor().getW());
}
else
{
@@ -764,8 +758,8 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
if(vertexFormatElements.get(e).getIndex() < v.getTexCoords().length)
{
builder.put(e,
sprite.getInterpolatedU(v.getTexCoords()[0].x * 16),
sprite.getInterpolatedV(v.getTexCoords()[0].y * 16),
sprite.getInterpolatedU(v.getTexCoords()[0].getX() * 16),
sprite.getInterpolatedV(v.getTexCoords()[0].getY() * 16),
0,
1
);
@@ -778,11 +772,11 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
case NORMAL:
if(v.getNormal() != null)
{
builder.put(e, v.getNormal().x, v.getNormal().y, v.getNormal().z, 0);
builder.put(e, v.getNormal().getX(), v.getNormal().getY(), v.getNormal().getZ(), 0);
}
else
{
builder.put(e, faceNormal.x, faceNormal.y, faceNormal.z, 0);
builder.put(e, faceNormal.getX(), faceNormal.getY(), faceNormal.getZ(), 0);
}
break;
default:
@@ -37,13 +37,9 @@ import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
import javax.vecmath.Matrix4f;
import javax.vecmath.Quat4f;
import javax.vecmath.Vector2f;
import javax.vecmath.Vector3f;
import javax.vecmath.Vector4f;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.*;
import net.minecraft.util.math.Vec2f;
import net.minecraftforge.versions.forge.ForgeVersion;
import net.minecraftforge.common.model.TransformationHelper;
import org.apache.commons.io.IOUtils;
@@ -253,8 +249,8 @@ public class B3DModel
String path = readString();
int flags = buf.getInt();
int blend = buf.getInt();
Vector2f pos = new Vector2f(buf.getFloat(), buf.getFloat());
Vector2f scale = new Vector2f(buf.getFloat(), buf.getFloat());
Vec2f pos = new Vec2f(buf.getFloat(), buf.getFloat());
Vec2f scale = new Vec2f(buf.getFloat(), buf.getFloat());
float rot = buf.getFloat();
ret.add(new Texture(path, flags, blend, pos, scale, rot));
}
@@ -389,7 +385,7 @@ public class B3DModel
Map<Integer, Key> ret = new HashMap<>();
int flags = buf.getInt();
Vector3f pos = null, scale = null;
Quat4f rot = null;
Quaternion rot = null;
while(buf.hasRemaining())
{
int frame = buf.getInt();
@@ -456,7 +452,7 @@ public class B3DModel
String name = readString();
Vector3f pos = new Vector3f(buf.getFloat(), buf.getFloat(), buf.getFloat());
Vector3f scale = new Vector3f(buf.getFloat(), buf.getFloat(), buf.getFloat());
Quat4f rot = readQuat();
Quaternion rot = readQuat();
dump("NODE(" + name + ", " + pos + ", " + scale + ", " + rot + ") {");
while(buf.hasRemaining())
{
@@ -494,13 +490,13 @@ public class B3DModel
return node;
}
private Quat4f readQuat()
private Quaternion readQuat()
{
float w = buf.getFloat();
float x = buf.getFloat();
float y = buf.getFloat();
float z = buf.getFloat();
return new Quat4f(x, y, z, w);
return new Quaternion(x, y, z, w);
}
private void skip()
@@ -533,15 +529,15 @@ public class B3DModel
public static class Texture
{
public static final Texture White = new Texture("builtin/white", 0, 0, new Vector2f(0, 0), new Vector2f(1, 1), 0);
public static final Texture White = new Texture("builtin/white", 0, 0, new Vec2f(0, 0), new Vec2f(1, 1), 0);
private final String path;
private final int flags;
private final int blend;
private final Vector2f pos;
private final Vector2f scale;
private final Vec2f pos;
private final Vec2f scale;
private final float rot;
public Texture(String path, int flags, int blend, Vector2f pos, Vector2f scale, float rot)
public Texture(String path, int flags, int blend, Vec2f pos, Vec2f scale, float rot)
{
this.path = path;
this.flags = flags;
@@ -566,12 +562,12 @@ public class B3DModel
return blend;
}
public Vector2f getPos()
public Vec2f getPos()
{
return pos;
}
public Vector2f getScale()
public Vec2f getScale()
{
return scale;
}
@@ -667,7 +663,7 @@ public class B3DModel
Matrix4f t = new Matrix4f();
if(mesh.getWeightMap().get(this).isEmpty())
{
t.setIdentity();
t.func_226591_a_();
}
else
{
@@ -675,27 +671,28 @@ public class B3DModel
{
totalWeight += bone.getLeft();
Matrix4f bm = animator.apply(bone.getRight());
bm.mul(bone.getLeft());
bm.func_226592_a_(bone.getLeft());
t.add(bm);
}
if(Math.abs(totalWeight) > 1e-4) t.mul(1f / totalWeight);
else t.setIdentity();
if(Math.abs(totalWeight) > 1e-4) t.func_226592_a_(1f / totalWeight);
else t.func_226591_a_();
}
TransformationMatrix trsr = new TransformationMatrix(TransformationHelper.toMojang(t));
TransformationMatrix trsr = new TransformationMatrix(t);
// pos
Vector4f pos = new Vector4f(this.pos);
pos.w = 1;
trsr.transformPosition(TransformationHelper.toMojang(pos));
Vector3f rPos = new Vector3f(pos.x / pos.w, pos.y / pos.w, pos.z / pos.w);
pos.setW(1);
trsr.transformPosition(pos);
pos.func_229374_e_();
Vector3f rPos = new Vector3f(pos.getX(), pos.getY(), pos.getZ());
// normal
Vector3f rNormal = null;
if(this.normal != null)
{
rNormal = new Vector3f(this.normal);
rNormal = this.normal.func_229195_e_();
trsr.transformNormal(rNormal);
}
@@ -787,13 +784,13 @@ public class B3DModel
public static Vector3f getNormal(Vertex v1, Vertex v2, Vertex v3)
{
Vector3f a = new Vector3f(v2.getPos());
Vector3f a = v2.getPos().func_229195_e_();
a.sub(v1.getPos());
Vector3f b = new Vector3f(v3.getPos());
Vector3f b = v3.getPos().func_229195_e_();
b.sub(v1.getPos());
Vector3f c = new Vector3f();
c.cross(a, b);
c.normalize();
Vector3f c = a.func_229195_e_();
c.cross(b);
c.func_229194_d_();
return c;
}
}
@@ -805,9 +802,9 @@ public class B3DModel
@Nullable
private final Vector3f scale;
@Nullable
private final Quat4f rot;
private final Quaternion rot;
public Key(@Nullable Vector3f pos, @Nullable Vector3f scale, @Nullable Quat4f rot)
public Key(@Nullable Vector3f pos, @Nullable Vector3f scale, @Nullable Quaternion rot)
{
this.pos = pos;
this.scale = scale;
@@ -827,7 +824,7 @@ public class B3DModel
}
@Nullable
public Quat4f getRot()
public Quaternion getRot()
{
return rot;
}
@@ -892,7 +889,7 @@ public class B3DModel
private final String name;
private final Vector3f pos;
private final Vector3f scale;
private final Quat4f rot;
private final Quaternion rot;
private final ImmutableMap<String, Node<?>> nodes;
@Nullable
private Animation animation;
@@ -900,12 +897,12 @@ public class B3DModel
@Nullable
private Node<? extends IKind<?>> parent;
public static <K extends IKind<K>> Node<K> create(String name, Vector3f pos, Vector3f scale, Quat4f rot, List<Node<?>> nodes, K kind)
public static <K extends IKind<K>> Node<K> create(String name, Vector3f pos, Vector3f scale, Quaternion rot, List<Node<?>> nodes, K kind)
{
return new Node<>(name, pos, scale, rot, nodes, kind);
}
public Node(String name, Vector3f pos, Vector3f scale, Quat4f rot, List<Node<?>> nodes, K kind)
public Node(String name, Vector3f pos, Vector3f scale, Quaternion rot, List<Node<?>> nodes, K kind)
{
this.name = name;
this.pos = pos;
@@ -974,7 +971,7 @@ public class B3DModel
return scale;
}
public Quat4f getRot()
public Quaternion getRot()
{
return rot;
}
@@ -69,11 +69,6 @@ public abstract class ModelFile {
public static class ExistingModelFile extends ModelFile {
private final ExistingFileHelper existingHelper;
@Deprecated
public ExistingModelFile(String location, ExistingFileHelper existingHelper) {
this(new ResourceLocation(location), existingHelper);
}
public ExistingModelFile(ResourceLocation location, ExistingFileHelper existingHelper) {
super(location);
this.existingHelper = existingHelper;
@@ -21,8 +21,8 @@ package net.minecraftforge.client.model.obj;
import com.google.common.collect.Maps;
import joptsimple.internal.Strings;
import net.minecraft.client.renderer.Vector4f;
import javax.vecmath.Vector4f;
import java.io.IOException;
import java.util.Arrays;
import java.util.Map;
@@ -25,6 +25,8 @@ import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import joptsimple.internal.Strings;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.Vector4f;
import net.minecraft.client.renderer.model.*;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
@@ -33,6 +35,7 @@ import net.minecraft.client.renderer.vertex.VertexFormatElement;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec2f;
import net.minecraftforge.client.model.*;
import net.minecraftforge.client.model.geometry.IModelGeometryPart;
import net.minecraftforge.client.model.geometry.IMultipartModelGeometry;
@@ -42,9 +45,6 @@ import net.minecraftforge.common.model.TransformationHelper;
import org.apache.commons.lang3.tuple.Pair;
import javax.annotation.Nullable;
import javax.vecmath.Vector2f;
import javax.vecmath.Vector3f;
import javax.vecmath.Vector4f;
import java.io.IOException;
import java.util.*;
import java.util.function.Function;
@@ -52,17 +52,17 @@ import java.util.stream.Collectors;
public class OBJModel implements IMultipartModelGeometry<OBJModel>
{
private static Vector2f[] DEFAULT_COORDS = {
new Vector2f(0, 0),
new Vector2f(0, 1),
new Vector2f(1, 1),
new Vector2f(1, 0),
private static Vec2f[] DEFAULT_COORDS = {
new Vec2f(0, 0),
new Vec2f(0, 1),
new Vec2f(1, 1),
new Vec2f(1, 0),
};
private final Map<String, ModelGroup> parts = Maps.newHashMap();
private final List<Vector3f> positions = Lists.newArrayList();
private final List<Vector2f> texCoords = Lists.newArrayList();
private final List<Vec2f> texCoords = Lists.newArrayList();
private final List<Vector3f> normals = Lists.newArrayList();
private final List<Vector4f> colors = Lists.newArrayList();
@@ -307,12 +307,12 @@ public class OBJModel implements IMultipartModelGeometry<OBJModel>
}
}
public static Vector2f parseVector2(String[] line)
public static Vec2f parseVector2(String[] line)
{
switch (line.length) {
case 1: return new Vector2f(0,0);
case 2: return new Vector2f(Float.parseFloat(line[1]), 0);
default: return new Vector2f(Float.parseFloat(line[1]), Float.parseFloat(line[2]));
case 1: return new Vec2f(0,0);
case 2: return new Vec2f(Float.parseFloat(line[1]), 0);
default: return new Vec2f(Float.parseFloat(line[1]), Float.parseFloat(line[2]));
}
}
@@ -401,12 +401,12 @@ public class OBJModel implements IMultipartModelGeometry<OBJModel>
Vector3f a = positions.get(indices[0][0]);
Vector3f ab = positions.get(indices[1][0]);
Vector3f ac = positions.get(indices[2][0]);
Vector3f abs = new Vector3f(ab);
Vector3f abs = ab.func_229195_e_();
abs.sub(a);
Vector3f acs = new Vector3f(ac);
Vector3f acs = ac.func_229195_e_();
acs.sub(a);
abs.cross(abs,acs);
abs.normalize();
abs.cross(acs);
abs.func_229194_d_();
faceNormal = abs;
}
@@ -419,8 +419,8 @@ public class OBJModel implements IMultipartModelGeometry<OBJModel>
builder.setTexture(texture);
builder.setApplyDiffuseLighting(!isFullbright);
int fakeLight = (int)((ambientColor.x + ambientColor.y + ambientColor.z) * 15 / 3.0f);
Vector2f uv2 = new Vector2f(((float) fakeLight * 0x20) / 0xFFFF, ((float) fakeLight * 0x20) / 0xFFFF);
int fakeLight = (int)((ambientColor.getX() + ambientColor.getY() + ambientColor.getZ()) * 15 / 3.0f);
Vec2f uv2 = new Vec2f(((float) fakeLight * 0x20) / 0xFFFF, ((float) fakeLight * 0x20) / 0xFFFF);
boolean hasTransform = !transform.isIdentity();
TransformationMatrix transformation = hasTransform ? transform : null;
@@ -429,15 +429,15 @@ public class OBJModel implements IMultipartModelGeometry<OBJModel>
{
int[] index = indices[Math.min(i,indices.length-1)];
Vector3f pos0 = positions.get(index[0]);
Vector4f position = new Vector4f(pos0.x, pos0.y, pos0.z, 1);
Vector2f texCoord = index.length >= 2 && texCoords.size() > 0 ? texCoords.get(index[1]) : DEFAULT_COORDS[i];
Vector4f position = new Vector4f(pos0.getX(), pos0.getY(), pos0.getZ(), 1);
Vec2f texCoord = index.length >= 2 && texCoords.size() > 0 ? texCoords.get(index[1]) : DEFAULT_COORDS[i];
Vector3f norm0 = !needsNormalRecalculation && index.length >= 3 && normals.size() > 0 ? normals.get(index[2]) : faceNormal;
Vector3f normal = norm0;
Vector4f color = index.length >= 4 && colors.size() > 0 ? colors.get(index[3]) : new Vector4f(1, 1, 1, 1);
if (hasTransform)
{
normal = new Vector3f(norm0);
transformation.transformPosition(TransformationHelper.toMojang(position));
normal = norm0.func_229195_e_();
transformation.transformPosition(position);
transformation.transformNormal(normal);
};
Vector4f tintedColor = new Vector4f(
@@ -450,7 +450,7 @@ public class OBJModel implements IMultipartModelGeometry<OBJModel>
norm[i] = normal;
}
builder.setQuadOrientation(Direction.getFacingFromVector(norm[0].x, norm[0].y,norm[0].z));
builder.setQuadOrientation(Direction.getFacingFromVector(norm[0].getX(), norm[0].getY(),norm[0].getZ()));
Direction cull = null;
if (detectCullableFaces)
@@ -508,7 +508,7 @@ public class OBJModel implements IMultipartModelGeometry<OBJModel>
return Pair.of(builder.build(), cull);
}
private void putVertexData(IVertexConsumer consumer, VertexFormat format, Vector4f position0, Vector2f texCoord0, Vector3f normal0, Vector4f color0, Vector2f uv2, TextureAtlasSprite texture)
private void putVertexData(IVertexConsumer consumer, VertexFormat format, Vector4f position0, Vec2f texCoord0, Vector3f normal0, Vector4f color0, Vec2f uv2, TextureAtlasSprite texture)
{
ImmutableList<VertexFormatElement> elements = format.func_227894_c_();
for(int j=0;j<elements.size();j++)
@@ -527,8 +527,8 @@ public class OBJModel implements IMultipartModelGeometry<OBJModel>
{
case 0:
consumer.put(j,
texture.getInterpolatedU(texCoord0.getX() * 16),
texture.getInterpolatedV((flipV ? (1 - texCoord0.getY()) : texCoord0.getY()) * 16)
texture.getInterpolatedU(texCoord0.x * 16),
texture.getInterpolatedV((flipV ? (1 - texCoord0.y) : texCoord0.y) * 16)
);
break;
case 1:
@@ -675,7 +675,7 @@ public class OBJModel implements IMultipartModelGeometry<OBJModel>
public boolean isFullbright()
{
return mat != null && mat.ambientColor.epsilonEquals(new Vector4f(1,1,1,1), 1/256f);
return mat != null && TransformationHelper.epsilonEquals(mat.ambientColor, new Vector4f(1,1,1,1), 1/256f);
}
}
@@ -254,30 +254,6 @@ public class LightUtil
}
}
private static IVertexConsumer tessellator = null;
@Deprecated // TODO: remove
public static IVertexConsumer getTessellator()
{
if(tessellator == null)
{
Tessellator tes = Tessellator.getInstance();
BufferBuilder wr = tes.getBuffer();
tessellator = new VertexBufferConsumer(wr);
}
return tessellator;
}
private static ItemConsumer itemConsumer = null;
@Deprecated // TODO: remove
public static ItemConsumer getItemConsumer()
{
if(itemConsumer == null)
{
itemConsumer = new ItemConsumer(getTessellator());
}
return itemConsumer;
}
private static final class ItemPipeline
{
final VertexBufferConsumer bufferConsumer;
@@ -20,10 +20,9 @@
package net.minecraftforge.client.model.pipeline;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.Vector4f;
import javax.vecmath.Vector3f;
public class TRSRTransformer extends VertexTransformer
{
private final TransformationMatrix transform;
@@ -40,14 +39,19 @@ public class TRSRTransformer extends VertexTransformer
switch (getVertexFormat().func_227894_c_().get(element).getUsage())
{
case POSITION:
Vector4f pos = new Vector4f(data);
Vector4f pos = new Vector4f(data[0], data[1], data[2], data[3]);
transform.transformPosition(pos);
pos.write(data);
data[0] = pos.getX();
data[1] = pos.getY();
data[2] = pos.getZ();
data[3] = pos.getW();
break;
case NORMAL:
Vector3f normal = new Vector3f(data);
transform.transformNormal(normal);
normal.get(data);
data[0] = normal.getX();
data[1] = normal.getY();
data[2] = normal.getZ();
break;
}
super.put(element, data);
@@ -19,12 +19,11 @@
package net.minecraftforge.client.model.pipeline;
import javax.vecmath.Vector3f;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.color.BlockColors;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
@@ -153,13 +152,13 @@ public class VertexLighterFlat extends QuadGatheringTransformer
v1.sub(t);
t.set(position[0]);
v2.sub(t);
v1.cross(v2, v1);
v1.normalize();
v2.cross(v1);
v2.func_229194_d_();
for(int v = 0; v < 4; v++)
{
normal[v][0] = v1.x;
normal[v][1] = v1.y;
normal[v][2] = v1.z;
normal[v][0] = v2.getX();
normal[v][1] = v2.getY();
normal[v][2] = v2.getZ();
normal[v][3] = 0;
}
}
@@ -846,15 +846,15 @@ public class ForgeHooks
.color(0).density(0).temperature(0).luminosity(0).viscosity(0).build(fluid);
if (fluid instanceof WaterFluid)
return net.minecraftforge.fluids.FluidAttributes.Water.builder(
new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation("block/water_still")),
new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation("block/water_flow")))
.overlay(new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation("block/water_overlay")))
new ResourceLocation("block/water_still"),
new ResourceLocation("block/water_flow"))
.overlay(new ResourceLocation("block/water_overlay"))
.translationKey("block.minecraft.water")
.color(0xFF3F76E4).build(fluid);
if (fluid instanceof LavaFluid)
return net.minecraftforge.fluids.FluidAttributes.builder(
new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation("block/lava_still")),
new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation("block/lava_flow")))
new ResourceLocation("block/lava_still"),
new ResourceLocation("block/lava_flow"))
.translationKey("block.minecraft.lava")
.luminosity(15).density(3000).viscosity(6000).temperature(1300).build(fluid);
throw new RuntimeException("Mod fluids must override createAttributes.");
@@ -77,24 +77,6 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook
public static final String VERSION_CHECK_CAT = "version_checking";
private static final Logger LOGGER = LogManager.getLogger();
private static final Marker FORGEMOD = MarkerManager.getMarker("FORGEMOD");
//TODO: Remove all of these, use ForgeConfig instead
@Deprecated
public static int[] blendRanges = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34 };
@Deprecated
public static boolean disableVersionCheck = false;
@Deprecated
public static boolean forgeLightPipelineEnabled = true;
@Deprecated
public static boolean zoomInMissingModelTextInGui = false;
@Deprecated
public static boolean disableStairSlabCulling = false; // Also known as the "DontCullStairsBecauseIUseACrappyTexturePackThatBreaksBasicBlockShapesSoICantTrustBasicBlockCulling" flag
@Deprecated
public static boolean alwaysSetupTerrainOffThread = false; // In WorldRenderer.setupTerrain, always force the chunk render updates to be queued to the thread
@Deprecated
public static boolean logCascadingWorldGeneration = true; // see Chunk#logCascadingWorldGeneration()
@Deprecated
public static boolean fixVanillaCascading = false; // There are various places in vanilla that cause cascading worldgen. Enabling this WILL change where blocks are placed to prevent this.
// DO NOT contact Forge about worldgen not 'matching' vanilla if this flag is set.
private static ForgeMod INSTANCE;
public static ForgeMod getInstance()
@@ -136,26 +136,6 @@ public interface IForgeBlock
return false;
}
//TODO: remove in 1.15
/**
* Check if the face of a block should block rendering.
*
* Faces which are fully opaque should return true, faces with transparency
* or faces which do not span the full size of the block should return false.
*
* @param state The current block state
* @param world The current world
* @param pos Block position in world
* @param face The side to check
* @return True if the block is opaque on the specified side.
* @deprecated This is no longer used for rendering logic.
*/
@Deprecated
default boolean doesSideBlockRendering(BlockState state, ILightReader world, BlockPos pos, Direction face)
{
return state.isOpaqueCube(world, pos);
}
/**
* Determines if this block should set fire and deal fire damage
* to entities coming into contact with it.
@@ -102,25 +102,6 @@ public interface IForgeBlockState
return getBlockState().getBlock().isLadder(getBlockState(), world, pos, entity);
}
//TODO: remove in 1.15
/**
* Check if the face of a block should block rendering.
*
* Faces which are fully opaque should return true, faces with transparency
* or faces which do not span the full size of the block should return false.
*
* @param world The current world
* @param pos Block position in world
* @param face The side to check
* @return True if the block is opaque on the specified side.
* @deprecated This is no longer used for rendering logic.
*/
@Deprecated
default boolean doesSideBlockRendering(ILightReader world, BlockPos pos, Direction face)
{
return getBlockState().getBlock().doesSideBlockRendering(getBlockState(), world, pos, face);
}
/**
* Called throughout the code as a replacement for block instanceof BlockContainer
* Moving this to the Block base class allows for mods that wish to extend vanilla
@@ -23,22 +23,16 @@ import java.lang.reflect.Type;
import java.util.EnumMap;
import java.util.Map;
import javax.annotation.Nullable;
import com.google.gson.*;
import net.minecraft.client.renderer.*;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.commons.lang3.tuple.Triple;
import net.minecraft.util.math.MathHelper;
import com.google.common.collect.Maps;
import net.minecraft.client.renderer.model.ItemTransformVec3f;
import net.minecraft.client.renderer.model.ModelRotation;
import net.minecraft.util.Direction;
import net.minecraft.util.math.Vec3i;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.ForgeHooksClient;
public final class TransformationHelper
{
@@ -51,132 +45,11 @@ public final class TransformationHelper
return new TransformationMatrix(transform.translation, quatFromXYZ(transform.rotation, true), transform.scale, null);
}
public static void transform(Matrix4f matrix, Vector4f vector)
{
javax.vecmath.Vector4f copy = toVecmath(vector);
toVecmath(matrix).transform(copy);
vector.set(copy.x, copy.y, copy.z, copy.w);
}
public static Quaternion quatFromXYZ(Vector3f xyz, boolean degrees)
{
return new Quaternion(xyz.getX(), xyz.getY(), xyz.getZ(), degrees);
}
public static Direction rotate(Matrix4f matrix, Direction facing)
{
Vec3i dir = facing.getDirectionVec();
javax.vecmath.Vector4f vec = new javax.vecmath.Vector4f(dir.getX(), dir.getY(), dir.getZ(), 0);
toVecmath(matrix).transform(vec);
return Direction.getFacingFromVector(vec.x, vec.y, vec.z);
}
/**
* convert transformation from assuming center-block system to corner-block system
*/
public static TransformationMatrix blockCenterToCorner(TransformationMatrix transform)
{
if (transform.isIdentity()) return TransformationMatrix.func_227983_a_();
javax.vecmath.Matrix4f ret = toVecmath(transform.func_227988_c_()), tmp = new javax.vecmath.Matrix4f();
tmp.setIdentity();
tmp.m03 = tmp.m13 = tmp.m23 = .5f;
ret.mul(tmp, ret);
tmp.m03 = tmp.m13 = tmp.m23 = -.5f;
ret.mul(tmp);
return new TransformationMatrix(toMojang(ret));
}
/**
* convert transformation from assuming corner-block system to center-block system
*/
public static TransformationMatrix blockCornerToCenter(TransformationMatrix transform)
{
if (transform.isIdentity()) return TransformationMatrix.func_227983_a_();
javax.vecmath.Matrix4f ret = toVecmath(transform.func_227988_c_()), tmp = new javax.vecmath.Matrix4f();
tmp.setIdentity();
tmp.m03 = tmp.m13 = tmp.m23 = -.5f;
ret.mul(tmp, ret);
tmp.m03 = tmp.m13 = tmp.m23 = .5f;
ret.mul(tmp);
return new TransformationMatrix(toMojang(ret));
}
@OnlyIn(Dist.CLIENT)
public static javax.vecmath.Vector3f toVecmath(Vector3f vec)
{
return new javax.vecmath.Vector3f(vec.getX(), vec.getY(), vec.getZ());
}
@OnlyIn(Dist.CLIENT)
public static javax.vecmath.Vector4f toVecmath(Vector4f vec)
{
return new javax.vecmath.Vector4f(vec.getX(), vec.getY(), vec.getZ(), vec.getW());
}
@OnlyIn(Dist.CLIENT)
public static javax.vecmath.Matrix4f toVecmath(Matrix4f m)
{
float[] all = new float[16];
m.write(all);
return new javax.vecmath.Matrix4f(all);
}
public static javax.vecmath.Quat4f toVecmath(Quaternion q)
{
return new javax.vecmath.Quat4f(q.getX(), q.getY(), q.getZ(), q.getW());
}
public static Quaternion toMojang(javax.vecmath.Quat4f q)
{
return new Quaternion(q.getX(), q.getY(), q.getZ(), q.getW());
}
@OnlyIn(Dist.CLIENT)
public static Vector3f toMojang(javax.vecmath.Vector3f vec)
{
return new Vector3f(vec.x, vec.y, vec.z);
}
@OnlyIn(Dist.CLIENT)
public static Vector4f toMojang(javax.vecmath.Vector4f vec)
{
return new Vector4f(vec.x, vec.y, vec.z, vec.w);
}
@OnlyIn(Dist.CLIENT)
public static Matrix4f toMojang(javax.vecmath.Matrix4f m)
{
Matrix4f r = new Matrix4f();
float[] row = new float[4];
float[] all = new float[16];
for (int x = 0; x < 4; x++)
{
m.getRow(x, row);
for (int y = 0; y < 4; y++)
{
all[y*4+x] = row[y];
}
}
r.set(all);
return r;
}
public static javax.vecmath.Vector3f lerp(javax.vecmath.Tuple3f from, javax.vecmath.Tuple3f to, float progress)
{
javax.vecmath.Vector3f res = new javax.vecmath.Vector3f(from);
res.interpolate(from, to, progress);
return res;
}
public static javax.vecmath.Vector4f lerp(javax.vecmath.Tuple4f from, javax.vecmath.Tuple4f to, float progress)
{
javax.vecmath.Vector4f res = new javax.vecmath.Vector4f(from);
res.interpolate(from, to, progress);
return res;
}
public static Vector3f lerp(Vector3f from, Vector3f to, float progress)
{
Vector3f res = from.func_229195_e_();
@@ -184,11 +57,49 @@ public final class TransformationHelper
return res;
}
public static Quaternion slerp(Quaternion from, Quaternion to, float progress)
private static final double THRESHOLD = 0.9995;
private static Quaternion slerp(Quaternion v0, Quaternion v1, float t)
{
javax.vecmath.Quat4f res = new javax.vecmath.Quat4f();
res.interpolate(toVecmath(from), toVecmath(to), progress);
return toMojang(res);
// From https://en.wikipedia.org/w/index.php?title=Slerp&oldid=928959428
// License: CC BY-SA 3.0 https://creativecommons.org/licenses/by-sa/3.0/
// Compute the cosine of the angle between the two vectors.
// If the dot product is negative, slerp won't take
// the shorter path. Note that v1 and -v1 are equivalent when
// the negation is applied to all four components. Fix by
// reversing one quaternion.
float dot = v0.getX() * v1.getX() + v0.getY() * v1.getY() + v0.getZ() * v1.getZ() + v0.getW() * v1.getW();
if (dot < 0.0f) {
v1 = new Quaternion(-v1.getX(), -v1.getY(), -v1.getZ(), -v1.getW());
dot = -dot;
}
// If the inputs are too close for comfort, linearly interpolate
// and normalize the result.
if (dot > THRESHOLD) {
float x = MathHelper.lerp(t, v0.getX(), v1.getX());
float y = MathHelper.lerp(t, v0.getY(), v1.getY());
float z = MathHelper.lerp(t, v0.getZ(), v1.getZ());
float w = MathHelper.lerp(t, v0.getW(), v1.getW());
return new Quaternion(x,y,z,w);
}
// Since dot is in range [0, DOT_THRESHOLD], acos is safe
float angle01 = (float)Math.acos(dot);
float angle0t = angle01*t;
float sin0t = MathHelper.sin(angle0t);
float sin01 = MathHelper.sin(angle01);
float sin1t = MathHelper.sin(angle01 - angle0t);
float s1 = sin0t / sin01;
float s0 = sin1t / sin01;
return new Quaternion(
s0 * v0.getX() + s1 * v1.getX(),
s0 * v0.getY() + s1 * v1.getY(),
s0 * v0.getZ() + s1 * v1.getZ(),
s0 * v0.getW() + s1 * v1.getW()
);
}
public static TransformationMatrix slerp(TransformationMatrix one, TransformationMatrix that, float progress)
@@ -207,17 +118,16 @@ public final class TransformationHelper
static
{
vanillaUvTransformLocalToGlobal.put(Direction.SOUTH, TransformationMatrix.func_227983_a_());
javax.vecmath.Quat4f tmp = new javax.vecmath.Quat4f();
tmp.set(new javax.vecmath.AxisAngle4f(0, 1, 0, (float)Math.toRadians(90)));
vanillaUvTransformLocalToGlobal.put(Direction.EAST, new TransformationMatrix(null, toMojang(tmp), null, null));
tmp.set(new javax.vecmath.AxisAngle4f(0, 1, 0, (float)Math.toRadians(-90)));
vanillaUvTransformLocalToGlobal.put(Direction.WEST, new TransformationMatrix(null, toMojang(tmp), null, null));
tmp.set(new javax.vecmath.AxisAngle4f(0, 1, 0, (float)Math.toRadians(180)));
vanillaUvTransformLocalToGlobal.put(Direction.NORTH, new TransformationMatrix(null, toMojang(tmp), null, null));
tmp.set(new javax.vecmath.AxisAngle4f(1, 0, 0, (float)Math.toRadians(-90)));
vanillaUvTransformLocalToGlobal.put(Direction.UP, new TransformationMatrix(null, toMojang(tmp), null, null));
tmp.set(new javax.vecmath.AxisAngle4f(1, 0, 0, (float)Math.toRadians(90)));
vanillaUvTransformLocalToGlobal.put(Direction.DOWN, new TransformationMatrix(null, toMojang(tmp), null, null));
vanillaUvTransformLocalToGlobal.put(Direction.EAST, new TransformationMatrix(null,
new Quaternion(Vector3f.field_229181_d_, 90,true), null, null));
vanillaUvTransformLocalToGlobal.put(Direction.WEST, new TransformationMatrix(null,
new Quaternion(Vector3f.field_229181_d_, -90,true), null, null));
vanillaUvTransformLocalToGlobal.put(Direction.NORTH, new TransformationMatrix(null,
new Quaternion(Vector3f.field_229181_d_, 180,true), null, null));
vanillaUvTransformLocalToGlobal.put(Direction.UP, new TransformationMatrix(null,
new Quaternion(Vector3f.field_229179_b_, -90,true), null, null));
vanillaUvTransformLocalToGlobal.put(Direction.DOWN, new TransformationMatrix(null,
new Quaternion(Vector3f.field_229179_b_, 90,true), null, null));
for(Direction side : Direction.values())
{
@@ -225,27 +135,26 @@ public final class TransformationHelper
}
}
public static TransformationMatrix getVanillaUvTransformLocalToGlobal(Direction side)
{
return vanillaUvTransformLocalToGlobal.get(side);
}
public static TransformationMatrix getVanillaUvTransformGlobalToLocal(Direction side)
{
return vanillaUvTransformGlobalToLocal.get(side);
}
public static TransformationMatrix getUVLockTransform(TransformationMatrix matrix, Direction originalSide)
{
Direction newSide = matrix.rotateTransform(originalSide);
try
{
return blockCenterToCorner(vanillaUvTransformGlobalToLocal.get(originalSide).compose(blockCornerToCenter(matrix.inverse())).compose(vanillaUvTransformLocalToGlobal.get(newSide)));
}
catch(javax.vecmath.SingularMatrixException e)
{
return new TransformationMatrix(null, null, new Vector3f(0, 0, 0), null);
}
return vanillaUvTransformGlobalToLocal.get(originalSide)
.compose(matrix.inverse().blockCornerToCenter())
.compose(vanillaUvTransformLocalToGlobal.get(newSide))
.blockCenterToCorner();
}
public static boolean epsilonEquals(Vector4f v1, Vector4f v2, float epsilon)
{
return MathHelper.abs(v1.getX()-v2.getX()) < epsilon &&
MathHelper.abs(v1.getY()-v2.getY()) < epsilon &&
MathHelper.abs(v1.getZ()-v2.getZ()) < epsilon &&
MathHelper.abs(v1.getW()-v2.getW()) < epsilon;
}
public static Quaternion makeQuaternion(float[] values)
{
return new Quaternion(values[0], values[1], values[2], values[3]);
}
public static class Deserializer implements JsonDeserializer<TransformationMatrix>
@@ -332,7 +241,7 @@ public final class TransformationHelper
if (!e.isJsonArray()) throw new JsonParseException("Matrix: expected an array, got: " + e);
JsonArray m = e.getAsJsonArray();
if (m.size() != 3) throw new JsonParseException("Matrix: expected an array of length 3, got: " + m.size());
javax.vecmath.Matrix4f ret = new javax.vecmath.Matrix4f();
float[] values = new float[16];
for (int i = 0; i < 3; i++)
{
if (!m.get(i).isJsonArray()) throw new JsonParseException("Matrix row: expected an array, got: " + m.get(i));
@@ -342,7 +251,7 @@ public final class TransformationHelper
{
try
{
ret.setElement(i, j, r.get(j).getAsNumber().floatValue());
values[j*4+i] = r.get(j).getAsNumber().floatValue();
}
catch (ClassCastException ex)
{
@@ -350,7 +259,7 @@ public final class TransformationHelper
}
}
}
return toMojang(ret);
return new Matrix4f(values);
}
public static float[] parseFloatArray(JsonElement e, int length, String prefix)
@@ -422,7 +331,7 @@ public final class TransformationHelper
if (array.size() == 3) //Vanilla rotation
return quatFromXYZ(new Vector3f(parseFloatArray(e, 3, "Rotation")), true);
else // quaternion
return new Quaternion(parseFloatArray(e, 4, "Rotation"));
return makeQuaternion(parseFloatArray(e, 4, "Rotation"));
}
else throw new JsonParseException("Rotation: expected array or object, got: " + e);
}
@@ -79,8 +79,8 @@ public class ItemTooltipEvent extends PlayerEvent
*/
@Override
@Nullable
public PlayerEntity getEntityPlayer()
public PlayerEntity getPlayer()
{
return super.getEntityPlayer();
return super.getPlayer();
}
}
@@ -53,17 +53,6 @@ public class PlayerEvent extends LivingEvent
entityPlayer = player;
}
/**
* Use {@link #getPlayer()}
*
* @return Player
*/
@Deprecated
public PlayerEntity getEntityPlayer()
{
return entityPlayer;
}
/**
* @return Player
*/
@@ -38,7 +38,6 @@ import javax.annotation.Nullable;
import static net.minecraftforge.eventbus.api.Event.Result.DEFAULT;
import static net.minecraftforge.eventbus.api.Event.Result.DENY;
import net.minecraftforge.eventbus.api.Event.Result;
import net.minecraftforge.fml.LogicalSide;
/**
@@ -317,7 +316,7 @@ public class PlayerInteractEvent extends PlayerEvent
@Nonnull
public ItemStack getItemStack()
{
return getEntityPlayer().getHeldItem(hand);
return getPlayer().getHeldItem(hand);
}
/**
@@ -347,7 +346,7 @@ public class PlayerInteractEvent extends PlayerEvent
*/
public World getWorld()
{
return getEntityPlayer().getEntityWorld();
return getPlayer().getEntityWorld();
}
/**
@@ -22,7 +22,6 @@ package net.minecraftforge.fluids;
import javax.annotation.Nullable;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.model.Material;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.IFluidState;
import net.minecraft.item.ItemStack;
@@ -63,11 +62,11 @@ public class FluidAttributes
private String translationKey;
private final Material stillTexture;
private final Material flowingTexture;
private final ResourceLocation stillTexture;
private final ResourceLocation flowingTexture;
@Nullable
private final Material overlayTexture;
private final ResourceLocation overlayTexture;
private final SoundEvent fillSound;
private final SoundEvent emptySound;
@@ -275,18 +274,18 @@ public class FluidAttributes
return color;
}
public Material getStillMaterial()
public ResourceLocation getStillTexture()
{
return stillTexture;
}
public Material getFlowingMaterial()
public ResourceLocation getFlowingTexture()
{
return flowingTexture;
}
@Nullable
public Material getOverlayMaterial()
public ResourceLocation getOverlayTexture()
{
return overlayTexture;
}
@@ -309,8 +308,8 @@ public class FluidAttributes
public boolean isGaseous(FluidStack stack){ return isGaseous(); }
public Rarity getRarity(FluidStack stack){ return getRarity(); }
public int getColor(FluidStack stack){ return getColor(); }
public Material getStillMaterial(FluidStack stack) { return getStillMaterial(); }
public Material getFlowingMaterial(FluidStack stack) { return getFlowingMaterial(); }
public ResourceLocation getStillTexture(FluidStack stack) { return getStillTexture(); }
public ResourceLocation getFlowingTexture(FluidStack stack) { return getFlowingTexture(); }
public SoundEvent getFillSound(FluidStack stack) { return getFillSound(); }
public SoundEvent getEmptySound(FluidStack stack) { return getEmptySound(); }
@@ -322,16 +321,16 @@ public class FluidAttributes
public boolean isGaseous(ILightReader world, BlockPos pos){ return isGaseous(); }
public Rarity getRarity(ILightReader world, BlockPos pos){ return getRarity(); }
public int getColor(ILightReader world, BlockPos pos){ return getColor(); }
public Material getStillMaterial(ILightReader world, BlockPos pos) { return getStillMaterial(); }
public Material getFlowingMaterial(ILightReader world, BlockPos pos) { return getFlowingMaterial(); }
public ResourceLocation getStillTexture(ILightReader world, BlockPos pos) { return getStillTexture(); }
public ResourceLocation getFlowingTexture(ILightReader world, BlockPos pos) { return getFlowingTexture(); }
public SoundEvent getFillSound(ILightReader world, BlockPos pos) { return getFillSound(); }
public SoundEvent getEmptySound(ILightReader world, BlockPos pos) { return getEmptySound(); }
public static Builder builder(Material stillTexture, Material flowingTexture) {
public static Builder builder(ResourceLocation stillTexture, ResourceLocation flowingTexture) {
return new Builder(stillTexture, flowingTexture, FluidAttributes::new);
}
public Stream<Material> getTextures()
public Stream<ResourceLocation> getTextures()
{
if (overlayTexture != null)
return Stream.of(stillTexture, flowingTexture, overlayTexture);
@@ -340,9 +339,9 @@ public class FluidAttributes
public static class Builder
{
private final Material stillTexture;
private final Material flowingTexture;
private Material overlayTexture;
private final ResourceLocation stillTexture;
private final ResourceLocation flowingTexture;
private ResourceLocation overlayTexture;
private int color = 0xFFFFFFFF;
private String translationKey;
private SoundEvent fillSound;
@@ -355,7 +354,7 @@ public class FluidAttributes
private Rarity rarity = Rarity.COMMON;
private BiFunction<Builder,Fluid,FluidAttributes> factory;
protected Builder(Material stillTexture, Material flowingTexture, BiFunction<Builder,Fluid,FluidAttributes> factory) {
protected Builder(ResourceLocation stillTexture, ResourceLocation flowingTexture, BiFunction<Builder,Fluid,FluidAttributes> factory) {
this.factory = factory;
this.stillTexture = stillTexture;
this.flowingTexture = flowingTexture;
@@ -373,7 +372,7 @@ public class FluidAttributes
return this;
}
public final Builder overlay(Material texture)
public final Builder overlay(ResourceLocation texture)
{
overlayTexture = texture;
return this;
@@ -447,7 +446,7 @@ public class FluidAttributes
return BiomeColors.func_228363_c_(world, pos) | 0xFF000000;
}
public static Builder builder(Material stillTexture, Material flowingTexture) {
public static Builder builder(ResourceLocation stillTexture, ResourceLocation flowingTexture) {
return new Builder(stillTexture, flowingTexture, Water::new);
}
}
@@ -22,10 +22,10 @@ package net.minecraftforge.fml;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.registries.IForgeRegistry;
import net.minecraftforge.registries.IForgeRegistryEntry;
import net.minecraftforge.registries.IRegistryDelegate;
import net.minecraftforge.registries.ObjectHolderRegistry;
import net.minecraftforge.registries.RegistryManager;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Objects;
@@ -42,20 +42,10 @@ public final class RegistryObject<T extends IForgeRegistryEntry<? super T>> impl
@Nullable
private T value;
@Deprecated
public static <T extends IForgeRegistryEntry<T>, U extends T> RegistryObject<U> of(final String name, Supplier<Class<? super T>> registryType) {
return of(new ResourceLocation(name), registryType);
}
public static <T extends IForgeRegistryEntry<T>, U extends T> RegistryObject<U> of(final ResourceLocation name, Supplier<Class<? super T>> registryType) {
return new RegistryObject<>(name, registryType);
}
@Deprecated
public static <T extends IForgeRegistryEntry<T>, U extends T> RegistryObject<U> of(final String name, IForgeRegistry<T> registry) {
return of(new ResourceLocation(name), registry);
}
public static <T extends IForgeRegistryEntry<T>, U extends T> RegistryObject<U> of(final ResourceLocation name, IForgeRegistry<T> registry) {
return new RegistryObject<>(name, registry);
}
@@ -93,11 +83,13 @@ public final class RegistryObject<T extends IForgeRegistryEntry<? super T>> impl
/**
* Directly retrieves the wrapped Registry Object. This value will automatically be updated when the backing registry is updated.
*/
@Nullable
@Override
@Nonnull
public T get()
{
return this.value;
T ret = this.value;
Objects.requireNonNull(ret, "Registry Object not present");
return ret;
}
public void updateReference(IForgeRegistry<? extends T> registry)
@@ -110,14 +102,6 @@ public final class RegistryObject<T extends IForgeRegistryEntry<? super T>> impl
return this.name;
}
/**
* @deprecated Prefer {@link #getId()}
*/
@Deprecated
public String getName() {
return getId().toString();
}
public Stream<T> stream() {
return isPresent() ? Stream.of(get()) : Stream.of();
}
@@ -37,7 +37,6 @@ import java.util.function.Supplier;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.Minecraft;
@@ -145,12 +144,6 @@ public class ClientModLoader
return VersionChecker.Status.UP_TO_DATE;
}
@Deprecated // TODO: remove in 1.15
public static void complete()
{
completeModLoading();
}
public static boolean completeModLoading()
{
RenderSystem.disableTexture();
@@ -64,37 +64,6 @@ public class ObfuscationReflectionHelper
return FMLLoader.getNameFunction("srg").map(f->f.apply(domain, name)).orElse(name);
}
/**
* Gets the value a field with the specified index in the given class.
* Note: For performance, use {@link #findField(Class, int)} if you are getting the value more than once.
* <p>
* Throws an exception if the field is not found or the value of the field cannot be gotten.
*
* @param classToAccess The class to find the field on.
* @param instance The instance of the {@code classToAccess}.
* @param fieldIndex The index of the field in the {@code classToAccess}.
* @param <T> The type of the value.
* @param <E> The type of the {@code classToAccess}.
* @return The value of the field with the specified index in the {@code classToAccess}.
* @throws UnableToAccessFieldException If there was a problem getting the field or the value.
* @deprecated Use {@link #getPrivateValue(Class, Object, String)} because field indices change a lot more often than field names do.
* TODO: Remove in 1.15
*/
@Deprecated
@Nullable
public static <T, E> T getPrivateValue(Class<? super E> classToAccess, E instance, int fieldIndex)
{
try
{
return (T) findField(classToAccess, fieldIndex).get(instance);
}
catch (Exception e)
{
LOGGER.error(REFLECTION, "There was a problem getting field index {} from {}", fieldIndex, classToAccess.getName(), e);
throw new UnableToAccessFieldException(e);
}
}
/**
* Gets the value a field with the specified name in the given class.
* Note: For performance, use {@link #findField(Class, String)} if you are getting the value more than once.
@@ -129,36 +98,6 @@ public class ObfuscationReflectionHelper
}
}
/**
* Sets the value a field with the specified index in the given class.
* Note: For performance, use {@link #findField(Class, int)} if you are setting the value more than once.
* <p>
* Throws an exception if the field is not found or the value of the field cannot be set.
*
* @param classToAccess The class to find the field on.
* @param instance The instance of the {@code classToAccess}.
* @param value The new value for the field
* @param fieldIndex The index of the field in the {@code classToAccess}.
* @param <T> The type of the value.
* @param <E> The type of the {@code classToAccess}.
* @throws UnableToAccessFieldException If there was a problem setting the value of the field.
* @deprecated Use {@link #setPrivateValue(Class, Object, Object, String)} because field indices change a lot more often than field names do.
* TODO: Remove in 1.15
*/
@Deprecated
public static <T, E> void setPrivateValue(@Nonnull final Class<? super T> classToAccess, @Nonnull final T instance, @Nullable final E value, int fieldIndex)
{
try
{
findField(classToAccess, fieldIndex).set(instance, value);
}
catch (IllegalAccessException e)
{
LOGGER.error("There was a problem setting field index {} on type {}", fieldIndex, classToAccess.getName(), e);
throw new UnableToAccessFieldException(e);
}
}
/**
* Sets the value a field with the specified name in the given class.
* Note: For performance, use {@link #findField(Class, String)} if you are setting the value more than once.
@@ -304,35 +243,6 @@ public class ObfuscationReflectionHelper
}
}
/**
* Finds a field with the specified index in the given class and makes it accessible.
* Note: For performance, store the returned value and avoid calling this repeatedly.
* <p>
* Throws an exception if the field is not found.
*
* @param clazz The class to find the field on.
* @param fieldIndex The index of the field on the class
* @param <T> The type.
* @return The constructor with the specified parameters in the given class.
* @throws NullPointerException If {@code clazz} is null.
* @throws UnableToFindFieldException If the field could not be found.
* @deprecated Use {@link #findField(Class, String)} because field indices change a lot more often than field names do.
* TODO: Remove in 1.15
*/
@Deprecated
@Nonnull
public static <T> Field findField(final Class<? super T> clazz, final int fieldIndex) {
Preconditions.checkNotNull(clazz, "Class to find field on cannot be null.");
try {
final Field f = clazz.getDeclaredFields()[fieldIndex];
f.setAccessible(true);
return f;
} catch (Exception e) {
throw new UnableToFindFieldException(e);
}
}
public static class UnableToAccessFieldException extends RuntimeException
{
private UnableToAccessFieldException(Exception e)
@@ -395,12 +395,6 @@ public class ForgeRegistry<V extends IForgeRegistryEntry<V>> implements IForgeRe
return ret;
}
@Deprecated //Public for ByteByfUtils only!
public V getRaw(int id)
{
return this.ids.get(id);
}
void addAlias(ResourceLocation from, ResourceLocation to)
{
if (this.isLocked())
@@ -969,15 +969,6 @@ public class GameData
}
}
/**
* @deprecated Use {@link #checkPrefix(String, boolean)}.
*/
@Deprecated
public static ResourceLocation checkPrefix(String name)
{
return checkPrefix(name, true);
}
/**
* Check a name for a domain prefix, and if not present infer it from the
* current active mod container.
@@ -68,13 +68,4 @@ public class ForgeTimings<T>
return sum / rawTimingData.length;
}
/**
* Returns a copy of the raw timings data collected by the tracker
* @return The raw timing data
* @deprecated Added for compatibility, remove in 1.13
*/
public int[] getRawTimingData(){
return Arrays.copyOfRange(rawTimingData, 0, rawTimingData.length);
}
}
@@ -40,8 +40,10 @@ public net.minecraft.client.renderer.model.BlockModel func_187966_f()Ljava/util/
public net.minecraft.client.renderer.model.BlockPart func_178236_a(Lnet/minecraft/util/Direction;)[F # getFaceUvs
public net.minecraft.client.renderer.model.BlockPart$Deserializer <init>()V
public net.minecraft.client.renderer.model.BlockPartFace$Deserializer <init>()V
public net.minecraft.client.renderer.model.ItemCameraTransforms$Deserializer <init>()V
public net.minecraft.client.renderer.model.ItemOverride$Deserializer <init>()V
protected net.minecraft.client.renderer.model.ItemOverrideList <init>()V
public net.minecraft.client.renderer.model.ItemTransformVec3f$Deserializer <init>()V
public net.minecraft.client.renderer.model.ItemTransformVec3f$Deserializer field_178360_b # TRANSLATION_DEFAULT
public net.minecraft.client.renderer.model.ItemTransformVec3f$Deserializer field_178361_c # SCALE_DEFAULT
public net.minecraft.client.renderer.model.ItemTransformVec3f$Deserializer field_178362_a # ROTATION_DEFAULT
@@ -26,12 +26,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.vecmath.AxisAngle4d;
import javax.vecmath.Matrix4f;
import javax.vecmath.Quat4f;
import javax.vecmath.Vector3d;
import javax.vecmath.Vector4f;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -19,16 +19,20 @@
package net.minecraftforge.debug.fluid;
import org.apache.commons.lang3.Validate;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.FlowingFluidBlock;
import net.minecraft.client.renderer.model.Material;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.fluid.FlowingFluid;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.*;
import net.minecraft.item.BucketItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fluids.FluidAttributes;
@@ -40,15 +44,14 @@ import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import org.apache.commons.lang3.Validate;
@Mod(NewFluidTest.MODID)
public class NewFluidTest
{
public static final String MODID = "new_fluid_test";
public static final Material FLUID_STILL = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation("minecraft:block/brown_mushroom_block"));
public static final Material FLUID_FLOWING = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation("minecraft:block/mushroom_stem"));
public static final ResourceLocation FLUID_STILL = new ResourceLocation("minecraft:block/brown_mushroom_block");
public static final ResourceLocation FLUID_FLOWING = new ResourceLocation("minecraft:block/mushroom_stem");
public static final DeferredRegister<Block> BLOCKS = new DeferredRegister<>(ForgeRegistries.BLOCKS, MODID);
public static final DeferredRegister<Item> ITEMS = new DeferredRegister<>(ForgeRegistries.ITEMS, MODID);
@@ -115,7 +115,7 @@ public class ContainerTypeTest
if (event.getWorld().getBlockState(event.getPos()).getBlock() == Blocks.SPONGE)
{
String text = "Hello World!";
NetworkHooks.openGui((ServerPlayerEntity) event.getEntityPlayer(), new INamedContainerProvider()
NetworkHooks.openGui((ServerPlayerEntity) event.getPlayer(), new INamedContainerProvider()
{
@Override
public Container createMenu(int p_createMenu_1_, PlayerInventory p_createMenu_2_, PlayerEntity p_createMenu_3_)