Skip to content

Commit

Permalink
fix compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
UpcraftLP committed Dec 9, 2023
1 parent cf6a58a commit 93c872e
Show file tree
Hide file tree
Showing 21 changed files with 92 additions and 94 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public SolarStrikeEntityRenderer(EntityRendererProvider.Context context) {

@Override
public void render(SolarStrikeEntity entity, float yaw, float tickDelta, PoseStack matrices, MultiBufferSource provider, int light) {
renderBeam(entity, matrices, provider, 0, (float) ((entity.level.getHeight() + 2048) - entity.getY()), 0, tickDelta, OverlayTexture.NO_OVERLAY, light);
renderBeam(entity, matrices, provider, 0, (float) ((entity.level().getHeight() + 2048) - entity.getY()), 0, tickDelta, OverlayTexture.NO_OVERLAY, light);
}

public void renderBeam(SolarStrikeEntity entity, PoseStack matrices, MultiBufferSource provider, float x, float y, float z, float tickDelta, int overlay, int light) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package dev.cammiescorner.arcanus.client.screens;

import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import dev.cammiescorner.arcanus.Arcanus;
import dev.cammiescorner.arcanus.screen.BookshelfScreenHandler;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.network.chat.Component;
Expand All @@ -18,20 +18,19 @@ public BookshelfScreen(BookshelfScreenHandler handler, Inventory inventory, Comp
}

@Override
protected void renderBg(PoseStack matrices, float delta, int mouseX, int mouseY) {
protected void renderBg(GuiGraphics graphics, float delta, int mouseX, int mouseY) {
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.setShaderTexture(0, TEXTURE);
int x = (width - imageWidth) / 2;
int y = (height - imageHeight) / 2;
blit(matrices, x, y, 0, 0, imageWidth, imageHeight);
graphics.blit(TEXTURE, x, y, 0, 0, imageWidth, imageHeight);
}

@Override
public void render(PoseStack matrices, int mouseX, int mouseY, float delta) {
renderBackground(matrices);
super.render(matrices, mouseX, mouseY, delta);
renderTooltip(matrices, mouseX, mouseY);
public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
renderBackground(graphics);
super.render(graphics, mouseX, mouseY, delta);
renderTooltip(graphics, mouseX, mouseY);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public Spell getActiveSpell() {

@Override
public void serverTick() {
Level level = player.getLevel();
Level level = player.level();
if (activeSpell != null) {
activeSpell.onActiveTick(level, this, activeSpellTimer);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void tick() {

super.tick();

if (!level.isClientSide()) {
if (!level().isClientSide()) {
setHitTimer(Math.max(0, getHitTimer() - 1));

if (tickCount > 0 && tickCount % 600 == 0)
Expand All @@ -81,7 +81,7 @@ private void moveEntities() {
if (tickCount <= Math.ceil(ArcaneBarrierEntity.MAX_HEIGHT / ArcaneBarrierEntity.GROWTH_RATE)) {
reapplyPosition();

List<Entity> list = level.getEntities(this, getBoundingBox(), EntitySelector.NO_SPECTATORS.and((entity) -> !entity.isPassengerOfSameVehicle(this)));
List<Entity> list = level().getEntities(this, getBoundingBox(), EntitySelector.NO_SPECTATORS.and((entity) -> !entity.isPassengerOfSameVehicle(this)));

for (Entity entity : list)
if (!(entity instanceof Shulker || entity instanceof ArcaneBarrierEntity) && !entity.noPhysics)
Expand All @@ -98,7 +98,7 @@ protected void defineSynchedData() {
@Override
protected void readAdditionalSaveData(CompoundTag nbt) {
if (nbt.contains("Owner"))
owner = level.getPlayerByUUID(nbt.getUUID("Owner"));
owner = level().getPlayerByUUID(nbt.getUUID("Owner"));
}

@Override
Expand All @@ -111,7 +111,7 @@ protected void addAdditionalSaveData(CompoundTag nbt) {
public boolean hurt(DamageSource source, float amount) {
if (this.isInvulnerableTo(source))
return false;
else if (this.level.isClientSide)
else if (this.level().isClientSide())
return false;
else if (this.isRemoved())
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ public MagicMissileEntity(EntityType<? extends MagicMissileEntity> type, Level w
public void tick() {
super.tick();

if (!level.isClientSide()) {
if (!level().isClientSide()) {
for (int count = 0; count < 16; count++) {
double x = getX() + (level.random.nextInt(3) - 1) / 4D;
double y = getY() + 0.2F + (level.random.nextInt(3) - 1) / 4D;
double z = getZ() + (level.random.nextInt(3) - 1) / 4D;
double deltaX = (level.random.nextInt(3) - 1) * level.random.nextDouble();
double deltaY = (level.random.nextInt(3) - 1) * level.random.nextDouble();
double deltaZ = (level.random.nextInt(3) - 1) * level.random.nextDouble();
double x = getX() + (random.nextInt(3) - 1) / 4D;
double y = getY() + 0.2F + (random.nextInt(3) - 1) / 4D;
double z = getZ() + (random.nextInt(3) - 1) / 4D;
double deltaX = (random.nextInt(3) - 1) * random.nextDouble();
double deltaY = (random.nextInt(3) - 1) * random.nextDouble();
double deltaZ = (random.nextInt(3) - 1) * random.nextDouble();

PlayerLookup.tracking(this).forEach(player -> ((ServerLevel) level).sendParticles(player, (ParticleOptions) ArcanusParticles.MAGIC_MISSILE, true, x, y, z, 1, deltaX, deltaY, deltaZ, 0.1));
PlayerLookup.tracking(this).forEach(player -> ((ServerLevel) level()).sendParticles(player, (ParticleOptions) ArcanusParticles.MAGIC_MISSILE, true, x, y, z, 1, deltaX, deltaY, deltaZ, 0.1));
}
}

Expand Down Expand Up @@ -72,7 +72,7 @@ protected void onHitEntity(EntityHitResult entityHitResult) {

@Override
public void playerTouch(Player player) {
if (!level.isClientSide && (inGround || isNoPhysics()) && shakeTime <= 0)
if (!level().isClientSide() && (inGround || isNoPhysics()) && shakeTime <= 0)
discard();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import dev.cammiescorner.arcanus.registry.ArcanusDamageTypes;
import dev.cammiescorner.arcanus.registry.ArcanusEntities;
import dev.cammiescorner.arcanus.registry.ArcanusSoundEvents;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.server.level.ServerLevel;
Expand All @@ -19,6 +17,9 @@
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec2;

import java.util.ArrayList;
import java.util.List;

public class SolarStrikeEntity extends AbstractArrow {

public final List<Entity> hasHit = new ArrayList<>();
Expand All @@ -33,12 +34,12 @@ public SolarStrikeEntity(EntityType<? extends SolarStrikeEntity> type, Level wor

@Override
public void tick() {
if (!level.isClientSide()) {
if (!level().isClientSide()) {
if (tickCount <= 9) {
AABB box = new AABB(getX() - 4, getY() - 1, getZ() - 4, getX() + 4, (level.getHeight() + 2048) - getY(), getZ() + 4);
AABB box = new AABB(getX() - 4, getY() - 1, getZ() - 4, getX() + 4, (level().getHeight() + 2048) - getY(), getZ() + 4);
float radius = (float) (box.maxX - box.minX) / 2;

level.getEntities(null, box).forEach(entity -> {
level().getEntities(null, box).forEach(entity -> {
if (!hasHit.contains(entity)) {
Vec2 pos1 = new Vec2((float) getX(), (float) getZ());
Vec2 pos2 = new Vec2((float) entity.getX(), (float) entity.getZ());
Expand All @@ -59,21 +60,21 @@ public void tick() {
kill();
} else {
if (tickCount == 1)
level.playLocalSound(getX(), getY(), getZ(), ArcanusSoundEvents.SOLAR_STRIKE, SoundSource.PLAYERS, Mth.clamp(1 - (Minecraft.getInstance().player.distanceTo(this) / 256F), 0, 1), (1.0F + (random.nextFloat() - random.nextFloat()) * 0.2F) * 0.7F, false);
level().playLocalSound(getX(), getY(), getZ(), ArcanusSoundEvents.SOLAR_STRIKE, SoundSource.PLAYERS, Mth.clamp(1 - (Minecraft.getInstance().player.distanceTo(this) / 256F), 0, 1), (1.0F + (random.nextFloat() - random.nextFloat()) * 0.2F) * 0.7F, false);

if (tickCount >= 2 && tickCount <= 5) {
level.addParticle(ParticleTypes.EXPLOSION_EMITTER, getX() + 2, getY(), getZ(), 1.0D, 0.0D, 0.0D);
level.addParticle(ParticleTypes.EXPLOSION_EMITTER, getX() - 2, getY(), getZ(), 1.0D, 0.0D, 0.0D);
level.addParticle(ParticleTypes.EXPLOSION_EMITTER, getX(), getY(), getZ() + 2, 1.0D, 0.0D, 0.0D);
level.addParticle(ParticleTypes.EXPLOSION_EMITTER, getX(), getY(), getZ() - 2, 1.0D, 0.0D, 0.0D);
level().addParticle(ParticleTypes.EXPLOSION_EMITTER, getX() + 2, getY(), getZ(), 1.0D, 0.0D, 0.0D);
level().addParticle(ParticleTypes.EXPLOSION_EMITTER, getX() - 2, getY(), getZ(), 1.0D, 0.0D, 0.0D);
level().addParticle(ParticleTypes.EXPLOSION_EMITTER, getX(), getY(), getZ() + 2, 1.0D, 0.0D, 0.0D);
level().addParticle(ParticleTypes.EXPLOSION_EMITTER, getX(), getY(), getZ() - 2, 1.0D, 0.0D, 0.0D);
}
}
}

@Override
public void kill() {
if (!level.isClientSide())
((ServerLevel) level).setChunkForced(chunkPosition().x, chunkPosition().z, false);
if (!level().isClientSide())
((ServerLevel) level()).setChunkForced(chunkPosition().x, chunkPosition().z, false);

super.kill();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void onRightClick(CallbackInfo info) {
unfinishedSpell = true;
pattern.add(Spell.Pattern.RIGHT);
player.swing(InteractionHand.MAIN_HAND);
player.level.playSeededSound(player, player.getX(), player.getY(), player.getZ(), SoundEvents.UI_BUTTON_CLICK, SoundSource.PLAYERS, 1F, 1.1F, 0L);
player.level().playSeededSound(player, player.getX(), player.getY(), player.getZ(), SoundEvents.UI_BUTTON_CLICK, SoundSource.PLAYERS, 1F, 1.1F, 0L);
info.cancel();
}
}
Expand All @@ -93,7 +93,7 @@ public void onLeftClick(CallbackInfo info) {
unfinishedSpell = true;
pattern.add(Spell.Pattern.LEFT);
player.swing(InteractionHand.MAIN_HAND);
player.level.playSeededSound(player, player.getX(), player.getY(), player.getZ(), SoundEvents.UI_BUTTON_CLICK, SoundSource.PLAYERS, 1F, 1.3F, 0L);
player.level().playSeededSound(player, player.getX(), player.getY(), player.getZ(), SoundEvents.UI_BUTTON_CLICK, SoundSource.PLAYERS, 1F, 1.3F, 0L);
info.cancel();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ public static void handle(MinecraftServer server, ServerPlayer player, ServerGam
if(!caster.cast(spell)) {
return;
}
caster.setLastCastTime(player.level.getGameTime());
caster.setLastCastTime(player.level().getGameTime());

if (!player.isCreative()) {
if (caster.getMana() < realManaCost && ArcanusConfig.haveBurnout) {
int burnoutAmount = realManaCost - caster.getMana();
caster.addBurnout(burnoutAmount);
player.hurt(ArcanusDamageTypes.burnout(player.level), burnoutAmount);
player.hurt(ArcanusDamageTypes.burnout(player.level()), burnoutAmount);
player.displayClientMessage(Arcanus.translate("error", "burnout").withStyle(ChatFormatting.RED), false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ public static int listPlayerSpells(CommandContext<CommandSourceStack> context, P
MutableComponent knownSpells = Component.literal("");
spells.stream().sorted(Comparator.comparing(spell -> Arcanus.SPELL.getKey(spell).toString())).forEachOrdered(spell -> knownSpells.append("\n - ").append(Component.translatable(spell.getTranslationKey())).append(" (" + spell.getSpellPattern().get(0).getSymbol() + "-" + spell.getSpellPattern().get(1).getSymbol() + "-" + spell.getSpellPattern().get(2).getSymbol() + ")"));

context.getSource().sendSuccess(Arcanus.translate("commands", "spells.list", player.getScoreboardName(), knownSpells), false);
context.getSource().sendSuccess(() -> Arcanus.translate("commands", "spells.list", player.getScoreboardName(), knownSpells), false);
return spells.size();
}

public static int addAllSpellsToPlayer(CommandContext<CommandSourceStack> context, ServerPlayer player) {
SpellMemory memory = player.getComponent(ArcanusComponents.SPELL_MEMORY);
int count = (int) Arcanus.SPELL.stream().filter(memory::unlockSpell).count();
player.syncComponent(ArcanusComponents.SPELL_MEMORY);
context.getSource().sendSuccess(Arcanus.translate("commands", "spells.added_all", player.getDisplayName()), false);
context.getSource().sendSuccess(() -> Arcanus.translate("commands", "spells.added_all", player.getDisplayName()), false);
return Math.max(count, 1);
}

Expand All @@ -103,7 +103,7 @@ public static int addSpellToPlayer(CommandContext<CommandSourceStack> context, S
Spell spell = ResourceArgument.getResource(context, "spell", Arcanus.SPELL_KEY).value();

if (memory.unlockSpell(spell)) {
context.getSource().sendSuccess(Arcanus.translate("commands", "spells.added", Component.translatable(spell.getTranslationKey(), Arcanus.SPELL.getKey(spell)), player.getScoreboardName()), false);
context.getSource().sendSuccess(() -> Arcanus.translate("commands", "spells.added", Component.translatable(spell.getTranslationKey(), Arcanus.SPELL.getKey(spell)), player.getScoreboardName()), false);
player.syncComponent(ArcanusComponents.SPELL_MEMORY);
return Command.SINGLE_SUCCESS;
}
Expand All @@ -116,7 +116,7 @@ public static int removeAllSpellsFromPlayer(CommandContext<CommandSourceStack> c
SpellMemory memory = player.getComponent(ArcanusComponents.SPELL_MEMORY);
memory.clear();
player.syncComponent(ArcanusComponents.SPELL_MEMORY);
context.getSource().sendSuccess(Arcanus.translate("commands", "spells.cleared", player.getDisplayName()), false);
context.getSource().sendSuccess(() -> Arcanus.translate("commands", "spells.cleared", player.getDisplayName()), false);
return Command.SINGLE_SUCCESS;
}

Expand All @@ -125,7 +125,7 @@ public static int removeSpellFromPlayer(CommandContext<CommandSourceStack> conte
Spell spell = ResourceArgument.getResource(context, "spell", Arcanus.SPELL_KEY).value();

if (memory.removeSpell(spell)) {
context.getSource().sendSuccess(Arcanus.translate("commands", "spells.removed", Component.translatable(spell.getTranslationKey(), Arcanus.SPELL.getKey(spell)), player.getDisplayName()), false);
context.getSource().sendSuccess(() -> Arcanus.translate("commands", "spells.removed", Component.translatable(spell.getTranslationKey(), Arcanus.SPELL.getKey(spell)), player.getDisplayName()), false);
player.syncComponent(ArcanusComponents.SPELL_MEMORY);
return Command.SINGLE_SUCCESS;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ public void onCast(MagicCaster caster) {
BlockHitResult blockResult = ((BlockHitResult) result);
Direction side = blockResult.getDirection();
BlockPos pos = blockResult.getBlockPos().offset(side.getStepX(), side.getStepY(), side.getStepZ());
ArcaneBarrierEntity arcaneWall = new ArcaneBarrierEntity(entity.getLevel());
ArcaneBarrierEntity arcaneWall = new ArcaneBarrierEntity(entity.level());

if (entity instanceof Player player) {
arcaneWall.setOwner(player);

if (!player.mayInteract(arcaneWall.getLevel(), pos)) {
if (!player.mayInteract(arcaneWall.level(), pos)) {
player.displayClientMessage(Arcanus.translate("spell", "cannot_interact"), false);
return;
}
}
arcaneWall.setPos(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
entity.getLevel().addFreshEntity(arcaneWall);
entity.level().addFreshEntity(arcaneWall);
} else {
if (entity instanceof Player player) {
player.displayClientMessage(Arcanus.translate("spell", "no_target"), false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void onCast(MagicCaster caster) {
Vec3 startPos = entity.getEyePosition(1F).add((entity.getRandom().nextInt(3) - 1) / startDivisor, (entity.getRandom().nextInt(3) - 1) / startDivisor, (entity.getRandom().nextInt(3) - 1) / startDivisor);
Vec3 endPos = result.getLocation().add((entity.getRandom().nextInt(3) - 1) / endDivisor, (entity.getRandom().nextInt(3) - 1) / endDivisor, (entity.getRandom().nextInt(3) - 1) / endDivisor);

ArcanusHelper.drawLine(startPos, endPos, entity.getLevel(), 0.5F, (ParticleOptions) ArcanusParticles.DISCOMBOBULATE);
ArcanusHelper.drawLine(startPos, endPos, entity.level(), 0.5F, (ParticleOptions) ArcanusParticles.DISCOMBOBULATE);
}

if (result.getType() == HitResult.Type.ENTITY) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void onCast(MagicCaster caster) {
Vec3 prevPos = serverPlayer.position();
QuiltDimensions.teleport(serverPlayer, serverWorld, new PortalInfo(spawnPoint, Vec3.ZERO, (float) rotation.x, (float) rotation.y));
serverWorld.playSound(null, prevPos.x(), prevPos.y(), prevPos.z(), SoundEvents.ENDERMAN_TELEPORT, SoundSource.PLAYERS, 2F, 1F);
serverPlayer.getLevel().playSound(null, serverPlayer, SoundEvents.ENDERMAN_TELEPORT, SoundSource.PLAYERS, 2F, 1F);
serverPlayer.level().playSound(null, serverPlayer, SoundEvents.ENDERMAN_TELEPORT, SoundSource.PLAYERS, 2F, 1F);
return;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/dev/cammiescorner/arcanus/spell/HealSpell.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ public HealSpell(Pattern first, Pattern second, Pattern last, int manaCost) {
public void onCast(MagicCaster caster) {
LivingEntity entity = caster.asEntity();
entity.heal(10);
entity.getLevel().playSound(null, entity, ArcanusSoundEvents.HEAL, SoundSource.PLAYERS, 2F, entity.getRandom().nextFloat() * 0.2F + 1.0F);
entity.level().playSound(null, entity, ArcanusSoundEvents.HEAL, SoundSource.PLAYERS, 2F, entity.getRandom().nextFloat() * 0.2F + 1.0F);

for (int amount = 0; amount < 32; amount++) {
float offsetX = ((entity.getRandom().nextInt(3) - 1) * entity.getRandom().nextFloat());
float offsetY = entity.getRandom().nextFloat() * 2F;
float offsetZ = ((entity.getRandom().nextInt(3) - 1) * entity.getRandom().nextFloat());

((ServerLevel) entity.getLevel()).sendParticles((ParticleOptions) ArcanusParticles.HEAL, entity.getX() + offsetX, entity.getY() - 0.5 + offsetY, entity.getZ() + offsetZ, 3, 0, 0, 0, 0);
((ServerLevel) entity.level()).sendParticles((ParticleOptions) ArcanusParticles.HEAL, entity.getX() + offsetX, entity.getY() - 0.5 + offsetY, entity.getZ() + offsetZ, 3, 0, 0, 0, 0);
}
}
}
Loading

0 comments on commit 93c872e

Please sign in to comment.