diff --git a/src/main/java/gregtech/GregTechMod.java b/src/main/java/gregtech/GregTechMod.java index 0f7446aa430..ba0dd90c7e7 100644 --- a/src/main/java/gregtech/GregTechMod.java +++ b/src/main/java/gregtech/GregTechMod.java @@ -9,6 +9,7 @@ import gregtech.api.gui.UIFactory; import gregtech.api.items.gui.PlayerInventoryUIFactory; import gregtech.api.metatileentity.MetaTileEntityUIFactory; +import gregtech.api.sound.GTSounds; import gregtech.api.model.ResourcePackHook; import gregtech.api.net.NetworkHandler; import gregtech.api.recipes.RecipeMap; @@ -117,6 +118,8 @@ public void onPreInit(FMLPreInitializationEvent event) { MetaItems.init(); MetaFluids.init(); + GTSounds.registerSounds(); + /* Start MetaTileEntity Registration */ MTE_REGISTRY.unfreeze(); GTLog.logger.info("Registering GTCEu Meta Tile Entities"); diff --git a/src/main/java/gregtech/api/GTValues.java b/src/main/java/gregtech/api/GTValues.java index 487ec0936a4..b5fed247952 100644 --- a/src/main/java/gregtech/api/GTValues.java +++ b/src/main/java/gregtech/api/GTValues.java @@ -120,6 +120,8 @@ public static boolean isModLoaded(String modid) { Class.forName(modid); isLoaded = true; } catch (ClassNotFoundException ignored) { + } catch (NoClassDefFoundError ignored) { + isLoaded = true; } } isModLoadedCache.put(modid, isLoaded); diff --git a/src/main/java/gregtech/api/block/machines/BlockMachine.java b/src/main/java/gregtech/api/block/machines/BlockMachine.java index 03e2262f35b..c481156d0f4 100755 --- a/src/main/java/gregtech/api/block/machines/BlockMachine.java +++ b/src/main/java/gregtech/api/block/machines/BlockMachine.java @@ -10,11 +10,15 @@ import gregtech.api.GregTechAPI; import gregtech.api.block.BlockCustomParticle; import gregtech.api.capability.GregtechCapabilities; +import gregtech.api.capability.tool.IHammerItem; import gregtech.api.capability.tool.IScrewdriverItem; import gregtech.api.capability.tool.IWrenchItem; import gregtech.api.cover.CoverBehavior; import gregtech.api.cover.ICoverable; import gregtech.api.cover.IFacadeCover; +import gregtech.api.items.metaitem.MetaItem; +import gregtech.api.items.toolitem.IToolStats; +import gregtech.api.items.toolitem.ToolMetaItem; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.MetaTileEntityHolder; import gregtech.api.pipenet.block.BlockPipe; @@ -331,6 +335,11 @@ public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @ if (wrenchItem.damageItem(DamageValues.DAMAGE_FOR_WRENCH, true) && metaTileEntity.onWrenchClick(playerIn, hand, wrenchDirection, rayTraceResult)) { + + if(itemStack.getItem() instanceof ToolMetaItem) { + IToolStats stats = ((ToolMetaItem) itemStack.getItem()).getItem(itemStack).getToolStats(); + stats.onBreakingUse(itemStack); + } wrenchItem.damageItem(DamageValues.DAMAGE_FOR_WRENCH, false); return true; } diff --git a/src/main/java/gregtech/api/capability/GregtechCapabilities.java b/src/main/java/gregtech/api/capability/GregtechCapabilities.java index 9829eaa3677..a49b8f63f7b 100644 --- a/src/main/java/gregtech/api/capability/GregtechCapabilities.java +++ b/src/main/java/gregtech/api/capability/GregtechCapabilities.java @@ -2,10 +2,7 @@ import gregtech.api.GTValues; import gregtech.api.capability.impl.EUToFEProvider; -import gregtech.api.capability.tool.ICutterItem; -import gregtech.api.capability.tool.IScrewdriverItem; -import gregtech.api.capability.tool.ISoftHammerItem; -import gregtech.api.capability.tool.IWrenchItem; +import gregtech.api.capability.tool.*; import gregtech.api.terminal.hardware.HardwareProvider; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; @@ -36,6 +33,10 @@ public class GregtechCapabilities { @CapabilityInject(ISoftHammerItem.class) public static Capability CAPABILITY_MALLET = null; + @CapabilityInject(IHammerItem.class) + public static Capability CAPABILITY_HAMMER = null; + + @CapabilityInject(IFuelable.class) public static Capability CAPABILITY_FUELABLE = null; diff --git a/src/main/java/gregtech/api/capability/tool/IHammerItem.java b/src/main/java/gregtech/api/capability/tool/IHammerItem.java new file mode 100644 index 00000000000..47f6daf0f68 --- /dev/null +++ b/src/main/java/gregtech/api/capability/tool/IHammerItem.java @@ -0,0 +1,7 @@ +package gregtech.api.capability.tool; + +public interface IHammerItem { + + boolean damageItem(int damage, boolean simulate); + +} diff --git a/src/main/java/gregtech/api/items/metaitem/MusicDiscStats.java b/src/main/java/gregtech/api/items/metaitem/MusicDiscStats.java new file mode 100644 index 00000000000..4f841ef798d --- /dev/null +++ b/src/main/java/gregtech/api/items/metaitem/MusicDiscStats.java @@ -0,0 +1,48 @@ +package gregtech.api.items.metaitem; + +import gregtech.api.items.metaitem.stats.IItemBehaviour; +import gregtech.api.items.metaitem.stats.IMusicDisc; +import net.minecraft.block.BlockJukebox; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.StatList; +import net.minecraft.util.*; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +public class MusicDiscStats implements IMusicDisc, IItemBehaviour { + + private final SoundEvent sound; + + public MusicDiscStats(SoundEvent sound) { + this.sound = sound; + } + + @SideOnly(Side.CLIENT) + @Override + public SoundEvent getSound() { + return sound; + } + + @Override + public ActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + IBlockState iblockstate = world.getBlockState(pos); + ItemStack itemStack = player.getHeldItem(hand); + if (iblockstate.getBlock() == Blocks.JUKEBOX && !(Boolean)iblockstate.getValue(BlockJukebox.HAS_RECORD)) { + if (!world.isRemote) { + ((BlockJukebox)Blocks.JUKEBOX).insertRecord(world, pos, iblockstate, itemStack); + world.playEvent(1010, pos, itemStack.getItemDamage()); + itemStack.shrink(1); + player.addStat(StatList.RECORD_PLAYED); + } + + return ActionResult.newResult(EnumActionResult.SUCCESS, itemStack); + } else { + return ActionResult.newResult(EnumActionResult.PASS, itemStack); + } + } +} diff --git a/src/main/java/gregtech/api/items/metaitem/stats/IMusicDisc.java b/src/main/java/gregtech/api/items/metaitem/stats/IMusicDisc.java new file mode 100644 index 00000000000..d21441fb6f6 --- /dev/null +++ b/src/main/java/gregtech/api/items/metaitem/stats/IMusicDisc.java @@ -0,0 +1,11 @@ +package gregtech.api.items.metaitem.stats; + +import net.minecraft.util.SoundEvent; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +public interface IMusicDisc extends IItemComponent { + + @SideOnly(Side.CLIENT) + SoundEvent getSound(); +} diff --git a/src/main/java/gregtech/api/items/toolitem/HammerItemStat.java b/src/main/java/gregtech/api/items/toolitem/HammerItemStat.java new file mode 100644 index 00000000000..564906e806d --- /dev/null +++ b/src/main/java/gregtech/api/items/toolitem/HammerItemStat.java @@ -0,0 +1,29 @@ +package gregtech.api.items.toolitem; + +import gregtech.api.capability.GregtechCapabilities; +import gregtech.api.capability.tool.IHammerItem; +import gregtech.api.capability.tool.IWrenchItem; +import gregtech.api.items.metaitem.stats.IItemCapabilityProvider; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ICapabilityProvider; + +public class HammerItemStat implements IItemCapabilityProvider { + + @Override + public ICapabilityProvider createProvider(ItemStack itemStack) { + return new CapabilityProvider(itemStack); + } + + private static class CapabilityProvider extends AbstractToolItemCapabilityProvider implements IHammerItem { + + public CapabilityProvider(ItemStack itemStack) { + super(itemStack); + } + + @Override + protected Capability getCapability() { + return GregtechCapabilities.CAPABILITY_HAMMER; + } + } +} diff --git a/src/main/java/gregtech/api/items/toolitem/IToolStats.java b/src/main/java/gregtech/api/items/toolitem/IToolStats.java index 6551c4a6636..86a372ad6a4 100644 --- a/src/main/java/gregtech/api/items/toolitem/IToolStats.java +++ b/src/main/java/gregtech/api/items/toolitem/IToolStats.java @@ -3,7 +3,9 @@ import gregtech.api.enchants.EnchantmentData; import gregtech.api.items.metaitem.MetaItem.MetaValueItem; import gregtech.api.unification.material.Material; +import gregtech.common.ConfigHolder; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -11,6 +13,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; +import net.minecraftforge.common.ForgeHooks; import java.util.Collections; import java.util.List; @@ -170,4 +173,14 @@ default int getColor(ItemStack stack, int tintIndex) { default Set getToolClasses(ItemStack stack) { return Collections.emptySet(); } + + default void onCraftingUse(ItemStack stack) { + if (ConfigHolder.toolCraftingSounds && ForgeHooks.getCraftingPlayer() != null && stack.getItem() instanceof ToolMetaItem) + ForgeHooks.getCraftingPlayer().playSound(((ToolMetaItem) stack.getItem()).getItem(stack).getSound(), 1, 1); + } + + default void onBreakingUse(ItemStack stack) { + if (ConfigHolder.toolUseSounds && Minecraft.getMinecraft().player != null && stack.getItem() instanceof ToolMetaItem) + Minecraft.getMinecraft().player.playSound(((ToolMetaItem) stack.getItem()).getItem(stack).getSound(), 1, 1); + } } diff --git a/src/main/java/gregtech/api/items/toolitem/ToolMetaItem.java b/src/main/java/gregtech/api/items/toolitem/ToolMetaItem.java index 07b98becb55..e1c38db88f8 100755 --- a/src/main/java/gregtech/api/items/toolitem/ToolMetaItem.java +++ b/src/main/java/gregtech/api/items/toolitem/ToolMetaItem.java @@ -30,6 +30,7 @@ import gregtech.common.tools.DamageValues; import gregtech.common.tools.ToolWrench; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.enchantment.Enchantment; @@ -46,11 +47,13 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EntityDamageSource; import net.minecraft.util.EnumHand; +import net.minecraft.util.SoundEvent; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.fml.common.Optional.Interface; import net.minecraftforge.fml.common.Optional.InterfaceList; @@ -185,6 +188,7 @@ public ItemStack getContainerItem(ItemStack stack) { if (metaToolValueItem.toolStats != null) { IToolStats toolStats = metaToolValueItem.toolStats; int toolDamagePerCraft = toolStats.getToolDamagePerContainerCraft(stack); + toolStats.onCraftingUse(stack); boolean canApplyDamage = damageItem(stack, toolDamagePerCraft, false); if (!canApplyDamage) return stack; } @@ -229,6 +233,7 @@ public boolean onBlockDestroyed(@Nonnull ItemStack stack, @Nonnull World world, if (metaToolValueItem != null) { IToolStats toolStats = metaToolValueItem.getToolStats(); toolStats.onBlockDestroyed(stack, world, state, pos, entity); + toolStats.onBreakingUse(stack); damageItem(stack, toolStats.getToolDamagePerBlockBreak(stack), false); } return true; @@ -700,6 +705,7 @@ public class MetaToolValueItem extends MetaValueItem { protected IToolStats toolStats = new DummyToolStats(); protected double amountOfMaterialToRepair = 0; + protected SoundEvent sound; protected MetaToolValueItem(int metaValue, String unlocalizedName) { super(metaValue, unlocalizedName); @@ -712,6 +718,15 @@ public MetaToolValueItem addComponents(IItemComponent... stats) { return this; } + public MetaToolValueItem setSound(SoundEvent sound) { + this.sound = sound; + return this; + } + + public SoundEvent getSound() { + return sound; + } + public MetaToolValueItem setFullRepairCost(double amountOfMaterialToRepair) { this.amountOfMaterialToRepair = amountOfMaterialToRepair; return this; diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index dda1e9fcd9b..c7ee9587c64 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -41,6 +41,7 @@ import net.minecraft.util.*; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos.PooledMutableBlockPos; +import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; @@ -72,6 +73,7 @@ public abstract class MetaTileEntity implements ICoverable { public static final IndexedCuboid6 FULL_CUBE_COLLISION = new IndexedCuboid6(null, Cuboid6.full); public static final String TAG_KEY_PAINTING_COLOR = "PaintingColor"; public static final String TAG_KEY_FRAGILE = "Fragile"; + public static final String TAG_KEY_MUFFLED = "Muffled"; public final ResourceLocation metaTileEntityId; MetaTileEntityHolder holder; @@ -103,6 +105,8 @@ public abstract class MetaTileEntity implements ICoverable { protected List notifiedFluidInputList = new ArrayList<>(); protected List notifiedFluidOutputList = new ArrayList<>(); + protected boolean muffled = false; + public MetaTileEntity(ResourceLocation metaTileEntityId) { this.metaTileEntityId = metaTileEntityId; initializeInventory(); @@ -747,6 +751,7 @@ public void writeInitialSyncData(PacketBuffer buf) { } } buf.writeBoolean(isFragile); + buf.writeBoolean(muffled); } public void receiveInitialSyncData(PacketBuffer buf) { @@ -768,6 +773,7 @@ public void receiveInitialSyncData(PacketBuffer buf) { } } this.isFragile = buf.readBoolean(); + this.muffled = buf.readBoolean(); } public void writeTraitData(MTETrait trait, int internalId, Consumer dataWriter) { @@ -1180,6 +1186,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound data) { } data.setTag("Covers", coversList); data.setBoolean(TAG_KEY_FRAGILE, isFragile); + data.setBoolean(TAG_KEY_MUFFLED, isFragile); return data; } @@ -1215,6 +1222,7 @@ public void readFromNBT(NBTTagCompound data) { } this.isFragile = data.getBoolean(TAG_KEY_FRAGILE); + this.muffled = data.getBoolean(TAG_KEY_MUFFLED); } @Override @@ -1330,4 +1338,12 @@ public boolean getWitherProof() { public void preInit(Object... data) { } + + public final void toggleMuffled() { + muffled = !muffled; + } + + public boolean isMuffled() { + return muffled; + } } diff --git a/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java index 60cd861c836..735e6bf7732 100644 --- a/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/SimpleGeneratorMetaTileEntity.java @@ -15,16 +15,21 @@ import gregtech.api.gui.widgets.ImageWidget; import gregtech.api.gui.widgets.SlotWidget; import gregtech.api.gui.widgets.TankWidget; +import gregtech.api.metatileentity.sound.ISoundCreator; +import gregtech.api.metatileentity.sound.PositionedSoundMTE; import gregtech.api.recipes.machines.FuelRecipeMap; import gregtech.api.render.OrientedOverlayRenderer; import gregtech.api.render.Textures; import gregtech.api.util.PipelineUtil; +import gregtech.common.ConfigHolder; +import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.SoundCategory; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.items.ItemStackHandler; @@ -32,7 +37,7 @@ import javax.annotation.Nullable; import java.util.List; -public class SimpleGeneratorMetaTileEntity extends TieredMetaTileEntity { +public class SimpleGeneratorMetaTileEntity extends TieredMetaTileEntity implements ISoundCreator { private final FuelRecipeLogic workableHandler; private final ItemStackHandler containerInventory; @@ -146,4 +151,17 @@ public void addInformation(ItemStack stack, @Nullable World player, List tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_out", energyContainer.getOutputVoltage(), GTValues.VN[getTier()])); tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); } + + @Override + public void onAttached() { + super.onAttached(); + if (getWorld() != null && getWorld().isRemote) { + this.setupSound(recipeMap.getSound(), this.getPos()); + } + } + + public boolean canCreateSound() { + return workableHandler.isActive(); + } + } diff --git a/src/main/java/gregtech/api/metatileentity/SteamMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/SteamMetaTileEntity.java index ccfed3808c3..835d9621902 100644 --- a/src/main/java/gregtech/api/metatileentity/SteamMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/SteamMetaTileEntity.java @@ -12,24 +12,28 @@ import gregtech.api.gui.resources.TextureArea; import gregtech.api.gui.widgets.ImageWidget; import gregtech.api.gui.widgets.LabelWidget; +import gregtech.api.metatileentity.sound.ISoundCreator; +import gregtech.api.metatileentity.sound.PositionedSoundMTE; import gregtech.api.recipes.ModHandler; import gregtech.api.recipes.RecipeMap; import gregtech.api.render.OrientedOverlayRenderer; import gregtech.api.render.SimpleSidedCubeRenderer; import gregtech.api.render.Textures; +import gregtech.api.sound.GTSounds; import gregtech.api.util.GTUtility; +import gregtech.common.ConfigHolder; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.Sound; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; -import net.minecraft.util.ResourceLocation; +import net.minecraft.util.*; import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; -public abstract class SteamMetaTileEntity extends MetaTileEntity { +public abstract class SteamMetaTileEntity extends MetaTileEntity implements ISoundCreator { public final TextureArea BRONZE_BACKGROUND_TEXTURE; public final TextureArea BRONZE_SLOT_BACKGROUND_TEXTURE; @@ -50,6 +54,11 @@ public SteamMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap recip this.setPaintingColor(0xFFFFFF); } + @Override + public boolean canCreateSound() { + return workableHandler.isActive(); + } + public RecipeLogicSteam getWorkableHandler() { return workableHandler; } @@ -125,4 +134,12 @@ public ModularUI.Builder createUITemplate(EntityPlayer player) { .setPredicate(() -> workableHandler.isHasNotEnoughEnergy())) .bindPlayerInventory(player.inventory, BRONZE_SLOT_BACKGROUND_TEXTURE, 0); } + + @Override + public void onAttached() { + super.onAttached(); + if (getWorld() != null && getWorld().isRemote) { + this.setupSound(workableHandler.getRecipeMap().getSound(), this.getPos()); + } + } } diff --git a/src/main/java/gregtech/api/metatileentity/WorkableTieredMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/WorkableTieredMetaTileEntity.java index 0ae860fec38..a929b21e0ad 100644 --- a/src/main/java/gregtech/api/metatileentity/WorkableTieredMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/WorkableTieredMetaTileEntity.java @@ -5,12 +5,19 @@ import codechicken.lib.vec.Matrix4; import gregtech.api.GTValues; import gregtech.api.capability.impl.*; +import gregtech.api.metatileentity.sound.ISoundCreator; +import gregtech.api.metatileentity.sound.PositionedSoundMTE; import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeMap; import gregtech.api.render.OrientedOverlayRenderer; +import gregtech.api.sound.GTSounds; +import gregtech.common.ConfigHolder; +import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.SoundEvent; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; @@ -24,7 +31,7 @@ import java.util.Set; import java.util.function.Function; -public abstract class WorkableTieredMetaTileEntity extends TieredMetaTileEntity { +public abstract class WorkableTieredMetaTileEntity extends TieredMetaTileEntity implements ISoundCreator { protected final RecipeLogicEnergy workable; protected final OrientedOverlayRenderer renderer; @@ -41,6 +48,10 @@ public WorkableTieredMetaTileEntity(ResourceLocation metaTileEntityId, RecipeMap reinitializeEnergyContainer(); } + public boolean canCreateSound() { + return workable.isActive(); + } + protected RecipeLogicEnergy createWorkable(RecipeMap recipeMap) { return new RecipeLogicEnergy(this, recipeMap, () -> energyContainer); } @@ -54,7 +65,7 @@ protected void reinitializeEnergyContainer() { } else this.energyContainer = new EnergyContainerHandler(this, tierVoltage * 64L, tierVoltage, 2, 0L, 0L) { @Override public long getInputAmperage() { - if(getEnergyCapacity() / 2 > getEnergyStored() && workable.isActive()) { + if (getEnergyCapacity() / 2 > getEnergyStored() && workable.isActive()) { return 2; } return 1; @@ -144,4 +155,16 @@ public void addInformation(ItemStack stack, @Nullable World player, List public Function getTankScalingFunction() { return tankScalingFunction; } + + public boolean isActive() { + return workable.isActive(); + } + + @Override + public void onAttached() { + super.onAttached(); + if (getWorld() != null && getWorld().isRemote) { + this.setupSound(this.workable.getRecipeMap().getSound(), this.getPos()); + } + } } diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java index eafd82689ba..923a6df92f0 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java @@ -16,6 +16,8 @@ import gregtech.api.capability.impl.MultiblockRecipeLogic; import gregtech.api.gui.Widget; import gregtech.api.gui.widgets.AdvancedTextWidget; +import gregtech.api.metatileentity.sound.ISoundCreator; +import gregtech.api.metatileentity.sound.PositionedSoundMTE; import gregtech.api.multiblock.PatternMatchContext; import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeMap; @@ -27,12 +29,15 @@ import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagInt; import net.minecraft.network.PacketBuffer; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.Style; @@ -51,7 +56,7 @@ import java.util.*; import java.util.stream.Stream; -public abstract class RecipeMapMultiblockController extends MultiblockWithDisplayBase implements IMultipleRecipeMaps { +public abstract class RecipeMapMultiblockController extends MultiblockWithDisplayBase implements ISoundCreator, IMultipleRecipeMaps { public final RecipeMap recipeMap; protected MultiblockRecipeLogic recipeMapWorkable; @@ -336,6 +341,20 @@ protected void toggleDistinct() { } } + + @Override + public void onAttached() { + super.onAttached(); + if (getWorld() != null && getWorld().isRemote) { + this.setupSound(recipeMap.getSound(), this.getPos()); + } + } + + public boolean canCreateSound() { + return recipeMapWorkable.isActive(); + } + + @Override public RecipeMap[] getAvailableRecipeMaps() { return hasMultipleRecipeMaps() ? this.recipeMaps : null; diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapPrimitiveMultiblockController.java b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapPrimitiveMultiblockController.java index ec06573cdc0..87a443d6991 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapPrimitiveMultiblockController.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapPrimitiveMultiblockController.java @@ -2,14 +2,20 @@ import gregtech.api.capability.impl.*; import gregtech.api.metatileentity.MTETrait; +import gregtech.api.metatileentity.sound.ISoundCreator; +import gregtech.api.metatileentity.sound.PositionedSoundMTE; import gregtech.api.recipes.RecipeMap; +import gregtech.api.util.world.DummyWorld; +import gregtech.common.ConfigHolder; +import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.SoundCategory; import net.minecraftforge.fluids.FluidTank; import java.util.ArrayList; import java.util.List; -public abstract class RecipeMapPrimitiveMultiblockController extends MultiblockWithDisplayBase { +public abstract class RecipeMapPrimitiveMultiblockController extends MultiblockWithDisplayBase implements ISoundCreator { protected PrimitiveRecipeLogic recipeMapWorkable; @@ -53,4 +59,17 @@ public void invalidateStructure() { protected boolean shouldUpdate(MTETrait trait) { return !(trait instanceof PrimitiveRecipeLogic); } + + @Override + public void onAttached() { + super.onAttached(); + if (getWorld() != null && getWorld().isRemote) { + this.setupSound(recipeMapWorkable.getRecipeMap().getSound(), this.getPos()); + } + } + + public boolean canCreateSound() { + return recipeMapWorkable.isActive(); + } + } diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapSteamMultiblockController.java b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapSteamMultiblockController.java index eaa7a9ffb84..0889464f3f3 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapSteamMultiblockController.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapSteamMultiblockController.java @@ -8,11 +8,15 @@ import gregtech.api.capability.impl.ItemHandlerList; import gregtech.api.capability.impl.SteamMultiblockRecipeLogic; import gregtech.api.metatileentity.MTETrait; +import gregtech.api.metatileentity.sound.ISoundCreator; +import gregtech.api.metatileentity.sound.PositionedSoundMTE; import gregtech.api.multiblock.PatternMatchContext; import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeMap; import gregtech.common.ConfigHolder; +import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.SoundCategory; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.Style; import net.minecraft.util.text.TextComponentTranslation; @@ -26,7 +30,7 @@ import java.util.List; import java.util.Map; -public abstract class RecipeMapSteamMultiblockController extends MultiblockWithDisplayBase { +public abstract class RecipeMapSteamMultiblockController extends MultiblockWithDisplayBase implements ISoundCreator { protected static final double CONVERSION_RATE = ConfigHolder.U.multiblockSteamToEU; @@ -142,4 +146,17 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, super.renderMetaTileEntity(renderState, translation, pipeline); this.getFrontOverlay().render(renderState, translation, pipeline, getFrontFacing(), recipeMapWorkable.isActive()); } + + @Override + public void onAttached() { + super.onAttached(); + if (getWorld() != null && getWorld().isRemote) { + this.setupSound(recipeMap.getSound(), this.getPos()); + } + } + + public boolean canCreateSound() { + return recipeMapWorkable.isActive(); + } + } diff --git a/src/main/java/gregtech/api/metatileentity/sound/ISoundCreator.java b/src/main/java/gregtech/api/metatileentity/sound/ISoundCreator.java new file mode 100644 index 00000000000..593647591ca --- /dev/null +++ b/src/main/java/gregtech/api/metatileentity/sound/ISoundCreator.java @@ -0,0 +1,33 @@ +package gregtech.api.metatileentity.sound; + +import gregtech.common.ConfigHolder; +import net.minecraft.client.Minecraft; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.SoundEvent; +import net.minecraft.util.math.BlockPos; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +public interface ISoundCreator { + boolean canCreateSound(); + + boolean isValid(); + + default boolean isMuffled() { + return false; + } + + /** + * @param sound The sound that this creator emits when running. + * @param pos The position of this creator in the world. + */ + + @SideOnly(Side.CLIENT) + default void setupSound(SoundEvent sound, BlockPos pos) { + if (sound != null && ConfigHolder.machineSounds) { + PositionedSoundMTE machineSound = new PositionedSoundMTE(sound.getSoundName(), SoundCategory.BLOCKS, this, pos); + Minecraft.getMinecraft().getSoundHandler().playSound(machineSound); + Minecraft.getMinecraft().getSoundHandler().update(); + } + } +} diff --git a/src/main/java/gregtech/api/metatileentity/sound/PositionedSoundMTE.java b/src/main/java/gregtech/api/metatileentity/sound/PositionedSoundMTE.java new file mode 100644 index 00000000000..f39e9ccb7b2 --- /dev/null +++ b/src/main/java/gregtech/api/metatileentity/sound/PositionedSoundMTE.java @@ -0,0 +1,35 @@ +package gregtech.api.metatileentity.sound; + +import net.minecraft.client.audio.ITickableSound; +import net.minecraft.client.audio.PositionedSound; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.math.BlockPos; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class PositionedSoundMTE extends PositionedSound implements ITickableSound { + + protected ISoundCreator mte; + + public PositionedSoundMTE(ResourceLocation soundId, SoundCategory categoryIn, ISoundCreator mteIn, BlockPos pos) { + super(soundId, categoryIn); + this.repeat = true; + this.repeatDelay = 0; + this.mte = mteIn; + this.xPosF = pos.getX(); + this.yPosF = pos.getY(); + this.zPosF = pos.getZ(); + } + + @Override + public void update() { + volume = mte.canCreateSound() && !mte.isMuffled() ? 1 : 0; + } + + @Override + public boolean isDonePlaying() { + return !this.mte.isValid(); + } +} diff --git a/src/main/java/gregtech/api/recipes/RecipeMap.java b/src/main/java/gregtech/api/recipes/RecipeMap.java index 3ce8b5709c5..bf5b7dd4a9d 100644 --- a/src/main/java/gregtech/api/recipes/RecipeMap.java +++ b/src/main/java/gregtech/api/recipes/RecipeMap.java @@ -13,12 +13,12 @@ import gregtech.api.gui.GuiTextures; import gregtech.api.gui.ModularUI; import gregtech.api.gui.resources.TextureArea; -import gregtech.api.gui.widgets.ProgressWidget; import gregtech.api.gui.widgets.ProgressWidget.MoveType; import gregtech.api.gui.widgets.RecipeProgressWidget; import gregtech.api.gui.widgets.SlotWidget; import gregtech.api.gui.widgets.TankWidget; import gregtech.api.recipes.builders.IntCircuitRecipeBuilder; +import gregtech.api.recipes.builders.SimpleRecipeBuilder; import gregtech.api.recipes.crafttweaker.CTRecipe; import gregtech.api.recipes.crafttweaker.CTRecipeBuilder; import gregtech.api.unification.material.Material; @@ -27,6 +27,7 @@ import gregtech.common.ConfigHolder; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import net.minecraft.item.ItemStack; +import net.minecraft.util.SoundEvent; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.common.Optional.Method; @@ -73,10 +74,12 @@ public class RecipeMap> { private Consumer> onRecipeBuildAction; + protected SoundEvent sound; + public RecipeMap(String unlocalizedName, - int minInputs, int maxInputs, int minOutputs, int maxOutputs, - int minFluidInputs, int maxFluidInputs, int minFluidOutputs, int maxFluidOutputs, - R defaultRecipe, boolean isHidden) { + int minInputs, int maxInputs, int minOutputs, int maxOutputs, + int minFluidInputs, int maxFluidInputs, int minFluidOutputs, int maxFluidOutputs, + R defaultRecipe, boolean isHidden) { this.unlocalizedName = unlocalizedName; this.slotOverlays = new TByteObjectHashMap<>(); this.progressBarTexture = GuiTextures.PROGRESS_BAR_ARROW; @@ -144,6 +147,11 @@ public RecipeMap setSlotOverlay(boolean isOutput, boolean isFluid, boolean is return this; } + public RecipeMap setSound(SoundEvent sound) { + this.sound = sound; + return this; + } + public RecipeMap onRecipeBuild(Consumer> consumer) { onRecipeBuildAction = consumer; return this; @@ -330,10 +338,10 @@ private Recipe findByInputsAndFluids(long voltage, List inputs, List< } } } - return prioritizedRecipe(priorityRecipeMap,iteratedRecipes,inputs,fluidInputs,matchingMode); + return prioritizedRecipe(priorityRecipeMap, iteratedRecipes, inputs, fluidInputs, matchingMode); } - private Recipe prioritizedRecipe(Map> priorityRecipeMap, HashSet iteratedRecipes,List inputs, List fluidInputs, MatchingMode matchingMode) { + private Recipe prioritizedRecipe(Map> priorityRecipeMap, HashSet iteratedRecipes, List inputs, List fluidInputs, MatchingMode matchingMode) { for (int i = priorityRecipeMap.size(); i >= 0; i--) { if (priorityRecipeMap.containsKey(i)) { for (Recipe tmpRecipe : priorityRecipeMap.get(i)) { @@ -349,7 +357,7 @@ private Recipe prioritizedRecipe(Map> priorityRecipe return null; } - private void calculateRecipePriority(Recipe recipe, HashMap promotedTimes, Map> priorityRecipeMap ) { + private void calculateRecipePriority(Recipe recipe, HashMap promotedTimes, Map> priorityRecipeMap) { Integer p = promotedTimes.get(recipe); if (p == null) { p = 0; @@ -466,8 +474,7 @@ protected static int[] determineSlotsGrid(int itemInputsCount) { } else if (itemInputsCount == 3) { itemSlotsToLeft = 3; itemSlotsToDown = 1; - } - else { + } else { //if we couldn't fit all into a perfect square, //increase the amount of slots to the left itemSlotsToLeft = (int) Math.ceil(sqrt); @@ -497,6 +504,10 @@ public List getRecipeList() { return Collections.unmodifiableList(recipeSet.stream().sorted(RECIPE_DURATION_THEN_EU).collect(Collectors.toList())); } + public SoundEvent getSound() { + return sound; + } + @ZenMethod("findRecipe") @Method(modid = GTValues.MODID_CT) @Nullable @@ -506,9 +517,9 @@ public CTRecipe ctFindRecipe(long maxVoltage, IItemStack[] itemInputs, ILiquidSt .map(CraftTweakerMC::getItemStack) .collect(Collectors.toList()); List mcFluidInputs = fluidInputs == null ? Collections.emptyList() : - Arrays.stream(fluidInputs) - .map(CraftTweakerMC::getLiquidStack) - .collect(Collectors.toList()); + Arrays.stream(fluidInputs) + .map(CraftTweakerMC::getLiquidStack) + .collect(Collectors.toList()); Recipe backingRecipe = findRecipe(maxVoltage, mcItemInputs, mcFluidInputs, outputFluidTankCapacity, MatchingMode.DEFAULT, true); return backingRecipe == null ? null : new CTRecipe(this, backingRecipe); } diff --git a/src/main/java/gregtech/api/recipes/RecipeMaps.java b/src/main/java/gregtech/api/recipes/RecipeMaps.java index 3286432187c..677968cf9ba 100644 --- a/src/main/java/gregtech/api/recipes/RecipeMaps.java +++ b/src/main/java/gregtech/api/recipes/RecipeMaps.java @@ -5,10 +5,12 @@ import gregtech.api.gui.GuiTextures; import gregtech.api.gui.widgets.ProgressWidget; import gregtech.api.gui.widgets.ProgressWidget.MoveType; +import gregtech.api.sound.GTSounds; import gregtech.api.recipes.builders.*; import gregtech.api.recipes.machines.*; import gregtech.api.unification.material.Material; import gregtech.api.unification.material.Materials; +import net.minecraft.init.SoundEvents; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenProperty; @@ -19,56 +21,65 @@ public class RecipeMaps { @ZenProperty public static final RecipeMap COMPRESSOR_RECIPES = new RecipeMap<>("compressor", 1, 1, 1, 1, 0, 0, 0, 0, new SimpleRecipeBuilder().duration(400).EUt(2), false) .setSlotOverlay(false, false, GuiTextures.COMPRESSOR_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_COMPRESS, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_COMPRESS, MoveType.HORIZONTAL) + .setSound(GTSounds.COMPRESSOR); @ZenProperty public static final RecipeMap EXTRACTOR_RECIPES = new RecipeMap<>("extractor", 0, 1, 0, 1, 0, 0, 0, 1, new SimpleRecipeBuilder().duration(400).EUt(2), false) .setSlotOverlay(false, false, GuiTextures.EXTRACTOR_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRACT, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRACT, MoveType.HORIZONTAL) + .setSound(GTSounds.COMPRESSOR); @ZenProperty public static final RecipeMap MACERATOR_RECIPES = new RecipeMap<>("macerator", 1, 1, 1, 3, 0, 0, 0, 0, new SimpleRecipeBuilder().duration(150).EUt(8), false) .setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY) .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_MACERATE, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_MACERATE, MoveType.HORIZONTAL) + .setSound(GTSounds.MACERATOR); @ZenProperty public static final RecipeMap ORE_WASHER_RECIPES = new RecipeMap<>("ore_washer", 1, 1, 1, 3, 0, 1, 0, 0, new SimpleRecipeBuilder().duration(400).EUt(16), false) .setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY) .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_BATH, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_BATH, MoveType.HORIZONTAL) + .setSound(GTSounds.BATH); @ZenProperty public static final RecipeMap THERMAL_CENTRIFUGE_RECIPES = new RecipeMap<>("thermal_centrifuge", 1, 1, 1, 3, 0, 0, 0, 0, new SimpleRecipeBuilder().duration(400).EUt(60), false) .setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY) .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) + .setSound(GTSounds.CENTRIFUGE); @ZenProperty public static final RecipeMap FURNACE_RECIPES = new RecipeMapFurnace("electric_furnace", 1, 1, 1, 1, 0, 0, 0, 0, new SimpleRecipeBuilder(), false) .setSlotOverlay(false, false, GuiTextures.FURNACE_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) + .setSound(GTSounds.FURNACE); @ZenProperty public static final RecipeMap ASSEMBLER_RECIPES = new RecipeMap<>("assembler", 1, 9, 1, 1, 0, 1, 0, 0, new AssemblerRecipeBuilder(), false) .setSlotOverlay(false, false, GuiTextures.CIRCUIT_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_CIRCUIT, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_CIRCUIT, MoveType.HORIZONTAL) + .setSound(GTSounds.ASSEMBLER); @ZenProperty public static final RecipeMap FORMING_PRESS_RECIPES = new RecipeMapFormingPress("forming_press", 2, 6, 1, 1, 0, 0, 0, 0, new SimpleRecipeBuilder(), false) - .setProgressBar(GuiTextures.PROGRESS_BAR_COMPRESS, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_COMPRESS, MoveType.HORIZONTAL) + .setSound(GTSounds.COMPRESSOR); @ZenProperty public static final RecipeMap ARC_FURNACE_RECIPES = new RecipeMap<>("arc_furnace", 1, 1, 1, 4, 1, 1, 0, 1, new SimpleRecipeBuilder(), false) .setProgressBar(GuiTextures.PROGRESS_BAR_ARC_FURNACE, MoveType.HORIZONTAL) + .setSound(GTSounds.ARC) .onRecipeBuild(recipeBuilder -> { if (recipeBuilder.getFluidInputs().isEmpty()) { recipeBuilder.fluidInputs(Materials.Oxygen.getFluid(recipeBuilder.duration)); @@ -104,7 +115,8 @@ public class RecipeMaps { @ZenProperty public static final RecipeMap SIFTER_RECIPES = new RecipeMap<>("sifter", 1, 1, 0, 6, 0, 0, 0, 0, new SimpleRecipeBuilder(), false) - .setProgressBar(GuiTextures.PROGRESS_BAR_SIFT, MoveType.VERTICAL_INVERTED); + .setProgressBar(GuiTextures.PROGRESS_BAR_SIFT, MoveType.VERTICAL_INVERTED) + .setSound(SoundEvents.BLOCK_SAND_PLACE); /** * Example: @@ -121,7 +133,8 @@ public class RecipeMaps { @ZenProperty public static final RecipeMap LASER_ENGRAVER_RECIPES = new RecipeMap<>("laser_engraver", 2, 2, 1, 1, 0, 0, 0, 0, new SimpleRecipeBuilder(), false) .setSlotOverlay(false, false, true, GuiTextures.LENS_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) + .setSound(GTSounds.ELECTROLYZER); /** * Example: @@ -140,7 +153,8 @@ public class RecipeMaps { public static final RecipeMap MIXER_RECIPES = new RecipeMap<>("mixer", 0, 6, 0, 1, 0, 2, 0, 1, new SimpleRecipeBuilder(), false) .setSlotOverlay(false, false, GuiTextures.DUST_OVERLAY) .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_MIXER, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_MIXER, MoveType.HORIZONTAL) + .setSound(GTSounds.MIXER); /** * Example: @@ -159,7 +173,8 @@ public class RecipeMaps { public static final RecipeMap AUTOCLAVE_RECIPES = new RecipeMap<>("autoclave", 1, 1, 1, 1, 1, 1, 0, 0, new SimpleRecipeBuilder(), false) .setSlotOverlay(false, false, GuiTextures.DUST_OVERLAY) .setSlotOverlay(true, false, GuiTextures.CRYSTAL_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_CRYSTALLIZATION, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_CRYSTALLIZATION, MoveType.HORIZONTAL) + .setSound(GTSounds.FURNACE); /** * Example: @@ -178,7 +193,8 @@ public class RecipeMaps { public static final RecipeMap ELECTROMAGNETIC_SEPARATOR_RECIPES = new RecipeMap<>("electromagnetic_separator", 1, 1, 1, 3, 0, 0, 0, 0, new SimpleRecipeBuilder(), false) .setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY) .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_MAGNET, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_MAGNET, MoveType.HORIZONTAL) + .setSound(GTSounds.ARC); /** * Example: @@ -194,7 +210,8 @@ public class RecipeMaps { @ZenProperty public static final RecipeMap POLARIZER_RECIPES = new RecipeMap<>("polarizer", 1, 1, 1, 1, 0, 0, 0, 0, new SimpleRecipeBuilder(), false) - .setProgressBar(GuiTextures.PROGRESS_BAR_MAGNET, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_MAGNET, MoveType.HORIZONTAL) + .setSound(GTSounds.ARC); /** * Example: @@ -211,7 +228,8 @@ public class RecipeMaps { @ZenProperty public static final RecipeMap CHEMICAL_BATH_RECIPES = new RecipeMap<>("chemical_bath", 1, 1, 1, 3, 1, 1, 0, 0, new SimpleRecipeBuilder(), false) - .setProgressBar(GuiTextures.PROGRESS_BAR_MIXER, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_MIXER, MoveType.HORIZONTAL) + .setSound(GTSounds.BATH); /** * Example: @@ -227,7 +245,8 @@ public class RecipeMaps { @ZenProperty public static final RecipeMap BREWING_RECIPES = new RecipeMap<>("brewery", 1, 1, 0, 0, 1, 1, 1, 1, new SimpleRecipeBuilder().duration(128).EUt(4), false) .setSlotOverlay(false, false, GuiTextures.BREWER_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) + .setSound(GTSounds.CHEMICAL_REACTOR); /** * Example: @@ -246,7 +265,8 @@ public class RecipeMaps { public static final RecipeMap FLUID_HEATER_RECIPES = new RecipeMap<>("fluid_heater", 1, 1, 0, 0, 1, 1, 1, 1, new IntCircuitRecipeBuilder(), false) .setSlotOverlay(false, true, GuiTextures.HEATING_OVERLAY_1) .setSlotOverlay(true, true, GuiTextures.HEATING_OVERLAY_2) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) + .setSound(GTSounds.BOILER); /** * Example: @@ -266,7 +286,8 @@ public class RecipeMaps { .setSlotOverlay(false, true, GuiTextures.BEAKER_OVERLAY_1) .setSlotOverlay(true, true, GuiTextures.BEAKER_OVERLAY_4) .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) + .setSound(GTSounds.BOILER); /** * Example: @@ -281,7 +302,8 @@ public class RecipeMaps { @ZenProperty public static final RecipeMap FERMENTING_RECIPES = new RecipeMap<>("fermenter", 0, 0, 0, 0, 1, 1, 1, 1, new SimpleRecipeBuilder().EUt(2), false) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) + .setSound(GTSounds.CHEMICAL_REACTOR); /** * Example: @@ -299,7 +321,8 @@ public class RecipeMaps { @ZenProperty public static final RecipeMap FLUID_SOLIDFICATION_RECIPES = new RecipeMap<>("fluid_solidifier", 1, 1, 1, 1, 1, 1, 0, 0, new SimpleRecipeBuilder(), false) .setSlotOverlay(false, false, GuiTextures.SOLIDIFIER_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) + .setSound(GTSounds.COOLING); /** * Example: @@ -316,7 +339,8 @@ public class RecipeMaps { @ZenProperty public static final RecipeMap FUSION_RECIPES = new RecipeMap<>("fusion_reactor", 0, 0, 0, 0, 2, 2, 1, 1, new FusionRecipeBuilder(), false) - .setProgressBar(GuiTextures.PROGRESS_BAR_FUSION, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_FUSION, MoveType.HORIZONTAL) + .setSound(GTSounds.ARC); /** * Examples: @@ -341,7 +365,8 @@ public class RecipeMaps { .setSlotOverlay(false, false, false, GuiTextures.EXTRACTOR_OVERLAY) .setSlotOverlay(false, false, true, GuiTextures.CANISTER_OVERLAY) .setSlotOverlay(false, true, true, GuiTextures.CENTRIFUGE_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRACT, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRACT, MoveType.HORIZONTAL) + .setSound(GTSounds.CENTRIFUGE); /** * Examples: @@ -371,7 +396,8 @@ public class RecipeMaps { .setSlotOverlay(false, false, false, GuiTextures.LIGHTNING_OVERLAY_1) .setSlotOverlay(false, false, true, GuiTextures.CANISTER_OVERLAY) .setSlotOverlay(false, true, true, GuiTextures.LIGHTNING_OVERLAY_2) - .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRACT, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRACT, MoveType.HORIZONTAL) + .setSound(GTSounds.ELECTROLYZER); /** * Example: @@ -388,7 +414,8 @@ public class RecipeMaps { */ @ZenProperty - public static final RecipeMap BLAST_RECIPES = new RecipeMap<>("electric_blast_furnace", 1, 3, 1, 2, 0, 1, 0, 1, new BlastRecipeBuilder(), false); + public static final RecipeMap BLAST_RECIPES = new RecipeMap<>("electric_blast_furnace", 1, 3, 1, 2, 0, 1, 0, 1, new BlastRecipeBuilder(), false) + .setSound(GTSounds.FURNACE); /** * Example: @@ -405,7 +432,8 @@ public class RecipeMaps { public static final RecipeMap IMPLOSION_RECIPES = new RecipeMap<>("implosion_compressor", 2, 3, 1, 2, 0, 0, 0, 0, new ImplosionRecipeBuilder().duration(20).EUt(30), false) .setSlotOverlay(false, false, true, GuiTextures.IMPLOSION_OVERLAY_1) .setSlotOverlay(false, false, false, GuiTextures.IMPLOSION_OVERLAY_2) - .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY); + .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) + .setSound(GTSounds.EXPLOSION); /** * Example: @@ -419,7 +447,8 @@ public class RecipeMaps { */ @ZenProperty - public static final RecipeMap VACUUM_RECIPES = new RecipeMap<>("vacuum_freezer", 0, 1, 0, 1, 0, 1, 0, 1, new SimpleRecipeBuilder().EUt(120), false); + public static final RecipeMap VACUUM_RECIPES = new RecipeMap<>("vacuum_freezer", 0, 1, 0, 1, 0, 1, 0, 1, new SimpleRecipeBuilder().EUt(120), false) + .setSound(GTSounds.COOLING); /** * Example: @@ -444,6 +473,7 @@ public class RecipeMaps { .setSlotOverlay(true, false, GuiTextures.VIAL_OVERLAY_1) .setSlotOverlay(true, true, GuiTextures.VIAL_OVERLAY_2) .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) + .setSound(GTValues.FOOLS.get() ? GTSounds.SCIENCE : GTSounds.CHEMICAL_REACTOR) .onRecipeBuild(recipeBuilder -> { RecipeMaps.LARGE_CHEMICAL_RECIPES.recipeBuilder() .inputs(recipeBuilder.getInputs().toArray(new CountableIngredient[0])) @@ -477,7 +507,8 @@ public class RecipeMaps { .setSlotOverlay(false, true, true, GuiTextures.MOLECULAR_OVERLAY_4) .setSlotOverlay(true, false, GuiTextures.VIAL_OVERLAY_1) .setSlotOverlay(true, true, GuiTextures.VIAL_OVERLAY_2) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL) + .setSound(GTSounds.CHEMICAL_REACTOR); /** * If universal every Fluid also gets separate distillation recipes @@ -494,7 +525,8 @@ public class RecipeMaps { */ @ZenProperty - public static final RecipeMap DISTILLATION_RECIPES = new RecipeMapDistillationTower("distillation_tower", 0, 0, 0, 1, 1, 1, 1, 12, new UniversalDistillationRecipeBuilder(), false); + public static final RecipeMap DISTILLATION_RECIPES = new RecipeMapDistillationTower("distillation_tower", 0, 0, 0, 1, 1, 1, 1, 12, new UniversalDistillationRecipeBuilder(), false) + .setSound(GTSounds.CHEMICAL_REACTOR); /** * Example: @@ -512,7 +544,8 @@ public class RecipeMaps { public static final RecipeMap CRACKING_RECIPES = new RecipeMap<>("cracker", 0, 0, 0, 0, 2, 2, 1, 2, new SimpleRecipeBuilder(), false) .setSlotOverlay(false, true, GuiTextures.CRACKING_OVERLAY_1) .setSlotOverlay(true, true, GuiTextures.CRACKING_OVERLAY_2) - .setProgressBar(GuiTextures.PROGRESS_BAR_CRACKING, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_CRACKING, MoveType.HORIZONTAL) + .setSound(GTSounds.FIRE); /** * Example: @@ -530,7 +563,8 @@ public class RecipeMaps { */ @ZenProperty - public static final RecipeMap PYROLYSE_RECIPES = new RecipeMap<>("pyrolyse_oven", 2, 2, 0, 1, 0, 1, 1, 1, new IntCircuitRecipeBuilder(), false); + public static final RecipeMap PYROLYSE_RECIPES = new RecipeMap<>("pyrolyse_oven", 2, 2, 0, 1, 0, 1, 1, 1, new IntCircuitRecipeBuilder(), false) + .setSound(GTSounds.FIRE); /** * Example: @@ -547,7 +581,8 @@ public class RecipeMaps { @ZenProperty public static final RecipeMap WIREMILL_RECIPES = new RecipeMap<>("wiremill", 1, 1, 1, 1, 0, 0, 0, 0, new SimpleRecipeBuilder(), false) .setSlotOverlay(false, false, GuiTextures.WIREMILL_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_WIREMILL, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_WIREMILL, MoveType.HORIZONTAL) + .setSound(GTSounds.MOTOR); /** * Example: @@ -564,13 +599,15 @@ public class RecipeMaps { @ZenProperty public static final RecipeMap BENDER_RECIPES = new RecipeMap<>("bender", 2, 2, 1, 1, 0, 0, 0, 0, new IntCircuitRecipeBuilder(), false) .setSlotOverlay(false, false, false, GuiTextures.BENDER_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_BENDING, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_BENDING, MoveType.HORIZONTAL) + .setSound(GTSounds.MOTOR); @ZenProperty public static final RecipeMap ALLOY_SMELTER_RECIPES = new RecipeMap<>("alloy_smelter", 1, 2, 1, 1, 0, 0, 0, 0, new SimpleRecipeBuilder(), false) .setSlotOverlay(false, false, GuiTextures.FURNACE_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) + .setSound(GTSounds.FURNACE); /** * Example: @@ -591,7 +628,8 @@ public class RecipeMaps { .setSlotOverlay(true, false, GuiTextures.CANISTER_OVERLAY) .setSlotOverlay(false, true, GuiTextures.DARK_CANISTER_OVERLAY) .setSlotOverlay(true, true, GuiTextures.DARK_CANISTER_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_CANNER, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_CANNER, MoveType.HORIZONTAL) + .setSound(GTSounds.BATH); /** * Example: @@ -611,7 +649,8 @@ public class RecipeMaps { .setSlotOverlay(true, false, false, GuiTextures.PIPE_OVERLAY_2) .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) .setSpecialTexture(98, 24, 5, 18, GuiTextures.PROGRESS_BAR_LATHE_BASE) - .setProgressBar(GuiTextures.PROGRESS_BAR_LATHE, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_LATHE, MoveType.HORIZONTAL) + .setSound(GTSounds.CUT); /** * Example: @@ -632,6 +671,7 @@ public class RecipeMaps { .setSlotOverlay(true, false, false, GuiTextures.CUTTER_OVERLAY) .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) .setProgressBar(GuiTextures.PROGRESS_BAR_SLICE, MoveType.HORIZONTAL) + .setSound(GTSounds.CUT) .onRecipeBuild(recipeBuilder -> { if (recipeBuilder.getFluidInputs().isEmpty()) { recipeBuilder.copy() @@ -666,7 +706,8 @@ public class RecipeMaps { @ZenProperty public static final RecipeMap EXTRUDER_RECIPES = new RecipeMap<>("extruder", 2, 2, 1, 1, 0, 0, 0, 0, new SimpleRecipeBuilder(), false) .setSlotOverlay(false, false, true, GuiTextures.MOLD_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRUDER, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRUDER, MoveType.HORIZONTAL) + .setSound(GTSounds.ARC); /** * Example: @@ -684,24 +725,28 @@ public class RecipeMaps { public static final RecipeMap FORGE_HAMMER_RECIPES = new RecipeMap<>("forge_hammer", 1, 1, 1, 1, 0, 0, 0, 0, new SimpleRecipeBuilder(), false) .setSlotOverlay(false, false, GuiTextures.HAMMER_OVERLAY) .setSpecialTexture(78, 42, 20, 6, GuiTextures.PROGRESS_BAR_HAMMER_BASE) - .setProgressBar(GuiTextures.PROGRESS_BAR_HAMMER, MoveType.VERTICAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_HAMMER, MoveType.VERTICAL) + .setSound(GTSounds.FORGE_HAMMER); @ZenProperty public static final RecipeMap PACKER_RECIPES = new RecipeMap<>("packer", 2, 2, 1, 1, 0, 0, 0, 0, new SimpleRecipeBuilder().EUt(12).duration(10), false) .setSlotOverlay(false, false, true, GuiTextures.BOX_OVERLAY) .setSlotOverlay(true, false, GuiTextures.BOXED_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_PACKER, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_PACKER, MoveType.HORIZONTAL) + .setSound(GTSounds.ASSEMBLER); @ZenProperty public static final RecipeMap UNPACKER_RECIPES = new RecipeMap<>("unpacker", 2, 2, 1, 2, 0, 0, 0, 0, new SimpleRecipeBuilder().EUt(12).duration(10), false) .setSlotOverlay(false, false, GuiTextures.BOXED_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_UNPACKER, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_UNPACKER, MoveType.HORIZONTAL) + .setSound(GTSounds.ASSEMBLER); @ZenProperty - public static final RecipeMapAssemblyLine ASSEMBLY_LINE_RECIPES = new RecipeMapAssemblyLine<>("assembly_line", 4, 16, 1, 1, 0, 4, 0, 0, new SimpleRecipeBuilder(), false) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL); + public static final RecipeMapAssemblyLine ASSEMBLY_LINE_RECIPES = (RecipeMapAssemblyLine) new RecipeMapAssemblyLine<>("assembly_line", 4, 16, 1, 1, 0, 4, 0, 0, new SimpleRecipeBuilder(), false) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) + .setSound(GTSounds.ASSEMBLER); // ASSEMBLY_LINE_RECIPES.setSlotOverlay(false, false, GuiTextures.MOLD_OVERLAY); TODO Fix this (???) @ZenProperty @@ -709,6 +754,7 @@ public class RecipeMaps { 1, 6, 1, 1, 0, 1, 0, 0, new CircuitAssemblerRecipeBuilder(), false) .setSlotOverlay(false, false, GuiTextures.CIRCUIT_OVERLAY) .setProgressBar(GuiTextures.PROGRESS_BAR_CIRCUIT_ASSEMBLER, ProgressWidget.MoveType.HORIZONTAL) + .setSound(GTSounds.ASSEMBLER) .onRecipeBuild(recipeBuilder -> { if (recipeBuilder.getFluidInputs().isEmpty()) { recipeBuilder.copy() @@ -726,7 +772,8 @@ public class RecipeMaps { .setSlotOverlay(false, true, GuiTextures.ATOMIC_OVERLAY_2) .setSlotOverlay(true, true, GuiTextures.POSITIVE_MATTER_OVERLAY) .setSlotOverlay(true, true, true, GuiTextures.NEUTRAL_MATTER_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_MASS_FAB, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_MASS_FAB, MoveType.HORIZONTAL) + .setSound(GTSounds.REPLICATOR); @ZenProperty public static final RecipeMap REPLICATOR_RECIPES = new RecipeMap<>("replicator", 1, 1, 0, 1, 1, 2, 0, 1, new SimpleRecipeBuilder(), false) @@ -735,52 +782,63 @@ public class RecipeMaps { .setSlotOverlay(true, true, GuiTextures.ATOMIC_OVERLAY_2) .setSlotOverlay(false, true, GuiTextures.NEUTRAL_MATTER_OVERLAY) .setSlotOverlay(false, true, true, GuiTextures.POSITIVE_MATTER_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_REPLICATOR, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_REPLICATOR, MoveType.HORIZONTAL) + .setSound(GTSounds.REPLICATOR); @ZenProperty public static final RecipeMap SCANNER_RECIPES = new RecipeMap<>("scanner", 0, 2, 1, 1, 0, 1, 0, 0, new SimpleRecipeBuilder(), false) .setSlotOverlay(false, false, GuiTextures.DATA_ORB_OVERLAY) .setSlotOverlay(false, false, true, GuiTextures.SCANNER_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, MoveType.HORIZONTAL) + .setSound(GTSounds.ELECTROLYZER); @ZenProperty public static final RecipeMap GAS_COLLECTOR_RECIPES = new RecipeMap<>("gas_collector", 1, 1, 0, 0, 0, 0, 1, 1, new GasCollectorRecipeBuilder(), false) .setSlotOverlay(false, false, GuiTextures.INT_CIRCUIT_OVERLAY) .setSlotOverlay(true, true, GuiTextures.CENTRIFUGE_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR, MoveType.HORIZONTAL) + .setSound(GTSounds.COOLING); public static final RecipeMap SIMPLE_WASHER_RECIPES = new RecipeMap<>("simple_washer", 1, 1, 1, 1, 1, 1, 0, 0, new SimpleRecipeBuilder(), true) .setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY) .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_BATH, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_BATH, MoveType.HORIZONTAL) + .setSound(GTSounds.BATH); public static final RecipeMap ROCK_BREAKER_RECIPES = new RecipeMap<>("rock_breaker", 1, 1, 1, 4, 0, 0, 0, 0, new SimpleRecipeBuilder(), false) .setSlotOverlay(false, false, GuiTextures.DUST_OVERLAY) .setSlotOverlay(true, false, GuiTextures.CRUSHED_ORE_OVERLAY) - .setProgressBar(GuiTextures.PROGRESS_BAR_MACERATE, MoveType.HORIZONTAL); + .setProgressBar(GuiTextures.PROGRESS_BAR_MACERATE, MoveType.HORIZONTAL) + .setSound(GTSounds.FIRE); @ZenProperty - public static final RecipeMap PRIMITIVE_BLAST_FURNACE_RECIPES = new RecipeMap<>("primitive_blast_furnace", 2, 3, 1, 3, 0, 0, 0, 0, new PrimitiveRecipeBuilder(), false); + public static final RecipeMap PRIMITIVE_BLAST_FURNACE_RECIPES = new RecipeMap<>("primitive_blast_furnace", 2, 3, 1, 3, 0, 0, 0, 0, new PrimitiveRecipeBuilder(), false) + .setSound(GTSounds.FIRE); @ZenProperty - public static final RecipeMap COKE_OVEN_RECIPES = new RecipeMap<>("coke_oven", 1, 1, 0, 1, 0, 0, 0, 1, new PrimitiveRecipeBuilder(), false); + public static final RecipeMap COKE_OVEN_RECIPES = new RecipeMap<>("coke_oven", 1, 1, 0, 1, 0, 0, 0, 1, new PrimitiveRecipeBuilder(), false) + .setSound(GTSounds.FIRE); ////////////////////////////////////// // Fuel Recipe Maps // ////////////////////////////////////// @ZenProperty - public static final FuelRecipeMap COMBUSTION_GENERATOR_FUELS = new FuelRecipeMap("combustion_generator"); + public static final FuelRecipeMap COMBUSTION_GENERATOR_FUELS = new FuelRecipeMap("combustion_generator") + .setSound(GTSounds.COMBUSTION); @ZenProperty - public static final FuelRecipeMap GAS_TURBINE_FUELS = new FuelRecipeMap("gas_turbine"); + public static final FuelRecipeMap GAS_TURBINE_FUELS = new FuelRecipeMap("gas_turbine") + .setSound(GTSounds.TURBINE); @ZenProperty - public static final FuelRecipeMap STEAM_TURBINE_FUELS = new FuelRecipeMap("steam_turbine"); + public static final FuelRecipeMap STEAM_TURBINE_FUELS = new FuelRecipeMap("steam_turbine") + .setSound(GTSounds.TURBINE); @ZenProperty public static final FuelRecipeMap SEMI_FLUID_GENERATOR_FUELS = new FuelRecipeMap("semi_fluid_generator"); @ZenProperty - public static final FuelRecipeMap PLASMA_GENERATOR_FUELS = new FuelRecipeMap("plasma_generator"); + public static final FuelRecipeMap PLASMA_GENERATOR_FUELS = new FuelRecipeMap("plasma_generator") + .setSound(GTSounds.TURBINE); } diff --git a/src/main/java/gregtech/api/recipes/machines/FuelRecipeMap.java b/src/main/java/gregtech/api/recipes/machines/FuelRecipeMap.java index 35cb973c718..cf2df153c97 100644 --- a/src/main/java/gregtech/api/recipes/machines/FuelRecipeMap.java +++ b/src/main/java/gregtech/api/recipes/machines/FuelRecipeMap.java @@ -5,8 +5,10 @@ import crafttweaker.api.minecraft.CraftTweakerMC; import gregtech.api.GTValues; import gregtech.api.recipes.FluidKey; +import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.recipes.FuelRecipe; import gregtech.api.util.LocalizationUtils; +import net.minecraft.util.SoundEvent; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.common.Optional.Method; import stanhebben.zenscript.annotations.ZenClass; @@ -25,12 +27,22 @@ public class FuelRecipeMap { private final Map recipeFluidMap = new HashMap<>(); private final List recipeList = new ArrayList<>(); + private SoundEvent sound; public FuelRecipeMap(String unlocalizedName) { this.unlocalizedName = unlocalizedName; RECIPE_MAPS.add(this); } + public SoundEvent getSound() { + return sound; + } + + public FuelRecipeMap setSound(SoundEvent sound) { + this.sound = sound; + return this; + } + @ZenGetter("recipeMaps") public static List getRecipeMaps() { return RECIPE_MAPS; diff --git a/src/main/java/gregtech/api/sound/GTSounds.java b/src/main/java/gregtech/api/sound/GTSounds.java new file mode 100644 index 00000000000..93966da67e1 --- /dev/null +++ b/src/main/java/gregtech/api/sound/GTSounds.java @@ -0,0 +1,93 @@ +package gregtech.api.sound; + +import gregtech.api.GTValues; +import net.minecraft.client.audio.Sound; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.SoundEvent; +import net.minecraftforge.fml.common.registry.ForgeRegistries; + +public class GTSounds { + public static SoundEvent MOTOR; + public static SoundEvent BATH; + public static SoundEvent MIXER; + public static SoundEvent ELECTROLYZER; + public static SoundEvent CENTRIFUGE; + public static SoundEvent FORGE_HAMMER; + public static SoundEvent MACERATOR; + public static SoundEvent CHEMICAL_REACTOR; + public static SoundEvent ARC; + public static SoundEvent BOILER; + public static SoundEvent FURNACE; + public static SoundEvent FIRE; + public static SoundEvent TURBINE; + public static SoundEvent COMBUSTION; + public static SoundEvent SCIENCE; + public static SoundEvent ASSEMBLER; + public static SoundEvent COMPRESSOR; + public static SoundEvent REPLICATOR; + public static SoundEvent CUT; + public static SoundEvent COOLING; + public static SoundEvent MINER; + public static SoundEvent EXPLOSION; + public static SoundEvent DRILL_TOOL; + public static SoundEvent PLUNGER_TOOL; + public static SoundEvent FILE_TOOL; + public static SoundEvent SAW_TOOL; + public static SoundEvent SCREWDRIVER_TOOL; + public static SoundEvent CHAINSAW_TOOL; + public static SoundEvent WIRECUTTER_TOOL; + public static SoundEvent SPRAY_CAN_TOOL; + public static SoundEvent TRICORDER_TOOL; + public static SoundEvent WRENCH_TOOL; + public static SoundEvent MORTAR_TOOL; + public static SoundEvent SOFT_HAMMER_TOOL; + + public static SoundEvent RECORD_SOUND; + + + public static void registerSounds() { + FORGE_HAMMER = registerSound("tick.forge_hammer"); + MACERATOR = registerSound("tick.macerator"); + CHEMICAL_REACTOR = registerSound("tick.chemical_reactor"); + ASSEMBLER = registerSound("tick.assembler"); + CENTRIFUGE = registerSound("tick.centrifuge"); + COMPRESSOR = registerSound("tick.compressor"); + ELECTROLYZER = registerSound("tick.electrolyzer"); + MIXER = registerSound("tick.mixer"); + REPLICATOR = registerSound("tick.replicator"); + ARC = registerSound("tick.arc"); + BOILER = registerSound("tick.boiler"); + FURNACE = registerSound("tick.furnace"); + COOLING = registerSound("tick.cooling"); + FIRE = registerSound("tick.fire"); + BATH = registerSound("tick.bath"); + MOTOR = registerSound("tick.motor"); + CUT = registerSound("tick.cut"); + TURBINE = registerSound("tick.turbine"); + COMBUSTION = registerSound("tick.combustion"); + MINER = registerSound("tick.miner"); // TODO: When miners are released, please make them implement ISoundCreator and use the GTSounds.MINER sound effect. + EXPLOSION = registerSound("tick.explosion"); + SCIENCE = registerSound("tick.science"); + WRENCH_TOOL = registerSound("use.wrench"); + SOFT_HAMMER_TOOL = registerSound("use.soft_hammer"); + DRILL_TOOL = registerSound("use.drill"); + PLUNGER_TOOL = registerSound("use.plunger"); + FILE_TOOL = registerSound("use.file"); + SAW_TOOL = registerSound("use.saw"); + SCREWDRIVER_TOOL = registerSound("use.screwdriver"); + CHAINSAW_TOOL = registerSound("use.chainsaw"); + WIRECUTTER_TOOL = registerSound("use.wirecutter"); + SPRAY_CAN_TOOL = registerSound("use.spray_can"); + TRICORDER_TOOL = registerSound("use.tricorder"); // TODO: use this when tricorders are put in-game + MORTAR_TOOL = registerSound("use.mortar"); + RECORD_SOUND = registerSound("record.sus"); + } + + private static SoundEvent registerSound(String soundNameIn) { + ResourceLocation location = new ResourceLocation(GTValues.MODID, soundNameIn); + SoundEvent event = new SoundEvent(location); + event.setRegistryName(location); + ForgeRegistries.SOUND_EVENTS.register(event); + return event; + } +} diff --git a/src/main/java/gregtech/common/ConfigHolder.java b/src/main/java/gregtech/common/ConfigHolder.java index 15aff21024f..099dce2018b 100644 --- a/src/main/java/gregtech/common/ConfigHolder.java +++ b/src/main/java/gregtech/common/ConfigHolder.java @@ -99,13 +99,22 @@ public class ConfigHolder { @Config.RequiresMcRestart public static int gasTurbineBonusOutput = 6144; + @Config.Comment("If true, sounds will be played while machines are active. Default: true") + @Config.RequiresWorldRestart + public static boolean machineSounds = true; + + @Config.Comment("If true, sounds will be played when using tools outside of crafting. Default: true") + public static boolean toolUseSounds = true; + + @Config.Comment("If true, sounds will be played when crafting with tools. Default: true") + public static boolean toolCraftingSounds = true; + @Config.Comment("The EU drain per tick for each screen.") @Config.Name("CentralMonitor cost") @Config.RangeInt(min = 0) @Config.RequiresMcRestart public static int centralMonitorEuCost = 50; - public static class VanillaRecipes { @Config.Comment("Whether to make glass related recipes harder. Default: true") diff --git a/src/main/java/gregtech/common/items/MetaItem1.java b/src/main/java/gregtech/common/items/MetaItem1.java index 657a3ea8b1f..658fe8d7f37 100644 --- a/src/main/java/gregtech/common/items/MetaItem1.java +++ b/src/main/java/gregtech/common/items/MetaItem1.java @@ -2,12 +2,10 @@ import gregtech.api.GTValues; import gregtech.api.items.OreDictNames; -import gregtech.api.items.metaitem.ElectricStats; -import gregtech.api.items.metaitem.FluidStats; -import gregtech.api.items.metaitem.FoodStats; -import gregtech.api.items.metaitem.StandardMetaItem; +import gregtech.api.items.metaitem.*; import gregtech.api.items.metaitem.stats.IItemComponent; import gregtech.api.items.metaitem.stats.IItemContainerItemProvider; +import gregtech.api.sound.GTSounds; import gregtech.api.terminal.hardware.HardwareProvider; import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.material.MarkerMaterials.Component; @@ -585,6 +583,7 @@ public void registerSubItems() { COLOURED_LEDS = addItem(800, "coloured.leds"); DISPLAY = addItem(801, "display"); + SUS_RECORD = addItem(802, "record.sus").addComponents(new MusicDiscStats(GTSounds.RECORD_SOUND)).setRarity(EnumRarity.RARE).setMaxStackSize(1).setInvisible(); } } diff --git a/src/main/java/gregtech/common/items/MetaItems.java b/src/main/java/gregtech/common/items/MetaItems.java index f87196a60f1..89577e55ff7 100644 --- a/src/main/java/gregtech/common/items/MetaItems.java +++ b/src/main/java/gregtech/common/items/MetaItems.java @@ -531,6 +531,8 @@ private MetaItems() { public static MetaItem.MetaValueItem IMPELLER_HV; public static MetaItem.MetaValueItem GRAVITATION_ENGINE; + public static MetaItem.MetaValueItem SUS_RECORD; + private static final List orePrefixes = new ArrayList() {{ add(OrePrefix.dust); add(OrePrefix.dustSmall); diff --git a/src/main/java/gregtech/common/items/MetaTool.java b/src/main/java/gregtech/common/items/MetaTool.java index 3fc5e1177a9..6ed3ce4ea85 100644 --- a/src/main/java/gregtech/common/items/MetaTool.java +++ b/src/main/java/gregtech/common/items/MetaTool.java @@ -4,9 +4,21 @@ import gregtech.api.items.ToolDictNames; import gregtech.api.items.metaitem.ElectricStats; import gregtech.api.items.toolitem.*; +import gregtech.api.recipes.ModHandler; +import gregtech.api.sound.GTSounds; +import gregtech.api.unification.material.Material; +import gregtech.api.unification.material.Materials; +import gregtech.api.unification.ore.OrePrefix; +import gregtech.api.unification.stack.UnificationEntry; import gregtech.common.ConfigHolder; import gregtech.common.tools.*; import gregtech.common.tools.largedrills.ToolDrills; +import net.minecraft.init.Enchantments; +import net.minecraft.init.Items; +import net.minecraft.init.SoundEvents; +import net.minecraft.item.ItemStack; + +import java.util.function.Function; import static gregtech.common.items.MetaItems.*; @@ -40,55 +52,68 @@ public void registerSubItems() { SAW = addItem(5, "tool.saw").setToolStats(new ToolSaw()) .setFullRepairCost(2) - .addOreDict(ToolDictNames.craftingToolSaw); + .addOreDict(ToolDictNames.craftingToolSaw) + .setSound(GTSounds.SAW_TOOL); HARD_HAMMER = addItem(6, "tool.hard_hammer").setToolStats(new ToolHardHammer()) .setFullRepairCost(6) - .addOreDict(ToolDictNames.craftingToolHardHammer); + .addOreDict(ToolDictNames.craftingToolHardHammer) + .addComponents(new HammerItemStat()) + .setSound(SoundEvents.BLOCK_ANVIL_USE); SOFT_HAMMER = addItem(7, "tool.soft_hammer").setToolStats(new ToolSoftHammer()) .setFullRepairCost(6) .addOreDict(ToolDictNames.craftingToolSoftHammer) - .addComponents(new SoftMalletItemStat()); + .addComponents(new SoftMalletItemStat()) + .setSound(GTSounds.SOFT_HAMMER_TOOL); WRENCH = addItem(8, "tool.wrench").setToolStats(new ToolWrench()) .setFullRepairCost(6) .addOreDict(ToolDictNames.craftingToolWrench) - .addComponents(new WrenchItemStat()); + .addComponents(new WrenchItemStat()) + .setSound(GTSounds.WRENCH_TOOL); FILE = addItem(9, "tool.file").setToolStats(new ToolFile()) .setFullRepairCost(2) - .addOreDict(ToolDictNames.craftingToolFile); + .addOreDict(ToolDictNames.craftingToolFile) + .setSound(GTSounds.FILE_TOOL); CROWBAR = addItem(10, "tool.crowbar").setToolStats(new ToolCrowbar()) .setFullRepairCost(1.5) - .addOreDict(ToolDictNames.craftingToolCrowbar); + .addOreDict(ToolDictNames.craftingToolCrowbar) + .setSound(SoundEvents.BLOCK_IRON_DOOR_OPEN); SCREWDRIVER = addItem(11, "tool.screwdriver").setToolStats(new ToolScrewdriver()) .setFullRepairCost(1) .addOreDict(ToolDictNames.craftingToolScrewdriver) - .addComponents(new ScrewdriverItemStat()); + .addComponents(new ScrewdriverItemStat()) + .setSound(GTSounds.SCREWDRIVER_TOOL); MORTAR = addItem(12, "tool.mortar").setToolStats(new ToolMortar()) .setFullRepairCost(2) - .addOreDict(ToolDictNames.craftingToolMortar); + .addOreDict(ToolDictNames.craftingToolMortar) + .setSound(GTSounds.MORTAR_TOOL); WIRE_CUTTER = addItem(13, "tool.wire_cutter").setToolStats(new ToolWireCutter()) .setFullRepairCost(4.125) .addOreDict(ToolDictNames.craftingToolWireCutter) - .addComponents(new CutterItemStat()); + .addComponents(new CutterItemStat()) + .setSound(GTSounds.WIRECUTTER_TOOL); BRANCH_CUTTER = addItem(14, "tool.branch_cutter").setToolStats(new ToolBranchCutter()) .setFullRepairCost(5.125) - .addOreDict(ToolDictNames.craftingToolBranchCutter); + .addOreDict(ToolDictNames.craftingToolBranchCutter) + .setSound(GTSounds.WIRECUTTER_TOOL); KNIFE = addItem(15, "tool.knife").setToolStats(new ToolKnife()) .setFullRepairCost(1.5) - .addOreDict(ToolDictNames.craftingToolBlade, ToolDictNames.craftingToolKnife); + .addOreDict(ToolDictNames.craftingToolBlade, ToolDictNames.craftingToolKnife) + .setSound(GTSounds.SAW_TOOL); BUTCHERY_KNIFE = addItem(16, "tool.butchery_knife").setToolStats(new ToolButcheryKnife()) .setFullRepairCost(4.5) - .addOreDict(ToolDictNames.craftingToolBlade); + .addOreDict(ToolDictNames.craftingToolBlade) + .setSound(GTSounds.SAW_TOOL); SENSE = addItem(17, "tool.sense").setToolStats(new ToolSense()) .setFullRepairCost(3) @@ -96,7 +121,8 @@ public void registerSubItems() { PLUNGER = addItem(18, "tool.plunger").setToolStats(new ToolPlunger()) .setFullRepairCost(2) - .addOreDict(ToolDictNames.craftingToolPlunger); + .addOreDict(ToolDictNames.craftingToolPlunger) + .setSound(GTSounds.PLUNGER_TOOL); MINING_HAMMER = addItem(19, "tool.mining_hammer").setToolStats(new ToolMiningHammer()) .setFullRepairCost(14); @@ -104,27 +130,32 @@ public void registerSubItems() { DRILL_LV = addItem(20, "tool.drill.lv").setToolStats(new ToolDrills.ToolDrillLV()) .setFullRepairCost(4) .addOreDict(ToolDictNames.craftingToolMiningDrill) - .addComponents(ElectricStats.createElectricItem(100000L, 1L)); + .addComponents(ElectricStats.createElectricItem(100000L, 1L)) + .setSound(GTSounds.DRILL_TOOL); DRILL_MV = addItem(21, "tool.drill.mv").setToolStats(new ToolDrills.ToolDrillMV()) .setFullRepairCost(4) .addOreDict(ToolDictNames.craftingToolMiningDrill) - .addComponents(ElectricStats.createElectricItem(400000L, 2L)); + .addComponents(ElectricStats.createElectricItem(400000L, 2L)) + .setSound(GTSounds.DRILL_TOOL); DRILL_HV = addItem(22, "tool.drill.hv").setToolStats(new ToolDrills.ToolDrillHV()) .setFullRepairCost(4) .addOreDict(ToolDictNames.craftingToolMiningDrill) - .addComponents(ElectricStats.createElectricItem(1600000L, 3L)); + .addComponents(ElectricStats.createElectricItem(1600000L, 3L)) + .setSound(GTSounds.DRILL_TOOL); DRILL_EV = addItem(23, "tool.drill.ev").setToolStats(new ToolDrills.ToolDrillEV()) .setFullRepairCost(4) .addOreDict(ToolDictNames.craftingToolMiningDrill) - .addComponents(ElectricStats.createElectricItem(6400000L, 4L)); + .addComponents(ElectricStats.createElectricItem(6400000L, 4L)) + .setSound(GTSounds.DRILL_TOOL); DRILL_IV = addItem(24, "tool.drill.iv").setToolStats(new ToolDrills.ToolDrillIV()) .setFullRepairCost(4) .addOreDict(ToolDictNames.craftingToolMiningDrill) - .addComponents(ElectricStats.createElectricItem(25600000L, 5L)); + .addComponents(ElectricStats.createElectricItem(25600000L, 5L)) + .setSound(GTSounds.DRILL_TOOL); if (!ConfigHolder.U.GT5u.enableHighTierDrills) { DRILL_EV.setInvisible(); @@ -134,46 +165,54 @@ public void registerSubItems() { CHAINSAW_LV = addItem(25, "tool.chainsaw.lv").setToolStats(new ToolChainsaw(GTValues.LV)) .setFullRepairCost(4) .addOreDict(ToolDictNames.craftingToolSaw) - .addComponents(ElectricStats.createElectricItem(100000L, GTValues.LV)); + .addComponents(ElectricStats.createElectricItem(100000L, GTValues.LV)) + .setSound(GTSounds.CHAINSAW_TOOL); CHAINSAW_MV = addItem(26, "tool.chainsaw.mv").setToolStats(new ToolChainsaw(GTValues.MV)) .setFullRepairCost(4) .addOreDict(ToolDictNames.craftingToolSaw) - .addComponents(ElectricStats.createElectricItem(400000L, GTValues.MV)); + .addComponents(ElectricStats.createElectricItem(400000L, GTValues.MV)) + .setSound(GTSounds.CHAINSAW_TOOL); CHAINSAW_HV = addItem(27, "tool.chainsaw.hv").setToolStats(new ToolChainsaw(GTValues.HV)) .setFullRepairCost(4) .addOreDict(ToolDictNames.craftingToolSaw) - .addComponents(ElectricStats.createElectricItem(1600000L, GTValues.HV)); + .addComponents(ElectricStats.createElectricItem(1600000L, GTValues.HV)) + .setSound(GTSounds.CHAINSAW_TOOL); WRENCH_LV = addItem(28, "tool.wrench.lv").setToolStats(new ToolElectricWrench(GTValues.LV)) .setFullRepairCost(4) .addOreDict(ToolDictNames.craftingToolWrench) .addComponents(new WrenchItemStat()) - .addComponents(ElectricStats.createElectricItem(100000L, GTValues.LV)); + .addComponents(ElectricStats.createElectricItem(100000L, GTValues.LV)) + .setSound(GTSounds.WRENCH_TOOL); WRENCH_MV = addItem(29, "tool.wrench.mv").setToolStats(new ToolElectricWrench(GTValues.MV)) .setFullRepairCost(4) .addOreDict(ToolDictNames.craftingToolWrench) .addComponents(new WrenchItemStat()) - .addComponents(ElectricStats.createElectricItem(400000L, GTValues.MV)); + .addComponents(ElectricStats.createElectricItem(400000L, GTValues.MV)) + .setSound(GTSounds.WRENCH_TOOL); WRENCH_HV = addItem(30, "tool.wrench.hv").setToolStats(new ToolElectricWrench(GTValues.HV)) .setFullRepairCost(4) .addOreDict(ToolDictNames.craftingToolWrench) .addComponents(new WrenchItemStat()) - .addComponents(ElectricStats.createElectricItem(1600000L, GTValues.HV)); + .addComponents(ElectricStats.createElectricItem(1600000L, GTValues.HV)) + .setSound(GTSounds.WRENCH_TOOL); SCREWDRIVER_LV = addItem(31, "tool.screwdriver.lv").setToolStats(new ToolScrewdriverLV()) .setFullRepairCost(1) .addOreDict(ToolDictNames.craftingToolScrewdriver) .addComponents(new ScrewdriverItemStat()) - .addComponents(ElectricStats.createElectricItem(100000L, 1L)); + .addComponents(ElectricStats.createElectricItem(100000L, 1L)) + .setSound(GTSounds.SCREWDRIVER_TOOL); BUZZSAW = addItem(32, "tool.buzzsaw").setToolStats(new ToolBuzzSaw()) .setFullRepairCost(4) .addOreDict(ToolDictNames.craftingToolSaw) - .addComponents(ElectricStats.createElectricItem(100000L, 1L)); + .addComponents(ElectricStats.createElectricItem(100000L, 1L)) + .setSound(GTSounds.CHAINSAW_TOOL); } } diff --git a/src/main/java/gregtech/common/items/behaviors/ColorSprayBehaviour.java b/src/main/java/gregtech/common/items/behaviors/ColorSprayBehaviour.java index 726362de437..57bacdf7163 100644 --- a/src/main/java/gregtech/common/items/behaviors/ColorSprayBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/ColorSprayBehaviour.java @@ -1,5 +1,6 @@ package gregtech.common.items.behaviors; +import gregtech.api.sound.GTSounds; import net.minecraft.block.Block; import net.minecraft.block.BlockStainedGlass; import net.minecraft.block.BlockStainedGlassPane; @@ -9,10 +10,7 @@ import net.minecraft.init.Blocks; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.ItemStack; -import net.minecraft.util.ActionResult; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.*; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -39,6 +37,7 @@ public ActionResult onItemUse(EntityPlayer player, World world, Block return ActionResult.newResult(EnumActionResult.PASS, player.getHeldItem(hand)); } useItemDurability(player, hand, stack, empty.copy()); + world.playSound(null, player.posX, player.posY, player.posZ, GTSounds.SPRAY_CAN_TOOL, SoundCategory.PLAYERS, 100, 0); return ActionResult.newResult(EnumActionResult.SUCCESS, player.getHeldItem(hand)); } diff --git a/src/main/java/gregtech/common/items/behaviors/WrenchBehaviour.java b/src/main/java/gregtech/common/items/behaviors/WrenchBehaviour.java index 2dc0a75259a..c37a76d1420 100644 --- a/src/main/java/gregtech/common/items/behaviors/WrenchBehaviour.java +++ b/src/main/java/gregtech/common/items/behaviors/WrenchBehaviour.java @@ -1,6 +1,8 @@ package gregtech.common.items.behaviors; import gregtech.api.items.metaitem.stats.IItemBehaviour; +import gregtech.api.items.toolitem.IToolStats; +import gregtech.api.items.toolitem.ToolMetaItem; import gregtech.api.metatileentity.MetaTileEntityHolder; import gregtech.api.util.GTUtility; import net.minecraft.client.resources.I18n; @@ -27,7 +29,9 @@ public WrenchBehaviour(int cost) { public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { if (!world.isRemote && !world.isAirBlock(pos)) { ItemStack stack = player.getHeldItem(hand); + TileEntity tileEntity = world.getTileEntity(pos); + if (tileEntity instanceof MetaTileEntityHolder) //machines handle wrench click manually return EnumActionResult.PASS; diff --git a/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityMaintenanceHatch.java b/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityMaintenanceHatch.java index 3a9caead930..06b69d199f1 100644 --- a/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityMaintenanceHatch.java +++ b/src/main/java/gregtech/common/metatileentities/electric/multiblockpart/MetaTileEntityMaintenanceHatch.java @@ -259,6 +259,7 @@ private void fixProblemWithTool(int problemIndex, EntityPlayer entityPlayer) { for (ItemStack itemStack : entityPlayer.inventory.mainInventory) { if (itemStack.isItemEqualIgnoreDurability(tool.getStackForm())) { ((IMaintenance) this.getController()).setMaintenanceFixed(problemIndex); + tool.getToolStats().onBreakingUse(itemStack); damageTool(itemStack); this.setTaped(false); } diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityLargeBoiler.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityLargeBoiler.java index c5d43d2fff9..163948d9bda 100755 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityLargeBoiler.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityLargeBoiler.java @@ -16,6 +16,8 @@ import gregtech.api.metatileentity.multiblock.IMultiblockPart; import gregtech.api.metatileentity.multiblock.MultiblockAbility; import gregtech.api.metatileentity.multiblock.MultiblockWithDisplayBase; +import gregtech.api.metatileentity.sound.ISoundCreator; +import gregtech.api.metatileentity.sound.PositionedSoundMTE; import gregtech.api.multiblock.BlockPattern; import gregtech.api.multiblock.FactoryBlockPattern; import gregtech.api.multiblock.PatternMatchContext; @@ -26,8 +28,10 @@ import gregtech.api.render.OrientedOverlayRenderer; import gregtech.api.render.SimpleCubeRenderer; import gregtech.api.render.Textures; +import gregtech.api.sound.GTSounds; import gregtech.api.unification.material.Materials; import gregtech.api.util.GTUtility; +import gregtech.common.ConfigHolder; import gregtech.common.blocks.BlockBoilerCasing.BoilerCasingType; import gregtech.common.blocks.BlockFireboxCasing; import gregtech.common.blocks.BlockFireboxCasing.FireboxCasingType; @@ -35,6 +39,7 @@ import gregtech.common.blocks.MetaBlocks; import gregtech.common.tools.DamageValues; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -43,6 +48,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.text.ITextComponent; @@ -59,7 +65,7 @@ import static gregtech.api.gui.widgets.AdvancedTextWidget.withButton; import static gregtech.api.gui.widgets.AdvancedTextWidget.withHoverTextTranslate; -public class MetaTileEntityLargeBoiler extends MultiblockWithDisplayBase implements IFuelable { +public class MetaTileEntityLargeBoiler extends MultiblockWithDisplayBase implements IFuelable, ISoundCreator { private static final int CONSUMPTION_MULTIPLIER = 100; private static final int BOILING_TEMPERATURE = 100; @@ -106,7 +112,7 @@ public enum BoilerType { public final OrientedOverlayRenderer frontOverlay; BoilerType(int baseSteamOutput, float fuelConsumptionMultiplier, int temperatureEffBuff, int maxTemperature, IBlockState casingState, IBlockState fireboxState, IBlockState pipeState, - ICubeRenderer solidCasingRenderer, SimpleCubeRenderer fireboxIdleRenderer, SimpleCubeRenderer firefoxActiveRenderer, OrientedOverlayRenderer frontOverlay) { + ICubeRenderer solidCasingRenderer, SimpleCubeRenderer fireboxIdleRenderer, SimpleCubeRenderer firefoxActiveRenderer, OrientedOverlayRenderer frontOverlay) { this.baseSteamOutput = baseSteamOutput; this.fuelConsumptionMultiplier = fuelConsumptionMultiplier; this.temperatureEffBuff = temperatureEffBuff; @@ -552,4 +558,16 @@ public Collection getFuels() { public boolean hasMufflerMechanics() { return true; } + + @Override + public void onAttached() { + super.onAttached(); + if (getWorld() != null && getWorld().isRemote) { + this.setupSound(GTSounds.BOILER, this.getPos()); + } + } + + public boolean canCreateSound() { + return isActive; + } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/FueledMultiblockController.java b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/FueledMultiblockController.java index 9d91793a04c..bcb36ad204b 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/generator/FueledMultiblockController.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/generator/FueledMultiblockController.java @@ -12,16 +12,21 @@ import gregtech.api.metatileentity.multiblock.IMultiblockPart; import gregtech.api.metatileentity.multiblock.MultiblockAbility; import gregtech.api.metatileentity.multiblock.MultiblockWithDisplayBase; +import gregtech.api.metatileentity.sound.ISoundCreator; +import gregtech.api.metatileentity.sound.PositionedSoundMTE; import gregtech.api.multiblock.PatternMatchContext; import gregtech.api.recipes.machines.FuelRecipeMap; +import gregtech.common.ConfigHolder; +import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.SoundCategory; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentTranslation; import java.util.List; import java.util.Map; -public abstract class FueledMultiblockController extends MultiblockWithDisplayBase { +public abstract class FueledMultiblockController extends MultiblockWithDisplayBase implements ISoundCreator { protected final FuelRecipeMap recipeMap; protected final FuelRecipeLogic workableHandler; @@ -105,4 +110,17 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, this.getFrontOverlay().render(renderState, translation, pipeline, getFrontFacing(), isStructureFormed() && workableHandler.isActive()); } + + @Override + public void onAttached() { + super.onAttached(); + if (getWorld() != null && getWorld().isRemote) { + this.setupSound(workableHandler.recipeMap.getSound(), this.getPos()); + } + } + + public boolean canCreateSound() { + return isActive(); + } + } diff --git a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java index 092569482c6..fd8b91c2ad3 100644 --- a/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java +++ b/src/main/java/gregtech/common/metatileentities/steam/boiler/SteamBoiler.java @@ -11,11 +11,16 @@ import gregtech.api.gui.widgets.*; import gregtech.api.gui.widgets.ProgressWidget.MoveType; import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.sound.ISoundCreator; +import gregtech.api.metatileentity.sound.PositionedSoundMTE; import gregtech.api.recipes.ModHandler; import gregtech.api.render.OrientedOverlayRenderer; import gregtech.api.render.SimpleSidedCubeRenderer; import gregtech.api.render.Textures; +import gregtech.api.sound.GTSounds; import gregtech.api.util.GTUtility; +import gregtech.common.ConfigHolder; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; @@ -39,7 +44,7 @@ import static gregtech.api.capability.GregtechDataCodes.IS_WORKING; -public abstract class SteamBoiler extends MetaTileEntity { +public abstract class SteamBoiler extends MetaTileEntity implements ISoundCreator { private static final EnumFacing[] STEAM_PUSH_DIRECTIONS = ArrayUtils.add(EnumFacing.HORIZONTALS, EnumFacing.UP); @@ -75,6 +80,11 @@ public SteamBoiler(ResourceLocation metaTileEntityId, boolean isHighPressure, Or this.setPaintingColor(0xFFFFFF); } + @Override + public boolean canCreateSound() { + return isBurning; + } + @SideOnly(Side.CLIENT) protected SimpleSidedCubeRenderer getBaseRenderer() { if (isHighPressure) { @@ -294,4 +304,12 @@ public ModularUI.Builder createUITemplate(EntityPlayer player) { public void addInformation(ItemStack stack, @Nullable World player, List tooltip, boolean advanced) { tooltip.add(I18n.format("gregtech.machine.steam_boiler.tooltip_produces", getBaseSteamOutput())); } + + @Override + public void onAttached() { + super.onAttached(); + if (getWorld() != null && getWorld().isRemote) { + this.setupSound(GTSounds.BOILER, this.getPos()); + } + } } diff --git a/src/main/java/gregtech/common/tools/DamageValues.java b/src/main/java/gregtech/common/tools/DamageValues.java index 56fa8fe6261..3f7c2088c7e 100644 --- a/src/main/java/gregtech/common/tools/DamageValues.java +++ b/src/main/java/gregtech/common/tools/DamageValues.java @@ -6,6 +6,7 @@ public class DamageValues { public static final int DAMAGE_FOR_CUTTER = 2; public static final int DAMAGE_FOR_CROWBAR = 1; public static final int DAMAGE_FOR_SOFT_HAMMER = 3; + public static final int DAMAGE_FOR_HAMMER = 3; public static final int DAMAGE_FOR_HOE = 2; public static final int DAMAGE_FOR_PLUNGER = 1; } diff --git a/src/main/java/gregtech/common/tools/HardHammerBehavior.java b/src/main/java/gregtech/common/tools/HardHammerBehavior.java new file mode 100644 index 00000000000..fe2acc93f54 --- /dev/null +++ b/src/main/java/gregtech/common/tools/HardHammerBehavior.java @@ -0,0 +1,61 @@ +package gregtech.common.tools; + +import gregtech.api.GTValues; +import gregtech.api.capability.GregtechTileCapabilities; +import gregtech.api.capability.IControllable; +import gregtech.api.items.metaitem.stats.IItemBehaviour; +import gregtech.api.items.metaitem.stats.IItemComponent; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.MetaTileEntityHolder; +import gregtech.api.util.GTUtility; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.world.World; + +import java.util.List; + +public class HardHammerBehavior implements IItemBehaviour { + + private final int cost; + + public HardHammerBehavior(int cost) { + this.cost = cost; + } + + public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { + if (world.isAirBlock(pos)) { + return EnumActionResult.PASS; + } + + ItemStack stack = player.getHeldItem(hand); + + TileEntity tileEntity = world.getTileEntity(pos); + if (tileEntity instanceof MetaTileEntityHolder) { + MetaTileEntity metaTileEntity = ((MetaTileEntityHolder) tileEntity).getMetaTileEntity(); + if (metaTileEntity != null) { + if(!world.isRemote) { // If it gets to this point, it will run on the client thread and do what it's supposed to, but we don't want this to pull up the GUI. + return EnumActionResult.SUCCESS; + } + metaTileEntity.toggleMuffled(); + if(metaTileEntity.isMuffled()) + player.sendMessage(new TextComponentTranslation("gregtech.machine.muffle.on")); + else + player.sendMessage(new TextComponentTranslation("gregtech.machine.muffle.off")); + GTUtility.doDamageItem(stack, cost, false); + return EnumActionResult.SUCCESS; + } + } + return EnumActionResult.PASS; + } + + public void addInformation(ItemStack itemStack, List lines) { + lines.add(I18n.format("behaviour.hammer")); + } +} diff --git a/src/main/java/gregtech/common/tools/ToolAxe.java b/src/main/java/gregtech/common/tools/ToolAxe.java index e1fdcad922a..9edf9fe510d 100644 --- a/src/main/java/gregtech/common/tools/ToolAxe.java +++ b/src/main/java/gregtech/common/tools/ToolAxe.java @@ -63,6 +63,7 @@ public boolean canMineBlock(IBlockState block, ItemStack stack) { public void onBlockDestroyed(ItemStack stack, World world, IBlockState state, BlockPos pos, EntityLivingBase entity) { super.onBlockDestroyed(stack, world, state, pos, entity); if (!entity.isSneaking() && entity instanceof EntityPlayer) { + this.onBreakingUse(stack); ToolUtility.applyTimberAxe(stack, world, pos, (EntityPlayer) entity); } } diff --git a/src/main/java/gregtech/common/tools/ToolChainsaw.java b/src/main/java/gregtech/common/tools/ToolChainsaw.java index 9bf10384cf0..2b501933514 100644 --- a/src/main/java/gregtech/common/tools/ToolChainsaw.java +++ b/src/main/java/gregtech/common/tools/ToolChainsaw.java @@ -104,6 +104,7 @@ public float getMaxDurabilityMultiplier(ItemStack stack) { public void onBlockDestroyed(ItemStack stack, World world, IBlockState state, BlockPos pos, EntityLivingBase entity) { super.onBlockDestroyed(stack, world, state, pos, entity); if (!entity.isSneaking() && entity instanceof EntityPlayer) { + this.onBreakingUse(stack); ToolUtility.applyTimberAxe(stack, world, pos, (EntityPlayer) entity); } } diff --git a/src/main/java/gregtech/common/tools/ToolChainsawLV.java b/src/main/java/gregtech/common/tools/ToolChainsawLV.java new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/main/java/gregtech/common/tools/ToolHardHammer.java b/src/main/java/gregtech/common/tools/ToolHardHammer.java index 2953f250ceb..d44e3e86481 100644 --- a/src/main/java/gregtech/common/tools/ToolHardHammer.java +++ b/src/main/java/gregtech/common/tools/ToolHardHammer.java @@ -2,6 +2,7 @@ import com.google.common.collect.ImmutableSet; import gregtech.api.enchants.EnchantmentHardHammer; +import gregtech.api.items.metaitem.MetaItem; import gregtech.api.recipes.MatchingMode; import gregtech.api.recipes.RecipeMaps; import net.minecraft.block.material.Material; @@ -88,11 +89,13 @@ public void convertBlockDrops(World world, BlockPos blockPos, IBlockState blockS ToolUtility.applyHammerDrops(world.rand, blockState, dropList, EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, toolStack), player); } - - - @Override public Set getToolClasses(ItemStack stack) { return HAMMER_TOOL_CLASSES; } + + @Override + public void onStatsAddedToTool(MetaItem.MetaValueItem item) { + item.addComponents(new HardHammerBehavior(DamageValues.DAMAGE_FOR_HAMMER)); + } } diff --git a/src/main/java/gregtech/common/tools/largedrills/ToolDrillLarge.java b/src/main/java/gregtech/common/tools/largedrills/ToolDrillLarge.java index 458b71290be..9e589e0e7c6 100644 --- a/src/main/java/gregtech/common/tools/largedrills/ToolDrillLarge.java +++ b/src/main/java/gregtech/common/tools/largedrills/ToolDrillLarge.java @@ -7,10 +7,12 @@ import gregtech.api.items.toolitem.ToolMetaItem; import gregtech.api.util.GTUtility; import gregtech.api.util.RelativeDirection; +import gregtech.common.ConfigHolder; import gregtech.common.items.behaviors.ModeSwitchBehavior; import gregtech.common.tools.ToolBase; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -201,6 +203,10 @@ private static Vec3i multiplyVec(Vec3i start, int multiplier) { ); } + @Override + public void onBreakingUse(ItemStack stack) { + } + @Override public void onBlockDestroyed(ItemStack stack, World world, IBlockState state, BlockPos pos, EntityLivingBase entity) { if (entity instanceof EntityPlayer && !(entity instanceof FakePlayer)) { @@ -233,6 +239,10 @@ public void onBlockDestroyed(ItemStack stack, World world, IBlockState state, Bl } } }*/ + + // Only play this once! + if (Minecraft.getMinecraft().player != null && ConfigHolder.toolUseSounds && stack.getItem() instanceof ToolMetaItem) + Minecraft.getMinecraft().player.playSound(((ToolMetaItem) stack.getItem()).getItem(stack).getSound(), 1, 1); } } diff --git a/src/main/java/gregtech/core/GTCETransformer.java b/src/main/java/gregtech/core/GTCETransformer.java index 84e3fd08999..8f20be3669e 100644 --- a/src/main/java/gregtech/core/GTCETransformer.java +++ b/src/main/java/gregtech/core/GTCETransformer.java @@ -5,6 +5,8 @@ import gregtech.core.util.TargetClassVisitor; import gregtech.core.visitors.*; import net.minecraft.launchwrapper.IClassTransformer; +import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.relauncher.Side; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.Opcodes; @@ -76,6 +78,16 @@ public byte[] transform(String name, String transformedName, byte[] basicClass) BlockVisitor.handleClassNode(classNode).accept(classWriter); return classWriter.toByteArray(); } + break; + } + case RenderGlobalVisitor.TARGET_CLASS_NAME: { + if (FMLCommonHandler.instance().getSide() == Side.CLIENT) { + ClassReader classReader = new ClassReader(basicClass); + ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); + classReader.accept(new TargetClassVisitor(classWriter, RenderGlobalVisitor.TARGET_METHOD, RenderGlobalVisitor::new), 0); + return classWriter.toByteArray(); + } + break; } } return basicClass; diff --git a/src/main/java/gregtech/core/hooks/SoundHooks.java b/src/main/java/gregtech/core/hooks/SoundHooks.java new file mode 100644 index 00000000000..afc5edb4a20 --- /dev/null +++ b/src/main/java/gregtech/core/hooks/SoundHooks.java @@ -0,0 +1,41 @@ +package gregtech.core.hooks; + +import gregtech.api.items.metaitem.MetaItem; +import gregtech.api.items.metaitem.MusicDiscStats; +import gregtech.api.items.metaitem.stats.IItemBehaviour; +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.item.Item; +import net.minecraft.item.ItemRecord; +import net.minecraft.util.math.BlockPos; +import net.minecraftforge.fml.common.ObfuscationReflectionHelper; + +public class SoundHooks { + + public static void playRecord(RenderGlobal renderGlobal, int type, BlockPos pos, int data) { + if (type == 1010) { + WorldClient world = ObfuscationReflectionHelper.getPrivateValue(RenderGlobal.class, renderGlobal, "field_72769_h"); + + // Check if it is a normal Item first, to avoid going to the main method + if (Item.getItemById(data) instanceof ItemRecord) { + world.playRecord(pos, ((ItemRecord)Item.getItemById(data)).getSound()); + return; + } + + // Then check if it is a MetaItem + for (MetaItem metaItem : MetaItem.getMetaItems()) { + MetaItem.MetaValueItem valueItem = metaItem.getItem((short) data); + if (valueItem != null) { + for (IItemBehaviour behavior : valueItem.getBehaviours()) { + if (behavior instanceof MusicDiscStats) { + world.playRecord(pos, ((MusicDiscStats) behavior).getSound()); + return; + } + } + } + } + // In this case, an Event with the correct code was fired, but is an invalid record to play. + world.playRecord(pos, null); + } + } +} diff --git a/src/main/java/gregtech/core/visitors/RenderGlobalVisitor.java b/src/main/java/gregtech/core/visitors/RenderGlobalVisitor.java new file mode 100644 index 00000000000..2f57a3adea7 --- /dev/null +++ b/src/main/java/gregtech/core/visitors/RenderGlobalVisitor.java @@ -0,0 +1,61 @@ +package gregtech.core.visitors; + +import gregtech.core.util.ObfMapping; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; + +public class RenderGlobalVisitor extends MethodVisitor implements Opcodes { + + public static final String TARGET_CLASS_NAME = "net/minecraft/client/renderer/RenderGlobal"; + public static final ObfMapping TARGET_METHOD = new ObfMapping(TARGET_CLASS_NAME, "playEvent", targetSignature()); + + private static final String PLAY_RECORD_OWNER = "gregtech/core/hooks/SoundHooks"; + private static final String PLAY_RECORD_SIGNATURE = recordSignature(); + private static final String PLAY_RECORD_METHOD_NAME = "playRecord"; + + private static final ObfMapping ITEM_GETBYID_INVOKE = new ObfMapping( + "net/minecraft/item/Item", + "func_150899_d", + "(I)Lnet/minecraft/item/Item;" + ).toRuntime(); + + public RenderGlobalVisitor(MethodVisitor mv) { + super(Opcodes.ASM5, mv); + } + + @Override + public void visitInsn(int opcode) { + super.visitInsn(opcode); + } + + @Override + public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) { + if (opcode == INVOKESTATIC && ITEM_GETBYID_INVOKE.matches(name, desc)) { + mv.visitVarInsn(ALOAD, 0); + mv.visitVarInsn(ILOAD, 2); + mv.visitVarInsn(ALOAD, 3); + mv.visitVarInsn(ILOAD, 4); + mv.visitMethodInsn(INVOKESTATIC, PLAY_RECORD_OWNER, PLAY_RECORD_METHOD_NAME, PLAY_RECORD_SIGNATURE, false); + mv.visitInsn(RETURN); + } + super.visitMethodInsn(opcode, owner, name, desc, itf); + } + + private static String targetSignature() { + return "(" + + "Lnet/minecraft/entity/player/EntityPlayer;" + + "I" + + "Lnet/minecraft/util/math/BlockPos;" + + "I" + + ")V"; + } + + private static String recordSignature() { + return "(" + + "Lnet/minecraft/client/renderer/RenderGlobal;" + + "I" + + "Lnet/minecraft/util/math/BlockPos;" + + "I" + + ")V"; + } +} diff --git a/src/main/resources/assets/gregtech/lang/en_us.lang b/src/main/resources/assets/gregtech/lang/en_us.lang index 4899f3baae3..07e66ac294b 100644 --- a/src/main/resources/assets/gregtech/lang/en_us.lang +++ b/src/main/resources/assets/gregtech/lang/en_us.lang @@ -950,6 +950,9 @@ metaarmor.energy_share.disable=Energy Supply: Gadgets charging disabled metaarmor.energy_share.tooltip=Supply mode: %s metaarmor.energy_share.tooltip.guide=To change mode shift-right click when holding item +metaitem.record.sus.name=Music Disc +metaitem.record.sus.tooltip=ยง7Leonz - Among Us Drip + gui.widget.incrementButton.default_tooltip=Hold Shift, Ctrl or both to change the amount cover.filter.blacklist.disabled=Whitelist @@ -3343,6 +3346,8 @@ gregtech.machine.world_accelerator.mode_entity=Entity Mode # General machinery gregtech.machine.basic.input_from_output_side.allow=Allow Input from Output Side gregtech.machine.basic.input_from_output_side.disallow=Disallow Input from Output Side +gregtech.machine.muffle.on=Sound Muffling: Enabled +gregtech.machine.muffle.off=Sound Muffling: Disabled gregtech.machine.perfect_oc=Does not lose energy efficiency when overclocked. # Advancements @@ -3545,6 +3550,7 @@ gregtech.advancement.ultimate_voltage.80_diamericium_titanium_coil.desc=Craft a behaviour.softhammer=Activates and Deactivates Machines +behaviour.hammer=Turns on and off Muffling for Machines (by hitting them) behaviour.wrench=Rotates Blocks on Rightclick behaviour.boor.by=by %s behaviour.paintspray.white.tooltip=Can paint things in White diff --git a/src/main/resources/assets/gregtech/models/item/metaitems/record.sus.json b/src/main/resources/assets/gregtech/models/item/metaitems/record.sus.json new file mode 100644 index 00000000000..a344328af30 --- /dev/null +++ b/src/main/resources/assets/gregtech/models/item/metaitems/record.sus.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "gregtech:items/metaitems/record.sus" + } +} diff --git a/src/main/resources/assets/gregtech/sounds.json b/src/main/resources/assets/gregtech/sounds.json index 7a73a41bfdf..a519fc5896d 100644 --- a/src/main/resources/assets/gregtech/sounds.json +++ b/src/main/resources/assets/gregtech/sounds.json @@ -1,2 +1,37 @@ { -} \ No newline at end of file + "tick.forge_hammer": {"category": "block", "sounds": [{"name": "gregtech:forge_hammer", "stream": false}]}, + "tick.macerator": {"category": "block", "sounds": [{"name": "gregtech:macerator", "stream": false}]}, + "tick.chemical_reactor": {"category": "block", "sounds": [{"name": "gregtech:chemical", "stream": false}]}, + "tick.assembler": {"category": "block", "sounds": [{"name": "gregtech:assembler", "stream": false}]}, + "tick.centrifuge": {"category": "block", "sounds": [{"name": "gregtech:centrifuge", "stream": false}]}, + "tick.compressor": {"category": "block", "sounds": [{"name": "gregtech:compressor", "stream": false}]}, + "tick.electrolyzer": {"category": "block", "sounds": [{"name": "gregtech:electrolyzer", "stream": false}]}, + "tick.mixer": {"category": "block", "sounds": [{"name": "gregtech:mixer", "stream": false}]}, + "tick.replicator": {"category": "block", "sounds": [{"name": "gregtech:replicator", "stream": false}]}, + "tick.arc": {"category": "block", "sounds": [{"name": "gregtech:hum", "stream": false}]}, + "tick.boiler": {"category": "block", "sounds": [{"name": "gregtech:boiling", "stream": false}]}, + "tick.furnace": {"category": "block", "sounds": [{"name": "gregtech:heating", "stream": false}]}, + "tick.cooling": {"category": "block", "sounds": [{"name": "gregtech:cooling", "stream": false}]}, + "tick.fire": {"category": "block", "sounds": [{"name": "gregtech:fire", "stream": false}]}, + "tick.bath": {"category": "block", "sounds": [{"name": "gregtech:bath", "stream": false}]}, + "tick.motor": {"category": "block", "sounds": [{"name": "gregtech:motor", "stream": false}]}, + "tick.cut": {"category": "block", "sounds": [{"name": "gregtech:cut", "stream": false}]}, + "tick.turbine": {"category": "block", "sounds": [{"name": "gregtech:turbine", "stream": false}]}, + "tick.combustion": {"category": "block", "sounds": [{"name": "gregtech:combustion", "stream": false}]}, + "tick.miner": {"category": "block", "sounds": [{"name": "gregtech:miner", "stream": false}]}, + "tick.explosion": {"category": "block", "sounds": [{"name": "gregtech:explosion", "stream": false}]}, + "tick.science": {"category": "block", "sounds": [{"name": "gregtech:science", "stream": false}]}, + "use.wrench": {"category": "block", "sounds": [{"name": "gregtech:wrench", "stream": false}]}, + "use.soft_hammer": {"category": "block", "sounds": [{"name": "gregtech:soft_hammer", "stream": false}]}, + "use.drill": {"category": "block", "sounds": [{"name": "gregtech:drill", "stream": false}]}, + "use.plunger": {"category": "block", "sounds": [{"name": "gregtech:plunger", "stream": false}]}, + "use.file": {"category": "block", "sounds": [{"name": "gregtech:file", "stream": false}]}, + "use.saw": {"category": "block", "sounds": [{"name": "gregtech:saw", "stream": false}]}, + "use.screwdriver": {"category": "block", "sounds": [{"name": "gregtech:screwdriver", "stream": false}]}, + "use.chainsaw": {"category": "block", "sounds": [{"name": "gregtech:chainsaw", "stream": false}]}, + "use.wirecutter": {"category": "block", "sounds": [{"name": "gregtech:wirecutter", "stream": false}]}, + "use.spray_can": {"category": "block", "sounds": [{"name": "gregtech:spray_can", "stream": false}]}, + "use.tricorder": {"category": "block", "sounds": [{"name": "gregtech:tricorder", "stream": false}]}, + "use.mortar": {"category": "block", "sounds": [{"name": "gregtech:mortar", "stream": false}]}, + "record.sus": {"category": "block", "sounds": [{"name": "gregtech:sus", "stream": false}]} +} diff --git a/src/main/resources/assets/gregtech/sounds/assembler.ogg b/src/main/resources/assets/gregtech/sounds/assembler.ogg new file mode 100644 index 00000000000..e96a94bccdf Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/assembler.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/bath.ogg b/src/main/resources/assets/gregtech/sounds/bath.ogg new file mode 100644 index 00000000000..0f525333d76 Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/bath.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/boiling.ogg b/src/main/resources/assets/gregtech/sounds/boiling.ogg new file mode 100644 index 00000000000..db9c4d32e0d Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/boiling.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/centrifuge.ogg b/src/main/resources/assets/gregtech/sounds/centrifuge.ogg new file mode 100644 index 00000000000..e34476d5538 Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/centrifuge.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/chainsaw.ogg b/src/main/resources/assets/gregtech/sounds/chainsaw.ogg new file mode 100644 index 00000000000..fc45600b0c0 Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/chainsaw.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/chemical.ogg b/src/main/resources/assets/gregtech/sounds/chemical.ogg new file mode 100644 index 00000000000..e9061207205 Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/chemical.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/combustion.ogg b/src/main/resources/assets/gregtech/sounds/combustion.ogg new file mode 100644 index 00000000000..e5a45779149 Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/combustion.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/compressor.ogg b/src/main/resources/assets/gregtech/sounds/compressor.ogg new file mode 100644 index 00000000000..90ec1b6dcf2 Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/compressor.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/cooling.ogg b/src/main/resources/assets/gregtech/sounds/cooling.ogg new file mode 100644 index 00000000000..006438e2f2d Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/cooling.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/cut.ogg b/src/main/resources/assets/gregtech/sounds/cut.ogg new file mode 100644 index 00000000000..fcfb4312c9c Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/cut.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/drill.ogg b/src/main/resources/assets/gregtech/sounds/drill.ogg new file mode 100644 index 00000000000..acd5a0bd4a2 Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/drill.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/electrolyzer.ogg b/src/main/resources/assets/gregtech/sounds/electrolyzer.ogg new file mode 100644 index 00000000000..450d03ebcb5 Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/electrolyzer.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/explosion.ogg b/src/main/resources/assets/gregtech/sounds/explosion.ogg new file mode 100644 index 00000000000..15445275b12 Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/explosion.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/file.ogg b/src/main/resources/assets/gregtech/sounds/file.ogg new file mode 100644 index 00000000000..6d74b750a36 Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/file.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/fire.ogg b/src/main/resources/assets/gregtech/sounds/fire.ogg new file mode 100644 index 00000000000..26db8686514 Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/fire.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/forge_hammer.ogg b/src/main/resources/assets/gregtech/sounds/forge_hammer.ogg new file mode 100644 index 00000000000..9abb42d4da9 Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/forge_hammer.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/heating.ogg b/src/main/resources/assets/gregtech/sounds/heating.ogg new file mode 100644 index 00000000000..78e488393d2 Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/heating.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/hum.ogg b/src/main/resources/assets/gregtech/sounds/hum.ogg new file mode 100644 index 00000000000..b71ba78b816 Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/hum.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/macerator.ogg b/src/main/resources/assets/gregtech/sounds/macerator.ogg new file mode 100644 index 00000000000..9ad798ba0f0 Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/macerator.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/miner.ogg b/src/main/resources/assets/gregtech/sounds/miner.ogg new file mode 100644 index 00000000000..90554fcb580 Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/miner.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/mixer.ogg b/src/main/resources/assets/gregtech/sounds/mixer.ogg new file mode 100644 index 00000000000..d07cba46d9a Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/mixer.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/mortar.ogg b/src/main/resources/assets/gregtech/sounds/mortar.ogg new file mode 100644 index 00000000000..676fe3cb6f7 Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/mortar.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/motor.ogg b/src/main/resources/assets/gregtech/sounds/motor.ogg new file mode 100644 index 00000000000..7475cf2285c Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/motor.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/plunger.ogg b/src/main/resources/assets/gregtech/sounds/plunger.ogg new file mode 100644 index 00000000000..3c7fa034582 Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/plunger.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/pump.ogg b/src/main/resources/assets/gregtech/sounds/pump.ogg new file mode 100644 index 00000000000..222fa84fe03 Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/pump.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/replicator.ogg b/src/main/resources/assets/gregtech/sounds/replicator.ogg new file mode 100644 index 00000000000..743b7555704 Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/replicator.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/saw.ogg b/src/main/resources/assets/gregtech/sounds/saw.ogg new file mode 100644 index 00000000000..1e6a3cb9981 Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/saw.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/science.ogg b/src/main/resources/assets/gregtech/sounds/science.ogg new file mode 100644 index 00000000000..c76cbde73c3 Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/science.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/screwdriver.ogg b/src/main/resources/assets/gregtech/sounds/screwdriver.ogg new file mode 100644 index 00000000000..4ff4ca95b21 Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/screwdriver.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/soft_hammer.ogg b/src/main/resources/assets/gregtech/sounds/soft_hammer.ogg new file mode 100644 index 00000000000..b9d0289d4f5 Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/soft_hammer.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/spray_can.ogg b/src/main/resources/assets/gregtech/sounds/spray_can.ogg new file mode 100644 index 00000000000..2cf51921175 Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/spray_can.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/sus.ogg b/src/main/resources/assets/gregtech/sounds/sus.ogg new file mode 100644 index 00000000000..3666e01529d Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/sus.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/tricorder.ogg b/src/main/resources/assets/gregtech/sounds/tricorder.ogg new file mode 100644 index 00000000000..4dd2d87a76f Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/tricorder.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/turbine.ogg b/src/main/resources/assets/gregtech/sounds/turbine.ogg new file mode 100644 index 00000000000..d7c2dc2b446 Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/turbine.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/wirecutter.ogg b/src/main/resources/assets/gregtech/sounds/wirecutter.ogg new file mode 100644 index 00000000000..033d0302431 Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/wirecutter.ogg differ diff --git a/src/main/resources/assets/gregtech/sounds/wrench.ogg b/src/main/resources/assets/gregtech/sounds/wrench.ogg new file mode 100644 index 00000000000..31a7b4a7eaa Binary files /dev/null and b/src/main/resources/assets/gregtech/sounds/wrench.ogg differ diff --git a/src/main/resources/assets/gregtech/textures/items/metaitems/record.sus.png b/src/main/resources/assets/gregtech/textures/items/metaitems/record.sus.png new file mode 100644 index 00000000000..c37f248b139 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/items/metaitems/record.sus.png differ