generated from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Shulk origin, gave particles to Enderian
- Loading branch information
Showing
13 changed files
with
252 additions
and
3 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
28 changes: 28 additions & 0 deletions
28
src/main/java/io/github/apace100/origins/power/HudRenderedVariableIntPower.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,28 @@ | ||
package io.github.apace100.origins.power; | ||
|
||
import net.minecraft.entity.player.PlayerEntity; | ||
|
||
public class HudRenderedVariableIntPower extends VariableIntPower implements HudRendered { | ||
|
||
private final int barIndex; | ||
|
||
public HudRenderedVariableIntPower(PowerType<?> type, PlayerEntity player, int barIndex, int startValue, int min, int max) { | ||
super(type, player, startValue, min, max); | ||
this.barIndex = barIndex; | ||
} | ||
|
||
@Override | ||
public int getBarIndex() { | ||
return barIndex; | ||
} | ||
|
||
@Override | ||
public float getFill() { | ||
return (this.getValue() - this.getMin()) / (float)(this.getMax() - this.getMin()); | ||
} | ||
|
||
@Override | ||
public boolean shouldRender() { | ||
return true; | ||
} | ||
} |
95 changes: 95 additions & 0 deletions
95
src/main/java/io/github/apace100/origins/power/InventoryPower.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,95 @@ | ||
package io.github.apace100.origins.power; | ||
|
||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.inventory.Inventories; | ||
import net.minecraft.inventory.Inventory; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.nbt.CompoundTag; | ||
import net.minecraft.nbt.Tag; | ||
import net.minecraft.screen.Generic3x3ContainerScreenHandler; | ||
import net.minecraft.screen.SimpleNamedScreenHandlerFactory; | ||
import net.minecraft.text.TranslatableText; | ||
import net.minecraft.util.collection.DefaultedList; | ||
|
||
public class InventoryPower extends Power implements Active, Inventory { | ||
|
||
private static final int SIZE = 3 * 3; | ||
private DefaultedList<ItemStack> inventory; | ||
private TranslatableText containerName; | ||
|
||
public InventoryPower(PowerType<?> type, PlayerEntity player, String containerName) { | ||
super(type, player); | ||
this.inventory = DefaultedList.ofSize(SIZE, ItemStack.EMPTY); | ||
this.containerName = new TranslatableText(containerName); | ||
} | ||
|
||
@Override | ||
public void onUse() { | ||
if(!player.world.isClient) { | ||
player.openHandledScreen(new SimpleNamedScreenHandlerFactory((i, playerInventory, playerEntity) -> { | ||
return new Generic3x3ContainerScreenHandler(i, playerInventory, this); | ||
}, containerName)); | ||
} | ||
} | ||
|
||
@Override | ||
public Tag toTag() { | ||
CompoundTag tag = new CompoundTag(); | ||
Inventories.toTag(tag, inventory); | ||
return tag; | ||
} | ||
|
||
@Override | ||
public void fromTag(Tag tag) { | ||
Inventories.fromTag((CompoundTag)tag, inventory); | ||
} | ||
|
||
@Override | ||
public int size() { | ||
return SIZE; | ||
} | ||
|
||
@Override | ||
public boolean isEmpty() { | ||
return inventory.isEmpty(); | ||
} | ||
|
||
@Override | ||
public ItemStack getStack(int slot) { | ||
return inventory.get(slot); | ||
} | ||
|
||
@Override | ||
public ItemStack removeStack(int slot, int amount) { | ||
return inventory.get(slot).split(amount); | ||
} | ||
|
||
@Override | ||
public ItemStack removeStack(int slot) { | ||
ItemStack stack = inventory.get(slot); | ||
setStack(slot, ItemStack.EMPTY); | ||
return stack; | ||
} | ||
|
||
@Override | ||
public void setStack(int slot, ItemStack stack) { | ||
inventory.set(slot, stack); | ||
} | ||
|
||
@Override | ||
public void markDirty() { | ||
|
||
} | ||
|
||
@Override | ||
public boolean canPlayerUse(PlayerEntity player) { | ||
return player == this.player; | ||
} | ||
|
||
@Override | ||
public void clear() { | ||
for(int i = 0; i < SIZE; i++) { | ||
setStack(i, ItemStack.EMPTY); | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/io/github/apace100/origins/power/ModifyExhaustionPower.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,10 @@ | ||
package io.github.apace100.origins.power; | ||
|
||
import net.minecraft.entity.player.PlayerEntity; | ||
|
||
public class ModifyExhaustionPower extends FloatPower { | ||
|
||
public ModifyExhaustionPower(PowerType<?> type, PlayerEntity player, float exhaustionMultiplier) { | ||
super(type, player, exhaustionMultiplier); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/io/github/apace100/origins/power/ModifyFoodPower.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,34 @@ | ||
package io.github.apace100.origins.power; | ||
|
||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.item.FoodComponent; | ||
import net.minecraft.item.ItemStack; | ||
|
||
import java.util.function.Function; | ||
import java.util.function.Predicate; | ||
|
||
public class ModifyFoodPower extends Power { | ||
|
||
private final Predicate<ItemStack> applicableFood; | ||
private final Function<FoodComponent, Integer> foodLevel; | ||
private final Function<FoodComponent, Float> saturation; | ||
|
||
public ModifyFoodPower(PowerType<?> type, PlayerEntity player, Predicate<ItemStack> applicableFood, Function<FoodComponent, Integer> additionalFood, Function<FoodComponent, Float> additionalSaturation) { | ||
super(type, player); | ||
this.applicableFood = applicableFood; | ||
this.foodLevel = additionalFood; | ||
this.saturation = additionalSaturation; | ||
} | ||
|
||
public boolean doesApply(ItemStack stack) { | ||
return applicableFood.test(stack); | ||
} | ||
|
||
public int getFoodLevel(FoodComponent food) { | ||
return foodLevel.apply(food); | ||
} | ||
|
||
public float getSaturation(FoodComponent food) { | ||
return saturation.apply(food); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"powers": [ | ||
"origins:shulker_inventory", | ||
"origins:natural_armor", | ||
"origins:strong_arms", | ||
"origins:no_shield", | ||
"origins:more_exhaustion" | ||
], | ||
"icon": "minecraft:shulker_shell", | ||
"order": 4, | ||
"impact": 1 | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/resources/data/origins/tags/items/ranged_weapons.json
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,8 @@ | ||
{ | ||
"replace": false, | ||
"values": [ | ||
"minecraft:bow", | ||
"minecraft:crossbow", | ||
"minecraft:trident" | ||
] | ||
} |