Shadow berry

This commit is contained in:
paulevsGitch 2020-11-03 23:19:46 +03:00
parent 29a594fd10
commit 5c9eda39f2
24 changed files with 321 additions and 10 deletions

View file

@ -9,7 +9,7 @@ import ru.betterend.effects.EndEnchantments;
import ru.betterend.effects.EndPotions;
import ru.betterend.recipe.AlloyingRecipes;
import ru.betterend.recipe.CraftingRecipes;
import ru.betterend.recipe.SmeltigRecipes;
import ru.betterend.recipe.FurnaceRecipes;
import ru.betterend.recipe.SmithingRecipes;
import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndBlockEntities;
@ -42,7 +42,7 @@ public class BetterEnd implements ModInitializer {
EndEnchantments.register();
EndPotions.register();
CraftingRecipes.register();
SmeltigRecipes.register();
FurnaceRecipes.register();
AlloyingRecipes.register();
SmithingRecipes.register();
EndStructures.register();

View file

@ -15,7 +15,7 @@ import ru.betterend.util.MHelper;
public class BlockBlueVineSeed extends BlockPlantWithAge {
@Override
public void grow(StructureWorldAccess world, Random random, BlockPos pos) {
public void growAdult(StructureWorldAccess world, Random random, BlockPos pos) {
int height = MHelper.randRange(2, 5, random);
int h = BlocksHelper.upRay(world, pos, height + 2);
if (h < height + 1) {

View file

@ -0,0 +1,58 @@
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.StructureWorldAccess;
import net.minecraft.world.World;
import ru.betterend.blocks.basis.BlockPlantWithAge;
import ru.betterend.registry.EndItems;
import ru.betterend.util.MHelper;
public class BlockShadowBerry extends BlockPlantWithAge {
private static final VoxelShape SHAPE = Block.createCuboidShape(1, 0, 1, 15, 8, 15);
@Override
public void growAdult(StructureWorldAccess world, Random random, BlockPos pos) {}
@Override
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
if (state.get(AGE) < 3) {
return Lists.newArrayList(new ItemStack(this));
}
else {
return Lists.newArrayList(new ItemStack(this), new ItemStack(EndItems.SHADOW_BERRY_RAW, MHelper.randRange(1, 3, MHelper.RANDOM)));
}
}
@Override
public boolean isFertilizable(BlockView world, BlockPos pos, BlockState state, boolean isClient) {
return state.get(AGE) < 3;
}
@Override
public boolean canGrow(World world, Random random, BlockPos pos, BlockState state) {
return state.get(AGE) < 3;
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ePos) {
return SHAPE;
}
@Override
public AbstractBlock.OffsetType getOffsetType() {
return AbstractBlock.OffsetType.NONE;
}
}

View file

@ -31,7 +31,7 @@ public abstract class BlockPlantWithAge extends BlockPlant {
stateManager.add(AGE);
}
public abstract void grow(StructureWorldAccess world, Random random, BlockPos pos);
public abstract void growAdult(StructureWorldAccess world, Random random, BlockPos pos);
@Override
public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state) {
@ -41,7 +41,7 @@ public abstract class BlockPlantWithAge extends BlockPlant {
world.setBlockState(pos, state.with(AGE, age + 1));
}
else {
grow(world, random, pos);
growAdult(world, random, pos);
}
}
}

View file

@ -93,6 +93,7 @@ public class CraftingRecipes {
GridRecipe.make("aurora_block", EndBlocks.AURORA_CRYSTAL).setShape("##", "##").addMaterial('#', EndItems.CRYSTAL_SHARDS).build();
GridRecipe.make("lotus_block", EndBlocks.END_LOTUS.log).setShape("##", "##").addMaterial('#', EndBlocks.END_LOTUS_STEM).build();
GridRecipe.make("needlegrass_stick", Items.STICK).setList("#").setOutputCount(2).addMaterial('#', EndBlocks.NEEDLEGRASS).build();
GridRecipe.make("shadow_berry_seeds", EndBlocks.SHADOW_BERRY).setList("#").setOutputCount(4).addMaterial('#', EndItems.SHADOW_BERRY_RAW).build();
}
public static void registerPedestal(String name, Block pedestal, Block slab, Block pillar) {

View file

@ -5,9 +5,10 @@ import ru.betterend.recipe.builders.FurnaceRecipe;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndItems;
public class SmeltigRecipes {
public class FurnaceRecipes {
public static void register() {
FurnaceRecipe.make("end_lily_leaf_dried", EndItems.END_LILY_LEAF, EndItems.END_LILY_LEAF_DRIED).build();
FurnaceRecipe.make("end_glass", EndBlocks.ENDSTONE_DUST, Blocks.GLASS).build();
FurnaceRecipe.make("end_glass", EndItems.SHADOW_BERRY_RAW, EndItems.SHADOW_BERRY_COOKED).build();
}
}

View file

@ -28,10 +28,11 @@ import ru.betterend.blocks.BlockLacugroveSapling;
import ru.betterend.blocks.BlockMossyGlowshroomCap;
import ru.betterend.blocks.BlockMossyGlowshroomHymenophore;
import ru.betterend.blocks.BlockMossyGlowshroomSapling;
import ru.betterend.blocks.BlockPath;
import ru.betterend.blocks.BlockMurkweed;
import ru.betterend.blocks.BlockNeedlegrass;
import ru.betterend.blocks.BlockPath;
import ru.betterend.blocks.BlockPythadendronSapling;
import ru.betterend.blocks.BlockShadowBerry;
import ru.betterend.blocks.BlockShadowGrass;
import ru.betterend.blocks.BlockTerrain;
import ru.betterend.blocks.BlockTerrainPlant;
@ -131,6 +132,9 @@ public class EndBlocks {
public static final Block MURKWEED = registerBlock("murkweed", new BlockMurkweed());
public static final Block NEEDLEGRASS = registerBlock("needlegrass", new BlockNeedlegrass());
// Crops //
public static final Block SHADOW_BERRY = registerBlock("shadow_berry", new BlockShadowBerry());
// Vines //
public static final Block DENSE_VINE = registerBlock("dense_vine", new BlockVine(15, true));
public static final Block TWISTED_VINE = registerBlock("twisted_vine", new BlockVine());

View file

@ -12,6 +12,7 @@ import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.SpawnReason;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.BlockItem;
import net.minecraft.item.FoodComponent;
import net.minecraft.item.Item;
import net.minecraft.item.Item.Settings;
import net.minecraft.item.ItemStack;
@ -77,6 +78,10 @@ public class EndItems {
public static final ToolItem DIAMOND_HAMMER = registerTool("diamond_hammer", new EndHammer(ToolMaterials.DIAMOND, 5.5F, -3.1F, 0.2D, makeSettings()));
public static final ToolItem NETHERITE_HAMMER = registerTool("netherite_hammer", new EndHammer(ToolMaterials.NETHERITE, 5.0F, -3.0F, 0.2D, makeSettings()));
// Food //
public final static Item SHADOW_BERRY_RAW = registerFood("shadow_berry_raw", 4, 0.5F);
public final static Item SHADOW_BERRY_COOKED = registerFood("shadow_berry_cooked", 6, 0.7F);
// Other //
public static final Item ETERNAL_CRYSTAL = registerItem("eternal_crystal", new EternalCrystal());
@ -131,6 +136,14 @@ public class EndItems {
return registerItem(name, item);
}
public static Item registerFood(String name, int hunger, float saturation) {
return registerFood(name, new FoodComponent.Builder().hunger(hunger).saturationModifier(saturation).build());
}
public static Item registerFood(String name, FoodComponent foodComponent) {
return registerItem(name, new Item(makeSettings().food(foodComponent)));
}
public static Settings makeSettings() {
return new Item.Settings().group(CreativeTab.END_TAB);
}

View file

@ -30,7 +30,7 @@ public class BlueVineFeature extends ScatterFeature {
}
else {
BlockPlantWithAge seed = ((BlockPlantWithAge) EndBlocks.BLUE_VINE_SEED);
seed.grow(world, random, blockPos);
seed.growAdult(world, random, blockPos);
}
}
}

View file

@ -0,0 +1,28 @@
{
"variants": {
"age=0": [
{ "model": "betterend:block/shadow_berry_01" },
{ "model": "betterend:block/shadow_berry_01", "y": 90 },
{ "model": "betterend:block/shadow_berry_01", "y": 180 },
{ "model": "betterend:block/shadow_berry_01", "y": 270 }
],
"age=1": [
{ "model": "betterend:block/shadow_berry_02" },
{ "model": "betterend:block/shadow_berry_02", "y": 90 },
{ "model": "betterend:block/shadow_berry_02", "y": 180 },
{ "model": "betterend:block/shadow_berry_02", "y": 270 }
],
"age=2": [
{ "model": "betterend:block/shadow_berry_03" },
{ "model": "betterend:block/shadow_berry_03", "y": 90 },
{ "model": "betterend:block/shadow_berry_03", "y": 180 },
{ "model": "betterend:block/shadow_berry_03", "y": 270 }
],
"age=3": [
{ "model": "betterend:block/shadow_berry_04" },
{ "model": "betterend:block/shadow_berry_04", "y": 90 },
{ "model": "betterend:block/shadow_berry_04", "y": 180 },
{ "model": "betterend:block/shadow_berry_04", "y": 270 }
]
}
}

View file

@ -269,5 +269,9 @@
"block.betterend.murkweed": "Murkweed",
"block.betterend.needlegrass": "Needlegrass",
"block.betterend.twisted_vine": "Twisted Vine"
"block.betterend.twisted_vine": "Twisted Vine",
"block.betterend.shadow_berry": "Shadow Berry Seeds",
"item.betterend.shadow_berry_cooked": "Shadow Berry Cooked",
"item.betterend.shadow_berry_raw": "Shadow Berry"
}

View file

@ -271,5 +271,9 @@
"block.betterend.murkweed": "Мракотрава",
"block.betterend.needlegrass": "Иголкоцвет",
"block.betterend.twisted_vine": "Закрученная лоза"
"block.betterend.twisted_vine": "Закрученная лоза",
"block.betterend.shadow_berry": "Семена теневой ягоды",
"item.betterend.shadow_berry_cooked": "Приготовленная теневая ягода",
"item.betterend.shadow_berry_raw": "Теневая ягода"
}

View file

@ -0,0 +1,19 @@
{
"__comment": "Designed by Paulevs with Cubik Studio - https://cubik.studio",
"textures": {
"particle": "betterend:block/shadow_berry",
"texture": "betterend:block/shadow_berry",
"texture1": "betterend:block/shadow_berry_leaves"
},
"elements": [
{
"__comment": "PlaneY4",
"from": [ 0, 0.5, 0 ],
"to": [ 16, 0.501, 16 ],
"faces": {
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture1" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture1" }
}
}
]
}

View file

@ -0,0 +1,45 @@
{
"__comment": "Designed by Paulevs with Cubik Studio - https://cubik.studio",
"textures": {
"particle": "betterend:block/shadow_berry",
"texture": "betterend:block/shadow_berry",
"texture1": "betterend:block/shadow_berry_leaves"
},
"elements": [
{
"__comment": "Box1",
"from": [ 3, 0, 3 ],
"to": [ 7, 4, 7 ],
"faces": {
"down": { "uv": [ 10, 10, 14, 14 ], "texture": "#texture" },
"up": { "uv": [ 8.5, 0.5, 12.5, 4.5 ], "texture": "#texture" },
"north": { "uv": [ 2, 11, 6, 15 ], "texture": "#texture" },
"south": { "uv": [ 2, 11, 6, 15 ], "texture": "#texture" },
"west": { "uv": [ 2, 11, 6, 15 ], "texture": "#texture" },
"east": { "uv": [ 2, 11, 6, 15 ], "texture": "#texture" }
}
},
{
"__comment": "Box1",
"from": [ 11.5, 0, 6.5 ],
"to": [ 14.5, 3, 9.5 ],
"faces": {
"down": { "uv": [ 12, 12, 15, 15 ], "texture": "#texture" },
"up": { "uv": [ 9, 1, 12, 4 ], "texture": "#texture" },
"north": { "uv": [ 4, 11, 7, 14 ], "texture": "#texture" },
"south": { "uv": [ 4, 11, 7, 14 ], "texture": "#texture" },
"west": { "uv": [ 4, 11, 7, 14 ], "texture": "#texture" },
"east": { "uv": [ 4, 11, 7, 14 ], "texture": "#texture" }
}
},
{
"__comment": "PlaneY4",
"from": [ 0, 0.5, 0 ],
"to": [ 16, 0.501, 16 ],
"faces": {
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture1" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture1" }
}
}
]
}

