diff options
| author | miozune <miozune@gmail.com> | 2023-07-25 13:17:59 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-25 13:17:59 +0900 |
| commit | 88425ab3314ad012eaa312859e4aa59476460ead (patch) | |
| tree | 752843fd75fa3df074800e268ab376d07570db03 /src/main/java/com | |
| parent | 074b75f5b0c9230a309a05168826b0dc2f9eba2e (diff) | |
| download | GT5-Unofficial-88425ab3314ad012eaa312859e4aa59476460ead.tar.gz GT5-Unofficial-88425ab3314ad012eaa312859e4aa59476460ead.tar.bz2 GT5-Unofficial-88425ab3314ad012eaa312859e4aa59476460ead.zip | |
Remove AbstractedStack (#346)
* Remove AbstractedStack
* Remove outdated script
Former-commit-id: 462a8b3e49915df48fd772bdc4ff13f097d39b4c
Diffstat (limited to 'src/main/java/com')
| -rw-r--r-- | src/main/java/com/github/bartimaeusnek/bartworks/system/object/AbstractedStack.java | 84 |
1 files changed, 0 insertions, 84 deletions
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<Integer, Short> 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<Integer, Short> getIdDamage() { - return this.idDamage; - } - - public NBTTagCompound getmTag() { - return this.mTag; - } - - public AbstractedStack(Pair<Integer, Short> 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(); - } -} |
