Merge pull request #517 from Cypher121/1.20-blanketcon/more-restrictions

More blanketcon restrictions
This commit is contained in:
petrak@ 2023-08-22 16:14:22 -04:00 committed by GitHub
commit 5d19639573
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 34 additions and 3 deletions

View file

@ -79,7 +79,7 @@ public class CircleCastEnv extends CastingEnvironment {
var sound = result.getSound().sound(); var sound = result.getSound().sound();
if (sound != null) { if (sound != null) {
var soundPos = this.execState.currentPos; var soundPos = this.execState.currentPos;
this.world.playSound(null, soundPos, sound, SoundSource.PLAYERS, 1f, 1f); this.world.playSound(null, soundPos, sound, SoundSource.PLAYERS, (float) HexConfig.common().castingVolumeMultiplier(), 1f);
} }
// TODO: this is gonna bite us in the bum someday // TODO: this is gonna bite us in the bum someday

View file

@ -7,6 +7,7 @@ import at.petrak.hexcasting.api.casting.eval.ExecutionClientView;
import at.petrak.hexcasting.api.casting.eval.ResolvedPattern; import at.petrak.hexcasting.api.casting.eval.ResolvedPattern;
import at.petrak.hexcasting.api.casting.iota.PatternIota; import at.petrak.hexcasting.api.casting.iota.PatternIota;
import at.petrak.hexcasting.api.casting.math.HexCoord; import at.petrak.hexcasting.api.casting.math.HexCoord;
import at.petrak.hexcasting.api.mod.HexConfig;
import at.petrak.hexcasting.api.mod.HexStatistics; import at.petrak.hexcasting.api.mod.HexStatistics;
import at.petrak.hexcasting.api.pigment.FrozenPigment; import at.petrak.hexcasting.api.pigment.FrozenPigment;
import at.petrak.hexcasting.common.msgs.*; import at.petrak.hexcasting.common.msgs.*;
@ -47,7 +48,7 @@ public class StaffCastEnv extends PlayerBasedCastEnv {
if (sound != null) { if (sound != null) {
var soundPos = this.caster.position(); var soundPos = this.caster.position();
this.world.playSound(null, soundPos.x, soundPos.y, soundPos.z, this.world.playSound(null, soundPos.x, soundPos.y, soundPos.z,
sound, SoundSource.PLAYERS, 1f, 1f); sound, SoundSource.PLAYERS, (float) HexConfig.common().castingVolumeMultiplier(), 1f);
} }
} }

View file

