mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-21 12:24:22 +01:00
1.19.3 -> 1.19.2
This commit is contained in:
parent
71e6b4ac16
commit
49cc3c495b
115 changed files with 498 additions and 574 deletions
|
@ -3,10 +3,10 @@ org.gradle.daemon=false
|
|||
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/develop
|
||||
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
|
||||
minecraft_version=1.19.2
|
||||
yarn_mappings=1.19.2+build.28
|
||||
loader_version=0.14.14
|
||||
fabric_version=0.73.2+1.19.2
|
||||
|
||||
# Mod Properties
|
||||
group=com.minelittlepony
|
||||
|
@ -21,8 +21,8 @@ org.gradle.daemon=false
|
|||
|
||||
# Dependencies
|
||||
fabwork_version=1.1.4
|
||||
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
|
||||
modmenu_version=4.0.6
|
||||
minelp_version=4.7.3+lts
|
||||
kirin_version=1.13.2+lts
|
||||
reach_attributes_version=2.3.0
|
||||
trinkets_version=3.4.0
|
||||
|
|
|
@ -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.registry.Registry;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
|
||||
public final class Race implements Affine {
|
||||
public static final String DEFAULT_ID = "unicopia:unset";
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
package com.minelittlepony.unicopia;
|
||||
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.event.GameEvent;
|
||||
|
||||
public interface UGameEvents {
|
||||
|
@ -11,7 +10,7 @@ public interface UGameEvents {
|
|||
|
||||
static GameEvent register(String name, int range) {
|
||||
Identifier id = Unicopia.id(name);
|
||||
return Registry.register(Registries.GAME_EVENT, id, new GameEvent(id.toString(), range));
|
||||
return Registry.register(Registry.GAME_EVENT, id, new GameEvent(id.toString(), range));
|
||||
}
|
||||
|
||||
static void bootstrap() {
|
||||
|
|
|
@ -3,8 +3,7 @@ package com.minelittlepony.unicopia;
|
|||
import net.minecraft.sound.SoundEvent;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
public interface USounds {
|
||||
SoundEvent AMBIENT_WIND_GUST = register("ambient.wind.gust");
|
||||
|
@ -89,7 +88,7 @@ public interface USounds {
|
|||
|
||||
static SoundEvent register(String name) {
|
||||
Identifier id = Unicopia.id(name);
|
||||
return Registry.register(Registries.SOUND_EVENT, id, SoundEvent.of(id));
|
||||
return Registry.register(Registry.SOUND_EVENT, id, new SoundEvent(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.registry.*;
|
||||
import net.minecraft.registry.tag.TagKey;
|
||||
import net.minecraft.tag.TagKey;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
public interface UTags {
|
||||
TagKey<Item> APPLES = item("apples");
|
||||
|
@ -37,15 +37,15 @@ public interface UTags {
|
|||
TagKey<EntityType<?>> TRANSFORMABLE_ENTITIES = entity("transformable");
|
||||
|
||||
static TagKey<Item> item(String name) {
|
||||
return TagKey.of(RegistryKeys.ITEM, Unicopia.id(name));
|
||||
return TagKey.of(Registry.ITEM_KEY, Unicopia.id(name));
|
||||
}
|
||||
|
||||
static TagKey<Block> block(String name) {
|
||||
return TagKey.of(RegistryKeys.BLOCK, Unicopia.id(name));
|
||||
return TagKey.of(Registry.BLOCK_KEY, Unicopia.id(name));
|
||||
}
|
||||
|
||||
static TagKey<EntityType<?>> entity(String name) {
|
||||
return TagKey.of(RegistryKeys.ENTITY_TYPE, Unicopia.id(name));
|
||||
return TagKey.of(Registry.ENTITY_TYPE_KEY, Unicopia.id(name));
|
||||
}
|
||||
|
||||
static void bootstrap() {
|
||||
|
|
|
@ -12,7 +12,7 @@ import com.minelittlepony.unicopia.Unicopia;
|
|||
import com.minelittlepony.unicopia.util.RegistryUtils;
|
||||
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
public interface Abilities {
|
||||
Registry<Ability<?>> REGISTRY = RegistryUtils.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.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
public record TreeTypeImpl (
|
||||
Identifier name,
|
||||
|
@ -43,7 +43,7 @@ public record TreeTypeImpl (
|
|||
}
|
||||
|
||||
private static boolean findMatch(Set<Identifier> ids, BlockState state) {
|
||||
return ids.contains(Registries.BLOCK.getId(state.getBlock()));
|
||||
return ids.contains(Registry.BLOCK.getId(state.getBlock()));
|
||||
}
|
||||
|
||||
static boolean isNonPersistent(BlockState state) {
|
||||
|
|
|
@ -18,12 +18,11 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.resource.JsonDataLoader;
|
||||
import net.minecraft.resource.ResourceManager;
|
||||
import net.minecraft.tag.TagKey;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.profiler.Profiler;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.registry.entry.RegistryEntry;
|
||||
import net.minecraft.registry.tag.TagKey;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryEntry;
|
||||
|
||||
public class TreeTypeLoader extends JsonDataLoader implements IdentifiableResourceReloadListener {
|
||||
private static final Identifier ID = Unicopia.id("data/tree_type");
|
||||
|
@ -106,12 +105,12 @@ public class TreeTypeLoader extends JsonDataLoader implements IdentifiableResour
|
|||
@Override
|
||||
public void appendTo(Weighted.Builder<Supplier<ItemStack>> weighted) {
|
||||
if (item != null) {
|
||||
Registries.ITEM.getOrEmpty(item).ifPresent(item -> {
|
||||
Registry.ITEM.getOrEmpty(item).ifPresent(item -> {
|
||||
weighted.put(weight, item::getDefaultStack);
|
||||
});
|
||||
} else {
|
||||
weighted.put(weight, () -> {
|
||||
return Registries.ITEM.getOrCreateEntryList(TagKey.of(RegistryKeys.ITEM, tag))
|
||||
return Registry.ITEM.getOrCreateEntryList(TagKey.of(Registry.ITEM_KEY, tag))
|
||||
.getRandom(Weighted.getRng())
|
||||
.map(RegistryEntry::value)
|
||||
.map(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.registry.tag.BlockTags;
|
||||
import net.minecraft.tag.BlockTags;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
|
|
|
@ -16,7 +16,8 @@ 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.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -203,7 +204,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(RegistryKeys.WORLD, id);
|
||||
dimension = RegistryKey.of(Registry.WORLD_KEY, 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.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
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<>(Registries.PARTICLE_TYPE.getIds());
|
||||
List<Identifier> names = new ArrayList<>(Registry.PARTICLE_TYPE.getIds());
|
||||
|
||||
int index = (int)MathHelper.nextDouble(source.asWorld().random, 0, names.size());
|
||||
|
||||
Identifier id = names.get(index);
|
||||
ParticleType<?> type = Registries.PARTICLE_TYPE.get(id);
|
||||
ParticleType<?> type = Registry.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.World.ExplosionSourceType;
|
||||
import net.minecraft.world.explosion.Explosion.DestructionType;
|
||||
|
||||
/**
|
||||
* 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, ExplosionSourceType.NONE);
|
||||
projectile.world.createExplosion(projectile, pos.getX(), pos.getY(), pos.getZ(), 3, DestructionType.NONE);
|
||||
toPlaceable().tick(projectile, Situation.BODY);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,13 +27,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.registry.tag.BlockTags;
|
||||
import net.minecraft.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.World.ExplosionSourceType;
|
||||
import net.minecraft.world.explosion.Explosion.DestructionType;
|
||||
|
||||
/**
|
||||
* Simple fire spell that triggers an effect when used on a block.
|
||||
|
@ -51,7 +51,7 @@ public class FireSpell extends AbstractAreaEffectSpell implements ProjectileDele
|
|||
public void onImpact(MagicProjectileEntity projectile, BlockHitResult hit) {
|
||||
if (!projectile.isClient()) {
|
||||
Vec3d pos = hit.getPos();
|
||||
projectile.asWorld().createExplosion(projectile.getOwner(), pos.getX(), pos.getY(), pos.getZ(), 2, ExplosionSourceType.MOB);
|
||||
projectile.asWorld().createExplosion(projectile.getOwner(), pos.getX(), pos.getY(), pos.getZ(), 2, DestructionType.BREAK);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class FireSpell extends AbstractAreaEffectSpell implements ProjectileDele
|
|||
public void onImpact(MagicProjectileEntity projectile, EntityHitResult hit) {
|
||||
if (!projectile.isClient()) {
|
||||
Entity entity = hit.getEntity();
|
||||
projectile.asWorld().createExplosion(projectile.getOwner(), entity.getX(), entity.getY(), entity.getZ(), 2, ExplosionSourceType.MOB);
|
||||
projectile.asWorld().createExplosion(projectile.getOwner(), entity.getX(), entity.getY(), entity.getZ(), 2, DestructionType.BREAK);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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.registry.tag.TagKey;
|
||||
import net.minecraft.tag.TagKey;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
|
|
@ -21,8 +21,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.registry.tag.BlockTags;
|
||||
import net.minecraft.registry.tag.FluidTags;
|
||||
import net.minecraft.tag.BlockTags;
|
||||
import net.minecraft.tag.FluidTags;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
|
|
@ -26,8 +26,8 @@ import net.minecraft.nbt.NbtCompound;
|
|||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.tag.FluidTags;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.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.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
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(Registries.ITEM.getId(item), EMPTY);
|
||||
return REGISTRY.getOrDefault(Registry.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 -> Registries.ITEM.getOrEmpty(id).stream());
|
||||
.flatMap(id -> Registry.ITEM.getOrEmpty(id).stream());
|
||||
}
|
||||
|
||||
public static Optional<SpellTraits> getEmbeddedTraits(ItemStack stack) {
|
||||
|
|
|
@ -29,7 +29,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.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TraitDiscovery implements NbtSerialisable, Copyable<TraitDiscovery> {
|
||||
|
@ -67,7 +67,7 @@ public class TraitDiscovery implements NbtSerialisable, Copyable<TraitDiscovery>
|
|||
return;
|
||||
}
|
||||
SpellTraits traits = SpellTraits.of(item);
|
||||
items.put(Registries.ITEM.getId(item), traits);
|
||||
items.put(Registry.ITEM.getId(item), traits);
|
||||
Set<Trait> newTraits = new HashSet<>();
|
||||
traits.entries().forEach(e -> {
|
||||
if (this.traits.add(e.getKey())) {
|
||||
|
@ -82,13 +82,13 @@ public class TraitDiscovery implements NbtSerialisable, Copyable<TraitDiscovery>
|
|||
}
|
||||
|
||||
public SpellTraits getKnownTraits(Item item) {
|
||||
return items.getOrDefault(Registries.ITEM.getId(item), SpellTraits.EMPTY);
|
||||
return items.getOrDefault(Registry.ITEM.getId(item), SpellTraits.EMPTY);
|
||||
}
|
||||
|
||||
public Stream<Item> getKnownItems(Trait trait) {
|
||||
return items.entrySet().stream()
|
||||
.filter(entry -> entry.getValue().get(trait) > 0)
|
||||
.flatMap(entry -> Registries.ITEM.getOrEmpty(entry.getKey()).stream());
|
||||
.flatMap(entry -> Registry.ITEM.getOrEmpty(entry.getKey()).stream());
|
||||
}
|
||||
|
||||
public boolean isUnread() {
|
||||
|
@ -144,7 +144,7 @@ public class TraitDiscovery implements NbtSerialisable, Copyable<TraitDiscovery>
|
|||
|
||||
private Optional<SpellTraits> loadTraits(Identifier itemId, NbtCompound nbt) {
|
||||
if (!pony.isClient()) {
|
||||
return Registries.ITEM.getOrEmpty(itemId)
|
||||
return Registry.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.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
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 || !Registries.ITEM.containsId(item)) {
|
||||
if (item == null || !Registry.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.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world));
|
||||
world.createAndScheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world));
|
||||
}
|
||||
return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos);
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ public class RockCropBlock extends CropBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isFertilizable(WorldView world, BlockPos pos, BlockState state, boolean isClient) {
|
||||
public boolean isFertilizable(BlockView 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(WorldView world, BlockPos pos, BlockState state, boolean isClient) {
|
||||
public boolean isFertilizable(BlockView world, BlockPos pos, BlockState state, boolean isClient) {
|
||||
return super.isFertilizable(world, pos, state, isClient) || (nextSegmentSupplier != null && isNext(world.getBlockState(pos.up())));
|
||||
}
|
||||
|
||||
|
|
|
@ -5,15 +5,14 @@ import java.util.function.Predicate;
|
|||
import java.util.function.Supplier;
|
||||
|
||||
import net.fabricmc.fabric.api.biome.v1.*;
|
||||
import net.fabricmc.fabric.api.event.registry.DynamicRegistrySetupCallback;
|
||||
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.util.Identifier;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
import net.minecraft.registry.*;
|
||||
import net.minecraft.registry.tag.BiomeTags;
|
||||
import net.minecraft.util.registry.*;
|
||||
import net.minecraft.tag.BiomeTags;
|
||||
import net.minecraft.world.gen.GenerationStep;
|
||||
import net.minecraft.world.gen.feature.*;
|
||||
import net.minecraft.world.gen.feature.size.TwoLayersFeatureSize;
|
||||
|
@ -23,36 +22,12 @@ import net.minecraft.world.gen.stateprovider.BlockStateProvider;
|
|||
import net.minecraft.world.gen.trunk.TrunkPlacer;
|
||||
|
||||
public record Tree (
|
||||
Identifier id,
|
||||
TreeFeatureConfig.Builder config,
|
||||
RegistryKey<ConfiguredFeature<?, ?>> configuredFeatureId,
|
||||
Optional<RegistryKey<PlacedFeature>> placedFeatureId,
|
||||
Optional<Block> sapling,
|
||||
Optional<PlacementModifier> placement
|
||||
RegistryEntry<ConfiguredFeature<TreeFeatureConfig, ?>> configuredFeature,
|
||||
Optional<RegistryEntry<PlacedFeature>> placedFeature,
|
||||
Optional<Block> sapling
|
||||
) {
|
||||
public static final List<Tree> REGISTRY = new ArrayList<>();
|
||||
|
||||
private static void bootstrap() {
|
||||
DynamicRegistrySetupCallback.EVENT.register(registries -> {
|
||||
registries.getOptional(RegistryKeys.CONFIGURED_FEATURE).ifPresent(registry -> {
|
||||
REGISTRY.forEach(tree -> {
|
||||
Registry.register(registry, tree.id(), new ConfiguredFeature<>(Feature.TREE, tree.config.build()));
|
||||
});
|
||||
});
|
||||
registries.getOptional(RegistryKeys.PLACED_FEATURE).ifPresent(registry -> {
|
||||
var reg = registries.asDynamicRegistryManager().createRegistryLookup().getOrThrow(RegistryKeys.CONFIGURED_FEATURE);
|
||||
REGISTRY.stream().filter(tree -> tree.placedFeatureId().isPresent()).forEach(tree -> {
|
||||
var placedFeature = new PlacedFeature(reg.getOrThrow(tree.configuredFeatureId()),
|
||||
VegetationPlacedFeatures.modifiersWithWouldSurvive(tree.placement().orElseThrow(), tree.sapling().orElse(Blocks.OAK_SAPLING))
|
||||
);
|
||||
|
||||
Registry.register(registry, tree.id, placedFeature);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
public static final Predicate<BiomeSelectionContext> IS_FOREST = BiomeSelectors.foundInOverworld().and(BiomeSelectors.tag(BiomeTags.IS_FOREST));
|
||||
|
||||
|
@ -116,28 +91,31 @@ public record Tree (
|
|||
}
|
||||
|
||||
public Tree build() {
|
||||
RegistryKey<ConfiguredFeature<?, ?>> configuredFeatureId = RegistryKey.of(RegistryKeys.CONFIGURED_FEATURE, id);
|
||||
Tree tree = new Tree(id, configSupplier.map(Supplier::get)
|
||||
RegistryEntry<ConfiguredFeature<TreeFeatureConfig, ?>> configuredFeature = ConfiguredFeatures.register(id.toString(), Feature.TREE, configSupplier.map(Supplier::get)
|
||||
.orElseGet(() -> new TreeFeatureConfig.Builder(
|
||||
BlockStateProvider.of(logType),
|
||||
trunkPlacer,
|
||||
BlockStateProvider.of(leavesType),
|
||||
foliagePlacer,
|
||||
size.get()
|
||||
).forceDirt()), configuredFeatureId, selector.map(selector -> {
|
||||
RegistryKey<PlacedFeature> i = RegistryKey.of(RegistryKeys.PLACED_FEATURE, id);
|
||||
BiomeModifications.addFeature(selector, GenerationStep.Feature.VEGETAL_DECORATION, i);
|
||||
return i;
|
||||
}), saplingId.map(id -> UBlocks.register(id, new SaplingBlock(new SaplingGenerator() {
|
||||
@Override
|
||||
protected RegistryKey<ConfiguredFeature<?, ?>> getTreeFeature(Random rng, boolean flowersNearby) {
|
||||
return configuredFeatureId;
|
||||
}
|
||||
}, FabricBlockSettings.copy(Blocks.OAK_SAPLING)), ItemGroups.NATURAL)), countModifier);
|
||||
BlockStateProvider.of(logType),
|
||||
trunkPlacer,
|
||||
BlockStateProvider.of(leavesType),
|
||||
foliagePlacer,
|
||||
size.get()
|
||||
).forceDirt()).build());
|
||||
|
||||
if (REGISTRY.isEmpty()) {
|
||||
bootstrap();
|
||||
}
|
||||
Optional<Block> sapling = saplingId.map(id -> UBlocks.register(id, new SaplingBlock(new SaplingGenerator() {
|
||||
@Override
|
||||
protected RegistryEntry<? extends ConfiguredFeature<?, ?>> getTreeFeature(Random rng, boolean flowersNearby) {
|
||||
return configuredFeature;
|
||||
}
|
||||
}, FabricBlockSettings.copy(Blocks.OAK_SAPLING)), ItemGroup.DECORATIONS));
|
||||
|
||||
Optional<RegistryEntry<PlacedFeature>> placedFeature = selector.map(selector -> {
|
||||
var pf = PlacedFeatures.register(id.toString() + "_checked", configuredFeature,
|
||||
VegetationPlacedFeatures.modifiersWithWouldSurvive(countModifier.orElseThrow(), sapling.orElse(Blocks.OAK_SAPLING))
|
||||
);
|
||||
BiomeModifications.addFeature(selector, GenerationStep.Feature.VEGETAL_DECORATION, pf.getKey().get());
|
||||
return pf;
|
||||
});
|
||||
|
||||
Tree tree = new Tree(configuredFeature, placedFeature, sapling);
|
||||
|
||||
REGISTRY.add(tree);
|
||||
return tree;
|
||||
|
|
|
@ -3,14 +3,13 @@ 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.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
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(Registries.BLOCK_ENTITY_TYPE, id, builder.build(null));
|
||||
return Registry.register(Registry.BLOCK_ENTITY_TYPE, id, builder.build(null));
|
||||
}
|
||||
|
||||
static void bootstrap() {}
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.util.List;
|
|||
|
||||
import com.minelittlepony.unicopia.Unicopia;
|
||||
import com.minelittlepony.unicopia.item.UItems;
|
||||
import com.minelittlepony.unicopia.item.group.ItemGroupRegistry;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricMaterialBuilder;
|
||||
|
@ -17,8 +16,7 @@ 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.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.BlockView;
|
||||
|
||||
public interface UBlocks {
|
||||
|
@ -34,23 +32,23 @@ public interface UBlocks {
|
|||
|
||||
Block FROSTED_OBSIDIAN = register("frosted_obsidian", new FrostedObsidianBlock(FabricBlockSettings.copy(Blocks.OBSIDIAN).ticksRandomly()));
|
||||
|
||||
Block ZAP_LOG = register("zap_log", new ZapAppleLogBlock(Blocks.OAK_LOG, MapColor.GRAY, MapColor.DEEPSLATE_GRAY), ItemGroups.BUILDING_BLOCKS);
|
||||
Block ZAP_WOOD = register("zap_wood", new ZapAppleLogBlock(Blocks.OAK_WOOD, MapColor.DEEPSLATE_GRAY, MapColor.DEEPSLATE_GRAY), ItemGroups.BUILDING_BLOCKS);
|
||||
Block ZAP_LOG = register("zap_log", new ZapAppleLogBlock(Blocks.OAK_LOG, MapColor.GRAY, MapColor.DEEPSLATE_GRAY), ItemGroup.BUILDING_BLOCKS);
|
||||
Block ZAP_WOOD = register("zap_wood", new ZapAppleLogBlock(Blocks.OAK_WOOD, MapColor.DEEPSLATE_GRAY, MapColor.DEEPSLATE_GRAY), ItemGroup.BUILDING_BLOCKS);
|
||||
|
||||
Block STRIPPED_ZAP_LOG = register("stripped_zap_log", new ZapAppleLogBlock(Blocks.STRIPPED_OAK_LOG, MapColor.LIGHT_GRAY, MapColor.GRAY), ItemGroups.BUILDING_BLOCKS);
|
||||
Block STRIPPED_ZAP_WOOD = register("stripped_zap_wood", new ZapAppleLogBlock(Blocks.STRIPPED_OAK_WOOD, MapColor.GRAY, MapColor.GRAY), ItemGroups.BUILDING_BLOCKS);
|
||||
Block STRIPPED_ZAP_LOG = register("stripped_zap_log", new ZapAppleLogBlock(Blocks.STRIPPED_OAK_LOG, MapColor.LIGHT_GRAY, MapColor.GRAY), ItemGroup.BUILDING_BLOCKS);
|
||||
Block STRIPPED_ZAP_WOOD = register("stripped_zap_wood", new ZapAppleLogBlock(Blocks.STRIPPED_OAK_WOOD, MapColor.GRAY, MapColor.GRAY), ItemGroup.BUILDING_BLOCKS);
|
||||
|
||||
Block ZAP_LEAVES = register("zap_leaves", new ZapAppleLeavesBlock(), ItemGroups.NATURAL);
|
||||
Block ZAP_LEAVES = register("zap_leaves", new ZapAppleLeavesBlock(), ItemGroup.DECORATIONS);
|
||||
Block ZAP_BULB = register("zap_bulb", new FruitBlock(FabricBlockSettings.of(Material.GOURD, MapColor.GRAY).strength(500, 1200).sounds(BlockSoundGroup.AZALEA_LEAVES), Direction.DOWN, ZAP_LEAVES, FruitBlock.DEFAULT_SHAPE, false));
|
||||
Block ZAP_APPLE = register("zap_apple", new FruitBlock(FabricBlockSettings.of(Material.GOURD, MapColor.GRAY).sounds(BlockSoundGroup.AZALEA_LEAVES), Direction.DOWN, ZAP_LEAVES, FruitBlock.DEFAULT_SHAPE, false));
|
||||
|
||||
Block WEATHER_VANE = register("weather_vane", new WeatherVaneBlock(FabricBlockSettings.of(Material.METAL, MapColor.BLACK).requiresTool().strength(3.0f, 6.0f).sounds(BlockSoundGroup.METAL).nonOpaque()), ItemGroups.TOOLS);
|
||||
Block WEATHER_VANE = register("weather_vane", new WeatherVaneBlock(FabricBlockSettings.of(Material.METAL, MapColor.BLACK).requiresTool().strength(3.0f, 6.0f).sounds(BlockSoundGroup.METAL).nonOpaque()), ItemGroup.TOOLS);
|
||||
|
||||
Block GREEN_APPLE_LEAVES = register("green_apple_leaves", new FruitBearingBlock(FabricBlockSettings.copy(Blocks.OAK_LEAVES),
|
||||
0xE5FFFF88,
|
||||
() -> UBlocks.GREEN_APPLE,
|
||||
() -> UItems.GREEN_APPLE.getDefaultStack()
|
||||
), ItemGroups.NATURAL);
|
||||
), ItemGroup.DECORATIONS);
|
||||
Block GREEN_APPLE = register("green_apple", new FruitBlock(FabricBlockSettings.of(Material.GOURD, MapColor.GREEN).sounds(BlockSoundGroup.WOOD), Direction.DOWN, GREEN_APPLE_LEAVES, FruitBlock.DEFAULT_SHAPE));
|
||||
Block GREEN_APPLE_SPROUT = register("green_apple_sprout", new SproutBlock(0xE5FFFF88, () -> UItems.GREEN_APPLE_SEEDS, () -> UTreeGen.GREEN_APPLE_TREE.sapling().map(Block::getDefaultState).get()));
|
||||
|
||||
|
@ -58,7 +56,7 @@ public interface UBlocks {
|
|||
0xE5FFCC88,
|
||||
() -> UBlocks.SWEET_APPLE,
|
||||
() -> UItems.SWEET_APPLE.getDefaultStack()
|
||||
), ItemGroups.NATURAL);
|
||||
), ItemGroup.DECORATIONS);
|
||||
Block SWEET_APPLE = register("sweet_apple", new FruitBlock(FabricBlockSettings.of(Material.GOURD, MapColor.GREEN).sounds(BlockSoundGroup.WOOD), Direction.DOWN, SWEET_APPLE_LEAVES, FruitBlock.DEFAULT_SHAPE));
|
||||
Block SWEET_APPLE_SPROUT = register("sweet_apple_sprout", new SproutBlock(0xE5FFCC88, () -> UItems.SWEET_APPLE_SEEDS, () -> UTreeGen.SWEET_APPLE_TREE.sapling().map(Block::getDefaultState).get()));
|
||||
|
||||
|
@ -66,7 +64,7 @@ public interface UBlocks {
|
|||
0xE5FFCCCC,
|
||||
() -> UBlocks.SOUR_APPLE,
|
||||
() -> UItems.SOUR_APPLE.getDefaultStack()
|
||||
), ItemGroups.NATURAL);
|
||||
), ItemGroup.DECORATIONS);
|
||||
Block SOUR_APPLE = register("sour_apple", new FruitBlock(FabricBlockSettings.of(Material.GOURD, MapColor.GREEN).sounds(BlockSoundGroup.WOOD), Direction.DOWN, SOUR_APPLE_LEAVES, FruitBlock.DEFAULT_SHAPE));
|
||||
Block SOUR_APPLE_SPROUT = register("sour_apple_sprout", new SproutBlock(0xE5FFCC88, () -> UItems.SOUR_APPLE_SEEDS, () -> UTreeGen.SOUR_APPLE_TREE.sapling().map(Block::getDefaultState).get()));
|
||||
|
||||
|
@ -85,7 +83,7 @@ public interface UBlocks {
|
|||
}
|
||||
|
||||
static <T extends Block> T register(Identifier id, T block, ItemGroup group) {
|
||||
UItems.register(id, ItemGroupRegistry.register(new BlockItem(block, new Item.Settings()), group));
|
||||
UItems.register(id, new BlockItem(block, new Item.Settings().group(group)));
|
||||
return register(id, block);
|
||||
}
|
||||
|
||||
|
@ -96,7 +94,7 @@ public interface UBlocks {
|
|||
if (block instanceof SaplingBlock || block instanceof SproutBlock || block instanceof FruitBlock || block instanceof CropBlock) {
|
||||
TRANSLUCENT_BLOCKS.add(block);
|
||||
}
|
||||
return Registry.register(Registries.BLOCK, id, block);
|
||||
return Registry.register(Registry.BLOCK, id, block);
|
||||
}
|
||||
|
||||
static void bootstrap() {
|
||||
|
|
|
@ -5,8 +5,8 @@ import com.minelittlepony.unicopia.Unicopia;
|
|||
import net.minecraft.block.*;
|
||||
import net.minecraft.util.math.intprovider.ConstantIntProvider;
|
||||
import net.minecraft.util.math.intprovider.UniformIntProvider;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.tag.BlockTags;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.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),
|
||||
Registries.BLOCK.getOrCreateEntryList(BlockTags.MANGROVE_LOGS_CAN_GROW_THROUGH)
|
||||
Registry.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.scheduleBlockTick(pos, this, 1);
|
||||
world.createAndScheduleBlockTick(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().scheduleBlockTick(ctx.getBlockPos(), this, 1);
|
||||
ctx.getWorld().createAndScheduleBlockTick(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.registry.tag.BlockTags;
|
||||
import net.minecraft.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.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
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 Registries.BLOCK.getOrEmpty(id).map(Block::getDefaultState)
|
||||
return Registry.BLOCK.getOrEmpty(id).map(Block::getDefaultState)
|
||||
.map(newState -> merge(newState, state))
|
||||
.orElse(state);
|
||||
}
|
||||
|
|
|
@ -17,10 +17,9 @@ import net.minecraft.block.*;
|
|||
import net.minecraft.state.property.Property;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.JsonHelper;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.registry.entry.RegistryEntry;
|
||||
import net.minecraft.registry.tag.TagKey;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryEntry;
|
||||
import net.minecraft.tag.TagKey;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class StatePredicate implements Predicate<BlockState> {
|
||||
|
@ -54,7 +53,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(RegistryKeys.BLOCK, new Identifier(s))).ifPresent(tag -> {
|
||||
Optional.of(JsonHelper.getString(o, "tag")).map(s -> TagKey.of(Registry.BLOCK_KEY, new Identifier(s))).ifPresent(tag -> {
|
||||
predicates.add(new StatePredicate() {
|
||||
@Override
|
||||
public StateChange getInverse() {
|
||||
|
@ -67,7 +66,7 @@ public abstract class StatePredicate implements Predicate<BlockState> {
|
|||
|
||||
@Override
|
||||
public @NotNull BlockState getConverted(World world, @NotNull BlockState state) {
|
||||
return Registries.BLOCK.getOrCreateEntryList(tag)
|
||||
return Registry.BLOCK.getOrCreateEntryList(tag)
|
||||
.getRandom(world.random)
|
||||
.map(RegistryEntry::value)
|
||||
.map(Block::getDefaultState)
|
||||
|
@ -154,14 +153,14 @@ public abstract class StatePredicate implements Predicate<BlockState> {
|
|||
|
||||
@Override
|
||||
public @NotNull BlockState getConverted(World world, @NotNull BlockState state) {
|
||||
return Registries.BLOCK.getOrEmpty(id).map(Block::getDefaultState).orElse(state);
|
||||
return Registry.BLOCK.getOrEmpty(id).map(Block::getDefaultState).orElse(state);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(BlockState state) {
|
||||
return Registries.BLOCK.getOrEmpty(id).filter(state::isOf).isPresent();
|
||||
return Registry.BLOCK.getOrEmpty(id).filter(state::isOf).isPresent();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -178,7 +177,7 @@ public abstract class StatePredicate implements Predicate<BlockState> {
|
|||
|
||||
@Override
|
||||
public @NotNull BlockState getConverted(World world, @NotNull BlockState state) {
|
||||
return Registries.BLOCK.getOrEmpty(id).map(Block::getDefaultState).map(newState -> {
|
||||
return Registry.BLOCK.getOrEmpty(id).map(Block::getDefaultState).map(newState -> {
|
||||
for (PropertyOp prop : properties) {
|
||||
newState = prop.applyTo(world, newState);
|
||||
}
|
||||
|
@ -190,7 +189,7 @@ public abstract class StatePredicate implements Predicate<BlockState> {
|
|||
|
||||
@Override
|
||||
public boolean test(BlockState state) {
|
||||
return Registries.BLOCK.getOrEmpty(id).filter(state::isOf).isPresent() && properties.stream().allMatch(p -> p.test(state));
|
||||
return Registry.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::getPositionTexProgram);
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
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.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
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(Registries.ITEM.getId(stack.getItem()).toString()).formatted(Formatting.DARK_GRAY));
|
||||
insertPosition = checkFor(lines, Text.literal(Registry.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 -> Registries.ENCHANTMENT.getOrEmpty(Identifier.tryParse(tag.getString("id")))
|
||||
.map(tag -> Registry.ENCHANTMENT.getOrEmpty(Identifier.tryParse(tag.getString("id")))
|
||||
.map(ench -> new Pair<>(tag.getInt("lvl"), ench)))
|
||||
.filter(Optional::isPresent)
|
||||
.map(Optional::get);
|
||||
|
|
|
@ -34,6 +34,7 @@ import net.minecraft.client.item.ModelPredicateProviderRegistry;
|
|||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.particle.SpriteProvider;
|
||||
import net.minecraft.client.render.*;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRendererFactories;
|
||||
import net.minecraft.client.render.entity.FlyingItemEntityRenderer;
|
||||
import net.minecraft.client.render.item.ItemRenderer;
|
||||
import net.minecraft.client.render.model.json.ModelTransformation;
|
||||
|
@ -76,7 +77,7 @@ public interface URenderers {
|
|||
EntityRendererRegistry.register(UEntities.SPELLBOOK, SpellbookEntityRenderer::new);
|
||||
EntityRendererRegistry.register(UEntities.AIR_BALLOON, AirBalloonEntityRenderer::new);
|
||||
|
||||
BlockEntityRendererRegistry.register(UBlockEntities.WEATHER_VANE, WeatherVaneBlockEntityRenderer::new);
|
||||
BlockEntityRendererFactories.register(UBlockEntities.WEATHER_VANE, WeatherVaneBlockEntityRenderer::new);
|
||||
|
||||
ColorProviderRegistry.ITEM.register((stack, i) -> i > 0 ? -1 : ((DyeableItem)stack.getItem()).getColor(stack), UItems.FRIENDSHIP_BRACELET);
|
||||
BuiltinItemRendererRegistry.INSTANCE.register(UItems.FILLED_JAR, (stack, mode, matrices, vertexConsumers, light, overlay) -> {
|
||||
|
|
|
@ -3,8 +3,6 @@ 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;
|
||||
|
@ -155,27 +153,27 @@ public class DismissSpellScreen extends GameGui {
|
|||
|
||||
@Override
|
||||
public boolean isMouseOver(double mouseX, double mouseY) {
|
||||
return squareDistance(mouseX, mouseY, x, y) < 75;
|
||||
return squareDistance(mouseX, mouseY, getX(), getY()) < 75;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float tickDelta) {
|
||||
copy.set(x, y, z, w);
|
||||
copy.mul(matrices.peek().getPositionMatrix());
|
||||
copy.set(getX(), getY(), getZ(), getW());
|
||||
copy.transform(matrices.peek().getPositionMatrix());
|
||||
|
||||
var type = actualSpell.getType().withTraits(actualSpell.getTraits());
|
||||
|
||||
DrawableUtil.drawLine(matrices, 0, 0, (int)x, (int)y, 0xFFAAFF99);
|
||||
DrawableUtil.drawLine(matrices, 0, 0, (int)getX(), (int)getY(), 0xFFAAFF99);
|
||||
DrawableUtil.renderItemIcon(actualSpell.isDead() ? UItems.BOTCHED_GEM.getDefaultStack() : type.getDefaultStack(),
|
||||
copy.x - 8 + copy.z / 20F,
|
||||
copy.y - 8 + copy.z / 20F,
|
||||
copy.getX() - 8 + copy.getZ() / 20F,
|
||||
copy.getY() - 8 + copy.getZ() / 20F,
|
||||
1
|
||||
);
|
||||
|
||||
int color = actualSpell.getType().getColor() << 2;
|
||||
|
||||
matrices.push();
|
||||
matrices.translate(x, y, 0);
|
||||
matrices.translate(getX(), getY(), 0);
|
||||
|
||||
DrawableUtil.drawArc(matrices, 7, 8, 0, DrawableUtil.TAU, color | 0x00000088, false);
|
||||
|
||||
|
@ -223,7 +221,7 @@ public class DismissSpellScreen extends GameGui {
|
|||
}
|
||||
|
||||
static void playClickEffect() {
|
||||
MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK.value(), 6, 0.3F));
|
||||
MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 6, 0.3F));
|
||||
}
|
||||
|
||||
static double squareDistance(double x1, double y1, double x2, double y2) {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.minelittlepony.unicopia.client.gui;
|
||||
|
||||
import org.joml.Matrix4f;
|
||||
|
||||
import com.minelittlepony.unicopia.Race;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
|
@ -17,6 +15,7 @@ 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;
|
||||
|
@ -56,7 +55,7 @@ public interface DrawableUtil {
|
|||
RenderSystem.enableBlend();
|
||||
RenderSystem.disableTexture();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorShader);
|
||||
|
||||
Matrix4f matrix = matrices.peek().getPositionMatrix();
|
||||
|
||||
|
@ -68,11 +67,11 @@ public interface DrawableUtil {
|
|||
RenderSystem.enableBlend();
|
||||
RenderSystem.disableTexture();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorShader);
|
||||
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.drawWithGlobalProgram(bufferBuilder.end());
|
||||
BufferRenderer.drawWithShader(bufferBuilder.end());
|
||||
RenderSystem.enableTexture();
|
||||
RenderSystem.disableBlend();
|
||||
}
|
||||
|
@ -99,7 +98,7 @@ public interface DrawableUtil {
|
|||
}
|
||||
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorShader);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.disableTexture();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
|
@ -120,7 +119,7 @@ public interface DrawableUtil {
|
|||
cylendricalVertex(bufferBuilder, model, innerRadius, angle + INCREMENT, r, g, b, k);
|
||||
}
|
||||
|
||||
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
|
||||
BufferRenderer.drawWithShader(bufferBuilder.end());
|
||||
RenderSystem.enableTexture();
|
||||
}
|
||||
|
||||
|
@ -159,7 +158,7 @@ public interface DrawableUtil {
|
|||
}
|
||||
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorShader);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.disableTexture();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
|
@ -186,7 +185,7 @@ public interface DrawableUtil {
|
|||
}
|
||||
}
|
||||
|
||||
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
|
||||
BufferRenderer.drawWithShader(bufferBuilder.end());
|
||||
RenderSystem.enableTexture();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
package com.minelittlepony.unicopia.client.gui;
|
||||
|
||||
import org.joml.Matrix4f;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.client.render.*;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Matrix4f;
|
||||
|
||||
public interface GradientUtil {
|
||||
|
||||
|
@ -14,7 +13,7 @@ public interface GradientUtil {
|
|||
RenderSystem.disableTexture();
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorShader);
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder bufferBuilder = tessellator.getBuffer();
|
||||
fillVerticalGradient(matrices.peek().getPositionMatrix(), bufferBuilder, startX, startY, stopY, endX, endY, z, colorStart, colorStop, colorEnd);
|
||||
|
@ -53,7 +52,7 @@ public interface GradientUtil {
|
|||
RenderSystem.disableTexture();
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorShader);
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
if (fillRadials(matrices.peek().getPositionMatrix(), tessellator.getBuffer(), startX, startY, endX, endY, z, colorStart, colorEnd, radius)) {
|
||||
tessellator.draw();
|
||||
|
|
|
@ -29,7 +29,7 @@ public class TribeButton extends Button {
|
|||
|
||||
@Override
|
||||
public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexProgram);
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
RenderSystem.setShaderTexture(0, TribeSelectionScreen.TEXTURE);
|
||||
RenderSystem.setShaderColor(1, 1, 1, alpha);
|
||||
RenderSystem.enableBlend();
|
||||
|
|
|
@ -131,9 +131,9 @@ public class UHud extends DrawableHelper {
|
|||
if (pony.asEntity().isSneaking()) {
|
||||
first = !first;
|
||||
}
|
||||
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(first ? 37 : 63));
|
||||
matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(first ? 37 : 63));
|
||||
matrices.translate(-23, 0, 0);
|
||||
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(-26));
|
||||
matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(-26));
|
||||
matrices.scale(0.8F, 0.8F, 1);
|
||||
UHud.drawTexture(matrices, 0, 0, 3, 120, 15, 7, 128, 128);
|
||||
matrices.pop();
|
||||
|
@ -170,7 +170,7 @@ public class UHud extends DrawableHelper {
|
|||
|
||||
view.push();
|
||||
view.translate(x, y, 0);
|
||||
view.multiply(RotationAxis.POSITIVE_X.rotationDegrees(xDirection * 45));
|
||||
view.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(xDirection * 45));
|
||||
InventoryScreen.drawEntity(0, 0, scale, 0, -20, client.player);
|
||||
view.pop();
|
||||
RenderSystem.applyModelViewMatrix();
|
||||
|
|
|
@ -2,8 +2,6 @@ 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;
|
||||
|
@ -14,6 +12,7 @@ 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 {
|
||||
|
||||
|
@ -28,7 +27,7 @@ public class EquippedSpellSlot extends Button {
|
|||
if (spell.isEmpty()) {
|
||||
return List.of();
|
||||
}
|
||||
return spell.getDefaultStack().getTooltip(MinecraftClient.getInstance().player, TooltipContext.Default.BASIC);
|
||||
return spell.getDefaultStack().getTooltip(MinecraftClient.getInstance().player, TooltipContext.Default.NORMAL);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -41,7 +40,7 @@ public class EquippedSpellSlot extends Button {
|
|||
drawTexture(matrices, getX() - 8, getY() - 8, 0, 0, 32, 32, 32, 32);
|
||||
|
||||
Vector4f pos = new Vector4f(getX(), getY(), 0, 1);
|
||||
pos.mul(matrices.peek().getPositionMatrix());
|
||||
pos.transform(matrices.peek().getPositionMatrix());
|
||||
|
||||
if (spell.isEmpty()) {
|
||||
RenderSystem.setShaderColor(1, 1, 1, 0.3F);
|
||||
|
@ -52,7 +51,7 @@ public class EquippedSpellSlot extends Button {
|
|||
} else {
|
||||
RenderSystem.disableBlend();
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
drawItem((int)pos.x, (int)pos.y);
|
||||
drawItem((int)pos.getX(), (int)pos.getY());
|
||||
}
|
||||
if (isHovered()) {
|
||||
HandledScreen.drawSlotHighlight(matrices, getX(), getY(), 0);
|
||||
|
|
|
@ -4,8 +4,6 @@ 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,6 +20,7 @@ import net.minecraft.client.render.model.json.ModelTransformation;
|
|||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.screen.PlayerScreenHandler;
|
||||
import net.minecraft.util.math.Vector4f;
|
||||
|
||||
class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder {
|
||||
private final List<IngredientTree.Entry> entries = new ArrayList<>();
|
||||
|
@ -174,8 +173,8 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder {
|
|||
}
|
||||
|
||||
Vector4f pos = new Vector4f(x, y, 0, 1);
|
||||
pos.mul(matrices.peek().getPositionMatrix());
|
||||
drawItem((int)pos.x, (int)pos.y);
|
||||
pos.transform(matrices.peek().getPositionMatrix());
|
||||
drawItem((int)pos.getX(), (int)pos.getY());
|
||||
}
|
||||
|
||||
protected void drawItem(int x, int y) {
|
||||
|
@ -188,7 +187,7 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder {
|
|||
if (stacks[index].isEmpty()) {
|
||||
return List.of();
|
||||
}
|
||||
return stacks[index].getTooltip(MinecraftClient.getInstance().player, TooltipContext.Default.BASIC);
|
||||
return stacks[index].getTooltip(MinecraftClient.getInstance().player, TooltipContext.Default.NORMAL);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -295,7 +295,7 @@ public class SpellbookScreen extends HandledScreen<SpellbookScreenHandler> imple
|
|||
|
||||
@Override
|
||||
public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float tickDelta) {
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexProgram);
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
|
||||
RenderSystem.setShaderColor(1, 1, 1, alpha);
|
||||
RenderSystem.defaultBlendFunc();
|
||||
|
|
|
@ -19,7 +19,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.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
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(Registries.ITEM.getId(AmuletItem.getForEntity((LivingEntity)entity).getItem()), id -> new Identifier(id.getNamespace(), "textures/models/armor/" + id.getPath() + ".png"));
|
||||
return textures.computeIfAbsent(Registry.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.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
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(Registries.ITEM.getId(GlassesItem.getForEntity((LivingEntity)entity).getItem()), id -> new Identifier(id.getNamespace(), "textures/models/armor/" + id.getPath() + ".png"));
|
||||
return textures.computeIfAbsent(Registry.ITEM.getId(GlassesItem.getForEntity((LivingEntity)entity).getItem()), id -> new Identifier(id.getNamespace(), "textures/models/armor/" + id.getPath() + ".png"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -75,7 +75,7 @@ class WingsGear implements IGear {
|
|||
|
||||
@Override
|
||||
public void render(MatrixStack stack, VertexConsumer consumer, int light, int overlay, float red, float green, float blue, float alpha, UUID interpolatorId) {
|
||||
model.getWings().renderPart(stack, consumer, light, overlay, red, green, blue, alpha, interpolatorId);
|
||||
model.getWings().renderPart(stack, consumer, light, overlay, red, green, blue, alpha, model.getAttributes());
|
||||
}
|
||||
|
||||
static class Model extends PegasusModel<LivingEntity> {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
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;
|
||||
|
@ -10,6 +8,7 @@ import net.minecraft.client.render.VertexConsumer;
|
|||
import net.minecraft.client.render.VertexFormat;
|
||||
import net.minecraft.client.render.VertexFormats;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
|
||||
public abstract class AbstractGeometryBasedParticle extends Particle {
|
||||
|
||||
|
@ -24,23 +23,23 @@ public abstract class AbstractGeometryBasedParticle extends Particle {
|
|||
return ParticleTextureSheet.CUSTOM;
|
||||
}
|
||||
|
||||
protected final void renderQuad(Tessellator te, BufferBuilder buffer, Vector3f[] corners, float alpha, float tickDelta) {
|
||||
protected final void renderQuad(Tessellator te, BufferBuilder buffer, Vec3f[] corners, float alpha, float tickDelta) {
|
||||
int light = getBrightness(tickDelta);
|
||||
|
||||
buffer.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR_LIGHT);
|
||||
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();
|
||||
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();
|
||||
|
||||
te.draw();
|
||||
}
|
||||
|
||||
protected final void renderQuad(VertexConsumer buffer, Vector3f[] corners, float alpha, float tickDelta) {
|
||||
protected final void renderQuad(VertexConsumer buffer, Vec3f[] corners, float alpha, float tickDelta) {
|
||||
int light = getBrightness(tickDelta);
|
||||
|
||||
for (Vector3f corner : corners) {
|
||||
buffer.vertex(corner.x, corner.y, corner.z).color(red, green, blue, alpha).light(light).next();
|
||||
for (Vec3f corner : corners) {
|
||||
buffer.vertex(corner.getX(), corner.getY(), corner.getZ()).color(red, green, blue, alpha).light(light).next();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
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 {
|
||||
|
||||
|
@ -15,8 +14,8 @@ public class ChangelingMagicParticle extends MagicParticle {
|
|||
this.provider = provider;
|
||||
}
|
||||
|
||||
static Vector3f nextColor(float intensity) {
|
||||
return new Vector3f(intensity * 0.5F, intensity, intensity * 0.4F);
|
||||
static Vec3f nextColor(float intensity) {
|
||||
return new Vec3f(intensity * 0.5F, intensity, intensity * 0.4F);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.minelittlepony.unicopia.client.particle;
|
||||
|
||||
import org.joml.Quaternionf;
|
||||
|
||||
import com.minelittlepony.unicopia.client.render.model.SphereModel;
|
||||
import com.minelittlepony.unicopia.particle.SphereParticleEffect;
|
||||
|
||||
|
@ -12,13 +10,13 @@ import net.minecraft.util.math.*;
|
|||
|
||||
public class DiskParticle extends SphereParticle {
|
||||
|
||||
private final Quaternionf rotation = new Quaternionf(0, 0, 0, 1);
|
||||
private final Quaternion rotation = new Quaternion(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.mul(RotationAxis.POSITIVE_Y.rotationDegrees((float)effect.getOffset().y));
|
||||
rotation.mul(RotationAxis.POSITIVE_X.rotationDegrees(90 - (float)effect.getOffset().x));
|
||||
rotation.hamiltonProduct(Vec3f.POSITIVE_Y.getDegreesQuaternion((float)effect.getOffset().y));
|
||||
rotation.hamiltonProduct(Vec3f.POSITIVE_X.getDegreesQuaternion(90 - (float)effect.getOffset().x));
|
||||
|
||||
effect.setOffset(new Vec3d(0, 0.25, 0));
|
||||
}
|
||||
|
|
|
@ -3,8 +3,6 @@ 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;
|
||||
|
@ -18,10 +16,11 @@ 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<Vector3f>> branches = new ArrayList<>();
|
||||
private final List<List<Vec3f>> 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);
|
||||
|
@ -50,21 +49,21 @@ public class LightningBoltParticle extends AbstractGeometryBasedParticle {
|
|||
world.setLightningTicksLeft(2);
|
||||
}
|
||||
|
||||
private List<Vector3f> generateBranch() {
|
||||
Vector3f startPos = new Vector3f(0, 0, 0);
|
||||
private List<Vec3f> generateBranch() {
|
||||
Vec3f startPos = new Vec3f(0, 0, 0);
|
||||
|
||||
int intendedLength = 2 + world.random.nextInt(6);
|
||||
|
||||
List<Vector3f> nodes = new ArrayList<>();
|
||||
List<Vec3f> nodes = new ArrayList<>();
|
||||
|
||||
while (nodes.size() < intendedLength) {
|
||||
startPos = startPos.add(
|
||||
startPos.add(
|
||||
(float)world.random.nextTriangular(0.1F, 3),
|
||||
(float)world.random.nextTriangular(0.1F, 3),
|
||||
(float)world.random.nextTriangular(0.1F, 3)
|
||||
);
|
||||
|
||||
nodes.add(startPos);
|
||||
nodes.add(startPos.copy());
|
||||
}
|
||||
|
||||
return nodes;
|
||||
|
@ -83,11 +82,14 @@ 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());
|
||||
|
||||
Vector3f origin = new Vector3f(x, y, z);
|
||||
Vec3f origin = new Vec3f(x, y, z);
|
||||
|
||||
for (List<Vector3f> branch : branches) {
|
||||
for (List<Vec3f> branch : branches) {
|
||||
for (int i = 0; i < branch.size(); i++) {
|
||||
renderBranch(buffer, i == 0 ? origin : new Vector3f(branch.get(i - 1).add(x, y, z)), new Vector3f(branch.get(i).add(x, y, z)));
|
||||
renderBranch(
|
||||
buffer, i == 0 ? origin : new Vec3f(branch.get(i - 1).getX() + x, branch.get(i - 1).getY() + y, branch.get(i - 1).getZ() + z),
|
||||
new Vec3f(branch.get(i).getX() + x, branch.get(i).getY() + y, branch.get(i).getZ() + z)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,29 +98,29 @@ public class LightningBoltParticle extends AbstractGeometryBasedParticle {
|
|||
RenderSystem.enableCull();
|
||||
}
|
||||
|
||||
private void renderBranch(VertexConsumer buffer, Vector3f from, Vector3f to) {
|
||||
private void renderBranch(VertexConsumer buffer, Vec3f from, Vec3f to) {
|
||||
float thickness = world.random.nextFloat() / 30 + 0.01F;
|
||||
|
||||
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),
|
||||
renderQuad(buffer, new Vec3f[]{
|
||||
new Vec3f(from.getX() - thickness, from.getY(), from.getX()),
|
||||
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()),
|
||||
|
||||
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() - 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, 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(), 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 - 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)
|
||||
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)
|
||||
}, 0.3F, 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.minelittlepony.unicopia.client.particle;
|
||||
|
||||
import org.joml.Vector3f;
|
||||
|
||||
import com.minelittlepony.unicopia.particle.MagicParticleEffect;
|
||||
|
||||
import net.minecraft.client.particle.ParticleTextureSheet;
|
||||
|
@ -9,13 +7,14 @@ 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, Vector3f color, float alpha) {
|
||||
MagicParticle(ParticleEffect effect, SpriteProvider provider, ClientWorld w, double x, double y, double z, double vX, double vY, double vZ, Vec3f color, float alpha) {
|
||||
super(w, x, y, z);
|
||||
setSprite(provider);
|
||||
|
||||
|
@ -28,9 +27,9 @@ public class MagicParticle extends SpriteBillboardParticle {
|
|||
scale = random.nextFloat() * 0.12F;
|
||||
maxAge = (int)(Math.random() * 10) + 20;
|
||||
|
||||
red = color.x;
|
||||
green = color.y;
|
||||
blue = color.z;
|
||||
red = color.getX();
|
||||
green = color.getY();
|
||||
blue = color.getZ();
|
||||
this.alpha = alpha;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
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;
|
||||
|
@ -15,16 +12,15 @@ import net.minecraft.util.math.*;
|
|||
public abstract class OrientedBillboardParticle extends AbstractBillboardParticle {
|
||||
|
||||
protected boolean fixed;
|
||||
protected Quaternionf rotation = new Quaternionf(0, 0, 0, 1);
|
||||
protected Quaternion rotation = new Quaternion(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) {
|
||||
// Was hamiltonianProduct (CHECK THIS!!)
|
||||
rotation.mul(RotationAxis.POSITIVE_Y.rotationDegrees(effect.getPitch()));
|
||||
rotation.mul(RotationAxis.POSITIVE_X.rotationDegrees(180 - effect.getYaw()));
|
||||
rotation.hamiltonProduct(Vec3f.POSITIVE_Y.getDegreesQuaternion(effect.getPitch()));
|
||||
rotation.hamiltonProduct(Vec3f.POSITIVE_X.getDegreesQuaternion(180 - effect.getYaw()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,18 +34,18 @@ public abstract class OrientedBillboardParticle extends AbstractBillboardParticl
|
|||
|
||||
@Override
|
||||
protected void renderQuads(Tessellator te, BufferBuilder buffer, float x, float y, float z, float tickDelta) {
|
||||
Vector3f[] corners = new Vector3f[]{
|
||||
new Vector3f(-1, -1, 0),
|
||||
new Vector3f(-1, 1, 0),
|
||||
new Vector3f( 1, 1, 0),
|
||||
new Vector3f( 1, -1, 0)
|
||||
Vec3f[] corners = new Vec3f[]{
|
||||
new Vec3f(-1, -1, 0),
|
||||
new Vec3f(-1, 1, 0),
|
||||
new Vec3f( 1, 1, 0),
|
||||
new Vec3f( 1, -1, 0)
|
||||
};
|
||||
float scale = getScale(tickDelta);
|
||||
|
||||
for(int k = 0; k < 4; ++k) {
|
||||
Vector3f corner = corners[k];
|
||||
Vec3f corner = corners[k];
|
||||
corner.rotate(rotation);
|
||||
corner.mul(scale);
|
||||
corner.scale(scale);
|
||||
corner.add(x, y, z);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@ 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;
|
||||
|
@ -19,6 +17,7 @@ import net.minecraft.client.world.ClientWorld;
|
|||
import net.minecraft.particle.DefaultParticleType;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
|
||||
public class RainbowTrailParticle extends AbstractBillboardParticle implements Attachment {
|
||||
private static final Identifier TEXTURE = Unicopia.id("textures/particles/rainboom_trail.png");
|
||||
|
@ -67,12 +66,12 @@ public class RainbowTrailParticle extends AbstractBillboardParticle implements A
|
|||
float alpha = 1 - (float)age / maxAge;
|
||||
|
||||
for (int i = 0; i < segments.size() - 1; i++) {
|
||||
Vector3f[] corners = segments.get(i).getPlane(segments.get(i + 1));
|
||||
Vec3f[] corners = segments.get(i).getPlane(segments.get(i + 1));
|
||||
float scale = getScale(tickDelta);
|
||||
|
||||
for (int k = 0; k < 4; ++k) {
|
||||
Vector3f corner = corners[k];
|
||||
corner.mul(scale);
|
||||
Vec3f corner = corners[k];
|
||||
corner.scale(scale);
|
||||
corner.add(x, y, z);
|
||||
}
|
||||
|
||||
|
@ -114,14 +113,14 @@ public class RainbowTrailParticle extends AbstractBillboardParticle implements A
|
|||
|
||||
private final class Segment {
|
||||
Vec3d position;
|
||||
Vector3f offset;
|
||||
Vec3f offset;
|
||||
|
||||
int age;
|
||||
int maxAge;
|
||||
|
||||
Segment(Vec3d position) {
|
||||
this.position = position;
|
||||
this.offset = new Vector3f((float)(position.getX() - x), (float)(position.getY() - y), (float)(position.getZ() - z));
|
||||
this.offset = new Vec3f((float)(position.getX() - x), (float)(position.getY() - y), (float)(position.getZ() - z));
|
||||
this.maxAge = 90;
|
||||
}
|
||||
|
||||
|
@ -133,23 +132,23 @@ public class RainbowTrailParticle extends AbstractBillboardParticle implements A
|
|||
return segments.indexOf(this) < segments.size() - 1 && age++ >= maxAge;
|
||||
}
|
||||
|
||||
Vector3f[] getPlane(Segment to) {
|
||||
float fromX = offset.x;
|
||||
float toX = to.offset.x;
|
||||
Vec3f[] getPlane(Segment to) {
|
||||
float fromX = offset.getX();
|
||||
float toX = to.offset.getX();
|
||||
|
||||
float fromZ = offset.z;
|
||||
float toZ = to.offset.z;
|
||||
float fromTopY = offset.y + 1;
|
||||
float fromBottomY = offset.y;
|
||||
float fromZ = offset.getZ();
|
||||
float toZ = to.offset.getZ();
|
||||
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 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
|
||||
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
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,6 @@ 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;
|
||||
|
@ -89,11 +86,11 @@ public class RunesParticle extends OrientedBillboardParticle implements Attachme
|
|||
targetSize = value.floatValue();
|
||||
}
|
||||
if (key == ATTR_PITCH) {
|
||||
rotation = new Quaternionf(0, 0, 0, 1);
|
||||
rotation.mul(RotationAxis.POSITIVE_Y.rotationDegrees(value.floatValue()));
|
||||
rotation = new Quaternion(0, 0, 0, 1);
|
||||
rotation.hamiltonProduct(Vec3f.POSITIVE_Y.getDegreesQuaternion(value.floatValue()));
|
||||
}
|
||||
if (key == ATTR_YAW) {
|
||||
rotation.mul(RotationAxis.POSITIVE_X.rotationDegrees(180 - value.floatValue()));
|
||||
rotation.hamiltonProduct(Vec3f.POSITIVE_X.getDegreesQuaternion(180 - value.floatValue()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,27 +126,27 @@ public class RunesParticle extends OrientedBillboardParticle implements Attachme
|
|||
RenderSystem.setShaderTexture(0, TEXTURES[i]);
|
||||
RenderSystem.setShaderColor(red, green, blue, alpha / ((float)(dim * 3) + 1));
|
||||
|
||||
Vector3f[] corners = new Vector3f[]{
|
||||
new Vector3f(-1, -1, 0),
|
||||
new Vector3f(-1, 1, 0),
|
||||
new Vector3f( 1, 1, 0),
|
||||
new Vector3f( 1, -1, 0)
|
||||
Vec3f[] corners = new Vec3f[]{
|
||||
new Vec3f(-1, -1, 0),
|
||||
new Vec3f(-1, 1, 0),
|
||||
new Vec3f( 1, 1, 0),
|
||||
new Vec3f( 1, -1, 0)
|
||||
};
|
||||
float scale = getScale(tickDelta);
|
||||
|
||||
float ringSpeed = (i % 2 == 0 ? i : -1) * i;
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
for(int k = 0; k < 4; ++k) {
|
||||
Vector3f corner = corners[k];
|
||||
Vec3f corner = corners[k];
|
||||
corner.rotate(ringAngle);
|
||||
corner.rotate(ringFlip);
|
||||
corner.rotate(ringRoll);
|
||||
corner.rotate(rotation);
|
||||
corner.mul(scale);
|
||||
corner.scale(scale);
|
||||
corner.add(x, y + 0.001F, z);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,9 +50,9 @@ public class SphereParticle extends Particle implements Attachment {
|
|||
super(w, x, y, z);
|
||||
this.parameters = parameters;
|
||||
this.radius = parameters.getRadius();
|
||||
this.red = parameters.getColor().x / 255F;
|
||||
this.green = parameters.getColor().y / 255F;
|
||||
this.blue = parameters.getColor().z / 255F;
|
||||
this.red = parameters.getColor().getX() / 255F;
|
||||
this.green = parameters.getColor().getY() / 255F;
|
||||
this.blue = parameters.getColor().getZ() / 255F;
|
||||
this.alpha = parameters.getAlpha();
|
||||
|
||||
setMaxAge(10);
|
||||
|
@ -158,7 +158,7 @@ public class SphereParticle extends Particle implements Attachment {
|
|||
RenderSystem.enableCull();
|
||||
RenderSystem.depthMask(true);
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
RenderSystem.setShader(GameRenderer::getParticleProgram);
|
||||
RenderSystem.setShader(GameRenderer::getParticleShader);
|
||||
}
|
||||
|
||||
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.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
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(Registries.ITEM.getId(stack.getItem()), id -> new Identifier(id.getNamespace(), "textures/models/armor/" + id.getPath() + ".png"));
|
||||
Identifier texture = textures.computeIfAbsent(Registry.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.RotationAxis;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
|
||||
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.y;
|
||||
final float modelScaleY = model.getTransformation().getTransformation(ModelTransformation.Mode.GROUND).scale.getY();
|
||||
|
||||
float scale = 1.6F;
|
||||
|
||||
transforms.push();
|
||||
transforms.scale(scale, scale, scale);
|
||||
transforms.translate(0, verticalOffset + variance * modelScaleY, 0);
|
||||
transforms.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(entity.getRotation(timeDelta)));
|
||||
transforms.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(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.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
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(Registries.ITEM.getId(stack.getItem()), id -> new Identifier(id.getNamespace(), "textures/models/armor/" + id.getPath() + ".png"));
|
||||
Identifier texture = textures.computeIfAbsent(Registry.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);
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ public class HeldEntityFeatureRenderer<E extends LivingEntity> implements Access
|
|||
float leanAmount = ((LivingEntityDuck)entity).getLeaningPitch();
|
||||
|
||||
matrices.push();
|
||||
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(180 - leanAmount * 90));
|
||||
matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(180 - leanAmount * 90));
|
||||
|
||||
Vec3d carryPosition = getCarryPosition(Living.living(entity), passenger)
|
||||
.rotateX(-leanAmount * MathHelper.PI / 4F)
|
||||
|
@ -37,7 +37,7 @@ public class HeldEntityFeatureRenderer<E extends LivingEntity> implements Access
|
|||
|
||||
matrices.translate(carryPosition.x, carryPosition.y, carryPosition.z);
|
||||
if (!(passenger instanceof Pony)) {
|
||||
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(90));
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(90));
|
||||
}
|
||||
|
||||
renderCarriedEntity(passenger.asEntity(), matrices, vertexConsumers, light, tickDelta);
|
||||
|
@ -60,9 +60,9 @@ public class HeldEntityFeatureRenderer<E extends LivingEntity> implements Access
|
|||
matrices.push();
|
||||
matrices.translate(f, g, h);
|
||||
matrices.translate(0, -1.3F, -1.3F);
|
||||
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(13));
|
||||
matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(13));
|
||||
if (!(passenger instanceof Pony)) {
|
||||
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(90));
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(90));
|
||||
}
|
||||
|
||||
renderCarriedEntity(passenger.asEntity(), matrices, vertexConsumers, light, tickDelta);
|
||||
|
|
|
@ -215,7 +215,7 @@ public class PlayerPoser {
|
|||
|
||||
private void rearUp(MatrixStack matrices, BipedEntityModel<?> model, float progress) {
|
||||
matrices.translate(0, 0, 0.5);
|
||||
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(-45 * progress));
|
||||
matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(-45 * progress));
|
||||
matrices.translate(0, 0, -0.5);
|
||||
|
||||
float roll = progress / 2F;
|
||||
|
|
|
@ -6,7 +6,7 @@ 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.UnclampedModelPredicateProvider;
|
||||
import net.minecraft.client.item.ModelPredicateProviderRegistry;
|
||||
import net.minecraft.client.model.*;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
|
@ -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.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
public class PolearmRenderer implements DynamicItemRenderer, ClampedModelPredicateProvider {
|
||||
public class PolearmRenderer implements DynamicItemRenderer, UnclampedModelPredicateProvider {
|
||||
|
||||
private static final PolearmRenderer INSTANCE = new PolearmRenderer();
|
||||
private static final Identifier THROWING = new Identifier("throwing");
|
||||
|
@ -36,7 +36,7 @@ public class PolearmRenderer implements DynamicItemRenderer, ClampedModelPredica
|
|||
}
|
||||
|
||||
static ModelIdentifier getModelId(ItemConvertible item) {
|
||||
Identifier id = Registries.ITEM.getId(item.asItem());
|
||||
Identifier id = Registry.ITEM.getId(item.asItem());
|
||||
return new ModelIdentifier(new Identifier(id.getNamespace(), id.getPath() + "_in_inventory"), "inventory");
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ public class PolearmRenderer implements DynamicItemRenderer, ClampedModelPredica
|
|||
} else {
|
||||
matrices.push();
|
||||
matrices.scale(1, -1, -1);
|
||||
Identifier id = Registries.ITEM.getId(stack.getItem());
|
||||
Identifier id = Registry.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()
|
||||
.program(COLOR_PROGRAM)
|
||||
.shader(COLOR_SHADER)
|
||||
.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()
|
||||
.program(COLOR_PROGRAM)
|
||||
.shader(COLOR_SHADER)
|
||||
.transparency(TRANSLUCENT_TRANSPARENCY)
|
||||
// .target(TRANSLUCENT_TARGET)
|
||||
.texturing(solid(Color.r(color), Color.g(color), Color.b(color), 0.6F))
|
||||
|
|
|
@ -120,8 +120,8 @@ public class WorldRenderDelegate {
|
|||
|
||||
matrices.translate(x, y + owner.getHeight() / 2, z);
|
||||
|
||||
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(roll));
|
||||
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(roll));
|
||||
matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(roll));
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(roll));
|
||||
|
||||
if (pony instanceof Pony) {
|
||||
roll = ((Pony)pony).getCamera().calculateRoll();
|
||||
|
@ -129,9 +129,9 @@ public class WorldRenderDelegate {
|
|||
roll -= 180;
|
||||
}
|
||||
|
||||
matrices.multiply(RotationAxis.NEGATIVE_Y.rotationDegrees(yaw));
|
||||
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(roll));
|
||||
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(yaw));
|
||||
matrices.multiply(Vec3f.NEGATIVE_Y.getDegreesQuaternion(yaw));
|
||||
matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(roll));
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(yaw));
|
||||
}
|
||||
|
||||
matrices.translate(-x, -y - owner.getHeight() / 2, -z);
|
||||
|
@ -206,7 +206,7 @@ public class WorldRenderDelegate {
|
|||
matrices.translate(x, y, z);
|
||||
|
||||
matrices.multiply(direction.getRotationQuaternion());
|
||||
matrices.multiply(RotationAxis.NEGATIVE_X.rotationDegrees(90));
|
||||
matrices.multiply(Vec3f.NEGATIVE_X.getDegreesQuaternion(90));
|
||||
|
||||
matrices.translate(-0.5, 0, -0.5);
|
||||
|
||||
|
|
|
@ -36,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(RotationAxis.NEGATIVE_Z.rotationDegrees(60));
|
||||
matrices.multiply(Vec3f.NEGATIVE_Z.getDegreesQuaternion(60));
|
||||
} else {
|
||||
matrices.translate(-1.5F, 0.1F, 0.2F);
|
||||
matrices.multiply(RotationAxis.NEGATIVE_Z.rotationDegrees(90));
|
||||
matrices.multiply(RotationAxis.NEGATIVE_Y.rotationDegrees(90));
|
||||
matrices.multiply(Vec3f.NEGATIVE_Z.getDegreesQuaternion(90));
|
||||
matrices.multiply(Vec3f.NEGATIVE_Y.getDegreesQuaternion(90));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,11 +3,10 @@ package com.minelittlepony.unicopia.client.render.model;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.joml.Matrix4f;
|
||||
import org.joml.Vector4f;
|
||||
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.Matrix4f;
|
||||
import net.minecraft.util.math.Vector4f;
|
||||
|
||||
public class BakedModel {
|
||||
private static final Vector4f drawVert = new Vector4f();
|
||||
|
@ -15,7 +14,7 @@ public class BakedModel {
|
|||
protected final List<Vertex> vertices = new ArrayList<>();
|
||||
|
||||
protected void addVertex(Vector4f vertex) {
|
||||
addVertex(vertex.x, vertex.y, vertex.z, 0, 0);
|
||||
addVertex(vertex.getX(), vertex.getY(), vertex.getZ(), 0, 0);
|
||||
}
|
||||
|
||||
protected void addVertex(float x, float y, float z, float u, float v) {
|
||||
|
@ -31,8 +30,8 @@ public class BakedModel {
|
|||
Matrix4f model = matrices.peek().getPositionMatrix();
|
||||
for (Vertex vertex : vertices) {
|
||||
drawVert.set(vertex.x() * scale, vertex.y() * scale, vertex.z() * scale, 1);
|
||||
drawVert.mul(model);
|
||||
vertexWriter.vertex(drawVert.x, drawVert.y, drawVert.z, r, g, b, a, vertex.u(), vertex.v(), overlay, light, 0, 0, 0);
|
||||
drawVert.transform(model);
|
||||
vertexWriter.vertex(drawVert.getX(), drawVert.getY(), drawVert.getZ(), r, g, b, a, vertex.u(), vertex.v(), overlay, light, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,11 +2,10 @@ package com.minelittlepony.unicopia.client.render.model;
|
|||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.joml.Vector4f;
|
||||
|
||||
import com.minelittlepony.unicopia.client.gui.DrawableUtil;
|
||||
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vector4f;
|
||||
|
||||
public class SphereModel extends BakedModel {
|
||||
public static final SphereModel SPHERE = new SphereModel(40, 40, DrawableUtil.TAU);
|
||||
|
|
|
@ -94,10 +94,10 @@ public class ViewportShader implements SynchronousResourceReloader, Identifiable
|
|||
}
|
||||
}
|
||||
|
||||
static class LoadedShader extends PostEffectProcessor {
|
||||
static class LoadedShader extends ShaderEffect {
|
||||
private final Object2FloatMap<String> uniformValues = new Object2FloatOpenHashMap<>();
|
||||
|
||||
private Multimap<String, JsonEffectShaderProgram> programs;
|
||||
private Multimap<String, JsonEffectGlShader> programs;
|
||||
|
||||
private final Identifier id;
|
||||
|
||||
|
@ -111,8 +111,8 @@ public class ViewportShader implements SynchronousResourceReloader, Identifiable
|
|||
}
|
||||
|
||||
@Override
|
||||
public PostEffectPass addPass(String programName, Framebuffer source, Framebuffer dest) throws IOException {
|
||||
PostEffectPass pass = super.addPass(programName, source, dest);
|
||||
public PostProcessShader addPass(String programName, Framebuffer source, Framebuffer dest) throws IOException {
|
||||
PostProcessShader pass = super.addPass(programName, source, dest);
|
||||
if (programs == null) {
|
||||
programs = LinkedListMultimap.create();
|
||||
}
|
||||
|
|
|
@ -22,8 +22,7 @@ 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.util.Identifier;
|
||||
import net.minecraft.server.command.CommandManager;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
|
@ -49,13 +48,13 @@ public class DisguiseCommand {
|
|||
}
|
||||
|
||||
private static ArgumentBuilder<ServerCommandSource, ?> buildEntityDisguise(Arg<ServerPlayerEntity> targetOp, CommandRegistryAccess registries) {
|
||||
return CommandManager.argument("entity", RegistryEntryArgumentType.registryEntry(registries, RegistryKeys.ENTITY_TYPE))
|
||||
return CommandManager.argument("entity", EntitySummonArgumentType.entitySummon())
|
||||
.suggests(SuggestionProviders.SUMMONABLE_ENTITIES)
|
||||
.executes(context -> disguise(
|
||||
context.getSource(),
|
||||
targetOp.apply(context),
|
||||
loadEntity(context.getSource(),
|
||||
RegistryEntryArgumentType.getSummonableEntityType(context, "entity"),
|
||||
EntitySummonArgumentType.getEntitySummon(context, "entity"),
|
||||
new NbtCompound())))
|
||||
.then(
|
||||
CommandManager.argument("nbt", NbtCompoundArgumentType.nbtCompound())
|
||||
|
@ -63,7 +62,7 @@ public class DisguiseCommand {
|
|||
context.getSource(),
|
||||
targetOp.apply(context),
|
||||
loadEntity(context.getSource(),
|
||||
RegistryEntryArgumentType.getSummonableEntityType(context, "entity"),
|
||||
EntitySummonArgumentType.getEntitySummon(context, "entity"),
|
||||
NbtCompoundArgumentType.getNbtCompound(context, "nbt"))))
|
||||
);
|
||||
}
|
||||
|
@ -99,9 +98,9 @@ public class DisguiseCommand {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static Entity loadEntity(ServerCommandSource source, RegistryEntry.Reference<EntityType<?>> entityType, NbtCompound nbt) {
|
||||
static Entity loadEntity(ServerCommandSource source, Identifier entityType, NbtCompound nbt) {
|
||||
nbt = nbt.copy();
|
||||
nbt.putString("id", entityType.registryKey().getValue().toString());
|
||||
nbt.putString("id", entityType.toString());
|
||||
return EntityType.loadEntityWithPassengers(nbt, source.getWorld(), Function.identity());
|
||||
}
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ public class SpellbookScreenHandler extends ScreenHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack quickMove(PlayerEntity player, int index) {
|
||||
public ItemStack transferSlot(PlayerEntity player, int index) {
|
||||
Slot sourceSlot = slots.get(index);
|
||||
|
||||
if (sourceSlot == null || !sourceSlot.hasStack()) {
|
||||
|
@ -304,5 +304,4 @@ public class SpellbookScreenHandler extends ScreenHandler {
|
|||
dropInventory(playerEntity, input);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,14 +5,13 @@ 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.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
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(Registries.SCREEN_HANDLER, Unicopia.id(name), type);
|
||||
return Registry.register(Registry.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.registry.tag.BlockTags;
|
||||
import net.minecraft.tag.BlockTags;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
|
|
@ -131,7 +131,7 @@ public class Creature extends Living<LivingEntity> implements WeaklyOwned.Mutabl
|
|||
.isEmpty();
|
||||
});
|
||||
|
||||
targets.clear(g -> true);
|
||||
targets.clear();
|
||||
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.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
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 = Registries.ENCHANTMENT.getId(enchant);
|
||||
Identifier id = Registry.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 -> {
|
||||
Registries.ENCHANTMENT.getOrEmpty(new Identifier(tag.asString())).ifPresent(equippedEnchantments::add);
|
||||
Registry.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.registry.tag.BlockTags;
|
||||
import net.minecraft.tag.BlockTags;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
|
|
@ -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.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
public class ItemTracker implements NbtSerialisable, Copyable<ItemTracker>, Tickable, TrinketsDelegate.Inventory {
|
||||
public static final long TICKS = 1;
|
||||
|
@ -108,7 +108,7 @@ public class ItemTracker implements NbtSerialisable, Copyable<ItemTracker>, Tick
|
|||
@Override
|
||||
public void toNBT(NbtCompound compound) {
|
||||
items.forEach((charm, count) -> {
|
||||
compound.putLong(Registries.ITEM.getId(charm.asItem()).toString(), count);
|
||||
compound.putLong(Registry.ITEM.getId(charm.asItem()).toString(), count);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ public class ItemTracker implements NbtSerialisable, Copyable<ItemTracker>, Tick
|
|||
items.clear();
|
||||
compound.getKeys().stream().map(Identifier::tryParse)
|
||||
.filter(Objects::nonNull)
|
||||
.map(id -> Map.entry(Registries.ITEM.get(id), compound.getLong(id.toString())))
|
||||
.map(id -> Map.entry(Registry.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.value() : SoundEvents.BLOCK_STONE_HIT;
|
||||
return isBouncy() ? SoundEvents.BLOCK_NOTE_BLOCK_BANJO : SoundEvents.BLOCK_STONE_HIT;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,8 +17,9 @@ 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.registry.*;
|
||||
import net.minecraft.registry.tag.BiomeTags;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.tag.BiomeTags;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
public interface UEntities {
|
||||
|
@ -54,7 +55,7 @@ public interface UEntities {
|
|||
|
||||
static <T extends Entity> EntityType<T> register(String name, FabricEntityTypeBuilder<T> builder) {
|
||||
EntityType<T> type = builder.build();
|
||||
return Registry.register(Registries.ENTITY_TYPE, Unicopia.id(name), type);
|
||||
return Registry.register(Registry.ENTITY_TYPE, Unicopia.id(name), type);
|
||||
}
|
||||
|
||||
static void bootstrap() {
|
||||
|
@ -86,7 +87,7 @@ public interface UEntities {
|
|||
|
||||
interface Paintings {
|
||||
private static void register(String id, int width, int height) {
|
||||
Registry.register(Registries.PAINTING_VARIANT, RegistryKey.of(RegistryKeys.PAINTING_VARIANT, Unicopia.id(id)), new PaintingVariant(16 * width, 16 * height));
|
||||
Registry.register(Registry.PAINTING_VARIANT, RegistryKey.of(Registry.PAINTING_VARIANT_KEY, Unicopia.id(id)), new PaintingVariant(16 * width, 16 * height));
|
||||
}
|
||||
|
||||
static void bootstrap() {
|
||||
|
|
|
@ -8,8 +8,7 @@ import com.minelittlepony.unicopia.Unicopia;
|
|||
|
||||
import net.minecraft.entity.attribute.ClampedEntityAttribute;
|
||||
import net.minecraft.entity.attribute.EntityAttribute;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
public interface UEntityAttributes {
|
||||
List<EntityAttribute> REGISTRY = new ArrayList<>();
|
||||
|
@ -21,7 +20,7 @@ public interface UEntityAttributes {
|
|||
|
||||
private static EntityAttribute register(String name, EntityAttribute attribute) {
|
||||
REGISTRY.add(attribute);
|
||||
return Registry.register(Registries.ATTRIBUTE, Unicopia.id(name), attribute);
|
||||
return Registry.register(Registry.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.registry.tag.ItemTags;
|
||||
import net.minecraft.registry.tag.TagKey;
|
||||
import net.minecraft.tag.ItemTags;
|
||||
import net.minecraft.tag.TagKey;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
import net.minecraft.village.TradeOffer;
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
package com.minelittlepony.unicopia.entity.behaviour;
|
||||
|
||||
import org.joml.Vector3f;
|
||||
|
||||
import com.minelittlepony.unicopia.entity.Living;
|
||||
|
||||
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;
|
||||
|
@ -13,11 +12,11 @@ public class AxolotlBehaviour extends EntityBehaviour<AxolotlEntity> {
|
|||
if (entity.getModelAngles().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Vector3f current = entity.getModelAngles().get("body");
|
||||
entity.getModelAngles().put("body", new Vector3f(
|
||||
Vec3f current = entity.getModelAngles().get("body");
|
||||
entity.getModelAngles().put("body", new Vec3f(
|
||||
source.asEntity().isSubmergedInWater() ? source.asEntity().getPitch() * toRad : 0,
|
||||
0,
|
||||
current == null ? 0 : current.z
|
||||
current == null ? 0 : current.getZ()
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ public interface Disguise extends FlightType.Provider, PlayerDimensions.Provider
|
|||
}
|
||||
|
||||
public static abstract class PlayerAccess extends PlayerEntity {
|
||||
public PlayerAccess() { super(null, null, 0, null); }
|
||||
public PlayerAccess() { super(null, null, 0, null, null); }
|
||||
public static TrackedData<Byte> getModelBitFlag() {
|
||||
return PLAYER_MODEL_PARTS;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,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.registry.Registry;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
public class EntityBehaviour<T extends Entity> {
|
||||
|
||||
|
|
|
@ -24,7 +24,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.registry.tag.BlockTags;
|
||||
import net.minecraft.tag.BlockTags;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
|
|
@ -39,7 +39,7 @@ public class ButterfingersStatusEffect extends StatusEffect {
|
|||
|
||||
if (target instanceof ServerPlayerEntity player) {
|
||||
if (player.dropSelectedItem(proximity < 1)) {
|
||||
player.world.playSound(null, player.getBlockPos(), SoundEvents.BLOCK_HONEY_BLOCK_SLIDE, player.getSoundCategory());
|
||||
player.world.playSound(null, player.getBlockPos(), SoundEvents.BLOCK_HONEY_BLOCK_SLIDE, player.getSoundCategory(), 1, 1);
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
player.networkHandler.sendPacket(new ScreenHandlerSlotUpdateS2CPacket(-2, 0, inventory.selectedSlot, inventory.getStack(inventory.selectedSlot)));
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ public class ButterfingersStatusEffect extends StatusEffect {
|
|||
if (!stack.isEmpty()) {
|
||||
target.setStackInHand(Hand.MAIN_HAND, ItemStack.EMPTY);
|
||||
target.dropStack(stack);
|
||||
target.world.playSound(null, target.getBlockPos(), SoundEvents.BLOCK_HONEY_BLOCK_SLIDE, target.getSoundCategory());
|
||||
target.world.playSound(null, target.getBlockPos(), SoundEvents.BLOCK_HONEY_BLOCK_SLIDE, target.getSoundCategory(), 1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,8 +17,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
public class RaceChangeStatusEffect extends StatusEffect {
|
||||
public static final int STAGE_DURATION = 200;
|
||||
|
@ -34,7 +33,7 @@ public class RaceChangeStatusEffect extends StatusEffect {
|
|||
|
||||
public static StatusEffect register(int color, Race race) {
|
||||
Identifier id = Race.REGISTRY.getId(race);
|
||||
return Registry.register(Registries.STATUS_EFFECT,
|
||||
return Registry.register(Registry.STATUS_EFFECT,
|
||||
new Identifier(id.getNamespace(), "change_race_" + id.getPath().toLowerCase()),
|
||||
new RaceChangeStatusEffect(color, race)
|
||||
);
|
||||
|
|
|
@ -4,8 +4,7 @@ import com.minelittlepony.unicopia.Unicopia;
|
|||
|
||||
import net.minecraft.entity.effect.StatusEffect;
|
||||
import net.minecraft.entity.effect.StatusEffectCategory;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
public interface UEffects {
|
||||
StatusEffect FOOD_POISONING = register("food_poisoning", new FoodPoisoningStatusEffect(3484199));
|
||||
|
@ -15,7 +14,7 @@ public interface UEffects {
|
|||
StatusEffect BUTTER_FINGERS = register("butter_fingers", new ButterfingersStatusEffect(0x888800));
|
||||
|
||||
private static StatusEffect register(String name, StatusEffect effect) {
|
||||
return Registry.register(Registries.STATUS_EFFECT, Unicopia.id(name), effect);
|
||||
return Registry.register(Registry.STATUS_EFFECT, Unicopia.id(name), effect);
|
||||
}
|
||||
|
||||
static void bootstrap() {}
|
||||
|
|
|
@ -4,8 +4,7 @@ import com.minelittlepony.unicopia.Unicopia;
|
|||
|
||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
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)));
|
||||
|
@ -15,7 +14,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(Registries.POTION, Unicopia.id(name), potion);
|
||||
return Registry.register(Registry.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.asEntity().playSound(SoundEvents.UI_BUTTON_CLICK.value(), 0.25F, 1.75F);
|
||||
pony.asEntity().playSound(SoundEvents.UI_BUTTON_CLICK, 0.25F, 1.75F);
|
||||
pony.setDirty();
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ 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.world.GameMode;
|
||||
|
||||
public class DummyClientPlayerEntity extends AbstractClientPlayerEntity implements Owned<PlayerEntity>, Owned.Mutable<PlayerEntity> {
|
||||
|
@ -23,7 +24,7 @@ public class DummyClientPlayerEntity extends AbstractClientPlayerEntity implemen
|
|||
private PlayerEntity owner;
|
||||
|
||||
public DummyClientPlayerEntity(ClientWorld world, GameProfile profile) {
|
||||
super(world, profile);
|
||||
super(world, profile, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -45,7 +46,7 @@ public class DummyClientPlayerEntity extends AbstractClientPlayerEntity implemen
|
|||
playerInfo = connection.getPlayerListEntry(getGameProfile().getId());
|
||||
|
||||
if (playerInfo == null) {
|
||||
playerInfo = new PlayerListEntry(getGameProfile(), false);
|
||||
playerInfo = new PlayerListEntry(new PlayerListS2CPacket.Entry(getGameProfile(), 0, null, null, null), null, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
super(world, BlockPos.ORIGIN, 0, profile, null);
|
||||
}
|
||||
|
||||
@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.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
public interface ChameleonItem {
|
||||
|
||||
|
@ -36,7 +36,7 @@ public interface ChameleonItem {
|
|||
|
||||
default Item getAppearance(ItemStack stack) {
|
||||
if (stack.hasNbt() && stack.getNbt().contains("appearance")) {
|
||||
return Registries.ITEM.get(new Identifier(stack.getNbt().getString("appearance")));
|
||||
return Registry.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", Registries.ITEM.getId(appearance.getItem()).toString());
|
||||
result.getOrCreateNbt().putString("appearance", Registry.ITEM.getId(appearance.getItem()).toString());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -74,7 +74,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, blockPos, SpawnReason.SPAWN_EGG, false, true);
|
||||
FloatingArtefactEntity entity = UEntities.FLOATING_ARTEFACT.create(serverWorld, context.getStack().getNbt(), null, null, blockPos, SpawnReason.SPAWN_EGG, false, true);
|
||||
|
||||
if (entity == null) {
|
||||
return ActionResult.FAIL;
|
||||
|
|
|
@ -4,14 +4,13 @@ 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, CraftingRecipeCategory category) {
|
||||
super(id, category);
|
||||
public GlowingRecipe(Identifier id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,15 +3,14 @@ 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, CraftingRecipeCategory category) {
|
||||
super(id, category);
|
||||
public ItemCombinationRecipe(Identifier id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,14 +3,13 @@ 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, CraftingRecipeCategory category) {
|
||||
super(id, category);
|
||||
public JarInsertRecipe(Identifier id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,7 +7,6 @@ import com.minelittlepony.unicopia.*;
|
|||
import com.minelittlepony.unicopia.block.UBlocks;
|
||||
import com.minelittlepony.unicopia.entity.UEntities;
|
||||
import com.minelittlepony.unicopia.item.enchantment.UEnchantments;
|
||||
import com.minelittlepony.unicopia.item.group.ItemGroupRegistry;
|
||||
import com.minelittlepony.unicopia.item.group.UItemGroups;
|
||||
import com.minelittlepony.unicopia.item.toxin.UFoodComponents;
|
||||
|
||||
|
@ -19,22 +18,21 @@ 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.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
public interface UItems {
|
||||
|
||||
List<Item> ITEMS = new ArrayList<>();
|
||||
|
||||
Item GREEN_APPLE = register("green_apple", AppleItem.registerTickCallback(new Item(new Item.Settings().food(FoodComponents.APPLE))), ItemGroups.FOOD_AND_DRINK);
|
||||
Item SWEET_APPLE = register("sweet_apple", AppleItem.registerTickCallback(new Item(new Item.Settings().food(FoodComponents.APPLE))), ItemGroups.FOOD_AND_DRINK);
|
||||
Item SOUR_APPLE = register("sour_apple", AppleItem.registerTickCallback(new Item(new Item.Settings().food(FoodComponents.APPLE))), ItemGroups.FOOD_AND_DRINK);
|
||||
Item GREEN_APPLE = register("green_apple", AppleItem.registerTickCallback(new Item(new Item.Settings().food(FoodComponents.APPLE).group(ItemGroup.FOOD))));
|
||||
Item SWEET_APPLE = register("sweet_apple", AppleItem.registerTickCallback(new Item(new Item.Settings().food(FoodComponents.APPLE).group(ItemGroup.FOOD))));
|
||||
Item SOUR_APPLE = register("sour_apple", AppleItem.registerTickCallback(new Item(new Item.Settings().food(FoodComponents.APPLE).group(ItemGroup.FOOD))));
|
||||
|
||||
ZapAppleItem ZAP_APPLE = register("zap_apple", AppleItem.registerTickCallback(new ZapAppleItem(new Item.Settings().food(UFoodComponents.ZAP_APPLE))), ItemGroups.FOOD_AND_DRINK);
|
||||
Item ZAP_BULB = register("zap_bulb", new Item(new Item.Settings().food(UFoodComponents.ZAP_BULB)), ItemGroups.FOOD_AND_DRINK);
|
||||
ZapAppleItem ZAP_APPLE = register("zap_apple", AppleItem.registerTickCallback(new ZapAppleItem(new Item.Settings().food(UFoodComponents.ZAP_APPLE).group(ItemGroup.FOOD))));
|
||||
Item ZAP_BULB = register("zap_bulb", new Item(new Item.Settings().food(UFoodComponents.ZAP_BULB).group(ItemGroup.FOOD)));
|
||||
|
||||
Item ROTTEN_APPLE = register("rotten_apple", new RottenAppleItem(new Item.Settings().food(FoodComponents.APPLE)), ItemGroups.FOOD_AND_DRINK);
|
||||
Item COOKED_ZAP_APPLE = register("cooked_zap_apple", new Item(new Item.Settings().food(FoodComponents.APPLE)), ItemGroups.FOOD_AND_DRINK);
|
||||
Item ROTTEN_APPLE = register("rotten_apple", new RottenAppleItem(new Item.Settings().food(FoodComponents.APPLE).group(ItemGroup.FOOD)));
|
||||
Item COOKED_ZAP_APPLE = register("cooked_zap_apple", new Item(new Item.Settings().food(FoodComponents.APPLE).group(ItemGroup.FOOD)));
|
||||
|
||||
Item MUSIC_DISC_CRUSADE = register("music_disc_crusade", USounds.RECORD_CRUSADE, 181);
|
||||
Item MUSIC_DISC_PET = register("music_disc_pet", USounds.RECORD_PET, 221);
|
||||
|
@ -44,91 +42,88 @@ public interface UItems {
|
|||
FriendshipBraceletItem FRIENDSHIP_BRACELET = register("friendship_bracelet", new FriendshipBraceletItem(
|
||||
new FabricItemSettings()
|
||||
.rarity(Rarity.UNCOMMON)
|
||||
), ItemGroups.TOOLS);
|
||||
.group(ItemGroup.TOOLS)
|
||||
));
|
||||
|
||||
Item EMPTY_JAR = register("empty_jar", new JarItem(new Item.Settings().maxCount(16).fireproof(), false, false, false), ItemGroups.FUNCTIONAL);
|
||||
Item EMPTY_JAR = register("empty_jar", new JarItem(new Item.Settings().maxCount(16).fireproof().group(ItemGroup.DECORATIONS), false, false, false));
|
||||
FilledJarItem FILLED_JAR = register("filled_jar", new FilledJarItem(new Item.Settings().maxCount(1)));
|
||||
Item RAIN_CLOUD_JAR = register("rain_cloud_jar", new JarItem(new Item.Settings().maxCount(1).fireproof(), true, false, false), ItemGroups.FUNCTIONAL);
|
||||
Item STORM_CLOUD_JAR = register("storm_cloud_jar", new JarItem(new Item.Settings().maxCount(1).fireproof(), true, true, false), ItemGroups.FUNCTIONAL);
|
||||
Item LIGHTNING_JAR = register("lightning_jar", new JarItem(new Item.Settings().maxCount(1).fireproof(), false, false, true), ItemGroups.FUNCTIONAL);
|
||||
Item ZAP_APPLE_JAM_JAR = register("zap_apple_jam_jar", new JarItem(new Item.Settings().maxCount(1).fireproof(), false, false, true), ItemGroups.FUNCTIONAL);
|
||||
Item RAIN_CLOUD_JAR = register("rain_cloud_jar", new JarItem(new Item.Settings().maxCount(1).fireproof().group(ItemGroup.DECORATIONS), true, false, false));
|
||||
Item STORM_CLOUD_JAR = register("storm_cloud_jar", new JarItem(new Item.Settings().maxCount(1).fireproof().group(ItemGroup.DECORATIONS), true, true, false));
|
||||
Item LIGHTNING_JAR = register("lightning_jar", new JarItem(new Item.Settings().maxCount(1).fireproof().group(ItemGroup.DECORATIONS), false, false, true));
|
||||
Item ZAP_APPLE_JAM_JAR = register("zap_apple_jam_jar", new JarItem(new Item.Settings().maxCount(1).fireproof().group(ItemGroup.DECORATIONS), false, false, true));
|
||||
|
||||
Item CRYSTAL_HEART = register("crystal_heart", new CrystalHeartItem(new Item.Settings().maxCount(1)), ItemGroups.TOOLS);
|
||||
Item CRYSTAL_SHARD = register("crystal_shard", new Item(new Item.Settings()), ItemGroups.NATURAL);
|
||||
Item CRYSTAL_HEART = register("crystal_heart", new CrystalHeartItem(new Item.Settings().maxCount(1).group(ItemGroup.TOOLS)));
|
||||
Item CRYSTAL_SHARD = register("crystal_shard", new Item(new Item.Settings().group(ItemGroup.MATERIALS)));
|
||||
|
||||
Item GEMSTONE = register("gemstone", new GemstoneItem(new Item.Settings()), ItemGroups.NATURAL);
|
||||
Item BOTCHED_GEM = register("botched_gem", new Item(new Item.Settings()), ItemGroups.NATURAL);
|
||||
Item GEMSTONE = register("gemstone", new GemstoneItem(new Item.Settings().group(ItemGroup.MATERIALS)));
|
||||
Item BOTCHED_GEM = register("botched_gem", new Item(new Item.Settings().group(ItemGroup.MATERIALS)));
|
||||
|
||||
Item PEGASUS_FEATHER = register("pegasus_feather", new Item(new Item.Settings()), ItemGroups.NATURAL);
|
||||
Item GRYPHON_FEATHER = register("gryphon_feather", new Item(new Item.Settings()), ItemGroups.NATURAL);
|
||||
Item PEGASUS_FEATHER = register("pegasus_feather", new Item(new Item.Settings().group(ItemGroup.MATERIALS)));
|
||||
Item GRYPHON_FEATHER = register("gryphon_feather", new Item(new Item.Settings().group(ItemGroup.MATERIALS)));
|
||||
|
||||
Item OAT_SEEDS = register("oat_seeds", new AliasedBlockItem(UBlocks.OATS, new Item.Settings()), ItemGroups.NATURAL);
|
||||
Item OATS = register("oats", new Item(new Item.Settings().food(UFoodComponents.OATS)), ItemGroups.FOOD_AND_DRINK);
|
||||
Item IMPORTED_OATS = register("imported_oats", new Item(new Item.Settings().food(UFoodComponents.IMPORTED_OATS)), ItemGroups.FOOD_AND_DRINK);
|
||||
Item OATMEAL = register("oatmeal", new OatmealItem(new Item.Settings().recipeRemainder(Items.BOWL).maxCount(1).food(UFoodComponents.OATMEAL)), ItemGroups.FOOD_AND_DRINK);
|
||||
Item OAT_SEEDS = register("oat_seeds", new AliasedBlockItem(UBlocks.OATS, new Item.Settings().group(ItemGroup.MATERIALS)));
|
||||
Item OATS = register("oats", new Item(new Item.Settings().food(UFoodComponents.OATS).group(ItemGroup.FOOD)));
|
||||
Item IMPORTED_OATS = register("imported_oats", new Item(new Item.Settings().food(UFoodComponents.IMPORTED_OATS).group(ItemGroup.FOOD)));
|
||||
Item OATMEAL = register("oatmeal", new OatmealItem(new Item.Settings().recipeRemainder(Items.BOWL).maxCount(1).food(UFoodComponents.OATMEAL).group(ItemGroup.FOOD)));
|
||||
|
||||
Item DAFFODIL_DAISY_SANDWICH = register("daffodil_daisy_sandwich", new Item(new Item.Settings().food(UFoodComponents.DAFODIL_DAISY_SANDWICH)), ItemGroups.FOOD_AND_DRINK);
|
||||
Item HAY_BURGER = register("hay_burger", new Item(new Item.Settings().maxCount(1).food(UFoodComponents.HAY_BURGER)), ItemGroups.FOOD_AND_DRINK);
|
||||
Item HAY_FRIES = register("hay_fries", new Item(new Item.Settings().maxCount(16).food(UFoodComponents.HAY_FRIES)), ItemGroups.FOOD_AND_DRINK);
|
||||
Item WHEAT_WORMS = register("wheat_worms", new Item(new Item.Settings().maxCount(16).food(UFoodComponents.INSECTS)), ItemGroups.NATURAL);
|
||||
Item MUFFIN = register("muffin", new MuffinItem(new Item.Settings().maxCount(32).food(FoodComponents.BREAD), 0), ItemGroups.FOOD_AND_DRINK);
|
||||
Item PINECONE = register("pinecone", new Item(new Item.Settings().food(UFoodComponents.PINECONE).maxCount(3)), ItemGroups.FOOD_AND_DRINK);
|
||||
Item ACORN = register("acorn", new Item(new Item.Settings().food(UFoodComponents.ACORN).maxCount(16)), ItemGroups.FOOD_AND_DRINK);
|
||||
Item DAFFODIL_DAISY_SANDWICH = register("daffodil_daisy_sandwich", new Item(new Item.Settings().food(UFoodComponents.DAFODIL_DAISY_SANDWICH).group(ItemGroup.FOOD)));
|
||||
Item HAY_BURGER = register("hay_burger", new Item(new Item.Settings().maxCount(1).food(UFoodComponents.HAY_BURGER).group(ItemGroup.FOOD)));
|
||||
Item HAY_FRIES = register("hay_fries", new Item(new Item.Settings().maxCount(16).food(UFoodComponents.HAY_FRIES).group(ItemGroup.FOOD)));
|
||||
Item WHEAT_WORMS = register("wheat_worms", new Item(new Item.Settings().maxCount(16).food(UFoodComponents.INSECTS).group(ItemGroup.MATERIALS)));
|
||||
Item MUFFIN = register("muffin", new MuffinItem(new Item.Settings().maxCount(32).food(FoodComponents.BREAD).group(ItemGroup.FOOD), 0));
|
||||
Item PINECONE = register("pinecone", new Item(new Item.Settings().food(UFoodComponents.PINECONE).maxCount(3).group(ItemGroup.FOOD)));
|
||||
Item ACORN = register("acorn", new Item(new Item.Settings().food(UFoodComponents.ACORN).maxCount(16).group(ItemGroup.FOOD)));
|
||||
|
||||
Item PEBBLES = register("pebbles", new RacePredicatedAliasedBlockItem(UBlocks.ROCKS, new Item.Settings(), Race::canUseEarth), ItemGroups.NATURAL);
|
||||
Item ROCK = register("rock", new HeavyProjectileItem(new Item.Settings(), 3), ItemGroups.NATURAL);
|
||||
Item WEIRD_ROCK = register("weird_rock", new Item(new Item.Settings()), ItemGroups.NATURAL);
|
||||
Item ROCK_STEW = register("rock_stew", new Item(new Item.Settings().food(FoodComponents.MUSHROOM_STEW)), ItemGroups.FOOD_AND_DRINK);
|
||||
Item PEBBLES = register("pebbles", new RacePredicatedAliasedBlockItem(UBlocks.ROCKS, new Item.Settings().group(ItemGroup.MATERIALS), Race::canUseEarth));
|
||||
Item ROCK = register("rock", new HeavyProjectileItem(new Item.Settings().group(ItemGroup.MATERIALS), 3));
|
||||
Item WEIRD_ROCK = register("weird_rock", new Item(new Item.Settings().group(ItemGroup.MATERIALS)));
|
||||
Item ROCK_STEW = register("rock_stew", new Item(new Item.Settings().food(FoodComponents.MUSHROOM_STEW).group(ItemGroup.FOOD)));
|
||||
|
||||
Item GREEN_APPLE_SEEDS = register("green_apple_seeds", new AliasedBlockItem(UBlocks.GREEN_APPLE_SPROUT, new Item.Settings()), ItemGroups.NATURAL);
|
||||
Item SWEET_APPLE_SEEDS = register("sweet_apple_seeds", new AliasedBlockItem(UBlocks.SWEET_APPLE_SPROUT, new Item.Settings()), ItemGroups.NATURAL);
|
||||
Item SOUR_APPLE_SEEDS = register("sour_apple_seeds", new AliasedBlockItem(UBlocks.SOUR_APPLE_SPROUT, new Item.Settings()), ItemGroups.NATURAL);
|
||||
Item GREEN_APPLE_SEEDS = register("green_apple_seeds", new AliasedBlockItem(UBlocks.GREEN_APPLE_SPROUT, new Item.Settings().group(ItemGroup.MATERIALS)));
|
||||
Item SWEET_APPLE_SEEDS = register("sweet_apple_seeds", new AliasedBlockItem(UBlocks.SWEET_APPLE_SPROUT, new Item.Settings().group(ItemGroup.MATERIALS)));
|
||||
Item SOUR_APPLE_SEEDS = register("sour_apple_seeds", new AliasedBlockItem(UBlocks.SOUR_APPLE_SPROUT, new Item.Settings().group(ItemGroup.MATERIALS)));
|
||||
|
||||
Item MUG = register("mug", new Item(new Settings().maxCount(16)), ItemGroups.TOOLS);
|
||||
Item CIDER = register("cider", new DrinkableItem(new Item.Settings().food(UFoodComponents.CIDER).maxCount(1).recipeRemainder(MUG)), ItemGroups.FOOD_AND_DRINK);
|
||||
Item JUICE = register("juice", new DrinkableItem(new Item.Settings().recipeRemainder(Items.GLASS_BOTTLE).maxCount(1).food(UFoodComponents.JUICE)), ItemGroups.FOOD_AND_DRINK);
|
||||
Item BURNED_JUICE = register("burned_juice", new DrinkableItem(new Item.Settings().recipeRemainder(Items.GLASS_BOTTLE).maxCount(1).food(UFoodComponents.BURNED_JUICE)), ItemGroups.FOOD_AND_DRINK);
|
||||
Item APPLE_PIE = register("apple_pie", new BlockItem(UBlocks.APPLE_PIE, new Item.Settings().maxCount(1)), ItemGroups.FOOD_AND_DRINK);
|
||||
Item APPLE_PIE_SLICE = register("apple_pie_slice", new Item(new Item.Settings().maxCount(16).food(UFoodComponents.PIE)), ItemGroups.FOOD_AND_DRINK);
|
||||
Item MUG = register("mug", new Item(new Settings().maxCount(16).group(ItemGroup.TOOLS)));
|
||||
Item CIDER = register("cider", new DrinkableItem(new Item.Settings().food(UFoodComponents.CIDER).maxCount(1).recipeRemainder(MUG).group(ItemGroup.FOOD)));
|
||||
Item JUICE = register("juice", new DrinkableItem(new Item.Settings().recipeRemainder(Items.GLASS_BOTTLE).maxCount(1).food(UFoodComponents.JUICE).group(ItemGroup.FOOD)));
|
||||
Item BURNED_JUICE = register("burned_juice", new DrinkableItem(new Item.Settings().recipeRemainder(Items.GLASS_BOTTLE).maxCount(1).food(UFoodComponents.BURNED_JUICE).group(ItemGroup.FOOD)));
|
||||
Item APPLE_PIE = register("apple_pie", new BlockItem(UBlocks.APPLE_PIE, new Item.Settings().maxCount(1).group(ItemGroup.FOOD)));
|
||||
Item APPLE_PIE_SLICE = register("apple_pie_slice", new Item(new Item.Settings().maxCount(16).food(UFoodComponents.PIE).group(ItemGroup.FOOD)));
|
||||
|
||||
Item LOVE_BOTTLE = register("love_bottle", new DrinkableItem(new Item.Settings().food(UFoodComponents.LOVE_BOTTLE).maxCount(1).recipeRemainder(Items.GLASS_BOTTLE)), ItemGroups.FOOD_AND_DRINK);
|
||||
Item LOVE_BUCKET = register("love_bucket", new DrinkableItem(new Item.Settings().food(UFoodComponents.LOVE_BUCKET).recipeRemainder(Items.BUCKET)), ItemGroups.FOOD_AND_DRINK);
|
||||
Item LOVE_MUG = register("love_mug", new DrinkableItem(new Item.Settings().food(UFoodComponents.LOVE_MUG).recipeRemainder(MUG)), ItemGroups.FOOD_AND_DRINK);
|
||||
Item LOVE_BOTTLE = register("love_bottle", new DrinkableItem(new Item.Settings().food(UFoodComponents.LOVE_BOTTLE).maxCount(1).recipeRemainder(Items.GLASS_BOTTLE).group(ItemGroup.FOOD)));
|
||||
Item LOVE_BUCKET = register("love_bucket", new DrinkableItem(new Item.Settings().food(UFoodComponents.LOVE_BUCKET).recipeRemainder(Items.BUCKET).group(ItemGroup.FOOD)));
|
||||
Item LOVE_MUG = register("love_mug", new DrinkableItem(new Item.Settings().food(UFoodComponents.LOVE_MUG).recipeRemainder(MUG).group(ItemGroup.FOOD)));
|
||||
|
||||
Item GOLDEN_FEATHER = register("golden_feather", new Item(new Item.Settings().rarity(Rarity.UNCOMMON)), ItemGroups.NATURAL);
|
||||
Item GOLDEN_WING = register("golden_wing", new Item(new Item.Settings().rarity(Rarity.UNCOMMON)), ItemGroups.NATURAL);
|
||||
Item GOLDEN_FEATHER = register("golden_feather", new Item(new Item.Settings().rarity(Rarity.UNCOMMON).group(ItemGroup.MATERIALS)));
|
||||
Item GOLDEN_WING = register("golden_wing", new Item(new Item.Settings().rarity(Rarity.UNCOMMON).group(ItemGroup.MATERIALS)));
|
||||
|
||||
Item DRAGON_BREATH_SCROLL = register("dragon_breath_scroll", new DragonBreathScrollItem(new Item.Settings().rarity(Rarity.UNCOMMON)), ItemGroups.TOOLS);
|
||||
Item DRAGON_BREATH_SCROLL = register("dragon_breath_scroll", new DragonBreathScrollItem(new Item.Settings().rarity(Rarity.UNCOMMON).group(ItemGroup.TOOLS)));
|
||||
|
||||
Item WOODEN_POLEARM = register("wooden_polearm", new PolearmItem(ToolMaterials.WOOD, 2, -3.6F, 2, new Item.Settings()), ItemGroups.COMBAT);
|
||||
Item STONE_POLEARM = register("stone_polearm", new PolearmItem(ToolMaterials.STONE, 2, -3.6F, 2, new Item.Settings()), ItemGroups.COMBAT);
|
||||
Item IRON_POLEARM = register("iron_polearm", new PolearmItem(ToolMaterials.IRON, 2, -3.6F, 3, new Item.Settings()), ItemGroups.COMBAT);
|
||||
Item GOLDEN_POLEARM = register("golden_polearm", new PolearmItem(ToolMaterials.GOLD, 2, -3.6F, 4, new Item.Settings()), ItemGroups.COMBAT);
|
||||
Item DIAMOND_POLEARM = register("diamond_polearm", new PolearmItem(ToolMaterials.DIAMOND, 2, -3.6F, 5, new Item.Settings()), ItemGroups.COMBAT);
|
||||
Item NETHERITE_POLEARM = register("netherite_polearm", new PolearmItem(ToolMaterials.NETHERITE, 2, -3.6F, 5, new Item.Settings().fireproof()), ItemGroups.COMBAT);
|
||||
Item WOODEN_POLEARM = register("wooden_polearm", new PolearmItem(ToolMaterials.WOOD, 2, -3.6F, 2, new Item.Settings().group(ItemGroup.COMBAT)));
|
||||
Item STONE_POLEARM = register("stone_polearm", new PolearmItem(ToolMaterials.STONE, 2, -3.6F, 2, new Item.Settings().group(ItemGroup.COMBAT)));
|
||||
Item IRON_POLEARM = register("iron_polearm", new PolearmItem(ToolMaterials.IRON, 2, -3.6F, 3, new Item.Settings().group(ItemGroup.COMBAT)));
|
||||
Item GOLDEN_POLEARM = register("golden_polearm", new PolearmItem(ToolMaterials.GOLD, 2, -3.6F, 4, new Item.Settings().group(ItemGroup.COMBAT)));
|
||||
Item DIAMOND_POLEARM = register("diamond_polearm", new PolearmItem(ToolMaterials.DIAMOND, 2, -3.6F, 5, new Item.Settings().group(ItemGroup.COMBAT)));
|
||||
Item NETHERITE_POLEARM = register("netherite_polearm", new PolearmItem(ToolMaterials.NETHERITE, 2, -3.6F, 5, new Item.Settings().fireproof().group(ItemGroup.COMBAT)));
|
||||
|
||||
Item BUTTERFLY_SPAWN_EGG = register("butterfly_spawn_egg", new SpawnEggItem(UEntities.BUTTERFLY, 0x222200, 0xaaeeff, new Item.Settings()), ItemGroups.SPAWN_EGGS);
|
||||
Item BUTTERFLY = register("butterfly", new Item(new Item.Settings().food(UFoodComponents.INSECTS)), ItemGroups.FOOD_AND_DRINK);
|
||||
Item BUTTERFLY_SPAWN_EGG = register("butterfly_spawn_egg", new SpawnEggItem(UEntities.BUTTERFLY, 0x222200, 0xaaeeff, new Item.Settings().group(ItemGroup.MISC)));
|
||||
Item BUTTERFLY = register("butterfly", new Item(new Item.Settings().food(UFoodComponents.INSECTS).group(ItemGroup.FOOD)));
|
||||
|
||||
Item SPELLBOOK = register("spellbook", new SpellbookItem(new Item.Settings().maxCount(1).rarity(Rarity.UNCOMMON)), ItemGroups.TOOLS);
|
||||
Item SPELLBOOK = register("spellbook", new SpellbookItem(new Item.Settings().maxCount(1).rarity(Rarity.UNCOMMON).group(ItemGroup.TOOLS)));
|
||||
|
||||
AmuletItem PEGASUS_AMULET = register("pegasus_amulet", new PegasusAmuletItem(new FabricItemSettings()
|
||||
.maxCount(1)
|
||||
.maxDamage(890)
|
||||
.rarity(Rarity.UNCOMMON), 900), ItemGroups.TOOLS);
|
||||
.rarity(Rarity.UNCOMMON)
|
||||
.group(ItemGroup.TOOLS), 900));
|
||||
AlicornAmuletItem ALICORN_AMULET = register("alicorn_amulet", new AlicornAmuletItem(new FabricItemSettings()
|
||||
.maxCount(1)
|
||||
.maxDamage(1000)
|
||||
.rarity(Rarity.RARE)), ItemGroups.TOOLS);
|
||||
.rarity(Rarity.RARE).group(ItemGroup.TOOLS)));
|
||||
|
||||
GlassesItem SUNGLASSES = register("sunglasses", new GlassesItem(new FabricItemSettings().maxCount(1)), ItemGroups.COMBAT);
|
||||
GlassesItem BROKEN_SUNGLASSES = register("broken_sunglasses", new GlassesItem(new FabricItemSettings().maxCount(1)), ItemGroups.COMBAT);
|
||||
GlassesItem SUNGLASSES = register("sunglasses", new GlassesItem(new FabricItemSettings().maxCount(1).group(ItemGroup.COMBAT)));
|
||||
GlassesItem BROKEN_SUNGLASSES = register("broken_sunglasses", new GlassesItem(new FabricItemSettings().maxCount(1).group(ItemGroup.COMBAT)));
|
||||
|
||||
static <T extends Item> T register(String name, T item, ItemGroup group) {
|
||||
return ItemGroupRegistry.register(register(name, item), group);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
static <T extends Item> T register(String name, T item) {
|
||||
return register(Unicopia.id(name), item);
|
||||
}
|
||||
|
@ -138,14 +133,15 @@ public interface UItems {
|
|||
if (item instanceof BlockItem) {
|
||||
((BlockItem)item).appendBlocks(Item.BLOCK_ITEMS, item);
|
||||
}
|
||||
return Registry.register(Registries.ITEM, id, item);
|
||||
return Registry.register(Registry.ITEM, id, item);
|
||||
}
|
||||
|
||||
static MusicDiscItem register(String name, SoundEvent sound, int seconds) {
|
||||
return register(name, new MusicDiscItem(1, sound, new Settings()
|
||||
.maxCount(1)
|
||||
.rarity(Rarity.RARE), seconds
|
||||
) {}, ItemGroups.TOOLS);
|
||||
.rarity(Rarity.RARE)
|
||||
.group(ItemGroup.TOOLS), seconds
|
||||
) {});
|
||||
}
|
||||
|
||||
static void bootstrap() {
|
||||
|
|
|
@ -31,7 +31,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.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.event.GameEvent;
|
||||
|
||||
|
@ -106,7 +106,7 @@ public class ZapAppleItem extends Item implements ChameleonItem, ToxicHolder, Mu
|
|||
.flatMap(world -> RegistryUtils.valuesForTag(world, UTags.APPLES))
|
||||
.filter(a -> a != this).map(item -> {
|
||||
ItemStack stack = new ItemStack(this);
|
||||
stack.getOrCreateNbt().putString("appearance", Registries.ITEM.getId(item).toString());
|
||||
stack.getOrCreateNbt().putString("appearance", Registry.ITEM.getId(item).toString());
|
||||
return stack;
|
||||
}).toList();
|
||||
}
|
||||
|
|
|
@ -8,24 +8,21 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.recipe.Ingredient;
|
||||
import net.minecraft.recipe.ShapelessRecipe;
|
||||
import net.minecraft.recipe.book.CraftingRecipeCategory;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.JsonHelper;
|
||||
import net.minecraft.util.collection.DefaultedList;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
public class ZapAppleRecipe extends ShapelessRecipe {
|
||||
|
||||
public ZapAppleRecipe(Identifier id, String group, CraftingRecipeCategory category, ItemStack output, DefaultedList<Ingredient> input) {
|
||||
super(id, group, category, output, input);
|
||||
public ZapAppleRecipe(Identifier id, String group, ItemStack output, DefaultedList<Ingredient> input) {
|
||||
super(id, group, output, input);
|
||||
}
|
||||
|
||||
public static class Serializer extends ShapelessRecipe.Serializer {
|
||||
@Override
|
||||
public ShapelessRecipe read(Identifier identifier, JsonObject json) {
|
||||
String group = JsonHelper.getString(json, "group", "");
|
||||
@SuppressWarnings("deprecation")
|
||||
CraftingRecipeCategory category = CraftingRecipeCategory.CODEC.byId(JsonHelper.getString(json, "category", null), CraftingRecipeCategory.MISC);
|
||||
DefaultedList<Ingredient> ingredients = URecipes.getIngredients(JsonHelper.getArray(json, "ingredients"));
|
||||
|
||||
if (ingredients.isEmpty()) {
|
||||
|
@ -36,7 +33,7 @@ public class ZapAppleRecipe extends ShapelessRecipe {
|
|||
|
||||
Identifier id = new Identifier(JsonHelper.getString(json, "appearance"));
|
||||
|
||||
return new ZapAppleRecipe(identifier, group, category, UItems.ZAP_APPLE.setAppearance(UItems.ZAP_APPLE.getDefaultStack(), Registries.ITEM.getOrEmpty(id).orElseThrow(() -> {
|
||||
return new ZapAppleRecipe(identifier, group, UItems.ZAP_APPLE.setAppearance(UItems.ZAP_APPLE.getDefaultStack(), Registry.ITEM.getOrEmpty(id).orElseThrow(() -> {
|
||||
return new JsonSyntaxException("Unknown item '" + id + "'");
|
||||
}).getDefaultStack()), ingredients);
|
||||
}
|
||||
|
@ -44,7 +41,6 @@ public class ZapAppleRecipe extends ShapelessRecipe {
|
|||
@Override
|
||||
public ShapelessRecipe read(Identifier identifier, PacketByteBuf input) {
|
||||
String group = input.readString(32767);
|
||||
CraftingRecipeCategory category = input.readEnumConstant(CraftingRecipeCategory.class);
|
||||
|
||||
DefaultedList<Ingredient> ingredients = DefaultedList.ofSize(input.readVarInt(), Ingredient.EMPTY);
|
||||
|
||||
|
@ -52,7 +48,7 @@ public class ZapAppleRecipe extends ShapelessRecipe {
|
|||
ingredients.set(j, Ingredient.fromPacket(input));
|
||||
}
|
||||
|
||||
return new ZapAppleRecipe(identifier, group, category, input.readItemStack(), ingredients);
|
||||
return new ZapAppleRecipe(identifier, group, input.readItemStack(), ingredients);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import net.minecraft.sound.SoundEvent;
|
|||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
import net.minecraft.util.profiler.Profiler;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
public class PoisonedJokeEnchantment extends SimpleEnchantment implements IdentifiableResourceReloadListener {
|
||||
private static final Identifier ID = Unicopia.id("data/poisoned_joke_sounds");
|
||||
|
@ -84,7 +84,7 @@ public class PoisonedJokeEnchantment extends SimpleEnchantment implements Identi
|
|||
}
|
||||
|
||||
private Stream<SoundEvent> findSound(Identifier id) {
|
||||
return Registries.SOUND_EVENT.getOrEmpty(id).map(Stream::of).orElseGet(() -> {
|
||||
return Registry.SOUND_EVENT.getOrEmpty(id).map(Stream::of).orElseGet(() -> {
|
||||
Unicopia.LOGGER.warn("Could not find sound with id {}", id);
|
||||
return Stream.empty();
|
||||
});
|
||||
|
|
|
@ -14,8 +14,7 @@ import net.minecraft.entity.attribute.EntityAttributeModifier;
|
|||
import net.minecraft.entity.attribute.EntityAttributes;
|
||||
import net.minecraft.entity.attribute.EntityAttributeModifier.Operation;
|
||||
import net.minecraft.enchantment.EnchantmentTarget;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
public interface UEnchantments {
|
||||
|
||||
|
@ -82,6 +81,6 @@ public interface UEnchantments {
|
|||
|
||||
static <T extends SimpleEnchantment> T register(String name, T enchantment) {
|
||||
REGISTRY.add(enchantment);
|
||||
return Registry.register(Registries.ENCHANTMENT, Unicopia.id(name), enchantment);
|
||||
return Registry.register(Registry.ENCHANTMENT, Unicopia.id(name), enchantment);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,14 +7,12 @@ import java.util.stream.Stream;
|
|||
import com.minelittlepony.unicopia.UTags;
|
||||
import com.minelittlepony.unicopia.Unicopia;
|
||||
|
||||
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
|
||||
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
|
||||
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.tag.TagKey;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.tag.TagKey;
|
||||
|
||||
public interface ItemGroupRegistry {
|
||||
Map<ItemGroup, Set<Item>> REGISTRY = new HashMap<>();
|
||||
|
||||
static List<ItemStack> getVariations(Item item) {
|
||||
if (item instanceof MultiItem) {
|
||||
|
@ -23,14 +21,9 @@ public interface ItemGroupRegistry {
|
|||
return List.of(item.getDefaultStack());
|
||||
}
|
||||
|
||||
static <T extends Item> T register(T item, ItemGroup group) {
|
||||
REGISTRY.computeIfAbsent(group, g -> new HashSet<>()).add(item);
|
||||
return item;
|
||||
}
|
||||
|
||||
static ItemGroup createDynamic(String name, Supplier<ItemStack> icon, Supplier<Stream<Item>> items) {
|
||||
boolean[] reloading = new boolean[1];
|
||||
return FabricItemGroup.builder(Unicopia.id(name)).entries((features, list, k) -> {
|
||||
return FabricItemGroupBuilder.create(Unicopia.id(name)).appendItems(list -> {
|
||||
if (reloading[0]) {
|
||||
return;
|
||||
}
|
||||
|
@ -45,7 +38,7 @@ public interface ItemGroupRegistry {
|
|||
static ItemGroup createGroupFromTag(String name, Supplier<ItemStack> icon) {
|
||||
TagKey<Item> key = UTags.item("groups/" + name);
|
||||
return createDynamic(name, icon, () -> {
|
||||
return Registries.ITEM.getEntryList(key)
|
||||
return Registry.ITEM.getEntryList(key)
|
||||
.stream()
|
||||
.flatMap(named -> named.stream())
|
||||
.map(entry -> entry.value());
|
||||
|
@ -53,10 +46,6 @@ public interface ItemGroupRegistry {
|
|||
}
|
||||
|
||||
static void bootstrap() {
|
||||
REGISTRY.forEach((group, items) -> {
|
||||
ItemGroupEvents.modifyEntriesEvent(group).register(event -> {
|
||||
event.addAll(items.stream().map(Item::getDefaultStack).toList());
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.minelittlepony.unicopia.item.toxin.Toxic;
|
|||
import com.minelittlepony.unicopia.item.toxin.ToxicHolder;
|
||||
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
public interface UItemGroups {
|
||||
ItemGroup ALL_ITEMS = ItemGroupRegistry.createDynamic("items", UItems.EMPTY_JAR::getDefaultStack, () -> {
|
||||
|
@ -16,7 +16,7 @@ public interface UItemGroups {
|
|||
.filter(item -> !(item instanceof ChameleonItem) || ((ChameleonItem)item).isFullyDisguised()));
|
||||
});
|
||||
ItemGroup HORSE_FEED = ItemGroupRegistry.createDynamic("horsefeed", UItems.ZAP_APPLE::getDefaultStack, () -> {
|
||||
return Registries.ITEM.stream()
|
||||
return Registry.ITEM.stream()
|
||||
.filter(item -> ((ToxicHolder)item).getToxic(item.getDefaultStack()) != Toxic.EMPTY);
|
||||
});
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue