Moved to RebornCore
This commit is contained in:
parent
50a830a101
commit
8abf6e5282
313 changed files with 3987 additions and 16508 deletions
|
@ -6,7 +6,6 @@ import net.minecraft.world.World;
|
|||
import techreborn.client.container.*;
|
||||
import techreborn.client.gui.*;
|
||||
import techreborn.pda.GuiManual;
|
||||
import techreborn.pda.pages.BasePage;
|
||||
import techreborn.tiles.*;
|
||||
import techreborn.tiles.idsu.TileIDSU;
|
||||
import techreborn.tiles.lesu.TileLesu;
|
||||
|
@ -89,7 +88,7 @@ public class GuiHandler implements IGuiHandler {
|
|||
} else if (ID == assemblingmachineID) {
|
||||
return new ContainerAssemblingMachine(
|
||||
(TileAssemblingMachine) world.getTileEntity(x, y, z), player);
|
||||
}else if (ID == dieselGeneratorID) {
|
||||
} else if (ID == dieselGeneratorID) {
|
||||
return new ContainerDieselGenerator(
|
||||
(TileDieselGenerator) world.getTileEntity(x, y, z), player);
|
||||
} else if (ID == industrialElectrolyzerID) {
|
||||
|
@ -171,7 +170,7 @@ public class GuiHandler implements IGuiHandler {
|
|||
} else if (ID == assemblingmachineID) {
|
||||
return new GuiAssemblingMachine(player,
|
||||
(TileAssemblingMachine) world.getTileEntity(x, y, z));
|
||||
}else if (ID == dieselGeneratorID) {
|
||||
} else if (ID == dieselGeneratorID) {
|
||||
return new GuiDieselGenerator(player,
|
||||
(TileDieselGenerator) world.getTileEntity(x, y, z));
|
||||
} else if (ID == industrialElectrolyzerID) {
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
package techreborn.client;
|
||||
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class GuiUtil {
|
||||
|
||||
|
||||
public static void drawRepeated(IIcon icon, double x, double y, double width, double height, double z) {
|
||||
double iconWidthStep = (icon.getMaxU() - icon.getMinU()) / 16.0D;
|
||||
double iconHeightStep = (icon.getMaxV() - icon.getMinV()) / 16.0D;
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
for (double cy = y; cy < y + height; cy += 16.0D) {
|
||||
double quadHeight = Math.min(16.0D, height + y - cy);
|
||||
double maxY = cy + quadHeight;
|
||||
double maxV = icon.getMinV() + iconHeightStep * quadHeight;
|
||||
for (double cx = x; cx < x + width; cx += 16.0D) {
|
||||
double quadWidth = Math.min(16.0D, width + x - cx);
|
||||
double maxX = cx + quadWidth;
|
||||
double maxU = icon.getMinU() + iconWidthStep * quadWidth;
|
||||
|
||||
tessellator.addVertexWithUV(cx, maxY, z, icon.getMinU(), maxV);
|
||||
tessellator.addVertexWithUV(maxX, maxY, z, maxU, maxV);
|
||||
tessellator.addVertexWithUV(maxX, cy, z, maxU, icon.getMinV());
|
||||
tessellator.addVertexWithUV(cx, cy, z, icon.getMinU(), icon.getMinV());
|
||||
}
|
||||
}
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
public static void drawTooltipBox(int x, int y, int w, int h) {
|
||||
int bg = 0xf0100010;
|
||||
drawGradientRect(x + 1, y, w - 1, 1, bg, bg);
|
||||
drawGradientRect(x + 1, y + h, w - 1, 1, bg, bg);
|
||||
drawGradientRect(x + 1, y + 1, w - 1, h - 1, bg, bg);//center
|
||||
drawGradientRect(x, y + 1, 1, h - 1, bg, bg);
|
||||
drawGradientRect(x + w, y + 1, 1, h - 1, bg, bg);
|
||||
int grad1 = 0x505000ff;
|
||||
int grad2 = 0x5028007F;
|
||||
drawGradientRect(x + 1, y + 2, 1, h - 3, grad1, grad2);
|
||||
drawGradientRect(x + w - 1, y + 2, 1, h - 3, grad1, grad2);
|
||||
|
||||
drawGradientRect(x + 1, y + 1, w - 1, 1, grad1, grad1);
|
||||
drawGradientRect(x + 1, y + h - 1, w - 1, 1, grad2, grad2);
|
||||
}
|
||||
|
||||
public static void drawGradientRect(int x, int y, int w, int h, int colour1, int colour2) {
|
||||
new GuiHook().drawGradientRect(x, y, x + w, y + h, colour1, colour2);
|
||||
}
|
||||
|
||||
public static class GuiHook extends Gui {
|
||||
@Override
|
||||
public void drawGradientRect(int par1, int par2, int par3, int par4, int par5, int par6) {
|
||||
super.drawGradientRect(par1, par2, par3, par4, par5, par6);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
package techreborn.client;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class SlotFake extends Slot {
|
||||
|
||||
public boolean mCanInsertItem;
|
||||
public boolean mCanStackItem;
|
||||
public int mMaxStacksize = 127;
|
||||
|
||||
public SlotFake(IInventory par1iInventory, int par2, int par3, int par4,
|
||||
boolean aCanInsertItem, boolean aCanStackItem, int aMaxStacksize) {
|
||||
super(par1iInventory, par2, par3, par4);
|
||||
this.mCanInsertItem = aCanInsertItem;
|
||||
this.mCanStackItem = aCanStackItem;
|
||||
this.mMaxStacksize = aMaxStacksize;
|
||||
}
|
||||
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
return this.mCanInsertItem;
|
||||
}
|
||||
|
||||
public int getSlotStackLimit() {
|
||||
return this.mMaxStacksize;
|
||||
}
|
||||
|
||||
public boolean getHasStack() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemStack decrStackSize(int par1) {
|
||||
return !this.mCanStackItem ? null : super.decrStackSize(par1);
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
package techreborn.client;
|
||||
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SlotFilteredVoid extends Slot {
|
||||
|
||||
private List<ItemStack> filter = new ArrayList<ItemStack>();
|
||||
|
||||
public SlotFilteredVoid(IInventory par1iInventory, int id, int x, int y) {
|
||||
super(par1iInventory, id, x, y);
|
||||
}
|
||||
|
||||
public SlotFilteredVoid(IInventory par1iInventory, int id, int x, int y, ItemStack[] filterList) {
|
||||
super(par1iInventory, id, x, y);
|
||||
for (ItemStack itemStack : filterList)
|
||||
this.filter.add(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack) {
|
||||
for (ItemStack itemStack : filter)
|
||||
if (itemStack.getItem().equals(stack.getItem()) && itemStack.getItemDamage() == stack.getItemDamage())
|
||||
return false;
|
||||
|
||||
return super.isItemValid(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putStack(ItemStack arg0) {
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
package techreborn.client;
|
||||
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
|
||||
public class SlotFluid extends Slot {
|
||||
public SlotFluid(IInventory p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_) {
|
||||
super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack) {
|
||||
|
||||
return FluidContainerRegistry.isContainer(stack) || (stack != null && stack.getItem() instanceof IFluidContainerItem);
|
||||
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
package techreborn.client;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class SlotInput extends Slot {
|
||||
|
||||
public SlotInput(IInventory par1iInventory, int par2, int par3, int par4) {
|
||||
super(par1iInventory, par2, par3, par4);
|
||||
}
|
||||
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getSlotStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
package techreborn.client;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class SlotOutput extends Slot {
|
||||
|
||||
public SlotOutput(IInventory par1iInventory, int par2, int par3, int par4) {
|
||||
super(par1iInventory, par2, par3, par4);
|
||||
}
|
||||
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getSlotStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
}
|
|
@ -8,9 +8,9 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import techreborn.api.IListInfoProvider;
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.common.util.Color;
|
||||
import techreborn.api.power.IEnergyInterfaceItem;
|
||||
import techreborn.util.Color;
|
||||
|
||||
public class StackToolTipEvent {
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import cpw.mods.fml.client.GuiModList;
|
|||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
import reborncore.client.gui.GuiUtil;
|
||||
import techreborn.Core;
|
||||
|
||||
import java.awt.*;
|
||||
|
|
|
@ -5,9 +5,10 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import reborncore.common.container.RebornContainer;
|
||||
import techreborn.tiles.TileAesu;
|
||||
|
||||
public class ContainerAesu extends TechRebornContainer {
|
||||
public class ContainerAesu extends RebornContainer {
|
||||
|
||||
EntityPlayer player;
|
||||
|
||||
|
@ -29,7 +30,7 @@ public class ContainerAesu extends TechRebornContainer {
|
|||
|
||||
// input
|
||||
//this.addSlotToContainer(new Slot(tileaesu.inventory, 0, 116, 23));
|
||||
// this.addSlotToContainer(new Slot(tileaesu.inventory, 1, 116, 59));
|
||||
// this.addSlotToContainer(new Slot(tileaesu.inventory, 1, 116, 59));
|
||||
|
||||
int i;
|
||||
|
||||
|
|
|
@ -3,10 +3,11 @@ package techreborn.client.container;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import techreborn.client.SlotOutput;
|
||||
import reborncore.client.gui.SlotOutput;
|
||||
import reborncore.common.container.RebornContainer;
|
||||
import techreborn.tiles.TileAlloyFurnace;
|
||||
|
||||
public class ContainerAlloyFurnace extends TechRebornContainer {
|
||||
public class ContainerAlloyFurnace extends RebornContainer {
|
||||
|
||||
EntityPlayer player;
|
||||
|
||||
|
@ -69,7 +70,7 @@ public class ContainerAlloyFurnace extends TechRebornContainer {
|
|||
if (this.burnTime != tile.burnTime) {
|
||||
crafting.sendProgressBarUpdate(this, 1, tile.burnTime);
|
||||
}
|
||||
if (this.cookTime != tile.cookTime) {
|
||||
if (this.cookTime != tile.cookTime) {
|
||||
crafting.sendProgressBarUpdate(this, 2, tile.cookTime);
|
||||
}
|
||||
}
|
||||
|
@ -79,11 +80,11 @@ public class ContainerAlloyFurnace extends TechRebornContainer {
|
|||
@Override
|
||||
public void updateProgressBar(int id, int value) {
|
||||
super.updateProgressBar(id, value);
|
||||
if(id == 0){
|
||||
if (id == 0) {
|
||||
this.currentItemBurnTime = value;
|
||||
} else if(id ==1){
|
||||
} else if (id == 1) {
|
||||
this.burnTime = value;
|
||||
} else if(id == 2){
|
||||
} else if (id == 2) {
|
||||
this.cookTime = value;
|
||||
}
|
||||
this.tile.currentItemBurnTime = this.currentItemBurnTime;
|
||||
|
|
|
@ -2,7 +2,7 @@ package techreborn.client.container;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import techreborn.client.SlotOutput;
|
||||
import reborncore.client.gui.SlotOutput;
|
||||
import techreborn.tiles.TileAlloySmelter;
|
||||
|
||||
public class ContainerAlloySmelter extends ContainerCrafting {
|
||||
|
|
|
@ -2,7 +2,7 @@ package techreborn.client.container;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import techreborn.client.SlotOutput;
|
||||
import reborncore.client.gui.SlotOutput;
|
||||
import techreborn.tiles.TileAssemblingMachine;
|
||||
|
||||
public class ContainerAssemblingMachine extends ContainerCrafting {
|
||||
|
|
|
@ -3,7 +3,7 @@ package techreborn.client.container;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import techreborn.client.SlotOutput;
|
||||
import reborncore.client.gui.SlotOutput;
|
||||
import techreborn.tiles.TileBlastFurnace;
|
||||
|
||||
public class ContainerBlastFurnace extends ContainerCrafting {
|
||||
|
|
|
@ -2,7 +2,7 @@ package techreborn.client.container;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import techreborn.client.SlotOutput;
|
||||
import reborncore.client.gui.SlotOutput;
|
||||
import techreborn.tiles.TileCentrifuge;
|
||||
|
||||
public class ContainerCentrifuge extends ContainerCrafting {
|
||||
|
@ -19,8 +19,8 @@ public class ContainerCentrifuge extends ContainerCrafting {
|
|||
}
|
||||
|
||||
public ContainerCentrifuge(TileCentrifuge tileCentrifuge, EntityPlayer player) {
|
||||
super(tileCentrifuge.crafter);
|
||||
tile = tileCentrifuge;
|
||||
super(tileCentrifuge.crafter);
|
||||
tile = tileCentrifuge;
|
||||
this.player = player;
|
||||
|
||||
// input
|
||||
|
|
|
@ -2,9 +2,10 @@ package techreborn.client.container;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import reborncore.common.container.RebornContainer;
|
||||
import techreborn.tiles.TileChargeBench;
|
||||
|
||||
public class ContainerChargeBench extends TechRebornContainer {
|
||||
public class ContainerChargeBench extends RebornContainer {
|
||||
|
||||
EntityPlayer player;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package techreborn.client.container;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import techreborn.client.SlotOutput;
|
||||
import reborncore.client.gui.SlotOutput;
|
||||
import techreborn.tiles.TileChemicalReactor;
|
||||
|
||||
public class ContainerChemicalReactor extends ContainerCrafting {
|
||||
|
|
|
@ -2,9 +2,10 @@ package techreborn.client.container;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import reborncore.common.container.RebornContainer;
|
||||
import techreborn.tiles.TileChunkLoader;
|
||||
|
||||
public class ContainerChunkloader extends TechRebornContainer {
|
||||
public class ContainerChunkloader extends RebornContainer {
|
||||
|
||||
EntityPlayer player;
|
||||
|
||||
|
|
|
@ -3,9 +3,10 @@ package techreborn.client.container;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import reborncore.common.container.RebornContainer;
|
||||
import techreborn.api.recipe.RecipeCrafter;
|
||||
|
||||
public abstract class ContainerCrafting extends TechRebornContainer {
|
||||
public abstract class ContainerCrafting extends RebornContainer {
|
||||
|
||||
RecipeCrafter crafter;
|
||||
|
||||
|
|
|
@ -3,11 +3,12 @@ package techreborn.client.container;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.client.SlotFilteredVoid;
|
||||
import reborncore.client.gui.SlotFilteredVoid;
|
||||
import reborncore.common.container.RebornContainer;
|
||||
import reborncore.common.util.Inventory;
|
||||
import techreborn.init.ModItems;
|
||||
import techreborn.util.Inventory;
|
||||
|
||||
public class ContainerDestructoPack extends TechRebornContainer {
|
||||
public class ContainerDestructoPack extends RebornContainer {
|
||||
|
||||
private EntityPlayer player;
|
||||
private Inventory inv;
|
||||
|
|
|
@ -5,11 +5,12 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import techreborn.client.SlotFake;
|
||||
import techreborn.client.SlotOutput;
|
||||
import reborncore.client.gui.SlotFake;
|
||||
import reborncore.client.gui.SlotOutput;
|
||||
import reborncore.common.container.RebornContainer;
|
||||
import techreborn.tiles.TileDieselGenerator;
|
||||
|
||||
public class ContainerDieselGenerator extends TechRebornContainer {
|
||||
public class ContainerDieselGenerator extends RebornContainer {
|
||||
public TileDieselGenerator tiledieselGenerator;
|
||||
public EntityPlayer player;
|
||||
public int energy;
|
||||
|
@ -74,8 +75,7 @@ public class ContainerDieselGenerator extends TechRebornContainer {
|
|||
public void updateProgressBar(int id, int value) {
|
||||
if (id == 0) {
|
||||
this.energy = value;
|
||||
}else
|
||||
if (id == 1) {
|
||||
} else if (id == 1) {
|
||||
this.fluid = value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,11 +2,12 @@ package techreborn.client.container;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import techreborn.client.SlotFake;
|
||||
import techreborn.client.SlotOutput;
|
||||
import reborncore.client.gui.SlotFake;
|
||||
import reborncore.client.gui.SlotOutput;
|
||||
import reborncore.common.container.RebornContainer;
|
||||
import techreborn.tiles.TileDigitalChest;
|
||||
|
||||
public class ContainerDigitalChest extends TechRebornContainer {
|
||||
public class ContainerDigitalChest extends RebornContainer {
|
||||
public TileDigitalChest tileDigitalChest;
|
||||
public EntityPlayer player;
|
||||
|
||||
|
|
|
@ -2,11 +2,12 @@ package techreborn.client.container;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import techreborn.client.SlotFake;
|
||||
import techreborn.client.SlotOutput;
|
||||
import reborncore.client.gui.SlotFake;
|
||||
import reborncore.client.gui.SlotOutput;
|
||||
import reborncore.common.container.RebornContainer;
|
||||
import techreborn.tiles.TileGasTurbine;
|
||||
|
||||
public class ContainerGasTurbine extends TechRebornContainer {
|
||||
public class ContainerGasTurbine extends RebornContainer {
|
||||
public TileGasTurbine tileGasTurbine;
|
||||
public EntityPlayer player;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package techreborn.client.container;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import techreborn.client.SlotOutput;
|
||||
import reborncore.client.gui.SlotOutput;
|
||||
import techreborn.tiles.TileGrinder;
|
||||
|
||||
public class ContainerGrinder extends ContainerCrafting {
|
||||
|
|
|
@ -5,10 +5,11 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import reborncore.common.container.RebornContainer;
|
||||
import techreborn.tiles.idsu.TileIDSU;
|
||||
|
||||
|
||||
public class ContainerIDSU extends TechRebornContainer {
|
||||
public class ContainerIDSU extends RebornContainer {
|
||||
|
||||
EntityPlayer player;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package techreborn.client.container;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import techreborn.client.SlotOutput;
|
||||
import reborncore.client.gui.SlotOutput;
|
||||
import techreborn.tiles.TileImplosionCompressor;
|
||||
|
||||
public class ContainerImplosionCompressor extends ContainerCrafting {
|
||||
|
|
|
@ -2,7 +2,7 @@ package techreborn.client.container;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import techreborn.client.SlotOutput;
|
||||
import reborncore.client.gui.SlotOutput;
|
||||
import techreborn.tiles.TileIndustrialElectrolyzer;
|
||||
|
||||
public class ContainerIndustrialElectrolyzer extends ContainerCrafting {
|
||||
|
|
|
@ -2,7 +2,7 @@ package techreborn.client.container;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import techreborn.client.SlotOutput;
|
||||
import reborncore.client.gui.SlotOutput;
|
||||
import techreborn.tiles.TileIndustrialSawmill;
|
||||
|
||||
public class ContainerIndustrialSawmill extends ContainerCrafting {
|
||||
|
|
|
@ -5,10 +5,11 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import reborncore.common.container.RebornContainer;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.tiles.lesu.TileLesu;
|
||||
|
||||
public class ContainerLesu extends TechRebornContainer {
|
||||
public class ContainerLesu extends RebornContainer {
|
||||
|
||||
EntityPlayer player;
|
||||
|
||||
|
|
|
@ -5,10 +5,11 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import techreborn.client.SlotOutput;
|
||||
import reborncore.client.gui.SlotOutput;
|
||||
import reborncore.common.container.RebornContainer;
|
||||
import techreborn.tiles.TileMatterFabricator;
|
||||
|
||||
public class ContainerMatterFabricator extends TechRebornContainer {
|
||||
public class ContainerMatterFabricator extends RebornContainer {
|
||||
|
||||
EntityPlayer player;
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package techreborn.client.container;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import reborncore.common.container.RebornContainer;
|
||||
|
||||
public class ContainerPda extends TechRebornContainer {
|
||||
public class ContainerPda extends RebornContainer {
|
||||
|
||||
EntityPlayer player;
|
||||
|
||||
|
|
|
@ -2,11 +2,12 @@ package techreborn.client.container;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import techreborn.client.SlotFake;
|
||||
import techreborn.client.SlotOutput;
|
||||
import reborncore.client.gui.SlotFake;
|
||||
import reborncore.client.gui.SlotOutput;
|
||||
import reborncore.common.container.RebornContainer;
|
||||
import techreborn.tiles.TileQuantumChest;
|
||||
|
||||
public class ContainerQuantumChest extends TechRebornContainer {
|
||||
public class ContainerQuantumChest extends RebornContainer {
|
||||
public TileQuantumChest tileQuantumChest;
|
||||
public EntityPlayer player;
|
||||
|
||||
|
|
|
@ -2,12 +2,13 @@ package techreborn.client.container;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import techreborn.client.SlotFake;
|
||||
import techreborn.client.SlotFluid;
|
||||
import techreborn.client.SlotOutput;
|
||||
import reborncore.client.gui.SlotFake;
|
||||
import reborncore.client.gui.SlotFluid;
|
||||
import reborncore.client.gui.SlotOutput;
|
||||
import reborncore.common.container.RebornContainer;
|
||||
import techreborn.tiles.TileQuantumTank;
|
||||
|
||||
public class ContainerQuantumTank extends TechRebornContainer {
|
||||
public class ContainerQuantumTank extends RebornContainer {
|
||||
public TileQuantumTank tileQuantumTank;
|
||||
public EntityPlayer player;
|
||||
|
||||
|
|
|
@ -5,12 +5,13 @@ import net.minecraft.inventory.ICrafting;
|
|||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.client.gui.SlotFake;
|
||||
import reborncore.client.gui.SlotOutput;
|
||||
import reborncore.common.container.RebornContainer;
|
||||
import techreborn.api.RollingMachineRecipe;
|
||||
import techreborn.client.SlotFake;
|
||||
import techreborn.client.SlotOutput;
|
||||
import techreborn.tiles.TileRollingMachine;
|
||||
|
||||
public class ContainerRollingMachine extends TechRebornContainer {
|
||||
public class ContainerRollingMachine extends RebornContainer {
|
||||
|
||||
EntityPlayer player;
|
||||
TileRollingMachine tile;
|
||||
|
@ -85,7 +86,7 @@ public class ContainerRollingMachine extends TechRebornContainer {
|
|||
if (this.burnTime != tile.tickTime) {
|
||||
crafting.sendProgressBarUpdate(this, 1, tile.tickTime);
|
||||
}
|
||||
if (this.energy != (int) tile.getEnergy()) {
|
||||
if (this.energy != (int) tile.getEnergy()) {
|
||||
crafting.sendProgressBarUpdate(this, 2, (int) tile.getEnergy());
|
||||
}
|
||||
}
|
||||
|
@ -95,11 +96,11 @@ public class ContainerRollingMachine extends TechRebornContainer {
|
|||
@Override
|
||||
public void updateProgressBar(int id, int value) {
|
||||
super.updateProgressBar(id, value);
|
||||
if(id == 0){
|
||||
if (id == 0) {
|
||||
this.currentItemBurnTime = value;
|
||||
} else if(id ==1){
|
||||
} else if (id == 1) {
|
||||
this.burnTime = value;
|
||||
} else if(id == 2){
|
||||
} else if (id == 2) {
|
||||
this.energy = value;
|
||||
}
|
||||
this.tile.runTime = this.currentItemBurnTime;
|
||||
|
@ -107,9 +108,8 @@ public class ContainerRollingMachine extends TechRebornContainer {
|
|||
this.tile.setEnergy(this.energy);
|
||||
}
|
||||
|
||||
public int getBurnTimeRemainingScaled(int scale)
|
||||
{
|
||||
if(burnTime == 0 || this.currentItemBurnTime == 0){
|
||||
public int getBurnTimeRemainingScaled(int scale) {
|
||||
if (burnTime == 0 || this.currentItemBurnTime == 0) {
|
||||
return 0;
|
||||
}
|
||||
return this.burnTime * scale / this.currentItemBurnTime;
|
||||
|
|
|
@ -2,11 +2,12 @@ package techreborn.client.container;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import techreborn.client.SlotFake;
|
||||
import techreborn.client.SlotOutput;
|
||||
import reborncore.client.gui.SlotFake;
|
||||
import reborncore.client.gui.SlotOutput;
|
||||
import reborncore.common.container.RebornContainer;
|
||||
import techreborn.tiles.TileSemifluidGenerator;
|
||||
|
||||
public class ContainerSemifluidGenerator extends TechRebornContainer {
|
||||
public class ContainerSemifluidGenerator extends RebornContainer {
|
||||
public TileSemifluidGenerator tileSemifluidGenerator;
|
||||
public EntityPlayer player;
|
||||
|
||||
|
|
|
@ -2,12 +2,13 @@ package techreborn.client.container;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import techreborn.client.SlotFake;
|
||||
import techreborn.client.SlotFluid;
|
||||
import techreborn.client.SlotOutput;
|
||||
import reborncore.client.gui.SlotFake;
|
||||
import reborncore.client.gui.SlotFluid;
|
||||
import reborncore.client.gui.SlotOutput;
|
||||
import reborncore.common.container.RebornContainer;
|
||||
import techreborn.tiles.TileThermalGenerator;
|
||||
|
||||
public class ContainerThermalGenerator extends TechRebornContainer {
|
||||
public class ContainerThermalGenerator extends RebornContainer {
|
||||
public TileThermalGenerator tileThermalGenerator;
|
||||
public EntityPlayer player;
|
||||
|
||||
|
|
|
@ -1,114 +0,0 @@
|
|||
package techreborn.client.container;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.client.SlotFake;
|
||||
|
||||
public abstract class TechRebornContainer extends Container {
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
|
||||
ItemStack originalStack = null;
|
||||
Slot slot = (Slot) inventorySlots.get(slotIndex);
|
||||
int numSlots = inventorySlots.size();
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
ItemStack stackInSlot = slot.getStack();
|
||||
originalStack = stackInSlot.copy();
|
||||
if (slotIndex >= numSlots - 9 * 4 && tryShiftItem(stackInSlot, numSlots)) {
|
||||
// NOOP
|
||||
} else if (slotIndex >= numSlots - 9 * 4 && slotIndex < numSlots - 9) {
|
||||
if (!shiftItemStack(stackInSlot, numSlots - 9, numSlots)) {
|
||||
return null;
|
||||
}
|
||||
} else if (slotIndex >= numSlots - 9 && slotIndex < numSlots) {
|
||||
if (!shiftItemStack(stackInSlot, numSlots - 9 * 4, numSlots - 9)) {
|
||||
return null;
|
||||
}
|
||||
} else if (!shiftItemStack(stackInSlot, numSlots - 9 * 4, numSlots)) {
|
||||
return null;
|
||||
}
|
||||
slot.onSlotChange(stackInSlot, originalStack);
|
||||
if (stackInSlot.stackSize <= 0) {
|
||||
slot.putStack(null);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
if (stackInSlot.stackSize == originalStack.stackSize) {
|
||||
return null;
|
||||
}
|
||||
slot.onPickupFromSlot(player, stackInSlot);
|
||||
}
|
||||
return originalStack;
|
||||
}
|
||||
|
||||
protected boolean shiftItemStack(ItemStack stackToShift, int start, int end) {
|
||||
boolean changed = false;
|
||||
if (stackToShift.isStackable()) {
|
||||
for (int slotIndex = start; stackToShift.stackSize > 0 && slotIndex < end; slotIndex++) {
|
||||
Slot slot = (Slot) inventorySlots.get(slotIndex);
|
||||
ItemStack stackInSlot = slot.getStack();
|
||||
if (stackInSlot != null && canStacksMerge(stackInSlot, stackToShift)) {
|
||||
int resultingStackSize = stackInSlot.stackSize + stackToShift.stackSize;
|
||||
int max = Math.min(stackToShift.getMaxStackSize(), slot.getSlotStackLimit());
|
||||
if (resultingStackSize <= max) {
|
||||
stackToShift.stackSize = 0;
|
||||
stackInSlot.stackSize = resultingStackSize;
|
||||
slot.onSlotChanged();
|
||||
changed = true;
|
||||
} else if (stackInSlot.stackSize < max) {
|
||||
stackToShift.stackSize -= max - stackInSlot.stackSize;
|
||||
stackInSlot.stackSize = max;
|
||||
slot.onSlotChanged();
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (stackToShift.stackSize > 0) {
|
||||
for (int slotIndex = start; stackToShift.stackSize > 0 && slotIndex < end; slotIndex++) {
|
||||
Slot slot = (Slot) inventorySlots.get(slotIndex);
|
||||
ItemStack stackInSlot = slot.getStack();
|
||||
if (stackInSlot == null) {
|
||||
int max = Math.min(stackToShift.getMaxStackSize(), slot.getSlotStackLimit());
|
||||
stackInSlot = stackToShift.copy();
|
||||
stackInSlot.stackSize = Math.min(stackToShift.stackSize, max);
|
||||
stackToShift.stackSize -= stackInSlot.stackSize;
|
||||
slot.putStack(stackInSlot);
|
||||
slot.onSlotChanged();
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
private boolean tryShiftItem(ItemStack stackToShift, int numSlots) {
|
||||
for (int machineIndex = 0; machineIndex < numSlots - 9 * 4; machineIndex++) {
|
||||
Slot slot = (Slot) inventorySlots.get(machineIndex);
|
||||
if (slot instanceof SlotFake) {
|
||||
continue;
|
||||
}
|
||||
if (!slot.isItemValid(stackToShift))
|
||||
continue;
|
||||
if (shiftItemStack(stackToShift, machineIndex, machineIndex + 1))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean canStacksMerge(ItemStack stack1, ItemStack stack2) {
|
||||
if (stack1 == null || stack2 == null) {
|
||||
return false;
|
||||
}
|
||||
if (!stack1.isItemEqual(stack2)) {
|
||||
return false;
|
||||
}
|
||||
if (!ItemStack.areItemStackTagsEqual(stack1, stack2)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
|
@ -5,9 +5,9 @@ import net.minecraft.client.gui.inventory.GuiContainer;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import reborncore.common.packets.PacketHandler;
|
||||
import techreborn.client.container.ContainerAesu;
|
||||
import techreborn.packets.PacketAesu;
|
||||
import techreborn.packets.PacketHandler;
|
||||
import techreborn.tiles.TileAesu;
|
||||
|
||||
import java.awt.*;
|
||||
|
|
|
@ -41,8 +41,7 @@ public class GuiAlloyFurnace extends GuiContainer {
|
|||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
if (this.alloyfurnace.isBurning())
|
||||
{
|
||||
if (this.alloyfurnace.isBurning()) {
|
||||
int i1 = this.alloyfurnace.getBurnTimeRemainingScaled(13);
|
||||
this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1);
|
||||
i1 = this.alloyfurnace.getCookProgressScaled(24);
|
||||
|
@ -51,7 +50,6 @@ public class GuiAlloyFurnace extends GuiContainer {
|
|||
}
|
||||
|
||||
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_,
|
||||
int p_146979_2_) {
|
||||
String name = StatCollector.translateToLocal("tile.techreborn.alloyfurnace.name");
|
||||
|
|
|
@ -8,10 +8,10 @@ import net.minecraft.util.ChunkCoordinates;
|
|||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import techreborn.client.GuiUtil;
|
||||
import reborncore.client.gui.GuiUtil;
|
||||
import reborncore.client.multiblock.Multiblock;
|
||||
import reborncore.client.multiblock.MultiblockSet;
|
||||
import techreborn.client.container.ContainerBlastFurnace;
|
||||
import techreborn.client.multiblock.Multiblock;
|
||||
import techreborn.client.multiblock.MultiblockSet;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.lib.ModInfo;
|
||||
import techreborn.proxies.ClientProxy;
|
||||
|
@ -38,8 +38,8 @@ public class GuiBlastFurnace extends GuiContainer {
|
|||
public void initGui() {
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
GuiButton button = new GuiButton(212, k + 4, l + 6, 20, 20, "");
|
||||
buttonList.add(button);
|
||||
GuiButton button = new GuiButton(212, k + 4, l + 6, 20, 20, "");
|
||||
buttonList.add(button);
|
||||
super.initGui();
|
||||
}
|
||||
|
||||
|
@ -78,60 +78,60 @@ 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);
|
||||
|
||||
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";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@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, 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";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,6 +58,6 @@ public class GuiCentrifuge extends GuiContainer {
|
|||
this.fontRendererObj.drawString(namePt1, 98, 6, 4210752);
|
||||
this.fontRendererObj.drawString(namePt2, 98, 14, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
|
||||
this.fontRendererObj.drawString(centrifuge.getProgressScaled(100) + "%", 98, this.ySize - 96 + 2, 4210752);
|
||||
this.fontRendererObj.drawString(centrifuge.getProgressScaled(100) + "%", 98, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import techreborn.client.GuiUtil;
|
||||
import reborncore.client.gui.GuiUtil;
|
||||
import techreborn.client.container.ContainerGrinder;
|
||||
import techreborn.lib.ModInfo;
|
||||
import techreborn.tiles.TileGrinder;
|
||||
|
|
|
@ -1,30 +1,27 @@
|
|||
package techreborn.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import techreborn.Core;
|
||||
import reborncore.common.packets.PacketHandler;
|
||||
import techreborn.client.container.ContainerIDSU;
|
||||
import techreborn.cofhLib.gui.GuiBase;
|
||||
import techreborn.cofhLib.gui.element.ElementListBox;
|
||||
import techreborn.cofhLib.gui.element.ElementTextField;
|
||||
import techreborn.cofhLib.gui.element.ElementTextFieldLimited;
|
||||
import techreborn.packets.PacketIdsu;
|
||||
import techreborn.tiles.idsu.TileIDSU;
|
||||
import techreborn.util.LogHelper;
|
||||
|
||||
public class GuiIDSU extends GuiBase {
|
||||
import java.awt.*;
|
||||
|
||||
public class GuiIDSU extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation(
|
||||
"techreborn", "textures/gui/aesu.png");
|
||||
|
||||
|
||||
TileIDSU idsu;
|
||||
|
||||
ContainerIDSU containerIDSU;
|
||||
|
||||
public static ElementListBox listBox = new ElementListBox(null, 10, 28, 100, 40);
|
||||
|
||||
ElementTextFieldLimited idFeild;
|
||||
ElementTextField nameFeild;
|
||||
|
||||
public GuiIDSU(EntityPlayer player, TileIDSU tileIDSU) {
|
||||
super(new ContainerIDSU(tileIDSU, player));
|
||||
|
@ -32,10 +29,6 @@ public class GuiIDSU extends GuiBase {
|
|||
this.ySize = 165;
|
||||
idsu = tileIDSU;
|
||||
this.containerIDSU = (ContainerIDSU) this.inventorySlots;
|
||||
texture = new ResourceLocation("techreborn", "textures/gui/aesu.png");
|
||||
drawTitle = false;
|
||||
drawInventory = false;
|
||||
name = StatCollector.translateToLocal("tile.techreborn.aesu.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -49,36 +42,29 @@ public class GuiIDSU extends GuiBase {
|
|||
this.buttonList.add(new GuiButton(2, k + 128, l + 5 + (20 * 2), 15, 15, "-"));
|
||||
this.buttonList.add(new GuiButton(3, k + 128, l + 5 + (20 * 3), 15, 15, "--"));
|
||||
this.buttonList.add(new GuiButton(4, k + 40, l + 10, 10, 10, "+"));
|
||||
}
|
||||
|
||||
listBox.gui = this;
|
||||
listBox.setSelectedIndex(containerIDSU.channel);
|
||||
|
||||
// listBox.borderColor = new GuiColor(120, 120, 120, 0).getColor();
|
||||
// listBox.backgroundColor = new GuiColor(0, 0, 0, 32).getColor();
|
||||
addElement(listBox);
|
||||
|
||||
idFeild = new ElementTextFieldLimited(this, 10, 10, 30, 10, (short) 4);
|
||||
idFeild.setFilter("1234567890", false);
|
||||
|
||||
addElement(idFeild);
|
||||
|
||||
nameFeild = new ElementTextField(this, 70, 10, 50, 10);
|
||||
|
||||
addElement(nameFeild);
|
||||
|
||||
// tabs.add(new TabIDConfig(this));
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_,
|
||||
int p_146976_2_, int p_146976_3_) {
|
||||
this.mc.getTextureManager().bindTexture(texture);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_,
|
||||
int p_146979_2_) {
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("tile.techreborn.idsu.name"), 40, 10, Color.WHITE.getRGB());
|
||||
this.fontRendererObj.drawString(containerIDSU.euOut + " eu/tick", 10, 20, Color.WHITE.getRGB());
|
||||
this.fontRendererObj.drawString(containerIDSU.storedEu + " eu", 10, 30, Color.WHITE.getRGB());
|
||||
this.fontRendererObj.drawString(containerIDSU.euChange + " eu change", 10, 40, Color.WHITE.getRGB());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton button) {
|
||||
super.actionPerformed(button);
|
||||
if (isInteger(idFeild.getText())) {
|
||||
Core.packetPipeline.sendToServer(new PacketIdsu(button.id, idsu, Integer.parseInt(idFeild.getText()), nameFeild.getText()));
|
||||
} else {
|
||||
LogHelper.info("There was an issue in the gui!, Please report this to the TechReborn Devs");
|
||||
}
|
||||
PacketHandler.sendPacketToServer(new PacketIdsu(button.id, idsu));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import techreborn.client.GuiUtil;
|
||||
import reborncore.client.gui.GuiUtil;
|
||||
import techreborn.client.container.ContainerIndustrialSawmill;
|
||||
import techreborn.lib.ModInfo;
|
||||
import techreborn.tiles.TileIndustrialSawmill;
|
||||
|
|
|
@ -39,7 +39,7 @@ public class GuiQuantumChest extends GuiContainer {
|
|||
I18n.format("container.inventory", new Object[0]), 8,
|
||||
this.ySize - 96 + 2, 4210752);
|
||||
this.fontRendererObj.drawString("Amount", 10, 20, 16448255);
|
||||
if (tile.storedItem != null && tile.getStackInSlot(1) !=null)
|
||||
if (tile.storedItem != null && tile.getStackInSlot(1) != null)
|
||||
this.fontRendererObj.drawString(tile.storedItem.stackSize + tile.getStackInSlot(1).stackSize + "", 10,
|
||||
30, 16448255);
|
||||
}
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
package techreborn.client.gui.componets;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
||||
public class GuiHiddenButton extends GuiButton {
|
||||
|
||||
public GuiHiddenButton(int id, int xPosition, int yPosition, String displayString) {
|
||||
super(id, xPosition, yPosition, displayString);
|
||||
}
|
||||
|
||||
public GuiHiddenButton(int id, int xPosition, int yPosition, int width, int height, String displayString) {
|
||||
super(id, xPosition, yPosition, width, height, displayString);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft p_146112_1_, int p_146112_2_, int p_146112_3_) {
|
||||
if (this.visible) {
|
||||
FontRenderer fontrenderer = p_146112_1_.fontRenderer;
|
||||
p_146112_1_.getTextureManager().bindTexture(buttonTextures);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.field_146123_n = p_146112_2_ >= this.xPosition && p_146112_3_ >= this.yPosition && p_146112_2_ < this.xPosition + this.width && p_146112_3_ < this.yPosition + this.height;
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
this.mouseDragged(p_146112_1_, p_146112_2_, p_146112_3_);
|
||||
int l = 14737632;
|
||||
|
||||
if (packedFGColour != 0) {
|
||||
l = packedFGColour;
|
||||
} else if (!this.enabled) {
|
||||
l = 10526880;
|
||||
} else if (this.field_146123_n) {
|
||||
l = 16777120;
|
||||
}
|
||||
|
||||
this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, l);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package techreborn.client.gui.componets;
|
||||
|
||||
import techreborn.cofhLib.gui.GuiBase;
|
||||
import techreborn.cofhLib.gui.element.TabBase;
|
||||
|
||||
/**
|
||||
* Created by mark on 18/06/15.
|
||||
*/
|
||||
public class TabIDConfig extends TabBase {
|
||||
public TabIDConfig(GuiBase gui) {
|
||||
super(gui);
|
||||
}
|
||||
}
|
|
@ -13,10 +13,10 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import reborncore.common.util.Color;
|
||||
import techreborn.api.power.IEnergyInterfaceItem;
|
||||
import techreborn.client.keybindings.KeyBindings;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.util.Color;
|
||||
|
||||
public class ChargeHud {
|
||||
public static final ChargeHud instance = new ChargeHud();
|
||||
|
|
|
@ -2,8 +2,8 @@ package techreborn.client.keybindings;
|
|||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.InputEvent;
|
||||
import techreborn.Core;
|
||||
import techreborn.lib.Key;
|
||||
import techreborn.util.LogHelper;
|
||||
|
||||
public class KeyInputEventHandler {
|
||||
private static Key getPressedKeybinding() {
|
||||
|
@ -16,7 +16,7 @@ public class KeyInputEventHandler {
|
|||
|
||||
@SubscribeEvent
|
||||
public void handleKeyInputEvent(InputEvent.KeyInputEvent event) {
|
||||
LogHelper.info(getPressedKeybinding());
|
||||
Core.logHelper.info(getPressedKeybinding());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,28 +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
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*/
|
||||
package techreborn.client.multiblock;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
/**
|
||||
* A hook for rendering blocks in the multiblock display.
|
||||
*/
|
||||
public interface IMultiblockRenderHook {
|
||||
|
||||
public static Map<Block, IMultiblockRenderHook> renderHooks = new HashMap();
|
||||
|
||||
public void renderBlockForMultiblock(IBlockAccess world, Multiblock mb, Block block, int meta, RenderBlocks renderBlocks);
|
||||
|
||||
}
|
|
@ -1,152 +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
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*/
|
||||
package techreborn.client.multiblock;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import techreborn.client.multiblock.component.MultiblockComponent;
|
||||
|
||||
/**
|
||||
* This class describes a Mutiblock object. It's used to display a
|
||||
* multiblock in the pda and to show the player in a ghost-like
|
||||
* look in the world.
|
||||
*/
|
||||
public class Multiblock {
|
||||
|
||||
public List<MultiblockComponent> components = new ArrayList();
|
||||
public List<ItemStack> materials = new ArrayList();
|
||||
|
||||
public int minX, minY, minZ, maxX, maxY, maxZ, offX, offY, offZ;
|
||||
|
||||
/**
|
||||
* Adds a multiblock component to this multiblock. The component's x y z
|
||||
* coords should be pivoted to the center of the structure.
|
||||
*/
|
||||
public void addComponent(MultiblockComponent component) {
|
||||
components.add(component);
|
||||
changeAxisForNewComponent(component.relPos.posX, component.relPos.posY, component.relPos.posZ);
|
||||
calculateCostForNewComponent(component);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs and adds a multiblock component to this multiblock. The x y z
|
||||
* coords should be pivoted to the center of the structure.
|
||||
*/
|
||||
public void addComponent(int x, int y, int z, Block block, int meta) {
|
||||
addComponent(new MultiblockComponent(new ChunkCoordinates(x, y, z), block, meta));
|
||||
}
|
||||
|
||||
private void changeAxisForNewComponent(int x, int y, int z) {
|
||||
if(x < minX)
|
||||
minX = x;
|
||||
else if(x > maxX)
|
||||
maxX = x;
|
||||
|
||||
if(y < minY)
|
||||
minY = y;
|
||||
else if(y > maxY)
|
||||
maxY = y;
|
||||
|
||||
if(z < minZ)
|
||||
minZ = z;
|
||||
else if(z > maxZ)
|
||||
maxZ = z;
|
||||
}
|
||||
|
||||
private void calculateCostForNewComponent(MultiblockComponent comp) {
|
||||
ItemStack[] materials = comp.getMaterials();
|
||||
if(materials != null)
|
||||
for(ItemStack stack : materials)
|
||||
addStack(stack);
|
||||
}
|
||||
|
||||
private void addStack(ItemStack stack) {
|
||||
if(stack == null)
|
||||
return;
|
||||
|
||||
for(ItemStack oStack : materials)
|
||||
if(oStack.isItemEqual(stack) && ItemStack.areItemStackTagsEqual(oStack, stack)) {
|
||||
oStack.stackSize += stack.stackSize;
|
||||
return;
|
||||
}
|
||||
|
||||
materials.add(stack);
|
||||
}
|
||||
|
||||
public void setRenderOffset(int x, int y, int z) {
|
||||
offX = x;
|
||||
offY = y;
|
||||
offZ = z;
|
||||
}
|
||||
|
||||
public List<MultiblockComponent> getComponents() {
|
||||
return components;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotates this multiblock by the angle passed in. For the best results, use
|
||||
* only multiples of pi/2.
|
||||
*/
|
||||
public void rotate(double angle) {
|
||||
for(MultiblockComponent comp : getComponents())
|
||||
comp.rotate(angle);
|
||||
}
|
||||
|
||||
public Multiblock copy() {
|
||||
Multiblock mb = new Multiblock();
|
||||
for(MultiblockComponent comp : getComponents())
|
||||
mb.addComponent(comp.copy());
|
||||
|
||||
return mb;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a length 4 array of all the rotations multiple of pi/2 required
|
||||
* to render this multiblock in the world relevant to the 4 cardinal
|
||||
* orientations.
|
||||
*/
|
||||
public Multiblock[] createRotations() {
|
||||
Multiblock[] blocks = new Multiblock[4];
|
||||
blocks[0] = this;
|
||||
blocks[1] = blocks[0].copy();
|
||||
blocks[1].rotate(Math.PI / 2);
|
||||
blocks[2] = blocks[1].copy();
|
||||
blocks[2].rotate(Math.PI / 2);
|
||||
blocks[3] = blocks[2].copy();
|
||||
blocks[3].rotate(Math.PI / 2);
|
||||
|
||||
return blocks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a MultiblockSet from this Multiblock and its rotations using
|
||||
* createRotations().
|
||||
*/
|
||||
public MultiblockSet makeSet() {
|
||||
return new MultiblockSet(this);
|
||||
}
|
||||
|
||||
public int getXSize() {
|
||||
return Math.abs(minX) + Math.abs(maxX) + 1;
|
||||
}
|
||||
|
||||
public int getYSize() {
|
||||
return Math.abs(minY) + Math.abs(maxY) + 1;
|
||||
}
|
||||
|
||||
public int getZSize() {
|
||||
return Math.abs(minZ) + Math.abs(maxZ) + 1;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,42 +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
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*/
|
||||
package techreborn.client.multiblock;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
/**
|
||||
* A set of Multiblock objects for various rotations.
|
||||
*/
|
||||
public class MultiblockSet {
|
||||
|
||||
private final Multiblock[] mbs;
|
||||
|
||||
public MultiblockSet(Multiblock[] mbs) {
|
||||
this.mbs = mbs;
|
||||
}
|
||||
|
||||
public MultiblockSet(Multiblock mb) {
|
||||
this(mb.createRotations());
|
||||
}
|
||||
|
||||
public Multiblock getForEntity(Entity e) {
|
||||
return getForRotation(e.rotationYaw);
|
||||
}
|
||||
|
||||
public Multiblock getForRotation(double rotation) {
|
||||
int facing = MathHelper.floor_double(rotation * 4.0 / 360.0 + 0.5) & 3;
|
||||
return getForIndex(facing);
|
||||
}
|
||||
|
||||
public Multiblock getForIndex(int index) {
|
||||
return mbs[index];
|
||||
}
|
||||
}
|
|
@ -1,67 +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
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*/
|
||||
package techreborn.client.multiblock.component;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* A component of a multiblock, the normal one
|
||||
* is just a block.
|
||||
*/
|
||||
public class MultiblockComponent {
|
||||
|
||||
public ChunkCoordinates relPos;
|
||||
public final Block block;
|
||||
public final int meta;
|
||||
|
||||
public MultiblockComponent(ChunkCoordinates relPos, Block block, int meta) {
|
||||
this.relPos = relPos;
|
||||
this.block = block;
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
public ChunkCoordinates getRelativePosition() {
|
||||
return relPos;
|
||||
}
|
||||
|
||||
public Block getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
public int getMeta() {
|
||||
return meta;
|
||||
}
|
||||
|
||||
public boolean matches(World world, int x, int y, int z) {
|
||||
return world.getBlock(x, y, z) == getBlock() && (meta == -1 || world.getBlockMetadata(x, y, z) == meta);
|
||||
}
|
||||
|
||||
public ItemStack[] getMaterials() {
|
||||
return new ItemStack[] { new ItemStack(block, 1, meta) };
|
||||
}
|
||||
|
||||
public void rotate(double angle) {
|
||||
double x = relPos.posX;
|
||||
double z = relPos.posZ;
|
||||
double sin = Math.sin(angle);
|
||||
double cos = Math.cos(angle);
|
||||
|
||||
double xn = x * cos - z * sin;
|
||||
double zn = x * sin + z * cos;
|
||||
relPos = new ChunkCoordinates((int) Math.round(xn), relPos.posY, (int) Math.round(zn));
|
||||
}
|
||||
|
||||
public MultiblockComponent copy() {
|
||||
return new MultiblockComponent(relPos, block, meta);
|
||||
}
|
||||
}
|
|
@ -2,10 +2,9 @@
|
|||
* 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;
|
||||
|
||||
|
@ -16,97 +15,91 @@ 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.ChatComponentText;
|
||||
import net.minecraft.util.ChatStyle;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
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 techreborn.client.multiblock.IMultiblockRenderHook;
|
||||
import techreborn.client.multiblock.Multiblock;
|
||||
import techreborn.client.multiblock.MultiblockSet;
|
||||
import techreborn.client.multiblock.component.MultiblockComponent;
|
||||
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;
|
||||
public static boolean rendering = false;
|
||||
|
||||
private static RenderBlocks blockRender = RenderBlocks.getInstance();
|
||||
public MultiblockSet currentMultiblock;
|
||||
public static ChunkCoordinates anchor;
|
||||
public static int angle;
|
||||
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;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
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;
|
||||
|
||||
if(!didAny) {
|
||||
setMultiblock(null);
|
||||
player.addChatComponentMessage(new ChatComponentText("Structure Complete!").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GREEN)));
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
|
||||
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;
|
||||
if (!didAny) {
|
||||
setMultiblock(null);
|
||||
player.addChatComponentMessage(new ChatComponentText("Structure Complete!").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GREEN)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,13 +7,12 @@ import ic2.api.item.IC2Items;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import reborncore.common.misc.Functions;
|
||||
import reborncore.common.misc.vecmath.Vecs3d;
|
||||
import reborncore.common.misc.vecmath.Vecs3dCube;
|
||||
import techreborn.client.IconSupplier;
|
||||
import techreborn.lib.Functions;
|
||||
import techreborn.lib.vecmath.Vecs3d;
|
||||
import techreborn.lib.vecmath.Vecs3dCube;
|
||||
import techreborn.partSystem.parts.CablePart;
|
||||
|
||||
|
||||
|
@ -59,7 +58,7 @@ public class RenderCablePart {
|
|||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static IIcon getIconFromType(int cableType) {
|
||||
if(IC2Classic.getLoadedIC2Type() == IC2Classic.IC2Type.SpeigersClassic){
|
||||
if (IC2Classic.getLoadedIC2Type() == IC2Classic.IC2Type.SpeigersClassic) {
|
||||
return Block.getBlockFromItem(IC2Items.getItem("copperCableBlock").getItem()).getIcon(0, cableType * 16);
|
||||
}
|
||||
IIcon p = null;
|
||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.client.resources.IResourceManager;
|
|||
import net.minecraft.client.resources.data.AnimationMetadataSection;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import reborncore.client.texture.ConnectedTexture;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
@ -42,17 +43,17 @@ public class CasingConnectedTextureGenerator extends TextureAtlasSprite {
|
|||
for (int i = 0; i < type_data.length; i += 1) {
|
||||
int x = (i % w);
|
||||
int y = (i - x) / w;
|
||||
if(getAlpha(edge_data[i]) != 0){
|
||||
if(y <= 1 && connectedTexture.isUp()){
|
||||
if (getAlpha(edge_data[i]) != 0) {
|
||||
if (y <= 1 && connectedTexture.isUp()) {
|
||||
new_data[i] = edge_data[i];
|
||||
}
|
||||
if(y >= 14 && connectedTexture.isDown()){
|
||||
if (y >= 14 && connectedTexture.isDown()) {
|
||||
new_data[i] = edge_data[i];
|
||||
}
|
||||
if(x <= 1 && connectedTexture.isRight()){
|
||||
if (x <= 1 && connectedTexture.isRight()) {
|
||||
new_data[i] = edge_data[i];
|
||||
}
|
||||
if(x >= 14 && connectedTexture.isLeft()){
|
||||
if (x >= 14 && connectedTexture.isLeft()) {
|
||||
new_data[i] = edge_data[i];
|
||||
}
|
||||
}
|
||||
|
@ -109,7 +110,7 @@ public class CasingConnectedTextureGenerator extends TextureAtlasSprite {
|
|||
output_image = new BufferedImage(w, h, 2);
|
||||
int[] type_data = new int[w * w];
|
||||
int[] edge_data = new int[w * w];
|
||||
|
||||
|
||||
for (int y = 0; y < h; y += w) {
|
||||
type_image[0].getRGB(0, y, w, w, type_data, 0, w);
|
||||
edge_image[0].getRGB(0, y, w, w, edge_data, 0, w);
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
package techreborn.client.texture;
|
||||
|
||||
public class ConnectedTexture {
|
||||
|
||||
private boolean up, down, left, right;
|
||||
|
||||
|
||||
public ConnectedTexture(boolean up, boolean down, boolean left, boolean right) {
|
||||
this.up = up;
|
||||
this.down = down;
|
||||
this.left = left;
|
||||
this.right = right;
|
||||
}
|
||||
|
||||
public boolean isUp() {
|
||||
return up;
|
||||
}
|
||||
|
||||
public void setUp(boolean up) {
|
||||
this.up = up;
|
||||
}
|
||||
|
||||
public boolean isDown() {
|
||||
return down;
|
||||
}
|
||||
|
||||
public void setDown(boolean down) {
|
||||
this.down = down;
|
||||
}
|
||||
|
||||
public boolean isLeft() {
|
||||
return left;
|
||||
}
|
||||
|
||||
public void setLeft(boolean left) {
|
||||
this.left = left;
|
||||
}
|
||||
|
||||
public boolean isRight() {
|
||||
return right;
|
||||
}
|
||||
|
||||
public void setRight(boolean right) {
|
||||
this.right = right;
|
||||
}
|
||||
|
||||
}
|
|
@ -9,6 +9,7 @@ import net.minecraft.client.resources.IResourceManager;
|
|||
import net.minecraft.client.resources.data.AnimationMetadataSection;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import reborncore.client.texture.ConnectedTexture;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
@ -45,17 +46,17 @@ public class LesuConnectedTextureGenerator extends TextureAtlasSprite {
|
|||
for (int i = 0; i < type_data.length; i += 1) {
|
||||
int x = (i % w);
|
||||
int y = (i - x) / w;
|
||||
if(getAlpha(edge_data[i]) != 0){
|
||||
if(y <= 1 && connectedTexture.isUp()){
|
||||
if (getAlpha(edge_data[i]) != 0) {
|
||||
if (y <= 1 && connectedTexture.isUp()) {
|
||||
new_data[i] = edge_data[i];
|
||||
}
|
||||
if(y >= 14 && connectedTexture.isDown()){
|
||||
if (y >= 14 && connectedTexture.isDown()) {
|
||||
new_data[i] = edge_data[i];
|
||||
}
|
||||
if(x <= 1 && connectedTexture.isRight()){
|
||||
if (x <= 1 && connectedTexture.isRight()) {
|
||||
new_data[i] = edge_data[i];
|
||||
}
|
||||
if(x >= 14 && connectedTexture.isLeft()){
|
||||
if (x >= 14 && connectedTexture.isLeft()) {
|
||||
new_data[i] = edge_data[i];
|
||||
}
|
||||
}
|
||||
|
@ -112,7 +113,7 @@ public class LesuConnectedTextureGenerator extends TextureAtlasSprite {
|
|||
output_image = new BufferedImage(w, h, 2);
|
||||
int[] type_data = new int[w * w];
|
||||
int[] edge_data = new int[w * w];
|
||||
|
||||
|
||||
for (int y = 0; y < h; y += w) {
|
||||
try {
|
||||
type_image[0].getRGB(0, y, w, w, type_data, 0, w);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue