Code update

This commit is contained in:
paulevsGitch 2021-11-30 12:52:10 +03:00
parent eca922058f
commit 5386d2e0f2
8 changed files with 61 additions and 63 deletions

View file

@ -43,11 +43,7 @@ public class SmallJellyshroomBlock extends BaseAttachedBlock implements RenderLa
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class); private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
public SmallJellyshroomBlock() { public SmallJellyshroomBlock() {
super(FabricBlockSettings.of(Material.PLANT) super(FabricBlockSettings.of(Material.PLANT).breakByHand(true).sound(SoundType.NETHER_WART).noCollission());
.breakByTool(FabricToolTags.SHEARS)
.breakByHand(true)
.sound(SoundType.NETHER_WART)
.noCollission());
} }
@Override @Override

View file

@ -101,7 +101,8 @@ public class CubozoaEntity extends AbstractSchoolingFish {
} }
public static AttributeSupplier.Builder createMobAttributes() { public static AttributeSupplier.Builder createMobAttributes() {
return LivingEntity.createLivingAttributes() return LivingEntity
.createLivingAttributes()
.add(Attributes.MAX_HEALTH, 2.0) .add(Attributes.MAX_HEALTH, 2.0)
.add(Attributes.FOLLOW_RANGE, 16.0) .add(Attributes.FOLLOW_RANGE, 16.0)
.add(Attributes.MOVEMENT_SPEED, 0.5); .add(Attributes.MOVEMENT_SPEED, 0.5);

View file

@ -1,7 +1,5 @@
package ru.betterend.entity; package ru.betterend.entity;
import java.util.EnumSet;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
@ -37,6 +35,8 @@ import ru.bclib.util.MHelper;
import ru.betterend.registry.EndEntities; import ru.betterend.registry.EndEntities;
import ru.betterend.registry.EndSounds; import ru.betterend.registry.EndSounds;
import java.util.EnumSet;
public class DragonflyEntity extends DespawnableAnimal implements FlyingAnimal { public class DragonflyEntity extends DespawnableAnimal implements FlyingAnimal {
public DragonflyEntity(EntityType<DragonflyEntity> entityType, Level world) { public DragonflyEntity(EntityType<DragonflyEntity> entityType, Level world) {
super(entityType, world); super(entityType, world);
@ -48,7 +48,8 @@ public class DragonflyEntity extends DespawnableAnimal implements FlyingAnimal {
} }
public static AttributeSupplier.Builder createMobAttributes() { public static AttributeSupplier.Builder createMobAttributes() {
return LivingEntity.createLivingAttributes() return LivingEntity
.createLivingAttributes()
.add(Attributes.MAX_HEALTH, 8.0D) .add(Attributes.MAX_HEALTH, 8.0D)
.add(Attributes.FOLLOW_RANGE, 16.0D) .add(Attributes.FOLLOW_RANGE, 16.0D)
.add(Attributes.FLYING_SPEED, 1.0D) .add(Attributes.FLYING_SPEED, 1.0D)

View file

@ -129,7 +129,8 @@ public class EndFishEntity extends AbstractSchoolingFish {
} }
public static AttributeSupplier.Builder createMobAttributes() { public static AttributeSupplier.Builder createMobAttributes() {
return LivingEntity.createLivingAttributes() return LivingEntity
.createLivingAttributes()
.add(Attributes.MAX_HEALTH, 2.0) .add(Attributes.MAX_HEALTH, 2.0)
.add(Attributes.FOLLOW_RANGE, 16.0) .add(Attributes.FOLLOW_RANGE, 16.0)
.add(Attributes.MOVEMENT_SPEED, 0.75); .add(Attributes.MOVEMENT_SPEED, 0.75);

View file

@ -71,7 +71,8 @@ public class EndSlimeEntity extends Slime {
} }
public static AttributeSupplier.Builder createMobAttributes() { public static AttributeSupplier.Builder createMobAttributes() {
return LivingEntity.createLivingAttributes() return LivingEntity
.createLivingAttributes()
.add(Attributes.MAX_HEALTH, 1.0D) .add(Attributes.MAX_HEALTH, 1.0D)
.add(Attributes.ATTACK_DAMAGE, 1.0D) .add(Attributes.ATTACK_DAMAGE, 1.0D)
.add(Attributes.FOLLOW_RANGE, 16.0D) .add(Attributes.FOLLOW_RANGE, 16.0D)

View file

@ -38,7 +38,8 @@ public class ShadowWalkerEntity extends Monster {
} }
public static AttributeSupplier.Builder createMobAttributes() { public static AttributeSupplier.Builder createMobAttributes() {
return Monster.createMonsterAttributes() return Monster
.createMonsterAttributes()
.add(Attributes.FOLLOW_RANGE, 35.0) .add(Attributes.FOLLOW_RANGE, 35.0)
.add(Attributes.MOVEMENT_SPEED, 0.15) .add(Attributes.MOVEMENT_SPEED, 0.15)
.add(Attributes.ATTACK_DAMAGE, 4.5) .add(Attributes.ATTACK_DAMAGE, 4.5)

View file

@ -1,9 +1,5 @@
package ru.betterend.entity; package ru.betterend.entity;
import java.util.EnumSet;
import org.jetbrains.annotations.Nullable;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
@ -41,6 +37,7 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.pathfinder.BlockPathTypes; import net.minecraft.world.level.pathfinder.BlockPathTypes;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.Nullable;
import ru.bclib.entity.DespawnableAnimal; import ru.bclib.entity.DespawnableAnimal;
import ru.bclib.util.BlocksHelper; import ru.bclib.util.BlocksHelper;
import ru.bclib.util.MHelper; import ru.bclib.util.MHelper;
@ -50,6 +47,8 @@ import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndEntities; import ru.betterend.registry.EndEntities;
import ru.betterend.registry.EndItems; import ru.betterend.registry.EndItems;
import java.util.EnumSet;
public class SilkMothEntity extends DespawnableAnimal implements FlyingAnimal { public class SilkMothEntity extends DespawnableAnimal implements FlyingAnimal {
private BlockPos hivePos; private BlockPos hivePos;
private BlockPos entrance; private BlockPos entrance;
@ -65,7 +64,8 @@ public class SilkMothEntity extends DespawnableAnimal implements FlyingAnimal {
} }
public static AttributeSupplier.Builder createMobAttributes() { public static AttributeSupplier.Builder createMobAttributes() {
return LivingEntity.createLivingAttributes() return LivingEntity
.createLivingAttributes()
.add(Attributes.MAX_HEALTH, 2.0D) .add(Attributes.MAX_HEALTH, 2.0D)
.add(Attributes.FOLLOW_RANGE, 16.0D) .add(Attributes.FOLLOW_RANGE, 16.0D)
.add(Attributes.FLYING_SPEED, 0.4D) .add(Attributes.FLYING_SPEED, 0.4D)

View file

@ -1,15 +1,12 @@
package ru.betterend.registry; package ru.betterend.registry;
import java.util.List;
import java.util.function.Supplier;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.levelgen.GenerationStep; import net.minecraft.world.level.levelgen.GenerationStep;
import net.minecraft.world.level.levelgen.GenerationStep.Decoration;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.configurations.CountConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.CountConfiguration;
@ -87,6 +84,9 @@ import ru.betterend.world.features.trees.UmbrellaTreeFeature;
import ru.betterend.world.generator.GeneratorOptions; import ru.betterend.world.generator.GeneratorOptions;
import ru.betterend.world.surface.UmbraSurfaceBuilder; import ru.betterend.world.surface.UmbraSurfaceBuilder;
import java.util.List;
import java.util.function.Supplier;
public class EndFeatures { public class EndFeatures {
// Trees // // Trees //
public static final BCLFeature MOSSY_GLOWSHROOM = redisterVegetation("mossy_glowshroom", new MossyGlowshroomFeature(), 3); public static final BCLFeature MOSSY_GLOWSHROOM = redisterVegetation("mossy_glowshroom", new MossyGlowshroomFeature(), 3);
@ -197,7 +197,7 @@ public class EndFeatures {
public static final BCLFeature CHARNIA_GREEN = redisterVegetation("charnia_green", new CharniaFeature(EndBlocks.CHARNIA_GREEN), 10); public static final BCLFeature CHARNIA_GREEN = redisterVegetation("charnia_green", new CharniaFeature(EndBlocks.CHARNIA_GREEN), 10);
public static final BCLFeature MENGER_SPONGE = redisterVegetation("menger_sponge", new MengerSpongeFeature(5), 1); public static final BCLFeature MENGER_SPONGE = redisterVegetation("menger_sponge", new MengerSpongeFeature(5), 1);
public static final BCLFeature CHARNIA_RED_RARE = redisterVegetation("charnia_red_rare", new CharniaFeature(EndBlocks.CHARNIA_RED),2); public static final BCLFeature CHARNIA_RED_RARE = redisterVegetation("charnia_red_rare", new CharniaFeature(EndBlocks.CHARNIA_RED),2);
public static final BCLFeature BIOME_ISLAND = BCLFeature.makeFeatureConfigured(BetterEnd.makeID("overworld_island"), new BiomeIslandFeature()); public static final BCLFeature BIOME_ISLAND = BCLFeature.makeFeatureConfigured(BetterEnd.makeID("overworld_island"), Decoration.RAW_GENERATION, new BiomeIslandFeature());
public static final BCLFeature FLAMAEA = redisterVegetation("flamaea", new SinglePlantFeature(EndBlocks.FLAMAEA, 12, false, 5), 20); public static final BCLFeature FLAMAEA = redisterVegetation("flamaea", new SinglePlantFeature(EndBlocks.FLAMAEA, 12, false, 5), 20);
// Terrain // // Terrain //
@ -210,7 +210,7 @@ public class EndFeatures {
public static final BCLFeature FLOATING_SPIRE = registerRawGen("floating_spire", new FloatingSpireFeature(), 8); public static final BCLFeature FLOATING_SPIRE = registerRawGen("floating_spire", new FloatingSpireFeature(), 8);
public static final BCLFeature GEYSER = registerRawGen("geyser", new GeyserFeature(), 8); public static final BCLFeature GEYSER = registerRawGen("geyser", new GeyserFeature(), 8);
public static final BCLFeature SULPHURIC_LAKE = registerLake("sulphuric_lake", new SulphuricLakeFeature(), 8); public static final BCLFeature SULPHURIC_LAKE = registerLake("sulphuric_lake", new SulphuricLakeFeature(), 8);
public static final BCLFeature SULPHURIC_CAVE = BCLFeature.makeCountRawFeature(BetterEnd.makeID("sulphuric_cave"), new SulphuricCaveFeature(), 2); public static final BCLFeature SULPHURIC_CAVE = BCLFeature.makeCountFeature(BetterEnd.makeID("sulphuric_cave"), Decoration.RAW_GENERATION, new SulphuricCaveFeature(), 2);
public static final BCLFeature ICE_STAR = registerRawGen("ice_star", new IceStarFeature(5, 15, 10, 25), 15); public static final BCLFeature ICE_STAR = registerRawGen("ice_star", new IceStarFeature(5, 15, 10, 25), 15);
public static final BCLFeature ICE_STAR_SMALL = registerRawGen("ice_star_small", new IceStarFeature(3, 5, 7, 12), 8); public static final BCLFeature ICE_STAR_SMALL = registerRawGen("ice_star_small", new IceStarFeature(3, 5, 7, 12), 8);
public static final BCLFeature SURFACE_VENT = registerChanced("surface_vent", new SurfaceVentFeature(), 4); public static final BCLFeature SURFACE_VENT = registerChanced("surface_vent", new SurfaceVentFeature(), 4);
@ -218,7 +218,7 @@ public class EndFeatures {
public static final BCLFeature OBSIDIAN_PILLAR_BASEMENT = registerChanced("obsidian_pillar_basement", new ObsidianPillarBasementFeature(), 8); public static final BCLFeature OBSIDIAN_PILLAR_BASEMENT = registerChanced("obsidian_pillar_basement", new ObsidianPillarBasementFeature(), 8);
public static final BCLFeature OBSIDIAN_BOULDER = registerChanced("obsidian_boulder", new ObsidianBoulderFeature(), 10); public static final BCLFeature OBSIDIAN_BOULDER = registerChanced("obsidian_boulder", new ObsidianBoulderFeature(), 10);
public static final BCLFeature FALLEN_PILLAR = registerChanced("fallen_pillar", new FallenPillarFeature(), 20); public static final BCLFeature FALLEN_PILLAR = registerChanced("fallen_pillar", new FallenPillarFeature(), 20);
public static final BCLFeature TUNEL_CAVE = BCLFeature.makeChunkFeature(BetterEnd.makeID("tunel_cave"), new TunelCaveFeature()); public static final BCLFeature TUNEL_CAVE = BCLFeature.makeChunkFeature(BetterEnd.makeID("tunel_cave"), Decoration.RAW_GENERATION, new TunelCaveFeature());
public static final BCLFeature UMBRALITH_ARCH = registerChanced( public static final BCLFeature UMBRALITH_ARCH = registerChanced(
"umbralith_arch", "umbralith_arch",
new ArchFeature( new ArchFeature(
@ -229,10 +229,10 @@ public class EndFeatures {
public static final BCLFeature THIN_UMBRALITH_ARCH = registerChanced("thin_umbralith_arch", new ThinArchFeature(EndBlocks.UMBRALITH.stone), 15); public static final BCLFeature THIN_UMBRALITH_ARCH = registerChanced("thin_umbralith_arch", new ThinArchFeature(EndBlocks.UMBRALITH.stone), 15);
// Ores // // Ores //
public static final BCLFeature THALLASIUM_ORE = registerOre("thallasium_ore", EndBlocks.THALLASIUM.ore, 24, 8, 0, 5, 128); public static final BCLFeature THALLASIUM_ORE = registerOre("thallasium_ore", EndBlocks.THALLASIUM.ore, 24, 8, 5, 128);
public static final BCLFeature ENDER_ORE = registerOre("ender_ore", EndBlocks.ENDER_ORE, 12, 4, 0, 5, 128); public static final BCLFeature ENDER_ORE = registerOre("ender_ore", EndBlocks.ENDER_ORE, 12, 4, 5, 128);
public static final BCLFeature AMBER_ORE = registerOre("amber_ore", EndBlocks.AMBER_ORE, 24, 6, 0, 5, 128); public static final BCLFeature AMBER_ORE = registerOre("amber_ore", EndBlocks.AMBER_ORE, 24, 6, 5, 128);
public static final BCLFeature DRAGON_BONE_BLOCK_ORE = registerOre("dragon_bone_ore", EndBlocks.DRAGON_BONE_BLOCK, 24, 8, 0, 5, 128); public static final BCLFeature DRAGON_BONE_BLOCK_ORE = registerOre("dragon_bone_ore", EndBlocks.DRAGON_BONE_BLOCK, 24, 8, 5, 128);
public static final BCLFeature VIOLECITE_LAYER = registerLayer("violecite_layer", EndBlocks.VIOLECITE, 15, 16, 128, 8); public static final BCLFeature VIOLECITE_LAYER = registerLayer("violecite_layer", EndBlocks.VIOLECITE, 15, 16, 128, 8);
public static final BCLFeature FLAVOLITE_LAYER = registerLayer("flavolite_layer", EndBlocks.FLAVOLITE, 12, 16, 128, 6); public static final BCLFeature FLAVOLITE_LAYER = registerLayer("flavolite_layer", EndBlocks.FLAVOLITE, 12, 16, 128, 6);
@ -278,27 +278,26 @@ public class EndFeatures {
} }
private static BCLFeature registerRawGen(String name, Feature<NoneFeatureConfiguration> feature, int chance) { private static BCLFeature registerRawGen(String name, Feature<NoneFeatureConfiguration> feature, int chance) {
return BCLFeature.makeRawGenFeature(BetterEnd.makeID(name), feature, chance); return BCLFeature.makeChancedFeature(BetterEnd.makeID(name), Decoration.RAW_GENERATION, feature, chance);
} }
private static BCLFeature registerLake(String name, Feature<NoneFeatureConfiguration> feature, int chance) { private static BCLFeature registerLake(String name, Feature<NoneFeatureConfiguration> feature, int chance) {
//return BCLFeature.makeLakeFeature(BetterEnd.makeID(name), feature, chance); return BCLFeature.makeChancedFeature(BetterEnd.makeID(name), Decoration.RAW_GENERATION, feature, chance);
return BCLFeature.makeRawGenFeature(BetterEnd.makeID(name), feature, chance);
} }
private static BCLFeature registerChanced(String name, Feature<NoneFeatureConfiguration> feature, int chance) { private static BCLFeature registerChanced(String name, Feature<NoneFeatureConfiguration> feature, int chance) {
return BCLFeature.makeChansedFeature(BetterEnd.makeID(name), feature, chance); return BCLFeature.makeChancedFeature(BetterEnd.makeID(name), Decoration.SURFACE_STRUCTURES, feature, chance);
} }
private static BCLFeature registerOre(String name, Block blockOre, int veins, int veinSize, int offset, int minY, int maxY) { private static BCLFeature registerOre(String name, Block blockOre, int veins, int veinSize, int minY, int maxY) {
return BCLFeature.makeOreFeature(BetterEnd.makeID(name), blockOre, Blocks.END_STONE, veins, veinSize, offset, minY, maxY); return BCLFeature.makeOreFeature(BetterEnd.makeID(name), blockOre, Blocks.END_STONE, veins, veinSize, minY, maxY);
} }
private static BCLFeature registerLayer(String name, Block block, float radius, int minY, int maxY, int count) { private static BCLFeature registerLayer(String name, Block block, float radius, int minY, int maxY, int count) {
OreLayerFeature layer = new OreLayerFeature(block.defaultBlockState(), radius, minY, maxY); OreLayerFeature layer = new OreLayerFeature(block.defaultBlockState(), radius, minY, maxY);
ConfiguredFeature<?, ?> configured = layer.configured(FeatureConfiguration.NONE) ConfiguredFeature<?, ?> configured = layer
.decorated(FeatureDecorator.COUNT.configured(new CountConfiguration( .configured(FeatureConfiguration.NONE)
count))); .decorated(FeatureDecorator.COUNT.configured(new CountConfiguration(count)));
return new BCLFeature(BetterEnd.makeID(name), layer, GenerationStep.Decoration.UNDERGROUND_ORES, configured); return new BCLFeature(BetterEnd.makeID(name), layer, GenerationStep.Decoration.UNDERGROUND_ORES, configured);
} }
@ -372,9 +371,7 @@ public class EndFeatures {
} }
else { else {
List<Supplier<ConfiguredFeature<?, ?>>> newFeature = Lists.newArrayList(); List<Supplier<ConfiguredFeature<?, ?>>> newFeature = Lists.newArrayList();
newFeature.add(() -> { newFeature.add(() -> feature.getFeatureConfigured());
return feature.getFeatureConfigured();
});
features.add(newFeature); features.add(newFeature);
} }
} }