From c62061728b21934ceb4375473e68d0e037966ac4 Mon Sep 17 00:00:00 2001 From: Lex Manos Date: Fri, 24 Jan 2014 17:16:35 -0800 Subject: [PATCH] Add the ability for custom records to have finer control over there sound resource location. Closes #933 --- .../client/renderer/RenderGlobal.java.patch | 17 +++++++++ .../net/minecraft/item/ItemRecord.java.patch | 35 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 patches/minecraft/net/minecraft/item/ItemRecord.java.patch diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch index 12802144c..44ea3ce0d 100644 --- a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch @@ -111,3 +111,20 @@ double d0 = par2EntityPlayer.lastTickPosX + (par2EntityPlayer.posX - par2EntityPlayer.lastTickPosX) * (double)par3; double d1 = par2EntityPlayer.lastTickPosY + (par2EntityPlayer.posY - par2EntityPlayer.lastTickPosY) * (double)par3; double d2 = par2EntityPlayer.lastTickPosZ + (par2EntityPlayer.posZ - par2EntityPlayer.lastTickPosZ) * (double)par3; +@@ -1839,12 +1873,15 @@ + { + ItemRecord itemrecord = ItemRecord.func_150926_b(par1Str); + ++ ResourceLocation resource = null; + if (itemrecord != null) + { + this.mc.ingameGUI.setRecordPlayingMessage(itemrecord.func_150927_i()); ++ resource = itemrecord.getRecordResource(par1Str); + } + +- PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.func_147675_a(new ResourceLocation(par1Str), (float)par2, (float)par3, (float)par4); ++ if (resource == null) resource = new ResourceLocation(par1Str); ++ PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.func_147675_a(resource, (float)par2, (float)par3, (float)par4); + this.field_147593_P.put(chunkcoordinates, positionedsoundrecord); + this.mc.func_147118_V().func_147682_a(positionedsoundrecord); + } diff --git a/patches/minecraft/net/minecraft/item/ItemRecord.java.patch b/patches/minecraft/net/minecraft/item/ItemRecord.java.patch new file mode 100644 index 000000000..3eefbbb5c --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemRecord.java.patch @@ -0,0 +1,35 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemRecord.java ++++ ../src-work/minecraft/net/minecraft/item/ItemRecord.java +@@ -10,6 +10,7 @@ + import net.minecraft.entity.player.EntityPlayer; + import net.minecraft.init.Blocks; + import net.minecraft.util.IIcon; ++import net.minecraft.util.ResourceLocation; + import net.minecraft.util.StatCollector; + import net.minecraft.world.World; + +@@ -24,7 +25,7 @@ + this.field_150929_a = p_i45350_1_; + this.maxStackSize = 1; + this.setCreativeTab(CreativeTabs.tabMisc); +- field_150928_b.put(p_i45350_1_, this); ++ field_150928_b.put("records." + p_i45350_1_, this); //Forge Bug Fix: RenderGlobal adds a "records." when looking up below. + } + + // JAVADOC METHOD $$ func_77617_a +@@ -81,4 +82,15 @@ + { + return (ItemRecord)field_150928_b.get(p_150926_0_); + } ++ ++ /** ++ * Retrieves the resource location of the sound to play for this record. ++ * ++ * @param name The name of the record to play ++ * @return The resource location for the audio, null to use default. ++ */ ++ public ResourceLocation getRecordResource(String name) ++ { ++ return new ResourceLocation(name); ++ } + }