View file

@ -0,0 +1,58 @@
{
"__comment": "Designed by Paulevs with Cubik Studio - https://cubik.studio",
"textures": {
"particle": "betterend:block/shadow_berry",
"texture": "betterend:block/shadow_berry",
"texture1": "betterend:block/shadow_berry_leaves"
},
"elements": [
{
"__comment": "Box1",
"from": [ 2, 0, 2 ],
"to": [ 8, 6, 8 ],
"faces": {
"down": { "uv": [ 9, 9, 15, 15 ], "texture": "#texture" },
"up": { "uv": [ 1, 1, 7, 7 ], "texture": "#texture" },
"north": { "uv": [ 1, 10, 7, 16 ], "texture": "#texture" },
"south": { "uv": [ 1, 10, 7, 16 ], "texture": "#texture" },
"west": { "uv": [ 1, 10, 7, 16 ], "texture": "#texture" },
"east": { "uv": [ 1, 10, 7, 16 ], "texture": "#texture" }
}
},
{
"__comment": "Box1",
"from": [ 11, 0, 6 ],
"to": [ 15, 4, 10 ],
"faces": {
"down": { "uv": [ 10, 10, 14, 14 ], "texture": "#texture" },
"up": { "uv": [ 8.5, 0.5, 12.5, 4.5 ], "texture": "#texture" },
"north": { "uv": [ 1, 11, 5, 15 ], "texture": "#texture" },
"south": { "uv": [ 1, 11, 5, 15 ], "texture": "#texture" },
"west": { "uv": [ 1, 11, 5, 15 ], "texture": "#texture" },
"east": { "uv": [ 1, 11, 5, 15 ], "texture": "#texture" }
}
},
{
"__comment": "Box1",
"from": [ 4, 0, 11 ],
"to": [ 7, 3, 14 ],
"faces": {
"down": { "uv": [ 12, 12, 15, 15 ], "texture": "#texture" },
"up": { "uv": [ 9, 1, 12, 4 ], "texture": "#texture" },
"north": { "uv": [ 4, 11, 7, 14 ], "texture": "#texture" },
"south": { "uv": [ 4, 11, 7, 14 ], "texture": "#texture" },
"west": { "uv": [ 4, 11, 7, 14 ], "texture": "#texture" },
"east": { "uv": [ 4, 11, 7, 14 ], "texture": "#texture" }
}
},
{
"__comment": "PlaneY4",
"from": [ 0, 0.5, 0 ],
"to": [ 16, 0.501, 16 ],
"faces": {
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture1" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture1" }
}
}
]
}

