-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v2.0.1 - Adjust how status effects are handled by foods (again)
- Loading branch information
1 parent
156e447
commit 6a22ef8
Showing
78 changed files
with
300 additions
and
318 deletions.
There are no files selected for viewing
22 changes: 21 additions & 1 deletion
22
src/main/java/net/dakotapride/garnished/item/AnniversaryCakeSliceFoodItem.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 |
---|---|---|
@@ -1,9 +1,29 @@ | ||
package net.dakotapride.garnished.item; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
import net.dakotapride.garnished.registry.GarnishedFoodValues; | ||
import net.minecraft.advancements.CriteriaTriggers; | ||
import net.minecraft.server.level.ServerPlayer; | ||
import net.minecraft.world.entity.LivingEntity; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.level.Level; | ||
|
||
public class AnniversaryCakeSliceFoodItem extends FarmersDelightItem { | ||
public class AnniversaryCakeSliceFoodItem extends FarmersDelightItem implements IGarnishedUtilities{ | ||
public AnniversaryCakeSliceFoodItem(Properties properties) { | ||
super(properties.food(GarnishedFoodValues.ANNIVERSARY_CAKE_SLICE)); | ||
} | ||
|
||
@Override | ||
public @NotNull ItemStack finishUsingItem(@NotNull ItemStack stack, @NotNull Level world, @NotNull LivingEntity entity) { | ||
Player playerentity = entity instanceof Player ? (Player) entity : null; | ||
if (playerentity instanceof ServerPlayer) | ||
CriteriaTriggers.CONSUME_ITEM.trigger((ServerPlayer) playerentity, stack); | ||
|
||
if (!world.isClientSide) | ||
entity.addEffect(triggerConditionalEffect(0, 1.0F)); | ||
|
||
return super.finishUsingItem(stack, world, entity); | ||
} | ||
} |
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
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: 21 additions & 1 deletion
22
src/main/java/net/dakotapride/garnished/item/BrowniePieceFoodItem.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 |
---|---|---|
@@ -1,9 +1,29 @@ | ||
package net.dakotapride.garnished.item; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
import net.dakotapride.garnished.registry.GarnishedFoodValues; | ||
import net.minecraft.advancements.CriteriaTriggers; | ||
import net.minecraft.server.level.ServerPlayer; | ||
import net.minecraft.world.entity.LivingEntity; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.level.Level; | ||
|
||
public class BrowniePieceFoodItem extends FarmersDelightItem { | ||
public class BrowniePieceFoodItem extends FarmersDelightItem implements IGarnishedUtilities{ | ||
public BrowniePieceFoodItem(Properties properties) { | ||
super(properties.food(GarnishedFoodValues.BROWNIE_PIECE)); | ||
} | ||
|
||
@Override | ||
public @NotNull ItemStack finishUsingItem(@NotNull ItemStack stack, @NotNull Level world, @NotNull LivingEntity entity) { | ||
Player playerentity = entity instanceof Player ? (Player) entity : null; | ||
if (playerentity instanceof ServerPlayer) | ||
CriteriaTriggers.CONSUME_ITEM.trigger((ServerPlayer) playerentity, stack); | ||
|
||
if (!world.isClientSide) | ||
entity.addEffect(triggerConditionalEffect(0, 0.25F)); | ||
|
||
return super.finishUsingItem(stack, world, entity); | ||
} | ||
} |
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
5 changes: 2 additions & 3 deletions
5
src/main/java/net/dakotapride/garnished/item/CashewSorbetScoopFoodItem.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 |
---|---|---|
@@ -1,10 +1,9 @@ | ||
package net.dakotapride.garnished.item; | ||
|
||
import net.dakotapride.garnished.registry.GarnishedFoodValues; | ||
import net.minecraft.world.item.Item; | ||
|
||
public class CashewSorbetScoopFoodItem extends Item implements IGarnishedUtilities { | ||
public class CashewSorbetScoopFoodItem extends ConditionalEffectItem implements IGarnishedUtilities { | ||
public CashewSorbetScoopFoodItem(Properties properties) { | ||
super(properties.food(GarnishedFoodValues.CASHEW_SORBET_SCOOP)); | ||
super(0, 0.65F, properties.food(GarnishedFoodValues.CASHEW_SORBET_SCOOP)); | ||
} | ||
} |
5 changes: 2 additions & 3 deletions
5
src/main/java/net/dakotapride/garnished/item/ChampionsOmeletteFoodItem.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 |
---|---|---|
@@ -1,10 +1,9 @@ | ||
package net.dakotapride.garnished.item; | ||
|
||
import net.dakotapride.garnished.registry.GarnishedFoodValues; | ||
import net.minecraft.world.item.Item; | ||
|
||
public class ChampionsOmeletteFoodItem extends Item implements IGarnishedUtilities { | ||
public class ChampionsOmeletteFoodItem extends ConditionalEffectItem implements IGarnishedUtilities { | ||
public ChampionsOmeletteFoodItem(Properties properties) { | ||
super(properties.food(GarnishedFoodValues.CHAMPIONS_OMELETTE).stacksTo(16)); | ||
super(3, 1.0F, properties.food(GarnishedFoodValues.CHAMPIONS_OMELETTE).stacksTo(16)); | ||
} | ||
} |
5 changes: 2 additions & 3 deletions
5
src/main/java/net/dakotapride/garnished/item/ChilledAppleFoodItem.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 |
---|---|---|
@@ -1,10 +1,9 @@ | ||
package net.dakotapride.garnished.item; | ||
|
||
import net.dakotapride.garnished.registry.GarnishedFoodValues; | ||
import net.minecraft.world.item.Item; | ||
|
||
public class ChilledAppleFoodItem extends Item implements IGarnishedUtilities { | ||
public class ChilledAppleFoodItem extends ConditionalEffectItem implements IGarnishedUtilities { | ||
public ChilledAppleFoodItem(Properties properties) { | ||
super(properties.food(GarnishedFoodValues.CHILLED_APPLE)); | ||
super(1, 0.50F, properties.food(GarnishedFoodValues.CHILLED_APPLE)); | ||
} | ||
} |
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
5 changes: 2 additions & 3 deletions
5
src/main/java/net/dakotapride/garnished/item/CinderRollFoodItem.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 |
---|---|---|
@@ -1,10 +1,9 @@ | ||
package net.dakotapride.garnished.item; | ||
|
||
import net.dakotapride.garnished.registry.GarnishedFoodValues; | ||
import net.minecraft.world.item.Item; | ||
|
||
public class CinderRollFoodItem extends Item implements IGarnishedUtilities { | ||
public class CinderRollFoodItem extends ConditionalEffectItem implements IGarnishedUtilities { | ||
public CinderRollFoodItem(Properties properties) { | ||
super(properties.food(GarnishedFoodValues.CINDER_ROLL).stacksTo(16)); | ||
super(5, 1.0F, properties.food(GarnishedFoodValues.CINDER_ROLL).stacksTo(16)); | ||
} | ||
} |
5 changes: 2 additions & 3 deletions
5
src/main/java/net/dakotapride/garnished/item/CoalTruffleFoodItem.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 |
---|---|---|
@@ -1,11 +1,10 @@ | ||
package net.dakotapride.garnished.item; | ||
|
||
import net.dakotapride.garnished.registry.GarnishedFoodValues; | ||
import net.minecraft.world.item.Item; | ||
|
||
public class CoalTruffleFoodItem extends Item implements IGarnishedUtilities { | ||
public class CoalTruffleFoodItem extends ConditionalEffectItem implements IGarnishedUtilities { | ||
|
||
public CoalTruffleFoodItem(Properties properties) { | ||
super(properties.stacksTo(16).food(GarnishedFoodValues.COAL_TRUFFLE)); | ||
super(0, 0.80F, properties.stacksTo(16).food(GarnishedFoodValues.COAL_TRUFFLE)); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/main/java/net/dakotapride/garnished/item/ConditionalEffectItem.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 net.dakotapride.garnished.item; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
import net.minecraft.advancements.CriteriaTriggers; | ||
import net.minecraft.server.level.ServerPlayer; | ||
import net.minecraft.world.entity.LivingEntity; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.item.Item; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.level.Level; | ||
|
||
public class ConditionalEffectItem extends Item implements IGarnishedUtilities { | ||
int value; | ||
float chance; | ||
|
||
public ConditionalEffectItem(int value, float chance, Properties pProperties) { | ||
super(pProperties); | ||
this.value = value; | ||
this.chance = chance; | ||
} | ||
|
||
@Override | ||
public @NotNull ItemStack finishUsingItem(@NotNull ItemStack stack, @NotNull Level world, @NotNull LivingEntity entity) { | ||
Player playerentity = entity instanceof Player ? (Player) entity : null; | ||
if (playerentity instanceof ServerPlayer) | ||
CriteriaTriggers.CONSUME_ITEM.trigger((ServerPlayer) playerentity, stack); | ||
|
||
if (!world.isClientSide) | ||
entity.addEffect(triggerConditionalEffect(value, chance)); | ||
|
||
return super.finishUsingItem(stack, world, entity); | ||
} | ||
|
||
} |
5 changes: 2 additions & 3 deletions
5
src/main/java/net/dakotapride/garnished/item/CookedPolarBearMeatItem.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 |
---|---|---|
@@ -1,11 +1,10 @@ | ||
package net.dakotapride.garnished.item; | ||
|
||
import net.dakotapride.garnished.registry.GarnishedFoodValues; | ||
import net.minecraft.world.item.Item; | ||
|
||
public class CookedPolarBearMeatItem extends Item implements IGarnishedUtilities { | ||
public class CookedPolarBearMeatItem extends ConditionalEffectItem implements IGarnishedUtilities { | ||
public CookedPolarBearMeatItem(Properties properties) { | ||
super(properties.food(GarnishedFoodValues.COOKED_POLAR_BEAR_MEAT)); | ||
super(1, 0.35F, properties.food(GarnishedFoodValues.COOKED_POLAR_BEAR_MEAT)); | ||
} | ||
|
||
} |
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
Oops, something went wrong.