generated from SmushyTaco/Example-Mod
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
164 changed files
with
4,305 additions
and
4,165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,7 @@ jobs: | |
- name: JDK setup | ||
uses: actions/[email protected] | ||
with: | ||
java-version: 17 | ||
java-version: 21 | ||
distribution: temurin | ||
- name: Build project | ||
if: inputs.build-project | ||
|
@@ -91,7 +91,7 @@ jobs: | |
NeoForgeMod/build/libs/*.jar | ||
if-no-files-found: error | ||
- name: Upload Forge jars | ||
if: inputs.build-project && inputs.upload-output | ||
if: inputs.build-project && inputs.upload-output && false | ||
uses: actions/[email protected] | ||
with: | ||
name: forge-jars | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ jobs: | |
name: neoforge-jars | ||
path: dist/neoforge | ||
- name: Download Forge jars | ||
if: false | ||
uses: actions/[email protected] | ||
with: | ||
name: forge-jars | ||
|
@@ -95,6 +96,7 @@ jobs: | |
game-version-filter: releases | ||
java: ${{ steps.load-java-version.outputs.value }} | ||
- name: Publish Forge mod to Modrinth and CurseForge | ||
if: false | ||
uses: Kir-Antipov/[email protected] | ||
with: | ||
modrinth-id: ${{ vars.MODRINTH_ID }} | ||
|
@@ -123,16 +125,13 @@ jobs: | |
dist/fabric/*-@(dev|sources|javadoc).jar | ||
dist/neoforge/!(*-@(dev|sources|javadoc)).jar | ||
dist/neoforge/*-@(dev|sources|javadoc).jar | ||
dist/forge/!(*-@(dev|sources|javadoc)).jar | ||
dist/forge/*-@(dev|sources|javadoc).jar | ||
changelog-file: CHANGELOG.g.md | ||
- name: Delete build output | ||
uses: geekyeggo/[email protected] | ||
with: | ||
name: | | ||
fabric-jars | ||
neoforge-jars | ||
forge-jars | ||
useGlob: false | ||
failOnError: false | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
FabricMod/src/main/java/opekope2/avm_staff/mixin/fabric/LivingEntityMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* AvM Staff Mod | ||
* Copyright (c) 2024 opekope2 | ||
* | ||
* This mod is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This mod is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this mod. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package opekope2.avm_staff.mixin.fabric; | ||
|
||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.Hand; | ||
import net.minecraft.world.World; | ||
import opekope2.avm_staff.api.StaffMod; | ||
import opekope2.avm_staff.api.staff.StaffHandler; | ||
import opekope2.avm_staff.util.StaffUtil; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(LivingEntity.class) | ||
public abstract class LivingEntityMixin extends Entity { | ||
private LivingEntityMixin(EntityType<?> type, World world) { | ||
super(type, world); | ||
} | ||
|
||
@Shadow | ||
public abstract ItemStack getMainHandStack(); | ||
|
||
@Shadow | ||
public abstract ItemStack getStackInHand(Hand hand); | ||
|
||
@Inject(method = "disablesShield", at = @At("HEAD"), cancellable = true) | ||
public void disableShield(CallbackInfoReturnable<Boolean> cir) { | ||
ItemStack mainHandStack = getMainHandStack(); | ||
if (!mainHandStack.isIn(StaffMod.getStaffsTag())) return; | ||
|
||
Item itemInStaff = StaffUtil.getItemInStaff(mainHandStack); | ||
if (itemInStaff == null) return; | ||
|
||
StaffHandler handlerOfItem = StaffUtil.getStaffHandlerOrDefault(itemInStaff); | ||
if (handlerOfItem.disablesShield()) { | ||
cir.setReturnValue(true); | ||
} | ||
} | ||
|
||
@SuppressWarnings("UnreachableCode") // Calm down IDEA, this is not what it looks like. Literally | ||
@Inject(method = "swingHand(Lnet/minecraft/util/Hand;Z)V", at = @At("HEAD"), cancellable = true) | ||
public void swingHand(Hand hand, boolean fromServerPlayer, CallbackInfo ci) { | ||
ItemStack stackInHand = getStackInHand(hand); | ||
if (stackInHand.isEmpty()) return; | ||
if (!stackInHand.isIn(StaffMod.getStaffsTag())) return; | ||
|
||
Item itemInStaff = StaffUtil.getItemInStaff(stackInHand); | ||
if (itemInStaff == null) return; | ||
|
||
StaffHandler handlerOfItem = StaffUtil.getStaffHandlerOrDefault(itemInStaff); | ||
if (!handlerOfItem.canSwingHand(stackInHand, getEntityWorld(), (LivingEntity) (Object) this, hand)) { | ||
ci.cancel(); | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
FabricMod/src/main/java/opekope2/avm_staff/mixin/fabric/PiglinBrainMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* AvM Staff Mod | ||
* Copyright (c) 2024 opekope2 | ||
* | ||
* This mod is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This mod is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this mod. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package opekope2.avm_staff.mixin.fabric; | ||
|
||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.mob.PiglinBrain; | ||
import net.minecraft.item.ItemStack; | ||
import opekope2.avm_staff.api.item.CrownItem; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(PiglinBrain.class) | ||
public abstract class PiglinBrainMixin { | ||
@Inject(method = "wearsGoldArmor", at = @At("HEAD"), cancellable = true) | ||
private static void wearsGoldArmor(LivingEntity entity, CallbackInfoReturnable<Boolean> cir) { | ||
for (ItemStack armorStack : entity.getArmorItems()) { | ||
if (armorStack.getItem() instanceof CrownItem) { | ||
cir.setReturnValue(true); | ||
return; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.