diff --git a/src/main/generated/assets/galacticraft/lang/en_us.json b/src/main/generated/assets/galacticraft/lang/en_us.json index 4211f9154..2b6c2a86d 100644 --- a/src/main/generated/assets/galacticraft/lang/en_us.json +++ b/src/main/generated/assets/galacticraft/lang/en_us.json @@ -543,6 +543,7 @@ "smithing_template.galacticraft.titanium_upgrade.ingredients": "Compressed Titanium", "star.galacticraft.sol": "Sol", "star.galacticraft.sol.description": "", + "subtitles.galacticraft.entity.throwable_meteor_chunk.throw": "Meteor Chunk flies", "tooltip.galacticraft.creative_only": "Creative Only", "tooltip.galacticraft.energy_remaining": "Energy Remaining: %s", "tooltip.galacticraft.glowstone_lantern": "Glowstone Lanterns are best used to light areas when there is no oxygen for lanterns to burn.", diff --git a/src/main/java/dev/galacticraft/mod/content/entity/ThrowableMeteorChunkEntity.java b/src/main/java/dev/galacticraft/mod/content/entity/ThrowableMeteorChunkEntity.java index f24d3a645..4194b3c40 100644 --- a/src/main/java/dev/galacticraft/mod/content/entity/ThrowableMeteorChunkEntity.java +++ b/src/main/java/dev/galacticraft/mod/content/entity/ThrowableMeteorChunkEntity.java @@ -74,10 +74,10 @@ public void addAdditionalSaveData(CompoundTag compound) { @Override protected Item getDefaultItem() { - if (this.entityData.get(HOT)) { - return GCItems.HOT_THROWABLE_METEOR_CHUNK; - } else { + if (this.entityData == null || !this.entityData.get(HOT)) { return GCItems.THROWABLE_METEOR_CHUNK; + } else { + return GCItems.HOT_THROWABLE_METEOR_CHUNK; } } diff --git a/src/main/java/dev/galacticraft/mod/content/item/HotThrowableMeteorChunkItem.java b/src/main/java/dev/galacticraft/mod/content/item/HotThrowableMeteorChunkItem.java index a75645c32..5899fc13b 100644 --- a/src/main/java/dev/galacticraft/mod/content/item/HotThrowableMeteorChunkItem.java +++ b/src/main/java/dev/galacticraft/mod/content/item/HotThrowableMeteorChunkItem.java @@ -27,6 +27,7 @@ import dev.galacticraft.mod.util.Translations; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Style; +import net.minecraft.sounds.SoundEvents; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; @@ -35,6 +36,7 @@ import net.minecraft.world.level.Level; import java.util.List; +import java.util.Objects; public class HotThrowableMeteorChunkItem extends ThrowableMeteorChunkItem { public static int MAX_TICKS = 45 * 20; @@ -61,12 +63,7 @@ public void inventoryTick(ItemStack stack, Level level, Entity entity, int slotI return; Integer i = stack.get(GCDataComponents.TICKS_UNTIL_COOL); - int ticks; - if (i == null) { - ticks = MAX_TICKS; - } else { - ticks = i; - } + int ticks = Objects.requireNonNullElse(i, MAX_TICKS); if (ticks == 0) { if (entity instanceof Player player) { @@ -77,6 +74,8 @@ public void inventoryTick(ItemStack stack, Level level, Entity entity, int slotI Inventory inventory = player.getInventory(); inventory.setItem(slotId, new ItemStack(GCItems.THROWABLE_METEOR_CHUNK, stack.getCount())); inventory.setChanged(); + + player.playSound(SoundEvents.GENERIC_EXTINGUISH_FIRE, 0.7F, 1.6F + (player.getRandom().nextFloat() - player.getRandom().nextFloat()) * 0.4F); // Entity::playEntityOnFireExtinguishedSound() } } stack.set(GCDataComponents.TICKS_UNTIL_COOL, ticks - 1); diff --git a/src/main/java/dev/galacticraft/mod/content/item/ThrowableMeteorChunkItem.java b/src/main/java/dev/galacticraft/mod/content/item/ThrowableMeteorChunkItem.java index edaa6d14c..2ab66c4bf 100644 --- a/src/main/java/dev/galacticraft/mod/content/item/ThrowableMeteorChunkItem.java +++ b/src/main/java/dev/galacticraft/mod/content/item/ThrowableMeteorChunkItem.java @@ -24,7 +24,6 @@ import dev.galacticraft.mod.content.GCSounds; import dev.galacticraft.mod.content.entity.ThrowableMeteorChunkEntity; -import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResultHolder; @@ -41,16 +40,8 @@ public ThrowableMeteorChunkItem(Properties settings) { @Override public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { ItemStack itemStack = player.getItemInHand(usedHand); - level.playSound( - null, - player.getX(), - player.getY(), - player.getZ(), - GCSounds.METEOR_CHUNK_THROW, - SoundSource.NEUTRAL, - 0.5F, - 0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F) - ); + player.playSound(GCSounds.METEOR_CHUNK_THROW, 0.5F, 0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F)); + if (!level.isClientSide) { ThrowableMeteorChunkEntity projectile = new ThrowableMeteorChunkEntity(player, level, itemStack.is(GCItems.HOT_THROWABLE_METEOR_CHUNK)); projectile.setItem(itemStack); diff --git a/src/main/java/dev/galacticraft/mod/data/GCTranslationProvider.java b/src/main/java/dev/galacticraft/mod/data/GCTranslationProvider.java index d7604385b..0f0a792d7 100644 --- a/src/main/java/dev/galacticraft/mod/data/GCTranslationProvider.java +++ b/src/main/java/dev/galacticraft/mod/data/GCTranslationProvider.java @@ -130,6 +130,8 @@ protected void generateTranslations(HolderLookup.@NotNull Provider registries) { this.add(Chat.BED_FAIL, "Uh oh, what if the oxygen runs out when I am asleep? I'll need a Cryogenic Chamber to sleep in space!"); this.add(Chat.ROCKET_WARNING, "Press again to launch."); + this.add(Subtitles.THROW_METEOR_CHUNK, "Meteor Chunk flies"); + this.add(RegistryDebug.DUMP, "Dumped: %s"); this.add(RegistryDebug.ID, "%s - %s: %s"); diff --git a/src/main/java/dev/galacticraft/mod/util/Translations.java b/src/main/java/dev/galacticraft/mod/util/Translations.java index 85adfd927..9c93a107c 100644 --- a/src/main/java/dev/galacticraft/mod/util/Translations.java +++ b/src/main/java/dev/galacticraft/mod/util/Translations.java @@ -43,6 +43,10 @@ interface Chat { String ROCKET_WARNING = "chat.galacticraft.rocket.warning"; } + interface Subtitles { + String THROW_METEOR_CHUNK = "subtitles.galacticraft.entity.throwable_meteor_chunk.throw"; + } + interface RegistryDebug { String DUMP = "commands.galacticraft.debug.registry.dump"; String ID = "commands.galacticraft.debug.registry.id"; diff --git a/src/main/resources/assets/galacticraft/sounds.json b/src/main/resources/assets/galacticraft/sounds.json index 1910a1f5b..ed934a5d0 100644 --- a/src/main/resources/assets/galacticraft/sounds.json +++ b/src/main/resources/assets/galacticraft/sounds.json @@ -143,6 +143,15 @@ } ] }, + "entity.throwable_meteor_chunk.throw": { + "subtitle": "subtitles.galacticraft.entity.throwable_meteor_chunk.throw", + "sounds": [ + { + "name": "minecraft:random/bow", + "stream": false + } + ] + }, "ambience.singledrip": { "sounds": [ "galacticraft:ambience/singledrip1", diff --git a/src/main/resources/assets/galacticraft/textures/item/hot_throwable_meteor_chunk.png b/src/main/resources/assets/galacticraft/textures/item/hot_throwable_meteor_chunk.png new file mode 100644 index 000000000..4f43139c6 Binary files /dev/null and b/src/main/resources/assets/galacticraft/textures/item/hot_throwable_meteor_chunk.png differ diff --git a/src/main/resources/assets/galacticraft/textures/item/throwable_meteor_chunk.png b/src/main/resources/assets/galacticraft/textures/item/throwable_meteor_chunk.png new file mode 100644 index 000000000..b13e604a3 Binary files /dev/null and b/src/main/resources/assets/galacticraft/textures/item/throwable_meteor_chunk.png differ