Compare commits

..

4 commits

Author SHA1 Message Date
Mrbysco
226a439154 Update .gitignore 2024-03-04 23:05:21 +01:00
Mrbysco
33f5541192 Change license to MIT
See https://github.com/Ellpeck/ActuallyAdditions/issues/1391
2024-03-04 23:05:01 +01:00
Flanks255
59459b157c Merge remote-tracking branch 'origin/1.20.1' into 1.20.1 2024-03-04 13:17:16 -06:00
Flanks255
0e3fec76ce Small filter tweak before 1.20.4 2024-03-04 13:17:03 -06:00
4 changed files with 34 additions and 40 deletions

1
.gitignore vendored
View file

@ -12,6 +12,7 @@
/classes /classes
/bin/ /bin/
/run/ /run/
/runs/
*.classpath *.classpath
*.project *.project

21
LICENSE Normal file
View 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.

View file

@ -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

View file

@ -35,13 +35,21 @@ public class FilterSettings {
} }
public FilterSettings(int slots, boolean defaultWhitelist, boolean defaultRespectNBT, boolean defaultRespectMod) { 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.isWhitelist = defaultWhitelist;
this.respectNBT = defaultRespectNBT; this.respectNBT = defaultRespectNBT;
this.respectMod = defaultRespectMod; this.respectMod = defaultRespectMod;
} }
public void onContentsChanged() {}
public static boolean check(ItemStack stack, ItemStackHandlerAA filter, boolean whitelist, boolean nbt, boolean mod) { public static boolean check(ItemStack stack, ItemStackHandlerAA filter, boolean whitelist, boolean nbt, boolean mod) {
if (!stack.isEmpty()) { if (!stack.isEmpty()) {
for (int i = 0; i < filter.getSlots(); i++) { for (int i = 0; i < filter.getSlots(); i++) {
@ -77,11 +85,7 @@ public class FilterSettings {
return false; return false;
} }
boolean nbtFine = !nbt || ItemStack.isSameItemSameTags(first, second); return !nbt || ItemStack.isSameItemSameTags(first, second);
if (nbtFine) {
return true;
}
return false;
} }
public void writeToNBT(CompoundTag tag, String name) { public void writeToNBT(CompoundTag tag, String name) {
@ -89,7 +93,7 @@ public class FilterSettings {
compound.putBoolean("Whitelist", this.isWhitelist); compound.putBoolean("Whitelist", this.isWhitelist);
compound.putBoolean("NBT", this.respectNBT); compound.putBoolean("NBT", this.respectNBT);
compound.putBoolean("Mod", this.respectMod); compound.putBoolean("Mod", this.respectMod);
TileEntityInventoryBase.saveSlots(this.filterInventory, compound); compound.put("Items", filterInventory.serializeNBT());
tag.put(name, compound); tag.put(name, compound);
} }
@ -98,7 +102,7 @@ public class FilterSettings {
this.isWhitelist = compound.getBoolean("Whitelist"); this.isWhitelist = compound.getBoolean("Whitelist");
this.respectNBT = compound.getBoolean("NBT"); this.respectNBT = compound.getBoolean("NBT");
this.respectMod = compound.getBoolean("Mod"); this.respectMod = compound.getBoolean("Mod");
TileEntityInventoryBase.loadSlots(this.filterInventory, compound); this.filterInventory.deserializeNBT(compound.getCompound("Items"));
} }
public boolean needsUpdateSend() { public boolean needsUpdateSend() {