Lurking terror and creeping horror egg fix, elythia terrain adjustments
This commit is contained in:
1 parent
eeded21b7d
commit
eb70e23b57
10 files changed
+34
-27
No files matched your search
+9
-8
@@ -36,6 +36,7 @@ public class CreepingHorrorEggBlock extends Block {
|
|||||||
public static final MapCodec<CreepingHorrorEggBlock> CODEC = Block.simpleCodec(CreepingHorrorEggBlock::new);
|
public static final MapCodec<CreepingHorrorEggBlock> CODEC = Block.simpleCodec(CreepingHorrorEggBlock::new);
|
||||||
public static final IntegerProperty HATCH = BlockStateProperties.HATCH;
|
public static final IntegerProperty HATCH = BlockStateProperties.HATCH;
|
||||||
public static final IntegerProperty EGGS = BlockStateProperties.EGGS;
|
public static final IntegerProperty EGGS = BlockStateProperties.EGGS;
|
||||||
|
private static final float PANIC_HATCH_CHANCE = 0.50F;
|
||||||
private static final int MAX_HATCH = 2;
|
private static final int MAX_HATCH = 2;
|
||||||
private static final int MAX_EGGS = 4;
|
private static final int MAX_EGGS = 4;
|
||||||
private static final VoxelShape SINGLE_SHAPE = Block.box(3.0D, 0.0D, 3.0D, 13.0D, 7.0D, 13.0D);
|
private static final VoxelShape SINGLE_SHAPE = Block.box(3.0D, 0.0D, 3.0D, 13.0D, 7.0D, 13.0D);
|
||||||
@@ -105,8 +106,10 @@ public class CreepingHorrorEggBlock extends Block {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void stepOn(Level level, BlockPos pos, BlockState state, Entity entity) {
|
public void stepOn(Level level, BlockPos pos, BlockState state, Entity entity) {
|
||||||
if (!entity.isSteppingCarefully()) {
|
if (entity instanceof Player && !entity.isSteppingCarefully() && this.destroyEgg(level, state, pos, entity, 100)) {
|
||||||
this.destroyEgg(level, state, pos, entity, 100);
|
if (level instanceof ServerLevel serverLevel) {
|
||||||
|
panicHatchNearby(serverLevel, pos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
super.stepOn(level, pos, state, entity);
|
super.stepOn(level, pos, state, entity);
|
||||||
}
|
}
|
||||||
@@ -128,9 +131,6 @@ public class CreepingHorrorEggBlock extends Block {
|
|||||||
public void playerDestroy(Level level, Player player, BlockPos pos, BlockState state, BlockEntity blockEntity, net.minecraft.world.item.ItemStack stack) {
|
public void playerDestroy(Level level, Player player, BlockPos pos, BlockState state, BlockEntity blockEntity, net.minecraft.world.item.ItemStack stack) {
|
||||||
super.playerDestroy(level, player, pos, state, blockEntity, stack);
|
super.playerDestroy(level, player, pos, state, blockEntity, stack);
|
||||||
this.decreaseEggs(level, pos, state);
|
this.decreaseEggs(level, pos, state);
|
||||||
if (level instanceof ServerLevel serverLevel) {
|
|
||||||
panicHatchNearby(serverLevel, pos);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void panicHatchNearby(ServerLevel level, BlockPos origin) {
|
private static void panicHatchNearby(ServerLevel level, BlockPos origin) {
|
||||||
@@ -141,7 +141,7 @@ public class CreepingHorrorEggBlock extends Block {
|
|||||||
for (int dz = -radius; dz <= radius; dz++) {
|
for (int dz = -radius; dz <= radius; dz++) {
|
||||||
if (dx == 0 && dy == 0 && dz == 0) continue;
|
if (dx == 0 && dy == 0 && dz == 0) continue;
|
||||||
mutable.set(origin.getX() + dx, origin.getY() + dy, origin.getZ() + dz);
|
mutable.set(origin.getX() + dx, origin.getY() + dy, origin.getZ() + dz);
|
||||||
if (level.random.nextFloat() >= 0.4f) continue;
|
if (level.random.nextFloat() >= PANIC_HATCH_CHANCE) continue;
|
||||||
BlockState nearby = level.getBlockState(mutable);
|
BlockState nearby = level.getBlockState(mutable);
|
||||||
BlockPos immutable = mutable.immutable();
|
BlockPos immutable = mutable.immutable();
|
||||||
if (nearby.getBlock() instanceof CreepingHorrorEggBlock b) {
|
if (nearby.getBlock() instanceof CreepingHorrorEggBlock b) {
|
||||||
@@ -167,12 +167,13 @@ public class CreepingHorrorEggBlock extends Block {
|
|||||||
return level.getBlockState(pos).is(BlockTags.SAND) || level.getBlockState(pos).blocksMotion();
|
return level.getBlockState(pos).is(BlockTags.SAND) || level.getBlockState(pos).blocksMotion();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void destroyEgg(Level level, BlockState state, BlockPos pos, Entity entity, int chance) {
|
private boolean destroyEgg(Level level, BlockState state, BlockPos pos, Entity entity, int chance) {
|
||||||
if (level.isClientSide || !this.canDestroyEgg(level, entity) || level.random.nextInt(chance) != 0) {
|
if (level.isClientSide || !this.canDestroyEgg(level, entity) || level.random.nextInt(chance) != 0) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
level.playSound(null, pos, SoundEvents.TURTLE_EGG_BREAK, SoundSource.BLOCKS, 0.7F, 0.9F + level.random.nextFloat() * 0.2F);
|
level.playSound(null, pos, SoundEvents.TURTLE_EGG_BREAK, SoundSource.BLOCKS, 0.7F, 0.9F + level.random.nextFloat() * 0.2F);
|
||||||
this.decreaseEggs(level, pos, state);
|
this.decreaseEggs(level, pos, state);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void hatchEggs(ServerLevel level, BlockPos pos, BlockState state, RandomSource random) {
|
void hatchEggs(ServerLevel level, BlockPos pos, BlockState state, RandomSource random) {
|
||||||
|
|||||||
+9
-8
@@ -36,6 +36,7 @@ public class LurkingTerrorEggBlock extends Block {
|
|||||||
public static final MapCodec<LurkingTerrorEggBlock> CODEC = Block.simpleCodec(LurkingTerrorEggBlock::new);
|
public static final MapCodec<LurkingTerrorEggBlock> CODEC = Block.simpleCodec(LurkingTerrorEggBlock::new);
|
||||||
public static final IntegerProperty HATCH = BlockStateProperties.HATCH;
|
public static final IntegerProperty HATCH = BlockStateProperties.HATCH;
|
||||||
public static final IntegerProperty EGGS = BlockStateProperties.EGGS;
|
public static final IntegerProperty EGGS = BlockStateProperties.EGGS;
|
||||||
|
private static final float PANIC_HATCH_CHANCE = 0.50F;
|
||||||
private static final int MAX_HATCH = 2;
|
private static final int MAX_HATCH = 2;
|
||||||
private static final int MAX_EGGS = 4;
|
private static final int MAX_EGGS = 4;
|
||||||
private static final VoxelShape SINGLE_SHAPE = Block.box(3.0D, 0.0D, 3.0D, 13.0D, 7.0D, 13.0D);
|
private static final VoxelShape SINGLE_SHAPE = Block.box(3.0D, 0.0D, 3.0D, 13.0D, 7.0D, 13.0D);
|
||||||
@@ -105,8 +106,10 @@ public class LurkingTerrorEggBlock extends Block {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void stepOn(Level level, BlockPos pos, BlockState state, Entity entity) {
|
public void stepOn(Level level, BlockPos pos, BlockState state, Entity entity) {
|
||||||
if (!entity.isSteppingCarefully()) {
|
if (entity instanceof Player && !entity.isSteppingCarefully() && this.destroyEgg(level, state, pos, entity, 100)) {
|
||||||
this.destroyEgg(level, state, pos, entity, 100);
|
if (level instanceof ServerLevel serverLevel) {
|
||||||
|
panicHatchNearby(serverLevel, pos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
super.stepOn(level, pos, state, entity);
|
super.stepOn(level, pos, state, entity);
|
||||||
}
|
}
|
||||||
@@ -128,9 +131,6 @@ public class LurkingTerrorEggBlock extends Block {
|
|||||||
public void playerDestroy(Level level, Player player, BlockPos pos, BlockState state, BlockEntity blockEntity, net.minecraft.world.item.ItemStack stack) {
|
public void playerDestroy(Level level, Player player, BlockPos pos, BlockState state, BlockEntity blockEntity, net.minecraft.world.item.ItemStack stack) {
|
||||||
super.playerDestroy(level, player, pos, state, blockEntity, stack);
|
super.playerDestroy(level, player, pos, state, blockEntity, stack);
|
||||||
this.decreaseEggs(level, pos, state);
|
this.decreaseEggs(level, pos, state);
|
||||||
if (level instanceof ServerLevel serverLevel) {
|
|
||||||
panicHatchNearby(serverLevel, pos);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void panicHatchNearby(ServerLevel level, BlockPos origin) {
|
private static void panicHatchNearby(ServerLevel level, BlockPos origin) {
|
||||||
@@ -141,7 +141,7 @@ public class LurkingTerrorEggBlock extends Block {
|
|||||||
for (int dz = -radius; dz <= radius; dz++) {
|
for (int dz = -radius; dz <= radius; dz++) {
|
||||||
if (dx == 0 && dy == 0 && dz == 0) continue;
|
if (dx == 0 && dy == 0 && dz == 0) continue;
|
||||||
mutable.set(origin.getX() + dx, origin.getY() + dy, origin.getZ() + dz);
|
mutable.set(origin.getX() + dx, origin.getY() + dy, origin.getZ() + dz);
|
||||||
if (level.random.nextFloat() >= 0.4f) continue;
|
if (level.random.nextFloat() >= PANIC_HATCH_CHANCE) continue;
|
||||||
BlockState nearby = level.getBlockState(mutable);
|
BlockState nearby = level.getBlockState(mutable);
|
||||||
BlockPos immutable = mutable.immutable();
|
BlockPos immutable = mutable.immutable();
|
||||||
if (nearby.getBlock() instanceof LurkingTerrorEggBlock b) {
|
if (nearby.getBlock() instanceof LurkingTerrorEggBlock b) {
|
||||||
@@ -167,12 +167,13 @@ public class LurkingTerrorEggBlock extends Block {
|
|||||||
return level.getBlockState(pos).is(BlockTags.SAND) || level.getBlockState(pos).blocksMotion();
|
return level.getBlockState(pos).is(BlockTags.SAND) || level.getBlockState(pos).blocksMotion();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void destroyEgg(Level level, BlockState state, BlockPos pos, Entity entity, int chance) {
|
private boolean destroyEgg(Level level, BlockState state, BlockPos pos, Entity entity, int chance) {
|
||||||
if (level.isClientSide || !this.canDestroyEgg(level, entity) || level.random.nextInt(chance) != 0) {
|
if (level.isClientSide || !this.canDestroyEgg(level, entity) || level.random.nextInt(chance) != 0) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
level.playSound(null, pos, SoundEvents.TURTLE_EGG_BREAK, SoundSource.BLOCKS, 0.7F, 0.9F + level.random.nextFloat() * 0.2F);
|
level.playSound(null, pos, SoundEvents.TURTLE_EGG_BREAK, SoundSource.BLOCKS, 0.7F, 0.9F + level.random.nextFloat() * 0.2F);
|
||||||
this.decreaseEggs(level, pos, state);
|
this.decreaseEggs(level, pos, state);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void hatchEggs(ServerLevel level, BlockPos pos, BlockState state, RandomSource random) {
|
void hatchEggs(ServerLevel level, BlockPos pos, BlockState state, RandomSource random) {
|
||||||
|
|||||||
@@ -134,11 +134,10 @@ public class BomberEntity extends Monster implements GeoEntity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean doHurtTarget(Entity target) {
|
public boolean doHurtTarget(Entity target) {
|
||||||
if (!(target instanceof LivingEntity livingTarget)) {
|
if (!(target instanceof LivingEntity)) {
|
||||||
return super.doHurtTarget(target);
|
return super.doHurtTarget(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
livingTarget.hurt(this.damageSources().mobAttack(this), (float) this.getAttributeValue(Attributes.ATTACK_DAMAGE));
|
|
||||||
this.primeFuse();
|
this.primeFuse();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"parent": "minecraft:block/template_four_turtle_eggs",
|
"parent": "minecraft:block/template_four_turtle_eggs",
|
||||||
"textures": {
|
"textures": {
|
||||||
"all": "antarchy:block/creeping_horror_egg/creeping_horror_egg"
|
"all": "antarchy:block/creeping_horror_egg/creeping_horror_egg",
|
||||||
|
"particle": "antarchy:block/creeping_horror_egg/creeping_horror_egg"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"parent": "minecraft:block/template_four_turtle_eggs",
|
"parent": "minecraft:block/template_four_turtle_eggs",
|
||||||
"textures": {
|
"textures": {
|
||||||
"all": "antarchy:block/lurking_terror_egg/lurking_terror_egg"
|
"all": "antarchy:block/lurking_terror_egg/lurking_terror_egg",
|
||||||
|
"particle": "antarchy:block/lurking_terror_egg/lurking_terror_egg"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-1
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"parent": "minecraft:block/template_four_turtle_eggs",
|
"parent": "minecraft:block/template_four_turtle_eggs",
|
||||||
"textures": {
|
"textures": {
|
||||||
"all": "antarchy:block/creeping_horror_egg/creeping_horror_egg_slightly_cracked"
|
"all": "antarchy:block/creeping_horror_egg/creeping_horror_egg_slightly_cracked",
|
||||||
|
"particle": "antarchy:block/creeping_horror_egg/creeping_horror_egg_slightly_cracked"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-1
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"parent": "minecraft:block/template_four_turtle_eggs",
|
"parent": "minecraft:block/template_four_turtle_eggs",
|
||||||
"textures": {
|
"textures": {
|
||||||
"all": "antarchy:block/lurking_terror_egg/lurking_terror_egg_slightly_cracked"
|
"all": "antarchy:block/lurking_terror_egg/lurking_terror_egg_slightly_cracked",
|
||||||
|
"particle": "antarchy:block/lurking_terror_egg/lurking_terror_egg_slightly_cracked"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-1
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"parent": "minecraft:block/template_four_turtle_eggs",
|
"parent": "minecraft:block/template_four_turtle_eggs",
|
||||||
"textures": {
|
"textures": {
|
||||||
"all": "antarchy:block/creeping_horror_egg/creeping_horror_egg_very_cracked"
|
"all": "antarchy:block/creeping_horror_egg/creeping_horror_egg_very_cracked",
|
||||||
|
"particle": "antarchy:block/creeping_horror_egg/creeping_horror_egg_very_cracked"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-1
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"parent": "minecraft:block/template_four_turtle_eggs",
|
"parent": "minecraft:block/template_four_turtle_eggs",
|
||||||
"textures": {
|
"textures": {
|
||||||
"all": "antarchy:block/lurking_terror_egg/lurking_terror_egg_very_cracked"
|
"all": "antarchy:block/lurking_terror_egg/lurking_terror_egg_very_cracked",
|
||||||
|
"particle": "antarchy:block/lurking_terror_egg/lurking_terror_egg_very_cracked"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-3
@@ -6,8 +6,8 @@
|
|||||||
"type": "minecraft:y_clamped_gradient",
|
"type": "minecraft:y_clamped_gradient",
|
||||||
"from_y": -64,
|
"from_y": -64,
|
||||||
"to_y": 220,
|
"to_y": 220,
|
||||||
"from_value": 1.75,
|
"from_value": 2.20,
|
||||||
"to_value": -2.05
|
"to_value": -1.90
|
||||||
},
|
},
|
||||||
"argument2": {
|
"argument2": {
|
||||||
"type": "minecraft:add",
|
"type": "minecraft:add",
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
},
|
},
|
||||||
"argument2": {
|
"argument2": {
|
||||||
"type": "minecraft:mul",
|
"type": "minecraft:mul",
|
||||||
"argument1": 0.30,
|
"argument1": 0.55,
|
||||||
"argument2": "minecraft:overworld/continents"
|
"argument2": "minecraft:overworld/continents"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user