Updated mappings to match the ones used by IE

This commit is contained in:
malte0811 2017-06-25 18:34:10 +02:00
parent c262866b4d
commit cbac269e04
19 changed files with 68 additions and 60 deletions

View file

@ -52,14 +52,14 @@ minecraft {
runDir = "run"
replace '${version}', project.version
mappings = "snapshot_20170323"
mappings = "snapshot_20170612"
}
repositories {
/*maven {
maven {
name 'ic2'
url 'http://maven.ic2.player.to/'
}*/
}
maven {
name 'jared maven'
url 'http://blamejared.com/maven'
@ -67,7 +67,7 @@ repositories {
}
dependencies {
//deobfCompile "net.industrial-craft:industrialcraft-2:2.7.+:api"
deobfCompile "net.industrial-craft:industrialcraft-2:2.7.+:api"
deobfCompile "blusunrize:ImmersiveEngineering:0.11-+:deobf"
}

View file

@ -101,7 +101,7 @@ public class BlockJacobsLadder extends BlockIWBase implements IMetaEnum, IPlacem
}
@Override
public boolean isFullyOpaque(IBlockState state) {
public boolean isTopSolid(IBlockState state) {
return false;
}

View file

@ -259,9 +259,9 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl
NBTTagList ret = new NBTTagList();
for (Vec3d point : array) {
NBTTagCompound vec = new NBTTagCompound();
vec.setDouble("x", point.xCoord);
vec.setDouble("y", point.yCoord);
vec.setDouble("z", point.zCoord);
vec.setDouble("x", point.x);
vec.setDouble("y", point.y);
vec.setDouble("z", point.z);
ret.appendTag(vec);
}
return ret;
@ -471,7 +471,7 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl
min = new Vec3d(distZ, 0, distX);
max = new Vec3d(1 - distZ, h, 1 - distX);
}
return new AxisAlignedBB(min.xCoord, min.yCoord, min.zCoord, max.xCoord, max.yCoord, max.zCoord);
return new AxisAlignedBB(min.x, min.y, min.z, max.x, max.y, max.z);
}
}

View file

@ -23,6 +23,7 @@ import malte0811.industrialWires.IndustrialWires;
import malte0811.industrialWires.blocks.BlockIWBase;
import malte0811.industrialWires.blocks.IMetaEnum;
import malte0811.industrialWires.controlpanel.PanelComponent;
import malte0811.industrialWires.controlpanel.PropertyComponents;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;

View file

