Switch to the new data-driven connector models

Update to new mappings
This commit is contained in:
malte0811 2018-11-17 12:23:31 +01:00
parent a60b55cad1
commit 88c10cdb81
32 changed files with 1062 additions and 184 deletions

View file

@ -32,11 +32,11 @@ sourceCompatibility = 1.8
targetCompatibility = 1.8 targetCompatibility = 1.8
minecraft { minecraft {
version = "14.23.4.2745" version = "1.12.2-14.23.5.2768"
runDir = "run" runDir = "run"
replace '${version}', project.version replace '${version}', project.version
mappings = "snapshot_20171003" mappings = "stable_39"
} }
repositories { repositories {

View file

@ -37,7 +37,7 @@ public class IWPotions {
setIconIndex(0, 0); setIconIndex(0, 0);
this.setRegistryName(new ResourceLocation(IndustrialWires.MODID, "tinnitus")); this.setRegistryName(new ResourceLocation(IndustrialWires.MODID, "tinnitus"));
ForgeRegistries.POTIONS.register(this); ForgeRegistries.POTIONS.register(this);
this.setPotionName("potion."+ IndustrialWires.MODID+"." + getRegistryName().getResourcePath()); this.setPotionName("potion." + IndustrialWires.MODID + "." + getRegistryName().getPath());
} }
@Override @Override

View file

@ -140,8 +140,9 @@ public class IndustrialWires {
public static IndustrialWires instance = new IndustrialWires(); public static IndustrialWires instance = new IndustrialWires();
public static CreativeTabs creativeTab = new CreativeTabs(MODID) { public static CreativeTabs creativeTab = new CreativeTabs(MODID) {
@Override @Override
public ItemStack getTabIconItem() { public ItemStack createIcon() {
if (coil!=null) { if (coil!=null) {
return new ItemStack(coil, 1, 2); return new ItemStack(coil, 1, 2);
} else { } else {

View file

@ -55,7 +55,7 @@ public abstract class BlockIWBase extends Block {
super(mat); super(mat);
setHardness(3.0F); setHardness(3.0F);
setResistance(15.0F); setResistance(15.0F);
setUnlocalizedName(IndustrialWires.MODID + "." + name); setTranslationKey(IndustrialWires.MODID + "." + name);
setRegistryName(IndustrialWires.MODID, name); setRegistryName(IndustrialWires.MODID, name);
setCreativeTab(IndustrialWires.creativeTab); setCreativeTab(IndustrialWires.creativeTab);
IndustrialWires.blocks.add(this); IndustrialWires.blocks.add(this);

View file

@ -45,12 +45,12 @@ public class ItemBlockIW extends ItemBlock {
@Nonnull @Nonnull
@Override @Override
public String getUnlocalizedName(ItemStack stack) { public String getTranslationKey(ItemStack stack) {
int meta = stack.getMetadata(); int meta = stack.getMetadata();
if (values != null) { if (values != null) {
return block.getUnlocalizedName() + "." + values[meta].toString().toLowerCase(); return block.getTranslationKey() + "." + values[meta].toString().toLowerCase();
} else { } else {
return block.getUnlocalizedName(); return block.getTranslationKey();
} }
} }

View file

@ -122,7 +122,7 @@ public abstract class TileEntityIWMultiblock extends TileEntityIWBase implements
mirrored = in.getBoolean(MIRRORED); mirrored = in.getBoolean(MIRRORED);
int[] offset = in.getIntArray(OFFSET); int[] offset = in.getIntArray(OFFSET);
this.offset = new Vec3i(offset[0], offset[1], offset[2]); this.offset = new Vec3i(offset[0], offset[1], offset[2]);
facing = EnumFacing.getHorizontal(in.getInteger(FACING)); facing = EnumFacing.byHorizontalIndex(in.getInteger(FACING));
} }
public Vec3i getSize() { public Vec3i getSize() {

View file

@ -48,7 +48,7 @@ public class TileEntityComponentPanel extends TileEntityPanel {
} }
public void updateRSInput() { public void updateRSInput() {
int value = world.isBlockIndirectlyGettingPowered(pos); int value = world.getRedstonePowerFromNeighbors(pos);
if (value == 0) { if (value == 0) {
for (EnumFacing f : EnumFacing.HORIZONTALS) { for (EnumFacing f : EnumFacing.HORIZONTALS) {
IBlockState state = world.getBlockState(pos.offset(f)); IBlockState state = world.getBlockState(pos.offset(f));

View file

@ -106,8 +106,8 @@ public class TileEntityPanel extends TileEntityGeneralCP implements IDirectional
@Override @Override
public void readNBT(NBTTagCompound in, boolean updatePacket) { public void readNBT(NBTTagCompound in, boolean updatePacket) {
readFromItemNBT(in); readFromItemNBT(in);
components.setFacing(EnumFacing.getHorizontal(in.getInteger("facing"))); components.setFacing(EnumFacing.byHorizontalIndex(in.getInteger("facing")));
components.setTop(EnumFacing.getFront(in.getInteger("top"))); components.setTop(EnumFacing.byIndex(in.getInteger("top")));
} }
@Override @Override
@ -226,9 +226,9 @@ public class TileEntityPanel extends TileEntityGeneralCP implements IDirectional
Matrix4 mat = components.getPanelTopTransformInverse(); Matrix4 mat = components.getPanelTopTransformInverse();
PanelComponent retPc = null; PanelComponent retPc = null;
RayTraceResult retRay = null; RayTraceResult retRay = null;
Vec3d playerPosRelative = player.getPositionVector().addVector(-pos.getX(), player.getEyeHeight() - pos.getY(), -pos.getZ()); Vec3d playerPosRelative = player.getPositionVector().add(-pos.getX(), player.getEyeHeight() - pos.getY(), -pos.getZ());
Vec3d playerPosTransformed = mat.apply(playerPosRelative); Vec3d playerPosTransformed = mat.apply(playerPosRelative);
Vec3d hitRel = hitAbs ? hitVec.addVector(-pos.getX(), -pos.getY(), -pos.getZ()) : hitVec; Vec3d hitRel = hitAbs ? hitVec.add(-pos.getX(), -pos.getY(), -pos.getZ()) : hitVec;
RayTraceResult r = getBoundingBox().calculateIntercept(playerPosRelative, playerPosRelative.add(player.getLookVec().scale(200))); RayTraceResult r = getBoundingBox().calculateIntercept(playerPosRelative, playerPosRelative.add(player.getLookVec().scale(200)));
if (r != null && r.hitVec != null) { if (r != null && r.hitVec != null) {
hitRel = r.hitVec; hitRel = r.hitVec;

View file

@ -146,7 +146,7 @@ public class TileEntityRSPanelIE extends TileEntityRSPanel//TODO what parts of T
public Vec3d getConnectionOffset(ImmersiveNetHandler.Connection connection) { public Vec3d getConnectionOffset(ImmersiveNetHandler.Connection connection) {
EnumFacing side = facing.getOpposite(); EnumFacing side = facing.getOpposite();
double conRadius = connection.cableType.getRenderDiameter() / 2; double conRadius = connection.cableType.getRenderDiameter() / 2;
return new Vec3d(.5 - conRadius * side.getFrontOffsetX(), .5 - conRadius * side.getFrontOffsetY(), .5 - conRadius * side.getFrontOffsetZ()); return new Vec3d(.5 - conRadius * side.getXOffset(), .5 - conRadius * side.getYOffset(), .5 - conRadius * side.getZOffset());
} }
@Override @Override

View file

@ -143,9 +143,10 @@ public class BlockJacobsLadder extends BlockIWBase implements IMetaEnum, IPlacem
return new ItemStack(this, 1, getMetaFromState(state)); return new ItemStack(this, 1, getMetaFromState(state));
} }
@Override @Override
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) { public void onEntityCollision(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) {
super.onEntityCollidedWithBlock(worldIn, pos, state, entityIn); super.onEntityCollision(worldIn, pos, state, entityIn);
TileEntity te = worldIn.getTileEntity(pos); TileEntity te = worldIn.getTileEntity(pos);
if (te instanceof TileEntityJacobsLadder) { if (te instanceof TileEntityJacobsLadder) {
((TileEntityJacobsLadder) te).onEntityTouch(entityIn); ((TileEntityJacobsLadder) te).onEntityTouch(entityIn);

View file

@ -52,7 +52,7 @@ public class TileEntityDischargeMeter extends TileEntityIWBase implements IPlaye
@Override @Override
public void readNBT(NBTTagCompound in, boolean updatePacket) { public void readNBT(NBTTagCompound in, boolean updatePacket) {
hasWire = in.getBoolean(HAS_WIRE); hasWire = in.getBoolean(HAS_WIRE);
facing = EnumFacing.getHorizontal(in.getByte(FACING)); facing = EnumFacing.byHorizontalIndex(in.getByte(FACING));
lastDischarge = in.getDouble(LAST_DISCHARGE); lastDischarge = in.getDouble(LAST_DISCHARGE);
aabb = null; aabb = null;
} }

View file

@ -714,16 +714,16 @@ public class TileEntityMarx extends TileEntityIWMultiblock implements ITickable,
.radius(5); .radius(5);
List<Light> toAdd = new ArrayList<>(te.stageCount*2-3); List<Light> toAdd = new ArrayList<>(te.stageCount*2-3);
if (te.dischargeData!=null&&te.dischargeData.energy>0) { if (te.dischargeData!=null&&te.dischargeData.energy>0) {
toAdd.add(builder.pos(origin.addVector(0, 0, 0)).build()); toAdd.add(builder.pos(origin.add(0, 0, 0)).build());
toAdd.add(builder.pos(origin.addVector(0, te.stageCount/2, 0)).build()); toAdd.add(builder.pos(origin.add(0, te.stageCount / 2, 0)).build());
toAdd.add(builder.pos(origin.addVector(0, te.stageCount-2, 0)).build()); toAdd.add(builder.pos(origin.add(0, te.stageCount - 2, 0)).build());
} }
origin = new Vec3d(offset(te.pos, te.facing, te.mirrored, 1, 0, 0)) origin = new Vec3d(offset(te.pos, te.facing, te.mirrored, 1, 0, 0))
.addVector(0, .75, 0) .add(0, .75, 0)
.add(new Vec3d(te.facing.getDirectionVec()).scale(.25)); .add(new Vec3d(te.facing.getDirectionVec()).scale(.25));
builder.radius(.5F); builder.radius(.5F);
for (int i = 0;i<te.stageCount-1;i+=te.stageCount/5) { for (int i = 0;i<te.stageCount-1;i+=te.stageCount/5) {
toAdd.add(builder.pos(origin.addVector(0, i, 0)).build()); toAdd.add(builder.pos(origin.add(0, i, 0)).build());
} }
event.getLightList().addAll(toAdd); event.getLightList().addAll(toAdd);
} }
@ -768,12 +768,12 @@ public class TileEntityMarx extends TileEntityIWMultiblock implements ITickable,
Vec3d diff = vertices[max].subtract(vertices[min]); Vec3d diff = vertices[max].subtract(vertices[min]);
Vec3d v0 = diff.crossProduct(side); Vec3d v0 = diff.crossProduct(side);
transform.setIdentity(); transform.setIdentity();
double diffLength = diff.lengthVector(); double diffLength = diff.length();
double noise = Math.sqrt(diffLength)*rand.nextDouble()*1/(1+Math.abs(stageCount/2.0-toGenerate))*.75; double noise = Math.sqrt(diffLength)*rand.nextDouble()*1/(1+Math.abs(stageCount/2.0-toGenerate))*.75;
if ((max-min)%2==1) { if ((max-min)%2==1) {
noise *= (toGenerate-min)/(double)(max-min); noise *= (toGenerate-min)/(double)(max-min);
} }
v0 = v0.scale((float) (noise/v0.lengthVector())); v0 = v0.scale((float) (noise / v0.length()));
diff = diff.scale(1/diffLength); diff = diff.scale(1/diffLength);
transform.rotate(Math.PI*2*rand.nextDouble(), diff.x, diff.y, diff.z); transform.rotate(Math.PI*2*rand.nextDouble(), diff.x, diff.y, diff.z);
Vec3d center = vertices[max].add(vertices[min]).scale(.5); Vec3d center = vertices[max].add(vertices[min]).scale(.5);

View file

@ -309,9 +309,9 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im
EnumFacing side = facing.getOpposite(); EnumFacing side = facing.getOpposite();
double conRadius = con.cableType.getRenderDiameter() / 2; double conRadius = con.cableType.getRenderDiameter() / 2;
double length = relay?relayOffset:connOffset; double length = relay?relayOffset:connOffset;
return new Vec3d(.5 + ( length - conRadius) * side.getFrontOffsetX(), return new Vec3d(.5 + (length - conRadius) * side.getXOffset(),
.5 + (length - conRadius) * side.getFrontOffsetY(), .5 + (length - conRadius) * side.getYOffset(),
.5 + (length - conRadius) * side.getFrontOffsetZ()); .5 + (length - conRadius) * side.getZOffset());
} }
@Override @Override
@ -427,7 +427,7 @@ public class TileEntityIC2ConnectorTin extends TileEntityImmersiveConnectable im
@Override @Override
public void readCustomNBT(@Nonnull NBTTagCompound nbt, boolean descPacket) { public void readCustomNBT(@Nonnull NBTTagCompound nbt, boolean descPacket) {
super.readCustomNBT(nbt, descPacket); super.readCustomNBT(nbt, descPacket);
facing = EnumFacing.getFront(nbt.getInteger("facing")); facing = EnumFacing.byIndex(nbt.getInteger("facing"));
relay = nbt.getBoolean("relay"); relay = nbt.getBoolean("relay");
int version = nbt.getInteger("version"); int version = nbt.getInteger("version");
bufferToNet = nbt.getDouble("inBuffer"); bufferToNet = nbt.getDouble("inBuffer");

View file

@ -193,7 +193,7 @@ public class ClientEventHandler {
public static void renderWorldLastLow(RenderWorldLastEvent ev) { public static void renderWorldLastLow(RenderWorldLastEvent ev) {
if (shouldScreenshot) { if (shouldScreenshot) {
Minecraft mc = Minecraft.getMinecraft(); Minecraft mc = Minecraft.getMinecraft();
ITextComponent comp = ScreenShotHelper.saveScreenshot(mc.mcDataDir, mc.displayWidth, mc.displayHeight, mc.getFramebuffer());//TODO ITextComponent comp = ScreenShotHelper.saveScreenshot(mc.gameDir, mc.displayWidth, mc.displayHeight, mc.getFramebuffer());//TODO
mc.player.sendMessage(comp); mc.player.sendMessage(comp);
shouldScreenshot = false; shouldScreenshot = false;
} }

View file

@ -16,7 +16,6 @@ package malte0811.industrialwires.client;
import blusunrize.immersiveengineering.api.ManualHelper; import blusunrize.immersiveengineering.api.ManualHelper;
import blusunrize.immersiveengineering.api.ManualPageMultiblock; import blusunrize.immersiveengineering.api.ManualPageMultiblock;
import blusunrize.immersiveengineering.api.energy.wires.WireApi;
import blusunrize.immersiveengineering.client.ClientUtils; import blusunrize.immersiveengineering.client.ClientUtils;
import blusunrize.immersiveengineering.common.Config; import blusunrize.immersiveengineering.common.Config;
import blusunrize.immersiveengineering.common.util.Utils; import blusunrize.immersiveengineering.common.util.Utils;
@ -25,7 +24,6 @@ import blusunrize.lib.manual.ManualInstance;
import blusunrize.lib.manual.ManualPages; import blusunrize.lib.manual.ManualPages;
import blusunrize.lib.manual.ManualPages.PositionedItemStack; import blusunrize.lib.manual.ManualPages.PositionedItemStack;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenHashMap;
import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntMap;
@ -91,45 +89,6 @@ public class ClientProxy extends CommonProxy {
@Override @Override
public void preInit() { public void preInit() {
super.preInit(); super.preInit();
if (IndustrialWires.hasIC2) {
WireApi.registerConnectorForRender("ic2_conn_tin", new ResourceLocation("immersiveengineering:block/connector/connector_lv.obj"),
ImmutableMap.of("#immersiveengineering:blocks/connector_connector_lv",
IndustrialWires.MODID + ":blocks/ic2_conn_tin"));
WireApi.registerConnectorForRender("ic2_relay_tin", new ResourceLocation("immersiveengineering:block/connector/connector_lv.obj"),
ImmutableMap.of("#immersiveengineering:blocks/connector_connector_lv",
IndustrialWires.MODID + ":blocks/ic2_relay_tin"));
WireApi.registerConnectorForRender("ic2_conn_copper", new ResourceLocation("immersiveengineering:block/connector/connector_lv.obj"),
ImmutableMap.of("#immersiveengineering:blocks/connector_connector_lv",
IndustrialWires.MODID + ":blocks/ic2_conn_copper"));
WireApi.registerConnectorForRender("ic2_relay_copper", new ResourceLocation("immersiveengineering:block/connector/connector_lv.obj"),
ImmutableMap.of("#immersiveengineering:blocks/connector_connector_lv",
IndustrialWires.MODID + ":blocks/ic2_relay_copper"));
WireApi.registerConnectorForRender("ic2_conn_gold", new ResourceLocation("immersiveengineering:block/connector/connector_mv.obj"),
ImmutableMap.of("#immersiveengineering:blocks/connector_connector_mv",
IndustrialWires.MODID + ":blocks/ic2_conn_gold"));
WireApi.registerConnectorForRender("ic2_relay_gold", new ResourceLocation("immersiveengineering:block/connector/connector_mv.obj"),
ImmutableMap.of("#immersiveengineering:blocks/connector_connector_mv",
IndustrialWires.MODID + ":blocks/ic2_relay_gold"));
WireApi.registerConnectorForRender("ic2_conn_hv", new ResourceLocation("immersiveengineering:block/connector/connector_hv.obj"),
ImmutableMap.of("#immersiveengineering:blocks/connector_connector_hv",
IndustrialWires.MODID + ":blocks/ic2_conn_hv"));
WireApi.registerConnectorForRender("ic2_relay_hv", new ResourceLocation("immersiveengineering:block/connector/relay_hv.obj"), null);
WireApi.registerConnectorForRender("ic2_conn_glass", new ResourceLocation("immersiveengineering:block/connector/connector_hv.obj"),
ImmutableMap.of("#immersiveengineering:blocks/connector_connector_hv",
IndustrialWires.MODID + ":blocks/ic2_conn_glass"));
WireApi.registerConnectorForRender("ic2_relay_glass", new ResourceLocation("immersiveengineering:block/connector/relay_hv.obj"),
ImmutableMap.of("#immersiveengineering:blocks/connector_relay_hv",
IndustrialWires.MODID + ":blocks/ic2_relay_glass"));
}
WireApi.registerConnectorForRender("rs_panel_conn", new ResourceLocation("industrialwires:block/rs_panel_conn.obj"), null);
WireApi.registerConnectorForRender("empty", new ResourceLocation("builtin/generated"), null);
OBJLoader.INSTANCE.addDomain(IndustrialWires.MODID); OBJLoader.INSTANCE.addDomain(IndustrialWires.MODID);
ModelLoaderRegistry.registerLoader(new PanelModelLoader()); ModelLoaderRegistry.registerLoader(new PanelModelLoader());
ModelLoaderRegistry.registerLoader(new MBIOModelLoader()); ModelLoaderRegistry.registerLoader(new MBIOModelLoader());

View file

@ -309,7 +309,7 @@ public class GuiPanelCreator extends GuiContainer {
nbt.setInteger("type", MessageType.DISASSEMBLE.ordinal()); nbt.setInteger("type", MessageType.DISASSEMBLE.ordinal());
break; break;
} }
if (!nbt.hasNoTags()) { if (!nbt.isEmpty()) {
IndustrialWires.packetHandler.sendToServer(new MessageGUIInteract(container.tile, nbt)); IndustrialWires.packetHandler.sendToServer(new MessageGUIInteract(container.tile, nbt));
} }
} }

View file

@ -113,7 +113,7 @@ public class BakedMBIOModel implements IBakedModel {
float[] vec = new float[3]; float[] vec = new float[3];
for (int i = 0; i < EnumFacing.VALUES.length; i++) { for (int i = 0; i < EnumFacing.VALUES.length; i++) {
EnumFacing f = EnumFacing.VALUES[i]; EnumFacing f = EnumFacing.VALUES[i];
NORMALS[i] = new Vector3f(f.getFrontOffsetX(), f.getFrontOffsetY(), f.getFrontOffsetZ()); NORMALS[i] = new Vector3f(f.getXOffset(), f.getYOffset(), f.getZOffset());
int axis = f.getAxis().ordinal(); int axis = f.getAxis().ordinal();
vec[axis] = f.getAxisDirection()==EnumFacing.AxisDirection.POSITIVE?1.001F:-.001F; vec[axis] = f.getAxisDirection()==EnumFacing.AxisDirection.POSITIVE?1.001F:-.001F;
float x1 = f.getAxisDirection()==EnumFacing.AxisDirection.POSITIVE?offsetInner:1-offsetInner; float x1 = f.getAxisDirection()==EnumFacing.AxisDirection.POSITIVE?offsetInner:1-offsetInner;

View file

@ -50,8 +50,8 @@ public class MBIOModelLoader implements ICustomModelLoader {
} }
@Override @Override
public boolean accepts(@Nonnull ResourceLocation modelLocation) { public boolean accepts(@Nonnull ResourceLocation modelLocation) {
return IndustrialWires.MODID.equals(modelLocation.getResourceDomain()) return IndustrialWires.MODID.equals(modelLocation.getNamespace())
&& "models/block/mbio".equals(modelLocation.getResourcePath()); && "models/block/mbio".equals(modelLocation.getPath());
} }
@Nonnull @Nonnull

View file

@ -47,13 +47,13 @@ public class PanelModelLoader implements ICustomModelLoader {
@Override @Override
public boolean accepts(@Nonnull ResourceLocation modelLocation) { public boolean accepts(@Nonnull ResourceLocation modelLocation) {
return modelLocation.getResourcePath().contains(RESOURCE_BASE + RESOURCE_LOCATION); return modelLocation.getPath().contains(RESOURCE_BASE + RESOURCE_LOCATION);
} }
@Nonnull @Nonnull
@Override @Override
public IModel loadModel(@Nonnull ResourceLocation modelLocation) throws IOException { public IModel loadModel(@Nonnull ResourceLocation modelLocation) throws IOException {
String resourcePath = modelLocation.getResourcePath(); String resourcePath = modelLocation.getPath();
int pos = resourcePath.indexOf(RESOURCE_LOCATION); int pos = resourcePath.indexOf(RESOURCE_LOCATION);
if (pos >= 0) { if (pos >= 0) {
return new PanelModelBase(); return new PanelModelBase();

View file

@ -91,10 +91,10 @@ public class RawModelFontRenderer extends FontRenderer {
@Override @Override
public void onResourceManagerReload(IResourceManager resourceManager) { public void onResourceManagerReload(IResourceManager resourceManager) {
super.onResourceManagerReload(resourceManager); super.onResourceManagerReload(resourceManager);
String p = locationFontTexture.getResourcePath(); String p = locationFontTexture.getPath();
if (p.startsWith("textures/")) p = p.substring("textures/".length(), p.length()); if (p.startsWith("textures/")) p = p.substring("textures/".length(), p.length());
if (p.endsWith(".png")) p = p.substring(0, p.length() - ".png".length()); if (p.endsWith(".png")) p = p.substring(0, p.length() - ".png".length());
String f = locationFontTexture.getResourceDomain() + ":" + p; String f = locationFontTexture.getNamespace() + ":" + p;
sprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(f); sprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(f);
} }

View file

@ -52,14 +52,14 @@ public class TileRenderMarx extends TileEntitySpecialRenderer<TileEntityMarx> {
//draw firing spark gaps //draw firing spark gaps
Vec3i facing = te.facing.getDirectionVec(); Vec3i facing = te.facing.getDirectionVec();
Vec3d offset = new Vec3d(MiscUtils.offset(BlockPos.ORIGIN, te.facing, te.mirrored, 1, 1, 0)); Vec3d offset = new Vec3d(MiscUtils.offset(BlockPos.ORIGIN, te.facing, te.mirrored, 1, 1, 0));
offset = offset.addVector(-.5*oneSgn(offset.x), 0, -.5*oneSgn(offset.z)); offset = offset.add(-.5 * oneSgn(offset.x), 0, -.5 * oneSgn(offset.z));
final float pos = .3125F; final float pos = .3125F;
Vec3d gapDir = new Vec3d(facing.getZ()*(te.mirrored?-1:1), 1, facing.getX()*(te.mirrored?1:-1)); Vec3d gapDir = new Vec3d(facing.getZ()*(te.mirrored?-1:1), 1, facing.getX()*(te.mirrored?1:-1));
Vec3d up = new Vec3d(gapDir.x, -1, gapDir.z); Vec3d up = new Vec3d(gapDir.x, -1, gapDir.z);
Vec3d bottomGap = new Vec3d(offset.x+facing.getX()*pos+.5, offset.y+.75, offset.z+facing.getZ() * pos+.5); Vec3d bottomGap = new Vec3d(offset.x+facing.getX()*pos+.5, offset.y+.75, offset.z+facing.getZ() * pos+.5);
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
GlStateManager.translate(x + bottomGap.x, y + bottomGap.y, z + bottomGap.z); GlStateManager.translate(x + bottomGap.x, y + bottomGap.y, z + bottomGap.z);
bottomGap = bottomGap.addVector(te.getPos().getX(), te.getPos().getY(), te.getPos().getZ()); bottomGap = bottomGap.add(te.getPos().getX(), te.getPos().getY(), te.getPos().getZ());
for (int i = 0; i < te.getStageCount() - 1; i++) { for (int i = 0; i < te.getStageCount() - 1; i++) {
renderGap(i, facing, vb, tes, player, gapDir, up, bottomGap, te.mirrored); renderGap(i, facing, vb, tes, player, gapDir, up, bottomGap, te.mirrored);
} }
@ -85,7 +85,7 @@ public class TileRenderMarx extends TileEntitySpecialRenderer<TileEntityMarx> {
player = player.subtract(bottomGap.x, bottomGap.y+i, bottomGap.z); player = player.subtract(bottomGap.x, bottomGap.y+i, bottomGap.z);
double t = player.dotProduct(gapDir)/2; double t = player.dotProduct(gapDir)/2;
Vec3d lineToPlayer = gapDir.scale(t).subtract(player); Vec3d lineToPlayer = gapDir.scale(t).subtract(player);
double angleRad = Math.acos(up.dotProduct(lineToPlayer)/(up.lengthVector()*lineToPlayer.lengthVector())); double angleRad = Math.acos(up.dotProduct(lineToPlayer) / (up.length() * lineToPlayer.length()));
angleRad *= Math.signum(lineToPlayer.dotProduct(new Vec3d(facing))); angleRad *= Math.signum(lineToPlayer.dotProduct(new Vec3d(facing)));
float angle = (float) (Math.toDegrees(angleRad)); float angle = (float) (Math.toDegrees(angleRad));
if (facing.getZ()<0) { if (facing.getZ()<0) {

View file

@ -304,7 +304,7 @@ public final class PanelUtils {
if (rs && data.hasKey(RS_CHANNEL)) { if (rs && data.hasKey(RS_CHANNEL)) {
EnumDyeColor channColor = EnumDyeColor.byMetadata(data.getInteger(RS_CHANNEL)); EnumDyeColor channColor = EnumDyeColor.byMetadata(data.getInteger(RS_CHANNEL));
String hexCol = Integer.toHexString(channColor.getColorValue()); String hexCol = Integer.toHexString(channColor.getColorValue());
list.add(I18n.format("desc.immersiveengineering.info.redstoneChannel", "<hexcol=" + hexCol + ":" + channColor.getUnlocalizedName() + ">")); list.add(I18n.format("desc.immersiveengineering.info.redstoneChannel", "<hexcol=" + hexCol + ":" + channColor.getTranslationKey() + ">"));
} }
if (rs && data.hasKey(RS_ID)) { if (rs && data.hasKey(RS_ID)) {
list.add(I18n.format(IndustrialWires.MODID + ".tooltip.rsId", data.getInteger(RS_ID))); list.add(I18n.format(IndustrialWires.MODID + ".tooltip.rsId", data.getInteger(RS_ID)));

View file

@ -39,8 +39,8 @@ public class EntityBrokenPart extends Entity {
public static final DataSerializer<ResourceLocation> RES_LOC_SERIALIZER = new DataSerializer<ResourceLocation>() { public static final DataSerializer<ResourceLocation> RES_LOC_SERIALIZER = new DataSerializer<ResourceLocation>() {
@Override @Override
public void write(@Nonnull PacketBuffer buf, @Nonnull ResourceLocation value) { public void write(@Nonnull PacketBuffer buf, @Nonnull ResourceLocation value) {
buf.writeString(value.getResourceDomain()); buf.writeString(value.getNamespace());
buf.writeString(value.getResourcePath()); buf.writeString(value.getPath());
} }
@Nonnull @Nonnull
@ -59,7 +59,7 @@ public class EntityBrokenPart extends Entity {
@Nonnull @Nonnull
@Override @Override
public ResourceLocation copyValue(@Nonnull ResourceLocation value) { public ResourceLocation copyValue(@Nonnull ResourceLocation value) {
return new ResourceLocation(value.getResourceDomain(), value.getResourcePath()); return new ResourceLocation(value.getNamespace(), value.getPath());
} }
}; };
public static DataParameter<ResourceLocation> MARKER_TEXTURE; public static DataParameter<ResourceLocation> MARKER_TEXTURE;

View file

@ -47,7 +47,7 @@ public class ItemIC2Coil extends Item implements IWireCoil {
public final static String NAME = "ic2_wire_coil"; public final static String NAME = "ic2_wire_coil";
public ItemIC2Coil() { public ItemIC2Coil() {
setUnlocalizedName(IndustrialWires.MODID + "."+NAME); setTranslationKey(IndustrialWires.MODID + "." + NAME);
setHasSubtypes(true); setHasSubtypes(true);
this.setCreativeTab(IndustrialWires.creativeTab); this.setCreativeTab(IndustrialWires.creativeTab);
setMaxStackSize(1); setMaxStackSize(1);
@ -67,10 +67,11 @@ public class ItemIC2Coil extends Item implements IWireCoil {
} }
} }
@Nonnull @Nonnull
@Override @Override
public String getUnlocalizedName(ItemStack stack) { public String getTranslationKey(ItemStack stack) {
return this.getUnlocalizedName() + "." + subNames[stack.getMetadata()]; return this.getTranslationKey() + "." + subNames[stack.getMetadata()];
} }
@Override @Override

View file

@ -42,7 +42,7 @@ public class ItemKey extends Item implements INetGUIItem {
public static final String ITEM_NAME = "key"; public static final String ITEM_NAME = "key";
public ItemKey() { public ItemKey() {
setUnlocalizedName(IndustrialWires.MODID + "."+ITEM_NAME); setTranslationKey(IndustrialWires.MODID + "." + ITEM_NAME);
setHasSubtypes(true); setHasSubtypes(true);
this.setCreativeTab(IndustrialWires.creativeTab); this.setCreativeTab(IndustrialWires.creativeTab);
setMaxStackSize(64); setMaxStackSize(64);
@ -83,7 +83,7 @@ public class ItemKey extends Item implements INetGUIItem {
@Nonnull @Nonnull
@Override @Override
public String getUnlocalizedName(ItemStack stack) { public String getTranslationKey(ItemStack stack) {
return "item."+IndustrialWires.MODID+".key."+types[stack.getMetadata()]; return "item."+IndustrialWires.MODID+".key."+types[stack.getMetadata()];
} }

View file

@ -58,7 +58,7 @@ public class ItemPanelComponent extends Item implements INetGUIItem {
public static final String NAME = "panel_component"; public static final String NAME = "panel_component";
public ItemPanelComponent() { public ItemPanelComponent() {
setUnlocalizedName(IndustrialWires.MODID + "."+NAME); setTranslationKey(IndustrialWires.MODID + "." + NAME);
setHasSubtypes(true); setHasSubtypes(true);
this.setCreativeTab(IndustrialWires.creativeTab); this.setCreativeTab(IndustrialWires.creativeTab);
setMaxStackSize(64); setMaxStackSize(64);
@ -85,10 +85,11 @@ public class ItemPanelComponent extends Item implements INetGUIItem {
return ClientProxy.itemFont;//TODO non-core-IE solution? return ClientProxy.itemFont;//TODO non-core-IE solution?
} }
@Nonnull @Nonnull
@Override @Override
public String getUnlocalizedName(ItemStack stack) { public String getTranslationKey(ItemStack stack) {
return this.getUnlocalizedName() + "." + types[stack.getMetadata()]; return this.getTranslationKey() + "." + types[stack.getMetadata()];
} }
@Override @Override

View file

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

View file

@ -88,7 +88,7 @@ public class LocalSidedWorld {
public Vec3d getRealPos(Vec3d relative) { public Vec3d getRealPos(Vec3d relative) {
return MiscUtils.offset(new Vec3d(origin.getX()+.5, origin.getY()+.5, origin.getZ()+.5), facing, mirror, return MiscUtils.offset(new Vec3d(origin.getX()+.5, origin.getY()+.5, origin.getZ()+.5), facing, mirror,
relative.addVector(.5, .5, .5)); relative.add(.5, .5, .5));
} }
public Vec3d getRealDirection(Vec3d dir) { public Vec3d getRealDirection(Vec3d dir) {
@ -100,14 +100,14 @@ public class LocalSidedWorld {
return f; return f;
} }
//+6 because getHorizontal uses abs(input%3). No idea why. //+6 because getHorizontal uses abs(input%3). No idea why.
return EnumFacing.getHorizontal(f.getHorizontalIndex()-facing.getHorizontalIndex()+6); return EnumFacing.byHorizontalIndex(f.getHorizontalIndex() - facing.getHorizontalIndex() + 6);
} }
public EnumFacing transformedToReal(@Nullable EnumFacing f) { public EnumFacing transformedToReal(@Nullable EnumFacing f) {
if (f==null||f.getAxis()== EnumFacing.Axis.Y) { if (f==null||f.getAxis()== EnumFacing.Axis.Y) {
return f; return f;
} }
return EnumFacing.getHorizontal(f.getHorizontalIndex()+facing.getHorizontalIndex()+2); return EnumFacing.byHorizontalIndex(f.getHorizontalIndex() + facing.getHorizontalIndex() + 2);
} }
//Getters+Setters //Getters+Setters

View file

@ -88,14 +88,14 @@ public final class MiscUtils {
if (mirror) { if (mirror) {
right *= -1; right *= -1;
} }
return offset(offset(p, f, forward), f.rotateY(), right).addVector(0, up, 0); return offset(offset(p, f, forward), f.rotateY(), right).add(0, up, 0);
} }
public static Vec3d offset(Vec3d in, EnumFacing f, double amount) { public static Vec3d offset(Vec3d in, EnumFacing f, double amount) {
if (amount==0) { if (amount==0) {
return in; return in;
} }
return in.addVector(f.getFrontOffsetX()*amount, f.getFrontOffsetY()*amount, f.getFrontOffsetZ()*amount); return in.add(f.getXOffset() * amount, f.getYOffset() * amount, f.getZOffset() * amount);
} }
/** /**

View file

@ -53,7 +53,13 @@
}, },
"type": { "type": {
"rs_wire": { "rs_wire": {
"model": "immersiveengineering:smartmodel/conn_rs_panel_conn" "model": "immersiveengineering:smartmodel/connector",
"custom": {
"base": "industrialwires:block/rs_panel_conn.obj",
"layers": [
"SOLID"
]
}
}, },
"top": { "top": {
"model": "industrialwires:smartmodel/panel" "model": "industrialwires:smartmodel/panel"

View file

@ -77,7 +77,11 @@
"model": "builtin/generated" "model": "builtin/generated"
}, },
"connector": { "connector": {
"model": "immersiveengineering:smartmodel/conn_empty" "model": "immersiveengineering:smartmodel/connector",
"custom": {
"base": "builtin/generated",
"layers": []
}
} }
}, },
"boolean0": "boolean0":