-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from rotgruengelb/1.20.2-dev
3.0.0 for 1.20.2
- Loading branch information
Showing
13 changed files
with
162 additions
and
77 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
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
22 changes: 0 additions & 22 deletions
22
...main/java/net/rotgruengelb/quirl/api/mechanic/interact/axe/v1/CustomAxeBlockInteract.java
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
...n/java/net/rotgruengelb/quirl/api/mechanic/interact/onblock/AxeBlockInteractRegistry.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,22 @@ | ||
package net.rotgruengelb.quirl.api.mechanic.interact.onblock; | ||
|
||
import net.minecraft.block.BlockState; | ||
import net.minecraft.sound.SoundCategory; | ||
import net.minecraft.sound.SoundEvent; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class AxeBlockInteractRegistry { | ||
|
||
private static final Map<BlockState, ToolBlockInteractResult> REG = new HashMap<>(); | ||
|
||
public static void register(BlockState starting_blockstate, BlockState new_blockstate, SoundEvent sound_event, SoundCategory sound_category) { | ||
REG.put(starting_blockstate, new ToolBlockInteractResult(new_blockstate, sound_event, sound_category, false)); | ||
} | ||
|
||
public static @Nullable ToolBlockInteractResult getResult(BlockState blockState) { | ||
return REG.get(blockState); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...ava/net/rotgruengelb/quirl/api/mechanic/interact/onblock/ShovelBlockInteractRegistry.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,26 @@ | ||
package net.rotgruengelb.quirl.api.mechanic.interact.onblock; | ||
|
||
import net.minecraft.block.BlockState; | ||
import net.minecraft.sound.SoundCategory; | ||
import net.minecraft.sound.SoundEvent; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class ShovelBlockInteractRegistry { | ||
|
||
private static final Map<BlockState, ToolBlockInteractResult> REG = new HashMap<>(); | ||
|
||
public static void register(BlockState starting_blockstate, BlockState new_blockstate, SoundEvent sound_event, SoundCategory sound_category) { | ||
REG.put(starting_blockstate, new ToolBlockInteractResult(new_blockstate, sound_event, sound_category, false)); | ||
} | ||
|
||
public static void register(BlockState starting_blockstate, BlockState new_blockstate, SoundEvent sound_event, SoundCategory sound_category, Boolean disable_surrounding_checks) { | ||
REG.put(starting_blockstate, new ToolBlockInteractResult(new_blockstate, sound_event, sound_category, disable_surrounding_checks)); | ||
} | ||
|
||
public static @Nullable ToolBlockInteractResult getResult(BlockState blockState) { | ||
return REG.get(blockState); | ||
} | ||
} |
10 changes: 5 additions & 5 deletions
10
...ct/result/v1/ToolBlockInteractResult.java → ...ract/onblock/ToolBlockInteractResult.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
22 changes: 0 additions & 22 deletions
22
...ava/net/rotgruengelb/quirl/api/mechanic/interact/shovel/v1/CustomShovelBlockInteract.java
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
src/main/java/net/rotgruengelb/quirl/lib/feature/item/HasCustomArmPose.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,16 @@ | ||
package net.rotgruengelb.quirl.lib.feature.item; | ||
|
||
import net.fabricmc.api.Environment; | ||
import net.minecraft.client.model.ModelPart; | ||
import net.minecraft.entity.LivingEntity; | ||
|
||
/** | ||
* This interface is used to add custom arm poses to items. <br> | ||
* The methods positionRightArm and positionLeftArm are called by the mixin BipedEntityModelMixin. | ||
*/ | ||
@Environment(net.fabricmc.api.EnvType.CLIENT) | ||
public interface HasCustomArmPose { | ||
void positionRightArm(ModelPart rightArm, LivingEntity entity, ModelPart head, ModelPart hat, ModelPart body, ModelPart leftArm, ModelPart rightLeg, ModelPart leftLeg); | ||
|
||
void positionLeftArm(ModelPart leftArm, LivingEntity entity, ModelPart head, ModelPart hat, ModelPart body, ModelPart rightArm, ModelPart rightLeg, ModelPart leftLeg); | ||
} |
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
63 changes: 63 additions & 0 deletions
63
src/main/java/net/rotgruengelb/quirl/mixin/BipedEntityModelMixin.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,63 @@ | ||
package net.rotgruengelb.quirl.mixin; | ||
|
||
import net.fabricmc.api.Environment; | ||
import net.minecraft.client.model.ModelPart; | ||
import net.minecraft.client.render.entity.model.BipedEntityModel; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.item.Item; | ||
import net.rotgruengelb.quirl.lib.feature.item.HasCustomArmPose; | ||
import org.spongepowered.asm.mixin.Final; | ||
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; | ||
|
||
@Environment(net.fabricmc.api.EnvType.CLIENT) | ||
@Mixin(BipedEntityModel.class) | ||
public class BipedEntityModelMixin { | ||
|
||
@Shadow | ||
@Final | ||
public ModelPart rightArm; | ||
|
||
@Shadow | ||
@Final | ||
public ModelPart head; | ||
|
||
@Shadow | ||
@Final | ||
public ModelPart leftArm; | ||
|
||
@Shadow | ||
@Final | ||
public ModelPart hat; | ||
|
||
@Shadow | ||
@Final | ||
public ModelPart body; | ||
|
||
@Shadow | ||
@Final | ||
public ModelPart leftLeg; | ||
|
||
@Shadow | ||
@Final | ||
public ModelPart rightLeg; | ||
|
||
@Inject(at = @At(value = "TAIL"), method = "positionRightArm") | ||
void positionRightArm(LivingEntity entity, CallbackInfo ci) { | ||
Item activeItem = entity.getActiveItem().getItem(); | ||
if (activeItem instanceof HasCustomArmPose) { | ||
((HasCustomArmPose) activeItem).positionRightArm(this.rightArm, entity, this.head, this.hat, this.body, this.leftArm, this.rightLeg, this.leftLeg); | ||
} | ||
} | ||
|
||
@Inject(at = @At(value = "TAIL"), method = "positionLeftArm") | ||
void positionLeftArm(LivingEntity entity, CallbackInfo ci) { | ||
Item activeItem = entity.getActiveItem().getItem(); | ||
if (activeItem instanceof HasCustomArmPose) { | ||
((HasCustomArmPose) activeItem).positionLeftArm(this.leftArm, entity, this.head, this.hat, this.body, this.rightArm, this.rightLeg, this.leftLeg); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,8 @@ | |
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
}, | ||
"client": [ | ||
"BipedEntityModelMixin" | ||
] | ||
} |