Merge remote-tracking branch 'origin/1.16' into 1.16

# Conflicts:
#	src/main/java/techreborn/init/TRContent.java
This commit is contained in:
modmuss50 2020-07-25 00:23:59 +01:00
commit 18a08b798e
235 changed files with 3995 additions and 3065 deletions

View file

@ -38,7 +38,7 @@ public class FluidGeneratorRecipes {
register(EFluidGenerator.DIESEL, ModFluids.NITROCOAL_FUEL.getFluid(), 48);
register(EFluidGenerator.DIESEL, ModFluids.DIESEL.getFluid(), 128);
register(EFluidGenerator.DIESEL, ModFluids.NITRO_DIESEL.getFluid(), 400);
register(EFluidGenerator.SEMIFLUID, ModFluids.SODIUM.getFluid(), 30);
register(EFluidGenerator.SEMIFLUID, ModFluids.LITHIUM.getFluid(), 60);
register(EFluidGenerator.SEMIFLUID, ModFluids.OIL.getFluid(), 16);
@ -48,7 +48,7 @@ public class FluidGeneratorRecipes {
register(EFluidGenerator.GAS, ModFluids.HYDROGEN.getFluid(), 15);
register(EFluidGenerator.GAS, ModFluids.METHANE.getFluid(), 45);
register(EFluidGenerator.PLASMA, ModFluids.HELIUMPLASMA.getFluid(), 8192);
}

View file

@ -24,7 +24,8 @@
package techreborn.init;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Material;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
@ -94,7 +95,7 @@ public enum ModFluids {
flowingFluid = new RebornFluid(false, fluidSettings, () -> block, () -> bucket, () -> flowingFluid, () -> stillFluid) {
};
block = new RebornFluidBlock(stillFluid, FabricBlockSettings.of(Material.WATER).noCollision().hardness(100.0F).dropsNothing().build());
block = new RebornFluidBlock(stillFluid, FabricBlockSettings.of(Material.WATER).noCollision().hardness(100.0F).dropsNothing());
bucket = new RebornBucketItem(stillFluid, new Item.Settings().group(TechReborn.ITEMGROUP).recipeRemainder(Items.BUCKET).maxCount(1));
}

View file

@ -69,14 +69,13 @@ public class ModLoot {
LootPoolEntry industrialFrame = makeEntry(TRContent.MachineBlocks.INDUSTRIAL.frame.asItem());
LootPoolEntry industrialCircuit = makeEntry(Parts.INDUSTRIAL_CIRCUIT);
LootPoolEntry energyFlowChip = makeEntry(Parts.ENERGY_FLOW_CHIP);
LootPool poolBasic = FabricLootPoolBuilder.builder().withEntry(copperIngot).withEntry(tinIngot)
.withEntry(leadIngot).withEntry(silverIngot).withEntry(refinedronIngot).withEntry(advancedalloyIngot)
.withEntry(basicFrame).withEntry(basicCircuit).withEntry(rubberSapling).rolls(UniformLootTableRange.between(1.0f, 2.0f))
.build();
LootPool poolAdvanced = FabricLootPoolBuilder.builder().withEntry(aluminumIngot).withEntry(electrumIngot)
.withEntry(invarIngot).withEntry(nickelIngot).withEntry(steelIngot).withEntry(zincIngot)
.withEntry(advancedFrame).withEntry(advancedCircuit).withEntry(dataStorageChip).rolls(UniformLootTableRange.between(1.0f, 3.0f))
@ -86,7 +85,7 @@ public class ModLoot {
.withEntry(platinumIngot).withEntry(titaniumIngot).withEntry(tungstenIngot).withEntry(tungstensteelIngot)
.withEntry(industrialFrame).withEntry(industrialCircuit).withEntry(energyFlowChip).rolls(UniformLootTableRange.between(1.0f, 3.0f))
.build();
LootTableLoadingCallback.EVENT.register((resourceManager, lootManager, ident, supplier, setter) -> {
String stringId = ident.toString();
if (!stringId.startsWith("minecraft:chests")) {
@ -95,24 +94,24 @@ public class ModLoot {
if (TechRebornConfig.enableOverworldLoot) {
switch (stringId) {
case "minecraft:chests/abandoned_mineshaft":
case "minecraft:chests/desert_pyramid":
case "minecraft:chests/igloo_chest":
case "minecraft:chests/jungle_temple":
case "minecraft:chests/simple_dungeon":
case "minecraft:chests/village/village_weaponsmith":
case "minecraft:chests/village/village_armorer":
case "minecraft:chests/village/village_toolsmith":
supplier.withPool(poolBasic);
break;
case "minecraft:chests/stronghold_corridor":
case "minecraft:chests/stronghold_crossing":
case "minecraft:chests/stronghold_library":
supplier.withPool(poolAdvanced);
break;
case "minecraft:chests/woodland_mansion":
supplier.withPool(poolIndustrial);
break;
case "minecraft:chests/abandoned_mineshaft":
case "minecraft:chests/desert_pyramid":
case "minecraft:chests/igloo_chest":
case "minecraft:chests/jungle_temple":
case "minecraft:chests/simple_dungeon":
case "minecraft:chests/village/village_weaponsmith":
case "minecraft:chests/village/village_armorer":
case "minecraft:chests/village/village_toolsmith":
supplier.withPool(poolBasic);
break;
case "minecraft:chests/stronghold_corridor":
case "minecraft:chests/stronghold_crossing":
case "minecraft:chests/stronghold_library":
supplier.withPool(poolAdvanced);
break;
case "minecraft:chests/woodland_mansion":
supplier.withPool(poolIndustrial);
break;
}
}
@ -133,7 +132,7 @@ public class ModLoot {
/**
* Makes loot entry from item provided
*
*
* @param item Item to include into LootEntry
* @return LootEntry for item provided
*/
@ -144,11 +143,11 @@ public class ModLoot {
/**
* Makes loot entry from item provided with weight provided
*
* @param item Item to include into LootEntry
* @param item Item to include into LootEntry
* @param weight Weight of that item
* @return LootEntry for item and weight provided
*/
private static LootPoolEntry makeEntry(ItemConvertible item, int weight){
private static LootPoolEntry makeEntry(ItemConvertible item, int weight) {
return ItemEntry.builder(item).weight(weight)
.apply(SetCountLootFunction.builder(UniformLootTableRange.between(1.0f, 2.0f))).build();
}

View file

@ -55,7 +55,7 @@ public class ModRecipes {
public static final RebornRecipeType<RebornRecipe> SOLID_CANNING_MACHINE = RecipeManager.newRecipeType(RebornRecipe::new, new Identifier("techreborn:solid_canning_machine"));
public static final RebornRecipeType<RebornRecipe> WIRE_MILL = RecipeManager.newRecipeType(RebornRecipe::new, new Identifier("techreborn:wire_mill"));
public static RebornRecipeType<?> byName(Identifier identifier){
public static RebornRecipeType<?> byName(Identifier identifier) {
return (RebornRecipeType<?>) Registry.RECIPE_SERIALIZER.get(identifier);
}
}

View file

@ -50,10 +50,10 @@ public class ModSounds {
@Override
public void playSound(boolean firstRun, BlockEntity blockEntity) {
World world = blockEntity.getWorld();
if (world == null){
return;
}
World world = blockEntity.getWorld();
if (world == null) {
return;
}
world.playSound(null, blockEntity.getPos().getX(), blockEntity.getPos().getY(),
blockEntity.getPos().getZ(), ModSounds.MACHINE_RUN, SoundCategory.BLOCKS, TechRebornConfig.machineSoundVolume, 1F);
}

View file

@ -37,20 +37,20 @@ import java.util.function.Supplier;
public enum TRArmorMaterials implements ArmorMaterial {
BRONZE(17, new int[] { 3, 6, 5, 2 }, 8, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0.0F, () -> {
BRONZE(17, new int[]{3, 6, 5, 2}, 8, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0.0F, () -> {
return Ingredient.ofItems(TRContent.Ingots.BRONZE.asItem());
}),
RUBY(16, new int[] { 2, 7, 5, 2 }, 10, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F, () -> {
}),
RUBY(16, new int[]{2, 7, 5, 2}, 10, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F, () -> {
return Ingredient.ofItems(TRContent.Gems.RUBY.asItem());
}),
SAPPHIRE(19, new int[] { 4, 4, 4, 4 }, 8, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F, () -> {
return Ingredient.ofItems(TRContent.Gems.SAPPHIRE.asItem());
}),
PERIDOT(17, new int[] { 3, 8, 3, 2 }, 16, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F, () -> {
SAPPHIRE(19, new int[]{4, 4, 4, 4}, 8, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F, () -> {
return Ingredient.ofItems(TRContent.Gems.SAPPHIRE.asItem());
}),
PERIDOT(17, new int[]{3, 8, 3, 2}, 16, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F, () -> {
return Ingredient.ofItems(TRContent.Gems.PERIDOT.asItem());
}),
QUANTUM(75, new int[] { 3, 6, 8, 3 }, 10, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F, () -> Ingredient.EMPTY),
CLOAKING_DEVICE(5, new int[] { 0, 2, 0, 0 }, 0, SoundEvents.ITEM_ARMOR_EQUIP_GOLD, 0.0F, () -> Ingredient.EMPTY),
QUANTUM(75, new int[]{3, 6, 8, 3}, 10, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F, () -> Ingredient.EMPTY),
CLOAKING_DEVICE(5, new int[]{0, 2, 0, 0}, 0, SoundEvents.ITEM_ARMOR_EQUIP_GOLD, 0.0F, () -> Ingredient.EMPTY),
LITHIUM_BATPACK(25, new int[]{0, 5, 0, 0}, 10, SoundEvents.ITEM_ARMOR_EQUIP_TURTLE, 0.0F, () -> Ingredient.EMPTY),
LAPOTRONIC_ORBPACK(33, new int[]{0, 6, 0, 0}, 10, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 2.0F, () -> Ingredient.EMPTY);

View file

@ -72,8 +72,8 @@ import java.util.List;
import java.util.function.Supplier;
public class TRBlockEntities {
private static List<BlockEntityType<?>> TYPES = new ArrayList<>();
private static final List<BlockEntityType<?>> TYPES = new ArrayList<>();
public static final BlockEntityType<StorageUnitBaseBlockEntity> STORAGE_UNIT = register(StorageUnitBaseBlockEntity::new, "storage_unit", TRContent.StorageUnit.values());
@ -111,6 +111,7 @@ public class TRBlockEntities {
public static final BlockEntityType<IndustrialSawmillBlockEntity> INDUSTRIAL_SAWMILL = register(IndustrialSawmillBlockEntity::new, "industrial_sawmill", TRContent.Machine.INDUSTRIAL_SAWMILL);
public static final BlockEntityType<SolidFuelGeneratorBlockEntity> SOLID_FUEL_GENEREATOR = register(SolidFuelGeneratorBlockEntity::new, "solid_fuel_generator", TRContent.Machine.SOLID_FUEL_GENERATOR);
public static final BlockEntityType<ExtractorBlockEntity> EXTRACTOR = register(ExtractorBlockEntity::new, "extractor", TRContent.Machine.EXTRACTOR);
public static final BlockEntityType<ResinBasinBlockEntity> RESIN_BASIN = register(ResinBasinBlockEntity::new, "resin_basin", TRContent.Machine.RESIN_BASIN);
public static final BlockEntityType<CompressorBlockEntity> COMPRESSOR = register(CompressorBlockEntity::new, "compressor", TRContent.Machine.COMPRESSOR);
public static final BlockEntityType<ElectricFurnaceBlockEntity> ELECTRIC_FURNACE = register(ElectricFurnaceBlockEntity::new, "electric_furnace", TRContent.Machine.ELECTRIC_FURNACE);
public static final BlockEntityType<SolarPanelBlockEntity> SOLAR_PANEL = register(SolarPanelBlockEntity::new, "solar_panel", TRContent.SolarPanels.values());

View file

@ -26,12 +26,7 @@ package techreborn.init;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
import net.minecraft.block.Block;
import net.minecraft.block.Material;
import net.minecraft.block.OreBlock;
import net.minecraft.block.SlabBlock;
import net.minecraft.block.StairsBlock;
import net.minecraft.block.WallBlock;
import net.minecraft.block.*;
import net.minecraft.entity.EntityType;
import net.minecraft.item.Item;
import net.minecraft.item.ItemConvertible;
@ -68,11 +63,8 @@ import techreborn.blocks.lighting.BlockLamp;
import techreborn.blocks.machine.tier0.IronAlloyFurnaceBlock;
import techreborn.blocks.machine.tier0.IronFurnaceBlock;
import techreborn.blocks.machine.tier1.BlockPlayerDetector;
import techreborn.blocks.misc.BlockAlarm;
import techreborn.blocks.misc.BlockMachineCasing;
import techreborn.blocks.misc.BlockMachineFrame;
import techreborn.blocks.misc.BlockStorage;
import techreborn.blocks.misc.TechRebornStairsBlock;
import techreborn.blocks.machine.tier1.ResinBasinBlock;
import techreborn.blocks.misc.*;
import techreborn.blocks.storage.energy.*;
import techreborn.blocks.storage.fluid.TankUnitBlock;
import techreborn.blocks.storage.item.StorageUnitBlock;
@ -89,11 +81,7 @@ import techreborn.items.armor.QuantumSuitItem;
import techreborn.utils.InitUtils;
import javax.annotation.Nullable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Stream;
@ -456,31 +444,13 @@ public class TRContent {
block = new BlockStorage();
InitUtils.setup(block, name + "_storage_block");
stairsBlock = new TechRebornStairsBlock(block.getDefaultState(), FabricBlockSettings.copyOf(block)){
@Override
public String getTranslationKey() {
return block.getTranslationKey();
}
};
stairsBlock = new TechRebornStairsBlock(block.getDefaultState(), FabricBlockSettings.copyOf(block));
InitUtils.setup(stairsBlock, name + "_storage_block_stairs");
slabBlock = new SlabBlock(FabricBlockSettings.copyOf(block)){
@Override
public String getTranslationKey() {
return block.getTranslationKey();
}
};
slabBlock = new SlabBlock(FabricBlockSettings.copyOf(block));
InitUtils.setup(slabBlock, name + "_storage_block_slab");
wallBlock = new WallBlock(FabricBlockSettings.copyOf(block)){
@Override
public String getTranslationKey() {
return block.getTranslationKey();
}
};
wallBlock = new WallBlock(FabricBlockSettings.copyOf(block));
InitUtils.setup(wallBlock, name + "_storage_block_wall");
}
@ -541,6 +511,7 @@ public class TRContent {
COMPRESSOR(new GenericMachineBlock(GuiType.COMPRESSOR, CompressorBlockEntity::new)),
DISTILLATION_TOWER(new GenericMachineBlock(GuiType.DISTILLATION_TOWER, DistillationTowerBlockEntity::new)),
EXTRACTOR(new GenericMachineBlock(GuiType.EXTRACTOR, ExtractorBlockEntity::new)),
RESIN_BASIN(new ResinBasinBlock(ResinBasinBlockEntity::new)),
FLUID_REPLICATOR(new GenericMachineBlock(GuiType.FLUID_REPLICATOR, FluidReplicatorBlockEntity::new)),
GRINDER(new DataDrivenMachineBlock("techreborn:grinder")),
ELECTRIC_FURNACE(new GenericMachineBlock(GuiType.ELECTRIC_FURNACE, ElectricFurnaceBlockEntity::new)),

View file

@ -51,10 +51,10 @@ import java.util.Random;
*/
public class TRDispenserBehavior {
public static void init(){
public static void init() {
if (TechRebornConfig.dispenseScrapboxes) {
DispenserBlock.registerBehavior(TRContent.SCRAP_BOX, new ItemDispenserBehavior() {
public ItemStack dispenseSilently(BlockPointer pointer, ItemStack stack){
public ItemStack dispenseSilently(BlockPointer pointer, ItemStack stack) {
List<RebornRecipe> scrapboxRecipeList = ModRecipes.SCRAPBOX.getRecipes(pointer.getWorld());
int random = new Random().nextInt(scrapboxRecipeList.size());
ItemStack out = scrapboxRecipeList.get(random).getOutputs().get(0);
@ -65,20 +65,20 @@ public class TRDispenserBehavior {
spawnItem(pointer.getWorld(), out, 6, facing, position);
return stack;
}
} );
});
}
DispenserBlock.registerBehavior(TRContent.CELL, new ItemDispenserBehavior(){
DispenserBlock.registerBehavior(TRContent.CELL, new ItemDispenserBehavior() {
public ItemStack dispenseSilently(BlockPointer pointer, ItemStack stack) {
DynamicCellItem cell = (DynamicCellItem)stack.getItem();
DynamicCellItem cell = (DynamicCellItem) stack.getItem();
WorldAccess iWorld = pointer.getWorld();
BlockPos blockPos = pointer.getBlockPos().offset(pointer.getBlockState().get(DispenserBlock.FACING));
BlockState blockState = iWorld.getBlockState(blockPos);
Block block = blockState.getBlock();
if (cell.getFluid(stack) == Fluids.EMPTY){
if (cell.getFluid(stack) == Fluids.EMPTY) {
// fill cell
if (block instanceof FluidDrainable) {
Fluid fluid = ((FluidDrainable)block).tryDrainFluid(iWorld, blockPos, blockState);
Fluid fluid = ((FluidDrainable) block).tryDrainFluid(iWorld, blockPos, blockState);
if (!(fluid instanceof FlowableFluid)) {
return super.dispenseSilently(pointer, stack);
} else {
@ -87,7 +87,7 @@ public class TRDispenserBehavior {
stack = filledCell;
} else {
stack.decrement(1);
if (((DispenserBlockEntity)pointer.getBlockEntity()).addToFirstFreeSlot(filledCell) < 0) {
if (((DispenserBlockEntity) pointer.getBlockEntity()).addToFirstFreeSlot(filledCell) < 0) {
this.dispense(pointer, filledCell);
}
}
@ -96,16 +96,15 @@ public class TRDispenserBehavior {
} else {
return super.dispenseSilently(pointer, stack);
}
}
else {
} else {
// drain cell
if (cell.placeFluid(null, pointer.getWorld(), blockPos, null, stack)) {
ItemStack emptyCell = cell.getEmpty();
if(stack.getCount() == 1) {
if (stack.getCount() == 1) {
stack = emptyCell;
} else {
stack.decrement(1);
if (((DispenserBlockEntity)pointer.getBlockEntity()).addToFirstFreeSlot(emptyCell) < 0) {
if (((DispenserBlockEntity) pointer.getBlockEntity()).addToFirstFreeSlot(emptyCell) < 0) {
this.dispense(pointer, emptyCell);
}
}

View file

@ -57,14 +57,18 @@ public enum TRToolTier implements ToolMaterial {
* against.
*/
private final float efficiency;
/** Damage versus entities. */
/**
* Damage versus entities.
*/
private final float attackDamage;
/** Defines the natural enchantability factor of the material. */
/**
* Defines the natural enchantability factor of the material.
*/
private final int enchantability;
private final Lazy<Ingredient> repairMaterial;
TRToolTier(int harvestLevelIn, int maxUsesIn, float efficiencyIn, float attackDamageIn,
int enchantabilityIn, Supplier<Ingredient> repairMaterialIn) {
int enchantabilityIn, Supplier<Ingredient> repairMaterialIn) {
this.harvestLevel = harvestLevelIn;
this.maxUses = maxUsesIn;
this.efficiency = efficiencyIn;

View file

@ -7,7 +7,6 @@ import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.text.LiteralText;
import net.minecraft.util.registry.Registry;
import techreborn.init.TRContent;
import java.io.IOException;
@ -25,16 +24,16 @@ public class TechRebornTemplates {
public static void init() {
CommandRegistrationCallback.EVENT.register((dispatcher, b) -> dispatcher.register(
literal("techreborn")
.then(literal("template")
.requires(source -> source.hasPermissionLevel(3))
.requires(source -> FabricLoader.getInstance().isDevelopmentEnvironment())
.then(literal("generate")
.then(
argument("path", greedyString())
.executes(TechRebornTemplates::process)
)
)
)
.then(literal("template")
.requires(source -> source.hasPermissionLevel(3))
.requires(source -> FabricLoader.getInstance().isDevelopmentEnvironment())
.then(literal("generate")
.then(
argument("path", greedyString())
.executes(TechRebornTemplates::process)
)
)
)
));
}

View file

@ -1,10 +1,6 @@
package techreborn.init.template;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.*;
import net.minecraft.block.Block;
import net.minecraft.util.registry.Registry;