Merge remote-tracking branch 'origin/1.19' into 1.19
This commit is contained in:
commit
daece9a38d
3 changed files with 45 additions and 5 deletions
|
@ -1,12 +1,17 @@
|
|||
package org.betterx.betterend.entity;
|
||||
|
||||
import org.betterx.bclib.entity.DespawnableAnimal;
|
||||
import static org.betterx.betterend.registry.EndEntities.SILK_MOTH;
|
||||
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.animal.Animal;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import org.betterx.bclib.util.BlocksHelper;
|
||||
import org.betterx.bclib.util.MHelper;
|
||||
import org.betterx.betterend.BetterEnd;
|
||||
import org.betterx.betterend.blocks.EndBlockProperties;
|
||||
import org.betterx.betterend.blocks.basis.EndPlantBlock;
|
||||
import org.betterx.betterend.registry.EndBlocks;
|
||||
import org.betterx.betterend.registry.EndEntities;
|
||||
import org.betterx.betterend.registry.EndItems;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
|
@ -46,7 +51,7 @@ import net.minecraft.world.phys.Vec3;
|
|||
import java.util.EnumSet;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class SilkMothEntity extends DespawnableAnimal implements FlyingAnimal {
|
||||
public class SilkMothEntity extends Animal implements FlyingAnimal {
|
||||
private BlockPos hivePos;
|
||||
private BlockPos entrance;
|
||||
private Level hiveWorld;
|
||||
|
@ -76,11 +81,12 @@ public class SilkMothEntity extends DespawnableAnimal implements FlyingAnimal {
|
|||
|
||||
@Override
|
||||
public boolean canBeLeashed(Player player) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAdditionalSaveData(CompoundTag tag) {
|
||||
super.addAdditionalSaveData(tag);
|
||||
if (hivePos != null) {
|
||||
tag.put("HivePos", NbtUtils.writeBlockPos(hivePos));
|
||||
tag.putString("HiveWorld", hiveWorld.dimension().location().toString());
|
||||
|
@ -89,6 +95,7 @@ public class SilkMothEntity extends DespawnableAnimal implements FlyingAnimal {
|
|||
|
||||
@Override
|
||||
public void readAdditionalSaveData(CompoundTag tag) {
|
||||
super.readAdditionalSaveData(tag);
|
||||
if (tag.contains("HivePos")) {
|
||||
hivePos = NbtUtils.readBlockPos(tag.getCompound("HivePos"));
|
||||
ResourceLocation worldID = new ResourceLocation(tag.getString("HiveWorld"));
|
||||
|
@ -322,4 +329,17 @@ public class SilkMothEntity extends DespawnableAnimal implements FlyingAnimal {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFood(ItemStack itemStack) {
|
||||
if (!(itemStack.getItem() instanceof BlockItem)){
|
||||
return false;
|
||||
}
|
||||
return ((BlockItem) (itemStack.getItem())).getBlock() instanceof EndPlantBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InteractionResult mobInteract(Player player, InteractionHand interactionHand) {
|
||||
return super.mobInteract(player, interactionHand);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.betterx.betterend.entity.model;
|
||||
|
||||
import org.betterx.betterend.BetterEnd;
|
||||
import org.betterx.betterend.entity.SilkMothEntity;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
@ -179,9 +180,17 @@ public class SilkMothEntityModel extends EntityModel<SilkMothEntity> {
|
|||
float blue,
|
||||
float alpha
|
||||
) {
|
||||
if (this.young) {
|
||||
matrices.pushPose();
|
||||
matrices.scale(0.6f, 0.6f, 0.6f);
|
||||
matrices.translate(0f, 0.5f, 0f);
|
||||
}
|
||||
bb_main.render(matrices, vertices, light, overlay);
|
||||
head_pivot.render(matrices, vertices, light, overlay);
|
||||
legsL.render(matrices, vertices, light, overlay);
|
||||
legsR.render(matrices, vertices, light, overlay);
|
||||
if (this.young) {
|
||||
matrices.popPose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue