Skip to content

Commit

Permalink
Rename mixins
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaming32 committed Jun 3, 2023
1 parent 17cb188 commit 05e8a29
Show file tree
Hide file tree
Showing 36 changed files with 84 additions and 85 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package com.fusionflux.portalcubed.accessor;

public interface HeldItemRendererExt {
public interface ItemInHandRendererExt {
void startHandFaker();
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.fusionflux.portalcubed.accessor;

public interface FramebufferExt {
public interface RenderTargetExt {
boolean isStencilBufferEnabled();

void setStencilBufferEnabled(boolean enabled);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public void tick(Level world, BlockPos pos, BlockState state) {
aimDests = PortalDirectionUtils.raycast(world, new ClipContext(
gunPos, gunPos.add(Vec3.directionFromRotation(pitch, yaw - 90).scale(127)),
ClipContext.Block.VISUAL, ClipContext.Fluid.NONE,
// We can pass null here because of ShapeContextMixin
// We can pass null here because of CollisionContextMixin
null
)).rays().stream().map(r -> new Tuple<>(r.start(), r.end())).toList();
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import com.fusionflux.portalcubed.items.PortalGun;
import com.fusionflux.portalcubed.mixin.client.AbstractSoundInstanceAccessor;
import com.fusionflux.portalcubed.mixin.client.DeathScreenAccessor;
import com.fusionflux.portalcubed.mixin.client.MusicTrackerAccessor;
import com.fusionflux.portalcubed.mixin.client.MusicManagerAccessor;
import com.fusionflux.portalcubed.optionslist.OptionsListScreen;
import com.fusionflux.portalcubed.packet.PortalCubedServerPackets;
import com.fusionflux.portalcubed.sound.PortalCubedSounds;
Expand Down Expand Up @@ -220,7 +220,7 @@ public void onInitializeClient(ModContainer mod) {
client.getSoundManager().play(excursionFunnelMusic);
} else if (excursionFunnelMusic.getVolume() < 1f && excursionFunnelMusic instanceof AbstractSoundInstanceAccessor access) {
access.setVolume(excursionFunnelMusic.getVolume() + 0.05f);
if (((MusicTrackerAccessor)client.getMusicManager()).getCurrentMusic() instanceof AbstractSoundInstanceAccessor cAccess) {
if (((MusicManagerAccessor)client.getMusicManager()).getCurrentMusic() instanceof AbstractSoundInstanceAccessor cAccess) {
cAccess.setVolume(1f - excursionFunnelMusic.getVolume() / 2);
}
client.getSoundManager().updateSourceVolume(null, 0); // If first argument is null, all it does is refresh SoundInstance volumes
Expand All @@ -229,13 +229,13 @@ public void onInitializeClient(ModContainer mod) {
if (excursionFunnelMusic.getVolume() <= 0f) {
client.getSoundManager().stop(excursionFunnelMusic);
excursionFunnelMusic = null;
if (((MusicTrackerAccessor)client.getMusicManager()).getCurrentMusic() instanceof AbstractSoundInstanceAccessor access) {
if (((MusicManagerAccessor)client.getMusicManager()).getCurrentMusic() instanceof AbstractSoundInstanceAccessor access) {
access.setVolume(1f);
client.getSoundManager().updateSourceVolume(null, 0); // See above
}
} else if (excursionFunnelMusic instanceof AbstractSoundInstanceAccessor access) {
access.setVolume(excursionFunnelMusic.getVolume() - 0.05f);
if (((MusicTrackerAccessor)client.getMusicManager()).getCurrentMusic() instanceof AbstractSoundInstanceAccessor cAccess) {
if (((MusicManagerAccessor)client.getMusicManager()).getCurrentMusic() instanceof AbstractSoundInstanceAccessor cAccess) {
cAccess.setVolume(1f - excursionFunnelMusic.getVolume() / 2);
}
client.getSoundManager().updateSourceVolume(null, 0); // See above
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.fusionflux.portalcubed.client.render.entity;

import com.fusionflux.portalcubed.accessor.CameraExt;
import com.fusionflux.portalcubed.accessor.FramebufferExt;
import com.fusionflux.portalcubed.accessor.RenderTargetExt;
import com.fusionflux.portalcubed.client.render.entity.model.ExperimentalPortalModel;
import com.fusionflux.portalcubed.config.PortalCubedConfig;
import com.fusionflux.portalcubed.entity.ExperimentalPortal;
Expand All @@ -18,6 +18,7 @@
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;

import static com.fusionflux.portalcubed.PortalCubed.id;
import static org.lwjgl.opengl.GL11.*;
Expand All @@ -39,7 +40,7 @@ public ExperimentalPortalRenderer(EntityRendererProvider.Context dispatcher) {
}

@Override
public void render(ExperimentalPortal entity, float yaw, float tickDelta, PoseStack matrices, MultiBufferSource vertexConsumers, int light) {
public void render(@NotNull ExperimentalPortal entity, float yaw, float tickDelta, @NotNull PoseStack matrices, @NotNull MultiBufferSource vertexConsumers, int light) {
super.render(entity, yaw, tickDelta, matrices, vertexConsumers, light);
matrices.pushPose();
matrices.mulPose(Vector3f.XP.rotationDegrees(entity.getYRot()));
Expand Down Expand Up @@ -84,7 +85,7 @@ private void renderPortal(
final boolean renderPortal = portalLayer < MAX_PORTAL_LAYER && entity.getActive();
if (renderPortal) {
// TODO: PortingLib compat
((FramebufferExt)Minecraft.getInstance().getMainRenderTarget()).setStencilBufferEnabled(true);
((RenderTargetExt)Minecraft.getInstance().getMainRenderTarget()).setStencilBufferEnabled(true);
glEnable(GL_STENCIL_TEST);
RenderSystem.colorMask(false, false, false, false);
RenderSystem.depthMask(false);
Expand Down Expand Up @@ -140,8 +141,9 @@ private void renderAxis(PoseStack.Pose entry, VertexConsumer vertices, Vec3 axis
.endVertex();
}

@NotNull
@Override
public ResourceLocation getTextureLocation(ExperimentalPortal entity) {
public ResourceLocation getTextureLocation(@NotNull ExperimentalPortal entity) {
if (PortalCubedConfig.enableRoundPortals) {
return !renderingTracers ? ROUND_TEXTURE : ROUND_TEXTURE_TRACER;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.spongepowered.asm.mixin.gen.Accessor;

@Mixin(ClipContext.class)
public interface RaycastContextAccessor {
public interface ClipContextAccessor {
@Accessor
ClipContext.Block getBlock();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(CollisionContext.class)
public interface ShapeContextMixin {
public interface CollisionContextMixin {
@Inject(method = "of", at = @At("HEAD"), cancellable = true)
private static void ofNullable(Entity entity, CallbackInfoReturnable<CollisionContext> cir) {
if (entity == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(Inventory.class)
public class PlayerInventoryMixin {
public class InventoryMixin {
@Shadow @Final public Player player;

@Inject(method = "swapPaint", at = @At("HEAD"), cancellable = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import java.util.UUID;

@Mixin(Level.class)
public abstract class WorldMixin implements Accessors {
public abstract class LevelMixin implements Accessors {

@Shadow
protected abstract LevelEntityGetter<Entity> getEntities();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
import org.spongepowered.asm.mixin.Mixin;

@Mixin(LevelReader.class)
public interface WorldViewMixin extends CustomCollisionView {
public interface LevelReaderMixin extends CustomCollisionView {
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.fusionflux.portalcubed.mixin;

import com.fusionflux.portalcubed.PortalCubed;
import com.fusionflux.portalcubed.PortalCubedGameRules;
import com.fusionflux.portalcubed.accessor.CalledValues;
import com.fusionflux.portalcubed.blocks.PortalCubedBlocks;
Expand Down Expand Up @@ -32,6 +31,7 @@
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.objectweb.asm.Opcodes;
import org.quiltmc.loader.api.minecraft.ClientOnly;
Expand All @@ -51,25 +51,22 @@
import java.util.Set;

@Mixin(Player.class)
public abstract class PlayerEntityMixin extends LivingEntity implements EntityAttachments {
public abstract class PlayerMixin extends LivingEntity implements EntityAttachments {
@Unique
private boolean cfg;

protected PlayerEntityMixin(EntityType<? extends LivingEntity> entityType, Level world) {
protected PlayerMixin(EntityType<? extends LivingEntity> entityType, Level world) {
super(entityType, world);
throw new AssertionError(
PortalCubed.MOD_ID + "'s PlayerEntityMixin dummy constructor was called, " +
"something is very wrong here!"
);
}

@NotNull
@Shadow
@Override
public abstract ItemStack getItemBySlot(EquipmentSlot slot);
public abstract ItemStack getItemBySlot(@NotNull EquipmentSlot slot);

@Shadow
@Override
public abstract void playSound(SoundEvent sound, float volume, float pitch);
public abstract void playSound(@NotNull SoundEvent sound, float volume, float pitch);

@Shadow
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(ServerGamePacketListenerImpl.class)
public abstract class ServerPlayNetworkHandlerMixin {
public abstract class ServerGamePacketListenerImplMixin {

@Shadow public ServerPlayer player;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(value = ServerPlayerGameMode.class, priority = 1001)
public abstract class ServerPlayerInteractionManagerMixin {
public abstract class ServerPlayerGameModeMixin {

@Shadow @Final protected ServerPlayer player;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(AbstractContainerScreen.class)
public class HandledScreenMixin {
public class AbstractContainerScreenMixin {
@Inject(method = "onClose", at = @At("HEAD"))
private void floorButtonEasterEgg(CallbackInfo ci) {
//noinspection ConstantValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(ClientAdvancements.class)
public class ClientAdvancementManagerMixin {
public class ClientAdvancementMixin {
@Inject(
method = "update",
at = @At(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import java.util.Set;

@Mixin(ClientLevel.class)
public class ClientWorldMixin {
public class ClientLevelMixin {
@WrapOperation(
method = "getMarkerParticleTarget",
at = @At(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.spongepowered.asm.mixin.injection.At;

@Mixin(ClientPacketListener.class)
public class ClientPlayNetworkHandlerMixin {
public class ClientPacketListenerMixin {
@WrapOperation(
method = "handlePlayerCombatKill",
at = @At(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(FogRenderer.class)
public abstract class BackgroundRendererMixin {
public abstract class FogRendererMixin {
@Shadow
private static float fogRed;
@Shadow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(Gui.class)
public class InGameHudMixin {
public class GuiMixin {
@Inject(method = "renderHotbar", at = @At("HEAD"), cancellable = true)
private void notWithPortalHudRH(float tickDelta, PoseStack matrices, CallbackInfo ci) {
if (PortalCubedClient.isPortalHudMode()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.fusionflux.portalcubed.mixin.client;

import com.fusionflux.portalcubed.accessor.HeldItemRendererExt;
import com.fusionflux.portalcubed.accessor.ItemInHandRendererExt;
import com.fusionflux.portalcubed.client.PortalCubedClient;
import com.fusionflux.portalcubed.items.PortalCubedItems;
import com.fusionflux.portalcubed.util.PortalCubedComponents;
Expand All @@ -25,7 +25,7 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(ItemInHandRenderer.class)
public class HeldItemRendererMixin implements HeldItemRendererExt {
public class ItemInHandRendererMixin implements ItemInHandRendererExt {
@Shadow @Final private Minecraft minecraft;
private boolean isHoldingInvisible;
private boolean handFaker;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.Map;

@Mixin(KeyMapping.class)
public interface KeyBindAccessor {
public interface KeyMappingAccessor {
@Accessor("MAP")
static Map<InputConstants.Key, KeyMapping> getMAP() {
throw new AssertionError();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import static org.lwjgl.glfw.GLFW.GLFW_REPEAT;

@Mixin(KeyboardHandler.class)
public class KeyboardMixin {
public class KeyboardHandlerMixin {
@Shadow @Final private Minecraft minecraft;

@WrapWithCondition(
Expand All @@ -29,7 +29,7 @@ private boolean dontSpamGrab(InputConstants.Key instance, long window, int key,
if (action != GLFW_REPEAT) {
return true;
}
final KeyMapping keybind = KeyBindAccessor.getMAP().get(instance);
final KeyMapping keybind = KeyMappingAccessor.getMAP().get(instance);
return keybind != PortalCubedKeyBindings.GRAB && (!PortalCubedClient.isPortalHudMode() || keybind != minecraft.options.keyInventory);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(LocalPlayer.class)
public class ClientPlayerEntityMixin extends AbstractClientPlayer implements HasMovementInputAccessor {
public class LocalPlayerMixin extends AbstractClientPlayer implements HasMovementInputAccessor {

@Shadow @Final protected Minecraft minecraft;

@Shadow public Input input;

public ClientPlayerEntityMixin(ClientLevel clientWorld, GameProfile gameProfile, @Nullable ProfilePublicKey playerPublicKey) {
public LocalPlayerMixin(ClientLevel clientWorld, GameProfile gameProfile, @Nullable ProfilePublicKey playerPublicKey) {
super(clientWorld, gameProfile, playerPublicKey);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(Minecraft.class)
public abstract class MinecraftClientMixin {
public abstract class MinecraftMixin {

@Shadow @Final public Options options;
@Shadow public LocalPlayer player;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import java.util.Map;

@Mixin(ModelBakery.class)
public abstract class ModelLoaderMixin {
public abstract class ModelBakeryMixin {

@Shadow
@Final
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.spongepowered.asm.mixin.injection.At;

@Mixin(MouseHandler.class)
public class MouseMixin {
public class MouseHandlerMixin {
@Shadow @Final private Minecraft minecraft;

@WrapWithCondition(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import org.spongepowered.asm.mixin.injection.At;

@Mixin(MultiPlayerGameMode.class)
public class ClientPlayerInteractionManagerMixin {
public class MultiPlayerGameModeMixin {
@WrapOperation(
method = "performUseItemOn",
at = @At(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.spongepowered.asm.mixin.gen.Accessor;

@Mixin(MusicManager.class)
public interface MusicTrackerAccessor {
public interface MusicManagerAccessor {
@Accessor
@Nullable
SoundInstance getCurrentMusic();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import java.util.stream.Stream;

@Mixin(ParticleEngine.class)
public class ParticleManagerMixin {
public class ParticleEngineMixin {
@WrapOperation(
method = "crack",
at = @At(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.spongepowered.asm.mixin.injection.At;

@Mixin(PlayerRenderer.class)
public class PlayerEntityRendererMixin {
public class PlayerRendererMixin {
@WrapOperation(
method = "setModelProperties",
at = @At(
Expand Down
Loading

0 comments on commit 05e8a29

Please sign in to comment.