Build 1.5-13

Fixed labels breaking the model cache and on dedicated servers, closes #10
This commit is contained in:
malte0811 2017-07-04 18:16:13 +02:00
parent b6ef962f6f
commit 0a772758ae
4 changed files with 35 additions and 23 deletions

View file

@ -1,23 +1,5 @@
def mainVersion = "1.5"
def buildNumber = "12"
/*
* This file is part of Industrial Wires.
* Copyright (C) 2016-2017 malte0811
*
* Industrial Wires is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Industrial Wires is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Industrial Wires. If not, see <http://www.gnu.org/licenses/>.
*/
def buildNumber = "13"
// For those who want the bleeding edge
buildscript {

View file

@ -1,3 +1,6 @@
#####Version 1.5-13
- Labels no longer break the model cache and cause lag
- Labels don't break on dedicated servers any more
#####Version 1.5-12
- Added tilted control panels
- Panels are no longer created from machine casings, there is a dedicated item for that now, the Unfinished Control Panel

View file

@ -33,6 +33,8 @@ import net.minecraft.nbt.NBTTagString;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.relauncher.Side;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@ -87,10 +89,14 @@ public class Label extends PanelComponent implements IConfigurableComponent {
@Override
public AxisAlignedBB getBlockRelativeAABB() {
if (aabb == null) {
RawModelFontRenderer fr = fontRenderer();
float width = fr.getStringWidth(text) * fr.scale;
float height = fr.FONT_HEIGHT * fr.scale;
aabb = new AxisAlignedBB(getX(), 0, getY(), getX() + width, 0, getY() + height);
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
RawModelFontRenderer fr = fontRenderer();
float width = fr.getStringWidth(text) * fr.scale;
float height = fr.FONT_HEIGHT * fr.scale;
aabb = new AxisAlignedBB(getX(), 0, getY(), getX() + width, 0, getY() + height);
} else {
aabb = new AxisAlignedBB(getX(), 0, getY(), getX() + .001, 0, getY() + .001);
}
}
return aabb;
}
@ -184,4 +190,24 @@ public class Label extends PanelComponent implements IConfigurableComponent {
new FloatConfig("blue", 0, 70, color[2], 60)
};
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
Label label = (Label) o;
if (color != label.color) return false;
return text.equals(label.text);
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + text.hashCode();
result = 31 * result + color;
return result;
}
}

View file

@ -80,6 +80,7 @@ public final class PanelUtils {
m4RotOnly.invert();
m4RotOnly.transpose();
//Intentionally not a for-each to help with CME's
//noinspection ForLoopReplaceableByForEach
for (int i = 0; i < components.size(); i++) {
PanelComponent pc = components.get(i);
Matrix4 m4Here = m4.copy().translate(pc.getX(), .0001, pc.getY());