Compare commits
7 Commits
krystal's-
...
1.18.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a956933e73 | ||
|
|
c2c3c06261 | ||
|
|
03650c6df1 | ||
|
|
17ab0baa7f | ||
|
|
dc87df19d6 | ||
|
|
04a6888472 | ||
|
|
f54098ff8d |
22
build.gradle
22
build.gradle
@@ -29,7 +29,7 @@ apply plugin: 'org.spongepowered.mixin'
|
||||
// add sourceSets.main, "createindustry.refmap.json"
|
||||
//}
|
||||
|
||||
version = '0.9.0c-1.19.2'
|
||||
version = '0.9.0c-1.18.2'
|
||||
group = 'com.drmangotea.createindustry' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = 'createindustry'
|
||||
|
||||
@@ -114,6 +114,11 @@ repositories {
|
||||
includeGroup "curse.maven"
|
||||
}
|
||||
}
|
||||
maven {
|
||||
// Location of the maven that hosts JEI files (and TiC) [1.18.2]
|
||||
name 'Progwml6 maven'
|
||||
url 'https://dvs1.progwml6.com/files/maven'
|
||||
}
|
||||
maven {
|
||||
// location of the maven that hosts JEI files since January 2023
|
||||
// location of the maven for Vazkii's mods
|
||||
@@ -140,20 +145,19 @@ dependencies {
|
||||
implementation fg.deobf("com.simibubi.create:create-${minecraft_version}:${create_version}:all") { transitive = false }
|
||||
|
||||
|
||||
implementation fg.deobf("curse.maven:createaddition-439890:5070245")
|
||||
implementation fg.deobf("curse.maven:zinclib-968773:5110339")
|
||||
implementation fg.deobf("curse.maven:createaddition-439890:4683727")
|
||||
//implementation fg.deobf("curse.maven:zinclib-968773:5110339")
|
||||
|
||||
implementation fg.deobf("curse.maven:mekanism-268560:4644795")
|
||||
implementation fg.deobf("curse.maven:mekanism-268560:3875976")
|
||||
|
||||
implementation fg.deobf("curse.maven:selene-499980:4983974")
|
||||
implementation fg.deobf("curse.maven:selene-499980:5660287")
|
||||
|
||||
implementation fg.deobf("curse.maven:spark-361579:4505309")
|
||||
implementation fg.deobf("curse.maven:spark-361579:4505375")
|
||||
|
||||
//implementation fg.deobf("curse.maven:create-steam-n-rails-688231:5246888")
|
||||
|
||||
compileOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}-common-api:${jei_version}")
|
||||
compileOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}-forge-api:${jei_version}")
|
||||
runtimeOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}-forge:${jei_version}")
|
||||
compileOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}:${jei_version}:api")
|
||||
runtimeOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}:${jei_version}")
|
||||
|
||||
|
||||
|
||||
|
||||
27
flake.lock
generated
Normal file
27
flake.lock
generated
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1732014248,
|
||||
"narHash": "sha256-y/MEyuJ5oBWrWAic/14LaIr/u5E0wRVzyYsouYY3W6w=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "23e89b7da85c3640bbc2173fe04f4bd114342367",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
24
flake.nix
Normal file
24
flake.nix
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs }:
|
||||
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
libs = with pkgs; [
|
||||
libpulseaudio
|
||||
libGL
|
||||
glfw
|
||||
openal
|
||||
stdenv.cc.cc.lib
|
||||
];
|
||||
in {
|
||||
devShell.x86_64-linux = pkgs.mkShell {
|
||||
packages = [];
|
||||
buildInputs = libs;
|
||||
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath libs;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
org.gradle.jvmargs=-Xmx3G
|
||||
org.gradle.daemon=false
|
||||
|
||||
jei_minecraft_version = 1.19.2
|
||||
jei_version = 11.4.0.274
|
||||
forge_version = 43.2.8
|
||||
jei_minecraft_version = 1.18.2
|
||||
jei_version = 9.7.0.209
|
||||
forge_version = 40.2.9
|
||||
|
||||
minecraft_version = 1.19.2
|
||||
flywheel_version = 0.6.10-20
|
||||
create_version = 0.5.1.f-45
|
||||
minecraft_version = 1.18.2
|
||||
flywheel_version = 0.6.9-101
|
||||
create_version = 0.5.1.c-299
|
||||
librarian_version = 1.+
|
||||
parchment_version = 2022.11.27
|
||||
parchment_version = 2022.11.06
|
||||
|
||||
registrate_version = MC1.19-1.1.5
|
||||
registrate_version = MC1.18.2-1.1.3
|
||||
@@ -25,10 +25,11 @@ import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
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;
|
||||
//import net.minecraftforge.data.event.GatherDataEvent;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
@@ -99,7 +100,7 @@ public class CreateTFMG
|
||||
modEventBus.addListener(CreateTFMG::init);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
modEventBus.addListener(EventPriority.LOWEST, TFMGDataGen::gatherData);
|
||||
modEventBus.addListener(TFMGSoundEvents::register);
|
||||
modEventBus.addGenericListener(SoundEvent.class, TFMGSoundEvents::register);
|
||||
DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> CreateTFMGClient::new);
|
||||
modEventBus.addListener(this::clientSetup);
|
||||
|
||||
|
||||
@@ -8,21 +8,24 @@ import com.tterrag.registrate.util.nullness.NonNullSupplier;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.fluids.ForgeFlowingFluid;
|
||||
import net.minecraftforge.fluids.ForgeFlowingFluid.Properties;
|
||||
public class GasFluidBuilder {
|
||||
}
|
||||
|
||||
public class GasFluidBuilder<T extends ForgeFlowingFluid, P> extends FluidBuilder<T, P> {
|
||||
|
||||
public GasFluidBuilder(AbstractRegistrate<?> owner, P parent, String name, BuilderCallback callback,
|
||||
ResourceLocation stillTexture, ResourceLocation flowingTexture, FluidBuilder.FluidTypeFactory typeFactory,
|
||||
NonNullFunction<Properties, T> factory) {
|
||||
super(owner, parent, name, callback, stillTexture, flowingTexture, typeFactory, factory);
|
||||
source(factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NonNullSupplier<T> asSupplier() {
|
||||
return this::getEntry;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
//TODO: redo this
|
||||
//public class GasFluidBuilder<T extends ForgeFlowingFluid, P> extends FluidBuilder<T, P> {
|
||||
//
|
||||
// public GasFluidBuilder(AbstractRegistrate<?> owner, P parent, String name, BuilderCallback callback,
|
||||
// ResourceLocation stillTexture, ResourceLocation flowingTexture, FluidBuilder.FluidTypeFactory typeFactory,
|
||||
// NonNullFunction<Properties, T> factory) {
|
||||
// super(owner, parent, name, callback, stillTexture, flowingTexture, typeFactory, factory);
|
||||
// source(factory);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public NonNullSupplier<T> asSupplier() {
|
||||
// return this::getEntry;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//}
|
||||
@@ -47,7 +47,7 @@ public class TFMGBuilderTransformers {
|
||||
.blockstate((c, p) -> {
|
||||
ModelFile bottom = AssetLookup.partialBaseModel(c, p, "bottom");
|
||||
ModelFile top = AssetLookup.partialBaseModel(c, p, "top");
|
||||
p.doorBlock(c.get(), bottom, bottom, bottom, bottom, top, top, top, top);
|
||||
p.doorBlock(c.get(), bottom, bottom, top, top);
|
||||
})
|
||||
.addLayer(() -> RenderType::cutoutMipped)
|
||||
.transform(pickaxeOnly())
|
||||
|
||||
@@ -11,7 +11,7 @@ import com.simibubi.create.foundation.utility.FilesHelper;
|
||||
import com.tterrag.registrate.providers.ProviderType;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
import net.minecraftforge.data.event.GatherDataEvent;
|
||||
import net.minecraftforge.forge.event.lifecycle.GatherDataEvent;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.function.BiConsumer;
|
||||
@@ -19,7 +19,7 @@ import java.util.function.BiConsumer;
|
||||
public class TFMGDataGen {
|
||||
public static void gatherData(GatherDataEvent event) {
|
||||
addExtraRegistrateData();
|
||||
|
||||
|
||||
DataGenerator generator = event.getGenerator();
|
||||
ExistingFileHelper existingFileHelper = event.getExistingFileHelper();
|
||||
|
||||
@@ -29,9 +29,9 @@ public class TFMGDataGen {
|
||||
if (server) {
|
||||
//generator.addProvider(true, new MStandardRecipeGen(generator));
|
||||
TFMGProcessingRecipeGen.registerAll(generator);
|
||||
generator.addProvider(true, new SequencedAssemblyGen(generator));
|
||||
generator.addProvider(true, new MechanicalCraftingGen(generator));
|
||||
generator.addProvider(true, new TFMGStandardRecipeGen(generator));
|
||||
generator.addProvider(new SequencedAssemblyGen(generator));
|
||||
generator.addProvider(new MechanicalCraftingGen(generator));
|
||||
generator.addProvider(new TFMGStandardRecipeGen(generator));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,13 +8,12 @@ import com.simibubi.create.content.processing.recipe.ProcessingRecipeBuilder;
|
||||
import com.simibubi.create.content.processing.recipe.ProcessingRecipeSerializer;
|
||||
import com.simibubi.create.foundation.recipe.IRecipeTypeInfo;
|
||||
import com.simibubi.create.foundation.utility.RegisteredObjects;
|
||||
import net.minecraft.data.CachedOutput;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.DataProvider;
|
||||
import net.minecraft.data.HashCache;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraftforge.fluids.FluidType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -22,9 +21,11 @@ import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.function.UnaryOperator;
|
||||
|
||||
import static net.minecraftforge.fluids.FluidAttributes.BUCKET_VOLUME;
|
||||
|
||||
public abstract class TFMGProcessingRecipeGen extends TFMGRecipeProvider {
|
||||
protected static final List<TFMGProcessingRecipeGen> GENERATORS = new ArrayList<>();
|
||||
protected static final int BUCKET = FluidType.BUCKET_VOLUME;
|
||||
protected static final int BUCKET = BUCKET_VOLUME;
|
||||
protected static final int BOTTLE = 250;
|
||||
|
||||
public TFMGProcessingRecipeGen(DataGenerator generator) {
|
||||
@@ -48,7 +49,7 @@ public abstract class TFMGProcessingRecipeGen extends TFMGRecipeProvider {
|
||||
GENERATORS.add(new MixingGen(gen));
|
||||
GENERATORS.add(new PressingGen(gen));
|
||||
|
||||
gen.addProvider(true, new DataProvider() {
|
||||
gen.addProvider(new DataProvider() {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
@@ -56,7 +57,7 @@ public abstract class TFMGProcessingRecipeGen extends TFMGRecipeProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(@NotNull CachedOutput dc) {
|
||||
public void run(@NotNull HashCache dc) {
|
||||
GENERATORS.forEach(g -> {
|
||||
try {
|
||||
g.run(dc);
|
||||
|
||||
@@ -14,10 +14,10 @@ import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidTank;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
||||
|
||||
@@ -61,7 +61,7 @@ public class FluidOutputBlockEntity extends SmartBlockEntity implements IHaveGog
|
||||
this.refreshCapability();
|
||||
}
|
||||
|
||||
return cap == ForgeCapabilities.FLUID_HANDLER ? this.fluidCapability.cast() : super.getCapability(cap, side);
|
||||
return cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY? this.fluidCapability.cast() : super.getCapability(cap, side);
|
||||
}
|
||||
|
||||
private void refreshCapability() {
|
||||
@@ -96,7 +96,7 @@ public class FluidOutputBlockEntity extends SmartBlockEntity implements IHaveGog
|
||||
}
|
||||
|
||||
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
|
||||
LazyOptional<IFluidHandler> handler = this.getCapability(ForgeCapabilities.FLUID_HANDLER);
|
||||
LazyOptional<IFluidHandler> handler = this.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY);
|
||||
Optional<IFluidHandler> resolve = handler.resolve();
|
||||
if (!resolve.isPresent()) {
|
||||
return false;
|
||||
|
||||
@@ -16,10 +16,10 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidTank;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
||||
|
||||
@@ -84,7 +84,7 @@ public class MultiblockMasterBlockEntity extends SmartBlockEntity implements IHa
|
||||
this.refreshCapability();
|
||||
}
|
||||
|
||||
return cap == ForgeCapabilities.FLUID_HANDLER ? this.fluidCapability.cast() : super.getCapability(cap, side);
|
||||
return cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY ? this.fluidCapability.cast() : super.getCapability(cap, side);
|
||||
}
|
||||
|
||||
private IFluidHandler handlerForCapability() {
|
||||
@@ -129,7 +129,7 @@ public class MultiblockMasterBlockEntity extends SmartBlockEntity implements IHa
|
||||
}
|
||||
}
|
||||
}
|
||||
LazyOptional<IFluidHandler> handler = this.getCapability(ForgeCapabilities.FLUID_HANDLER);
|
||||
LazyOptional<IFluidHandler> handler = this.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY);
|
||||
Optional<IFluidHandler> resolve = handler.resolve();
|
||||
if (!resolve.isPresent()) {
|
||||
return false;
|
||||
|
||||
@@ -16,9 +16,9 @@ import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
|
||||
import java.util.*;
|
||||
@@ -361,7 +361,7 @@ public class MultiblockStructure {
|
||||
|
||||
public void addToGoggleTooltip(List<Component> tooltip) {
|
||||
for (FluidOutputBlockEntity fluidOutput : getFluidOutputBlockEntities()) {
|
||||
LazyOptional<IFluidHandler> handler = fluidOutput.getCapability(ForgeCapabilities.FLUID_HANDLER);
|
||||
LazyOptional<IFluidHandler> handler = fluidOutput.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY);
|
||||
Optional<IFluidHandler> resolve = handler.resolve();
|
||||
addFluidTooltip(tooltip, resolve, fluidOutput.getBlockPos());
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.simibubi.create.Create;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.Explosion;
|
||||
import net.minecraft.world.level.Level;
|
||||
@@ -15,6 +14,7 @@ import net.minecraft.world.phys.Vec3;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class TFMGUtils {
|
||||
@@ -55,7 +55,7 @@ public class TFMGUtils {
|
||||
return;
|
||||
|
||||
|
||||
RandomSource r = level.getRandom();
|
||||
Random r = level.getRandom();
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@ package com.drmangotea.createindustry.blocks.concrete;
|
||||
|
||||
import com.drmangotea.createindustry.registry.TFMGBlocks;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.level.levelgen.RandomSource;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraftforge.fluids.ForgeFlowingFluid;
|
||||
@@ -26,14 +26,14 @@ public class ConcreteFluid extends ForgeFlowingFluid {
|
||||
return 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomTick(Level level, BlockPos pos, FluidState p_230574_, RandomSource randomSource) {
|
||||
int random = randomSource.nextInt(7) ;
|
||||
|
||||
if(random==2) {
|
||||
level.setBlock(pos, TFMGBlocks.CONCRETE.get().defaultBlockState(), 3);
|
||||
}
|
||||
}
|
||||
// @Override
|
||||
// public void randomTick(Level level, BlockPos pos, FluidState p_230574_, RandomSource randomSource) {
|
||||
// int random = randomSource.nextInt(7) ;
|
||||
//
|
||||
// if(random==2) {
|
||||
// level.setBlock(pos, TFMGBlocks.CONCRETE.get().defaultBlockState(), 3);
|
||||
// }
|
||||
// }
|
||||
|
||||
protected boolean isRandomlyTicking() {
|
||||
return true;
|
||||
|
||||
@@ -17,68 +17,70 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
|
||||
import java.util.function.Supplier;
|
||||
public class ConcreteFluidType {
|
||||
}
|
||||
|
||||
public class ConcreteFluidType extends AllFluids.TintedFluidType {
|
||||
|
||||
private Vector3f fogColor;
|
||||
private Supplier<Float> fogDistance;
|
||||
|
||||
public static FluidBuilder.FluidTypeFactory create(int fogColor, Supplier<Float> fogDistance) {
|
||||
return (p, s, f) -> {
|
||||
ConcreteFluidType fluidType = new ConcreteFluidType(p, s, f);
|
||||
fluidType.fogColor = new Color(fogColor, false).asVectorF();
|
||||
fluidType.fogDistance = fogDistance;
|
||||
return fluidType;
|
||||
};
|
||||
}
|
||||
|
||||
private ConcreteFluidType(Properties properties, ResourceLocation stillTexture,
|
||||
ResourceLocation flowingTexture) {
|
||||
super(properties, stillTexture, flowingTexture);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getTintColor(FluidStack stack) {
|
||||
return NO_TINT;
|
||||
}
|
||||
|
||||
/*
|
||||
* Removing alpha from tint prevents optifine from forcibly applying biome
|
||||
* colors to modded fluids (this workaround only works for fluids in the solid
|
||||
* render layer)
|
||||
*/
|
||||
@Override
|
||||
public int getTintColor(FluidState state, BlockAndTintGetter world, BlockPos pos) {
|
||||
return 0x00ffffff;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Vector3f getCustomFogColor() {
|
||||
return fogColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getFogDistanceModifier() {
|
||||
return fogDistance.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSwim(Entity entity)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public float getFallDistanceModifier(Entity entity)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@Override
|
||||
public boolean move(FluidState state, LivingEntity entity, Vec3 movementVector, double gravity)
|
||||
{
|
||||
entity.setDeltaMovement(entity.getDeltaMovement().scale(0.2d));
|
||||
//entity.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 30, 5, true, false, false));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//public class ConcreteFluidType extends AllFluids.TintedFluidType {
|
||||
//
|
||||
// private Vector3f fogColor;
|
||||
// private Supplier<Float> fogDistance;
|
||||
//
|
||||
// public static FluidBuilder.FluidTypeFactory create(int fogColor, Supplier<Float> fogDistance) {
|
||||
// return (p, s, f) -> {
|
||||
// ConcreteFluidType fluidType = new ConcreteFluidType(p, s, f);
|
||||
// fluidType.fogColor = new Color(fogColor, false).asVectorF();
|
||||
// fluidType.fogDistance = fogDistance;
|
||||
// return fluidType;
|
||||
// };
|
||||
// }
|
||||
//
|
||||
// private ConcreteFluidType(Properties properties, ResourceLocation stillTexture,
|
||||
// ResourceLocation flowingTexture) {
|
||||
// super(properties, stillTexture, flowingTexture);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected int getTintColor(FluidStack stack) {
|
||||
// return NO_TINT;
|
||||
// }
|
||||
//
|
||||
// /*
|
||||
// * Removing alpha from tint prevents optifine from forcibly applying biome
|
||||
// * colors to modded fluids (this workaround only works for fluids in the solid
|
||||
// * render layer)
|
||||
// */
|
||||
// @Override
|
||||
// public int getTintColor(FluidState state, BlockAndTintGetter world, BlockPos pos) {
|
||||
// return 0x00ffffff;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected Vector3f getCustomFogColor() {
|
||||
// return fogColor;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected float getFogDistanceModifier() {
|
||||
// return fogDistance.get();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean canSwim(Entity entity)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// @Override
|
||||
// public float getFallDistanceModifier(Entity entity)
|
||||
// {
|
||||
// return 1;
|
||||
// }
|
||||
// @Override
|
||||
// public boolean move(FluidState state, LivingEntity entity, Vec3 movementVector, double gravity)
|
||||
// {
|
||||
// entity.setDeltaMovement(entity.getDeltaMovement().scale(0.2d));
|
||||
// //entity.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 30, 5, true, false, false));
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
||||
@@ -2,9 +2,9 @@ package com.drmangotea.createindustry.blocks.concrete.asphalt;
|
||||
|
||||
import com.drmangotea.createindustry.registry.TFMGBlocks;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.level.levelgen.RandomSource;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraftforge.fluids.ForgeFlowingFluid;
|
||||
@@ -26,14 +26,14 @@ public class AsphaltFluid extends ForgeFlowingFluid {
|
||||
return 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomTick(Level level, BlockPos pos, FluidState p_230574_, RandomSource randomSource) {
|
||||
int random = randomSource.nextInt(7) ;
|
||||
|
||||
if(random==2) {
|
||||
level.setBlock(pos, TFMGBlocks.ASPHALT.get().defaultBlockState(), 3);
|
||||
}
|
||||
}
|
||||
// @Override
|
||||
// public void randomTick(Level level, BlockPos pos, FluidState p_230574_, RandomSource randomSource) {
|
||||
// int random = randomSource.nextInt(7) ;
|
||||
//
|
||||
// if(random==2) {
|
||||
// level.setBlock(pos, TFMGBlocks.ASPHALT.get().defaultBlockState(), 3);
|
||||
// }
|
||||
// }
|
||||
|
||||
protected boolean isRandomlyTicking() {
|
||||
return true;
|
||||
|
||||
@@ -40,7 +40,7 @@ public class FormWorkBlockEntity extends TFMGMachineBlockEntity {
|
||||
return new SmartFluidTank(1000, this::onFluidStackChanged){
|
||||
@Override
|
||||
public boolean isFluidValid(FluidStack stack) {
|
||||
return stack.getFluid().isSame(TFMGFluids.LIQUID_CONCRETE.getSource());
|
||||
return stack.getFluid().isSame(TFMGFluids.LIQUID_CONCRETE.get());
|
||||
}
|
||||
@Override
|
||||
public FluidStack drain(FluidStack resource, FluidAction action) {
|
||||
@@ -115,7 +115,7 @@ public class FormWorkBlockEntity extends TFMGMachineBlockEntity {
|
||||
FluidTank checkedTank = ((FormWorkBlockEntity) CheckedBE).tankInventory;
|
||||
if (checkedTank.getFluidAmount() < 1000) {
|
||||
if(checkedTank.getFluidAmount()>=995&&tankInventory.getFluidAmount()>0){
|
||||
checkedTank.setFluid(new FluidStack(TFMGFluids.LIQUID_CONCRETE.getSource(), checkedTank.getFluidAmount()+1));
|
||||
checkedTank.setFluid(new FluidStack(TFMGFluids.LIQUID_CONCRETE.get(), checkedTank.getFluidAmount()+1));
|
||||
//tankInventory.drain(1, IFluidHandler.FluidAction.EXECUTE);
|
||||
// continue;
|
||||
}
|
||||
@@ -135,7 +135,7 @@ public class FormWorkBlockEntity extends TFMGMachineBlockEntity {
|
||||
// toRemove = reducedAmount - amountModifier;
|
||||
}
|
||||
//
|
||||
checkedTank.setFluid(new FluidStack(TFMGFluids.LIQUID_CONCRETE.getSource(), newFluidAmount));
|
||||
checkedTank.setFluid(new FluidStack(TFMGFluids.LIQUID_CONCRETE.get(), newFluidAmount));
|
||||
tankInventory.drain(1, IFluidHandler.FluidAction.EXECUTE);
|
||||
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ public class RebarFormWorkBlockEntity extends FormWorkBlockEntity {
|
||||
FluidTank checkedTank = ((RebarFormWorkBlockEntity) CheckedBE).tankInventory;
|
||||
if (checkedTank.getFluidAmount() < 1000) {
|
||||
if(checkedTank.getFluidAmount()>=995&&tankInventory.getFluidAmount()>0){
|
||||
checkedTank.setFluid(new FluidStack(TFMGFluids.LIQUID_CONCRETE.getSource(), checkedTank.getFluidAmount()+1));
|
||||
checkedTank.setFluid(new FluidStack(TFMGFluids.LIQUID_CONCRETE.get(), checkedTank.getFluidAmount()+1));
|
||||
//tankInventory.drain(1, IFluidHandler.FluidAction.EXECUTE);
|
||||
// continue;
|
||||
}
|
||||
@@ -115,7 +115,7 @@ public class RebarFormWorkBlockEntity extends FormWorkBlockEntity {
|
||||
// toRemove = reducedAmount - amountModifier;
|
||||
}
|
||||
//
|
||||
checkedTank.setFluid(new FluidStack(TFMGFluids.LIQUID_CONCRETE.getSource(), newFluidAmount));
|
||||
checkedTank.setFluid(new FluidStack(TFMGFluids.LIQUID_CONCRETE.get(), newFluidAmount));
|
||||
tankInventory.drain(1, IFluidHandler.FluidAction.EXECUTE);
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.google.common.collect.Maps;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.util.RandomSource;
|
||||
//import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
@@ -19,6 +19,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
||||
import net.minecraft.world.level.levelgen.RandomSource;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
|
||||
@@ -13,8 +13,9 @@ import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
//import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -89,11 +90,11 @@ public class ElectricBlockEntity extends SmartBlockEntity implements IHaveGoggle
|
||||
public @NotNull <T> LazyOptional<T> getCapability(@NotNull Capability<T> cap, @Nullable Direction side) {
|
||||
|
||||
|
||||
if (cap == ForgeCapabilities.ENERGY&&side == null) {
|
||||
if (cap == CapabilityEnergy.ENERGY&&side == null) {
|
||||
return lazyEnergyHandler.cast();
|
||||
} else
|
||||
|
||||
if (cap == ForgeCapabilities.ENERGY&&hasElectricitySlot(side)) {
|
||||
if (cap == CapabilityEnergy.ENERGY&&hasElectricitySlot(side)) {
|
||||
return lazyEnergyHandler.cast();
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,8 @@ import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.LeverBlock;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
//import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import net.minecraftforge.energy.EnergyStorage;
|
||||
|
||||
public interface IElectricBlock {
|
||||
@@ -145,17 +146,17 @@ public interface IElectricBlock {
|
||||
|
||||
if(be1!=null) {
|
||||
|
||||
if (be1.getCapability(ForgeCapabilities.ENERGY, direction.getOpposite()).isPresent()) {
|
||||
if (be1.getCapability(CapabilityEnergy.ENERGY, direction.getOpposite()).isPresent()) {
|
||||
|
||||
if (!(be1.getCapability(ForgeCapabilities.ENERGY, direction.getOpposite()).orElse(new EnergyStorage(0)) instanceof TFMGForgeEnergyStorage)) {
|
||||
if (!(be1.getCapability(CapabilityEnergy.ENERGY, direction.getOpposite()).orElse(new EnergyStorage(0)) instanceof TFMGForgeEnergyStorage)) {
|
||||
|
||||
|
||||
|
||||
|
||||
int i = be1.getCapability(ForgeCapabilities.ENERGY, direction.getOpposite()).orElse(new EnergyStorage(0)).receiveEnergy(1000, true);
|
||||
int i = be1.getCapability(CapabilityEnergy.ENERGY, direction.getOpposite()).orElse(new EnergyStorage(0)).receiveEnergy(1000, true);
|
||||
int y = getForgeEnergy().extractEnergy(1000, true);
|
||||
|
||||
int j = be1.getCapability(ForgeCapabilities.ENERGY, direction.getOpposite()).orElse(new EnergyStorage(0)).receiveEnergy(Math.min(y,i), false);
|
||||
int j = be1.getCapability(CapabilityEnergy.ENERGY, direction.getOpposite()).orElse(new EnergyStorage(0)).receiveEnergy(Math.min(y,i), false);
|
||||
getForgeEnergy().extractEnergy(j, false);
|
||||
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@ import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -89,11 +89,11 @@ public class KineticElectricBlockEntity extends KineticBlockEntity implements IH
|
||||
public @NotNull <T> LazyOptional<T> getCapability(@NotNull Capability<T> cap, @Nullable Direction side) {
|
||||
|
||||
|
||||
if (cap == ForgeCapabilities.ENERGY&&side == null) {
|
||||
if (cap == CapabilityEnergy.ENERGY&&side == null) {
|
||||
return lazyEnergyHandler.cast();
|
||||
} else
|
||||
|
||||
if (cap == ForgeCapabilities.ENERGY&&hasElectricitySlot(side)) {
|
||||
if (cap == CapabilityEnergy.ENERGY&&hasElectricitySlot(side)) {
|
||||
return lazyEnergyHandler.cast();
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import net.minecraftforge.energy.EnergyStorage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -226,17 +226,17 @@ public class CableConnectorBlockEntity extends ElectricBlockEntity {
|
||||
}else
|
||||
if(be1!=null) {
|
||||
|
||||
if (be1.getCapability(ForgeCapabilities.ENERGY, direction.getOpposite()).isPresent()) {
|
||||
if (be1.getCapability(CapabilityEnergy.ENERGY, direction.getOpposite()).isPresent()) {
|
||||
|
||||
if (!(be1.getCapability(ForgeCapabilities.ENERGY, direction.getOpposite()).orElse(new EnergyStorage(0)) instanceof TFMGForgeEnergyStorage)) {
|
||||
if (!(be1.getCapability(CapabilityEnergy.ENERGY, direction.getOpposite()).orElse(new EnergyStorage(0)) instanceof TFMGForgeEnergyStorage)) {
|
||||
|
||||
|
||||
|
||||
|
||||
int i = be1.getCapability(ForgeCapabilities.ENERGY, direction.getOpposite()).orElse(new EnergyStorage(0)).receiveEnergy(1000, true);
|
||||
int i = be1.getCapability(CapabilityEnergy.ENERGY, direction.getOpposite()).orElse(new EnergyStorage(0)).receiveEnergy(1000, true);
|
||||
int y = getForgeEnergy().extractEnergy(1000, true);
|
||||
|
||||
int j = be1.getCapability(ForgeCapabilities.ENERGY, direction.getOpposite()).orElse(new EnergyStorage(0)).receiveEnergy(Math.min(y,i), false);
|
||||
int j = be1.getCapability(CapabilityEnergy.ENERGY, direction.getOpposite()).orElse(new EnergyStorage(0)).receiveEnergy(Math.min(y,i), false);
|
||||
getForgeEnergy().extractEnergy(j, false);
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.drmangotea.createindustry.blocks.electricity.cable_blocks.copycat_cable_block;
|
||||
|
||||
import com.jozufozu.flywheel.core.materials.model.ModelData;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.content.decoration.copycat.CopycatBlock;
|
||||
import com.simibubi.create.content.decoration.copycat.FilteredBlockAndTintGetter;
|
||||
import com.simibubi.create.foundation.model.BakedModelWrapperWithData;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -12,153 +12,155 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.client.model.data.ModelData;
|
||||
import net.minecraftforge.client.model.data.ModelProperty;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class AbstractCopycatCableModel extends BakedModelWrapperWithData {
|
||||
|
||||
public static final ModelProperty<BlockState> MATERIAL_PROPERTY = new ModelProperty<>();
|
||||
private static final ModelProperty<OcclusionData> OCCLUSION_PROPERTY = new ModelProperty<>();
|
||||
private static final ModelProperty<ModelData> WRAPPED_DATA_PROPERTY = new ModelProperty<>();
|
||||
|
||||
public AbstractCopycatCableModel(BakedModel originalModel) {
|
||||
super(originalModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ModelData.Builder gatherModelData(ModelData.Builder builder, BlockAndTintGetter world, BlockPos pos, BlockState state,
|
||||
ModelData blockEntityData) {
|
||||
BlockState material = getMaterial(blockEntityData);
|
||||
if (material == null)
|
||||
return builder;
|
||||
|
||||
builder.with(MATERIAL_PROPERTY, material);
|
||||
|
||||
if (!(state.getBlock() instanceof CopycatBlock copycatBlock))
|
||||
return builder;
|
||||
|
||||
OcclusionData occlusionData = new OcclusionData();
|
||||
gatherOcclusionData(world, pos, state, material, occlusionData, copycatBlock);
|
||||
builder.with(OCCLUSION_PROPERTY, occlusionData);
|
||||
|
||||
ModelData wrappedData = getModelOf(material).getModelData(
|
||||
new FilteredBlockAndTintGetter(world,
|
||||
targetPos -> copycatBlock.canConnectTexturesToward(world, pos, targetPos, state)),
|
||||
pos, material, ModelData.EMPTY);
|
||||
return builder.with(WRAPPED_DATA_PROPERTY, wrappedData);
|
||||
}
|
||||
|
||||
private void gatherOcclusionData(BlockAndTintGetter world, BlockPos pos, BlockState state, BlockState material,
|
||||
OcclusionData occlusionData, CopycatBlock copycatBlock) {
|
||||
BlockPos.MutableBlockPos mutablePos = new BlockPos.MutableBlockPos();
|
||||
for (Direction face : Iterate.directions) {
|
||||
|
||||
// Rubidium: Run an additional IForgeBlock.hidesNeighborFace check because it
|
||||
// seems to be missing in Block.shouldRenderFace
|
||||
BlockPos.MutableBlockPos neighbourPos = mutablePos.setWithOffset(pos, face);
|
||||
BlockState neighbourState = world.getBlockState(neighbourPos);
|
||||
if (state.supportsExternalFaceHiding()
|
||||
&& neighbourState.hidesNeighborFace(world, neighbourPos, state, face.getOpposite())) {
|
||||
occlusionData.occlude(face);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!copycatBlock.canFaceBeOccluded(state, face))
|
||||
continue;
|
||||
if (!Block.shouldRenderFace(material, world, pos, face, neighbourPos))
|
||||
occlusionData.occlude(face);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(BlockState state, Direction side, RandomSource rand, ModelData data, RenderType renderType) {
|
||||
|
||||
// Rubidium: see below
|
||||
if (side != null && state.getBlock() instanceof CopycatBlock ccb && ccb.shouldFaceAlwaysRender(state, side))
|
||||
return Collections.emptyList();
|
||||
|
||||
BlockState material = getMaterial(data);
|
||||
|
||||
if (material == null)
|
||||
return super.getQuads(state, side, rand, data, renderType);
|
||||
|
||||
OcclusionData occlusionData = data.get(OCCLUSION_PROPERTY);
|
||||
if (occlusionData != null && occlusionData.isOccluded(side))
|
||||
return super.getQuads(state, side, rand, data, renderType);
|
||||
|
||||
ModelData wrappedData = data.get(WRAPPED_DATA_PROPERTY);
|
||||
if (wrappedData == null)
|
||||
wrappedData = ModelData.EMPTY;
|
||||
if (renderType != null && !Minecraft.getInstance()
|
||||
.getBlockRenderer()
|
||||
.getBlockModel(material)
|
||||
.getRenderTypes(material, rand, wrappedData)
|
||||
.contains(renderType))
|
||||
return super.getQuads(state, side, rand, data, renderType);
|
||||
|
||||
List<BakedQuad> croppedQuads = getCroppedQuads(state, side, rand, material, wrappedData, renderType);
|
||||
|
||||
// Rubidium: render side!=null versions of the base material during side==null,
|
||||
// to avoid getting culled away
|
||||
if (side == null && state.getBlock() instanceof CopycatBlock ccb)
|
||||
for (Direction nonOcclusionSide : Iterate.directions)
|
||||
if (ccb.shouldFaceAlwaysRender(state, nonOcclusionSide))
|
||||
croppedQuads.addAll(getCroppedQuads(state, nonOcclusionSide, rand, material, wrappedData, renderType));
|
||||
|
||||
return croppedQuads;
|
||||
}
|
||||
|
||||
public abstract List<BakedQuad> getCroppedQuads(BlockState state, Direction side, RandomSource rand,
|
||||
BlockState material, ModelData wrappedData, RenderType renderType);
|
||||
|
||||
@Override
|
||||
public TextureAtlasSprite getParticleIcon(ModelData data) {
|
||||
BlockState material = getMaterial(data);
|
||||
|
||||
if (material == null)
|
||||
return super.getParticleIcon(data);
|
||||
|
||||
ModelData wrappedData = data.get(WRAPPED_DATA_PROPERTY);
|
||||
if (wrappedData == null)
|
||||
wrappedData = ModelData.EMPTY;
|
||||
|
||||
return getModelOf(material).getParticleIcon(wrappedData);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static BlockState getMaterial(ModelData data) {
|
||||
BlockState material = data.get(MATERIAL_PROPERTY);
|
||||
return material == null ? AllBlocks.COPYCAT_BASE.getDefaultState() : material;
|
||||
}
|
||||
|
||||
public static BakedModel getModelOf(BlockState state) {
|
||||
return Minecraft.getInstance()
|
||||
.getBlockRenderer()
|
||||
.getBlockModel(state);
|
||||
}
|
||||
|
||||
private static class OcclusionData {
|
||||
private final boolean[] occluded;
|
||||
|
||||
public OcclusionData() {
|
||||
occluded = new boolean[6];
|
||||
}
|
||||
|
||||
public void occlude(Direction face) {
|
||||
occluded[face.get3DDataValue()] = true;
|
||||
}
|
||||
|
||||
public boolean isOccluded(Direction face) {
|
||||
return face == null ? false : occluded[face.get3DDataValue()];
|
||||
}
|
||||
}
|
||||
|
||||
public class AbstractCopycatCableModel {
|
||||
}
|
||||
|
||||
//
|
||||
//public abstract class AbstractCopycatCableModel extends BakedModelWrapperWithData {
|
||||
//
|
||||
// public static final ModelProperty<BlockState> MATERIAL_PROPERTY = new ModelProperty<>();
|
||||
// private static final ModelProperty<OcclusionData> OCCLUSION_PROPERTY = new ModelProperty<>();
|
||||
// private static final ModelProperty<ModelData> WRAPPED_DATA_PROPERTY = new ModelProperty<>();
|
||||
//
|
||||
// public AbstractCopycatCableModel(BakedModel originalModel) {
|
||||
// super(originalModel);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected ModelData.Builder gatherModelData(ModelData.Builder builder, BlockAndTintGetter world, BlockPos pos, BlockState state,
|
||||
// ModelData blockEntityData) {
|
||||
// BlockState material = getMaterial(blockEntityData);
|
||||
// if (material == null)
|
||||
// return builder;
|
||||
//
|
||||
// builder.with(MATERIAL_PROPERTY, material);
|
||||
//
|
||||
// if (!(state.getBlock() instanceof CopycatBlock copycatBlock))
|
||||
// return builder;
|
||||
//
|
||||
// OcclusionData occlusionData = new OcclusionData();
|
||||
// gatherOcclusionData(world, pos, state, material, occlusionData, copycatBlock);
|
||||
// builder.with(OCCLUSION_PROPERTY, occlusionData);
|
||||
//
|
||||
// ModelData wrappedData = getModelOf(material).getModelData(
|
||||
// new FilteredBlockAndTintGetter(world,
|
||||
// targetPos -> copycatBlock.canConnectTexturesToward(world, pos, targetPos, state)),
|
||||
// pos, material, ModelData.EMPTY);
|
||||
// return builder.with(WRAPPED_DATA_PROPERTY, wrappedData);
|
||||
// }
|
||||
//
|
||||
// private void gatherOcclusionData(BlockAndTintGetter world, BlockPos pos, BlockState state, BlockState material,
|
||||
// OcclusionData occlusionData, CopycatBlock copycatBlock) {
|
||||
// BlockPos.MutableBlockPos mutablePos = new BlockPos.MutableBlockPos();
|
||||
// for (Direction face : Iterate.directions) {
|
||||
//
|
||||
// // Rubidium: Run an additional IForgeBlock.hidesNeighborFace check because it
|
||||
// // seems to be missing in Block.shouldRenderFace
|
||||
// BlockPos.MutableBlockPos neighbourPos = mutablePos.setWithOffset(pos, face);
|
||||
// BlockState neighbourState = world.getBlockState(neighbourPos);
|
||||
// if (state.supportsExternalFaceHiding()
|
||||
// && neighbourState.hidesNeighborFace(world, neighbourPos, state, face.getOpposite())) {
|
||||
// occlusionData.occlude(face);
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// if (!copycatBlock.canFaceBeOccluded(state, face))
|
||||
// continue;
|
||||
// if (!Block.shouldRenderFace(material, world, pos, face, neighbourPos))
|
||||
// occlusionData.occlude(face);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<BakedQuad> getQuads(BlockState state, Direction side, RandomSource rand, ModelData data, RenderType renderType) {
|
||||
//
|
||||
// // Rubidium: see below
|
||||
// if (side != null && state.getBlock() instanceof CopycatBlock ccb && ccb.shouldFaceAlwaysRender(state, side))
|
||||
// return Collections.emptyList();
|
||||
//
|
||||
// BlockState material = getMaterial(data);
|
||||
//
|
||||
// if (material == null)
|
||||
// return super.getQuads(state, side, rand, data, renderType);
|
||||
//
|
||||
// OcclusionData occlusionData = data.get(OCCLUSION_PROPERTY);
|
||||
// if (occlusionData != null && occlusionData.isOccluded(side))
|
||||
// return super.getQuads(state, side, rand, data, renderType);
|
||||
//
|
||||
// ModelData wrappedData = data.get(WRAPPED_DATA_PROPERTY);
|
||||
// if (wrappedData == null)
|
||||
// wrappedData = ModelData.EMPTY;
|
||||
// if (renderType != null && !Minecraft.getInstance()
|
||||
// .getBlockRenderer()
|
||||
// .getBlockModel(material)
|
||||
// .getRenderTypes(material, rand, wrappedData)
|
||||
// .contains(renderType))
|
||||
// return super.getQuads(state, side, rand, data, renderType);
|
||||
//
|
||||
// List<BakedQuad> croppedQuads = getCroppedQuads(state, side, rand, material, wrappedData, renderType);
|
||||
//
|
||||
// // Rubidium: render side!=null versions of the base material during side==null,
|
||||
// // to avoid getting culled away
|
||||
// if (side == null && state.getBlock() instanceof CopycatBlock ccb)
|
||||
// for (Direction nonOcclusionSide : Iterate.directions)
|
||||
// if (ccb.shouldFaceAlwaysRender(state, nonOcclusionSide))
|
||||
// croppedQuads.addAll(getCroppedQuads(state, nonOcclusionSide, rand, material, wrappedData, renderType));
|
||||
//
|
||||
// return croppedQuads;
|
||||
// }
|
||||
//
|
||||
// public abstract List<BakedQuad> getCroppedQuads(BlockState state, Direction side, RandomSource rand,
|
||||
// BlockState material, ModelData wrappedData, RenderType renderType);
|
||||
//
|
||||
// @Override
|
||||
// public TextureAtlasSprite getParticleIcon(ModelData data) {
|
||||
// BlockState material = getMaterial(data);
|
||||
//
|
||||
// if (material == null)
|
||||
// return super.getParticleIcon(data);
|
||||
//
|
||||
// ModelData wrappedData = data.get(WRAPPED_DATA_PROPERTY);
|
||||
// if (wrappedData == null)
|
||||
// wrappedData = ModelData.EMPTY;
|
||||
//
|
||||
// return getModelOf(material).getParticleIcon(wrappedData);
|
||||
// }
|
||||
//
|
||||
// @Nullable
|
||||
// public static BlockState getMaterial(ModelData data) {
|
||||
// BlockState material = data.get(MATERIAL_PROPERTY);
|
||||
// return material == null ? AllBlocks.COPYCAT_BASE.getDefaultState() : material;
|
||||
// }
|
||||
//
|
||||
// public static BakedModel getModelOf(BlockState state) {
|
||||
// return Minecraft.getInstance()
|
||||
// .getBlockRenderer()
|
||||
// .getBlockModel(state);
|
||||
// }
|
||||
//
|
||||
// private static class OcclusionData {
|
||||
// private final boolean[] occluded;
|
||||
//
|
||||
// public OcclusionData() {
|
||||
// occluded = new boolean[6];
|
||||
// }
|
||||
//
|
||||
// public void occlude(Direction face) {
|
||||
// occluded[face.get3DDataValue()] = true;
|
||||
// }
|
||||
//
|
||||
// public boolean isOccluded(Direction face) {
|
||||
// return face == null ? false : occluded[face.get3DDataValue()];
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
||||
@@ -35,7 +35,8 @@ import net.minecraft.world.phys.shapes.Shapes;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.model.data.ModelDataManager;
|
||||
import net.minecraftforge.client.model.ModelDataManager;
|
||||
//import net.minecraftforge.client.model.data.ModelDataManager;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -231,19 +232,19 @@ public class CopycatCableBlock extends Block implements IBE<CopycatCableBlockEnt
|
||||
|
||||
// Connected Textures
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public BlockState getAppearance(BlockState state, BlockAndTintGetter level, BlockPos pos, Direction side,
|
||||
BlockState queryState, BlockPos queryPos) {
|
||||
|
||||
if (isIgnoredConnectivitySide(level, state, side, pos, queryPos))
|
||||
return state;
|
||||
|
||||
ModelDataManager modelDataManager = level.getModelDataManager();
|
||||
if (modelDataManager == null)
|
||||
return getMaterial(level, pos);
|
||||
return CopycatModel.getMaterial(modelDataManager.getAt(pos));
|
||||
}
|
||||
// TODO: re-add this
|
||||
// @Override
|
||||
// @OnlyIn(Dist.CLIENT)
|
||||
// public BlockState getAppearance(BlockState state, BlockAndTintGetter level, BlockPos pos, Direction side,
|
||||
// BlockState queryState, BlockPos queryPos) {
|
||||
//
|
||||
// if (isIgnoredConnectivitySide(level, state, side, pos, queryPos))
|
||||
// return state;
|
||||
// state ModelDataManager modelDataManager = ;
|
||||
// if (modelDataManager == null)
|
||||
// return getMaterial(level, pos);
|
||||
// return CopycatModel.getMaterial(modelDataManager.getAt(pos));
|
||||
// }
|
||||
|
||||
public boolean isIgnoredConnectivitySide(BlockAndTintGetter reader, BlockState state, Direction face,
|
||||
BlockPos fromPos, BlockPos toPos) {
|
||||
|
||||
@@ -11,8 +11,8 @@ import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -88,7 +88,7 @@ public class CopycatCableBlockEntity extends CopycatBlockEntity implements IElec
|
||||
|
||||
@Override
|
||||
public @NotNull <T> LazyOptional<T> getCapability(@NotNull Capability<T> cap, @Nullable Direction side) {
|
||||
if (cap == ForgeCapabilities.ENERGY&&hasElectricitySlot(side)) {
|
||||
if (cap == CapabilityEnergy.ENERGY&&hasElectricitySlot(side)) {
|
||||
return lazyEnergyHandler.cast();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.drmangotea.createindustry.blocks.electricity.cable_blocks.copycat_cable_block;
|
||||
|
||||
import com.jozufozu.flywheel.core.materials.model.ModelData;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.content.decoration.copycat.CopycatSpecialCases;
|
||||
import com.simibubi.create.foundation.model.BakedModelHelper;
|
||||
@@ -12,77 +13,80 @@ import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.block.DirectionalBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.RandomSource;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.client.model.data.ModelData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CopycatCableBlockModel extends com.simibubi.create.content.decoration.copycat.CopycatModel {
|
||||
public class CopycatCableBlockModel {
|
||||
}
|
||||
|
||||
protected static final AABB CUBE_AABB = new AABB(BlockPos.ZERO);
|
||||
|
||||
public CopycatCableBlockModel(BakedModel originalModel) {
|
||||
super(originalModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<BakedQuad> getCroppedQuads(BlockState state, Direction side, RandomSource rand, BlockState material,
|
||||
ModelData wrappedData, RenderType renderType) {
|
||||
Direction facing = Direction.UP;
|
||||
BlockRenderDispatcher blockRenderer = Minecraft.getInstance()
|
||||
.getBlockRenderer();
|
||||
|
||||
BlockState specialCopycatModelState = null;
|
||||
if (CopycatSpecialCases.isBarsMaterial(material))
|
||||
specialCopycatModelState = AllBlocks.COPYCAT_BARS.getDefaultState();
|
||||
if (CopycatSpecialCases.isTrapdoorMaterial(material))
|
||||
return blockRenderer.getBlockModel(material)
|
||||
.getQuads(state, side, rand, wrappedData, renderType);
|
||||
|
||||
if (specialCopycatModelState != null) {
|
||||
BakedModel blockModel = blockRenderer
|
||||
.getBlockModel(specialCopycatModelState.setValue(DirectionalBlock.FACING, facing));
|
||||
if (blockModel instanceof AbstractCopycatCableModel cm)
|
||||
return cm.getCroppedQuads(state, side, rand, material, wrappedData, renderType);
|
||||
}
|
||||
|
||||
BakedModel model = getModelOf(material);
|
||||
List<BakedQuad> templateQuads = model.getQuads(material, side, rand, wrappedData, renderType);
|
||||
int size = templateQuads.size();
|
||||
|
||||
List<BakedQuad> quads = new ArrayList<>();
|
||||
|
||||
Vec3 normal = Vec3.atLowerCornerOf(facing.getNormal());
|
||||
Vec3 normalScaled16 = normal.scale(8 / 16f);
|
||||
|
||||
// 2 Pieces
|
||||
for (boolean front : Iterate.trueAndFalse) {
|
||||
Vec3 normalScaledN13 = normal.scale(front ? 0 : -0 / 16f);
|
||||
float contract = 16 - (8);
|
||||
AABB bb = CUBE_AABB.contract(normal.x * contract / 16, normal.y * contract / 16, normal.z * contract / 16);
|
||||
if (!front)
|
||||
bb = bb.move(normalScaled16);
|
||||
|
||||
for (BakedQuad quad : templateQuads) {
|
||||
Direction direction = quad.getDirection();
|
||||
|
||||
if (front && direction == facing)
|
||||
continue;
|
||||
if (!front && direction == facing.getOpposite())
|
||||
continue;
|
||||
|
||||
quads.add(BakedQuadHelper.cloneWithCustomGeometry(quad,
|
||||
BakedModelHelper.cropAndMove(quad.getVertices(), quad.getSprite(), bb, normalScaledN13)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return quads;
|
||||
}
|
||||
|
||||
}
|
||||
//
|
||||
//public class CopycatCableBlockModel extends com.simibubi.create.content.decoration.copycat.CopycatModel {
|
||||
//
|
||||
// protected static final AABB CUBE_AABB = new AABB(BlockPos.ZERO);
|
||||
//
|
||||
// public CopycatCableBlockModel(BakedModel originalModel) {
|
||||
// super(originalModel);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected List<BakedQuad> getCroppedQuads(BlockState state, Direction side, RandomSource rand, BlockState material,
|
||||
// ModelData wrappedData, RenderType renderType) {
|
||||
// Direction facing = Direction.UP;
|
||||
// BlockRenderDispatcher blockRenderer = Minecraft.getInstance()
|
||||
// .getBlockRenderer();
|
||||
//
|
||||
// BlockState specialCopycatModelState = null;
|
||||
// if (CopycatSpecialCases.isBarsMaterial(material))
|
||||
// specialCopycatModelState = AllBlocks.COPYCAT_BARS.getDefaultState();
|
||||
// if (CopycatSpecialCases.isTrapdoorMaterial(material))
|
||||
// return blockRenderer.getBlockModel(material)
|
||||
// .getQuads(state, side, rand, wrappedData, renderType);
|
||||
//
|
||||
// if (specialCopycatModelState != null) {
|
||||
// BakedModel blockModel = blockRenderer
|
||||
// .getBlockModel(specialCopycatModelState.setValue(DirectionalBlock.FACING, facing));
|
||||
// if (blockModel instanceof AbstractCopycatCableModel cm)
|
||||
// return cm.getCroppedQuads(state, side, rand, material, wrappedData, renderType);
|
||||
// }
|
||||
//
|
||||
// BakedModel model = getModelOf(material);
|
||||
// List<BakedQuad> templateQuads = model.getQuads(material, side, rand, wrappedData, renderType);
|
||||
// int size = templateQuads.size();
|
||||
//
|
||||
// List<BakedQuad> quads = new ArrayList<>();
|
||||
//
|
||||
// Vec3 normal = Vec3.atLowerCornerOf(facing.getNormal());
|
||||
// Vec3 normalScaled16 = normal.scale(8 / 16f);
|
||||
//
|
||||
// // 2 Pieces
|
||||
// for (boolean front : Iterate.trueAndFalse) {
|
||||
// Vec3 normalScaledN13 = normal.scale(front ? 0 : -0 / 16f);
|
||||
// float contract = 16 - (8);
|
||||
// AABB bb = CUBE_AABB.contract(normal.x * contract / 16, normal.y * contract / 16, normal.z * contract / 16);
|
||||
// if (!front)
|
||||
// bb = bb.move(normalScaled16);
|
||||
//
|
||||
// for (BakedQuad quad : templateQuads) {
|
||||
// Direction direction = quad.getDirection();
|
||||
//
|
||||
// if (front && direction == facing)
|
||||
// continue;
|
||||
// if (!front && direction == facing.getOpposite())
|
||||
// continue;
|
||||
//
|
||||
// quads.add(BakedQuadHelper.cloneWithCustomGeometry(quad,
|
||||
// BakedModelHelper.cropAndMove(quad.getVertices(), quad.getSprite(), bb, normalScaledN13)));
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// return quads;
|
||||
// }
|
||||
//
|
||||
//}
|
||||
@@ -25,8 +25,8 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -209,11 +209,11 @@ public class ElectricMotorBlockEntity extends GeneratingKineticBlockEntity imple
|
||||
public @NotNull <T> LazyOptional<T> getCapability(@NotNull Capability<T> cap, @Nullable Direction side) {
|
||||
|
||||
|
||||
if (cap == ForgeCapabilities.ENERGY&&side == null) {
|
||||
if (cap == CapabilityEnergy.ENERGY&&side == null) {
|
||||
return lazyEnergyHandler.cast();
|
||||
} else
|
||||
|
||||
if (cap == ForgeCapabilities.ENERGY&&hasElectricitySlot(side)) {
|
||||
if (cap == CapabilityEnergy.ENERGY&&hasElectricitySlot(side)) {
|
||||
return lazyEnergyHandler.cast();
|
||||
}
|
||||
|
||||
|
||||
@@ -27,8 +27,8 @@ import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
|
||||
|
||||
@@ -120,7 +120,7 @@ public class PolarizerBlockEntity extends ElectricBlockEntity implements IHaveGo
|
||||
}
|
||||
@Nonnull
|
||||
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, Direction side) {
|
||||
return cap == ForgeCapabilities.ITEM_HANDLER ? this.itemCapability.cast() : super.getCapability(cap, side);
|
||||
return cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY? this.itemCapability.cast() : super.getCapability(cap, side);
|
||||
}
|
||||
|
||||
public boolean playerInteract(Player player, InteractionHand hand){
|
||||
|
||||
@@ -14,7 +14,7 @@ import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import net.minecraftforge.energy.EnergyStorage;
|
||||
|
||||
import java.util.List;
|
||||
@@ -52,9 +52,9 @@ public class EnergyMeterBlockEntity extends SmartBlockEntity implements IHaveGog
|
||||
|
||||
|
||||
if(beBehind!=null)
|
||||
if(beBehind.getCapability(ForgeCapabilities.ENERGY).isPresent()){
|
||||
energy = beBehind.getCapability(ForgeCapabilities.ENERGY).orElse(new EnergyStorage(0)).getEnergyStored();
|
||||
range = beBehind.getCapability(ForgeCapabilities.ENERGY).orElse(new EnergyStorage(0)).getMaxEnergyStored();
|
||||
if(beBehind.getCapability(CapabilityEnergy.ENERGY).isPresent()){
|
||||
energy = beBehind.getCapability(CapabilityEnergy.ENERGY).orElse(new EnergyStorage(0)).getEnergyStored();
|
||||
range = beBehind.getCapability(CapabilityEnergy.ENERGY).orElse(new EnergyStorage(0)).getMaxEnergyStored();
|
||||
|
||||
} else energy = 0;
|
||||
|
||||
|
||||
@@ -31,10 +31,10 @@ import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidTank;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
||||
|
||||
@@ -229,7 +229,7 @@ public class CompactEngineBlockEntity extends GeneratingKineticBlockEntity imple
|
||||
|
||||
|
||||
////////////////////////////////////////
|
||||
LazyOptional<IFluidHandler> handler = this.getCapability(ForgeCapabilities.FLUID_HANDLER);
|
||||
LazyOptional<IFluidHandler> handler = this.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY);
|
||||
Optional<IFluidHandler> resolve = handler.resolve();
|
||||
if (!resolve.isPresent())
|
||||
return false;
|
||||
@@ -462,7 +462,7 @@ public void write(CompoundTag compound, boolean clientPacket) {
|
||||
|
||||
ItemStack stack = pPlayer.getItemInHand(pHand);
|
||||
|
||||
if(stack.is(TFMGFluids.GASOLINE.getBucket().get())&&tankInventory.isEmpty()){
|
||||
if(stack.is(TFMGFluids.GASOLINE.get().getBucket())&&tankInventory.isEmpty()){
|
||||
|
||||
tankInventory.setFluid(new FluidStack(TFMGFluids.GASOLINE.get(),1000));
|
||||
pPlayer.setItemInHand(pHand, Items.BUCKET.getDefaultInstance());
|
||||
@@ -522,7 +522,7 @@ public void write(CompoundTag compound, boolean clientPacket) {
|
||||
@Override
|
||||
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) {
|
||||
|
||||
if (cap == ForgeCapabilities.FLUID_HANDLER)
|
||||
if (cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)
|
||||
return fluidCapability.cast();
|
||||
return super.getCapability(cap, side);
|
||||
}
|
||||
|
||||
@@ -39,9 +39,9 @@ import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
@@ -93,8 +93,8 @@ public class DieselEngineBlockEntity extends SmartBlockEntity implements IHaveGo
|
||||
|
||||
|
||||
|
||||
exhaustTank = createInventory(TFMGFluids.CARBON_DIOXIDE.getSource(),true);
|
||||
airTank = createInventory(TFMGFluids.AIR.getSource(),false);
|
||||
exhaustTank = createInventory(TFMGFluids.CARBON_DIOXIDE.get(),true);
|
||||
airTank = createInventory(TFMGFluids.AIR.get(),false);
|
||||
|
||||
|
||||
tanks = Couple.create(fuelTank, exhaustTank);
|
||||
@@ -341,16 +341,16 @@ public class DieselEngineBlockEntity extends SmartBlockEntity implements IHaveGo
|
||||
fuelModifier = 1;
|
||||
|
||||
|
||||
fuelTank.setFluid(new FluidStack(TFMGFluids.DIESEL.getSource(),fuelTank.getFluidAmount()-(2-fuelModifier)));
|
||||
fuelTank.setFluid(new FluidStack(TFMGFluids.DIESEL.get(),fuelTank.getFluidAmount()-(2-fuelModifier)));
|
||||
|
||||
|
||||
}
|
||||
//airTank.drain(1, IFluidHandler.FluidAction.EXECUTE);
|
||||
if(!airTank.isEmpty()) {
|
||||
airTank.setFluid(new FluidStack(TFMGFluids.AIR.getSource(), airTank.getFluidAmount() - 5));
|
||||
}else expansionBE.airTank.setFluid(new FluidStack(TFMGFluids.AIR.getSource(), expansionBE.airTank.getFluidAmount() - 5));
|
||||
exhaustTank.fill(new FluidStack(TFMGFluids.CARBON_DIOXIDE.getSource(),3), IFluidHandler.FluidAction.EXECUTE);
|
||||
//tanks.get(false).setFluid(new FluidStack(TFMGFluids.CARBON_DIOXIDE.getSource(), tanks.get(false).getFluidAmount()+1));
|
||||
airTank.setFluid(new FluidStack(TFMGFluids.AIR.get(), airTank.getFluidAmount() - 5));
|
||||
}else expansionBE.airTank.setFluid(new FluidStack(TFMGFluids.AIR.get(), expansionBE.airTank.getFluidAmount() - 5));
|
||||
exhaustTank.fill(new FluidStack(TFMGFluids.CARBON_DIOXIDE.get(),3), IFluidHandler.FluidAction.EXECUTE);
|
||||
//tanks.get(false).setFluid(new FluidStack(TFMGFluids.CARBON_DIOXIDE.get(), tanks.get(false).getFluidAmount()+1));
|
||||
|
||||
|
||||
|
||||
@@ -360,12 +360,12 @@ public class DieselEngineBlockEntity extends SmartBlockEntity implements IHaveGo
|
||||
if (!expansionBE.coolantTank.isEmpty()){
|
||||
strengthModifier +=3;
|
||||
if(consumptionTimer>5)
|
||||
expansionBE.coolantTank.setFluid(new FluidStack(TFMGFluids.COOLING_FLUID.getSource(), expansionBE.coolantTank.getFluidAmount() - 1));
|
||||
expansionBE.coolantTank.setFluid(new FluidStack(TFMGFluids.COOLING_FLUID.get(), expansionBE.coolantTank.getFluidAmount() - 1));
|
||||
}
|
||||
if (!expansionBE.lubricationOilTank.isEmpty()){
|
||||
strengthModifier +=5;
|
||||
if(consumptionTimer>5)
|
||||
expansionBE.lubricationOilTank.setFluid(new FluidStack(TFMGFluids.LUBRICATION_OIL.getSource(), expansionBE.lubricationOilTank.getFluidAmount() - 1));
|
||||
expansionBE.lubricationOilTank.setFluid(new FluidStack(TFMGFluids.LUBRICATION_OIL.get(), expansionBE.lubricationOilTank.getFluidAmount() - 1));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -497,7 +497,7 @@ public class DieselEngineBlockEntity extends SmartBlockEntity implements IHaveGo
|
||||
@SuppressWarnings("removal")
|
||||
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, Direction side) {
|
||||
|
||||
if (cap == ForgeCapabilities.FLUID_HANDLER)
|
||||
if (cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)
|
||||
return fluidCapability.cast();
|
||||
return super.getCapability(cap, side);
|
||||
}
|
||||
@@ -535,7 +535,7 @@ public class DieselEngineBlockEntity extends SmartBlockEntity implements IHaveGo
|
||||
|
||||
|
||||
//--Fluid Info--//
|
||||
LazyOptional<IFluidHandler> handler = this.getCapability(ForgeCapabilities.FLUID_HANDLER);
|
||||
LazyOptional<IFluidHandler> handler = this.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY);
|
||||
Optional<IFluidHandler> resolve = handler.resolve();
|
||||
if (!resolve.isPresent())
|
||||
return false;
|
||||
|
||||
@@ -79,7 +79,7 @@ public class AirIntakeBlockEntity extends KineticBlockEntity implements IWrencha
|
||||
//if(!level.isClientSide) {
|
||||
int production = ((int) maxShaftSpeed * ((diameter * diameter))) / 10;
|
||||
if (tankInventory.getFluidAmount() + production <= tankInventory.getCapacity() && !allObstructed) {
|
||||
tankInventory.setFluid(new FluidStack(TFMGFluids.AIR.getSource(), production + tankInventory.getFluidAmount()));
|
||||
tankInventory.setFluid(new FluidStack(TFMGFluids.AIR.get(), production + tankInventory.getFluidAmount()));
|
||||
}
|
||||
|
||||
isObstructed = hasBlockInFront(this.getBlockPos());
|
||||
@@ -550,7 +550,7 @@ public class AirIntakeBlockEntity extends KineticBlockEntity implements IWrencha
|
||||
return new SmartFluidTank(8000, this::onFluidStackChanged){
|
||||
@Override
|
||||
public boolean isFluidValid(FluidStack stack) {
|
||||
return stack.getFluid().isSame(TFMGFluids.AIR.getSource());
|
||||
return stack.getFluid().isSame(TFMGFluids.AIR.get());
|
||||
}
|
||||
// @Override
|
||||
// public FluidStack drain(FluidStack resource, FluidAction action) {
|
||||
|
||||
@@ -456,7 +456,7 @@ public void write(CompoundTag compound, boolean clientPacket) {
|
||||
|
||||
ItemStack stack = pPlayer.getItemInHand(pHand);
|
||||
|
||||
if(stack.is(TFMGFluids.CREOSOTE.getBucket().get())&&tankInventory.isEmpty()){
|
||||
if(stack.is(TFMGFluids.CREOSOTE.get().getBucket())&&tankInventory.isEmpty()){
|
||||
|
||||
tankInventory.setFluid(new FluidStack(TFMGFluids.CREOSOTE.get(),1000));
|
||||
pPlayer.setItemInHand(pHand, Items.BUCKET.getDefaultInstance());
|
||||
|
||||
@@ -31,10 +31,10 @@ import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidTank;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
||||
|
||||
@@ -287,7 +287,7 @@ boolean signalChanged;
|
||||
|
||||
|
||||
////////////////////////////////////////
|
||||
LazyOptional<IFluidHandler> handler = this.getCapability(ForgeCapabilities.FLUID_HANDLER);
|
||||
LazyOptional<IFluidHandler> handler = this.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY);
|
||||
Optional<IFluidHandler> resolve = handler.resolve();
|
||||
if (!resolve.isPresent())
|
||||
return false;
|
||||
@@ -475,7 +475,7 @@ public void write(CompoundTag compound, boolean clientPacket) {
|
||||
EngineBackBlockEntity back = (EngineBackBlockEntity) level.getBlockEntity(this.getBlockPos().relative(this.getBlockState().getValue(FACING).getOpposite()));
|
||||
if(back!=null) {
|
||||
if (efficiency != 0 && signal != 0 && !overStressed && !isExhaustTankFull())
|
||||
back.tankInventory.setFluid(new FluidStack(TFMGFluids.CARBON_DIOXIDE.getSource(), back.tankInventory.getFluidAmount() + 6));
|
||||
back.tankInventory.setFluid(new FluidStack(TFMGFluids.CARBON_DIOXIDE.get(), back.tankInventory.getFluidAmount() + 6));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -616,7 +616,7 @@ public void write(CompoundTag compound, boolean clientPacket) {
|
||||
@Override
|
||||
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) {
|
||||
|
||||
if (cap == ForgeCapabilities.FLUID_HANDLER)
|
||||
if (cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)
|
||||
return fluidCapability.cast();
|
||||
return super.getCapability(cap, side);
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ import java.util.Optional;
|
||||
return new SmartFluidTank(1000, this::onFluidStackChanged){
|
||||
@Override
|
||||
public boolean isFluidValid(FluidStack stack) {
|
||||
return stack.getFluid().isSame(TFMGFluids.CARBON_DIOXIDE.getSource());
|
||||
return stack.getFluid().isSame(TFMGFluids.CARBON_DIOXIDE.get());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
BIN
src/main/java/com/drmangotea/createindustry/blocks/fluids.zip
Normal file
BIN
src/main/java/com/drmangotea/createindustry/blocks/fluids.zip
Normal file
Binary file not shown.
@@ -1,70 +0,0 @@
|
||||
package com.drmangotea.createindustry.blocks.fluids;
|
||||
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.simibubi.create.AllFluids;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.foundation.utility.Color;
|
||||
import com.tterrag.registrate.builders.FluidBuilder;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import javax.swing.text.html.parser.Entity;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class AcidFluidType extends AllFluids.TintedFluidType {
|
||||
|
||||
public static DamageSource damageSourceAcid = new DamageSource("createindustry.acid");
|
||||
public AcidFluidType(Properties properties, ResourceLocation stillTexture, ResourceLocation flowingTexture) {
|
||||
super(properties, stillTexture, flowingTexture);
|
||||
}
|
||||
private Vector3f fogColor;
|
||||
private Supplier<Float> fogDistance;
|
||||
|
||||
public static FluidBuilder.FluidTypeFactory create(int fogColor, Supplier<Float> fogDistance) {
|
||||
return (p, s, f) -> {
|
||||
AcidFluidType fluidType = new AcidFluidType(p, s, f);
|
||||
fluidType.fogColor = new Color(fogColor, false).asVectorF();
|
||||
fluidType.fogDistance = fogDistance;
|
||||
return fluidType;
|
||||
};
|
||||
}
|
||||
@Override
|
||||
protected Vector3f getCustomFogColor() {
|
||||
return fogColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getFogDistanceModifier() {
|
||||
return fogDistance.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getTintColor(FluidStack stack) {
|
||||
return NO_TINT;
|
||||
}
|
||||
@Override
|
||||
public int getTintColor(FluidState state, BlockAndTintGetter world, BlockPos pos) {
|
||||
return 0x00ffffff;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean move(FluidState state, LivingEntity entity, Vec3 movementVector, double gravity)
|
||||
{
|
||||
|
||||
|
||||
|
||||
if(Create.RANDOM.nextInt(2)==0)
|
||||
entity.hurt(damageSourceAcid,2);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
package com.drmangotea.createindustry.blocks.fluids;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.Level;
|
||||
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;
|
||||
|
||||
/**
|
||||
* makes fluid burn when close to fire,
|
||||
* not working for now
|
||||
*/
|
||||
public class FlammableFluid extends ForgeFlowingFluid {
|
||||
|
||||
|
||||
protected FlammableFluid(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 FlammableFluid {
|
||||
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 FlammableFluid {
|
||||
public Source(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
public int getAmount(FluidState p_76269_) {
|
||||
return 8;
|
||||
}
|
||||
|
||||
public boolean isSource(FluidState p_76267_) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package com.drmangotea.createindustry.blocks.fluids;
|
||||
|
||||
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.simibubi.create.AllFluids;
|
||||
import com.simibubi.create.foundation.utility.Color;
|
||||
import com.tterrag.registrate.builders.FluidBuilder;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class FlammableFluidType extends AllFluids.TintedFluidType {
|
||||
|
||||
private Vector3f fogColor;
|
||||
private Supplier<Float> fogDistance;
|
||||
|
||||
public static FluidBuilder.FluidTypeFactory create(int fogColor, Supplier<Float> fogDistance) {
|
||||
return (p, s, f) -> {
|
||||
FlammableFluidType fluidType = new FlammableFluidType(p, s, f);
|
||||
fluidType.fogColor = new Color(fogColor, false).asVectorF();
|
||||
fluidType.fogDistance = fogDistance;
|
||||
return fluidType;
|
||||
};
|
||||
}
|
||||
|
||||
private FlammableFluidType(Properties properties, ResourceLocation stillTexture,
|
||||
ResourceLocation flowingTexture) {
|
||||
super(properties, stillTexture, flowingTexture);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getTintColor(FluidStack stack) {
|
||||
return NO_TINT;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getTintColor(FluidState state, BlockAndTintGetter world, BlockPos pos) {
|
||||
return 0x00ffffff;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Vector3f getCustomFogColor() {
|
||||
return fogColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getFogDistanceModifier() {
|
||||
return fogDistance.get();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
package com.drmangotea.createindustry.blocks.fluids;
|
||||
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.simibubi.create.AllFluids;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.foundation.utility.Color;
|
||||
import com.tterrag.registrate.builders.FluidBuilder;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class HotFluidType extends AllFluids.TintedFluidType {
|
||||
public HotFluidType(Properties properties, ResourceLocation stillTexture, ResourceLocation flowingTexture) {
|
||||
super(properties, stillTexture, flowingTexture);
|
||||
}
|
||||
private Vector3f fogColor;
|
||||
private Supplier<Float> fogDistance;
|
||||
|
||||
public static FluidBuilder.FluidTypeFactory create(int fogColor, Supplier<Float> fogDistance) {
|
||||
return (p, s, f) -> {
|
||||
HotFluidType fluidType = new HotFluidType(p, s, f);
|
||||
fluidType.fogColor = new Color(fogColor, false).asVectorF();
|
||||
fluidType.fogDistance = fogDistance;
|
||||
return fluidType;
|
||||
};
|
||||
}
|
||||
@Override
|
||||
protected Vector3f getCustomFogColor() {
|
||||
return fogColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getFogDistanceModifier() {
|
||||
return fogDistance.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getTintColor(FluidStack stack) {
|
||||
return NO_TINT;
|
||||
}
|
||||
@Override
|
||||
public int getTintColor(FluidState state, BlockAndTintGetter world, BlockPos pos) {
|
||||
return 0x00ffffff;
|
||||
}
|
||||
@Override
|
||||
public int getLightLevel() {
|
||||
return 15;
|
||||
}
|
||||
@Override
|
||||
public int getTemperature()
|
||||
{
|
||||
return 1270;
|
||||
}
|
||||
@Override
|
||||
public int getViscosity()
|
||||
{
|
||||
return 50;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean move(FluidState state, LivingEntity entity, Vec3 movementVector, double gravity)
|
||||
{
|
||||
entity.setDeltaMovement(entity.getDeltaMovement().scale(0.6d));
|
||||
|
||||
entity.setSecondsOnFire(10);
|
||||
|
||||
if(Create.RANDOM.nextInt(30)==27)
|
||||
entity.hurt(DamageSource.LAVA,2);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canExtinguish(Entity entity)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.drmangotea.createindustry.blocks.fluids;
|
||||
|
||||
import com.drmangotea.createindustry.blocks.concrete.ConcreteFluidType;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.simibubi.create.AllFluids;
|
||||
import com.simibubi.create.foundation.utility.Color;
|
||||
import com.tterrag.registrate.builders.FluidBuilder;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class PlasticFluidType extends HotFluidType {
|
||||
public PlasticFluidType(Properties properties, ResourceLocation stillTexture, ResourceLocation flowingTexture) {
|
||||
super(properties, stillTexture, flowingTexture);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -128,7 +128,7 @@ public class ExhaustBlockEntity extends SmartBlockEntity implements IHaveGoggleI
|
||||
return new SmartFluidTank(500, this::onFluidStackChanged) {
|
||||
@Override
|
||||
public boolean isFluidValid(FluidStack stack) {
|
||||
return stack.getFluid().isSame(TFMGFluids.CARBON_DIOXIDE.getSource());
|
||||
return stack.getFluid().isSame(TFMGFluids.CARBON_DIOXIDE.get());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -24,24 +24,25 @@ import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.RandomSource;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class FireboxBlockEntity extends SmartBlockEntity {
|
||||
|
||||
@@ -136,7 +137,7 @@ public class FireboxBlockEntity extends SmartBlockEntity {
|
||||
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) {
|
||||
if (!fluidCapability.isPresent())
|
||||
refreshCapability();
|
||||
if (cap == ForgeCapabilities.FLUID_HANDLER)
|
||||
if (cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)
|
||||
return fluidCapability.cast();
|
||||
return super.getCapability(cap, side);
|
||||
}
|
||||
@@ -213,7 +214,7 @@ public class FireboxBlockEntity extends SmartBlockEntity {
|
||||
if (heatLevel == HeatLevel.NONE)
|
||||
return;
|
||||
|
||||
RandomSource r = level.getRandom();
|
||||
Random r = level.getRandom();
|
||||
|
||||
Vec3 c = VecHelper.getCenterOf(worldPosition);
|
||||
Vec3 v = c.add(VecHelper.offsetRandomly(Vec3.ZERO, r, .125f)
|
||||
@@ -246,7 +247,7 @@ public class FireboxBlockEntity extends SmartBlockEntity {
|
||||
|
||||
public void spawnParticleBurst(boolean soulFlame) {
|
||||
Vec3 c = VecHelper.getCenterOf(worldPosition);
|
||||
RandomSource r = level.random;
|
||||
Random r = level.random;
|
||||
for (int i = 0; i < 20; i++) {
|
||||
Vec3 offset = VecHelper.offsetRandomly(Vec3.ZERO, r, .5f)
|
||||
.multiply(1, .25f, 1)
|
||||
|
||||
@@ -26,10 +26,11 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
|
||||
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
||||
@@ -364,7 +365,7 @@ public class BlastFurnaceOutputBlockEntity extends TFMGMachineBlockEntity implem
|
||||
|
||||
|
||||
containedFluidTooltip(tooltip, isPlayerSneaking,
|
||||
getCapability(ForgeCapabilities.FLUID_HANDLER));
|
||||
getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY));
|
||||
|
||||
|
||||
return true;
|
||||
@@ -396,9 +397,9 @@ public class BlastFurnaceOutputBlockEntity extends TFMGMachineBlockEntity implem
|
||||
@Override
|
||||
|
||||
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, Direction side) {
|
||||
if (cap == ForgeCapabilities.ITEM_HANDLER)
|
||||
if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
|
||||
return itemCapability.cast();
|
||||
if (cap == ForgeCapabilities.FLUID_HANDLER)
|
||||
if (cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)
|
||||
return fluidCapability.cast();
|
||||
return super.getCapability(cap, side);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
|
||||
@@ -43,7 +43,7 @@ public class CastingSpoutRenderer extends SafeBlockEntityRenderer<CastingSpoutBl
|
||||
|
||||
if (!fluidStack.isEmpty() && level != 0) {
|
||||
boolean top = fluidStack.getFluid()
|
||||
.getFluidType()
|
||||
.getAttributes()
|
||||
.isLighterThanAir();
|
||||
|
||||
level = Math.max(level, 0.175f);
|
||||
|
||||
@@ -27,11 +27,12 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
|
||||
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
||||
@@ -523,9 +524,9 @@ public class CokeOvenBlockEntity extends TFMGMachineBlockEntity implements IWren
|
||||
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, Direction side) {
|
||||
if(controller!=null)
|
||||
refreshCapability();
|
||||
if (cap == ForgeCapabilities.ITEM_HANDLER)
|
||||
if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
|
||||
return itemCapability.cast();
|
||||
if (cap == ForgeCapabilities.FLUID_HANDLER)
|
||||
if (cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)
|
||||
return fluidCapability.cast();
|
||||
return super.getCapability(cap, side);
|
||||
}
|
||||
|
||||
@@ -28,9 +28,9 @@ import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
||||
import org.checkerframework.checker.units.qual.C;
|
||||
@@ -194,7 +194,7 @@ public class DistillationControllerBlockEntity extends SmartBlockEntity implemen
|
||||
.style(ChatFormatting.RED)
|
||||
.forGoggles(tooltip, 1);
|
||||
containedFluidTooltip(tooltip, isPlayerSneaking,
|
||||
getCapability(ForgeCapabilities.FLUID_HANDLER));
|
||||
getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -237,7 +237,7 @@ public class DistillationControllerBlockEntity extends SmartBlockEntity implemen
|
||||
@Nonnull
|
||||
@Override
|
||||
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, Direction side) {
|
||||
if (cap == ForgeCapabilities.FLUID_HANDLER)
|
||||
if (cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)
|
||||
return fluidCapability.cast();
|
||||
return super.getCapability(cap, side);
|
||||
}
|
||||
|
||||
@@ -17,9 +17,9 @@ import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
||||
|
||||
@@ -57,7 +57,7 @@ public class DistillationOutputBlockEntity extends SmartBlockEntity implements I
|
||||
@Nonnull
|
||||
@Override
|
||||
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, Direction side) {
|
||||
if (cap == ForgeCapabilities.FLUID_HANDLER)
|
||||
if (cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)
|
||||
return fluidCapability.cast();
|
||||
return super.getCapability(cap, side);
|
||||
}
|
||||
@@ -82,7 +82,7 @@ public class DistillationOutputBlockEntity extends SmartBlockEntity implements I
|
||||
|
||||
|
||||
return containedFluidTooltip(tooltip, isPlayerSneaking,
|
||||
getCapability(ForgeCapabilities.FLUID_HANDLER));
|
||||
getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@ import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
||||
|
||||
@@ -139,7 +139,7 @@ public class PumpjackBaseBlockEntity extends SmartBlockEntity implements IHaveGo
|
||||
return;
|
||||
|
||||
|
||||
tankInventory.setFluid(new FluidStack(TFMGFluids.CRUDE_OIL.getSource(), tankInventory.getFluidAmount() + miningRate));
|
||||
tankInventory.setFluid(new FluidStack(TFMGFluids.CRUDE_OIL.get(), tankInventory.getFluidAmount() + miningRate));
|
||||
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ public class PumpjackBaseBlockEntity extends SmartBlockEntity implements IHaveGo
|
||||
return new SmartFluidTank(8000, this::onFluidStackChanged) {
|
||||
@Override
|
||||
public boolean isFluidValid(FluidStack stack) {
|
||||
return stack.getFluid().isSame(TFMGFluids.CRUDE_OIL.getSource());
|
||||
return stack.getFluid().isSame(TFMGFluids.CRUDE_OIL.get());
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -185,7 +185,7 @@ public class PumpjackBaseBlockEntity extends SmartBlockEntity implements IHaveGo
|
||||
}
|
||||
|
||||
//--Fluid Info--//
|
||||
LazyOptional<IFluidHandler> handler = this.getCapability(ForgeCapabilities.FLUID_HANDLER);
|
||||
LazyOptional<IFluidHandler> handler = this.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY);
|
||||
Optional<IFluidHandler> resolve = handler.resolve();
|
||||
if (!resolve.isPresent())
|
||||
return false;
|
||||
@@ -261,7 +261,7 @@ public class PumpjackBaseBlockEntity extends SmartBlockEntity implements IHaveGo
|
||||
|
||||
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, Direction side) {
|
||||
|
||||
if (cap == ForgeCapabilities.FLUID_HANDLER)
|
||||
if (cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)
|
||||
return fluidCapability.cast();
|
||||
return super.getCapability(cap, side);
|
||||
}
|
||||
|
||||
@@ -14,17 +14,17 @@ import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.client.ChunkRenderTypeSet;
|
||||
import net.minecraftforge.client.model.data.ModelData;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
import net.minecraftforge.client.model.data.ModelDataMap;
|
||||
import net.minecraftforge.client.model.data.ModelProperty;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import static net.minecraft.world.level.block.PipeBlock.PROPERTY_BY_DIRECTION;
|
||||
|
||||
@@ -37,80 +37,65 @@ public class AluminumPipeAttachmentModel extends BakedModelWrapperWithData {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ModelData.Builder gatherModelData(ModelData.Builder builder, BlockAndTintGetter world, BlockPos pos, BlockState state,
|
||||
ModelData blockEntityData) {
|
||||
protected void gatherModelData(ModelDataMap.Builder builder, BlockAndTintGetter world, BlockPos pos, BlockState state,
|
||||
IModelData blockEntityData) {
|
||||
PipeModelData data = new PipeModelData();
|
||||
FluidTransportBehaviour transport = BlockEntityBehaviour.get(world, pos, FluidTransportBehaviour.TYPE);
|
||||
BracketedBlockEntityBehaviour bracket = BlockEntityBehaviour.get(world, pos, BracketedBlockEntityBehaviour.TYPE);
|
||||
|
||||
if (transport != null)
|
||||
for (Direction d : Iterate.directions) {
|
||||
boolean shouldConnect = true;
|
||||
if(world.getBlockState(pos.relative(d)).getBlock() instanceof FluidPipeBlock) {
|
||||
|
||||
if(d.getAxis().isHorizontal())
|
||||
shouldConnect = world.getBlockState(pos.relative(d)).getValue(PROPERTY_BY_DIRECTION.get(d.getOpposite()));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
for (Direction d : Iterate.directions)
|
||||
data.putAttachment(d, transport.getRenderedRimAttachment(world, pos, state, d));
|
||||
|
||||
if(!shouldConnect)
|
||||
if(state.getBlock() instanceof FluidPipeBlock)
|
||||
if(state.getValue(PROPERTY_BY_DIRECTION.get(d)))
|
||||
data.putAttachment(d, FluidTransportBehaviour.AttachmentTypes.RIM);
|
||||
|
||||
}
|
||||
if (bracket != null)
|
||||
data.putBracket(bracket.getBracket());
|
||||
|
||||
data.setEncased(FluidPipeBlock.shouldDrawCasing(world, pos, state));
|
||||
return builder.with(PIPE_PROPERTY, data);
|
||||
builder.withInitial(PIPE_PROPERTY, data);
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
@Override
|
||||
public ChunkRenderTypeSet getRenderTypes(@NotNull BlockState state, @NotNull RandomSource rand, @NotNull ModelData data) {
|
||||
ChunkRenderTypeSet set = super.getRenderTypes(state, rand, data);
|
||||
if (set.isEmpty()) {
|
||||
return ItemBlockRenderTypes.getRenderLayers(state);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
// @SuppressWarnings("removal")
|
||||
// @Override
|
||||
// public ChunkRenderTypeSet getRenderTypes(@NotNull BlockState state, @NotNull RandomSource rand, @NotNull ModelData data) {
|
||||
// ChunkRenderTypeSet set = super.getRenderTypes(state, rand, data);
|
||||
// if (set.isEmpty()) {
|
||||
// return ItemBlockRenderTypes.getRenderLayers(state);
|
||||
// }
|
||||
// return set;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(BlockState state, Direction side, RandomSource rand, ModelData data, RenderType renderType) {
|
||||
List<BakedQuad> quads = super.getQuads(state, side, rand, data, renderType);
|
||||
if (data.has(PIPE_PROPERTY)) {
|
||||
PipeModelData pipeData = data.get(PIPE_PROPERTY);
|
||||
public List<BakedQuad> getQuads(BlockState state, Direction side, Random rand, IModelData data) {
|
||||
List<BakedQuad> quads = super.getQuads(state, side, rand, data);
|
||||
if (data.hasProperty(PIPE_PROPERTY)) {
|
||||
PipeModelData pipeData = data.getData(PIPE_PROPERTY);
|
||||
quads = new ArrayList<>(quads);
|
||||
addQuads(quads, state, side, rand, data, pipeData, renderType);
|
||||
addQuads(quads, state, side, rand, data, pipeData);
|
||||
}
|
||||
return quads;
|
||||
}
|
||||
|
||||
private void addQuads(List<BakedQuad> quads, BlockState state, Direction side, RandomSource rand, ModelData data,
|
||||
PipeModelData pipeData, RenderType renderType) {
|
||||
private void addQuads(List<BakedQuad> quads, BlockState state, Direction side, Random rand, IModelData data,
|
||||
PipeModelData pipeData) {
|
||||
BakedModel bracket = pipeData.getBracket();
|
||||
if (bracket != null)
|
||||
quads.addAll(bracket.getQuads(state, side, rand, data, renderType));
|
||||
quads.addAll(bracket.getQuads(state, side, rand, data));
|
||||
for (Direction d : Iterate.directions) {
|
||||
FluidTransportBehaviour.AttachmentTypes type = pipeData.getAttachment(d);
|
||||
for (FluidTransportBehaviour.AttachmentTypes.ComponentPartials partial : type.partials) {
|
||||
quads.addAll(TFMGPartialModels.ALUMINUM_PIPE_ATTACHMENTS.get(partial)
|
||||
.get(d)
|
||||
.get()
|
||||
.getQuads(state, side, rand, data, renderType));
|
||||
.getQuads(state, side, rand, data));
|
||||
}
|
||||
}
|
||||
if (pipeData.isEncased())
|
||||
quads.addAll(TFMGPartialModels.ALUMINUM_FLUID_PIPE_CASING.get()
|
||||
.getQuads(state, side, rand, data, renderType));
|
||||
.getQuads(state, side, rand, data));
|
||||
}
|
||||
|
||||
|
||||
private static class PipeModelData {
|
||||
private FluidTransportBehaviour.AttachmentTypes[] attachments;
|
||||
private boolean encased;
|
||||
|
||||
@@ -19,7 +19,6 @@ import com.simibubi.create.foundation.utility.Iterate;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
@@ -106,12 +105,7 @@ public class AluminumPipeBlock extends FluidPipeBlock {
|
||||
return state.setValue(PROPERTY_BY_DIRECTION.get(preferredDirection), true)
|
||||
.setValue(PROPERTY_BY_DIRECTION.get(preferredDirection.getOpposite()), true);
|
||||
}
|
||||
@Override
|
||||
public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource r) {
|
||||
super.tick(state,world,pos,r);
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public InteractionResult onWrenched(BlockState state, UseOnContext context) {
|
||||
|
||||
|
||||
@@ -14,17 +14,17 @@ import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.client.ChunkRenderTypeSet;
|
||||
import net.minecraftforge.client.model.data.ModelData;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
import net.minecraftforge.client.model.data.ModelDataMap;
|
||||
import net.minecraftforge.client.model.data.ModelProperty;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import static net.minecraft.world.level.block.PipeBlock.PROPERTY_BY_DIRECTION;
|
||||
|
||||
@@ -36,81 +36,69 @@ public class BrassPipeAttachmentModel extends BakedModelWrapperWithData {
|
||||
super(template);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected ModelData.Builder gatherModelData(ModelData.Builder builder, BlockAndTintGetter world, BlockPos pos, BlockState state,
|
||||
ModelData blockEntityData) {
|
||||
protected void gatherModelData(ModelDataMap.Builder builder, BlockAndTintGetter world, BlockPos pos, BlockState state,
|
||||
IModelData blockEntityData) {
|
||||
PipeModelData data = new PipeModelData();
|
||||
FluidTransportBehaviour transport = BlockEntityBehaviour.get(world, pos, FluidTransportBehaviour.TYPE);
|
||||
BracketedBlockEntityBehaviour bracket = BlockEntityBehaviour.get(world, pos, BracketedBlockEntityBehaviour.TYPE);
|
||||
|
||||
if (transport != null)
|
||||
for (Direction d : Iterate.directions) {
|
||||
boolean shouldConnect = true;
|
||||
if(world.getBlockState(pos.relative(d)).getBlock() instanceof FluidPipeBlock) {
|
||||
|
||||
if(d.getAxis().isHorizontal())
|
||||
shouldConnect = world.getBlockState(pos.relative(d)).getValue(PROPERTY_BY_DIRECTION.get(d.getOpposite()));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
for (Direction d : Iterate.directions)
|
||||
data.putAttachment(d, transport.getRenderedRimAttachment(world, pos, state, d));
|
||||
|
||||
if(!shouldConnect)
|
||||
if(state.getBlock() instanceof FluidPipeBlock)
|
||||
if(state.getValue(PROPERTY_BY_DIRECTION.get(d)))
|
||||
data.putAttachment(d, FluidTransportBehaviour.AttachmentTypes.RIM);
|
||||
|
||||
}
|
||||
if (bracket != null)
|
||||
data.putBracket(bracket.getBracket());
|
||||
|
||||
data.setEncased(FluidPipeBlock.shouldDrawCasing(world, pos, state));
|
||||
return builder.with(PIPE_PROPERTY, data);
|
||||
builder.withInitial(PIPE_PROPERTY, data);
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
@Override
|
||||
public ChunkRenderTypeSet getRenderTypes(@NotNull BlockState state, @NotNull RandomSource rand, @NotNull ModelData data) {
|
||||
ChunkRenderTypeSet set = super.getRenderTypes(state, rand, data);
|
||||
if (set.isEmpty()) {
|
||||
return ItemBlockRenderTypes.getRenderLayers(state);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
// @SuppressWarnings("removal")
|
||||
// @Override
|
||||
// public ChunkRenderTypeSet getRenderTypes(@NotNull BlockState state, @NotNull RandomSource rand, @NotNull ModelData data) {
|
||||
// ChunkRenderTypeSet set = super.getRenderTypes(state, rand, data);
|
||||
// if (set.isEmpty()) {
|
||||
// return ItemBlockRenderTypes.getRenderLayers(state);
|
||||
// }
|
||||
// return set;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(BlockState state, Direction side, RandomSource rand, ModelData data, RenderType renderType) {
|
||||
List<BakedQuad> quads = super.getQuads(state, side, rand, data, renderType);
|
||||
if (data.has(PIPE_PROPERTY)) {
|
||||
PipeModelData pipeData = data.get(PIPE_PROPERTY);
|
||||
public List<BakedQuad> getQuads(BlockState state, Direction side, Random rand, IModelData data) {
|
||||
List<BakedQuad> quads = super.getQuads(state, side, rand, data);
|
||||
if (data.hasProperty(PIPE_PROPERTY)) {
|
||||
PipeModelData pipeData = data.getData(PIPE_PROPERTY);
|
||||
quads = new ArrayList<>(quads);
|
||||
addQuads(quads, state, side, rand, data, pipeData, renderType);
|
||||
addQuads(quads, state, side, rand, data, pipeData);
|
||||
}
|
||||
return quads;
|
||||
}
|
||||
|
||||
private void addQuads(List<BakedQuad> quads, BlockState state, Direction side, RandomSource rand, ModelData data,
|
||||
PipeModelData pipeData, RenderType renderType) {
|
||||
private void addQuads(List<BakedQuad> quads, BlockState state, Direction side, Random rand, IModelData data,
|
||||
PipeModelData pipeData) {
|
||||
BakedModel bracket = pipeData.getBracket();
|
||||
if (bracket != null)
|
||||
quads.addAll(bracket.getQuads(state, side, rand, data, renderType));
|
||||
quads.addAll(bracket.getQuads(state, side, rand, data));
|
||||
for (Direction d : Iterate.directions) {
|
||||
FluidTransportBehaviour.AttachmentTypes type = pipeData.getAttachment(d);
|
||||
for (FluidTransportBehaviour.AttachmentTypes.ComponentPartials partial : type.partials) {
|
||||
quads.addAll(TFMGPartialModels.BRASS_PIPE_ATTACHMENTS.get(partial)
|
||||
.get(d)
|
||||
.get()
|
||||
.getQuads(state, side, rand, data, renderType));
|
||||
.getQuads(state, side, rand, data));
|
||||
}
|
||||
}
|
||||
if (pipeData.isEncased())
|
||||
quads.addAll(TFMGPartialModels.BRASS_FLUID_PIPE_CASING.get()
|
||||
.getQuads(state, side, rand, data, renderType));
|
||||
.getQuads(state, side, rand, data));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private static class PipeModelData {
|
||||
private FluidTransportBehaviour.AttachmentTypes[] attachments;
|
||||
private boolean encased;
|
||||
|
||||
@@ -19,7 +19,6 @@ import com.simibubi.create.foundation.utility.Iterate;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
@@ -105,12 +104,6 @@ public class BrassPipeBlock extends FluidPipeBlock {
|
||||
// Use preferred
|
||||
return state.setValue(PROPERTY_BY_DIRECTION.get(preferredDirection), true)
|
||||
.setValue(PROPERTY_BY_DIRECTION.get(preferredDirection.getOpposite()), true);
|
||||
}
|
||||
@Override
|
||||
public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource r) {
|
||||
super.tick(state,world,pos,r);
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public InteractionResult onWrenched(BlockState state, UseOnContext context) {
|
||||
|
||||
@@ -14,17 +14,18 @@ import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.client.ChunkRenderTypeSet;
|
||||
import net.minecraftforge.client.model.data.ModelData;
|
||||
import net.minecraft.world.level.levelgen.RandomSource;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
import net.minecraftforge.client.model.data.ModelDataMap;
|
||||
import net.minecraftforge.client.model.data.ModelProperty;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import static net.minecraft.world.level.block.PipeBlock.PROPERTY_BY_DIRECTION;
|
||||
|
||||
@@ -37,80 +38,67 @@ public class CastIronPipeAttachmentModel extends BakedModelWrapperWithData {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ModelData.Builder gatherModelData(ModelData.Builder builder, BlockAndTintGetter world, BlockPos pos, BlockState state,
|
||||
ModelData blockEntityData) {
|
||||
protected void gatherModelData(ModelDataMap.Builder builder, BlockAndTintGetter world, BlockPos pos, BlockState state,
|
||||
IModelData blockEntityData) {
|
||||
PipeModelData data = new PipeModelData();
|
||||
FluidTransportBehaviour transport = BlockEntityBehaviour.get(world, pos, FluidTransportBehaviour.TYPE);
|
||||
BracketedBlockEntityBehaviour bracket = BlockEntityBehaviour.get(world, pos, BracketedBlockEntityBehaviour.TYPE);
|
||||
|
||||
if (transport != null)
|
||||
for (Direction d : Iterate.directions) {
|
||||
boolean shouldConnect = true;
|
||||
if(world.getBlockState(pos.relative(d)).getBlock() instanceof FluidPipeBlock) {
|
||||
|
||||
if(d.getAxis().isHorizontal())
|
||||
shouldConnect = world.getBlockState(pos.relative(d)).getValue(PROPERTY_BY_DIRECTION.get(d.getOpposite()));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
for (Direction d : Iterate.directions)
|
||||
data.putAttachment(d, transport.getRenderedRimAttachment(world, pos, state, d));
|
||||
|
||||
if(!shouldConnect)
|
||||
if(state.getBlock() instanceof FluidPipeBlock)
|
||||
if(state.getValue(PROPERTY_BY_DIRECTION.get(d)))
|
||||
data.putAttachment(d, FluidTransportBehaviour.AttachmentTypes.RIM);
|
||||
|
||||
}
|
||||
if (bracket != null)
|
||||
data.putBracket(bracket.getBracket());
|
||||
|
||||
data.setEncased(FluidPipeBlock.shouldDrawCasing(world, pos, state));
|
||||
return builder.with(PIPE_PROPERTY, data);
|
||||
builder.withInitial(PIPE_PROPERTY, data);
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
@Override
|
||||
public ChunkRenderTypeSet getRenderTypes(@NotNull BlockState state, @NotNull RandomSource rand, @NotNull ModelData data) {
|
||||
ChunkRenderTypeSet set = super.getRenderTypes(state, rand, data);
|
||||
if (set.isEmpty()) {
|
||||
return ItemBlockRenderTypes.getRenderLayers(state);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
// @SuppressWarnings("removal")
|
||||
// @Override
|
||||
// public ChunkRenderTypeSet getRenderTypes(@NotNull BlockState state, @NotNull RandomSource rand, @NotNull ModelData data) {
|
||||
// ChunkRenderTypeSet set = super.getRenderTypes(state, rand, data);
|
||||
// if (set.isEmpty()) {
|
||||
// return ItemBlockRenderTypes.getRenderLayers(state);
|
||||
// }
|
||||
// return set;
|
||||
// }
|
||||
//
|
||||
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(BlockState state, Direction side, RandomSource rand, ModelData data, RenderType renderType) {
|
||||
List<BakedQuad> quads = super.getQuads(state, side, rand, data, renderType);
|
||||
if (data.has(PIPE_PROPERTY)) {
|
||||
PipeModelData pipeData = data.get(PIPE_PROPERTY);
|
||||
public List<BakedQuad> getQuads(BlockState state, Direction side, Random rand, IModelData data) {
|
||||
List<BakedQuad> quads = super.getQuads(state, side, rand, data);
|
||||
if (data.hasProperty(PIPE_PROPERTY)) {
|
||||
PipeModelData pipeData = data.getData(PIPE_PROPERTY);
|
||||
quads = new ArrayList<>(quads);
|
||||
addQuads(quads, state, side, rand, data, pipeData, renderType);
|
||||
addQuads(quads, state, side, rand, data, pipeData);
|
||||
}
|
||||
return quads;
|
||||
}
|
||||
|
||||
private void addQuads(List<BakedQuad> quads, BlockState state, Direction side, RandomSource rand, ModelData data,
|
||||
PipeModelData pipeData, RenderType renderType) {
|
||||
private void addQuads(List<BakedQuad> quads, BlockState state, Direction side, Random rand, IModelData data,
|
||||
PipeModelData pipeData) {
|
||||
BakedModel bracket = pipeData.getBracket();
|
||||
if (bracket != null)
|
||||
quads.addAll(bracket.getQuads(state, side, rand, data, renderType));
|
||||
quads.addAll(bracket.getQuads(state, side, rand, data));
|
||||
for (Direction d : Iterate.directions) {
|
||||
FluidTransportBehaviour.AttachmentTypes type = pipeData.getAttachment(d);
|
||||
for (FluidTransportBehaviour.AttachmentTypes.ComponentPartials partial : type.partials) {
|
||||
quads.addAll(TFMGPartialModels.CAST_IRON_PIPE_ATTACHMENTS.get(partial)
|
||||
.get(d)
|
||||
.get()
|
||||
.getQuads(state, side, rand, data, renderType));
|
||||
.getQuads(state, side, rand, data));
|
||||
}
|
||||
}
|
||||
if (pipeData.isEncased())
|
||||
quads.addAll(TFMGPartialModels.CAST_IRON_FLUID_PIPE_CASING.get()
|
||||
.getQuads(state, side, rand, data, renderType));
|
||||
.getQuads(state, side, rand, data));
|
||||
}
|
||||
|
||||
|
||||
private static class PipeModelData {
|
||||
private FluidTransportBehaviour.AttachmentTypes[] attachments;
|
||||
private boolean encased;
|
||||
|
||||
@@ -19,7 +19,6 @@ import com.simibubi.create.foundation.utility.Iterate;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
@@ -31,6 +30,7 @@ import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.levelgen.RandomSource;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
@@ -106,12 +106,7 @@ public class CastIronPipeBlock extends FluidPipeBlock {
|
||||
return state.setValue(PROPERTY_BY_DIRECTION.get(preferredDirection), true)
|
||||
.setValue(PROPERTY_BY_DIRECTION.get(preferredDirection.getOpposite()), true);
|
||||
}
|
||||
@Override
|
||||
public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource r) {
|
||||
super.tick(state,world,pos,r);
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public InteractionResult onWrenched(BlockState state, UseOnContext context) {
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.drmangotea.createindustry.blocks.pipes.normal.plastic;
|
||||
|
||||
import com.drmangotea.createindustry.registry.TFMGPartialModels;
|
||||
import com.jozufozu.flywheel.core.materials.model.ModelData;
|
||||
import com.simibubi.create.content.decoration.bracket.BracketedBlockEntityBehaviour;
|
||||
import com.simibubi.create.content.fluids.FluidTransportBehaviour;
|
||||
import com.simibubi.create.content.fluids.pipes.FluidPipeBlock;
|
||||
@@ -14,17 +15,18 @@ import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.client.ChunkRenderTypeSet;
|
||||
import net.minecraftforge.client.model.data.ModelData;
|
||||
import net.minecraft.world.level.levelgen.RandomSource;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
import net.minecraftforge.client.model.data.ModelDataMap;
|
||||
import net.minecraftforge.client.model.data.ModelProperty;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import static net.minecraft.world.level.block.PipeBlock.PROPERTY_BY_DIRECTION;
|
||||
|
||||
@@ -36,81 +38,70 @@ public class PlasticPipeAttachmentModel extends BakedModelWrapperWithData {
|
||||
super(template);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected ModelData.Builder gatherModelData(ModelData.Builder builder, BlockAndTintGetter world, BlockPos pos, BlockState state,
|
||||
ModelData blockEntityData) {
|
||||
protected void gatherModelData(ModelDataMap.Builder builder, BlockAndTintGetter world, BlockPos pos, BlockState state,
|
||||
IModelData blockEntityData) {
|
||||
PipeModelData data = new PipeModelData();
|
||||
FluidTransportBehaviour transport = BlockEntityBehaviour.get(world, pos, FluidTransportBehaviour.TYPE);
|
||||
BracketedBlockEntityBehaviour bracket = BlockEntityBehaviour.get(world, pos, BracketedBlockEntityBehaviour.TYPE);
|
||||
|
||||
if (transport != null)
|
||||
for (Direction d : Iterate.directions) {
|
||||
boolean shouldConnect = true;
|
||||
if(world.getBlockState(pos.relative(d)).getBlock() instanceof FluidPipeBlock) {
|
||||
|
||||
if(d.getAxis().isHorizontal())
|
||||
shouldConnect = world.getBlockState(pos.relative(d)).getValue(PROPERTY_BY_DIRECTION.get(d.getOpposite()));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
for (Direction d : Iterate.directions)
|
||||
data.putAttachment(d, transport.getRenderedRimAttachment(world, pos, state, d));
|
||||
|
||||
if(!shouldConnect)
|
||||
if(state.getBlock() instanceof FluidPipeBlock)
|
||||
if(state.getValue(PROPERTY_BY_DIRECTION.get(d)))
|
||||
data.putAttachment(d, FluidTransportBehaviour.AttachmentTypes.RIM);
|
||||
|
||||
}
|
||||
if (bracket != null)
|
||||
data.putBracket(bracket.getBracket());
|
||||
|
||||
data.setEncased(FluidPipeBlock.shouldDrawCasing(world, pos, state));
|
||||
return builder.with(PIPE_PROPERTY, data);
|
||||
builder.withInitial(PIPE_PROPERTY, data);
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
@Override
|
||||
public ChunkRenderTypeSet getRenderTypes(@NotNull BlockState state, @NotNull RandomSource rand, @NotNull ModelData data) {
|
||||
ChunkRenderTypeSet set = super.getRenderTypes(state, rand, data);
|
||||
if (set.isEmpty()) {
|
||||
return ItemBlockRenderTypes.getRenderLayers(state);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
// @SuppressWarnings("removal")
|
||||
// @Override
|
||||
// public ChunkRenderTypeSet getRenderTypes(@NotNull BlockState state, @NotNull RandomSource rand, @NotNull ModelData data) {
|
||||
// ChunkRenderTypeSet set = super.getRenderTypes(state, rand, data);
|
||||
// if (set.isEmpty()) {
|
||||
// return ItemBlockRenderTypes.getRenderLayers(state);
|
||||
// }
|
||||
// return set;
|
||||
// }
|
||||
//
|
||||
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(BlockState state, Direction side, RandomSource rand, ModelData data, RenderType renderType) {
|
||||
List<BakedQuad> quads = super.getQuads(state, side, rand, data, renderType);
|
||||
if (data.has(PIPE_PROPERTY)) {
|
||||
PipeModelData pipeData = data.get(PIPE_PROPERTY);
|
||||
public List<BakedQuad> getQuads(BlockState state, Direction side, Random rand, IModelData data) {
|
||||
List<BakedQuad> quads = super.getQuads(state, side, rand, data);
|
||||
if (data.hasProperty(PIPE_PROPERTY)) {
|
||||
PipeModelData pipeData = data.getData(PIPE_PROPERTY);
|
||||
quads = new ArrayList<>(quads);
|
||||
addQuads(quads, state, side, rand, data, pipeData, renderType);
|
||||
addQuads(quads, state, side, rand, data, pipeData);
|
||||
}
|
||||
return quads;
|
||||
}
|
||||
|
||||
private void addQuads(List<BakedQuad> quads, BlockState state, Direction side, RandomSource rand, ModelData data,
|
||||
PipeModelData pipeData, RenderType renderType) {
|
||||
private void addQuads(List<BakedQuad> quads, BlockState state, Direction side, Random rand, IModelData data,
|
||||
PipeModelData pipeData) {
|
||||
BakedModel bracket = pipeData.getBracket();
|
||||
if (bracket != null)
|
||||
quads.addAll(bracket.getQuads(state, side, rand, data, renderType));
|
||||
quads.addAll(bracket.getQuads(state, side, rand, data));
|
||||
for (Direction d : Iterate.directions) {
|
||||
FluidTransportBehaviour.AttachmentTypes type = pipeData.getAttachment(d);
|
||||
for (FluidTransportBehaviour.AttachmentTypes.ComponentPartials partial : type.partials) {
|
||||
quads.addAll(TFMGPartialModels.PLASTIC_PIPE_ATTACHMENTS.get(partial)
|
||||
.get(d)
|
||||
.get()
|
||||
.getQuads(state, side, rand, data, renderType));
|
||||
.getQuads(state, side, rand, data));
|
||||
}
|
||||
}
|
||||
if (pipeData.isEncased())
|
||||
quads.addAll(TFMGPartialModels.PLASTIC_FLUID_PIPE_CASING.get()
|
||||
.getQuads(state, side, rand, data, renderType));
|
||||
.getQuads(state, side, rand, data));
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static class PipeModelData {
|
||||
private FluidTransportBehaviour.AttachmentTypes[] attachments;
|
||||
private boolean encased;
|
||||
|
||||
@@ -18,7 +18,6 @@ import com.simibubi.create.foundation.utility.Iterate;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
@@ -105,12 +104,7 @@ public class PlasticPipeBlock extends FluidPipeBlock {
|
||||
return state.setValue(PROPERTY_BY_DIRECTION.get(preferredDirection), true)
|
||||
.setValue(PROPERTY_BY_DIRECTION.get(preferredDirection.getOpposite()), true);
|
||||
}
|
||||
@Override
|
||||
public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource r) {
|
||||
super.tick(state,world,pos,r);
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public InteractionResult onWrenched(BlockState state, UseOnContext context) {
|
||||
|
||||
|
||||
@@ -15,17 +15,17 @@ import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.client.ChunkRenderTypeSet;
|
||||
import net.minecraftforge.client.model.data.ModelData;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
import net.minecraftforge.client.model.data.ModelDataMap;
|
||||
import net.minecraftforge.client.model.data.ModelProperty;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
|
||||
import static net.minecraft.world.level.block.PipeBlock.PROPERTY_BY_DIRECTION;
|
||||
@@ -39,80 +39,65 @@ public class SteelPipeAttachmentModel extends BakedModelWrapperWithData {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ModelData.Builder gatherModelData(ModelData.Builder builder, BlockAndTintGetter world, BlockPos pos, BlockState state,
|
||||
ModelData blockEntityData) {
|
||||
protected void gatherModelData(ModelDataMap.Builder builder, BlockAndTintGetter world, BlockPos pos, BlockState state,
|
||||
IModelData blockEntityData) {
|
||||
PipeModelData data = new PipeModelData();
|
||||
FluidTransportBehaviour transport = BlockEntityBehaviour.get(world, pos, FluidTransportBehaviour.TYPE);
|
||||
BracketedBlockEntityBehaviour bracket = BlockEntityBehaviour.get(world, pos, BracketedBlockEntityBehaviour.TYPE);
|
||||
|
||||
if (transport != null)
|
||||
for (Direction d : Iterate.directions) {
|
||||
boolean shouldConnect = true;
|
||||
if(world.getBlockState(pos.relative(d)).getBlock() instanceof FluidPipeBlock) {
|
||||
|
||||
if(d.getAxis().isHorizontal())
|
||||
shouldConnect = world.getBlockState(pos.relative(d)).getValue(PROPERTY_BY_DIRECTION.get(d.getOpposite()));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
for (Direction d : Iterate.directions)
|
||||
data.putAttachment(d, transport.getRenderedRimAttachment(world, pos, state, d));
|
||||
|
||||
if(!shouldConnect)
|
||||
if(state.getBlock() instanceof FluidPipeBlock)
|
||||
if(state.getValue(PROPERTY_BY_DIRECTION.get(d)))
|
||||
data.putAttachment(d, FluidTransportBehaviour.AttachmentTypes.RIM);
|
||||
|
||||
}
|
||||
if (bracket != null)
|
||||
data.putBracket(bracket.getBracket());
|
||||
|
||||
data.setEncased(FluidPipeBlock.shouldDrawCasing(world, pos, state));
|
||||
return builder.with(PIPE_PROPERTY, data);
|
||||
builder.withInitial(PIPE_PROPERTY, data);
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
@Override
|
||||
public ChunkRenderTypeSet getRenderTypes(@NotNull BlockState state, @NotNull RandomSource rand, @NotNull ModelData data) {
|
||||
ChunkRenderTypeSet set = super.getRenderTypes(state, rand, data);
|
||||
if (set.isEmpty()) {
|
||||
return ItemBlockRenderTypes.getRenderLayers(state);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
// @SuppressWarnings("removal")
|
||||
// @Override
|
||||
// public ChunkRenderTypeSet getRenderTypes(@NotNull BlockState state, @NotNull RandomSource rand, @NotNull ModelData data) {
|
||||
// ChunkRenderTypeSet set = super.getRenderTypes(state, rand, data);
|
||||
// if (set.isEmpty()) {
|
||||
// return ItemBlockRenderTypes.getRenderLayers(state);
|
||||
// }
|
||||
// return set;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(BlockState state, Direction side, RandomSource rand, ModelData data, RenderType renderType) {
|
||||
List<BakedQuad> quads = super.getQuads(state, side, rand, data, renderType);
|
||||
if (data.has(PIPE_PROPERTY)) {
|
||||
PipeModelData pipeData = data.get(PIPE_PROPERTY);
|
||||
public List<BakedQuad> getQuads(BlockState state, Direction side, Random rand, IModelData data) {
|
||||
List<BakedQuad> quads = super.getQuads(state, side, rand, data);
|
||||
if (data.hasProperty(PIPE_PROPERTY)) {
|
||||
PipeModelData pipeData = data.getData(PIPE_PROPERTY);
|
||||
quads = new ArrayList<>(quads);
|
||||
addQuads(quads, state, side, rand, data, pipeData, renderType);
|
||||
addQuads(quads, state, side, rand, data, pipeData);
|
||||
}
|
||||
return quads;
|
||||
}
|
||||
|
||||
private void addQuads(List<BakedQuad> quads, BlockState state, Direction side, RandomSource rand, ModelData data,
|
||||
PipeModelData pipeData, RenderType renderType) {
|
||||
private void addQuads(List<BakedQuad> quads, BlockState state, Direction side, Random rand, IModelData data,
|
||||
PipeModelData pipeData) {
|
||||
BakedModel bracket = pipeData.getBracket();
|
||||
if (bracket != null)
|
||||
quads.addAll(bracket.getQuads(state, side, rand, data, renderType));
|
||||
quads.addAll(bracket.getQuads(state, side, rand, data));
|
||||
for (Direction d : Iterate.directions) {
|
||||
FluidTransportBehaviour.AttachmentTypes type = pipeData.getAttachment(d);
|
||||
for (FluidTransportBehaviour.AttachmentTypes.ComponentPartials partial : type.partials) {
|
||||
quads.addAll(TFMGPartialModels.STEEL_PIPE_ATTACHMENTS.get(partial)
|
||||
.get(d)
|
||||
.get()
|
||||
.getQuads(state, side, rand, data, renderType));
|
||||
.getQuads(state, side, rand, data));
|
||||
}
|
||||
}
|
||||
if (pipeData.isEncased())
|
||||
quads.addAll(TFMGPartialModels.STEEL_FLUID_PIPE_CASING.get()
|
||||
.getQuads(state, side, rand, data, renderType));
|
||||
.getQuads(state, side, rand, data));
|
||||
}
|
||||
|
||||
|
||||
public class PipeModelData {
|
||||
private FluidTransportBehaviour.AttachmentTypes[] attachments;
|
||||
private boolean encased;
|
||||
|
||||
@@ -19,7 +19,6 @@ import com.simibubi.create.foundation.utility.Iterate;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
@@ -106,12 +105,7 @@ public class SteelPipeBlock extends FluidPipeBlock {
|
||||
return state.setValue(PROPERTY_BY_DIRECTION.get(preferredDirection), true)
|
||||
.setValue(PROPERTY_BY_DIRECTION.get(preferredDirection.getOpposite()), true);
|
||||
}
|
||||
@Override
|
||||
public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource r) {
|
||||
super.tick(state,world,pos,r);
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public InteractionResult onWrenched(BlockState state, UseOnContext context) {
|
||||
|
||||
|
||||
@@ -4,11 +4,7 @@ package com.drmangotea.createindustry.blocks.pipes.pumps;
|
||||
import com.drmangotea.createindustry.registry.TFMGBlockEntities;
|
||||
import com.simibubi.create.content.fluids.pump.PumpBlock;
|
||||
import com.simibubi.create.content.fluids.pump.PumpBlockEntity;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class TFMGPumpBlock extends PumpBlock {
|
||||
public TFMGPumpBlock(Properties p_i48415_1_) {
|
||||
@@ -16,12 +12,7 @@ public class TFMGPumpBlock extends PumpBlock {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource r) {
|
||||
super.tick(state,world,pos,r);
|
||||
this.getBlockEntity(world,pos).updatePressureChange();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<PumpBlockEntity> getBlockEntityClass() {
|
||||
|
||||
@@ -22,7 +22,6 @@ import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.network.protocol.game.DebugPackets;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
|
||||
@@ -21,7 +21,6 @@ import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.network.protocol.game.DebugPackets;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
||||
@@ -2,8 +2,11 @@ package com.drmangotea.createindustry.blocks.tanks;
|
||||
|
||||
|
||||
import com.drmangotea.createindustry.base.TFMGSpriteShifts;
|
||||
import com.jozufozu.flywheel.core.materials.model.ModelData;
|
||||
import com.simibubi.create.AllSpriteShifts;
|
||||
import com.simibubi.create.api.connectivity.ConnectivityHandler;
|
||||
import com.simibubi.create.content.fluids.tank.FluidTankCTBehaviour;
|
||||
import com.simibubi.create.content.fluids.tank.FluidTankModel;
|
||||
import com.simibubi.create.foundation.block.connected.CTModel;
|
||||
import com.simibubi.create.foundation.block.connected.CTSpriteShiftEntry;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
@@ -12,16 +15,14 @@ import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.client.model.data.ModelData;
|
||||
import net.minecraft.world.level.levelgen.RandomSource;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
import net.minecraftforge.client.model.data.ModelDataMap;
|
||||
import net.minecraftforge.client.model.data.ModelProperty;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
public class SteelFluidTankModel extends CTModel {
|
||||
|
||||
@@ -38,32 +39,35 @@ public class SteelFluidTankModel extends CTModel {
|
||||
super(originalModel, new FluidTankCTBehaviour(side, top, inner));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected ModelData.Builder gatherModelData(ModelData.Builder builder, BlockAndTintGetter world, BlockPos pos, BlockState state,
|
||||
ModelData blockEntityData) {
|
||||
protected void gatherModelData(ModelDataMap.Builder builder, BlockAndTintGetter world, BlockPos pos, BlockState state,
|
||||
IModelData blockEntityData) {
|
||||
super.gatherModelData(builder, world, pos, state, blockEntityData);
|
||||
CullData cullData = new CullData();
|
||||
for (Direction d : Iterate.horizontalDirections)
|
||||
cullData.setCulled(d, ConnectivityHandler.isConnected(world, pos, pos.relative(d)));
|
||||
return builder.with(CULL_PROPERTY, cullData);
|
||||
builder.withInitial(CULL_PROPERTY, cullData);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(BlockState state, Direction side, RandomSource rand, ModelData extraData, RenderType renderType) {
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(BlockState state, Direction side, Random rand, IModelData extraData) {
|
||||
if (side != null)
|
||||
return Collections.emptyList();
|
||||
|
||||
List<BakedQuad> quads = new ArrayList<>();
|
||||
for (Direction d : Iterate.directions) {
|
||||
if (extraData.has(CULL_PROPERTY) && extraData.get(CULL_PROPERTY)
|
||||
if (extraData.hasProperty(CULL_PROPERTY) && extraData.getData(CULL_PROPERTY)
|
||||
.isCulled(d))
|
||||
continue;
|
||||
quads.addAll(super.getQuads(state, d, rand, extraData, renderType));
|
||||
quads.addAll(super.getQuads(state, d, rand, extraData));
|
||||
}
|
||||
quads.addAll(super.getQuads(state, null, rand, extraData, renderType));
|
||||
quads.addAll(super.getQuads(state, null, rand, extraData));
|
||||
return quads;
|
||||
}
|
||||
private class CullData {
|
||||
|
||||
private static class CullData {
|
||||
boolean[] culledFaces;
|
||||
|
||||
public CullData() {
|
||||
|
||||
@@ -56,7 +56,7 @@ public class SteelFluidTankRenderer extends SafeBlockEntityRenderer<SteelTankBlo
|
||||
return;
|
||||
|
||||
boolean top = fluidStack.getFluid()
|
||||
.getFluidType()
|
||||
.getAttributes()
|
||||
.isLighterThanAir();
|
||||
|
||||
float xMin = tankHullWidth;
|
||||
|
||||
@@ -19,6 +19,7 @@ import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.StringRepresentable;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
@@ -183,7 +184,8 @@ public class SteelTankBlock extends Block implements IWrenchable, IBE<SteelTankB
|
||||
Fluid fluid = fluidInTank.getFluid();
|
||||
fluidState = fluid.defaultFluidState()
|
||||
.createLegacyBlock();
|
||||
soundevent = FluidHelper.getEmptySound(fluidInTank);
|
||||
|
||||
soundevent = getEmptySound(fluidInTank);
|
||||
}
|
||||
|
||||
if (exchange == FluidExchange.TANK_TO_ITEM) {
|
||||
@@ -191,7 +193,7 @@ public class SteelTankBlock extends Block implements IWrenchable, IBE<SteelTankB
|
||||
Fluid fluid = prevFluidInTank.getFluid();
|
||||
fluidState = fluid.defaultFluidState()
|
||||
.createLegacyBlock();
|
||||
soundevent = FluidHelper.getFillSound(prevFluidInTank);
|
||||
soundevent = getFillSound(prevFluidInTank);
|
||||
}
|
||||
|
||||
if (soundevent != null && !onClient) {
|
||||
@@ -213,7 +215,7 @@ public class SteelTankBlock extends Block implements IWrenchable, IBE<SteelTankB
|
||||
float level = (float) fluidInTank.getAmount() / fluidTank.getTankCapacity(0);
|
||||
|
||||
boolean reversed = fluidInTank.getFluid()
|
||||
.getFluidType()
|
||||
.getAttributes()
|
||||
.isLighterThanAir();
|
||||
if (reversed)
|
||||
level = 1 - level;
|
||||
@@ -238,6 +240,22 @@ public class SteelTankBlock extends Block implements IWrenchable, IBE<SteelTankB
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
public static SoundEvent getFillSound(FluidStack fluid) {
|
||||
SoundEvent soundevent = fluid.getFluid().getAttributes().getFillSound();
|
||||
if (soundevent == null)
|
||||
soundevent =
|
||||
FluidHelper.isTag(fluid, FluidTags.LAVA) ? SoundEvents.BUCKET_FILL_LAVA : SoundEvents.BUCKET_FILL;
|
||||
return soundevent;
|
||||
}
|
||||
|
||||
public static SoundEvent getEmptySound(FluidStack fluid) {
|
||||
SoundEvent soundevent = fluid.getFluid().getAttributes().getEmptySound();
|
||||
if (soundevent == null)
|
||||
soundevent =
|
||||
FluidHelper.isTag(fluid, FluidTags.LAVA) ? SoundEvents.BUCKET_EMPTY_LAVA : SoundEvents.BUCKET_EMPTY;
|
||||
return soundevent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean isMoving) {
|
||||
if (state.hasBlockEntity() && (state.getBlock() != newState.getBlock() || !newState.hasBlockEntity())) {
|
||||
|
||||
@@ -34,11 +34,11 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidAttributes;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidType;
|
||||
import net.minecraftforge.fluids.IFluidTank;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction;
|
||||
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
||||
@@ -166,9 +166,9 @@ public class SteelTankBlockEntity extends FluidTankBlockEntity implements IHaveG
|
||||
if (!hasLevel())
|
||||
return;
|
||||
|
||||
FluidType attributes = newFluidStack.getFluid()
|
||||
.getFluidType();
|
||||
int luminosity = (int) (attributes.getLightLevel(newFluidStack) / 1.2f);
|
||||
FluidAttributes attributes = newFluidStack.getFluid().getAttributes();
|
||||
|
||||
int luminosity = (int) (attributes.getLuminosity(newFluidStack) / 1.2f);
|
||||
boolean reversed = attributes.isLighterThanAir();
|
||||
int maxY = (int) ((getFillState() * height) + 1);
|
||||
|
||||
@@ -471,7 +471,7 @@ public class SteelTankBlockEntity extends FluidTankBlockEntity implements IHaveG
|
||||
return false;
|
||||
|
||||
return containedFluidTooltip(tooltip, isPlayerSneaking,
|
||||
controllerTE.getCapability(ForgeCapabilities.FLUID_HANDLER));
|
||||
controllerTE.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -581,7 +581,7 @@ public class SteelTankBlockEntity extends FluidTankBlockEntity implements IHaveG
|
||||
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) {
|
||||
if (!fluidCapability.isPresent())
|
||||
refreshCapability();
|
||||
if (cap == ForgeCapabilities.FLUID_HANDLER)
|
||||
if (cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)
|
||||
return fluidCapability.cast();
|
||||
return super.getCapability(cap, side);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,8 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
||||
//import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
||||
import net.minecraftforge.client.IItemRenderProperties;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Optional;
|
||||
@@ -224,7 +225,7 @@ public class AdvancedPotatoCannonItem extends ProjectileWeaponItem implements Cu
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void initializeClient(Consumer<IClientItemExtensions> consumer) {
|
||||
public void initializeClient(Consumer<IItemRenderProperties> consumer) {
|
||||
consumer.accept(SimpleCustomRenderer.create(this, new AdvancedPotatoCannonItemRenderer()));
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.minecraft.client.renderer.block.BlockRenderDispatcher;
|
||||
import net.minecraft.client.renderer.entity.EntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||
import net.minecraft.client.renderer.entity.TntMinecartRenderer;
|
||||
import net.minecraft.client.renderer.entity.TntRenderer;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
@@ -16,11 +17,9 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class NapalmBombRenderer extends EntityRenderer<NapalmBombEntity> {
|
||||
private final BlockRenderDispatcher blockRenderer;
|
||||
public NapalmBombRenderer(EntityRendererProvider.Context p_174426_) {
|
||||
super(p_174426_);
|
||||
this.shadowRadius = 0.5F;
|
||||
this.blockRenderer = p_174426_.getBlockRenderDispatcher();
|
||||
}
|
||||
|
||||
public void render(NapalmBombEntity p_116177_, float p_116178_, float p_116179_, PoseStack p_116180_, MultiBufferSource p_116181_, int p_116182_) {
|
||||
@@ -39,7 +38,7 @@ public class NapalmBombRenderer extends EntityRenderer<NapalmBombEntity> {
|
||||
p_116180_.mulPose(Vector3f.YP.rotationDegrees(-90.0F));
|
||||
p_116180_.translate(-0.5D, -0.5D, 0.5D);
|
||||
p_116180_.mulPose(Vector3f.YP.rotationDegrees(90.0F));
|
||||
TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, TFMGBlocks.NAPALM_BOMB.get().defaultBlockState(), p_116180_, p_116181_, p_116182_, i / 5 % 2 == 0);
|
||||
TntMinecartRenderer.renderWhiteSolidBlock(TFMGBlocks.NAPALM_BOMB.get().defaultBlockState(), p_116180_, p_116181_, p_116182_, i / 5 % 2 == 0);
|
||||
p_116180_.popPose();
|
||||
super.render(p_116177_, p_116178_, p_116179_, p_116180_, p_116181_, p_116182_);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import net.minecraft.Util;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.*;
|
||||
import net.minecraft.world.level.block.*;
|
||||
@@ -16,6 +15,7 @@ import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
||||
import net.minecraft.world.level.block.state.properties.IntegerProperty;
|
||||
import net.minecraft.world.level.levelgen.RandomSource;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.Shapes;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
@@ -122,7 +122,7 @@ public class BlueFireBlock extends BaseFireBlock {
|
||||
}
|
||||
|
||||
public void tick(BlockState p_221160_, ServerLevel p_221161_, BlockPos p_221162_, RandomSource p_221163_) {
|
||||
p_221161_.scheduleTick(p_221162_, this, getFireTickDelay(p_221161_.random));
|
||||
p_221161_.scheduleTick(p_221162_, this, getFireTickDelay(p_221163_));
|
||||
if (p_221161_.getGameRules().getBoolean(GameRules.RULE_DOFIRETICK)) {
|
||||
if (!p_221160_.canSurvive(p_221161_, p_221162_)) {
|
||||
p_221161_.removeBlock(p_221162_, false);
|
||||
@@ -266,7 +266,8 @@ public class BlueFireBlock extends BaseFireBlock {
|
||||
|
||||
public void onPlace(BlockState p_53479_, Level p_53480_, BlockPos p_53481_, BlockState p_53482_, boolean p_53483_) {
|
||||
super.onPlace(p_53479_, p_53480_, p_53481_, p_53482_, p_53483_);
|
||||
p_53480_.scheduleTick(p_53481_, this, getFireTickDelay(p_53480_.random));
|
||||
// TODO: fix this
|
||||
//p_53480_.scheduleTick(p_53481_, this, getFireTickDelay(p_53480_.random));
|
||||
}
|
||||
|
||||
private static int getFireTickDelay(RandomSource p_221149_) {
|
||||
@@ -296,71 +297,71 @@ public class BlueFireBlock extends BaseFireBlock {
|
||||
fireblock.setFlammable(Blocks.JUNGLE_PLANKS, 5, 20);
|
||||
fireblock.setFlammable(Blocks.ACACIA_PLANKS, 5, 20);
|
||||
fireblock.setFlammable(Blocks.DARK_OAK_PLANKS, 5, 20);
|
||||
fireblock.setFlammable(Blocks.MANGROVE_PLANKS, 5, 20);
|
||||
// fireblock.setFlammable(Blocks.MANGROVE_PLANKS, 5, 20);
|
||||
fireblock.setFlammable(Blocks.OAK_SLAB, 5, 20);
|
||||
fireblock.setFlammable(Blocks.SPRUCE_SLAB, 5, 20);
|
||||
fireblock.setFlammable(Blocks.BIRCH_SLAB, 5, 20);
|
||||
fireblock.setFlammable(Blocks.JUNGLE_SLAB, 5, 20);
|
||||
fireblock.setFlammable(Blocks.ACACIA_SLAB, 5, 20);
|
||||
fireblock.setFlammable(Blocks.DARK_OAK_SLAB, 5, 20);
|
||||
fireblock.setFlammable(Blocks.MANGROVE_SLAB, 5, 20);
|
||||
// fireblock.setFlammable(Blocks.MANGROVE_SLAB, 5, 20);
|
||||
fireblock.setFlammable(Blocks.OAK_FENCE_GATE, 5, 20);
|
||||
fireblock.setFlammable(Blocks.SPRUCE_FENCE_GATE, 5, 20);
|
||||
fireblock.setFlammable(Blocks.BIRCH_FENCE_GATE, 5, 20);
|
||||
fireblock.setFlammable(Blocks.JUNGLE_FENCE_GATE, 5, 20);
|
||||
fireblock.setFlammable(Blocks.ACACIA_FENCE_GATE, 5, 20);
|
||||
fireblock.setFlammable(Blocks.DARK_OAK_FENCE_GATE, 5, 20);
|
||||
fireblock.setFlammable(Blocks.MANGROVE_FENCE_GATE, 5, 20);
|
||||
// fireblock.setFlammable(Blocks.MANGROVE_FENCE_GATE, 5, 20);
|
||||
fireblock.setFlammable(Blocks.OAK_FENCE, 5, 20);
|
||||
fireblock.setFlammable(Blocks.SPRUCE_FENCE, 5, 20);
|
||||
fireblock.setFlammable(Blocks.BIRCH_FENCE, 5, 20);
|
||||
fireblock.setFlammable(Blocks.JUNGLE_FENCE, 5, 20);
|
||||
fireblock.setFlammable(Blocks.ACACIA_FENCE, 5, 20);
|
||||
fireblock.setFlammable(Blocks.DARK_OAK_FENCE, 5, 20);
|
||||
fireblock.setFlammable(Blocks.MANGROVE_FENCE, 5, 20);
|
||||
// fireblock.setFlammable(Blocks.MANGROVE_FENCE, 5, 20);
|
||||
fireblock.setFlammable(Blocks.OAK_STAIRS, 5, 20);
|
||||
fireblock.setFlammable(Blocks.BIRCH_STAIRS, 5, 20);
|
||||
fireblock.setFlammable(Blocks.SPRUCE_STAIRS, 5, 20);
|
||||
fireblock.setFlammable(Blocks.JUNGLE_STAIRS, 5, 20);
|
||||
fireblock.setFlammable(Blocks.ACACIA_STAIRS, 5, 20);
|
||||
fireblock.setFlammable(Blocks.DARK_OAK_STAIRS, 5, 20);
|
||||
fireblock.setFlammable(Blocks.MANGROVE_STAIRS, 5, 20);
|
||||
// fireblock.setFlammable(Blocks.MANGROVE_STAIRS, 5, 20);
|
||||
fireblock.setFlammable(Blocks.OAK_LOG, 5, 5);
|
||||
fireblock.setFlammable(Blocks.SPRUCE_LOG, 5, 5);
|
||||
fireblock.setFlammable(Blocks.BIRCH_LOG, 5, 5);
|
||||
fireblock.setFlammable(Blocks.JUNGLE_LOG, 5, 5);
|
||||
fireblock.setFlammable(Blocks.ACACIA_LOG, 5, 5);
|
||||
fireblock.setFlammable(Blocks.DARK_OAK_LOG, 5, 5);
|
||||
fireblock.setFlammable(Blocks.MANGROVE_LOG, 5, 5);
|
||||
// fireblock.setFlammable(Blocks.MANGROVE_LOG, 5, 5);
|
||||
fireblock.setFlammable(Blocks.STRIPPED_OAK_LOG, 5, 5);
|
||||
fireblock.setFlammable(Blocks.STRIPPED_SPRUCE_LOG, 5, 5);
|
||||
fireblock.setFlammable(Blocks.STRIPPED_BIRCH_LOG, 5, 5);
|
||||
fireblock.setFlammable(Blocks.STRIPPED_JUNGLE_LOG, 5, 5);
|
||||
fireblock.setFlammable(Blocks.STRIPPED_ACACIA_LOG, 5, 5);
|
||||
fireblock.setFlammable(Blocks.STRIPPED_DARK_OAK_LOG, 5, 5);
|
||||
fireblock.setFlammable(Blocks.STRIPPED_MANGROVE_LOG, 5, 5);
|
||||
// fireblock.setFlammable(Blocks.STRIPPED_MANGROVE_LOG, 5, 5);
|
||||
fireblock.setFlammable(Blocks.STRIPPED_OAK_WOOD, 5, 5);
|
||||
fireblock.setFlammable(Blocks.STRIPPED_SPRUCE_WOOD, 5, 5);
|
||||
fireblock.setFlammable(Blocks.STRIPPED_BIRCH_WOOD, 5, 5);
|
||||
fireblock.setFlammable(Blocks.STRIPPED_JUNGLE_WOOD, 5, 5);
|
||||
fireblock.setFlammable(Blocks.STRIPPED_ACACIA_WOOD, 5, 5);
|
||||
fireblock.setFlammable(Blocks.STRIPPED_DARK_OAK_WOOD, 5, 5);
|
||||
fireblock.setFlammable(Blocks.STRIPPED_MANGROVE_WOOD, 5, 5);
|
||||
// fireblock.setFlammable(Blocks.STRIPPED_MANGROVE_WOOD, 5, 5);
|
||||
fireblock.setFlammable(Blocks.OAK_WOOD, 5, 5);
|
||||
fireblock.setFlammable(Blocks.SPRUCE_WOOD, 5, 5);
|
||||
fireblock.setFlammable(Blocks.BIRCH_WOOD, 5, 5);
|
||||
fireblock.setFlammable(Blocks.JUNGLE_WOOD, 5, 5);
|
||||
fireblock.setFlammable(Blocks.ACACIA_WOOD, 5, 5);
|
||||
fireblock.setFlammable(Blocks.DARK_OAK_WOOD, 5, 5);
|
||||
fireblock.setFlammable(Blocks.MANGROVE_WOOD, 5, 5);
|
||||
fireblock.setFlammable(Blocks.MANGROVE_ROOTS, 5, 20);
|
||||
// fireblock.setFlammable(Blocks.MANGROVE_WOOD, 5, 5);
|
||||
// fireblock.setFlammable(Blocks.MANGROVE_ROOTS, 5, 20);
|
||||
fireblock.setFlammable(Blocks.OAK_LEAVES, 30, 60);
|
||||
fireblock.setFlammable(Blocks.SPRUCE_LEAVES, 30, 60);
|
||||
fireblock.setFlammable(Blocks.BIRCH_LEAVES, 30, 60);
|
||||
fireblock.setFlammable(Blocks.JUNGLE_LEAVES, 30, 60);
|
||||
fireblock.setFlammable(Blocks.ACACIA_LEAVES, 30, 60);
|
||||
fireblock.setFlammable(Blocks.DARK_OAK_LEAVES, 30, 60);
|
||||
fireblock.setFlammable(Blocks.MANGROVE_LEAVES, 30, 60);
|
||||
// fireblock.setFlammable(Blocks.MANGROVE_LEAVES, 30, 60);
|
||||
fireblock.setFlammable(Blocks.BOOKSHELF, 30, 20);
|
||||
fireblock.setFlammable(Blocks.TNT, 15, 100);
|
||||
fireblock.setFlammable(Blocks.GRASS, 60, 100);
|
||||
|
||||
@@ -10,7 +10,8 @@ import net.minecraft.Util;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
//import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.levelgen.RandomSource;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.GameRules;
|
||||
@@ -127,7 +128,7 @@ public class GreenFireBlock extends BaseFireBlock {
|
||||
}
|
||||
|
||||
public void tick(BlockState p_221160_, ServerLevel p_221161_, BlockPos p_221162_, RandomSource p_221163_) {
|
||||
p_221161_.scheduleTick(p_221162_, this, getFireTickDelay(p_221161_.random));
|
||||
p_221161_.scheduleTick(p_221162_, this, getFireTickDelay(p_221163_));
|
||||
if (p_221161_.getGameRules().getBoolean(GameRules.RULE_DOFIRETICK)) {
|
||||
if (!p_221160_.canSurvive(p_221161_, p_221162_)) {
|
||||
p_221161_.removeBlock(p_221162_, false);
|
||||
@@ -268,7 +269,8 @@ public class GreenFireBlock extends BaseFireBlock {
|
||||
|
||||
public void onPlace(BlockState p_53479_, Level p_53480_, BlockPos p_53481_, BlockState p_53482_, boolean p_53483_) {
|
||||
super.onPlace(p_53479_, p_53480_, p_53481_, p_53482_, p_53483_);
|
||||
p_53480_.scheduleTick(p_53481_, this, getFireTickDelay(p_53480_.random));
|
||||
//TODO: Fix this
|
||||
// p_53480_.scheduleTick(p_53481_, this, getFireTickDelay(p_53480_.random));
|
||||
}
|
||||
|
||||
private static int getFireTickDelay(RandomSource p_221149_) {
|
||||
@@ -300,71 +302,71 @@ public class GreenFireBlock extends BaseFireBlock {
|
||||
fireblock.setFlammable(Blocks.JUNGLE_PLANKS, 5, 20);
|
||||
fireblock.setFlammable(Blocks.ACACIA_PLANKS, 5, 20);
|
||||
fireblock.setFlammable(Blocks.DARK_OAK_PLANKS, 5, 20);
|
||||
fireblock.setFlammable(Blocks.MANGROVE_PLANKS, 5, 20);
|
||||
// fireblock.setFlammable(Blocks.MANGROVE_PLANKS, 5, 20);
|
||||
fireblock.setFlammable(Blocks.OAK_SLAB, 5, 20);
|
||||
fireblock.setFlammable(Blocks.SPRUCE_SLAB, 5, 20);
|
||||
fireblock.setFlammable(Blocks.BIRCH_SLAB, 5, 20);
|
||||
fireblock.setFlammable(Blocks.JUNGLE_SLAB, 5, 20);
|
||||
fireblock.setFlammable(Blocks.ACACIA_SLAB, 5, 20);
|
||||
fireblock.setFlammable(Blocks.DARK_OAK_SLAB, 5, 20);
|
||||
fireblock.setFlammable(Blocks.MANGROVE_SLAB, 5, 20);
|
||||
// fireblock.setFlammable(Blocks.MANGROVE_SLAB, 5, 20);
|
||||
fireblock.setFlammable(Blocks.OAK_FENCE_GATE, 5, 20);
|
||||
fireblock.setFlammable(Blocks.SPRUCE_FENCE_GATE, 5, 20);
|
||||
fireblock.setFlammable(Blocks.BIRCH_FENCE_GATE, 5, 20);
|
||||
fireblock.setFlammable(Blocks.JUNGLE_FENCE_GATE, 5, 20);
|
||||
fireblock.setFlammable(Blocks.ACACIA_FENCE_GATE, 5, 20);
|
||||
fireblock.setFlammable(Blocks.DARK_OAK_FENCE_GATE, 5, 20);
|
||||
fireblock.setFlammable(Blocks.MANGROVE_FENCE_GATE, 5, 20);
|
||||
// fireblock.setFlammable(Blocks.MANGROVE_FENCE_GATE, 5, 20);
|
||||
fireblock.setFlammable(Blocks.OAK_FENCE, 5, 20);
|
||||
fireblock.setFlammable(Blocks.SPRUCE_FENCE, 5, 20);
|
||||
fireblock.setFlammable(Blocks.BIRCH_FENCE, 5, 20);
|
||||
fireblock.setFlammable(Blocks.JUNGLE_FENCE, 5, 20);
|
||||
fireblock.setFlammable(Blocks.ACACIA_FENCE, 5, 20);
|
||||
fireblock.setFlammable(Blocks.DARK_OAK_FENCE, 5, 20);
|
||||
fireblock.setFlammable(Blocks.MANGROVE_FENCE, 5, 20);
|
||||
// fireblock.setFlammable(Blocks.MANGROVE_FENCE, 5, 20);
|
||||
fireblock.setFlammable(Blocks.OAK_STAIRS, 5, 20);
|
||||
fireblock.setFlammable(Blocks.BIRCH_STAIRS, 5, 20);
|
||||
fireblock.setFlammable(Blocks.SPRUCE_STAIRS, 5, 20);
|
||||
fireblock.setFlammable(Blocks.JUNGLE_STAIRS, 5, 20);
|
||||
fireblock.setFlammable(Blocks.ACACIA_STAIRS, 5, 20);
|
||||
fireblock.setFlammable(Blocks.DARK_OAK_STAIRS, 5, 20);
|
||||
fireblock.setFlammable(Blocks.MANGROVE_STAIRS, 5, 20);
|
||||
// fireblock.setFlammable(Blocks.MANGROVE_STAIRS, 5, 20);
|
||||
fireblock.setFlammable(Blocks.OAK_LOG, 5, 5);
|
||||
fireblock.setFlammable(Blocks.SPRUCE_LOG, 5, 5);
|
||||
fireblock.setFlammable(Blocks.BIRCH_LOG, 5, 5);
|
||||
fireblock.setFlammable(Blocks.JUNGLE_LOG, 5, 5);
|
||||
fireblock.setFlammable(Blocks.ACACIA_LOG, 5, 5);
|
||||
fireblock.setFlammable(Blocks.DARK_OAK_LOG, 5, 5);
|
||||
fireblock.setFlammable(Blocks.MANGROVE_LOG, 5, 5);
|
||||
// fireblock.setFlammable(Blocks.MANGROVE_LOG, 5, 5);
|
||||
fireblock.setFlammable(Blocks.STRIPPED_OAK_LOG, 5, 5);
|
||||
fireblock.setFlammable(Blocks.STRIPPED_SPRUCE_LOG, 5, 5);
|
||||
fireblock.setFlammable(Blocks.STRIPPED_BIRCH_LOG, 5, 5);
|
||||
fireblock.setFlammable(Blocks.STRIPPED_JUNGLE_LOG, 5, 5);
|
||||
fireblock.setFlammable(Blocks.STRIPPED_ACACIA_LOG, 5, 5);
|
||||
fireblock.setFlammable(Blocks.STRIPPED_DARK_OAK_LOG, 5, 5);
|
||||
fireblock.setFlammable(Blocks.STRIPPED_MANGROVE_LOG, 5, 5);
|
||||
// fireblock.setFlammable(Blocks.STRIPPED_MANGROVE_LOG, 5, 5);
|
||||
fireblock.setFlammable(Blocks.STRIPPED_OAK_WOOD, 5, 5);
|
||||
fireblock.setFlammable(Blocks.STRIPPED_SPRUCE_WOOD, 5, 5);
|
||||
fireblock.setFlammable(Blocks.STRIPPED_BIRCH_WOOD, 5, 5);
|
||||
fireblock.setFlammable(Blocks.STRIPPED_JUNGLE_WOOD, 5, 5);
|
||||
fireblock.setFlammable(Blocks.STRIPPED_ACACIA_WOOD, 5, 5);
|
||||
fireblock.setFlammable(Blocks.STRIPPED_DARK_OAK_WOOD, 5, 5);
|
||||
fireblock.setFlammable(Blocks.STRIPPED_MANGROVE_WOOD, 5, 5);
|
||||
// fireblock.setFlammable(Blocks.STRIPPED_MANGROVE_WOOD, 5, 5);
|
||||
fireblock.setFlammable(Blocks.OAK_WOOD, 5, 5);
|
||||
fireblock.setFlammable(Blocks.SPRUCE_WOOD, 5, 5);
|
||||
fireblock.setFlammable(Blocks.BIRCH_WOOD, 5, 5);
|
||||
fireblock.setFlammable(Blocks.JUNGLE_WOOD, 5, 5);
|
||||
fireblock.setFlammable(Blocks.ACACIA_WOOD, 5, 5);
|
||||
fireblock.setFlammable(Blocks.DARK_OAK_WOOD, 5, 5);
|
||||
fireblock.setFlammable(Blocks.MANGROVE_WOOD, 5, 5);
|
||||
fireblock.setFlammable(Blocks.MANGROVE_ROOTS, 5, 20);
|
||||
// fireblock.setFlammable(Blocks.MANGROVE_WOOD, 5, 5);
|
||||
// fireblock.setFlammable(Blocks.MANGROVE_ROOTS, 5, 20);
|
||||
fireblock.setFlammable(Blocks.OAK_LEAVES, 30, 60);
|
||||
fireblock.setFlammable(Blocks.SPRUCE_LEAVES, 30, 60);
|
||||
fireblock.setFlammable(Blocks.BIRCH_LEAVES, 30, 60);
|
||||
fireblock.setFlammable(Blocks.JUNGLE_LEAVES, 30, 60);
|
||||
fireblock.setFlammable(Blocks.ACACIA_LEAVES, 30, 60);
|
||||
fireblock.setFlammable(Blocks.DARK_OAK_LEAVES, 30, 60);
|
||||
fireblock.setFlammable(Blocks.MANGROVE_LEAVES, 30, 60);
|
||||
// fireblock.setFlammable(Blocks.MANGROVE_LEAVES, 30, 60);
|
||||
fireblock.setFlammable(Blocks.BOOKSHELF, 30, 20);
|
||||
fireblock.setFlammable(Blocks.TNT, 15, 100);
|
||||
fireblock.setFlammable(Blocks.GRASS, 60, 100);
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -19,7 +20,7 @@ import java.util.function.Predicate;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class FlamethrowerFuelType {
|
||||
private List<Supplier<Fluid>> fluids = new ArrayList<>();
|
||||
private List<Optional<Holder<Fluid>>> fluids = new ArrayList<Optional<Holder<Fluid>>>();
|
||||
private int spread = 15;
|
||||
private float speed = 1;
|
||||
private int amount = 4;
|
||||
@@ -30,7 +31,7 @@ public class FlamethrowerFuelType {
|
||||
public FlamethrowerFuelType() {
|
||||
}
|
||||
|
||||
public List<Supplier<Fluid>> getFluids() {
|
||||
public List<Optional<Holder<Fluid>>> getFluids() {
|
||||
return fluids;
|
||||
}
|
||||
|
||||
@@ -68,9 +69,10 @@ public class FlamethrowerFuelType {
|
||||
JsonPrimitive primitive = element.getAsJsonPrimitive();
|
||||
if (primitive.isString()) {
|
||||
try {
|
||||
Optional<Holder.Reference<Fluid>> reference = ForgeRegistries.FLUIDS.getDelegate(new ResourceLocation(primitive.getAsString()));
|
||||
//TODO: check if this even works
|
||||
@NotNull Optional<Holder<Fluid>> reference = ForgeRegistries.FLUIDS.getHolder(new ResourceLocation(primitive.getAsString()));
|
||||
if (reference.isPresent()) {
|
||||
type.fluids.add(reference.get());
|
||||
type.fluids.add(Optional.of(reference.get()));
|
||||
}
|
||||
} catch (ResourceLocationException e) {
|
||||
//
|
||||
@@ -104,8 +106,8 @@ public class FlamethrowerFuelType {
|
||||
|
||||
public static void toBuffer(FlamethrowerFuelType type, FriendlyByteBuf buffer) {
|
||||
buffer.writeVarInt(type.fluids.size());
|
||||
for (Supplier<Fluid> delegate : type.fluids) {
|
||||
buffer.writeResourceLocation(RegisteredObjects.getKeyOrThrow(delegate.get()));
|
||||
for (Optional<Holder<Fluid>> delegate : type.fluids) {
|
||||
buffer.writeResourceLocation(RegisteredObjects.getKeyOrThrow(delegate.get().value()));
|
||||
}
|
||||
buffer.writeInt(type.spread);
|
||||
buffer.writeFloat(type.speed);
|
||||
@@ -119,9 +121,9 @@ public class FlamethrowerFuelType {
|
||||
FlamethrowerFuelType type = new FlamethrowerFuelType();
|
||||
int size = buffer.readVarInt();
|
||||
for (int i = 0; i < size; i++) {
|
||||
Optional<Holder.Reference<Fluid>> reference = ForgeRegistries.FLUIDS.getDelegate(buffer.readResourceLocation());
|
||||
@NotNull Optional<Holder<Fluid>> reference = ForgeRegistries.FLUIDS.getHolder(buffer.readResourceLocation());
|
||||
if (reference.isPresent()) {
|
||||
type.fluids.add(reference.get());
|
||||
type.fluids.add(reference);
|
||||
}
|
||||
}
|
||||
type.spread = buffer.readInt();
|
||||
@@ -178,7 +180,7 @@ public class FlamethrowerFuelType {
|
||||
@SafeVarargs
|
||||
public final Builder addFluids(Supplier<Fluid>... fluids) {
|
||||
for (Supplier<Fluid> fluid : fluids)
|
||||
result.fluids.add(ForgeRegistries.FLUIDS.getDelegateOrThrow(fluid.get()));
|
||||
result.fluids.add(ForgeRegistries.FLUIDS.getHolder(fluid.get()));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.simibubi.create.AllPackets;
|
||||
import com.simibubi.create.foundation.networking.SimplePacketBase;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
@@ -88,14 +89,19 @@ public class FlamethrowerFuelTypeManager {
|
||||
public static void fillFluidMap() {
|
||||
for (Map.Entry<ResourceLocation, FlamethrowerFuelType> entry : BUILTIN_TYPE_MAP.entrySet()) {
|
||||
FlamethrowerFuelType type = entry.getValue();
|
||||
for (Supplier<Fluid> delegate : type.getFluids()) {
|
||||
FLUID_TO_TYPE_MAP.put(delegate.get(), type);
|
||||
// for (Supplier<Fluid> delegate : type.getFluids()) {
|
||||
// FLUID_TO_TYPE_MAP.put(delegate.get(), type);
|
||||
// }
|
||||
// TODO: fix this? I have no idea what im doing here
|
||||
for (Optional<Holder<Fluid>> delegate : type.getFluids()) {
|
||||
FLUID_TO_TYPE_MAP.put(delegate.get().value(), type);
|
||||
}
|
||||
}
|
||||
for (Map.Entry<ResourceLocation, FlamethrowerFuelType> entry : CUSTOM_TYPE_MAP.entrySet()) {
|
||||
FlamethrowerFuelType type = entry.getValue();
|
||||
for (Supplier<Fluid> delegate : type.getFluids()) {
|
||||
FLUID_TO_TYPE_MAP.put(delegate.get(), type);
|
||||
// TODO: this one too
|
||||
for (Optional<Holder<Fluid>> delegate : type.getFluids()) {
|
||||
FLUID_TO_TYPE_MAP.put(delegate.get().value(), type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,7 +170,8 @@ return Math.round( 13* ((float)((float)stack.getOrCreateTag().getInt("amount")/(
|
||||
//nbt.putInt("amount", nbt.getInt("amount") + toDrain);
|
||||
//context.getPlayer().getCooldowns().addCooldown(stack.getItem(), 20);
|
||||
for (FlamethrowerFuelType fuelBuiltin : FlamethrowerFuelTypeManager.GLOBAL_TYPE_MAP.values()) {
|
||||
if (fuelBuiltin.getFluids().stream().anyMatch(supplier -> supplier.get().isSame(be.getFluid(0).getFluid()))) {
|
||||
// TODO: check if this works
|
||||
if (fuelBuiltin.getFluids().stream().anyMatch(supplier -> supplier.get().value().isSame(be.getFluid(0).getFluid()))) {
|
||||
int toDrain = Math.min(FUEL_CAPACITY - nbt.getInt("amount"), be.getFluid(0).getAmount());
|
||||
nbt.putString("fuel", FlamethrowerFuelTypeManager.getIdForType(fuelBuiltin).toString());
|
||||
be.getTankInventory().drain(toDrain, IFluidHandler.FluidAction.EXECUTE);
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.drmangotea.createindustry.registry.TFMGItems;
|
||||
import com.drmangotea.createindustry.registry.TFMGMobEffects;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
@@ -130,9 +131,10 @@ public class LitLithiumBladeItem extends SwordItem {
|
||||
ItemStack stack1 = new ItemStack(TFMGItems.LITHIUM_BLADE.get(),1,stack.getOrCreateTag());
|
||||
|
||||
|
||||
Map<Enchantment, Integer> enchantments = stack.getAllEnchantments();
|
||||
|
||||
enchantments.forEach(stack1::enchant);
|
||||
// Map<Enchantment, Integer> enchantments = stack.getAllEnchantments();
|
||||
ListTag enchantments = stack.getEnchantmentTags();
|
||||
// TODO: reimplement this
|
||||
// enchantments.forEach(stack1::enchant);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -31,10 +31,10 @@ public class LithiumBladeItem extends SwordItem {
|
||||
|
||||
ItemStack stack1 = new ItemStack(TFMGItems.LIT_LITHIUM_BLADE.get(), 1, stack.getOrCreateTag());
|
||||
|
||||
//TODO: reimplement this too
|
||||
//Map<Enchantment, Integer> enchantments = stack.getAllEnchantments();
|
||||
|
||||
Map<Enchantment, Integer> enchantments = stack.getAllEnchantments();
|
||||
|
||||
enchantments.forEach(stack1::enchant);
|
||||
//enchantments.forEach(stack1::enchant);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ public class LithiumSpark extends ThrowableProjectile {
|
||||
|
||||
|
||||
public void burst(double pX, double pY, double pZ, float pVelocity, float pInaccuracy) {
|
||||
Vec3 vec3 = (new Vec3(pX, pY, pZ)).normalize().add(this.random.triangle(0.0D, 0.0172275D * (double)pInaccuracy), 0, this.random.triangle(0.0D, 0.0172275D * (double)pInaccuracy)).scale((double)pVelocity);
|
||||
Vec3 vec3 = (new Vec3(pX, pY, pZ)).normalize().add(this.random.nextGaussian(0.0D, 0.0172275D * (double)pInaccuracy), 0, this.random.nextGaussian(0.0D, 0.0172275D * (double)pInaccuracy)).scale((double)pVelocity);
|
||||
this.setDeltaMovement(vec3);
|
||||
double d0 = vec3.horizontalDistance();
|
||||
this.setYRot((float)(Mth.atan2(vec3.x, vec3.z) * (double)(180F / (float)Math.PI)));
|
||||
|
||||
@@ -17,27 +17,34 @@ 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.common.world.BiomeModifier;
|
||||
//import net.minecraftforge.data.event.GatherDataEvent;
|
||||
import net.minecraftforge.event.world.BiomeLoadingEvent;
|
||||
import net.minecraftforge.forge.event.lifecycle.GatherDataEvent;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
/**
|
||||
* really goofy way to do worldgen but it works
|
||||
*/
|
||||
@Mixin(AllOreFeatureConfigEntries.class)
|
||||
public class AllOreFeatureConfigEntriesMixin {
|
||||
|
||||
|
||||
|
||||
|
||||
@Shadow @Final private static Predicate<BiomeLoadingEvent> NETHER_BIOMES;
|
||||
@Shadow @Final private static Predicate<BiomeLoadingEvent> OVERWORLD_BIOMES;
|
||||
@Shadow
|
||||
public static final OreFeatureConfigEntry STRIATED_ORES_OVERWORLD =
|
||||
create("striated_ores_overworld", 32, 1 / 18f, -30, 70)
|
||||
.biomeExt()
|
||||
.predicate(OVERWORLD_BIOMES)
|
||||
.parent()
|
||||
.layeredDatagenExt()
|
||||
.withLayerPattern(TFMGLayeredPatterns.BAUXITE)
|
||||
.withLayerPattern(TFMGLayeredPatterns.LIGNITE)
|
||||
@@ -49,16 +56,20 @@ public class AllOreFeatureConfigEntriesMixin {
|
||||
.withLayerPattern(AllLayerPatterns.MALACHITE)
|
||||
.withLayerPattern(AllLayerPatterns.LIMESTONE)
|
||||
.withLayerPattern(AllLayerPatterns.OCHRESTONE)
|
||||
.biomeTag(BiomeTags.IS_OVERWORLD)
|
||||
|
||||
//.biomeTag(BiomeTags.IS_OVERWORLD)
|
||||
.parent();
|
||||
@Shadow
|
||||
public static final OreFeatureConfigEntry STRIATED_ORES_NETHER =
|
||||
create("striated_ores_nether", 32, 1 / 18f, 40, 90)
|
||||
.biomeExt()
|
||||
.predicate(NETHER_BIOMES)
|
||||
.parent()
|
||||
.layeredDatagenExt()
|
||||
.withLayerPattern(TFMGLayeredPatterns.SULFUR)
|
||||
.withLayerPattern(AllLayerPatterns.SCORIA_NETHER)
|
||||
.withLayerPattern(AllLayerPatterns.SCORCHIA_NETHER)
|
||||
.biomeTag(BiomeTags.IS_NETHER)
|
||||
// .biomeTag(BiomeTags.IS_NETHER)
|
||||
.parent();
|
||||
|
||||
//
|
||||
@@ -99,7 +110,7 @@ public class AllOreFeatureConfigEntriesMixin {
|
||||
|
||||
DynamicDataProvider<ConfiguredFeature<?, ?>> configuredFeatureProvider = DynamicDataProvider.create(generator, "Create's Configured Features", registryAccess, Registry.CONFIGURED_FEATURE_REGISTRY, configuredFeatures);
|
||||
if (configuredFeatureProvider != null) {
|
||||
generator.addProvider(true, configuredFeatureProvider);
|
||||
generator.addProvider( configuredFeatureProvider);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -114,23 +125,23 @@ public class AllOreFeatureConfigEntriesMixin {
|
||||
|
||||
DynamicDataProvider<PlacedFeature> placedFeatureProvider = DynamicDataProvider.create(generator, "Create's Placed Features", registryAccess, Registry.PLACED_FEATURE_REGISTRY, placedFeatures);
|
||||
if (placedFeatureProvider != null) {
|
||||
generator.addProvider(true, placedFeatureProvider);
|
||||
generator.addProvider(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);
|
||||
}
|
||||
//TODO: re-add this?
|
||||
// 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);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.network.protocol.game.DebugPackets;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
//import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
@@ -39,6 +39,7 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition.Builder;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.levelgen.RandomSource;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
import net.minecraft.world.level.pathfinder.PathComputationType;
|
||||
@@ -170,10 +171,10 @@ public class FluidPipeBlockMixin extends PipeBlock implements SimpleWaterloggedB
|
||||
world.scheduleTick(pos, this, 1, TickPriority.HIGH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource r) {
|
||||
FluidPropagator.propagateChangedPipe(world, pos, state);
|
||||
}
|
||||
// @Override
|
||||
// public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource r) {
|
||||
// FluidPropagator.propagateChangedPipe(world, pos, state);
|
||||
// }
|
||||
@Shadow
|
||||
public static boolean isPipe(BlockState state) {
|
||||
return state.getBlock() instanceof FluidPipeBlockMixin;
|
||||
|
||||
@@ -6,8 +6,10 @@ import java.util.List;
|
||||
|
||||
import com.drmangotea.createindustry.base.TFMGPipeModelData;
|
||||
import com.drmangotea.createindustry.blocks.pipes.normal.plastic.PlasticPipeAttachmentModel;
|
||||
import com.jozufozu.flywheel.core.materials.model.ModelData;
|
||||
import com.simibubi.create.content.fluids.FluidTransportBehaviour;
|
||||
import com.simibubi.create.content.fluids.PipeAttachmentModel;
|
||||
import net.minecraft.world.level.levelgen.RandomSource;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.simibubi.create.AllPartialModels;
|
||||
@@ -26,106 +28,109 @@ import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.client.ChunkRenderTypeSet;
|
||||
import net.minecraftforge.client.model.data.ModelData;
|
||||
import net.minecraftforge.client.model.data.ModelData.Builder;
|
||||
//import net.minecraftforge.client.ChunkRenderTypeSet;
|
||||
//import net.minecraftforge.client.model.data.ModelData;
|
||||
//import net.minecraftforge.client.model.data.ModelData.Builder;
|
||||
import net.minecraftforge.client.model.data.ModelProperty;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
import static net.minecraft.world.level.block.PipeBlock.PROPERTY_BY_DIRECTION;
|
||||
@Mixin(PipeAttachmentModel.class)
|
||||
public class PipeAttachmentModelMixin extends BakedModelWrapperWithData {
|
||||
|
||||
private static final ModelProperty<TFMGPipeModelData> PIPE_PROPERTY = new ModelProperty<>();
|
||||
|
||||
public PipeAttachmentModelMixin(BakedModel template) {
|
||||
super(template);
|
||||
}
|
||||
|
||||
/**
|
||||
* @author DrMangoTea
|
||||
* @reason locked pipes
|
||||
*/
|
||||
@Overwrite( remap = false)
|
||||
protected ModelData.Builder gatherModelData(ModelData.Builder builder, BlockAndTintGetter world, BlockPos pos, BlockState state,
|
||||
ModelData blockEntityData) {
|
||||
TFMGPipeModelData data = new TFMGPipeModelData();
|
||||
FluidTransportBehaviour transport = BlockEntityBehaviour.get(world, pos, FluidTransportBehaviour.TYPE);
|
||||
BracketedBlockEntityBehaviour bracket = BlockEntityBehaviour.get(world, pos, BracketedBlockEntityBehaviour.TYPE);
|
||||
|
||||
if (transport != null)
|
||||
for (Direction d : Iterate.directions) {
|
||||
boolean shouldConnect = true;
|
||||
if(world.getBlockState(pos.relative(d)).getBlock() instanceof FluidPipeBlock) {
|
||||
|
||||
if(d.getAxis().isHorizontal())
|
||||
shouldConnect = world.getBlockState(pos.relative(d)).getValue(PROPERTY_BY_DIRECTION.get(d.getOpposite()));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
data.putAttachment(d, transport.getRenderedRimAttachment(world, pos, state, d));
|
||||
|
||||
if(!shouldConnect)
|
||||
if(state.getBlock() instanceof FluidPipeBlock)
|
||||
if(state.getValue(PROPERTY_BY_DIRECTION.get(d)))
|
||||
data.putAttachment(d, FluidTransportBehaviour.AttachmentTypes.RIM);
|
||||
|
||||
}
|
||||
if (bracket != null)
|
||||
data.putBracket(bracket.getBracket());
|
||||
|
||||
data.setEncased(FluidPipeBlock.shouldDrawCasing(world, pos, state));
|
||||
return builder.with(PIPE_PROPERTY, data);
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
@Override
|
||||
public ChunkRenderTypeSet getRenderTypes(@NotNull BlockState state, @NotNull RandomSource rand, @NotNull ModelData data) {
|
||||
ChunkRenderTypeSet set = super.getRenderTypes(state, rand, data);
|
||||
if (set.isEmpty()) {
|
||||
return ItemBlockRenderTypes.getRenderLayers(state);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(BlockState state, Direction side, RandomSource rand, ModelData data, RenderType renderType) {
|
||||
List<BakedQuad> quads = super.getQuads(state, side, rand, data, renderType);
|
||||
if (data.has(PIPE_PROPERTY)) {
|
||||
TFMGPipeModelData pipeData = data.get(PIPE_PROPERTY);
|
||||
quads = new ArrayList<>(quads);
|
||||
addQuads(quads, state, side, rand, data, pipeData, renderType);
|
||||
}
|
||||
return quads;
|
||||
}
|
||||
|
||||
private void addQuads(List<BakedQuad> quads, BlockState state, Direction side, RandomSource rand, ModelData data,
|
||||
TFMGPipeModelData pipeData, RenderType renderType) {
|
||||
BakedModel bracket = pipeData.getBracket();
|
||||
if (bracket != null)
|
||||
quads.addAll(bracket.getQuads(state, side, rand, data, renderType));
|
||||
for (Direction d : Iterate.directions) {
|
||||
AttachmentTypes type = pipeData.getAttachment(d);
|
||||
for (ComponentPartials partial : type.partials) {
|
||||
quads.addAll(AllPartialModels.PIPE_ATTACHMENTS.get(partial)
|
||||
.get(d)
|
||||
.get()
|
||||
.getQuads(state, side, rand, data, renderType));
|
||||
}
|
||||
}
|
||||
if (pipeData.isEncased())
|
||||
quads.addAll(AllPartialModels.FLUID_PIPE_CASING.get()
|
||||
.getQuads(state, side, rand, data, renderType));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// TODO: re-implement this
|
||||
public class PipeAttachmentModelMixin {
|
||||
}
|
||||
//@Mixin(PipeAttachmentModel.class)
|
||||
//public class PipeAttachmentModelMixin extends BakedModelWrapperWithData {
|
||||
//
|
||||
// private static final ModelProperty<TFMGPipeModelData> PIPE_PROPERTY = new ModelProperty<>();
|
||||
//
|
||||
// public PipeAttachmentModelMixin(BakedModel template) {
|
||||
// super(template);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @author DrMangoTea
|
||||
// * @reason locked pipes
|
||||
// */
|
||||
// @Overwrite( remap = false)
|
||||
// protected ModelData.Builder gatherModelData(ModelData.Builder builder, BlockAndTintGetter world, BlockPos pos, BlockState state,
|
||||
// ModelData blockEntityData) {
|
||||
// TFMGPipeModelData data = new TFMGPipeModelData();
|
||||
// FluidTransportBehaviour transport = BlockEntityBehaviour.get(world, pos, FluidTransportBehaviour.TYPE);
|
||||
// BracketedBlockEntityBehaviour bracket = BlockEntityBehaviour.get(world, pos, BracketedBlockEntityBehaviour.TYPE);
|
||||
//
|
||||
// if (transport != null)
|
||||
// for (Direction d : Iterate.directions) {
|
||||
// boolean shouldConnect = true;
|
||||
// if(world.getBlockState(pos.relative(d)).getBlock() instanceof FluidPipeBlock) {
|
||||
//
|
||||
// if(d.getAxis().isHorizontal())
|
||||
// shouldConnect = world.getBlockState(pos.relative(d)).getValue(PROPERTY_BY_DIRECTION.get(d.getOpposite()));
|
||||
//
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
// data.putAttachment(d, transport.getRenderedRimAttachment(world, pos, state, d));
|
||||
//
|
||||
// if(!shouldConnect)
|
||||
// if(state.getBlock() instanceof FluidPipeBlock)
|
||||
// if(state.getValue(PROPERTY_BY_DIRECTION.get(d)))
|
||||
// data.putAttachment(d, FluidTransportBehaviour.AttachmentTypes.RIM);
|
||||
//
|
||||
// }
|
||||
// if (bracket != null)
|
||||
// data.putBracket(bracket.getBracket());
|
||||
//
|
||||
// data.setEncased(FluidPipeBlock.shouldDrawCasing(world, pos, state));
|
||||
// return builder.with(PIPE_PROPERTY, data);
|
||||
// }
|
||||
//
|
||||
// @SuppressWarnings("removal")
|
||||
// @Override
|
||||
// public ChunkRenderTypeSet getRenderTypes(@NotNull BlockState state, @NotNull RandomSource rand, @NotNull ModelData data) {
|
||||
// ChunkRenderTypeSet set = super.getRenderTypes(state, rand, data);
|
||||
// if (set.isEmpty()) {
|
||||
// return ItemBlockRenderTypes.getRenderLayers(state);
|
||||
// }
|
||||
// return set;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<BakedQuad> getQuads(BlockState state, Direction side, RandomSource rand, ModelData data, RenderType renderType) {
|
||||
// List<BakedQuad> quads = super.getQuads(state, side, rand, data, renderType);
|
||||
// if (data.has(PIPE_PROPERTY)) {
|
||||
// TFMGPipeModelData pipeData = data.get(PIPE_PROPERTY);
|
||||
// quads = new ArrayList<>(quads);
|
||||
// addQuads(quads, state, side, rand, data, pipeData, renderType);
|
||||
// }
|
||||
// return quads;
|
||||
// }
|
||||
//
|
||||
// private void addQuads(List<BakedQuad> quads, BlockState state, Direction side, RandomSource rand, ModelData data,
|
||||
// TFMGPipeModelData pipeData, RenderType renderType) {
|
||||
// BakedModel bracket = pipeData.getBracket();
|
||||
// if (bracket != null)
|
||||
// quads.addAll(bracket.getQuads(state, side, rand, data, renderType));
|
||||
// for (Direction d : Iterate.directions) {
|
||||
// AttachmentTypes type = pipeData.getAttachment(d);
|
||||
// for (ComponentPartials partial : type.partials) {
|
||||
// quads.addAll(AllPartialModels.PIPE_ATTACHMENTS.get(partial)
|
||||
// .get(d)
|
||||
// .get()
|
||||
// .getQuads(state, side, rand, data, renderType));
|
||||
// }
|
||||
// }
|
||||
// if (pipeData.isEncased())
|
||||
// quads.addAll(AllPartialModels.FLUID_PIPE_CASING.get()
|
||||
// .getQuads(state, side, rand, data, renderType));
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//}
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import static net.minecraft.client.renderer.ScreenEffectRenderer.renderFluid;
|
||||
//import static net.minecraft.client.renderer.ScreenEffectRenderer.renderFluid;
|
||||
|
||||
@Mixin(ScreenEffectRenderer.class)
|
||||
public class ScreenEffectRendererMixin {
|
||||
@@ -35,9 +35,10 @@ public class ScreenEffectRendererMixin {
|
||||
|
||||
}
|
||||
private static void renderMoltenMetal(Minecraft p_110726_, PoseStack p_110727_) {
|
||||
|
||||
for(int i = 0 ; i<10; i++)
|
||||
renderFluid(p_110726_, p_110727_, MOLTEN_METAL_OVERLAY);
|
||||
//TODO: re-add this
|
||||
//
|
||||
// for(int i = 0 ; i<10; i++)
|
||||
// renderFluid(p_110726_, p_110727_, MOLTEN_METAL_OVERLAY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public class TFMGPonderTag extends PonderTag {
|
||||
|
||||
public static final PonderTag OIL = create("oil")
|
||||
.defaultLang("Oil Related Machines", "Machines used to get, refine and use oil")
|
||||
.item(TFMGFluids.CRUDE_OIL.getBucket().get(), true, false).addToIndex();
|
||||
.item(TFMGFluids.CRUDE_OIL.get().getBucket(), true, false).addToIndex();
|
||||
|
||||
public static final PonderTag METALLURGY = create("metallurgy")
|
||||
.defaultLang("Metal processing", "Machines related to metal")
|
||||
|
||||
@@ -51,7 +51,7 @@ public class AdvancedDistillationCategory extends CreateRecipeCategory<Distillat
|
||||
.addSlot(RecipeIngredientRole.OUTPUT, 105, y)
|
||||
.setBackground(getRenderedSlot(), -1, -1)
|
||||
.addIngredient(ForgeTypes.FLUID_STACK, withImprovedVisibility(recipe.getFluidResults().get(i)))
|
||||
.addTooltipCallback(addFluidTooltip(recipe.getFirstFluidResult().getAmount()));
|
||||
.addTooltipCallback(addFluidTooltip(recipe.getFluidResults().get(i).getAmount()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ public class TFMGJei implements IModPlugin {
|
||||
gas_blasting = builder(GasBlastingRecipe.class)
|
||||
.addTypedRecipes(TFMGRecipeTypes.GAS_BLASTING)
|
||||
.catalyst(TFMGBlocks.BLAST_STOVE::get)
|
||||
.doubleItemIcon(TFMGBlocks.BLAST_STOVE.get(), TFMGFluids.AIR.getBucket().get())
|
||||
.doubleItemIcon(TFMGBlocks.BLAST_STOVE.get(), TFMGFluids.AIR.get().getBucket())
|
||||
.emptyBackground(177, 150)
|
||||
.build("gas_blasting", GasBlastingCategory::new),
|
||||
|
||||
|
||||
@@ -583,7 +583,8 @@ public class TFMGBlocks {
|
||||
public static final BlockEntry<CopycatCableBlock> COPYCAT_CABLE_BLOCK =
|
||||
REGISTRATE.block("copycat_cable_block", CopycatCableBlock::new)
|
||||
.transform(TFMGBuilderTransformers.copycatCable())
|
||||
.onRegister(CreateRegistrate.blockModel(() -> CopycatCableBlockModel::new))
|
||||
//TODO: reimplement this
|
||||
//.onRegister(CreateRegistrate.blockModel(() -> CopycatCableBlockModel::new))
|
||||
.item()
|
||||
.transform(customItemModel())
|
||||
.register();
|
||||
@@ -1177,7 +1178,7 @@ public class TFMGBlocks {
|
||||
.properties(p -> p.color(MaterialColor.COLOR_ORANGE))
|
||||
.properties(p -> p.lightLevel(s -> 15))
|
||||
.properties(p -> p.noOcclusion()
|
||||
.noLootTable()
|
||||
.noDrops()
|
||||
.air())
|
||||
|
||||
.register();
|
||||
|
||||
@@ -6,12 +6,10 @@ package com.drmangotea.createindustry.registry;
|
||||
import com.drmangotea.createindustry.CreateTFMG;
|
||||
import com.drmangotea.createindustry.base.util.TFMGUtils;
|
||||
import com.drmangotea.createindustry.blocks.concrete.ConcreteFluid;
|
||||
import com.drmangotea.createindustry.blocks.concrete.ConcreteFluidType;
|
||||
import com.drmangotea.createindustry.blocks.concrete.asphalt.AsphaltFluid;
|
||||
import com.drmangotea.createindustry.blocks.fluids.*;
|
||||
//import com.drmangotea.createindustry.blocks.fluids.*;
|
||||
import com.simibubi.create.AllTags;
|
||||
|
||||
import com.simibubi.create.content.decoration.palettes.AllPaletteStoneTypes;
|
||||
import com.simibubi.create.content.fluids.VirtualFluid;
|
||||
import com.tterrag.registrate.util.entry.FluidEntry;
|
||||
|
||||
@@ -19,8 +17,6 @@ import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraftforge.common.ForgeMod;
|
||||
import net.minecraftforge.fluids.FluidInteractionRegistry;
|
||||
import net.minecraftforge.fluids.ForgeFlowingFluid;
|
||||
|
||||
import static com.drmangotea.createindustry.CreateTFMG.REGISTRATE;
|
||||
@@ -81,17 +77,15 @@ public class TFMGFluids {
|
||||
|
||||
|
||||
public static final FluidEntry<ForgeFlowingFluid.Flowing> COOLING_FLUID =
|
||||
REGISTRATE.fluid("cooling_fluid",COOLING_FLUID_STILL_RL,COOLING_FLUID_FLOW_RL,
|
||||
ConcreteFluidType.create(0x333333,
|
||||
() -> 1f / 24f ))
|
||||
REGISTRATE.fluid("cooling_fluid",COOLING_FLUID_STILL_RL,COOLING_FLUID_FLOW_RL)
|
||||
.lang("Cooling Fluid")
|
||||
.properties(b -> b.viscosity(1000)
|
||||
.density(1000))
|
||||
.fluidProperties(p -> p.levelDecreasePerBlock(1)
|
||||
.attributes(b -> b.viscosity(1000).density(1000))
|
||||
.properties(p -> p.levelDecreasePerBlock(1)
|
||||
.tickRate(10)
|
||||
.slopeFindDistance(5)
|
||||
.explosionResistance(100f))
|
||||
|
||||
|
||||
.source(ForgeFlowingFluid.Source::new)
|
||||
.bucket()
|
||||
// .tag(AllTags.forgeItemTag("buckets/napalm"))
|
||||
@@ -102,13 +96,10 @@ public class TFMGFluids {
|
||||
|
||||
|
||||
public static final FluidEntry<ForgeFlowingFluid.Flowing> SULFURIC_ACID =
|
||||
REGISTRATE.fluid("sulfuric_acid",SULFURIC_AXID_STILL_RL,SULFURIC_AXID_FLOW_RL,
|
||||
AcidFluidType.create(0x333333,
|
||||
() -> 1f / 24f ))
|
||||
REGISTRATE.fluid("sulfuric_acid",SULFURIC_AXID_STILL_RL,SULFURIC_AXID_FLOW_RL)
|
||||
.lang("Sulfuric Acid")
|
||||
.properties(b -> b.viscosity(1000)
|
||||
.density(1000))
|
||||
.fluidProperties(p -> p.levelDecreasePerBlock(1)
|
||||
.attributes(b -> b.viscosity(1000).density(1000))
|
||||
.properties(p -> p.levelDecreasePerBlock(1)
|
||||
.tickRate(10)
|
||||
.slopeFindDistance(5)
|
||||
.explosionResistance(100f))
|
||||
@@ -126,17 +117,13 @@ public class TFMGFluids {
|
||||
|
||||
|
||||
public static final FluidEntry<ForgeFlowingFluid.Flowing> LIQUID_CONCRETE =
|
||||
REGISTRATE.fluid("liquid_concrete",CONCRETE_RL,CONCRETE_RL,
|
||||
ConcreteFluidType.create(0x333333,
|
||||
() -> 1f / 24f ))
|
||||
REGISTRATE.fluid("liquid_concrete",CONCRETE_RL,CONCRETE_RL)
|
||||
.lang("Liquid Concrete")
|
||||
.properties(b -> b.viscosity(9999)
|
||||
.density(9999))
|
||||
.fluidProperties(p -> p.levelDecreasePerBlock(0)
|
||||
.attributes(b -> b.viscosity(9999).density(9999))
|
||||
.properties(p -> p.levelDecreasePerBlock(0)
|
||||
.tickRate(99999)
|
||||
.slopeFindDistance(0)
|
||||
.explosionResistance(4f)
|
||||
)
|
||||
.explosionResistance(4f))
|
||||
.source(ConcreteFluid.Source::new)
|
||||
.bucket()
|
||||
//.tag(AllTags.forgeItemTag("buckets/napalm"))
|
||||
@@ -144,17 +131,14 @@ public class TFMGFluids {
|
||||
.register();
|
||||
|
||||
public static final FluidEntry<ForgeFlowingFluid.Flowing> LIQUID_ASPHALT =
|
||||
REGISTRATE.fluid("liquid_asphalt", ASPHALT_RL, ASPHALT_RL,
|
||||
ConcreteFluidType.create(0x333333,
|
||||
() -> 1f / 24f ))
|
||||
REGISTRATE.fluid("liquid_asphalt", ASPHALT_RL, ASPHALT_RL)
|
||||
.lang("Liquid Asphalt")
|
||||
.properties(b -> b.viscosity(9999)
|
||||
.density(9999))
|
||||
.fluidProperties(p -> p.levelDecreasePerBlock(0)
|
||||
.attributes(b -> b.viscosity(9999).density(9999))
|
||||
.properties(p -> p.levelDecreasePerBlock(0)
|
||||
.tickRate(99999)
|
||||
.slopeFindDistance(0)
|
||||
.explosionResistance(4f)
|
||||
)
|
||||
.explosionResistance(4f))
|
||||
|
||||
.source(AsphaltFluid.Source::new)
|
||||
.bucket()
|
||||
//.tag(AllTags.forgeItemTag("buckets/napalm"))
|
||||
@@ -164,13 +148,10 @@ public class TFMGFluids {
|
||||
|
||||
|
||||
public static final FluidEntry<ForgeFlowingFluid.Flowing> LIQUID_PLASTIC =
|
||||
REGISTRATE.fluid("liquid_plastic",PLASTIC_STILL_RL,PLASTIC_FLOW_RL
|
||||
, PlasticFluidType.create(0xc4c4c4,
|
||||
() -> 1f / 24f ))
|
||||
REGISTRATE.fluid("liquid_plastic",PLASTIC_STILL_RL,PLASTIC_FLOW_RL)
|
||||
.lang("Liquid Plastic")
|
||||
.properties(b -> b.viscosity(1500)
|
||||
.density(1000))
|
||||
.fluidProperties(p -> p.levelDecreasePerBlock(1)
|
||||
.attributes(b -> b.viscosity(1500).density(1000))
|
||||
.properties(p -> p.levelDecreasePerBlock(1)
|
||||
.tickRate(10)
|
||||
.slopeFindDistance(2)
|
||||
.explosionResistance(100f))
|
||||
@@ -182,15 +163,14 @@ public class TFMGFluids {
|
||||
.register();
|
||||
|
||||
public static final FluidEntry<ForgeFlowingFluid.Flowing> MOLTEN_STEEL =
|
||||
REGISTRATE.fluid("molten_steel",MOLTEN_STEEL_STILL_RL,MOLTEN_STEEL_FLOW_RL,
|
||||
HotFluidType.create(0xfbfbbb, () -> 1f / 24f ))
|
||||
REGISTRATE.fluid("molten_steel",MOLTEN_STEEL_STILL_RL,MOLTEN_STEEL_FLOW_RL)
|
||||
.lang("Molten Steel")
|
||||
.properties(b -> b.viscosity(1500)
|
||||
.density(1000))
|
||||
.fluidProperties(p -> p.levelDecreasePerBlock(1)
|
||||
.attributes(b -> b.viscosity(1500).density(1000))
|
||||
.properties(p -> p.levelDecreasePerBlock(1)
|
||||
.tickRate(10)
|
||||
.slopeFindDistance(2)
|
||||
.explosionResistance(100f))
|
||||
|
||||
.tag(TFMGTags.TFMGFluidTags.MOLTEN_STEEL.tag)
|
||||
.source(ForgeFlowingFluid.Source::new)
|
||||
.bucket()
|
||||
@@ -199,16 +179,13 @@ public class TFMGFluids {
|
||||
.register();
|
||||
|
||||
public static final FluidEntry<ForgeFlowingFluid.Flowing> MOLTEN_SLAG =
|
||||
REGISTRATE.fluid("molten_slag",MOLTEN_SLAG_STILL_RL,MOLTEN_SLAG_FLOW_RL ,
|
||||
HotFluidType.create(0xfbfbbb, () -> 1f / 24f ))
|
||||
REGISTRATE.fluid("molten_slag",MOLTEN_SLAG_STILL_RL,MOLTEN_SLAG_FLOW_RL)
|
||||
.lang("Molten Slag")
|
||||
.properties(b -> b.viscosity(1500)
|
||||
.density(1000))
|
||||
.fluidProperties(p -> p.levelDecreasePerBlock(1)
|
||||
.attributes(b -> b.viscosity(1500).density(1000))
|
||||
.properties(p -> p.levelDecreasePerBlock(1)
|
||||
.tickRate(10)
|
||||
.slopeFindDistance(2)
|
||||
.explosionResistance(100f))
|
||||
|
||||
.source(ForgeFlowingFluid.Source::new)
|
||||
.bucket()
|
||||
.tag(AllTags.forgeItemTag("buckets/slag"))
|
||||
@@ -237,18 +214,16 @@ public class TFMGFluids {
|
||||
public static FluidEntry<ForgeFlowingFluid.Flowing> flammableFluid(String name, TagKey<Fluid>... tags){
|
||||
|
||||
|
||||
return REGISTRATE.fluid(name,CreateTFMG.asResource("fluid/"+name+"_still"),CreateTFMG.asResource("fluid/"+name+"_flow"),
|
||||
FlammableFluidType.create(0x606060,
|
||||
() -> 1f / 24f ))
|
||||
return REGISTRATE.fluid(name,CreateTFMG.asResource("fluid/"+name+"_still"),CreateTFMG.asResource("fluid/"+name+"_flow"))
|
||||
.lang(TFMGUtils.fromId(name))
|
||||
.properties(b -> b.viscosity(1000)
|
||||
.density(1000))
|
||||
.fluidProperties(p -> p.levelDecreasePerBlock(1)
|
||||
.attributes(b -> b.viscosity(1500).density(1000))
|
||||
.properties(p -> p.levelDecreasePerBlock(1)
|
||||
.tickRate(10)
|
||||
.slopeFindDistance(5)
|
||||
.slopeFindDistance(2)
|
||||
.explosionResistance(100f))
|
||||
.tag(tags)
|
||||
.source(FlammableFluid.Source::new)
|
||||
.source(ForgeFlowingFluid.Source::new)
|
||||
// .source(FlammableFluid.Source::new)
|
||||
.bucket()
|
||||
.tag(AllTags.forgeItemTag("buckets/"+name))
|
||||
.build()
|
||||
@@ -313,12 +288,14 @@ public class TFMGFluids {
|
||||
// CRUDE_OIL.get().getFluidType(),
|
||||
// fluidState -> TFMGFluids.POLLUTED_WATER.getBlock().get().defaultBlockState()));
|
||||
|
||||
FluidInteractionRegistry.addInteraction( TFMGFluids.COOLING_FLUID.get().getFluidType(), new FluidInteractionRegistry.InteractionInformation(
|
||||
ForgeMod.LAVA_TYPE.get(),
|
||||
fluidState -> AllPaletteStoneTypes.LIMESTONE.baseBlock
|
||||
.get()
|
||||
.defaultBlockState()));
|
||||
|
||||
// TODO: re-add fluid interactions
|
||||
// FluidInteractionRegistry.addInteraction( TFMGFluids.COOLING_FLUID.get().getFluidType(), new FluidInteractionRegistry.InteractionInformation(
|
||||
// ForgeMod.LAVA_TYPE.get(),
|
||||
// fluidState -> AllPaletteStoneTypes.LIMESTONE.baseBlock
|
||||
// .get()
|
||||
// .defaultBlockState()));
|
||||
//
|
||||
|
||||
|
||||
|
||||
@@ -327,8 +304,4 @@ public class TFMGFluids {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ public enum TFMGPackets {
|
||||
getChannel().messageBuilder(type, index++, direction)
|
||||
.encoder(encoder)
|
||||
.decoder(decoder)
|
||||
.consumerNetworkThread(handler)
|
||||
.consumer(handler)
|
||||
.add();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,13 @@ import com.drmangotea.createindustry.base.ElectricSparkParticle;
|
||||
import com.simibubi.create.content.equipment.bell.SoulParticle;
|
||||
import com.simibubi.create.foundation.particle.ICustomParticleData;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.core.particles.ParticleOptions;
|
||||
import net.minecraft.core.particles.ParticleType;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.event.RegisterParticleProvidersEvent;
|
||||
//import net.minecraftforge.client.event.RegisterParticleProvidersEvent;
|
||||
import net.minecraftforge.client.event.ParticleFactoryRegisterEvent;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
@@ -35,7 +37,7 @@ public enum TFMGParticleTypes {
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void registerFactories(RegisterParticleProvidersEvent event) {
|
||||
public static void registerFactories(ParticleFactoryRegisterEvent event) {
|
||||
for (TFMGParticleTypes particle : values())
|
||||
particle.entry.registerFactory(event);
|
||||
}
|
||||
@@ -63,9 +65,9 @@ public enum TFMGParticleTypes {
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void registerFactory(RegisterParticleProvidersEvent event) {
|
||||
public void registerFactory(ParticleFactoryRegisterEvent event) {
|
||||
typeFactory.get()
|
||||
.register(object.get(), event);
|
||||
.register(object.get(), Minecraft.getInstance().particleEngine);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,12 +7,13 @@ import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.simibubi.create.AllSoundEvents;
|
||||
import com.simibubi.create.Create;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.data.CachedOutput;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.DataProvider;
|
||||
import net.minecraft.data.HashCache;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
@@ -21,8 +22,9 @@ import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegisterEvent;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -68,13 +70,14 @@ public class TFMGSoundEvents {
|
||||
entry.prepare();
|
||||
}
|
||||
|
||||
public static void register(RegisterEvent event) {
|
||||
event.register(Registry.SOUND_EVENT_REGISTRY, helper -> {
|
||||
for (TFMGSoundEvents.SoundEntry entry : ALL.values())
|
||||
entry.register(helper);
|
||||
});
|
||||
|
||||
public static void register(RegistryEvent.Register<SoundEvent> event) {
|
||||
IForgeRegistry<SoundEvent> registry = event.getRegistry();
|
||||
for (TFMGSoundEvents.SoundEntry entry : ALL.values())
|
||||
entry.register(registry);
|
||||
}
|
||||
|
||||
|
||||
public static JsonObject provideLangEntries() {
|
||||
JsonObject object = new JsonObject();
|
||||
for (TFMGSoundEvents.SoundEntry entry : ALL.values())
|
||||
@@ -111,7 +114,7 @@ public class TFMGSoundEvents {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(CachedOutput cache) throws IOException {
|
||||
public void run(HashCache cache) throws IOException {
|
||||
generate(generator.getOutputFolder(), cache);
|
||||
}
|
||||
|
||||
@@ -120,7 +123,7 @@ public class TFMGSoundEvents {
|
||||
return "TFMG's Custom Sounds";
|
||||
}
|
||||
|
||||
public void generate(Path path, CachedOutput cache) {
|
||||
public void generate(Path path, HashCache cache) {
|
||||
Gson GSON = (new GsonBuilder()).setPrettyPrinting()
|
||||
.disableHtmlEscaping()
|
||||
.create();
|
||||
@@ -135,7 +138,7 @@ public class TFMGSoundEvents {
|
||||
entry.getValue()
|
||||
.write(json);
|
||||
});
|
||||
DataProvider.saveStable(cache, json, path.resolve("sounds.json"));
|
||||
DataProvider.save(GSON, cache, json, path.resolve("sounds.json"));
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@@ -144,6 +147,7 @@ public class TFMGSoundEvents {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public record ConfiguredSoundEvent(Supplier<SoundEvent> event, float volume, float pitch) {
|
||||
}
|
||||
|
||||
@@ -214,7 +218,7 @@ public class TFMGSoundEvents {
|
||||
|
||||
}
|
||||
|
||||
public static abstract class SoundEntry {
|
||||
public static abstract class SoundEntry {
|
||||
|
||||
protected ResourceLocation id;
|
||||
protected String subtitle;
|
||||
@@ -230,7 +234,7 @@ public class TFMGSoundEvents {
|
||||
|
||||
public abstract void prepare();
|
||||
|
||||
public abstract void register(RegisterEvent.RegisterHelper<SoundEvent> registry);
|
||||
public abstract void register(IForgeRegistry<SoundEvent> registry);
|
||||
|
||||
public abstract void write(JsonObject json);
|
||||
|
||||
@@ -295,152 +299,153 @@ public class TFMGSoundEvents {
|
||||
|
||||
}
|
||||
|
||||
private static class WrappedSoundEntry extends TFMGSoundEvents.SoundEntry {
|
||||
private static class WrappedSoundEntry extends SoundEntry {
|
||||
|
||||
private List<TFMGSoundEvents.ConfiguredSoundEvent> wrappedEvents;
|
||||
private List<TFMGSoundEvents.WrappedSoundEntry.CompiledSoundEvent> compiledEvents;
|
||||
private List<ConfiguredSoundEvent> wrappedEvents;
|
||||
private List<CompiledSoundEvent> compiledEvents;
|
||||
|
||||
public WrappedSoundEntry(ResourceLocation id, String subtitle,
|
||||
List<TFMGSoundEvents.ConfiguredSoundEvent> wrappedEvents, SoundSource category, int attenuationDistance) {
|
||||
super(id, subtitle, category, attenuationDistance);
|
||||
this.wrappedEvents = wrappedEvents;
|
||||
compiledEvents = new ArrayList<>();
|
||||
}
|
||||
public WrappedSoundEntry(ResourceLocation id, String subtitle,
|
||||
List<ConfiguredSoundEvent> wrappedEvents, SoundSource category, int attenuationDistance) {
|
||||
super(id, subtitle, category, attenuationDistance);
|
||||
this.wrappedEvents = wrappedEvents;
|
||||
compiledEvents = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepare() {
|
||||
for (int i = 0; i < wrappedEvents.size(); i++) {
|
||||
TFMGSoundEvents.ConfiguredSoundEvent wrapped = wrappedEvents.get(i);
|
||||
ResourceLocation location = getIdOf(i);
|
||||
RegistryObject<SoundEvent> event = RegistryObject.create(location, ForgeRegistries.SOUND_EVENTS);
|
||||
compiledEvents.add(new TFMGSoundEvents.WrappedSoundEntry.CompiledSoundEvent(event, wrapped.volume(), wrapped.pitch()));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void prepare() {
|
||||
for (int i = 0; i < wrappedEvents.size(); i++) {
|
||||
ConfiguredSoundEvent wrapped = wrappedEvents.get(i);
|
||||
ResourceLocation location = getIdOf(i);
|
||||
RegistryObject<SoundEvent> event = RegistryObject.create(location, ForgeRegistries.SOUND_EVENTS);
|
||||
compiledEvents.add(new CompiledSoundEvent(event, wrapped.volume(), wrapped.pitch()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(RegisterEvent.RegisterHelper<SoundEvent> helper) {
|
||||
for (TFMGSoundEvents.WrappedSoundEntry.CompiledSoundEvent compiledEvent : compiledEvents) {
|
||||
ResourceLocation location = compiledEvent.event().getId();
|
||||
helper.register(location, new SoundEvent(location));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void register(IForgeRegistry<SoundEvent> registry) {
|
||||
for (CompiledSoundEvent compiledEvent : compiledEvents) {
|
||||
ResourceLocation location = compiledEvent.event().getId();
|
||||
registry.register(new SoundEvent(location).setRegistryName(location));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SoundEvent getMainEvent() {
|
||||
return compiledEvents.get(0)
|
||||
.event().get();
|
||||
}
|
||||
@Override
|
||||
public SoundEvent getMainEvent() {
|
||||
return compiledEvents.get(0)
|
||||
.event().get();
|
||||
}
|
||||
|
||||
protected ResourceLocation getIdOf(int i) {
|
||||
return new ResourceLocation(id.getNamespace(), i == 0 ? id.getPath() : id.getPath() + "_compounded_" + i);
|
||||
}
|
||||
protected ResourceLocation getIdOf(int i) {
|
||||
return new ResourceLocation(id.getNamespace(), i == 0 ? id.getPath() : id.getPath() + "_compounded_" + i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JsonObject json) {
|
||||
for (int i = 0; i < wrappedEvents.size(); i++) {
|
||||
TFMGSoundEvents.ConfiguredSoundEvent event = wrappedEvents.get(i);
|
||||
JsonObject entry = new JsonObject();
|
||||
JsonArray list = new JsonArray();
|
||||
JsonObject s = new JsonObject();
|
||||
s.addProperty("name", event.event()
|
||||
.get()
|
||||
.getLocation()
|
||||
.toString());
|
||||
s.addProperty("type", "event");
|
||||
if (attenuationDistance != 0)
|
||||
s.addProperty("attenuation_distance", attenuationDistance);
|
||||
list.add(s);
|
||||
entry.add("sounds", list);
|
||||
if (i == 0 && hasSubtitle())
|
||||
entry.addProperty("subtitle", getSubtitleKey());
|
||||
json.add(getIdOf(i).getPath(), entry);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void write(JsonObject json) {
|
||||
for (int i = 0; i < wrappedEvents.size(); i++) {
|
||||
ConfiguredSoundEvent event = wrappedEvents.get(i);
|
||||
JsonObject entry = new JsonObject();
|
||||
JsonArray list = new JsonArray();
|
||||
JsonObject s = new JsonObject();
|
||||
s.addProperty("name", event.event()
|
||||
.get()
|
||||
.getLocation()
|
||||
.toString());
|
||||
s.addProperty("type", "event");
|
||||
if (attenuationDistance != 0)
|
||||
s.addProperty("attenuation_distance", attenuationDistance);
|
||||
list.add(s);
|
||||
entry.add("sounds", list);
|
||||
if (i == 0 && hasSubtitle())
|
||||
entry.addProperty("subtitle", getSubtitleKey());
|
||||
json.add(getIdOf(i).getPath(), entry);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void play(Level world, Player entity, double x, double y, double z, float volume, float pitch) {
|
||||
for (TFMGSoundEvents.WrappedSoundEntry.CompiledSoundEvent event : compiledEvents) {
|
||||
world.playSound(entity, x, y, z, event.event().get(), category, event.volume() * volume,
|
||||
event.pitch() * pitch);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void play(Level world, Player entity, double x, double y, double z, float volume, float pitch) {
|
||||
for (CompiledSoundEvent event : compiledEvents) {
|
||||
world.playSound(entity, x, y, z, event.event().get(), category, event.volume() * volume,
|
||||
event.pitch() * pitch);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playAt(Level world, double x, double y, double z, float volume, float pitch, boolean fade) {
|
||||
for (TFMGSoundEvents.WrappedSoundEntry.CompiledSoundEvent event : compiledEvents) {
|
||||
world.playLocalSound(x, y, z, event.event().get(), category, event.volume() * volume,
|
||||
event.pitch() * pitch, fade);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void playAt(Level world, double x, double y, double z, float volume, float pitch, boolean fade) {
|
||||
for (CompiledSoundEvent event : compiledEvents) {
|
||||
world.playLocalSound(x, y, z, event.event().get(), category, event.volume() * volume,
|
||||
event.pitch() * pitch, fade);
|
||||
}
|
||||
}
|
||||
|
||||
private record CompiledSoundEvent(RegistryObject<SoundEvent> event, float volume, float pitch) {
|
||||
}
|
||||
private record CompiledSoundEvent(RegistryObject<SoundEvent> event, float volume, float pitch) {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static class CustomSoundEntry extends TFMGSoundEvents.SoundEntry {
|
||||
private static class CustomSoundEntry extends SoundEntry {
|
||||
|
||||
protected List<ResourceLocation> variants;
|
||||
protected RegistryObject<SoundEvent> event;
|
||||
protected List<ResourceLocation> variants;
|
||||
protected RegistryObject<SoundEvent> event;
|
||||
|
||||
public CustomSoundEntry(ResourceLocation id, List<ResourceLocation> variants, String subtitle,
|
||||
SoundSource category, int attenuationDistance) {
|
||||
super(id, subtitle, category, attenuationDistance);
|
||||
this.variants = variants;
|
||||
}
|
||||
public CustomSoundEntry(ResourceLocation id, List<ResourceLocation> variants, String subtitle,
|
||||
SoundSource category, int attenuationDistance) {
|
||||
super(id, subtitle, category, attenuationDistance);
|
||||
this.variants = variants;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepare() {
|
||||
event = RegistryObject.create(id, ForgeRegistries.SOUND_EVENTS);
|
||||
}
|
||||
@Override
|
||||
public void prepare() {
|
||||
event = RegistryObject.create(id, ForgeRegistries.SOUND_EVENTS);
|
||||
}
|
||||
|
||||
public void register(RegisterEvent.RegisterHelper<SoundEvent> helper) {
|
||||
ResourceLocation location = event.getId();
|
||||
helper.register(location, new SoundEvent(location));
|
||||
}
|
||||
@Override
|
||||
public void register(IForgeRegistry<SoundEvent> registry) {
|
||||
ResourceLocation location = event.getId();
|
||||
registry.register(new SoundEvent(location).setRegistryName(location));
|
||||
}
|
||||
|
||||
@Override
|
||||
public SoundEvent getMainEvent() {
|
||||
return event.get();
|
||||
}
|
||||
@Override
|
||||
public SoundEvent getMainEvent() {
|
||||
return event.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JsonObject json) {
|
||||
JsonObject entry = new JsonObject();
|
||||
JsonArray list = new JsonArray();
|
||||
@Override
|
||||
public void write(JsonObject json) {
|
||||
JsonObject entry = new JsonObject();
|
||||
JsonArray list = new JsonArray();
|
||||
|
||||
JsonObject s = new JsonObject();
|
||||
s.addProperty("name", id.toString());
|
||||
s.addProperty("type", "file");
|
||||
if (attenuationDistance != 0)
|
||||
s.addProperty("attenuation_distance", attenuationDistance);
|
||||
list.add(s);
|
||||
JsonObject s = new JsonObject();
|
||||
s.addProperty("name", id.toString());
|
||||
s.addProperty("type", "file");
|
||||
if (attenuationDistance != 0)
|
||||
s.addProperty("attenuation_distance", attenuationDistance);
|
||||
list.add(s);
|
||||
|
||||
for (ResourceLocation variant : variants) {
|
||||
s = new JsonObject();
|
||||
s.addProperty("name", variant.toString());
|
||||
s.addProperty("type", "file");
|
||||
if (attenuationDistance != 0)
|
||||
s.addProperty("attenuation_distance", attenuationDistance);
|
||||
list.add(s);
|
||||
}
|
||||
for (ResourceLocation variant : variants) {
|
||||
s = new JsonObject();
|
||||
s.addProperty("name", variant.toString());
|
||||
s.addProperty("type", "file");
|
||||
if (attenuationDistance != 0)
|
||||
s.addProperty("attenuation_distance", attenuationDistance);
|
||||
list.add(s);
|
||||
}
|
||||
|
||||
entry.add("sounds", list);
|
||||
if (hasSubtitle())
|
||||
entry.addProperty("subtitle", getSubtitleKey());
|
||||
json.add(id.getPath(), entry);
|
||||
}
|
||||
entry.add("sounds", list);
|
||||
if (hasSubtitle())
|
||||
entry.addProperty("subtitle", getSubtitleKey());
|
||||
json.add(id.getPath(), entry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void play(Level world, Player entity, double x, double y, double z, float volume, float pitch) {
|
||||
world.playSound(entity, x, y, z, event.get(), category, volume, pitch);
|
||||
}
|
||||
@Override
|
||||
public void play(Level world, Player entity, double x, double y, double z, float volume, float pitch) {
|
||||
world.playSound(entity, x, y, z, event.get(), category, volume, pitch);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playAt(Level world, double x, double y, double z, float volume, float pitch, boolean fade) {
|
||||
world.playLocalSound(x, y, z, event.get(), category, volume, pitch, fade);
|
||||
}
|
||||
@Override
|
||||
public void playAt(Level world, double x, double y, double z, float volume, float pitch, boolean fade) {
|
||||
world.playLocalSound(x, y, z, event.get(), category, volume, pitch, fade);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
@@ -30,13 +31,13 @@ import static com.drmangotea.createindustry.registry.TFMGTags.NameSpace.MOD;
|
||||
|
||||
|
||||
public class TFMGTags {
|
||||
public static <T> TagKey<T> optionalTag(IForgeRegistry<T> registry,
|
||||
ResourceLocation id) {
|
||||
public static <T extends IForgeRegistryEntry<T>> TagKey<T> optionalTag(IForgeRegistry<T> registry,
|
||||
ResourceLocation id) {
|
||||
return registry.tags()
|
||||
.createOptionalTagKey(id, Collections.emptySet());
|
||||
}
|
||||
|
||||
public static <T> TagKey<T> forgeTag(IForgeRegistry<T> registry, String path) {
|
||||
public static <T extends IForgeRegistryEntry<T>> TagKey<T> forgeTag(IForgeRegistry<T> registry, String path) {
|
||||
return optionalTag(registry, new ResourceLocation("forge", path));
|
||||
}
|
||||
|
||||
@@ -170,7 +171,7 @@ public class TFMGTags {
|
||||
TFMGEntityTags(TFMGTags.NameSpace namespace, String path, boolean optional, boolean alwaysDatagen) {
|
||||
ResourceLocation id = new ResourceLocation(namespace.id, path == null ? Lang.asId(name()) : path);
|
||||
if (optional) {
|
||||
tag = optionalTag(ForgeRegistries.ENTITY_TYPES, id);
|
||||
tag = optionalTag(ForgeRegistries.ENTITIES, id);
|
||||
} else {
|
||||
tag = TagKey.create(Registry.ENTITY_TYPE_REGISTRY, id);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ 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;
|
||||
@@ -23,6 +22,7 @@ import net.minecraft.world.level.levelgen.synth.NormalNoise;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class OilFeature extends Feature<GeodeConfiguration> {
|
||||
@@ -34,7 +34,7 @@ public class OilFeature extends Feature<GeodeConfiguration> {
|
||||
|
||||
public boolean place(FeaturePlaceContext<GeodeConfiguration> p_159836_) {
|
||||
GeodeConfiguration geodeconfiguration = p_159836_.config();
|
||||
RandomSource random = p_159836_.random();
|
||||
Random random = p_159836_.random();
|
||||
BlockPos blockpos = p_159836_.origin();
|
||||
WorldGenLevel worldgenlevel = p_159836_.level();
|
||||
int i = geodeconfiguration.minGenOffset;
|
||||
|
||||
@@ -11,38 +11,56 @@ 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.biome.Biome;
|
||||
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.event.world.BiomeLoadingEvent;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
|
||||
public class TFMGOreConfigEntries {
|
||||
|
||||
private static final Predicate<BiomeLoadingEvent> OVERWORLD_BIOMES = event -> {
|
||||
Biome.BiomeCategory category = event.getCategory();
|
||||
return category != Biome.BiomeCategory.NETHER && category != Biome.BiomeCategory.THEEND && category != Biome.BiomeCategory.NONE;
|
||||
};
|
||||
|
||||
private static final Predicate<BiomeLoadingEvent> NETHER_BIOMES = event -> {
|
||||
Biome.BiomeCategory category = event.getCategory();
|
||||
return category == Biome.BiomeCategory.NETHER;
|
||||
};
|
||||
|
||||
public static final OreFeatureConfigEntry LEAD_ORE =
|
||||
create("lead_ore", 10, 5, -63, 60)
|
||||
.biomeExt()
|
||||
.predicate(OVERWORLD_BIOMES)
|
||||
.parent()
|
||||
.standardDatagenExt()
|
||||
|
||||
.withBlocks(Couple.create(TFMGBlocks.LEAD_ORE, TFMGBlocks.DEEPSLATE_LEAD_ORE))
|
||||
.biomeTag(BiomeTags.IS_OVERWORLD)
|
||||
.parent();
|
||||
public static final OreFeatureConfigEntry NICKEL_ORE =
|
||||
create("nickel_ore", 8, 4, -63, 20)
|
||||
.biomeExt()
|
||||
.predicate(OVERWORLD_BIOMES)
|
||||
.parent()
|
||||
.standardDatagenExt()
|
||||
.withBlocks(Couple.create(TFMGBlocks.NICKEL_ORE, TFMGBlocks.DEEPSLATE_NICKEL_ORE))
|
||||
.biomeTag(BiomeTags.IS_OVERWORLD)
|
||||
.parent();
|
||||
|
||||
|
||||
public static final OreFeatureConfigEntry LITHIUM_ORE =
|
||||
create("lithium_ore", 12, 2, -63, 0)
|
||||
.biomeExt()
|
||||
.predicate(OVERWORLD_BIOMES)
|
||||
.parent()
|
||||
.standardDatagenExt()
|
||||
.withBlocks(Couple.create(TFMGBlocks.LITHIUM_ORE, TFMGBlocks.DEEPSLATE_LITHIUM_ORE))
|
||||
.biomeTag(BiomeTags.IS_OVERWORLD)
|
||||
.parent();
|
||||
|
||||
|
||||
|
||||
@@ -5,13 +5,14 @@ import com.drmangotea.createindustry.registry.TFMGFluids;
|
||||
import com.mojang.serialization.Codec;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProvider;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
|
||||
public class OilDepositFeature extends Feature<NoneFeatureConfiguration> {
|
||||
public OilDepositFeature(Codec<NoneFeatureConfiguration> p_65786_) {
|
||||
@@ -24,7 +25,7 @@ public class OilDepositFeature extends Feature<NoneFeatureConfiguration> {
|
||||
BlockPos startingPos = context.origin();
|
||||
WorldGenLevel level = context.level();
|
||||
BlockPos pos = startingPos;
|
||||
RandomSource randomsource = context.random();
|
||||
Random randomsource = context.random();
|
||||
|
||||
|
||||
level.setBlock(startingPos, TFMGBlocks.OIL_DEPOSIT.getDefaultState(),2);
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.mojang.serialization.Codec;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
@@ -18,6 +17,8 @@ import net.minecraft.world.level.material.Fluids;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.common.Tags;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class OilWellFeature extends Feature<NoneFeatureConfiguration> {
|
||||
public OilWellFeature(Codec<NoneFeatureConfiguration> pCodec) {
|
||||
super(pCodec);
|
||||
@@ -29,7 +30,7 @@ public class OilWellFeature extends Feature<NoneFeatureConfiguration> {
|
||||
BlockPos startingPos = context.origin();
|
||||
WorldGenLevel level = context.level();
|
||||
BlockPos pos = startingPos;
|
||||
RandomSource randomsource = context.random();
|
||||
Random randomsource = context.random();
|
||||
|
||||
ChunkGenerator chunkGenerator = context.chunkGenerator();
|
||||
|
||||
@@ -73,7 +74,7 @@ public class OilWellFeature extends Feature<NoneFeatureConfiguration> {
|
||||
|
||||
if(randomsource.nextInt(10)==7){
|
||||
if(level.getFluidState(pos1).is(Fluids.WATER)||level.getBlockState(pos1).is(Tags.Blocks.SAND)) {
|
||||
level.setBlock(pos1, TFMGFluids.CRUDE_OIL.getSource().getSource(true).createLegacyBlock(), 3);
|
||||
level.setBlock(pos1, TFMGFluids.CRUDE_OIL.get().getSource(true).createLegacyBlock(), 3);
|
||||
if(level.getBlockState(pos1).is(Tags.Blocks.SAND))
|
||||
level.getBlockState(pos1).updateShape(Direction.NORTH,level.getBlockState(pos1),level,pos1,pos1);
|
||||
}
|
||||
@@ -85,7 +86,7 @@ public class OilWellFeature extends Feature<NoneFeatureConfiguration> {
|
||||
}
|
||||
|
||||
|
||||
level.setBlock(pos, TFMGFluids.CRUDE_OIL.getSource().getSource(true).createLegacyBlock(), 3);
|
||||
level.setBlock(pos, TFMGFluids.CRUDE_OIL.get().getSource(true).createLegacyBlock(), 3);
|
||||
level.getBlockState(pos).updateShape(Direction.NORTH,level.getBlockState(pos),level,pos,pos);
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
modLoader="javafml"
|
||||
|
||||
loaderVersion="[43,)"
|
||||
loaderVersion="[40,)"
|
||||
|
||||
license="MIT"
|
||||
|
||||
@@ -26,7 +26,7 @@ Create is by default a steam/clockpunk mod and most addons aim to expand this pa
|
||||
|
||||
mandatory=true
|
||||
|
||||
versionRange="[43,)"
|
||||
versionRange="[40,)"
|
||||
|
||||
ordering="NONE"
|
||||
|
||||
@@ -36,6 +36,6 @@ Create is by default a steam/clockpunk mod and most addons aim to expand this pa
|
||||
modId="minecraft"
|
||||
mandatory=true
|
||||
|
||||
versionRange="[1.19.2,1.20)"
|
||||
versionRange="[1.18.2,1.20)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
|
||||
{
|
||||
"required": true,
|
||||
"minVersion": 0.8,
|
||||
"minVersion": "0.8",
|
||||
"package": "com.drmangotea.createindustry.mixins",
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"refmap": "createindustry.refmap.json",
|
||||
@@ -11,8 +10,7 @@
|
||||
"ArrowMixin",
|
||||
"BucketItemMixin",
|
||||
"FluidPipeBlockMixin",
|
||||
"FluidPropagatorMixin",
|
||||
"PipeAttachmentModelMixin"
|
||||
"FluidPropagatorMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
||||
Reference in New Issue
Block a user