0.6.0 dev release 1

This commit is contained in:
gamma-delta 2022-03-04 21:52:43 -06:00
parent de3be9d04a
commit 5483298354
13 changed files with 62 additions and 43 deletions

View file

@ -17,7 +17,7 @@ apply plugin: 'maven-publish'
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'org.parchmentmc.librarian.forgegradle'
version = '0.5.0'
version = '0.6.0-dev.1'
group = 'at.petra-k.hexcasting' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'hexcasting'

View file

@ -154,7 +154,7 @@ db8a00478e1c4b0f9b143b5946d1ba25e489591d data/hexcasting/recipes/dynamic/seal_fo
c742a0a5fba2388263bfccfb49c60277d817f8cd data/hexcasting/recipes/pride_colorizer_1.json
855d1421063c24b2d1507f90f378f51261111d84 data/hexcasting/recipes/pride_colorizer_10.json
51a90058e4701f2d6ef157e1a930c203876e2447 data/hexcasting/recipes/pride_colorizer_11.json
07c309d1f6d80b077adf855b9064a968ce23b310 data/hexcasting/recipes/pride_colorizer_12.json
65bb0279c70aed060a09332552a122cf993f5d2a data/hexcasting/recipes/pride_colorizer_12.json
5f1e9330dcdf927e128212678c8e262c6daa92f1 data/hexcasting/recipes/pride_colorizer_13.json
01841b89db3b16a614a098cd468b6d3b64986a34 data/hexcasting/recipes/pride_colorizer_2.json
8ef1f2fcc98c19e3ff1ccdf1c427a6458a720023 data/hexcasting/recipes/pride_colorizer_3.json

View file

