mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 14:52:58 +00:00
Formatting and code readability cleanup (#5467)
* First pass reformatting code to be more readable (common still not done) * Replace google common collect calls with Java calls where possible * Remove a bunch of unnecessary parenthesis leaving clarifying ones * Add some missing @Nonnull annotations * Fix checking wrong type * Remove unnecessary continue/return statements and simplify comparision check * Pass exception instead of directly printing stack trace * Work on cleaning up common, through config so far * Work on cleaning up common, through integration so far * Work on cleaning up common, through network so far * Work on cleaning up common, through tier so far * Remove empty constructors that get created by default anyways * Work on cleaning up common, through transmitters so far * Work on cleaning up common, through utils so far * Finish cleaning up spacing for common
This commit is contained in:
1 parent
91ef2a5c3d
commit
0d4b50908f
909 files changed
+6234
-15623
No files matched your search
@@ -6,29 +6,27 @@ import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
||||
/**
|
||||
* Chunk3D - an integer-based way to keep track of and perform operations on chunks in a Minecraft-based environment.
|
||||
* This also takes in account the dimension the chunk is in.
|
||||
* Chunk3D - an integer-based way to keep track of and perform operations on chunks in a Minecraft-based environment. This also takes in account the dimension the chunk
|
||||
* is in.
|
||||
*
|
||||
* @author aidancbrady
|
||||
*/
|
||||
public class Chunk3D {
|
||||
|
||||
public int dimensionId;
|
||||
|
||||
public int x;
|
||||
public int z;
|
||||
|
||||
/**
|
||||
* Creates a Chunk3D object from the given x and z coordinates, as well as a dimension.
|
||||
*
|
||||
* @param x - chunk x location
|
||||
* @param z - chunk z location
|
||||
* @param x - chunk x location
|
||||
* @param z - chunk z location
|
||||
* @param dimension - the dimension this Chunk3D is in
|
||||
*/
|
||||
public Chunk3D(int x, int z, int dimension) {
|
||||
this.x = x;
|
||||
this.z = z;
|
||||
|
||||
dimensionId = dimension;
|
||||
}
|
||||
|
||||
@@ -38,9 +36,8 @@ public class Chunk3D {
|
||||
* @param entity - the entity to get the Chunk3D object from
|
||||
*/
|
||||
public Chunk3D(Entity entity) {
|
||||
x = ((int) entity.posX) >> 4;
|
||||
z = ((int) entity.posZ) >> 4;
|
||||
|
||||
x = (int) entity.posX >> 4;
|
||||
z = (int) entity.posZ >> 4;
|
||||
dimensionId = entity.dimension;
|
||||
}
|
||||
|
||||
@@ -52,7 +49,6 @@ public class Chunk3D {
|
||||
public Chunk3D(Coord4D coord) {
|
||||
x = coord.x >> 4;
|
||||
z = coord.z >> 4;
|
||||
|
||||
dimensionId = coord.dimensionId;
|
||||
}
|
||||
|
||||
@@ -60,6 +56,7 @@ public class Chunk3D {
|
||||
* Whether or not this chunk exists in the given world.
|
||||
*
|
||||
* @param world - the world to check in
|
||||
*
|
||||
* @return if the chunk exists
|
||||
*/
|
||||
public boolean exists(World world) {
|
||||
@@ -70,6 +67,7 @@ public class Chunk3D {
|
||||
* Gets a Chunk object corresponding to this Chunk3D's coordinates.
|
||||
*
|
||||
* @param world - the world to get the Chunk object from
|
||||
*
|
||||
* @return the corresponding Chunk object
|
||||
*/
|
||||
public Chunk getChunk(World world) {
|
||||
@@ -97,10 +95,7 @@ public class Chunk3D {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof Chunk3D &&
|
||||
((Chunk3D) obj).x == x &&
|
||||
((Chunk3D) obj).z == z &&
|
||||
((Chunk3D) obj).dimensionId == dimensionId;
|
||||
return obj instanceof Chunk3D && ((Chunk3D) obj).x == x && ((Chunk3D) obj).z == z && ((Chunk3D) obj).dimensionId == dimensionId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -111,4 +106,4 @@ public class Chunk3D {
|
||||
code = 31 * code + dimensionId;
|
||||
return code;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,8 +19,8 @@ import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
|
||||
/**
|
||||
* Coord4D - an integer-based way to keep track of and perform operations on blocks in a Minecraft-based environment.
|
||||
* This also takes in account the dimension the coordinate is in.
|
||||
* Coord4D - an integer-based way to keep track of and perform operations on blocks in a Minecraft-based environment. This also takes in account the dimension the
|
||||
* coordinate is in.
|
||||
*
|
||||
* @author aidancbrady
|
||||
*/
|
||||
@@ -29,7 +29,6 @@ public class Coord4D {
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
|
||||
public int dimensionId;
|
||||
|
||||
/**
|
||||
@@ -41,23 +40,21 @@ public class Coord4D {
|
||||
this.x = (int) entity.posX;
|
||||
this.y = (int) entity.posY;
|
||||
this.z = (int) entity.posZ;
|
||||
|
||||
this.dimensionId = entity.world.provider.getDimension();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Coord4D from the defined x, y, z, and dimension values.
|
||||
*
|
||||
* @param x - x coordinate
|
||||
* @param y - y coordinate
|
||||
* @param z - z coordinate
|
||||
* @param x - x coordinate
|
||||
* @param y - y coordinate
|
||||
* @param z - z coordinate
|
||||
* @param dimension - dimension ID
|
||||
*/
|
||||
public Coord4D(double x, double y, double z, int dimension) {
|
||||
this.x = MathHelper.floor(x);
|
||||
this.y = MathHelper.floor(y);
|
||||
this.z = MathHelper.floor(z);
|
||||
|
||||
this.dimensionId = dimension;
|
||||
}
|
||||
|
||||
@@ -73,6 +70,7 @@ public class Coord4D {
|
||||
* Returns a new Coord4D from a defined TileEntity's x, y and z values.
|
||||
*
|
||||
* @param tileEntity - TileEntity at the location that will represent this Coord4D
|
||||
*
|
||||
* @return the Coord4D object from the TileEntity
|
||||
*/
|
||||
public static Coord4D get(TileEntity tileEntity) {
|
||||
@@ -83,6 +81,7 @@ public class Coord4D {
|
||||
* Returns a new Coord4D from a tag compound.
|
||||
*
|
||||
* @param tag - tag compound to read from
|
||||
*
|
||||
* @return the Coord4D from the tag compound
|
||||
*/
|
||||
public static Coord4D read(NBTTagCompound tag) {
|
||||
@@ -93,6 +92,7 @@ public class Coord4D {
|
||||
* Returns a new Coord4D from a ByteBuf.
|
||||
*
|
||||
* @param dataStream - data input to read from
|
||||
*
|
||||
* @return the Coord4D from the data input
|
||||
*/
|
||||
public static Coord4D read(ByteBuf dataStream) {
|
||||
@@ -103,6 +103,7 @@ public class Coord4D {
|
||||
* Gets the state of the block representing this Coord4D.
|
||||
*
|
||||
* @param world - world this Coord4D is in
|
||||
*
|
||||
* @return the state of this Coord4D's block
|
||||
*/
|
||||
public IBlockState getBlockState(IBlockAccess world) {
|
||||
@@ -122,13 +123,13 @@ public class Coord4D {
|
||||
* Gets the TileEntity of the block representing this Coord4D.
|
||||
*
|
||||
* @param world - world this Coord4D is in
|
||||
*
|
||||
* @return the TileEntity of this Coord4D's block
|
||||
*/
|
||||
public TileEntity getTileEntity(IBlockAccess world) {
|
||||
if (world instanceof World && !exists((World) world)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return world.getTileEntity(getPos());
|
||||
}
|
||||
|
||||
@@ -136,13 +137,13 @@ public class Coord4D {
|
||||
* Gets the Block value of the block representing this Coord4D.
|
||||
*
|
||||
* @param world - world this Coord4D is in
|
||||
*
|
||||
* @return the Block value of this Coord4D's block
|
||||
*/
|
||||
public Block getBlock(IBlockAccess world) {
|
||||
if (world instanceof World && !exists((World) world)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return getBlockState(world).getBlock();
|
||||
}
|
||||
|
||||
@@ -150,6 +151,7 @@ public class Coord4D {
|
||||
* Writes this Coord4D's data to an NBTTagCompound.
|
||||
*
|
||||
* @param nbtTags - tag compound to write to
|
||||
*
|
||||
* @return the tag compound with this Coord4D's data
|
||||
*/
|
||||
public NBTTagCompound write(NBTTagCompound nbtTags) {
|
||||
@@ -157,7 +159,6 @@ public class Coord4D {
|
||||
nbtTags.setInteger("y", y);
|
||||
nbtTags.setInteger("z", z);
|
||||
nbtTags.setInteger("dimensionId", dimensionId);
|
||||
|
||||
return nbtTags;
|
||||
}
|
||||
|
||||
@@ -199,6 +200,7 @@ public class Coord4D {
|
||||
* @param x - x value to translate
|
||||
* @param y - y value to translate
|
||||
* @param z - z value to translate
|
||||
*
|
||||
* @return translated Coord4D
|
||||
*/
|
||||
public Coord4D translate(int x, int y, int z) {
|
||||
@@ -209,6 +211,7 @@ public class Coord4D {
|
||||
* Translates this Coord4D by the defined Coord4D's coordinates, regardless of dimension.
|
||||
*
|
||||
* @param coord - coordinates to translate by
|
||||
*
|
||||
* @return translated Coord4D
|
||||
*/
|
||||
public Coord4D translate(Coord4D coord) {
|
||||
@@ -219,6 +222,7 @@ public class Coord4D {
|
||||
* Creates and returns a new Coord4D translated to the defined offsets of the side.
|
||||
*
|
||||
* @param side - side to translate this Coord4D to
|
||||
*
|
||||
* @return translated Coord4D
|
||||
*/
|
||||
public Coord4D offset(EnumFacing side) {
|
||||
@@ -228,26 +232,23 @@ public class Coord4D {
|
||||
/**
|
||||
* Creates and returns a new Coord4D translated to the defined offsets of the side by the defined amount.
|
||||
*
|
||||
* @param side - side to translate this Coord4D to
|
||||
* @param side - side to translate this Coord4D to
|
||||
* @param amount - how far to translate this Coord4D
|
||||
*
|
||||
* @return translated Coord4D
|
||||
*/
|
||||
public Coord4D offset(EnumFacing side, int amount) {
|
||||
if (side == null || amount == 0) {
|
||||
return this;
|
||||
}
|
||||
|
||||
return new Coord4D(x + (side.getXOffset() * amount), y + (side.getYOffset() * amount),
|
||||
z + (side.getZOffset() * amount), dimensionId);
|
||||
return new Coord4D(x + (side.getXOffset() * amount), y + (side.getYOffset() * amount), z + (side.getZOffset() * amount), dimensionId);
|
||||
}
|
||||
|
||||
public ItemStack getStack(IBlockAccess world) {
|
||||
IBlockState state = getBlockState(world);
|
||||
|
||||
if (state == null || state.getBlock().isAir(state, world, null)) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
return new ItemStack(state.getBlock(), 1, state.getBlock().getMetaFromState(state));
|
||||
}
|
||||
|
||||
@@ -255,6 +256,7 @@ public class Coord4D {
|
||||
* Creates and returns a new Coord4D with values representing the difference between the defined Coord4D
|
||||
*
|
||||
* @param other - the Coord4D to subtract from this
|
||||
*
|
||||
* @return a Coord4D representing the distance between the defined Coord4D
|
||||
*/
|
||||
public Coord4D difference(Coord4D other) {
|
||||
@@ -262,21 +264,19 @@ public class Coord4D {
|
||||
}
|
||||
|
||||
/**
|
||||
* A method used to find the EnumFacing represented by the distance of the defined Coord4D. Most likely won't have
|
||||
* many applicable uses.
|
||||
* A method used to find the EnumFacing represented by the distance of the defined Coord4D. Most likely won't have many applicable uses.
|
||||
*
|
||||
* @param other - Coord4D to find the side difference of
|
||||
*
|
||||
* @return EnumFacing representing the side the defined relative Coord4D is on to this
|
||||
*/
|
||||
public EnumFacing sideDifference(Coord4D other) {
|
||||
Coord4D diff = difference(other);
|
||||
|
||||
for (EnumFacing side : EnumFacing.VALUES) {
|
||||
if (side.getXOffset() == diff.x && side.getYOffset() == diff.y && side.getZOffset() == diff.z) {
|
||||
return side;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -284,6 +284,7 @@ public class Coord4D {
|
||||
* Gets the distance to a defined Coord4D.
|
||||
*
|
||||
* @param obj - the Coord4D to find the distance to
|
||||
*
|
||||
* @return the distance to the defined Coord4D
|
||||
*/
|
||||
public int distanceTo(Coord4D obj) {
|
||||
@@ -294,8 +295,9 @@ public class Coord4D {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param side - side to check
|
||||
* @param side - side to check
|
||||
* @param world - world this Coord4D is in
|
||||
*
|
||||
* @return Whether or not the defined side of this Coord4D is visible.
|
||||
*/
|
||||
public boolean sideVisible(EnumFacing side, IBlockAccess world) {
|
||||
@@ -306,6 +308,7 @@ public class Coord4D {
|
||||
* Gets a TargetPoint with the defined range from this Coord4D with the appropriate coordinates and dimension ID.
|
||||
*
|
||||
* @param range - the range the packet can be sent in of this Coord4D
|
||||
*
|
||||
* @return TargetPoint relative to this Coord4D
|
||||
*/
|
||||
public TargetPoint getTargetPoint(double range) {
|
||||
@@ -316,6 +319,7 @@ public class Coord4D {
|
||||
* Steps this Coord4D in the defined side's offset without creating a new value.
|
||||
*
|
||||
* @param side - side to step towards
|
||||
*
|
||||
* @return this Coord4D
|
||||
*/
|
||||
public Coord4D step(EnumFacing side) {
|
||||
@@ -326,17 +330,18 @@ public class Coord4D {
|
||||
* Whether or not the chunk this Coord4D is in exists and is loaded.
|
||||
*
|
||||
* @param world - world this Coord4D is in
|
||||
*
|
||||
* @return the chunk of this Coord4D
|
||||
*/
|
||||
public boolean exists(World world) {
|
||||
return world.isBlockLoaded(new BlockPos(x, y,
|
||||
z));//world.getChunkProvider() == null || world.getChunkProvider().getLoadedChunk(x >> 4, z >> 4) != null;
|
||||
return world.isBlockLoaded(new BlockPos(x, y, z));//world.getChunkProvider() == null || world.getChunkProvider().getLoadedChunk(x >> 4, z >> 4) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the chunk this Coord4D is in.
|
||||
*
|
||||
* @param world - world this Coord4D is in
|
||||
*
|
||||
* @return the chunk of this Coord4D
|
||||
*/
|
||||
public Chunk getChunk(World world) {
|
||||
@@ -356,6 +361,7 @@ public class Coord4D {
|
||||
* Whether or not the block this Coord4D represents is an air block.
|
||||
*
|
||||
* @param world - world this Coord4D is in
|
||||
*
|
||||
* @return if this Coord4D is an air block
|
||||
*/
|
||||
public boolean isAirBlock(IBlockAccess world) {
|
||||
@@ -366,6 +372,7 @@ public class Coord4D {
|
||||
* Whether or not this block this Coord4D represents is replaceable.
|
||||
*
|
||||
* @param world - world this Coord4D is in
|
||||
*
|
||||
* @return if this Coord4D is replaceable
|
||||
*/
|
||||
public boolean isReplaceable(World world) {
|
||||
@@ -393,11 +400,7 @@ public class Coord4D {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof Coord4D &&
|
||||
((Coord4D) obj).x == x &&
|
||||
((Coord4D) obj).y == y &&
|
||||
((Coord4D) obj).z == z &&
|
||||
((Coord4D) obj).dimensionId == dimensionId;
|
||||
return obj instanceof Coord4D && ((Coord4D) obj).x == x && ((Coord4D) obj).y == y && ((Coord4D) obj).z == z && ((Coord4D) obj).dimensionId == dimensionId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -409,4 +412,4 @@ public class Coord4D {
|
||||
code = 31 * code + dimensionId;
|
||||
return code;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,8 +33,8 @@ public enum EnumColor implements IStringSerializable {
|
||||
BROWN("\u00a76", "brown", "Brown", new int[]{150, 75, 0}, 3, TextFormatting.GOLD),
|
||||
BRIGHT_PINK("\u00a7d", "brightPink", "Pink", new int[]{255, 192, 203}, 9, TextFormatting.LIGHT_PURPLE);
|
||||
|
||||
public static EnumColor[] DYES = new EnumColor[]{BLACK, RED, DARK_GREEN, BROWN, DARK_BLUE, PURPLE, DARK_AQUA, GREY,
|
||||
DARK_GREY, BRIGHT_PINK, BRIGHT_GREEN, YELLOW, INDIGO, PINK, ORANGE, WHITE};
|
||||
public static EnumColor[] DYES = new EnumColor[]{BLACK, RED, DARK_GREEN, BROWN, DARK_BLUE, PURPLE, DARK_AQUA, GREY, DARK_GREY, BRIGHT_PINK, BRIGHT_GREEN, YELLOW,
|
||||
INDIGO, PINK, ORANGE, WHITE};
|
||||
|
||||
/**
|
||||
* The color code that will be displayed
|
||||
@@ -66,7 +66,6 @@ public enum EnumColor implements IStringSerializable {
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -124,6 +123,7 @@ public enum EnumColor implements IStringSerializable {
|
||||
* Gets the 0-1 of this color's RGB value by dividing by 255 (used for OpenGL coloring).
|
||||
*
|
||||
* @param index - R:0, G:1, B:2
|
||||
*
|
||||
* @return the color value
|
||||
*/
|
||||
public float getColor(int index) {
|
||||
@@ -143,4 +143,4 @@ public enum EnumColor implements IStringSerializable {
|
||||
public String toString() {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,10 +14,10 @@ public interface IAlloyInteraction {
|
||||
/**
|
||||
* Called when a player right-clicks this block with an alloy.
|
||||
*
|
||||
* @param player - the player right-clicking the block
|
||||
* @param hand - the hand this alloy was right-clicked with
|
||||
* @param stack - the stack of alloy being right-clicked
|
||||
* @param player - the player right-clicking the block
|
||||
* @param hand - the hand this alloy was right-clicked with
|
||||
* @param stack - the stack of alloy being right-clicked
|
||||
* @param tierOrdinal - the ordinal tier of the alloy (1 = advanced, 2 = elite, 3 = ultimate)
|
||||
*/
|
||||
void onAlloyInteraction(EntityPlayer player, EnumHand hand, ItemStack stack, int tierOrdinal);
|
||||
}
|
||||
}
|
||||
@@ -5,4 +5,4 @@ public interface IClientTicker {
|
||||
void clientTick();
|
||||
|
||||
boolean needsTicks();
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,7 @@ package mekanism.api;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* Implement this in your TileEntity class if you wish for Mekanism filters to be able to store any of their
|
||||
* information.
|
||||
* Implement this in your TileEntity class if you wish for Mekanism filters to be able to store any of their information.
|
||||
*
|
||||
* @author aidancbrady
|
||||
*/
|
||||
@@ -16,12 +15,13 @@ public interface IConfigCardAccess {
|
||||
* Collects the TileEntity's filter card data into the parameterized NBTTagCompound.
|
||||
*
|
||||
* @param nbtTags - the NBTTagCompound of the filter card ItemStack
|
||||
*
|
||||
* @return the NBTTagCompound that now contains the TileEntity's filter card data
|
||||
*/
|
||||
NBTTagCompound getConfigurationData(NBTTagCompound nbtTags);
|
||||
|
||||
/**
|
||||
* Retrieves the TileEntity's data contained in the filter card based on the given NBTTagCompopund.
|
||||
* Retrieves the TileEntity's data contained in the filter card based on the given NBTTagCompound.
|
||||
*
|
||||
* @param nbtTags - the NBTTagCompound of the filter card ItemStack
|
||||
*/
|
||||
@@ -34,4 +34,4 @@ public interface IConfigCardAccess {
|
||||
*/
|
||||
String getDataType();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,8 @@ public interface IConfigurable {
|
||||
* Called when a player shift-right clicks this block with a Configurator.
|
||||
*
|
||||
* @param player - the player who clicked the block
|
||||
* @param side - the side the block was clicked on
|
||||
* @param side - the side the block was clicked on
|
||||
*
|
||||
* @return action that was performed
|
||||
*/
|
||||
EnumActionResult onSneakRightClick(EntityPlayer player, EnumFacing side);
|
||||
@@ -24,8 +25,9 @@ public interface IConfigurable {
|
||||
* Called when a player right clicks this block with a Configurator.
|
||||
*
|
||||
* @param player - the player who clicked the block
|
||||
* @param side - the side the block was clicked on
|
||||
* @param side - the side the block was clicked on
|
||||
*
|
||||
* @return action that was performed
|
||||
*/
|
||||
EnumActionResult onRightClick(EntityPlayer player, EnumFacing side);
|
||||
}
|
||||
}
|
||||
@@ -8,4 +8,4 @@ package mekanism.api;
|
||||
public interface IEvaporationSolar {
|
||||
|
||||
boolean canSeeSun();
|
||||
}
|
||||
}
|
||||
@@ -29,4 +29,4 @@ public interface IHeatTransfer {
|
||||
boolean canConnectHeat(EnumFacing side);
|
||||
|
||||
IHeatTransfer getAdjacent(EnumFacing side);
|
||||
}
|
||||
}
|
||||
@@ -17,4 +17,4 @@ public interface IMekWrench {
|
||||
|
||||
default void wrenchUsed(EntityPlayer player, EnumHand hand, ItemStack wrench, RayTraceResult rayTrace) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,9 +34,7 @@ public class MekanismAPI {
|
||||
if (cardboardBoxModIgnore.contains(Objects.requireNonNull(block.getRegistryName()).getNamespace())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return cardboardBoxIgnore.stream()
|
||||
.noneMatch(i -> i.block == block && (i.meta == OreDictionary.WILDCARD_VALUE || i.meta == meta));
|
||||
return cardboardBoxIgnore.stream().noneMatch(i -> i.block == block && (i.meta == OreDictionary.WILDCARD_VALUE || i.meta == meta));
|
||||
}
|
||||
|
||||
public static void addBoxBlacklist(@Nullable Block block, int meta) {
|
||||
@@ -118,4 +116,4 @@ public class MekanismAPI {
|
||||
removeBoxBlacklistMod(modid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ public interface MekanismRecipeHelper {
|
||||
/**
|
||||
* Add an Enrichment Chamber recipe.
|
||||
*
|
||||
* @param input - input ItemStack
|
||||
* @param input - input ItemStack
|
||||
* @param output - output ItemStack
|
||||
*/
|
||||
void addEnrichmentChamberRecipe(ItemStack input, ItemStack output);
|
||||
@@ -19,7 +19,7 @@ public interface MekanismRecipeHelper {
|
||||
/**
|
||||
* Add an Osmium Compressor recipe.
|
||||
*
|
||||
* @param input - input ItemStack
|
||||
* @param input - input ItemStack
|
||||
* @param output - output ItemStack
|
||||
*/
|
||||
void addOsmiumCompressorRecipe(ItemStack input, ItemStack output);
|
||||
@@ -27,7 +27,7 @@ public interface MekanismRecipeHelper {
|
||||
/**
|
||||
* Add a Combiner recipe.
|
||||
*
|
||||
* @param input - input ItemStack
|
||||
* @param input - input ItemStack
|
||||
* @param output - output ItemStack
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -36,8 +36,8 @@ public interface MekanismRecipeHelper {
|
||||
/**
|
||||
* Add a Combiner recipe.
|
||||
*
|
||||
* @param input - input ItemStack
|
||||
* @param extra - extra ItemStack
|
||||
* @param input - input ItemStack
|
||||
* @param extra - extra ItemStack
|
||||
* @param output - output ItemStack
|
||||
*/
|
||||
void addCombinerRecipe(ItemStack input, ItemStack extra, ItemStack output);
|
||||
@@ -45,7 +45,7 @@ public interface MekanismRecipeHelper {
|
||||
/**
|
||||
* Add a Crusher recipe.
|
||||
*
|
||||
* @param input - input ItemStack
|
||||
* @param input - input ItemStack
|
||||
* @param output - output ItemStack
|
||||
*/
|
||||
void addCrusherRecipe(ItemStack input, ItemStack output);
|
||||
@@ -53,7 +53,7 @@ public interface MekanismRecipeHelper {
|
||||
/**
|
||||
* Add a Purification Chamber recipe.
|
||||
*
|
||||
* @param input - input ItemStack
|
||||
* @param input - input ItemStack
|
||||
* @param output - output ItemStack
|
||||
*/
|
||||
void addPurificationChamberRecipe(ItemStack input, ItemStack output);
|
||||
@@ -63,7 +63,7 @@ public interface MekanismRecipeHelper {
|
||||
*
|
||||
* @param infuse - which Infuse to use
|
||||
* @param amount - how much of the Infuse to use
|
||||
* @param input - input ItemStack
|
||||
* @param input - input ItemStack
|
||||
* @param output - output ItemStack
|
||||
*/
|
||||
void addMetallurgicInfuserRecipe(InfuseType infuse, int amount, ItemStack input, ItemStack output);
|
||||
@@ -71,16 +71,16 @@ public interface MekanismRecipeHelper {
|
||||
/**
|
||||
* Add a Chemical Infuser recipe.
|
||||
*
|
||||
* @param leftInput - left GasStack to input
|
||||
* @param leftInput - left GasStack to input
|
||||
* @param rightInput - right GasStack to input
|
||||
* @param output - output GasStack
|
||||
* @param output - output GasStack
|
||||
*/
|
||||
void addChemicalInfuserRecipe(GasStack leftInput, GasStack rightInput, GasStack output);
|
||||
|
||||
/**
|
||||
* Add a Chemical Oxidizer recipe.
|
||||
*
|
||||
* @param input - input ItemStack
|
||||
* @param input - input ItemStack
|
||||
* @param output - output GasStack
|
||||
*/
|
||||
void addChemicalOxidizerRecipe(ItemStack input, GasStack output);
|
||||
@@ -88,7 +88,7 @@ public interface MekanismRecipeHelper {
|
||||
/**
|
||||
* Add a Chemical Injection Chamber recipe.
|
||||
*
|
||||
* @param input - input ItemStack
|
||||
* @param input - input ItemStack
|
||||
* @param output - output ItemStack
|
||||
*/
|
||||
void addChemicalInjectionChamberRecipe(ItemStack input, Gas gas, ItemStack output);
|
||||
@@ -96,8 +96,8 @@ public interface MekanismRecipeHelper {
|
||||
/**
|
||||
* Add an Electrolytic Separator recipe.
|
||||
*
|
||||
* @param fluid - FluidStack to electrolyze
|
||||
* @param leftOutput - left gas to produce when the fluid is electrolyzed
|
||||
* @param fluid - FluidStack to electrolyze
|
||||
* @param leftOutput - left gas to produce when the fluid is electrolyzed
|
||||
* @param rightOutput - right gas to produce when the fluid is electrolyzed
|
||||
*/
|
||||
void addElectrolyticSeparatorRecipe(FluidStack fluid, double energy, GasStack leftOutput, GasStack rightOutput);
|
||||
@@ -105,17 +105,17 @@ public interface MekanismRecipeHelper {
|
||||
/**
|
||||
* Add a Precision Sawmill recipe.
|
||||
*
|
||||
* @param input - input ItemStack
|
||||
* @param primaryOutput - guaranteed output
|
||||
* @param input - input ItemStack
|
||||
* @param primaryOutput - guaranteed output
|
||||
* @param secondaryOutput - possible extra output
|
||||
* @param chance - probability of obtaining extra output
|
||||
* @param chance - probability of obtaining extra output
|
||||
*/
|
||||
void addPrecisionSawmillRecipe(ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput, double chance);
|
||||
|
||||
/**
|
||||
* Add a Precision Sawmill recipe with no chance output
|
||||
*
|
||||
* @param input - input ItemStack
|
||||
* @param input - input ItemStack
|
||||
* @param primaryOutput - guaranteed output
|
||||
*/
|
||||
void addPrecisionSawmillRecipe(ItemStack input, ItemStack primaryOutput);
|
||||
@@ -123,7 +123,7 @@ public interface MekanismRecipeHelper {
|
||||
/**
|
||||
* Add a Chemical Dissolution Chamber recipe.
|
||||
*
|
||||
* @param input - input ItemStack
|
||||
* @param input - input ItemStack
|
||||
* @param output - output GasStack
|
||||
*/
|
||||
void addChemicalDissolutionChamberRecipe(ItemStack input, GasStack output);
|
||||
@@ -131,7 +131,7 @@ public interface MekanismRecipeHelper {
|
||||
/**
|
||||
* Add a Chemical Washer recipe.
|
||||
*
|
||||
* @param input - input GasStack
|
||||
* @param input - input GasStack
|
||||
* @param output - output GasStack
|
||||
*/
|
||||
void addChemicalWasherRecipe(GasStack input, GasStack output);
|
||||
@@ -139,7 +139,7 @@ public interface MekanismRecipeHelper {
|
||||
/**
|
||||
* Add a Chemical Crystallizer recipe.
|
||||
*
|
||||
* @param input - input GasStack
|
||||
* @param input - input GasStack
|
||||
* @param output - output ItemStack
|
||||
*/
|
||||
void addChemicalCrystallizerRecipe(GasStack input, ItemStack output);
|
||||
@@ -147,13 +147,13 @@ public interface MekanismRecipeHelper {
|
||||
/**
|
||||
* Add a Pressurized Reaction Chamber recipe.
|
||||
*
|
||||
* @param inputSolid - input ItemStack
|
||||
* @param inputFluid - input FluidStack
|
||||
* @param inputGas - input GasStack
|
||||
* @param inputSolid - input ItemStack
|
||||
* @param inputFluid - input FluidStack
|
||||
* @param inputGas - input GasStack
|
||||
* @param outputSolid - output ItemStack
|
||||
* @param outputGas - output GasStack
|
||||
* @param outputGas - output GasStack
|
||||
* @param extraEnergy - extra energy needed by the recipe
|
||||
* @param ticks - amount of ticks it takes for this recipe to complete
|
||||
* @param ticks - amount of ticks it takes for this recipe to complete
|
||||
*/
|
||||
void addPRCRecipe(ItemStack inputSolid, FluidStack inputFluid, GasStack inputGas, ItemStack outputSolid,
|
||||
GasStack outputGas, double extraEnergy, int ticks);
|
||||
@@ -161,4 +161,4 @@ public interface MekanismRecipeHelper {
|
||||
void addThermalEvaporationRecipe(FluidStack inputFluid, FluidStack outputFluid);
|
||||
|
||||
void addSolarNeutronRecipe(GasStack inputGas, GasStack outputGas);
|
||||
}
|
||||
}
|
||||
@@ -65,6 +65,7 @@ public class Pos3D extends Vec3d {
|
||||
* Returns a new Pos3D from a tag compound.
|
||||
*
|
||||
* @param tag - tag compound to read from
|
||||
*
|
||||
* @return the Pos3D from the tag compound
|
||||
*/
|
||||
public static Pos3D read(NBTTagCompound tag) {
|
||||
@@ -75,6 +76,7 @@ public class Pos3D extends Vec3d {
|
||||
* Creates a new Pos3D from the motion of an entity.
|
||||
*
|
||||
* @param entity Entitiy to get the motion from
|
||||
*
|
||||
* @return Pos3D representing the motion of the given entity
|
||||
*/
|
||||
public static Pos3D fromMotion(Entity entity) {
|
||||
@@ -85,7 +87,6 @@ public class Pos3D extends Vec3d {
|
||||
double x = translation.x * matrix[0] + translation.y * matrix[1] + translation.z * matrix[2] + matrix[3];
|
||||
double y = translation.x * matrix[4] + translation.y * matrix[5] + translation.z * matrix[6] + matrix[7];
|
||||
double z = translation.x * matrix[8] + translation.y * matrix[9] + translation.z * matrix[10] + matrix[11];
|
||||
|
||||
return new Pos3D(x, y, z);
|
||||
}
|
||||
|
||||
@@ -112,21 +113,21 @@ public class Pos3D extends Vec3d {
|
||||
* Writes this Pos3D's data to an NBTTagCompound.
|
||||
*
|
||||
* @param nbtTags - tag compound to write to
|
||||
*
|
||||
* @return the tag compound with this Pos3D's data
|
||||
*/
|
||||
public NBTTagCompound write(NBTTagCompound nbtTags) {
|
||||
nbtTags.setDouble("x", x);
|
||||
nbtTags.setDouble("y", y);
|
||||
nbtTags.setDouble("z", z);
|
||||
|
||||
return nbtTags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a Pos3D with values representing the difference between this and the Pos3D in the
|
||||
* parameters.
|
||||
* Creates and returns a Pos3D with values representing the difference between this and the Pos3D in the parameters.
|
||||
*
|
||||
* @param vec - Vec3 to subtract
|
||||
*
|
||||
* @return difference of the two Pos3Ds
|
||||
*/
|
||||
public Pos3D diff(Vec3d vec) {
|
||||
@@ -137,6 +138,7 @@ public class Pos3D extends Vec3d {
|
||||
* Creates a new Coord4D representing this Pos3D in the provided dimension.
|
||||
*
|
||||
* @param dimensionId - the dimension this Pos3D is in
|
||||
*
|
||||
* @return Coord4D representing this Pos3D
|
||||
*/
|
||||
public Coord4D getCoord(int dimensionId) {
|
||||
@@ -156,6 +158,7 @@ public class Pos3D extends Vec3d {
|
||||
* @param x - amount to translate on the x axis
|
||||
* @param y - amount to translate on the y axis
|
||||
* @param z - amount to translate on the z axis
|
||||
*
|
||||
* @return the translated Pos3D
|
||||
*/
|
||||
public Pos3D translate(double x, double y, double z) {
|
||||
@@ -166,6 +169,7 @@ public class Pos3D extends Vec3d {
|
||||
* Performs the same operation as translate(x, y, z), but with a Pos3D value instead.
|
||||
*
|
||||
* @param pos - Pos3D value to translate by
|
||||
*
|
||||
* @return translated Pos3D
|
||||
*/
|
||||
public Pos3D translate(Vec3d pos) {
|
||||
@@ -176,8 +180,7 @@ public class Pos3D extends Vec3d {
|
||||
* Performs the same operation as translate(x, y, z), but by a set amount in a EnumFacing
|
||||
*/
|
||||
public Pos3D translate(EnumFacing direction, double amount) {
|
||||
return translate(direction.getDirectionVec().getX() * amount, direction.getDirectionVec().getY() * amount,
|
||||
direction.getDirectionVec().getZ() * amount);
|
||||
return translate(direction.getDirectionVec().getX() * amount, direction.getDirectionVec().getY() * amount, direction.getDirectionVec().getZ() * amount);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -194,7 +197,6 @@ public class Pos3D extends Vec3d {
|
||||
if (direction.getAxis() != Axis.Z) {
|
||||
zPos += amount;
|
||||
}
|
||||
|
||||
return new Pos3D(xPos, yPos, zPos);
|
||||
}
|
||||
|
||||
@@ -202,6 +204,7 @@ public class Pos3D extends Vec3d {
|
||||
* Returns the distance between this and the defined Pos3D.
|
||||
*
|
||||
* @param pos - the Pos3D to find the distance to
|
||||
*
|
||||
* @return the distance between this and the defined Pos3D
|
||||
*/
|
||||
public double distance(Vec3d pos) {
|
||||
@@ -215,21 +218,19 @@ public class Pos3D extends Vec3d {
|
||||
* Rotates this Pos3D by the defined yaw value.
|
||||
*
|
||||
* @param yaw - yaw to rotate by
|
||||
*
|
||||
* @return rotated Pos3D
|
||||
*/
|
||||
@Nonnull
|
||||
@Override
|
||||
public Pos3D rotateYaw(float yaw) {
|
||||
double yawRadians = Math.toRadians(yaw);
|
||||
|
||||
double xPos = x;
|
||||
double zPos = z;
|
||||
|
||||
if (yaw != 0) {
|
||||
xPos = x * Math.cos(yawRadians) - z * Math.sin(yawRadians);
|
||||
zPos = z * Math.cos(yawRadians) + x * Math.sin(yawRadians);
|
||||
}
|
||||
|
||||
return new Pos3D(xPos, y, zPos);
|
||||
}
|
||||
|
||||
@@ -237,15 +238,12 @@ public class Pos3D extends Vec3d {
|
||||
@Override
|
||||
public Pos3D rotatePitch(float pitch) {
|
||||
double pitchRadians = Math.toRadians(pitch);
|
||||
|
||||
double yPos = y;
|
||||
double zPos = z;
|
||||
|
||||
if (pitch != 0) {
|
||||
yPos = y * Math.cos(pitchRadians) - z * Math.sin(pitchRadians);
|
||||
zPos = z * Math.cos(pitchRadians) + y * Math.sin(pitchRadians);
|
||||
}
|
||||
|
||||
return new Pos3D(x, yPos, zPos);
|
||||
}
|
||||
|
||||
@@ -259,16 +257,12 @@ public class Pos3D extends Vec3d {
|
||||
double rollRadians = Math.toRadians(roll);
|
||||
|
||||
double xPos = x * Math.cos(yawRadians) * Math.cos(pitchRadians) + z * (
|
||||
Math.cos(yawRadians) * Math.sin(pitchRadians) * Math.sin(rollRadians) - Math.sin(yawRadians) * Math
|
||||
.cos(rollRadians)) + y * (Math.cos(yawRadians) * Math.sin(pitchRadians) * Math.cos(rollRadians)
|
||||
+ Math.sin(yawRadians) * Math.sin(rollRadians));
|
||||
Math.cos(yawRadians) * Math.sin(pitchRadians) * Math.sin(rollRadians) - Math.sin(yawRadians) * Math.cos(rollRadians)) +
|
||||
y * (Math.cos(yawRadians) * Math.sin(pitchRadians) * Math.cos(rollRadians) + Math.sin(yawRadians) * Math.sin(rollRadians));
|
||||
double zPos = x * Math.sin(yawRadians) * Math.cos(pitchRadians) + z * (
|
||||
Math.sin(yawRadians) * Math.sin(pitchRadians) * Math.sin(rollRadians) + Math.cos(yawRadians) * Math
|
||||
.cos(rollRadians)) + y * (Math.sin(yawRadians) * Math.sin(pitchRadians) * Math.cos(rollRadians)
|
||||
- Math.cos(yawRadians) * Math.sin(rollRadians));
|
||||
double yPos = -x * Math.sin(pitchRadians) + z * Math.cos(pitchRadians) * Math.sin(rollRadians) + y * Math
|
||||
.cos(pitchRadians) * Math.cos(rollRadians);
|
||||
|
||||
Math.sin(yawRadians) * Math.sin(pitchRadians) * Math.sin(rollRadians) + Math.cos(yawRadians) * Math.cos(rollRadians)) +
|
||||
y * (Math.sin(yawRadians) * Math.sin(pitchRadians) * Math.cos(rollRadians) - Math.cos(yawRadians) * Math.sin(rollRadians));
|
||||
double yPos = -x * Math.sin(pitchRadians) + z * Math.cos(pitchRadians) * Math.sin(rollRadians) + y * Math.cos(pitchRadians) * Math.cos(rollRadians);
|
||||
return new Pos3D(xPos, yPos, zPos);
|
||||
}
|
||||
|
||||
@@ -282,6 +276,7 @@ public class Pos3D extends Vec3d {
|
||||
* @param x - x value to scale by
|
||||
* @param y - y value to scale by
|
||||
* @param z - z value to scale by
|
||||
*
|
||||
* @return scaled Pos3D
|
||||
*/
|
||||
public Pos3D scale(double x, double y, double z) {
|
||||
@@ -312,17 +307,16 @@ public class Pos3D extends Vec3d {
|
||||
float ocos = 1.0F - cos;
|
||||
float sin = (float) Math.sin(angle);
|
||||
|
||||
matrix[0] = (x * x * ocos + cos);
|
||||
matrix[1] = (y * x * ocos + z * sin);
|
||||
matrix[2] = (x * z * ocos - y * sin);
|
||||
matrix[4] = (x * y * ocos - z * sin);
|
||||
matrix[5] = (y * y * ocos + cos);
|
||||
matrix[6] = (y * z * ocos + x * sin);
|
||||
matrix[8] = (x * z * ocos + y * sin);
|
||||
matrix[9] = (y * z * ocos - x * sin);
|
||||
matrix[10] = (z * z * ocos + cos);
|
||||
matrix[0] = x * x * ocos + cos;
|
||||
matrix[1] = y * x * ocos + z * sin;
|
||||
matrix[2] = x * z * ocos - y * sin;
|
||||
matrix[4] = x * y * ocos - z * sin;
|
||||
matrix[5] = y * y * ocos + cos;
|
||||
matrix[6] = y * z * ocos + x * sin;
|
||||
matrix[8] = x * z * ocos + y * sin;
|
||||
matrix[9] = y * z * ocos - x * sin;
|
||||
matrix[10] = z * z * ocos + cos;
|
||||
matrix[15] = 1.0F;
|
||||
|
||||
return matrix;
|
||||
}
|
||||
|
||||
@@ -345,11 +339,7 @@ public class Pos3D extends Vec3d {
|
||||
}
|
||||
|
||||
public Pos3D getPerpendicular() {
|
||||
if (z == 0) {
|
||||
return zCrossProduct();
|
||||
}
|
||||
|
||||
return xCrossProduct();
|
||||
return z == 0 ? zCrossProduct() : xCrossProduct();
|
||||
}
|
||||
|
||||
public Pos3D floor() {
|
||||
@@ -369,10 +359,7 @@ public class Pos3D extends Vec3d {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof Vec3d &&
|
||||
((Vec3d) obj).x == x &&
|
||||
((Vec3d) obj).y == y &&
|
||||
((Vec3d) obj).z == z;
|
||||
return obj instanceof Vec3d && ((Vec3d) obj).x == x && ((Vec3d) obj).y == y && ((Vec3d) obj).z == z;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -383,4 +370,4 @@ public class Pos3D extends Vec3d {
|
||||
code = 31 * code + new Double(z).hashCode();
|
||||
return code;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
public class Range4D {
|
||||
|
||||
public int dimensionId;
|
||||
|
||||
public int xMin;
|
||||
public int yMin;
|
||||
public int zMin;
|
||||
@@ -23,7 +22,6 @@ public class Range4D {
|
||||
xMax = maxX;
|
||||
yMax = maxY;
|
||||
zMax = maxZ;
|
||||
|
||||
dimensionId = dimension;
|
||||
}
|
||||
|
||||
@@ -34,7 +32,6 @@ public class Range4D {
|
||||
xMax = xMin + 16;
|
||||
yMax = 255;
|
||||
zMax = zMin + 16;
|
||||
|
||||
dimensionId = chunk.dimensionId;
|
||||
}
|
||||
|
||||
@@ -42,17 +39,14 @@ public class Range4D {
|
||||
xMin = coord.x;
|
||||
yMin = coord.y;
|
||||
zMin = coord.z;
|
||||
|
||||
xMax = coord.x + 1;
|
||||
yMax = coord.y + 1;
|
||||
zMax = coord.z + 1;
|
||||
|
||||
dimensionId = coord.dimensionId;
|
||||
}
|
||||
|
||||
public static Range4D getChunkRange(EntityPlayer player) {
|
||||
int radius = FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getViewDistance();
|
||||
|
||||
return new Range4D(new Chunk3D(player)).expandChunks(radius);
|
||||
}
|
||||
|
||||
@@ -61,7 +55,6 @@ public class Range4D {
|
||||
xMax += chunks * 16;
|
||||
zMin -= chunks * 16;
|
||||
zMax += chunks * 16;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -70,26 +63,22 @@ public class Range4D {
|
||||
xMax += radius;
|
||||
zMin -= radius;
|
||||
zMax += radius;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public Set<Chunk3D> getIntersectingChunks() {
|
||||
Set<Chunk3D> set = new HashSet<>();
|
||||
|
||||
for (int chunkX = xMin >> 4; chunkX <= xMax - 1 >> 4; chunkX++) {
|
||||
for (int chunkZ = zMin >> 4; chunkZ <= zMax - 1 >> 4; chunkZ++) {
|
||||
set.add(new Chunk3D(chunkX, chunkZ, dimensionId));
|
||||
}
|
||||
}
|
||||
|
||||
return set;
|
||||
}
|
||||
|
||||
public boolean intersects(Range4D range) {
|
||||
return (xMax + 1 - 1.E-05D > range.xMin) && (range.xMax + 1 - 1.E-05D > xMin) && (yMax + 1 - 1.E-05D
|
||||
> range.yMin) && (range.yMax + 1 - 1.E-05D > yMin) && (zMax + 1 - 1.E-05D > range.zMin) && (
|
||||
range.zMax + 1 - 1.E-05D > zMin);
|
||||
return (xMax + 1 - 1.E-05D > range.xMin) && (range.xMax + 1 - 1.E-05D > xMin) && (yMax + 1 - 1.E-05D > range.yMin) &&
|
||||
(range.yMax + 1 - 1.E-05D > yMin) && (zMax + 1 - 1.E-05D > range.zMin) && (range.zMax + 1 - 1.E-05D > zMin);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -99,20 +88,19 @@ public class Range4D {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[Range4D: " + xMin + ", " + yMin + ", " + zMin + ", " + xMax + ", " + yMax + ", " + zMax + ", dim="
|
||||
+ dimensionId + "]";
|
||||
return "[Range4D: " + xMin + ", " + yMin + ", " + zMin + ", " + xMax + ", " + yMax + ", " + zMax + ", dim=" + dimensionId + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof Range4D &&
|
||||
((Range4D) obj).xMin == xMin &&
|
||||
((Range4D) obj).yMin == yMin &&
|
||||
((Range4D) obj).zMin == zMin &&
|
||||
((Range4D) obj).xMax == xMax &&
|
||||
((Range4D) obj).yMax == yMax &&
|
||||
((Range4D) obj).zMax == zMax &&
|
||||
((Range4D) obj).dimensionId == dimensionId;
|
||||
((Range4D) obj).xMin == xMin &&
|
||||
((Range4D) obj).yMin == yMin &&
|
||||
((Range4D) obj).zMin == zMin &&
|
||||
((Range4D) obj).xMax == xMax &&
|
||||
((Range4D) obj).yMax == yMax &&
|
||||
((Range4D) obj).zMax == zMax &&
|
||||
((Range4D) obj).dimensionId == dimensionId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -127,4 +115,4 @@ public class Range4D {
|
||||
code = 31 * code + dimensionId;
|
||||
return code;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,4 +21,4 @@ public class TileNetworkList extends NonNullList<Object> {
|
||||
public static TileNetworkList withContents(@Nonnull Object... contents) {
|
||||
return new TileNetworkList(Arrays.asList(contents));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,25 +8,19 @@ public class EnergizedItemManager {
|
||||
* Discharges an IEnergizedItem with the defined amount of energy.
|
||||
*
|
||||
* @param itemStack - ItemStack to discharge
|
||||
* @param amount - amount of energy to discharge from the item, usually the total amount of energy needed in a
|
||||
* TileEntity
|
||||
* @param amount - amount of energy to discharge from the item, usually the total amount of energy needed in a TileEntity
|
||||
*
|
||||
* @return amount of energy discharged
|
||||
*/
|
||||
public static double discharge(ItemStack itemStack, double amount) {
|
||||
if (!itemStack.isEmpty()) {
|
||||
if (itemStack.getItem() instanceof IEnergizedItem) {
|
||||
IEnergizedItem energizedItem = (IEnergizedItem) itemStack.getItem();
|
||||
|
||||
if (energizedItem.canSend(itemStack)) {
|
||||
double energyToUse = Math.min(energizedItem.getMaxTransfer(itemStack),
|
||||
Math.min(energizedItem.getEnergy(itemStack), amount));
|
||||
energizedItem.setEnergy(itemStack, energizedItem.getEnergy(itemStack) - energyToUse);
|
||||
|
||||
return energyToUse;
|
||||
}
|
||||
if (!itemStack.isEmpty() && itemStack.getItem() instanceof IEnergizedItem) {
|
||||
IEnergizedItem energizedItem = (IEnergizedItem) itemStack.getItem();
|
||||
if (energizedItem.canSend(itemStack)) {
|
||||
double energyToUse = Math.min(energizedItem.getMaxTransfer(itemStack), Math.min(energizedItem.getEnergy(itemStack), amount));
|
||||
energizedItem.setEnergy(itemStack, energizedItem.getEnergy(itemStack) - energyToUse);
|
||||
return energyToUse;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -34,25 +28,20 @@ public class EnergizedItemManager {
|
||||
* Charges an IEnergizedItem with the defined amount of energy.
|
||||
*
|
||||
* @param itemStack - ItemStack to charge
|
||||
* @param amount - amount of energy to charge the item with, usually the total amount of energy stored in a
|
||||
* TileEntity
|
||||
* @param amount - amount of energy to charge the item with, usually the total amount of energy stored in a TileEntity
|
||||
*
|
||||
* @return amount of energy charged
|
||||
*/
|
||||
public static double charge(ItemStack itemStack, double amount) {
|
||||
if (!itemStack.isEmpty()) {
|
||||
if (itemStack.getItem() instanceof IEnergizedItem) {
|
||||
IEnergizedItem energizedItem = (IEnergizedItem) itemStack.getItem();
|
||||
|
||||
if (energizedItem.canReceive(itemStack)) {
|
||||
double energyToSend = Math.min(energizedItem.getMaxTransfer(itemStack),
|
||||
Math.min(energizedItem.getMaxEnergy(itemStack) - energizedItem.getEnergy(itemStack), amount));
|
||||
energizedItem.setEnergy(itemStack, energizedItem.getEnergy(itemStack) + energyToSend);
|
||||
|
||||
return energyToSend;
|
||||
}
|
||||
if (!itemStack.isEmpty() && itemStack.getItem() instanceof IEnergizedItem) {
|
||||
IEnergizedItem energizedItem = (IEnergizedItem) itemStack.getItem();
|
||||
if (energizedItem.canReceive(itemStack)) {
|
||||
double energyToSend = Math.min(energizedItem.getMaxTransfer(itemStack),
|
||||
Math.min(energizedItem.getMaxEnergy(itemStack) - energizedItem.getEnergy(itemStack), amount));
|
||||
energizedItem.setEnergy(itemStack, energizedItem.getEnergy(itemStack) + energyToSend);
|
||||
return energyToSend;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,4 +10,4 @@ public class EnergyStack {
|
||||
public EnergyStack(double newAmount) {
|
||||
amount = newAmount;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ public interface IEnergizedItem {
|
||||
* Gets and returns the amount of energy stored in this item.
|
||||
*
|
||||
* @param itemStack - the ItemStack to check
|
||||
*
|
||||
* @return energy stored
|
||||
*/
|
||||
double getEnergy(ItemStack itemStack);
|
||||
@@ -21,7 +22,7 @@ public interface IEnergizedItem {
|
||||
* Sets this item's stored energy value to a new amount.
|
||||
*
|
||||
* @param itemStack - the ItemStack who's energy value is to be change
|
||||
* @param amount - new amount of energy
|
||||
* @param amount - new amount of energy
|
||||
*/
|
||||
void setEnergy(ItemStack itemStack, double amount);
|
||||
|
||||
@@ -29,6 +30,7 @@ public interface IEnergizedItem {
|
||||
* Gets and returns this item's maximum amount of energy that can be stored.
|
||||
*
|
||||
* @param itemStack - the ItemStack to check
|
||||
*
|
||||
* @return maximum energy
|
||||
*/
|
||||
double getMaxEnergy(ItemStack itemStack);
|
||||
@@ -37,6 +39,7 @@ public interface IEnergizedItem {
|
||||
* Gets and returns how much energy this item can transfer to and from charging slots.
|
||||
*
|
||||
* @param itemStack - the ItemStack to check
|
||||
*
|
||||
* @return transfer amount
|
||||
*/
|
||||
double getMaxTransfer(ItemStack itemStack);
|
||||
@@ -45,6 +48,7 @@ public interface IEnergizedItem {
|
||||
* Gets and returns whether or not this item can receive energy from a charging slot.
|
||||
*
|
||||
* @param itemStack - the ItemStack to check
|
||||
*
|
||||
* @return if the item can receive energy
|
||||
*/
|
||||
boolean canReceive(ItemStack itemStack);
|
||||
@@ -53,7 +57,8 @@ public interface IEnergizedItem {
|
||||
* Gets and returns whether or not this item can send energy to a charging slot.
|
||||
*
|
||||
* @param itemStack - the ItemStack to check
|
||||
*
|
||||
* @return if the item can send energy
|
||||
*/
|
||||
boolean canSend(ItemStack itemStack);
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,9 @@ public interface IStrictEnergyAcceptor {
|
||||
/**
|
||||
* Transfer a certain amount of energy to this acceptor.
|
||||
*
|
||||
* @param amount - amount to transfer
|
||||
* @param amount - amount to transfer
|
||||
* @param simulate - if the operation should be simulated
|
||||
*
|
||||
* @return energy used
|
||||
*/
|
||||
double acceptEnergy(EnumFacing side, double amount, boolean simulate);
|
||||
@@ -22,7 +23,8 @@ public interface IStrictEnergyAcceptor {
|
||||
* Whether or not this tile entity can accept energy from a certain side.
|
||||
*
|
||||
* @param side - side to check
|
||||
*
|
||||
* @return if tile entity accepts energy
|
||||
*/
|
||||
boolean canReceiveEnergy(EnumFacing side);
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,9 @@ public interface IStrictEnergyOutputter {
|
||||
/**
|
||||
* Pulls a certain amount of energy from this outputter.
|
||||
*
|
||||
* @param amount - amount to pull
|
||||
* @param amount - amount to pull
|
||||
* @param simulate - if the operation should be simulated
|
||||
*
|
||||
* @return energy sent
|
||||
*/
|
||||
double pullEnergy(EnumFacing side, double amount, boolean simulate);
|
||||
@@ -22,7 +23,8 @@ public interface IStrictEnergyOutputter {
|
||||
* Whether or not this tile entity can output energy on a specific side.
|
||||
*
|
||||
* @param side - side to check
|
||||
*
|
||||
* @return if the tile entity outputs energy
|
||||
*/
|
||||
boolean canOutputEnergy(EnumFacing side);
|
||||
}
|
||||
}
|
||||
@@ -27,4 +27,4 @@ public interface IStrictEnergyStorage {
|
||||
* @return maximum energy
|
||||
*/
|
||||
double getMaxEnergy();
|
||||
}
|
||||
}
|
||||
@@ -2,5 +2,4 @@
|
||||
package mekanism.api.energy;
|
||||
|
||||
import mekanism.api.MekanismAPI;
|
||||
import net.minecraftforge.fml.common.API;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -72,6 +72,7 @@ public class Gas {
|
||||
* Returns the Gas stored in the defined tag compound.
|
||||
*
|
||||
* @param nbtTags - tag compound to get the Gas from
|
||||
*
|
||||
* @return Gas stored in the tag compound
|
||||
*/
|
||||
public static Gas readFromNBT(NBTTagCompound nbtTags) {
|
||||
@@ -101,10 +102,11 @@ public class Gas {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets this gas's "visible" state to a new value. Setting it to 'false' will treat this gas as an internal gas, and
|
||||
* it will not be displayed or accessed by other mods.
|
||||
* Sets this gas's "visible" state to a new value. Setting it to 'false' will treat this gas as an internal gas, and it will not be displayed or accessed by other
|
||||
* mods.
|
||||
*
|
||||
* @param v - new visible state
|
||||
*
|
||||
* @return this Gas object
|
||||
*/
|
||||
public Gas setVisible(boolean v) {
|
||||
@@ -127,6 +129,7 @@ public class Gas {
|
||||
* DEPRECATED: Sets the unlocalized name of this Gas. Use setTranslationKey instead.
|
||||
*
|
||||
* @param s - unlocalized name to set
|
||||
*
|
||||
* @return this Gas object
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -147,6 +150,7 @@ public class Gas {
|
||||
* Sets the unlocalized name of this Gas.
|
||||
*
|
||||
* @param s - unlocalized name to set
|
||||
*
|
||||
* @return this Gas object
|
||||
*/
|
||||
public Gas setTranslationKey(String s) {
|
||||
@@ -202,6 +206,7 @@ public class Gas {
|
||||
* Sets this gas's icon.
|
||||
*
|
||||
* @param map - IIcon to associate with this Gas
|
||||
*
|
||||
* @return this Gas object
|
||||
*/
|
||||
public Gas registerIcon(TextureMap map) {
|
||||
@@ -234,6 +239,7 @@ public class Gas {
|
||||
* Writes this Gas to a defined tag compound.
|
||||
*
|
||||
* @param nbtTags - tag compound to write this Gas to
|
||||
*
|
||||
* @return the tag compound this gas was written to
|
||||
*/
|
||||
public NBTTagCompound write(NBTTagCompound nbtTags) {
|
||||
@@ -315,4 +321,4 @@ public class Gas {
|
||||
public void setTint(int tint) {
|
||||
this.tint = tint;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ public class GasRegistry {
|
||||
* Register a new gas into GasRegistry. Call this BEFORE post-init.
|
||||
*
|
||||
* @param gas - Gas to register
|
||||
*
|
||||
* @return the gas that has been registered, pulled right out of GasRegistry
|
||||
*/
|
||||
public static Gas register(Gas gas) {
|
||||
@@ -37,9 +38,7 @@ public class GasRegistry {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
registeredGasses.add(gas);
|
||||
|
||||
return getGas(gas.getName());
|
||||
}
|
||||
|
||||
@@ -47,6 +46,7 @@ public class GasRegistry {
|
||||
* Gets the gas associated with the defined ID.
|
||||
*
|
||||
* @param id - ID to check
|
||||
*
|
||||
* @return gas associated with defined ID
|
||||
*/
|
||||
public static Gas getGas(int id) {
|
||||
@@ -61,6 +61,7 @@ public class GasRegistry {
|
||||
* Gets the gas associated with the defined fluid.
|
||||
*
|
||||
* @param f - fluid to check
|
||||
*
|
||||
* @return the gas associated with the fluid
|
||||
*/
|
||||
public static Gas getGas(Fluid f) {
|
||||
@@ -77,6 +78,7 @@ public class GasRegistry {
|
||||
* Whether or not GasRegistry contains a gas with the specified name
|
||||
*
|
||||
* @param name - name to check
|
||||
*
|
||||
* @return if GasRegistry contains a gas with the defined name
|
||||
*/
|
||||
public static boolean containsGas(String name) {
|
||||
@@ -96,15 +98,16 @@ public class GasRegistry {
|
||||
* Gets the gas associated with the specified name.
|
||||
*
|
||||
* @param name - name of the gas to get
|
||||
*
|
||||
* @return gas associated with the name
|
||||
*/
|
||||
public static Gas getGas(String name) {
|
||||
name = name.toLowerCase(Locale.ROOT);
|
||||
for (Gas gas : registeredGasses) {
|
||||
if (gas.getName().toLowerCase(Locale.ROOT).equals(name.toLowerCase(Locale.ROOT))) {
|
||||
if (gas.getName().toLowerCase(Locale.ROOT).equals(name)) {
|
||||
return gas;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -112,17 +115,17 @@ public class GasRegistry {
|
||||
* Gets the gas ID of a specified gas.
|
||||
*
|
||||
* @param gas - gas to get the ID from
|
||||
*
|
||||
* @return gas ID
|
||||
*/
|
||||
public static int getGasID(Gas gas) {
|
||||
if (gas == null || !containsGas(gas.getName())) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return registeredGasses.indexOf(gas);
|
||||
}
|
||||
|
||||
private static boolean hasAlreadyStitched() {
|
||||
return Loader.instance().getLoaderState().ordinal() > LoaderState.PREINITIALIZATION.ordinal();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ public class GasStack {
|
||||
/**
|
||||
* Creates a new GasStack with a defined gas ID and quantity.
|
||||
*
|
||||
* @param id - gas ID to associate this GasStack to, will perform a GasRegistry lookup in the constructor
|
||||
* @param id - gas ID to associate this GasStack to, will perform a GasRegistry lookup in the constructor
|
||||
* @param quantity - amount of gas to be referenced in this GasStack
|
||||
*/
|
||||
public GasStack(int id, int quantity) {
|
||||
@@ -26,7 +26,7 @@ public class GasStack {
|
||||
/**
|
||||
* Creates a new GasStack with a defined Gas type and quantity.
|
||||
*
|
||||
* @param gas - gas type of the stack
|
||||
* @param gas - gas type of the stack
|
||||
* @param quantity - amount of gas to be referenced in this GasStack
|
||||
*/
|
||||
public GasStack(Gas gas, int quantity) {
|
||||
@@ -41,6 +41,7 @@ public class GasStack {
|
||||
* Returns the GasStack stored in the defined tag compound, or null if it doesn't exist.
|
||||
*
|
||||
* @param nbtTags - tag compound to read from
|
||||
*
|
||||
* @return GasStack stored in the tag compound
|
||||
*/
|
||||
public static GasStack readFromNBT(NBTTagCompound nbtTags) {
|
||||
@@ -77,6 +78,7 @@ public class GasStack {
|
||||
* Writes this GasStack to a defined tag compound.
|
||||
*
|
||||
* @param nbtTags - tag compound to write to
|
||||
*
|
||||
* @return tag compound with this GasStack's data
|
||||
*/
|
||||
public NBTTagCompound write(NBTTagCompound nbtTags) {
|
||||
@@ -109,6 +111,7 @@ public class GasStack {
|
||||
* Whether or not this GasStack's gas type is equal to the other defined GasStack.
|
||||
*
|
||||
* @param stack - GasStack to check
|
||||
*
|
||||
* @return if the GasStacks contain the same gas type
|
||||
*/
|
||||
public boolean isGasEqual(GasStack stack) {
|
||||
@@ -124,4 +127,4 @@ public class GasStack {
|
||||
public int hashCode() {
|
||||
return type == null ? 0 : type.getID();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@ public class GasTank implements GasTankInfo {
|
||||
* Returns the tank stored in the defined tag compound, or null if it doesn't exist.
|
||||
*
|
||||
* @param nbtTags - tag compound to read from
|
||||
*
|
||||
* @return tank stored in the tag compound
|
||||
*/
|
||||
public static GasTank readFromNBT(NBTTagCompound nbtTags) {
|
||||
@@ -38,7 +39,6 @@ public class GasTank implements GasTankInfo {
|
||||
|
||||
GasTank tank = new GasTank();
|
||||
tank.read(nbtTags);
|
||||
|
||||
return tank;
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ public class GasTank implements GasTankInfo {
|
||||
*
|
||||
* @param amount - amount to draw
|
||||
* @param doDraw - if the gas should actually be removed from this tank
|
||||
*
|
||||
* @return gas taken from this GasTank as a GasStack value
|
||||
*/
|
||||
public GasStack draw(int amount, boolean doDraw) {
|
||||
@@ -55,27 +56,24 @@ public class GasTank implements GasTankInfo {
|
||||
}
|
||||
|
||||
GasStack ret = new GasStack(stored.getGas(), Math.min(getStored(), amount));
|
||||
|
||||
if (ret.amount > 0) {
|
||||
if (doDraw) {
|
||||
stored.amount -= ret.amount;
|
||||
|
||||
if (stored.amount <= 0) {
|
||||
stored = null;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a specified amount of gas to this tank.
|
||||
*
|
||||
* @param amount - the GasStack for this tank to receive
|
||||
* @param amount - the GasStack for this tank to receive
|
||||
* @param doReceive - if the gas should actually be added to this tank
|
||||
*
|
||||
* @return the amount of gas accepted by this tank
|
||||
*/
|
||||
public int receive(GasStack amount, boolean doReceive) {
|
||||
@@ -100,27 +98,29 @@ public class GasTank implements GasTankInfo {
|
||||
* If this GasTank can receive the specified type of gas. Will return false if this tank does not need anymore gas.
|
||||
*
|
||||
* @param gas - gas to check
|
||||
*
|
||||
* @return if this GasTank can accept the defined gas
|
||||
*/
|
||||
public boolean canReceive(Gas gas) {
|
||||
return getNeeded() != 0 && (stored == null || (gas == null || gas == stored.getGas()));
|
||||
return getNeeded() != 0 && (stored == null || gas == null || gas == stored.getGas());
|
||||
}
|
||||
|
||||
/**
|
||||
* If this GasTank can receive the specified type of gas. Will return TRUE if this tank does not need anymore gas.
|
||||
*
|
||||
* @param gas - gas to check
|
||||
*
|
||||
* @return if this GasTank can accept the defined gas
|
||||
*/
|
||||
public boolean canReceiveType(Gas gas) {
|
||||
return stored == null || (gas == null || gas == stored.getGas());
|
||||
return stored == null || gas == null || gas == stored.getGas();
|
||||
}
|
||||
|
||||
/**
|
||||
* If this GasTank can be drawn of the specified type of gas. Will return false if this tank does not contain any
|
||||
* gas.
|
||||
* If this GasTank can be drawn of the specified type of gas. Will return false if this tank does not contain any gas.
|
||||
*
|
||||
* @param gas - gas to check
|
||||
*
|
||||
* @return if this GasTank can be drawn of the defined gas
|
||||
*/
|
||||
public boolean canDraw(Gas gas) {
|
||||
@@ -168,7 +168,6 @@ public class GasTank implements GasTankInfo {
|
||||
*/
|
||||
public void setGas(GasStack stack) {
|
||||
stored = stack;
|
||||
|
||||
if (stored != null) {
|
||||
stored.amount = Math.min(getMaxGas(), stored.amount);
|
||||
if (stored.amount <= 0) {
|
||||
@@ -199,15 +198,14 @@ public class GasTank implements GasTankInfo {
|
||||
* Writes this tank to a defined tag compound.
|
||||
*
|
||||
* @param nbtTags - tag compound to write to
|
||||
*
|
||||
* @return tag compound with this tank's data
|
||||
*/
|
||||
public NBTTagCompound write(NBTTagCompound nbtTags) {
|
||||
if (stored != null && stored.getGas() != null && stored.amount > 0) {
|
||||
nbtTags.setTag("stored", stored.write(new NBTTagCompound()));
|
||||
}
|
||||
|
||||
nbtTags.setInteger("maxGas", maxGas);
|
||||
|
||||
return nbtTags;
|
||||
}
|
||||
|
||||
@@ -224,9 +222,8 @@ public class GasTank implements GasTankInfo {
|
||||
stored = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (nbtTags.hasKey("maxGas") && nbtTags.getInteger("maxGas") != 0) {
|
||||
maxGas = nbtTags.getInteger("maxGas");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,4 +28,4 @@ public interface GasTankInfo {
|
||||
* @return - max gas
|
||||
*/
|
||||
int getMaxGas();
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ public interface IGasHandler {
|
||||
* Transfer a certain amount of gas to this block.
|
||||
*
|
||||
* @param stack - gas to add
|
||||
*
|
||||
* @return gas added
|
||||
*/
|
||||
int receiveGas(EnumFacing side, GasStack stack, boolean doTransfer);
|
||||
@@ -24,6 +25,7 @@ public interface IGasHandler {
|
||||
* Draws a certain amount of gas from this block.
|
||||
*
|
||||
* @param amount - amount to draw
|
||||
*
|
||||
* @return gas drawn
|
||||
*/
|
||||
GasStack drawGas(EnumFacing side, int amount, boolean doTransfer);
|
||||
@@ -33,6 +35,7 @@ public interface IGasHandler {
|
||||
*
|
||||
* @param side - side to check
|
||||
* @param type - type of gas to check
|
||||
*
|
||||
* @return if block accepts gas
|
||||
*/
|
||||
boolean canReceiveGas(EnumFacing side, Gas type);
|
||||
@@ -42,6 +45,7 @@ public interface IGasHandler {
|
||||
*
|
||||
* @param side - side to check
|
||||
* @param type - type of gas to check
|
||||
*
|
||||
* @return if block can be drawn of gas
|
||||
*/
|
||||
boolean canDrawGas(EnumFacing side, Gas type);
|
||||
@@ -55,4 +59,4 @@ public interface IGasHandler {
|
||||
default GasTankInfo[] getTankInfo() {
|
||||
return NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,8 @@ public interface IGasItem {
|
||||
* Adds a defined amount of a certain gas to an item.
|
||||
*
|
||||
* @param itemstack - the itemstack to add gas to
|
||||
* @param stack - the type and amount of gas to add
|
||||
* @param stack - the type and amount of gas to add
|
||||
*
|
||||
* @return the gas that was accepted by the item
|
||||
*/
|
||||
int addGas(ItemStack itemstack, GasStack stack);
|
||||
@@ -29,7 +30,8 @@ public interface IGasItem {
|
||||
* Removes the defined amount of a certain gas from the item.
|
||||
*
|
||||
* @param itemstack - the itemstack to remove gas from
|
||||
* @param amount - the amount of gas to remove
|
||||
* @param amount - the amount of gas to remove
|
||||
*
|
||||
* @return the gas that was removed by the item
|
||||
*/
|
||||
GasStack removeGas(ItemStack itemstack, int amount);
|
||||
@@ -38,7 +40,8 @@ public interface IGasItem {
|
||||
* Whether or not this storage tank be given a specific gas.
|
||||
*
|
||||
* @param itemstack - the itemstack to check
|
||||
* @param type - the type of gas the tank can possibly receive
|
||||
* @param type - the type of gas the tank can possibly receive
|
||||
*
|
||||
* @return if the item be charged
|
||||
*/
|
||||
boolean canReceiveGas(ItemStack itemstack, Gas type);
|
||||
@@ -47,7 +50,8 @@ public interface IGasItem {
|
||||
* Whether or not this item can give a gas receiver a certain type of gas.
|
||||
*
|
||||
* @param itemstack - the itemstack to check
|
||||
* @param type - the type of gas the tank can provide
|
||||
* @param type - the type of gas the tank can provide
|
||||
*
|
||||
* @return if the item can provide gas
|
||||
*/
|
||||
boolean canProvideGas(ItemStack itemstack, Gas type);
|
||||
@@ -56,6 +60,7 @@ public interface IGasItem {
|
||||
* Get the gas of a declared type.
|
||||
*
|
||||
* @param itemstack - ItemStack parameter
|
||||
*
|
||||
* @return gas stored
|
||||
*/
|
||||
GasStack getGas(ItemStack itemstack);
|
||||
@@ -64,7 +69,7 @@ public interface IGasItem {
|
||||
* Set the gas of a declared type to a new amount;
|
||||
*
|
||||
* @param itemstack - ItemStack parameter
|
||||
* @param stack - the type and amount of gas to add
|
||||
* @param stack - the type and amount of gas to add
|
||||
*/
|
||||
void setGas(ItemStack itemstack, GasStack stack);
|
||||
|
||||
@@ -72,7 +77,8 @@ public interface IGasItem {
|
||||
* Gets the maximum amount of gas this tile entity can store.
|
||||
*
|
||||
* @param itemstack - ItemStack parameter
|
||||
*
|
||||
* @return maximum gas
|
||||
*/
|
||||
int getMaxGas(ItemStack itemstack);
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,7 @@ import net.minecraft.util.EnumFacing;
|
||||
* Implement this if your block can connect to Pressurized Tubes.
|
||||
*
|
||||
* @author AidanBrady
|
||||
* @deprecated Dropped in favor of better support for machines of what implements GAS_HANDLER_CAPABILITY use {@link
|
||||
* IGasHandler} instead.
|
||||
* @deprecated Dropped in favor of better support for machines of what implements GAS_HANDLER_CAPABILITY use {@link IGasHandler} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public interface ITubeConnection {
|
||||
@@ -16,7 +15,8 @@ public interface ITubeConnection {
|
||||
* Whether or not a tube can connect to a certain orientation.
|
||||
*
|
||||
* @param side - orientation to check
|
||||
*
|
||||
* @return if a tube can connect
|
||||
*/
|
||||
boolean canTubeConnect(EnumFacing side);
|
||||
}
|
||||
}
|
||||
@@ -2,5 +2,4 @@
|
||||
package mekanism.api.gas;
|
||||
|
||||
import mekanism.api.MekanismAPI;
|
||||
import net.minecraftforge.fml.common.API;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -21,4 +21,4 @@ public class InfuseObject {
|
||||
type = infusion;
|
||||
stored = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,6 @@ public class InfuseRegistry {
|
||||
if (infuseTypes.containsKey(infuse.name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
infuseTypes.put(infuse.name, infuse);
|
||||
}
|
||||
|
||||
@@ -38,13 +37,13 @@ public class InfuseRegistry {
|
||||
* Gets an InfuseType from it's name, or null if it doesn't exist.
|
||||
*
|
||||
* @param name - the name of the InfuseType to get
|
||||
*
|
||||
* @return the name's corresponding InfuseType
|
||||
*/
|
||||
public static InfuseType get(String name) {
|
||||
if (name.equals("null")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return infuseTypes.get(name);
|
||||
}
|
||||
|
||||
@@ -52,6 +51,7 @@ public class InfuseRegistry {
|
||||
* Whether or not the registry contains a correspondent InfuseType to a name.
|
||||
*
|
||||
* @param name - the name to check
|
||||
*
|
||||
* @return if the name has a coorespondent InfuseType
|
||||
*/
|
||||
public static boolean contains(String name) {
|
||||
@@ -59,19 +59,17 @@ public class InfuseRegistry {
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a block or item that serves as an infuse object. An infuse object will store a certain type and amount
|
||||
* of infuse, and will deliver this amount to the Metallurgic Infuser's buffer of infuse. The item's stack size
|
||||
* will be decremented when it is placed in the Metallurgic Infuser's infuse slot, and the machine can accept the
|
||||
* type and amount of infuse stored in the object.
|
||||
* Registers a block or item that serves as an infuse object. An infuse object will store a certain type and amount of infuse, and will deliver this amount to the
|
||||
* Metallurgic Infuser's buffer of infuse. The item's stack size will be decremented when it is placed in the Metallurgic Infuser's infuse slot, and the machine can
|
||||
* accept the type and amount of infuse stored in the object.
|
||||
*
|
||||
* @param itemStack - stack the infuse object is linked to -- stack size is ignored
|
||||
* @param itemStack - stack the infuse object is linked to -- stack size is ignored
|
||||
* @param infuseObject - the infuse object with the type and amount data
|
||||
*/
|
||||
public static void registerInfuseObject(ItemStack itemStack, InfuseObject infuseObject) {
|
||||
if (getObject(itemStack) != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
infuseObjects.put(itemStack, infuseObject);
|
||||
}
|
||||
|
||||
@@ -79,6 +77,7 @@ public class InfuseRegistry {
|
||||
* Gets the InfuseObject data from an ItemStack.
|
||||
*
|
||||
* @param itemStack - the ItemStack to check
|
||||
*
|
||||
* @return the ItemStack's InfuseObject
|
||||
*/
|
||||
public static InfuseObject getObject(ItemStack itemStack) {
|
||||
@@ -87,7 +86,6 @@ public class InfuseRegistry {
|
||||
return obj.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -108,4 +106,4 @@ public class InfuseRegistry {
|
||||
public static Map<String, InfuseType> getInfuseMap() {
|
||||
return infuseTypes;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,11 +47,10 @@ public final class InfuseType {
|
||||
|
||||
public InfuseType setTranslationKey(String name) {
|
||||
unlocalizedName = "infuse." + name;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLocalizedName() {
|
||||
return I18n.translateToLocal(unlocalizedName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,5 +2,4 @@
|
||||
package mekanism.api.infuse;
|
||||
|
||||
import mekanism.api.MekanismAPI;
|
||||
import net.minecraftforge.fml.common.API;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -7,4 +7,4 @@ public interface ILaserReceptor {
|
||||
void receiveLaserEnergy(double energy, EnumFacing side);
|
||||
|
||||
boolean canLasersDig();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
@API(apiVersion = MekanismAPI.API_VERSION, owner = "mekanism", provides = "MekanismAPI|core")
|
||||
package mekanism.api;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -1,8 +1,6 @@
|
||||
package mekanism.api.transmitters;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
@@ -26,17 +24,15 @@ import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
public abstract class DynamicNetwork<ACCEPTOR, NETWORK extends DynamicNetwork<ACCEPTOR, NETWORK, BUFFER>, BUFFER> implements
|
||||
IClientTicker, INetworkDataHandler {
|
||||
public abstract class DynamicNetwork<ACCEPTOR, NETWORK extends DynamicNetwork<ACCEPTOR, NETWORK, BUFFER>, BUFFER> implements IClientTicker, INetworkDataHandler {
|
||||
|
||||
protected Set<IGridTransmitter<ACCEPTOR, NETWORK, BUFFER>> transmitters = Sets.newLinkedHashSet();
|
||||
protected Set<IGridTransmitter<ACCEPTOR, NETWORK, BUFFER>> transmittersToAdd = Sets.newLinkedHashSet();
|
||||
protected Set<IGridTransmitter<ACCEPTOR, NETWORK, BUFFER>> transmittersAdded = Sets.newLinkedHashSet();
|
||||
protected Set<IGridTransmitter<ACCEPTOR, NETWORK, BUFFER>> transmitters = new HashSet<>();
|
||||
protected Set<IGridTransmitter<ACCEPTOR, NETWORK, BUFFER>> transmittersToAdd = new HashSet<>();
|
||||
protected Set<IGridTransmitter<ACCEPTOR, NETWORK, BUFFER>> transmittersAdded = new HashSet<>();
|
||||
|
||||
protected Set<Coord4D> possibleAcceptors = new HashSet<>();
|
||||
protected Map<Coord4D, EnumSet<EnumFacing>> acceptorDirections = new HashMap<>();
|
||||
protected Map<IGridTransmitter<ACCEPTOR, NETWORK, BUFFER>, EnumSet<EnumFacing>> changedAcceptors = Maps
|
||||
.newHashMap();
|
||||
protected Map<IGridTransmitter<ACCEPTOR, NETWORK, BUFFER>, EnumSet<EnumFacing>> changedAcceptors = new HashMap<>();
|
||||
protected Range4D packetRange = null;
|
||||
protected int capacity = 0;
|
||||
protected double meanCapacity = 0;
|
||||
@@ -70,13 +66,12 @@ public abstract class DynamicNetwork<ACCEPTOR, NETWORK extends DynamicNetwork<AC
|
||||
|
||||
updateCapacity();
|
||||
clampBuffer();
|
||||
queueClientUpdate(Lists.newArrayList(transmittersToAdd));
|
||||
queueClientUpdate(new ArrayList<>(transmittersToAdd));
|
||||
transmittersToAdd.clear();
|
||||
}
|
||||
|
||||
if (!changedAcceptors.isEmpty()) {
|
||||
for (Entry<IGridTransmitter<ACCEPTOR, NETWORK, BUFFER>, EnumSet<EnumFacing>> entry : changedAcceptors
|
||||
.entrySet()) {
|
||||
for (Entry<IGridTransmitter<ACCEPTOR, NETWORK, BUFFER>, EnumSet<EnumFacing>> entry : changedAcceptors.entrySet()) {
|
||||
IGridTransmitter<ACCEPTOR, NETWORK, BUFFER> transmitter = entry.getKey();
|
||||
|
||||
if (transmitter.isValid()) {
|
||||
@@ -87,7 +82,6 @@ public abstract class DynamicNetwork<ACCEPTOR, NETWORK extends DynamicNetwork<AC
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
changedAcceptors.clear();
|
||||
}
|
||||
}
|
||||
@@ -99,26 +93,22 @@ public abstract class DynamicNetwork<ACCEPTOR, NETWORK extends DynamicNetwork<AC
|
||||
|
||||
if (acceptor != null) {
|
||||
possibleAcceptors.add(acceptorCoord);
|
||||
|
||||
if (directions != null) {
|
||||
directions.add(side.getOpposite());
|
||||
} else {
|
||||
acceptorDirections.put(acceptorCoord, EnumSet.of(side.getOpposite()));
|
||||
}
|
||||
} else {
|
||||
if (directions != null) {
|
||||
directions.remove(side.getOpposite());
|
||||
} else if (directions != null) {
|
||||
directions.remove(side.getOpposite());
|
||||
|
||||
if (directions.isEmpty()) {
|
||||
possibleAcceptors.remove(acceptorCoord);
|
||||
acceptorDirections.remove(acceptorCoord);
|
||||
}
|
||||
} else {
|
||||
if (directions.isEmpty()) {
|
||||
possibleAcceptors.remove(acceptorCoord);
|
||||
acceptorDirections.remove(acceptorCoord);
|
||||
}
|
||||
} else {
|
||||
possibleAcceptors.remove(acceptorCoord);
|
||||
acceptorDirections.remove(acceptorCoord);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -161,7 +151,6 @@ public abstract class DynamicNetwork<ACCEPTOR, NETWORK extends DynamicNetwork<AC
|
||||
|
||||
public void acceptorChanged(IGridTransmitter<ACCEPTOR, NETWORK, BUFFER> transmitter, EnumFacing side) {
|
||||
EnumSet<EnumFacing> directions = changedAcceptors.get(transmitter);
|
||||
|
||||
if (directions != null) {
|
||||
directions.add(side);
|
||||
} else {
|
||||
@@ -179,26 +168,22 @@ public abstract class DynamicNetwork<ACCEPTOR, NETWORK extends DynamicNetwork<AC
|
||||
}
|
||||
|
||||
transmittersToAdd.addAll(net.transmittersToAdd);
|
||||
|
||||
possibleAcceptors.addAll(net.possibleAcceptors);
|
||||
|
||||
for (Entry<Coord4D, EnumSet<EnumFacing>> entry : net.acceptorDirections.entrySet()) {
|
||||
Coord4D coord = entry.getKey();
|
||||
|
||||
if (acceptorDirections.containsKey(coord)) {
|
||||
acceptorDirections.get(coord).addAll(entry.getValue());
|
||||
} else {
|
||||
acceptorDirections.put(coord, entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Range4D getPacketRange() {
|
||||
if (packetRange == null) {
|
||||
return genPacketRange();
|
||||
}
|
||||
|
||||
return packetRange;
|
||||
}
|
||||
|
||||
@@ -240,7 +225,6 @@ public abstract class DynamicNetwork<ACCEPTOR, NETWORK extends DynamicNetwork<AC
|
||||
maxZ = coord.z;
|
||||
}
|
||||
}
|
||||
|
||||
return new Range4D(minX, minY, minZ, maxX, maxY, maxZ, initTransmitter.world().provider.getDimension());
|
||||
}
|
||||
|
||||
@@ -278,8 +262,7 @@ public abstract class DynamicNetwork<ACCEPTOR, NETWORK extends DynamicNetwork<AC
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this if things can have variable capacity along the network. An 'average' value of capacity. Calculate
|
||||
* it how you will.
|
||||
* Override this if things can have variable capacity along the network. An 'average' value of capacity. Calculate it how you will.
|
||||
*/
|
||||
protected synchronized void updateMeanCapacity() {
|
||||
if (transmitters.size() > 0) {
|
||||
@@ -316,7 +299,6 @@ public abstract class DynamicNetwork<ACCEPTOR, NETWORK extends DynamicNetwork<AC
|
||||
try {
|
||||
while (i.hasNext()) {
|
||||
DelayQueue q = i.next();
|
||||
|
||||
if (q.delay > 0) {
|
||||
q.delay--;
|
||||
} else {
|
||||
@@ -330,10 +312,8 @@ public abstract class DynamicNetwork<ACCEPTOR, NETWORK extends DynamicNetwork<AC
|
||||
|
||||
if (updateDelay > 0) {
|
||||
updateDelay--;
|
||||
|
||||
if (updateDelay == 0) {
|
||||
MinecraftForge.EVENT_BUS
|
||||
.post(new TransmittersAddedEvent(this, firstUpdate, (Collection) transmittersAdded));
|
||||
MinecraftForge.EVENT_BUS.post(new TransmittersAddedEvent(this, firstUpdate, (Collection) transmittersAdded));
|
||||
firstUpdate = false;
|
||||
transmittersAdded.clear();
|
||||
needsUpdate = true;
|
||||
@@ -465,4 +445,4 @@ public abstract class DynamicNetwork<ACCEPTOR, NETWORK extends DynamicNetwork<AC
|
||||
return o instanceof DelayQueue && ((DelayQueue) o).player.equals(this.player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,4 +8,4 @@ public interface IBlockableConnection {
|
||||
boolean canConnectMutual(EnumFacing side);
|
||||
|
||||
boolean canConnect(EnumFacing side);
|
||||
}
|
||||
}
|
||||
@@ -72,6 +72,7 @@ public interface IGridTransmitter<ACCEPTOR, NETWORK extends DynamicNetwork<ACCEP
|
||||
|
||||
/**
|
||||
* If the transmitter does not have a buffer this will try to fallback on the network's buffer.
|
||||
*
|
||||
* @return The transmitter's buffer, or if null the network's buffer.
|
||||
*/
|
||||
@Nullable
|
||||
@@ -84,20 +85,17 @@ public interface IGridTransmitter<ACCEPTOR, NETWORK extends DynamicNetwork<ACCEP
|
||||
return buffer;
|
||||
}
|
||||
|
||||
default boolean isCompatibleWith(IGridTransmitter<ACCEPTOR, NETWORK, BUFFER> other){
|
||||
default boolean isCompatibleWith(IGridTransmitter<ACCEPTOR, NETWORK, BUFFER> other) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets called on an orphan if at least one attempted network fails to connect
|
||||
* due to having connected to another network that is incompatible with the
|
||||
* next attempted ones.
|
||||
* Gets called on an orphan if at least one attempted network fails to connect due to having connected to another network that is incompatible with the next attempted
|
||||
* ones.
|
||||
*
|
||||
* This is primarily used for if extra handling needs to be done, such as
|
||||
* refreshing the connections visually on a minor delay so that it has
|
||||
* time to have the buffer no longer be null and properly compare the
|
||||
* connection.
|
||||
* This is primarily used for if extra handling needs to be done, such as refreshing the connections visually on a minor delay so that it has time to have the buffer
|
||||
* no longer be null and properly compare the connection.
|
||||
*/
|
||||
default void connectionFailed() {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,4 +7,4 @@ public interface INetworkDataHandler {
|
||||
String getStoredInfo();
|
||||
|
||||
String getFlowInfo();
|
||||
}
|
||||
}
|
||||
@@ -8,4 +8,4 @@ public interface ITransmitter {
|
||||
* @return TransmissionType this transmitter uses
|
||||
*/
|
||||
TransmissionType getTransmissionType();
|
||||
}
|
||||
}
|
||||
@@ -51,10 +51,6 @@ public enum TransmissionType {
|
||||
}
|
||||
|
||||
public boolean checkTransmissionType(TileEntity sideTile, TileEntity currentTile) {
|
||||
if (sideTile instanceof ITransmitter) {
|
||||
return ((ITransmitter) sideTile).getTransmissionType() == this;
|
||||
}
|
||||
|
||||
return false;
|
||||
return sideTile instanceof ITransmitter && ((ITransmitter) sideTile).getTransmissionType() == this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
package mekanism.api.transmitters;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import java.util.Deque;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.MekanismAPI;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -22,16 +22,15 @@ public class TransmitterNetworkRegistry {
|
||||
private static TransmitterNetworkRegistry INSTANCE = new TransmitterNetworkRegistry();
|
||||
private static boolean loaderRegistered = false;
|
||||
private static Logger logger = LogManager.getLogger("MekanismTransmitters");
|
||||
private HashSet<DynamicNetwork> networks = Sets.newHashSet();
|
||||
private HashSet<DynamicNetwork> networksToChange = Sets.newHashSet();
|
||||
private HashSet<IGridTransmitter> invalidTransmitters = Sets.newHashSet();
|
||||
private HashMap<Coord4D, IGridTransmitter> orphanTransmitters = Maps.newHashMap();
|
||||
private HashMap<Coord4D, IGridTransmitter> newOrphanTransmitters = Maps.newHashMap();
|
||||
private Set<DynamicNetwork> networks = new HashSet<>();
|
||||
private Set<DynamicNetwork> networksToChange = new HashSet<>();
|
||||
private Set<IGridTransmitter> invalidTransmitters = new HashSet<>();
|
||||
private Map<Coord4D, IGridTransmitter> orphanTransmitters = new HashMap<>();
|
||||
private Map<Coord4D, IGridTransmitter> newOrphanTransmitters = new HashMap<>();
|
||||
|
||||
public static void initiate() {
|
||||
if (!loaderRegistered) {
|
||||
loaderRegistered = true;
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(INSTANCE);
|
||||
}
|
||||
}
|
||||
@@ -82,11 +81,8 @@ public class TransmitterNetworkRegistry {
|
||||
|
||||
public void tickEnd() {
|
||||
removeInvalidTransmitters();
|
||||
|
||||
assignOrphans();
|
||||
|
||||
commitChanges();
|
||||
|
||||
for (DynamicNetwork net : networks) {
|
||||
net.tick();
|
||||
}
|
||||
@@ -100,7 +96,6 @@ public class TransmitterNetworkRegistry {
|
||||
for (IGridTransmitter invalid : invalidTransmitters) {
|
||||
if (!(invalid.isOrphan() && invalid.isValid())) {
|
||||
DynamicNetwork n = invalid.getTransmitterNetwork();
|
||||
|
||||
if (n != null) {
|
||||
n.invalidate();
|
||||
}
|
||||
@@ -118,9 +113,8 @@ public class TransmitterNetworkRegistry {
|
||||
logger.info("Dealing with " + orphanTransmitters.size() + " orphan Transmitters");
|
||||
}
|
||||
|
||||
for (IGridTransmitter orphanTransmitter : (new HashMap<>(orphanTransmitters)).values()) {
|
||||
for (IGridTransmitter orphanTransmitter : new HashMap<>(orphanTransmitters).values()) {
|
||||
DynamicNetwork network = getNetworkFromOrphan(orphanTransmitter);
|
||||
|
||||
if (network != null) {
|
||||
networksToChange.add(network);
|
||||
network.register();
|
||||
@@ -130,8 +124,7 @@ public class TransmitterNetworkRegistry {
|
||||
orphanTransmitters.clear();
|
||||
}
|
||||
|
||||
public <A, N extends DynamicNetwork<A, N, BUFFER>, BUFFER> DynamicNetwork<A, N, BUFFER> getNetworkFromOrphan(
|
||||
IGridTransmitter<A, N, BUFFER> startOrphan) {
|
||||
public <A, N extends DynamicNetwork<A, N, BUFFER>, BUFFER> DynamicNetwork<A, N, BUFFER> getNetworkFromOrphan(IGridTransmitter<A, N, BUFFER> startOrphan) {
|
||||
if (startOrphan.isValid() && startOrphan.isOrphan()) {
|
||||
OrphanPathFinder<A, N, BUFFER> finder = new OrphanPathFinder<>(startOrphan);
|
||||
finder.start();
|
||||
@@ -140,28 +133,20 @@ public class TransmitterNetworkRegistry {
|
||||
switch (finder.networksFound.size()) {
|
||||
case 0:
|
||||
if (MekanismAPI.debug) {
|
||||
logger.info("No networks found. Creating new network for " + finder.connectedTransmitters.size()
|
||||
+ " transmitters");
|
||||
logger.info("No networks found. Creating new network for " + finder.connectedTransmitters.size() + " transmitters");
|
||||
}
|
||||
|
||||
network = startOrphan.createEmptyNetwork();
|
||||
|
||||
break;
|
||||
case 1:
|
||||
if (MekanismAPI.debug) {
|
||||
logger.info("Adding " + finder.connectedTransmitters.size()
|
||||
+ " transmitters to single found network");
|
||||
logger.info("Adding " + finder.connectedTransmitters.size() + " transmitters to single found network");
|
||||
}
|
||||
|
||||
network = finder.networksFound.iterator().next();
|
||||
|
||||
break;
|
||||
default:
|
||||
if (MekanismAPI.debug) {
|
||||
logger.info("Merging " + finder.networksFound.size() + " networks with "
|
||||
+ finder.connectedTransmitters.size() + " new transmitters");
|
||||
logger.info("Merging " + finder.networksFound.size() + " networks with " + finder.connectedTransmitters.size() + " new transmitters");
|
||||
}
|
||||
|
||||
network = startOrphan.mergeNetworks(finder.networksFound);
|
||||
}
|
||||
|
||||
@@ -173,10 +158,8 @@ public class TransmitterNetworkRegistry {
|
||||
// so that it can refresh the connections
|
||||
startOrphan.connectionFailed();
|
||||
}
|
||||
|
||||
return network;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -184,7 +167,6 @@ public class TransmitterNetworkRegistry {
|
||||
for (DynamicNetwork network : networksToChange) {
|
||||
network.commit();
|
||||
}
|
||||
|
||||
networksToChange.clear();
|
||||
}
|
||||
|
||||
@@ -200,7 +182,6 @@ public class TransmitterNetworkRegistry {
|
||||
for (DynamicNetwork network : networks) {
|
||||
strings[i++] = network.toString();
|
||||
}
|
||||
|
||||
return strings;
|
||||
}
|
||||
|
||||
@@ -208,10 +189,10 @@ public class TransmitterNetworkRegistry {
|
||||
|
||||
public IGridTransmitter<A, N, BUFFER> startPoint;
|
||||
|
||||
public HashSet<Coord4D> iterated = Sets.newHashSet();
|
||||
public HashSet<Coord4D> iterated = new HashSet<>();
|
||||
|
||||
public HashSet<IGridTransmitter<A, N, BUFFER>> connectedTransmitters = Sets.newHashSet();
|
||||
public HashSet<N> networksFound = Sets.newHashSet();
|
||||
public HashSet<IGridTransmitter<A, N, BUFFER>> connectedTransmitters = new HashSet<>();
|
||||
public HashSet<N> networksFound = new HashSet<>();
|
||||
|
||||
private Deque<Coord4D> queue = new LinkedList<>();
|
||||
|
||||
@@ -242,8 +223,8 @@ public class TransmitterNetworkRegistry {
|
||||
if (orphanTransmitters.containsKey(from)) {
|
||||
IGridTransmitter<A, N, BUFFER> transmitter = orphanTransmitters.get(from);
|
||||
|
||||
if (transmitter.isValid() && transmitter.isOrphan() && (connectedTransmitters.isEmpty()
|
||||
|| connectedTransmitters.stream().anyMatch(existing -> existing.isCompatibleWith(transmitter)))) {
|
||||
if (transmitter.isValid() && transmitter.isOrphan() &&
|
||||
(connectedTransmitters.isEmpty() || connectedTransmitters.stream().anyMatch(existing -> existing.isCompatibleWith(transmitter)))) {
|
||||
connectedTransmitters.add(transmitter);
|
||||
transmitter.setOrphan(false);
|
||||
|
||||
@@ -253,7 +234,6 @@ public class TransmitterNetworkRegistry {
|
||||
continue;
|
||||
}
|
||||
Coord4D directionCoord = transmitter.getAdjacentConnectableTransmitterCoord(direction);
|
||||
|
||||
if (directionCoord != null && !iterated.contains(directionCoord)) {
|
||||
queue.addLast(directionCoord);
|
||||
}
|
||||
@@ -278,4 +258,4 @@ public class TransmitterNetworkRegistry {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,5 +2,4 @@
|
||||
package mekanism.api.transmitters;
|
||||
|
||||
import mekanism.api.MekanismAPI;
|
||||
import net.minecraftforge.fml.common.API;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -20,9 +20,7 @@ public class BlockInfo {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof BlockInfo &&
|
||||
((BlockInfo) obj).block == block &&
|
||||
((BlockInfo) obj).meta == meta;
|
||||
return obj instanceof BlockInfo && ((BlockInfo) obj).block == block && ((BlockInfo) obj).meta == meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,9 +19,7 @@ public class ItemInfo {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof ItemInfo &&
|
||||
((ItemInfo) obj).item == item &&
|
||||
((ItemInfo) obj).meta == meta;
|
||||
return obj instanceof ItemInfo && ((ItemInfo) obj).item == item && ((ItemInfo) obj).meta == meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -31,4 +29,4 @@ public class ItemInfo {
|
||||
code = 7 * code + meta;
|
||||
return code;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
@API(apiVersion = "9.0.0", owner = "mekanism", provides = "MekanismAPI|util")
|
||||
package mekanism.api.util;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -13,8 +13,8 @@ public class ApiJarPresentException extends CustomModLoadingErrorDisplayExceptio
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final @Nonnull
|
||||
String[] msgs;
|
||||
@Nonnull
|
||||
private final String[] msgs;
|
||||
|
||||
public ApiJarPresentException(@Nonnull String[] msgs) {
|
||||
super(msgs[0], new RuntimeException());
|
||||
@@ -26,8 +26,7 @@ public class ApiJarPresentException extends CustomModLoadingErrorDisplayExceptio
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(@Nullable GuiErrorScreen errorScreen, @Nullable FontRenderer fontRenderer, int mouseRelX,
|
||||
int mouseRelY, float tickTime) {
|
||||
public void drawScreen(@Nullable GuiErrorScreen errorScreen, @Nullable FontRenderer fontRenderer, int mouseRelX, int mouseRelY, float tickTime) {
|
||||
if (errorScreen == null || fontRenderer == null) {
|
||||
return;
|
||||
}
|
||||
@@ -41,4 +40,4 @@ public class ApiJarPresentException extends CustomModLoadingErrorDisplayExceptio
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,8 +27,7 @@ public class ClientConnectionHandler {
|
||||
} else {
|
||||
// If the client is connecting to a foreign integrated or dedicated server.
|
||||
try {
|
||||
MekanismClient.voiceClient = new VoiceClient(
|
||||
((InetSocketAddress) event.getManager().getRemoteAddress()).getHostString());
|
||||
MekanismClient.voiceClient = new VoiceClient(((InetSocketAddress) event.getManager().getRemoteAddress()).getHostString());
|
||||
} catch (Throwable e) {
|
||||
Mekanism.logger.error("Unable to establish VoiceClient on remote connection.", e);
|
||||
}
|
||||
|
||||
@@ -14,4 +14,4 @@ public class ClientPlayerTracker {
|
||||
Mekanism.playerState.clearPlayer(event.player);
|
||||
Mekanism.freeRunnerOn.remove(event.player.getUniqueID());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -263,31 +263,24 @@ public class ClientProxy extends CommonProxy {
|
||||
@Override
|
||||
public void loadConfiguration() {
|
||||
super.loadConfiguration();
|
||||
|
||||
MekanismConfig.current().client.load(Mekanism.configuration);
|
||||
|
||||
if (Mekanism.configuration.hasChanged()) {
|
||||
Mekanism.configuration.save();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openPersonalChest(EntityPlayer entityplayer, int id, int windowId, boolean isBlock, BlockPos pos,
|
||||
EnumHand hand) {
|
||||
TileEntityPersonalChest tileEntity = (TileEntityPersonalChest) entityplayer.world.getTileEntity(pos);
|
||||
|
||||
public void openPersonalChest(EntityPlayer entityplayer, int id, int windowId, boolean isBlock, BlockPos pos, EnumHand hand) {
|
||||
if (id == 0) {
|
||||
if (isBlock) {
|
||||
FMLClientHandler.instance()
|
||||
.displayGuiScreen(entityplayer, new GuiPersonalChest(entityplayer.inventory, tileEntity));
|
||||
TileEntityPersonalChest tileEntity = (TileEntityPersonalChest) entityplayer.world.getTileEntity(pos);
|
||||
FMLClientHandler.instance().displayGuiScreen(entityplayer, new GuiPersonalChest(entityplayer.inventory, tileEntity));
|
||||
entityplayer.openContainer.windowId = windowId;
|
||||
} else {
|
||||
ItemStack stack = entityplayer.getHeldItem(hand);
|
||||
|
||||
if (MachineType.get(stack) == MachineType.PERSONAL_CHEST) {
|
||||
InventoryPersonalChest inventory = new InventoryPersonalChest(stack, hand);
|
||||
FMLClientHandler.instance()
|
||||
.displayGuiScreen(entityplayer, new GuiPersonalChest(entityplayer.inventory, inventory));
|
||||
FMLClientHandler.instance().displayGuiScreen(entityplayer, new GuiPersonalChest(entityplayer.inventory, inventory));
|
||||
entityplayer.openContainer.windowId = windowId;
|
||||
}
|
||||
}
|
||||
@@ -296,63 +289,45 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
@Override
|
||||
public void registerTESRs() {
|
||||
ClientRegistry
|
||||
.bindTileEntitySpecialRenderer(TileEntityAdvancedFactory.class, new RenderConfigurableMachine<>());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAdvancedFactory.class, new RenderConfigurableMachine<>());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBin.class, new RenderBin());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBoilerCasing.class, new RenderThermoelectricBoiler());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBoilerValve.class, new RenderThermoelectricBoiler());
|
||||
ClientRegistry
|
||||
.bindTileEntitySpecialRenderer(TileEntityChemicalCrystallizer.class, new RenderChemicalCrystallizer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityChemicalDissolutionChamber.class,
|
||||
new RenderChemicalDissolutionChamber());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityChemicalInjectionChamber.class,
|
||||
new RenderConfigurableMachine<>());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityChemicalCrystallizer.class, new RenderChemicalCrystallizer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityChemicalDissolutionChamber.class, new RenderChemicalDissolutionChamber());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityChemicalInjectionChamber.class, new RenderConfigurableMachine<>());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCombiner.class, new RenderConfigurableMachine<>());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCrusher.class, new RenderConfigurableMachine<>());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDigitalMiner.class, new RenderDigitalMiner());
|
||||
ClientRegistry
|
||||
.bindTileEntitySpecialRenderer(TileEntityDiversionTransporter.class, new RenderLogisticalTransporter());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDiversionTransporter.class, new RenderLogisticalTransporter());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDynamicTank.class, new RenderDynamicTank());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDynamicValve.class, new RenderDynamicTank());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityEliteFactory.class, new RenderConfigurableMachine<>());
|
||||
ClientRegistry
|
||||
.bindTileEntitySpecialRenderer(TileEntityEnergizedSmelter.class, new RenderConfigurableMachine<>());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityEnergizedSmelter.class, new RenderConfigurableMachine<>());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityEnergyCube.class, new RenderEnergyCube());
|
||||
ClientRegistry
|
||||
.bindTileEntitySpecialRenderer(TileEntityEnrichmentChamber.class, new RenderConfigurableMachine<>());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityEnrichmentChamber.class, new RenderConfigurableMachine<>());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFactory.class, new RenderConfigurableMachine<>());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFluidTank.class, RenderFluidTank.INSTANCE);
|
||||
ClientRegistry
|
||||
.bindTileEntitySpecialRenderer(TileEntityFormulaicAssemblicator.class, new RenderConfigurableMachine<>());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFormulaicAssemblicator.class, new RenderConfigurableMachine<>());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityGasTank.class, new RenderGasTank());
|
||||
ClientRegistry
|
||||
.bindTileEntitySpecialRenderer(TileEntityLogisticalTransporter.class, new RenderLogisticalTransporter());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLogisticalTransporter.class, new RenderLogisticalTransporter());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMechanicalPipe.class, new RenderMechanicalPipe());
|
||||
ClientRegistry
|
||||
.bindTileEntitySpecialRenderer(TileEntityMetallurgicInfuser.class, new RenderConfigurableMachine<>());
|
||||
ClientRegistry
|
||||
.bindTileEntitySpecialRenderer(TileEntityOsmiumCompressor.class, new RenderConfigurableMachine<>());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMetallurgicInfuser.class, new RenderConfigurableMachine<>());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityOsmiumCompressor.class, new RenderConfigurableMachine<>());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPRC.class, new RenderConfigurableMachine<>());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPersonalChest.class, new RenderPersonalChest());
|
||||
ClientRegistry
|
||||
.bindTileEntitySpecialRenderer(TileEntityPrecisionSawmill.class, new RenderConfigurableMachine<>());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPrecisionSawmill.class, new RenderConfigurableMachine<>());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPressurizedTube.class, new RenderPressurizedTube());
|
||||
ClientRegistry
|
||||
.bindTileEntitySpecialRenderer(TileEntityPurificationChamber.class, new RenderConfigurableMachine<>());
|
||||
ClientRegistry
|
||||
.bindTileEntitySpecialRenderer(TileEntityQuantumEntangloporter.class, new RenderQuantumEntangloporter());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPurificationChamber.class, new RenderConfigurableMachine<>());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityQuantumEntangloporter.class, new RenderQuantumEntangloporter());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityResistiveHeater.class, new RenderResistiveHeater());
|
||||
ClientRegistry
|
||||
.bindTileEntitySpecialRenderer(TileEntityRestrictiveTransporter.class, new RenderLogisticalTransporter());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRestrictiveTransporter.class, new RenderLogisticalTransporter());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySecurityDesk.class, new RenderSecurityDesk());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySeismicVibrator.class, new RenderSeismicVibrator());
|
||||
ClientRegistry
|
||||
.bindTileEntitySpecialRenderer(TileEntitySolarNeutronActivator.class, new RenderSolarNeutronActivator());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySolarNeutronActivator.class, new RenderSolarNeutronActivator());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTeleporter.class, new RenderTeleporter());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityThermalEvaporationController.class,
|
||||
new RenderThermalEvaporationController());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityThermodynamicConductor.class,
|
||||
new RenderThermodynamicConductor());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityThermalEvaporationController.class, new RenderThermalEvaporationController());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityThermodynamicConductor.class, new RenderThermodynamicConductor());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityUniversalCable.class, new RenderUniversalCable());
|
||||
}
|
||||
|
||||
@@ -415,8 +390,7 @@ public class ClientProxy extends CommonProxy {
|
||||
ModelBakery.registerItemVariants(MekanismItems.WalkieTalkie, ItemWalkieTalkie.getModel(i));
|
||||
}
|
||||
|
||||
ModelBakery.registerItemVariants(MekanismItems.CraftingFormula, ItemCraftingFormula.MODEL,
|
||||
ItemCraftingFormula.INVALID_MODEL, ItemCraftingFormula.ENCODED_MODEL);
|
||||
ModelBakery.registerItemVariants(MekanismItems.CraftingFormula, ItemCraftingFormula.MODEL, ItemCraftingFormula.INVALID_MODEL, ItemCraftingFormula.ENCODED_MODEL);
|
||||
|
||||
MekanismItems.Jetpack.setTileEntityItemStackRenderer(new RenderJetpack());
|
||||
MekanismItems.ArmoredJetpack.setTileEntityItemStackRenderer(new RenderArmoredJetpack());
|
||||
@@ -430,7 +404,6 @@ public class ClientProxy extends CommonProxy {
|
||||
Item.getItemFromBlock(MekanismBlocks.MachineBlock2).setTileEntityItemStackRenderer(new RenderMachineItem());
|
||||
Item.getItemFromBlock(MekanismBlocks.MachineBlock3).setTileEntityItemStackRenderer(new RenderMachineItem());
|
||||
Item.getItemFromBlock(MekanismBlocks.BasicBlock2).setTileEntityItemStackRenderer(new RenderBasicBlockItem());
|
||||
|
||||
}
|
||||
|
||||
private ModelResourceLocation getInventoryMRL(String type) {
|
||||
@@ -453,45 +426,28 @@ public class ClientProxy extends CommonProxy {
|
||||
ModelLoader.setCustomStateMapper(MekanismBlocks.CardboardBox, boxMapper);
|
||||
ModelLoader.setCustomStateMapper(MekanismBlocks.Transmitter, transmitterMapper);
|
||||
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.ObsidianTNT), 0,
|
||||
getInventoryMRL("ObsidianTNT"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.SaltBlock), 0,
|
||||
getInventoryMRL("SaltBlock"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.CardboardBox), 0,
|
||||
new ModelResourceLocation("mekanism:CardboardBox", "storage=false"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.CardboardBox), 1,
|
||||
new ModelResourceLocation("mekanism:CardboardBox", "storage=true"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.EnergyCube), 0,
|
||||
getInventoryMRL("EnergyCube"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.ObsidianTNT), 0, getInventoryMRL("ObsidianTNT"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.SaltBlock), 0, getInventoryMRL("SaltBlock"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.CardboardBox), 0, new ModelResourceLocation("mekanism:CardboardBox", "storage=false"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.CardboardBox), 1, new ModelResourceLocation("mekanism:CardboardBox", "storage=true"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.EnergyCube), 0, getInventoryMRL("EnergyCube"));
|
||||
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.MachineBlock), 4,
|
||||
getInventoryMRL("digital_miner"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.MachineBlock), 13,
|
||||
getInventoryMRL("personal_chest"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.MachineBlock), 4, getInventoryMRL("digital_miner"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.MachineBlock), 13, getInventoryMRL("personal_chest"));
|
||||
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.MachineBlock2), 6,
|
||||
getInventoryMRL("chemical_dissolution_chamber"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.MachineBlock2), 8,
|
||||
getInventoryMRL("chemical_crystallizer"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.MachineBlock2), 9,
|
||||
getInventoryMRL("seismic_vibrator"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.MachineBlock2), 6, getInventoryMRL("chemical_dissolution_chamber"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.MachineBlock2), 8, getInventoryMRL("chemical_crystallizer"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.MachineBlock2), 9, getInventoryMRL("seismic_vibrator"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.MachineBlock2), 11, getInventoryMRL("fluid_tank"));
|
||||
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.MachineBlock2), 11,
|
||||
getInventoryMRL("fluid_tank"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.MachineBlock3), 0, getInventoryMRL("quantum_entangloporter"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.MachineBlock3), 1, getInventoryMRL("solar_neutron_activator"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.MachineBlock3), 4, getInventoryMRL("resistive_heater"));
|
||||
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.MachineBlock3), 0,
|
||||
getInventoryMRL("quantum_entangloporter"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.MachineBlock3), 1,
|
||||
getInventoryMRL("solar_neutron_activator"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.MachineBlock3), 4,
|
||||
getInventoryMRL("resistive_heater"));
|
||||
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.BasicBlock2), 9,
|
||||
getInventoryMRL("security_desk"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.BasicBlock2), 9, getInventoryMRL("security_desk"));
|
||||
|
||||
for (int i = 0; i < EnumColor.DYES.length; i++) {
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.GlowPanel), i,
|
||||
getInventoryMRL("glowpanel"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.GlowPanel), i, getInventoryMRL("glowpanel"));
|
||||
}
|
||||
|
||||
for (MachineType type : MachineType.values()) {
|
||||
@@ -503,8 +459,7 @@ public class ClientProxy extends CommonProxy {
|
||||
String resource = "mekanism:" + type.getName();
|
||||
RecipeType recipePointer = null;
|
||||
|
||||
if (type == MachineType.BASIC_FACTORY || type == MachineType.ADVANCED_FACTORY
|
||||
|| type == MachineType.ELITE_FACTORY) {
|
||||
if (type == MachineType.BASIC_FACTORY || type == MachineType.ADVANCED_FACTORY || type == MachineType.ELITE_FACTORY) {
|
||||
recipePointer = RecipeType.values()[0];
|
||||
resource = "mekanism:" + type.getName() + "_" + recipePointer.getName();
|
||||
}
|
||||
@@ -512,38 +467,30 @@ public class ClientProxy extends CommonProxy {
|
||||
while (true) {
|
||||
if (machineResources.get(resource) == null) {
|
||||
List<String> entries = new ArrayList<>();
|
||||
|
||||
if (type.hasActiveTexture()) {
|
||||
entries.add("active=false");
|
||||
}
|
||||
|
||||
if (type.hasRotations()) {
|
||||
entries.add("facing=north");
|
||||
}
|
||||
|
||||
String properties = getProperties(entries);
|
||||
|
||||
ModelResourceLocation model = new ModelResourceLocation(resource, properties);
|
||||
|
||||
machineResources.put(resource, model);
|
||||
modelsToAdd.add(model);
|
||||
|
||||
if (type == MachineType.BASIC_FACTORY || type == MachineType.ADVANCED_FACTORY
|
||||
|| type == MachineType.ELITE_FACTORY) {
|
||||
if (type == MachineType.BASIC_FACTORY || type == MachineType.ADVANCED_FACTORY || type == MachineType.ELITE_FACTORY) {
|
||||
if (recipePointer.ordinal() < RecipeType.values().length - 1) {
|
||||
recipePointer = RecipeType.values()[recipePointer.ordinal() + 1];
|
||||
resource = "mekanism:" + type.getName() + "_" + recipePointer.getName();
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
ModelLoader.registerItemVariants(Item.getItemFromBlock(type.typeBlock.getBlock()),
|
||||
modelsToAdd.toArray(new ModelResourceLocation[]{}));
|
||||
ModelLoader.registerItemVariants(Item.getItemFromBlock(type.typeBlock.getBlock()), modelsToAdd.toArray(new ModelResourceLocation[]{}));
|
||||
}
|
||||
|
||||
for (BasicBlockType type : BasicBlockType.values()) {
|
||||
@@ -559,41 +506,32 @@ public class ClientProxy extends CommonProxy {
|
||||
while (true) {
|
||||
if (basicResources.get(resource) == null) {
|
||||
List<String> entries = new ArrayList<>();
|
||||
|
||||
if (type.hasActiveTexture()) {
|
||||
entries.add("active=false");
|
||||
}
|
||||
|
||||
if (type.hasRotations() || type == BasicBlockType.THERMAL_EVAPORATION_CONTROLLER) {
|
||||
entries.add("facing=north");
|
||||
}
|
||||
|
||||
//TODO: Is this check against bin's needed
|
||||
String properties = type == BasicBlockType.BIN ? "inventory" : getProperties(entries);
|
||||
|
||||
ModelResourceLocation model = new ModelResourceLocation(resource, properties);
|
||||
|
||||
basicResources.put(resource, model);
|
||||
modelsToAdd.add(model);
|
||||
|
||||
if (type.tiers) {
|
||||
if (tierPointer.ordinal() < BaseTier.values().length - 1) {
|
||||
tierPointer = BaseTier.values()[tierPointer.ordinal() + 1];
|
||||
|
||||
if (type == BasicBlockType.BIN || tierPointer.isObtainable()) {
|
||||
resource = "mekanism:" + type.getName() + "_" + tierPointer.getName();
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
ModelLoader.registerItemVariants(Item.getItemFromBlock(type.blockType.getBlock()),
|
||||
modelsToAdd.toArray(new ModelResourceLocation[]{}));
|
||||
ModelLoader.registerItemVariants(Item.getItemFromBlock(type.blockType.getBlock()), modelsToAdd.toArray(new ModelResourceLocation[]{}));
|
||||
}
|
||||
|
||||
for (TransmitterType type : TransmitterType.values()) {
|
||||
@@ -610,76 +548,55 @@ public class ClientProxy extends CommonProxy {
|
||||
if (transmitterResources.get(resource) == null) {
|
||||
String properties = "inventory";
|
||||
ModelResourceLocation model = new ModelResourceLocation(resource, properties);
|
||||
|
||||
transmitterResources.put(resource, model);
|
||||
modelsToAdd.add(model);
|
||||
|
||||
if (type.hasTiers()) {
|
||||
if (tierPointer.ordinal() < BaseTier.values().length - 1) {
|
||||
tierPointer = BaseTier.values()[tierPointer.ordinal() + 1];
|
||||
|
||||
if (tierPointer.isObtainable()) {
|
||||
resource = "mekanism:" + type.getName() + "_" + tierPointer.getName();
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
ModelLoader.registerItemVariants(Item.getItemFromBlock(MekanismBlocks.Transmitter),
|
||||
modelsToAdd.toArray(new ModelResourceLocation[]{}));
|
||||
ModelLoader.registerItemVariants(Item.getItemFromBlock(MekanismBlocks.Transmitter), modelsToAdd.toArray(new ModelResourceLocation[]{}));
|
||||
}
|
||||
|
||||
for (EnumColor color : EnumColor.DYES) {
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.PlasticBlock),
|
||||
color.getMetaValue(), new ModelResourceLocation("mekanism:plastic_block", "type=plastic"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.SlickPlasticBlock),
|
||||
color.getMetaValue(), new ModelResourceLocation("mekanism:plastic_block", "type=slick"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.GlowPlasticBlock),
|
||||
color.getMetaValue(), new ModelResourceLocation("mekanism:plastic_block", "type=glow"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.ReinforcedPlasticBlock),
|
||||
color.getMetaValue(), new ModelResourceLocation("mekanism:plastic_block", "type=reinforced"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.RoadPlasticBlock),
|
||||
color.getMetaValue(), new ModelResourceLocation("mekanism:plastic_block", "type=road"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.PlasticFence),
|
||||
color.getMetaValue(), getInventoryMRL("PlasticFence"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.PlasticBlock), color.getMetaValue(), new ModelResourceLocation("mekanism:plastic_block", "type=plastic"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.SlickPlasticBlock), color.getMetaValue(), new ModelResourceLocation("mekanism:plastic_block", "type=slick"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.GlowPlasticBlock), color.getMetaValue(), new ModelResourceLocation("mekanism:plastic_block", "type=glow"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.ReinforcedPlasticBlock), color.getMetaValue(), new ModelResourceLocation("mekanism:plastic_block", "type=reinforced"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.RoadPlasticBlock), color.getMetaValue(), new ModelResourceLocation("mekanism:plastic_block", "type=road"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.PlasticFence), color.getMetaValue(), getInventoryMRL("PlasticFence"));
|
||||
}
|
||||
|
||||
for (EnumOreType ore : EnumOreType.values()) {
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.OreBlock), ore.ordinal(),
|
||||
new ModelResourceLocation("mekanism:OreBlock", "type=" + ore.getName()));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.OreBlock), ore.ordinal(), new ModelResourceLocation("mekanism:OreBlock", "type=" + ore.getName()));
|
||||
}
|
||||
|
||||
ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(MekanismBlocks.GasTank), stack ->
|
||||
{
|
||||
ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(MekanismBlocks.GasTank), stack -> {
|
||||
GasTankTier tier = GasTankTier.values()[((ItemBlockGasTank) stack.getItem()).getBaseTier(stack).ordinal()];
|
||||
ResourceLocation baseLocation = new ResourceLocation("mekanism", "GasTank");
|
||||
|
||||
return new ModelResourceLocation(baseLocation, "facing=north,tier=" + tier);
|
||||
});
|
||||
|
||||
ItemMeshDefinition machineMesher = stack ->
|
||||
{
|
||||
ItemMeshDefinition machineMesher = stack -> {
|
||||
MachineType type = MachineType.get(stack);
|
||||
|
||||
if (type != null) {
|
||||
String resource = "mekanism:" + type.getName();
|
||||
|
||||
if (type == MachineType.BASIC_FACTORY || type == MachineType.ADVANCED_FACTORY
|
||||
|| type == MachineType.ELITE_FACTORY) {
|
||||
if (type == MachineType.BASIC_FACTORY || type == MachineType.ADVANCED_FACTORY || type == MachineType.ELITE_FACTORY) {
|
||||
RecipeType recipe = ((ItemBlockMachine) stack.getItem()).getRecipeTypeOrNull(stack);
|
||||
if (recipe != null) {
|
||||
resource = "mekanism:" + type.getName() + "_" + recipe.getName();
|
||||
}
|
||||
}
|
||||
|
||||
return machineResources.get(resource);
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
@@ -687,75 +604,58 @@ public class ClientProxy extends CommonProxy {
|
||||
ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(MekanismBlocks.MachineBlock2), machineMesher);
|
||||
ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(MekanismBlocks.MachineBlock3), machineMesher);
|
||||
|
||||
ItemMeshDefinition basicMesher = stack ->
|
||||
{
|
||||
ItemMeshDefinition basicMesher = stack -> {
|
||||
BasicBlockType type = BasicBlockType.get(stack);
|
||||
|
||||
if (type != null) {
|
||||
String resource = "mekanism:" + type.getName();
|
||||
|
||||
if (type.tiers) {
|
||||
BaseTier tier = ((ItemBlockBasic) stack.getItem()).getBaseTier(stack);
|
||||
resource = "mekanism:" + type.getName() + "_" + tier.getName();
|
||||
}
|
||||
|
||||
return basicResources.get(resource);
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(MekanismBlocks.BasicBlock), basicMesher);
|
||||
ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(MekanismBlocks.BasicBlock2), basicMesher);
|
||||
|
||||
ItemMeshDefinition transmitterMesher = stack ->
|
||||
{
|
||||
ItemMeshDefinition transmitterMesher = stack -> {
|
||||
TransmitterType type = TransmitterType.get(stack.getItemDamage());
|
||||
|
||||
if (type != null) {
|
||||
String resource = "mekanism:" + type.getName();
|
||||
|
||||
if (type.hasTiers()) {
|
||||
BaseTier tier = ((ItemBlockTransmitter) stack.getItem()).getBaseTier(stack);
|
||||
resource = "mekanism:" + type.getName() + "_" + tier.getName();
|
||||
}
|
||||
|
||||
return transmitterResources.get(resource);
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(MekanismBlocks.Transmitter), transmitterMesher);
|
||||
|
||||
//Walkie Talkie dynamic texture
|
||||
ModelLoader.setCustomMeshDefinition(MekanismItems.WalkieTalkie, stack ->
|
||||
{
|
||||
ModelLoader.setCustomMeshDefinition(MekanismItems.WalkieTalkie, stack -> {
|
||||
if (!stack.isEmpty() && stack.getItem() instanceof ItemWalkieTalkie) {
|
||||
ItemWalkieTalkie item = (ItemWalkieTalkie) stack.getItem();
|
||||
|
||||
if (item.getOn(stack)) {
|
||||
return ItemWalkieTalkie.CHANNEL_MODELS.get(item.getChannel(stack));
|
||||
}
|
||||
}
|
||||
|
||||
return ItemWalkieTalkie.OFF_MODEL;
|
||||
});
|
||||
|
||||
//Crafting Formula dynamic texture
|
||||
ModelLoader.setCustomMeshDefinition(MekanismItems.CraftingFormula, stack ->
|
||||
{
|
||||
ModelLoader.setCustomMeshDefinition(MekanismItems.CraftingFormula, stack -> {
|
||||
if (!stack.isEmpty() && stack.getItem() instanceof ItemCraftingFormula) {
|
||||
ItemCraftingFormula item = (ItemCraftingFormula) stack.getItem();
|
||||
|
||||
if (item.getInventory(stack) == null) {
|
||||
return ItemCraftingFormula.MODEL;
|
||||
} else {
|
||||
return item.isInvalid(stack) ? ItemCraftingFormula.INVALID_MODEL
|
||||
: ItemCraftingFormula.ENCODED_MODEL;
|
||||
}
|
||||
return item.isInvalid(stack) ? ItemCraftingFormula.INVALID_MODEL : ItemCraftingFormula.ENCODED_MODEL;
|
||||
}
|
||||
|
||||
return ItemCraftingFormula.MODEL;
|
||||
});
|
||||
|
||||
@@ -812,11 +712,9 @@ public class ClientProxy extends CommonProxy {
|
||||
return new GuiTeleporter(player.inventory, (TileEntityTeleporter) tileEntity);
|
||||
case 14:
|
||||
ItemStack itemStack = player.getHeldItem(EnumHand.values()[pos.getX()]);
|
||||
|
||||
if (!itemStack.isEmpty() && itemStack.getItem() instanceof ItemPortableTeleporter) {
|
||||
return new GuiTeleporter(player, EnumHand.values()[pos.getX()], itemStack);
|
||||
}
|
||||
|
||||
return null;
|
||||
case 15:
|
||||
return new GuiPurificationChamber(player.inventory, (TileEntityAdvancedElectricMachine) tileEntity);
|
||||
@@ -829,72 +727,57 @@ public class ClientProxy extends CommonProxy {
|
||||
//EMPTY 19, 20
|
||||
case 21:
|
||||
EntityRobit robit = (EntityRobit) world.getEntityByID(pos.getX());
|
||||
|
||||
if (robit != null) {
|
||||
return new GuiRobitMain(player.inventory, robit);
|
||||
}
|
||||
|
||||
return null;
|
||||
case 22:
|
||||
robit = (EntityRobit) world.getEntityByID(pos.getX());
|
||||
|
||||
if (robit != null) {
|
||||
return new GuiRobitCrafting(player.inventory, robit);
|
||||
}
|
||||
|
||||
return null;
|
||||
case 23:
|
||||
robit = (EntityRobit) world.getEntityByID(pos.getX());
|
||||
|
||||
if (robit != null) {
|
||||
return new GuiRobitInventory(player.inventory, robit);
|
||||
}
|
||||
|
||||
return null;
|
||||
case 24:
|
||||
robit = (EntityRobit) world.getEntityByID(pos.getX());
|
||||
|
||||
if (robit != null) {
|
||||
return new GuiRobitSmelting(player.inventory, robit);
|
||||
}
|
||||
|
||||
return null;
|
||||
case 25:
|
||||
robit = (EntityRobit) world.getEntityByID(pos.getX());
|
||||
|
||||
if (robit != null) {
|
||||
return new GuiRobitRepair(player.inventory, robit);
|
||||
}
|
||||
|
||||
return null;
|
||||
case 29:
|
||||
return new GuiChemicalOxidizer(player.inventory, (TileEntityChemicalOxidizer) tileEntity);
|
||||
case 30:
|
||||
return new GuiChemicalInfuser(player.inventory, (TileEntityChemicalInfuser) tileEntity);
|
||||
case 31:
|
||||
return new GuiChemicalInjectionChamber(player.inventory,
|
||||
(TileEntityAdvancedElectricMachine) tileEntity);
|
||||
return new GuiChemicalInjectionChamber(player.inventory, (TileEntityAdvancedElectricMachine) tileEntity);
|
||||
case 32:
|
||||
return new GuiElectrolyticSeparator(player.inventory, (TileEntityElectrolyticSeparator) tileEntity);
|
||||
case 33:
|
||||
return new GuiThermalEvaporationController(player.inventory,
|
||||
(TileEntityThermalEvaporationController) tileEntity);
|
||||
return new GuiThermalEvaporationController(player.inventory, (TileEntityThermalEvaporationController) tileEntity);
|
||||
case 34:
|
||||
return new GuiPrecisionSawmill(player.inventory, (TileEntityPrecisionSawmill) tileEntity);
|
||||
case 35:
|
||||
return new GuiChemicalDissolutionChamber(player.inventory,
|
||||
(TileEntityChemicalDissolutionChamber) tileEntity);
|
||||
return new GuiChemicalDissolutionChamber(player.inventory, (TileEntityChemicalDissolutionChamber) tileEntity);
|
||||
case 36:
|
||||
return new GuiChemicalWasher(player.inventory, (TileEntityChemicalWasher) tileEntity);
|
||||
case 37:
|
||||
return new GuiChemicalCrystallizer(player.inventory, (TileEntityChemicalCrystallizer) tileEntity);
|
||||
case 38:
|
||||
ItemStack itemStack1 = player.getHeldItem(EnumHand.values()[pos.getX()]);
|
||||
|
||||
if (!itemStack1.isEmpty() && itemStack1.getItem() instanceof ItemSeismicReader) {
|
||||
return new GuiSeismicReader(world, new Coord4D(player), itemStack1.copy());
|
||||
}
|
||||
|
||||
return null;
|
||||
case 39:
|
||||
return new GuiSeismicVibrator(player.inventory, (TileEntitySeismicVibrator) tileEntity);
|
||||
@@ -939,7 +822,6 @@ public class ClientProxy extends CommonProxy {
|
||||
case 59:
|
||||
return new GuiLogisticalSorter(player, (TileEntityLogisticalSorter) tileEntity);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -949,12 +831,10 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
if (screen instanceof GuiTeleporter && !((GuiTeleporter) screen).isStackEmpty()) {
|
||||
GuiTeleporter teleporter = (GuiTeleporter) screen;
|
||||
|
||||
teleporter.setStatus(message.status);
|
||||
teleporter.setFrequency(message.frequency);
|
||||
teleporter.setPublicCache(message.publicCache);
|
||||
teleporter.setPrivateCache(message.privateCache);
|
||||
|
||||
teleporter.updateButtons();
|
||||
}
|
||||
}
|
||||
@@ -973,15 +853,13 @@ public class ClientProxy extends CommonProxy {
|
||||
if (MekanismConfig.current().client.enableMultiblockFormationParticles.val()) {
|
||||
anim.run();
|
||||
} else {
|
||||
player.sendStatusMessage(
|
||||
new TextComponentGroup(TextFormatting.BLUE).translation("chat.mek.multiblockformed"), true);
|
||||
player.sendStatusMessage(new TextComponentGroup(TextFormatting.BLUE).translation("chat.mek.multiblockformed"), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doMultiblockSparkle(TileEntity tileEntity, BlockPos renderLoc, int length, int width, int height,
|
||||
INodeChecker checker) {
|
||||
public void doMultiblockSparkle(TileEntity tileEntity, BlockPos renderLoc, int length, int width, int height, INodeChecker checker) {
|
||||
doSparkle(tileEntity, new SparkleAnimation(tileEntity, renderLoc, length, width, height, checker));
|
||||
}
|
||||
|
||||
@@ -990,61 +868,40 @@ public class ClientProxy extends CommonProxy {
|
||||
doSparkle(tileEntity, new SparkleAnimation(tileEntity, corner1, corner2, checker));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
|
||||
Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler((state, worldIn, pos, tintIndex) ->
|
||||
{
|
||||
Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler((state, worldIn, pos, tintIndex) -> {
|
||||
BlockMachine machine = (BlockMachine) state.getBlock();
|
||||
|
||||
if (state.getValue(machine.getMachineBlock().getProperty()) == MachineType.FLUID_TANK) {
|
||||
EnumColor color = state.getValue(BlockStateMachine.tierProperty).getColor();
|
||||
|
||||
return (int) (color.getColor(0) * 255) << 16 | (int) (color.getColor(1) * 255) << 8 | (int) (
|
||||
color.getColor(2) * 255);
|
||||
return (int) (color.getColor(0) * 255) << 16 | (int) (color.getColor(1) * 255) << 8 | (int) (color.getColor(2) * 255);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}, MekanismBlocks.MachineBlock, MekanismBlocks.MachineBlock2, MekanismBlocks.MachineBlock3);
|
||||
Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler((state, worldIn, pos, tintIndex) ->
|
||||
{
|
||||
Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler((state, worldIn, pos, tintIndex) -> {
|
||||
EnumDyeColor color = state.getValue(colorProperty);
|
||||
EnumColor dye = EnumColor.DYES[color.getDyeDamage()];
|
||||
|
||||
return (int) (dye.getColor(0) * 255) << 16 | (int) (dye.getColor(1) * 255) << 8 | (int) (dye.getColor(2)
|
||||
* 255);
|
||||
}, MekanismBlocks.PlasticBlock, MekanismBlocks.GlowPlasticBlock, MekanismBlocks.RoadPlasticBlock,
|
||||
MekanismBlocks.ReinforcedPlasticBlock,
|
||||
return (int) (dye.getColor(0) * 255) << 16 | (int) (dye.getColor(1) * 255) << 8 | (int) (dye.getColor(2) * 255);
|
||||
}, MekanismBlocks.PlasticBlock, MekanismBlocks.GlowPlasticBlock, MekanismBlocks.RoadPlasticBlock, MekanismBlocks.ReinforcedPlasticBlock,
|
||||
MekanismBlocks.SlickPlasticBlock, MekanismBlocks.PlasticFence);
|
||||
Minecraft.getMinecraft().getItemColors().registerItemColorHandler((stack, tintIndex) ->
|
||||
{
|
||||
Minecraft.getMinecraft().getItemColors().registerItemColorHandler((stack, tintIndex) -> {
|
||||
if (MachineType.get(stack) == MachineType.FLUID_TANK) {
|
||||
EnumColor color = ((ItemBlockMachine) stack.getItem()).getBaseTier(stack).getColor();
|
||||
|
||||
return (int) (color.getColor(0) * 255) << 16 | (int) (color.getColor(1) * 255) << 8 | (int) (
|
||||
color.getColor(2) * 255);
|
||||
return (int) (color.getColor(0) * 255) << 16 | (int) (color.getColor(1) * 255) << 8 | (int) (color.getColor(2) * 255);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}, MekanismBlocks.MachineBlock, MekanismBlocks.MachineBlock2, MekanismBlocks.MachineBlock3);
|
||||
Minecraft.getMinecraft().getItemColors().registerItemColorHandler((stack, tintIndex) ->
|
||||
{
|
||||
Minecraft.getMinecraft().getItemColors().registerItemColorHandler((stack, tintIndex) -> {
|
||||
EnumDyeColor dyeColor = EnumDyeColor.byDyeDamage(stack.getItemDamage() & 15);
|
||||
EnumColor dye = EnumColor.DYES[dyeColor.getDyeDamage()];
|
||||
|
||||
return (int) (dye.getColor(0) * 255) << 16 | (int) (dye.getColor(1) * 255) << 8 | (int) (dye.getColor(2)
|
||||
* 255);
|
||||
}, MekanismBlocks.PlasticBlock, MekanismBlocks.GlowPlasticBlock, MekanismBlocks.RoadPlasticBlock,
|
||||
MekanismBlocks.ReinforcedPlasticBlock,
|
||||
return (int) (dye.getColor(0) * 255) << 16 | (int) (dye.getColor(1) * 255) << 8 | (int) (dye.getColor(2) * 255);
|
||||
}, MekanismBlocks.PlasticBlock, MekanismBlocks.GlowPlasticBlock, MekanismBlocks.RoadPlasticBlock, MekanismBlocks.ReinforcedPlasticBlock,
|
||||
MekanismBlocks.SlickPlasticBlock, MekanismBlocks.PlasticFence);
|
||||
Minecraft.getMinecraft().getItemColors().registerItemColorHandler((stack, tintIndex) ->
|
||||
{
|
||||
Minecraft.getMinecraft().getItemColors().registerItemColorHandler((stack, tintIndex) -> {
|
||||
EnumColor dye = EnumColor.DYES[stack.getItemDamage()];
|
||||
|
||||
return (int) (dye.getColor(0) * 255) << 16 | (int) (dye.getColor(1) * 255) << 8 | (int) (dye.getColor(2)
|
||||
* 255);
|
||||
return (int) (dye.getColor(0) * 255) << 16 | (int) (dye.getColor(1) * 255) << 8 | (int) (dye.getColor(2) * 255);
|
||||
}, MekanismItems.Balloon);
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new ClientConnectionHandler());
|
||||
@@ -1073,32 +930,25 @@ public class ClientProxy extends CommonProxy {
|
||||
modelRegistry.putObject(ERL, RenderEnergyCubeItem.model = new ItemLayerWrapper(modelRegistry.getObject(ERL)));
|
||||
|
||||
ModelResourceLocation JetpackRL = getInventoryMRL("Jetpack");
|
||||
modelRegistry
|
||||
.putObject(JetpackRL, RenderJetpack.model = new ItemLayerWrapper(modelRegistry.getObject(JetpackRL)));
|
||||
modelRegistry.putObject(JetpackRL, RenderJetpack.model = new ItemLayerWrapper(modelRegistry.getObject(JetpackRL)));
|
||||
|
||||
ModelResourceLocation ArmorJetpackRL = getInventoryMRL("ArmoredJetpack");
|
||||
modelRegistry.putObject(ArmorJetpackRL,
|
||||
RenderArmoredJetpack.model = new ItemLayerWrapper(modelRegistry.getObject(ArmorJetpackRL)));
|
||||
modelRegistry.putObject(ArmorJetpackRL, RenderArmoredJetpack.model = new ItemLayerWrapper(modelRegistry.getObject(ArmorJetpackRL)));
|
||||
|
||||
ModelResourceLocation GasMaskRL = getInventoryMRL("GasMask");
|
||||
modelRegistry
|
||||
.putObject(GasMaskRL, RenderGasMask.model = new ItemLayerWrapper(modelRegistry.getObject(GasMaskRL)));
|
||||
modelRegistry.putObject(GasMaskRL, RenderGasMask.model = new ItemLayerWrapper(modelRegistry.getObject(GasMaskRL)));
|
||||
|
||||
ModelResourceLocation ScubaTankRL = getInventoryMRL("ScubaTank");
|
||||
modelRegistry.putObject(ScubaTankRL,
|
||||
RenderScubaTank.model = new ItemLayerWrapper(modelRegistry.getObject(ScubaTankRL)));
|
||||
modelRegistry.putObject(ScubaTankRL, RenderScubaTank.model = new ItemLayerWrapper(modelRegistry.getObject(ScubaTankRL)));
|
||||
|
||||
ModelResourceLocation FreeRunnerRL = getInventoryMRL("FreeRunners");
|
||||
modelRegistry.putObject(FreeRunnerRL,
|
||||
RenderFreeRunners.model = new ItemLayerWrapper(modelRegistry.getObject(FreeRunnerRL)));
|
||||
modelRegistry.putObject(FreeRunnerRL, RenderFreeRunners.model = new ItemLayerWrapper(modelRegistry.getObject(FreeRunnerRL)));
|
||||
|
||||
ModelResourceLocation AtomicDisassemblerRL = getInventoryMRL("AtomicDisassembler");
|
||||
modelRegistry.putObject(AtomicDisassemblerRL,
|
||||
RenderAtomicDisassembler.model = new ItemLayerWrapper(modelRegistry.getObject(AtomicDisassemblerRL)));
|
||||
modelRegistry.putObject(AtomicDisassemblerRL, RenderAtomicDisassembler.model = new ItemLayerWrapper(modelRegistry.getObject(AtomicDisassemblerRL)));
|
||||
|
||||
ModelResourceLocation FlamethrowerRL = getInventoryMRL("Flamethrower");
|
||||
modelRegistry.putObject(FlamethrowerRL,
|
||||
RenderFlameThrower.model = new ItemLayerWrapper(modelRegistry.getObject(FlamethrowerRL)));
|
||||
modelRegistry.putObject(FlamethrowerRL, RenderFlameThrower.model = new ItemLayerWrapper(modelRegistry.getObject(FlamethrowerRL)));
|
||||
|
||||
machineModelBake(modelRegistry, "digital_miner", MachineType.DIGITAL_MINER);
|
||||
machineModelBake(modelRegistry, "solar_neutron_activator", MachineType.SOLAR_NEUTRON_ACTIVATOR);
|
||||
@@ -1115,16 +965,14 @@ public class ClientProxy extends CommonProxy {
|
||||
basicBlockModelBake(modelRegistry, "security_desk", BasicBlockType.SECURITY_DESK);
|
||||
}
|
||||
|
||||
private void machineModelBake(IRegistry<ModelResourceLocation, IBakedModel> modelRegistry, String type,
|
||||
MachineType machineType) {
|
||||
private void machineModelBake(IRegistry<ModelResourceLocation, IBakedModel> modelRegistry, String type, MachineType machineType) {
|
||||
ModelResourceLocation modelResourceLocation = getInventoryMRL(type);
|
||||
ItemLayerWrapper itemLayerWrapper = new ItemLayerWrapper(modelRegistry.getObject(modelResourceLocation));
|
||||
RenderMachineItem.modelMap.put(machineType, itemLayerWrapper);
|
||||
modelRegistry.putObject(modelResourceLocation, itemLayerWrapper);
|
||||
}
|
||||
|
||||
private void basicBlockModelBake(IRegistry<ModelResourceLocation, IBakedModel> modelRegistry, String type,
|
||||
BasicBlockType basicType) {
|
||||
private void basicBlockModelBake(IRegistry<ModelResourceLocation, IBakedModel> modelRegistry, String type, BasicBlockType basicType) {
|
||||
ModelResourceLocation modelResourceLocation = getInventoryMRL(type);
|
||||
ItemLayerWrapper itemLayerWrapper = new ItemLayerWrapper(modelRegistry.getObject(modelResourceLocation));
|
||||
RenderBasicBlockItem.modelMap.put(basicType, itemLayerWrapper);
|
||||
@@ -1155,13 +1003,10 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
@Override
|
||||
public boolean isPaused() {
|
||||
if (FMLClientHandler.instance().getClient().isSingleplayer() && !FMLClientHandler.instance().getClient()
|
||||
.getIntegratedServer().getPublic()) {
|
||||
if (FMLClientHandler.instance().getClient().isSingleplayer() && !FMLClientHandler.instance().getClient().getIntegratedServer().getPublic()) {
|
||||
GuiScreen screen = FMLClientHandler.instance().getClient().currentScreen;
|
||||
|
||||
return screen != null && screen.doesGuiPauseGame();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1174,9 +1019,8 @@ public class ClientProxy extends CommonProxy {
|
||||
public EntityPlayer getPlayer(MessageContext context) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
|
||||
return context.getServerHandler().player;
|
||||
} else {
|
||||
return Minecraft.getMinecraft().player;
|
||||
}
|
||||
return Minecraft.getMinecraft().player;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1192,8 +1036,7 @@ public class ClientProxy extends CommonProxy {
|
||||
if (server != null) {
|
||||
server.addScheduledTask(runnable);
|
||||
} else {
|
||||
Mekanism.logger.error(
|
||||
"Packet handler wanted to set a scheduled task, but we couldn't find a way to set one.");
|
||||
Mekanism.logger.error("Packet handler wanted to set a scheduled task, but we couldn't find a way to set one.");
|
||||
Mekanism.logger.error("Player = {}, World = {}", player, player.world);
|
||||
}
|
||||
}
|
||||
@@ -1214,4 +1057,4 @@ public class ClientProxy extends CommonProxy {
|
||||
public void throwApiPresentException() {
|
||||
throw new ApiJarPresentException(API_PRESENT_MESSAGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package mekanism.client;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
@@ -75,24 +75,20 @@ public class ClientTickHandler {
|
||||
ItemJetpack jetpack = (ItemJetpack) stack.getItem();
|
||||
|
||||
if (jetpack.getGas(stack) != null) {
|
||||
if ((mc.gameSettings.keyBindJump.isKeyDown() && jetpack.getMode(stack) == JetpackMode.NORMAL)
|
||||
&& mc.currentScreen == null) {
|
||||
if (mc.gameSettings.keyBindJump.isKeyDown() && jetpack.getMode(stack) == JetpackMode.NORMAL && mc.currentScreen == null) {
|
||||
return true;
|
||||
} else if (jetpack.getMode(stack) == JetpackMode.HOVER) {
|
||||
if ((!mc.gameSettings.keyBindJump.isKeyDown() && !mc.gameSettings.keyBindSneak.isKeyDown()) || (
|
||||
mc.gameSettings.keyBindJump.isKeyDown() && mc.gameSettings.keyBindSneak.isKeyDown())
|
||||
|| mc.currentScreen != null) {
|
||||
if ((!mc.gameSettings.keyBindJump.isKeyDown() && !mc.gameSettings.keyBindSneak.isKeyDown()) ||
|
||||
(mc.gameSettings.keyBindJump.isKeyDown() && mc.gameSettings.keyBindSneak.isKeyDown()) || mc.currentScreen != null) {
|
||||
return !CommonPlayerTickHandler.isOnGround(player);
|
||||
} else if (mc.gameSettings.keyBindSneak.isKeyDown() && mc.currentScreen == null) {
|
||||
return !CommonPlayerTickHandler.isOnGround(player);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -100,20 +96,16 @@ public class ClientTickHandler {
|
||||
if (player != mc.player) {
|
||||
return Mekanism.playerState.isGasmaskOn(player);
|
||||
}
|
||||
|
||||
ItemStack tank = player.inventory.armorInventory.get(2);
|
||||
ItemStack mask = player.inventory.armorInventory.get(3);
|
||||
|
||||
if (!tank.isEmpty() && !mask.isEmpty()) {
|
||||
if (tank.getItem() instanceof ItemScubaTank && mask.getItem() instanceof ItemGasMask) {
|
||||
ItemScubaTank scubaTank = (ItemScubaTank) tank.getItem();
|
||||
|
||||
if (scubaTank.getGas(tank) != null) {
|
||||
return scubaTank.getFlowing(tank);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -123,14 +115,11 @@ public class ClientTickHandler {
|
||||
}
|
||||
|
||||
ItemStack stack = player.getItemStackFromSlot(EntityEquipmentSlot.FEET);
|
||||
|
||||
if (!stack.isEmpty() && stack.getItem() instanceof ItemFreeRunners) {
|
||||
ItemFreeRunners freeRunners = (ItemFreeRunners) stack.getItem();
|
||||
|
||||
/*freeRunners.getEnergy(stack) > 0 && */
|
||||
return freeRunners.getMode(stack) == ItemFreeRunners.FreeRunnerMode.NORMAL;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -138,32 +127,25 @@ public class ClientTickHandler {
|
||||
if (player != mc.player) {
|
||||
return Mekanism.playerState.isFlamethrowerOn(player);
|
||||
}
|
||||
|
||||
if (hasFlamethrower(player)) {
|
||||
return mc.gameSettings.keyBindUseItem.isKeyDown();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean hasFlamethrower(EntityPlayer player) {
|
||||
if (!player.inventory.getCurrentItem().isEmpty() && player.inventory.getCurrentItem()
|
||||
.getItem() instanceof ItemFlamethrower) {
|
||||
if (!player.inventory.getCurrentItem().isEmpty() && player.inventory.getCurrentItem().getItem() instanceof ItemFlamethrower) {
|
||||
ItemFlamethrower flamethrower = (ItemFlamethrower) player.inventory.getCurrentItem().getItem();
|
||||
|
||||
return flamethrower.getGas(player.inventory.getCurrentItem()) != null;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void portableTeleport(EntityPlayer player, EnumHand hand, Frequency freq) {
|
||||
if (MekanismConfig.current().general.portableTeleporterDelay.val() == 0) {
|
||||
Mekanism.packetHandler
|
||||
.sendToServer(new PortableTeleporterMessage(PortableTeleporterPacketType.TELEPORT, hand, freq));
|
||||
Mekanism.packetHandler.sendToServer(new PortableTeleporterMessage(PortableTeleporterPacketType.TELEPORT, hand, freq));
|
||||
} else {
|
||||
portableTeleports.put(player, new TeleportData(hand, freq,
|
||||
mc.world.getWorldTime() + MekanismConfig.current().general.portableTeleporterDelay.val()));
|
||||
portableTeleports.put(player, new TeleportData(hand, freq, mc.world.getWorldTime() + MekanismConfig.current().general.portableTeleporterDelay.val()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,15 +191,13 @@ public class ClientTickHandler {
|
||||
Mekanism.freeRunnerOn.remove(mc.player.getUniqueID());
|
||||
}
|
||||
|
||||
Mekanism.packetHandler.sendToServer(
|
||||
new PacketFreeRunnerData.FreeRunnerDataMessage(PacketFreeRunnerData.FreeRunnerPacket.UPDATE,
|
||||
mc.player.getUniqueID(), isFreeRunnerOn(mc.player)));
|
||||
Mekanism.packetHandler.sendToServer(new PacketFreeRunnerData.FreeRunnerDataMessage(PacketFreeRunnerData.FreeRunnerPacket.UPDATE,
|
||||
mc.player.getUniqueID(), isFreeRunnerOn(mc.player)));
|
||||
}
|
||||
|
||||
ItemStack bootStack = mc.player.getItemStackFromSlot(EntityEquipmentSlot.FEET);
|
||||
|
||||
if (!bootStack.isEmpty() && bootStack.getItem() instanceof ItemFreeRunners && isFreeRunnerOn(mc.player)
|
||||
&& !mc.player.isSneaking()) {
|
||||
if (!bootStack.isEmpty() && bootStack.getItem() instanceof ItemFreeRunners && isFreeRunnerOn(mc.player) && !mc.player.isSneaking()) {
|
||||
mc.player.stepHeight = 1.002F;
|
||||
} else if (mc.player.stepHeight == 1.002F) {
|
||||
mc.player.stepHeight = 0.6F;
|
||||
@@ -229,8 +209,7 @@ public class ClientTickHandler {
|
||||
Mekanism.playerState.setGasmaskState(mc.player.getUniqueID(), isGasMaskOn(mc.player), true);
|
||||
Mekanism.playerState.setFlamethrowerState(mc.player.getUniqueID(), isFlamethrowerOn(mc.player), true);
|
||||
|
||||
for (Iterator<Entry<EntityPlayer, TeleportData>> iter = portableTeleports.entrySet().iterator();
|
||||
iter.hasNext(); ) {
|
||||
for (Iterator<Entry<EntityPlayer, TeleportData>> iter = portableTeleports.entrySet().iterator(); iter.hasNext(); ) {
|
||||
Entry<EntityPlayer, TeleportData> entry = iter.next();
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
@@ -242,9 +221,7 @@ public class ClientTickHandler {
|
||||
}
|
||||
|
||||
if (mc.world.getWorldTime() == entry.getValue().teleportTime) {
|
||||
Mekanism.packetHandler.sendToServer(
|
||||
new PortableTeleporterMessage(PortableTeleporterPacketType.TELEPORT, entry.getValue().hand,
|
||||
entry.getValue().freq));
|
||||
Mekanism.packetHandler.sendToServer(new PortableTeleporterMessage(PortableTeleporterPacketType.TELEPORT, entry.getValue().hand, entry.getValue().freq));
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
@@ -258,7 +235,6 @@ public class ClientTickHandler {
|
||||
|
||||
if (isFlamethrowerOn(mc.player)) {
|
||||
ItemFlamethrower flamethrower = (ItemFlamethrower) mc.player.inventory.getCurrentItem().getItem();
|
||||
|
||||
if (!(mc.player.isCreative() || mc.player.isSpectator())) {
|
||||
flamethrower.useGas(mc.player.inventory.getCurrentItem());
|
||||
}
|
||||
@@ -271,9 +247,8 @@ public class ClientTickHandler {
|
||||
mc.player.motionY = Math.min(mc.player.motionY + 0.15D, 0.5D);
|
||||
mc.player.fallDistance = 0.0F;
|
||||
} else if (jetpack.getMode(chestStack) == JetpackMode.HOVER) {
|
||||
if ((!mc.gameSettings.keyBindJump.isKeyDown() && !mc.gameSettings.keyBindSneak.isKeyDown()) || (
|
||||
mc.gameSettings.keyBindJump.isKeyDown() && mc.gameSettings.keyBindSneak.isKeyDown())
|
||||
|| mc.currentScreen != null) {
|
||||
if ((!mc.gameSettings.keyBindJump.isKeyDown() && !mc.gameSettings.keyBindSneak.isKeyDown()) ||
|
||||
(mc.gameSettings.keyBindJump.isKeyDown() && mc.gameSettings.keyBindSneak.isKeyDown()) || mc.currentScreen != null) {
|
||||
if (mc.player.motionY > 0) {
|
||||
mc.player.motionY = Math.max(mc.player.motionY - 0.15D, 0);
|
||||
} else if (mc.player.motionY < 0) {
|
||||
@@ -290,25 +265,20 @@ public class ClientTickHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mc.player.fallDistance = 0.0F;
|
||||
}
|
||||
|
||||
jetpack.useGas(chestStack);
|
||||
}
|
||||
|
||||
if (isGasMaskOn(mc.player)) {
|
||||
ItemScubaTank tank = (ItemScubaTank) chestStack.getItem();
|
||||
|
||||
final int max = 300;
|
||||
|
||||
tank.useGas(chestStack);
|
||||
GasStack received = tank.useGas(chestStack, max - mc.player.getAir());
|
||||
|
||||
if (received != null) {
|
||||
mc.player.setAir(mc.player.getAir() + received.amount);
|
||||
}
|
||||
|
||||
if (mc.player.getAir() == max) {
|
||||
for (Object obj : mc.player.getActivePotionEffects()) {
|
||||
if (obj instanceof PotionEffect) {
|
||||
@@ -324,8 +294,7 @@ public class ClientTickHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onMouseEvent(MouseEvent event) {
|
||||
if (MekanismConfig.current().client.allowConfiguratorModeScroll.val() && mc.player != null && mc.player
|
||||
.isSneaking()) {
|
||||
if (MekanismConfig.current().client.allowConfiguratorModeScroll.val() && mc.player != null && mc.player.isSneaking()) {
|
||||
ItemStack stack = mc.player.getHeldItemMainhand();
|
||||
int delta = event.getDwheel();
|
||||
|
||||
@@ -343,10 +312,8 @@ public class ClientTickHandler {
|
||||
} else if (newVal < 0) {
|
||||
newVal = ConfiguratorMode.values().length + newVal;
|
||||
}
|
||||
|
||||
configurator.setState(stack, ConfiguratorMode.values()[newVal]);
|
||||
Mekanism.packetHandler
|
||||
.sendToServer(new ItemStackMessage(EnumHand.MAIN_HAND, Lists.newArrayList(newVal)));
|
||||
Mekanism.packetHandler.sendToServer(new ItemStackMessage(EnumHand.MAIN_HAND, new ArrayList<>(newVal)));
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
@@ -364,4 +331,4 @@ public class ClientTickHandler {
|
||||
teleportTime = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,6 @@ public final class HolidayManager {
|
||||
holidays.add(new Christmas());
|
||||
holidays.add(new NewYear());
|
||||
}
|
||||
|
||||
Mekanism.logger.info("Initialized HolidayManager.");
|
||||
}
|
||||
|
||||
@@ -48,10 +47,8 @@ public final class HolidayManager {
|
||||
if (!MekanismConfig.current().client.holidays.val()) {
|
||||
return sound;
|
||||
}
|
||||
|
||||
try {
|
||||
YearlyDate date = getDate();
|
||||
|
||||
for (Holiday holiday : holidays) {
|
||||
if (holiday.getDate().equals(date)) {
|
||||
return holiday.filterSound(sound);
|
||||
@@ -59,7 +56,6 @@ public final class HolidayManager {
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
|
||||
return sound;
|
||||
}
|
||||
|
||||
@@ -69,11 +65,9 @@ public final class HolidayManager {
|
||||
|
||||
private static String getThemedLines(EnumColor[] colors, int amount) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < amount; i++) {
|
||||
builder.append(colors[i % colors.length]).append("-");
|
||||
}
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
@@ -119,8 +113,7 @@ public final class HolidayManager {
|
||||
|
||||
private static class Christmas extends Holiday {
|
||||
|
||||
private String[] nutcracker = new String[]{"christmas.1", "christmas.2", "christmas.3", "christmas.4",
|
||||
"christmas.5"};
|
||||
private String[] nutcracker = new String[]{"christmas.1", "christmas.2", "christmas.3", "christmas.4", "christmas.5"};
|
||||
|
||||
@Override
|
||||
public YearlyDate getDate() {
|
||||
@@ -130,10 +123,8 @@ public final class HolidayManager {
|
||||
@Override
|
||||
public void onEvent(EntityPlayer player) {
|
||||
String themedLines = getThemedLines(new EnumColor[]{EnumColor.DARK_GREEN, EnumColor.DARK_RED}, 13);
|
||||
player.sendMessage(
|
||||
new TextComponentString(themedLines + EnumColor.DARK_BLUE + Mekanism.LOG_TAG + themedLines));
|
||||
player.sendMessage(new TextComponentString(
|
||||
EnumColor.RED + "Merry Christmas, " + EnumColor.DARK_BLUE + player.getName() + EnumColor.RED + "!"));
|
||||
player.sendMessage(new TextComponentString(themedLines + EnumColor.DARK_BLUE + Mekanism.LOG_TAG + themedLines));
|
||||
player.sendMessage(new TextComponentString(EnumColor.RED + "Merry Christmas, " + EnumColor.DARK_BLUE + player.getName() + EnumColor.RED + "!"));
|
||||
player.sendMessage(new TextComponentString(EnumColor.RED + "May you have plenty of Christmas cheer"));
|
||||
player.sendMessage(new TextComponentString(EnumColor.RED + "and have a relaxing holiday with your"));
|
||||
player.sendMessage(new TextComponentString(EnumColor.RED + "family :)"));
|
||||
@@ -143,20 +134,18 @@ public final class HolidayManager {
|
||||
|
||||
@Override
|
||||
public ResourceLocation filterSound(ResourceLocation sound) {
|
||||
String soundResourceLocationString = sound.toString();
|
||||
|
||||
if (soundResourceLocationString.contains("machine.enrichment")) {
|
||||
return new ResourceLocation(sound.toString().replace("machine.enrichment", nutcracker[0]));
|
||||
} else if (soundResourceLocationString.contains("machine.metalinfuser")) {
|
||||
return new ResourceLocation(sound.toString().replace("machine.metalinfuser", nutcracker[1]));
|
||||
} else if (soundResourceLocationString.contains("machine.purification")) {
|
||||
return new ResourceLocation(sound.toString().replace("machine.purification", nutcracker[2]));
|
||||
} else if (soundResourceLocationString.contains("machine.smelter")) {
|
||||
return new ResourceLocation(sound.toString().replace("machine.smelter", nutcracker[3]));
|
||||
} else if (soundResourceLocationString.contains("machine.dissolution")) {
|
||||
return new ResourceLocation(sound.toString().replace("machine.dissolution", nutcracker[4]));
|
||||
String soundLocation = sound.toString();
|
||||
if (soundLocation.contains("machine.enrichment")) {
|
||||
return new ResourceLocation(soundLocation.replace("machine.enrichment", nutcracker[0]));
|
||||
} else if (soundLocation.contains("machine.metalinfuser")) {
|
||||
return new ResourceLocation(soundLocation.replace("machine.metalinfuser", nutcracker[1]));
|
||||
} else if (soundLocation.contains("machine.purification")) {
|
||||
return new ResourceLocation(soundLocation.replace("machine.purification", nutcracker[2]));
|
||||
} else if (soundLocation.contains("machine.smelter")) {
|
||||
return new ResourceLocation(soundLocation.replace("machine.smelter", nutcracker[3]));
|
||||
} else if (soundLocation.contains("machine.dissolution")) {
|
||||
return new ResourceLocation(soundLocation.replace("machine.dissolution", nutcracker[4]));
|
||||
}
|
||||
|
||||
return sound;
|
||||
}
|
||||
}
|
||||
@@ -171,13 +160,10 @@ public final class HolidayManager {
|
||||
@Override
|
||||
public void onEvent(EntityPlayer player) {
|
||||
String themedLines = getThemedLines(new EnumColor[]{EnumColor.WHITE, EnumColor.YELLOW}, 13);
|
||||
player.sendMessage(
|
||||
new TextComponentString(themedLines + EnumColor.DARK_BLUE + Mekanism.LOG_TAG + themedLines));
|
||||
player.sendMessage(new TextComponentString(
|
||||
EnumColor.AQUA + "Happy New Year, " + EnumColor.DARK_BLUE + player.getName() + EnumColor.RED + "!"));
|
||||
player.sendMessage(new TextComponentString(themedLines + EnumColor.DARK_BLUE + Mekanism.LOG_TAG + themedLines));
|
||||
player.sendMessage(new TextComponentString(EnumColor.AQUA + "Happy New Year, " + EnumColor.DARK_BLUE + player.getName() + EnumColor.RED + "!"));
|
||||
player.sendMessage(new TextComponentString(EnumColor.AQUA + "Best wishes to you as we enter this"));
|
||||
player.sendMessage(new TextComponentString(
|
||||
EnumColor.AQUA + "new and exciting year of " + calendar.get(Calendar.YEAR) + "! :)"));
|
||||
player.sendMessage(new TextComponentString(EnumColor.AQUA + "new and exciting year of " + calendar.get(Calendar.YEAR) + "! :)"));
|
||||
player.sendMessage(new TextComponentString(EnumColor.DARK_GREY + "-aidancbrady"));
|
||||
player.sendMessage(new TextComponentString(themedLines + EnumColor.DARK_BLUE + "[=======]" + themedLines));
|
||||
}
|
||||
@@ -211,4 +197,4 @@ public final class HolidayManager {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -71,13 +71,14 @@ public abstract class MekKeyHandler {
|
||||
public abstract void keyUp(KeyBinding kb);
|
||||
|
||||
protected static class Builder {
|
||||
|
||||
private List<KeyBinding> bindings = new ArrayList<>(4);
|
||||
private BitSet repeatFlags = new BitSet();
|
||||
|
||||
/**
|
||||
* Add a keybinding to the list
|
||||
*
|
||||
* @param k the KeyBinding to add
|
||||
* @param k the KeyBinding to add
|
||||
* @param repeatFlag true if keyDown pseudo-events continue to be sent while key is held
|
||||
*/
|
||||
protected Builder addBinding(KeyBinding k, boolean repeatFlag) {
|
||||
@@ -94,4 +95,4 @@ public abstract class MekKeyHandler {
|
||||
return bindings.toArray(new KeyBinding[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,6 @@ public class MekanismClient extends Mekanism {
|
||||
|
||||
public static void updateKey(KeyBinding key, int type) {
|
||||
boolean down = Minecraft.getMinecraft().currentScreen == null && key.isKeyDown();
|
||||
|
||||
if (down != keyMap.has(Minecraft.getMinecraft().player, type)) {
|
||||
Mekanism.packetHandler.sendToServer(new KeyMessage(type, down));
|
||||
keyMap.update(Minecraft.getMinecraft().player, type, down);
|
||||
@@ -67,4 +66,4 @@ public class MekanismClient extends Mekanism {
|
||||
module.resetClient();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,11 +54,10 @@ public class MekanismKeyHandler extends MekKeyHandler {
|
||||
public static KeyBinding jumpKey = Minecraft.getMinecraft().gameSettings.keyBindJump;
|
||||
|
||||
private static Builder BINDINGS = new Builder()
|
||||
.addBinding(modeSwitchKey, false)
|
||||
.addBinding(armorModeSwitchKey, false)
|
||||
.addBinding(freeRunnerModeSwitchKey, false)
|
||||
.addBinding(voiceKey, true)
|
||||
;
|
||||
.addBinding(modeSwitchKey, false)
|
||||
.addBinding(armorModeSwitchKey, false)
|
||||
.addBinding(freeRunnerModeSwitchKey, false)
|
||||
.addBinding(voiceKey, true);
|
||||
|
||||
public MekanismKeyHandler() {
|
||||
super(BINDINGS);
|
||||
@@ -81,51 +80,35 @@ public class MekanismKeyHandler extends MekKeyHandler {
|
||||
if (kb == modeSwitchKey) {
|
||||
EntityPlayer player = FMLClientHandler.instance().getClient().player;
|
||||
ItemStack toolStack = player.inventory.getCurrentItem();
|
||||
|
||||
Item item = toolStack.getItem();
|
||||
|
||||
if (player.isSneaking() && item instanceof ItemConfigurator) {
|
||||
ItemConfigurator configurator = (ItemConfigurator) item;
|
||||
|
||||
ConfiguratorMode configuratorMode = configurator.getState(toolStack);
|
||||
int toSet = (configuratorMode.ordinal() + 1) % ConfiguratorMode.values().length;
|
||||
configuratorMode = ConfiguratorMode.values()[toSet];
|
||||
configurator.setState(toolStack, configuratorMode);
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new ItemStackMessage(EnumHand.MAIN_HAND, Collections.singletonList(toSet)));
|
||||
|
||||
player.sendMessage(
|
||||
new TextComponentGroup(TextFormatting.GRAY)
|
||||
.string(Mekanism.LOG_TAG, TextFormatting.DARK_BLUE).string(" ")
|
||||
.translation("mekanism.tooltip.configureState", LangUtils.withColor(configuratorMode.getNameComponent(), configuratorMode.getColor().textFormatting))
|
||||
);
|
||||
player.sendMessage(new TextComponentGroup(TextFormatting.GRAY).string(Mekanism.LOG_TAG, TextFormatting.DARK_BLUE).string(" ")
|
||||
.translation("mekanism.tooltip.configureState", LangUtils.withColor(configuratorMode.getNameComponent(), configuratorMode.getColor().textFormatting)));
|
||||
} else if (player.isSneaking() && item instanceof ItemElectricBow) {
|
||||
ItemElectricBow bow = (ItemElectricBow) item;
|
||||
|
||||
boolean newBowState = !bow.getFireState(toolStack);
|
||||
bow.setFireState(toolStack, newBowState);
|
||||
Mekanism.packetHandler.sendToServer(new ItemStackMessage(EnumHand.MAIN_HAND, Collections.singletonList(newBowState)));
|
||||
player.sendMessage(
|
||||
new TextComponentGroup(TextFormatting.GRAY)
|
||||
.string(Mekanism.LOG_TAG, TextFormatting.DARK_BLUE).string(" ")
|
||||
.translation("mekanism.tooltip.fireMode", LangUtils.onOffColoured(newBowState))
|
||||
);
|
||||
player.sendMessage(new TextComponentGroup(TextFormatting.GRAY).string(Mekanism.LOG_TAG, TextFormatting.DARK_BLUE).string(" ")
|
||||
.translation("mekanism.tooltip.fireMode", LangUtils.onOffColoured(newBowState)));
|
||||
} else if (player.isSneaking() && item instanceof ItemBlockMachine) {
|
||||
ItemBlockMachine machine = (ItemBlockMachine) item;
|
||||
|
||||
if (MachineType.get(toolStack) == MachineType.FLUID_TANK) {
|
||||
boolean newBucketMode = !machine.getBucketMode(toolStack);
|
||||
machine.setBucketMode(toolStack, newBucketMode);
|
||||
Mekanism.packetHandler.sendToServer(new ItemStackMessage(EnumHand.MAIN_HAND, Collections.singletonList(machine.getBucketMode(toolStack))));
|
||||
player.sendMessage(
|
||||
new TextComponentGroup(TextFormatting.GRAY)
|
||||
.string(Mekanism.LOG_TAG, TextFormatting.DARK_BLUE).string(" ")
|
||||
.translation("mekanism.tooltip.portableTank.bucketMode", LangUtils.onOffColoured(newBucketMode))
|
||||
);
|
||||
player.sendMessage(new TextComponentGroup(TextFormatting.GRAY).string(Mekanism.LOG_TAG, TextFormatting.DARK_BLUE).string(" ")
|
||||
.translation("mekanism.tooltip.portableTank.bucketMode", LangUtils.onOffColoured(newBucketMode)));
|
||||
}
|
||||
} else if (player.isSneaking() && item instanceof ItemWalkieTalkie) {
|
||||
ItemWalkieTalkie wt = (ItemWalkieTalkie) item;
|
||||
|
||||
if (wt.getOn(toolStack)) {
|
||||
int newChan = wt.getChannel(toolStack) + 1;
|
||||
if (newChan == 9) {
|
||||
@@ -136,14 +119,10 @@ public class MekanismKeyHandler extends MekKeyHandler {
|
||||
}
|
||||
} else if (player.isSneaking() && item instanceof ItemFlamethrower) {
|
||||
ItemFlamethrower flamethrower = (ItemFlamethrower) item;
|
||||
|
||||
flamethrower.incrementMode(toolStack);
|
||||
Mekanism.packetHandler.sendToServer(new FlamethrowerDataMessage(FlamethrowerPacket.MODE, EnumHand.MAIN_HAND, null, false));
|
||||
player.sendMessage(
|
||||
new TextComponentGroup(TextFormatting.GRAY)
|
||||
.string(Mekanism.LOG_TAG, TextFormatting.DARK_BLUE).string(" ")
|
||||
.translation("mekanism.tooltip.flamethrower.modeBump", flamethrower.getMode(toolStack).getTextComponent())
|
||||
);
|
||||
player.sendMessage(new TextComponentGroup(TextFormatting.GRAY).string(Mekanism.LOG_TAG, TextFormatting.DARK_BLUE).string(" ")
|
||||
.translation("mekanism.tooltip.flamethrower.modeBump", flamethrower.getMode(toolStack).getTextComponent()));
|
||||
}
|
||||
} else if (kb == armorModeSwitchKey) {
|
||||
EntityPlayer player = FMLClientHandler.instance().getClient().player;
|
||||
@@ -152,7 +131,6 @@ public class MekanismKeyHandler extends MekKeyHandler {
|
||||
|
||||
if (chestItem instanceof ItemJetpack) {
|
||||
ItemJetpack jetpack = (ItemJetpack) chestItem;
|
||||
|
||||
if (player.isSneaking()) {
|
||||
jetpack.setMode(chestStack, JetpackMode.DISABLED);
|
||||
} else {
|
||||
@@ -163,7 +141,6 @@ public class MekanismKeyHandler extends MekKeyHandler {
|
||||
SoundHandler.playSound(MekanismSounds.HYDRAULIC);
|
||||
} else if (chestItem instanceof ItemScubaTank) {
|
||||
ItemScubaTank scubaTank = (ItemScubaTank) chestItem;
|
||||
|
||||
scubaTank.toggleFlowing(chestStack);
|
||||
Mekanism.packetHandler.sendToServer(ScubaTankDataMessage.MODE_CHANGE(false));
|
||||
SoundHandler.playSound(MekanismSounds.HYDRAULIC);
|
||||
@@ -175,13 +152,11 @@ public class MekanismKeyHandler extends MekKeyHandler {
|
||||
|
||||
if (feetItem instanceof ItemFreeRunners) {
|
||||
ItemFreeRunners freeRunners = (ItemFreeRunners) feetItem;
|
||||
|
||||
if (player.isSneaking()) {
|
||||
freeRunners.setMode(feetStack, ItemFreeRunners.FreeRunnerMode.DISABLED);
|
||||
} else {
|
||||
freeRunners.incrementMode(feetStack);
|
||||
}
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new FreeRunnerDataMessage(PacketFreeRunnerData.FreeRunnerPacket.MODE, null, player.isSneaking()));
|
||||
SoundHandler.playSound(MekanismSounds.HYDRAULIC);
|
||||
}
|
||||
@@ -191,4 +166,4 @@ public class MekanismKeyHandler extends MekKeyHandler {
|
||||
@Override
|
||||
public void keyUp(KeyBinding kb) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,9 +38,7 @@ public class SparkleAnimation {
|
||||
|
||||
public void run() {
|
||||
if (MekanismConfig.current().general.dynamicTankEasterEgg.val()) {
|
||||
tile.getWorld()
|
||||
.playSound(null, tile.getPos().getX(), tile.getPos().getY(), tile.getPos().getZ(),
|
||||
MekanismSounds.CJ_EASTER_EGG, SoundCategory.BLOCKS, 1F, 1F);
|
||||
tile.getWorld().playSound(null, tile.getPos().getX(), tile.getPos().getY(), tile.getPos().getZ(), MekanismSounds.CJ_EASTER_EGG, SoundCategory.BLOCKS, 1F, 1F);
|
||||
}
|
||||
|
||||
// Using the provided radius, get an iterable over all the positions within the radius
|
||||
@@ -61,19 +59,20 @@ public class SparkleAnimation {
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
world.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + random.nextDouble(),
|
||||
pos.getY() + random.nextDouble(), pos.getZ() + -.01, 0, 0, 0);
|
||||
world.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + random.nextDouble(),
|
||||
pos.getY() + random.nextDouble(), pos.getZ() + 1.01, 0, 0, 0);
|
||||
world.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + -.01,
|
||||
pos.getY() + random.nextDouble(), pos.getZ() + random.nextDouble(), 0, 0, 0);
|
||||
world.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + 1.01,
|
||||
pos.getY() + random.nextDouble(), pos.getZ() + random.nextDouble(), 0, 0, 0);
|
||||
world.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + random.nextDouble(), pos.getY() + random.nextDouble(),
|
||||
pos.getZ() + -.01, 0, 0, 0);
|
||||
world.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + random.nextDouble(), pos.getY() + random.nextDouble(),
|
||||
pos.getZ() + 1.01, 0, 0, 0);
|
||||
world.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + -.01, pos.getY() + random.nextDouble(),
|
||||
pos.getZ() + random.nextDouble(), 0, 0, 0);
|
||||
world.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + 1.01, pos.getY() + random.nextDouble(),
|
||||
pos.getZ() + random.nextDouble(), 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface INodeChecker {
|
||||
|
||||
boolean isNode(TileEntity tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,8 +17,8 @@ import org.lwjgl.opengl.GL11;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ParticleLaser extends Particle {
|
||||
|
||||
double length;
|
||||
EnumFacing direction;
|
||||
private double length;
|
||||
private EnumFacing direction;
|
||||
|
||||
public ParticleLaser(World world, Pos3D start, Pos3D end, EnumFacing dir, double energy) {
|
||||
super(world, (start.x + end.x) / 2D, (start.y + end.y) / 2D, (start.z + end.z) / 2D);
|
||||
@@ -34,8 +34,7 @@ public class ParticleLaser extends Particle {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(BufferBuilder worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_,
|
||||
float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) {
|
||||
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
|
||||
tessellator.draw();
|
||||
@@ -72,26 +71,26 @@ public class ParticleLaser extends Particle {
|
||||
float vMax = particleTexture.getInterpolatedV(16);
|
||||
|
||||
GlStateManager.rotate(45, 0, 1, 0);
|
||||
worldRendererIn.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
|
||||
worldRendererIn.pos(-particleScale, -length / 2, 0).tex(uMin, vMin)
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
|
||||
buffer.pos(-particleScale, -length / 2, 0).tex(uMin, vMin)
|
||||
.color(particleRed, particleGreen, particleBlue, particleAlpha).lightmap(240, 240).endVertex();
|
||||
worldRendererIn.pos(-particleScale, length / 2, 0).tex(uMin, vMax)
|
||||
buffer.pos(-particleScale, length / 2, 0).tex(uMin, vMax)
|
||||
.color(particleRed, particleGreen, particleBlue, particleAlpha).lightmap(240, 240).endVertex();
|
||||
worldRendererIn.pos(particleScale, length / 2, 0).tex(uMax, vMax)
|
||||
buffer.pos(particleScale, length / 2, 0).tex(uMax, vMax)
|
||||
.color(particleRed, particleGreen, particleBlue, particleAlpha).lightmap(240, 240).endVertex();
|
||||
worldRendererIn.pos(particleScale, -length / 2, 0).tex(uMax, vMin)
|
||||
buffer.pos(particleScale, -length / 2, 0).tex(uMax, vMin)
|
||||
.color(particleRed, particleGreen, particleBlue, particleAlpha).lightmap(240, 240).endVertex();
|
||||
tessellator.draw();
|
||||
|
||||
GlStateManager.rotate(90, 0, 1, 0);
|
||||
worldRendererIn.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
|
||||
worldRendererIn.pos(-particleScale, -length / 2, 0).tex(uMin, vMin)
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
|
||||
buffer.pos(-particleScale, -length / 2, 0).tex(uMin, vMin)
|
||||
.color(particleRed, particleGreen, particleBlue, particleAlpha).lightmap(240, 240).endVertex();
|
||||
worldRendererIn.pos(-particleScale, length / 2, 0).tex(uMin, vMax)
|
||||
buffer.pos(-particleScale, length / 2, 0).tex(uMin, vMax)
|
||||
.color(particleRed, particleGreen, particleBlue, particleAlpha).lightmap(240, 240).endVertex();
|
||||
worldRendererIn.pos(particleScale, length / 2, 0).tex(uMax, vMax)
|
||||
buffer.pos(particleScale, length / 2, 0).tex(uMax, vMax)
|
||||
.color(particleRed, particleGreen, particleBlue, particleAlpha).lightmap(240, 240).endVertex();
|
||||
worldRendererIn.pos(particleScale, -length / 2, 0).tex(uMax, vMin)
|
||||
buffer.pos(particleScale, -length / 2, 0).tex(uMax, vMin)
|
||||
.color(particleRed, particleGreen, particleBlue, particleAlpha).lightmap(240, 240).endVertex();
|
||||
tessellator.draw();
|
||||
|
||||
@@ -99,11 +98,11 @@ public class ParticleLaser extends Particle {
|
||||
GL11.glPopAttrib();
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
worldRendererIn.begin(7, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
|
||||
buffer.begin(7, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFXLayer() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
public class ConfigGuiFactory implements IModGuiFactory {
|
||||
|
||||
@Override
|
||||
public void initialize(Minecraft minecraftInstance) {
|
||||
|
||||
public void initialize(Minecraft instance) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -29,4 +28,4 @@ public class ConfigGuiFactory implements IModGuiFactory {
|
||||
public GuiScreen createConfigGui(GuiScreen parentScreen) {
|
||||
return new GuiMekanismConfig(parentScreen);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,8 +41,7 @@ public class GuiAdvancedElectricMachine extends GuiMekanismTile<TileEntityAdvanc
|
||||
addGuiElement(new GuiEnergyInfo(() -> {
|
||||
String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.energyPerTick);
|
||||
return Arrays.asList(LangUtils.localize("gui.using") + ": " + multiplier + "/t",
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils
|
||||
.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
}, this, resource));
|
||||
addGuiElement(new GuiSlot(SlotType.INPUT, this, resource, 55, 16));
|
||||
addGuiElement(new GuiSlot(SlotType.POWER, this, resource, 30, 34).with(SlotOverlay.POWER));
|
||||
@@ -62,15 +61,13 @@ public class GuiAdvancedElectricMachine extends GuiMekanismTile<TileEntityAdvanc
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
fontRenderer.drawString(tileEntity.getName(),
|
||||
(xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2), 6, 0x404040);
|
||||
fontRenderer.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2), 6, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
if (xAxis >= 61 && xAxis <= 67 && yAxis >= 37 && yAxis <= 49) {
|
||||
drawHoveringText(tileEntity.gasTank.getGas() != null ?
|
||||
tileEntity.gasTank.getGas().getGas().getLocalizedName() + ": " + tileEntity.gasTank.getStored()
|
||||
: LangUtils.localize("gui.none"), xAxis, yAxis);
|
||||
drawHoveringText(tileEntity.gasTank.getGas() != null ? tileEntity.gasTank.getGas().getGas().getLocalizedName() + ": " + tileEntity.gasTank.getStored()
|
||||
: LangUtils.localize("gui.none"), xAxis, yAxis);
|
||||
}
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@@ -32,38 +32,28 @@ public class GuiBoilerStats extends GuiMekanismTile<TileEntityBoilerCasing> {
|
||||
addGuiElement(new GuiBoilerTab(this, tileEntity, BoilerTab.MAIN, 6, resource));
|
||||
addGuiElement(new GuiHeatInfo(() -> {
|
||||
TemperatureUnit unit = TemperatureUnit.values()[MekanismConfig.current().general.tempUnit.val().ordinal()];
|
||||
String environment = UnitDisplayUtils
|
||||
.getDisplayShort(tileEntity.structure.lastEnvironmentLoss * unit.intervalSize, false, unit);
|
||||
String environment = UnitDisplayUtils.getDisplayShort(tileEntity.structure.lastEnvironmentLoss * unit.intervalSize, false, unit);
|
||||
return Collections.singletonList(LangUtils.localize("gui.dissipated") + ": " + environment + "/t");
|
||||
}, this, resource));
|
||||
addGuiElement(boilGraph = new GuiGraph(this, resource, 8, 83, 160, 36,
|
||||
data -> LangUtils.localize("gui.boilRate") + ": " + data + " mB/t"));
|
||||
addGuiElement(maxGraph = new GuiGraph(this, resource, 8, 122, 160, 36,
|
||||
data -> LangUtils.localize("gui.maxBoil") + ": " + data + " mB/t"));
|
||||
maxGraph.enableFixedScale((int) (
|
||||
(tileEntity.structure.superheatingElements * MekanismConfig.current().general.superheatingHeatTransfer
|
||||
.val()) / SynchronizedBoilerData.getHeatEnthalpy()));
|
||||
maxGraph.enableFixedScale((int) ((tileEntity.structure.superheatingElements * MekanismConfig.current().general.superheatingHeatTransfer.val()) /
|
||||
SynchronizedBoilerData.getHeatEnthalpy()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
String stats = LangUtils.localize("gui.boilerStats");
|
||||
fontRenderer.drawString(stats, (xSize / 2) - (fontRenderer.getStringWidth(stats) / 2), 6, 0x404040);
|
||||
fontRenderer
|
||||
.drawString(LangUtils.localize("gui.maxWater") + ": " + tileEntity.clientWaterCapacity + " mB", 8, 26,
|
||||
0x404040);
|
||||
fontRenderer
|
||||
.drawString(LangUtils.localize("gui.maxSteam") + ": " + tileEntity.clientSteamCapacity + " mB", 8, 35,
|
||||
0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.maxWater") + ": " + tileEntity.clientWaterCapacity + " mB", 8, 26, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.maxSteam") + ": " + tileEntity.clientSteamCapacity + " mB", 8, 35, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.heatTransfer"), 8, 49, 0x797979);
|
||||
fontRenderer
|
||||
.drawString(LangUtils.localize("gui.superheaters") + ": " + tileEntity.structure.superheatingElements, 14,
|
||||
58, 0x404040);
|
||||
int boilCapacity = (int) ((tileEntity.structure.superheatingElements *
|
||||
MekanismConfig.current().general.superheatingHeatTransfer.val()) / SynchronizedBoilerData
|
||||
.getHeatEnthalpy());
|
||||
fontRenderer
|
||||
.drawString(LangUtils.localize("gui.boilCapacity") + ": " + boilCapacity + " mB/t", 8, 72, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.superheaters") + ": " + tileEntity.structure.superheatingElements, 14, 58, 0x404040);
|
||||
int boilCapacity = (int) ((tileEntity.structure.superheatingElements * MekanismConfig.current().general.superheatingHeatTransfer.val()) /
|
||||
SynchronizedBoilerData.getHeatEnthalpy());
|
||||
fontRenderer.drawString(LangUtils.localize("gui.boilCapacity") + ": " + boilCapacity + " mB/t", 8, 72, 0x404040);
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,8 +39,7 @@ public class GuiChanceMachine extends GuiMekanismTile<TileEntityChanceMachine> {
|
||||
addGuiElement(new GuiEnergyInfo(() -> {
|
||||
String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.energyPerTick);
|
||||
return Arrays.asList(LangUtils.localize("gui.using") + ": " + multiplier + "/t",
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils
|
||||
.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
}, this, resource));
|
||||
addGuiElement(new GuiSlot(SlotType.INPUT, this, resource, 55, 16));
|
||||
addGuiElement(new GuiSlot(SlotType.POWER, this, resource, 55, 52).with(SlotOverlay.POWER));
|
||||
|
||||
@@ -78,8 +78,8 @@ public class GuiDictionary extends GuiMekanism {
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int button) throws IOException {
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
|
||||
if (button == 0) {
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
|
||||
@@ -87,7 +87,6 @@ public class GuiDictionary extends GuiMekanism {
|
||||
|
||||
for (int i = 0; i < inventorySlots.inventorySlots.size(); i++) {
|
||||
Slot slot = inventorySlots.inventorySlots.get(i);
|
||||
|
||||
if (isMouseOverSlot(slot, mouseX, mouseY)) {
|
||||
hovering = slot;
|
||||
break;
|
||||
@@ -96,14 +95,11 @@ public class GuiDictionary extends GuiMekanism {
|
||||
|
||||
if (hovering != null) {
|
||||
ItemStack stack = hovering.getStack();
|
||||
|
||||
if (!stack.isEmpty()) {
|
||||
itemType = stack.copy();
|
||||
itemType.setCount(1);
|
||||
|
||||
scrollList.setText(OreDictCache.getOreDictName(itemType));
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -115,18 +111,15 @@ public class GuiDictionary extends GuiMekanism {
|
||||
if (!stack.isEmpty() && !Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
|
||||
itemType = stack.copy();
|
||||
itemType.setCount(1);
|
||||
|
||||
scrollList.setText(OreDictCache.getOreDictName(itemType));
|
||||
} else if (stack.isEmpty() && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
|
||||
itemType = ItemStack.EMPTY;
|
||||
|
||||
scrollList.setText(null);
|
||||
}
|
||||
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
}
|
||||
}
|
||||
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.TileNetworkList;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo;
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
@@ -16,7 +17,6 @@ import mekanism.client.gui.element.GuiVisualsTab;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.api.TileNetworkList;
|
||||
import mekanism.common.content.miner.ThreadMinerSearch.State;
|
||||
import mekanism.common.inventory.container.ContainerDigitalMiner;
|
||||
import mekanism.common.network.PacketDigitalMinerGui.DigitalMinerGuiMessage;
|
||||
@@ -57,14 +57,12 @@ public class GuiDigitalMiner extends GuiMekanismTile<TileEntityDigitalMiner> {
|
||||
double perTick = tileEntity.getPerTick();
|
||||
String multiplier = MekanismUtils.getEnergyDisplay(perTick);
|
||||
ArrayList<String> ret = new ArrayList<>(4);
|
||||
ret.add(LangUtils.localize("mekanism.gui.digitalMiner.capacity") + ": " + MekanismUtils
|
||||
.getEnergyDisplay(tileEntity.getMaxEnergy()));
|
||||
ret.add(LangUtils.localize("mekanism.gui.digitalMiner.capacity") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy()));
|
||||
ret.add(LangUtils.localize("gui.needed") + ": " + multiplier + "/t");
|
||||
if (perTick > tileEntity.getMaxEnergy()) {
|
||||
ret.add(TextFormatting.RED + LangUtils.localize("mekanism.gui.insufficientbuffer"));
|
||||
}
|
||||
ret.add(LangUtils.localize("mekanism.gui.bufferfree") + ": " + MekanismUtils
|
||||
.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
ret.add(LangUtils.localize("mekanism.gui.bufferfree") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
return ret;
|
||||
}, this, resource));
|
||||
addGuiElement(new GuiSlot(SlotType.NORMAL, this, resource, 151, 5).with(SlotOverlay.POWER));
|
||||
@@ -105,8 +103,7 @@ public class GuiDigitalMiner extends GuiMekanismTile<TileEntityDigitalMiner> {
|
||||
TileNetworkList data = TileNetworkList.withContents(4);
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
} else if (guibutton.id == 2) {
|
||||
Mekanism.packetHandler
|
||||
.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
|
||||
Mekanism.packetHandler.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 0, 0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,14 +130,9 @@ public class GuiDigitalMiner extends GuiMekanismTile<TileEntityDigitalMiner> {
|
||||
fontRenderer.drawString(runningType, 9, 10, 0x00CD00);
|
||||
fontRenderer.drawString(tileEntity.searcher.state.desc, 9, 19, 0x00CD00);
|
||||
|
||||
fontRenderer.drawString(
|
||||
LangUtils.localize("gui.eject") + ": " + LangUtils.localize("gui." + (tileEntity.doEject ? "on" : "off")),
|
||||
9, 30, 0x00CD00);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.digitalMiner.pull") + ": " + LangUtils
|
||||
.localize("gui." + (tileEntity.doPull ? "on" : "off")), 9, 39, 0x00CD00);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.digitalMiner.silk") + ": " + LangUtils
|
||||
.localize("gui." + (tileEntity.silkTouch ? "on" : "off")), 9, 48, 0x00CD00);
|
||||
|
||||
fontRenderer.drawString(LangUtils.localize("gui.eject") + ": " + LangUtils.localize("gui." + (tileEntity.doEject ? "on" : "off")), 9, 30, 0x00CD00);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.digitalMiner.pull") + ": " + LangUtils.localize("gui." + (tileEntity.doPull ? "on" : "off")), 9, 39, 0x00CD00);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.digitalMiner.silk") + ": " + LangUtils.localize("gui." + (tileEntity.silkTouch ? "on" : "off")), 9, 48, 0x00CD00);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.digitalMiner.toMine") + ":", 9, 59, 0x00CD00);
|
||||
fontRenderer.drawString("" + tileEntity.clientToMine, 9, 68, 0x00CD00);
|
||||
|
||||
@@ -152,7 +144,6 @@ public class GuiDigitalMiner extends GuiMekanismTile<TileEntityDigitalMiner> {
|
||||
mc.getTextureManager().bindTexture(MekanismRenderer.getBlocksTexture());
|
||||
drawTexturedRectFromIcon(144, 27, MekanismRenderer.getColorIcon(EnumColor.DARK_RED), 16, 16);
|
||||
itemRender.renderItemAndEffectIntoGUI(tileEntity.missingStack, 144, 27);
|
||||
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GlStateManager.popMatrix();
|
||||
} else {
|
||||
@@ -160,11 +151,10 @@ public class GuiDigitalMiner extends GuiMekanismTile<TileEntityDigitalMiner> {
|
||||
drawTexturedModalRect(143, 26, SlotOverlay.CHECK.textureX, SlotOverlay.CHECK.textureY, 18, 18);
|
||||
}
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
if (xAxis >= 164 && xAxis <= 168 && yAxis >= 25 && yAxis <= 77) {
|
||||
drawHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), xAxis,
|
||||
yAxis);
|
||||
drawHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), xAxis, yAxis);
|
||||
}
|
||||
if (xAxis >= 147 && xAxis <= 161 && yAxis >= 47 && yAxis <= 61) {
|
||||
drawHoveringText(LangUtils.localize("gui.autoEject"), xAxis, yAxis);
|
||||
@@ -198,10 +188,7 @@ public class GuiDigitalMiner extends GuiMekanismTile<TileEntityDigitalMiner> {
|
||||
|
||||
int xAxis = mouseX - guiWidth;
|
||||
int yAxis = mouseY - guiHeight;
|
||||
|
||||
int displayInt;
|
||||
|
||||
displayInt = tileEntity.getScaledEnergyLevel(52);
|
||||
int displayInt = tileEntity.getScaledEnergyLevel(52);
|
||||
drawTexturedModalRect(guiWidth + 164, guiHeight + 25 + 52 - displayInt, 176, 52 - displayInt, 4, displayInt);
|
||||
|
||||
if (xAxis >= 147 && xAxis <= 161 && yAxis >= 47 && yAxis <= 61) {
|
||||
@@ -227,47 +214,36 @@ public class GuiDigitalMiner extends GuiMekanismTile<TileEntityDigitalMiner> {
|
||||
} else {
|
||||
drawTexturedModalRect(guiWidth + 131, guiHeight + 63, 176 + 4 + 42, 14, 14, 14);
|
||||
}
|
||||
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int button) throws IOException {
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
|
||||
if (button == 0) {
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
if (xAxis >= 147 && xAxis <= 161 && yAxis >= 47 && yAxis <= 61) {
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
|
||||
TileNetworkList data = TileNetworkList.withContents(0);
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
}
|
||||
|
||||
if (xAxis >= 147 && xAxis <= 161 && yAxis >= 63 && yAxis <= 77) {
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
|
||||
TileNetworkList data = TileNetworkList.withContents(1);
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
}
|
||||
|
||||
if (xAxis >= 131 && xAxis <= 145 && yAxis >= 47 && yAxis <= 61) {
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
|
||||
TileNetworkList data = TileNetworkList.withContents(5);
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
}
|
||||
|
||||
if (xAxis >= 131 && xAxis <= 145 && yAxis >= 63 && yAxis <= 77) {
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
|
||||
TileNetworkList data = TileNetworkList.withContents(9);
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,6 @@ public class GuiDigitalMinerConfig extends GuiMekanismTile<TileEntityDigitalMine
|
||||
final int scrollSize = tileEntity.filters.size() - 4;
|
||||
return (int) ((scrollSize + 0.5) * scroll);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -100,26 +99,22 @@ public class GuiDigitalMinerConfig extends GuiMekanismTile<TileEntityDigitalMine
|
||||
if (stackSwitch == 0) {
|
||||
for (Map.Entry<MOreDictFilter, StackData> entry : oreDictStacks.entrySet()) {
|
||||
if (entry.getValue().iterStacks != null && entry.getValue().iterStacks.size() > 0) {
|
||||
if (entry.getValue().stackIndex == -1
|
||||
|| entry.getValue().stackIndex == entry.getValue().iterStacks.size() - 1) {
|
||||
if (entry.getValue().stackIndex == -1 || entry.getValue().stackIndex == entry.getValue().iterStacks.size() - 1) {
|
||||
entry.getValue().stackIndex = 0;
|
||||
} else if (entry.getValue().stackIndex < entry.getValue().iterStacks.size() - 1) {
|
||||
entry.getValue().stackIndex++;
|
||||
}
|
||||
|
||||
entry.getValue().renderStack = entry.getValue().iterStacks.get(entry.getValue().stackIndex);
|
||||
}
|
||||
}
|
||||
|
||||
for (Map.Entry<MModIDFilter, StackData> entry : modIDStacks.entrySet()) {
|
||||
if (entry.getValue().iterStacks != null && entry.getValue().iterStacks.size() > 0) {
|
||||
if (entry.getValue().stackIndex == -1
|
||||
|| entry.getValue().stackIndex == entry.getValue().iterStacks.size() - 1) {
|
||||
if (entry.getValue().stackIndex == -1 || entry.getValue().stackIndex == entry.getValue().iterStacks.size() - 1) {
|
||||
entry.getValue().stackIndex = 0;
|
||||
} else if (entry.getValue().stackIndex < entry.getValue().iterStacks.size() - 1) {
|
||||
entry.getValue().stackIndex++;
|
||||
}
|
||||
|
||||
entry.getValue().renderStack = entry.getValue().iterStacks.get(entry.getValue().stackIndex);
|
||||
}
|
||||
}
|
||||
@@ -131,7 +126,6 @@ public class GuiDigitalMinerConfig extends GuiMekanismTile<TileEntityDigitalMine
|
||||
entry.getValue().renderStack = ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
for (Map.Entry<MModIDFilter, StackData> entry : modIDStacks.entrySet()) {
|
||||
if (entry.getValue().iterStacks != null && entry.getValue().iterStacks.size() == 0) {
|
||||
entry.getValue().renderStack = ItemStack.EMPTY;
|
||||
@@ -168,8 +162,8 @@ public class GuiDigitalMinerConfig extends GuiMekanismTile<TileEntityDigitalMine
|
||||
maxField.mouseClicked(mouseX, mouseY, button);
|
||||
|
||||
if (button == 0) {
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
|
||||
if (xAxis >= 154 && xAxis <= 166 && yAxis >= getScroll() + 18 && yAxis <= getScroll() + 18 + 15) {
|
||||
if (needsScrollBars()) {
|
||||
@@ -191,10 +185,8 @@ public class GuiDigitalMinerConfig extends GuiMekanismTile<TileEntityDigitalMine
|
||||
if (xAxis >= arrowX && xAxis <= arrowX + 10 && yAxis >= yStart + 14 && yAxis <= yStart + 20) {
|
||||
// Process up button click
|
||||
final TileNetworkList data = TileNetworkList.withContents(11, getFilterIndex() + i);
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -203,10 +195,8 @@ public class GuiDigitalMinerConfig extends GuiMekanismTile<TileEntityDigitalMine
|
||||
if (xAxis >= arrowX && xAxis <= arrowX + 10 && yAxis >= yStart + 21 && yAxis <= yStart + 27) {
|
||||
// Process down button click
|
||||
final TileNetworkList data = TileNetworkList.withContents(12, getFilterIndex() + i);
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -216,24 +206,16 @@ public class GuiDigitalMinerConfig extends GuiMekanismTile<TileEntityDigitalMine
|
||||
|
||||
if (filter instanceof MItemStackFilter) {
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
Mekanism.packetHandler.sendToServer(
|
||||
new DigitalMinerGuiMessage(MinerGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 1,
|
||||
getFilterIndex() + i, 0));
|
||||
Mekanism.packetHandler.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 1, getFilterIndex() + i, 0));
|
||||
} else if (filter instanceof MOreDictFilter) {
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
Mekanism.packetHandler.sendToServer(
|
||||
new DigitalMinerGuiMessage(MinerGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 2,
|
||||
getFilterIndex() + i, 0));
|
||||
Mekanism.packetHandler.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 2, getFilterIndex() + i, 0));
|
||||
} else if (filter instanceof MMaterialFilter) {
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
Mekanism.packetHandler.sendToServer(
|
||||
new DigitalMinerGuiMessage(MinerGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 3,
|
||||
getFilterIndex() + i, 0));
|
||||
Mekanism.packetHandler.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 3, getFilterIndex() + i, 0));
|
||||
} else if (filter instanceof MModIDFilter) {
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
Mekanism.packetHandler.sendToServer(
|
||||
new DigitalMinerGuiMessage(MinerGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 6,
|
||||
getFilterIndex() + i, 0));
|
||||
Mekanism.packetHandler.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 6, getFilterIndex() + i, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -241,8 +223,7 @@ public class GuiDigitalMinerConfig extends GuiMekanismTile<TileEntityDigitalMine
|
||||
|
||||
if (xAxis >= 5 && xAxis <= 16 && yAxis >= 5 && yAxis <= 16) {
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
Mekanism.packetHandler.sendToServer(
|
||||
new DigitalMinerGuiMessage(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 4, 0, 0));
|
||||
Mekanism.packetHandler.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 4, 0, 0));
|
||||
}
|
||||
|
||||
if (xAxis >= 39 && xAxis <= 50 && yAxis >= 67 && yAxis <= 78) {
|
||||
@@ -262,7 +243,6 @@ public class GuiDigitalMinerConfig extends GuiMekanismTile<TileEntityDigitalMine
|
||||
|
||||
if (xAxis >= 11 && xAxis <= 25 && yAxis >= 141 && yAxis <= 155) {
|
||||
TileNetworkList data = TileNetworkList.withContents(10);
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
}
|
||||
@@ -273,7 +253,7 @@ public class GuiDigitalMinerConfig extends GuiMekanismTile<TileEntityDigitalMine
|
||||
protected void mouseClickMove(int mouseX, int mouseY, int button, long ticks) {
|
||||
super.mouseClickMove(mouseX, mouseY, button, ticks);
|
||||
if (isDragging) {
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
scroll = Math.min(Math.max((float) (yAxis - 18 - dragOffset) / 123F, 0), 1);
|
||||
}
|
||||
}
|
||||
@@ -281,7 +261,6 @@ public class GuiDigitalMinerConfig extends GuiMekanismTile<TileEntityDigitalMine
|
||||
@Override
|
||||
protected void mouseReleased(int x, int y, int type) {
|
||||
super.mouseReleased(x, y, type);
|
||||
|
||||
if (type == 0 && isDragging) {
|
||||
dragOffset = 0;
|
||||
isDragging = false;
|
||||
@@ -294,27 +273,18 @@ public class GuiDigitalMinerConfig extends GuiMekanismTile<TileEntityDigitalMine
|
||||
@Override
|
||||
public void handleMouseInput() throws IOException {
|
||||
super.handleMouseInput();
|
||||
|
||||
int i = Mouse.getEventDWheel();
|
||||
|
||||
if (i != 0 && needsScrollBars()) {
|
||||
final int j = tileEntity.filters.size() - 4;
|
||||
|
||||
if (i > 0) {
|
||||
i = 1;
|
||||
}
|
||||
|
||||
if (i < 0) {
|
||||
} else {
|
||||
i = -1;
|
||||
}
|
||||
|
||||
scroll = (float) (scroll - (double) i / (double) j);
|
||||
|
||||
if (scroll < 0.0F) {
|
||||
scroll = 0.0F;
|
||||
}
|
||||
|
||||
if (scroll > 1.0F) {
|
||||
} else if (scroll > 1.0F) {
|
||||
scroll = 1.0F;
|
||||
}
|
||||
}
|
||||
@@ -328,7 +298,6 @@ public class GuiDigitalMinerConfig extends GuiMekanismTile<TileEntityDigitalMine
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
|
||||
@@ -340,8 +309,7 @@ public class GuiDigitalMinerConfig extends GuiMekanismTile<TileEntityDigitalMine
|
||||
String prevMax = maxField != null ? maxField.getText() : "";
|
||||
|
||||
radiusField = new GuiTextField(1, fontRenderer, guiWidth + 12, guiHeight + 67, 26, 11);
|
||||
radiusField.setMaxStringLength(
|
||||
Integer.toString(MekanismConfig.current().general.digitalMinerMaxRadius.val()).length());
|
||||
radiusField.setMaxStringLength(Integer.toString(MekanismConfig.current().general.digitalMinerMaxRadius.val()).length());
|
||||
radiusField.setText(prevRad);
|
||||
|
||||
minField = new GuiTextField(2, fontRenderer, guiWidth + 12, guiHeight + 92, 26, 11);
|
||||
@@ -358,29 +326,21 @@ public class GuiDigitalMinerConfig extends GuiMekanismTile<TileEntityDigitalMine
|
||||
super.actionPerformed(guibutton);
|
||||
|
||||
if (guibutton.id == 0) {
|
||||
Mekanism.packetHandler
|
||||
.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 5, 0, 0));
|
||||
Mekanism.packetHandler.sendToServer(new DigitalMinerGuiMessage(MinerGuiPacket.SERVER, Coord4D.get(tileEntity), 5, 0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
|
||||
fontRenderer.drawString(LangUtils.localize("gui.digitalMinerConfig"), 43, 6, 0x404040);
|
||||
|
||||
fontRenderer.drawString(LangUtils.localize("gui.filters") + ":", 11, 19, 0x00CD00);
|
||||
fontRenderer.drawString("T: " + tileEntity.filters.size(), 11, 28, 0x00CD00);
|
||||
|
||||
fontRenderer
|
||||
.drawString("I: " + (tileEntity.inverse ? LangUtils.localize("gui.on") : LangUtils.localize("gui.off")),
|
||||
11, 131, 0x00CD00);
|
||||
|
||||
fontRenderer.drawString("I: " + (tileEntity.inverse ? LangUtils.localize("gui.on") : LangUtils.localize("gui.off")), 11, 131, 0x00CD00);
|
||||
fontRenderer.drawString("Radi: " + tileEntity.getRadius(), 11, 58, 0x00CD00);
|
||||
|
||||
fontRenderer.drawString("Min: " + tileEntity.minY, 11, 83, 0x00CD00);
|
||||
|
||||
fontRenderer.drawString("Max: " + tileEntity.maxY, 11, 108, 0x00CD00);
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
@@ -390,7 +350,6 @@ public class GuiDigitalMinerConfig extends GuiMekanismTile<TileEntityDigitalMine
|
||||
|
||||
if (filter instanceof MItemStackFilter) {
|
||||
MItemStackFilter itemFilter = (MItemStackFilter) filter;
|
||||
|
||||
if (!itemFilter.itemType.isEmpty()) {
|
||||
GlStateManager.pushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
@@ -402,13 +361,10 @@ public class GuiDigitalMinerConfig extends GuiMekanismTile<TileEntityDigitalMine
|
||||
fontRenderer.drawString(LangUtils.localize("gui.itemFilter"), 78, yStart + 2, 0x404040);
|
||||
} else if (filter instanceof MOreDictFilter) {
|
||||
MOreDictFilter oreFilter = (MOreDictFilter) filter;
|
||||
|
||||
if (!oreDictStacks.containsKey(oreFilter)) {
|
||||
updateStackList(oreFilter);
|
||||
}
|
||||
|
||||
ItemStack renderStack = oreDictStacks.get(filter).renderStack;
|
||||
|
||||
if (!renderStack.isEmpty()) {
|
||||
try {
|
||||
GlStateManager.pushMatrix();
|
||||
@@ -419,11 +375,9 @@ public class GuiDigitalMinerConfig extends GuiMekanismTile<TileEntityDigitalMine
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
fontRenderer.drawString(LangUtils.localize("gui.oredictFilter"), 78, yStart + 2, 0x404040);
|
||||
} else if (filter instanceof MMaterialFilter) {
|
||||
MMaterialFilter itemFilter = (MMaterialFilter) filter;
|
||||
|
||||
if (!itemFilter.getMaterialItem().isEmpty()) {
|
||||
GlStateManager.pushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
@@ -431,17 +385,13 @@ public class GuiDigitalMinerConfig extends GuiMekanismTile<TileEntityDigitalMine
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
fontRenderer.drawString(LangUtils.localize("gui.materialFilter"), 78, yStart + 2, 0x404040);
|
||||
} else if (filter instanceof MModIDFilter) {
|
||||
MModIDFilter modFilter = (MModIDFilter) filter;
|
||||
|
||||
if (!modIDStacks.containsKey(modFilter)) {
|
||||
updateStackList(modFilter);
|
||||
}
|
||||
|
||||
ItemStack renderStack = modIDStacks.get(filter).renderStack;
|
||||
|
||||
if (!renderStack.isEmpty()) {
|
||||
try {
|
||||
GlStateManager.pushMatrix();
|
||||
@@ -452,16 +402,13 @@ public class GuiDigitalMinerConfig extends GuiMekanismTile<TileEntityDigitalMine
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
fontRenderer.drawString(LangUtils.localize("gui.modIDFilter"), 78, yStart + 2, 0x404040);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (xAxis >= 11 && xAxis <= 25 && yAxis >= 141 && yAxis <= 155) {
|
||||
drawHoveringText(LangUtils.localize("gui.digitalMiner.inverse"), xAxis, yAxis);
|
||||
}
|
||||
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@@ -474,12 +421,10 @@ public class GuiDigitalMinerConfig extends GuiMekanismTile<TileEntityDigitalMine
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
drawTexturedModalRect(guiLeft + scrollX, guiTop + scrollY + getScroll(), 232 + (needsScrollBars() ? 0 : 12), 0, 12, 15);
|
||||
|
||||
drawTexturedModalRect(guiLeft + scrollX, guiTop + scrollY + getScroll(), 232 + (needsScrollBars() ? 0 : 12), 0,
|
||||
12, 15);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (tileEntity.filters.get(getFilterIndex() + i) != null) {
|
||||
@@ -554,7 +499,6 @@ public class GuiDigitalMinerConfig extends GuiMekanismTile<TileEntityDigitalMine
|
||||
if ((!radiusField.isFocused() && !minField.isFocused() && !maxField.isFocused()) || i == Keyboard.KEY_ESCAPE) {
|
||||
super.keyTyped(c, i);
|
||||
}
|
||||
|
||||
if (i == Keyboard.KEY_RETURN) {
|
||||
if (radiusField.isFocused()) {
|
||||
setRadius();
|
||||
@@ -564,7 +508,6 @@ public class GuiDigitalMinerConfig extends GuiMekanismTile<TileEntityDigitalMine
|
||||
setMaxY();
|
||||
}
|
||||
}
|
||||
|
||||
if (Character.isDigit(c) || isTextboxKey(c, i)) {
|
||||
radiusField.textboxKeyTyped(c, i);
|
||||
minField.textboxKeyTyped(c, i);
|
||||
@@ -574,13 +517,9 @@ public class GuiDigitalMinerConfig extends GuiMekanismTile<TileEntityDigitalMine
|
||||
|
||||
private void setRadius() {
|
||||
if (!radiusField.getText().isEmpty()) {
|
||||
int toUse = Math.max(0, Math.min(Integer.parseInt(radiusField.getText()),
|
||||
MekanismConfig.current().general.digitalMinerMaxRadius.val()));
|
||||
|
||||
int toUse = Math.max(0, Math.min(Integer.parseInt(radiusField.getText()), MekanismConfig.current().general.digitalMinerMaxRadius.val()));
|
||||
TileNetworkList data = TileNetworkList.withContents(6, toUse);
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
|
||||
radiusField.setText("");
|
||||
}
|
||||
}
|
||||
@@ -588,11 +527,8 @@ public class GuiDigitalMinerConfig extends GuiMekanismTile<TileEntityDigitalMine
|
||||
private void setMinY() {
|
||||
if (!minField.getText().isEmpty()) {
|
||||
int toUse = Math.max(0, Math.min(Integer.parseInt(minField.getText()), tileEntity.maxY));
|
||||
|
||||
TileNetworkList data = TileNetworkList.withContents(7, toUse);
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
|
||||
minField.setText("");
|
||||
}
|
||||
}
|
||||
@@ -600,11 +536,8 @@ public class GuiDigitalMinerConfig extends GuiMekanismTile<TileEntityDigitalMine
|
||||
private void setMaxY() {
|
||||
if (!maxField.getText().isEmpty()) {
|
||||
int toUse = Math.max(tileEntity.minY, Math.min(Integer.parseInt(maxField.getText()), 255));
|
||||
|
||||
TileNetworkList data = TileNetworkList.withContents(8, toUse);
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
|
||||
maxField.setText("");
|
||||
}
|
||||
}
|
||||
@@ -613,9 +546,7 @@ public class GuiDigitalMinerConfig extends GuiMekanismTile<TileEntityDigitalMine
|
||||
if (!oreDictStacks.containsKey(filter)) {
|
||||
oreDictStacks.put(filter, new StackData());
|
||||
}
|
||||
|
||||
oreDictStacks.get(filter).iterStacks = OreDictCache.getOreDictStacks(filter.getOreDictName(), true);
|
||||
|
||||
stackSwitch = 0;
|
||||
updateScreen();
|
||||
oreDictStacks.get(filter).stackIndex = -1;
|
||||
@@ -625,9 +556,7 @@ public class GuiDigitalMinerConfig extends GuiMekanismTile<TileEntityDigitalMine
|
||||
if (!modIDStacks.containsKey(filter)) {
|
||||
modIDStacks.put(filter, new StackData());
|
||||
}
|
||||
|
||||
modIDStacks.get(filter).iterStacks = OreDictCache.getModIDStacks(filter.getModID(), true);
|
||||
|
||||
stackSwitch = 0;
|
||||
updateScreen();
|
||||
modIDStacks.get(filter).stackIndex = -1;
|
||||
|
||||
@@ -39,8 +39,7 @@ public class GuiDoubleElectricMachine extends GuiMekanismTile<TileEntityDoubleEl
|
||||
addGuiElement(new GuiEnergyInfo(() -> {
|
||||
String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.energyPerTick);
|
||||
return Arrays.asList(LangUtils.localize("gui.using") + ": " + multiplier + "/t",
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils
|
||||
.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
}, this, resource));
|
||||
addGuiElement(new GuiSlot(SlotType.INPUT, this, resource, 55, 16));
|
||||
addGuiElement(new GuiSlot(SlotType.POWER, this, resource, 30, 34).with(SlotOverlay.POWER));
|
||||
@@ -60,9 +59,7 @@ public class GuiDoubleElectricMachine extends GuiMekanismTile<TileEntityDoubleEl
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
fontRenderer
|
||||
.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2),
|
||||
6, 0x404040);
|
||||
fontRenderer.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2), 6, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@@ -23,26 +23,20 @@ public class GuiDynamicTank extends GuiEmbeddedGaugeTile<TileEntityDynamicTank>
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
fontRenderer
|
||||
.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2),
|
||||
6, 0x404040);
|
||||
fontRenderer.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2), 6, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 94) + 2, 0x404040);
|
||||
fontRenderer.drawString(
|
||||
LangUtils.localize("gui.volume") + ": " + tileEntity.clientCapacity / TankUpdateProtocol.FLUID_PER_TANK,
|
||||
53, 26, 0x00CD00);
|
||||
renderScaledText(
|
||||
tileEntity.structure.fluidStored != null ? LangUtils.localizeFluidStack(tileEntity.structure.fluidStored)
|
||||
+ ":" : LangUtils.localize("gui.noFluid"), 53, 44, 0x00CD00, 74);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.volume") + ": " + tileEntity.clientCapacity / TankUpdateProtocol.FLUID_PER_TANK, 53, 26, 0x00CD00);
|
||||
renderScaledText(tileEntity.structure.fluidStored != null ? LangUtils.localizeFluidStack(tileEntity.structure.fluidStored)
|
||||
+ ":" : LangUtils.localize("gui.noFluid"), 53, 44, 0x00CD00, 74);
|
||||
if (tileEntity.structure.fluidStored != null) {
|
||||
fontRenderer.drawString(tileEntity.structure.fluidStored.amount + "mB", 53, 53, 0x00CD00);
|
||||
}
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
if (xAxis >= 7 && xAxis <= 39 && yAxis >= 14 && yAxis <= 72) {
|
||||
drawHoveringText(tileEntity.structure.fluidStored != null ?
|
||||
LangUtils.localizeFluidStack(tileEntity.structure.fluidStored) + ": "
|
||||
+ tileEntity.structure.fluidStored.amount + "mB" : LangUtils.localize("gui.empty"), xAxis,
|
||||
yAxis);
|
||||
drawHoveringText(tileEntity.structure.fluidStored != null
|
||||
? LangUtils.localizeFluidStack(tileEntity.structure.fluidStored) + ": " + tileEntity.structure.fluidStored.amount + "mB"
|
||||
: LangUtils.localize("gui.empty"), xAxis, yAxis);
|
||||
}
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@@ -39,8 +39,7 @@ public class GuiElectricMachine extends GuiMekanismTile<TileEntityElectricMachin
|
||||
addGuiElement(new GuiEnergyInfo(() -> {
|
||||
String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.energyPerTick);
|
||||
return Arrays.asList(LangUtils.localize("gui.using") + ": " + multiplier + "/t",
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils
|
||||
.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
}, this, resource));
|
||||
addGuiElement(new GuiSlot(SlotType.INPUT, this, resource, 55, 16));
|
||||
addGuiElement(new GuiSlot(SlotType.POWER, this, resource, 55, 52).with(SlotOverlay.POWER));
|
||||
@@ -59,9 +58,7 @@ public class GuiElectricMachine extends GuiMekanismTile<TileEntityElectricMachin
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
fontRenderer
|
||||
.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2),
|
||||
6, 0x404040);
|
||||
fontRenderer.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2), 6, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@@ -37,8 +37,7 @@ public class GuiElectricPump extends GuiMekanismTile<TileEntityElectricPump> {
|
||||
addGuiElement(new GuiEnergyInfo(() -> {
|
||||
String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.energyPerTick);
|
||||
return Arrays.asList(LangUtils.localize("gui.using") + ": " + multiplier + "/t",
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils
|
||||
.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
}, this, resource));
|
||||
addGuiElement(new GuiSecurityTab(this, tileEntity, resource));
|
||||
addGuiElement(new GuiRedstoneControl(this, tileEntity, resource));
|
||||
@@ -47,16 +46,12 @@ public class GuiElectricPump extends GuiMekanismTile<TileEntityElectricPump> {
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
fontRenderer
|
||||
.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2),
|
||||
6, 0x404040);
|
||||
fontRenderer.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2), 6, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 94) + 2, 0x404040);
|
||||
fontRenderer
|
||||
.drawString(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), 51, 26,
|
||||
0x00CD00);
|
||||
String text =
|
||||
tileEntity.fluidTank.getFluid() != null ? LangUtils.localizeFluidStack(tileEntity.fluidTank.getFluid())
|
||||
+ ": " + tileEntity.fluidTank.getFluid().amount : LangUtils.localize("gui.noFluid");
|
||||
fontRenderer.drawString(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), 51, 26, 0x00CD00);
|
||||
String text = tileEntity.fluidTank.getFluid() != null
|
||||
? LangUtils.localizeFluidStack(tileEntity.fluidTank.getFluid()) + ": " + tileEntity.fluidTank.getFluid().amount
|
||||
: LangUtils.localize("gui.noFluid");
|
||||
renderScaledText(text, 51, 35, 0x00CD00, 74);
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package mekanism.client.gui;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.TileNetworkList;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo;
|
||||
import mekanism.client.gui.element.GuiFluidGauge;
|
||||
import mekanism.client.gui.element.GuiGasGauge;
|
||||
@@ -19,7 +20,6 @@ import mekanism.client.gui.element.GuiSlot.SlotType;
|
||||
import mekanism.client.gui.element.GuiUpgradeTab;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.api.TileNetworkList;
|
||||
import mekanism.common.inventory.container.ContainerElectrolyticSeparator;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.tile.TileEntityElectrolyticSeparator;
|
||||
@@ -45,8 +45,7 @@ public class GuiElectrolyticSeparator extends GuiMekanismTile<TileEntityElectrol
|
||||
addGuiElement(new GuiEnergyInfo(() -> {
|
||||
String usage = MekanismUtils.getEnergyDisplay(tileEntity.clientEnergyUsed);
|
||||
return Arrays.asList(LangUtils.localize("gui.using") + ": " + usage + "/t",
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils
|
||||
.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
}, this, resource));
|
||||
addGuiElement(new GuiFluidGauge(() -> tileEntity.fluidTank, GuiGauge.Type.STANDARD, this, resource, 5, 10));
|
||||
addGuiElement(new GuiGasGauge(() -> tileEntity.leftTank, GuiGauge.Type.SMALL, this, resource, 58, 18));
|
||||
@@ -68,8 +67,8 @@ public class GuiElectrolyticSeparator extends GuiMekanismTile<TileEntityElectrol
|
||||
@Override
|
||||
protected void mouseClicked(int x, int y, int button) throws IOException {
|
||||
super.mouseClicked(x, y, button);
|
||||
int xAxis = (x - (width - xSize) / 2);
|
||||
int yAxis = (y - (height - ySize) / 2);
|
||||
int xAxis = x - (width - xSize) / 2;
|
||||
int yAxis = y - (height - ySize) / 2;
|
||||
if (xAxis > 8 && xAxis < 17 && yAxis > 73 && yAxis < 82) {
|
||||
TileNetworkList data = TileNetworkList.withContents((byte) 0);
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
@@ -89,13 +88,10 @@ public class GuiElectrolyticSeparator extends GuiMekanismTile<TileEntityElectrol
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
fontRenderer.drawString(tileEntity.getName(), 45, 6, 0x404040);
|
||||
String name = chooseByMode(tileEntity.dumpLeft, LangUtils.localize("gui.idle"),
|
||||
LangUtils.localize("gui.dumping"), LangUtils.localize("gui.dumping_excess"));
|
||||
String name = chooseByMode(tileEntity.dumpLeft, LangUtils.localize("gui.idle"), LangUtils.localize("gui.dumping"), LangUtils.localize("gui.dumping_excess"));
|
||||
renderScaledText(name, 21, 73, 0x404040, 66);
|
||||
name = chooseByMode(tileEntity.dumpRight, LangUtils.localize("gui.idle"), LangUtils.localize("gui.dumping"),
|
||||
LangUtils.localize("gui.dumping_excess"));
|
||||
renderScaledText(name, 156 - (int) (fontRenderer.getStringWidth(name) * getNeededScale(name, 66)), 73, 0x404040,
|
||||
66);
|
||||
name = chooseByMode(tileEntity.dumpRight, LangUtils.localize("gui.idle"), LangUtils.localize("gui.dumping"), LangUtils.localize("gui.dumping_excess"));
|
||||
renderScaledText(name, 156 - (int) (fontRenderer.getStringWidth(name) * getNeededScale(name, 66)), 73, 0x404040, 66);
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@@ -106,7 +102,6 @@ public class GuiElectrolyticSeparator extends GuiMekanismTile<TileEntityElectrol
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
|
||||
int displayInt = chooseByMode(tileEntity.dumpLeft, 52, 60, 68);
|
||||
drawTexturedModalRect(guiWidth + 8, guiHeight + 73, 176, displayInt, 8, 8);
|
||||
|
||||
@@ -125,7 +120,6 @@ public class GuiElectrolyticSeparator extends GuiMekanismTile<TileEntityElectrol
|
||||
} else if (dumping.equals(TileEntityGasTank.GasMode.DUMPING_EXCESS)) {
|
||||
return dumpingExcessOption;
|
||||
}
|
||||
|
||||
return idleOption; //should not happen;
|
||||
}
|
||||
}
|
||||
@@ -39,8 +39,7 @@ public abstract class GuiEmbeddedGaugeTile<TILE extends TileEntityContainerBlock
|
||||
renderRemaining = scale;
|
||||
scale = 0;
|
||||
}
|
||||
drawTexturedModalRect(guiWidth + xPos, guiHeight + yPos + 58 - renderRemaining - start,
|
||||
fluidTexture, 16, 16 - (16 - renderRemaining));
|
||||
drawTexturedModalRect(guiWidth + xPos, guiHeight + yPos + 58 - renderRemaining - start, fluidTexture, 16, renderRemaining);
|
||||
start += 16;
|
||||
if (renderRemaining == 0 || scale == 0) {
|
||||
break;
|
||||
|
||||
@@ -32,19 +32,15 @@ public class GuiEnergyCube extends GuiMekanismTile<TileEntityEnergyCube> {
|
||||
addGuiElement(new GuiSideConfigurationTab(this, tileEntity, resource));
|
||||
addGuiElement(new GuiTransporterConfigTab(this, 34, tileEntity, resource));
|
||||
addGuiElement(new GuiEnergyGauge(() -> tileEntity, GuiEnergyGauge.Type.WIDE, this, resource, 55, 18));
|
||||
addGuiElement(new GuiEnergyInfo(() -> Arrays.asList(LangUtils.localize("gui.storing") + ": " + MekanismUtils
|
||||
.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()),
|
||||
LangUtils.localize("gui.maxOutput") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxOutput())
|
||||
+ "/t"), this, resource));
|
||||
addGuiElement(new GuiEnergyInfo(() -> Arrays.asList(LangUtils.localize("gui.storing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()),
|
||||
LangUtils.localize("gui.maxOutput") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxOutput()) + "/t"), this, resource));
|
||||
addGuiElement(new GuiSlot(SlotType.INPUT, this, resource, 16, 34).with(SlotOverlay.MINUS));
|
||||
addGuiElement(new GuiSlot(SlotType.OUTPUT, this, resource, 142, 34).with(SlotOverlay.PLUS));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
fontRenderer
|
||||
.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2),
|
||||
6, 0x404040);
|
||||
fontRenderer.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2), 6, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, ySize - 96 + 2, 0x404040);
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@ package mekanism.client.gui;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.TileNetworkList;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.infuse.InfuseType;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo;
|
||||
import mekanism.client.gui.element.GuiRecipeType;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
@@ -15,13 +17,12 @@ import mekanism.client.gui.element.GuiUpgradeTab;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.tier.FactoryTier;
|
||||
import mekanism.common.base.IFactory.MachineFuelType;
|
||||
import mekanism.common.base.IFactory.RecipeType;
|
||||
import mekanism.api.TileNetworkList;
|
||||
import mekanism.common.inventory.container.ContainerFactory;
|
||||
import mekanism.common.item.ItemGaugeDropper;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.tier.FactoryTier;
|
||||
import mekanism.common.tile.TileEntityFactory;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
@@ -52,32 +53,26 @@ public class GuiFactory extends GuiMekanismTile<TileEntityFactory> {
|
||||
addGuiElement(new GuiEnergyInfo(() -> {
|
||||
String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.lastUsage);
|
||||
return Arrays.asList(LangUtils.localize("gui.using") + ": " + multiplier + "/t",
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils
|
||||
.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
}, this, resource));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
fontRenderer
|
||||
.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2),
|
||||
4, 0x404040);
|
||||
fontRenderer.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2), 4, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 93) + 2, 0x404040);
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
if (xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69) {
|
||||
drawHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), xAxis,
|
||||
yAxis);
|
||||
drawHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), xAxis, yAxis);
|
||||
}
|
||||
if (xAxis >= 8 && xAxis <= 168 && yAxis >= 78 && yAxis <= 83) {
|
||||
if (tileEntity.getRecipeType().getFuelType() == MachineFuelType.ADVANCED) {
|
||||
drawHoveringText(
|
||||
tileEntity.gasTank.getGas() != null ? tileEntity.gasTank.getGas().getGas().getLocalizedName()
|
||||
+ ": " + tileEntity.gasTank.getStored() : LangUtils.localize("gui.none"), xAxis, yAxis);
|
||||
GasStack gasStack = tileEntity.gasTank.getGas();
|
||||
drawHoveringText(gasStack != null ? gasStack.getGas().getLocalizedName() + ": " + tileEntity.gasTank.getStored() : LangUtils.localize("gui.none"), xAxis, yAxis);
|
||||
} else if (tileEntity.getRecipeType() == RecipeType.INFUSING) {
|
||||
drawHoveringText(
|
||||
tileEntity.infuseStored.getType() != null ? tileEntity.infuseStored.getType().getLocalizedName() + ": "
|
||||
+ tileEntity.infuseStored.getAmount() : LangUtils.localize("gui.empty"), xAxis, yAxis);
|
||||
InfuseType type = tileEntity.infuseStored.getType();
|
||||
drawHoveringText(type != null ? type.getLocalizedName() + ": " + tileEntity.infuseStored.getAmount() : LangUtils.localize("gui.empty"), xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
@@ -92,8 +87,8 @@ public class GuiFactory extends GuiMekanismTile<TileEntityFactory> {
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
int displayInt = tileEntity.getScaledEnergyLevel(52);
|
||||
drawTexturedModalRect(guiWidth + 165, guiHeight + 17 + 52 - displayInt, 176, 52 - displayInt, 4, displayInt);
|
||||
int xOffset = tileEntity.tier == FactoryTier.BASIC ? 59 : (tileEntity.tier == FactoryTier.ADVANCED ? 39 : 33);
|
||||
int xDistance = tileEntity.tier == FactoryTier.BASIC ? 38 : (tileEntity.tier == FactoryTier.ADVANCED ? 26 : 19);
|
||||
int xOffset = tileEntity.tier == FactoryTier.BASIC ? 59 : tileEntity.tier == FactoryTier.ADVANCED ? 39 : 33;
|
||||
int xDistance = tileEntity.tier == FactoryTier.BASIC ? 38 : tileEntity.tier == FactoryTier.ADVANCED ? 26 : 19;
|
||||
|
||||
for (int i = 0; i < tileEntity.tier.processes; i++) {
|
||||
int xPos = xOffset + (i * xDistance);
|
||||
@@ -135,8 +130,8 @@ public class GuiFactory extends GuiMekanismTile<TileEntityFactory> {
|
||||
protected void mouseClicked(int x, int y, int button) throws IOException {
|
||||
super.mouseClicked(x, y, button);
|
||||
if (button == 0 || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
|
||||
int xAxis = (x - (width - xSize) / 2);
|
||||
int yAxis = (y - (height - ySize) / 2);
|
||||
int xAxis = x - (width - xSize) / 2;
|
||||
int yAxis = y - (height - ySize) / 2;
|
||||
if (xAxis > 8 && xAxis < 168 && yAxis > 78 && yAxis < 83) {
|
||||
ItemStack stack = mc.player.inventory.getItemStack();
|
||||
if (!stack.isEmpty() && stack.getItem() instanceof ItemGaugeDropper) {
|
||||
|
||||
@@ -32,9 +32,7 @@ public class GuiFluidTank extends GuiMekanismTile<TileEntityFluidTank> {
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
fontRenderer
|
||||
.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2),
|
||||
6, 0x404040);
|
||||
fontRenderer.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2), 6, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, ySize - 96 + 2, 0x404040);
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -36,8 +37,7 @@ public class GuiFluidicPlenisher extends GuiMekanismTile<TileEntityFluidicPlenis
|
||||
addGuiElement(new GuiEnergyInfo(() -> {
|
||||
String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.energyPerTick);
|
||||
return Arrays.asList(LangUtils.localize("gui.using") + ": " + multiplier + "/t",
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils
|
||||
.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
}, this, resource));
|
||||
addGuiElement(new GuiSecurityTab(this, tileEntity, resource));
|
||||
addGuiElement(new GuiRedstoneControl(this, tileEntity, resource));
|
||||
@@ -46,20 +46,12 @@ public class GuiFluidicPlenisher extends GuiMekanismTile<TileEntityFluidicPlenis
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
fontRenderer
|
||||
.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2),
|
||||
6, 0x404040);
|
||||
fontRenderer.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2), 6, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 94) + 2, 0x404040);
|
||||
fontRenderer
|
||||
.drawString(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), 51, 26,
|
||||
0x00CD00);
|
||||
fontRenderer
|
||||
.drawString(LangUtils.localize("gui.finished") + ": " + LangUtils.transYesNo(tileEntity.finishedCalc), 51,
|
||||
35, 0x00CD00);
|
||||
fontRenderer.drawString(
|
||||
tileEntity.fluidTank.getFluid() != null ? LangUtils.localizeFluidStack(tileEntity.fluidTank.getFluid())
|
||||
+ ": " + tileEntity.fluidTank.getFluid().amount : LangUtils.localize("gui.noFluid"), 51, 44,
|
||||
0x00CD00);
|
||||
fontRenderer.drawString(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), 51, 26, 0x00CD00);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.finished") + ": " + LangUtils.transYesNo(tileEntity.finishedCalc), 51, 35, 0x00CD00);
|
||||
FluidStack fluid = tileEntity.fluidTank.getFluid();
|
||||
fontRenderer.drawString(fluid != null ? LangUtils.localizeFluidStack(fluid) + ": " + fluid.amount : LangUtils.localize("gui.noFluid"), 51, 44, 0x00CD00);
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package mekanism.client.gui;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.TileNetworkList;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo;
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
@@ -16,7 +17,6 @@ import mekanism.client.gui.element.GuiUpgradeTab;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.api.TileNetworkList;
|
||||
import mekanism.common.inventory.container.ContainerFormulaicAssemblicator;
|
||||
import mekanism.common.item.ItemCraftingFormula;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
@@ -50,8 +50,7 @@ public class GuiFormulaicAssemblicator extends GuiMekanismTile<TileEntityFormula
|
||||
addGuiElement(new GuiEnergyInfo(() -> {
|
||||
String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.energyPerTick);
|
||||
return Arrays.asList(LangUtils.localize("gui.using") + ": " + multiplier + "/t",
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils
|
||||
.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
}, this, resource));
|
||||
addGuiElement(new GuiSlot(SlotType.POWER, this, resource, 151, 75).with(SlotOverlay.POWER));
|
||||
ySize += 64;
|
||||
@@ -59,12 +58,10 @@ public class GuiFormulaicAssemblicator extends GuiMekanismTile<TileEntityFormula
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
fontRenderer
|
||||
.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2),
|
||||
6, 0x404040);
|
||||
fontRenderer.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2), 6, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
if (xAxis >= 44 && xAxis <= 60 && yAxis >= 75 && yAxis <= 91) {
|
||||
drawHoveringText(LangUtils.localize("gui.fillEmpty"), xAxis, yAxis);
|
||||
}
|
||||
@@ -78,12 +75,10 @@ public class GuiFormulaicAssemblicator extends GuiMekanismTile<TileEntityFormula
|
||||
drawHoveringText(LangUtils.localize("gui.craftAvailable"), xAxis, yAxis);
|
||||
}
|
||||
if (xAxis >= 107 && xAxis <= 123 && yAxis >= 75 && yAxis <= 91) {
|
||||
drawHoveringText(LangUtils.localize("gui.autoModeToggle") + ": " +
|
||||
LangUtils.transOnOff(tileEntity.autoMode), xAxis, yAxis);
|
||||
drawHoveringText(LangUtils.localize("gui.autoModeToggle") + ": " + LangUtils.transOnOff(tileEntity.autoMode), xAxis, yAxis);
|
||||
}
|
||||
if (xAxis >= 26 && xAxis <= 42 && yAxis >= 75 && yAxis <= 91) {
|
||||
drawHoveringText(LangUtils.localize("gui.stockControl") + ": " +
|
||||
LangUtils.transOnOff(tileEntity.stockControl), xAxis, yAxis);
|
||||
drawHoveringText(LangUtils.localize("gui.stockControl") + ": " + LangUtils.transOnOff(tileEntity.stockControl), xAxis, yAxis);
|
||||
}
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
@@ -167,13 +162,14 @@ public class GuiFormulaicAssemblicator extends GuiMekanismTile<TileEntityFormula
|
||||
Slot slot = inventorySlots.inventorySlots.get(i + 20);
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
int guiX = guiWidth + slot.xPos;
|
||||
int guiY = guiHeight + slot.yPos;
|
||||
if (slot.getStack().isEmpty() || !slot.getStack().isItemEqual(stack)) {
|
||||
drawGradientRect(guiWidth + slot.xPos, guiHeight + slot.yPos, guiWidth + slot.xPos + 16,
|
||||
guiHeight + slot.yPos + 16, -2137456640, -2137456640);
|
||||
drawGradientRect(guiX, guiY, guiX + 16, guiY + 16, -2137456640, -2137456640);
|
||||
}
|
||||
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
itemRender.renderItemAndEffectIntoGUI(stack, guiWidth + slot.xPos, guiHeight + slot.yPos);
|
||||
itemRender.renderItemAndEffectIntoGUI(stack, guiX, guiY);
|
||||
MekanismRenderer.resetColor();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
@@ -184,10 +180,11 @@ public class GuiFormulaicAssemblicator extends GuiMekanismTile<TileEntityFormula
|
||||
}
|
||||
|
||||
private boolean canEncode() {
|
||||
return tileEntity.formula == null && !tileEntity.inventory.get(2).isEmpty() && tileEntity.inventory.get(2)
|
||||
.getItem() instanceof ItemCraftingFormula &&
|
||||
((ItemCraftingFormula) tileEntity.inventory.get(2).getItem()).getInventory(tileEntity.inventory.get(2))
|
||||
== null;
|
||||
if (tileEntity.formula != null) {
|
||||
return false;
|
||||
}
|
||||
ItemStack formulaStack = tileEntity.inventory.get(2);
|
||||
return !formulaStack.isEmpty() && formulaStack.getItem() instanceof ItemCraftingFormula && ((ItemCraftingFormula) formulaStack.getItem()).getInventory(formulaStack) == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -195,15 +192,13 @@ public class GuiFormulaicAssemblicator extends GuiMekanismTile<TileEntityFormula
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
|
||||
if (button == 0) {
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
|
||||
if (!tileEntity.autoMode) {
|
||||
if (xAxis >= 44 && xAxis <= 60 && yAxis >= 75 && yAxis <= 91) {
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
|
||||
TileNetworkList data = TileNetworkList.withContents(4);
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
}
|
||||
|
||||
@@ -211,26 +206,20 @@ public class GuiFormulaicAssemblicator extends GuiMekanismTile<TileEntityFormula
|
||||
if (canEncode()) {
|
||||
if (xAxis >= 7 && xAxis <= 21 && yAxis >= 45 && yAxis <= 59) {
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
|
||||
TileNetworkList data = TileNetworkList.withContents(1);
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
}
|
||||
}
|
||||
|
||||
if (xAxis >= 71 && xAxis <= 87 && yAxis >= 75 && yAxis <= 91) {
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
|
||||
TileNetworkList data = TileNetworkList.withContents(2);
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
}
|
||||
|
||||
if (xAxis >= 89 && xAxis <= 105 && yAxis >= 75 && yAxis <= 91) {
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
|
||||
TileNetworkList data = TileNetworkList.withContents(3);
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
}
|
||||
}
|
||||
@@ -239,17 +228,13 @@ public class GuiFormulaicAssemblicator extends GuiMekanismTile<TileEntityFormula
|
||||
if (tileEntity.formula != null) {
|
||||
if (xAxis >= 107 && xAxis <= 123 && yAxis >= 75 && yAxis <= 91) {
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
|
||||
TileNetworkList data = TileNetworkList.withContents(0);
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
}
|
||||
|
||||
if (xAxis >= 26 && xAxis <= 42 && yAxis >= 75 && yAxis <= 91) {
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
|
||||
TileNetworkList data = TileNetworkList.withContents(5);
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,20 +29,16 @@ public class GuiFuelwoodHeater extends GuiMekanismTile<TileEntityFuelwoodHeater>
|
||||
addGuiElement(new GuiSecurityTab(this, tileEntity, resource));
|
||||
addGuiElement(new GuiHeatInfo(() -> {
|
||||
TemperatureUnit unit = TemperatureUnit.values()[MekanismConfig.current().general.tempUnit.val().ordinal()];
|
||||
String environment = UnitDisplayUtils
|
||||
.getDisplayShort(tileEntity.lastEnvironmentLoss * unit.intervalSize, false, unit);
|
||||
String environment = UnitDisplayUtils.getDisplayShort(tileEntity.lastEnvironmentLoss * unit.intervalSize, false, unit);
|
||||
return Collections.singletonList(LangUtils.localize("gui.dissipated") + ": " + environment + "/t");
|
||||
}, this, resource));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
fontRenderer
|
||||
.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2),
|
||||
6, 0x404040);
|
||||
fontRenderer.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2), 6, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 94) + 2, 0x404040);
|
||||
renderScaledText(LangUtils.localize("gui.temp") + ": " + MekanismUtils
|
||||
.getTemperatureDisplay(tileEntity.temperature, TemperatureUnit.AMBIENT), 50, 25, 0x00CD00, 76);
|
||||
renderScaledText(LangUtils.localize("gui.temp") + ": " + MekanismUtils.getTemperatureDisplay(tileEntity.temperature, TemperatureUnit.AMBIENT), 50, 25, 0x00CD00, 76);
|
||||
renderScaledText(LangUtils.localize("gui.fuel") + ": " + tileEntity.burnTime, 50, 41, 0x00CD00, 76);
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
@@ -56,8 +52,7 @@ public class GuiFuelwoodHeater extends GuiMekanismTile<TileEntityFuelwoodHeater>
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
if (tileEntity.burnTime > 0) {
|
||||
int displayInt = tileEntity.burnTime * 13 / tileEntity.maxBurnTime;
|
||||
drawTexturedModalRect(guiWidth + 143, guiHeight + 30 + 12 - displayInt, 176, 12 - displayInt, 14,
|
||||
displayInt + 1);
|
||||
drawTexturedModalRect(guiWidth + 143, guiHeight + 30 + 12 - displayInt, 176, 12 - displayInt, 14, displayInt + 1);
|
||||
}
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
}
|
||||
|
||||
@@ -41,21 +41,15 @@ public class GuiGasTank extends GuiMekanismTile<TileEntityGasTank> {
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
String stored = "" + (tileEntity.gasTank.getStored() == Integer.MAX_VALUE ? LangUtils.localize("gui.infinite")
|
||||
: tileEntity.gasTank.getStored());
|
||||
String capacityInfo =
|
||||
stored + " / " + (tileEntity.tier.getStorage() == Integer.MAX_VALUE ? LangUtils.localize("gui.infinite")
|
||||
: tileEntity.tier.getStorage());
|
||||
fontRenderer
|
||||
.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2),
|
||||
6, 0x404040);
|
||||
String stored = "" + (tileEntity.gasTank.getStored() == Integer.MAX_VALUE ? LangUtils.localize("gui.infinite") : tileEntity.gasTank.getStored());
|
||||
String capacityInfo = stored + " / " + (tileEntity.tier.getStorage() == Integer.MAX_VALUE ? LangUtils.localize("gui.infinite") : tileEntity.tier.getStorage());
|
||||
fontRenderer.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2), 6, 0x404040);
|
||||
fontRenderer.drawString(capacityInfo, 45, 40, 0x404040);
|
||||
renderScaledText(
|
||||
LangUtils.localize("gui.gas") + ": " + (tileEntity.gasTank.getGas() != null ? tileEntity.gasTank.getGas()
|
||||
.getGas().getLocalizedName() : LangUtils.localize("gui.none")), 45, 49, 0x404040, 112);
|
||||
renderScaledText(LangUtils.localize("gui.gas") + ": " + (tileEntity.gasTank.getGas() != null
|
||||
? tileEntity.gasTank.getGas().getGas().getLocalizedName()
|
||||
: LangUtils.localize("gui.none")), 45, 49, 0x404040, 112);
|
||||
fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, ySize - 96 + 2, 0x404040);
|
||||
String name = chooseByMode(tileEntity.dumping, LangUtils.localize("gui.idle"),
|
||||
LangUtils.localize("gui.dumping"), LangUtils.localize("gui.dumping_excess"));
|
||||
String name = chooseByMode(tileEntity.dumping, LangUtils.localize("gui.idle"), LangUtils.localize("gui.dumping"), LangUtils.localize("gui.dumping_excess"));
|
||||
fontRenderer.drawString(name, 156 - fontRenderer.getStringWidth(name), 73, 0x404040);
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
@@ -80,8 +74,8 @@ public class GuiGasTank extends GuiMekanismTile<TileEntityGasTank> {
|
||||
@Override
|
||||
protected void mouseClicked(int x, int y, int button) throws IOException {
|
||||
super.mouseClicked(x, y, button);
|
||||
int xAxis = (x - (width - xSize) / 2);
|
||||
int yAxis = (y - (height - ySize) / 2);
|
||||
int xAxis = x - (width - xSize) / 2;
|
||||
int yAxis = y - (height - ySize) / 2;
|
||||
if (xAxis > 160 && xAxis < 169 && yAxis > 73 && yAxis < 82) {
|
||||
TileNetworkList data = TileNetworkList.withContents(0);
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
@@ -103,7 +97,6 @@ public class GuiGasTank extends GuiMekanismTile<TileEntityGasTank> {
|
||||
} else if (dumping.equals(TileEntityGasTank.GasMode.DUMPING_EXCESS)) {
|
||||
return dumpingExcessOption;
|
||||
}
|
||||
|
||||
return idleOption; //should not happen;
|
||||
}
|
||||
}
|
||||
@@ -23,32 +23,23 @@ public class GuiInductionMatrix extends GuiMekanismTile<TileEntityInductionCasin
|
||||
super(tile, new ContainerInductionMatrix(inventory, tile));
|
||||
ResourceLocation resource = getGuiLocation();
|
||||
addGuiElement(new GuiMatrixTab(this, tileEntity, MatrixTab.STAT, 6, resource));
|
||||
addGuiElement(new GuiEnergyInfo(() -> Arrays.asList(
|
||||
LangUtils.localize("gui.storing") + ": " + MekanismUtils
|
||||
.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()),
|
||||
LangUtils.localize("gui.input") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.structure.lastInput)
|
||||
+ "/t",
|
||||
LangUtils.localize("gui.output") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.structure.lastOutput)
|
||||
+ "/t"), this, resource));
|
||||
addGuiElement(new GuiEnergyInfo(() -> Arrays.asList(LangUtils.localize("gui.storing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()),
|
||||
LangUtils.localize("gui.input") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.structure.lastInput) + "/t",
|
||||
LangUtils.localize("gui.output") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.structure.lastOutput) + "/t"), this, resource));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
fontRenderer
|
||||
.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2),
|
||||
6, 0x404040);
|
||||
fontRenderer.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2), 6, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 94) + 2, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.input") + ":", 53, 26, 0x00CD00);
|
||||
fontRenderer
|
||||
.drawString(MekanismUtils.getEnergyDisplay(tileEntity.structure.lastInput) + "/t", 53, 35, 0x00CD00);
|
||||
fontRenderer.drawString(MekanismUtils.getEnergyDisplay(tileEntity.structure.lastInput) + "/t", 53, 35, 0x00CD00);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.output") + ":", 53, 44, 0x00CD00);
|
||||
fontRenderer
|
||||
.drawString(MekanismUtils.getEnergyDisplay(tileEntity.structure.lastOutput) + "/t", 53, 53, 0x00CD00);
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
fontRenderer.drawString(MekanismUtils.getEnergyDisplay(tileEntity.structure.lastOutput) + "/t", 53, 53, 0x00CD00);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
if (xAxis >= 7 && xAxis <= 39 && yAxis >= 14 && yAxis <= 72) {
|
||||
drawHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), xAxis,
|
||||
yAxis);
|
||||
drawHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), xAxis, yAxis);
|
||||
}
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
@@ -75,12 +66,9 @@ public class GuiInductionMatrix extends GuiMekanismTile<TileEntityInductionCasin
|
||||
public void displayGauge(int xPos, int yPos, int scale, int side /*0-left, 1-right*/) {
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
|
||||
int start = 0;
|
||||
|
||||
while (true) {
|
||||
int renderRemaining;
|
||||
|
||||
if (scale > 16) {
|
||||
renderRemaining = 16;
|
||||
scale -= 16;
|
||||
@@ -90,15 +78,12 @@ public class GuiInductionMatrix extends GuiMekanismTile<TileEntityInductionCasin
|
||||
}
|
||||
|
||||
mc.renderEngine.bindTexture(MekanismRenderer.getBlocksTexture());
|
||||
drawTexturedModalRect(guiWidth + xPos, guiHeight + yPos + 58 - renderRemaining - start,
|
||||
MekanismRenderer.energyIcon, 16, 16 - (16 - renderRemaining));
|
||||
drawTexturedModalRect(guiWidth + xPos, guiHeight + yPos + 58 - renderRemaining - start, MekanismRenderer.energyIcon, 16, renderRemaining);
|
||||
start += 16;
|
||||
|
||||
if (renderRemaining == 0 || scale == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mc.renderEngine.bindTexture(getGuiLocation());
|
||||
drawTexturedModalRect(guiWidth + xPos, guiHeight + yPos, 176, side == 0 ? 0 : 54, 16, 54);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package mekanism.client.gui;
|
||||
|
||||
import java.io.IOException;
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.TileNetworkList;
|
||||
import mekanism.client.gui.element.GuiAmplifierTab;
|
||||
import mekanism.client.gui.element.GuiGauge.Type;
|
||||
import mekanism.client.gui.element.GuiNumberGauge;
|
||||
@@ -10,7 +11,6 @@ import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSecurityTab;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.api.TileNetworkList;
|
||||
import mekanism.common.inventory.container.ContainerLaserAmplifier;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.tile.TileEntityLaserAmplifier;
|
||||
@@ -54,8 +54,7 @@ public class GuiLaserAmplifier extends GuiMekanismTile<TileEntityLaserAmplifier>
|
||||
|
||||
@Override
|
||||
public String getText(double level) {
|
||||
return LangUtils.localize("gui.storing") + ": " + MekanismUtils
|
||||
.getEnergyDisplay(level, tileEntity.getMaxEnergy());
|
||||
return LangUtils.localize("gui.storing") + ": " + MekanismUtils.getEnergyDisplay(level, tileEntity.getMaxEnergy());
|
||||
}
|
||||
}, Type.STANDARD, this, resource, 6, 10));
|
||||
addGuiElement(new GuiSecurityTab(this, tileEntity, resource));
|
||||
@@ -68,13 +67,9 @@ public class GuiLaserAmplifier extends GuiMekanismTile<TileEntityLaserAmplifier>
|
||||
fontRenderer.drawString(tileEntity.getName(), 55, 6, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||
fontRenderer.drawString(tileEntity.time > 0 ? LangUtils.localize("gui.delay") + ": " + tileEntity.time + "t"
|
||||
: LangUtils.localize("gui.noDelay"), 26, 30, 0x404040);
|
||||
fontRenderer.drawString(
|
||||
LangUtils.localize("gui.min") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.minThreshold), 26, 45,
|
||||
0x404040);
|
||||
fontRenderer.drawString(
|
||||
LangUtils.localize("gui.max") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.maxThreshold), 26, 60,
|
||||
0x404040);
|
||||
: LangUtils.localize("gui.noDelay"), 26, 30, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.min") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.minThreshold), 26, 45, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.max") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.maxThreshold), 26, 60, 0x404040);
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@@ -96,7 +91,6 @@ public class GuiLaserAmplifier extends GuiMekanismTile<TileEntityLaserAmplifier>
|
||||
@Override
|
||||
public void updateScreen() {
|
||||
super.updateScreen();
|
||||
|
||||
minField.updateCursorCounter();
|
||||
maxField.updateCursorCounter();
|
||||
timerField.updateCursorCounter();
|
||||
@@ -105,7 +99,6 @@ public class GuiLaserAmplifier extends GuiMekanismTile<TileEntityLaserAmplifier>
|
||||
@Override
|
||||
public void mouseClicked(int mouseX, int mouseY, int button) throws IOException {
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
|
||||
minField.mouseClicked(mouseX, mouseY, button);
|
||||
maxField.mouseClicked(mouseX, mouseY, button);
|
||||
timerField.mouseClicked(mouseX, mouseY, button);
|
||||
@@ -137,7 +130,7 @@ public class GuiLaserAmplifier extends GuiMekanismTile<TileEntityLaserAmplifier>
|
||||
if (Character.isDigit(c) || c == '.' || c == 'E' || isTextboxKey(c, i)) {
|
||||
minField.textboxKeyTyped(c, i);
|
||||
maxField.textboxKeyTyped(c, i);
|
||||
if(c != '.' && c != 'E') {
|
||||
if (c != '.' && c != 'E') {
|
||||
timerField.textboxKeyTyped(c, i);
|
||||
}
|
||||
}
|
||||
@@ -146,18 +139,14 @@ public class GuiLaserAmplifier extends GuiMekanismTile<TileEntityLaserAmplifier>
|
||||
private void setMinThreshold() {
|
||||
if (!minField.getText().isEmpty()) {
|
||||
double toUse;
|
||||
|
||||
try {
|
||||
toUse = Math.max(0, Double.parseDouble(minField.getText()));
|
||||
} catch (Exception e) {
|
||||
minField.setText("");
|
||||
return;
|
||||
}
|
||||
|
||||
TileNetworkList data = TileNetworkList.withContents(0, toUse);
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
|
||||
minField.setText("");
|
||||
}
|
||||
}
|
||||
@@ -165,18 +154,14 @@ public class GuiLaserAmplifier extends GuiMekanismTile<TileEntityLaserAmplifier>
|
||||
private void setMaxThreshold() {
|
||||
if (!maxField.getText().isEmpty()) {
|
||||
double toUse;
|
||||
|
||||
try {
|
||||
toUse = Math.max(0, Double.parseDouble(maxField.getText()));
|
||||
} catch (Exception e) {
|
||||
maxField.setText("");
|
||||
return;
|
||||
}
|
||||
|
||||
TileNetworkList data = TileNetworkList.withContents(1, toUse);
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
|
||||
maxField.setText("");
|
||||
}
|
||||
}
|
||||
@@ -184,11 +169,8 @@ public class GuiLaserAmplifier extends GuiMekanismTile<TileEntityLaserAmplifier>
|
||||
private void setTime() {
|
||||
if (!timerField.getText().isEmpty()) {
|
||||
int toUse = Math.max(0, Integer.parseInt(timerField.getText()));
|
||||
|
||||
TileNetworkList data = TileNetworkList.withContents(2, toUse);
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
|
||||
timerField.setText("");
|
||||
}
|
||||
}
|
||||
@@ -196,12 +178,10 @@ public class GuiLaserAmplifier extends GuiMekanismTile<TileEntityLaserAmplifier>
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
|
||||
String prevTime = timerField != null ? timerField.getText() : "";
|
||||
|
||||
timerField = new GuiTextField(0, fontRenderer, guiWidth + 96, guiHeight + 28, 36, 11);
|
||||
timerField.setMaxStringLength(4);
|
||||
timerField.setText(prevTime);
|
||||
@@ -212,7 +192,6 @@ public class GuiLaserAmplifier extends GuiMekanismTile<TileEntityLaserAmplifier>
|
||||
minField.setText(prevMin);
|
||||
|
||||
String prevMax = maxField != null ? maxField.getText() : "";
|
||||
|
||||
maxField = new GuiTextField(2, fontRenderer, guiWidth + 96, guiHeight + 58, 72, 11);
|
||||
maxField.setMaxStringLength(10);
|
||||
maxField.setText(prevMax);
|
||||
|
||||
@@ -22,9 +22,7 @@ public class GuiLaserTractorBeam extends GuiMekanismTile<TileEntityLaserTractorB
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
fontRenderer
|
||||
.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2),
|
||||
6, 0x404040);
|
||||
fontRenderer.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2), 6, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.TileNetworkList;
|
||||
import mekanism.client.gui.element.GuiRedstoneControl;
|
||||
import mekanism.client.gui.element.GuiSecurityTab;
|
||||
import mekanism.client.gui.element.GuiUpgradeTab;
|
||||
@@ -16,7 +17,6 @@ import mekanism.client.sound.SoundHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.MekanismSounds;
|
||||
import mekanism.common.OreDictCache;
|
||||
import mekanism.api.TileNetworkList;
|
||||
import mekanism.common.content.transporter.TItemStackFilter;
|
||||
import mekanism.common.content.transporter.TMaterialFilter;
|
||||
import mekanism.common.content.transporter.TModIDFilter;
|
||||
@@ -101,7 +101,6 @@ public class GuiLogisticalSorter extends GuiMekanismTile<TileEntityLogisticalSor
|
||||
final int scrollSize = tileEntity.filters.size() - 4;
|
||||
return (int) ((scrollSize + 0.5) * scroll);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -119,11 +118,9 @@ public class GuiLogisticalSorter extends GuiMekanismTile<TileEntityLogisticalSor
|
||||
for (final Map.Entry<TOreDictFilter, StackData> entry : oreDictStacks.entrySet()) {
|
||||
setNextRenderStack(entry.getValue());
|
||||
}
|
||||
|
||||
for (final Map.Entry<TModIDFilter, StackData> entry : modIDStacks.entrySet()) {
|
||||
setNextRenderStack(entry.getValue());
|
||||
}
|
||||
|
||||
stackSwitch = 20;
|
||||
} else {
|
||||
for (final Map.Entry<TOreDictFilter, StackData> entry : oreDictStacks.entrySet()) {
|
||||
@@ -131,7 +128,6 @@ public class GuiLogisticalSorter extends GuiMekanismTile<TileEntityLogisticalSor
|
||||
entry.getValue().renderStack = ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
for (final Map.Entry<TModIDFilter, StackData> entry : modIDStacks.entrySet()) {
|
||||
if (entry.getValue().iterStacks != null && entry.getValue().iterStacks.size() == 0) {
|
||||
entry.getValue().renderStack = ItemStack.EMPTY;
|
||||
@@ -162,12 +158,11 @@ public class GuiLogisticalSorter extends GuiMekanismTile<TileEntityLogisticalSor
|
||||
private void setNextRenderStack(StackData value) {
|
||||
if (value.iterStacks != null && value.iterStacks.size() > 0) {
|
||||
if (value.stackIndex == -1
|
||||
|| value.stackIndex == value.iterStacks.size() - 1) {
|
||||
|| value.stackIndex == value.iterStacks.size() - 1) {
|
||||
value.stackIndex = 0;
|
||||
} else if (value.stackIndex < value.iterStacks.size() - 1) {
|
||||
value.stackIndex++;
|
||||
}
|
||||
|
||||
value.renderStack = value.iterStacks.get(value.stackIndex);
|
||||
}
|
||||
}
|
||||
@@ -195,61 +190,48 @@ public class GuiLogisticalSorter extends GuiMekanismTile<TileEntityLogisticalSor
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (tileEntity.filters.get(getFilterIndex() + i) != null) {
|
||||
final int yStart = i * 29 + 18;
|
||||
|
||||
if (xAxis >= 56 && xAxis <= 152 && yAxis >= yStart && yAxis <= yStart + 29) {
|
||||
// Check for sorting button
|
||||
final int arrowX = filterX + filterW - 12;
|
||||
|
||||
if (getFilterIndex() + i > 0) {
|
||||
if (xAxis >= arrowX && xAxis <= arrowX + 10 && yAxis >= yStart + 14
|
||||
&& yAxis <= yStart + 20) {
|
||||
&& yAxis <= yStart + 20) {
|
||||
// Process up button click
|
||||
final TileNetworkList data = TileNetworkList.withContents(3, getFilterIndex() + i);
|
||||
|
||||
Mekanism.packetHandler
|
||||
.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (getFilterIndex() + i < tileEntity.filters.size() - 1) {
|
||||
if (xAxis >= arrowX && xAxis <= arrowX + 10 && yAxis >= yStart + 21
|
||||
&& yAxis <= yStart + 27) {
|
||||
&& yAxis <= yStart + 27) {
|
||||
// Process down button click
|
||||
final TileNetworkList data = TileNetworkList.withContents(4, getFilterIndex() + i);
|
||||
|
||||
Mekanism.packetHandler
|
||||
.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
final TransporterFilter filter = tileEntity.filters.get(getFilterIndex() + i);
|
||||
|
||||
if (filter instanceof TItemStackFilter) {
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
Mekanism.packetHandler.sendToServer(
|
||||
new LogisticalSorterGuiMessage(SorterGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity),
|
||||
1, getFilterIndex() + i, 0));
|
||||
new LogisticalSorterGuiMessage(SorterGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 1, getFilterIndex() + i, 0));
|
||||
} else if (filter instanceof TOreDictFilter) {
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
Mekanism.packetHandler.sendToServer(
|
||||
new LogisticalSorterGuiMessage(SorterGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity),
|
||||
2, getFilterIndex() + i, 0));
|
||||
new LogisticalSorterGuiMessage(SorterGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 2, getFilterIndex() + i, 0));
|
||||
} else if (filter instanceof TMaterialFilter) {
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
Mekanism.packetHandler.sendToServer(
|
||||
new LogisticalSorterGuiMessage(SorterGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity),
|
||||
3, getFilterIndex() + i, 0));
|
||||
new LogisticalSorterGuiMessage(SorterGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 3, getFilterIndex() + i, 0));
|
||||
} else if (filter instanceof TModIDFilter) {
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
Mekanism.packetHandler.sendToServer(
|
||||
new LogisticalSorterGuiMessage(SorterGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity),
|
||||
5, getFilterIndex() + i, 0));
|
||||
new LogisticalSorterGuiMessage(SorterGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 5, getFilterIndex() + i, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -258,7 +240,6 @@ public class GuiLogisticalSorter extends GuiMekanismTile<TileEntityLogisticalSor
|
||||
// Check for auto eject button
|
||||
if (xAxis >= 12 && xAxis <= 26 && yAxis >= 110 && yAxis <= 124) {
|
||||
final TileNetworkList data = TileNetworkList.withContents(1);
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
}
|
||||
@@ -266,7 +247,6 @@ public class GuiLogisticalSorter extends GuiMekanismTile<TileEntityLogisticalSor
|
||||
// Check for round robin button
|
||||
if (xAxis >= 12 && xAxis <= 26 && yAxis >= 84 && yAxis <= 98) {
|
||||
final TileNetworkList data = TileNetworkList.withContents(2);
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
}
|
||||
@@ -274,7 +254,6 @@ public class GuiLogisticalSorter extends GuiMekanismTile<TileEntityLogisticalSor
|
||||
// Check for single item button
|
||||
if (xAxis >= 12 && xAxis <= 26 && yAxis >= 58 && yAxis <= 72) {
|
||||
final TileNetworkList data = TileNetworkList.withContents(5);
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
}
|
||||
@@ -287,7 +266,6 @@ public class GuiLogisticalSorter extends GuiMekanismTile<TileEntityLogisticalSor
|
||||
// Check for default colour button
|
||||
if (xAxis >= 13 && xAxis <= 29 && yAxis >= 137 && yAxis <= 153) {
|
||||
final TileNetworkList data = TileNetworkList.withContents(0, mouseBtn);
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
SoundHandler.playSound(MekanismSounds.DING);
|
||||
}
|
||||
@@ -306,7 +284,6 @@ public class GuiLogisticalSorter extends GuiMekanismTile<TileEntityLogisticalSor
|
||||
@Override
|
||||
protected void mouseReleased(int mouseX, int mouseY, int type) {
|
||||
super.mouseReleased(mouseX, mouseY, type);
|
||||
|
||||
if (type == 0 && isDragging) {
|
||||
dragOffset = 0;
|
||||
isDragging = false;
|
||||
@@ -319,26 +296,19 @@ public class GuiLogisticalSorter extends GuiMekanismTile<TileEntityLogisticalSor
|
||||
@Override
|
||||
public void handleMouseInput() throws IOException {
|
||||
super.handleMouseInput();
|
||||
|
||||
int i = Mouse.getEventDWheel();
|
||||
|
||||
if (i != 0 && needsScrollBars()) {
|
||||
final int j = tileEntity.filters.size() - 4;
|
||||
|
||||
if (i > 0) {
|
||||
i = 1;
|
||||
}
|
||||
|
||||
if (i < 0) {
|
||||
i = -1;
|
||||
}
|
||||
|
||||
scroll = (float) (scroll - (double) i / (double) j);
|
||||
|
||||
if (scroll < 0.0F) {
|
||||
scroll = 0.0F;
|
||||
}
|
||||
|
||||
if (scroll > 1.0F) {
|
||||
scroll = 1.0F;
|
||||
}
|
||||
@@ -356,17 +326,14 @@ public class GuiLogisticalSorter extends GuiMekanismTile<TileEntityLogisticalSor
|
||||
|
||||
// Add buttons to gui
|
||||
buttonList.clear();
|
||||
buttonList
|
||||
.add(new GuiButton(BUTTON_NEW, guiLeft + 56, guiTop + 136, 96, 20, LangUtils.localize("gui.newFilter")));
|
||||
buttonList.add(new GuiButton(BUTTON_NEW, guiLeft + 56, guiTop + 136, 96, 20, LangUtils.localize("gui.newFilter")));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton) throws IOException {
|
||||
super.actionPerformed(guibutton);
|
||||
|
||||
if (guibutton.id == BUTTON_NEW) {
|
||||
Mekanism.packetHandler.sendToServer(
|
||||
new LogisticalSorterGuiMessage(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), 4, 0, 0));
|
||||
Mekanism.packetHandler.sendToServer(new LogisticalSorterGuiMessage(SorterGuiPacket.SERVER, Coord4D.get(tileEntity), 4, 0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -378,19 +345,14 @@ public class GuiLogisticalSorter extends GuiMekanismTile<TileEntityLogisticalSor
|
||||
|
||||
// Write to info display
|
||||
fontRenderer.drawString(tileEntity.getName(), 43, 6, 0x404040);
|
||||
|
||||
fontRenderer.drawString(LangUtils.localize("gui.filters") + ":", 11, 19, 0x00CD00);
|
||||
fontRenderer.drawString("T: " + tileEntity.filters.size(), 11, 28, 0x00CD00);
|
||||
|
||||
fontRenderer.drawString(LangUtils.localize("mekanism.gui.logisticalSorter.singleItem") + ":", 12, 48, 0x00CD00);
|
||||
fontRenderer.drawString(LangUtils.transOnOff(tileEntity.singleItem), 27, 60, 0x00CD00);
|
||||
|
||||
fontRenderer.drawString(LangUtils.localize("mekanism.gui.logisticalSorter.roundRobin") + ":", 12, 74, 0x00CD00);
|
||||
fontRenderer.drawString(LangUtils.transOnOff(tileEntity.roundRobin), 27, 86, 0x00CD00);
|
||||
|
||||
fontRenderer.drawString(LangUtils.localize("mekanism.gui.logisticalSorter.autoEject") + ":", 12, 100, 0x00CD00);
|
||||
fontRenderer.drawString(LangUtils.transOnOff(tileEntity.autoEject), 27, 112, 0x00CD00);
|
||||
|
||||
fontRenderer.drawString(LangUtils.localize("mekanism.gui.logisticalSorter.default") + ":", 12, 126, 0x00CD00);
|
||||
|
||||
// Draw filters
|
||||
@@ -398,7 +360,6 @@ public class GuiLogisticalSorter extends GuiMekanismTile<TileEntityLogisticalSor
|
||||
if (tileEntity.filters.get(getFilterIndex() + i) != null) {
|
||||
final TransporterFilter filter = tileEntity.filters.get(getFilterIndex() + i);
|
||||
final int yStart = i * filterH + filterY;
|
||||
|
||||
if (filter instanceof TItemStackFilter) {
|
||||
final TItemStackFilter itemFilter = (TItemStackFilter) filter;
|
||||
|
||||
@@ -411,18 +372,14 @@ public class GuiLogisticalSorter extends GuiMekanismTile<TileEntityLogisticalSor
|
||||
}
|
||||
|
||||
fontRenderer.drawString(LangUtils.localize("gui.itemFilter"), 78, yStart + 2, 0x404040);
|
||||
fontRenderer.drawString(
|
||||
filter.color != null ? filter.color.getColoredName() : LangUtils.localize("gui.none"), 78,
|
||||
yStart + 11, 0x404040);
|
||||
fontRenderer.drawString(filter.color != null ? filter.color.getColoredName() : LangUtils.localize("gui.none"), 78, yStart + 11, 0x404040);
|
||||
} else if (filter instanceof TOreDictFilter) {
|
||||
final TOreDictFilter oreFilter = (TOreDictFilter) filter;
|
||||
|
||||
if (!oreDictStacks.containsKey(oreFilter)) {
|
||||
updateStackList(oreFilter);
|
||||
}
|
||||
|
||||
ItemStack renderStack = oreDictStacks.get(filter).renderStack;
|
||||
|
||||
if (!renderStack.isEmpty()) {
|
||||
try {
|
||||
GlStateManager.pushMatrix();
|
||||
@@ -435,12 +392,9 @@ public class GuiLogisticalSorter extends GuiMekanismTile<TileEntityLogisticalSor
|
||||
}
|
||||
|
||||
fontRenderer.drawString(LangUtils.localize("gui.oredictFilter"), 78, yStart + 2, 0x404040);
|
||||
fontRenderer.drawString(
|
||||
filter.color != null ? filter.color.getColoredName() : LangUtils.localize("gui.none"), 78,
|
||||
yStart + 11, 0x404040);
|
||||
fontRenderer.drawString(filter.color != null ? filter.color.getColoredName() : LangUtils.localize("gui.none"), 78, yStart + 11, 0x404040);
|
||||
} else if (filter instanceof TMaterialFilter) {
|
||||
final TMaterialFilter itemFilter = (TMaterialFilter) filter;
|
||||
|
||||
if (!itemFilter.getMaterialItem().isEmpty()) {
|
||||
GlStateManager.pushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
@@ -450,9 +404,7 @@ public class GuiLogisticalSorter extends GuiMekanismTile<TileEntityLogisticalSor
|
||||
}
|
||||
|
||||
fontRenderer.drawString(LangUtils.localize("gui.materialFilter"), 78, yStart + 2, 0x404040);
|
||||
fontRenderer.drawString(
|
||||
filter.color != null ? filter.color.getColoredName() : LangUtils.localize("gui.none"), 78,
|
||||
yStart + 11, 0x404040);
|
||||
fontRenderer.drawString(filter.color != null ? filter.color.getColoredName() : LangUtils.localize("gui.none"), 78, yStart + 11, 0x404040);
|
||||
} else if (filter instanceof TModIDFilter) {
|
||||
final TModIDFilter modFilter = (TModIDFilter) filter;
|
||||
|
||||
@@ -474,9 +426,7 @@ public class GuiLogisticalSorter extends GuiMekanismTile<TileEntityLogisticalSor
|
||||
}
|
||||
|
||||
fontRenderer.drawString(LangUtils.localize("gui.modIDFilter"), 78, yStart + 2, 0x404040);
|
||||
fontRenderer.drawString(
|
||||
filter.color != null ? filter.color.getColoredName() : LangUtils.localize("gui.none"), 78,
|
||||
yStart + 11, 0x404040);
|
||||
fontRenderer.drawString(filter.color != null ? filter.color.getColoredName() : LangUtils.localize("gui.none"), 78, yStart + 11, 0x404040);
|
||||
}
|
||||
|
||||
// Draw hovertext for sorting buttons
|
||||
@@ -487,7 +437,6 @@ public class GuiLogisticalSorter extends GuiMekanismTile<TileEntityLogisticalSor
|
||||
drawHoveringText(LangUtils.localize("gui.moveUp"), xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
|
||||
if (getFilterIndex() + i < tileEntity.filters.size() - 1) {
|
||||
if (xAxis >= arrowX && xAxis <= arrowX + 10 && yAxis >= yStart + 21 && yAxis <= yStart + 27) {
|
||||
drawHoveringText(LangUtils.localize("gui.moveDown"), xAxis, yAxis);
|
||||
@@ -519,24 +468,15 @@ public class GuiLogisticalSorter extends GuiMekanismTile<TileEntityLogisticalSor
|
||||
}
|
||||
|
||||
if (xAxis >= 12 && xAxis <= 26 && yAxis >= 110 && yAxis <= 124) {
|
||||
drawHoveringText(
|
||||
MekanismUtils.splitTooltip(
|
||||
LangUtils.localize("mekanism.gui.logisticalSorter.autoEject.tooltip"), ItemStack.EMPTY
|
||||
), xAxis, yAxis);
|
||||
drawHoveringText(MekanismUtils.splitTooltip(LangUtils.localize("mekanism.gui.logisticalSorter.autoEject.tooltip"), ItemStack.EMPTY), xAxis, yAxis);
|
||||
}
|
||||
|
||||
if (xAxis >= 12 && xAxis <= 26 && yAxis >= 84 && yAxis <= 98) {
|
||||
drawHoveringText(
|
||||
MekanismUtils.splitTooltip(
|
||||
LangUtils.localize("mekanism.gui.logisticalSorter.roundRobin.tooltip"), ItemStack.EMPTY
|
||||
), xAxis, yAxis);
|
||||
drawHoveringText(MekanismUtils.splitTooltip(LangUtils.localize("mekanism.gui.logisticalSorter.roundRobin.tooltip"), ItemStack.EMPTY), xAxis, yAxis);
|
||||
}
|
||||
|
||||
if (xAxis >= 12 && xAxis <= 26 && yAxis >= 58 && yAxis <= 72) {
|
||||
drawHoveringText(
|
||||
MekanismUtils.splitTooltip(
|
||||
LangUtils.localize("mekanism.gui.logisticalSorter.singleItem.tooltip"), ItemStack.EMPTY
|
||||
), xAxis, yAxis);
|
||||
drawHoveringText(MekanismUtils.splitTooltip(LangUtils.localize("mekanism.gui.logisticalSorter.singleItem.tooltip"), ItemStack.EMPTY), xAxis, yAxis);
|
||||
}
|
||||
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
@@ -552,8 +492,7 @@ public class GuiLogisticalSorter extends GuiMekanismTile<TileEntityLogisticalSor
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
// Draw scrollbar
|
||||
drawTexturedModalRect(guiLeft + scrollX, guiTop + scrollY + getScroll(), 232 + (needsScrollBars() ? 0 : 12), 0,
|
||||
12, 15);
|
||||
drawTexturedModalRect(guiLeft + scrollX, guiTop + scrollY + getScroll(), 232 + (needsScrollBars() ? 0 : 12), 0, 12, 15);
|
||||
|
||||
// Get mouse position relative to gui
|
||||
final int xAxis = mouseX - guiLeft;
|
||||
@@ -566,8 +505,7 @@ public class GuiLogisticalSorter extends GuiMekanismTile<TileEntityLogisticalSor
|
||||
final int yStart = i * filterH + filterY;
|
||||
|
||||
// Flag for mouse over this filter
|
||||
boolean mouseOver =
|
||||
xAxis >= filterX && xAxis <= filterX + filterW && yAxis >= yStart && yAxis <= yStart + filterH;
|
||||
boolean mouseOver = xAxis >= filterX && xAxis <= filterX + filterW && yAxis >= yStart && yAxis <= yStart + filterH;
|
||||
|
||||
// Change colour based on filter type
|
||||
if (filter instanceof TItemStackFilter) {
|
||||
|
||||
@@ -29,8 +29,7 @@ public class GuiMatrixStats extends GuiMekanismTile<TileEntityInductionCasing> {
|
||||
addGuiElement(new GuiRateBar(this, new IRateInfoHandler() {
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return LangUtils.localize("gui.receiving") + ": " + MekanismUtils
|
||||
.getEnergyDisplay(tileEntity.structure.lastInput) + "/t";
|
||||
return LangUtils.localize("gui.receiving") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.structure.lastInput) + "/t";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -41,8 +40,7 @@ public class GuiMatrixStats extends GuiMekanismTile<TileEntityInductionCasing> {
|
||||
addGuiElement(new GuiRateBar(this, new IRateInfoHandler() {
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return LangUtils.localize("gui.outputting") + ": " + MekanismUtils
|
||||
.getEnergyDisplay(tileEntity.structure.lastOutput) + "/t";
|
||||
return LangUtils.localize("gui.outputting") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.structure.lastOutput) + "/t";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -51,12 +49,9 @@ public class GuiMatrixStats extends GuiMekanismTile<TileEntityInductionCasing> {
|
||||
}
|
||||
}, resource, 38, 13));
|
||||
addGuiElement(new GuiEnergyInfo(() -> Arrays.asList(
|
||||
LangUtils.localize("gui.storing") + ": " + MekanismUtils
|
||||
.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()),
|
||||
LangUtils.localize("gui.input") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.structure.lastInput)
|
||||
+ "/t",
|
||||
LangUtils.localize("gui.output") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.structure.lastOutput)
|
||||
+ "/t"), this, resource));
|
||||
LangUtils.localize("gui.storing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()),
|
||||
LangUtils.localize("gui.input") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.structure.lastInput) + "/t",
|
||||
LangUtils.localize("gui.output") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.structure.lastOutput) + "/t"), this, resource));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,18 +59,16 @@ public class GuiMatrixStats extends GuiMekanismTile<TileEntityInductionCasing> {
|
||||
String stats = LangUtils.localize("gui.matrixStats");
|
||||
fontRenderer.drawString(stats, (xSize / 2) - (fontRenderer.getStringWidth(stats) / 2), 6, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.input") + ":", 53, 26, 0x797979);
|
||||
fontRenderer.drawString(MekanismUtils.getEnergyDisplay(tileEntity.structure.lastInput) + "/" + MekanismUtils
|
||||
.getEnergyDisplay(tileEntity.structure.transferCap), 59, 35, 0x404040);
|
||||
fontRenderer.drawString(MekanismUtils.getEnergyDisplay(tileEntity.structure.lastInput) + "/" +
|
||||
MekanismUtils.getEnergyDisplay(tileEntity.structure.transferCap), 59, 35, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.output") + ":", 53, 46, 0x797979);
|
||||
fontRenderer.drawString(MekanismUtils.getEnergyDisplay(tileEntity.structure.lastOutput) + "/" + MekanismUtils
|
||||
.getEnergyDisplay(tileEntity.structure.transferCap), 59, 55, 0x404040);
|
||||
fontRenderer.drawString(MekanismUtils.getEnergyDisplay(tileEntity.structure.lastOutput) + "/" +
|
||||
MekanismUtils.getEnergyDisplay(tileEntity.structure.transferCap), 59, 55, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.dimensions") + ":", 8, 82, 0x797979);
|
||||
fontRenderer.drawString(tileEntity.structure.volWidth + " x " + tileEntity.structure.volHeight + " x "
|
||||
+ tileEntity.structure.volLength, 14, 91, 0x404040);
|
||||
fontRenderer.drawString(tileEntity.structure.volWidth + " x " + tileEntity.structure.volHeight + " x " + tileEntity.structure.volLength, 14, 91, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.constituents") + ":", 8, 102, 0x797979);
|
||||
fontRenderer.drawString(tileEntity.clientCells + " " + LangUtils.localize("gui.cells"), 14, 111, 0x404040);
|
||||
fontRenderer
|
||||
.drawString(tileEntity.clientProviders + " " + LangUtils.localize("gui.providers"), 14, 120, 0x404040);
|
||||
fontRenderer.drawString(tileEntity.clientProviders + " " + LangUtils.localize("gui.providers"), 14, 120, 0x404040);
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,9 +27,8 @@ public abstract class GuiMekanism extends GuiContainer implements IGuiWrapper {
|
||||
}
|
||||
|
||||
public static boolean isTextboxKey(char c, int i) {
|
||||
return i == Keyboard.KEY_BACK || i == Keyboard.KEY_DELETE || i == Keyboard.KEY_LEFT || i == Keyboard.KEY_RIGHT
|
||||
|| i == Keyboard.KEY_END || i == Keyboard.KEY_HOME || isKeyComboCtrlA(i) || isKeyComboCtrlC(i)
|
||||
|| isKeyComboCtrlV(i) || isKeyComboCtrlX(i);
|
||||
return i == Keyboard.KEY_BACK || i == Keyboard.KEY_DELETE || i == Keyboard.KEY_LEFT || i == Keyboard.KEY_RIGHT || i == Keyboard.KEY_END ||
|
||||
i == Keyboard.KEY_HOME || isKeyComboCtrlA(i) || isKeyComboCtrlC(i) || isKeyComboCtrlV(i) || isKeyComboCtrlX(i);
|
||||
}
|
||||
|
||||
public Set<GuiElement> getGuiElements() {
|
||||
@@ -50,14 +49,12 @@ public abstract class GuiMekanism extends GuiContainer implements IGuiWrapper {
|
||||
*/
|
||||
public void renderScaledText(String text, int x, int y, int color, int maxX) {
|
||||
int length = fontRenderer.getStringWidth(text);
|
||||
|
||||
if (length <= maxX) {
|
||||
fontRenderer.drawString(text, x, y, color);
|
||||
} else {
|
||||
float scale = (float) maxX / length;
|
||||
float reverse = 1 / scale;
|
||||
float yAdd = 4 - (scale * 8) / 2F;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.scale(scale, scale, scale);
|
||||
fontRenderer.drawString(text, (int) (x * reverse), (int) ((y * reverse) + yAdd), color);
|
||||
@@ -68,8 +65,8 @@ public abstract class GuiMekanism extends GuiContainer implements IGuiWrapper {
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
guiElements.forEach(element -> element.renderForeground(xAxis, yAxis));
|
||||
}
|
||||
|
||||
@@ -88,8 +85,8 @@ public abstract class GuiMekanism extends GuiContainer implements IGuiWrapper {
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int button) throws IOException {
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
guiElements.forEach(element -> element.preMouseClicked(xAxis, yAxis, button));
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
guiElements.forEach(element -> element.mouseClicked(xAxis, yAxis, button));
|
||||
@@ -123,16 +120,16 @@ public abstract class GuiMekanism extends GuiContainer implements IGuiWrapper {
|
||||
@Override
|
||||
protected void mouseClickMove(int mouseX, int mouseY, int button, long ticks) {
|
||||
super.mouseClickMove(mouseX, mouseY, button, ticks);
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
guiElements.forEach(element -> element.mouseClickMove(xAxis, yAxis, button, ticks));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseReleased(int mouseX, int mouseY, int type) {
|
||||
super.mouseReleased(mouseX, mouseY, type);
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
guiElements.forEach(element -> element.mouseReleased(xAxis, yAxis, type));
|
||||
}
|
||||
|
||||
@@ -172,7 +169,7 @@ public abstract class GuiMekanism extends GuiContainer implements IGuiWrapper {
|
||||
|
||||
protected void renderCenteredText(int leftMargin, int areaWidth, int y, int color, String text) {
|
||||
int textWidth = fontRenderer.getStringWidth(text);
|
||||
int centerX = leftMargin + (areaWidth/2) - (textWidth/2);
|
||||
int centerX = leftMargin + (areaWidth / 2) - (textWidth / 2);
|
||||
fontRenderer.drawString(text, centerX, y, color);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,18 +24,12 @@ public class GuiMekanismConfig extends GuiConfig {
|
||||
|
||||
private static List<IConfigElement> getConfigElements() {
|
||||
List<IConfigElement> list = new ArrayList<>();
|
||||
list.add(new DummyCategoryElement(LangUtils.localize("mekanism.configgui.ctgy.general"),
|
||||
"mekanism.configgui.ctgy.general", GeneralEntry.class));
|
||||
list.add(new DummyCategoryElement(LangUtils.localize("mekanism.configgui.ctgy.machines"),
|
||||
"mekanism.configgui.ctgy.machines", MachinesEntry.class));
|
||||
list.add(new DummyCategoryElement(LangUtils.localize("mekanism.configgui.ctgy.tier"),
|
||||
"mekanism.configgui.ctgy.tier", TierEntry.class));
|
||||
list.add(new DummyCategoryElement(LangUtils.localize("mekanism.configgui.ctgy.usage"),
|
||||
"mekanism.configgui.ctgy.usage", UsageEntry.class));
|
||||
list.add(new DummyCategoryElement(LangUtils.localize("mekanism.configgui.ctgy.storage"),
|
||||
"mekanism.configgui.ctgy.storage", StorageEntry.class));
|
||||
list.add(new DummyCategoryElement(LangUtils.localize("mekanism.configgui.ctgy.client"),
|
||||
"mekanism.configgui.ctgy.client", ClientEntry.class));
|
||||
list.add(new DummyCategoryElement(LangUtils.localize("mekanism.configgui.ctgy.general"), "mekanism.configgui.ctgy.general", GeneralEntry.class));
|
||||
list.add(new DummyCategoryElement(LangUtils.localize("mekanism.configgui.ctgy.machines"), "mekanism.configgui.ctgy.machines", MachinesEntry.class));
|
||||
list.add(new DummyCategoryElement(LangUtils.localize("mekanism.configgui.ctgy.tier"), "mekanism.configgui.ctgy.tier", TierEntry.class));
|
||||
list.add(new DummyCategoryElement(LangUtils.localize("mekanism.configgui.ctgy.usage"), "mekanism.configgui.ctgy.usage", UsageEntry.class));
|
||||
list.add(new DummyCategoryElement(LangUtils.localize("mekanism.configgui.ctgy.storage"), "mekanism.configgui.ctgy.storage", StorageEntry.class));
|
||||
list.add(new DummyCategoryElement(LangUtils.localize("mekanism.configgui.ctgy.client"), "mekanism.configgui.ctgy.client", ClientEntry.class));
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -48,10 +42,8 @@ public class GuiMekanismConfig extends GuiConfig {
|
||||
@Override
|
||||
protected GuiScreen buildChildScreen() {
|
||||
return new GuiConfig(owningScreen,
|
||||
new ConfigElement(Mekanism.configuration.getCategory(Configuration.CATEGORY_GENERAL))
|
||||
.getChildElements(),
|
||||
owningScreen.modID, Configuration.CATEGORY_GENERAL, false, false,
|
||||
GuiConfig.getAbridgedConfigPath(Mekanism.configuration.toString()));
|
||||
new ConfigElement(Mekanism.configuration.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), owningScreen.modID,
|
||||
Configuration.CATEGORY_GENERAL, false, false, GuiConfig.getAbridgedConfigPath(Mekanism.configuration.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,10 +55,8 @@ public class GuiMekanismConfig extends GuiConfig {
|
||||
|
||||
@Override
|
||||
protected GuiScreen buildChildScreen() {
|
||||
return new GuiConfig(owningScreen,
|
||||
new ConfigElement(Mekanism.configuration.getCategory("machines")).getChildElements(),
|
||||
owningScreen.modID, Configuration.CATEGORY_GENERAL, false, false,
|
||||
GuiConfig.getAbridgedConfigPath(Mekanism.configuration.toString()));
|
||||
return new GuiConfig(owningScreen, new ConfigElement(Mekanism.configuration.getCategory("machines")).getChildElements(), owningScreen.modID,
|
||||
Configuration.CATEGORY_GENERAL, false, false, GuiConfig.getAbridgedConfigPath(Mekanism.configuration.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,10 +68,8 @@ public class GuiMekanismConfig extends GuiConfig {
|
||||
|
||||
@Override
|
||||
protected GuiScreen buildChildScreen() {
|
||||
return new GuiConfig(owningScreen,
|
||||
new ConfigElement(Mekanism.configuration.getCategory("tier")).getChildElements(),
|
||||
owningScreen.modID, Configuration.CATEGORY_GENERAL, false, false,
|
||||
GuiConfig.getAbridgedConfigPath(Mekanism.configuration.toString()));
|
||||
return new GuiConfig(owningScreen, new ConfigElement(Mekanism.configuration.getCategory("tier")).getChildElements(), owningScreen.modID,
|
||||
Configuration.CATEGORY_GENERAL, false, false, GuiConfig.getAbridgedConfigPath(Mekanism.configuration.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,10 +81,8 @@ public class GuiMekanismConfig extends GuiConfig {
|
||||
|
||||
@Override
|
||||
protected GuiScreen buildChildScreen() {
|
||||
return new GuiConfig(owningScreen,
|
||||
new ConfigElement(Mekanism.configuration.getCategory("usage")).getChildElements(),
|
||||
owningScreen.modID, Configuration.CATEGORY_GENERAL, false, false,
|
||||
GuiConfig.getAbridgedConfigPath(Mekanism.configuration.toString()));
|
||||
return new GuiConfig(owningScreen, new ConfigElement(Mekanism.configuration.getCategory("usage")).getChildElements(), owningScreen.modID,
|
||||
Configuration.CATEGORY_GENERAL, false, false, GuiConfig.getAbridgedConfigPath(Mekanism.configuration.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,10 +94,8 @@ public class GuiMekanismConfig extends GuiConfig {
|
||||
|
||||
@Override
|
||||
protected GuiScreen buildChildScreen() {
|
||||
return new GuiConfig(owningScreen,
|
||||
new ConfigElement(Mekanism.configuration.getCategory("storage")).getChildElements(),
|
||||
owningScreen.modID, Configuration.CATEGORY_GENERAL, false, false,
|
||||
GuiConfig.getAbridgedConfigPath(Mekanism.configuration.toString()));
|
||||
return new GuiConfig(owningScreen, new ConfigElement(Mekanism.configuration.getCategory("storage")).getChildElements(), owningScreen.modID,
|
||||
Configuration.CATEGORY_GENERAL, false, false, GuiConfig.getAbridgedConfigPath(Mekanism.configuration.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,10 +107,8 @@ public class GuiMekanismConfig extends GuiConfig {
|
||||
|
||||
@Override
|
||||
protected GuiScreen buildChildScreen() {
|
||||
return new GuiConfig(owningScreen,
|
||||
new ConfigElement(Mekanism.configuration.getCategory("client")).getChildElements(),
|
||||
owningScreen.modID, "client", false, false,
|
||||
GuiConfig.getAbridgedConfigPath(Mekanism.configuration.toString()));
|
||||
return new GuiConfig(owningScreen, new ConfigElement(Mekanism.configuration.getCategory("client")).getChildElements(), owningScreen.modID,
|
||||
Configuration.CATEGORY_CLIENT, false, false, GuiConfig.getAbridgedConfigPath(Mekanism.configuration.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,8 +29,8 @@ public abstract class GuiMekanismTile<TILE extends TileEntityContainerBlock> ext
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
if (tileEntity instanceof ISideConfiguration) {
|
||||
Slot hovering = null;
|
||||
for (int i = 0; i < inventorySlots.inventorySlots.size(); i++) {
|
||||
@@ -45,8 +45,7 @@ public abstract class GuiMekanismTile<TILE extends TileEntityContainerBlock> ext
|
||||
if (!stack.isEmpty() && stack.getItem() instanceof ItemConfigurator && hovering != null) {
|
||||
SideData data = getFromSlot(hovering);
|
||||
if (data != null) {
|
||||
drawHoveringText(data.color + data.localize() + " (" + data.color.getColoredName() + ")", xAxis,
|
||||
yAxis);
|
||||
drawHoveringText(data.color + data.localize() + " (" + data.color.getColoredName() + ")", xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,7 +65,6 @@ public abstract class GuiMekanismTile<TILE extends TileEntityContainerBlock> ext
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package mekanism.client.gui;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.TileNetworkList;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo;
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiProgress;
|
||||
@@ -19,7 +20,6 @@ import mekanism.client.gui.element.GuiUpgradeTab;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.api.TileNetworkList;
|
||||
import mekanism.common.inventory.container.ContainerMetallurgicInfuser;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.tile.TileEntityMetallurgicInfuser;
|
||||
@@ -48,8 +48,7 @@ public class GuiMetallurgicInfuser extends GuiMekanismTile<TileEntityMetallurgic
|
||||
addGuiElement(new GuiEnergyInfo(() -> {
|
||||
String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.energyPerTick);
|
||||
return Arrays.asList(LangUtils.localize("gui.using") + ": " + multiplier + "/t",
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils
|
||||
.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
}, this, resource));
|
||||
addGuiElement(new GuiSlot(SlotType.EXTRA, this, resource, 16, 34));
|
||||
addGuiElement(new GuiSlot(SlotType.INPUT, this, resource, 50, 42));
|
||||
@@ -67,12 +66,11 @@ public class GuiMetallurgicInfuser extends GuiMekanismTile<TileEntityMetallurgic
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
fontRenderer.drawString(tileEntity.getName(), 45, 6, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
if (xAxis >= 7 && xAxis <= 11 && yAxis >= 17 && yAxis <= 69) {
|
||||
drawHoveringText(
|
||||
tileEntity.infuseStored.getType() != null ? tileEntity.infuseStored.getType().getLocalizedName() + ": "
|
||||
+ tileEntity.infuseStored.getAmount() : LangUtils.localize("gui.empty"), xAxis, yAxis);
|
||||
drawHoveringText(tileEntity.infuseStored.getType() != null ? tileEntity.infuseStored.getType().getLocalizedName() + ": " + tileEntity.infuseStored.getAmount()
|
||||
: LangUtils.localize("gui.empty"), xAxis, yAxis);
|
||||
}
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
@@ -87,8 +85,7 @@ public class GuiMetallurgicInfuser extends GuiMekanismTile<TileEntityMetallurgic
|
||||
if (tileEntity.infuseStored.getType() != null) {
|
||||
mc.renderEngine.bindTexture(MekanismRenderer.getBlocksTexture());
|
||||
int displayInt = tileEntity.getScaledInfuseLevel(52);
|
||||
drawTexturedRectFromIcon(guiWidth + 7, guiHeight + 17 + 52 - displayInt,
|
||||
tileEntity.infuseStored.getType().sprite, 4, displayInt);
|
||||
drawTexturedRectFromIcon(guiWidth + 7, guiHeight + 17 + 52 - displayInt, tileEntity.infuseStored.getType().sprite, 4, displayInt);
|
||||
}
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
}
|
||||
@@ -97,8 +94,8 @@ public class GuiMetallurgicInfuser extends GuiMekanismTile<TileEntityMetallurgic
|
||||
protected void mouseClicked(int x, int y, int button) throws IOException {
|
||||
super.mouseClicked(x, y, button);
|
||||
if (button == 0) {
|
||||
int xAxis = (x - (width - xSize) / 2);
|
||||
int yAxis = (y - (height - ySize) / 2);
|
||||
int xAxis = x - (width - xSize) / 2;
|
||||
int yAxis = y - (height - ySize) / 2;
|
||||
if (xAxis > 148 && xAxis < 168 && yAxis > 73 && yAxis < 82) {
|
||||
TileNetworkList data = TileNetworkList.withContents(0);
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
|
||||
@@ -68,7 +68,7 @@ public class GuiOredictionificator extends GuiMekanismTile<TileEntityOredictioni
|
||||
if (tileEntity.filters.size() <= 3) {
|
||||
return 0;
|
||||
}
|
||||
return (int) ((tileEntity.filters.size() * scroll) - ((3F / (float) tileEntity.filters.size())) * scroll);
|
||||
return (int) ((tileEntity.filters.size() * scroll) - (3F / (float) tileEntity.filters.size()) * scroll);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -84,17 +84,13 @@ public class GuiOredictionificator extends GuiMekanismTile<TileEntityOredictioni
|
||||
protected void actionPerformed(GuiButton guibutton) throws IOException {
|
||||
super.actionPerformed(guibutton);
|
||||
if (guibutton.id == 0) {
|
||||
Mekanism.packetHandler.sendToServer(
|
||||
new OredictionificatorGuiMessage(OredictionificatorGuiPacket.SERVER, Coord4D.get(tileEntity), 1, 0,
|
||||
0));
|
||||
Mekanism.packetHandler.sendToServer(new OredictionificatorGuiMessage(OredictionificatorGuiPacket.SERVER, Coord4D.get(tileEntity), 1, 0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
fontRenderer
|
||||
.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2),
|
||||
6, 0x404040);
|
||||
fontRenderer.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2), 6, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (tileEntity.filters.get(getFilterIndex() + i) != null) {
|
||||
@@ -147,8 +143,8 @@ public class GuiOredictionificator extends GuiMekanismTile<TileEntityOredictioni
|
||||
public void mouseClicked(int mouseX, int mouseY, int button) throws IOException {
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
if (button == 0) {
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
if (xAxis >= 154 && xAxis <= 166 && yAxis >= getScroll() + 18 && yAxis <= getScroll() + 18 + 15) {
|
||||
if (tileEntity.filters.size() > 3) {
|
||||
dragOffset = yAxis - (getScroll() + 18);
|
||||
@@ -162,11 +158,9 @@ public class GuiOredictionificator extends GuiMekanismTile<TileEntityOredictioni
|
||||
if (tileEntity.filters.get(getFilterIndex() + i) != null) {
|
||||
int yStart = i * 22 + 18;
|
||||
if (xAxis > 10 && xAxis <= 152 && yAxis > yStart && yAxis <= yStart + 22) {
|
||||
OredictionificatorFilter filter = tileEntity.filters.get(getFilterIndex() + i);
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
Mekanism.packetHandler.sendToServer(
|
||||
new OredictionificatorGuiMessage(OredictionificatorGuiPacket.SERVER_INDEX,
|
||||
Coord4D.get(tileEntity), 1, getFilterIndex() + i, 0));
|
||||
new OredictionificatorGuiMessage(OredictionificatorGuiPacket.SERVER_INDEX, Coord4D.get(tileEntity), 1, getFilterIndex() + i, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -177,7 +171,7 @@ public class GuiOredictionificator extends GuiMekanismTile<TileEntityOredictioni
|
||||
protected void mouseClickMove(int mouseX, int mouseY, int button, long ticks) {
|
||||
super.mouseClickMove(mouseX, mouseY, button, ticks);
|
||||
if (isDragging) {
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
scroll = Math.min(Math.max((float) (yAxis - 18 - dragOffset) / 73F, 0), 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,18 +41,13 @@ public class GuiPRC extends GuiMekanismTile<TileEntityPRC> {
|
||||
addGuiElement(new GuiUpgradeTab(this, tileEntity, resource));
|
||||
addGuiElement(new GuiEnergyInfo(() -> {
|
||||
double extra = tileEntity.getRecipe() != null ? tileEntity.getRecipe().extraEnergy : 0;
|
||||
String multiplier = MekanismUtils.getEnergyDisplay(
|
||||
MekanismUtils.getEnergyPerTick(tileEntity, tileEntity.BASE_ENERGY_PER_TICK + extra));
|
||||
String multiplier = MekanismUtils.getEnergyDisplay(MekanismUtils.getEnergyPerTick(tileEntity, tileEntity.BASE_ENERGY_PER_TICK + extra));
|
||||
return Arrays.asList(LangUtils.localize("gui.using") + ": " + multiplier + "/t",
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils
|
||||
.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
}, this, resource));
|
||||
addGuiElement(new GuiFluidGauge(() ->
|
||||
tileEntity.inputFluidTank, GuiGauge.Type.STANDARD_YELLOW, this, resource, 5, 10));
|
||||
addGuiElement(new GuiGasGauge(() ->
|
||||
tileEntity.inputGasTank, GuiGauge.Type.STANDARD_RED, this, resource, 28, 10));
|
||||
addGuiElement(new GuiGasGauge(() ->
|
||||
tileEntity.outputGasTank, GuiGauge.Type.SMALL_BLUE, this, resource, 140, 40));
|
||||
addGuiElement(new GuiFluidGauge(() -> tileEntity.inputFluidTank, GuiGauge.Type.STANDARD_YELLOW, this, resource, 5, 10));
|
||||
addGuiElement(new GuiGasGauge(() -> tileEntity.inputGasTank, GuiGauge.Type.STANDARD_RED, this, resource, 28, 10));
|
||||
addGuiElement(new GuiGasGauge(() -> tileEntity.outputGasTank, GuiGauge.Type.SMALL_BLUE, this, resource, 140, 40));
|
||||
addGuiElement(new GuiPowerBar(this, tileEntity, resource, 164, 15));
|
||||
addGuiElement(new GuiSlot(SlotType.INPUT, this, resource, 53, 34));
|
||||
addGuiElement(new GuiSlot(SlotType.POWER, this, resource, 140, 18).with(SlotOverlay.POWER));
|
||||
@@ -67,9 +62,7 @@ public class GuiPRC extends GuiMekanismTile<TileEntityPRC> {
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
fontRenderer
|
||||
.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2),
|
||||
6, 0x404040);
|
||||
fontRenderer.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2), 6, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@@ -85,8 +85,7 @@ public class GuiQuantumEntangloporter extends GuiMekanismTile<TileEntityQuantumE
|
||||
}
|
||||
|
||||
public String getSecurity(Frequency freq) {
|
||||
return !freq.publicFreq ? EnumColor.DARK_RED + LangUtils.localize("gui.private")
|
||||
: LangUtils.localize("gui.public");
|
||||
return !freq.publicFreq ? EnumColor.DARK_RED + LangUtils.localize("gui.private") : LangUtils.localize("gui.public");
|
||||
}
|
||||
|
||||
public void updateButtons() {
|
||||
@@ -112,8 +111,7 @@ public class GuiQuantumEntangloporter extends GuiMekanismTile<TileEntityQuantumE
|
||||
privateButton.enabled = true;
|
||||
}
|
||||
if (scrollList.hasSelection()) {
|
||||
Frequency freq = privateMode ? tileEntity.privateCache.get(scrollList.getSelection())
|
||||
: tileEntity.publicCache.get(scrollList.getSelection());
|
||||
Frequency freq = privateMode ? tileEntity.privateCache.get(scrollList.getSelection()) : tileEntity.publicCache.get(scrollList.getSelection());
|
||||
setButton.enabled = tileEntity.getFrequency(null) == null || !tileEntity.getFrequency(null).equals(freq);
|
||||
deleteButton.enabled = tileEntity.getSecurity().getOwnerUUID().equals(freq.ownerUUID);
|
||||
} else {
|
||||
@@ -135,8 +133,8 @@ public class GuiQuantumEntangloporter extends GuiMekanismTile<TileEntityQuantumE
|
||||
updateButtons();
|
||||
frequencyField.mouseClicked(mouseX, mouseY, button);
|
||||
if (button == 0) {
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
if (xAxis >= 137 && xAxis <= 148 && yAxis >= 103 && yAxis <= 114) {
|
||||
setFrequency(frequencyField.getText());
|
||||
frequencyField.setText("");
|
||||
@@ -161,8 +159,7 @@ public class GuiQuantumEntangloporter extends GuiMekanismTile<TileEntityQuantumE
|
||||
frequencyField.setText("");
|
||||
}
|
||||
}
|
||||
if (Character.isDigit(c) || Character.isLetter(c) || isTextboxKey(c, i) ||
|
||||
FrequencyManager.SPECIAL_CHARS.contains(c)) {
|
||||
if (Character.isDigit(c) || Character.isLetter(c) || isTextboxKey(c, i) || FrequencyManager.SPECIAL_CHARS.contains(c)) {
|
||||
frequencyField.textboxKeyTyped(c, i);
|
||||
}
|
||||
updateButtons();
|
||||
@@ -178,15 +175,13 @@ public class GuiQuantumEntangloporter extends GuiMekanismTile<TileEntityQuantumE
|
||||
} else if (guibutton.id == 2) {
|
||||
int selection = scrollList.getSelection();
|
||||
if (selection != -1) {
|
||||
Frequency freq =
|
||||
privateMode ? tileEntity.privateCache.get(selection) : tileEntity.publicCache.get(selection);
|
||||
Frequency freq = privateMode ? tileEntity.privateCache.get(selection) : tileEntity.publicCache.get(selection);
|
||||
setFrequency(freq.name);
|
||||
}
|
||||
} else if (guibutton.id == 3) {
|
||||
int selection = scrollList.getSelection();
|
||||
if (selection != -1) {
|
||||
Frequency freq =
|
||||
privateMode ? tileEntity.privateCache.get(selection) : tileEntity.publicCache.get(selection);
|
||||
Frequency freq = privateMode ? tileEntity.privateCache.get(selection) : tileEntity.publicCache.get(selection);
|
||||
TileNetworkList data = TileNetworkList.withContents(1, freq.name, freq.publicFreq);
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
scrollList.clearSelection();
|
||||
@@ -197,20 +192,16 @@ public class GuiQuantumEntangloporter extends GuiMekanismTile<TileEntityQuantumE
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
fontRenderer
|
||||
.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2),
|
||||
4, 0x404040);
|
||||
fontRenderer.drawString(
|
||||
LangUtils.localize("gui.owner") + ": " + (tileEntity.getSecurity().getClientOwner() != null ? tileEntity
|
||||
.getSecurity().getClientOwner() : LangUtils.localize("gui.none")), 8, (ySize - 96) + 4, 0x404040);
|
||||
fontRenderer.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2), 4, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.owner") + ": " + (tileEntity.getSecurity().getClientOwner() != null
|
||||
? tileEntity.getSecurity().getClientOwner()
|
||||
: LangUtils.localize("gui.none")), 8, (ySize - 96) + 4, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.freq") + ":", 32, 81, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.security") + ":", 32, 91, 0x404040);
|
||||
fontRenderer.drawString(" " + (tileEntity.getFrequency(null) != null ? tileEntity.getFrequency(null).name
|
||||
: EnumColor.DARK_RED + LangUtils.localize("gui.none")),
|
||||
Frequency frequency = tileEntity.getFrequency(null);
|
||||
fontRenderer.drawString(" " + (frequency != null ? frequency.name : EnumColor.DARK_RED + LangUtils.localize("gui.none")),
|
||||
32 + fontRenderer.getStringWidth(LangUtils.localize("gui.freq") + ":"), 81, 0x797979);
|
||||
fontRenderer.drawString(
|
||||
" " + (tileEntity.getFrequency(null) != null ? getSecurity(tileEntity.getFrequency(null))
|
||||
: EnumColor.DARK_RED + LangUtils.localize("gui.none")),
|
||||
fontRenderer.drawString(" " + (frequency != null ? getSecurity(frequency) : EnumColor.DARK_RED + LangUtils.localize("gui.none")),
|
||||
32 + fontRenderer.getStringWidth(LangUtils.localize("gui.security") + ":"), 91, 0x797979);
|
||||
String str = LangUtils.localize("gui.set") + ":";
|
||||
renderScaledText(str, 27, 104, 0x404040, 20);
|
||||
@@ -224,8 +215,8 @@ public class GuiQuantumEntangloporter extends GuiMekanismTile<TileEntityQuantumE
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
if (xAxis >= 137 && xAxis <= 148 && yAxis >= 103 && yAxis <= 114) {
|
||||
drawTexturedModalRect(guiWidth + 137, guiHeight + 103, xSize, 0, 11, 11);
|
||||
} else {
|
||||
|
||||
@@ -48,13 +48,11 @@ public class GuiResistiveHeater extends GuiMekanismTile<TileEntityResistiveHeate
|
||||
addGuiElement(new GuiEnergyInfo(() -> {
|
||||
String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.energyUsage);
|
||||
return Arrays.asList(LangUtils.localize("gui.using") + ": " + multiplier + "/t",
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils
|
||||
.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
}, this, resource));
|
||||
addGuiElement(new GuiHeatInfo(() -> {
|
||||
TemperatureUnit unit = TemperatureUnit.values()[MekanismConfig.current().general.tempUnit.val().ordinal()];
|
||||
String environment = UnitDisplayUtils
|
||||
.getDisplayShort(tileEntity.lastEnvironmentLoss * unit.intervalSize, false, unit);
|
||||
String environment = UnitDisplayUtils.getDisplayShort(tileEntity.lastEnvironmentLoss * unit.intervalSize, false, unit);
|
||||
return Collections.singletonList(LangUtils.localize("gui.dissipated") + ": " + environment + "/t");
|
||||
}, this, resource));
|
||||
}
|
||||
@@ -73,15 +71,10 @@ public class GuiResistiveHeater extends GuiMekanismTile<TileEntityResistiveHeate
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
fontRenderer
|
||||
.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2),
|
||||
6, 0x404040);
|
||||
fontRenderer.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2), 6, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 94) + 2, 0x404040);
|
||||
renderScaledText(LangUtils.localize("gui.temp") + ": " + MekanismUtils
|
||||
.getTemperatureDisplay(tileEntity.temperature, TemperatureUnit.AMBIENT), 50, 25, 0x00CD00, 76);
|
||||
renderScaledText(
|
||||
LangUtils.localize("gui.usage") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.energyUsage) + "/t",
|
||||
50, 41, 0x00CD00, 76);
|
||||
renderScaledText(LangUtils.localize("gui.temp") + ": " + MekanismUtils.getTemperatureDisplay(tileEntity.temperature, TemperatureUnit.AMBIENT), 50, 25, 0x00CD00, 76);
|
||||
renderScaledText(LangUtils.localize("gui.usage") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.energyUsage) + "/t", 50, 41, 0x00CD00, 76);
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@@ -92,8 +85,8 @@ public class GuiResistiveHeater extends GuiMekanismTile<TileEntityResistiveHeate
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
if (xAxis >= 116 && xAxis <= 126 && yAxis >= 51 && yAxis <= 61) {
|
||||
drawTexturedModalRect(guiWidth + 116, guiHeight + 51, xSize, 0, 11, 11);
|
||||
} else {
|
||||
@@ -123,8 +116,8 @@ public class GuiResistiveHeater extends GuiMekanismTile<TileEntityResistiveHeate
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
energyUsageField.mouseClicked(mouseX, mouseY, button);
|
||||
if (button == 0) {
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
if (xAxis >= 116 && xAxis <= 126 && yAxis >= 51 && yAxis <= 61) {
|
||||
setEnergyUsage();
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
|
||||
@@ -3,6 +3,7 @@ package mekanism.client.gui;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.TileNetworkList;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo;
|
||||
import mekanism.client.gui.element.GuiFluidGauge;
|
||||
import mekanism.client.gui.element.GuiGasGauge;
|
||||
@@ -18,7 +19,6 @@ import mekanism.client.gui.element.GuiSlot.SlotType;
|
||||
import mekanism.client.gui.element.GuiUpgradeTab;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.api.TileNetworkList;
|
||||
import mekanism.common.inventory.container.ContainerRotaryCondensentrator;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.tile.TileEntityRotaryCondensentrator;
|
||||
@@ -49,8 +49,7 @@ public class GuiRotaryCondensentrator extends GuiMekanismTile<TileEntityRotaryCo
|
||||
addGuiElement(new GuiEnergyInfo(() -> {
|
||||
String usage = MekanismUtils.getEnergyDisplay(tileEntity.clientEnergyUsed);
|
||||
return Arrays.asList(LangUtils.localize("gui.using") + ": " + usage + "/t",
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils
|
||||
.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
}, this, resource));
|
||||
addGuiElement(new GuiFluidGauge(() -> tileEntity.fluidTank, GuiGauge.Type.STANDARD, this, resource, 133, 13));
|
||||
addGuiElement(new GuiGasGauge(() -> tileEntity.gasTank, GuiGauge.Type.STANDARD, this, resource, 25, 13));
|
||||
@@ -80,16 +79,13 @@ public class GuiRotaryCondensentrator extends GuiMekanismTile<TileEntityRotaryCo
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
fontRenderer
|
||||
.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2),
|
||||
4, 0x404040);
|
||||
fontRenderer.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2), 4, 0x404040);
|
||||
fontRenderer.drawString(tileEntity.mode == 0 ? LangUtils.localize("gui.condensentrating")
|
||||
: LangUtils.localize("gui.decondensentrating"), 6, (ySize - 94) + 2, 0x404040);
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
: LangUtils.localize("gui.decondensentrating"), 6, (ySize - 94) + 2, 0x404040);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
if (xAxis >= 116 && xAxis <= 168 && yAxis >= 76 && yAxis <= 80) {
|
||||
drawHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), xAxis,
|
||||
yAxis);
|
||||
drawHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy(), tileEntity.getMaxEnergy()), xAxis, yAxis);
|
||||
}
|
||||
if (xAxis >= 4 && xAxis <= 22 && yAxis >= 4 && yAxis <= 22) {
|
||||
drawHoveringText(LangUtils.localize("gui.rotaryCondensentrator.toggleOperation"), xAxis, yAxis);
|
||||
@@ -105,8 +101,8 @@ public class GuiRotaryCondensentrator extends GuiMekanismTile<TileEntityRotaryCo
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
int displayInt;
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
displayInt = tileEntity.getScaledEnergyLevel(52);
|
||||
drawTexturedModalRect(guiWidth + 116, guiHeight + 76, 176, 36, displayInt, 4);
|
||||
if (xAxis >= 4 && xAxis <= 22 && yAxis >= 4 && yAxis <= 22) {
|
||||
@@ -121,8 +117,8 @@ public class GuiRotaryCondensentrator extends GuiMekanismTile<TileEntityRotaryCo
|
||||
protected void mouseClicked(int mouseX, int mouseY, int button) throws IOException {
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
if (button == 0) {
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
if (xAxis >= 4 && xAxis <= 22 && yAxis >= 4 && yAxis <= 22) {
|
||||
TileNetworkList data = TileNetworkList.withContents(0);
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
|
||||
@@ -6,10 +6,10 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.TileNetworkList;
|
||||
import mekanism.client.gui.element.GuiScrollList;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.api.TileNetworkList;
|
||||
import mekanism.common.inventory.container.ContainerSecurityDesk;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.security.ISecurityTile.SecurityMode;
|
||||
@@ -91,10 +91,10 @@ public class GuiSecurityDesk extends GuiMekanismTile<TileEntitySecurityDesk> {
|
||||
updateButtons();
|
||||
trustedField.mouseClicked(mouseX, mouseY, button);
|
||||
if (button == 0) {
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
if (tileEntity.frequency != null && tileEntity.ownerUUID != null && tileEntity.clientOwner
|
||||
.equals(mc.player.getName())) {
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
//TODO: replace compare with uuid instead of clientOwner and player name
|
||||
if (tileEntity.frequency != null && tileEntity.ownerUUID != null && tileEntity.clientOwner.equals(mc.player.getName())) {
|
||||
if (xAxis >= 123 && xAxis <= 134 && yAxis >= 68 && yAxis <= 79) {
|
||||
addTrusted(trustedField.getText());
|
||||
trustedField.setText("");
|
||||
@@ -167,14 +167,9 @@ public class GuiSecurityDesk extends GuiMekanismTile<TileEntitySecurityDesk> {
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
String ownerText =
|
||||
tileEntity.clientOwner != null ? (LangUtils.localize("gui.owner") + ": " + tileEntity.clientOwner)
|
||||
: EnumColor.RED + LangUtils.localize("gui.noOwner");
|
||||
fontRenderer
|
||||
.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2),
|
||||
4, 0x404040);
|
||||
fontRenderer
|
||||
.drawString(ownerText, (xSize - 7) - fontRenderer.getStringWidth(ownerText), (ySize - 96) + 2, 0x404040);
|
||||
String ownerText = tileEntity.clientOwner != null ? (LangUtils.localize("gui.owner") + ": " + tileEntity.clientOwner) : EnumColor.RED + LangUtils.localize("gui.noOwner");
|
||||
fontRenderer.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2), 4, 0x404040);
|
||||
fontRenderer.drawString(ownerText, xSize - 7 - fontRenderer.getStringWidth(ownerText), (ySize - 96) + 2, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||
String trusted = LangUtils.localize("gui.trustedPlayers");
|
||||
fontRenderer.drawString(trusted, 74 - (fontRenderer.getStringWidth(trusted) / 2), 57, 0x787878);
|
||||
@@ -184,11 +179,10 @@ public class GuiSecurityDesk extends GuiMekanismTile<TileEntitySecurityDesk> {
|
||||
}
|
||||
fontRenderer.drawString(security, 13, 103, 0x404040);
|
||||
renderScaledText(LangUtils.localize("gui.add") + ":", 13, 70, 0x404040, 20);
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
if (tileEntity.frequency != null && xAxis >= 146 && xAxis <= 162 && yAxis >= 59 && yAxis <= 75) {
|
||||
displayTooltip(LangUtils.localize("gui.securityOverride") + ": " + LangUtils
|
||||
.transOnOff(tileEntity.frequency.override), xAxis, yAxis);
|
||||
displayTooltip(LangUtils.localize("gui.securityOverride") + ": " + LangUtils.transOnOff(tileEntity.frequency.override), xAxis, yAxis);
|
||||
}
|
||||
if (xAxis >= 13 && xAxis <= 53 && yAxis >= 113 && yAxis <= 129) {
|
||||
displayTooltip(LangUtils.localize("gui.publicMode"), xAxis, yAxis);
|
||||
@@ -209,12 +203,11 @@ public class GuiSecurityDesk extends GuiMekanismTile<TileEntitySecurityDesk> {
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
if (tileEntity.frequency != null && tileEntity.clientOwner != null && mc.player.getName()
|
||||
.equals(tileEntity.clientOwner)) {
|
||||
drawTexturedModalRect(guiWidth + 145, guiHeight + 78, xSize + (tileEntity.frequency.override ? 0 : 6), 22,
|
||||
6, 6);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
//TODO: replace compare with uuid instead of clientOwner and player name
|
||||
if (tileEntity.frequency != null && tileEntity.clientOwner != null && mc.player.getName().equals(tileEntity.clientOwner)) {
|
||||
drawTexturedModalRect(guiWidth + 145, guiHeight + 78, xSize + (tileEntity.frequency.override ? 0 : 6), 22, 6, 6);
|
||||
if (xAxis >= 146 && xAxis <= 162 && yAxis >= 59 && yAxis <= 75) {
|
||||
drawTexturedModalRect(guiWidth + 146, guiHeight + 59, xSize + 12, 0, 16, 16);
|
||||
} else {
|
||||
|
||||
@@ -46,7 +46,6 @@ public class GuiSeismicReader extends GuiScreen {
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
upButton = new Rectangle((width - xSize) / 2 + 70, (height - ySize) / 2 + 75, 13, 13);
|
||||
downButton = new Rectangle((width - xSize) / 2 + 70, (height - ySize) / 2 + 92, 13, 13);
|
||||
tooltip = new Rectangle((width - xSize) / 2 + 30, (height - ySize) / 2 + 82, 16, 16);
|
||||
@@ -75,8 +74,7 @@ public class GuiSeismicReader extends GuiScreen {
|
||||
GL11.glColor3f(0.5f, 0.5f, 1f);
|
||||
}
|
||||
|
||||
drawTexturedModalRect(downButton.getX(), downButton.getY(), 150, 0, downButton.getWidth(),
|
||||
downButton.getHeight());
|
||||
drawTexturedModalRect(downButton.getX(), downButton.getY(), 150, 0, downButton.getWidth(), downButton.getHeight());
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
|
||||
// Fix the overlapping if > 100
|
||||
@@ -120,8 +118,7 @@ public class GuiSeismicReader extends GuiScreen {
|
||||
|
||||
// Get the name from the stack and render it
|
||||
if (currentLayer - 1 >= 0) {
|
||||
ItemStack nameStack = new ItemStack(blockList.get(currentLayer - 1).getRight(), 1,
|
||||
blockList.get(currentLayer - 1).getLeft());
|
||||
ItemStack nameStack = new ItemStack(blockList.get(currentLayer - 1).getRight(), 1, blockList.get(currentLayer - 1).getLeft());
|
||||
String renderString = nameStack.getDisplayName();
|
||||
|
||||
String capitalised = renderString.substring(0, 1).toUpperCase() + renderString.substring(1);
|
||||
@@ -153,8 +150,7 @@ public class GuiSeismicReader extends GuiScreen {
|
||||
if (blockList.get(currentLayer - 1) != null) {
|
||||
Block block = blockList.get(currentLayer - 1).getRight();
|
||||
|
||||
if (pair.getRight() == block && Objects
|
||||
.equals(pair.getLeft(), blockList.get(currentLayer - 1).getLeft())) {
|
||||
if (pair.getRight() == block && Objects.equals(pair.getLeft(), blockList.get(currentLayer - 1).getLeft())) {
|
||||
frequency++;
|
||||
}
|
||||
}
|
||||
@@ -170,20 +166,17 @@ public class GuiSeismicReader extends GuiScreen {
|
||||
|
||||
public String wrapString(String str, int index) {
|
||||
String string = str;
|
||||
|
||||
for (int i = 0; i < string.length(); i++) {
|
||||
if (i == index) {
|
||||
string = string.substring(0, i) + "\n" + string.substring(i);
|
||||
}
|
||||
}
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGuiClosed() {
|
||||
super.onGuiClosed();
|
||||
|
||||
blockList.clear();
|
||||
}
|
||||
|
||||
@@ -192,7 +185,6 @@ public class GuiSeismicReader extends GuiScreen {
|
||||
IBlockState state = worldObj.getBlockState(p);
|
||||
Block block = state.getBlock();
|
||||
int metadata = block.getMetaFromState(state);
|
||||
|
||||
blockList.add(Pair.of(metadata, block));
|
||||
}
|
||||
}
|
||||
@@ -200,7 +192,6 @@ public class GuiSeismicReader extends GuiScreen {
|
||||
@Override
|
||||
protected void mouseClicked(int xPos, int yPos, int buttonClicked) throws IOException {
|
||||
super.mouseClicked(xPos, yPos, buttonClicked);
|
||||
|
||||
if (upButton.intersects(new Rectangle(xPos, yPos, 1, 1))) {
|
||||
if (currentLayer + 1 <= blockList.size() - 1) {
|
||||
currentLayer++;
|
||||
@@ -218,4 +209,4 @@ public class GuiSeismicReader extends GuiScreen {
|
||||
public boolean doesGuiPauseGame() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,11 +30,9 @@ public class GuiSeismicVibrator extends GuiMekanismTile<TileEntitySeismicVibrato
|
||||
addGuiElement(new GuiRedstoneControl(this, tileEntity, resource));
|
||||
addGuiElement(new GuiPowerBar(this, tileEntity, resource, 164, 15));
|
||||
addGuiElement(new GuiEnergyInfo(() -> {
|
||||
String multiplier = MekanismUtils
|
||||
.getEnergyDisplay(MekanismConfig.current().usage.seismicVibrator.val());
|
||||
String multiplier = MekanismUtils.getEnergyDisplay(MekanismConfig.current().usage.seismicVibrator.val());
|
||||
return Arrays.asList(LangUtils.localize("gui.using") + ": " + multiplier + "/t",
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils
|
||||
.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
LangUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy() - tileEntity.getEnergy()));
|
||||
}, this, resource));
|
||||
addGuiElement(new GuiSlot(SlotType.NORMAL, this, resource, 142, 34).with(SlotOverlay.POWER));
|
||||
}
|
||||
@@ -43,11 +41,8 @@ public class GuiSeismicVibrator extends GuiMekanismTile<TileEntitySeismicVibrato
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
fontRenderer.drawString(tileEntity.getName(), 45, 6, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||
fontRenderer
|
||||
.drawString(tileEntity.isActive ? LangUtils.localize("gui.vibrating") : LangUtils.localize("gui.idle"),
|
||||
19, 26, 0x00CD00);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.chunk") + ": " + (tileEntity.getPos().getX() >> 4) + ", " + (
|
||||
tileEntity.getPos().getZ() >> 4), 19, 35, 0x00CD00);
|
||||
fontRenderer.drawString(tileEntity.isActive ? LangUtils.localize("gui.vibrating") : LangUtils.localize("gui.idle"), 19, 26, 0x00CD00);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.chunk") + ": " + (tileEntity.getPos().getX() >> 4) + ", " + (tileEntity.getPos().getZ() >> 4), 19, 35, 0x00CD00);
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
|
||||
@@ -89,8 +89,8 @@ public class GuiSideConfiguration extends GuiMekanismTile<TileEntityContainerBlo
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
if (xAxis >= 6 && xAxis <= 20 && yAxis >= 6 && yAxis <= 20) {
|
||||
drawTexturedModalRect(guiWidth + 6, guiHeight + 6, 176 + 28, 0, 14, 14);
|
||||
} else {
|
||||
@@ -127,23 +127,20 @@ public class GuiSideConfiguration extends GuiMekanismTile<TileEntityContainerBlo
|
||||
String title = currentType.localize() + " " + LangUtils.localize("gui.config");
|
||||
fontRenderer.drawString(title, (xSize / 2) - (fontRenderer.getStringWidth(title) / 2), 5, 0x404040);
|
||||
if (configurable.getConfig().canEject(currentType)) {
|
||||
fontRenderer.drawString(
|
||||
LangUtils.localize("gui.eject") + ": " + (configurable.getConfig().isEjecting(currentType) ? "On"
|
||||
: "Off"), 53, 17, 0x00CD00);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.eject") + ": " + (configurable.getConfig().isEjecting(currentType) ? "On" : "Off"), 53, 17, 0x00CD00);
|
||||
} else {
|
||||
fontRenderer.drawString(LangUtils.localize("gui.noEject"), 53, 17, 0x00CD00);
|
||||
}
|
||||
fontRenderer.drawString(LangUtils.localize("gui.slots"), 77, 81, 0x787878);
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
for (int i = 0; i < slotPosMap.size(); i++) {
|
||||
int x = slotPosMap.get(i).xPos;
|
||||
int y = slotPosMap.get(i).yPos;
|
||||
SideData data = configurable.getConfig().getOutput(currentType, EnumFacing.byIndex(i));
|
||||
if (data != TileComponentConfig.EMPTY) {
|
||||
if (xAxis >= x && xAxis <= x + 14 && yAxis >= y && yAxis <= y + 14) {
|
||||
drawHoveringText(data.color + data.localize() + " (" + data.color.getColoredName() + ")", xAxis,
|
||||
yAxis);
|
||||
drawHoveringText(data.color + data.localize() + " (" + data.color.getColoredName() + ")", xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -165,8 +162,8 @@ public class GuiSideConfiguration extends GuiMekanismTile<TileEntityContainerBlo
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int button) throws IOException {
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
TileEntity tile = (TileEntity) configurable;
|
||||
if (button == 0) {
|
||||
if (xAxis >= 6 && xAxis <= 20 && yAxis >= 6 && yAxis <= 20) {
|
||||
@@ -176,8 +173,7 @@ public class GuiSideConfiguration extends GuiMekanismTile<TileEntityContainerBlo
|
||||
}
|
||||
if (xAxis >= 156 && xAxis <= 170 && yAxis >= 6 && yAxis <= 20) {
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
Mekanism.packetHandler.sendToServer(
|
||||
new ConfigurationUpdateMessage(ConfigurationPacket.EJECT, Coord4D.get(tile), 0, 0, currentType));
|
||||
Mekanism.packetHandler.sendToServer(new ConfigurationUpdateMessage(ConfigurationPacket.EJECT, Coord4D.get(tile), 0, 0, currentType));
|
||||
}
|
||||
}
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && button == 0) {
|
||||
@@ -188,9 +184,7 @@ public class GuiSideConfiguration extends GuiMekanismTile<TileEntityContainerBlo
|
||||
int y = slotPosMap.get(i).yPos;
|
||||
if (xAxis >= x && xAxis <= x + 14 && yAxis >= y && yAxis <= y + 14) {
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
Mekanism.packetHandler.sendToServer(
|
||||
new ConfigurationUpdateMessage(ConfigurationPacket.SIDE_DATA, Coord4D.get(tile), button, i,
|
||||
currentType));
|
||||
Mekanism.packetHandler.sendToServer(new ConfigurationUpdateMessage(ConfigurationPacket.SIDE_DATA, Coord4D.get(tile), button, i, currentType));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,8 +117,7 @@ public class GuiTeleporter extends GuiMekanismTile<TileEntityTeleporter> {
|
||||
privateMode = !item.getFrequency(stack).publicFreq;
|
||||
setFrequency(item.getFrequency(stack).name);
|
||||
} else {
|
||||
Mekanism.packetHandler.sendToServer(
|
||||
new PortableTeleporterMessage(PortableTeleporterPacketType.DATA_REQUEST, currentHand, clientFreq));
|
||||
Mekanism.packetHandler.sendToServer(new PortableTeleporterMessage(PortableTeleporterPacketType.DATA_REQUEST, currentHand, clientFreq));
|
||||
}
|
||||
ySize = 175;
|
||||
}
|
||||
@@ -134,8 +133,7 @@ public class GuiTeleporter extends GuiMekanismTile<TileEntityTeleporter> {
|
||||
setButton = new GuiButton(2, guiWidth + 27, guiHeight + 116, 60, 20, LangUtils.localize("gui.set"));
|
||||
deleteButton = new GuiButton(3, guiWidth + 89, guiHeight + 116, 60, 20, LangUtils.localize("gui.delete"));
|
||||
if (!itemStack.isEmpty()) {
|
||||
teleportButton = new GuiButton(4, guiWidth + 42, guiHeight + 140, 92, 20,
|
||||
LangUtils.localize("gui.teleport"));
|
||||
teleportButton = new GuiButton(4, guiWidth + 42, guiHeight + 140, 92, 20, LangUtils.localize("gui.teleport"));
|
||||
}
|
||||
frequencyField = new GuiTextField(5, fontRenderer, guiWidth + 50, guiHeight + 104, 86, 11);
|
||||
frequencyField.setMaxStringLength(FrequencyManager.MAX_FREQ_LENGTH);
|
||||
@@ -148,9 +146,7 @@ public class GuiTeleporter extends GuiMekanismTile<TileEntityTeleporter> {
|
||||
if (!itemStack.isEmpty()) {
|
||||
buttonList.add(teleportButton);
|
||||
if (!isInit) {
|
||||
Mekanism.packetHandler.sendToServer(
|
||||
new PortableTeleporterMessage(PortableTeleporterPacketType.DATA_REQUEST, currentHand,
|
||||
clientFreq));
|
||||
Mekanism.packetHandler.sendToServer(new PortableTeleporterMessage(PortableTeleporterPacketType.DATA_REQUEST, currentHand, clientFreq));
|
||||
} else {
|
||||
isInit = false;
|
||||
}
|
||||
@@ -174,8 +170,7 @@ public class GuiTeleporter extends GuiMekanismTile<TileEntityTeleporter> {
|
||||
}
|
||||
|
||||
public String getSecurity(Frequency freq) {
|
||||
return !freq.publicFreq ? EnumColor.DARK_RED + LangUtils.localize("gui.private")
|
||||
: LangUtils.localize("gui.public");
|
||||
return !freq.publicFreq ? EnumColor.DARK_RED + LangUtils.localize("gui.private") : LangUtils.localize("gui.public");
|
||||
}
|
||||
|
||||
public void updateButtons() {
|
||||
@@ -201,8 +196,7 @@ public class GuiTeleporter extends GuiMekanismTile<TileEntityTeleporter> {
|
||||
privateButton.enabled = true;
|
||||
}
|
||||
if (scrollList.hasSelection()) {
|
||||
Frequency freq = privateMode ? getPrivateCache().get(scrollList.getSelection())
|
||||
: getPublicCache().get(scrollList.getSelection());
|
||||
Frequency freq = privateMode ? getPrivateCache().get(scrollList.getSelection()) : getPublicCache().get(scrollList.getSelection());
|
||||
setButton.enabled = getFrequency() == null || !getFrequency().equals(freq);
|
||||
deleteButton.enabled = getOwner().equals(freq.ownerUUID);
|
||||
} else {
|
||||
@@ -227,8 +221,8 @@ public class GuiTeleporter extends GuiMekanismTile<TileEntityTeleporter> {
|
||||
updateButtons();
|
||||
frequencyField.mouseClicked(mouseX, mouseY, button);
|
||||
if (button == 0) {
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
if (xAxis >= 137 && xAxis <= 148 && yAxis >= 103 && yAxis <= 114) {
|
||||
setFrequency(frequencyField.getText());
|
||||
frequencyField.setText("");
|
||||
@@ -239,8 +233,7 @@ public class GuiTeleporter extends GuiMekanismTile<TileEntityTeleporter> {
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getGuiLocation() {
|
||||
return MekanismUtils
|
||||
.getResource(ResourceType.GUI, isPortable ? "GuiPortableTeleporter.png" : "GuiTeleporter.png");
|
||||
return MekanismUtils.getResource(ResourceType.GUI, isPortable ? "GuiPortableTeleporter.png" : "GuiTeleporter.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -254,8 +247,7 @@ public class GuiTeleporter extends GuiMekanismTile<TileEntityTeleporter> {
|
||||
frequencyField.setText("");
|
||||
}
|
||||
}
|
||||
if (Character.isDigit(c) || Character.isLetter(c) || isTextboxKey(c, i) || FrequencyManager.SPECIAL_CHARS
|
||||
.contains(c)) {
|
||||
if (Character.isDigit(c) || Character.isLetter(c) || isTextboxKey(c, i) || FrequencyManager.SPECIAL_CHARS.contains(c)) {
|
||||
frequencyField.textboxKeyTyped(c, i);
|
||||
}
|
||||
updateButtons();
|
||||
@@ -282,10 +274,8 @@ public class GuiTeleporter extends GuiMekanismTile<TileEntityTeleporter> {
|
||||
TileNetworkList data = TileNetworkList.withContents(1, freq.name, freq.publicFreq);
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
} else {
|
||||
Mekanism.packetHandler.sendToServer(
|
||||
new PortableTeleporterMessage(PortableTeleporterPacketType.DEL_FREQ, currentHand, freq));
|
||||
Mekanism.packetHandler.sendToServer(
|
||||
new PortableTeleporterMessage(PortableTeleporterPacketType.DATA_REQUEST, currentHand, null));
|
||||
Mekanism.packetHandler.sendToServer(new PortableTeleporterMessage(PortableTeleporterPacketType.DEL_FREQ, currentHand, freq));
|
||||
Mekanism.packetHandler.sendToServer(new PortableTeleporterMessage(PortableTeleporterPacketType.DATA_REQUEST, currentHand, null));
|
||||
}
|
||||
scrollList.clearSelection();
|
||||
}
|
||||
@@ -301,22 +291,18 @@ public class GuiTeleporter extends GuiMekanismTile<TileEntityTeleporter> {
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
fontRenderer.drawString(getName(), (xSize / 2) - (fontRenderer.getStringWidth(getName()) / 2), 4, 0x404040);
|
||||
fontRenderer.drawString(
|
||||
LangUtils.localize("gui.owner") + ": " + (getOwnerUsername() != null ? getOwnerUsername()
|
||||
: LangUtils.localize("gui.none")), 8, !itemStack.isEmpty() ? ySize - 12 : (ySize - 96) + 4,
|
||||
0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.owner") + ": " + (getOwnerUsername() != null ? getOwnerUsername() : LangUtils.localize("gui.none")),
|
||||
8, !itemStack.isEmpty() ? ySize - 12 : (ySize - 96) + 4, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.freq") + ":", 32, 81, 0x404040);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.security") + ":", 32, 91, 0x404040);
|
||||
fontRenderer.drawString(" " + (getFrequency() != null ? getFrequency().name
|
||||
: EnumColor.DARK_RED + LangUtils.localize("gui.none")),
|
||||
fontRenderer.drawString(" " + (getFrequency() != null ? getFrequency().name : EnumColor.DARK_RED + LangUtils.localize("gui.none")),
|
||||
32 + fontRenderer.getStringWidth(LangUtils.localize("gui.freq") + ":"), 81, 0x797979);
|
||||
fontRenderer.drawString(" " + (getFrequency() != null ? getSecurity(getFrequency())
|
||||
: EnumColor.DARK_RED + LangUtils.localize("gui.none")),
|
||||
fontRenderer.drawString(" " + (getFrequency() != null ? getSecurity(getFrequency()) : EnumColor.DARK_RED + LangUtils.localize("gui.none")),
|
||||
32 + fontRenderer.getStringWidth(LangUtils.localize("gui.security") + ":"), 91, 0x797979);
|
||||
String str = LangUtils.localize("gui.set") + ":";
|
||||
renderScaledText(str, 27, 104, 0x404040, 20);
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
if (xAxis >= 6 && xAxis <= 24 && yAxis >= 6 && yAxis <= 24) {
|
||||
if (getFrequency() == null) {
|
||||
drawHoveringText(EnumColor.DARK_RED + LangUtils.localize("gui.teleporter.noFreq"), xAxis, yAxis);
|
||||
@@ -334,15 +320,14 @@ public class GuiTeleporter extends GuiMekanismTile<TileEntityTeleporter> {
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
if (xAxis >= 137 && xAxis <= 148 && yAxis >= 103 && yAxis <= 114) {
|
||||
drawTexturedModalRect(guiWidth + 137, guiHeight + 103, xSize, 0, 11, 11);
|
||||
} else {
|
||||
drawTexturedModalRect(guiWidth + 137, guiHeight + 103, xSize, 11, 11, 11);
|
||||
}
|
||||
int y = getFrequency() == null ? 94 : (getStatus() == 2 ? 22 : (getStatus() == 3 ? 40 :
|
||||
(getStatus() == 4 ? 58 : 76)));
|
||||
int y = getFrequency() == null ? 94 : getStatus() == 2 ? 22 : getStatus() == 3 ? 40 : getStatus() == 4 ? 58 : 76;
|
||||
drawTexturedModalRect(guiWidth + 6, guiHeight + 6, 176, y, 18, 18);
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
frequencyField.drawTextBox();
|
||||
@@ -367,7 +352,6 @@ public class GuiTeleporter extends GuiMekanismTile<TileEntityTeleporter> {
|
||||
return tileEntity.getSecurity().getOwnerUUID();
|
||||
}
|
||||
return ((IOwnerItem) itemStack.getItem()).getOwnerUUID(itemStack);
|
||||
|
||||
}
|
||||
|
||||
private String getOwnerUsername() {
|
||||
@@ -402,8 +386,7 @@ public class GuiTeleporter extends GuiMekanismTile<TileEntityTeleporter> {
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
|
||||
} else {
|
||||
Frequency newFreq = new Frequency(freq, null).setPublic(!privateMode);
|
||||
Mekanism.packetHandler.sendToServer(
|
||||
new PortableTeleporterMessage(PortableTeleporterPacketType.SET_FREQ, currentHand, newFreq));
|
||||
Mekanism.packetHandler.sendToServer(new PortableTeleporterMessage(PortableTeleporterPacketType.SET_FREQ, currentHand, newFreq));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import mekanism.common.util.UnitDisplayUtils;
|
||||
import mekanism.common.util.UnitDisplayUtils.TemperatureUnit;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -25,12 +26,10 @@ public class GuiThermalEvaporationController extends GuiMekanismTile<TileEntityT
|
||||
super(tile, new ContainerThermalEvaporationController(inventory, tile));
|
||||
ResourceLocation resource = getGuiLocation();
|
||||
addGuiElement(new GuiFluidGauge(() -> tileEntity.inputTank, GuiGauge.Type.STANDARD, this, resource, 6, 13));
|
||||
addGuiElement(new GuiFluidGauge(() ->
|
||||
tileEntity.outputTank, GuiGauge.Type.STANDARD, this, resource, 152, 13));
|
||||
addGuiElement(new GuiFluidGauge(() -> tileEntity.outputTank, GuiGauge.Type.STANDARD, this, resource, 152, 13));
|
||||
addGuiElement(new GuiHeatInfo(() -> {
|
||||
TemperatureUnit unit = TemperatureUnit.values()[MekanismConfig.current().general.tempUnit.val().ordinal()];
|
||||
String environment = UnitDisplayUtils
|
||||
.getDisplayShort(tileEntity.totalLoss * unit.intervalSize, false, unit);
|
||||
String environment = UnitDisplayUtils.getDisplayShort(tileEntity.totalLoss * unit.intervalSize, false, unit);
|
||||
return Collections.singletonList(LangUtils.localize("gui.dissipated") + ": " + environment + "/t");
|
||||
}, this, resource));
|
||||
}
|
||||
@@ -38,26 +37,20 @@ public class GuiThermalEvaporationController extends GuiMekanismTile<TileEntityT
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 96) + 4, 0x404040);
|
||||
fontRenderer
|
||||
.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2),
|
||||
4, 0x404040);
|
||||
fontRenderer.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2), 4, 0x404040);
|
||||
fontRenderer.drawString(getStruct(), 50, 21, 0x00CD00);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.height") + ": " + tileEntity.height, 50, 30, 0x00CD00);
|
||||
fontRenderer.drawString(LangUtils.localize("gui.temp") + ": " + getTemp(), 50, 39, 0x00CD00);
|
||||
renderScaledText(
|
||||
LangUtils.localize("gui.production") + ": " + Math.round(tileEntity.lastGain * 100D) / 100D + " mB/t", 50,
|
||||
48, 0x00CD00, 76);
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
renderScaledText(LangUtils.localize("gui.production") + ": " + Math.round(tileEntity.lastGain * 100D) / 100D + " mB/t", 50, 48, 0x00CD00, 76);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
if (xAxis >= 7 && xAxis <= 23 && yAxis >= 14 && yAxis <= 72) {
|
||||
drawHoveringText(tileEntity.inputTank.getFluid() != null ?
|
||||
LangUtils.localizeFluidStack(tileEntity.inputTank.getFluid()) + ": " + tileEntity.inputTank
|
||||
.getFluidAmount() : LangUtils.localize("gui.empty"), xAxis, yAxis);
|
||||
FluidStack fluid = tileEntity.inputTank.getFluid();
|
||||
drawHoveringText(fluid != null ? LangUtils.localizeFluidStack(fluid) + ": " + tileEntity.inputTank.getFluidAmount() : LangUtils.localize("gui.empty"), xAxis, yAxis);
|
||||
}
|
||||
if (xAxis >= 153 && xAxis <= 169 && yAxis >= 14 && yAxis <= 72) {
|
||||
drawHoveringText(tileEntity.outputTank.getFluid() != null ?
|
||||
LangUtils.localizeFluidStack(tileEntity.outputTank.getFluid()) + ": " + tileEntity.outputTank
|
||||
.getFluidAmount() : LangUtils.localize("gui.empty"), xAxis, yAxis);
|
||||
FluidStack fluid = tileEntity.outputTank.getFluid();
|
||||
drawHoveringText(fluid != null ? LangUtils.localizeFluidStack(fluid) + ": " + tileEntity.outputTank.getFluidAmount() : LangUtils.localize("gui.empty"), xAxis, yAxis);
|
||||
}
|
||||
if (xAxis >= 49 && xAxis <= 127 && yAxis >= 64 && yAxis <= 72) {
|
||||
drawHoveringText(getTemp(), xAxis, yAxis);
|
||||
@@ -68,12 +61,10 @@ public class GuiThermalEvaporationController extends GuiMekanismTile<TileEntityT
|
||||
private String getStruct() {
|
||||
if (tileEntity.structured) {
|
||||
return LangUtils.localize("gui.formed");
|
||||
} else if (tileEntity.controllerConflict) {
|
||||
return LangUtils.localize("gui.conflict");
|
||||
} else {
|
||||
if (tileEntity.controllerConflict) {
|
||||
return LangUtils.localize("gui.conflict");
|
||||
} else {
|
||||
return LangUtils.localize("gui.incomplete");
|
||||
}
|
||||
return LangUtils.localize("gui.incomplete");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,15 +47,13 @@ public class GuiThermoelectricBoiler extends GuiEmbeddedGaugeTile<TileEntityBoil
|
||||
|
||||
@Override
|
||||
public double getLevel() {
|
||||
double cap = (tileEntity.structure.superheatingElements * MekanismConfig
|
||||
.current().general.superheatingHeatTransfer.val()) / SynchronizedBoilerData.getHeatEnthalpy();
|
||||
double cap = (tileEntity.structure.superheatingElements * MekanismConfig.current().general.superheatingHeatTransfer.val()) / SynchronizedBoilerData.getHeatEnthalpy();
|
||||
return (double) tileEntity.structure.lastMaxBoil / cap;
|
||||
}
|
||||
}, resource, 144, 13));
|
||||
addGuiElement(new GuiHeatInfo(() -> {
|
||||
TemperatureUnit unit = TemperatureUnit.values()[MekanismConfig.current().general.tempUnit.val().ordinal()];
|
||||
String environment = UnitDisplayUtils
|
||||
.getDisplayShort(tileEntity.structure.lastEnvironmentLoss * unit.intervalSize, false, unit);
|
||||
String environment = UnitDisplayUtils.getDisplayShort(tileEntity.structure.lastEnvironmentLoss * unit.intervalSize, false, unit);
|
||||
return Collections.singletonList(LangUtils.localize("gui.dissipated") + ": " + environment + "/t");
|
||||
}, this, resource));
|
||||
}
|
||||
@@ -63,28 +61,22 @@ public class GuiThermoelectricBoiler extends GuiEmbeddedGaugeTile<TileEntityBoil
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
fontRenderer.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 96) + 4, 0x404040);
|
||||
fontRenderer
|
||||
.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2),
|
||||
5, 0x404040);
|
||||
renderScaledText(LangUtils.localize("gui.temp") + ": " + MekanismUtils
|
||||
.getTemperatureDisplay(tileEntity.structure.temperature, TemperatureUnit.AMBIENT), 43, 30, 0x00CD00, 90);
|
||||
renderScaledText(LangUtils.localize("gui.boilRate") + ": " + tileEntity.structure.lastBoilRate + " mB/t", 43,
|
||||
39, 0x00CD00, 90);
|
||||
renderScaledText(LangUtils.localize("gui.maxBoil") + ": " + tileEntity.structure.lastMaxBoil + " mB/t", 43, 48,
|
||||
0x00CD00, 90);
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
fontRenderer.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2), 5, 0x404040);
|
||||
renderScaledText(LangUtils.localize("gui.temp") + ": " +
|
||||
MekanismUtils.getTemperatureDisplay(tileEntity.structure.temperature, TemperatureUnit.AMBIENT), 43, 30, 0x00CD00, 90);
|
||||
renderScaledText(LangUtils.localize("gui.boilRate") + ": " + tileEntity.structure.lastBoilRate + " mB/t", 43, 39, 0x00CD00, 90);
|
||||
renderScaledText(LangUtils.localize("gui.maxBoil") + ": " + tileEntity.structure.lastMaxBoil + " mB/t", 43, 48, 0x00CD00, 90);
|
||||
int xAxis = mouseX - (width - xSize) / 2;
|
||||
int yAxis = mouseY - (height - ySize) / 2;
|
||||
if (xAxis >= 7 && xAxis <= 23 && yAxis >= 14 && yAxis <= 72) {
|
||||
drawHoveringText(tileEntity.structure.waterStored != null ?
|
||||
LangUtils.localizeFluidStack(tileEntity.structure.waterStored) + ": "
|
||||
+ tileEntity.structure.waterStored.amount + "mB" : LangUtils.localize("gui.empty"), xAxis,
|
||||
yAxis);
|
||||
drawHoveringText(tileEntity.structure.waterStored != null
|
||||
? LangUtils.localizeFluidStack(tileEntity.structure.waterStored) + ": " + tileEntity.structure.waterStored.amount + "mB"
|
||||
: LangUtils.localize("gui.empty"), xAxis, yAxis);
|
||||
}
|
||||
if (xAxis >= 153 && xAxis <= 169 && yAxis >= 14 && yAxis <= 72) {
|
||||
drawHoveringText(tileEntity.structure.steamStored != null ?
|
||||
LangUtils.localizeFluidStack(tileEntity.structure.steamStored) + ": "
|
||||
+ tileEntity.structure.steamStored.amount + "mB" : LangUtils.localize("gui.empty"), xAxis,
|
||||
yAxis);
|
||||
drawHoveringText(tileEntity.structure.steamStored != null
|
||||
? LangUtils.localizeFluidStack(tileEntity.structure.steamStored) + ": " + tileEntity.structure.steamStored.amount + "mB"
|
||||
: LangUtils.localize("gui.empty"), xAxis, yAxis);
|
||||
}
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
Loaded 100 of 909 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user