forked from Slimefun/Slimefun4
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refs/heads/walshy/mc-1.21' into walshy/mc-1.21-itemstac…
…ks-of # Conflicts: # pom.xml # src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ExplosiveTool.java
- Loading branch information
Showing
18 changed files
with
253 additions
and
50 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
default: help | ||
|
||
.PHONY: help | ||
help: | ||
@echo " * gen-biomes version=<version> - Generate biomes for the given version" | ||
|
||
.PHONY: gen-biomes | ||
gen-biomes: | ||
@echo "Generating biomes for $(version)" | ||
@curl "https://raw.githubusercontent.com/MockBukkit/MockBukkit/refs/heads/v$(version)/src/main/resources/keyed/worldgen/biome.json" -s \ | ||
| jq '[ .values[].key]' \ | ||
> "src/test/resources/biomes/$(version).x.json" |
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
before_install: | ||
- sdk install java 17.0.1-open | ||
- sdk use java 17.0.1-open | ||
- sdk install java 21.0.2-open | ||
- sdk use java 21.0.2-open | ||
- sdk install maven | ||
|
||
jdk: | ||
- openjdk17 | ||
- openjdk21 |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,4 +118,4 @@ public String toJSON() { | |
return new GsonBuilder().create().toJson(data); | ||
} | ||
|
||
} | ||
} |
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
59 changes: 59 additions & 0 deletions
59
src/test/java/io/github/thebusybiscuit/slimefun4/test/mocks/InventoryViewWrapper.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,59 @@ | ||
package io.github.thebusybiscuit.slimefun4.test.mocks; | ||
|
||
import be.seeseemelk.mockbukkit.inventory.InventoryViewMock; | ||
import org.bukkit.entity.HumanEntity; | ||
import org.bukkit.event.inventory.InventoryType; | ||
import org.bukkit.inventory.Inventory; | ||
import org.bukkit.inventory.InventoryView; | ||
import org.bukkit.inventory.ItemStack; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
|
||
/** | ||
* Temporary class which implements {@link #getItem(int)} and {@link #setItem(int, ItemStack)} | ||
* provided {@link #getInventory(int)} and {@link #convertSlot(int)} are implemented by the backing | ||
* {@link InventoryView} | ||
* <p> | ||
* This class should be replaced by MockBukkit when <a href="https://github.com/MockBukkit/MockBukkit/pull/1011">this pr</a> | ||
* is merged. | ||
* <br> | ||
* Code is taken directly from CraftBukkit <a href="https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/inventory/CraftAbstractInventoryView.java">here</a>. | ||
* | ||
* @author md5sha256 | ||
*/ | ||
public class InventoryViewWrapper extends InventoryViewMock { | ||
|
||
private InventoryViewWrapper(HumanEntity player, | ||
String name, | ||
Inventory top, | ||
Inventory bottom, | ||
InventoryType type) { | ||
super(player, name, top, bottom, type); | ||
} | ||
|
||
@Nonnull | ||
public static InventoryViewWrapper wrap(@Nonnull InventoryView inventoryView) { | ||
HumanEntity player = inventoryView.getPlayer(); | ||
String name = inventoryView.getTitle(); | ||
Inventory top = inventoryView.getTopInventory(); | ||
Inventory bottom = inventoryView.getBottomInventory(); | ||
InventoryType inventoryType = inventoryView.getType(); | ||
return new InventoryViewWrapper(player, name, top, bottom, inventoryType); | ||
} | ||
|
||
@Override | ||
@Nullable | ||
public ItemStack getItem(int slot) { | ||
Inventory inventory = getInventory(slot); | ||
return (inventory == null) ? null : inventory.getItem(convertSlot(slot)); | ||
} | ||
|
||
@Override | ||
public void setItem(int slot, @Nullable ItemStack item) { | ||
Inventory inventory = getInventory(slot); | ||
if (inventory != null) { | ||
inventory.setItem(convertSlot(slot), item); | ||
} | ||
} | ||
} |
Oops, something went wrong.