-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1.1.0 regular blocks + init moisture detector
- Loading branch information
1 parent
4d76935
commit 8bbebfc
Showing
20 changed files
with
178 additions
and
6 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
7 changes: 7 additions & 0 deletions
7
src/client/resources/assets/rounded/blockstates/dead_bladderwrack_block.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,7 @@ | ||
{ | ||
"variants": { | ||
"": { | ||
"model": "rounded:block/dead_bladderwrack_block" | ||
} | ||
} | ||
} |
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/client/resources/assets/rounded/models/block/dead_bladderwrack_block.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:block/cube_all", | ||
"textures": { | ||
"all": "rounded:block/dead_bladderwrack_block" | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
src/client/resources/assets/rounded/models/item/dead_bladderwrack_block.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,3 @@ | ||
{ | ||
"parent": "rounded:block/dead_bladderwrack_block" | ||
} |
Binary file added
BIN
+228 Bytes
src/client/resources/assets/rounded/textures/block/bladderwrack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+276 Bytes
src/client/resources/assets/rounded/textures/block/bladderwrack_block.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+237 Bytes
src/client/resources/assets/rounded/textures/block/chiseled_prismarine_bricks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+229 Bytes
src/client/resources/assets/rounded/textures/block/dead_bladderwrack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+276 Bytes
src/client/resources/assets/rounded/textures/block/dead_bladderwrack_block.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+468 Bytes
src/client/resources/assets/rounded/textures/block/prismarine_lantern.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions
5
src/client/resources/assets/rounded/textures/block/prismarine_lantern.png.mcmeta
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,5 @@ | ||
{ | ||
"animation": { | ||
"frametime": 8 | ||
} | ||
} |
Binary file added
BIN
+371 Bytes
src/client/resources/assets/rounded/textures/block/smooth_prismarine.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+391 Bytes
src/client/resources/assets/rounded/textures/block/smooth_prismarine_slab_side.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+299 Bytes
src/client/resources/assets/rounded/textures/item/prismarine_lantern.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
96 changes: 96 additions & 0 deletions
96
src/main/java/com/lumiscosity/rounded/blocks/MoistureDetectorBlock.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,96 @@ | ||
package com.lumiscosity.rounded.blocks; | ||
|
||
import com.mojang.serialization.MapCodec; | ||
import net.minecraft.block.*; | ||
import net.minecraft.block.entity.BlockEntity; | ||
import net.minecraft.block.entity.BlockEntityTicker; | ||
import net.minecraft.block.entity.BlockEntityType; | ||
import net.minecraft.fluid.FluidState; | ||
import net.minecraft.state.StateManager; | ||
import net.minecraft.state.property.IntProperty; | ||
import net.minecraft.state.property.Properties; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.Direction; | ||
import net.minecraft.util.math.MathHelper; | ||
import net.minecraft.world.BlockView; | ||
import net.minecraft.world.World; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import static com.lumiscosity.rounded.blocks.RegisterBlocks.MOISTURE_DETECTOR_BE; | ||
|
||
public class MoistureDetectorBlock extends BlockWithEntity { | ||
public static final MapCodec<MoistureDetectorBlock> CODEC = createCodec(MoistureDetectorBlock::new); | ||
public static final IntProperty POWER = Properties.POWER; | ||
|
||
@Override | ||
public MapCodec<MoistureDetectorBlock> getCodec() { | ||
return CODEC; | ||
} | ||
|
||
public MoistureDetectorBlock(AbstractBlock.Settings settings) { | ||
super(settings); | ||
this.setDefaultState(this.stateManager.getDefaultState().with(POWER, 0)); | ||
} | ||
|
||
@Override | ||
protected int getWeakRedstonePower(BlockState state, BlockView world, BlockPos pos, Direction direction) { | ||
return state.get(POWER); | ||
} | ||
|
||
public static void getWaterLevel(BlockState state, World world, BlockPos pos, FluidState water) { | ||
int i = water.getLevel() * 2; | ||
i = MathHelper.clamp(i, 0, 15); | ||
if (state.get(POWER) != i) { | ||
world.setBlockState(pos, state.with(POWER, i), Block.NOTIFY_ALL); | ||
} | ||
} | ||
|
||
public static void getRainLevel(BlockState state, World world, BlockPos pos) { | ||
int i = world.isRaining() ? world.isThundering() ? 15 : 7 : 0; | ||
if (state.get(POWER) != i) { | ||
world.setBlockState(pos, state.with(POWER, i), Block.NOTIFY_ALL); | ||
} | ||
} | ||
|
||
@Override | ||
protected boolean emitsRedstonePower(BlockState state) { | ||
return true; | ||
} | ||
|
||
public static class MoistureDetectorBlockEntity extends BlockEntity { | ||
public MoistureDetectorBlockEntity(BlockPos pos, BlockState state) { | ||
super(MOISTURE_DETECTOR_BE, pos, state); | ||
} | ||
} | ||
|
||
@Override | ||
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { | ||
return new MoistureDetectorBlockEntity(pos, state); | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type) { | ||
return !world.isClient ? validateTicker(type, MOISTURE_DETECTOR_BE, MoistureDetectorBlock::tick) : null; | ||
} | ||
|
||
private static void tick(World world, BlockPos pos, BlockState state, MoistureDetectorBlockEntity blockEntity) { | ||
if (world.getTime() % 2L == 0L) { | ||
BlockPos check_pos = pos.up(); | ||
if (world.getBlockState(check_pos).isOf(Blocks.WATER)) { | ||
getWaterLevel(state, world, pos, world.getFluidState(check_pos)); | ||
} else if (world.getBlockState(check_pos).contains(Properties.WATERLOGGED) ? world.getBlockState(check_pos).get(Properties.WATERLOGGED) : false) { | ||
if (state.get(POWER) != 15) { | ||
world.setBlockState(pos, state.with(POWER, 15), Block.NOTIFY_ALL); | ||
} | ||
} else if (world.hasRain(pos)) { | ||
getRainLevel(state, world, pos); | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) { | ||
builder.add(POWER); | ||
} | ||
} |
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
10 changes: 9 additions & 1 deletion
10
src/main/resources/data/minecraft/tags/block/mineable/pickaxe.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 |
---|---|---|
@@ -1,6 +1,14 @@ | ||
{ | ||
"replace": false, | ||
"values": [ | ||
"rounded:luster_cluster" | ||
"rounded:luster_cluster", | ||
"rounded:smooth_prismarine", | ||
"rounded:smooth_prismarine_slab", | ||
"rounded:chiseled_prismarine_bricks", | ||
"rounded:prismarine_lantern", | ||
"rounded:dead_bladderwrack", | ||
"rounded:bladderwrack", | ||
"rounded:dead_bladderwrack_block", | ||
"rounded:bladderwrack_block" | ||
] | ||
} |