1.19.3 port (#3074)
* Start on 1.19.3 port * Client runs, kinda * Fix crash when opening item group * Fix dynamic models * Add atlas config for slot sprites * Ore :) * Rubber tree's, lakes and ore cleanup * Add blocks to item group * Fix rubber tree sapling * added vanilla creative and missing peridot pickaxe (#3076) * added vanilla creative and missing peridot pickaxe * some small tweaks Co-authored-by: ayutac <fly.high.android@gmail.com> * added bamboo saw mill datagen recipes (#3077) * added bamboo saw mill datagen recipes * fixed datagen error Co-authored-by: ayutac <fly.high.android@gmail.com> * 1.19.3-rc1 * 1.19.3 port villager housing (#3082) * added NBTs for the houses * added the houses, theoretically * added the houses, practically * made house gen configurable Co-authored-by: ayutac <fly.high.android@gmail.com> * Fixes #3083 * reordered TR creative tab and small tweaks to the rest (#3081) * reordered TR creative tab and small tweaks to the rest * small bugfix Co-authored-by: ayutac <fly.high.android@gmail.com> * 1.19.3 * Bump version Co-authored-by: Ayutac <skoch02@students.uni-mainz.de> Co-authored-by: ayutac <fly.high.android@gmail.com>
This commit is contained in:
parent
7b7fba96c5
commit
573ba92920
162 changed files with 2049 additions and 1265 deletions
|
@ -30,10 +30,11 @@ import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
|
|||
import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry;
|
||||
import net.fabricmc.fabric.api.renderer.v1.RendererAccess;
|
||||
import net.minecraft.client.item.ClampedModelPredicateProvider;
|
||||
import net.minecraft.client.item.ModelPredicateProviderRegistry;
|
||||
import net.minecraft.client.item.UnclampedModelPredicateProvider;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.render.model.Baker;
|
||||
import net.minecraft.client.render.model.ModelBakeSettings;
|
||||
import net.minecraft.client.render.model.ModelLoader;
|
||||
import net.minecraft.client.render.model.UnbakedModel;
|
||||
|
@ -47,8 +48,9 @@ import net.minecraft.fluid.Fluid;
|
|||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registry;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import reborncore.client.ClientJumpEvent;
|
||||
import reborncore.client.gui.builder.GuiBase;
|
||||
|
@ -60,6 +62,7 @@ import techreborn.client.ClientGuiType;
|
|||
import techreborn.client.ClientboundPacketHandlers;
|
||||
import techreborn.client.events.ClientJumpHandler;
|
||||
import techreborn.client.events.StackToolTipHandler;
|
||||
import techreborn.client.render.BaseDynamicFluidBakedModel;
|
||||
import techreborn.client.render.DynamicBucketBakedModel;
|
||||
import techreborn.client.render.DynamicCellBakedModel;
|
||||
import techreborn.client.render.entitys.CableCoverRenderer;
|
||||
|
@ -80,6 +83,7 @@ import java.util.Collection;
|
|||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class TechRebornClient implements ClientModInitializer {
|
||||
|
||||
|
@ -103,47 +107,15 @@ public class TechRebornClient implements ClientModInitializer {
|
|||
return JsonUnbakedModel.deserialize("{\"parent\":\"minecraft:item/generated\",\"textures\":{\"layer0\":\"techreborn:item/cell_background\"}}");
|
||||
}
|
||||
|
||||
return new UnbakedModel() {
|
||||
@Override
|
||||
public Collection<Identifier> getModelDependencies() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<SpriteIdentifier> getTextureDependencies(Function<Identifier, UnbakedModel> unbakedModelGetter, Set<Pair<String, String>> unresolvedTextureReferences) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BakedModel bake(ModelLoader loader, Function<SpriteIdentifier, Sprite> textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) {
|
||||
return new DynamicCellBakedModel();
|
||||
}
|
||||
|
||||
};
|
||||
return new UnbakedDynamicModel(DynamicCellBakedModel::new);
|
||||
}
|
||||
Fluid fluid = Registry.FLUID.get(new Identifier(TechReborn.MOD_ID, modelIdentifier.getPath().split("_bucket")[0]));
|
||||
Fluid fluid = Registries.FLUID.get(new Identifier(TechReborn.MOD_ID, modelIdentifier.getPath().split("_bucket")[0]));
|
||||
if (modelIdentifier.getPath().endsWith("_bucket") && fluid != Fluids.EMPTY) {
|
||||
if (!RendererAccess.INSTANCE.hasRenderer()) {
|
||||
return JsonUnbakedModel.deserialize("{\"parent\":\"minecraft:item/generated\",\"textures\":{\"layer0\":\"minecraft:item/bucket\"}}");
|
||||
}
|
||||
|
||||
return new UnbakedModel() {
|
||||
@Override
|
||||
public Collection<Identifier> getModelDependencies() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<SpriteIdentifier> getTextureDependencies(Function<Identifier, UnbakedModel> unbakedModelGetter, Set<Pair<String, String>> unresolvedTextureReferences) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BakedModel bake(ModelLoader loader, Function<SpriteIdentifier, Sprite> textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) {
|
||||
return new DynamicBucketBakedModel();
|
||||
}
|
||||
|
||||
};
|
||||
return new UnbakedDynamicModel(DynamicBucketBakedModel::new);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -252,13 +224,13 @@ public class TechRebornClient implements ClientModInitializer {
|
|||
}
|
||||
|
||||
private static <T extends Item> void registerPredicateProvider(Class<T> itemClass, Identifier identifier, ItemModelPredicateProvider<T> modelPredicateProvider) {
|
||||
Registry.ITEM.stream()
|
||||
Registries.ITEM.stream()
|
||||
.filter(item -> item.getClass().isAssignableFrom(itemClass))
|
||||
.forEach(item -> ModelPredicateProviderRegistry.register(item, identifier, modelPredicateProvider));
|
||||
}
|
||||
|
||||
//Need the item instance in a few places, this makes it easier
|
||||
private interface ItemModelPredicateProvider<T extends Item> extends UnclampedModelPredicateProvider {
|
||||
private interface ItemModelPredicateProvider<T extends Item> extends ClampedModelPredicateProvider {
|
||||
|
||||
float call(T item, ItemStack stack, @Nullable ClientWorld world, @Nullable LivingEntity entity, int seed);
|
||||
|
||||
|
@ -268,4 +240,28 @@ public class TechRebornClient implements ClientModInitializer {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
private static class UnbakedDynamicModel implements UnbakedModel {
|
||||
private final Supplier<BaseDynamicFluidBakedModel> supplier;
|
||||
|
||||
public UnbakedDynamicModel(Supplier<BaseDynamicFluidBakedModel> supplier) {
|
||||
this.supplier = supplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Identifier> getModelDependencies() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParents(Function<Identifier, UnbakedModel> modelLoader) {
|
||||
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BakedModel bake(Baker baker, Function<SpriteIdentifier, Sprite> textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) {
|
||||
return supplier.get();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -373,7 +373,7 @@ public class ReiPlugin implements REIClientPlugin {
|
|||
final Sprite sprite = handler.getFluidSprites(MinecraftClient.getInstance().world, BlockPos.ORIGIN, fluid.getDefaultState())[0];
|
||||
int color = FluidRenderHandlerRegistry.INSTANCE.get(fluid).getFluidColor(MinecraftClient.getInstance().world, BlockPos.ORIGIN, fluid.getDefaultState());
|
||||
|
||||
final int iconHeight = sprite.getHeight();
|
||||
final int iconHeight = sprite.getContents().getHeight();
|
||||
int offsetHeight = drawHeight;
|
||||
|
||||
RenderSystem.setShaderColor((color >> 16 & 255) / 255.0F, (float) (color >> 8 & 255) / 255.0F, (float) (color & 255) / 255.0F, 1F);
|
||||
|
|
|
@ -40,10 +40,11 @@ import net.minecraft.fluid.Fluid;
|
|||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registry;
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.common.BaseBlockEntityProvider;
|
||||
import techreborn.blocks.cable.CableBlock;
|
||||
|
@ -135,7 +136,7 @@ public class StackToolTipHandler implements ItemTooltipCallback {
|
|||
}
|
||||
|
||||
private static boolean isTRItem(Item item) {
|
||||
return Registry.ITEM.getId(item).getNamespace().equals("techreborn");
|
||||
return Registries.ITEM.getId(item).getNamespace().equals("techreborn");
|
||||
}
|
||||
|
||||
private static Text getOreDepthText(OreDepth depth) {
|
||||
|
|
|
@ -53,7 +53,10 @@ public class GuiChunkLoader extends GuiBase<BuiltScreenHandler> {
|
|||
addDrawableChild(new GuiButtonUpDown(x + 64 + 24, y + 40, this, b -> onClick(-1), UpDownButtonType.REWIND));
|
||||
addDrawableChild(new GuiButtonUpDown(x + 64 + 36, y + 40, this, b -> onClick(-5), UpDownButtonType.FASTREWIND));
|
||||
|
||||
addDrawableChild(new ButtonWidget(x + 10, y + 70, 155, 20, Text.literal("Toggle Loaded Chunks"), b -> ClientChunkManager.toggleLoadedChunks(blockEntity.getPos())));
|
||||
addDrawableChild(ButtonWidget.builder(Text.literal("Toggle Loaded Chunks"), b -> ClientChunkManager.toggleLoadedChunks(blockEntity.getPos()))
|
||||
.position(x + 10, y + 70)
|
||||
.size(155, 20)
|
||||
.build());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
|
||||
package techreborn.client.gui;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.gui.widget.TexturedButtonWidget;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
@ -37,7 +35,6 @@ import reborncore.client.gui.guibuilder.GuiBuilder;
|
|||
import reborncore.common.screen.BuiltScreenHandler;
|
||||
import techreborn.blockentity.machine.iron.IronFurnaceBlockEntity;
|
||||
import techreborn.packets.ServerboundPackets;
|
||||
import techreborn.utils.PlayerUtils;
|
||||
|
||||
public class GuiIronFurnace extends GuiBase<BuiltScreenHandler> {
|
||||
|
||||
|
@ -57,34 +54,35 @@ public class GuiIronFurnace extends GuiBase<BuiltScreenHandler> {
|
|||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
ButtonWidget.TooltipSupplier tooltipSupplier = (button, matrices, mouseX, mouseY) -> {
|
||||
PlayerEntity player = MinecraftClient.getInstance().player;
|
||||
if (player == null) { return; }
|
||||
String message = "Experience: ";
|
||||
|
||||
float furnaceExp = blockEntity.experience;
|
||||
if (furnaceExp <= 0) {
|
||||
message = message + "0";
|
||||
} else {
|
||||
float expTillLevel = (1.0F - player.experienceProgress) * player.getNextLevelExperience();
|
||||
if (furnaceExp <= expTillLevel) {
|
||||
int percentage = (int) (blockEntity.experience * 100 / player.getNextLevelExperience());
|
||||
message = message + "+"
|
||||
+ (percentage > 0 ? String.valueOf(percentage) : "<1")
|
||||
+ "%";
|
||||
} else {
|
||||
int levels = 0;
|
||||
furnaceExp -= expTillLevel;
|
||||
while (furnaceExp > 0) {
|
||||
furnaceExp -= PlayerUtils.getLevelExperience(player.experienceLevel);
|
||||
++levels;
|
||||
}
|
||||
message = message + "+" + levels + "L";
|
||||
}
|
||||
}
|
||||
|
||||
renderTooltip(matrices, Text.literal(message), mouseX, mouseY);
|
||||
};
|
||||
// TODO 1.19.3
|
||||
// ButtonWidget.TooltipSupplier tooltipSupplier = (button, matrices, mouseX, mouseY) -> {
|
||||
// PlayerEntity player = MinecraftClient.getInstance().player;
|
||||
// if (player == null) { return; }
|
||||
// String message = "Experience: ";
|
||||
//
|
||||
// float furnaceExp = blockEntity.experience;
|
||||
// if (furnaceExp <= 0) {
|
||||
// message = message + "0";
|
||||
// } else {
|
||||
// float expTillLevel = (1.0F - player.experienceProgress) * player.getNextLevelExperience();
|
||||
// if (furnaceExp <= expTillLevel) {
|
||||
// int percentage = (int) (blockEntity.experience * 100 / player.getNextLevelExperience());
|
||||
// message = message + "+"
|
||||
// + (percentage > 0 ? String.valueOf(percentage) : "<1")
|
||||
// + "%";
|
||||
// } else {
|
||||
// int levels = 0;
|
||||
// furnaceExp -= expTillLevel;
|
||||
// while (furnaceExp > 0) {
|
||||
// furnaceExp -= PlayerUtils.getLevelExperience(player.experienceLevel);
|
||||
// ++levels;
|
||||
// }
|
||||
// message = message + "+" + levels + "L";
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// renderTooltip(matrices, Text.literal(message), mouseX, mouseY);
|
||||
// };
|
||||
|
||||
addDrawableChild(new TexturedButtonWidget(
|
||||
getGuiLeft() + 116,
|
||||
|
@ -98,7 +96,6 @@ public class GuiIronFurnace extends GuiBase<BuiltScreenHandler> {
|
|||
16,
|
||||
16,
|
||||
b -> onClick(),
|
||||
tooltipSupplier,
|
||||
Text.empty()));
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
import net.minecraft.screen.PlayerScreenHandler;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.util.math.RotationAxis;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import techreborn.entities.EntityNukePrimed;
|
||||
import techreborn.init.TRContent;
|
||||
|
@ -69,7 +69,7 @@ public class NukeRenderer extends EntityRenderer<EntityNukePrimed> {
|
|||
matrixStack.scale(j, j, j);
|
||||
}
|
||||
|
||||
matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-90.0F));
|
||||
matrixStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(-90.0F));
|
||||
matrixStack.translate(-0.5D, -0.5D, 0.5D);
|
||||
TntMinecartEntityRenderer.renderFlashingBlock(blockRenderManager, TRContent.NUKE.getDefaultState(), matrixStack, vertexConsumerProvider, i, entity.getFuse() / 5 % 2 == 0);
|
||||
matrixStack.pop();
|
||||
|
|
|
@ -35,7 +35,7 @@ import net.minecraft.client.render.model.json.ModelTransformation;
|
|||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.util.math.RotationAxis;
|
||||
import techreborn.blockentity.storage.item.StorageUnitBaseBlockEntity;
|
||||
|
||||
/**
|
||||
|
@ -59,7 +59,7 @@ public class StorageUnitRenderer implements BlockEntityRenderer<StorageUnitBaseB
|
|||
// Item rendering
|
||||
matrices.push();
|
||||
Direction direction = storage.getFacing();
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion((direction.getHorizontal() - 2) * 90F));
|
||||
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees((direction.getHorizontal() - 2) * 90F));
|
||||
matrices.scale(0.5F, 0.5F, 0.5F);
|
||||
switch (direction) {
|
||||
case NORTH, WEST -> matrices.translate(1, 1, 0);
|
||||
|
@ -78,7 +78,7 @@ public class StorageUnitRenderer implements BlockEntityRenderer<StorageUnitBaseB
|
|||
// Render item only on horizontal facing #2183
|
||||
if (Direction.Type.HORIZONTAL.test(facing) ){
|
||||
matrices.translate(0.5, 0.5, 0.5); // Translate center
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-facing.rotateYCounterclockwise().asRotation() + 90)); // Rotate depending on face
|
||||
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(-facing.rotateYCounterclockwise().asRotation() + 90)); // Rotate depending on face
|
||||
matrices.translate(0, 0, -0.505); // Translate forward
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ import net.minecraft.client.render.block.entity.BlockEntityRendererFactory;
|
|||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.util.math.RotationAxis;
|
||||
import techreborn.blockentity.generator.basic.WindMillBlockEntity;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
@ -58,7 +58,7 @@ public class TurbineRenderer implements BlockEntityRenderer<WindMillBlockEntity>
|
|||
|
||||
matrixStack.push();
|
||||
matrixStack.translate(0.5, 0, 0.5);
|
||||
matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-facing.rotateYCounterclockwise().asRotation() + 90));
|
||||
matrixStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(-facing.rotateYCounterclockwise().asRotation() + 90));
|
||||
matrixStack.translate(0, -1, -0.56);
|
||||
|
||||
float spin = blockEntity.bladeAngle + tickDelta * blockEntity.spinSpeed;
|
||||
|
|
|
@ -45,7 +45,7 @@ public class DestructoPackScreenHandler extends ScreenHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferSlot(PlayerEntity player, int index) {
|
||||
public ItemStack quickMove(PlayerEntity player, int index) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,8 @@ package techreborn.datagen
|
|||
|
||||
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
||||
import net.minecraft.registry.RegistryBuilder
|
||||
import net.minecraft.registry.RegistryKeys
|
||||
import techreborn.TechReborn
|
||||
import techreborn.datagen.models.BlockLootTableProvider
|
||||
import techreborn.datagen.models.ModelProvider
|
||||
|
@ -42,35 +44,50 @@ import techreborn.datagen.recipes.smelting.SmeltingRecipesProvider
|
|||
import techreborn.datagen.tags.TRBlockTagProvider
|
||||
import techreborn.datagen.tags.TRItemTagProvider
|
||||
import techreborn.datagen.tags.TRPointOfInterestTagProvider
|
||||
import techreborn.datagen.tags.WaterExplosionTagProvider
|
||||
import techreborn.datagen.worldgen.TRWorldGenBootstrap
|
||||
import techreborn.datagen.worldgen.TRWorldGenProvider
|
||||
|
||||
class TechRebornDataGen implements DataGeneratorEntrypoint {
|
||||
|
||||
@Override
|
||||
void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
|
||||
fabricDataGenerator.addProvider(WaterExplosionTagProvider.&new)
|
||||
fabricDataGenerator.addProvider(TRItemTagProvider.&new)
|
||||
fabricDataGenerator.addProvider(TRPointOfInterestTagProvider.&new)
|
||||
fabricDataGenerator.addProvider(TRBlockTagProvider.&new)
|
||||
def pack = fabricDataGenerator.createPack()
|
||||
|
||||
def add = { FabricDataGenerator.Pack.RegistryDependentFactory factory ->
|
||||
pack.addProvider factory
|
||||
}
|
||||
|
||||
add TRItemTagProvider::new
|
||||
add TRPointOfInterestTagProvider::new
|
||||
|
||||
add TRBlockTagProvider::new
|
||||
// tags before all else, very important!!
|
||||
fabricDataGenerator.addProvider(SmeltingRecipesProvider.&new)
|
||||
fabricDataGenerator.addProvider(CraftingRecipesProvider.&new)
|
||||
add SmeltingRecipesProvider::new
|
||||
add CraftingRecipesProvider::new
|
||||
|
||||
fabricDataGenerator.addProvider(GrinderRecipesProvider.&new)
|
||||
fabricDataGenerator.addProvider(CompressorRecipesProvider.&new)
|
||||
fabricDataGenerator.addProvider(ExtractorRecipesProvider.&new)
|
||||
fabricDataGenerator.addProvider(ChemicalReactorRecipesProvider.&new)
|
||||
fabricDataGenerator.addProvider(AssemblingMachineRecipesProvider.&new)
|
||||
fabricDataGenerator.addProvider(BlastFurnaceRecipesProvider.&new)
|
||||
fabricDataGenerator.addProvider(IndustrialGrinderRecipesProvider.&new)
|
||||
fabricDataGenerator.addProvider(IndustrialSawmillRecipesProvider.&new)
|
||||
add GrinderRecipesProvider::new
|
||||
add CompressorRecipesProvider::new
|
||||
add ExtractorRecipesProvider::new
|
||||
add ChemicalReactorRecipesProvider::new
|
||||
add AssemblingMachineRecipesProvider::new
|
||||
add BlastFurnaceRecipesProvider::new
|
||||
add IndustrialGrinderRecipesProvider::new
|
||||
add IndustrialSawmillRecipesProvider::new
|
||||
|
||||
fabricDataGenerator.addProvider(ModelProvider.&new)
|
||||
fabricDataGenerator.addProvider(BlockLootTableProvider.&new)
|
||||
add ModelProvider::new
|
||||
add BlockLootTableProvider::new
|
||||
|
||||
add TRWorldGenProvider::new
|
||||
}
|
||||
|
||||
@Override
|
||||
String getEffectiveModId() {
|
||||
return TechReborn.MOD_ID
|
||||
}
|
||||
|
||||
@Override
|
||||
void buildRegistry(RegistryBuilder registryBuilder) {
|
||||
registryBuilder.addRegistry(RegistryKeys.CONFIGURED_FEATURE, TRWorldGenBootstrap::configuredFeatures)
|
||||
registryBuilder.addRegistry(RegistryKeys.PLACED_FEATURE, TRWorldGenBootstrap::placedFeatures)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,26 +1,20 @@
|
|||
package techreborn.datagen.models
|
||||
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricBlockLootTableProvider
|
||||
import net.fabricmc.fabric.api.resource.conditions.v1.ConditionJsonProvider
|
||||
import net.minecraft.data.DataWriter
|
||||
import net.minecraft.data.server.BlockLootTableGenerator
|
||||
import net.minecraft.loot.LootTable
|
||||
import net.minecraft.util.Identifier
|
||||
import org.jetbrains.annotations.NotNull
|
||||
import net.minecraft.registry.RegistryWrapper
|
||||
import techreborn.init.TRContent
|
||||
|
||||
import java.util.function.BiConsumer
|
||||
import java.util.function.Consumer
|
||||
import java.util.concurrent.CompletableFuture
|
||||
|
||||
class BlockLootTableProvider extends FabricBlockLootTableProvider{
|
||||
|
||||
BlockLootTableProvider(FabricDataGenerator dataGenerator) {
|
||||
super(dataGenerator)
|
||||
BlockLootTableProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||
super(output)
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void generateBlockLootTables() {
|
||||
public void generate() {
|
||||
TRContent.StorageBlocks.values().each {
|
||||
addDrop(it.getBlock())
|
||||
addDrop(it.getSlabBlock())
|
||||
|
|
|
@ -24,19 +24,20 @@
|
|||
|
||||
package techreborn.datagen.models
|
||||
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider
|
||||
import net.minecraft.block.Blocks
|
||||
import net.minecraft.data.client.BlockStateModelGenerator
|
||||
import net.minecraft.data.client.ItemModelGenerator
|
||||
import net.minecraft.data.client.Models
|
||||
import net.minecraft.data.family.BlockFamilies
|
||||
import net.minecraft.data.family.BlockFamily
|
||||
import net.minecraft.registry.RegistryWrapper
|
||||
import techreborn.init.TRContent
|
||||
|
||||
import java.util.concurrent.CompletableFuture
|
||||
|
||||
class ModelProvider extends FabricModelProvider {
|
||||
ModelProvider(FabricDataGenerator dataGenerator) {
|
||||
super(dataGenerator)
|
||||
ModelProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||
super(output)
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,13 +24,14 @@
|
|||
|
||||
package techreborn.datagen.recipes
|
||||
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider
|
||||
import net.minecraft.advancement.criterion.CriterionConditions
|
||||
import net.minecraft.data.server.recipe.RecipeJsonProvider
|
||||
import net.minecraft.item.ItemConvertible
|
||||
import net.minecraft.recipe.Ingredient
|
||||
import net.minecraft.tag.TagKey
|
||||
import net.minecraft.registry.RegistryWrapper
|
||||
import net.minecraft.registry.tag.TagKey
|
||||
import net.minecraft.util.Identifier
|
||||
import techreborn.datagen.recipes.machine.MachineRecipeJsonFactory
|
||||
import techreborn.datagen.recipes.machine.blast_furnace.BlastFurnaceRecipeJsonFactory
|
||||
|
@ -38,23 +39,24 @@ import techreborn.datagen.recipes.machine.industrial_grinder.IndustrialGrinderRe
|
|||
import techreborn.datagen.recipes.machine.industrial_sawmill.IndustrialSawmillRecipeJsonFactory
|
||||
import techreborn.init.ModRecipes
|
||||
|
||||
import java.util.concurrent.CompletableFuture
|
||||
import java.util.function.Consumer
|
||||
|
||||
abstract class TechRebornRecipesProvider extends FabricRecipeProvider {
|
||||
protected Consumer<RecipeJsonProvider> exporter
|
||||
TechRebornRecipesProvider(FabricDataGenerator dataGenerator) {
|
||||
super(dataGenerator)
|
||||
TechRebornRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||
super(output)
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void generateRecipes(Consumer<RecipeJsonProvider> exporter) {
|
||||
final void generate(Consumer<RecipeJsonProvider> exporter) {
|
||||
this.exporter = exporter
|
||||
generateRecipes()
|
||||
}
|
||||
|
||||
abstract void generateRecipes()
|
||||
|
||||
static Ingredient createIngredient(def input) {
|
||||
static Ingredient createIngredient(def input) {
|
||||
if (input instanceof Ingredient) {
|
||||
return input
|
||||
}
|
||||
|
@ -161,4 +163,9 @@ abstract class TechRebornRecipesProvider extends FabricRecipeProvider {
|
|||
protected Identifier getRecipeIdentifier(Identifier identifier) {
|
||||
return new Identifier("techreborn", super.getRecipeIdentifier(identifier).path)
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Recipes / " + getClass().name
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,21 +25,26 @@
|
|||
package techreborn.datagen.recipes.crafting
|
||||
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||
import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder
|
||||
import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder
|
||||
import net.minecraft.data.server.recipe.SingleItemRecipeJsonBuilder
|
||||
import net.minecraft.item.ItemConvertible
|
||||
import net.minecraft.item.Items
|
||||
import net.minecraft.recipe.RecipeSerializer
|
||||
import net.minecraft.recipe.book.RecipeCategory
|
||||
import net.minecraft.registry.RegistryWrapper
|
||||
import net.minecraft.util.Identifier
|
||||
import techreborn.TechReborn
|
||||
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
||||
import techreborn.init.TRContent
|
||||
|
||||
import java.util.concurrent.CompletableFuture
|
||||
import java.util.function.Function
|
||||
|
||||
class CraftingRecipesProvider extends TechRebornRecipesProvider {
|
||||
CraftingRecipesProvider(FabricDataGenerator dataGenerator) {
|
||||
super(dataGenerator)
|
||||
CraftingRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||
super(output, registriesFuture)
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -191,8 +196,8 @@ class CraftingRecipesProvider extends TechRebornRecipesProvider {
|
|||
return s.toString()
|
||||
}
|
||||
|
||||
def offerMonoShapelessRecipe(def input, int inputSize, ItemConvertible output, int outputSize, String source, prefix = "", String result = null) {
|
||||
ShapelessRecipeJsonBuilder.create(output, outputSize).input(createIngredient(input), inputSize)
|
||||
def offerMonoShapelessRecipe(def input, int inputSize, ItemConvertible output, int outputSize, String source, prefix = "", String result = null, RecipeCategory category = RecipeCategory.MISC) {
|
||||
new ShapelessRecipeJsonBuilder(category, output, outputSize).input(createIngredient(input), inputSize)
|
||||
.criterion(getCriterionName(input), getCriterionConditions(input))
|
||||
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, recipeNameString(prefix, input, output, source, result)))
|
||||
}
|
||||
|
@ -206,14 +211,14 @@ class CraftingRecipesProvider extends TechRebornRecipesProvider {
|
|||
return s.toString()
|
||||
}
|
||||
|
||||
def static createMonoShapeRecipe(def input, ItemConvertible output, char character, int outputAmount = 1) {
|
||||
return ShapedRecipeJsonBuilder.create(output, outputAmount)
|
||||
def static createMonoShapeRecipe(def input, ItemConvertible output, char character, int outputAmount = 1, RecipeCategory category = RecipeCategory.MISC) {
|
||||
return new ShapedRecipeJsonBuilder(category, output, outputAmount)
|
||||
.input(character, createIngredient(input))
|
||||
.criterion(getCriterionName(input), getCriterionConditions(input))
|
||||
}
|
||||
|
||||
def static createDuoShapeRecipe(def input1, def input2, ItemConvertible output, char char1, char char2, boolean crit1 = true, boolean crit2 = false) {
|
||||
ShapedRecipeJsonBuilder factory = ShapedRecipeJsonBuilder.create(output)
|
||||
def static createDuoShapeRecipe(def input1, def input2, ItemConvertible output, char char1, char char2, boolean crit1 = true, boolean crit2 = false, RecipeCategory category = RecipeCategory.MISC) {
|
||||
ShapedRecipeJsonBuilder factory = ShapedRecipeJsonBuilder.create(category, output)
|
||||
.input(char1, createIngredient(input1))
|
||||
.input(char2, createIngredient(input2))
|
||||
if (crit1)
|
||||
|
@ -223,8 +228,8 @@ class CraftingRecipesProvider extends TechRebornRecipesProvider {
|
|||
return factory
|
||||
}
|
||||
|
||||
def static createStonecutterRecipe(def input, ItemConvertible output, int outputAmount = 1) {
|
||||
return SingleItemRecipeJsonBuilder.createStonecutting(createIngredient(input), output, outputAmount)
|
||||
def static createStonecutterRecipe(def input, ItemConvertible output, int outputAmount = 1, RecipeCategory category = RecipeCategory.MISC) {
|
||||
return new SingleItemRecipeJsonBuilder(category, RecipeSerializer.STONECUTTING, createIngredient(input), output, outputAmount)
|
||||
.criterion(getCriterionName(input), getCriterionConditions(input))
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ package techreborn.datagen.recipes.machine
|
|||
import net.minecraft.item.Item
|
||||
import net.minecraft.item.ItemConvertible
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.tag.TagKey
|
||||
import net.minecraft.registry.tag.TagKey
|
||||
import net.minecraft.util.Identifier
|
||||
import reborncore.common.crafting.ingredient.RebornIngredient
|
||||
import reborncore.common.crafting.ingredient.StackIngredient
|
||||
|
|
|
@ -26,6 +26,7 @@ package techreborn.datagen.recipes.machine
|
|||
|
||||
import com.google.gson.JsonObject
|
||||
import net.fabricmc.fabric.api.resource.conditions.v1.ConditionJsonProvider
|
||||
import net.fabricmc.fabric.api.resource.conditions.v1.DefaultResourceConditions
|
||||
import net.fabricmc.fabric.impl.datagen.FabricDataGenHelper
|
||||
import net.minecraft.advancement.Advancement.Builder
|
||||
import net.minecraft.advancement.criterion.CriterionConditions
|
||||
|
@ -33,15 +34,16 @@ import net.minecraft.data.server.recipe.RecipeJsonProvider
|
|||
import net.minecraft.item.ItemConvertible
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.recipe.RecipeSerializer
|
||||
import net.minecraft.tag.TagKey
|
||||
import net.minecraft.registry.Registries
|
||||
import net.minecraft.registry.Registry
|
||||
import net.minecraft.registry.tag.TagKey
|
||||
import net.minecraft.resource.featuretoggle.FeatureFlag
|
||||
import net.minecraft.util.Identifier
|
||||
import net.minecraft.util.registry.Registry
|
||||
import org.jetbrains.annotations.NotNull
|
||||
import reborncore.common.crafting.RebornRecipe
|
||||
import reborncore.common.crafting.RebornRecipeType
|
||||
import reborncore.common.crafting.RecipeUtils
|
||||
import reborncore.common.crafting.ingredient.RebornIngredient
|
||||
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
||||
|
||||
import java.util.function.Consumer
|
||||
|
||||
|
@ -209,10 +211,14 @@ class MachineRecipeJsonFactory<R extends RebornRecipe> {
|
|||
throw new IllegalStateException("Recipe has no outputs")
|
||||
}
|
||||
|
||||
def outputId = Registry.ITEM.getId(outputs[0].item)
|
||||
def outputId = Registries.ITEM.getId(outputs[0].item)
|
||||
return new Identifier("techreborn", "${type.name().path}/${outputId.path}${getSourceAppendix()}")
|
||||
}
|
||||
|
||||
def feature(FeatureFlag flag) {
|
||||
condition(DefaultResourceConditions.featuresEnabled(flag))
|
||||
}
|
||||
|
||||
static class MachineRecipeJsonProvider<R extends RebornRecipe> implements RecipeJsonProvider {
|
||||
private final RebornRecipeType<R> type
|
||||
private final R recipe
|
||||
|
|
|
@ -24,16 +24,19 @@
|
|||
|
||||
package techreborn.datagen.recipes.machine.assembling_machine
|
||||
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.item.Items
|
||||
import net.minecraft.tag.ItemTags
|
||||
import net.minecraft.registry.RegistryWrapper
|
||||
import net.minecraft.registry.tag.ItemTags
|
||||
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
||||
|
||||
import java.util.concurrent.CompletableFuture
|
||||
|
||||
class AssemblingMachineRecipesProvider extends TechRebornRecipesProvider {
|
||||
|
||||
AssemblingMachineRecipesProvider(FabricDataGenerator dataGenerator) {
|
||||
super(dataGenerator)
|
||||
AssemblingMachineRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||
super(output, registriesFuture)
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,12 +24,15 @@
|
|||
|
||||
package techreborn.datagen.recipes.machine.blast_furnace
|
||||
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.item.Items
|
||||
import net.minecraft.registry.RegistryWrapper
|
||||
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
||||
import techreborn.init.TRContent
|
||||
|
||||
import java.util.concurrent.CompletableFuture
|
||||
|
||||
class BlastFurnaceRecipesProvider extends TechRebornRecipesProvider {
|
||||
|
||||
public final int ARMOR_POWER = 128
|
||||
|
@ -39,8 +42,8 @@ class BlastFurnaceRecipesProvider extends TechRebornRecipesProvider {
|
|||
public final int TOOL_TIME = ARMOR_TIME
|
||||
public final int TOOL_HEAT = ARMOR_HEAT
|
||||
|
||||
BlastFurnaceRecipesProvider(FabricDataGenerator dataGenerator) {
|
||||
super(dataGenerator)
|
||||
BlastFurnaceRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||
super(output, registriesFuture)
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,18 +24,21 @@
|
|||
|
||||
package techreborn.datagen.recipes.machine.chemical_reactor
|
||||
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.registry.RegistryWrapper
|
||||
import reborncore.common.util.ColoredItem
|
||||
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
||||
|
||||
import java.util.concurrent.CompletableFuture
|
||||
|
||||
class ChemicalReactorRecipesProvider extends TechRebornRecipesProvider {
|
||||
|
||||
public final int DYE_POWER = 25
|
||||
public final int DYE_TIME = 250
|
||||
|
||||
ChemicalReactorRecipesProvider(FabricDataGenerator dataGenerator) {
|
||||
super(dataGenerator)
|
||||
ChemicalReactorRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||
super(output, registriesFuture)
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,15 +24,18 @@
|
|||
|
||||
package techreborn.datagen.recipes.machine.compressor
|
||||
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.registry.RegistryWrapper
|
||||
import reborncore.common.misc.TagConvertible
|
||||
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
||||
import techreborn.init.TRContent
|
||||
|
||||
import java.util.concurrent.CompletableFuture
|
||||
|
||||
class CompressorRecipesProvider extends TechRebornRecipesProvider {
|
||||
CompressorRecipesProvider(FabricDataGenerator dataGenerator) {
|
||||
super(dataGenerator)
|
||||
CompressorRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||
super(output, registriesFuture)
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,15 +24,18 @@
|
|||
|
||||
package techreborn.datagen.recipes.machine.extractor
|
||||
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.item.Items
|
||||
import net.minecraft.registry.RegistryWrapper
|
||||
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
||||
import techreborn.init.TRContent
|
||||
|
||||
import java.util.concurrent.CompletableFuture
|
||||
|
||||
class ExtractorRecipesProvider extends TechRebornRecipesProvider {
|
||||
ExtractorRecipesProvider(FabricDataGenerator dataGenerator) {
|
||||
super(dataGenerator)
|
||||
ExtractorRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||
super(output, registriesFuture)
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,19 +24,23 @@
|
|||
|
||||
package techreborn.datagen.recipes.machine.grinder
|
||||
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.item.Items
|
||||
import net.minecraft.tag.ItemTags
|
||||
import net.minecraft.tag.TagKey
|
||||
import net.minecraft.registry.Registry
|
||||
import net.minecraft.registry.RegistryKeys
|
||||
import net.minecraft.registry.RegistryWrapper
|
||||
import net.minecraft.registry.tag.ItemTags
|
||||
import net.minecraft.registry.tag.TagKey
|
||||
import net.minecraft.util.Identifier
|
||||
import net.minecraft.util.registry.Registry
|
||||
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
||||
import techreborn.init.TRContent
|
||||
|
||||
import java.util.concurrent.CompletableFuture
|
||||
|
||||
class GrinderRecipesProvider extends TechRebornRecipesProvider {
|
||||
GrinderRecipesProvider(FabricDataGenerator dataGenerator) {
|
||||
super(dataGenerator)
|
||||
GrinderRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||
super(output, registriesFuture)
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,9 +61,9 @@ class GrinderRecipesProvider extends TechRebornRecipesProvider {
|
|||
|
||||
void generateVanillaRawMetals() {
|
||||
[
|
||||
(Items.RAW_IRON) : (TagKey.of(Registry.ITEM_KEY, new Identifier("c", "iron_ores"))),
|
||||
(Items.RAW_COPPER): (TagKey.of(Registry.ITEM_KEY, new Identifier("c", "copper_ores"))),
|
||||
(Items.RAW_GOLD) : (TagKey.of(Registry.ITEM_KEY, new Identifier("c", "gold_ores")))
|
||||
(Items.RAW_IRON) : (TagKey.of(RegistryKeys.ITEM, new Identifier("c", "iron_ores"))),
|
||||
(Items.RAW_COPPER): (TagKey.of(RegistryKeys.ITEM, new Identifier("c", "copper_ores"))),
|
||||
(Items.RAW_GOLD) : (TagKey.of(RegistryKeys.ITEM, new Identifier("c", "gold_ores")))
|
||||
].each { raw, oreTag ->
|
||||
offerGrinderRecipe {
|
||||
ingredients oreTag
|
||||
|
@ -249,5 +253,4 @@ class GrinderRecipesProvider extends TechRebornRecipesProvider {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -24,13 +24,16 @@
|
|||
|
||||
package techreborn.datagen.recipes.machine.industrial_grinder
|
||||
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.item.Items
|
||||
import net.minecraft.registry.RegistryWrapper
|
||||
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
||||
import techreborn.init.ModFluids
|
||||
import techreborn.init.TRContent
|
||||
|
||||
import java.util.concurrent.CompletableFuture
|
||||
|
||||
class IndustrialGrinderRecipesProvider extends TechRebornRecipesProvider {
|
||||
|
||||
public final int ARMOR_POWER = 128
|
||||
|
@ -41,8 +44,8 @@ class IndustrialGrinderRecipesProvider extends TechRebornRecipesProvider {
|
|||
public final long TOOL_FLUID_AMOUNT = 500L // in millibuckets
|
||||
var dustMap = TRContent.SmallDusts.SD2DMap
|
||||
|
||||
IndustrialGrinderRecipesProvider(FabricDataGenerator dataGenerator) {
|
||||
super(dataGenerator)
|
||||
IndustrialGrinderRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||
super(output, registriesFuture)
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,17 +24,21 @@
|
|||
|
||||
package techreborn.datagen.recipes.machine.industrial_sawmill
|
||||
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.item.Items
|
||||
import net.minecraft.tag.ItemTags
|
||||
import net.minecraft.registry.RegistryWrapper
|
||||
import net.minecraft.registry.tag.ItemTags
|
||||
import net.minecraft.resource.featuretoggle.FeatureFlags
|
||||
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
||||
import techreborn.init.TRContent
|
||||
|
||||
import java.util.concurrent.CompletableFuture
|
||||
|
||||
class IndustrialSawmillRecipesProvider extends TechRebornRecipesProvider {
|
||||
|
||||
IndustrialSawmillRecipesProvider(FabricDataGenerator dataGenerator) {
|
||||
super(dataGenerator)
|
||||
IndustrialSawmillRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||
super(output, registriesFuture)
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,6 +63,14 @@ class IndustrialSawmillRecipesProvider extends TechRebornRecipesProvider {
|
|||
fluidAmount 1000 // in millibuckets
|
||||
}
|
||||
}
|
||||
offerIndustrialSawmillRecipe {
|
||||
ingredients ItemTags.BAMBOO_BLOCKS
|
||||
outputs new ItemStack(Items.BAMBOO_PLANKS,2), new ItemStack(TRContent.Dusts.SAW, 1)
|
||||
power 40
|
||||
time 100
|
||||
fluidAmount 500 // in millibuckets
|
||||
feature FeatureFlags.UPDATE_1_20
|
||||
}
|
||||
[
|
||||
(Items.ACACIA_STAIRS): Items.ACACIA_SLAB,
|
||||
(Items.BIRCH_STAIRS): Items.BIRCH_SLAB,
|
||||
|
@ -81,6 +93,21 @@ class IndustrialSawmillRecipesProvider extends TechRebornRecipesProvider {
|
|||
criterion getCriterionName(stairs), getCriterionConditions(stairs)
|
||||
}
|
||||
}
|
||||
[
|
||||
(Items.BAMBOO_STAIRS): Items.BAMBOO_SLAB,
|
||||
(Items.BAMBOO_MOSAIC_STAIRS): Items.BAMBOO_MOSAIC_SLAB
|
||||
].each { stairs, slab ->
|
||||
offerIndustrialSawmillRecipe {
|
||||
ingredients stairs
|
||||
outputs slab, new ItemStack(TRContent.Dusts.SAW, 2)
|
||||
power 30
|
||||
time 100
|
||||
fluidAmount 250 // in millibuckets
|
||||
source "stairs"
|
||||
criterion getCriterionName(stairs), getCriterionConditions(stairs)
|
||||
feature FeatureFlags.UPDATE_1_20
|
||||
}
|
||||
}
|
||||
[
|
||||
(Items.ACACIA_SLAB): Items.ACACIA_PRESSURE_PLATE,
|
||||
(Items.BIRCH_SLAB): Items.BIRCH_PRESSURE_PLATE,
|
||||
|
@ -103,6 +130,21 @@ class IndustrialSawmillRecipesProvider extends TechRebornRecipesProvider {
|
|||
criterion getCriterionName(slab), getCriterionConditions(slab)
|
||||
}
|
||||
}
|
||||
[
|
||||
(Items.BAMBOO_SLAB): Items.BAMBOO_PRESSURE_PLATE,
|
||||
(Items.BAMBOO_MOSAIC_SLAB): Items.BAMBOO_PRESSURE_PLATE
|
||||
].each { slab, plate ->
|
||||
offerIndustrialSawmillRecipe {
|
||||
ingredients slab
|
||||
outputs new ItemStack(plate, 2), new ItemStack(TRContent.Dusts.SAW, 2)
|
||||
power 30
|
||||
time 200
|
||||
fluidAmount 250 // in millibuckets
|
||||
source ((slab == Items.BAMBOO_MOSAIC_SLAB ? "mosaic_" : "") + "slab")
|
||||
criterion getCriterionName(slab), getCriterionConditions(slab)
|
||||
feature FeatureFlags.UPDATE_1_20
|
||||
}
|
||||
}
|
||||
[
|
||||
(ItemTags.PLANKS): 8,
|
||||
// stairs would be 6, slabs 4
|
||||
|
|
|
@ -24,18 +24,22 @@
|
|||
|
||||
package techreborn.datagen.recipes.smelting
|
||||
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||
import net.minecraft.data.server.recipe.CookingRecipeJsonBuilder
|
||||
import net.minecraft.item.ItemConvertible
|
||||
import net.minecraft.item.Items
|
||||
import net.minecraft.recipe.CookingRecipeSerializer
|
||||
import net.minecraft.recipe.RecipeSerializer
|
||||
import net.minecraft.recipe.book.RecipeCategory
|
||||
import net.minecraft.registry.RegistryWrapper
|
||||
import techreborn.datagen.recipes.TechRebornRecipesProvider
|
||||
import techreborn.init.TRContent
|
||||
|
||||
import java.util.concurrent.CompletableFuture
|
||||
|
||||
class SmeltingRecipesProvider extends TechRebornRecipesProvider {
|
||||
SmeltingRecipesProvider(FabricDataGenerator dataGenerator) {
|
||||
super(dataGenerator)
|
||||
SmeltingRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||
super(output, registriesFuture)
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -73,8 +77,8 @@ class SmeltingRecipesProvider extends TechRebornRecipesProvider {
|
|||
offerCookingRecipe(input, output, experience, cookingTime, RecipeSerializer.BLASTING, "blasting/")
|
||||
}
|
||||
|
||||
def offerCookingRecipe(def input, ItemConvertible output, float experience, int cookingTime, CookingRecipeSerializer<?> serializer, String prefix = "") {
|
||||
CookingRecipeJsonBuilder.create(createIngredient(input), output, experience, cookingTime, serializer)
|
||||
def offerCookingRecipe(def input, ItemConvertible output, float experience, int cookingTime, CookingRecipeSerializer<?> serializer, String prefix = "", RecipeCategory category = RecipeCategory.MISC) {
|
||||
CookingRecipeJsonBuilder.create(createIngredient(input), category, output, experience, cookingTime, serializer)
|
||||
.criterion(getCriterionName(input), getCriterionConditions(input))
|
||||
.offerTo(this.exporter, prefix + getInputPath(output) + "_from_" + getInputPath(input))
|
||||
}
|
||||
|
|
|
@ -24,22 +24,25 @@
|
|||
|
||||
package techreborn.datagen.tags
|
||||
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider
|
||||
import net.fabricmc.fabric.api.mininglevel.v1.FabricMineableTags
|
||||
import net.fabricmc.fabric.api.tag.convention.v1.ConventionalBlockTags
|
||||
import net.minecraft.tag.BlockTags
|
||||
import net.minecraft.registry.RegistryWrapper
|
||||
import net.minecraft.registry.tag.BlockTags
|
||||
import net.minecraft.util.Identifier
|
||||
import techreborn.init.TRContent
|
||||
|
||||
import java.util.concurrent.CompletableFuture
|
||||
|
||||
class TRBlockTagProvider extends FabricTagProvider.BlockTagProvider {
|
||||
|
||||
TRBlockTagProvider(FabricDataGenerator dataGenerator) {
|
||||
super(dataGenerator)
|
||||
TRBlockTagProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||
super(output, registriesFuture)
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void generateTags() {
|
||||
protected void configure(RegistryWrapper.WrapperLookup lookup) {
|
||||
getOrCreateTagBuilder(TRContent.BlockTags.DRILL_MINEABLE)
|
||||
.addOptionalTag(BlockTags.PICKAXE_MINEABLE.id())
|
||||
.addOptionalTag(BlockTags.SHOVEL_MINEABLE.id())
|
||||
|
|
|
@ -24,19 +24,23 @@
|
|||
|
||||
package techreborn.datagen.tags
|
||||
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider.ItemTagProvider
|
||||
import net.minecraft.tag.BlockTags
|
||||
import net.minecraft.tag.ItemTags
|
||||
import net.minecraft.registry.RegistryWrapper
|
||||
import net.minecraft.registry.tag.ItemTags
|
||||
import reborncore.common.misc.RebornCoreTags
|
||||
import techreborn.init.ModFluids
|
||||
import techreborn.init.TRContent
|
||||
|
||||
import java.util.concurrent.CompletableFuture
|
||||
|
||||
class TRItemTagProvider extends ItemTagProvider {
|
||||
TRItemTagProvider(FabricDataGenerator dataGenerator) {
|
||||
super(dataGenerator)
|
||||
TRItemTagProvider(FabricDataOutput dataOutput, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||
super(dataOutput, registriesFuture)
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void generateTags() {
|
||||
protected void configure(RegistryWrapper.WrapperLookup arg) {
|
||||
TRContent.Ores.values().each { ore ->
|
||||
getOrCreateTagBuilder(ore.asTag()).add(ore.asItem())
|
||||
getOrCreateTagBuilder(TRContent.ItemTags.ORES).add(ore.asItem())
|
||||
|
@ -176,5 +180,8 @@ class TRItemTagProvider extends ItemTagProvider {
|
|||
|
||||
getOrCreateTagBuilder(ItemTags.WOODEN_TRAPDOORS)
|
||||
.add(TRContent.RUBBER_TRAPDOOR.asItem())
|
||||
|
||||
getOrCreateTagBuilder(RebornCoreTags.WATER_EXPLOSION_ITEM)
|
||||
.add(ModFluids.SODIUM.getBucket())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,20 +24,23 @@
|
|||
|
||||
package techreborn.datagen.tags
|
||||
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider
|
||||
import net.minecraft.tag.PointOfInterestTypeTags
|
||||
import net.minecraft.util.registry.Registry
|
||||
import net.minecraft.registry.RegistryKeys
|
||||
import net.minecraft.registry.RegistryWrapper
|
||||
import net.minecraft.registry.tag.PointOfInterestTypeTags
|
||||
import net.minecraft.world.poi.PointOfInterestType
|
||||
import techreborn.init.TRVillager
|
||||
|
||||
import java.util.concurrent.CompletableFuture
|
||||
|
||||
class TRPointOfInterestTagProvider extends FabricTagProvider<PointOfInterestType> {
|
||||
TRPointOfInterestTagProvider(FabricDataGenerator dataGenerator) {
|
||||
super(dataGenerator, Registry.POINT_OF_INTEREST_TYPE)
|
||||
TRPointOfInterestTagProvider(FabricDataOutput dataOutput, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||
super(dataOutput, RegistryKeys.POINT_OF_INTEREST_TYPE, registriesFuture)
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void generateTags() {
|
||||
protected void configure(RegistryWrapper.WrapperLookup arg) {
|
||||
getOrCreateTagBuilder(PointOfInterestTypeTags.ACQUIRABLE_JOB_SITE)
|
||||
.add(TRVillager.METALLURGIST_POI)
|
||||
.add(TRVillager.ELECTRICIAN_POI)
|
||||
|
|
|
@ -0,0 +1,185 @@
|
|||
package techreborn.datagen.worldgen
|
||||
|
||||
import net.minecraft.block.BlockState
|
||||
import net.minecraft.block.Blocks
|
||||
import net.minecraft.registry.Registerable
|
||||
import net.minecraft.registry.RegistryEntryLookup
|
||||
import net.minecraft.registry.RegistryKeys
|
||||
import net.minecraft.registry.tag.BlockTags
|
||||
import net.minecraft.structure.rule.BlockMatchRuleTest
|
||||
import net.minecraft.structure.rule.BlockStateMatchRuleTest
|
||||
import net.minecraft.structure.rule.RuleTest
|
||||
import net.minecraft.structure.rule.TagMatchRuleTest
|
||||
import net.minecraft.util.collection.DataPool
|
||||
import net.minecraft.util.math.BlockPos
|
||||
import net.minecraft.util.math.Direction
|
||||
import net.minecraft.util.math.intprovider.ConstantIntProvider
|
||||
import net.minecraft.world.Heightmap
|
||||
import net.minecraft.world.gen.YOffset
|
||||
import net.minecraft.world.gen.blockpredicate.BlockPredicate
|
||||
import net.minecraft.world.gen.feature.*
|
||||
import net.minecraft.world.gen.feature.size.TwoLayersFeatureSize
|
||||
import net.minecraft.world.gen.foliage.BlobFoliagePlacer
|
||||
import net.minecraft.world.gen.heightprovider.UniformHeightProvider
|
||||
import net.minecraft.world.gen.placementmodifier.*
|
||||
import net.minecraft.world.gen.stateprovider.BlockStateProvider
|
||||
import net.minecraft.world.gen.stateprovider.WeightedBlockStateProvider
|
||||
import net.minecraft.world.gen.trunk.StraightTrunkPlacer
|
||||
import techreborn.blocks.misc.BlockRubberLog
|
||||
import techreborn.init.ModFluids
|
||||
import techreborn.init.TRContent
|
||||
import techreborn.world.RubberTreeSpikeDecorator
|
||||
import techreborn.world.TROreFeatureConfig
|
||||
import techreborn.world.TargetDimension
|
||||
import techreborn.world.WorldGenerator
|
||||
|
||||
class TRWorldGenBootstrap {
|
||||
static void configuredFeatures(Registerable<ConfiguredFeature> registry) {
|
||||
def placedFeatureLookup = registry.getRegistryLookup(RegistryKeys.PLACED_FEATURE)
|
||||
|
||||
WorldGenerator.ORE_FEATURES.forEach {
|
||||
registry.register(it.configuredFeature(), createOreConfiguredFeature(it))
|
||||
}
|
||||
|
||||
registry.register(WorldGenerator.OIL_LAKE_FEATURE, createOilLakeConfiguredFeature())
|
||||
registry.register(WorldGenerator.RUBBER_TREE_FEATURE, createRubberTreeConfiguredFeature())
|
||||
registry.register(WorldGenerator.RUBBER_TREE_PATCH_FEATURE, createRubberPatchTreeConfiguredFeature(placedFeatureLookup))
|
||||
}
|
||||
|
||||
static void placedFeatures(Registerable<PlacedFeature> registry) {
|
||||
def configuredFeatureLookup = registry.getRegistryLookup(RegistryKeys.CONFIGURED_FEATURE)
|
||||
|
||||
WorldGenerator.ORE_FEATURES.forEach {
|
||||
registry.register(it.placedFeature(), createOrePlacedFeature(configuredFeatureLookup, it))
|
||||
}
|
||||
|
||||
registry.register(WorldGenerator.OIL_LAKE_PLACED_FEATURE, createOilLakePlacedFeature(configuredFeatureLookup))
|
||||
registry.register(WorldGenerator.RUBBER_TREE_PLACED_FEATURE, createRubberTreePlacedFeature(configuredFeatureLookup))
|
||||
registry.register(WorldGenerator.RUBBER_TREE_PATCH_PLACED_FEATURE, createRubberTreePatchPlacedFeature(configuredFeatureLookup))
|
||||
}
|
||||
|
||||
// Ores
|
||||
private static ConfiguredFeature createOreConfiguredFeature(TROreFeatureConfig config) {
|
||||
def oreFeatureConfig = switch (config.ore().distribution.dimension) {
|
||||
case TargetDimension.OVERWORLD -> createOverworldOreFeatureConfig(config)
|
||||
case TargetDimension.NETHER -> createSimpleOreFeatureConfig(new BlockMatchRuleTest(Blocks.NETHERRACK), config)
|
||||
case TargetDimension.END -> createSimpleOreFeatureConfig(new BlockStateMatchRuleTest(Blocks.END_STONE.getDefaultState()), config)
|
||||
}
|
||||
|
||||
return new ConfiguredFeature<>(Feature.ORE, oreFeatureConfig)
|
||||
}
|
||||
|
||||
private static OreFeatureConfig createOverworldOreFeatureConfig(TROreFeatureConfig config) {
|
||||
if (config.ore().getDeepslate() != null) {
|
||||
return new OreFeatureConfig(List.of(
|
||||
OreFeatureConfig.createTarget(new TagMatchRuleTest(BlockTags.STONE_ORE_REPLACEABLES), config.ore().block.getDefaultState()),
|
||||
OreFeatureConfig.createTarget(new TagMatchRuleTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES), config.ore().getDeepslate().block.getDefaultState())
|
||||
), config.ore().distribution.veinSize)
|
||||
}
|
||||
|
||||
return createSimpleOreFeatureConfig(new TagMatchRuleTest(BlockTags.STONE_ORE_REPLACEABLES), config)
|
||||
}
|
||||
|
||||
private static OreFeatureConfig createSimpleOreFeatureConfig(RuleTest test, TROreFeatureConfig config) {
|
||||
return new OreFeatureConfig(test, config.ore().block.getDefaultState(), config.ore().distribution.veinSize)
|
||||
}
|
||||
|
||||
private static PlacedFeature createOrePlacedFeature(RegistryEntryLookup<ConfiguredFeature> configuredFeatureLookup, TROreFeatureConfig config) {
|
||||
return new PlacedFeature(configuredFeatureLookup.getOrThrow(config.configuredFeature()), getOrePlacementModifiers(config))
|
||||
}
|
||||
|
||||
private static List<PlacementModifier> getOrePlacementModifiers(TROreFeatureConfig config) {
|
||||
return oreModifiers(
|
||||
CountPlacementModifier.of(config.ore().distribution.veinsPerChunk),
|
||||
HeightRangePlacementModifier.uniform(
|
||||
config.ore().distribution.minOffset,
|
||||
YOffset.fixed(config.ore().distribution.maxY)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private static List<PlacementModifier> oreModifiers(PlacementModifier first, PlacementModifier second) {
|
||||
return List.of(first, SquarePlacementModifier.of(), second, BiomePlacementModifier.of())
|
||||
}
|
||||
|
||||
// Oil lake
|
||||
private static ConfiguredFeature createOilLakeConfiguredFeature() {
|
||||
return new ConfiguredFeature<>(Feature.LAKE,
|
||||
new LakeFeature.Config(
|
||||
BlockStateProvider.of(ModFluids.OIL.getBlock().getDefaultState()),
|
||||
BlockStateProvider.of(Blocks.STONE.getDefaultState())
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private static PlacedFeature createOilLakePlacedFeature(RegistryEntryLookup<ConfiguredFeature> lookup) {
|
||||
return new PlacedFeature(
|
||||
lookup.getOrThrow(WorldGenerator.OIL_LAKE_FEATURE), List.of(
|
||||
RarityFilterPlacementModifier.of(20),
|
||||
HeightRangePlacementModifier.of(UniformHeightProvider.create(YOffset.fixed(0), YOffset.getTop())),
|
||||
EnvironmentScanPlacementModifier.of(Direction.DOWN, BlockPredicate.bothOf(BlockPredicate.not(BlockPredicate.IS_AIR), BlockPredicate.insideWorldBounds(new BlockPos(0, -5, 0))), 32),
|
||||
SurfaceThresholdFilterPlacementModifier.of(Heightmap.Type.OCEAN_FLOOR_WG, Integer.MIN_VALUE, -5)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
// Rubber tree
|
||||
private static ConfiguredFeature createRubberTreeConfiguredFeature() {
|
||||
final DataPool.Builder<BlockState> logDataPool = DataPool.<BlockState>builder()
|
||||
.add(TRContent.RUBBER_LOG.getDefaultState(), 6)
|
||||
|
||||
Arrays.stream(Direction.values())
|
||||
.filter(direction -> direction.getAxis().isHorizontal())
|
||||
.map(direction -> TRContent.RUBBER_LOG.getDefaultState()
|
||||
.with(BlockRubberLog.HAS_SAP, true)
|
||||
.with(BlockRubberLog.SAP_SIDE, direction)
|
||||
)
|
||||
.forEach(state -> logDataPool.add(state, 1))
|
||||
|
||||
return new ConfiguredFeature<>(Feature.TREE,
|
||||
new TreeFeatureConfig.Builder(
|
||||
new WeightedBlockStateProvider(logDataPool),
|
||||
new StraightTrunkPlacer(6, 3, 0),
|
||||
BlockStateProvider.of(TRContent.RUBBER_LEAVES.getDefaultState()),
|
||||
new BlobFoliagePlacer(
|
||||
ConstantIntProvider.create(2),
|
||||
ConstantIntProvider.create(0),
|
||||
3
|
||||
),
|
||||
new TwoLayersFeatureSize(
|
||||
1,
|
||||
0,
|
||||
1
|
||||
))
|
||||
.decorators(List.of(
|
||||
new RubberTreeSpikeDecorator(4, BlockStateProvider.of(TRContent.RUBBER_LEAVES.getDefaultState()))
|
||||
)).build()
|
||||
)
|
||||
}
|
||||
|
||||
private static PlacedFeature createRubberTreePlacedFeature(RegistryEntryLookup<ConfiguredFeature> lookup) {
|
||||
return new PlacedFeature(lookup.getOrThrow(WorldGenerator.RUBBER_TREE_FEATURE), List.of(
|
||||
PlacedFeatures.wouldSurvive(TRContent.RUBBER_SAPLING)
|
||||
))
|
||||
}
|
||||
|
||||
private static ConfiguredFeature createRubberPatchTreeConfiguredFeature(RegistryEntryLookup<PlacedFeature> lookup) {
|
||||
return new ConfiguredFeature<>(Feature.RANDOM_PATCH,
|
||||
ConfiguredFeatures.createRandomPatchFeatureConfig(
|
||||
6, lookup.getOrThrow(WorldGenerator.RUBBER_TREE_PLACED_FEATURE)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private static PlacedFeature createRubberTreePatchPlacedFeature(RegistryEntryLookup<ConfiguredFeature> lookup) {
|
||||
return new PlacedFeature(
|
||||
lookup.getOrThrow(WorldGenerator.RUBBER_TREE_PATCH_FEATURE),
|
||||
List.of(
|
||||
RarityFilterPlacementModifier.of(3),
|
||||
SquarePlacementModifier.of(),
|
||||
PlacedFeatures.MOTION_BLOCKING_HEIGHTMAP,
|
||||
BiomePlacementModifier.of()
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package techreborn.datagen.worldgen
|
||||
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
|
||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricDynamicRegistryProvider
|
||||
import net.minecraft.registry.RegistryKeys
|
||||
import net.minecraft.registry.RegistryWrapper
|
||||
|
||||
import java.util.concurrent.CompletableFuture
|
||||
|
||||
class TRWorldGenProvider extends FabricDynamicRegistryProvider {
|
||||
TRWorldGenProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||
super(output, registriesFuture)
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure(RegistryWrapper.WrapperLookup registries, Entries entries) {
|
||||
entries.addAll(registries.getWrapperOrThrow(RegistryKeys.CONFIGURED_FEATURE))
|
||||
entries.addAll(registries.getWrapperOrThrow(RegistryKeys.PLACED_FEATURE))
|
||||
}
|
||||
|
||||
@Override
|
||||
String getName() {
|
||||
return "TechReborn World gen"
|
||||
}
|
||||
}
|
|
@ -26,7 +26,7 @@ package techreborn
|
|||
|
||||
import net.minecraft.Bootstrap
|
||||
import net.minecraft.SharedConstants
|
||||
import net.minecraft.util.registry.BuiltinRegistries
|
||||
import net.minecraft.registry.BuiltinRegistries
|
||||
import net.minecraft.world.EmptyBlockView
|
||||
import net.minecraft.world.gen.HeightContext
|
||||
import net.minecraft.world.gen.chunk.DebugChunkGenerator
|
||||
|
|
|
@ -25,12 +25,9 @@
|
|||
package techreborn;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
|
||||
import net.minecraft.block.ComposterBlock;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import reborncore.common.blockentity.RedstoneConfiguration;
|
||||
|
@ -42,7 +39,15 @@ import techreborn.config.TechRebornConfig;
|
|||
import techreborn.events.ApplyArmorToDamageHandler;
|
||||
import techreborn.events.OreDepthSyncHandler;
|
||||
import techreborn.events.UseBlockHandler;
|
||||
import techreborn.init.*;
|
||||
import techreborn.init.FluidGeneratorRecipes;
|
||||
import techreborn.init.FuelRecipes;
|
||||
import techreborn.init.ModLoot;
|
||||
import techreborn.init.ModRecipes;
|
||||
import techreborn.init.ModSounds;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.init.TRCauldronBehavior;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.init.TRDispenserBehavior;
|
||||
import techreborn.init.template.TechRebornTemplates;
|
||||
import techreborn.items.DynamicCellItem;
|
||||
import techreborn.packets.ServerboundPackets;
|
||||
|
@ -55,10 +60,6 @@ public class TechReborn implements ModInitializer {
|
|||
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
|
||||
public static TechReborn INSTANCE;
|
||||
|
||||
public static ItemGroup ITEMGROUP = FabricItemGroupBuilder.build(
|
||||
new Identifier("techreborn", "item_group"),
|
||||
() -> new ItemStack(TRContent.NUKE));
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
INSTANCE = this;
|
||||
|
|
|
@ -30,13 +30,14 @@ import net.minecraft.block.entity.BlockEntity;
|
|||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.screen.ScreenHandler;
|
||||
import net.minecraft.screen.ScreenHandlerType;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.world.World;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import reborncore.api.blockentity.IMachineGuiHandler;
|
||||
|
@ -142,7 +143,7 @@ public final class GuiType<T extends BlockEntity> implements IMachineGuiHandler
|
|||
|
||||
private GuiType(Identifier identifier) {
|
||||
this.identifier = identifier;
|
||||
this.screenHandlerType = Registry.register(Registry.SCREEN_HANDLER, identifier, new ExtendedScreenHandlerType<>(getScreenHandlerFactory()));
|
||||
this.screenHandlerType = Registry.register(Registries.SCREEN_HANDLER, identifier, new ExtendedScreenHandlerType<>(getScreenHandlerFactory()));
|
||||
|
||||
TYPES.put(identifier, this);
|
||||
}
|
||||
|
|
|
@ -35,6 +35,9 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.NbtHelper;
|
||||
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.registry.RegistryWrapper;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
|
@ -48,6 +51,7 @@ import reborncore.common.network.ClientBoundPackets;
|
|||
import reborncore.common.network.NetworkManager;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import reborncore.common.util.WorldUtils;
|
||||
import team.reborn.energy.api.EnergyStorage;
|
||||
import team.reborn.energy.api.base.SimpleSidedEnergyContainer;
|
||||
import techreborn.blocks.cable.CableBlock;
|
||||
|
@ -232,7 +236,7 @@ public class CableBlockEntity extends BlockEntity
|
|||
energyContainer.amount = compound.getLong("energy");
|
||||
}
|
||||
if (compound.contains("cover")) {
|
||||
cover = NbtHelper.toBlockState(compound.getCompound("cover"));
|
||||
cover = NbtHelper.toBlockState(WorldUtils.getBlockRegistryWrapper(world), compound.getCompound("cover"));
|
||||
} else {
|
||||
cover = null;
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ public class IronAlloyFurnaceBlockEntity extends AbstractIronMachineBlockEntity
|
|||
return false;
|
||||
if (inventory.getStack(OUTPUT_SLOT).isEmpty())
|
||||
return true;
|
||||
if (!inventory.getStack(OUTPUT_SLOT).isItemEqualIgnoreDamage(itemstack))
|
||||
if (!inventory.getStack(OUTPUT_SLOT).isItemEqual(itemstack))
|
||||
return false;
|
||||
int result = inventory.getStack(OUTPUT_SLOT).getCount() + itemstack.getCount();
|
||||
return result <= inventory.getStackLimit() && result <= inventory.getStack(OUTPUT_SLOT).getMaxCount();
|
||||
|
|
|
@ -98,7 +98,7 @@ 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){
|
||||
if (previousStack.isItemEqual(stack) && !previousValid){
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ public class IronFurnaceBlockEntity extends AbstractIronMachineBlockEntity imple
|
|||
|
||||
if (inventory.getStack(OUTPUT_SLOT).isEmpty()) {
|
||||
inventory.setStack(OUTPUT_SLOT, resultStack.copy());
|
||||
} else if (inventory.getStack(OUTPUT_SLOT).isItemEqualIgnoreDamage(resultStack)) {
|
||||
} else if (inventory.getStack(OUTPUT_SLOT).isItemEqual(resultStack)) {
|
||||
inventory.getStack(OUTPUT_SLOT).increment(resultStack.getCount());
|
||||
}
|
||||
experience += getExperienceFor();
|
||||
|
@ -158,7 +158,7 @@ public class IronFurnaceBlockEntity extends AbstractIronMachineBlockEntity imple
|
|||
ItemStack outputSlotStack = inventory.getStack(OUTPUT_SLOT);
|
||||
if (outputSlotStack.isEmpty())
|
||||
return true;
|
||||
if (!outputSlotStack.isItemEqualIgnoreDamage(outputStack))
|
||||
if (!outputSlotStack.isItemEqual(outputStack))
|
||||
return false;
|
||||
int result = outputSlotStack.getCount() + outputStack.getCount();
|
||||
return result <= inventory.getStackLimit() && result <= outputStack.getMaxCount();
|
||||
|
|
|
@ -115,7 +115,7 @@ public class FluidReplicatorBlockEntity extends GenericMachineBlockEntity implem
|
|||
private static IInventoryAccess<FluidReplicatorBlockEntity> getInventoryAccess() {
|
||||
return (slotID, stack, face, direction, blockEntity) -> {
|
||||
if (slotID == 0) {
|
||||
return stack.isItemEqualIgnoreDamage(TRContent.Parts.UU_MATTER.getStack());
|
||||
return stack.isItemEqual(TRContent.Parts.UU_MATTER.getStack());
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
@ -132,7 +132,7 @@ public class FluidReplicatorBlockEntity extends GenericMachineBlockEntity implem
|
|||
@Override
|
||||
public BuiltScreenHandler createScreenHandler(int syncID, PlayerEntity player) {
|
||||
return new ScreenHandlerBuilder("fluidreplicator").player(player.getInventory()).inventory().hotbar().addInventory()
|
||||
.blockEntity(this).fluidSlot(1, 124, 35).filterSlot(0, 55, 45, stack -> stack.isItemEqualIgnoreDamage(TRContent.Parts.UU_MATTER.getStack()))
|
||||
.blockEntity(this).fluidSlot(1, 124, 35).filterSlot(0, 55, 45, stack -> stack.isItemEqual(TRContent.Parts.UU_MATTER.getStack()))
|
||||
.outputSlot(2, 124, 55).energySlot(3, 8, 72).sync(tank).syncEnergyValue().syncCrafterValue().addInventory()
|
||||
.create(this, syncID);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.item.Items;
|
|||
import net.minecraft.loot.context.LootContext;
|
||||
import net.minecraft.loot.context.LootContextParameters;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.tag.BlockTags;
|
||||
import net.minecraft.registry.tag.BlockTags;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
|
|
@ -125,7 +125,7 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
|
|||
if (inventoryCrafting == null) {
|
||||
inventoryCrafting = new CraftingInventory(new ScreenHandler(null, -1) {
|
||||
@Override
|
||||
public ItemStack transferSlot(PlayerEntity player, int index) {
|
||||
public ItemStack quickMove(PlayerEntity player, int index) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,9 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registry;
|
||||
import reborncore.api.blockentity.IUpgrade;
|
||||
import reborncore.common.screen.BuiltScreenHandler;
|
||||
import reborncore.common.screen.BuiltScreenHandlerProvider;
|
||||
|
@ -56,7 +57,7 @@ public class RecyclerBlockEntity extends GenericMachineBlockEntity implements Bu
|
|||
if ((item instanceof IUpgrade)) {
|
||||
return false;
|
||||
}
|
||||
return !TechRebornConfig.recyclerBlackList.contains(Registry.ITEM.getId(item).toString());
|
||||
return !TechRebornConfig.recyclerBlackList.contains(Registries.ITEM.getId(item).toString());
|
||||
}
|
||||
|
||||
// BuiltScreenHandlerProvider
|
||||
|
|
|
@ -433,7 +433,7 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferSlot(PlayerEntity player, int index) {
|
||||
public ItemStack quickMove(PlayerEntity player, int slot) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ public class MatterFabricatorBlockEntity extends PowerAcceptorBlockEntity
|
|||
}
|
||||
|
||||
public int getValue(ItemStack itemStack) {
|
||||
if (itemStack.isItemEqualIgnoreDamage(TRContent.Parts.SCRAP.getStack())) {
|
||||
if (itemStack.isItemEqual(TRContent.Parts.SCRAP.getStack())) {
|
||||
return 200;
|
||||
} else if (itemStack.getItem() == TRContent.SCRAP_BOX) {
|
||||
return 2000;
|
||||
|
|
|
@ -155,7 +155,7 @@ public class AdjustableSUBlockEntity extends EnergyStorageBlockEntity implements
|
|||
// MachineBaseBlockEntity
|
||||
@Override
|
||||
public boolean isUpgradeValid(IUpgrade upgrade, ItemStack stack) {
|
||||
return stack.isItemEqual(new ItemStack(TRContent.Upgrades.SUPERCONDUCTOR.item));
|
||||
return stack.isOf(TRContent.Upgrades.SUPERCONDUCTOR.item);
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
|
|
|
@ -181,7 +181,7 @@ public class CableBlock extends BlockWithEntity implements Waterloggable {
|
|||
public BlockState getStateForNeighborUpdate(BlockState ourState, Direction direction, BlockState otherState,
|
||||
WorldAccess worldIn, BlockPos ourPos, BlockPos otherPos) {
|
||||
if (ourState.get(WATERLOGGED)) {
|
||||
worldIn.createAndScheduleFluidTick(ourPos, Fluids.WATER, Fluids.WATER.getTickRate(worldIn));
|
||||
worldIn.scheduleFluidTick(ourPos, Fluids.WATER, Fluids.WATER.getTickRate(worldIn));
|
||||
}
|
||||
return ourState;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ import net.minecraft.state.StateManager;
|
|||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.state.property.DirectionProperty;
|
||||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.tag.BlockTags;
|
||||
import net.minecraft.registry.tag.BlockTags;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
|
|
|
@ -24,15 +24,16 @@
|
|||
|
||||
package techreborn.blocks.misc;
|
||||
|
||||
import net.minecraft.block.WoodenButtonBlock;
|
||||
import net.minecraft.block.ButtonBlock;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
/**
|
||||
* @author drcrazy
|
||||
*/
|
||||
public class RubberButtonBlock extends WoodenButtonBlock {
|
||||
public class RubberButtonBlock extends ButtonBlock {
|
||||
|
||||
public RubberButtonBlock() {
|
||||
super(InitUtils.setupRubberBlockSettings(true, 0.5F, 0.5F));
|
||||
super(InitUtils.setupRubberBlockSettings(true, 0.5F, 0.5F), 30, true, SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_OFF, SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_ON);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
package techreborn.blocks.misc;
|
||||
|
||||
import net.minecraft.block.DoorBlock;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
/**
|
||||
|
@ -33,6 +34,6 @@ import techreborn.utils.InitUtils;
|
|||
public class RubberDoorBlock extends DoorBlock {
|
||||
|
||||
public RubberDoorBlock() {
|
||||
super(InitUtils.setupRubberBlockSettings(3.0F, 3.0F));
|
||||
super(InitUtils.setupRubberBlockSettings(3.0F, 3.0F), SoundEvents.BLOCK_NETHER_WOOD_TRAPDOOR_CLOSE, SoundEvents.BLOCK_NETHER_WOOD_TRAPDOOR_OPEN);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
package techreborn.blocks.misc;
|
||||
|
||||
import net.minecraft.block.PressurePlateBlock;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
/**
|
||||
|
@ -33,7 +34,7 @@ import techreborn.utils.InitUtils;
|
|||
public class RubberPressurePlateBlock extends PressurePlateBlock {
|
||||
|
||||
public RubberPressurePlateBlock() {
|
||||
super(PressurePlateBlock.ActivationRule.EVERYTHING, InitUtils.setupRubberBlockSettings(true, 0.5F, 0.5F));
|
||||
super(PressurePlateBlock.ActivationRule.EVERYTHING, InitUtils.setupRubberBlockSettings(true, 0.5F, 0.5F), SoundEvents.BLOCK_NETHER_WOOD_PRESSURE_PLATE_CLICK_OFF, SoundEvents.BLOCK_NETHER_WOOD_PRESSURE_PLATE_CLICK_ON);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
package techreborn.blocks.misc;
|
||||
|
||||
import net.minecraft.block.TrapdoorBlock;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
/**
|
||||
|
@ -33,6 +34,6 @@ import techreborn.utils.InitUtils;
|
|||
public class RubberTrapdoorBlock extends TrapdoorBlock {
|
||||
|
||||
public RubberTrapdoorBlock() {
|
||||
super(InitUtils.setupRubberBlockSettings(3.0F, 3.0F));
|
||||
super(InitUtils.setupRubberBlockSettings(3.0F, 3.0F), SoundEvents.BLOCK_WOODEN_TRAPDOOR_CLOSE, SoundEvents.BLOCK_WOODEN_TRAPDOOR_OPEN);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -694,4 +694,10 @@ public class TechRebornConfig {
|
|||
|
||||
@Config(config = "world", category = "generation", key = "enableOilLakeGeneration", comment = "When enabled oil lakes will generate in the world")
|
||||
public static boolean enableOilLakeGeneration = true;
|
||||
|
||||
@Config(config = "world", category = "generation", key = "enableMetallurgistGeneration", comment = "When enabled metallurgist houses can generate in villages")
|
||||
public static boolean enableMetallurgistGeneration = true;
|
||||
|
||||
@Config(config = "world", category = "generation", key = "enableElectricianGeneration", comment = "When enabled electrician houses can generate in villages")
|
||||
public static boolean enableElectricianGeneration = true;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.Item.Settings;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import reborncore.RebornRegistry;
|
||||
import reborncore.common.powerSystem.RcEnergyTier;
|
||||
import team.reborn.energy.api.EnergyStorage;
|
||||
|
@ -72,10 +73,11 @@ public class ModRegistry {
|
|||
registerApis();
|
||||
TRVillager.registerVillagerTrades();
|
||||
TRVillager.registerWanderingTraderTrades();
|
||||
TRVillager.registerVillagerHouses();
|
||||
}
|
||||
|
||||
private static void registerBlocks() {
|
||||
Settings itemGroup = new Item.Settings().group(TechReborn.ITEMGROUP);
|
||||
Settings itemGroup = new Item.Settings();
|
||||
Arrays.stream(Ores.values()).forEach(value -> RebornRegistry.registerBlock(value.block, itemGroup));
|
||||
StorageBlocks.blockStream().forEach(block -> RebornRegistry.registerBlock(block, itemGroup));
|
||||
Arrays.stream(MachineBlocks.values()).forEach(value -> {
|
||||
|
@ -103,7 +105,7 @@ public class ModRegistry {
|
|||
RebornRegistry.registerBlock(TRContent.RUBBER_SAPLING = InitUtils.setup(new BlockRubberSapling(), "rubber_sapling"), itemGroup);
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_SLAB = InitUtils.setup(new SlabBlock(InitUtils.setupRubberBlockSettings(2.0F, 15.0F)), "rubber_slab"), itemGroup);
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_FENCE = InitUtils.setup(new FenceBlock(InitUtils.setupRubberBlockSettings(2.0F, 15.0F)), "rubber_fence"), itemGroup);
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_FENCE_GATE = InitUtils.setup(new FenceGateBlock(InitUtils.setupRubberBlockSettings(2.0F, 15.0F)), "rubber_fence_gate"), itemGroup);
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_FENCE_GATE = InitUtils.setup(new FenceGateBlock(InitUtils.setupRubberBlockSettings(2.0F, 15.0F), SoundEvents.BLOCK_FENCE_GATE_CLOSE, SoundEvents.BLOCK_FENCE_GATE_OPEN), "rubber_fence_gate"), itemGroup);
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_STAIR = InitUtils.setup(new BlockRubberPlankStair(), "rubber_stair"), itemGroup);
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_TRAPDOOR = InitUtils.setup(new RubberTrapdoorBlock(), "rubber_trapdoor"), itemGroup);
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_BUTTON = InitUtils.setup(new RubberButtonBlock(), "rubber_button"), itemGroup);
|
||||
|
|
|
@ -26,7 +26,7 @@ package techreborn.events;
|
|||
|
||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
import reborncore.common.network.NetworkManager;
|
||||
import techreborn.packets.ClientboundPackets;
|
||||
import techreborn.world.OreDepth;
|
||||
|
@ -52,7 +52,7 @@ public final class OreDepthSyncHandler {
|
|||
public static void updateDepths(List<OreDepth> list) {
|
||||
synchronized (OreDepthSyncHandler.class) {
|
||||
oreDepthMap = list.stream()
|
||||
.collect(Collectors.toMap(oreDepth -> Registry.BLOCK.get(oreDepth.identifier()), Function.identity()));
|
||||
.collect(Collectors.toMap(oreDepth -> Registries.BLOCK.get(oreDepth.identifier()), Function.identity()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,15 +28,17 @@ package techreborn.init;
|
|||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemConvertible;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registry;
|
||||
import reborncore.common.fluid.*;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public enum ModFluids {
|
||||
public enum ModFluids implements ItemConvertible {
|
||||
BERYLLIUM,
|
||||
CALCIUM,
|
||||
CALCIUM_CARBONATE,
|
||||
|
@ -97,15 +99,15 @@ public enum ModFluids {
|
|||
};
|
||||
|
||||
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));
|
||||
bucket = new RebornBucketItem(stillFluid, new Item.Settings().recipeRemainder(Items.BUCKET).maxCount(1));
|
||||
}
|
||||
|
||||
public void register() {
|
||||
RebornFluidManager.register(stillFluid, identifier);
|
||||
RebornFluidManager.register(flowingFluid, new Identifier(TechReborn.MOD_ID, identifier.getPath() + "_flowing"));
|
||||
|
||||
Registry.register(Registry.BLOCK, identifier, block);
|
||||
Registry.register(Registry.ITEM, new Identifier(TechReborn.MOD_ID, identifier.getPath() + "_bucket"), bucket);
|
||||
Registry.register(Registries.BLOCK, identifier, block);
|
||||
Registry.register(Registries.ITEM, new Identifier(TechReborn.MOD_ID, identifier.getPath() + "_bucket"), bucket);
|
||||
}
|
||||
|
||||
public RebornFluid getFluid() {
|
||||
|
@ -127,4 +129,9 @@ public enum ModFluids {
|
|||
public RebornBucketItem getBucket() {
|
||||
return bucket;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item asItem() {
|
||||
return getBucket();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,14 +24,21 @@
|
|||
|
||||
package techreborn.init;
|
||||
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import reborncore.common.crafting.RebornRecipe;
|
||||
import reborncore.common.crafting.RebornRecipeType;
|
||||
import reborncore.common.crafting.RecipeManager;
|
||||
import reborncore.common.crafting.serde.RebornFluidRecipeSerde;
|
||||
import reborncore.common.crafting.serde.RebornRecipeSerde;
|
||||
import techreborn.api.recipe.recipes.*;
|
||||
import techreborn.api.recipe.recipes.AssemblingMachineRecipe;
|
||||
import techreborn.api.recipe.recipes.BlastFurnaceRecipe;
|
||||
import techreborn.api.recipe.recipes.CentrifugeRecipe;
|
||||
import techreborn.api.recipe.recipes.FluidReplicatorRecipe;
|
||||
import techreborn.api.recipe.recipes.FusionReactorRecipe;
|
||||
import techreborn.api.recipe.recipes.IndustrialGrinderRecipe;
|
||||
import techreborn.api.recipe.recipes.IndustrialSawmillRecipe;
|
||||
import techreborn.api.recipe.recipes.RollingMachineRecipe;
|
||||
import techreborn.api.recipe.recipes.serde.BlastFurnaceRecipeSerde;
|
||||
import techreborn.api.recipe.recipes.serde.FusionReactorRecipeSerde;
|
||||
import techreborn.api.recipe.recipes.serde.RollingMachineRecipeSerde;
|
||||
|
@ -69,6 +76,6 @@ public class ModRecipes {
|
|||
public static final RebornRecipeType<RebornRecipe> WIRE_MILL = RecipeManager.newRecipeType(new Identifier("techreborn:wire_mill"));
|
||||
|
||||
public static RebornRecipeType<?> byName(Identifier identifier) {
|
||||
return (RebornRecipeType<?>) Registry.RECIPE_SERIALIZER.get(identifier);
|
||||
return (RebornRecipeType<?>) Registries.RECIPE_SERIALIZER.get(identifier);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,9 +30,10 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.item.ItemConvertible;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registry;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.blockentity.cable.CableBlockEntity;
|
||||
|
@ -158,7 +159,7 @@ public class TRBlockEntities {
|
|||
|
||||
public static <T extends BlockEntity> BlockEntityType<T> register(String id, FabricBlockEntityTypeBuilder<T> builder) {
|
||||
BlockEntityType<T> blockEntityType = builder.build(null);
|
||||
Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(id), blockEntityType);
|
||||
Registry.register(Registries.BLOCK_ENTITY_TYPE, new Identifier(id), blockEntityType);
|
||||
TRBlockEntities.TYPES.add(blockEntityType);
|
||||
return blockEntityType;
|
||||
}
|
||||
|
|
|
@ -26,18 +26,23 @@ package techreborn.init;
|
|||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.ExperienceDroppingBlock;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.SlabBlock;
|
||||
import net.minecraft.block.StairsBlock;
|
||||
import net.minecraft.block.WallBlock;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemConvertible;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.registry.tag.TagKey;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.tag.TagKey;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.Pair;
|
||||
import net.minecraft.util.math.intprovider.UniformIntProvider;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Marker;
|
||||
|
@ -51,16 +56,42 @@ import techreborn.TechReborn;
|
|||
import techreborn.blockentity.GuiType;
|
||||
import techreborn.blockentity.generator.LightningRodBlockEntity;
|
||||
import techreborn.blockentity.generator.PlasmaGeneratorBlockEntity;
|
||||
import techreborn.blockentity.generator.advanced.*;
|
||||
import techreborn.blockentity.generator.advanced.DieselGeneratorBlockEntity;
|
||||
import techreborn.blockentity.generator.advanced.DragonEggSyphonBlockEntity;
|
||||
import techreborn.blockentity.generator.advanced.GasTurbineBlockEntity;
|
||||
import techreborn.blockentity.generator.advanced.SemiFluidGeneratorBlockEntity;
|
||||
import techreborn.blockentity.generator.advanced.ThermalGeneratorBlockEntity;
|
||||
import techreborn.blockentity.generator.basic.SolidFuelGeneratorBlockEntity;
|
||||
import techreborn.blockentity.generator.basic.WaterMillBlockEntity;
|
||||
import techreborn.blockentity.generator.basic.WindMillBlockEntity;
|
||||
import techreborn.blockentity.machine.misc.ChargeOMatBlockEntity;
|
||||
import techreborn.blockentity.machine.misc.DrainBlockEntity;
|
||||
import techreborn.blockentity.machine.multiblock.*;
|
||||
import techreborn.blockentity.machine.multiblock.DistillationTowerBlockEntity;
|
||||
import techreborn.blockentity.machine.multiblock.FluidReplicatorBlockEntity;
|
||||
import techreborn.blockentity.machine.multiblock.ImplosionCompressorBlockEntity;
|
||||
import techreborn.blockentity.machine.multiblock.IndustrialBlastFurnaceBlockEntity;
|
||||
import techreborn.blockentity.machine.multiblock.IndustrialGrinderBlockEntity;
|
||||
import techreborn.blockentity.machine.multiblock.IndustrialSawmillBlockEntity;
|
||||
import techreborn.blockentity.machine.multiblock.VacuumFreezerBlockEntity;
|
||||
import techreborn.blockentity.machine.tier0.block.BlockBreakerBlockEntity;
|
||||
import techreborn.blockentity.machine.tier0.block.BlockPlacerBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.*;
|
||||
import techreborn.blockentity.machine.tier1.AlloySmelterBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.AssemblingMachineBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.AutoCraftingTableBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.ChemicalReactorBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.CompressorBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.ElectricFurnaceBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.ElevatorBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.ExtractorBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.GreenhouseControllerBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.GrinderBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.IndustrialElectrolyzerBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.RecyclerBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.ResinBasinBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.RollingMachineBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.ScrapboxinatorBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.SolidCanningMachineBlockEntity;
|
||||
import techreborn.blockentity.machine.tier1.WireMillBlockEntity;
|
||||
import techreborn.blockentity.machine.tier2.LaunchpadBlockEntity;
|
||||
import techreborn.blockentity.machine.tier3.ChunkLoaderBlockEntity;
|
||||
import techreborn.blockentity.machine.tier3.IndustrialCentrifugeBlockEntity;
|
||||
|
@ -77,8 +108,18 @@ import techreborn.blocks.machine.tier0.IronAlloyFurnaceBlock;
|
|||
import techreborn.blocks.machine.tier0.IronFurnaceBlock;
|
||||
import techreborn.blocks.machine.tier1.PlayerDetectorBlock;
|
||||
import techreborn.blocks.machine.tier1.ResinBasinBlock;
|
||||
import techreborn.blocks.misc.*;
|
||||
import techreborn.blocks.storage.energy.*;
|
||||
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.storage.energy.AdjustableSUBlock;
|
||||
import techreborn.blocks.storage.energy.HighVoltageSUBlock;
|
||||
import techreborn.blocks.storage.energy.InterdimensionalSUBlock;
|
||||
import techreborn.blocks.storage.energy.LSUStorageBlock;
|
||||
import techreborn.blocks.storage.energy.LapotronicSUBlock;
|
||||
import techreborn.blocks.storage.energy.LowVoltageSUBlock;
|
||||
import techreborn.blocks.storage.energy.MediumVoltageSUBlock;
|
||||
import techreborn.blocks.storage.fluid.TankUnitBlock;
|
||||
import techreborn.blocks.storage.item.StorageUnitBlock;
|
||||
import techreborn.blocks.transformers.BlockEVTransformer;
|
||||
|
@ -95,7 +136,14 @@ import techreborn.items.armor.QuantumSuitItem;
|
|||
import techreborn.utils.InitUtils;
|
||||
import techreborn.world.OreDistribution;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
@ -266,27 +314,27 @@ public class TRContent {
|
|||
public static Item STEEL_BOOTS;
|
||||
|
||||
public final static class BlockTags {
|
||||
public static final TagKey<Block> RUBBER_LOGS = TagKey.of(Registry.BLOCK_KEY, new Identifier(TechReborn.MOD_ID, "rubber_logs"));
|
||||
public static final TagKey<Block> OMNI_TOOL_MINEABLE = TagKey.of(Registry.BLOCK_KEY, new Identifier(TechReborn.MOD_ID, "mineable/omni_tool"));
|
||||
public static final TagKey<Block> DRILL_MINEABLE = TagKey.of(Registry.BLOCK_KEY, new Identifier(TechReborn.MOD_ID, "mineable/drill"));
|
||||
public static final TagKey<Block> NONE_SOLID_COVERS = TagKey.of(Registry.BLOCK_KEY, new Identifier(TechReborn.MOD_ID, "none_solid_covers"));
|
||||
public static final TagKey<Block> RUBBER_LOGS = TagKey.of(RegistryKeys.BLOCK, new Identifier(TechReborn.MOD_ID, "rubber_logs"));
|
||||
public static final TagKey<Block> OMNI_TOOL_MINEABLE = TagKey.of(RegistryKeys.BLOCK, new Identifier(TechReborn.MOD_ID, "mineable/omni_tool"));
|
||||
public static final TagKey<Block> DRILL_MINEABLE = TagKey.of(RegistryKeys.BLOCK, new Identifier(TechReborn.MOD_ID, "mineable/drill"));
|
||||
public static final TagKey<Block> NONE_SOLID_COVERS = TagKey.of(RegistryKeys.BLOCK, new Identifier(TechReborn.MOD_ID, "none_solid_covers"));
|
||||
|
||||
private BlockTags() {
|
||||
}
|
||||
}
|
||||
|
||||
public final static class ItemTags {
|
||||
public static final TagKey<Item> RUBBER_LOGS = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "rubber_logs"));
|
||||
public static final TagKey<Item> INGOTS = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "ingots"));
|
||||
public static final TagKey<Item> ORES = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "ores"));
|
||||
public static final TagKey<Item> STORAGE_BLOCK = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "storage_blocks"));
|
||||
public static final TagKey<Item> DUSTS = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "dusts"));
|
||||
public static final TagKey<Item> RAW_METALS = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "raw_metals"));
|
||||
public static final TagKey<Item> SMALL_DUSTS = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "small_dusts"));
|
||||
public static final TagKey<Item> GEMS = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "gems"));
|
||||
public static final TagKey<Item> NUGGETS = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "nuggets"));
|
||||
public static final TagKey<Item> PLATES = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "plates"));
|
||||
public static final TagKey<Item> STORAGE_UNITS = TagKey.of(Registry.ITEM_KEY, new Identifier(TechReborn.MOD_ID, "storage_units"));
|
||||
public static final TagKey<Item> RUBBER_LOGS = TagKey.of(RegistryKeys.ITEM, new Identifier(TechReborn.MOD_ID, "rubber_logs"));
|
||||
public static final TagKey<Item> INGOTS = TagKey.of(RegistryKeys.ITEM, new Identifier(TechReborn.MOD_ID, "ingots"));
|
||||
public static final TagKey<Item> ORES = TagKey.of(RegistryKeys.ITEM, new Identifier(TechReborn.MOD_ID, "ores"));
|
||||
public static final TagKey<Item> STORAGE_BLOCK = TagKey.of(RegistryKeys.ITEM, new Identifier(TechReborn.MOD_ID, "storage_blocks"));
|
||||
public static final TagKey<Item> DUSTS = TagKey.of(RegistryKeys.ITEM, new Identifier(TechReborn.MOD_ID, "dusts"));
|
||||
public static final TagKey<Item> RAW_METALS = TagKey.of(RegistryKeys.ITEM, new Identifier(TechReborn.MOD_ID, "raw_metals"));
|
||||
public static final TagKey<Item> SMALL_DUSTS = TagKey.of(RegistryKeys.ITEM, new Identifier(TechReborn.MOD_ID, "small_dusts"));
|
||||
public static final TagKey<Item> GEMS = TagKey.of(RegistryKeys.ITEM, new Identifier(TechReborn.MOD_ID, "gems"));
|
||||
public static final TagKey<Item> NUGGETS = TagKey.of(RegistryKeys.ITEM, new Identifier(TechReborn.MOD_ID, "nuggets"));
|
||||
public static final TagKey<Item> PLATES = TagKey.of(RegistryKeys.ITEM, new Identifier(TechReborn.MOD_ID, "plates"));
|
||||
public static final TagKey<Item> STORAGE_UNITS = TagKey.of(RegistryKeys.ITEM, new Identifier(TechReborn.MOD_ID, "storage_units"));
|
||||
|
||||
private ItemTags() {
|
||||
}
|
||||
|
@ -530,7 +578,7 @@ public class TRContent {
|
|||
|
||||
Ores(OreDistribution distribution, UniformIntProvider experienceDroppedFallback, boolean industrial) {
|
||||
name = this.toString().toLowerCase(Locale.ROOT);
|
||||
block = new OreBlock(FabricBlockSettings.of(Material.STONE)
|
||||
block = new ExperienceDroppingBlock(FabricBlockSettings.of(Material.STONE)
|
||||
.requiresTool()
|
||||
.sounds(name.startsWith("deepslate") ? BlockSoundGroup.DEEPSLATE : BlockSoundGroup.STONE)
|
||||
.hardness(name.startsWith("deepslate") ? 4.5f : 3f)
|
||||
|
@ -539,7 +587,7 @@ public class TRContent {
|
|||
);
|
||||
this.industrial = industrial;
|
||||
InitUtils.setup(block, name + "_ore");
|
||||
tag = TagKey.of(Registry.ITEM_KEY, new Identifier("c",
|
||||
tag = TagKey.of(RegistryKeys.ITEM, new Identifier("c",
|
||||
(name.startsWith("deepslate_") ? name.substring(name.indexOf('_')+1): name) + "_ores"));
|
||||
this.distribution = distribution;
|
||||
}
|
||||
|
@ -642,7 +690,7 @@ public class TRContent {
|
|||
name = this.toString().toLowerCase(Locale.ROOT);
|
||||
block = new BlockStorage(isHot, hardness, resistance);
|
||||
InitUtils.setup(block, name + "_storage_block");
|
||||
tag = TagKey.of(Registry.ITEM_KEY, new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_blocks"));
|
||||
tag = TagKey.of(RegistryKeys.ITEM, new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_blocks"));
|
||||
|
||||
stairsBlock = new TechRebornStairsBlock(block.getDefaultState(), FabricBlockSettings.copyOf(block));
|
||||
InitUtils.setup(stairsBlock, name + "_storage_block_stairs");
|
||||
|
@ -835,9 +883,9 @@ public class TRContent {
|
|||
|
||||
Dusts(String tagNameBase) {
|
||||
name = this.toString().toLowerCase(Locale.ROOT);
|
||||
item = new Item(new Item.Settings().group(TechReborn.ITEMGROUP));
|
||||
item = new Item(new Item.Settings());
|
||||
InitUtils.setup(item, name + "_dust");
|
||||
tag = TagKey.of(Registry.ITEM_KEY, new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_dusts"));
|
||||
tag = TagKey.of(RegistryKeys.ITEM, new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_dusts"));
|
||||
}
|
||||
|
||||
Dusts() {
|
||||
|
@ -874,7 +922,7 @@ public class TRContent {
|
|||
|
||||
RawMetals() {
|
||||
name = this.toString().toLowerCase(Locale.ROOT);
|
||||
item = new Item(new Item.Settings().group(TechReborn.ITEMGROUP));
|
||||
item = new Item(new Item.Settings());
|
||||
Ores oreVariant = null;
|
||||
try {
|
||||
oreVariant = Ores.valueOf(this.toString());
|
||||
|
@ -894,7 +942,7 @@ public class TRContent {
|
|||
}
|
||||
storageBlock = blockVariant;
|
||||
InitUtils.setup(item, "raw_" + name);
|
||||
tag = TagKey.of(Registry.ITEM_KEY, new Identifier("c", "raw_" + name + "_ores"));
|
||||
tag = TagKey.of(RegistryKeys.ITEM, new Identifier("c", "raw_" + name + "_ores"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -955,7 +1003,7 @@ public class TRContent {
|
|||
|
||||
SmallDusts(String tagNameBase, ItemConvertible dustVariant) {
|
||||
name = this.toString().toLowerCase(Locale.ROOT);
|
||||
item = new Item(new Item.Settings().group(TechReborn.ITEMGROUP));
|
||||
item = new Item(new Item.Settings());
|
||||
if (dustVariant == null)
|
||||
try {
|
||||
dustVariant = Dusts.valueOf(this.toString());
|
||||
|
@ -966,7 +1014,7 @@ public class TRContent {
|
|||
}
|
||||
dust = dustVariant;
|
||||
InitUtils.setup(item, name + "_small_dust");
|
||||
tag = TagKey.of(Registry.ITEM_KEY, new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_small_dusts"));
|
||||
tag = TagKey.of(RegistryKeys.ITEM, new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_small_dusts"));
|
||||
}
|
||||
|
||||
SmallDusts(String tagNameBase) {
|
||||
|
@ -1031,7 +1079,7 @@ public class TRContent {
|
|||
|
||||
Gems(String tagPlural) {
|
||||
name = this.toString().toLowerCase(Locale.ROOT);
|
||||
item = new Item(new Item.Settings().group(TechReborn.ITEMGROUP));
|
||||
item = new Item(new Item.Settings());
|
||||
Dusts dustVariant = null;
|
||||
try {
|
||||
dustVariant = Dusts.valueOf(this.toString());
|
||||
|
@ -1059,7 +1107,7 @@ public class TRContent {
|
|||
}
|
||||
storageBlock = blockVariant;
|
||||
InitUtils.setup(item, name + "_gem");
|
||||
tag = TagKey.of(Registry.ITEM_KEY, new Identifier("c", tagPlural == null ? name + "_gems" : tagPlural));
|
||||
tag = TagKey.of(RegistryKeys.ITEM, new Identifier("c", tagPlural == null ? name + "_gems" : tagPlural));
|
||||
}
|
||||
|
||||
Gems() {
|
||||
|
@ -1134,7 +1182,7 @@ public class TRContent {
|
|||
|
||||
Ingots(String tagNameBase) {
|
||||
name = this.toString().toLowerCase(Locale.ROOT);
|
||||
item = new Item(new Item.Settings().group(TechReborn.ITEMGROUP));
|
||||
item = new Item(new Item.Settings());
|
||||
Dusts dustVariant = null;
|
||||
try {
|
||||
dustVariant = Dusts.valueOf(this.toString());
|
||||
|
@ -1161,7 +1209,7 @@ public class TRContent {
|
|||
}
|
||||
storageBlock = blockVariant;
|
||||
InitUtils.setup(item, name + "_ingot");
|
||||
tag = TagKey.of(Registry.ITEM_KEY, new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_ingots"));
|
||||
tag = TagKey.of(RegistryKeys.ITEM, new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_ingots"));
|
||||
}
|
||||
|
||||
Ingots() {
|
||||
|
@ -1233,7 +1281,7 @@ public class TRContent {
|
|||
|
||||
Nuggets(String tagNameBase, ItemConvertible ingotVariant, boolean ofGem) {
|
||||
name = this.toString().toLowerCase(Locale.ROOT);
|
||||
item = new Item(new Item.Settings().group(TechReborn.ITEMGROUP));
|
||||
item = new Item(new Item.Settings());
|
||||
if (ingotVariant == null)
|
||||
try {
|
||||
ingotVariant = Ingots.valueOf(this.toString());
|
||||
|
@ -1245,7 +1293,7 @@ public class TRContent {
|
|||
ingot = ingotVariant;
|
||||
this.ofGem = ofGem;
|
||||
InitUtils.setup(item, name + "_nugget");
|
||||
tag = TagKey.of(Registry.ITEM_KEY, new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_nuggets"));
|
||||
tag = TagKey.of(RegistryKeys.ITEM, new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_nuggets"));
|
||||
}
|
||||
|
||||
Nuggets(ItemConvertible ingotVariant, boolean ofGem) {
|
||||
|
@ -1358,7 +1406,7 @@ public class TRContent {
|
|||
|
||||
Parts() {
|
||||
name = this.toString().toLowerCase(Locale.ROOT);
|
||||
item = new Item(new Item.Settings().group(TechReborn.ITEMGROUP));
|
||||
item = new Item(new Item.Settings());
|
||||
InitUtils.setup(item, name);
|
||||
}
|
||||
|
||||
|
@ -1427,7 +1475,7 @@ public class TRContent {
|
|||
|
||||
Plates(ItemConvertible source, ItemConvertible sourceBlock, boolean industrial, String tagNameBase) {
|
||||
name = this.toString().toLowerCase(Locale.ROOT);
|
||||
item = new Item(new Item.Settings().group(TechReborn.ITEMGROUP));
|
||||
item = new Item(new Item.Settings());
|
||||
ItemConvertible sourceVariant = null;
|
||||
if (source != null) {
|
||||
sourceVariant = source;
|
||||
|
@ -1471,7 +1519,7 @@ public class TRContent {
|
|||
tagNameBase = name;
|
||||
}
|
||||
|
||||
tag = TagKey.of(Registry.ITEM_KEY, new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_plates"));
|
||||
tag = TagKey.of(RegistryKeys.ITEM, new Identifier("c", Objects.requireNonNullElse(tagNameBase, name) + "_plates"));
|
||||
}
|
||||
|
||||
Plates(String tagNameBase) {
|
||||
|
@ -1590,5 +1638,6 @@ public class TRContent {
|
|||
|
||||
static {
|
||||
ModRegistry.register();
|
||||
TRItemGroup.ITEM_GROUP.getId();
|
||||
}
|
||||
}
|
||||
|
|
826
src/main/java/techreborn/init/TRItemGroup.java
Normal file
826
src/main/java/techreborn/init/TRItemGroup.java
Normal file
|
@ -0,0 +1,826 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2020 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.init;
|
||||
|
||||
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
|
||||
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroupEntries;
|
||||
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
|
||||
import net.minecraft.enchantment.Enchantments;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.util.Identifier;
|
||||
import reborncore.common.fluid.FluidUtils;
|
||||
import reborncore.common.powerSystem.RcEnergyItem;
|
||||
import techreborn.items.DynamicCellItem;
|
||||
import techreborn.items.tool.basic.RockCutterItem;
|
||||
import techreborn.items.tool.industrial.NanosaberItem;
|
||||
import techreborn.utils.MaterialComparator;
|
||||
import techreborn.utils.MaterialTypeComparator;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class TRItemGroup {
|
||||
public static final ItemGroup ITEM_GROUP = FabricItemGroup.builder(new Identifier("techreborn", "item_group"))
|
||||
.icon(() -> new ItemStack(TRContent.NUKE))
|
||||
.build();
|
||||
|
||||
static {
|
||||
ItemGroupEvents.modifyEntriesEvent(ITEM_GROUP).register(TRItemGroup::entries);
|
||||
ItemGroupEvents.modifyEntriesEvent(ItemGroups.BUILDING_BLOCKS).register(TRItemGroup::addBuildingBlocks);
|
||||
ItemGroupEvents.modifyEntriesEvent(ItemGroups.COLORED_BLOCKS).register(TRItemGroup::addColoredBlocks);
|
||||
ItemGroupEvents.modifyEntriesEvent(ItemGroups.NATURAL).register(TRItemGroup::addNaturalBlocks);
|
||||
ItemGroupEvents.modifyEntriesEvent(ItemGroups.FUNCTIONAL).register(TRItemGroup::addFunctionalBlocks);
|
||||
ItemGroupEvents.modifyEntriesEvent(ItemGroups.REDSTONE).register(TRItemGroup::addRedstoneBlocks);
|
||||
ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS).register(TRItemGroup::addTools);
|
||||
ItemGroupEvents.modifyEntriesEvent(ItemGroups.COMBAT).register(TRItemGroup::addCombat);
|
||||
ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register(TRItemGroup::addIngredients);
|
||||
}
|
||||
|
||||
private static final ItemConvertible[] rubberOrderSmall = new ItemConvertible[]{
|
||||
TRContent.RUBBER_LOG,
|
||||
TRContent.RUBBER_LOG_STRIPPED,
|
||||
TRContent.RUBBER_WOOD,
|
||||
TRContent.STRIPPED_RUBBER_WOOD,
|
||||
TRContent.RUBBER_PLANKS,
|
||||
TRContent.RUBBER_STAIR,
|
||||
TRContent.RUBBER_SLAB,
|
||||
TRContent.RUBBER_FENCE,
|
||||
TRContent.RUBBER_FENCE_GATE,
|
||||
TRContent.RUBBER_DOOR,
|
||||
TRContent.RUBBER_TRAPDOOR,
|
||||
TRContent.RUBBER_PRESSURE_PLATE,
|
||||
TRContent.RUBBER_BUTTON
|
||||
};
|
||||
|
||||
private static void entries(FabricItemGroupEntries entries) {
|
||||
// rubber tree and related stuff
|
||||
entries.add(TRContent.RUBBER_SAPLING);
|
||||
entries.add(TRContent.RUBBER_LEAVES);
|
||||
addContent(rubberOrderSmall, entries);
|
||||
entries.add(TRContent.TREE_TAP);
|
||||
addPoweredItem(TRContent.ELECTRIC_TREE_TAP, entries, null, true);
|
||||
entries.add(TRContent.Machine.RESIN_BASIN);
|
||||
entries.add(TRContent.Parts.SAP);
|
||||
entries.add(TRContent.Parts.RUBBER);
|
||||
|
||||
// resources
|
||||
List<Enum<? extends ItemConvertible>> stuff = new LinkedList<>();
|
||||
stuff.addAll(Arrays.stream(TRContent.Ores.values()).filter(ore -> !ore.isDeepslate()).toList());
|
||||
stuff.addAll(Arrays.stream(TRContent.Dusts.values()).toList());
|
||||
stuff.addAll(Arrays.stream(TRContent.RawMetals.values()).toList());
|
||||
stuff.addAll(Arrays.stream(TRContent.SmallDusts.values()).toList());
|
||||
stuff.addAll(Arrays.stream(TRContent.Gems.values()).toList());
|
||||
stuff.addAll(Arrays.stream(TRContent.Ingots.values()).toList());
|
||||
stuff.addAll(Arrays.stream(TRContent.Nuggets.values()).toList());
|
||||
stuff.addAll(Arrays.stream(TRContent.Plates.values()).toList());
|
||||
stuff.addAll(Arrays.stream(TRContent.StorageBlocks.values()).filter(block -> !block.name().startsWith("RAW")).toList());
|
||||
Collections.sort(stuff, new MaterialComparator().thenComparing(new MaterialTypeComparator()));
|
||||
for (Object item : stuff) {
|
||||
entries.add((ItemConvertible)item);
|
||||
}
|
||||
entries.addAfter(TRContent.Plates.COPPER, TRContent.COPPER_WALL);
|
||||
entries.addAfter(TRContent.Plates.IRON, TRContent.REFINED_IRON_FENCE);
|
||||
entries.addBefore(TRContent.Plates.CARBON,
|
||||
TRContent.Parts.CARBON_FIBER,
|
||||
TRContent.Parts.CARBON_MESH);
|
||||
entries.addAfter(TRContent.RawMetals.TIN, TRContent.StorageBlocks.RAW_TIN);
|
||||
entries.addAfter(TRContent.RawMetals.LEAD, TRContent.StorageBlocks.RAW_LEAD);
|
||||
entries.addAfter(TRContent.RawMetals.SILVER, TRContent.StorageBlocks.RAW_SILVER);
|
||||
entries.addAfter(TRContent.RawMetals.IRIDIUM, TRContent.StorageBlocks.RAW_IRIDIUM);
|
||||
entries.addAfter(TRContent.RawMetals.TUNGSTEN, TRContent.StorageBlocks.RAW_TUNGSTEN);
|
||||
for (TRContent.StorageBlocks block : TRContent.StorageBlocks.values()) {
|
||||
entries.addAfter(block,
|
||||
block.getStairsBlock(),
|
||||
block.getSlabBlock(),
|
||||
block.getWallBlock()
|
||||
);
|
||||
}
|
||||
for (TRContent.Ores ore : TRContent.Ores.values()) {
|
||||
if (!ore.isDeepslate()) {
|
||||
continue;
|
||||
}
|
||||
entries.addAfter(ore.getUnDeepslate(), ore);
|
||||
}
|
||||
|
||||
// fluids
|
||||
addContent(ModFluids.values(), entries);
|
||||
addCells(entries);
|
||||
|
||||
// parts
|
||||
addContent(TRContent.Parts.values(), entries);
|
||||
entries.add(TRContent.FREQUENCY_TRANSMITTER);
|
||||
entries.add(TRContent.REINFORCED_GLASS);
|
||||
entries.addAfter(TRContent.Parts.SCRAP, TRContent.SCRAP_BOX);
|
||||
|
||||
// machines
|
||||
entries.add(TRContent.WRENCH);
|
||||
entries.add(TRContent.PAINTING_TOOL);
|
||||
for (TRContent.MachineBlocks machineBlock : TRContent.MachineBlocks.values()) {
|
||||
entries.add(machineBlock.frame);
|
||||
entries.add(machineBlock.casing);
|
||||
}
|
||||
addContent(TRContent.Cables.values(), entries);
|
||||
addContent(TRContent.Machine.values(), entries);
|
||||
addContent(TRContent.SolarPanels.values(), entries);
|
||||
entries.add(TRContent.COMPUTER_CUBE);
|
||||
entries.add(TRContent.NUKE);
|
||||
addContent(TRContent.Upgrades.values(), entries);
|
||||
addContent(TRContent.StorageUnit.values(), entries);
|
||||
addContent(TRContent.TankUnit.values(), entries);
|
||||
for (TRContent.StorageUnit storageUnit : TRContent.StorageUnit.values()) {
|
||||
if (storageUnit.upgrader != null) {
|
||||
entries.add(storageUnit.upgrader);
|
||||
}
|
||||
}
|
||||
|
||||
// armor and traditional tools
|
||||
entries.add(TRContent.BRONZE_HELMET);
|
||||
entries.add(TRContent.BRONZE_CHESTPLATE);
|
||||
entries.add(TRContent.BRONZE_LEGGINGS);
|
||||
entries.add(TRContent.BRONZE_BOOTS);
|
||||
entries.add(TRContent.BRONZE_SWORD);
|
||||
entries.add(TRContent.BRONZE_PICKAXE);
|
||||
entries.add(TRContent.BRONZE_AXE);
|
||||
entries.add(TRContent.BRONZE_HOE);
|
||||
entries.add(TRContent.BRONZE_SPADE);
|
||||
|
||||
entries.add(TRContent.RUBY_HELMET);
|
||||
entries.add(TRContent.RUBY_CHESTPLATE);
|
||||
entries.add(TRContent.RUBY_LEGGINGS);
|
||||
entries.add(TRContent.RUBY_BOOTS);
|
||||
entries.add(TRContent.RUBY_SWORD);
|
||||
entries.add(TRContent.RUBY_PICKAXE);
|
||||
entries.add(TRContent.RUBY_AXE);
|
||||
entries.add(TRContent.RUBY_HOE);
|
||||
entries.add(TRContent.RUBY_SPADE);
|
||||
|
||||
entries.add(TRContent.SAPPHIRE_HELMET);
|
||||
entries.add(TRContent.SAPPHIRE_CHESTPLATE);
|
||||
entries.add(TRContent.SAPPHIRE_LEGGINGS);
|
||||
entries.add(TRContent.SAPPHIRE_BOOTS);
|
||||
entries.add(TRContent.SAPPHIRE_SWORD);
|
||||
entries.add(TRContent.SAPPHIRE_PICKAXE);
|
||||
entries.add(TRContent.SAPPHIRE_AXE);
|
||||
entries.add(TRContent.SAPPHIRE_HOE);
|
||||
entries.add(TRContent.SAPPHIRE_SPADE);
|
||||
|
||||
entries.add(TRContent.PERIDOT_HELMET);
|
||||
entries.add(TRContent.PERIDOT_CHESTPLATE);
|
||||
entries.add(TRContent.PERIDOT_LEGGINGS);
|
||||
entries.add(TRContent.PERIDOT_BOOTS);
|
||||
entries.add(TRContent.PERIDOT_SWORD);
|
||||
entries.add(TRContent.PERIDOT_PICKAXE);
|
||||
entries.add(TRContent.PERIDOT_AXE);
|
||||
entries.add(TRContent.PERIDOT_HOE);
|
||||
entries.add(TRContent.PERIDOT_SPADE);
|
||||
|
||||
entries.add(TRContent.SILVER_HELMET);
|
||||
entries.add(TRContent.SILVER_CHESTPLATE);
|
||||
entries.add(TRContent.SILVER_LEGGINGS);
|
||||
entries.add(TRContent.SILVER_BOOTS);
|
||||
|
||||
entries.add(TRContent.STEEL_HELMET);
|
||||
entries.add(TRContent.STEEL_CHESTPLATE);
|
||||
entries.add(TRContent.STEEL_LEGGINGS);
|
||||
entries.add(TRContent.STEEL_BOOTS);
|
||||
|
||||
// powered tools
|
||||
addPoweredItem(TRContent.BASIC_CHAINSAW, entries, null, true);
|
||||
addPoweredItem(TRContent.BASIC_JACKHAMMER, entries, null, true);
|
||||
addPoweredItem(TRContent.BASIC_DRILL, entries, null, true);
|
||||
|
||||
addPoweredItem(TRContent.ADVANCED_CHAINSAW, entries, null, true);
|
||||
addPoweredItem(TRContent.ADVANCED_JACKHAMMER, entries, null, true);
|
||||
addPoweredItem(TRContent.ADVANCED_DRILL, entries, null, true);
|
||||
|
||||
addPoweredItem(TRContent.INDUSTRIAL_CHAINSAW, entries, null, true);
|
||||
addPoweredItem(TRContent.INDUSTRIAL_JACKHAMMER, entries, null, true);
|
||||
addPoweredItem(TRContent.INDUSTRIAL_DRILL, entries, null, true);
|
||||
|
||||
addRockCutter(entries, null, true);
|
||||
addPoweredItem(TRContent.OMNI_TOOL, entries, null, true);
|
||||
|
||||
addPoweredItem(TRContent.QUANTUM_HELMET, entries, null, true);
|
||||
addPoweredItem(TRContent.QUANTUM_CHESTPLATE, entries, null, true);
|
||||
addPoweredItem(TRContent.QUANTUM_LEGGINGS, entries, null, true);
|
||||
addPoweredItem(TRContent.QUANTUM_BOOTS, entries, null, true);
|
||||
|
||||
addNanosaber(entries, null, false);
|
||||
|
||||
addPoweredItem(TRContent.LITHIUM_ION_BATPACK, entries, null, true);
|
||||
addPoweredItem(TRContent.LAPOTRONIC_ORBPACK, entries, null, true);
|
||||
addPoweredItem(TRContent.CLOAKING_DEVICE, entries, null, true);
|
||||
|
||||
addPoweredItem(TRContent.RED_CELL_BATTERY, entries, null, true);
|
||||
addPoweredItem(TRContent.LITHIUM_ION_BATTERY, entries, null, true);
|
||||
addPoweredItem(TRContent.ENERGY_CRYSTAL, entries, null, true);
|
||||
addPoweredItem(TRContent.LAPOTRON_CRYSTAL, entries, null, true);
|
||||
addPoweredItem(TRContent.LAPOTRONIC_ORB, entries, null, true);
|
||||
|
||||
entries.add(TRContent.GPS);
|
||||
|
||||
entries.add(TRContent.MANUAL);
|
||||
entries.add(TRContent.DEBUG_TOOL);
|
||||
}
|
||||
|
||||
private static void addBuildingBlocks(FabricItemGroupEntries entries) {
|
||||
entries.addAfter(Items.MANGROVE_BUTTON, rubberOrderSmall);
|
||||
entries.addAfter(Items.AMETHYST_BLOCK,
|
||||
TRContent.MachineBlocks.BASIC.getFrame(),
|
||||
TRContent.MachineBlocks.ADVANCED.getFrame(),
|
||||
TRContent.MachineBlocks.INDUSTRIAL.getFrame());
|
||||
entries.addAfter(Items.CHAIN, TRContent.REFINED_IRON_FENCE);
|
||||
entries.addBefore(Items.COPPER_BLOCK,
|
||||
TRContent.StorageBlocks.RAW_TIN,
|
||||
TRContent.StorageBlocks.RAW_TIN.getStairsBlock(),
|
||||
TRContent.StorageBlocks.RAW_TIN.getSlabBlock(),
|
||||
TRContent.StorageBlocks.RAW_TIN.getWallBlock(),
|
||||
TRContent.StorageBlocks.TIN,
|
||||
TRContent.StorageBlocks.TIN.getStairsBlock(),
|
||||
TRContent.StorageBlocks.TIN.getSlabBlock(),
|
||||
TRContent.StorageBlocks.TIN.getWallBlock(),
|
||||
TRContent.StorageBlocks.ZINC,
|
||||
TRContent.StorageBlocks.ZINC.getStairsBlock(),
|
||||
TRContent.StorageBlocks.ZINC.getSlabBlock(),
|
||||
TRContent.StorageBlocks.ZINC.getWallBlock(),
|
||||
TRContent.StorageBlocks.REFINED_IRON,
|
||||
TRContent.StorageBlocks.REFINED_IRON.getStairsBlock(),
|
||||
TRContent.StorageBlocks.REFINED_IRON.getSlabBlock(),
|
||||
TRContent.StorageBlocks.REFINED_IRON.getWallBlock(),
|
||||
TRContent.StorageBlocks.STEEL,
|
||||
TRContent.StorageBlocks.STEEL.getStairsBlock(),
|
||||
TRContent.StorageBlocks.STEEL.getSlabBlock(),
|
||||
TRContent.StorageBlocks.STEEL.getWallBlock());
|
||||
entries.addAfter(Items.CUT_COPPER_SLAB, TRContent.COPPER_WALL);
|
||||
entries.addAfter(Items.WAXED_OXIDIZED_CUT_COPPER_SLAB,
|
||||
TRContent.StorageBlocks.RAW_LEAD,
|
||||
TRContent.StorageBlocks.RAW_LEAD.getStairsBlock(),
|
||||
TRContent.StorageBlocks.RAW_LEAD.getSlabBlock(),
|
||||
TRContent.StorageBlocks.RAW_LEAD.getWallBlock(),
|
||||
TRContent.StorageBlocks.LEAD,
|
||||
TRContent.StorageBlocks.LEAD.getStairsBlock(),
|
||||
TRContent.StorageBlocks.LEAD.getSlabBlock(),
|
||||
TRContent.StorageBlocks.LEAD.getWallBlock(),
|
||||
TRContent.StorageBlocks.NICKEL,
|
||||
TRContent.StorageBlocks.NICKEL.getStairsBlock(),
|
||||
TRContent.StorageBlocks.NICKEL.getSlabBlock(),
|
||||
TRContent.StorageBlocks.NICKEL.getWallBlock(),
|
||||
TRContent.StorageBlocks.BRONZE,
|
||||
TRContent.StorageBlocks.BRONZE.getStairsBlock(),
|
||||
TRContent.StorageBlocks.BRONZE.getSlabBlock(),
|
||||
TRContent.StorageBlocks.BRONZE.getWallBlock(),
|
||||
TRContent.StorageBlocks.BRASS,
|
||||
TRContent.StorageBlocks.BRASS.getStairsBlock(),
|
||||
TRContent.StorageBlocks.BRASS.getSlabBlock(),
|
||||
TRContent.StorageBlocks.BRASS.getWallBlock(),
|
||||
TRContent.StorageBlocks.ADVANCED_ALLOY,
|
||||
TRContent.StorageBlocks.ADVANCED_ALLOY.getStairsBlock(),
|
||||
TRContent.StorageBlocks.ADVANCED_ALLOY.getSlabBlock(),
|
||||
TRContent.StorageBlocks.ADVANCED_ALLOY.getWallBlock(),
|
||||
TRContent.StorageBlocks.INVAR,
|
||||
TRContent.StorageBlocks.INVAR.getStairsBlock(),
|
||||
TRContent.StorageBlocks.INVAR.getSlabBlock(),
|
||||
TRContent.StorageBlocks.INVAR.getWallBlock(),
|
||||
TRContent.StorageBlocks.RAW_SILVER,
|
||||
TRContent.StorageBlocks.RAW_SILVER.getStairsBlock(),
|
||||
TRContent.StorageBlocks.RAW_SILVER.getSlabBlock(),
|
||||
TRContent.StorageBlocks.RAW_SILVER.getWallBlock(),
|
||||
TRContent.StorageBlocks.SILVER,
|
||||
TRContent.StorageBlocks.SILVER.getStairsBlock(),
|
||||
TRContent.StorageBlocks.SILVER.getSlabBlock(),
|
||||
TRContent.StorageBlocks.SILVER.getWallBlock(),
|
||||
TRContent.StorageBlocks.ELECTRUM,
|
||||
TRContent.StorageBlocks.ELECTRUM.getStairsBlock(),
|
||||
TRContent.StorageBlocks.ELECTRUM.getSlabBlock(),
|
||||
TRContent.StorageBlocks.ELECTRUM.getWallBlock(),
|
||||
TRContent.StorageBlocks.ALUMINUM,
|
||||
TRContent.StorageBlocks.ALUMINUM.getStairsBlock(),
|
||||
TRContent.StorageBlocks.ALUMINUM.getSlabBlock(),
|
||||
TRContent.StorageBlocks.ALUMINUM.getWallBlock(),
|
||||
TRContent.StorageBlocks.TITANIUM,
|
||||
TRContent.StorageBlocks.TITANIUM.getStairsBlock(),
|
||||
TRContent.StorageBlocks.TITANIUM.getSlabBlock(),
|
||||
TRContent.StorageBlocks.TITANIUM.getWallBlock(),
|
||||
TRContent.StorageBlocks.CHROME,
|
||||
TRContent.StorageBlocks.CHROME.getStairsBlock(),
|
||||
TRContent.StorageBlocks.CHROME.getSlabBlock(),
|
||||
TRContent.StorageBlocks.CHROME.getWallBlock(),
|
||||
TRContent.StorageBlocks.RUBY,
|
||||
TRContent.StorageBlocks.RUBY.getStairsBlock(),
|
||||
TRContent.StorageBlocks.RUBY.getSlabBlock(),
|
||||
TRContent.StorageBlocks.RUBY.getWallBlock(),
|
||||
TRContent.StorageBlocks.SAPPHIRE,
|
||||
TRContent.StorageBlocks.SAPPHIRE.getStairsBlock(),
|
||||
TRContent.StorageBlocks.SAPPHIRE.getSlabBlock(),
|
||||
TRContent.StorageBlocks.SAPPHIRE.getWallBlock(),
|
||||
TRContent.StorageBlocks.PERIDOT,
|
||||
TRContent.StorageBlocks.PERIDOT.getStairsBlock(),
|
||||
TRContent.StorageBlocks.PERIDOT.getSlabBlock(),
|
||||
TRContent.StorageBlocks.PERIDOT.getWallBlock(),
|
||||
TRContent.StorageBlocks.RED_GARNET,
|
||||
TRContent.StorageBlocks.RED_GARNET.getStairsBlock(),
|
||||
TRContent.StorageBlocks.RED_GARNET.getSlabBlock(),
|
||||
TRContent.StorageBlocks.RED_GARNET.getWallBlock(),
|
||||
TRContent.StorageBlocks.YELLOW_GARNET,
|
||||
TRContent.StorageBlocks.YELLOW_GARNET.getStairsBlock(),
|
||||
TRContent.StorageBlocks.YELLOW_GARNET.getSlabBlock(),
|
||||
TRContent.StorageBlocks.YELLOW_GARNET.getWallBlock(),
|
||||
TRContent.StorageBlocks.RAW_IRIDIUM,
|
||||
TRContent.StorageBlocks.RAW_IRIDIUM.getStairsBlock(),
|
||||
TRContent.StorageBlocks.RAW_IRIDIUM.getSlabBlock(),
|
||||
TRContent.StorageBlocks.RAW_IRIDIUM.getWallBlock(),
|
||||
TRContent.StorageBlocks.IRIDIUM,
|
||||
TRContent.StorageBlocks.IRIDIUM.getStairsBlock(),
|
||||
TRContent.StorageBlocks.IRIDIUM.getSlabBlock(),
|
||||
TRContent.StorageBlocks.IRIDIUM.getWallBlock(),
|
||||
TRContent.StorageBlocks.RAW_TUNGSTEN,
|
||||
TRContent.StorageBlocks.RAW_TUNGSTEN.getStairsBlock(),
|
||||
TRContent.StorageBlocks.RAW_TUNGSTEN.getSlabBlock(),
|
||||
TRContent.StorageBlocks.RAW_TUNGSTEN.getWallBlock(),
|
||||
TRContent.StorageBlocks.TUNGSTEN,
|
||||
TRContent.StorageBlocks.TUNGSTEN.getStairsBlock(),
|
||||
TRContent.StorageBlocks.TUNGSTEN.getSlabBlock(),
|
||||
TRContent.StorageBlocks.TUNGSTEN.getWallBlock(),
|
||||
TRContent.StorageBlocks.TUNGSTENSTEEL,
|
||||
TRContent.StorageBlocks.TUNGSTENSTEEL.getStairsBlock(),
|
||||
TRContent.StorageBlocks.TUNGSTENSTEEL.getSlabBlock(),
|
||||
TRContent.StorageBlocks.TUNGSTENSTEEL.getWallBlock(),
|
||||
TRContent.StorageBlocks.HOT_TUNGSTENSTEEL,
|
||||
TRContent.StorageBlocks.HOT_TUNGSTENSTEEL.getStairsBlock(),
|
||||
TRContent.StorageBlocks.HOT_TUNGSTENSTEEL.getSlabBlock(),
|
||||
TRContent.StorageBlocks.HOT_TUNGSTENSTEEL.getWallBlock(),
|
||||
TRContent.StorageBlocks.IRIDIUM_REINFORCED_STONE,
|
||||
TRContent.StorageBlocks.IRIDIUM_REINFORCED_STONE.getStairsBlock(),
|
||||
TRContent.StorageBlocks.IRIDIUM_REINFORCED_STONE.getSlabBlock(),
|
||||
TRContent.StorageBlocks.IRIDIUM_REINFORCED_STONE.getWallBlock(),
|
||||
TRContent.StorageBlocks.IRIDIUM_REINFORCED_TUNGSTENSTEEL,
|
||||
TRContent.StorageBlocks.IRIDIUM_REINFORCED_TUNGSTENSTEEL.getStairsBlock(),
|
||||
TRContent.StorageBlocks.IRIDIUM_REINFORCED_TUNGSTENSTEEL.getSlabBlock(),
|
||||
TRContent.StorageBlocks.IRIDIUM_REINFORCED_TUNGSTENSTEEL.getWallBlock());
|
||||
}
|
||||
|
||||
private static void addColoredBlocks(FabricItemGroupEntries entries) {
|
||||
entries.addBefore(Items.TINTED_GLASS, TRContent.REINFORCED_GLASS);
|
||||
}
|
||||
|
||||
private static void addNaturalBlocks(FabricItemGroupEntries entries) {
|
||||
entries.addBefore(Items.IRON_ORE, TRContent.Ores.TIN, TRContent.Ores.DEEPSLATE_TIN);
|
||||
entries.addAfter(Items.DEEPSLATE_COPPER_ORE,
|
||||
TRContent.Ores.LEAD, TRContent.Ores.DEEPSLATE_LEAD,
|
||||
TRContent.Ores.SILVER, TRContent.Ores.DEEPSLATE_SILVER);
|
||||
entries.addAfter(Items.DEEPSLATE_GOLD_ORE,
|
||||
TRContent.Ores.GALENA, TRContent.Ores.DEEPSLATE_GALENA,
|
||||
TRContent.Ores.BAUXITE, TRContent.Ores.DEEPSLATE_BAUXITE);
|
||||
entries.addAfter(Items.DEEPSLATE_REDSTONE_ORE,
|
||||
TRContent.Ores.RUBY, TRContent.Ores.DEEPSLATE_RUBY,
|
||||
TRContent.Ores.SAPPHIRE, TRContent.Ores.DEEPSLATE_SAPPHIRE);
|
||||
entries.addAfter(Items.DEEPSLATE_DIAMOND_ORE, TRContent.Ores.IRIDIUM, TRContent.Ores.DEEPSLATE_IRIDIUM);
|
||||
entries.addAfter(Items.NETHER_GOLD_ORE,
|
||||
TRContent.Ores.CINNABAR,
|
||||
TRContent.Ores.PYRITE,
|
||||
TRContent.Ores.SPHALERITE);
|
||||
entries.addAfter(Items.ANCIENT_DEBRIS,
|
||||
TRContent.Ores.PERIDOT,
|
||||
TRContent.Ores.SHELDONITE,
|
||||
TRContent.Ores.SODALITE,
|
||||
TRContent.Ores.TUNGSTEN);
|
||||
entries.addBefore(Items.RAW_IRON_BLOCK, TRContent.StorageBlocks.RAW_TIN);
|
||||
entries.addAfter(Items.RAW_COPPER_BLOCK,
|
||||
TRContent.StorageBlocks.RAW_LEAD,
|
||||
TRContent.StorageBlocks.RAW_SILVER);
|
||||
entries.addAfter(Items.RAW_GOLD_BLOCK,
|
||||
TRContent.StorageBlocks.RAW_IRIDIUM,
|
||||
TRContent.StorageBlocks.RAW_TUNGSTEN);
|
||||
entries.addAfter(Items.MANGROVE_LOG, TRContent.RUBBER_LOG);
|
||||
entries.addAfter(Items.MUDDY_MANGROVE_ROOTS, TRContent.RUBBER_LEAVES);
|
||||
entries.addAfter(Items.MANGROVE_PROPAGULE, TRContent.RUBBER_SAPLING);
|
||||
}
|
||||
|
||||
private static void addFunctionalBlocks(FabricItemGroupEntries entries) {
|
||||
entries.addAfter(Items.END_ROD,
|
||||
TRContent.Machine.LAMP_INCANDESCENT,
|
||||
TRContent.Machine.LAMP_LED);
|
||||
entries.addBefore(Items.CRYING_OBSIDIAN, TRContent.StorageBlocks.HOT_TUNGSTENSTEEL);
|
||||
entries.addAfter(Items.CRAFTING_TABLE,
|
||||
TRContent.Machine.AUTO_CRAFTING_TABLE,
|
||||
TRContent.Machine.BLOCK_BREAKER,
|
||||
TRContent.Machine.BLOCK_PLACER);
|
||||
entries.addAfter(Items.STONECUTTER, TRContent.Machine.RESIN_BASIN);
|
||||
entries.addAfter(Items.SMITHING_TABLE, TRContent.Machine.ASSEMBLY_MACHINE);
|
||||
entries.addAfter(Items.FURNACE,
|
||||
TRContent.Machine.IRON_FURNACE,
|
||||
TRContent.Machine.ELECTRIC_FURNACE);
|
||||
entries.addAfter(Items.BLAST_FURNACE,
|
||||
TRContent.Machine.INDUSTRIAL_BLAST_FURNACE,
|
||||
TRContent.Machine.IRON_ALLOY_FURNACE,
|
||||
TRContent.Machine.ALLOY_SMELTER,
|
||||
TRContent.Machine.GRINDER,
|
||||
TRContent.Machine.INDUSTRIAL_GRINDER,
|
||||
TRContent.Machine.INDUSTRIAL_SAWMILL,
|
||||
TRContent.Machine.ROLLING_MACHINE,
|
||||
TRContent.Machine.VACUUM_FREEZER);
|
||||
entries.addAfter(Items.SCAFFOLDING,
|
||||
TRContent.Machine.ELEVATOR,
|
||||
TRContent.Machine.LAUNCHPAD);
|
||||
entries.addAfter(Items.COMPOSTER,
|
||||
TRContent.Machine.COMPRESSOR,
|
||||
TRContent.Machine.SOLID_CANNING_MACHINE,
|
||||
TRContent.Machine.RECYCLER,
|
||||
TRContent.Machine.SCRAPBOXINATOR,
|
||||
TRContent.Machine.MATTER_FABRICATOR);
|
||||
entries.addBefore(Items.BREWING_STAND, TRContent.Machine.IMPLOSION_COMPRESSOR);
|
||||
entries.addBefore(Items.CAULDRON,
|
||||
TRContent.Machine.EXTRACTOR,
|
||||
TRContent.Machine.CHEMICAL_REACTOR,
|
||||
TRContent.Machine.INDUSTRIAL_CENTRIFUGE,
|
||||
TRContent.Machine.INDUSTRIAL_ELECTROLYZER,
|
||||
TRContent.Machine.DISTILLATION_TOWER);
|
||||
entries.addAfter(Items.CAULDRON,
|
||||
TRContent.Machine.DRAIN,
|
||||
TRContent.Machine.FLUID_REPLICATOR);
|
||||
entries.addAfter(Items.LODESTONE, TRContent.Machine.CHUNK_LOADER);
|
||||
entries.addAfter(Items.BEEHIVE, TRContent.Machine.GREENHOUSE_CONTROLLER);
|
||||
entries.addAfter(Items.LIGHTNING_ROD, TRContent.Machine.LIGHTNING_ROD);
|
||||
// inventory stuff
|
||||
entries.addAfter(Items.ENDER_CHEST,
|
||||
TRContent.StorageUnit.BUFFER,
|
||||
TRContent.StorageUnit.CRUDE,
|
||||
TRContent.StorageUnit.BASIC,
|
||||
TRContent.StorageUnit.ADVANCED,
|
||||
TRContent.StorageUnit.INDUSTRIAL,
|
||||
TRContent.StorageUnit.QUANTUM,
|
||||
TRContent.StorageUnit.CREATIVE,
|
||||
TRContent.TankUnit.BASIC,
|
||||
TRContent.TankUnit.ADVANCED,
|
||||
TRContent.TankUnit.INDUSTRIAL,
|
||||
TRContent.TankUnit.QUANTUM,
|
||||
TRContent.TankUnit.CREATIVE);
|
||||
entries.addBefore(Items.SKELETON_SKULL,
|
||||
// blocks
|
||||
TRContent.MachineBlocks.BASIC.getCasing(),
|
||||
TRContent.MachineBlocks.ADVANCED.getCasing(),
|
||||
TRContent.MachineBlocks.INDUSTRIAL.getCasing(),
|
||||
TRContent.Machine.FUSION_COIL,
|
||||
// generators
|
||||
TRContent.Machine.SOLID_FUEL_GENERATOR,
|
||||
TRContent.Machine.SEMI_FLUID_GENERATOR,
|
||||
TRContent.Machine.DIESEL_GENERATOR,
|
||||
TRContent.Machine.GAS_TURBINE,
|
||||
TRContent.Machine.PLASMA_GENERATOR,
|
||||
TRContent.Machine.THERMAL_GENERATOR,
|
||||
TRContent.Machine.WATER_MILL,
|
||||
TRContent.Machine.WIND_MILL,
|
||||
TRContent.Machine.DRAGON_EGG_SYPHON,
|
||||
TRContent.Machine.FUSION_CONTROL_COMPUTER,
|
||||
// batteries & transformers
|
||||
TRContent.Machine.LOW_VOLTAGE_SU,
|
||||
TRContent.Machine.LV_TRANSFORMER,
|
||||
TRContent.Machine.MEDIUM_VOLTAGE_SU,
|
||||
TRContent.Machine.MV_TRANSFORMER,
|
||||
TRContent.Machine.HIGH_VOLTAGE_SU,
|
||||
TRContent.Machine.HV_TRANSFORMER,
|
||||
TRContent.Machine.CHARGE_O_MAT,
|
||||
TRContent.Machine.LAPOTRONIC_SU,
|
||||
TRContent.Machine.LSU_STORAGE,
|
||||
TRContent.Machine.ADJUSTABLE_SU,
|
||||
TRContent.Machine.EV_TRANSFORMER,
|
||||
TRContent.Machine.INTERDIMENSIONAL_SU,
|
||||
// cables
|
||||
TRContent.Cables.TIN,
|
||||
TRContent.Cables.COPPER,
|
||||
TRContent.Cables.INSULATED_COPPER,
|
||||
TRContent.Cables.GOLD,
|
||||
TRContent.Cables.INSULATED_GOLD,
|
||||
TRContent.Cables.HV,
|
||||
TRContent.Cables.INSULATED_HV,
|
||||
TRContent.Cables.GLASSFIBER,
|
||||
TRContent.Cables.SUPERCONDUCTOR,
|
||||
TRContent.Machine.WIRE_MILL);
|
||||
}
|
||||
|
||||
private static void addRedstoneBlocks(FabricItemGroupEntries entries) {
|
||||
entries.addBefore(Items.SCULK_SENSOR, TRContent.Machine.ALARM);
|
||||
entries.addAfter(Items.WHITE_WOOL, TRContent.Machine.PLAYER_DETECTOR);
|
||||
}
|
||||
|
||||
private static void addTools(FabricItemGroupEntries entries) {
|
||||
entries.addBefore(Items.GOLDEN_SHOVEL,
|
||||
TRContent.BRONZE_SPADE,
|
||||
TRContent.BRONZE_PICKAXE,
|
||||
TRContent.BRONZE_AXE,
|
||||
TRContent.BRONZE_HOE);
|
||||
entries.addBefore(Items.DIAMOND_SHOVEL,
|
||||
TRContent.RUBY_SPADE,
|
||||
TRContent.RUBY_PICKAXE,
|
||||
TRContent.RUBY_AXE,
|
||||
TRContent.RUBY_HOE,
|
||||
TRContent.SAPPHIRE_SPADE,
|
||||
TRContent.SAPPHIRE_PICKAXE,
|
||||
TRContent.SAPPHIRE_AXE,
|
||||
TRContent.SAPPHIRE_HOE,
|
||||
TRContent.PERIDOT_SPADE,
|
||||
TRContent.PERIDOT_PICKAXE,
|
||||
TRContent.PERIDOT_AXE,
|
||||
TRContent.PERIDOT_HOE);
|
||||
// order very important here
|
||||
entries.addBefore(Items.BUCKET, TRContent.TREE_TAP);
|
||||
addPoweredItem(TRContent.ELECTRIC_TREE_TAP, entries, Items.BUCKET, false);
|
||||
addPoweredItem(TRContent.ROCK_CUTTER, entries, Items.BUCKET, false);
|
||||
addPoweredItem(TRContent.BASIC_DRILL, entries, Items.BUCKET, false);
|
||||
addPoweredItem(TRContent.ADVANCED_DRILL, entries, Items.BUCKET, false);
|
||||
addPoweredItem(TRContent.INDUSTRIAL_DRILL, entries, Items.BUCKET, false);
|
||||
addPoweredItem(TRContent.BASIC_JACKHAMMER, entries, Items.BUCKET, false);
|
||||
addPoweredItem(TRContent.ADVANCED_JACKHAMMER, entries, Items.BUCKET, false);
|
||||
addPoweredItem(TRContent.INDUSTRIAL_JACKHAMMER, entries, Items.BUCKET, false);
|
||||
addPoweredItem(TRContent.BASIC_CHAINSAW, entries, Items.BUCKET, false);
|
||||
addPoweredItem(TRContent.ADVANCED_CHAINSAW, entries, Items.BUCKET, false);
|
||||
addPoweredItem(TRContent.INDUSTRIAL_CHAINSAW, entries, Items.BUCKET, false);
|
||||
addPoweredItem(TRContent.OMNI_TOOL, entries, Items.BUCKET, false);
|
||||
entries.addBefore(Items.BUCKET, TRContent.CELL);
|
||||
addPoweredItem(TRContent.RED_CELL_BATTERY, entries, Items.OAK_BOAT, false);
|
||||
addPoweredItem(TRContent.LITHIUM_ION_BATTERY, entries, Items.OAK_BOAT, false);
|
||||
addPoweredItem(TRContent.LITHIUM_ION_BATPACK, entries, Items.OAK_BOAT, false);
|
||||
addPoweredItem(TRContent.ENERGY_CRYSTAL, entries, Items.OAK_BOAT, false);
|
||||
addPoweredItem(TRContent.LAPOTRON_CRYSTAL, entries, Items.OAK_BOAT, false);
|
||||
addPoweredItem(TRContent.LAPOTRONIC_ORB, entries, Items.OAK_BOAT, false);
|
||||
addPoweredItem(TRContent.LAPOTRONIC_ORBPACK, entries, Items.OAK_BOAT, false);
|
||||
// now order not important again
|
||||
entries.addBefore(Items.SHEARS,
|
||||
TRContent.SCRAP_BOX,
|
||||
TRContent.Plates.WOOD,
|
||||
TRContent.PAINTING_TOOL);
|
||||
entries.addAfter(Items.RECOVERY_COMPASS, TRContent.GPS);
|
||||
entries.addAfter(Items.SPYGLASS, TRContent.WRENCH);
|
||||
}
|
||||
|
||||
private static void addCombat(FabricItemGroupEntries entries) {
|
||||
addNanosaber(entries, Items.WOODEN_AXE, true);
|
||||
entries.addAfter(Items.IRON_BOOTS,
|
||||
TRContent.STEEL_HELMET,
|
||||
TRContent.STEEL_CHESTPLATE,
|
||||
TRContent.STEEL_LEGGINGS,
|
||||
TRContent.STEEL_BOOTS,
|
||||
TRContent.BRONZE_HELMET,
|
||||
TRContent.BRONZE_CHESTPLATE,
|
||||
TRContent.BRONZE_LEGGINGS,
|
||||
TRContent.BRONZE_BOOTS);
|
||||
entries.addBefore(Items.GOLDEN_HELMET,
|
||||
TRContent.SILVER_HELMET,
|
||||
TRContent.SILVER_CHESTPLATE,
|
||||
TRContent.SILVER_LEGGINGS,
|
||||
TRContent.SILVER_BOOTS);
|
||||
entries.addBefore(Items.DIAMOND_HELMET,
|
||||
TRContent.RUBY_HELMET,
|
||||
TRContent.RUBY_CHESTPLATE,
|
||||
TRContent.RUBY_LEGGINGS,
|
||||
TRContent.RUBY_BOOTS,
|
||||
TRContent.SAPPHIRE_HELMET,
|
||||
TRContent.SAPPHIRE_CHESTPLATE,
|
||||
TRContent.SAPPHIRE_LEGGINGS,
|
||||
TRContent.SAPPHIRE_BOOTS,
|
||||
TRContent.PERIDOT_HELMET,
|
||||
TRContent.PERIDOT_CHESTPLATE,
|
||||
TRContent.PERIDOT_LEGGINGS,
|
||||
TRContent.PERIDOT_BOOTS);
|
||||
addPoweredItem(TRContent.QUANTUM_HELMET, entries, Items.TURTLE_HELMET, false);
|
||||
addPoweredItem(TRContent.QUANTUM_CHESTPLATE, entries, Items.TURTLE_HELMET, false);
|
||||
addPoweredItem(TRContent.QUANTUM_LEGGINGS, entries, Items.TURTLE_HELMET, false);
|
||||
addPoweredItem(TRContent.QUANTUM_BOOTS, entries, Items.TURTLE_HELMET, false);
|
||||
addPoweredItem(TRContent.CLOAKING_DEVICE, entries, Items.LEATHER_HORSE_ARMOR, false);
|
||||
entries.addAfter(Items.END_CRYSTAL, TRContent.NUKE);
|
||||
}
|
||||
|
||||
private static void addIngredients(FabricItemGroupEntries entries) {
|
||||
// raw / gem
|
||||
entries.addBefore(Items.RAW_IRON, TRContent.RawMetals.TIN);
|
||||
entries.addAfter(Items.RAW_COPPER,
|
||||
TRContent.RawMetals.LEAD,
|
||||
TRContent.RawMetals.SILVER);
|
||||
entries.addBefore(Items.EMERALD,
|
||||
TRContent.Gems.RUBY,
|
||||
TRContent.Gems.SAPPHIRE,
|
||||
TRContent.Gems.PERIDOT,
|
||||
TRContent.Gems.RED_GARNET,
|
||||
TRContent.Gems.YELLOW_GARNET);
|
||||
entries.addAfter(Items.DIAMOND,
|
||||
TRContent.RawMetals.IRIDIUM,
|
||||
TRContent.RawMetals.TUNGSTEN);
|
||||
// nuggets
|
||||
entries.addBefore(Items.IRON_NUGGET,
|
||||
TRContent.Nuggets.TIN,
|
||||
TRContent.Nuggets.ZINC);
|
||||
entries.addAfter(Items.IRON_NUGGET,
|
||||
TRContent.Nuggets.REFINED_IRON,
|
||||
TRContent.Nuggets.STEEL,
|
||||
TRContent.Nuggets.COPPER,
|
||||
TRContent.Nuggets.LEAD,
|
||||
TRContent.Nuggets.NICKEL,
|
||||
TRContent.Nuggets.BRONZE,
|
||||
TRContent.Nuggets.BRASS,
|
||||
TRContent.Nuggets.INVAR);
|
||||
entries.addBefore(Items.GOLD_NUGGET, TRContent.Nuggets.SILVER);
|
||||
entries.addAfter(Items.GOLD_NUGGET,
|
||||
TRContent.Nuggets.ELECTRUM,
|
||||
TRContent.Nuggets.ALUMINUM,
|
||||
TRContent.Nuggets.TITANIUM,
|
||||
TRContent.Nuggets.CHROME,
|
||||
TRContent.Nuggets.EMERALD,
|
||||
TRContent.Nuggets.DIAMOND,
|
||||
TRContent.Nuggets.IRIDIUM,
|
||||
TRContent.Nuggets.TUNGSTEN,
|
||||
TRContent.Nuggets.NETHERITE);
|
||||
// ingots
|
||||
entries.addBefore(Items.IRON_INGOT,
|
||||
TRContent.Ingots.TIN,
|
||||
TRContent.Ingots.ZINC);
|
||||
entries.addAfter(Items.IRON_INGOT,
|
||||
TRContent.Ingots.REFINED_IRON,
|
||||
TRContent.Ingots.STEEL);
|
||||
entries.addAfter(Items.COPPER_INGOT,
|
||||
TRContent.Ingots.LEAD,
|
||||
TRContent.Ingots.NICKEL,
|
||||
TRContent.Ingots.BRONZE,
|
||||
TRContent.Ingots.BRASS,
|
||||
TRContent.Ingots.MIXED_METAL,
|
||||
TRContent.Ingots.ADVANCED_ALLOY,
|
||||
TRContent.Ingots.INVAR);
|
||||
entries.addBefore(Items.GOLD_INGOT, TRContent.Ingots.SILVER);
|
||||
entries.addAfter(Items.GOLD_INGOT,
|
||||
TRContent.Ingots.ELECTRUM,
|
||||
TRContent.Ingots.ALUMINUM,
|
||||
TRContent.Ingots.TITANIUM,
|
||||
TRContent.Ingots.CHROME,
|
||||
TRContent.Ingots.IRIDIUM,
|
||||
TRContent.Ingots.IRIDIUM_ALLOY,
|
||||
TRContent.Ingots.TUNGSTEN,
|
||||
TRContent.Ingots.TUNGSTENSTEEL,
|
||||
TRContent.Ingots.HOT_TUNGSTENSTEEL);
|
||||
// dusts and small dusts
|
||||
// misc
|
||||
entries.addAfter(Items.STICK,
|
||||
TRContent.Parts.PLANTBALL,
|
||||
TRContent.Parts.COMPRESSED_PLANTBALL);
|
||||
entries.addAfter(Items.HONEYCOMB,
|
||||
TRContent.Parts.SAP,
|
||||
TRContent.Parts.RUBBER,
|
||||
TRContent.Parts.SCRAP);
|
||||
entries.addBefore(Items.PRISMARINE_SHARD, TRContent.Parts.SPONGE_PIECE);
|
||||
entries.addBefore(Items.BRICK,
|
||||
TRContent.Parts.CARBON_FIBER,
|
||||
TRContent.Parts.CARBON_MESH);
|
||||
entries.addBefore(Items.NETHER_STAR, TRContent.Parts.SYNTHETIC_REDSTONE_CRYSTAL);
|
||||
entries.addAfter(Items.NETHERITE_INGOT, TRContent.Parts.UU_MATTER);
|
||||
// machine parts
|
||||
entries.addAfter(Items.NETHER_BRICK,
|
||||
TRContent.Parts.ELECTRONIC_CIRCUIT,
|
||||
TRContent.Parts.ADVANCED_CIRCUIT,
|
||||
TRContent.Parts.INDUSTRIAL_CIRCUIT,
|
||||
TRContent.Parts.DATA_STORAGE_CORE,
|
||||
TRContent.Parts.DATA_STORAGE_CHIP,
|
||||
TRContent.Parts.ENERGY_FLOW_CHIP,
|
||||
TRContent.Parts.SUPERCONDUCTOR,
|
||||
TRContent.Parts.CUPRONICKEL_HEATING_COIL,
|
||||
TRContent.Parts.NICHROME_HEATING_COIL,
|
||||
TRContent.Parts.KANTHAL_HEATING_COIL,
|
||||
TRContent.Parts.NEUTRON_REFLECTOR,
|
||||
TRContent.Parts.THICK_NEUTRON_REFLECTOR,
|
||||
TRContent.Parts.IRIDIUM_NEUTRON_REFLECTOR,
|
||||
TRContent.Parts.DIAMOND_SAW_BLADE,
|
||||
TRContent.Parts.DIAMOND_GRINDING_HEAD,
|
||||
TRContent.Parts.TUNGSTEN_GRINDING_HEAD);
|
||||
entries.addBefore(Items.FIREWORK_STAR,
|
||||
TRContent.Parts.BASIC_DISPLAY,
|
||||
TRContent.Parts.DIGITAL_DISPLAY);
|
||||
// cell-parts
|
||||
entries.addAfter(Items.PHANTOM_MEMBRANE,
|
||||
TRContent.Parts.WATER_COOLANT_CELL_10K,
|
||||
TRContent.Parts.WATER_COOLANT_CELL_30K,
|
||||
TRContent.Parts.WATER_COOLANT_CELL_60K,
|
||||
TRContent.Parts.NAK_COOLANT_CELL_60K,
|
||||
TRContent.Parts.NAK_COOLANT_CELL_180K,
|
||||
TRContent.Parts.NAK_COOLANT_CELL_360K,
|
||||
TRContent.Parts.HELIUM_COOLANT_CELL_60K,
|
||||
TRContent.Parts.HELIUM_COOLANT_CELL_180K,
|
||||
TRContent.Parts.HELIUM_COOLANT_CELL_360K);
|
||||
}
|
||||
|
||||
private static void addContent(ItemConvertible[] items, FabricItemGroupEntries entries) {
|
||||
for (ItemConvertible item : items) {
|
||||
entries.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
private static void addCells(FabricItemGroupEntries entries) {
|
||||
entries.add(DynamicCellItem.getEmptyCell(1));
|
||||
for (Fluid fluid : FluidUtils.getAllFluids()) {
|
||||
if (fluid.isStill(fluid.getDefaultState())) {
|
||||
entries.add(DynamicCellItem.getCellWithFluid(fluid));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void addPoweredItem(Item item, FabricItemGroupEntries entries, ItemConvertible before, boolean includeUncharged) {
|
||||
ItemStack uncharged = new ItemStack(item);
|
||||
ItemStack charged = new ItemStack(item);
|
||||
RcEnergyItem energyItem = (RcEnergyItem) item;
|
||||
|
||||
energyItem.setStoredEnergy(charged, energyItem.getEnergyCapacity());
|
||||
|
||||
if (before == null) {
|
||||
if (includeUncharged) {
|
||||
entries.add(uncharged);
|
||||
}
|
||||
entries.add(charged);
|
||||
}
|
||||
else {
|
||||
if (includeUncharged) {
|
||||
entries.addBefore(before, uncharged, charged);
|
||||
}
|
||||
else {
|
||||
entries.addBefore(before, charged);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void addRockCutter(FabricItemGroupEntries entries, ItemConvertible before, boolean includeUncharged) {
|
||||
RockCutterItem rockCutter = (RockCutterItem) TRContent.ROCK_CUTTER;
|
||||
|
||||
ItemStack uncharged = new ItemStack(rockCutter);
|
||||
uncharged.addEnchantment(Enchantments.SILK_TOUCH, 1);
|
||||
ItemStack charged = new ItemStack(rockCutter);
|
||||
charged.addEnchantment(Enchantments.SILK_TOUCH, 1);
|
||||
rockCutter.setStoredEnergy(charged, rockCutter.getEnergyCapacity());
|
||||
|
||||
if (before == null) {
|
||||
if (includeUncharged) {
|
||||
entries.add(uncharged);
|
||||
}
|
||||
entries.add(charged);
|
||||
}
|
||||
else {
|
||||
if (includeUncharged) {
|
||||
entries.addBefore(before, uncharged, charged);
|
||||
}
|
||||
else {
|
||||
entries.addBefore(before, charged);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void addNanosaber(FabricItemGroupEntries entries, ItemConvertible before, boolean onlyPoweredAndActive) {
|
||||
NanosaberItem nanosaber = (NanosaberItem) TRContent.NANOSABER;
|
||||
|
||||
ItemStack inactiveUncharged = new ItemStack(nanosaber);
|
||||
inactiveUncharged.setNbt(new NbtCompound());
|
||||
inactiveUncharged.getOrCreateNbt().putBoolean("isActive", false);
|
||||
|
||||
ItemStack inactiveCharged = new ItemStack(TRContent.NANOSABER);
|
||||
inactiveCharged.setNbt(new NbtCompound());
|
||||
inactiveCharged.getOrCreateNbt().putBoolean("isActive", false);
|
||||
nanosaber.setStoredEnergy(inactiveCharged, nanosaber.getEnergyCapacity());
|
||||
|
||||
ItemStack activeCharged = new ItemStack(TRContent.NANOSABER);
|
||||
activeCharged.setNbt(new NbtCompound());
|
||||
activeCharged.getOrCreateNbt().putBoolean("isActive", true);
|
||||
nanosaber.setStoredEnergy(activeCharged, nanosaber.getEnergyCapacity());
|
||||
|
||||
if (before == null) {
|
||||
if (!onlyPoweredAndActive) {
|
||||
entries.add(inactiveUncharged);
|
||||
entries.add(inactiveCharged);
|
||||
}
|
||||
entries.add(activeCharged);
|
||||
}
|
||||
else {
|
||||
if (!onlyPoweredAndActive) {
|
||||
entries.addBefore(before, inactiveUncharged, inactiveCharged, activeCharged);
|
||||
}
|
||||
else {
|
||||
entries.addBefore(before, activeCharged);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +1,27 @@
|
|||
package techreborn.init;
|
||||
|
||||
import net.fabricmc.fabric.api.event.registry.DynamicRegistrySetupCallback;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.trade.TradeOfferHelper;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.villager.VillagerProfessionBuilder;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.world.poi.PointOfInterestHelper;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.structure.pool.StructurePool;
|
||||
import net.minecraft.structure.pool.StructurePoolElement;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.village.TradeOffer;
|
||||
import net.minecraft.village.VillagerProfession;
|
||||
import net.minecraft.world.poi.PointOfInterestType;
|
||||
import reborncore.common.util.TradeUtils;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class TRVillager {
|
||||
|
||||
|
@ -30,18 +35,18 @@ public class TRVillager {
|
|||
ELECTRICIAN_ID, 1, 1, TRContent.Machine.SOLID_FUEL_GENERATOR.block
|
||||
);
|
||||
|
||||
public static final VillagerProfession METALLURGIST_PROFESSION = Registry.register(Registry.VILLAGER_PROFESSION, METALLURGIST_ID,
|
||||
public static final VillagerProfession METALLURGIST_PROFESSION = Registry.register(Registries.VILLAGER_PROFESSION, METALLURGIST_ID,
|
||||
VillagerProfessionBuilder.create()
|
||||
.id(METALLURGIST_ID)
|
||||
.workstation(RegistryKey.of(Registry.POINT_OF_INTEREST_TYPE_KEY, METALLURGIST_ID))
|
||||
.workstation(RegistryKey.of(RegistryKeys.POINT_OF_INTEREST_TYPE, METALLURGIST_ID))
|
||||
.workSound(SoundEvents.ENTITY_VILLAGER_WORK_TOOLSMITH)
|
||||
.build()
|
||||
);
|
||||
|
||||
public static final VillagerProfession ELECTRICIAN_PROFESSION = Registry.register(Registry.VILLAGER_PROFESSION, ELECTRICIAN_ID,
|
||||
public static final VillagerProfession ELECTRICIAN_PROFESSION = Registry.register(Registries.VILLAGER_PROFESSION, ELECTRICIAN_ID,
|
||||
VillagerProfessionBuilder.create()
|
||||
.id(ELECTRICIAN_ID)
|
||||
.workstation(RegistryKey.of(Registry.POINT_OF_INTEREST_TYPE_KEY, ELECTRICIAN_ID))
|
||||
.workstation(RegistryKey.of(RegistryKeys.POINT_OF_INTEREST_TYPE, ELECTRICIAN_ID))
|
||||
.workSound(ModSounds.CABLE_SHOCK)
|
||||
.build()
|
||||
);
|
||||
|
@ -105,10 +110,28 @@ public class TRVillager {
|
|||
extraCommonTrades.add(TradeUtils.createSell(TRContent.RUBBER_SAPLING, 5, 1, 8, 1));
|
||||
// registration of the trades, no changes necessary for new trades
|
||||
TradeOfferHelper.registerWanderingTraderOffers(1, allTradesList -> allTradesList.addAll(
|
||||
extraCommonTrades.stream().map(TradeUtils::asFactory).collect(Collectors.toList())
|
||||
extraCommonTrades.stream().map(TradeUtils::asFactory).toList()
|
||||
));
|
||||
TradeOfferHelper.registerWanderingTraderOffers(2, allTradesList -> allTradesList.addAll(
|
||||
extraRareTrades.stream().map(TradeUtils::asFactory).collect(Collectors.toList())
|
||||
extraRareTrades.stream().map(TradeUtils::asFactory).toList()
|
||||
));
|
||||
}
|
||||
|
||||
public static void registerVillagerHouses() {
|
||||
final String[] types = new String[] {"desert", "plains", "savanna", "snowy", "taiga"};
|
||||
for (String type : types) {
|
||||
DynamicRegistrySetupCallback.EVENT.register(registryManager ->
|
||||
registryManager.registerEntryAdded(RegistryKeys.TEMPLATE_POOL, ((rawId, id, pool) -> {
|
||||
if (id.equals(new Identifier("minecraft", "village/"+type+"/houses"))) {
|
||||
if (TechRebornConfig.enableMetallurgistGeneration) {
|
||||
pool.elements.add(StructurePoolElement.ofSingle(TechReborn.MOD_ID + ":village/" + type + "/houses/" + type + "_metallurgist").apply(StructurePool.Projection.RIGID));
|
||||
}
|
||||
if (TechRebornConfig.enableElectricianGeneration) {
|
||||
pool.elements.add(StructurePoolElement.ofSingle(TechReborn.MOD_ID + ":village/" + type + "/houses/" + type + "_electrician").apply(StructurePool.Projection.RIGID));
|
||||
}
|
||||
}
|
||||
}))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,9 +24,13 @@
|
|||
|
||||
package techreborn.init.template;
|
||||
|
||||
import com.google.gson.*;
|
||||
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 net.minecraft.block.Block;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
|
@ -51,7 +55,7 @@ public class TemplateProcessor {
|
|||
public void processSimpleBlocks(String template, List<Block> blocks) throws IOException {
|
||||
for (Block block : blocks) {
|
||||
Map<String, String> values = new HashMap<>();
|
||||
values.put("name", Registry.BLOCK.getId(block).getPath());
|
||||
values.put("name", Registries.BLOCK.getId(block).getPath());
|
||||
|
||||
process(template, values);
|
||||
}
|
||||
|
|
|
@ -28,20 +28,16 @@ import net.minecraft.client.item.TooltipContext;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.TypedActionResult;
|
||||
import net.minecraft.util.collection.DefaultedList;
|
||||
import net.minecraft.world.World;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import reborncore.common.powerSystem.RcEnergyItem;
|
||||
import reborncore.common.powerSystem.RcEnergyTier;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -51,7 +47,7 @@ public class BatteryItem extends Item implements RcEnergyItem {
|
|||
private final RcEnergyTier tier;
|
||||
|
||||
public BatteryItem(int maxEnergy, RcEnergyTier tier) {
|
||||
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
|
||||
super(new Item.Settings().maxCount(1));
|
||||
this.maxEnergy = maxEnergy;
|
||||
this.tier = tier;
|
||||
}
|
||||
|
@ -86,14 +82,6 @@ public class BatteryItem extends Item implements RcEnergyItem {
|
|||
ItemUtils.buildActiveTooltip(stack, tooltip);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> stacks) {
|
||||
if (!isIn(group)) {
|
||||
return;
|
||||
}
|
||||
InitUtils.initPoweredItems(this, stacks);
|
||||
}
|
||||
|
||||
// EnergyHolder
|
||||
@Override
|
||||
public long getEnergyCapacity() {
|
||||
|
|
|
@ -40,25 +40,23 @@ import net.minecraft.fluid.FlowableFluid;
|
|||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUsage;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.tag.FluidTags;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.sound.SoundEvent;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.tag.FluidTags;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.TypedActionResult;
|
||||
import net.minecraft.util.collection.DefaultedList;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.hit.HitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.RaycastContext;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
|
@ -68,7 +66,6 @@ import org.jetbrains.annotations.Nullable;
|
|||
import reborncore.common.fluid.FluidUtils;
|
||||
import reborncore.common.fluid.container.ItemFluidInfo;
|
||||
import reborncore.common.util.ItemNBTHelper;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
/**
|
||||
|
@ -77,7 +74,7 @@ import techreborn.init.TRContent;
|
|||
public class DynamicCellItem extends Item implements ItemFluidInfo {
|
||||
|
||||
public DynamicCellItem() {
|
||||
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(16));
|
||||
super(new Item.Settings().maxCount(16));
|
||||
}
|
||||
|
||||
// Thanks vanilla :)
|
||||
|
@ -90,7 +87,7 @@ public class DynamicCellItem extends Item implements ItemFluidInfo {
|
|||
public static ItemStack getCellWithFluid(Fluid fluid, int stackSize) {
|
||||
Validate.notNull(fluid);
|
||||
ItemStack stack = new ItemStack(TRContent.CELL);
|
||||
ItemNBTHelper.getNBT(stack).putString("fluid", Registry.FLUID.getId(fluid).toString());
|
||||
ItemNBTHelper.getNBT(stack).putString("fluid", Registries.FLUID.getId(fluid).toString());
|
||||
stack.setCount(stackSize);
|
||||
return stack;
|
||||
}
|
||||
|
@ -148,19 +145,6 @@ public class DynamicCellItem extends Item implements ItemFluidInfo {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendStacks(ItemGroup tab, DefaultedList<ItemStack> subItems) {
|
||||
if (!isIn(tab)) {
|
||||
return;
|
||||
}
|
||||
subItems.add(getEmptyCell(1));
|
||||
for (Fluid fluid : FluidUtils.getAllFluids()) {
|
||||
if (fluid.isStill(fluid.getDefaultState())) {
|
||||
subItems.add(getCellWithFluid(fluid));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Text getName(ItemStack itemStack) {
|
||||
Fluid fluid = getFluid(itemStack);
|
||||
|
@ -253,7 +237,7 @@ public class DynamicCellItem extends Item implements ItemFluidInfo {
|
|||
|
||||
private Fluid getFluid(@Nullable NbtCompound tag) {
|
||||
if (tag != null && tag.contains("fluid")) {
|
||||
return Registry.FLUID.get(new Identifier(tag.getString("fluid")));
|
||||
return Registries.FLUID.get(new Identifier(tag.getString("fluid")));
|
||||
}
|
||||
return Fluids.EMPTY;
|
||||
}
|
||||
|
|
|
@ -30,16 +30,19 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUsageContext;
|
||||
import net.minecraft.nbt.NbtOps;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.TypedActionResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.GlobalPos;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.world.World;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import reborncore.common.chunkloading.ChunkLoaderManager;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -47,7 +50,7 @@ import java.util.Optional;
|
|||
public class FrequencyTransmitterItem extends Item {
|
||||
|
||||
public FrequencyTransmitterItem() {
|
||||
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
|
||||
super(new Item.Settings().maxCount(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -35,12 +35,11 @@ import net.minecraft.util.Hand;
|
|||
import net.minecraft.util.TypedActionResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
public class GpsItem extends Item {
|
||||
|
||||
public GpsItem() {
|
||||
super(new Settings().group(TechReborn.ITEMGROUP));
|
||||
super(new Settings());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -33,13 +33,12 @@ import net.minecraft.util.Hand;
|
|||
import net.minecraft.util.TypedActionResult;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.common.network.NetworkManager;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.packets.ClientboundPackets;
|
||||
|
||||
public class ManualItem extends Item {
|
||||
|
||||
public ManualItem() {
|
||||
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
|
||||
super(new Item.Settings().maxCount(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -41,7 +41,7 @@ import java.util.List;
|
|||
public class ScrapBoxItem extends Item {
|
||||
|
||||
public ScrapBoxItem() {
|
||||
super(new Item.Settings().group(TechReborn.ITEMGROUP));
|
||||
super(new Item.Settings());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -39,7 +39,7 @@ public class UpgradeItem extends Item implements IUpgrade {
|
|||
public final IUpgrade behavior;
|
||||
|
||||
public UpgradeItem(String name, IUpgrade process) {
|
||||
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(16));
|
||||
super(new Item.Settings().maxCount(16));
|
||||
this.name = name;
|
||||
this.behavior = process;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import net.minecraft.util.ActionResult;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.common.blockentity.MachineBaseBlockEntity;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.blockentity.storage.fluid.TankUnitBaseBlockEntity;
|
||||
import techreborn.blockentity.storage.item.StorageUnitBaseBlockEntity;
|
||||
import techreborn.init.TRContent.StorageUnit;
|
||||
|
@ -19,7 +18,7 @@ import techreborn.init.TRContent.TankUnit;
|
|||
public class UpgraderItem extends Item {
|
||||
|
||||
public UpgraderItem() {
|
||||
super(new Item.Settings().group(TechReborn.ITEMGROUP));
|
||||
super(new Item.Settings());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -36,7 +36,6 @@ import net.minecraft.world.World;
|
|||
import reborncore.common.powerSystem.RcEnergyItem;
|
||||
import reborncore.common.powerSystem.RcEnergyTier;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class BatpackItem extends ArmorItem implements RcEnergyItem {
|
||||
|
@ -45,7 +44,7 @@ public class BatpackItem extends ArmorItem implements RcEnergyItem {
|
|||
public final RcEnergyTier tier;
|
||||
|
||||
public BatpackItem(int maxCharge, ArmorMaterial material, RcEnergyTier tier) {
|
||||
super(material, EquipmentSlot.CHEST, new Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
||||
super(material, EquipmentSlot.CHEST, new Settings().maxCount(1).maxDamage(-1));
|
||||
this.maxCharge = maxCharge;
|
||||
this.tier = tier;
|
||||
}
|
||||
|
@ -71,14 +70,6 @@ public class BatpackItem extends ArmorItem implements RcEnergyItem {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> itemList) {
|
||||
if (!isIn(group)) {
|
||||
return;
|
||||
}
|
||||
InitUtils.initPoweredItems(this, itemList);
|
||||
}
|
||||
|
||||
// EnergyHolder
|
||||
@Override
|
||||
public long getEnergyCapacity() {
|
||||
|
|
|
@ -48,7 +48,7 @@ public class CloakingDeviceItem extends TRArmourItem implements RcEnergyItem, Ar
|
|||
|
||||
// 40M FE capacity with 10k FE\t charge rate
|
||||
public CloakingDeviceItem() {
|
||||
super(TRArmorMaterials.CLOAKING_DEVICE, EquipmentSlot.CHEST, new Item.Settings().group(TechReborn.ITEMGROUP).maxDamage(-1).maxCount(1));
|
||||
super(TRArmorMaterials.CLOAKING_DEVICE, EquipmentSlot.CHEST, new Item.Settings().maxDamage(-1).maxCount(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -77,15 +77,6 @@ public class CloakingDeviceItem extends TRArmourItem implements RcEnergyItem, Ar
|
|||
return ItemUtils.getColorForDurabilityBar(stack);
|
||||
}
|
||||
|
||||
// Item
|
||||
@Override
|
||||
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> itemList) {
|
||||
if (!isIn(group)) {
|
||||
return;
|
||||
}
|
||||
InitUtils.initPoweredItems(this, itemList);
|
||||
}
|
||||
|
||||
// EnergyHolder
|
||||
@Override
|
||||
public long getEnergyCapacity() {
|
||||
|
|
|
@ -37,17 +37,13 @@ import net.minecraft.entity.effect.StatusEffects;
|
|||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ArmorMaterial;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.collection.DefaultedList;
|
||||
import reborncore.api.items.ArmorBlockEntityTicker;
|
||||
import reborncore.api.items.ArmorRemoveHandler;
|
||||
import reborncore.common.powerSystem.RcEnergyItem;
|
||||
import reborncore.common.powerSystem.RcEnergyTier;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class QuantumSuitItem extends TRArmourItem implements ArmorBlockEntityTicker, ArmorRemoveHandler, RcEnergyItem {
|
||||
|
||||
|
@ -62,7 +58,7 @@ public class QuantumSuitItem extends TRArmourItem implements ArmorBlockEntityTic
|
|||
|
||||
|
||||
public QuantumSuitItem(ArmorMaterial material, EquipmentSlot slot) {
|
||||
super(material, slot, new Item.Settings().group(TechReborn.ITEMGROUP).maxDamage(-1).maxCount(1));
|
||||
super(material, slot, new Item.Settings().maxDamage(-1).maxCount(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -178,12 +174,4 @@ public class QuantumSuitItem extends TRArmourItem implements ArmorBlockEntityTic
|
|||
public RcEnergyTier getTier() {
|
||||
return RcEnergyTier.EXTREME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> itemList) {
|
||||
if (!isIn(group)) {
|
||||
return;
|
||||
}
|
||||
InitUtils.initPoweredItems(this, itemList);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ import net.minecraft.entity.EquipmentSlot;
|
|||
import net.minecraft.item.ArmorItem;
|
||||
import net.minecraft.item.ArmorMaterial;
|
||||
import net.minecraft.item.Item;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -46,7 +45,7 @@ public class TRArmourItem extends ArmorItem {
|
|||
};
|
||||
|
||||
public TRArmourItem(ArmorMaterial material, EquipmentSlot slot) {
|
||||
this(material, slot, new Item.Settings().group(TechReborn.ITEMGROUP));
|
||||
this(material, slot, new Item.Settings());
|
||||
}
|
||||
|
||||
public TRArmourItem(ArmorMaterial material, EquipmentSlot slot, Item.Settings settings) {
|
||||
|
|
|
@ -28,16 +28,16 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.enchantment.Enchantments;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.tag.BlockTags;
|
||||
import net.minecraft.util.collection.DefaultedList;
|
||||
import net.minecraft.item.AxeItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ToolMaterial;
|
||||
import net.minecraft.registry.tag.BlockTags;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.common.powerSystem.RcEnergyItem;
|
||||
import reborncore.common.powerSystem.RcEnergyTier;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class ChainsawItem extends AxeItem implements RcEnergyItem {
|
||||
|
||||
|
@ -50,7 +50,7 @@ public class ChainsawItem extends AxeItem implements RcEnergyItem {
|
|||
|
||||
public ChainsawItem(ToolMaterial material, int energyCapacity, RcEnergyTier tier, int cost, float poweredSpeed, float unpoweredSpeed, Item referenceTool) {
|
||||
// combat stats same as for diamond axe. Fix for #2468
|
||||
super(material, 5.0F, -3.0F, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
||||
super(material, 5.0F, -3.0F, new Item.Settings().maxCount(1).maxDamage(-1));
|
||||
this.maxCharge = energyCapacity;
|
||||
this.tier = tier;
|
||||
this.cost = cost;
|
||||
|
@ -112,14 +112,6 @@ public class ChainsawItem extends AxeItem implements RcEnergyItem {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> stacks) {
|
||||
if (!isIn(group)) {
|
||||
return;
|
||||
}
|
||||
InitUtils.initPoweredItems(this, stacks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemBarStep(ItemStack stack) {
|
||||
return ItemUtils.getPowerForDurabilityBar(stack);
|
||||
|
|
|
@ -30,16 +30,15 @@ import net.minecraft.block.entity.BlockEntity;
|
|||
import net.minecraft.command.BlockDataObject;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemUsageContext;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.state.property.Property;
|
||||
import net.minecraft.text.MutableText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import team.reborn.energy.api.EnergyStorage;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
|
||||
|
@ -49,7 +48,7 @@ import java.util.Map.Entry;
|
|||
public class DebugToolItem extends Item {
|
||||
|
||||
public DebugToolItem() {
|
||||
super(new Item.Settings().group(TechReborn.ITEMGROUP));
|
||||
super(new Item.Settings());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -109,7 +108,7 @@ public class DebugToolItem extends Item {
|
|||
String s = "" + Formatting.GREEN;
|
||||
s += "Block Registry Name: ";
|
||||
s += Formatting.BLUE;
|
||||
s += Registry.BLOCK.getId(block);
|
||||
s += Registries.BLOCK.getId(block);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
|
@ -29,20 +29,16 @@ import net.minecraft.enchantment.EnchantmentHelper;
|
|||
import net.minecraft.enchantment.Enchantments;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.MiningToolItem;
|
||||
import net.minecraft.item.ToolMaterial;
|
||||
import net.minecraft.util.collection.DefaultedList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.common.powerSystem.RcEnergyItem;
|
||||
import reborncore.common.powerSystem.RcEnergyTier;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class DrillItem extends MiningToolItem implements RcEnergyItem {
|
||||
public final int maxCharge;
|
||||
|
@ -54,7 +50,7 @@ public class DrillItem extends MiningToolItem implements RcEnergyItem {
|
|||
|
||||
public DrillItem(ToolMaterial material, int energyCapacity, RcEnergyTier tier, int cost, float poweredSpeed, float unpoweredSpeed, MiningLevel miningLevel) {
|
||||
// combat stats same as for diamond pickaxe. Fix for #2468
|
||||
super(1, -2.8F, material, TRContent.BlockTags.DRILL_MINEABLE, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
||||
super(1, -2.8F, material, TRContent.BlockTags.DRILL_MINEABLE, new Item.Settings().maxCount(1).maxDamage(-1));
|
||||
this.maxCharge = energyCapacity;
|
||||
this.cost = cost;
|
||||
this.poweredSpeed = poweredSpeed;
|
||||
|
@ -125,14 +121,6 @@ public class DrillItem extends MiningToolItem implements RcEnergyItem {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> stacks) {
|
||||
if (!isIn(group)) {
|
||||
return;
|
||||
}
|
||||
InitUtils.initPoweredItems(this, stacks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemBarStep(ItemStack stack) {
|
||||
return ItemUtils.getPowerForDurabilityBar(stack);
|
||||
|
|
|
@ -48,7 +48,7 @@ public class JackhammerItem extends PickaxeItem implements RcEnergyItem {
|
|||
|
||||
public JackhammerItem(ToolMaterial material, int energyCapacity, RcEnergyTier tier, int cost) {
|
||||
// combat stats same as for diamond pickaxe. Fix for #2468
|
||||
super(material, 1, -2.8F, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
||||
super(material, 1, -2.8F, new Item.Settings().maxCount(1).maxDamage(-1));
|
||||
this.maxCharge = energyCapacity;
|
||||
this.tier = tier;
|
||||
this.cost = cost;
|
||||
|
@ -111,14 +111,6 @@ public class JackhammerItem extends PickaxeItem implements RcEnergyItem {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> stacks) {
|
||||
if (!isIn(group)) {
|
||||
return;
|
||||
}
|
||||
InitUtils.initPoweredItems(this, stacks);
|
||||
}
|
||||
|
||||
// EnergyHolder
|
||||
@Override
|
||||
public long getEnergyCapacity() {
|
||||
|
|
|
@ -39,6 +39,7 @@ import net.minecraft.util.ActionResult;
|
|||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.world.World;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import reborncore.common.util.WorldUtils;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.blockentity.cable.CableBlockEntity;
|
||||
import techreborn.blocks.cable.CableBlock;
|
||||
|
@ -49,7 +50,7 @@ import java.util.List;
|
|||
public class PaintingToolItem extends Item {
|
||||
|
||||
public PaintingToolItem() {
|
||||
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamageIfAbsent(64));
|
||||
super(new Item.Settings().maxCount(1).maxDamageIfAbsent(64));
|
||||
}
|
||||
|
||||
public ActionResult useOnBlock(ItemUsageContext context) {
|
||||
|
@ -69,7 +70,7 @@ public class PaintingToolItem extends Item {
|
|||
}
|
||||
return ActionResult.FAIL;
|
||||
} else {
|
||||
BlockState cover = getCover(context.getStack());
|
||||
BlockState cover = getCover(context.getWorld(), context.getStack());
|
||||
if (cover != null && blockState.getBlock() instanceof CableBlock && blockState.get(CableBlock.COVERED)) {
|
||||
BlockEntity blockEntity = context.getWorld().getBlockEntity(context.getBlockPos());
|
||||
if (blockEntity == null) {
|
||||
|
@ -89,15 +90,15 @@ public class PaintingToolItem extends Item {
|
|||
return ActionResult.FAIL;
|
||||
}
|
||||
|
||||
public static BlockState getCover(ItemStack stack) {
|
||||
public static BlockState getCover(World world, ItemStack stack) {
|
||||
if (stack.hasNbt() && stack.getOrCreateNbt().contains("cover")) {
|
||||
return NbtHelper.toBlockState(stack.getOrCreateNbt().getCompound("cover"));
|
||||
return NbtHelper.toBlockState(WorldUtils.getBlockRegistryWrapper(world), stack.getOrCreateNbt().getCompound("cover"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context) {
|
||||
BlockState blockState = getCover(stack);
|
||||
BlockState blockState = getCover(world, stack);
|
||||
if (blockState != null) {
|
||||
tooltip.add((Text.translatable(blockState.getBlock().getTranslationKey())).formatted(Formatting.GRAY));
|
||||
tooltip.add((Text.translatable("techreborn.tooltip.painting_tool.apply")).formatted(Formatting.GOLD));
|
||||
|
|
|
@ -25,11 +25,10 @@
|
|||
package techreborn.items.tool;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
public class TreeTapItem extends Item {
|
||||
|
||||
public TreeTapItem() {
|
||||
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamageIfAbsent(20));
|
||||
super(new Item.Settings().maxCount(1).maxDamageIfAbsent(20));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.api.IToolHandler;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 26/02/2016.
|
||||
|
@ -40,7 +39,7 @@ import techreborn.TechReborn;
|
|||
public class WrenchItem extends Item implements IToolHandler {
|
||||
|
||||
public WrenchItem() {
|
||||
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
|
||||
super(new Item.Settings().maxCount(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -45,7 +45,7 @@ public class ElectricTreetapItem extends Item implements RcEnergyItem {
|
|||
public RcEnergyTier tier = RcEnergyTier.MEDIUM;
|
||||
|
||||
public ElectricTreetapItem() {
|
||||
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
||||
super(new Item.Settings().maxCount(1).maxDamage(-1));
|
||||
}
|
||||
|
||||
// Item
|
||||
|
@ -54,14 +54,6 @@ public class ElectricTreetapItem extends Item implements RcEnergyItem {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> stacks) {
|
||||
if (!isIn(group)) {
|
||||
return;
|
||||
}
|
||||
InitUtils.initPoweredItems(this, stacks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemBarStep(ItemStack stack) {
|
||||
return ItemUtils.getPowerForDurabilityBar(stack);
|
||||
|
|
|
@ -29,16 +29,16 @@ import net.minecraft.enchantment.EnchantmentHelper;
|
|||
import net.minecraft.enchantment.Enchantments;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.util.collection.DefaultedList;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.PickaxeItem;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.common.powerSystem.RcEnergyItem;
|
||||
import reborncore.common.powerSystem.RcEnergyTier;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.init.TRToolMaterials;
|
||||
|
||||
public class RockCutterItem extends PickaxeItem implements RcEnergyItem {
|
||||
|
@ -49,7 +49,7 @@ public class RockCutterItem extends PickaxeItem implements RcEnergyItem {
|
|||
// 10k Energy with 128 E\t charge rate
|
||||
public RockCutterItem() {
|
||||
// combat stats same as for diamond pickaxe. Fix for #2468
|
||||
super(TRToolMaterials.ROCK_CUTTER, 1, -2.8f, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
||||
super(TRToolMaterials.ROCK_CUTTER, 1, -2.8f, new Item.Settings().maxCount(1).maxDamage(-1));
|
||||
}
|
||||
|
||||
// PickaxeItem
|
||||
|
@ -105,21 +105,6 @@ public class RockCutterItem extends PickaxeItem implements RcEnergyItem {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> stacks) {
|
||||
if (!isIn(group)) {
|
||||
return;
|
||||
}
|
||||
ItemStack uncharged = new ItemStack(this);
|
||||
uncharged.addEnchantment(Enchantments.SILK_TOUCH, 1);
|
||||
ItemStack charged = new ItemStack(TRContent.ROCK_CUTTER);
|
||||
charged.addEnchantment(Enchantments.SILK_TOUCH, 1);
|
||||
setStoredEnergy(charged, getEnergyCapacity());
|
||||
|
||||
stacks.add(uncharged);
|
||||
stacks.add(charged);
|
||||
}
|
||||
|
||||
// ItemDurabilityExtensions
|
||||
@Override
|
||||
public int getItemBarStep(ItemStack stack) {
|
||||
|
|
|
@ -31,7 +31,7 @@ import net.minecraft.entity.LivingEntity;
|
|||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.tag.BlockTags;
|
||||
import net.minecraft.registry.tag.BlockTags;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
|
|
|
@ -114,12 +114,4 @@ public class IndustrialDrillItem extends DrillItem {
|
|||
public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Text> tooltip, TooltipContext flagIn) {
|
||||
ItemUtils.buildActiveTooltip(stack, tooltip);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendStacks(ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
|
||||
if (!isIn(par2ItemGroup)) {
|
||||
return;
|
||||
}
|
||||
InitUtils.initPoweredItems(TRContent.INDUSTRIAL_DRILL, itemList);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,23 +38,18 @@ import net.minecraft.entity.attribute.EntityAttributeModifier;
|
|||
import net.minecraft.entity.attribute.EntityAttributes;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.SwordItem;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.TypedActionResult;
|
||||
import net.minecraft.util.collection.DefaultedList;
|
||||
import net.minecraft.world.World;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import reborncore.common.powerSystem.RcEnergyItem;
|
||||
import reborncore.common.powerSystem.RcEnergyTier;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.init.TRToolMaterials;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -65,7 +60,7 @@ public class NanosaberItem extends SwordItem implements RcEnergyItem {
|
|||
|
||||
// 4ME max charge with 1k charge rate
|
||||
public NanosaberItem() {
|
||||
super(TRToolMaterials.NANOSABER, 1, 1, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
||||
super(TRToolMaterials.NANOSABER, 1, 1, new Item.Settings().maxCount(1).maxDamage(-1));
|
||||
}
|
||||
|
||||
// SwordItem
|
||||
|
@ -106,31 +101,6 @@ public class NanosaberItem extends SwordItem implements RcEnergyItem {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendStacks(
|
||||
ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
|
||||
if (!isIn(par2ItemGroup)) {
|
||||
return;
|
||||
}
|
||||
ItemStack inactiveUncharged = new ItemStack(this);
|
||||
inactiveUncharged.setNbt(new NbtCompound());
|
||||
inactiveUncharged.getOrCreateNbt().putBoolean("isActive", false);
|
||||
|
||||
ItemStack inactiveCharged = new ItemStack(TRContent.NANOSABER);
|
||||
inactiveCharged.setNbt(new NbtCompound());
|
||||
inactiveCharged.getOrCreateNbt().putBoolean("isActive", false);
|
||||
setStoredEnergy(inactiveCharged, getEnergyCapacity());
|
||||
|
||||
ItemStack activeCharged = new ItemStack(TRContent.NANOSABER);
|
||||
activeCharged.setNbt(new NbtCompound());
|
||||
activeCharged.getOrCreateNbt().putBoolean("isActive", true);
|
||||
setStoredEnergy(activeCharged, getEnergyCapacity());
|
||||
|
||||
itemList.add(inactiveUncharged);
|
||||
itemList.add(inactiveCharged);
|
||||
itemList.add(activeCharged);
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Override
|
||||
public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Text> tooltip, TooltipContext flagIn) {
|
||||
|
|
|
@ -57,7 +57,7 @@ public class OmniToolItem extends MiningToolItem implements RcEnergyItem {
|
|||
|
||||
// 4M FE max charge with 1k charge rate
|
||||
public OmniToolItem() {
|
||||
super(3, 1, TRToolMaterials.OMNI_TOOL, TRContent.BlockTags.OMNI_TOOL_MINEABLE, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
||||
super(3, 1, TRToolMaterials.OMNI_TOOL, TRContent.BlockTags.OMNI_TOOL_MINEABLE, new Item.Settings().maxCount(1).maxDamage(-1));
|
||||
this.miningLevel = MiningLevel.DIAMOND.intLevel;
|
||||
}
|
||||
|
||||
|
@ -114,14 +114,6 @@ public class OmniToolItem extends MiningToolItem implements RcEnergyItem {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendStacks(ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
|
||||
if (!isIn(par2ItemGroup)) {
|
||||
return;
|
||||
}
|
||||
InitUtils.initPoweredItems(TRContent.OMNI_TOOL, itemList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemBarStep(ItemStack stack) {
|
||||
return ItemUtils.getPowerForDurabilityBar(stack);
|
||||
|
|
|
@ -29,7 +29,6 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ToolMaterial;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
public class TRAxeItem extends AxeItem {
|
||||
|
||||
|
@ -40,7 +39,7 @@ public class TRAxeItem extends AxeItem {
|
|||
}
|
||||
|
||||
public TRAxeItem(ToolMaterial material, String repairOreDict) {
|
||||
super(material, material.getAttackDamage(), -3.0F, new Item.Settings().group(TechReborn.ITEMGROUP));
|
||||
super(material, material.getAttackDamage(), -3.0F, new Item.Settings());
|
||||
this.repairOreDict = repairOreDict;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ public class TRHoeItem extends HoeItem {
|
|||
}
|
||||
|
||||
public TRHoeItem(ToolMaterial material, String repairOreDict) {
|
||||
super(material, 0, 0F, new Item.Settings().group(TechReborn.ITEMGROUP));
|
||||
super(material, 0, 0F, new Item.Settings());
|
||||
this.repairOreDict = repairOreDict;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.item.PickaxeItem;
|
||||
import net.minecraft.item.ToolMaterial;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
public class TRPickaxeItem extends PickaxeItem {
|
||||
|
||||
|
@ -40,7 +39,7 @@ public class TRPickaxeItem extends PickaxeItem {
|
|||
}
|
||||
|
||||
public TRPickaxeItem(ToolMaterial material, String repairOreDict) {
|
||||
super(material, 1, -2.8F, new Item.Settings().group(TechReborn.ITEMGROUP));
|
||||
super(material, 1, -2.8F, new Item.Settings());
|
||||
this.repairOreDict = repairOreDict;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ public class TRSpadeItem extends ShovelItem {
|
|||
}
|
||||
|
||||
public TRSpadeItem(ToolMaterial material, String repairOreDict) {
|
||||
super(material, 1.5F, -3.0F, new Item.Settings().group(TechReborn.ITEMGROUP));
|
||||
super(material, 1.5F, -3.0F, new Item.Settings());
|
||||
this.repairOreDict = repairOreDict;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.item.SwordItem;
|
||||
import net.minecraft.item.ToolMaterial;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
public class TRSwordItem extends SwordItem {
|
||||
|
||||
|
@ -40,7 +39,7 @@ public class TRSwordItem extends SwordItem {
|
|||
}
|
||||
|
||||
public TRSwordItem(ToolMaterial material, String repairOreDict) {
|
||||
super(material, 3, -2.4F, new Item.Settings().group(TechReborn.ITEMGROUP));
|
||||
super(material, 3, -2.4F, new Item.Settings());
|
||||
this.repairOreDict = repairOreDict;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
package techreborn.utils;
|
||||
|
||||
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroupEntries;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -31,11 +32,12 @@ import net.minecraft.block.MapColor;
|
|||
import net.minecraft.block.Material;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.sound.SoundEvent;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.collection.DefaultedList;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registry;
|
||||
import reborncore.RebornRegistry;
|
||||
import reborncore.common.powerSystem.RcEnergyItem;
|
||||
import techreborn.TechReborn;
|
||||
|
@ -53,18 +55,7 @@ public class InitUtils {
|
|||
|
||||
public static SoundEvent setup(String name) {
|
||||
Identifier identifier = new Identifier(TechReborn.MOD_ID, name);
|
||||
return Registry.register(Registry.SOUND_EVENT, identifier, new SoundEvent(identifier));
|
||||
}
|
||||
|
||||
public static void initPoweredItems(Item item, DefaultedList<ItemStack> itemList) {
|
||||
ItemStack uncharged = new ItemStack(item);
|
||||
ItemStack charged = new ItemStack(item);
|
||||
RcEnergyItem energyItem = (RcEnergyItem) item;
|
||||
|
||||
energyItem.setStoredEnergy(charged, energyItem.getEnergyCapacity());
|
||||
|
||||
itemList.add(uncharged);
|
||||
itemList.add(charged);
|
||||
return Registry.register(Registries.SOUND_EVENT, identifier, SoundEvent.of(identifier));
|
||||
}
|
||||
|
||||
public static AbstractBlock.Settings setupRubberBlockSettings(boolean noCollision, float hardness, float resistance) {
|
||||
|
|
110
src/main/java/techreborn/utils/MaterialComparator.java
Normal file
110
src/main/java/techreborn/utils/MaterialComparator.java
Normal file
|
@ -0,0 +1,110 @@
|
|||
package techreborn.utils;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public class MaterialComparator implements Comparator<Enum<?>> {
|
||||
|
||||
private static final List<String> ORDER = List.of(
|
||||
"SAW",
|
||||
"WOOD",
|
||||
"ASHES",
|
||||
"DARK_ASHES",
|
||||
"ANDESITE",
|
||||
"DIORITE",
|
||||
"GRANITE",
|
||||
"BASALT",
|
||||
"CALCITE",
|
||||
"MARBLE",
|
||||
"COAL",
|
||||
"CARBON",
|
||||
"CARBON_FIBER",
|
||||
"CHARCOAL",
|
||||
"CLAY",
|
||||
"FLINT",
|
||||
"SILICON",
|
||||
"TIN",
|
||||
"ZINC",
|
||||
"IRON",
|
||||
"REFINED_IRON",
|
||||
"STEEL",
|
||||
"COPPER",
|
||||
"LEAD",
|
||||
"NICKEL",
|
||||
"BRONZE",
|
||||
"BRASS",
|
||||
"MIXED_METAL",
|
||||
"ADVANCED_ALLOY",
|
||||
"INVAR",
|
||||
"SILVER",
|
||||
"GOLD",
|
||||
"ELECTRUM",
|
||||
"GALENA",
|
||||
"BAUXITE",
|
||||
"ALUMINUM",
|
||||
"TITANIUM",
|
||||
"CHROME",
|
||||
"REDSTONE",
|
||||
"RUBY",
|
||||
"SAPPHIRE",
|
||||
"PERIDOT",
|
||||
"RED_GARNET",
|
||||
"YELLOW_GARNET",
|
||||
"EMERALD",
|
||||
"AMETHYST",
|
||||
"LAPIS",
|
||||
"LAZURITE",
|
||||
"DIAMOND",
|
||||
"IRIDIUM",
|
||||
"IRIDIUM_ALLOY",
|
||||
"PLATINUM",
|
||||
"OBSIDIAN",
|
||||
"NETHERRACK",
|
||||
"GLOWSTONE",
|
||||
"QUARTZ",
|
||||
"CINNABAR",
|
||||
"PYRITE",
|
||||
"PYROPE",
|
||||
"SPHALERITE",
|
||||
"ALMANDINE",
|
||||
"ANDRADITE",
|
||||
"GROSSULAR",
|
||||
"SPESSARTINE",
|
||||
"MAGNESIUM",
|
||||
"MANGANESE",
|
||||
"MAGNALIUM",
|
||||
"PHOSPHOROUS",
|
||||
"SULFUR",
|
||||
"SALTPETER",
|
||||
"OLIVINE",
|
||||
"UVAROVITE",
|
||||
"ENDER_PEARL",
|
||||
"ENDER_EYE",
|
||||
"ENDSTONE",
|
||||
"SODALITE",
|
||||
"SHELDONITE",
|
||||
"TUNGSTEN",
|
||||
"TUNGSTENSTEEL",
|
||||
"HOT_TUNGSTENSTEEL",
|
||||
"IRIDIUM_REINFORCED_STONE",
|
||||
"IRIDIUM_REINFORCED_TUNGSTENSTEEL",
|
||||
"NETHERITE"
|
||||
);
|
||||
|
||||
@Override
|
||||
public int compare(Enum<?> o1, Enum<?> o2) {
|
||||
if (o1 == o2) {
|
||||
return 0;
|
||||
}
|
||||
if (o1 == null) {
|
||||
return Integer.MIN_VALUE;
|
||||
}
|
||||
if (o2 == null) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
if (o1.name().equals(o2.name())) {
|
||||
return 0;
|
||||
}
|
||||
return ORDER.indexOf(o1.name()) - ORDER.indexOf(o2.name());
|
||||
}
|
||||
}
|
38
src/main/java/techreborn/utils/MaterialTypeComparator.java
Normal file
38
src/main/java/techreborn/utils/MaterialTypeComparator.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
package techreborn.utils;
|
||||
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public class MaterialTypeComparator implements Comparator<Enum<?>> {
|
||||
|
||||
private static final List<String> ORDER = List.of(
|
||||
TRContent.Ores.class.getName(),
|
||||
TRContent.Nuggets.class.getName(),
|
||||
TRContent.SmallDusts.class.getName(),
|
||||
TRContent.Dusts.class.getName(),
|
||||
TRContent.RawMetals.class.getName(),
|
||||
TRContent.Ingots.class.getName(),
|
||||
TRContent.Gems.class.getName(),
|
||||
TRContent.Plates.class.getName(),
|
||||
TRContent.StorageBlocks.class.getName()
|
||||
);
|
||||
|
||||
@Override
|
||||
public int compare(Enum<?> o1, Enum<?> o2) {
|
||||
if (o1 == o2) {
|
||||
return 0;
|
||||
}
|
||||
if (o1 == null) {
|
||||
return Integer.MIN_VALUE;
|
||||
}
|
||||
if (o2 == null) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
if (o1.getClass().getName().equals(o2.getClass().getName())) {
|
||||
return 0;
|
||||
}
|
||||
return ORDER.indexOf(o1.getClass().getName()) - ORDER.indexOf(o2.getClass().getName());
|
||||
}
|
||||
}
|
|
@ -30,7 +30,8 @@ import net.minecraft.enchantment.EnchantmentHelper;
|
|||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.Registry;
|
||||
import reborncore.api.events.ItemCraftCallback;
|
||||
import reborncore.common.powerSystem.RcEnergyItem;
|
||||
import techreborn.TechReborn;
|
||||
|
@ -65,7 +66,7 @@ public final class PoweredCraftingHandler implements ItemCraftCallback {
|
|||
energyItem.setStoredEnergy(stack, Math.min(totalEnergy, energyItem.getEnergyCapacity()));
|
||||
}
|
||||
|
||||
if (!Registry.ITEM.getId(stack.getItem()).getNamespace().equalsIgnoreCase(TechReborn.MOD_ID)) {
|
||||
if (!Registries.ITEM.getId(stack.getItem()).getNamespace().equalsIgnoreCase(TechReborn.MOD_ID)) {
|
||||
return;
|
||||
}
|
||||
Map<Enchantment, Integer> map = Maps.newLinkedHashMap();
|
||||
|
|
|
@ -25,12 +25,14 @@
|
|||
package techreborn.utils;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import net.fabricmc.fabric.api.tag.convention.v1.ConventionalBlockTags;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.enchantment.Enchantments;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.registry.tag.BlockTags;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.hit.HitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -177,7 +179,7 @@ public class ToolsUtil {
|
|||
if (blockState.getMaterial().isLiquid()) {
|
||||
return true;
|
||||
}
|
||||
if (blockState.getBlock() instanceof OreBlock) {
|
||||
if (blockState.isIn(ConventionalBlockTags.ORES)) {
|
||||
return true;
|
||||
}
|
||||
if (blockState.isOf(Blocks.OBSIDIAN) || blockState.isOf(Blocks.CRYING_OBSIDIAN)){
|
||||
|
|
|
@ -26,11 +26,12 @@ package techreborn.world;
|
|||
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.HeightContext;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
@ -62,7 +63,7 @@ public record OreDepth(Identifier identifier, int minY, int maxY, TargetDimensio
|
|||
if (ore.isDeepslate()) continue;
|
||||
|
||||
if (ore.distribution != null) {
|
||||
final Identifier blockId = Registry.BLOCK.getId(ore.block);
|
||||
final Identifier blockId = Registries.BLOCK.getId(ore.block);
|
||||
final HeightContext heightContext = getHeightContext(server, ore.distribution.dimension);
|
||||
|
||||
if (heightContext == null) {
|
||||
|
@ -77,7 +78,7 @@ public record OreDepth(Identifier identifier, int minY, int maxY, TargetDimensio
|
|||
TRContent.Ores deepslate = ore.getDeepslate();
|
||||
if (deepslate == null) continue;
|
||||
|
||||
final Identifier deepSlateBlockId = Registry.BLOCK.getId(deepslate.block);
|
||||
final Identifier deepSlateBlockId = Registries.BLOCK.getId(deepslate.block);
|
||||
depths.add(new OreDepth(deepSlateBlockId, minY, maxY, ore.distribution.dimension));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,113 +0,0 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2020 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.world;
|
||||
|
||||
import net.fabricmc.fabric.api.biome.v1.BiomeSelectionContext;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.structure.rule.BlockStateMatchRuleTest;
|
||||
import net.minecraft.structure.rule.RuleTest;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.BuiltinRegistries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.world.gen.YOffset;
|
||||
import net.minecraft.world.gen.feature.*;
|
||||
import net.minecraft.world.gen.placementmodifier.*;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class OreFeature {
|
||||
private final TRContent.Ores ore;
|
||||
private final ConfiguredFeature<?, ?> configuredFeature;
|
||||
private final PlacedFeature placedFeature;
|
||||
|
||||
public OreFeature(TRContent.Ores ore) {
|
||||
this.ore = ore;
|
||||
|
||||
this.configuredFeature = configureAndRegisterFeature();
|
||||
this.placedFeature = configureAndRegisterPlacedFeature();
|
||||
}
|
||||
|
||||
private ConfiguredFeature<?, ?> configureAndRegisterFeature() {
|
||||
final OreFeatureConfig oreFeatureConfig = switch (ore.distribution.dimension) {
|
||||
case OVERWORLD -> createOverworldFeatureConfig();
|
||||
case NETHER -> createSimpleFeatureConfig(OreConfiguredFeatures.BASE_STONE_NETHER);
|
||||
case END -> createSimpleFeatureConfig(new BlockStateMatchRuleTest(Blocks.END_STONE.getDefaultState()));
|
||||
};
|
||||
|
||||
ConfiguredFeature<?, ?> configuredFeature = new ConfiguredFeature<>(Feature.ORE, oreFeatureConfig);
|
||||
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, getId(), configuredFeature);
|
||||
return configuredFeature;
|
||||
}
|
||||
|
||||
private OreFeatureConfig createOverworldFeatureConfig() {
|
||||
if (this.ore.getDeepslate() != null) {
|
||||
return new OreFeatureConfig(List.of(
|
||||
OreFeatureConfig.createTarget(OreConfiguredFeatures.STONE_ORE_REPLACEABLES, this.ore.block.getDefaultState()),
|
||||
OreFeatureConfig.createTarget(OreConfiguredFeatures.DEEPSLATE_ORE_REPLACEABLES, this.ore.getDeepslate().block.getDefaultState())
|
||||
), ore.distribution.veinSize);
|
||||
}
|
||||
|
||||
return createSimpleFeatureConfig(OreConfiguredFeatures.STONE_ORE_REPLACEABLES);
|
||||
}
|
||||
|
||||
private OreFeatureConfig createSimpleFeatureConfig(RuleTest test) {
|
||||
return new OreFeatureConfig(test, this.ore.block.getDefaultState(), ore.distribution.veinSize);
|
||||
}
|
||||
|
||||
private PlacedFeature configureAndRegisterPlacedFeature() {
|
||||
PlacedFeature placedFeature = new PlacedFeature(WorldGenerator.getEntry(BuiltinRegistries.CONFIGURED_FEATURE, configuredFeature), getPlacementModifiers());
|
||||
Registry.register(BuiltinRegistries.PLACED_FEATURE, getId(), placedFeature);
|
||||
return placedFeature;
|
||||
}
|
||||
|
||||
private List<PlacementModifier> getPlacementModifiers() {
|
||||
return modifiers(
|
||||
CountPlacementModifier.of(ore.distribution.veinsPerChunk),
|
||||
HeightRangePlacementModifier.uniform(
|
||||
ore.distribution.minOffset,
|
||||
YOffset.fixed(ore.distribution.maxY)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private static List<PlacementModifier> modifiers(PlacementModifier first, PlacementModifier second) {
|
||||
return List.of(first, SquarePlacementModifier.of(), second, BiomePlacementModifier.of());
|
||||
}
|
||||
|
||||
public final Identifier getId() {
|
||||
return new Identifier("techreborn", ore.name + "_ore");
|
||||
}
|
||||
|
||||
public Predicate<BiomeSelectionContext> getBiomeSelector() {
|
||||
return ore.distribution.dimension.biomeSelector;
|
||||
}
|
||||
|
||||
public RegistryKey<PlacedFeature> getPlacedFeatureRegistryKey() {
|
||||
return BuiltinRegistries.PLACED_FEATURE.getKey(this.placedFeature).orElseThrow();
|
||||
}
|
||||
}
|
|
@ -25,16 +25,15 @@
|
|||
package techreborn.world;
|
||||
|
||||
import net.minecraft.block.sapling.SaplingGenerator;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
import net.minecraft.util.registry.BuiltinRegistries;
|
||||
import net.minecraft.util.registry.RegistryEntry;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class RubberSaplingGenerator extends SaplingGenerator {
|
||||
@Nullable
|
||||
@Override
|
||||
protected RegistryEntry<? extends ConfiguredFeature<?, ?>> getTreeFeature(Random random, boolean bees) {
|
||||
return WorldGenerator.getEntry(BuiltinRegistries.CONFIGURED_FEATURE, WorldGenerator.RUBBER_TREE_FEATURE);
|
||||
protected RegistryKey<ConfiguredFeature<?, ?>> getTreeFeature(Random random, boolean bees) {
|
||||
return WorldGenerator.RUBBER_TREE_FEATURE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,9 +26,7 @@ package techreborn.world;
|
|||
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.gen.stateprovider.BlockStateProvider;
|
||||
import net.minecraft.world.gen.treedecorator.TreeDecorator;
|
||||
import net.minecraft.world.gen.treedecorator.TreeDecoratorType;
|
||||
|
@ -43,8 +41,6 @@ public class RubberTreeSpikeDecorator extends TreeDecorator {
|
|||
).apply(instance, RubberTreeSpikeDecorator::new)
|
||||
);
|
||||
|
||||
public static final TreeDecoratorType<RubberTreeSpikeDecorator> RUBBER_TREE_SPIKE = Registry.register(Registry.TREE_DECORATOR_TYPE, new Identifier("techreborn", "rubber_tree_spike"), new TreeDecoratorType<>(CODEC));
|
||||
|
||||
private final int spireHeight;
|
||||
private final BlockStateProvider provider;
|
||||
|
||||
|
@ -55,7 +51,7 @@ public class RubberTreeSpikeDecorator extends TreeDecorator {
|
|||
|
||||
@Override
|
||||
protected TreeDecoratorType<?> getType() {
|
||||
return RUBBER_TREE_SPIKE;
|
||||
return WorldGenerator.RUBBER_TREE_SPIKE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -65,7 +61,7 @@ public class RubberTreeSpikeDecorator extends TreeDecorator {
|
|||
.ifPresent(blockPos -> {
|
||||
for (int i = 0; i < spireHeight; i++) {
|
||||
BlockPos sPos = blockPos.up(i);
|
||||
generator.replace(sPos, provider.getBlockState(generator.getRandom(), sPos));
|
||||
generator.replace(sPos, provider.get(generator.getRandom(), sPos));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -22,21 +22,30 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.datagen.tags
|
||||
package techreborn.world;
|
||||
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider
|
||||
import reborncore.common.misc.RebornCoreTags
|
||||
import techreborn.init.ModFluids
|
||||
import net.fabricmc.fabric.api.biome.v1.BiomeSelectionContext;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.gen.feature.PlacedFeature;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
class WaterExplosionTagProvider extends FabricTagProvider.ItemTagProvider {
|
||||
WaterExplosionTagProvider(FabricDataGenerator dataGenerator) {
|
||||
super(dataGenerator)
|
||||
}
|
||||
import java.util.function.Predicate;
|
||||
|
||||
@Override
|
||||
protected void generateTags() {
|
||||
getOrCreateTagBuilder(RebornCoreTags.WATER_EXPLOSION_ITEM)
|
||||
.add(ModFluids.SODIUM.getBucket())
|
||||
}
|
||||
public record TROreFeatureConfig(Identifier id, TRContent.Ores ore, RegistryKey<ConfiguredFeature<?, ?>> configuredFeature, RegistryKey<PlacedFeature> placedFeature) {
|
||||
public static TROreFeatureConfig of(TRContent.Ores ore) {
|
||||
Identifier id = new Identifier("techreborn", ore.name + "_ore");
|
||||
return new TROreFeatureConfig(
|
||||
id,
|
||||
ore,
|
||||
RegistryKey.of(RegistryKeys.CONFIGURED_FEATURE, id),
|
||||
RegistryKey.of(RegistryKeys.PLACED_FEATURE, id)
|
||||
);
|
||||
}
|
||||
|
||||
public Predicate<BiomeSelectionContext> biomeSelector() {
|
||||
return ore.distribution.dimension.biomeSelector;
|
||||
}
|
||||
}
|
|
@ -24,35 +24,23 @@
|
|||
|
||||
package techreborn.world;
|
||||
|
||||
import net.fabricmc.fabric.api.biome.v1.*;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.tag.BiomeTags;
|
||||
import net.fabricmc.fabric.api.biome.v1.BiomeModificationContext;
|
||||
import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
|
||||
import net.fabricmc.fabric.api.biome.v1.BiomeSelectionContext;
|
||||
import net.fabricmc.fabric.api.biome.v1.BiomeSelectors;
|
||||
import net.fabricmc.fabric.api.biome.v1.ModificationPhase;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.registry.tag.BiomeTags;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.collection.DataPool;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.intprovider.ConstantIntProvider;
|
||||
import net.minecraft.util.registry.BuiltinRegistries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryEntry;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.world.Heightmap;
|
||||
import net.minecraft.world.biome.BiomeKeys;
|
||||
import net.minecraft.world.gen.GenerationStep;
|
||||
import net.minecraft.world.gen.YOffset;
|
||||
import net.minecraft.world.gen.blockpredicate.BlockPredicate;
|
||||
import net.minecraft.world.gen.feature.*;
|
||||
import net.minecraft.world.gen.feature.size.TwoLayersFeatureSize;
|
||||
import net.minecraft.world.gen.foliage.BlobFoliagePlacer;
|
||||
import net.minecraft.world.gen.heightprovider.UniformHeightProvider;
|
||||
import net.minecraft.world.gen.placementmodifier.*;
|
||||
import net.minecraft.world.gen.stateprovider.BlockStateProvider;
|
||||
import net.minecraft.world.gen.stateprovider.WeightedBlockStateProvider;
|
||||
import net.minecraft.world.gen.trunk.StraightTrunkPlacer;
|
||||
import techreborn.blocks.misc.BlockRubberLog;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.gen.feature.PlacedFeature;
|
||||
import net.minecraft.world.gen.treedecorator.TreeDecoratorType;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.ModFluids;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
@ -62,18 +50,23 @@ import java.util.function.Consumer;
|
|||
|
||||
// /fill ~ ~ ~ ~20 ~20 ~20 air replace #minecraft:base_stone_overworld
|
||||
public class WorldGenerator {
|
||||
public static ConfiguredFeature<TreeFeatureConfig, ?> RUBBER_TREE_FEATURE;
|
||||
public static PlacedFeature RUBBER_TREE_PLACED_FEATURE;
|
||||
public static ConfiguredFeature<RandomPatchFeatureConfig, ?> RUBBER_TREE_PATCH_FEATURE;
|
||||
public static PlacedFeature RUBBER_TREE_PATCH_PLACED_FEATURE;
|
||||
public static final List<OreFeature> ORE_FEATURES = getOreFeatures();
|
||||
public static ConfiguredFeature<?, ?> OIL_LAKE_FEATURE;
|
||||
public static PlacedFeature OIL_LAKE_PLACED_FEATURE;
|
||||
public static final List<TROreFeatureConfig> ORE_FEATURES = getOreFeatures();
|
||||
|
||||
public static final Identifier OIL_LAKE_ID = new Identifier("techreborn", "oil_lake");
|
||||
public static final RegistryKey<ConfiguredFeature<?, ?>> OIL_LAKE_FEATURE = RegistryKey.of(RegistryKeys.CONFIGURED_FEATURE, OIL_LAKE_ID);
|
||||
public static final RegistryKey<PlacedFeature> OIL_LAKE_PLACED_FEATURE = RegistryKey.of(RegistryKeys.PLACED_FEATURE, OIL_LAKE_ID);
|
||||
|
||||
public static final Identifier RUBBER_TREE_ID = new Identifier("techreborn", "rubber_tree");
|
||||
public static final RegistryKey<ConfiguredFeature<?, ?>> RUBBER_TREE_FEATURE = RegistryKey.of(RegistryKeys.CONFIGURED_FEATURE, RUBBER_TREE_ID);
|
||||
public static final RegistryKey<PlacedFeature> RUBBER_TREE_PLACED_FEATURE = RegistryKey.of(RegistryKeys.PLACED_FEATURE, RUBBER_TREE_ID);
|
||||
|
||||
public static final Identifier RUBBER_TREE_PATCH_ID = new Identifier("techreborn", "rubber_tree_patch");
|
||||
public static final RegistryKey<ConfiguredFeature<?, ?>> RUBBER_TREE_PATCH_FEATURE = RegistryKey.of(RegistryKeys.CONFIGURED_FEATURE, RUBBER_TREE_PATCH_ID);
|
||||
public static final RegistryKey<PlacedFeature> RUBBER_TREE_PATCH_PLACED_FEATURE = RegistryKey.of(RegistryKeys.PLACED_FEATURE, RUBBER_TREE_PATCH_ID);
|
||||
|
||||
public static final TreeDecoratorType<RubberTreeSpikeDecorator> RUBBER_TREE_SPIKE = Registry.register(Registries.TREE_DECORATOR_TYPE, new Identifier("techreborn", "rubber_tree_spike"), new TreeDecoratorType<>(RubberTreeSpikeDecorator.CODEC));
|
||||
|
||||
public static void initWorldGen() {
|
||||
registerTreeDecorators();
|
||||
registerOilLakes();
|
||||
|
||||
if (!TechRebornConfig.enableOreGeneration && !TechRebornConfig.enableRubberTreeGeneration && !TechRebornConfig.enableOilLakeGeneration) {
|
||||
return;
|
||||
}
|
||||
|
@ -92,108 +85,28 @@ public class WorldGenerator {
|
|||
return;
|
||||
}
|
||||
|
||||
for (OreFeature feature : ORE_FEATURES) {
|
||||
if (feature.getBiomeSelector().test(biomeSelectionContext)) {
|
||||
biomeModificationContext.getGenerationSettings().addFeature(GenerationStep.Feature.UNDERGROUND_ORES, feature.getPlacedFeatureRegistryKey());
|
||||
for (TROreFeatureConfig feature : ORE_FEATURES) {
|
||||
if (feature.biomeSelector().test(biomeSelectionContext)) {
|
||||
biomeModificationContext.getGenerationSettings().addFeature(GenerationStep.Feature.UNDERGROUND_ORES, feature.placedFeature());
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static List<OreFeature> getOreFeatures() {
|
||||
private static List<TROreFeatureConfig> getOreFeatures() {
|
||||
return Arrays.stream(TRContent.Ores.values())
|
||||
.filter(ores -> ores.distribution != null)
|
||||
.map(OreFeature::new)
|
||||
.map(TROreFeatureConfig::of)
|
||||
.toList();
|
||||
}
|
||||
|
||||
private static void registerTreeDecorators() {
|
||||
Identifier treeId = new Identifier("techreborn", "rubber_tree");
|
||||
Identifier patchId = new Identifier("techreborn", "rubber_tree_patch");
|
||||
|
||||
RUBBER_TREE_FEATURE = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, treeId,
|
||||
new ConfiguredFeature<>(Feature.TREE, rubber().build())
|
||||
);
|
||||
RUBBER_TREE_PLACED_FEATURE = Registry.register(BuiltinRegistries.PLACED_FEATURE, treeId,
|
||||
new PlacedFeature(getEntry(BuiltinRegistries.CONFIGURED_FEATURE, RUBBER_TREE_FEATURE), List.of(
|
||||
PlacedFeatures.wouldSurvive(TRContent.RUBBER_SAPLING)
|
||||
))
|
||||
);
|
||||
|
||||
RUBBER_TREE_PATCH_FEATURE = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, patchId,
|
||||
new ConfiguredFeature<>(Feature.RANDOM_PATCH,
|
||||
ConfiguredFeatures.createRandomPatchFeatureConfig(
|
||||
6, getEntry(BuiltinRegistries.PLACED_FEATURE, RUBBER_TREE_PLACED_FEATURE)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
RUBBER_TREE_PATCH_PLACED_FEATURE = Registry.register(BuiltinRegistries.PLACED_FEATURE, patchId,
|
||||
new PlacedFeature(getEntry(BuiltinRegistries.CONFIGURED_FEATURE, RUBBER_TREE_PATCH_FEATURE), List.of(
|
||||
RarityFilterPlacementModifier.of(3),
|
||||
SquarePlacementModifier.of(),
|
||||
PlacedFeatures.MOTION_BLOCKING_HEIGHTMAP,
|
||||
BiomePlacementModifier.of())
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private static BiConsumer<BiomeSelectionContext, BiomeModificationContext> rubberTreeModifier() {
|
||||
if (!TechRebornConfig.enableRubberTreeGeneration) {
|
||||
return (biomeSelectionContext, biomeModificationContext) -> {};
|
||||
}
|
||||
|
||||
final RegistryKey<PlacedFeature> registryKey = BuiltinRegistries.PLACED_FEATURE.getKey(RUBBER_TREE_PATCH_PLACED_FEATURE).orElseThrow();
|
||||
|
||||
return (biomeSelectionContext, biomeModificationContext) ->
|
||||
biomeModificationContext.getGenerationSettings().addFeature(GenerationStep.Feature.VEGETAL_DECORATION, registryKey);
|
||||
}
|
||||
|
||||
private static TreeFeatureConfig.Builder rubber() {
|
||||
final DataPool.Builder<BlockState> logDataPool = DataPool.<BlockState>builder()
|
||||
.add(TRContent.RUBBER_LOG.getDefaultState(), 6);
|
||||
|
||||
Arrays.stream(Direction.values())
|
||||
.filter(direction -> direction.getAxis().isHorizontal())
|
||||
.map(direction -> TRContent.RUBBER_LOG.getDefaultState()
|
||||
.with(BlockRubberLog.HAS_SAP, true)
|
||||
.with(BlockRubberLog.SAP_SIDE, direction)
|
||||
)
|
||||
.forEach(state -> logDataPool.add(state, 1));
|
||||
|
||||
return new TreeFeatureConfig.Builder(
|
||||
new WeightedBlockStateProvider(logDataPool),
|
||||
new StraightTrunkPlacer(6, 3, 0),
|
||||
BlockStateProvider.of(TRContent.RUBBER_LEAVES.getDefaultState()),
|
||||
new BlobFoliagePlacer(
|
||||
ConstantIntProvider.create(2),
|
||||
ConstantIntProvider.create(0),
|
||||
3
|
||||
),
|
||||
new TwoLayersFeatureSize(
|
||||
1,
|
||||
0,
|
||||
1
|
||||
))
|
||||
.decorators(List.of(
|
||||
new RubberTreeSpikeDecorator(4, BlockStateProvider.of(TRContent.RUBBER_LEAVES.getDefaultState()))
|
||||
));
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private static void registerOilLakes() {
|
||||
Identifier lakeId = new Identifier("techreborn", "oil_lake");
|
||||
OIL_LAKE_FEATURE = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, lakeId,
|
||||
new ConfiguredFeature<>(Feature.LAKE,
|
||||
new LakeFeature.Config(BlockStateProvider.of(ModFluids.OIL.getBlock().getDefaultState()), BlockStateProvider.of(Blocks.STONE.getDefaultState()))
|
||||
));
|
||||
OIL_LAKE_PLACED_FEATURE = Registry.register(BuiltinRegistries.PLACED_FEATURE, lakeId,
|
||||
new PlacedFeature(getEntry(BuiltinRegistries.CONFIGURED_FEATURE, OIL_LAKE_FEATURE), List.of(
|
||||
RarityFilterPlacementModifier.of(20),
|
||||
HeightRangePlacementModifier.of(UniformHeightProvider.create(YOffset.fixed(0), YOffset.getTop())),
|
||||
EnvironmentScanPlacementModifier.of(Direction.DOWN, BlockPredicate.bothOf(BlockPredicate.not(BlockPredicate.IS_AIR), BlockPredicate.insideWorldBounds(new BlockPos(0, -5, 0))), 32),
|
||||
SurfaceThresholdFilterPlacementModifier.of(Heightmap.Type.OCEAN_FLOOR_WG, Integer.MIN_VALUE, -5)
|
||||
)));
|
||||
biomeModificationContext.getGenerationSettings().addFeature(GenerationStep.Feature.VEGETAL_DECORATION, RUBBER_TREE_PATCH_PLACED_FEATURE);
|
||||
}
|
||||
|
||||
private static Consumer<BiomeModificationContext> oilLakeModifier(){
|
||||
|
@ -201,12 +114,6 @@ public class WorldGenerator {
|
|||
return (biomeModificationContext) -> {};
|
||||
}
|
||||
|
||||
final RegistryKey<PlacedFeature> registryKey = BuiltinRegistries.PLACED_FEATURE.getKey(OIL_LAKE_PLACED_FEATURE).orElseThrow();
|
||||
|
||||
return (biomeModificationContext) -> biomeModificationContext.getGenerationSettings().addFeature(GenerationStep.Feature.LAKES, registryKey);
|
||||
}
|
||||
|
||||
public static <T> RegistryEntry<T> getEntry(Registry<T> registry, T value) {
|
||||
return registry.getEntry(registry.getKey(value).orElseThrow()).orElseThrow();
|
||||
return (biomeModificationContext) -> biomeModificationContext.getGenerationSettings().addFeature(GenerationStep.Feature.LAKES, OIL_LAKE_PLACED_FEATURE);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue