Skip to content

Commit

Permalink
1.0.4
Browse files Browse the repository at this point in the history
- Updated to 1.17.1
- Updated Gradle
- Updated dependencies
- Added Guarded by Piglins REI category
- Moved to new Fabric TagFactory instead of TagRegistry
- Optimized imports
  • Loading branch information
Shnupbups committed Oct 5, 2021
1 parent e9de334 commit 4e68001
Show file tree
Hide file tree
Showing 13 changed files with 134 additions and 75 deletions.
16 changes: 8 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.17
yarn_mappings=10
minecraft_version=1.17.1
yarn_mappings=61
tiny_version=2
loader_version=0.11.3
loader_version=0.11.7

# Mod Properties
mod_version = 1.0.3
mod_version = 1.0.4
maven_group = com.shnupbups
mod_name = piglib
version_meta = fabric-mc1.17

# Dependencies
# check on https://modmuss50.me/fabric.html
fapi_version=0.35.0+1.17
fapi_version=0.40.1+1.17

# Other Stuff
# check on maven at https://maven.shedaniel.me/me/shedaniel/RoughlyEnoughItems-fabric/
rei_version = 6.0.250-alpha
rei_version = 6.0.279-alpha

# check on maven at https://maven.terraformersmc.com/releases/com/terraformersmc/modmenu
modmenu_version = 2.0.2
modmenu_version = 2.0.14
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
8 changes: 4 additions & 4 deletions src/main/java/com/shnupbups/piglib/Piglib.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.shnupbups.piglib;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.tag.TagRegistry;
import net.fabricmc.fabric.api.tag.TagFactory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tag.ItemTags;
Expand All @@ -21,9 +21,9 @@ public static boolean shouldAdmire(ItemStack stack) {

@Override
public void onInitialize() {
PIGLIN_SAFE_ARMOR = TagRegistry.item(id("piglin_safe_armor"));
PIGLIN_LOVED_NUGGETS = TagRegistry.item(id("piglin_loved_nuggets"));
PIGLIN_BARTERING_ITEMS = TagRegistry.item(id("piglin_bartering_items"));
PIGLIN_SAFE_ARMOR = TagFactory.ITEM.create(id("piglin_safe_armor"));
PIGLIN_LOVED_NUGGETS = TagFactory.ITEM.create(id("piglin_loved_nuggets"));
PIGLIN_BARTERING_ITEMS = TagFactory.ITEM.create(id("piglin_bartering_items"));
}

public static Identifier id(String id) {
Expand Down
21 changes: 20 additions & 1 deletion src/main/java/com/shnupbups/piglib/rei/PiglibClientPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@
import me.shedaniel.rei.api.client.registry.display.DisplayRegistry;
import me.shedaniel.rei.api.common.util.CollectionUtils;
import me.shedaniel.rei.api.common.util.EntryIngredients;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.tag.BlockTags;
import net.minecraft.tag.ItemTags;

import java.util.ArrayList;
import java.util.List;

public class PiglibClientPlugin implements REIClientPlugin {
Expand All @@ -23,16 +27,19 @@ public void registerCategories(CategoryRegistry registry) {
new BarteringCategory(),
new PiglinLovedCategory(),
new PiglinSafeArmorCategory(),
new PiglinRepellentsCategory()
new PiglinRepellentsCategory(),
new GuardedByPiglinsCategory()
);
registry.removePlusButton(PiglibPlugin.BARTERING);
registry.removePlusButton(PiglibPlugin.PIGLIN_LOVED);
registry.removePlusButton(PiglibPlugin.PIGLIN_SAFE_ARMOR);
registry.removePlusButton(PiglibPlugin.PIGLIN_REPELLENTS);
registry.removePlusButton(PiglibPlugin.GUARDED_BY_PIGLINS);
registry.addWorkstations(PiglibPlugin.BARTERING, EntryIngredients.of(Items.PIGLIN_SPAWN_EGG));
registry.addWorkstations(PiglibPlugin.PIGLIN_LOVED, EntryIngredients.of(Items.PIGLIN_SPAWN_EGG));
registry.addWorkstations(PiglibPlugin.PIGLIN_SAFE_ARMOR, EntryIngredients.of(Items.PIGLIN_SPAWN_EGG));
registry.addWorkstations(PiglibPlugin.PIGLIN_REPELLENTS, EntryIngredients.of(Items.PIGLIN_SPAWN_EGG));
registry.addWorkstations(PiglibPlugin.GUARDED_BY_PIGLINS, EntryIngredients.of(Items.PIGLIN_SPAWN_EGG));
}

@Override
Expand All @@ -41,11 +48,23 @@ public void registerDisplays(DisplayRegistry registry) {
registry.add(new PiglinLovedDisplay(getPiglinLovedStacks()));
registry.add(new PiglinSafeArmorDisplay(CollectionUtils.map(Lists.newArrayList(Piglib.PIGLIN_SAFE_ARMOR.values()), ItemStack::new)));
registry.add(new PiglinRepellentsDisplay(CollectionUtils.map(Lists.newArrayList(ItemTags.PIGLIN_REPELLENTS.values()), ItemStack::new)));
registry.add(new GuardedByPiglinsDisplay(getGuardedByPiglinsStacks()));
}

public List<ItemStack> getPiglinLovedStacks() {
List<ItemStack> list = CollectionUtils.map(Lists.newArrayList(ItemTags.PIGLIN_LOVED.values()), ItemStack::new);
list.addAll(CollectionUtils.map(Lists.newArrayList(Piglib.PIGLIN_LOVED_NUGGETS.values()), (item) -> new ItemStack(item, 64)));
return list;
}

public List<ItemStack> getGuardedByPiglinsStacks() {
List<Item> list = new ArrayList<>();
for(Block b:BlockTags.GUARDED_BY_PIGLINS.values()) {
Item item = b.asItem();
if(!(item.equals(Items.AIR) || list.contains(item))) {
list.add(item);
}
}
return CollectionUtils.map(list, ItemStack::new);
}
}
2 changes: 2 additions & 0 deletions src/main/java/com/shnupbups/piglib/rei/PiglibPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ public class PiglibPlugin implements REIServerPlugin {
public static final CategoryIdentifier<PiglinLovedDisplay> PIGLIN_LOVED = CategoryIdentifier.of(Piglib.MOD_ID, "plugins/piglin_loved");
public static final CategoryIdentifier<PiglinSafeArmorDisplay> PIGLIN_SAFE_ARMOR = CategoryIdentifier.of(Piglib.MOD_ID, "plugins/piglin_safe_armor");
public static final CategoryIdentifier<PiglinRepellentsDisplay> PIGLIN_REPELLENTS = CategoryIdentifier.of(Piglib.MOD_ID, "plugins/piglin_repellents");
public static final CategoryIdentifier<GuardedByPiglinsDisplay> GUARDED_BY_PIGLINS = CategoryIdentifier.of(Piglib.MOD_ID, "plugins/guarded_by_piglins");

@Override
public void registerDisplaySerializer(DisplaySerializerRegistry registry) {
registry.register(BARTERING, PiglibDisplay.serializer(BarteringDisplay::new));
registry.register(PIGLIN_LOVED, PiglibDisplay.serializer(PiglinLovedDisplay::new));
registry.register(PIGLIN_SAFE_ARMOR, PiglibDisplay.serializer(PiglinSafeArmorDisplay::new));
registry.register(PIGLIN_REPELLENTS, PiglibDisplay.serializer(PiglinRepellentsDisplay::new));
registry.register(GUARDED_BY_PIGLINS, PiglibDisplay.serializer(GuardedByPiglinsDisplay::new));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,15 @@

package com.shnupbups.piglib.rei.category;

import com.google.common.collect.Lists;
import com.shnupbups.piglib.rei.PiglibPlugin;
import com.shnupbups.piglib.rei.ScrollableSlotsWidget;
import com.shnupbups.piglib.rei.display.BarteringDisplay;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.DisplayRenderer;
import me.shedaniel.rei.api.client.gui.Renderer;
import me.shedaniel.rei.api.client.gui.widgets.Widget;
import me.shedaniel.rei.api.client.gui.widgets.Widgets;
import me.shedaniel.rei.api.client.registry.display.DisplayCategory;
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.util.CollectionUtils;
import me.shedaniel.rei.api.common.util.EntryStacks;
import net.minecraft.block.Blocks;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.Items;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;

import java.util.List;

public class BarteringCategory extends PiglibCategory<BarteringDisplay> {
@Override
public CategoryIdentifier<? extends BarteringDisplay> getCategoryIdentifier() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* This file is licensed under the MIT License, part of Roughly Enough Items.
* Copyright (c) 2018, 2019, 2020, 2021 shedaniel
*
* 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.shnupbups.piglib.rei.category;

import com.shnupbups.piglib.rei.PiglibPlugin;
import com.shnupbups.piglib.rei.display.GuardedByPiglinsDisplay;
import com.shnupbups.piglib.rei.display.PiglinRepellentsDisplay;
import me.shedaniel.rei.api.client.gui.Renderer;
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.util.EntryStacks;
import net.minecraft.item.Items;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;

public class GuardedByPiglinsCategory extends PiglibCategory<GuardedByPiglinsDisplay> {
@Override
public CategoryIdentifier<? extends GuardedByPiglinsDisplay> getCategoryIdentifier() {
return PiglibPlugin.GUARDED_BY_PIGLINS;
}

@Override
public Text getTitle() {
return new TranslatableText("category.piglib.guarded_by_piglins");
}

@Override
public Renderer getIcon() {
return EntryStacks.of(Items.GOLD_BLOCK);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.google.common.collect.Lists;
import com.shnupbups.piglib.rei.ScrollableSlotsWidget;
import com.shnupbups.piglib.rei.display.BarteringDisplay;
import com.shnupbups.piglib.rei.display.PiglibDisplay;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,15 @@

package com.shnupbups.piglib.rei.category;

import com.google.common.collect.Lists;
import com.shnupbups.piglib.rei.PiglibPlugin;
import com.shnupbups.piglib.rei.ScrollableSlotsWidget;
import com.shnupbups.piglib.rei.display.BarteringDisplay;
import com.shnupbups.piglib.rei.display.PiglinLovedDisplay;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.DisplayRenderer;
import me.shedaniel.rei.api.client.gui.Renderer;
import me.shedaniel.rei.api.client.gui.widgets.Widget;
import me.shedaniel.rei.api.client.gui.widgets.Widgets;
import me.shedaniel.rei.api.client.registry.display.DisplayCategory;
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.util.CollectionUtils;
import me.shedaniel.rei.api.common.util.EntryStacks;
import net.minecraft.block.Blocks;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.Items;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;

import java.util.List;

public class PiglinLovedCategory extends PiglibCategory<PiglinLovedDisplay> {
@Override
public CategoryIdentifier<? extends PiglinLovedDisplay> getCategoryIdentifier() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,15 @@

package com.shnupbups.piglib.rei.category;

import com.google.common.collect.Lists;
import com.shnupbups.piglib.rei.PiglibPlugin;
import com.shnupbups.piglib.rei.ScrollableSlotsWidget;
import com.shnupbups.piglib.rei.display.PiglinLovedDisplay;
import com.shnupbups.piglib.rei.display.PiglinRepellentsDisplay;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.DisplayRenderer;
import me.shedaniel.rei.api.client.gui.Renderer;
import me.shedaniel.rei.api.client.gui.widgets.Widget;
import me.shedaniel.rei.api.client.gui.widgets.Widgets;
import me.shedaniel.rei.api.client.registry.display.DisplayCategory;
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.util.CollectionUtils;
import me.shedaniel.rei.api.common.util.EntryStacks;
import net.minecraft.block.Blocks;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.Items;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;

import java.util.List;

public class PiglinRepellentsCategory extends PiglibCategory<PiglinRepellentsDisplay> {
@Override
public CategoryIdentifier<? extends PiglinRepellentsDisplay> getCategoryIdentifier() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,15 @@

package com.shnupbups.piglib.rei.category;

import com.google.common.collect.Lists;
import com.shnupbups.piglib.rei.PiglibPlugin;
import com.shnupbups.piglib.rei.ScrollableSlotsWidget;
import com.shnupbups.piglib.rei.display.PiglinRepellentsDisplay;
import com.shnupbups.piglib.rei.display.PiglinSafeArmorDisplay;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.DisplayRenderer;
import me.shedaniel.rei.api.client.gui.Renderer;
import me.shedaniel.rei.api.client.gui.widgets.Widget;
import me.shedaniel.rei.api.client.gui.widgets.Widgets;
import me.shedaniel.rei.api.client.registry.display.DisplayCategory;
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.util.CollectionUtils;
import me.shedaniel.rei.api.common.util.EntryStacks;
import net.minecraft.block.Blocks;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.Items;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;

import java.util.List;

public class PiglinSafeArmorCategory extends PiglibCategory<PiglinSafeArmorDisplay> {
@Override
public CategoryIdentifier<? extends PiglinSafeArmorDisplay> getCategoryIdentifier() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* This file is licensed under the MIT License, part of Roughly Enough Items.
* Copyright (c) 2018, 2019, 2020, 2021 shedaniel
*
* 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.shnupbups.piglib.rei.display;

import com.shnupbups.piglib.rei.PiglibPlugin;
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.entry.EntryIngredient;
import net.minecraft.item.ItemStack;

import java.util.List;

public class GuardedByPiglinsDisplay extends PiglibDisplay {
public GuardedByPiglinsDisplay(List<ItemStack> entries) {
super(entries);
}

public GuardedByPiglinsDisplay(List<EntryIngredient> inputs, List<EntryIngredient> outputs) {
super(inputs, outputs);
}

@Override
public CategoryIdentifier<?> getCategoryIdentifier() {
return PiglibPlugin.GUARDED_BY_PIGLINS;
}
}
3 changes: 2 additions & 1 deletion src/main/resources/assets/piglib/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"category.piglib.bartering": "Bartering",
"category.piglib.piglin_safe_armor": "Piglin Safe Armor",
"category.piglib.piglin_loved": "Piglin Loved",
"category.piglib.piglin_repellents": "Piglin Repellents"
"category.piglib.piglin_repellents": "Piglin Repellents",
"category.piglib.guarded_by_piglins": "Guarded by Piglins"
}

0 comments on commit 4e68001

Please sign in to comment.