mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 07:17:58 +01:00
1.19.2 -> 1.19.3 (1.20) [part 1]
This commit is contained in:
parent
6beca7649e
commit
c9c463d6c9
119 changed files with 507 additions and 436 deletions
38
build.gradle
38
build.gradle
|
@ -1,8 +1,15 @@
|
|||
buildscript {
|
||||
dependencies {
|
||||
classpath 'com.github.dexman545:Outlet:1.3.10'
|
||||
}
|
||||
}
|
||||
plugins {
|
||||
id 'java-library'
|
||||
id 'fabric-loom' version '0.12-SNAPSHOT'
|
||||
id 'com.modrinth.minotaur' version '2.+'
|
||||
id 'org.ajoberstar.reckon' version '0.13.0'
|
||||
}
|
||||
apply plugin: 'dex.plugins.outlet'
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
|
@ -11,6 +18,9 @@ java {
|
|||
withSourcesJar()
|
||||
}
|
||||
|
||||
outlet.allowSnapshotsForProject = false
|
||||
outlet.mcVersionRange = project.minecraft_version_range
|
||||
|
||||
group = project.group
|
||||
description = project.displayname
|
||||
archivesBaseName = project.name
|
||||
|
@ -45,11 +55,14 @@ dependencies {
|
|||
modApi "com.minelittlepony:kirin:${project.kirin_version}"
|
||||
include "com.minelittlepony:kirin:${project.kirin_version}"
|
||||
|
||||
// For reach-entity-attributes have not updated to 1.19.3.
|
||||
// Until then, clone from https://github.com/Sollace/reach-entity-attributes and run:
|
||||
// > gradlew build publishToMavenLocal
|
||||
modApi "com.jamieswhiteshirt:reach-entity-attributes:${project.reach_attributes_version}"
|
||||
include "com.jamieswhiteshirt:reach-entity-attributes:${project.reach_attributes_version}"
|
||||
|
||||
modCompileOnly "com.terraformersmc:modmenu:${project.modmenu_version}"
|
||||
modCompileOnly "dev.emi:trinkets:3.4.0"
|
||||
modCompileOnly "dev.emi:trinkets:${project.trinkets_version}"
|
||||
}
|
||||
|
||||
processResources {
|
||||
|
@ -63,3 +76,26 @@ processResources {
|
|||
tasks.withType(JavaCompile) {
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
|
||||
tasks.modrinth {
|
||||
onlyIf {
|
||||
def stage = version.version.stage.value
|
||||
stage == null || stage.name != 'beta'
|
||||
}
|
||||
}
|
||||
|
||||
modrinth {
|
||||
token = System.env.MODRINTH_KEY
|
||||
projectId = project.modrinth_project_id
|
||||
//featured = true
|
||||
versionNumber = version.toString()
|
||||
versionName = archivesBaseName + '-' + version
|
||||
changelog = "[Changelog](https://github.com/Sollace/Unicopia/releases/tag/${version.toString()})"
|
||||
uploadFile = remapJar
|
||||
outlet.mcVersions().each{ver ->
|
||||
gameVersions.add ver
|
||||
}
|
||||
dependencies {
|
||||
required.project 'P7dR8mSH'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,10 +3,10 @@ org.gradle.daemon=false
|
|||
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/develop
|
||||
minecraft_version=1.19.2
|
||||
yarn_mappings=1.19.2+build.3
|
||||
loader_version=0.14.9
|
||||
fabric_version=0.59.0+1.19.2
|
||||
minecraft_version=1.19.3
|
||||
yarn_mappings=1.19.3+build.2
|
||||
loader_version=0.14.11
|
||||
fabric_version=0.68.1+1.19.3
|
||||
|
||||
# Mod Properties
|
||||
group=com.minelittlepony
|
||||
|
@ -14,8 +14,14 @@ org.gradle.daemon=false
|
|||
authors=Sollace
|
||||
description=Magical Abilities for Mine Little Pony!
|
||||
|
||||
# Publishing
|
||||
minecraft_version_range=>=1.19.3-pre1
|
||||
modrinth_loader_type=fabric
|
||||
modrinth_project_id=
|
||||
|
||||
# Dependencies
|
||||
modmenu_version=4.0.6
|
||||
minelp_version=4.6.2-beta.1
|
||||
kirin_version=1.12.0-beta.4
|
||||
reach_attributes_version=2.3.0
|
||||
modmenu_version=5.0.0-alpha.3
|
||||
minelp_version=4.7.2
|
||||
kirin_version=1.13.2
|
||||
reach_attributes_version=2.3.1
|
||||
trinkets_version=3.5.0
|
|
@ -5,6 +5,10 @@ pluginManagement {
|
|||
name = 'Fabric'
|
||||
url = 'https://maven.fabricmc.net/'
|
||||
}
|
||||
maven {
|
||||
name = 'Jitpack'
|
||||
url = 'https://jitpack.io'
|
||||
}
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
|
||||
public final class Race implements Affine {
|
||||
public static final String DEFAULT_ID = "unicopia:human";
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package com.minelittlepony.unicopia;
|
||||
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.world.event.GameEvent;
|
||||
|
||||
public interface UGameEvents {
|
||||
|
@ -10,7 +11,7 @@ public interface UGameEvents {
|
|||
|
||||
static GameEvent register(String name, int range) {
|
||||
Identifier id = Unicopia.id(name);
|
||||
return Registry.register(Registry.GAME_EVENT, id, new GameEvent(id.toString(), range));
|
||||
return Registry.register(Registries.GAME_EVENT, id, new GameEvent(id.toString(), range));
|
||||
}
|
||||
|
||||
static void bootstrap() {
|
||||
|
|
|
@ -3,7 +3,8 @@ package com.minelittlepony.unicopia;
|
|||
import net.minecraft.sound.SoundEvent;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
|
||||
public interface USounds {
|
||||
SoundEvent AMBIENT_WIND_GUST = register("ambient.wind.gust");
|
||||
|
@ -88,7 +89,7 @@ public interface USounds {
|
|||
|
||||
static SoundEvent register(String name) {
|
||||
Identifier id = Unicopia.id(name);
|
||||
return Registry.register(Registry.SOUND_EVENT, id, new SoundEvent(id));
|
||||
return Registry.register(Registries.SOUND_EVENT, id, SoundEvent.of(id));
|
||||
}
|
||||
|
||||
static void bootstrap() {}
|
||||
|
|
|
@ -5,8 +5,8 @@ import com.minelittlepony.unicopia.item.toxin.Toxics;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tag.TagKey;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.*;
|
||||
import net.minecraft.registry.tag.TagKey;
|
||||
|
||||
public interface UTags {
|
||||
TagKey<Item> APPLES = item("apples");
|
||||
|
@ -35,15 +35,15 @@ public interface UTags {
|
|||
TagKey<EntityType<?>> TRANSFORMABLE_ENTITIES = entity("transformable");
|
||||
|
||||
static TagKey<Item> item(String name) {
|
||||
return TagKey.of(Registry.ITEM_KEY, Unicopia.id(name));
|
||||
return TagKey.of(RegistryKeys.ITEM, Unicopia.id(name));
|
||||
}
|
||||
|
||||
static TagKey<Block> block(String name) {
|
||||
return TagKey.of(Registry.BLOCK_KEY, Unicopia.id(name));
|
||||
return TagKey.of(RegistryKeys.BLOCK, Unicopia.id(name));
|
||||
}
|
||||
|
||||
static TagKey<EntityType<?>> entity(String name) {
|
||||
return TagKey.of(Registry.ENTITY_TYPE_KEY, Unicopia.id(name));
|
||||
return TagKey.of(RegistryKeys.ENTITY_TYPE, Unicopia.id(name));
|
||||
}
|
||||
|
||||
static void bootstrap() {
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.minelittlepony.unicopia;
|
|||
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.registry.RegistryEntry;
|
||||
import net.minecraft.registry.entry.RegistryEntry;
|
||||
import net.minecraft.world.PersistentState;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraft.world.dimension.DimensionTypes;
|
||||
|
|
|
@ -12,7 +12,7 @@ import com.minelittlepony.unicopia.Unicopia;
|
|||
import com.minelittlepony.unicopia.util.Registries;
|
||||
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registry;
|
||||
|
||||
public interface Abilities {
|
||||
Registry<Ability<?>> REGISTRY = Registries.createSimple(Unicopia.id("abilities"));
|
||||
|
|
|
@ -9,7 +9,7 @@ import net.minecraft.block.LeavesBlock;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
|
||||
public record TreeTypeImpl (
|
||||
Identifier name,
|
||||
|
@ -43,7 +43,7 @@ public record TreeTypeImpl (
|
|||
}
|
||||
|
||||
private static boolean findMatch(Set<Identifier> ids, BlockState state) {
|
||||
return ids.contains(Registry.BLOCK.getId(state.getBlock()));
|
||||
return ids.contains(Registries.BLOCK.getId(state.getBlock()));
|
||||
}
|
||||
|
||||
static boolean isNonPersistent(BlockState state) {
|
||||
|
|
|
@ -17,7 +17,7 @@ import net.minecraft.resource.JsonDataLoader;
|
|||
import net.minecraft.resource.ResourceManager;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.profiler.Profiler;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
|
||||
public class TreeTypeLoader extends JsonDataLoader implements IdentifiableResourceReloadListener {
|
||||
private static final Identifier ID = Unicopia.id("data/tree_type");
|
||||
|
@ -96,7 +96,7 @@ public class TreeTypeLoader extends JsonDataLoader implements IdentifiableResour
|
|||
}
|
||||
|
||||
void appendDrop(Weighted.Builder<Supplier<ItemStack>> weighted) {
|
||||
Registry.ITEM.getOrEmpty(item).ifPresent(item -> {
|
||||
Registries.ITEM.getOrEmpty(item).ifPresent(item -> {
|
||||
weighted.put(weight, item::getDefaultStack);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.LeavesBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tag.BlockTags;
|
||||
import net.minecraft.registry.tag.BlockTags;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
|
|
|
@ -16,10 +16,9 @@ import com.minelittlepony.unicopia.particle.UParticles;
|
|||
import com.minelittlepony.unicopia.particle.ParticleHandle.Attachment;
|
||||
|
||||
import net.minecraft.nbt.*;
|
||||
import net.minecraft.registry.*;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
|
@ -204,7 +203,7 @@ public class PlaceableSpell extends AbstractDelegatingSpell implements OrientedS
|
|||
if (compound.contains("dimension", NbtElement.STRING_TYPE)) {
|
||||
Identifier id = Identifier.tryParse(compound.getString("dimension"));
|
||||
if (id != null) {
|
||||
dimension = RegistryKey.of(Registry.WORLD_KEY, id);
|
||||
dimension = RegistryKey.of(RegistryKeys.WORLD, id);
|
||||
}
|
||||
}
|
||||
if (compound.contains("castEntity")) {
|
||||
|
|
|
@ -15,7 +15,7 @@ import net.minecraft.particle.ParticleTypes;
|
|||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
|
||||
public class AwkwardSpell extends AbstractSpell implements TimedSpell {
|
||||
|
||||
|
@ -47,12 +47,12 @@ public class AwkwardSpell extends AbstractSpell implements TimedSpell {
|
|||
if (source.isClient()) {
|
||||
source.spawnParticles(new Sphere(false, (1 + source.getLevel().getScaled(8)) * 8), 10, pos -> {
|
||||
|
||||
List<Identifier> names = new ArrayList<>(Registry.PARTICLE_TYPE.getIds());
|
||||
List<Identifier> names = new ArrayList<>(Registries.PARTICLE_TYPE.getIds());
|
||||
|
||||
int index = (int)MathHelper.nextDouble(source.getReferenceWorld().random, 0, names.size());
|
||||
|
||||
Identifier id = names.get(index);
|
||||
ParticleType<?> type = Registry.PARTICLE_TYPE.get(id);
|
||||
ParticleType<?> type = Registries.PARTICLE_TYPE.get(id);
|
||||
|
||||
if (type instanceof ParticleEffect && shouldSpawnParticle(type)) {
|
||||
source.addParticle((ParticleEffect)type, pos, Vec3d.ZERO);
|
||||
|
|
|
@ -31,7 +31,7 @@ import net.minecraft.util.hit.BlockHitResult;
|
|||
import net.minecraft.util.hit.EntityHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.explosion.Explosion.DestructionType;
|
||||
import net.minecraft.world.World.ExplosionSourceType;
|
||||
|
||||
/**
|
||||
* More powerful version of the vortex spell which creates a black hole.
|
||||
|
@ -61,7 +61,7 @@ public class DarkVortexSpell extends AttractiveSpell implements ProjectileDelega
|
|||
public void onImpact(MagicProjectileEntity projectile, BlockHitResult hit) {
|
||||
if (!projectile.isClient()) {
|
||||
BlockPos pos = hit.getBlockPos();
|
||||
projectile.world.createExplosion(projectile, pos.getX(), pos.getY(), pos.getZ(), 3, DestructionType.NONE);
|
||||
projectile.world.createExplosion(projectile, pos.getX(), pos.getY(), pos.getZ(), 3, ExplosionSourceType.NONE);
|
||||
toPlaceable().tick(projectile, Situation.BODY);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,13 +28,13 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.tag.BlockTags;
|
||||
import net.minecraft.registry.tag.BlockTags;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.hit.EntityHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.explosion.Explosion.DestructionType;
|
||||
import net.minecraft.world.World.ExplosionSourceType;
|
||||
|
||||
/**
|
||||
* Simple fire spell that triggers an effect when used on a block.
|
||||
|
@ -52,7 +52,7 @@ public class FireSpell extends AbstractAreaEffectSpell implements ProjectileDele
|
|||
public void onImpact(MagicProjectileEntity projectile, BlockHitResult hit) {
|
||||
if (!projectile.isClient()) {
|
||||
Vec3d pos = hit.getPos();
|
||||
projectile.getReferenceWorld().createExplosion(projectile.getOwner(), pos.getX(), pos.getY(), pos.getZ(), 2, DestructionType.DESTROY);
|
||||
projectile.getReferenceWorld().createExplosion(projectile.getOwner(), pos.getX(), pos.getY(), pos.getZ(), 2, ExplosionSourceType.MOB);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ public class FireSpell extends AbstractAreaEffectSpell implements ProjectileDele
|
|||
public void onImpact(MagicProjectileEntity projectile, EntityHitResult hit) {
|
||||
if (!projectile.isClient()) {
|
||||
Entity entity = hit.getEntity();
|
||||
projectile.getReferenceWorld().createExplosion(projectile.getOwner(), entity.getX(), entity.getY(), entity.getZ(), 2, DestructionType.DESTROY);
|
||||
projectile.getReferenceWorld().createExplosion(projectile.getOwner(), entity.getX(), entity.getY(), entity.getZ(), 2, ExplosionSourceType.MOB);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import net.minecraft.block.*;
|
|||
import net.minecraft.fluid.*;
|
||||
import net.minecraft.nbt.*;
|
||||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.tag.TagKey;
|
||||
import net.minecraft.registry.tag.TagKey;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
|
|
@ -20,8 +20,8 @@ import net.minecraft.entity.TntEntity;
|
|||
import net.minecraft.entity.Entity.RemovalReason;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.tag.BlockTags;
|
||||
import net.minecraft.tag.FluidTags;
|
||||
import net.minecraft.registry.tag.BlockTags;
|
||||
import net.minecraft.registry.tag.FluidTags;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
|
|
@ -23,11 +23,11 @@ import com.minelittlepony.unicopia.util.Registries;
|
|||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.tag.FluidTags;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.tag.FluidTags;
|
||||
|
||||
public final class SpellType<T extends Spell> implements Affine, SpellPredicate<T> {
|
||||
public static final Identifier EMPTY_ID = Unicopia.id("none");
|
||||
|
|
|
@ -33,7 +33,7 @@ import net.minecraft.network.PacketByteBuf;
|
|||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
|
||||
public final class SpellTraits implements Iterable<Map.Entry<Trait, Float>> {
|
||||
public static final SpellTraits EMPTY = new SpellTraits(Map.of());
|
||||
|
@ -199,7 +199,7 @@ public final class SpellTraits implements Iterable<Map.Entry<Trait, Float>> {
|
|||
}
|
||||
|
||||
public static SpellTraits of(Item item) {
|
||||
return REGISTRY.getOrDefault(Registry.ITEM.getId(item), EMPTY);
|
||||
return REGISTRY.getOrDefault(Registries.ITEM.getId(item), EMPTY);
|
||||
}
|
||||
|
||||
public static SpellTraits of(Block block) {
|
||||
|
@ -210,7 +210,7 @@ public final class SpellTraits implements Iterable<Map.Entry<Trait, Float>> {
|
|||
return REGISTRY.entrySet().stream()
|
||||
.filter(e -> e.getValue().get(trait) > 0)
|
||||
.map(Map.Entry::getKey)
|
||||
.flatMap(id -> Registry.ITEM.getOrEmpty(id).stream());
|
||||
.flatMap(id -> Registries.ITEM.getOrEmpty(id).stream());
|
||||
}
|
||||
|
||||
public static Optional<SpellTraits> getEmbeddedTraits(ItemStack stack) {
|
||||
|
|
|
@ -28,7 +28,7 @@ import net.minecraft.nbt.NbtString;
|
|||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TraitDiscovery implements NbtSerialisable {
|
||||
|
@ -66,7 +66,7 @@ public class TraitDiscovery implements NbtSerialisable {
|
|||
return;
|
||||
}
|
||||
SpellTraits traits = SpellTraits.of(item);
|
||||
items.put(Registry.ITEM.getId(item), traits);
|
||||
items.put(Registries.ITEM.getId(item), traits);
|
||||
Set<Trait> newTraits = new HashSet<>();
|
||||
traits.entries().forEach(e -> {
|
||||
if (this.traits.add(e.getKey())) {
|
||||
|
@ -81,13 +81,13 @@ public class TraitDiscovery implements NbtSerialisable {
|
|||
}
|
||||
|
||||
public SpellTraits getKnownTraits(Item item) {
|
||||
return items.getOrDefault(Registry.ITEM.getId(item), SpellTraits.EMPTY);
|
||||
return items.getOrDefault(Registries.ITEM.getId(item), SpellTraits.EMPTY);
|
||||
}
|
||||
|
||||
public Stream<Item> getKnownItems(Trait trait) {
|
||||
return items.entrySet().stream()
|
||||
.filter(entry -> entry.getValue().get(trait) > 0)
|
||||
.flatMap(entry -> Registry.ITEM.getOrEmpty(entry.getKey()).stream());
|
||||
.flatMap(entry -> Registries.ITEM.getOrEmpty(entry.getKey()).stream());
|
||||
}
|
||||
|
||||
public boolean isUnread() {
|
||||
|
@ -143,7 +143,7 @@ public class TraitDiscovery implements NbtSerialisable {
|
|||
|
||||
private Optional<SpellTraits> loadTraits(Identifier itemId, NbtCompound nbt) {
|
||||
if (!pony.isClient()) {
|
||||
return Registry.ITEM.getOrEmpty(itemId)
|
||||
return Registries.ITEM.getOrEmpty(itemId)
|
||||
.flatMap(item -> Optional.of(SpellTraits.of(item)))
|
||||
.filter(SpellTraits::isPresent)
|
||||
.or(() -> SpellTraits.fromNbt(nbt));
|
||||
|
|
|
@ -26,7 +26,7 @@ import net.minecraft.resource.SinglePreparationResourceReloader;
|
|||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.JsonHelper;
|
||||
import net.minecraft.util.profiler.Profiler;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
|
||||
public class TraitLoader extends SinglePreparationResourceReloader<Multimap<Identifier, TraitLoader.TraitStream>> implements IdentifiableResourceReloadListener {
|
||||
private static final Identifier ID = Unicopia.id("data/traits");
|
||||
|
@ -108,7 +108,7 @@ public class TraitLoader extends SinglePreparationResourceReloader<Multimap<Iden
|
|||
.map(JsonElement::getAsString)
|
||||
.map(Identifier::tryParse)
|
||||
.filter(item -> {
|
||||
if (item == null || !Registry.ITEM.containsId(item)) {
|
||||
if (item == null || !Registries.ITEM.containsId(item)) {
|
||||
Unicopia.LOGGER.warn("Skipping unknown item {} in {}:{}", item, pack, id);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -163,7 +163,7 @@ public class PieBlock extends Block implements Waterloggable {
|
|||
return Blocks.AIR.getDefaultState();
|
||||
}
|
||||
if (state.get(WATERLOGGED)) {
|
||||
world.createAndScheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world));
|
||||
world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world));
|
||||
}
|
||||
return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos);
|
||||
}
|
||||
|
|
|
@ -12,9 +12,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.util.math.random.Random;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldEvents;
|
||||
import net.minecraft.world.*;
|
||||
|
||||
public class RockCropBlock extends CropBlock {
|
||||
private static final VoxelShape[] AGE_TO_SHAPE = new VoxelShape[] {
|
||||
|
@ -93,7 +91,7 @@ public class RockCropBlock extends CropBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isFertilizable(BlockView world, BlockPos pos, BlockState state, boolean isClient) {
|
||||
public boolean isFertilizable(WorldView world, BlockPos pos, BlockState state, boolean isClient) {
|
||||
if (world instanceof World && !canGrow((World)world, ((World)world).random, pos, state)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@ public class SegmentedCropBlock extends CropBlock implements SegmentedBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isFertilizable(BlockView world, BlockPos pos, BlockState state, boolean isClient) {
|
||||
public boolean isFertilizable(WorldView world, BlockPos pos, BlockState state, boolean isClient) {
|
||||
return super.isFertilizable(world, pos, state, isClient) || (nextSegmentSupplier != null && isNext(world.getBlockState(pos.up())));
|
||||
}
|
||||
|
||||
|
|
|
@ -9,10 +9,11 @@ import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
|||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.sapling.SaplingGenerator;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.tag.BiomeTags;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
import net.minecraft.util.registry.*;
|
||||
import net.minecraft.registry.*;
|
||||
import net.minecraft.registry.tag.BiomeTags;
|
||||
import net.minecraft.registry.entry.*;
|
||||
import net.minecraft.world.gen.GenerationStep;
|
||||
import net.minecraft.world.gen.feature.*;
|
||||
import net.minecraft.world.gen.feature.size.TwoLayersFeatureSize;
|
||||
|
|
|
@ -3,13 +3,14 @@ package com.minelittlepony.unicopia.block;
|
|||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.block.entity.BlockEntityType.Builder;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
|
||||
public interface UBlockEntities {
|
||||
BlockEntityType<WeatherVaneBlock.WeatherVane> WEATHER_VANE = create("weather_vane", BlockEntityType.Builder.create(WeatherVaneBlock.WeatherVane::new, UBlocks.WEATHER_VANE));
|
||||
|
||||
static <T extends BlockEntity> BlockEntityType<T> create(String id, Builder<T> builder) {
|
||||
return Registry.register(Registry.BLOCK_ENTITY_TYPE, id, builder.build(null));
|
||||
return Registry.register(Registries.BLOCK_ENTITY_TYPE, id, builder.build(null));
|
||||
}
|
||||
|
||||
static void bootstrap() {}
|
||||
|
|
|
@ -16,7 +16,8 @@ import net.minecraft.sound.BlockSoundGroup;
|
|||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.world.BlockView;
|
||||
|
||||
public interface UBlocks {
|
||||
|
|
|
@ -3,10 +3,10 @@ package com.minelittlepony.unicopia.block;
|
|||
import com.minelittlepony.unicopia.Unicopia;
|
||||
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.tag.BlockTags;
|
||||
import net.minecraft.util.math.intprovider.ConstantIntProvider;
|
||||
import net.minecraft.util.math.intprovider.UniformIntProvider;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.tag.BlockTags;
|
||||
import net.minecraft.world.gen.foliage.BlobFoliagePlacer;
|
||||
import net.minecraft.world.gen.foliage.JungleFoliagePlacer;
|
||||
import net.minecraft.world.gen.trunk.StraightTrunkPlacer;
|
||||
|
@ -18,7 +18,7 @@ public interface UTreeGen {
|
|||
UniformIntProvider.create(3, 6),
|
||||
0.3f,
|
||||
UniformIntProvider.create(1, 3),
|
||||
Registry.BLOCK.getOrCreateEntryList(BlockTags.MANGROVE_LOGS_CAN_GROW_THROUGH)
|
||||
Registries.BLOCK.getOrCreateEntryList(BlockTags.MANGROVE_LOGS_CAN_GROW_THROUGH)
|
||||
), new JungleFoliagePlacer(
|
||||
ConstantIntProvider.create(3),
|
||||
ConstantIntProvider.create(2),
|
||||
|
|
|
@ -68,7 +68,7 @@ public class ZapAppleLeavesBlock extends LeavesBlock implements TintedBlock {
|
|||
onStageChanged(store, newStage, world, state, pos, random);
|
||||
}
|
||||
|
||||
world.createAndScheduleBlockTick(pos, this, 1);
|
||||
world.scheduleBlockTick(pos, this, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -79,7 +79,7 @@ public class ZapAppleLeavesBlock extends LeavesBlock implements TintedBlock {
|
|||
@Override
|
||||
public BlockState getPlacementState(ItemPlacementContext ctx) {
|
||||
if (!ctx.getWorld().isClient) {
|
||||
ctx.getWorld().createAndScheduleBlockTick(ctx.getBlockPos(), this, 1);
|
||||
ctx.getWorld().scheduleBlockTick(ctx.getBlockPos(), this, 1);
|
||||
return super.getPlacementState(ctx).with(STAGE, ZapAppleStageStore.get(ctx.getWorld()).getStage());
|
||||
}
|
||||
return super.getPlacementState(ctx);
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.minelittlepony.unicopia.util.Tickable;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.tag.BlockTags;
|
||||
import net.minecraft.registry.tag.BlockTags;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.*;
|
||||
import net.minecraft.world.Heightmap.Type;
|
||||
|
|
|
@ -14,7 +14,7 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.state.property.Property;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.JsonHelper;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class StateChange {
|
||||
|
@ -49,7 +49,7 @@ public abstract class StateChange {
|
|||
if (chance > 0 && world.random.nextFloat() > chance) {
|
||||
return state;
|
||||
}
|
||||
return Registry.BLOCK.getOrEmpty(id).map(Block::getDefaultState)
|
||||
return Registries.BLOCK.getOrEmpty(id).map(Block::getDefaultState)
|
||||
.map(newState -> merge(newState, state))
|
||||
.orElse(state);
|
||||
}
|
||||
|
|
|
@ -14,11 +14,13 @@ import com.google.gson.JsonObject;
|
|||
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.state.property.Property;
|
||||
import net.minecraft.tag.TagKey;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.JsonHelper;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryEntry;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.registry.entry.RegistryEntry;
|
||||
import net.minecraft.registry.tag.FluidTags;
|
||||
import net.minecraft.registry.tag.TagKey;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class StatePredicate implements Predicate<BlockState> {
|
||||
|
@ -52,7 +54,7 @@ public abstract class StatePredicate implements Predicate<BlockState> {
|
|||
predicates.add(ofState(JsonHelper.getString(o, "state")));
|
||||
}
|
||||
if (o.has("tag")) {
|
||||
Optional.of(JsonHelper.getString(o, "tag")).map(s -> TagKey.of(Registry.BLOCK_KEY, new Identifier(s))).ifPresent(tag -> {
|
||||
Optional.of(JsonHelper.getString(o, "tag")).map(s -> TagKey.of(RegistryKeys.BLOCK, new Identifier(s))).ifPresent(tag -> {
|
||||
predicates.add(new StatePredicate() {
|
||||
@Override
|
||||
public StateChange getInverse() {
|
||||
|
@ -65,7 +67,7 @@ public abstract class StatePredicate implements Predicate<BlockState> {
|
|||
|
||||
@Override
|
||||
public @NotNull BlockState getConverted(World world, @NotNull BlockState state) {
|
||||
return Registry.BLOCK.getOrCreateEntryList(tag)
|
||||
return Registries.BLOCK.getOrCreateEntryList(tag)
|
||||
.getRandom(world.random)
|
||||
.map(RegistryEntry::value)
|
||||
.map(Block::getDefaultState)
|
||||
|
@ -117,7 +119,8 @@ public abstract class StatePredicate implements Predicate<BlockState> {
|
|||
}
|
||||
|
||||
static boolean isOre(BlockState s) {
|
||||
return s.getBlock() instanceof OreBlock;
|
||||
// TODO: Use ConventionalBlockTags.ORES
|
||||
return s.getBlock() instanceof ExperienceDroppingBlock && !(s.getBlock() instanceof SculkBlock);
|
||||
}
|
||||
|
||||
static boolean isWater(BlockState s) {
|
||||
|
@ -152,14 +155,14 @@ public abstract class StatePredicate implements Predicate<BlockState> {
|
|||
|
||||
@Override
|
||||
public @NotNull BlockState getConverted(World world, @NotNull BlockState state) {
|
||||
return Registry.BLOCK.getOrEmpty(id).map(Block::getDefaultState).orElse(state);
|
||||
return Registries.BLOCK.getOrEmpty(id).map(Block::getDefaultState).orElse(state);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(BlockState state) {
|
||||
return Registry.BLOCK.getOrEmpty(id).filter(state::isOf).isPresent();
|
||||
return Registries.BLOCK.getOrEmpty(id).filter(state::isOf).isPresent();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -176,7 +179,7 @@ public abstract class StatePredicate implements Predicate<BlockState> {
|
|||
|
||||
@Override
|
||||
public @NotNull BlockState getConverted(World world, @NotNull BlockState state) {
|
||||
return Registry.BLOCK.getOrEmpty(id).map(Block::getDefaultState).map(newState -> {
|
||||
return Registries.BLOCK.getOrEmpty(id).map(Block::getDefaultState).map(newState -> {
|
||||
for (PropertyOp prop : properties) {
|
||||
newState = prop.applyTo(world, newState);
|
||||
}
|
||||
|
@ -188,7 +191,7 @@ public abstract class StatePredicate implements Predicate<BlockState> {
|
|||
|
||||
@Override
|
||||
public boolean test(BlockState state) {
|
||||
return Registry.BLOCK.getOrEmpty(id).filter(state::isOf).isPresent() && properties.stream().allMatch(p -> p.test(state));
|
||||
return Registries.BLOCK.getOrEmpty(id).filter(state::isOf).isPresent() && properties.stream().allMatch(p -> p.test(state));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public class DiscoveryToast implements Toast {
|
|||
return Toast.Visibility.HIDE;
|
||||
}
|
||||
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexProgram);
|
||||
RenderSystem.setShaderTexture(0, TEXTURE);
|
||||
RenderSystem.setShaderColor(1.0F, 1, 1, 1);
|
||||
manager.drawTexture(matrices, 0, 0, 0, 32, getWidth(), getHeight());
|
||||
|
|
|
@ -31,7 +31,7 @@ import net.minecraft.text.Text;
|
|||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.Pair;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
|
||||
public class ModifierTooltipRenderer implements ItemTooltipCallback {
|
||||
|
||||
|
@ -102,7 +102,7 @@ public class ModifierTooltipRenderer implements ItemTooltipCallback {
|
|||
if (stack.isDamaged()) {
|
||||
insertPosition = checkFor(lines, Text.translatable("item.durability", stack.getMaxDamage() - stack.getDamage(), stack.getMaxDamage()));
|
||||
} else {
|
||||
insertPosition = checkFor(lines, Text.literal(Registry.ITEM.getId(stack.getItem()).toString()).formatted(Formatting.DARK_GRAY));
|
||||
insertPosition = checkFor(lines, Text.literal(Registries.ITEM.getId(stack.getItem()).toString()).formatted(Formatting.DARK_GRAY));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ public class ModifierTooltipRenderer implements ItemTooltipCallback {
|
|||
return stack.getEnchantments()
|
||||
.stream()
|
||||
.map(t -> (NbtCompound)t)
|
||||
.map(tag -> Registry.ENCHANTMENT.getOrEmpty(Identifier.tryParse(tag.getString("id")))
|
||||
.map(tag -> Registries.ENCHANTMENT.getOrEmpty(Identifier.tryParse(tag.getString("id")))
|
||||
.map(ench -> new Pair<>(tag.getInt("lvl"), ench)))
|
||||
.filter(Optional::isPresent)
|
||||
.map(Optional::get);
|
||||
|
|
|
@ -3,6 +3,8 @@ package com.minelittlepony.unicopia.client.gui;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.joml.Vector4f;
|
||||
|
||||
import com.minelittlepony.common.client.gui.GameGui;
|
||||
import com.minelittlepony.unicopia.ability.magic.spell.*;
|
||||
import com.minelittlepony.unicopia.client.FlowingText;
|
||||
|
@ -153,27 +155,27 @@ public class DismissSpellScreen extends GameGui {
|
|||
|
||||
@Override
|
||||
public boolean isMouseOver(double mouseX, double mouseY) {
|
||||
return squareDistance(mouseX, mouseY, getX(), getY()) < 75;
|
||||
return squareDistance(mouseX, mouseY, x, y) < 75;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float tickDelta) {
|
||||
copy.set(getX(), getY(), getZ(), getW());
|
||||
copy.transform(matrices.peek().getPositionMatrix());
|
||||
copy.set(x, y, z, w);
|
||||
copy.mul(matrices.peek().getPositionMatrix());
|
||||
|
||||
var type = actualSpell.getType().withTraits(actualSpell.getTraits());
|
||||
|
||||
DrawableUtil.drawLine(matrices, 0, 0, (int)getX(), (int)getY(), 0xFFAAFF99);
|
||||
DrawableUtil.drawLine(matrices, 0, 0, (int)x, (int)y, 0xFFAAFF99);
|
||||
DrawableUtil.renderItemIcon(actualSpell.isDead() ? UItems.BOTCHED_GEM.getDefaultStack() : type.getDefaultStack(),
|
||||
copy.getX() - 8 + copy.getZ() / 20F,
|
||||
copy.getY() - 8 + copy.getZ() / 20F,
|
||||
copy.x - 8 + copy.z / 20F,
|
||||
copy.y - 8 + copy.z / 20F,
|
||||
1
|
||||
);
|
||||
|
||||
int color = actualSpell.getType().getColor() << 2;
|
||||
|
||||
matrices.push();
|
||||
matrices.translate(getX(), getY(), 0);
|
||||
matrices.translate(x, y, 0);
|
||||
|
||||
DrawableUtil.drawArc(matrices, 7, 8, 0, DrawableUtil.TAU, color | 0x00000088, false);
|
||||
|
||||
|
@ -221,7 +223,7 @@ public class DismissSpellScreen extends GameGui {
|
|||
}
|
||||
|
||||
static void playClickEffect() {
|
||||
MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 6, 0.3F));
|
||||
MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK.value(), 6, 0.3F));
|
||||
}
|
||||
|
||||
static double squareDistance(double x1, double y1, double x2, double y2) {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.minelittlepony.unicopia.client.gui;
|
||||
|
||||
import org.joml.Matrix4f;
|
||||
|
||||
import com.minelittlepony.unicopia.Race;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
|
@ -15,7 +17,6 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Matrix4f;
|
||||
|
||||
public interface DrawableUtil {
|
||||
double PI = Math.PI;
|
||||
|
@ -55,7 +56,7 @@ public interface DrawableUtil {
|
|||
RenderSystem.enableBlend();
|
||||
RenderSystem.disableTexture();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorShader);
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
||||
|
||||
Matrix4f matrix = matrices.peek().getPositionMatrix();
|
||||
|
||||
|
@ -67,11 +68,11 @@ public interface DrawableUtil {
|
|||
RenderSystem.enableBlend();
|
||||
RenderSystem.disableTexture();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorShader);
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
||||
bufferBuilder.begin(VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION_COLOR);
|
||||
bufferBuilder.vertex(matrix, x1, y1, 0).color(r, g, b, k).next();
|
||||
bufferBuilder.vertex(matrix, x2, y2, 0).color(r, g, b, k).next();
|
||||
BufferRenderer.drawWithShader(bufferBuilder.end());
|
||||
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
|
||||
RenderSystem.enableTexture();
|
||||
RenderSystem.disableBlend();
|
||||
}
|
||||
|
@ -98,7 +99,7 @@ public interface DrawableUtil {
|
|||
}
|
||||
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorShader);
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.disableTexture();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
|
@ -119,7 +120,7 @@ public interface DrawableUtil {
|
|||
cylendricalVertex(bufferBuilder, model, innerRadius, angle + INCREMENT, r, g, b, k);
|
||||
}
|
||||
|
||||
BufferRenderer.drawWithShader(bufferBuilder.end());
|
||||
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
|
||||
RenderSystem.enableTexture();
|
||||
}
|
||||
|
||||
|
@ -158,7 +159,7 @@ public interface DrawableUtil {
|
|||
}
|
||||
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorShader);
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.disableTexture();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
|
@ -185,7 +186,7 @@ public interface DrawableUtil {
|
|||
}
|
||||
}
|
||||
|
||||
BufferRenderer.drawWithShader(bufferBuilder.end());
|
||||
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
|
||||
RenderSystem.enableTexture();
|
||||
}
|
||||
|
||||
|
|
|
@ -25,10 +25,10 @@ public class TextBlock extends Label {
|
|||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
|
||||
int textY = (int)(y + MinecraftClient.getInstance().textRenderer.fontHeight/1.5F);
|
||||
int textY = (int)(getY() + MinecraftClient.getInstance().textRenderer.fontHeight/1.5F);
|
||||
|
||||
for (OrderedText line : getFont().wrapLines(getStyle().getText(), maxWidth)) {
|
||||
getFont().drawWithShadow(matrices, line, x, textY, getStyle().getColor());
|
||||
getFont().drawWithShadow(matrices, line, getX(), textY, getStyle().getColor());
|
||||
textY += getFont().fontHeight;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public class TribeButton extends Button {
|
|||
|
||||
@Override
|
||||
public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexProgram);
|
||||
RenderSystem.setShaderTexture(0, TribeSelectionScreen.TEXTURE);
|
||||
RenderSystem.setShaderColor(1, 1, 1, alpha);
|
||||
RenderSystem.enableBlend();
|
||||
|
@ -41,18 +41,18 @@ public class TribeButton extends Button {
|
|||
|
||||
MinecraftClient mc = MinecraftClient.getInstance();
|
||||
|
||||
drawTexture(matrices, x - 3, y - 13, 0, 0, 76, 69);
|
||||
drawTexture(matrices, getX() - 3, getY() - 13, 0, 0, 76, 69);
|
||||
if (isHovered()) {
|
||||
drawTexture(matrices, x - 4, y - 14, 76, 0, 78, 71);
|
||||
drawTexture(matrices, getX() - 4, getY() - 14, 76, 0, 78, 71);
|
||||
|
||||
if (hovered && screenWidth > 0) {
|
||||
Identifier id = Race.REGISTRY.getId(race);
|
||||
drawCenteredText(matrices, getFont(), Text.translatable("gui.unicopia.tribe_selection.describe." + id.getNamespace() + "." + id.getPath()), screenWidth / 2, y + height, 0xFFFFFFFF);
|
||||
drawCenteredText(matrices, getFont(), Text.translatable("gui.unicopia.tribe_selection.describe." + id.getNamespace() + "." + id.getPath()), screenWidth / 2, getY() + height, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
if (getStyle().hasIcon()) {
|
||||
getStyle().getIcon().render(matrices, x, y, mouseX, mouseY, partialTicks);
|
||||
getStyle().getIcon().render(matrices, getX(), getY(), mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
int foreColor = getStyle().getColor();
|
||||
|
|
|
@ -3,12 +3,12 @@ package com.minelittlepony.unicopia.client.gui;
|
|||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import com.minelittlepony.common.client.gui.GameGui;
|
||||
import com.minelittlepony.common.client.gui.element.Button;
|
||||
import com.minelittlepony.common.client.gui.element.Label;
|
||||
import com.minelittlepony.unicopia.Race;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import it.unimi.dsi.fastutil.booleans.BooleanConsumer;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.*;
|
||||
|
@ -33,8 +33,12 @@ public class TribeConfirmationScreen extends GameGui implements HidesHud {
|
|||
|
||||
int top = (height - columnHeight) / 2;
|
||||
|
||||
addDrawableChild(new ButtonWidget(width / 2 + 5, top + columnHeight + padding, 100, 20, Text.translatable("Join Tribe"), b -> callback.accept(true)));
|
||||
addDrawableChild(new ButtonWidget(width / 2 - 105, top + columnHeight + padding, 100, 20, Text.translatable("Go Back"), b -> callback.accept(false)));
|
||||
addDrawableChild(new Button(width / 2 + 5, top + columnHeight + padding, 100, 20))
|
||||
.onClick(b -> callback.accept(true))
|
||||
.getStyle().setText("Join Tribe");
|
||||
addDrawableChild(new Button(width / 2 - 105, top + columnHeight + padding, 100, 20))
|
||||
.onClick(b -> callback.accept(false))
|
||||
.getStyle().setText("Go Back");
|
||||
|
||||
addDrawable(new Label(width / 2, top - 30).setCentered()).getStyle().setText(Text.translatable("gui.unicopia.tribe_selection.confirm", selection.getDisplayName().copy().formatted(Formatting.YELLOW)));
|
||||
|
||||
|
|
|
@ -36,9 +36,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Quaternion;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.util.math.*;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
|
||||
public class UHud extends DrawableHelper {
|
||||
|
@ -153,7 +151,7 @@ public class UHud extends DrawableHelper {
|
|||
|
||||
view.push();
|
||||
view.translate(x, y, 0);
|
||||
view.multiply(new Quaternion(-9, xDirection * 45, 0, true));
|
||||
view.multiply(RotationAxis.POSITIVE_X.rotationDegrees(xDirection * 45));
|
||||
InventoryScreen.drawEntity(0, 0, scale, 0, -20, client.player);
|
||||
view.pop();
|
||||
RenderSystem.applyModelViewMatrix();
|
||||
|
@ -235,7 +233,7 @@ public class UHud extends DrawableHelper {
|
|||
if (hasEffect) {
|
||||
matrices.push();
|
||||
matrices.translate(scaledWidth, 0, 0);
|
||||
matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(90));
|
||||
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(90));
|
||||
|
||||
fillGradient(matrices, 0, 0, scaledHeight, scaledWidth / 2, 0xFFFFFF | 0, 0xFFFFFF | alpha2);
|
||||
fillGradient(matrices, 0, scaledWidth / 2, scaledHeight, scaledWidth, 0xFFFFFF | alpha2, 0xFFFFFF | 0);
|
||||
|
@ -302,7 +300,7 @@ public class UHud extends DrawableHelper {
|
|||
|
||||
matrices.push();
|
||||
matrices.translate(scaledWidth, 0, 0);
|
||||
matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(90));
|
||||
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(90));
|
||||
|
||||
fillGradient(matrices, 0, 0, scaledHeight, halfWidth, color | alpha1, color | alpha2);
|
||||
fillGradient(matrices, 0, scaledWidth - halfWidth, scaledHeight, scaledWidth, color | alpha2, color | alpha1);
|
||||
|
@ -328,7 +326,7 @@ public class UHud extends DrawableHelper {
|
|||
|
||||
matrices.push();
|
||||
matrices.translate(scaledWidth, 0, 0);
|
||||
matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(90));
|
||||
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(90));
|
||||
|
||||
fillGradient(matrices, 0, 0, scaledHeight, halfWidth, color | alpha1, color | alpha2);
|
||||
fillGradient(matrices, 0, scaledWidth - halfWidth, scaledHeight, scaledWidth, color | alpha2, color | alpha1);
|
||||
|
|
|
@ -2,6 +2,8 @@ package com.minelittlepony.unicopia.client.gui.spellbook;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.joml.Vector4f;
|
||||
|
||||
import com.minelittlepony.common.client.gui.element.Button;
|
||||
import com.minelittlepony.unicopia.ability.magic.spell.effect.CustomisedSpellType;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
@ -12,7 +14,6 @@ import net.minecraft.client.item.TooltipContext;
|
|||
import net.minecraft.client.render.item.ItemRenderer;
|
||||
import net.minecraft.client.sound.SoundManager;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.Vector4f;
|
||||
|
||||
public class EquippedSpellSlot extends Button {
|
||||
|
||||
|
@ -27,7 +28,7 @@ public class EquippedSpellSlot extends Button {
|
|||
if (spell.isEmpty()) {
|
||||
return List.of();
|
||||
}
|
||||
return spell.getDefaultStack().getTooltip(MinecraftClient.getInstance().player, TooltipContext.Default.NORMAL);
|
||||
return spell.getDefaultStack().getTooltip(MinecraftClient.getInstance().player, TooltipContext.Default.BASIC);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -37,24 +38,24 @@ public class EquippedSpellSlot extends Button {
|
|||
RenderSystem.setShaderTexture(0, SpellbookScreen.SLOT);
|
||||
RenderSystem.enableBlend();
|
||||
|
||||
drawTexture(matrices, x - 8, y - 8, 0, 0, 32, 32, 32, 32);
|
||||
drawTexture(matrices, getX() - 8, getY() - 8, 0, 0, 32, 32, 32, 32);
|
||||
|
||||
Vector4f pos = new Vector4f(x, y, 0, 1);
|
||||
pos.transform(matrices.peek().getPositionMatrix());
|
||||
Vector4f pos = new Vector4f(getX(), getY(), 0, 1);
|
||||
pos.mul(matrices.peek().getPositionMatrix());
|
||||
|
||||
if (spell.isEmpty()) {
|
||||
RenderSystem.setShaderColor(1, 1, 1, 0.3F);
|
||||
RenderSystem.setShaderTexture(0, SpellbookScreen.GEM);
|
||||
drawTexture(matrices, x, y, 0, 0, 16, 16, 16, 16);
|
||||
drawTexture(matrices, getX(), getY(), 0, 0, 16, 16, 16, 16);
|
||||
RenderSystem.disableBlend();
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
} else {
|
||||
RenderSystem.disableBlend();
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
drawItem((int)pos.getX(), (int)pos.getY());
|
||||
drawItem((int)pos.x, (int)pos.y);
|
||||
}
|
||||
if (isHovered()) {
|
||||
HandledScreen.drawSlotHighlight(matrices, x, y, 0);
|
||||
HandledScreen.drawSlotHighlight(matrices, getX(), getY(), 0);
|
||||
this.onPress();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.joml.Vector4f;
|
||||
|
||||
import com.minelittlepony.common.client.gui.*;
|
||||
import com.minelittlepony.common.client.gui.element.Button;
|
||||
import com.minelittlepony.unicopia.ability.magic.spell.crafting.SpellbookRecipe;
|
||||
|
@ -22,7 +24,6 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.screen.PlayerScreenHandler;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.math.Vector4f;
|
||||
|
||||
class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder {
|
||||
private final List<IngredientTree.Entry> entries = new ArrayList<>();
|
||||
|
@ -187,8 +188,8 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder {
|
|||
}
|
||||
|
||||
Vector4f pos = new Vector4f(x, y, 0, 1);
|
||||
pos.transform(matrices.peek().getPositionMatrix());
|
||||
drawItem((int)pos.getX(), (int)pos.getY());
|
||||
pos.mul(matrices.peek().getPositionMatrix());
|
||||
drawItem((int)pos.x, (int)pos.y);
|
||||
}
|
||||
|
||||
protected void drawItem(int x, int y) {
|
||||
|
@ -201,7 +202,7 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder {
|
|||
if (stacks[index].isEmpty()) {
|
||||
return List.of();
|
||||
}
|
||||
return stacks[index].getTooltip(MinecraftClient.getInstance().player, TooltipContext.Default.NORMAL);
|
||||
return stacks[index].getTooltip(MinecraftClient.getInstance().player, TooltipContext.Default.BASIC);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -292,7 +292,7 @@ public class SpellbookScreen extends HandledScreen<SpellbookScreenHandler> imple
|
|||
|
||||
@Override
|
||||
public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float tickDelta) {
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexProgram);
|
||||
|
||||
RenderSystem.setShaderColor(1, 1, 1, alpha);
|
||||
RenderSystem.defaultBlendFunc();
|
||||
|
@ -301,7 +301,7 @@ public class SpellbookScreen extends HandledScreen<SpellbookScreenHandler> imple
|
|||
GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
if (getStyle().hasIcon()) {
|
||||
getStyle().getIcon().render(matrices, x, y, mouseX, mouseY, tickDelta);
|
||||
getStyle().getIcon().render(matrices, getX(), getY(), mouseX, mouseY, tickDelta);
|
||||
}
|
||||
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
|
|
|
@ -128,7 +128,7 @@ public class SpellbookTraitDexPageContent extends DrawableHelper implements Spel
|
|||
.sorted(Comparator.comparing(u -> knownItems.contains(u) ? 0 : 1))
|
||||
.forEach(i -> {
|
||||
DefaultedList<ItemStack> stacks = DefaultedList.of();
|
||||
i.appendStacks(ItemGroup.SEARCH, stacks);
|
||||
i.appendStacks(ItemGroups.SEARCH, stacks);
|
||||
if (knownItems.contains(i)) {
|
||||
tree.input(stacks);
|
||||
} else {
|
||||
|
@ -205,14 +205,14 @@ public class SpellbookTraitDexPageContent extends DrawableHelper implements Spel
|
|||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
RenderSystem.setShaderTexture(0, SpellbookScreen.TEXTURE);
|
||||
RenderSystem.enableBlend();
|
||||
drawTexture(matrices, x - 2, y - 8, 204, 219, 22, 32, 512, 256);
|
||||
drawTexture(matrices, getX() - 2, getY() - 8, 204, 219, 22, 32, 512, 256);
|
||||
|
||||
if (!active) {
|
||||
drawTexture(matrices, x - 2, y - 1, 74, 223, 18, 18, 512, 256);
|
||||
drawTexture(matrices, getX() - 2, getY() - 1, 74, 223, 18, 18, 512, 256);
|
||||
}
|
||||
|
||||
if (discoveries.isUnread(trait)) {
|
||||
drawTexture(matrices, x - 8, y - 8, 225, 219, 35, 32, 512, 256);
|
||||
drawTexture(matrices, getX() - 8, getY() - 8, 225, 219, 35, 32, 512, 256);
|
||||
}
|
||||
|
||||
super.renderButton(matrices, mouseX, mouseY, tickDelta);
|
||||
|
|
|
@ -17,7 +17,7 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
|
||||
class AmuletGear extends AmuletModel implements IGear {
|
||||
|
||||
|
@ -41,7 +41,7 @@ class AmuletGear extends AmuletModel implements IGear {
|
|||
|
||||
@Override
|
||||
public <T extends Entity> Identifier getTexture(T entity, Context<T, ?> context) {
|
||||
return textures.computeIfAbsent(Registry.ITEM.getId(AmuletItem.getForEntity((LivingEntity)entity).getItem()), id -> new Identifier(id.getNamespace(), "textures/models/armor/" + id.getPath() + ".png"));
|
||||
return textures.computeIfAbsent(Registries.ITEM.getId(AmuletItem.getForEntity((LivingEntity)entity).getItem()), id -> new Identifier(id.getNamespace(), "textures/models/armor/" + id.getPath() + ".png"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,7 +16,7 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
|
||||
class GlassesGear extends GlassesModel implements IGear {
|
||||
|
||||
|
@ -38,7 +38,7 @@ class GlassesGear extends GlassesModel implements IGear {
|
|||
|
||||
@Override
|
||||
public <T extends Entity> Identifier getTexture(T entity, Context<T, ?> context) {
|
||||
return textures.computeIfAbsent(Registry.ITEM.getId(GlassesItem.getForEntity((LivingEntity)entity).getItem()), id -> new Identifier(id.getNamespace(), "textures/models/armor/" + id.getPath() + ".png"));
|
||||
return textures.computeIfAbsent(Registries.ITEM.getId(GlassesItem.getForEntity((LivingEntity)entity).getItem()), id -> new Identifier(id.getNamespace(), "textures/models/armor/" + id.getPath() + ".png"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -69,7 +69,7 @@ public class Main extends MineLPDelegate implements ClientModInitializer {
|
|||
|
||||
@Override
|
||||
public Race getPlayerPonyRace(PlayerEntity player) {
|
||||
switch (MineLittlePony.getInstance().getManager().getPony(player).getRace()) {
|
||||
switch (MineLittlePony.getInstance().getManager().getPony(player).race()) {
|
||||
case ALICORN:
|
||||
return Race.ALICORN;
|
||||
case CHANGELING:
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.minelittlepony.unicopia.client.particle;
|
||||
|
||||
import org.joml.Vector3f;
|
||||
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.particle.ParticleTextureSheet;
|
||||
import net.minecraft.client.render.BufferBuilder;
|
||||
|
@ -7,7 +9,6 @@ import net.minecraft.client.render.Tessellator;
|
|||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.render.VertexFormat;
|
||||
import net.minecraft.client.render.VertexFormats;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
|
||||
public abstract class AbstractGeometryBasedParticle extends Particle {
|
||||
|
@ -23,23 +24,23 @@ public abstract class AbstractGeometryBasedParticle extends Particle {
|
|||
return ParticleTextureSheet.CUSTOM;
|
||||
}
|
||||
|
||||
protected final void renderQuad(Tessellator te, BufferBuilder buffer, Vec3f[] corners, float alpha, float tickDelta) {
|
||||
protected final void renderQuad(Tessellator te, BufferBuilder buffer, Vector3f[] corners, float alpha, float tickDelta) {
|
||||
int light = getBrightness(tickDelta);
|
||||
|
||||
buffer.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR_LIGHT);
|
||||
buffer.vertex(corners[0].getX(), corners[0].getY(), corners[0].getZ()).texture(0, 0).color(red, green, blue, alpha).light(light).next();
|
||||
buffer.vertex(corners[1].getX(), corners[1].getY(), corners[1].getZ()).texture(1, 0).color(red, green, blue, alpha).light(light).next();
|
||||
buffer.vertex(corners[2].getX(), corners[2].getY(), corners[2].getZ()).texture(1, 1).color(red, green, blue, alpha).light(light).next();
|
||||
buffer.vertex(corners[3].getX(), corners[3].getY(), corners[3].getZ()).texture(0, 1).color(red, green, blue, alpha).light(light).next();
|
||||
buffer.vertex(corners[0].x, corners[0].y, corners[0].z).texture(0, 0).color(red, green, blue, alpha).light(light).next();
|
||||
buffer.vertex(corners[1].x, corners[1].y, corners[1].z).texture(1, 0).color(red, green, blue, alpha).light(light).next();
|
||||
buffer.vertex(corners[2].x, corners[2].y, corners[2].z).texture(1, 1).color(red, green, blue, alpha).light(light).next();
|
||||
buffer.vertex(corners[3].x, corners[3].y, corners[3].z).texture(0, 1).color(red, green, blue, alpha).light(light).next();
|
||||
|
||||
te.draw();
|
||||
}
|
||||
|
||||
protected final void renderQuad(VertexConsumer buffer, Vec3f[] corners, float alpha, float tickDelta) {
|
||||
protected final void renderQuad(VertexConsumer buffer, Vector3f[] corners, float alpha, float tickDelta) {
|
||||
int light = getBrightness(tickDelta);
|
||||
|
||||
for (Vec3f corner : corners) {
|
||||
buffer.vertex(corner.getX(), corner.getY(), corner.getZ()).color(red, green, blue, alpha).light(light).next();
|
||||
for (Vector3f corner : corners) {
|
||||
buffer.vertex(corner.x, corner.y, corner.z).color(red, green, blue, alpha).light(light).next();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package com.minelittlepony.unicopia.client.particle;
|
||||
|
||||
import org.joml.Vector3f;
|
||||
|
||||
import net.minecraft.client.particle.SpriteProvider;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.particle.ParticleEffect;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
|
||||
public class ChangelingMagicParticle extends MagicParticle {
|
||||
|
||||
|
@ -14,8 +15,8 @@ public class ChangelingMagicParticle extends MagicParticle {
|
|||
this.provider = provider;
|
||||
}
|
||||
|
||||
static Vec3f nextColor(float intensity) {
|
||||
return new Vec3f(intensity * 0.5F, intensity, intensity * 0.4F);
|
||||
static Vector3f nextColor(float intensity) {
|
||||
return new Vector3f(intensity * 0.5F, intensity, intensity * 0.4F);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.minelittlepony.unicopia.client.particle;
|
||||
|
||||
import org.joml.Quaternionf;
|
||||
|
||||
import com.minelittlepony.unicopia.particle.SphereParticleEffect;
|
||||
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
|
@ -9,13 +11,14 @@ import net.minecraft.util.math.*;
|
|||
|
||||
public class DiskParticle extends SphereParticle {
|
||||
|
||||
private final Quaternion rotation = new Quaternion(0, 0, 0, 1);
|
||||
private final Quaternionf rotation = new Quaternionf(0, 0, 0, 1);
|
||||
|
||||
public DiskParticle(SphereParticleEffect effect, ClientWorld w, double x, double y, double z, double rX, double rY, double rZ) {
|
||||
super(effect, w, x, y, z, 0, 0, 0);
|
||||
|
||||
rotation.hamiltonProduct(Vec3f.POSITIVE_Y.getDegreesQuaternion((float)effect.getOffset().y));
|
||||
rotation.hamiltonProduct(Vec3f.POSITIVE_X.getDegreesQuaternion(90 - (float)effect.getOffset().x));
|
||||
// TODO: was hamiltonianProduct (check this!!!)
|
||||
rotation.mul(RotationAxis.POSITIVE_Y.rotationDegrees((float)effect.getOffset().y));
|
||||
rotation.mul(RotationAxis.POSITIVE_X.rotationDegrees(90 - (float)effect.getOffset().x));
|
||||
|
||||
effect.setOffset(new Vec3d(0, 0.25, 0));
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ package com.minelittlepony.unicopia.client.particle;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.joml.Vector3f;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
|
@ -16,11 +18,10 @@ import net.minecraft.sound.SoundCategory;
|
|||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
|
||||
public class LightningBoltParticle extends AbstractGeometryBasedParticle {
|
||||
|
||||
private final List<List<Vec3d>> branches = new ArrayList<>();
|
||||
private final List<List<Vector3f>> branches = new ArrayList<>();
|
||||
|
||||
public LightningBoltParticle(DefaultParticleType type, ClientWorld world, double x, double y, double z, double velocityX, double velocityY, double velocityZ) {
|
||||
super(world, x, y, z, velocityX, velocityY, velocityZ);
|
||||
|
@ -49,18 +50,18 @@ public class LightningBoltParticle extends AbstractGeometryBasedParticle {
|
|||
world.setLightningTicksLeft(2);
|
||||
}
|
||||
|
||||
private List<Vec3d> generateBranch() {
|
||||
Vec3d startPos = new Vec3d(0, 0, 0);
|
||||
private List<Vector3f> generateBranch() {
|
||||
Vector3f startPos = new Vector3f(0, 0, 0);
|
||||
|
||||
int intendedLength = 2 + world.random.nextInt(6);
|
||||
|
||||
List<Vec3d> nodes = new ArrayList<>();
|
||||
List<Vector3f> nodes = new ArrayList<>();
|
||||
|
||||
while (nodes.size() < intendedLength) {
|
||||
startPos = startPos.add(
|
||||
world.random.nextTriangular(0.1, 3),
|
||||
world.random.nextTriangular(0.1, 3),
|
||||
world.random.nextTriangular(0.1, 3)
|
||||
(float)world.random.nextTriangular(0.1F, 3),
|
||||
(float)world.random.nextTriangular(0.1F, 3),
|
||||
(float)world.random.nextTriangular(0.1F, 3)
|
||||
);
|
||||
|
||||
nodes.add(startPos);
|
||||
|
@ -82,11 +83,11 @@ public class LightningBoltParticle extends AbstractGeometryBasedParticle {
|
|||
float y = (float)(MathHelper.lerp(tickDelta, prevPosY, this.y) - cam.getY());
|
||||
float z = (float)(MathHelper.lerp(tickDelta, prevPosZ, this.z) - cam.getZ());
|
||||
|
||||
Vec3f origin = new Vec3f(x, y, z);
|
||||
Vector3f origin = new Vector3f(x, y, z);
|
||||
|
||||
for (List<Vec3d> branch : branches) {
|
||||
for (List<Vector3f> branch : branches) {
|
||||
for (int i = 0; i < branch.size(); i++) {
|
||||
renderBranch(buffer, i == 0 ? origin : new Vec3f(branch.get(i - 1).add(x, y, z)), new Vec3f(branch.get(i).add(x, y, z)));
|
||||
renderBranch(buffer, i == 0 ? origin : new Vector3f(branch.get(i - 1).add(x, y, z)), new Vector3f(branch.get(i).add(x, y, z)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,29 +96,29 @@ public class LightningBoltParticle extends AbstractGeometryBasedParticle {
|
|||
RenderSystem.enableCull();
|
||||
}
|
||||
|
||||
private void renderBranch(VertexConsumer buffer, Vec3f from, Vec3f to) {
|
||||
private void renderBranch(VertexConsumer buffer, Vector3f from, Vector3f to) {
|
||||
float thickness = world.random.nextFloat() / 30 + 0.01F;
|
||||
|
||||
renderQuad(buffer, new Vec3f[]{
|
||||
new Vec3f(from.getX() - thickness, from.getY(), from.getZ()),
|
||||
new Vec3f(to.getX() - thickness, to.getY(), to.getZ()),
|
||||
new Vec3f(to.getX() + thickness, to.getY(), to.getZ()),
|
||||
new Vec3f(from.getX() + thickness, from.getY(), from.getZ()),
|
||||
renderQuad(buffer, new Vector3f[]{
|
||||
new Vector3f(from.x - thickness, from.y, from.z),
|
||||
new Vector3f(to.x - thickness, to.y, to.z),
|
||||
new Vector3f(to.x + thickness, to.y, to.z),
|
||||
new Vector3f(from.x + thickness, from.y, from.z),
|
||||
|
||||
new Vec3f(from.getX() - thickness, from.getY() - thickness * 2, from.getZ()),
|
||||
new Vec3f(to.getX() - thickness, to.getY() - thickness * 2, to.getZ()),
|
||||
new Vec3f(to.getX() + thickness, to.getY() - thickness * 2, to.getZ()),
|
||||
new Vec3f(from.getX() + thickness, from.getY() - thickness * 2, from.getZ()),
|
||||
new Vector3f(from.x - thickness, from.y - thickness * 2, from.z),
|
||||
new Vector3f(to.x - thickness, to.y - thickness * 2, to.z),
|
||||
new Vector3f(to.x + thickness, to.y - thickness * 2, to.z),
|
||||
new Vector3f(from.x + thickness, from.y - thickness * 2, from.z),
|
||||
|
||||
new Vec3f(from.getX(), from.getY() - thickness, from.getZ() + thickness),
|
||||
new Vec3f(to.getX(), to.getY() - thickness, to.getZ() + thickness),
|
||||
new Vec3f(to.getX(), to.getY() + thickness, to.getZ() + thickness),
|
||||
new Vec3f(from.getX(), from.getY() + thickness, from.getZ() + thickness),
|
||||
new Vector3f(from.x, from.y - thickness, from.z + thickness),
|
||||
new Vector3f(to.x, to.y - thickness, to.z + thickness),
|
||||
new Vector3f(to.x, to.y + thickness, to.z + thickness),
|
||||
new Vector3f(from.x, from.y + thickness, from.z + thickness),
|
||||
|
||||
new Vec3f(from.getX() - thickness * 2, from.getY() - thickness, from.getZ() + thickness),
|
||||
new Vec3f(to.getX() - thickness * 2, to.getY() - thickness, to.getZ() + thickness),
|
||||
new Vec3f(to.getX() - thickness * 2, to.getY() + thickness, to.getZ() + thickness),
|
||||
new Vec3f(from.getX() - thickness * 2, from.getY() + thickness, from.getZ() + thickness)
|
||||
new Vector3f(from.x - thickness * 2, from.y - thickness, from.z + thickness),
|
||||
new Vector3f(to.x - thickness * 2, to.y - thickness, to.z + thickness),
|
||||
new Vector3f(to.x - thickness * 2, to.y + thickness, to.z + thickness),
|
||||
new Vector3f(from.x - thickness * 2, from.y + thickness, from.z + thickness)
|
||||
}, 0.3F, 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.minelittlepony.unicopia.client.particle;
|
||||
|
||||
import org.joml.Vector3f;
|
||||
|
||||
import com.minelittlepony.unicopia.particle.MagicParticleEffect;
|
||||
|
||||
import net.minecraft.client.particle.ParticleTextureSheet;
|
||||
|
@ -7,14 +9,13 @@ import net.minecraft.client.particle.SpriteBillboardParticle;
|
|||
import net.minecraft.client.particle.SpriteProvider;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.particle.ParticleEffect;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
|
||||
public class MagicParticle extends SpriteBillboardParticle {
|
||||
private final double startX;
|
||||
private final double startY;
|
||||
private final double startZ;
|
||||
|
||||
MagicParticle(ParticleEffect effect, SpriteProvider provider, ClientWorld w, double x, double y, double z, double vX, double vY, double vZ, Vec3f color, float alpha) {
|
||||
MagicParticle(ParticleEffect effect, SpriteProvider provider, ClientWorld w, double x, double y, double z, double vX, double vY, double vZ, Vector3f color, float alpha) {
|
||||
super(w, x, y, z);
|
||||
setSprite(provider);
|
||||
|
||||
|
@ -27,9 +28,9 @@ public class MagicParticle extends SpriteBillboardParticle {
|
|||
scale = random.nextFloat() * 0.12F;
|
||||
maxAge = (int)(Math.random() * 10) + 20;
|
||||
|
||||
red = color.getX();
|
||||
green = color.getY();
|
||||
blue = color.getZ();
|
||||
red = color.x;
|
||||
green = color.y;
|
||||
blue = color.z;
|
||||
this.alpha = alpha;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,27 +1,30 @@
|
|||
package com.minelittlepony.unicopia.client.particle;
|
||||
|
||||
import org.joml.Quaternionf;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
import com.minelittlepony.unicopia.particle.OrientedBillboardParticleEffect;
|
||||
|
||||
import net.minecraft.client.render.BufferBuilder;
|
||||
import net.minecraft.client.render.Camera;
|
||||
import net.minecraft.client.render.Tessellator;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.util.math.Quaternion;
|
||||
import net.minecraft.util.math.*;
|
||||
|
||||
public abstract class OrientedBillboardParticle extends AbstractBillboardParticle {
|
||||
|
||||
protected boolean fixed;
|
||||
protected Quaternion rotation = new Quaternion(0, 0, 0, 1);
|
||||
protected Quaternionf rotation = new Quaternionf(0, 0, 0, 1);
|
||||
|
||||
public OrientedBillboardParticle(OrientedBillboardParticleEffect effect, ClientWorld world, double x, double y, double z, double velocityX, double velocityY, double velocityZ) {
|
||||
super(world, x, y, z, velocityX, velocityY, velocityZ);
|
||||
|
||||
fixed = effect.isAngleFixed();
|
||||
if (fixed) {
|
||||
rotation.hamiltonProduct(Vec3f.POSITIVE_Y.getDegreesQuaternion(effect.getPitch()));
|
||||
rotation.hamiltonProduct(Vec3f.POSITIVE_X.getDegreesQuaternion(180 - effect.getYaw()));
|
||||
// Was hamiltonianProduct (CHECK THIS!!)
|
||||
rotation.mul(RotationAxis.POSITIVE_Y.rotationDegrees(effect.getPitch()));
|
||||
rotation.mul(RotationAxis.POSITIVE_X.rotationDegrees(180 - effect.getYaw()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,18 +38,18 @@ public abstract class OrientedBillboardParticle extends AbstractBillboardParticl
|
|||
|
||||
@Override
|
||||
protected void renderQuads(Tessellator te, BufferBuilder buffer, float x, float y, float z, float tickDelta) {
|
||||
Vec3f[] corners = new Vec3f[]{
|
||||
new Vec3f(-1, -1, 0),
|
||||
new Vec3f(-1, 1, 0),
|
||||
new Vec3f( 1, 1, 0),
|
||||
new Vec3f( 1, -1, 0)
|
||||
Vector3f[] corners = new Vector3f[]{
|
||||
new Vector3f(-1, -1, 0),
|
||||
new Vector3f(-1, 1, 0),
|
||||
new Vector3f( 1, 1, 0),
|
||||
new Vector3f( 1, -1, 0)
|
||||
};
|
||||
float scale = getScale(tickDelta);
|
||||
|
||||
for(int k = 0; k < 4; ++k) {
|
||||
Vec3f corner = corners[k];
|
||||
Vector3f corner = corners[k];
|
||||
corner.rotate(rotation);
|
||||
corner.scale(scale);
|
||||
corner.mul(scale);
|
||||
corner.add(x, y, z);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.joml.Vector3f;
|
||||
|
||||
import com.minelittlepony.unicopia.Unicopia;
|
||||
import com.minelittlepony.unicopia.ability.magic.Caster;
|
||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||
|
@ -13,7 +15,6 @@ import com.minelittlepony.unicopia.particle.ParticleHandle.Link;
|
|||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.BufferBuilder;
|
||||
import net.minecraft.client.render.Tessellator;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.particle.DefaultParticleType;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
@ -62,12 +63,12 @@ public class RainbowTrailParticle extends AbstractBillboardParticle implements A
|
|||
float alpha = 1 - (float)age / maxAge;
|
||||
|
||||
for (int i = 0; i < segments.size() - 1; i++) {
|
||||
Vec3f[] corners = segments.get(i).getPlane(segments.get(i + 1));
|
||||
Vector3f[] corners = segments.get(i).getPlane(segments.get(i + 1));
|
||||
float scale = getScale(tickDelta);
|
||||
|
||||
for (int k = 0; k < 4; ++k) {
|
||||
Vec3f corner = corners[k];
|
||||
corner.scale(scale);
|
||||
Vector3f corner = corners[k];
|
||||
corner.mul(scale);
|
||||
corner.add(x, y, z);
|
||||
}
|
||||
|
||||
|
@ -109,14 +110,14 @@ public class RainbowTrailParticle extends AbstractBillboardParticle implements A
|
|||
|
||||
private final class Segment {
|
||||
Vec3d position;
|
||||
Vec3f offset;
|
||||
Vector3f offset;
|
||||
|
||||
int age;
|
||||
int maxAge;
|
||||
|
||||
Segment(Vec3d position) {
|
||||
this.position = position;
|
||||
this.offset = new Vec3f((float)(position.getX() - x), (float)(position.getY() - y), (float)(position.getZ() - z));
|
||||
this.offset = new Vector3f((float)(position.getX() - x), (float)(position.getY() - y), (float)(position.getZ() - z));
|
||||
this.maxAge = 90;
|
||||
}
|
||||
|
||||
|
@ -128,24 +129,23 @@ public class RainbowTrailParticle extends AbstractBillboardParticle implements A
|
|||
return segments.indexOf(this) < segments.size() - 1 && age++ >= maxAge;
|
||||
}
|
||||
|
||||
Vec3f[] getPlane(Segment to) {
|
||||
float fromX = offset.getX();
|
||||
float toX = to.offset.getX();
|
||||
Vector3f[] getPlane(Segment to) {
|
||||
float fromX = offset.x;
|
||||
float toX = to.offset.x;
|
||||
|
||||
float fromZ = offset.getZ();
|
||||
float toZ = to.offset.getZ();
|
||||
float fromZ = offset.z;
|
||||
float toZ = to.offset.z;
|
||||
float fromTopY = offset.y + 1;
|
||||
float fromBottomY = offset.y;
|
||||
|
||||
float fromTopY = offset.getY() + 1;
|
||||
float fromBottomY = offset.getY();
|
||||
float toTopY = to.offset.y + 1;
|
||||
float toBottomY = to.offset.y;
|
||||
|
||||
float toTopY = to.offset.getY() + 1;
|
||||
float toBottomY = to.offset.getY();
|
||||
|
||||
return new Vec3f[]{
|
||||
new Vec3f(fromX, fromBottomY, fromZ), // bottom left
|
||||
new Vec3f(fromX, fromTopY, fromZ), // top left
|
||||
new Vec3f(toX, toTopY, toZ), // top right
|
||||
new Vec3f(toX, toBottomY, toZ) // bottom right
|
||||
return new Vector3f[]{
|
||||
new Vector3f(fromX, fromBottomY, fromZ), // bottom left
|
||||
new Vector3f(fromX, fromTopY, fromZ), // top left
|
||||
new Vector3f(toX, toTopY, toZ), // top right
|
||||
new Vector3f(toX, toBottomY, toZ) // bottom right
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,9 @@ package com.minelittlepony.unicopia.client.particle;
|
|||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.joml.Quaternionf;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
import com.minelittlepony.common.util.Color;
|
||||
import com.minelittlepony.unicopia.Unicopia;
|
||||
import com.minelittlepony.unicopia.ability.magic.Caster;
|
||||
|
@ -12,12 +15,9 @@ import com.mojang.blaze3d.systems.RenderSystem;
|
|||
|
||||
import net.minecraft.client.render.BufferBuilder;
|
||||
import net.minecraft.client.render.Tessellator;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Quaternion;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.*;
|
||||
|
||||
public class RunesParticle extends OrientedBillboardParticle implements Attachment {
|
||||
|
||||
|
@ -89,11 +89,13 @@ public class RunesParticle extends OrientedBillboardParticle implements Attachme
|
|||
targetSize = value.floatValue();
|
||||
}
|
||||
if (key == ATTR_PITCH) {
|
||||
rotation = new Quaternion(0, 0, 0, 1);
|
||||
rotation.hamiltonProduct(Vec3f.POSITIVE_Y.getDegreesQuaternion(value.floatValue()));
|
||||
rotation = new Quaternionf(0, 0, 0, 1);
|
||||
// TODO: Was hamiltonianProduct (CHECK!!!)
|
||||
rotation.mul(RotationAxis.POSITIVE_Y.rotationDegrees(value.floatValue()));
|
||||
}
|
||||
if (key == ATTR_YAW) {
|
||||
rotation.hamiltonProduct(Vec3f.POSITIVE_X.getDegreesQuaternion(180 - value.floatValue()));
|
||||
// TODO: Was hamiltonianProduct (CHECK!!!)
|
||||
rotation.mul(RotationAxis.POSITIVE_X.rotationDegrees(180 - value.floatValue()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,27 +131,27 @@ public class RunesParticle extends OrientedBillboardParticle implements Attachme
|
|||
RenderSystem.setShaderTexture(0, TEXTURES[i]);
|
||||
RenderSystem.setShaderColor(red, green, blue, alpha / ((float)(dim * 3) + 1));
|
||||
|
||||
Vec3f[] corners = new Vec3f[]{
|
||||
new Vec3f(-1, -1, 0),
|
||||
new Vec3f(-1, 1, 0),
|
||||
new Vec3f( 1, 1, 0),
|
||||
new Vec3f( 1, -1, 0)
|
||||
Vector3f[] corners = new Vector3f[]{
|
||||
new Vector3f(-1, -1, 0),
|
||||
new Vector3f(-1, 1, 0),
|
||||
new Vector3f( 1, 1, 0),
|
||||
new Vector3f( 1, -1, 0)
|
||||
};
|
||||
float scale = getScale(tickDelta);
|
||||
|
||||
float ringSpeed = (i % 2 == 0 ? i : -1) * i;
|
||||
|
||||
Quaternion ringAngle = Vec3f.POSITIVE_Z.getDegreesQuaternion(angle * ringSpeed);
|
||||
Quaternion ringFlip = Vec3f.POSITIVE_Y.getDegreesQuaternion(angle * ringSpeed * dim);
|
||||
Quaternion ringRoll = Vec3f.POSITIVE_X.getDegreesQuaternion(angle * ringSpeed * dim);
|
||||
Quaternionf ringAngle = RotationAxis.POSITIVE_Z.rotationDegrees(angle * ringSpeed);
|
||||
Quaternionf ringFlip = RotationAxis.POSITIVE_Y.rotationDegrees(angle * ringSpeed * dim);
|
||||
Quaternionf ringRoll = RotationAxis.POSITIVE_X.rotationDegrees(angle * ringSpeed * dim);
|
||||
|
||||
for(int k = 0; k < 4; ++k) {
|
||||
Vec3f corner = corners[k];
|
||||
Vector3f corner = corners[k];
|
||||
corner.rotate(ringAngle);
|
||||
corner.rotate(ringFlip);
|
||||
corner.rotate(ringRoll);
|
||||
corner.rotate(rotation);
|
||||
corner.scale(scale);
|
||||
corner.mul(scale);
|
||||
corner.add(x, y + 0.001F, z);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,13 +4,14 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.joml.Matrix4f;
|
||||
import org.joml.Vector4f;
|
||||
|
||||
import com.minelittlepony.unicopia.client.gui.DrawableUtil;
|
||||
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Matrix4f;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.Vector4f;
|
||||
|
||||
public class SphereModel {
|
||||
public static final SphereModel SPHERE = new SphereModel(40, 40, DrawableUtil.TAU);
|
||||
|
@ -35,9 +36,9 @@ public class SphereModel {
|
|||
|
||||
Matrix4f model = matrices.peek().getPositionMatrix();
|
||||
for (Vector4f vertex : vertices) {
|
||||
drawVert.set(vertex.getX() * radius, vertex.getY() * radius, vertex.getZ() * radius, vertex.getW());
|
||||
drawVert.transform(model);
|
||||
vertexWriter.vertex(drawVert.getX(), drawVert.getY(), drawVert.getZ(), r, g, b, a, 0, 0, overlay, light, 0, 0, 0);
|
||||
drawVert.set(vertex.x * radius, vertex.y * radius, vertex.z * radius, vertex.w);
|
||||
drawVert.mul(model);
|
||||
vertexWriter.vertex(drawVert.x, drawVert.y, drawVert.z, r, g, b, a, 0, 0, overlay, light, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,9 +49,9 @@ public class SphereParticle extends Particle implements Attachment {
|
|||
super(w, x, y, z);
|
||||
this.parameters = parameters;
|
||||
this.radius = parameters.getRadius();
|
||||
this.red = parameters.getColor().getX() / 255F;
|
||||
this.green = parameters.getColor().getY() / 255F;
|
||||
this.blue = parameters.getColor().getZ() / 255F;
|
||||
this.red = parameters.getColor().x / 255F;
|
||||
this.green = parameters.getColor().y / 255F;
|
||||
this.blue = parameters.getColor().z / 255F;
|
||||
this.alpha = parameters.getAlpha();
|
||||
|
||||
setMaxAge(10);
|
||||
|
@ -157,7 +157,7 @@ public class SphereParticle extends Particle implements Attachment {
|
|||
RenderSystem.enableCull();
|
||||
RenderSystem.depthMask(true);
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
RenderSystem.setShader(GameRenderer::getParticleShader);
|
||||
RenderSystem.setShader(GameRenderer::getParticleProgram);
|
||||
}
|
||||
|
||||
protected void renderModel(MatrixStack matrices, VertexConsumer buffer, float lerpedRad, float tickDelta, int light) {
|
||||
|
|
|
@ -24,7 +24,7 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
|
||||
public class AmuletFeatureRenderer<E extends LivingEntity> implements AccessoryFeatureRenderer.Feature<E> {
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class AmuletFeatureRenderer<E extends LivingEntity> implements AccessoryF
|
|||
ItemStack stack = AmuletItem.getForEntity(entity);
|
||||
|
||||
if (!stack.isEmpty()) {
|
||||
Identifier texture = textures.computeIfAbsent(Registry.ITEM.getId(stack.getItem()), id -> new Identifier(id.getNamespace(), "textures/models/armor/" + id.getPath() + ".png"));
|
||||
Identifier texture = textures.computeIfAbsent(Registries.ITEM.getId(stack.getItem()), id -> new Identifier(id.getNamespace(), "textures/models/armor/" + id.getPath() + ".png"));
|
||||
|
||||
VertexConsumer consumer = ItemRenderer.getArmorGlintConsumer(renderContext, RenderLayer.getArmorCutoutNoCull(texture), false, false);
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.screen.PlayerScreenHandler;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.util.math.RotationAxis;
|
||||
|
||||
public class FloatingArtefactEntityRenderer extends EntityRenderer<FloatingArtefactEntity> {
|
||||
|
||||
|
@ -38,14 +38,14 @@ public class FloatingArtefactEntityRenderer extends EntityRenderer<FloatingArtef
|
|||
|
||||
final float variance = 0.25F;
|
||||
final float verticalOffset = entity.getVerticalOffset(timeDelta);
|
||||
final float modelScaleY = model.getTransformation().getTransformation(ModelTransformation.Mode.GROUND).scale.getY();
|
||||
final float modelScaleY = model.getTransformation().getTransformation(ModelTransformation.Mode.GROUND).scale.y;
|
||||
|
||||
float scale = 1.6F;
|
||||
|
||||
transforms.push();
|
||||
transforms.scale(scale, scale, scale);
|
||||
transforms.translate(0, verticalOffset + variance * modelScaleY, 0);
|
||||
transforms.multiply(Vec3f.POSITIVE_Y.getRadialQuaternion(entity.getRotation(timeDelta)));
|
||||
transforms.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(entity.getRotation(timeDelta)));
|
||||
|
||||
itemRenderer.renderItem(stack, ModelTransformation.Mode.GROUND, false, transforms, renderContext, lightUv, OverlayTexture.DEFAULT_UV, model);
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
|
||||
public class GlassesFeatureRenderer<E extends LivingEntity> implements AccessoryFeatureRenderer.Feature<E> {
|
||||
|
||||
|
@ -39,7 +39,7 @@ public class GlassesFeatureRenderer<E extends LivingEntity> implements Accessory
|
|||
ItemStack stack = GlassesItem.getForEntity(entity);
|
||||
|
||||
if (!stack.isEmpty()) {
|
||||
Identifier texture = textures.computeIfAbsent(Registry.ITEM.getId(stack.getItem()), id -> new Identifier(id.getNamespace(), "textures/models/armor/" + id.getPath() + ".png"));
|
||||
Identifier texture = textures.computeIfAbsent(Registries.ITEM.getId(stack.getItem()), id -> new Identifier(id.getNamespace(), "textures/models/armor/" + id.getPath() + ".png"));
|
||||
|
||||
VertexConsumer consumer = ItemRenderer.getArmorGlintConsumer(renderContext, RenderLayer.getArmorCutoutNoCull(texture), false, false);
|
||||
|
||||
|
|
|
@ -17,8 +17,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.sound.SoundEvent;
|
||||
import net.minecraft.util.Arm;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.util.math.*;
|
||||
|
||||
public class PlayerPoser {
|
||||
public static final PlayerPoser INSTANCE = new PlayerPoser();
|
||||
|
@ -200,7 +199,7 @@ public class PlayerPoser {
|
|||
|
||||
private void rearUp(MatrixStack matrices, BipedEntityModel<?> model, float progress) {
|
||||
matrices.translate(0, 0, 0.5);
|
||||
matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(-45 * progress));
|
||||
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(-45 * progress));
|
||||
matrices.translate(0, 0, -0.5);
|
||||
|
||||
float roll = progress / 2F;
|
||||
|
|
|
@ -6,8 +6,8 @@ import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry;
|
|||
import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry.DynamicItemRenderer;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.item.ClampedModelPredicateProvider;
|
||||
import net.minecraft.client.item.ModelPredicateProviderRegistry;
|
||||
import net.minecraft.client.item.UnclampedModelPredicateProvider;
|
||||
import net.minecraft.client.model.*;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.render.entity.model.TridentEntityModel;
|
||||
|
@ -20,9 +20,9 @@ import net.minecraft.client.world.ClientWorld;
|
|||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
|
||||
public class PolearmRenderer implements DynamicItemRenderer, UnclampedModelPredicateProvider {
|
||||
public class PolearmRenderer implements DynamicItemRenderer, ClampedModelPredicateProvider {
|
||||
|
||||
private static final PolearmRenderer INSTANCE = new PolearmRenderer();
|
||||
private static final Identifier THROWING = new Identifier("throwing");
|
||||
|
@ -36,8 +36,8 @@ public class PolearmRenderer implements DynamicItemRenderer, UnclampedModelPredi
|
|||
}
|
||||
|
||||
static ModelIdentifier getModelId(ItemConvertible item) {
|
||||
Identifier id = Registry.ITEM.getId(item.asItem());
|
||||
return new ModelIdentifier(id.toString() + "_in_inventory#inventory");
|
||||
Identifier id = Registries.ITEM.getId(item.asItem());
|
||||
return new ModelIdentifier(new Identifier(id.getNamespace(), id.getPath() + "_in_inventory"), "inventory");
|
||||
}
|
||||
|
||||
public static TexturedModelData getTexturedModelData() {
|
||||
|
@ -68,7 +68,7 @@ public class PolearmRenderer implements DynamicItemRenderer, UnclampedModelPredi
|
|||
} else {
|
||||
matrices.push();
|
||||
matrices.scale(1, -1, -1);
|
||||
Identifier id = Registry.ITEM.getId(stack.getItem());
|
||||
Identifier id = Registries.ITEM.getId(stack.getItem());
|
||||
Identifier texture = new Identifier(id.getNamespace(), "textures/entity/polearm/" + id.getPath() + ".png");
|
||||
model.render(matrices, MineLPDelegate.getInstance().getItemBuffer(vertexConsumers, texture).orElseGet(() -> {
|
||||
return ItemRenderer.getDirectItemGlintConsumer(vertexConsumers, model.getLayer(texture), false, stack.hasGlint());
|
||||
|
|
|
@ -17,7 +17,7 @@ public final class RenderLayers extends RenderLayer {
|
|||
|
||||
private static final RenderLayer MAGIC_NO_COLOR = of("magic_no_color", VertexFormats.POSITION_COLOR_TEXTURE_OVERLAY_LIGHT_NORMAL,
|
||||
VertexFormat.DrawMode.QUADS, 256, true, true, MultiPhaseParameters.builder()
|
||||
.shader(COLOR_SHADER)
|
||||
.program(COLOR_PROGRAM)
|
||||
.transparency(TRANSLUCENT_TRANSPARENCY)
|
||||
.target(TRANSLUCENT_TARGET)
|
||||
.build(false));
|
||||
|
@ -27,7 +27,7 @@ public final class RenderLayers extends RenderLayer {
|
|||
VertexFormats.POSITION_COLOR_TEXTURE_OVERLAY_LIGHT_NORMAL,
|
||||
VertexFormat.DrawMode.QUADS, 256, true, true,
|
||||
MultiPhaseParameters.builder()
|
||||
.shader(COLOR_SHADER)
|
||||
.program(COLOR_PROGRAM)
|
||||
.transparency(TRANSLUCENT_TRANSPARENCY)
|
||||
// .target(TRANSLUCENT_TARGET)
|
||||
.texturing(solid(Color.r(color), Color.g(color), Color.b(color), 0.6F))
|
||||
|
|
|
@ -25,15 +25,12 @@ import net.minecraft.client.render.entity.EntityRenderer;
|
|||
import net.minecraft.client.render.entity.LivingEntityRenderer;
|
||||
import net.minecraft.client.render.entity.model.BipedEntityModel;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.entity.*;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.vehicle.BoatEntity;
|
||||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.*;
|
||||
|
||||
public class WorldRenderDelegate {
|
||||
public static final WorldRenderDelegate INSTANCE = new WorldRenderDelegate();
|
||||
|
@ -119,8 +116,8 @@ public class WorldRenderDelegate {
|
|||
|
||||
matrices.translate(x, y + owner.getHeight() / 2, z);
|
||||
|
||||
matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(roll));
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(roll));
|
||||
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(roll));
|
||||
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(roll));
|
||||
|
||||
if (pony instanceof Pony) {
|
||||
roll = ((Pony)pony).getCamera().calculateRoll();
|
||||
|
@ -128,9 +125,9 @@ public class WorldRenderDelegate {
|
|||
roll -= 180;
|
||||
}
|
||||
|
||||
matrices.multiply(Vec3f.NEGATIVE_Y.getDegreesQuaternion(yaw));
|
||||
matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(roll));
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(yaw));
|
||||
matrices.multiply(RotationAxis.NEGATIVE_Y.rotationDegrees(yaw));
|
||||
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(roll));
|
||||
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(yaw));
|
||||
}
|
||||
|
||||
matrices.translate(-x, -y - owner.getHeight() / 2, -z);
|
||||
|
@ -205,7 +202,7 @@ public class WorldRenderDelegate {
|
|||
matrices.translate(x, y, z);
|
||||
|
||||
matrices.multiply(direction.getRotationQuaternion());
|
||||
matrices.multiply(Vec3f.NEGATIVE_X.getDegreesQuaternion(90));
|
||||
matrices.multiply(RotationAxis.NEGATIVE_X.rotationDegrees(90));
|
||||
|
||||
matrices.translate(-0.5, 0, -0.5);
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package com.minelittlepony.unicopia.client.render.entity;
|
||||
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
|
||||
import com.minelittlepony.unicopia.Unicopia;
|
||||
import com.minelittlepony.unicopia.entity.SpellbookEntity;
|
||||
|
||||
|
@ -10,6 +7,7 @@ import net.minecraft.client.render.entity.EntityRendererFactory;
|
|||
import net.minecraft.client.render.entity.LivingEntityRenderer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.*;
|
||||
|
||||
public class SpellbookEntityRenderer extends LivingEntityRenderer<SpellbookEntity, SpellbookModel> {
|
||||
private static final Identifier TEXTURE = Unicopia.id("textures/entity/spellbook/normal.png");
|
||||
|
@ -38,11 +36,11 @@ public class SpellbookEntityRenderer extends LivingEntityRenderer<SpellbookEntit
|
|||
float floatPosition = MathHelper.sin((entity.age + partialTicks + entity.getId()) / 20) * 0.04F;
|
||||
|
||||
matrices.translate(0, floatPosition, 0);
|
||||
matrices.multiply(Vec3f.NEGATIVE_Z.getDegreesQuaternion(60));
|
||||
matrices.multiply(RotationAxis.NEGATIVE_Z.rotationDegrees(60));
|
||||
} else {
|
||||
matrices.translate(-1.5F, 0.1F, 0.2F);
|
||||
matrices.multiply(Vec3f.NEGATIVE_Z.getDegreesQuaternion(90));
|
||||
matrices.multiply(Vec3f.NEGATIVE_Y.getDegreesQuaternion(90));
|
||||
matrices.multiply(RotationAxis.NEGATIVE_Z.rotationDegrees(90));
|
||||
matrices.multiply(RotationAxis.NEGATIVE_Y.rotationDegrees(90));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -94,10 +94,10 @@ public class ViewportShader implements SynchronousResourceReloader, Identifiable
|
|||
}
|
||||
}
|
||||
|
||||
static class LoadedShader extends ShaderEffect {
|
||||
static class LoadedShader extends PostEffectProcessor {
|
||||
private final Object2FloatMap<String> uniformValues = new Object2FloatOpenHashMap<>();
|
||||
|
||||
private Multimap<String, JsonEffectGlShader> programs;
|
||||
private Multimap<String, JsonEffectShaderProgram> programs;
|
||||
|
||||
private final Identifier id;
|
||||
|
||||
|
@ -111,8 +111,8 @@ public class ViewportShader implements SynchronousResourceReloader, Identifiable
|
|||
}
|
||||
|
||||
@Override
|
||||
public PostProcessShader addPass(String programName, Framebuffer source, Framebuffer dest) throws IOException {
|
||||
PostProcessShader pass = super.addPass(programName, source, dest);
|
||||
public PostEffectPass addPass(String programName, Framebuffer source, Framebuffer dest) throws IOException {
|
||||
PostEffectPass pass = super.addPass(programName, source, dest);
|
||||
if (programs == null) {
|
||||
programs = LinkedListMultimap.create();
|
||||
}
|
||||
|
|
|
@ -98,6 +98,6 @@ public abstract class FadeOutSoundInstance extends MovingSoundInstance {
|
|||
if (muted) {
|
||||
return 0.001F;
|
||||
}
|
||||
return getLerpedVolume() * sound.getVolume().get(field_38800);
|
||||
return getLerpedVolume() * sound.getVolume().get(random);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public class Commands {
|
|||
if (Unicopia.getConfig().enableCheats.get()) {
|
||||
SpeciesCommand.register(dispatcher);
|
||||
GravityCommand.register(dispatcher);
|
||||
DisguiseCommand.register(dispatcher);
|
||||
DisguiseCommand.register(dispatcher, access);
|
||||
if (Debug.DEBUG_COMMANDS) {
|
||||
TraitCommand.register(dispatcher);
|
||||
ManaCommand.register(dispatcher);
|
||||
|
|
|
@ -15,47 +15,47 @@ import com.mojang.brigadier.context.CommandContext;
|
|||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
|
||||
|
||||
import net.minecraft.command.argument.EntityArgumentType;
|
||||
import net.minecraft.command.argument.EntitySummonArgumentType;
|
||||
import net.minecraft.command.argument.NbtCompoundArgumentType;
|
||||
import net.minecraft.command.CommandRegistryAccess;
|
||||
import net.minecraft.command.argument.*;
|
||||
import net.minecraft.command.suggestion.SuggestionProviders;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.registry.entry.RegistryEntry;
|
||||
import net.minecraft.server.command.CommandManager;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.world.GameRules;
|
||||
|
||||
public class DisguiseCommand {
|
||||
private static final SimpleCommandExceptionType FAILED_EXCEPTION = new SimpleCommandExceptionType(Text.translatable("commands.disguise.notfound"));
|
||||
|
||||
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
|
||||
public static void register(CommandDispatcher<ServerCommandSource> dispatcher, CommandRegistryAccess registries) {
|
||||
dispatcher.register(CommandManager
|
||||
.literal("disguise")
|
||||
.requires(s -> s.hasPermissionLevel(2))
|
||||
.executes(context -> reveal(context.getSource(), context.getSource().getPlayer()))
|
||||
.then(
|
||||
CommandManager.argument("target", EntityArgumentType.players())
|
||||
.then(buildEntityDisguise(context -> EntityArgumentType.getPlayer(context, "target")))
|
||||
.then(buildEntityDisguise(context -> EntityArgumentType.getPlayer(context, "target"), registries))
|
||||
.then(buildPlayerDisguise(context -> EntityArgumentType.getPlayer(context, "target")))
|
||||
)
|
||||
.then(buildEntityDisguise(context -> context.getSource().getPlayer()))
|
||||
.then(buildEntityDisguise(context -> context.getSource().getPlayer(), registries))
|
||||
.then(buildPlayerDisguise(context -> context.getSource().getPlayer()))
|
||||
);
|
||||
}
|
||||
|
||||
private static ArgumentBuilder<ServerCommandSource, ?> buildEntityDisguise(Arg<ServerPlayerEntity> targetOp) {
|
||||
return CommandManager.argument("entity", EntitySummonArgumentType.entitySummon())
|
||||
private static ArgumentBuilder<ServerCommandSource, ?> buildEntityDisguise(Arg<ServerPlayerEntity> targetOp, CommandRegistryAccess registries) {
|
||||
return CommandManager.argument("entity", RegistryEntryArgumentType.registryEntry(registries, RegistryKeys.ENTITY_TYPE))
|
||||
.suggests(SuggestionProviders.SUMMONABLE_ENTITIES)
|
||||
.executes(context -> disguise(
|
||||
context.getSource(),
|
||||
targetOp.apply(context),
|
||||
loadEntity(context.getSource(),
|
||||
EntitySummonArgumentType.getEntitySummon(context, "entity"),
|
||||
RegistryEntryArgumentType.getSummonableEntityType(context, "entity"),
|
||||
new NbtCompound())))
|
||||
.then(
|
||||
CommandManager.argument("nbt", NbtCompoundArgumentType.nbtCompound())
|
||||
|
@ -63,7 +63,7 @@ public class DisguiseCommand {
|
|||
context.getSource(),
|
||||
targetOp.apply(context),
|
||||
loadEntity(context.getSource(),
|
||||
EntitySummonArgumentType.getEntitySummon(context, "entity"),
|
||||
RegistryEntryArgumentType.getSummonableEntityType(context, "entity"),
|
||||
NbtCompoundArgumentType.getNbtCompound(context, "nbt"))))
|
||||
);
|
||||
}
|
||||
|
@ -99,9 +99,9 @@ public class DisguiseCommand {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static Entity loadEntity(ServerCommandSource source, Identifier id, NbtCompound nbt) {
|
||||
static Entity loadEntity(ServerCommandSource source, RegistryEntry.Reference<EntityType<?>> entityType, NbtCompound nbt) {
|
||||
nbt = nbt.copy();
|
||||
nbt.putString("id", id.toString());
|
||||
nbt.putString("id", entityType.registryKey().getValue().toString());
|
||||
return EntityType.loadEntityWithPassengers(nbt, source.getWorld(), Function.identity());
|
||||
}
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ public class SpellbookScreenHandler extends ScreenHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferSlot(PlayerEntity player, int index) {
|
||||
public ItemStack quickMove(PlayerEntity player, int index) {
|
||||
Slot sourceSlot = slots.get(index);
|
||||
|
||||
if (sourceSlot == null || !sourceSlot.hasStack()) {
|
||||
|
|
|
@ -5,13 +5,14 @@ import com.minelittlepony.unicopia.Unicopia;
|
|||
import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerType;
|
||||
import net.minecraft.screen.ScreenHandler;
|
||||
import net.minecraft.screen.ScreenHandlerType;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
|
||||
public interface UScreenHandlers {
|
||||
ScreenHandlerType<SpellbookScreenHandler> SPELL_BOOK = register("spell_book", new ExtendedScreenHandlerType<>(SpellbookScreenHandler::new));
|
||||
|
||||
static <T extends ScreenHandler> ScreenHandlerType<T> register(String name, ScreenHandlerType<T> type) {
|
||||
return Registry.register(Registry.SCREEN_HANDLER, Unicopia.id(name), type);
|
||||
return Registry.register(Registries.SCREEN_HANDLER, Unicopia.id(name), type);
|
||||
}
|
||||
|
||||
static void bootstrap() { }
|
||||
|
|
|
@ -26,7 +26,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.predicate.entity.EntityPredicates;
|
||||
import net.minecraft.sound.SoundEvent;
|
||||
import net.minecraft.tag.BlockTags;
|
||||
import net.minecraft.registry.tag.BlockTags;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
|
|
@ -19,6 +19,7 @@ import net.minecraft.entity.data.TrackedData;
|
|||
import net.minecraft.entity.data.TrackedDataHandlerRegistry;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.listener.ClientPlayPacketListener;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -146,7 +147,7 @@ public class CastSpellEntity extends LightEmittingEntity implements Caster<Livin
|
|||
}
|
||||
|
||||
@Override
|
||||
public Packet<?> createSpawnPacket() {
|
||||
public Packet<ClientPlayPacketListener> createSpawnPacket() {
|
||||
return Channel.SERVER_SPAWN_PROJECTILE.toPacket(new MsgSpawnProjectile(this));
|
||||
}
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ public class Creature extends Living<LivingEntity> implements WeaklyOwned<Living
|
|||
.isEmpty();
|
||||
});
|
||||
|
||||
targets.clear();
|
||||
targets.clear(g -> true);
|
||||
targets.add(2, new ActiveTargetGoal<>((MobEntity)entity, PlayerEntity.class, true, filter));
|
||||
targets.add(2, new ActiveTargetGoal<>((MobEntity)entity, HostileEntity.class, true, filter));
|
||||
targets.add(2, new ActiveTargetGoal<>((MobEntity)entity, SlimeEntity.class, true, filter));
|
||||
|
|
|
@ -20,7 +20,7 @@ import net.minecraft.nbt.NbtCompound;
|
|||
import net.minecraft.nbt.NbtList;
|
||||
import net.minecraft.nbt.NbtString;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
|
||||
public class Enchantments implements NbtSerialisable, Tickable {
|
||||
|
||||
|
@ -77,7 +77,7 @@ public class Enchantments implements NbtSerialisable, Tickable {
|
|||
public void toNBT(NbtCompound compound) {
|
||||
NbtList list = new NbtList();
|
||||
equippedEnchantments.forEach(enchant -> {
|
||||
Identifier id = Registry.ENCHANTMENT.getId(enchant);
|
||||
Identifier id = Registries.ENCHANTMENT.getId(enchant);
|
||||
if (id != null) {
|
||||
list.add(NbtString.of(id.toString()));
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ public class Enchantments implements NbtSerialisable, Tickable {
|
|||
equippedEnchantments.clear();
|
||||
if (compound.contains("enchants")) {
|
||||
compound.getList("enchants", 8).forEach(tag -> {
|
||||
Registry.ENCHANTMENT.getOrEmpty(new Identifier(tag.asString())).ifPresent(equippedEnchantments::add);
|
||||
Registries.ENCHANTMENT.getOrEmpty(new Identifier(tag.asString())).ifPresent(equippedEnchantments::add);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import net.minecraft.entity.mob.MobEntity;
|
|||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.particle.BlockStateParticleEffect;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.tag.BlockTags;
|
||||
import net.minecraft.registry.tag.BlockTags;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
|
|
@ -14,6 +14,7 @@ import net.minecraft.entity.data.TrackedDataHandlerRegistry;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.listener.ClientPlayPacketListener;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
@ -185,7 +186,7 @@ public class FloatingArtefactEntity extends Entity {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Packet<?> createSpawnPacket() {
|
||||
public Packet<ClientPlayPacketListener> createSpawnPacket() {
|
||||
return Channel.SERVER_SPAWN_PROJECTILE.toPacket(new MsgSpawnProjectile(this));
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import net.minecraft.item.ItemConvertible;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
|
||||
public class ItemTracker implements NbtSerialisable, Copyable<ItemTracker> {
|
||||
public static final long TICKS = 1;
|
||||
|
@ -92,7 +92,7 @@ public class ItemTracker implements NbtSerialisable, Copyable<ItemTracker> {
|
|||
@Override
|
||||
public void toNBT(NbtCompound compound) {
|
||||
items.forEach((charm, count) -> {
|
||||
compound.putLong(Registry.ITEM.getId(charm.asItem()).toString(), count);
|
||||
compound.putLong(Registries.ITEM.getId(charm.asItem()).toString(), count);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ public class ItemTracker implements NbtSerialisable, Copyable<ItemTracker> {
|
|||
items.clear();
|
||||
compound.getKeys().stream().map(Identifier::tryParse)
|
||||
.filter(Objects::nonNull)
|
||||
.map(id -> Map.entry(Registry.ITEM.get(id), compound.getLong(id.toString())))
|
||||
.map(id -> Map.entry(Registries.ITEM.get(id), compound.getLong(id.toString())))
|
||||
.filter(i -> i.getKey() instanceof Trackable && i.getValue() > 0)
|
||||
.forEach(item -> items.put((Trackable)item.getKey(), item.getValue()));
|
||||
}
|
||||
|
|
|
@ -175,7 +175,7 @@ public class PhysicsBodyProjectileEntity extends PersistentProjectileEntity impl
|
|||
|
||||
@Override
|
||||
protected SoundEvent getHitSound() {
|
||||
return isBouncy() ? SoundEvents.BLOCK_NOTE_BLOCK_BANJO : SoundEvents.BLOCK_STONE_HIT;
|
||||
return isBouncy() ? SoundEvents.BLOCK_NOTE_BLOCK_BANJO.value() : SoundEvents.BLOCK_STONE_HIT;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,9 +17,8 @@ import net.minecraft.entity.EntityType;
|
|||
import net.minecraft.entity.SpawnGroup;
|
||||
import net.minecraft.entity.decoration.painting.PaintingVariant;
|
||||
import net.minecraft.entity.mob.FlyingEntity;
|
||||
import net.minecraft.tag.BiomeTags;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.registry.*;
|
||||
import net.minecraft.registry.tag.BiomeTags;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
public interface UEntities {
|
||||
|
@ -55,7 +54,7 @@ public interface UEntities {
|
|||
|
||||
static <T extends Entity> EntityType<T> register(String name, FabricEntityTypeBuilder<T> builder) {
|
||||
EntityType<T> type = builder.build();
|
||||
return Registry.register(Registry.ENTITY_TYPE, Unicopia.id(name), type);
|
||||
return Registry.register(Registries.ENTITY_TYPE, Unicopia.id(name), type);
|
||||
}
|
||||
|
||||
static void bootstrap() {
|
||||
|
@ -87,7 +86,7 @@ public interface UEntities {
|
|||
|
||||
interface Paintings {
|
||||
private static void register(String id, int width, int height) {
|
||||
Registry.register(Registry.PAINTING_VARIANT, RegistryKey.of(Registry.PAINTING_VARIANT_KEY, Unicopia.id(id)), new PaintingVariant(16 * width, 16 * height));
|
||||
Registry.register(Registries.PAINTING_VARIANT, RegistryKey.of(RegistryKeys.PAINTING_VARIANT, Unicopia.id(id)), new PaintingVariant(16 * width, 16 * height));
|
||||
}
|
||||
|
||||
static void bootstrap() {
|
||||
|
|
|
@ -8,7 +8,8 @@ import com.minelittlepony.unicopia.Unicopia;
|
|||
|
||||
import net.minecraft.entity.attribute.ClampedEntityAttribute;
|
||||
import net.minecraft.entity.attribute.EntityAttribute;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
|
||||
public interface UEntityAttributes {
|
||||
List<EntityAttribute> REGISTRY = new ArrayList<>();
|
||||
|
@ -20,7 +21,7 @@ public interface UEntityAttributes {
|
|||
|
||||
private static EntityAttribute register(String name, EntityAttribute attribute) {
|
||||
REGISTRY.add(attribute);
|
||||
return Registry.register(Registry.ATTRIBUTE, Unicopia.id(name), attribute);
|
||||
return Registry.register(Registries.ATTRIBUTE, Unicopia.id(name), attribute);
|
||||
}
|
||||
|
||||
static void bootstrap() {}
|
||||
|
|
|
@ -13,8 +13,8 @@ import net.minecraft.entity.Entity;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.tag.ItemTags;
|
||||
import net.minecraft.tag.TagKey;
|
||||
import net.minecraft.registry.tag.ItemTags;
|
||||
import net.minecraft.registry.tag.TagKey;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
import net.minecraft.village.TradeOffer;
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package com.minelittlepony.unicopia.entity.behaviour;
|
||||
|
||||
import org.joml.Vector3f;
|
||||
|
||||
import com.minelittlepony.unicopia.ability.magic.Caster;
|
||||
|
||||
import net.minecraft.entity.passive.AxolotlEntity;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
|
||||
public class AxolotlBehaviour extends EntityBehaviour<AxolotlEntity> {
|
||||
private static final float toRad = 0.017453292F;
|
||||
|
@ -12,11 +13,11 @@ public class AxolotlBehaviour extends EntityBehaviour<AxolotlEntity> {
|
|||
if (entity.getModelAngles().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Vec3f current = entity.getModelAngles().get("body");
|
||||
entity.getModelAngles().put("body", new Vec3f(
|
||||
Vector3f current = entity.getModelAngles().get("body");
|
||||
entity.getModelAngles().put("body", new Vector3f(
|
||||
source.getEntity().isSubmergedInWater() ? source.getEntity().getPitch() * toRad : 0,
|
||||
0,
|
||||
current == null ? 0 : current.getZ()
|
||||
current == null ? 0 : current.z
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ public interface Disguise extends FlightType.Provider, PlayerDimensions.Provider
|
|||
}
|
||||
|
||||
public static abstract class PlayerAccess extends PlayerEntity {
|
||||
public PlayerAccess() { super(null, null, 0, null, null); }
|
||||
public PlayerAccess() { super(null, null, 0, null); }
|
||||
public static TrackedData<Byte> getModelBitFlag() {
|
||||
return PLAYER_MODEL_PARTS;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registry;
|
||||
|
||||
public class EntityBehaviour<T extends Entity> {
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import net.minecraft.entity.EntityDimensions;
|
|||
import net.minecraft.entity.FallingBlockEntity;
|
||||
import net.minecraft.entity.damage.DamageSource;
|
||||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.tag.BlockTags;
|
||||
import net.minecraft.registry.tag.BlockTags;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
|
|
@ -17,7 +17,8 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
|
||||
public class RaceChangeStatusEffect extends StatusEffect {
|
||||
public static final int STAGE_DURATION = 200;
|
||||
|
@ -33,7 +34,7 @@ public class RaceChangeStatusEffect extends StatusEffect {
|
|||
|
||||
public static StatusEffect register(int color, Race race) {
|
||||
Identifier id = Race.REGISTRY.getId(race);
|
||||
return Registry.register(Registry.STATUS_EFFECT,
|
||||
return Registry.register(Registries.STATUS_EFFECT,
|
||||
new Identifier(id.getNamespace(), "change_race_" + id.getPath().toLowerCase()),
|
||||
new RaceChangeStatusEffect(color, race)
|
||||
);
|
||||
|
|
|
@ -4,7 +4,8 @@ import com.minelittlepony.unicopia.Unicopia;
|
|||
|
||||
import net.minecraft.entity.effect.StatusEffect;
|
||||
import net.minecraft.entity.effect.StatusEffectCategory;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
|
||||
public interface UEffects {
|
||||
StatusEffect FOOD_POISONING = register("food_poisoning", new FoodPoisoningStatusEffect(3484199));
|
||||
|
@ -13,7 +14,7 @@ public interface UEffects {
|
|||
StatusEffect PARALYSIS = register("paralysis", new StatusEffect(StatusEffectCategory.HARMFUL, 0) {});
|
||||
|
||||
private static StatusEffect register(String name, StatusEffect effect) {
|
||||
return Registry.register(Registry.STATUS_EFFECT, Unicopia.id(name), effect);
|
||||
return Registry.register(Registries.STATUS_EFFECT, Unicopia.id(name), effect);
|
||||
}
|
||||
|
||||
static void bootstrap() {}
|
||||
|
|
|
@ -4,7 +4,8 @@ import com.minelittlepony.unicopia.Unicopia;
|
|||
|
||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
|
||||
public interface UPotions {
|
||||
Potion TRIBE_SWAP_EARTH_PONY = register("tribe_swap_earth", new Potion("unicopia.tribe_swap_earth", new StatusEffectInstance(RaceChangeStatusEffect.CHANGE_RACE_EARTH, RaceChangeStatusEffect.MAX_DURATION)));
|
||||
|
@ -14,7 +15,7 @@ public interface UPotions {
|
|||
Potion TRIBE_SWAP_CHANGELING = register("tribe_swap_changeling", new Potion("unicopia.tribe_swap_changeling", new StatusEffectInstance(RaceChangeStatusEffect.CHANGE_RACE_CHANGELING, RaceChangeStatusEffect.MAX_DURATION)));
|
||||
|
||||
static Potion register(String name, Potion potion) {
|
||||
return Registry.register(Registry.POTION, Unicopia.id(name), potion);
|
||||
return Registry.register(Registries.POTION, Unicopia.id(name), potion);
|
||||
}
|
||||
|
||||
static void bootstrap() {
|
||||
|
|
|
@ -44,7 +44,7 @@ public class PlayerCharmTracker implements NbtSerialisable {
|
|||
|
||||
public void equipSpell(Hand hand, CustomisedSpellType<?> spell) {
|
||||
handSpells[hand.ordinal()] = spell;
|
||||
pony.getMaster().playSound(SoundEvents.UI_BUTTON_CLICK, 0.25F, 1.75F);
|
||||
pony.getMaster().playSound(SoundEvents.UI_BUTTON_CLICK.value(), 0.25F, 1.75F);
|
||||
pony.setDirty();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.minelittlepony.unicopia.entity.player.dummy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
@ -16,8 +14,6 @@ import net.minecraft.client.network.PlayerListEntry;
|
|||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.packet.s2c.play.PlayerListS2CPacket;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.world.GameMode;
|
||||
|
||||
public class DummyClientPlayerEntity extends AbstractClientPlayerEntity implements Owned<PlayerEntity> {
|
||||
|
@ -27,7 +23,7 @@ public class DummyClientPlayerEntity extends AbstractClientPlayerEntity implemen
|
|||
private PlayerEntity owner;
|
||||
|
||||
public DummyClientPlayerEntity(ClientWorld world, GameProfile profile) {
|
||||
super(world, profile, null);
|
||||
super(world, profile);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -49,7 +45,7 @@ public class DummyClientPlayerEntity extends AbstractClientPlayerEntity implemen
|
|||
playerInfo = connection.getPlayerListEntry(getGameProfile().getId());
|
||||
|
||||
if (playerInfo == null) {
|
||||
playerInfo = new PlayerListEntry(new Packet().entry(), MinecraftClient.getInstance().getServicesSignatureVerifier(), false);
|
||||
playerInfo = new PlayerListEntry(getGameProfile(), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,18 +72,4 @@ public class DummyClientPlayerEntity extends AbstractClientPlayerEntity implemen
|
|||
public void setMaster(PlayerEntity owner) {
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
private final class Packet extends PlayerListS2CPacket {
|
||||
public Packet() {
|
||||
super(PlayerListS2CPacket.Action.ADD_PLAYER, List.of());
|
||||
}
|
||||
|
||||
PlayerListS2CPacket.Entry entry() {
|
||||
return new PlayerListS2CPacket.Entry(
|
||||
getGameProfile(),
|
||||
0,
|
||||
GameMode.DEFAULT,
|
||||
Text.literal(getGameProfile().getName()), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ public class DummyPlayerEntity extends PlayerEntity implements Owned<PlayerEntit
|
|||
private PlayerEntity owner;
|
||||
|
||||
public DummyPlayerEntity(World world, GameProfile profile) {
|
||||
super(world, BlockPos.ORIGIN, 0, profile, null);
|
||||
super(world, BlockPos.ORIGIN, 0, profile);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,7 +4,7 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
|
||||
public interface ChameleonItem {
|
||||
|
||||
|
@ -36,7 +36,7 @@ public interface ChameleonItem {
|
|||
|
||||
default Item getAppearance(ItemStack stack) {
|
||||
if (stack.hasNbt() && stack.getNbt().contains("appearance")) {
|
||||
return Registry.ITEM.get(new Identifier(stack.getNbt().getString("appearance")));
|
||||
return Registries.ITEM.get(new Identifier(stack.getNbt().getString("appearance")));
|
||||
}
|
||||
|
||||
return Items.AIR;
|
||||
|
@ -51,7 +51,7 @@ public interface ChameleonItem {
|
|||
result.setDamage(stack.getDamage());
|
||||
result.setCount(stack.getCount());
|
||||
}
|
||||
result.getOrCreateNbt().putString("appearance", Registry.ITEM.getId(appearance.getItem()).toString());
|
||||
result.getOrCreateNbt().putString("appearance", Registries.ITEM.getId(appearance.getItem()).toString());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ public class CrystalHeartItem extends Item implements FloatingArtefactEntity.Art
|
|||
|
||||
if (world instanceof ServerWorld serverWorld) {
|
||||
|
||||
FloatingArtefactEntity entity = UEntities.FLOATING_ARTEFACT.create(serverWorld, context.getStack().getNbt(), null, context.getPlayer(), blockPos, SpawnReason.SPAWN_EGG, false, true);
|
||||
FloatingArtefactEntity entity = UEntities.FLOATING_ARTEFACT.create(serverWorld, context.getStack().getNbt(), null, blockPos, SpawnReason.SPAWN_EGG, false, true);
|
||||
|
||||
if (entity == null) {
|
||||
return ActionResult.FAIL;
|
||||
|
|
|
@ -4,13 +4,14 @@ import net.minecraft.inventory.CraftingInventory;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.recipe.RecipeSerializer;
|
||||
import net.minecraft.recipe.book.CraftingRecipeCategory;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.Pair;
|
||||
|
||||
public class GlowingRecipe extends ItemCombinationRecipe {
|
||||
|
||||
public GlowingRecipe(Identifier id) {
|
||||
super(id);
|
||||
public GlowingRecipe(Identifier id, CraftingRecipeCategory category) {
|
||||
super(id, category);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,14 +3,15 @@ package com.minelittlepony.unicopia.item;
|
|||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.recipe.SpecialCraftingRecipe;
|
||||
import net.minecraft.recipe.book.CraftingRecipeCategory;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.Pair;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class ItemCombinationRecipe extends SpecialCraftingRecipe {
|
||||
|
||||
public ItemCombinationRecipe(Identifier id) {
|
||||
super(id);
|
||||
public ItemCombinationRecipe(Identifier id, CraftingRecipeCategory category) {
|
||||
super(id, category);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,13 +3,14 @@ package com.minelittlepony.unicopia.item;
|
|||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.recipe.RecipeSerializer;
|
||||
import net.minecraft.recipe.book.CraftingRecipeCategory;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.Pair;
|
||||
|
||||
public class JarInsertRecipe extends ItemCombinationRecipe {
|
||||
|
||||
public JarInsertRecipe(Identifier id) {
|
||||
super(id);
|
||||
public JarInsertRecipe(Identifier id, CraftingRecipeCategory category) {
|
||||
super(id, category);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,7 +17,8 @@ import net.fabricmc.fabric.api.registry.FuelRegistry;
|
|||
import net.minecraft.sound.SoundEvent;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.Rarity;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
|
||||
public interface UItems {
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ import net.minecraft.util.math.Vec3d;
|
|||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Rarity;
|
||||
import net.minecraft.util.TypedActionResult;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.event.GameEvent;
|
||||
|
||||
|
@ -100,13 +100,13 @@ public class ZapAppleItem extends Item implements ChameleonItem, ToxicHolder {
|
|||
@Override
|
||||
public void appendStacks(ItemGroup tab, DefaultedList<ItemStack> items) {
|
||||
super.appendStacks(tab, items);
|
||||
if (isIn(tab)) {
|
||||
if (tab.contains(getDefaultStack())) {
|
||||
Unicopia.SIDE.getPony().map(Pony::getReferenceWorld)
|
||||
.stream()
|
||||
.flatMap(world -> Registries.valuesForTag(world, UTags.APPLES))
|
||||
.filter(a -> a != this).forEach(item -> {
|
||||
ItemStack stack = new ItemStack(this);
|
||||
stack.getOrCreateNbt().putString("appearance", Registry.ITEM.getId(item).toString());
|
||||
stack.getOrCreateNbt().putString("appearance", Registries.ITEM.getId(item).toString());
|
||||
items.add(stack);
|
||||
});
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue