Lanceleaf, more moss variation, translations

This commit is contained in:
paulevsGitch 2020-12-10 13:04:11 +03:00
parent 5bd4abebfb
commit 2183fe5829
43 changed files with 480 additions and 35 deletions

View file

@ -0,0 +1,53 @@
package ru.betterend.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.EnumProperty;
import net.minecraft.state.property.IntProperty;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import ru.betterend.blocks.BlockProperties.PentaShape;
import ru.betterend.blocks.basis.BlockPlant;
import ru.betterend.registry.EndBlocks;
public class BlockLanceleaf extends BlockPlant {
public static final EnumProperty<PentaShape> SHAPE = BlockProperties.PENTA_SHAPE;
public static final IntProperty ROTATION = BlockProperties.ROTATION;
public BlockLanceleaf() {
super();
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) {
stateManager.add(SHAPE, ROTATION);
}
@Override
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
PentaShape shape = state.get(SHAPE);
if (shape == PentaShape.TOP) {
return world.getBlockState(pos.down()).isOf(this);
}
else if (shape == PentaShape.BOTTOM) {
return world.getBlockState(pos.down()).isOf(EndBlocks.AMBER_MOSS) && world.getBlockState(pos.up()).isOf(this);
}
else {
return world.getBlockState(pos.down()).isOf(this) && world.getBlockState(pos.up()).isOf(this);
}
}
@Override
public BlockState getStateForNeighborUpdate(BlockState state, Direction facing, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) {
if (!canPlaceAt(state, world, pos)) {
return Blocks.AIR.getDefaultState();
}
else {
return state;
}
}
}

View file

@ -0,0 +1,40 @@
package ru.betterend.blocks;
import java.util.Random;
import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.BlockPos.Mutable;
import net.minecraft.world.StructureWorldAccess;
import ru.betterend.blocks.BlockProperties.PentaShape;
import ru.betterend.blocks.basis.BlockPlantWithAge;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
public class BlockLanceleafSeed extends BlockPlantWithAge {
@Override
public void growAdult(StructureWorldAccess world, Random random, BlockPos pos) {
int height = MHelper.randRange(4, 6, random);
int h = BlocksHelper.upRay(world, pos, height + 2);
if (h < height + 1) {
return;
}
int rotation = random.nextInt(4);
Mutable mut = new Mutable().set(pos);
BlockState plant = EndBlocks.LANCELEAF.getDefaultState().with(BlockProperties.ROTATION, rotation);
BlocksHelper.setWithoutUpdate(world, mut, plant.with(BlockProperties.PENTA_SHAPE, PentaShape.BOTTOM));
BlocksHelper.setWithoutUpdate(world, mut.move(Direction.UP), plant.with(BlockProperties.PENTA_SHAPE, PentaShape.PRE_BOTTOM));
for (int i = 2; i < height - 2; i++) {
BlocksHelper.setWithoutUpdate(world, mut.move(Direction.UP), plant.with(BlockProperties.PENTA_SHAPE, PentaShape.MIDDLE));
}
BlocksHelper.setWithoutUpdate(world, mut.move(Direction.UP), plant.with(BlockProperties.PENTA_SHAPE, PentaShape.PRE_TOP));
BlocksHelper.setWithoutUpdate(world, mut.move(Direction.UP), plant.with(BlockProperties.PENTA_SHAPE, PentaShape.TOP));
}
@Override
protected boolean isTerrain(BlockState state) {
return state.isOf(EndBlocks.AMBER_MOSS);
}
}

View file

@ -2,15 +2,18 @@ package ru.betterend.blocks;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.EnumProperty;
import net.minecraft.state.property.IntProperty;
import net.minecraft.util.StringIdentifiable;
public class BlockProperties {
public static final EnumProperty<TripleShape> TRIPLE_SHAPE = EnumProperty.of("shape", TripleShape.class);
public final static EnumProperty<PedestalState> PEDESTAL_STATE = EnumProperty.of("state", PedestalState.class);
public static final EnumProperty<HydraluxShape> HYDRALUX_SHAPE = EnumProperty.of("shape", HydraluxShape.class);
public static final EnumProperty<PentaShape> PENTA_SHAPE = EnumProperty.of("shape", PentaShape.class);
public static final BooleanProperty HAS_ITEM = BooleanProperty.of("has_item");
public static final BooleanProperty HAS_LIGHT = BooleanProperty.of("has_light");
public static final BooleanProperty ACTIVATED = BooleanProperty.of("active");
public static final IntProperty ROTATION = IntProperty.of("rotation", 0, 3);
public static enum TripleShape implements StringIdentifiable {
TOP("top"),
@ -89,4 +92,28 @@ public class BlockProperties {
return glow;
}
}
public static enum PentaShape implements StringIdentifiable {
BOTTOM("bottom"),
PRE_BOTTOM("pre_bottom"),
MIDDLE("middle"),
PRE_TOP("pre_top"),
TOP("top");
private final String name;
PentaShape(String name) {
this.name = name;
}
@Override
public String asString() {
return name;
}
@Override
public String toString() {
return name;
}
}
}

View file

