Merge remote-tracking branch 'remotes/origin/1.12' into 1.13-prep
# Conflicts: # src/main/java/techreborn/api/fluidreplicator/FluidReplicatorRecipe.java # src/main/java/techreborn/client/container/ContainerPda.java # src/main/java/techreborn/client/gui/TRBuilder.java # src/main/java/techreborn/compat/crafttweaker/CTFusionReactor.java # src/main/java/techreborn/compat/crafttweaker/CTGeneric.java # src/main/java/techreborn/compat/jei/RecipeUtil.java # src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java # src/main/java/techreborn/compat/jei/alloySmelter/AlloySmelterRecipeCategory.java # src/main/java/techreborn/compat/jei/assemblingMachine/AssemblingMachineRecipeCategory.java # src/main/java/techreborn/compat/jei/blastFurnace/BlastFurnaceRecipeCategory.java # src/main/java/techreborn/compat/jei/centrifuge/CentrifugeRecipeCategory.java # src/main/java/techreborn/compat/jei/chemicalReactor/ChemicalReactorRecipeCategory.java # src/main/java/techreborn/compat/jei/compressor/CompressorRecipeCategory.java # src/main/java/techreborn/compat/jei/distillationTower/DistillationTowerRecipeCategory.java # src/main/java/techreborn/compat/jei/extractor/ExtractorRecipeCategory.java # src/main/java/techreborn/compat/jei/fluidReplicator/FluidReplicatorRecipeCategory.java # src/main/java/techreborn/compat/jei/fusionReactor/FusionReactorRecipeCategory.java # src/main/java/techreborn/compat/jei/fusionReactor/FusionReactorRecipeWrapper.java # src/main/java/techreborn/compat/jei/grinder/GrinderRecipeCategory.java # src/main/java/techreborn/compat/jei/implosionCompressor/ImplosionCompressorRecipeCategory.java # src/main/java/techreborn/compat/jei/industrialElectrolyzer/IndustrialElectrolyzerRecipeCategory.java # src/main/java/techreborn/compat/jei/industrialGrinder/IndustrialGrinderRecipeCategory.java # src/main/java/techreborn/compat/jei/industrialSawmill/IndustrialSawmillRecipeCategory.java # src/main/java/techreborn/compat/jei/rollingMachine/RollingMachineRecipeCategory.java # src/main/java/techreborn/compat/jei/vacuumFreezer/VacuumFreezerRecipeCategory.java # src/main/java/techreborn/init/ModBlocks.java # src/main/java/techreborn/init/ModTileEntities.java # src/main/java/techreborn/init/recipes/CraftingTableRecipes.java # src/main/java/techreborn/init/recipes/IndustrialGrinderRecipes.java # src/main/java/techreborn/items/tools/ItemAdvancedDrill.java # src/main/java/techreborn/packets/PacketAutoCraftingTableLock.java # src/main/resources/assets/techreborn/lang/en_us.lang # src/main/resources/assets/techreborn/loot_tables/chests/abandoned_mineshaft.json # src/main/resources/assets/techreborn/loot_tables/chests/desert_pyramid.json # src/main/resources/assets/techreborn/loot_tables/chests/igloo_chest.json # src/main/resources/assets/techreborn/loot_tables/chests/jungle_temple.json # src/main/resources/assets/techreborn/loot_tables/chests/simple_dungeon.json # src/main/resources/assets/techreborn/loot_tables/chests/village_blacksmith.json
This commit is contained in:
commit
6060a97855
77 changed files with 1863 additions and 4017 deletions
47
src/main/java/techreborn/tiles/TileCreativeQuantumChest.java
Normal file
47
src/main/java/techreborn/tiles/TileCreativeQuantumChest.java
Normal file
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.tiles;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class TileCreativeQuantumChest extends TileQuantumChest {
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
ItemStack stack = getStackInSlot(1);
|
||||
if (!stack.isEmpty() && storedItem.isEmpty()) {
|
||||
stack.setCount(stack.getMaxStackSize());
|
||||
storedItem = stack.copy();
|
||||
}
|
||||
|
||||
storedItem.setCount(maxCapacity - storedItem.getMaxStackSize());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int slotTransferSpeed() {
|
||||
return 1;
|
||||
}
|
||||
}
|
46
src/main/java/techreborn/tiles/TileCreativeQuantumTank.java
Normal file
46
src/main/java/techreborn/tiles/TileCreativeQuantumTank.java
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.tiles;
|
||||
|
||||
public class TileCreativeQuantumTank extends TileQuantumTank {
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
if (!tank.isEmpty() && !tank.isFull()) {
|
||||
tank.setFluidAmount(Integer.MAX_VALUE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int slotTransferSpeed() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fluidTransferAmount() {
|
||||
return 10000;
|
||||
}
|
||||
}
|
|
@ -32,12 +32,10 @@ import net.minecraft.util.EnumFacing;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.registration.RebornRegistry;
|
||||
|
@ -45,6 +43,7 @@ import reborncore.common.registration.impl.ConfigRegistry;
|
|||
import reborncore.common.util.Tank;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -161,19 +160,9 @@ public class TilePump extends TilePowerAcceptor {
|
|||
return tagCompound;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
return true;
|
||||
}
|
||||
return super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(tank);
|
||||
}
|
||||
return super.getCapability(capability, facing);
|
||||
public Tank getTank() {
|
||||
return tank;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,9 +29,6 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
|
@ -47,6 +44,7 @@ import techreborn.client.container.builder.ContainerBuilder;
|
|||
import techreborn.init.ModBlocks;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
|
@ -113,22 +111,6 @@ public class TileQuantumTank extends TileLegacyMachineBase
|
|||
readFromNBT(packet.getNbtCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(final Capability<?> capability, final EnumFacing facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
return true;
|
||||
}
|
||||
return super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(final Capability<T> capability, final EnumFacing facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(tank);
|
||||
}
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
|
||||
// IInventoryProvider
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
|
@ -161,4 +143,10 @@ public class TileQuantumTank extends TileLegacyMachineBase
|
|||
.addInventory().tile(this).fluidSlot(0, 80, 17).outputSlot(1, 80, 53).addInventory()
|
||||
.create(this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Tank getTank() {
|
||||
return tank;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,9 +26,7 @@ package techreborn.tiles.generator;
|
|||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
|
@ -41,6 +39,8 @@ import techreborn.api.generator.FluidGeneratorRecipe;
|
|||
import techreborn.api.generator.FluidGeneratorRecipeList;
|
||||
import techreborn.api.generator.GeneratorRecipeHelper;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implements IToolDrop, IInventoryProvider {
|
||||
|
||||
private final FluidGeneratorRecipeList recipes;
|
||||
|
@ -90,7 +90,7 @@ public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implement
|
|||
}
|
||||
|
||||
if (tank.getFluidAmount() > 0) {
|
||||
if (currentRecipe == null || !currentRecipe.getFluid().equals(tank.getFluidType()))
|
||||
if (currentRecipe == null || !FluidUtils.fluidEquals(currentRecipe.getFluid(), tank.getFluidType()))
|
||||
currentRecipe = getRecipes().getRecipeForFluid(tank.getFluidType()).orElse(null);
|
||||
|
||||
if (currentRecipe != null) {
|
||||
|
@ -172,22 +172,6 @@ public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implement
|
|||
return inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
return true;
|
||||
}
|
||||
return super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(tank);
|
||||
}
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
|
@ -221,4 +205,10 @@ public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implement
|
|||
public void setTankAmount(int amount){
|
||||
tank.setFluidAmount(amount);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Tank getTank() {
|
||||
return tank;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,10 +27,7 @@ package techreborn.tiles.multiblock;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import reborncore.common.recipes.RecipeCrafter;
|
||||
import reborncore.common.registration.RebornRegistry;
|
||||
import reborncore.common.registration.impl.ConfigRegistry;
|
||||
|
@ -46,6 +43,8 @@ import techreborn.init.TRIngredients;
|
|||
import techreborn.lib.ModInfo;
|
||||
import techreborn.tiles.TileGenericMachine;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* @author drcrazy
|
||||
*
|
||||
|
@ -124,22 +123,6 @@ public class TileFluidReplicator extends TileGenericMachine implements IContaine
|
|||
return tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(final Capability<?> capability, final EnumFacing facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
return true;
|
||||
}
|
||||
return super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(final Capability<T> capability, final EnumFacing facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(tank);
|
||||
}
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
|
||||
// TileLegacyMachineBase
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) {
|
||||
|
@ -161,4 +144,10 @@ public class TileFluidReplicator extends TileGenericMachine implements IContaine
|
|||
.outputSlot(2, 124, 55).energySlot(3, 8, 72).syncEnergyValue().syncCrafterValue().addInventory()
|
||||
.create(this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Tank getTank() {
|
||||
return tank;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,9 +31,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
|
@ -53,6 +51,8 @@ import techreborn.init.ModBlocks;
|
|||
import techreborn.lib.ModInfo;
|
||||
import techreborn.tiles.TileGenericMachine;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class TileIndustrialGrinder extends TileGenericMachine implements IContainerProvider, ITileRecipeHandler<IndustrialGrinderRecipe> {
|
||||
|
||||
|
@ -128,22 +128,6 @@ public class TileIndustrialGrinder extends TileGenericMachine implements IContai
|
|||
return tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(final Capability<?> capability, final EnumFacing facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
return true;
|
||||
}
|
||||
return super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(final Capability<T> capability, final EnumFacing facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(tank);
|
||||
}
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
|
||||
// TileLegacyMachineBase
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) {
|
||||
|
@ -214,4 +198,10 @@ public class TileIndustrialGrinder extends TileGenericMachine implements IContai
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Tank getTank() {
|
||||
return tank;
|
||||
}
|
||||
}
|
|
@ -31,9 +31,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
|
@ -53,6 +51,8 @@ import techreborn.init.ModBlocks;
|
|||
import techreborn.lib.ModInfo;
|
||||
import techreborn.tiles.TileGenericMachine;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class TileIndustrialSawmill extends TileGenericMachine implements IContainerProvider, ITileRecipeHandler<IndustrialSawmillRecipe> {
|
||||
|
||||
|
@ -128,24 +128,6 @@ public class TileIndustrialSawmill extends TileGenericMachine implements IContai
|
|||
return tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(final Capability<?> capability, final EnumFacing facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
return true;
|
||||
}
|
||||
return super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(final Capability<T> capability, final EnumFacing facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
if (tank != null) {
|
||||
return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(tank);
|
||||
}
|
||||
}
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
|
||||
// TileLegacyMachineBase
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) {
|
||||
|
@ -213,4 +195,10 @@ public class TileIndustrialSawmill extends TileGenericMachine implements IContai
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Tank getTank() {
|
||||
return tank;
|
||||
}
|
||||
}
|
|
@ -59,7 +59,7 @@ import java.util.List;
|
|||
*/
|
||||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class TileAutoCraftingTable extends TilePowerAcceptor
|
||||
implements IToolDrop, IInventoryProvider, IContainerProvider {
|
||||
implements IToolDrop, IInventoryProvider, IContainerProvider {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "autocrafter", key = "AutoCrafterInput", comment = "AutoCrafting Table Max Input (Value in EU)")
|
||||
public static int maxInput = 32;
|
||||
|
@ -85,8 +85,8 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
public IRecipe getIRecipe() {
|
||||
InventoryCrafting crafting = getCraftingInventory();
|
||||
if (!crafting.isEmpty()) {
|
||||
if(lastRecipe != null){
|
||||
if(lastRecipe.matches(crafting, world)){
|
||||
if (lastRecipe != null) {
|
||||
if (lastRecipe.matches(crafting, world)) {
|
||||
return lastRecipe;
|
||||
}
|
||||
}
|
||||
|
@ -181,41 +181,39 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
public boolean make(IRecipe recipe) {
|
||||
if (canMake(recipe)) {
|
||||
if (recipe == null) {
|
||||
return false;
|
||||
} else if (recipe != null) {
|
||||
for (int i = 0; i < recipe.getIngredients().size(); i++) {
|
||||
Ingredient ingredient = recipe.getIngredients().get(i);
|
||||
//Looks for the best slot to take it from
|
||||
ItemStack bestSlot = inventory.getStackInSlot(i);
|
||||
if (ingredient.apply(bestSlot)) {
|
||||
handleContainerItem(bestSlot);
|
||||
bestSlot.shrink(1);
|
||||
} else {
|
||||
for (int j = 0; j < 9; j++) {
|
||||
ItemStack stack = inventory.getStackInSlot(j);
|
||||
if (ingredient.apply(stack)) {
|
||||
handleContainerItem(stack);
|
||||
stack.shrink(1); //TODO is this right? or do I need to use it as an actull crafting grid
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (recipe == null || !canMake(recipe)) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < recipe.getIngredients().size(); i++) {
|
||||
Ingredient ingredient = recipe.getIngredients().get(i);
|
||||
// Looks for the best slot to take it from
|
||||
ItemStack bestSlot = inventory.getStackInSlot(i);
|
||||
if (ingredient.apply(bestSlot)) {
|
||||
handleContainerItem(bestSlot);
|
||||
bestSlot.shrink(1);
|
||||
} else {
|
||||
for (int j = 0; j < 9; j++) {
|
||||
ItemStack stack = inventory.getStackInSlot(j);
|
||||
if (ingredient.apply(stack)) {
|
||||
handleContainerItem(stack);
|
||||
stack.shrink(1); // TODO is this right? or do I need
|
||||
// to use it as an actull
|
||||
// crafting grid
|
||||
break;
|
||||
}
|
||||
}
|
||||
ItemStack output = inventory.getStackInSlot(9);
|
||||
//TODO fire forge recipe event
|
||||
ItemStack ouputStack = recipe.getCraftingResult(getCraftingInventory());
|
||||
if (output.isEmpty()) {
|
||||
inventory.setInventorySlotContents(9, ouputStack.copy());
|
||||
} else {
|
||||
//TODO use ouputStack in someway?
|
||||
output.grow(recipe.getRecipeOutput().getCount());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
ItemStack output = inventory.getStackInSlot(9);
|
||||
// TODO fire forge recipe event
|
||||
ItemStack ouputStack = recipe.getCraftingResult(getCraftingInventory());
|
||||
if (output.isEmpty()) {
|
||||
inventory.setInventorySlotContents(9, ouputStack.copy());
|
||||
} else {
|
||||
// TODO use ouputStack in someway?
|
||||
output.grow(recipe.getRecipeOutput().getCount());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void handleContainerItem(ItemStack stack) {
|
||||
|
@ -225,7 +223,8 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
if (hasOutputSpace(containerItem, 10)) {
|
||||
if (extraOutputSlot.isEmpty()) {
|
||||
setInventorySlotContents(10, containerItem.copy());
|
||||
} else if (ItemUtils.isItemEqual(extraOutputSlot, containerItem, true, true) && extraOutputSlot.getMaxStackSize() < extraOutputSlot.getCount() + containerItem.getCount()) {
|
||||
} else if (ItemUtils.isItemEqual(extraOutputSlot, containerItem, true, true)
|
||||
&& extraOutputSlot.getMaxStackSize() < extraOutputSlot.getCount() + containerItem.getCount()) {
|
||||
extraOutputSlot.grow(1);
|
||||
}
|
||||
}
|
||||
|
@ -264,14 +263,15 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
if (ingredient != Ingredient.EMPTY && ingredient.apply(stack)) {
|
||||
if (stackInSlot.isEmpty()) {
|
||||
possibleSlots.add(i);
|
||||
} else if (stackInSlot.getItem() == stack.getItem() && stackInSlot.getItemDamage() == stack.getItemDamage()) {
|
||||
} else if (stackInSlot.getItem() == stack.getItem()
|
||||
&& stackInSlot.getItemDamage() == stack.getItemDamage()) {
|
||||
if (stackInSlot.getMaxStackSize() >= stackInSlot.getCount() + stack.getCount()) {
|
||||
possibleSlots.add(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//Slot, count
|
||||
// Slot, count
|
||||
Pair<Integer, Integer> smallestCount = null;
|
||||
for (Integer slot : possibleSlots) {
|
||||
ItemStack slotStack = inventory.getStackInSlot(slot);
|
||||
|
@ -328,7 +328,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
progress++;
|
||||
if (progress == 1) {
|
||||
world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), ModSounds.AUTO_CRAFTING,
|
||||
SoundCategory.BLOCKS, 0.3F, 0.8F);
|
||||
SoundCategory.BLOCKS, 0.3F, 0.8F);
|
||||
}
|
||||
useEnergy(euTick);
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
}
|
||||
}
|
||||
|
||||
//Easyest way to sync back to the client
|
||||
// Easyest way to sync back to the client
|
||||
public int getLockedInt() {
|
||||
return locked ? 1 : 0;
|
||||
}
|
||||
|
@ -384,7 +384,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
if(tag.hasKey("locked")){
|
||||
if (tag.hasKey("locked")) {
|
||||
locked = tag.getBoolean("locked");
|
||||
}
|
||||
super.readFromNBT(tag);
|
||||
|
@ -407,12 +407,12 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side) {
|
||||
return new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
|
||||
return new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int index, ItemStack stack, EnumFacing direction) {
|
||||
if(index > 8){
|
||||
if (index > 8) {
|
||||
return false;
|
||||
}
|
||||
int bestSlot = findBestSlotForStack(getIRecipe(), stack);
|
||||
|
@ -424,13 +424,13 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
|
||||
@Override
|
||||
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) {
|
||||
if(index > 8){
|
||||
if (index > 8) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//This machine doesnt have a facing
|
||||
// This machine doesnt have a facing
|
||||
@Override
|
||||
public EnumFacing getFacingEnum() {
|
||||
return EnumFacing.NORTH;
|
||||
|
@ -451,16 +451,12 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(EntityPlayer player) {
|
||||
return new ContainerBuilder("autocraftingtable").player(player.inventory).inventory().hotbar()
|
||||
.addInventory().tile(this)
|
||||
.slot(0, 28, 25).slot(1, 46, 25).slot(2, 64, 25)
|
||||
.slot(3, 28, 43).slot(4, 46, 43).slot(5, 64, 43)
|
||||
.slot(6, 28, 61).slot(7, 46, 61).slot(8, 64, 61)
|
||||
.outputSlot(9, 145, 42).outputSlot(10, 145, 70).syncEnergyValue()
|
||||
.syncIntegerValue(this::getProgress, this::setProgress)
|
||||
.syncIntegerValue(this::getMaxProgress, this::setMaxProgress)
|
||||
.syncIntegerValue(this::getLockedInt, this::setLockedInt)
|
||||
.addInventory().create(this);
|
||||
return new ContainerBuilder("autocraftingtable").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 28, 25).slot(1, 46, 25).slot(2, 64, 25).slot(3, 28, 43).slot(4, 46, 43)
|
||||
.slot(5, 64, 43).slot(6, 28, 61).slot(7, 46, 61).slot(8, 64, 61).outputSlot(9, 145, 42)
|
||||
.outputSlot(10, 145, 70).syncEnergyValue().syncIntegerValue(this::getProgress, this::setProgress)
|
||||
.syncIntegerValue(this::getMaxProgress, this::setMaxProgress)
|
||||
.syncIntegerValue(this::getLockedInt, this::setLockedInt).addInventory().create(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue