Fix for #1782, cheap basic tools and fixed some warnings here and there
This commit is contained in:
parent
dc8511f1f0
commit
9035e4376a
9 changed files with 29 additions and 37 deletions
|
@ -134,7 +134,10 @@ public class CableBlockEntity extends BlockEntity
|
|||
continue;
|
||||
} else if (blockEntity instanceof EnergyBlockEntity) {
|
||||
EnergyBlockEntity acceptor = (EnergyBlockEntity) blockEntity;
|
||||
if (energy <= acceptor.getEnergy() || !acceptor.canAcceptEnergy(face.getOpposite())) {
|
||||
if (blockEntity instanceof CableBlockEntity && energy <= acceptor.getEnergy()) {
|
||||
continue;
|
||||
}
|
||||
if (!acceptor.canAcceptEnergy(face.getOpposite())) {
|
||||
continue;
|
||||
}
|
||||
acceptors.add(acceptor);
|
||||
|
|
|
@ -34,7 +34,6 @@ import reborncore.client.containerBuilder.IContainerProvider;
|
|||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.containerBuilder.builder.ContainerBuilder;
|
||||
import reborncore.common.recipes.RecipeCrafter;
|
||||
import reborncore.common.util.IInventoryAccess;
|
||||
import reborncore.common.util.RebornInventory;
|
||||
import reborncore.common.util.Tank;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
|
@ -76,16 +75,6 @@ public class IndustrialGrinderBlockEntity extends GenericMachineBlockEntity impl
|
|||
&& centerBlock.getMaterial() == Material.WATER);
|
||||
return down && center && blade && up;
|
||||
}
|
||||
|
||||
private static IInventoryAccess<IndustrialGrinderBlockEntity> getInventoryAccess(){
|
||||
return (slotID, stack, face, direction, blockEntity) -> {
|
||||
if(slotID == 1){
|
||||
//TODO check if the item has fluid in it
|
||||
//return stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null).isPresent();
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
// TilePowerAcceptor
|
||||
@Override
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.recipe.CraftingRecipe;
|
||||
import net.minecraft.recipe.Ingredient;
|
||||
import net.minecraft.recipe.Recipe;
|
||||
import net.minecraft.recipe.RecipeType;
|
||||
|
@ -48,12 +49,12 @@ import reborncore.common.util.ItemUtils;
|
|||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.ModSounds;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.RecipeUtils;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 20/06/2017.
|
||||
|
@ -67,8 +68,8 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
|
|||
public int euTick = 10;
|
||||
|
||||
CraftingInventory inventoryCrafting = null;
|
||||
Recipe lastCustomRecipe = null;
|
||||
Recipe lastRecipe = null;
|
||||
CraftingRecipe lastCustomRecipe = null;
|
||||
CraftingRecipe lastRecipe = null;
|
||||
|
||||
public boolean locked = true;
|
||||
|
||||
|
@ -77,7 +78,7 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
|
|||
}
|
||||
|
||||
@Nullable
|
||||
public Recipe getIRecipe() {
|
||||
public CraftingRecipe getIRecipe() {
|
||||
CraftingInventory crafting = getCraftingInventory();
|
||||
if (!crafting.isInvEmpty()) {
|
||||
if (lastRecipe != null) {
|
||||
|
@ -85,11 +86,10 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
|
|||
return lastRecipe;
|
||||
}
|
||||
}
|
||||
for (Recipe testRecipe : RecipeUtils.getRecipes(world, RecipeType.CRAFTING)) {
|
||||
if (testRecipe.matches(crafting, world)) {
|
||||
lastRecipe = testRecipe;
|
||||
return testRecipe;
|
||||
}
|
||||
Optional<CraftingRecipe> testRecipe = world.getRecipeManager().getFirstMatch(RecipeType.CRAFTING, crafting, world);
|
||||
if (testRecipe.isPresent()) {
|
||||
lastRecipe = testRecipe.get();
|
||||
return lastRecipe;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -110,7 +110,7 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
|
|||
return inventoryCrafting;
|
||||
}
|
||||
|
||||
public boolean canMake(Recipe<CraftingInventory> recipe) {
|
||||
public boolean canMake(CraftingRecipe recipe) {
|
||||
if (recipe != null && recipe.fits(3, 3)) {
|
||||
boolean missingOutput = false;
|
||||
int[] stacksInSlots = new int[9];
|
||||
|
@ -177,7 +177,7 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean make(Recipe<CraftingInventory> recipe) {
|
||||
public boolean make(CraftingRecipe recipe) {
|
||||
if (recipe == null || !canMake(recipe)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -203,10 +203,9 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
|
|||
}
|
||||
}
|
||||
ItemStack output = inventory.getInvStack(9);
|
||||
// TODO fire forge recipe event
|
||||
ItemStack ouputStack = recipe.craft(getCraftingInventory());
|
||||
ItemStack outputStack = recipe.craft(getCraftingInventory());
|
||||
if (output.isEmpty()) {
|
||||
inventory.setInvStack(9, ouputStack.copy());
|
||||
inventory.setInvStack(9, outputStack.copy());
|
||||
} else {
|
||||
// TODO use ouputStack in someway?
|
||||
output.increment(recipe.getOutput().getCount());
|
||||
|
@ -239,7 +238,7 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean isItemValidForRecipeSlot(Recipe recipe, ItemStack stack, int slotID) {
|
||||
public boolean isItemValidForRecipeSlot(Recipe<CraftingInventory> recipe, ItemStack stack, int slotID) {
|
||||
if (recipe == null) {
|
||||
return true;
|
||||
}
|
||||
|
@ -250,7 +249,7 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
|
|||
return true;
|
||||
}
|
||||
|
||||
public int findBestSlotForStack(Recipe recipe, ItemStack stack) {
|
||||
public int findBestSlotForStack(Recipe<CraftingInventory> recipe, ItemStack stack) {
|
||||
if (recipe == null) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -314,7 +313,7 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
|
|||
if (world.isClient) {
|
||||
return;
|
||||
}
|
||||
Recipe recipe = getIRecipe();
|
||||
CraftingRecipe recipe = getIRecipe();
|
||||
if (recipe != null) {
|
||||
if (progress >= maxProgress) {
|
||||
if (make(recipe)) {
|
||||
|
@ -427,7 +426,7 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
|
|||
|
||||
// ItemHandlerProvider
|
||||
@Override
|
||||
public RebornInventory getInventory() {
|
||||
public RebornInventory<AutoCraftingTableBlockEntity> getInventory() {
|
||||
return inventory;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ package techreborn.client.gui;
|
|||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.recipe.Recipe;
|
||||
import net.minecraft.recipe.CraftingRecipe;
|
||||
import net.minecraft.util.Identifier;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.gui.builder.GuiBase;
|
||||
|
@ -57,7 +57,7 @@ public class GuiAutoCrafting extends GuiBase<BuiltContainer> {
|
|||
@Override
|
||||
protected void drawForeground(int mouseX, int mouseY) {
|
||||
super.drawForeground(mouseX, mouseY);
|
||||
Recipe recipe = blockEntityAutoCraftingTable.getIRecipe();
|
||||
CraftingRecipe recipe = blockEntityAutoCraftingTable.getIRecipe();
|
||||
if (recipe != null) {
|
||||
renderItemStack(recipe.getOutput(), 95, 42);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ import net.minecraft.container.Container;
|
|||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class GuiDestructoPack extends AbstractContainerScreen {
|
||||
public class GuiDestructoPack extends AbstractContainerScreen<Container> {
|
||||
|
||||
private static final Identifier texture = new Identifier("techreborn",
|
||||
"textures/gui/destructopack.png");
|
||||
|
@ -53,7 +53,7 @@ public class GuiDestructoPack extends AbstractContainerScreen {
|
|||
|
||||
@Override
|
||||
protected void drawForeground(int arg0, int arg1) {
|
||||
String name = I18n.translate("item.techreborn.part.destructoPack.name");
|
||||
String name = I18n.translate("item.techreborn.destructopack");
|
||||
font.draw(name, containerWidth / 2 - font.getStringWidth(name) / 2, 5, 4210752);
|
||||
this.font.draw(I18n.translate("container.inventory"), 8, this.containerHeight - 96 + 2,
|
||||
4210752);
|
||||
|
|
|
@ -511,6 +511,7 @@
|
|||
"item.techreborn.basic_jackhammer": "Steel Jackhammer",
|
||||
"item.techreborn.treetap": "Treetap",
|
||||
"item.techreborn.wrench": "Wrench",
|
||||
"item.techreborn.destructopack": "Destructopack",
|
||||
|
||||
"_comment17": "Items-Misc",
|
||||
"item.techreborn.cell": "Empty Cell",
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
],
|
||||
"key": {
|
||||
"S": {
|
||||
"tag": "c:steel_ingot"
|
||||
"item": "techreborn:refined_iron_ingot"
|
||||
},
|
||||
"C": {
|
||||
"item": "techreborn:electronic_circuit"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
],
|
||||
"key": {
|
||||
"S": {
|
||||
"tag": "c:steel_ingot"
|
||||
"item": "techreborn:refined_iron_ingot"
|
||||
},
|
||||
"C": {
|
||||
"item": "techreborn:electronic_circuit"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
],
|
||||
"key": {
|
||||
"S": {
|
||||
"tag": "c:steel_ingot"
|
||||
"item": "techreborn:refined_iron_ingot"
|
||||
},
|
||||
"C": {
|
||||
"item": "techreborn:electronic_circuit"
|
||||
|
|
Loading…
Add table
Reference in a new issue