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

# Conflicts:
#	build.gradle
#	src/main/java/techreborn/Core.java
#	src/main/java/techreborn/api/fluidreplicator/FluidReplicatorRecipe.java
#	src/main/java/techreborn/api/recipe/recipes/BlastFurnaceRecipe.java
#	src/main/java/techreborn/blocks/BlockMachineCasing.java
#	src/main/java/techreborn/blocks/cable/EnumCableType.java
#	src/main/java/techreborn/blocks/generator/solarpanel/BlockSolarPanel.java
#	src/main/java/techreborn/blocks/storage/BlockEnergyStorage.java
#	src/main/java/techreborn/blocks/transformers/BlockTransformer.java
#	src/main/java/techreborn/client/gui/GuiAESU.java
#	src/main/java/techreborn/client/gui/GuiManual.java
#	src/main/java/techreborn/client/gui/GuiVacuumFreezer.java
#	src/main/java/techreborn/command/TechRebornDevCommand.java
#	src/main/java/techreborn/compat/jei/RecipeUtil.java
#	src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java
#	src/main/java/techreborn/compat/jei/fusionReactor/FusionReactorRecipeWrapper.java
#	src/main/java/techreborn/compat/jei/industrialSawmill/IndustrialSawmillRecipeWrapper.java
#	src/main/java/techreborn/config/ConfigTechReborn.java
#	src/main/java/techreborn/init/IC2Duplicates.java
#	src/main/java/techreborn/init/ModRecipes.java
#	src/main/java/techreborn/init/OreDict.java
#	src/main/java/techreborn/init/recipes/CraftingTableRecipes.java
#	src/main/java/techreborn/init/recipes/FusionReactorRecipes.java
#	src/main/java/techreborn/init/recipes/IndustrialCentrifugeRecipes.java
#	src/main/java/techreborn/init/recipes/IndustrialGrinderRecipes.java
#	src/main/java/techreborn/init/recipes/SmeltingRecipes.java
#	src/main/java/techreborn/items/ItemUpgrades.java
#	src/main/java/techreborn/items/ingredients/ItemParts.java
#	src/main/java/techreborn/items/tool/industrial/ItemIndustrialChainsaw.java
#	src/main/java/techreborn/items/tool/industrial/ItemIndustrialDrill.java
#	src/main/java/techreborn/items/tools/ItemWrench.java
#	src/main/java/techreborn/tiles/TileAlarm.java
#	src/main/java/techreborn/tiles/fusionReactor/TileFusionControlComputer.java
#	src/main/java/techreborn/tiles/generator/TileCreativeSolarPanel.java
#	src/main/java/techreborn/tiles/generator/TileLightningRod.java
#	src/main/java/techreborn/tiles/machine/iron/TileIronAlloyFurnace.java
#	src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialBlastFurnace.java
#	src/main/java/techreborn/tiles/machine/multiblock/TileVacuumFreezer.java
#	src/main/java/techreborn/tiles/machine/tier1/TileAutoCraftingTable.java
#	src/main/java/techreborn/tiles/machine/tier1/TileRecycler.java
#	src/main/java/techreborn/tiles/machine/tier1/TileRollingMachine.java
#	src/main/java/techreborn/tiles/machine/tier3/TileMatterFabricator.java
#	src/main/java/techreborn/tiles/storage/TileAdjustableSU.java
#	src/main/java/techreborn/world/TechRebornRetroGen.java
#	src/main/resources/assets/techreborn/blockstates/items/materials/part.json
#	src/main/resources/assets/techreborn/blockstates/items/misc/upgrades.json
This commit is contained in:
modmuss50 2019-04-27 20:32:56 +01:00
commit 6ab23c4c64
32 changed files with 668 additions and 54 deletions

View file

