From 88425ab3314ad012eaa312859e4aa59476460ead Mon Sep 17 00:00:00 2001 From: miozune Date: Tue, 25 Jul 2023 13:17:59 +0900 Subject: Remove AbstractedStack (#346) * Remove AbstractedStack * Remove outdated script Former-commit-id: 462a8b3e49915df48fd772bdc4ff13f097d39b4c --- .../bartworks/system/object/AbstractedStack.java | 84 ---------------------- 1 file changed, 84 deletions(-) delete mode 100644 src/main/java/com/github/bartimaeusnek/bartworks/system/object/AbstractedStack.java (limited to 'src/main/java') diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/object/AbstractedStack.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/object/AbstractedStack.java deleted file mode 100644 index 86e5673ebf..0000000000 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/object/AbstractedStack.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2018-2020 bartimaeusnek Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following - * conditions: The above copyright notice and this permission notice shall be included in all copies or substantial - * portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -package com.github.bartimaeusnek.bartworks.system.object; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import com.github.bartimaeusnek.bartworks.util.Pair; - -public class AbstractedStack implements Serializable { - - final Pair idDamage; - final NBTTagCompound mTag; - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof AbstractedStack)) return false; - - AbstractedStack that = (AbstractedStack) o; - - if (this.getIdDamage() != null ? !this.getIdDamage().equals(that.getIdDamage()) : that.getIdDamage() != null) - return false; - return this.getmTag() != null ? this.getmTag().equals(that.getmTag()) : that.getmTag() == null; - } - - @Override - public int hashCode() { - int result = this.getIdDamage() != null ? this.getIdDamage().hashCode() : 0; - result = 31 * result + (this.getmTag() != null ? this.getmTag().hashCode() : 0); - return result; - } - - public Pair getIdDamage() { - return this.idDamage; - } - - public NBTTagCompound getmTag() { - return this.mTag; - } - - public AbstractedStack(Pair idDamage, NBTTagCompound mTag) { - this.idDamage = idDamage; - this.mTag = mTag; - } - - public AbstractedStack(ItemStack itemStack) { - if (itemStack == null) throw new UnsupportedOperationException(); - this.idDamage = new Pair<>(Item.getIdFromItem(itemStack.getItem()), (short) itemStack.getItemDamage()); - this.mTag = itemStack.getTagCompound(); - } - - public byte[] serialize() throws IOException { - ByteArrayOutputStream out = new ByteArrayOutputStream(); - ObjectOutputStream os = new ObjectOutputStream(out); - os.writeObject(this); - return out.toByteArray(); - } - - public AbstractedStack deserialize(byte[] data) throws IOException, ClassNotFoundException, ClassCastException { - ByteArrayInputStream in = new ByteArrayInputStream(data); - ObjectInputStream is = new ObjectInputStream(in); - return (AbstractedStack) is.readObject(); - } -} -- cgit