mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-29 18:28:34 +01:00
Compare commits
No commits in common. "86a89a96a8b2300dde43b47ce459c316bea0783b" and "e8fee61c9174544e82832aac5b5f666517497147" have entirely different histories.
86a89a96a8
...
e8fee61c91
14 changed files with 57 additions and 104 deletions
|
@ -480,8 +480,8 @@ f3df22f203e8c00ee7ee004bb9b4edfd522f069a data/actuallyadditions/loot_tables/bloc
|
||||||
bf7743c27757cf5b0dbab9b3e15d1d5ca1ece818 data/actuallyadditions/loot_tables/blocks/coal_generator.json
|
bf7743c27757cf5b0dbab9b3e15d1d5ca1ece818 data/actuallyadditions/loot_tables/blocks/coal_generator.json
|
||||||
66ee33930c8392b29710ce2bc117f99907e336df data/actuallyadditions/loot_tables/blocks/coffee.json
|
66ee33930c8392b29710ce2bc117f99907e336df data/actuallyadditions/loot_tables/blocks/coffee.json
|
||||||
3285202e3f840d091b8d85dc2c721199fcc96240 data/actuallyadditions/loot_tables/blocks/coffee_machine.json
|
3285202e3f840d091b8d85dc2c721199fcc96240 data/actuallyadditions/loot_tables/blocks/coffee_machine.json
|
||||||
317d0377327250f2fe15ff549a1ffa1b7bdade14 data/actuallyadditions/loot_tables/blocks/crusher.json
|
98c2198bf7df995a8c43f08101eb2021a62e1dec data/actuallyadditions/loot_tables/blocks/crusher.json
|
||||||
b087c6f44cf0236f52471ec54c026ee30ba0d273 data/actuallyadditions/loot_tables/blocks/crusher_double.json
|
93c16ed7d46e44ceafdc32c2a440f98b8c805723 data/actuallyadditions/loot_tables/blocks/crusher_double.json
|
||||||
6336ca572b8d81f6e06b43bb925b48bb915b6574 data/actuallyadditions/loot_tables/blocks/diamatine_crystal_block.json
|
6336ca572b8d81f6e06b43bb925b48bb915b6574 data/actuallyadditions/loot_tables/blocks/diamatine_crystal_block.json
|
||||||
b9ed4007fec7a382a02b08b231f072df6aa40049 data/actuallyadditions/loot_tables/blocks/diamatine_crystal_cluster.json
|
b9ed4007fec7a382a02b08b231f072df6aa40049 data/actuallyadditions/loot_tables/blocks/diamatine_crystal_cluster.json
|
||||||
7476dbc0cbb3c1a8ce5a3c1562f73fcfb4adcd10 data/actuallyadditions/loot_tables/blocks/display_stand.json
|
7476dbc0cbb3c1a8ce5a3c1562f73fcfb4adcd10 data/actuallyadditions/loot_tables/blocks/display_stand.json
|
||||||
|
@ -559,7 +559,7 @@ d6c0f113ea7c3cc0e8c3a11860792966d516211b data/actuallyadditions/loot_tables/bloc
|
||||||
a365f2f0d80e070d281a7b839c961d36f115abeb data/actuallyadditions/loot_tables/blocks/phantom_redstoneface.json
|
a365f2f0d80e070d281a7b839c961d36f115abeb data/actuallyadditions/loot_tables/blocks/phantom_redstoneface.json
|
||||||
13f0d4587dac4822a26fd063a22f6f46c83e9af6 data/actuallyadditions/loot_tables/blocks/placer.json
|
13f0d4587dac4822a26fd063a22f6f46c83e9af6 data/actuallyadditions/loot_tables/blocks/placer.json
|
||||||
6d9a73f94513ed92c1697d25c5d89145b016ab5d data/actuallyadditions/loot_tables/blocks/player_interface.json
|
6d9a73f94513ed92c1697d25c5d89145b016ab5d data/actuallyadditions/loot_tables/blocks/player_interface.json
|
||||||
bb5b9781aa9c64a1330eff6d7bb3e6c2c7f3a645 data/actuallyadditions/loot_tables/blocks/powered_furnace.json
|
25a194a62fcad1b0b86540efbe6ca81757a3408a data/actuallyadditions/loot_tables/blocks/powered_furnace.json
|
||||||
a92f9584164335ecbcf769bc668289d76cea5d6c data/actuallyadditions/loot_tables/blocks/ranged_collector.json
|
a92f9584164335ecbcf769bc668289d76cea5d6c data/actuallyadditions/loot_tables/blocks/ranged_collector.json
|
||||||
d497fdb4936e1f3fdaa556da79e39f6fcbb405ed data/actuallyadditions/loot_tables/blocks/restonia_crystal_block.json
|
d497fdb4936e1f3fdaa556da79e39f6fcbb405ed data/actuallyadditions/loot_tables/blocks/restonia_crystal_block.json
|
||||||
7d025b370ad83e847619627002ca835901faf235 data/actuallyadditions/loot_tables/blocks/restonia_crystal_cluster.json
|
7d025b370ad83e847619627002ca835901faf235 data/actuallyadditions/loot_tables/blocks/restonia_crystal_cluster.json
|
||||||
|
@ -718,7 +718,7 @@ e088aee52db067c15c72bfe743ac106b98ca4be2 data/actuallyadditions/recipes/colorcha
|
||||||
a4fb51f83c38bfebceeadde885d59632e355bf6d data/actuallyadditions/recipes/colorchange/yellow_terracotta.json
|
a4fb51f83c38bfebceeadde885d59632e355bf6d data/actuallyadditions/recipes/colorchange/yellow_terracotta.json
|
||||||
ca4f8d37d115eac5889542b04d1c01cd2e0cde43 data/actuallyadditions/recipes/colorchange/yellow_wool.json
|
ca4f8d37d115eac5889542b04d1c01cd2e0cde43 data/actuallyadditions/recipes/colorchange/yellow_wool.json
|
||||||
160466dfd10fafc2ae4b4130ca35220d4c2d2342 data/actuallyadditions/recipes/crate_keeper.json
|
160466dfd10fafc2ae4b4130ca35220d4c2d2342 data/actuallyadditions/recipes/crate_keeper.json
|
||||||
341c5816febc417a36e516986f6d1461cf38cfed data/actuallyadditions/recipes/crushing/bone_crusher.json
|
b76b843a60a1c456a11d3bb932a93ab3753d6f58 data/actuallyadditions/recipes/crushing/bone_crusher.json
|
||||||
293cecfa94d22e62bd817a3964e82dca4479d44d data/actuallyadditions/recipes/diamond_aiot.json
|
293cecfa94d22e62bd817a3964e82dca4479d44d data/actuallyadditions/recipes/diamond_aiot.json
|
||||||
abb220fb19dea7cf9afcd30fbe533d21b7c4e9c0 data/actuallyadditions/recipes/display_stand.json
|
abb220fb19dea7cf9afcd30fbe533d21b7c4e9c0 data/actuallyadditions/recipes/display_stand.json
|
||||||
f3465f5a05a931f4e5933508c2bc56de9c9eafe5 data/actuallyadditions/recipes/double_battery.json
|
f3465f5a05a931f4e5933508c2bc56de9c9eafe5 data/actuallyadditions/recipes/double_battery.json
|
||||||
|
|
|
@ -13,19 +13,6 @@
|
||||||
{
|
{
|
||||||
"condition": "minecraft:survives_explosion"
|
"condition": "minecraft:survives_explosion"
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"functions": [
|
|
||||||
{
|
|
||||||
"function": "minecraft:copy_nbt",
|
|
||||||
"source": "block_entity",
|
|
||||||
"ops": [
|
|
||||||
{
|
|
||||||
"source": "Energy",
|
|
||||||
"target": "BlockEntityTag.Energy",
|
|
||||||
"op": "replace"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -13,19 +13,6 @@
|
||||||
{
|
{
|
||||||
"condition": "minecraft:survives_explosion"
|
"condition": "minecraft:survives_explosion"
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"functions": [
|
|
||||||
{
|
|
||||||
"function": "minecraft:copy_nbt",
|
|
||||||
"source": "block_entity",
|
|
||||||
"ops": [
|
|
||||||
{
|
|
||||||
"source": "Energy",
|
|
||||||
"target": "BlockEntityTag.Energy",
|
|
||||||
"op": "replace"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -13,19 +13,6 @@
|
||||||
{
|
{
|
||||||
"condition": "minecraft:survives_explosion"
|
"condition": "minecraft:survives_explosion"
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"functions": [
|
|
||||||
{
|
|
||||||
"function": "minecraft:copy_nbt",
|
|
||||||
"source": "block_entity",
|
|
||||||
"ops": [
|
|
||||||
{
|
|
||||||
"source": "Energy",
|
|
||||||
"target": "BlockEntityTag.Energy",
|
|
||||||
"op": "replace"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,12 +6,10 @@
|
||||||
"result": [
|
"result": [
|
||||||
{
|
{
|
||||||
"item": "minecraft:bone_meal",
|
"item": "minecraft:bone_meal",
|
||||||
"count": 6,
|
|
||||||
"chance": 1.0
|
"chance": 1.0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"item": "minecraft:air",
|
"item": "minecraft:air",
|
||||||
"count": 0,
|
|
||||||
"chance": 0.0
|
"chance": 0.0
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -57,9 +57,6 @@ public class LootTableGenerator extends LootTableProvider {
|
||||||
dropKeepEnergy(ActuallyBlocks.DISPLAY_STAND);
|
dropKeepEnergy(ActuallyBlocks.DISPLAY_STAND);
|
||||||
dropKeepEnergy(ActuallyBlocks.COAL_GENERATOR);
|
dropKeepEnergy(ActuallyBlocks.COAL_GENERATOR);
|
||||||
dropKeepEnergy(ActuallyBlocks.OIL_GENERATOR);
|
dropKeepEnergy(ActuallyBlocks.OIL_GENERATOR);
|
||||||
dropKeepEnergy(ActuallyBlocks.CRUSHER);
|
|
||||||
dropKeepEnergy(ActuallyBlocks.CRUSHER_DOUBLE);
|
|
||||||
dropKeepEnergy(ActuallyBlocks.POWERED_FURNACE);
|
|
||||||
|
|
||||||
this.dropSelf(ActuallyBlocks.BATTERY_BOX.get());
|
this.dropSelf(ActuallyBlocks.BATTERY_BOX.get());
|
||||||
this.dropSelf(ActuallyBlocks.ITEM_INTERFACE_HOPPING.get());
|
this.dropSelf(ActuallyBlocks.ITEM_INTERFACE_HOPPING.get());
|
||||||
|
@ -84,6 +81,9 @@ public class LootTableGenerator extends LootTableProvider {
|
||||||
this.dropSelf(ActuallyBlocks.PHANTOM_BREAKER.get());
|
this.dropSelf(ActuallyBlocks.PHANTOM_BREAKER.get());
|
||||||
this.dropSelf(ActuallyBlocks.FERMENTING_BARREL.get());
|
this.dropSelf(ActuallyBlocks.FERMENTING_BARREL.get());
|
||||||
this.dropSelf(ActuallyBlocks.FEEDER.get());
|
this.dropSelf(ActuallyBlocks.FEEDER.get());
|
||||||
|
this.dropSelf(ActuallyBlocks.CRUSHER.get());
|
||||||
|
this.dropSelf(ActuallyBlocks.CRUSHER_DOUBLE.get());
|
||||||
|
this.dropSelf(ActuallyBlocks.POWERED_FURNACE.get());
|
||||||
this.dropSelf(ActuallyBlocks.HEAT_COLLECTOR.get());
|
this.dropSelf(ActuallyBlocks.HEAT_COLLECTOR.get());
|
||||||
this.dropSelf(ActuallyBlocks.GREENHOUSE_GLASS.get());
|
this.dropSelf(ActuallyBlocks.GREENHOUSE_GLASS.get());
|
||||||
this.dropSelf(ActuallyBlocks.BREAKER.get());
|
this.dropSelf(ActuallyBlocks.BREAKER.get());
|
||||||
|
|
|
@ -46,9 +46,9 @@ public final class ActuallyBlocks {
|
||||||
// Machines
|
// Machines
|
||||||
public static final AABlockReg<BlockFeeder, AABlockItem, TileEntityFeeder> FEEDER = new AABlockReg<>("feeder", BlockFeeder::new, (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityFeeder::new);
|
public static final AABlockReg<BlockFeeder, AABlockItem, TileEntityFeeder> FEEDER = new AABlockReg<>("feeder", BlockFeeder::new, (b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityFeeder::new);
|
||||||
public static final AABlockReg<BlockCrusher, AABlockItem, TileEntityCrusher> CRUSHER = new AABlockReg<>("crusher", () -> new BlockCrusher(false),
|
public static final AABlockReg<BlockCrusher, AABlockItem, TileEntityCrusher> CRUSHER = new AABlockReg<>("crusher", () -> new BlockCrusher(false),
|
||||||
(b) -> new AABlockItem.BlockEntityEnergyItem(b, defaultBlockItemProperties), TileEntityCrusher::new);
|
(b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityCrusher::new);
|
||||||
public static final AABlockReg<BlockCrusher, AABlockItem, TileEntityCrusher> CRUSHER_DOUBLE = new AABlockReg<>("crusher_double", () -> new BlockCrusher(false),
|
public static final AABlockReg<BlockCrusher, AABlockItem, TileEntityCrusher> CRUSHER_DOUBLE = new AABlockReg<>("crusher_double", () -> new BlockCrusher(false),
|
||||||
(b) -> new AABlockItem.BlockEntityEnergyItem(b, defaultBlockItemProperties), TileEntityCrusherDouble::new);
|
(b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityCrusherDouble::new);
|
||||||
|
|
||||||
public static final AABlockReg<BlockEnergizer, AABlockItem, TileEntityEnergizer> ENERGIZER = new AABlockReg<>("energizer", () -> new BlockEnergizer(true),
|
public static final AABlockReg<BlockEnergizer, AABlockItem, TileEntityEnergizer> ENERGIZER = new AABlockReg<>("energizer", () -> new BlockEnergizer(true),
|
||||||
(b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityEnergizer::new);
|
(b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityEnergizer::new);
|
||||||
|
@ -108,7 +108,7 @@ public final class ActuallyBlocks {
|
||||||
public static final AABlockReg<BlockCoffeeMachine, AABlockItem, TileEntityCoffeeMachine> COFFEE_MACHINE = new AABlockReg<>("coffee_machine", BlockCoffeeMachine::new,
|
public static final AABlockReg<BlockCoffeeMachine, AABlockItem, TileEntityCoffeeMachine> COFFEE_MACHINE = new AABlockReg<>("coffee_machine", BlockCoffeeMachine::new,
|
||||||
(b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityCoffeeMachine::new);
|
(b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityCoffeeMachine::new);
|
||||||
public static final AABlockReg<BlockPoweredFurnace, AABlockItem, TileEntityPoweredFurnace> POWERED_FURNACE = new AABlockReg<>("powered_furnace", BlockPoweredFurnace::new,
|
public static final AABlockReg<BlockPoweredFurnace, AABlockItem, TileEntityPoweredFurnace> POWERED_FURNACE = new AABlockReg<>("powered_furnace", BlockPoweredFurnace::new,
|
||||||
(b) -> new AABlockItem.BlockEntityEnergyItem(b, defaultBlockItemProperties), TileEntityPoweredFurnace::new);
|
(b) -> new AABlockItem(b, defaultBlockItemProperties), TileEntityPoweredFurnace::new);
|
||||||
|
|
||||||
|
|
||||||
// Crystal Blocks
|
// Crystal Blocks
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class BlockCrusher extends BlockContainerBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||||
return defaultBlockState().setValue(HORIZONTAL_FACING, context.getHorizontalDirection().getOpposite()).setValue(LIT, false);
|
return defaultBlockState().setValue(HORIZONTAL_FACING, context.getNearestLookingDirection().getOpposite()).setValue(LIT, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -121,18 +121,14 @@ public class CrushingRecipe implements IRecipe<IInventory> {
|
||||||
if (resultList.size() < 1)
|
if (resultList.size() < 1)
|
||||||
throw new IllegalStateException(pRecipeId.toString() + ": Recipe must contain at least 1 result item");
|
throw new IllegalStateException(pRecipeId.toString() + ": Recipe must contain at least 1 result item");
|
||||||
|
|
||||||
JsonObject result1 = resultList.get(0).getAsJsonObject();
|
ItemStack output1 = new ItemStack(JSONUtils.getAsItem(resultList.get(0).getAsJsonObject(), "item"));
|
||||||
int count1 = JSONUtils.getAsInt(result1, "count", 0);
|
float chance1 = JSONUtils.getAsFloat(resultList.get(0).getAsJsonObject(), "chance");
|
||||||
ItemStack output1 = new ItemStack(JSONUtils.getAsItem(result1, "item"), count1);
|
|
||||||
float chance1 = JSONUtils.getAsFloat(result1, "chance");
|
|
||||||
|
|
||||||
ItemStack output2 = ItemStack.EMPTY;
|
ItemStack output2 = ItemStack.EMPTY;
|
||||||
float chance2 = 1.0f;
|
float chance2 = 1.0f;
|
||||||
if (resultList.size() > 1) {
|
if (resultList.size() > 1) {
|
||||||
JsonObject result2 = resultList.get(1).getAsJsonObject();
|
output2 = new ItemStack(JSONUtils.getAsItem(resultList.get(1).getAsJsonObject(), "item"));
|
||||||
int count2 = JSONUtils.getAsInt(result2, "count", 0);
|
chance2 = JSONUtils.getAsFloat(resultList.get(1).getAsJsonObject(), "chance");
|
||||||
output2 = new ItemStack(JSONUtils.getAsItem(result2, "item"), count2);
|
|
||||||
chance2 = JSONUtils.getAsFloat(result2, "chance");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new CrushingRecipe(pRecipeId, ingredient, output1, chance1, output2, chance2);
|
return new CrushingRecipe(pRecipeId, ingredient, output1, chance1, output2, chance2);
|
||||||
|
@ -186,12 +182,10 @@ public class CrushingRecipe implements IRecipe<IInventory> {
|
||||||
|
|
||||||
JsonObject result1 = new JsonObject();
|
JsonObject result1 = new JsonObject();
|
||||||
result1.addProperty("item", outputOne.asItem().getRegistryName().toString());
|
result1.addProperty("item", outputOne.asItem().getRegistryName().toString());
|
||||||
result1.addProperty("count", countOne);
|
|
||||||
result1.addProperty("chance", outputChance1);
|
result1.addProperty("chance", outputChance1);
|
||||||
|
|
||||||
JsonObject result2 = new JsonObject();
|
JsonObject result2 = new JsonObject();
|
||||||
result2.addProperty("item", outputTwo.asItem().getRegistryName().toString());
|
result2.addProperty("item", outputTwo.asItem().getRegistryName().toString());
|
||||||
result2.addProperty("count", countTwo);
|
|
||||||
result2.addProperty("chance", outputChance2);
|
result2.addProperty("chance", outputChance2);
|
||||||
|
|
||||||
JsonArray resultList = new JsonArray();
|
JsonArray resultList = new JsonArray();
|
||||||
|
|
|
@ -8,8 +8,7 @@ public class SingleItem implements IInventory {
|
||||||
private final ItemStack itemStack;
|
private final ItemStack itemStack;
|
||||||
|
|
||||||
public SingleItem(ItemStack itemStack) {
|
public SingleItem(ItemStack itemStack) {
|
||||||
this.itemStack = itemStack.copy();
|
this.itemStack = itemStack;
|
||||||
this.itemStack.setCount(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,9 +10,7 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.tile;
|
package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.AASounds;
|
import de.ellpeck.actuallyadditions.mod.AASounds;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe;
|
import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.CrusherContainer;
|
import de.ellpeck.actuallyadditions.mod.inventory.CrusherContainer;
|
||||||
|
@ -39,7 +37,6 @@ import net.minecraftforge.common.util.LazyOptional;
|
||||||
import net.minecraftforge.energy.IEnergyStorage;
|
import net.minecraftforge.energy.IEnergyStorage;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public class TileEntityCrusher extends TileEntityInventoryBase implements IButtonReactor, INamedContainerProvider {
|
public class TileEntityCrusher extends TileEntityInventoryBase implements IButtonReactor, INamedContainerProvider {
|
||||||
|
|
||||||
|
@ -189,21 +186,26 @@ public class TileEntityCrusher extends TileEntityInventoryBase implements IButto
|
||||||
return (slot, automation) -> !automation || slot == SLOT_OUTPUT_1_1 || slot == SLOT_OUTPUT_1_2 || slot == SLOT_OUTPUT_2_1 || slot == SLOT_OUTPUT_2_2;
|
return (slot, automation) -> !automation || slot == SLOT_OUTPUT_1_1 || slot == SLOT_OUTPUT_1_2 || slot == SLOT_OUTPUT_2_1 || slot == SLOT_OUTPUT_2_2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Optional<CrushingRecipe> getRecipeForInput(ItemStack itemStack) {
|
|
||||||
return ActuallyAdditionsAPI.CRUSHER_RECIPES.stream().filter($ -> $.matches(itemStack)).findFirst();
|
|
||||||
}
|
|
||||||
public boolean canCrushOn(int theInput, int theFirstOutput, int theSecondOutput) {
|
public boolean canCrushOn(int theInput, int theFirstOutput, int theSecondOutput) {
|
||||||
ItemStack inputStack = this.inv.getStackInSlot(theInput);
|
if (StackUtil.isValid(this.inv.getStackInSlot(theInput))) {
|
||||||
if (!inputStack.isEmpty()) {
|
CrushingRecipe recipe = null;//CrusherRecipeRegistry.getRecipeFromInput(this.inv.getStackInSlot(theInput)); //TODO
|
||||||
Optional<CrushingRecipe> recipeOpt = getRecipeForInput(inputStack);
|
if (recipe == null) {
|
||||||
if (!recipeOpt.isPresent()) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
CrushingRecipe recipe = recipeOpt.get();
|
|
||||||
ItemStack outputOne = recipe.getOutputOne();
|
ItemStack outputOne = recipe.getOutputOne();
|
||||||
ItemStack outputTwo = recipe.getOutputTwo();
|
ItemStack outputTwo = recipe.getOutputTwo();
|
||||||
if (!outputOne.isEmpty()) {
|
if (StackUtil.isValid(outputOne)) {
|
||||||
return (this.inv.getStackInSlot(theFirstOutput).isEmpty() || this.inv.getStackInSlot(theFirstOutput).sameItem(outputOne) && this.inv.getStackInSlot(theFirstOutput).getCount() <= this.inv.getStackInSlot(theFirstOutput).getMaxStackSize() - outputOne.getCount()) && (outputTwo.isEmpty() || this.inv.getStackInSlot(theSecondOutput).isEmpty() || this.inv.getStackInSlot(theSecondOutput).sameItem(outputTwo) && this.inv.getStackInSlot(theSecondOutput).getCount() <= this.inv.getStackInSlot(theSecondOutput).getMaxStackSize() - outputTwo.getCount());
|
/* //TODO
|
||||||
|
if (outputOne.getDamage() == Util.WILDCARD) {
|
||||||
|
outputOne.setDamage(0);
|
||||||
|
}
|
||||||
|
if (StackUtil.isValid(outputTwo) && outputTwo.getDamage() == Util.WILDCARD) {
|
||||||
|
outputTwo.setDamage(0);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
if ((!StackUtil.isValid(this.inv.getStackInSlot(theFirstOutput)) || this.inv.getStackInSlot(theFirstOutput).sameItem(outputOne) && this.inv.getStackInSlot(theFirstOutput).getCount() <= this.inv.getStackInSlot(theFirstOutput).getMaxStackSize() - outputOne.getCount()) && (!StackUtil.isValid(outputTwo) || !StackUtil.isValid(this.inv.getStackInSlot(theSecondOutput)) || this.inv.getStackInSlot(theSecondOutput).sameItem(outputTwo) && this.inv.getStackInSlot(theSecondOutput).getCount() <= this.inv.getStackInSlot(theSecondOutput).getMaxStackSize() - outputTwo.getCount())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -216,15 +218,18 @@ public class TileEntityCrusher extends TileEntityInventoryBase implements IButto
|
||||||
}
|
}
|
||||||
|
|
||||||
public void finishCrushing(int theInput, int theFirstOutput, int theSecondOutput) {
|
public void finishCrushing(int theInput, int theFirstOutput, int theSecondOutput) {
|
||||||
Optional<CrushingRecipe> recipeOpt = getRecipeForInput(this.inv.getStackInSlot(theInput));
|
CrushingRecipe recipe = CrusherRecipeRegistry.getRecipeFromInput(this.inv.getStackInSlot(theInput));//TODO
|
||||||
if (!recipeOpt.isPresent()) {
|
if (recipe == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CrushingRecipe recipe = recipeOpt.get();
|
|
||||||
|
|
||||||
ItemStack outputOne = recipe.getOutputOne();
|
ItemStack outputOne = recipe.getOutputOne();
|
||||||
if (!outputOne.isEmpty()) {
|
if (StackUtil.isValid(outputOne)) {
|
||||||
if (this.inv.getStackInSlot(theFirstOutput).isEmpty()) {
|
/* //TODO
|
||||||
|
if (outputOne.getDamage() == Util.WILDCARD) {
|
||||||
|
outputOne.setDamage(0);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
if (!StackUtil.isValid(this.inv.getStackInSlot(theFirstOutput))) {
|
||||||
this.inv.setStackInSlot(theFirstOutput, outputOne.copy());
|
this.inv.setStackInSlot(theFirstOutput, outputOne.copy());
|
||||||
} else if (this.inv.getStackInSlot(theFirstOutput).getItem() == outputOne.getItem()) {
|
} else if (this.inv.getStackInSlot(theFirstOutput).getItem() == outputOne.getItem()) {
|
||||||
this.inv.setStackInSlot(theFirstOutput, StackUtil.grow(this.inv.getStackInSlot(theFirstOutput), outputOne.getCount()));
|
this.inv.setStackInSlot(theFirstOutput, StackUtil.grow(this.inv.getStackInSlot(theFirstOutput), outputOne.getCount()));
|
||||||
|
@ -232,10 +237,15 @@ public class TileEntityCrusher extends TileEntityInventoryBase implements IButto
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack outputTwo = recipe.getOutputTwo();
|
ItemStack outputTwo = recipe.getOutputTwo();
|
||||||
if (!outputTwo.isEmpty()) {
|
if (StackUtil.isValid(outputTwo)) {
|
||||||
|
/* //TODO
|
||||||
|
if (outputTwo.getDamage() == Util.WILDCARD) {
|
||||||
|
outputTwo.setDamage(0);
|
||||||
|
}
|
||||||
|
*/
|
||||||
float rand = this.level.random.nextFloat();
|
float rand = this.level.random.nextFloat();
|
||||||
if (rand <= recipe.getSecondChance()) {
|
if (rand <= recipe.getSecondChance()) {
|
||||||
if (this.inv.getStackInSlot(theSecondOutput).isEmpty()) {
|
if (!StackUtil.isValid(this.inv.getStackInSlot(theSecondOutput))) {
|
||||||
this.inv.setStackInSlot(theSecondOutput, outputTwo.copy());
|
this.inv.setStackInSlot(theSecondOutput, outputTwo.copy());
|
||||||
} else if (this.inv.getStackInSlot(theSecondOutput).getItem() == outputTwo.getItem()) {
|
} else if (this.inv.getStackInSlot(theSecondOutput).getItem() == outputTwo.getItem()) {
|
||||||
this.inv.setStackInSlot(theSecondOutput, StackUtil.grow(this.inv.getStackInSlot(theSecondOutput), outputTwo.getCount()));
|
this.inv.setStackInSlot(theSecondOutput, StackUtil.grow(this.inv.getStackInSlot(theSecondOutput), outputTwo.getCount()));
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.tile;
|
package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.SingleItem;
|
import de.ellpeck.actuallyadditions.mod.crafting.SingleItem;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFurnaceDouble;
|
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFurnaceDouble;
|
||||||
|
@ -25,10 +24,8 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
import net.minecraft.inventory.container.Container;
|
import net.minecraft.inventory.container.Container;
|
||||||
import net.minecraft.inventory.container.INamedContainerProvider;
|
import net.minecraft.inventory.container.INamedContainerProvider;
|
||||||
import net.minecraft.inventory.container.Slot;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.AbstractCookingRecipe;
|
import net.minecraft.item.crafting.AbstractCookingRecipe;
|
||||||
import net.minecraft.item.crafting.FurnaceRecipe;
|
|
||||||
import net.minecraft.item.crafting.IRecipeType;
|
import net.minecraft.item.crafting.IRecipeType;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.state.properties.BlockStateProperties;
|
import net.minecraft.state.properties.BlockStateProperties;
|
||||||
|
@ -70,11 +67,11 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
|
||||||
ItemStack first = inv.getStackInSlot(slot1);
|
ItemStack first = inv.getStackInSlot(slot1);
|
||||||
ItemStack second = inv.getStackInSlot(slot2);
|
ItemStack second = inv.getStackInSlot(slot2);
|
||||||
|
|
||||||
if (!first.isEmpty() || !second.isEmpty()) {
|
if (StackUtil.isValid(first) || StackUtil.isValid(second)) {
|
||||||
ItemStack toSplit = ItemStack.EMPTY;
|
ItemStack toSplit = ItemStack.EMPTY;
|
||||||
if (first.isEmpty() && !second.isEmpty() && second.getCount() > 1) {
|
if (!StackUtil.isValid(first) && StackUtil.isValid(second) && second.getCount() > 1) {
|
||||||
toSplit = second;
|
toSplit = second;
|
||||||
} else if (second.isEmpty() && !first.isEmpty() && first.getCount() > 1) {
|
} else if (!StackUtil.isValid(second) && StackUtil.isValid(first) && first.getCount() > 1) {
|
||||||
toSplit = first;
|
toSplit = first;
|
||||||
} else if (ItemUtil.canBeStacked(first, second)) {
|
} else if (ItemUtil.canBeStacked(first, second)) {
|
||||||
if (first.getCount() < first.getMaxStackSize() || second.getCount() < second.getMaxStackSize()) {
|
if (first.getCount() < first.getMaxStackSize() || second.getCount() < second.getMaxStackSize()) {
|
||||||
|
@ -85,7 +82,7 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!toSplit.isEmpty()) {
|
if (StackUtil.isValid(toSplit)) {
|
||||||
ItemStack splitFirst = toSplit.copy();
|
ItemStack splitFirst = toSplit.copy();
|
||||||
ItemStack secondSplit = splitFirst.split(splitFirst.getCount() / 2);
|
ItemStack secondSplit = splitFirst.split(splitFirst.getCount() / 2);
|
||||||
inv.setStackInSlot(slot1, splitFirst);
|
inv.setStackInSlot(slot1, splitFirst);
|
||||||
|
@ -123,7 +120,6 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
|
||||||
if (this.isAutoSplit) {
|
if (this.isAutoSplit) {
|
||||||
autoSplit(this.inv, SLOT_INPUT_1, SLOT_INPUT_2);
|
autoSplit(this.inv, SLOT_INPUT_1, SLOT_INPUT_2);
|
||||||
}
|
}
|
||||||
//TODO all this logic needs redone someday
|
|
||||||
|
|
||||||
boolean smelted = false;
|
boolean smelted = false;
|
||||||
|
|
||||||
|
@ -194,10 +190,6 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
|
||||||
return level.getServer().getRecipeManager().getRecipeFor(IRecipeType.SMELTING, new SingleItem(stack), level).map(AbstractCookingRecipe::getResultItem);
|
return level.getServer().getRecipeManager().getRecipeFor(IRecipeType.SMELTING, new SingleItem(stack), level).map(AbstractCookingRecipe::getResultItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<FurnaceRecipe> getRecipeForInput(ItemStack stack) {
|
|
||||||
return level.getServer().getRecipeManager().getRecipeFor(IRecipeType.SMELTING, new SingleItem(stack), level);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IAcceptor getAcceptor() {
|
public IAcceptor getAcceptor() {
|
||||||
return (slot, stack, automation) -> !automation || (slot == SLOT_INPUT_1 || slot == SLOT_INPUT_2) && validInput(stack);
|
return (slot, stack, automation) -> !automation || (slot == SLOT_INPUT_1 || slot == SLOT_INPUT_2) && validInput(stack);
|
||||||
|
@ -212,8 +204,10 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
|
||||||
ItemStack input = this.inv.getStackInSlot(theInput);
|
ItemStack input = this.inv.getStackInSlot(theInput);
|
||||||
ItemStack output = this.inv.getStackInSlot(theOutput);
|
ItemStack output = this.inv.getStackInSlot(theOutput);
|
||||||
if (!input.isEmpty()) {
|
if (!input.isEmpty()) {
|
||||||
Optional<FurnaceRecipe> recipe = getRecipeForInput(input);
|
ItemStack outputStack = getOutputForInput(input).orElse(ItemStack.EMPTY);
|
||||||
return recipe.map($ -> output.isEmpty() || output.sameItem($.getResultItem()) && output.getCount() <= output.getMaxStackSize() - $.getResultItem().getCount()).orElse(false);
|
if (!output.isEmpty()) {
|
||||||
|
return output.isEmpty() || output.sameItem(outputStack) && output.getCount() <= output.getMaxStackSize() - outputStack.getCount();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,8 +44,5 @@ public class ResourceReloader implements IResourceManagerReloadListener {
|
||||||
|
|
||||||
ActuallyAdditionsAPI.MINING_LENS_RECIPES.clear();
|
ActuallyAdditionsAPI.MINING_LENS_RECIPES.clear();
|
||||||
ActuallyAdditionsAPI.MINING_LENS_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.MINING_LENS));
|
ActuallyAdditionsAPI.MINING_LENS_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.MINING_LENS));
|
||||||
|
|
||||||
ActuallyAdditionsAPI.CRUSHER_RECIPES.clear();
|
|
||||||
ActuallyAdditionsAPI.CRUSHER_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.CRUSHING));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@
|
||||||
"block.actuallyadditions.giant_chest_medium": "Medium Storage Crate",
|
"block.actuallyadditions.giant_chest_medium": "Medium Storage Crate",
|
||||||
"block.actuallyadditions.giant_chest_large": "Large Storage Crate",
|
"block.actuallyadditions.giant_chest_large": "Large Storage Crate",
|
||||||
"block.actuallyadditions.crusher": "Crusher",
|
"block.actuallyadditions.crusher": "Crusher",
|
||||||
"block.actuallyadditions.crusher_double": "Double Crusher",
|
"block.actuallyadditions.double_crusher": "Double Crusher",
|
||||||
"block.actuallyadditions.powered_furnace": "Powered Furnace",
|
"block.actuallyadditions.powered_furnace": "Powered Furnace",
|
||||||
"block.actuallyadditions.fishing_net": "Fishing Net",
|
"block.actuallyadditions.fishing_net": "Fishing Net",
|
||||||
"block.actuallyadditions.furnace_solar": "Solar Panel",
|
"block.actuallyadditions.furnace_solar": "Solar Panel",
|
||||||
|
@ -591,7 +591,7 @@
|
||||||
"container.actuallyadditions.inputter": "ESD",
|
"container.actuallyadditions.inputter": "ESD",
|
||||||
"container.actuallyadditions.inputterAdvanced": "Advanced ESD",
|
"container.actuallyadditions.inputterAdvanced": "Advanced ESD",
|
||||||
"container.actuallyadditions.crusher": "Crusher",
|
"container.actuallyadditions.crusher": "Crusher",
|
||||||
"container.actuallyadditions.crusher_double": "Double Crusher",
|
"container.actuallyadditions.double_crusher": "Double Crusher",
|
||||||
"container.actuallyadditions.powered_furnace": "Powered Furnace",
|
"container.actuallyadditions.powered_furnace": "Powered Furnace",
|
||||||
"container.actuallyadditions.feeder": "Feeder",
|
"container.actuallyadditions.feeder": "Feeder",
|
||||||
"container.actuallyadditions.giantChest": "Small Storage Crate",
|
"container.actuallyadditions.giantChest": "Small Storage Crate",
|
||||||
|
|
Loading…
Reference in a new issue