generated from NeoForgeMDKs/MDK-1.21-NeoGradle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7e95a8d
commit 16e2552
Showing
8 changed files
with
129 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/main/java/com/portingdeadmods/modjam/api/fluids/BaseFluidType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.portingdeadmods.modjam.api.fluids; | ||
|
||
import net.minecraft.core.Vec3i; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.neoforged.neoforge.fluids.FluidType; | ||
|
||
public class BaseFluidType extends FluidType { | ||
private final ResourceLocation stillTexture; | ||
private final ResourceLocation flowingTexture; | ||
private final ResourceLocation overlayTexture; | ||
private final Vec3i color; | ||
|
||
public BaseFluidType(ResourceLocation stillTexture, ResourceLocation flowingTexture, ResourceLocation overlayTexture, Vec3i color, FluidType.Properties properties) { | ||
super(properties); | ||
this.stillTexture = stillTexture; | ||
this.flowingTexture = flowingTexture; | ||
this.overlayTexture = overlayTexture; | ||
this.color = color; | ||
} | ||
|
||
public ResourceLocation getStillTexture() { | ||
return stillTexture; | ||
} | ||
|
||
public ResourceLocation getFlowingTexture() { | ||
return flowingTexture; | ||
} | ||
|
||
public ResourceLocation getOverlayTexture() { | ||
return overlayTexture; | ||
} | ||
|
||
public Vec3i getColor() { | ||
return color; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/main/java/com/portingdeadmods/modjam/registries/MJFluidTypes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.portingdeadmods.modjam.registries; | ||
|
||
import com.portingdeadmods.modjam.ModJam; | ||
import com.portingdeadmods.modjam.api.fluids.BaseFluidType; | ||
import net.minecraft.core.Vec3i; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.sounds.SoundEvents; | ||
import net.neoforged.neoforge.common.SoundAction; | ||
import net.neoforged.neoforge.fluids.FluidType; | ||
import net.neoforged.neoforge.registries.DeferredRegister; | ||
import net.neoforged.neoforge.registries.NeoForgeRegistries; | ||
|
||
import java.util.function.Supplier; | ||
|
||
public class MJFluidTypes { | ||
|
||
public static final DeferredRegister<FluidType> FLUID_TYPES = | ||
DeferredRegister.create(NeoForgeRegistries.FLUID_TYPES, ModJam.MODID); | ||
|
||
public static final Supplier<FluidType> SALT_WATER_FLUID_TYPE = register("soap_water", | ||
FluidType.Properties.create().lightLevel(2).density(15).viscosity(5).sound(SoundAction.get("drink"), | ||
SoundEvents.HONEY_DRINK), new Vec3i(224, 56, 208), FluidTemplate.WATER); | ||
|
||
|
||
private static Supplier<FluidType> register(String name, FluidType.Properties properties, Vec3i color, FluidTemplate template) { | ||
return FLUID_TYPES.register(name, () -> new BaseFluidType(template.still, template.flowing, template.overlay, color, properties)); | ||
} | ||
|
||
|
||
public enum FluidTemplate { | ||
WATER(ResourceLocation.parse("block/salt_water_still"), | ||
ResourceLocation.parse("block/salt_water_flow"), | ||
ResourceLocation.fromNamespaceAndPath(ModJam.MODID, "misc/in_salt_water")); | ||
|
||
private final ResourceLocation still; | ||
private final ResourceLocation flowing; | ||
private final ResourceLocation overlay; | ||
|
||
FluidTemplate(ResourceLocation still, ResourceLocation flowing, ResourceLocation overlay) { | ||
this.still = still; | ||
this.flowing = flowing; | ||
this.overlay = overlay; | ||
} | ||
} | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/com/portingdeadmods/modjam/registries/MJFluids.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.portingdeadmods.modjam.registries; | ||
|
||
import com.portingdeadmods.modjam.ModJam; | ||
import net.minecraft.core.registries.Registries; | ||
import net.minecraft.world.level.material.FlowingFluid; | ||
import net.minecraft.world.level.material.Fluid; | ||
import net.neoforged.neoforge.fluids.BaseFlowingFluid; | ||
import net.neoforged.neoforge.registries.DeferredRegister; | ||
|
||
import java.util.function.Supplier; | ||
|
||
public class MJFluids { | ||
|
||
public static final DeferredRegister<Fluid> FLUIDS = | ||
DeferredRegister.create(Registries.FLUID, ModJam.MODID); | ||
|
||
public static final Supplier<FlowingFluid> SALT_WATER_SOURCE = FLUIDS.register("salt_water", | ||
() -> new BaseFlowingFluid.Source(MJFluids.SALT_WATER_PROPERTIES)); | ||
public static final Supplier<FlowingFluid> SALT_WATER_FLOWING = FLUIDS.register("salt_water_flowing", | ||
() -> new BaseFlowingFluid.Flowing(MJFluids.SALT_WATER_PROPERTIES)); | ||
|
||
|
||
public static final BaseFlowingFluid.Properties SALT_WATER_PROPERTIES = new BaseFlowingFluid.Properties( | ||
MJFluidTypes.SALT_WATER_FLUID_TYPE, SALT_WATER_SOURCE, SALT_WATER_FLOWING) | ||
.slopeFindDistance(2).levelDecreasePerBlock(2).block(MJBlocks.SALT_WATER_FLUID_BLOCK) | ||
.bucket(MJItems.SALT_WATER_BUCKET); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters