mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
rotate to always show controller at bottom right
This commit is contained in:
parent
c978fa8955
commit
a636440d13
@ -56,7 +56,7 @@ public class MachinePWRController extends BlockContainer implements ITooltipProv
|
|||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(int side, int metadata) {
|
public IIcon getIcon(int side, int metadata) {
|
||||||
return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : this.blockIcon);
|
return metadata == 0 && side != 0 && side != 1 ? this.iconFront : (side == metadata ? this.iconFront : this.blockIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -18,12 +18,14 @@ import net.minecraft.client.renderer.Tessellator;
|
|||||||
import net.minecraft.client.renderer.texture.TextureMap;
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.ChatComponentText;
|
import net.minecraft.util.ChatComponentText;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class GUIScreenSlicePrinter extends GuiScreen {
|
public class GUIScreenSlicePrinter extends GuiScreen {
|
||||||
|
|
||||||
private final int x1, y1, z1;
|
private final int x1, y1, z1;
|
||||||
private final int x2, y2, z2;
|
private final int x2, y2, z2;
|
||||||
private final int sizeX, sizeY, sizeZ;
|
private final int sizeX, sizeY, sizeZ;
|
||||||
|
private final ForgeDirection dir;
|
||||||
|
|
||||||
private HashSet<Block> whitelist;
|
private HashSet<Block> whitelist;
|
||||||
|
|
||||||
@ -34,7 +36,7 @@ public class GUIScreenSlicePrinter extends GuiScreen {
|
|||||||
private String dirname;
|
private String dirname;
|
||||||
private static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss");
|
private static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss");
|
||||||
|
|
||||||
public GUIScreenSlicePrinter(int x1, int y1, int z1, int x2, int y2, int z2) {
|
public GUIScreenSlicePrinter(int x1, int y1, int z1, int x2, int y2, int z2, ForgeDirection dir) {
|
||||||
this.x1 = Math.min(x1, x2);
|
this.x1 = Math.min(x1, x2);
|
||||||
this.y1 = Math.min(y1, y2);
|
this.y1 = Math.min(y1, y2);
|
||||||
this.z1 = Math.min(z1, z2);
|
this.z1 = Math.min(z1, z2);
|
||||||
@ -42,6 +44,8 @@ public class GUIScreenSlicePrinter extends GuiScreen {
|
|||||||
this.y2 = Math.max(y1, y2);
|
this.y2 = Math.max(y1, y2);
|
||||||
this.z2 = Math.max(z1, z2);
|
this.z2 = Math.max(z1, z2);
|
||||||
|
|
||||||
|
this.dir = dir;
|
||||||
|
|
||||||
this.sizeX = this.x2 - this.x1 + 1;
|
this.sizeX = this.x2 - this.x1 + 1;
|
||||||
this.sizeY = this.y2 - this.y1 + 1;
|
this.sizeY = this.y2 - this.y1 + 1;
|
||||||
this.sizeZ = this.z2 - this.z1 + 1;
|
this.sizeZ = this.z2 - this.z1 + 1;
|
||||||
@ -49,8 +53,8 @@ public class GUIScreenSlicePrinter extends GuiScreen {
|
|||||||
dirname = dateFormat.format(new Date()).toString();
|
dirname = dateFormat.format(new Date()).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public GUIScreenSlicePrinter(int x1, int y1, int z1, int x2, int y2, int z2, HashSet<Block> whitelist) {
|
public GUIScreenSlicePrinter(int x1, int y1, int z1, int x2, int y2, int z2, ForgeDirection dir, HashSet<Block> whitelist) {
|
||||||
this(x1, y1, z1, x2, y2, z2);
|
this(x1, y1, z1, x2, y2, z2, dir);
|
||||||
this.whitelist = whitelist;
|
this.whitelist = whitelist;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,7 +125,20 @@ public class GUIScreenSlicePrinter extends GuiScreen {
|
|||||||
|
|
||||||
GL11.glRotated(-30, 1, 0, 0);
|
GL11.glRotated(-30, 1, 0, 0);
|
||||||
GL11.glRotated(-45, 0, 1, 0);
|
GL11.glRotated(-45, 0, 1, 0);
|
||||||
GL11.glTranslated(sizeX / -2D, -sizeY / 2D, sizeZ / -2D);
|
|
||||||
|
if(dir == ForgeDirection.WEST) {
|
||||||
|
GL11.glRotated(180, 0, 1, 0);
|
||||||
|
} else if(dir == ForgeDirection.NORTH) {
|
||||||
|
GL11.glRotated(-90, 0, 1, 0);
|
||||||
|
} else if(dir == ForgeDirection.SOUTH) {
|
||||||
|
GL11.glRotated(90, 0, 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(dir == ForgeDirection.WEST || dir == ForgeDirection.EAST) {
|
||||||
|
GL11.glTranslated(sizeX / -2D, -sizeY / 2D, sizeZ / -2D);
|
||||||
|
} else {
|
||||||
|
GL11.glTranslated(sizeZ / -2D, -sizeY / 2D, sizeX / -2D);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,6 +29,7 @@ public class ItemPWRPrinter extends Item implements IGUIProvider {
|
|||||||
private static int x1, y1, z1;
|
private static int x1, y1, z1;
|
||||||
private static int x2, y2, z2;
|
private static int x2, y2, z2;
|
||||||
private static Block[] blockSync;
|
private static Block[] blockSync;
|
||||||
|
private static ForgeDirection dir;
|
||||||
|
|
||||||
private HashSet<BlockPos> fill = new HashSet<>();
|
private HashSet<BlockPos> fill = new HashSet<>();
|
||||||
private static HashSet<Block> whitelist = new HashSet<Block>() {{
|
private static HashSet<Block> whitelist = new HashSet<Block>() {{
|
||||||
@ -44,6 +45,7 @@ public class ItemPWRPrinter extends Item implements IGUIProvider {
|
|||||||
buf.writeInt(x2);
|
buf.writeInt(x2);
|
||||||
buf.writeInt(y2);
|
buf.writeInt(y2);
|
||||||
buf.writeInt(z2);
|
buf.writeInt(z2);
|
||||||
|
buf.writeInt(dir.ordinal());
|
||||||
|
|
||||||
for(Block block : blockSync) {
|
for(Block block : blockSync) {
|
||||||
buf.writeInt(Block.getIdFromBlock(block));
|
buf.writeInt(Block.getIdFromBlock(block));
|
||||||
@ -59,6 +61,7 @@ public class ItemPWRPrinter extends Item implements IGUIProvider {
|
|||||||
x2 = buf.readInt();
|
x2 = buf.readInt();
|
||||||
y2 = buf.readInt();
|
y2 = buf.readInt();
|
||||||
z2 = buf.readInt();
|
z2 = buf.readInt();
|
||||||
|
dir = ForgeDirection.values()[buf.readInt()];
|
||||||
|
|
||||||
for(int x = x1; x <= x2; x++) {
|
for(int x = x1; x <= x2; x++) {
|
||||||
for(int y = y1; y <= y2; y++) {
|
for(int y = y1; y <= y2; y++) {
|
||||||
@ -121,7 +124,7 @@ public class ItemPWRPrinter extends Item implements IGUIProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void findBounds(World world, TileEntityPWRController pwr) {
|
public void findBounds(World world, TileEntityPWRController pwr) {
|
||||||
ForgeDirection dir = ForgeDirection.getOrientation(world.getBlockMetadata(pwr.xCoord, pwr.yCoord, pwr.zCoord)).getOpposite();
|
dir = ForgeDirection.getOrientation(world.getBlockMetadata(pwr.xCoord, pwr.yCoord, pwr.zCoord)).getOpposite();
|
||||||
|
|
||||||
fill.clear();
|
fill.clear();
|
||||||
fill.add(new BlockPos(pwr.xCoord, pwr.yCoord, pwr.zCoord));
|
fill.add(new BlockPos(pwr.xCoord, pwr.yCoord, pwr.zCoord));
|
||||||
@ -161,7 +164,7 @@ public class ItemPWRPrinter extends Item implements IGUIProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||||
return new GUIScreenSlicePrinter(x1, y1, z1, x2, y2, z2, whitelist);
|
return new GUIScreenSlicePrinter(x1, y1, z1, x2, y2, z2, dir, whitelist);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user