Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9ef9b7c
commit b78c8d8
Showing
10 changed files
with
180 additions
and
2 deletions.
There are no files selected for viewing
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
32 changes: 32 additions & 0 deletions
32
common/src/main/java/com/blamejared/clumps/api/events/IRepairEvent.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,32 @@ | ||
package com.blamejared.clumps.api.events; | ||
|
||
import net.minecraft.world.entity.player.Player; | ||
|
||
/** | ||
* Fired before an item is repaired, allowing other mods to repair items before the vanilla inventory is repaired. | ||
* If a repair is performed, then any leftover experience should be set back to this event using {@link #setValue(int)} | ||
*/ | ||
public interface IRepairEvent { | ||
|
||
/** | ||
* Sets the amount of experience left after repairing. | ||
* | ||
* @param value The new value to set. | ||
*/ | ||
void setValue(int value); | ||
|
||
/** | ||
* Gets the amount of experience to be used by the repair. | ||
* | ||
* @return The amount of experience to be used by the repair. | ||
*/ | ||
int getValue(); | ||
|
||
/** | ||
* Gets the player whose items are being repaired. | ||
* | ||
* @return The player whose items are being repaired. | ||
*/ | ||
Player getPlayer(); | ||
|
||
} |
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
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
52 changes: 52 additions & 0 deletions
52
fabric/src/main/java/com/blamejared/clumps/api/events/RepairEvent.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,52 @@ | ||
package com.blamejared.clumps.api.events; | ||
|
||
import net.minecraft.world.entity.player.Player; | ||
|
||
/** | ||
* Fired before an item is repaired, if a repair is performed, then any leftover experience should be set back to this event. | ||
*/ | ||
public class RepairEvent implements IValueEvent { | ||
|
||
private final Player player; | ||
private int value; | ||
|
||
public RepairEvent(Player player, int value) { | ||
|
||
this.player = player; | ||
this.value = value; | ||
} | ||
|
||
/** | ||
* Sets the amount of experience left after repairing. | ||
* | ||
* @param value The new value to set. | ||
*/ | ||
@Override | ||
public void setValue(int value) { | ||
|
||
this.value = value; | ||
} | ||
|
||
/** | ||
* Gets the amount of experience to be used by the repair. | ||
* | ||
* @return The amount of experience to be used by the repair. | ||
*/ | ||
@Override | ||
public int getValue() { | ||
|
||
return this.value; | ||
} | ||
|
||
/** | ||
* Gets the player whose items are being repaired. | ||
* | ||
* @return The player whose items are being repaired. | ||
*/ | ||
@Override | ||
public Player getPlayer() { | ||
|
||
return this.player; | ||
} | ||
|
||
} |
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
53 changes: 53 additions & 0 deletions
53
forge/src/main/java/com/blamejared/clumps/api/events/RepairEvent.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,53 @@ | ||
package com.blamejared.clumps.api.events; | ||
|
||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraftforge.eventbus.api.Event; | ||
|
||
/** | ||
* Fired before an item is repaired, if a repair is performed, then any leftover experience should be set back to this event. | ||
*/ | ||
public class RepairEvent extends Event implements IRepairEvent { | ||
|
||
private final Player player; | ||
private int value; | ||
|
||
public RepairEvent(Player player, int value) { | ||
|
||
this.player = player; | ||
this.value = value; | ||
} | ||
|
||
/** | ||
* Sets the amount of experience left after repairing. | ||
* | ||
* @param value The new value to set. | ||
*/ | ||
@Override | ||
public void setValue(int value) { | ||
|
||
this.value = value; | ||
} | ||
|
||
/** | ||
* Gets the amount of experience to be used by the repair. | ||
* | ||
* @return The amount of experience to be used by the repair. | ||
*/ | ||
@Override | ||
public int getValue() { | ||
|
||
return this.value; | ||
} | ||
|
||
/** | ||
* Gets the player whose items are being repaired. | ||
* | ||
* @return The player whose items are being repaired. | ||
*/ | ||
@Override | ||
public Player getPlayer() { | ||
|
||
return this.player; | ||
} | ||
|
||
} |
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