use of net.tropicraft.core.common.item.AshenMaskItem in project Tropicraft by Tropicraft.
the class TropicraftRenderLayers method registerLayers.
@SubscribeEvent
public static void registerLayers(EntityRenderersEvent.RegisterLayerDefinitions event) {
KOA_HUNTER_LAYER = registerMain("koa_hunter", KoaModel::create, event);
TROPI_CREEPER_LAYER = registerMain("tropi_creeper", TropiCreeperModel::create, event);
IGUANA_LAYER = registerMain("iguana", IguanaModel::create, event);
UMBRELLA_LAYER = registerMain("umbrella", UmbrellaModel::create, event);
BEACH_FLOAT_LAYER = registerMain("beach_float", BeachFloatModel::create, event);
CHAIR_LAYER = registerMain("chair", ChairModel::create, event);
TROPI_SKELLY_LAYER = registerMain("tropi_skelly", TropiSkellyModel::create, event);
EIH_LAYER = registerMain("eih", EIHModel::create, event);
SEA_TURTLE_LAYER = registerMain("sea_turtle", SeaTurtleModel::create, event);
MARLIN_LAYER = registerMain("marlin", MarlinModel::create, event);
FAILGULL_LAYER = registerMain("failgull", FailgullModel::create, event);
DOLPHIN_LAYER = registerMain("dolphin", TropicraftDolphinModel::create, event);
SEAHORSE_LAYER = registerMain("seahorse", SeahorseModel::create, event);
TREE_FROG_LAYER = registerMain("tree_frog", TreeFrogModel::create, event);
SEA_URCHIN_LAYER = registerMain("sea_urchin", SeaUrchinModel::create, event);
SEA_URCHIN_EGG_ENTITY_LAYER = registerMain("sea_urchin_egg", EggModel::create, event);
STARFISH_EGG_LAYER = registerMain("starfish_egg", EggModel::create, event);
V_MONKEY_LAYER = registerMain("v_monkey", VMonkeyModel::create, event);
PIRANHA_LAYER = registerMain("piranha", PiranhaModel::create, event);
RIVER_SARDINE_LAYER = registerMain("river_sardine", SardineModel::create, event);
TROPICAL_FISH_LAYER = registerMain("tropical_fish", TropicraftTropicalFishModel::create, event);
EAGLE_RAY_LAYER = registerMain("eagle_ray", EagleRayModel::create, event);
TROPI_SPIDER_EGG_LAYER = registerMain("tropi_spider_egg", EggModel::create, event);
ASHEN_LAYER = registerMain("ashen", AshenModel::create, event);
HAMMERHEAD_LAYER = registerMain("hammerhead", SharkModel::create, event);
SEA_TURTLE_EGG_LAYER = registerMain("turtle_egg", EggModel::create, event);
TROPI_BEE_LAYER = registerMain("tropi_bee", TropiBeeModel::createBodyLayer, event);
COWKTAIL_LAYER = registerMain("cowktail", CowModel::createBodyLayer, event);
MAN_O_WAR_OUTER_LAYER = registerMain("man_o_war", ManOWarModel::createOuterModel, event);
MAN_O_WAR_GEL_LAYER = registerMain("man_o_war_gel", ManOWarModel::createGelLayerModel, event);
BAMBOO_MUG = registerMain("bamboo_mug", BambooMugModel::create, event);
// BAMBOO_CHEST = registerMain("bamboo_chest", BambooChestRenderer);
// BAMBOO_DOUBLE_CHEST_LEFT = registerMain("bamboo_double_chest_left", () -> BambooChestBlockEntityRenderer.getLeftDoubleTexturedModelData());
// BAMBOO_DOUBLE_CHEST_RIGHT = registerMain("bamboo_double_chest_right", () -> BambooChestBlockEntityRenderer.getRightDoubleTexturedModelData());
EIHMACHINE_LAYER = registerMain("drink_mixer", EIHMachineModel::create, event);
AIRCOMPRESSOR_LAYER = registerMain("air_compressor", EIHMachineModel::create, event);
BASILISK_LIZARD_LAYER = registerMain("basilisk_lizard", BasiliskLizardModel::create, event);
CUBERA_LAYER = registerMain("cubera", CuberaModel::create, event);
FIDDLER_CRAB_LAYER = registerMain("fiddler_crab", FiddlerCrabModel::create, event);
HUMMINGBIRD_LAYER = registerMain("hummingbird", HummingbirdModel::create, event);
JAGUAR_LAYER = registerMain("jaguar", JaguarModel::create, event);
TAPIR_LAYER = registerMain("tapir", TapirModel::create, event);
SPIDER_MONKEY_LAYER = registerMain("spider_monkey", SpiderMonkeyModel::create, event);
WHITE_LIPPED_PECCARY_LAYER = registerMain("white_lipped_peccary", WhiteLippedPeccaryModel::create, event);
// ArrayList<MaskArmorProvider> MASK_PROVIDER = new ArrayList<>();
final List<RegistryObject<AshenMaskItem>> masks = TropicraftItems.ASHEN_MASKS.values().asList();
for (RegistryObject<AshenMaskItem> maskItem : masks) {
ModelLayerLocation ashen_mask_layer = registerMain("ashen_mask_" + maskItem.get().getMaskType().name().toLowerCase(Locale.ROOT), PlayerHeadpieceModel::create, event);
ASHEN_MASK_LAYERS.add(ashen_mask_layer);
}
STACHE_LAYER = registerMain("nigel_stache", PlayerHeadpieceModel::create, event);
HEAD_SCUBA_LAYER = registerMain("scuba_goggles", ModelScubaGear::create, event);
CHEST_SCUBA_LAYER = registerMain("scuba_harness", ModelScubaGear::create, event);
FEET_SCUBA_LAYER = registerMain("scuba_flippers", ModelScubaGear::create, event);
TANK_SCUBA_LAYER = registerMain("pony_bottle", ModelScubaGear::create, event);
setupScubaGearModels();
}
use of net.tropicraft.core.common.item.AshenMaskItem in project Tropicraft by Tropicraft.
the class EntityAIMeleeAndRangedAttack method tick.
/**
* Updates the task
*/
@Override
public void tick() {
if (attackTarget != null) {
ItemStack headGear = attackTarget.getItemBySlot(EquipmentSlot.HEAD);
if (headGear.getItem() instanceof AshenMaskItem) {
return;
}
}
double d0 = entityHost.distanceToSqr(attackTarget.getX(), attackTarget.getBoundingBox().minY, attackTarget.getZ());
boolean flag = entityHost.getSensing().hasLineOfSight(attackTarget);
if (flag) {
++seeTime;
} else {
seeTime = 0;
}
if (d0 <= (double) shootCutoffRangeSqr && seeTime >= 20) {
// this.entityHost.getNavigation().clearPathEntity();
} else {
// this.entityHost.getNavigation().tryMoveToEntityLiving(this.attackTarget, this.entityMoveSpeed);
}
if (seeTime >= 20) {
entityHost.getNavigation().moveTo(attackTarget, entityMoveSpeed);
}
entityHost.getLookControl().setLookAt(attackTarget, 30.0F, 30.0F);
float f;
if (--rangedAttackTime <= 0) {
f = Mth.sqrt((float) d0) / shootCutoffRange;
float f1 = f;
if (f < 0.1F) {
f1 = 0.1F;
}
if (f1 > 1.0F) {
f1 = 1.0F;
}
if (d0 >= (double) shootCutoffRange * (double) shootCutoffRange) {
rangedAttackEntityHost.performRangedAttack(attackTarget, f1);
rangedAttackTime = maxRangedAttackTime;
} else if (d0 <= meleeHitRange * meleeHitRange) {
entityHost.doHurtTarget(attackTarget);
entityHost.swing(InteractionHand.MAIN_HAND);
rangedAttackTime = maxMeleeAttackTime;
}
}
}
use of net.tropicraft.core.common.item.AshenMaskItem in project Tropicraft by Tropicraft.
the class AIAshenShootDart method tick.
@Override
public void tick() {
LivingEntity target = entity.getTarget();
if (target != null) {
ItemStack headGear = target.getItemBySlot(EquipmentSlot.HEAD);
if (headGear.getItem() instanceof AshenMaskItem) {
return;
}
double d0 = entity.distanceToSqr(target.getX(), target.getBoundingBox().minY, target.getZ());
boolean canSeeEnemy = entity.getSensing().hasLineOfSight(target);
boolean hasSeenEnemy = seeTime > 0;
if (canSeeEnemy != hasSeenEnemy) {
seeTime = 0;
}
if (canSeeEnemy) {
++seeTime;
} else {
--seeTime;
}
if (d0 <= (double) maxAttackDistance && seeTime >= 20) {
entity.getNavigation().stop();
++strafingTime;
} else {
entity.getNavigation().moveTo(target, moveSpeedAmplifier);
strafingTime = -1;
}
if (strafingTime >= 20) {
if ((double) entity.getRandom().nextFloat() < 0.3D) {
strafingClockwise = !strafingClockwise;
}
if ((double) entity.getRandom().nextFloat() < 0.3D) {
strafingBackwards = !strafingBackwards;
}
strafingTime = 0;
}
if (strafingTime > -1) {
if (d0 > (double) (maxAttackDistance * 0.75F)) {
strafingBackwards = false;
} else if (d0 < (double) (maxAttackDistance * 0.25F)) {
strafingBackwards = true;
}
entity.getMoveControl().strafe(strafingBackwards ? -0.5F : 0.5F, strafingClockwise ? 0.5F : -0.5F);
entity.lookAt(target, 30.0F, 30.0F);
} else {
entity.getLookControl().setLookAt(target, 30.0F, 30.0F);
}
if (entity.isUsingItem()) {
if (!canSeeEnemy && seeTime < -60) {
entity.stopUsingItem();
} else if (canSeeEnemy) {
int i = entity.getTicksUsingItem();
if (i >= 20) {
entity.stopUsingItem();
entity.performRangedAttack(target, (float) (14 - entity.level.getDifficulty().getId() * 4));
attackTime = attackCooldown;
}
}
} else if (--attackTime <= 0 && seeTime >= -60) {
entity.startUsingItem(InteractionHand.MAIN_HAND);
}
}
}
use of net.tropicraft.core.common.item.AshenMaskItem in project Tropicraft by Tropicraft.
the class AshenEntity method performRangedAttack.
@Override
public void performRangedAttack(LivingEntity target, float velocity) {
ItemStack headGear = target.getItemBySlot(EquipmentSlot.HEAD);
// Don't shoot things wearing ashen masks
if (headGear.getItem() instanceof AshenMaskItem) {
return;
}
Arrow tippedArrow = BlowGunItem.createArrow(level, this, BlowGunItem.getProjectile());
double d0 = target.getX() - getX();
double d1 = target.getBoundingBox().minY + (double) (target.getBbHeight() / 3.0F) - tippedArrow.getY();
double d2 = target.getZ() - getZ();
double d3 = Mth.sqrt((float) (d0 * d0 + d2 * d2));
tippedArrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, velocity);
tippedArrow.setBaseDamage(1);
tippedArrow.setKnockback(0);
playSound(SoundEvents.CROSSBOW_SHOOT, 1.0F, 1.0F / (getRandom().nextFloat() * 0.4F + 0.8F));
level.addFreshEntity(tippedArrow);
}
Aggregations