renamed Colorizers to Pigments everywhere that wouldn't be tedious (i.e. not in ids, or lang files).
(cherry picked from commit d311390281213bd45165af6f504d7436fb989c44)
This commit is contained in:
parent
75b4eb7a4b
commit
99e8228610
|
@ -7,7 +7,7 @@ import net.minecraft.world.phys.Vec3;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface ADColorizer {
|
||||
public interface ADPigment {
|
||||
ColorProvider provideColor(UUID owner);
|
||||
|
||||
static int morphBetweenColors(int[] colors, Vec3 gradientDir, float time, Vec3 position) {
|
|
@ -104,7 +104,7 @@ public interface ICircleComponent {
|
|||
activator = impetus.getExecutionState().caster;
|
||||
|
||||
if (impetus == null || impetus.getExecutionState() == null)
|
||||
colorizer = new FrozenPigment(new ItemStack(HexItems.DYE_COLORIZERS.get(DyeColor.RED)), activator);
|
||||
colorizer = new FrozenPigment(new ItemStack(HexItems.DYE_PIGMENTS.get(DyeColor.RED)), activator);
|
||||
else
|
||||
colorizer = impetus.getPigment();
|
||||
|
||||
|
@ -123,7 +123,7 @@ public interface ICircleComponent {
|
|||
var spray = new ParticleSpray(vpos, vecOutDir.scale(success ? 1.0 : 1.5), success ? 0.1 : 0.5,
|
||||
Mth.PI / (success ? 4 : 2), success ? 30 : 100);
|
||||
spray.sprayParticles(serverLevel,
|
||||
success ? colorizer : new FrozenPigment(new ItemStack(HexItems.DYE_COLORIZERS.get(DyeColor.RED)),
|
||||
success ? colorizer : new FrozenPigment(new ItemStack(HexItems.DYE_PIGMENTS.get(DyeColor.RED)),
|
||||
activator));
|
||||
}
|
||||
|
||||
|
|
|
@ -289,7 +289,7 @@ public abstract class CastingEnvironment {
|
|||
EXTRACTION,
|
||||
}
|
||||
|
||||
public abstract FrozenPigment getColorizer();
|
||||
public abstract FrozenPigment getPigment();
|
||||
|
||||
public abstract @Nullable FrozenPigment setPigment(@Nullable FrozenPigment pigment);
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ public class CircleCastEnv extends CastingEnvironment {
|
|||
}
|
||||
|
||||
@Override
|
||||
public FrozenPigment getColorizer() {
|
||||
public FrozenPigment getPigment() {
|
||||
var impetus = this.getImpetus();
|
||||
if (impetus == null)
|
||||
return FrozenPigment.DEFAULT.get();
|
||||
|
|
|
@ -53,7 +53,7 @@ public class PackagedItemCastEnv extends PlayerBasedCastEnv {
|
|||
}
|
||||
|
||||
@Override
|
||||
public FrozenPigment getColorizer() {
|
||||
public FrozenPigment getPigment() {
|
||||
var casterStack = this.caster.getItemInHand(this.castingHand);
|
||||
var casterHexHolder = IXplatAbstractions.INSTANCE.findHexHolder(casterStack);
|
||||
return casterHexHolder.getPigment();
|
||||
|
|
|
@ -191,9 +191,7 @@ public abstract class PlayerBasedCastEnv extends CastingEnvironment {
|
|||
|
||||
@Override
|
||||
public @Nullable FrozenPigment setPigment(@Nullable FrozenPigment pigment) {
|
||||
IXplatAbstractions.INSTANCE.setColorizer(caster, pigment);
|
||||
|
||||
return null;
|
||||
return IXplatAbstractions.INSTANCE.setPigment(caster, pigment);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -63,7 +63,7 @@ public class StaffCastEnv extends PlayerBasedCastEnv {
|
|||
}
|
||||
|
||||
@Override
|
||||
public FrozenPigment getColorizer() {
|
||||
public FrozenPigment getPigment() {
|
||||
return HexAPI.instance().getColorizer(this.caster);
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ public class StaffCastEnv extends PlayerBasedCastEnv {
|
|||
// Somehow we lost spraying particles on each new pattern, so do it here
|
||||
// this also nicely prevents particle spam on trinkets
|
||||
new ParticleSpray(sender.position(), new Vec3(0.0, 1.5, 0.0), 0.4, Math.PI / 3, 30)
|
||||
.sprayParticles(sender.getLevel(), IXplatAbstractions.INSTANCE.getColorizer(sender));
|
||||
.sprayParticles(sender.getLevel(), IXplatAbstractions.INSTANCE.getPigment(sender));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ sealed class OperatorSideEffect {
|
|||
|
||||
data class Particles(val spray: ParticleSpray) : OperatorSideEffect() {
|
||||
override fun performEffect(harness: CastingVM): Boolean {
|
||||
harness.env.produceParticles(this.spray, harness.env.colorizer)
|
||||
harness.env.produceParticles(this.spray, harness.env.pigment)
|
||||
// this.spray.sprayParticles(harness.env.world, harness.env.colorizer)
|
||||
|
||||
return false
|
||||
|
@ -71,7 +71,7 @@ sealed class OperatorSideEffect {
|
|||
spray.sprayParticles(
|
||||
harness.env.world,
|
||||
FrozenPigment(
|
||||
ItemStack(HexItems.DYE_COLORIZERS[DyeColor.RED]!!),
|
||||
ItemStack(HexItems.DYE_PIGMENTS[DyeColor.RED]!!),
|
||||
Util.NIL_UUID
|
||||
)
|
||||
)
|
||||
|
|
|
@ -61,7 +61,7 @@ abstract class Mishap : Throwable() {
|
|||
|
||||
protected fun dyeColor(color: DyeColor): FrozenPigment =
|
||||
FrozenPigment(
|
||||
ItemStack(HexItems.DYE_COLORIZERS[color]!!),
|
||||
ItemStack(HexItems.DYE_PIGMENTS[color]!!),
|
||||
Util.NIL_UUID
|
||||
)
|
||||
|
||||
|
|
|
@ -13,6 +13,6 @@ import java.util.UUID;
|
|||
* and the appropriate cap/CC will be attached.
|
||||
*/
|
||||
@ApiStatus.OverrideOnly
|
||||
public interface ColorizerItem {
|
||||
public interface PigmentItem {
|
||||
ColorProvider provideColor(ItemStack stack, UUID owner);
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package at.petrak.hexcasting.api.pigment;
|
||||
|
||||
import at.petrak.hexcasting.api.addldata.ADColorizer;
|
||||
import at.petrak.hexcasting.api.addldata.ADPigment;
|
||||
import net.minecraft.util.FastColor;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
|
@ -30,7 +30,7 @@ public abstract class ColorProvider {
|
|||
double luminance = (0.2126 * r + 0.7152 * g + 0.0722 * b) / 0xFF; // Standard relative luminance calculation
|
||||
|
||||
if (luminance < 0.05) {
|
||||
int rawMod = ADColorizer.morphBetweenColors(MINIMUM_LUMINANCE_COLOR_WHEEL, new Vec3(0.1, 0.1, 0.1),
|
||||
int rawMod = ADPigment.morphBetweenColors(MINIMUM_LUMINANCE_COLOR_WHEEL, new Vec3(0.1, 0.1, 0.1),
|
||||
time / 20 / 20, position);
|
||||
|
||||
r += FastColor.ARGB32.red(rawMod);
|
||||
|
|
|
@ -21,7 +21,7 @@ public record FrozenPigment(ItemStack item, UUID owner) {
|
|||
public static final String TAG_OWNER = "owner";
|
||||
|
||||
public static final Supplier<FrozenPigment> DEFAULT =
|
||||
() -> new FrozenPigment(new ItemStack(HexItems.DEFAULT_COLORIZER), Util.NIL_UUID);
|
||||
() -> new FrozenPigment(new ItemStack(HexItems.DEFAULT_PIGMENT), Util.NIL_UUID);
|
||||
|
||||
public CompoundTag serializeToNBT() {
|
||||
var out = new CompoundTag();
|
||||
|
|
|
@ -83,7 +83,7 @@ public class HexAdditionalRenderers {
|
|||
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
RenderSystem.lineWidth(5f);
|
||||
|
||||
var colorizer = IXplatAbstractions.INSTANCE.getColorizer(owner);
|
||||
var colorizer = IXplatAbstractions.INSTANCE.getPigment(owner);
|
||||
var colProvider = colorizer.getColorProvider();
|
||||
BiConsumer<float[], float[]> v = (l, r) -> {
|
||||
int lcolor = colProvider.getColor(time, new Vec3(l[0], l[1], l[2])),
|
||||
|
|
|
@ -18,10 +18,10 @@ object OpColorize : SpellAction {
|
|||
args: List<Iota>,
|
||||
ctx: CastingEnvironment
|
||||
): SpellAction.Result {
|
||||
val (handStack, hand) = ctx.getHeldItemToOperateOn(IXplatAbstractions.INSTANCE::isColorizer)
|
||||
val (handStack, hand) = ctx.getHeldItemToOperateOn(IXplatAbstractions.INSTANCE::isPigment)
|
||||
?: throw MishapBadOffhandItem.of(ItemStack.EMPTY, null, "colorizer") // TODO: hack
|
||||
|
||||
if (!IXplatAbstractions.INSTANCE.isColorizer(handStack)) {
|
||||
if (!IXplatAbstractions.INSTANCE.isPigment(handStack)) {
|
||||
throw MishapBadOffhandItem.of(
|
||||
handStack,
|
||||
hand,
|
||||
|
|
|
@ -58,10 +58,10 @@ class OpConjureBlock(val light: Boolean) : SpellAction {
|
|||
if (state != null) {
|
||||
ctx.world.setBlock(pos, state, 5)
|
||||
|
||||
val colorizer = ctx.colorizer
|
||||
val pigment = ctx.pigment
|
||||
|
||||
if (ctx.world.getBlockState(pos).block is BlockConjured) {
|
||||
BlockConjured.setColor(ctx.world, pos, colorizer)
|
||||
BlockConjured.setColor(ctx.world, pos, pigment)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,8 +110,8 @@ class OpFlight(val type: Type) : SpellAction {
|
|||
}
|
||||
player.level.playSound(null, player.x, player.y, player.z, HexSounds.FLIGHT_FINISH, SoundSource.PLAYERS, 2f, 1f)
|
||||
val superDangerSpray = ParticleSpray(player.position(), Vec3(0.0, 1.0, 0.0), Math.PI, 0.4, count = 20)
|
||||
superDangerSpray.sprayParticles(player.getLevel(), FrozenPigment(ItemStack(HexItems.DYE_COLORIZERS[DyeColor.RED]!!), Util.NIL_UUID))
|
||||
superDangerSpray.sprayParticles(player.getLevel(), FrozenPigment(ItemStack(HexItems.DYE_COLORIZERS[DyeColor.BLACK]!!), Util.NIL_UUID))
|
||||
superDangerSpray.sprayParticles(player.getLevel(), FrozenPigment(ItemStack(HexItems.DYE_PIGMENTS[DyeColor.RED]!!), Util.NIL_UUID))
|
||||
superDangerSpray.sprayParticles(player.getLevel(), FrozenPigment(ItemStack(HexItems.DYE_PIGMENTS[DyeColor.BLACK]!!), Util.NIL_UUID))
|
||||
} else {
|
||||
if (!player.abilities.mayfly) {
|
||||
player.abilities.mayfly = true
|
||||
|
@ -136,16 +136,16 @@ class OpFlight(val type: Type) : SpellAction {
|
|||
val dangerParticleCount = (particleCount * danger).roundToInt()
|
||||
val okParticleCount = particleCount - dangerParticleCount
|
||||
val oneDangerParticleCount = Mth.ceil(dangerParticleCount / 2.0)
|
||||
val color = IXplatAbstractions.INSTANCE.getColorizer(player)
|
||||
val color = IXplatAbstractions.INSTANCE.getPigment(player)
|
||||
|
||||
// TODO: have the particles go in the opposite direction of the velocity?
|
||||
ParticleSpray(player.position(), Vec3(0.0, -0.6, 0.0), 0.6, Math.PI * 0.3, count = okParticleCount)
|
||||
.sprayParticles(player.getLevel(), color)
|
||||
val dangerSpray = ParticleSpray(player.position(), Vec3(0.0, 1.0, 0.0), 0.3, Math.PI * 0.75, count = 0)
|
||||
dangerSpray.copy(count = oneDangerParticleCount)
|
||||
.sprayParticles(player.getLevel(), FrozenPigment(ItemStack(HexItems.DYE_COLORIZERS[DyeColor.BLACK]!!), Util.NIL_UUID))
|
||||
.sprayParticles(player.getLevel(), FrozenPigment(ItemStack(HexItems.DYE_PIGMENTS[DyeColor.BLACK]!!), Util.NIL_UUID))
|
||||
dangerSpray.copy(count = oneDangerParticleCount)
|
||||
.sprayParticles(player.getLevel(), FrozenPigment(ItemStack(HexItems.DYE_COLORIZERS[DyeColor.RED]!!), Util.NIL_UUID))
|
||||
.sprayParticles(player.getLevel(), FrozenPigment(ItemStack(HexItems.DYE_PIGMENTS[DyeColor.RED]!!), Util.NIL_UUID))
|
||||
|
||||
if (player.level.random.nextFloat() < 0.02)
|
||||
player.level.playSound(null, player.x, player.y, player.z, HexSounds.FLIGHT_AMBIENCE, SoundSource.PLAYERS, 0.2f, 1f)
|
||||
|
|
|
@ -74,7 +74,7 @@ class OpMakePackagedSpell<T : ItemPackagedHex>(val itemType: T, val cost: Int) :
|
|||
val entityStack = itemEntity.item.copy()
|
||||
val mediamount = extractMedia(entityStack, drainForBatteries = true)
|
||||
if (mediamount > 0) {
|
||||
hexHolder.writeHex(patterns, ctx.colorizer, mediamount)
|
||||
hexHolder.writeHex(patterns, ctx.pigment, mediamount)
|
||||
}
|
||||
|
||||
itemEntity.item = entityStack
|
||||
|
|
|
@ -58,7 +58,7 @@ object OpAltiora : SpellAction {
|
|||
if (player.level.random.nextFloat() < 0.02)
|
||||
player.level.playSound(null, player.x, player.y, player.z, HexSounds.FLIGHT_AMBIENCE, SoundSource.PLAYERS, 0.2f, 1f)
|
||||
|
||||
val color = IXplatAbstractions.INSTANCE.getColorizer(player)
|
||||
val color = IXplatAbstractions.INSTANCE.getPigment(player)
|
||||
ParticleSpray(player.position(), Vec3(0.0, -0.2, 0.0), 0.4, Math.PI * 0.5, count = 3)
|
||||
.sprayParticles(player.getLevel(), color)
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ public class HexAPIImpl implements HexAPI {
|
|||
|
||||
@Override
|
||||
public FrozenPigment getColorizer(Player player) {
|
||||
return IXplatAbstractions.INSTANCE.getColorizer(player);
|
||||
return IXplatAbstractions.INSTANCE.getPigment(player);
|
||||
}
|
||||
|
||||
ArmorMaterial ARMOR_MATERIAL = new ArmorMaterial() {
|
||||
|
|
|
@ -144,7 +144,7 @@ public abstract class ItemPackagedHex extends ItemMediaHolder implements HexHold
|
|||
// Somehow we lost spraying particles on each new pattern, so do it here
|
||||
// this also nicely prevents particle spam on trinkets
|
||||
new ParticleSpray(player.position(), new Vec3(0.0, 1.5, 0.0), 0.4, Math.PI / 3, 30)
|
||||
.sprayParticles(sPlayer.getLevel(), ctx.getColorizer());
|
||||
.sprayParticles(sPlayer.getLevel(), ctx.getPigment());
|
||||
}
|
||||
|
||||
var sound = ctx.getSound().sound();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package at.petrak.hexcasting.common.items.colorizer;
|
||||
package at.petrak.hexcasting.common.items.pigment;
|
||||
|
||||
import at.petrak.hexcasting.api.addldata.ADColorizer;
|
||||
import at.petrak.hexcasting.api.item.ColorizerItem;
|
||||
import at.petrak.hexcasting.api.addldata.ADPigment;
|
||||
import at.petrak.hexcasting.api.item.PigmentItem;
|
||||
import at.petrak.hexcasting.api.pigment.ColorProvider;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
@ -9,8 +9,8 @@ import net.minecraft.world.phys.Vec3;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
public class ItemAmethystAndCopperColorizer extends Item implements ColorizerItem {
|
||||
public ItemAmethystAndCopperColorizer(Properties pProperties) {
|
||||
public class ItemAmethystAndCopperPigment extends Item implements PigmentItem {
|
||||
public ItemAmethystAndCopperPigment(Properties pProperties) {
|
||||
super(pProperties);
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ public class ItemAmethystAndCopperColorizer extends Item implements ColorizerIte
|
|||
|
||||
@Override
|
||||
protected int getRawColor(float time, Vec3 position) {
|
||||
return ADColorizer.morphBetweenColors(COLORS, new Vec3(0.1, 0.1, 0.1), time / 600, position);
|
||||
return ADPigment.morphBetweenColors(COLORS, new Vec3(0.1, 0.1, 0.1), time / 600, position);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package at.petrak.hexcasting.common.items.colorizer;
|
||||
package at.petrak.hexcasting.common.items.pigment;
|
||||
|
||||
import at.petrak.hexcasting.api.item.ColorizerItem;
|
||||
import at.petrak.hexcasting.api.item.PigmentItem;
|
||||
import at.petrak.hexcasting.api.pigment.ColorProvider;
|
||||
import net.minecraft.world.item.DyeColor;
|
||||
import net.minecraft.world.item.Item;
|
||||
|
@ -9,10 +9,10 @@ import net.minecraft.world.phys.Vec3;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
public class ItemDyeColorizer extends Item implements ColorizerItem {
|
||||
public class ItemDyePigment extends Item implements PigmentItem {
|
||||
private final DyeColor dyeColor;
|
||||
|
||||
public ItemDyeColorizer(DyeColor dyeColor, Properties pProperties) {
|
||||
public ItemDyePigment(DyeColor dyeColor, Properties pProperties) {
|
||||
super(pProperties);
|
||||
this.dyeColor = dyeColor;
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package at.petrak.hexcasting.common.items.colorizer;
|
||||
package at.petrak.hexcasting.common.items.pigment;
|
||||
|
||||
import at.petrak.hexcasting.api.addldata.ADColorizer;
|
||||
import at.petrak.hexcasting.api.item.ColorizerItem;
|
||||
import at.petrak.hexcasting.api.addldata.ADPigment;
|
||||
import at.petrak.hexcasting.api.item.PigmentItem;
|
||||
import at.petrak.hexcasting.api.pigment.ColorProvider;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
@ -10,7 +10,7 @@ import net.minecraft.world.phys.Vec3;
|
|||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ItemPrideColorizer extends Item implements ColorizerItem {
|
||||
public class ItemPridePigment extends Item implements PigmentItem {
|
||||
public enum Type {
|
||||
AGENDER(new int[]{0x16a10c, 0xffffff, 0x7a8081, 0x302f30}),
|
||||
AROACE(new int[]{0x7210bc, 0xebf367, 0xffffff, 0x82dceb, 0x2f4dd8}),
|
||||
|
@ -47,7 +47,7 @@ public class ItemPrideColorizer extends Item implements ColorizerItem {
|
|||
|
||||
public final Type type;
|
||||
|
||||
public ItemPrideColorizer(Type type, Properties pProperties) {
|
||||
public ItemPridePigment(Type type, Properties pProperties) {
|
||||
super(pProperties);
|
||||
this.type = type;
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public class ItemPrideColorizer extends Item implements ColorizerItem {
|
|||
protected class MyColorProvider extends ColorProvider {
|
||||
@Override
|
||||
protected int getRawColor(float time, Vec3 position) {
|
||||
return ADColorizer.morphBetweenColors(type.colors, new Vec3(0.1, 0.1, 0.1), time / 400, position);
|
||||
return ADPigment.morphBetweenColors(type.colors, new Vec3(0.1, 0.1, 0.1), time / 400, position);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package at.petrak.hexcasting.common.items.colorizer;
|
||||
package at.petrak.hexcasting.common.items.pigment;
|
||||
|
||||
import at.petrak.hexcasting.api.addldata.ADColorizer;
|
||||
import at.petrak.hexcasting.api.item.ColorizerItem;
|
||||
import at.petrak.hexcasting.api.addldata.ADPigment;
|
||||
import at.petrak.hexcasting.api.item.PigmentItem;
|
||||
import at.petrak.hexcasting.api.pigment.ColorProvider;
|
||||
import at.petrak.paucal.api.PaucalAPI;
|
||||
import com.google.gson.JsonElement;
|
||||
|
@ -14,8 +14,8 @@ import java.awt.*;
|
|||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ItemUUIDColorizer extends Item implements ColorizerItem {
|
||||
public ItemUUIDColorizer(Properties pProperties) {
|
||||
public class ItemUUIDPigment extends Item implements PigmentItem {
|
||||
public ItemUUIDPigment(Properties pProperties) {
|
||||
super(pProperties);
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ public class ItemUUIDColorizer extends Item implements ColorizerItem {
|
|||
|
||||
@Override
|
||||
protected int getRawColor(float time, Vec3 position) {
|
||||
return ADColorizer.morphBetweenColors(this.colors, new Vec3(0.1, 0.1, 0.1), time / 400, position);
|
||||
return ADPigment.morphBetweenColors(this.colors, new Vec3(0.1, 0.1, 0.1), time / 400, position);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,10 +4,10 @@ import at.petrak.hexcasting.common.items.ItemJewelerHammer;
|
|||
import at.petrak.hexcasting.common.items.ItemLens;
|
||||
import at.petrak.hexcasting.common.items.ItemLoreFragment;
|
||||
import at.petrak.hexcasting.common.items.ItemStaff;
|
||||
import at.petrak.hexcasting.common.items.colorizer.ItemAmethystAndCopperColorizer;
|
||||
import at.petrak.hexcasting.common.items.colorizer.ItemDyeColorizer;
|
||||
import at.petrak.hexcasting.common.items.colorizer.ItemPrideColorizer;
|
||||
import at.petrak.hexcasting.common.items.colorizer.ItemUUIDColorizer;
|
||||
import at.petrak.hexcasting.common.items.pigment.ItemAmethystAndCopperPigment;
|
||||
import at.petrak.hexcasting.common.items.pigment.ItemDyePigment;
|
||||
import at.petrak.hexcasting.common.items.pigment.ItemPridePigment;
|
||||
import at.petrak.hexcasting.common.items.pigment.ItemUUIDPigment;
|
||||
import at.petrak.hexcasting.common.items.magic.*;
|
||||
import at.petrak.hexcasting.common.items.storage.*;
|
||||
import at.petrak.hexcasting.xplat.IXplatAbstractions;
|
||||
|
@ -79,25 +79,25 @@ public class HexItems {
|
|||
public static final ItemMediaBattery BATTERY = make("battery",
|
||||
new ItemMediaBattery(unstackable()));
|
||||
|
||||
public static final EnumMap<DyeColor, ItemDyeColorizer> DYE_COLORIZERS = Util.make(() -> {
|
||||
var out = new EnumMap<DyeColor, ItemDyeColorizer>(DyeColor.class);
|
||||
public static final EnumMap<DyeColor, ItemDyePigment> DYE_PIGMENTS = Util.make(() -> {
|
||||
var out = new EnumMap<DyeColor, ItemDyePigment>(DyeColor.class);
|
||||
for (var dye : DyeColor.values()) {
|
||||
out.put(dye, make("dye_colorizer_" + dye.getName(), new ItemDyeColorizer(dye, unstackable())));
|
||||
out.put(dye, make("dye_colorizer_" + dye.getName(), new ItemDyePigment(dye, unstackable())));
|
||||
}
|
||||
return out;
|
||||
});
|
||||
public static final EnumMap<ItemPrideColorizer.Type, ItemPrideColorizer> PRIDE_COLORIZERS = Util.make(() -> {
|
||||
var out = new EnumMap<ItemPrideColorizer.Type, ItemPrideColorizer>(ItemPrideColorizer.Type.class);
|
||||
for (var politicsInMyVidya : ItemPrideColorizer.Type.values()) {
|
||||
public static final EnumMap<ItemPridePigment.Type, ItemPridePigment> PRIDE_PIGMENTS = Util.make(() -> {
|
||||
var out = new EnumMap<ItemPridePigment.Type, ItemPridePigment>(ItemPridePigment.Type.class);
|
||||
for (var politicsInMyVidya : ItemPridePigment.Type.values()) {
|
||||
out.put(politicsInMyVidya, make("pride_colorizer_" + politicsInMyVidya.getName(),
|
||||
new ItemPrideColorizer(politicsInMyVidya, unstackable())));
|
||||
new ItemPridePigment(politicsInMyVidya, unstackable())));
|
||||
}
|
||||
return out;
|
||||
});
|
||||
|
||||
public static final Item UUID_COLORIZER = make("uuid_colorizer", new ItemUUIDColorizer(unstackable()));
|
||||
public static final Item DEFAULT_COLORIZER = make("default_colorizer",
|
||||
new ItemAmethystAndCopperColorizer(unstackable()));
|
||||
public static final Item UUID_PIGMENT = make("uuid_colorizer", new ItemUUIDPigment(unstackable()));
|
||||
public static final Item DEFAULT_PIGMENT = make("default_colorizer",
|
||||
new ItemAmethystAndCopperPigment(unstackable()));
|
||||
|
||||
// BUFF SANDVICH
|
||||
public static final Item SUBMARINE_SANDWICH = make("sub_sandwich",
|
||||
|
|
|
@ -5,7 +5,7 @@ import at.petrak.hexcasting.api.misc.MediaConstants;
|
|||
import at.petrak.hexcasting.api.mod.HexTags;
|
||||
import at.petrak.hexcasting.common.blocks.decoration.BlockAkashicLog;
|
||||
import at.petrak.hexcasting.common.items.ItemStaff;
|
||||
import at.petrak.hexcasting.common.items.colorizer.ItemPrideColorizer;
|
||||
import at.petrak.hexcasting.common.items.pigment.ItemPridePigment;
|
||||
import at.petrak.hexcasting.common.lib.HexBlocks;
|
||||
import at.petrak.hexcasting.common.lib.HexItems;
|
||||
import at.petrak.hexcasting.common.recipe.SealThingsRecipe;
|
||||
|
@ -161,7 +161,7 @@ public class HexplatRecipes extends PaucalRecipeProvider {
|
|||
.unlockedBy("has_item", hasItem(Items.AMETHYST_SHARD)).save(recipes);
|
||||
|
||||
for (var dye : DyeColor.values()) {
|
||||
var item = HexItems.DYE_COLORIZERS.get(dye);
|
||||
var item = HexItems.DYE_PIGMENTS.get(dye);
|
||||
ShapedRecipeBuilder.shaped(item)
|
||||
.define('D', HexItems.AMETHYST_DUST)
|
||||
.define('C', DyeItem.byColor(dye))
|
||||
|
@ -171,30 +171,30 @@ public class HexplatRecipes extends PaucalRecipeProvider {
|
|||
.unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes);
|
||||
}
|
||||
|
||||
gayRecipe(recipes, ItemPrideColorizer.Type.AGENDER, Ingredient.of(Items.GLASS));
|
||||
gayRecipe(recipes, ItemPrideColorizer.Type.AROACE, Ingredient.of(Items.WHEAT_SEEDS));
|
||||
gayRecipe(recipes, ItemPrideColorizer.Type.AROMANTIC, Ingredient.of(Items.ARROW));
|
||||
gayRecipe(recipes, ItemPrideColorizer.Type.ASEXUAL, Ingredient.of(Items.BREAD));
|
||||
gayRecipe(recipes, ItemPrideColorizer.Type.BISEXUAL, Ingredient.of(Items.WHEAT));
|
||||
gayRecipe(recipes, ItemPrideColorizer.Type.DEMIBOY, Ingredient.of(Items.RAW_IRON));
|
||||
gayRecipe(recipes, ItemPrideColorizer.Type.DEMIGIRL, Ingredient.of(Items.RAW_COPPER));
|
||||
gayRecipe(recipes, ItemPrideColorizer.Type.GAY, Ingredient.of(Items.STONE_BRICK_WALL));
|
||||
gayRecipe(recipes, ItemPrideColorizer.Type.GENDERFLUID, Ingredient.of(Items.WATER_BUCKET));
|
||||
gayRecipe(recipes, ItemPrideColorizer.Type.GENDERQUEER, Ingredient.of(Items.GLASS_BOTTLE));
|
||||
gayRecipe(recipes, ItemPrideColorizer.Type.INTERSEX, Ingredient.of(Items.AZALEA));
|
||||
gayRecipe(recipes, ItemPrideColorizer.Type.LESBIAN, Ingredient.of(Items.HONEYCOMB));
|
||||
gayRecipe(recipes, ItemPrideColorizer.Type.NONBINARY, Ingredient.of(Items.MOSS_BLOCK));
|
||||
gayRecipe(recipes, ItemPrideColorizer.Type.PANSEXUAL, ingredients.whenModIngredient(
|
||||
gayRecipe(recipes, ItemPridePigment.Type.AGENDER, Ingredient.of(Items.GLASS));
|
||||
gayRecipe(recipes, ItemPridePigment.Type.AROACE, Ingredient.of(Items.WHEAT_SEEDS));
|
||||
gayRecipe(recipes, ItemPridePigment.Type.AROMANTIC, Ingredient.of(Items.ARROW));
|
||||
gayRecipe(recipes, ItemPridePigment.Type.ASEXUAL, Ingredient.of(Items.BREAD));
|
||||
gayRecipe(recipes, ItemPridePigment.Type.BISEXUAL, Ingredient.of(Items.WHEAT));
|
||||
gayRecipe(recipes, ItemPridePigment.Type.DEMIBOY, Ingredient.of(Items.RAW_IRON));
|
||||
gayRecipe(recipes, ItemPridePigment.Type.DEMIGIRL, Ingredient.of(Items.RAW_COPPER));
|
||||
gayRecipe(recipes, ItemPridePigment.Type.GAY, Ingredient.of(Items.STONE_BRICK_WALL));
|
||||
gayRecipe(recipes, ItemPridePigment.Type.GENDERFLUID, Ingredient.of(Items.WATER_BUCKET));
|
||||
gayRecipe(recipes, ItemPridePigment.Type.GENDERQUEER, Ingredient.of(Items.GLASS_BOTTLE));
|
||||
gayRecipe(recipes, ItemPridePigment.Type.INTERSEX, Ingredient.of(Items.AZALEA));
|
||||
gayRecipe(recipes, ItemPridePigment.Type.LESBIAN, Ingredient.of(Items.HONEYCOMB));
|
||||
gayRecipe(recipes, ItemPridePigment.Type.NONBINARY, Ingredient.of(Items.MOSS_BLOCK));
|
||||
gayRecipe(recipes, ItemPridePigment.Type.PANSEXUAL, ingredients.whenModIngredient(
|
||||
Ingredient.of(Items.CARROT),
|
||||
"farmersdelight",
|
||||
CompatIngredientValue.of("farmersdelight:skillet")
|
||||
));
|
||||
gayRecipe(recipes, ItemPrideColorizer.Type.PLURAL, Ingredient.of(Items.REPEATER));
|
||||
gayRecipe(recipes, ItemPrideColorizer.Type.TRANSGENDER, Ingredient.of(Items.EGG));
|
||||
gayRecipe(recipes, ItemPridePigment.Type.PLURAL, Ingredient.of(Items.REPEATER));
|
||||
gayRecipe(recipes, ItemPridePigment.Type.TRANSGENDER, Ingredient.of(Items.EGG));
|
||||
|
||||
ring(HexItems.UUID_COLORIZER, 1, HexItems.AMETHYST_DUST, Items.AMETHYST_SHARD)
|
||||
ring(HexItems.UUID_PIGMENT, 1, HexItems.AMETHYST_DUST, Items.AMETHYST_SHARD)
|
||||
.unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes);
|
||||
ring(HexItems.DEFAULT_COLORIZER, 1, HexItems.AMETHYST_DUST, Items.COPPER_INGOT)
|
||||
ring(HexItems.DEFAULT_PIGMENT, 1, HexItems.AMETHYST_DUST, Items.COPPER_INGOT)
|
||||
.unlockedBy("has_item", hasItem(HexItems.AMETHYST_DUST)).save(recipes);
|
||||
|
||||
ShapedRecipeBuilder.shaped(HexItems.SCROLL_SMOL)
|
||||
|
@ -526,8 +526,8 @@ public class HexplatRecipes extends PaucalRecipeProvider {
|
|||
.save(recipes);
|
||||
}
|
||||
|
||||
private void gayRecipe(Consumer<FinishedRecipe> recipes, ItemPrideColorizer.Type type, Ingredient material) {
|
||||
var colorizer = HexItems.PRIDE_COLORIZERS.get(type);
|
||||
private void gayRecipe(Consumer<FinishedRecipe> recipes, ItemPridePigment.Type type, Ingredient material) {
|
||||
var colorizer = HexItems.PRIDE_PIGMENTS.get(type);
|
||||
ShapedRecipeBuilder.shaped(colorizer)
|
||||
.define('D', HexItems.AMETHYST_DUST)
|
||||
.define('C', material)
|
||||
|
|
|
@ -81,7 +81,7 @@ public interface IXplatAbstractions {
|
|||
|
||||
boolean isBrainswept(Mob mob);
|
||||
|
||||
void setColorizer(Player target, FrozenPigment colorizer);
|
||||
@Nullable FrozenPigment setPigment(Player target, @Nullable FrozenPigment colorizer);
|
||||
|
||||
void setSentinel(Player target, @Nullable Sentinel sentinel);
|
||||
|
||||
|
@ -97,7 +97,7 @@ public interface IXplatAbstractions {
|
|||
|
||||
@Nullable AltioraAbility getAltiora(Player player);
|
||||
|
||||
FrozenPigment getColorizer(Player player);
|
||||
FrozenPigment getPigment(Player player);
|
||||
|
||||
@Nullable Sentinel getSentinel(Player player);
|
||||
|
||||
|
@ -126,9 +126,9 @@ public interface IXplatAbstractions {
|
|||
|
||||
// coooollooorrrs
|
||||
|
||||
boolean isColorizer(ItemStack stack);
|
||||
boolean isPigment(ItemStack stack);
|
||||
|
||||
ColorProvider getColorProvider(FrozenPigment colorizer);
|
||||
ColorProvider getColorProvider(FrozenPigment pigment);
|
||||
|
||||
// Items
|
||||
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
package at.petrak.hexcasting.fabric.cc;
|
||||
|
||||
import at.petrak.hexcasting.api.pigment.FrozenPigment;
|
||||
import dev.onyxstudios.cca.api.v3.component.Component;
|
||||
import dev.onyxstudios.cca.api.v3.component.sync.AutoSyncedComponent;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
||||
/**
|
||||
* Holds the colorizer item favored by the player
|
||||
*/
|
||||
public class CCFavoredColorizer implements Component, AutoSyncedComponent {
|
||||
public static final String TAG_COLORIZER = "colorizer";
|
||||
|
||||
private final Player owner;
|
||||
|
||||
public CCFavoredColorizer(Player owner) {
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
private FrozenPigment colorizer = FrozenPigment.DEFAULT.get();
|
||||
|
||||
public FrozenPigment getColorizer() {
|
||||
return colorizer;
|
||||
}
|
||||
|
||||
public void setColorizer(FrozenPigment colorizer) {
|
||||
this.colorizer = colorizer;
|
||||
HexCardinalComponents.FAVORED_COLORIZER.sync(this.owner);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNbt(CompoundTag tag) {
|
||||
this.colorizer = FrozenPigment.fromNBT(tag.getCompound(TAG_COLORIZER));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNbt(CompoundTag tag) {
|
||||
tag.put(TAG_COLORIZER, this.colorizer.serializeToNBT());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package at.petrak.hexcasting.fabric.cc;
|
||||
|
||||
import at.petrak.hexcasting.api.pigment.FrozenPigment;
|
||||
import dev.onyxstudios.cca.api.v3.component.Component;
|
||||
import dev.onyxstudios.cca.api.v3.component.sync.AutoSyncedComponent;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Holds the pigment item favored by the player
|
||||
*/
|
||||
public class CCFavoredPigment implements Component, AutoSyncedComponent {
|
||||
public static final String TAG_PIGMENT = "pigment";
|
||||
|
||||
private final Player owner;
|
||||
|
||||
public CCFavoredPigment(Player owner) {
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
private FrozenPigment pigment = FrozenPigment.DEFAULT.get();
|
||||
|
||||
public FrozenPigment getPigment() {
|
||||
return pigment;
|
||||
}
|
||||
|
||||
public FrozenPigment setPigment(@Nullable FrozenPigment pigment) {
|
||||
var old = this.pigment;
|
||||
this.pigment = pigment != null ? pigment : FrozenPigment.DEFAULT.get();
|
||||
HexCardinalComponents.FAVORED_PIGMENT.sync(this.owner);
|
||||
return old;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNbt(CompoundTag tag) {
|
||||
this.pigment = FrozenPigment.fromNBT(tag.getCompound(TAG_PIGMENT));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNbt(CompoundTag tag) {
|
||||
tag.put(TAG_PIGMENT, this.pigment.serializeToNBT());
|
||||
}
|
||||
}
|
|
@ -33,8 +33,8 @@ public class HexCardinalComponents implements EntityComponentInitializer, ItemCo
|
|||
// entities
|
||||
public static final ComponentKey<CCBrainswept> BRAINSWEPT = ComponentRegistry.getOrCreate(modLoc("brainswept"),
|
||||
CCBrainswept.class);
|
||||
public static final ComponentKey<CCFavoredColorizer> FAVORED_COLORIZER = ComponentRegistry.getOrCreate(
|
||||
modLoc("favored_colorizer"), CCFavoredColorizer.class);
|
||||
public static final ComponentKey<CCFavoredPigment> FAVORED_PIGMENT = ComponentRegistry.getOrCreate(
|
||||
modLoc("favored_pigment"), CCFavoredPigment.class);
|
||||
public static final ComponentKey<CCSentinel> SENTINEL = ComponentRegistry.getOrCreate(modLoc("sentinel"),
|
||||
CCSentinel.class);
|
||||
public static final ComponentKey<CCFlight> FLIGHT = ComponentRegistry.getOrCreate(modLoc("flight"),
|
||||
|
@ -48,8 +48,8 @@ public class HexCardinalComponents implements EntityComponentInitializer, ItemCo
|
|||
public static final ComponentKey<CCPatterns> PATTERNS = ComponentRegistry.getOrCreate(modLoc("patterns"),
|
||||
CCPatterns.class);
|
||||
|
||||
public static final ComponentKey<CCColorizer> COLORIZER = ComponentRegistry.getOrCreate(modLoc("colorizer"),
|
||||
CCColorizer.class);
|
||||
public static final ComponentKey<CCPigment> PIGMENT = ComponentRegistry.getOrCreate(modLoc("pigment"),
|
||||
CCPigment.class);
|
||||
public static final ComponentKey<CCIotaHolder> IOTA_HOLDER = ComponentRegistry.getOrCreate(modLoc("iota_holder"),
|
||||
CCIotaHolder.class);
|
||||
public static final ComponentKey<CCMediaHolder> MEDIA_HOLDER = ComponentRegistry.getOrCreate(modLoc("media_holder"),
|
||||
|
@ -63,7 +63,7 @@ public class HexCardinalComponents implements EntityComponentInitializer, ItemCo
|
|||
@Override
|
||||
public void registerEntityComponentFactories(EntityComponentFactoryRegistry registry) {
|
||||
registry.registerFor(Mob.class, BRAINSWEPT, CCBrainswept::new);
|
||||
registry.registerForPlayers(FAVORED_COLORIZER, CCFavoredColorizer::new, RespawnCopyStrategy.ALWAYS_COPY);
|
||||
registry.registerForPlayers(FAVORED_PIGMENT, CCFavoredPigment::new, RespawnCopyStrategy.ALWAYS_COPY);
|
||||
registry.registerForPlayers(SENTINEL, CCSentinel::new, RespawnCopyStrategy.ALWAYS_COPY);
|
||||
registry.registerForPlayers(ALTIORA, CCAltiora::new, RespawnCopyStrategy.LOSSLESS_ONLY);
|
||||
// Fortunately these are all both only needed on the server and don't want to be copied across death
|
||||
|
@ -82,7 +82,7 @@ public class HexCardinalComponents implements EntityComponentInitializer, ItemCo
|
|||
|
||||
@Override
|
||||
public void registerItemComponentFactories(ItemComponentFactoryRegistry registry) {
|
||||
registry.register(i -> i instanceof ColorizerItem, COLORIZER, CCColorizer.ItemBased::new);
|
||||
registry.register(i -> i instanceof PigmentItem, PIGMENT, CCPigment.ItemBased::new);
|
||||
|
||||
registry.register(i -> i instanceof IotaHolderItem, IOTA_HOLDER, CCItemIotaHolder.ItemBased::new);
|
||||
// oh havoc, you think you're so funny
|
||||
|
|
|
@ -24,7 +24,7 @@ public abstract class CCHexHolder extends ItemComponent implements ADHexHolder {
|
|||
super(owner);
|
||||
var item = owner.getItem();
|
||||
if (!(item instanceof HexHolderItem hexHolderItem)) {
|
||||
throw new IllegalStateException("item is not a colorizer: " + owner);
|
||||
throw new IllegalStateException("item is not a pigment: " + owner);
|
||||
}
|
||||
this.hexHolder = hexHolderItem;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package at.petrak.hexcasting.fabric.cc.adimpl;
|
||||
|
||||
import at.petrak.hexcasting.api.addldata.ADColorizer;
|
||||
import at.petrak.hexcasting.api.item.ColorizerItem;
|
||||
import at.petrak.hexcasting.api.addldata.ADPigment;
|
||||
import at.petrak.hexcasting.api.item.PigmentItem;
|
||||
import at.petrak.hexcasting.api.pigment.ColorProvider;
|
||||
import at.petrak.hexcasting.fabric.cc.HexCardinalComponents;
|
||||
import dev.onyxstudios.cca.api.v3.item.ItemComponent;
|
||||
|
@ -10,21 +10,21 @@ import net.minecraft.world.item.ItemStack;
|
|||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* The colorizer itself
|
||||
* The pigment itself
|
||||
*/
|
||||
public abstract class CCColorizer extends ItemComponent implements ADColorizer {
|
||||
public CCColorizer(ItemStack stack) {
|
||||
super(stack, HexCardinalComponents.COLORIZER);
|
||||
public abstract class CCPigment extends ItemComponent implements ADPigment {
|
||||
public CCPigment(ItemStack stack) {
|
||||
super(stack, HexCardinalComponents.PIGMENT);
|
||||
}
|
||||
|
||||
public static class ItemBased extends CCColorizer {
|
||||
private final ColorizerItem item;
|
||||
public static class ItemBased extends CCPigment {
|
||||
private final PigmentItem item;
|
||||
|
||||
public ItemBased(ItemStack owner) {
|
||||
super(owner);
|
||||
var item = owner.getItem();
|
||||
if (!(item instanceof ColorizerItem col)) {
|
||||
throw new IllegalStateException("item is not a colorizer: " + owner);
|
||||
if (!(item instanceof PigmentItem col)) {
|
||||
throw new IllegalStateException("item is not a pigment: " + owner);
|
||||
}
|
||||
this.item = col;
|
||||
}
|
|
@ -145,9 +145,11 @@ public class FabricXplatImpl implements IXplatAbstractions {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setColorizer(Player target, FrozenPigment colorizer) {
|
||||
var cc = HexCardinalComponents.FAVORED_COLORIZER.get(target);
|
||||
cc.setColorizer(colorizer);
|
||||
public @Nullable FrozenPigment setPigment(Player target, @Nullable FrozenPigment pigment) {
|
||||
var cc = HexCardinalComponents.FAVORED_PIGMENT.get(target);
|
||||
var old = cc.getPigment();
|
||||
cc.setPigment(pigment);
|
||||
return old;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -197,9 +199,9 @@ public class FabricXplatImpl implements IXplatAbstractions {
|
|||
}
|
||||
|
||||
@Override
|
||||
public FrozenPigment getColorizer(Player player) {
|
||||
var cc = HexCardinalComponents.FAVORED_COLORIZER.get(player);
|
||||
return cc.getColorizer();
|
||||
public FrozenPigment getPigment(Player player) {
|
||||
var cc = HexCardinalComponents.FAVORED_PIGMENT.get(player);
|
||||
return cc.getPigment();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -267,14 +269,14 @@ public class FabricXplatImpl implements IXplatAbstractions {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isColorizer(ItemStack stack) {
|
||||
return HexCardinalComponents.COLORIZER.isProvidedBy(stack);
|
||||
public boolean isPigment(ItemStack stack) {
|
||||
return HexCardinalComponents.PIGMENT.isProvidedBy(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColorProvider getColorProvider(FrozenPigment colorizer) {
|
||||
var cc = HexCardinalComponents.COLORIZER.maybeGet(colorizer.item());
|
||||
return cc.map(col -> col.provideColor(colorizer.owner())).orElse(ColorProvider.MISSING);
|
||||
public ColorProvider getColorProvider(FrozenPigment pigment) {
|
||||
var cc = HexCardinalComponents.PIGMENT.maybeGet(pigment.item());
|
||||
return cc.map(col -> col.provideColor(pigment.owner())).orElse(ColorProvider.MISSING);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package at.petrak.hexcasting.forge.cap;
|
||||
|
||||
import at.petrak.hexcasting.forge.network.MsgAltioraUpdateAck;
|
||||
import at.petrak.hexcasting.forge.network.MsgColorizerUpdateAck;
|
||||
import at.petrak.hexcasting.forge.network.MsgPigmentUpdateAck;
|
||||
import at.petrak.hexcasting.forge.network.MsgSentinelStatusUpdateAck;
|
||||
import at.petrak.hexcasting.xplat.IXplatAbstractions;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
@ -28,7 +28,7 @@ public class CapSyncers {
|
|||
x.setFlight(player, x.getFlight(proto));
|
||||
x.setAltiora(player, x.getAltiora(proto));
|
||||
x.setSentinel(player, x.getSentinel(proto));
|
||||
x.setColorizer(player, x.getColorizer(proto));
|
||||
x.setPigment(player, x.getPigment(proto));
|
||||
x.setStaffcastImage(player, x.getStaffcastVM(proto, InteractionHand.MAIN_HAND).getImage());
|
||||
x.setPatterns(player, x.getPatternsSavedInUi(proto));
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public class CapSyncers {
|
|||
}
|
||||
|
||||
syncSentinel(player);
|
||||
syncColorizer(player);
|
||||
syncPigment(player);
|
||||
syncAltiora(player);
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class CapSyncers {
|
|||
}
|
||||
|
||||
syncSentinel(player);
|
||||
syncColorizer(player);
|
||||
syncPigment(player);
|
||||
syncAltiora(player);
|
||||
}
|
||||
|
||||
|
@ -60,9 +60,9 @@ public class CapSyncers {
|
|||
new MsgSentinelStatusUpdateAck(IXplatAbstractions.INSTANCE.getSentinel(player)));
|
||||
}
|
||||
|
||||
public static void syncColorizer(ServerPlayer player) {
|
||||
public static void syncPigment(ServerPlayer player) {
|
||||
IXplatAbstractions.INSTANCE.sendPacketToPlayer(player,
|
||||
new MsgColorizerUpdateAck(IXplatAbstractions.INSTANCE.getColorizer(player)));
|
||||
new MsgPigmentUpdateAck(IXplatAbstractions.INSTANCE.getPigment(player)));
|
||||
}
|
||||
|
||||
public static void syncAltiora(ServerPlayer player) {
|
||||
|
|
|
@ -74,7 +74,7 @@ public class ForgeCapabilityHandler {
|
|||
evt.register(ADMediaHolder.class);
|
||||
evt.register(ADIotaHolder.class);
|
||||
evt.register(ADHexHolder.class);
|
||||
evt.register(ADColorizer.class);
|
||||
evt.register(ADPigment.class);
|
||||
}
|
||||
|
||||
public static void attachItemCaps(AttachCapabilitiesEvent<ItemStack> evt) {
|
||||
|
@ -124,9 +124,9 @@ public class ForgeCapabilityHandler {
|
|||
provide(stack, HexCapabilities.VARIANT_ITEM, () -> new CapItemVariantItem(variantItem, stack)));
|
||||
}
|
||||
|
||||
if (stack.getItem() instanceof ColorizerItem colorizer) {
|
||||
if (stack.getItem() instanceof PigmentItem pigment) {
|
||||
evt.addCapability(PIGMENT_CAP,
|
||||
provide(stack, HexCapabilities.COLOR, () -> new CapItemColorizer(colorizer, stack)));
|
||||
provide(stack, HexCapabilities.COLOR, () -> new CapItemPigment(pigment, stack)));
|
||||
}
|
||||
|
||||
if (IXplatAbstractions.INSTANCE.isModPresent(HexInterop.Forge.CURIOS_API_ID)
|
||||
|
|
|
@ -15,6 +15,6 @@ public final class HexCapabilities {
|
|||
});
|
||||
public static final Capability<ADVariantItem> VARIANT_ITEM = CapabilityManager.get(new CapabilityToken<>() {
|
||||
});
|
||||
public static final Capability<ADColorizer> COLOR = CapabilityManager.get(new CapabilityToken<>() {
|
||||
public static final Capability<ADPigment> COLOR = CapabilityManager.get(new CapabilityToken<>() {
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package at.petrak.hexcasting.forge.cap.adimpl;
|
||||
|
||||
import at.petrak.hexcasting.api.addldata.ADColorizer;
|
||||
import at.petrak.hexcasting.api.item.ColorizerItem;
|
||||
import at.petrak.hexcasting.api.addldata.ADPigment;
|
||||
import at.petrak.hexcasting.api.item.PigmentItem;
|
||||
import at.petrak.hexcasting.api.pigment.ColorProvider;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public record CapItemColorizer(ColorizerItem holder,
|
||||
ItemStack stack) implements ADColorizer {
|
||||
public record CapItemPigment(PigmentItem holder,
|
||||
ItemStack stack) implements ADPigment {
|
||||
@Override
|
||||
public ColorProvider provideColor(UUID owner) {
|
||||
return holder.provideColor(this.stack, owner);
|
|
@ -4,7 +4,7 @@ import at.petrak.hexcasting.api.HexAPI;
|
|||
import at.petrak.hexcasting.client.render.GaslightingTracker;
|
||||
import at.petrak.hexcasting.common.blocks.BlockQuenchedAllay;
|
||||
import at.petrak.hexcasting.common.items.ItemStaff;
|
||||
import at.petrak.hexcasting.common.items.colorizer.ItemPrideColorizer;
|
||||
import at.petrak.hexcasting.common.items.pigment.ItemPridePigment;
|
||||
import at.petrak.hexcasting.common.items.magic.ItemMediaBattery;
|
||||
import at.petrak.hexcasting.common.items.magic.ItemPackagedHex;
|
||||
import at.petrak.hexcasting.common.items.storage.ItemFocus;
|
||||
|
@ -138,18 +138,18 @@ public class HexItemModels extends PaucalItemModelProvider {
|
|||
}
|
||||
|
||||
for (var dye : DyeColor.values()) {
|
||||
singleTexture(getPath(HexItems.DYE_COLORIZERS.get(dye)),
|
||||
singleTexture(getPath(HexItems.DYE_PIGMENTS.get(dye)),
|
||||
new ResourceLocation("item/generated"),
|
||||
"layer0", modLoc("item/colorizer/dye_" + dye.getName()));
|
||||
}
|
||||
for (var type : ItemPrideColorizer.Type.values()) {
|
||||
singleTexture(getPath(HexItems.PRIDE_COLORIZERS.get(type)),
|
||||
for (var type : ItemPridePigment.Type.values()) {
|
||||
singleTexture(getPath(HexItems.PRIDE_PIGMENTS.get(type)),
|
||||
new ResourceLocation("item/generated"),
|
||||
"layer0", modLoc("item/colorizer/pride_" + type.getName()));
|
||||
}
|
||||
singleTexture(getPath(HexItems.UUID_COLORIZER), new ResourceLocation("item/generated"),
|
||||
singleTexture(getPath(HexItems.UUID_PIGMENT), new ResourceLocation("item/generated"),
|
||||
"layer0", modLoc("item/colorizer/uuid"));
|
||||
singleTexture(getPath(HexItems.DEFAULT_COLORIZER), new ResourceLocation("item/generated"),
|
||||
singleTexture(getPath(HexItems.DEFAULT_PIGMENT), new ResourceLocation("item/generated"),
|
||||
"layer0", modLoc("item/colorizer/uuid"));
|
||||
|
||||
simpleItem(modLoc("slate_blank"));
|
||||
|
|
|
@ -43,8 +43,8 @@ public class ForgePacketHandler {
|
|||
MsgBlinkS2C::deserialize, makeClientBoundHandler(MsgBlinkS2C::handle));
|
||||
NETWORK.registerMessage(messageIdx++, MsgSentinelStatusUpdateAck.class, MsgSentinelStatusUpdateAck::serialize,
|
||||
MsgSentinelStatusUpdateAck::deserialize, makeClientBoundHandler(MsgSentinelStatusUpdateAck::handle));
|
||||
NETWORK.registerMessage(messageIdx++, MsgColorizerUpdateAck.class, MsgColorizerUpdateAck::serialize,
|
||||
MsgColorizerUpdateAck::deserialize, makeClientBoundHandler(MsgColorizerUpdateAck::handle));
|
||||
NETWORK.registerMessage(messageIdx++, MsgPigmentUpdateAck.class, MsgPigmentUpdateAck::serialize,
|
||||
MsgPigmentUpdateAck::deserialize, makeClientBoundHandler(MsgPigmentUpdateAck::handle));
|
||||
NETWORK.registerMessage(messageIdx++, MsgAltioraUpdateAck.class, MsgAltioraUpdateAck::serialize,
|
||||
MsgAltioraUpdateAck::deserialize, makeClientBoundHandler(MsgAltioraUpdateAck::handle));
|
||||
NETWORK.registerMessage(messageIdx++, MsgCastParticleS2C.class, MsgCastParticleS2C::serialize,
|
||||
|
|
|
@ -13,7 +13,7 @@ import static at.petrak.hexcasting.api.HexAPI.modLoc;
|
|||
/**
|
||||
* Sent server->client to synchronize the status of the sentinel.
|
||||
*/
|
||||
public record MsgColorizerUpdateAck(FrozenPigment update) implements IMessage {
|
||||
public record MsgPigmentUpdateAck(FrozenPigment update) implements IMessage {
|
||||
public static final ResourceLocation ID = modLoc("color");
|
||||
|
||||
@Override
|
||||
|
@ -21,12 +21,12 @@ public record MsgColorizerUpdateAck(FrozenPigment update) implements IMessage {
|
|||
return ID;
|
||||
}
|
||||
|
||||
public static MsgColorizerUpdateAck deserialize(ByteBuf buffer) {
|
||||
public static MsgPigmentUpdateAck deserialize(ByteBuf buffer) {
|
||||
var buf = new FriendlyByteBuf(buffer);
|
||||
|
||||
var tag = buf.readAnySizeNbt();
|
||||
var colorizer = FrozenPigment.fromNBT(tag);
|
||||
return new MsgColorizerUpdateAck(colorizer);
|
||||
return new MsgPigmentUpdateAck(colorizer);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -34,13 +34,13 @@ public record MsgColorizerUpdateAck(FrozenPigment update) implements IMessage {
|
|||
buf.writeNbt(this.update.serializeToNBT());
|
||||
}
|
||||
|
||||
public static void handle(MsgColorizerUpdateAck self) {
|
||||
public static void handle(MsgPigmentUpdateAck self) {
|
||||
Minecraft.getInstance().execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
var player = Minecraft.getInstance().player;
|
||||
if (player != null) {
|
||||
IXplatAbstractions.INSTANCE.setColorizer(player, self.update());
|
||||
IXplatAbstractions.INSTANCE.setPigment(player, self.update());
|
||||
}
|
||||
}
|
||||
});
|
|
@ -181,13 +181,20 @@ public class ForgeXplatImpl implements IXplatAbstractions {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setColorizer(Player player, FrozenPigment colorizer) {
|
||||
public @Nullable FrozenPigment setPigment(Player player, @Nullable FrozenPigment pigment) {
|
||||
var old = getPigment(player);
|
||||
|
||||
CompoundTag tag = player.getPersistentData();
|
||||
tag.put(TAG_COLOR, colorizer.serializeToNBT());
|
||||
if (pigment != null)
|
||||
tag.put(TAG_PIGMENT, pigment.serializeToNBT());
|
||||
else
|
||||
tag.remove(TAG_PIGMENT);
|
||||
|
||||
if (player instanceof ServerPlayer serverPlayer) {
|
||||
CapSyncers.syncColorizer(serverPlayer);
|
||||
CapSyncers.syncPigment(serverPlayer);
|
||||
}
|
||||
|
||||
return old;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -255,8 +262,8 @@ public class ForgeXplatImpl implements IXplatAbstractions {
|
|||
}
|
||||
|
||||
@Override
|
||||
public FrozenPigment getColorizer(Player player) {
|
||||
return FrozenPigment.fromNBT(player.getPersistentData().getCompound(TAG_COLOR));
|
||||
public FrozenPigment getPigment(Player player) {
|
||||
return FrozenPigment.fromNBT(player.getPersistentData().getCompound(TAG_PIGMENT));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -340,15 +347,15 @@ public class ForgeXplatImpl implements IXplatAbstractions {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isColorizer(ItemStack stack) {
|
||||
public boolean isPigment(ItemStack stack) {
|
||||
return stack.getCapability(HexCapabilities.COLOR).isPresent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColorProvider getColorProvider(FrozenPigment colorizer) {
|
||||
var maybeColorizer = colorizer.item().getCapability(HexCapabilities.COLOR).resolve();
|
||||
if (maybeColorizer.isPresent()) {
|
||||
return maybeColorizer.get().provideColor(colorizer.owner());
|
||||
public ColorProvider getColorProvider(FrozenPigment pigment) {
|
||||
var maybePigment = pigment.item().getCapability(HexCapabilities.COLOR).resolve();
|
||||
if (maybePigment.isPresent()) {
|
||||
return maybePigment.get().provideColor(pigment.owner());
|
||||
}
|
||||
return ColorProvider.MISSING;
|
||||
}
|
||||
|
@ -561,7 +568,7 @@ public class ForgeXplatImpl implements IXplatAbstractions {
|
|||
public static final String TAG_SENTINEL_POSITION = "hexcasting:sentinel_position";
|
||||
public static final String TAG_SENTINEL_DIMENSION = "hexcasting:sentinel_dimension";
|
||||
|
||||
public static final String TAG_COLOR = "hexcasting:colorizer";
|
||||
public static final String TAG_PIGMENT = "hexcasting:pigment";
|
||||
|
||||
public static final String TAG_FLIGHT_ALLOWED = "hexcasting:flight_allowed";
|
||||
public static final String TAG_FLIGHT_TIME = "hexcasting:flight_time";
|
||||
|
|
Loading…
Reference in a new issue