Skip to content

Commit 12ddd96

Browse files
committed
Some tweaks
1 parent ccdff6d commit 12ddd96

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

src/main/java/com/programmerdan/minecraft/addgun/guns/Guns.java

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.bukkit.event.Event.Result;
3232
import org.bukkit.event.block.BlockBreakEvent;
3333
import org.bukkit.event.block.BlockDamageEvent;
34+
import org.bukkit.event.block.BlockExplodeEvent;
3435
import org.bukkit.event.entity.EntityDamageByEntityEvent;
3536
import org.bukkit.event.entity.EntityPickupItemEvent;
3637
import org.bukkit.event.entity.ProjectileHitEvent;
@@ -95,6 +96,7 @@ public Guns() {
9596
public void gunBulletHitGroundEvent(ProjectileHitEvent event) {
9697
if (!(event.getEntity() instanceof Projectile)) return;
9798
if (event.getHitBlock() == null) return;
99+
98100
Projectile bullet = (Projectile) event.getEntity();
99101

100102
StandardGun gun = bulletToGunMap.get(bullet.getName());
@@ -115,6 +117,29 @@ public void gunBulletHitGroundEvent(ProjectileHitEvent event) {
115117
return;
116118
}
117119

120+
Material block = event.getHitBlock().getType();
121+
if (!block.isSolid() && block.isTransparent()) {
122+
if (Material.LAVA.equals(block) || Material.STATIONARY_LAVA.equals(block)) {
123+
// lava, it dies.
124+
} else {
125+
// respawn it
126+
/*Location newBegin = event.getHitBlock().getLocation().clone();
127+
if (hit instanceof Damageable) {
128+
Damageable dhit = (Damageable) hit;
129+
newBegin.add(bullet.getVelocity().normalize().multiply(dhit.getWidth() * 2));
130+
} else {
131+
newBegin.add(bullet.getVelocity().normalize().multiply(1.42)); // diagonalize!
132+
}
133+
AddGun.getPlugin().debug(" Just Missed at location {0}, spawning continue at {1} with velocity {2}",
134+
end, newBegin, bullet.getVelocity());
135+
136+
Projectile continueBullet = gun.shoot(newBegin, bulletType, bullet.getShooter(), bullet.getVelocity(), true);
137+
138+
gun.postMiss(whereEnd, hit, bullet, continueBullet, bulletType);
139+
*/
140+
}
141+
}
142+
118143
Location end = event.getHitBlock().getLocation().clone().add(0.5, 0.5, 0.5);
119144

120145
AddGun.getPlugin().debug("Warning: bullet {1} of {0} hit ground {2}", gun.getBulletTag(), bullet.getUniqueId(), end);
@@ -663,7 +688,6 @@ public void chunkUnloadClearBullets(ChunkUnloadEvent event) {
663688
}
664689
}
665690

666-
667691
/**
668692
* Using a supplied item, identifies which gun, or if none, null.
669693
*

src/main/java/com/programmerdan/minecraft/addgun/guns/StandardGun.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ public void manageDamage(HitDigest hitData, Damageable hit, Projectile bullet, B
676676
case RIGHT_ARM:
677677
case RIGHT_FOOT:
678678
case RIGHT_HAND:// all variants on body atm
679-
armorHit = equipment.getLeggings();
679+
armorHit = equipment.getChestplate();
680680
shield = equipment.getItemInOffHand();
681681
break;
682682
case BOOTS:
@@ -814,7 +814,7 @@ public void manageDamage(HitDigest hitData, Damageable hit, Projectile bullet, B
814814
case RIGHT_ARM:
815815
case RIGHT_FOOT:
816816
case RIGHT_HAND:// all variants on body atm
817-
equipment.setLeggings(armorHit);
817+
equipment.setChestplate(armorHit);
818818
if (tShield != null && Material.SHIELD.equals(tShield.getType())) {
819819
equipment.setItemInOffHand(shield);
820820
}
@@ -885,6 +885,7 @@ public void postHit(HitDigest hitData, Entity hit, Projectile bullet, Bullet bul
885885
@Override
886886
public void run() {
887887
world.createExplosion(loc.getX(), loc.getY(), loc.getZ(), bulletType.getExplosionLevel(), true, true);
888+
world.createExplosion(loc.getX(), loc.getY(), loc.getZ(), bulletType.getExplosionLevel() * 3, false, false);
888889
}
889890
} , 1l);
890891
dbg.append("Created explosion ").append(bulletType.getExplosionLevel()).append(" on hit, with fire ");
@@ -893,9 +894,10 @@ public void run() {
893894
@Override
894895
public void run() {
895896
world.createExplosion(loc.getX(), loc.getY(), loc.getZ(), bulletType.getExplosionLevel(), false, true);
897+
world.createExplosion(loc.getX(), loc.getY(), loc.getZ(), bulletType.getExplosionLevel() * 3, false, false);
896898
}
897899
}, 1l);
898-
dbg.append("Created explosion ").append(bulletType.getExplosionLevel()).append(" on hit, with fire ");
900+
dbg.append("Created explosion ").append(bulletType.getExplosionLevel()).append(" on hit, without fire ");
899901
}
900902
}
901903

0 commit comments

Comments
 (0)