@ -34,6 +34,7 @@ import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import ru.betterend.blocks.BlockProperties;
import ru.betterend.client.render.ERenderLayer;
import ru.betterend.interfaces.IRenderTypeable;
import ru.betterend.registry.EndTags;
@ -41,7 +42,7 @@ import ru.betterend.util.BlocksHelper;
public class BlockDoublePlant extends BlockBaseNotFull implements IRenderTypeable, Fertilizable {
private static final VoxelShape SHAPE = Block.createCuboidShape(4, 2, 4, 12, 16, 12);
public static final IntProperty ROTATION = IntProperty.of("rotation", 0, 3);
public static final IntProperty ROTATION = BlockProperties.ROTATION;
public static final BooleanProperty TOP = BooleanProperty.of("top");
public BlockDoublePlant() {

View file

@ -36,6 +36,8 @@ import ru.betterend.blocks.BlockHydraluxPetalColored;
import ru.betterend.blocks.BlockHydraluxSapling;
import ru.betterend.blocks.BlockHydrothermalVent;
import ru.betterend.blocks.BlockLacugroveSapling;
import ru.betterend.blocks.BlockLanceleaf;
import ru.betterend.blocks.BlockLanceleafSeed;
import ru.betterend.blocks.BlockMengerSponge;
import ru.betterend.blocks.BlockMengerSpongeWet;
import ru.betterend.blocks.BlockMossyGlowshroomCap;
@ -173,6 +175,9 @@ public class EndBlocks {
public static final Block BLUE_VINE_LANTERN = registerBlock("blue_vine_lantern", new BlockBlueVineLantern());
public static final Block BLUE_VINE_FUR = registerBlock("blue_vine_fur", new BlockFur(BLUE_VINE_SEED, 15, 3));
public static final Block LANCELEAF_SEED = registerBlock("lanceleaf_seed", new BlockLanceleafSeed());
public static final Block LANCELEAF = registerBlockNI("lanceleaf", new BlockLanceleaf());
public static final Block BUBBLE_CORAL = registerBlock("bubble_coral", new BlockBubbleCoral());
public static final Block MENGER_SPONGE = registerBlock("menger_sponge", new BlockMengerSponge());
public static final Block MENGER_SPONGE_WET = registerBlock("menger_sponge_wet", new BlockMengerSpongeWet());

View file

@ -20,6 +20,7 @@ import ru.betterend.world.features.EndLilyFeature;
import ru.betterend.world.features.EndLotusFeature;
import ru.betterend.world.features.EndLotusLeafFeature;
import ru.betterend.world.features.HydraluxFeature;
import ru.betterend.world.features.LanceleafFeature;
import ru.betterend.world.features.MengerSpongeFeature;
import ru.betterend.world.features.SinglePlantFeature;
import ru.betterend.world.features.UnderwaterPlantFeature;
@ -70,6 +71,7 @@ public class EndFeatures {
public static final EndFeature BUSHY_GRASS = new EndFeature("bushy_grass", new SinglePlantFeature(EndBlocks.BUSHY_GRASS, 8, false), 20);
public static final EndFeature BUSHY_GRASS_WG = new EndFeature("bushy_grass_wg", new SinglePlantFeature(EndBlocks.BUSHY_GRASS, 5), 10);
public static final EndFeature AMBER_GRASS = new EndFeature("amber_grass", new SinglePlantFeature(EndBlocks.AMBER_GRASS, 6), 9);
public static final EndFeature LANCELEAF = new EndFeature("lanceleaf", new LanceleafFeature(), 1);
// Vines //
public static final EndFeature DENSE_VINE = new EndFeature("dense_vine", new VineFeature(EndBlocks.DENSE_VINE, 24), 3);

View file

@ -26,13 +26,15 @@ public class TranslationHelper {
JsonObject translationEn = gson.fromJson(new InputStreamReader(streamEn), JsonObject.class);
JsonObject translationRu = gson.fromJson(new InputStreamReader(streamRu), JsonObject.class);
EndItems.getModBlocks().forEach((block) -> {
String name = block.getName().getString();
if (!translationEn.has(name)) {
missingNamesEn.add(name);
}
if (!translationRu.has(name)) {
missingNamesRu.add(name);
Registry.BLOCK.forEach((block) -> {
if (Registry.BLOCK.getId(block).getNamespace().equals(BetterEnd.MOD_ID)) {
String name = block.getName().getString();
if (!translationEn.has(name)) {
missingNamesEn.add(name);
}
if (!translationRu.has(name)) {
missingNamesRu.add(name);
}
}
});

View file

@ -15,6 +15,7 @@ public class BiomeAmberLand extends EndBiome {
.addFeature(EndFeatures.AMBER_ORE)
.addFeature(EndFeatures.END_LAKE_RARE)
.addFeature(EndFeatures.HELIX_TREE)
.addFeature(EndFeatures.LANCELEAF)
.addFeature(EndFeatures.AMBER_GRASS)
.addFeature(EndFeatures.CHARNIA_ORANGE)
.addFeature(EndFeatures.CHARNIA_RED)

View file

@ -0,0 +1,25 @@
package ru.betterend.world.features;
import java.util.Random;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.StructureWorldAccess;
import ru.betterend.blocks.basis.BlockPlantWithAge;
import ru.betterend.registry.EndBlocks;
public class LanceleafFeature extends ScatterFeature {
public LanceleafFeature() {
super(5);
}
@Override
public boolean canGenerate(StructureWorldAccess world, Random random, BlockPos center, BlockPos blockPos, float radius) {
return EndBlocks.LANCELEAF_SEED.canPlaceAt(AIR, world, blockPos);
}
@Override
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
BlockPlantWithAge seed = ((BlockPlantWithAge) EndBlocks.LANCELEAF_SEED);
seed.growAdult(world, random, blockPos);
}
}

View file

@ -74,10 +74,10 @@ public class HelixTreeFeature extends DefaultFeature {
for (int i = 0; i <= 20; i++) {
float radius = i * 0.1F - 1;
radius *= radius;
radius = (1 - radius) * 4F * scale;
radius = (1 - radius) * 8F * scale;
dx = (float) Math.sin(i * 0.25F + angle) * radius;
dz = (float) Math.cos(i * 0.25F + angle) * radius;
spline.add(new Vector3f(dx, i * scale, dz));
spline.add(new Vector3f(dx, i * scale * 1.2F, dz));
}
Vector3f start = new Vector3f();