@ -13,7 +13,7 @@
"item": "hexcasting:amethyst_dust"
},
"C": {
"item": "minecraft:feather"
"item": "minecraft:azalea"
}
},
"result": {

View file

@ -2,16 +2,16 @@ package at.petrak.hexcasting.api
import net.minecraft.world.phys.Vec3
data class ParticleSpray(val pos: Vec3, val vel: Vec3, val fuzziness: Double, val spread: Double) {
data class ParticleSpray(val pos: Vec3, val vel: Vec3, val fuzziness: Double, val spread: Double, val count: Int = 20) {
companion object {
@JvmStatic
fun Burst(pos: Vec3, size: Double): ParticleSpray {
return ParticleSpray(pos, Vec3(size, 0.0, 0.0), 0.0, 6.28)
fun Burst(pos: Vec3, size: Double, count: Int = 20): ParticleSpray {
return ParticleSpray(pos, Vec3(size, 0.0, 0.0), 0.0, 3.14, count)
}
@JvmStatic
fun Cloud(pos: Vec3, size: Double): ParticleSpray {
return ParticleSpray(pos, Vec3.ZERO, size, 0.0)
fun Cloud(pos: Vec3, size: Double, count: Int = 20): ParticleSpray {
return ParticleSpray(pos, Vec3(0.0, 0.001, 0.0), size, 0.0, count)
}
}
}

View file

@ -55,15 +55,15 @@ public class ConjureParticle extends TextureSheetParticle {
}
public @NotNull ParticleRenderType getRenderType() {
return this.light ? I_STOLE_THIS_FROM_PSI : ParticleRenderType.PARTICLE_SHEET_TRANSLUCENT;
return this.light ? LIGHT_RENDER_TYPE : CONJURE_RENDER_TYPE;
}
public void tick() {
super.tick();
this.setSpriteFromAge(this.sprites);
this.alpha = 1.0f - ((float) this.age / (float) this.lifetime);
if (light) {
this.quadSize *= 0.96f;
this.alpha = 1.0f - ((float) this.age / (float) this.lifetime);
}
}
@ -97,7 +97,7 @@ public class ConjureParticle extends TextureSheetParticle {
// pretty sure this prevents the gross culling
// https://github.com/VazkiiMods/Psi/blob/1.18/src/main/java/vazkii/psi/client/fx/FXWisp.java
private static final ParticleRenderType I_STOLE_THIS_FROM_PSI = new ParticleRenderType() {
private record ConjureRenderType(boolean light) implements ParticleRenderType {
@Override
public void begin(BufferBuilder buf, TextureManager texMan) {
RenderSystem.depthMask(false);
@ -106,7 +106,7 @@ public class ConjureParticle extends TextureSheetParticle {
RenderSystem.setShaderTexture(0, TextureAtlas.LOCATION_PARTICLES);
texMan.bindForSetup(TextureAtlas.LOCATION_PARTICLES);
texMan.getTexture(TextureAtlas.LOCATION_PARTICLES).setFilter(true, false);
texMan.getTexture(TextureAtlas.LOCATION_PARTICLES).setFilter(this.light, false);
buf.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.PARTICLE);
}
@ -123,7 +123,10 @@ public class ConjureParticle extends TextureSheetParticle {
@Override
public String toString() {
return HexMod.MOD_ID + ":conjure";
return HexMod.MOD_ID + (light ? ":light" : ":conjure");
}
};
}
private static final ConjureRenderType CONJURE_RENDER_TYPE = new ConjureRenderType(false);
private static final ConjureRenderType LIGHT_RENDER_TYPE = new ConjureRenderType(true);
}

View file

@ -37,7 +37,9 @@ public class BlockEntityConjured extends BlockEntity {
pEntity.getX() + (RANDOM.nextFloat() * 0.6D) - 0.3D,
getBlockPos().getY() + (RANDOM.nextFloat() * 0.05D) + 0.95D,
pEntity.getZ() + (RANDOM.nextFloat() * 0.6D) - 0.3D,
0.0, 0.0, 0.0);
RANDOM.nextFloat(-0.02f, 0.02f),
RANDOM.nextFloat(0.02f),
RANDOM.nextFloat(-0.02f, 0.02f));
}
}
}
@ -53,14 +55,18 @@ public class BlockEntityConjured extends BlockEntity {
(double) getBlockPos().getX() + 0.4D + (RANDOM.nextFloat() * 0.2D),
(double) getBlockPos().getY() + 0.4D + (RANDOM.nextFloat() * 0.2D),
(double) getBlockPos().getZ() + 0.4D + (RANDOM.nextFloat() * 0.2D),
0.0, 0.0, 0.0);
RANDOM.nextFloat(-0.005f, 0.005f),
RANDOM.nextFloat(-0.005f, 0.005f),
RANDOM.nextFloat(-0.005f, 0.005f));
} else {
if (RANDOM.nextFloat() < 0.7) {
level.addParticle(new ConjureParticleOptions(color, false),
(double) getBlockPos().getX() + RANDOM.nextFloat(),
(double) getBlockPos().getY() + RANDOM.nextFloat(),
(double) getBlockPos().getZ() + RANDOM.nextFloat(),
0.0, 0.0, 0.0);
RANDOM.nextFloat(-0.02f, 0.02f),
RANDOM.nextFloat(-0.02f, 0.02f),
RANDOM.nextFloat(-0.02f, 0.02f));
}
}
}

View file

@ -26,7 +26,7 @@ public class HexBlocks {
BlockBehaviour.Properties.of(Material.AMETHYST, MaterialColor.DIAMOND)
.sound(SoundType.AMETHYST)
.noDrops()
.strength(0f, 0f)
.instabreak()
.noOcclusion()
.isSuffocating(HexBlocks::never)
.isViewBlocking(HexBlocks::never)));

View file

