-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add item_pre_grindstone, item_pre_smithing; partial fix modify_event …
…for item_pre_craft (#1386)
- Loading branch information
Showing
10 changed files
with
390 additions
and
26 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
src/main/java/com/laytonsmith/abstraction/MCGrindstoneInventory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.laytonsmith.abstraction; | ||
|
||
public interface MCGrindstoneInventory extends MCInventory { | ||
MCItemStack getUpperItem(); | ||
MCItemStack getLowerItem(); | ||
MCItemStack getResult(); | ||
|
||
void setUpperItem(MCItemStack i); | ||
void setLowerItem(MCItemStack i); | ||
void setResult(MCItemStack i); | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/laytonsmith/abstraction/MCSmithingInventory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.laytonsmith.abstraction; | ||
|
||
public interface MCSmithingInventory extends MCInventory { | ||
MCItemStack getInputEquipment(); | ||
MCItemStack getInputMaterial(); | ||
MCItemStack getInputTemplate(); | ||
MCRecipe getRecipe(); | ||
MCItemStack getResult(); | ||
|
||
void setInputEquipment(MCItemStack stack); | ||
void setInputMaterial(MCItemStack stack); | ||
void setInputTemplate(MCItemStack stack); | ||
void setResult(MCItemStack stack); | ||
} |
45 changes: 45 additions & 0 deletions
45
src/main/java/com/laytonsmith/abstraction/bukkit/BukkitMCGrindstoneInventory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.laytonsmith.abstraction.bukkit; | ||
|
||
import com.laytonsmith.abstraction.MCGrindstoneInventory; | ||
import com.laytonsmith.abstraction.MCItemStack; | ||
import org.bukkit.inventory.GrindstoneInventory; | ||
|
||
public class BukkitMCGrindstoneInventory extends BukkitMCInventory implements MCGrindstoneInventory { | ||
|
||
GrindstoneInventory gi; | ||
|
||
public BukkitMCGrindstoneInventory(GrindstoneInventory inventory) { | ||
super(inventory); | ||
gi = inventory; | ||
} | ||
|
||
@Override | ||
public MCItemStack getUpperItem() { | ||
return new BukkitMCItemStack(gi.getItem(0)); | ||
} | ||
|
||
@Override | ||
public MCItemStack getLowerItem() { | ||
return new BukkitMCItemStack(gi.getItem(1)); | ||
} | ||
|
||
@Override | ||
public MCItemStack getResult() { | ||
return new BukkitMCItemStack(gi.getItem(2)); | ||
} | ||
|
||
@Override | ||
public void setUpperItem(MCItemStack stack) { | ||
gi.setItem(0, ((BukkitMCItemStack) stack).asItemStack()); | ||
} | ||
|
||
@Override | ||
public void setLowerItem(MCItemStack stack) { | ||
gi.setItem(1, ((BukkitMCItemStack) stack).asItemStack()); | ||
} | ||
|
||
@Override | ||
public void setResult(MCItemStack stack) { | ||
gi.setItem(2, ((BukkitMCItemStack) stack).asItemStack()); | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
src/main/java/com/laytonsmith/abstraction/bukkit/BukkitMCSmithingInventory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package com.laytonsmith.abstraction.bukkit; | ||
|
||
import com.laytonsmith.abstraction.MCItemStack; | ||
import com.laytonsmith.abstraction.MCRecipe; | ||
import com.laytonsmith.abstraction.MCSmithingInventory; | ||
import org.bukkit.inventory.SmithingInventory; | ||
import org.bukkit.inventory.SmithingRecipe; | ||
|
||
public class BukkitMCSmithingInventory extends BukkitMCInventory implements MCSmithingInventory { | ||
|
||
SmithingInventory si; | ||
|
||
public BukkitMCSmithingInventory(SmithingInventory inventory) { | ||
super(inventory); | ||
si = inventory; | ||
} | ||
|
||
@Override | ||
public MCItemStack getInputEquipment() { | ||
return new BukkitMCItemStack(si.getItem(1)); | ||
} | ||
|
||
@Override | ||
public MCItemStack getInputMaterial() { | ||
return new BukkitMCItemStack(si.getItem(2)); | ||
} | ||
|
||
@Override | ||
public MCItemStack getInputTemplate() { | ||
return new BukkitMCItemStack(si.getItem(0)); | ||
} | ||
|
||
@Override | ||
public MCRecipe getRecipe() { | ||
if(si.getRecipe() == null) { | ||
return null; | ||
} else { | ||
return new BukkitMCSmithingRecipe((SmithingRecipe) si.getRecipe()); | ||
} | ||
} | ||
|
||
@Override | ||
public MCItemStack getResult() { | ||
return new BukkitMCItemStack(si.getResult()); | ||
} | ||
|
||
@Override | ||
public void setInputEquipment(MCItemStack stack) { | ||
si.setItem(1, ((BukkitMCItemStack) stack).asItemStack()); | ||
} | ||
|
||
@Override | ||
public void setInputMaterial(MCItemStack stack) { | ||
si.setItem(2, ((BukkitMCItemStack) stack).asItemStack()); | ||
} | ||
|
||
@Override | ||
public void setInputTemplate(MCItemStack stack) { | ||
si.setItem(0, ((BukkitMCItemStack) stack).asItemStack()); | ||
} | ||
|
||
@Override | ||
public void setResult(MCItemStack stack) { | ||
si.setResult(((BukkitMCItemStack) stack).asItemStack()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/main/java/com/laytonsmith/abstraction/events/MCPrepareGrindstoneEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.laytonsmith.abstraction.events; | ||
|
||
import com.laytonsmith.abstraction.MCItemStack; | ||
import com.laytonsmith.abstraction.MCPlayer; | ||
|
||
public interface MCPrepareGrindstoneEvent extends MCInventoryEvent { | ||
MCPlayer getPlayer(); | ||
|
||
void setResult(MCItemStack stack); | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/laytonsmith/abstraction/events/MCPrepareSmithingEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.laytonsmith.abstraction.events; | ||
|
||
import com.laytonsmith.abstraction.MCItemStack; | ||
import com.laytonsmith.abstraction.MCPlayer; | ||
|
||
public interface MCPrepareSmithingEvent extends MCInventoryEvent { | ||
MCPlayer getPlayer(); | ||
|
||
void setResult(MCItemStack stack); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.