Lumecorn seed & rod
This commit is contained in:
parent
302db402c1
commit
7e9d809814
23 changed files with 162 additions and 18 deletions
|
@ -2,6 +2,7 @@ package ru.betterend.blocks;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
@ -46,4 +47,9 @@ public class BlueVineSeedBlock extends EndPlantWithAgeBlock {
|
|||
protected boolean isTerrain(BlockState state) {
|
||||
return state.isOf(EndBlocks.END_MOSS) || state.isOf(EndBlocks.END_MYCELIUM);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractBlock.OffsetType getOffsetType() {
|
||||
return AbstractBlock.OffsetType.NONE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.Random;
|
|||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
|
@ -66,4 +67,9 @@ public class GlowingPillarSeedBlock extends EndPlantWithAgeBlock {
|
|||
protected boolean isTerrain(BlockState state) {
|
||||
return state.isOf(EndBlocks.AMBER_MOSS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractBlock.OffsetType getOffsetType() {
|
||||
return AbstractBlock.OffsetType.NONE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package ru.betterend.blocks;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockPos.Mutable;
|
||||
|
@ -37,4 +38,9 @@ public class LanceleafSeedBlock extends EndPlantWithAgeBlock {
|
|||
protected boolean isTerrain(BlockState state) {
|
||||
return state.isOf(EndBlocks.AMBER_MOSS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractBlock.OffsetType getOffsetType() {
|
||||
return AbstractBlock.OffsetType.NONE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -7,6 +10,8 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.loot.context.LootContext;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.EnumProperty;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -19,16 +24,21 @@ import ru.betterend.blocks.BlockProperties.LumecornShape;
|
|||
import ru.betterend.blocks.basis.BaseBlockNotFull;
|
||||
import ru.betterend.client.render.ERenderLayer;
|
||||
import ru.betterend.interfaces.IRenderTypeable;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndItems;
|
||||
import ru.betterend.registry.EndTags;
|
||||
import ru.betterend.util.MHelper;
|
||||
|
||||
public class LumecornBlock extends BaseBlockNotFull implements IRenderTypeable {
|
||||
public static final EnumProperty<LumecornShape> SHAPE = EnumProperty.of("shape", LumecornShape.class);
|
||||
private static final VoxelShape SHAPE_BIG = Block.createCuboidShape(5, 0, 5, 11, 16, 11);
|
||||
private static final VoxelShape SHAPE_MEDIUM = Block.createCuboidShape(6, 0, 6, 10, 16, 10);
|
||||
private static final VoxelShape SHAPE_SMALL = Block.createCuboidShape(7, 0, 7, 9, 16, 9);
|
||||
private static final VoxelShape SHAPE_BOTTOM = Block.createCuboidShape(6, 0, 6, 10, 16, 10);
|
||||
private static final VoxelShape SHAPE_TOP = Block.createCuboidShape(6, 0, 6, 10, 8, 10);
|
||||
|
||||
public LumecornBlock() {
|
||||
super(FabricBlockSettings.of(Material.WOOD).breakByTool(FabricToolTags.AXES).hardness(0.5F).luminance((state) -> {
|
||||
super(FabricBlockSettings.of(Material.WOOD)
|
||||
.breakByTool(FabricToolTags.AXES)
|
||||
.hardness(0.5F)
|
||||
.luminance((state) -> {
|
||||
return state.get(SHAPE).getLight();
|
||||
}));
|
||||
}
|
||||
|
@ -45,16 +55,7 @@ public class LumecornBlock extends BaseBlockNotFull implements IRenderTypeable {
|
|||
|
||||
@Override
|
||||
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ePos) {
|
||||
LumecornShape shape = state.get(SHAPE);
|
||||
if (shape == LumecornShape.LIGHT_MIDDLE) {
|
||||
return SHAPE_SMALL;
|
||||
}
|
||||
else if (shape == LumecornShape.LIGHT_TOP_MIDDLE) {
|
||||
return SHAPE_MEDIUM;
|
||||
}
|
||||
else {
|
||||
return SHAPE_BIG;
|
||||
}
|
||||
return state.get(SHAPE) == LumecornShape.LIGHT_TOP ? SHAPE_TOP : SHAPE_BOTTOM;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -63,9 +64,12 @@ public class LumecornBlock extends BaseBlockNotFull implements IRenderTypeable {
|
|||
if (shape == LumecornShape.BOTTOM_BIG || shape == LumecornShape.BOTTOM_SMALL) {
|
||||
return world.getBlockState(pos.down()).isIn(EndTags.END_GROUND);
|
||||
}
|
||||
else {
|
||||
else if (shape == LumecornShape.LIGHT_TOP) {
|
||||
return world.getBlockState(pos.down()).isOf(this);
|
||||
}
|
||||
else {
|
||||
return world.getBlockState(pos.down()).isOf(this) && world.getBlockState(pos.up()).isOf(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -77,4 +81,23 @@ public class LumecornBlock extends BaseBlockNotFull implements IRenderTypeable {
|
|||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
|
||||
LumecornShape shape = state.get(SHAPE);
|
||||
if (shape == LumecornShape.BOTTOM_BIG || shape == LumecornShape.BOTTOM_SMALL || shape == LumecornShape.MIDDLE) {
|
||||
if (MHelper.RANDOM.nextBoolean()) {
|
||||
return Collections.singletonList(new ItemStack(EndBlocks.LUMECORN_SEED));
|
||||
}
|
||||
else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
if (MHelper.RANDOM.nextBoolean()) {
|
||||
return Collections.singletonList(new ItemStack(EndItems.LUMECORN_ROD));
|
||||
}
|
||||
else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
28
src/main/java/ru/betterend/blocks/LumecornSeedBlock.java
Normal file
28
src/main/java/ru/betterend/blocks/LumecornSeedBlock.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
|
||||
public class LumecornSeedBlock extends EndPlantWithAgeBlock {
|
||||
@Override
|
||||
public void growAdult(StructureWorldAccess world, Random random, BlockPos pos) {
|
||||
EndFeatures.LUMECORN.getFeature().generate(world, null, random, pos, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isTerrain(BlockState state) {
|
||||
return state.isOf(EndBlocks.END_MOSS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractBlock.OffsetType getOffsetType() {
|
||||
return AbstractBlock.OffsetType.NONE;
|
||||
}
|
||||
}
|
|
@ -57,6 +57,7 @@ import ru.betterend.blocks.LacugroveSaplingBlock;
|
|||
import ru.betterend.blocks.LanceleafBlock;
|
||||
import ru.betterend.blocks.LanceleafSeedBlock;
|
||||
import ru.betterend.blocks.LumecornBlock;
|
||||
import ru.betterend.blocks.LumecornSeedBlock;
|
||||
import ru.betterend.blocks.MengerSpongeBlock;
|
||||
import ru.betterend.blocks.MengerSpongeWetBlock;
|
||||
import ru.betterend.blocks.MossyGlowshroomCapBlock;
|
||||
|
@ -228,7 +229,8 @@ public class EndBlocks {
|
|||
|
||||
public static final Block SMALL_JELLYSHROOM = registerBlock("small_jellyshroom", new SmallJellyshroomBlock());
|
||||
|
||||
public static final Block LUMECORN = registerBlock("lumecorn", new LumecornBlock());
|
||||
public static final Block LUMECORN_SEED = registerBlock("lumecorn_seed", new LumecornSeedBlock());
|
||||
public static final Block LUMECORN = registerBlockNI("lumecorn", new LumecornBlock());
|
||||
|
||||
// Crops
|
||||
public static final Block BLOSSOM_BERRY = registerBlock("blossom_berry_seed", new EndCropBlock(EndItems.BLOSSOM_BERRY, PINK_MOSS));
|
||||
|
|
|
@ -73,6 +73,7 @@ public class EndItems {
|
|||
public final static Item LEATHER_STRIPE = registerItem("leather_stripe");
|
||||
public final static Item LEATHER_WRAPPED_STICK = registerItem("leather_wrapped_stick");
|
||||
public final static Item SILK_FIBER = registerItem("silk_fiber");
|
||||
public final static Item LUMECORN_ROD = registerItem("lumecorn_rod");
|
||||
|
||||
// Armor //
|
||||
public static final Item TERMINITE_HELMET = registerItem("terminite_helmet", new ArmorItem(EndArmorMaterial.TERMINITE, EquipmentSlot.HEAD, makeItemSettings()));
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"variants": {
|
||||
"age=0": { "model": "betterend:block/lumecorn_seed_0" },
|
||||
"age=1": { "model": "betterend:block/lumecorn_seed_1" },
|
||||
"age=2": { "model": "betterend:block/lumecorn_seed_2" },
|
||||
"age=3": { "model": "betterend:block/lumecorn_seed_3" }
|
||||
}
|
||||
}
|
|
@ -589,5 +589,8 @@
|
|||
"block.betterend.thallasium_door": "Thallasium Door",
|
||||
"block.betterend.thallasium_plate": "Thallasium Pressure Plate",
|
||||
"block.betterend.thallasium_tile": "Thallasium Tile",
|
||||
"block.betterend.thallasium_trapdoor": "Thallasium Trapdoor"
|
||||
"block.betterend.thallasium_trapdoor": "Thallasium Trapdoor",
|
||||
|
||||
"block.betterend.lumecorn_seed": "Lumecorn Seed",
|
||||
"item.betterend.lumecorn_rod": "Lumecorn Rod"
|
||||
}
|
||||
|
|
|
@ -591,5 +591,8 @@
|
|||
"block.betterend.thallasium_door": "Талласиевая дверь",
|
||||
"block.betterend.thallasium_plate": "Талласиевая нажимная плита",
|
||||
"block.betterend.thallasium_tile": "Талласиевая плитка",
|
||||
"block.betterend.thallasium_trapdoor": "Талласиевый люк"
|
||||
"block.betterend.thallasium_trapdoor": "Талласиевый люк",
|
||||
|
||||
"block.betterend.lumecorn_seed": "Семя люмекорна",
|
||||
"item.betterend.lumecorn_rod": "Стержень люмекорна"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"intensity": 0.5,
|
||||
"red": 0.0,
|
||||
"green": 0.0,
|
||||
"blue": 1.0,
|
||||
"worksInFluid": true
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"intensity": 0.5,
|
||||
"red": 1.0,
|
||||
"green": 0.5,
|
||||
"blue": 0.0,
|
||||
"worksInFluid": true
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"intensity": 0.5,
|
||||
"red": 0.5,
|
||||
"green": 1.0,
|
||||
"blue": 0.0,
|
||||
"worksInFluid": true
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"defaultMaterial": "betterend:waving_floor_glow_50"
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"defaultMaterial": "betterend:glow_50"
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
{}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "betterend:block/cross_no_distortion",
|
||||
"textures": {
|
||||
"texture": "betterend:block/lumecorn_0"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "betterend:block/cross_no_distortion",
|
||||
"textures": {
|
||||
"texture": "betterend:block/lumecorn_1"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "betterend:block/cross_no_distortion",
|
||||
"textures": {
|
||||
"texture": "betterend:block/lumecorn_2"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "betterend:block/cross_no_distortion",
|
||||
"textures": {
|
||||
"texture": "betterend:block/lumecorn_3"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "betterend:item/lumecorn_seed"
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 378 B After Width: | Height: | Size: 378 B |
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
Loading…
Add table
Add a link
Reference in a new issue