@ -1,6 +1,6 @@
![](https://i.imgur.com/m0y21EK.png "Tech Reborn")
[![](http://cf.way2muchnoise.eu/full_233564_downloads.svg)](https://minecraft.curseforge.com/projects/techreborn) [![](http://cf.way2muchnoise.eu/versions/233564.svg)](https://minecraft.curseforge.com/projects/techreborn) [![](https://img.shields.io/badge/Discord-TeamReborn-738bd7.svg)](https://discord.gg/teamreborn) [![Crowdin](https://d322cqt584bo4o.cloudfront.net/techreborn/localized.svg)](https://translate.techreborn.ovh/project/techreborn)
[![](http://cf.way2muchnoise.eu/full_233564_downloads.svg)](https://minecraft.curseforge.com/projects/techreborn) [![](http://cf.way2muchnoise.eu/packs/233564.svg)](https://minecraft.curseforge.com/projects/techreborn) [![](http://cf.way2muchnoise.eu/versions/233564.svg)](https://minecraft.curseforge.com/projects/techreborn) [![](https://img.shields.io/badge/Discord-TeamReborn-738bd7.svg)](https://discord.gg/teamreborn) [![Crowdin](https://d322cqt584bo4o.cloudfront.net/techreborn/localized.svg)](https://translate.techreborn.ovh/project/techreborn)
# Tech Reborn for 1.13.1 (BUILD JOBS WILL NEED UPDATING) [![Build Status](https://jenkins.modmuss50.me/job/Team%20Reborn/job/TechReborn/job/1.12/badge/icon)](https://jenkins.modmuss50.me/job/Team%20Reborn/job/TechReborn/job/1.12/)

View file

@ -65,6 +65,11 @@ public class FusionReactorRecipe {
*/
int tickTime;
/**
* This is the minium reactor size that this recipe can work with
*/
int minSize;
/**
* @param topInput This is the top slot stack
* @param bottomInput This is the bottom slot stack
@ -75,14 +80,31 @@ public class FusionReactorRecipe {
*/
public FusionReactorRecipe(ItemStack topInput, ItemStack bottomInput, ItemStack output, double startEU,
double euTick, int tickTime) {
this(topInput, bottomInput, output, startEU, euTick, tickTime, 0);
}
/**
* @param topInput This is the top slot stack
* @param bottomInput This is the bottom slot stack
* @param output This is the output stack
* @param startEU This is the inital EU amount
* @param euTick This is the eu that is transfured every tick
* @param tickTime This is the time the recipe takes to process
* @param minSize This is the min size of reactor required for this recipe
*/
public FusionReactorRecipe(ItemStack topInput, ItemStack bottomInput, ItemStack output, double startEU,
double euTick, int tickTime, int minSize) {
this.topInput = topInput;
this.bottomInput = bottomInput;
this.output = output;
this.startEU = startEU;
this.euTick = euTick;
this.tickTime = tickTime;
this.minSize = minSize;
}
public ItemStack getTopInput() {
return topInput;
}
@ -106,4 +128,8 @@ public class FusionReactorRecipe {
public int getTickTime() {
return tickTime;
}
public int getMinSize() {
return minSize;
}
}

View file

@ -50,7 +50,7 @@ import techreborn.TechReborn;
* Created by Rushmead
*/
public abstract class BlockTransformer extends BaseTileBlock {
public static DirectionProperty FACING = BlockStateProperties.FACING;
public String name;
@ -69,7 +69,7 @@ public abstract class BlockTransformer extends BaseTileBlock {
public EnumFacing getFacing(IBlockState state) {
return state.get(FACING);
}
// BaseTileBlock
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer,
@ -89,7 +89,7 @@ public abstract class BlockTransformer extends BaseTileBlock {
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
builder.add(FACING);
}
@SuppressWarnings("deprecation")
@Override
public boolean onBlockActivated(IBlockState state, World worldIn, BlockPos pos, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {

View file

@ -30,10 +30,14 @@ import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import reborncore.client.gui.builder.widget.GuiButtonExtended;
import reborncore.common.network.NetworkManager;
import techreborn.items.ItemManual;
import techreborn.packets.ServerboundPackets;
import java.awt.*;
public class GuiManual extends GuiScreen {
ItemManual manual;
@ -44,7 +48,7 @@ public class GuiManual extends GuiScreen {
int guiHeight = 195;
private static final String text1 = I18n.format("techreborn.manual.wiki");
private static final String text2 = I18n.format("techreborn.manual.discord");
private static final String text3 = I18n.format("techreborn.manual.refund");
public GuiManual(EntityPlayer player) {
this.player = player;
@ -57,8 +61,12 @@ public class GuiManual extends GuiScreen {
@Override
public void initGui() {
buttons.add(new GuiButtonExtended(1, (width / 2 - 30), (height / 2 - (guiHeight / 4)) + 17, 60, 20, I18n.format("techreborn.manual.wikibtn")).clickHandler(this::onClick));
buttons.add(new GuiButtonExtended(2, (width / 2 - 30), (height / 2) + 22, 60, 20, I18n.format("techreborn.manual.discordbtn")).clickHandler(this::onClick));
int y = height / 4;
buttons.add(new GuiButtonExtended(1, (width / 2 - 30), y + 10, 60, 20, I18n.format("techreborn.manual.wikibtn")));
buttons.add(new GuiButtonExtended(2, (width / 2 - 30), y + 60, 60, 20, I18n.format("techreborn.manual.discordbtn")));
if(ItemManual.allowRefund){
buttons.add(new GuiButtonExtended(3, (width / 2 - 30), y + 110, 60, 20, I18n.format("techreborn.manual.refundbtn")));
}
}
@Override
@ -68,8 +76,12 @@ public class GuiManual extends GuiScreen {
int centerX = (width / 2) - guiWidth / 2;
int centerY = (height / 2) - guiHeight / 2;
drawTexturedModalRect(centerX, centerY, 0, 0, guiWidth, guiHeight);
int y = height / 4;
fontRenderer.drawString(text1, ((width / 2) - fontRenderer.getStringWidth(text1) / 2), height / 2 - (guiHeight / 4), 4210752);
fontRenderer.drawString(text2, ((width / 2) - fontRenderer.getStringWidth(text2) / 2), height / 2 + 5, 4210752);
if(ItemManual.allowRefund){
fontRenderer.drawString(text3, ((width / 2) - fontRenderer.getStringWidth(text3) / 2), y + 100, 4210752);
}
super.render(mouseX, mouseY, partialTicks);
}
@ -81,6 +93,10 @@ public class GuiManual extends GuiScreen {
case 2:
this.mc.displayGuiScreen(new GuiConfirmOpenLink(this, "https://discord.gg/teamreborn", 2, false));
break;
case 3:
mc.displayGuiScreen(null);
NetworkManager.sendToServer(ServerboundPackets.createRefundPacket());
break;
}
}

View file

@ -95,7 +95,7 @@ public class GuiVacuumFreezer extends GuiBase {
final Multiblock multiblock = new Multiblock();
IBlockState advancedCasing = TRContent.MachineBlocks.ADVANCED.getCasing().getDefaultState();
IBlockState industrialCasing = TRContent.MachineBlocks.INDUSTRIAL.getCasing().getDefaultState();
addComponent(0, -1, 0, advancedCasing, multiblock);
addComponent(1, -1, 0, advancedCasing, multiblock);
addComponent(0, -1, 1, advancedCasing, multiblock);

View file

@ -90,7 +90,7 @@ public class ConfigTechReborn {
@ConfigRegistry(config = "items", category = "power", key = "clockingDeviceEnergyUsage", comment = "Cloacking device energy usesage (FE)")
public static int CloackingDeviceUsage = 10;
@ConfigRegistry(config = "generators", category = "solarPanelBasic", key = "basicDayRate", comment = "Generation rate during day for Basic Solar Panel (Value in FE)")
public static int basicGenerationRateD = 1;
@ -101,7 +101,7 @@ public class ConfigTechReborn {
public static int advancedGenerationRateD = 16;
@ConfigRegistry(config = "generators", category = "solarPanelAdvanced", key = "advancedNightRate", comment = "Generation rate during night for Advanced Solar Panel (Value in FE)")
public static int advancedGenerationRateN = 0;
public static int advancedGenerationRateN = 0;
@ConfigRegistry(config = "generators", category = "solarPanelIndustrial", key = "industrialDayRate", comment = "Generation rate during day for Industrial Solar Panel (Value in FE)")
public static int industrialGenerationRateD = 64;

View file

@ -0,0 +1,98 @@
/*
* 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.init.recipes;
import net.minecraft.item.ItemStack;
/**
* @author drcrazy
*
*/
public class BlastFurnaceRecipes extends RecipeMethods {
public static void init() {
// register(ItemDusts.getDustByName("titanium"), null, ItemIngots.getIngotByName("titanium"), null, 3600, 1500);
// register(ItemDustsSmall.getSmallDustByName("titanium", 4), null, ItemIngots.getIngotByName("titanium"), null,
// 3600, 1500);
// register(ItemDusts.getDustByName("aluminum"), null, ItemIngots.getIngotByName("aluminum"), null, 2200, 1700);
// register(ItemDustsSmall.getSmallDustByName("aluminum", 4), null, ItemIngots.getIngotByName("aluminum"), null,
// 2200, 1700);
// register(ItemDusts.getDustByName("tungsten"), null, ItemIngots.getIngotByName("tungsten"), null, 1800, 2500);
// register(ItemDustsSmall.getSmallDustByName("tungsten", 4), null, ItemIngots.getIngotByName("tungsten"), null,
// 1800, 2500);
// register(ItemDusts.getDustByName("chrome"), null, ItemIngots.getIngotByName("chrome"), null, 4420, 1700);
// register(ItemDustsSmall.getSmallDustByName("chrome", 4), null, ItemIngots.getIngotByName("chrome"), null, 4420,
// 1700);
// register(ItemDusts.getDustByName("steel"), null, ItemIngots.getIngotByName("steel"), null, 2800, 1000);
// register(ItemDustsSmall.getSmallDustByName("steel", 4), null, ItemIngots.getIngotByName("steel"), null, 2800,
// 1000);
// register(ItemDusts.getDustByName("galena", 2), null, ItemIngots.getIngotByName("silver"),
// ItemIngots.getIngotByName("lead"), 80, 1500);
// register(new ItemStack(Items.IRON_INGOT), ItemDusts.getDustByName("coal", 2),
// ItemIngots.getIngotByName("steel"), ItemDusts.getDustByName("dark_ashes", 2), 500, 1000);
// register(ItemIngots.getIngotByName("tungsten"), ItemIngots.getIngotByName("steel"),
// ItemIngots.getIngotByName("hot_tungstensteel"), ItemDusts.getDustByName("dark_ashes", 4), 500, 128,
// 3000);
// register(new ItemStack(Blocks.IRON_ORE), ItemDusts.getDustByName("calcite"), new ItemStack(Items.IRON_INGOT, 3),
// ItemDusts.getDustByName("dark_ashes"), 140, 1000);
// register(BlockOre.getOreByName("Pyrite"), ItemDusts.getDustByName("calcite"),
// new ItemStack(Items.IRON_INGOT, 2), ItemDusts.getDustByName("dark_ashes"), 140, 1000);
// register(new ItemStack(Items.DIAMOND_HELMET), new ItemStack(Blocks.SAND), new ItemStack(Items.DIAMOND, 5),
// ItemDusts.getDustByName("dark_ashes"), 140, 1000);
// register(new ItemStack(Items.DIAMOND_CHESTPLATE), new ItemStack(Blocks.SAND), new ItemStack(Items.DIAMOND, 8),
// ItemDusts.getDustByName("dark_ashes"), 140, 1000);
// register(new ItemStack(Items.DIAMOND_LEGGINGS), new ItemStack(Blocks.SAND), new ItemStack(Items.DIAMOND, 7),
// ItemDusts.getDustByName("dark_ashes"), 140, 1000);
// register(new ItemStack(Items.DIAMOND_BOOTS), new ItemStack(Blocks.SAND), new ItemStack(Items.DIAMOND, 4),
// ItemDusts.getDustByName("dark_ashes"), 140, 1000);
// register(new ItemStack(Items.GOLDEN_HELMET), new ItemStack(Blocks.SAND), new ItemStack(Items.GOLD_INGOT, 5),
// ItemDusts.getDustByName("dark_ashes"), 140, 1000);
// register(new ItemStack(Items.GOLDEN_CHESTPLATE), new ItemStack(Blocks.SAND), new ItemStack(Items.GOLD_INGOT, 8),
// ItemDusts.getDustByName("dark_ashes"), 140, 1000);
// register(new ItemStack(Items.GOLDEN_LEGGINGS), new ItemStack(Blocks.SAND), new ItemStack(Items.GOLD_INGOT, 7),
// ItemDusts.getDustByName("dark_ashes"), 140, 1000);
// register(new ItemStack(Items.GOLDEN_BOOTS), new ItemStack(Blocks.SAND), new ItemStack(Items.GOLD_INGOT, 4),
// ItemDusts.getDustByName("dark_ashes"), 140, 1000);
// register(new ItemStack(Items.IRON_HELMET), new ItemStack(Blocks.SAND), new ItemStack(Items.IRON_INGOT, 5),
// ItemDusts.getDustByName("dark_ashes"), 140, 1000);
// register(new ItemStack(Items.IRON_CHESTPLATE), new ItemStack(Blocks.SAND), new ItemStack(Items.IRON_INGOT, 8),
// ItemDusts.getDustByName("dark_ashes"), 140, 1000);
// register(new ItemStack(Items.IRON_LEGGINGS), new ItemStack(Blocks.SAND), new ItemStack(Items.IRON_INGOT, 7),
// ItemDusts.getDustByName("dark_ashes"), 140, 1000);
// register(new ItemStack(Items.IRON_BOOTS), new ItemStack(Blocks.SAND), new ItemStack(Items.IRON_INGOT, 4),
// ItemDusts.getDustByName("dark_ashes"), 140, 1000);
}
private static void register(ItemStack in1, ItemStack in2, ItemStack out1, ItemStack out2, int tickTime,
int euPerTick, int neededHeat) {
// RecipeHandler.addRecipe(new BlastFurnaceRecipe(in1, in2, out1, out2, tickTime, euPerTick, neededHeat));
}
private static void register(ItemStack in1, ItemStack in2, ItemStack out1, ItemStack out2, int tickTime,
int neededHeat) {
register(in1, in2, out1, out2, tickTime, 120, neededHeat);
}
}

View file

@ -0,0 +1,89 @@
/*
* 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.init.recipes;
import java.security.InvalidParameterException;
import net.minecraft.item.ItemStack;
/**
* @author drcrazy
*
*/
public class CompressorRecipes extends RecipeMethods {
public static void init() {
// register(ItemIngots.getIngotByName("advanced_alloy"), ItemPlates.getPlateByName("advanced_alloy"), 400, 20);
// register(IC2Duplicates.CARBON_MESH.getStackBasedOnConfig(), ItemPlates.getPlateByName("carbon"), 400, 2);
// register(OreUtil.getStackFromName("plankWood"), OreUtil.getStackFromName("plateWood"));
// register(OreUtil.getStackFromName("dustLazurite"), ItemPlates.getPlateByName("lazurite"));
// register(OreUtil.getStackFromName("obsidian"), ItemPlates.getPlateByName("obsidian", 9));
// register(OreUtil.getStackFromName("dustObsidian"), ItemPlates.getPlateByName("obsidian"));
// register(OreUtil.getStackFromName("dustYellowGarnet"), ItemPlates.getPlateByName("YellowGarnet"));
// register(OreUtil.getStackFromName("blockYellowGarnet"), ItemPlates.getPlateByName("YellowGarnet", 9));
// register(OreUtil.getStackFromName("dustRedGarnet"), ItemPlates.getPlateByName("RedGarnet"));
// register(OreUtil.getStackFromName("blockRedGarnet"), ItemPlates.getPlateByName("RedGarnet", 9));
// register("ingotRefinedIron", ItemPlates.getPlateByName("RefinedIron"));
//
// ItemStack plate;
// for (String ore : OreUtil.oreNames) {
// if (ore.equals("iridium")) {
// continue;
// }
// if (!OreUtil.hasPlate(ore)) {
// continue;
// }
//
// try {
// plate = ItemPlates.getPlateByName(ore, 1);
// } catch (InvalidParameterException e) {
// plate = OreUtil.getStackFromName("plate" + OreUtil.capitalizeFirstLetter(ore));
// }
// if (plate.isEmpty()) {
// continue;
// }
// if (OreUtil.hasIngot(ore)) {
// register(OreUtil.getStackFromName("ingot" + OreUtil.capitalizeFirstLetter(ore)), plate);
// }
// if (OreUtil.hasGem(ore) && OreUtil.hasDust(ore)) {
// register(OreUtil.getStackFromName("dust" + OreUtil.capitalizeFirstLetter(ore)), plate);
// }
// if (OreUtil.hasBlock(ore)) {
// ItemStack morePlates = plate.copy();
// morePlates.setCount(9);
// register(OreUtil.getStackFromName("block" + OreUtil.capitalizeFirstLetter(ore)), morePlates);
// }
// }
}
static void register(Object input, ItemStack output) {
register(input, output, 300, 4);
}
static void register(Object input, ItemStack output, int tickTime, int euPerTick) {
//RecipeHandler.addRecipe(new CompressorRecipe(input, output, tickTime, euPerTick));
}
}

View file

@ -30,10 +30,14 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.world.World;
import reborncore.common.registration.config.ConfigRegistry;
import techreborn.TechReborn;
public class ItemManual extends Item {
@ConfigRegistry(config = "misc", category = "general", key = "manualRefund", comment = "Allow refunding items used to craft the manual")
public static boolean allowRefund = true;
public ItemManual() {
super(new Item.Properties().group(TechReborn.ITEMGROUP).maxStackSize(1));
}

View file

@ -154,4 +154,8 @@ public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo {
return 0;
}
@Override
public int getItemEnchantability() {
return 20;
}
}

View file

@ -25,27 +25,47 @@
package techreborn.items.tool.industrial;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemTier;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tags.BlockTags;
import net.minecraft.util.NonNullList;
import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.IShearable;
import reborncore.common.powerSystem.ExternalPowerSystems;
import reborncore.common.powerSystem.forge.ForgePowerItemManager;
import reborncore.common.util.ChatUtils;
import reborncore.common.util.ItemUtils;
import techreborn.config.ConfigTechReborn;
import techreborn.init.TRContent;
import techreborn.items.tool.ItemChainsaw;
import techreborn.utils.MessageIDs;
import techreborn.utils.TagUtils;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
public class ItemIndustrialChainsaw extends ItemChainsaw {
private static final EnumFacing[] SEARCH_ORDER = new EnumFacing[]{EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.EAST, EnumFacing.WEST, EnumFacing.UP};
// 4M FE max charge with 1k charge rate
public ItemIndustrialChainsaw() {
super(ItemTier.DIAMOND, ConfigTechReborn.IndustrialChainsawCharge, 1.0F);
@ -70,16 +90,108 @@ public class ItemIndustrialChainsaw extends ItemChainsaw {
@Override
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos, EntityLivingBase entityLiving) {
for (int i = 1; i < 10; i++) {
BlockPos nextPos = pos.up(i);
IBlockState nextState = worldIn.getBlockState(nextPos);
if(TagUtils.hasTag(nextState.getBlock(), BlockTags.LOGS)){
breakBlock(nextPos, stack, worldIn, entityLiving, pos);
if(ItemUtils.isActive(stack) && !worldIn.isRemote){
IBlockState state = worldIn.getBlockState(pos);
if(state.getBlock() instanceof IShearable){
if(((IShearable) state.getBlock()).isShearable(stack, worldIn, pos)){
List<ItemStack> results = ((IShearable) state.getBlock()).onSheared(stack, worldIn, pos, 0);
results.forEach(itemStack -> InventoryHelper.spawnItemStack(worldIn, (double) pos.getX(), (double) pos.getY(), (double) pos.getZ(), itemStack));
return super.onBlockDestroyed(stack, worldIn, blockIn, pos, entityLiving);
}
}
}
List<BlockPos> wood = new ArrayList<>();
findWood(worldIn, pos, wood, new ArrayList<>());
wood.forEach(pos1 -> breakBlock(pos1, stack, worldIn, entityLiving, pos));
return super.onBlockDestroyed(stack, worldIn, blockIn, pos, entityLiving);
}
private void findWood(World world, BlockPos pos, List<BlockPos> wood, List<BlockPos> leaves){
//Limit the amount of wood to be broken to 64 blocks.
if(wood.size() >= 64){
return;
}
//Search 150 leaves for wood
if(leaves.size() >= 150){
return;
}
for(EnumFacing facing : SEARCH_ORDER){
BlockPos checkPos = pos.offset(facing);
if(!wood.contains(checkPos) && !leaves.contains(checkPos)){
IBlockState state = world.getBlockState(checkPos);
if(TagUtils.hasTag(state.getBlock(), BlockTags.LOGS)){
wood.add(checkPos);
findWood(world, checkPos, wood, leaves);
} else if(TagUtils.hasTag(state.getBlock(), BlockTags.LEAVES)){
leaves.add(checkPos);
findWood(world, checkPos, wood, leaves);
}
}
}
}
@Override
public ActionResult<ItemStack> onItemRightClick(final World world, final EntityPlayer player, final EnumHand hand) {
final ItemStack stack = player.getHeldItem(hand);
if (player.isSneaking()) {
if (new ForgePowerItemManager(stack).getEnergyStored() < cost) {
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
TextFormatting.GRAY + I18n.format("techreborn.message.nanosaberEnergyErrorTo") + " "
+ TextFormatting.GOLD + I18n
.format("techreborn.message.nanosaberActivate")));
} else {
if (!ItemUtils.isActive(stack)) {
if (stack.getTag() == null) {
stack.setTag(new NBTTagCompound());
}
stack.getTag().putBoolean("isActive", true);
if (world.isRemote) {
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
TextFormatting.GRAY + I18n.format("techreborn.message.setTo") + " "
+ TextFormatting.GOLD + I18n
.format("techreborn.message.nanosaberActive")));
}
} else {
stack.getTag().putBoolean("isActive", false);
if (world.isRemote) {
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
TextFormatting.GRAY + I18n.format("techreborn.message.setTo") + " "
+ TextFormatting.GOLD + I18n
.format("techreborn.message.nanosaberInactive")));
}
}
}
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
}
return new ActionResult<>(EnumActionResult.PASS, stack);
}
@Override
public boolean onEntityItemUpdate(ItemStack stack, EntityItem entity) {
if (ItemUtils.isActive(stack) && new ForgePowerItemManager(stack).getEnergyStored() < cost) {
if(entity.world.isRemote){
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
TextFormatting.GRAY + I18n.format("techreborn.message.nanosaberEnergyError") + " "
+ TextFormatting.GOLD + I18n
.format("techreborn.message.nanosaberDeactivating")));
}
stack.getTag().putBoolean("isActive", false);
}
return false;
}
@OnlyIn(Dist.CLIENT)
@Override
public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
if (!ItemUtils.isActive(stack)) {
tooltip.add(new TextComponentString(TextFormatting.YELLOW + "Shear: " + TextFormatting.RED + I18n.format("techreborn.message.nanosaberInactive")));
} else {
tooltip.add(new TextComponentString(TextFormatting.YELLOW + "Shear: " + TextFormatting.GREEN + I18n.format("techreborn.message.nanosaberActive")));
}
}
@Override
public boolean canHarvestBlock(IBlockState blockIn) {
return Items.DIAMOND_AXE.canHarvestBlock(blockIn);

View file

@ -26,28 +26,39 @@ package techreborn.items.tool.industrial;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemTier;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import reborncore.common.powerSystem.ExternalPowerSystems;
import reborncore.common.powerSystem.forge.ForgePowerItemManager;
import reborncore.common.util.ChatUtils;
import reborncore.common.util.ItemUtils;
import techreborn.config.ConfigTechReborn;
import techreborn.init.TRContent;
import techreborn.items.tool.ItemDrill;
import techreborn.utils.MessageIDs;
import javax.annotation.Nullable;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class ItemIndustrialDrill extends ItemDrill {
@ -105,12 +116,15 @@ public class ItemIndustrialDrill extends ItemDrill {
ForgePowerItemManager capEnergy = new ForgePowerItemManager(drill);
capEnergy.extractEnergy(cost, false);
ExternalPowerSystems.requestEnergyFromArmor(capEnergy, playerIn);
if(capEnergy.getEnergyStored() > cost){
capEnergy.extractEnergy(cost, false);
ExternalPowerSystems.requestEnergyFromArmor(capEnergy, playerIn);
blockState.getBlock().harvestBlock(world, playerIn, pos, blockState, world.getTileEntity(pos), drill);
world.removeBlock(pos);
world.removeTileEntity(pos);
blockState.getBlock().removedByPlayer(blockState, world, pos, playerIn, true, null);
blockState.getBlock().harvestBlock(world, playerIn, pos, blockState, world.getTileEntity(pos), drill);
world.removeBlock(pos);
world.removeTileEntity(pos);
}
}
private boolean shouldBreak(EntityPlayer playerIn, World worldIn, BlockPos originalPos, BlockPos pos) {
@ -143,12 +157,74 @@ public class ItemIndustrialDrill extends ItemDrill {
if ((entityLiving instanceof EntityPlayer)) {
playerIn = (EntityPlayer) entityLiving;
}
for (BlockPos additionalPos : getTargetBlocks(worldIn, pos, playerIn)) {
breakBlock(additionalPos, worldIn, playerIn, stack);
if(ItemUtils.isActive(stack)){
for (BlockPos additionalPos : getTargetBlocks(worldIn, pos, playerIn)) {
breakBlock(additionalPos, worldIn, playerIn, stack);
}
}
return super.onBlockDestroyed(stack, worldIn, blockIn, pos, entityLiving);
}
@Override
public ActionResult<ItemStack> onItemRightClick(final World world, final EntityPlayer player, final EnumHand hand) {
final ItemStack stack = player.getHeldItem(hand);
if (player.isSneaking()) {
if (new ForgePowerItemManager(stack).getEnergyStored() < cost) {
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
TextFormatting.GRAY + I18n.format("techreborn.message.nanosaberEnergyErrorTo") + " "
+ TextFormatting.GOLD + I18n
.format("techreborn.message.nanosaberActivate")));
} else {
if (!ItemUtils.isActive(stack)) {
if (stack.getTag() == null) {
stack.setTag(new NBTTagCompound());
}
stack.getTag().putBoolean("isActive", true);
if (world.isRemote) {
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
TextFormatting.GRAY + I18n.format("techreborn.message.setTo") + " "
+ TextFormatting.GOLD + I18n
.format("techreborn.message.nanosaberActive")));
}
} else {
stack.getTag().putBoolean("isActive", false);
if (world.isRemote) {
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
TextFormatting.GRAY + I18n.format("techreborn.message.setTo") + " "
+ TextFormatting.GOLD + I18n
.format("techreborn.message.nanosaberInactive")));
}
}
}
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
}
return new ActionResult<>(EnumActionResult.PASS, stack);
}
@Override
public boolean onEntityItemUpdate(ItemStack stack, EntityItem entity) {
if (ItemUtils.isActive(stack) && new ForgePowerItemManager(stack).getEnergyStored() < cost) {
if(entity.world.isRemote){
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
TextFormatting.GRAY + I18n.format("techreborn.message.nanosaberEnergyError") + " "
+ TextFormatting.GOLD + I18n
.format("techreborn.message.nanosaberDeactivating")));
}
stack.getTag().putBoolean("isActive", false);
}
return false;
}
@OnlyIn(Dist.CLIENT)
@Override
public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
if (!ItemUtils.isActive(stack)) {
tooltip.add(new TextComponentString(TextFormatting.YELLOW + "Shear: " + TextFormatting.RED + I18n.format("techreborn.message.nanosaberInactive")));
} else {
tooltip.add(new TextComponentString(TextFormatting.YELLOW + "Shear: " + TextFormatting.GREEN + I18n.format("techreborn.message.nanosaberActive")));
}
}
// ItemPickaxe
@Override
public boolean canHarvestBlock(IBlockState blockIn) {

View file

@ -24,17 +24,27 @@
package techreborn.packets;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.network.NetworkEvent;
import reborncore.common.network.ExtendedPacketBuffer;
import reborncore.common.network.NetworkManager;
import reborncore.common.network.NetworkPacket;
import techreborn.init.TRContent;
import techreborn.items.ItemManual;
import techreborn.tiles.fusionReactor.TileFusionControlComputer;
import techreborn.tiles.machine.tier1.TileAutoCraftingTable;
import techreborn.tiles.machine.tier1.TileRollingMachine;
import techreborn.tiles.storage.TileAdjustableSU;
import techreborn.tiles.storage.idsu.TileInterdimensionalSU;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
public class ServerboundPackets {
public static final ResourceLocation AESU = new ResourceLocation("techreborn", "aesu");
@ -42,6 +52,7 @@ public class ServerboundPackets {
public static final ResourceLocation ROLLING_MACHINE_LOCK = new ResourceLocation("techreborn", "rolling_machine_lock");
public static final ResourceLocation FUSION_CONTROL_SIZE = new ResourceLocation("techreborn", "fusion_control_size");
public static final ResourceLocation IDSU = new ResourceLocation("techreborn", "idsu");
public static final ResourceLocation REFUND = new ResourceLocation("techreborn", "refund");
public static void init() {
NetworkManager.registerPacketHandler(AESU, (extendedPacketBuffer, context) -> {
@ -50,7 +61,7 @@ public class ServerboundPackets {
context.enqueueWork(() -> {
TileEntity tile = context.getSender().world.getTileEntity(pos);
if (tile instanceof TileAdjustableSU) {
((TileAdjustableSU) tile).handleGuiInputFromClient(buttonID);
((TileAdjustableSU) tile).handleGuiInputFromClient(buttonID, false, false);
}
});
});
@ -98,6 +109,26 @@ public class ServerboundPackets {
}
});
});
NetworkManager.registerPacketHandler(REFUND, (extendedPacketBuffer, context) -> {
if(!ItemManual.allowRefund){
return;
}
context.enqueueWork(() -> {
EntityPlayerMP playerMP = context.getSender();
for (int i = 0; i < playerMP.inventory.getSizeInventory(); i++) {
ItemStack stack = playerMP.inventory.getStackInSlot(i);
if (stack.getItem() == TRContent.MANUAL) {
playerMP.inventory.removeStackFromSlot(i);
playerMP.inventory.addItemStackToInventory(new ItemStack(Items.BOOK));
//TODO 1.13
//playerMP.inventory.addItemStackToInventory(OreUtil.getStackFromName("ingotRefinedIron"));
return;
}
}
});
});
}
public static NetworkPacket createPacketAesu(int buttonID, TileAdjustableSU tile) {
@ -135,4 +166,10 @@ public class ServerboundPackets {
});
}
public static NetworkPacket createRefundPacket(){
return NetworkManager.createPacket(REFUND, extendedPacketBuffer -> {
});
}
}

View file

@ -24,7 +24,6 @@
package techreborn.tiles;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -35,6 +34,7 @@ import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import reborncore.api.IToolDrop;
import reborncore.common.util.ChatUtils;
import reborncore.common.util.StringUtils;
import techreborn.blocks.BlockAlarm;
import techreborn.init.ModSounds;
import techreborn.init.TRContent;
@ -56,7 +56,8 @@ public class TileAlarm extends TileEntity
} else {
selectedSound = 1;
}
ChatUtils.sendNoSpamMessages(MessageIDs.alarmID, new TextComponentString(TextFormatting.GRAY + I18n.format("techreborn.message.alarm") + " " + "Alarm " + selectedSound));
ChatUtils.sendNoSpamMessages(MessageIDs.alarmID, new TextComponentString(
TextFormatting.GRAY + StringUtils.t("techreborn.message.alarm") + " " + "Alarm " + selectedSound));
}
}

View file

@ -75,6 +75,7 @@ public class TileFusionControlComputer extends TilePowerAcceptor
int outputStackSlot = 2;
FusionReactorRecipe currentRecipe = null;
boolean hasStartedCrafting = false;
long lastTick = -1;
public TileFusionControlComputer() {
super(TRTileEntities.FUSION_CONTROL_COMPUTER);
@ -181,7 +182,8 @@ public class TileFusionControlComputer extends TilePowerAcceptor
* @return boolean True if reactor can execute recipe provided
*/
private boolean validateReactorRecipe(FusionReactorRecipe recipe) {
return validateReactorRecipeInputs(recipe, inventory.getStackInSlot(topStackSlot), inventory.getStackInSlot(bottomStackSlot)) || validateReactorRecipeInputs(recipe, inventory.getStackInSlot(bottomStackSlot), inventory.getStackInSlot(topStackSlot));
boolean validRecipe = validateReactorRecipeInputs(recipe, inventory.getStackInSlot(topStackSlot), inventory.getStackInSlot(bottomStackSlot)) || validateReactorRecipeInputs(recipe, inventory.getStackInSlot(bottomStackSlot), inventory.getStackInSlot(topStackSlot));
return validRecipe && getSize() >= recipe.getMinSize();
}
private boolean validateReactorRecipeInputs(FusionReactorRecipe recipe, ItemStack slot1, ItemStack slot2) {
@ -207,6 +209,12 @@ public class TileFusionControlComputer extends TilePowerAcceptor
return;
}
if(lastTick == world.getGameTime()){
//Prevent tick accerators, blame obstinate for this.
return;
}
lastTick = world.getGameTime();
// Force check every second
if (world.getGameTime() % 20 == 0) {
checkCoils();

View file

@ -89,7 +89,7 @@ public class TileLightningRod extends TilePowerAcceptor implements IToolDrop {
world.addWeatherEffect(lightningBolt);
world.spawnEntity(lightningBolt);
addEnergy(baseEnergyStrike * (0.3F + weatherStrength));
((BlockMachineBase) getBlockType()).setActive(true, world, pos);
((BlockMachineBase) world.getBlockState(pos).getBlock()).setActive(true, world, pos);
onStatusHoldTicks = 400;
}
}

View file

@ -47,7 +47,7 @@ public class TileThermalGenerator extends TileBaseFluidGenerator implements ICon
@ConfigRegistry(config = "generators", category = "thermal_generator", key = "ThermalGeneratorTankCapacity", comment = "Thermal Generator Tank Capacity")
public static int tankCapacity = 10_000;
@ConfigRegistry(config = "generators", category = "thermal_generator", key = "ThermalGeneratorEnergyPerTick", comment = "Thermal Generator Energy Per Tick (Value in EU)")
public static int energyPerTick = 10;
public static int energyPerTick = 16;
public TileThermalGenerator() {
super(TRTileEntities.THERMAL_GEN, EFluidGenerator.THERMAL, "TileThermalGenerator", tankCapacity, energyPerTick);

View file

@ -58,6 +58,9 @@ public class TileImplosionCompressor extends TileGenericMachine implements ICont
}
public boolean getMutliBlock() {
if(multiblockChecker == null){
return false;
}
final boolean down = multiblockChecker.checkRectY(1, 1, MultiblockChecker.REINFORCED_CASING, MultiblockChecker.ZERO_OFFSET);
final boolean up = multiblockChecker.checkRectY(1, 1, MultiblockChecker.REINFORCED_CASING, new BlockPos(0, 2, 0));
final boolean chamber = multiblockChecker.checkRingYHollow(1, 1, MultiblockChecker.REINFORCED_CASING, new BlockPos(0, 1, 0));
@ -68,21 +71,13 @@ public class TileImplosionCompressor extends TileGenericMachine implements ICont
@Override
public void tick() {
if (multiblockChecker == null) {
final BlockPos downCenter = pos.offset(getFacing().getOpposite(), 2);
multiblockChecker = new MultiblockChecker(world, downCenter);
multiblockChecker = new MultiblockChecker(world, pos.down(3));
}
if (!world.isRemote && getMutliBlock()){
super.tick();
}
}
// TileEntity
@Override
public void validate() {
super.validate();
multiblockChecker = new MultiblockChecker(world, pos.down(3));
}
// IContainerProvider
@Override

View file

@ -105,6 +105,9 @@ public class TileIndustrialBlastFurnace extends TileGenericMachine implements IC
}
public boolean getMutliBlock() {
if(multiblockChecker == null){
return false;
}
final boolean layer0 = multiblockChecker.checkRectY(1, 1, MultiblockChecker.CASING_ANY, MultiblockChecker.ZERO_OFFSET);
final boolean layer1 = multiblockChecker.checkRingY(1, 1, MultiblockChecker.CASING_ANY, new BlockPos(0, 1, 0));
final boolean layer2 = multiblockChecker.checkRingY(1, 1, MultiblockChecker.CASING_ANY, new BlockPos(0, 2, 0));
@ -132,7 +135,7 @@ public class TileIndustrialBlastFurnace extends TileGenericMachine implements IC
multiblockChecker = new MultiblockChecker(world, downCenter);
}
if (!world.isRemote && getMutliBlock()){
if (getMutliBlock()){
super.tick();
}
}

View file

@ -167,7 +167,6 @@ public class TileElectricFurnace extends TilePowerAcceptor
}
}
} else {
progress = 0;
updateState();
}
if (burning != isBurning()) {

View file

@ -29,6 +29,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import reborncore.api.IToolDrop;
import reborncore.api.tile.IUpgrade;
import reborncore.api.tile.ItemHandlerProvider;
import reborncore.client.containerBuilder.IContainerProvider;
import reborncore.client.containerBuilder.builder.BuiltContainer;
@ -50,6 +51,8 @@ public class TileRecycler extends TilePowerAcceptor
public static int maxInput = 32;
@ConfigRegistry(config = "machines", category = "recycler", key = "RecyclerMaxEnergy", comment = "Recycler Max Energy (Value in EU)")
public static int maxEnergy = 1000;
@ConfigRegistry(config = "machines", category = "recycler", key = "produceIC2Scrap", comment = "When enabled and when ic2 is installed the recycler will make ic2 scrap")
public static boolean produceIC2Scrap = false;
private final Inventory<TileRecycler> inventory = new Inventory<>(3, "TileRecycler", 64, this).withConfiguredAccess();
private final int cost = 2;
@ -75,7 +78,7 @@ public class TileRecycler extends TilePowerAcceptor
}
public void recycleItems() {
final ItemStack itemstack = TRContent.Parts.SCRAP.getStack();
ItemStack itemstack = TRContent.Parts.SCRAP.getStack();
final int randomchance = this.world.rand.nextInt(chance);
if (randomchance == 1) {
@ -201,7 +204,7 @@ public class TileRecycler extends TilePowerAcceptor
@Override
public BuiltContainer createContainer(EntityPlayer player) {
return new ContainerBuilder("recycler").player(player.inventory).inventory().hotbar().addInventory()
.tile(this).slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue()
.tile(this).slot(0, 55, 45, itemStack -> itemStack.getItem() instanceof IUpgrade).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue()
.syncIntegerValue(this::getProgress, this::setProgress).addInventory().create(this);
}
}

View file

@ -38,6 +38,7 @@ import reborncore.api.tile.ItemHandlerProvider;
import reborncore.client.containerBuilder.IContainerProvider;
import reborncore.client.containerBuilder.builder.BuiltContainer;
import reborncore.client.containerBuilder.builder.ContainerBuilder;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry;
@ -50,8 +51,10 @@ import techreborn.init.TRTileEntities;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
//TODO add tick and power bars.
@ -121,6 +124,7 @@ public class TileRollingMachine extends TilePowerAcceptor
InventoryCrafting craftMatrix = getCraftingMatrix();
currentRecipe = RollingMachineRecipe.instance.findMatchingRecipe(craftMatrix, world);
if (currentRecipe != null) {
setIsActive(true);
if (world.getGameTime() % 2 == 0) {
Optional<InventoryCrafting> balanceResult = balanceRecipe(craftMatrix);
if (balanceResult.isPresent()) {
@ -149,6 +153,8 @@ public class TileRollingMachine extends TilePowerAcceptor
inventory.setStackInSlot(outputSlot, stack);
tickTime = 0;
hasCrafted = true;
} else {
setIsActive(false);
}
}
if (hasCrafted) {
@ -169,13 +175,27 @@ public class TileRollingMachine extends TilePowerAcceptor
&& canMake(craftMatrix)) {
useEnergy(getEuPerTick(energyPerTick));
tickTime++;
} else {
setIsActive(false);
}
}
if (currentRecipeOutput.isEmpty()) {
tickTime = 0;
currentRecipe = null;
setIsActive(canMake(getCraftingMatrix()));
}
}
public void setIsActive(boolean active) {
if (active == isRunning){
return;
}
isRunning = active;
if (this.getWorld().getBlockState(this.getPos()).getBlock() instanceof BlockMachineBase) {
BlockMachineBase blockMachineBase = (BlockMachineBase)this.getWorld().getBlockState(this.getPos()).getBlock();
blockMachineBase.setActive(active, this.getWorld(), this.getPos());
}
this.getWorld().notifyBlockUpdate(this.getPos(), this.getWorld().getBlockState(this.getPos()), this.getWorld().getBlockState(this.getPos()), 3);
}
public Optional<InventoryCrafting> balanceRecipe(InventoryCrafting craftCache) {
@ -213,6 +233,45 @@ public class TileRollingMachine extends TilePowerAcceptor
}
}
if(!possibleSlots.isEmpty()){
int totalItems = possibleSlots.stream()
.mapToInt(value -> inventory.getStackInSlot(value).getCount()).sum();
int slots = possibleSlots.size();
//This makes an array of ints with the best possible slot distribution
int[] split = new int[slots];
int remainder = totalItems % slots;
Arrays.fill(split, totalItems / slots);
while (remainder > 0){
for (int i = 0; i < split.length; i++) {
if(remainder > 0){
split[i] +=1;
remainder --;
}
}
}
List<Integer> slotDistrubution = possibleSlots.stream()
.mapToInt(value -> inventory.getStackInSlot(value).getCount())
.boxed().collect(Collectors.toList());
boolean needsBalance = false;
for (int i = 0; i < split.length; i++) {
int required = split[i];
if(slotDistrubution.contains(required)){
//We need to remove the int, not at the int, this seems to work around that
slotDistrubution.remove(new Integer(required));
} else {
needsBalance = true;
}
}
if (!needsBalance) {
return Optional.empty();
}
} else {
return Optional.empty();
}
//Slot, count
Pair<Integer, Integer> bestSlot = null;
for (Integer slot : possibleSlots) {

View file

@ -28,6 +28,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import reborncore.api.power.EnumPowerTier;
import reborncore.api.tile.IUpgrade;
import reborncore.client.containerBuilder.IContainerProvider;
import reborncore.client.containerBuilder.builder.BuiltContainer;
import reborncore.client.containerBuilder.builder.ContainerBuilder;
@ -42,9 +43,9 @@ import techreborn.init.TRTileEntities;
public class TileAdjustableSU extends TileEnergyStorage implements IContainerProvider {
@ConfigRegistry(config = "machines", category = "aesu", key = "AesuMaxInput", comment = "AESU Max Input (Value in EU)")
public static int maxInput = 8192;
public static int maxInput = 16192;
@ConfigRegistry(config = "machines", category = "aesu", key = "AesuMaxOutput", comment = "AESU Max Output (Value in EU)")
public static int maxOutput = 8192;
public static int maxOutput = 16192;
@ConfigRegistry(config = "machines", category = "aesu", key = "AesuMaxEnergy", comment = "AESU Max Energy (Value in EU)")
public static int maxEnergy = 100_000_000;
@ -54,22 +55,58 @@ public class TileAdjustableSU extends TileEnergyStorage implements IContainerPro
public TileAdjustableSU() {
super(TRTileEntities.ADJUSTABLE_SU, "ADJUSTABLE_SU", 4, TRContent.Machine.ADJUSTABLE_SU.block, EnumPowerTier.INSANE, maxInput, maxOutput, maxEnergy);
}
public void handleGuiInputFromClient(int id) {
int superconductors = 0;
@Override
public void tick() {
super.tick();
superconductors = 0;
for (int i = 0; i < getUpgradeSlotCount(); i++) {
ItemStack stack = getUpgradeInvetory().getStackInSlot(i);
if(false){ //TODO 1.13
superconductors++;
}
}
if (OUTPUT > getMaxConfigOutput()) {
OUTPUT = getMaxConfigOutput();
}
if(world.getGameTime() % 20 == 0){
checkTier();
}
}
public int getMaxConfigOutput(){
int extra = 0;
if(superconductors > 0){
extra = (int) Math.pow(2, (superconductors + 2)) * maxOutput;
}
return maxOutput + extra;
}
public void handleGuiInputFromClient(int id, boolean shift, boolean ctrl) {
if (id == 300) {
OUTPUT += 256;
OUTPUT += shift ? 4096 : 256;
if(ctrl){
//Set to max, limited to the max later
OUTPUT = Integer.MAX_VALUE;
}
}
if (id == 301) {
OUTPUT += 64;
OUTPUT += shift ? 512 : 64;
}
if (id == 302) {
OUTPUT -= 64;
OUTPUT -= shift ? 512 : 64;
}
if (id == 303) {
OUTPUT -= 256;
OUTPUT -= shift ? 4096 : 256;
if(ctrl){
OUTPUT = 1;
}
}
if (OUTPUT > maxOutput) {
OUTPUT = maxOutput;
if (OUTPUT > getMaxConfigOutput()) {
OUTPUT = getMaxConfigOutput();
}
if (OUTPUT <= -1) {
OUTPUT = 0;
@ -104,6 +141,25 @@ public class TileAdjustableSU extends TileEnergyStorage implements IContainerPro
return OUTPUT;
}
@Override
public double getMaxOutput() {
return OUTPUT;
}
@Override
public double getBaseMaxInput() {
//If we have super conductors increase the max input of the machine
if(getMaxConfigOutput() > maxOutput){
return getMaxConfigOutput();
}
return maxInput;
}
@Override
public EnumPowerTier getBaseTier() {
return null;
}
// TilePowerAcceptor
@Override
public NBTTagCompound write(NBTTagCompound tagCompound) {
@ -127,4 +183,14 @@ public class TileAdjustableSU extends TileEnergyStorage implements IContainerPro
.complete(8, 18).addArmor().addInventory().tile(this).energySlot(0, 62, 45).energySlot(1, 98, 45)
.syncEnergyValue().syncIntegerValue(this::getCurrentOutput, this::setCurentOutput).addInventory().create(this);
}
@Override
public boolean canBeUpgraded() {
return true;
}
@Override
public boolean isUpgradeValid(IUpgrade upgrade, ItemStack stack) {
return false; //TODO 1.13
}
}

View file

@ -76,6 +76,9 @@ public class TileTransformer extends TilePowerAcceptor
this.maxInput = tier.getMaxInput();
this.maxOutput = tier.getMaxOutput();
this.maxStorage = tier.getMaxInput() * 2;
// Should always be 4, except if we're tier MICRO, in which it will be 1.
super.setMaxPacketsPerTick(tier.getMaxOutput() / ouputTier.getMaxInput());
}
// TilePowerAcceptor

View file

@ -45,6 +45,11 @@
"textures": {
"layer0": "techreborn:items/cables/insulatedhv"
}
},
"superconductor": {
"textures": {
"layer0": "techreborn:items/cables/superconductor"
}
}
}
}

