Skip to content

Commit

Permalink
Add the ability for custom records to have finer control over there s…
Browse files Browse the repository at this point in the history
…ound resource location. Closes #933
  • Loading branch information
LexManos committed Jan 25, 2014
1 parent 796b53f commit c620617
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
35 changes: 35 additions & 0 deletions patches/minecraft/net/minecraft/item/ItemRecord.java.patch
Original file line number Diff line number Diff line change
@@ -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);
+ }
}

0 comments on commit c620617

Please sign in to comment.