-
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.
-re-add alchemy nodes having an item slot
- Loading branch information
1 parent
bee5ec1
commit 778e0ee
Showing
13 changed files
with
235 additions
and
39 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
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
45 changes: 45 additions & 0 deletions
45
src/main/java/cassunshine/thework/alchemy/circle/events/node/AlchemyNodeSetItem.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 cassunshine.thework.alchemy.circle.events.node; | ||
|
||
import cassunshine.thework.TheWorkMod; | ||
import cassunshine.thework.alchemy.circle.node.AlchemyNode; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.nbt.NbtCompound; | ||
import net.minecraft.network.PacketByteBuf; | ||
import net.minecraft.util.Identifier; | ||
|
||
public class AlchemyNodeSetItem extends AlchemyNodeEvent { | ||
public static final Identifier IDENTIFIER = new Identifier(TheWorkMod.ModID, "node_set_item"); | ||
|
||
public ItemStack stack; | ||
|
||
public AlchemyNodeSetItem() { | ||
super(IDENTIFIER); | ||
} | ||
|
||
public AlchemyNodeSetItem(ItemStack stack, AlchemyNode node) { | ||
super(node, IDENTIFIER); | ||
|
||
this.stack = stack.copy(); | ||
} | ||
|
||
@Override | ||
public void writePacket(PacketByteBuf buf) { | ||
super.writePacket(buf); | ||
|
||
buf.writeNbt(stack.writeNbt(new NbtCompound())); | ||
} | ||
|
||
@Override | ||
public void readPacket(PacketByteBuf buf) { | ||
super.readPacket(buf); | ||
|
||
stack = ItemStack.fromNbt(buf.readNbt()); | ||
} | ||
|
||
@Override | ||
public void applyToNode(AlchemyNode node) { | ||
super.applyToNode(node); | ||
|
||
node.heldStack = 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.