Skip to content

Commit

Permalink
Improve mixin class locations
Browse files Browse the repository at this point in the history
  • Loading branch information
Grayray75 committed Aug 23, 2023
1 parent 1637e21 commit 3d037f3
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package me.jellysquid.mods.phosphor.mixins;
package me.jellysquid.mods.phosphor.mixins.common;

import net.minecraft.world.chunk.ChunkSection;
import net.minecraft.world.chunk.palette.PaletteContainer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package me.jellysquid.mods.phosphor.mixins;
package me.jellysquid.mods.phosphor.mixins.common;

import net.minecraft.util.math.Direction;
import org.spongepowered.asm.mixin.Mixin;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package me.jellysquid.mods.phosphor.mixins;
package me.jellysquid.mods.phosphor.mixins.common;

import net.minecraft.world.chunk.palette.Palette;
import net.minecraft.world.chunk.palette.PaletteContainer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package me.jellysquid.mods.phosphor.mod.world.lighting;
package me.jellysquid.mods.phosphor.mod.world;

import me.jellysquid.mods.phosphor.mixins.ChunkSectionAccessor;
import me.jellysquid.mods.phosphor.mixins.PaletteContainerAccessor;
import me.jellysquid.mods.phosphor.mixins.common.ChunkSectionAccessor;
import me.jellysquid.mods.phosphor.mixins.common.PaletteContainerAccessor;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.ChunkSection;

public class LightingEngineHelpers {
public class BlockStateHelper {
private static final BlockState DEFAULT_BLOCK_STATE = Blocks.AIR.getDefaultState();

// Avoids some additional logic in Chunk#getBlockState... 0 is always air
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import me.jellysquid.mods.phosphor.api.IChunkLighting;
import me.jellysquid.mods.phosphor.api.ILightingEngine;
import me.jellysquid.mods.phosphor.mixins.DirectionAccessor;
import me.jellysquid.mods.phosphor.mixins.common.DirectionAccessor;
import me.jellysquid.mods.phosphor.mod.PhosphorMod;
import me.jellysquid.mods.phosphor.mod.collections.PooledLongQueue;
import me.jellysquid.mods.phosphor.mod.world.BlockStateHelper;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.BlockState;
Expand Down Expand Up @@ -299,7 +300,7 @@ else if (oldLight > newLight) {
continue;
}

final BlockState state = LightingEngineHelpers.posToState(this.curPos, this.curChunk);
final BlockState state = BlockStateHelper.posToState(this.curPos, this.curChunk);
final int luminosity = this.getCursorLuminosity(state, lightType);
final int opacity; //if luminosity is high enough, opacity is irrelevant

Expand Down Expand Up @@ -332,7 +333,7 @@ else if (oldLight > newLight) {

final BlockPos.Mutable nPos = info.pos;

if (curLight - this.getPosOpacity(nPos, LightingEngineHelpers.posToState(nPos, info.section)) >= nLight) //schedule neighbor for darkening if we possibly light it
if (curLight - this.getPosOpacity(nPos, BlockStateHelper.posToState(nPos, info.section)) >= nLight) //schedule neighbor for darkening if we possibly light it
{
this.enqueueDarkening(nPos, info.key, nLight, nChunk, lightType);
}
Expand Down Expand Up @@ -453,7 +454,7 @@ else if (lightType == LightType.SKY) {


private int calculateNewLightFromCursor(final LightType lightType) {
final BlockState state = LightingEngineHelpers.posToState(this.curPos, this.curChunk);
final BlockState state = BlockStateHelper.posToState(this.curPos, this.curChunk);

final int luminosity = this.getCursorLuminosity(state, lightType);
final int opacity;
Expand Down Expand Up @@ -500,7 +501,7 @@ private void spreadLightFromCursor(final int curLight, final LightType lightType
continue;
}

final int newLight = curLight - this.getPosOpacity(info.pos, LightingEngineHelpers.posToState(info.pos, info.section));
final int newLight = curLight - this.getPosOpacity(info.pos, BlockStateHelper.posToState(info.pos, info.section));

if (newLight > info.light) {
this.enqueueBrightening(info.pos, info.key, newLight, nChunk, lightType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import me.jellysquid.mods.phosphor.api.IChunkLightingData;
import me.jellysquid.mods.phosphor.api.ILightingEngine;
import me.jellysquid.mods.phosphor.api.ILightingEngineProvider;
import me.jellysquid.mods.phosphor.mixins.ChunkSectionAccessor;
import me.jellysquid.mods.phosphor.mixins.DirectionAccessor;
import me.jellysquid.mods.phosphor.mixins.PaletteContainerAccessor;
import me.jellysquid.mods.phosphor.mixins.common.ChunkSectionAccessor;
import me.jellysquid.mods.phosphor.mixins.common.DirectionAccessor;
import me.jellysquid.mods.phosphor.mixins.common.PaletteContainerAccessor;
import me.jellysquid.mods.phosphor.mod.PhosphorMod;
import net.minecraft.block.BlockState;
import net.minecraft.nbt.NbtCompound;
Expand Down
12 changes: 6 additions & 6 deletions src/main/resources/phosphor.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
"package": "me.jellysquid.mods.phosphor.mixins",
"compatibilityLevel": "JAVA_8",
"mixins": [
"ChunkSectionAccessor",
"DirectionAccessor",
"PaletteContainerAccessor",
"common.ThreadedAnvilChunkStorageMixin",
"common.ChunkDataS2CPacketMixin",
"common.ChunkMixin",
"common.ChunkMixin$Vanilla",
"common.ServerChunkProviderMixin",
"common.ChunkSectionAccessor",
"common.ChunkSectionMixin",
"common.ChunkDataS2CPacketMixin",
"common.DirectionAccessor",
"common.PaletteContainerAccessor",
"common.ServerChunkProviderMixin",
"common.ThreadedAnvilChunkStorageMixin",
"common.WorldMixin"
],
"client": [
Expand Down

0 comments on commit 3d037f3

Please sign in to comment.