-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rearrange mixins, add ClientLevel mixin
- Loading branch information
Showing
22 changed files
with
199 additions
and
83 deletions.
There are no files selected for viewing
7 changes: 0 additions & 7 deletions
7
src/main/java/breadmod/mixin/accessors/client/package-info.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package breadmod.mixin.client; | ||
|
||
import breadmod.util.render.RenderGeneralKt; | ||
import net.minecraft.client.multiplayer.ClientLevel; | ||
import net.minecraft.world.phys.Vec3; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
// todo red sky hue shifting back to normal colors, repeating (probably use sin for this) | ||
@Mixin(ClientLevel.class) | ||
class ClientLevelMixin { | ||
|
||
@Inject(method = "getSkyColor", at = @At("HEAD"), cancellable = true) | ||
private void getSkyColor(Vec3 pPos, float pPartialTick, CallbackInfoReturnable<Vec3> cir) { | ||
if (RenderGeneralKt.getSkyColorMixinActive()) { | ||
cir.setReturnValue(new Vec3(1f, 0f, 0f)); | ||
} | ||
} | ||
|
||
@Inject(method = "getSkyDarken", at = @At("HEAD"), cancellable = true) | ||
private void getSkyDarken(float pPartialTick, CallbackInfoReturnable<Float> cir) { | ||
if (RenderGeneralKt.getSkyColorMixinActive()) { | ||
cir.setReturnValue(1f); | ||
} | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
...sors/client/IAccessorDirectoryLister.java → ...ixin/client/IAccessorDirectoryLister.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ccessors/client/IAccessorProgramType.java → ...od/mixin/client/IAccessorProgramType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/java/breadmod/mixin/client/IFontManagerAccessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package breadmod.mixin.client; | ||
|
||
import net.minecraft.client.gui.font.FontManager; | ||
import net.minecraft.client.gui.font.FontSet; | ||
import net.minecraft.resources.ResourceLocation; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Accessor; | ||
|
||
import java.util.Map; | ||
|
||
@Mixin(FontManager.class) | ||
interface IFontManagerAccessor { | ||
|
||
@Accessor("fontSets") | ||
Map<ResourceLocation, FontSet> iGetFontSets(); | ||
|
||
@Accessor("missingFontSet") | ||
FontSet iGetMissingFontSet(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...xin/accessors/common/IAccessorEntity.java → ...readmod/mixin/common/IAccessorEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
package breadmod.mixin.accessors.common; | ||
package breadmod.mixin.common; | ||
|
||
import net.minecraft.world.entity.Entity; | ||
import net.minecraft.world.level.Level; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Accessor; | ||
|
||
@Mixin(Entity.class) | ||
public interface IAccessorEntity { | ||
interface IAccessorEntity { | ||
@Accessor("level") | ||
Level breadmod$getLevel(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package breadmod.block | ||
|
||
import breadmod.CommonForgeEventBus.warTimerMap | ||
import breadmod.network.PacketHandler | ||
import breadmod.network.clientbound.war_timer.WarTimerIncrementPacket | ||
import net.minecraft.core.BlockPos | ||
import net.minecraft.world.entity.player.Player | ||
import net.minecraft.world.level.Level | ||
import net.minecraft.world.level.block.Block | ||
import net.minecraft.world.level.block.state.BlockState | ||
import net.minecraft.world.level.material.FluidState | ||
import net.minecraftforge.network.PacketDistributor | ||
|
||
// todo 3d model, texturing, sounds | ||
class WarTerminalBlock: Block(Properties.of()) { | ||
|
||
override fun onDestroyedByPlayer( | ||
state: BlockState, | ||
level: Level, | ||
pos: BlockPos, | ||
player: Player, | ||
willHarvest: Boolean, | ||
fluid: FluidState | ||
): Boolean { | ||
val server = level.server ?: return super.onDestroyedByPlayer(state, level, pos, player, willHarvest, fluid) | ||
server.playerList.players.forEach { player -> | ||
warTimerMap[player]?.let { | ||
val increase = it.first.third + 30 | ||
warTimerMap.put(player, Triple(it.first.first, 41, increase) to (it.second.first to true)) | ||
PacketHandler.NETWORK.send( | ||
PacketDistributor.PLAYER.with { player }, | ||
WarTimerIncrementPacket(true, increase) | ||
) | ||
} | ||
} | ||
return super.onDestroyedByPlayer(state, level, pos, player, willHarvest, fluid) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
package breadmod.client.gui | ||
|
||
object WarTickerClient { | ||
var timer = 30 | ||
var isIncreasing = false | ||
var timeLeft = 30 | ||
var isTimerIncreasing = false | ||
var increasingTimer = 0 | ||
var active = false | ||
var timerActive = false | ||
|
||
var scroll = -110f | ||
var lastScroll = -110f | ||
var timerPosition = -110f | ||
var lastTimerPosition = -110f | ||
|
||
fun tick() { | ||
if (increasingTimer > 0) { // Increase timer | ||
increasingTimer-- | ||
timer++ | ||
} else isIncreasing = false | ||
timeLeft++ | ||
} else isTimerIncreasing = false | ||
|
||
lastScroll = scroll // hell code until I figure out proper smooth like anims from minecraft's code | ||
if (scroll > -110.0 && !active) { | ||
scroll -= (1f * 0.5f) * 4.0f | ||
} else if (scroll < 0.0 && active) { | ||
scroll += (1f * 0.5f) * 4.0f | ||
lastTimerPosition = timerPosition // hell code until I figure out proper smooth like anims from minecraft's code | ||
if (timerPosition > -110.0 && !timerActive) { | ||
timerPosition -= (1f * 0.5f) * 4.0f | ||
} else if (timerPosition < 0.0 && timerActive) { | ||
timerPosition += (1f * 0.5f) * 4.0f | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.