-
Notifications
You must be signed in to change notification settings - Fork 40
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
d153e7c
commit 0239ab6
Showing
14 changed files
with
363 additions
and
2 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
6 changes: 6 additions & 0 deletions
6
src/generated/resources/assets/anvilcraft/models/item/oil_bucket.json
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,6 @@ | ||
{ | ||
"parent": "minecraft:item/generated", | ||
"textures": { | ||
"layer0": "anvilcraft:item/oil_bucket" | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/generated/resources/data/anvilcraft/loot_table/blocks/oil.json
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,21 @@ | ||
{ | ||
"type": "minecraft:block", | ||
"pools": [ | ||
{ | ||
"bonus_rolls": 0.0, | ||
"conditions": [ | ||
{ | ||
"condition": "minecraft:survives_explosion" | ||
} | ||
], | ||
"entries": [ | ||
{ | ||
"type": "minecraft:item", | ||
"name": "minecraft:air" | ||
} | ||
], | ||
"rolls": 1.0 | ||
} | ||
], | ||
"random_sequence": "anvilcraft:blocks/oil" | ||
} |
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
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
27 changes: 27 additions & 0 deletions
27
src/main/java/dev/dubhe/anvilcraft/fluid/ClientFluidTypeExtensionImpl.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 dev.dubhe.anvilcraft.fluid; | ||
|
||
import net.minecraft.MethodsReturnNonnullByDefault; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.neoforged.neoforge.client.extensions.common.IClientFluidTypeExtensions; | ||
|
||
@MethodsReturnNonnullByDefault | ||
public class ClientFluidTypeExtensionImpl implements IClientFluidTypeExtensions { | ||
public final ResourceLocation stillTexture; | ||
public final ResourceLocation flowingTexture; | ||
|
||
|
||
public ClientFluidTypeExtensionImpl(ResourceLocation stillTexture, ResourceLocation flowingTexture) { | ||
this.stillTexture = stillTexture; | ||
this.flowingTexture = flowingTexture; | ||
} | ||
|
||
@Override | ||
public ResourceLocation getFlowingTexture() { | ||
return flowingTexture; | ||
} | ||
|
||
@Override | ||
public ResourceLocation getStillTexture() { | ||
return stillTexture; | ||
} | ||
} |
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,156 @@ | ||
package dev.dubhe.anvilcraft.fluid; | ||
|
||
import dev.dubhe.anvilcraft.init.ModBlocks; | ||
import dev.dubhe.anvilcraft.init.ModFluids; | ||
import dev.dubhe.anvilcraft.init.ModItems; | ||
import net.minecraft.MethodsReturnNonnullByDefault; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.core.Direction; | ||
import net.minecraft.sounds.SoundEvents; | ||
import net.minecraft.world.entity.Entity; | ||
import net.minecraft.world.entity.item.ItemEntity; | ||
import net.minecraft.world.item.Item; | ||
import net.minecraft.world.level.BlockGetter; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraft.world.level.LevelAccessor; | ||
import net.minecraft.world.level.LevelReader; | ||
import net.minecraft.world.level.block.LiquidBlock; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraft.world.level.block.state.StateDefinition; | ||
import net.minecraft.world.level.material.Fluid; | ||
import net.minecraft.world.level.material.FluidState; | ||
import net.minecraft.world.level.pathfinder.PathType; | ||
import net.minecraft.world.phys.Vec3; | ||
import net.neoforged.neoforge.common.SoundActions; | ||
import net.neoforged.neoforge.fluids.BaseFlowingFluid; | ||
import net.neoforged.neoforge.fluids.FluidType; | ||
|
||
import javax.annotation.ParametersAreNonnullByDefault; | ||
|
||
@ParametersAreNonnullByDefault | ||
@MethodsReturnNonnullByDefault | ||
public abstract class OilFluid extends BaseFlowingFluid { | ||
public static final FluidType TYPE = new FluidType(FluidType.Properties.create() | ||
.descriptionId("block.anvilcraft.oil") | ||
.canSwim(true) | ||
.canDrown(true) | ||
.fallDistanceModifier(0.0F) | ||
.canExtinguish(false) | ||
.pathType(PathType.LAVA) | ||
.adjacentPathType(null) | ||
.sound(SoundActions.BUCKET_FILL, SoundEvents.BUCKET_FILL_LAVA) | ||
.sound(SoundActions.BUCKET_EMPTY, SoundEvents.BUCKET_EMPTY_LAVA) | ||
.lightLevel(0) | ||
) { | ||
public boolean canConvertToSource(FluidState state, LevelReader reader, BlockPos pos) { | ||
return false; | ||
} | ||
|
||
public double motionScale(Entity entity) { | ||
return 0.0023333333333333335; | ||
} | ||
|
||
public void setItemMovement(ItemEntity entity) { | ||
Vec3 vec3 = entity.getDeltaMovement(); | ||
entity.setDeltaMovement(vec3.x * 0.949999988079071, vec3.y + (double) (vec3.y < 0.05999999865889549 ? 5.0E-4F : 0.0F), vec3.z * 0.949999988079071); | ||
} | ||
}; | ||
|
||
OilFluid() { | ||
super( | ||
new Properties( | ||
() -> TYPE, | ||
ModFluids.OIL, | ||
ModFluids.FLOWING_OIL | ||
).slopeFindDistance(4) | ||
); | ||
} | ||
|
||
|
||
@Override | ||
public Item getBucket() { | ||
return ModItems.OIL_BUCKET.asItem(); | ||
} | ||
|
||
@Override | ||
protected boolean canBeReplacedWith(FluidState fluidState, BlockGetter blockGetter, BlockPos blockPos, Fluid fluid, Direction direction) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public int getTickDelay(LevelReader levelReader) { | ||
return 30; | ||
} | ||
|
||
@Override | ||
protected float getExplosionResistance() { | ||
return 100f; | ||
} | ||
|
||
@Override | ||
protected BlockState createLegacyBlock(FluidState fluidState) { | ||
return ModBlocks.OIL.getDefaultState().setValue(LiquidBlock.LEVEL, getLegacyLevel(fluidState)); | ||
} | ||
|
||
@Override | ||
public Fluid getFlowing() { | ||
return ModFluids.FLOWING_OIL.get(); | ||
} | ||
|
||
@Override | ||
public Fluid getSource() { | ||
return ModFluids.OIL.get(); | ||
} | ||
|
||
@Override | ||
protected void beforeDestroyingBlock(LevelAccessor levelAccessor, BlockPos blockPos, BlockState blockState) { | ||
|
||
} | ||
|
||
@Override | ||
protected int getSlopeFindDistance(LevelReader levelReader) { | ||
return 4; | ||
} | ||
|
||
@Override | ||
protected int getDropOff(LevelReader levelReader) { | ||
return 2; | ||
} | ||
|
||
@Override | ||
protected boolean canConvertToSource(Level level) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public FluidType getFluidType() { | ||
return TYPE; | ||
} | ||
|
||
public static class Source extends OilFluid { | ||
|
||
public int getAmount(FluidState state) { | ||
return 8; | ||
} | ||
|
||
public boolean isSource(FluidState state) { | ||
return true; | ||
} | ||
} | ||
|
||
public static class Flowing extends OilFluid { | ||
|
||
protected void createFluidStateDefinition(StateDefinition.Builder<Fluid, FluidState> builder) { | ||
super.createFluidStateDefinition(builder); | ||
builder.add(LEVEL); | ||
} | ||
|
||
public int getAmount(FluidState state) { | ||
return state.getValue(LEVEL); | ||
} | ||
|
||
public boolean isSource(FluidState state) { | ||
return false; | ||
} | ||
} | ||
} |
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
Oops, something went wrong.