Slime size fix
This commit is contained in:
parent
83320b2df3
commit
c9cdea122f
3 changed files with 17 additions and 4 deletions
|
@ -7,15 +7,21 @@ import net.fabricmc.api.Environment;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
||||||
import net.minecraft.block.AbstractBlock;
|
import net.minecraft.block.AbstractBlock;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Material;
|
import net.minecraft.block.Material;
|
||||||
|
import net.minecraft.block.ShapeContext;
|
||||||
import net.minecraft.particle.ParticleTypes;
|
import net.minecraft.particle.ParticleTypes;
|
||||||
import net.minecraft.sound.BlockSoundGroup;
|
import net.minecraft.sound.BlockSoundGroup;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.shape.VoxelShape;
|
||||||
|
import net.minecraft.world.BlockView;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import ru.betterend.blocks.basis.BlockUnderwaterPlant;
|
import ru.betterend.blocks.basis.BlockUnderwaterPlant;
|
||||||
|
|
||||||
public class BlockBubbleCoral extends BlockUnderwaterPlant {
|
public class BlockBubbleCoral extends BlockUnderwaterPlant {
|
||||||
|
private static final VoxelShape SHAPE = Block.createCuboidShape(0, 0, 0, 16, 14, 16);
|
||||||
|
|
||||||
public BlockBubbleCoral() {
|
public BlockBubbleCoral() {
|
||||||
super(FabricBlockSettings.of(Material.UNDERWATER_PLANT)
|
super(FabricBlockSettings.of(Material.UNDERWATER_PLANT)
|
||||||
.breakByTool(FabricToolTags.SHEARS)
|
.breakByTool(FabricToolTags.SHEARS)
|
||||||
|
@ -36,4 +42,9 @@ public class BlockBubbleCoral extends BlockUnderwaterPlant {
|
||||||
double z = pos.getZ() + random.nextDouble();
|
double z = pos.getZ() + random.nextDouble();
|
||||||
world.addParticle(ParticleTypes.BUBBLE, x, y, z, 0.0D, 0.0D, 0.0D);
|
world.addParticle(ParticleTypes.BUBBLE, x, y, z, 0.0D, 0.0D, 0.0D);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ePos) {
|
||||||
|
return SHAPE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@ public class EntityEndSlime extends SlimeEntity {
|
||||||
if (BiomeRegistry.getFromBiome(world.getBiome(getBlockPos())) == BiomeRegistry.FOGGY_MUSHROOMLAND) {
|
if (BiomeRegistry.getFromBiome(world.getBiome(getBlockPos())) == BiomeRegistry.FOGGY_MUSHROOMLAND) {
|
||||||
this.setMossy(true);
|
this.setMossy(true);
|
||||||
}
|
}
|
||||||
|
this.calculateDimensions();
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,6 +88,7 @@ public class EntityEndSlime extends SlimeEntity {
|
||||||
slimeEntity.setAiDisabled(bl);
|
slimeEntity.setAiDisabled(bl);
|
||||||
slimeEntity.setInvulnerable(this.isInvulnerable());
|
slimeEntity.setInvulnerable(this.isInvulnerable());
|
||||||
((ISlime) slimeEntity).setSlimeSize(j, true);
|
((ISlime) slimeEntity).setSlimeSize(j, true);
|
||||||
|
slimeEntity.calculateDimensions();
|
||||||
slimeEntity.refreshPositionAndAngles(this.getX() + (double) g, this.getY() + 0.5D, this.getZ() + (double) h, this.random.nextFloat() * 360.0F, 0.0F);
|
slimeEntity.refreshPositionAndAngles(this.getX() + (double) g, this.getY() + 0.5D, this.getZ() + (double) h, this.random.nextFloat() * 360.0F, 0.0F);
|
||||||
this.world.spawnEntity(slimeEntity);
|
this.world.spawnEntity(slimeEntity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,8 @@ import ru.betterend.util.MHelper;
|
||||||
import ru.betterend.util.SpawnHelper;
|
import ru.betterend.util.SpawnHelper;
|
||||||
|
|
||||||
public class EntityRegistry {
|
public class EntityRegistry {
|
||||||
public static final EntityType<EntityDragonfly> DRAGONFLY = register("dragonfly", SpawnGroup.AMBIENT, 0.6F, 0.5F, EntityDragonfly::new, EntityDragonfly.createMobAttributes(), MHelper.color(32, 42, 176), MHelper.color(115, 225, 249));
|
public static final EntityType<EntityDragonfly> DRAGONFLY = register("dragonfly", SpawnGroup.AMBIENT, 0.6F, 0.5F, EntityDragonfly::new, EntityDragonfly.createMobAttributes(), true, MHelper.color(32, 42, 176), MHelper.color(115, 225, 249));
|
||||||
public static final EntityType<EntityEndSlime> END_SLIME = register("end_slime", SpawnGroup.MONSTER, 0.6F, 0.5F, EntityEndSlime::new, EntityEndSlime.createMobAttributes(), MHelper.color(28, 28, 28), MHelper.color(99, 11, 99));
|
public static final EntityType<EntityEndSlime> END_SLIME = register("end_slime", SpawnGroup.MONSTER, 2F, 2F, EntityEndSlime::new, EntityEndSlime.createMobAttributes(), false, MHelper.color(28, 28, 28), MHelper.color(99, 11, 99));
|
||||||
|
|
||||||
public static void register() {
|
public static void register() {
|
||||||
SpawnHelper.restrictionLand(END_SLIME, EntityEndSlime::canSpawn);
|
SpawnHelper.restrictionLand(END_SLIME, EntityEndSlime::canSpawn);
|
||||||
|
@ -29,8 +29,8 @@ public class EntityRegistry {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <T extends LivingEntity> EntityType<T> register(String name, SpawnGroup group, float width, float height, EntityFactory<T> entity, Builder attributes, int eggColor, int dotsColor) {
|
private static <T extends LivingEntity> EntityType<T> register(String name, SpawnGroup group, float width, float height, EntityFactory<T> entity, Builder attributes, boolean fixedSize, int eggColor, int dotsColor) {
|
||||||
EntityType<T> type = Registry.register(Registry.ENTITY_TYPE, BetterEnd.makeID(name), FabricEntityTypeBuilder.<T>create(group, entity).dimensions(EntityDimensions.fixed(width, height)).build());
|
EntityType<T> type = Registry.register(Registry.ENTITY_TYPE, BetterEnd.makeID(name), FabricEntityTypeBuilder.<T>create(group, entity).dimensions(fixedSize ? EntityDimensions.fixed(width, height) : EntityDimensions.changing(width, height)).build());
|
||||||
FabricDefaultAttributeRegistry.register(type, attributes);
|
FabricDefaultAttributeRegistry.register(type, attributes);
|
||||||
ItemRegistry.registerEgg("spawn_egg_" + name, type, eggColor, dotsColor);
|
ItemRegistry.registerEgg("spawn_egg_" + name, type, eggColor, dotsColor);
|
||||||
return type;
|
return type;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue