v1.6.0
This commit is contained in:
1 parent
dfb2c94073
commit
7015a527fd
43 files changed
+1353
-14
No files matched your search
@@ -43,3 +43,5 @@ repo/
|
|||||||
reasonix.toml
|
reasonix.toml
|
||||||
null
|
null
|
||||||
work
|
work
|
||||||
|
scripts
|
||||||
|
export
|
||||||
@@ -0,0 +1,618 @@
|
|||||||
|
package net.minecraft.world.entity.player;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
import net.minecraft.CrashReport;
|
||||||
|
import net.minecraft.CrashReportCategory;
|
||||||
|
import net.minecraft.ReportedException;
|
||||||
|
import net.minecraft.core.NonNullList;
|
||||||
|
import net.minecraft.core.component.DataComponents;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.nbt.ListTag;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket;
|
||||||
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
import net.minecraft.tags.TagKey;
|
||||||
|
import net.minecraft.world.Container;
|
||||||
|
import net.minecraft.world.ContainerHelper;
|
||||||
|
import net.minecraft.world.Nameable;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
|
||||||
|
public class Inventory implements Container, Nameable {
|
||||||
|
public static final int POP_TIME_DURATION = 5;
|
||||||
|
public static final int INVENTORY_SIZE = 36;
|
||||||
|
private static final int SELECTION_SIZE = 9;
|
||||||
|
public static final int SLOT_OFFHAND = 40;
|
||||||
|
public static final int NOT_FOUND_INDEX = -1;
|
||||||
|
public static final int[] ALL_ARMOR_SLOTS = new int[]{0, 1, 2, 3};
|
||||||
|
public static final int[] HELMET_SLOT_ONLY = new int[]{3};
|
||||||
|
public final NonNullList<ItemStack> items = NonNullList.withSize(36, ItemStack.EMPTY);
|
||||||
|
public final NonNullList<ItemStack> armor = NonNullList.withSize(4, ItemStack.EMPTY);
|
||||||
|
public final NonNullList<ItemStack> offhand = NonNullList.withSize(1, ItemStack.EMPTY);
|
||||||
|
private final List<NonNullList<ItemStack>> compartments = ImmutableList.of(this.items, this.armor, this.offhand);
|
||||||
|
public int selected;
|
||||||
|
public final Player player;
|
||||||
|
private int timesChanged;
|
||||||
|
|
||||||
|
public Inventory(Player player) {
|
||||||
|
this.player = player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack getSelected() {
|
||||||
|
return isHotbarSlot(this.selected) ? this.items.get(this.selected) : ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getSelectionSize() {
|
||||||
|
return 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean hasRemainingSpaceForItem(ItemStack destination, ItemStack origin) {
|
||||||
|
return !destination.isEmpty()
|
||||||
|
&& ItemStack.isSameItemSameComponents(destination, origin)
|
||||||
|
&& destination.isStackable()
|
||||||
|
&& destination.getCount() < this.getMaxStackSize(destination);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getFreeSlot() {
|
||||||
|
for (int i = 0; i < this.items.size(); i++) {
|
||||||
|
if (this.items.get(i).isEmpty()) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPickedItem(ItemStack stack) {
|
||||||
|
int i = this.findSlotMatchingItem(stack);
|
||||||
|
if (isHotbarSlot(i)) {
|
||||||
|
this.selected = i;
|
||||||
|
} else {
|
||||||
|
if (i == -1) {
|
||||||
|
this.selected = this.getSuitableHotbarSlot();
|
||||||
|
if (!this.items.get(this.selected).isEmpty()) {
|
||||||
|
int j = this.getFreeSlot();
|
||||||
|
if (j != -1) {
|
||||||
|
this.items.set(j, this.items.get(this.selected));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.items.set(this.selected, stack);
|
||||||
|
} else {
|
||||||
|
this.pickSlot(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void pickSlot(int index) {
|
||||||
|
this.selected = this.getSuitableHotbarSlot();
|
||||||
|
ItemStack itemstack = this.items.get(this.selected);
|
||||||
|
this.items.set(this.selected, this.items.get(index));
|
||||||
|
this.items.set(index, itemstack);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isHotbarSlot(int index) {
|
||||||
|
return index >= 0 && index < 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the stack or an equivalent one in the main inventory
|
||||||
|
*/
|
||||||
|
public int findSlotMatchingItem(ItemStack stack) {
|
||||||
|
for (int i = 0; i < this.items.size(); i++) {
|
||||||
|
if (!this.items.get(i).isEmpty() && ItemStack.isSameItemSameComponents(stack, this.items.get(i))) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int findSlotMatchingUnusedItem(ItemStack stack) {
|
||||||
|
for (int i = 0; i < this.items.size(); i++) {
|
||||||
|
ItemStack itemstack = this.items.get(i);
|
||||||
|
if (!itemstack.isEmpty()
|
||||||
|
&& ItemStack.isSameItemSameComponents(stack, itemstack)
|
||||||
|
&& !itemstack.isDamaged()
|
||||||
|
&& !itemstack.isEnchanted()
|
||||||
|
&& !itemstack.has(DataComponents.CUSTOM_NAME)) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSuitableHotbarSlot() {
|
||||||
|
for (int i = 0; i < 9; i++) {
|
||||||
|
int j = (this.selected + i) % 9;
|
||||||
|
if (this.items.get(j).isEmpty()) {
|
||||||
|
return j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int k = 0; k < 9; k++) {
|
||||||
|
int l = (this.selected + k) % 9;
|
||||||
|
if (!this.items.get(l).isNotReplaceableByPickAction(this.player, l)) {
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change the selected item in the hotbar after a mouse scroll. Select the slot to the left if {@code direction} is positive, or to the right if negative.
|
||||||
|
*/
|
||||||
|
public void swapPaint(double direction) {
|
||||||
|
int i = (int)Math.signum(direction);
|
||||||
|
this.selected -= i;
|
||||||
|
|
||||||
|
while (this.selected < 0) {
|
||||||
|
this.selected += 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (this.selected >= 9) {
|
||||||
|
this.selected -= 9;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int clearOrCountMatchingItems(Predicate<ItemStack> stackPredicate, int maxCount, Container inventory) {
|
||||||
|
int i = 0;
|
||||||
|
boolean flag = maxCount == 0;
|
||||||
|
i += ContainerHelper.clearOrCountMatchingItems(this, stackPredicate, maxCount - i, flag);
|
||||||
|
i += ContainerHelper.clearOrCountMatchingItems(inventory, stackPredicate, maxCount - i, flag);
|
||||||
|
ItemStack itemstack = this.player.containerMenu.getCarried();
|
||||||
|
i += ContainerHelper.clearOrCountMatchingItems(itemstack, stackPredicate, maxCount - i, flag);
|
||||||
|
if (itemstack.isEmpty()) {
|
||||||
|
this.player.containerMenu.setCarried(ItemStack.EMPTY);
|
||||||
|
}
|
||||||
|
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function stores as many items of an ItemStack as possible in a matching slot and returns the quantity of left over items.
|
||||||
|
*/
|
||||||
|
private int addResource(ItemStack stack) {
|
||||||
|
int i = this.getSlotWithRemainingSpace(stack);
|
||||||
|
if (i == -1) {
|
||||||
|
i = this.getFreeSlot();
|
||||||
|
}
|
||||||
|
|
||||||
|
return i == -1 ? stack.getCount() : this.addResource(i, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int addResource(int slot, ItemStack stack) {
|
||||||
|
int i = stack.getCount();
|
||||||
|
ItemStack itemstack = this.getItem(slot);
|
||||||
|
if (itemstack.isEmpty()) {
|
||||||
|
itemstack = stack.copyWithCount(0);
|
||||||
|
this.setItem(slot, itemstack);
|
||||||
|
}
|
||||||
|
|
||||||
|
int j = this.getMaxStackSize(itemstack) - itemstack.getCount();
|
||||||
|
int k = Math.min(i, j);
|
||||||
|
if (k == 0) {
|
||||||
|
return i;
|
||||||
|
} else {
|
||||||
|
i -= k;
|
||||||
|
itemstack.grow(k);
|
||||||
|
itemstack.setPopTime(5);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores a stack in the player's inventory. It first tries to place it in the selected slot in the player's hotbar, then the offhand slot, then any available/empty slot in the player's inventory.
|
||||||
|
*/
|
||||||
|
public int getSlotWithRemainingSpace(ItemStack stack) {
|
||||||
|
if (this.hasRemainingSpaceForItem(this.getItem(this.selected), stack)) {
|
||||||
|
return this.selected;
|
||||||
|
} else if (this.hasRemainingSpaceForItem(this.getItem(40), stack)) {
|
||||||
|
return 40;
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < this.items.size(); i++) {
|
||||||
|
if (this.hasRemainingSpaceForItem(this.items.get(i), stack)) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void tick() {
|
||||||
|
int slot = 0;
|
||||||
|
for (NonNullList<ItemStack> nonnulllist : this.compartments) {
|
||||||
|
for (int i = 0; i < nonnulllist.size(); i++) {
|
||||||
|
if (!nonnulllist.get(i).isEmpty()) {
|
||||||
|
// Neo: Fix the slot param to be the global index instead of the per-compartment index.
|
||||||
|
// Neo: Fix the selected param to only be true for hotbar slots.
|
||||||
|
nonnulllist.get(i).inventoryTick(this.player.level(), this.player, slot, this.selected == slot);
|
||||||
|
}
|
||||||
|
slot++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the stack to the first empty slot in the player's inventory. Returns {@code false} if it's not possible to place the entire stack in the inventory.
|
||||||
|
*/
|
||||||
|
public boolean add(ItemStack stack) {
|
||||||
|
return this.add(-1, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the stack to the specified slot in the player's inventory. Returns {@code false} if it's not possible to place the entire stack in the inventory.
|
||||||
|
*/
|
||||||
|
public boolean add(int slot, ItemStack stack) {
|
||||||
|
if (stack.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
if (stack.isDamaged()) {
|
||||||
|
if (slot == -1) {
|
||||||
|
slot = this.getFreeSlot();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (slot >= 0) {
|
||||||
|
this.items.set(slot, stack.copyAndClear());
|
||||||
|
this.items.get(slot).setPopTime(5);
|
||||||
|
return true;
|
||||||
|
} else if (this.player.hasInfiniteMaterials()) {
|
||||||
|
stack.setCount(0);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
int i;
|
||||||
|
do {
|
||||||
|
i = stack.getCount();
|
||||||
|
if (slot == -1) {
|
||||||
|
stack.setCount(this.addResource(stack));
|
||||||
|
} else {
|
||||||
|
stack.setCount(this.addResource(slot, stack));
|
||||||
|
}
|
||||||
|
} while (!stack.isEmpty() && stack.getCount() < i);
|
||||||
|
|
||||||
|
if (stack.getCount() == i && this.player.hasInfiniteMaterials()) {
|
||||||
|
stack.setCount(0);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return stack.getCount() < i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Throwable throwable) {
|
||||||
|
CrashReport crashreport = CrashReport.forThrowable(throwable, "Adding item to inventory");
|
||||||
|
CrashReportCategory crashreportcategory = crashreport.addCategory("Item being added");
|
||||||
|
crashreportcategory.setDetail("Registry Name", () -> String.valueOf(net.minecraft.core.registries.BuiltInRegistries.ITEM.getKey(stack.getItem())));
|
||||||
|
crashreportcategory.setDetail("Item Class", () -> stack.getItem().getClass().getName());
|
||||||
|
crashreportcategory.setDetail("Item ID", Item.getId(stack.getItem()));
|
||||||
|
crashreportcategory.setDetail("Item data", stack.getDamageValue());
|
||||||
|
crashreportcategory.setDetail("Item name", () -> stack.getHoverName().getString());
|
||||||
|
throw new ReportedException(crashreport);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void placeItemBackInInventory(ItemStack stack) {
|
||||||
|
this.placeItemBackInInventory(stack, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void placeItemBackInInventory(ItemStack stack, boolean sendPacket) {
|
||||||
|
while (!stack.isEmpty()) {
|
||||||
|
int i = this.getSlotWithRemainingSpace(stack);
|
||||||
|
if (i == -1) {
|
||||||
|
i = this.getFreeSlot();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == -1) {
|
||||||
|
this.player.drop(stack, false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
int j = stack.getMaxStackSize() - this.getItem(i).getCount();
|
||||||
|
if (this.add(i, stack.split(j)) && sendPacket && this.player instanceof ServerPlayer) {
|
||||||
|
((ServerPlayer)this.player).connection.send(new ClientboundContainerSetSlotPacket(-2, 0, i, this.getItem(i)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes up to a specified number of items from an inventory slot and returns them in a new stack.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ItemStack removeItem(int index, int count) {
|
||||||
|
List<ItemStack> list = null;
|
||||||
|
|
||||||
|
for (NonNullList<ItemStack> nonnulllist : this.compartments) {
|
||||||
|
if (index < nonnulllist.size()) {
|
||||||
|
list = nonnulllist;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
index -= nonnulllist.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
return list != null && !list.get(index).isEmpty() ? ContainerHelper.removeItem(list, index, count) : ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeItem(ItemStack stack) {
|
||||||
|
for (NonNullList<ItemStack> nonnulllist : this.compartments) {
|
||||||
|
for (int i = 0; i < nonnulllist.size(); i++) {
|
||||||
|
if (nonnulllist.get(i) == stack) {
|
||||||
|
nonnulllist.set(i, ItemStack.EMPTY);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes a stack from the given slot and returns it.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ItemStack removeItemNoUpdate(int index) {
|
||||||
|
NonNullList<ItemStack> nonnulllist = null;
|
||||||
|
|
||||||
|
for (NonNullList<ItemStack> nonnulllist1 : this.compartments) {
|
||||||
|
if (index < nonnulllist1.size()) {
|
||||||
|
nonnulllist = nonnulllist1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
index -= nonnulllist1.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nonnulllist != null && !nonnulllist.get(index).isEmpty()) {
|
||||||
|
ItemStack itemstack = nonnulllist.get(index);
|
||||||
|
nonnulllist.set(index, ItemStack.EMPTY);
|
||||||
|
return itemstack;
|
||||||
|
} else {
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void setItem(int index, ItemStack stack) {
|
||||||
|
NonNullList<ItemStack> nonnulllist = null;
|
||||||
|
|
||||||
|
for (NonNullList<ItemStack> nonnulllist1 : this.compartments) {
|
||||||
|
if (index < nonnulllist1.size()) {
|
||||||
|
nonnulllist = nonnulllist1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
index -= nonnulllist1.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nonnulllist != null) {
|
||||||
|
nonnulllist.set(index, stack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getDestroySpeed(BlockState state) {
|
||||||
|
return this.items.get(this.selected).getDestroySpeed(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes the inventory out as a list of compound tags. This is where the slot indices are used (+100 for armor, +80 for crafting).
|
||||||
|
*/
|
||||||
|
public ListTag save(ListTag listTag) {
|
||||||
|
for (int i = 0; i < this.items.size(); i++) {
|
||||||
|
if (!this.items.get(i).isEmpty()) {
|
||||||
|
CompoundTag compoundtag = new CompoundTag();
|
||||||
|
compoundtag.putByte("Slot", (byte)i);
|
||||||
|
listTag.add(this.items.get(i).save(this.player.registryAccess(), compoundtag));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int j = 0; j < this.armor.size(); j++) {
|
||||||
|
if (!this.armor.get(j).isEmpty()) {
|
||||||
|
CompoundTag compoundtag1 = new CompoundTag();
|
||||||
|
compoundtag1.putByte("Slot", (byte)(j + 100));
|
||||||
|
listTag.add(this.armor.get(j).save(this.player.registryAccess(), compoundtag1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int k = 0; k < this.offhand.size(); k++) {
|
||||||
|
if (!this.offhand.get(k).isEmpty()) {
|
||||||
|
CompoundTag compoundtag2 = new CompoundTag();
|
||||||
|
compoundtag2.putByte("Slot", (byte)(k + 150));
|
||||||
|
listTag.add(this.offhand.get(k).save(this.player.registryAccess(), compoundtag2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return listTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads from the given tag list and fills the slots in the inventory with the correct items.
|
||||||
|
*/
|
||||||
|
public void load(ListTag listTag) {
|
||||||
|
this.items.clear();
|
||||||
|
this.armor.clear();
|
||||||
|
this.offhand.clear();
|
||||||
|
|
||||||
|
for (int i = 0; i < listTag.size(); i++) {
|
||||||
|
CompoundTag compoundtag = listTag.getCompound(i);
|
||||||
|
int j = compoundtag.getByte("Slot") & 255;
|
||||||
|
ItemStack itemstack = ItemStack.parse(this.player.registryAccess(), compoundtag).orElse(ItemStack.EMPTY);
|
||||||
|
if (j >= 0 && j < this.items.size()) {
|
||||||
|
this.items.set(j, itemstack);
|
||||||
|
} else if (j >= 100 && j < this.armor.size() + 100) {
|
||||||
|
this.armor.set(j - 100, itemstack);
|
||||||
|
} else if (j >= 150 && j < this.offhand.size() + 150) {
|
||||||
|
this.offhand.set(j - 150, itemstack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getContainerSize() {
|
||||||
|
return this.items.size() + this.armor.size() + this.offhand.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEmpty() {
|
||||||
|
for (ItemStack itemstack : this.items) {
|
||||||
|
if (!itemstack.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ItemStack itemstack1 : this.armor) {
|
||||||
|
if (!itemstack1.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ItemStack itemstack2 : this.offhand) {
|
||||||
|
if (!itemstack2.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the stack in the given slot.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ItemStack getItem(int index) {
|
||||||
|
List<ItemStack> list = null;
|
||||||
|
|
||||||
|
for (NonNullList<ItemStack> nonnulllist : this.compartments) {
|
||||||
|
if (index < nonnulllist.size()) {
|
||||||
|
list = nonnulllist;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
index -= nonnulllist.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
return list == null ? ItemStack.EMPTY : list.get(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getName() {
|
||||||
|
return Component.translatable("container.inventory");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a player armor item (as an {@code ItemStack}) contained in specified armor slot
|
||||||
|
*/
|
||||||
|
public ItemStack getArmor(int slot) {
|
||||||
|
return this.armor.get(slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dropAll() {
|
||||||
|
for (List<ItemStack> list : this.compartments) {
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
ItemStack itemstack = list.get(i);
|
||||||
|
if (!itemstack.isEmpty()) {
|
||||||
|
this.player.drop(itemstack, true, false);
|
||||||
|
list.set(i, ItemStack.EMPTY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setChanged() {
|
||||||
|
this.timesChanged++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTimesChanged() {
|
||||||
|
return this.timesChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Don't rename this method to canInteractWith due to conflicts with Container
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean stillValid(Player player) {
|
||||||
|
return player.canInteractWithEntity(this.player, 4.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns {@code true} if the specified {@link net.minecraft.world.item.ItemStack} exists in the inventory.
|
||||||
|
*/
|
||||||
|
public boolean contains(ItemStack stack) {
|
||||||
|
for (List<ItemStack> list : this.compartments) {
|
||||||
|
for (ItemStack itemstack : list) {
|
||||||
|
if (!itemstack.isEmpty() && ItemStack.isSameItemSameComponents(itemstack, stack)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean contains(TagKey<Item> tag) {
|
||||||
|
for (List<ItemStack> list : this.compartments) {
|
||||||
|
for (ItemStack itemstack : list) {
|
||||||
|
if (!itemstack.isEmpty() && itemstack.is(tag)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean contains(Predicate<ItemStack> predicate) {
|
||||||
|
for (List<ItemStack> list : this.compartments) {
|
||||||
|
for (ItemStack itemstack : list) {
|
||||||
|
if (predicate.test(itemstack)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy the ItemStack contents from another InventoryPlayer instance
|
||||||
|
*/
|
||||||
|
public void replaceWith(Inventory playerInventory) {
|
||||||
|
for (int i = 0; i < this.getContainerSize(); i++) {
|
||||||
|
this.setItem(i, playerInventory.getItem(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.selected = playerInventory.selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clearContent() {
|
||||||
|
for (List<ItemStack> list : this.compartments) {
|
||||||
|
list.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fillStackedContents(StackedContents stackedContent) {
|
||||||
|
for (ItemStack itemstack : this.items) {
|
||||||
|
stackedContent.accountSimpleStack(itemstack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param removeStack Whether to remove the entire stack of items. If {@code false
|
||||||
|
* }, removes a single item.
|
||||||
|
*/
|
||||||
|
public ItemStack removeFromSelected(boolean removeStack) {
|
||||||
|
ItemStack itemstack = this.getSelected();
|
||||||
|
return itemstack.isEmpty() ? ItemStack.EMPTY : this.removeItem(this.selected, removeStack ? itemstack.getCount() : 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -43,6 +43,14 @@ public class ModSounds {
|
|||||||
SOUND_EVENTS.register("star_collide",
|
SOUND_EVENTS.register("star_collide",
|
||||||
() -> SoundEvent.createVariableRangeEvent(
|
() -> SoundEvent.createVariableRangeEvent(
|
||||||
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "star_collide")));
|
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "star_collide")));
|
||||||
|
public static final Supplier<SoundEvent> SUMMON_TERRAPRISMA =
|
||||||
|
SOUND_EVENTS.register("summon_terraprisma",
|
||||||
|
() -> SoundEvent.createVariableRangeEvent(
|
||||||
|
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "summon_terraprisma")));
|
||||||
|
public static final Supplier<SoundEvent> SHOT =
|
||||||
|
SOUND_EVENTS.register("shot",
|
||||||
|
() -> SoundEvent.createVariableRangeEvent(
|
||||||
|
ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, "shot")));
|
||||||
public static final Supplier<SoundEvent> BOOM =
|
public static final Supplier<SoundEvent> BOOM =
|
||||||
SOUND_EVENTS.register("boom",
|
SOUND_EVENTS.register("boom",
|
||||||
() -> SoundEvent.createVariableRangeEvent(
|
() -> SoundEvent.createVariableRangeEvent(
|
||||||
|
|||||||
+5
@@ -1,5 +1,6 @@
|
|||||||
package com.lzxnone.terraria.client.entity.summon;
|
package com.lzxnone.terraria.client.entity.summon;
|
||||||
|
|
||||||
|
import com.lzxnone.terraria.client.item.ammo.ClientBulletAmmo;
|
||||||
import com.lzxnone.terraria.client.item.magic.ClientLastPrism;
|
import com.lzxnone.terraria.client.item.magic.ClientLastPrism;
|
||||||
import com.lzxnone.terraria.client.item.melee.ClientDevilsDevastation;
|
import com.lzxnone.terraria.client.item.melee.ClientDevilsDevastation;
|
||||||
import com.lzxnone.terraria.client.item.melee.ClientFirstFractal;
|
import com.lzxnone.terraria.client.item.melee.ClientFirstFractal;
|
||||||
@@ -22,6 +23,7 @@ public class ClientStaticSummonRenderBehaviors {
|
|||||||
|
|
||||||
static {
|
static {
|
||||||
BEHAVIORS.put(StaticSummonBehaviors.DEFAULT, DEFAULT_BEHAVIOR);
|
BEHAVIORS.put(StaticSummonBehaviors.DEFAULT, DEFAULT_BEHAVIOR);
|
||||||
|
|
||||||
BEHAVIORS.put(StaticSummonBehaviors.SEEDLER_NUT, DEFAULT_BEHAVIOR);
|
BEHAVIORS.put(StaticSummonBehaviors.SEEDLER_NUT, DEFAULT_BEHAVIOR);
|
||||||
BEHAVIORS.put(StaticSummonBehaviors.THE_HORSEMANS_BLADE_JACK, DEFAULT_BEHAVIOR);
|
BEHAVIORS.put(StaticSummonBehaviors.THE_HORSEMANS_BLADE_JACK, DEFAULT_BEHAVIOR);
|
||||||
BEHAVIORS.put(StaticSummonBehaviors.INFLUX_WAVER_BEAM, DEFAULT_BEHAVIOR);
|
BEHAVIORS.put(StaticSummonBehaviors.INFLUX_WAVER_BEAM, DEFAULT_BEHAVIOR);
|
||||||
@@ -41,6 +43,9 @@ public class ClientStaticSummonRenderBehaviors {
|
|||||||
BEHAVIORS.put(StaticSummonBehaviors.LAST_PRISM_TRI, ClientLastPrism.SUMMON_BEHAVIOR);
|
BEHAVIORS.put(StaticSummonBehaviors.LAST_PRISM_TRI, ClientLastPrism.SUMMON_BEHAVIOR);
|
||||||
BEHAVIORS.put(StaticSummonBehaviors.LAST_PRISM_BEAM, ClientLastPrism.SUMMON_BEHAVIOR2);
|
BEHAVIORS.put(StaticSummonBehaviors.LAST_PRISM_BEAM, ClientLastPrism.SUMMON_BEHAVIOR2);
|
||||||
BEHAVIORS.put(StaticSummonBehaviors.TERRAPRISMA, ClientTerraprisma.SUMMON_BEHAVIOR);
|
BEHAVIORS.put(StaticSummonBehaviors.TERRAPRISMA, ClientTerraprisma.SUMMON_BEHAVIOR);
|
||||||
|
|
||||||
|
BEHAVIORS.put(StaticSummonBehaviors.MUSKET_BALL, ClientBulletAmmo.SUMMON_BEHAVIOR);
|
||||||
|
BEHAVIORS.put(StaticSummonBehaviors.METEOR_SHOT, ClientBulletAmmo.SUMMON_BEHAVIOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IStaticSummonRenderBehavior getBehavior(String id) {
|
public static IStaticSummonRenderBehavior getBehavior(String id) {
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
package com.lzxnone.terraria.client.event;
|
||||||
|
|
||||||
|
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||||
|
import com.lzxnone.terraria.item.ModItemTags;
|
||||||
|
import com.lzxnone.terraria.item.weapon.RangedWeapon;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
|
import net.minecraft.world.entity.HumanoidArm;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.minecraft.world.inventory.Slot;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.neoforged.api.distmarker.Dist;
|
||||||
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
|
import net.neoforged.fml.common.EventBusSubscriber;
|
||||||
|
import net.neoforged.neoforge.client.event.ContainerScreenEvent;
|
||||||
|
import net.neoforged.neoforge.client.event.RenderGuiEvent;
|
||||||
|
|
||||||
|
@EventBusSubscriber(modid = LzxnoneTerraria.MODID, value = Dist.CLIENT)
|
||||||
|
public class RangedWeaponGuiHandler {
|
||||||
|
private static final int VALID_AMMO_COLOR = 0x6600FF00;
|
||||||
|
private static final int INVALID_AMMO_COLOR = 0x66FF0000;
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void onContainerForeground(ContainerScreenEvent.Render.Foreground event) {
|
||||||
|
ItemStack carriedStack = event.getContainerScreen().getMenu().getCarried();
|
||||||
|
GuiGraphics guiGraphics = event.getGuiGraphics();
|
||||||
|
|
||||||
|
for(Slot slot : event.getContainerScreen().getMenu().slots) {
|
||||||
|
if(!slot.isActive()) continue;
|
||||||
|
|
||||||
|
ItemStack weaponStack = slot.getItem();
|
||||||
|
if(!(weaponStack.getItem() instanceof RangedWeapon rangedWeapon)) continue;
|
||||||
|
|
||||||
|
renderAmmoDropHint(guiGraphics, rangedWeapon, weaponStack, carriedStack, slot);
|
||||||
|
renderSelectedAmmoIcon(guiGraphics, weaponStack, slot.x, slot.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void onRenderGui(RenderGuiEvent.Post event) {
|
||||||
|
Minecraft minecraft = Minecraft.getInstance();
|
||||||
|
Player player = minecraft.player;
|
||||||
|
if(player == null || minecraft.options.hideGui) return;
|
||||||
|
|
||||||
|
GuiGraphics guiGraphics = event.getGuiGraphics();
|
||||||
|
int centerX = guiGraphics.guiWidth() / 2;
|
||||||
|
int hotbarY = guiGraphics.guiHeight() - 19;
|
||||||
|
|
||||||
|
for(int i = 0; i < 9; i++) {
|
||||||
|
ItemStack stack = player.getInventory().items.get(i);
|
||||||
|
int slotX = centerX - 90 + i * 20 + 2;
|
||||||
|
renderSelectedAmmoIcon(guiGraphics, stack, slotX, hotbarY);
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemStack offhandStack = player.getOffhandItem();
|
||||||
|
if(!offhandStack.isEmpty()) {
|
||||||
|
int offhandX = player.getMainArm().getOpposite() == HumanoidArm.LEFT
|
||||||
|
? centerX - 91 - 26
|
||||||
|
: centerX + 91 + 10;
|
||||||
|
renderSelectedAmmoIcon(guiGraphics, offhandStack, offhandX, hotbarY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void renderAmmoDropHint(GuiGraphics guiGraphics, RangedWeapon rangedWeapon,
|
||||||
|
ItemStack weaponStack, ItemStack carriedStack, Slot slot) {
|
||||||
|
if(carriedStack.isEmpty() || !carriedStack.is(ModItemTags.BULLET_AMMO)) return;
|
||||||
|
|
||||||
|
int color = rangedWeapon.canUseAmmo(weaponStack, carriedStack) ? VALID_AMMO_COLOR : INVALID_AMMO_COLOR;
|
||||||
|
guiGraphics.fill(slot.x, slot.y, slot.x + 16, slot.y + 16, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void renderSelectedAmmoIcon(GuiGraphics guiGraphics, ItemStack weaponStack, int slotX, int slotY) {
|
||||||
|
if(!(weaponStack.getItem() instanceof RangedWeapon)) return;
|
||||||
|
|
||||||
|
ItemStack ammoStack = RangedWeapon.getAmmoStack(weaponStack);
|
||||||
|
if(ammoStack.isEmpty()) return;
|
||||||
|
|
||||||
|
int x = slotX + 12;
|
||||||
|
int y = slotY + 12;
|
||||||
|
|
||||||
|
guiGraphics.pose().pushPose();
|
||||||
|
guiGraphics.pose().translate(x, y, 200.0F);
|
||||||
|
guiGraphics.pose().scale(0.25F, 0.25F, 1.0F);
|
||||||
|
guiGraphics.renderItem(ammoStack, 0, 0);
|
||||||
|
guiGraphics.pose().popPose();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
package com.lzxnone.terraria.client.item.ammo;
|
||||||
|
|
||||||
|
import com.lzxnone.terraria.client.entity.summon.IStaticSummonRenderBehavior;
|
||||||
|
import com.lzxnone.terraria.entity.summon.StaticSummon;
|
||||||
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
import com.mojang.math.Axis;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.MultiBufferSource;
|
||||||
|
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||||
|
import net.minecraft.util.Mth;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.item.ItemDisplayContext;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
|
||||||
|
public class ClientBulletAmmo {
|
||||||
|
public static final IStaticSummonRenderBehavior SUMMON_BEHAVIOR = new IStaticSummonRenderBehavior() {
|
||||||
|
public void render(Entity entity, float entityYaw, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) {
|
||||||
|
if(!(entity instanceof StaticSummon summon)) return;
|
||||||
|
ItemStack itemStack = summon.getEntityData().get(StaticSummon.ITEM);
|
||||||
|
if(itemStack == ItemStack.EMPTY) return;
|
||||||
|
|
||||||
|
poseStack.pushPose();
|
||||||
|
|
||||||
|
//旋转(方向修正)
|
||||||
|
poseStack.mulPose(Axis.YP.rotationDegrees(-Mth.lerp(partialTick, summon.yRotO, summon.getYRot())));
|
||||||
|
poseStack.mulPose(Axis.XP.rotationDegrees(Mth.lerp(partialTick, summon.xRotO, summon.getXRot())));
|
||||||
|
|
||||||
|
poseStack.mulPose(Axis.YP.rotationDegrees(-90));
|
||||||
|
|
||||||
|
poseStack.scale(
|
||||||
|
summon.getEntityData().get(StaticSummon.SCALE_X),
|
||||||
|
summon.getEntityData().get(StaticSummon.SCALE_Y),
|
||||||
|
summon.getEntityData().get(StaticSummon.SCALE_Z)
|
||||||
|
);
|
||||||
|
|
||||||
|
Minecraft.getInstance().getItemRenderer().renderStatic(
|
||||||
|
itemStack,
|
||||||
|
ItemDisplayContext.NONE,
|
||||||
|
packedLight,
|
||||||
|
OverlayTexture.NO_OVERLAY,
|
||||||
|
poseStack,
|
||||||
|
bufferSource,
|
||||||
|
entity.level(),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
poseStack.popPose();
|
||||||
|
|
||||||
|
poseStack.pushPose();
|
||||||
|
|
||||||
|
//旋转(方向修正)
|
||||||
|
poseStack.mulPose(Axis.YP.rotationDegrees(-Mth.lerp(partialTick, summon.yRotO, summon.getYRot())));
|
||||||
|
poseStack.mulPose(Axis.XP.rotationDegrees(Mth.lerp(partialTick, summon.xRotO, summon.getXRot())));
|
||||||
|
|
||||||
|
poseStack.mulPose(Axis.ZP.rotationDegrees(90));
|
||||||
|
poseStack.mulPose(Axis.YP.rotationDegrees(-90));
|
||||||
|
|
||||||
|
poseStack.scale(
|
||||||
|
summon.getEntityData().get(StaticSummon.SCALE_X),
|
||||||
|
summon.getEntityData().get(StaticSummon.SCALE_Y),
|
||||||
|
summon.getEntityData().get(StaticSummon.SCALE_Z)
|
||||||
|
);
|
||||||
|
|
||||||
|
Minecraft.getInstance().getItemRenderer().renderStatic(
|
||||||
|
itemStack,
|
||||||
|
ItemDisplayContext.NONE,
|
||||||
|
packedLight,
|
||||||
|
OverlayTexture.NO_OVERLAY,
|
||||||
|
poseStack,
|
||||||
|
bufferSource,
|
||||||
|
entity.level(),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
poseStack.popPose();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -55,6 +55,15 @@ public class ModCreativeModeTabs {
|
|||||||
output.accept(ModItems.LAST_PRISM.get());
|
output.accept(ModItems.LAST_PRISM.get());
|
||||||
}).build());
|
}).build());
|
||||||
|
|
||||||
|
public static final DeferredHolder<CreativeModeTab, CreativeModeTab> RANGED_TAB = CREATIVE_MODE_TABS.register("lzxnoneterraria_ranged_0", () -> CreativeModeTab.builder()
|
||||||
|
.title(Component.translatable("itemGroup.lzxnoneterraria.ranged"))
|
||||||
|
.icon(() -> ModItems.SDMG.get().getDefaultInstance())
|
||||||
|
.displayItems((parameters, output) -> {
|
||||||
|
output.accept(ModItems.SDMG.get());
|
||||||
|
output.accept(ModItems.MUSKET_BALL.get());
|
||||||
|
output.accept(ModItems.METEOR_SHOT.get());
|
||||||
|
}).build());
|
||||||
|
|
||||||
public static final DeferredHolder<CreativeModeTab, CreativeModeTab> SUMMON_TAB = CREATIVE_MODE_TABS.register("lzxnoneterraria_summon_0", () -> CreativeModeTab.builder()
|
public static final DeferredHolder<CreativeModeTab, CreativeModeTab> SUMMON_TAB = CREATIVE_MODE_TABS.register("lzxnoneterraria_summon_0", () -> CreativeModeTab.builder()
|
||||||
.title(Component.translatable("itemGroup.lzxnoneterraria.summon"))
|
.title(Component.translatable("itemGroup.lzxnoneterraria.summon"))
|
||||||
.icon(() -> ModItems.TERRAPRISMA.get().getDefaultInstance())
|
.icon(() -> ModItems.TERRAPRISMA.get().getDefaultInstance())
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.lzxnone.terraria.entity.summon;
|
package com.lzxnone.terraria.entity.summon;
|
||||||
|
|
||||||
|
import com.lzxnone.terraria.item.ammo.MeteorShot;
|
||||||
|
import com.lzxnone.terraria.item.ammo.MusketBall;
|
||||||
import com.lzxnone.terraria.item.weapon.magic.LastPrism;
|
import com.lzxnone.terraria.item.weapon.magic.LastPrism;
|
||||||
import com.lzxnone.terraria.item.weapon.melee.*;
|
import com.lzxnone.terraria.item.weapon.melee.*;
|
||||||
import com.lzxnone.terraria.item.weapon.summon.Terraprisma;
|
import com.lzxnone.terraria.item.weapon.summon.Terraprisma;
|
||||||
@@ -11,6 +13,8 @@ public class StaticSummonBehaviors {
|
|||||||
private static final Map<String, IStaticSummonBehavior> BEHAVIORS = new HashMap<>();
|
private static final Map<String, IStaticSummonBehavior> BEHAVIORS = new HashMap<>();
|
||||||
|
|
||||||
public static final String DEFAULT = "default";
|
public static final String DEFAULT = "default";
|
||||||
|
|
||||||
|
//弹射实体
|
||||||
public static final String SEEDLER_NUT = "seedler_nut";
|
public static final String SEEDLER_NUT = "seedler_nut";
|
||||||
public static final String THE_HORSEMANS_BLADE_JACK = "the_horsemans_blade_jack";
|
public static final String THE_HORSEMANS_BLADE_JACK = "the_horsemans_blade_jack";
|
||||||
public static final String INFLUX_WAVER_BEAM = "influx_waver_beam";
|
public static final String INFLUX_WAVER_BEAM = "influx_waver_beam";
|
||||||
@@ -31,8 +35,13 @@ public class StaticSummonBehaviors {
|
|||||||
public static final String LAST_PRISM_BEAM = "last_prism_beam";
|
public static final String LAST_PRISM_BEAM = "last_prism_beam";
|
||||||
public static final String TERRAPRISMA = "terraprisma";
|
public static final String TERRAPRISMA = "terraprisma";
|
||||||
|
|
||||||
|
//弹药实体
|
||||||
|
public static final String MUSKET_BALL = "musket_ball";
|
||||||
|
public static final String METEOR_SHOT = "meteor_shot";
|
||||||
|
|
||||||
static {
|
static {
|
||||||
BEHAVIORS.put(DEFAULT, new IStaticSummonBehavior() {});
|
BEHAVIORS.put(DEFAULT, new IStaticSummonBehavior() {});
|
||||||
|
|
||||||
BEHAVIORS.put(SEEDLER_NUT, Seedler.SUMMON_BEHAVIOR);
|
BEHAVIORS.put(SEEDLER_NUT, Seedler.SUMMON_BEHAVIOR);
|
||||||
BEHAVIORS.put(THE_HORSEMANS_BLADE_JACK, TheHorsemansBlade.SUMMON_BEHAVIOR);
|
BEHAVIORS.put(THE_HORSEMANS_BLADE_JACK, TheHorsemansBlade.SUMMON_BEHAVIOR);
|
||||||
BEHAVIORS.put(INFLUX_WAVER_BEAM, InfluxWaver.SUMMON_BEHAVIOR);
|
BEHAVIORS.put(INFLUX_WAVER_BEAM, InfluxWaver.SUMMON_BEHAVIOR);
|
||||||
@@ -52,6 +61,9 @@ public class StaticSummonBehaviors {
|
|||||||
BEHAVIORS.put(LAST_PRISM_TRI, LastPrism.SUMMON_BEHAVIOR);
|
BEHAVIORS.put(LAST_PRISM_TRI, LastPrism.SUMMON_BEHAVIOR);
|
||||||
BEHAVIORS.put(LAST_PRISM_BEAM, LastPrism.SUMMON_BEHAVIOR2);
|
BEHAVIORS.put(LAST_PRISM_BEAM, LastPrism.SUMMON_BEHAVIOR2);
|
||||||
BEHAVIORS.put(TERRAPRISMA, Terraprisma.SUMMON_BEHAVIOR);
|
BEHAVIORS.put(TERRAPRISMA, Terraprisma.SUMMON_BEHAVIOR);
|
||||||
|
|
||||||
|
BEHAVIORS.put(MUSKET_BALL, MusketBall.SUMMON_BEHAVIOR);
|
||||||
|
BEHAVIORS.put(METEOR_SHOT, MeteorShot.SUMMON_BEHAVIOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IStaticSummonBehavior getBehavior(String id) {
|
public static IStaticSummonBehavior getBehavior(String id) {
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.lzxnone.terraria.item;
|
||||||
|
|
||||||
|
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||||
|
import net.minecraft.core.registries.Registries;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.tags.TagKey;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
|
||||||
|
public class ModItemTags {
|
||||||
|
public static final TagKey<Item> BULLET_AMMO = create("bullet_ammo");
|
||||||
|
|
||||||
|
private static TagKey<Item> create(String name) {
|
||||||
|
return TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(LzxnoneTerraria.MODID, name));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,14 @@
|
|||||||
package com.lzxnone.terraria.item;
|
package com.lzxnone.terraria.item;
|
||||||
|
|
||||||
import com.lzxnone.terraria.LzxnoneTerraria;
|
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||||
|
import com.lzxnone.terraria.item.ammo.*;
|
||||||
import com.lzxnone.terraria.item.projectile.*;
|
import com.lzxnone.terraria.item.projectile.*;
|
||||||
|
import com.lzxnone.terraria.item.projectile.ammo.BulletProjectile;
|
||||||
|
import com.lzxnone.terraria.item.projectile.ammo.MeteorShotProjectile;
|
||||||
import com.lzxnone.terraria.item.projectile.first_fractal.*;
|
import com.lzxnone.terraria.item.projectile.first_fractal.*;
|
||||||
import com.lzxnone.terraria.item.weapon.magic.*;
|
import com.lzxnone.terraria.item.weapon.magic.*;
|
||||||
import com.lzxnone.terraria.item.weapon.melee.*;
|
import com.lzxnone.terraria.item.weapon.melee.*;
|
||||||
|
import com.lzxnone.terraria.item.weapon.ranged.*;
|
||||||
import com.lzxnone.terraria.item.weapon.summon.*;
|
import com.lzxnone.terraria.item.weapon.summon.*;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.neoforged.neoforge.registries.DeferredItem;
|
import net.neoforged.neoforge.registries.DeferredItem;
|
||||||
@@ -42,6 +46,16 @@ public class ModItems {
|
|||||||
//魔法武器
|
//魔法武器
|
||||||
public static final DeferredItem<Item> LAST_PRISM = ITEMS.register("last_prism", LastPrism::new);
|
public static final DeferredItem<Item> LAST_PRISM = ITEMS.register("last_prism", LastPrism::new);
|
||||||
|
|
||||||
|
//远程武器
|
||||||
|
public static final DeferredItem<Item> SDMG = ITEMS.register("sdmg", SDMG::new);
|
||||||
|
|
||||||
|
//弹药
|
||||||
|
public static final DeferredItem<Item> MUSKET_BALL = ITEMS.register("musket_ball", MusketBall::new);
|
||||||
|
public static final DeferredItem<Item> METEOR_SHOT = ITEMS.register("meteor_shot", MeteorShot::new);
|
||||||
|
|
||||||
|
public static final DeferredItem<Item> BULLET_PROJECTILE = ITEMS.register("bullet_projectile", BulletProjectile::new);
|
||||||
|
public static final DeferredItem<Item> METEOR_SHOT_PROJECTILE = ITEMS.register("meteor_shot_projectile", MeteorShotProjectile::new);
|
||||||
|
|
||||||
//召唤武器
|
//召唤武器
|
||||||
public static final DeferredItem<Item> TERRAPRISMA = ITEMS.register("terraprisma", Terraprisma::new);
|
public static final DeferredItem<Item> TERRAPRISMA = ITEMS.register("terraprisma", Terraprisma::new);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.lzxnone.terraria.item.ammo;
|
||||||
|
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
|
||||||
|
public class BulletAmmo extends Item {
|
||||||
|
public BulletAmmo() {
|
||||||
|
super(new Item.Properties());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.lzxnone.terraria.item.ammo;
|
||||||
|
|
||||||
|
import com.lzxnone.terraria.entity.summon.IStaticSummonBehavior;
|
||||||
|
import com.lzxnone.terraria.entity.summon.StaticSummon;
|
||||||
|
|
||||||
|
public class MeteorShot extends BulletAmmo {
|
||||||
|
public static final IStaticSummonBehavior SUMMON_BEHAVIOR = new IStaticSummonBehavior() {
|
||||||
|
@Override
|
||||||
|
public void tick(StaticSummon summon) {
|
||||||
|
this.checkBeforeTick(summon);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.lzxnone.terraria.item.ammo;
|
||||||
|
|
||||||
|
import com.lzxnone.terraria.entity.summon.IStaticSummonBehavior;
|
||||||
|
import com.lzxnone.terraria.entity.summon.StaticSummon;
|
||||||
|
|
||||||
|
public class MusketBall extends BulletAmmo {
|
||||||
|
public static final IStaticSummonBehavior SUMMON_BEHAVIOR = new IStaticSummonBehavior() {
|
||||||
|
@Override
|
||||||
|
public void tick(StaticSummon summon) {
|
||||||
|
this.checkBeforeTick(summon);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.lzxnone.terraria.item.projectile.ammo;
|
||||||
|
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
|
||||||
|
public class BulletProjectile extends Item {
|
||||||
|
public BulletProjectile() {
|
||||||
|
super(new Item.Properties());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.lzxnone.terraria.item.projectile.ammo;
|
||||||
|
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
|
||||||
|
public class MeteorShotProjectile extends Item {
|
||||||
|
public MeteorShotProjectile() {
|
||||||
|
super(new Item.Properties());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,27 @@
|
|||||||
package com.lzxnone.terraria.item.weapon;
|
package com.lzxnone.terraria.item.weapon;
|
||||||
|
|
||||||
|
import net.minecraft.core.component.DataComponents;
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.entity.SlotAccess;
|
||||||
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.minecraft.world.inventory.ClickAction;
|
||||||
|
import net.minecraft.world.inventory.Slot;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.item.Tier;
|
import net.minecraft.world.item.Tier;
|
||||||
|
import net.minecraft.world.item.TooltipFlag;
|
||||||
|
import net.minecraft.world.item.component.CustomData;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class RangedWeapon extends Weapon {
|
public class RangedWeapon extends Weapon {
|
||||||
|
public static final String AMMO_KEY = "ammo";
|
||||||
|
|
||||||
public RangedWeapon(Tier tier, Properties properties) {
|
public RangedWeapon(Tier tier, Properties properties) {
|
||||||
super(tier, properties);
|
super(tier, properties);
|
||||||
}
|
}
|
||||||
@@ -10,4 +29,131 @@ public class RangedWeapon extends Weapon {
|
|||||||
public RangedWeapon(Properties properties) {
|
public RangedWeapon(Properties properties) {
|
||||||
super(properties);
|
super(properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean canUseAmmo(ItemStack weaponStack, ItemStack ammoStack) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getUseTime(ItemStack weaponStack, LivingEntity entity) {
|
||||||
|
return 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAmmoConsumeAmount(ItemStack weaponStack, LivingEntity entity) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean shouldShootThisTick(ItemStack weaponStack, LivingEntity entity, int remainingUseTicks) {
|
||||||
|
int useTime = Math.max(1, getUseTime(weaponStack, entity));
|
||||||
|
int elapsedMinecraftTicks = getUseDuration(weaponStack, entity) - remainingUseTicks;
|
||||||
|
if(elapsedMinecraftTicks <= 0) return false;
|
||||||
|
|
||||||
|
int currentShot = elapsedMinecraftTicks * 3 / useTime;
|
||||||
|
int previousShot = (elapsedMinecraftTicks - 1) * 3 / useTime;
|
||||||
|
return currentShot > previousShot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean canShoot(ItemStack weaponStack, Player player) {
|
||||||
|
ItemStack ammoStack = getAmmoStack(weaponStack);
|
||||||
|
if(ammoStack.isEmpty() || !canUseAmmo(weaponStack, ammoStack)) return false;
|
||||||
|
|
||||||
|
Item ammoItem = ammoStack.getItem();
|
||||||
|
for(ItemStack inventoryStack : player.getInventory().items) {
|
||||||
|
if(inventoryStack.is(ammoItem)) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean consumeAmmo(ItemStack weaponStack, Player player, int amount) {
|
||||||
|
if(amount <= 0 || player.hasInfiniteMaterials()) return true;
|
||||||
|
|
||||||
|
ItemStack ammoStack = getAmmoStack(weaponStack);
|
||||||
|
if(ammoStack.isEmpty() || !canUseAmmo(weaponStack, ammoStack)) return false;
|
||||||
|
|
||||||
|
Item ammoItem = ammoStack.getItem();
|
||||||
|
int available = 0;
|
||||||
|
for(ItemStack inventoryStack : player.getInventory().items) {
|
||||||
|
if(inventoryStack.is(ammoItem)) {
|
||||||
|
available += inventoryStack.getCount();
|
||||||
|
if(available >= amount) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(available < amount) return false;
|
||||||
|
|
||||||
|
int remaining = amount;
|
||||||
|
for(ItemStack inventoryStack : player.getInventory().items) {
|
||||||
|
if(!inventoryStack.is(ammoItem)) continue;
|
||||||
|
|
||||||
|
int consumed = Math.min(remaining, inventoryStack.getCount());
|
||||||
|
inventoryStack.shrink(consumed);
|
||||||
|
remaining -= consumed;
|
||||||
|
if(remaining <= 0) return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean tryShoot(Level level, Player player, ItemStack weaponStack) {
|
||||||
|
if(!canShoot(weaponStack, player)) return false;
|
||||||
|
if(!level.isClientSide() && !consumeAmmo(weaponStack, player, getAmmoConsumeAmount(weaponStack, player))) return false;
|
||||||
|
|
||||||
|
shoot(level, player, weaponStack);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void shoot(Level level, Player player, ItemStack weaponStack) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUseTick(Level level, LivingEntity entity, ItemStack stack, int remainingUseTicks) {
|
||||||
|
if(!(entity instanceof Player player)) return;
|
||||||
|
if(!shouldShootThisTick(stack, entity, remainingUseTicks)) return;
|
||||||
|
|
||||||
|
if(!tryShoot(level, player, stack)) {
|
||||||
|
player.stopUsingItem();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getUseDuration(ItemStack stack, LivingEntity entity) {
|
||||||
|
return 72000;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ResourceLocation getAmmo(ItemStack weaponStack) {
|
||||||
|
String ammo = weaponStack.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY)
|
||||||
|
.copyTag()
|
||||||
|
.getString(AMMO_KEY);
|
||||||
|
return ammo.isEmpty() ? null : ResourceLocation.parse(ammo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStack getAmmoStack(ItemStack weaponStack) {
|
||||||
|
ResourceLocation ammoId = getAmmo(weaponStack);
|
||||||
|
if(ammoId == null) return ItemStack.EMPTY;
|
||||||
|
|
||||||
|
Item ammoItem = BuiltInRegistries.ITEM.get(ammoId);
|
||||||
|
return ammoItem == Items.AIR ? ItemStack.EMPTY : ammoItem.getDefaultInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean overrideOtherStackedOnMe(ItemStack stack, ItemStack other, Slot slot,
|
||||||
|
ClickAction action, Player player, SlotAccess access) {
|
||||||
|
if(action != ClickAction.PRIMARY || other.isEmpty() || !canUseAmmo(stack, other)) return false;
|
||||||
|
|
||||||
|
ResourceLocation ammoId = BuiltInRegistries.ITEM.getKey(other.getItem());
|
||||||
|
CustomData.update(DataComponents.CUSTOM_DATA, stack, tag -> tag.putString(AMMO_KEY, ammoId.toString()));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void appendHoverText(ItemStack stack, Item.TooltipContext context,
|
||||||
|
List<Component> tooltipComponents, TooltipFlag tooltipFlag) {
|
||||||
|
super.appendHoverText(stack, context, tooltipComponents, tooltipFlag);
|
||||||
|
|
||||||
|
ItemStack ammoStack = getAmmoStack(stack);
|
||||||
|
if(ammoStack.isEmpty()) return;
|
||||||
|
|
||||||
|
tooltipComponents.add(Component.translatable(
|
||||||
|
"tooltip.lzxnoneterraria.ammo",
|
||||||
|
ammoStack.getHoverName()
|
||||||
|
).withStyle(style -> style.withColor(0x55FF55)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -178,13 +178,12 @@ public class LastPrism extends MagicWeapon {
|
|||||||
public void tick(StaticSummon summon) {
|
public void tick(StaticSummon summon) {
|
||||||
this.checkBeforeTick(summon);
|
this.checkBeforeTick(summon);
|
||||||
if(summon.getOwner() instanceof Player player) {
|
if(summon.getOwner() instanceof Player player) {
|
||||||
ItemStack stack = player.getMainHandItem();
|
if(!player.isUsingItem()) {
|
||||||
if(!stack.is(ModItems.LAST_PRISM.get()) || !player.isUsingItem()) {
|
|
||||||
this.onDied(summon);
|
this.onDied(summon);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ItemStack usingStack = player.getUseItem();
|
ItemStack stack = player.getUseItem();
|
||||||
if(!usingStack.is(ModItems.LAST_PRISM.get())) {
|
if(!stack.is(ModItems.LAST_PRISM.get())) {
|
||||||
this.onDied(summon);
|
this.onDied(summon);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -214,13 +213,6 @@ public class LastPrism extends MagicWeapon {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack stack = player.getMainHandItem();
|
|
||||||
ItemStack usingStack = player.getUseItem();
|
|
||||||
if(!stack.is(ModItems.LAST_PRISM.get()) || !player.isUsingItem() || !usingStack.is(ModItems.LAST_PRISM.get())) {
|
|
||||||
this.onDied(beam);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
beam.setPos(tri.position());
|
beam.setPos(tri.position());
|
||||||
BeamData beamData = computeBeamData(tri, getBeamIndex(beam), 0.0f);
|
BeamData beamData = computeBeamData(tri, getBeamIndex(beam), 0.0f);
|
||||||
if(beamData == null) return;
|
if(beamData == null) return;
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package com.lzxnone.terraria.item.weapon.ranged;
|
||||||
|
|
||||||
|
import com.lzxnone.terraria.ModSounds;
|
||||||
|
import com.lzxnone.terraria.entity.summon.StaticSummon;
|
||||||
|
import com.lzxnone.terraria.item.ModItemTags;
|
||||||
|
import com.lzxnone.terraria.item.weapon.RangedWeapon;
|
||||||
|
import com.lzxnone.terraria.utils.AmmoUtil;
|
||||||
|
import com.lzxnone.terraria.utils.SoundUtil;
|
||||||
|
import net.minecraft.world.InteractionHand;
|
||||||
|
import net.minecraft.world.InteractionResultHolder;
|
||||||
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.Rarity;
|
||||||
|
import net.minecraft.world.item.Tiers;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
|
|
||||||
|
public class SDMG extends RangedWeapon {
|
||||||
|
public SDMG() {
|
||||||
|
super(Tiers.NETHERITE, new Item.Properties().stacksTo(1).fireResistant().rarity(Rarity.EPIC));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand hand) {
|
||||||
|
ItemStack stack = player.getItemInHand(hand);
|
||||||
|
if(!tryShoot(level, player, stack)) return InteractionResultHolder.fail(stack);
|
||||||
|
player.startUsingItem(hand);
|
||||||
|
return InteractionResultHolder.consume(stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canUseAmmo(ItemStack weaponStack, ItemStack ammoStack) {
|
||||||
|
return ammoStack.is(ModItemTags.BULLET_AMMO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getUseTime(ItemStack weaponStack, LivingEntity entity) {
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void shoot(Level level, Player player, ItemStack stack) {
|
||||||
|
SoundUtil.playClientSound(player, ModSounds.SHOT.get());
|
||||||
|
if(!level.isClientSide()) {
|
||||||
|
StaticSummon summon = AmmoUtil.createAmmoSummon(level, player, stack);
|
||||||
|
level.addFreshEntity(summon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.lzxnone.terraria.item.weapon.summon;
|
package com.lzxnone.terraria.item.weapon.summon;
|
||||||
|
|
||||||
|
import com.lzxnone.terraria.ModSounds;
|
||||||
import com.lzxnone.terraria.attachment.ModAttachments;
|
import com.lzxnone.terraria.attachment.ModAttachments;
|
||||||
import com.lzxnone.terraria.enchantment.ModEnchantments;
|
import com.lzxnone.terraria.enchantment.ModEnchantments;
|
||||||
import com.lzxnone.terraria.entity.ModEntities;
|
import com.lzxnone.terraria.entity.ModEntities;
|
||||||
@@ -15,6 +16,7 @@ import com.lzxnone.terraria.ui.config.IConfigData;
|
|||||||
import com.lzxnone.terraria.utils.DamageUtil;
|
import com.lzxnone.terraria.utils.DamageUtil;
|
||||||
import com.lzxnone.terraria.utils.FilterUtil;
|
import com.lzxnone.terraria.utils.FilterUtil;
|
||||||
import com.lzxnone.terraria.utils.MathUtil;
|
import com.lzxnone.terraria.utils.MathUtil;
|
||||||
|
import com.lzxnone.terraria.utils.SoundUtil;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.core.registries.Registries;
|
import net.minecraft.core.registries.Registries;
|
||||||
@@ -601,6 +603,7 @@ public class Terraprisma extends SummonWeapon {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
SoundUtil.playClientSound(player, ModSounds.SUMMON_TERRAPRISMA.get());
|
||||||
return InteractionResultHolder.consume(stack);
|
return InteractionResultHolder.consume(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.lzxnone.terraria.mixin;
|
||||||
|
|
||||||
|
import com.lzxnone.terraria.item.ModItems;
|
||||||
|
import net.minecraft.client.model.HumanoidModel;
|
||||||
|
import net.minecraft.client.model.geom.ModelPart;
|
||||||
|
import net.minecraft.world.InteractionHand;
|
||||||
|
import net.minecraft.world.entity.HumanoidArm;
|
||||||
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
@Mixin(HumanoidModel.class)
|
||||||
|
public abstract class HumanoidModelMixin<T extends LivingEntity> {
|
||||||
|
@Shadow @Final public ModelPart rightArm;
|
||||||
|
@Shadow @Final public ModelPart leftArm;
|
||||||
|
|
||||||
|
@Inject(method = "setupAnim", at = @At("RETURN"))
|
||||||
|
private void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks,
|
||||||
|
float netHeadYaw, float headPitch, CallbackInfo ci) {
|
||||||
|
if(!(entity instanceof Player player)) return;
|
||||||
|
if(!player.isUsingItem()) return;
|
||||||
|
|
||||||
|
HumanoidArm usedArm = player.getUsedItemHand() == InteractionHand.MAIN_HAND
|
||||||
|
? player.getMainArm()
|
||||||
|
: player.getMainArm().getOpposite();
|
||||||
|
|
||||||
|
if(player.getUseItem().is(ModItems.SDMG.get())) {
|
||||||
|
float horizontalArmRot = (float) Math.toRadians(-90.0D);
|
||||||
|
if(usedArm == HumanoidArm.RIGHT) {
|
||||||
|
this.rightArm.xRot = horizontalArmRot;
|
||||||
|
}else {
|
||||||
|
this.leftArm.xRot = horizontalArmRot;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -123,7 +123,7 @@ public class ItemInHandRenderMixin {
|
|||||||
if(player.getCooldowns().isOnCooldown(itemStack.getItem())) {
|
if(player.getCooldowns().isOnCooldown(itemStack.getItem())) {
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
}else if(itemStack.is(ModItems.LAST_PRISM) && entity instanceof Player player) {
|
}else if(itemStack.is(ModItems.LAST_PRISM.get()) && entity instanceof Player player) {
|
||||||
if(player.isUsingItem()) {
|
if(player.isUsingItem()) {
|
||||||
ItemStack usingStack = player.getUseItem();
|
ItemStack usingStack = player.getUseItem();
|
||||||
if(usingStack.is(itemStack.getItem())) {
|
if(usingStack.is(itemStack.getItem())) {
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ public abstract class UseSpeedMixin {
|
|||||||
|| usingItem.is(ModItems.FIRST_FRACTAL.get())
|
|| usingItem.is(ModItems.FIRST_FRACTAL.get())
|
||||||
|| usingItem.is(ModItems.TERRAGRIM.get())
|
|| usingItem.is(ModItems.TERRAGRIM.get())
|
||||||
|| usingItem.is(ModItems.MACE.get())
|
|| usingItem.is(ModItems.MACE.get())
|
||||||
|| usingItem.is(ModItems.LAST_PRISM.get());
|
|| usingItem.is(ModItems.LAST_PRISM.get())
|
||||||
|
|| usingItem.is(ModItems.SDMG.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@WrapOperation(
|
@WrapOperation(
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package com.lzxnone.terraria.utils;
|
||||||
|
|
||||||
|
import com.lzxnone.terraria.LzxnoneTerraria;
|
||||||
|
import com.lzxnone.terraria.entity.ModEntities;
|
||||||
|
import com.lzxnone.terraria.entity.summon.StaticSummon;
|
||||||
|
import com.lzxnone.terraria.entity.summon.StaticSummonBehaviors;
|
||||||
|
import com.lzxnone.terraria.item.ModItems;
|
||||||
|
import com.lzxnone.terraria.item.weapon.RangedWeapon;
|
||||||
|
import net.minecraft.core.component.DataComponents;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.component.CustomData;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
import org.joml.Vector3f;
|
||||||
|
|
||||||
|
public class AmmoUtil {
|
||||||
|
public static final Vector3f OFFSET = new Vector3f(-0.3f, 0, 1.5f);
|
||||||
|
|
||||||
|
public static StaticSummon createAmmoSummon(Level level, Player player, ItemStack stack) {
|
||||||
|
Vector3f[] dirs = MathUtil.computeCoordinateSystem(player);
|
||||||
|
Vec3 eyePos = player.getEyePosition();
|
||||||
|
Vec3 pos = new Vec3(
|
||||||
|
eyePos.x + dirs[0].x * OFFSET.z + dirs[1].x * OFFSET.y + dirs[2].x * OFFSET.x,
|
||||||
|
eyePos.y + dirs[0].y * OFFSET.z + dirs[1].y * OFFSET.y + dirs[2].y * OFFSET.x,
|
||||||
|
eyePos.z + dirs[0].z * OFFSET.z + dirs[1].z * OFFSET.y + dirs[2].z * OFFSET.x
|
||||||
|
);
|
||||||
|
|
||||||
|
StaticSummon summon = new StaticSummon(ModEntities.STATIC_SUMMON.get(), level);
|
||||||
|
summon.setOwner(player);
|
||||||
|
summon.setPos(pos);
|
||||||
|
summon.getEntityData().set(StaticSummon.STACK_SOURCE, stack.copy());
|
||||||
|
summon.getEntityData().set(StaticSummon.RENDER_MODE, "custom");
|
||||||
|
|
||||||
|
float[] xyRot = MathUtil.computeXYRot(dirs[0], dirs[1]);
|
||||||
|
summon.setXRot(xyRot[0]);
|
||||||
|
summon.setYRot(xyRot[1]);
|
||||||
|
summon.xRotO = xyRot[0];
|
||||||
|
summon.yRotO = xyRot[1];
|
||||||
|
|
||||||
|
String ammo = stack.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY).copyTag().getString(RangedWeapon.AMMO_KEY);
|
||||||
|
if(ammo.equals("lzxnoneterraria:musket_ball")) setMusketBall(summon);
|
||||||
|
else if(ammo.equals("lzxnoneterraria:meteor_shot")) setMeteorShot(summon);
|
||||||
|
return summon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setMusketBall(StaticSummon summon) {
|
||||||
|
summon.getEntityData().set(StaticSummon.BEHAVIOR, StaticSummonBehaviors.MUSKET_BALL);
|
||||||
|
summon.getEntityData().set(StaticSummon.ITEM, new ItemStack(ModItems.BULLET_PROJECTILE.get()));
|
||||||
|
summon.getEntityData().set(StaticSummon.LIFETIME, 100);
|
||||||
|
summon.getEntityData().set(StaticSummon.SCALE_X, 1.0f);
|
||||||
|
summon.getEntityData().set(StaticSummon.SCALE_Y, 0.05f);
|
||||||
|
summon.getEntityData().set(StaticSummon.SCALE_Z, 0.01f);
|
||||||
|
summon.setNoGravity(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setMeteorShot(StaticSummon summon) {
|
||||||
|
summon.getEntityData().set(StaticSummon.BEHAVIOR, StaticSummonBehaviors.METEOR_SHOT);
|
||||||
|
summon.getEntityData().set(StaticSummon.ITEM, new ItemStack(ModItems.METEOR_SHOT_PROJECTILE.get()));
|
||||||
|
summon.getEntityData().set(StaticSummon.LIFETIME, 100);
|
||||||
|
summon.getEntityData().set(StaticSummon.SCALE_X, 1.0f);
|
||||||
|
summon.getEntityData().set(StaticSummon.SCALE_Y, 0.05f);
|
||||||
|
summon.getEntityData().set(StaticSummon.SCALE_Z, 0.01f);
|
||||||
|
summon.setNoGravity(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"itemGroup.lzxnoneterraria.melee": "Terraria Melee",
|
"itemGroup.lzxnoneterraria.melee": "Terraria Melee",
|
||||||
"itemGroup.lzxnoneterraria.magic": "Terraria Magic",
|
"itemGroup.lzxnoneterraria.magic": "Terraria Magic",
|
||||||
|
"itemGroup.lzxnoneterraria.ranged": "Terraria Ranged",
|
||||||
"itemGroup.lzxnoneterraria.summon": "Terraria Summon",
|
"itemGroup.lzxnoneterraria.summon": "Terraria Summon",
|
||||||
"itemGroup.lzxnoneterraria.block": "Terraria Block",
|
"itemGroup.lzxnoneterraria.block": "Terraria Block",
|
||||||
"itemGroup.lzxnoneterraria.calamity_melee": "Terraria Calamity Melee",
|
"itemGroup.lzxnoneterraria.calamity_melee": "Terraria Calamity Melee",
|
||||||
@@ -31,6 +32,9 @@
|
|||||||
"item.lzxnoneterraria.mace": "Mace",
|
"item.lzxnoneterraria.mace": "Mace",
|
||||||
"item.lzxnoneterraria.devils_devastation": "Devil's Devastation",
|
"item.lzxnoneterraria.devils_devastation": "Devil's Devastation",
|
||||||
"item.lzxnoneterraria.last_prism": "Last Prism",
|
"item.lzxnoneterraria.last_prism": "Last Prism",
|
||||||
|
"item.lzxnoneterraria.sdmg": "S.D.M.G.",
|
||||||
|
"item.lzxnoneterraria.musket_ball": "Musket Ball",
|
||||||
|
"item.lzxnoneterraria.meteor_shot": "Meteor Shot",
|
||||||
"item.lzxnoneterraria.terraprisma": "Terraprisma",
|
"item.lzxnoneterraria.terraprisma": "Terraprisma",
|
||||||
|
|
||||||
"enchantment.lzxnoneterraria.mana_leak": "Mana Leak",
|
"enchantment.lzxnoneterraria.mana_leak": "Mana Leak",
|
||||||
@@ -48,6 +52,7 @@
|
|||||||
|
|
||||||
"tooltip.lzxnoneterraria.relative_distance": "Relative Distance",
|
"tooltip.lzxnoneterraria.relative_distance": "Relative Distance",
|
||||||
"tooltip.lzxnoneterraria.absolute_distance": "Absolute Distance",
|
"tooltip.lzxnoneterraria.absolute_distance": "Absolute Distance",
|
||||||
|
"tooltip.lzxnoneterraria.ammo": "Ammo: %s",
|
||||||
"tooltip.lzxnoneterraria.devils_devastation_kill_mode": "Kill Mode",
|
"tooltip.lzxnoneterraria.devils_devastation_kill_mode": "Kill Mode",
|
||||||
"tooltip.lzxnoneterraria.devils_devastation.0": "The perfect blade of the Underworld, wielding the power of Brimstone directly.",
|
"tooltip.lzxnoneterraria.devils_devastation.0": "The perfect blade of the Underworld, wielding the power of Brimstone directly.",
|
||||||
"tooltip.lzxnoneterraria.devils_devastation.1": "Humans understand this force as Havoc, the inevitable sundering of all order in fire.",
|
"tooltip.lzxnoneterraria.devils_devastation.1": "Humans understand this force as Havoc, the inevitable sundering of all order in fire.",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"itemGroup.lzxnoneterraria.melee": "泰拉瑞亚 近战武器",
|
"itemGroup.lzxnoneterraria.melee": "泰拉瑞亚 近战武器",
|
||||||
"itemGroup.lzxnoneterraria.magic": "泰拉瑞亚 魔法武器",
|
"itemGroup.lzxnoneterraria.magic": "泰拉瑞亚 魔法武器",
|
||||||
|
"itemGroup.lzxnoneterraria.ranged": "泰拉瑞亚 远程武器",
|
||||||
"itemGroup.lzxnoneterraria.summon": "泰拉瑞亚 召唤武器",
|
"itemGroup.lzxnoneterraria.summon": "泰拉瑞亚 召唤武器",
|
||||||
"itemGroup.lzxnoneterraria.block": "泰拉瑞亚 方块",
|
"itemGroup.lzxnoneterraria.block": "泰拉瑞亚 方块",
|
||||||
"itemGroup.lzxnoneterraria.calamity_melee": "泰拉瑞亚灾厄 近战武器",
|
"itemGroup.lzxnoneterraria.calamity_melee": "泰拉瑞亚灾厄 近战武器",
|
||||||
@@ -31,6 +32,9 @@
|
|||||||
"item.lzxnoneterraria.mace": "链锤",
|
"item.lzxnoneterraria.mace": "链锤",
|
||||||
"item.lzxnoneterraria.devils_devastation": "破灭魔王剑",
|
"item.lzxnoneterraria.devils_devastation": "破灭魔王剑",
|
||||||
"item.lzxnoneterraria.last_prism": "终极棱镜",
|
"item.lzxnoneterraria.last_prism": "终极棱镜",
|
||||||
|
"item.lzxnoneterraria.sdmg": "S.D.M.G.",
|
||||||
|
"item.lzxnoneterraria.musket_ball": "火枪子弹",
|
||||||
|
"item.lzxnoneterraria.meteor_shot": "流星弹",
|
||||||
"item.lzxnoneterraria.terraprisma": "泰拉棱镜",
|
"item.lzxnoneterraria.terraprisma": "泰拉棱镜",
|
||||||
|
|
||||||
"enchantment.lzxnoneterraria.mana_leak": "魔力泄漏",
|
"enchantment.lzxnoneterraria.mana_leak": "魔力泄漏",
|
||||||
@@ -48,6 +52,7 @@
|
|||||||
|
|
||||||
"tooltip.lzxnoneterraria.relative_distance": "相对距离",
|
"tooltip.lzxnoneterraria.relative_distance": "相对距离",
|
||||||
"tooltip.lzxnoneterraria.absolute_distance": "绝对距离",
|
"tooltip.lzxnoneterraria.absolute_distance": "绝对距离",
|
||||||
|
"tooltip.lzxnoneterraria.ammo": "弹药: %s",
|
||||||
"tooltip.lzxnoneterraria.devils_devastation_kill_mode": "杀戮模式",
|
"tooltip.lzxnoneterraria.devils_devastation_kill_mode": "杀戮模式",
|
||||||
"tooltip.lzxnoneterraria.devils_devastation.0": "完美的地狱之剑,直接掌握着硫磺火之力。",
|
"tooltip.lzxnoneterraria.devils_devastation.0": "完美的地狱之剑,直接掌握着硫磺火之力。",
|
||||||
"tooltip.lzxnoneterraria.devils_devastation.1": "人类将这种力量理解为浩劫,即一切秩序在火焰之中的必然毁灭。",
|
"tooltip.lzxnoneterraria.devils_devastation.1": "人类将这种力量理解为浩劫,即一切秩序在火焰之中的必然毁灭。",
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "lzxnoneterraria:item/bullet_projectile"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
{
|
||||||
|
"parent": "item/handheld",
|
||||||
|
"display": {
|
||||||
|
"gui": {
|
||||||
|
"rotation": [ 0, 0, 0 ],
|
||||||
|
"translation": [ 0, 0, 0 ],
|
||||||
|
"scale": [ 1.0, 0.5, 1.0 ]
|
||||||
|
},
|
||||||
|
"ground": {
|
||||||
|
"rotation": [ 0, 0, 0 ],
|
||||||
|
"translation": [ 0, 2.0, 0 ],
|
||||||
|
"scale": [ 1.0, 0.5, 0.5 ]
|
||||||
|
},
|
||||||
|
"head": {
|
||||||
|
"rotation": [ 0, 180, 0 ],
|
||||||
|
"translation": [ 0, 13.0, 7.0 ],
|
||||||
|
"scale": [ 2, 1, 1 ]
|
||||||
|
},
|
||||||
|
"fixed": {
|
||||||
|
"rotation": [ 0, 180, 0 ],
|
||||||
|
"translation": [ 0, 0, 0 ],
|
||||||
|
"scale": [ 1, 0.5, 1 ]
|
||||||
|
},
|
||||||
|
"thirdperson_righthand": {
|
||||||
|
"rotation": [0, 90, 0],
|
||||||
|
"translation": [0, 0, -1],
|
||||||
|
"scale": [1.7, 0.85, 0.85]
|
||||||
|
},
|
||||||
|
"thirdperson_lefthand": {
|
||||||
|
"rotation": [0, -90, 0],
|
||||||
|
"translation": [0, 0, -1],
|
||||||
|
"scale": [1.7, 0.85, 0.85]
|
||||||
|
},
|
||||||
|
"firstperson_righthand": {
|
||||||
|
"rotation": [0, 90, 25],
|
||||||
|
"translation": [1.13, 4.2, 0.0],
|
||||||
|
"scale": [1.36, 0.68, 0.68]
|
||||||
|
},
|
||||||
|
"firstperson_lefthand": {
|
||||||
|
"rotation": [0, -90, -25],
|
||||||
|
"translation": [1.13, 4.2, 0.0],
|
||||||
|
"scale": [1.36, 0.68, 0.68]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "lzxnoneterraria:item/meteor_shot"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "lzxnoneterraria:item/meteor_shot_projectile"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "lzxnoneterraria:item/musket_ball"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "lzxnoneterraria:item/gun",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "lzxnoneterraria:item/sdmg"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,48 @@
|
|||||||
{
|
{
|
||||||
"parent": "lzxnoneterraria:item/sword3",
|
"parent": "item/handheld",
|
||||||
"textures": {
|
"textures": {
|
||||||
"layer0": "lzxnoneterraria:item/seedler"
|
"layer0": "lzxnoneterraria:item/seedler"
|
||||||
|
},
|
||||||
|
"display": {
|
||||||
|
"gui": {
|
||||||
|
"rotation": [ 0, 0, 0 ],
|
||||||
|
"translation": [ 0, 0, 0 ],
|
||||||
|
"scale": [ 0.65, 1.0, 1.0 ]
|
||||||
|
},
|
||||||
|
"ground": {
|
||||||
|
"rotation": [ 0, 0, 0 ],
|
||||||
|
"translation": [ 0, 2.0, 0 ],
|
||||||
|
"scale": [ 0.5, 0.75, 0.5 ]
|
||||||
|
},
|
||||||
|
"head": {
|
||||||
|
"rotation": [ 0, 180, 0 ],
|
||||||
|
"translation": [ 0, 13.0, 7.0 ],
|
||||||
|
"scale": [ 1, 1.5, 1 ]
|
||||||
|
},
|
||||||
|
"fixed": {
|
||||||
|
"rotation": [ 0, 180, 0 ],
|
||||||
|
"translation": [ 0, 0, 0 ],
|
||||||
|
"scale": [ 0.65, 1.0, 1 ]
|
||||||
|
},
|
||||||
|
"thirdperson_righthand": {
|
||||||
|
"rotation": [0, 90, 55],
|
||||||
|
"translation": [0, 10.0, 7.0],
|
||||||
|
"scale": [1.2, 1.8, 1.8]
|
||||||
|
},
|
||||||
|
"thirdperson_lefthand": {
|
||||||
|
"rotation": [0, -90, -55],
|
||||||
|
"translation": [0, 10.0, 7.0],
|
||||||
|
"scale": [1.2, 1.8, 1.8]
|
||||||
|
},
|
||||||
|
"firstperson_righthand": {
|
||||||
|
"rotation": [0, 90, 25],
|
||||||
|
"translation": [1.13, 10.0, 0.0],
|
||||||
|
"scale": [0.83, 1.25, 1.25]
|
||||||
|
},
|
||||||
|
"firstperson_lefthand": {
|
||||||
|
"rotation": [0, -90, -25],
|
||||||
|
"translation": [1.13, 10.0, 0.0],
|
||||||
|
"scale": [0.83, 1.25, 1.25]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,6 +23,12 @@
|
|||||||
"star_collide": {
|
"star_collide": {
|
||||||
"sounds": ["lzxnoneterraria:star_collide"]
|
"sounds": ["lzxnoneterraria:star_collide"]
|
||||||
},
|
},
|
||||||
|
"summon_terraprisma": {
|
||||||
|
"sounds": ["lzxnoneterraria:summon_terraprisma"]
|
||||||
|
},
|
||||||
|
"shot": {
|
||||||
|
"sounds": ["lzxnoneterraria:shot"]
|
||||||
|
},
|
||||||
"boom": {
|
"boom": {
|
||||||
"sounds": ["lzxnoneterraria:boom"]
|
"sounds": ["lzxnoneterraria:boom"]
|
||||||
},
|
},
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 465 B |
Binary file not shown.
|
After Width: | Height: | Size: 134 B |
Binary file not shown.
|
After Width: | Height: | Size: 466 B |
Binary file not shown.
|
After Width: | Height: | Size: 141 B |
Binary file not shown.
|
After Width: | Height: | Size: 356 B |
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"replace": false,
|
||||||
|
"values": [
|
||||||
|
"lzxnoneterraria:musket_ball",
|
||||||
|
"lzxnoneterraria:meteor_shot"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
"client": [
|
"client": [
|
||||||
"GuiGraphicsMixin",
|
"GuiGraphicsMixin",
|
||||||
"GuiMixin",
|
"GuiMixin",
|
||||||
|
"HumanoidModelMixin",
|
||||||
"ItemInHandRenderMixin",
|
"ItemInHandRenderMixin",
|
||||||
"UseSpeedMixin"
|
"UseSpeedMixin"
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in new issue
Block a user