Skip to content

Instantly share code, notes, and snippets.

@FeepingCreature
Created July 3, 2012 09:53
Show Gist options
  • Save FeepingCreature/3038800 to your computer and use it in GitHub Desktop.
Save FeepingCreature/3038800 to your computer and use it in GitHub Desktop.
+ public int getSelectedSlotId()
+ {
+ if (!mod_ComputerCraft.isMultiplayerClient()) {
+ synchronized (this.m_inventory) {
+ ItemStack itemstack = this.m_inventory[this.m_state.selectedSlot];
+ if (itemstack == null) return -1;
+ return itemstack.id;
+ }
+ }
+
+ throw new UnsupportedOperationException();
+ }
+
/* */ public int getSelectedSlot()
/* */ {
/* 293 */ if (!mod_ComputerCraft.isMultiplayerClient()) {
@@ -753,7 +766,19 @@
/* */
/* 854 */ return false;
/* */ }
-/* */
+/* */
+ private boolean compare(int i)
+ {
+ int j = this.x + net.minecraft.server.Facing.b[i];
+ int k = this.y + net.minecraft.server.Facing.c[i];
+ int l = this.z + net.minecraft.server.facing.d[i];
+
+ if (!isBlockInWorld(k)) return false;
+
+ int id = getSelectedSlotId();
+ return id == this.world.getTypeId(j, k, l).id;
+ }
+
/* */ private void dropStack(ItemStack itemstack, int i) {
/* 858 */ double d = this.x + 0.5D;
/* 859 */ double d1 = this.y + 0.5D;
@@ -966,6 +991,16 @@
/* 1102 */ break;
/* */ case 25:
/* 1105 */ flag = detect(0);
+ break;
+ case 26:
+ flag = compare(this.m_clientState.dir);
+ break;
+ case 27:
+ flag = compare(1);
+ break;
+ case 28:
+ flag = compare(0);
+ break;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment