-
Notifications
You must be signed in to change notification settings - Fork 6
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
44 changed files
with
819 additions
and
172 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
16 changes: 9 additions & 7 deletions
16
src/main/java/com/hugman/uhc/modifier/PlayerAttributeModifier.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,30 +1,32 @@ | ||
package com.hugman.uhc.modifier; | ||
|
||
import com.mojang.serialization.Codec; | ||
import com.mojang.serialization.MapCodec; | ||
import com.mojang.serialization.codecs.RecordCodecBuilder; | ||
import net.minecraft.entity.attribute.EntityAttribute; | ||
import net.minecraft.entity.attribute.EntityAttributeInstance; | ||
import net.minecraft.network.packet.s2c.play.EntityAttributesS2CPacket; | ||
import net.minecraft.entity.attribute.EntityAttributeModifier; | ||
import net.minecraft.registry.entry.RegistryEntry; | ||
import net.minecraft.server.network.ServerPlayerEntity; | ||
|
||
public record PlayerAttributeModifier(RegistryEntry<EntityAttribute> attribute, double value) implements Modifier { | ||
public record PlayerAttributeModifier( | ||
RegistryEntry<EntityAttribute> attribute, | ||
EntityAttributeModifier modifier | ||
) implements Modifier { | ||
public static final MapCodec<PlayerAttributeModifier> CODEC = RecordCodecBuilder.mapCodec(instance -> instance.group( | ||
EntityAttribute.CODEC.fieldOf("attribute").forGetter(PlayerAttributeModifier::attribute), | ||
Codec.doubleRange(0.0F, Double.MAX_VALUE).fieldOf("value").forGetter(PlayerAttributeModifier::value) | ||
EntityAttributeModifier.MAP_CODEC.forGetter(PlayerAttributeModifier::modifier) | ||
).apply(instance, PlayerAttributeModifier::new)); | ||
|
||
@Override | ||
public ModifierType<?> getType() { | ||
return ModifierType.PLAYER_ATTRIBUTE; | ||
} | ||
|
||
public void setAttribute(ServerPlayerEntity player) { | ||
public void refreshAttribute(ServerPlayerEntity player) { | ||
EntityAttributeInstance instance = player.getAttributes().getCustomInstance(this.attribute); | ||
if (instance != null) { | ||
instance.setBaseValue(value); | ||
player.networkHandler.sendPacket(new EntityAttributesS2CPacket(player.getId(), player.getAttributes().getTracked())); | ||
instance.removeModifier(modifier); | ||
instance.addPersistentModifier(modifier); | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,3 +1,20 @@ | ||
{ | ||
"game.doublerunner": "DoubleRunner" | ||
"game.doublerunner": "DoubleRunner", | ||
|
||
"module.doublerunner.blasted_ores_plus": "Blasted Ores+", | ||
"module.doublerunner.dasher_plus": "Dasher+", | ||
"module.doublerunner.dasher_plus.description": "Permanent haste and speed, and no fall damage", | ||
"module.doublerunner.faster_resources_plus": "Faster Resources+", | ||
"module.doublerunner.guaranteed_golden_apples": "Guaranteed Golden Apples", | ||
"module.doublerunner.guaranteed_golden_apples.description": "All leaves only drop golden apples", | ||
"module.doublerunner.ore_boost_plus": "Ore Boost+", | ||
"module.doublerunner.potion_drops": "Potion Drops", | ||
"module.doublerunner.potion_drops.description": "Some entities drop potions", | ||
"module.doublerunner.timberman.description": "Trees get cut instantly and drop oak planks", | ||
|
||
"module_description.doublerunner.zombies_drop_strength_potions": "Zombies drops potions of Strength", | ||
"module_description.doublerunner.spiders_drop_poison_potions": "Spiders drops potions of Poison", | ||
"module_description.doublerunner.sugar_cane_drops_swiftness_potions": "Sugar cane drops potions of Swiftness", | ||
"module_description.doublerunner.rabbits_drop_leaping_potions": "Rabbits drops potions of Leaping", | ||
"module_description.doublerunner.bats_drop_night_vision_potions": "Bats drops potions of Night Vision" | ||
} |
46 changes: 0 additions & 46 deletions
46
src/main/resources/data/doublerunner/plasmid/game/test.json
This file was deleted.
Oops, something went wrong.
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
6 changes: 3 additions & 3 deletions
6
src/main/resources/data/doublerunner/uhc/module/blasted_ores_plus.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
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.