Floating fur fix
This commit is contained in:
parent
1afa06c39e
commit
ac0c207f36
3 changed files with 22 additions and 4 deletions
|
@ -34,8 +34,7 @@ public class BlockEndLotusSeed extends BlockUnderwaterPlantWithAge {
|
|||
TripleShape shape = (height == 0) ? TripleShape.TOP : TripleShape.MIDDLE;
|
||||
Direction dir = BlocksHelper.randomHorizontal(random);
|
||||
BlockPos leafCenter = bpos.toImmutable().offset(dir);
|
||||
boolean hasLeaf = hasLeaf(world, leafCenter);
|
||||
if (hasLeaf) {
|
||||
if (hasLeaf(world, leafCenter)) {
|
||||
generateLeaf(world, leafCenter);
|
||||
BlocksHelper.setWithoutUpdate(world, bpos, startLeaf.with(BlockEndLotusStem.SHAPE, shape).with(BlockEndLotusStem.FACING, dir));
|
||||
}
|
||||
|
@ -70,7 +69,8 @@ public class BlockEndLotusSeed extends BlockUnderwaterPlantWithAge {
|
|||
stem = stem.with(BlockEndLotusStem.WATERLOGGED, true);
|
||||
}
|
||||
}
|
||||
if (hasLeaf) {
|
||||
|
||||
if (world.getBlockState(bpos.offset(dir)).isOf(BlockRegistry.END_LOTUS_LEAF)) {
|
||||
stem = stem.with(BlockEndLotusStem.LEAF, true).with(BlockEndLotusStem.FACING, dir);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package ru.betterend.entity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Blocks;
|
||||
|
@ -19,6 +20,7 @@ import net.minecraft.particle.ParticleTypes;
|
|||
import net.minecraft.sound.SoundEvent;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.world.ServerWorldAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -108,6 +110,8 @@ public class EntityEndFish extends SchoolingFishEntity {
|
|||
}
|
||||
|
||||
public static boolean canSpawn(EntityType<EntityEndFish> type, ServerWorldAccess world, SpawnReason spawnReason, BlockPos pos, Random random) {
|
||||
return true;
|
||||
Box box = new Box(pos).expand(16);
|
||||
List<EntityEndFish> list = world.getEntitiesByClass(EntityEndFish.class, box, (entity) -> { return true; });
|
||||
return list.size() < 9;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,9 @@ package ru.betterend.util;
|
|||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
|
@ -131,6 +134,7 @@ public class BlocksHelper {
|
|||
|
||||
public static void fixBlocks(WorldAccess world, BlockPos start, BlockPos end) {
|
||||
BlockState state;
|
||||
Set<BlockPos> doubleCheck = Sets.newHashSet();
|
||||
for (int x = start.getX(); x <= end.getX(); x++) {
|
||||
POS.setX(x);
|
||||
for (int z = start.getZ(); z <= end.getZ(); z++) {
|
||||
|
@ -139,6 +143,10 @@ public class BlocksHelper {
|
|||
POS.setY(y);
|
||||
state = world.getBlockState(POS);
|
||||
|
||||
if (state.getBlock() instanceof BlockGlowingFur) {
|
||||
doubleCheck.add(POS.toImmutable());
|
||||
}
|
||||
|
||||
// Liquids
|
||||
if (!state.getFluidState().isEmpty()) {
|
||||
POS.setY(y - 1);
|
||||
|
@ -222,6 +230,12 @@ public class BlocksHelper {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
doubleCheck.forEach((pos) -> {
|
||||
if (!world.getBlockState(pos).canPlaceAt(world, pos)) {
|
||||
BlocksHelper.setWithoutUpdate(world, pos, AIR);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static boolean isEndNylium(Block block) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue