-
Notifications
You must be signed in to change notification settings - Fork 20
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
7 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
common/src/main/java/muramasa/antimatter/behaviour/IInteractEntity.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 muramasa.antimatter.behaviour; | ||
|
||
import net.minecraft.world.InteractionHand; | ||
import net.minecraft.world.InteractionResult; | ||
import net.minecraft.world.entity.LivingEntity; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.item.ItemStack; | ||
|
||
public interface IInteractEntity<T> extends IBehaviour<T> { | ||
@Override | ||
default String getId() { | ||
return "interact_entity"; | ||
} | ||
|
||
InteractionResult interactLivingEntity(T instance, ItemStack stack, Player player, LivingEntity interactionTarget, InteractionHand usedHand); | ||
} |
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
35 changes: 35 additions & 0 deletions
35
common/src/main/java/muramasa/antimatter/tool/behaviour/BehaviourShearing.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,35 @@ | ||
package muramasa.antimatter.tool.behaviour; | ||
|
||
import muramasa.antimatter.behaviour.IInteractEntity; | ||
import muramasa.antimatter.behaviour.IItemUse; | ||
import muramasa.antimatter.tool.IAntimatterTool; | ||
import net.minecraft.sounds.SoundSource; | ||
import net.minecraft.world.InteractionHand; | ||
import net.minecraft.world.InteractionResult; | ||
import net.minecraft.world.entity.LivingEntity; | ||
import net.minecraft.world.entity.animal.Sheep; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.context.UseOnContext; | ||
import net.minecraft.world.level.gameevent.GameEvent; | ||
|
||
public class BehaviourShearing implements IInteractEntity<IAntimatterTool> { | ||
public static final BehaviourShearing INSTANCE = new BehaviourShearing(); | ||
@Override | ||
public String getId() { | ||
return "shearing"; | ||
} | ||
|
||
@Override | ||
public InteractionResult interactLivingEntity(IAntimatterTool instance, ItemStack stack, Player player, LivingEntity interactionTarget, InteractionHand usedHand) { | ||
if (!player.getLevel().isClientSide && interactionTarget instanceof Sheep sheep && sheep.readyForShearing()){ | ||
sheep.shear(SoundSource.PLAYERS); | ||
sheep.gameEvent(GameEvent.SHEAR, player); | ||
stack.hurtAndBreak(1, player, (playerx) -> { | ||
playerx.broadcastBreakEvent(usedHand); | ||
}); | ||
return InteractionResult.SUCCESS; | ||
} | ||
return InteractionResult.PASS; | ||
} | ||
} |
Binary file added
BIN
+214 Bytes
...on/src/main/resources/assets/antimatter/textures/item/tool/overlay/scissors.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+300 Bytes
common/src/main/resources/assets/antimatter/textures/item/tool/scissors.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.