Tile -> BlockEntity + some more refactors
This commit is contained in:
parent
7f8674f1ca
commit
dbc89adaf7
193 changed files with 3194 additions and 3214 deletions
|
@ -39,19 +39,19 @@ import java.util.List;
|
|||
public class ScrapboxRecipeCrafter extends RecipeCrafter {
|
||||
|
||||
/**
|
||||
* @param parentTile Tile having this crafter
|
||||
* @param inventory Inventory from parent tile
|
||||
* @param parent Tile having this crafter
|
||||
* @param inventory Inventory from parent blockEntity
|
||||
* @param inputSlots Slot IDs for input
|
||||
* @param outputSlots Slot IDs for output
|
||||
*/
|
||||
public ScrapboxRecipeCrafter(BlockEntity parentTile, RebornInventory<?> inventory, int[] inputSlots, int[] outputSlots) {
|
||||
super(ModRecipes.SCRAPBOX, parentTile, 1, 1, inventory, inputSlots, outputSlots);
|
||||
public ScrapboxRecipeCrafter(BlockEntity parent, RebornInventory<?> inventory, int[] inputSlots, int[] outputSlots) {
|
||||
super(ModRecipes.SCRAPBOX, parent, 1, 1, inventory, inputSlots, outputSlots);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCurrentRecipe(){
|
||||
List<RebornRecipe> scrapboxRecipeList = ModRecipes.SCRAPBOX.getRecipes(tile.getWorld());
|
||||
int random = tile.getWorld().random.nextInt(scrapboxRecipeList.size());
|
||||
List<RebornRecipe> scrapboxRecipeList = ModRecipes.SCRAPBOX.getRecipes(blockEntity.getWorld());
|
||||
int random = blockEntity.getWorld().random.nextInt(scrapboxRecipeList.size());
|
||||
// Sets the current recipe then syncs
|
||||
setCurrentRecipe(scrapboxRecipeList.get(random));
|
||||
this.currentNeededTicks = Math.max((int) (currentRecipe.getTime() * (1.0 - getSpeedMultiplier())), 1);
|
||||
|
|
|
@ -30,7 +30,7 @@ import net.minecraft.util.Identifier;
|
|||
import net.minecraft.util.JsonHelper;
|
||||
import reborncore.common.crafting.RebornRecipe;
|
||||
import reborncore.common.crafting.RebornRecipeType;
|
||||
import techreborn.tiles.machine.multiblock.TileIndustrialBlastFurnace;
|
||||
import techreborn.blockentity.machine.multiblock.IndustrialBlastFurnaceBlockEntity;
|
||||
|
||||
public class BlastFurnaceRecipe extends RebornRecipe {
|
||||
|
||||
|
@ -53,16 +53,16 @@ public class BlastFurnaceRecipe extends RebornRecipe {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canCraft(final BlockEntity tile) {
|
||||
if (tile instanceof TileIndustrialBlastFurnace) {
|
||||
final TileIndustrialBlastFurnace blastFurnace = (TileIndustrialBlastFurnace) tile;
|
||||
public boolean canCraft(final BlockEntity blockEntity) {
|
||||
if (blockEntity instanceof IndustrialBlastFurnaceBlockEntity) {
|
||||
final IndustrialBlastFurnaceBlockEntity blastFurnace = (IndustrialBlastFurnaceBlockEntity) blockEntity;
|
||||
return blastFurnace.getHeat() >= heat;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCraft(final BlockEntity tile) {
|
||||
public boolean onCraft(final BlockEntity blockEntity) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ import net.minecraft.util.Identifier;
|
|||
import reborncore.common.crafting.RebornRecipe;
|
||||
import reborncore.common.crafting.RebornRecipeType;
|
||||
import reborncore.fluid.FluidStack;
|
||||
import techreborn.tiles.machine.multiblock.TileIndustrialGrinder;
|
||||
import techreborn.blockentity.machine.multiblock.IndustrialGrinderBlockEntity;
|
||||
|
||||
public class IndustrialGrinderRecipe extends RebornRecipe {
|
||||
|
||||
|
@ -41,13 +41,13 @@ public class IndustrialGrinderRecipe extends RebornRecipe {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canCraft(final BlockEntity tileEntity) {
|
||||
TileIndustrialGrinder tile = (TileIndustrialGrinder) tileEntity;
|
||||
if (!tile.getMultiBlock()) {
|
||||
public boolean canCraft(final BlockEntity be) {
|
||||
IndustrialGrinderBlockEntity blockEntity = (IndustrialGrinderBlockEntity) be;
|
||||
if (!blockEntity.getMultiBlock()) {
|
||||
return false;
|
||||
}
|
||||
final FluidStack recipeFluid = fluidStack;
|
||||
final FluidStack tankFluid = tile.tank.getFluid();
|
||||
final FluidStack tankFluid = blockEntity.tank.getFluid();
|
||||
if (fluidStack == null) {
|
||||
return true;
|
||||
}
|
||||
|
@ -63,10 +63,10 @@ public class IndustrialGrinderRecipe extends RebornRecipe {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onCraft(final BlockEntity tileEntity) {
|
||||
TileIndustrialGrinder tile = (TileIndustrialGrinder) tileEntity;
|
||||
public boolean onCraft(final BlockEntity be) {
|
||||
IndustrialGrinderBlockEntity blockEntity = (IndustrialGrinderBlockEntity) be;
|
||||
final FluidStack recipeFluid = fluidStack;
|
||||
final FluidStack tankFluid = tile.tank.getFluid();
|
||||
final FluidStack tankFluid = blockEntity.tank.getFluid();
|
||||
if (fluidStack == null) {
|
||||
return true;
|
||||
}
|
||||
|
@ -76,12 +76,12 @@ public class IndustrialGrinderRecipe extends RebornRecipe {
|
|||
if (tankFluid.isFluidEqual(recipeFluid)) {
|
||||
if (tankFluid.amount >= recipeFluid.amount) {
|
||||
if (tankFluid.amount == recipeFluid.amount) {
|
||||
tile.tank.setFluid(null);
|
||||
blockEntity.tank.setFluid(null);
|
||||
}
|
||||
else {
|
||||
tankFluid.amount -= recipeFluid.amount;
|
||||
}
|
||||
tile.syncWithAll();
|
||||
blockEntity.syncWithAll();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ import net.minecraft.util.Identifier;
|
|||
import reborncore.common.crafting.RebornRecipe;
|
||||
import reborncore.common.crafting.RebornRecipeType;
|
||||
import reborncore.fluid.FluidStack;
|
||||
import techreborn.tiles.machine.multiblock.TileIndustrialSawmill;
|
||||
import techreborn.blockentity.machine.multiblock.IndustrialSawmillBlockEntity;
|
||||
|
||||
public class IndustrialSawmillRecipe extends RebornRecipe {
|
||||
|
||||
|
@ -41,13 +41,13 @@ public class IndustrialSawmillRecipe extends RebornRecipe {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canCraft(BlockEntity tileEntity) {
|
||||
TileIndustrialSawmill tile = (TileIndustrialSawmill) tileEntity;
|
||||
if (!tile.getMutliBlock()) {
|
||||
public boolean canCraft(BlockEntity be) {
|
||||
IndustrialSawmillBlockEntity blockEntity = (IndustrialSawmillBlockEntity) be;
|
||||
if (!blockEntity.getMutliBlock()) {
|
||||
return false;
|
||||
}
|
||||
final FluidStack recipeFluid = fluidStack;
|
||||
final FluidStack tankFluid = tile.tank.getFluid();
|
||||
final FluidStack tankFluid = blockEntity.tank.getFluid();
|
||||
if (fluidStack == null) {
|
||||
return true;
|
||||
}
|
||||
|
@ -63,10 +63,10 @@ public class IndustrialSawmillRecipe extends RebornRecipe {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onCraft(BlockEntity tileEntity) {
|
||||
TileIndustrialSawmill tile = (TileIndustrialSawmill) tileEntity;
|
||||
public boolean onCraft(BlockEntity be) {
|
||||
IndustrialSawmillBlockEntity blockEntity = (IndustrialSawmillBlockEntity) be;
|
||||
final FluidStack recipeFluid = fluidStack;
|
||||
final FluidStack tankFluid = tile.tank.getFluid();
|
||||
final FluidStack tankFluid = blockEntity.tank.getFluid();
|
||||
if (fluidStack == null) {
|
||||
return true;
|
||||
}
|
||||
|
@ -76,11 +76,11 @@ public class IndustrialSawmillRecipe extends RebornRecipe {
|
|||
if (tankFluid.isFluidEqual(recipeFluid)) {
|
||||
if (tankFluid.amount >= recipeFluid.amount) {
|
||||
if (tankFluid.amount == recipeFluid.amount) {
|
||||
tile.tank.setFluid(null);
|
||||
blockEntity.tank.setFluid(null);
|
||||
} else {
|
||||
tankFluid.amount -= recipeFluid.amount;
|
||||
}
|
||||
tile.syncWithAll();
|
||||
blockEntity.syncWithAll();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue