Fix the rest of the models & remove manual and heat generator

This commit is contained in:
Prospector 2017-06-16 08:20:30 -07:00
parent 977e0657ff
commit b80235504f
41 changed files with 74 additions and 2737 deletions

View file

@ -63,11 +63,11 @@ public class BlockMachineCasing extends BlockMultiblockBase {
setCreativeTab(TechRebornCreativeTab.instance); setCreativeTab(TechRebornCreativeTab.instance);
setHardness(2F); setHardness(2F);
this.setDefaultState(this.getDefaultState().withProperty(TYPE, "standard")); this.setDefaultState(this.getDefaultState().withProperty(TYPE, "standard"));
for (int i = 0; i > types.length; i++) { for (int i = 0; i < types.length; i++) {
if (Core.proxy.isCTMAvailable()) { if (Core.proxy.isCTMAvailable()) {
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, i, "machines/structure/ctm").setInvVariant(types[i])); ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, i, "machines/structure/ctm").setInvVariant("type=" + types[i]));
} else { } else {
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, i, "machines/structure").setInvVariant(types[i])); ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, i, "machines/structure").setInvVariant("type=" + types[i]));
} }
} }
} }

View file

@ -56,8 +56,8 @@ public class BlockMachineFrames extends BaseBlock {
setCreativeTab(TechRebornCreativeTab.instance); setCreativeTab(TechRebornCreativeTab.instance);
setHardness(1f); setHardness(1f);
this.setDefaultState(this.getDefaultState().withProperty(TYPE, "basic")); this.setDefaultState(this.getDefaultState().withProperty(TYPE, "basic"));
for (int i = 0; i > types.length; i++) { for (int i = 0; i < types.length; i++) {
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, i, "machines/structure").setInvVariant(types[i])); ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, i, "machines/structure").setInvVariant("type=" + types[i]));
} }
} }

View file