@ -19,6 +19,7 @@ import net.minecraft.network.chat.Component
import net.minecraft.server.level.ServerLevel
import net.minecraft.server.level.ServerPlayer
import net.minecraft.world.InteractionHand
import net.minecraft.world.phys.Vec3
import kotlin.math.min
/**
@ -69,10 +70,9 @@ class CastingHarness private constructor(
sideEffects.add(
OperatorSideEffect.Particles(
ParticleSpray(
this.ctx.caster.eyePosition.add(this.ctx.caster.lookAngle.scale(0.5)),
this.ctx.caster.lookAngle,
0.0,
0.1
this.ctx.position,
Vec3(0.0, 1.0, 0.0),
0.5, 1.0
)
)
)

View file

@ -34,7 +34,10 @@ object OpBlink : SpellOperator {
return Triple(
Spell(target, delta),
50_000 * delta.roundToInt(),
listOf(ParticleSpray.Cloud(targetMiddlePos, 2.0), ParticleSpray.Burst(targetMiddlePos.add(dvec), 2.0))
listOf(
ParticleSpray.Cloud(targetMiddlePos, 2.0, 50),
ParticleSpray.Burst(targetMiddlePos.add(dvec), 2.0, 100)
)
)
}

View file

@ -24,7 +24,7 @@ class OpExplode(val fire: Boolean) : SpellOperator {
return Triple(
Spell(pos, strength, this.fire),
((1 + strength + if (this.fire) 2 else 0) * 50_000.0).toInt(),
listOf(ParticleSpray.Burst(pos, strength))
listOf(ParticleSpray.Burst(pos, strength, 50))
)
}

View file

@ -3,8 +3,6 @@ package at.petrak.hexcasting.common.network;
import at.petrak.hexcasting.api.ParticleSpray;
import at.petrak.hexcasting.common.casting.colors.FrozenColorizer;
import at.petrak.hexcasting.common.particles.ConjureParticleOptions;
import com.mojang.math.Quaternion;
import com.mojang.math.Vector3f;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft;
import net.minecraft.network.FriendlyByteBuf;
@ -33,10 +31,12 @@ public record MsgCastParticleAck(ParticleSpray spray, FrozenColorizer colorizer)
var velZ = buf.readDouble();
var fuzziness = buf.readDouble();
var spread = buf.readDouble();
var count = buf.readInt();
var tag = buf.readAnySizeNbt();
var colorizer = FrozenColorizer.deserialize(tag);
return new MsgCastParticleAck(
new ParticleSpray(new Vec3(posX, posY, posZ), new Vec3(velX, velY, velZ), fuzziness, spread), colorizer);
new ParticleSpray(new Vec3(posX, posY, posZ), new Vec3(velX, velY, velZ), fuzziness, spread, count),
colorizer);
}
public void serialize(ByteBuf buffer) {
@ -49,29 +49,36 @@ public record MsgCastParticleAck(ParticleSpray spray, FrozenColorizer colorizer)
buf.writeDouble(this.spray.getVel().z);
buf.writeDouble(this.spray.getFuzziness());
buf.writeDouble(this.spray.getSpread());
buf.writeInt(this.spray.getCount());
buf.writeNbt(this.colorizer.serialize());
}
public void handle(Supplier<NetworkEvent.Context> ctx) {
ctx.get().enqueueWork(() ->
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> {
for (int i = 0; i < 20; i++) {
for (int i = 0; i < spray.getCount(); i++) {
// For the colors, pick any random time to get a mix of colors
var color = colorizer.getColor(RANDOM.nextFloat() * 256f, Vec3.ZERO);
var offset = randomInCircle(Mth.TWO_PI).scale(spray.getSpread());
var offset = randomInCircle(Mth.TWO_PI).normalize()
.scale(RANDOM.nextFloat() * spray.getSpread() / 2);
var pos = spray.getPos().add(offset);
// https://math.stackexchange.com/questions/56784/generate-a-random-direction-within-a-cone
var northCone = randomInCircle(spray.getSpread());
var velNorm = spray.getVel().normalize();
var zp = new Vec3(0.0, 0.0, 1.0);
var rotAxis = velNorm.cross(zp);
var th = Math.acos(velNorm.dot(zp));
var dagn = new Quaternion(new Vector3f(rotAxis), (float) th, false);
var velf = new Vector3f(northCone);
velf.transform(dagn);
var vel = new Vec3(velf).scale(spray.getVel().length());
var phi = Math.acos(1.0 - RANDOM.nextDouble() * (1.0 - Math.cos(spray.getSpread())));
var theta = Math.PI * 2.0 * RANDOM.nextDouble();
var v = spray.getVel().normalize();
// pick any old vector to get a vector normal to v with
Vec3 k;
if (v.x == 0.0 && v.y == 0.0) {
// oops, pick a *different* normal
k = new Vec3(1.0, 0.0, 0.0);
} else {
k = v.cross(new Vec3(0.0, 0.0, 1.0));
}
var velUnlen = v.scale(Math.cos(phi))
.add(k.scale(Math.sin(phi) * Math.cos(theta)))
.add(v.cross(k).scale(Math.sin(phi) * Math.sin(theta)));
var vel = velUnlen.scale(spray.getVel().length() / 20);
Minecraft.getInstance().level.addParticle(
new ConjureParticleOptions(color, false),

View file

@ -132,7 +132,7 @@ public class Recipes extends RecipeProvider {
Items.HONEYCOMB,
Items.RAW_IRON,
Items.WATER_BUCKET,
Items.FEATHER,
Items.AZALEA,
Items.ARROW,
};
for (int i = 0; i < politicsInMyVidya.length; i++) {

View file

@ -319,13 +319,13 @@
"hexcasting.entry.phials": "Phials of Media",
"hexcasting.page.phials1": "I find it quite ... irritating, how Nature refuses to give me change for my work. If all I have on hand is $(item)Charged Crystal/$s, even the tiniest $(action)Archer's Purification/$ will consume the entire crystal, wasting the remaining _media.$(br2)Fortunately, it seems I've found a way somewhat allay this problem.",
"hexcasting.page.phials2": "I've found old scrolls describing a $(item)Glass Bottle/$ infused with _media. When casting _Hexes, my spells would then draw _media out of the phial. The liquid form of the _media would let me take exact change, so to speak; nothing would be wasted.",
"hexcasting.page.phials3": "It's quite like the internal battery of a $(item)Trinket/$, or similar. I cen even $(l:patterns/spells/hexcasting#hexcasting:recharge)$(action)Recharge/$ them in the same manner. $(br2)Unfortunately, the art of actually $(italic)making/$ the things seems to have been lost to time. I've found a hint at the pattern used to craft it, but the technique is irritatingly elusive, and I can't seem to do it successfully.",
"hexcasting.page.phials4": "I suspect I will figure it out with study and practice, though. For now, I will simply deal with the wasted _media...$(br2)But I won't settle for it forever.$(br2)",
"hexcasting.page.phials3": "It's quite like the internal battery of a $(item)Trinket/$, or similar. I can even $(l:patterns/spells/hexcasting#hexcasting:recharge)$(action)Recharge/$ them in the same manner. $(br2)Unfortunately, the art of actually $(italic)making/$ the things seems to have been lost to time. I've found a hint at the pattern used to craft it, but the technique is irritatingly elusive, and I can't seem to do it successfully.",
"hexcasting.page.phials4": "I suspect I will figure it out with study and practice, though. For now, I will simply deal with the wasted _media...$(br2)But I won't settle for it forever.$(br2)$(italic)Drink the milk./$",
"hexcasting.entry.pigments": "Pigments",
"hexcasting.page.pigments1": "Although their names were lost to time, the old practitioners of my art seem to have identified themselves by a color, emblematic of them and their spells. It seems a special kind of pigment, offered to Nature in the right way, would \"[...] paint one's thoughts in a manner pleasing to Nature, inducing a miraculous change in personal colour.\"",
"hexcasting.page.pigments2": "I'm not certain on the specifics of how it works, but I believe I have isolated the formulae for many different colors of pigments. To use a pigment, I hold it in one hand while casting $(l:patterns/spells/colorize)$(action)Internalize Pigment/$ with the other, consuming the pigment and marking my mind with its color.$(br2)The pigments seem to affect the color of the sparks of media emitted out of a staff when I cast a _Hex, as well as my $(l:patterns/sentinels)$(thing)Sentinel/$.",
"hexcasting.page.pigments3header": "Chromatic Colorizers",
"hexcasting.page.pigments3header": "Chromatic Pigments",
"hexcasting.page.pigments3": "Pigments all the colors of the rainbow.",
"hexcasting.page.pigments4": "And finally, a pigment with a color wholly unique to me.$(br2)$(italic)And all the colors I am inside have not been invented yet./$",