@ -27,6 +27,8 @@ public class HexConfig {
int artifactCooldown(); int artifactCooldown();
double castingVolumeMultiplier();
long DEFAULT_DUST_MEDIA_AMOUNT = MediaConstants.DUST_UNIT; long DEFAULT_DUST_MEDIA_AMOUNT = MediaConstants.DUST_UNIT;
long DEFAULT_SHARD_MEDIA_AMOUNT = MediaConstants.SHARD_UNIT; long DEFAULT_SHARD_MEDIA_AMOUNT = MediaConstants.SHARD_UNIT;
long DEFAULT_CHARGED_MEDIA_AMOUNT = MediaConstants.CRYSTAL_UNIT; long DEFAULT_CHARGED_MEDIA_AMOUNT = MediaConstants.CRYSTAL_UNIT;
@ -36,9 +38,11 @@ public class HexConfig {
int DEFAULT_TRINKET_COOLDOWN = 5; int DEFAULT_TRINKET_COOLDOWN = 5;
int DEFAULT_ARTIFACT_COOLDOWN = 3; int DEFAULT_ARTIFACT_COOLDOWN = 3;
double DEFAULT_CASTING_VOLUME_MULTIPLIER = 0.05;
} }
public interface ClientConfigAccess { public interface ClientConfigAccess {
boolean ctrlTogglesOffStrokeOrder(); boolean ctrlTogglesOffStrokeOrder();
boolean invertSpellbookScrollDirection(); boolean invertSpellbookScrollDirection();
@ -54,6 +58,7 @@ public class HexConfig {
} }
public interface ServerConfigAccess { public interface ServerConfigAccess {
int opBreakHarvestLevelBecauseForgeThoughtItWasAGoodIdeaToImplementHarvestTiersUsingAnHonestToGodTopoSort(); int opBreakHarvestLevelBecauseForgeThoughtItWasAGoodIdeaToImplementHarvestTiersUsingAnHonestToGodTopoSort();
int maxOpCount(); int maxOpCount();

View file

@ -7,8 +7,10 @@ import at.petrak.hexcasting.api.casting.iota.Iota;
import at.petrak.hexcasting.api.casting.iota.IotaType; import at.petrak.hexcasting.api.casting.iota.IotaType;
import at.petrak.hexcasting.api.casting.iota.PatternIota; import at.petrak.hexcasting.api.casting.iota.PatternIota;
import at.petrak.hexcasting.api.item.HexHolderItem; import at.petrak.hexcasting.api.item.HexHolderItem;
import at.petrak.hexcasting.api.mod.HexConfig;
import at.petrak.hexcasting.api.pigment.FrozenPigment; import at.petrak.hexcasting.api.pigment.FrozenPigment;
import at.petrak.hexcasting.api.utils.NBTHelper; import at.petrak.hexcasting.api.utils.NBTHelper;
import at.petrak.hexcasting.common.misc.AdventureHelper;
import at.petrak.hexcasting.common.msgs.MsgNewSpiralPatternsS2C; import at.petrak.hexcasting.common.msgs.MsgNewSpiralPatternsS2C;
import at.petrak.hexcasting.xplat.IXplatAbstractions; import at.petrak.hexcasting.xplat.IXplatAbstractions;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
@ -122,6 +124,10 @@ public abstract class ItemPackagedHex extends ItemMediaHolder implements HexHold
return InteractionResultHolder.success(stack); return InteractionResultHolder.success(stack);
} }
if (AdventureHelper.canUseLoose(player, stack, world, player.position())) {
return InteractionResultHolder.success(stack);
}
List<Iota> instrs = getHex(stack, (ServerLevel) world); List<Iota> instrs = getHex(stack, (ServerLevel) world);
if (instrs == null) { if (instrs == null) {
return InteractionResultHolder.fail(stack); return InteractionResultHolder.fail(stack);
@ -162,7 +168,7 @@ public abstract class ItemPackagedHex extends ItemMediaHolder implements HexHold
if (sound != null) { if (sound != null) {
var soundPos = sPlayer.position(); var soundPos = sPlayer.position();
sPlayer.level().playSound(null, soundPos.x, soundPos.y, soundPos.z, sPlayer.level().playSound(null, soundPos.x, soundPos.y, soundPos.z,
sound, SoundSource.PLAYERS, 1f, 1f); sound, SoundSource.PLAYERS, (float) HexConfig.common().castingVolumeMultiplier(), 1f);
} }
if (broken) { if (broken) {

View file

@ -77,6 +77,9 @@ public class FabricHexConfig extends PartitioningSerializer.GlobalData {
@ConfigEntry.Gui.Tooltip @ConfigEntry.Gui.Tooltip
private int artifactCooldown = DEFAULT_ARTIFACT_COOLDOWN; private int artifactCooldown = DEFAULT_ARTIFACT_COOLDOWN;
@ConfigEntry.Gui.Tooltip
private double castingVolumeMultiplier = DEFAULT_CASTING_VOLUME_MULTIPLIER;
@Override @Override
public void validatePostLoad() throws ValidationException { public void validatePostLoad() throws ValidationException {
@ -120,6 +123,11 @@ public class FabricHexConfig extends PartitioningSerializer.GlobalData {
public int artifactCooldown() { public int artifactCooldown() {
return artifactCooldown; return artifactCooldown;
} }
@Override
public double castingVolumeMultiplier() {
return castingVolumeMultiplier;
}
} }
@Config(name = "client") @Config(name = "client")

View file

@ -20,6 +20,8 @@ public class ForgeHexConfig implements HexConfig.CommonConfigAccess {
private static ForgeConfigSpec.IntValue trinketCooldown; private static ForgeConfigSpec.IntValue trinketCooldown;
private static ForgeConfigSpec.IntValue artifactCooldown; private static ForgeConfigSpec.IntValue artifactCooldown;
private static ForgeConfigSpec.DoubleValue castingVolumeMultiplier;
public ForgeHexConfig(ForgeConfigSpec.Builder builder) { public ForgeHexConfig(ForgeConfigSpec.Builder builder) {
builder.push("Media Amounts"); builder.push("Media Amounts");
dustMediaAmount = builder.comment("How much media a single Amethyst Dust item is worth") dustMediaAmount = builder.comment("How much media a single Amethyst Dust item is worth")
@ -40,6 +42,10 @@ public class ForgeHexConfig implements HexConfig.CommonConfigAccess {
artifactCooldown = builder.comment("Cooldown in ticks of a artifact") artifactCooldown = builder.comment("Cooldown in ticks of a artifact")
.defineInRange("artifactCooldown", DEFAULT_ARTIFACT_COOLDOWN, 0, Integer.MAX_VALUE); .defineInRange("artifactCooldown", DEFAULT_ARTIFACT_COOLDOWN, 0, Integer.MAX_VALUE);
builder.pop(); builder.pop();
castingVolumeMultiplier = builder.comment(
"Multiplier for casting sounds made by circles, staff casting and casting items")
.defineInRange("castingVolumeMultiplier", DEFAULT_CASTING_VOLUME_MULTIPLIER, 0.0, 1.0);
} }
@Override @Override
@ -77,6 +83,11 @@ public class ForgeHexConfig implements HexConfig.CommonConfigAccess {
return artifactCooldown.get(); return artifactCooldown.get();
} }
@Override
public double castingVolumeMultiplier() {
return castingVolumeMultiplier.get();
}
public static class Client implements HexConfig.ClientConfigAccess { public static class Client implements HexConfig.ClientConfigAccess {
private static ForgeConfigSpec.BooleanValue ctrlTogglesOffStrokeOrder; private static ForgeConfigSpec.BooleanValue ctrlTogglesOffStrokeOrder;
private static ForgeConfigSpec.BooleanValue invertSpellbookScrollDirection; private static ForgeConfigSpec.BooleanValue invertSpellbookScrollDirection;