From a228c7804ee1009b6af4f69113445dd2f3ee2b24 Mon Sep 17 00:00:00 2001 From: lublak <44057030+lublak@users.noreply.github.com> Date: Tue, 30 Mar 2021 02:19:39 +0200 Subject: [PATCH 1/2] apple slice tag --- build.gradle | 40 +++++++++---------- .../common/entites/LizardEntity.java | 12 +++++- .../data/cnb/tags/items/apple_slice.json | 6 +++ 3 files changed, 36 insertions(+), 22 deletions(-) create mode 100644 src/main/resources/data/cnb/tags/items/apple_slice.json diff --git a/build.gradle b/build.gradle index 93d7ebf..cf9c4f1 100644 --- a/build.gradle +++ b/build.gradle @@ -144,23 +144,23 @@ processResources { } } -curseforge { - def curseProp = new Properties() - File secretPropsFile = file("key.properties") - curseProp.load(secretPropsFile.newInputStream()) - - project { - apiKey = curseProp.getProperty('curseKey') - id = "414401" - releaseType = "release" - changelogType = 'html' - changelog = '

Big Changes!

' - addGameVersion("1.16.4") - addGameVersion("Forge") - addGameVersion("Java 8") - - relations { - requiredDependency 'geckolib' - } - } -} +//curseforge { +// def curseProp = new Properties() +// File secretPropsFile = file("key.properties") +// curseProp.load(secretPropsFile.newInputStream()) +// +// project { +// apiKey = curseProp.getProperty('curseKey') +// id = "414401" +// releaseType = "release" +// changelogType = 'html' +// changelog = '

Big Changes!

' +// addGameVersion("1.16.4") +// addGameVersion("Forge") +// addGameVersion("Java 8") +// +// relations { +// requiredDependency 'geckolib' +// } +// } +//} diff --git a/src/main/java/com/cgessinger/creaturesandbeasts/common/entites/LizardEntity.java b/src/main/java/com/cgessinger/creaturesandbeasts/common/entites/LizardEntity.java index b70f3c0..0f24f2f 100644 --- a/src/main/java/com/cgessinger/creaturesandbeasts/common/entites/LizardEntity.java +++ b/src/main/java/com/cgessinger/creaturesandbeasts/common/entites/LizardEntity.java @@ -52,6 +52,9 @@ import software.bernie.geckolib3.core.event.predicate.AnimationEvent; import software.bernie.geckolib3.core.manager.AnimationData; import software.bernie.geckolib3.core.manager.AnimationFactory; +import com.cgessinger.creaturesandbeasts.CreaturesAndBeasts; +import net.minecraft.tags.ITag; +import net.minecraft.tags.ItemTags; import javax.annotation.Nullable; import java.util.Arrays; @@ -62,6 +65,8 @@ public class LizardEntity extends AnimalEntity implements IAnimatable, IModNetable, IAnimationHolder { + private final ResourceLocation APPLE_SLICE = new ResourceLocation(CreaturesAndBeasts.MOD_ID, "apple_slice"); + private final AnimationFactory factory = new AnimationFactory( this ); private static final DataParameter PARTYING = @@ -218,7 +223,9 @@ public ActionResultType func_230254_b_( PlayerEntity player, Hand hand ) // on r { ActionResultType result = super.func_230254_b_( player, hand ); ItemStack item = player.getHeldItem( hand ); - if ( item.getItem() instanceof AppleSliceItem && this.isSad() ) + ITag apple_slice = ItemTags.getCollection().get(APPLE_SLICE); + boolean has_slices = apple_slice == null ? item.getItem() instanceof AppleSliceItem : apple_slice.contains(item.getItem()); + if( has_slices && this.isSad() ) { this.setSad( false ); item.shrink( player.abilities.isCreativeMode ? 0 : 1 ); @@ -346,7 +353,8 @@ public boolean shouldLookAround() @Override public boolean isBreedingItem( ItemStack stack ) { - return stack.getItem() instanceof AppleSliceItem; + ITag apple_slice = ItemTags.getCollection().get(APPLE_SLICE); + return apple_slice == null ? stack.getItem() instanceof AppleSliceItem : apple_slice.contains(stack.getItem()); } public void spawnParticles( IParticleData data ) diff --git a/src/main/resources/data/cnb/tags/items/apple_slice.json b/src/main/resources/data/cnb/tags/items/apple_slice.json new file mode 100644 index 0000000..8bff87f --- /dev/null +++ b/src/main/resources/data/cnb/tags/items/apple_slice.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "cnb:apple_slice" + ] +} \ No newline at end of file From d4be4a3473da479fcaaee3d4e59a05c316939b48 Mon Sep 17 00:00:00 2001 From: lublak <44057030+lublak@users.noreply.github.com> Date: Tue, 30 Mar 2021 02:21:29 +0200 Subject: [PATCH 2/2] revert changes for testing --- build.gradle | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/build.gradle b/build.gradle index cf9c4f1..93d7ebf 100644 --- a/build.gradle +++ b/build.gradle @@ -144,23 +144,23 @@ processResources { } } -//curseforge { -// def curseProp = new Properties() -// File secretPropsFile = file("key.properties") -// curseProp.load(secretPropsFile.newInputStream()) -// -// project { -// apiKey = curseProp.getProperty('curseKey') -// id = "414401" -// releaseType = "release" -// changelogType = 'html' -// changelog = '

Big Changes!

' -// addGameVersion("1.16.4") -// addGameVersion("Forge") -// addGameVersion("Java 8") -// -// relations { -// requiredDependency 'geckolib' -// } -// } -//} +curseforge { + def curseProp = new Properties() + File secretPropsFile = file("key.properties") + curseProp.load(secretPropsFile.newInputStream()) + + project { + apiKey = curseProp.getProperty('curseKey') + id = "414401" + releaseType = "release" + changelogType = 'html' + changelog = '

Big Changes!

' + addGameVersion("1.16.4") + addGameVersion("Forge") + addGameVersion("Java 8") + + relations { + requiredDependency 'geckolib' + } + } +}