mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-10-25 20:32:32 +00:00
Merge branch 'master' into feature/casting-cooling-animation
This commit is contained in:
102 files changed
+3084
-1292
No files matched your search
@@ -27,4 +27,5 @@ whitelist.json
|
||||
*.iws
|
||||
src/main/resources/mixins.*.json
|
||||
*.bat
|
||||
*.sh
|
||||
layout.json
|
||||
+15
-15
@@ -1,35 +1,35 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
compileOnlyApi('com.github.GTNewHorizons:Angelica:2.1.36:api')
|
||||
api("com.github.GTNewHorizons:Mantle:0.5.3:dev")
|
||||
api("com.github.GTNewHorizons:ForgeMultipart:1.7.10:dev")
|
||||
compileOnlyApi('com.github.GTNewHorizons:Angelica:2.2.13:api')
|
||||
api("com.github.GTNewHorizons:Mantle:0.5.4:dev")
|
||||
api("com.github.GTNewHorizons:ForgeMultipart:1.7.14:dev")
|
||||
// gtnhlib is compileOnlyApi by us, but needed at runtime by nei, so require the correct version
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.11.30:dev")
|
||||
implementation("com.github.GTNewHorizons:NotEnoughItems:2.8.103-GTNH:dev")
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.11.48:dev")
|
||||
implementation("com.github.GTNewHorizons:NotEnoughItems:2.8.139-GTNH:dev")
|
||||
compileOnlyApi("curse.maven:cofh-core-69162:2388751")
|
||||
compileOnly("com.github.GTNewHorizons:inventory-tweaks:1.7.1:api")
|
||||
compileOnly("com.github.GTNewHorizons:waila:1.19.30:api")
|
||||
compileOnly("com.github.GTNewHorizons:waila:1.19.34:api")
|
||||
compileOnly("com.github.GTNewHorizons:Battlegear2:1.4.3:api")
|
||||
compileOnly("curse.maven:minefactory-reloaded-66672:2366150")
|
||||
compileOnly("curse.maven:zelda-sword-skills-220540:2384889")
|
||||
compileOnly("curse.maven:dynamic-sword-skills-226360:2495462")
|
||||
compileOnly("curse.maven:notenoughkeys-224614:2276280")
|
||||
compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev")
|
||||
compileOnly("com.github.GTNewHorizons:Mobs-Info:0.5.17-GTNH:dev")
|
||||
compileOnly("com.github.GTNewHorizons:Mobs-Info:0.6.0-GTNH:dev")
|
||||
compileOnlyApi("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev")
|
||||
compileOnlyApi("com.github.GTNewHorizons:Natura:2.8.19:dev")
|
||||
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.21-GTNH:dev')
|
||||
compileOnly('com.github.GTNewHorizons:SpecialMobs:3.7.4')
|
||||
runtimeOnly('com.github.GTNewHorizons:TiC-Tooltips:1.4.1:dev'){transitive = false}
|
||||
runtimeOnly("com.github.GTNewHorizons:ServerUtilities:2.3.1:dev")
|
||||
compileOnlyApi("com.github.GTNewHorizons:Natura:2.8.24:dev")
|
||||
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.23-GTNH:dev')
|
||||
compileOnly('com.github.GTNewHorizons:SpecialMobs:3.7.6')
|
||||
runtimeOnly('com.github.GTNewHorizons:TiC-Tooltips:1.4.2:dev'){transitive = false}
|
||||
runtimeOnly("com.github.GTNewHorizons:ServerUtilities:2.4.10:dev")
|
||||
|
||||
|
||||
// For testing scythe crop harvesting
|
||||
// devOnlyNonPublishable("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev")
|
||||
// devOnlyNonPublishable("com.github.GTNewHorizons:harvestcraft:1.3.11-GTNH:dev")
|
||||
// devOnlyNonPublishable("com.github.GTNewHorizons:harvestcraft:1.3.15-GTNH:dev")
|
||||
// devOnlyNonPublishable(deobfCurse("pams-harvest-the-nether-231262:2241397"))
|
||||
// devOnlyNonPublishable("com.github.GTNewHorizons:Natura:2.8.19:dev")
|
||||
// devOnlyNonPublishable("com.github.GTNewHorizons:EnderCore:0.5.14")
|
||||
// devOnlyNonPublishable("com.github.GTNewHorizons:Natura:2.8.24:dev")
|
||||
// devOnlyNonPublishable("com.github.GTNewHorizons:EnderCore:0.5.15")
|
||||
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/cf726b4a1c84b50457225f9bba6d7650/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/cf726b4a1c84b50457225f9bba6d7650/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c2dd35c9d0aaf0ba6ad0791320f99dfc/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/e5810bd7fd1f8a586644409d395a7e55/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/cf726b4a1c84b50457225f9bba6d7650/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/7b3c4877c0749019e6805bb61e421497/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/d76df094a9cbbabd3b08251f9e61444a/redirect
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/9064f22734b42ac03e85df04b632e167/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/4d0277c49991306ac78048580fe34bcf/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/a9fa3b809e484a1e1ac4308a5dda661a/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/aa99913fa6d767d899ffc96082da01ca/redirect
|
||||
toolchainVersion=25
|
||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.26'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.29'
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.crafting.Detailing;
|
||||
import tconstruct.library.crafting.LiquidCasting;
|
||||
import tconstruct.library.util.AoEExclusionList;
|
||||
import tconstruct.library.util.BlockSideHitListener;
|
||||
import tconstruct.mechworks.TinkerMechworks;
|
||||
import tconstruct.mechworks.landmine.behavior.Behavior;
|
||||
import tconstruct.mechworks.landmine.behavior.stackCombo.SpecialStackHandler;
|
||||
@@ -196,6 +197,7 @@ public class TConstruct {
|
||||
chiselDetailing = new Detailing();
|
||||
|
||||
AoEExclusionList.init(new File(event.getModConfigurationDirectory(), "TConstruct_AOEExclusions.cfg"));
|
||||
BlockSideHitListener.init();
|
||||
|
||||
playerTracker = new TPlayerHandler();
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(TConstruct.instance, proxy);
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package tconstruct.api;
|
||||
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Resolves the effective capacity used by container operations.
|
||||
*/
|
||||
public class ExtendedStackLimitHelper {
|
||||
|
||||
public static boolean hasExtendedStackLimit(Slot slot) {
|
||||
return getProvider(slot) != null;
|
||||
}
|
||||
|
||||
public static boolean hasExtendedStackLimit(Container container) {
|
||||
if (container == null) return false;
|
||||
|
||||
for (Object object : container.inventorySlots) {
|
||||
if (object instanceof Slot slot && hasExtendedStackLimit(slot)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int getStackLimit(Slot slot, ItemStack stack) {
|
||||
if (slot == null || stack == null) return 0;
|
||||
|
||||
IExtendedStackLimitProvider provider = getProvider(slot);
|
||||
if (provider != null) {
|
||||
return Math.max(0, provider.getExtendedStackLimit(slot.getSlotIndex(), stack));
|
||||
}
|
||||
|
||||
return Math.max(0, Math.min(slot.getSlotStackLimit(), stack.getMaxStackSize()));
|
||||
}
|
||||
|
||||
private static IExtendedStackLimitProvider getProvider(Slot slot) {
|
||||
if (slot instanceof IExtendedStackLimitProvider provider) return provider;
|
||||
if (slot.inventory instanceof IExtendedStackLimitProvider provider) return provider;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package tconstruct.api;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Provides an item-aware stack capacity for a slot or its backing inventory.
|
||||
*
|
||||
* <p>
|
||||
* The returned value is the complete capacity for the supplied item in the supplied slot. Implementations may return a
|
||||
* value larger than the item's normal stack size when the inventory supports extended stacks. The backing inventory
|
||||
* must preserve values up to the returned capacity when a stack is written back.
|
||||
* </p>
|
||||
*/
|
||||
public interface IExtendedStackLimitProvider {
|
||||
|
||||
int getExtendedStackLimit(int slotIndex, ItemStack stack);
|
||||
}
|
||||
@@ -50,9 +50,9 @@ public class ArmorExtendedGui extends InventoryEffectRenderer {
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
// fontRenderer.drawString(StatCollector.translateToLocal("inventory.armorextended"),
|
||||
// 60, 6, 0x404040);
|
||||
// 60, 6, ColorUtils.inventoryTitle.getColor());
|
||||
// fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"),
|
||||
// 17, (ySize - 96) + 2, 0x404040);
|
||||
// 17, (ySize - 96) + 2, ColorUtils.inventoryTitle.getColor());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,6 +11,7 @@ import tconstruct.armor.inventory.KnapsackContainer;
|
||||
import tconstruct.armor.player.KnapsackInventory;
|
||||
import tconstruct.client.tabs.InventoryTabKnapsack;
|
||||
import tconstruct.client.tabs.TabRegistry;
|
||||
import tconstruct.library.util.ColorUtils;
|
||||
|
||||
public class KnapsackGui extends InventoryEffectRenderer {
|
||||
|
||||
@@ -48,9 +49,16 @@ public class KnapsackGui extends InventoryEffectRenderer {
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("inventory.knapsack"), 8, 6, 0x404040);
|
||||
fontRendererObj
|
||||
.drawString(StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 4, 0x404040);
|
||||
fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal("inventory.knapsack"),
|
||||
8,
|
||||
6,
|
||||
ColorUtils.inventoryTitle.getColor());
|
||||
fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal("container.inventory"),
|
||||
8,
|
||||
(ySize - 96) + 4,
|
||||
ColorUtils.inventoryTitle.getColor());
|
||||
}
|
||||
|
||||
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/knapsack.png");
|
||||
|
||||
@@ -2,11 +2,8 @@ package tconstruct.armor.modelblock;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
@@ -18,11 +15,12 @@ public class DryingRackRender implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public static int model = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
private static final float[][] RACK_BOUNDS = { { 0.375F, 0.375F, 0.0F, 0.625F, 0.625F, 1.0F } };
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
if (modelID == model) {
|
||||
renderer.setRenderBounds(0.375F, 0.375F, 0.0F, 0.625F, 0.625F, 1.0F);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata, RACK_BOUNDS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,34 +63,4 @@ public class DryingRackRender implements ISimpleBlockRenderingHandler {
|
||||
public int getRenderId() {
|
||||
return model;
|
||||
}
|
||||
|
||||
public static void renderStandardInvBlock(RenderBlocks renderblocks, Block block, int meta) {
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, -1F, 0.0F);
|
||||
renderblocks.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
renderblocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, -1F);
|
||||
renderblocks.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||
renderblocks.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1F, 0.0F, 0.0F);
|
||||
renderblocks.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||
renderblocks.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, meta));
|
||||
tessellator.draw();
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
}
|
||||
@@ -50,6 +50,8 @@ public class FlexibleToolRenderer implements IItemRenderer {
|
||||
}
|
||||
|
||||
private static final int toolIcons = 10;
|
||||
private final IIcon[] compactIconBuffer = new IIcon[toolIcons];
|
||||
private final IIcon[] rawIconBuffer = new IIcon[toolIcons];
|
||||
|
||||
protected void specialAnimation(ItemRenderType type, ItemStack item) {}
|
||||
|
||||
@@ -60,12 +62,11 @@ public class FlexibleToolRenderer implements IItemRenderer {
|
||||
Entity ent = null;
|
||||
if (data.length > 1) ent = (Entity) data[1];
|
||||
|
||||
IIcon[] parts = new IIcon[toolIcons];
|
||||
int iconParts = getIcons(item, type, ent, parts);
|
||||
int iconParts = getIcons(item, type, ent, compactIconBuffer);
|
||||
|
||||
// drawing the inventory is a simple procedure
|
||||
if (type == ItemRenderType.INVENTORY) {
|
||||
renderInventory(iconParts, parts, item);
|
||||
renderInventory(iconParts, compactIconBuffer, item);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -82,7 +83,7 @@ public class FlexibleToolRenderer implements IItemRenderer {
|
||||
float[] xSub = new float[iconParts];
|
||||
float[] ySub = new float[iconParts];
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
IIcon icon = parts[i];
|
||||
IIcon icon = compactIconBuffer[i];
|
||||
xMin[i] = icon.getMinU();
|
||||
xMax[i] = icon.getMaxU();
|
||||
yMin[i] = icon.getMinV();
|
||||
@@ -262,23 +263,26 @@ public class FlexibleToolRenderer implements IItemRenderer {
|
||||
boolean isInventory = type == ItemRenderType.INVENTORY;
|
||||
ToolCore tool = (ToolCore) item.getItem();
|
||||
|
||||
IIcon[] tempParts = new IIcon[iconParts];
|
||||
label: {
|
||||
if (!isInventory && ent instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) ent;
|
||||
ItemStack itemInUse = player.getItemInUse();
|
||||
if (itemInUse != null) {
|
||||
int useCount = player.getItemInUseCount();
|
||||
for (int i = iconParts; i-- > 0;) tempParts[i] = tool.getIcon(item, i, player, itemInUse, useCount);
|
||||
for (int i = iconParts; i-- > 0;) {
|
||||
rawIconBuffer[i] = tool.getIcon(item, i, player, itemInUse, useCount);
|
||||
}
|
||||
break label;
|
||||
}
|
||||
}
|
||||
for (int i = iconParts; i-- > 0;) tempParts[i] = tool.getIcon(item, i);
|
||||
for (int i = iconParts; i-- > 0;) {
|
||||
rawIconBuffer[i] = tool.getIcon(item, i);
|
||||
}
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
IIcon part = tempParts[i];
|
||||
IIcon part = rawIconBuffer[i];
|
||||
if (part == null || part == ToolCore.blankSprite || part == ToolCore.emptyIcon) ++count;
|
||||
else parts[i - count] = part;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package tconstruct.client;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
@@ -27,8 +26,6 @@ import tconstruct.tools.items.ManualInfo;
|
||||
|
||||
public class TProxyClient extends TProxyCommon {
|
||||
|
||||
public static DecimalFormat df = new DecimalFormat("##.#");
|
||||
|
||||
/* TODO: Split this class up into its respective parts */
|
||||
public static SmallFontRenderer smallFontRenderer;
|
||||
public static IIcon metalBall;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -178,7 +180,10 @@ public class Arrow extends ToolCore {
|
||||
else color = "\u00a76";
|
||||
}
|
||||
|
||||
String energy = color + tags.getInteger("Energy") + "/" + getMaxEnergyStored(stack) + " RF";
|
||||
String energy = color + formatNumber(tags.getInteger("Energy"))
|
||||
+ " / "
|
||||
+ formatNumber(getMaxEnergyStored(stack))
|
||||
+ " RF";
|
||||
list.add(energy);
|
||||
}
|
||||
if (tags.hasKey("InfiTool")) {
|
||||
@@ -208,11 +213,11 @@ public class Arrow extends ToolCore {
|
||||
}
|
||||
int attack = (int) (tags.getCompoundTag("InfiTool").getInteger("Attack") * this.getDamageModifier());
|
||||
list.add(
|
||||
"\u00A79+" + attack
|
||||
"\u00A79+" + formatNumber(attack)
|
||||
+ " "
|
||||
+ StatCollector.translateToLocalFormatted("attribute.name.generic.attackDamage"));
|
||||
list.add(
|
||||
"\u00A79+" + tags.getCompoundTag("InfiTool").getInteger("Attack")
|
||||
"\u00A79+" + formatNumber(tags.getCompoundTag("InfiTool").getInteger("Attack"))
|
||||
+ " "
|
||||
+ StatCollector.translateToLocalFormatted("attribute.name.ammo.attackDamage"));
|
||||
}
|
||||
|
||||
@@ -408,9 +408,10 @@ public abstract class BowBase extends ToolCore {
|
||||
}
|
||||
|
||||
protected IIcon getCorrectIcon2(Map<Integer, IIcon> icons, int id) {
|
||||
if (!icons.containsKey(id)) return blankSprite;
|
||||
Integer boxedId = id;
|
||||
if (icons.containsKey(boxedId)) return icons.get(boxedId);
|
||||
|
||||
return icons.get(id);
|
||||
return blankSprite;
|
||||
}
|
||||
|
||||
/* Animations */
|
||||
|
||||
@@ -6,7 +6,6 @@ import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.network.NetHandlerPlayClient;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
@@ -234,22 +233,11 @@ public class Scythe extends Weapon {
|
||||
.getClientPlayHandler();
|
||||
if (handler instanceof NetHandlerPlayClient) {
|
||||
NetHandlerPlayClient handlerClient = (NetHandlerPlayClient) handler;
|
||||
// scythe aoe is a cube so the face is irrelevant
|
||||
handlerClient.addToSendQueue(
|
||||
new C07PacketPlayerDigging(
|
||||
0,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
Minecraft
|
||||
.getMinecraft().objectMouseOver.sideHit));
|
||||
new C07PacketPlayerDigging(0, x, y, z, 1));
|
||||
handlerClient.addToSendQueue(
|
||||
new C07PacketPlayerDigging(
|
||||
2,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
Minecraft
|
||||
.getMinecraft().objectMouseOver.sideHit));
|
||||
new C07PacketPlayerDigging(2, x, y, z, 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
@@ -115,7 +117,10 @@ public class Shortbow extends BowBase {
|
||||
else color = "\u00a76";
|
||||
}
|
||||
|
||||
String energy = color + tags.getInteger("Energy") + "/" + getMaxEnergyStored(stack) + " RF";
|
||||
String energy = color + formatNumber(tags.getInteger("Energy"))
|
||||
+ " / "
|
||||
+ formatNumber(getMaxEnergyStored(stack))
|
||||
+ " RF";
|
||||
list.add(energy);
|
||||
}
|
||||
if (tags.hasKey("InfiTool")) {
|
||||
|
||||
@@ -364,9 +364,9 @@ public class TConstructRegistry {
|
||||
* @return Tool Material
|
||||
*/
|
||||
public static ToolMaterial getMaterial(int key) {
|
||||
if (toolMaterials.containsKey(key)) {
|
||||
return (toolMaterials.get(key));
|
||||
}
|
||||
Integer boxedKey = key;
|
||||
ToolMaterial material = toolMaterials.get(boxedKey);
|
||||
if (material != null || toolMaterials.containsKey(boxedKey)) return material;
|
||||
|
||||
// This is probably an old tool whose material has been removed from the game.
|
||||
// Fall back to wood.
|
||||
|
||||
@@ -4,9 +4,10 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
import tconstruct.library.util.AoEExclusionList;
|
||||
import tconstruct.library.util.BlockSideHitListener;
|
||||
|
||||
public abstract class AOEHarvestTool extends HarvestTool {
|
||||
|
||||
@@ -26,6 +27,8 @@ public abstract class AOEHarvestTool extends HarvestTool {
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) {
|
||||
if (player.worldObj.isRemote) return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
|
||||
// only effective materials matter. We don't want to aoe when breaking dirt with a hammer.
|
||||
String toolName = "tool." + getAOEToolName().toLowerCase();
|
||||
Block block = player.worldObj.getBlock(x, y, z);
|
||||
@@ -39,30 +42,36 @@ public abstract class AOEHarvestTool extends HarvestTool {
|
||||
|
||||
if (player.isSneaking()) return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
|
||||
MovingObjectPosition mop = AbilityHelper.raytraceFromEntity(player.worldObj, player, false, 4.5d);
|
||||
if (mop == null) return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
int sideHit = mop.sideHit;
|
||||
// int sideHit = Minecraft.getMinecraft().objectMouseOver.sideHit;
|
||||
int sideHit = BlockSideHitListener.getSideHit(player);
|
||||
|
||||
// Width++/Height++ expander modifiers enlarge the area by one block on each side of their axis
|
||||
int widthRange = breakRadius + (toolTags.getBoolean("Width++") ? 1 : 0);
|
||||
int heightRange = breakRadius + (toolTags.getBoolean("Height++") ? 1 : 0);
|
||||
|
||||
// we successfully destroyed a block. time to do AOE!
|
||||
int xRange = breakRadius;
|
||||
int yRange = breakRadius;
|
||||
int xRange = widthRange;
|
||||
int yRange = heightRange;
|
||||
int zRange = breakDepth;
|
||||
switch (sideHit) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 1: {
|
||||
// floor/ceiling: width sits perpendicular to the player's facing, height runs along it
|
||||
int facing = MathHelper.floor_double((player.rotationYaw * 4F) / 360F + 0.5D) & 3;
|
||||
boolean facingZ = facing == 0 || facing == 2;
|
||||
xRange = facingZ ? widthRange : heightRange;
|
||||
yRange = breakDepth;
|
||||
zRange = breakRadius;
|
||||
zRange = facingZ ? heightRange : widthRange;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
case 3:
|
||||
xRange = breakRadius;
|
||||
xRange = widthRange;
|
||||
zRange = breakDepth;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
xRange = breakDepth;
|
||||
zRange = breakRadius;
|
||||
zRange = widthRange;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public class AbilityHelper {
|
||||
if (tags.getCompoundTag("InfiTool").hasKey("Unbreaking"))
|
||||
reinforced = tags.getCompoundTag("InfiTool").getInteger("Unbreaking");
|
||||
|
||||
if (random.nextInt(10) < 10 - reinforced) {
|
||||
if (random.nextInt(10) < 10 - reinforced && (double) block.getBlockHardness(world, x, y, z) != 0.0D) {
|
||||
damageTool(stack, 1, tags, player, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -131,10 +131,10 @@ public abstract class HarvestTool extends ToolCore {
|
||||
|
||||
boolean used = false;
|
||||
int hotbarSlot = player.inventory.currentItem;
|
||||
int itemSlot = hotbarSlot == 0 ? 8 : hotbarSlot + 1;
|
||||
int itemSlot = getAdjacentHotbarSlot(hotbarSlot);
|
||||
ItemStack nearbyStack;
|
||||
|
||||
if (hotbarSlot < 8) {
|
||||
if (itemSlot >= 0) {
|
||||
nearbyStack = player.inventory.getStackInSlot(itemSlot);
|
||||
if (nearbyStack != null) {
|
||||
Item item = nearbyStack.getItem();
|
||||
@@ -303,8 +303,8 @@ public abstract class HarvestTool extends ToolCore {
|
||||
}
|
||||
|
||||
// send an update to the server, so we get an update back
|
||||
if (PHConstruct.extraBlockUpdates) Minecraft.getMinecraft().getNetHandler().addToSendQueue(
|
||||
new C07PacketPlayerDigging(2, x, y, z, Minecraft.getMinecraft().objectMouseOver.sideHit));
|
||||
if (PHConstruct.extraBlockUpdates) Minecraft.getMinecraft().getNetHandler()
|
||||
.addToSendQueue(new C07PacketPlayerDigging(2, x, y, z, sidehit));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package tconstruct.library.tools;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -11,6 +13,7 @@ import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemPotion;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -62,6 +65,8 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem, IEq
|
||||
protected int damageVsEntity;
|
||||
public static IIcon blankSprite;
|
||||
public static IIcon emptyIcon;
|
||||
private static final String[] effectKeys = { "Effect1", "Effect2", "Effect3", "Effect4", "Effect5", "Effect6",
|
||||
"Effect7", "Effect8", "Effect9" };
|
||||
|
||||
public ToolCore(int baseDamage) {
|
||||
super();
|
||||
@@ -246,7 +251,7 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem, IEq
|
||||
}
|
||||
// Effects
|
||||
else if (renderPass <= 10) {
|
||||
String effect = "Effect" + (1 + renderPass - getPartAmount());
|
||||
String effect = getEffectKey(1 + renderPass - getPartAmount());
|
||||
if (tags.hasKey(effect)) return effectIcons.get(tags.getInteger(effect));
|
||||
}
|
||||
return blankSprite;
|
||||
@@ -254,8 +259,14 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem, IEq
|
||||
return emptyIcon;
|
||||
}
|
||||
|
||||
protected static String getEffectKey(int effect) {
|
||||
if (effect > 0 && effect <= effectKeys.length) return effectKeys[effect - 1];
|
||||
return "Effect" + effect;
|
||||
}
|
||||
|
||||
protected IIcon getCorrectIcon(Map<Integer, IIcon> icons, int id) {
|
||||
if (icons.containsKey(id)) return icons.get(id);
|
||||
Integer boxedId = id;
|
||||
if (icons.containsKey(boxedId)) return icons.get(boxedId);
|
||||
|
||||
// default icon
|
||||
return icons.get(-1);
|
||||
@@ -278,7 +289,10 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem, IEq
|
||||
else color = EnumChatFormatting.GOLD.toString();
|
||||
}
|
||||
|
||||
String energy = color + tags.getInteger("Energy") + "/" + getMaxEnergyStored(stack) + " RF";
|
||||
String energy = color + formatNumber(tags.getInteger("Energy"))
|
||||
+ "/"
|
||||
+ formatNumber(getMaxEnergyStored(stack))
|
||||
+ " RF";
|
||||
list.add(energy);
|
||||
}
|
||||
if (tags.hasKey("InfiTool")) {
|
||||
@@ -339,7 +353,7 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem, IEq
|
||||
int attack = (int) (tags.getCompoundTag("InfiTool").getInteger("Attack") * this.getDamageModifier());
|
||||
list.add(
|
||||
EnumChatFormatting.BLUE + "+"
|
||||
+ attack
|
||||
+ formatNumber(attack)
|
||||
+ " "
|
||||
+ StatCollector.translateToLocalFormatted("attribute.name.generic.attackDamage"));
|
||||
}
|
||||
@@ -563,11 +577,31 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem, IEq
|
||||
|
||||
protected int getCorrectColor(ItemStack stack, int renderPass, NBTTagCompound tags, String key,
|
||||
Map<Integer, IIcon> map) {
|
||||
// Avoid render-time concatenation for built-in parts while preserving addon keys.
|
||||
String colorKey;
|
||||
String renderKey;
|
||||
if ("Handle".equals(key)) {
|
||||
colorKey = "HandleColor";
|
||||
renderKey = "RenderHandle";
|
||||
} else if ("Head".equals(key)) {
|
||||
colorKey = "HeadColor";
|
||||
renderKey = "RenderHead";
|
||||
} else if ("Accessory".equals(key)) {
|
||||
colorKey = "AccessoryColor";
|
||||
renderKey = "RenderAccessory";
|
||||
} else if ("Extra".equals(key)) {
|
||||
colorKey = "ExtraColor";
|
||||
renderKey = "RenderExtra";
|
||||
} else {
|
||||
colorKey = key + "Color";
|
||||
renderKey = "Render" + key;
|
||||
}
|
||||
|
||||
// custom coloring
|
||||
if (tags.hasKey(key + "Color")) return tags.getInteger(key + "Color");
|
||||
if (tags.hasKey(colorKey)) return tags.getInteger(colorKey);
|
||||
|
||||
// custom texture?
|
||||
int matId = tags.getInteger("Render" + key);
|
||||
int matId = tags.getInteger(renderKey);
|
||||
if (map.containsKey(matId)) return super.getColorFromItemStack(stack, renderPass);
|
||||
|
||||
// color default texture with material color
|
||||
@@ -575,19 +609,18 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem, IEq
|
||||
}
|
||||
|
||||
protected int getDefaultColor(int renderPass, int materialID) {
|
||||
if (TConstructRegistry.getMaterial(materialID) != null)
|
||||
return TConstructRegistry.getMaterial(materialID).primaryColor();
|
||||
tconstruct.library.tools.ToolMaterial material = TConstructRegistry.getMaterial(materialID);
|
||||
if (material != null) return material.primaryColor();
|
||||
|
||||
return 0xffffffff;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
int hotbarSlot = player.inventory.currentItem;
|
||||
int itemSlot = hotbarSlot == 0 ? 8 : hotbarSlot + 1;
|
||||
int itemSlot = getAdjacentHotbarSlot(player.inventory.currentItem);
|
||||
ItemStack nearbyStack;
|
||||
|
||||
if (hotbarSlot < 8) {
|
||||
if (itemSlot >= 0) {
|
||||
nearbyStack = player.inventory.getStackInSlot(itemSlot);
|
||||
if (nearbyStack != null) {
|
||||
Item item = nearbyStack.getItem();
|
||||
@@ -608,6 +641,10 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem, IEq
|
||||
return stack;
|
||||
}
|
||||
|
||||
protected int getAdjacentHotbarSlot(int hotbarSlot) {
|
||||
return hotbarSlot < InventoryPlayer.getHotbarSize() - 1 ? hotbarSlot + 1 : -1;
|
||||
}
|
||||
|
||||
/* Vanilla overrides */
|
||||
@Override
|
||||
public boolean isItemTool(ItemStack par1ItemStack) {
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package tconstruct.library.util;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedOutEvent;
|
||||
|
||||
/** Logic to keep track of the side of the block that was last hit. */
|
||||
public class BlockSideHitListener {
|
||||
|
||||
private static final Map<UUID, Integer> HIT_FACE = new HashMap<>();
|
||||
private static boolean initialized = false;
|
||||
|
||||
/** Initializes this listener. */
|
||||
public static void init() {
|
||||
if (initialized) return;
|
||||
|
||||
initialized = true;
|
||||
BlockSideHitListener listener = new BlockSideHitListener();
|
||||
MinecraftForge.EVENT_BUS.register(listener);
|
||||
FMLCommonHandler.instance().bus().register(listener);
|
||||
}
|
||||
|
||||
/** Called when the player left-clicks a block to store the face. */
|
||||
@SubscribeEvent
|
||||
public void onLeftClickBlock(PlayerInteractEvent event) {
|
||||
if (event.action == PlayerInteractEvent.Action.LEFT_CLICK_BLOCK) {
|
||||
HIT_FACE.put(event.entityPlayer.getUniqueID(), event.face);
|
||||
}
|
||||
}
|
||||
|
||||
/** Called when a player leaves the server to clear the face. */
|
||||
@SubscribeEvent
|
||||
public void onLeaveServer(PlayerLoggedOutEvent event) {
|
||||
HIT_FACE.remove(event.player.getUniqueID());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the side this player last hit.
|
||||
*
|
||||
* @param player player whose last hit side is requested
|
||||
* @return side last hit
|
||||
*/
|
||||
public static int getSideHit(EntityPlayer player) {
|
||||
Integer side = HIT_FACE.get(player.getUniqueID());
|
||||
return side == null ? 1 : side;
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ public class ColorUtils {
|
||||
|
||||
public static final ColorResource
|
||||
// spotless:off
|
||||
inventoryTitle = color.rgb("inventoryTitle", "0x404040"),
|
||||
materialName = color.rgb("materialName", "0x404040"),
|
||||
materialDurability = color.rgb("materialDurability", "0x404040"),
|
||||
materialHandleModifier1 = color.rgb("materialHandleModifier1", "0x404040"),
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package tconstruct.library.weaponry;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -23,7 +25,6 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import mods.battlegear2.api.PlayerEventChild;
|
||||
import mods.battlegear2.api.weapons.IBattlegearWeapon;
|
||||
import tconstruct.client.TProxyClient;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
@@ -242,7 +243,7 @@ public abstract class ProjectileWeapon extends ToolCore implements IBattlegearWe
|
||||
// are we drawing an effect?
|
||||
if (renderPass >= getPartAmount()) {
|
||||
// is the effect animated?
|
||||
String effect = "Effect" + (1 + renderPass - getPartAmount());
|
||||
String effect = getEffectKey(1 + renderPass - getPartAmount());
|
||||
if (tags.hasKey(effect)) {
|
||||
int index = tags.getInteger(effect);
|
||||
if (animationEffectIcons.get(index) != null) return getCorrectAnimationIcon(
|
||||
@@ -280,15 +281,17 @@ public abstract class ProjectileWeapon extends ToolCore implements IBattlegearWe
|
||||
|
||||
protected IIcon getCorrectAnimationIcon(Map<Integer, IIcon[]> icons, int id, float progress) {
|
||||
// animation count, standard texture as reference
|
||||
float count = icons.get(-1).length - 1;
|
||||
IIcon[] defaultAnimation = icons.get(-1);
|
||||
float count = defaultAnimation.length - 1;
|
||||
int step = Math.round(progress * count);
|
||||
|
||||
step = Math.max(0, step);
|
||||
|
||||
if (icons.containsKey(id)) return icons.get(id)[step];
|
||||
Integer boxedId = id;
|
||||
if (icons.containsKey(boxedId)) return icons.get(boxedId)[step];
|
||||
|
||||
// default icon
|
||||
return icons.get(-1)[step];
|
||||
return defaultAnimation[step];
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -316,7 +319,7 @@ public abstract class ProjectileWeapon extends ToolCore implements IBattlegearWe
|
||||
}
|
||||
// Effects
|
||||
else if (renderPass <= 10) {
|
||||
String effect = "Effect" + (1 + renderPass - getPartAmount());
|
||||
String effect = getEffectKey(1 + renderPass - getPartAmount());
|
||||
if (tags.hasKey(effect)) return effectIcons.get(tags.getInteger(effect));
|
||||
}
|
||||
return blankSprite;
|
||||
@@ -445,9 +448,7 @@ public abstract class ProjectileWeapon extends ToolCore implements IBattlegearWe
|
||||
|
||||
list.remove(list.size() - 1); // remove last item (the damage of the bow itself)
|
||||
list.add(currentAmmo.getDisplayName());
|
||||
list.add(
|
||||
StatCollector.translateToLocal("attribute.name.ammo.maxAttackDamage") + ": "
|
||||
+ TProxyClient.df.format(damage));
|
||||
list.add(StatCollector.translateToLocal("attribute.name.ammo.maxAttackDamage") + ": " + formatNumber(damage));
|
||||
}
|
||||
|
||||
/*---- Battlegear Support START ----*/
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package tconstruct.mechworks.landmine;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
@@ -32,38 +29,4 @@ public class Helper {
|
||||
|
||||
return ForgeDirection.UNKNOWN;
|
||||
}
|
||||
|
||||
public static void renderInventoryCube(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
renderer.renderFaceYPos(block, 0, 0, 0, renderer.getBlockIconFromSideAndMetadata(block, 1, metadata));
|
||||
tessellator.draw();
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, -1.0F, 0.0F);
|
||||
renderer.renderFaceYNeg(block, 0, 0, 0, renderer.getBlockIconFromSideAndMetadata(block, 0, metadata));
|
||||
tessellator.draw();
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||
renderer.renderFaceXPos(block, 0, 0, 0, renderer.getBlockIconFromSideAndMetadata(block, 2, metadata));
|
||||
tessellator.draw();
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1.0F, 0.0F, 0.0F);
|
||||
renderer.renderFaceXNeg(block, 0, 0, 0, renderer.getBlockIconFromSideAndMetadata(block, 3, metadata));
|
||||
tessellator.draw();
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||
renderer.renderFaceZPos(block, 0, 0, 0, renderer.getBlockIconFromSideAndMetadata(block, 4, metadata));
|
||||
tessellator.draw();
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, -1.0F);
|
||||
renderer.renderFaceZNeg(block, 0, 0, 0, renderer.getBlockIconFromSideAndMetadata(block, 5, metadata));
|
||||
tessellator.draw();
|
||||
}
|
||||
}
|
||||
@@ -91,12 +91,11 @@ public class ModAttack extends ItemModTypeFilter {
|
||||
|
||||
if (tags.hasKey(key)) {
|
||||
int[] keyPair = tags.getIntArray(key);
|
||||
int overThreshold = increase / threshold;
|
||||
|
||||
int leftToBoost = threshold - (keyPair[0] % threshold);
|
||||
if (increase >= leftToBoost) {
|
||||
int attack = tags.getInteger("Attack");
|
||||
attack += (overThreshold > 1) ? overThreshold : 1;
|
||||
attack += 1 + (increase - leftToBoost) / threshold;
|
||||
tags.setInteger("Attack", attack);
|
||||
}
|
||||
|
||||
@@ -118,14 +117,13 @@ public class ModAttack extends ItemModTypeFilter {
|
||||
int modifiers = tags.getInteger("Modifiers");
|
||||
modifiers -= 1;
|
||||
tags.setInteger("Modifiers", modifiers);
|
||||
int overThreshold = increase / threshold;
|
||||
String modName = "\u00a7f" + guiType + " (" + increase + "/" + max + ")";
|
||||
int tooltipIndex = addToolTip(tool, tooltipName, modName);
|
||||
int[] keyPair = new int[] { increase, max, tooltipIndex };
|
||||
tags.setIntArray(key, keyPair);
|
||||
|
||||
int attack = tags.getInteger("Attack");
|
||||
attack += (overThreshold >= 1) ? overThreshold : 0;
|
||||
attack += 1 + increase / threshold;
|
||||
tags.setInteger("Attack", attack);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package tconstruct.modifiers.tools;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import tconstruct.library.tools.AOEHarvestTool;
|
||||
|
||||
/* Width++/Height++ from TiC2: boolean flag, applies once, only fits tools with an AOE */
|
||||
|
||||
public class ModExpander extends ModBoolean {
|
||||
|
||||
public ModExpander(ItemStack[] items, String tag, String c, String tip) {
|
||||
super(items, 0, tag, c, tip);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify(ItemStack tool, ItemStack[] input) {
|
||||
return tool.getItem() instanceof AOEHarvestTool && super.canModify(tool, input);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMatchingEffect(ItemStack input) {
|
||||
// expanders have no render overlay on the tool
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import net.minecraft.inventory.Slot;
|
||||
|
||||
import codechicken.nei.recipe.DefaultOverlayHandler;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import tconstruct.tools.gui.CraftingStationGui;
|
||||
import tconstruct.tools.inventory.CraftingStationContainer;
|
||||
import tconstruct.tools.logic.CraftingStationLogic;
|
||||
|
||||
@@ -21,15 +20,7 @@ public class CraftingStationOverlayHandler extends DefaultOverlayHandler {
|
||||
|
||||
@Override
|
||||
public int transferRecipe(GuiContainer gui, IRecipeHandler handler, int recipeIndex, int multiplier) {
|
||||
|
||||
if (gui.inventorySlots instanceof CraftingStationContainer stationContainer) {
|
||||
if (stationContainer.logic.chest != null && gui instanceof CraftingStationGui stationGui) {
|
||||
offsetx = 5 + stationGui.getChestWidth();
|
||||
} else {
|
||||
offsetx = 5;
|
||||
}
|
||||
}
|
||||
|
||||
offsetx = 5;
|
||||
return super.transferRecipe(gui, handler, recipeIndex, multiplier);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,9 +22,7 @@ public class CraftingStationStackPositioner implements IStackPositioner {
|
||||
}
|
||||
|
||||
if (screen instanceof CraftingStationGui) {
|
||||
CraftingStationGui gui = (CraftingStationGui) screen;
|
||||
|
||||
int offsetX = gui.hasChest() ? 5 + gui.getChestWidth() : 5;
|
||||
int offsetX = 5;
|
||||
int offsetY = 11;
|
||||
|
||||
for (PositionedStack stack : stacks) {
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
package tconstruct.plugins.nei;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import codechicken.nei.api.IBookmarkContainerHandler;
|
||||
import tconstruct.tools.gui.CraftingStationGui;
|
||||
import tconstruct.tools.inventory.CraftingStationContainer;
|
||||
import tconstruct.tools.logic.CraftingStationLogic;
|
||||
|
||||
@@ -21,76 +20,72 @@ public class NEITConstructBookmarkContainerHandler implements IBookmarkContainer
|
||||
|
||||
@Override
|
||||
public void pullBookmarkItemsFromContainer(GuiContainer guiContainer, ArrayList<ItemStack> bookmarkItems) {
|
||||
CraftingStationGui gui = (CraftingStationGui) guiContainer;
|
||||
CraftingStationLogic logic = ((CraftingStationContainer) guiContainer.inventorySlots).logic;
|
||||
if (logic.getFirstInventory() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<ItemStack> containerStacks = getStacks(gui);
|
||||
Container container = guiContainer.inventorySlots;
|
||||
for (ItemStack bookmarkItem : bookmarkItems) {
|
||||
|
||||
int bookmarkSizeBackup = bookmarkItem.stackSize;
|
||||
|
||||
for (int i = magicNumber; i < containerStacks.size(); i++) {
|
||||
ItemStack containerItem = containerStacks.get(i);
|
||||
|
||||
if (containerItem == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bookmarkItem.isItemEqual(containerItem)) {
|
||||
if (bookmarkItem.stackSize <= 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
int transferAmount = Math.min(bookmarkItem.stackSize, containerItem.stackSize);
|
||||
|
||||
moveItems(guiContainer, i, transferAmount);
|
||||
bookmarkItem.stackSize -= transferAmount;
|
||||
|
||||
if (bookmarkItem.stackSize == 0) {
|
||||
break;
|
||||
}
|
||||
int remaining = bookmarkItem.stackSize;
|
||||
for (int i = magicNumber; i < container.inventorySlots.size() && remaining > 0; i++) {
|
||||
ItemStack containerItem = container.getSlot(i).getStack();
|
||||
if (containerItem != null && bookmarkItem.isItemEqual(containerItem)) {
|
||||
remaining -= moveItems(guiContainer, i, Math.min(remaining, containerItem.stackSize));
|
||||
}
|
||||
}
|
||||
bookmarkItem.stackSize = bookmarkSizeBackup;
|
||||
}
|
||||
}
|
||||
|
||||
private List<ItemStack> getStacks(GuiContainer container) {
|
||||
List<ItemStack> result = new ArrayList<>();
|
||||
for (int i = 0; i < container.inventorySlots.inventorySlots.size(); i++) {
|
||||
result.add(container.inventorySlots.getSlot(i).getStack());
|
||||
private int moveItems(GuiContainer container, int fromSlot, int transferAmount) {
|
||||
Slot source = container.inventorySlots.getSlot(fromSlot);
|
||||
ItemStack sourceStack = source.getStack();
|
||||
if (sourceStack == null || !source.canTakeStack(mc.thePlayer)) {
|
||||
return 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void moveItems(GuiContainer container, int fromSlot, int transferAmount) {
|
||||
for (int i = 0; i < transferAmount; i++) {
|
||||
int toSlot = findValidPlayerInventoryDestination(container.inventorySlots, fromSlot);
|
||||
if (!source.isItemValid(sourceStack)) {
|
||||
// The remainder cannot be put back into an extraction-only slot, so move the whole stack.
|
||||
int toSlot = findValidPlayerInventoryDestination(container.inventorySlots, fromSlot, sourceStack.stackSize);
|
||||
if (toSlot == -1) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
int moved = sourceStack.stackSize;
|
||||
clickSlot(container, fromSlot, 0);
|
||||
clickSlot(container, toSlot, 0);
|
||||
return moved;
|
||||
}
|
||||
|
||||
int moved = 0;
|
||||
for (int i = 0; i < transferAmount; i++) {
|
||||
int toSlot = findValidPlayerInventoryDestination(container.inventorySlots, fromSlot, 1);
|
||||
if (toSlot == -1) {
|
||||
break;
|
||||
}
|
||||
clickSlot(container, fromSlot, 0);
|
||||
clickSlot(container, toSlot, 1);
|
||||
clickSlot(container, fromSlot, 0);
|
||||
moved++;
|
||||
}
|
||||
return moved;
|
||||
}
|
||||
|
||||
private void clickSlot(GuiContainer container, int slotIdx, int button) {
|
||||
mc.playerController.windowClick(container.inventorySlots.windowId, slotIdx, button, 0, mc.thePlayer);
|
||||
}
|
||||
|
||||
private int findValidPlayerInventoryDestination(Container container, int fromSlot) {
|
||||
private int findValidPlayerInventoryDestination(Container container, int fromSlot, int amount) {
|
||||
ItemStack stackToMove = container.getSlot(fromSlot).getStack();
|
||||
if (stackToMove == null) {
|
||||
return -1;
|
||||
}
|
||||
for (int i = 10; i < magicNumber; i++) { // 10 comes from the magic number including crafting field + product
|
||||
ItemStack toStack = container.getSlot(i).getStack();
|
||||
if (toStack == null) {
|
||||
return i;
|
||||
}
|
||||
int diff = stackToMove.getMaxStackSize() - toStack.stackSize;
|
||||
if (toStack.isItemEqual(stackToMove) && diff > 0) {
|
||||
Slot destination = container.getSlot(i);
|
||||
ItemStack toStack = destination.getStack();
|
||||
int capacity = Math.min(destination.getSlotStackLimit(), stackToMove.getMaxStackSize())
|
||||
- (toStack == null ? 0 : toStack.stackSize);
|
||||
if (capacity >= amount && (toStack == null
|
||||
|| toStack.isItemEqual(stackToMove) && ItemStack.areItemStackTagsEqual(toStack, stackToMove))) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package tconstruct.plugins.nei;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatFluid;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
@@ -223,7 +225,7 @@ public abstract class RecipeHandlerBase extends TemplateRecipeHandler {
|
||||
return currenttip;
|
||||
}
|
||||
currenttip.add(this.fluid.getLocalizedName());
|
||||
currenttip.add(EnumChatFormatting.GRAY.toString() + this.fluid.amount + " mB");
|
||||
currenttip.add(EnumChatFormatting.GRAY + formatFluid(this.fluid.amount));
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package tconstruct.plugins.nei;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -70,7 +72,10 @@ public class RecipeHandlerDryingRack extends RecipeHandlerBase {
|
||||
int time = ((CachedDryingRackRecipe) this.arecipes.get(recipe)).time;
|
||||
int seconds = time / 20;
|
||||
GuiDraw.drawStringC(
|
||||
StatCollector.translateToLocalFormatted("tconstruct.nei.dryingrack.duration", time, seconds),
|
||||
StatCollector.translateToLocalFormatted(
|
||||
"tconstruct.nei.dryingrack.duration",
|
||||
formatNumber(time),
|
||||
formatNumber(seconds)),
|
||||
81,
|
||||
40,
|
||||
0x808080,
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package tconstruct.plugins.nei;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -92,7 +94,7 @@ public class RecipeHandlerMelting extends RecipeHandlerBase {
|
||||
@Override
|
||||
public void drawExtras(int recipe) {
|
||||
int temperature = ((CachedMeltingRecipe) this.arecipes.get(recipe)).temperature;
|
||||
GuiDraw.drawStringC(temperature + " C", 81, 9, ColorUtils.neiTemperature.getColor(), false);
|
||||
GuiDraw.drawStringC(formatNumber(temperature) + " C", 81, 9, ColorUtils.neiTemperature.getColor(), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package tconstruct.plugins.nei;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -107,26 +109,28 @@ public class RecipeHandlerToolMaterials extends RecipeHandlerBase {
|
||||
ColorUtils.materialName.getColor(),
|
||||
false);
|
||||
GuiDraw.drawString(
|
||||
StatCollector.translateToLocal("gui.partcrafter4") + crecipe.material.durability,
|
||||
StatCollector.translateToLocal("gui.partcrafter4") + formatNumber(crecipe.material.durability),
|
||||
35,
|
||||
20,
|
||||
ColorUtils.materialDurability.getColor(),
|
||||
false);
|
||||
GuiDraw.drawString(
|
||||
StatCollector.translateToLocal("gui.partcrafter5") + crecipe.material.handleModifier + "x",
|
||||
StatCollector.translateToLocal("gui.partcrafter5") + formatNumber(crecipe.material.handleModifier)
|
||||
+ "x",
|
||||
35,
|
||||
30,
|
||||
ColorUtils.materialHandleModifier1.getColor(),
|
||||
false);
|
||||
GuiDraw.drawString(
|
||||
StatCollector.translateToLocal("gui.partcrafter11")
|
||||
+ Math.round(crecipe.material.durability * crecipe.material.handleModifier),
|
||||
+ formatNumber(crecipe.material.durability * crecipe.material.handleModifier),
|
||||
35,
|
||||
40,
|
||||
ColorUtils.materialHandleModifier2.getColor(),
|
||||
false);
|
||||
GuiDraw.drawString(
|
||||
StatCollector.translateToLocal("gui.partcrafter6") + crecipe.material.miningspeed / 100F,
|
||||
StatCollector.translateToLocal("gui.partcrafter6")
|
||||
+ formatNumber(crecipe.material.miningspeed / 100F),
|
||||
35,
|
||||
50,
|
||||
ColorUtils.materialMiningSpeed.getColor(),
|
||||
@@ -142,14 +146,16 @@ public class RecipeHandlerToolMaterials extends RecipeHandlerBase {
|
||||
: StatCollector.translateToLocal("gui.partcrafter9");
|
||||
if (crecipe.material.attack() % 2 == 0) {
|
||||
GuiDraw.drawString(
|
||||
StatCollector.translateToLocal("gui.partcrafter10") + crecipe.material.attack / 2 + heart,
|
||||
StatCollector.translateToLocal("gui.partcrafter10") + formatNumber(crecipe.material.attack / 2)
|
||||
+ heart,
|
||||
35,
|
||||
70,
|
||||
ColorUtils.materialAttack1.getColor(),
|
||||
false);
|
||||
} else {
|
||||
GuiDraw.drawString(
|
||||
StatCollector.translateToLocal("gui.partcrafter10") + crecipe.material.attack / 2F + heart,
|
||||
StatCollector.translateToLocal("gui.partcrafter10") + formatNumber(crecipe.material.attack / 2F)
|
||||
+ heart,
|
||||
35,
|
||||
70,
|
||||
ColorUtils.materialAttack2.getColor(),
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package tconstruct.plugins.waila;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatFluid;
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -43,9 +46,9 @@ public class BasinDataProvider implements IWailaDataProvider {
|
||||
StatCollector.translateToLocal("tconstruct.waila.liquidtag")
|
||||
+ WailaRegistrar.fluidNameHelper(fs));
|
||||
currenttip.add(
|
||||
StatCollector.translateToLocal("tconstruct.waila.amounttag") + fs.amount
|
||||
+ "/"
|
||||
+ te.getCapacity());
|
||||
StatCollector.translateToLocal("tconstruct.waila.amounttag") + formatNumber(fs.amount)
|
||||
+ " / "
|
||||
+ formatFluid(te.getCapacity()));
|
||||
final int progress = te.getProgress();
|
||||
currenttip.add(StatCollector.translateToLocal("tconstruct.waila.progress") + progress + "%");
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package tconstruct.plugins.waila;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatFluid;
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -59,10 +62,14 @@ public class CastingChannelDataProvider implements IWailaDataProvider {
|
||||
String s1, s2, s3, s4;
|
||||
s1 = s2 = s3 = s4 = StatCollector.translateToLocal("tconstruct.waila.empty");
|
||||
|
||||
if (northTank.fluid != null) s1 = northTank.fluid.amount + " / " + northTank.capacity;
|
||||
if (southTank.fluid != null) s2 = southTank.fluid.amount + " / " + southTank.capacity;
|
||||
if (westTank.fluid != null) s3 = westTank.fluid.amount + " / " + westTank.capacity;
|
||||
if (eastTank.fluid != null) s4 = eastTank.fluid.amount + " / " + eastTank.capacity;
|
||||
if (northTank.fluid != null)
|
||||
s1 = formatNumber(northTank.fluid.amount) + " / " + formatFluid(northTank.capacity);
|
||||
if (southTank.fluid != null)
|
||||
s2 = formatNumber(southTank.fluid.amount) + " / " + formatFluid(southTank.capacity);
|
||||
if (westTank.fluid != null)
|
||||
s3 = formatNumber(westTank.fluid.amount) + " / " + formatFluid(westTank.capacity);
|
||||
if (eastTank.fluid != null)
|
||||
s4 = formatNumber(eastTank.fluid.amount) + " / " + formatFluid(eastTank.capacity);
|
||||
currenttip.add(s1 + "; " + s2 + "; " + s3 + "; " + s4);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package tconstruct.plugins.waila;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatFluid;
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -40,9 +43,9 @@ public class SearedTankDataProvider implements IWailaDataProvider {
|
||||
StatCollector.translateToLocal("tconstruct.waila.liquidtag")
|
||||
+ WailaRegistrar.fluidNameHelper(fs));
|
||||
currenttip.add(
|
||||
StatCollector.translateToLocal("tconstruct.waila.amounttag") + fs.amount
|
||||
+ "/"
|
||||
+ te.tank.getCapacity());
|
||||
StatCollector.translateToLocal("tconstruct.waila.amounttag") + formatNumber(fs.amount)
|
||||
+ " / "
|
||||
+ formatFluid(te.tank.getCapacity()));
|
||||
} else {
|
||||
currenttip.add(SpecialChars.ITALIC + StatCollector.translateToLocal("tconstruct.waila.empty"));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package tconstruct.plugins.waila;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatFluid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -40,7 +42,7 @@ public class SmelteryDataProvider implements IWailaDataProvider {
|
||||
currenttip.add(SpecialChars.ITALIC + StatCollector.translateToLocal("tconstruct.waila.empty"));
|
||||
} else {
|
||||
for (FluidStack st : fls) {
|
||||
currenttip.add(WailaRegistrar.fluidNameHelper(st) + " (" + st.amount + "mB)");
|
||||
currenttip.add(WailaRegistrar.fluidNameHelper(st) + " (" + formatFluid(st.amount) + ")");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package tconstruct.plugins.waila;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatFluid;
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -46,9 +49,9 @@ public class TableDataProvider implements IWailaDataProvider {
|
||||
StatCollector.translateToLocal("tconstruct.waila.liquidtag")
|
||||
+ WailaRegistrar.fluidNameHelper(te.getFluid()));
|
||||
currenttip.add(
|
||||
StatCollector.translateToLocal("tconstruct.waila.amounttag") + te.getFluidAmount()
|
||||
+ "/"
|
||||
+ te.getCapacity());
|
||||
StatCollector.translateToLocal("tconstruct.waila.amounttag") + formatNumber(te.getFluidAmount())
|
||||
+ " / "
|
||||
+ formatFluid(te.getCapacity()));
|
||||
final int progress = te.getProgress();
|
||||
currenttip.add(StatCollector.translateToLocal("tconstruct.waila.progress") + progress + "%");
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ public class WailaRegistrar {
|
||||
// Tanks
|
||||
registrar.registerBodyProvider(new SearedTankDataProvider(), LavaTankBlock.class);
|
||||
registrar.registerBodyProvider(new CastingChannelDataProvider(), CastingChannelLogic.class);
|
||||
// registrar.registerBodyProvider(new EssenceExtractorDataProvider(), EssenceExtractor.class);
|
||||
|
||||
// Casting systems
|
||||
registrar.registerBodyProvider(new BasinDataProvider(), CastingBasinLogic.class);
|
||||
|
||||
@@ -7,12 +7,14 @@ import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
@@ -23,7 +25,6 @@ import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import mantle.blocks.iface.IServantLogic;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.smeltery.itemblocks.LavaTankItemBlock;
|
||||
import tconstruct.smeltery.logic.LavaTankLogic;
|
||||
@@ -244,11 +245,17 @@ public class LavaTankBlock extends BlockContainer {
|
||||
}
|
||||
|
||||
/* Updates */
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block nBlockID) {
|
||||
TileEntity logic = world.getTileEntity(x, y, z);
|
||||
if (logic instanceof IServantLogic) {
|
||||
((IServantLogic) logic).notifyMasterOfChange();
|
||||
}
|
||||
if (!SmelteryBlock.isStructureChange(nBlockID)) return;
|
||||
|
||||
SmelteryBlock.notifyMasterOfStructureChange(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPreDestroy(World world, int x, int y, int z, int meta) {
|
||||
SmelteryBlock.notifyMasterOfStructureChange(world, x, y, z);
|
||||
super.onBlockPreDestroy(world, x, y, z, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -292,6 +299,25 @@ public class LavaTankBlock extends BlockContainer {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB entityBox,
|
||||
List<AxisAlignedBB> list, Entity entity) {
|
||||
|
||||
super.addCollisionBoxesToList(world, x, y, z, entityBox, list, entity);
|
||||
|
||||
AxisAlignedBB extraBox = AxisAlignedBB.getBoundingBox(
|
||||
x + 3.0 / 16.0,
|
||||
y + 1.0,
|
||||
z + 3.0 / 16.0,
|
||||
x + 13.0 / 16.0,
|
||||
y + 18.0 / 16.0,
|
||||
z + 13.0 / 16.0);
|
||||
|
||||
if (entityBox.intersectsWith(extraBox)) {
|
||||
list.add(extraBox);
|
||||
}
|
||||
}
|
||||
|
||||
// Comparator
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -26,6 +27,7 @@ import mantle.blocks.iface.IServantLogic;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.smeltery.SmelteryProxyCommon;
|
||||
import tconstruct.smeltery.TinkerSmeltery;
|
||||
import tconstruct.smeltery.logic.SmelteryDrainLogic;
|
||||
import tconstruct.smeltery.logic.SmelteryLogic;
|
||||
import tconstruct.smeltery.model.SmelteryRender;
|
||||
@@ -232,7 +234,25 @@ public class SmelteryBlock extends InventoryBlock {
|
||||
/* Updating */
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||
// System.out.println("Neighbor changed");
|
||||
if (!isStructureChange(block)) return;
|
||||
|
||||
notifyMasterOfStructureChange(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPreDestroy(World world, int x, int y, int z, int meta) {
|
||||
notifyMasterOfStructureChange(world, x, y, z);
|
||||
super.onBlockPreDestroy(world, x, y, z, meta);
|
||||
}
|
||||
|
||||
static boolean isStructureChange(Block block) {
|
||||
return block == Blocks.air || block == TinkerSmeltery.smeltery
|
||||
|| block == TinkerSmeltery.smelteryNether
|
||||
|| block == TinkerSmeltery.lavaTank
|
||||
|| block == TinkerSmeltery.lavaTankNether;
|
||||
}
|
||||
|
||||
static void notifyMasterOfStructureChange(World world, int x, int y, int z) {
|
||||
TileEntity logic = world.getTileEntity(x, y, z);
|
||||
if (logic instanceof IServantLogic) {
|
||||
((IServantLogic) logic).notifyMasterOfChange();
|
||||
@@ -241,17 +261,6 @@ public class SmelteryBlock extends InventoryBlock {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block blockID, int meta) {
|
||||
// TE is not valid anymore at this point. :/
|
||||
|
||||
TileEntity logic = world.getTileEntity(x, y, z);
|
||||
if (logic instanceof IServantLogic) {
|
||||
((IServantLogic) logic).notifyMasterOfChange();
|
||||
}
|
||||
super.breakBlock(world, x, y, z, blockID, meta);
|
||||
}
|
||||
|
||||
// Comparator
|
||||
|
||||
public boolean hasComparatorInputOverride() {
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package tconstruct.smeltery.gui;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatFluid;
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -22,6 +25,7 @@ import org.lwjgl.opengl.GL12;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.util.ColorUtils;
|
||||
import tconstruct.smeltery.inventory.ActiveContainer;
|
||||
import tconstruct.smeltery.inventory.SmelteryContainer;
|
||||
import tconstruct.smeltery.logic.SmelteryLogic;
|
||||
@@ -39,7 +43,6 @@ public class SmelteryGui extends ActiveContainerGui {
|
||||
private final int columns;
|
||||
private final int smelterySize;
|
||||
public static final int maxRows = 8;
|
||||
private int fuelDisplayTick = 0;
|
||||
|
||||
public SmelteryGui(InventoryPlayer inventoryplayer, SmelteryLogic smeltery, World world, int x, int y, int z) {
|
||||
super((ActiveContainer) smeltery.getGuiContainer(inventoryplayer, world, x, y, z));
|
||||
@@ -59,7 +62,6 @@ public class SmelteryGui extends ActiveContainerGui {
|
||||
return;
|
||||
}
|
||||
|
||||
if (fuelDisplayTick++ % 5 == 0) logic.updateFuelDisplay();
|
||||
updateScrollbar(mouseX, mouseY);
|
||||
|
||||
super.drawScreen(mouseX, mouseY, par3);
|
||||
@@ -113,12 +115,16 @@ public class SmelteryGui extends ActiveContainerGui {
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
int baseX = 86 + (columns - 3) * 22;
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("crafters.Smeltery"), baseX, 5, 0x404040);
|
||||
fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal("crafters.Smeltery"),
|
||||
baseX,
|
||||
5,
|
||||
ColorUtils.inventoryTitle.getColor());
|
||||
fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal("container.inventory"),
|
||||
baseX + 4,
|
||||
(ySize - 96) + 2,
|
||||
0x404040);
|
||||
ColorUtils.inventoryTitle.getColor());
|
||||
|
||||
int cornerX = (width - xSize) / 2 + 36 + (columns - 3) * 22;
|
||||
int cornerY = (height - ySize) / 2;
|
||||
@@ -272,10 +278,8 @@ public class SmelteryGui extends ActiveContainerGui {
|
||||
if (slotSize > columns * maxRows) slotSize = columns * maxRows;
|
||||
int iter;
|
||||
for (iter = 0; iter < slotSize && iter + slotPos * columns < smelterySize; iter++) {
|
||||
int slotTemp = logic.getTempForSlot(iter + slotPos * columns) - 20;
|
||||
int maxTemp = logic.getMeltingPointForSlot(iter + slotPos * columns) - 20;
|
||||
if (slotTemp > 0 && maxTemp > 0) {
|
||||
int size = Math.max(1, Math.min(16, 16 * slotTemp / maxTemp));
|
||||
int size = ((SmelteryContainer) inventorySlots).getHeatLevel(iter + slotPos * columns);
|
||||
if (size > 0) {
|
||||
drawTexturedModalRect(
|
||||
cornerX - xleft + (iter % columns * 22),
|
||||
cornerY + 8 + (iter / columns * 18) + 16 - size,
|
||||
@@ -343,7 +347,7 @@ public class SmelteryGui extends ActiveContainerGui {
|
||||
private List<String> getFuelTooltip() {
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
list.add("\u00A7f" + StatCollector.translateToLocal("gui.smeltery.fuel"));
|
||||
list.add(logic.fuelAmount + "/" + logic.fuelCapacity + " mB");
|
||||
list.add(formatNumber(logic.fuelAmount) + " / " + formatFluid(logic.fuelCapacity));
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -352,45 +356,55 @@ public class SmelteryGui extends ActiveContainerGui {
|
||||
String name = liquid.getFluid().getLocalizedName(liquid);
|
||||
list.add("\u00A7f" + name);
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
|
||||
list.add("mB: " + liquid.amount);
|
||||
list.add(formatFluid(liquid.amount));
|
||||
} else if (name.equals(StatCollector.translateToLocal("fluid.emerald.liquid"))) {
|
||||
list.add(StatCollector.translateToLocal("gui.smeltery.emerald") + liquid.amount / 640f);
|
||||
list.add(
|
||||
StatCollector
|
||||
.translateToLocalFormatted("gui.smeltery.emerald", formatNumber(liquid.amount / 640f)));
|
||||
} else if (name.equals(StatCollector.translateToLocal("fluid.quartz.molten"))) {
|
||||
list.add(StatCollector.translateToLocal("gui.smeltery.quartz") + liquid.amount / 250f);
|
||||
list.add(
|
||||
StatCollector.translateToLocalFormatted("gui.smeltery.quartz", formatNumber(liquid.amount / 250f)));
|
||||
} else if (name.equals(StatCollector.translateToLocal("fluid.glass.molten"))) {
|
||||
int blocks = liquid.amount / 1000;
|
||||
if (blocks > 0) list.add(StatCollector.translateToLocal("gui.smeltery.glass.block") + blocks);
|
||||
if (blocks > 0)
|
||||
list.add(StatCollector.translateToLocalFormatted("gui.smeltery.glass.block", formatNumber(blocks)));
|
||||
int panels = (liquid.amount % 1000) / 250;
|
||||
if (panels > 0) list.add(StatCollector.translateToLocal("gui.smeltery.glass.pannel") + panels);
|
||||
if (panels > 0)
|
||||
list.add(StatCollector.translateToLocalFormatted("gui.smeltery.glass.pannel", formatNumber(panels)));
|
||||
int mB = (liquid.amount % 1000) % 250;
|
||||
if (mB > 0) list.add("mB: " + mB);
|
||||
if (mB > 0) list.add(formatFluid(mB));
|
||||
} else if (name.equals(StatCollector.translateToLocal("fluid.stone.seared"))) {
|
||||
if (Loader.isModLoaded("dreamcraft")) {
|
||||
int blocks = liquid.amount / 360; // in gtnh each seared stone block is 360 mb of fluid
|
||||
if (blocks > 0) list.add(StatCollector.translateToLocal("gui.smeltery.glass.block") + blocks);
|
||||
if (blocks > 0)
|
||||
list.add(StatCollector.translateToLocalFormatted("gui.smeltery.glass.block", formatNumber(blocks)));
|
||||
// we also have no casting recipe for seared bricks
|
||||
int mB = liquid.amount % 360;
|
||||
if (mB > 0) list.add("mB: " + mB);
|
||||
if (mB > 0) list.add(formatFluid(mB));
|
||||
} else {
|
||||
int blocks = liquid.amount / TConstruct.ingotLiquidValue;
|
||||
if (blocks > 0) list.add(StatCollector.translateToLocal("gui.smeltery.glass.block") + blocks);
|
||||
if (blocks > 0)
|
||||
list.add(StatCollector.translateToLocalFormatted("gui.smeltery.glass.block", formatNumber(blocks)));
|
||||
int ingots = (liquid.amount % TConstruct.ingotLiquidValue) / (TConstruct.ingotLiquidValue / 4);
|
||||
if (ingots > 0) list.add(StatCollector.translateToLocal("gui.smeltery.metal.ingot") + ingots);
|
||||
if (ingots > 0)
|
||||
list.add(StatCollector.translateToLocalFormatted("gui.smeltery.metal.ingot", formatNumber(ingots)));
|
||||
int mB = (liquid.amount % TConstruct.ingotLiquidValue) % (TConstruct.ingotLiquidValue / 4);
|
||||
if (mB > 0) list.add("mB: " + mB);
|
||||
if (mB > 0) list.add(formatFluid(mB));
|
||||
}
|
||||
} else if (isMolten(name)) {
|
||||
int ingots = liquid.amount / TConstruct.ingotLiquidValue;
|
||||
if (ingots > 0) list.add(StatCollector.translateToLocal("gui.smeltery.metal.ingot") + ingots);
|
||||
if (ingots > 0)
|
||||
list.add(StatCollector.translateToLocalFormatted("gui.smeltery.metal.ingot", formatNumber(ingots)));
|
||||
int mB = liquid.amount % TConstruct.ingotLiquidValue;
|
||||
if (mB > 0) {
|
||||
int nuggets = mB / TConstruct.nuggetLiquidValue;
|
||||
int junk = (mB % TConstruct.nuggetLiquidValue);
|
||||
if (nuggets > 0) list.add(StatCollector.translateToLocal("gui.smeltery.metal.nugget") + nuggets);
|
||||
if (junk > 0) list.add("mB: " + junk);
|
||||
if (nuggets > 0) list.add(
|
||||
StatCollector.translateToLocalFormatted("gui.smeltery.metal.nugget", formatNumber(nuggets)));
|
||||
if (junk > 0) list.add(formatFluid(junk));
|
||||
}
|
||||
} else {
|
||||
list.add("mB: " + liquid.amount);
|
||||
list.add(formatFluid(liquid.amount));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,32 @@
|
||||
package tconstruct.smeltery.inventory;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.smeltery.TinkerSmeltery;
|
||||
import tconstruct.smeltery.gui.SmelteryGui;
|
||||
import tconstruct.smeltery.logic.SmelteryLogic;
|
||||
import tconstruct.util.network.SmelteryGuiPacket;
|
||||
|
||||
public class SmelteryContainer extends ActiveContainer {
|
||||
|
||||
public SmelteryLogic logic;
|
||||
public InventoryPlayer playerInv;
|
||||
public int fuel = 0;
|
||||
private int updateTicks;
|
||||
private int[] lastHeatRuns;
|
||||
private FluidStack lastFuel;
|
||||
private int lastFuelCapacity;
|
||||
private final byte[] heatLevels;
|
||||
private int slotRow;
|
||||
public int columns;
|
||||
public final int smelterySize;
|
||||
@@ -25,6 +37,7 @@ public class SmelteryContainer extends ActiveContainer {
|
||||
slotRow = 0;
|
||||
columns = smeltery.getBlocksPerLayer() >= 16 ? 4 : 3;
|
||||
smelterySize = smeltery.getBlockCapacity();
|
||||
heatLevels = new byte[smelterySize];
|
||||
|
||||
/* Smeltery inventory */
|
||||
|
||||
@@ -83,31 +96,64 @@ public class SmelteryContainer extends ActiveContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() // TODO: Sync with this
|
||||
{
|
||||
// we only update if the size is the same, since the screen is getting closed on sizechange and would cause a
|
||||
// crash otherwise
|
||||
if (smelterySize == this.inventorySlots.size()) super.detectAndSendChanges();
|
||||
/*
|
||||
* for (int i = 0; i < crafters.size(); i++) { ICrafting icrafting = (ICrafting)crafters.get(i); if (progress !=
|
||||
* logic.progress) { icrafting.sendProgressBarUpdate(this, 0, logic.progress); } if (fuel != logic.fuel) {
|
||||
* icrafting.sendProgressBarUpdate(this, 1, logic.fuel); } if (fuelGague != logic.fuelGague) {
|
||||
* icrafting.sendProgressBarUpdate(this, 2, logic.fuelGague); } } progress = logic.progress; fuel = logic.fuel;
|
||||
* fuelGague = logic.fuelGague;
|
||||
*/
|
||||
public void detectAndSendChanges() {
|
||||
// The GUI closes when the structure changes size. Its old Slot objects must not read the resized inventory.
|
||||
if (smelterySize != logic.getBlockCapacity() || updateTicks++ % 5 != 0) return;
|
||||
super.detectAndSendChanges();
|
||||
if (crafters.isEmpty()) return;
|
||||
logic.updateFuelDisplay();
|
||||
int[] heatRuns = getHeatRuns();
|
||||
FluidStack fuel = logic.getFuel();
|
||||
if (!Arrays.equals(heatRuns, lastHeatRuns) || !fuel.isFluidStackIdentical(lastFuel)
|
||||
|| logic.fuelCapacity != lastFuelCapacity) {
|
||||
for (Object crafter : crafters) {
|
||||
if (crafter instanceof EntityPlayerMP player) {
|
||||
TConstruct.packetPipeline
|
||||
.sendTo(new SmelteryGuiPacket(this, heatRuns, fuel, logic.fuelCapacity), player);
|
||||
}
|
||||
}
|
||||
lastHeatRuns = heatRuns;
|
||||
lastFuel = fuel;
|
||||
lastFuelCapacity = logic.fuelCapacity;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgressBar(int id, int value) {
|
||||
if (id == 0) {
|
||||
logic.fuelGague = value;
|
||||
public void addCraftingToCrafters(ICrafting crafter) {
|
||||
super.addCraftingToCrafters(crafter);
|
||||
if (crafter instanceof EntityPlayerMP player) {
|
||||
logic.updateFuelDisplay();
|
||||
TConstruct.packetPipeline
|
||||
.sendTo(new SmelteryGuiPacket(this, getHeatRuns(), logic.getFuel(), logic.fuelCapacity), player);
|
||||
}
|
||||
/*
|
||||
* if (id == 1) { logic.fuel = value; }
|
||||
*/
|
||||
/*
|
||||
* if (id == 2) { logic.fuelGague = value; }
|
||||
*/
|
||||
}
|
||||
|
||||
private int[] getHeatRuns() {
|
||||
IntStream.Builder runs = IntStream.builder();
|
||||
int previous = -1;
|
||||
for (int i = 0; i < smelterySize; i++) {
|
||||
int temperature = logic.getTempForSlot(i) - 20;
|
||||
int target = logic.getMeltingPointForSlot(i) - 20;
|
||||
int level = temperature > 0 && target > 0 ? Math.max(1, Math.min(16, 16 * temperature / target)) : 0;
|
||||
if (previous != -1 && level != previous) runs.add((i << 5) | previous);
|
||||
previous = level;
|
||||
}
|
||||
if (smelterySize > 0) runs.add((smelterySize << 5) | previous);
|
||||
return runs.build().toArray();
|
||||
}
|
||||
|
||||
public void updateGuiState(int[] heatRuns, FluidStack fuel, int fuelCapacity) {
|
||||
int start = 0;
|
||||
for (int run : heatRuns) {
|
||||
int end = run >>> 5;
|
||||
Arrays.fill(heatLevels, start, end, (byte) (run & 31));
|
||||
start = end;
|
||||
}
|
||||
logic.setFuelDisplay(fuel, fuelCapacity);
|
||||
}
|
||||
|
||||
public int getHeatLevel(int slot) {
|
||||
return heatLevels[slot];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package tconstruct.smeltery.itemblocks;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatFluid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -7,6 +9,8 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
|
||||
@@ -28,10 +32,12 @@ public class LavaTankItemBlock extends MultiItemBlock implements IFluidContainer
|
||||
if (stack.hasTagCompound()) {
|
||||
NBTTagCompound liquidTag = stack.getTagCompound().getCompoundTag("Fluid");
|
||||
if (liquidTag != null) {
|
||||
list.add(
|
||||
StatCollector.translateToLocal("searedtank1.tooltip") + " "
|
||||
+ StatCollector.translateToLocal(liquidTag.getString("FluidName")));
|
||||
list.add(liquidTag.getInteger("Amount") + " mB");
|
||||
|
||||
Fluid fluidInTank = FluidRegistry.getFluid(liquidTag.getString("FluidName"));
|
||||
String fluidName = fluidInTank == null ? "INVALID FLUID" : fluidInTank.getLocalizedName(null);
|
||||
|
||||
list.add(StatCollector.translateToLocalFormatted("searedtank1.tooltip", fluidName));
|
||||
list.add(formatFluid(liquidTag.getInteger("Amount")));
|
||||
}
|
||||
} else {
|
||||
list.add(StatCollector.translateToLocal("searedtank3.tooltip"));
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package tconstruct.smeltery.logic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.BitSet;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -15,6 +17,7 @@ import net.minecraft.entity.monster.EntityIronGolem;
|
||||
import net.minecraft.entity.passive.EntityHorse;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -36,8 +39,6 @@ import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import net.minecraftforge.fluids.IFluidTank;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import mantle.blocks.abstracts.InventoryLogic;
|
||||
import mantle.blocks.abstracts.MultiServantLogic;
|
||||
import mantle.blocks.iface.IActiveLogic;
|
||||
@@ -85,7 +86,20 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
|
||||
public int[] activeTemps; // values are multiplied by 10
|
||||
public int[] meltingTemps; // values are multiplied by 10
|
||||
private ItemStack[] cachedStacks = new ItemStack[0];
|
||||
private ItemStack[] renderStacks = new ItemStack[0];
|
||||
private FluidStack[] meltingResults = new FluidStack[0];
|
||||
private boolean inventoryDirty = true;
|
||||
private final BitSet heatingSlots = new BitSet();
|
||||
private final BitSet waitingSlots = new BitSet();
|
||||
private boolean tankChanged;
|
||||
private NBTTagCompound lastSentClientData;
|
||||
private NBTTagCompound lastReceivedClientData;
|
||||
private int[] clientRenderRuns = new int[0];
|
||||
private SmelteryRenderData renderData = new SmelteryRenderData(0, new int[0]);
|
||||
private FluidStack displayFuel;
|
||||
private int tick;
|
||||
private boolean structureCheckQueued;
|
||||
|
||||
public final List<FluidStack> moltenMetal = Collections.synchronizedList(new ArrayList<>());
|
||||
public int maxLiquid;
|
||||
@@ -95,6 +109,7 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
boolean needsUpdate;
|
||||
|
||||
private boolean drainComparatorOutputDirty;
|
||||
private int lastComparatorStrength = -1;
|
||||
|
||||
public SmelteryLogic() {
|
||||
super(0);
|
||||
@@ -124,6 +139,8 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
layers = lay;
|
||||
maxBlockCapacity = getBlocksPerLayer() * layers;
|
||||
maxLiquid = maxBlockCapacity * MB_PER_BLOCK_CAPACITY;
|
||||
resetInventoryCache();
|
||||
lastComparatorStrength = -1;
|
||||
|
||||
int[] tempActive = activeTemps;
|
||||
activeTemps = new int[maxBlockCapacity];
|
||||
@@ -205,6 +222,7 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
|
||||
// update current liquid. This is done in case some config or something changed the capacity or other things.
|
||||
updateCurrentLiquid();
|
||||
drainComparatorOutputDirty = true;
|
||||
}
|
||||
|
||||
/* Misc */
|
||||
@@ -215,6 +233,10 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
|
||||
@Override
|
||||
public Container getGuiContainer(InventoryPlayer inventoryplayer, World world, int x, int y, int z) {
|
||||
if (inventoryplayer.player instanceof EntityPlayerMP player) {
|
||||
// The client needs the current capacity before constructing its slots, ahead of batched world updates.
|
||||
player.playerNetServerHandler.sendPacket(getDescriptionPacket());
|
||||
}
|
||||
return new SmelteryContainer(inventoryplayer, this);
|
||||
}
|
||||
|
||||
@@ -260,7 +282,7 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
|
||||
@Override
|
||||
public void setActive(boolean flag) {
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
needsUpdate = true;
|
||||
}
|
||||
|
||||
public int getScaledFuelGague(int scale) {
|
||||
@@ -287,20 +309,20 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
/* Updating */
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (worldObj.isRemote) return;
|
||||
checkStructureIfQueued();
|
||||
|
||||
tick++;
|
||||
if (tick == 60) {
|
||||
tick = 0;
|
||||
detectEntities();
|
||||
}
|
||||
|
||||
/*
|
||||
* if (worldObj.isRemote) return;
|
||||
*/
|
||||
|
||||
if (tick % 4 == 0) {
|
||||
if (useTime > 0) useTime -= 4;
|
||||
|
||||
if (validStructure) {
|
||||
refreshInventory();
|
||||
checkHasItems();
|
||||
|
||||
// consume fuel if needed
|
||||
@@ -310,25 +332,38 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
}
|
||||
}
|
||||
|
||||
if (tick % 5 == 0 && needsUpdate) {
|
||||
NBTTagCompound data = writeClientData();
|
||||
needsUpdate = false;
|
||||
if (!data.equals(lastSentClientData)) {
|
||||
lastSentClientData = data;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
if (tick % 20 == 0) {
|
||||
if (!validStructure) checkValidPlacement();
|
||||
|
||||
if (needsUpdate) {
|
||||
needsUpdate = false;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
if (drainComparatorOutputDirty) {
|
||||
// tank dirty, update drains
|
||||
for (CoordTuple drain : drains) {
|
||||
// this obfuscated method will propagate a block update (and weak updates) around give coord
|
||||
worldObj.func_147453_f(drain.x, drain.y, drain.z, worldObj.getBlock(drain.x, drain.y, drain.z));
|
||||
int strength = maxLiquid == 0 ? 0 : MathHelper.ceiling_float_int(15f * currentLiquid / maxLiquid);
|
||||
if (strength != lastComparatorStrength) {
|
||||
lastComparatorStrength = strength;
|
||||
for (CoordTuple drain : drains) {
|
||||
worldObj.func_147453_f(drain.x, drain.y, drain.z, worldObj.getBlock(drain.x, drain.y, drain.z));
|
||||
}
|
||||
}
|
||||
drainComparatorOutputDirty = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkStructureIfQueued() {
|
||||
if (structureCheckQueued) {
|
||||
structureCheckQueued = false;
|
||||
checkValidPlacement();
|
||||
}
|
||||
}
|
||||
|
||||
void detectEntities() {
|
||||
if (!validStructure || minPos == null || maxPos == null) return;
|
||||
|
||||
@@ -404,106 +439,120 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
|
||||
if (!itemDestroyed) item.setEntityItemStack(istack);
|
||||
if (itemAdded) {
|
||||
this.needsUpdate = true;
|
||||
// TODO 1.7.5 send description packet in better way to not cause render update
|
||||
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||
markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
private void checkHasItems() {
|
||||
inUse = false;
|
||||
for (int i = 0; i < maxBlockCapacity; i++) if (this.isStackInSlot(i) && meltingTemps[i] > 200) {
|
||||
inUse = true;
|
||||
break;
|
||||
}
|
||||
inUse = !heatingSlots.isEmpty() || !waitingSlots.isEmpty();
|
||||
}
|
||||
|
||||
private void heatItems() {
|
||||
if (tankChanged) {
|
||||
heatingSlots.or(waitingSlots);
|
||||
waitingSlots.clear();
|
||||
tankChanged = false;
|
||||
}
|
||||
if (useTime > 0) {
|
||||
boolean hasUse = false;
|
||||
int temperature = this.getInternalTemperature();
|
||||
int speed = temperature / 100;
|
||||
int refTemp = temperature * 10;
|
||||
for (int i = 0; i < maxBlockCapacity; i++) {
|
||||
for (int i = heatingSlots.nextSetBit(0); i >= 0; i = heatingSlots.nextSetBit(i + 1)) {
|
||||
if (meltingTemps[i] > 200 && this.isStackInSlot(i)) {
|
||||
hasUse = true;
|
||||
if (activeTemps[i] < refTemp && activeTemps[i] < meltingTemps[i]) {
|
||||
boolean wasVisible = activeTemps[i] / 10 > 20;
|
||||
activeTemps[i] += speed; // lava has temp of 1000. we increase by 10 per application.
|
||||
if (!wasVisible && activeTemps[i] / 10 > 20) needsUpdate = true;
|
||||
} else if (activeTemps[i] >= meltingTemps[i]) {
|
||||
if (!worldObj.isRemote) {
|
||||
FluidStack result = getResultFor(inventory[i]);
|
||||
if (result != null) {
|
||||
if (addMoltenMetal(result, false)) {
|
||||
inventory[i] = null;
|
||||
activeTemps[i] = 200;
|
||||
ArrayList<FluidStack> alloys = Smeltery.mixMetals(moltenMetal);
|
||||
for (FluidStack liquid : alloys) {
|
||||
addMoltenMetal(liquid, true);
|
||||
}
|
||||
markDirty();
|
||||
}
|
||||
}
|
||||
FluidStack result = meltingResults[i];
|
||||
if (result != null && result.amount <= maxLiquid - currentLiquid
|
||||
&& addMoltenMetal(result, false)) {
|
||||
inventory[i] = null;
|
||||
activeTemps[i] = 200;
|
||||
meltingTemps[i] = 200;
|
||||
cachedStacks[i] = null;
|
||||
meltingResults[i] = null;
|
||||
renderStacks[i] = null;
|
||||
heatingSlots.clear(i);
|
||||
mixMetals();
|
||||
} else {
|
||||
heatingSlots.clear(i);
|
||||
waitingSlots.set(i);
|
||||
}
|
||||
}
|
||||
|
||||
} else activeTemps[i] = 200;
|
||||
} else {
|
||||
activeTemps[i] = 200;
|
||||
heatingSlots.clear(i);
|
||||
}
|
||||
}
|
||||
inUse = hasUse;
|
||||
checkHasItems();
|
||||
}
|
||||
}
|
||||
|
||||
boolean addMoltenMetal(FluidStack liquid, boolean first) {
|
||||
needsUpdate = true;
|
||||
if (moltenMetal.size() == 0) {
|
||||
// does it fit in?
|
||||
if (liquid.amount > this.getCapacity()) return false;
|
||||
|
||||
moltenMetal.add(liquid.copy());
|
||||
updateCurrentLiquid();
|
||||
} else {
|
||||
// update liquid amount..
|
||||
updateCurrentLiquid();
|
||||
|
||||
if (liquid.amount + currentLiquid > maxLiquid) return false;
|
||||
|
||||
currentLiquid += liquid.amount;
|
||||
drainComparatorOutputDirty = true;
|
||||
// TConstruct.logger.info("Current liquid: "+currentLiquid);
|
||||
boolean added = false;
|
||||
for (int i = 0; i < moltenMetal.size(); i++) {
|
||||
FluidStack l = moltenMetal.get(i);
|
||||
// if (l.itemID == liquid.itemID && l.itemMeta ==
|
||||
// liquid.itemMeta)
|
||||
if (l.isFluidEqual(liquid)) {
|
||||
l.amount += liquid.amount;
|
||||
added = true;
|
||||
}
|
||||
if (l.amount <= 0) {
|
||||
moltenMetal.remove(l);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
if (!added) {
|
||||
if (first) moltenMetal.add(0, liquid.copy());
|
||||
else moltenMetal.add(liquid.copy());
|
||||
// Alloy recipes consume the existing stacks before returning their products.
|
||||
updateCurrentLiquid();
|
||||
if (liquid.amount <= 0 || liquid.amount > maxLiquid - currentLiquid) return false;
|
||||
moltenMetal.removeIf(fluid -> fluid.amount <= 0);
|
||||
for (FluidStack stored : moltenMetal) {
|
||||
if (stored.isFluidEqual(liquid)) {
|
||||
stored.amount += liquid.amount;
|
||||
currentLiquid += liquid.amount;
|
||||
markTankDirty();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
moltenMetal.add(first ? 0 : moltenMetal.size(), liquid.copy());
|
||||
currentLiquid += liquid.amount;
|
||||
markTankDirty();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void updateCurrentLiquid() {
|
||||
currentLiquid = 0;
|
||||
for (FluidStack liquid : moltenMetal) currentLiquid += liquid.amount;
|
||||
drainComparatorOutputDirty = true;
|
||||
}
|
||||
|
||||
private void updateTemperatures() {
|
||||
for (int i = 0; i < maxBlockCapacity && i < meltingTemps.length; i++) {
|
||||
meltingTemps[i] = Smeltery.getLiquifyTemperature(inventory[i]) * 10; // temperatures are *10 for more
|
||||
// progress control
|
||||
private void mixMetals() {
|
||||
for (FluidStack liquid : Smeltery.mixMetals(moltenMetal)) {
|
||||
addMoltenMetal(liquid, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void resetInventoryCache() {
|
||||
heatingSlots.clear();
|
||||
waitingSlots.clear();
|
||||
cachedStacks = new ItemStack[maxBlockCapacity];
|
||||
renderStacks = new ItemStack[maxBlockCapacity];
|
||||
meltingResults = new FluidStack[maxBlockCapacity];
|
||||
inventoryDirty = true;
|
||||
}
|
||||
|
||||
private void refreshInventory() {
|
||||
if (!inventoryDirty) return;
|
||||
inventoryDirty = false;
|
||||
for (int i = 0; i < maxBlockCapacity; i++) {
|
||||
ItemStack stack = inventory[i];
|
||||
if (!ItemStack.areItemStacksEqual(stack, cachedStacks[i])) {
|
||||
cachedStacks[i] = stack == null ? null : stack.copy();
|
||||
meltingTemps[i] = Smeltery.getLiquifyTemperature(stack) * 10;
|
||||
meltingResults[i] = getResultFor(stack);
|
||||
renderStacks[i] = stack == null ? null : Smeltery.getRenderIndex(stack);
|
||||
waitingSlots.clear(i);
|
||||
heatingSlots.set(i, stack != null && meltingTemps[i] > 200);
|
||||
if (!heatingSlots.get(i)) activeTemps[i] = 200;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void markTankDirty() {
|
||||
tankChanged = true;
|
||||
needsUpdate = true;
|
||||
drainComparatorOutputDirty = true;
|
||||
super.markDirty();
|
||||
}
|
||||
|
||||
public void updateFuelDisplay() {
|
||||
int totalAmount = 0;
|
||||
int totalCapacity = 0;
|
||||
@@ -539,6 +588,7 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
|
||||
fuelAmount = totalAmount;
|
||||
fuelCapacity = totalCapacity;
|
||||
displayFuel = fuelType == null ? null : new FluidStack(fuelType, totalAmount);
|
||||
}
|
||||
|
||||
// actually is updateFuel.
|
||||
@@ -613,37 +663,14 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
// empty
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public FluidStack getFuel() {
|
||||
FluidStack combined = null;
|
||||
return displayFuel == null ? new FluidStack(FluidRegistry.LAVA, 0) : displayFuel.copy();
|
||||
}
|
||||
|
||||
synchronized (lavaTanks) {
|
||||
Iterator<CoordTuple> iter = lavaTanks.iterator();
|
||||
while (iter.hasNext()) {
|
||||
CoordTuple coord = iter.next();
|
||||
if (!worldObj.blockExists(coord.x, coord.y, coord.z)) continue;
|
||||
|
||||
TileEntity te = worldObj.getTileEntity(coord.x, coord.y, coord.z);
|
||||
if (!(te instanceof IFluidHandler)) {
|
||||
iter.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
FluidTankInfo[] info = ((IFluidHandler) te).getTankInfo(ForgeDirection.DOWN);
|
||||
if (info.length <= 0 || info[0].fluid == null || info[0].fluid.amount <= 0) continue;
|
||||
|
||||
if (combined == null) {
|
||||
combined = info[0].fluid.copy();
|
||||
} else if (combined.isFluidEqual(info[0].fluid)) {
|
||||
combined.amount += info[0].fluid.amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (combined == null) {
|
||||
return new FluidStack(FluidRegistry.LAVA, 0);
|
||||
}
|
||||
return combined;
|
||||
public void setFuelDisplay(FluidStack fuel, int capacity) {
|
||||
displayFuel = fuel;
|
||||
fuelAmount = fuel == null ? 0 : fuel.amount;
|
||||
fuelCapacity = capacity;
|
||||
}
|
||||
|
||||
public FluidStack getResultFor(ItemStack stack) {
|
||||
@@ -663,7 +690,7 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
updateTemperatures();
|
||||
inventoryDirty = true;
|
||||
|
||||
super.markDirty();
|
||||
needsUpdate = true;
|
||||
@@ -680,7 +707,7 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
/* Multiblock */
|
||||
@Override
|
||||
public void notifyChange(IServantLogic servant, int x, int y, int z) {
|
||||
checkValidPlacement();
|
||||
structureCheckQueued = true;
|
||||
}
|
||||
|
||||
public void checkValidPlacement() {
|
||||
@@ -799,11 +826,11 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
|
||||
// update other stuff
|
||||
adjustLayers(checkLayers, true);
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
needsUpdate = true;
|
||||
validStructure = true;
|
||||
} else {
|
||||
internalTemp = 20;
|
||||
if (validStructure) worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
if (validStructure) needsUpdate = true;
|
||||
validStructure = false;
|
||||
}
|
||||
}
|
||||
@@ -980,18 +1007,15 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
if (doDrain) {
|
||||
// liquid = null;
|
||||
moltenMetal.remove(liquid);
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
needsUpdate = true;
|
||||
updateCurrentLiquid();
|
||||
markTankDirty();
|
||||
}
|
||||
return liq;
|
||||
} else {
|
||||
if (doDrain && maxDrain > 0) {
|
||||
liquid.amount -= maxDrain;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
currentLiquid -= maxDrain;
|
||||
drainComparatorOutputDirty = true;
|
||||
needsUpdate = true;
|
||||
markTankDirty();
|
||||
}
|
||||
return new FluidStack(liquid.getFluid(), maxDrain, liquid.tag);
|
||||
}
|
||||
@@ -1002,28 +1026,14 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
|
||||
@Override
|
||||
public int fill(FluidStack resource, boolean doFill) {
|
||||
// don't fill if we're not complete
|
||||
if (!validStructure) return 0;
|
||||
|
||||
if (resource != null && currentLiquid < maxLiquid) // resource.amount +
|
||||
// currentLiquid <
|
||||
// maxLiquid)
|
||||
{
|
||||
if (resource.amount + currentLiquid > maxLiquid) resource.amount = maxLiquid - currentLiquid;
|
||||
int amount = resource.amount;
|
||||
|
||||
if (amount > 0 && doFill) {
|
||||
if (addMoltenMetal(resource, false)) {
|
||||
ArrayList<FluidStack> alloys = Smeltery.mixMetals(moltenMetal);
|
||||
for (FluidStack liquid : alloys) {
|
||||
addMoltenMetal(liquid, true);
|
||||
}
|
||||
}
|
||||
needsUpdate = true;
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
}
|
||||
return amount;
|
||||
} else return 0;
|
||||
if (!validStructure || resource == null || resource.amount <= 0) return 0;
|
||||
int amount = Math.min(resource.amount, Math.max(0, maxLiquid - currentLiquid));
|
||||
if (amount == 0 || !doFill) return amount;
|
||||
FluidStack accepted = resource.copy();
|
||||
accepted.amount = amount;
|
||||
if (!addMoltenMetal(accepted, false)) return 0;
|
||||
mixMetals();
|
||||
return amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1066,6 +1076,7 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
else maxPos = new CoordTuple(xCoord, yCoord, zCoord);
|
||||
|
||||
maxBlockCapacity = getBlocksPerLayer() * layers;
|
||||
resetInventoryCache();
|
||||
inventory = new ItemStack[maxBlockCapacity];
|
||||
super.readFromNBT(tags);
|
||||
|
||||
@@ -1139,19 +1150,80 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
}
|
||||
|
||||
/* Packets */
|
||||
private NBTTagCompound writeClientData() {
|
||||
refreshInventory();
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setBoolean("ValidStructure", validStructure);
|
||||
data.setIntArray("MinPos", new int[] { minPos.x, minPos.y, minPos.z });
|
||||
data.setIntArray("MaxPos", new int[] { maxPos.x, maxPos.y, maxPos.z });
|
||||
data.setInteger("Layers", layers);
|
||||
data.setInteger("MaxLiquid", maxLiquid);
|
||||
data.setByte("Direction", direction);
|
||||
data.setIntArray("Render", SmelteryRenderData.encode(inventory, renderStacks, activeTemps));
|
||||
NBTTagList fluids = new NBTTagList();
|
||||
for (FluidStack fluid : moltenMetal) fluids.appendTag(fluid.copy().writeToNBT(new NBTTagCompound()));
|
||||
data.setTag("Liquids", fluids);
|
||||
return data;
|
||||
}
|
||||
|
||||
public SmelteryRenderData getRenderData() {
|
||||
return renderData;
|
||||
}
|
||||
|
||||
public void reorderFluid(int fluidId, boolean last) {
|
||||
for (int i = 0; i < moltenMetal.size(); i++) {
|
||||
if (moltenMetal.get(i).getFluidID() == fluidId) {
|
||||
int target = last ? moltenMetal.size() - 1 : 0;
|
||||
if (i != target) {
|
||||
moltenMetal.add(target, moltenMetal.remove(i));
|
||||
markTankDirty();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
writeToNBT(tag);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, writeClientData());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
|
||||
readFromNBT(packet.func_148857_g());
|
||||
markDirty();
|
||||
NBTTagCompound data = packet.func_148857_g();
|
||||
if (data.equals(lastReceivedClientData)) return;
|
||||
lastReceivedClientData = (NBTTagCompound) data.copy();
|
||||
int[] min = data.getIntArray("MinPos");
|
||||
int[] max = data.getIntArray("MaxPos");
|
||||
minPos = new CoordTuple(min[0], min[1], min[2]);
|
||||
maxPos = new CoordTuple(max[0], max[1], max[2]);
|
||||
layers = data.getInteger("Layers");
|
||||
maxLiquid = data.getInteger("MaxLiquid");
|
||||
direction = data.getByte("Direction");
|
||||
validStructure = data.getBoolean("ValidStructure");
|
||||
int size = getBlocksPerLayer() * layers;
|
||||
boolean resized = size != maxBlockCapacity;
|
||||
if (resized) {
|
||||
maxBlockCapacity = size;
|
||||
inventory = new ItemStack[size];
|
||||
activeTemps = new int[size];
|
||||
meltingTemps = new int[size];
|
||||
}
|
||||
int[] runs = data.getIntArray("Render");
|
||||
if (resized || !Arrays.equals(runs, clientRenderRuns)) {
|
||||
clientRenderRuns = runs;
|
||||
renderData = new SmelteryRenderData(size, runs);
|
||||
}
|
||||
NBTTagList fluids = data.getTagList("Liquids", 10);
|
||||
synchronized (moltenMetal) {
|
||||
moltenMetal.clear();
|
||||
for (int i = 0; i < fluids.tagCount(); i++) {
|
||||
FluidStack fluid = FluidStack.loadFluidStackFromNBT(fluids.getCompoundTagAt(i));
|
||||
if (fluid != null) moltenMetal.add(fluid);
|
||||
}
|
||||
updateCurrentLiquid();
|
||||
}
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
this.needsUpdate = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
package tconstruct.smeltery.logic;
|
||||
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
/** The block appearance of the contents, independent of the GUI's actual inventory stacks. */
|
||||
public final class SmelteryRenderData {
|
||||
|
||||
private final int[] blocks;
|
||||
private final int[] metadata;
|
||||
private final float[] heights;
|
||||
|
||||
public SmelteryRenderData(int size, int[] runs) {
|
||||
blocks = new int[size];
|
||||
metadata = new int[size];
|
||||
heights = new float[size];
|
||||
int start = 0;
|
||||
for (int i = 0; i < runs.length; i += 4) {
|
||||
int end = runs[i];
|
||||
java.util.Arrays.fill(blocks, start, end, runs[i + 1]);
|
||||
java.util.Arrays.fill(metadata, start, end, runs[i + 2]);
|
||||
java.util.Arrays.fill(heights, start, end, Float.intBitsToFloat(runs[i + 3]));
|
||||
start = end;
|
||||
}
|
||||
}
|
||||
|
||||
/** Each run stores its exclusive end, block ID, metadata and exact rendered height. */
|
||||
public static int[] encode(ItemStack[] inventory, ItemStack[] renderStacks, int[] temperatures) {
|
||||
IntStream.Builder runs = IntStream.builder();
|
||||
int previousBlock = -1;
|
||||
int previousMeta = 0;
|
||||
int previousHeight = 0;
|
||||
for (int slot = 0; slot < inventory.length; slot++) {
|
||||
int block = 0;
|
||||
int meta = 0;
|
||||
int height = 0;
|
||||
ItemStack input = inventory[slot];
|
||||
ItemStack render = renderStacks[slot];
|
||||
if (input != null && render != null && temperatures[slot] / 10 > 20) {
|
||||
block = Block.getIdFromBlock(Block.getBlockFromItem(render.getItem()));
|
||||
meta = render.getItemDamage();
|
||||
height = Float.floatToIntBits(
|
||||
MathHelper.clamp_float(input.stackSize / (float) render.stackSize, 0.01F, 1.0F));
|
||||
}
|
||||
if (block != previousBlock || meta != previousMeta || height != previousHeight) {
|
||||
if (slot > 0) runs.add(slot).add(previousBlock).add(previousMeta).add(previousHeight);
|
||||
previousBlock = block;
|
||||
previousMeta = meta;
|
||||
previousHeight = height;
|
||||
}
|
||||
}
|
||||
if (inventory.length > 0) {
|
||||
runs.add(inventory.length).add(previousBlock).add(previousMeta).add(previousHeight);
|
||||
}
|
||||
return runs.build().toArray();
|
||||
}
|
||||
|
||||
public Block getBlock(int slot) {
|
||||
return Block.getBlockById(blocks[slot]);
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return blocks.length;
|
||||
}
|
||||
|
||||
public int getMetadata(int slot) {
|
||||
return metadata[slot];
|
||||
}
|
||||
|
||||
public float getHeight(int slot) {
|
||||
return heights[slot];
|
||||
}
|
||||
}
|
||||
@@ -4,21 +4,19 @@ import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import tconstruct.client.BlockSkinRenderHelper;
|
||||
import tconstruct.smeltery.logic.CastingChannelLogic;
|
||||
import tconstruct.util.ItemHelper;
|
||||
|
||||
/**
|
||||
* @author BluSunrize
|
||||
@@ -28,31 +26,16 @@ public class BlockRenderCastingChannel implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
private static final float[][] CHANNEL_BOUNDS = { { 0.3125F, 0.375F, 0.3125F, 0.6875F, 0.5F, 0.6875F },
|
||||
{ 0.3125F, 0.375F, 0.0F, 0.6875F, 0.5F, 0.3125F }, { 0.3125F, 0.5F, 0.0F, 0.375F, 0.625F, 0.3125F },
|
||||
{ 0.625F, 0.5F, 0.0F, 0.6875F, 0.625F, 0.3125F }, { 0.3125F, 0.375F, 0.6875F, 0.6875F, 0.5F, 1.0F },
|
||||
{ 0.3125F, 0.5F, 0.6875F, 0.375F, 0.625F, 1.0F }, { 0.625F, 0.5F, 0.6875F, 0.6875F, 0.625F, 1.0F },
|
||||
{ 0.3125F, 0.375F, 0.3125F, 0.375F, 0.625F, 0.6875F },
|
||||
{ 0.625F, 0.375F, 0.3125F, 0.6875F, 0.625F, 0.6875F } };
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
// Floor
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0.3125D, 0.6875D, 0.5D, 0.6875D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
// Channel Z-
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0D, 0.6875D, 0.5D, 0.3125D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
renderer.setRenderBounds(0.3125D, 0.5D, 0D, 0.375D, 0.625D, 0.3125D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0D, 0.6875D, 0.625D, 0.3125D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
// Channel Z+
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0.6875D, 0.6875D, 0.5D, 1D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
renderer.setRenderBounds(0.3125D, 0.5D, 0.6875D, 0.375D, 0.625D, 1D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0.6875D, 0.6875D, 0.625D, 1D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
// Wall X-
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0.3125D, 0.375D, 0.625D, 0.6875D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
// Wall X+
|
||||
renderer.setRenderBounds(0.625D, 0.375D, 0.3125D, 0.6875D, 0.625D, 0.6875D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata, CHANNEL_BOUNDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -200,36 +183,6 @@ public class BlockRenderCastingChannel implements ISimpleBlockRenderingHandler {
|
||||
fluid.getColor(fluidStack));
|
||||
}
|
||||
|
||||
private void renderStandardBlock(Block block, int meta, RenderBlocks renderer) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, -1.0F, 0.0F);
|
||||
renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, -1.0F);
|
||||
renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||
renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1.0F, 0.0F, 0.0F);
|
||||
renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||
renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, meta));
|
||||
tessellator.draw();
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return renderID;
|
||||
|
||||
@@ -24,96 +24,34 @@ public class CastingBlockRender implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public static int searedModel = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
private static final float[][] TABLE_BOUNDS = { { 0.0F, 0.625F, 0.0F, 1.0F, 0.9375F, 1.0F },
|
||||
{ 0.0F, 0.9375F, 0.0F, 0.0625F, 1.0F, 1.0F }, { 0.0625F, 0.9375F, 0.9375F, 0.9375F, 1.0F, 1.0F },
|
||||
{ 0.9375F, 0.9375F, 0.0F, 1.0F, 1.0F, 1.0F }, { 0.0625F, 0.9375F, 0.0F, 0.9375F, 1.0F, 0.0625F },
|
||||
{ 0.0F, 0.0F, 0.0F, 0.3125F, 0.625F, 0.3125F }, { 0.6875F, 0.0F, 0.0F, 1.0F, 0.625F, 0.25F },
|
||||
{ 0.0F, 0.0F, 0.6875F, 0.3125F, 0.625F, 1.0F }, { 0.6875F, 0.0F, 0.6875F, 1.0F, 0.625F, 1.0F } };
|
||||
|
||||
private static final float[][] FAUCET_BOUNDS = { { 0.25F, 0.25F, 0.625F, 0.75F, 0.375F, 1.0F },
|
||||
{ 0.25F, 0.25F, 0.625F, 0.375F, 0.625F, 1.0F }, { 0.625F, 0.25F, 0.625F, 0.75F, 0.625F, 1.0F } };
|
||||
|
||||
private static final float[][] BASIN_BOUNDS = { { 0.125F, 0.125F, 0.125F, 0.875F, 0.25F, 0.875F },
|
||||
{ 0.0F, 0.0F, 0.0F, 0.3125F, 0.125F, 0.3125F }, { 0.6875F, 0.0F, 0.0F, 1.0F, 0.125F, 0.3125F },
|
||||
{ 0.0F, 0.0F, 0.6875F, 0.3125F, 0.125F, 1.0F }, { 0.6875F, 0.0F, 0.6875F, 1.0F, 0.125F, 1.0F },
|
||||
{ 0.0F, 0.125F, 0.0F, 0.125F, 1.0F, 1.0F }, { 0.875F, 0.125F, 0.0F, 1.0F, 1.0F, 1.0F },
|
||||
{ 0.125F, 0.125F, 0.0F, 0.875F, 1.0F, 0.125F }, { 0.125F, 0.125F, 0.875F, 0.875F, 1.0F, 1.0F } };
|
||||
|
||||
private static final float[][] FULL_BOUNDS = { { 0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F } };
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
if (modelID == searedModel) {
|
||||
if (metadata == 0) {
|
||||
// Top
|
||||
renderer.setRenderBounds(0.0F, 0.625F, 0.0F, 1.0F, 0.9375F, 1.0F);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
|
||||
// Lip
|
||||
renderer.setRenderBounds(0.0F, 0.9375, 0.0F, 0.0625, 1.0, 1.0F);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.0625, 0.9375, 0.9375, 0.9375, 1.0, 1.0F);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.9375, 0.9375, 0.0F, 1.0F, 1.0, 1.0F);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.0625, 0.9375, 0.0F, 0.9375, 1.0, 0.0625);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
|
||||
// Legs
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 0.3125F, 0.625F, 0.3125F);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.6875, 0.0F, 0.0F, 1.0F, 0.625F, 0.25F);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.6875, 0.3125F, 0.625F, 1.0F);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.6875, 0.0F, 0.6875, 1.0F, 0.625F, 1.0F);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata, TABLE_BOUNDS);
|
||||
} else if (metadata == 1) {
|
||||
renderer.setRenderBounds(0.25, 0.25, 0.625, 0.75, 0.375, 1);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.25, 0.25, 0.625, 0.375, 0.625, 1);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.625, 0.25, 0.625, 0.75, 0.625, 1);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.375, 0.375, 0.625, 0.625, 0.625, 1);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata, FAUCET_BOUNDS);
|
||||
} else if (metadata == 2) {
|
||||
renderer.setRenderBounds(0.125F, 0.125f, 0.125F, 0.875F, 0.25F, 0.875F);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
|
||||
// Details
|
||||
/*
|
||||
* renderer.setRenderBounds(0.001f, 0.1245f, 0.001f, 0.1245f, 0.999f, 0.4375f);
|
||||
* ItemHelper.renderStandardInvBlock(renderer, block, metadata); renderer.setRenderBounds(0.001f,
|
||||
* 0.1245f, 0.5625f, 0.1245f, 0.999f, 0.999f); ItemHelper.renderStandardInvBlock(renderer, block,
|
||||
* metadata); renderer.setRenderBounds(0.001f, 0.8755f, 0.4375f, 0.1245f, 0.999f, 0.5625f);
|
||||
* ItemHelper.renderStandardInvBlock(renderer, block, metadata); renderer.setRenderBounds(0.001f,
|
||||
* 0.1245f, 0.4375f, 0.1245f, 0.25F, 0.5625f); ItemHelper.renderStandardInvBlock(renderer, block,
|
||||
* metadata); renderer.setRenderBounds(0.8755f, 0.1245f, 0f, 0.999f, 0.999f, 0.4375f);
|
||||
* ItemHelper.renderStandardInvBlock(renderer, block, metadata); renderer.setRenderBounds(0.8755f,
|
||||
* 0.1245f, 0.5625f, 0.999f, 0.999f, 0.999f); ItemHelper.renderStandardInvBlock(renderer, block,
|
||||
* metadata); renderer.setRenderBounds(0.8755f, 0.8755f, 0.4375f, 0.999f, 0.999f, 0.5625f);
|
||||
* ItemHelper.renderStandardInvBlock(renderer, block, metadata); renderer.setRenderBounds(0.8755f,
|
||||
* 0.1245f, 0.4375f, 0.999f, 0.25F, 0.5625f); ItemHelper.renderStandardInvBlock(renderer, block,
|
||||
* metadata); renderer.setRenderBounds(0.1245f, 0.1245f, 0.8755f, 0.4375f, 0.999f, 0.999f);
|
||||
* ItemHelper.renderStandardInvBlock(renderer, block, metadata); renderer.setRenderBounds(0.5625f,
|
||||
* 0.1245f, 0.8755f, 0.8755f, 0.999f, 0.999f); ItemHelper.renderStandardInvBlock(renderer, block,
|
||||
* metadata); renderer.setRenderBounds(0.4375f, 0.8755f, 0.8755f, 0.5625f, 0.999f, 0.999f);
|
||||
* ItemHelper.renderStandardInvBlock(renderer, block, metadata); renderer.setRenderBounds(0.4375f,
|
||||
* 0.1245f, 0.8755f, 0.5625f, 0.2495F, 0.999f); ItemHelper.renderStandardInvBlock(renderer, block,
|
||||
* metadata); renderer.setRenderBounds(0.1245f, 0.1245f, 0.001f, 0.4375f, 0.999f, 0.1245f);
|
||||
* ItemHelper.renderStandardInvBlock(renderer, block, metadata); renderer.setRenderBounds(0.5625f,
|
||||
* 0.1245f, 0.001f, 0.8755f, 0.999f, 0.1245f); ItemHelper.renderStandardInvBlock(renderer, block,
|
||||
* metadata); renderer.setRenderBounds(0.4375f, 0.8755f, 0.001f, 0.5625f, 0.999f, 0.1245f);
|
||||
* ItemHelper.renderStandardInvBlock(renderer, block, metadata); renderer.setRenderBounds(0.4375f,
|
||||
* 0.1245f, 0.001f, 0.5625f, 0.25F, 0.1245f); ItemHelper.renderStandardInvBlock(renderer, block,
|
||||
* metadata);
|
||||
*/
|
||||
|
||||
// Legs
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 0.3125F, 0.125, 0.3125F);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.6875F, 0.0F, 0.0F, 1.0F, 0.125, 0.3125F);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.6875F, 0.3125F, 0.125, 1.0F);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.6875F, 0.0F, 0.6875F, 1.0F, 0.125, 1.0F);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
|
||||
// Outside
|
||||
renderer.setRenderBounds(0.0f, 0.125, 0f, 0.125, 1.0F, 1);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.875f, 0.125, 0f, 1, 1.0F, 1);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.125f, 0.125, 0f, 0.875f, 1.0F, 0.125f);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.125f, 0.125, 0.875f, 0.875f, 1.0F, 1);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata, BASIN_BOUNDS);
|
||||
} else {
|
||||
renderer.setRenderBounds(0, 0, 0, 1, 1, 1);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata, FULL_BOUNDS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,44 +37,31 @@ public class PaneConnectedRender implements ISimpleBlockRenderingHandler {
|
||||
int segments = GlassPaneConnected.SEGMENT_CENTER | GlassPaneConnected.SEGMENT_WEST
|
||||
| GlassPaneConnected.SEGMENT_EAST;
|
||||
|
||||
// Bottom
|
||||
IIcon northIcon = pane.getIcon(2, meta);
|
||||
IIcon southIcon = pane.getIcon(3, meta);
|
||||
IIcon westIcon = pane.getIcon(4, meta);
|
||||
IIcon eastIcon = pane.getIcon(5, meta);
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
|
||||
tessellator.setNormal(0.0F, -1.0F, 0.0F);
|
||||
renderTopOrBottom(tessellator, 0, 0, 0, segments, false, pane.getTopIcon(meta));
|
||||
tessellator.draw();
|
||||
|
||||
// Top
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
renderTopOrBottom(tessellator, 0, 0, 0, segments, true, pane.getBottomIcon(meta));
|
||||
tessellator.draw();
|
||||
|
||||
// North
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, -1.0F);
|
||||
IIcon northIcon = pane.getIcon(2, meta);
|
||||
renderSide(tessellator, 0, 0, 0, NORTH, true, true, false, false, northIcon, northIcon, northIcon);
|
||||
tessellator.draw();
|
||||
|
||||
// South
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||
IIcon southIcon = pane.getIcon(3, meta);
|
||||
renderSide(tessellator, 0, 0, 0, SOUTH, true, true, false, false, southIcon, southIcon, southIcon);
|
||||
tessellator.draw();
|
||||
|
||||
// West
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1.0F, 0.0F, 0.0F);
|
||||
IIcon westIcon = pane.getIcon(4, meta);
|
||||
renderSide(tessellator, 0, 0, 0, WEST, false, false, true, true, westIcon, westIcon, westIcon);
|
||||
tessellator.draw();
|
||||
|
||||
// East
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||
IIcon eastIcon = pane.getIcon(5, meta);
|
||||
renderSide(tessellator, 0, 0, 0, EAST, false, false, true, true, eastIcon, eastIcon, eastIcon);
|
||||
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
|
||||
@@ -2,8 +2,6 @@ package tconstruct.smeltery.model;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
@@ -14,8 +12,8 @@ import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import mantle.world.CoordTuple;
|
||||
import tconstruct.client.BlockSkinRenderHelper;
|
||||
import tconstruct.library.crafting.Smeltery;
|
||||
import tconstruct.smeltery.logic.SmelteryLogic;
|
||||
import tconstruct.smeltery.logic.SmelteryRenderData;
|
||||
import tconstruct.util.ItemHelper;
|
||||
|
||||
@ThreadSafeISBRH(perThread = false)
|
||||
@@ -115,33 +113,15 @@ public class SmelteryRender implements ISimpleBlockRenderingHandler {
|
||||
void renderLayer(SmelteryLogic logic, int start, CoordTuple from, CoordTuple to, int posY, RenderBlocks renderer,
|
||||
IBlockAccess world) {
|
||||
renderer.setRenderBounds(-0.001F, -0.001F, -0.001F, 1.001F, 1.001F, 1.001F);
|
||||
SmelteryRenderData data = logic.getRenderData();
|
||||
int i = start;
|
||||
for (int x = from.x; x <= to.x; x++) for (int z = from.z; z <= to.z; z++) {
|
||||
// safety because of changes.
|
||||
if (i > logic.getSizeInventory()) return;
|
||||
ItemStack input = logic.getStackInSlot(i);
|
||||
if (input != null && logic.getTempForSlot(i) > 20) {
|
||||
ItemStack blockToRender = Smeltery.getRenderIndex(input);
|
||||
if (blockToRender != null) {
|
||||
float blockHeight = input.stackSize / (float) blockToRender.stackSize;
|
||||
renderer.setRenderBounds(
|
||||
0.0F,
|
||||
0.0F,
|
||||
0.0F,
|
||||
1.0F,
|
||||
MathHelper.clamp_float(blockHeight, 0.01F, 1.0F),
|
||||
1.0F);
|
||||
|
||||
Block liquidBlock = Block.getBlockFromItem(blockToRender.getItem());
|
||||
BlockSkinRenderHelper.renderMetadataBlock(
|
||||
liquidBlock,
|
||||
blockToRender.getItemDamage(),
|
||||
x,
|
||||
posY,
|
||||
z,
|
||||
renderer,
|
||||
world);
|
||||
}
|
||||
if (i >= data.size()) return;
|
||||
float height = data.getHeight(i);
|
||||
if (height > 0) {
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, height, 1.0F);
|
||||
BlockSkinRenderHelper
|
||||
.renderMetadataBlock(data.getBlock(i), data.getMetadata(i), x, posY, z, renderer, world);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package tconstruct.smeltery.model;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
@@ -24,14 +23,20 @@ public class TankRender implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public static int tankModelID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
private static final float[][] TANK_TOP_BOUNDS = { { 0.1875F, 0.0F, 0.1875F, 0.8125F, 0.125F, 0.8125F } };
|
||||
|
||||
private static final float[][] TANK_FULL_BOUNDS = { { 0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F } };
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
if (modelID == tankModelID) {
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
// the thingie on top of lava tanks
|
||||
if (metadata == 0) {
|
||||
renderer.setRenderBounds(0.1875, 0, 0.1875, 0.8125, 0.125, 0.8125);
|
||||
renderDoRe(renderer, block, metadata);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata, TANK_FULL_BOUNDS);
|
||||
GL11.glTranslatef(0.0F, 1.0F, 0.0F);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata, TANK_TOP_BOUNDS);
|
||||
GL11.glTranslatef(0.0F, -1.0F, 0.0F);
|
||||
} else {
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata, TANK_FULL_BOUNDS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,8 +45,10 @@ public class TankRender implements ISimpleBlockRenderingHandler {
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelID,
|
||||
RenderBlocks renderer) {
|
||||
if (modelID == tankModelID) {
|
||||
// Liquid
|
||||
if (ForgeHooksClient.getWorldRenderPass() == 0) {
|
||||
// Liquid, in the translucent pass: the alpha test of pass 0 discards fluid textures that are less than
|
||||
// 50% opaque (e.g. GT gases). The block itself is drawn in pass 0, its textures are fully opaque or fully
|
||||
// clear.
|
||||
if (ForgeHooksClient.getWorldRenderPass() == 1) {
|
||||
LavaTankLogic logic = (LavaTankLogic) world.getTileEntity(x, y, z);
|
||||
if (logic != null && logic.containsFluid()) {
|
||||
FluidStack liquid = logic.tank.getFluid();
|
||||
@@ -86,33 +93,4 @@ public class TankRender implements ISimpleBlockRenderingHandler {
|
||||
return tankModelID;
|
||||
}
|
||||
|
||||
private void renderDoRe(RenderBlocks renderblocks, Block block, int meta) {
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glTranslatef(-0.5F, 0.5F, -0.5F);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, -1F, 0.0F);
|
||||
renderblocks.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
renderblocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, -1F);
|
||||
renderblocks.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||
renderblocks.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1F, 0.0F, 0.0F);
|
||||
renderblocks.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||
renderblocks.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, meta));
|
||||
tessellator.draw();
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package tconstruct.tools;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -490,10 +492,10 @@ public class TinkerToolEvents implements IMobExtraInfoProvider {
|
||||
Translations.BASE_CHANCE.get(0d),
|
||||
StatCollector.translateToLocalFormatted(
|
||||
"tconstruct.mobsinfocompat.tinkers_construct_beheading",
|
||||
m1),
|
||||
formatNumber(m1)),
|
||||
StatCollector.translateToLocalFormatted(
|
||||
"tconstruct.mobsinfocompat.tinkers_construct_beheading_1",
|
||||
m2)));
|
||||
formatNumber(m2))));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -79,6 +79,7 @@ import tconstruct.modifiers.tools.ModBlaze;
|
||||
import tconstruct.modifiers.tools.ModButtertouch;
|
||||
import tconstruct.modifiers.tools.ModCreativeToolModifier;
|
||||
import tconstruct.modifiers.tools.ModDurability;
|
||||
import tconstruct.modifiers.tools.ModExpander;
|
||||
import tconstruct.modifiers.tools.ModExtraModifier;
|
||||
import tconstruct.modifiers.tools.ModFlux;
|
||||
import tconstruct.modifiers.tools.ModInteger;
|
||||
@@ -249,6 +250,17 @@ public class TinkerTools {
|
||||
TinkerTools.craftedSoil.stepSound = Block.soundTypeGravel;
|
||||
|
||||
GameRegistry.registerBlock(TinkerTools.toolStationWood, ToolStationItemBlock.class, "ToolStationBlock");
|
||||
OreDictionary.registerOre("tconstructToolStation", new ItemStack(TinkerTools.toolStationWood, 1, 0));
|
||||
OreDictionary.registerOre("tconstructPartBuilder", new ItemStack(TinkerTools.toolStationWood, 1, 1));
|
||||
OreDictionary.registerOre("tconstructPartBuilder", new ItemStack(TinkerTools.toolStationWood, 1, 2));
|
||||
OreDictionary.registerOre("tconstructPartBuilder", new ItemStack(TinkerTools.toolStationWood, 1, 3));
|
||||
OreDictionary.registerOre("tconstructPartBuilder", new ItemStack(TinkerTools.toolStationWood, 1, 4));
|
||||
OreDictionary.registerOre("tconstructPatternChest", new ItemStack(TinkerTools.toolStationWood, 1, 5));
|
||||
OreDictionary.registerOre("tconstructStencilTable", new ItemStack(TinkerTools.toolStationWood, 1, 10));
|
||||
OreDictionary.registerOre("tconstructStencilTable", new ItemStack(TinkerTools.toolStationWood, 1, 11));
|
||||
OreDictionary.registerOre("tconstructStencilTable", new ItemStack(TinkerTools.toolStationWood, 1, 12));
|
||||
OreDictionary.registerOre("tconstructStencilTable", new ItemStack(TinkerTools.toolStationWood, 1, 13));
|
||||
|
||||
GameRegistry.registerTileEntity(ToolStationLogic.class, "ToolStation");
|
||||
GameRegistry.registerTileEntity(PartBuilderLogic.class, "PartCrafter");
|
||||
GameRegistry.registerTileEntity(PatternChestLogic.class, "PatternHolder");
|
||||
@@ -762,6 +774,21 @@ public class TinkerTools {
|
||||
ItemStack reinforcement = new ItemStack(TinkerTools.materials, 1, 43);
|
||||
ModifyBuilder.registerModifier(new ModReinforced(new ItemStack[] { reinforcement }, 16, 1));
|
||||
|
||||
ItemStack expanderHorizontal = new ItemStack(TinkerTools.materials, 1, 44);
|
||||
ItemStack expanderVertical = new ItemStack(TinkerTools.materials, 1, 45);
|
||||
ModifyBuilder.registerModifier(
|
||||
new ModExpander(
|
||||
new ItemStack[] { expanderHorizontal },
|
||||
"Width++",
|
||||
"\u00a7a",
|
||||
StatCollector.translateToLocal("modifier.tool.width")));
|
||||
ModifyBuilder.registerModifier(
|
||||
new ModExpander(
|
||||
new ItemStack[] { expanderVertical },
|
||||
"Height++",
|
||||
"\u00a7a",
|
||||
StatCollector.translateToLocal("modifier.tool.height")));
|
||||
|
||||
TConstructRegistry.registerActiveToolMod(new TActiveOmniMod());
|
||||
}
|
||||
|
||||
@@ -908,6 +935,66 @@ public class TinkerTools {
|
||||
String[] patBlock = { "###", "###", "###" };
|
||||
String[] patSurround = { "###", "#m#", "###" };
|
||||
|
||||
// Expander modifier items (Width++/Height++): the pistons point the way the tool expands. With GregTech
|
||||
// loaded they are its LV electric pistons; without it the recipe is TiC2's own.
|
||||
Item gtMetaItem = Loader.isModLoaded("gregtech") ? GameRegistry.findItem("gregtech", "gt.metaitem.01") : null;
|
||||
if (gtMetaItem != null) {
|
||||
ItemStack lvPiston = new ItemStack(gtMetaItem, 1, 32640); // gregtech:gt.metaitem.01:32640
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(
|
||||
new ItemStack(TinkerTools.materials, 1, 44),
|
||||
"gog",
|
||||
"pep",
|
||||
"gog",
|
||||
'g',
|
||||
"gearGtSmallSteel",
|
||||
'o',
|
||||
"plateDenseObsidian",
|
||||
'p',
|
||||
lvPiston,
|
||||
'e',
|
||||
Items.ender_pearl));
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(
|
||||
new ItemStack(TinkerTools.materials, 1, 45),
|
||||
"gpg",
|
||||
"oeo",
|
||||
"gpg",
|
||||
'g',
|
||||
"gearGtSmallSteel",
|
||||
'o',
|
||||
"plateDenseObsidian",
|
||||
'p',
|
||||
lvPiston,
|
||||
'e',
|
||||
Items.ender_pearl));
|
||||
} else {
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(
|
||||
new ItemStack(TinkerTools.materials, 1, 44),
|
||||
" l ",
|
||||
"psp",
|
||||
" l ",
|
||||
'l',
|
||||
"gemLapis",
|
||||
'p',
|
||||
Blocks.piston,
|
||||
's',
|
||||
"slimeball"));
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(
|
||||
new ItemStack(TinkerTools.materials, 1, 45),
|
||||
" p ",
|
||||
"lsl",
|
||||
" p ",
|
||||
'l',
|
||||
"gemLapis",
|
||||
'p',
|
||||
Blocks.piston,
|
||||
's',
|
||||
"slimeball"));
|
||||
}
|
||||
|
||||
Object[] toolForgeBlocks = { "blockIron", "blockGold", Blocks.diamond_block, Blocks.emerald_block,
|
||||
"blockCobalt", "blockArdite", "blockManyullyn", "blockCopper", "blockBronze", "blockTin",
|
||||
"blockAluminum", "blockAluminumBrass", "blockAlumite", "blockSteel" };
|
||||
|
||||
@@ -72,14 +72,6 @@ public class CraftingSlab extends InventorySlab {
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
if (metadata == 5 || metadata == 6) return AxisAlignedBB.getBoundingBox(
|
||||
(double) x + this.minX,
|
||||
(double) y + this.minY,
|
||||
(double) z + this.minZ,
|
||||
(double) x + this.maxX,
|
||||
(double) y + this.maxY - 0.125,
|
||||
(double) z + this.maxZ);
|
||||
return AxisAlignedBB.getBoundingBox(
|
||||
(double) x + this.minX,
|
||||
(double) y + this.minY,
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -14,6 +15,8 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@@ -110,6 +113,31 @@ public class ToolStationBlock extends InventoryBlock {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 start, Vec3 end) {
|
||||
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if (metadata == 5 || metadata == 6) {
|
||||
float oldMinX = (float) this.minX;
|
||||
float oldMinY = (float) this.minY;
|
||||
float oldMinZ = (float) this.minZ;
|
||||
float oldMaxX = (float) this.maxX;
|
||||
float oldMaxY = (float) this.maxY;
|
||||
float oldMaxZ = (float) this.maxZ;
|
||||
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.875F, 1.0F);
|
||||
|
||||
MovingObjectPosition result = super.collisionRayTrace(world, x, y, z, start, end);
|
||||
|
||||
this.setBlockBounds(oldMinX, oldMinY, oldMinZ, oldMaxX, oldMaxY, oldMaxZ);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return super.collisionRayTrace(world, x, y, z, start, end);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
@@ -129,6 +157,24 @@ public class ToolStationBlock extends InventoryBlock {
|
||||
(double) z + this.maxZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB mask, List<AxisAlignedBB> list,
|
||||
Entity entity) {
|
||||
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if (metadata == 5 || metadata == 6) {
|
||||
AxisAlignedBB box = AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 0.875, z + 1);
|
||||
|
||||
if (box.intersectsWith(mask)) {
|
||||
list.add(box);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
super.addCollisionBoxesToList(world, x, y, z, mask, list, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int metadata) {
|
||||
return switch (metadata) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package tconstruct.tools.gui;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
@@ -25,11 +27,12 @@ public class BattlesignGui extends GuiScreen {
|
||||
private float bgColG = 1F;
|
||||
private float bgColB = 1F;
|
||||
private static final ResourceLocation background = new ResourceLocation("tinker:textures/gui/battlesignText.png");
|
||||
private final String[] text = { "", "", "", "", "" };
|
||||
private final String[] text = new String[BattlesignLogic.LINE_COUNT];
|
||||
int currentLine = 0;
|
||||
|
||||
public BattlesignGui(BattlesignLogic logic) {
|
||||
this.battlesign = logic;
|
||||
Arrays.fill(text, "");
|
||||
|
||||
ItemStack stack = logic.getEquipmentItem();
|
||||
if (stack != null) {
|
||||
@@ -146,13 +149,8 @@ public class BattlesignGui extends GuiScreen {
|
||||
|
||||
Keyboard.enableRepeatEvents(false);
|
||||
|
||||
TConstruct.packetPipeline.sendToServer(
|
||||
new SignDataPacket(
|
||||
battlesign.getWorldObj().provider.dimensionId,
|
||||
battlesign.xCoord,
|
||||
battlesign.yCoord,
|
||||
battlesign.zCoord,
|
||||
text));
|
||||
TConstruct.packetPipeline
|
||||
.sendToServer(new SignDataPacket(battlesign.xCoord, battlesign.yCoord, battlesign.zCoord, text));
|
||||
}
|
||||
|
||||
private float calcLuminance(float r, float g, float b) {
|
||||
|
||||
@@ -9,7 +9,6 @@ import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -28,13 +27,35 @@ import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.crafting.PatternBuilder;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.library.tools.ToolMaterial;
|
||||
import tconstruct.library.util.ColorUtils;
|
||||
import tconstruct.library.util.HarvestLevels;
|
||||
import tconstruct.tools.logic.CraftingStationLogic;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
import tconstruct.util.network.CraftingStationDumpPacket;
|
||||
|
||||
@Optional.Interface(iface = "codechicken.nei.api.INEIGuiHandler", modid = "NotEnoughItems")
|
||||
public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
|
||||
|
||||
private static final int CRAFTING_WIDTH = 176;
|
||||
private static final int CRAFTING_HEIGHT = 166;
|
||||
private static final int DESCRIPTION_WIDTH = 126;
|
||||
private static final int DESCRIPTION_HEIGHT = 172;
|
||||
private static final int DEFAULT_COLUMNS = 6;
|
||||
private static final int CLASSIC_MAX_ROWS = 10;
|
||||
private static final int MIN_COLUMNS = 5;
|
||||
private static final int MAX_OVERHANG_ROWS = 7;
|
||||
private static final int NEI_VERTICAL_MARGIN = 22;
|
||||
private static final int NEI_PANEL_MARGIN = 2;
|
||||
private static final int NEI_BOOKMARK_GROUP_WIDTH = 7;
|
||||
private static final int MIN_BOOKMARK_COLUMNS = 4;
|
||||
private static final int SCROLL_SEPARATOR_HEIGHT = 4;
|
||||
private static final int OUTSIDE_SLOT_ID = -999;
|
||||
private static final int CLICK_MODE_PICKUP = 0;
|
||||
private static final int CLICK_MODE_QUICK_MOVE = 1;
|
||||
private static final int CLICK_MODE_THROW = 4;
|
||||
// Treat an empty trailing slot as a small layout cost, not a hard constraint.
|
||||
private static final double UNUSED_SLOT_SCORE_PENALTY = 0.01D;
|
||||
|
||||
/*
|
||||
* Slider/slots related. Taken & adapted from Tinkers Construct 1.12 under the MIT License
|
||||
*/
|
||||
@@ -42,6 +63,7 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
|
||||
|
||||
public static final GuiElementScalable slotElement = new GuiElementScalable(7, 7, 18, 18, 64, 64);
|
||||
public static final GuiElementScalable slotEmptyElement = new GuiElementScalable(7 + 18, 7, 18, 18, 64, 64);
|
||||
private static final GuiElementScalable scrollSeparator = new GuiElementScalable(7, 57, 1, 1, 64, 64);
|
||||
|
||||
private static final GuiElementDuex sliderNormal = new GuiElementDuex(7, 25, 10, 15, 64, 64);
|
||||
private static final GuiElementDuex sliderLow = new GuiElementDuex(17, 25, 10, 15, 64, 64);
|
||||
@@ -88,7 +110,7 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
|
||||
private int chestLeft = 0;
|
||||
private int chestTop = 0;
|
||||
private int chestWidth = 0;
|
||||
private int chestHeight = 0;
|
||||
private ChestLayout chestLayout;
|
||||
|
||||
public CraftingStationGui(InventoryPlayer inventory, CraftingStationLogic logic, World world, int x, int y, int z) {
|
||||
super(logic.getGuiContainer(inventory, world, x, y, z));
|
||||
@@ -103,8 +125,8 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 166;
|
||||
this.xSize = CRAFTING_WIDTH;
|
||||
this.ySize = CRAFTING_HEIGHT;
|
||||
|
||||
this.guiLeft = (this.width - this.xSize) / 2;
|
||||
this.guiTop = (this.height - this.ySize) / 2;
|
||||
@@ -112,15 +134,14 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
|
||||
this.craftingLeft = this.guiLeft;
|
||||
this.craftingTop = this.guiTop;
|
||||
|
||||
if (logic.tinkerTable) {
|
||||
this.descLeft = this.guiLeft + 176;
|
||||
this.descTop = this.craftingTop;
|
||||
}
|
||||
|
||||
if (logic.chest != null) {
|
||||
updateChest();
|
||||
} else {
|
||||
slider.hide();
|
||||
if (logic.tinkerTable) {
|
||||
this.descLeft = this.guiLeft + CRAFTING_WIDTH;
|
||||
this.descTop = this.craftingTop;
|
||||
}
|
||||
}
|
||||
|
||||
this.craftingTextLeft = this.craftingLeft - this.guiLeft;
|
||||
@@ -129,10 +150,7 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
|
||||
// Add dump button if chest is connected
|
||||
this.buttonList.clear();
|
||||
if (logic.chest != null) {
|
||||
int bothOffset = 0;
|
||||
if (logic.slotCount > 54) bothOffset += 12;
|
||||
bothOffset += 122;
|
||||
this.buttonList.add(new GuiButtonDump(0, this.guiLeft + bothOffset + 161, this.guiTop + 5));
|
||||
this.buttonList.add(new GuiButtonDump(0, this.craftingLeft + 161, this.craftingTop + 5));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,17 +194,23 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.fontRendererObj
|
||||
.drawString(StatCollector.translateToLocal(logic.chest.get().getInventoryName()), 8, 6, 0x202020);
|
||||
this.fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal(logic.chest.get().getInventoryName()),
|
||||
chestLeft - guiLeft + 8,
|
||||
chestTop - guiTop + 6,
|
||||
ColorUtils.inventoryTitle.getColor());
|
||||
}
|
||||
|
||||
this.fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal(logic.tinkerTable ? "crafters.TinkerTable" : logic.getInvName()),
|
||||
craftingTextLeft + 8,
|
||||
6,
|
||||
0x202020);
|
||||
this.fontRendererObj
|
||||
.drawString(StatCollector.translateToLocal("container.inventory"), craftingTextLeft + 8, 72, 0x202020);
|
||||
craftingTop - guiTop + 6,
|
||||
ColorUtils.inventoryTitle.getColor());
|
||||
this.fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal("container.inventory"),
|
||||
craftingTextLeft + 8,
|
||||
craftingTop - guiTop + 72,
|
||||
ColorUtils.inventoryTitle.getColor());
|
||||
|
||||
if (logic.tinkerTable) {
|
||||
if (logic.isStackInSlot(0)) // output slot = modified item
|
||||
@@ -209,7 +233,8 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
|
||||
void drawToolStats(ItemStack stack) {
|
||||
if (stack == null) return;
|
||||
|
||||
if (stack.getItem() instanceof IModifyable) ToolStationGuiHelper.drawToolStats(stack, descTextLeft + 10, 0);
|
||||
if (stack.getItem() instanceof IModifyable)
|
||||
ToolStationGuiHelper.drawToolStats(stack, descTextLeft + 10, descTop - guiTop);
|
||||
|
||||
int matID = PatternBuilder.instance.getPartID(stack);
|
||||
|
||||
@@ -222,14 +247,15 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
|
||||
|
||||
void drawToolInformation() {
|
||||
int offsetX = descTextLeft + 63;
|
||||
int offsetY = descTop - guiTop;
|
||||
|
||||
this.drawCenteredString(fontRendererObj, title, offsetX, 8, 0xffffff);
|
||||
fontRendererObj.drawSplitString(body, offsetX - 56, 24, 115, 0xffffff);
|
||||
this.drawCenteredString(fontRendererObj, title, offsetX, offsetY + 8, 0xffffff);
|
||||
fontRendererObj.drawSplitString(body, offsetX - 56, offsetY + 24, 115, 0xffffff);
|
||||
}
|
||||
|
||||
protected void drawMaterialStats(ToolMaterial materialEnum) {
|
||||
final int baseX = descTextLeft + 8;
|
||||
final int baseY = 8;
|
||||
final int baseY = descTop - guiTop + 8;
|
||||
|
||||
String centerTitle = "\u00A7n" + materialEnum.localizedName();
|
||||
|
||||
@@ -294,21 +320,7 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
|
||||
|
||||
this.mc.getTextureManager().bindTexture(gui_inventory);
|
||||
if (hasChest()) {
|
||||
chestLeft += border.w;
|
||||
chestTop += border.h;
|
||||
|
||||
border.draw();
|
||||
|
||||
int x = chestLeft;
|
||||
int y = chestTop;
|
||||
final int midW = chestWidth - border.w * 2;
|
||||
|
||||
if (shouldDrawName()) {
|
||||
textBackground.drawScaledX(chestLeft, chestTop, midW);
|
||||
y += textBackground.h;
|
||||
}
|
||||
|
||||
drawChestSlots(x, y);
|
||||
drawChest();
|
||||
|
||||
// slider
|
||||
if (slider.isEnabled()) {
|
||||
@@ -317,9 +329,6 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
|
||||
|
||||
updateChestSlots();
|
||||
}
|
||||
|
||||
chestLeft -= border.w;
|
||||
chestTop -= border.h;
|
||||
}
|
||||
// Draw description
|
||||
if (logic.tinkerTable) {
|
||||
@@ -357,21 +366,13 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
|
||||
|
||||
@Override
|
||||
public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h) {
|
||||
final int cw = (logic.chest != null ? chestWidth : 0);
|
||||
if (logic.chest != null) {
|
||||
final Rectangle blah = new Rectangle(x, y, w, h);
|
||||
final Rectangle chestRectangle = new Rectangle(
|
||||
chestLeft,
|
||||
chestTop,
|
||||
chestWidth,
|
||||
chestHeight + (shouldDrawName() ? textBackground.y : 0) + (border.h * 2));
|
||||
Rectangle itemPanelSlot = new Rectangle(x, y, w, h);
|
||||
if (intersectsChest(itemPanelSlot)) return true;
|
||||
if (new Rectangle(craftingLeft, craftingTop, CRAFTING_WIDTH, CRAFTING_HEIGHT).intersects(itemPanelSlot))
|
||||
return true;
|
||||
|
||||
if (chestRectangle.intersects(blah)) return true;
|
||||
}
|
||||
|
||||
if (y + h - 4 < guiTop || y + 4 > guiTop + ySize) return false;
|
||||
|
||||
return x - w - 4 >= guiLeft + cw && x + 4 <= guiLeft + xSize + cw + (logic.tinkerTable ? 126 : 0);
|
||||
return logic.tinkerTable
|
||||
&& new Rectangle(descLeft, descTop, DESCRIPTION_WIDTH, DESCRIPTION_HEIGHT).intersects(itemPanelSlot);
|
||||
}
|
||||
|
||||
public boolean hasChest() {
|
||||
@@ -379,12 +380,7 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
|
||||
}
|
||||
|
||||
public boolean isMouseInChest(int mouseX, int mouseY) {
|
||||
final int xMod = (slider.isEnabled() ? slider.width : 0) + border.w;
|
||||
final int yMod = (shouldDrawName() ? textBackground.y : 0) + (border.h * 2);
|
||||
|
||||
return mouseX >= (this.chestLeft - xMod) && mouseX < (chestLeft + chestWidth + xMod)
|
||||
&& mouseY >= (this.chestTop - yMod)
|
||||
&& mouseY < (chestTop + chestHeight + yMod);
|
||||
return intersectsChest(new Rectangle(mouseX, mouseY, 1, 1));
|
||||
}
|
||||
|
||||
public boolean isMouseOverFullSlot(int mouseX, int mouseY) {
|
||||
@@ -414,6 +410,8 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
|
||||
// all visible
|
||||
if (!slider.isEnabled()) return true;
|
||||
|
||||
if (chestLayout.lShaped && chestSlot.getVisualIndex() < chestLayout.topCapacity) return true;
|
||||
|
||||
return firstSlotId <= chestSlot.getVisualIndex() && lastSlotId > chestSlot.getVisualIndex();
|
||||
}
|
||||
|
||||
@@ -422,119 +420,73 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
|
||||
return super.isMouseOverSlot(slotIn, mouseX, mouseY) && shouldDrawSlot(slotIn);
|
||||
}
|
||||
|
||||
private int getDisplayedRows() {
|
||||
return chestHeight / slotElement.h;
|
||||
}
|
||||
|
||||
private int calcCappedYSize(int max) {
|
||||
int h = slotElement.h * logic.invRows;
|
||||
|
||||
// not higher than the max
|
||||
while (h > max) {
|
||||
h -= slotElement.h;
|
||||
@Override
|
||||
protected void handleMouseClick(Slot slot, int slotId, int button, int mode) {
|
||||
if (slotId == OUTSIDE_SLOT_ID && slot instanceof ChestSlot && shouldDrawSlot(slot)) {
|
||||
slotId = slot.slotNumber;
|
||||
if (mode == CLICK_MODE_THROW) mode = CLICK_MODE_PICKUP;
|
||||
if (mode == CLICK_MODE_PICKUP && isShiftKeyDown()) mode = CLICK_MODE_QUICK_MOVE;
|
||||
}
|
||||
return h;
|
||||
|
||||
super.handleMouseClick(slot, slotId, button, mode);
|
||||
}
|
||||
|
||||
public int getChestWidth() {
|
||||
return chestWidth;
|
||||
private int getDisplayedRows() {
|
||||
return chestLayout.visibleRows;
|
||||
}
|
||||
|
||||
// updatePosition
|
||||
public void updateChest() {
|
||||
chestHeight = calcCappedYSize(CraftingStationGui.slotElement.h * 10);
|
||||
chestSlotCount = logic.slotCount;
|
||||
chestLayout = selectChestLayout();
|
||||
|
||||
// slider needed?
|
||||
if (getDisplayedRows() < logic.invRows) {
|
||||
if (chestLayout.scrolling) {
|
||||
slider.enable();
|
||||
slider.show();
|
||||
} else {
|
||||
slider.disable();
|
||||
slider.hide();
|
||||
}
|
||||
|
||||
chestWidth = logic.invColumns * CraftingStationGui.slotElement.w + 2 * border.w
|
||||
+ (slider.isEnabled() ? slider.width : 0);
|
||||
this.xSize = CRAFTING_WIDTH;
|
||||
this.ySize = CRAFTING_HEIGHT;
|
||||
this.guiLeft = (this.width - this.xSize) / 2;
|
||||
this.guiTop = (this.height - this.ySize) / 2;
|
||||
|
||||
chestLeft = guiLeft - chestWidth;
|
||||
chestTop = guiTop;
|
||||
this.craftingLeft = guiLeft;
|
||||
this.craftingTop = guiTop;
|
||||
this.chestLeft = craftingLeft - chestLayout.lowerPanelWidth;
|
||||
this.chestTop = craftingTop - chestLayout.craftingTopOffset + chestLayout.chestTopOffset;
|
||||
this.chestWidth = chestLayout.lowerPanelWidth;
|
||||
this.descLeft = craftingLeft + CRAFTING_WIDTH;
|
||||
this.descTop = craftingTop;
|
||||
|
||||
// Leaving out the xSize increase by chestSize and adjusting where it's used, because otherwise it shifts both
|
||||
// the bookmarks and item panel
|
||||
// way too far out. If anything (mouseClick, for example) relies on xSize, you'll need to hack it like below.
|
||||
// xSize += guiLeft - chestLeft;
|
||||
guiLeft = chestLeft;
|
||||
|
||||
border.setPosition(chestLeft, chestTop);
|
||||
border.setSize(chestWidth, chestHeight + (shouldDrawName() ? textBackground.h : 0) + 2 * border.h);
|
||||
|
||||
slider.show();
|
||||
slider.setPosition(
|
||||
chestLeft + logic.invColumns * slotElement.w + border.w,
|
||||
chestTop + (shouldDrawName() ? textBackground.h : 0) + border.h);
|
||||
slider.setSize(chestHeight);
|
||||
slider.setSliderParameters(0, logic.invRows - getDisplayedRows(), 1);
|
||||
configureChestWidgets();
|
||||
positionMainSlots();
|
||||
|
||||
updateChestSlots();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int x, int y, int button) {
|
||||
// Hacks
|
||||
final int height = ySize;
|
||||
|
||||
if (logic.chest != null && x >= guiLeft && x <= guiLeft + chestWidth) {
|
||||
ySize = border.height;
|
||||
}
|
||||
|
||||
xSize += chestWidth;
|
||||
super.mouseClicked(x, y, button);
|
||||
xSize -= chestWidth;
|
||||
ySize = height;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseMovedOrUp(int x, int y, int button) {
|
||||
// Hacks
|
||||
final int height = ySize;
|
||||
|
||||
if (logic.chest != null && x >= guiLeft && x <= guiLeft + chestWidth) {
|
||||
ySize = border.height;
|
||||
}
|
||||
|
||||
xSize += chestWidth;
|
||||
super.mouseMovedOrUp(x, y, button);
|
||||
xSize -= chestWidth;
|
||||
ySize = height;
|
||||
}
|
||||
|
||||
// updates slot visibility
|
||||
protected void updateChestSlots() {
|
||||
if (!hasChest()) return;
|
||||
|
||||
final IInventory secondInventory = logic.getSecondInventory();
|
||||
int xOffset = chestLeft - guiLeft + border.w;
|
||||
int yOffset = chestTop - guiTop + border.h + getHeaderHeight();
|
||||
|
||||
int xOffset = border.w;
|
||||
int yOffset = border.h;
|
||||
|
||||
if (shouldDrawName()) {
|
||||
yOffset += textBackground.h;
|
||||
}
|
||||
|
||||
firstSlotId = slider.getValue() * logic.invColumns;
|
||||
lastSlotId = Math.min(chestSlotCount, firstSlotId + getDisplayedRows() * logic.invColumns);
|
||||
firstSlotId = chestLayout.scrolling
|
||||
? (chestLayout.lShaped ? chestLayout.topCapacity : 0) + slider.getValue() * chestLayout.columns
|
||||
: 0;
|
||||
lastSlotId = chestLayout.scrolling
|
||||
? Math.min(chestSlotCount, firstSlotId + getDisplayedRows() * chestLayout.columns)
|
||||
: chestSlotCount;
|
||||
|
||||
for (Object o : inventorySlots.inventorySlots) {
|
||||
if (!(o instanceof ChestSlot slot)) continue;
|
||||
|
||||
if (shouldDrawSlot(slot)) {
|
||||
slot.enable();
|
||||
// calc position of the slot
|
||||
final int offset = slot.getVisualIndex() - firstSlotId;
|
||||
final int x = (offset % logic.invColumns) * CraftingStationGui.slotElement.w;
|
||||
final int y = (offset / logic.invColumns) * CraftingStationGui.slotElement.h;
|
||||
|
||||
slot.xDisplayPosition = x + xOffset + 1 /*- this.chestWidth*/;
|
||||
slot.yDisplayPosition = y + yOffset + 1;
|
||||
positionChestSlot(slot, xOffset, yOffset);
|
||||
} else {
|
||||
slot.disable();
|
||||
slot.xDisplayPosition = 0;
|
||||
@@ -543,26 +495,465 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private void positionChestSlot(ChestSlot slot, int xOffset, int yOffset) {
|
||||
int visualIndex = slot.getVisualIndex();
|
||||
final int x;
|
||||
final int y;
|
||||
|
||||
if (!chestLayout.lShaped) {
|
||||
int offset = visualIndex - firstSlotId;
|
||||
x = (offset % chestLayout.columns) * slotElement.w;
|
||||
y = (offset / chestLayout.columns) * slotElement.h;
|
||||
} else if (visualIndex < chestLayout.topCapacity) {
|
||||
x = (visualIndex % chestLayout.topColumns) * slotElement.w;
|
||||
y = (visualIndex / chestLayout.topColumns) * slotElement.h;
|
||||
} else {
|
||||
int offset = visualIndex - (chestLayout.scrolling ? firstSlotId : chestLayout.topCapacity);
|
||||
x = (offset % chestLayout.columns) * slotElement.w;
|
||||
y = (chestLayout.overhangRows + offset / chestLayout.columns) * slotElement.h + chestLayout.separatorHeight;
|
||||
}
|
||||
|
||||
slot.xDisplayPosition = x + xOffset + 1;
|
||||
slot.yDisplayPosition = y + yOffset + 1;
|
||||
}
|
||||
|
||||
// drawSlots
|
||||
protected void drawChestSlots(int xPos, int yPos) {
|
||||
if (!hasChest()) return;
|
||||
|
||||
int width = logic.invColumns * slotElement.w;
|
||||
int height = chestHeight - border.h * 2;
|
||||
if (chestLayout.lShaped) {
|
||||
drawSlotRows(xPos, yPos, chestLayout.topColumns, Math.min(chestSlotCount, chestLayout.topCapacity));
|
||||
drawSlotRows(
|
||||
xPos,
|
||||
yPos + chestLayout.overhangRows * slotElement.h + chestLayout.separatorHeight,
|
||||
chestLayout.columns,
|
||||
chestLayout.scrolling ? lastSlotId - firstSlotId
|
||||
: Math.max(0, chestSlotCount - chestLayout.topCapacity));
|
||||
if (chestLayout.scrolling) {
|
||||
int separatorY = yPos + chestLayout.overhangRows * slotElement.h;
|
||||
scrollSeparator.drawScaled(
|
||||
xPos,
|
||||
separatorY,
|
||||
chestLayout.topColumns * slotElement.w,
|
||||
chestLayout.separatorHeight);
|
||||
}
|
||||
} else {
|
||||
drawSlotRows(xPos, yPos, chestLayout.columns, lastSlotId - firstSlotId);
|
||||
}
|
||||
}
|
||||
|
||||
int fullRows = (lastSlotId - firstSlotId) / logic.invColumns;
|
||||
int slotsLeft = (lastSlotId - firstSlotId) % logic.invColumns;
|
||||
|
||||
int y; // We use it after the loop
|
||||
for (y = 0; y < fullRows * slotElement.h && y < height; y += slotElement.h) {
|
||||
slotElement.drawScaledX(xPos, yPos + y, width);
|
||||
private void drawChest() {
|
||||
if (chestLayout.lShaped) {
|
||||
drawLShapedBorder();
|
||||
} else {
|
||||
border.draw();
|
||||
}
|
||||
|
||||
int x = chestLeft + border.w;
|
||||
int y = chestTop + border.h;
|
||||
|
||||
if (shouldDrawName()) {
|
||||
int titleWidth = chestLayout.lShaped ? chestLayout.topColumns * slotElement.w
|
||||
: chestLayout.panelWidth - border.w * 2;
|
||||
textBackground.drawScaledX(x, y, titleWidth);
|
||||
y += textBackground.h;
|
||||
}
|
||||
|
||||
drawChestSlots(x, y);
|
||||
}
|
||||
|
||||
private void drawLShapedBorder() {
|
||||
int wideRight = chestLeft + chestLayout.panelWidth;
|
||||
int lowerRight = chestLeft + chestLayout.lowerPanelWidth;
|
||||
int elbowY = chestTop + border.h
|
||||
+ getHeaderHeight()
|
||||
+ chestLayout.overhangRows * slotElement.h
|
||||
+ chestLayout.separatorHeight;
|
||||
int bottom = chestTop + chestLayout.panelHeight;
|
||||
|
||||
border.cornerTopLeft.draw(chestLeft, chestTop);
|
||||
border.borderTop.drawScaledX(chestLeft + border.w, chestTop, chestLayout.panelWidth - border.w * 2);
|
||||
border.cornerTopRight.draw(wideRight - border.w, chestTop);
|
||||
|
||||
border.borderLeft.drawScaledY(chestLeft, chestTop + border.h, chestLayout.panelHeight - border.h * 2);
|
||||
border.borderRight.drawScaledY(wideRight - border.w, chestTop + border.h, elbowY - chestTop - border.h);
|
||||
border.cornerBottomRight.draw(wideRight - border.w, elbowY);
|
||||
border.borderBottom.drawScaledX(lowerRight, elbowY, wideRight - lowerRight - border.w);
|
||||
border.drawConcaveBottomRight(lowerRight - border.w, elbowY);
|
||||
border.borderRight.drawScaledY(lowerRight - border.w, elbowY + border.h, bottom - elbowY - border.h * 2);
|
||||
|
||||
border.cornerBottomLeft.draw(chestLeft, bottom - border.h);
|
||||
border.borderBottom
|
||||
.drawScaledX(chestLeft + border.w, bottom - border.h, chestLayout.lowerPanelWidth - border.w * 2);
|
||||
border.cornerBottomRight.draw(lowerRight - border.w, bottom - border.h);
|
||||
}
|
||||
|
||||
private void drawSlotRows(int x, int y, int columns, int slotCount) {
|
||||
if (slotCount <= 0) return;
|
||||
|
||||
int width = columns * slotElement.w;
|
||||
int fullRows = slotCount / columns;
|
||||
int slotsLeft = slotCount % columns;
|
||||
|
||||
for (int row = 0; row < fullRows; row++) {
|
||||
slotElement.drawScaledX(x, y + row * slotElement.h, width);
|
||||
}
|
||||
|
||||
// draw partial row and unused slots
|
||||
if (slotsLeft > 0) {
|
||||
slotElement.drawScaledX(xPos, yPos + y, slotsLeft * slotElement.w);
|
||||
// empty slots that don't exist
|
||||
slotEmptyElement.drawScaledX(xPos + slotsLeft * slotElement.w, yPos + y, width - slotsLeft * slotElement.w);
|
||||
int rowY = y + fullRows * slotElement.h;
|
||||
slotElement.drawScaledX(x, rowY, slotsLeft * slotElement.w);
|
||||
slotEmptyElement.drawScaledX(x + slotsLeft * slotElement.w, rowY, width - slotsLeft * slotElement.w);
|
||||
}
|
||||
}
|
||||
|
||||
private void configureChestWidgets() {
|
||||
int headerHeight = getHeaderHeight();
|
||||
|
||||
border.setPosition(chestLeft, chestTop);
|
||||
border.setSize(chestLayout.panelWidth, chestLayout.panelHeight);
|
||||
|
||||
if (chestLayout.scrolling) {
|
||||
int sliderTopOffset = chestLayout.lShaped
|
||||
? chestLayout.overhangRows * slotElement.h + chestLayout.separatorHeight
|
||||
: 0;
|
||||
slider.setPosition(
|
||||
chestLeft + border.w + chestLayout.columns * slotElement.w,
|
||||
chestTop + border.h + headerHeight + sliderTopOffset);
|
||||
slider.setSize(chestLayout.visibleRows * slotElement.h);
|
||||
slider.setSliderParameters(0, chestLayout.totalRows - chestLayout.visibleRows, 1);
|
||||
}
|
||||
}
|
||||
|
||||
private void positionMainSlots() {
|
||||
int xOffset = craftingLeft - guiLeft;
|
||||
int yOffset = craftingTop - guiTop;
|
||||
|
||||
setSlotPosition(0, xOffset + 124, yOffset + 35);
|
||||
|
||||
for (int row = 0; row < 3; row++) {
|
||||
for (int column = 0; column < 3; column++) {
|
||||
setSlotPosition(1 + column + row * 3, xOffset + 30 + column * 18, yOffset + 17 + row * 18);
|
||||
}
|
||||
}
|
||||
|
||||
for (int row = 0; row < 3; row++) {
|
||||
for (int column = 0; column < 9; column++) {
|
||||
setSlotPosition(10 + column + row * 9, xOffset + 8 + column * 18, yOffset + 84 + row * 18);
|
||||
}
|
||||
}
|
||||
|
||||
for (int column = 0; column < 9; column++) {
|
||||
setSlotPosition(37 + column, xOffset + 8 + column * 18, yOffset + 142);
|
||||
}
|
||||
}
|
||||
|
||||
private void setSlotPosition(int index, int x, int y) {
|
||||
Slot slot = inventorySlots.getSlot(index);
|
||||
slot.xDisplayPosition = x;
|
||||
slot.yDisplayPosition = y;
|
||||
}
|
||||
|
||||
private boolean intersectsChest(Rectangle rectangle) {
|
||||
if (!hasChest() || chestLayout == null) return false;
|
||||
|
||||
if (!chestLayout.lShaped) {
|
||||
return new Rectangle(chestLeft, chestTop, chestLayout.panelWidth, chestLayout.panelHeight)
|
||||
.intersects(rectangle);
|
||||
}
|
||||
|
||||
int headerHeight = getHeaderHeight();
|
||||
int topSectionHeight = border.h + headerHeight
|
||||
+ chestLayout.overhangRows * slotElement.h
|
||||
+ chestLayout.separatorHeight
|
||||
+ border.h;
|
||||
Rectangle top = new Rectangle(chestLeft, chestTop, chestLayout.panelWidth, topSectionHeight);
|
||||
Rectangle lower = new Rectangle(
|
||||
chestLeft,
|
||||
chestTop + topSectionHeight - border.h,
|
||||
chestLayout.lowerPanelWidth,
|
||||
chestLayout.panelHeight - topSectionHeight + border.h);
|
||||
return top.intersects(rectangle) || lower.intersects(rectangle);
|
||||
}
|
||||
|
||||
private int getHeaderHeight() {
|
||||
return shouldDrawName() ? textBackground.h : 0;
|
||||
}
|
||||
|
||||
private ChestLayout selectChestLayout() {
|
||||
int craftingLeft = (width - CRAFTING_WIDTH) / 2;
|
||||
int bookmarkWidth = NEI_PANEL_MARGIN + NEI_BOOKMARK_GROUP_WIDTH + MIN_BOOKMARK_COLUMNS * slotElement.w;
|
||||
int availableChestWidth = Math.max(1, craftingLeft - bookmarkWidth);
|
||||
int availableHeight = Math.max(1, height - NEI_VERTICAL_MARGIN * 2);
|
||||
int headerHeight = getHeaderHeight();
|
||||
int descriptionWidth = logic.tinkerTable ? DESCRIPTION_WIDTH : 0;
|
||||
int sideHeight = logic.tinkerTable ? DESCRIPTION_HEIGHT : CRAFTING_HEIGHT;
|
||||
int availableWidth = availableChestWidth + CRAFTING_WIDTH + descriptionWidth;
|
||||
int maxColumns = Math.max(MIN_COLUMNS, (availableChestWidth - border.w * 2) / slotElement.w);
|
||||
|
||||
if (PHConstruct.classicCraftingStationLayout) {
|
||||
int totalRows = ceilDiv(chestSlotCount, DEFAULT_COLUMNS);
|
||||
return createRectangularLayout(
|
||||
DEFAULT_COLUMNS,
|
||||
Math.min(totalRows, CLASSIC_MAX_ROWS),
|
||||
totalRows > CLASSIC_MAX_ROWS,
|
||||
headerHeight,
|
||||
descriptionWidth,
|
||||
sideHeight,
|
||||
Integer.MAX_VALUE,
|
||||
Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
// Preserve the original six-column layout for standard connected inventories.
|
||||
if (chestSlotCount <= DEFAULT_COLUMNS * CLASSIC_MAX_ROWS) {
|
||||
return createRectangularLayout(
|
||||
DEFAULT_COLUMNS,
|
||||
ceilDiv(chestSlotCount, DEFAULT_COLUMNS),
|
||||
false,
|
||||
headerHeight,
|
||||
descriptionWidth,
|
||||
sideHeight,
|
||||
Integer.MAX_VALUE,
|
||||
Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
// Prefer a complete layout that fits, so scrolling remains a fallback.
|
||||
ChestLayout best = null;
|
||||
for (int columns = MIN_COLUMNS; columns <= maxColumns; columns++) {
|
||||
ChestLayout rectangle = createRectangularLayout(
|
||||
columns,
|
||||
ceilDiv(chestSlotCount, columns),
|
||||
false,
|
||||
headerHeight,
|
||||
descriptionWidth,
|
||||
sideHeight,
|
||||
availableWidth,
|
||||
availableHeight);
|
||||
best = selectBetterCompleteLayout(best, rectangle);
|
||||
|
||||
for (int overhangRows = 1; overhangRows <= MAX_OVERHANG_ROWS; overhangRows++) {
|
||||
ChestLayout lShape = createLShapedLayout(
|
||||
columns,
|
||||
overhangRows,
|
||||
Integer.MAX_VALUE,
|
||||
false,
|
||||
headerHeight,
|
||||
descriptionWidth,
|
||||
sideHeight,
|
||||
availableWidth,
|
||||
availableHeight);
|
||||
best = selectBetterCompleteLayout(best, lShape);
|
||||
}
|
||||
}
|
||||
|
||||
if (best != null) return best;
|
||||
|
||||
// If no complete layout fits, maximize the visible capacity of a scrolling layout.
|
||||
ChestLayout fallback = null;
|
||||
int maxVisibleRows = Math.max(1, (availableHeight - headerHeight - border.h * 2) / slotElement.h);
|
||||
int centeredCraftingTop = (height - CRAFTING_HEIGHT) / 2;
|
||||
int maxVisibleLowerRows = Math.max(1, (height - NEI_VERTICAL_MARGIN - centeredCraftingTop) / slotElement.h);
|
||||
for (int columns = MIN_COLUMNS; columns <= maxColumns; columns++) {
|
||||
ChestLayout candidate = createRectangularLayout(
|
||||
columns,
|
||||
maxVisibleRows,
|
||||
true,
|
||||
headerHeight,
|
||||
descriptionWidth,
|
||||
sideHeight,
|
||||
availableWidth,
|
||||
availableHeight);
|
||||
fallback = selectBetterScrollingLayout(fallback, candidate);
|
||||
|
||||
for (int overhangRows = 1; overhangRows <= MAX_OVERHANG_ROWS; overhangRows++) {
|
||||
ChestLayout lShape = createLShapedLayout(
|
||||
columns,
|
||||
overhangRows,
|
||||
maxVisibleLowerRows,
|
||||
true,
|
||||
headerHeight,
|
||||
descriptionWidth,
|
||||
sideHeight,
|
||||
availableWidth,
|
||||
availableHeight);
|
||||
fallback = selectBetterScrollingLayout(fallback, lShape);
|
||||
}
|
||||
}
|
||||
|
||||
if (fallback != null) return fallback;
|
||||
|
||||
// Last resort for screens that cannot fit even the reserved minimum layout.
|
||||
return createRectangularLayout(
|
||||
MIN_COLUMNS,
|
||||
maxVisibleRows,
|
||||
true,
|
||||
headerHeight,
|
||||
descriptionWidth,
|
||||
sideHeight,
|
||||
Integer.MAX_VALUE,
|
||||
Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
private ChestLayout createRectangularLayout(int columns, int visibleRows, boolean scrolling, int headerHeight,
|
||||
int descriptionWidth, int sideHeight, int availableWidth, int availableHeight) {
|
||||
int panelWidth = columns * slotElement.w + border.w * 2 + (scrolling ? slider.width : 0);
|
||||
int panelHeight = visibleRows * slotElement.h + headerHeight + border.h * 2;
|
||||
int combinedWidth = panelWidth + CRAFTING_WIDTH + descriptionWidth;
|
||||
int combinedHeight = Math.max(panelHeight, sideHeight);
|
||||
int chestTopOffset = PHConstruct.classicCraftingStationLayout ? 0 : (combinedHeight - panelHeight) / 2;
|
||||
int craftingTopOffset = PHConstruct.classicCraftingStationLayout ? 0 : (combinedHeight - sideHeight) / 2;
|
||||
int totalRows = ceilDiv(chestSlotCount, columns);
|
||||
int visibleCapacity = columns * visibleRows;
|
||||
int unusedSlots = Math.max(0, visibleCapacity - chestSlotCount);
|
||||
|
||||
return new ChestLayout(
|
||||
false,
|
||||
scrolling,
|
||||
columns,
|
||||
columns,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
visibleRows,
|
||||
totalRows,
|
||||
panelWidth,
|
||||
panelWidth,
|
||||
panelHeight,
|
||||
combinedHeight,
|
||||
chestTopOffset,
|
||||
craftingTopOffset,
|
||||
visibleCapacity,
|
||||
unusedSlots,
|
||||
score(combinedWidth, combinedHeight, availableWidth, availableHeight),
|
||||
combinedWidth <= availableWidth && fitsVertically(combinedHeight, craftingTopOffset));
|
||||
}
|
||||
|
||||
private ChestLayout createLShapedLayout(int columns, int overhangRows, int visibleLowerRows, boolean scrolling,
|
||||
int headerHeight, int descriptionWidth, int sideHeight, int availableWidth, int availableHeight) {
|
||||
int overhangColumns = ceilDiv(CRAFTING_WIDTH, slotElement.w);
|
||||
int topColumns = columns + overhangColumns;
|
||||
int topCapacity = topColumns * overhangRows;
|
||||
int remainingSlots = chestSlotCount - topCapacity;
|
||||
if (remainingSlots <= 0) return null;
|
||||
|
||||
int totalLowerRows = ceilDiv(remainingSlots, columns);
|
||||
if (!scrolling) visibleLowerRows = totalLowerRows;
|
||||
int separatorHeight = scrolling ? SCROLL_SEPARATOR_HEIGHT : 0;
|
||||
|
||||
int panelWidth = topColumns * slotElement.w + border.w * 2;
|
||||
int lowerPanelWidth = columns * slotElement.w + border.w * 2 + (scrolling ? slider.width : 0);
|
||||
int panelHeight = (overhangRows + visibleLowerRows) * slotElement.h + separatorHeight
|
||||
+ headerHeight
|
||||
+ border.h * 2;
|
||||
int craftingTopOffset = border.h + headerHeight + overhangRows * slotElement.h + separatorHeight + border.h;
|
||||
int combinedWidth = Math.max(panelWidth, lowerPanelWidth + CRAFTING_WIDTH + descriptionWidth);
|
||||
int combinedHeight = Math.max(panelHeight, craftingTopOffset + sideHeight);
|
||||
int visibleCapacity = topCapacity + visibleLowerRows * columns;
|
||||
double screenUsage = score(combinedWidth, combinedHeight, availableWidth, availableHeight);
|
||||
|
||||
return new ChestLayout(
|
||||
true,
|
||||
scrolling,
|
||||
columns,
|
||||
topColumns,
|
||||
topCapacity,
|
||||
overhangRows,
|
||||
separatorHeight,
|
||||
visibleLowerRows,
|
||||
totalLowerRows,
|
||||
panelWidth,
|
||||
lowerPanelWidth,
|
||||
panelHeight,
|
||||
combinedHeight,
|
||||
0,
|
||||
craftingTopOffset,
|
||||
visibleCapacity,
|
||||
scrolling ? 0 : visibleCapacity - chestSlotCount,
|
||||
screenUsage,
|
||||
combinedWidth <= availableWidth && fitsVertically(combinedHeight, craftingTopOffset));
|
||||
}
|
||||
|
||||
private boolean fitsVertically(int combinedHeight, int craftingTopOffset) {
|
||||
int centeredCraftingTop = (height - CRAFTING_HEIGHT) / 2;
|
||||
int combinedTop = centeredCraftingTop - craftingTopOffset;
|
||||
return combinedTop >= NEI_VERTICAL_MARGIN && combinedTop + combinedHeight <= height - NEI_VERTICAL_MARGIN;
|
||||
}
|
||||
|
||||
private ChestLayout selectBetterCompleteLayout(ChestLayout current, ChestLayout candidate) {
|
||||
if (candidate == null || !candidate.fits) return current;
|
||||
if (current == null) return candidate;
|
||||
|
||||
double currentScore = current.score + current.unusedSlots * UNUSED_SLOT_SCORE_PENALTY;
|
||||
double candidateScore = candidate.score + candidate.unusedSlots * UNUSED_SLOT_SCORE_PENALTY;
|
||||
if (candidateScore < currentScore) return candidate;
|
||||
if (candidateScore > currentScore) return current;
|
||||
if (candidate.unusedSlots < current.unusedSlots) return candidate;
|
||||
if (candidate.unusedSlots > current.unusedSlots) return current;
|
||||
if (!candidate.lShaped && current.lShaped) return candidate;
|
||||
return current;
|
||||
}
|
||||
|
||||
private ChestLayout selectBetterScrollingLayout(ChestLayout current, ChestLayout candidate) {
|
||||
if (candidate == null || !candidate.fits) return current;
|
||||
if (current == null || candidate.visibleCapacity > current.visibleCapacity) return candidate;
|
||||
if (candidate.visibleCapacity < current.visibleCapacity) return current;
|
||||
if (candidate.score < current.score) return candidate;
|
||||
return current;
|
||||
}
|
||||
|
||||
private static double score(int width, int height, int availableWidth, int availableHeight) {
|
||||
return Math.max((double) width / availableWidth, (double) height / availableHeight);
|
||||
}
|
||||
|
||||
private static int ceilDiv(int value, int divisor) {
|
||||
return (value + divisor - 1) / divisor;
|
||||
}
|
||||
|
||||
/** Geometry shared by rendering, slot positioning, hit testing, and NEI integration. */
|
||||
private static class ChestLayout {
|
||||
|
||||
private final boolean lShaped;
|
||||
private final boolean scrolling;
|
||||
private final int columns;
|
||||
private final int topColumns;
|
||||
private final int topCapacity;
|
||||
private final int overhangRows;
|
||||
private final int separatorHeight;
|
||||
private final int visibleRows;
|
||||
private final int totalRows;
|
||||
private final int panelWidth;
|
||||
private final int lowerPanelWidth;
|
||||
private final int panelHeight;
|
||||
private final int combinedHeight;
|
||||
private final int chestTopOffset;
|
||||
private final int craftingTopOffset;
|
||||
private final int visibleCapacity;
|
||||
private final int unusedSlots;
|
||||
private final double score;
|
||||
private final boolean fits;
|
||||
|
||||
private ChestLayout(boolean lShaped, boolean scrolling, int columns, int topColumns, int topCapacity,
|
||||
int overhangRows, int separatorHeight, int visibleRows, int totalRows, int panelWidth,
|
||||
int lowerPanelWidth, int panelHeight, int combinedHeight, int chestTopOffset, int craftingTopOffset,
|
||||
int visibleCapacity, int unusedSlots, double score, boolean fits) {
|
||||
this.lShaped = lShaped;
|
||||
this.scrolling = scrolling;
|
||||
this.columns = columns;
|
||||
this.topColumns = topColumns;
|
||||
this.topCapacity = topCapacity;
|
||||
this.overhangRows = overhangRows;
|
||||
this.separatorHeight = separatorHeight;
|
||||
this.visibleRows = visibleRows;
|
||||
this.totalRows = totalRows;
|
||||
this.panelWidth = panelWidth;
|
||||
this.lowerPanelWidth = lowerPanelWidth;
|
||||
this.panelHeight = panelHeight;
|
||||
this.combinedHeight = combinedHeight;
|
||||
this.chestTopOffset = chestTopOffset;
|
||||
this.craftingTopOffset = craftingTopOffset;
|
||||
this.visibleCapacity = visibleCapacity;
|
||||
this.unusedSlots = unusedSlots;
|
||||
this.score = score;
|
||||
this.fits = fits;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.minecraft.world.World;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.library.util.ColorUtils;
|
||||
import tconstruct.tools.logic.FrypanLogic;
|
||||
|
||||
public class FrypanGui extends GuiContainer {
|
||||
@@ -21,9 +22,16 @@ public class FrypanGui extends GuiContainer {
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("crafters.Frypan"), 60, 6, 0x404040);
|
||||
fontRendererObj
|
||||
.drawString(StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||
fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal("crafters.Frypan"),
|
||||
60,
|
||||
6,
|
||||
ColorUtils.inventoryTitle.getColor());
|
||||
fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal("container.inventory"),
|
||||
8,
|
||||
(ySize - 96) + 2,
|
||||
ColorUtils.inventoryTitle.getColor());
|
||||
}
|
||||
|
||||
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/frypan.png");
|
||||
|
||||
@@ -16,6 +16,9 @@ package tconstruct.tools.gui;
|
||||
|
||||
public class GuiBorderWidget {
|
||||
|
||||
private static final int OUTLINE_WIDTH = 1;
|
||||
private static final int SHADOW_WIDTH = 2;
|
||||
|
||||
// all elements based on generic gui
|
||||
public GuiElementDuex cornerTopLeft = new GuiElementDuex(0, 0, 7, 7, 64, 64);
|
||||
public GuiElementDuex cornerTopRight = new GuiElementDuex(64 - 7, 0, 7, 7, 64, 64);
|
||||
@@ -27,6 +30,28 @@ public class GuiBorderWidget {
|
||||
public GuiElementScalable borderLeft = new GuiElementScalable(0, 7, 7, 64 - 7 - 7, 64, 64);
|
||||
public GuiElementScalable borderRight = new GuiElementScalable(64 - 7, 7, 7, 64 - 7 - 7, 64, 64);
|
||||
|
||||
private final GuiElementScalable borderInteriorPixel = new GuiElementScalable(
|
||||
borderBottom.x,
|
||||
borderBottom.y,
|
||||
1,
|
||||
1,
|
||||
borderBottom.texW,
|
||||
borderBottom.texH);
|
||||
private final GuiElementScalable borderShadowPixel = new GuiElementScalable(
|
||||
borderBottom.x,
|
||||
borderBottom.y + borderBottom.h - OUTLINE_WIDTH - SHADOW_WIDTH,
|
||||
1,
|
||||
1,
|
||||
borderBottom.texW,
|
||||
borderBottom.texH);
|
||||
private final GuiElementScalable borderOutlinePixel = new GuiElementScalable(
|
||||
borderBottom.x,
|
||||
borderBottom.y + borderBottom.h - OUTLINE_WIDTH,
|
||||
1,
|
||||
1,
|
||||
borderBottom.texW,
|
||||
borderBottom.texH);
|
||||
|
||||
public int xPos;
|
||||
public int yPos;
|
||||
public int height;
|
||||
@@ -62,6 +87,14 @@ public class GuiBorderWidget {
|
||||
return height + borderTop.h + borderBottom.h;
|
||||
}
|
||||
|
||||
public void drawConcaveBottomRight(int x, int y) {
|
||||
int shadowSize = OUTLINE_WIDTH + SHADOW_WIDTH;
|
||||
borderInteriorPixel.drawScaled(x, y, w, h);
|
||||
borderShadowPixel.drawScaled(x + w - shadowSize, y + h - shadowSize, shadowSize, shadowSize);
|
||||
borderInteriorPixel.draw(x + w - shadowSize, y + h - shadowSize);
|
||||
borderOutlinePixel.draw(x + w - OUTLINE_WIDTH, y + h - OUTLINE_WIDTH);
|
||||
}
|
||||
|
||||
public void draw() {
|
||||
int x = xPos;
|
||||
int y = yPos;
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.minecraft.world.World;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.library.util.ColorUtils;
|
||||
import tconstruct.tools.logic.PartChestLogic;
|
||||
|
||||
public class PartChestGui extends GuiContainer {
|
||||
@@ -23,9 +24,16 @@ public class PartChestGui extends GuiContainer {
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("inventory.PartChest"), 8, 8, 0x404040);
|
||||
fontRendererObj
|
||||
.drawString(StatCollector.translateToLocal("container.inventory"), 17, (ySize - 96) + 2, 0x404040);
|
||||
fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal("inventory.PartChest"),
|
||||
8,
|
||||
8,
|
||||
ColorUtils.inventoryTitle.getColor());
|
||||
fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal("container.inventory"),
|
||||
17,
|
||||
(ySize - 96) + 2,
|
||||
ColorUtils.inventoryTitle.getColor());
|
||||
}
|
||||
|
||||
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/partchest.png");
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package tconstruct.tools.gui;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -23,6 +24,7 @@ import tconstruct.library.crafting.PatternBuilder;
|
||||
import tconstruct.library.tools.ArrowMaterial;
|
||||
import tconstruct.library.tools.BowMaterial;
|
||||
import tconstruct.library.tools.ToolMaterial;
|
||||
import tconstruct.library.util.ColorUtils;
|
||||
import tconstruct.library.util.HarvestLevels;
|
||||
import tconstruct.library.weaponry.ArrowShaftMaterial;
|
||||
import tconstruct.tools.TinkerTools.MaterialID;
|
||||
@@ -48,7 +50,7 @@ public class PartCrafterGui extends GuiContainer implements INEIGuiHandler {
|
||||
private static final int DESC_WIDTH = 126;
|
||||
private static final int DESC_HEIGHT = 166;
|
||||
private static final int CHEST_WIDTH = 122;
|
||||
private static final int CHEST_HEIGHT = 114;
|
||||
private static final int CHEST_HEIGHT = 115;
|
||||
private static final String SPACE_STRING = " ";
|
||||
|
||||
// Panel positions
|
||||
@@ -64,8 +66,6 @@ public class PartCrafterGui extends GuiContainer implements INEIGuiHandler {
|
||||
private int chestLeft = 0;
|
||||
private int chestTop = 0;
|
||||
|
||||
private static DecimalFormat df = new DecimalFormat("##.##");
|
||||
|
||||
public PartCrafterGui(InventoryPlayer inventoryplayer, PartBuilderLogic partlogic, World world, int x, int y,
|
||||
int z) {
|
||||
super(partlogic.getGuiContainer(inventoryplayer, world, x, y, z));
|
||||
@@ -106,16 +106,23 @@ public class PartCrafterGui extends GuiContainer implements INEIGuiHandler {
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
if (drawChestPart) {
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("inventory.PatternChest"), 8, 17, 0x404040);
|
||||
this.fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal("inventory.PatternChest"),
|
||||
8,
|
||||
17,
|
||||
ColorUtils.inventoryTitle.getColor());
|
||||
}
|
||||
|
||||
this.fontRendererObj
|
||||
.drawString(StatCollector.translateToLocal("crafters.PartBuilder"), craftingTextLeft + 6, 6, 0x404040);
|
||||
this.fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal("crafters.PartBuilder"),
|
||||
craftingTextLeft + 6,
|
||||
6,
|
||||
ColorUtils.inventoryTitle.getColor());
|
||||
this.fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal("container.inventory"),
|
||||
craftingTextLeft + 8,
|
||||
this.ySize - 96 + 2,
|
||||
0x404040);
|
||||
ColorUtils.inventoryTitle.getColor());
|
||||
|
||||
drawMaterialInformation();
|
||||
}
|
||||
@@ -171,7 +178,7 @@ public class PartCrafterGui extends GuiContainer implements INEIGuiHandler {
|
||||
strWait2Draw.add(
|
||||
StatCollector.translateToLocalFormatted(
|
||||
"gui.partcrafter.durability",
|
||||
McTextFormatter.addGreen(String.valueOf(materialEnum.durability()))));
|
||||
McTextFormatter.addGreen(formatNumber(materialEnum.durability()))));
|
||||
strWait2Draw.add(
|
||||
StatCollector.translateToLocalFormatted(
|
||||
"gui.partcrafter.mininglevel",
|
||||
@@ -179,25 +186,25 @@ public class PartCrafterGui extends GuiContainer implements INEIGuiHandler {
|
||||
strWait2Draw.add(
|
||||
StatCollector.translateToLocalFormatted(
|
||||
"gui.partcrafter.miningspeed",
|
||||
McTextFormatter.addAqua(String.valueOf(materialEnum.toolSpeed() / 100f))));
|
||||
McTextFormatter.addAqua(formatNumber(materialEnum.toolSpeed() / 100f))));
|
||||
strWait2Draw.add(
|
||||
StatCollector.translateToLocalFormatted(
|
||||
"gui.partcrafter.attack",
|
||||
McTextFormatter.addRed(String.valueOf(materialEnum.attack()))));
|
||||
McTextFormatter.addRed(formatNumber(materialEnum.attack()))));
|
||||
strWait2Draw.add(
|
||||
StatCollector.translateToLocalFormatted(
|
||||
"gui.partcrafter.handlemodifier",
|
||||
McTextFormatter.addYellow(String.valueOf(materialEnum.handleDurability()))));
|
||||
McTextFormatter.addYellow(formatNumber(materialEnum.handleDurability()))));
|
||||
|
||||
if (bowMaterial != null) {
|
||||
strWait2Draw.add(
|
||||
StatCollector.translateToLocalFormatted(
|
||||
"gui.partcrafter.drawspeed",
|
||||
McTextFormatter.addGray(df.format(bowMaterial.drawspeed / 20f))));
|
||||
McTextFormatter.addGray(formatNumber(bowMaterial.drawspeed / 20f))));
|
||||
strWait2Draw.add(
|
||||
StatCollector.translateToLocalFormatted(
|
||||
"gui.partcrafter.arrowspeed",
|
||||
McTextFormatter.addGray(df.format(bowMaterial.flightSpeedMax))));
|
||||
McTextFormatter.addGray(formatNumber(bowMaterial.flightSpeedMax))));
|
||||
}
|
||||
|
||||
if (arrowShaftMaterial != null) {
|
||||
@@ -206,11 +213,11 @@ public class PartCrafterGui extends GuiContainer implements INEIGuiHandler {
|
||||
strWait2Draw.add(
|
||||
SPACE_STRING + StatCollector.translateToLocalFormatted(
|
||||
"gui.partcrafter.weight",
|
||||
McTextFormatter.addYellow(df.format(arrowShaftMaterial.weight))));
|
||||
McTextFormatter.addYellow(formatNumber(arrowShaftMaterial.weight))));
|
||||
strWait2Draw.add(
|
||||
SPACE_STRING + StatCollector.translateToLocalFormatted(
|
||||
"gui.partcrafter.breakchance",
|
||||
McTextFormatter.addYellow(df.format(arrowShaftMaterial.fragility * 100f))));
|
||||
McTextFormatter.addYellow(formatNumber(arrowShaftMaterial.fragility * 100f))));
|
||||
}
|
||||
|
||||
if (arrowMaterial != null) {
|
||||
@@ -219,11 +226,11 @@ public class PartCrafterGui extends GuiContainer implements INEIGuiHandler {
|
||||
strWait2Draw.add(
|
||||
SPACE_STRING + StatCollector.translateToLocalFormatted(
|
||||
"gui.partcrafter.weight",
|
||||
McTextFormatter.addYellow(df.format(arrowMaterial.mass))));
|
||||
McTextFormatter.addYellow(formatNumber(arrowMaterial.mass))));
|
||||
strWait2Draw.add(
|
||||
SPACE_STRING + StatCollector.translateToLocalFormatted(
|
||||
"gui.partcrafter.breakchance",
|
||||
McTextFormatter.addYellow(df.format(arrowMaterial.breakChance * 100f))));
|
||||
McTextFormatter.addYellow(formatNumber(arrowMaterial.breakChance * 100f))));
|
||||
}
|
||||
|
||||
for (String tempStr : strWait2Draw) {
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.minecraft.world.World;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.library.util.ColorUtils;
|
||||
import tconstruct.tools.logic.PatternChestLogic;
|
||||
|
||||
public class PatternChestGui extends GuiContainer {
|
||||
@@ -24,9 +25,16 @@ public class PatternChestGui extends GuiContainer {
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("inventory.PatternChest"), 8, 8, 0x404040);
|
||||
fontRendererObj
|
||||
.drawString(StatCollector.translateToLocal("container.inventory"), 17, (ySize - 96) + 2, 0x404040);
|
||||
fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal("inventory.PatternChest"),
|
||||
8,
|
||||
8,
|
||||
ColorUtils.inventoryTitle.getColor());
|
||||
fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal("container.inventory"),
|
||||
17,
|
||||
(ySize - 96) + 2,
|
||||
ColorUtils.inventoryTitle.getColor());
|
||||
}
|
||||
|
||||
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/patternchest.png");
|
||||
|
||||
@@ -21,6 +21,7 @@ import tconstruct.TConstruct;
|
||||
import tconstruct.library.client.StencilGuiElement;
|
||||
import tconstruct.library.client.TConstructClientRegistry;
|
||||
import tconstruct.library.crafting.StencilBuilder;
|
||||
import tconstruct.library.util.ColorUtils;
|
||||
import tconstruct.tools.inventory.PatternShaperChestContainer;
|
||||
import tconstruct.tools.logic.StencilTableLogic;
|
||||
import tconstruct.util.network.PatternTablePacket;
|
||||
@@ -63,12 +64,19 @@ public class StencilTableGui extends GuiContainer implements INEIGuiHandler {
|
||||
StatCollector.translateToLocal("inventory.PatternChest"),
|
||||
TEXTURE_WIDTH + 5,
|
||||
17,
|
||||
0x404040);
|
||||
ColorUtils.inventoryTitle.getColor());
|
||||
}
|
||||
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("crafters.PatternShaper"), 50, 6, 0x404040);
|
||||
fontRendererObj
|
||||
.drawString(StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||
fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal("crafters.PatternShaper"),
|
||||
50,
|
||||
6,
|
||||
ColorUtils.inventoryTitle.getColor());
|
||||
fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal("container.inventory"),
|
||||
8,
|
||||
(ySize - 96) + 2,
|
||||
ColorUtils.inventoryTitle.getColor());
|
||||
}
|
||||
|
||||
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/patternshaper.png");
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package tconstruct.tools.gui;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
@@ -31,8 +32,6 @@ public final class ToolStationGuiHelper {
|
||||
private static final FontRenderer fontRendererObj = Minecraft.getMinecraft().fontRenderer;
|
||||
private static int xPos, yPos;
|
||||
|
||||
private static final DecimalFormat df = new DecimalFormat("#.##");
|
||||
|
||||
private static void newline() {
|
||||
yPos += 10;
|
||||
}
|
||||
@@ -109,9 +108,12 @@ public final class ToolStationGuiHelper {
|
||||
// big durabilities have to split to 2 lines
|
||||
if (maxDur >= 10000) {
|
||||
write(StatCollector.translateToLocal("gui.toolstation1"));
|
||||
write("- " + availableDurability + "/" + maxDur);
|
||||
write("- " + formatNumber(availableDurability) + " / " + formatNumber(maxDur));
|
||||
} else {
|
||||
write(StatCollector.translateToLocal("gui.toolstation2") + availableDurability + "/" + maxDur);
|
||||
write(
|
||||
StatCollector.translateToLocal("gui.toolstation2") + formatNumber(availableDurability)
|
||||
+ " / "
|
||||
+ formatNumber(maxDur));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,13 +121,13 @@ public final class ToolStationGuiHelper {
|
||||
final int max = ammoItem.getMaxAmmo(stack);
|
||||
final int current = ammoItem.getAmmoCount(stack);
|
||||
|
||||
write(StatCollector.translateToLocal("gui.toolstation21") + current + "/" + max);
|
||||
write(StatCollector.translateToLocal("gui.toolstation21") + formatNumber(current) + " / " + formatNumber(max));
|
||||
}
|
||||
|
||||
private static void drawModifiers(NBTTagCompound tags) {
|
||||
int modifiers = tags.getInteger("Modifiers");
|
||||
// remaining modifiers
|
||||
if (modifiers != 0) write(StatCollector.translateToLocal("gui.toolstation18") + modifiers);
|
||||
if (modifiers != 0) write(StatCollector.translateToLocal("gui.toolstation18") + formatNumber(modifiers));
|
||||
|
||||
// Modifier-header (if we have modifiers)
|
||||
if (tags.hasKey("ModifierTip1")) {
|
||||
@@ -158,11 +160,11 @@ public final class ToolStationGuiHelper {
|
||||
float mineSpeed = AbilityHelper.calcToolSpeed(tool, tags);
|
||||
float stoneboundSpeed = AbilityHelper.calcStoneboundBonus(tool, tags);
|
||||
|
||||
write(StatCollector.translateToLocal("gui.toolstation14") + df.format(mineSpeed));
|
||||
write(StatCollector.translateToLocal("gui.toolstation14") + formatNumber(mineSpeed));
|
||||
if (stoneboundSpeed != 0) {
|
||||
String bloss = stoneboundSpeed > 0 ? StatCollector.translateToLocal("gui.toolstation4")
|
||||
: StatCollector.translateToLocal("gui.toolstation5");
|
||||
write(bloss + df.format(stoneboundSpeed));
|
||||
write(bloss + formatNumber(stoneboundSpeed));
|
||||
}
|
||||
write(
|
||||
StatCollector.translateToLocal("gui.toolstation15")
|
||||
@@ -175,11 +177,11 @@ public final class ToolStationGuiHelper {
|
||||
float stoneboundSpeed = AbilityHelper.calcStoneboundBonus(tool, tags);
|
||||
|
||||
write(StatCollector.translateToLocal("gui.toolstation12"));
|
||||
write("- " + df.format(mineSpeed) + ", " + df.format(mineSpeed2));
|
||||
write("- " + formatNumber(mineSpeed) + ", " + formatNumber(mineSpeed2));
|
||||
if (stoneboundSpeed != 0) {
|
||||
String bloss = stoneboundSpeed > 0 ? StatCollector.translateToLocal("gui.toolstation4")
|
||||
: StatCollector.translateToLocal("gui.toolstation5");
|
||||
write(bloss + df.format(stoneboundSpeed));
|
||||
write(bloss + formatNumber(stoneboundSpeed));
|
||||
}
|
||||
|
||||
write(StatCollector.translateToLocal("gui.toolstation13"));
|
||||
@@ -202,15 +204,16 @@ public final class ToolStationGuiHelper {
|
||||
|
||||
String heart = attack == 2 ? StatCollector.translateToLocal("gui.partcrafter8")
|
||||
: StatCollector.translateToLocal("gui.partcrafter9");
|
||||
if (attack % 2 == 0) write(StatCollector.translateToLocal("gui.toolstation3") + attack / 2 + heart);
|
||||
else write(StatCollector.translateToLocal("gui.toolstation3") + df.format(attack / 2f) + heart);
|
||||
if (attack % 2 == 0)
|
||||
write(StatCollector.translateToLocal("gui.toolstation3") + formatNumber(attack / 2) + heart);
|
||||
else write(StatCollector.translateToLocal("gui.toolstation3") + formatNumber(attack / 2f) + heart);
|
||||
|
||||
if (stoneboundDamage != 0) {
|
||||
heart = stoneboundDamage == 2 ? StatCollector.translateToLocal("gui.partcrafter8")
|
||||
: StatCollector.translateToLocal("gui.partcrafter9");
|
||||
String bloss = stoneboundDamage > 0 ? StatCollector.translateToLocal("gui.toolstation4")
|
||||
: StatCollector.translateToLocal("gui.toolstation5");
|
||||
write(bloss + df.format(stoneboundDamage / 2f) + heart);
|
||||
write(bloss + formatNumber(stoneboundDamage / 2f) + heart);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,56 +228,57 @@ public final class ToolStationGuiHelper {
|
||||
|
||||
String heart = attack == 2 ? StatCollector.translateToLocal("gui.partcrafter8")
|
||||
: StatCollector.translateToLocal("gui.partcrafter9");
|
||||
if (attack % 2 == 0) write(StatCollector.translateToLocal("gui.toolstation23") + attack / 2 + heart);
|
||||
else write(StatCollector.translateToLocal("gui.toolstation23") + df.format(attack / 2f) + heart);
|
||||
if (attack % 2 == 0)
|
||||
write(StatCollector.translateToLocal("gui.toolstation23") + formatNumber(attack / 2) + heart);
|
||||
else write(StatCollector.translateToLocal("gui.toolstation23") + formatNumber(attack / 2f) + heart);
|
||||
}
|
||||
|
||||
private static void drawProjectileWeaponStats(ProjectileWeapon weapon, NBTTagCompound tags, ItemStack stack) {
|
||||
// drawspeed
|
||||
final int drawSpeed = weapon.getWindupTime(stack);
|
||||
final float trueDraw = drawSpeed / 20f;
|
||||
write(StatCollector.translateToLocal("gui.toolstation6") + df.format(trueDraw) + "s");
|
||||
write(StatCollector.translateToLocal("gui.toolstation6") + formatNumber(trueDraw) + "s");
|
||||
|
||||
// flightspeed
|
||||
final float flightSpeed = weapon.getProjectileSpeed(stack);
|
||||
write(StatCollector.translateToLocal("gui.toolstation7") + df.format(flightSpeed) + "x");
|
||||
write(StatCollector.translateToLocal("gui.toolstation7") + formatNumber(flightSpeed) + "x");
|
||||
}
|
||||
|
||||
private static void drawProjectileStats(NBTTagCompound tags) {
|
||||
// weight
|
||||
final float weight = tags.getFloat("Mass");
|
||||
write(StatCollector.translateToLocal("gui.toolstation8") + df.format(weight));
|
||||
write(StatCollector.translateToLocal("gui.toolstation8") + formatNumber(weight));
|
||||
|
||||
// accuracy
|
||||
final float accuracy = tags.getFloat("Accuracy");
|
||||
write(StatCollector.translateToLocal("gui.toolstation9") + df.format(accuracy) + "%");
|
||||
write(StatCollector.translateToLocal("gui.toolstation9") + formatNumber(accuracy) + "%");
|
||||
|
||||
// breakchance
|
||||
final float breakChance = tags.getFloat("BreakChance") * 100;
|
||||
write(StatCollector.translateToLocal("gui.toolstation22") + df.format(breakChance) + "%");
|
||||
write(StatCollector.translateToLocal("gui.toolstation22") + formatNumber(breakChance) + "%");
|
||||
}
|
||||
|
||||
private static void drawArmorStats(ArmorCore armor, NBTTagCompound tags, ItemStack stack) {
|
||||
// Damage reduction
|
||||
double damageReduction = tags.getDouble("DamageReduction");
|
||||
if (damageReduction > 0)
|
||||
write(StatCollector.translateToLocal("gui.toolstation19") + df.format(damageReduction));
|
||||
write(StatCollector.translateToLocal("gui.toolstation19") + formatNumber(damageReduction));
|
||||
|
||||
// Protection
|
||||
double protection = armor.getProtection(stack);
|
||||
double maxProtection = tags.getDouble("MaxDefense");
|
||||
|
||||
write(
|
||||
StatCollector.translateToLocal("gui.toolstation20") + df.format(protection)
|
||||
+ "/"
|
||||
+ df.format(maxProtection));
|
||||
StatCollector.translateToLocal("gui.toolstation20") + formatNumber(protection)
|
||||
+ " / "
|
||||
+ formatNumber(maxProtection));
|
||||
}
|
||||
|
||||
private static void drawAccessoryStats(AccessoryCore core, NBTTagCompound tags) {
|
||||
if (tags.hasKey("MiningSpeed")) {
|
||||
float mineSpeed = tags.getInteger("MiningSpeed");
|
||||
float trueSpeed = mineSpeed / (100f);
|
||||
write(StatCollector.translateToLocal("gui.toolstation16") + trueSpeed);
|
||||
write(StatCollector.translateToLocal("gui.toolstation16") + formatNumber(trueSpeed));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -33,7 +33,7 @@ public class MaterialItem extends CraftingItem {
|
||||
"EssenceCrystal", "AluBrassNugget", "SilkyCloth", "SilkyJewel", "ObsidianNugget", "CobaltNugget",
|
||||
"ArditeNugget", "ManyullynNugget", "BronzeNugget", "AlumiteNugget", "SteelNugget", "PigIronIngot",
|
||||
"PigIronNugget", "GlueBall", "SearedBrick", "ArditeDust", "CobaltDust", "AluminumDust", "ManyullynDust",
|
||||
"AluBrassDust", "Reinforcement" };
|
||||
"AluBrassDust", "Reinforcement", "ExpanderHorizontal", "ExpanderVertical" };
|
||||
|
||||
static String[] craftingTextures = new String[] { "paperstack", "slimecrystal", "searedbrick", "cobaltingot",
|
||||
"arditeingot", "manyullyningot", "mossball", "lavacrystal", "necroticbone", "copperingot", "tiningot",
|
||||
@@ -42,7 +42,7 @@ public class MaterialItem extends CraftingItem {
|
||||
"nugget_alubrass", "silkycloth", "silkyjewel", "nugget_obsidian", "nugget_cobalt", "nugget_ardite",
|
||||
"nugget_manyullyn", "nugget_bronze", "nugget_alumite", "nugget_steel", "pigironingot", "nugget_pigiron",
|
||||
"glueball", "searedbrick_nether", "ardite_dust", "cobalt_dust", "aluminum_dust", "manyullyn_dust",
|
||||
"alubrass_dust", "reinforcement" };
|
||||
"alubrass_dust", "reinforcement", "expander_horizontal", "expander_vertical" };
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -73,6 +73,18 @@ public class MaterialItem extends CraftingItem {
|
||||
StatCollector.translateToLocal("modifier.tooltip.Main") + "\u00a75 "
|
||||
+ StatCollector.translateToLocal("tool.reinforced"));
|
||||
break;
|
||||
case 44:
|
||||
list.add(
|
||||
StatCollector.translateToLocal("modifier.tooltip.Main") + "\u00a7a "
|
||||
+ StatCollector.translateToLocal("modifier.tool.width"));
|
||||
list.add("\u00a78\u00a7o" + StatCollector.translateToLocal("modifier.tooltip.expander.horizontal"));
|
||||
break;
|
||||
case 45:
|
||||
list.add(
|
||||
StatCollector.translateToLocal("modifier.tooltip.Main") + "\u00a7a "
|
||||
+ StatCollector.translateToLocal("modifier.tool.height"));
|
||||
list.add("\u00a78\u00a7o" + StatCollector.translateToLocal("modifier.tooltip.expander.vertical"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package tconstruct.tools.items;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -103,8 +105,9 @@ public class Pattern extends CraftingItem implements IPattern {
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> list, boolean par4) {
|
||||
float cost = getPatternCost(stack) / 2f;
|
||||
if (cost > 0) {
|
||||
if (cost - (int) cost < 0.1) list.add(StatCollector.translateToLocal("pattern1.tooltip") + (int) cost);
|
||||
else list.add(StatCollector.translateToLocal("pattern2.tooltip") + cost);
|
||||
if (cost - (int) cost < 0.1)
|
||||
list.add(StatCollector.translateToLocalFormatted("pattern1.tooltip", formatNumber(cost)));
|
||||
else list.add(StatCollector.translateToLocalFormatted("pattern2.tooltip", formatNumber(cost)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,6 @@ package tconstruct.tools.logic;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/*
|
||||
@@ -13,6 +11,8 @@ import net.minecraft.world.World;
|
||||
|
||||
public class BattlesignLogic extends EquipLogic {
|
||||
|
||||
public static final int LINE_COUNT = 5;
|
||||
|
||||
protected String[] text;
|
||||
|
||||
public BattlesignLogic() {
|
||||
@@ -72,16 +72,4 @@ public class BattlesignLogic extends EquipLogic {
|
||||
public String[] getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public S35PacketUpdateTileEntity getDescriptionPacket() {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
this.writeToNBT(compound);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
this.readFromNBT(pkt.func_148857_g());
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,18 @@
|
||||
package tconstruct.tools.logic;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityChest;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
@@ -20,6 +25,11 @@ import tconstruct.util.config.PHConstruct;
|
||||
|
||||
public class CraftingStationLogic extends InventoryLogic implements ISidedInventory {
|
||||
|
||||
private static final String SIDE_INVENTORY_PREFERENCES_TAG = "SideInventoryPreferences";
|
||||
private static final int CRAFTING_GRID_FIRST_SLOT = 1;
|
||||
private static final int CRAFTING_GRID_SIZE = 9;
|
||||
private static final int VALID_SIDE_INVENTORY_PREFERENCES = (1 << CRAFTING_GRID_SIZE) - 1;
|
||||
|
||||
public ForgeDirection chestDirection = ForgeDirection.UNKNOWN;
|
||||
public int chestSize;
|
||||
public WeakReference<IInventory> chest;
|
||||
@@ -30,10 +40,17 @@ public class CraftingStationLogic extends InventoryLogic implements ISidedInvent
|
||||
public boolean stencilTable;
|
||||
public boolean doubleFirst;
|
||||
|
||||
/** Server-selected shift-click behavior, synchronized before opening the GUI. */
|
||||
public boolean shiftClickToGrid;
|
||||
|
||||
public int invRows, invColumns, slotCount;
|
||||
|
||||
private static final int[] NO_SLOTS = new int[0];
|
||||
|
||||
private int sideInventoryPreferences;
|
||||
private int[] firstInventorySlots = NO_SLOTS;
|
||||
private int[] secondInventorySlots = NO_SLOTS;
|
||||
|
||||
/** Cached result of {@link #getInventories()}; rebuilt when the adjacent inventories are rescanned. */
|
||||
@SuppressWarnings("rawtypes")
|
||||
private WeakReference[] inventories = new WeakReference[4];
|
||||
@@ -52,7 +69,67 @@ public class CraftingStationLogic extends InventoryLogic implements ISidedInvent
|
||||
if (slot == 0) {
|
||||
for (int i = 1; i < getSizeInventory(); i++) decrStackSize(i, 1);
|
||||
}
|
||||
return super.decrStackSize(slot, quantity);
|
||||
ItemStack removed = super.decrStackSize(slot, quantity);
|
||||
clearSideInventoryPreferenceIfEmpty(slot);
|
||||
return removed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack itemstack) {
|
||||
super.setInventorySlotContents(slot, itemstack);
|
||||
clearSideInventoryPreferenceIfEmpty(slot);
|
||||
}
|
||||
|
||||
public boolean prefersSideInventory(int slot) {
|
||||
int preference = getSideInventoryPreference(slot);
|
||||
return preference != 0 && (sideInventoryPreferences & preference) != 0;
|
||||
}
|
||||
|
||||
public void setSideInventoryPreference(int slot, boolean prefersSideInventory) {
|
||||
int preference = getSideInventoryPreference(slot);
|
||||
if (preference == 0) return;
|
||||
|
||||
int updatedPreferences = prefersSideInventory ? sideInventoryPreferences | preference
|
||||
: sideInventoryPreferences & ~preference;
|
||||
setSideInventoryPreferences(updatedPreferences);
|
||||
}
|
||||
|
||||
public int getSideInventoryPreferences() {
|
||||
return sideInventoryPreferences;
|
||||
}
|
||||
|
||||
public void setSideInventoryPreferences(int preferences) {
|
||||
preferences &= VALID_SIDE_INVENTORY_PREFERENCES;
|
||||
if (sideInventoryPreferences != preferences) {
|
||||
sideInventoryPreferences = preferences;
|
||||
markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
private void clearSideInventoryPreferenceIfEmpty(int slot) {
|
||||
if (slot < CRAFTING_GRID_FIRST_SLOT || slot >= CRAFTING_GRID_FIRST_SLOT + CRAFTING_GRID_SIZE) return;
|
||||
|
||||
ItemStack stack = getStackInSlot(slot);
|
||||
if (stack == null || stack.stackSize <= 0) {
|
||||
setSideInventoryPreference(slot, false);
|
||||
}
|
||||
}
|
||||
|
||||
private static int getSideInventoryPreference(int slot) {
|
||||
int gridSlot = slot - CRAFTING_GRID_FIRST_SLOT;
|
||||
return gridSlot >= 0 && gridSlot < CRAFTING_GRID_SIZE ? 1 << gridSlot : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tags) {
|
||||
super.readFromNBT(tags);
|
||||
sideInventoryPreferences = tags.getInteger(SIDE_INVENTORY_PREFERENCES_TAG) & VALID_SIDE_INVENTORY_PREFERENCES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tags) {
|
||||
super.writeToNBT(tags);
|
||||
tags.setInteger(SIDE_INVENTORY_PREFERENCES_TAG, sideInventoryPreferences);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -62,6 +139,9 @@ public class CraftingStationLogic extends InventoryLogic implements ISidedInvent
|
||||
|
||||
@Override
|
||||
public Container getGuiContainer(InventoryPlayer inventoryplayer, World world, int x, int y, int z) {
|
||||
if (world.isRemote) return new CraftingStationContainer(inventoryplayer, this, x, y, z);
|
||||
|
||||
shiftClickToGrid = PHConstruct.craftingStationShiftClickToGrid;
|
||||
chest = null;
|
||||
chestSize = 0;
|
||||
slotCount = 0;
|
||||
@@ -96,10 +176,6 @@ public class CraftingStationLogic extends InventoryLogic implements ISidedInvent
|
||||
if (chest == null && inv.isUseableByPlayer(inventoryplayer.player)) {
|
||||
chest = new WeakReference<>(inv);
|
||||
chestDirection = dir;
|
||||
invColumns = 6;
|
||||
chestSize = tile instanceof ISidedInventory sidedIvn
|
||||
? sidedIvn.getAccessibleSlotsFromSide(dir.getOpposite().ordinal()).length
|
||||
: inv.getSizeInventory();
|
||||
|
||||
if (tile instanceof TileEntityChest tileChest) {
|
||||
if (tileChest.adjacentChestZPos != null) {
|
||||
@@ -116,16 +192,90 @@ public class CraftingStationLogic extends InventoryLogic implements ISidedInvent
|
||||
doubleFirst = true;
|
||||
}
|
||||
}
|
||||
slotCount = chestSize * (doubleChest != null ? 2 : 1);
|
||||
invRows = (int) Math.ceil((double) slotCount / invColumns);
|
||||
}
|
||||
}
|
||||
|
||||
this.inventories = new WeakReference[] { this.chest, this.doubleChest, this.patternChest, this.furnace };
|
||||
firstInventorySlots = getInventorySlots(getFirstInventory());
|
||||
secondInventorySlots = getInventorySlots(getSecondInventory());
|
||||
chestSize = doubleFirst ? secondInventorySlots.length : firstInventorySlots.length;
|
||||
slotCount = firstInventorySlots.length + secondInventorySlots.length;
|
||||
invRows = (slotCount + 5) / 6;
|
||||
invColumns = 6;
|
||||
|
||||
if (inventoryplayer.player instanceof EntityPlayerMP player) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setBoolean("CraftingStationGui", true);
|
||||
writeInventoryReference(data, "Chest", chest);
|
||||
writeInventoryReference(data, "DoubleChest", doubleChest);
|
||||
writeInventoryReference(data, "PatternChest", patternChest);
|
||||
writeInventoryReference(data, "Furnace", furnace);
|
||||
data.setInteger("ChestDirection", chestDirection.ordinal());
|
||||
data.setBoolean("DoubleFirst", doubleFirst);
|
||||
data.setBoolean("TinkerTable", tinkerTable);
|
||||
data.setBoolean("ShiftClickToGrid", shiftClickToGrid);
|
||||
data.setIntArray("FirstSlots", firstInventorySlots);
|
||||
data.setIntArray("SecondSlots", secondInventorySlots);
|
||||
player.playerNetServerHandler.sendPacket(new S35PacketUpdateTileEntity(x, y, z, 0, data));
|
||||
}
|
||||
|
||||
return new CraftingStationContainer(inventoryplayer, this, x, y, z);
|
||||
}
|
||||
|
||||
private int[] getInventorySlots(IInventory inventory) {
|
||||
if (inventory == null) return NO_SLOTS;
|
||||
if (inventory instanceof ISidedInventory sided) {
|
||||
return sided.getAccessibleSlotsFromSide(chestDirection.getOpposite().ordinal()).clone();
|
||||
}
|
||||
return IntStream.range(0, inventory.getSizeInventory()).toArray();
|
||||
}
|
||||
|
||||
public int[] getFirstInventorySlots() {
|
||||
return firstInventorySlots;
|
||||
}
|
||||
|
||||
public int[] getSecondInventorySlots() {
|
||||
return secondInventorySlots;
|
||||
}
|
||||
|
||||
private static void writeInventoryReference(NBTTagCompound data, String key, WeakReference<IInventory> ref) {
|
||||
if (ref != null && ref.get() instanceof TileEntity tile) {
|
||||
data.setIntArray(key, new int[] { tile.xCoord, tile.yCoord, tile.zCoord });
|
||||
}
|
||||
}
|
||||
|
||||
private WeakReference<IInventory> readInventoryReference(NBTTagCompound data, String key) {
|
||||
int[] pos = data.getIntArray(key);
|
||||
if (pos.length == 3 && worldObj.getTileEntity(pos[0], pos[1], pos[2]) instanceof IInventory adjacent) {
|
||||
return new WeakReference<>(adjacent);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager manager, S35PacketUpdateTileEntity packet) {
|
||||
NBTTagCompound data = packet.func_148857_g();
|
||||
if (!data.getBoolean("CraftingStationGui")) {
|
||||
super.onDataPacket(manager, packet);
|
||||
return;
|
||||
}
|
||||
chest = readInventoryReference(data, "Chest");
|
||||
doubleChest = readInventoryReference(data, "DoubleChest");
|
||||
patternChest = readInventoryReference(data, "PatternChest");
|
||||
furnace = readInventoryReference(data, "Furnace");
|
||||
chestDirection = ForgeDirection.getOrientation(data.getInteger("ChestDirection"));
|
||||
doubleFirst = data.getBoolean("DoubleFirst");
|
||||
tinkerTable = data.getBoolean("TinkerTable");
|
||||
shiftClickToGrid = data.getBoolean("ShiftClickToGrid");
|
||||
firstInventorySlots = data.getIntArray("FirstSlots");
|
||||
secondInventorySlots = data.getIntArray("SecondSlots");
|
||||
chestSize = doubleFirst ? secondInventorySlots.length : firstInventorySlots.length;
|
||||
slotCount = firstInventorySlots.length + secondInventorySlots.length;
|
||||
invColumns = 6;
|
||||
invRows = (slotCount + 5) / 6;
|
||||
inventories = new WeakReference[] { chest, doubleChest, patternChest, furnace };
|
||||
}
|
||||
|
||||
private boolean isBlacklisted(Class<? extends TileEntity> clazz) {
|
||||
return PHConstruct.craftingStationBlacklist.contains(clazz.getName());
|
||||
}
|
||||
|
||||
@@ -56,5 +56,6 @@ public abstract class EquipLogic extends InventoryLogic {
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
this.readFromNBT(pkt.func_148857_g());
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
@@ -2,43 +2,34 @@ package tconstruct.tools.model;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.util.ItemHelper;
|
||||
|
||||
@ThreadSafeISBRH(perThread = false)
|
||||
public class TableRender implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public static int model = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
private static final float[][] TABLE_BOUNDS = { { 0.0F, 0.75F, 0.0F, 1.0F, 1.0F, 1.0F },
|
||||
{ 0.0F, 0.0F, 0.0F, 0.25F, 0.75F, 0.25F }, { 0.75F, 0.0F, 0.0F, 1.0F, 0.75F, 0.25F },
|
||||
{ 0.0F, 0.0F, 0.75F, 0.25F, 0.75F, 1.0F }, { 0.75F, 0.0F, 0.75F, 1.0F, 0.75F, 1.0F } };
|
||||
|
||||
private static final float[][] CHEST_BOUNDS = { { 0.0F, 0.0F, 0.0F, 1.0F, 0.875F, 1.0F } };
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
if (modelID == model) {
|
||||
// until we get the new model.. finally...
|
||||
if (block == TinkerTools.toolStationWood && metadata >= 5 && metadata <= 9) {
|
||||
// pattern chest
|
||||
renderer.setRenderBounds(0, 0, 0, 1, 0.875, 1);
|
||||
renderStandardInvBlock(renderer, block, metadata);
|
||||
return;
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata, CHEST_BOUNDS);
|
||||
} else {
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata, TABLE_BOUNDS);
|
||||
}
|
||||
|
||||
renderer.setRenderBounds(0.0F, 0.75F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 0.25F, 0.75F, 0.25F);
|
||||
renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.75F, 0.0F, 0.0F, 1.0F, 0.75F, 0.25F);
|
||||
renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.75F, 0.25F, 0.75F, 1.0F);
|
||||
renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.75F, 0.0F, 0.75F, 1.0F, 0.75F, 1.0F);
|
||||
renderStandardInvBlock(renderer, block, metadata);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,33 +71,4 @@ public class TableRender implements ISimpleBlockRenderingHandler {
|
||||
return model;
|
||||
}
|
||||
|
||||
public static void renderStandardInvBlock(RenderBlocks renderblocks, Block block, int meta) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, -1F, 0.0F);
|
||||
renderblocks.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
renderblocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, -1F);
|
||||
renderblocks.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||
renderblocks.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1F, 0.0F, 0.0F);
|
||||
renderblocks.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||
renderblocks.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, meta));
|
||||
tessellator.draw();
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
}
|
||||
@@ -74,6 +74,39 @@ public class ItemHelper {
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
public static void renderStandardInvBlock(RenderBlocks renderblocks, Block block, int meta, float[][] bounds) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
IIcon[] icons = new IIcon[6];
|
||||
for (int side = 0; side < 6; side++) {
|
||||
icons[side] = ItemHelper.getIconSafe(block.getIcon(side, meta));
|
||||
}
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
tessellator.startDrawingQuads();
|
||||
for (int i = 0; i < bounds.length; i++) {
|
||||
renderblocks.setRenderBounds(
|
||||
bounds[i][0],
|
||||
bounds[i][1],
|
||||
bounds[i][2],
|
||||
bounds[i][3],
|
||||
bounds[i][4],
|
||||
bounds[i][5]);
|
||||
tessellator.setNormal(0.0F, -1F, 0.0F);
|
||||
renderblocks.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, icons[0]);
|
||||
tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
renderblocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, icons[1]);
|
||||
tessellator.setNormal(0.0F, 0.0F, -1F);
|
||||
renderblocks.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, icons[2]);
|
||||
tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||
renderblocks.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, icons[3]);
|
||||
tessellator.setNormal(-1F, 0.0F, 0.0F);
|
||||
renderblocks.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, icons[4]);
|
||||
tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||
renderblocks.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, icons[5]);
|
||||
}
|
||||
tessellator.draw();
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
public static void renderInvBlockFace(RenderBlocks renderblocks, Block block, int meta) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glScalef(2f, 2f, 2f);
|
||||
|
||||
@@ -246,6 +246,12 @@ public class PHConstruct {
|
||||
"9, 400, 2, 1200, 2, true", "17, 320, 1, 1000, 3, true", "DAMAGE, 0.3, true" },
|
||||
" If an effect fails to apply, check the console for information \n FORMAT: \n potionID (Can also put \"DAMAGE\" to hurt the player instead, \n effectDuration (in ticks) (or DAMAGE effect strength) , \n initialAmplifier (Exclude if the first parameter is DAMAGE), \n maxDuration (this is the maximum duration the potions can stack in ticks (Exclude if the first parameter is DAMAGE)), \n maxAmplifier (the maximum allowed potionAmplifier with multiple effects uses (Exclude if the first parameter is DAMAGE)), \n stackExclusiveEffect (a true or false value which allows the effect to be only applied when the essence berries are eaten while shift is held (Only works if Allow stackwise consumption = true)")
|
||||
.getStringList();
|
||||
craftingStationShiftClickToGrid = config.get(
|
||||
"general",
|
||||
"craftingStationShiftClickToGrid",
|
||||
false,
|
||||
"Shift-click items from the player or attached inventory into the crafting station grid first. When false, move items between the player and attached inventory, or into the grid if no inventory is attached. Tinkers' tools always prefer the center slot")
|
||||
.getBoolean(false);
|
||||
disableAllRecipes = config.get(
|
||||
"general",
|
||||
"Disable All Recipes",
|
||||
@@ -282,6 +288,12 @@ public class PHConstruct {
|
||||
|
||||
showTravellerAccessories = config.get("Looks", "Show Traveller Gear Accessories", true).getBoolean(true);
|
||||
enableTinkerInventoryTab = config.get("Looks", "Enable Tinker Inventory Tab", true).getBoolean(true);
|
||||
classicCraftingStationLayout = config.get(
|
||||
"Looks",
|
||||
"classicCraftingStationLayout",
|
||||
false,
|
||||
"Use the classic crafting station layout with at most 10 visible inventory rows and scrolling for larger inventories, client-side only")
|
||||
.getBoolean(false);
|
||||
|
||||
// dimension blacklist
|
||||
cfgForbiddenDim = config
|
||||
@@ -491,6 +503,7 @@ public class PHConstruct {
|
||||
public static String[] disgustingXPBerryEffects;
|
||||
|
||||
public static boolean disableAllRecipes;
|
||||
public static boolean craftingStationShiftClickToGrid;
|
||||
public static double HarvestToolAOERelativeStrength;
|
||||
|
||||
// Mobs
|
||||
@@ -568,6 +581,7 @@ public class PHConstruct {
|
||||
public static int connectedTexturesMode;
|
||||
public static boolean showTravellerAccessories;
|
||||
public static boolean enableTinkerInventoryTab;
|
||||
public static boolean classicCraftingStationLayout;
|
||||
|
||||
// dimensionblacklist
|
||||
public static boolean slimeIslGenDim0Only;
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
import tconstruct.tools.inventory.CraftingStationContainer;
|
||||
|
||||
public class CraftingStationStackSyncPacket extends AbstractPacket {
|
||||
|
||||
private static final int FLAG_HAS_STACK = 1;
|
||||
private static final int FLAG_HAS_TAG = 2;
|
||||
private static final int MAX_UPDATE_COUNT = 255;
|
||||
|
||||
private int windowId;
|
||||
private int[] slotIds;
|
||||
private ItemStack[] stacks;
|
||||
|
||||
public CraftingStationStackSyncPacket() {}
|
||||
|
||||
public CraftingStationStackSyncPacket(int windowId, int[] slotIds, ItemStack[] stacks) {
|
||||
if (slotIds == null || stacks == null || slotIds.length != stacks.length || slotIds.length > MAX_UPDATE_COUNT) {
|
||||
throw new IllegalArgumentException("Crafting station update arrays must have the same size up to 255");
|
||||
}
|
||||
|
||||
this.windowId = windowId;
|
||||
this.slotIds = slotIds.clone();
|
||||
this.stacks = copyStacks(stacks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
|
||||
buffer.writeByte(windowId);
|
||||
buffer.writeByte(slotIds.length);
|
||||
|
||||
for (int i = 0; i < slotIds.length; i++) {
|
||||
buffer.writeShort(slotIds[i]);
|
||||
|
||||
ItemStack stack = stacks[i];
|
||||
if (stack == null || stack.stackSize <= 0 || stack.getItem() == null) {
|
||||
buffer.writeByte(0);
|
||||
continue;
|
||||
}
|
||||
|
||||
int flags = FLAG_HAS_STACK;
|
||||
if (stack.hasTagCompound()) flags |= FLAG_HAS_TAG;
|
||||
buffer.writeByte(flags);
|
||||
ByteBufUtils.writeVarInt(buffer, Item.getIdFromItem(stack.getItem()), 3);
|
||||
ByteBufUtils.writeVarInt(buffer, stack.stackSize, 5);
|
||||
buffer.writeShort(stack.getItemDamage());
|
||||
if ((flags & FLAG_HAS_TAG) != 0) ByteBufUtils.writeTag(buffer, stack.getTagCompound());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
|
||||
windowId = buffer.readByte();
|
||||
int updateCount = buffer.readUnsignedByte();
|
||||
slotIds = new int[updateCount];
|
||||
stacks = new ItemStack[updateCount];
|
||||
|
||||
for (int i = 0; i < updateCount; i++) {
|
||||
slotIds[i] = buffer.readShort();
|
||||
int flags = buffer.readUnsignedByte();
|
||||
if ((flags & FLAG_HAS_STACK) == 0) continue;
|
||||
|
||||
int itemId = ByteBufUtils.readVarInt(buffer, 3);
|
||||
int stackSize = ByteBufUtils.readVarInt(buffer, 5);
|
||||
int itemDamage = buffer.readShort();
|
||||
Item item = Item.getItemById(itemId);
|
||||
if (item == null || stackSize <= 0) {
|
||||
if ((flags & FLAG_HAS_TAG) != 0) ByteBufUtils.readTag(buffer);
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemStack stack = new ItemStack(item, stackSize, itemDamage);
|
||||
if ((flags & FLAG_HAS_TAG) != 0) stack.setTagCompound(ByteBufUtils.readTag(buffer));
|
||||
stacks[i] = stack;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleClientSide(EntityPlayer player) {
|
||||
if (player == null || !(player.openContainer instanceof CraftingStationContainer container)
|
||||
|| container.windowId != windowId) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < slotIds.length; i++) {
|
||||
if (slotIds[i] == -1) {
|
||||
player.inventory.setItemStack(stacks[i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (slotIds[i] < 0 || slotIds[i] >= container.inventorySlots.size()) continue;
|
||||
Slot slot = container.getSlot(slotIds[i]);
|
||||
if (slot != null) {
|
||||
slot.putStack(stacks[i]);
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleServerSide(EntityPlayer player) {}
|
||||
|
||||
private static ItemStack[] copyStacks(ItemStack[] source) {
|
||||
ItemStack[] copies = new ItemStack[source.length];
|
||||
for (int i = 0; i < source.length; i++) {
|
||||
copies[i] = source[i] == null ? null : source[i].copy();
|
||||
}
|
||||
return copies;
|
||||
}
|
||||
}
|
||||
@@ -124,6 +124,7 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, Abstra
|
||||
registerPacket(DoubleJumpPacket.class);
|
||||
registerPacket(AccessoryInventoryPacket.class);
|
||||
registerPacket(SmelteryPacket.class);
|
||||
registerPacket(SmelteryGuiPacket.class);
|
||||
registerPacket(PatternTablePacket.class);
|
||||
registerPacket(ToolStationPacket.class);
|
||||
registerPacket(PacketUpdateTE.class);
|
||||
@@ -137,6 +138,7 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, Abstra
|
||||
registerPacket(ArmourGuiSyncPacket.class);
|
||||
|
||||
registerPacket(CraftingStationDumpPacket.class);
|
||||
registerPacket(CraftingStationStackSyncPacket.class);
|
||||
}
|
||||
|
||||
// Method to call from FMLPostInitializationEvent
|
||||
|
||||
@@ -7,75 +7,70 @@ import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.tools.logic.BattlesignLogic;
|
||||
|
||||
public class SignDataPacket extends AbstractPacket {
|
||||
|
||||
private int dimension, x, y, z, length;
|
||||
private static final int MAX_LINE_LENGTH = 256;
|
||||
private static final double MAX_EDIT_DISTANCE_SQ = 64D;
|
||||
|
||||
private int x, y, z;
|
||||
private String[] text;
|
||||
|
||||
public SignDataPacket() {}
|
||||
|
||||
public SignDataPacket(int dimension, int x, int y, int z, String[] text) {
|
||||
public SignDataPacket(int x, int y, int z, String[] text) {
|
||||
this.text = text;
|
||||
this.dimension = dimension;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.length = text.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
|
||||
buffer.writeInt(dimension);
|
||||
buffer.writeInt(x);
|
||||
buffer.writeInt(y);
|
||||
buffer.writeInt(z);
|
||||
buffer.writeInt(length);
|
||||
for (int i = 0; i < length; i++) {
|
||||
ByteBufUtils.writeUTF8String(buffer, text[i]);
|
||||
buffer.writeInt(text.length);
|
||||
for (String line : text) {
|
||||
ByteBufUtils.writeUTF8String(buffer, line);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
|
||||
dimension = buffer.readInt();
|
||||
x = buffer.readInt();
|
||||
y = buffer.readInt();
|
||||
z = buffer.readInt();
|
||||
length = buffer.readInt();
|
||||
text = new String[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
text[i] = ByteBufUtils.readUTF8String(buffer);
|
||||
int lineCount = Math.max(0, Math.min(buffer.readInt(), BattlesignLogic.LINE_COUNT));
|
||||
text = new String[lineCount];
|
||||
for (int i = 0; i < lineCount; i++) {
|
||||
String line = ByteBufUtils.readUTF8String(buffer);
|
||||
text[i] = line.length() > MAX_LINE_LENGTH ? line.substring(0, MAX_LINE_LENGTH) : line;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleClientSide(EntityPlayer player) {
|
||||
TileEntity te = player.worldObj.getTileEntity(x, y, z);
|
||||
|
||||
if (te instanceof BattlesignLogic) {
|
||||
BattlesignLogic logic = (BattlesignLogic) te;
|
||||
|
||||
logic.setText(text);
|
||||
}
|
||||
}
|
||||
public void handleClientSide(EntityPlayer player) {}
|
||||
|
||||
@Override
|
||||
public void handleServerSide(EntityPlayer player) {
|
||||
if (player.worldObj.blockExists(x, y, z)) {
|
||||
if (!player.worldObj.blockExists(x, y, z)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getDistanceSq(x + 0.5D, y + 0.5D, z + 0.5D) > MAX_EDIT_DISTANCE_SQ) {
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntity te = player.worldObj.getTileEntity(x, y, z);
|
||||
|
||||
if (te instanceof BattlesignLogic) {
|
||||
BattlesignLogic logic = (BattlesignLogic) te;
|
||||
|
||||
logic.setText(text);
|
||||
if (!(te instanceof BattlesignLogic)) {
|
||||
return;
|
||||
}
|
||||
|
||||
TConstruct.packetPipeline.sendToDimension(new SignDataPacket(dimension, x, y, z, text), dimension);
|
||||
((BattlesignLogic) te).setText(text);
|
||||
te.markDirty();
|
||||
player.worldObj.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
import tconstruct.smeltery.inventory.SmelteryContainer;
|
||||
|
||||
/** Heat-bar levels and aggregate fuel, sent only to an open smeltery container. */
|
||||
public class SmelteryGuiPacket extends AbstractPacket {
|
||||
|
||||
private int windowId;
|
||||
private int slots;
|
||||
private int[] heatRuns;
|
||||
private FluidStack fuel;
|
||||
private int fuelCapacity;
|
||||
|
||||
public SmelteryGuiPacket() {}
|
||||
|
||||
public SmelteryGuiPacket(SmelteryContainer container, int[] heatRuns, FluidStack fuel, int fuelCapacity) {
|
||||
windowId = container.windowId;
|
||||
slots = container.smelterySize;
|
||||
this.heatRuns = heatRuns.clone();
|
||||
this.fuel = fuel.copy();
|
||||
this.fuelCapacity = fuelCapacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
|
||||
buffer.writeInt(windowId);
|
||||
buffer.writeInt(slots);
|
||||
buffer.writeInt(heatRuns.length);
|
||||
for (int run : heatRuns) buffer.writeInt(run);
|
||||
ByteBufUtils.writeTag(buffer, fuel.writeToNBT(new NBTTagCompound()));
|
||||
buffer.writeInt(fuelCapacity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
|
||||
windowId = buffer.readInt();
|
||||
slots = buffer.readInt();
|
||||
int length = buffer.readInt();
|
||||
if (slots < 0 || length < 0 || length > slots || length > buffer.readableBytes() / Integer.BYTES) {
|
||||
throw new IllegalArgumentException("Invalid smeltery heat run count");
|
||||
}
|
||||
heatRuns = new int[length];
|
||||
for (int i = 0; i < heatRuns.length; i++) heatRuns[i] = buffer.readInt();
|
||||
fuel = FluidStack.loadFluidStackFromNBT(ByteBufUtils.readTag(buffer));
|
||||
fuelCapacity = buffer.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleClientSide(EntityPlayer player) {
|
||||
if (player.openContainer instanceof SmelteryContainer container && container.windowId == windowId
|
||||
&& container.smelterySize == slots) {
|
||||
container.updateGuiState(heatRuns, fuel, fuelCapacity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleServerSide(EntityPlayer player) {}
|
||||
}
|
||||
@@ -1,14 +1,10 @@
|
||||
package tconstruct.util.network;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
import mantle.common.network.PacketUpdateTE;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.smeltery.inventory.SmelteryContainer;
|
||||
import tconstruct.smeltery.logic.SmelteryLogic;
|
||||
|
||||
@@ -61,22 +57,7 @@ public class SmelteryPacket extends AbstractPacket {
|
||||
&& logic.xCoord == this.x
|
||||
&& logic.yCoord == this.y
|
||||
&& logic.zCoord == this.z) {
|
||||
FluidStack temp = null;
|
||||
|
||||
for (FluidStack liquid : logic.moltenMetal) {
|
||||
if (liquid.getFluidID() == this.fluidID) temp = liquid;
|
||||
}
|
||||
|
||||
if (temp != null) {
|
||||
logic.moltenMetal.remove(temp);
|
||||
if (this.isShiftPressed) logic.moltenMetal.add(temp);
|
||||
else logic.moltenMetal.add(0, temp);
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
logic.writeToNBT(data);
|
||||
TConstruct.packetPipeline
|
||||
.sendToDimension(new PacketUpdateTE(this.x, this.y, this.z, data), this.dimension);
|
||||
logic.reorderFluid(this.fluidID, this.isShiftPressed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,6 +70,7 @@ public class CrosshairHandler {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(GL11.GL_ONE_MINUS_DST_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR, 1, 0);
|
||||
|
||||
if (equipped.getTagCompound() == null) return;
|
||||
float spread = ((1.0f - weapon.getWindupProgress(equipped, mc.thePlayer)) * 25f);
|
||||
|
||||
// 4 square crosshair
|
||||
|
||||
@@ -308,7 +308,7 @@ public class Crossbow extends ProjectileWeapon {
|
||||
// are we drawing an effect?
|
||||
if (renderPass >= getPartAmount()) {
|
||||
// is the effect animated?
|
||||
String effect = "Effect" + (1 + renderPass - getPartAmount());
|
||||
String effect = getEffectKey(1 + renderPass - getPartAmount());
|
||||
if (tags.hasKey(effect)) {
|
||||
int index = tags.getInteger(effect);
|
||||
if (animationEffectIcons.get(index) != null)
|
||||
|
||||
@@ -94,7 +94,7 @@ public class TinkerWorldEvents {
|
||||
if (item == TinkerTools.cutlass) {
|
||||
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 3 * 20, 1));
|
||||
} else if (item == TinkerTools.battlesign) {
|
||||
event.ammount *= 1.5; // Puts battlesign blocking at 3/4 instead of 1/2
|
||||
event.ammount *= 0.25; // Puts battlesign blocking at 3/4 instead of 1/2
|
||||
}
|
||||
}
|
||||
} else if (reciever instanceof EntityCreeper) {
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
package tconstruct.world.itemblocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import mantle.blocks.abstracts.MultiItemBlock;
|
||||
|
||||
@@ -19,14 +14,4 @@ public class MetalOreItemBlock extends MultiItemBlock {
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
if (stack.hasTagCompound()) {
|
||||
NBTTagCompound liquidTag = stack.getTagCompound().getCompoundTag("Liquid");
|
||||
if (liquidTag != null) {
|
||||
list.add("Contains " + liquidTag.getString("LiquidName"));
|
||||
list.add(liquidTag.getInteger("Amount") + " mB");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,9 @@ public class BarricadeRender implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public static int model;
|
||||
|
||||
private static final float[][] BARRICADE_BOUNDS = { { 0.375F, 0.0F, 0.375F, 0.625F, 1.0F, 0.625F },
|
||||
{ 0.375F, 0.375F, 0.0F, 0.625F, 0.625F, 1.0F } };
|
||||
|
||||
public BarricadeRender() {
|
||||
model = RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
@@ -119,10 +122,7 @@ public class BarricadeRender implements ISimpleBlockRenderingHandler {
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
if (modelID == model) {
|
||||
renderer.setRenderBounds(0.375F, 0.0F, 0.375F, 0.625F, 1.0F, 0.625F);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.375F, 0.375F, 0.0F, 0.625F, 0.625F, 1.0F);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata, BARRICADE_BOUNDS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,26 +2,25 @@ package tconstruct.world.model;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import tconstruct.util.ItemHelper;
|
||||
|
||||
@ThreadSafeISBRH(perThread = false)
|
||||
public class PunjiRender implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public static int model = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
private static final float[][] PUNJI_BOUNDS = { { 0.4375F, 0.0F, 0.4375F, 0.5625F, 1.0F, 0.5625F } };
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
if (modelID == model) {
|
||||
renderer.setRenderBounds(0.4375, 0.0, 0.4375, 0.5625, 1.0f, 0.5625);
|
||||
renderStandardInvBlock(renderer, block, metadata);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata, PUNJI_BOUNDS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,34 +71,4 @@ public class PunjiRender implements ISimpleBlockRenderingHandler {
|
||||
public int getRenderId() {
|
||||
return model;
|
||||
}
|
||||
|
||||
public static void renderStandardInvBlock(RenderBlocks renderblocks, Block block, int meta) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, -1F, 0.0F);
|
||||
renderblocks.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
renderblocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, -1F);
|
||||
renderblocks.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||
renderblocks.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1F, 0.0F, 0.0F);
|
||||
renderblocks.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||
renderblocks.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, meta));
|
||||
tessellator.draw();
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
}
|
||||
@@ -5,13 +5,12 @@ import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import tconstruct.mechworks.landmine.Helper;
|
||||
import tconstruct.util.ItemHelper;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -23,15 +22,11 @@ public class RenderLandmine implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public static int model = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
private static final float[][] LANDMINE_BOUNDS = { { 0.0625F, 0.5F, 0.0625F, 0.9375F, 0.5625F, 0.9375F } };
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.5F, 0F, -0.5F);
|
||||
|
||||
renderer.setRenderBounds(0.0625F, 0.0F, 0.0625F, 1.0F - 0.0625F, 0.0625F, 1.0F - 0.0625F);
|
||||
Helper.renderInventoryCube(block, metadata, modelID, renderer);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata, LANDMINE_BOUNDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -792,11 +792,11 @@ tconstruct.nei.dryingrack=Sušák
|
||||
tconstruct.nei.melting=Teplota hutě
|
||||
|
||||
gui.smeltery1=Paliva
|
||||
gui.smeltery.emerald=Smaragdy:
|
||||
gui.smeltery.glass.block=Bloky:
|
||||
gui.smeltery.glass.pannel=Panely:
|
||||
gui.smeltery.metal.ingot=Cihly:
|
||||
gui.smeltery.metal.nugget=Valony:
|
||||
gui.smeltery.emerald=%s Smaragdy
|
||||
gui.smeltery.glass.block=%s Bloky
|
||||
gui.smeltery.glass.pannel=%s Panely
|
||||
gui.smeltery.metal.ingot=%s Cihly
|
||||
gui.smeltery.metal.nugget=%s Valony
|
||||
gui.smeltery.molten.check=Roztavený
|
||||
gui.landmine=Nášlapná mina
|
||||
gui.partcrafter1=Vyrábění částí nástrojů
|
||||
|
||||
@@ -792,11 +792,11 @@ tconstruct.nei.dryingrack=Trockengestell
|
||||
tconstruct.nei.melting=Schmelzen
|
||||
|
||||
gui.smeltery.fuel=Brennstoff
|
||||
gui.smeltery.emerald=Smaragde:
|
||||
gui.smeltery.glass.block=Blöcke:
|
||||
gui.smeltery.glass.pannel=Bleche:
|
||||
gui.smeltery.metal.ingot=Barren:
|
||||
gui.smeltery.metal.nugget=Nuggets:
|
||||
gui.smeltery.emerald=%s Smaragde
|
||||
gui.smeltery.glass.block=%s Blöcke
|
||||
gui.smeltery.glass.pannel=%s Bleche
|
||||
gui.smeltery.metal.ingot=%s Barren
|
||||
gui.smeltery.metal.nugget=%s Nuggets
|
||||
gui.smeltery.molten.check=Geschmolzenes,Geschmolzener
|
||||
gui.landmine=Landmine
|
||||
gui.partcrafter1=Werkzeugteilbau
|
||||
|
||||
@@ -715,11 +715,11 @@ smeltery.brick.tooltip1=Smelteree structure block
|
||||
smeltery.brick.tooltip2=(Safe for decoration)
|
||||
|
||||
gui.smeltery.fuel=Fuel
|
||||
gui.smeltery.emerald=Emeralds:
|
||||
gui.smeltery.glass.block=Blocks:
|
||||
gui.smeltery.glass.pannel=Pannels:
|
||||
gui.smeltery.metal.ingot=Ingots:
|
||||
gui.smeltery.metal.nugget=Nuggets:
|
||||
gui.smeltery.emerald=%s Emeralds
|
||||
gui.smeltery.glass.block=%s Blocks
|
||||
gui.smeltery.glass.pannel=%s Pannels
|
||||
gui.smeltery.metal.ingot=%s Ingots
|
||||
gui.smeltery.metal.nugget=%s Nuggets
|
||||
gui.smeltery.molten.check=Molten
|
||||
gui.landmine=Landmine
|
||||
gui.partcrafter1=Tool Part Crafting
|
||||
|
||||
@@ -340,6 +340,8 @@ item.tconstruct.Materials.AluminumDust.name=Aluminum Dust
|
||||
item.tconstruct.Materials.ManyullynDust.name=Manyullyn Dust
|
||||
item.tconstruct.Materials.AluBrassDust.name=Aluminum Brass Dust
|
||||
item.tconstruct.Materials.Reinforcement.name=Reinforcement
|
||||
item.tconstruct.Materials.ExpanderHorizontal.name=Expander (Horizontal)
|
||||
item.tconstruct.Materials.ExpanderVertical.name=Expander (Vertical)
|
||||
|
||||
item.tconstruct.ArmorPattern.helmet.name=Helmet Cast
|
||||
item.tconstruct.ArmorPattern.chestplate.name=Chestplate Cast
|
||||
@@ -793,7 +795,7 @@ strangefood7.tooltip=The mysteriously appearing snack
|
||||
hambone1.tooltip=Hambone!
|
||||
hambone2.tooltip=Usable for Bacon bases
|
||||
metalblock.tooltip=Usable for Beacon bases
|
||||
craftedsoil1.tooltip=Heals Undead
|
||||
craftedsoil1.tooltip=Heals Walking Undead
|
||||
craftedsoil2.tooltip=Harmful to Undead
|
||||
fancybrick1.tooltip=Somewhat expensive
|
||||
fancybrick2.tooltip=Quite expensive
|
||||
@@ -805,7 +807,7 @@ brick2.tooltip=Quite expensive
|
||||
brick3.tooltip=Emits Redstone signal up to
|
||||
brick4.tooltip=4 blocks away
|
||||
brick5.tooltip=Bouncy!
|
||||
craftedsoil.slab1.tooltip=Heals Undead
|
||||
craftedsoil.slab1.tooltip=Heals Walking Undead
|
||||
craftedsoil.slab2.tooltip=Harmful to Undead
|
||||
speedblock1.tooltip=You run pretty fast on it
|
||||
speedblock2.tooltip=You run a bit faster on it
|
||||
@@ -816,7 +818,7 @@ manual2.tooltip=By: Skyla
|
||||
manual3.tooltip=By: Thruul M'gon
|
||||
manual4.tooltip=By: Sheriff Bownana
|
||||
manual5.tooltip=By: Nameless Tinker
|
||||
searedtank1.tooltip=Contains
|
||||
searedtank1.tooltip=Contains %s
|
||||
searedtank2.tooltip=Keeps any fluids it has when harvested
|
||||
searedtank3.tooltip=Heart of the Smeltery
|
||||
oreberries1.tooltip=Sweet Irony
|
||||
@@ -848,8 +850,8 @@ oreberrybush4.tooltip=Tin Man
|
||||
oreberrybush5.tooltip=White Chocolate
|
||||
oreberrybush6.tooltip=Tastes like Creeper
|
||||
barricade.tooltip=Stacks up to 4 times
|
||||
pattern1.tooltip=Material Cost:
|
||||
pattern2.tooltip=Material Cost:
|
||||
pattern1.tooltip=Material Cost: %s
|
||||
pattern2.tooltip=Material Cost: %s
|
||||
potionlauncher.tooltip=Test Item
|
||||
smeltery.controller.tooltip=Brain of the Smeltery
|
||||
smeltery.drain.tooltip1=Works both as input and output for
|
||||
@@ -882,11 +884,11 @@ tconstruct.nei.melting=Smeltery Melting
|
||||
tconstruct.nei.dryingrack.duration=%d ticks (%d secs)
|
||||
|
||||
gui.smeltery.fuel=Fuel
|
||||
gui.smeltery.emerald=Emeralds:
|
||||
gui.smeltery.glass.block=Blocks:
|
||||
gui.smeltery.glass.pannel=Panels:
|
||||
gui.smeltery.metal.ingot=Ingots:
|
||||
gui.smeltery.metal.nugget=Nuggets:
|
||||
gui.smeltery.emerald=%s Emeralds
|
||||
gui.smeltery.glass.block=%s Blocks
|
||||
gui.smeltery.glass.pannel=%s Panels
|
||||
gui.smeltery.metal.ingot=%s Ingots
|
||||
gui.smeltery.metal.nugget=%s Nuggets
|
||||
gui.smeltery.molten.check=Molten
|
||||
gui.landmine=Landmine
|
||||
gui.partcrafter1=Tool Part Crafting
|
||||
@@ -1006,7 +1008,7 @@ material.thaumium.ability=Thaumic
|
||||
material.wood=Wood
|
||||
material.wood.display=Wooden
|
||||
|
||||
creativeModLock.tooltip=Target Lock:
|
||||
creativeModLock.tooltip=Target Lock:
|
||||
|
||||
attribute.name.ammo.attackDamage=Base Damage
|
||||
attribute.name.ammo.maxAttackDamage=Max. Damage
|
||||
@@ -1115,6 +1117,10 @@ modifier.tool.lava=Auto-Smelt
|
||||
modifier.tool.moss=Auto-Repair
|
||||
modifier.tool.necro=Life Steal
|
||||
modifier.tool.blaze=Fiery
|
||||
modifier.tool.width=Width++
|
||||
modifier.tool.height=Height++
|
||||
modifier.tooltip.expander.horizontal=Don't skip leg day!
|
||||
modifier.tooltip.expander.vertical=Do you even lift?
|
||||
|
||||
modifier.toolstation.Beheading=Beheading
|
||||
modifier.toolstation.Blaze=Blaze
|
||||
|
||||
@@ -792,11 +792,11 @@ tconstruct.nei.dryingrack=Drying Rack
|
||||
tconstruct.nei.melting=Smeltery Melting
|
||||
|
||||
gui.smeltery.fuel=Fuel
|
||||
gui.smeltery.emerald=Emeralds:
|
||||
gui.smeltery.glass.block=Blocks:
|
||||
gui.smeltery.glass.pannel=Panels:
|
||||
gui.smeltery.metal.ingot=Ingots:
|
||||
gui.smeltery.metal.nugget=Nuggets:
|
||||
gui.smeltery.emerald=%s Emeralds
|
||||
gui.smeltery.glass.block=%s Blocks
|
||||
gui.smeltery.glass.pannel=%s Panels
|
||||
gui.smeltery.metal.ingot=%s Ingots
|
||||
gui.smeltery.metal.nugget=%s Nuggets
|
||||
gui.smeltery.molten.check=Molten
|
||||
gui.landmine=Landmine
|
||||
gui.partcrafter1=Tool Part Crafting
|
||||
|
||||
@@ -802,11 +802,11 @@ tconstruct.nei.dryingrack=Stendino
|
||||
tconstruct.nei.melting=Fusione della fonderia
|
||||
|
||||
gui.smeltery.fuel=Carburante
|
||||
gui.smeltery.emerald=Smeraldi:
|
||||
gui.smeltery.glass.block=Blocchi:
|
||||
gui.smeltery.glass.pannel=Pannelli:
|
||||
gui.smeltery.metal.ingot=Lingotti:
|
||||
gui.smeltery.metal.nugget=Pepite:
|
||||
gui.smeltery.emerald=%s Smeraldi
|
||||
gui.smeltery.glass.block=%s Blocchi
|
||||
gui.smeltery.glass.pannel=%s Pannelli
|
||||
gui.smeltery.metal.ingot=%s Lingotti
|
||||
gui.smeltery.metal.nugget=%s Pepite
|
||||
gui.smeltery.molten.check=fuso,fusa
|
||||
gui.landmine=Mina
|
||||
gui.partcrafter1=Costruire parti
|
||||
|
||||
@@ -767,11 +767,11 @@ tconstruct.nei.dryingrack=Drying Rack
|
||||
tconstruct.nei.melting=Smeltery Melting
|
||||
|
||||
gui.smeltery.fuel=Fuel
|
||||
gui.smeltery.emerald=Emeralds:
|
||||
gui.smeltery.glass.block=Blocks:
|
||||
gui.smeltery.glass.pannel=Panels:
|
||||
gui.smeltery.metal.ingot=Ingots:
|
||||
gui.smeltery.metal.nugget=Nuggets:
|
||||
gui.smeltery.emerald=%s Emeralds
|
||||
gui.smeltery.glass.block=%s Blocks
|
||||
gui.smeltery.glass.pannel=%s Panels
|
||||
gui.smeltery.metal.ingot=%s Ingots
|
||||
gui.smeltery.metal.nugget=%s Nuggets
|
||||
gui.smeltery.molten.check=Molten
|
||||
gui.landmine=Landmine
|
||||
gui.partcrafter1=Tool Part Crafting
|
||||
|
||||
@@ -783,11 +783,11 @@ tconstruct.nei.dryingrack=건조대
|
||||
tconstruct.nei.melting=융화
|
||||
|
||||
gui.smeltery.fuel=연료
|
||||
gui.smeltery.emerald=에메랄드 수:
|
||||
gui.smeltery.glass.block=블럭 수:
|
||||
gui.smeltery.glass.pannel=유리판 수:
|
||||
gui.smeltery.metal.ingot=주괴 수:
|
||||
gui.smeltery.metal.nugget=조각 수:
|
||||
gui.smeltery.emerald=%s 에메랄드 수
|
||||
gui.smeltery.glass.block=%s 블럭 수
|
||||
gui.smeltery.glass.pannel=%s 유리판 수
|
||||
gui.smeltery.metal.ingot=%s 주괴 수
|
||||
gui.smeltery.metal.nugget=%s 조각 수
|
||||
gui.smeltery.molten.check=녹은
|
||||
gui.landmine=지뢰
|
||||
gui.partcrafter1=도구 부품 조합
|
||||
|
||||
@@ -780,11 +780,11 @@ tconstruct.nei.dryingrack=Cabide de Secagem
|
||||
tconstruct.nei.melting=Fundição
|
||||
|
||||
gui.smeltery.fuel=Combustível
|
||||
gui.smeltery.emerald=Esmeralda:
|
||||
gui.smeltery.glass.block=Blocos:
|
||||
gui.smeltery.glass.pannel=Painéis:
|
||||
gui.smeltery.metal.ingot=Barras:
|
||||
gui.smeltery.metal.nugget=Pepitas:
|
||||
gui.smeltery.emerald=%s Esmeralda
|
||||
gui.smeltery.glass.block=%s Blocos
|
||||
gui.smeltery.glass.pannel=% Painéi
|
||||
gui.smeltery.metal.ingot=%s Barras
|
||||
gui.smeltery.metal.nugget=%s Pepitas
|
||||
gui.smeltery.molten.check=Derretido
|
||||
gui.landmine=Mina Terrestre
|
||||
gui.partcrafter1=Criação de Partes de Ferramentas
|
||||
|
||||
@@ -767,11 +767,11 @@ tconstruct.nei.dryingrack=Cabide de Secagem
|
||||
tconstruct.nei.melting=Oficina de Fundição Melting
|
||||
|
||||
gui.smeltery.fuel=Combustível
|
||||
gui.smeltery.emerald=Esmeralda:
|
||||
gui.smeltery.glass.block=Blocos:
|
||||
gui.smeltery.glass.pannel=Painéis:
|
||||
gui.smeltery.metal.ingot=Lingotes:
|
||||
gui.smeltery.metal.nugget=Pepitas:
|
||||
gui.smeltery.emerald=%s Esmeralda
|
||||
gui.smeltery.glass.block=%s Blocos
|
||||
gui.smeltery.glass.pannel=%s Painéis
|
||||
gui.smeltery.metal.ingot=%s Lingotes
|
||||
gui.smeltery.metal.nugget=%s Pepitas
|
||||
gui.smeltery.molten.check=Derretido
|
||||
gui.landmine=Mina Terrestre
|
||||
gui.partcrafter1=Criação das Partes de Ferramentas
|
||||
|
||||
@@ -797,11 +797,11 @@ tconstruct.nei.dryingrack=Доска для вяления
|
||||
tconstruct.nei.melting=Плавка в плавильне
|
||||
|
||||
gui.smeltery.fuel=Топливо
|
||||
gui.smeltery.emerald=Изумрудов:
|
||||
gui.smeltery.glass.block=Блоков:
|
||||
gui.smeltery.glass.pannel=Панелей:
|
||||
gui.smeltery.metal.ingot=Слитков:
|
||||
gui.smeltery.metal.nugget=Самородков:
|
||||
gui.smeltery.emerald=%s Изумрудов
|
||||
gui.smeltery.glass.block=%s Блоков
|
||||
gui.smeltery.glass.pannel=%s Панелей
|
||||
gui.smeltery.metal.ingot=%s Слитков
|
||||
gui.smeltery.metal.nugget=%s Самородков
|
||||
gui.smeltery.molten.check=Расплавленн
|
||||
gui.landmine=Мина
|
||||
gui.partcrafter1=Создание частей
|
||||
|
||||
@@ -834,11 +834,11 @@ tconstruct.nei.dryingrack=Дошка для в'ялення
|
||||
tconstruct.nei.melting=Плавка в плавильній
|
||||
|
||||
gui.smeltery.fuel=Паливо
|
||||
gui.smeltery.emerald=Смарагди:
|
||||
gui.smeltery.glass.block=Блоки:
|
||||
gui.smeltery.glass.pannel=Панелі:
|
||||
gui.smeltery.metal.ingot=Злитки:
|
||||
gui.smeltery.metal.nugget=Самородки:
|
||||
gui.smeltery.emerald=%s Смарагди
|
||||
gui.smeltery.glass.block=%s Блоки
|
||||
gui.smeltery.glass.pannel=%s Панелі
|
||||
gui.smeltery.metal.ingot=%s Злитки
|
||||
gui.smeltery.metal.nugget=%s Самородки
|
||||
gui.smeltery.molten.check=Розплавлений
|
||||
gui.landmine=Міна
|
||||
gui.partcrafter1=Створення частин
|
||||
|
||||
@@ -835,11 +835,11 @@ tconstruct.nei.dryingrack=晾干架
|
||||
tconstruct.nei.melting=冶炼炉熔化
|
||||
|
||||
gui.smeltery.fuel=燃料
|
||||
gui.smeltery.emerald=绿宝石:
|
||||
gui.smeltery.glass.block=方块:
|
||||
gui.smeltery.glass.pannel=板:
|
||||
gui.smeltery.metal.ingot=锭:
|
||||
gui.smeltery.metal.nugget=粒:
|
||||
gui.smeltery.emerald=%s 绿宝石
|
||||
gui.smeltery.glass.block=%s 方块
|
||||
gui.smeltery.glass.pannel=%s 板
|
||||
gui.smeltery.metal.ingot=%s 锭
|
||||
gui.smeltery.metal.nugget=%s 粒
|
||||
gui.smeltery.molten.check=熔融
|
||||
gui.landmine=地雷
|
||||
gui.partcrafter1=合成工具部件
|
||||
|
||||
@@ -717,11 +717,11 @@ tconstruct.nei.dryingrack=晾乾架
|
||||
tconstruct.nei.melting=冶煉爐熔化
|
||||
|
||||
gui.smeltery.fuel=燃料
|
||||
gui.smeltery.emerald=綠寶石:
|
||||
gui.smeltery.glass.block=方塊:
|
||||
gui.smeltery.glass.pannel=板:
|
||||
gui.smeltery.metal.ingot=錠:
|
||||
gui.smeltery.metal.nugget=粒:
|
||||
gui.smeltery.emerald=%s 綠寶石
|
||||
gui.smeltery.glass.block=%s 方塊
|
||||
gui.smeltery.glass.pannel=%s 板
|
||||
gui.smeltery.metal.ingot=%s 錠
|
||||
gui.smeltery.metal.nugget=%s 粒
|
||||
gui.smeltery.molten.check=熔融
|
||||
gui.landmine=地雷
|
||||
gui.partcrafter1=合成工具部件
|
||||
|
||||
Loaded 100 of 102 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user