Merge branch '1.18' into 1.18-Ayutac-datagen-6

# Conflicts:
#	src/main/java/techreborn/init/TRContent.java
#	src/main/resources/data/techreborn/recipes/compressor/chrome_plate.json
#	src/main/resources/data/techreborn/recipes/compressor/chrome_plate_from_block.json
#	src/main/resources/data/techreborn/recipes/grinder/chrome_dust.json
This commit is contained in:
Ayutac 2022-02-26 12:14:11 +01:00
commit e35e222fa6
25 changed files with 359 additions and 120 deletions

View file

@ -50,7 +50,8 @@ public class IronFurnaceBlockEntity extends AbstractIronMachineBlockEntity imple
int inputSlot = 0;
int outputSlot = 1;
public float experience;
private boolean previousValid = false;
private ItemStack previousStack = ItemStack.EMPTY;
private Recipe<?> lastRecipe = null;
public IronFurnaceBlockEntity(BlockPos pos, BlockState state) {
@ -75,6 +76,9 @@ public class IronFurnaceBlockEntity extends AbstractIronMachineBlockEntity imple
// Fast fail if there is no input, no point checking the recipes if the machine is empty
return ItemStack.EMPTY;
}
if (previousStack.isItemEqualIgnoreDamage(stack) && !previousValid){
return ItemStack.EMPTY;
}
// Check the previous recipe to see if it still applies to the current inv, saves rechecking the whole recipe list
if (lastRecipe != null && RecipeUtils.matchesSingleInput(lastRecipe, stack)) {
@ -123,11 +127,18 @@ public class IronFurnaceBlockEntity extends AbstractIronMachineBlockEntity imple
ItemStack inputStack = inventory.getStack(inputSlot);
if (inputStack.isEmpty())
return false;
if (previousStack != inputStack) {
previousStack = inputStack;
previousValid = true;
}
ItemStack outputStack = getResultFor(inputStack);
if (outputStack.isEmpty())
if (outputStack.isEmpty()) {
previousValid = false;
return false;
}
else {
previousValid = true;
}
ItemStack outputSlotStack = inventory.getStack(outputSlot);
if (outputSlotStack.isEmpty())
return true;

View file

@ -162,8 +162,8 @@ public class AdjustableSUBlockEntity extends EnergyStorageBlockEntity implements
@Override
public BuiltScreenHandler createScreenHandler(int syncID, PlayerEntity player) {
return new ScreenHandlerBuilder("aesu").player(player.getInventory()).inventory().hotbar().armor()
.complete(8, 18).addArmor().addInventory().blockEntity(this).energySlot(0, 62, 45).energySlot(1, 98, 45)
.syncEnergyValue().sync(this::getCurrentOutput, this::setCurrentOutput).addInventory().create(this, syncID);
.complete(8, 18).addArmor().addInventory().blockEntity(this).energySlot(0, 62, 45).energySlot(1, 98, 45)
.syncEnergyValue().sync(this::getCurrentOutput, this::setCurrentOutput).addInventory().create(this, syncID);
}
public int getCurrentOutput() {

View file

@ -39,7 +39,7 @@ public class BlockMachineCasing extends BlockMultiblockBase {
public final int heatCapacity;
public BlockMachineCasing(int heatCapacity) {
super(FabricBlockSettings.of(Material.METAL).strength(2f, 2f).sounds(BlockSoundGroup.METAL));
super(FabricBlockSettings.of(Material.METAL).strength(2f, 2f).sounds(BlockSoundGroup.METAL).requiresTool());
this.heatCapacity = heatCapacity;
}
@ -56,5 +56,4 @@ public class BlockMachineCasing extends BlockMultiblockBase {
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
return new MachineCasingBlockEntity(pos, state);
}
}

View file

@ -31,15 +31,15 @@ import reborncore.common.BaseBlock;
public class BlockStorage extends BaseBlock {
public BlockStorage(boolean isHot) {
super(isHot ? getDefaultSettings().luminance(15).nonOpaque() : getDefaultSettings());
}
public BlockStorage() {
this(false);
this(false, 3f, 6f);
}
public static FabricBlockSettings getDefaultSettings() {
return FabricBlockSettings.of(Material.METAL).strength(2f, 2f).sounds(BlockSoundGroup.METAL);
public BlockStorage(boolean isHot, float hardness, float resistance) {
super(isHot ? getDefaultSettings(hardness, resistance).luminance(15).nonOpaque() : getDefaultSettings(hardness, resistance));
}
public static FabricBlockSettings getDefaultSettings(float hardness, float resistance) {
return FabricBlockSettings.of(Material.METAL).strength(hardness, resistance).sounds(BlockSoundGroup.METAL).requiresTool();
}
}

View file

@ -439,25 +439,25 @@ public class TechRebornConfig {
public static int electricFurnaceMaxEnergy = 1000;
@Config(config = "machines", category = "storage", key = "CrudeStorageUnitMaxStorage", comment = "Maximum amount of items a Crude Storage Unit can store")
public static int crudeStorageUnitMaxStorage = 2048;
public static int crudeStorageUnitMaxStorage = 1 << 11; // 2^11, around 2,000, holds 2^5=32 64-stacks
@Config(config = "machines", category = "storage", key = "BasicStorageUnitMaxStorage", comment = "Maximum amount of items a Basic Storage Unit can store")
public static int basicStorageUnitMaxStorage = 8192;
public static int basicStorageUnitMaxStorage = 1 << 13; // 2^13, around 8,000, holds 2^7=128 64-stacks
@Config(config = "machines", category = "storage", key = "BasicTankUnitCapacity", comment = "How much liquid a Basic Tank Unit can take (Value in buckets, 1000 Mb)")
public static int basicTankUnitCapacity = 35;
public static int basicTankUnitCapacity = 1 << 7; // 2^7=128, holds 2^3=8 16-stacks cells (content only)
@Config(config = "machines", category = "storage", key = "AdvancedStorageMaxStorage", comment = "Maximum amount of items an Advanced Storage Unit can store")
public static int advancedStorageUnitMaxStorage = 32768;
public static int advancedStorageUnitMaxStorage = 1 << 15; // 2^15, around 32,000, holds 2^9=512 64-stacks
@Config(config = "machines", category = "storage", key = "AdvancedTankUnitMaxStorage", comment = "How much liquid an Advanced Tank Unit can take (Value in buckets, 1000 Mb)")
public static int advancedTankUnitMaxStorage = 200;
public static int advancedTankUnitMaxStorage = 1 << 9; // 2^9=512, holds 2^5=32 16-stacks cells (content only)
@Config(config = "machines", category = "storage", key = "IndustrialStorageMaxStorage", comment = "Maximum amount of items an Industrial Storage Unit can store (Compat: >= 32768)")
public static int industrialStorageUnitMaxStorage = 65536;
public static int industrialStorageUnitMaxStorage = 1 << 16; // 2^16, around 65,000, holds 2^10=1024 64-stacks
@Config(config = "machines", category = "storage", key = "IndustrialTankUnitCapacity", comment = "How much liquid an Industrial Tank Unit can take (Value in buckets, 1000 Mb)")
public static int industrialTankUnitCapacity = 500;
public static int industrialTankUnitCapacity = 1 << 10; // 2^10, around 1,000, holds 2^6=64 16-stacks cells (content only)
@Config(config = "machines", category = "storage", key = "QuantumStorageUnitMaxStorage", comment = "Maximum amount of items a Quantum Storage Unit can store (Compat: == MAX_VALUE)")
public static int quantumStorageUnitMaxStorage = Integer.MAX_VALUE;

View file

@ -451,7 +451,8 @@ public class TRContent {
block = new OreBlock(FabricBlockSettings.of(Material.STONE)
.requiresTool()
.sounds(name.startsWith("deepslate") ? BlockSoundGroup.DEEPSLATE : BlockSoundGroup.STONE)
.strength(2f, 2f),
.hardness(name.startsWith("deepslate") ? 4.5f : 3f)
.resistance(3f),
distribution != null ? distribution.experienceDropped : experienceDroppedFallback
);
this.industrial = industrial;
@ -508,13 +509,47 @@ public class TRContent {
}
}
/**
* The base tag name for chrome items. "chromium" is proper spelling, but changing the enum constant names or
* directly registry names will result in item loss upon updating. Hence, only the base tag is changed, where needed.
*/
public static final String CHROME_TAG_NAME_BASE = "chromium";
public static final Tag.Identified<Item> STORAGE_BLOCK_TAG = TagFactory.ITEM.create(new Identifier(TechReborn.MOD_ID, "storage_blocks"));
public enum StorageBlocks implements ItemConvertible, TagConvertible<Item> {
ADVANCED_ALLOY, ALUMINUM, BRASS, BRONZE, CHROME, ELECTRUM, HOT_TUNGSTENSTEEL(true), INVAR, IRIDIUM,
IRIDIUM_REINFORCED_STONE, IRIDIUM_REINFORCED_TUNGSTENSTEEL, LEAD, NICKEL, PERIDOT, PLATINUM, RAW_IRIDIUM,
RAW_LEAD, RAW_SILVER, RAW_TIN, RAW_TUNGSTEN, RED_GARNET, REFINED_IRON, RUBY, SAPPHIRE, SILVER, STEEL, TIN,
TITANIUM, TUNGSTEN, TUNGSTENSTEEL, YELLOW_GARNET, ZINC;
ADVANCED_ALLOY(5f, 6f),
ALUMINUM(),
BRASS(),
BRONZE(5f, 6f),
CHROME(false, 5f, 6f, CHROME_TAG_NAME_BASE),
ELECTRUM(),
HOT_TUNGSTENSTEEL(true, 5f, 6f),
INVAR(),
IRIDIUM(5f, 6f),
IRIDIUM_REINFORCED_STONE(30f, 800f),
IRIDIUM_REINFORCED_TUNGSTENSTEEL(50f, 1200f),
LEAD(),
NICKEL(5f, 6f),
PERIDOT(5f, 6f),
PLATINUM(5f, 6f),
RAW_IRIDIUM(2f, 2f),
RAW_LEAD(2f, 2f),
RAW_SILVER(2f, 2f),
RAW_TIN(2f, 2f),
RAW_TUNGSTEN(2f, 2f),
RED_GARNET(5f, 6f),
REFINED_IRON(5f, 6f),
RUBY(5f, 6f),
SAPPHIRE(5f, 6f),
SILVER(5f, 6f),
STEEL(5f, 6f),
TIN(),
TITANIUM(5f, 6f),
TUNGSTEN(5f, 6f),
TUNGSTENSTEEL(30f, 800f),
YELLOW_GARNET(5f, 6f),
ZINC(5f, 6f);
private final String name;
private final Block block;
@ -523,11 +558,11 @@ public class TRContent {
private final WallBlock wallBlock;
private final Tag.Identified<Item> tag;
StorageBlocks(boolean isHot) {
StorageBlocks(boolean isHot, float hardness, float resistance, String tagNameBase) {
name = this.toString().toLowerCase(Locale.ROOT);
block = new BlockStorage(isHot);
block = new BlockStorage(isHot, hardness, resistance);
InitUtils.setup(block, name + "_storage_block");
tag = TagFactory.ITEM.create(new Identifier("c", name + "_blocks"));
tag = TagFactory.ITEM.create(new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_blocks"));
stairsBlock = new TechRebornStairsBlock(block.getDefaultState(), FabricBlockSettings.copyOf(block));
InitUtils.setup(stairsBlock, name + "_storage_block_stairs");
@ -539,8 +574,16 @@ public class TRContent {
InitUtils.setup(wallBlock, name + "_storage_block_wall");
}
StorageBlocks(boolean isHot, float hardness, float resistance) {
this(isHot, hardness, resistance, null);
}
StorageBlocks(float hardness, float resistance) {
this(false, hardness, resistance, null);
}
StorageBlocks() {
this(false);
this(false, 3f, 6f);
}
@Override
@ -698,7 +741,7 @@ public class TRContent {
public static final Tag.Identified<Item> DUSTS_TAG = TagFactory.ITEM.create(new Identifier(TechReborn.MOD_ID, "dusts"));
public enum Dusts implements ItemConvertible, TagConvertible<Item> {
ALMANDINE, ALUMINUM, AMETHYST, ANDESITE, ANDRADITE, ASHES, BASALT, BAUXITE, BRASS, BRONZE, CALCITE, CHARCOAL, CHROME,
ALMANDINE, ALUMINUM, AMETHYST, ANDESITE, ANDRADITE, ASHES, BASALT, BAUXITE, BRASS, BRONZE, CALCITE, CHARCOAL, CHROME(CHROME_TAG_NAME_BASE),
CINNABAR, CLAY, COAL, DARK_ASHES, DIAMOND, DIORITE, ELECTRUM, EMERALD, ENDER_EYE, ENDER_PEARL, ENDSTONE,
FLINT, GALENA, GRANITE, GROSSULAR, INVAR, LAZURITE, MAGNESIUM, MANGANESE, MARBLE, NETHERRACK,
NICKEL, OBSIDIAN, OLIVINE, PERIDOT, PHOSPHOROUS, PLATINUM, PYRITE, PYROPE, QUARTZ, RED_GARNET, RUBY, SALTPETER,
@ -708,11 +751,15 @@ public class TRContent {
private final Item item;
private final Tag.Identified<Item> tag;
Dusts() {
Dusts(String tagNameBase) {
name = this.toString().toLowerCase(Locale.ROOT);
item = new Item(new Item.Settings().group(TechReborn.ITEMGROUP));
InitUtils.setup(item, name + "_dust");
tag = TagFactory.ITEM.create(new Identifier("c", name + "_dusts"));
tag = TagFactory.ITEM.create(new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_dusts"));
}
Dusts() {
this(null);
}
public ItemStack getStack() {
@ -814,7 +861,7 @@ public class TRContent {
public static final Tag.Identified<Item> SMALL_DUSTS_TAG = TagFactory.ITEM.create(new Identifier(TechReborn.MOD_ID, "small_dusts"));
public enum SmallDusts implements ItemConvertible, TagConvertible<Item> {
ALMANDINE, ANDESITE, ANDRADITE, ASHES, BASALT, BAUXITE, CALCITE, CHARCOAL, CHROME,
ALMANDINE, ANDESITE, ANDRADITE, ASHES, BASALT, BAUXITE, CALCITE, CHARCOAL, CHROME(CHROME_TAG_NAME_BASE),
CINNABAR, CLAY, COAL, DARK_ASHES, DIAMOND, DIORITE, ELECTRUM, EMERALD, ENDER_EYE, ENDER_PEARL, ENDSTONE,
FLINT, GALENA, GLOWSTONE(Items.GLOWSTONE_DUST), GRANITE, GROSSULAR, INVAR, LAZURITE, MAGNESIUM, MANGANESE, MARBLE,
NETHERRACK, NICKEL, OBSIDIAN, OLIVINE, PERIDOT, PHOSPHOROUS, PLATINUM, PYRITE, PYROPE, QUARTZ, REDSTONE(Items.REDSTONE),
@ -826,7 +873,7 @@ public class TRContent {
private final ItemConvertible dust;
private final Tag.Identified<Item> tag;
SmallDusts(ItemConvertible dustVariant) {
SmallDusts(String tagNameBase, ItemConvertible dustVariant) {
name = this.toString().toLowerCase(Locale.ROOT);
item = new Item(new Item.Settings().group(TechReborn.ITEMGROUP));
if (dustVariant == null)
@ -838,11 +885,19 @@ public class TRContent {
}
dust = dustVariant;
InitUtils.setup(item, name + "_small_dust");
tag = TagFactory.ITEM.create(new Identifier("c", name + "_small_dusts"));
tag = TagFactory.ITEM.create(new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_small_dusts"));
}
SmallDusts(String tagNameBase) {
this(tagNameBase, null);
}
SmallDusts(ItemConvertible dustVariant) {
this(null, dustVariant);
}
SmallDusts() {
this(null);
this(null, null);
}
public ItemStack getStack() {
@ -988,7 +1043,7 @@ public class TRContent {
public static final Tag.Identified<Item> INGOTS_TAG = TagFactory.ITEM.create(new Identifier(TechReborn.MOD_ID, "ingots"));
public enum Ingots implements ItemConvertible, TagConvertible<Item> {
ADVANCED_ALLOY, ALUMINUM, BRASS, BRONZE, CHROME, ELECTRUM, HOT_TUNGSTENSTEEL, INVAR, IRIDIUM_ALLOY, IRIDIUM,
ADVANCED_ALLOY, ALUMINUM, BRASS, BRONZE, CHROME(CHROME_TAG_NAME_BASE), ELECTRUM, HOT_TUNGSTENSTEEL, INVAR, IRIDIUM_ALLOY, IRIDIUM,
LEAD, MIXED_METAL, NICKEL, PLATINUM, REFINED_IRON, SILVER, STEEL, TIN, TITANIUM, TUNGSTEN, TUNGSTENSTEEL, ZINC;
private final String name;
@ -997,7 +1052,7 @@ public class TRContent {
private final StorageBlocks storageBlock;
private final Tag.Identified<Item> tag;
Ingots() {
Ingots(String tagNameBase) {
name = this.toString().toLowerCase(Locale.ROOT);
item = new Item(new Item.Settings().group(TechReborn.ITEMGROUP));
Dusts dustVariant = null;
@ -1023,7 +1078,11 @@ public class TRContent {
}
storageBlock = blockVariant;
InitUtils.setup(item, name + "_ingot");
tag = TagFactory.ITEM.create(new Identifier("c", name + "_ingots"));
tag = TagFactory.ITEM.create(new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_ingots"));
}
Ingots() {
this(null);
}
public ItemStack getStack() {
@ -1080,7 +1139,7 @@ public class TRContent {
public static final Tag.Identified<Item> NUGGETS_TAG = TagFactory.ITEM.create(new Identifier(TechReborn.MOD_ID, "nuggets"));
public enum Nuggets implements ItemConvertible, TagConvertible<Item> {
ALUMINUM, BRASS, BRONZE, CHROME, COPPER(Items.COPPER_INGOT, false), DIAMOND(Items.DIAMOND, true),
ALUMINUM, BRASS, BRONZE, CHROME(CHROME_TAG_NAME_BASE), COPPER(Items.COPPER_INGOT, false), DIAMOND(Items.DIAMOND, true),
ELECTRUM, EMERALD(Items.EMERALD, true), HOT_TUNGSTENSTEEL, INVAR, IRIDIUM, LEAD, NICKEL,
PLATINUM, REFINED_IRON, SILVER, STEEL, TIN, TITANIUM, TUNGSTEN, TUNGSTENSTEEL, ZINC;
@ -1090,7 +1149,7 @@ public class TRContent {
private final boolean ofGem;
private final Tag.Identified<Item> tag;
Nuggets(ItemConvertible ingotVariant, boolean ofGem) {
Nuggets(String tagNameBase, ItemConvertible ingotVariant, boolean ofGem) {
name = this.toString().toLowerCase(Locale.ROOT);
item = new Item(new Item.Settings().group(TechReborn.ITEMGROUP));
if (ingotVariant == null)
@ -1103,7 +1162,15 @@ public class TRContent {
ingot = ingotVariant;
this.ofGem = ofGem;
InitUtils.setup(item, name + "_nugget");
tag = TagFactory.ITEM.create(new Identifier("c", name + "_nuggets"));
tag = TagFactory.ITEM.create(new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_nuggets"));
}
Nuggets(ItemConvertible ingotVariant, boolean ofGem) {
this(null, ingotVariant, ofGem);
}
Nuggets(String tagNameBase) {
this(tagNameBase, null, false);
}
Nuggets() {
@ -1234,7 +1301,7 @@ public class TRContent {
BRASS,
BRONZE,
CARBON(Parts.CARBON_MESH),
CHROME,
CHROME(CHROME_TAG_NAME_BASE),
COAL(Dusts.COAL, Items.COAL_BLOCK),
COPPER(Items.COPPER_INGOT, Items.COPPER_BLOCK),
DIAMOND(Dusts.DIAMOND, Items.DIAMOND_BLOCK),
@ -1277,7 +1344,7 @@ public class TRContent {
private final boolean industrial;
private final Tag.Identified<Item> tag;
Plates(ItemConvertible source, ItemConvertible sourceBlock, boolean industrial) {
Plates(ItemConvertible source, ItemConvertible sourceBlock, boolean industrial, String tagNameBase) {
name = this.toString().toLowerCase(Locale.ROOT);
item = new Item(new Item.Settings().group(TechReborn.ITEMGROUP));
ItemConvertible sourceVariant = null;
@ -1316,7 +1383,11 @@ public class TRContent {
this.source = sourceVariant;
this.industrial = industrial;
InitUtils.setup(item, name + "_plate");
tag = TagFactory.ITEM.create(new Identifier("c", name + "_plates"));
tag = TagFactory.ITEM.create(new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_plates"));
}
Plates(String tagNameBase) {
this(null, null, false);
}
Plates(ItemConvertible source, ItemConvertible sourceBlock) {
@ -1332,7 +1403,7 @@ public class TRContent {
}
Plates() {
this(null);
this(null, null, false);
}
public ItemStack getStack() {