@ -135,6 +135,7 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil
NBTTagList l = nbt.getTagList("components", 10);
PanelUtils.readListFromNBT(l, components);
components.height = nbt.getFloat("height");
components.angle = nbt.getFloat("angle");
}
defAABB = null;
}
@ -148,6 +149,7 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil
}
nbt.setTag("components", comps);
nbt.setFloat("height", components.height);
nbt.setFloat("angle", components.angle);
}
@Nonnull
@ -220,7 +222,7 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil
Vec3d max = new Vec3d(in.maxX, in.maxY, in.maxZ);
min = mat.apply(min);
max = mat.apply(max);
return new AxisAlignedBB(min.xCoord, min.yCoord, min.zCoord, max.xCoord, max.yCoord, max.zCoord);
return new AxisAlignedBB(min.x, min.y, min.z, max.x, max.y, max.z);
}
@Nullable
@ -232,7 +234,7 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil
for (PanelComponent pc : components) {
AxisAlignedBB box = pc.getBlockRelativeAABB();
if (box.maxY > box.minY) {
box = apply(mat, box.expandXyz(.002));
box = apply(mat, box.grow(.002));
Vec3d hitVec = hitAbs ? hit.addVector(-pos.getX(), -pos.getY(), -pos.getZ()) : hit;
hitVec = hitVec.scale(2).subtract(playerPos);
RayTraceResult ray = box.calculateIntercept(playerPos, hitVec);

View file

@ -30,6 +30,7 @@ import malte0811.industrialWires.blocks.IBlockBoundsIW;
import malte0811.industrialWires.blocks.INetGUI;
import malte0811.industrialWires.controlpanel.PanelComponent;
import malte0811.industrialWires.controlpanel.PanelUtils;
import malte0811.industrialWires.controlpanel.PropertyComponents;
import malte0811.industrialWires.util.TriConsumer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;

View file

@ -277,7 +277,7 @@ public class ClientProxy extends CommonProxy {
default:
return;
}
PositionedSoundRecord sound = new PositionedSoundRecord(event, SoundCategory.BLOCKS, te.size.soundVolume, 1, false, 0, ISound.AttenuationType.LINEAR, (float) soundPos.xCoord, (float) soundPos.yCoord, (float) soundPos.zCoord);
PositionedSoundRecord sound = new PositionedSoundRecord(event, SoundCategory.BLOCKS, te.size.soundVolume, 1, false, 0, ISound.AttenuationType.LINEAR, (float) soundPos.x, (float) soundPos.y, (float) soundPos.z);
ClientUtils.mc().getSoundHandler().playSound(sound);
playingSounds.put(te.getPos(), sound);
}

View file

@ -223,8 +223,8 @@ public class GuiPanelComponent extends GuiContainer {
for (int i = 0; i < stringTexts.size(); i++) {
GuiTextField field = stringTexts.get(i);
String tooltip = confComp.fomatConfigDescription(IConfigurableComponent.ConfigType.STRING, i);
if (tooltip != null && mouseX >= field.xPosition && mouseX < field.xPosition + field.width &&
mouseY >= field.yPosition && mouseY < field.yPosition + field.height) {
if (tooltip != null && mouseX >= field.x && mouseX < field.x + field.width &&
mouseY >= field.y && mouseY < field.y + field.height) {
ClientUtils.drawHoveringText(ImmutableList.of(tooltip), mouseX, mouseY, mc.fontRenderer);
}
}

View file

@ -22,8 +22,8 @@ public class GuiChannelPicker extends GuiButton {
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
mouseX -= xPosition;
mouseY -= yPosition;
mouseX -= x;
mouseY -= y;
currHovered = -1;
for (byte i = 0; i < 16; i++) {
int xMin = width / 4 * (i % 4);
@ -36,19 +36,19 @@ public class GuiChannelPicker extends GuiButton {
currHovered = i;
}
if (selected == i) {
drawRect(xMin + xPosition, yMin + yPosition, xMax + xPosition, yMax + yPosition, 0xff000000 | ~colorVal);
drawRect(xMin + x, yMin + y, xMax + x, yMax + y, 0xff000000 | ~colorVal);
}
if (currHovered == i) {
drawRect(xMin + xPosition, yMin + yPosition, xMax + xPosition, yMax + yPosition, colorVal);
drawRect(xMin + x, yMin + y, xMax + x, yMax + y, colorVal);
} else {
final int offset = width / 20;
drawRect(xMin + offset + xPosition, yMin + offset + yPosition, xMax - offset + xPosition, yMax - offset + yPosition, colorVal);
drawRect(xMin + offset + x, yMin + offset + y, xMax - offset + x, yMax - offset + y, colorVal);
}
}
}
public boolean click(int x, int y) {
if (xPosition <= x && xPosition + width >= x && yPosition <= y && yPosition + height >= y) {
public boolean click(int xMouse, int yMouse) {
if (x <= xMouse && x + width >= xMouse && y <= yMouse && y + height >= yMouse) {
select();
return true;
}
@ -65,7 +65,7 @@ public class GuiChannelPicker extends GuiButton {
return selected;
}
public boolean isHovered(int x, int y) {
return xPosition <= x && xPosition + width >= x && yPosition <= y && yPosition + height >= y;
public boolean isHovered(int xMouse, int yMouse) {
return x <= xMouse && x + width >= xMouse && y <= yMouse && y + height >= yMouse;
}
}

View file

@ -46,14 +46,14 @@ public class GuiChannelPickerSmall extends GuiChannelPicker {
} else {
EnumDyeColor color = EnumDyeColor.byMetadata(selected);
int colorVal = color.getMapColor().colorValue | 0xff000000;
drawRect(xPosition, yPosition, xPosition + width, yPosition + height, colorVal);
drawRect(x, y, x + width, y + height, colorVal);
}
}
@Override
public boolean click(int x, int y) {
public boolean click(int xMouse, int yMouse) {
if (!open) {
if (xPosition <= x && xPosition + width >= x && yPosition <= y && yPosition + height >= y) {
if (x <= xMouse && x + width >= xMouse && y <= yMouse && y + height >= yMouse) {
open = true;
width = onSize;
height = onSize;
@ -62,7 +62,7 @@ public class GuiChannelPickerSmall extends GuiChannelPicker {
return false;
} else {
boolean ret = false;
if (xPosition <= x && xPosition + width >= x && yPosition <= y && yPosition + height >= y) {
if (x <= xMouse && x + width >= xMouse && y <= yMouse && y + height >= yMouse) {
select();
ret = true;
}

View file

@ -23,10 +23,10 @@ import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.collect.ImmutableList;
import malte0811.industrialWires.blocks.controlpanel.BlockTypes_Panel;
import malte0811.industrialWires.blocks.controlpanel.PropertyComponents;
import malte0811.industrialWires.blocks.controlpanel.PropertyComponents.PanelRenderProperties;
import malte0811.industrialWires.blocks.controlpanel.TileEntityPanel;
import malte0811.industrialWires.controlpanel.PanelUtils;
import malte0811.industrialWires.controlpanel.PropertyComponents;
import malte0811.industrialWires.controlpanel.PropertyComponents.PanelRenderProperties;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.*;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;

View file

@ -52,7 +52,7 @@ public class TileRenderJacobsLadder extends TileEntitySpecialRenderer<TileEntity
Vec3d[] controls = new Vec3d[tile.size.arcPoints];
for (int i = 0; i < tile.size.arcPoints; i++) {
Vec3d speed = tile.controlMovement[i];
controls[i] = tile.controls[i].addVector(speed.xCoord * partialTicks, speed.yCoord * partialTicks, speed.zCoord * partialTicks);
controls[i] = tile.controls[i].addVector(speed.x * partialTicks, speed.y * partialTicks, speed.z * partialTicks);
}
drawBezier(controls, tile.salt, tile.size);
//DEBUG CODE
@ -136,15 +136,15 @@ public class TileRenderJacobsLadder extends TileEntitySpecialRenderer<TileEntity
}
private void drawQuad(Vec3d v0, Vec3d v1, Vec3d rad, float[] color0, float[] color1, VertexBuffer vertexBuffer) {
color(color1, vertexBuffer.pos(v1.xCoord - rad.xCoord, v1.yCoord - rad.yCoord, v1.zCoord - rad.zCoord)).endVertex();
color(color0, vertexBuffer.pos(v0.xCoord - rad.xCoord, v0.yCoord - rad.yCoord, v0.zCoord - rad.zCoord)).endVertex();
color(color0, vertexBuffer.pos(v0.xCoord + rad.xCoord, v0.yCoord + rad.yCoord, v0.zCoord + rad.zCoord)).endVertex();
color(color1, vertexBuffer.pos(v1.xCoord + rad.xCoord, v1.yCoord + rad.yCoord, v1.zCoord + rad.zCoord)).endVertex();
color(color1, vertexBuffer.pos(v1.x - rad.x, v1.y - rad.y, v1.z - rad.z)).endVertex();
color(color0, vertexBuffer.pos(v0.x - rad.x, v0.y - rad.y, v0.z - rad.z)).endVertex();
color(color0, vertexBuffer.pos(v0.x + rad.x, v0.y + rad.y, v0.z + rad.z)).endVertex();
color(color1, vertexBuffer.pos(v1.x + rad.x, v1.y + rad.y, v1.z + rad.z)).endVertex();
color(color1, vertexBuffer.pos(v1.xCoord + rad.xCoord, v1.yCoord + rad.yCoord, v1.zCoord + rad.zCoord)).endVertex();
color(color0, vertexBuffer.pos(v0.xCoord + rad.xCoord, v0.yCoord + rad.yCoord, v0.zCoord + rad.zCoord)).endVertex();
color(color0, vertexBuffer.pos(v0.xCoord - rad.xCoord, v0.yCoord - rad.yCoord, v0.zCoord - rad.zCoord)).endVertex();
color(color1, vertexBuffer.pos(v1.xCoord - rad.xCoord, v1.yCoord - rad.yCoord, v1.zCoord - rad.zCoord)).endVertex();
color(color1, vertexBuffer.pos(v1.x + rad.x, v1.y + rad.y, v1.z + rad.z)).endVertex();
color(color0, vertexBuffer.pos(v0.x + rad.x, v0.y + rad.y, v0.z + rad.z)).endVertex();
color(color0, vertexBuffer.pos(v0.x - rad.x, v0.y - rad.y, v0.z - rad.z)).endVertex();
color(color1, vertexBuffer.pos(v1.x - rad.x, v1.y - rad.y, v1.z - rad.z)).endVertex();
}
private VertexBuffer color(float[] color, VertexBuffer vb) {

View file

@ -167,7 +167,7 @@ public abstract class PanelComponent {
double px = te.getPos().getX() - TileEntityRendererDispatcher.staticPlayerX;
double py = te.getPos().getY() - TileEntityRendererDispatcher.staticPlayerY;
double pz = te.getPos().getZ() - TileEntityRendererDispatcher.staticPlayerZ;
RenderGlobal.drawSelectionBoundingBox(te.apply(te.getComponents().getPanelTopTransform(), getBlockRelativeAABB()).expandXyz(0.002).offset(px, py, pz),
RenderGlobal.drawSelectionBoundingBox(te.apply(te.getComponents().getPanelTopTransform(), getBlockRelativeAABB()).grow(0.002).offset(px, py, pz),
0.0F, 0.0F, 0.0F, 0.4F);
GlStateManager.depthMask(true);
GlStateManager.enableTexture2D();

View file

@ -24,9 +24,9 @@ import ic2.api.item.IC2Items;
import malte0811.industrialWires.IndustrialWires;
import malte0811.industrialWires.blocks.controlpanel.BlockPanel;
import malte0811.industrialWires.blocks.controlpanel.BlockTypes_Panel;
import malte0811.industrialWires.blocks.controlpanel.PropertyComponents.PanelRenderProperties;
import malte0811.industrialWires.client.RawQuad;
import malte0811.industrialWires.client.panelmodel.SmartLightingQuadIW;
import malte0811.industrialWires.controlpanel.PropertyComponents.PanelRenderProperties;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.BakedQuad;

View file

@ -16,10 +16,9 @@
* along with Industrial Wires. If not, see <http://www.gnu.org/licenses/>.
*/
package malte0811.industrialWires.blocks.controlpanel;
package malte0811.industrialWires.controlpanel;
import blusunrize.immersiveengineering.common.util.chickenbones.Matrix4;
import malte0811.industrialWires.controlpanel.PanelComponent;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.property.IUnlistedProperty;
@ -52,6 +51,7 @@ public class PropertyComponents implements IUnlistedProperty<PropertyComponents.
public EnumFacing facing = EnumFacing.NORTH;
public float height = .5F;
public EnumFacing top = EnumFacing.UP;
public float angle = 0;
public PanelRenderProperties() {
super();
@ -74,25 +74,29 @@ public class PropertyComponents implements IUnlistedProperty<PropertyComponents.
}
public Matrix4 getPanelTopTransform() {
return getPanelBaseTransform().translate(0, height, 0);
return getPanelBaseTransformUnrotated().translate(0, height, 0).rotate(angle, 1, 0, 0);
}
public Matrix4 getPanelBaseTransform() {
return getPanelBaseTransformUnrotated().rotate(angle, 1, 0, 0);
}
public Matrix4 getPanelBaseTransformUnrotated() {
Matrix4 ret = new Matrix4();
ret.translate(.5, .5, .5);
switch (top) {
case DOWN:
ret.rotate(Math.PI, 0, 0, 1);
case UP:
ret.rotate(-facing.getHorizontalAngle() * Math.PI / 180 + Math.PI, 0, 1, 0);
break;
case NORTH:
case SOUTH:
case WEST:
case EAST:
ret.rotate(Math.PI / 2, 1, 0, 0);
ret.rotate(top.getHorizontalAngle() * Math.PI / 180, 0, 0, 1);
break;
case DOWN:
ret.rotate(Math.PI, 0, 0, 1);
case UP:
ret.rotate(-facing.getHorizontalAngle() * Math.PI / 180 + Math.PI, 0, 1, 0);
break;
case NORTH:
case SOUTH:
case WEST:
case EAST:
ret.rotate(Math.PI / 2, 1, 0, 0);
ret.rotate(top.getHorizontalAngle() * Math.PI / 180, 0, 0, 1);
break;
}
ret.translate(-.5, -.5, -.5);
return ret;

View file

@ -129,7 +129,7 @@ public class Slider extends PanelComponent implements IConfigurableComponent {
@Override
public void interactWith(Vec3d hitRelative, TileEntityPanel tile, EntityPlayerMP player) {
double pos = horizontal ? hitRelative.xCoord : (length - hitRelative.zCoord);
double pos = horizontal ? hitRelative.x : (length - hitRelative.z);
byte newLevel = (byte) (Math.min(pos * 16 / length, 15));
if (newLevel != out) {
setOut(rsChannel, newLevel);

View file

@ -129,8 +129,8 @@ public class Variac extends PanelComponent implements IConfigurableComponent {
@Override
public void interactWith(Vec3d hitRelative, TileEntityPanel tile, EntityPlayerMP player) {
double xRel = hitRelative.xCoord - SIZE / 2;
double yRel = -(hitRelative.zCoord - SIZE / 2);
double xRel = hitRelative.x - SIZE / 2;
double yRel = -(hitRelative.z - SIZE / 2);
double angle = 1.5 * Math.PI - Math.atan2(yRel, xRel);
if (angle < 0) {
angle += 2 * Math.PI;

View file

@ -55,7 +55,7 @@ public class MessagePanelInteract implements IMessage {
buf.writeInt(this.pos.getY());
buf.writeInt(this.pos.getZ());
buf.writeInt(pcId);
buf.writeDouble(hitRelative.xCoord).writeDouble(hitRelative.yCoord).writeDouble(hitRelative.zCoord);
buf.writeDouble(hitRelative.x).writeDouble(hitRelative.y).writeDouble(hitRelative.z);
}
public static class HandlerServer implements IMessageHandler<MessagePanelInteract, IMessage> {

View file

@ -34,7 +34,7 @@ public final class Beziers {
int n = controls.length - 1;
for (int i = 0; i <= n; i++) {
double coeff = binomialCoeff(n, i) * Math.pow(t, i) * Math.pow(1 - t, n - i);
ret = ret.addVector(coeff * controls[i].xCoord, coeff * controls[i].yCoord, coeff * controls[i].zCoord);
ret = ret.addVector(coeff * controls[i].x, coeff * controls[i].y, coeff * controls[i].z);
}
return ret;
}