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
MCZME
committed
Aug 12, 2024
1 parent
631ed4b
commit ec61a2d
Showing
13 changed files
with
97 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,63 @@ | ||
package mczme.lingshi.common.block; | ||
|
||
import mczme.lingshi.common.registry.ModItems; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.world.level.BlockGetter; | ||
import net.minecraft.world.level.ItemLike; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.CropBlock; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraft.world.level.block.state.StateDefinition; | ||
import net.minecraft.world.level.block.state.properties.BlockStateProperties; | ||
import net.minecraft.world.level.block.state.properties.IntegerProperty; | ||
import net.minecraft.world.phys.shapes.CollisionContext; | ||
import net.minecraft.world.phys.shapes.VoxelShape; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class RiceBlock extends CropBlock { | ||
|
||
public static final int MAX_AGE = 3; | ||
public static final IntegerProperty AGE = BlockStateProperties.AGE_3; | ||
private static final VoxelShape[] SHAPE_BY_AGE = new VoxelShape[]{ | ||
Block.box(0.0, 0.0, 0.0, 16.0, 2.0, 16.0), | ||
Block.box(0.0, 0.0, 0.0, 16.0, 6.0, 16.0), | ||
Block.box(0.0, 0.0, 0.0, 16.0, 10.0, 16.0), | ||
Block.box(0.0, 0.0, 0.0, 16.0, 14.0, 16.0), | ||
}; | ||
|
||
public RiceBlock(Properties properties) { | ||
super(properties); | ||
this.registerDefaultState(this.defaultBlockState().setValue(AGE, 0)); | ||
} | ||
|
||
@Override | ||
protected @NotNull ItemLike getBaseSeedId() { | ||
return ModItems.RICE.get(); | ||
} | ||
|
||
@Override | ||
protected VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) { | ||
return SHAPE_BY_AGE[this.getAge(pState)]; | ||
} | ||
|
||
@Override | ||
public IntegerProperty getAgeProperty() { | ||
return AGE; | ||
} | ||
|
||
@Override | ||
public int getAge(BlockState state) { | ||
return state.getValue(this.getAgeProperty()); | ||
} | ||
|
||
@Override | ||
public int getMaxAge() { | ||
return 3; | ||
} | ||
|
||
@Override | ||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> pBuilder) { | ||
pBuilder.add(AGE); | ||
} | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,16 @@ | ||
{ | ||
"variants": { | ||
"age=0": { | ||
"model": "lingshi:block/riceseedling_age0" | ||
"model": "lingshi:block/rice0" | ||
}, | ||
"age=1": { | ||
"model": "lingshi:block/riceseedling_age0" | ||
"model": "lingshi:block/rice1" | ||
}, | ||
"age=2": { | ||
"model": "lingshi:block/riceseedling_age0" | ||
"model": "lingshi:block/rice2" | ||
}, | ||
"age=3": { | ||
"model": "lingshi:block/riceseedling_age0" | ||
}, | ||
"age=4": { | ||
"model": "lingshi:block/riceseedling_age0" | ||
}, | ||
"age=5": { | ||
"model": "lingshi:block/riceseedling_age0" | ||
}, | ||
"age=6": { | ||
"model": "lingshi:block/riceseedling_age0" | ||
}, | ||
"age=7": { | ||
"model": "lingshi:block/riceseedling_age0" | ||
"model": "lingshi:block/rice3" | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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 @@ | ||
{ | ||
"parent": "block/crop", | ||
"render_type": "minecraft:cutout", | ||
"textures": { | ||
"crop": "lingshi:block/rice0" | ||
} | ||
} |
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 @@ | ||
{ | ||
"parent": "block/crop", | ||
"render_type": "minecraft:cutout", | ||
"textures": { | ||
"crop": "lingshi:block/rice1" | ||
} | ||
} |
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 @@ | ||
{ | ||
"parent": "block/crop", | ||
"render_type": "minecraft:cutout", | ||
"textures": { | ||
"crop": "lingshi:block/rice2" | ||
} | ||
} |
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 @@ | ||
{ | ||
"parent": "block/crop", | ||
"render_type": "minecraft:cutout", | ||
"textures": { | ||
"crop": "lingshi:block/rice3" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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