use of net.tropicraft.core.common.entity.passive.EntityKoaBase in project Tropicraft by Tropicraft.
the class TownKoaVillage method spawnMemberAtSpawnLocation.
/*public void spawnEntityRel(String parType, int memberID) {
BlockPos coords = listCoordsSpawn.get(memberID);
BlockPos coords = BuildManager.rotateNew(new BlockPos(MathHelper.floor_double(parCoords.xCoord), MathHelper.floor_double(parCoords.yCoord), MathHelper.floor_double(parCoords.zCoord)), direction,
Vec3d.createVectorHelper(spawn.getX(), spawn.getY(), spawn.getZ()),
Vec3d.createVectorHelper(areaWidth, areaHeight, areaLength));
EntityKoaBase ent = null;
if (parType.equals("fisher")) {
ent = new EntityKoaFisher(getWorld());
} else if (parType.equals("hunter")) {
ent = new EntityKoaHunter(getWorld());
} else if (parType.equals("trader")) {
ent = new EntityKoaTrader(getWorld());
} else if (parType.equals("shaman")) {
ent = new EntityKoaShaman(getWorld());
}
if (ent != null) {
ent.getAIAgent().setManagedLocation(this);
ent.setPosition(spawn.getX() + coords.getX() + 0.5F, spawn.getY() + coords.getY(), spawn.getZ() + coords.getZ() + 0.5F);
//ent.setPosition(parCoords.xCoord + 0.5F, parCoords.yCoord, parCoords.zCoord + 0.5F);
getWorld().spawnEntityInWorld(ent);
addEntity(parType, ent);
ent.onSpawnWithEgg(null);
}
//TODO: register entities with managedlocation, how are ids managed?
}*/
@Override
public EntityLivingBase spawnMemberAtSpawnLocation(SpawnLocationData parData) {
super.spawnMemberAtSpawnLocation(parData);
EntityKoaBase ent = null;
/*if (parData.type.equals("fisher")) {
ent = new EntityKoaFisher(getWorld());
} else if (parData.type.equals("hunter")) {
ent = new EntityKoaHunter(getWorld());
} else if (parData.type.equals("trader")) {
ent = new EntityKoaTrader(getWorld());
} else if (parData.type.equals("shaman")) {
ent = new EntityKoaShaman(getWorld());
}*/
ent = new EntityKoaHunter(getWorld());
if (ent != null) {
// ent.getAIAgent().setManagedLocation(this);
ent.setVillageID(this.locationID);
ent.setPosition(spawn.getX() + parData.coords.getX() + 0.5F, spawn.getY() + parData.coords.getY(), spawn.getZ() + parData.coords.getZ() + 0.5F);
// ent.setPosition(parCoords.xCoord + 0.5F, parCoords.yCoord, parCoords.zCoord + 0.5F);
getWorld().spawnEntity(ent);
parData.entityUUID = ent.getPersistentID();
ent.onInitialSpawn(getWorld().getDifficultyForLocation(ent.getPosition()), null);
ent.postSpawnGenderFix();
addEntity(ent);
}
return ent;
}
use of net.tropicraft.core.common.entity.passive.EntityKoaBase in project Tropicraft by Tropicraft.
the class EntityAIKoaMate method giveBirth.
/*private boolean canTownHandleMoreVillagers112()
{
TownKoaVillage village = villagerObj.getVillage();
if (village == null) {
if (villagerObj.findAndSetTownID(true)) {
village = villagerObj.getVillage();
//just in case
if (village == null) return false;
} else {
return false;
}
}
return village.getPopulationSize() < village.getMaxPopulationSize();
}*/
// TODO: 1.14 readd
private void giveBirth() {
AgeableMob entityvillager = this.villagerObj.getBreedOffspring((ServerLevel) world, this.mate);
this.mate.setAge(6000);
this.villagerObj.setAge(6000);
this.mate.setIsWillingToMate(false);
this.villagerObj.setIsWillingToMate(false);
// final net.minecraftforge.event.entity.living.BabyEntitySpawnEvent event = new net.minecraftforge.event.entity.living.BabyEntitySpawnEvent(villagerObj, mate, entityvillager);
// if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event) || event.getChild() == null) { return; }
// entityvillager = event.getChild();
entityvillager.setAge(-24000);
entityvillager.moveTo(villagerObj.getX(), villagerObj.getY(), villagerObj.getZ(), 0.0F, 0.0F);
if (entityvillager instanceof EntityKoaBase) {
((EntityKoaBase) entityvillager).setVillageAndDimID(villagerObj.getVillageID(), villagerObj.getVillageDimension());
entityvillager.restrictTo(villagerObj.getRestrictCenter(), EntityKoaBase.MAX_HOME_DISTANCE);
// TODO: 1.14 readd
/*TownKoaVillage village = villagerObj.getVillage();
if (village != null) {
((EntityKoaBase) entityvillager).postSpawnGenderFix();
village.addEntity(entityvillager);
}*/
((EntityKoaBase) entityvillager).updateUniqueEntityAI();
entityvillager.level.playSound(null, entityvillager.blockPosition(), SoundEvents.CHICKEN_EGG, SoundSource.AMBIENT, 1, 1);
}
this.world.addFreshEntity(entityvillager);
this.world.broadcastEntityEvent(entityvillager, (byte) 12);
}
use of net.tropicraft.core.common.entity.passive.EntityKoaBase in project Tropicraft by Tropicraft.
the class FishingBobberEntityRenderer method render.
public void render(FishingBobberEntity pEntity, float pEntityYaw, float pPartialTicks, PoseStack pMatrixStack, MultiBufferSource pBuffer, int pPackedLight) {
EntityKoaBase koa = pEntity.getAngler();
if (koa != null) {
pMatrixStack.pushPose();
pMatrixStack.pushPose();
pMatrixStack.scale(0.5F, 0.5F, 0.5F);
pMatrixStack.mulPose(this.entityRenderDispatcher.cameraOrientation());
pMatrixStack.mulPose(Vector3f.YP.rotationDegrees(180.0F));
PoseStack.Pose posestack$pose = pMatrixStack.last();
Matrix4f matrix4f = posestack$pose.pose();
Matrix3f matrix3f = posestack$pose.normal();
VertexConsumer vertexconsumer = pBuffer.getBuffer(RENDER_TYPE);
vertex(vertexconsumer, matrix4f, matrix3f, pPackedLight, 0.0F, 0, 0, 1);
vertex(vertexconsumer, matrix4f, matrix3f, pPackedLight, 1.0F, 0, 1, 1);
vertex(vertexconsumer, matrix4f, matrix3f, pPackedLight, 1.0F, 1, 1, 0);
vertex(vertexconsumer, matrix4f, matrix3f, pPackedLight, 0.0F, 1, 0, 0);
pMatrixStack.popPose();
int i = koa.getMainArm() == HumanoidArm.RIGHT ? 1 : -1;
ItemStack itemstack = koa.getMainHandItem();
if (!itemstack.is(Items.FISHING_ROD)) {
i = -i;
}
float f = koa.getAttackAnim(pPartialTicks);
float f1 = Mth.sin(Mth.sqrt(f) * (float) Math.PI);
float f2 = Mth.lerp(pPartialTicks, koa.yBodyRotO, koa.yBodyRot) * ((float) Math.PI / 180F);
double d0 = (double) Mth.sin(f2);
double d1 = (double) Mth.cos(f2);
double d2 = (double) i * 0.35D;
double d3 = 0.8D;
double d4;
double d5;
double d6;
float f3;
d4 = Mth.lerp((double) pPartialTicks, koa.xo, koa.getX()) - d1 * d2 - d0 * 0.8D;
d5 = koa.yo + (double) koa.getEyeHeight() + (koa.getY() - koa.yo) * (double) pPartialTicks - 0.45D;
d6 = Mth.lerp((double) pPartialTicks, koa.zo, koa.getZ()) - d0 * d2 + d1 * 0.8D;
f3 = koa.isCrouching() ? -0.1875F : 0.0F;
double d9 = Mth.lerp((double) pPartialTicks, pEntity.xo, pEntity.getX());
double d10 = Mth.lerp((double) pPartialTicks, pEntity.yo, pEntity.getY()) + 0.25D;
double d8 = Mth.lerp((double) pPartialTicks, pEntity.zo, pEntity.getZ());
float f4 = (float) (d4 - d9);
float f5 = (float) (d5 - d10) + f3;
float f6 = (float) (d6 - d8);
VertexConsumer vertexconsumer1 = pBuffer.getBuffer(RenderType.lineStrip());
PoseStack.Pose posestack$pose1 = pMatrixStack.last();
int j = 16;
for (int k = 0; k <= 16; ++k) {
stringVertex(f4, f5, f6, vertexconsumer1, posestack$pose1, fraction(k, 16), fraction(k + 1, 16));
}
pMatrixStack.popPose();
super.render(pEntity, pEntityYaw, pPartialTicks, pMatrixStack, pBuffer, pPackedLight);
}
}
Aggregations