Skip to content

Commit

Permalink
add jitpack build file so that mod can be depended upon
Browse files Browse the repository at this point in the history
  • Loading branch information
diamonddevv committed Jan 26, 2024
1 parent 415379e commit aa3bec3
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 15 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
id 'maven-publish'
}


apply plugin: 'maven-publish'
base.archivesName = project.archives_base_name
version = "$project.version+${libs.versions.minecraft.get()}"
group = project.maven_group
Expand Down
2 changes: 2 additions & 0 deletions jitpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
jdk:
- openjdk17
34 changes: 20 additions & 14 deletions src/main/java/dev/diamond/enderism/item/CursedChorusItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import dev.diamond.enderism.nbt.EnderismNbt;
import dev.diamond.enderism.registry.InitAdvancementCriteria;
import dev.diamond.enderism.registry.InitBlocks;
import dev.diamond.enderism.registry.InitGamerules;
import dev.diamond.enderism.registry.InitSoundEvents;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroupEntries;
Expand Down Expand Up @@ -105,8 +106,10 @@ public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attack

if (stack.getItem() instanceof CursedChorusItem) {
if (target instanceof PlayerEntity player) {
target.getWorld().playSound(null, target.getX(), target.getY(), target.getZ(), InitSoundEvents.CURSED_CHORUS_FRUIT_PLAYER_BIND, SoundCategory.BLOCKS, 1.5f, 2f);
EnderismNbt.CursedChorusBindManager.setPlayerBind(player, stack);
if (target.getWorld().getGameRules().getBoolean(InitGamerules.CURSED_CHORUS_PLAYERBINDING) && !EnderismNbt.CursedChorusBindManager.isBound(stack)) {
target.getWorld().playSound(null, target.getX(), target.getY(), target.getZ(), InitSoundEvents.CURSED_CHORUS_FRUIT_PLAYER_BIND, SoundCategory.BLOCKS, 1.5f, 2f);
EnderismNbt.CursedChorusBindManager.setPlayerBind(player, stack);
}
}
}

Expand All @@ -116,19 +119,22 @@ public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attack
@Override
public ActionResult useOnBlock(ItemUsageContext context) {
// Handle adding a Chorus Magnetite bind to the fruit
if (!EnderismNbt.CursedChorusBindManager.isBound(context.getStack())) {


World world = context.getWorld();
BlockPos pos = context.getBlockPos();
BlockState blockstate = world.getBlockState(pos);
Block block = blockstate.getBlock();
ItemStack stack = context.getStack();

if (block == InitBlocks.CHORUS_MAGNETITE) {
EnderismNbt.CursedChorusBindManager.setMagnetiteBind(pos, stack);
Vec3d vec = new Vec3d(pos.getX(), pos.getY(), pos.getZ());
world.playSound(null, vec.x + 0.5, vec.y, vec.z + 0.5, InitSoundEvents.CURSED_CHORUS_FRUIT_CHORUS_MAGNETITE_BIND, SoundCategory.BLOCKS, 1.5f, 2f);
for (int i = 0; i < 5; i++) {
world.addParticle(ParticleTypes.WITCH, vec.x + 0.5, vec.y + 0.5, vec.z + 0.5, 1, 1, 1);
World world = context.getWorld();
BlockPos pos = context.getBlockPos();
BlockState blockstate = world.getBlockState(pos);
Block block = blockstate.getBlock();
ItemStack stack = context.getStack();

if (block == InitBlocks.CHORUS_MAGNETITE) {
EnderismNbt.CursedChorusBindManager.setMagnetiteBind(pos, stack);
Vec3d vec = new Vec3d(pos.getX(), pos.getY(), pos.getZ());
world.playSound(null, vec.x + 0.5, vec.y, vec.z + 0.5, InitSoundEvents.CURSED_CHORUS_FRUIT_CHORUS_MAGNETITE_BIND, SoundCategory.BLOCKS, 1.5f, 2f);
for (int i = 0; i < 5; i++) {
world.addParticle(ParticleTypes.WITCH, vec.x + 0.5, vec.y + 0.5, vec.z + 0.5, 1, 1, 1);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ public class InitGamerules implements RegistryInitializer {

public static GameRules.Key<GameRules.BooleanRule> ELYTRA_FIREWORKS;
public static GameRules.Key<GameRules.IntRule> CHORUSKIRMISH_CHANCE;
public static GameRules.Key<GameRules.BooleanRule> CURSED_CHORUS_PLAYERBINDING;

@Override
public void register() {
ELYTRA_FIREWORKS = GameRuleRegistry.register("fireworksBoostElytra", GameRules.Category.PLAYER, GameRuleFactory.createBooleanRule(false));
CHORUSKIRMISH_CHANCE = GameRuleRegistry.register("choruskirmishChance", GameRules.Category.MISC, GameRuleFactory.createIntRule(25));
CURSED_CHORUS_PLAYERBINDING = GameRuleRegistry.register("cursedChorusFruitCanPlayerbind", GameRules.Category.PLAYER, GameRuleFactory.createBooleanRule(true));
}
}

0 comments on commit aa3bec3

Please sign in to comment.