Merge remote-tracking branch 'remotes/origin/1.12' into 1.13-prep

# Conflicts:
#	src/main/java/techreborn/api/fluidreplicator/FluidReplicatorRecipe.java
#	src/main/java/techreborn/client/container/ContainerPda.java
#	src/main/java/techreborn/client/gui/TRBuilder.java
#	src/main/java/techreborn/compat/crafttweaker/CTFusionReactor.java
#	src/main/java/techreborn/compat/crafttweaker/CTGeneric.java
#	src/main/java/techreborn/compat/jei/RecipeUtil.java
#	src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java
#	src/main/java/techreborn/compat/jei/alloySmelter/AlloySmelterRecipeCategory.java
#	src/main/java/techreborn/compat/jei/assemblingMachine/AssemblingMachineRecipeCategory.java
#	src/main/java/techreborn/compat/jei/blastFurnace/BlastFurnaceRecipeCategory.java
#	src/main/java/techreborn/compat/jei/centrifuge/CentrifugeRecipeCategory.java
#	src/main/java/techreborn/compat/jei/chemicalReactor/ChemicalReactorRecipeCategory.java
#	src/main/java/techreborn/compat/jei/compressor/CompressorRecipeCategory.java
#	src/main/java/techreborn/compat/jei/distillationTower/DistillationTowerRecipeCategory.java
#	src/main/java/techreborn/compat/jei/extractor/ExtractorRecipeCategory.java
#	src/main/java/techreborn/compat/jei/fluidReplicator/FluidReplicatorRecipeCategory.java
#	src/main/java/techreborn/compat/jei/fusionReactor/FusionReactorRecipeCategory.java
#	src/main/java/techreborn/compat/jei/fusionReactor/FusionReactorRecipeWrapper.java
#	src/main/java/techreborn/compat/jei/grinder/GrinderRecipeCategory.java
#	src/main/java/techreborn/compat/jei/implosionCompressor/ImplosionCompressorRecipeCategory.java
#	src/main/java/techreborn/compat/jei/industrialElectrolyzer/IndustrialElectrolyzerRecipeCategory.java
#	src/main/java/techreborn/compat/jei/industrialGrinder/IndustrialGrinderRecipeCategory.java
#	src/main/java/techreborn/compat/jei/industrialSawmill/IndustrialSawmillRecipeCategory.java
#	src/main/java/techreborn/compat/jei/rollingMachine/RollingMachineRecipeCategory.java
#	src/main/java/techreborn/compat/jei/vacuumFreezer/VacuumFreezerRecipeCategory.java
#	src/main/java/techreborn/init/ModBlocks.java
#	src/main/java/techreborn/init/ModTileEntities.java
#	src/main/java/techreborn/init/recipes/CraftingTableRecipes.java
#	src/main/java/techreborn/init/recipes/IndustrialGrinderRecipes.java
#	src/main/java/techreborn/items/tools/ItemAdvancedDrill.java
#	src/main/java/techreborn/packets/PacketAutoCraftingTableLock.java
#	src/main/resources/assets/techreborn/lang/en_us.lang
#	src/main/resources/assets/techreborn/loot_tables/chests/abandoned_mineshaft.json
#	src/main/resources/assets/techreborn/loot_tables/chests/desert_pyramid.json
#	src/main/resources/assets/techreborn/loot_tables/chests/igloo_chest.json
#	src/main/resources/assets/techreborn/loot_tables/chests/jungle_temple.json
#	src/main/resources/assets/techreborn/loot_tables/chests/simple_dungeon.json
#	src/main/resources/assets/techreborn/loot_tables/chests/village_blacksmith.json
This commit is contained in:
Modmuss50 2018-09-05 17:49:49 +01:00
commit 6060a97855
No known key found for this signature in database
GPG key ID: 773D17BE8BF49C82
77 changed files with 1863 additions and 4017 deletions

View file

