-
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.
- Loading branch information
1 parent
a5328d2
commit 3cced2c
Showing
12 changed files
with
197 additions
and
59 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
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
44 changes: 44 additions & 0 deletions
44
src/main/java/net/anawesomguy/carnivalfoods/item/ModifiedStickItem.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,44 @@ | ||
package net.anawesomguy.carnivalfoods.item; | ||
|
||
import net.anawesomguy.carnivalfoods.block.CottonCandyMachineBlock; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.item.ItemUsageContext; | ||
import net.minecraft.util.ActionResult; | ||
import net.minecraft.util.Hand; | ||
import net.minecraft.util.TypedActionResult; | ||
import net.minecraft.world.RaycastContext; | ||
import net.minecraft.world.World; | ||
|
||
public class ModifiedStickItem extends Item { | ||
public ModifiedStickItem(Settings settings) { | ||
super(settings); | ||
} | ||
|
||
@Override | ||
public int getMaxUseTime(ItemStack stack, LivingEntity user) { | ||
return CottonCandyMachineBlock.TOTAL_TIME; | ||
} | ||
|
||
@Override | ||
public void usageTick(World world, LivingEntity user, ItemStack stack, int remainingUseTicks) { | ||
super.usageTick(world, user, stack, remainingUseTicks); | ||
} | ||
|
||
@Override | ||
public ActionResult useOnBlock(ItemUsageContext context) { | ||
return ActionResult.SUCCESS; | ||
} | ||
|
||
@Override | ||
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) { | ||
ItemStack stack = user.getStackInHand(hand); | ||
user.setCurrentHand(hand); | ||
return new TypedActionResult<>( | ||
useOnBlock(new ItemUsageContext(world, user, hand, stack, | ||
raycast(world, user, RaycastContext.FluidHandling.NONE) | ||
)), stack); | ||
} | ||
} |
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.