worldgen and stone palettes
@@ -3,24 +3,17 @@ package com.drmangotea.tfmg;
|
||||
import com.drmangotea.tfmg.base.TFMGLangPartials;
|
||||
import com.drmangotea.tfmg.content.gadgets.explosives.thermite_grenades.fire.TFMGColoredFires;
|
||||
import com.drmangotea.tfmg.registry.*;
|
||||
import com.drmangotea.tfmg.worldgen.TFMGConfiguredFeatures;
|
||||
import com.drmangotea.tfmg.worldgen.TFMGFeatures;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import com.simibubi.create.AllSoundEvents;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.foundation.advancement.AllAdvancements;
|
||||
import com.simibubi.create.foundation.data.AllLangPartials;
|
||||
import com.simibubi.create.foundation.data.CreateRegistrate;
|
||||
import com.simibubi.create.foundation.data.LangMerger;
|
||||
import com.simibubi.create.foundation.data.TagGen;
|
||||
import com.simibubi.create.foundation.data.recipe.MechanicalCraftingRecipeGen;
|
||||
import com.simibubi.create.foundation.data.recipe.ProcessingRecipeGen;
|
||||
import com.simibubi.create.foundation.data.recipe.SequencedAssemblyRecipeGen;
|
||||
import com.simibubi.create.foundation.data.recipe.StandardRecipeGen;
|
||||
import com.simibubi.create.foundation.ponder.PonderLocalization;
|
||||
import com.tterrag.registrate.providers.ProviderType;
|
||||
import net.minecraft.client.renderer.ItemBlockRenderTypes;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.data.event.GatherDataEvent;
|
||||
@@ -31,6 +24,7 @@ import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.event.server.ServerStartingEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -49,6 +43,8 @@ public class CreateTFMG
|
||||
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
|
||||
REGISTRATE.registerEventListeners(FMLJavaModLoadingContext.get().getModEventBus());
|
||||
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::commonSetup);
|
||||
//
|
||||
|
||||
TFMGBlocks.register();
|
||||
@@ -57,7 +53,10 @@ public class CreateTFMG
|
||||
TFMGEntityTypes.register();
|
||||
TFMGCreativeModeTabs.init();
|
||||
TFMGFluids.register();
|
||||
TFMGPaletteBlocks.register();
|
||||
TFMGColoredFires.register(modEventBus);
|
||||
TFMGFeatures.register(modEventBus);
|
||||
|
||||
//
|
||||
modEventBus.addListener(EventPriority.LOWEST, CreateTFMG::gatherData);
|
||||
DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> CreateTFMGClient::new);
|
||||
@@ -72,6 +71,13 @@ public class CreateTFMG
|
||||
ItemBlockRenderTypes.setRenderLayer(TFMGColoredFires.GREEN_FIRE.get(), RenderType.cutout());
|
||||
ItemBlockRenderTypes.setRenderLayer(TFMGColoredFires.BLUE_FIRE.get(), RenderType.cutout());
|
||||
}
|
||||
private void commonSetup(final FMLCommonSetupEvent event) {
|
||||
event.enqueueWork(() -> {
|
||||
final Holder<PlacedFeature> initializeOil = TFMGConfiguredFeatures.OIL_PLACED;
|
||||
final Holder<PlacedFeature> initializeSimulatedOil = TFMGConfiguredFeatures.SIMULATED_OIL_PLACED;
|
||||
|
||||
});
|
||||
}
|
||||
@SubscribeEvent
|
||||
public void onServerStarting(ServerStartingEvent event)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,269 @@
|
||||
package com.drmangotea.tfmg.base.palettes;
|
||||
|
||||
import static com.drmangotea.tfmg.CreateTFMG.REGISTRATE;
|
||||
import static com.simibubi.create.foundation.data.TagGen.pickaxeOnly;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import com.drmangotea.tfmg.CreateTFMG;
|
||||
import com.drmangotea.tfmg.registry.TFMGPaletteStoneTypes;
|
||||
import com.simibubi.create.foundation.data.CreateRegistrate;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import com.tterrag.registrate.builders.BlockBuilder;
|
||||
import com.tterrag.registrate.builders.ItemBuilder;
|
||||
import com.tterrag.registrate.providers.DataGenContext;
|
||||
import com.tterrag.registrate.providers.RegistrateBlockstateProvider;
|
||||
import com.tterrag.registrate.providers.RegistrateRecipeProvider;
|
||||
import com.tterrag.registrate.providers.loot.RegistrateBlockLootTables;
|
||||
import com.tterrag.registrate.util.DataIngredient;
|
||||
import com.tterrag.registrate.util.entry.BlockEntry;
|
||||
import com.tterrag.registrate.util.nullness.NonnullType;
|
||||
|
||||
import net.minecraft.data.recipes.ShapedRecipeBuilder;
|
||||
import net.minecraft.data.recipes.ShapelessRecipeBuilder;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.SlabBlock;
|
||||
import net.minecraft.world.level.block.StairBlock;
|
||||
import net.minecraft.world.level.block.WallBlock;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour.Properties;
|
||||
import net.minecraftforge.client.model.generators.ModelFile;
|
||||
|
||||
public abstract class TFMGPaletteBlockPartial<B extends Block> {
|
||||
|
||||
public static final TFMGPaletteBlockPartial<StairBlock> STAIR = new TFMGPaletteBlockPartial.Stairs();
|
||||
public static final TFMGPaletteBlockPartial<SlabBlock> SLAB = new TFMGPaletteBlockPartial.Slab(false);
|
||||
public static final TFMGPaletteBlockPartial<SlabBlock> UNIQUE_SLAB = new TFMGPaletteBlockPartial.Slab(true);
|
||||
public static final TFMGPaletteBlockPartial<WallBlock> WALL = new TFMGPaletteBlockPartial.Wall();
|
||||
|
||||
public static final TFMGPaletteBlockPartial<?>[] ALL_PARTIALS = { STAIR, SLAB, WALL };
|
||||
public static final TFMGPaletteBlockPartial<?>[] FOR_POLISHED = { STAIR, UNIQUE_SLAB, WALL };
|
||||
|
||||
private String name;
|
||||
|
||||
private TFMGPaletteBlockPartial(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public @NonnullType BlockBuilder<B, CreateRegistrate> create(String variantName, TFMGPaletteBlockPattern pattern,
|
||||
BlockEntry<? extends Block> block, TFMGPaletteStoneTypes variant) {
|
||||
String patternName = Lang.nonPluralId(pattern.createName(variantName));
|
||||
String blockName = patternName + "_" + this.name;
|
||||
|
||||
BlockBuilder<B, CreateRegistrate> blockBuilder = REGISTRATE
|
||||
.block(blockName, p -> createBlock(block))
|
||||
.blockstate((c, p) -> generateBlockState(c, p, variantName, pattern, block))
|
||||
.recipe((c, p) -> createRecipes(variant, block, c, p))
|
||||
.transform(b -> transformBlock(b, variantName, pattern));
|
||||
|
||||
ItemBuilder<BlockItem, BlockBuilder<B, CreateRegistrate>> itemBuilder = blockBuilder.item()
|
||||
.transform(b -> transformItem(b, variantName, pattern));
|
||||
|
||||
if (canRecycle())
|
||||
itemBuilder.tag(variant.materialTag);
|
||||
|
||||
return itemBuilder.build();
|
||||
}
|
||||
|
||||
protected ResourceLocation getTexture(String variantName, TFMGPaletteBlockPattern pattern, int index) {
|
||||
return TFMGPaletteBlockPattern.toLocation(variantName, pattern.getTexture(index));
|
||||
}
|
||||
|
||||
protected BlockBuilder<B, CreateRegistrate> transformBlock(BlockBuilder<B, CreateRegistrate> builder,
|
||||
String variantName, TFMGPaletteBlockPattern pattern) {
|
||||
getBlockTags().forEach(builder::tag);
|
||||
return builder.transform(pickaxeOnly());
|
||||
}
|
||||
|
||||
protected ItemBuilder<BlockItem, BlockBuilder<B, CreateRegistrate>> transformItem(
|
||||
ItemBuilder<BlockItem, BlockBuilder<B, CreateRegistrate>> builder, String variantName,
|
||||
TFMGPaletteBlockPattern pattern) {
|
||||
getItemTags().forEach(builder::tag);
|
||||
return builder;
|
||||
}
|
||||
|
||||
protected boolean canRecycle() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected abstract Iterable<TagKey<Block>> getBlockTags();
|
||||
|
||||
protected abstract Iterable<TagKey<Item>> getItemTags();
|
||||
|
||||
protected abstract B createBlock(Supplier<? extends Block> block);
|
||||
|
||||
protected abstract void createRecipes(TFMGPaletteStoneTypes type, BlockEntry<? extends Block> patternBlock,
|
||||
DataGenContext<Block, ? extends Block> c, RegistrateRecipeProvider p);
|
||||
|
||||
protected abstract void generateBlockState(DataGenContext<Block, B> ctx, RegistrateBlockstateProvider prov,
|
||||
String variantName, TFMGPaletteBlockPattern pattern, Supplier<? extends Block> block);
|
||||
|
||||
private static class Stairs extends TFMGPaletteBlockPartial<StairBlock> {
|
||||
|
||||
public Stairs() {
|
||||
super("stairs");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected StairBlock createBlock(Supplier<? extends Block> block) {
|
||||
return new StairBlock(() -> block.get()
|
||||
.defaultBlockState(), Properties.copy(block.get()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void generateBlockState(DataGenContext<Block, StairBlock> ctx, RegistrateBlockstateProvider prov,
|
||||
String variantName, TFMGPaletteBlockPattern pattern, Supplier<? extends Block> block) {
|
||||
prov.stairsBlock(ctx.get(), getTexture(variantName, pattern, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Iterable<TagKey<Block>> getBlockTags() {
|
||||
return Arrays.asList(BlockTags.STAIRS);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Iterable<TagKey<Item>> getItemTags() {
|
||||
return Arrays.asList(ItemTags.STAIRS);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createRecipes(TFMGPaletteStoneTypes type, BlockEntry<? extends Block> patternBlock,
|
||||
DataGenContext<Block, ? extends Block> c, RegistrateRecipeProvider p) {
|
||||
p.stairs(DataIngredient.items(patternBlock), c::get, c.getName(), false);
|
||||
p.stonecutting(DataIngredient.tag(type.materialTag), c::get, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class Slab extends TFMGPaletteBlockPartial<SlabBlock> {
|
||||
|
||||
private boolean customSide;
|
||||
|
||||
public Slab(boolean customSide) {
|
||||
super("slab");
|
||||
this.customSide = customSide;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SlabBlock createBlock(Supplier<? extends Block> block) {
|
||||
return new SlabBlock(Properties.copy(block.get()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canRecycle() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void generateBlockState(DataGenContext<Block, SlabBlock> ctx, RegistrateBlockstateProvider prov,
|
||||
String variantName, TFMGPaletteBlockPattern pattern, Supplier<? extends Block> block) {
|
||||
String name = ctx.getName();
|
||||
ResourceLocation mainTexture = getTexture(variantName, pattern, 0);
|
||||
ResourceLocation sideTexture = customSide ? getTexture(variantName, pattern, 1) : mainTexture;
|
||||
|
||||
ModelFile bottom = prov.models()
|
||||
.slab(name, sideTexture, mainTexture, mainTexture);
|
||||
ModelFile top = prov.models()
|
||||
.slabTop(name + "_top", sideTexture, mainTexture, mainTexture);
|
||||
ModelFile doubleSlab;
|
||||
|
||||
if (customSide) {
|
||||
doubleSlab = prov.models()
|
||||
.cubeColumn(name + "_double", sideTexture, mainTexture);
|
||||
} else {
|
||||
doubleSlab = prov.models()
|
||||
.getExistingFile(prov.modLoc(pattern.createName(variantName)));
|
||||
}
|
||||
|
||||
prov.slabBlock(ctx.get(), bottom, top, doubleSlab);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Iterable<TagKey<Block>> getBlockTags() {
|
||||
return Arrays.asList(BlockTags.SLABS);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Iterable<TagKey<Item>> getItemTags() {
|
||||
return Arrays.asList(ItemTags.SLABS);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createRecipes(TFMGPaletteStoneTypes type, BlockEntry<? extends Block> patternBlock,
|
||||
DataGenContext<Block, ? extends Block> c, RegistrateRecipeProvider p) {
|
||||
p.slab(DataIngredient.items(patternBlock), c::get, c.getName(), false);
|
||||
p.stonecutting(DataIngredient.tag(type.materialTag), c::get, 2);
|
||||
DataIngredient ingredient = DataIngredient.items(c.get());
|
||||
ShapelessRecipeBuilder.shapeless(patternBlock.get())
|
||||
.requires(ingredient)
|
||||
.requires(ingredient)
|
||||
.unlockedBy("has_" + c.getName(), ingredient.getCritereon(p))
|
||||
.save(p, CreateTFMG.MOD_ID + ":" + c.getName() + "_recycling");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockBuilder<SlabBlock, CreateRegistrate> transformBlock(
|
||||
BlockBuilder<SlabBlock, CreateRegistrate> builder, String variantName, TFMGPaletteBlockPattern pattern) {
|
||||
builder.loot((lt, block) -> lt.add(block, RegistrateBlockLootTables.createSlabItemTable(block)));
|
||||
return super.transformBlock(builder, variantName, pattern);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class Wall extends TFMGPaletteBlockPartial<WallBlock> {
|
||||
|
||||
public Wall() {
|
||||
super("wall");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected WallBlock createBlock(Supplier<? extends Block> block) {
|
||||
return new WallBlock(Properties.copy(block.get()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemBuilder<BlockItem, BlockBuilder<WallBlock, CreateRegistrate>> transformItem(
|
||||
ItemBuilder<BlockItem, BlockBuilder<WallBlock, CreateRegistrate>> builder, String variantName,
|
||||
TFMGPaletteBlockPattern pattern) {
|
||||
builder.model((c, p) -> p.wallInventory(c.getName(), getTexture(variantName, pattern, 0)));
|
||||
return super.transformItem(builder, variantName, pattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void generateBlockState(DataGenContext<Block, WallBlock> ctx, RegistrateBlockstateProvider prov,
|
||||
String variantName, TFMGPaletteBlockPattern pattern, Supplier<? extends Block> block) {
|
||||
prov.wallBlock(ctx.get(), pattern.createName(variantName), getTexture(variantName, pattern, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Iterable<TagKey<Block>> getBlockTags() {
|
||||
return Arrays.asList(BlockTags.WALLS);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Iterable<TagKey<Item>> getItemTags() {
|
||||
return Arrays.asList(ItemTags.WALLS);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createRecipes(TFMGPaletteStoneTypes type, BlockEntry<? extends Block> patternBlock,
|
||||
DataGenContext<Block, ? extends Block> c, RegistrateRecipeProvider p) {
|
||||
p.stonecutting(DataIngredient.tag(type.materialTag), c::get, 1);
|
||||
DataIngredient ingredient = DataIngredient.items(patternBlock);
|
||||
ShapedRecipeBuilder.shaped(c.get(), 6)
|
||||
.pattern("XXX")
|
||||
.pattern("XXX")
|
||||
.define('X', ingredient)
|
||||
.unlockedBy("has_" + p.safeName(ingredient), ingredient.getCritereon(p))
|
||||
.save(p, p.safeId(c.get()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,270 @@
|
||||
package com.drmangotea.tfmg.base.palettes;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.CreateTFMG;
|
||||
import com.simibubi.create.content.decoration.palettes.ConnectedPillarBlock;
|
||||
import com.simibubi.create.foundation.block.connected.*;
|
||||
import com.tterrag.registrate.providers.DataGenContext;
|
||||
import com.tterrag.registrate.providers.RegistrateBlockstateProvider;
|
||||
import com.tterrag.registrate.providers.RegistrateRecipeProvider;
|
||||
import com.tterrag.registrate.util.nullness.NonNullBiConsumer;
|
||||
import com.tterrag.registrate.util.nullness.NonNullFunction;
|
||||
import com.tterrag.registrate.util.nullness.NonNullSupplier;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.model.generators.ConfiguredModel;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static com.drmangotea.tfmg.base.palettes.TFMGPaletteBlockPartial.ALL_PARTIALS;
|
||||
import static com.drmangotea.tfmg.base.palettes.TFMGPaletteBlockPartial.FOR_POLISHED;
|
||||
import static com.drmangotea.tfmg.base.palettes.TFMGPaletteBlockPattern.PatternNameType.*;
|
||||
|
||||
|
||||
public class TFMGPaletteBlockPattern {
|
||||
|
||||
public static final TFMGPaletteBlockPattern
|
||||
|
||||
CUT =
|
||||
create("cut", PREFIX, ALL_PARTIALS),
|
||||
|
||||
BRICKS = create("cut_bricks", WRAP, ALL_PARTIALS).textures("brick"),
|
||||
|
||||
SMALL_BRICKS = create("small_bricks", WRAP, ALL_PARTIALS).textures("small_brick"),
|
||||
|
||||
POLISHED = create("polished_cut", PREFIX, FOR_POLISHED).textures("polished", "slab"),
|
||||
|
||||
LAYERED = create("layered", PREFIX).blockStateFactory(p -> p::cubeColumn)
|
||||
.textures("layered", "cap")
|
||||
.connectedTextures(v -> new HorizontalCTBehaviour(ct(v, TFMGPaletteBlockPattern.CTs.LAYERED), ct(v, TFMGPaletteBlockPattern.CTs.CAP))),
|
||||
|
||||
PILLAR = create("pillar", SUFFIX).blockStateFactory(p -> p::pillar)
|
||||
.block(ConnectedPillarBlock::new)
|
||||
.textures("pillar", "cap")
|
||||
.connectedTextures(v -> new RotatedPillarCTBehaviour(ct(v, TFMGPaletteBlockPattern.CTs.PILLAR), ct(v, TFMGPaletteBlockPattern.CTs.CAP)))
|
||||
|
||||
;
|
||||
|
||||
public static final TFMGPaletteBlockPattern[] VANILLA_RANGE = { CUT, POLISHED, BRICKS, SMALL_BRICKS, LAYERED, PILLAR };
|
||||
|
||||
public static final TFMGPaletteBlockPattern[] STANDARD_RANGE = { CUT, POLISHED, BRICKS, SMALL_BRICKS, LAYERED, PILLAR };
|
||||
|
||||
static final String TEXTURE_LOCATION = "block/palettes/stone_types/%s/%s";
|
||||
|
||||
private TFMGPaletteBlockPattern.PatternNameType nameType;
|
||||
private String[] textures;
|
||||
private String id;
|
||||
private boolean isTranslucent;
|
||||
private TagKey<Block>[] blockTags;
|
||||
private TagKey<Item>[] itemTags;
|
||||
private Optional<Function<String, ConnectedTextureBehaviour>> ctFactory;
|
||||
|
||||
private TFMGPaletteBlockPattern.IPatternBlockStateGenerator blockStateGenerator;
|
||||
private NonNullFunction<BlockBehaviour.Properties, ? extends Block> blockFactory;
|
||||
private NonNullFunction<NonNullSupplier<Block>, NonNullBiConsumer<DataGenContext<Block, ? extends Block>, RegistrateRecipeProvider>> additionalRecipes;
|
||||
private TFMGPaletteBlockPartial<? extends Block>[] partials;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private RenderType renderType;
|
||||
|
||||
private static TFMGPaletteBlockPattern create(String name, TFMGPaletteBlockPattern.PatternNameType nameType,
|
||||
TFMGPaletteBlockPartial<?>... partials) {
|
||||
TFMGPaletteBlockPattern pattern = new TFMGPaletteBlockPattern();
|
||||
pattern.id = name;
|
||||
pattern.ctFactory = Optional.empty();
|
||||
pattern.nameType = nameType;
|
||||
pattern.partials = partials;
|
||||
pattern.additionalRecipes = $ -> NonNullBiConsumer.noop();
|
||||
pattern.isTranslucent = false;
|
||||
pattern.blockFactory = Block::new;
|
||||
pattern.textures = new String[] { name };
|
||||
pattern.blockStateGenerator = p -> p::cubeAll;
|
||||
return pattern;
|
||||
}
|
||||
|
||||
public TFMGPaletteBlockPattern.IPatternBlockStateGenerator getBlockStateGenerator() {
|
||||
return blockStateGenerator;
|
||||
}
|
||||
|
||||
public boolean isTranslucent() {
|
||||
return isTranslucent;
|
||||
}
|
||||
|
||||
public TagKey<Block>[] getBlockTags() {
|
||||
return blockTags;
|
||||
}
|
||||
|
||||
public TagKey<Item>[] getItemTags() {
|
||||
return itemTags;
|
||||
}
|
||||
|
||||
public NonNullFunction<BlockBehaviour.Properties, ? extends Block> getBlockFactory() {
|
||||
return blockFactory;
|
||||
}
|
||||
|
||||
public TFMGPaletteBlockPartial<? extends Block>[] getPartials() {
|
||||
return partials;
|
||||
}
|
||||
|
||||
public String getTexture(int index) {
|
||||
return textures[index];
|
||||
}
|
||||
|
||||
public void addRecipes(NonNullSupplier<Block> baseBlock, DataGenContext<Block, ? extends Block> c,
|
||||
RegistrateRecipeProvider p) {
|
||||
additionalRecipes.apply(baseBlock)
|
||||
.accept(c, p);
|
||||
}
|
||||
|
||||
public Optional<Supplier<ConnectedTextureBehaviour>> createCTBehaviour(String variant) {
|
||||
return ctFactory.map(d -> () -> d.apply(variant));
|
||||
}
|
||||
|
||||
// Builder
|
||||
|
||||
private TFMGPaletteBlockPattern blockStateFactory(TFMGPaletteBlockPattern.IPatternBlockStateGenerator factory) {
|
||||
blockStateGenerator = factory;
|
||||
return this;
|
||||
}
|
||||
|
||||
private TFMGPaletteBlockPattern textures(String... textures) {
|
||||
this.textures = textures;
|
||||
return this;
|
||||
}
|
||||
|
||||
private TFMGPaletteBlockPattern block(NonNullFunction<BlockBehaviour.Properties, ? extends Block> blockFactory) {
|
||||
this.blockFactory = blockFactory;
|
||||
return this;
|
||||
}
|
||||
|
||||
private TFMGPaletteBlockPattern connectedTextures(Function<String, ConnectedTextureBehaviour> factory) {
|
||||
this.ctFactory = Optional.of(factory);
|
||||
return this;
|
||||
}
|
||||
|
||||
// Model generators
|
||||
|
||||
public TFMGPaletteBlockPattern.IBlockStateProvider cubeAll(String variant) {
|
||||
ResourceLocation all = toLocation(variant, textures[0]);
|
||||
return (ctx, prov) -> prov.simpleBlock(ctx.get(), prov.models()
|
||||
.cubeAll(createName(variant), all));
|
||||
}
|
||||
|
||||
public TFMGPaletteBlockPattern.IBlockStateProvider cubeBottomTop(String variant) {
|
||||
ResourceLocation side = toLocation(variant, textures[0]);
|
||||
ResourceLocation bottom = toLocation(variant, textures[1]);
|
||||
ResourceLocation top = toLocation(variant, textures[2]);
|
||||
return (ctx, prov) -> prov.simpleBlock(ctx.get(), prov.models()
|
||||
.cubeBottomTop(createName(variant), side, bottom, top));
|
||||
}
|
||||
|
||||
public TFMGPaletteBlockPattern.IBlockStateProvider pillar(String variant) {
|
||||
ResourceLocation side = toLocation(variant, textures[0]);
|
||||
ResourceLocation end = toLocation(variant, textures[1]);
|
||||
|
||||
return (ctx, prov) -> prov.getVariantBuilder(ctx.getEntry())
|
||||
.forAllStatesExcept(state -> {
|
||||
Direction.Axis axis = state.getValue(BlockStateProperties.AXIS);
|
||||
if (axis == Direction.Axis.Y)
|
||||
return ConfiguredModel.builder()
|
||||
.modelFile(prov.models()
|
||||
.cubeColumn(createName(variant), side, end))
|
||||
.uvLock(false)
|
||||
.build();
|
||||
return ConfiguredModel.builder()
|
||||
.modelFile(prov.models()
|
||||
.cubeColumnHorizontal(createName(variant) + "_horizontal", side, end))
|
||||
.uvLock(false)
|
||||
.rotationX(90)
|
||||
.rotationY(axis == Direction.Axis.X ? 90 : 0)
|
||||
.build();
|
||||
}, BlockStateProperties.WATERLOGGED, ConnectedPillarBlock.NORTH, ConnectedPillarBlock.SOUTH,
|
||||
ConnectedPillarBlock.EAST, ConnectedPillarBlock.WEST);
|
||||
}
|
||||
|
||||
public TFMGPaletteBlockPattern.IBlockStateProvider cubeColumn(String variant) {
|
||||
ResourceLocation side = toLocation(variant, textures[0]);
|
||||
ResourceLocation end = toLocation(variant, textures[1]);
|
||||
return (ctx, prov) -> prov.simpleBlock(ctx.get(), prov.models()
|
||||
.cubeColumn(createName(variant), side, end));
|
||||
}
|
||||
|
||||
// Utility
|
||||
|
||||
protected String createName(String variant) {
|
||||
if (nameType == WRAP) {
|
||||
String[] split = id.split("_");
|
||||
if (split.length == 2) {
|
||||
String formatString = "%s_%s_%s";
|
||||
return String.format(formatString, split[0], variant, split[1]);
|
||||
}
|
||||
}
|
||||
String formatString = "%s_%s";
|
||||
return nameType == SUFFIX ? String.format(formatString, variant, id) : String.format(formatString, id, variant);
|
||||
}
|
||||
|
||||
protected static ResourceLocation toLocation(String variant, String texture) {
|
||||
return CreateTFMG.asResource(
|
||||
String.format(TEXTURE_LOCATION, texture, variant + (texture.equals("cut") ? "_" : "_cut_") + texture));
|
||||
}
|
||||
|
||||
protected static CTSpriteShiftEntry ct(String variant, TFMGPaletteBlockPattern.CTs texture) {
|
||||
ResourceLocation resLoc = texture.srcFactory.apply(variant);
|
||||
ResourceLocation resLocTarget = texture.targetFactory.apply(variant);
|
||||
return CTSpriteShifter.getCT(texture.type, resLoc,
|
||||
new ResourceLocation(resLocTarget.getNamespace(), resLocTarget.getPath() + "_connected"));
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
static interface IPatternBlockStateGenerator
|
||||
extends Function<TFMGPaletteBlockPattern, Function<String, TFMGPaletteBlockPattern.IBlockStateProvider>> {
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
static interface IBlockStateProvider
|
||||
extends NonNullBiConsumer<DataGenContext<Block, ? extends Block>, RegistrateBlockstateProvider> {
|
||||
}
|
||||
|
||||
enum PatternNameType {
|
||||
PREFIX, SUFFIX, WRAP
|
||||
}
|
||||
|
||||
// Textures with connectability, used by Spriteshifter
|
||||
|
||||
public enum CTs {
|
||||
|
||||
PILLAR(AllCTTypes.RECTANGLE, s -> toLocation(s, "pillar")),
|
||||
CAP(AllCTTypes.OMNIDIRECTIONAL, s -> toLocation(s, "cap")),
|
||||
LAYERED(AllCTTypes.HORIZONTAL_KRYPPERS, s -> toLocation(s, "layered"))
|
||||
|
||||
;
|
||||
|
||||
public CTType type;
|
||||
private Function<String, ResourceLocation> srcFactory;
|
||||
private Function<String, ResourceLocation> targetFactory;
|
||||
|
||||
private CTs(CTType type, Function<String, ResourceLocation> factory) {
|
||||
this(type, factory, factory);
|
||||
}
|
||||
|
||||
private CTs(CTType type, Function<String, ResourceLocation> srcFactory,
|
||||
Function<String, ResourceLocation> targetFactory) {
|
||||
this.type = type;
|
||||
this.srcFactory = srcFactory;
|
||||
this.targetFactory = targetFactory;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.drmangotea.tfmg.base.palettes;
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGPaletteStoneTypes;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.simibubi.create.foundation.data.CreateRegistrate;
|
||||
import com.tterrag.registrate.builders.BlockBuilder;
|
||||
import com.tterrag.registrate.builders.ItemBuilder;
|
||||
import com.tterrag.registrate.providers.ProviderType;
|
||||
import com.tterrag.registrate.util.DataIngredient;
|
||||
import com.tterrag.registrate.util.entry.BlockEntry;
|
||||
import com.tterrag.registrate.util.nullness.NonNullSupplier;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
||||
|
||||
import static com.drmangotea.tfmg.CreateTFMG.REGISTRATE;
|
||||
import static com.simibubi.create.foundation.data.CreateRegistrate.connectedTextures;
|
||||
import static com.simibubi.create.foundation.data.TagGen.pickaxeOnly;
|
||||
|
||||
@SuppressWarnings("'onRegister(com.tterrag.registrate.util.nullness.NonNullConsumer<? super capture<? extends net.minecraft.world.level.block.Block>>)' in 'com.tterrag.registrate.builders.Builder' cannot be applied to '(com.tterrag.registrate.util.nullness.NonNullConsumer<capture<? super capture<? extends net.minecraft.world.level.block.Block>>>)'")
|
||||
public class TFMGPalettesVariantEntry {
|
||||
|
||||
public final ImmutableList<BlockEntry<? extends Block>> registeredBlocks;
|
||||
public final ImmutableList<BlockEntry<? extends Block>> registeredPartials;
|
||||
|
||||
public TFMGPalettesVariantEntry(String name, TFMGPaletteStoneTypes paletteStoneVariants) {
|
||||
ImmutableList.Builder<BlockEntry<? extends Block>> registeredBlocks = ImmutableList.builder();
|
||||
ImmutableList.Builder<BlockEntry<? extends Block>> registeredPartials = ImmutableList.builder();
|
||||
NonNullSupplier<Block> baseBlock = paletteStoneVariants.baseBlock;
|
||||
|
||||
for (TFMGPaletteBlockPattern pattern : paletteStoneVariants.variantTypes) {
|
||||
BlockBuilder<? extends Block, CreateRegistrate> builder =
|
||||
REGISTRATE.block(pattern.createName(name), pattern.getBlockFactory())
|
||||
.initialProperties(baseBlock)
|
||||
.transform(pickaxeOnly())
|
||||
.blockstate(pattern.getBlockStateGenerator()
|
||||
.apply(pattern)
|
||||
.apply(name)::accept);
|
||||
|
||||
ItemBuilder<BlockItem, ? extends BlockBuilder<? extends Block, CreateRegistrate>> itemBuilder =
|
||||
builder.item();
|
||||
|
||||
TagKey<Block>[] blockTags = pattern.getBlockTags();
|
||||
if (blockTags != null)
|
||||
builder.tag(blockTags);
|
||||
TagKey<Item>[] itemTags = pattern.getItemTags();
|
||||
if (itemTags != null)
|
||||
itemBuilder.tag(itemTags);
|
||||
|
||||
itemBuilder.tag(paletteStoneVariants.materialTag);
|
||||
|
||||
if (pattern.isTranslucent())
|
||||
builder.addLayer(() -> RenderType::translucent);
|
||||
pattern.createCTBehaviour(name)
|
||||
.ifPresent(b -> builder.onRegister(connectedTextures(b)));
|
||||
|
||||
builder.recipe((c, p) -> {
|
||||
p.stonecutting(DataIngredient.tag(paletteStoneVariants.materialTag), c);
|
||||
pattern.addRecipes(baseBlock, c, p);
|
||||
});
|
||||
|
||||
itemBuilder.register();
|
||||
BlockEntry<? extends Block> block = builder.register();
|
||||
registeredBlocks.add(block);
|
||||
|
||||
for (TFMGPaletteBlockPartial<? extends Block> partialBlock : pattern.getPartials())
|
||||
registeredPartials.add(partialBlock.create(name, pattern, block, paletteStoneVariants)
|
||||
.register());
|
||||
}
|
||||
|
||||
REGISTRATE.addDataGenerator(ProviderType.RECIPE,
|
||||
p -> p.stonecutting(DataIngredient.tag(paletteStoneVariants.materialTag), baseBlock));
|
||||
REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, p -> p.tag(paletteStoneVariants.materialTag)
|
||||
.add(baseBlock.get()
|
||||
.asItem()));
|
||||
|
||||
this.registeredBlocks = registeredBlocks.build();
|
||||
this.registeredPartials = registeredPartials.build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.drmangotea.tfmg.content.deposits;
|
||||
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
|
||||
import com.simibubi.create.foundation.block.IBE;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
|
||||
public class FluidDepositBlock extends Block implements IBE<FluidDepositTileEntity> {
|
||||
|
||||
public FluidDepositBlock(Properties p_49795_) {
|
||||
super(p_49795_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<FluidDepositTileEntity> getBlockEntityClass() {
|
||||
return FluidDepositTileEntity.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockEntityType<? extends FluidDepositTileEntity> getBlockEntityType() {
|
||||
return TFMGBlockEntities.OIL_DEPOSIT.get();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.drmangotea.tfmg.content.deposits;
|
||||
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.CreateTFMG;
|
||||
import com.drmangotea.tfmg.registry.TFMGFluids;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FluidDepositTileEntity extends SmartBlockEntity {
|
||||
|
||||
public final int baseFluidAmount= Create.RANDOM.nextInt(300000000);
|
||||
public final int fluidAmountToBuckets =baseFluidAmount/1000;
|
||||
public int fluidAmount= fluidAmountToBuckets;
|
||||
|
||||
public FluidDepositTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
CreateTFMG.LOGGER.debug("Created Oil Deposit with "+baseFluidAmount+" buckets of Crude Oil");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBehaviours(List<BlockEntityBehaviour> behaviours) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(CompoundTag compound, boolean clientPacket) {
|
||||
|
||||
compound.putInt("FluidAmount", baseFluidAmount);
|
||||
|
||||
super.write(compound, clientPacket);
|
||||
|
||||
}
|
||||
@Override
|
||||
protected void read(CompoundTag compound, boolean clientPacket) {
|
||||
super.read(compound, clientPacket);
|
||||
|
||||
|
||||
fluidAmount = compound.getInt("FluidAmount");
|
||||
|
||||
}
|
||||
public Fluid getDepositFluid(){
|
||||
return TFMGFluids.CRUDE_OIL.getSource();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.drmangotea.tfmg.content.fluids;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraftforge.fluids.ForgeFlowingFluid;
|
||||
|
||||
public class BurnableFluid extends ForgeFlowingFluid {
|
||||
|
||||
|
||||
protected BurnableFluid(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSource(FluidState p_76140_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAmount(FluidState p_164509_) {
|
||||
return 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomTick(Level level, BlockPos pos, FluidState p_230574_, RandomSource randomSource) {
|
||||
//level.setBlock(pos,Blocks.FIRE.defaultBlockState(),3);
|
||||
// if (!level.isClientSide) {
|
||||
|
||||
// Direction checkedDirection=Direction.NORTH;
|
||||
// for(int i = 0; i < 4; i++) {
|
||||
|
||||
// checkedDirection=checkedDirection.getClockWise();
|
||||
|
||||
// BlockPos checkedPos = pos.relative(checkedDirection);
|
||||
|
||||
// if(level.getBlockEntity(checkedPos).getBlockState().is(Blocks.FIRE)) {
|
||||
// level.explode(null, pos.getX(), pos.getY(), pos.getZ(), 2.0F, Explosion.BlockInteraction.NONE);
|
||||
// level.setBlock(pos,Blocks.FIRE.defaultBlockState(),3);
|
||||
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
protected boolean isRandomlyTicking() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
public static class Flowing extends BurnableFluid {
|
||||
public Flowing(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
protected void createFluidStateDefinition(StateDefinition.Builder<Fluid, FluidState> p_76260_) {
|
||||
super.createFluidStateDefinition(p_76260_);
|
||||
p_76260_.add(LEVEL);
|
||||
}
|
||||
|
||||
public int getAmount(FluidState p_76264_) {
|
||||
return p_76264_.getValue(LEVEL);
|
||||
}
|
||||
|
||||
public boolean isSource(FluidState p_76262_) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Source extends BurnableFluid {
|
||||
public Source(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
public int getAmount(FluidState p_76269_) {
|
||||
return 8;
|
||||
}
|
||||
|
||||
public boolean isSource(FluidState p_76267_) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.drmangotea.tfmg.content.items;
|
||||
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.RecipeType;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class TFMGFuelItem extends BlockItem {
|
||||
|
||||
private final int burnTicks;
|
||||
|
||||
|
||||
public static TFMGFuelItem fossilstone(Block block,Properties properties) {
|
||||
return new TFMGFuelItem(block,properties, 4000);
|
||||
}
|
||||
public static TFMGFuelItem coal_coke(Block block,Properties properties){
|
||||
return new TFMGFuelItem(block,properties,3200);
|
||||
}
|
||||
public TFMGFuelItem(Block p_40565_, Properties p_40566_,int burnTime) {
|
||||
super(p_40565_, p_40566_);
|
||||
this.burnTicks = burnTime;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int getBurnTime(ItemStack itemStack, @Nullable RecipeType<?> recipeType) {
|
||||
return burnTicks;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.drmangotea.tfmg.mixins;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.worldgen.TFMGLayeredPatterns;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.foundation.data.DynamicDataProvider;
|
||||
import com.simibubi.create.infrastructure.worldgen.AllLayerPatterns;
|
||||
import com.simibubi.create.infrastructure.worldgen.AllOreFeatureConfigEntries;
|
||||
import com.simibubi.create.infrastructure.worldgen.OreFeatureConfigEntry;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.BiomeTags;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||
import net.minecraftforge.common.ForgeConfigSpec;
|
||||
import net.minecraftforge.common.world.BiomeModifier;
|
||||
import net.minecraftforge.data.event.GatherDataEvent;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Mixin(AllOreFeatureConfigEntries.class)
|
||||
public class AllOreFeatureConfigEntriesMixin {
|
||||
|
||||
@Shadow
|
||||
public static final OreFeatureConfigEntry STRIATED_ORES_OVERWORLD =
|
||||
create("striated_ores_overworld", 32, 1 / 18f, -30, 70)
|
||||
.layeredDatagenExt()
|
||||
.withLayerPattern(TFMGLayeredPatterns.BAUXITE)
|
||||
.withLayerPattern(TFMGLayeredPatterns.LIGNITE)
|
||||
.withLayerPattern(TFMGLayeredPatterns.GALENA)
|
||||
.withLayerPattern(AllLayerPatterns.SCORIA)
|
||||
.withLayerPattern(AllLayerPatterns.CINNABAR)
|
||||
.withLayerPattern(AllLayerPatterns.MAGNETITE)
|
||||
.withLayerPattern(AllLayerPatterns.MALACHITE)
|
||||
.withLayerPattern(AllLayerPatterns.LIMESTONE)
|
||||
.withLayerPattern(AllLayerPatterns.OCHRESTONE)
|
||||
.biomeTag(BiomeTags.IS_OVERWORLD)
|
||||
.parent();
|
||||
@Shadow
|
||||
public static final OreFeatureConfigEntry STRIATED_ORES_NETHER =
|
||||
create("striated_ores_nether", 32, 1 / 18f, 40, 90)
|
||||
.layeredDatagenExt()
|
||||
.withLayerPattern(TFMGLayeredPatterns.SULFUR)
|
||||
.withLayerPattern(AllLayerPatterns.SCORIA_NETHER)
|
||||
.withLayerPattern(AllLayerPatterns.SCORCHIA_NETHER)
|
||||
.biomeTag(BiomeTags.IS_NETHER)
|
||||
.parent();
|
||||
|
||||
//
|
||||
|
||||
private static OreFeatureConfigEntry create(String name, int clusterSize, float frequency,
|
||||
int minHeight, int maxHeight) {
|
||||
ResourceLocation id = Create.asResource(name);
|
||||
OreFeatureConfigEntry configDrivenFeatureEntry = new OreFeatureConfigEntry(id, clusterSize, frequency, minHeight, maxHeight);
|
||||
return configDrivenFeatureEntry;
|
||||
}
|
||||
@Shadow
|
||||
public static void fillConfig(ForgeConfigSpec.Builder builder, String namespace) {
|
||||
OreFeatureConfigEntry.ALL
|
||||
.forEach((id, entry) -> {
|
||||
if (id.getNamespace().equals(namespace)) {
|
||||
builder.push(entry.getName());
|
||||
entry.addToConfig(builder);
|
||||
builder.pop();
|
||||
}
|
||||
});
|
||||
}
|
||||
@Shadow
|
||||
public static void init() {}
|
||||
@Shadow
|
||||
public static void gatherData(GatherDataEvent event) {
|
||||
DataGenerator generator = event.getGenerator();
|
||||
RegistryAccess registryAccess = RegistryAccess.BUILTIN.get();
|
||||
|
||||
//
|
||||
|
||||
Map<ResourceLocation, ConfiguredFeature<?, ?>> configuredFeatures = new HashMap<>();
|
||||
for (Map.Entry<ResourceLocation, OreFeatureConfigEntry> entry : OreFeatureConfigEntry.ALL.entrySet()) {
|
||||
OreFeatureConfigEntry.DatagenExtension datagenExt = entry.getValue().datagenExt();
|
||||
if (datagenExt != null) {
|
||||
configuredFeatures.put(entry.getKey(), datagenExt.createConfiguredFeature(registryAccess));
|
||||
}
|
||||
}
|
||||
|
||||
DynamicDataProvider<ConfiguredFeature<?, ?>> configuredFeatureProvider = DynamicDataProvider.create(generator, "Create's Configured Features", registryAccess, Registry.CONFIGURED_FEATURE_REGISTRY, configuredFeatures);
|
||||
if (configuredFeatureProvider != null) {
|
||||
generator.addProvider(true, configuredFeatureProvider);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Map<ResourceLocation, PlacedFeature> placedFeatures = new HashMap<>();
|
||||
for (Map.Entry<ResourceLocation, OreFeatureConfigEntry> entry : OreFeatureConfigEntry.ALL.entrySet()) {
|
||||
OreFeatureConfigEntry.DatagenExtension datagenExt = entry.getValue().datagenExt();
|
||||
if (datagenExt != null) {
|
||||
placedFeatures.put(entry.getKey(), datagenExt.createPlacedFeature(registryAccess));
|
||||
}
|
||||
}
|
||||
|
||||
DynamicDataProvider<PlacedFeature> placedFeatureProvider = DynamicDataProvider.create(generator, "Create's Placed Features", registryAccess, Registry.PLACED_FEATURE_REGISTRY, placedFeatures);
|
||||
if (placedFeatureProvider != null) {
|
||||
generator.addProvider(true, placedFeatureProvider);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Map<ResourceLocation, BiomeModifier> biomeModifiers = new HashMap<>();
|
||||
for (Map.Entry<ResourceLocation, OreFeatureConfigEntry> entry : OreFeatureConfigEntry.ALL.entrySet()) {
|
||||
OreFeatureConfigEntry.DatagenExtension datagenExt = entry.getValue().datagenExt();
|
||||
if (datagenExt != null) {
|
||||
biomeModifiers.put(entry.getKey(), datagenExt.createBiomeModifier(registryAccess));
|
||||
}
|
||||
}
|
||||
|
||||
DynamicDataProvider<BiomeModifier> biomeModifierProvider = DynamicDataProvider.create(generator, "Create's Biome Modifiers", registryAccess, ForgeRegistries.Keys.BIOME_MODIFIERS, biomeModifiers);
|
||||
if (biomeModifierProvider != null) {
|
||||
generator.addProvider(true, biomeModifierProvider);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.drmangotea.tfmg.registry;
|
||||
import com.drmangotea.tfmg.CreateTFMG;
|
||||
import com.drmangotea.tfmg.content.concrete.formwork.FormWorkBlockEntity;
|
||||
import com.drmangotea.tfmg.content.concrete.formwork.FormWorkRenderer;
|
||||
import com.drmangotea.tfmg.content.deposits.FluidDepositTileEntity;
|
||||
import com.simibubi.create.content.fluids.pipes.FluidPipeBlockEntity;
|
||||
import com.simibubi.create.content.fluids.pipes.StraightPipeBlockEntity;
|
||||
import com.simibubi.create.content.fluids.pipes.TransparentStraightPipeRenderer;
|
||||
@@ -28,6 +29,10 @@ public class TFMGBlockEntities {
|
||||
.renderer(() -> FormWorkRenderer::new)
|
||||
.validBlocks(TFMGBlocks.FORMWORK_BLOCK)
|
||||
.register();
|
||||
public static final BlockEntityEntry<FluidDepositTileEntity> OIL_DEPOSIT = REGISTRATE
|
||||
.blockEntity("oil_deposit", FluidDepositTileEntity::new)
|
||||
// .validBlocks(TFMGBlocks.OIL_DEPOSIT)
|
||||
.register();
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,10 @@ import com.drmangotea.tfmg.base.TFMGBuilderTransformers;
|
||||
import com.drmangotea.tfmg.base.TFMGSpriteShifts;
|
||||
import com.drmangotea.tfmg.content.concrete.formwork.FormWorkBlock;
|
||||
import com.drmangotea.tfmg.content.concrete.formwork.FormWorkGenerator;
|
||||
import com.drmangotea.tfmg.content.deposits.FluidDepositBlock;
|
||||
import com.drmangotea.tfmg.content.gadgets.explosives.napalm.NapalmBombBlock;
|
||||
import com.drmangotea.tfmg.content.gadgets.explosives.thermite_grenades.ThermiteGrenadeItem;
|
||||
import com.drmangotea.tfmg.content.items.TFMGFuelItem;
|
||||
import com.simibubi.create.content.decoration.encasing.CasingBlock;
|
||||
import com.simibubi.create.content.decoration.encasing.EncasedCTBehaviour;
|
||||
import com.simibubi.create.content.logistics.chute.ChuteGenerator;
|
||||
@@ -24,6 +27,7 @@ import static com.drmangotea.tfmg.CreateTFMG.REGISTRATE;
|
||||
import static com.simibubi.create.foundation.data.BlockStateGen.simpleCubeAll;
|
||||
import static com.simibubi.create.foundation.data.CreateRegistrate.casingConnectivity;
|
||||
import static com.simibubi.create.foundation.data.CreateRegistrate.connectedTextures;
|
||||
import static com.simibubi.create.foundation.data.ModelGen.customItemModel;
|
||||
import static com.simibubi.create.foundation.data.TagGen.*;
|
||||
|
||||
|
||||
@@ -44,6 +48,30 @@ public class TFMGBlocks {
|
||||
.build()
|
||||
.lang("Napalm Bomb")
|
||||
.register();
|
||||
public static final BlockEntry<Block> FOSSILSTONE = REGISTRATE.block("fossilstone", Block::new)
|
||||
.initialProperties(() -> Blocks.OBSIDIAN)
|
||||
.properties(p -> p.strength(100f,1200f))
|
||||
.properties(p -> p.color(MaterialColor.COLOR_BLACK))
|
||||
.properties(p -> p.requiresCorrectToolForDrops())
|
||||
.transform(pickaxeOnly())
|
||||
.blockstate(simpleCubeAll("fossilstone"))
|
||||
.item(TFMGFuelItem::fossilstone)
|
||||
.build()
|
||||
.lang("Fossilstone")
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<FluidDepositBlock> OIL_DEPOSIT = REGISTRATE.block("oil_deposit", FluidDepositBlock::new)
|
||||
.initialProperties(() -> Blocks.BEDROCK)
|
||||
.properties(p -> p.color(MaterialColor.COLOR_GRAY))
|
||||
.properties(p -> p.strength(69696969))
|
||||
.properties(p -> p.requiresCorrectToolForDrops())
|
||||
.transform(pickaxeOnly())
|
||||
.blockstate(simpleCubeAll("oil_deposit"))
|
||||
.item()
|
||||
.build()
|
||||
.lang("Oil Deposit")
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<CasingBlock> STEEL_CASING = REGISTRATE.block("steel_casing", CasingBlock::new)
|
||||
.properties(p -> p.color(MaterialColor.TERRACOTTA_LIGHT_GRAY))
|
||||
.transform(BuilderTransformers.casing(() -> TFMGSpriteShifts.STEEL_CASING))
|
||||
@@ -123,7 +151,7 @@ public class TFMGBlocks {
|
||||
.properties(p -> p.requiresCorrectToolForDrops())
|
||||
.transform(pickaxeOnly())
|
||||
.blockstate(simpleCubeAll("concrete"))
|
||||
.tag(BlockTags.NEEDS_IRON_TOOL)
|
||||
.tag(BlockTags.NEEDS_STONE_TOOL)
|
||||
.transform(tagBlockAndItem("concrete"))
|
||||
.build()
|
||||
.lang("Concrete")
|
||||
|
||||
@@ -3,47 +3,16 @@ package com.drmangotea.tfmg.registry;
|
||||
|
||||
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.drmangotea.tfmg.CreateTFMG;
|
||||
import com.drmangotea.tfmg.content.concrete.ConcreteFluid;
|
||||
import com.drmangotea.tfmg.content.concrete.ConcreteFluidType;
|
||||
import com.simibubi.create.AllFluids;
|
||||
import com.drmangotea.tfmg.content.fluids.BurnableFluid;
|
||||
import com.simibubi.create.AllTags;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.mojang.blaze3d.shaders.FogShape;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.simibubi.create.AllTags.AllFluidTags;
|
||||
import com.simibubi.create.content.decoration.palettes.AllPaletteStoneTypes;
|
||||
import com.simibubi.create.content.fluids.VirtualFluid;
|
||||
import com.simibubi.create.content.fluids.potion.PotionFluid;
|
||||
import com.simibubi.create.content.fluids.potion.PotionFluid.PotionFluidType;
|
||||
import com.simibubi.create.foundation.utility.Color;
|
||||
import com.simibubi.create.infrastructure.config.AllConfigs;
|
||||
import com.tterrag.registrate.builders.FluidBuilder.FluidTypeFactory;
|
||||
import com.tterrag.registrate.util.entry.FluidEntry;
|
||||
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.renderer.FogRenderer.FogMode;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions;
|
||||
import net.minecraftforge.common.ForgeMod;
|
||||
import net.minecraftforge.fluids.FluidInteractionRegistry;
|
||||
import net.minecraftforge.fluids.FluidInteractionRegistry.InteractionInformation;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidType;
|
||||
import net.minecraftforge.fluids.ForgeFlowingFluid;
|
||||
|
||||
import static com.drmangotea.tfmg.CreateTFMG.REGISTRATE;
|
||||
@@ -121,7 +90,7 @@ public class TFMGFluids {
|
||||
|
||||
|
||||
|
||||
public static final FluidEntry<ForgeFlowingFluid.Flowing> CRUDE_OIL_FLUID =
|
||||
public static final FluidEntry<ForgeFlowingFluid.Flowing> CRUDE_OIL =
|
||||
REGISTRATE.fluid("crude_oil_fluid",CRUDE_OIL_STILL_RL,CRUDE_OIL_FLOW_RL)
|
||||
.lang("Crude Oil")
|
||||
.properties(b -> b.viscosity(1000)
|
||||
@@ -131,7 +100,7 @@ public class TFMGFluids {
|
||||
.slopeFindDistance(5)
|
||||
.explosionResistance(100f))
|
||||
|
||||
.source(ForgeFlowingFluid.Source::new)
|
||||
.source(BurnableFluid.Source::new)
|
||||
.bucket()
|
||||
.tag(AllTags.forgeItemTag("buckets/gasoline"))
|
||||
.build()
|
||||
@@ -167,7 +136,7 @@ public class TFMGFluids {
|
||||
.slopeFindDistance(5)
|
||||
.explosionResistance(100f))
|
||||
|
||||
.source(ForgeFlowingFluid.Source::new)
|
||||
.source(BurnableFluid.Source::new)
|
||||
.bucket()
|
||||
.tag(AllTags.forgeItemTag("buckets/gasoline"))
|
||||
.build()
|
||||
@@ -185,7 +154,7 @@ public class TFMGFluids {
|
||||
.slopeFindDistance(5)
|
||||
.explosionResistance(100f))
|
||||
|
||||
.source(ForgeFlowingFluid.Source::new)
|
||||
.source(BurnableFluid.Source::new)
|
||||
.bucket()
|
||||
.tag(AllTags.forgeItemTag("buckets/diesel"))
|
||||
.build()
|
||||
@@ -201,7 +170,7 @@ public class TFMGFluids {
|
||||
.slopeFindDistance(5)
|
||||
.explosionResistance(100f))
|
||||
|
||||
.source(ForgeFlowingFluid.Source::new)
|
||||
.source(BurnableFluid.Source::new)
|
||||
.bucket()
|
||||
.tag(AllTags.forgeItemTag("buckets/kerosene"))
|
||||
.build()
|
||||
@@ -217,7 +186,7 @@ public class TFMGFluids {
|
||||
.slopeFindDistance(5)
|
||||
.explosionResistance(100f))
|
||||
|
||||
.source(ForgeFlowingFluid.Source::new)
|
||||
.source(BurnableFluid.Source::new)
|
||||
.bucket()
|
||||
.tag(AllTags.forgeItemTag("buckets/naphtha"))
|
||||
.build()
|
||||
@@ -233,7 +202,7 @@ public class TFMGFluids {
|
||||
.slopeFindDistance(5)
|
||||
.explosionResistance(100f))
|
||||
|
||||
.source(ForgeFlowingFluid.Source::new)
|
||||
.source(BurnableFluid.Source::new)
|
||||
.bucket()
|
||||
.build()
|
||||
.register();
|
||||
@@ -248,7 +217,7 @@ public class TFMGFluids {
|
||||
.slopeFindDistance(5)
|
||||
.explosionResistance(100f))
|
||||
|
||||
.source(ForgeFlowingFluid.Source::new)
|
||||
.source(BurnableFluid.Source::new)
|
||||
.bucket()
|
||||
.build()
|
||||
.register();
|
||||
@@ -262,7 +231,7 @@ public class TFMGFluids {
|
||||
.slopeFindDistance(5)
|
||||
.explosionResistance(100f))
|
||||
|
||||
.source(ForgeFlowingFluid.Source::new)
|
||||
.source(BurnableFluid.Source::new)
|
||||
.bucket()
|
||||
.tag(AllTags.forgeItemTag("buckets/napalm"))
|
||||
.build()
|
||||
@@ -292,7 +261,7 @@ public class TFMGFluids {
|
||||
.slopeFindDistance(5)
|
||||
.explosionResistance(100f))
|
||||
|
||||
.source(ForgeFlowingFluid.Source::new)
|
||||
.source(BurnableFluid.Source::new)
|
||||
.bucket()
|
||||
//.tag(AllTags.forgeItemTag("buckets/napalm"))
|
||||
.build()
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.drmangotea.tfmg.registry;
|
||||
|
||||
import com.simibubi.create.AllCreativeModeTabs;
|
||||
import com.simibubi.create.AllSpriteShifts;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.content.decoration.palettes.*;
|
||||
import com.simibubi.create.foundation.block.connected.HorizontalCTBehaviour;
|
||||
import com.simibubi.create.foundation.block.connected.SimpleCTBehaviour;
|
||||
import com.simibubi.create.foundation.data.BlockStateGen;
|
||||
import com.simibubi.create.foundation.data.WindowGen;
|
||||
import com.tterrag.registrate.util.DataIngredient;
|
||||
import com.tterrag.registrate.util.entry.BlockEntry;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.GlassBlock;
|
||||
import net.minecraft.world.level.block.state.properties.WoodType;
|
||||
import net.minecraft.world.level.material.MaterialColor;
|
||||
import net.minecraftforge.common.Tags;
|
||||
|
||||
import static com.drmangotea.tfmg.CreateTFMG.REGISTRATE;
|
||||
import static com.simibubi.create.foundation.data.WindowGen.*;
|
||||
|
||||
public class TFMGPaletteBlocks {
|
||||
|
||||
static {
|
||||
REGISTRATE.creativeModeTab(() -> TFMGCreativeModeTabs.TFMG_BASE);
|
||||
}
|
||||
|
||||
|
||||
static {
|
||||
TFMGPaletteStoneTypes.register(REGISTRATE);
|
||||
}
|
||||
|
||||
public static void register() {}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.drmangotea.tfmg.registry;
|
||||
|
||||
import com.drmangotea.tfmg.CreateTFMG;
|
||||
import com.drmangotea.tfmg.base.palettes.TFMGPaletteBlockPattern;
|
||||
import com.drmangotea.tfmg.base.palettes.TFMGPalettesVariantEntry;
|
||||
import com.simibubi.create.AllTags;
|
||||
|
||||
import com.simibubi.create.foundation.data.CreateRegistrate;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import com.tterrag.registrate.util.nullness.NonNullSupplier;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.material.MaterialColor;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import static com.drmangotea.tfmg.base.palettes.TFMGPaletteBlockPattern.STANDARD_RANGE;
|
||||
|
||||
public enum TFMGPaletteStoneTypes {
|
||||
|
||||
|
||||
BAUXITE(STANDARD_RANGE, r -> r.paletteStoneBlock("bauxite", () -> Blocks.DEEPSLATE, true, true)
|
||||
.properties(p -> p.destroyTime(1.25f)
|
||||
.color(MaterialColor.COLOR_BLUE))
|
||||
.register()),
|
||||
|
||||
;
|
||||
|
||||
private Function<CreateRegistrate, NonNullSupplier<Block>> factory;
|
||||
private TFMGPalettesVariantEntry variants;
|
||||
|
||||
public NonNullSupplier<Block> baseBlock;
|
||||
public TFMGPaletteBlockPattern[] variantTypes;
|
||||
public TagKey<Item> materialTag;
|
||||
|
||||
private TFMGPaletteStoneTypes(TFMGPaletteBlockPattern[] variantTypes,
|
||||
Function<CreateRegistrate, NonNullSupplier<Block>> factory) {
|
||||
this.factory = factory;
|
||||
this.variantTypes = variantTypes;
|
||||
}
|
||||
|
||||
public NonNullSupplier<Block> getBaseBlock() {
|
||||
return baseBlock;
|
||||
}
|
||||
|
||||
public TFMGPalettesVariantEntry getVariants() {
|
||||
return variants;
|
||||
}
|
||||
|
||||
public static void register(CreateRegistrate registrate) {
|
||||
for (TFMGPaletteStoneTypes paletteStoneVariants : values()) {
|
||||
NonNullSupplier<Block> baseBlock = paletteStoneVariants.factory.apply(registrate);
|
||||
paletteStoneVariants.baseBlock = baseBlock;
|
||||
String id = Lang.asId(paletteStoneVariants.name());
|
||||
paletteStoneVariants.materialTag =
|
||||
AllTags.optionalTag(ForgeRegistries.ITEMS, CreateTFMG.asResource("stone_types/" + id));
|
||||
paletteStoneVariants.variants = new TFMGPalettesVariantEntry(id, paletteStoneVariants);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
170
src/main/java/com/drmangotea/tfmg/worldgen/OilFeature.java
Normal file
@@ -0,0 +1,170 @@
|
||||
package com.drmangotea.tfmg.worldgen;
|
||||
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import com.mojang.serialization.Codec;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.BuddingAmethystBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.levelgen.*;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.GeodeConfiguration;
|
||||
import net.minecraft.world.level.levelgen.synth.NormalNoise;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class OilFeature extends Feature<GeodeConfiguration> {
|
||||
private static final Direction[] DIRECTIONS = Direction.values();
|
||||
|
||||
public OilFeature(Codec<GeodeConfiguration> p_159834_) {
|
||||
super(p_159834_);
|
||||
}
|
||||
|
||||
public boolean place(FeaturePlaceContext<GeodeConfiguration> p_159836_) {
|
||||
GeodeConfiguration geodeconfiguration = p_159836_.config();
|
||||
RandomSource random = p_159836_.random();
|
||||
BlockPos blockpos = p_159836_.origin();
|
||||
WorldGenLevel worldgenlevel = p_159836_.level();
|
||||
int i = geodeconfiguration.minGenOffset;
|
||||
int j = geodeconfiguration.maxGenOffset;
|
||||
List<Pair<BlockPos, Integer>> list = Lists.newLinkedList();
|
||||
int k = 10;
|
||||
WorldgenRandom worldgenrandom = new WorldgenRandom(new LegacyRandomSource(worldgenlevel.getSeed()));
|
||||
NormalNoise normalnoise = NormalNoise.create(worldgenrandom, -4, 0.5D);
|
||||
List<BlockPos> list1 = Lists.newLinkedList();
|
||||
double d0 = (double)k / (double)geodeconfiguration.outerWallDistance.getMaxValue();
|
||||
GeodeLayerSettings geodelayersettings = geodeconfiguration.geodeLayerSettings;
|
||||
GeodeBlockSettings geodeblocksettings = geodeconfiguration.geodeBlockSettings;
|
||||
GeodeCrackSettings geodecracksettings = geodeconfiguration.geodeCrackSettings;
|
||||
double d1 = 1.0D / Math.sqrt(geodelayersettings.filling-1);
|
||||
double d2 = 1.0D / Math.sqrt(geodelayersettings.innerLayer + d0-5);
|
||||
double d3 = 1.0D / Math.sqrt(geodelayersettings.middleLayer + d0-5);
|
||||
double d4 = 1.0D / Math.sqrt(geodelayersettings.outerLayer + d0-4.7);
|
||||
double d5 = 1.0D / Math.sqrt(geodecracksettings.baseCrackSize + random.nextDouble() / 2.0D + (k > 3 ? d0 : 0.0D));
|
||||
boolean flag = false;
|
||||
int l = 0;
|
||||
|
||||
for(int i1 = 0; i1 < k; ++i1) {
|
||||
int j1 = geodeconfiguration.outerWallDistance.sample(random);
|
||||
int k1 = geodeconfiguration.outerWallDistance.sample(random);
|
||||
int l1 = geodeconfiguration.outerWallDistance.sample(random);
|
||||
BlockPos blockpos1 = blockpos.offset(j1, k1, l1);
|
||||
BlockState blockstate = worldgenlevel.getBlockState(blockpos1);
|
||||
if (blockstate.isAir() || blockstate.is(BlockTags.GEODE_INVALID_BLOCKS)) {
|
||||
++l;
|
||||
if (l > geodeconfiguration.invalidBlocksThreshold) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
list.add(Pair.of(blockpos1, geodeconfiguration.pointOffset.sample(random)));
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
int i2 = random.nextInt(4);
|
||||
int j2 = k * 2 + 1;
|
||||
if (i2 == 0) {
|
||||
list1.add(blockpos.offset(j2, 7, 0));
|
||||
list1.add(blockpos.offset(j2, 5, 0));
|
||||
list1.add(blockpos.offset(j2, 1, 0));
|
||||
} else if (i2 == 1) {
|
||||
list1.add(blockpos.offset(0, 7, j2));
|
||||
list1.add(blockpos.offset(0, 5, j2));
|
||||
list1.add(blockpos.offset(0, 1, j2));
|
||||
} else if (i2 == 2) {
|
||||
list1.add(blockpos.offset(j2, 7, j2));
|
||||
list1.add(blockpos.offset(j2, 5, j2));
|
||||
list1.add(blockpos.offset(j2, 1, j2));
|
||||
} else {
|
||||
list1.add(blockpos.offset(0, 7, 0));
|
||||
list1.add(blockpos.offset(0, 5, 0));
|
||||
list1.add(blockpos.offset(0, 1, 0));
|
||||
}
|
||||
}
|
||||
|
||||
List<BlockPos> list2 = Lists.newArrayList();
|
||||
Predicate<BlockState> predicate = isReplaceable(geodeconfiguration.geodeBlockSettings.cannotReplace);
|
||||
|
||||
for(BlockPos blockpos3 : BlockPos.betweenClosed(blockpos.offset(i, i, i), blockpos.offset(j, j, j))) {
|
||||
double d8 = normalnoise.getValue((double)blockpos3.getX(), (double)blockpos3.getY(), (double)blockpos3.getZ()) * geodeconfiguration.noiseMultiplier;
|
||||
double d6 = 0.0D;
|
||||
double d7 = 0.0D;
|
||||
|
||||
for(Pair<BlockPos, Integer> pair : list) {
|
||||
d6 += Mth.fastInvSqrt(blockpos3.distSqr(pair.getFirst()) + (double)pair.getSecond().intValue()) + d8;
|
||||
}
|
||||
|
||||
for(BlockPos blockpos6 : list1) {
|
||||
d7 += Mth.fastInvSqrt(blockpos3.distSqr(blockpos6) + (double)geodecracksettings.crackPointOffset) + d8;
|
||||
}
|
||||
|
||||
if (!(d6 < d4)) {
|
||||
if (flag && d7 >= d5 && d6 < d1) {
|
||||
this.safeSetBlock(worldgenlevel, blockpos3, Blocks.AIR.defaultBlockState(), predicate);
|
||||
|
||||
for(Direction direction1 : DIRECTIONS) {
|
||||
BlockPos blockpos2 = blockpos3.relative(direction1);
|
||||
FluidState fluidstate = worldgenlevel.getFluidState(blockpos2);
|
||||
if (!fluidstate.isEmpty()) {
|
||||
worldgenlevel.scheduleTick(blockpos2, fluidstate.getType(), 0);
|
||||
}
|
||||
}
|
||||
} else if (d6 >= d1) {
|
||||
this.safeSetBlock(worldgenlevel, blockpos3, geodeblocksettings.fillingProvider.getState(random, blockpos3), predicate);
|
||||
} else if (d6 >= d2) {
|
||||
boolean flag1 = (double)random.nextFloat() < geodeconfiguration.useAlternateLayer0Chance;
|
||||
if (flag1) {
|
||||
this.safeSetBlock(worldgenlevel, blockpos3, geodeblocksettings.alternateInnerLayerProvider.getState(random, blockpos3), predicate);
|
||||
} else {
|
||||
this.safeSetBlock(worldgenlevel, blockpos3, geodeblocksettings.innerLayerProvider.getState(random, blockpos3), predicate);
|
||||
}
|
||||
|
||||
if ((!geodeconfiguration.placementsRequireLayer0Alternate || flag1) && (double)random.nextFloat() < geodeconfiguration.usePotentialPlacementsChance) {
|
||||
list2.add(blockpos3.immutable());
|
||||
}
|
||||
} else if (d6 >= d3) {
|
||||
this.safeSetBlock(worldgenlevel, blockpos3, geodeblocksettings.middleLayerProvider.getState(random, blockpos3), predicate);
|
||||
} else if (d6 >= d4) {
|
||||
this.safeSetBlock(worldgenlevel, blockpos3, geodeblocksettings.outerLayerProvider.getState(random, blockpos3), predicate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<BlockState> list3 = geodeblocksettings.innerPlacements;
|
||||
|
||||
for(BlockPos blockpos4 : list2) {
|
||||
BlockState blockstate1 = Util.getRandom(list3, random);
|
||||
|
||||
for(Direction direction : DIRECTIONS) {
|
||||
if (blockstate1.hasProperty(BlockStateProperties.FACING)) {
|
||||
blockstate1 = blockstate1.setValue(BlockStateProperties.FACING, direction);
|
||||
}
|
||||
|
||||
BlockPos blockpos5 = blockpos4.relative(direction);
|
||||
BlockState blockstate2 = worldgenlevel.getBlockState(blockpos5);
|
||||
if (blockstate1.hasProperty(BlockStateProperties.WATERLOGGED)) {
|
||||
blockstate1 = blockstate1.setValue(BlockStateProperties.WATERLOGGED, Boolean.valueOf(blockstate2.getFluidState().isSource()));
|
||||
}
|
||||
|
||||
if (BuddingAmethystBlock.canClusterGrowAtState(blockstate2)) {
|
||||
this.safeSetBlock(worldgenlevel, blockpos5, blockstate1, predicate);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.drmangotea.tfmg.worldgen;
|
||||
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.drmangotea.tfmg.registry.TFMGFluids;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.data.worldgen.features.FeatureUtils;
|
||||
import net.minecraft.data.worldgen.placement.PlacementUtils;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.util.valueproviders.UniformInt;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.levelgen.GeodeBlockSettings;
|
||||
import net.minecraft.world.level.levelgen.GeodeCrackSettings;
|
||||
import net.minecraft.world.level.levelgen.GeodeLayerSettings;
|
||||
import net.minecraft.world.level.levelgen.VerticalAnchor;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.GeodeConfiguration;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration;
|
||||
import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProvider;
|
||||
import net.minecraft.world.level.levelgen.placement.*;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.BlockMatchTest;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class TFMGConfiguredFeatures {
|
||||
|
||||
// public static final DeferredRegister<PlacedFeature> PLACED_FEATURES =
|
||||
// DeferredRegister.create(Registry.PLACED_FEATURE_REGISTRY, CreateIndustry.MOD_ID);
|
||||
|
||||
|
||||
public static final RuleTest BEDROCK = new BlockMatchTest(Blocks.BEDROCK);
|
||||
//-------------------------------------------------------------------------------------------------//
|
||||
|
||||
|
||||
public static final Holder<ConfiguredFeature<GeodeConfiguration, ?>> OIL_CONFIGURED =
|
||||
FeatureUtils.register("tfmg:oil", TFMGFeatures.OIL.get(),
|
||||
new GeodeConfiguration(new GeodeBlockSettings(BlockStateProvider.simple(TFMGFluids.CRUDE_OIL.get().getSource().defaultFluidState().createLegacyBlock()), BlockStateProvider.simple(Blocks.AIR), BlockStateProvider.simple(Blocks.AIR), BlockStateProvider.simple(Blocks.AIR), BlockStateProvider.simple(TFMGBlocks.FOSSILSTONE.get()), List.of(Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState()), BlockTags.FEATURES_CANNOT_REPLACE, BlockTags.GEODE_INVALID_BLOCKS), new GeodeLayerSettings(1.7D, 2.2D, 3.2D, 4.2D), new GeodeCrackSettings(0.95D, 2.0D, 2), 0.35D, 0.083D, true, UniformInt.of(4, 6), UniformInt.of(3, 4), UniformInt.of(1, 2), -16, 16, 0.05D, 1));
|
||||
|
||||
|
||||
public static final Holder<ConfiguredFeature<OreConfiguration, ?>> SIMULATED_OIL_CONFIGURED =
|
||||
FeatureUtils.register("tfmg:simulated_oil", TFMGFeatures.SIMULATED_OIL.get(),
|
||||
new OreConfiguration(BEDROCK, TFMGBlocks.OIL_DEPOSIT.get().defaultBlockState(), 35));
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------//
|
||||
|
||||
|
||||
public static final Holder<PlacedFeature> OIL_PLACED = PlacementUtils.register("tfmg:oil",
|
||||
OIL_CONFIGURED, RarityFilter.onAverageOnceEvery(120),
|
||||
InSquarePlacement.spread(),
|
||||
HeightRangePlacement.uniform(VerticalAnchor.absolute(-50),
|
||||
VerticalAnchor.absolute(-10)), BiomeFilter.biome());
|
||||
|
||||
public static final Holder<PlacedFeature> SIMULATED_OIL_PLACED = PlacementUtils.register("tfmg:simulated_oil",
|
||||
SIMULATED_OIL_CONFIGURED, RarityFilter.onAverageOnceEvery(75));
|
||||
|
||||
|
||||
|
||||
|
||||
// public static void register(IEventBus eventBus) {
|
||||
// PLACED_FEATURES.register(eventBus);
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
34
src/main/java/com/drmangotea/tfmg/worldgen/TFMGFeatures.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package com.drmangotea.tfmg.worldgen;
|
||||
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.CreateTFMG;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.levelgen.feature.OreFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.GeodeConfiguration;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
|
||||
public class TFMGFeatures {
|
||||
|
||||
public static final DeferredRegister<Feature<?>> FEATURES = DeferredRegister.create(ForgeRegistries.FEATURES, CreateTFMG.MOD_ID);
|
||||
|
||||
//-------------------------------------------------------------------------------------------------//
|
||||
|
||||
public static final RegistryObject<Feature<GeodeConfiguration>> OIL = FEATURES.register("oil", () ->
|
||||
new OilFeature(GeodeConfiguration.CODEC));
|
||||
|
||||
|
||||
|
||||
public static final RegistryObject<Feature<OreConfiguration>> SIMULATED_OIL = FEATURES.register("simulated_oil", () ->
|
||||
new OreFeature(OreConfiguration.CODEC));
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------//
|
||||
public static void register(IEventBus eventBus) {
|
||||
FEATURES.register(eventBus);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.drmangotea.tfmg.worldgen;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.simibubi.create.content.decoration.palettes.AllPaletteStoneTypes;
|
||||
import com.simibubi.create.infrastructure.worldgen.LayerPattern;
|
||||
import com.tterrag.registrate.util.nullness.NonNullSupplier;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
||||
public class TFMGLayeredPatterns {
|
||||
|
||||
public static final NonNullSupplier<LayerPattern>
|
||||
|
||||
BAUXITE = () -> LayerPattern.builder()
|
||||
.layer(l -> l.weight(1)
|
||||
.passiveBlock())
|
||||
.layer(l -> l.weight(2)
|
||||
.block(TFMGBlocks.CONCRETE.get())
|
||||
.size(1, 3))
|
||||
.layer(l -> l.weight(1)
|
||||
.block(Blocks.SMOOTH_BASALT)
|
||||
.block(Blocks.GRANITE)
|
||||
.size(2, 2))
|
||||
.layer(l -> l.weight(1)
|
||||
.blocks(Blocks.GRANITE, Blocks.SMOOTH_BASALT))
|
||||
.layer(l -> l.weight(1)
|
||||
.block(AllPaletteStoneTypes.ANDESITE.getBaseBlock()))
|
||||
.build();
|
||||
|
||||
public static final NonNullSupplier<LayerPattern>
|
||||
|
||||
GALENA = () -> LayerPattern.builder()
|
||||
.layer(l -> l.weight(1)
|
||||
.passiveBlock())
|
||||
.layer(l -> l.weight(2)
|
||||
.block(TFMGBlocks.CONCRETE.get())
|
||||
.size(1, 3))
|
||||
.layer(l -> l.weight(1)
|
||||
.block(Blocks.SMOOTH_BASALT)
|
||||
.block(Blocks.GRANITE)
|
||||
.size(2, 2))
|
||||
.layer(l -> l.weight(1)
|
||||
.blocks(Blocks.GRANITE, Blocks.SMOOTH_BASALT))
|
||||
.layer(l -> l.weight(1)
|
||||
.block(AllPaletteStoneTypes.ANDESITE.getBaseBlock()))
|
||||
.build();
|
||||
|
||||
public static final NonNullSupplier<LayerPattern>
|
||||
|
||||
LIGNITE = () -> LayerPattern.builder()
|
||||
.layer(l -> l.weight(1)
|
||||
.passiveBlock())
|
||||
.layer(l -> l.weight(2)
|
||||
.block(TFMGBlocks.CONCRETE.get())
|
||||
.size(1, 3))
|
||||
.layer(l -> l.weight(1)
|
||||
.block(Blocks.TUFF)
|
||||
.block(Blocks.DEEPSLATE)
|
||||
.size(2, 2))
|
||||
.layer(l -> l.weight(1)
|
||||
.blocks(Blocks.DEEPSLATE, Blocks.TUFF))
|
||||
.layer(l -> l.weight(1)
|
||||
.block(AllPaletteStoneTypes.SCORIA.getBaseBlock()))
|
||||
.build();
|
||||
|
||||
|
||||
public static final NonNullSupplier<LayerPattern>
|
||||
|
||||
SULFUR = () -> LayerPattern.builder()
|
||||
.inNether()
|
||||
.layer(l -> l.weight(2)
|
||||
.passiveBlock())
|
||||
.layer(l -> l.weight(2)
|
||||
.block(TFMGBlocks.CONCRETE.get())
|
||||
.size(1, 2))
|
||||
.layer(l -> l.weight(3)
|
||||
.block(AllPaletteStoneTypes.SCORCHIA.getBaseBlock())
|
||||
.block(Blocks.BLACKSTONE)
|
||||
.size(1, 3))
|
||||
.layer(l -> l.weight(1)
|
||||
.block(Blocks.MAGMA_BLOCK))
|
||||
.layer(l -> l.weight(2)
|
||||
.block(Blocks.BASALT)
|
||||
.block(Blocks.SMOOTH_BASALT))
|
||||
.build();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
After Width: | Height: | Size: 240 B |
|
After Width: | Height: | Size: 246 B |
|
After Width: | Height: | Size: 243 B |
|
After Width: | Height: | Size: 230 B |
|
After Width: | Height: | Size: 224 B |
|
After Width: | Height: | Size: 230 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 206 B |
|
After Width: | Height: | Size: 223 B |
|
After Width: | Height: | Size: 346 B |
|
After Width: | Height: | Size: 195 B |
|
After Width: | Height: | Size: 182 B |
|
After Width: | Height: | Size: 177 B |
|
After Width: | Height: | Size: 197 B |
|
After Width: | Height: | Size: 202 B |
|
After Width: | Height: | Size: 908 B |
|
After Width: | Height: | Size: 219 B |
|
After Width: | Height: | Size: 224 B |
|
After Width: | Height: | Size: 240 B |
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"type": "forge:add_features",
|
||||
"biomes": "#minecraft:is_overworld",
|
||||
"features": "tfmg:simulated_oil",
|
||||
"step": "underground_ores"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"type": "forge:add_features",
|
||||
"biomes": "#minecraft:is_overworld",
|
||||
"features": "tfmg:oil",
|
||||
"step": "underground_ores"
|
||||
}
|
||||
@@ -6,7 +6,8 @@
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"refmap": "tfmg.refmap.json",
|
||||
"mixins": [
|
||||
|
||||
"AllOreFeatureConfigEntriesMixin"
|
||||
// "FluidPropagatorMixin"
|
||||
],
|
||||
|
||||
"injectors": {
|
||||
|
||||
16
src/main/resources/tfmg_changelog.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
Version 0.6.0
|
||||
|
||||
|
||||
-liquid concrete changed from a block to actuall fluid
|
||||
-liquid concrete bucket works with smart pipes
|
||||
-changed strength of oil deposits from 696969 to 69696969
|
||||
-added formwork
|
||||
-added cooling liquid
|
||||
-added creosote
|
||||
-added connected texture to cast iron block
|
||||
-added blue and green fire
|
||||
-added copper and zinc grenades
|
||||
-sparks from thermite grenades now set mobs on fire on impact
|
||||
-changed id of the mod from "createindustry" to "tfmg"
|
||||
-increased burning time of fossilstone and coal coke
|
||||
-oil deposits spawn in larger but rarer groups
|
||||