@ -24,6 +24,7 @@
package techreborn.api.fluidreplicator;
import reborncore.common.util.FluidUtils;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
@ -114,11 +115,11 @@ public class FluidReplicatorRecipe implements Cloneable {
if (fluid == null) {
return false;
}
if (!fluid.equals(output)) {
if (!FluidUtils.fluidEquals(fluid, output)) {
return false;
}
final Fluid tankFluid = tile.tank.getFluidType();
if (tankFluid != null && !tankFluid.equals(output)) {
if (tankFluid != null && !FluidUtils.fluidEquals(tankFluid, fluid)) {
return false;
}

View file

@ -26,6 +26,7 @@ package techreborn.api.fluidreplicator;
import net.minecraftforge.fluids.Fluid;
import org.apache.commons.lang3.Validate;
import reborncore.common.util.FluidUtils;
import java.util.ArrayList;
import java.util.Optional;
@ -72,6 +73,6 @@ public class FluidReplicatorRecipeList {
* @return FluidReplicatorRecipe Recipe for fluid provided
*/
public static Optional<FluidReplicatorRecipe> getRecipeForFluid(Fluid fluid) {
return recipes.stream().filter(recipe -> recipe.getFluid().equals(fluid)).findAny();
return recipes.stream().filter(recipe -> FluidUtils.fluidEquals(recipe.getFluid(), fluid)).findAny();
}
}

View file

@ -25,6 +25,7 @@
package techreborn.api.generator;
import net.minecraftforge.fluids.Fluid;
import reborncore.common.util.FluidUtils;
public class FluidGeneratorRecipe {
private final EFluidGenerator generatorType;
@ -79,7 +80,7 @@ public class FluidGeneratorRecipe {
if (fluid == null) {
if (other.fluid != null)
return false;
} else if (!fluid.equals(other.fluid))
} else if (!FluidUtils.fluidEquals(other.fluid, fluid))
return false;
if (generatorType != other.generatorType)
return false;

View file

@ -26,6 +26,7 @@ package techreborn.api.generator;
import com.google.common.collect.Sets;
import net.minecraftforge.fluids.Fluid;
import reborncore.common.util.FluidUtils;
import java.util.HashSet;
import java.util.Optional;
@ -48,7 +49,7 @@ public class FluidGeneratorRecipeList {
}
public Optional<FluidGeneratorRecipe> getRecipeForFluid(Fluid fluid) {
return this.recipes.stream().filter(recipe -> recipe.getFluid().equals(fluid)).findAny();
return this.recipes.stream().filter(recipe -> FluidUtils.fluidEquals(recipe.getFluid(), fluid)).findAny();
}
public HashSet<FluidGeneratorRecipe> getRecipes() {

View file

@ -228,7 +228,7 @@ public class BlockCable extends BlockContainer {
@Override
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) {
return getStateFromMeta(placer.getHeldItem(hand).getItemDamage());
return getStateFromMeta(meta);
}
@Override

View file

@ -0,0 +1,69 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2018 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.tier3;
import net.minecraft.block.state.IBlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import prospector.shootingstar.ShootingStar;
import prospector.shootingstar.model.ModelCompound;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.common.blocks.BlockMachineBase;
import techreborn.client.EGui;
import techreborn.lib.ModInfo;
import techreborn.tiles.TileCreativeQuantumChest;
import techreborn.utils.TechRebornCreativeTab;
public class BlockCreativeQuantumChest extends BlockMachineBase {
public BlockCreativeQuantumChest() {
super();
this.setUnlocalizedName("techreborn.creativeQuantumChest");
setCreativeTab(TechRebornCreativeTab.instance);
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/tier3_machines"));
}
@Override
public TileEntity createNewTileEntity(final World world, final int meta) {
return new TileCreativeQuantumChest();
}
@Override
public IMachineGuiHandler getGui() {
return EGui.QUANTUM_CHEST;
}
@Override
public boolean isAdvanced() {
return true;
}
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
//lets not drop max int items into the world, that sounds like a bad idea
worldIn.removeTileEntity(pos);
}
}

View file

@ -0,0 +1,60 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2018 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.tier3;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import prospector.shootingstar.ShootingStar;
import prospector.shootingstar.model.ModelCompound;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.common.blocks.BlockMachineBase;
import techreborn.client.EGui;
import techreborn.lib.ModInfo;
import techreborn.tiles.TileCreativeQuantumTank;
import techreborn.utils.TechRebornCreativeTab;
public class BlockCreativeQuantumTank extends BlockMachineBase {
public BlockCreativeQuantumTank() {
super();
setCreativeTab(TechRebornCreativeTab.instance);
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/tier3_machines"));
}
@Override
public TileEntity createNewTileEntity(final World world, final int meta) {
return new TileCreativeQuantumTank();
}
@Override
public IMachineGuiHandler getGui() {
return EGui.QUANTUM_TANK;
}
@Override
public boolean isAdvanced() {
return true;
}
}

View file

@ -37,6 +37,7 @@ public class ContainerDestructoPack extends RebornContainer {
private EntityPlayer player;
private Inventory inv;
@SuppressWarnings("deprecation")
public ContainerDestructoPack(EntityPlayer player) {
super(null);
this.player = player;

View file

@ -61,7 +61,7 @@ public class GuiAESU extends GuiBase {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
final Layer layer = Layer.FOREGROUND;
if(!GuiBase.showSlotConfig){
if(GuiBase.slotConfigType == SlotConfigType.NONE){
GlStateManager.pushMatrix();
GlStateManager.scale(0.6, 0.6, 1);
this.drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.tile.getEnergy()) + "/"

View file

@ -28,7 +28,9 @@ import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.client.config.GuiUtils;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@ -36,8 +38,11 @@ import org.lwjgl.input.Keyboard;
import reborncore.api.tile.IUpgradeable;
import reborncore.common.tile.TileLegacyMachineBase;
import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.gui.slot.GuiFluidConfiguration;
import techreborn.client.gui.slot.GuiSlotConfiguration;
import techreborn.client.gui.widget.GuiButtonPowerBar;
import techreborn.init.ModItems;
import techreborn.items.DynamicCell;
import java.io.IOException;
import java.util.ArrayList;
@ -53,7 +58,7 @@ public class GuiBase extends GuiContainer {
public TRBuilder builder = new TRBuilder();
public TileEntity tile;
public BuiltContainer container;
public static boolean showSlotConfig = false;
public static SlotConfigType slotConfigType = SlotConfigType.NONE;
public boolean upgrades;
@ -61,7 +66,7 @@ public class GuiBase extends GuiContainer {
super(container);
this.tile = tile;
this.container = container;
showSlotConfig = false;
slotConfigType = SlotConfigType.NONE;
}
protected void drawSlot(int x, int y, Layer layer) {
@ -119,6 +124,9 @@ public class GuiBase extends GuiContainer {
public void initGui() {
super.initGui();
GuiSlotConfiguration.init(this);
if(getMachine().getTank() != null && getMachine().showTankConfig()){
GuiFluidConfiguration.init(this);
}
}
@Override
@ -136,7 +144,10 @@ public class GuiBase extends GuiContainer {
}
}
if(getMachine().hasSlotConfig()){
builder.drawSlotTab(this, guiLeft, guiTop, mouseX, mouseY, upgrades);
builder.drawSlotTab(this, guiLeft, guiTop, mouseX, mouseY, upgrades, new ItemStack(ModItems.WRENCH));
}
if(getMachine().showTankConfig()){
builder.drawSlotTab(this, guiLeft, guiTop + 27, mouseX, mouseY, upgrades, DynamicCell.getCellWithFluid(FluidRegistry.LAVA));
}
}
@ -153,10 +164,14 @@ public class GuiBase extends GuiContainer {
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
this.buttonList.clear();
drawTitle();
if(showSlotConfig && getMachine().hasSlotConfig()){
if(slotConfigType == SlotConfigType.ITEMS && getMachine().hasSlotConfig()){
GuiSlotConfiguration.draw(this, mouseX, mouseY);
}
if(slotConfigType == SlotConfigType.FLUIDS && getMachine().showTankConfig()){
GuiFluidConfiguration.draw(this, mouseX, mouseY);
}
int offset = 0;
if(!upgrades){
offset = 80;
@ -168,6 +183,13 @@ public class GuiBase extends GuiContainer {
GlStateManager.disableLighting();
GlStateManager.color(1, 1, 1, 1);
}
if (builder.isInRect(guiLeft - 19, guiTop + 92 - offset + 27, 12, 12, mouseX, mouseY) && getMachine().hasSlotConfig()) {
List<String> list = new ArrayList<>();
list.add("Configure Fluids");
GuiUtils.drawHoveringText(list, mouseX - guiLeft , mouseY - guiTop , width, height, -1, mc.fontRenderer);
GlStateManager.disableLighting();
GlStateManager.color(1, 1, 1, 1);
}
}
@Override
@ -212,19 +234,27 @@ public class GuiBase extends GuiContainer {
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
if(showSlotConfig && getMachine().hasSlotConfig()){
if(slotConfigType == SlotConfigType.ITEMS && getMachine().hasSlotConfig()){
if(GuiSlotConfiguration.mouseClicked(mouseX, mouseY, mouseButton, this)){
return;
}
}
if(slotConfigType == SlotConfigType.FLUIDS && getMachine().showTankConfig()){
if(GuiFluidConfiguration.mouseClicked(mouseX, mouseY, mouseButton, this)){
return;
}
}
super.mouseClicked(mouseX, mouseY, mouseButton);
}
@Override
protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
if(showSlotConfig && getMachine().hasSlotConfig()){
if(slotConfigType == SlotConfigType.ITEMS && getMachine().hasSlotConfig()){
GuiSlotConfiguration.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick, this);
}
if(slotConfigType == SlotConfigType.FLUIDS && getMachine().showTankConfig()){
GuiFluidConfiguration.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick, this);
}
super.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick);
}
@ -235,22 +265,38 @@ public class GuiBase extends GuiContainer {
offset = 80;
}
if(isPointInRegion(-26, 84 - offset, 30, 30, mouseX, mouseY) && getMachine().hasSlotConfig()){
showSlotConfig = !showSlotConfig;
if(!showSlotConfig){
if(slotConfigType != SlotConfigType.ITEMS){
slotConfigType = SlotConfigType.ITEMS;
} else {
slotConfigType = SlotConfigType.NONE;
}
if(slotConfigType == SlotConfigType.ITEMS){
GuiSlotConfiguration.reset();
}
}
if(showSlotConfig && getMachine().hasSlotConfig()){
if(isPointInRegion(-26, 84 - offset + 27, 30, 30, mouseX, mouseY) && getMachine().hasSlotConfig()){
if(slotConfigType != SlotConfigType.FLUIDS){
slotConfigType = SlotConfigType.FLUIDS;
} else {
slotConfigType = SlotConfigType.NONE;
}
}
if(slotConfigType == SlotConfigType.ITEMS && getMachine().hasSlotConfig()){
if(GuiSlotConfiguration.mouseReleased(mouseX, mouseY, state, this)){
return;
}
}
if(slotConfigType == SlotConfigType.FLUIDS && getMachine().showTankConfig()){
if(GuiFluidConfiguration.mouseReleased(mouseX, mouseY, state, this)){
return;
}
}
super.mouseReleased(mouseX, mouseY, state);
}
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
if(showSlotConfig){
if(slotConfigType == SlotConfigType.ITEMS){
if(isCtrlKeyDown() && keyCode == Keyboard.KEY_C){
GuiSlotConfiguration.copyToClipboard();
return;
@ -264,7 +310,7 @@ public class GuiBase extends GuiContainer {
@Override
public void onGuiClosed() {
showSlotConfig = false;
slotConfigType = SlotConfigType.NONE;
super.onGuiClosed();
}
@ -276,13 +322,14 @@ public class GuiBase extends GuiContainer {
return (TileLegacyMachineBase) tile;
}
//TODO
public enum SlotRender {
STANDARD, OUTPUT, NONE, SPRITE;
}
public enum Layer {
BACKGROUND, FOREGROUND
}
public enum SlotConfigType{
NONE,
ITEMS,
FLUIDS
}
}

View file

@ -52,7 +52,7 @@ public class GuiBatbox extends GuiBase {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
final Layer layer = Layer.FOREGROUND;
if(!GuiBase.showSlotConfig){
if(GuiBase.slotConfigType == SlotConfigType.NONE){
GlStateManager.pushMatrix();
GlStateManager.scale(0.6, 0.6, 5);
this.drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.tile.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.tile.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer);

View file

@ -107,7 +107,7 @@ public class GuiBlastFurnace extends GuiBase {
@Override
public void actionPerformed(final GuiButton button) throws IOException {
super.actionPerformed(button);
if (button.id == 212 && !GuiBase.showSlotConfig) {
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{
// This code here makes a basic multiblock and then sets to the selected one.

View file

@ -103,7 +103,7 @@ public class GuiDistillationTower extends GuiBase {
@Override
public void actionPerformed(final GuiButton button) throws IOException {
super.actionPerformed(button);
if (button.id == 212 && !GuiBase.showSlotConfig) {
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{
// This code here makes a basic multiblock and then sets to the selected one.

View file

@ -112,7 +112,7 @@ public class GuiFluidReplicator extends GuiBase {
@Override
public void actionPerformed(final GuiButton button) throws IOException {
super.actionPerformed(button);
if (button.id == 212 && !GuiBase.showSlotConfig) {
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{
// This code here makes a basic multiblock and then sets to the selected one.

View file

@ -122,7 +122,7 @@ public class GuiFusionReactor extends GuiBase {
@Override
public void actionPerformed(final GuiButton button) throws IOException {
super.actionPerformed(button);
if (button.id == 212 && !GuiBase.showSlotConfig) {
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
updateMultiBlockRender();
} else {

View file

@ -105,7 +105,7 @@ public class GuiImplosionCompressor extends GuiBase {
@Override
public void actionPerformed(final GuiButton button) throws IOException {
super.actionPerformed(button);
if (button.id == 212 && !GuiBase.showSlotConfig) {
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{
// This code here makes a basic multiblock and then sets to the selected one.

View file

@ -109,7 +109,7 @@ public class GuiIndustrialGrinder extends GuiBase {
@Override
public void actionPerformed(final GuiButton button) throws IOException {
super.actionPerformed(button);
if (button.id == 212 && !GuiBase.showSlotConfig) {
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{
// This code here makes a basic multiblock and then sets to the selected one.

View file

@ -108,7 +108,7 @@ public class GuiIndustrialSawmill extends GuiBase {
@Override
public void actionPerformed(final GuiButton button) throws IOException {
super.actionPerformed(button);
if (button.id == 212 && !GuiBase.showSlotConfig) {
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{
// This code here makes a basic multiblock and then sets to the selected one.

View file

@ -27,7 +27,9 @@ package techreborn.client.gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import techreborn.init.ModItems;
import techreborn.tiles.tier0.TileIronFurnace;
public class GuiIronFurnace extends GuiBase {
@ -48,7 +50,7 @@ public class GuiIronFurnace extends GuiBase {
protected void drawGuiContainerBackgroundLayer(final float p_146976_1_, final int p_146976_2_, final int p_146976_3_) {
this.drawDefaultBackground();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
builder.drawSlotTab(this, guiLeft, guiTop, p_146976_2_, p_146976_3_, upgrades);
builder.drawSlotTab(this, guiLeft, guiTop, p_146976_2_, p_146976_3_, upgrades, new ItemStack(ModItems.WRENCH));
this.mc.getTextureManager().bindTexture(GuiIronFurnace.texture);
final int k = (this.width - this.xSize) / 2;
final int l = (this.height - this.ySize) / 2;

View file

@ -53,7 +53,7 @@ public class GuiMFE extends GuiBase {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
final Layer layer = Layer.FOREGROUND;
if(!GuiBase.showSlotConfig){
if(GuiBase.slotConfigType == SlotConfigType.NONE){
GlStateManager.pushMatrix();
GlStateManager.scale(0.6, 0.6, 1);
this.drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.mfe.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) this.mfe.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer);

View file

@ -24,7 +24,6 @@
package techreborn.client.gui;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.fluids.FluidStack;
import techreborn.tiles.TileQuantumTank;
@ -52,12 +51,6 @@ public class GuiQuantumTank extends GuiBase {
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
final String name = I18n.format("tile.techreborn:quantum_tank.name");
this.fontRenderer.drawString(name, this.xSize / 2 - this.fontRenderer.getStringWidth(name) / 2, 6,
4210752);
this.fontRenderer.drawString(I18n.format("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
FluidStack fluid = this.quantumTank.tank.getFluid();
if(fluid != null){
this.fontRenderer.drawString( "Fluid Type:", 10, 20, 4210752);

View file

@ -100,7 +100,7 @@ public class GuiVacuumFreezer extends GuiBase {
@Override
public void actionPerformed(final GuiButton button) throws IOException {
super.actionPerformed(button);
if (button.id == 212 && !GuiBase.showSlotConfig) {
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{
// This code here makes a basic multiblock and then sets to the selected one.

View file

@ -62,7 +62,7 @@ public class TRBuilder extends GuiBuilder {
}
public void drawMultiEnergyBar(GuiBase gui, int x, int y, int energyStored, int maxEnergyStored, int mouseX, int mouseY, int buttonID, GuiBase.Layer layer) {
if(GuiBase.showSlotConfig){
if(GuiBase.slotConfigType != GuiBase.SlotConfigType.NONE){
return;
}
if (layer == GuiBase.Layer.BACKGROUND) {
@ -104,7 +104,7 @@ public class TRBuilder extends GuiBuilder {
}
public void drawProgressBar(GuiBase gui, int progress, int maxProgress, int x, int y, int mouseX, int mouseY, ProgressDirection direction, GuiBase.Layer layer) {
if(GuiBase.showSlotConfig){
if(GuiBase.slotConfigType != GuiBase.SlotConfigType.NONE){
return;
}
if (layer == GuiBase.Layer.BACKGROUND) {
@ -152,7 +152,7 @@ public class TRBuilder extends GuiBuilder {
}
public void drawTank(GuiBase gui, int x, int y, int mouseX, int mouseY, FluidStack fluid, int maxCapacity, boolean isTankEmpty, GuiBase.Layer layer) {
if(GuiBase.showSlotConfig){
if(GuiBase.slotConfigType != GuiBase.SlotConfigType.NONE){
return;
}
if (layer == GuiBase.Layer.BACKGROUND) {
@ -213,7 +213,7 @@ public class TRBuilder extends GuiBuilder {
}
public void drawJEIButton(GuiBase gui, int x, int y, GuiBase.Layer layer) {
if(GuiBase.showSlotConfig){
if(GuiBase.slotConfigType != GuiBase.SlotConfigType.NONE){
return;
}
if (Loader.isModLoaded("jei")) {
@ -227,7 +227,7 @@ public class TRBuilder extends GuiBuilder {
}
public void drawLockButton(GuiBase gui, int x, int y, int mouseX, int mouseY, GuiBase.Layer layer, boolean locked) {
if(GuiBase.showSlotConfig){
if(GuiBase.slotConfigType != GuiBase.SlotConfigType.NONE){
return;
}
if (layer == GuiBase.Layer.BACKGROUND) {
@ -251,7 +251,7 @@ public class TRBuilder extends GuiBuilder {
}
public void drawHologramButton(GuiBase gui, int x, int y, int mouseX, int mouseY, GuiBase.Layer layer) {
if(GuiBase.showSlotConfig){
if(GuiBase.slotConfigType != GuiBase.SlotConfigType.NONE){
return;
}
if (layer == GuiBase.Layer.BACKGROUND) {
@ -278,7 +278,7 @@ public class TRBuilder extends GuiBuilder {
}
public void drawUpDownButtons(GuiBase gui, int x, int y, GuiBase.Layer layer){
if(GuiBase.showSlotConfig){
if(GuiBase.slotConfigType != GuiBase.SlotConfigType.NONE){
return;
}
if (layer == GuiBase.Layer.BACKGROUND) {
@ -293,7 +293,7 @@ public class TRBuilder extends GuiBuilder {
}
public void drawUpDownButtonsSmall(GuiBase gui, int x, int y, GuiBase.Layer layer){
if(GuiBase.showSlotConfig){
if(GuiBase.slotConfigType != GuiBase.SlotConfigType.NONE){
return;
}
if (layer == GuiBase.Layer.BACKGROUND) {
@ -308,7 +308,7 @@ public class TRBuilder extends GuiBuilder {
}
public void drawEnergyOutput(GuiBase gui, int right, int top, int maxOutput, GuiBase.Layer layer){
if(GuiBase.showSlotConfig){
if(GuiBase.slotConfigType != GuiBase.SlotConfigType.NONE){
return;
}
String text = PowerSystem.getLocaliszedPowerFormattedNoSuffix(maxOutput) + " "
@ -325,7 +325,7 @@ public class TRBuilder extends GuiBuilder {
}
public void drawBigBlueBar(GuiBase gui, int x, int y, int value, int max, int mouseX, int mouseY, String suffix, GuiBase.Layer layer) {
if(GuiBase.showSlotConfig){
if(GuiBase.slotConfigType != GuiBase.SlotConfigType.NONE){
return;
}
if (layer == GuiBase.Layer.BACKGROUND) {
@ -360,7 +360,7 @@ public class TRBuilder extends GuiBuilder {
}
public void drawBigHeatBar(GuiBase gui, int x, int y, int value, int max, GuiBase.Layer layer) {
if(GuiBase.showSlotConfig){
if(GuiBase.slotConfigType != GuiBase.SlotConfigType.NONE){
return;
}
if (layer == GuiBase.Layer.BACKGROUND) {
@ -380,7 +380,7 @@ public class TRBuilder extends GuiBuilder {
}
public void drawMultiblockMissingBar(GuiBase gui, GuiBase.Layer layer) {
if(GuiBase.showSlotConfig){
if(GuiBase.slotConfigType != GuiBase.SlotConfigType.NONE){
return;
}
int x = 0;
@ -448,8 +448,8 @@ public class TRBuilder extends GuiBuilder {
gui.drawTexturedModalRect(posX - 27, posY + 4, 126, 151, 30, 87);
}
public void drawSlotTab(GuiScreen gui, int posX, int posY, int mouseX, int mouseY, boolean upgrades){
int offset = 0;
public void drawSlotTab(GuiScreen gui, int posX, int posY, int mouseX, int mouseY, boolean upgrades, ItemStack stack){
int offset = -1;
if(!upgrades){
offset = 80;
}

View file

@ -0,0 +1,153 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2018 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.client.gui.slot;
import com.google.common.collect.Lists;
import net.minecraft.client.Minecraft;
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.lwjgl.input.Keyboard;
import reborncore.common.tile.TileLegacyMachineBase;
import techreborn.client.gui.GuiBase;
import techreborn.client.gui.slot.elements.ConfigFluidElement;
import techreborn.client.gui.slot.elements.ElementBase;
import techreborn.client.gui.slot.elements.SlotType;
import javax.annotation.Nullable;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
public class GuiFluidConfiguration {
static ConfigFluidElement fluidConfigElement;
public static void init(GuiBase guiBase) {
fluidConfigElement = new ConfigFluidElement(guiBase.getMachine().getTank(), SlotType.NORMAL, 35 - guiBase.guiLeft + 50, 35 - guiBase.guiTop - 25, guiBase);
}
public static void draw(GuiBase guiBase, int mouseX, int mouseY) {
fluidConfigElement.draw(guiBase);
}
@SubscribeEvent
public static void keyboardEvent(GuiScreenEvent.KeyboardInputEvent event) {
if (GuiBase.slotConfigType == GuiBase.SlotConfigType.FLUIDS && Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
GuiBase.slotConfigType = GuiBase.SlotConfigType.NONE;
event.setCanceled(true);
}
}
public static List<ConfigFluidElement> getVisibleElements() {
return Collections.singletonList(fluidConfigElement);
}
public static boolean mouseClicked(int mouseX, int mouseY, int mouseButton, GuiBase guiBase) throws IOException {
if (mouseButton == 0) {
for (ConfigFluidElement configFluidElement : getVisibleElements()) {
for (ElementBase element : configFluidElement.elements) {
if (element.isInRect(guiBase, element.x, element.y, element.getWidth(guiBase.getMachine()), element.getHeight(guiBase.getMachine()), mouseX, mouseY)) {
element.isPressing = true;
boolean action = element.onStartPress(guiBase.getMachine(), guiBase, mouseX, mouseY);
for (ElementBase e : getVisibleElements()) {
if (e != element) {
e.isPressing = false;
}
}
if (action)
break;
} else {
element.isPressing = false;
}
}
}
}
return !getVisibleElements().isEmpty();
}
public static void mouseClickMove(int mouseX, int mouseY, int mouseButton, long timeSinceLastClick, GuiBase guiBase) {
if (mouseButton == 0) {
for (ConfigFluidElement configFluidElement : getVisibleElements()) {
for (ElementBase element : configFluidElement.elements) {
if (element.isInRect(guiBase, element.x, element.y, element.getWidth(guiBase.getMachine()), element.getHeight(guiBase.getMachine()), mouseX, mouseY)) {
element.isDragging = true;
boolean action = element.onDrag(guiBase.getMachine(), guiBase, mouseX, mouseY);
for (ElementBase e : getVisibleElements()) {
if (e != element) {
e.isDragging = false;
}
}
if (action)
break;
} else {
element.isDragging = false;
}
}
}
}
}
public static boolean mouseReleased(int mouseX, int mouseY, int mouseButton, GuiBase guiBase) {
boolean clicked = false;
if (mouseButton == 0) {
for (ConfigFluidElement configFluidElement : getVisibleElements()) {
if (configFluidElement.isInRect(guiBase, configFluidElement.x, configFluidElement.y, configFluidElement.getWidth(guiBase.getMachine()), configFluidElement.getHeight(guiBase.getMachine()), mouseX, mouseY)) {
clicked = true;
}
for (ElementBase element : Lists.reverse(configFluidElement.elements)) {
if (element.isInRect(guiBase, element.x, element.y, element.getWidth(guiBase.getMachine()), element.getHeight(guiBase.getMachine()), mouseX, mouseY)) {
element.isReleasing = true;
boolean action = element.onRelease(guiBase.getMachine(), guiBase, mouseX, mouseY);
for (ElementBase e : getVisibleElements()) {
if (e != element) {
e.isReleasing = false;
}
}
if (action)
clicked = true;
break;
} else {
element.isReleasing = false;
}
}
}
}
return clicked;
}
@Nullable
private static TileLegacyMachineBase getMachine() {
if (!(Minecraft.getMinecraft().currentScreen instanceof GuiBase)) {
return null;
}
GuiBase base = (GuiBase) Minecraft.getMinecraft().currentScreen;
if (!(base.tile instanceof TileLegacyMachineBase)) {
return null;
}
TileLegacyMachineBase machineBase = (TileLegacyMachineBase) base.tile;
return machineBase;
}
}

View file

@ -51,7 +51,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
public class GuiSlotConfiguration {
public class GuiSlotConfiguration {
static HashMap<Integer, ConfigSlotElement> slotElementMap = new HashMap<>();
@ -236,7 +236,7 @@ public class GuiSlotConfiguration {
}
public static List<Rectangle> getExtraSpace(GuiBase guiBase){
if(!GuiBase.showSlotConfig || slectedSlot == -1){
if(GuiBase.slotConfigType != GuiBase.SlotConfigType.ITEMS || slectedSlot == -1){
return Collections.emptyList();
}
List<Rectangle> list = new ArrayList<>();

View file

@ -27,14 +27,17 @@ package techreborn.client.gui.slot.elements;
import reborncore.common.tile.TileLegacyMachineBase;
import techreborn.client.gui.GuiBase;
import java.util.function.Predicate;
public class CheckBoxElement extends ElementBase {
public String label, type;
public int labelColor, slotID;
TileLegacyMachineBase machineBase;
public TileLegacyMachineBase machineBase;
Predicate<CheckBoxElement> ticked;
private Sprite.CheckBox checkBoxSprite;
public CheckBoxElement(String label, int labelColor, int x, int y, String type, int slotID, Sprite.CheckBox checkBoxSprite, TileLegacyMachineBase machineBase) {
public CheckBoxElement(String label, int labelColor, int x, int y, String type, int slotID, Sprite.CheckBox checkBoxSprite, TileLegacyMachineBase machineBase, Predicate<CheckBoxElement> ticked) {
super(x, y, checkBoxSprite.getNormal());
this.checkBoxSprite = checkBoxSprite;
this.type = type;
@ -42,13 +45,14 @@ public class CheckBoxElement extends ElementBase {
this.machineBase = machineBase;
this.label = label;
this.labelColor = labelColor;
if (isTicked()) {
this.ticked = ticked;
if (ticked.test(this)) {
container.setSprite(0, checkBoxSprite.getTicked());
} else {
container.setSprite(0, checkBoxSprite.getNormal());
}
this.addPressAction((element, gui, provider, mouseX, mouseY) -> {
if (isTicked()) {
if (ticked.test(this)) {
element.container.setSprite(0, checkBoxSprite.getTicked());
} else {
element.container.setSprite(0, checkBoxSprite.getNormal());
@ -61,21 +65,11 @@ public class CheckBoxElement extends ElementBase {
public void draw(GuiBase gui) {
// super.draw(gui);
ISprite sprite = checkBoxSprite.getNormal();
if(isTicked()){
if(ticked.test(this)){
sprite = checkBoxSprite.getTicked();
}
drawSprite(gui, sprite, x, y );
drawString(gui, label, x + checkBoxSprite.getNormal().width + 5, ((y + getHeight(gui.getMachine()) / 2) - (gui.mc.fontRenderer.FONT_HEIGHT / 2)), labelColor);
}
public boolean isTicked() {
if(type.equalsIgnoreCase("output")){
return machineBase.slotConfiguration.getSlotDetails(slotID).autoOutput();
}
if(type.equalsIgnoreCase("filter")){
return machineBase.slotConfiguration.getSlotDetails(slotID).filter();
}
return machineBase.slotConfiguration.getSlotDetails(slotID).autoInput();
}
}

View file

@ -0,0 +1,79 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2018 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.client.gui.slot.elements;
import reborncore.common.util.Tank;
import techreborn.client.gui.GuiBase;
import java.util.ArrayList;
import java.util.List;
public class ConfigFluidElement extends ElementBase {
SlotType type;
Tank tank;
public List<ElementBase> elements = new ArrayList<>();
boolean filter = false;
public ConfigFluidElement(Tank tank, SlotType type, int x, int y, GuiBase gui) {
super(x, y, type.getButtonSprite());
this.type = type;
this.tank = tank;
FluidConfigPopupElement popupElement;
elements.add(popupElement = new FluidConfigPopupElement(x - 22, y - 22, this));
elements.add(new ButtonElement(x + 37, y - 25, Sprite.EXIT_BUTTON).addReleaseAction((element, gui1, provider, mouseX, mouseY) -> {
GuiBase.slotConfigType = GuiBase.SlotConfigType.NONE;
return true;
}));
elements.add(new CheckBoxElement("Pull In", 0xFFFFFFFF, x - 26, y + 42, "input", 0, Sprite.LIGHT_CHECK_BOX, gui.getMachine(),
checkBoxElement -> checkBoxElement.machineBase.fluidConfiguration.autoInput()).addPressAction((element, gui12, provider, mouseX, mouseY) -> {
popupElement.updateCheckBox((CheckBoxElement) element, "input", gui12);
return true;
}));
elements.add(new CheckBoxElement("Pump Out", 0xFFFFFFFF, x - 26, y + 57, "output", 0, Sprite.LIGHT_CHECK_BOX, gui.getMachine(),
checkBoxElement -> checkBoxElement.machineBase.fluidConfiguration.autoOutput()).addPressAction((element, gui13, provider, mouseX, mouseY) -> {
popupElement.updateCheckBox((CheckBoxElement) element, "output", gui13);
return true;
}));
setWidth(85);
setHeight(105 + (filter ? 15 : 0));
}
@Override
public void draw(GuiBase gui) {
super.draw(gui);
if (isHovering) {
drawSprite(gui, type.getButtonHoverOverlay(), x, y);
}
elements.forEach(elementBase -> elementBase.draw(gui));
}
public SlotType getType() {
return type;
}
}

View file

@ -58,14 +58,17 @@ public class ConfigSlotElement extends ElementBase {
elements.add(popupElement = new SlotConfigPopupElement(this.id, x - 22, y - 22, this));
elements.add(new ButtonElement(x + 37, y - 25, Sprite.EXIT_BUTTON).addReleaseAction((element, gui1, provider, mouseX, mouseY) -> {
GuiSlotConfiguration.slectedSlot = -1;
GuiBase.slotConfigType = GuiBase.SlotConfigType.NONE;
return true;
}));
elements.add(new CheckBoxElement("Auto Input", 0xFFFFFFFF, x - 26, y + 42, "input", slotId, Sprite.LIGHT_CHECK_BOX, gui.getMachine()).addPressAction((element, gui12, provider, mouseX, mouseY) -> {
elements.add(new CheckBoxElement("Auto Input", 0xFFFFFFFF, x - 26, y + 42, "input", slotId, Sprite.LIGHT_CHECK_BOX, gui.getMachine(),
checkBoxElement -> checkBoxElement.machineBase.slotConfiguration.getSlotDetails(checkBoxElement.slotID).autoInput()).addPressAction((element, gui12, provider, mouseX, mouseY) -> {
popupElement.updateCheckBox((CheckBoxElement) element, "input", gui12);
return true;
}));
elements.add(new CheckBoxElement("Auto Output", 0xFFFFFFFF, x - 26, y + 57,"output", slotId, Sprite.LIGHT_CHECK_BOX, gui.getMachine()).addPressAction((element, gui13, provider, mouseX, mouseY) -> {
elements.add(new CheckBoxElement("Auto Output", 0xFFFFFFFF, x - 26, y + 57, "output", slotId, Sprite.LIGHT_CHECK_BOX, gui.getMachine(),
checkBoxElement -> checkBoxElement.machineBase.slotConfiguration.getSlotDetails(checkBoxElement.slotID).autoOutput()).addPressAction((element, gui13, provider, mouseX, mouseY) -> {
popupElement.updateCheckBox((CheckBoxElement) element, "output", gui13);
return true;
}));
@ -73,7 +76,8 @@ public class ConfigSlotElement extends ElementBase {
if(gui.getMachine() instanceof IRecipeCrafterProvider){
RecipeCrafter recipeCrafter = ((IRecipeCrafterProvider) gui.getMachine()).getRecipeCrafter();
if(Arrays.stream(recipeCrafter.inputSlots).anyMatch(value -> value == slotId)){
elements.add(new CheckBoxElement("Filter Input", 0xFFFFFFFF, x - 26, y + 72,"filter", slotId, Sprite.LIGHT_CHECK_BOX, gui.getMachine()).addPressAction((element, gui13, provider, mouseX, mouseY) -> {
elements.add(new CheckBoxElement("Filter Input", 0xFFFFFFFF, x - 26, y + 72, "filter", slotId, Sprite.LIGHT_CHECK_BOX, gui.getMachine(),
checkBoxElement -> checkBoxElement.machineBase.slotConfiguration.getSlotDetails(checkBoxElement.slotID).filter()).addPressAction((element, gui13, provider, mouseX, mouseY) -> {
popupElement.updateCheckBox((CheckBoxElement) element, "filter", gui13);
return true;
}));

View file

@ -0,0 +1,222 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2018 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.client.gui.slot.elements;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.BlockRendererDispatcher;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fml.client.FMLClientHandler;
import reborncore.RebornCore;
import reborncore.client.gui.GuiUtil;
import reborncore.common.network.NetworkManager;
import reborncore.common.network.packet.PacketFluidConfigSave;
import reborncore.common.network.packet.PacketFluidIOSave;
import reborncore.common.tile.FluidConfiguration;
import reborncore.common.tile.TileLegacyMachineBase;
import reborncore.common.util.MachineFacing;
import techreborn.client.gui.GuiBase;
import java.awt.*;
public class FluidConfigPopupElement extends ElementBase {
public boolean filter = false;
ConfigFluidElement fluidElement;
int lastMousex, lastMousey;
public FluidConfigPopupElement(int x, int y, ConfigFluidElement fluidElement) {
super(x, y, Sprite.SLOT_CONFIG_POPUP);
this.fluidElement = fluidElement;
}
@Override
public void draw(GuiBase gui) {
drawDefaultBackground(gui, adjustX(gui, getX() - 8), adjustY(gui, getY() - 7), 84, 105 + (filter ? 15 : 0));
super.draw(gui);
TileLegacyMachineBase machine = ((TileLegacyMachineBase) gui.tile);
IBlockAccess blockAccess = machine.getWorld();
BlockPos pos = machine.getPos();
IBlockState state = blockAccess.getBlockState(pos);
IBlockState actualState = state.getBlock().getDefaultState().getActualState(blockAccess, pos);
BlockRendererDispatcher dispatcher = FMLClientHandler.instance().getClient().getBlockRendererDispatcher();
IBakedModel model = dispatcher.getBlockModelShapes().getModelForState(state.getBlock().getDefaultState());
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
drawState(gui, blockAccess, model, actualState, pos, dispatcher, 4, 23); //left
drawState(gui, blockAccess, model, actualState, pos, dispatcher, 23, -12, -90F, 1F, 0F, 0F); //top
drawState(gui, blockAccess, model, actualState, pos, dispatcher, 23, 23, -90F, 0F, 1F, 0F); //centre
drawState(gui, blockAccess, model, actualState, pos, dispatcher, 23, 42, 90F, 1F, 0F, 0F); //bottom
drawState(gui, blockAccess, model, actualState, pos, dispatcher, 26, 23, 180F, 0F, 1F, 0F); //right
drawState(gui, blockAccess, model, actualState, pos, dispatcher, 26, 42, 90F, 0F, 1F, 0F); //back
drawSateColor(gui.getMachine(), MachineFacing.UP.getFacing(machine), 22, -1, gui);
drawSateColor(gui.getMachine(), MachineFacing.FRONT.getFacing(machine), 22, 18, gui);
drawSateColor(gui.getMachine(), MachineFacing.DOWN.getFacing(machine), 22, 37, gui);
drawSateColor(gui.getMachine(), MachineFacing.RIGHT.getFacing(machine), 41, 18, gui);
drawSateColor(gui.getMachine(), MachineFacing.BACK.getFacing(machine), 41, 37, gui);
drawSateColor(gui.getMachine(), MachineFacing.LEFT.getFacing(machine), 3, 18, gui);
}
@Override
public boolean onRelease(TileLegacyMachineBase provider, GuiBase gui, int mouseX, int mouseY) {
if (isInBox(23, 4, 16, 16, mouseX, mouseY, gui)) {
cyleConfig(MachineFacing.UP.getFacing(provider), gui);
} else if (isInBox(23, 23, 16, 16, mouseX, mouseY, gui)) {
cyleConfig(MachineFacing.FRONT.getFacing(provider), gui);
} else if (isInBox(42, 23, 16, 16, mouseX, mouseY, gui)) {
cyleConfig(MachineFacing.RIGHT.getFacing(provider), gui);
} else if (isInBox(4, 23, 16, 16, mouseX, mouseY, gui)) {
cyleConfig(MachineFacing.LEFT.getFacing(provider), gui);
} else if (isInBox(23, 42, 16, 16, mouseX, mouseY, gui)) {
cyleConfig(MachineFacing.DOWN.getFacing(provider), gui);
} else if (isInBox(42, 42, 16, 16, mouseX, mouseY, gui)) {
cyleConfig(MachineFacing.BACK.getFacing(provider), gui);
} else {
return false;
}
return true;
}
public void cyleConfig(EnumFacing side, GuiBase guiBase) {
FluidConfiguration.FluidConfig config = guiBase.getMachine().fluidConfiguration.getSideDetail(side);
FluidConfiguration.ExtractConfig fluidIO = config.getIoConfig().getNext();
FluidConfiguration.FluidConfig newConfig = new FluidConfiguration.FluidConfig(side, fluidIO);
PacketFluidConfigSave packetSave = new PacketFluidConfigSave(guiBase.tile.getPos(), newConfig);
NetworkManager.sendToServer(packetSave);
}
public void updateCheckBox(CheckBoxElement checkBoxElement, String type, GuiBase guiBase) {
FluidConfiguration configHolder = guiBase.getMachine().fluidConfiguration;
boolean input = configHolder.autoInput();
boolean output = configHolder.autoOutput();
if (type.equalsIgnoreCase("input")) {
input = !configHolder.autoInput();
}
if (type.equalsIgnoreCase("output")) {
output = !configHolder.autoOutput();
}
PacketFluidIOSave packetFluidIOSave = new PacketFluidIOSave(guiBase.tile.getPos(), input, output);
NetworkManager.sendToServer(packetFluidIOSave);
}
@Override
public boolean onHover(TileLegacyMachineBase provider, GuiBase gui, int mouseX, int mouseY) {
lastMousex = mouseX;
lastMousey = mouseY;
return super.onHover(provider, gui, mouseX, mouseY);
}
private void drawSateColor(TileLegacyMachineBase machineBase, EnumFacing side, int inx, int iny, GuiBase gui) {
iny += 4;
int sx = inx + getX() + gui.guiLeft;
int sy = iny + getY() + gui.guiTop;
FluidConfiguration fluidConfiguration = machineBase.fluidConfiguration;
if (fluidConfiguration == null) {
RebornCore.logHelper.debug("Humm, this isnt suppoed to happen");
return;
}
FluidConfiguration.FluidConfig fluidConfig = fluidConfiguration.getSideDetail(side);
Color color;
switch (fluidConfig.getIoConfig()) {
case NONE:
color = new Color(0, 0, 0, 0);
break;
case INPUT:
color = new Color(0, 0, 255, 128);
break;
case OUTPUT:
color = new Color(255, 69, 0, 128);
break;
case ALL:
color = new Color(52, 255, 30, 128);
break;
default:
color = new Color(0, 0, 0, 0);
break;
}
GlStateManager.color(255, 255, 255);
GuiUtil.drawGradientRect(sx, sy, 18, 18, color.getRGB(), color.getRGB());
GlStateManager.color(255, 255, 255);
}
private boolean isInBox(int rectX, int rectY, int rectWidth, int rectHeight, int pointX, int pointY, GuiBase guiBase) {
rectX += getX();
rectY += getY();
return isInRect(guiBase, rectX, rectY, rectWidth, rectHeight, pointX, pointY);
//return (pointX - guiBase.getGuiLeft()) >= rectX - 1 && (pointX - guiBase.getGuiLeft()) < rectX + rectWidth + 1 && (pointY - guiBase.getGuiTop()) >= rectY - 1 && (pointY - guiBase.getGuiTop()) < rectY + rectHeight + 1;
}
public void drawState(GuiBase gui,
IBlockAccess blockAccess,
IBakedModel model,
IBlockState actualState,
BlockPos pos,
BlockRendererDispatcher dispatcher,
int x,
int y,
float rotAngle,
float rotX,
float rotY,
float rotZ) {
GlStateManager.pushMatrix();
GlStateManager.enableDepth();
GlStateManager.translate(8 + gui.guiLeft + this.x + x, 8 + gui.guiTop + this.y + y, 512);
GlStateManager.scale(16F, 16F, 16F);
GlStateManager.translate(0.5F, 0.5F, 0.5F);
GlStateManager.scale(-1, -1, -1);
if (rotAngle != 0) {
GlStateManager.rotate(rotAngle, rotX, rotY, rotZ);
}
dispatcher.getBlockModelRenderer().renderModelBrightness(model, actualState, 1F, false);
GlStateManager.disableDepth();
GlStateManager.popMatrix();
/* GlStateManager.pushMatrix();
GlStateManager.enableDepth();
// GlStateManager.translate(8 + gui.xFactor + this.x + x, 8 + gui.yFactor + this.y + y, 1000);
GlStateManager.translate(gui.xFactor + this.x + x, gui.yFactor + this.y + y, 512);
if (rotAngle != 0) {
GlStateManager.rotate(rotAngle, rotX, rotY, rotZ);
}
GlStateManager.scale(16F, 16F, 16F);
GlStateManager.translate(-0.5F, -0.5F, -0.5F);
GlStateManager.scale(-1, -1, -1);
GlStateManager.disableDepth();
GlStateManager.popMatrix();*/
}
public void drawState(GuiBase gui, IBlockAccess blockAccess, IBakedModel model, IBlockState actualState, BlockPos pos, BlockRendererDispatcher dispatcher, int x, int y) {
drawState(gui, blockAccess, model, actualState, pos, dispatcher, x, y, 0, 0, 0, 0);
}
}

View file

@ -120,5 +120,12 @@ public class ConfigTechReborn {
@ConfigRegistry(config = "generators", category = "solarPanelQuantum", key = "quantumNightRate", comment = "Generation rate during night for Quantum Solar Panel (Value in EU)")
public static int quantumGenerationRateN = 64;
@ConfigRegistry(config = "world", category = "loot", key = "enableOverworldLoot", comment = "When true TechReborn will add ingots, machine frames and circuits to OverWorld loot chests.")
public static boolean enableOverworldLoot = true;
@ConfigRegistry(config = "world", category = "loot", key = "enableNetherLoot", comment = "When true TechReborn will add ingots, machine frames and circuits to Nether loot chests.")
public static boolean enableNetherLoot = true;
@ConfigRegistry(config = "world", category = "loot", key = "enableEndLoot", comment = "When true TechReborn will add ingots, machine frames and circuits to The End loot chests.")
public static boolean enableEndLoot = true;
}

View file

@ -31,13 +31,24 @@ import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import reborncore.common.explosion.RebornExplosion;
import reborncore.common.registration.RebornRegistry;
import reborncore.common.registration.impl.ConfigRegistry;
import techreborn.lib.ModInfo;
/**
* Created by Mark on 13/03/2016.
*/
@RebornRegistry(modID = ModInfo.MOD_ID)
public class EntityNukePrimed extends EntityTNTPrimed {
public int fuse = 400;
@ConfigRegistry(config = "misc", category = "nuke", key = "fuse", comment = "Nuke fuse time (ticks)")
public static int fuse = 400;
@ConfigRegistry(config = "misc", category = "nuke", key = "radius", comment = "Nuke explision radius")
public static int radius = 40;
@ConfigRegistry(config = "misc", category = "nuke", key = "enabled", comment = "Should the nuke explode, set to false to prevent block damage")
public static boolean enabled = true;
public EntityNukePrimed(World world) {
super(world);
@ -76,8 +87,11 @@ public class EntityNukePrimed extends EntityTNTPrimed {
}
public void explodeNuke() {
if(!enabled){
return;
}
RebornExplosion nukeExplosion = new RebornExplosion(new BlockPos(this.posX, this.posY, this.posZ), world,
40);
radius);
nukeExplosion.setLivingBase(getTntPlacedBy());
nukeExplosion.explode();
}

View file

@ -46,6 +46,7 @@ import techreborn.Core;
public class StackToolTipEvent {
@SuppressWarnings("deprecation")
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void handleItemTooltipEvent(ItemTooltipEvent event) {

View file

@ -60,7 +60,9 @@ public class ModBlocks {
public static Block THERMAL_GENERATOR;
public static Block QUANTUM_TANK;
public static Block CREATIVE_QUANTUM_TANK;
public static Block QUANTUM_CHEST;
public static Block CREATIVE_QUANTUM_CHEST;
public static Block DIGITAL_CHEST;
public static Block INDUSTRIAL_CENTRIFUGE;
public static Block ROLLING_MACHINE;
@ -151,9 +153,15 @@ public class ModBlocks {
QUANTUM_TANK = new BlockQuantumTank();
registerBlock(QUANTUM_TANK, ItemBlockQuantumTank.class, "quantum_tank");
CREATIVE_QUANTUM_TANK = new BlockCreativeQuantumTank();
registerBlock(CREATIVE_QUANTUM_TANK, ItemBlockQuantumTank.class, "creative_quantum_tank");
QUANTUM_CHEST = new BlockQuantumChest();
registerBlock(QUANTUM_CHEST, ItemBlockQuantumChest.class, "quantum_chest");
CREATIVE_QUANTUM_CHEST = new BlockCreativeQuantumChest();
registerBlock(CREATIVE_QUANTUM_CHEST, ItemBlockQuantumChest.class, "creative_quantum_chest");
DIGITAL_CHEST = new BlockDigitalChest();
registerBlock(DIGITAL_CHEST, ItemBlockDigitalChest.class, "digital_chest");
@ -393,7 +401,7 @@ public class ModBlocks {
*/
public static void registerBlock(Block block, String name) {
name = name.toLowerCase();
block.setTranslationKey(ModInfo.MOD_ID + ":" + name);
block.setTranslationKey(ModInfo.MOD_ID + "." + name);
RebornRegistry.registerBlock(block, new ResourceLocation(ModInfo.MOD_ID, name));
}
@ -405,19 +413,19 @@ public class ModBlocks {
*/
public static void registerBlock(Block block, Class<? extends ItemBlock> itemclass, String name) {
name = name.toLowerCase();
block.setTranslationKey(ModInfo.MOD_ID + ":" + name);
block.setTranslationKey(ModInfo.MOD_ID + "." + name);
RebornRegistry.registerBlock(block, itemclass, new ResourceLocation(ModInfo.MOD_ID, name));
}
public static void registerBlock(Block block, ItemBlock itemBlock, String name) {
name = name.toLowerCase();
block.setTranslationKey(ModInfo.MOD_ID + ":" + name);
block.setTranslationKey(ModInfo.MOD_ID + "." + name);
RebornRegistry.registerBlock(block, itemBlock, new ResourceLocation(ModInfo.MOD_ID, name));
}
public static void registerBlockNoItem(Block block, String name) {
name = name.toLowerCase();
block.setTranslationKey(ModInfo.MOD_ID + ":" + name);
block.setTranslationKey(ModInfo.MOD_ID + "." + name);
RebornRegistry.registerBlockNoItem(block, new ResourceLocation(ModInfo.MOD_ID, name));
}

View file

@ -30,6 +30,7 @@ import net.minecraft.world.storage.loot.conditions.LootCondition;
import net.minecraftforge.event.LootTableLoadEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import techreborn.Core;
import techreborn.config.ConfigTechReborn;
import techreborn.lib.ModInfo;
import java.util.ArrayList;
@ -40,18 +41,24 @@ public class ModLoot {
public static List<ResourceLocation> lootTables = new ArrayList<ResourceLocation>();
public static void init() {
lootTables.add(new ResourceLocation(ModInfo.MOD_ID, "chests/abandoned_mineshaft"));
lootTables.add(new ResourceLocation(ModInfo.MOD_ID, "chests/desert_pyramid"));
lootTables.add(new ResourceLocation(ModInfo.MOD_ID, "chests/end_city_treasure"));
lootTables.add(new ResourceLocation(ModInfo.MOD_ID, "chests/igloo_chest"));
lootTables.add(new ResourceLocation(ModInfo.MOD_ID, "chests/jungle_temple"));
lootTables.add(new ResourceLocation(ModInfo.MOD_ID, "chests/nether_bridge"));
lootTables.add(new ResourceLocation(ModInfo.MOD_ID, "chests/simple_dungeon"));
lootTables.add(new ResourceLocation(ModInfo.MOD_ID, "chests/stronghold_corridor"));
lootTables.add(new ResourceLocation(ModInfo.MOD_ID, "chests/stronghold_crossing"));
lootTables.add(new ResourceLocation(ModInfo.MOD_ID, "chests/stronghold_library"));
lootTables.add(new ResourceLocation(ModInfo.MOD_ID, "chests/village_blacksmith"));
lootTables.add(new ResourceLocation(ModInfo.MOD_ID, "chests/woodland_mansion"));
if (ConfigTechReborn.enableOverworldLoot) {
lootTables.add(new ResourceLocation(ModInfo.MOD_ID, "chests/abandoned_mineshaft"));
lootTables.add(new ResourceLocation(ModInfo.MOD_ID, "chests/desert_pyramid"));
lootTables.add(new ResourceLocation(ModInfo.MOD_ID, "chests/igloo_chest"));
lootTables.add(new ResourceLocation(ModInfo.MOD_ID, "chests/jungle_temple"));
lootTables.add(new ResourceLocation(ModInfo.MOD_ID, "chests/simple_dungeon"));
lootTables.add(new ResourceLocation(ModInfo.MOD_ID, "chests/stronghold_corridor"));
lootTables.add(new ResourceLocation(ModInfo.MOD_ID, "chests/stronghold_crossing"));
lootTables.add(new ResourceLocation(ModInfo.MOD_ID, "chests/stronghold_library"));
lootTables.add(new ResourceLocation(ModInfo.MOD_ID, "chests/village_blacksmith"));
lootTables.add(new ResourceLocation(ModInfo.MOD_ID, "chests/woodland_mansion"));
}
if (ConfigTechReborn.enableNetherLoot) {
lootTables.add(new ResourceLocation(ModInfo.MOD_ID, "chests/nether_bridge"));
}
if (ConfigTechReborn.enableEndLoot) {
lootTables.add(new ResourceLocation(ModInfo.MOD_ID, "chests/end_city_treasure"));
}
for (ResourceLocation lootTable : lootTables) {
LootTableList.register(lootTable);

View file

@ -93,6 +93,8 @@ public enum ModTileEntities {
ELECTRIC_FURNACE(TileElectricFurnace.class, "electric_furnace"),
SOLAR_PANEL(TileSolarPanel.class, "solar_panel"),
CREATIVE_SOLAR_PANEL(TileCreativeSolarPanel.class, "creative_solar_panel"),
CREATIVE_QUANTUM_TANK(TileCreativeQuantumTank.class, "creative_quantum_tank"),
CREATIVE_QUANTUM_CHEST(TileCreativeQuantumChest.class, "creative_quantum_chest"),
WATER_MILL(TileWaterMill.class, "water_mill"),
WIND_MILL(TileWindMill.class, "wind_mill"),
MACHINE_BASE(TileLegacyMachineBase.class, "machine_base"),

View file

@ -58,9 +58,9 @@ public class CraftingTableRecipes extends RecipeMethods {
registerShaped(getStack(ModBlocks.REINFORCED_GLASS, 7), "GAG", "GGG", "GAG", 'A', "plateAdvancedAlloy", 'G', "blockGlass");
registerShaped(getStack(ModBlocks.REINFORCED_GLASS, 7), "GGG", "AGA", "GGG", 'A', "plateAdvancedAlloy", 'G', "blockGlass");
// registerShaped(getMaterial("iridium_alloy", Type.INGOT), "IAI", "ADA", "IAI", 'I', "ingotIridium", 'D', "dustDiamond", 'A', "plateAdvancedAlloy");
// Tools and devices
registerShaped(getStack(TRItems.WRENCH), "BNB", "NBN", " B ", 'B', "ingotBronze", 'N', "nuggetBronze");
registerShaped(getStack(TRItems.WRENCH), "BNB", "NBN", " B ", 'B', "ingotBronze", 'N', "nuggetBronze");
registerShaped(getStack(TRItems.TREE_TAP), " S ", "PPP", "P ", 'S', "stickWood", 'P', "plankWood");
registerShaped(getStack(TRItems.ELECTRIC_TREE_TAP), "TB", " ", 'T', getStack(TRItems.TREE_TAP), 'B', "reBattery");
registerShaped(getStack(TRItems.NANOSABER), "DC ", "DC ", "GLG", 'L', "lapotronCrystal", 'C', "plateCarbon", 'D', "plateDiamond", 'G', "dustsmallGlowstone");
@ -80,13 +80,13 @@ public class CraftingTableRecipes extends RecipeMethods {
registerShaped(getStack(TRItems.LAPOTRONIC_ORB_PACK), "FOF", "SPS", "FIF", 'F', "circuitMaster", 'O', getStack(TRItems.LAPOTRONIC_ORB), 'S', "craftingSuperconductor", 'I', "ingotIridium", 'P', getStack(TRItems.LITHIUM_BATTERY_PACK));
registerShaped(getStack(TRItems.RE_BATTERY), " W ", "TRT", "TRT", 'T', "ingotTin", 'R', "dustRedstone", 'W', EnumCableType.ICOPPER.getStack());
registerShaped(getStack(TRItems.LITHIUM_BATTERY), " C ", "PFP", "PFP", 'F', getCell("lithium"), 'P', "plateAluminum", 'C', EnumCableType.IGOLD.getStack());
registerShaped(getStack(TRItems.LITHIUM_BATTERY_PACK), "BCB", "BPB", "B B", 'B', getStack(TRItems.LITHIUM_BATTERY), 'P', "plateAluminum", 'C', "circuitAdvanced");
registerShaped(getStack(TRItems.LITHIUM_BATTERY_PACK), "BCB", "BPB", "B B", 'B', getStack(TRItems.LITHIUM_BATTERY), 'P', "plateAluminum", 'C', "circuitAdvanced");
registerShaped(getStack(TRItems.ENERGY_CRYSTAL), "RRR", "RDR", "RRR", 'R', "dustRedstone", 'D', "gemDiamond");
registerShaped(getStack(TRItems.LAPOTRONIC_CRYSTAL), "LCL", "LEL", "LCL", 'L', "dyeBlue", 'E', "energyCrystal", 'C', "circuitBasic");
registerShaped(getStack(TRItems.LAPOTRONIC_ORB), "LLL", "LPL", "LLL", 'L', "lapotronCrystal", 'P', "plateIridiumAlloy");
registerShaped(getStack(TRItems.SCRAP_BOX), "SSS", "SSS", "SSS", 'S', TRIngredients.Parts.SCRAP.getStack());
registerShapeless(getStack(TRItems.FREQUENCY_TRANSMITTER), EnumCableType.ICOPPER.getStack(), "circuitBasic");
if (ConfigTechReborn.enableGemArmorAndTools) {
addToolAndArmourRecipes(getStack(TRItems.RUBY_SWORD), getStack(TRItems.RUBY_PICKAXE), getStack(TRItems.RUBY_AXE), getStack(TRItems.RUBY_HOE), getStack(TRItems.RUBY_SPADE), getStack(TRItems.RUBY_HELMET), getStack(TRItems.RUBY_CHESTPLATE), getStack(TRItems.RUBY_LEGGINGS), getStack(TRItems.RUBY_BOOTS), "gemRuby");
addToolAndArmourRecipes(getStack(TRItems.SAPPHIRE_SWORD), getStack(TRItems.SAPPHIRE_PICKAXE), getStack(TRItems.SAPPHIRE_AXE), getStack(TRItems.SAPPHIRE_HOE), getStack(TRItems.SAPPHIRE_SPADE), getStack(TRItems.SAPPHIRE_HELMET), getStack(TRItems.SAPPHIRE_CHSTPLATE), getStack(TRItems.SAPPHIRE_LEGGINGS), getStack(TRItems.SAPPHIRE_BOOTS), "gemSapphire");
@ -122,7 +122,7 @@ public class CraftingTableRecipes extends RecipeMethods {
registerShaped(getStack(ModBlocks.INDUSTRIAL_BLAST_FURNACE), "CHC", "HBH", "FHF", 'H', getMaterial("cupronickelHeatingCoil", Type.PART), 'C', "circuitAdvanced", 'B', "machineBlockAdvanced", 'F', getStack(ModBlocks.ELECTRIC_FURNACE));
registerShaped(getStack(ModBlocks.INDUSTRIAL_GRINDER), "ECG", "HHH", "CBC", 'E', getStack(ModBlocks.INDUSTRIAL_ELECTROLYZER), 'H', "craftingDiamondGrinder", 'C', "circuitAdvanced", 'B', "machineBlockAdvanced", 'G', getStack(ModBlocks.GRINDER));
// registerShaped(getStack(ModBlocks.IMPLOSION_COMPRESSOR), "ABA", "CPC", "ABA", 'A', getMaterialObject("advancedAlloy", Type.INGOT), 'C', "circuitAdvanced", 'B', "machineBlockAdvanced", 'P', getStack(ModBlocks.COMPRESSOR));
registerShaped(getStack(ModBlocks.VACUUM_FREEZER), "SPS", "CGC", "SPS", 'S', "plateSteel", 'C', "circuitAdvanced", 'G', "glassReinforced", 'P', getStack(ModBlocks.EXTRACTOR));
registerShaped(getStack(ModBlocks.VACUUM_FREEZER), "SPS", "CGC", "SPS", 'S', "plateSteel", 'C', "circuitAdvanced", 'G', "glassReinforced", 'P', getStack(ModBlocks.EXTRACTOR));
registerShaped(getStack(ModBlocks.DISTILLATION_TOWER), "CMC", "PBP", "EME", 'E', getStack(ModBlocks.INDUSTRIAL_ELECTROLYZER), 'M', "circuitMaster", 'B', "machineBlockElite", 'C', getStack(ModBlocks.INDUSTRIAL_CENTRIFUGE), 'P', getStack(ModBlocks.EXTRACTOR));
registerShaped(getStack(ModBlocks.CHEMICAL_REACTOR), "IMI", "CPC", "IEI", 'I', "plateInvar", 'C', "circuitAdvanced", 'M', getStack(ModBlocks.EXTRACTOR), 'P', getStack(ModBlocks.COMPRESSOR), 'E', getStack(ModBlocks.EXTRACTOR));
registerShaped(getStack(ModBlocks.ROLLING_MACHINE), "PCP", "MBM", "PCP", 'P', getStack(Blocks.PISTON), 'C', "circuitAdvanced", 'M', getStack(ModBlocks.COMPRESSOR), 'B', "machineBlockBasic");
@ -177,15 +177,15 @@ public class CraftingTableRecipes extends RecipeMethods {
registerShaped(getMaterial("machine", Type.MACHINE_FRAME), "AAA", "A A", "AAA", 'A', "ingotRefinedIron");
registerShaped(getMaterial("advanced_machine", Type.MACHINE_FRAME), " C ", "AMA", " C ", 'A', "plateAdvancedAlloy", 'C', "plateCarbon", 'M', "machineBlockBasic");
registerShaped(getMaterial("highly_advanced_machine", Type.MACHINE_FRAME), "CTC", "TBT", "CTC", 'C', "plateChrome", 'T', "plateTitanium", 'B', "machineBlockAdvanced");
// Multiblock casings
registerShaped(getMaterial("standard", 4, Type.MACHINE_CASING), "RRR", "CAC", "RRR", 'R', "ingotRefinedIron", 'C', "circuitBasic", 'A', "machineBlockBasic");
registerShaped(getMaterial("standard", 4, Type.MACHINE_CASING), "RRR", "CAC", "RRR", 'R', "plateIron", 'C', "circuitBasic", 'A', "machineBlockBasic");
registerShaped(getMaterial("standard", 4, Type.MACHINE_CASING), "RRR", "CAC", "RRR", 'R', "plateAluminum", 'C', "circuitBasic", 'A', "machineBlockBasic");
registerShaped(getMaterial("standard", 4, Type.MACHINE_CASING), "RRR", "CAC", "RRR", 'R', "plateAluminum", 'C', "circuitBasic", 'A', "machineBlockBasic");
registerShaped(getMaterial("reinforced", 4, Type.MACHINE_CASING), "RRR", "CAC", "RRR", 'R', "plateSteel", 'C', "circuitAdvanced", 'A', "machineBlockAdvanced");
registerShaped(getMaterial("reinforced", 1, Type.MACHINE_CASING), "RRR", "CAC", "RRR", 'R', "plateSteel", 'C', "circuitAdvanced", 'A', getMaterial("standard", Type.MACHINE_CASING));
registerShaped(getMaterial("advanced", 4, Type.MACHINE_CASING), "RRR", "CAC", "RRR", 'R', "plateChrome", 'C', "circuitElite", 'A', "machineBlockElite");
registerShaped(getMaterial("advanced", 1, Type.MACHINE_CASING), "RRR", "CAC", "RRR", 'R', "plateChrome", 'C', "circuitElite", 'A', getMaterial("reinforced", Type.MACHINE_CASING));
registerShaped(getMaterial("advanced", 1, Type.MACHINE_CASING), "RRR", "CAC", "RRR", 'R', "plateChrome", 'C', "circuitElite", 'A', getMaterial("reinforced", Type.MACHINE_CASING));
// Parts
// registerShaped(getMaterial("data_storage_circuit", Type.PART), "RGR", "LCL", "EEE", 'R', "dustRedstone", 'G', "dustGlowstone", 'L', "gemLapis", 'C', "circuitBasic", 'E', "plateEmerald");
@ -193,7 +193,7 @@ public class CraftingTableRecipes extends RecipeMethods {
// registerShaped(getMaterial("energy_flow_circuit", 4, Type.PART), "ATA", "LIL", "ATA", 'T', "ingotTungsten", 'I', "plateIridiumAlloy", 'A', "circuitAdvanced", 'L', "lapotronCrystal");
// registerShaped(getMaterial("data_orb", Type.PART), "DDD", "DSD", "DDD", 'D', "circuitStorage", 'S', "circuitElite");
// registerShaped(getMaterial("diamond_saw_blade", 4, Type.PART), "DSD", "S S", "DSD", 'D', "dustDiamond", 'S', "ingotSteel");
// registerShaped(getMaterial("diamond_grinding_head", 2, Type.PART), "DSD", "SGS", "DSD", 'S', "ingotSteel", 'D', "dustDiamond", 'G', "gemDiamond");
// registerShaped(getMaterial("diamond_grinding_head", 2, Type.PART), "DSD", "SGS", "DSD", 'S', "ingotSteel", 'D', "dustDiamond", 'G', "gemDiamond");
// registerShaped(getMaterial("tungsten_grinding_head", 2, Type.PART), "TST", "SBS", "TST", 'S', "ingotSteel", 'T', "ingotTungsten", 'B', "blockSteel");
// registerShaped(getMaterial("computer_monitor", Type.PART), "ADA", "DGD", "ADA", 'D', "dye", 'A', "ingotAluminum", 'G', "paneGlass");
// registerShaped(getMaterial("coolant_simple", 2, Type.PART), " T ", "TWT", " T ", 'T', "ingotTin", 'W', getStack(Items.WATER_BUCKET));
@ -214,7 +214,7 @@ public class CraftingTableRecipes extends RecipeMethods {
// registerShaped(getMaterial("carbon_fiber", Type.PART), "CCC", "C C", "CCC", 'C', getCell("carbon"));
// registerShapeless(getMaterial("carbon_mesh", Type.PART), getMaterial("carbon_fiber", Type.PART), getMaterial("carbon_fiber", Type.PART));
// registerShaped(getMaterial("electronic_circuit", Type.PART), "WWW", "SRS", "WWW", 'R', "ingotRefinedIron", 'S', Items.REDSTONE, 'W', EnumCableType.ICOPPER.getStack());
// registerShaped(getMaterial("advanced_circuit", Type.PART), "RGR", "LCL", "RGR", 'R', "dustRedstone", 'G', "dustGlowstone", 'L', "gemLapis", 'C', "circuitBasic");
// registerShaped(getMaterial("advanced_circuit", Type.PART), "RGR", "LCL", "RGR", 'R', "dustRedstone", 'G', "dustGlowstone", 'L', "gemLapis", 'C', "circuitBasic");
// Cables
registerShaped(getMaterial("copper", 6, Type.CABLE), "CCC", 'C', "ingotCopper");

View file

@ -49,10 +49,11 @@ public class IndustrialGrinderRecipes extends RecipeMethods {
if (oresExist("dustSmallThorium")) {
register(getOre("oreCoal"), WATER, 100, 64, getStack(Items.COAL, 2), getOre("dustSmallThorium"));
} else {
register(getOre("oreCoal"), WATER, 100, 64, getStack(Items.COAL, 2));
register(getOre("oreCoal"), WATER, 100, 64, getStack(Items.COAL, 3));
register(getOre("oreCoal"), MERCURY, 100, 64, getStack(Items.COAL, 4));
}
// TODO: Fix recipe
// TODO: Fix recipe
// register(getOre("oreIron"), WATER, 100, 64, getMaterial("iron", 2, Type.DUST), getMaterial("tin", Type.SMALL_DUST), getMaterial("nickel", 1, Type.DUST));
// register(getOre("oreGold"), WATER, 100, 64, getMaterial("gold", 2, Type.DUST), getMaterial("copper", Type.SMALL_DUST), getMaterial("nickel", Type.SMALL_DUST));
@ -64,7 +65,7 @@ public class IndustrialGrinderRecipes extends RecipeMethods {
// register(getOre("oreRedstone"), WATER, 100, 64, getStack(Items.REDSTONE, 10), getMaterial("glowstone", 2, Type.SMALL_DUST));
// register(getOre("oreDiamond"), WATER, 100, 64, getStack(Items.DIAMOND), getMaterial("diamond", 6, Type.SMALL_DUST), getMaterial("coal", Type.DUST));
//
// register(getOre("oreEmerald"), WATER, 100, 64, getStack(Items.EMERALD), getMaterial("emerald", 6, Type.SMALL_DUST));
//TR ores

View file

@ -43,6 +43,7 @@ import techreborn.config.ConfigTechReborn;
import techreborn.init.TRItems;
import javax.annotation.Nullable;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
@ -61,6 +62,9 @@ public class ItemAdvancedDrill extends ItemDrill {
return new HashSet<BlockPos>();
}
RayTraceResult raytrace = rayTrace(worldIn, playerIn, false);
if(raytrace == null || raytrace.sideHit == null){
return Collections.emptySet();
}
EnumFacing enumfacing = raytrace.sideHit;
if (enumfacing == EnumFacing.SOUTH || enumfacing == EnumFacing.NORTH) {
for (int i = -1; i < 2; i++) {

View file

@ -110,7 +110,9 @@ public class ItemRockCutter extends ItemPickaxe implements IEnergyItemInfo {
@Override
public void onCreated(ItemStack stack, World worldIn, EntityPlayer playerIn) {
stack.addEnchantment(Enchantments.SILK_TOUCH, 1);
if (!stack.isItemEnchanted()) {
stack.addEnchantment(Enchantments.SILK_TOUCH, 1);
}
}
@Override

View file

@ -46,6 +46,7 @@ import techreborn.client.ClientEventHandler;
import techreborn.client.IconSupplier;
import techreborn.client.RegisterItemJsons;
import techreborn.client.gui.GuiBase;
import techreborn.client.gui.slot.GuiFluidConfiguration;
import techreborn.client.gui.slot.GuiSlotConfiguration;
import techreborn.client.keybindings.KeyBindings;
import techreborn.client.render.ModelDynamicCell;
@ -80,6 +81,7 @@ public class ClientProxy extends CommonProxy {
MinecraftForge.EVENT_BUS.register(new StackToolTipEvent());
multiblockRenderEvent = new MultiblockRenderEvent();
MinecraftForge.EVENT_BUS.register(GuiSlotConfiguration.class);
MinecraftForge.EVENT_BUS.register(GuiFluidConfiguration.class);
MinecraftForge.EVENT_BUS.register(multiblockRenderEvent);
// TODO FIX ME
ClientRegistry.registerKeyBinding(KeyBindings.config);

View file

@ -0,0 +1,47 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2018 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;
import net.minecraft.item.ItemStack;
public class TileCreativeQuantumChest extends TileQuantumChest {
@Override
public void update() {
super.update();
ItemStack stack = getStackInSlot(1);
if (!stack.isEmpty() && storedItem.isEmpty()) {
stack.setCount(stack.getMaxStackSize());
storedItem = stack.copy();
}
storedItem.setCount(maxCapacity - storedItem.getMaxStackSize());
}
@Override
public int slotTransferSpeed() {
return 1;
}
}

View file

@ -0,0 +1,46 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2018 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;
public class TileCreativeQuantumTank extends TileQuantumTank {
@Override
public void update() {
super.update();
if (!tank.isEmpty() && !tank.isFull()) {
tank.setFluidAmount(Integer.MAX_VALUE);
}
}
@Override
public int slotTransferSpeed() {
return 1;
}
@Override
public int fluidTransferAmount() {
return 10000;
}
}

View file

@ -32,12 +32,10 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidBlock;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.registration.RebornRegistry;
@ -45,6 +43,7 @@ import reborncore.common.registration.impl.ConfigRegistry;
import reborncore.common.util.Tank;
import techreborn.lib.ModInfo;
import javax.annotation.Nullable;
import java.util.List;
/**
@ -161,19 +160,9 @@ public class TilePump extends TilePowerAcceptor {
return tagCompound;
}
@Nullable
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
return true;
}
return super.hasCapability(capability, facing);
}
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(tank);
}
return super.getCapability(capability, facing);
public Tank getTank() {
return tank;
}
}

View file

@ -29,9 +29,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import reborncore.api.IListInfoProvider;
import reborncore.api.IToolDrop;
import reborncore.api.tile.IInventoryProvider;
@ -47,6 +44,7 @@ import techreborn.client.container.builder.ContainerBuilder;
import techreborn.init.ModBlocks;
import techreborn.lib.ModInfo;
import javax.annotation.Nullable;
import java.util.List;
@RebornRegistry(modID = ModInfo.MOD_ID)
@ -113,22 +111,6 @@ public class TileQuantumTank extends TileLegacyMachineBase
readFromNBT(packet.getNbtCompound());
}
@Override
public boolean hasCapability(final Capability<?> capability, final EnumFacing facing) {
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
return true;
}
return super.hasCapability(capability, facing);
}
@Override
public <T> T getCapability(final Capability<T> capability, final EnumFacing facing) {
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(tank);
}
return super.getCapability(capability, facing);
}
// IInventoryProvider
@Override
public Inventory getInventory() {
@ -161,4 +143,10 @@ public class TileQuantumTank extends TileLegacyMachineBase
.addInventory().tile(this).fluidSlot(0, 80, 17).outputSlot(1, 80, 53).addInventory()
.create(this);
}
@Nullable
@Override
public Tank getTank() {
return tank;
}
}

View file

@ -26,9 +26,7 @@ package techreborn.tiles.generator;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import reborncore.api.IToolDrop;
import reborncore.api.tile.IInventoryProvider;
import reborncore.common.blocks.BlockMachineBase;
@ -41,6 +39,8 @@ import techreborn.api.generator.FluidGeneratorRecipe;
import techreborn.api.generator.FluidGeneratorRecipeList;
import techreborn.api.generator.GeneratorRecipeHelper;
import javax.annotation.Nullable;
public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implements IToolDrop, IInventoryProvider {
private final FluidGeneratorRecipeList recipes;
@ -90,7 +90,7 @@ public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implement
}
if (tank.getFluidAmount() > 0) {
if (currentRecipe == null || !currentRecipe.getFluid().equals(tank.getFluidType()))
if (currentRecipe == null || !FluidUtils.fluidEquals(currentRecipe.getFluid(), tank.getFluidType()))
currentRecipe = getRecipes().getRecipeForFluid(tank.getFluidType()).orElse(null);
if (currentRecipe != null) {
@ -172,22 +172,6 @@ public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implement
return inventory;
}
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
return true;
}
return super.hasCapability(capability, facing);
}
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(tank);
}
return super.getCapability(capability, facing);
}
@Override
public void readFromNBT(NBTTagCompound tagCompound) {
super.readFromNBT(tagCompound);
@ -221,4 +205,10 @@ public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implement
public void setTankAmount(int amount){
tank.setFluidAmount(amount);
}
@Nullable
@Override
public Tank getTank() {
return tank;
}
}

View file

@ -27,10 +27,7 @@ package techreborn.tiles.multiblock;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.registration.RebornRegistry;
import reborncore.common.registration.impl.ConfigRegistry;
@ -46,6 +43,8 @@ import techreborn.init.TRIngredients;
import techreborn.lib.ModInfo;
import techreborn.tiles.TileGenericMachine;
import javax.annotation.Nullable;
/**
* @author drcrazy
*
@ -124,22 +123,6 @@ public class TileFluidReplicator extends TileGenericMachine implements IContaine
return tagCompound;
}
@Override
public boolean hasCapability(final Capability<?> capability, final EnumFacing facing) {
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
return true;
}
return super.hasCapability(capability, facing);
}
@Override
public <T> T getCapability(final Capability<T> capability, final EnumFacing facing) {
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(tank);
}
return super.getCapability(capability, facing);
}
// TileLegacyMachineBase
@Override
public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) {
@ -161,4 +144,10 @@ public class TileFluidReplicator extends TileGenericMachine implements IContaine
.outputSlot(2, 124, 55).energySlot(3, 8, 72).syncEnergyValue().syncCrafterValue().addInventory()
.create(this);
}
@Nullable
@Override
public Tank getTank() {
return tank;
}
}

View file

@ -31,9 +31,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidBlock;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
@ -53,6 +51,8 @@ import techreborn.init.ModBlocks;
import techreborn.lib.ModInfo;
import techreborn.tiles.TileGenericMachine;
import javax.annotation.Nullable;
@RebornRegistry(modID = ModInfo.MOD_ID)
public class TileIndustrialGrinder extends TileGenericMachine implements IContainerProvider, ITileRecipeHandler<IndustrialGrinderRecipe> {
@ -128,22 +128,6 @@ public class TileIndustrialGrinder extends TileGenericMachine implements IContai
return tagCompound;
}
@Override
public boolean hasCapability(final Capability<?> capability, final EnumFacing facing) {
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
return true;
}
return super.hasCapability(capability, facing);
}
@Override
public <T> T getCapability(final Capability<T> capability, final EnumFacing facing) {
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(tank);
}
return super.getCapability(capability, facing);
}
// TileLegacyMachineBase
@Override
public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) {
@ -214,4 +198,10 @@ public class TileIndustrialGrinder extends TileGenericMachine implements IContai
}
return false;
}
@Nullable
@Override
public Tank getTank() {
return tank;
}
}

View file

@ -31,9 +31,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidBlock;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
@ -53,6 +51,8 @@ import techreborn.init.ModBlocks;
import techreborn.lib.ModInfo;
import techreborn.tiles.TileGenericMachine;
import javax.annotation.Nullable;
@RebornRegistry(modID = ModInfo.MOD_ID)
public class TileIndustrialSawmill extends TileGenericMachine implements IContainerProvider, ITileRecipeHandler<IndustrialSawmillRecipe> {
@ -128,24 +128,6 @@ public class TileIndustrialSawmill extends TileGenericMachine implements IContai
return tagCompound;
}
@Override
public boolean hasCapability(final Capability<?> capability, final EnumFacing facing) {
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
return true;
}
return super.hasCapability(capability, facing);
}
@Override
public <T> T getCapability(final Capability<T> capability, final EnumFacing facing) {
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
if (tank != null) {
return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(tank);
}
}
return super.getCapability(capability, facing);
}
// TileLegacyMachineBase
@Override
public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) {
@ -213,4 +195,10 @@ public class TileIndustrialSawmill extends TileGenericMachine implements IContai
}
return false;
}
@Nullable
@Override
public Tank getTank() {
return tank;
}
}

View file

@ -59,7 +59,7 @@ import java.util.List;
*/
@RebornRegistry(modID = ModInfo.MOD_ID)
public class TileAutoCraftingTable extends TilePowerAcceptor
implements IToolDrop, IInventoryProvider, IContainerProvider {
implements IToolDrop, IInventoryProvider, IContainerProvider {
@ConfigRegistry(config = "machines", category = "autocrafter", key = "AutoCrafterInput", comment = "AutoCrafting Table Max Input (Value in EU)")
public static int maxInput = 32;
@ -85,8 +85,8 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
public IRecipe getIRecipe() {
InventoryCrafting crafting = getCraftingInventory();
if (!crafting.isEmpty()) {
if(lastRecipe != null){
if(lastRecipe.matches(crafting, world)){
if (lastRecipe != null) {
if (lastRecipe.matches(crafting, world)) {
return lastRecipe;
}
}
@ -181,41 +181,39 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
}
public boolean make(IRecipe recipe) {
if (canMake(recipe)) {
if (recipe == null) {
return false;
} else if (recipe != null) {
for (int i = 0; i < recipe.getIngredients().size(); i++) {
Ingredient ingredient = recipe.getIngredients().get(i);
//Looks for the best slot to take it from
ItemStack bestSlot = inventory.getStackInSlot(i);
if (ingredient.apply(bestSlot)) {
handleContainerItem(bestSlot);
bestSlot.shrink(1);
} else {
for (int j = 0; j < 9; j++) {
ItemStack stack = inventory.getStackInSlot(j);
if (ingredient.apply(stack)) {
handleContainerItem(stack);
stack.shrink(1); //TODO is this right? or do I need to use it as an actull crafting grid
break;
}
}
if (recipe == null || !canMake(recipe)) {
return false;
}
for (int i = 0; i < recipe.getIngredients().size(); i++) {
Ingredient ingredient = recipe.getIngredients().get(i);
// Looks for the best slot to take it from
ItemStack bestSlot = inventory.getStackInSlot(i);
if (ingredient.apply(bestSlot)) {
handleContainerItem(bestSlot);
bestSlot.shrink(1);
} else {
for (int j = 0; j < 9; j++) {
ItemStack stack = inventory.getStackInSlot(j);
if (ingredient.apply(stack)) {
handleContainerItem(stack);
stack.shrink(1); // TODO is this right? or do I need
// to use it as an actull
// crafting grid
break;
}
}
ItemStack output = inventory.getStackInSlot(9);
//TODO fire forge recipe event
ItemStack ouputStack = recipe.getCraftingResult(getCraftingInventory());
if (output.isEmpty()) {
inventory.setInventorySlotContents(9, ouputStack.copy());
} else {
//TODO use ouputStack in someway?
output.grow(recipe.getRecipeOutput().getCount());
}
return true;
}
}
return false;
ItemStack output = inventory.getStackInSlot(9);
// TODO fire forge recipe event
ItemStack ouputStack = recipe.getCraftingResult(getCraftingInventory());
if (output.isEmpty()) {
inventory.setInventorySlotContents(9, ouputStack.copy());
} else {
// TODO use ouputStack in someway?
output.grow(recipe.getRecipeOutput().getCount());
}
return true;
}
private void handleContainerItem(ItemStack stack) {
@ -225,7 +223,8 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
if (hasOutputSpace(containerItem, 10)) {
if (extraOutputSlot.isEmpty()) {
setInventorySlotContents(10, containerItem.copy());
} else if (ItemUtils.isItemEqual(extraOutputSlot, containerItem, true, true) && extraOutputSlot.getMaxStackSize() < extraOutputSlot.getCount() + containerItem.getCount()) {
} else if (ItemUtils.isItemEqual(extraOutputSlot, containerItem, true, true)
&& extraOutputSlot.getMaxStackSize() < extraOutputSlot.getCount() + containerItem.getCount()) {
extraOutputSlot.grow(1);
}
}
@ -264,14 +263,15 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
if (ingredient != Ingredient.EMPTY && ingredient.apply(stack)) {
if (stackInSlot.isEmpty()) {
possibleSlots.add(i);
} else if (stackInSlot.getItem() == stack.getItem() && stackInSlot.getItemDamage() == stack.getItemDamage()) {
} else if (stackInSlot.getItem() == stack.getItem()
&& stackInSlot.getItemDamage() == stack.getItemDamage()) {
if (stackInSlot.getMaxStackSize() >= stackInSlot.getCount() + stack.getCount()) {
possibleSlots.add(i);
}
}
}
}
//Slot, count
// Slot, count
Pair<Integer, Integer> smallestCount = null;
for (Integer slot : possibleSlots) {
ItemStack slotStack = inventory.getStackInSlot(slot);
@ -328,7 +328,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
progress++;
if (progress == 1) {
world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), ModSounds.AUTO_CRAFTING,
SoundCategory.BLOCKS, 0.3F, 0.8F);
SoundCategory.BLOCKS, 0.3F, 0.8F);
}
useEnergy(euTick);
}
@ -342,7 +342,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
}
}
//Easyest way to sync back to the client
// Easyest way to sync back to the client
public int getLockedInt() {
return locked ? 1 : 0;
}
@ -384,7 +384,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
@Override
public void readFromNBT(NBTTagCompound tag) {
if(tag.hasKey("locked")){
if (tag.hasKey("locked")) {
locked = tag.getBoolean("locked");
}
super.readFromNBT(tag);
@ -407,12 +407,12 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
@Override
public int[] getSlotsForFace(EnumFacing side) {
return new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
return new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
}
@Override
public boolean canInsertItem(int index, ItemStack stack, EnumFacing direction) {
if(index > 8){
if (index > 8) {
return false;
}
int bestSlot = findBestSlotForStack(getIRecipe(), stack);
@ -424,13 +424,13 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
@Override
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) {
if(index > 8){
if (index > 8) {
return true;
}
return false;
}
//This machine doesnt have a facing
// This machine doesnt have a facing
@Override
public EnumFacing getFacingEnum() {
return EnumFacing.NORTH;
@ -451,16 +451,12 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
// IContainerProvider
@Override
public BuiltContainer createContainer(EntityPlayer player) {
return new ContainerBuilder("autocraftingtable").player(player.inventory).inventory().hotbar()
.addInventory().tile(this)
.slot(0, 28, 25).slot(1, 46, 25).slot(2, 64, 25)
.slot(3, 28, 43).slot(4, 46, 43).slot(5, 64, 43)
.slot(6, 28, 61).slot(7, 46, 61).slot(8, 64, 61)
.outputSlot(9, 145, 42).outputSlot(10, 145, 70).syncEnergyValue()
.syncIntegerValue(this::getProgress, this::setProgress)
.syncIntegerValue(this::getMaxProgress, this::setMaxProgress)
.syncIntegerValue(this::getLockedInt, this::setLockedInt)
.addInventory().create(this);
return new ContainerBuilder("autocraftingtable").player(player.inventory).inventory().hotbar().addInventory()
.tile(this).slot(0, 28, 25).slot(1, 46, 25).slot(2, 64, 25).slot(3, 28, 43).slot(4, 46, 43)
.slot(5, 64, 43).slot(6, 28, 61).slot(7, 46, 61).slot(8, 64, 61).outputSlot(9, 145, 42)
.outputSlot(10, 145, 70).syncEnergyValue().syncIntegerValue(this::getProgress, this::setProgress)
.syncIntegerValue(this::getMaxProgress, this::setMaxProgress)
.syncIntegerValue(this::getLockedInt, this::setLockedInt).addInventory().create(this);
}
@Override

View file

@ -114,8 +114,8 @@ public class TechRebornWorldGen implements IWorldGenerator {
for (OreConfig ore : config) {
if (ore.blockName.equals(defaultOre.blockName) && ore.meta == defaultOre.meta) {
hasFoundOre = true;
ore.state = defaultOre.state; // Should allow for states to
// be saved/loaded
// Should allow for states to be saved/loaded
ore.state = defaultOre.state;
}
}
if (!hasFoundOre) {
@ -194,52 +194,53 @@ public class TechRebornWorldGen implements IWorldGenerator {
boolean genTree = false;
List<OreConfig> list = new ArrayList<>();
Predicate<IBlockState> predicate = BlockMatcher.forBlock(Blocks.STONE);
if (world.provider.isSurfaceWorld()) {
list.addAll(getAllGenOresFromList(config.overworldOres));
genTree = true;
} else if (world.provider.getDimension() == -1) {
if (world.provider.getDimension() == -1) {
list.addAll(getAllGenOresFromList(config.neatherOres));
predicate = BlockMatcher.forBlock(Blocks.NETHERRACK);
} else if (world.provider.getDimension() == 1) {
list.addAll(getAllGenOresFromList(config.endOres));
predicate = BlockMatcher.forBlock(Blocks.END_STONE);
}
else if (config.overworldOresInModdedDims || world.provider.getDimension() == 0) {
list.addAll(getAllGenOresFromList(config.overworldOres));
genTree = true;
}
if (!list.isEmpty() && config.generateOres) {
int xPos, yPos, zPos;
for (OreConfig ore : list) {
WorldGenMinable worldGenMinable = new WorldGenMinable(ore.state, ore.veinSize, predicate);
if (ore.state != null) {
for (int i = 0; i < ore.veinsPerChunk; i++) {
xPos = chunkX * 16 + random.nextInt(16);
if (ore.maxYHeight == -1 || ore.minYHeight == -1) {
continue;
}
yPos = ore.minYHeight + random.nextInt(ore.maxYHeight - ore.minYHeight);
zPos = chunkZ * 16 + random.nextInt(16);
BlockPos pos = new BlockPos(xPos, yPos, zPos);
if (ore.veinSize < 4){
// Workaround for small veins
for (int j = 1; j < ore.veinSize; j++) {
// standard worldgen offset is added here like in WorldGenMinable#generate
BlockPos smallVeinPos = pos.add(8, 0, 8);
smallVeinPos.add(random.nextInt(2), random.nextInt(2), random.nextInt(2));
IBlockState blockState = world.getBlockState(smallVeinPos);
if (blockState.getBlock().isReplaceableOreGen(blockState, world, smallVeinPos, predicate)) {
world.setBlockState(smallVeinPos, ore.state, 2);
}
}
} else {
try {
worldGenMinable.generate(world, random, pos);
} catch (ArrayIndexOutOfBoundsException e) {
Core.logHelper.error("Something bad is happening during world gen the ore "
+ ore.blockNiceName
+ " caused a crash when generating. Report this to the TechReborn devs with a log");
if (ore.state == null) {
continue;
}
for (int i = 0; i < ore.veinsPerChunk; i++) {
xPos = chunkX * 16 + random.nextInt(16);
if (ore.maxYHeight == -1 || ore.minYHeight == -1) {
continue;
}
yPos = ore.minYHeight + random.nextInt(ore.maxYHeight - ore.minYHeight);
zPos = chunkZ * 16 + random.nextInt(16);
BlockPos pos = new BlockPos(xPos, yPos, zPos);
if (ore.veinSize < 4) {
// Workaround for small veins
for (int j = 1; j < ore.veinSize; j++) {
// standard worldgen offset is added here like in WorldGenMinable#generate
BlockPos smallVeinPos = pos.add(8, 0, 8);
smallVeinPos.add(random.nextInt(2), random.nextInt(2), random.nextInt(2));
IBlockState blockState = world.getBlockState(smallVeinPos);
if (blockState.getBlock().isReplaceableOreGen(blockState, world, smallVeinPos, predicate)) {
world.setBlockState(smallVeinPos, ore.state, 2);
}
}
} else {
try {
worldGenMinable.generate(world, random, pos);
} catch (ArrayIndexOutOfBoundsException e) {
Core.logHelper.error("Something bad is happening during world gen the ore "
+ ore.blockNiceName
+ " caused a crash when generating. Report this to the TechReborn devs with a log");
}
}
}
}

View file

@ -36,6 +36,8 @@ public class WorldGenConfig {
public boolean generateOres = true;
public boolean retroGenOres = false;
public boolean overworldOresInModdedDims = true;
public List<OreConfig> overworldOres;