Feature/fluidreplicator (#1482)
Added Fluid Replicator multiblock machine.
This commit is contained in:
parent
7b275bebb1
commit
fef10740ba
29 changed files with 1202 additions and 121 deletions
|
@ -68,4 +68,5 @@ public class Reference {
|
|||
public static String RECYCLER_RECIPE = "RECYCLER_RECIPE";
|
||||
public static String SCRAPBOX_RECIPE = "SCRAPBOX_RECIPE";
|
||||
public static String VACUUM_FREEZER_RECIPE = "VACUUM_FREEZER_RECIPE";
|
||||
public static String FLUID_REPLICATOR_RECIPE = "FLUID_REPLICATOR_RECIPE";
|
||||
}
|
||||
|
|
|
@ -0,0 +1,139 @@
|
|||
/*
|
||||
* 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.api.fluidreplicator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import techreborn.init.ModItems;
|
||||
import techreborn.tiles.multiblock.TileFluidReplicator;
|
||||
|
||||
/**
|
||||
* @author drcrazy
|
||||
*
|
||||
*/
|
||||
public class FluidReplicatorRecipe implements Cloneable {
|
||||
|
||||
/**
|
||||
* This is the UU matter amount that is required as input
|
||||
* <p>
|
||||
* This cannot be null
|
||||
*/
|
||||
@Nonnull
|
||||
private final int input;
|
||||
|
||||
/**
|
||||
* This is the fluid we will produce
|
||||
* <p>
|
||||
* This cannot be null
|
||||
*/
|
||||
@Nonnull
|
||||
private final Fluid output;
|
||||
|
||||
/**
|
||||
* This is the time in ticks that the recipe takes to complete
|
||||
*/
|
||||
private final int tickTime;
|
||||
|
||||
/**
|
||||
* This is the EU that charges every tick to replicate fluid.
|
||||
*/
|
||||
private final int euPerTick;
|
||||
|
||||
/**
|
||||
* @param input int Amount of UU-matter per bucket
|
||||
* @param output Fluid Fluid to replicate
|
||||
* @param tickTime int Production time for recipe
|
||||
* @param euPerTick int EU amount per tick
|
||||
*/
|
||||
public FluidReplicatorRecipe(int input, Fluid output, int tickTime, int euPerTick) {
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.tickTime = tickTime;
|
||||
this.euPerTick = euPerTick;
|
||||
}
|
||||
|
||||
public int getInput() {
|
||||
return input;
|
||||
}
|
||||
|
||||
public Fluid getFluid() {
|
||||
return output;
|
||||
}
|
||||
|
||||
public int getTickTime() {
|
||||
return tickTime;
|
||||
}
|
||||
|
||||
public int getEuTick() {
|
||||
return euPerTick;
|
||||
}
|
||||
|
||||
public List<Object> getInputs() {
|
||||
ArrayList<Object> inputs = new ArrayList<>();
|
||||
inputs.add(new ItemStack(ModItems.UU_MATTER, input));
|
||||
return inputs;
|
||||
}
|
||||
|
||||
public boolean useOreDic() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canCraft(TileFluidReplicator tile) {
|
||||
if (!tile.getMultiBlock()) {
|
||||
return false;
|
||||
}
|
||||
final BlockPos hole = tile.getPos().offset(tile.getFacing().getOpposite(), 2);
|
||||
final Fluid fluid = FluidRegistry.lookupFluidForBlock(tile.getWorld().getBlockState(hole).getBlock());
|
||||
if (fluid == null) {
|
||||
return false;
|
||||
}
|
||||
if (!fluid.equals(output)) {
|
||||
return false;
|
||||
}
|
||||
final Fluid tankFluid = tile.tank.getFluidType();
|
||||
if (tankFluid != null && !tankFluid.equals(output)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean onCraft(TileFluidReplicator tile) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Cloneable
|
||||
@Override
|
||||
public Object clone() throws CloneNotSupportedException {
|
||||
return super.clone();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,204 @@
|
|||
/*
|
||||
* 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.api.fluidreplicator;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import reborncore.common.recipes.RecipeCrafter;
|
||||
import reborncore.common.util.Inventory;
|
||||
import reborncore.common.util.Tank;
|
||||
import techreborn.api.Reference;
|
||||
import techreborn.init.ModItems;
|
||||
import techreborn.tiles.multiblock.TileFluidReplicator;
|
||||
|
||||
/**
|
||||
* @author drcrazy
|
||||
*
|
||||
*/
|
||||
public class FluidReplicatorRecipeCrafter extends RecipeCrafter {
|
||||
|
||||
public FluidReplicatorRecipe currentRecipe;
|
||||
int ticksSinceLastChange;
|
||||
|
||||
/**
|
||||
* RecipeCrafter for Fluid Replicator
|
||||
*
|
||||
* @param parentTile TileEntity Reference to the tile having this crafter
|
||||
* @param inventory Inventory reference to inventory used for crafting
|
||||
* @param inputSlots This is the list of the slots that the crafting logic should look for the input UU-Matter.
|
||||
* @param outputSlots This is the list of slots that the crafting logic should look for output fluid
|
||||
*/
|
||||
public FluidReplicatorRecipeCrafter(TileEntity parentTile, Inventory inventory, int[] inputSlots, int[] outputSlots) {
|
||||
super(Reference.FLUID_REPLICATOR_RECIPE, parentTile, 1, 1, inventory, inputSlots, outputSlots);
|
||||
}
|
||||
|
||||
/**
|
||||
* FluidReplicatorRecipe version of hasAllInputs
|
||||
*/
|
||||
private boolean hasAllInputs(FluidReplicatorRecipe recipe) {
|
||||
if (recipe == null) {
|
||||
return false;
|
||||
}
|
||||
ItemStack inputStack = inventory.getStackInSlot(inputSlots[0]);
|
||||
if (!inputStack.isItemEqual(new ItemStack(ModItems.UU_MATTER))) {
|
||||
return false;
|
||||
}
|
||||
if (inputStack.getCount() < recipe.getInput()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean canFit(Fluid fluid, Tank tank) {
|
||||
if (tank.fill(new FluidStack(fluid, Fluid.BUCKET_VOLUME), false) != Fluid.BUCKET_VOLUME) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setCurrentRecipe(FluidReplicatorRecipe recipe) {
|
||||
try {
|
||||
this.currentRecipe = (FluidReplicatorRecipe) recipe.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// RecipeCrafter
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (parentTile.getWorld().isRemote) {
|
||||
return;
|
||||
}
|
||||
ticksSinceLastChange++;
|
||||
// Force a has changed every second
|
||||
if (ticksSinceLastChange >= 20) {
|
||||
setInvDirty(true);
|
||||
ticksSinceLastChange = 0;
|
||||
}
|
||||
// It will now look for new recipes.
|
||||
if (currentRecipe == null && isInvDirty()) {
|
||||
updateCurrentRecipe();
|
||||
}
|
||||
if(currentRecipe != null) {
|
||||
// If it doesn't have all the inputs reset
|
||||
if (isInvDirty() && !hasAllInputs()) {
|
||||
currentRecipe = null;
|
||||
currentTickTime = 0;
|
||||
setIsActive();
|
||||
}
|
||||
// If it has reached the recipe tick time
|
||||
if (currentRecipe != null && currentTickTime >= currentNeededTicks && hasAllInputs()) {
|
||||
TileFluidReplicator tileFluidReplicator = (TileFluidReplicator) parentTile;
|
||||
// Checks to see if it can fit the output
|
||||
// And fill tank with replicated fluid
|
||||
if (canFit(currentRecipe.getFluid(), tileFluidReplicator.tank) && currentRecipe.onCraft(tileFluidReplicator)) {
|
||||
tileFluidReplicator.tank.fill(new FluidStack(currentRecipe.getFluid(), Fluid.BUCKET_VOLUME), true);
|
||||
// This uses all the inputs
|
||||
useAllInputs();
|
||||
// Reset
|
||||
currentRecipe = null;
|
||||
currentTickTime = 0;
|
||||
updateCurrentRecipe();
|
||||
//Update active state if the tile isnt going to start crafting again
|
||||
if(currentRecipe == null){
|
||||
setIsActive();
|
||||
}
|
||||
}
|
||||
} else if (currentRecipe != null && currentTickTime < currentNeededTicks) {
|
||||
// This uses the power
|
||||
if (energy.canUseEnergy(getEuPerTick(currentRecipe.getEuTick()))) {
|
||||
energy.useEnergy(getEuPerTick(currentRecipe.getEuTick()));
|
||||
// Increase the ticktime
|
||||
currentTickTime ++;
|
||||
if(currentTickTime == 1 || currentTickTime % 20 == 0 && soundHanlder != null){
|
||||
soundHanlder.playSound(false, parentTile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
setInvDirty(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCurrentRecipe() {
|
||||
TileFluidReplicator tileFluidReplicator = (TileFluidReplicator) parentTile;
|
||||
for (FluidReplicatorRecipe recipe : FluidReplicatorRecipeList.recipes) {
|
||||
if (recipe.canCraft(tileFluidReplicator) && hasAllInputs(recipe)) {
|
||||
if (!canFit(recipe.getFluid(), tileFluidReplicator.tank)) {
|
||||
this.currentRecipe = null;
|
||||
currentTickTime = 0;
|
||||
setIsActive();
|
||||
return;
|
||||
}
|
||||
setCurrentRecipe(recipe);
|
||||
currentNeededTicks = Math.max((int) (currentRecipe.getTickTime()* (1.0 - getSpeedMultiplier())), 1);
|
||||
currentTickTime = 0;
|
||||
setIsActive();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAllInputs() {
|
||||
if (this.currentRecipe == null) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return hasAllInputs(this.currentRecipe);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void useAllInputs() {
|
||||
if (currentRecipe == null) {
|
||||
return;
|
||||
}
|
||||
if (hasAllInputs(currentRecipe)) {
|
||||
inventory.decrStackSize(inputSlots[0], currentRecipe.getInput());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCraftAgain() {
|
||||
TileFluidReplicator tileFluidReplicator = (TileFluidReplicator) parentTile;
|
||||
for (FluidReplicatorRecipe recipe : FluidReplicatorRecipeList.recipes) {
|
||||
if (recipe.canCraft(tileFluidReplicator) && hasAllInputs(recipe)) {
|
||||
if (!canFit(recipe.getFluid(), tileFluidReplicator.tank)) {
|
||||
return false;
|
||||
}
|
||||
if (energy.getEnergy() < recipe.getEuTick()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* 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.api.fluidreplicator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.commons.lang3.Validate;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
/**
|
||||
* @author drcrazy
|
||||
*
|
||||
*/
|
||||
public class FluidReplicatorRecipeList {
|
||||
|
||||
/**
|
||||
* This is the list of all the recipes
|
||||
*/
|
||||
public static ArrayList<FluidReplicatorRecipe> recipes = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Register your Fluid Replicator recipe
|
||||
*
|
||||
* @param recipe FluidReplicatorRecipe The recipe you want to add
|
||||
*/
|
||||
public static void addRecipe(FluidReplicatorRecipe recipe) {
|
||||
Validate.notNull(recipe);
|
||||
Validate.isTrue(!recipes.contains(recipe));
|
||||
Validate.validState(recipe.getInput() >= 1);
|
||||
Validate.validState(!getRecipeForFluid(recipe.getFluid()).isPresent());
|
||||
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fluid Replicator recipe you want to remove
|
||||
*
|
||||
* @param recipe FluidReplicatorRecipe Recipe to remove
|
||||
* @return boolean true if recipe was removed from list of recipes
|
||||
*/
|
||||
public static boolean removeRecipe(FluidReplicatorRecipe recipe) {
|
||||
return recipes.remove(recipe);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if there is a Fluid Replicator recipe for that fluid
|
||||
*
|
||||
* @param fluid Fluid Fluid to search for
|
||||
* @return FluidReplicatorRecipe Recipe for fluid provided
|
||||
*/
|
||||
public static Optional<FluidReplicatorRecipe> getRecipeForFluid(Fluid fluid) {
|
||||
return recipes.stream().filter(recipe -> recipe.getFluid().equals(fluid)).findAny();
|
||||
}
|
||||
}
|
|
@ -22,28 +22,39 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.blocks;
|
||||
package techreborn.blocks.advanced_machine;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.common.BaseTileBlock;
|
||||
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.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.TilePump;
|
||||
import techreborn.lib.ModInfo;
|
||||
import techreborn.tiles.multiblock.TileFluidReplicator;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 08/05/2016.
|
||||
*/
|
||||
public class BlockPump extends BaseTileBlock {
|
||||
public BlockPump() {
|
||||
super(Material.IRON);
|
||||
setHardness(2f);
|
||||
setUnlocalizedName("techreborn.pump");
|
||||
public class BlockFluidReplicator extends BlockMachineBase {
|
||||
|
||||
public BlockFluidReplicator() {
|
||||
super();
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/tier3_machines"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
||||
return new TilePump();
|
||||
return new TileFluidReplicator();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMachineGuiHandler getGui() {
|
||||
return EGui.FLUID_REPLICATOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAdvanced() {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -73,7 +73,8 @@ public enum EGui implements IMachineGuiHandler {
|
|||
SCRAPBOXINATOR(true),
|
||||
SEMIFLUID_GENERATOR(true),
|
||||
THERMAL_GENERATOR(true),
|
||||
VACUUM_FREEZER(true);
|
||||
VACUUM_FREEZER(true),
|
||||
FLUID_REPLICATOR(true);
|
||||
|
||||
private final boolean containerBuilder;
|
||||
|
||||
|
|
|
@ -158,6 +158,8 @@ public class GuiHandler implements IGuiHandler {
|
|||
return new GuiDistillationTower(player, (TileDistillationTower) tile);
|
||||
case MANUAL:
|
||||
return new GuiManual(player);
|
||||
case FLUID_REPLICATOR:
|
||||
return new GuiFluidReplicator(player, (TileFluidReplicator) tile);
|
||||
default:
|
||||
break;
|
||||
|
||||
|
|
148
src/main/java/techreborn/client/gui/GuiFluidReplicator.java
Normal file
148
src/main/java/techreborn/client/gui/GuiFluidReplicator.java
Normal file
|
@ -0,0 +1,148 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import reborncore.client.multiblock.Multiblock;
|
||||
import reborncore.client.multiblock.MultiblockRenderEvent;
|
||||
import reborncore.client.multiblock.MultiblockSet;
|
||||
import techreborn.blocks.BlockMachineCasing;
|
||||
import techreborn.client.gui.widget.GuiButtonHologram;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.proxies.ClientProxy;
|
||||
import techreborn.tiles.multiblock.TileFluidReplicator;
|
||||
|
||||
/**
|
||||
* @author drcrazy
|
||||
*
|
||||
*/
|
||||
public class GuiFluidReplicator extends GuiBase {
|
||||
|
||||
TileFluidReplicator tile;
|
||||
|
||||
public GuiFluidReplicator(final EntityPlayer player, final TileFluidReplicator tile) {
|
||||
super(player, tile, tile.createContainer(player));
|
||||
this.tile = tile;
|
||||
}
|
||||
|
||||
public void addHologramButton(int x, int y, int id, Layer layer) {
|
||||
if (id == 0)
|
||||
buttonList.clear();
|
||||
int factorX = 0;
|
||||
int factorY = 0;
|
||||
if (layer == Layer.BACKGROUND) {
|
||||
factorX = guiLeft;
|
||||
factorY = guiTop;
|
||||
}
|
||||
buttonList.add(new GuiButtonHologram(id, x + factorX, y + factorY, this, layer));
|
||||
}
|
||||
|
||||
public void addComponent(final int x, final int y, final int z, final IBlockState blockState, final Multiblock multiblock) {
|
||||
multiblock.addComponent(new BlockPos(x, y, z), blockState);
|
||||
}
|
||||
|
||||
// GuiBase
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
ClientProxy.multiblockRenderEvent.setMultiblock(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) {
|
||||
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
|
||||
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
|
||||
// Battery slot
|
||||
drawSlot(8, 72, layer);
|
||||
// Input slot
|
||||
drawSlot(55, 45, layer);
|
||||
// Liquid input slot
|
||||
drawSlot(124, 35, layer);
|
||||
// Liquid output slot
|
||||
drawSlot(124, 55, layer);
|
||||
// JEI button
|
||||
builder.drawJEIButton(this, 150, 4, layer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
|
||||
|
||||
builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer);
|
||||
builder.drawTank(this, 99, 25, mouseX, mouseY, tile.tank.getFluid(), tile.tank.getCapacity(), tile.tank.isEmpty(), layer);
|
||||
builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer);
|
||||
if (tile.getMultiBlock()) {
|
||||
addHologramButton(6, 4, 212, layer);
|
||||
builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer);
|
||||
} else {
|
||||
builder.drawMultiblockMissingBar(this, layer);
|
||||
addHologramButton(76, 56, 212, layer);
|
||||
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
|
||||
}
|
||||
}
|
||||
|
||||
// GuiScreen
|
||||
@Override
|
||||
public void actionPerformed(final GuiButton button) throws IOException {
|
||||
super.actionPerformed(button);
|
||||
if (button.id == 212 && !GuiBase.showSlotConfig) {
|
||||
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
|
||||
{
|
||||
// This code here makes a basic multiblock and then sets to the selected one.
|
||||
final Multiblock multiblock = new Multiblock();
|
||||
final IBlockState reinforcedCasing = ModBlocks.MACHINE_CASINGS.getDefaultState()
|
||||
.withProperty(BlockMachineCasing.TYPE, "reinforced");
|
||||
|
||||
addComponent(1, 0, 0, reinforcedCasing, multiblock);
|
||||
addComponent(0, 0, 1, reinforcedCasing, multiblock);
|
||||
addComponent(-1, 0, 0, reinforcedCasing, multiblock);
|
||||
addComponent(0, 0, -1, reinforcedCasing, multiblock);
|
||||
addComponent(-1, 0, -1, reinforcedCasing, multiblock);
|
||||
addComponent(-1, 0, 1, reinforcedCasing, multiblock);
|
||||
addComponent(1, 0, -1, reinforcedCasing, multiblock);
|
||||
addComponent(1, 0, 1, reinforcedCasing, multiblock);
|
||||
|
||||
final MultiblockSet set = new MultiblockSet(multiblock);
|
||||
ClientProxy.multiblockRenderEvent.setMultiblock(set);
|
||||
ClientProxy.multiblockRenderEvent.parent = tile.getPos();
|
||||
MultiblockRenderEvent.anchor = new BlockPos(
|
||||
this.tile.getPos().getX()
|
||||
- EnumFacing.getFront(this.tile.getFacingInt()).getFrontOffsetX() * 2,
|
||||
this.tile.getPos().getY() - 1, this.tile.getPos().getZ()
|
||||
- EnumFacing.getFront(this.tile.getFacingInt()).getFrontOffsetZ() * 2);
|
||||
}
|
||||
} else {
|
||||
ClientProxy.multiblockRenderEvent.setMultiblock(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* 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.compat.crafttweaker;
|
||||
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* 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.compat.crafttweaker;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
|
@ -42,6 +42,7 @@ public class RecipeCategoryUids {
|
|||
public static final String SCRAPBOX = "TechReborn.Scrapbox";
|
||||
public static final String INDUSTRIAL_SAWMILL = "TechReborn.IndustrialSawmill";
|
||||
public static final String DISTILLATION_TOWER = "TechReborn.DistillationTower";
|
||||
public static final String FLUID_REPLICATOR = "TechReborn.FluidReplicator";
|
||||
|
||||
private RecipeCategoryUids() {
|
||||
}
|
||||
|
|
|
@ -48,6 +48,8 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
import org.lwjgl.input.Mouse;
|
||||
import reborncore.api.recipe.RecipeHandler;
|
||||
import techreborn.Core;
|
||||
import techreborn.api.fluidreplicator.FluidReplicatorRecipe;
|
||||
import techreborn.api.fluidreplicator.FluidReplicatorRecipeList;
|
||||
import techreborn.api.generator.EFluidGenerator;
|
||||
import techreborn.api.generator.FluidGeneratorRecipe;
|
||||
import techreborn.api.generator.GeneratorRecipeHelper;
|
||||
|
@ -75,6 +77,8 @@ import techreborn.compat.jei.distillationTower.DistillationTowerRecipeCategory;
|
|||
import techreborn.compat.jei.distillationTower.DistillationTowerRecipeWrapper;
|
||||
import techreborn.compat.jei.extractor.ExtractorRecipeCategory;
|
||||
import techreborn.compat.jei.extractor.ExtractorRecipeWrapper;
|
||||
import techreborn.compat.jei.fluidReplicator.FluidReplicatorRecipeCategory;
|
||||
import techreborn.compat.jei.fluidReplicator.FluidReplicatorRecipeWrapper;
|
||||
import techreborn.compat.jei.fusionReactor.FusionReactorRecipeCategory;
|
||||
import techreborn.compat.jei.fusionReactor.FusionReactorRecipeWrapper;
|
||||
import techreborn.compat.jei.generators.fluid.FluidGeneratorRecipeCategory;
|
||||
|
@ -146,41 +150,37 @@ public class TechRebornJeiPlugin implements IModPlugin {
|
|||
final IJeiHelpers jeiHelpers = registry.getJeiHelpers();
|
||||
final IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
|
||||
|
||||
registry.addRecipeCategories(
|
||||
new AlloySmelterRecipeCategory(guiHelper),
|
||||
new AssemblingMachineRecipeCategory(guiHelper),
|
||||
new BlastFurnaceRecipeCategory(guiHelper),
|
||||
new CentrifugeRecipeCategory(guiHelper),
|
||||
new ChemicalReactorRecipeCategory(guiHelper),
|
||||
new DistillationTowerRecipeCategory(guiHelper),
|
||||
new FusionReactorRecipeCategory(guiHelper),
|
||||
new GrinderRecipeCategory(guiHelper),
|
||||
new ImplosionCompressorRecipeCategory(guiHelper),
|
||||
new IndustrialGrinderRecipeCategory(guiHelper),
|
||||
new IndustrialElectrolyzerRecipeCategory(guiHelper),
|
||||
new IndustrialSawmillRecipeCategory(guiHelper),
|
||||
new RollingMachineRecipeCategory(guiHelper),
|
||||
new VacuumFreezerRecipeCategory(guiHelper));
|
||||
registry.addRecipeCategories(new AlloySmelterRecipeCategory(guiHelper));
|
||||
registry.addRecipeCategories(new AssemblingMachineRecipeCategory(guiHelper));
|
||||
registry.addRecipeCategories(new BlastFurnaceRecipeCategory(guiHelper));
|
||||
registry.addRecipeCategories(new CentrifugeRecipeCategory(guiHelper));
|
||||
registry.addRecipeCategories(new ChemicalReactorRecipeCategory(guiHelper));
|
||||
registry.addRecipeCategories(new DistillationTowerRecipeCategory(guiHelper));
|
||||
registry.addRecipeCategories(new FusionReactorRecipeCategory(guiHelper));
|
||||
registry.addRecipeCategories(new GrinderRecipeCategory(guiHelper));
|
||||
registry.addRecipeCategories(new ImplosionCompressorRecipeCategory(guiHelper));
|
||||
registry.addRecipeCategories(new IndustrialGrinderRecipeCategory(guiHelper));
|
||||
registry.addRecipeCategories(new IndustrialElectrolyzerRecipeCategory(guiHelper));
|
||||
registry.addRecipeCategories(new IndustrialSawmillRecipeCategory(guiHelper));
|
||||
registry.addRecipeCategories(new RollingMachineRecipeCategory(guiHelper));
|
||||
registry.addRecipeCategories(new VacuumFreezerRecipeCategory(guiHelper));
|
||||
registry.addRecipeCategories(new FluidReplicatorRecipeCategory(guiHelper));
|
||||
|
||||
for (final EFluidGenerator type : EFluidGenerator.values())
|
||||
registry.addRecipeCategories(new FluidGeneratorRecipeCategory(type, guiHelper));
|
||||
|
||||
if (CompatConfigs.showScrapbox) {
|
||||
registry.addRecipeCategories(new ScrapboxRecipeCategory(guiHelper));
|
||||
}
|
||||
|
||||
for (final EFluidGenerator type : EFluidGenerator.values())
|
||||
registry.addRecipeCategories(new FluidGeneratorRecipeCategory(type, guiHelper));
|
||||
|
||||
if (!IC2Duplicates.deduplicate()) {
|
||||
registry.addRecipeCategories(
|
||||
new CompressorRecipeCategory(guiHelper),
|
||||
new ExtractorRecipeCategory(guiHelper));
|
||||
registry.addRecipeCategories(new CompressorRecipeCategory(guiHelper));
|
||||
registry.addRecipeCategories(new ExtractorRecipeCategory(guiHelper));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(
|
||||
@Nonnull
|
||||
final
|
||||
IModRegistry registry) {
|
||||
public void register(@Nonnull final IModRegistry registry) {
|
||||
final IJeiHelpers jeiHelpers = registry.getJeiHelpers();
|
||||
|
||||
jeiHelpers.getIngredientBlacklist().addIngredientToBlacklist(new ItemStack(ModFluids.BLOCK_BERYLLIUM));
|
||||
|
@ -218,6 +218,11 @@ public class TechRebornJeiPlugin implements IModPlugin {
|
|||
jeiHelpers.getIngredientBlacklist().addIngredientToBlacklist(new ItemStack(ModFluids.BLOCK_ELECTROLYZED_WATER));
|
||||
jeiHelpers.getIngredientBlacklist().addIngredientToBlacklist(new ItemStack(ModFluids.BLOCK_COMPRESSED_AIR));
|
||||
jeiHelpers.getIngredientBlacklist().addIngredientToBlacklist(new ItemStack(ModItems.MISSING_RECIPE_PLACEHOLDER));
|
||||
|
||||
if (CompatManager.isQuantumStorageLoaded) {
|
||||
jeiHelpers.getIngredientBlacklist().addIngredientToBlacklist(new ItemStack(ModBlocks.QUANTUM_CHEST));
|
||||
jeiHelpers.getIngredientBlacklist().addIngredientToBlacklist(new ItemStack(ModBlocks.QUANTUM_TANK));
|
||||
}
|
||||
|
||||
if (IC2Duplicates.deduplicate()) {
|
||||
for (final IC2Duplicates duplicate : IC2Duplicates.values()) {
|
||||
|
@ -256,8 +261,13 @@ public class TechRebornJeiPlugin implements IModPlugin {
|
|||
registry.handleRecipes(IndustrialSawmillRecipe.class, recipe -> new IndustrialSawmillRecipeWrapper(jeiHelpers, recipe), RecipeCategoryUids.INDUSTRIAL_SAWMILL);
|
||||
registry.handleRecipes(VacuumFreezerRecipe.class, recipe -> new VacuumFreezerRecipeWrapper(jeiHelpers, recipe), RecipeCategoryUids.VACUUM_FREEZER);
|
||||
registry.handleRecipes(DistillationTowerRecipe.class, recipe -> new DistillationTowerRecipeWrapper(jeiHelpers, recipe), RecipeCategoryUids.DISTILLATION_TOWER);
|
||||
registry.handleRecipes(FluidReplicatorRecipe.class, recipe -> new FluidReplicatorRecipeWrapper(jeiHelpers,recipe), RecipeCategoryUids.FLUID_REPLICATOR);
|
||||
registry.addRecipeHandlers(new RollingMachineRecipeHandler());
|
||||
|
||||
for (final EFluidGenerator type : EFluidGenerator.values()) {
|
||||
registry.handleRecipes(FluidGeneratorRecipe.class, recipe -> new FluidGeneratorRecipeWrapper(jeiHelpers, recipe), type.getRecipeID());
|
||||
}
|
||||
|
||||
if (CompatConfigs.showScrapbox) {
|
||||
registry.handleRecipes(ScrapboxRecipe.class, recipe -> new ScrapboxRecipeWrapper(jeiHelpers, recipe), RecipeCategoryUids.SCRAPBOX);
|
||||
}
|
||||
|
@ -267,18 +277,15 @@ public class TechRebornJeiPlugin implements IModPlugin {
|
|||
registry.handleRecipes(ExtractorRecipe.class, recipe -> new ExtractorRecipeWrapper(jeiHelpers, recipe), RecipeCategoryUids.EXTRACTOR);
|
||||
}
|
||||
|
||||
for (final EFluidGenerator type : EFluidGenerator.values()) {
|
||||
registry.handleRecipes(FluidGeneratorRecipe.class, recipe -> new FluidGeneratorRecipeWrapper(jeiHelpers, recipe), type.getRecipeID());
|
||||
}
|
||||
|
||||
registry.addRecipes(RecipeHandler.recipeList.stream().filter(recipe -> {
|
||||
if(recipe instanceof ScrapboxRecipe){
|
||||
if (recipe instanceof ScrapboxRecipe) {
|
||||
return CompatConfigs.showScrapbox;
|
||||
}
|
||||
return true;
|
||||
}).collect(Collectors.toList()));
|
||||
|
||||
registry.addRecipes(FusionReactorRecipeHelper.reactorRecipes, RecipeCategoryUids.FUSION_REACTOR);
|
||||
registry.addRecipes(FluidReplicatorRecipeList.recipes, RecipeCategoryUids.FLUID_REPLICATOR);
|
||||
GeneratorRecipeHelper.fluidRecipes.forEach((type, list) -> registry.addRecipes(list.getRecipes(), type.getRecipeID()));
|
||||
|
||||
try {
|
||||
|
@ -324,7 +331,8 @@ public class TechRebornJeiPlugin implements IModPlugin {
|
|||
addRecipeClickArea(GuiScrapboxinator.class, 150, 4, 18, 18, RecipeCategoryUids.SCRAPBOX);
|
||||
addRecipeClickArea(GuiFusionReactor.class, 150, 4, 18, 18, RecipeCategoryUids.FUSION_REACTOR);
|
||||
addRecipeClickArea(GuiRollingMachine.class, 150, 4, 20, 12, RecipeCategoryUids.ROLLING_MACHINE);
|
||||
|
||||
addRecipeClickArea(GuiFluidReplicator.class, 150, 4, 20, 12, RecipeCategoryUids.FLUID_REPLICATOR);
|
||||
|
||||
//OLD ONES
|
||||
addRecipeClickArea(GuiAlloyFurnace.class, 80, 35, 26, 20, RecipeCategoryUids.ALLOY_SMELTER,
|
||||
VanillaRecipeCategoryUid.FUEL);
|
||||
|
@ -356,6 +364,7 @@ public class TechRebornJeiPlugin implements IModPlugin {
|
|||
registry.addRecipeCatalyst(new ItemStack(ModBlocks.INDUSTRIAL_SAWMILL), RecipeCategoryUids.INDUSTRIAL_SAWMILL);
|
||||
registry.addRecipeCatalyst(new ItemStack(ModBlocks.ROLLING_MACHINE), RecipeCategoryUids.ROLLING_MACHINE);
|
||||
registry.addRecipeCatalyst(new ItemStack(ModBlocks.DISTILLATION_TOWER), RecipeCategoryUids.DISTILLATION_TOWER);
|
||||
registry.addRecipeCatalyst(new ItemStack(ModBlocks.FLUID_REPLICATOR), RecipeCategoryUids.FLUID_REPLICATOR);
|
||||
|
||||
if (CompatConfigs.showScrapbox) {
|
||||
registry.addRecipeCatalyst(new ItemStack(ModItems.SCRAP_BOX), RecipeCategoryUids.SCRAPBOX);
|
||||
|
@ -364,52 +373,43 @@ public class TechRebornJeiPlugin implements IModPlugin {
|
|||
final IRecipeTransferRegistry recipeTransferRegistry = registry.getRecipeTransferRegistry();
|
||||
|
||||
recipeTransferRegistry.addRecipeTransferHandler(
|
||||
new BuiltContainerTransferInfo("fusionreactor", RecipeCategoryUids.FUSION_REACTOR, 36, 2, 0, 36));
|
||||
new BuiltContainerTransferInfo("fusionreactor", RecipeCategoryUids.FUSION_REACTOR, 36, 2, 0, 36));
|
||||
recipeTransferRegistry.addRecipeTransferHandler(
|
||||
new BuiltContainerTransferInfo("industrialelectrolyzer", RecipeCategoryUids.INDUSTRIAL_ELECTROLYZER, 36,
|
||||
2, 0, 36));
|
||||
new BuiltContainerTransferInfo("industrialelectrolyzer", RecipeCategoryUids.INDUSTRIAL_ELECTROLYZER, 36, 2, 0, 36));
|
||||
recipeTransferRegistry.addRecipeTransferHandler(
|
||||
new BuiltContainerTransferInfo("industrialgrinder", RecipeCategoryUids.GRINDER, 36, 2, 0, 36));
|
||||
new BuiltContainerTransferInfo("industrialgrinder", RecipeCategoryUids.GRINDER, 36, 2, 0, 36));
|
||||
recipeTransferRegistry.addRecipeTransferHandler(
|
||||
new BuiltContainerTransferInfo("implosioncompressor", RecipeCategoryUids.IMPLOSION_COMPRESSOR, 36, 2, 0,
|
||||
36));
|
||||
new BuiltContainerTransferInfo("implosioncompressor", RecipeCategoryUids.IMPLOSION_COMPRESSOR, 36, 2, 0, 36));
|
||||
recipeTransferRegistry.addRecipeTransferHandler(
|
||||
new BuiltContainerTransferInfo("vacuumfreezer", RecipeCategoryUids.VACUUM_FREEZER, 36, 1, 0, 36));
|
||||
new BuiltContainerTransferInfo("vacuumfreezer", RecipeCategoryUids.VACUUM_FREEZER, 36, 1, 0, 36));
|
||||
recipeTransferRegistry.addRecipeTransferHandler(
|
||||
new BuiltContainerTransferInfo("blastfurnace", RecipeCategoryUids.BLAST_FURNACE, 36, 2, 0, 36));
|
||||
new BuiltContainerTransferInfo("blastfurnace", RecipeCategoryUids.BLAST_FURNACE, 36, 2, 0, 36));
|
||||
recipeTransferRegistry.addRecipeTransferHandler(
|
||||
new BuiltContainerTransferInfo("rollingmachine", RecipeCategoryUids.ROLLING_MACHINE, 36, 9, 0, 36));
|
||||
new BuiltContainerTransferInfo("rollingmachine", RecipeCategoryUids.ROLLING_MACHINE, 36, 9, 0, 36));
|
||||
recipeTransferRegistry.addRecipeTransferHandler(
|
||||
new BuiltContainerTransferInfo("alloyfurnace", RecipeCategoryUids.ALLOY_SMELTER, 36, 2, 0, 36));
|
||||
new BuiltContainerTransferInfo("alloyfurnace", RecipeCategoryUids.ALLOY_SMELTER, 36, 2, 0, 36));
|
||||
recipeTransferRegistry.addRecipeTransferHandler(
|
||||
new BuiltContainerTransferInfo("alloyfurnace", VanillaRecipeCategoryUid.FUEL, 36, 2, 0, 36));
|
||||
new BuiltContainerTransferInfo("alloyfurnace", VanillaRecipeCategoryUid.FUEL, 36, 2, 0, 36));
|
||||
recipeTransferRegistry.addRecipeTransferHandler(
|
||||
new BuiltContainerTransferInfo("alloysmelter", RecipeCategoryUids.ALLOY_SMELTER, 36, 2, 0, 36));
|
||||
new BuiltContainerTransferInfo("alloysmelter", RecipeCategoryUids.ALLOY_SMELTER, 36, 2, 0, 36));
|
||||
recipeTransferRegistry.addRecipeTransferHandler(
|
||||
new BuiltContainerTransferInfo("assemblingmachine", RecipeCategoryUids.ASSEMBLING_MACHINE, 36, 2, 0,
|
||||
36));
|
||||
new BuiltContainerTransferInfo("assemblingmachine", RecipeCategoryUids.ASSEMBLING_MACHINE, 36, 2, 0, 36));
|
||||
recipeTransferRegistry.addRecipeTransferHandler(
|
||||
new BuiltContainerTransferInfo("chemicalreactor", RecipeCategoryUids.CHEMICAL_REACTOR, 36, 2, 0, 36));
|
||||
new BuiltContainerTransferInfo("chemicalreactor", RecipeCategoryUids.CHEMICAL_REACTOR, 36, 2, 0, 36));
|
||||
recipeTransferRegistry.addRecipeTransferHandler(
|
||||
new BuiltContainerTransferInfo("centrifuge", RecipeCategoryUids.CENTRIFUGE, 36, 2, 0, 36));
|
||||
new BuiltContainerTransferInfo("centrifuge", RecipeCategoryUids.CENTRIFUGE, 36, 2, 0, 36));
|
||||
recipeTransferRegistry.addRecipeTransferHandler(
|
||||
new BuiltContainerTransferInfo("grinder", RecipeCategoryUids.GRINDER, 36, 1, 0, 36));
|
||||
new BuiltContainerTransferInfo("grinder", RecipeCategoryUids.GRINDER, 36, 1, 0, 36));
|
||||
recipeTransferRegistry.addRecipeTransferHandler(
|
||||
new BuiltContainerTransferInfo("extractor", RecipeCategoryUids.EXTRACTOR, 36, 1, 0, 36));
|
||||
new BuiltContainerTransferInfo("extractor", RecipeCategoryUids.EXTRACTOR, 36, 1, 0, 36));
|
||||
recipeTransferRegistry.addRecipeTransferHandler(
|
||||
new BuiltContainerTransferInfo("compressor", RecipeCategoryUids.COMPRESSOR, 36, 1, 0, 36));
|
||||
new BuiltContainerTransferInfo("compressor", RecipeCategoryUids.COMPRESSOR, 36, 1, 0, 36));
|
||||
recipeTransferRegistry.addRecipeTransferHandler(
|
||||
new BuiltContainerTransferInfo("industrialsawmill", RecipeCategoryUids.INDUSTRIAL_SAWMILL, 36, 2, 0, 36));
|
||||
new BuiltContainerTransferInfo("industrialsawmill", RecipeCategoryUids.INDUSTRIAL_SAWMILL, 36, 2, 0, 36));
|
||||
recipeTransferRegistry.addRecipeTransferHandler(
|
||||
new BuiltContainerTransferInfo("distillationtower", RecipeCategoryUids.DISTILLATION_TOWER, 36, 2, 0, 36));
|
||||
|
||||
if (CompatManager.isQuantumStorageLoaded) {
|
||||
registry.getJeiHelpers().getIngredientBlacklist().addIngredientToBlacklist(new ItemStack(ModBlocks.QUANTUM_CHEST));
|
||||
registry.getJeiHelpers().getIngredientBlacklist().addIngredientToBlacklist(new ItemStack(ModBlocks.QUANTUM_TANK));
|
||||
}
|
||||
new BuiltContainerTransferInfo("distillationtower", RecipeCategoryUids.DISTILLATION_TOWER, 36, 2, 0, 36));
|
||||
|
||||
registry.addAdvancedGuiHandlers(new AdvancedGuiHandler());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -439,8 +439,6 @@ public class TechRebornJeiPlugin implements IModPlugin {
|
|||
|
||||
//Taken from JEI so we can have a custom impliemntation of it
|
||||
//This is done as I didnt see an easy way to disable the show recipes button when a certain condition is met
|
||||
|
||||
|
||||
public void addRecipeClickArea(Class<? extends GuiContainer> guiContainerClass, int xPos, int yPos, int width, int height, String... recipeCategoryUids) {
|
||||
ErrorUtil.checkNotNull(guiContainerClass, "guiContainerClass");
|
||||
ErrorUtil.checkNotEmpty(recipeCategoryUids, "recipeCategoryUids");
|
||||
|
@ -495,6 +493,5 @@ public class TechRebornJeiPlugin implements IModPlugin {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* 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.compat.jei.fluidReplicator;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IGuiFluidStackGroup;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IRecipeCategory;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import techreborn.compat.jei.RecipeCategoryUids;
|
||||
import techreborn.compat.jei.RecipeUtil;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* @author drcrazy
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class FluidReplicatorRecipeCategory implements IRecipeCategory<FluidReplicatorRecipeWrapper> {
|
||||
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/jei.png");
|
||||
private static final int[] OUTPUT_TANKS = { 0 };
|
||||
private static final int[] INPUT_SLOTS = { 0 };
|
||||
private final IDrawable background;
|
||||
private final IDrawable tankOverlay;
|
||||
private final String title;
|
||||
|
||||
public FluidReplicatorRecipeCategory(@Nonnull IGuiHelper guiHelper) {
|
||||
this.background = guiHelper.createDrawable(texture, 125, 0, 72, 60);
|
||||
this.tankOverlay = guiHelper.createDrawable(texture, 196, 0, 12, 47);
|
||||
this.title = I18n.translateToLocal("tile.techreborn:fluid_replicator.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUid() {
|
||||
return RecipeCategoryUids.FLUID_REPLICATOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModName() {
|
||||
return ModInfo.MOD_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDrawable getBackground() {
|
||||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayout recipeLayout, FluidReplicatorRecipeWrapper recipeWrapper, IIngredients ingredients) {
|
||||
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
|
||||
guiItemStacks.init(INPUT_SLOTS[0], true, 2, 21);
|
||||
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
|
||||
guiFluidStacks.init(OUTPUT_TANKS[0], false, 52, 6, 12, 47, 10_000, true, tankOverlay);
|
||||
RecipeUtil.setRecipeItems(recipeLayout, ingredients, INPUT_SLOTS, null, null, OUTPUT_TANKS);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* 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.compat.jei.fluidReplicator;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.IJeiHelpers;
|
||||
import mezz.jei.api.gui.IDrawableAnimated;
|
||||
import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import techreborn.api.fluidreplicator.FluidReplicatorRecipe;
|
||||
import techreborn.client.gui.TRBuilder;
|
||||
import techreborn.init.ModItems;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* @author drcrazy
|
||||
*
|
||||
*/
|
||||
public class FluidReplicatorRecipeWrapper implements IRecipeWrapper {
|
||||
private final FluidReplicatorRecipe recipe;
|
||||
private final IDrawableAnimated progress;
|
||||
|
||||
public FluidReplicatorRecipeWrapper(@Nonnull IJeiHelpers jeiHelpers, @Nonnull FluidReplicatorRecipe recipe) {
|
||||
this.recipe = recipe;
|
||||
IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
|
||||
IDrawableStatic progressStatic = guiHelper.createDrawable(TRBuilder.GUI_SHEET, 100, 151, 16, 10);
|
||||
int ticksPerCycle = recipe.getTickTime();
|
||||
this.progress = guiHelper.createAnimatedDrawable(progressStatic, ticksPerCycle,
|
||||
IDrawableAnimated.StartDirection.LEFT, false);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see mezz.jei.api.recipe.IRecipeWrapper#getIngredients(mezz.jei.api.ingredients.IIngredients)
|
||||
*/
|
||||
@Override
|
||||
public void getIngredients(IIngredients ingredients) {
|
||||
ingredients.setInput(ItemStack.class, new ItemStack(ModItems.UU_MATTER, recipe.getInput()));
|
||||
ingredients.setOutput(FluidStack.class, new FluidStack(recipe.getFluid(), Fluid.BUCKET_VOLUME));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
|
||||
progress.draw(minecraft, 25, 25);
|
||||
}
|
||||
}
|
|
@ -76,13 +76,7 @@ public class GrinderRecipeCategory implements IRecipeCategory<GrinderRecipeWrapp
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(
|
||||
@Nonnull
|
||||
IRecipeLayout recipeLayout,
|
||||
@Nonnull
|
||||
GrinderRecipeWrapper recipeWrapper,
|
||||
@Nonnull
|
||||
IIngredients ingredients) {
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull GrinderRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
|
||||
guiItemStacks.init(INPUT_SLOTS[0], true, 3, 7);
|
||||
guiItemStacks.init(OUTPUT_SLOTS[0], false, 49, 7);
|
||||
|
|
|
@ -34,7 +34,10 @@ import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
|||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
|
||||
import techreborn.api.fluidreplicator.FluidReplicatorRecipe;
|
||||
import techreborn.api.fluidreplicator.FluidReplicatorRecipeList;
|
||||
import techreborn.api.generator.EFluidGenerator;
|
||||
import techreborn.api.generator.FluidGeneratorRecipeList;
|
||||
import techreborn.api.generator.GeneratorRecipeHelper;
|
||||
import techreborn.compat.ICompatModule;
|
||||
import techreborn.init.ModItems;
|
||||
|
@ -78,6 +81,8 @@ public class RecipeThermalExpansion implements ICompatModule {
|
|||
ThermalExpansionHelper.addSmelterRecipe(4000, new ItemStack(Items.IRON_INGOT, 2), new ItemStack(Blocks.SAND), RecipeMethods.getMaterial("refined_iron", 2, RecipeMethods.Type.INGOT), ItemMaterial.crystalSlag.copy(), 25);
|
||||
|
||||
GeneratorRecipeHelper.registerFluidRecipe(EFluidGenerator.THERMAL, TFFluids.fluidPyrotheum, 80);
|
||||
|
||||
FluidReplicatorRecipeList.addRecipe(new FluidReplicatorRecipe(4, TFFluids.fluidCoal, 100, 20));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -153,6 +153,7 @@ public class ModBlocks {
|
|||
public static Block LAMP_INCANDESCENT;
|
||||
public static Block LAMP_LED;
|
||||
public static Block ALARM;
|
||||
public static Block FLUID_REPLICATOR;
|
||||
|
||||
/**
|
||||
* Register blocks
|
||||
|
@ -431,6 +432,10 @@ public class ModBlocks {
|
|||
ALARM = new BlockAlarm();
|
||||
registerBlock(ALARM, "alarm");
|
||||
GameRegistry.registerTileEntity(TileAlarm.class, "TileAlarmTR");
|
||||
|
||||
FLUID_REPLICATOR = new BlockFluidReplicator();
|
||||
registerBlock(FLUID_REPLICATOR, "fluid_replicator");
|
||||
GameRegistry.registerTileEntity(TileFluidReplicator.class, "TileFluidReplicatorTR");
|
||||
|
||||
//TODO enable when done
|
||||
// flare = new BlockFlare();
|
||||
|
|
|
@ -83,6 +83,7 @@ public class ModRecipes {
|
|||
FusionReactorRecipes.init();
|
||||
DistillationTowerRecipes.init();
|
||||
AlloySmelterRecipes.init();
|
||||
FluidReplicatorRecipes.init();
|
||||
|
||||
addBlastFurnaceRecipes();
|
||||
addVacuumFreezerRecipes();
|
||||
|
@ -107,23 +108,8 @@ public class ModRecipes {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
IndustrialSawmillRecipes.init();
|
||||
|
||||
//Let it be in postInit to be sure that oredict already there
|
||||
if (OreUtil.doesOreExistAndValid("stoneMarble")) {
|
||||
ItemStack marbleStack = getOre("stoneMarble");
|
||||
marbleStack.setCount(1);
|
||||
RecipeHandler.addRecipe(new GrinderRecipe(
|
||||
marbleStack, ItemDusts.getDustByName("marble"),
|
||||
120, 10));
|
||||
}
|
||||
if (OreUtil.doesOreExistAndValid("stoneBasalt")) {
|
||||
ItemStack marbleStack = getOre("stoneBasalt");
|
||||
marbleStack.setCount(1);
|
||||
RecipeHandler.addRecipe(new GrinderRecipe(
|
||||
marbleStack, ItemDusts.getDustByName("basalt"),
|
||||
120, 10));
|
||||
}
|
||||
}
|
||||
|
||||
private static void addCompressorRecipes() {
|
||||
|
@ -252,6 +238,21 @@ public class ModRecipes {
|
|||
ItemDusts.getDustByName("obsidian", 4),
|
||||
170, 19));
|
||||
|
||||
if (OreUtil.doesOreExistAndValid("stoneMarble")) {
|
||||
ItemStack marbleStack = getOre("stoneMarble");
|
||||
marbleStack.setCount(1);
|
||||
RecipeHandler.addRecipe(new GrinderRecipe(
|
||||
marbleStack, ItemDusts.getDustByName("marble"),
|
||||
120, 10));
|
||||
}
|
||||
if (OreUtil.doesOreExistAndValid("stoneBasalt")) {
|
||||
ItemStack marbleStack = getOre("stoneBasalt");
|
||||
marbleStack.setCount(1);
|
||||
RecipeHandler.addRecipe(new GrinderRecipe(
|
||||
marbleStack, ItemDusts.getDustByName("basalt"),
|
||||
120, 10));
|
||||
}
|
||||
|
||||
for (String oreDictionaryName : OreDictionary.getOreNames()) {
|
||||
if (isDictPrefixed(oreDictionaryName, "ore", "gem", "ingot")) {
|
||||
ItemStack oreStack = getDictOreOrEmpty(oreDictionaryName, 1);
|
||||
|
@ -418,5 +419,4 @@ public class ModRecipes {
|
|||
}
|
||||
return OreDictionary.getOres(name).get(0).copy();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public class OreDict {
|
|||
OreUtil.registerOre("lapotronCrystal", ModItems.LAPOTRONIC_CRYSTAL);
|
||||
OreUtil.registerOre("energyCrystal", ModItems.ENERGY_CRYSTAL);
|
||||
|
||||
OreUtil.registerOre("drillBasic", ModItems.DIAMOND_DRILL);
|
||||
OreUtil.registerOre("drillBasic", ModItems.STEEL_DRILL);
|
||||
OreUtil.registerOre("drillDiamond", ModItems.DIAMOND_DRILL);
|
||||
|
||||
OreUtil.registerOre("industrialTnt", Blocks.TNT);
|
||||
|
|
|
@ -51,7 +51,7 @@ public class CraftingTableRecipes extends RecipeMethods {
|
|||
registerCompressionRecipes();
|
||||
registerMixedMetalIngotRecipes();
|
||||
|
||||
registerShapeless(BlockStorage2.getStorageBlockByName("iridium_reinforced_stone", 1), getStack(Blocks.STONE), "plateIridiumAlloy");
|
||||
registerShapeless(BlockStorage2.getStorageBlockByName("iridium_reinforced_stone", 1), "stone", "plateIridiumAlloy");
|
||||
registerShapeless(BlockStorage2.getStorageBlockByName("iridium_reinforced_tungstensteel", 1), BlockStorage2.getStorageBlockByName("tungstensteel", 1), "plateIridium");
|
||||
registerShapeless(BlockStorage2.getStorageBlockByName("iridium_reinforced_tungstensteel", 1), BlockStorage2.getStorageBlockByName("iridium_reinforced_stone", 1), getMaterialObject("tungstensteel", Type.INGOT));
|
||||
registerShapeless(getStack(ModBlocks.RUBBER_PLANKS, 4), getStack(ModBlocks.RUBBER_LOG));
|
||||
|
@ -76,7 +76,7 @@ public class CraftingTableRecipes extends RecipeMethods {
|
|||
registerShaped(getStack(ModItems.DIAMOND_JACKHAMMER), "DSD", "TCT", " D ", 'D', "gemDiamond", 'C', "circuitAdvanced", 'S', getStack(ModItems.STEEL_JACKHAMMER, 1, OreDictionary.WILDCARD_VALUE), 'T', "ingotTitanium");
|
||||
registerShaped(getStack(ModItems.ADVANCED_JACKHAMMER), "NDN", "OCO", " I ", 'I', "plateIridiumAlloy", 'N', "nuggetIridium", 'D', getStack(ModItems.DIAMOND_DRILL, 1, OreDictionary.WILDCARD_VALUE), 'C', "circuitMaster", 'O', getMaterial("overclock", Type.UPGRADE));
|
||||
registerShaped(getStack(ModItems.CLOAKING_DEVICE), "CIC", "IOI", "CIC", 'C', "ingotChrome", 'I', "plateIridiumAlloy", 'O', getStack(ModItems.LAPOTRONIC_ORB));
|
||||
registerShaped(getStack(ModItems.LAPOTRONIC_ORB_PACK), "FOF", "SPS", "FIF", 'F', "circuitMaster", 'O', getStack(ModItems.LAPOTRONIC_ORB), 'S', getMaterial("super_conductor", Type.PART), 'I', "ingotIridium", 'P', getStack(ModItems.LITHIUM_BATTERY_PACK));
|
||||
registerShaped(getStack(ModItems.LAPOTRONIC_ORB_PACK), "FOF", "SPS", "FIF", 'F', "circuitMaster", 'O', getStack(ModItems.LAPOTRONIC_ORB), 'S', "craftingSuperconductor", 'I', "ingotIridium", 'P', getStack(ModItems.LITHIUM_BATTERY_PACK));
|
||||
|
||||
if (ConfigTechReborn.enableGemArmorAndTools) {
|
||||
addToolAndArmourRecipes(getStack(ModItems.RUBY_SWORD), getStack(ModItems.RUBY_PICKAXE), getStack(ModItems.RUBY_AXE), getStack(ModItems.RUBY_HOE), getStack(ModItems.RUBY_SPADE), getStack(ModItems.RUBY_HELMET), getStack(ModItems.RUBY_CHESTPLATE), getStack(ModItems.RUBY_LEGGINGS), getStack(ModItems.RUBY_BOOTS), "gemRuby");
|
||||
|
@ -125,20 +125,20 @@ public class CraftingTableRecipes extends RecipeMethods {
|
|||
registerShaped(getStack(ModBlocks.CHEMICAL_REACTOR), "IMI", "CPC", "IEI", 'I', "plateInvar", 'C', "circuitAdvanced", 'M', getStack(IC2Duplicates.EXTRACTOR), 'P', getStack(IC2Duplicates.COMPRESSOR), 'E', getStack(IC2Duplicates.EXTRACTOR));
|
||||
registerShaped(getStack(ModBlocks.ROLLING_MACHINE), "PCP", "MBM", "PCP", 'P', getStack(Blocks.PISTON), 'C', "circuitAdvanced", 'M', getStack(IC2Duplicates.COMPRESSOR), 'B', "machineBlockBasic");
|
||||
registerShaped(getStack(ModBlocks.AUTO_CRAFTING_TABLE), "MPM", "PCP", "MPM", 'M', "circuitAdvanced", 'C', "workbench", 'P', "plateIron");
|
||||
registerShaped(getStack(ModBlocks.CHARGE_O_MAT), "ETE", "COC", "EAE", 'E', "circuitMaster", 'T', "energyCrystal", 'C', getStack(Blocks.CHEST), 'O', getStack(ModItems.LAPOTRONIC_ORB), 'A', "machineBlockAdvanced");
|
||||
registerShaped(getStack(ModBlocks.CHARGE_O_MAT), "ETE", "COC", "EAE", 'E', "circuitMaster", 'T', "energyCrystal", 'C', "chest", 'O', getStack(ModItems.LAPOTRONIC_ORB), 'A', "machineBlockAdvanced");
|
||||
registerShaped(getStack(ModBlocks.ALLOY_SMELTER), " C ", "FMF", " ", 'C', "circuitBasic", 'F', getStack(IC2Duplicates.ELECTRICAL_FURNACE), 'M', "machineBlockBasic");
|
||||
registerShaped(getStack(ModBlocks.INTERDIMENSIONAL_SU), "PAP", "ACA", "PAP", 'P', "plateIridiumAlloy", 'C', getStack(Blocks.ENDER_CHEST), 'A', getStack(ModBlocks.ADJUSTABLE_SU));
|
||||
registerShaped(getStack(ModBlocks.INTERDIMENSIONAL_SU), "PAP", "ACA", "PAP", 'P', "plateIridiumAlloy", 'C', "chestEnder", 'A', getStack(ModBlocks.ADJUSTABLE_SU));
|
||||
registerShaped(getStack(ModBlocks.ADJUSTABLE_SU), "LLL", "LCL", "LLL", 'L', getStack(ModItems.LAPOTRONIC_ORB), 'C', "energyCrystal");
|
||||
registerShaped(getStack(ModBlocks.LAPOTRONIC_SU), " L ", "CBC", " M ", 'L', getStack(IC2Duplicates.LVT), 'C', "circuitAdvanced", 'M', getStack(IC2Duplicates.MVT), 'B', getStack(ModBlocks.LSU_STORAGE));
|
||||
registerShaped(getStack(ModBlocks.LSU_STORAGE), "LLL", "LCL", "LLL", 'L', "blockLapis", 'C', "circuitBasic");
|
||||
registerShaped(getStack(ModBlocks.SCRAPBOXINATOR), "ICI", "DSD", "ICI", 'S', getStack(ModItems.SCRAP_BOX), 'C', "circuitBasic", 'I', "plateIron", 'D', getStack(Blocks.DIRT));
|
||||
registerShaped(getStack(ModBlocks.SCRAPBOXINATOR), "ICI", "DSD", "ICI", 'S', getStack(ModItems.SCRAP_BOX), 'C', "circuitBasic", 'I', "plateIron", 'D', "dirt");
|
||||
registerShaped(getStack(ModBlocks.FUSION_CONTROL_COMPUTER), "CCC", "PTP", "CCC", 'P', "energyCrystal", 'T', getStack(ModBlocks.FUSION_COIL), 'C', "circuitMaster");
|
||||
registerShaped(getStack(ModBlocks.FUSION_COIL), "CSC", "NAN", "CRC", 'A', getStack(ModBlocks.MACHINE_CASINGS, 1, 2), 'N', getMaterial("nichromeHeatingCoil", Type.PART), 'C', "circuitMaster", 'S', getMaterial("superConductor", Type.PART), 'R', getMaterial("iridiumNeutronReflector", Type.PART));
|
||||
registerShaped(getStack(ModBlocks.FUSION_COIL), "CSC", "NAN", "CRC", 'A', getStack(ModBlocks.MACHINE_CASINGS, 1, 2), 'N', getMaterial("nichromeHeatingCoil", Type.PART), 'C', "circuitMaster", 'S', "craftingSuperconductor", 'R', getMaterial("iridiumNeutronReflector", Type.PART));
|
||||
registerShaped(getStack(ModBlocks.DIGITAL_CHEST), "PPP", "PDP", "PCP", 'P', "plateAluminum", 'D', getMaterial("data_orb", Type.PART), 'C', getMaterial("computer_monitor", Type.PART));
|
||||
registerShaped(getStack(ModBlocks.DIGITAL_CHEST), "PPP", "PDP", "PCP", 'P', "plateSteel", 'D', getMaterial("data_orb", Type.PART), 'C', getMaterial("computer_monitor", Type.PART));
|
||||
registerShaped(getStack(ModBlocks.MATTER_FABRICATOR), "ETE", "AOA", "ETE", 'E', "circuitMaster", 'T', getStack(IC2Duplicates.EXTRACTOR), 'A', getMaterial("highly_advanced_machine", Type.MACHINE_FRAME), 'O', getStack(ModItems.LAPOTRONIC_ORB));
|
||||
registerShaped(getStack(ModBlocks.COMPUTER_CUBE), "OMC", "MFM", "CMO", 'O', getMaterial("data_orb", Type.PART), 'M', getMaterial("computer_monitor", Type.PART), 'C', getMaterial("energy_flow_circuit", Type.PART), 'F', "machineBlockAdvanced");
|
||||
registerShaped(getStack(ModBlocks.PLAYER_DETECTOR, true), " D ", "CFC", " D ", 'D', getMaterial("data_storage_circuit", Type.PART), 'C', "circuitAdvanced", 'F', getStack(ModBlocks.COMPUTER_CUBE));
|
||||
registerShaped(getStack(ModBlocks.MATTER_FABRICATOR), "ETE", "AOA", "ETE", 'E', "circuitMaster", 'T', getStack(IC2Duplicates.EXTRACTOR), 'A', "machineBlockElite", 'O', getStack(ModItems.LAPOTRONIC_ORB));
|
||||
registerShaped(getStack(ModBlocks.COMPUTER_CUBE), "OMC", "MFM", "CMO", 'O', getMaterial("data_orb", Type.PART), 'M', getMaterial("computer_monitor", Type.PART), 'C', "circuitMaster", 'F', "machineBlockAdvanced");
|
||||
registerShaped(getStack(ModBlocks.PLAYER_DETECTOR, true), " D ", "CFC", " D ", 'D', "circuitStorage", 'C', "circuitAdvanced", 'F', getStack(ModBlocks.COMPUTER_CUBE));
|
||||
registerShaped(getStack(ModBlocks.DRAGON_EGG_SYPHON), "CTC", "PSP", "CBC", 'C', "circuitMaster", 'T', getStack(IC2Duplicates.MFE), 'P', "plateIridiumAlloy", 'S', "craftingSuperconductor", 'B', getStack(ModItems.LAPOTRONIC_ORB));
|
||||
registerShaped(getStack(ModBlocks.PLASMA_GENERATOR), "PPP", "PTP", "CGC", 'P', "plateTungstensteel", 'T', getStack(IC2Duplicates.HVT), 'C', "circuitMaster", 'G', getStack(IC2Duplicates.GENERATOR));
|
||||
registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 0), "DLD", "LDL", "CGC", 'D', "dustCoal", 'L', "paneGlass", 'G', getStack(IC2Duplicates.GENERATOR), 'C', "circuitBasic");
|
||||
|
@ -146,11 +146,12 @@ public class CraftingTableRecipes extends RecipeMethods {
|
|||
registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 1), "DLD", "LDL", "CPC", 'D', "dustCoal", 'L', "blockGlass", 'C', "circuitAdvanced", 'P', "machineBlockBasic");
|
||||
registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 2), "DLD", "LDL", "CPC", 'D', "dustDiamond", 'L', "blockGlass", 'C', "circuitAdvanced", 'P', getStack(ModBlocks.SOLAR_PANEL, 1, 1));
|
||||
registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 2), "DLD", "LDL", "CPC", 'D', "dustDiamond", 'L', "blockGlass", 'C', "circuitAdvanced", 'P', "machineBlockBasic");
|
||||
registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 3), "DLD", "LDL", "CPC", 'D', "dustDiamond", 'L', getStack(ModBlocks.REINFORCED_GLASS), 'C', "circuitAdvanced", 'P', getStack(ModBlocks.SOLAR_PANEL, 1, 2));
|
||||
registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 3), "DLD", "LDL", "CPC", 'D', "dustDiamond", 'L', getStack(ModBlocks.REINFORCED_GLASS), 'C', "circuitAdvanced", 'P', "machineBlockAdvanced");
|
||||
registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 4), "DLD", "LDL", "CPC", 'D', "dustDiamond", 'L', getStack(ModBlocks.REINFORCED_GLASS), 'C', "circuitMaster", 'P', getStack(ModBlocks.SOLAR_PANEL, 1, 3));
|
||||
registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 4), "DLD", "LDL", "CPC", 'D', "dustDiamond", 'L', getStack(ModBlocks.REINFORCED_GLASS), 'C', "circuitMaster", 'P', "machineBlockElite");
|
||||
registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 3), "DLD", "LDL", "CPC", 'D', "dustDiamond", 'L', "glassReinforced", 'C', "circuitAdvanced", 'P', getStack(ModBlocks.SOLAR_PANEL, 1, 2));
|
||||
registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 3), "DLD", "LDL", "CPC", 'D', "dustDiamond", 'L', "glassReinforced", 'C', "circuitAdvanced", 'P', "machineBlockAdvanced");
|
||||
registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 4), "DLD", "LDL", "CPC", 'D', "dustDiamond", 'L', "glassReinforced", 'C', "circuitMaster", 'P', getStack(ModBlocks.SOLAR_PANEL, 1, 3));
|
||||
registerShaped(getStack(ModBlocks.SOLAR_PANEL, 1, 4), "DLD", "LDL", "CPC", 'D', "dustDiamond", 'L', "glassReinforced", 'C', "circuitMaster", 'P', "machineBlockElite");
|
||||
registerShaped(getStack(ModBlocks.ALARM, 1, 0), "ICI", "SRS", "ICI", 'I', "ingotIron", 'C', getMaterial("copper", Type.CABLE), 'S', getMaterial("insulatedcopper", Type.CABLE), 'R', "blockRedstone" );
|
||||
registerShaped(getStack(ModBlocks.FLUID_REPLICATOR), "PCP", "CFC", "ESR", 'P', "plateTungstensteel", 'F', "machineBlockElite", 'C', "circuitMaster", 'E', getStack(ModBlocks.INDUSTRIAL_ELECTROLYZER), 'S', "craftingSuperconductor",'R', getStack(ModBlocks.CHEMICAL_REACTOR));
|
||||
|
||||
if (!IC2Duplicates.deduplicate()) {
|
||||
registerShaped(getStack(IC2Duplicates.HVT), " H ", " M ", " H ", 'M', getStack(IC2Duplicates.MVT), 'H', getStack(IC2Duplicates.CABLE_IHV));
|
||||
|
@ -159,9 +160,9 @@ public class CraftingTableRecipes extends RecipeMethods {
|
|||
registerShaped(getStack(IC2Duplicates.BAT_BOX), "WCW", "BBB", "WWW", 'W', "plankWood", 'B', "reBattery", 'C', getStack(IC2Duplicates.CABLE_ICOPPER));
|
||||
registerShaped(getStack(IC2Duplicates.MFE), "GEG", "EME", "GEG", 'M', "machineBlockBasic", 'E', "energyCrystal", 'G', getStack(IC2Duplicates.CABLE_IGOLD));
|
||||
registerShaped(getStack(IC2Duplicates.MFSU), "LAL", "LML", "LOL", 'A', "circuitAdvanced", 'L', "lapotronCrystal", 'M', getStack(IC2Duplicates.MFE), 'O', "machineBlockAdvanced");
|
||||
registerShaped(getStack(IC2Duplicates.COMPRESSOR), "S S", "SCS", "SMS", 'C', "circuitBasic", 'M', "machineBlockBasic", 'S', getStack(Blocks.STONE));
|
||||
registerShaped(getStack(IC2Duplicates.COMPRESSOR), "S S", "SCS", "SMS", 'C', "circuitBasic", 'M', "machineBlockBasic", 'S', "stone");
|
||||
registerShaped(getStack(IC2Duplicates.ELECTRICAL_FURNACE), " C ", "RFR", " ", 'C', "circuitBasic", 'F', getStack(IC2Duplicates.IRON_FURNACE), 'R', "dustRedstone");
|
||||
registerShaped(getStack(IC2Duplicates.RECYCLER), " E ", "DCD", "GDG", 'D', getStack(Blocks.DIRT), 'C', getStack(IC2Duplicates.COMPRESSOR), 'G', getMaterialObject("glowstone", Type.DUST), 'E', "circuitBasic");
|
||||
registerShaped(getStack(IC2Duplicates.RECYCLER), " E ", "DCD", "GDG", 'D', "dirt", 'C', getStack(IC2Duplicates.COMPRESSOR), 'G', "dustGlowstone", 'E', "circuitBasic");
|
||||
registerShaped(getStack(IC2Duplicates.IRON_FURNACE), "III", "I I", "III", 'I', "ingotIron");
|
||||
registerShaped(getStack(IC2Duplicates.IRON_FURNACE), " I ", "I I", "IFI", 'I', "ingotIron", 'F', getStack(Blocks.FURNACE));
|
||||
registerShaped(getStack(IC2Duplicates.EXTRACTOR), "TMT", "TCT", " ", 'T', getStack(ModItems.TREE_TAP, true), 'M', "machineBlockBasic", 'C', "circuitBasic");
|
||||
|
@ -170,7 +171,7 @@ public class CraftingTableRecipes extends RecipeMethods {
|
|||
}
|
||||
|
||||
if (!CompatManager.isQuantumStorageLoaded) {
|
||||
registerShaped(getStack(ModBlocks.QUANTUM_CHEST), "DCD", "ATA", "DQD", 'D', getMaterial("dataOrb", Type.PART), 'C', getMaterial("computerMonitor", Type.PART), 'A', getMaterial("highly_advanced_machine", Type.MACHINE_FRAME), 'Q', getStack(ModBlocks.DIGITAL_CHEST), 'T', getStack(IC2Duplicates.COMPRESSOR));
|
||||
registerShaped(getStack(ModBlocks.QUANTUM_CHEST), "DCD", "ATA", "DQD", 'D', getMaterial("dataOrb", Type.PART), 'C', getMaterial("computerMonitor", Type.PART), 'A', "machineBlockElite", 'Q', getStack(ModBlocks.DIGITAL_CHEST), 'T', getStack(IC2Duplicates.COMPRESSOR));
|
||||
registerShaped(getStack(ModBlocks.QUANTUM_TANK), "EPE", "PCP", "EPE", 'P', "platePlatinum", 'E', "circuitAdvanced", 'C', getStack(ModBlocks.QUANTUM_CHEST));
|
||||
}
|
||||
|
||||
|
@ -191,9 +192,9 @@ public class CraftingTableRecipes extends RecipeMethods {
|
|||
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");
|
||||
registerShaped(getMaterial("data_storage_circuit", Type.PART), "EEE", "ECE", "EEE", 'E', "gemEmerald", 'C', "circuitBasic");
|
||||
registerShaped(getMaterial("data_control_circuit", Type.PART), "ADA", "DID", "ADA", 'I', "ingotIridium", 'A', "circuitAdvanced", 'D', getMaterial("data_storage_circuit", Type.PART));
|
||||
registerShaped(getMaterial("data_control_circuit", Type.PART), "ADA", "DID", "ADA", 'I', "ingotIridium", 'A', "circuitAdvanced", 'D', "circuitStorage");
|
||||
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', getMaterial("data_storage_circuit", Type.PART), 'S', getMaterial("data_control_circuit", Type.PART));
|
||||
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("tungsten_grinding_head", 2, Type.PART), "TST", "SBS", "TST", 'S', "ingotSteel", 'T', "ingotTungsten", 'B', "blockSteel");
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* 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.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import techreborn.api.fluidreplicator.FluidReplicatorRecipe;
|
||||
import techreborn.api.fluidreplicator.FluidReplicatorRecipeList;
|
||||
import techreborn.init.ModFluids;
|
||||
|
||||
/**
|
||||
* @author drcrazy
|
||||
*
|
||||
*/
|
||||
public class FluidReplicatorRecipes {
|
||||
|
||||
public static void init() {
|
||||
register(1, FluidRegistry.WATER, 40, 2);
|
||||
register(1, FluidRegistry.LAVA, 80, 2);
|
||||
register(2, ModFluids.COMPRESSED_AIR, 100, 20);
|
||||
register(2, ModFluids.CARBON, 100, 20);
|
||||
register(2, ModFluids.CARBON_FIBER, 100, 20);
|
||||
register(4, ModFluids.MERCURY, 200, 20);
|
||||
register(4, ModFluids.METHANE, 200, 20);
|
||||
|
||||
}
|
||||
|
||||
static void register(int input, Fluid output, int ticks, int euPerTick) {
|
||||
if(output == null || input < 1 || ticks < 1 || euPerTick < 1){
|
||||
return;
|
||||
}
|
||||
FluidReplicatorRecipeList.addRecipe(new FluidReplicatorRecipe(input, output, ticks, euPerTick));
|
||||
}
|
||||
}
|
|
@ -67,8 +67,8 @@ public abstract class TileGenericMachine extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.crafter != null && this.crafter.currentTickTime != 0) {
|
||||
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
|
||||
if (getRecipeCrafter() != null && getRecipeCrafter().currentTickTime != 0) {
|
||||
return getRecipeCrafter().currentTickTime * scale / getRecipeCrafter().currentNeededTicks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,165 @@
|
|||
/*
|
||||
* 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.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;
|
||||
import reborncore.common.util.FluidUtils;
|
||||
import reborncore.common.util.Inventory;
|
||||
import reborncore.common.util.Tank;
|
||||
import techreborn.api.fluidreplicator.FluidReplicatorRecipeCrafter;
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.init.ModItems;
|
||||
import techreborn.lib.ModInfo;
|
||||
import techreborn.tiles.TileGenericMachine;
|
||||
|
||||
/**
|
||||
* @author drcrazy
|
||||
*
|
||||
*/
|
||||
|
||||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class TileFluidReplicator extends TileGenericMachine implements IContainerProvider {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "fluidreplicator", key = "FluidReplicatorMaxInput", comment = "Fluid Replicator Max Input (Value in EU)")
|
||||
public static int maxInput = 256;
|
||||
@ConfigRegistry(config = "machines", category = "fluidreplicator", key = "FluidReplicatorMaxEnergy", comment = "Fluid Replicator Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 400_000;
|
||||
|
||||
public MultiblockChecker multiblockChecker;
|
||||
public static final int TANK_CAPACITY = 16_000;
|
||||
public Tank tank;
|
||||
int ticksSinceLastChange;
|
||||
|
||||
public TileFluidReplicator() {
|
||||
super("FluidReplicator", maxInput, maxEnergy, ModBlocks.FLUID_REPLICATOR, 3);
|
||||
final int[] inputs = new int[] { 0 };
|
||||
this.inventory = new Inventory(4, "TileFluidReplicator", 64, this);
|
||||
this.crafter = new FluidReplicatorRecipeCrafter(this, this.inventory, inputs, null);
|
||||
this.tank = new Tank("TileFluidReplicator", TileFluidReplicator.TANK_CAPACITY, this);
|
||||
}
|
||||
|
||||
public boolean getMultiBlock() {
|
||||
if (multiblockChecker == null) {
|
||||
return false;
|
||||
}
|
||||
final boolean ring = multiblockChecker.checkRingY(1, 1, MultiblockChecker.REINFORCED_CASING,
|
||||
MultiblockChecker.ZERO_OFFSET);
|
||||
return ring;
|
||||
}
|
||||
|
||||
// TileGenericMachine
|
||||
@Override
|
||||
public void update() {
|
||||
if (multiblockChecker == null) {
|
||||
final BlockPos pos = getPos().offset(getFacing().getOpposite(), 2);
|
||||
multiblockChecker = new MultiblockChecker(this.world, pos);
|
||||
}
|
||||
|
||||
ticksSinceLastChange++;
|
||||
// Check cells input slot 2 time per second
|
||||
if (!world.isRemote && ticksSinceLastChange >= 10) {
|
||||
if (!inventory.getStackInSlot(1).isEmpty()) {
|
||||
FluidUtils.fillContainers(tank, inventory, 1, 2, tank.getFluidType());
|
||||
}
|
||||
ticksSinceLastChange = 0;
|
||||
}
|
||||
|
||||
if (getMultiBlock()) {
|
||||
super.update();
|
||||
}
|
||||
|
||||
tank.compareAndUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return (RecipeCrafter) crafter;
|
||||
}
|
||||
|
||||
// TilePowerAcceptor
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
tank.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
tank.writeToNBT(tagCompound);
|
||||
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);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T> T getCapability(final Capability<T> capability, final EnumFacing facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
return (T) this.tank;
|
||||
}
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
|
||||
// TileLegacyMachineBase
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) {
|
||||
if (slotIndex == 0) {
|
||||
if (itemStack.isItemEqual(new ItemStack(ModItems.UU_MATTER))) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(EntityPlayer player) {
|
||||
return new ContainerBuilder("fluidreplicator").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).fluidSlot(1, 124, 35).filterSlot(0, 55, 45, stack -> stack.getItem() == ModItems.UU_MATTER)
|
||||
.outputSlot(2, 124, 55).energySlot(3, 8, 72).syncEnergyValue().syncCrafterValue().addInventory()
|
||||
.create(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
"forge_marker": 1,
|
||||
"defaults": {
|
||||
"transform": "forge:default-block",
|
||||
"model": "orientable",
|
||||
"textures": {
|
||||
"particle": "techreborn:blocks/machines/tier3_machines/fluid_replicator_front_off",
|
||||
"top": "techreborn:blocks/machines/tier3_machines/machine_top",
|
||||
"down": "techreborn:blocks/machines/tier3_machines/machine_bottom",
|
||||
"south": "techreborn:blocks/machines/tier3_machines/machine_back",
|
||||
"west": "techreborn:blocks/machines/tier3_machines/machine_west",
|
||||
"east": "techreborn:blocks/machines/tier3_machines/machine_east"
|
||||
}
|
||||
},
|
||||
"variants": {
|
||||
"inventory": {
|
||||
"transform": "forge:default-block",
|
||||
"model": "orientable",
|
||||
"textures": {
|
||||
"front": "techreborn:blocks/machines/tier3_machines/fluid_replicator_front_off"
|
||||
}
|
||||
},
|
||||
"facing": {
|
||||
"north": {
|
||||
},
|
||||
"east": {
|
||||
"y": 90
|
||||
},
|
||||
"south": {
|
||||
"y": 180
|
||||
},
|
||||
"west": {
|
||||
"y": 270
|
||||
}
|
||||
},
|
||||
"active": {
|
||||
"true": {
|
||||
"textures": {
|
||||
"front": "techreborn:blocks/machines/tier3_machines/fluid_replicator_front_on"
|
||||
}
|
||||
},
|
||||
"false": {
|
||||
"textures": {
|
||||
"front": "techreborn:blocks/machines/tier3_machines/fluid_replicator_front_off"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -81,6 +81,7 @@ tile.techreborn:mv_transformer.name=MV Transformer
|
|||
tile.techreborn:hv_transformer.name=HV Transformer
|
||||
tile.techreborn:ev_transformer.name=EV Transformer
|
||||
tile.techreborn:auto_crafting_table.name=Auto Crafting Table
|
||||
tile.techreborn:fluid_replicator.name=Fluid Replicator
|
||||
|
||||
|
||||
#Blocks
|
||||
|
|
Before Width: | Height: | Size: 708 B After Width: | Height: | Size: 708 B |
Binary file not shown.
After Width: | Height: | Size: 1 KiB |
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"animation": {
|
||||
"frametime": 5,
|
||||
"frames": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4
|
||||
]
|
||||
}
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.7 KiB |
Loading…
Reference in a new issue