mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-13 05:54:17 +01:00
Merge remote-tracking branch 'upstream/mc1.18/dev' into mc1.19/dev
Conflicts: src/main/java/com/simibubi/create/AllFluids.java src/main/java/com/simibubi/create/CreateClient.java src/main/java/com/simibubi/create/foundation/worldgen/BuiltinRegistration.java src/main/java/com/simibubi/create/foundation/worldgen/OreFeatureConfigEntry.java
This commit is contained in:
commit
d09ccf24d2
@ -12,16 +12,12 @@ import com.simibubi.create.content.palettes.AllPaletteStoneTypes;
|
||||
import com.simibubi.create.foundation.data.CreateRegistrate;
|
||||
import com.tterrag.registrate.util.entry.FluidEntry;
|
||||
|
||||
import net.minecraft.client.renderer.ItemBlockRenderTypes;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
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.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidType;
|
||||
@ -33,17 +29,17 @@ public class AllFluids {
|
||||
|
||||
public static final FluidEntry<PotionFluid> POTION =
|
||||
REGISTRATE.virtualFluid("potion", PotionFluidType::new, PotionFluid::new)
|
||||
.lang(f -> "fluid.create.potion", "Potion")
|
||||
.lang("Potion")
|
||||
.register();
|
||||
|
||||
public static final FluidEntry<VirtualFluid> TEA = REGISTRATE.virtualFluid("tea")
|
||||
.lang(f -> "fluid.create.tea", "Builder's Tea")
|
||||
.lang("Builder's Tea")
|
||||
.tag(AllTags.forgeFluidTag("tea"))
|
||||
.register();
|
||||
|
||||
public static final FluidEntry<ForgeFlowingFluid.Flowing> HONEY =
|
||||
REGISTRATE.standardFluid("honey", NoColorFluidAttributes::new)
|
||||
.lang(f -> "fluid.create.honey", "Honey")
|
||||
.lang("Honey")
|
||||
.properties(b -> b.viscosity(2000)
|
||||
.density(1400))
|
||||
.fluidProperties(p -> p.levelDecreasePerBlock(2)
|
||||
@ -59,7 +55,7 @@ public class AllFluids {
|
||||
|
||||
public static final FluidEntry<ForgeFlowingFluid.Flowing> CHOCOLATE =
|
||||
REGISTRATE.standardFluid("chocolate", NoColorFluidAttributes::new)
|
||||
.lang(f -> "fluid.create.chocolate", "Chocolate")
|
||||
.lang("Chocolate")
|
||||
.tag(AllTags.forgeFluidTag("chocolate"))
|
||||
.properties(b -> b.viscosity(1500)
|
||||
.density(1400))
|
||||
@ -73,16 +69,6 @@ public class AllFluids {
|
||||
|
||||
public static void register() {}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void assignRenderLayers() {}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private static void makeTranslucent(FluidEntry<?> entry) {
|
||||
ForgeFlowingFluid fluid = entry.get();
|
||||
ItemBlockRenderTypes.setRenderLayer(fluid, RenderType.translucent());
|
||||
ItemBlockRenderTypes.setRenderLayer(fluid.getSource(), RenderType.translucent());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static BlockState getLavaInteraction(FluidState fluidState) {
|
||||
Fluid fluid = fluidState.getType();
|
||||
|
@ -37,6 +37,7 @@ import com.simibubi.create.foundation.data.recipe.StandardRecipeGen;
|
||||
import com.simibubi.create.foundation.networking.AllPackets;
|
||||
import com.simibubi.create.foundation.utility.CreateRegistry;
|
||||
import com.simibubi.create.foundation.worldgen.AllFeatures;
|
||||
import com.simibubi.create.foundation.worldgen.AllOreFeatureConfigEntries;
|
||||
import com.simibubi.create.foundation.worldgen.AllPlacementModifiers;
|
||||
import com.simibubi.create.foundation.worldgen.BuiltinRegistration;
|
||||
import com.tterrag.registrate.util.nullness.NonNullSupplier;
|
||||
@ -111,6 +112,7 @@ public class Create {
|
||||
AllParticleTypes.register(modEventBus);
|
||||
AllStructureProcessorTypes.register(modEventBus);
|
||||
AllEntityDataSerializers.register(modEventBus);
|
||||
AllOreFeatureConfigEntries.init();
|
||||
AllFeatures.register(modEventBus);
|
||||
AllPlacementModifiers.register(modEventBus);
|
||||
BuiltinRegistration.register(modEventBus);
|
||||
|
@ -75,7 +75,6 @@ public class CreateClient {
|
||||
BUFFER_CACHE.registerCompartment(SBBContraptionManager.CONTRAPTION, 20);
|
||||
BUFFER_CACHE.registerCompartment(WorldSectionElement.DOC_WORLD_SECTION, 20);
|
||||
|
||||
// AllFluids.assignRenderLayers();
|
||||
AllBlockPartials.init();
|
||||
AllStitchedTextures.init();
|
||||
|
||||
|
@ -79,7 +79,7 @@ public class AllOreFeatureConfigEntries {
|
||||
for (Map.Entry<ResourceLocation, OreFeatureConfigEntry> entry : OreFeatureConfigEntry.ALL.entrySet()) {
|
||||
DatagenExtension datagenExt = entry.getValue().datagenExt();
|
||||
if (datagenExt != null) {
|
||||
configuredFeatures.put(entry.getKey(), datagenExt.getConfiguredFeature());
|
||||
configuredFeatures.put(entry.getKey(), datagenExt.createConfiguredFeature(registryAccess));
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ public class AllOreFeatureConfigEntries {
|
||||
for (Map.Entry<ResourceLocation, OreFeatureConfigEntry> entry : OreFeatureConfigEntry.ALL.entrySet()) {
|
||||
DatagenExtension datagenExt = entry.getValue().datagenExt();
|
||||
if (datagenExt != null) {
|
||||
placedFeatures.put(entry.getKey(), datagenExt.getPlacedFeature());
|
||||
placedFeatures.put(entry.getKey(), datagenExt.createPlacedFeature(registryAccess));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ import com.simibubi.create.Create;
|
||||
import com.simibubi.create.foundation.worldgen.OreFeatureConfigEntry.DatagenExtension;
|
||||
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.data.BuiltinRegistries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||
@ -25,9 +26,9 @@ public class BuiltinRegistration {
|
||||
if (id.getNamespace().equals(Create.ID)) {
|
||||
DatagenExtension datagenExt = entry.getValue().datagenExt();
|
||||
if (datagenExt != null) {
|
||||
CONFIGURED_FEATURE_REGISTER.register(id.getPath(), () -> datagenExt.getConfiguredFeature());
|
||||
PLACED_FEATURE_REGISTER.register(id.getPath(), () -> datagenExt.getPlacedFeature());
|
||||
BIOME_MODIFIER_REGISTER.register(id.getPath(), () -> datagenExt.getBiomeModifier());
|
||||
CONFIGURED_FEATURE_REGISTER.register(id.getPath(), () -> datagenExt.createConfiguredFeature(BuiltinRegistries.ACCESS));
|
||||
PLACED_FEATURE_REGISTER.register(id.getPath(), () -> datagenExt.createPlacedFeature(BuiltinRegistries.ACCESS));
|
||||
BIOME_MODIFIER_REGISTER.register(id.getPath(), () -> datagenExt.createBiomeModifier(BuiltinRegistries.ACCESS));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ import com.tterrag.registrate.util.nullness.NonNullSupplier;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.HolderSet;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.data.BuiltinRegistries;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.data.worldgen.features.OreFeatures;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
@ -109,39 +109,25 @@ public class OreFeatureConfigEntry extends ConfigBase {
|
||||
public abstract class DatagenExtension {
|
||||
public TagKey<Biome> biomeTag;
|
||||
|
||||
protected ConfiguredFeature<?, ?> configuredFeature;
|
||||
protected PlacedFeature placedFeature;
|
||||
protected BiomeModifier biomeModifier;
|
||||
|
||||
public DatagenExtension biomeTag(TagKey<Biome> biomes) {
|
||||
this.biomeTag = biomes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public abstract ConfiguredFeature<?, ?> getConfiguredFeature();
|
||||
public abstract ConfiguredFeature<?, ?> createConfiguredFeature(RegistryAccess registryAccess);
|
||||
|
||||
public PlacedFeature getPlacedFeature() {
|
||||
if (placedFeature != null) {
|
||||
return placedFeature;
|
||||
}
|
||||
|
||||
Holder<ConfiguredFeature<?, ?>> featureHolder = BuiltinRegistries.CONFIGURED_FEATURE.getOrCreateHolderOrThrow(ResourceKey.create(Registry.CONFIGURED_FEATURE_REGISTRY, id));
|
||||
placedFeature = new PlacedFeature(featureHolder, List.of(new ConfigDrivenPlacement(OreFeatureConfigEntry.this)));
|
||||
|
||||
return placedFeature;
|
||||
public PlacedFeature createPlacedFeature(RegistryAccess registryAccess) {
|
||||
Registry<ConfiguredFeature<?, ?>> featureRegistry = registryAccess.registryOrThrow(Registry.CONFIGURED_FEATURE_REGISTRY);
|
||||
Holder<ConfiguredFeature<?, ?>> featureHolder = featureRegistry.getOrCreateHolderOrThrow(ResourceKey.create(Registry.CONFIGURED_FEATURE_REGISTRY, id));
|
||||
return new PlacedFeature(featureHolder, List.of(new ConfigDrivenPlacement(OreFeatureConfigEntry.this)));
|
||||
}
|
||||
|
||||
public BiomeModifier getBiomeModifier() {
|
||||
if (biomeModifier != null) {
|
||||
return biomeModifier;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
HolderSet<Biome> biomes = new HolderSet.Named<>(BuiltinRegistries.BIOME, biomeTag);
|
||||
Holder<PlacedFeature> featureHolder = BuiltinRegistries.PLACED_FEATURE.getOrCreateHolderOrThrow(ResourceKey.create(Registry.PLACED_FEATURE_REGISTRY, id));
|
||||
biomeModifier = new AddFeaturesBiomeModifier(biomes, HolderSet.direct(featureHolder), Decoration.UNDERGROUND_ORES);
|
||||
|
||||
return biomeModifier;
|
||||
public BiomeModifier createBiomeModifier(RegistryAccess registryAccess) {
|
||||
Registry<Biome> biomeRegistry = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY);
|
||||
Registry<PlacedFeature> featureRegistry = registryAccess.registryOrThrow(Registry.PLACED_FEATURE_REGISTRY);
|
||||
HolderSet<Biome> biomes = new HolderSet.Named<>(biomeRegistry, biomeTag);
|
||||
Holder<PlacedFeature> featureHolder = featureRegistry.getOrCreateHolderOrThrow(ResourceKey.create(Registry.PLACED_FEATURE_REGISTRY, id));
|
||||
return new AddFeaturesBiomeModifier(biomes, HolderSet.direct(featureHolder), Decoration.UNDERGROUND_ORES);
|
||||
}
|
||||
|
||||
public OreFeatureConfigEntry parent() {
|
||||
@ -178,11 +164,7 @@ public class OreFeatureConfigEntry extends ConfigBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfiguredFeature<?, ?> getConfiguredFeature() {
|
||||
if (configuredFeature != null) {
|
||||
return configuredFeature;
|
||||
}
|
||||
|
||||
public ConfiguredFeature<?, ?> createConfiguredFeature(RegistryAccess registryAccess) {
|
||||
List<TargetBlockState> targetStates = new ArrayList<>();
|
||||
if (block != null)
|
||||
targetStates.add(OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, block.get()
|
||||
@ -195,9 +177,7 @@ public class OreFeatureConfigEntry extends ConfigBase {
|
||||
.defaultBlockState()));
|
||||
|
||||
ConfigDrivenOreFeatureConfiguration config = new ConfigDrivenOreFeatureConfiguration(OreFeatureConfigEntry.this, 0, targetStates);
|
||||
configuredFeature = new ConfiguredFeature<>(AllFeatures.STANDARD_ORE.get(), config);
|
||||
|
||||
return configuredFeature;
|
||||
return new ConfiguredFeature<>(AllFeatures.STANDARD_ORE.get(), config);
|
||||
}
|
||||
}
|
||||
|
||||
@ -216,19 +196,13 @@ public class OreFeatureConfigEntry extends ConfigBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfiguredFeature<?, ?> getConfiguredFeature() {
|
||||
if (configuredFeature != null) {
|
||||
return configuredFeature;
|
||||
}
|
||||
|
||||
public ConfiguredFeature<?, ?> createConfiguredFeature(RegistryAccess registryAccess) {
|
||||
List<LayerPattern> layerPatterns = this.layerPatterns.stream()
|
||||
.map(NonNullSupplier::get)
|
||||
.toList();
|
||||
|
||||
ConfigDrivenLayeredOreFeatureConfiguration config = new ConfigDrivenLayeredOreFeatureConfiguration(OreFeatureConfigEntry.this, 0, layerPatterns);
|
||||
configuredFeature = new ConfiguredFeature<>(AllFeatures.LAYERED_ORE.get(), config);
|
||||
|
||||
return configuredFeature;
|
||||
return new ConfiguredFeature<>(AllFeatures.LAYERED_ORE.get(), config);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user