@ -24,6 +24,8 @@
package techreborn.blocks; package techreborn.blocks;
import net.minecraft.block.BlockGlass;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.BlockRenderLayer;
@ -31,19 +33,26 @@ import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import prospector.shootingstar.ShootingStar; import prospector.shootingstar.ShootingStar;
import prospector.shootingstar.model.ModelCompound; import prospector.shootingstar.model.ModelCompound;
import reborncore.common.BaseBlock;
import techreborn.client.TechRebornCreativeTabMisc; import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.lib.ModInfo; import techreborn.lib.ModInfo;
public class BlockReinforcedGlass extends BaseBlock { import java.util.Random;
public class BlockReinforcedGlass extends BlockGlass {
public BlockReinforcedGlass() { public BlockReinforcedGlass() {
super(Material.GLASS); super(Material.GLASS, false);
setCreativeTab(TechRebornCreativeTabMisc.instance); setCreativeTab(TechRebornCreativeTabMisc.instance);
setSoundType(SoundType.STONE);
setHardness(4.0F); setHardness(4.0F);
setResistance(60F);
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this)); ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this));
} }
public int quantityDropped(Random random) {
return 1;
}
@Override @Override
public boolean isOpaqueCube(IBlockState state) { public boolean isOpaqueCube(IBlockState state) {
return false; return false;
@ -57,5 +66,4 @@ public class BlockReinforcedGlass extends BaseBlock {
public boolean isFullCube() { public boolean isFullCube() {
return false; return false;
} }
} }

View file

@ -1,49 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.blocks.generator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import prospector.shootingstar.ShootingStar;
import prospector.shootingstar.model.ModelCompound;
import reborncore.common.blocks.BlockMachineBase;
import techreborn.client.TechRebornCreativeTab;
import techreborn.lib.ModInfo;
import techreborn.tiles.generator.TileHeatGenerator;
public class BlockHeatGenerator extends BlockMachineBase {
public BlockHeatGenerator() {
super();
setCreativeTab(TechRebornCreativeTab.instance);
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/generators"));
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
return new TileHeatGenerator();
}
}

View file

@ -31,7 +31,6 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler; import net.minecraftforge.fml.common.network.IGuiHandler;
import techreborn.client.container.*; import techreborn.client.container.*;
import techreborn.client.gui.*; import techreborn.client.gui.*;
import techreborn.manual.GuiManual;
import techreborn.tiles.*; import techreborn.tiles.*;
import techreborn.tiles.fusionReactor.TileFusionControlComputer; import techreborn.tiles.fusionReactor.TileFusionControlComputer;
import techreborn.tiles.generator.*; import techreborn.tiles.generator.*;
@ -127,8 +126,6 @@ public class GuiHandler implements IGuiHandler {
return new GuiIronFurnace(player, (TileIronFurnace) tile); return new GuiIronFurnace(player, (TileIronFurnace) tile);
case LESU: case LESU:
return new GuiLESU(player, (TileLapotronicSU) tile); return new GuiLESU(player, (TileLapotronicSU) tile);
case MANUAL:
return new GuiManual();
case MATTER_FABRICATOR: case MATTER_FABRICATOR:
return new GuiMatterFabricator(player, (TileMatterFabricator) tile); return new GuiMatterFabricator(player, (TileMatterFabricator) tile);
case MEDIUM_VOLTAGE_SU: case MEDIUM_VOLTAGE_SU:

View file

@ -74,13 +74,6 @@ public class TRBuilder extends GuiBuilder {
gui.drawTexturedModalRect(x + 1, y + 49 - draw, PowerSystem.getDisplayPower().xBar, 48 + PowerSystem.getDisplayPower().yBar - draw, 12, draw); gui.drawTexturedModalRect(x + 1, y + 49 - draw, PowerSystem.getDisplayPower().xBar, 48 + PowerSystem.getDisplayPower().yBar - draw, 12, draw);
int percentage = percentage(maxEnergyStored, energyStored); int percentage = percentage(maxEnergyStored, energyStored);
if (isInRect(x + 1, y + 1, 11, 48, mouseX, mouseY)) { if (isInRect(x + 1, y + 1, 11, 48, mouseX, mouseY)) {
GlStateManager.disableLighting();
GlStateManager.disableDepth();
GlStateManager.colorMask(true, true, true, false);
GuiUtils.drawGradientRect(0, x + 1, y + 1, x + 13, y + 49, 0x80FFFFFF, 0x80FFFFFF);
GlStateManager.colorMask(true, true, true, true);
GlStateManager.enableDepth();
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
TextFormatting powerColour = TextFormatting.GOLD; TextFormatting powerColour = TextFormatting.GOLD;
list.add(powerColour + PowerSystem.getLocaliszedPowerFormattedNoSuffix(energyStored) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix(maxEnergyStored) + " " + PowerSystem.getDisplayPower().abbreviation); list.add(powerColour + PowerSystem.getLocaliszedPowerFormattedNoSuffix(energyStored) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix(maxEnergyStored) + " " + PowerSystem.getDisplayPower().abbreviation);
@ -345,16 +338,16 @@ public class TRBuilder extends GuiBuilder {
Minecraft.getMinecraft().getTextureManager().bindTexture(GUI_SHEET); Minecraft.getMinecraft().getTextureManager().bindTexture(GUI_SHEET);
for (int i = 1; i <= count; i++) { for (int i = 1; i <= count; i++) {
if (i == 1) { if (i == 1) {
gui.drawTexturedModalRect(posX, posY, 114 + 39, 218, 22, 26); gui.drawTexturedModalRect(posX, posY, 125 + 39, 218, 22, 26);
posX += 22; posX += 22;
if (1 == count) { if (1 == count) {
gui.drawTexturedModalRect(posX, posY, 136 + 39, 218, 4, 26); gui.drawTexturedModalRect(posX, posY, 147 + 39, 218, 4, 26);
} }
} else if (i != 1 && i != count) { } else if (i != 1 && i != count) {
gui.drawTexturedModalRect(posX, posY, 116 + 39, 218, 20, 26); gui.drawTexturedModalRect(posX, posY, 127 + 39, 218, 20, 26);
posX += 20; posX += 20;
} else if (i == count) { } else if (i == count) {
gui.drawTexturedModalRect(posX, posY, 116 + 39, 218, 24, 26); gui.drawTexturedModalRect(posX, posY, 127 + 39, 218, 24, 26);
posX += 24; posX += 24;
} }
} }

View file

@ -99,7 +99,6 @@ public class ModBlocks {
public static Block FUSION_CONTROL_COMPUTER; public static Block FUSION_CONTROL_COMPUTER;
public static Block FUSION_COIL; public static Block FUSION_COIL;
public static Block LIGHTNING_ROD; public static Block LIGHTNING_ROD;
public static Block HEAT_GENERATOR;
public static Block INDUSTRIAL_SAWMILL; public static Block INDUSTRIAL_SAWMILL;
public static Block CHARGE_O_MAT; public static Block CHARGE_O_MAT;
public static Block PLAYER_DETECTOR; public static Block PLAYER_DETECTOR;
@ -288,10 +287,6 @@ public class ModBlocks {
registerBlock(LIGHTNING_ROD, "lightning_rod"); registerBlock(LIGHTNING_ROD, "lightning_rod");
GameRegistry.registerTileEntity(TileLightningRod.class, "TileLightningRodTR"); GameRegistry.registerTileEntity(TileLightningRod.class, "TileLightningRodTR");
HEAT_GENERATOR = new BlockHeatGenerator();
registerBlock(HEAT_GENERATOR, "heat_generator");
GameRegistry.registerTileEntity(TileHeatGenerator.class, "TileHeatGeneratorTR");
INDUSTRIAL_SAWMILL = new BlockIndustrialSawmill(); INDUSTRIAL_SAWMILL = new BlockIndustrialSawmill();
registerBlock(INDUSTRIAL_SAWMILL, "industrial_sawmill"); registerBlock(INDUSTRIAL_SAWMILL, "industrial_sawmill");
GameRegistry.registerTileEntity(TileIndustrialSawmill.class, "TileIndustrialSawmillTR"); GameRegistry.registerTileEntity(TileIndustrialSawmill.class, "TileIndustrialSawmillTR");

View file

@ -748,10 +748,6 @@ public class ModRecipes {
"circuitMaster", 'T', IC2Duplicates.EXTRACTOR.getStackBasedOnConfig(), 'A', "circuitMaster", 'T', IC2Duplicates.EXTRACTOR.getStackBasedOnConfig(), 'A',
BlockMachineFrames.getFrameByName("highlyAdvancedMachine", 1), 'O', ModItems.LAPOTRONIC_ORB); BlockMachineFrames.getFrameByName("highlyAdvancedMachine", 1), 'O', ModItems.LAPOTRONIC_ORB);
RebornCraftingHelper
.addShapedOreRecipe(new ItemStack(ModBlocks.HEAT_GENERATOR), "III", "IHI", "CGC", 'I', "plateIron", 'H',
new ItemStack(Blocks.IRON_BARS), 'C', "circuitBasic", 'G', IC2Duplicates.GENERATOR.getStackBasedOnConfig());
RebornCraftingHelper RebornCraftingHelper
.addShapedOreRecipe(new ItemStack(ModBlocks.GAS_TURBINE), "IAI", "WGW", "IAI", 'I', "ingotInvar", 'A', .addShapedOreRecipe(new ItemStack(ModBlocks.GAS_TURBINE), "IAI", "WGW", "IAI", 'I', "ingotInvar", 'A',
"circuitAdvanced", 'W', "circuitAdvanced", 'W',

View file

@ -1,214 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.manual;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import techreborn.init.ModBlocks;
import techreborn.init.ModItems;
import techreborn.items.ItemParts;
import techreborn.items.ItemPlates;
import techreborn.manual.pages.*;
import java.io.IOException;
@SideOnly(Side.CLIENT)
public class GuiManual extends GuiScreen {
protected final PageCollection root;
public Container inventorySlots;
protected int pageIndex = 0;
protected int xSize = 0;
protected int ySize = 0;
protected int guiLeft;
protected int guiTop;
public GuiManual() {
this.xSize = 200;
this.ySize = 180;
root = createRoot();
//root = ManualLoader.getPages();
}
protected PageCollection createRoot() {
pageIndex = 0;
final PageCollection pageCollection = new PageCollection();
pageCollection.addPage(new ContentsPage(Reference.pageNames.CONTENTS_PAGE, pageCollection));
// GETTING STARTED
pageCollection.addPage(new GettingStartedPage(Reference.pageNames.GETTINGSTARTED_PAGE, pageCollection));
pageCollection.addPage(new DescriptionPage(Reference.pageNames.GETTINGRUBBER_PAGE, pageCollection, true,
Reference.pageNames.GETTINGRUBBER2_PAGE));
pageCollection.addPage(new CraftingInfoPage(Reference.pageNames.GETTINGRUBBER2_PAGE, pageCollection,
ItemParts.getPartByName("rubber"), "", Reference.pageNames.GETTINGRUBBER_PAGE));
pageCollection.addPage(new CraftingInfoPage(Reference.pageNames.CRAFTINGPLATES_PAGE, pageCollection,
ItemPlates.getPlateByName("iron"), "", Reference.pageNames.GETTINGSTARTED_PAGE));
// POWER GENERATION
pageCollection.addPage(new GeneratingPowerPage(Reference.pageNames.GENERATINGPOWER_PAGE, pageCollection));
pageCollection.addPage(new CraftingInfoPage(ModBlocks.SOLID_FUEL_GENEREATOR.getLocalizedName(), pageCollection,
new ItemStack(ModBlocks.SOLID_FUEL_GENEREATOR), "", Reference.pageNames.GENERATINGPOWER_PAGE));
pageCollection.addPage(new CraftingInfoPage(ModBlocks.THERMAL_GENERATOR.getLocalizedName(), pageCollection,
new ItemStack(ModBlocks.THERMAL_GENERATOR), "", Reference.pageNames.GENERATINGPOWER_PAGE));
pageCollection.addPage(new CraftingInfoPage(ModBlocks.SOLAR_PANEL.getLocalizedName(), pageCollection,
new ItemStack(ModBlocks.SOLAR_PANEL), "", Reference.pageNames.GENERATINGPOWER_PAGE));
pageCollection.addPage(new CraftingInfoPage(ModBlocks.HEAT_GENERATOR.getLocalizedName(), pageCollection,
new ItemStack(ModBlocks.HEAT_GENERATOR), "", Reference.pageNames.GENERATINGPOWER_PAGE));
pageCollection.addPage(new CraftingInfoPage(ModBlocks.LIGHTNING_ROD.getLocalizedName(), pageCollection,
new ItemStack(ModBlocks.LIGHTNING_ROD), "", Reference.pageNames.GENERATINGPOWER_PAGE));
// BASIC MACHINES
pageCollection.addPage(new BasicMachinesPage(Reference.pageNames.BASICMACHINES_PAGE, pageCollection));
pageCollection.addPage(new CraftingInfoPage(ModBlocks.GRINDER.getLocalizedName(), pageCollection,
new ItemStack(ModBlocks.GRINDER), "", Reference.pageNames.BASICMACHINES_PAGE));
pageCollection.addPage(new CraftingInfoPage(ModBlocks.ELECTRIC_FURNACE.getLocalizedName(), pageCollection,
new ItemStack(ModBlocks.ELECTRIC_FURNACE), "", Reference.pageNames.BASICMACHINES_PAGE));
pageCollection.addPage(new CraftingInfoPage(ModBlocks.ALLOY_SMELTER.getLocalizedName(), pageCollection,
new ItemStack(ModBlocks.ALLOY_SMELTER), "", Reference.pageNames.BASICMACHINES_PAGE));
pageCollection.addPage(new CraftingInfoPage(ModBlocks.EXTRACTOR.getLocalizedName(), pageCollection,
new ItemStack(ModBlocks.EXTRACTOR), "", Reference.pageNames.BASICMACHINES_PAGE));
pageCollection.addPage(new CraftingInfoPage(ModBlocks.COMPRESSOR.getLocalizedName(), pageCollection,
new ItemStack(ModBlocks.COMPRESSOR), "", Reference.pageNames.BASICMACHINES_PAGE));
// ADVANCED MACHINES
pageCollection.addPage(new AdvancedMachines(Reference.pageNames.ADVANCEDMACHINES_PAGE, pageCollection));
pageCollection.addPage(new CraftingInfoPage(ModBlocks.INDUSTRIAL_BLAST_FURNACE.getLocalizedName(), pageCollection,
new ItemStack(ModBlocks.INDUSTRIAL_BLAST_FURNACE), "", Reference.pageNames.ADVANCEDMACHINES_PAGE));
pageCollection.addPage(new CraftingInfoPage(ModBlocks.INDUSTRIAL_SAWMILL.getLocalizedName(), pageCollection,
new ItemStack(ModBlocks.INDUSTRIAL_SAWMILL), "", Reference.pageNames.ADVANCEDMACHINES_PAGE));
pageCollection.addPage(new CraftingInfoPage(ModBlocks.INDUSTRIAL_ELECTROLYZER.getLocalizedName(), pageCollection,
new ItemStack(ModBlocks.INDUSTRIAL_ELECTROLYZER), "", Reference.pageNames.ADVANCEDMACHINES_PAGE));
pageCollection.addPage(new CraftingInfoPage(ModBlocks.INDUSTRIAL_GRINDER.getLocalizedName(), pageCollection,
new ItemStack(ModBlocks.INDUSTRIAL_GRINDER), "", Reference.pageNames.ADVANCEDMACHINES_PAGE));
pageCollection.addPage(new CraftingInfoPage(ModBlocks.IMPLOSION_COMPRESSOR.getLocalizedName(), pageCollection,
new ItemStack(ModBlocks.IMPLOSION_COMPRESSOR), "", Reference.pageNames.ADVANCEDMACHINES_PAGE));
pageCollection.addPage(new CraftingInfoPage(ModBlocks.INDUSTRIAL_CENTRIFUGE.getLocalizedName(), pageCollection,
new ItemStack(ModBlocks.INDUSTRIAL_CENTRIFUGE), "", Reference.pageNames.ADVANCEDMACHINES_PAGE));
// TOOLS
pageCollection.addPage(new ToolsPage(Reference.pageNames.TOOLS_PAGE, pageCollection));
pageCollection.addPage(new CraftingInfoPage(ModItems.STEEL_DRILL.getUnlocalizedName() + ".name", pageCollection,
new ItemStack(ModItems.STEEL_DRILL), "", Reference.pageNames.TOOLS_PAGE));
pageCollection.addPage(new CraftingInfoPage(ModItems.DIAMOND_DRILL.getUnlocalizedName() + ".name",
pageCollection, new ItemStack(ModItems.DIAMOND_DRILL), "", Reference.pageNames.TOOLS_PAGE));
pageCollection.addPage(new CraftingInfoPage(ModItems.ADVANCED_DRILL.getUnlocalizedName() + ".name",
pageCollection, new ItemStack(ModItems.ADVANCED_DRILL), "", Reference.pageNames.TOOLS_PAGE));
pageCollection.addPage(new CraftingInfoPage(ModItems.STEEL_CHAINSAW.getUnlocalizedName() + ".name",
pageCollection, new ItemStack(ModItems.STEEL_CHAINSAW), "", Reference.pageNames.TOOLS_PAGE));
pageCollection.addPage(new CraftingInfoPage(ModItems.DIAMOND_CHAINSAW.getUnlocalizedName() + ".name",
pageCollection, new ItemStack(ModItems.DIAMOND_CHAINSAW), "", Reference.pageNames.TOOLS_PAGE));
pageCollection.addPage(new CraftingInfoPage(ModItems.ADVANCED_CHAINSAW.getUnlocalizedName() + ".name",
pageCollection, new ItemStack(ModItems.ADVANCED_CHAINSAW), "", Reference.pageNames.TOOLS_PAGE));
pageCollection.addPage(new CraftingInfoPage(ModItems.OMNI_TOOL.getUnlocalizedName() + ".name", pageCollection,
new ItemStack(ModItems.OMNI_TOOL), "", Reference.pageNames.TOOLS_PAGE));
pageCollection.addPage(new CraftingInfoPage(ModItems.TREE_TAP.getUnlocalizedName() + ".name", pageCollection,
new ItemStack(ModItems.TREE_TAP), "", Reference.pageNames.TOOLS_PAGE));
return pageCollection;
}
private int getNextPageIndex() {
int i = pageIndex;
pageIndex++;
return i;
}
@Override
public void drawScreen(int mouseX, int mouseY, float par3) {
drawGuiBackgroundLayer(par3, mouseX, mouseY);
super.drawScreen(mouseX, mouseY, par3);
prepareRenderState();
GL11.glPushMatrix();
root.drawScreen(this.mc, this.guiLeft, this.guiTop, mouseX - this.guiLeft, mouseY - this.guiTop);
GL11.glPopMatrix();
restoreRenderState();
}
protected void prepareRenderState() {
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
}
protected void restoreRenderState() {
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
RenderHelper.enableStandardItemLighting();
}
protected void drawGuiBackgroundLayer(float p_146976_1_, int mouseX, int mouseY) {
GL11.glPushMatrix();
GL11.glTranslated(this.guiLeft, this.guiTop, 0);
root.renderBackgroundLayer(this.mc, 0, 0, mouseX - this.guiLeft, mouseY - this.guiTop);
GL11.glPopMatrix();
}
@Override
public void setWorldAndResolution(Minecraft minecraft, int x, int y) {
super.setWorldAndResolution(minecraft, x, y);
root.setWorldAndResolution(minecraft, x, y);
}
@Override
public void actionPerformed(GuiButton button) {
root.actionPerformed(button);
}
@Override
public void mouseClicked(int par1, int par2, int par3) throws IOException {
root.mouseClicked(par1, par2, par3);
}
@Override
public void handleInput() throws IOException {
super.handleInput();
}
@Override
public void initGui() {
super.initGui();
this.guiLeft = (this.width - this.xSize) / 2;
this.guiTop = (this.height - this.ySize) / 2;
}
@Override
public boolean doesGuiPauseGame() {
return false;
}
}

View file

@ -1,114 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.manual;
import com.google.common.collect.Lists;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiButton;
import techreborn.manual.pages.BasePage;
import java.io.IOException;
import java.util.List;
public class PageCollection extends Gui {
public final List<BasePage> pages = Lists.newArrayList();
protected int x;
protected int y;
private String ACTIVE_PAGE = Reference.pageNames.CONTENTS_PAGE;
public PageCollection() {
this.x = 0;
this.y = 0;
}
public void addPage(BasePage page) {
pages.add(page);
}
public BasePage getPageByName(String name) {
for (BasePage component : pages) {
if (component.getReferenceName().equals(ACTIVE_PAGE)) {
return component;
}
}
return null;
}
public BasePage getActivePage() {
for (BasePage component : pages) {
if (component.getReferenceName().equals(ACTIVE_PAGE)) {
return component;
}
}
return null;
}
public final void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
if (getActivePage() == null)
return;
getActivePage().drawScreen(minecraft, offsetX, offsetY, mouseX, mouseY);
}
public final void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
if (getActivePage() == null)
return;
getActivePage().renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
}
public void changeActivePage(String newPage) {
ACTIVE_PAGE = newPage;
if (getActivePage() == null)
return;
getActivePage().setWorldAndResolution(Minecraft.getMinecraft(), x, y);
}
public void setWorldAndResolution(Minecraft minecraft, int x, int y) {
if (getActivePage() == null)
return;
getActivePage().setWorldAndResolution(minecraft, x, y);
this.x = x;
this.y = y;
}
protected void actionPerformed(GuiButton button) {
if (getActivePage() == null)
return;
getActivePage().actionPerformed(button);
}
// protected void mouseMovedOrUp(int par1, int par2, int par3) {
// if (getActivePage() == null) return;
// getActivePage().mo(par1, par2, par3);
// }
protected void mouseClicked(int par1, int par2, int par3) throws IOException {
if (getActivePage() == null)
return;
getActivePage().mouseClicked(par1, par2, par3);
}
}

View file

@ -1,50 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.manual;
public class Reference {
public static final String CONTENTS_KEY = "techreborn.manual.contents";
public static final String GETTINGSTARTED_KEY = "techreborn.manual.gettingstarted";
public static final String GENERATINGPOWER_KEY = "techreborn.manual.generatingpower";
public static final String BASICMACHINES_KEY = "techreborn.manual.basicmachines";
public static final String ADVANCEDMACHINES_KEY = "techreborn.manual.advancedmachines";
public static final String TOOLS_KEY = "techreborn.manual.tools";
public static final String GETTINGRUBBER_KEY = "techreborn.manual.gettingrubber";
public static final String CRAFTINGPLATES_KEY = "techreborn.manual.gettingplates";
public class pageNames {
public static final String CONTENTS_PAGE = "contents";
public static final String BASICMACHINES_PAGE = "basicmachines";
public static final String GETTINGSTARTED_PAGE = "gettingstarted";
public static final String GETTINGRUBBER_PAGE = "gettingrubber";
public static final String GETTINGRUBBER2_PAGE = "gettingrubber2";
public static final String CRAFTINGPLATES_PAGE = "gettingplates";
public static final String GENERATINGPOWER_PAGE = "generatingpower";
public static final String ADVANCEDMACHINES_PAGE = "advancedmachines";
public static final String TOOLS_PAGE = "tools";
}
}

View file

@ -1,38 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.manual.loader;
/**
* Created by Mark on 16/04/2016.
*/
public class DownloadablePackageInfo {
PackageInfo packageInfo;
String md5;
String fileName;
}

View file

@ -1,130 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.manual.loader;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import reborncore.RebornCore;
import reborncore.common.util.Unzip;
import techreborn.manual.PageCollection;
import techreborn.manual.Reference;
import techreborn.manual.loader.pages.CategoriesPage;
import techreborn.manual.saveFormat.ManualFormat;
import java.io.*;
import java.net.URL;
import java.net.URLConnection;
/**
* Created by modmuss50 on 23/04/2016.
*/
public class ManualLoader {
public static final String MANUAL_VERSION = "0";
File configDir;
public static ManualFormat format;
public ManualLoader(File configDir) {
this.configDir = configDir;
}
VersionsInfo info = null;
public void load() throws IOException {
File manualdir = new File(configDir, "manual");
if (!manualdir.exists()) {
manualdir.mkdir();
}
URL url = new URL(RebornCore.WEB_URL + "techreborn/manual/versions.json");
URLConnection con = url.openConnection();
InputStream in = con.getInputStream();
String encoding = con.getContentEncoding();
encoding = encoding == null ? "UTF-8" : encoding;
String body = IOUtils.toString(in, encoding);
Gson gson = new Gson();
info = gson.fromJson(body, new TypeToken<VersionsInfo>() {
}.getType());
DownloadablePackageInfo downloadablePackageInfo = null;
if (info != null) {
for (DownloadablePackageInfo packageInfo : info.versions) {
if (packageInfo.packageInfo.version.equals(MANUAL_VERSION)) {
downloadablePackageInfo = packageInfo;
break;
}
}
}
if (downloadablePackageInfo != null) {
boolean hasIntactZip = false;
File zipLocation = new File(manualdir, downloadablePackageInfo.fileName);
if (zipLocation.exists()) {
String md5 = getMD5(zipLocation);
if (md5.equals(downloadablePackageInfo.md5)) {
//Oh look we allready have it!
hasIntactZip = true;
}
} else {
FileUtils.copyURLToFile(new URL(RebornCore.WEB_URL + "techreborn/manual/packages/" + downloadablePackageInfo.fileName), zipLocation);
String md5 = getMD5(zipLocation);
if (md5.equals(downloadablePackageInfo.md5)) {
//ok the downloaded file is valid
hasIntactZip = true;
}
}
if (hasIntactZip) {
File outputDir = new File(manualdir, zipLocation.getName().replace(".zip", ""));
Unzip.unzip(zipLocation, outputDir);
File inputData = new File(outputDir, "master.json");
BufferedReader reader = new BufferedReader(new FileReader(inputData));
ManualLoader.format = gson.fromJson(reader, ManualFormat.class);
}
}
}
public static PageCollection getPages() {
final PageCollection pageCollection = new PageCollection();
pageCollection.addPage(new CategoriesPage(Reference.pageNames.CONTENTS_PAGE, pageCollection));
return pageCollection;
}
public static String getMD5(File file) throws IOException {
FileInputStream fis = new FileInputStream(file);
String md5 = DigestUtils.md5Hex(fis);
fis.close();
return md5;
}
}

View file

@ -1,38 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.manual.loader;
/**
* Created by Mark on 16/04/2016.
*/
public class PackageInfo {
public String name;
public String version;
public String language;
}

View file

@ -1,40 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.manual.loader;
import java.util.List;
/**
* Created by Mark on 16/04/2016.
*/
public class VersionsInfo {
String name;
String lastUpdated;
List<DownloadablePackageInfo> versions;
}

View file

@ -1,104 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.manual.loader.pages;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import techreborn.items.ItemPlates;
import techreborn.manual.PageCollection;
import techreborn.manual.Reference;
import techreborn.manual.loader.ManualLoader;
import techreborn.manual.pages.TitledPage;
import techreborn.manual.saveFormat.Entry;
import techreborn.manual.util.GuiButtonItemTexture;
import java.awt.*;
import java.util.ArrayList;
/**
* Created by Mark on 23/04/2016.
*/
public class CategoriesPage extends TitledPage {
public CategoriesPage(String name, PageCollection collection) {
super(name, false, collection, Reference.CONTENTS_KEY, Color.white.getRGB());
}
@SuppressWarnings("unchecked")
@Override
public void initGui() {
buttonList.clear();
ArrayList<String> categories = new ArrayList<>();
for (Entry entry : ManualLoader.format.entries) {
if (!categories.contains(entry.category)) {
categories.add(entry.category);
}
}
int i = 0;
for (String string : categories) {
buttonList.add(new GuiButtonItemTexture(i, getXMin() + 20, getYMin() + 20 + (i * 20), 0, 46, 100, 20,
ItemPlates.getPlateByName("iron"), string,
string));
i++;
System.out.println(string);
}
//
//
// buttonList.add(new GuiButtonItemTexture(0, getXMin() + 20, getYMin() + 20, 0, 46, 100, 20,
// ItemPlates.getPlateByName("iron"), Reference.pageNames.GETTINGSTARTED_PAGE,
// ttl(Reference.GETTINGSTARTED_KEY)));
// buttonList.add(new GuiButtonItemTexture(1, getXMin() + 20, getYMin() + 40, 0, 46, 100, 20,
// new ItemStack(ModBlocks.Generator), Reference.pageNames.GENERATINGPOWER_PAGE,
// ttl(Reference.GENERATINGPOWER_KEY)));
// buttonList.add(new GuiButtonItemTexture(2, getXMin() + 20, getYMin() + 60, 0, 46, 100, 20,
// new ItemStack(ModBlocks.ElectricFurnace), Reference.pageNames.BASICMACHINES_PAGE,
// ttl(Reference.BASICMACHINES_KEY)));
// buttonList.add(new GuiButtonItemTexture(3, getXMin() + 20, getYMin() + 80, 0, 46, 100, 20,
// new ItemStack(ModBlocks.blastFurnace), Reference.pageNames.ADVANCEDMACHINES_PAGE,
// ttl(Reference.ADVANCEDMACHINES_KEY)));
// buttonList.add(new GuiButtonItemTexture(4, getXMin() + 20, getYMin() + 100, 0, 46, 100, 20,
// new ItemStack(ModItems.ironDrill), Reference.pageNames.TOOLS_PAGE, ttl(Reference.TOOLS_KEY)));
}
@Override
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
}
@Override
public void actionPerformed(GuiButton button) {
// if (button.id == 0)
// collection.changeActivePage(Reference.pageNames.GETTINGSTARTED_PAGE);
// if (button.id == 1)
// collection.changeActivePage(Reference.pageNames.GENERATINGPOWER_PAGE);
// if (button.id == 2)
// collection.changeActivePage(Reference.pageNames.BASICMACHINES_PAGE);
// if (button.id == 3)
// collection.changeActivePage(Reference.pageNames.ADVANCEDMACHINES_PAGE);
// if (button.id == 4)
// collection.changeActivePage(Reference.pageNames.TOOLS_PAGE);
}
}

View file

@ -1,83 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.manual.pages;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.item.ItemStack;
import techreborn.init.ModBlocks;
import techreborn.manual.PageCollection;
import techreborn.manual.Reference;
import techreborn.manual.util.ButtonUtil;
import techreborn.manual.util.GuiButtonItemTexture;
import java.awt.*;
public class AdvancedMachines extends TitledPage {
public AdvancedMachines(String name, PageCollection collection) {
super(name, false, collection, Reference.ADVANCEDMACHINES_KEY, Color.white.getRGB());
}
@Override
public void initGui() {
buttonList.clear();
ButtonUtil.addBackButton(0, width / 2 - 60, height / 2 + 64, buttonList);
buttonList.add(new GuiButtonItemTexture(1, getXMin() + 10, getYMin() + 20, 0, 46, 100, 20,
new ItemStack(ModBlocks.INDUSTRIAL_BLAST_FURNACE), ModBlocks.INDUSTRIAL_BLAST_FURNACE.getUnlocalizedName(),
ttl(ModBlocks.INDUSTRIAL_BLAST_FURNACE.getLocalizedName())));
buttonList.add(new GuiButtonItemTexture(2, getXMin() + 10, getYMin() + 40, 0, 46, 100, 20,
new ItemStack(ModBlocks.INDUSTRIAL_SAWMILL), ModBlocks.INDUSTRIAL_SAWMILL.getUnlocalizedName(),
ttl(ModBlocks.INDUSTRIAL_SAWMILL.getLocalizedName())));
buttonList.add(new GuiButtonItemTexture(3, getXMin() + 10, getYMin() + 60, 0, 46, 100, 20,
new ItemStack(ModBlocks.INDUSTRIAL_ELECTROLYZER), ModBlocks.INDUSTRIAL_ELECTROLYZER.getUnlocalizedName(),
ttl(ModBlocks.INDUSTRIAL_ELECTROLYZER.getLocalizedName())));
buttonList.add(new GuiButtonItemTexture(4, getXMin() + 10, getYMin() + 80, 0, 46, 100, 20,
new ItemStack(ModBlocks.INDUSTRIAL_GRINDER), ModBlocks.INDUSTRIAL_GRINDER.getUnlocalizedName(),
ttl(ModBlocks.INDUSTRIAL_GRINDER.getLocalizedName())));
buttonList.add(new GuiButtonItemTexture(5, getXMin() + 10, getYMin() + 100, 0, 46, 100, 20,
new ItemStack(ModBlocks.IMPLOSION_COMPRESSOR), ModBlocks.IMPLOSION_COMPRESSOR.getUnlocalizedName(),
ttl(ModBlocks.IMPLOSION_COMPRESSOR.getLocalizedName())));
buttonList.add(new GuiButtonItemTexture(6, getXMin() + 10, getYMin() + 120, 0, 46, 100, 20,
new ItemStack(ModBlocks.INDUSTRIAL_CENTRIFUGE), ModBlocks.INDUSTRIAL_CENTRIFUGE.getUnlocalizedName(),
ttl(ModBlocks.INDUSTRIAL_CENTRIFUGE.getLocalizedName())));
}
@Override
public void actionPerformed(GuiButton button) {
if (button.id == 0)
collection.changeActivePage(Reference.pageNames.CONTENTS_PAGE);
if (button.id == 1)
collection.changeActivePage(ModBlocks.INDUSTRIAL_BLAST_FURNACE.getLocalizedName());
if (button.id == 2)
collection.changeActivePage(ModBlocks.INDUSTRIAL_SAWMILL.getLocalizedName());
if (button.id == 3)
collection.changeActivePage(ModBlocks.INDUSTRIAL_ELECTROLYZER.getLocalizedName());
if (button.id == 4)
collection.changeActivePage(ModBlocks.INDUSTRIAL_GRINDER.getLocalizedName());
if (button.id == 5)
collection.changeActivePage(ModBlocks.IMPLOSION_COMPRESSOR.getLocalizedName());
if (button.id == 6)
collection.changeActivePage(ModBlocks.INDUSTRIAL_CENTRIFUGE.getLocalizedName());
}
}

View file

@ -1,123 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.manual.pages;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.manual.PageCollection;
import techreborn.manual.Reference;
import java.io.IOException;
public class BasePage extends GuiScreen {
public static final ResourceLocation PAGE_TEXTURE = new ResourceLocation(
"techreborn:textures/manual/gui/manual.png");
private final int xSize = 200;
private final int ySize = 180;
// Name Displayed in the index page
public String INDEX_NAME;
public boolean hasIndexButton = false;
protected PageCollection collection;
// Name used to reference the page
private String REFERENCE_NAME;
public BasePage() {
}
public BasePage(String referenceName, PageCollection collection) {
this.REFERENCE_NAME = referenceName;
this.mc = Minecraft.getMinecraft();
this.collection = collection;
initGui();
}
public BasePage(String referenceName, boolean showInMenue, PageCollection collection) {
this(referenceName, collection);
this.hasIndexButton = showInMenue;
}
public int getXMin() {
return (this.width - xSize) / 2;
}
public void setXMin(int x) {
this.width = x;
}
public int getYMin() {
return (this.height - ySize) / 2;
}
public void setYMin(int y) {
this.height = y;
}
// Unlocalized Index Page Name
public BasePage setIndexName(String unlocalizedName) {
this.INDEX_NAME = ttl(unlocalizedName);
return this;
}
public String getReferenceName() {
return REFERENCE_NAME;
}
public void setReferenceName(String name) {
REFERENCE_NAME = name;
}
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
minecraft.renderEngine.bindTexture(PAGE_TEXTURE);
drawTexturedModalRect(offsetX, offsetY, 0, 0, xSize, ySize);
}
public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
}
public void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.drawScreen(mouseX + offsetX, mouseY + offsetY, 0);
renderOverlayComponents(minecraft, offsetX, offsetY, mouseX, mouseY);
}
@Override
public void actionPerformed(GuiButton button) {
if (button.id == 0)
collection.changeActivePage(Reference.pageNames.CONTENTS_PAGE);
}
@Override
public void mouseClicked(int par1, int par2, int par3) throws IOException {
super.mouseClicked(par1, par2, par3);
}
// Translate To Local
public String ttl(String unlocalizedName) {
return I18n.translateToLocal(unlocalizedName);
}
}

View file

@ -1,78 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.manual.pages;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.item.ItemStack;
import techreborn.init.ModBlocks;
import techreborn.manual.PageCollection;
import techreborn.manual.Reference;
import techreborn.manual.util.ButtonUtil;
import techreborn.manual.util.GuiButtonItemTexture;
import java.awt.*;
public class BasicMachinesPage extends TitledPage {
public BasicMachinesPage(String name, PageCollection collection) {
super(name, false, collection, Reference.BASICMACHINES_KEY, Color.white.getRGB());
}
@Override
public void initGui() {
buttonList.clear();
ButtonUtil.addBackButton(0, width / 2 - 60, height / 2 + 64, buttonList);
buttonList.add(new GuiButtonItemTexture(1, getXMin() + 20, getYMin() + 20, 0, 46, 100, 20,
new ItemStack(ModBlocks.GRINDER), ModBlocks.GRINDER.getUnlocalizedName(),
ttl(ModBlocks.GRINDER.getLocalizedName())));
buttonList.add(new GuiButtonItemTexture(2, getXMin() + 20, getYMin() + 40, 0, 46, 100, 20,
new ItemStack(ModBlocks.ELECTRIC_FURNACE), ModBlocks.ELECTRIC_FURNACE.getUnlocalizedName(),
ttl(ModBlocks.ELECTRIC_FURNACE.getLocalizedName())));
buttonList.add(new GuiButtonItemTexture(3, getXMin() + 20, getYMin() + 60, 0, 46, 100, 20,
new ItemStack(ModBlocks.ALLOY_SMELTER), ModBlocks.ALLOY_SMELTER.getUnlocalizedName(),
ttl(ModBlocks.ALLOY_SMELTER.getLocalizedName())));
buttonList.add(new GuiButtonItemTexture(4, getXMin() + 20, getYMin() + 80, 0, 46, 100, 20,
new ItemStack(ModBlocks.EXTRACTOR), ModBlocks.EXTRACTOR.getUnlocalizedName(),
ttl(ModBlocks.EXTRACTOR.getLocalizedName())));
buttonList.add(new GuiButtonItemTexture(5, getXMin() + 20, getYMin() + 100, 0, 46, 100, 20,
new ItemStack(ModBlocks.COMPRESSOR), ModBlocks.COMPRESSOR.getUnlocalizedName(),
ttl(ModBlocks.COMPRESSOR.getLocalizedName())));
}
@Override
public void actionPerformed(GuiButton button) {
if (button.id == 0)
collection.changeActivePage(Reference.pageNames.CONTENTS_PAGE);
if (button.id == 1)
collection.changeActivePage(ModBlocks.GRINDER.getLocalizedName());
if (button.id == 2)
collection.changeActivePage(ModBlocks.ELECTRIC_FURNACE.getLocalizedName());
if (button.id == 3)
collection.changeActivePage(ModBlocks.ALLOY_SMELTER.getLocalizedName());
if (button.id == 4)
collection.changeActivePage(ModBlocks.EXTRACTOR.getLocalizedName());
if (button.id == 5)
collection.changeActivePage(ModBlocks.COMPRESSOR.getLocalizedName());
}
}

View file

@ -1,82 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.manual.pages;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.item.ItemStack;
import techreborn.init.ModBlocks;
import techreborn.init.ModItems;
import techreborn.items.ItemPlates;
import techreborn.manual.PageCollection;
import techreborn.manual.Reference;
import techreborn.manual.util.GuiButtonItemTexture;
import java.awt.*;
public class ContentsPage extends TitledPage {
public ContentsPage(String name, PageCollection collection) {
super(name, false, collection, Reference.CONTENTS_KEY, Color.white.getRGB());
}
@SuppressWarnings("unchecked")
@Override
public void initGui() {
buttonList.clear();
buttonList.add(new GuiButtonItemTexture(0, getXMin() + 20, getYMin() + 20, 0, 46, 100, 20,
ItemPlates.getPlateByName("iron"), Reference.pageNames.GETTINGSTARTED_PAGE,
ttl(Reference.GETTINGSTARTED_KEY)));
buttonList.add(new GuiButtonItemTexture(1, getXMin() + 20, getYMin() + 40, 0, 46, 100, 20,
new ItemStack(ModBlocks.SOLID_FUEL_GENEREATOR), Reference.pageNames.GENERATINGPOWER_PAGE,
ttl(Reference.GENERATINGPOWER_KEY)));
buttonList.add(new GuiButtonItemTexture(2, getXMin() + 20, getYMin() + 60, 0, 46, 100, 20,
new ItemStack(ModBlocks.ELECTRIC_FURNACE), Reference.pageNames.BASICMACHINES_PAGE,
ttl(Reference.BASICMACHINES_KEY)));
buttonList.add(new GuiButtonItemTexture(3, getXMin() + 20, getYMin() + 80, 0, 46, 100, 20,
new ItemStack(ModBlocks.INDUSTRIAL_BLAST_FURNACE), Reference.pageNames.ADVANCEDMACHINES_PAGE,
ttl(Reference.ADVANCEDMACHINES_KEY)));
buttonList.add(new GuiButtonItemTexture(4, getXMin() + 20, getYMin() + 100, 0, 46, 100, 20,
new ItemStack(ModItems.STEEL_DRILL), Reference.pageNames.TOOLS_PAGE, ttl(Reference.TOOLS_KEY)));
}
@Override
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
}
@Override
public void actionPerformed(GuiButton button) {
if (button.id == 0)
collection.changeActivePage(Reference.pageNames.GETTINGSTARTED_PAGE);
if (button.id == 1)
collection.changeActivePage(Reference.pageNames.GENERATINGPOWER_PAGE);
if (button.id == 2)
collection.changeActivePage(Reference.pageNames.BASICMACHINES_PAGE);
if (button.id == 3)
collection.changeActivePage(Reference.pageNames.ADVANCEDMACHINES_PAGE);
if (button.id == 4)
collection.changeActivePage(Reference.pageNames.TOOLS_PAGE);
}
}

View file

@ -1,340 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.manual.pages;
import com.google.common.base.MoreObjects;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.RenderItem;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import org.lwjgl.opengl.GL11;
import techreborn.manual.PageCollection;
import techreborn.manual.util.ButtonUtil;
import java.awt.*;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class CraftingInfoPage extends TitledPage {
public ItemStack result;
public String imageprefix = "techreborn:textures/manual/elements/";
public String backpage;
private boolean isSmelting = false;
private ItemStack[] recipe = new ItemStack[9];
private boolean hasRecipe = false;
private String rawDescription;
private List<String> formattedDescription;
private float descriptionScale = 0.66f;
public CraftingInfoPage(String name, PageCollection collection, ItemStack itemStack, String unlocalizedDescription,
String backPage) {
super(name, true, collection, itemStack.getUnlocalizedName() + ".name", Color.white.getRGB());
this.result = itemStack;
this.recipe = getFirstRecipeForItem(itemStack);
this.backpage = backPage;
for (ItemStack stack : recipe)
if (stack != null)
hasRecipe = true;
if (unlocalizedDescription == "")
rawDescription = ttl(itemStack.getUnlocalizedName() + ".description");
else
rawDescription = ttl(unlocalizedDescription);
}
@Override
public void initGui() {
buttonList.clear();
ButtonUtil.addBackButton(0, width / 2 - 60, height / 2 + 64, buttonList);
}
@Override
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
GL11.glPushMatrix();
if (isSmelting) {
renderImage(offsetX + 15, offsetY + 10, "furnacerecipe");
} else {
if (hasRecipe) {
renderImage(offsetX + (offsetX / 2), offsetY + 10, "craftingtable");
} else {
drawString(fontRenderer, "No Crafting Recipe", offsetX + 40, offsetY + 22, Color.black.getRGB());
}
}
GL11.glPopMatrix();
}
public void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.drawScreen(minecraft, offsetX, offsetY, mouseX, mouseY);
int relativeMouseX = mouseX + offsetX;
int relativeMouseY = mouseY + offsetY;
int gridOffsetX = isSmelting ? 85 : 71;
int gridOffsetY = 18;
int itemBoxSize = 18;
addDescription(minecraft, offsetX + 8, offsetY);
ItemStack tooltip = null;
int i = 0;
for (ItemStack input : recipe) {
if (input != null) {
int row = (i % 3);
int column = i / 3;
int itemX = offsetX + gridOffsetX + (row * itemBoxSize) - 54;
int itemY = offsetY + gridOffsetY + (column * itemBoxSize) + 2;
drawItemStack(input, itemX, itemY, "");
if (relativeMouseX > itemX - 2 && relativeMouseX < itemX - 2 + itemBoxSize && relativeMouseY > itemY - 2
&& relativeMouseY < itemY - 2 + itemBoxSize) {
tooltip = input;
}
}
i++;
}
int itemX = offsetX + (isSmelting ? 92 : 112);
int itemY = offsetY + (isSmelting ? 40 : 38);
if (!hasRecipe) {
itemX = offsetX + 20;
itemY = offsetY + 18;
}
drawItemStack(result, itemX, itemY, "");
if (relativeMouseX > itemX - 2 && relativeMouseX < itemX - 2 + itemBoxSize && relativeMouseY > itemY - 2
&& relativeMouseY < itemY - 2 + itemBoxSize) {
tooltip = result;
}
if (tooltip != null) {
drawItemStackTooltip(tooltip, relativeMouseX, relativeMouseY);
}
}
public void renderImage(int offsetX, int offsetY, String imagename) {
TextureManager render = Minecraft.getMinecraft().renderEngine;
render.bindTexture(new ResourceLocation(imageprefix + imagename + ".png"));
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(1F, 1F, 1F, 1F);
drawTexturedModalRect(offsetX + 16, offsetY + 9, 0, 0, 116, 54);
GL11.glDisable(GL11.GL_BLEND);
}
public void addDescription(Minecraft minecraft, int offsetX, int offsetY) {
GL11.glPushMatrix();
if (hasRecipe)
GL11.glTranslated(offsetX + 5, offsetY + 75, 1);
else
GL11.glTranslated(offsetX + 5, offsetY + 40, 1);
GL11.glScalef(descriptionScale, descriptionScale, descriptionScale);
int offset = 0;
for (String s : getFormattedText(fontRenderer)) {
if (s == null)
break;
if (s.contains("\\%") && s.substring(0, 2).equals("\\%")) {
s = s.substring(2);
offset += fontRenderer.FONT_HEIGHT / 2;
}
fontRenderer.drawString(s, 0, offset, Color.black.getRGB());
offset += fontRenderer.FONT_HEIGHT;
}
GL11.glPopMatrix();
}
@SuppressWarnings("unchecked")
public List<String> getFormattedText(FontRenderer fr) {
if (formattedDescription == null) {
formattedDescription = new ArrayList<>();
if (Strings.isNullOrEmpty(rawDescription)) {
formattedDescription = ImmutableList.of();
return formattedDescription;
}
if (!rawDescription.contains("\\n")) {
formattedDescription = ImmutableList.copyOf(fr.listFormattedStringToWidth(rawDescription, 370));
return formattedDescription;
}
List<String> segments = new ArrayList();
String raw = rawDescription;
int escape = 0;
while (raw.contains("\\n")) {
segments.add(raw.substring(0, raw.indexOf("\\n")));
raw = raw.substring(raw.indexOf("\\n") + 2);
if (!raw.contains("\\n"))
segments.add(raw);
escape++;
if (escape > 100) {
break;
}
}
for (String s : segments)
formattedDescription.addAll(ImmutableList.copyOf(fr.listFormattedStringToWidth(s, 370)));
}
return formattedDescription;
}
protected void drawItemStackTooltip(ItemStack stack, int x, int y) {
final Minecraft mc = Minecraft.getMinecraft();
FontRenderer font = MoreObjects.firstNonNull(stack.getItem().getFontRenderer(stack), mc.fontRenderer);
@SuppressWarnings("unchecked")
List<String> list = stack.getTooltip(mc.player, mc.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL);
List<String> colored = Lists.newArrayListWithCapacity(list.size());
colored.add(stack.getRarity().rarityColor + list.get(0));
for (String line : list)
colored.add(TextFormatting.GRAY + line);
if (colored.size() >= 2)
colored.remove(1);
drawHoveringText(colored, x, y, font);
}
private void drawItemStack(ItemStack par1ItemStack, int par2, int par3, String par4Str) {
GL11.glTranslatef(0.0F, 0.0F, 32.0F);
this.zLevel = 200.0F;
RenderHelper.enableGUIStandardItemLighting();
GL11.glColor3f(1f, 1f, 1f);
GL11.glEnable(GL11.GL_NORMALIZE);
FontRenderer font = null;
if (par1ItemStack != null)
font = par1ItemStack.getItem().getFontRenderer(par1ItemStack);
if (font == null)
font = Minecraft.getMinecraft().fontRenderer;
renderItemStack(par1ItemStack, par2, par3);
this.zLevel = 0.0F;
}
public void renderItemStack(ItemStack stack, int x, int y) {
if (stack != null) {
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderHelper.enableGUIStandardItemLighting();
RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem();
itemRenderer.renderItemAndEffectIntoGUI(stack, x, y);
GL11.glDisable(GL11.GL_LIGHTING);
}
}
@SuppressWarnings("unchecked")
private ItemStack[] getFirstRecipeForItem(ItemStack resultingItem) {
ItemStack[] recipeItems = new ItemStack[9];
for (IRecipe recipe : CraftingManager.REGISTRY) {
if (recipe == null)
continue;
ItemStack result = recipe.getRecipeOutput();
if (result == ItemStack.EMPTY || !result.isItemEqual(resultingItem))
continue;
NonNullList<Ingredient> input = recipe.getIngredients();
if (input.isEmpty())
continue;
for (int i = 0; i < input.size(); i++)
recipeItems[i] = convertToStack(input.get(i));
break;
}
Iterator iterator = FurnaceRecipes.instance().getSmeltingList().entrySet().iterator();
Map.Entry entry;
while (iterator.hasNext()) {
entry = (Map.Entry) iterator.next();
if (entry.getKey() instanceof ItemStack && ((ItemStack) entry.getValue()).isItemEqual(result)) {
isSmelting = true;
recipeItems[0] = (ItemStack) entry.getKey();
}
}
return recipeItems;
}
protected ItemStack convertToStack(Ingredient ingredient) {
ItemStack entry = ItemStack.EMPTY;
entry = ingredient.getMatchingStacks()[0];
if (entry == null || entry.isEmpty())
return null;
entry = entry.copy();
if (entry.getItemDamage() == OreDictionary.WILDCARD_VALUE)
entry.setItemDamage(0);
return entry;
}
private Object[] getShapedOreRecipe(ShapedOreRecipe recipe) {
try {
Field field = ShapedOreRecipe.class.getDeclaredField("width");
if (field != null) {
field.setAccessible(true);
int width = field.getInt(recipe);
NonNullList<Ingredient> input = recipe.getIngredients();
Object[] grid = new Object[9];
for (int i = 0, offset = 0, y = 0; y < 3; y++) {
for (int x = 0; x < 3; x++, i++) {
if (x < width && offset < input.size()) {
grid[i] = input.get(offset);
offset++;
} else {
grid[i] = null;
}
}
}
return grid;
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
@Override
public void actionPerformed(GuiButton button) {
if (button.id == 0)
collection.changeActivePage(backpage);
}
}

View file

@ -1,138 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.manual.pages;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import techreborn.manual.PageCollection;
import techreborn.manual.Reference;
import techreborn.manual.util.ButtonUtil;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
public class DescriptionPage extends TitledPage {
public boolean hasImage;
public String secondpage;
public String imageprefix = "techreborn:textures/manual/screenshots/";
private String rawDescription;
private List<String> formattedDescription;
private float descriptionScale = 0.88f;
public DescriptionPage(String name, PageCollection collection, boolean hasImage, String secondPage) {
super(name, false, collection, Reference.GETTINGSTARTED_KEY, Color.white.getRGB());
this.hasImage = hasImage;
this.rawDescription = "techreborn.manual." + this.getReferenceName() + ".description";
this.secondpage = secondPage;
}
@Override
public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
if (hasImage) {
renderImage(offsetX, offsetY);
addDescription(mc, offsetX, offsetY + 60);
} else
addDescription(mc, offsetX, offsetY);
}
@Override
public void initGui() {
buttonList.clear();
ButtonUtil.addBackButton(0, width / 2 - 60, height / 2 + 64, buttonList);
if (secondpage != null) {
ButtonUtil.addNextButton(1, width / 2 + 40, height / 2 + 64, buttonList);
}
}
public void renderImage(int offsetX, int offsetY) {
TextureManager render = Minecraft.getMinecraft().renderEngine;
render.bindTexture(new ResourceLocation(imageprefix + this.getReferenceName() + ".png"));
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(1F, 1F, 1F, 1F);
drawTexturedModalRect(offsetX, offsetY - 14, 0, 0, 120, this.height);
GL11.glDisable(GL11.GL_BLEND);
}
public void addDescription(Minecraft minecraft, int offsetX, int offsetY) {
GL11.glPushMatrix();
GL11.glTranslated(offsetX + 15, offsetY + 40, 1);
GL11.glScalef(descriptionScale, descriptionScale, descriptionScale);
int offset = 0;
for (String s : getFormattedText(fontRenderer)) {
if (s == null)
break;
if (s.contains("\\%") && s.substring(0, 2).equals("\\%")) {
s = s.substring(2);
offset += fontRenderer.FONT_HEIGHT / 2;
}
fontRenderer.drawString(s, 0, offset, Color.black.getRGB());
offset += fontRenderer.FONT_HEIGHT;
}
GL11.glPopMatrix();
}
@SuppressWarnings("unchecked")
public List<String> getFormattedText(FontRenderer fr) {
if (formattedDescription == null) {
formattedDescription = new ArrayList<>();
if (Strings.isNullOrEmpty(rawDescription)) {
formattedDescription = ImmutableList.of();
return formattedDescription;
}
if (!rawDescription.contains("\\n")) {
formattedDescription = ImmutableList.copyOf(fr.listFormattedStringToWidth(rawDescription, 130));
return formattedDescription;
}
List<String> segments = new ArrayList();
String raw = rawDescription;
for (String s : segments)
formattedDescription.addAll(ImmutableList.copyOf(fr.listFormattedStringToWidth(s, 370)));
}
return formattedDescription;
}
@Override
public void actionPerformed(GuiButton button) {
if (button.id == 0)
collection.changeActivePage(Reference.pageNames.GETTINGSTARTED_PAGE);
if (secondpage != null) {
if (button.id == 1)
collection.changeActivePage(secondpage);
}
}
}

View file

@ -1,78 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.manual.pages;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.item.ItemStack;
import techreborn.init.ModBlocks;
import techreborn.manual.PageCollection;
import techreborn.manual.Reference;
import techreborn.manual.util.ButtonUtil;
import techreborn.manual.util.GuiButtonItemTexture;
import java.awt.*;
public class GeneratingPowerPage extends TitledPage {
public GeneratingPowerPage(String name, PageCollection collection) {
super(name, false, collection, Reference.GENERATINGPOWER_KEY, Color.white.getRGB());
}
@Override
public void initGui() {
buttonList.clear();
ButtonUtil.addBackButton(0, width / 2 - 60, height / 2 + 64, buttonList);
buttonList.add(new GuiButtonItemTexture(1, getXMin() + 20, getYMin() + 20, 0, 46, 100, 20,
new ItemStack(ModBlocks.SOLID_FUEL_GENEREATOR), ModBlocks.SOLID_FUEL_GENEREATOR.getUnlocalizedName(),
ttl(ModBlocks.SOLID_FUEL_GENEREATOR.getLocalizedName())));
buttonList.add(new GuiButtonItemTexture(2, getXMin() + 20, getYMin() + 40, 0, 46, 100, 20,
new ItemStack(ModBlocks.THERMAL_GENERATOR), ModBlocks.THERMAL_GENERATOR.getUnlocalizedName(),
ttl(ModBlocks.THERMAL_GENERATOR.getLocalizedName())));
buttonList.add(new GuiButtonItemTexture(3, getXMin() + 20, getYMin() + 60, 0, 46, 100, 20,
new ItemStack(ModBlocks.SOLAR_PANEL), ModBlocks.SOLAR_PANEL.getUnlocalizedName(),
ttl(ModBlocks.SOLAR_PANEL.getLocalizedName())));
buttonList.add(new GuiButtonItemTexture(4, getXMin() + 20, getYMin() + 80, 0, 46, 100, 20,
new ItemStack(ModBlocks.HEAT_GENERATOR), ModBlocks.HEAT_GENERATOR.getUnlocalizedName(),
ttl(ModBlocks.HEAT_GENERATOR.getLocalizedName())));
buttonList.add(new GuiButtonItemTexture(5, getXMin() + 20, getYMin() + 100, 0, 46, 100, 20,
new ItemStack(ModBlocks.LIGHTNING_ROD), ModBlocks.LIGHTNING_ROD.getUnlocalizedName(),
ttl(ModBlocks.LIGHTNING_ROD.getLocalizedName())));
}
@Override
public void actionPerformed(GuiButton button) {
if (button.id == 0)
collection.changeActivePage(Reference.pageNames.CONTENTS_PAGE);
if (button.id == 1)
collection.changeActivePage(ModBlocks.SOLID_FUEL_GENEREATOR.getLocalizedName());
if (button.id == 2)
collection.changeActivePage(ModBlocks.THERMAL_GENERATOR.getLocalizedName());
if (button.id == 3)
collection.changeActivePage(ModBlocks.SOLAR_PANEL.getLocalizedName());
if (button.id == 4)
collection.changeActivePage(ModBlocks.HEAT_GENERATOR.getLocalizedName());
if (button.id == 5)
collection.changeActivePage(ModBlocks.LIGHTNING_ROD.getLocalizedName());
}
}

View file

@ -1,64 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.manual.pages;
import net.minecraft.client.gui.GuiButton;
import techreborn.items.ItemParts;
import techreborn.items.ItemPlates;
import techreborn.manual.PageCollection;
import techreborn.manual.Reference;
import techreborn.manual.util.ButtonUtil;
import techreborn.manual.util.GuiButtonItemTexture;
import java.awt.*;
public class GettingStartedPage extends TitledPage {
public GettingStartedPage(String name, PageCollection collection) {
super(name, false, collection, Reference.GETTINGSTARTED_KEY, Color.white.getRGB());
}
@Override
public void initGui() {
buttonList.clear();
ButtonUtil.addBackButton(0, width / 2 - 60, height / 2 + 64, buttonList);
buttonList.add(new GuiButtonItemTexture(1, getXMin() + 20, getYMin() + 20, 0, 46, 100, 20,
ItemParts.getPartByName("rubberSap"), Reference.pageNames.GETTINGRUBBER_PAGE,
ttl(Reference.GETTINGRUBBER_KEY)));
buttonList.add(new GuiButtonItemTexture(2, getXMin() + 20, getYMin() + 40, 0, 46, 100, 20,
ItemPlates.getPlateByName("iron"), Reference.pageNames.CRAFTINGPLATES_PAGE,
ttl(Reference.CRAFTINGPLATES_KEY)));
}
@Override
public void actionPerformed(GuiButton button) {
if (button.id == 0)
collection.changeActivePage(Reference.pageNames.CONTENTS_PAGE);
if (button.id == 1)
collection.changeActivePage(Reference.pageNames.GETTINGRUBBER_PAGE);
if (button.id == 2)
collection.changeActivePage(Reference.pageNames.CRAFTINGPLATES_PAGE);
}
}

View file

@ -1,48 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.manual.pages;
import net.minecraft.client.Minecraft;
import techreborn.manual.PageCollection;
public class TitledPage extends BasePage {
public boolean drawTitle = true;
private String title;
private int colour;
public TitledPage(String name, boolean showInMenue, PageCollection collection, String unlocalizedTitle, int colour) {
super(name, showInMenue, collection);
this.title = unlocalizedTitle;
this.colour = colour;
}
@Override
public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
if (title == null)
title = INDEX_NAME;
if (drawTitle)
drawCenteredString(minecraft.fontRenderer, ttl(title), offsetX + 70, offsetY + 10, colour);
}
}

View file

@ -1,98 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.manual.pages;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.item.ItemStack;
import techreborn.init.ModItems;
import techreborn.manual.PageCollection;
import techreborn.manual.Reference;
import techreborn.manual.util.ButtonUtil;
import techreborn.manual.util.GuiButtonItemTexture;
import java.awt.*;
public class ToolsPage extends TitledPage {
public ToolsPage(String name, PageCollection collection) {
super(name, false, collection, Reference.TOOLS_KEY, Color.white.getRGB());
}
@Override
public void initGui() {
buttonList.clear();
ButtonUtil.addBackButton(0, width / 2 - 60, height / 2 + 64, buttonList);
ButtonUtil.addNextButton(1, width / 2 + 40, height / 2 + 64, buttonList);
buttonList.add(new GuiButtonItemTexture(2, getXMin() + 20, getYMin() + 20, 0, 46, 100, 20,
new ItemStack(ModItems.STEEL_DRILL), ModItems.STEEL_DRILL.getUnlocalizedName(),
ttl(ModItems.STEEL_DRILL.getUnlocalizedName() + ".name")));
buttonList.add(new GuiButtonItemTexture(3, getXMin() + 20, getYMin() + 40, 0, 46, 100, 20,
new ItemStack(ModItems.DIAMOND_DRILL), ModItems.DIAMOND_DRILL.getUnlocalizedName(),
ttl(ModItems.DIAMOND_DRILL.getUnlocalizedName() + ".name")));
buttonList.add(new GuiButtonItemTexture(4, getXMin() + 20, getYMin() + 60, 0, 46, 100, 20,
new ItemStack(ModItems.ADVANCED_DRILL), ModItems.ADVANCED_DRILL.getUnlocalizedName(),
ttl(ModItems.ADVANCED_DRILL.getUnlocalizedName() + ".name")));
buttonList.add(new GuiButtonItemTexture(5, getXMin() + 20, getYMin() + 80, 0, 46, 100, 20,
new ItemStack(ModItems.STEEL_CHAINSAW), ModItems.STEEL_CHAINSAW.getUnlocalizedName(),
ttl(ModItems.STEEL_CHAINSAW.getUnlocalizedName() + ".name")));
buttonList.add(new GuiButtonItemTexture(6, getXMin() + 20, getYMin() + 100, 0, 46, 100, 20,
new ItemStack(ModItems.DIAMOND_CHAINSAW), ModItems.DIAMOND_CHAINSAW.getUnlocalizedName(),
ttl(ModItems.DIAMOND_CHAINSAW.getUnlocalizedName() + ".name")));
buttonList.add(new GuiButtonItemTexture(7, getXMin() + 20, getYMin() + 120, 0, 46, 100, 20,
new ItemStack(ModItems.ADVANCED_CHAINSAW), ModItems.ADVANCED_CHAINSAW.getUnlocalizedName(),
ttl(ModItems.ADVANCED_CHAINSAW.getUnlocalizedName() + ".name")));
}
@Override
public void actionPerformed(GuiButton button) {
if (button.id == 0)
collection.changeActivePage(Reference.pageNames.CONTENTS_PAGE);
if (button.id == 1) {
buttonList.clear();
ButtonUtil.addBackButton(0, width / 2 - 60, height / 2 + 64, buttonList);
buttonList.add(new GuiButtonItemTexture(8, getXMin() + 20, getYMin() + 20, 0, 46, 100, 20,
new ItemStack(ModItems.OMNI_TOOL), ModItems.OMNI_TOOL.getUnlocalizedName(),
ttl(ModItems.OMNI_TOOL.getUnlocalizedName() + ".name")));
buttonList.add(new GuiButtonItemTexture(9, getXMin() + 20, getYMin() + 40, 0, 46, 100, 20,
new ItemStack(ModItems.TREE_TAP), ModItems.TREE_TAP.getUnlocalizedName(),
ttl(ModItems.TREE_TAP.getUnlocalizedName() + ".name")));
}
if (button.id == 2)
collection.changeActivePage(ModItems.STEEL_DRILL.getUnlocalizedName() + ".name");
if (button.id == 3)
collection.changeActivePage(ModItems.DIAMOND_DRILL.getUnlocalizedName() + ".name");
if (button.id == 4)
collection.changeActivePage(ModItems.ADVANCED_DRILL.getUnlocalizedName() + ".name");
if (button.id == 5)
collection.changeActivePage(ModItems.STEEL_CHAINSAW.getUnlocalizedName() + ".name");
if (button.id == 6)
collection.changeActivePage(ModItems.DIAMOND_CHAINSAW.getUnlocalizedName() + ".name");
if (button.id == 7)
collection.changeActivePage(ModItems.ADVANCED_CHAINSAW.getUnlocalizedName() + ".name");
if (button.id == 8)
collection.changeActivePage(ModItems.OMNI_TOOL.getUnlocalizedName() + ".name");
if (button.id == 9)
collection.changeActivePage(ModItems.TREE_TAP.getUnlocalizedName() + ".name");
}
}

View file

@ -1,46 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.manual.saveFormat;
/**
* Created by Mark on 05/04/2016.
*/
public class Entry {
public String name;
public String registryName;
public MetaData meta;
/**
* This says what type of page it is, crafting, image, ect
*/
public String type;
public String category;
public EntryData data;
}

View file

@ -1,39 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.manual.saveFormat;
import java.util.HashMap;
/**
* Created by Mark on 05/04/2016.
*/
public class EntryData {
/**
* Use this to store data for a page
*/
public HashMap<String, String> data;
}

View file

@ -1,48 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.manual.saveFormat;
import java.util.List;
/**
* Created by Mark on 05/04/2016.
*/
public class ManualFormat {
public String name;
public String modId;
public List<Entry> entries;
public ManualFormat(String name, String modId, List<Entry> entries) {
this.name = name;
this.modId = modId;
this.entries = entries;
}
public ManualFormat() {
}
}

View file

@ -1,36 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.manual.saveFormat;
/**
* Created by Mark on 05/04/2016.
*/
public class MetaData {
int startMeta;
int endMeta;
}

View file

@ -1,43 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.manual.util;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List;
@SideOnly(Side.CLIENT)
public class ButtonUtil {
@SideOnly(Side.CLIENT)
public static void addBackButton(int ID, int X, int Y, List buttonList) {
buttonList.add(new GuiButtonCustomTexture(ID, X, Y, 50, 60, 17, 12, "button", "", "", 0, 11, 10, 16));
}
@SideOnly(Side.CLIENT)
public static void addNextButton(int ID, int X, int Y, List buttonList) {
buttonList.add(new GuiButtonCustomTexture(ID, X, Y, 50, 60, 17, 12, "button", "", "", 0, 1, 10, 17));
}
}

View file

@ -1,77 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.manual.util;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.OpenGlHelper;
import org.lwjgl.opengl.GL11;
public class GuiButtonAHeight extends GuiButton {
public GuiButtonAHeight(int id, int xPos, int yPos, int width, int hight, String displayString) {
super(id, xPos, yPos, width, hight, displayString);
}
@Override
public void drawButton(Minecraft minecraft, int mouseX, int mouseY, float ticks) {
if (this.visible) {
FontRenderer fontrenderer = minecraft.fontRenderer;
minecraft.getTextureManager().bindTexture(BUTTON_TEXTURES);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width
&& mouseY < this.y + this.height;
int k = this.getHoverState(this.hovered);
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
this.drawTexturedModalRect(this.x, this.y, 0, 46 + k * 20, this.width / 2, this.height);
this.drawTexturedModalRect(this.x + this.width / 2, this.y, 200 - this.width / 2,
46 + k * 20, this.width / 2, this.height);
if (this.height < 20) {
this.drawTexturedModalRect(x, y + 3, 0, (46 + k * 20) + 20 - height + 3, width / 2,
height - 3);
this.drawTexturedModalRect(x + width / 2, y + 3, 200 - width / 2,
(46 + k * 20) + 20 - height + 3, width / 2, height - 3);
}
this.mouseDragged(minecraft, mouseX, mouseY);
int l = 14737632;
if (packedFGColour != 0) {
l = packedFGColour;
} else if (!this.enabled) {
l = 10526880;
} else if (this.hovered) {
l = 16777120;
}
this.drawCenteredString(fontrenderer, this.displayString, this.x + this.width / 2,
this.y + (this.height - 8) / 2, l);
}
}
}

View file

@ -1,105 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.manual.util;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.client.config.GuiButtonExt;
import org.lwjgl.opengl.GL11;
import java.awt.*;
public class GuiButtonCustomTexture extends GuiButtonExt {
public int textureU;
public int textureV;
public String texturename;
public String LINKED_PAGE;
public String NAME;
public String imageprefix = "techreborn:textures/manual/elements/";
public int buttonHeight;
public int buttonWidth;
public int buttonU;
public int buttonV;
public int textureH;
public int textureW;
public GuiButtonCustomTexture(int id, int xPos, int yPos, int u, int v, int buttonWidth, int buttonHeight,
String texturename, String linkedPage, String name, int buttonU, int buttonV, int textureH, int textureW) {
super(id, xPos, yPos, buttonWidth, buttonHeight, "_");
this.textureU = u;
this.textureV = v;
this.texturename = texturename;
this.NAME = name;
this.LINKED_PAGE = linkedPage;
this.buttonHeight = height;
this.buttonWidth = width;
this.buttonU = buttonU;
this.buttonV = buttonV;
this.textureH = textureH;
this.textureW = textureW;
}
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
if (this.visible) {
boolean flag = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width
&& mouseY < this.y + this.height;
mc.getTextureManager().bindTexture(BUTTON_TEXTURES);
int u = textureU;
int v = textureV;
if (flag) {
u += width;
GL11.glPushMatrix();
GL11.glColor4f(0f, 0f, 0f, 1f);
this.drawTexturedModalRect(this.x, this.y, u, v, width, height);
GL11.glPopMatrix();
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glEnable(32826);
RenderHelper.enableStandardItemLighting();
RenderHelper.enableGUIStandardItemLighting();
renderImage(this.x, this.y);
this.drawString(mc.fontRenderer, this.NAME, this.x + 20, this.y + 3,
Color.white.getRGB());
}
}
public void renderImage(int offsetX, int offsetY) {
TextureManager render = Minecraft.getMinecraft().renderEngine;
render.bindTexture(new ResourceLocation(imageprefix + this.texturename + ".png"));
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(1F, 1F, 1F, 1F);
drawTexturedModalRect(offsetX, offsetY, this.buttonU, this.buttonV, this.textureW, this.textureH);
GL11.glDisable(GL11.GL_BLEND);
}
public boolean getIsHovering() {
return hovered;
}
}

View file

@ -1,84 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.manual.util;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.RenderItem;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.client.config.GuiButtonExt;
import org.lwjgl.opengl.GL11;
import java.awt.*;
public class GuiButtonItemTexture extends GuiButtonExt {
public int textureU;
public int textureV;
public ItemStack itemstack;
public String LINKED_PAGE;
public String NAME;
public GuiButtonItemTexture(int id, int xPos, int yPos, int u, int v, int width, int height, ItemStack stack,
String linkedPage, String name) {
super(id, xPos, yPos, width, height, "_");
textureU = u;
textureV = v;
itemstack = stack;
NAME = name;
this.LINKED_PAGE = linkedPage;
}
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
if (this.visible) {
boolean flag = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width
&& mouseY < this.y + this.height;
mc.getTextureManager().bindTexture(BUTTON_TEXTURES);
int u = textureU;
int v = textureV;
if (flag) {
u += mc.fontRenderer.getStringWidth(this.NAME) + 25;
v += mc.fontRenderer.getStringWidth(this.NAME) + 25;
GL11.glPushMatrix();
GL11.glColor4f(0f, 0f, 0f, 1f);
this.drawTexturedModalRect(this.x, this.y, u, v, mc.fontRenderer.getStringWidth(this.NAME) + 25, height);
GL11.glPopMatrix();
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glEnable(32826);
RenderHelper.enableStandardItemLighting();
RenderHelper.enableGUIStandardItemLighting();
RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem();
itemRenderer.renderItemIntoGUI(itemstack, this.x, this.y);
this.drawString(mc.fontRenderer, this.NAME, this.x + 20, this.y + 3,
Color.white.getRGB());
}
}
public boolean getIsHovering() {
return hovered;
}
}

View file

@ -1,92 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.manual.util;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.util.text.TextFormatting;
import org.lwjgl.opengl.GL11;
import java.awt.*;
public class GuiButtonTextOnly extends GuiButton {
public String LINKED_PAGE;
public int textColour;
public GuiButtonTextOnly(int id, int xPos, int yPos, int width, int hight, String displayString, String linkedPage,
int colour) {
super(id, xPos, yPos, width, hight, displayString);
this.LINKED_PAGE = linkedPage;
this.textColour = colour;
}
@Override
public void drawButton(Minecraft minecraft, int mouseX, int mouseY, float partialTicks) {
if (this.visible) {
FontRenderer fontrenderer = minecraft.fontRenderer;
minecraft.getTextureManager().bindTexture(BUTTON_TEXTURES);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width
&& mouseY < this.y + this.height;
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
this.mouseDragged(minecraft, mouseX, mouseY);
String trimmedDisplayString = displayString;
if (fontrenderer.getStringWidth(displayString) > width + 30 && !this.hovered) {
int energencyBreak = 0;
while (fontrenderer.getStringWidth(trimmedDisplayString) * 0.7 > width - 5) {
trimmedDisplayString = trimmedDisplayString.substring(0, trimmedDisplayString.length() - 1);
energencyBreak++;
if (energencyBreak > 100)
break;
}
trimmedDisplayString += "...";
}
if (this.hovered) {
trimmedDisplayString = TextFormatting.BOLD + "" + TextFormatting.ITALIC + trimmedDisplayString;
GL11.glPushMatrix();
GL11.glColor4f(0f, 0f, 0f, 1f);
drawTexturedModalRect(x + (int) (x * 0.01), y + (int) (y * 0.01), 0, 46,
(int) (fontrenderer.getStringWidth(trimmedDisplayString) * 0.72) + 2, 8);
GL11.glPopMatrix();
}
GL11.glPushMatrix();
GL11.glScalef(0.7F, 0.7F, 1);
fontrenderer.drawString(trimmedDisplayString, (int) (x * 1.45),
(int) ((y + (height - 8) / 2) * 1.45), Color.WHITE.getRGB());
GL11.glPopMatrix();
}
}
public boolean getIsHovering() {
return hovered;
}
}

View file

@ -49,9 +49,6 @@ import prospector.shootingstar.ShootingStar;
import reborncore.api.tile.IUpgradeable; import reborncore.api.tile.IUpgradeable;
import reborncore.client.hud.StackInfoHUD; import reborncore.client.hud.StackInfoHUD;
import reborncore.client.multiblock.MultiblockRenderEvent; import reborncore.client.multiblock.MultiblockRenderEvent;
import techreborn.Core;
import techreborn.blocks.BlockMachineCasing;
import techreborn.blocks.BlockMachineFrames;
import techreborn.blocks.BlockRubberLeaves; import techreborn.blocks.BlockRubberLeaves;
import techreborn.client.ClientMultiBlocks; import techreborn.client.ClientMultiBlocks;
import techreborn.client.IconSupplier; import techreborn.client.IconSupplier;
@ -65,9 +62,6 @@ import techreborn.entities.EntityNukePrimed;
import techreborn.init.ModBlocks; import techreborn.init.ModBlocks;
import techreborn.items.ItemFrequencyTransmitter; import techreborn.items.ItemFrequencyTransmitter;
import techreborn.lib.ModInfo; import techreborn.lib.ModInfo;
import techreborn.manual.loader.ManualLoader;
import java.io.File;
public class ClientProxy extends CommonProxy { public class ClientProxy extends CommonProxy {

View file

@ -1,156 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2017 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.tiles.generator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import reborncore.common.IWrenchable;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.registration.RebornRegistry;
import reborncore.common.registration.impl.ConfigRegistry;
import techreborn.init.ModBlocks;
import techreborn.lib.ModInfo;
@RebornRegistry(modID = ModInfo.MOD_ID)
public class TileHeatGenerator extends TilePowerAcceptor implements IWrenchable {
@ConfigRegistry(config = "machines", category = "heat_generator", key = "HeatGeneratorMaxOutput", comment = "Heat Generator Max Output (Value in EU)")
public static int maxOutput = 128;
@ConfigRegistry(config = "machines", category = "heat_generator", key = "HeatGeneratorMaxEnergy", comment = "Heat Generator Max Energy (Value in EU)")
public static int maxEnergy = 10000;
@ConfigRegistry(config = "machines", category = "heat_generator", key = "HeatGeneratorEnergyPerTick", comment = "Heat Generator Energy Per Tick (Value in EU)")
public static int energyPerTick = 5;
private long lastOutput = 0;
public TileHeatGenerator() {
super();
}
@Override
public void updateEntity() {
super.updateEntity();
if (!world.isRemote) {
for (final EnumFacing direction : EnumFacing.values()) {
if (direction.equals(EnumFacing.UP))
continue;
if (this.world
.getBlockState(new BlockPos(this.getPos().getX() + direction.getFrontOffsetX(),
this.getPos().getY() + direction.getFrontOffsetY(),
this.getPos().getZ() + direction.getFrontOffsetZ()))
.getBlock() == Blocks.LAVA) {
if (tryAddingEnergy(energyPerTick))
this.lastOutput = this.world.getTotalWorldTime();
}
}
if (this.world.getTotalWorldTime() - this.lastOutput < 30 && !this.isActive())
this.world.setBlockState(this.getPos(),
this.world.getBlockState(this.getPos()).withProperty(BlockMachineBase.ACTIVE, true));
else if (this.world.getTotalWorldTime() - this.lastOutput > 30 && this.isActive())
this.world.setBlockState(this.getPos(),
this.world.getBlockState(this.getPos()).withProperty(BlockMachineBase.ACTIVE, false));
}
}
private boolean tryAddingEnergy(int amount) {
if (this.getMaxPower() - this.getEnergy() >= amount) {
addEnergy(amount);
return true;
} else if (this.getMaxPower() - this.getEnergy() > 0) {
addEnergy(this.getMaxPower() - this.getEnergy());
return true;
}
return false;
}
@Override
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
return false;
}
@Override
public EnumFacing getFacing() {
return getFacingEnum();
}
@Override
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
return entityPlayer.isSneaking();
}
@Override
public float getWrenchDropRate() {
return 1.0F;
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return new ItemStack(ModBlocks.HEAT_GENERATOR, 1);
}
public boolean isComplete() {
return false;
}
@Override
public double getBaseMaxPower() {
return maxEnergy;
}
@Override
public boolean canAcceptEnergy(EnumFacing direction) {
return false;
}
@Override
public boolean canProvideEnergy(EnumFacing direction) {
return true;
}
@Override
public double getBaseMaxOutput() {
return maxOutput;
}
@Override
public double getBaseMaxInput() {
return 0;
}
// @Override
// public void addWailaInfo(List<String> info)
// {
// super.addWailaInfo(info);
// info.add("Power Generarating " + euTick +" EU/t");
//
// }
}

View file

@ -1,10 +1,18 @@
{ {
"forge_marker": 1, "forge_marker": 1,
"defaults": { "defaults": {
"transform": "forge:default-block",
"model": "cube_all",
"textures": { "textures": {
"all": "techreborn:blocks/reinforced_glass" "all": "techreborn:blocks/reinforced_glass"
} },
"transform": "forge:default-block",
"model": "cube_all"
},
"variants": {
"inventory": [
{}
],
"normal": [
{}
]
} }
} }

View file

@ -69,7 +69,7 @@ tile.techreborn:scrapboxinator.name=Scrapbox-inator
tile.techreborn:batbox.name=Battery Box tile.techreborn:batbox.name=Battery Box
tile.techreborn:mfe.name=MFE tile.techreborn:mfe.name=MFE
tile.techreborn:mfsu.name=MFSU tile.techreborn:mfsu.name=MFSU
tile.techreborn:reinforcedglass.name=Reinforced Glass tile.techreborn:reinforced_glass.name=Reinforced Glass
tile.techreborn:nuke.name=Nuke tile.techreborn:nuke.name=Nuke
tile.techreborn:lvtransformer.name=LV Transformer tile.techreborn:lvtransformer.name=LV Transformer
tile.techreborn:mvtransformer.name=MV Transformer tile.techreborn:mvtransformer.name=MV Transformer
@ -618,36 +618,36 @@ item.techreborn:manual.name=Tech Manual
item.techreborn:debug.name=Debug Tool item.techreborn:debug.name=Debug Tool
#Recipe Handlers #Recipe Handlers
techreborn:recipe.alloysmelter=Alloy Furnace Recipe techreborn.recipe.alloysmelter=Alloy Furnace Recipe
techreborn:recipe.ironalloysmelter=Iron Alloy Furnace Recipe techreborn.recipe.ironalloysmelter=Iron Alloy Furnace Recipe
techreborn:recipe.assemblingmachine=Assembling Machine Recipe techreborn.recipe.assemblingmachine=Assembling Machine Recipe
techreborn:recipe.blastfurnace=Blast Furnace Recipe techreborn.recipe.blastfurnace=Blast Furnace Recipe
techreborn:recipe.centrifuge=Centrifuge Recipe techreborn.recipe.centrifuge=Centrifuge Recipe
techreborn:recipe.grinder=Industrial Grinder Recipe techreborn.recipe.grinder=Industrial Grinder Recipe
techreborn:recipe.industrialelectrolyzer=Industrial Electrolyzer Recipe techreborn.recipe.industrialelectrolyzer=Industrial Electrolyzer Recipe
techreborn:recipe.industrialsawmill=Industrial Sawmill Recipe techreborn.recipe.industrialsawmill=Industrial Sawmill Recipe
techreborn:recipe.lathe=Lathe Recipe techreborn.recipe.lathe=Lathe Recipe
techreborn:recipe.platecuttingmachine=Plate Cutting Machine Recipe techreborn.recipe.platecuttingmachine=Plate Cutting Machine Recipe
techreborn:recipe.chemicalReactor=Chemical Reactor Recipe techreborn.recipe.chemicalReactor=Chemical Reactor Recipe
techreborn:recipe.implosioncompressor=Implosion Compressor techreborn.recipe.implosioncompressor=Implosion Compressor
#Message #Message
techreborn:message.missingmultiblock=Incomplete Multiblock techreborn.message.missingmultiblock=Incomplete Multiblock
techreborn:message.setTo=Set to techreborn.message.setTo=Set to
techreborn:message.in=in techreborn.message.in=in
techreborn:message.noCoordsSet=No Coordinates Set techreborn.message.noCoordsSet=No Coordinates Set
techreborn:message.coordsHaveBeen=Coordinates have been techreborn.message.coordsHaveBeen=Coordinates have been
techreborn:message.cleared=Cleared techreborn.message.cleared=Cleared
techreborn:message.detects=Detects techreborn.message.detects=Detects
techreborn:message.allPlayers=All Players techreborn.message.allPlayers=All Players
techreborn:message.onlyOtherPlayers=Only Other Players techreborn.message.onlyOtherPlayers=Only Other Players
techreborn:message.onlyYou=Only You techreborn.message.onlyYou=Only You
techreborn:message.nanosaberActive=Active techreborn.message.nanosaberActive=Active
techreborn:message.nanosaberActivate=Activate techreborn.message.nanosaberActivate=Activate
techreborn:message.nanosaberDeactivating=Deactivating techreborn.message.nanosaberDeactivating=Deactivating
techreborn:message.nanosaberInactive=Inactive techreborn.message.nanosaberInactive=Inactive
techreborn:message.nanosaberEnergyErrorTo=Not Enough Energy to techreborn.message.nanosaberEnergyErrorTo=Not Enough Energy to
techreborn:message.nanosaberEnergyError=Not Enough Energy: techreborn.message.nanosaberEnergyError=Not Enough Energy:
#Cables #Cables
Cable.copperCable.name=Copper Cable Cable.copperCable.name=Copper Cable
@ -667,25 +667,6 @@ desc.uninsulatedCable=Damages Entities!
desc.transfer=Energy Transfer: desc.transfer=Energy Transfer:
desc.tier=Tier: desc.tier=Tier:
#Manual
techreborn:manual.contents=Contents Page
techreborn:manual.gettingstarted=Getting Started
techreborn:manual.generatingpower=Generating Power
techreborn:manual.basicmachines=Basic Machines
techreborn:manual.advancedmachines=Advanced Machines
techreborn:manual.tools=Tools
techreborn:manual.gettingrubber=Collecting Rubber
techreborn:manual.backbutton=Back
techreborn:manual.gettingplates=Crafting Plates
item.techreborn:advancedDrill.description=This Tool is a advanced version of the mining drill, when this item is activated it will dig out a 3x3.
tile.techreborn:alloyfurnace.description=This Machine is your first step into TechReborn with this you can fuse metals into other metals. These other metals can be used to craft the higher tier machines.
tile.techreborn:alloysmelter.description=This machine is a upgraded version of the Alloy Furnace, This block requires EU or RF.
tile.techreborn:assemblingmachine.description=This block is used to craft some of the more complex machines that can't be crafted in a normal crafting table.
tile.techreborn:blastfurnace.description=This Machine needs a 3x4x3 of machine casings behind it to increase its internal heat, The hotter the machine is the more recipes will open up to you. This machine also needs EU/RF.
keys.techreborn:category=TechReborn Category keys.techreborn:category=TechReborn Category
keys.techreborn:config=Config keys.techreborn:config=Config
@ -695,20 +676,20 @@ achievement.TechReborn:centrifuge_Craft=Time to Spin
achievement.TechReborn:thermalgen_Craft=Time to Heat achievement.TechReborn:thermalgen_Craft=Time to Heat
# JEI Integration # JEI Integration
techreborn:jei.recipe.start.cost=Start: %sEU techreborn.jei.recipe.start.cost=Start: %sEU
techreborn:jei.recipe.running.cost=EU/t: %s techreborn.jei.recipe.running.cost=EU/t: %s
techreborn:jei.recipe.processing.time.1=Time: %s ticks techreborn.jei.recipe.processing.time.1=Time: %s ticks
techreborn:jei.recipe.processing.time.2=(%s seconds) techreborn.jei.recipe.processing.time.2=(%s seconds)
jei.techreborn:scrapbox.name=Opening Scrapboxes jei.techreborn.scrapbox.name=Opening Scrapboxes
techreborn:desc.rubberSap=In order to get sap, you need to find a rubber tree or obtain a rubber tree sapling and proceed to grow it. Once you have obtained a rubber tree, search around for little yellowish spots on the tree. If you don't see any, just wait a bit and eventually these yellow "sap" spots. To harvest the sap, use a treetap and use it on the log. techreborn.desc.rubberSap=In order to get sap, you need to find a rubber tree or obtain a rubber tree sapling and proceed to grow it. Once you have obtained a rubber tree, search around for little yellowish spots on the tree. If you don't see any, just wait a bit and eventually these yellow "sap" spots. To harvest the sap, use a treetap and use it on the log.
techreborn:desc.scrapBox=Scrapboxes can be opened by either a simple use in hand, or by dispensers. That's right, just throw your scrapboxes into dispensers and give them a redstone signal, and boom! Random item! techreborn.desc.scrapBox=Scrapboxes can be opened by either a simple use in hand, or by dispensers. That's right, just throw your scrapboxes into dispensers and give them a redstone signal, and boom! Random item!
techreborn:desc.scrapBoxNoDispenser=Scrapboxes can be opened by a simple use in hand! techreborn.desc.scrapBoxNoDispenser=Scrapboxes can be opened by a simple use in hand!
techreborn:jei.category.alloy.furnace=Alloy Furnace techreborn.jei.category.alloy.furnace=Alloy Furnace
techreborn:jei.category.generator.gas=Gas Generator techreborn.jei.category.generator.gas=Gas Generator
techreborn:jei.category.generator.semifluid=Semifluid Generator techreborn.jei.category.generator.semifluid=Semifluid Generator
techreborn:jei.category.generator.diesel=Diesel Generator techreborn.jei.category.generator.diesel=Diesel Generator
techreborn:jei.category.generator.thermal=Thermal Generator techreborn.jei.category.generator.thermal=Thermal Generator
#Death Messages #Death Messages
death.attack.shock=%s was electrocuted death.attack.shock=%s was electrocuted

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 16 KiB