View file

@ -77,6 +77,11 @@
"textures": {
"cable": "techreborn:blocks/cables/hv_insulated_cable"
}
},
"superconductor": {
"textures": {
"cable": "techreborn:blocks/cables/superconductor_cable"
}
}
}
}

View file

@ -146,6 +146,7 @@ tile.techreborn.cable.glassfiber.name=Glass Fiber Cable
tile.techreborn.cable.insulatedcopper.name=Insulated Copper Cable
tile.techreborn.cable.insulatedgold.name=Insulated Gold Cable
tile.techreborn.cable.insulatedhv.name=Insulated HV Cable
tile.techreborn.cable.superconductor.name=Superconductor Cable
#Fluid blocks
tile.techreborn.berylium.name=Beryllium
@ -487,6 +488,7 @@ item.techreborn.part.coolant_six.name=60k Coolant Cell
item.techreborn.part.carbon_mesh.name=Carbon Mesh
item.techreborn.part.carbon_fiber.name=Carbon Fiber
item.techreborn.part.uuMatter.name=UU-Matter
item.techreborn.part.enhanced_super_conductor.name=Enhanced Superconductor
#Items-Armor
item.techreborn.cloakingdevice.name=Cloaking Device
@ -528,6 +530,7 @@ item.techreborn.scrapbox.name=Scrap Box
item.techreborn.upgrade.overclock.name=Overclocker Upgrade
item.techreborn.upgrade.transformer.name=Transformer Upgrade
item.techreborn.upgrade.energy_storage.name=Energy Storage Upgrade
item.techreborn.upgrade.superconductor.name=Superconductor Upgrade
item.bronzeSword.name=Bronze Sword
@ -627,8 +630,10 @@ techreborn.tooltip.alarm=Shift rightclick to change sound
#ManualUI
techreborn.manual.wiki=Online wiki
techreborn.manual.discord=Our discord
techreborn.manual.refund=I want a refund
techreborn.manual.wikibtn=Open
techreborn.manual.discordbtn=Join
techreborn.manual.refundbtn=Refund
#Advancements
advancements.techreborn.root.desc=Now that you have acquired Tech Reborn ore, you might find a tree tap usefull.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 552 B

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 552 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB