mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 13:37:58 +01:00
1.19.4 -> 1.20-pre6
This commit is contained in:
parent
3ab501e3f3
commit
43d1142f1f
135 changed files with 723 additions and 714 deletions
|
@ -3,10 +3,10 @@ org.gradle.daemon=false
|
|||
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/develop
|
||||
minecraft_version=1.19.4
|
||||
yarn_mappings=1.19.4+build.1
|
||||
loader_version=0.14.17
|
||||
fabric_version=0.76.0+1.19.4
|
||||
minecraft_version=1.20-pre6
|
||||
yarn_mappings=1.20-pre6+build.2
|
||||
loader_version=0.14.21
|
||||
fabric_version=0.82.1+1.20
|
||||
|
||||
# Mod Properties
|
||||
group=com.minelittlepony
|
||||
|
@ -15,19 +15,19 @@ org.gradle.daemon=false
|
|||
description=Magical Abilities for Mine Little Pony!
|
||||
|
||||
# Publishing
|
||||
minecraft_version_range=>=1.19.4
|
||||
minecraft_version_range=>=1.20.0
|
||||
modrinth_loader_type=fabric
|
||||
modrinth_project_id=
|
||||
modrinth_project_id=9K7RJlvM
|
||||
|
||||
# Dependencies
|
||||
fabwork_version=1.1.9
|
||||
modmenu_version=6.1.0-rc.4
|
||||
minelp_version=4.8.7
|
||||
kirin_version=1.14.0
|
||||
reach_attributes_version=2.3.2
|
||||
fabwork_version=1.2.0
|
||||
modmenu_version=7.0.0-beta.2
|
||||
minelp_version=4.9.0-beta.2
|
||||
kirin_version=1.15.0
|
||||
reach_attributes_version=2.3.3
|
||||
trinkets_version=3.6.0
|
||||
terraformer_api_version=6.1.0
|
||||
terraformer_api_version=7.0.0-beta.1
|
||||
|
||||
# TMI Testing
|
||||
tmi_type=emi
|
||||
emi_version=1.0.0+1.19.4
|
||||
tmi_type=none
|
||||
emi_version=1.0.0+1.19.3
|
||||
|
|
BIN
lib/reach-entity-attributes-2.3.3.jar
Normal file
BIN
lib/reach-entity-attributes-2.3.3.jar
Normal file
Binary file not shown.
|
@ -30,6 +30,6 @@ public interface EntityConvertable<E extends Entity> extends WorldConvertable {
|
|||
|
||||
@Override
|
||||
default World asWorld() {
|
||||
return asEntity().world;
|
||||
return asEntity().getWorld();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ public class InteractionManager {
|
|||
*/
|
||||
@NotNull
|
||||
public final PlayerEntity createPlayer(Entity observer, GameProfile profile) {
|
||||
return createPlayer(observer.world, profile);
|
||||
return createPlayer(observer.getWorld(), profile);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -127,7 +127,7 @@ public class ChangelingFeedAbility implements Ability<Hit> {
|
|||
|
||||
|
||||
if (!canFeed(iplayer)) {
|
||||
iplayer.playSound(SoundEvents.ENTITY_PLAYER_BURP, 1, (float)player.world.random.nextTriangular(1F, 0.2F));
|
||||
iplayer.playSound(SoundEvents.ENTITY_PLAYER_BURP, 1, (float)player.getWorld().random.nextTriangular(1F, 0.2F));
|
||||
} else {
|
||||
iplayer.playSound(SoundEvents.ENTITY_GENERIC_DRINK, 0.1F, iplayer.getRandomPitch());
|
||||
}
|
||||
|
|
|
@ -164,9 +164,9 @@ public class EarthPonyKickAbility implements Ability<Pos> {
|
|||
|
||||
PlayerEntity player = iplayer.asEntity();
|
||||
|
||||
if (BlockDestructionManager.of(player.world).getBlockDestruction(pos) + 4 >= BlockDestructionManager.MAX_DAMAGE) {
|
||||
if (player.world.random.nextInt(30) == 0) {
|
||||
tree.traverse(player.world, pos, (w, state, p, recurseLevel) -> {
|
||||
if (BlockDestructionManager.of(player.getWorld()).getBlockDestruction(pos) + 4 >= BlockDestructionManager.MAX_DAMAGE) {
|
||||
if (player.getWorld().random.nextInt(30) == 0) {
|
||||
tree.traverse(player.getWorld(), pos, (w, state, p, recurseLevel) -> {
|
||||
if (recurseLevel < 5) {
|
||||
w.breakBlock(p, true);
|
||||
} else {
|
||||
|
@ -196,12 +196,12 @@ public class EarthPonyKickAbility implements Ability<Pos> {
|
|||
}
|
||||
|
||||
private int dropApples(PlayerEntity player, BlockPos pos) {
|
||||
TreeType tree = TreeType.at(pos, player.world);
|
||||
TreeType tree = TreeType.at(pos, player.getWorld());
|
||||
|
||||
if (tree.countBlocks(player.world, pos) > 0) {
|
||||
if (tree.countBlocks(player.getWorld(), pos) > 0) {
|
||||
List<ItemEntity> capturedDrops = new ArrayList<>();
|
||||
|
||||
tree.traverse(player.world, pos, (world, state, position, recurse) -> {
|
||||
tree.traverse(player.getWorld(), pos, (world, state, position, recurse) -> {
|
||||
affectBlockChange(player, position);
|
||||
}, (world, state, position, recurse) -> {
|
||||
affectBlockChange(player, position);
|
||||
|
@ -215,7 +215,7 @@ public class EarthPonyKickAbility implements Ability<Pos> {
|
|||
}
|
||||
});
|
||||
|
||||
capturedDrops.forEach(player.world::spawnEntity);
|
||||
capturedDrops.forEach(player.getWorld()::spawnEntity);
|
||||
|
||||
return capturedDrops.size() / 3;
|
||||
}
|
||||
|
@ -255,28 +255,28 @@ public class EarthPonyKickAbility implements Ability<Pos> {
|
|||
}
|
||||
|
||||
private void affectBlockChange(PlayerEntity player, BlockPos position) {
|
||||
BlockDestructionManager.of(player.world).damageBlock(position, 4);
|
||||
BlockDestructionManager.of(player.getWorld()).damageBlock(position, 4);
|
||||
|
||||
PosHelper.all(position, p -> {
|
||||
BlockState s = player.world.getBlockState(p);
|
||||
BlockState s = player.getWorld().getBlockState(p);
|
||||
|
||||
if (s.getBlock() instanceof BeehiveBlock) {
|
||||
if (player.world.getBlockEntity(p) instanceof BeehiveBlockEntity hive) {
|
||||
if (player.getWorld().getBlockEntity(p) instanceof BeehiveBlockEntity hive) {
|
||||
hive.angerBees(player, s, BeehiveBlockEntity.BeeState.EMERGENCY);
|
||||
}
|
||||
|
||||
player.world.updateComparators(position, s.getBlock());
|
||||
player.getWorld().updateComparators(position, s.getBlock());
|
||||
|
||||
Box area = new Box(position).expand(8, 6, 8);
|
||||
List<BeeEntity> nearbyBees = player.world.getNonSpectatingEntities(BeeEntity.class, area);
|
||||
List<BeeEntity> nearbyBees = player.getWorld().getNonSpectatingEntities(BeeEntity.class, area);
|
||||
|
||||
if (!nearbyBees.isEmpty()) {
|
||||
List<PlayerEntity> nearbyPlayers = player.world.getNonSpectatingEntities(PlayerEntity.class, area);
|
||||
List<PlayerEntity> nearbyPlayers = player.getWorld().getNonSpectatingEntities(PlayerEntity.class, area);
|
||||
int i = nearbyPlayers.size();
|
||||
|
||||
for (BeeEntity bee : nearbyBees) {
|
||||
if (bee.getTarget() == null) {
|
||||
bee.setTarget(nearbyPlayers.get(player.world.random.nextInt(i)));
|
||||
bee.setTarget(nearbyPlayers.get(player.getWorld().random.nextInt(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,13 +17,13 @@ import com.minelittlepony.unicopia.util.PosHelper;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.attribute.EntityAttributes;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.registry.tag.BlockTags;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.math.BlockBox;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -148,7 +148,7 @@ public class EarthPonyStompAbility implements Ability<Hit> {
|
|||
|
||||
spawnEffectAround(player, center, radius, rad);
|
||||
|
||||
ParticleUtils.spawnParticle(player.world, UParticles.GROUND_POUND, player.getX(), player.getY() - 1, player.getZ(), 0, 0, 0);
|
||||
ParticleUtils.spawnParticle(player.getWorld(), UParticles.GROUND_POUND, player.getX(), player.getY() - 1, player.getZ(), 0, 0, 0);
|
||||
|
||||
iplayer.subtractEnergyCost(rad);
|
||||
});
|
||||
|
@ -159,7 +159,7 @@ public class EarthPonyStompAbility implements Ability<Hit> {
|
|||
double dist = Math.sqrt(i.getSquaredDistance(source.getX(), source.getY(), source.getZ()));
|
||||
|
||||
if (dist <= radius) {
|
||||
spawnEffect(source.world, i, dist, range);
|
||||
spawnEffect(source.getWorld(), i, dist, range);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ public class EarthPonyStompAbility implements Ability<Hit> {
|
|||
w.breakBlock(pos, true);
|
||||
|
||||
if (w instanceof ServerWorld) {
|
||||
if (state.getMaterial() == Material.STONE && w.getRandom().nextInt(4) == 0) {
|
||||
if (state.isIn(BlockTags.BASE_STONE_OVERWORLD) && w.getRandom().nextInt(4) == 0) {
|
||||
ItemStack stack = UItems.PEBBLES.getDefaultStack();
|
||||
stack.setCount(1 + w.getRandom().nextInt(2));
|
||||
Block.dropStack(w, pos, stack);
|
||||
|
|
|
@ -168,7 +168,7 @@ public class UnicornTeleportAbility implements Ability<Pos> {
|
|||
|
||||
participant.fallDistance /= distance;
|
||||
|
||||
participant.world.playSound(null, destination.pos(), USounds.ENTITY_PLAYER_UNICORN_TELEPORT, SoundCategory.PLAYERS, 1, 1);
|
||||
participant.getWorld().playSound(null, destination.pos(), USounds.ENTITY_PLAYER_UNICORN_TELEPORT, SoundCategory.PLAYERS, 1, 1);
|
||||
}
|
||||
|
||||
private boolean enterable(World w, BlockPos pos) {
|
||||
|
@ -186,7 +186,7 @@ public class UnicornTeleportAbility implements Ability<Pos> {
|
|||
|
||||
Block c = state.getBlock();
|
||||
return state.hasSolidTopSurface(w, pos, player)
|
||||
|| state.getMaterial().isLiquid()
|
||||
|| state.isLiquid()
|
||||
|| (c instanceof WallBlock)
|
||||
|| (c instanceof FenceBlock)
|
||||
|| (c instanceof LeavesBlock);
|
||||
|
|
|
@ -131,8 +131,8 @@ public class PlaceableSpell extends AbstractDelegatingSpell implements OrientedS
|
|||
}
|
||||
entity.getSpellSlot().put(copy);
|
||||
entity.setCaster(source);
|
||||
entity.world.spawnEntity(entity);
|
||||
Ether.get(entity.world).put(getType(), entity);
|
||||
entity.getWorld().spawnEntity(entity);
|
||||
Ether.get(entity.getWorld()).put(getType(), entity);
|
||||
|
||||
castEntity.set(entity);
|
||||
setDirty();
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.minelittlepony.unicopia.item.EnchantableItem;
|
|||
import com.minelittlepony.unicopia.item.URecipes;
|
||||
import com.minelittlepony.unicopia.util.InventoryUtil;
|
||||
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.inventory.RecipeInputInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.recipe.RecipeSerializer;
|
||||
|
@ -20,7 +20,7 @@ public class SpellShapedCraftingRecipe extends ShapedRecipe {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack craft(CraftingInventory inventory, DynamicRegistryManager registries) {
|
||||
public ItemStack craft(RecipeInputInventory inventory, DynamicRegistryManager registries) {
|
||||
return InventoryUtil.stream(inventory)
|
||||
.filter(stack -> stack.getItem() instanceof EnchantableItem)
|
||||
.filter(EnchantableItem::isEnchanted)
|
||||
|
|
|
@ -75,8 +75,8 @@ public class AttractiveSpell extends ShieldSpell implements HomingSpell, TimedSp
|
|||
|
||||
@Override
|
||||
protected boolean isValidTarget(Caster<?> source, Entity entity) {
|
||||
if (target.isPresent(entity.world)) {
|
||||
return target.get(entity.world) == entity;
|
||||
if (target.referenceEquals(entity)) {
|
||||
return true;
|
||||
}
|
||||
return getTraits().get(Trait.KNOWLEDGE) > 10 ? entity instanceof ItemEntity : super.isValidTarget(source, entity);
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ public class AttractiveSpell extends ShieldSpell implements HomingSpell, TimedSp
|
|||
z = 0;
|
||||
}
|
||||
|
||||
if (this.target.get(target.world) == target) {
|
||||
if (this.target.referenceEquals(target)) {
|
||||
target.fallDistance = 0;
|
||||
|
||||
if (target.isOnGround()) {
|
||||
|
|
|
@ -41,7 +41,7 @@ public class CatapultSpell extends AbstractSpell implements ProjectileDelegate.B
|
|||
@Override
|
||||
public void onImpact(MagicProjectileEntity projectile, BlockHitResult hit) {
|
||||
if (!projectile.isClient() && projectile.canModifyAt(hit.getBlockPos())) {
|
||||
createBlockEntity(projectile.world, hit.getBlockPos(), e -> apply(projectile, e));
|
||||
createBlockEntity(projectile.getWorld(), hit.getBlockPos(), e -> apply(projectile, e));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,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.getWorld().createExplosion(projectile, pos.getX(), pos.getY(), pos.getZ(), 3, ExplosionSourceType.NONE);
|
||||
toPlaceable().tick(projectile, Situation.BODY);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ public class IceSpell extends AbstractSpell {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (state.getMaterial() == Material.ICE
|
||||
if (state.isIn(BlockTags.ICE)
|
||||
&& world.random.nextInt(10) == 0
|
||||
&& isSurroundedByIce(world, pos)) {
|
||||
world.setBlockState(pos, Blocks.PACKED_ICE.getDefaultState());
|
||||
|
@ -122,7 +122,7 @@ public class IceSpell extends AbstractSpell {
|
|||
|
||||
private static boolean isSurroundedByIce(World w, BlockPos pos) {
|
||||
return PosHelper.adjacentNeighbours(pos).allMatch(i ->
|
||||
w.getBlockState(i).getMaterial() == Material.ICE
|
||||
w.getBlockState(i).isIn(BlockTags.ICE)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ public class LightSpell extends AbstractSpell implements TimedSpell, ProjectileD
|
|||
return caster.getOriginVector().add(VecHelper.supply(() -> caster.asWorld().random.nextInt(3) - 1));
|
||||
}));
|
||||
entity.setMaster(caster);
|
||||
entity.world.spawnEntity(entity);
|
||||
entity.getWorld().spawnEntity(entity);
|
||||
|
||||
ref.set(entity);
|
||||
setDirty();
|
||||
|
@ -94,7 +94,7 @@ public class LightSpell extends AbstractSpell implements TimedSpell, ProjectileD
|
|||
}
|
||||
lights.forEach(ref -> {
|
||||
ref.ifPresent(caster.asWorld(), e -> {
|
||||
e.world.sendEntityStatus(e, (byte)60);
|
||||
e.getWorld().sendEntityStatus(e, (byte)60);
|
||||
e.discard();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -99,7 +99,7 @@ public class NecromancySpell extends AbstractAreaEffectSpell implements Projecti
|
|||
|
||||
summonedEntities.removeIf(ref -> ref.getOrEmpty(source.asWorld()).filter(e -> {
|
||||
if (e.getPos().distanceTo(source.getOriginVector()) > radius * 2) {
|
||||
e.world.sendEntityStatus(e, (byte)60);
|
||||
e.getWorld().sendEntityStatus(e, (byte)60);
|
||||
e.discard();
|
||||
return false;
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ public class NecromancySpell extends AbstractAreaEffectSpell implements Projecti
|
|||
if (master != null) {
|
||||
master.applyDamageEffects(master, e);
|
||||
}
|
||||
e.world.sendEntityStatus(e, (byte)60);
|
||||
e.getWorld().sendEntityStatus(e, (byte)60);
|
||||
e.discard();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -122,9 +122,9 @@ public class PortalSpell extends AbstractSpell implements PlaceableSpell.Placeme
|
|||
entity.setYaw(entity.getYaw() + yawDifference);
|
||||
entity.setVelocity(entity.getVelocity().rotateY(yawDifference * MathHelper.RADIANS_PER_DEGREE));
|
||||
|
||||
entity.world.playSoundFromEntity(null, entity, USounds.ENTITY_PLAYER_UNICORN_TELEPORT, entity.getSoundCategory(), 1, 1);
|
||||
entity.getWorld().playSoundFromEntity(null, entity, USounds.ENTITY_PLAYER_UNICORN_TELEPORT, entity.getSoundCategory(), 1, 1);
|
||||
entity.teleport(dest.x, dest.y, dest.z);
|
||||
entity.world.playSoundFromEntity(null, entity, USounds.ENTITY_PLAYER_UNICORN_TELEPORT, entity.getSoundCategory(), 1, 1);
|
||||
entity.getWorld().playSoundFromEntity(null, entity, USounds.ENTITY_PLAYER_UNICORN_TELEPORT, entity.getSoundCategory(), 1, 1);
|
||||
setDirty();
|
||||
|
||||
if (!source.subtractEnergyCost(Math.sqrt(entity.getPos().subtract(dest).length()))) {
|
||||
|
|
|
@ -106,7 +106,7 @@ public class SiphoningSpell extends AbstractAreaEffectSpell {
|
|||
}
|
||||
} else {
|
||||
e.heal((float)Math.min(source.getLevel().getScaled(e.getHealth()) / 2F, maxHealthGain * 0.6));
|
||||
ParticleUtils.spawnParticle(e.world, new FollowingParticleEffect(UParticles.HEALTH_DRAIN, e, 0.2F), e.getPos(), Vec3d.ZERO);
|
||||
ParticleUtils.spawnParticle(e.getWorld(), new FollowingParticleEffect(UParticles.HEALTH_DRAIN, e, 0.2F), e.getPos(), Vec3d.ZERO);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -39,11 +39,11 @@ public class TransformationSpell extends AbstractSpell implements ProjectileDele
|
|||
|
||||
@Override
|
||||
public void onImpact(MagicProjectileEntity projectile, EntityHitResult hit) {
|
||||
if (projectile.world.isClient) {
|
||||
if (projectile.getWorld().isClient) {
|
||||
return;
|
||||
}
|
||||
Entity entity = hit.getEntity();
|
||||
pickType(entity.getType(), entity.world).flatMap(type -> convert(entity, type)).ifPresentOrElse(e -> {
|
||||
pickType(entity.getType(), entity.getWorld()).flatMap(type -> convert(entity, type)).ifPresentOrElse(e -> {
|
||||
entity.playSound(USounds.SPELL_TRANSFORM_TRANSMUTE_ENTITY, 1, 1);
|
||||
}, () -> {
|
||||
ParticleUtils.spawnParticles(ParticleTypes.SMOKE, entity, 20);
|
||||
|
|
|
@ -16,7 +16,7 @@ import net.minecraft.advancement.criterion.AbstractCriterionConditions;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.predicate.entity.AdvancementEntityPredicateDeserializer;
|
||||
import net.minecraft.predicate.entity.AdvancementEntityPredicateSerializer;
|
||||
import net.minecraft.predicate.entity.EntityPredicate.Extended;
|
||||
import net.minecraft.predicate.entity.LootContextPredicate;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.JsonHelper;
|
||||
|
@ -31,7 +31,7 @@ public class CustomEventCriterion extends AbstractCriterion<CustomEventCriterion
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Conditions conditionsFromJson(JsonObject json, Extended playerPredicate, AdvancementEntityPredicateDeserializer deserializer) {
|
||||
protected Conditions conditionsFromJson(JsonObject json, LootContextPredicate playerPredicate, AdvancementEntityPredicateDeserializer deserializer) {
|
||||
|
||||
Set<Race> races = new HashSet<>();
|
||||
|
||||
|
@ -73,7 +73,7 @@ public class CustomEventCriterion extends AbstractCriterion<CustomEventCriterion
|
|||
|
||||
private final int repeatCount;
|
||||
|
||||
public Conditions(Extended playerPredicate, String event, Set<Race> races, Boolean flying, int repeatCount) {
|
||||
public Conditions(LootContextPredicate playerPredicate, String event, Set<Race> races, Boolean flying, int repeatCount) {
|
||||
super(ID, playerPredicate);
|
||||
this.event = event;
|
||||
this.races = races;
|
||||
|
|
|
@ -10,7 +10,7 @@ import net.minecraft.advancement.criterion.AbstractCriterionConditions;
|
|||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.predicate.entity.AdvancementEntityPredicateDeserializer;
|
||||
import net.minecraft.predicate.entity.AdvancementEntityPredicateSerializer;
|
||||
import net.minecraft.predicate.entity.EntityPredicate.Extended;
|
||||
import net.minecraft.predicate.entity.LootContextPredicate;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.JsonHelper;
|
||||
|
@ -25,7 +25,7 @@ public class RaceChangeCriterion extends AbstractCriterion<RaceChangeCriterion.C
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Conditions conditionsFromJson(JsonObject json, Extended playerPredicate, AdvancementEntityPredicateDeserializer deserializer) {
|
||||
protected Conditions conditionsFromJson(JsonObject json, LootContextPredicate playerPredicate, AdvancementEntityPredicateDeserializer deserializer) {
|
||||
return new Conditions(playerPredicate, Race.fromName(JsonHelper.getString(json, "race"), Race.EARTH));
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ public class RaceChangeCriterion extends AbstractCriterion<RaceChangeCriterion.C
|
|||
public static class Conditions extends AbstractCriterionConditions {
|
||||
private final Race race;
|
||||
|
||||
public Conditions(Extended playerPredicate, Race race) {
|
||||
public Conditions(LootContextPredicate playerPredicate, Race race) {
|
||||
super(ID, playerPredicate);
|
||||
this.race = race;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,8 @@ import net.minecraft.world.*;
|
|||
public class BaseZapAppleLeavesBlock extends LeavesBlock implements TintedBlock {
|
||||
|
||||
BaseZapAppleLeavesBlock() {
|
||||
super(Settings.of(Material.LEAVES)
|
||||
super(Settings.create()
|
||||
.mapColor(MapColor.PURPLE)
|
||||
.strength(500, 1200)
|
||||
.ticksRandomly()
|
||||
.sounds(BlockSoundGroup.AZALEA_LEAVES)
|
||||
|
|
|
@ -6,8 +6,9 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.ButtonBlock;
|
||||
import net.minecraft.block.LeavesBlock;
|
||||
import net.minecraft.block.MapColor;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.PillarBlock;
|
||||
import net.minecraft.block.enums.Instrument;
|
||||
import net.minecraft.block.piston.PistonBehavior;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -20,7 +21,7 @@ interface BlockConstructionUtils {
|
|||
}
|
||||
|
||||
static ButtonBlock woodenButton(BlockSoundGroup soundGroup, BlockSetType setType) {
|
||||
return new ButtonBlock(AbstractBlock.Settings.of(Material.DECORATION).noCollision().strength(0.5f).sounds(soundGroup), setType, 30, true);
|
||||
return new ButtonBlock(AbstractBlock.Settings.create().noCollision().strength(0.5f).pistonBehavior(PistonBehavior.DESTROY).sounds(soundGroup), setType, 30, true);
|
||||
}
|
||||
|
||||
static boolean never(BlockState state, BlockView world, BlockPos pos, EntityType<?> type) {
|
||||
|
@ -32,15 +33,15 @@ interface BlockConstructionUtils {
|
|||
}
|
||||
|
||||
static PillarBlock createLogBlock(MapColor topMapColor, MapColor sideMapColor) {
|
||||
return new PillarBlock(AbstractBlock.Settings.of(Material.WOOD, state -> state.get(PillarBlock.AXIS) == Direction.Axis.Y ? topMapColor : sideMapColor).strength(2).sounds(BlockSoundGroup.WOOD));
|
||||
return new PillarBlock(AbstractBlock.Settings.create().mapColor(state -> state.get(PillarBlock.AXIS) == Direction.Axis.Y ? topMapColor : sideMapColor).instrument(Instrument.BASS).strength(2.0f).sounds(BlockSoundGroup.WOOD).burnable());
|
||||
}
|
||||
|
||||
static PillarBlock createWoodBlock(MapColor mapColor) {
|
||||
return new PillarBlock(AbstractBlock.Settings.of(Material.WOOD, mapColor).strength(2).sounds(BlockSoundGroup.WOOD));
|
||||
return new PillarBlock(AbstractBlock.Settings.create().mapColor(mapColor).instrument(Instrument.BASS).strength(2.0f).sounds(BlockSoundGroup.WOOD).burnable());
|
||||
}
|
||||
|
||||
static LeavesBlock createLeavesBlock(BlockSoundGroup soundGroup) {
|
||||
return new LeavesBlock(AbstractBlock.Settings.of(Material.LEAVES).strength(0.2F).ticksRandomly().sounds(soundGroup).nonOpaque().allowsSpawning(BlockConstructionUtils::canSpawnOnLeaves).suffocates(BlockConstructionUtils::never).blockVision(BlockConstructionUtils::never));
|
||||
return new LeavesBlock(AbstractBlock.Settings.create().mapColor(MapColor.DARK_GREEN).strength(0.2f).ticksRandomly().sounds(soundGroup).nonOpaque().allowsSpawning(BlockConstructionUtils::canSpawnOnLeaves).suffocates(BlockConstructionUtils::never).blockVision(BlockConstructionUtils::never).burnable().pistonBehavior(PistonBehavior.DESTROY).solidBlock(BlockConstructionUtils::never));
|
||||
}
|
||||
|
||||
static Boolean canSpawnOnLeaves(BlockState state, BlockView world, BlockPos pos, EntityType<?> type) {
|
||||
|
|
|
@ -7,7 +7,6 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.FrostedIceBlock;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.piston.PistonBehavior;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stat.Stats;
|
||||
|
@ -35,9 +34,4 @@ public class FrostedObsidianBlock extends FrostedIceBlock {
|
|||
world.setBlockState(pos, Blocks.LAVA.getDefaultState());
|
||||
world.updateNeighbor(pos, Blocks.LAVA, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PistonBehavior getPistonBehavior(BlockState state) {
|
||||
return PistonBehavior.BLOCK;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,8 +6,10 @@ import com.minelittlepony.unicopia.ability.EarthPonyKickAbility.Buckable;
|
|||
|
||||
import net.fabricmc.fabric.api.registry.FlammableBlockRegistry;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.piston.PistonBehavior;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.util.math.*;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
|
@ -30,7 +32,7 @@ public class FruitBlock extends Block implements Buckable {
|
|||
}
|
||||
|
||||
public FruitBlock(Settings settings, Direction attachmentFace, Block stem, VoxelShape shape) {
|
||||
this(settings, attachmentFace, stem, shape, true);
|
||||
this(settings.sounds(BlockSoundGroup.WOOD).pistonBehavior(PistonBehavior.DESTROY), attachmentFace, stem, shape, true);
|
||||
}
|
||||
|
||||
public FruitBlock(Settings settings, Direction attachmentFace, Block stem, VoxelShape shape, boolean flammable) {
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.function.Supplier;
|
|||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.piston.PistonBehavior;
|
||||
import net.minecraft.item.ItemConvertible;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
|
@ -34,7 +35,12 @@ public class SproutBlock extends CropBlock implements TintedBlock {
|
|||
private final int overlay;
|
||||
|
||||
public SproutBlock(int overlay, ItemConvertible seeds, Supplier<BlockState> matureState) {
|
||||
super(Settings.of(Material.PLANT).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.STEM));
|
||||
super(Settings.create()
|
||||
.noCollision()
|
||||
.ticksRandomly()
|
||||
.breakInstantly()
|
||||
.sounds(BlockSoundGroup.STEM)
|
||||
.pistonBehavior(PistonBehavior.DESTROY));
|
||||
this.seeds = seeds;
|
||||
this.matureState = matureState;
|
||||
this.overlay = overlay;
|
||||
|
|
|
@ -9,25 +9,27 @@ import com.minelittlepony.unicopia.item.group.ItemGroupRegistry;
|
|||
import com.minelittlepony.unicopia.server.world.UTreeGen;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricMaterialBuilder;
|
||||
import net.fabricmc.fabric.api.registry.FlammableBlockRegistry;
|
||||
import net.fabricmc.fabric.api.registry.StrippableBlockRegistry;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.AbstractBlock.Settings;
|
||||
import net.minecraft.block.piston.PistonBehavior;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.registry.Registries;
|
||||
|
||||
public interface UBlocks {
|
||||
List<Block> TRANSLUCENT_BLOCKS = new ArrayList<>();
|
||||
|
||||
Block ROCKS = register("rocks", new RockCropBlock(FabricBlockSettings.of(
|
||||
new FabricMaterialBuilder(MapColor.STONE_GRAY).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().build()
|
||||
)
|
||||
Block ROCKS = register("rocks", new RockCropBlock(Settings.create()
|
||||
.mapColor(MapColor.STONE_GRAY)
|
||||
.nonOpaque()
|
||||
.pistonBehavior(PistonBehavior.DESTROY)
|
||||
.requiresTool()
|
||||
.ticksRandomly()
|
||||
.strength(2)
|
||||
|
@ -44,22 +46,22 @@ public interface UBlocks {
|
|||
Block ZAP_LEAVES = register("zap_leaves", new ZapAppleLeavesBlock(), ItemGroups.NATURAL);
|
||||
Block FLOWERING_ZAP_LEAVES = register("flowering_zap_leaves", new BaseZapAppleLeavesBlock(), ItemGroups.NATURAL);
|
||||
Block ZAP_LEAVES_PLACEHOLDER = register("zap_leaves_placeholder", new ZapAppleLeavesPlaceholderBlock());
|
||||
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 ZAP_BULB = register("zap_bulb", new FruitBlock(Settings.create().mapColor(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(Settings.create().mapColor(MapColor.GRAY).sounds(BlockSoundGroup.AZALEA_LEAVES), Direction.DOWN, ZAP_LEAVES, FruitBlock.DEFAULT_SHAPE, false));
|
||||
|
||||
Block PALM_LOG = register("palm_log", BlockConstructionUtils.createLogBlock(MapColor.OFF_WHITE, MapColor.SPRUCE_BROWN), ItemGroups.BUILDING_BLOCKS);
|
||||
Block PALM_WOOD = register("palm_wood", BlockConstructionUtils.createWoodBlock(MapColor.OFF_WHITE), ItemGroups.BUILDING_BLOCKS);
|
||||
Block STRIPPED_PALM_LOG = register("stripped_palm_log", BlockConstructionUtils.createLogBlock(MapColor.OFF_WHITE, MapColor.OFF_WHITE), ItemGroups.BUILDING_BLOCKS);
|
||||
Block STRIPPED_PALM_WOOD = register("stripped_palm_wood", BlockConstructionUtils.createWoodBlock(MapColor.OFF_WHITE), ItemGroups.BUILDING_BLOCKS);
|
||||
|
||||
Block PALM_PLANKS = register("palm_planks", new Block(Settings.of(Material.WOOD, MapColor.OFF_WHITE).strength(2, 3).sounds(BlockSoundGroup.WOOD)), ItemGroups.BUILDING_BLOCKS);
|
||||
Block PALM_STAIRS = register("palm_stairs", new StairsBlock(PALM_PLANKS.getDefaultState(), Settings.copy(PALM_PLANKS)), ItemGroups.BUILDING_BLOCKS);
|
||||
Block PALM_SLAB = register("palm_slab", new SlabBlock(Settings.of(Material.WOOD, PALM_PLANKS.getDefaultMapColor()).strength(2, 3).sounds(BlockSoundGroup.WOOD)), ItemGroups.BUILDING_BLOCKS);
|
||||
Block PALM_FENCE = register("palm_fence", new FenceBlock(Settings.of(Material.WOOD, PALM_PLANKS.getDefaultMapColor()).strength(2, 3).sounds(BlockSoundGroup.WOOD)), ItemGroups.BUILDING_BLOCKS);
|
||||
Block PALM_FENCE_GATE = register("palm_fence_gate", new FenceGateBlock(Settings.of(Material.WOOD, PALM_PLANKS.getDefaultMapColor()).strength(2, 3).sounds(BlockSoundGroup.WOOD), WoodType.OAK), ItemGroups.BUILDING_BLOCKS);
|
||||
Block PALM_PLANKS = register("palm_planks", new Block(Settings.create().mapColor(MapColor.OFF_WHITE).strength(2, 3).sounds(BlockSoundGroup.WOOD).pistonBehavior(PistonBehavior.NORMAL)), ItemGroups.BUILDING_BLOCKS);
|
||||
Block PALM_STAIRS = register("palm_stairs", new StairsBlock(PALM_PLANKS.getDefaultState(), Settings.copy(PALM_PLANKS).pistonBehavior(PistonBehavior.NORMAL)), ItemGroups.BUILDING_BLOCKS);
|
||||
Block PALM_SLAB = register("palm_slab", new SlabBlock(Settings.create().mapColor(PALM_PLANKS.getDefaultMapColor()).strength(2, 3).sounds(BlockSoundGroup.WOOD).pistonBehavior(PistonBehavior.NORMAL)), ItemGroups.BUILDING_BLOCKS);
|
||||
Block PALM_FENCE = register("palm_fence", new FenceBlock(Settings.create().mapColor(PALM_PLANKS.getDefaultMapColor()).strength(2, 3).sounds(BlockSoundGroup.WOOD).pistonBehavior(PistonBehavior.NORMAL)), ItemGroups.BUILDING_BLOCKS);
|
||||
Block PALM_FENCE_GATE = register("palm_fence_gate", new FenceGateBlock(Settings.create().mapColor(PALM_PLANKS.getDefaultMapColor()).strength(2, 3).sounds(BlockSoundGroup.WOOD).pistonBehavior(PistonBehavior.NORMAL), WoodType.OAK), ItemGroups.BUILDING_BLOCKS);
|
||||
// Block PALM_DOOR = register("palm_door", new DoorBlock(Settings.of(Material.WOOD, PALM_PLANKS.getDefaultMapColor()).strength(3.0f).sounds(BlockSoundGroup.WOOD).nonOpaque(), SoundEvents.BLOCK_WOODEN_DOOR_CLOSE, SoundEvents.BLOCK_WOODEN_DOOR_OPEN), ItemGroups.BUILDING_BLOCKS);
|
||||
// Block PALM_TRAPDOOR = register("palm_trapdoor", new TrapdoorBlock(Settings.of(Material.WOOD, PALM_PLANKS.getDefaultMapColor()).strength(3.0f).sounds(BlockSoundGroup.WOOD).nonOpaque().allowsSpawning(UBlocks::never), SoundEvents.BLOCK_WOODEN_TRAPDOOR_CLOSE, SoundEvents.BLOCK_WOODEN_TRAPDOOR_OPEN), ItemGroups.BUILDING_BLOCKS);
|
||||
Block PALM_PRESSURE_PLATE = register("palm_pressure_plate", new PressurePlateBlock(PressurePlateBlock.ActivationRule.EVERYTHING, Settings.of(Material.WOOD, PALM_PLANKS.getDefaultMapColor()).noCollision().strength(0.5f).sounds(BlockSoundGroup.WOOD), BlockSetType.OAK), ItemGroups.BUILDING_BLOCKS);
|
||||
Block PALM_PRESSURE_PLATE = register("palm_pressure_plate", new PressurePlateBlock(PressurePlateBlock.ActivationRule.EVERYTHING, Settings.create().mapColor(PALM_PLANKS.getDefaultMapColor()).noCollision().strength(0.5f).sounds(BlockSoundGroup.WOOD).pistonBehavior(PistonBehavior.DESTROY), BlockSetType.OAK), ItemGroups.BUILDING_BLOCKS);
|
||||
Block PALM_BUTTON = register("palm_button", BlockConstructionUtils.woodenButton(), ItemGroups.BUILDING_BLOCKS);
|
||||
// Block PALM_SIGN = register("palm_sign", new SignBlock(Settings.of(Material.WOOD).noCollision().strength(1.0f).sounds(BlockSoundGroup.WOOD), PALM_SIGN_TYPE), ItemGroups.BUILDING_BLOCKS);
|
||||
//
|
||||
|
@ -69,16 +71,16 @@ public interface UBlocks {
|
|||
|
||||
Block PALM_LEAVES = register("palm_leaves", BlockConstructionUtils.createLeavesBlock(BlockSoundGroup.GRASS), ItemGroups.BUILDING_BLOCKS);
|
||||
|
||||
Block BANANAS = register("bananas", new FruitBlock(FabricBlockSettings.of(Material.GOURD, MapColor.YELLOW).sounds(BlockSoundGroup.WOOD).hardness(3), Direction.DOWN, PALM_LEAVES, VoxelShapes.fullCube()));
|
||||
Block BANANAS = register("bananas", new FruitBlock(Settings.create().mapColor(MapColor.YELLOW).sounds(BlockSoundGroup.WOOD).hardness(3).pistonBehavior(PistonBehavior.DESTROY), Direction.DOWN, PALM_LEAVES, VoxelShapes.fullCube()));
|
||||
|
||||
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(Settings.create().mapColor(MapColor.BLACK).requiresTool().strength(3.0f, 6.0f).sounds(BlockSoundGroup.METAL).nonOpaque().pistonBehavior(PistonBehavior.BLOCK)), ItemGroups.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);
|
||||
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 = register("green_apple", new FruitBlock(Settings.create().mapColor(MapColor.GREEN), 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()));
|
||||
|
||||
Block SWEET_APPLE_LEAVES = register("sweet_apple_leaves", new FruitBearingBlock(FabricBlockSettings.copy(Blocks.OAK_LEAVES),
|
||||
|
@ -86,7 +88,7 @@ public interface UBlocks {
|
|||
() -> UBlocks.SWEET_APPLE,
|
||||
() -> UItems.SWEET_APPLE.getDefaultStack()
|
||||
), ItemGroups.NATURAL);
|
||||
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 = register("sweet_apple", new FruitBlock(Settings.create().mapColor(MapColor.GREEN), 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()));
|
||||
|
||||
Block SOUR_APPLE_LEAVES = register("sour_apple_leaves", new FruitBearingBlock(FabricBlockSettings.copy(Blocks.OAK_LEAVES),
|
||||
|
@ -94,10 +96,10 @@ public interface UBlocks {
|
|||
() -> UBlocks.SOUR_APPLE,
|
||||
() -> UItems.SOUR_APPLE.getDefaultStack()
|
||||
), ItemGroups.NATURAL);
|
||||
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 = register("sour_apple", new FruitBlock(Settings.create().mapColor(MapColor.GREEN), 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()));
|
||||
|
||||
Block APPLE_PIE = register("apple_pie", new PieBlock(FabricBlockSettings.of(Material.CAKE, MapColor.ORANGE).strength(0.5F).sounds(BlockSoundGroup.WET_GRASS), () -> UItems.APPLE_PIE_SLICE));
|
||||
Block APPLE_PIE = register("apple_pie", new PieBlock(Settings.create().solid().mapColor(MapColor.ORANGE).strength(0.5F).sounds(BlockSoundGroup.WET_GRASS).pistonBehavior(PistonBehavior.DESTROY), () -> UItems.APPLE_PIE_SLICE));
|
||||
|
||||
SegmentedCropBlock OATS = register("oats", SegmentedCropBlock.create(11, 5, AbstractBlock.Settings.copy(Blocks.WHEAT), () -> UItems.OAT_SEEDS, null, () -> UBlocks.OATS_STEM));
|
||||
SegmentedCropBlock OATS_STEM = register("oats_stem", OATS.createNext(5));
|
||||
|
@ -107,11 +109,11 @@ public interface UBlocks {
|
|||
return register(Unicopia.id(name), item);
|
||||
}
|
||||
|
||||
static <T extends Block> T register(String name, T block, ItemGroup group) {
|
||||
static <T extends Block> T register(String name, T block, RegistryKey<ItemGroup> group) {
|
||||
return register(Unicopia.id(name), block, group);
|
||||
}
|
||||
|
||||
static <T extends Block> T register(Identifier id, T block, ItemGroup group) {
|
||||
static <T extends Block> T register(Identifier id, T block, RegistryKey<ItemGroup> group) {
|
||||
UItems.register(id, ItemGroupRegistry.register(new BlockItem(block, new Item.Settings()), group));
|
||||
return register(id, block);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import net.minecraft.util.math.random.Random;
|
|||
public class ZapAppleLeavesPlaceholderBlock extends AirBlock {
|
||||
|
||||
ZapAppleLeavesPlaceholderBlock() {
|
||||
super(AbstractBlock.Settings.of(Material.AIR).noCollision().dropsNothing().air());
|
||||
super(Settings.create().replaceable().noCollision().dropsNothing().air());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.minelittlepony.unicopia.block;
|
|||
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.enums.Instrument;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
|
@ -18,11 +19,13 @@ public class ZapAppleLogBlock extends PillarBlock {
|
|||
private final Block artifialModelBlock;
|
||||
|
||||
ZapAppleLogBlock(Block artifialModelBlock, MapColor topMapColor, MapColor sideMapColor) {
|
||||
super(AbstractBlock.Settings.of(Material.WOOD,
|
||||
super(AbstractBlock.Settings.create().mapColor(
|
||||
state -> state.get(PillarBlock.AXIS) == Direction.Axis.Y ? topMapColor : sideMapColor
|
||||
)
|
||||
.instrument(Instrument.BASS)
|
||||
.strength(2.0f)
|
||||
.sounds(BlockSoundGroup.WOOD)
|
||||
.strength(500, 1200));
|
||||
.burnable());
|
||||
setDefaultState(getDefaultState().with(NATURAL, true));
|
||||
this.artifialModelBlock = artifialModelBlock;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ 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.FluidTags;
|
||||
import net.minecraft.registry.tag.TagKey;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -123,11 +124,11 @@ public abstract class StatePredicate implements Predicate<BlockState> {
|
|||
}
|
||||
|
||||
static boolean isWater(BlockState s) {
|
||||
return s.getMaterial() == Material.WATER;
|
||||
return s.isLiquid() && s.getFluidState().isIn(FluidTags.WATER);
|
||||
}
|
||||
|
||||
static boolean isLava(BlockState s) {
|
||||
return s.getMaterial() == Material.LAVA;
|
||||
return s.isLiquid() && s.getFluidState().isIn(FluidTags.LAVA);
|
||||
}
|
||||
|
||||
public static Predicate<BlockState> ofState(String state) {
|
||||
|
|
|
@ -7,7 +7,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import org.spongepowered.include.com.google.common.base.Objects;
|
||||
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.render.GameRenderer;
|
||||
import net.minecraft.client.toast.Toast;
|
||||
import net.minecraft.client.toast.ToastManager;
|
||||
|
@ -26,7 +26,7 @@ public class DiscoveryToast implements Toast {
|
|||
private boolean justUpdated;
|
||||
|
||||
@Override
|
||||
public Toast.Visibility draw(MatrixStack matrices, ToastManager manager, long startTime) {
|
||||
public Toast.Visibility draw(DrawContext context, ToastManager manager, long startTime) {
|
||||
if (justUpdated) {
|
||||
this.startTime = startTime;
|
||||
justUpdated = false;
|
||||
|
@ -37,26 +37,21 @@ public class DiscoveryToast implements Toast {
|
|||
}
|
||||
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexProgram);
|
||||
RenderSystem.setShaderTexture(0, TEXTURE);
|
||||
RenderSystem.setShaderColor(1.0F, 1, 1, 1);
|
||||
ToastManager.drawTexture(matrices, 0, 0, 0, 32, getWidth(), getHeight());
|
||||
manager.getClient().textRenderer.draw(matrices, TITLE, 30, 7, -11534256);
|
||||
manager.getClient().textRenderer.draw(matrices, DESCRIPTION, 30, 18, -16777216);
|
||||
|
||||
context.drawTexture(TEXTURE, 0, 0, 0, 32, getWidth(), getHeight());
|
||||
context.drawText(manager.getClient().textRenderer, TITLE, 30, 7, -11534256, false);
|
||||
context.drawText(manager.getClient().textRenderer, DESCRIPTION, 30, 18, -16777216, false);
|
||||
|
||||
Identifier icon = discoveries.get((int)(startTime / Math.max(1L, MAX_AGE / discoveries.size()) % discoveries.size()));
|
||||
|
||||
MatrixStack matrixStack = RenderSystem.getModelViewStack();
|
||||
matrixStack.push();
|
||||
matrixStack.scale(0.6F, 0.6F, 1);
|
||||
RenderSystem.applyModelViewMatrix();
|
||||
manager.getClient().getItemRenderer().renderInGui(matrixStack, UItems.SPELLBOOK.getDefaultStack(), 3, 3);
|
||||
matrixStack.pop();
|
||||
RenderSystem.applyModelViewMatrix();
|
||||
MatrixStack matrices = context.getMatrices();
|
||||
matrices.push();
|
||||
matrices.scale(0.6F, 0.6F, 1);
|
||||
context.drawItem(UItems.SPELLBOOK.getDefaultStack(), 3, 3);
|
||||
matrices.pop();
|
||||
|
||||
RenderSystem.setShaderTexture(0, icon);
|
||||
DrawableHelper.drawTexture(matrices, 8, 8, 1, 0, 0, 16, 16, 16, 16);
|
||||
|
||||
// manager.getClient().getItemRenderer().renderInGui(recipe.getOutput(), 8, 8);
|
||||
context.drawTexture(icon, 8, 8, 1, 0, 0, 16, 16, 16, 16);
|
||||
|
||||
return startTime - this.startTime >= MAX_AGE ? Toast.Visibility.HIDE : Toast.Visibility.SHOW;
|
||||
}
|
||||
|
|
|
@ -72,21 +72,22 @@ public class DismissSpellScreen extends GameGui {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
fillGradient(matrices, 0, 0, width, height / 2, 0xF0101010, 0x80101010);
|
||||
fillGradient(matrices, 0, height / 2, width, height, 0x80101010, 0xF0101010);
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
context.fillGradient(0, 0, width, height / 2, 0xF0101010, 0x80101010);
|
||||
context.fillGradient(0, height / 2, width, height, 0x80101010, 0xF0101010);
|
||||
|
||||
relativeMouseX = -width + mouseX * 2;
|
||||
relativeMouseY = -height + mouseY * 2;
|
||||
|
||||
MatrixStack matrices = context.getMatrices();
|
||||
matrices.push();
|
||||
matrices.translate(width - mouseX, height - mouseY, 0);
|
||||
DrawableUtil.drawLine(matrices, 0, 0, relativeMouseX, relativeMouseY, 0xFFFFFF88);
|
||||
DrawableUtil.drawArc(matrices, 40, 80, 0, DrawableUtil.TAU, 0x00000010, false);
|
||||
DrawableUtil.drawArc(matrices, 160, 1600, 0, DrawableUtil.TAU, 0x00000020, false);
|
||||
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
DrawableUtil.renderRaceIcon(matrices, pony.getObservedSpecies(), 0, 0, 16);
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
DrawableUtil.renderRaceIcon(context, pony.getObservedSpecies(), 0, 0, 16);
|
||||
matrices.pop();
|
||||
|
||||
DrawableUtil.drawLine(matrices, mouseX, mouseY - 4, mouseX, mouseY + 4, 0xFFAAFF99);
|
||||
|
@ -95,7 +96,7 @@ public class DismissSpellScreen extends GameGui {
|
|||
matrices.push();
|
||||
matrices.translate(0, 0, 300);
|
||||
Text cancel = Text.literal("Press ESC to cancel");
|
||||
getFont().drawWithShadow(matrices, cancel, (width - getFont().getWidth(cancel)) / 2, height - 30, 0xFFFFFFFF);
|
||||
context.drawText(getFont(), cancel, (width - getFont().getWidth(cancel)) / 2, height - 30, 0xFFFFFFFF, true);
|
||||
matrices.pop();
|
||||
}
|
||||
|
||||
|
@ -159,14 +160,15 @@ public class DismissSpellScreen extends GameGui {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float tickDelta) {
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float tickDelta) {
|
||||
MatrixStack matrices = context.getMatrices();
|
||||
copy.set(x, y, z, w);
|
||||
copy.mul(matrices.peek().getPositionMatrix());
|
||||
|
||||
var type = actualSpell.getType().withTraits(actualSpell.getTraits());
|
||||
|
||||
DrawableUtil.drawLine(matrices, 0, 0, (int)x, (int)y, 0xFFAAFF99);
|
||||
DrawableUtil.renderItemIcon(actualSpell.isDead() ? UItems.BOTCHED_GEM.getDefaultStack() : type.getDefaultStack(),
|
||||
DrawableUtil.renderItemIcon(context, actualSpell.isDead() ? UItems.BOTCHED_GEM.getDefaultStack() : type.getDefaultStack(),
|
||||
copy.x - 8 + copy.z / 20F,
|
||||
copy.y - 8 + copy.z / 20F,
|
||||
1
|
||||
|
@ -199,7 +201,7 @@ public class DismissSpellScreen extends GameGui {
|
|||
}
|
||||
tooltip.add(ScreenTexts.EMPTY);
|
||||
tooltip.add(Text.translatable("[Click to Discard]"));
|
||||
renderTooltip(matrices, tooltip, 0, 0);
|
||||
context.drawTooltip(getFont(), tooltip, 0, 0);
|
||||
|
||||
if (!lastMouseOver) {
|
||||
lastMouseOver = true;
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.minelittlepony.unicopia.Race;
|
|||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.render.BufferBuilder;
|
||||
import net.minecraft.client.render.BufferRenderer;
|
||||
import net.minecraft.client.render.GameRenderer;
|
||||
|
@ -24,32 +24,29 @@ public interface DrawableUtil {
|
|||
double NUM_RINGS = 300;
|
||||
double INCREMENT = TAU / NUM_RINGS;
|
||||
|
||||
static void drawScaledText(MatrixStack matrices, Text text, int x, int y, float size, int color) {
|
||||
static void drawScaledText(DrawContext context, Text text, int x, int y, float size, int color) {
|
||||
MatrixStack matrices = context.getMatrices();
|
||||
matrices.push();
|
||||
matrices.translate(x, y, 0);
|
||||
matrices.scale(size, size, 1);
|
||||
MinecraftClient.getInstance().textRenderer.draw(matrices, text, 0, 0, color);
|
||||
context.drawText(MinecraftClient.getInstance().textRenderer, text, 0, 0, color, false);
|
||||
matrices.pop();
|
||||
}
|
||||
|
||||
static void renderItemIcon(ItemStack stack, double x, double y, float scale) {
|
||||
MatrixStack modelStack = RenderSystem.getModelViewStack();
|
||||
static void renderItemIcon(DrawContext context ,ItemStack stack, double x, double y, float scale) {
|
||||
MatrixStack modelStack = context.getMatrices();
|
||||
modelStack.push();
|
||||
modelStack.translate(x, y, 0);
|
||||
if (scale != 1) {
|
||||
modelStack.scale(scale, scale, 1);
|
||||
}
|
||||
RenderSystem.applyModelViewMatrix();
|
||||
|
||||
MinecraftClient.getInstance().getItemRenderer().renderGuiItemIcon(modelStack, stack, 0, 0);
|
||||
context.drawItem(stack, 0, 0);
|
||||
|
||||
modelStack.pop();
|
||||
RenderSystem.applyModelViewMatrix();
|
||||
}
|
||||
|
||||
static void renderRaceIcon(MatrixStack matrices, Race race, int x, int y, int size) {
|
||||
RenderSystem.setShaderTexture(0, race.getIcon());
|
||||
DrawableHelper.drawTexture(matrices, x - size / 2, y - size / 2, 0, 0, 0, size, size, size, size);
|
||||
static void renderRaceIcon(DrawContext context, Race race, int x, int y, int size) {
|
||||
context.drawTexture(race.getIcon(), x - size / 2, y - size / 2, 0, 0, 0, size, size, size, size);
|
||||
}
|
||||
|
||||
static void drawLine(MatrixStack matrices, int x1, int y1, int x2, int y2, int color) {
|
||||
|
|
|
@ -6,16 +6,14 @@ import java.util.List;
|
|||
import com.minelittlepony.unicopia.Unicopia;
|
||||
import com.minelittlepony.unicopia.ability.magic.spell.trait.*;
|
||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.font.TextRenderer.TextLayerType;
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.tooltip.TooltipComponent;
|
||||
import net.minecraft.client.render.Tessellator;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.render.item.ItemRenderer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.text.*;
|
||||
|
@ -54,12 +52,12 @@ public class ItemTraitsTooltipRenderer implements Text, OrderedText, TooltipComp
|
|||
}
|
||||
|
||||
@Override
|
||||
public void drawItems(TextRenderer textRenderer, int x, int y, MatrixStack matrices, ItemRenderer itemRenderer) {
|
||||
public void drawItems(TextRenderer textRenderer, int x, int y, DrawContext context) {
|
||||
int columns = getColumns();
|
||||
int i = 0;
|
||||
|
||||
for (var entry : traits) {
|
||||
renderTraitIcon(entry.getKey(), entry.getValue(), matrices,
|
||||
renderTraitIcon(entry.getKey(), entry.getValue(), context,
|
||||
x + (i % columns) * 17,
|
||||
y + (i / columns) * 17
|
||||
);
|
||||
|
@ -82,11 +80,11 @@ public class ItemTraitsTooltipRenderer implements Text, OrderedText, TooltipComp
|
|||
return Text.empty();
|
||||
}
|
||||
|
||||
public static void renderStackTraits(ItemStack stack, MatrixStack matrices, float x, float y, float weight, float delta, int seed) {
|
||||
renderStackTraits(SpellTraits.of(stack), matrices, x, y, weight, delta, seed, false);
|
||||
public static void renderStackTraits(ItemStack stack, DrawContext context, float x, float y, float weight, float delta, int seed) {
|
||||
renderStackTraits(SpellTraits.of(stack), context, x, y, weight, delta, seed, false);
|
||||
}
|
||||
|
||||
public static void renderStackTraits(SpellTraits traits, MatrixStack matrices, float x, float y, float weight, float delta, int seed, boolean revealAll) {
|
||||
public static void renderStackTraits(SpellTraits traits, DrawContext context, float x, float y, float weight, float delta, int seed, boolean revealAll) {
|
||||
float time = MathHelper.cos((MinecraftClient.getInstance().player.age + delta + seed) / 2F) * 0.7F;
|
||||
|
||||
float angle = 0.7F + (time / 30F) % MathHelper.TAU;
|
||||
|
@ -95,7 +93,7 @@ public class ItemTraitsTooltipRenderer implements Text, OrderedText, TooltipComp
|
|||
|
||||
for (var entry : traits) {
|
||||
if (revealAll || isKnown(entry.getKey())) {
|
||||
ItemTraitsTooltipRenderer.renderTraitIcon(entry.getKey(), entry.getValue() * weight, matrices,
|
||||
ItemTraitsTooltipRenderer.renderTraitIcon(entry.getKey(), entry.getValue() * weight, context,
|
||||
x + r * MathHelper.sin(angle),
|
||||
y + r * MathHelper.cos(angle),
|
||||
revealAll || isKnown(entry.getKey())
|
||||
|
@ -110,21 +108,20 @@ public class ItemTraitsTooltipRenderer implements Text, OrderedText, TooltipComp
|
|||
|| Pony.of(MinecraftClient.getInstance().player).getDiscoveries().isKnown(trait);
|
||||
}
|
||||
|
||||
public static void renderTraitIcon(Trait trait, float value, MatrixStack matrices, float xx, float yy) {
|
||||
renderTraitIcon(trait, value, matrices, xx, yy, isKnown(trait));
|
||||
public static void renderTraitIcon(Trait trait, float value, DrawContext context, float xx, float yy) {
|
||||
renderTraitIcon(trait, value, context, xx, yy, isKnown(trait));
|
||||
}
|
||||
|
||||
public static void renderTraitIcon(Trait trait, float value, MatrixStack matrices, float xx, float yy, boolean reveal) {
|
||||
public static void renderTraitIcon(Trait trait, float value, DrawContext context, float xx, float yy, boolean reveal) {
|
||||
TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
|
||||
|
||||
int size = 12;
|
||||
|
||||
RenderSystem.setShaderTexture(0, reveal ? trait.getSprite() : UNKNOWN);
|
||||
|
||||
MatrixStack matrices = context.getMatrices();
|
||||
matrices.push();
|
||||
matrices.translate(xx, yy, 300F);
|
||||
|
||||
DrawableHelper.drawTexture(matrices, 2, 1, 0, 0, 0, size, size, size, size);
|
||||
context.drawTexture(reveal ? trait.getSprite() : UNKNOWN, 2, 1, 0, 0, 0, size, size, size, size);
|
||||
|
||||
matrices.translate(9, 3 + size / 2, 0);
|
||||
matrices.scale(0.5F, 0.5F, 1);
|
||||
|
|
|
@ -15,8 +15,8 @@ import com.minelittlepony.unicopia.Config;
|
|||
import com.minelittlepony.unicopia.Race;
|
||||
import com.minelittlepony.unicopia.Unicopia;
|
||||
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.server.integrated.IntegratedServer;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
|
@ -135,10 +135,10 @@ public class LanSettingsScreen extends GameGui {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float tickDelta) {
|
||||
renderBackground(matrices);
|
||||
super.render(matrices, mouseX, mouseY, tickDelta);
|
||||
content.render(matrices, mouseX, mouseY, tickDelta);
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float tickDelta) {
|
||||
renderBackground(context);
|
||||
super.render(context, mouseX, mouseY, tickDelta);
|
||||
content.render(context, mouseX, mouseY, tickDelta);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.minelittlepony.unicopia.entity.player.MagicReserves;
|
|||
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||
import com.minelittlepony.unicopia.entity.player.MagicReserves.Bar;
|
||||
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
||||
class ManaRingSlot extends Slot {
|
||||
|
@ -18,7 +19,8 @@ class ManaRingSlot extends Slot {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void renderContents(MatrixStack matrices, AbilityDispatcher abilities, boolean bSwap, float tickDelta) {
|
||||
protected void renderContents(DrawContext context, AbilityDispatcher abilities, boolean bSwap, float tickDelta) {
|
||||
MatrixStack matrices = context.getMatrices();
|
||||
matrices.push();
|
||||
matrices.translate(24.5, 25.5, 0);
|
||||
|
||||
|
@ -58,7 +60,7 @@ class ManaRingSlot extends Slot {
|
|||
|
||||
matrices.pop();
|
||||
|
||||
super.renderContents(matrices, abilities, bSwap, tickDelta);
|
||||
super.renderContents(context, abilities, bSwap, tickDelta);
|
||||
}
|
||||
|
||||
private double renderRing(MatrixStack matrices, double outerRadius, double innerRadius, double offsetAngle, Bar bar, int color, float tickDelta) {
|
||||
|
|
|
@ -13,8 +13,8 @@ import com.minelittlepony.unicopia.util.RegistryIndexer;
|
|||
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.server.integrated.IntegratedServer;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.text.Text;
|
||||
|
@ -81,7 +81,7 @@ public class SettingsScreen extends GameGui {
|
|||
row += 20;
|
||||
content.addButton(new Label(LEFT, row)).getStyle().setText("unicopia.options.world");
|
||||
|
||||
WorldTribeManager tribes = WorldTribeManager.forWorld((ServerWorld)server.getPlayerManager().getPlayer(MinecraftClient.getInstance().player.getUuid()).world);
|
||||
WorldTribeManager tribes = WorldTribeManager.forWorld((ServerWorld)server.getPlayerManager().getPlayer(MinecraftClient.getInstance().player.getUuid()).getWorld());
|
||||
|
||||
content.addButton(new Slider(LEFT, row += 20, 0, races.size(), races.indexOf(tribes.getDefaultRace())))
|
||||
.onChange(races.createSetter(tribes::setDefaultRace))
|
||||
|
@ -105,10 +105,10 @@ public class SettingsScreen extends GameGui {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float tickDelta) {
|
||||
renderBackground(matrices);
|
||||
super.render(matrices, mouseX, mouseY, tickDelta);
|
||||
content.render(matrices, mouseX, mouseY, tickDelta);
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float tickDelta) {
|
||||
renderBackground(context);
|
||||
super.render(context, mouseX, mouseY, tickDelta);
|
||||
content.render(context, mouseX, mouseY, tickDelta);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.minelittlepony.unicopia.ability.AbilitySlot;
|
|||
import com.minelittlepony.unicopia.client.KeyBindingsHandler;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
@ -74,7 +75,7 @@ class Slot {
|
|||
return y;
|
||||
}
|
||||
|
||||
void renderBackground(MatrixStack matrices, AbilityDispatcher abilities, boolean bSwap, float tickDelta) {
|
||||
void renderBackground(DrawContext context, AbilityDispatcher abilities, boolean bSwap, float tickDelta) {
|
||||
|
||||
if (aSlot != bSlot) {
|
||||
bSwap |= !abilities.isFilled(aSlot);
|
||||
|
@ -83,17 +84,17 @@ class Slot {
|
|||
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
RenderSystem.enableBlend();
|
||||
MatrixStack matrices = context.getMatrices();
|
||||
matrices.push();
|
||||
matrices.translate(getX(), getY(), 0);
|
||||
|
||||
// background
|
||||
UHud.drawTexture(matrices, 0, 0, backgroundU, backgroundV, size, size, 128, 128);
|
||||
context.drawTexture(UHud.HUD_TEXTURE, 0, 0, backgroundU, backgroundV, size, size, 128, 128);
|
||||
|
||||
AbilityDispatcher.Stat stat = abilities.getStat(bSwap ? bSlot : aSlot);
|
||||
|
||||
|
||||
int sz = iconSize - slotPadding;
|
||||
uHud.renderAbilityIcon(matrices, stat, slotPadding, slotPadding, sz, sz, sz, sz);
|
||||
uHud.renderAbilityIcon(context, stat, slotPadding, slotPadding, sz, sz, sz, sz);
|
||||
|
||||
float cooldown = stat.getFillProgress();
|
||||
|
||||
|
@ -107,21 +108,22 @@ class Slot {
|
|||
int progressTop = progressBottom - (int)(progressMax * cooldown);
|
||||
|
||||
// progress
|
||||
UHud.fill(matrices, slotPadding, progressTop, size - slotPadding, progressBottom, 0xCFFFFFFF);
|
||||
context.fill(slotPadding, progressTop, size - slotPadding, progressBottom, 0xCFFFFFFF);
|
||||
}
|
||||
|
||||
renderContents(matrices, abilities, bSwap, tickDelta);
|
||||
renderContents(context, abilities, bSwap, tickDelta);
|
||||
matrices.pop();
|
||||
}
|
||||
|
||||
protected void renderContents(MatrixStack matrices, AbilityDispatcher abilities, boolean bSwap, float tickDelta) {
|
||||
protected void renderContents(DrawContext context, AbilityDispatcher abilities, boolean bSwap, float tickDelta) {
|
||||
// contents
|
||||
UHud.drawTexture(matrices, 0, 0, foregroundU, foregroundV, size, size, 128, 128);
|
||||
context.drawTexture(UHud.HUD_TEXTURE, 0, 0, foregroundU, foregroundV, size, size, 128, 128);
|
||||
}
|
||||
|
||||
void renderLabel(MatrixStack matrices, AbilityDispatcher abilities, float tickDelta) {
|
||||
void renderLabel(DrawContext context, AbilityDispatcher abilities, float tickDelta) {
|
||||
Text label = KeyBindingsHandler.INSTANCE.getBinding(aSlot).getLabel();
|
||||
|
||||
MatrixStack matrices = context.getMatrices();
|
||||
matrices.push();
|
||||
|
||||
int x = getX();
|
||||
|
@ -135,7 +137,7 @@ class Slot {
|
|||
matrices.translate(x, getY() + labelY, 0);
|
||||
matrices.scale(0.5F, 0.5F, 0.5F);
|
||||
|
||||
UHud.drawTextWithShadow(matrices, uHud.font, label, 0, 0, 0xFFFFFF);
|
||||
context.drawText(uHud.font, label, 0, 0, 0xFFFFFF, true);
|
||||
|
||||
matrices.pop();
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.minelittlepony.common.client.gui.dimension.Bounds;
|
|||
import com.minelittlepony.common.client.gui.element.Label;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.text.OrderedText;
|
||||
|
||||
public class TextBlock extends Label {
|
||||
|
@ -24,11 +24,11 @@ public class TextBlock extends Label {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) {
|
||||
int textY = (int)(getY() + MinecraftClient.getInstance().textRenderer.fontHeight/1.5F);
|
||||
|
||||
for (OrderedText line : getFont().wrapLines(getStyle().getText(), maxWidth)) {
|
||||
getFont().drawWithShadow(matrices, line, getX(), textY, getStyle().getColor());
|
||||
context.drawText(getFont(), line, getX(), textY, getStyle().getColor(), true);
|
||||
textY += getFont().fontHeight;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ import com.mojang.blaze3d.platform.GlStateManager;
|
|||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.render.GameRenderer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
@ -28,9 +28,8 @@ public class TribeButton extends Button {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
|
||||
public void renderButton(DrawContext context, int mouseX, int mouseY, float partialTicks) {
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexProgram);
|
||||
RenderSystem.setShaderTexture(0, TribeSelectionScreen.TEXTURE);
|
||||
RenderSystem.setShaderColor(1, 1, 1, alpha);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
|
@ -41,18 +40,18 @@ public class TribeButton extends Button {
|
|||
|
||||
MinecraftClient mc = MinecraftClient.getInstance();
|
||||
|
||||
drawTexture(matrices, getX() - 3, getY() - 13, 0, 0, 76, 69);
|
||||
context.drawTexture(TribeSelectionScreen.TEXTURE, getX() - 3, getY() - 13, 0, 0, 76, 69);
|
||||
if (isHovered()) {
|
||||
drawTexture(matrices, getX() - 4, getY() - 14, 76, 0, 78, 71);
|
||||
context.drawTexture(TribeSelectionScreen.TEXTURE, getX() - 4, getY() - 14, 76, 0, 78, 71);
|
||||
|
||||
if (hovered && screenWidth > 0) {
|
||||
Identifier id = Race.REGISTRY.getId(race);
|
||||
drawCenteredTextWithShadow(matrices, getFont(), Text.translatable("gui.unicopia.tribe_selection.describe." + id.getNamespace() + "." + id.getPath()), screenWidth / 2, getY() + height, 0xFFFFFFFF);
|
||||
context.drawCenteredTextWithShadow(getFont(), Text.translatable("gui.unicopia.tribe_selection.describe." + id.getNamespace() + "." + id.getPath()), screenWidth / 2, getY() + height, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
if (getStyle().hasIcon()) {
|
||||
getStyle().getIcon().render(matrices, getX(), getY(), mouseX, mouseY, partialTicks);
|
||||
getStyle().getIcon().render(context, getX(), getY(), mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
int foreColor = getStyle().getColor();
|
||||
|
@ -65,7 +64,7 @@ public class TribeButton extends Button {
|
|||
setMessage(getStyle().getText());
|
||||
|
||||
|
||||
renderForground(matrices, mc, mouseX, mouseY, foreColor | MathHelper.ceil(alpha * 255.0F) << 24);
|
||||
renderForground(context, mc, mouseX, mouseY, foreColor | MathHelper.ceil(alpha * 255.0F) << 24);
|
||||
}
|
||||
|
||||
public static ISprite createSprite(Race race, int x, int y, int size) {
|
||||
|
|
|
@ -6,10 +6,9 @@ import com.minelittlepony.common.client.gui.GameGui;
|
|||
import com.minelittlepony.common.client.gui.element.Button;
|
||||
import com.minelittlepony.common.client.gui.element.Label;
|
||||
import com.minelittlepony.unicopia.Race;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import it.unimi.dsi.fastutil.booleans.BooleanConsumer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.*;
|
||||
|
||||
|
@ -82,10 +81,8 @@ public class TribeConfirmationScreen extends GameGui implements HidesHud {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
renderBackground(matrices);
|
||||
|
||||
RenderSystem.setShaderTexture(0, TribeSelectionScreen.TEXTURE);
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
renderBackground(context);
|
||||
|
||||
final int columnHeight = 180;
|
||||
final int columnWidth = 310;
|
||||
|
@ -98,23 +95,23 @@ public class TribeConfirmationScreen extends GameGui implements HidesHud {
|
|||
|
||||
final int zOffset = 0;
|
||||
|
||||
drawTexture(matrices, left + zOffset, top, 0, 70, 123, columnHeight);
|
||||
context.drawTexture(TribeSelectionScreen.TEXTURE, left + zOffset, top, 0, 70, 123, columnHeight);
|
||||
|
||||
drawTexture(matrices, left + segmentWidth + zOffset, top, 20, 70, 123, columnHeight);
|
||||
context.drawTexture(TribeSelectionScreen.TEXTURE, left + segmentWidth + zOffset, top, 20, 70, 123, columnHeight);
|
||||
|
||||
drawTexture(matrices, width - left - segmentWidth + zOffset, top, 10, 70, 123, columnHeight);
|
||||
context.drawTexture(TribeSelectionScreen.TEXTURE, width - left - segmentWidth + zOffset, top, 10, 70, 123, columnHeight);
|
||||
|
||||
top -= 31;
|
||||
|
||||
left = width / 2;
|
||||
|
||||
drawTexture(matrices, left - 55, top, 140, 70, 21, 50);
|
||||
context.drawTexture(TribeSelectionScreen.TEXTURE, left - 55, top, 140, 70, 21, 50);
|
||||
|
||||
drawTexture(matrices, left - 35, top, 10, 70, 69, 50);
|
||||
context.drawTexture(TribeSelectionScreen.TEXTURE, left - 35, top, 10, 70, 69, 50);
|
||||
|
||||
drawTexture(matrices, left + 35, top, 148, 70, 21, 50);
|
||||
context.drawTexture(TribeSelectionScreen.TEXTURE, left + 35, top, 148, 70, 21, 50);
|
||||
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,7 +10,7 @@ import com.minelittlepony.unicopia.Unicopia;
|
|||
import com.minelittlepony.unicopia.network.Channel;
|
||||
import com.minelittlepony.unicopia.network.MsgRequestSpeciesChange;
|
||||
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
@ -93,9 +93,9 @@ public class TribeSelectionScreen extends GameGui implements HidesHud {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
renderBackground(matrices);
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
renderBackground(context);
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,7 +22,7 @@ import com.mojang.blaze3d.systems.RenderSystem;
|
|||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.hud.InGameHud;
|
||||
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
@ -35,7 +35,7 @@ import net.minecraft.util.*;
|
|||
import net.minecraft.util.math.*;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
|
||||
public class UHud extends DrawableHelper {
|
||||
public class UHud {
|
||||
|
||||
public static final UHud INSTANCE = new UHud();
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class UHud extends DrawableHelper {
|
|||
private boolean prevReplacing;
|
||||
private SpellType<?> focusedType = SpellType.empty();
|
||||
|
||||
public void render(InGameHud hud, MatrixStack matrices, float tickDelta) {
|
||||
public void render(InGameHud hud, DrawContext context, float tickDelta) {
|
||||
|
||||
if (client.player == null) {
|
||||
return;
|
||||
|
@ -81,7 +81,7 @@ public class UHud extends DrawableHelper {
|
|||
|
||||
Pony pony = Pony.of(client.player);
|
||||
|
||||
renderViewEffects(pony, matrices, scaledWidth, scaledHeight, tickDelta);
|
||||
renderViewEffects(pony, context, scaledWidth, scaledHeight, tickDelta);
|
||||
|
||||
if (client.currentScreen instanceof HidesHud || client.player.isSpectator() || client.options.hudHidden) {
|
||||
return;
|
||||
|
@ -90,6 +90,7 @@ public class UHud extends DrawableHelper {
|
|||
font = client.textRenderer;
|
||||
xDirection = client.player.getMainArm() == Arm.LEFT ? -1 : 1;
|
||||
|
||||
MatrixStack matrices = context.getMatrices();
|
||||
matrices.push();
|
||||
|
||||
int hudX = ((scaledWidth - 50) / 2) + (104 * xDirection);
|
||||
|
@ -111,7 +112,7 @@ public class UHud extends DrawableHelper {
|
|||
AbilityDispatcher abilities = pony.getAbilities();
|
||||
|
||||
if (message != null && messageTime > 0) {
|
||||
renderMessage(matrices, tickDelta);
|
||||
renderMessage(context, tickDelta);
|
||||
}
|
||||
|
||||
RenderSystem.setShaderColor(1, 1, 1,1);
|
||||
|
@ -120,7 +121,7 @@ public class UHud extends DrawableHelper {
|
|||
|
||||
boolean swap = client.options.sneakKey.isPressed();
|
||||
|
||||
slots.forEach(slot -> slot.renderBackground(matrices, abilities, swap, tickDelta));
|
||||
slots.forEach(slot -> slot.renderBackground(context, abilities, swap, tickDelta));
|
||||
|
||||
if (pony.getObservedSpecies().canCast()) {
|
||||
AbilitySlot slot = swap ? AbilitySlot.PASSIVE : AbilitySlot.PRIMARY;
|
||||
|
@ -145,18 +146,18 @@ public class UHud extends DrawableHelper {
|
|||
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(-26));
|
||||
matrices.scale(0.8F, 0.8F, 1);
|
||||
int u = replacing ? 16 : 3;
|
||||
UHud.drawTexture(matrices, 0, 0, u, 120, 13, 7, 128, 128);
|
||||
context.drawTexture(HUD_TEXTURE, 0, 0, u, 120, 13, 7, 128, 128);
|
||||
matrices.pop();
|
||||
}
|
||||
}
|
||||
|
||||
slots.forEach(slot -> slot.renderLabel(matrices, abilities, tickDelta));
|
||||
slots.forEach(slot -> slot.renderLabel(context, abilities, tickDelta));
|
||||
|
||||
matrices.pop();
|
||||
|
||||
if (pony.getObservedSpecies().canCast()) {
|
||||
renderSpell(pony.getCharms().getEquippedSpell(Hand.MAIN_HAND), hudX + 10 - xDirection * 13, hudY + 2);
|
||||
renderSpell(pony.getCharms().getEquippedSpell(Hand.OFF_HAND), hudX + 8 - xDirection * 2, hudY - 6);
|
||||
renderSpell(context, pony.getCharms().getEquippedSpell(Hand.MAIN_HAND), hudX + 10 - xDirection * 13, hudY + 2);
|
||||
renderSpell(context, pony.getCharms().getEquippedSpell(Hand.OFF_HAND), hudX + 8 - xDirection * 2, hudY - 6);
|
||||
}
|
||||
|
||||
RenderSystem.disableBlend();
|
||||
|
@ -176,19 +177,16 @@ public class UHud extends DrawableHelper {
|
|||
int x = scaledWidth / 2 + xDirection * 67;
|
||||
int y = (int)(scaledHeight - 18 - dims.height/2F);
|
||||
|
||||
MatrixStack view = RenderSystem.getModelViewStack();
|
||||
|
||||
view.push();
|
||||
view.translate(x, y, 0);
|
||||
view.multiply(RotationAxis.POSITIVE_X.rotationDegrees(xDirection * 45));
|
||||
InventoryScreen.drawEntity(view, 0, 0, scale, 0, -20, client.player);
|
||||
view.pop();
|
||||
RenderSystem.applyModelViewMatrix();
|
||||
matrices.push();
|
||||
matrices.translate(x, y, 0);
|
||||
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(xDirection * 45));
|
||||
InventoryScreen.drawEntity(context, 0, 0, scale, 0, -20, client.player);
|
||||
matrices.pop();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void renderSpell(CustomisedSpellType<?> spell, double x, double y) {
|
||||
public void renderSpell(DrawContext context, CustomisedSpellType<?> spell, double x, double y) {
|
||||
if (spell.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -196,7 +194,7 @@ public class UHud extends DrawableHelper {
|
|||
Pony pony = Pony.of(client.player);
|
||||
|
||||
if (spell.isOn(pony)) {
|
||||
MatrixStack modelStack = new MatrixStack();
|
||||
MatrixStack modelStack = context.getMatrices();
|
||||
|
||||
modelStack.push();
|
||||
modelStack.translate(x + 5.5, y + 5.5, 0);
|
||||
|
@ -215,17 +213,17 @@ public class UHud extends DrawableHelper {
|
|||
modelStack.push();
|
||||
modelStack.translate(1, 1, 900);
|
||||
modelStack.scale(0.8F, 0.8F, 0.8F);
|
||||
font.drawWithShadow(modelStack, count > 64 ? "64+" : String.valueOf(count), 0, 0, 0xFFFFFFFF);
|
||||
context.drawText(font, count > 64 ? "64+" : String.valueOf(count), 0, 0, 0xFFFFFFFF, true);
|
||||
modelStack.pop();
|
||||
}
|
||||
|
||||
modelStack.pop();
|
||||
}
|
||||
|
||||
DrawableUtil.renderItemIcon(spell.getDefaultStack(), x, y, EQUIPPED_GEMSTONE_SCALE);
|
||||
DrawableUtil.renderItemIcon(context, spell.getDefaultStack(), x, y, EQUIPPED_GEMSTONE_SCALE);
|
||||
}
|
||||
|
||||
private void renderMessage(MatrixStack matrices, float tickDelta) {
|
||||
private void renderMessage(DrawContext context, float tickDelta) {
|
||||
float time = messageTime - tickDelta;
|
||||
int progress = Math.min(255, (int)(time * 255F / 20F));
|
||||
|
||||
|
@ -235,11 +233,11 @@ public class UHud extends DrawableHelper {
|
|||
|
||||
color |= alpha;
|
||||
|
||||
drawCenteredTextWithShadow(matrices, client.textRenderer, message, 25, -15, color);
|
||||
context.drawCenteredTextWithShadow(font, message, 25, -15, color);
|
||||
}
|
||||
}
|
||||
|
||||
protected void renderViewEffects(Pony pony, MatrixStack matrices, int scaledWidth, int scaledHeight, float tickDelta) {
|
||||
protected void renderViewEffects(Pony pony, DrawContext context, int scaledWidth, int scaledHeight, float tickDelta) {
|
||||
|
||||
boolean hasEffect = client.player.hasStatusEffect(UEffects.SUN_BLINDNESS);
|
||||
|
||||
|
@ -258,12 +256,12 @@ public class UHud extends DrawableHelper {
|
|||
int color = 0xFFFFFF;
|
||||
|
||||
if (hasEffect) {
|
||||
GradientUtil.fillRadialGradient(matrices, 0, 0, scaledWidth, scaledHeight,
|
||||
GradientUtil.fillRadialGradient(context.getMatrices(), 0, 0, scaledWidth, scaledHeight,
|
||||
color | (alpha1 << 24),
|
||||
color | (alpha2 << 24),
|
||||
0, 1);
|
||||
} else {
|
||||
GradientUtil.fillVerticalGradient(matrices, 0, 0, scaledHeight / 2, scaledWidth, scaledHeight,
|
||||
GradientUtil.fillVerticalGradient(context.getMatrices(), 0, 0, scaledHeight / 2, scaledWidth, scaledHeight,
|
||||
color | (alpha1 << 24),
|
||||
color | (alpha2 << 24),
|
||||
color | (alpha1 << 24),
|
||||
|
@ -277,7 +275,7 @@ public class UHud extends DrawableHelper {
|
|||
final int delay = 7;
|
||||
final int current = client.player.age / delay;
|
||||
final int tint = DyeColor.byId(current % DyeColor.values().length).getSignColor();
|
||||
fillGradient(matrices, 0, 0, scaledWidth, scaledHeight, 0x1F000000 | tint, 0x5F000000 | tint);
|
||||
context.fillGradient(0, 0, scaledWidth, scaledHeight, 0x1F000000 | tint, 0x5F000000 | tint);
|
||||
|
||||
if (partySound == null || partySound.isDone()) {
|
||||
client.getSoundManager().play(
|
||||
|
@ -292,7 +290,7 @@ public class UHud extends DrawableHelper {
|
|||
if (partySound != null) {
|
||||
partySound.setMuted(true);
|
||||
}
|
||||
fillGradient(matrices, 0, 0, scaledWidth, scaledHeight, 0x0A000088, 0x7E000000);
|
||||
context.fillGradient(0, 0, scaledWidth, scaledHeight, 0x0A000088, 0x7E000000);
|
||||
}
|
||||
} else {
|
||||
if (partySound != null) {
|
||||
|
@ -302,7 +300,7 @@ public class UHud extends DrawableHelper {
|
|||
|
||||
if (UItems.ALICORN_AMULET.isApplicable(client.player)) {
|
||||
float radius = (float)pony.getArmour().getTicks(UItems.ALICORN_AMULET) / (5 * ItemTracker.DAYS);
|
||||
renderVignette(matrices, 0x000000, radius, radius, scaledWidth, scaledHeight);
|
||||
renderVignette(context, 0x000000, radius, radius, scaledWidth, scaledHeight);
|
||||
}
|
||||
|
||||
float exhaustion = MathHelper.clamp(pony.getMagicalReserves().getExhaustion().getPercentFill(), 0, 0.6F);
|
||||
|
@ -319,11 +317,11 @@ public class UHud extends DrawableHelper {
|
|||
float rate = exhaustion > 0.5F ? 2.5F : 7F;
|
||||
float radius = (1 + (float)Math.sin(client.player.age / rate)) / 2F;
|
||||
|
||||
renderVignette(matrices, 0x880000, exhaustion * radius, 0.1F + radius * 0.3F, scaledWidth, scaledHeight);
|
||||
renderVignette(context, 0x880000, exhaustion * radius, 0.1F + radius * 0.3F, scaledWidth, scaledHeight);
|
||||
}
|
||||
}
|
||||
|
||||
private void renderVignette(MatrixStack matrices, int color, float alpha, float radius, int scaledWidth, int scaledHeight) {
|
||||
private void renderVignette(DrawContext context, int color, float alpha, float radius, int scaledWidth, int scaledHeight) {
|
||||
if (radius <= 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -331,7 +329,7 @@ public class UHud extends DrawableHelper {
|
|||
color &= 0xFFFFFF;
|
||||
float alpha2 = MathHelper.clamp(radius - 1, 0, 1) * 255;
|
||||
float alpha1 = Math.max(alpha2, MathHelper.clamp(alpha * 2, 0, 1) * 205);
|
||||
GradientUtil.fillRadialGradient(matrices, 0, 0, scaledWidth, scaledHeight,
|
||||
GradientUtil.fillRadialGradient(context.getMatrices(), 0, 0, scaledWidth, scaledHeight,
|
||||
color | (int)alpha1 << 24,
|
||||
color | (int)alpha2 << 24,
|
||||
0, Math.min(1, radius));
|
||||
|
@ -348,11 +346,9 @@ public class UHud extends DrawableHelper {
|
|||
}
|
||||
}
|
||||
|
||||
void renderAbilityIcon(MatrixStack matrices, AbilityDispatcher.Stat stat, int x, int y, int u, int v, int frameWidth, int frameHeight) {
|
||||
void renderAbilityIcon(DrawContext context, AbilityDispatcher.Stat stat, int x, int y, int u, int v, int frameWidth, int frameHeight) {
|
||||
stat.getAbility(Unicopia.getConfig().hudPage.get()).ifPresent(ability -> {
|
||||
RenderSystem.setShaderTexture(0, ability.getIcon(Pony.of(client.player)));
|
||||
drawTexture(matrices, x, y, 0, 0, frameWidth, frameHeight, u, v);
|
||||
RenderSystem.setShaderTexture(0, HUD_TEXTURE);
|
||||
context.drawTexture(ability.getIcon(Pony.of(client.player)), x, y, 0, 0, frameWidth, frameHeight, u, v);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.minelittlepony.unicopia.container.SpellbookChapterLoader.Flow;
|
|||
import com.minelittlepony.unicopia.container.SpellbookState;
|
||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.text.Text;
|
||||
|
@ -30,17 +31,17 @@ public class DynamicContent implements Content {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void draw(MatrixStack matrices, int mouseX, int mouseY, IViewRoot container) {
|
||||
public void draw(DrawContext context, int mouseX, int mouseY, IViewRoot container) {
|
||||
int pageIndex = state.getOffset() * 2;
|
||||
|
||||
getPage(pageIndex).ifPresent(page -> page.draw(matrices, mouseX, mouseY, container));
|
||||
getPage(pageIndex).ifPresent(page -> page.draw(context, mouseX, mouseY, container));
|
||||
|
||||
matrices.push();
|
||||
context.getMatrices().push();
|
||||
getPage(pageIndex + 1).ifPresent(page -> {
|
||||
page.bounds.left = bounds.left + bounds.width / 2 + 20;
|
||||
page.draw(matrices, mouseX, mouseY, container);
|
||||
page.draw(context, mouseX, mouseY, container);
|
||||
});
|
||||
matrices.pop();
|
||||
context.getMatrices().pop();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -123,7 +124,7 @@ public class DynamicContent implements Content {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void draw(MatrixStack matrices, int mouseX, int mouseY, IViewRoot container) {
|
||||
public void draw(DrawContext context, int mouseX, int mouseY, IViewRoot container) {
|
||||
|
||||
if (elements.isEmpty()) {
|
||||
return;
|
||||
|
@ -142,8 +143,9 @@ public class DynamicContent implements Content {
|
|||
|
||||
int headerColor = mouseY % 255;
|
||||
|
||||
DrawableUtil.drawScaledText(matrices, needsMoreXp ? UNKNOWN : title, bounds.left, bounds.top - 10, 1.3F, headerColor);
|
||||
DrawableUtil.drawScaledText(matrices, level < 0 ? UNKNOWN_LEVEL : Text.literal("Level: " + (level + 1)).formatted(Formatting.DARK_GREEN), bounds.left, bounds.top - 10 + 12, 0.8F, headerColor);
|
||||
MatrixStack matrices = context.getMatrices();
|
||||
DrawableUtil.drawScaledText(context, needsMoreXp ? UNKNOWN : title, bounds.left, bounds.top - 10, 1.3F, headerColor);
|
||||
DrawableUtil.drawScaledText(context, level < 0 ? UNKNOWN_LEVEL : Text.literal("Level: " + (level + 1)).formatted(Formatting.DARK_GREEN), bounds.left, bounds.top - 10 + 12, 0.8F, headerColor);
|
||||
|
||||
matrices.push();
|
||||
matrices.translate(bounds.left, bounds.top + 16, 0);
|
||||
|
@ -151,13 +153,13 @@ public class DynamicContent implements Content {
|
|||
Bounds bounds = element.bounds();
|
||||
matrices.push();
|
||||
bounds.translate(matrices);
|
||||
element.draw(matrices, mouseX, mouseY, container);
|
||||
element.draw(context, mouseX, mouseY, container);
|
||||
matrices.pop();
|
||||
});
|
||||
|
||||
matrices.push();
|
||||
elements.stream().filter(PageElement::isInline).forEach(element -> {
|
||||
element.draw(matrices, mouseX, mouseY, container);
|
||||
element.draw(context, mouseX, mouseY, container);
|
||||
matrices.translate(0, element.bounds().height, 0);
|
||||
});
|
||||
matrices.pop();
|
||||
|
|
|
@ -9,11 +9,11 @@ import com.minelittlepony.unicopia.ability.magic.spell.effect.CustomisedSpellTyp
|
|||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
||||
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;
|
||||
|
||||
public class EquippedSpellSlot extends Button {
|
||||
|
||||
|
@ -33,34 +33,32 @@ public class EquippedSpellSlot extends Button {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float tickDelta) {
|
||||
public void renderButton(DrawContext context, int mouseX, int mouseY, float tickDelta) {
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
RenderSystem.setShaderTexture(0, SpellbookScreen.SLOT);
|
||||
RenderSystem.enableBlend();
|
||||
|
||||
drawTexture(matrices, getX() - 8, getY() - 8, 0, 0, 32, 32, 32, 32);
|
||||
context.drawTexture(SpellbookScreen.SLOT, getX() - 8, getY() - 8, 0, 0, 32, 32, 32, 32);
|
||||
|
||||
Vector4f pos = new Vector4f(getX(), getY(), 0, 1);
|
||||
pos.mul(matrices.peek().getPositionMatrix());
|
||||
pos.mul(context.getMatrices().peek().getPositionMatrix());
|
||||
|
||||
if (spell.isEmpty()) {
|
||||
RenderSystem.setShaderColor(1, 1, 1, 0.3F);
|
||||
RenderSystem.setShaderTexture(0, SpellbookScreen.GEM);
|
||||
drawTexture(matrices, getX(), getY(), 0, 0, 16, 16, 16, 16);
|
||||
context.drawTexture(SpellbookScreen.GEM, getX(), getY(), 0, 0, 16, 16, 16, 16);
|
||||
RenderSystem.disableBlend();
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
} else {
|
||||
RenderSystem.disableBlend();
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
drawItem(matrices, (int)pos.x, (int)pos.y);
|
||||
drawItem(context, (int)pos.x, (int)pos.y);
|
||||
}
|
||||
if (isHovered()) {
|
||||
HandledScreen.drawSlotHighlight(matrices, getX(), getY(), 0);
|
||||
HandledScreen.drawSlotHighlight(context, getX(), getY(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawItem(MatrixStack matrices, int x, int y) {
|
||||
itemRenderer.renderInGui(matrices, spell.getDefaultStack(), x, y);
|
||||
protected void drawItem(DrawContext context, int x, int y) {
|
||||
context.drawItem(spell.getDefaultStack(), x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -14,6 +14,7 @@ import com.minelittlepony.unicopia.client.render.PassThroughVertexConsumer;
|
|||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.item.TooltipContext;
|
||||
import net.minecraft.client.render.*;
|
||||
import net.minecraft.client.render.item.ItemRenderer;
|
||||
|
@ -133,22 +134,22 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float tickDelta) {
|
||||
public void renderButton(DrawContext context, int mouseX, int mouseY, float tickDelta) {
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
RenderSystem.setShaderTexture(0, SpellbookScreen.SLOT);
|
||||
RenderSystem.enableBlend();
|
||||
|
||||
drawTexture(matrices, getX() - 8, getY() - 10, 0, 0, 32, 32, 32, 32);
|
||||
context.drawTexture(SpellbookScreen.SLOT, getX() - 8, getY() - 10, 0, 0, 32, 32, 32, 32);
|
||||
|
||||
RenderSystem.disableBlend();
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
|
||||
MinecraftClient.getInstance().textRenderer.draw(matrices, label,
|
||||
context.drawText(getFont(), label,
|
||||
getX() - MinecraftClient.getInstance().textRenderer.getWidth(label) / 2 - 3,
|
||||
getY() + 4,
|
||||
0
|
||||
0,
|
||||
false
|
||||
);
|
||||
entry.render(matrices, getX(), getY(), tickDelta);
|
||||
entry.render(context, getX(), getY(), tickDelta);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,7 +163,7 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder {
|
|||
return Multiple.of(Arrays.stream(traits).map(t -> new Traits(t, value)).toArray(Entry[]::new));
|
||||
}
|
||||
|
||||
void render(MatrixStack matrices, int mouseX, int mouseY, float tickDelta);
|
||||
void render(DrawContext context, int mouseX, int mouseY, float tickDelta);
|
||||
|
||||
Tooltip getTooltip();
|
||||
|
||||
|
@ -177,7 +178,7 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder {
|
|||
static final IngredientTree.Entry EMPTY = new IngredientTree.Entry() {
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float tickDelta) {}
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float tickDelta) {}
|
||||
|
||||
@Override
|
||||
public void onClick() { }
|
||||
|
@ -203,14 +204,14 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int x, int y, float tickDelta) {
|
||||
public void render(DrawContext context, int x, int y, float tickDelta) {
|
||||
y -= 2;
|
||||
|
||||
if (ticker++ % 30 == 0) {
|
||||
index = (index + 1) % entries.length;
|
||||
}
|
||||
|
||||
entries[index].render(matrices, x, y, tickDelta);
|
||||
entries[index].render(context, x, y, tickDelta);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -235,12 +236,12 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int x, int y, float tickDelta) {
|
||||
drawItem(matrices, x, y - 2);
|
||||
public void render(DrawContext context, int x, int y, float tickDelta) {
|
||||
drawItem(context, x, y - 2);
|
||||
}
|
||||
|
||||
protected void drawItem(MatrixStack matrices, int x, int y) {
|
||||
itemRenderer.renderInGui(matrices, stack, x, y);
|
||||
protected void drawItem(DrawContext context, int x, int y) {
|
||||
context.drawItem(stack, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -261,7 +262,7 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder {
|
|||
|
||||
static class HiddenStacks extends Stacks {
|
||||
private static final PassThroughVertexConsumer.Parameters FIXTURE = new PassThroughVertexConsumer.Parameters().color((parent, r, g, b, a) -> {
|
||||
parent.color(0, 0, 0, a);
|
||||
parent.color(0, 0, 0, 0.6F);
|
||||
});
|
||||
|
||||
HiddenStacks(ItemStack stack) {
|
||||
|
@ -269,17 +270,18 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void drawItem(MatrixStack matrices, int x, int y) {
|
||||
protected void drawItem(DrawContext context, int x, int y) {
|
||||
var model = itemRenderer.getModel(stack, null, null, 0);
|
||||
|
||||
MinecraftClient.getInstance().getTextureManager().getTexture(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE).setFilter(false, false);
|
||||
RenderSystem.setShaderTexture(0, PlayerScreenHandler.BLOCK_ATLAS_TEXTURE);
|
||||
MatrixStack matrices = context.getMatrices();
|
||||
matrices.push();
|
||||
matrices.translate(x, y, 100);
|
||||
matrices.translate(8, 8, 0);
|
||||
matrices.scale(1, -1, 1);
|
||||
matrices.scale(8, 8, 8);
|
||||
VertexConsumerProvider.Immediate immediate = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers();
|
||||
VertexConsumerProvider.Immediate immediate = context.getVertexConsumers();
|
||||
boolean bl = !model.isSideLit();
|
||||
if (bl) {
|
||||
DiffuseLighting.disableGuiDepthLighting();
|
||||
|
@ -316,8 +318,8 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int x, int y, float tickDelta) {
|
||||
ItemTraitsTooltipRenderer.renderTraitIcon(trait, value, matrices, x, y);
|
||||
public void render(DrawContext context, int x, int y, float tickDelta) {
|
||||
ItemTraitsTooltipRenderer.renderTraitIcon(trait, value, context, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,11 +11,10 @@ import com.minelittlepony.unicopia.client.gui.ParagraphWrappingVisitor;
|
|||
import com.minelittlepony.unicopia.client.gui.spellbook.SpellbookChapterList.Drawable;
|
||||
import com.minelittlepony.unicopia.container.SpellbookChapterLoader.Flow;
|
||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.text.Style;
|
||||
|
@ -24,7 +23,7 @@ import net.minecraft.util.*;
|
|||
|
||||
interface PageElement extends Drawable {
|
||||
@Override
|
||||
default void draw(MatrixStack matrices, int mouseX, int mouseY, IViewRoot container) {
|
||||
default void draw(DrawContext context, int mouseX, int mouseY, IViewRoot container) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -64,10 +63,8 @@ interface PageElement extends Drawable {
|
|||
Bounds bounds,
|
||||
Flow flow) implements PageElement {
|
||||
@Override
|
||||
public void draw(MatrixStack matrices, int mouseX, int mouseY, IViewRoot container) {
|
||||
RenderSystem.setShaderTexture(0, texture);
|
||||
DrawableHelper.drawTexture(matrices, 0, 0, 0, 0, 0, bounds().width, bounds().height, bounds().width, bounds().height);
|
||||
RenderSystem.setShaderTexture(0, SpellbookScreen.TEXTURE);
|
||||
public void draw(DrawContext context, int mouseX, int mouseY, IViewRoot container) {
|
||||
context.drawTexture(texture, 0, 0, 0, 0, 0, bounds().width, bounds().height, bounds().width, bounds().height);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,12 +93,13 @@ interface PageElement extends Drawable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void draw(MatrixStack matrices, int mouseX, int mouseY, IViewRoot container) {
|
||||
public void draw(DrawContext context, int mouseX, int mouseY, IViewRoot container) {
|
||||
TextRenderer font = MinecraftClient.getInstance().textRenderer;
|
||||
boolean needsMoreXp = page.getLevel() < 0 || Pony.of(MinecraftClient.getInstance().player).getLevel().get() < page.getLevel();
|
||||
MatrixStack matrices = context.getMatrices();
|
||||
matrices.push();
|
||||
wrappedText.forEach(line -> {
|
||||
font.draw(matrices, needsMoreXp ? line.text().copy().formatted(Formatting.OBFUSCATED) : line.text().copy(), line.x(), 0, 0);
|
||||
context.drawText(font, needsMoreXp ? line.text().copy().formatted(Formatting.OBFUSCATED) : line.text().copy(), line.x(), 0, 0, false);
|
||||
matrices.translate(0, font.fontHeight, 0);
|
||||
});
|
||||
matrices.pop();
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.minelittlepony.common.client.gui.IViewRoot;
|
|||
import com.minelittlepony.unicopia.Debug;
|
||||
import com.minelittlepony.unicopia.Unicopia;
|
||||
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class SpellbookChapterList {
|
||||
|
@ -89,14 +89,14 @@ public class SpellbookChapterList {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void draw(MatrixStack matrices, int mouseX, int mouseY, IViewRoot container) {
|
||||
obj.draw(matrices, mouseX, mouseY, container);
|
||||
public void draw(DrawContext context, int mouseX, int mouseY, IViewRoot container) {
|
||||
obj.draw(context, mouseX, mouseY, container);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public interface Drawable {
|
||||
void draw(MatrixStack matrices, int mouseX, int mouseY, IViewRoot container);
|
||||
void draw(DrawContext context, int mouseX, int mouseY, IViewRoot container);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.minelittlepony.unicopia.container.SpellbookState;
|
|||
import com.minelittlepony.unicopia.item.URecipes;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
@ -40,14 +41,14 @@ public class SpellbookCraftingPageContent extends ScrollContainer implements Spe
|
|||
}
|
||||
|
||||
@Override
|
||||
public void draw(MatrixStack matrices, int mouseX, int mouseY, IViewRoot container) {
|
||||
public void draw(DrawContext context, int mouseX, int mouseY, IViewRoot container) {
|
||||
|
||||
int headerColor = mouseY % 255;
|
||||
|
||||
DrawableUtil.drawScaledText(matrices, state.getOffset() == 0 ? INVENTORY_TITLE : RECIPES_TITLE, screen.getFrameBounds().left + screen.getFrameBounds().width / 2 + 20, SpellbookScreen.TITLE_Y, 1.3F, headerColor);
|
||||
DrawableUtil.drawScaledText(context, state.getOffset() == 0 ? INVENTORY_TITLE : RECIPES_TITLE, screen.getFrameBounds().left + screen.getFrameBounds().width / 2 + 20, SpellbookScreen.TITLE_Y, 1.3F, headerColor);
|
||||
|
||||
Text pageText = Text.translatable("%s/%s", state.getOffset() + 1, TOTAL_PAGES);
|
||||
textRenderer.draw(matrices, pageText, 337 - textRenderer.getWidth(pageText) / 2F, 190, headerColor);
|
||||
context.drawText(textRenderer, pageText, (int)(337 - textRenderer.getWidth(pageText) / 2F), 190, headerColor, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -97,35 +98,35 @@ public class SpellbookCraftingPageContent extends ScrollContainer implements Spe
|
|||
}
|
||||
|
||||
@Override
|
||||
public void drawOverlays(MatrixStack matrices, int mouseX, int mouseY, float tickDelta) {
|
||||
public void drawOverlays(DrawContext context, int mouseX, int mouseY, float tickDelta) {
|
||||
MatrixStack matrices = context.getMatrices();
|
||||
matrices.push();
|
||||
matrices.translate(margin.left, margin.top, 0);
|
||||
matrices.translate(-2, -2, 200);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.setShaderTexture(0, SpellbookScreen.TEXTURE);
|
||||
int tileSize = 25;
|
||||
|
||||
final int bottom = height - tileSize + 4;
|
||||
final int right = width - tileSize + 9;
|
||||
|
||||
drawTexture(matrices, 0, 0, 405, 62, tileSize, tileSize, 512, 256);
|
||||
drawTexture(matrices, right, 0, 425, 62, tileSize, tileSize, 512, 256);
|
||||
context.drawTexture(SpellbookScreen.TEXTURE, 0, 0, 405, 62, tileSize, tileSize, 512, 256);
|
||||
context.drawTexture(SpellbookScreen.TEXTURE, right, 0, 425, 62, tileSize, tileSize, 512, 256);
|
||||
|
||||
drawTexture(matrices, 0, bottom, 405, 72, tileSize, tileSize, 512, 256);
|
||||
drawTexture(matrices, right, bottom, 425, 72, tileSize, tileSize, 512, 256);
|
||||
context.drawTexture(SpellbookScreen.TEXTURE, 0, bottom, 405, 72, tileSize, tileSize, 512, 256);
|
||||
context.drawTexture(SpellbookScreen.TEXTURE, right, bottom, 425, 72, tileSize, tileSize, 512, 256);
|
||||
|
||||
for (int i = tileSize; i < right; i += tileSize) {
|
||||
drawTexture(matrices, i, 0, 415, 62, tileSize, tileSize, 512, 256);
|
||||
drawTexture(matrices, i, bottom, 415, 72, tileSize, tileSize, 512, 256);
|
||||
context.drawTexture(SpellbookScreen.TEXTURE, i, 0, 415, 62, tileSize, tileSize, 512, 256);
|
||||
context.drawTexture(SpellbookScreen.TEXTURE, i, bottom, 415, 72, tileSize, tileSize, 512, 256);
|
||||
}
|
||||
|
||||
for (int i = tileSize; i < bottom; i += tileSize) {
|
||||
drawTexture(matrices, 0, i, 405, 67, tileSize, tileSize, 512, 256);
|
||||
drawTexture(matrices, right, i, 425, 67, tileSize, tileSize, 512, 256);
|
||||
context.drawTexture(SpellbookScreen.TEXTURE, 0, i, 405, 67, tileSize, tileSize, 512, 256);
|
||||
context.drawTexture(SpellbookScreen.TEXTURE, right, i, 425, 67, tileSize, tileSize, 512, 256);
|
||||
}
|
||||
matrices.pop();
|
||||
screen.drawSlots(matrices, mouseX, mouseY, tickDelta);
|
||||
screen.drawSlots(context, mouseX, mouseY, tickDelta);
|
||||
|
||||
super.drawOverlays(matrices, mouseX, mouseY, tickDelta);
|
||||
super.drawOverlays(context, mouseX, mouseY, tickDelta);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,14 +9,14 @@ import com.sollace.romanizer.api.Romanizer;
|
|||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
public class SpellbookProfilePageContent extends DrawableHelper implements SpellbookChapterList.Content {
|
||||
public class SpellbookProfilePageContent implements SpellbookChapterList.Content {
|
||||
private final MinecraftClient client = MinecraftClient.getInstance();
|
||||
private final Pony pony = Pony.of(client.player);
|
||||
private final TextRenderer font = client.textRenderer;
|
||||
|
@ -63,7 +63,7 @@ public class SpellbookProfilePageContent extends DrawableHelper implements Spell
|
|||
}
|
||||
|
||||
@Override
|
||||
public void draw(MatrixStack matrices, int mouseX, int mouseY, IViewRoot container) {
|
||||
public void draw(DrawContext context, int mouseX, int mouseY, IViewRoot container) {
|
||||
|
||||
int y = SpellbookScreen.TITLE_Y;
|
||||
|
||||
|
@ -72,8 +72,8 @@ public class SpellbookProfilePageContent extends DrawableHelper implements Spell
|
|||
float currentScaledLevel = pony.getLevel().getScaled(1);
|
||||
float currentCorruption = pony.getCorruption().getScaled(1);
|
||||
|
||||
DrawableUtil.drawScaledText(matrices, pony.asEntity().getName(), SpellbookScreen.TITLE_X, y, 1.3F, SpellbookScreen.TITLE_COLOR);
|
||||
DrawableUtil.drawScaledText(matrices, ExperienceGroup.forLevel(
|
||||
DrawableUtil.drawScaledText(context, pony.asEntity().getName(), SpellbookScreen.TITLE_X, y, 1.3F, SpellbookScreen.TITLE_COLOR);
|
||||
DrawableUtil.drawScaledText(context, ExperienceGroup.forLevel(
|
||||
currentScaledLevel,
|
||||
currentCorruption
|
||||
), SpellbookScreen.TITLE_X, y + 13, 0.8F,
|
||||
|
@ -85,10 +85,11 @@ public class SpellbookProfilePageContent extends DrawableHelper implements Spell
|
|||
|
||||
MagicReserves reserves = pony.getMagicalReserves();
|
||||
|
||||
MatrixStack matrices = context.getMatrices();
|
||||
matrices.push();
|
||||
matrices.translate(screen.getBackgroundWidth() / 2 + SpellbookScreen.TITLE_X - 10, y, 0);
|
||||
matrices.scale(1.3F, 1.3F, 1);
|
||||
font.draw(matrices, SpellbookCraftingPageContent.INVENTORY_TITLE, 0, 0, SpellbookScreen.TITLE_COLOR);
|
||||
context.drawText(font, SpellbookCraftingPageContent.INVENTORY_TITLE, 0, 0, SpellbookScreen.TITLE_COLOR, false);
|
||||
matrices.pop();
|
||||
|
||||
Bounds bounds = screen.getFrameBounds();
|
||||
|
@ -139,26 +140,26 @@ public class SpellbookProfilePageContent extends DrawableHelper implements Spell
|
|||
String manaString = (int)reserves.getMana().get() + "/" + (int)reserves.getMana().getMax();
|
||||
|
||||
y = 15;
|
||||
font.draw(matrices, "Mana", -font.getWidth("Mana") / 2, y, SpellbookScreen.TITLE_COLOR);
|
||||
font.draw(matrices, manaString, -font.getWidth(manaString) / 2, y += font.fontHeight, SpellbookScreen.TITLE_COLOR);
|
||||
context.drawText(font, "Mana", -font.getWidth("Mana") / 2, y, SpellbookScreen.TITLE_COLOR, false);
|
||||
context.drawText(font, manaString, -font.getWidth(manaString) / 2, y += font.fontHeight, SpellbookScreen.TITLE_COLOR, false);
|
||||
|
||||
Text levelString = Text.literal(Romanizer.romanize(currentLevel + 1));
|
||||
|
||||
matrices.translate(-font.getWidth(levelString), -35, 0);
|
||||
matrices.scale(2F, 2F, 1);
|
||||
font.draw(matrices, levelString, 0, 0, SpellbookScreen.TITLE_COLOR);
|
||||
context.drawText(font, levelString, 0, 0, SpellbookScreen.TITLE_COLOR, false);
|
||||
matrices.pop();
|
||||
|
||||
matrices.push();
|
||||
matrices.translate(-screen.getX(), -screen.getY(), 0);
|
||||
screen.drawSlots(matrices, mouseX, mouseY, 0);
|
||||
screen.drawSlots(context, mouseX, mouseY, 0);
|
||||
matrices.pop();
|
||||
}
|
||||
|
||||
static void drawBar(MatrixStack matrices, int x, int y, float value, int color) {
|
||||
static void drawBar(DrawContext context, int x, int y, float value, int color) {
|
||||
int barWidth = 40;
|
||||
int midpoint = x + (int)(barWidth * value);
|
||||
fill(matrices, x, y, midpoint, y + 5, 0xFFAAFFFF);
|
||||
fill(matrices, midpoint, y, x + barWidth, y + 5, color);
|
||||
context.fill(x, y, midpoint, y + 5, 0xFFAAFFFF);
|
||||
context.fill(midpoint, y, x + barWidth, y + 5, color);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import com.minelittlepony.unicopia.network.MsgSpellbookStateChanged;
|
|||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.Drawable;
|
||||
import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
||||
import net.minecraft.client.gui.screen.recipebook.RecipeBookProvider;
|
||||
|
@ -27,7 +28,6 @@ import net.minecraft.client.render.GameRenderer;
|
|||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.screen.slot.Slot;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
@ -70,7 +70,7 @@ public class SpellbookScreen extends HandledScreen<SpellbookScreenHandler> imple
|
|||
return chapters.getCurrentChapter() == craftingChapter;
|
||||
});
|
||||
handler.getSpellbookState().setSynchronizer(state -> {
|
||||
Channel.CLIENT_SPELLBOOK_UPDATE.sendToServer(new MsgSpellbookStateChanged<ServerPlayerEntity>(handler.syncId, state));
|
||||
Channel.CLIENT_SPELLBOOK_UPDATE.sendToServer(MsgSpellbookStateChanged.create(handler, state));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -133,21 +133,19 @@ public class SpellbookScreen extends HandledScreen<SpellbookScreenHandler> imple
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) {
|
||||
if (getState().isDirty()) {
|
||||
clearAndInit();
|
||||
}
|
||||
super.render(matrices, mouseX, mouseY, partialTicks);
|
||||
drawMouseoverTooltip(matrices, mouseX, mouseY);
|
||||
super.render(context, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawBackground(MatrixStack matrices, float delta, int mouseX, int mouseY) {
|
||||
renderBackground(matrices);
|
||||
protected void drawBackground(DrawContext context, float delta, int mouseX, int mouseY) {
|
||||
renderBackground(context);
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
RenderSystem.setShaderTexture(0, TEXTURE);
|
||||
|
||||
drawTexture(matrices, x, y, 0, 0, backgroundWidth, backgroundHeight, 512, 256);
|
||||
context.drawTexture(TEXTURE, x, y, 0, 0, backgroundWidth, backgroundHeight, 512, 256);
|
||||
|
||||
if (Debug.DEBUG_SPELLBOOK_CHAPTERS) {
|
||||
clearAndInit();
|
||||
|
@ -169,43 +167,41 @@ public class SpellbookScreen extends HandledScreen<SpellbookScreenHandler> imple
|
|||
|
||||
boolean isRight = tab.chapter().side() == TabSide.RIGHT;
|
||||
|
||||
drawTexture(matrices, bounds.left, bounds.top, isRight ? 510 - bounds.width : 402, v, bounds.width, bounds.height, 512, 256);
|
||||
context.drawTexture(TEXTURE, bounds.left, bounds.top, isRight ? 510 - bounds.width : 402, v, bounds.width, bounds.height, 512, 256);
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
|
||||
RenderSystem.setShaderTexture(0, tab.icon().get());
|
||||
drawTexture(matrices, isRight ? bounds.left + bounds.width - 16 - 10 : bounds.left + 10, bounds.top + (bounds.height - 16) / 2, 0, 0, 16, 16, 16, 16);
|
||||
context.drawTexture(TEXTURE, isRight ? bounds.left + bounds.width - 16 - 10 : bounds.left + 10, bounds.top + (bounds.height - 16) / 2, 0, 0, 16, 16, 16, 16);
|
||||
RenderSystem.setShaderTexture(0, TEXTURE);
|
||||
});
|
||||
|
||||
MatrixStack matrices = context.getMatrices();
|
||||
matrices.push();
|
||||
matrices.translate(x, y, 0);
|
||||
chapters.getCurrentChapter().content().ifPresent(content -> content.draw(matrices, mouseX, mouseY, (IViewRoot)this));
|
||||
chapters.getCurrentChapter().content().ifPresent(content -> content.draw(context, mouseX, mouseY, (IViewRoot)this));
|
||||
matrices.pop();
|
||||
}
|
||||
|
||||
void drawSlots(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
void drawSlots(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
MatrixStack matrices = context.getMatrices();
|
||||
matrices.push();
|
||||
matrices.translate(x, y, 0);
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
RenderSystem.setShaderTexture(0, SLOT);
|
||||
RenderSystem.enableBlend();
|
||||
|
||||
for (Slot slot : handler.slots) {
|
||||
if (slot.isEnabled() && slot instanceof SpellbookSlot p) {
|
||||
drawTexture(matrices, slot.x - 8, slot.y - 8, 0, 0, 32, 32, 32, 32);
|
||||
context.drawTexture(SLOT, slot.x - 8, slot.y - 8, 0, 0, 32, 32, 32, 32);
|
||||
|
||||
if (slot instanceof InputSlot) {
|
||||
RenderSystem.setShaderColor(1, 1, 1, 0.3F);
|
||||
RenderSystem.setShaderTexture(0, GEM);
|
||||
drawTexture(matrices, slot.x, slot.y, 0, 0, 16, 16, 16, 16);
|
||||
context.drawTexture(GEM, slot.x, slot.y, 0, 0, 16, 16, 16, 16);
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
RenderSystem.setShaderTexture(0, SLOT);
|
||||
}
|
||||
|
||||
if (!(p instanceof InventorySlot)) {
|
||||
float weight = p.getWeight();
|
||||
ItemTraitsTooltipRenderer.renderStackTraits(slot.getStack(), matrices, slot.x, slot.y, weight == 0 ? 1 : weight, delta, slot.id);
|
||||
RenderSystem.setShaderTexture(0, SLOT);
|
||||
ItemTraitsTooltipRenderer.renderStackTraits(slot.getStack(), context, slot.x, slot.y, weight == 0 ? 1 : weight, delta, slot.id);
|
||||
RenderSystem.enableBlend();
|
||||
}
|
||||
}
|
||||
|
@ -216,7 +212,7 @@ public class SpellbookScreen extends HandledScreen<SpellbookScreenHandler> imple
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void drawForeground(MatrixStack matrices, int mouseX, int mouseY) {
|
||||
protected void drawForeground(DrawContext context, int mouseX, int mouseY) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -271,7 +267,7 @@ public class SpellbookScreen extends HandledScreen<SpellbookScreenHandler> imple
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float tickDelta) {
|
||||
public void renderButton(DrawContext context, int mouseX, int mouseY, float tickDelta) {
|
||||
if (!active) {
|
||||
return;
|
||||
}
|
||||
|
@ -279,7 +275,7 @@ public class SpellbookScreen extends HandledScreen<SpellbookScreenHandler> imple
|
|||
int state = hovered ? 1 : 0;
|
||||
|
||||
sprite.setTextureOffset(23 * state, (int)(479 + 6.5F - (increment * 6.5F)));
|
||||
super.renderButton(matrices, mouseX, mouseY, tickDelta);
|
||||
super.renderButton(context, mouseX, mouseY, tickDelta);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -294,7 +290,7 @@ public class SpellbookScreen extends HandledScreen<SpellbookScreenHandler> imple
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float tickDelta) {
|
||||
public void renderButton(DrawContext context, int mouseX, int mouseY, float tickDelta) {
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexProgram);
|
||||
|
||||
RenderSystem.setShaderColor(1, 1, 1, alpha);
|
||||
|
@ -304,7 +300,7 @@ public class SpellbookScreen extends HandledScreen<SpellbookScreenHandler> imple
|
|||
GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
if (getStyle().hasIcon()) {
|
||||
getStyle().getIcon().render(matrices, getX(), getY(), mouseX, mouseY, tickDelta);
|
||||
getStyle().getIcon().render(context, getX(), getY(), mouseX, mouseY, tickDelta);
|
||||
}
|
||||
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
|
|
|
@ -16,7 +16,7 @@ import com.minelittlepony.unicopia.item.group.ItemGroupRegistry;
|
|||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
|
@ -24,7 +24,7 @@ import net.minecraft.text.Text;
|
|||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.Util;
|
||||
|
||||
public class SpellbookTraitDexPageContent extends DrawableHelper implements SpellbookChapterList.Content, SpellbookScreen.RecipesChangedListener {
|
||||
public class SpellbookTraitDexPageContent implements SpellbookChapterList.Content, SpellbookScreen.RecipesChangedListener {
|
||||
private final Trait[] traits = Trait.values();
|
||||
private SpellbookState.PageState state = new SpellbookState.PageState();
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class SpellbookTraitDexPageContent extends DrawableHelper implements Spel
|
|||
}
|
||||
|
||||
@Override
|
||||
public void draw(MatrixStack matrices, int mouseX, int mouseY, IViewRoot container) {
|
||||
public void draw(DrawContext context, int mouseX, int mouseY, IViewRoot container) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -144,42 +144,42 @@ public class SpellbookTraitDexPageContent extends DrawableHelper implements Spel
|
|||
|
||||
|
||||
@Override
|
||||
public void drawOverlays(MatrixStack matrices, int mouseX, int mouseY, float tickDelta) {
|
||||
public void drawOverlays(DrawContext context, int mouseX, int mouseY, float tickDelta) {
|
||||
MatrixStack matrices = context.getMatrices();
|
||||
matrices.push();
|
||||
matrices.translate(margin.left, margin.top, 0);
|
||||
matrices.translate(-2, -2, 200);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.setShaderTexture(0, SpellbookScreen.TEXTURE);
|
||||
int tileSize = 25;
|
||||
|
||||
final int bottom = height - tileSize + 4;
|
||||
final int right = width - tileSize + 9;
|
||||
|
||||
drawTexture(matrices, 0, 0, 405, 62, tileSize, tileSize, 512, 256);
|
||||
drawTexture(matrices, 0, bottom, 405, 72, tileSize, tileSize, 512, 256);
|
||||
context.drawTexture(SpellbookScreen.TEXTURE, 0, 0, 405, 62, tileSize, tileSize, 512, 256);
|
||||
context.drawTexture(SpellbookScreen.TEXTURE, 0, bottom, 405, 72, tileSize, tileSize, 512, 256);
|
||||
|
||||
for (int i = tileSize; i < right; i += tileSize) {
|
||||
drawTexture(matrices, i, 0, 415, 62, tileSize, tileSize, 512, 256);
|
||||
drawTexture(matrices, i, bottom, 415, 72, tileSize, tileSize, 512, 256);
|
||||
context.drawTexture(SpellbookScreen.TEXTURE, i, 0, 415, 62, tileSize, tileSize, 512, 256);
|
||||
context.drawTexture(SpellbookScreen.TEXTURE, i, bottom, 415, 72, tileSize, tileSize, 512, 256);
|
||||
}
|
||||
|
||||
for (int i = tileSize; i < bottom; i += tileSize) {
|
||||
drawTexture(matrices, 0, i, 405, 67, tileSize, tileSize, 512, 256);
|
||||
drawTexture(matrices, right, i, 425, 67, tileSize, tileSize, 512, 256);
|
||||
context.drawTexture(SpellbookScreen.TEXTURE, 0, i, 405, 67, tileSize, tileSize, 512, 256);
|
||||
context.drawTexture(SpellbookScreen.TEXTURE, right, i, 425, 67, tileSize, tileSize, 512, 256);
|
||||
}
|
||||
|
||||
drawTexture(matrices, right, 0, 425, 62, tileSize, tileSize, 512, 256);
|
||||
drawTexture(matrices, right, bottom, 425, 72, tileSize, tileSize, 512, 256);
|
||||
context.drawTexture(SpellbookScreen.TEXTURE, right, 0, 425, 62, tileSize, tileSize, 512, 256);
|
||||
context.drawTexture(SpellbookScreen.TEXTURE, right, bottom, 425, 72, tileSize, tileSize, 512, 256);
|
||||
matrices.pop();
|
||||
|
||||
if (this == rightPage) {
|
||||
leftPage.drawDelayed(matrices, mouseX, mouseY, 0);
|
||||
rightPage.drawDelayed(matrices, mouseX, mouseY, 0);
|
||||
leftPage.drawDelayed(context, mouseX, mouseY, 0);
|
||||
rightPage.drawDelayed(context, mouseX, mouseY, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void drawDelayed(MatrixStack matrices, int mouseX, int mouseY, float tickDelta) {
|
||||
super.drawOverlays(matrices, mouseX, mouseY, tickDelta);
|
||||
public void drawDelayed(DrawContext context, int mouseX, int mouseY, float tickDelta) {
|
||||
super.drawOverlays(context, mouseX, mouseY, tickDelta);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -199,24 +199,23 @@ public class SpellbookTraitDexPageContent extends DrawableHelper implements Spel
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float tickDelta) {
|
||||
public void renderButton(DrawContext context, int mouseX, int mouseY, float tickDelta) {
|
||||
TraitDiscovery discoveries = Pony.of(MinecraftClient.getInstance().player).getDiscoveries();
|
||||
setEnabled(discoveries.isKnown(trait));
|
||||
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
RenderSystem.setShaderTexture(0, SpellbookScreen.TEXTURE);
|
||||
RenderSystem.enableBlend();
|
||||
drawTexture(matrices, getX() - 2, getY() - 8, 204, 219, 22, 32, 512, 256);
|
||||
context.drawTexture(SpellbookScreen.TEXTURE, getX() - 2, getY() - 8, 204, 219, 22, 32, 512, 256);
|
||||
|
||||
if (!active) {
|
||||
drawTexture(matrices, getX() - 2, getY() - 1, 74, 223, 18, 18, 512, 256);
|
||||
context.drawTexture(SpellbookScreen.TEXTURE, getX() - 2, getY() - 1, 74, 223, 18, 18, 512, 256);
|
||||
}
|
||||
|
||||
if (discoveries.isUnread(trait)) {
|
||||
drawTexture(matrices, getX() - 8, getY() - 8, 225, 219, 35, 32, 512, 256);
|
||||
context.drawTexture(SpellbookScreen.TEXTURE, getX() - 8, getY() - 8, 225, 219, 35, 32, 512, 256);
|
||||
}
|
||||
|
||||
super.renderButton(matrices, mouseX, mouseY, tickDelta);
|
||||
super.renderButton(context, mouseX, mouseY, tickDelta);
|
||||
hovered &= active;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ class WingsGear implements IGear {
|
|||
}
|
||||
|
||||
if (AmuletSelectors.PEGASUS_AMULET.test(living.asEntity())) {
|
||||
return entity.world.getDimension().ultrawarm() ? ICARUS_WINGS_CORRUPTED : ICARUS_WINGS;
|
||||
return entity.getWorld().getDimension().ultrawarm() ? ICARUS_WINGS_CORRUPTED : ICARUS_WINGS;
|
||||
}
|
||||
|
||||
Race race = living instanceof Pony pony ? pony.getObservedSpecies() : living.getSpecies();
|
||||
|
|
|
@ -34,7 +34,7 @@ public class FloatingArtefactEntityRenderer extends EntityRenderer<FloatingArtef
|
|||
stack = UItems.EMPTY_JAR.getDefaultStack();
|
||||
}
|
||||
|
||||
final BakedModel model = itemRenderer.getModel(stack, entity.world, null, 0);
|
||||
final BakedModel model = itemRenderer.getModel(stack, entity.getWorld(), null, 0);
|
||||
|
||||
final float variance = 0.25F;
|
||||
final float verticalOffset = entity.getVerticalOffset(timeDelta);
|
||||
|
|
|
@ -23,6 +23,6 @@ public class IcarusWingsFeatureRenderer<E extends LivingEntity> extends WingsFea
|
|||
|
||||
@Override
|
||||
protected Identifier getTexture(E entity) {
|
||||
return entity.world.getDimension().ultrawarm() ? ICARUS_WINGS_CORRUPTED : ICARUS_WINGS;
|
||||
return entity.getWorld().getDimension().ultrawarm() ? ICARUS_WINGS_CORRUPTED : ICARUS_WINGS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,13 +87,13 @@ public class DisguiseCommand {
|
|||
.setDisguise(entity);
|
||||
|
||||
if (source.getEntity() == player) {
|
||||
source.sendFeedback(Text.translatable("commands.disguise.success.self", entity.getName()), true);
|
||||
source.sendFeedback(() -> Text.translatable("commands.disguise.success.self", entity.getName()), true);
|
||||
} else {
|
||||
if (player.getEntityWorld().getGameRules().getBoolean(GameRules.SEND_COMMAND_FEEDBACK)) {
|
||||
player.sendMessage(Text.translatable("commands.disguise.success", entity.getName()));
|
||||
}
|
||||
|
||||
source.sendFeedback(Text.translatable("commands.disguise.success.other", player.getName(), entity.getName()), true);
|
||||
source.sendFeedback(() -> Text.translatable("commands.disguise.success.other", player.getName(), entity.getName()), true);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -114,13 +114,13 @@ public class DisguiseCommand {
|
|||
iplayer.getSpellSlot().removeIf(SpellPredicate.IS_DISGUISE, true);
|
||||
|
||||
if (source.getEntity() == player) {
|
||||
source.sendFeedback(Text.translatable("commands.disguise.removed.self"), true);
|
||||
source.sendFeedback(() -> Text.translatable("commands.disguise.removed.self"), true);
|
||||
} else {
|
||||
if (player.getEntityWorld().getGameRules().getBoolean(GameRules.SEND_COMMAND_FEEDBACK)) {
|
||||
player.sendMessage(Text.translatable("commands.disguise.removed"));
|
||||
}
|
||||
|
||||
source.sendFeedback(Text.translatable("commands.disguise.removed.other", player.getName()), true);
|
||||
source.sendFeedback(() -> Text.translatable("commands.disguise.removed.other", player.getName()), true);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -60,13 +60,13 @@ class GravityCommand {
|
|||
String translationKey = "commands.gravity." + key;
|
||||
|
||||
if (source.getEntity() == player) {
|
||||
source.sendFeedback(Text.translatable(translationKey + ".self", arguments), true);
|
||||
source.sendFeedback(() -> Text.translatable(translationKey + ".self", arguments), true);
|
||||
} else {
|
||||
if (notifyTarget && source.getWorld().getGameRules().getBoolean(GameRules.SEND_COMMAND_FEEDBACK)) {
|
||||
player.sendMessage(Text.translatable(translationKey, arguments));
|
||||
}
|
||||
|
||||
source.sendFeedback(Text.translatable(translationKey + ".other", Streams.concat(Stream.of(player.getDisplayName()), Arrays.stream(arguments)).toArray()), true);
|
||||
source.sendFeedback(() -> Text.translatable(translationKey + ".other", Streams.concat(Stream.of(player.getDisplayName()), Arrays.stream(arguments)).toArray()), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,19 +50,20 @@ class RacelistCommand {
|
|||
}
|
||||
|
||||
static int toggle(ServerCommandSource source, ServerPlayerEntity player, Race race, String action, Function<Race, Boolean> func) {
|
||||
String translationKey = "commands.racelist." + action;
|
||||
source.sendFeedback(() -> {
|
||||
String translationKey = "commands.racelist." + action;
|
||||
|
||||
if (!func.apply(race)) {
|
||||
if (race.isUnset()) {
|
||||
translationKey = "commands.racelist.illegal";
|
||||
} else {
|
||||
translationKey += ".failed";
|
||||
if (!func.apply(race)) {
|
||||
if (race.isUnset()) {
|
||||
translationKey = "commands.racelist.illegal";
|
||||
} else {
|
||||
translationKey += ".failed";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text formattedName = race.getDisplayName().copy().formatted(Formatting.GOLD);
|
||||
|
||||
source.sendFeedback(Text.translatable(translationKey, formattedName).formatted(Formatting.GREEN), false);
|
||||
Text formattedName = race.getDisplayName().copy().formatted(Formatting.GOLD);
|
||||
return Text.translatable(translationKey, formattedName).formatted(Formatting.GREEN);
|
||||
}, false);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,12 +72,12 @@ class SpeciesCommand {
|
|||
}
|
||||
|
||||
if (player == source.getPlayer()) {
|
||||
source.sendFeedback(Text.translatable("commands.race.success.self", race.getDisplayName()), true);
|
||||
source.sendFeedback(() -> Text.translatable("commands.race.success.self", race.getDisplayName()), true);
|
||||
} else {
|
||||
if (player.getEntityWorld().getGameRules().getBoolean(GameRules.SEND_COMMAND_FEEDBACK)) {
|
||||
player.sendMessage(Text.translatable("commands.race.success", race.getDisplayName()), false);
|
||||
}
|
||||
source.sendFeedback(Text.translatable("commands.race.success.other", player.getName(), race.getDisplayName()), true);
|
||||
source.sendFeedback(() -> Text.translatable("commands.race.success.other", player.getName(), race.getDisplayName()), true);
|
||||
}
|
||||
} else if (player.getEntityWorld().getGameRules().getBoolean(GameRules.SEND_COMMAND_FEEDBACK)) {
|
||||
player.sendMessage(Text.translatable("commands.race.permission"), false);
|
||||
|
|
|
@ -86,7 +86,7 @@ class TraitCommand {
|
|||
if (source.getPlayer() == player) {
|
||||
player.sendMessage(Text.translatable(translationKey, gravity), false);
|
||||
} else {
|
||||
source.sendFeedback(Text.translatable(translationKey + ".other", player.getName(), gravity), true);
|
||||
source.sendFeedback(() -> Text.translatable(translationKey + ".other", player.getName(), gravity), true);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -25,8 +25,10 @@ class WorldTribeCommand {
|
|||
}
|
||||
|
||||
static int get(ServerCommandSource source) throws CommandSyntaxException {
|
||||
WorldTribeManager manager = WorldTribeManager.forWorld(source.getWorld());
|
||||
source.sendFeedback(Text.translatable("commands.worldtribe.success.get", manager.getDefaultRace().getDisplayName()), true);
|
||||
source.sendFeedback(() -> {
|
||||
WorldTribeManager manager = WorldTribeManager.forWorld(source.getWorld());
|
||||
return Text.translatable("commands.worldtribe.success.get", manager.getDefaultRace().getDisplayName());
|
||||
}, true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -34,7 +36,7 @@ class WorldTribeCommand {
|
|||
WorldTribeManager manager = WorldTribeManager.forWorld(source.getWorld());
|
||||
manager.setDefaultRace(race);
|
||||
|
||||
source.sendFeedback(Text.translatable("commands.worldtribe.success.set", race.getDisplayName()), true);
|
||||
source.sendFeedback(() -> Text.translatable("commands.worldtribe.success.set", race.getDisplayName()), true);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import dev.emi.emi.api.stack.EmiIngredient;
|
|||
import dev.emi.emi.api.stack.EmiStack;
|
||||
import dev.emi.emi.api.widget.TextureWidget;
|
||||
import dev.emi.emi.api.widget.WidgetHolder;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
|
@ -120,9 +120,9 @@ class SpellbookEmiRecipe implements EmiRecipe, SpellbookRecipe.CraftingTreeBuild
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
RenderSystem.enableBlend();
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
context.drawTexture(texture, x, y, 0, u, v, width, height, textureWidth, textureHeight);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,6 +14,7 @@ import dev.emi.emi.api.render.EmiRender;
|
|||
import dev.emi.emi.api.stack.Comparison;
|
||||
import dev.emi.emi.api.stack.EmiStack;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.tooltip.TooltipComponent;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.item.Item;
|
||||
|
@ -78,25 +79,30 @@ public class TraitEmiStack extends EmiStack {
|
|||
return trait.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int x, int y, float delta, int flags) {
|
||||
//@Override
|
||||
public void render(DrawContext context, int x, int y, float delta, int flags) {
|
||||
if ((flags & RENDER_ICON) != 0) {
|
||||
List<Item> knownItems = trait.getItems();
|
||||
if (knownItems.isEmpty() || MinecraftClient.getInstance().player == null) {
|
||||
ItemTraitsTooltipRenderer.renderTraitIcon(trait, amount, matrices, x, y, true);
|
||||
ItemTraitsTooltipRenderer.renderTraitIcon(trait, amount, context, x, y, true);
|
||||
} else {
|
||||
int tick = (MinecraftClient.getInstance().player.age / 12) % knownItems.size();
|
||||
ItemStack stack = knownItems.get(tick).getDefaultStack();
|
||||
EmiStack.of(stack).render(matrices, x, y, delta, flags);
|
||||
ItemTraitsTooltipRenderer.renderStackTraits(traits, matrices, x, y, 1, delta, 0, true);
|
||||
EmiStack.of(stack).render(context.getMatrices(), x, y, delta, flags);
|
||||
ItemTraitsTooltipRenderer.renderStackTraits(traits, context, x, y, 1, delta, 0, true);
|
||||
}
|
||||
}
|
||||
|
||||
if ((flags & RENDER_REMAINDER) != 0) {
|
||||
EmiRender.renderRemainderIcon(this, matrices, x, y);
|
||||
EmiRender.renderRemainderIcon(this, context.getMatrices(), x, y);
|
||||
}
|
||||
}
|
||||
|
||||
//@Override
|
||||
public void render(MatrixStack matrices, int x, int y, float delta, int flags) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public EmiStack copy() {
|
||||
return new TraitEmiStack(trait, amount);
|
||||
|
|
|
@ -55,7 +55,7 @@ public class OutputSlot extends CraftingResultSlot implements SpellbookSlot {
|
|||
InventoryUtil.stream(input).forEach(s -> {
|
||||
pony.getDiscoveries().unlock(s.getItem());
|
||||
});
|
||||
pony.getMagicalReserves().getXp().add(MathHelper.clamp(player.world.getRandom().nextFloat() / 10F, 0.001F, 0.3F));
|
||||
pony.getMagicalReserves().getXp().add(MathHelper.clamp(player.getWorld().getRandom().nextFloat() / 10F, 0.001F, 0.3F));
|
||||
super.onTakeItem(player, stack);
|
||||
}
|
||||
}
|
|
@ -80,7 +80,7 @@ public class AirBalloonEntity extends FlyingEntity implements EntityCollisions.C
|
|||
|
||||
if (isAirworthy()) {
|
||||
setVelocity(getVelocity()
|
||||
.add(getWind(world, getBlockPos()))
|
||||
.add(getWind(getWorld(), getBlockPos()))
|
||||
.normalize()
|
||||
.multiply(0.2)
|
||||
.add(0, isBurnerActive() ? 0.00F : isTouchingWater() ? 0.02F : -0.06F, 0));
|
||||
|
@ -112,15 +112,15 @@ public class AirBalloonEntity extends FlyingEntity implements EntityCollisions.C
|
|||
if (velocityBeforeTick.length() > 0.01 && !isSubmergedInWater()) {
|
||||
Box box = getInteriorBoundingBox();
|
||||
|
||||
for (Entity e : world.getOtherEntities(this, box.expand(-0.2, 1, -0.2))) {
|
||||
updatePassenger(e, box, !onGround);
|
||||
for (Entity e : getWorld().getOtherEntities(this, box.expand(-0.2, 1, -0.2))) {
|
||||
updatePassenger(e, box, !isOnGround());
|
||||
weight++;
|
||||
}
|
||||
|
||||
if (hasBalloon()) {
|
||||
Box balloonBox = getBalloonBoundingBox();
|
||||
|
||||
for (Entity e : world.getOtherEntities(this, balloonBox.expand(1.0E-7))) {
|
||||
for (Entity e : getWorld().getOtherEntities(this, balloonBox.expand(1.0E-7))) {
|
||||
updatePassenger(e, balloonBox, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -176,17 +176,17 @@ public class ButterflyEntity extends AmbientEntity {
|
|||
return;
|
||||
}
|
||||
|
||||
if (world.getBlockState(below).isAir()
|
||||
|| !world.getOtherEntities(this, getBoundingBox().expand(3), this::isAggressor).isEmpty()
|
||||
|| (ticksResting++ > MAX_REST_TICKS || world.random.nextInt(500) == 0)
|
||||
|| world.hasRain(below)) {
|
||||
if (getWorld().getBlockState(below).isAir()
|
||||
|| !getWorld().getOtherEntities(this, getBoundingBox().expand(3), this::isAggressor).isEmpty()
|
||||
|| (ticksResting++ > MAX_REST_TICKS || getWorld().random.nextInt(500) == 0)
|
||||
|| getWorld().hasRain(below)) {
|
||||
setResting(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!world.isClient
|
||||
if (!getWorld().isClient
|
||||
&& age % BREEDING_INTERVAL == 0
|
||||
&& world.random.nextInt(200) == 0
|
||||
&& getWorld().random.nextInt(200) == 0
|
||||
&& canBreed()) {
|
||||
breed();
|
||||
}
|
||||
|
@ -205,14 +205,14 @@ public class ButterflyEntity extends AmbientEntity {
|
|||
return flower;
|
||||
}).or(this::findNextHoverPosition).ifPresent(this::moveTowards);
|
||||
|
||||
if (random.nextInt(100) == 0 && world.getBlockState(below).isOpaque()) {
|
||||
if (random.nextInt(100) == 0 && getWorld().getBlockState(below).isOpaque()) {
|
||||
setResting(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean canBreed() {
|
||||
return age > BREEDING_INTERVAL && breedingCooldown <= 0 && isResting() && world.getOtherEntities(this, getBoundingBox().expand(2), i -> {
|
||||
return age > BREEDING_INTERVAL && breedingCooldown <= 0 && isResting() && getWorld().getOtherEntities(this, getBoundingBox().expand(2), i -> {
|
||||
return i instanceof ButterflyEntity && i.getType() == getType() && ((ButterflyEntity)i).isResting();
|
||||
}).size() == 1;
|
||||
}
|
||||
|
@ -220,9 +220,9 @@ public class ButterflyEntity extends AmbientEntity {
|
|||
private boolean breed() {
|
||||
breedingCooldown = MAX_BREEDING_COOLDOWN;
|
||||
|
||||
ButterflyEntity copy = (ButterflyEntity)getType().create(world);
|
||||
ButterflyEntity copy = (ButterflyEntity)getType().create(getWorld());
|
||||
copy.copyPositionAndRotation(this);
|
||||
world.spawnEntity(copy);
|
||||
getWorld().spawnEntity(copy);
|
||||
setResting(false);
|
||||
return true;
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ public class ButterflyEntity extends AmbientEntity {
|
|||
// invalidate the hovering position
|
||||
BlockPos pos = getBlockPos();
|
||||
|
||||
return hoveringPosition = hoveringPosition.filter(p -> world.isAir(p)
|
||||
return hoveringPosition = hoveringPosition.filter(p -> getWorld().isAir(p)
|
||||
&& p.getY() >= 1
|
||||
&& random.nextInt(30) != 0
|
||||
&& p.getSquaredDistance(pos) >= 4).or(() -> {
|
||||
|
@ -249,9 +249,9 @@ public class ButterflyEntity extends AmbientEntity {
|
|||
return flowerPosition;
|
||||
}
|
||||
|
||||
flowerPosition = flowerPosition.filter(p -> world.getBlockState(p).isIn(BlockTags.FLOWERS)).or(() -> {
|
||||
flowerPosition = flowerPosition.filter(p -> getWorld().getBlockState(p).isIn(BlockTags.FLOWERS)).or(() -> {
|
||||
return BlockPos.streamOutwards(getBlockPos(), FLOWER_DETECTION_RANGE, FLOWER_DETECTION_RANGE, FLOWER_DETECTION_RANGE)
|
||||
.filter(p -> !visited.containsKey(p) && world.getBlockState(p).isIn(BlockTags.FLOWERS))
|
||||
.filter(p -> !visited.containsKey(p) && getWorld().getBlockState(p).isIn(BlockTags.FLOWERS))
|
||||
.findFirst()
|
||||
.map(p -> {
|
||||
visited.put(p, (long)age - 900);
|
||||
|
|
|
@ -67,7 +67,7 @@ public class CastSpellEntity extends LightEmittingEntity implements Caster<CastS
|
|||
return;
|
||||
}
|
||||
|
||||
if (!getSpellSlot().forEach(spell -> Operation.ofBoolean(spell.tick(this, Situation.GROUND_ENTITY)), world.isClient)) {
|
||||
if (!getSpellSlot().forEach(spell -> Operation.ofBoolean(spell.tick(this, Situation.GROUND_ENTITY)), getWorld().isClient)) {
|
||||
discard();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public interface DynamicLightSource {
|
|||
|
||||
@SuppressWarnings("deprecation")
|
||||
void tick() {
|
||||
if (entity.world.isClient) {
|
||||
if (entity.getWorld().isClient) {
|
||||
if (entity.isRemoved()) {
|
||||
remove();
|
||||
return;
|
||||
|
@ -36,12 +36,13 @@ public interface DynamicLightSource {
|
|||
|
||||
BlockPos currentPos = entity.getBlockPos();
|
||||
|
||||
if (!currentPos.equals(lastPos) && entity.world.isChunkLoaded(currentPos)) {
|
||||
if (!currentPos.equals(lastPos) && entity.getWorld().isChunkLoaded(currentPos)) {
|
||||
try {
|
||||
if (lastPos != null) {
|
||||
entity.world.getLightingProvider().checkBlock(lastPos);
|
||||
entity.getWorld().getLightingProvider().checkBlock(lastPos);
|
||||
}
|
||||
entity.world.getLightingProvider().addLightSource(currentPos, light);
|
||||
// TODO: store this in the ether and inject into Chunk#forEachLightSource
|
||||
//entity.getWorld().getLightingProvider().addLightSource(currentPos, light);
|
||||
lastPos = currentPos;
|
||||
} catch (Exception ignored) { }
|
||||
}
|
||||
|
@ -49,9 +50,9 @@ public interface DynamicLightSource {
|
|||
}
|
||||
|
||||
void remove() {
|
||||
if (entity.world.isClient && lastPos != null) {
|
||||
if (entity.getWorld().isClient && lastPos != null) {
|
||||
try {
|
||||
entity.world.getLightingProvider().checkBlock(lastPos);
|
||||
entity.getWorld().getLightingProvider().checkBlock(lastPos);
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public class EntityPhysics<T extends Entity> implements Physics, Copyable<Entity
|
|||
@Override
|
||||
public void tick() {
|
||||
if (isGravityNegative()) {
|
||||
if (entity.getY() > entity.world.getHeight() + 64) {
|
||||
if (entity.getY() > entity.getWorld().getHeight() + 64) {
|
||||
entity.damage(entity.getDamageSources().outOfWorld(), 4.0F);
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ public class EntityPhysics<T extends Entity> implements Physics, Copyable<Entity
|
|||
protected void onGravitychanged() {
|
||||
entity.calculateDimensions();
|
||||
|
||||
if (!entity.world.isClient && entity instanceof MobEntity) {
|
||||
if (!entity.getWorld().isClient && entity instanceof MobEntity) {
|
||||
((MobEntity)entity).getNavigation().stop();
|
||||
((MobEntity)entity).setTarget(null);
|
||||
}
|
||||
|
@ -92,9 +92,9 @@ public class EntityPhysics<T extends Entity> implements Physics, Copyable<Entity
|
|||
MathHelper.floor(entity.getZ())
|
||||
);
|
||||
|
||||
if (entity.world.getBlockState(pos).isAir()) {
|
||||
if (entity.getWorld().getBlockState(pos).isAir()) {
|
||||
BlockPos below = pos.down();
|
||||
BlockState block = entity.world.getBlockState(below);
|
||||
BlockState block = entity.getWorld().getBlockState(below);
|
||||
if (block.isIn(BlockTags.FENCES) || block.isIn(BlockTags.WALLS) || block.getBlock() instanceof FenceGateBlock) {
|
||||
entity.setOnGround(true);
|
||||
return below;
|
||||
|
@ -108,13 +108,13 @@ public class EntityPhysics<T extends Entity> implements Physics, Copyable<Entity
|
|||
|
||||
@Override
|
||||
public void spawnSprintingParticles() {
|
||||
BlockState state = entity.world.getBlockState(getHeadPosition());
|
||||
BlockState state = entity.getWorld().getBlockState(getHeadPosition());
|
||||
if (state.getRenderType() != BlockRenderType.INVISIBLE) {
|
||||
Vec3d vel = entity.getVelocity();
|
||||
entity.world.addParticle(new BlockStateParticleEffect(ParticleTypes.BLOCK, state),
|
||||
entity.getX() + (entity.world.random.nextFloat() - 0.5D) * entity.getWidth(),
|
||||
entity.getWorld().addParticle(new BlockStateParticleEffect(ParticleTypes.BLOCK, state),
|
||||
entity.getX() + (entity.getWorld().random.nextFloat() - 0.5D) * entity.getWidth(),
|
||||
entity.getY() + entity.getHeight() - 0.1D,
|
||||
entity.getZ() + (entity.world.random.nextFloat() - 0.5D) * entity.getWidth(),
|
||||
entity.getZ() + (entity.getWorld().random.nextFloat() - 0.5D) * entity.getWidth(),
|
||||
vel.x * -4, -1.5D, vel.z * -4);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ public class FairyEntity extends PathAwareEntity implements DynamicLightSource,
|
|||
|
||||
@Override
|
||||
public World asWorld() {
|
||||
return world;
|
||||
return getWorld();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -138,12 +138,12 @@ public class FairyEntity extends PathAwareEntity implements DynamicLightSource,
|
|||
|
||||
@Override
|
||||
public void tick() {
|
||||
onGround = true;
|
||||
setOnGround(true);
|
||||
super.tick();
|
||||
emitter.tick();
|
||||
|
||||
if (world.random.nextInt(20) == 3) {
|
||||
world.addParticle(new MagicParticleEffect(0xFFFFFF), getParticleX(1), getY(), getParticleZ(1), 0, 0, 0);
|
||||
if (getWorld().random.nextInt(20) == 3) {
|
||||
getWorld().addParticle(new MagicParticleEffect(0xFFFFFF), getParticleX(1), getY(), getParticleZ(1), 0, 0, 0);
|
||||
}
|
||||
|
||||
if (age % 60 == 0) {
|
||||
|
@ -163,15 +163,15 @@ public class FairyEntity extends PathAwareEntity implements DynamicLightSource,
|
|||
setVelocity(getVelocity().multiply(0.5));
|
||||
} else {
|
||||
float f = 0.91f;
|
||||
if (onGround) {
|
||||
f = world.getBlockState(getBlockPos().down()).getBlock().getSlipperiness() * 0.91f;
|
||||
if (isOnGround()) {
|
||||
f = getWorld().getBlockState(getBlockPos().down()).getBlock().getSlipperiness() * 0.91f;
|
||||
}
|
||||
float g = 0.16277137f / (f * f * f);
|
||||
f = 0.91f;
|
||||
if (onGround) {
|
||||
f = world.getBlockState(getBlockPos().down()).getBlock().getSlipperiness() * 0.91f;
|
||||
if (isOnGround()) {
|
||||
f = getWorld().getBlockState(getBlockPos().down()).getBlock().getSlipperiness() * 0.91f;
|
||||
}
|
||||
updateVelocity(onGround ? 0.1f * g : 0.02f, movementInput);
|
||||
updateVelocity(isOnGround() ? 0.1f * g : 0.02f, movementInput);
|
||||
move(MovementType.SELF, getVelocity());
|
||||
setVelocity(getVelocity().multiply(f));
|
||||
}
|
||||
|
@ -203,13 +203,13 @@ public class FairyEntity extends PathAwareEntity implements DynamicLightSource,
|
|||
|
||||
@Override
|
||||
public boolean handleAttack(Entity attacker) {
|
||||
if (world instanceof ServerWorld serverWorld) {
|
||||
LightningEntity lightning = EntityType.LIGHTNING_BOLT.create(world);
|
||||
if (getWorld() instanceof ServerWorld serverWorld) {
|
||||
LightningEntity lightning = EntityType.LIGHTNING_BOLT.create(getWorld());
|
||||
lightning.refreshPositionAfterTeleport(getX(), getY(), getZ());
|
||||
attacker.onStruckByLightning(serverWorld, lightning);
|
||||
}
|
||||
emitGameEvent(GameEvent.LIGHTNING_STRIKE);
|
||||
ParticleUtils.spawnParticle(world, UParticles.LIGHTNING_BOLT, getPos(), Vec3d.ZERO);
|
||||
ParticleUtils.spawnParticle(getWorld(), UParticles.LIGHTNING_BOLT, getPos(), Vec3d.ZERO);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -258,13 +258,13 @@ public class FairyEntity extends PathAwareEntity implements DynamicLightSource,
|
|||
|
||||
@Override
|
||||
public boolean canStart() {
|
||||
target = assignment.get(world);
|
||||
target = assignment.get(getWorld());
|
||||
|
||||
if (target == null) {
|
||||
target = getMaster();
|
||||
}
|
||||
if (target == null) {
|
||||
target = world.getClosestPlayer(FairyEntity.this, maxDistance);
|
||||
target = getWorld().getClosestPlayer(FairyEntity.this, maxDistance);
|
||||
}
|
||||
return target != null;
|
||||
}
|
||||
|
@ -297,7 +297,7 @@ public class FairyEntity extends PathAwareEntity implements DynamicLightSource,
|
|||
getLookControl().lookAt(target, 10, getMaxLookPitchChange());
|
||||
|
||||
Path currentPath = getNavigation().getCurrentPath();
|
||||
if (currentPath != null && target.getEyeY() < getY() - 0.5 && world.getBlockState(getBlockPos().down(3)).isAir()) {
|
||||
if (currentPath != null && target.getEyeY() < getY() - 0.5 && getWorld().getBlockState(getBlockPos().down(3)).isAir()) {
|
||||
addVelocity(0, -speed, 0);
|
||||
}
|
||||
|
||||
|
@ -307,9 +307,9 @@ public class FairyEntity extends PathAwareEntity implements DynamicLightSource,
|
|||
|
||||
if (distance > 100) {
|
||||
teleport(
|
||||
target.getX() + world.random.nextFloat() / 2F - 0.5F,
|
||||
target.getX() + getWorld().random.nextFloat() / 2F - 0.5F,
|
||||
target.getEyeY(),
|
||||
target.getZ() + world.random.nextFloat() / 2F - 0.5F
|
||||
target.getZ() + getWorld().random.nextFloat() / 2F - 0.5F
|
||||
);
|
||||
setVelocity(target.getVelocity());
|
||||
return;
|
||||
|
@ -331,7 +331,7 @@ public class FairyEntity extends PathAwareEntity implements DynamicLightSource,
|
|||
|
||||
if (distance <= minDistance * minDistance) {
|
||||
|
||||
BlockPos pos = FuzzyPositions.localFuzz(FairyEntity.this.world.random, 5, 5);
|
||||
BlockPos pos = FuzzyPositions.localFuzz(getWorld().random, 5, 5);
|
||||
if (pos != null) {
|
||||
getNavigation().startMovingTo(pos.getX(), pos.getY(), pos.getZ(), speed);
|
||||
} else {
|
||||
|
|
|
@ -98,7 +98,7 @@ public class FloatingArtefactEntity extends Entity implements UDamageSources {
|
|||
setStack(UItems.EMPTY_JAR.getDefaultStack());
|
||||
}
|
||||
|
||||
if (world.isClient) {
|
||||
if (getWorld().isClient) {
|
||||
float spin = getSpin();
|
||||
if (Math.abs(spin - targetSpin) > 1.0E-5F) {
|
||||
spinChange = spin - targetSpin;
|
||||
|
@ -129,7 +129,7 @@ public class FloatingArtefactEntity extends Entity implements UDamageSources {
|
|||
((Artifact)stack.getItem()).onArtifactTick(this);
|
||||
}
|
||||
|
||||
if (world.getTime() % 80 == 0) {
|
||||
if (getWorld().getTime() % 80 == 0) {
|
||||
State state = getState();
|
||||
playSound(USounds.ENTITY_ARTEFACT_AMBIENT, state.getVolume(), state.getPitch());
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ public class FloatingArtefactEntity extends Entity implements UDamageSources {
|
|||
|
||||
@Override
|
||||
public World asWorld() {
|
||||
return world;
|
||||
return getWorld();
|
||||
}
|
||||
|
||||
public enum State {
|
||||
|
|
|
@ -49,7 +49,7 @@ public class ItemImpl implements Equine<ItemEntity> {
|
|||
@Override
|
||||
public boolean beforeUpdate() {
|
||||
|
||||
if (!entity.world.isClient) {
|
||||
if (!entity.getWorld().isClient) {
|
||||
Race race = getSpecies();
|
||||
if (race != serverRace) {
|
||||
serverRace = race;
|
||||
|
@ -67,9 +67,9 @@ public class ItemImpl implements Equine<ItemEntity> {
|
|||
ClingyItem clingy = item instanceof ClingyItem ? (ClingyItem)item : ClingyItem.DEFAULT;
|
||||
|
||||
if (clingy.isClingy(stack)) {
|
||||
Random rng = entity.world.random;
|
||||
Random rng = entity.getWorld().random;
|
||||
|
||||
entity.world.addParticle(clingy.getParticleEffect((IItemEntity)entity),
|
||||
entity.getWorld().addParticle(clingy.getParticleEffect((IItemEntity)entity),
|
||||
entity.getX() + rng.nextFloat() - 0.5,
|
||||
entity.getY() + rng.nextFloat() - 0.5,
|
||||
entity.getZ() + rng.nextFloat() - 0.5,
|
||||
|
@ -77,7 +77,7 @@ public class ItemImpl implements Equine<ItemEntity> {
|
|||
);
|
||||
|
||||
Vec3d position = entity.getPos();
|
||||
VecHelper.findInRange(entity, entity.world, entity.getPos(), clingy.getFollowDistance(i), e -> e instanceof PlayerEntity)
|
||||
VecHelper.findInRange(entity, entity.getWorld(), entity.getPos(), clingy.getFollowDistance(i), e -> e instanceof PlayerEntity)
|
||||
.stream()
|
||||
.sorted((a, b) -> (int)(a.getPos().distanceTo(position) - b.getPos().distanceTo(position)))
|
||||
.findFirst()
|
||||
|
|
|
@ -25,7 +25,7 @@ class ItemPhysics extends EntityPhysics<ItemEntity> {
|
|||
|
||||
float above = 0.98f;
|
||||
if (entity.verticalCollision) {
|
||||
above *= entity.world.getBlockState(entity.getBlockPos().up()).getBlock().getSlipperiness();
|
||||
above *= entity.getWorld().getBlockState(entity.getBlockPos().up()).getBlock().getSlipperiness();
|
||||
//above /= 9;
|
||||
}
|
||||
|
||||
|
@ -36,8 +36,8 @@ class ItemPhysics extends EntityPhysics<ItemEntity> {
|
|||
|
||||
@Override
|
||||
protected void onGravitychanged() {
|
||||
if (!entity.world.isClient) {
|
||||
float gravity = this.getBaseGravityModifier();
|
||||
if (!entity.getWorld().isClient) {
|
||||
float gravity = getBaseGravityModifier();
|
||||
setBaseGravityModifier(gravity == 0 ? 1 : gravity * 2);
|
||||
setBaseGravityModifier(gravity);
|
||||
}
|
||||
|
|
|
@ -170,7 +170,7 @@ public abstract class Living<T extends LivingEntity> implements Equine<T>, Caste
|
|||
tickers.forEach(Tickable::tick);
|
||||
|
||||
try {
|
||||
getSpellSlot().forEach(spell -> Operation.ofBoolean(spell.tick(this, Situation.BODY)), entity.world.isClient);
|
||||
getSpellSlot().forEach(spell -> Operation.ofBoolean(spell.tick(this, Situation.BODY)), entity.getWorld().isClient);
|
||||
} catch (Exception e) {
|
||||
Unicopia.LOGGER.error("Error whilst ticking spell on entity {}", entity, e);
|
||||
}
|
||||
|
@ -223,12 +223,12 @@ public abstract class Living<T extends LivingEntity> implements Equine<T>, Caste
|
|||
}
|
||||
|
||||
private void updateDragonBreath() {
|
||||
if (!entity.world.isClient && (entity instanceof PlayerEntity || entity.hasCustomName())) {
|
||||
if (!entity.getWorld().isClient && (entity instanceof PlayerEntity || entity.hasCustomName())) {
|
||||
|
||||
Vec3d targetPos = entity.getRotationVector().multiply(2).add(entity.getEyePos());
|
||||
|
||||
if (entity.getWorld().isAir(BlockPos.ofFloored(targetPos))) {
|
||||
DragonBreathStore store = DragonBreathStore.get(entity.world);
|
||||
DragonBreathStore store = DragonBreathStore.get(entity.getWorld());
|
||||
String name = entity.getDisplayName().getString();
|
||||
store.popEntries(name).forEach(stack -> {
|
||||
Vec3d randomPos = targetPos.add(VecHelper.supply(() -> entity.getRandom().nextTriangular(0.1, 0.5)));
|
||||
|
@ -238,16 +238,16 @@ public abstract class Living<T extends LivingEntity> implements Equine<T>, Caste
|
|||
}
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
ParticleUtils.spawnParticle(entity.world, ParticleTypes.FLAME, randomPos.add(
|
||||
ParticleUtils.spawnParticle(entity.getWorld(), ParticleTypes.FLAME, randomPos.add(
|
||||
VecHelper.supply(() -> entity.getRandom().nextTriangular(0.1, 0.5))
|
||||
), Vec3d.ZERO);
|
||||
}
|
||||
|
||||
ItemEntity item = EntityType.ITEM.create(entity.world);
|
||||
ItemEntity item = EntityType.ITEM.create(entity.getWorld());
|
||||
item.setStack(stack.payload());
|
||||
item.setPosition(randomPos);
|
||||
item.world.spawnEntity(item);
|
||||
entity.world.playSoundFromEntity(null, entity, USounds.ITEM_DRAGON_BREATH_ARRIVE, entity.getSoundCategory(), 1, 1);
|
||||
item.getWorld().spawnEntity(item);
|
||||
entity.getWorld().playSoundFromEntity(null, entity, USounds.ITEM_DRAGON_BREATH_ARRIVE, entity.getSoundCategory(), 1, 1);
|
||||
|
||||
if (stack.payload().getItem() == UItems.OATS && entity instanceof PlayerEntity player) {
|
||||
UCriteria.RECEIVE_OATS.trigger(player);
|
||||
|
@ -395,7 +395,7 @@ public abstract class Living<T extends LivingEntity> implements Equine<T>, Caste
|
|||
}
|
||||
|
||||
public static void transmitPassengers(@Nullable Entity entity) {
|
||||
if (entity != null && entity.world instanceof ServerWorld sw) {
|
||||
if (entity != null && entity.getWorld() instanceof ServerWorld sw) {
|
||||
sw.getChunkManager().sendToNearbyPlayers(entity, new EntityPassengersSetS2CPacket(entity));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ public class PhysicsBodyProjectileEntity extends PersistentProjectileEntity impl
|
|||
@Override
|
||||
public void onPlayerCollision(PlayerEntity player) {
|
||||
|
||||
if (world.isClient || isNoClip() || shake > 0) {
|
||||
if (getWorld().isClient || isNoClip() || shake > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -132,26 +132,26 @@ public class PhysicsBodyProjectileEntity extends PersistentProjectileEntity impl
|
|||
|
||||
@Override
|
||||
protected void onBlockHit(BlockHitResult hit) {
|
||||
BlockState state = world.getBlockState(hit.getBlockPos());
|
||||
BlockState state = getWorld().getBlockState(hit.getBlockPos());
|
||||
|
||||
BlockState posState = getBlockStateAtPos();
|
||||
if (state.isIn(BlockTags.WOODEN_BUTTONS) && state.getBlock() instanceof ButtonBlock button) {
|
||||
button.powerOn(state, world, hit.getBlockPos());
|
||||
button.powerOn(state, getWorld(), hit.getBlockPos());
|
||||
} else if (posState.isIn(BlockTags.WOODEN_BUTTONS) && posState.getBlock() instanceof ButtonBlock button) {
|
||||
button.powerOn(posState, world, getBlockPos());
|
||||
button.powerOn(posState, getWorld(), getBlockPos());
|
||||
}
|
||||
|
||||
if (state.getBlock() instanceof LeverBlock lever) {
|
||||
lever.togglePower(state, world, hit.getBlockPos());
|
||||
lever.togglePower(state, getWorld(), hit.getBlockPos());
|
||||
} else if (posState.getBlock() instanceof LeverBlock lever) {
|
||||
lever.togglePower(posState, world, getBlockPos());
|
||||
lever.togglePower(posState, getWorld(), getBlockPos());
|
||||
}
|
||||
|
||||
BlockPos belowPos = getBlockPos().down();
|
||||
BlockState below = world.getBlockState(belowPos);
|
||||
BlockState below = getWorld().getBlockState(belowPos);
|
||||
ItemStack stack = getStack();
|
||||
if (below.getBlock() instanceof HopperBlock hopper) {
|
||||
BlockEntity e = world.getBlockEntity(belowPos);
|
||||
BlockEntity e = getWorld().getBlockEntity(belowPos);
|
||||
if (e instanceof Inventory inventory) {
|
||||
for (int i = 0; i < inventory.size(); i++) {
|
||||
ItemStack slotStack = inventory.getStack(i);
|
||||
|
@ -171,18 +171,18 @@ public class PhysicsBodyProjectileEntity extends PersistentProjectileEntity impl
|
|||
}
|
||||
|
||||
if (getVelocity().length() > 0.2F) {
|
||||
boolean ownerCanModify = !world.isClient && Caster.of(getOwner()).filter(pony -> pony.canModifyAt(hit.getBlockPos())).isPresent();
|
||||
boolean ownerCanModify = !getWorld().isClient && Caster.of(getOwner()).filter(pony -> pony.canModifyAt(hit.getBlockPos())).isPresent();
|
||||
|
||||
if (ownerCanModify && world.getGameRules().getBoolean(GameRules.DO_MOB_GRIEFING)) {
|
||||
if ((!isBouncy() || world.random.nextInt(200) == 0) && state.isIn(UTags.FRAGILE)) {
|
||||
world.breakBlock(hit.getBlockPos(), true);
|
||||
if (ownerCanModify && getWorld().getGameRules().getBoolean(GameRules.DO_MOB_GRIEFING)) {
|
||||
if ((!isBouncy() || getWorld().random.nextInt(200) == 0) && state.isIn(UTags.FRAGILE)) {
|
||||
getWorld().breakBlock(hit.getBlockPos(), true);
|
||||
}
|
||||
}
|
||||
|
||||
if (isBouncy()) {
|
||||
Direction.Axis side = hit.getSide().getAxis();
|
||||
|
||||
double randomisation = ((world.random.nextFloat() - 0.5F) / 5);
|
||||
double randomisation = ((getWorld().random.nextFloat() - 0.5F) / 5);
|
||||
|
||||
double inflectionAmount = randomisation + -0.4;
|
||||
double deflectionAmount = randomisation + 0.3;
|
||||
|
@ -200,9 +200,9 @@ public class PhysicsBodyProjectileEntity extends PersistentProjectileEntity impl
|
|||
}
|
||||
|
||||
addVelocity(
|
||||
((world.random.nextFloat() - 0.5F) / 5),
|
||||
((world.random.nextFloat() - 0.5F) / 5),
|
||||
((world.random.nextFloat() - 0.5F) / 5)
|
||||
((getWorld().random.nextFloat() - 0.5F) / 5),
|
||||
((getWorld().random.nextFloat() - 0.5F) / 5),
|
||||
((getWorld().random.nextFloat() - 0.5F) / 5)
|
||||
);
|
||||
} else {
|
||||
super.onBlockHit(hit);
|
||||
|
@ -212,7 +212,7 @@ public class PhysicsBodyProjectileEntity extends PersistentProjectileEntity impl
|
|||
}
|
||||
|
||||
setSound(state.getSoundGroup().getStepSound());
|
||||
world.playSoundFromEntity(null, this, state.getSoundGroup().getStepSound(), SoundCategory.BLOCKS, 1, 1);
|
||||
getWorld().playSoundFromEntity(null, this, state.getSoundGroup().getStepSound(), SoundCategory.BLOCKS, 1, 1);
|
||||
emitGameEvent(GameEvent.STEP);
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ public class SpellbookEntity extends MobEntity {
|
|||
if (player instanceof ServerPlayerEntity recipient
|
||||
&& player.currentScreenHandler instanceof SpellbookScreenHandler book
|
||||
&& getUuid().equals(book.entityId)) {
|
||||
Channel.SERVER_SPELLBOOK_UPDATE.sendToPlayer(new MsgSpellbookStateChanged<PlayerEntity>(book.syncId, state), recipient);
|
||||
Channel.SERVER_SPELLBOOK_UPDATE.sendToPlayer(new MsgSpellbookStateChanged<>(book.syncId, state), recipient);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -143,7 +143,7 @@ public class SpellbookEntity extends MobEntity {
|
|||
jumping = awake && isTouchingWater();
|
||||
super.tick();
|
||||
|
||||
if (world.isClient && isOpen()) {
|
||||
if (getWorld().isClient && isOpen()) {
|
||||
for (int offX = -2; offX <= 1; ++offX) {
|
||||
for (int offZ = -2; offZ <= 1; ++offZ) {
|
||||
if (offX > -1 && offX < 1 && offZ == -1) {
|
||||
|
@ -152,7 +152,7 @@ public class SpellbookEntity extends MobEntity {
|
|||
|
||||
if (random.nextInt(320) == 0) {
|
||||
for (int offY = 0; offY <= 1; ++offY) {
|
||||
world.addParticle(ParticleTypes.ENCHANT,
|
||||
getWorld().addParticle(ParticleTypes.ENCHANT,
|
||||
getX(), getY(), getZ(),
|
||||
offX/2F + random.nextFloat(),
|
||||
offY/2F - random.nextFloat() + 0.5f,
|
||||
|
@ -165,7 +165,7 @@ public class SpellbookEntity extends MobEntity {
|
|||
}
|
||||
|
||||
if (awake) {
|
||||
world.getOtherEntities(this, getBoundingBox().expand(2), EquinePredicates.PLAYER_UNICORN.and(e -> e instanceof PlayerEntity)).stream().findFirst().ifPresent(player -> {
|
||||
getWorld().getOtherEntities(this, getBoundingBox().expand(2), EquinePredicates.PLAYER_UNICORN.and(e -> e instanceof PlayerEntity)).stream().findFirst().ifPresent(player -> {
|
||||
setBored(false);
|
||||
if (isOpen()) {
|
||||
Vec3d diff = player.getPos().subtract(getPos());
|
||||
|
@ -176,15 +176,15 @@ public class SpellbookEntity extends MobEntity {
|
|||
}
|
||||
});
|
||||
|
||||
if (!world.isClient) {
|
||||
if (!getWorld().isClient) {
|
||||
if (activeTicks > 0 && --activeTicks <= 0) {
|
||||
setBored(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!world.isClient && world.random.nextInt(30) == 0) {
|
||||
float celest = world.getSkyAngle(1) * 4;
|
||||
if (!getWorld().isClient && getWorld().random.nextInt(30) == 0) {
|
||||
float celest = getWorld().getSkyAngle(1) * 4;
|
||||
|
||||
boolean daytime = celest > 3 || celest < 1;
|
||||
|
||||
|
@ -198,14 +198,14 @@ public class SpellbookEntity extends MobEntity {
|
|||
|
||||
@Override
|
||||
public boolean damage(DamageSource source, float amount) {
|
||||
if (!world.isClient) {
|
||||
if (!getWorld().isClient) {
|
||||
remove(Entity.RemovalReason.KILLED);
|
||||
|
||||
BlockSoundGroup sound = BlockSoundGroup.WOOD;
|
||||
|
||||
world.playSound(getX(), getY(), getZ(), sound.getBreakSound(), SoundCategory.BLOCKS, sound.getVolume(), sound.getPitch(), true);
|
||||
getWorld().playSound(getX(), getY(), getZ(), sound.getBreakSound(), SoundCategory.BLOCKS, sound.getVolume(), sound.getPitch(), true);
|
||||
|
||||
if (world.getGameRules().getBoolean(GameRules.DO_TILE_DROPS)) {
|
||||
if (getWorld().getGameRules().getBoolean(GameRules.DO_TILE_DROPS)) {
|
||||
dropStack(getPickBlockStack(), 1);
|
||||
}
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ public class SpellbookEntity extends MobEntity {
|
|||
|
||||
@Override
|
||||
public ScreenHandler createMenu(int syncId, PlayerInventory inv, PlayerEntity player) {
|
||||
return new SpellbookScreenHandler(syncId, inv, ScreenHandlerContext.create(world, getBlockPos()), state, getUuid());
|
||||
return new SpellbookScreenHandler(syncId, inv, ScreenHandlerContext.create(getWorld(), getBlockPos()), state, getUuid());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -87,7 +87,7 @@ public interface UTradeOffers {
|
|||
}
|
||||
|
||||
private static Item random(Entity e, TagKey<Item> item, Random rng) {
|
||||
return RegistryUtils.entriesForTag(e.world, item).getRandom(rng).get().value();
|
||||
return RegistryUtils.entriesForTag(e.getWorld(), item).getRandom(rng).get().value();
|
||||
}
|
||||
|
||||
static class JarredItemTradeOfferFactory implements TradeOffers.Factory {
|
||||
|
|
|
@ -52,7 +52,7 @@ public class DynamicTargetGoal extends Goal {
|
|||
mob.setTarget(null);
|
||||
}
|
||||
|
||||
target = VecHelper.findInRange(mob, mob.world, mob.getPos(), 26, test)
|
||||
target = VecHelper.findInRange(mob, mob.getWorld(), mob.getPos(), 26, test)
|
||||
.stream()
|
||||
.sorted(Comparator.comparing(e -> mob.distanceTo(e)))
|
||||
.findFirst();
|
||||
|
|
|
@ -66,11 +66,11 @@ public class EatMuffinGoal extends BreakHeartGoal {
|
|||
eatingStarted = true;
|
||||
|
||||
if (target instanceof PhysicsBodyProjectileEntity projectile) {
|
||||
mob.eatFood(mob.world, projectile.getStack());
|
||||
mob.eatFood(mob.getWorld(), projectile.getStack());
|
||||
projectile.discard();
|
||||
|
||||
if (mob instanceof AnimalEntity animal) {
|
||||
if (mob.world.random.nextInt(12) == 0) {
|
||||
if (mob.getWorld().random.nextInt(12) == 0) {
|
||||
Entity player = ((PhysicsBodyProjectileEntity) target).getOwner();
|
||||
|
||||
animal.lovePlayer(player instanceof PlayerEntity ? (PlayerEntity)player : null);
|
||||
|
|
|
@ -62,11 +62,11 @@ public class WantItTakeItGoal extends BreakHeartGoal {
|
|||
mob.tryAttack(target);
|
||||
mob.swingHand(Hand.MAIN_HAND);
|
||||
|
||||
if (mob.world.random.nextInt(20) == 0) {
|
||||
if (mob.getWorld().random.nextInt(20) == 0) {
|
||||
for (EquipmentSlot slot : EquipmentSlot.values()) {
|
||||
ItemStack stack = ((LivingEntity)target).getEquippedStack(slot);
|
||||
if (EnchantmentHelper.getLevel(UEnchantments.WANT_IT_NEED_IT, stack) > 0) {
|
||||
AwaitTickQueue.scheduleTask(mob.world, w -> {
|
||||
AwaitTickQueue.scheduleTask(mob.getWorld(), w -> {
|
||||
target.equipStack(slot, ItemStack.EMPTY);
|
||||
mob.tryEquip(stack);
|
||||
});
|
||||
|
@ -76,7 +76,7 @@ public class WantItTakeItGoal extends BreakHeartGoal {
|
|||
}
|
||||
}
|
||||
} else if (target instanceof ItemEntity) {
|
||||
AwaitTickQueue.scheduleTask(mob.world, w -> {
|
||||
AwaitTickQueue.scheduleTask(mob.getWorld(), w -> {
|
||||
ItemEntity item = (ItemEntity)target;
|
||||
ItemStack stack = item.getStack();
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ public class BeeBehaviour extends EntityBehaviour<BeeEntity> {
|
|||
@Override
|
||||
public BeeEntity onCreate(BeeEntity entity, EntityAppearance context, boolean replaceOld) {
|
||||
super.onCreate(entity, context, replaceOld);
|
||||
if (replaceOld && entity.world.isClient) {
|
||||
if (replaceOld && entity.getWorld().isClient) {
|
||||
InteractionManager.instance().playLoopingSound(entity, InteractionManager.SOUND_BEE, entity.getId());
|
||||
}
|
||||
return entity;
|
||||
|
|
|
@ -67,19 +67,19 @@ public class BlazeBehaviour extends EntityBehaviour<BlazeEntity> {
|
|||
|
||||
if (fireballsFired > 0) {
|
||||
if (!entity.isSilent()) {
|
||||
entity.world.syncWorldEvent(null, WorldEvents.BLAZE_SHOOTS, entity.getBlockPos(), 0);
|
||||
entity.getWorld().syncWorldEvent(null, WorldEvents.BLAZE_SHOOTS, entity.getBlockPos(), 0);
|
||||
}
|
||||
|
||||
Vec3d rot = player.asEntity().getRotationVec(1);
|
||||
|
||||
for (int i = 0; i < 1; ++i) {
|
||||
SmallFireballEntity proj = new SmallFireballEntity(entity.world, player.asEntity(),
|
||||
SmallFireballEntity proj = new SmallFireballEntity(entity.getWorld(), player.asEntity(),
|
||||
rot.getX() + entity.getRandom().nextGaussian(),
|
||||
rot.getY(),
|
||||
rot.getZ() + entity.getRandom().nextGaussian()
|
||||
);
|
||||
proj.setPosition(proj.getX(), entity.getBodyY(0.5D) + 0.5D, proj.getZ());
|
||||
entity.world.spawnEntity(proj);
|
||||
entity.getWorld().spawnEntity(proj);
|
||||
}
|
||||
}
|
||||
} else if (!firing) {
|
||||
|
|
|
@ -36,7 +36,7 @@ public class ChickenBehaviour extends EntityBehaviour<ChickenEntity> {
|
|||
player.asEntity().getInventory().removeStack(slot, 1);
|
||||
entity.playSound(SoundEvents.ENTITY_CHICKEN_EGG,
|
||||
1,
|
||||
(entity.world.random.nextFloat() - entity.world.random.nextFloat()) * 0.2F + 4
|
||||
(entity.getWorld().random.nextFloat() - entity.getWorld().random.nextFloat()) * 0.2F + 4
|
||||
);
|
||||
entity.equipStack(EquipmentSlot.OFFHAND, egg);
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ public class EntityBehaviour<T extends Entity> {
|
|||
((EntityDuck)to).setRemovalReason(from.getRemovalReason());
|
||||
to.setOnGround(from.isOnGround());
|
||||
|
||||
if (!from.world.isClient) {
|
||||
if (!from.getWorld().isClient) {
|
||||
// player collision is not known on the server
|
||||
boolean clip = to.noClip;
|
||||
to.noClip = false;
|
||||
|
@ -134,7 +134,7 @@ public class EntityBehaviour<T extends Entity> {
|
|||
|
||||
BlockPos pos = BlockPos.ofFloored(x, y, z);
|
||||
|
||||
if (!from.world.isAir(pos) && !from.world.isWater(pos)) {
|
||||
if (!from.getWorld().isAir(pos) && !from.getWorld().isWater(pos)) {
|
||||
y++;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ public interface EntitySwap {
|
|||
Swap<Entity> YAW = Swap.of(Entity::getYaw, Entity::setYaw);
|
||||
Swap<Entity> HEAD_YAW = Swap.of(Entity::getHeadYaw, (entity, headYaw) -> {
|
||||
entity.setHeadYaw(headYaw);
|
||||
if (entity.world instanceof ServerWorld sw) {
|
||||
if (entity.getWorld() instanceof ServerWorld sw) {
|
||||
sw.getChunkManager().sendToNearbyPlayers(entity, new EntitySetHeadYawS2CPacket(entity, (byte)MathHelper.floor(entity.getHeadYaw() * 256F / 360F)));
|
||||
}
|
||||
});
|
||||
|
|
|
@ -48,7 +48,7 @@ public class FallingBlockBehaviour extends EntityBehaviour<FallingBlockEntity> {
|
|||
|
||||
BlockState state = entity.getBlockState();
|
||||
if (state.getBlock() instanceof FallingBlock fb) {
|
||||
fb.onLanding(entity.world, entity.getBlockPos(), state, state, entity);
|
||||
fb.onLanding(entity.getWorld(), entity.getBlockPos(), state, state, entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,9 +73,9 @@ public class FallingBlockBehaviour extends EntityBehaviour<FallingBlockEntity> {
|
|||
BlockState lowerState = state.with(DoorBlock.HALF, DoubleBlockHalf.LOWER);
|
||||
BlockState upperState = state.with(DoorBlock.HALF, DoubleBlockHalf.UPPER);
|
||||
|
||||
context.attachExtraEntity(configure(MixinFallingBlockEntity.createInstance(entity.world, entity.getX(), entity.getY(), entity.getZ(), upperState), block));
|
||||
context.attachExtraEntity(configure(MixinFallingBlockEntity.createInstance(entity.getWorld(), entity.getX(), entity.getY(), entity.getZ(), upperState), block));
|
||||
|
||||
return configure(MixinFallingBlockEntity.createInstance(entity.world, entity.getX(), entity.getY() + 1, entity.getZ(), lowerState), block);
|
||||
return configure(MixinFallingBlockEntity.createInstance(entity.getWorld(), entity.getX(), entity.getY() + 1, entity.getZ(), lowerState), block);
|
||||
}
|
||||
|
||||
if (block instanceof BlockEntityProvider bep) {
|
||||
|
@ -90,10 +90,10 @@ public class FallingBlockBehaviour extends EntityBehaviour<FallingBlockEntity> {
|
|||
|
||||
BlockState state = entity.getBlockState();
|
||||
if (state.contains(Properties.WATERLOGGED)) {
|
||||
boolean logged = entity.world.isWater(entity.getBlockPos());
|
||||
boolean logged = entity.getWorld().isWater(entity.getBlockPos());
|
||||
|
||||
if (state.get(Properties.WATERLOGGED) != logged) {
|
||||
entity = MixinFallingBlockEntity.createInstance(entity.world, entity.getX(), entity.getY(), entity.getZ(), state.with(Properties.WATERLOGGED, logged));
|
||||
entity = MixinFallingBlockEntity.createInstance(entity.getWorld(), entity.getX(), entity.getY(), entity.getZ(), state.with(Properties.WATERLOGGED, logged));
|
||||
spell.getDisguise().setAppearance(entity);
|
||||
return;
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ public class FallingBlockBehaviour extends EntityBehaviour<FallingBlockEntity> {
|
|||
be.onSyncedBlockEvent(1, isSneakingOnGround(source) ? 1 : 0);
|
||||
}
|
||||
|
||||
be.setWorld(entity.world);
|
||||
be.setWorld(entity.getWorld());
|
||||
((Positioned)be).setPos(entity.getBlockPos());
|
||||
ceb.tick();
|
||||
be.setWorld(null);
|
||||
|
|
|
@ -19,16 +19,16 @@ public class GhastBehaviour extends MobBehaviour<GhastEntity> {
|
|||
|
||||
if (sneaking) {
|
||||
if (!entity.isSilent()) {
|
||||
entity.world.syncWorldEvent(null, WorldEvents.GHAST_WARNS, entity.getBlockPos(), 0);
|
||||
entity.getWorld().syncWorldEvent(null, WorldEvents.GHAST_WARNS, entity.getBlockPos(), 0);
|
||||
}
|
||||
} else {
|
||||
if (!entity.isSilent()) {
|
||||
entity.world.syncWorldEvent(null, WorldEvents.GHAST_SHOOTS, entity.getBlockPos(), 0);
|
||||
entity.getWorld().syncWorldEvent(null, WorldEvents.GHAST_SHOOTS, entity.getBlockPos(), 0);
|
||||
}
|
||||
|
||||
Vec3d rot = player.asEntity().getRotationVec(1);
|
||||
|
||||
FireballEntity proj = new FireballEntity(entity.world, player.asEntity(),
|
||||
FireballEntity proj = new FireballEntity(entity.getWorld(), player.asEntity(),
|
||||
rot.getX(),
|
||||
rot.getY(),
|
||||
rot.getZ(),
|
||||
|
@ -40,7 +40,7 @@ public class GhastBehaviour extends MobBehaviour<GhastEntity> {
|
|||
proj.getZ() + rot.z * 4
|
||||
);
|
||||
|
||||
entity.world.spawnEntity(proj);
|
||||
entity.getWorld().spawnEntity(proj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ public class MinecartBehaviour extends EntityBehaviour<AbstractMinecartEntity> {
|
|||
@Override
|
||||
public AbstractMinecartEntity onCreate(AbstractMinecartEntity entity, EntityAppearance context, boolean replaceOld) {
|
||||
super.onCreate(entity, context, replaceOld);
|
||||
if (replaceOld && entity.world.isClient) {
|
||||
if (replaceOld && entity.getWorld().isClient) {
|
||||
InteractionManager.instance().playLoopingSound(entity, InteractionManager.SOUND_MINECART, entity.getId());
|
||||
}
|
||||
return entity;
|
||||
|
|
|
@ -34,7 +34,7 @@ public class MobBehaviour<T extends MobEntity> extends EntityBehaviour<T> {
|
|||
@SuppressWarnings("unchecked")
|
||||
protected T getDummy(T entity) {
|
||||
if (dummy == null) {
|
||||
dummy = (T)entity.getType().create(entity.world);
|
||||
dummy = (T)entity.getType().create(entity.getWorld());
|
||||
}
|
||||
|
||||
return dummy;
|
||||
|
|
|
@ -28,7 +28,7 @@ public class RangedAttackBehaviour<T extends Entity & RangedAttackMob> extends E
|
|||
|
||||
if (player.sneakingChanged() && isSneakingOnGround(player)) {
|
||||
|
||||
ProjectileEntity spit = projectileSupplier.apply(entity.world, entity);
|
||||
ProjectileEntity spit = projectileSupplier.apply(entity.getWorld(), entity);
|
||||
|
||||
Vec3d rot = player.asEntity().getRotationVec(1);
|
||||
|
||||
|
@ -36,10 +36,10 @@ public class RangedAttackBehaviour<T extends Entity & RangedAttackMob> extends E
|
|||
spit.setOwner(player.asEntity());
|
||||
|
||||
if (!entity.isSilent()) {
|
||||
SoundEmitter.playSoundAt(entity, sound, 1, 1 + (entity.world.random.nextFloat() - entity.world.random.nextFloat()) * 0.2F);
|
||||
SoundEmitter.playSoundAt(entity, sound, 1, 1 + (entity.getWorld().random.nextFloat() - entity.getWorld().random.nextFloat()) * 0.2F);
|
||||
}
|
||||
|
||||
entity.world.spawnEntity(spit);
|
||||
entity.getWorld().spawnEntity(spit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,17 +22,17 @@ public class SheepBehaviour extends EntityBehaviour<SheepEntity> {
|
|||
if (player.sneakingChanged()) {
|
||||
|
||||
BlockPos pos = entity.getBlockPos().down();
|
||||
BlockState state = entity.world.getBlockState(pos);
|
||||
BlockState state = entity.getWorld().getBlockState(pos);
|
||||
boolean grass = state.isOf(Blocks.GRASS_BLOCK);
|
||||
|
||||
if (player.asEntity().isSneaking()) {
|
||||
if (grass && entity.world.isClient && entity.isSheared()) {
|
||||
if (grass && entity.getWorld().isClient && entity.isSheared()) {
|
||||
entity.handleStatus((byte)10);
|
||||
}
|
||||
} else {
|
||||
if (entity.isSheared() && grass) {
|
||||
entity.world.syncWorldEvent(WorldEvents.BLOCK_BROKEN, pos, Block.getRawIdFromState(state));
|
||||
entity.world.setBlockState(pos, Blocks.DIRT.getDefaultState(), 2);
|
||||
entity.getWorld().syncWorldEvent(WorldEvents.BLOCK_BROKEN, pos, Block.getRawIdFromState(state));
|
||||
entity.getWorld().setBlockState(pos, Blocks.DIRT.getDefaultState(), 2);
|
||||
|
||||
entity.onEatingGrass();
|
||||
} else if (!entity.isSheared()) {
|
||||
|
@ -41,7 +41,7 @@ public class SheepBehaviour extends EntityBehaviour<SheepEntity> {
|
|||
player.asEntity().playSound(SoundEvents.ENTITY_SHEEP_SHEAR, 1, 1);
|
||||
entity.setSheared(true);
|
||||
|
||||
Random rng = entity.world.random;
|
||||
Random rng = entity.getWorld().random;
|
||||
PlayerInventory inv = player.asEntity().getInventory();
|
||||
|
||||
int dropAmount = rng.nextInt(3);
|
||||
|
|
|
@ -24,7 +24,7 @@ public class ShulkerBehaviour extends EntityBehaviour<ShulkerEntity> {
|
|||
Direction attachmentFace = shulker.getAttachedFace();
|
||||
BlockPos pos = shulker.getBlockPos().offset(attachmentFace);
|
||||
|
||||
boolean noGravity = !shulker.isOnGround() && !shulker.world.isAir(pos)
|
||||
boolean noGravity = !shulker.isOnGround() && !shulker.getWorld().isAir(pos)
|
||||
&& (attachmentFace == Direction.UP || attachmentFace.getAxis() != Axis.Y);
|
||||
|
||||
source.asEntity().setNoGravity(noGravity);
|
||||
|
@ -54,7 +54,7 @@ public class ShulkerBehaviour extends EntityBehaviour<ShulkerEntity> {
|
|||
if (player.sneakingChanged()) {
|
||||
mx.callSetPeekAmount((int)(peekAmount / 0.01F));
|
||||
} else if (peekAmount > 0.2 && mx.callGetPeekAmount() == 0) {
|
||||
if (shulker.isAlive() && shulker.world.random.nextInt(1000) < shulker.ambientSoundChance++) {
|
||||
if (shulker.isAlive() && shulker.getWorld().random.nextInt(1000) < shulker.ambientSoundChance++) {
|
||||
shulker.ambientSoundChance = -shulker.getMinAmbientSoundDelay();
|
||||
shulker.playSound(SoundEvents.ENTITY_SHULKER_AMBIENT, 1, 1);
|
||||
}
|
||||
|
|
|
@ -14,10 +14,10 @@ public class SilverfishBehaviour extends EntityBehaviour<SilverfishEntity> {
|
|||
public void update(Pony player, SilverfishEntity entity, Disguise spell) {
|
||||
if (!player.isClient() && player.sneakingChanged() && player.asEntity().isSneaking()) {
|
||||
BlockPos pos = entity.getBlockPos().down();
|
||||
BlockState state = entity.world.getBlockState(pos);
|
||||
BlockState state = entity.getWorld().getBlockState(pos);
|
||||
|
||||
if (StateMaps.SILVERFISH_AFFECTED.convert(entity.world, pos)) {
|
||||
entity.world.syncWorldEvent(WorldEvents.BLOCK_BROKEN, pos, Block.getRawIdFromState(state));
|
||||
if (StateMaps.SILVERFISH_AFFECTED.convert(entity.getWorld(), pos)) {
|
||||
entity.getWorld().syncWorldEvent(WorldEvents.BLOCK_BROKEN, pos, Block.getRawIdFromState(state));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ public class SpellcastingIllagerBehaviour extends EntityBehaviour<SpellcastingIl
|
|||
static void setSpell(Pony player, SpellcastingIllagerEntity entity, Disguise s) {
|
||||
if (player.asEntity().isSneaking()) {
|
||||
SpellcastingIllagerEntity.Spell[] spells = SpellcastingIllagerEntity.Spell.values();
|
||||
SpellcastingIllagerEntity.Spell spell = spells[entity.world.random.nextInt(spells.length - 1) + 1];
|
||||
SpellcastingIllagerEntity.Spell spell = spells[entity.getWorld().random.nextInt(spells.length - 1) + 1];
|
||||
|
||||
entity.setSpell(spell);
|
||||
entity.setTarget(entity);
|
||||
|
|
|
@ -11,7 +11,7 @@ public class TraderBehaviour extends EntityBehaviour<MerchantEntity> {
|
|||
if (pony.sneakingChanged() && pony.asEntity().isSneaking()) {
|
||||
entity.setHeadRollingTimeLeft(40);
|
||||
|
||||
if (!entity.world.isClient()) {
|
||||
if (!entity.getWorld().isClient()) {
|
||||
entity.playSound(SoundEvents.ENTITY_VILLAGER_NO, 1, 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public class EntityCollisions {
|
|||
} else if (entity instanceof FallingBlockEntity) {
|
||||
BlockPos pos = entity.getBlockPos();
|
||||
output.accept(((FallingBlockEntity) entity).getBlockState()
|
||||
.getCollisionShape(entity.world, entity.getBlockPos(), context)
|
||||
.getCollisionShape(entity.getWorld(), entity.getBlockPos(), context)
|
||||
.offset(pos.getX(), pos.getY(), pos.getZ())
|
||||
);
|
||||
}
|
||||
|
|
|
@ -25,21 +25,21 @@ public class ButterfingersStatusEffect extends StatusEffect {
|
|||
amplifier = MathHelper.clamp(amplifier, 0, 5);
|
||||
final int scale = 500 + (int)(((5 - amplifier) / 5F) * 900);
|
||||
|
||||
if (entity.world.random.nextInt(scale / 4) == 0) {
|
||||
applyInstantEffect(null, null, entity, amplifier, entity.world.random.nextInt(scale));
|
||||
if (entity.getWorld().random.nextInt(scale / 4) == 0) {
|
||||
applyInstantEffect(null, null, entity, amplifier, entity.getWorld().random.nextInt(scale));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyInstantEffect(@Nullable Entity source, @Nullable Entity attacker, LivingEntity target, int amplifier, double proximity) {
|
||||
|
||||
if (target.world.isClient) {
|
||||
if (target.getWorld().isClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (target instanceof ServerPlayerEntity player) {
|
||||
if (player.dropSelectedItem(proximity < 1)) {
|
||||
player.world.playSound(null, player.getBlockPos(), SoundEvents.BLOCK_HONEY_BLOCK_SLIDE, player.getSoundCategory());
|
||||
player.getWorld().playSound(null, player.getBlockPos(), SoundEvents.BLOCK_HONEY_BLOCK_SLIDE, player.getSoundCategory());
|
||||
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.getWorld().playSound(null, target.getBlockPos(), SoundEvents.BLOCK_HONEY_BLOCK_SLIDE, target.getSoundCategory());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,35 +28,29 @@ public class CorruptInfluenceStatusEffect extends StatusEffect {
|
|||
@Override
|
||||
public void applyUpdateEffect(LivingEntity entity, int amplifier) {
|
||||
|
||||
if (entity.world.isClient) {
|
||||
if (entity.getWorld().isClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (entity instanceof HostileEntity) {
|
||||
|
||||
int nearby = 0;
|
||||
|
||||
for (Entity i : entity.world.getOtherEntities(entity, entity.getBoundingBox().expand(40))) {
|
||||
if (i.getType() == entity.getType()) {
|
||||
nearby++;
|
||||
}
|
||||
}
|
||||
int nearby = entity.getWorld().getOtherEntities(entity, entity.getBoundingBox().expand(40), i -> i.getType() == entity.getType()).size();
|
||||
|
||||
if (nearby > 1) {
|
||||
if (Equine.of(entity).filter(eq -> eq instanceof Owned<?> o && o.getMaster() != null).isPresent()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (entity.world.random.nextInt(2000) != 0) {
|
||||
if (entity.getWorld().random.nextInt(2000) != 0) {
|
||||
return;
|
||||
}
|
||||
} else if (entity.world.random.nextInt(200) != 0) {
|
||||
} else if (entity.getWorld().random.nextInt(200) != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
HostileEntity mob = (HostileEntity)entity;
|
||||
|
||||
HostileEntity clone = (HostileEntity)mob.getType().create(mob.world);
|
||||
HostileEntity clone = (HostileEntity)mob.getType().create(mob.getWorld());
|
||||
clone.copyPositionAndRotation(entity);
|
||||
|
||||
Equine.of(clone).ifPresent(eq -> {
|
||||
|
@ -64,10 +58,10 @@ public class CorruptInfluenceStatusEffect extends StatusEffect {
|
|||
((Owned.Mutable<Entity>)eq).setMaster(mob);
|
||||
}
|
||||
});
|
||||
mob.world.spawnEntity(clone);
|
||||
mob.getWorld().spawnEntity(clone);
|
||||
|
||||
if (!mob.isSilent()) {
|
||||
mob.world.syncWorldEvent((PlayerEntity)null, WorldEvents.ZOMBIE_INFECTS_VILLAGER, mob.getBlockPos(), 0);
|
||||
mob.getWorld().syncWorldEvent((PlayerEntity)null, WorldEvents.ZOMBIE_INFECTS_VILLAGER, mob.getBlockPos(), 0);
|
||||
}
|
||||
} else if (entity.age % 2000 == 0) {
|
||||
entity.damage(Living.living(entity).damageOf(UDamageTypes.ALICORN_AMULET), 2);
|
||||
|
|
|
@ -80,7 +80,7 @@ public class SunBlindnessStatusEffect extends StatusEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
return isPositionExposedToSun(entity.world, entity.getBlockPos());
|
||||
return isPositionExposedToSun(entity.getWorld(), entity.getBlockPos());
|
||||
}
|
||||
|
||||
public static boolean isPositionExposedToSun(World world, BlockPos pos) {
|
||||
|
|
|
@ -20,7 +20,7 @@ public interface MeteorlogicalUtil {
|
|||
}
|
||||
|
||||
// we translate sun angle to a scale of 0-1 (0=sunrise, 1=sunset, >1 nighttime)
|
||||
final float skyAngle = ((entity.world.getSkyAngle(1) + 0.25F) % 1F) * 2;
|
||||
final float skyAngle = ((entity.getWorld().getSkyAngle(1) + 0.25F) % 1F) * 2;
|
||||
float playerYaw = MathHelper.wrapDegrees(entity.getHeadYaw());
|
||||
float playerAngle = (-entity.getPitch(1) / 90F) / 2F;
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue