Additional plants

This commit is contained in:
paulevsGitch 2021-03-17 14:26:39 +03:00
parent 37b24bfcaf
commit c3ce436fe0
59 changed files with 1468 additions and 5 deletions

View file

@ -0,0 +1,57 @@
package ru.betterend.blocks;
import java.util.List;
import java.util.Random;
import com.google.common.collect.Lists;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.ShapeContext;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootContext;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import ru.betterend.blocks.basis.EndPlantBlock;
import ru.betterend.registry.EndBlocks;
public class BoluxMushroomBlock extends EndPlantBlock {
private static final VoxelShape SHAPE = Block.createCuboidShape(1, 0, 1, 15, 9, 15);
public BoluxMushroomBlock() {
super(10);
}
@Override
protected boolean isTerrain(BlockState state) {
return state.isOf(EndBlocks.RUTISCUS);
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ePos) {
return SHAPE;
}
@Override
public AbstractBlock.OffsetType getOffsetType() {
return AbstractBlock.OffsetType.NONE;
}
@Override
public boolean isFertilizable(BlockView world, BlockPos pos, BlockState state, boolean isClient) {
return false;
}
@Override
public boolean canGrow(World world, Random random, BlockPos pos, BlockState state) {
return false;
}
@Override
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
return Lists.newArrayList(new ItemStack(this));
}
}

View file

@ -0,0 +1,63 @@
package ru.betterend.blocks;
import java.util.List;
import com.google.common.collect.Lists;
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.Block;
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.sound.BlockSoundGroup;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import ru.betterend.blocks.basis.EndPlantBlock;
import ru.betterend.interfaces.ISpetialItem;
public class FlamaeaBlock extends EndPlantBlock implements ISpetialItem {
private static final VoxelShape SHAPE = Block.createCuboidShape(0, 0, 0, 16, 1, 16);
public FlamaeaBlock() {
super(FabricBlockSettings.of(Material.PLANT)
.breakByTool(FabricToolTags.SHEARS)
.sounds(BlockSoundGroup.WET_GRASS)
.breakByHand(true));
}
@Override
protected boolean isTerrain(BlockState state) {
return state.isOf(Blocks.WATER);
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ePos) {
return SHAPE;
}
@Override
public AbstractBlock.OffsetType getOffsetType() {
return AbstractBlock.OffsetType.NONE;
}
@Override
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
return Lists.newArrayList(new ItemStack(this));
}
@Override
public int getStackSize() {
return 64;
}
@Override
public boolean canPlaceOnWater() {
return true;
}
}

View file