View file

@ -0,0 +1,58 @@
{
"__comment": "Designed by Paulevs with Cubik Studio - https://cubik.studio",
"textures": {
"particle": "betterend:block/shadow_berry",
"texture": "betterend:block/shadow_berry",
"texture1": "betterend:block/shadow_berry_leaves"
},
"elements": [
{
"__comment": "Box1",
"from": [ 1, 0, 1 ],
"to": [ 9, 8, 9 ],
"faces": {
"down": { "uv": [ 8, 8, 16, 16 ], "texture": "#texture" },
"up": { "uv": [ 0, 0, 8, 8 ], "texture": "#texture" },
"north": { "uv": [ 0, 8, 8, 16 ], "texture": "#texture" },
"south": { "uv": [ 0, 8, 8, 16 ], "texture": "#texture" },
"west": { "uv": [ 0, 8, 8, 16 ], "texture": "#texture" },
"east": { "uv": [ 0, 8, 8, 16 ], "texture": "#texture" }
}
},
{
"__comment": "Box1",
"from": [ 10, 0, 5 ],
"to": [ 16, 6, 11 ],
"faces": {
"down": { "uv": [ 9, 9, 15, 15 ], "texture": "#texture" },
"up": { "uv": [ 1, 1, 7, 7 ], "texture": "#texture" },
"north": { "uv": [ 0, 10, 6, 16 ], "texture": "#texture" },
"south": { "uv": [ 0, 10, 6, 16 ], "texture": "#texture" },
"west": { "uv": [ 0, 10, 6, 16 ], "texture": "#texture" },
"east": { "uv": [ 0, 10, 6, 16 ], "texture": "#texture" }
}
},
{
"__comment": "Box1",
"from": [ 3, 0, 10 ],
"to": [ 8, 5, 15 ],
"faces": {
"down": { "uv": [ 11, 11, 16, 16 ], "texture": "#texture" },
"up": { "uv": [ 8, 0, 13, 5 ], "texture": "#texture" },
"north": { "uv": [ 3, 11, 8, 16 ], "texture": "#texture" },
"south": { "uv": [ 3, 11, 8, 16 ], "texture": "#texture" },
"west": { "uv": [ 3, 11, 8, 16 ], "texture": "#texture" },
"east": { "uv": [ 3, 11, 8, 16 ], "texture": "#texture" }
}
},
{
"__comment": "PlaneY4",
"from": [ 0, 0.5, 0 ],
"to": [ 16, 0.501, 16 ],
"faces": {
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture1" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture1" }
}
}
]
}

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "betterend:item/shadow_berry_seeds"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "betterend:item/shadow_berry_cooked"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "betterend:item/shadow_berry"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB