Config to only render routing lines while an INodeRenderer is held
Current INodeRenderer's are the Node Router and all Routing Nodes
This commit is contained in:
parent
507d41111d
commit
3f8cccf056
|
@ -132,8 +132,12 @@ public class ConfigHandler
|
||||||
public static boolean vanillaPotionHealthBoostEnabled;
|
public static boolean vanillaPotionHealthBoostEnabled;
|
||||||
public static boolean vanillaPotionAbsorptionEnabled;
|
public static boolean vanillaPotionAbsorptionEnabled;
|
||||||
|
|
||||||
|
// General
|
||||||
public static int sacrificialPackConversion;
|
public static int sacrificialPackConversion;
|
||||||
|
|
||||||
|
// Client
|
||||||
|
public static boolean alwaysRenderRoutingLines;
|
||||||
|
|
||||||
// Compat
|
// Compat
|
||||||
public static int wailaAltarDisplayMode;
|
public static int wailaAltarDisplayMode;
|
||||||
public static boolean thaumcraftGogglesUpgrade;
|
public static boolean thaumcraftGogglesUpgrade;
|
||||||
|
@ -273,6 +277,10 @@ public class ConfigHandler
|
||||||
BloodMagicAPI.setLoggingEnabled(config.getBoolean("enableLogging", category, true, "Allows logging information to the console. Fatal errors will bypass this"));
|
BloodMagicAPI.setLoggingEnabled(config.getBoolean("enableLogging", category, true, "Allows logging information to the console. Fatal errors will bypass this"));
|
||||||
sacrificialPackConversion = config.getInt("sacrificialPackConversion", category, 20, 0, 100, "Base multiplier for the Coat of Arms. DamageDealt * sacrificialPackConversion");
|
sacrificialPackConversion = config.getInt("sacrificialPackConversion", category, 20, 0, 100, "Base multiplier for the Coat of Arms. DamageDealt * sacrificialPackConversion");
|
||||||
|
|
||||||
|
category = "Client";
|
||||||
|
config.addCustomCategoryComment(category, "Client only settings");
|
||||||
|
alwaysRenderRoutingLines = config.getBoolean("alwaysRenderRoutingLines", category, false, "Always renders the beams between routing nodes. If false, only renders while a Node Router is being held.");
|
||||||
|
|
||||||
category = "Compatibility";
|
category = "Compatibility";
|
||||||
config.addCustomCategoryComment(category, "Compatibility settings");
|
config.addCustomCategoryComment(category, "Compatibility settings");
|
||||||
wailaAltarDisplayMode = config.getInt("wailaAltarDisplayMode", category + ".waila", 1, 0, 2, "The mode for the Waila display on Blood Altars.\n0 - Always display information\n1 - Only display when Divination/Seer sigil is in hand.\n2 - Only display when Divination/Seer sigil is in inventory");
|
wailaAltarDisplayMode = config.getInt("wailaAltarDisplayMode", category + ".waila", 1, 0, 2, "The mode for the Waila display on Blood Altars.\n0 - Always display information\n1 - Only display when Divination/Seer sigil is in hand.\n2 - Only display when Divination/Seer sigil is in inventory");
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
package WayofTime.bloodmagic.api.iface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Held items that implement this will cause the beams between
|
||||||
|
* routing nodes to render.
|
||||||
|
*/
|
||||||
|
public interface INodeRenderer
|
||||||
|
{
|
||||||
|
}
|
|
@ -26,6 +26,7 @@ public class ConfigGui extends GuiConfig
|
||||||
// adds sections declared in ConfigHandler. toLowerCase() is used
|
// adds sections declared in ConfigHandler. toLowerCase() is used
|
||||||
// because the configuration class automatically does this, so must we.
|
// because the configuration class automatically does this, so must we.
|
||||||
list.add(new ConfigElement(ConfigHandler.getConfig().getCategory("Potions".toLowerCase())));
|
list.add(new ConfigElement(ConfigHandler.getConfig().getCategory("Potions".toLowerCase())));
|
||||||
|
list.add(new ConfigElement(ConfigHandler.getConfig().getCategory("Client".toLowerCase())));
|
||||||
list.add(new ConfigElement(ConfigHandler.getConfig().getCategory("Compatibility".toLowerCase())));
|
list.add(new ConfigElement(ConfigHandler.getConfig().getCategory("Compatibility".toLowerCase())));
|
||||||
list.add(new ConfigElement(ConfigHandler.getConfig().getCategory("Teleposer Blacklist".toLowerCase())));
|
list.add(new ConfigElement(ConfigHandler.getConfig().getCategory("Teleposer Blacklist".toLowerCase())));
|
||||||
list.add(new ConfigElement(ConfigHandler.getConfig().getCategory("Well of Suffering Blacklist".toLowerCase())));
|
list.add(new ConfigElement(ConfigHandler.getConfig().getCategory("Well of Suffering Blacklist".toLowerCase())));
|
||||||
|
|
|
@ -2,6 +2,10 @@ package WayofTime.bloodmagic.client.render;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.ConfigHandler;
|
||||||
|
import WayofTime.bloodmagic.api.iface.INodeRenderer;
|
||||||
|
import WayofTime.bloodmagic.registry.ModItems;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
import net.minecraft.client.renderer.WorldRenderer;
|
import net.minecraft.client.renderer.WorldRenderer;
|
||||||
|
@ -18,93 +22,96 @@ import WayofTime.bloodmagic.tile.routing.TileRoutingNode;
|
||||||
|
|
||||||
public class RenderItemRoutingNode extends TileEntitySpecialRenderer<TileRoutingNode>
|
public class RenderItemRoutingNode extends TileEntitySpecialRenderer<TileRoutingNode>
|
||||||
{
|
{
|
||||||
private static final ResourceLocation field_110629_a = new ResourceLocation("textures/entity/beacon_beam.png");
|
private static final ResourceLocation beamTexture = new ResourceLocation("textures/entity/beacon_beam.png");
|
||||||
|
private static final Minecraft mc = Minecraft.getMinecraft();
|
||||||
|
|
||||||
// private static final ResourceLocation test = new ResourceLocation("luminescence:textures/models/InputMirror.png");
|
// private static final ResourceLocation test = new ResourceLocation("luminescence:textures/models/InputMirror.png");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderTileEntityAt(TileRoutingNode tileNode, double x, double y, double z, float partialTicks, int destroyStage)
|
public void renderTileEntityAt(TileRoutingNode tileNode, double x, double y, double z, float partialTicks, int destroyStage)
|
||||||
{
|
{
|
||||||
List<BlockPos> connectionList = tileNode.getConnected();
|
if ((mc.thePlayer.getHeldItem() != null && mc.thePlayer.getHeldItem().getItem() instanceof INodeRenderer) || ConfigHandler.alwaysRenderRoutingLines)
|
||||||
for (BlockPos wantedPos : connectionList)
|
|
||||||
{
|
{
|
||||||
BlockPos offsetPos = wantedPos.subtract(tileNode.getPos());
|
List<BlockPos> connectionList = tileNode.getConnected();
|
||||||
|
for (BlockPos wantedPos : connectionList) {
|
||||||
|
BlockPos offsetPos = wantedPos.subtract(tileNode.getPos());
|
||||||
|
|
||||||
//The beam renders towards the east by default.
|
//The beam renders towards the east by default.
|
||||||
|
|
||||||
int xd = offsetPos.getX();
|
int xd = offsetPos.getX();
|
||||||
int yd = offsetPos.getY();
|
int yd = offsetPos.getY();
|
||||||
int zd = offsetPos.getZ();
|
int zd = offsetPos.getZ();
|
||||||
double distance = Math.sqrt(xd * xd + yd * yd + zd * zd);
|
double distance = Math.sqrt(xd * xd + yd * yd + zd * zd);
|
||||||
double subLength = MathHelper.sqrt_double(xd * xd + zd * zd);
|
double subLength = MathHelper.sqrt_double(xd * xd + zd * zd);
|
||||||
float rotYaw = -((float) (Math.atan2(zd, xd) * 180.0D / Math.PI));
|
float rotYaw = -((float) (Math.atan2(zd, xd) * 180.0D / Math.PI));
|
||||||
float rotPitch = ((float) (Math.atan2(yd, subLength) * 180.0D / Math.PI));
|
float rotPitch = ((float) (Math.atan2(yd, subLength) * 180.0D / Math.PI));
|
||||||
|
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
float f1 = 1.0f;
|
float f1 = 1.0f;
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
WorldRenderer wr = tessellator.getWorldRenderer();
|
WorldRenderer wr = tessellator.getWorldRenderer();
|
||||||
this.bindTexture(field_110629_a);
|
this.bindTexture(beamTexture);
|
||||||
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F);
|
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F);
|
||||||
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F);
|
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F);
|
||||||
GlStateManager.disableLighting();
|
GlStateManager.disableLighting();
|
||||||
GlStateManager.disableCull();
|
GlStateManager.disableCull();
|
||||||
float f2 = 0;
|
float f2 = 0;
|
||||||
float f3 = -f2 * 0.2F - (float) MathHelper.floor_float(-f2 * 0.1F);
|
float f3 = -f2 * 0.2F - (float) MathHelper.floor_float(-f2 * 0.1F);
|
||||||
GlStateManager.enableBlend();
|
GlStateManager.enableBlend();
|
||||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
double width = 0.06;
|
double width = 0.06;
|
||||||
|
|
||||||
float test = (tileNode.getWorld().getTotalWorldTime() + partialTicks) / 5f;
|
float test = (tileNode.getWorld().getTotalWorldTime() + partialTicks) / 5f;
|
||||||
|
|
||||||
double d18 = -width / 2;
|
double d18 = -width / 2;
|
||||||
double d19 = -width / 2;
|
double d19 = -width / 2;
|
||||||
double d20 = width / 2;
|
double d20 = width / 2;
|
||||||
double d21 = -width / 2;
|
double d21 = -width / 2;
|
||||||
double d22 = -width / 2;
|
double d22 = -width / 2;
|
||||||
double d23 = width / 2;
|
double d23 = width / 2;
|
||||||
double d24 = width / 2;
|
double d24 = width / 2;
|
||||||
double d25 = width / 2;
|
double d25 = width / 2;
|
||||||
double d26 = (double) (distance * f1);
|
double d26 = (double) (distance * f1);
|
||||||
double d27 = 0.0D;
|
double d27 = 0.0D;
|
||||||
double d28 = 1.0D;
|
double d28 = 1.0D;
|
||||||
double d29 = (double) (f3) + test;
|
double d29 = (double) (f3) + test;
|
||||||
double d30 = (double) (distance * f1) + d29;
|
double d30 = (double) (distance * f1) + d29;
|
||||||
|
|
||||||
GlStateManager.translate(x + 0.5, y + 0.5, z + 0.5);
|
GlStateManager.translate(x + 0.5, y + 0.5, z + 0.5);
|
||||||
|
|
||||||
GlStateManager.rotate(rotYaw, 0, 1, 0);
|
GlStateManager.rotate(rotYaw, 0, 1, 0);
|
||||||
GlStateManager.rotate(rotPitch, 0, 0, 1);
|
GlStateManager.rotate(rotPitch, 0, 0, 1);
|
||||||
|
|
||||||
// tessellator.setBrightness(240);
|
// tessellator.setBrightness(240);
|
||||||
// float s = 1F / 16F;
|
// float s = 1F / 16F;
|
||||||
wr.begin(7, DefaultVertexFormats.POSITION_TEX);
|
wr.begin(7, DefaultVertexFormats.POSITION_TEX);
|
||||||
// tessellator.setColorRGBA(255, 255, 255, 100);
|
// tessellator.setColorRGBA(255, 255, 255, 100);
|
||||||
wr.pos(d26, d18, d19).tex(d28, d30).endVertex();
|
wr.pos(d26, d18, d19).tex(d28, d30).endVertex();
|
||||||
wr.pos(0, d18, d19).tex(d28, d29).endVertex();
|
wr.pos(0, d18, d19).tex(d28, d29).endVertex();
|
||||||
wr.pos(0, d20, d21).tex(d27, d29).endVertex();
|
wr.pos(0, d20, d21).tex(d27, d29).endVertex();
|
||||||
wr.pos(d26, d20, d21).tex(d27, d30).endVertex();
|
wr.pos(d26, d20, d21).tex(d27, d30).endVertex();
|
||||||
wr.pos(d26, d24, d25).tex(d28, d30).endVertex();
|
wr.pos(d26, d24, d25).tex(d28, d30).endVertex();
|
||||||
wr.pos(0, d24, d25).tex(d28, d29).endVertex();
|
wr.pos(0, d24, d25).tex(d28, d29).endVertex();
|
||||||
wr.pos(0, d22, d23).tex(d27, d29).endVertex();
|
wr.pos(0, d22, d23).tex(d27, d29).endVertex();
|
||||||
wr.pos(d26, d22, d23).tex(d27, d30).endVertex();
|
wr.pos(d26, d22, d23).tex(d27, d30).endVertex();
|
||||||
wr.pos(d26, d20, d21).tex(d28, d30).endVertex();
|
wr.pos(d26, d20, d21).tex(d28, d30).endVertex();
|
||||||
wr.pos(0, d20, d21).tex(d28, d29).endVertex();
|
wr.pos(0, d20, d21).tex(d28, d29).endVertex();
|
||||||
wr.pos(0, d24, d25).tex(d27, d29).endVertex();
|
wr.pos(0, d24, d25).tex(d27, d29).endVertex();
|
||||||
wr.pos(d26, d24, d25).tex(d27, d30).endVertex();
|
wr.pos(d26, d24, d25).tex(d27, d30).endVertex();
|
||||||
wr.pos(d26, d22, d23).tex(d28, d30).endVertex();
|
wr.pos(d26, d22, d23).tex(d28, d30).endVertex();
|
||||||
wr.pos(0, d22, d23).tex(d28, d29).endVertex();
|
wr.pos(0, d22, d23).tex(d28, d29).endVertex();
|
||||||
wr.pos(0, d18, d19).tex(d27, d29).endVertex();
|
wr.pos(0, d18, d19).tex(d27, d29).endVertex();
|
||||||
wr.pos(d26, d18, d19).tex(d27, d30).endVertex();
|
wr.pos(d26, d18, d19).tex(d27, d30).endVertex();
|
||||||
|
|
||||||
ShaderHelper.useShader(ShaderHelper.psiBar, (int) tileNode.getWorld().getTotalWorldTime());
|
ShaderHelper.useShader(ShaderHelper.psiBar, (int) tileNode.getWorld().getTotalWorldTime());
|
||||||
tessellator.draw();
|
tessellator.draw();
|
||||||
ShaderHelper.releaseShader();
|
ShaderHelper.releaseShader();
|
||||||
|
|
||||||
GlStateManager.enableLighting();
|
GlStateManager.enableLighting();
|
||||||
GlStateManager.enableTexture2D();
|
GlStateManager.enableTexture2D();
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
package WayofTime.bloodmagic.item.block;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.api.iface.INodeRenderer;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
|
|
||||||
|
public class ItemBlockRoutingNode extends ItemBlock implements INodeRenderer
|
||||||
|
{
|
||||||
|
public ItemBlockRoutingNode(Block block)
|
||||||
|
{
|
||||||
|
super(block);
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,7 @@ package WayofTime.bloodmagic.item.routing;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.api.iface.INodeRenderer;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -21,7 +22,7 @@ import WayofTime.bloodmagic.routing.IRoutingNode;
|
||||||
import WayofTime.bloodmagic.util.ChatUtil;
|
import WayofTime.bloodmagic.util.ChatUtil;
|
||||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||||
|
|
||||||
public class ItemNodeRouter extends Item
|
public class ItemNodeRouter extends Item implements INodeRenderer
|
||||||
{
|
{
|
||||||
public ItemNodeRouter()
|
public ItemNodeRouter()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package WayofTime.bloodmagic.registry;
|
package WayofTime.bloodmagic.registry;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.item.block.*;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
|
@ -35,15 +36,6 @@ import WayofTime.bloodmagic.block.BlockRitualStone;
|
||||||
import WayofTime.bloodmagic.block.BlockSoulForge;
|
import WayofTime.bloodmagic.block.BlockSoulForge;
|
||||||
import WayofTime.bloodmagic.block.BlockSpectral;
|
import WayofTime.bloodmagic.block.BlockSpectral;
|
||||||
import WayofTime.bloodmagic.block.BlockTeleposer;
|
import WayofTime.bloodmagic.block.BlockTeleposer;
|
||||||
import WayofTime.bloodmagic.item.block.ItemBlockBloodRune;
|
|
||||||
import WayofTime.bloodmagic.item.block.ItemBlockBloodStoneBrick;
|
|
||||||
import WayofTime.bloodmagic.item.block.ItemBlockBloodTank;
|
|
||||||
import WayofTime.bloodmagic.item.block.ItemBlockCrystal;
|
|
||||||
import WayofTime.bloodmagic.item.block.ItemBlockDemonCrystal;
|
|
||||||
import WayofTime.bloodmagic.item.block.ItemBlockPath;
|
|
||||||
import WayofTime.bloodmagic.item.block.ItemBlockPedestal;
|
|
||||||
import WayofTime.bloodmagic.item.block.ItemBlockRitualController;
|
|
||||||
import WayofTime.bloodmagic.item.block.ItemBlockRitualStone;
|
|
||||||
import WayofTime.bloodmagic.tile.TileAlchemyArray;
|
import WayofTime.bloodmagic.tile.TileAlchemyArray;
|
||||||
import WayofTime.bloodmagic.tile.TileAltar;
|
import WayofTime.bloodmagic.tile.TileAltar;
|
||||||
import WayofTime.bloodmagic.tile.TileBloodTank;
|
import WayofTime.bloodmagic.tile.TileBloodTank;
|
||||||
|
@ -119,10 +111,10 @@ public class ModBlocks
|
||||||
soulForge = registerBlock(new BlockSoulForge());
|
soulForge = registerBlock(new BlockSoulForge());
|
||||||
crystal = registerBlock(new BlockCrystal(), ItemBlockCrystal.class);
|
crystal = registerBlock(new BlockCrystal(), ItemBlockCrystal.class);
|
||||||
bloodStoneBrick = registerBlock(new BlockBloodStoneBrick(), ItemBlockBloodStoneBrick.class);
|
bloodStoneBrick = registerBlock(new BlockBloodStoneBrick(), ItemBlockBloodStoneBrick.class);
|
||||||
masterRoutingNode = registerBlock(new BlockMasterRoutingNode());
|
masterRoutingNode = registerBlock(new BlockMasterRoutingNode(), ItemBlockRoutingNode.class);
|
||||||
inputRoutingNode = registerBlock(new BlockInputRoutingNode());
|
inputRoutingNode = registerBlock(new BlockInputRoutingNode(), ItemBlockRoutingNode.class);
|
||||||
outputRoutingNode = registerBlock(new BlockOutputRoutingNode());
|
outputRoutingNode = registerBlock(new BlockOutputRoutingNode(), ItemBlockRoutingNode.class);
|
||||||
itemRoutingNode = registerBlock(new BlockItemRoutingNode());
|
itemRoutingNode = registerBlock(new BlockItemRoutingNode(), ItemBlockRoutingNode.class);
|
||||||
incenseAltar = registerBlock(new BlockIncenseAltar());
|
incenseAltar = registerBlock(new BlockIncenseAltar());
|
||||||
pathBlock = registerBlock(new BlockPath(), ItemBlockPath.class);
|
pathBlock = registerBlock(new BlockPath(), ItemBlockPath.class);
|
||||||
demonCrucible = registerBlock(new BlockDemonCrucible());
|
demonCrucible = registerBlock(new BlockDemonCrucible());
|
||||||
|
|
Loading…
Reference in a new issue