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