mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-27 17:28:34 +01:00
Compare commits
4 commits
97532fff5b
...
226a439154
Author | SHA1 | Date | |
---|---|---|---|
|
226a439154 | ||
|
33f5541192 | ||
|
59459b157c | ||
|
0e3fec76ce |
4 changed files with 34 additions and 40 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -12,6 +12,7 @@
|
|||
/classes
|
||||
/bin/
|
||||
/run/
|
||||
/runs/
|
||||
|
||||
*.classpath
|
||||
*.project
|
||||
|
|
21
LICENSE
Normal file
21
LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2019 Mrbysco
|
||||
|
||||
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.
|
32
LICENSE.md
32
LICENSE.md
|
@ -1,32 +0,0 @@
|
|||
#### All Rights Reserved
|
||||
|
||||
The things listed below are special cases and exceptions from the above. They have to be respected in addition to the above.
|
||||
Everything that is not listed below applies to the above.
|
||||
|
||||
### YOU MAY
|
||||
* Fork and modify the code.
|
||||
* Submit pull requests.
|
||||
* Copy small parts of code for other projects.
|
||||
* Make a review/spotlight of the mod or use it in a modpack.
|
||||
* Make Let's Play (and similar) videos containing the mod.
|
||||
|
||||
### YOU CAN NOT
|
||||
* Copy entire classes, methods or features or claim you made them.
|
||||
* Redistribute the mod. This does not apply, however, when it comes to pre-packaged modpacks.
|
||||
|
||||
### YOU HAVE TO
|
||||
* When modifying or using code, always explicitly credit Ellpeck as the creator.
|
||||
* When making a review/spotlight containing the mod or using it in a modpack, always make clear that Actually Additions is used.
|
||||
* When it comes to the code, always link back to the official repository.
|
||||
* When it comes to the mod, always link back to the the official Minecraft Forum thread or CurseForge page.
|
||||
|
||||
### NOTES
|
||||
|
||||
* There is no warranty of any kind given. The creator is not to be held liable for bugs, problems or issues.
|
||||
* The Actually Additions API can be used in other projects, however it should not be modified. It can be redistributed with other mods (if necessary), however it should still be visible that it is a part of Actually Additions. Do not remove the copyright header from any of the API's files.
|
||||
* The above License only applies for code that is part of the mod itself, any APIs used (such as the CoFH API) are licensed by their respective publishers.
|
||||
* Excerpts from other code used (such as the OpenBlocks XP system) are explicitly declared as such and the above point applies for them.
|
||||
* You are not allowed to copy the assets used in this mod for any other project.
|
||||
* Parts of this license, especially restrictive ones, can be ignored with personal permission. Said permission, however, will only be given to people I know or someone who has a very good reason for needing it.
|
||||
|
||||
© 2015-2017 Ellpeck
|
|
@ -35,13 +35,21 @@ public class FilterSettings {
|
|||
}
|
||||
|
||||
public FilterSettings(int slots, boolean defaultWhitelist, boolean defaultRespectNBT, boolean defaultRespectMod) {
|
||||
this.filterInventory = new ItemStackHandlerAA(slots);
|
||||
this.filterInventory = new ItemStackHandlerAA(slots) {
|
||||
@Override
|
||||
protected void onContentsChanged(int slot) {
|
||||
super.onContentsChanged(slot);
|
||||
FilterSettings.this.onContentsChanged();
|
||||
}
|
||||
};
|
||||
|
||||
this.isWhitelist = defaultWhitelist;
|
||||
this.respectNBT = defaultRespectNBT;
|
||||
this.respectMod = defaultRespectMod;
|
||||
}
|
||||
|
||||
public void onContentsChanged() {}
|
||||
|
||||
public static boolean check(ItemStack stack, ItemStackHandlerAA filter, boolean whitelist, boolean nbt, boolean mod) {
|
||||
if (!stack.isEmpty()) {
|
||||
for (int i = 0; i < filter.getSlots(); i++) {
|
||||
|
@ -77,11 +85,7 @@ public class FilterSettings {
|
|||
return false;
|
||||
}
|
||||
|
||||
boolean nbtFine = !nbt || ItemStack.isSameItemSameTags(first, second);
|
||||
if (nbtFine) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return !nbt || ItemStack.isSameItemSameTags(first, second);
|
||||
}
|
||||
|
||||
public void writeToNBT(CompoundTag tag, String name) {
|
||||
|
@ -89,7 +93,7 @@ public class FilterSettings {
|
|||
compound.putBoolean("Whitelist", this.isWhitelist);
|
||||
compound.putBoolean("NBT", this.respectNBT);
|
||||
compound.putBoolean("Mod", this.respectMod);
|
||||
TileEntityInventoryBase.saveSlots(this.filterInventory, compound);
|
||||
compound.put("Items", filterInventory.serializeNBT());
|
||||
tag.put(name, compound);
|
||||
}
|
||||
|
||||
|
@ -98,7 +102,7 @@ public class FilterSettings {
|
|||
this.isWhitelist = compound.getBoolean("Whitelist");
|
||||
this.respectNBT = compound.getBoolean("NBT");
|
||||
this.respectMod = compound.getBoolean("Mod");
|
||||
TileEntityInventoryBase.loadSlots(this.filterInventory, compound);
|
||||
this.filterInventory.deserializeNBT(compound.getCompound("Items"));
|
||||
}
|
||||
|
||||
public boolean needsUpdateSend() {
|
||||
|
|
Loading…
Reference in a new issue