Skip to content

Commit

Permalink
config done
Browse files Browse the repository at this point in the history
  • Loading branch information
CammiePone committed Jan 5, 2024
1 parent 7cf61f2 commit db207ec
Show file tree
Hide file tree
Showing 65 changed files with 1,357 additions and 1,185 deletions.
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ dependencies {
modCompileOnly libs.patchouli
modLocalRuntime libs.patchouli

modImplementation libs.midnightlib
modImplementation libs.smartbrainlib
modImplementation libs.resourceful.config

Expand Down
2 changes: 0 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ cca = "5.2.2"
trinkets = "3.7.1"
sparkweave = "0.4.1"
patchouli = "1.20.1-84-FABRIC"
midnightlib = "1.4.1-quilt"
mixinextras = "0.2.2"
reach_attr = "2.4.0"
modmenu = "7.2.2"
Expand Down Expand Up @@ -38,7 +37,6 @@ cca_chunk = { module = "dev.onyxstudios.cardinal-components-api:cardinal-compone
trinkets = { module = "dev.emi:trinkets", version.ref = "trinkets" }
sparkweave = { module = "dev.upcraft:Sparkweave", version.ref = "sparkweave" }
patchouli = { module = "vazkii.patchouli:Patchouli", version.ref = "patchouli" }
midnightlib = { module = "maven.modrinth:midnightlib", version.ref = "midnightlib" }
mixinextras = { module = "io.github.llamalad7:mixinextras-fabric", version.ref = "mixinextras" }
reach_attr = { module = "com.jamieswhiteshirt:reach-entity-attributes", version.ref = "reach_attr" }
modmenu = { module = "com.terraformersmc:modmenu", version.ref = "modmenu" }
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/dev/cammiescorner/arcanuscontinuum/Arcanus.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import dev.cammiescorner.arcanuscontinuum.common.blocks.MagicDoorBlock;
import dev.cammiescorner.arcanuscontinuum.common.blocks.entities.MagicDoorBlockEntity;
import dev.cammiescorner.arcanuscontinuum.common.packets.c2s.*;
import dev.cammiescorner.arcanuscontinuum.common.packets.s2c.SyncConfigValuesPacket;
import dev.cammiescorner.arcanuscontinuum.common.packets.s2c.SyncStatusEffectPacket;
import dev.cammiescorner.arcanuscontinuum.common.packets.s2c.SyncSupporterData;
import dev.cammiescorner.arcanuscontinuum.common.registry.*;
Expand Down Expand Up @@ -144,6 +145,9 @@ public void onInitialize(ModContainer mod) {
EntityElytraEvents.CUSTOM.register((entity, tickElytra) -> entity.hasStatusEffect(ArcanusStatusEffects.MANA_WINGS.get()));

ServerPlayConnectionEvents.JOIN.register((handler, sender, server) -> {
if(!server.isSingleplayer())
SyncConfigValuesPacket.send(handler.player);

Arcanus.refreshSupporterData(server, false);
SyncSupporterData.send(handler.player);
SyncStatusEffectPacket.sendToAll(handler.player, ArcanusStatusEffects.ANONYMITY.get(), handler.player.hasStatusEffect(ArcanusStatusEffects.ANONYMITY.get()));
Expand Down
1,937 changes: 995 additions & 942 deletions src/main/java/dev/cammiescorner/arcanuscontinuum/ArcanusConfig.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@
import dev.cammiescorner.arcanuscontinuum.common.compat.ArcanusCompat;
import dev.cammiescorner.arcanuscontinuum.common.compat.FirstPersonCompat;
import dev.cammiescorner.arcanuscontinuum.common.items.StaffItem;
import dev.cammiescorner.arcanuscontinuum.common.packets.s2c.SyncStaffTemplatePacket;
import dev.cammiescorner.arcanuscontinuum.common.packets.s2c.SyncStatusEffectPacket;
import dev.cammiescorner.arcanuscontinuum.common.packets.s2c.SyncSupporterData;
import dev.cammiescorner.arcanuscontinuum.common.packets.s2c.SyncWorkbenchModePacket;
import dev.cammiescorner.arcanuscontinuum.common.packets.s2c.*;
import dev.cammiescorner.arcanuscontinuum.common.registry.*;
import dev.cammiescorner.arcanuscontinuum.common.util.ArcanusHelper;
import net.fabricmc.fabric.api.client.model.loading.v1.ModelLoadingPlugin;
Expand Down Expand Up @@ -78,6 +75,7 @@ public class ArcanusClient implements ClientModInitializer {
public static final RenderLayer LAYER = ArcanusClient.getMagicCircles(Arcanus.id("textures/block/warded_block.png"));
public static BooleanSupplier FIRST_PERSON_MODEL_ENABLED = () -> false;
public static BooleanSupplier FIRST_PERSON_SHOW_HANDS = () -> true;
public static boolean castingSpeedHasCoolDown;
private final MinecraftClient client = MinecraftClient.getInstance();

@Override
Expand Down Expand Up @@ -128,6 +126,7 @@ public void onInitializeClient(ModContainer mod) {
ClientPlayNetworking.registerGlobalReceiver(SyncWorkbenchModePacket.ID, SyncWorkbenchModePacket::handle);
ClientPlayNetworking.registerGlobalReceiver(SyncStaffTemplatePacket.ID, SyncStaffTemplatePacket::handle);
ClientPlayNetworking.registerGlobalReceiver(SyncSupporterData.ID, SyncSupporterData::handle);
ClientPlayNetworking.registerGlobalReceiver(SyncConfigValuesPacket.ID, SyncConfigValuesPacket::handle);

ColorProviderRegistry.ITEM.register((stack, tintIndex) -> tintIndex == 0 ? StaffItem.getPrimaryColour(stack) : tintIndex == 1 ? StaffItem.getSecondaryColour(stack) : 0xffffff,
ArcanusItems.WOODEN_STAFF.get(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void addWardedBlock(PlayerEntity player, BlockPos pos) {
}

public void removeWardedBlock(PlayerEntity player, BlockPos pos) {
boolean canOtherPlayersRemoveBlock = ArcanusConfig.WardingEffectProperties.canBeRemovedByOthers;
boolean canOtherPlayersRemoveBlock = ArcanusConfig.UtilityEffects.WardingEffectProperties.canBeRemovedByOthers;

if(canOtherPlayersRemoveBlock || isOwnerOfBlock(player, pos)) {
wardedBlocks.remove(pos);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package dev.cammiescorner.arcanuscontinuum.common.components.entity;

import dev.cammiescorner.arcanuscontinuum.ArcanusConfig;
import dev.cammiescorner.arcanuscontinuum.api.spells.SpellEffect;
import dev.cammiescorner.arcanuscontinuum.common.registry.ArcanusSpellComponents;
import dev.onyxstudios.cca.api.v3.component.tick.ServerTickingComponent;
import net.minecraft.entity.Entity;
import net.minecraft.entity.passive.TameableEntity;
Expand Down Expand Up @@ -44,7 +47,8 @@ public void writeToNbt(NbtCompound tag) {
tag.putInt("Timer", timer);
}

public void setScale(float scale, double strength) {
public void setScale(SpellEffect effect, double strength) {
float scale = ArcanusSpellComponents.SHRINK.is(effect) ? ArcanusConfig.UtilityEffects.ShrinkEffectProperties.baseShrinkAmount : ArcanusConfig.UtilityEffects.EnlargeEffectProperties.baseEnlargeAmount;
ScaleData heightData = ScaleTypes.HEIGHT.getScaleData(entity);
ScaleData widthData = ScaleTypes.WIDTH.getScaleData(entity);
ScaleData reachData = ScaleTypes.REACH.getScaleData(entity);
Expand All @@ -60,7 +64,7 @@ public void setScale(float scale, double strength) {
reachData.setTargetScale((float) MathHelper.clamp(reachData.getBaseScale() * scale, 0.125, 6));
speedData.setTargetScale((float) MathHelper.clamp(speedData.getBaseScale() * scale, 0.125, 6));

timer = (int) Math.round(100 * strength);
timer = (int) Math.round((ArcanusSpellComponents.SHRINK.is(effect) ? ArcanusConfig.UtilityEffects.ShrinkEffectProperties.baseEffectDuration : ArcanusConfig.UtilityEffects.EnlargeEffectProperties.baseEffectDuration) * strength);
}

public void resetScale() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package dev.cammiescorner.arcanuscontinuum.common.components.level;

import dev.cammiescorner.arcanuscontinuum.Arcanus;
import dev.cammiescorner.arcanuscontinuum.ArcanusConfig;
import dev.cammiescorner.arcanuscontinuum.common.blocks.SpatialRiftExitBlock;
import dev.cammiescorner.arcanuscontinuum.common.blocks.SpatialRiftExitEdgeBlock;
import dev.cammiescorner.arcanuscontinuum.common.blocks.entities.MagicBlockEntity;
Expand Down Expand Up @@ -131,8 +132,11 @@ public void teleportOutOfPocketDimension(ServerPlayerEntity player) {
}

public void generateNewPlot(PlayerEntity player) {
int pocketWidth = Math.round(ArcanusConfig.UtilityEffects.SpatialRiftEffectProperties.pocketWidth / 2f) + 1;
int pocketHeight = Math.round(ArcanusConfig.UtilityEffects.SpatialRiftEffectProperties.pocketHeight / 2f) + 1;

var boxContainer = new Object() {
Box box = new Box(-13, -13, -13, 13, 13, 13);
Box box = new Box(-pocketWidth, -pocketHeight, -pocketWidth, pocketWidth, pocketHeight, pocketWidth);
};

while(existingPlots.entrySet().stream().anyMatch(entry -> entry.getValue().intersects(boxContainer.box.expand(38))))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package dev.cammiescorner.arcanuscontinuum.common.entities.magic;

import dev.cammiescorner.arcanuscontinuum.Arcanus;
import dev.cammiescorner.arcanuscontinuum.ArcanusConfig;
import dev.cammiescorner.arcanuscontinuum.api.entities.Targetable;
import dev.cammiescorner.arcanuscontinuum.api.spells.SpellEffect;
import dev.cammiescorner.arcanuscontinuum.api.spells.SpellGroup;
Expand Down Expand Up @@ -95,7 +96,7 @@ public void tick() {
}
}

if(trueAge >= 100)
if(trueAge >= ArcanusConfig.SpellShapes.AOEShapeProperties.baseLifeSpan)
kill();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package dev.cammiescorner.arcanuscontinuum.common.entities.magic;

import dev.cammiescorner.arcanuscontinuum.Arcanus;
import dev.cammiescorner.arcanuscontinuum.ArcanusConfig;
import dev.cammiescorner.arcanuscontinuum.api.entities.ArcanusEntityAttributes;
import dev.cammiescorner.arcanuscontinuum.api.entities.Targetable;
import dev.cammiescorner.arcanuscontinuum.api.spells.SpellEffect;
Expand Down Expand Up @@ -212,7 +213,7 @@ public void setProperties(@Nullable LivingEntity caster, LivingEntity target, It
EntityAttributeInstance manaLock = caster.getAttributeInstance(ArcanusEntityAttributes.MANA_LOCK.get());

if(maxMana != null && manaLock != null) {
double maximumManaLock = 0.9;
double maximumManaLock = ArcanusConfig.SpellShapes.GuardianOrbShapeProperties.maximumManaLock;

manaLock.addPersistentModifier(new EntityAttributeModifier(casterId, "Orb Mana Lock", maxMana.getValue() * (effects.size() * (maximumManaLock / 11)), EntityAttributeModifier.Operation.ADDITION));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public MagicProjectileEntity(EntityType<? extends PersistentProjectileEntity> en

@Override
public void tick() {
int lifeSpan = ArcanusConfig.ProjectileShapeProperties.baseLifeSpan;
int lifeSpan = ArcanusConfig.SpellShapes.ProjectileShapeProperties.baseLifeSpan;

if(!getWorld().isClient() && (getOwner() == null || !getOwner().isAlive() || (ArcanusSpellComponents.PROJECTILE.is(getShape()) && age >= lifeSpan))) {
kill();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package dev.cammiescorner.arcanuscontinuum.common.entities.magic;

import dev.cammiescorner.arcanuscontinuum.Arcanus;
import dev.cammiescorner.arcanuscontinuum.ArcanusConfig;
import dev.cammiescorner.arcanuscontinuum.api.entities.Targetable;
import dev.cammiescorner.arcanuscontinuum.api.spells.SpellEffect;
import dev.cammiescorner.arcanuscontinuum.api.spells.SpellGroup;
Expand Down Expand Up @@ -47,7 +48,7 @@ public void tick() {
return;
}

if(getWorld() instanceof ServerWorld serverWorld && age > 60) {
if(getWorld() instanceof ServerWorld serverWorld && age > ArcanusConfig.SpellShapes.RuneShapeProperties.delay) {
LivingEntity entity = getWorld().getClosestEntity(LivingEntity.class, TargetPredicate.createNonAttackable().setPredicate(livingEntity -> livingEntity.isAlive() && !livingEntity.isSpectator() && livingEntity instanceof Targetable targetable && targetable.arcanuscontinuum$canBeTargeted()), null, getX(), getY(), getZ(), new Box(-0.5, 0, -0.5, 0.5, 0.2, 0.5).offset(getPos()));

if(entity != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.cammiescorner.arcanuscontinuum.common.entities.magic;

import dev.cammiescorner.arcanuscontinuum.ArcanusConfig;
import dev.cammiescorner.arcanuscontinuum.api.entities.Targetable;
import dev.cammiescorner.arcanuscontinuum.common.registry.ArcanusComponents;
import net.minecraft.entity.Entity;
Expand Down Expand Up @@ -31,33 +32,35 @@ public PocketDimensionPortalEntity(EntityType<?> variant, World world) {

@Override
public void tick() {
if(!getWorld().isClient() && (getCaster() == null || !getCaster().isAlive()) || getTrueAge() > 720) {
if(!getWorld().isClient() && (getCaster() == null || !getCaster().isAlive()) || getTrueAge() > ArcanusConfig.UtilityEffects.SpatialRiftEffectProperties.baseLifeSpan + 20) {
kill();
return;
}

if(getTrueAge() <= 700) {
if(getTrueAge() <= ArcanusConfig.UtilityEffects.SpatialRiftEffectProperties.baseLifeSpan) {
Box box = new Box(0, 0, 0, 0, 0, 0).expand(4 + pullStrength).offset(getPos());
double boxRadius = box.getXLength() / 2;
double boxRadiusSq = boxRadius * boxRadius;

if(getTrueAge() > 100) {
if(getTrueAge() > ArcanusConfig.UtilityEffects.SpatialRiftEffectProperties.portalGrowTime) {
getWorld().getEntitiesByClass(Entity.class, getBoundingBox(), entity -> entity.canUsePortals() && !entity.isSpectator() && (!(entity instanceof PlayerEntity player) || !ArcanusComponents.hasPortalCoolDown(player))).forEach(entity -> {
if(!(entity instanceof PocketDimensionPortalEntity))
ArcanusComponents.teleportToPocketDimension(getWorld().getProperties(), getCaster(), entity);
});

getWorld().getEntitiesByClass(Entity.class, box, entity -> entity.isAlive() && !entity.isSpectator() && !(entity instanceof PlayerEntity player && (player.isCreative() || ArcanusComponents.hasPortalCoolDown(player)))).forEach(entity -> {
double distanceSq = getPos().squaredDistanceTo(entity.getPos());
if(ArcanusConfig.UtilityEffects.SpatialRiftEffectProperties.canSuckEntitiesIn) {
getWorld().getEntitiesByClass(Entity.class, box, entity -> entity.isAlive() && !entity.isSpectator() && !(entity instanceof PlayerEntity player && (player.isCreative() || ArcanusComponents.hasPortalCoolDown(player)))).forEach(entity -> {
double distanceSq = getPos().squaredDistanceTo(entity.getPos());

if(!(entity instanceof PocketDimensionPortalEntity) && distanceSq <= boxRadiusSq && distanceSq != 0) {
Vec3d direction = getPos().subtract(entity.getPos()).normalize();
double inverseSq = 1 / distanceSq;
if(!(entity instanceof PocketDimensionPortalEntity) && distanceSq <= boxRadiusSq && distanceSq != 0) {
Vec3d direction = getPos().subtract(entity.getPos()).normalize();
double inverseSq = 1 / distanceSq;

entity.addVelocity(direction.multiply(inverseSq));
entity.velocityModified = true;
}
});
entity.addVelocity(direction.multiply(inverseSq));
entity.velocityModified = true;
}
});
}
}

for(int i = 0; i < boxRadius * 2; ++i) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package dev.cammiescorner.arcanuscontinuum.common.packets.c2s;

import dev.cammiescorner.arcanuscontinuum.Arcanus;
import dev.cammiescorner.arcanuscontinuum.ArcanusConfig;
import dev.cammiescorner.arcanuscontinuum.common.entities.magic.AggressorbEntity;
import dev.cammiescorner.arcanuscontinuum.common.registry.ArcanusComponents;
import dev.upcraft.sparkweave.api.util.scheduler.Tasks;
import io.netty.buffer.Unpooled;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
Expand Down Expand Up @@ -59,7 +59,7 @@ private static void shootOrb(List<UUID> orbIds, ServerWorld world, LivingEntity
if(world.getEntity(orbId) instanceof AggressorbEntity orb && owner != null && orb.isBoundToTarget()) {
orb.setBoundToTarget(false);
orb.setPosition(orb.getTarget().getEyePos());
orb.setProperties(orb.getTarget(), orb.getTarget().getPitch(), orb.getTarget().getYaw(), 0F, 3f, 1F);
orb.setProperties(orb.getTarget(), orb.getTarget().getPitch(), orb.getTarget().getYaw(), 0F, ArcanusConfig.SpellShapes.AggressorbShapeProperties.projectileSpeed, 1F);
world.playSound(null, orb.getX(), orb.getY(), orb.getZ(), SoundEvents.ENTITY_ARROW_SHOOT, SoundCategory.NEUTRAL, 1f, 1f, 1L);
ArcanusComponents.removeOrbFromEntity(orb.getTarget(), orbId);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package dev.cammiescorner.arcanuscontinuum.common.packets.s2c;

import dev.cammiescorner.arcanuscontinuum.Arcanus;
import dev.cammiescorner.arcanuscontinuum.ArcanusConfig;
import dev.cammiescorner.arcanuscontinuum.client.ArcanusClient;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayNetworkHandler;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
import org.quiltmc.qsl.networking.api.PacketByteBufs;
import org.quiltmc.qsl.networking.api.PacketSender;
import org.quiltmc.qsl.networking.api.ServerPlayNetworking;

public class SyncConfigValuesPacket {
public static final Identifier ID = Arcanus.id("sync_config_values");

public static void send(ServerPlayerEntity player) {
PacketByteBuf buf = PacketByteBufs.create();

buf.writeBoolean(ArcanusConfig.castingSpeedHasCoolDown);

ServerPlayNetworking.send(player, ID, buf);
}

public static void handle(MinecraftClient client, ClientPlayNetworkHandler handler, PacketByteBuf buf, PacketSender sender) {
boolean castingSpeedHasCoolDown = buf.readBoolean();

client.execute(() -> ArcanusClient.castingSpeedHasCoolDown = castingSpeedHasCoolDown);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import dev.cammiescorner.arcanuscontinuum.Arcanus;
import dev.cammiescorner.arcanuscontinuum.api.spells.Pattern;
import dev.cammiescorner.arcanuscontinuum.api.spells.SpellEffect;
import dev.cammiescorner.arcanuscontinuum.api.spells.SpellShape;
import dev.cammiescorner.arcanuscontinuum.common.compat.ArcanusCompat;
import dev.cammiescorner.arcanuscontinuum.common.compat.PehkuiCompat;
Expand Down Expand Up @@ -289,8 +290,8 @@ public static void setSpellShape(Entity entity, SpellShape shape) {
SPELL_SHAPE.get(entity).setSpellShape(shape);
}

public static void setScale(Entity entity, float scale, double strength) {
SIZE.get(entity).setScale(scale, strength);
public static void setScale(Entity entity, SpellEffect effect, double strength) {
SIZE.get(entity).setScale(effect, strength);
}

public static void resetScale(Entity entity) {
Expand Down
Loading

0 comments on commit db207ec

Please sign in to comment.