Merge branch 'master' of https://github.com/TechReborn/TechReborn
Conflicts: src/main/java/techreborn/asm/LoadingPlugin.java src/main/java/techreborn/client/gui/GuiBlastFurnace.java src/main/java/techreborn/client/render/MultiblockRenderEvent.java src/main/java/techreborn/compat/recipes/RecipesIC2.java src/main/java/techreborn/init/ModItems.java src/main/java/techreborn/lib/Location.java src/main/java/techreborn/packets/PacketPipeline.java src/main/java/techreborn/partSystem/fmp/CableConverter.java
This commit is contained in:
commit
ef03cf50a9
23 changed files with 888 additions and 654 deletions
|
@ -41,6 +41,13 @@ public class GuiBlastFurnace extends GuiContainer {
|
|||
GuiButton button = new GuiButton(212, k + 4, l + 6, 20, 20, "");
|
||||
buttonList.add(button);
|
||||
super.initGui();
|
||||
ChunkCoordinates coordinates = new ChunkCoordinates(blastfurnace.xCoord - (ForgeDirection.getOrientation(blastfurnace.getRotation()).offsetX * 2), blastfurnace.yCoord - 1, blastfurnace.zCoord - (ForgeDirection.getOrientation(blastfurnace.getRotation()).offsetZ * 2));
|
||||
if(coordinates.equals(ClientProxy.multiblockRenderEvent.anchor) && blastfurnace.getHeat() != 0){
|
||||
ClientProxy.multiblockRenderEvent.setMultiblock(null);
|
||||
button.displayString = "B";
|
||||
} else {
|
||||
button.displayString = "A";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -79,59 +86,61 @@ public class GuiBlastFurnace extends GuiContainer {
|
|||
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button) {
|
||||
super.actionPerformed(button);
|
||||
if (button.id == 212) {
|
||||
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
|
||||
{//This code here makes a basic multiblock and then sets to the selected one.
|
||||
Multiblock multiblock = new Multiblock();
|
||||
multiblock.addComponent(0, 0, 0, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(1, 0, 0, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(0, 0, 1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(-1, 0, 0, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(0, 0, -1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(-1, 0, -1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(-1, 0, 1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(1, 0, -1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(1, 0, 1, ModBlocks.MachineCasing, 0);
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button) {
|
||||
super.actionPerformed(button);
|
||||
if(button.id == 212){
|
||||
if(ClientProxy.multiblockRenderEvent.currentMultiblock == null){
|
||||
{//This code here makes a basic multiblock and then sets to the selected one.
|
||||
Multiblock multiblock = new Multiblock();
|
||||
multiblock.addComponent(0, 0, 0, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(1, 0, 0, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(0, 0, 1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(-1, 0, 0, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(0, 0, -1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(-1, 0, -1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(-1, 0, 1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(1, 0, -1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(1, 0, 1, ModBlocks.MachineCasing, 0);
|
||||
|
||||
multiblock.addComponent(1, 1, 0, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(0, 1, 1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(-1, 1, 0, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(0, 1, -1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(-1, 1, -1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(-1, 1, 1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(1, 1, -1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(1, 1, 1, ModBlocks.MachineCasing, 0);
|
||||
|
||||
multiblock.addComponent(1, 2, 0, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(0, 2, 1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(-1, 2, 0, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(0, 2, -1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(-1, 2, -1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(-1, 2, 1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(1, 2, -1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(1, 2, 1, ModBlocks.MachineCasing, 0);
|
||||
|
||||
multiblock.addComponent(1, 1, 0, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(0, 1, 1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(-1, 1, 0, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(0, 1, -1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(-1, 1, -1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(-1, 1, 1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(1, 1, -1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(1, 1, 1, ModBlocks.MachineCasing, 0);
|
||||
|
||||
multiblock.addComponent(1, 2, 0, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(0, 2, 1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(-1, 2, 0, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(0, 2, -1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(-1, 2, -1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(-1, 2, 1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(1, 2, -1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(1, 2, 1, ModBlocks.MachineCasing, 0);
|
||||
|
||||
multiblock.addComponent(1, 3, 0, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(0, 3, 1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(-1, 3, 0, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(0, 3, -1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(-1, 3, -1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(-1, 3, 1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(1, 3, -1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(1, 3, 1, ModBlocks.MachineCasing, 0);
|
||||
|
||||
MultiblockSet set = new MultiblockSet(multiblock);
|
||||
ClientProxy.multiblockRenderEvent.setMultiblock(set);
|
||||
ClientProxy.multiblockRenderEvent.anchor = new ChunkCoordinates(blastfurnace.xCoord - (ForgeDirection.getOrientation(blastfurnace.getRotation()).offsetX * 2), blastfurnace.yCoord - 1, blastfurnace.zCoord - (ForgeDirection.getOrientation(blastfurnace.getRotation()).offsetZ * 2));
|
||||
}
|
||||
button.displayString = "A";
|
||||
} else {
|
||||
ClientProxy.multiblockRenderEvent.setMultiblock(null);
|
||||
button.displayString = "B";
|
||||
}
|
||||
}
|
||||
}
|
||||
multiblock.addComponent(0, 3, 0, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(1, 3, 0, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(0, 3, 1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(-1, 3, 0, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(0, 3, -1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(-1, 3, -1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(-1, 3, 1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(1, 3, -1, ModBlocks.MachineCasing, 0);
|
||||
multiblock.addComponent(1, 3, 1, ModBlocks.MachineCasing, 0);
|
||||
|
||||
MultiblockSet set = new MultiblockSet(multiblock);
|
||||
ClientProxy.multiblockRenderEvent.setMultiblock(set);
|
||||
ClientProxy.multiblockRenderEvent.partent = new Location(blastfurnace.xCoord, blastfurnace.yCoord, blastfurnace.zCoord, blastfurnace.getWorldObj());
|
||||
ClientProxy.multiblockRenderEvent.anchor = new ChunkCoordinates(blastfurnace.xCoord - (ForgeDirection.getOrientation(blastfurnace.getRotation()).offsetX * 2), blastfurnace.yCoord - 1, blastfurnace.zCoord - (ForgeDirection.getOrientation(blastfurnace.getRotation()).offsetZ * 2));
|
||||
}
|
||||
button.displayString = "A";
|
||||
} else {
|
||||
ClientProxy.multiblockRenderEvent.setMultiblock(null);
|
||||
button.displayString = "B";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,57 +43,56 @@ public class ChargeHud {
|
|||
|
||||
public void drawChargeHud(ScaledResolution res) {
|
||||
EntityPlayer player = mc.thePlayer;
|
||||
ItemStack stack = player.getCurrentArmor(2);
|
||||
ItemStack stack2 = mc.thePlayer.inventory.getCurrentItem();
|
||||
if (showHud) {
|
||||
if (stack2 != null) {
|
||||
if ((stack2.getItem() instanceof IEnergyInterfaceItem)) {
|
||||
double MaxCharge = ((IEnergyInterfaceItem) stack2.getItem()).getMaxPower(stack2);
|
||||
double CurrentCharge = ((IEnergyInterfaceItem) stack2.getItem()).getEnergy(stack2);
|
||||
Color color = Color.GREEN;
|
||||
double quarter = MaxCharge / 4;
|
||||
double half = MaxCharge / 2;
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glEnable(32826);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, stack2, 0, 20);
|
||||
RenderItem.getInstance().renderItemOverlayIntoGUI(mc.fontRenderer, mc.renderEngine, stack2, 0, 20);
|
||||
if (CurrentCharge <= half) {
|
||||
color = Color.YELLOW;
|
||||
}
|
||||
if (CurrentCharge <= quarter) {
|
||||
color = Color.DARK_RED;
|
||||
}
|
||||
mc.fontRenderer.drawString(color + GetEUString(CurrentCharge) + "/" + GetEUString(MaxCharge), 20, 25, 0);
|
||||
ItemStack armorstack = player.getCurrentArmor(2);
|
||||
ItemStack stack = mc.thePlayer.inventory.getCurrentItem();
|
||||
|
||||
}
|
||||
int y = 5;
|
||||
|
||||
if (armorstack != null && ConfigTechReborn.ShowChargeHud && armorstack.getItem() instanceof IEnergyInterfaceItem) {
|
||||
double MaxCharge = ((IEnergyInterfaceItem) armorstack.getItem()).getMaxPower(armorstack);
|
||||
double CurrentCharge = ((IEnergyInterfaceItem) armorstack.getItem()).getEnergy(armorstack);
|
||||
Color color = Color.GREEN;
|
||||
double quarter = MaxCharge / 4;
|
||||
double half = MaxCharge / 2;
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glEnable(32826);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
//Render the stack
|
||||
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, armorstack, 0, y - 5);
|
||||
//Render Overlay
|
||||
RenderItem.getInstance().renderItemOverlayIntoGUI(mc.fontRenderer, mc.renderEngine, armorstack, 0, y - 5);
|
||||
//Get the color depending on current charge
|
||||
if (CurrentCharge <= half) {
|
||||
color = Color.YELLOW;
|
||||
}
|
||||
if (CurrentCharge <= quarter) {
|
||||
color = Color.DARK_RED;
|
||||
}
|
||||
mc.fontRenderer.drawString(color + GetEUString(CurrentCharge) + "/" + GetEUString(MaxCharge), 20, y, 0);
|
||||
y += 20;
|
||||
}
|
||||
|
||||
if (stack != null) {
|
||||
if ((stack.getItem() instanceof IEnergyInterfaceItem) && ConfigTechReborn.ShowChargeHud) {
|
||||
double MaxCharge = ((IEnergyInterfaceItem) stack.getItem()).getMaxPower(stack);
|
||||
double CurrentCharge = ((IEnergyInterfaceItem) stack2.getItem()).getEnergy(stack2);
|
||||
Color color = Color.GREEN;
|
||||
double quarter = MaxCharge / 4;
|
||||
double half = MaxCharge / 2;
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glEnable(32826);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
//Render the stack
|
||||
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, stack, 0, 0);
|
||||
//Render Overlay
|
||||
RenderItem.getInstance().renderItemOverlayIntoGUI(mc.fontRenderer, mc.renderEngine, stack, 0, 0);
|
||||
//Get the color depending on current charge
|
||||
if (CurrentCharge <= half) {
|
||||
color = Color.YELLOW;
|
||||
}
|
||||
if (CurrentCharge <= quarter) {
|
||||
color = Color.DARK_RED;
|
||||
}
|
||||
mc.fontRenderer.drawString(color + GetEUString(CurrentCharge) + "/" + GetEUString(MaxCharge), 20, 5, 0);
|
||||
if (showHud) {
|
||||
if (stack != null && stack.getItem() instanceof IEnergyInterfaceItem) {
|
||||
double MaxCharge = ((IEnergyInterfaceItem) stack.getItem()).getMaxPower(stack);
|
||||
double CurrentCharge = ((IEnergyInterfaceItem) stack.getItem()).getEnergy(stack);
|
||||
Color color = Color.GREEN;
|
||||
double quarter = MaxCharge / 4;
|
||||
double half = MaxCharge / 2;
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glEnable(32826);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, stack, 0, y - 5);
|
||||
RenderItem.getInstance().renderItemOverlayIntoGUI(mc.fontRenderer, mc.renderEngine, stack, 0, y - 5);
|
||||
if (CurrentCharge <= half) {
|
||||
color = Color.YELLOW;
|
||||
}
|
||||
if (CurrentCharge <= quarter) {
|
||||
color = Color.DARK_RED;
|
||||
}
|
||||
mc.fontRenderer.drawString(color + GetEUString(CurrentCharge) + "/" + GetEUString(MaxCharge), 20, y, 0);
|
||||
}
|
||||
}
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
|
|
@ -1,105 +0,0 @@
|
|||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p/>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package techreborn.client.render;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import reborncore.client.multiblock.IMultiblockRenderHook;
|
||||
import reborncore.client.multiblock.Multiblock;
|
||||
import reborncore.client.multiblock.MultiblockSet;
|
||||
import reborncore.client.multiblock.component.MultiblockComponent;
|
||||
|
||||
public class MultiblockRenderEvent {
|
||||
public static boolean rendering = false;
|
||||
|
||||
private static RenderBlocks blockRender = RenderBlocks.getInstance();
|
||||
public MultiblockSet currentMultiblock;
|
||||
public static ChunkCoordinates anchor;
|
||||
public static int angle;
|
||||
|
||||
public void setMultiblock(MultiblockSet set) {
|
||||
currentMultiblock = set;
|
||||
anchor = null;
|
||||
angle = 0;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWorldRenderLast(RenderWorldLastEvent event) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if (mc.thePlayer != null && mc.objectMouseOver != null && !mc.thePlayer.isSneaking()) {
|
||||
mc.thePlayer.getCurrentEquippedItem();
|
||||
renderPlayerLook(mc.thePlayer, mc.objectMouseOver);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if (currentMultiblock != null && anchor == null && event.action == Action.RIGHT_CLICK_BLOCK && event.entityPlayer == Minecraft.getMinecraft().thePlayer) {
|
||||
anchor = new ChunkCoordinates(event.x, event.y, event.z);
|
||||
angle = MathHelper.floor_double(event.entityPlayer.rotationYaw * 4.0 / 360.0 + 0.5) & 3;
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void renderPlayerLook(EntityPlayer player, MovingObjectPosition src) {
|
||||
if (currentMultiblock != null) {
|
||||
int anchorX = anchor != null ? anchor.posX : src.blockX;
|
||||
int anchorY = anchor != null ? anchor.posY + 1 : src.blockY + 1;
|
||||
int anchorZ = anchor != null ? anchor.posZ : src.blockZ;
|
||||
|
||||
rendering = true;
|
||||
Multiblock mb = currentMultiblock.getForEntity(player);
|
||||
boolean didAny = false;
|
||||
for (MultiblockComponent comp : mb.getComponents())
|
||||
if (renderComponent(player.worldObj, mb, comp, anchorX, anchorY, anchorZ))
|
||||
didAny = true;
|
||||
rendering = false;
|
||||
|
||||
if (!didAny) {
|
||||
setMultiblock(null);
|
||||
player.addChatComponentMessage(new ChatComponentText("Structure Complete!").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GREEN)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean renderComponent(World world, Multiblock mb, MultiblockComponent comp, int anchorX, int anchorY, int anchorZ) {
|
||||
ChunkCoordinates pos = comp.getRelativePosition();
|
||||
int x = pos.posX + anchorX;
|
||||
int y = pos.posY + anchorY;
|
||||
int z = pos.posZ + anchorZ;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glColor4f(1F, 1F, 1F, 0.4F);
|
||||
GL11.glTranslated(x + 0.5 - RenderManager.renderPosX, y + 0.5 - RenderManager.renderPosY, z + 0.5 - RenderManager.renderPosZ);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
|
||||
blockRender.useInventoryTint = false;
|
||||
Block block = comp.getBlock();
|
||||
if (IMultiblockRenderHook.renderHooks.containsKey(block))
|
||||
IMultiblockRenderHook.renderHooks.get(block).renderBlockForMultiblock(world, mb, block, comp.getMeta(), blockRender);
|
||||
else blockRender.renderBlockAsItem(comp.getBlock(), comp.getMeta(), 1F);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glPopMatrix();
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue