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

Turn Tinted Glass into bulletproof glass for pierce < 5 guns #264

Open
wants to merge 1 commit into
base: 1.20.1
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions src/main/java/com/tacz/guns/entity/EntityKineticBullet.java
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,10 @@ public boolean isTracerAmmo() {
return isTracerAmmo;
}

public int getPierce() {
return this.pierce;
}

public RandomSource getRandom() {
return this.random;
}
Expand Down
12 changes: 9 additions & 3 deletions src/main/java/com/tacz/guns/event/ammo/DestroyGlassBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,15 @@ public static void onAmmoHitBlock(AmmoHitBlockEvent event) {
EntityKineticBullet ammo = event.getAmmo();
Block stateBlock = state.getBlock();
NoteBlockInstrument instrument = state.instrument();
if (AmmoConfig.DESTROY_GLASS.get() && (stateBlock instanceof AbstractGlassBlock ||
stateBlock instanceof StainedGlassPaneBlock ||
(stateBlock instanceof IronBarsBlock && instrument.equals(NoteBlockInstrument.HAT)))) {
if (AmmoConfig.DESTROY_GLASS.get() &&
!(stateBlock instanceof TintedGlassBlock) &&
(stateBlock instanceof AbstractGlassBlock ||
stateBlock instanceof StainedGlassPaneBlock ||
(stateBlock instanceof IronBarsBlock && instrument.equals(NoteBlockInstrument.HAT)))) {
level.destroyBlock(pos, false, ammo.getOwner());
}
// Break tinted glass if bullet pierce value is 5 or more
if (stateBlock instanceof TintedGlassBlock && ammo.getPierce() >= 5) {
level.destroyBlock(pos, false, ammo.getOwner());
}
}
Expand Down