Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Sentry Gun #1467

Open
wants to merge 1 commit into
base: 1.12.2
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/main/java/com/flansmod/common/guns/EntityAAGun.java
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,11 @@ public void onUpdate()

Vec3d origin = rotate(type.barrelX[currentBarrel] / 16D - type.barrelZ[currentBarrel] / 16D,
type.barrelY[currentBarrel] / 16D,
type.barrelX[currentBarrel] / 16D + type.barrelZ[currentBarrel] / 16D).add(posX, posY, posZ);
type.barrelX[currentBarrel] / 16D + type.barrelZ[currentBarrel] / 16D).add(posX, posY + 1.5F, posZ);

Double radianYaw = Math.toRadians(gunYaw + 90F);
Double radianPitch = Math.toRadians(gunPitch);
Vector3f shootingDirection = new Vector3f(-Math.sin(radianYaw), Math.cos(radianYaw)*-Math.sin(radianPitch), Math.cos(radianYaw)*Math.cos(radianPitch));
Vector3f shootingDirection = new Vector3f(-Math.sin(radianYaw), -Math.sin(radianPitch), Math.cos(radianYaw)*Math.cos(radianPitch));

FireableGun weapon = new FireableGun(type, (float)type.damage, (float)type.accuracy, (float)type.damage, EnumSpreadPattern.circle);
FiredShot shot = new FiredShot(weapon, bullet, this, player);
Expand Down Expand Up @@ -430,14 +430,14 @@ public Entity getValidTarget()
return null;
if(placer == null && placerName != null)
placer = world.getPlayerEntityByName(placerName);
for(Object obj : world.getEntitiesWithinAABBExcludingEntity(this, getEntityBoundingBox().expand(type.targetRange, type.targetRange, type.targetRange)))
for(Object obj : world.getEntitiesWithinAABBExcludingEntity(this, getEntityBoundingBox().grow(type.targetRange, type.targetRange, type.targetRange)))
{
Entity candidateEntity = (Entity)obj;

if((type.targetMobs && candidateEntity instanceof EntityMob) || (type.targetPlayers && candidateEntity instanceof EntityPlayer))
{
//Check that this entity is actually in range and visible
if(candidateEntity.getDistanceSq(this) < type.targetRange * type.targetRange)
if(candidateEntity.getDistance(this) < type.targetRange)
{
if(candidateEntity instanceof EntityPlayer)
{
Expand Down