-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating Fragmentation Grenade Parts
Increase of Grab Blaster Bolts set off C-25 FG Blocks Ticking Sound when it's primed Updating Fragmentation Grenade Item class Adding FG tooltip to lang file Adding Off texture for block Starting work on item renderer Creating GrenadeItemSoundInstance as a superclass
- Loading branch information
1 parent
21e890c
commit 7af3291
Showing
20 changed files
with
333 additions
and
281 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
.../src/main/java/com/parzivail/pswg/client/sound/FragmentationGrenadeItemSoundInstance.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.parzivail.pswg.client.sound; | ||
|
||
import com.parzivail.pswg.container.SwgSounds; | ||
import com.parzivail.pswg.item.FragmentationGrenadeItem; | ||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.item.ItemStack; | ||
|
||
@Environment(EnvType.CLIENT) | ||
public class FragmentationGrenadeItemSoundInstance extends GrenadeItemSoundInstance implements ISoftRepeatSound | ||
{ | ||
public FragmentationGrenadeItemSoundInstance(PlayerEntity player) | ||
{ | ||
super(player, SwgSounds.Explosives.THERMAL_DETONATOR_BEEP); | ||
} | ||
|
||
@Override | ||
public boolean isItem(ItemStack stack) | ||
{ | ||
if (stack.getItem() instanceof FragmentationGrenadeItem) | ||
{ | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
; | ||
} |
104 changes: 104 additions & 0 deletions
104
projects/pswg/src/main/java/com/parzivail/pswg/client/sound/GrenadeItemSoundInstance.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
package com.parzivail.pswg.client.sound; | ||
|
||
import com.parzivail.pswg.item.ThrowableExplosiveTag; | ||
import com.parzivail.util.sound.DopplerSoundInstance; | ||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
import net.minecraft.client.sound.SoundInstance; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.sound.SoundCategory; | ||
import net.minecraft.sound.SoundEvent; | ||
|
||
@Environment(EnvType.CLIENT) | ||
public class GrenadeItemSoundInstance extends DopplerSoundInstance implements ISoftRepeatSound | ||
{ | ||
private final PlayerEntity player; | ||
|
||
public GrenadeItemSoundInstance(PlayerEntity player, SoundEvent soundEvent) | ||
{ | ||
super(player, soundEvent, SoundCategory.PLAYERS, SoundInstance.createRandom()); | ||
this.player = player; | ||
this.repeat = true; | ||
this.repeatDelay = 0; | ||
this.volume = 0.75F; | ||
this.x = (float)player.getX(); | ||
this.y = (float)player.getY(); | ||
this.z = (float)player.getZ(); | ||
} | ||
|
||
@Override | ||
public boolean canPlay() | ||
{ | ||
return !this.player.isSilent(); | ||
} | ||
|
||
@Override | ||
public boolean shouldAlwaysPlay() | ||
{ | ||
return true; | ||
} | ||
|
||
public PlayerEntity getPlayer() | ||
{ | ||
return player; | ||
} | ||
|
||
@Override | ||
public void tick() | ||
{ | ||
super.tick(); | ||
|
||
if (this.player.isRemoved()) | ||
{ | ||
this.setDone(); | ||
return; | ||
} | ||
|
||
var foundItem = false; | ||
|
||
if (isItem(player.getMainHandStack()) && isPrimed(player.getMainHandStack())) | ||
foundItem = true; | ||
|
||
if (isItem(player.getOffHandStack()) && isPrimed(player.getOffHandStack())) | ||
foundItem = true; | ||
|
||
if (!areConditionsMet(player)) | ||
{ | ||
this.setDone(); | ||
return; | ||
} | ||
if (foundItem) | ||
volume = 0.75f; | ||
else | ||
volume = 0.25f; | ||
|
||
this.x = (float)this.player.getX(); | ||
this.y = (float)this.player.getY(); | ||
this.z = (float)this.player.getZ(); | ||
} | ||
|
||
public boolean areConditionsMet(PlayerEntity player) | ||
{ | ||
for (int i = 0; i < player.getInventory().size(); i++) | ||
if (isItem(player.getInventory().getStack(i)) && isPrimed(player.getInventory().getStack(i))) | ||
return true; | ||
return false; | ||
} | ||
|
||
public boolean isItem(ItemStack stack) | ||
{ | ||
return false; | ||
} | ||
|
||
; | ||
|
||
private boolean isPrimed(ItemStack stack) | ||
{ | ||
if (!(isItem(stack))) | ||
return false; | ||
|
||
var tet = new ThrowableExplosiveTag(stack.getOrCreateNbt()); | ||
return tet.primed; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.