Buckets & entity enhancements, cleanup
This commit is contained in:
parent
00fd2b6199
commit
3ec2edd6d5
234 changed files with 1988 additions and 1643 deletions
|
@ -2,6 +2,7 @@ package ru.betterend.entity;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.protocol.game.ClientboundGameEventPacket;
|
||||
|
@ -30,7 +31,6 @@ import net.minecraft.world.entity.animal.AbstractSchoolingFish;
|
|||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.ServerLevelAccessor;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
|
@ -49,7 +49,13 @@ public class CubozoaEntity extends AbstractSchoolingFish {
|
|||
@Override
|
||||
public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, SpawnGroupData entityData, CompoundTag entityTag) {
|
||||
SpawnGroupData data = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityTag);
|
||||
if (EndBiomes.getFromBiome(world.getBiome(blockPosition())) == EndBiomes.SULPHUR_SPRINGS) {
|
||||
if (entityTag != null) {
|
||||
if (entityTag.contains("variant"))
|
||||
this.entityData.set(VARIANT, entityTag.getByte("variant"));
|
||||
if (entityTag.contains("scale"))
|
||||
this.entityData.set(SCALE, entityTag.getByte("scale"));
|
||||
}
|
||||
else if (EndBiomes.getFromBiome(world.getBiome(blockPosition())) == EndBiomes.SULPHUR_SPRINGS) {
|
||||
this.entityData.set(VARIANT, (byte) 1);
|
||||
}
|
||||
this.refreshDimensions();
|
||||
|
@ -67,7 +73,7 @@ public class CubozoaEntity extends AbstractSchoolingFish {
|
|||
public void addAdditionalSaveData(CompoundTag tag) {
|
||||
super.addAdditionalSaveData(tag);
|
||||
tag.putByte("Variant", (byte) getVariant());
|
||||
tag.putByte("Scale", (byte) getScale());
|
||||
tag.putByte("Scale", getByteScale());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -80,6 +86,15 @@ public class CubozoaEntity extends AbstractSchoolingFish {
|
|||
this.entityData.set(SCALE, tag.getByte("Scale"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack getBucketItemStack() {
|
||||
ItemStack bucket = EndItems.BUCKET_CUBOZOA.getDefaultInstance();
|
||||
CompoundTag tag = bucket.getOrCreateTag();
|
||||
tag.putByte("variant", entityData.get(VARIANT));
|
||||
tag.putByte("scale", entityData.get(SCALE));
|
||||
return bucket;
|
||||
}
|
||||
|
||||
public static AttributeSupplier.Builder createMobAttributes() {
|
||||
return LivingEntity.createLivingAttributes()
|
||||
|
@ -91,9 +106,13 @@ public class CubozoaEntity extends AbstractSchoolingFish {
|
|||
public int getVariant() {
|
||||
return (int) this.entityData.get(VARIANT);
|
||||
}
|
||||
|
||||
public byte getByteScale() {
|
||||
return this.entityData.get(SCALE);
|
||||
}
|
||||
|
||||
public float getScale() {
|
||||
return this.entityData.get(SCALE) / 32F + 0.75F;
|
||||
return getByteScale() / 32F + 0.75F;
|
||||
}
|
||||
|
||||
public static boolean canSpawn(EntityType<CubozoaEntity> type, ServerLevelAccessor world, MobSpawnType spawnReason, BlockPos pos, Random random) {
|
||||
|
@ -117,11 +136,6 @@ public class CubozoaEntity extends AbstractSchoolingFish {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack getBucketItemStack() {
|
||||
return new ItemStack(Items.WATER_BUCKET);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getFlopSound() {
|
||||
return SoundEvents.SALMON_FLOP;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue