rendering improvements, add clear lens too while at it

This commit is contained in:
asiekierka 2015-11-07 10:49:02 +01:00
parent 8377eb94f7
commit 7e9db9486e
8 changed files with 39 additions and 27 deletions

View file

@ -60,6 +60,8 @@ chat.pipe.power.iron.level.320=High
chat.pipe.power.iron.level.640=Very High
chat.pipe.power.iron.level.1280=Full Capacity
color.clear=Clear
color.black=Black
color.blue=Blue
color.brown=Brown

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

View file

@ -22,6 +22,7 @@ public class LensFilterHandler {
for (ForgeDirection dir : event.destinations) {
boolean hasFilter = false;
boolean hasLens = false;
int sideColor = -1;
int sideLensColor = -1;
@ -33,6 +34,7 @@ public class LensFilterHandler {
hasFilter = true;
sideColor = ((LensPluggable) pluggable).color;
} else {
hasLens = true;
sideLensColor = ((LensPluggable) pluggable).color;
}
}
@ -47,7 +49,7 @@ public class LensFilterHandler {
if (hasFilter && otherColor != sideColor) {
// Filter colors conflict - the side is unpassable
continue;
} else if (sideLensColor >= 0) {
} else if (hasLens) {
// The closer lens color differs from the further away filter color - the side is unpassable OR treated as colorless
if (sideLensColor == otherColor) {
hasFilter = false;

View file

@ -138,6 +138,7 @@ public class PipeIconProvider implements IIconProvider {
PipeStainedOverlay("pipeStainedOverlay"),
PipeLens("pipeLens"),
PipeFilter("pipeFilter"),
PipeLensClearOverlay("pipeLensClearOverlay"),
PipeLensOverlay("pipeLensOverlay"),
PipePlug("pipePlug"),
//

View file

@ -42,10 +42,12 @@ public final class TransportSiliconRecipes {
BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:filter:" + i, 10000, new ItemStack(BuildCraftTransport.lensItem, 2, i + 16),
ColorUtils.getOreDictionaryName(15 - i), "blockGlass", Blocks.iron_bars);
}
}
BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:filter:16", 10000, new ItemStack(BuildCraftTransport.lensItem, 2, 32),
"blockGlass", Blocks.iron_bars);
BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:lens:16", 10000, new ItemStack(BuildCraftTransport.lensItem, 2, 32),
"blockGlass");
BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:filter:16", 10000, new ItemStack(BuildCraftTransport.lensItem, 2, 33),
"blockGlass", Blocks.iron_bars);
}
// PIPE WIRE
if (Utils.isRegistered(PipeWire.item)) {

View file

@ -38,16 +38,14 @@ public class ItemLens extends ItemBuildCraft implements IPipePluggableItem {
@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamageForRenderPass(int meta, int pass) {
if (meta == 32) {
return icons[2];
switch (meta) {
case 32:
return pass == 0 ? icons[3] : icons[0];
case 33:
return pass == 0 ? icons[3] : icons[2];
default:
return icons[meta >= 16 ? (1 + (pass & 1)) : (1 - (pass & 1))];
}
return icons[meta >= 16 ? (1 + (pass & 1)) : (1 - (pass & 1))];
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderPasses(int metadata) {
return metadata == 32 ? 1 : 2;
}
@Override
@ -63,7 +61,7 @@ public class ItemLens extends ItemBuildCraft implements IPipePluggableItem {
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass) {
if (stack.getItemDamage() == 32) {
if (stack.getItemDamage() >= 32) {
return 16777215;
}
return pass == 0 ? ColorUtils.getRGBColor(getDye(stack)) : 16777215;
@ -71,8 +69,8 @@ public class ItemLens extends ItemBuildCraft implements IPipePluggableItem {
@Override
public String getItemStackDisplayName(ItemStack itemstack) {
if (itemstack.getItemDamage() == 32) {
return StringUtils.localize("item.Filter.name") + " (" + StringUtils.localize("color.clear") + ")";
if (itemstack.getItemDamage() >= 32) {
return StringUtils.localize(itemstack.getItemDamage() == 33 ? "item.Filter.name" : "item.Lens.name") + " (" + StringUtils.localize("color.clear") + ")";
} else {
return StringUtils.localize(itemstack.getItemDamage() >= 16 ? "item.Filter.name" : "item.Lens.name") + " (" + StringUtils.localize("color." + ColorUtils.getName(getDye(itemstack))) + ")";
}
@ -85,7 +83,7 @@ public class ItemLens extends ItemBuildCraft implements IPipePluggableItem {
@Override
public String[] getIconNames() {
return new String[]{"lens/lensFrame", "lens/transparent", "lens/filterFrame"};
return new String[]{"lens/lensFrame", "lens/transparent", "lens/filterFrame", "lens/clear"};
}
@ -93,7 +91,7 @@ public class ItemLens extends ItemBuildCraft implements IPipePluggableItem {
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List itemList) {
for (int i = 0; i <= 32; i++) {
for (int i = 0; i < 34; i++) {
itemList.add(new ItemStack(item, 1, i));
}
}

View file

@ -53,9 +53,6 @@ public class LensPluggable extends PipePluggable {
if (renderPass == 1) {
int color = ((LensPluggable) pipePluggable).color;
if (color < 0) {
return;
}
blockStateMachine.setRenderMask(1 << side.ordinal() | (1 << (side.ordinal() ^ 1)));
@ -63,8 +60,13 @@ public class LensPluggable extends PipePluggable {
zeroState[i][0] += zFightOffset;
zeroState[i][1] -= zFightOffset;
}
blockStateMachine.getTextureState().set(BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.TYPE.PipeLensOverlay.ordinal()));
((FakeBlock) blockStateMachine).setColor(ColorUtils.getRGBColor(15 - color));
if (color == -1) {
blockStateMachine.getTextureState().set(BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.TYPE.PipeLensClearOverlay.ordinal()));
} else {
blockStateMachine.getTextureState().set(BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.TYPE.PipeLensOverlay.ordinal()));
((FakeBlock) blockStateMachine).setColor(ColorUtils.getRGBColor(15 - color));
}
blockStateMachine.setRenderAllSides();
} else {
@ -92,7 +94,8 @@ public class LensPluggable extends PipePluggable {
public LensPluggable(ItemStack stack) {
color = stack.getItemDamage() & 15;
isFilter = stack.getItemDamage() >= 16;
if (isFilter && stack.getItemDamage() == 32) {
if (stack.getItemDamage() >= 32) {
isFilter = stack.getItemDamage() == 33;
color = -1;
}
}
@ -112,8 +115,8 @@ public class LensPluggable extends PipePluggable {
@Override
public ItemStack[] getDropItems(IPipeTile pipe) {
int meta = color | (isFilter ? 16 : 0);
if (isFilter && color == -1) {
meta = 32;
if (color == -1) {
meta = isFilter ? 33 : 32;
}
return new ItemStack[]{new ItemStack(BuildCraftTransport.lensItem, 1, meta)};
@ -179,7 +182,11 @@ public class LensPluggable extends PipePluggable {
private void color(TravelingItem item) {
if ((item.toCenter && item.input.getOpposite() == side)
|| (!item.toCenter && item.output == side)) {
item.color = EnumColor.fromId(color);
if (color == -1) {
item.color = null;
} else {
item.color = EnumColor.fromId(color);
}
}
}