@ -13,6 +13,7 @@ import net.minecraft.block.ShapeContext;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemPlacementContext;
@ -38,11 +39,12 @@ import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import ru.betterend.blocks.entities.ESignBlockEntity;
import ru.betterend.interfaces.ISpetialItem;
import ru.betterend.patterns.BlockPatterned;
import ru.betterend.patterns.Patterns;
import ru.betterend.util.BlocksHelper;
public class EndSignBlock extends AbstractSignBlock implements BlockPatterned {
public class EndSignBlock extends AbstractSignBlock implements BlockPatterned, ISpetialItem {
public static final IntProperty ROTATION = Properties.ROTATION;
public static final BooleanProperty FLOOR = BooleanProperty.of("floor");
private static final VoxelShape[] WALL_SHAPES = new VoxelShape[] {
@ -177,4 +179,32 @@ public class EndSignBlock extends AbstractSignBlock implements BlockPatterned {
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
return Collections.singletonList(new ItemStack(this));
}
@Override
public Fluid tryDrainFluid(WorldAccess world, BlockPos pos, BlockState state) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean canFillWithFluid(BlockView world, BlockPos pos, BlockState state, Fluid fluid) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean tryFillWithFluid(WorldAccess world, BlockPos pos, BlockState state, FluidState fluidState) {
// TODO Auto-generated method stub
return false;
}
@Override
public int getStackSize() {
return 16;
}
@Override
public boolean canPlaceOnWater() {
return false;
}
}

View file

@ -0,0 +1,7 @@
package ru.betterend.interfaces;
public interface ISpetialItem {
public int getStackSize();
public boolean canPlaceOnWater();
}

View file

@ -1,8 +1,13 @@
package ru.betterend.item;
import net.minecraft.advancement.criterion.Criteria;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsage;
import net.minecraft.item.Items;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.stat.Stats;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.UseAction;
@ -27,4 +32,23 @@ public class DrinkItem extends PatternedItem {
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
return ItemUsage.consumeHeldItem(world, user, hand);
}
@Override
public ItemStack finishUsing(ItemStack stack, World world, LivingEntity user) {
if (user instanceof ServerPlayerEntity) {
ServerPlayerEntity serverPlayerEntity = (ServerPlayerEntity) user;
Criteria.CONSUME_ITEM.trigger(serverPlayerEntity, stack);
serverPlayerEntity.incrementStat(Stats.USED.getOrCreateStat(this));
}
if (user instanceof PlayerEntity && !((PlayerEntity) user).abilities.creativeMode) {
stack.decrement(1);
}
if (!world.isClient) {
user.clearStatusEffects();
}
return stack.isEmpty() ? new ItemStack(Items.GLASS_BOTTLE) : stack;
}
}

View file

@ -4,6 +4,8 @@ import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.block.MaterialColor;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item.Settings;
import net.minecraft.item.LilyPadItem;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import ru.betterend.BetterEnd;
@ -18,6 +20,7 @@ import ru.betterend.blocks.AuroraCrystalBlock;
import ru.betterend.blocks.BlueVineBlock;
import ru.betterend.blocks.BlueVineLanternBlock;
import ru.betterend.blocks.BlueVineSeedBlock;
import ru.betterend.blocks.BoluxMushroomBlock;
import ru.betterend.blocks.BrimstoneBlock;
import ru.betterend.blocks.BubbleCoralBlock;
import ru.betterend.blocks.BulbVineBlock;
@ -47,6 +50,7 @@ import ru.betterend.blocks.EndstoneDustBlock;
import ru.betterend.blocks.EternalPedestal;
import ru.betterend.blocks.EternalRunedFlavolite;
import ru.betterend.blocks.FilaluxLanternBlock;
import ru.betterend.blocks.FlamaeaBlock;
import ru.betterend.blocks.GlowingHymenophoreBlock;
import ru.betterend.blocks.GlowingMossBlock;
import ru.betterend.blocks.GlowingPillarLuminophorBlock;
@ -105,7 +109,6 @@ import ru.betterend.blocks.basis.EndFurnaceBlock;
import ru.betterend.blocks.basis.EndLeavesBlock;
import ru.betterend.blocks.basis.EndOreBlock;
import ru.betterend.blocks.basis.EndPillarBlock;
import ru.betterend.blocks.basis.EndSignBlock;
import ru.betterend.blocks.basis.EndSlabBlock;
import ru.betterend.blocks.basis.EndStairsBlock;
import ru.betterend.blocks.basis.EndUnderwaterWallPlantBlock;
@ -122,6 +125,7 @@ import ru.betterend.blocks.complex.MetalMaterial;
import ru.betterend.blocks.complex.StoneMaterial;
import ru.betterend.blocks.complex.WoodenMaterial;
import ru.betterend.config.Configs;
import ru.betterend.interfaces.ISpetialItem;
import ru.betterend.item.material.EndArmorMaterial;
import ru.betterend.item.material.EndToolMaterial;
@ -277,6 +281,7 @@ public class EndBlocks {
public static final Block GLOWING_PILLAR_LEAVES = registerBlock("glowing_pillar_leaves", new FurBlock(GLOWING_PILLAR_SEED, 15, 3));
public static final Block SMALL_JELLYSHROOM = registerBlock("small_jellyshroom", new SmallJellyshroomBlock());
public static final Block BOLUX_MUSHROOM = registerBlock("bolux_mushroom", new BoluxMushroomBlock());
public static final Block LUMECORN_SEED = registerBlock("lumecorn_seed", new LumecornSeedBlock());
public static final Block LUMECORN = registerBlockNI("lumecorn", new LumecornBlock());
@ -316,6 +321,10 @@ public class EndBlocks {
public static final Block HYDRALUX_PETAL_BLOCK = registerBlock("hydralux_petal_block", new HydraluxPetalBlock());
public static final ColoredMaterial HYDRALUX_PETAL_BLOCK_COLORED = new ColoredMaterial(HydraluxPetalColoredBlock::new, HYDRALUX_PETAL_BLOCK, true);
public static final Block POND_ANEMONE = registerBlock("pond_anemone", new BubbleCoralBlock());
public static final Block FLAMAEA = registerBlock("flamaea", new FlamaeaBlock());
public static final Block CAVE_BUSH = registerBlock("cave_bush", new SimpleLeavesBlock(MaterialColor.MAGENTA));
public static final Block MURKWEED = registerBlock("murkweed", new MurkweedBlock());
@ -323,12 +332,14 @@ public class EndBlocks {
// Wall Plants //
public static final Block PURPLE_POLYPORE = registerBlock("purple_polypore", new WallMushroomBlock(13));
public static final Block AURANT_POLYPORE = registerBlock("aurant_polypore", new WallMushroomBlock(13));
public static final Block TAIL_MOSS = registerBlock("tail_moss", new EndWallPlantBlock());
public static final Block CYAN_MOSS = registerBlock("cyan_moss", new EndWallPlantBlock());
public static final Block TWISTED_MOSS = registerBlock("twisted_moss", new EndWallPlantBlock());
public static final Block TUBE_WORM = registerBlock("tube_worm", new EndUnderwaterWallPlantBlock());
public static final Block BULB_MOSS = registerBlock("bulb_moss", new EndWallPlantBlock(12));
public static final Block JUNGLE_FERN = registerBlock("jungle_fern", new EndWallPlantBlock());
public static final Block RUSCUS = registerBlock("ruscus", new EndWallPlantBlock());
// Vines //
public static final Block DENSE_VINE = registerBlock("dense_vine", new VineBlock(15, true));
@ -394,8 +405,20 @@ public class EndBlocks {
return block;
}
Registry.register(Registry.BLOCK, id, block);
int maxCount = block instanceof EndSignBlock ? 16 : 64;
EndItems.registerBlockItem(id, new BlockItem(block, EndItems.makeBlockItemSettings().maxCount(maxCount)));
int maxCount = 64;
boolean placeOnWater = false;
if (block instanceof ISpetialItem) {
ISpetialItem item = (ISpetialItem) block;
maxCount = item.getStackSize();
placeOnWater = item.canPlaceOnWater();
}
Settings item = EndItems.makeBlockItemSettings().maxCount(maxCount);
if (placeOnWater) {
EndItems.registerBlockItem(id, new LilyPadItem(block, item));
}
else {
EndItems.registerBlockItem(id, new BlockItem(block, item));
}
return block;
}

View file

@ -123,6 +123,7 @@ public class EndFeatures {
public static final EndFeature SMALL_AMARANITA = new EndFeature("small_amaranita", new SinglePlantFeature(EndBlocks.SMALL_AMARANITA_MUSHROOM, 5, 5), 4);
public static final EndFeature GLOBULAGUS = new EndFeature("globulagus", new SinglePlantFeature(EndBlocks.GLOBULAGUS, 5, 3), 6);
public static final EndFeature CLAWFERN = new EndFeature("clawfern", new SinglePlantFeature(EndBlocks.CLAWFERN, 5, 4), 5);
public static final EndFeature BOLUX_MUSHROOM = new EndFeature("bolux_mushroom", new SinglePlantFeature(EndBlocks.BOLUX_MUSHROOM, 5, 5), 2);
// Vines //
public static final EndFeature DENSE_VINE = new EndFeature("dense_vine", new VineFeature(EndBlocks.DENSE_VINE, 24), 3);
@ -135,6 +136,7 @@ public class EndFeatures {
// Wall Plants //
public static final EndFeature PURPLE_POLYPORE = new EndFeature("purple_polypore", new WallPlantOnLogFeature(EndBlocks.PURPLE_POLYPORE, 3), 5);
public static final EndFeature AURANT_POLYPORE = new EndFeature("aurant_polypore", new WallPlantOnLogFeature(EndBlocks.AURANT_POLYPORE, 3), 5);
public static final EndFeature TAIL_MOSS = new EndFeature("tail_moss", new WallPlantFeature(EndBlocks.TAIL_MOSS, 3), 15);
public static final EndFeature CYAN_MOSS = new EndFeature("cyan_moss", new WallPlantFeature(EndBlocks.CYAN_MOSS, 3), 15);
public static final EndFeature TAIL_MOSS_WOOD = new EndFeature("tail_moss_wood", new WallPlantOnLogFeature(EndBlocks.TAIL_MOSS, 4), 25);
@ -158,6 +160,7 @@ public class EndFeatures {
public static final EndFeature END_LOTUS = new EndFeature("end_lotus", new EndLotusFeature(7), 5);
public static final EndFeature END_LOTUS_LEAF = new EndFeature("end_lotus_leaf", new EndLotusLeafFeature(20), 25);
public static final EndFeature HYDRALUX = new EndFeature("hydralux", new HydraluxFeature(5), 5);
public static final EndFeature POND_ANEMONE = new EndFeature("pond_anemone", new UnderwaterPlantFeature(EndBlocks.POND_ANEMONE, 6), 10);
public static final EndFeature CHARNIA_RED = new EndFeature("charnia_red", new CharniaFeature(EndBlocks.CHARNIA_RED), 10);
public static final EndFeature CHARNIA_PURPLE = new EndFeature("charnia_purple", new CharniaFeature(EndBlocks.CHARNIA_PURPLE), 10);
@ -168,6 +171,7 @@ public class EndFeatures {
public static final EndFeature MENGER_SPONGE = new EndFeature("menger_sponge", new MengerSpongeFeature(5), 1);
public static final EndFeature CHARNIA_RED_RARE = new EndFeature("charnia_red_rare", new CharniaFeature(EndBlocks.CHARNIA_RED), 2);
public static final EndFeature OVERWORLD_ISLAND = EndFeature.makeFetureConfigured("overworld_island", new OverworldIslandFeature());
public static final EndFeature FLAMAEA = new EndFeature("flamaea", new SinglePlantFeature(EndBlocks.FLAMAEA, 12, false, 5), 20);
// Terrain //
public static final EndFeature END_LAKE = EndFeature.makeLakeFeature("end_lake", new EndLakeFeature(), 4);

View file

@ -120,6 +120,7 @@ public class EndItems {
public final static Item AMBER_ROOT_RAW = registerFood("amber_root_raw", 2, 0.8F);
public final static Item CHORUS_MUSHROOM_RAW = registerFood("chorus_mushroom_raw", 3, 0.5F);
public final static Item CHORUS_MUSHROOM_COOKED = registerFood("chorus_mushroom_cooked", FoodComponents.MUSHROOM_STEW);
public final static Item BOLUX_MUSHROOM_COOKED = registerFood("bolux_mushroom_cooked", FoodComponents.MUSHROOM_STEW);
// Drinks //
public final static Item UMBRELLA_CLUSTER_JUICE = registerDrink("umbrella_cluster_juice", 5, 0.7F);

View file

@ -18,11 +18,17 @@ public class LanternWoodsBiome extends EndBiome {
.setMusic(EndSounds.MUSIC_FOREST)
.setParticles(EndParticles.GLOWING_SPHERE, 0.001F)
.addFeature(EndFeatures.END_LAKE_NORMAL)
.addFeature(EndFeatures.FLAMAEA)
.addFeature(EndFeatures.LUCERNIA)
.addFeature(EndFeatures.LUCERNIA_BUSH)
.addFeature(EndFeatures.FILALUX)
.addFeature(EndFeatures.AERIDIUM)
.addFeature(EndFeatures.LAMELLARIUM)
.addFeature(EndFeatures.BOLUX_MUSHROOM)
.addFeature(EndFeatures.AURANT_POLYPORE)
.addFeature(EndFeatures.POND_ANEMONE)
.addFeature(EndFeatures.CHARNIA_ORANGE)
.addFeature(EndFeatures.CHARNIA_RED)
.addStructureFeature(ConfiguredStructureFeatures.END_CITY)
.addMobSpawn(EntityType.ENDERMAN, 50, 1, 2));
}