Skip to content

Commit

Permalink
Fix mixin exception (#60)
Browse files Browse the repository at this point in the history
* let's see if this works...

* fix mistake

* add missing `@Overwrite`

* Update build.gradle

* Add recommended javadoc

* Fix refmap value in early Mixins JSON

* Quick fix

* Revert "Quick fix"

This reverts commit c7b15ec.

* Revert ChunkProviderServerMixin.java

* Revert "Revert ChunkProviderServerMixin.java"

This reverts commit 5365b21.

* update BS

* Revert "Revert "Revert ChunkProviderServerMixin.java""

This reverts commit bbbc50a.

* Revert "Revert "Revert "Revert ChunkProviderServerMixin.java"""

This reverts commit 33167d2.

* update BS

Signed-off-by: Glease <[email protected]>

* spotlessApply (#61)

Co-authored-by: Martin Robertz <[email protected]>
Co-authored-by: GitHub GTNH Actions <>

* Swap back chunkProvider and chunkGenerator parameters

Signed-off-by: Glease <[email protected]>
Co-authored-by: glowredman <[email protected]>
Co-authored-by: kuba6000 <[email protected]>
Co-authored-by: Glease <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
5 people authored Dec 10, 2022
1 parent faa60e7 commit 5d4d901
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 16 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//version: 1668274302
//version: 1670690877
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
Expand Down Expand Up @@ -338,10 +338,10 @@ dependencies {
annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3')
annotationProcessor('com.google.guava:guava:24.1.1-jre')
annotationProcessor('com.google.code.gson:gson:2.8.6')
annotationProcessor('org.spongepowered:mixin:0.8.5-GTNH:processor')
annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.3:processor')
}
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
compile('com.gtnewhorizon:gtnhmixins:2.0.2')
compile('com.gtnewhorizon:gtnhmixins:2.1.3')
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
package micdoodle8.mods.galacticraft.core.mixins.minecraft;

import cpw.mods.fml.common.registry.GameRegistry;
import com.gtnewhorizon.mixinextras.injector.WrapWithCondition;
import micdoodle8.mods.galacticraft.core.util.WorldUtil;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.ChunkProviderServer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(ChunkProviderServer.class)
public class ChunkProviderServerMixin {

@Redirect(
method = "populate(Lnet/minecraft/world/chunk/IChunkProvider;II)V",
@WrapWithCondition(
at =
@At(
value = "INVOKE",
remap = false,
target =
"Lcpw/mods/fml/common/registry/GameRegistry;generateWorld(IILnet/minecraft/world/World;Lnet/minecraft/world/chunk/IChunkProvider;Lnet/minecraft/world/chunk/IChunkProvider;)V",
remap = false),
value = "INVOKE"),
method = "populate(Lnet/minecraft/world/chunk/IChunkProvider;II)V",
require = 1)
private void onRegistry(
int chunkX, int chunkZ, World world, IChunkProvider currentChunkProvider, IChunkProvider chunkGenerator) {
if (!WorldUtil.otherModPreventGenerate(chunkX, chunkZ, world, currentChunkProvider, chunkGenerator)) {
GameRegistry.generateWorld(chunkX, chunkZ, world, currentChunkProvider, chunkGenerator);
}
private boolean checkOtherModPreventGenerate(
int chunkX, int chunkZ, World world, IChunkProvider chunkProvider, IChunkProvider chunkGenerator) {
return !WorldUtil.otherModPreventGenerate(chunkX, chunkZ, world, chunkProvider, chunkGenerator);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public EntityLivingBaseMixin() {
super(null);
}

@ModifyConstant(method = "moveEntityWithHeading", constant = @Constant(doubleValue = 0.08D), require = 1)
@ModifyConstant(method = "moveEntityWithHeading(FF)V", constant = @Constant(doubleValue = 0.08D), require = 1)
private double onMoveEntityWithHeading(double value) {
return WorldUtil.getGravityForEntity(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,20 @@
import micdoodle8.mods.galacticraft.core.util.WorldUtil;
import net.minecraft.entity.Entity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;

@Mixin(Entity.class)
public abstract class EntityMixin {

/**
* Return whether this entity should be rendered as on fire.
* @author micdoodle8
* @author radfast
* @author SinTh0r4s
* @author glowredman
* @reason enable custom Galacticraft dimension behaviour
*/
@Overwrite
public boolean canRenderOnFire() {
return WorldUtil.shouldRenderFire((Entity) (Object) this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
public class GuiSleepMPMxin {

@Inject(method = "func_146418_g", at = @At("RETURN"), require = 1)
private void onFunc_146418_g(CallbackInfo callbackInfo) {
private void onWakeFromSleep(CallbackInfo callbackInfo) {
MinecraftForge.EVENT_BUS.post(new EventHandlerGC.SleepCancelledEvent());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;

@Mixin(PlayerControllerMP.class)
Expand All @@ -22,6 +23,13 @@ public abstract class PlayerControllerMPMixin {
@Final
private NetHandlerPlayClient netClientHandler;

/**
* @author micdoodle8
* @author SinTh0r4s
* @author glowredman
* @reason enable custom Galacticraft dimension behaviour
*/
@Overwrite
public EntityClientPlayerMP func_147493_a(World world, StatFileWriter stats) {
return new GCEntityClientPlayerMP(this.mc, world, this.mc.getSession(), this.netClientHandler, stats);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@
import micdoodle8.mods.galacticraft.core.util.WorldUtil;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;

@Mixin(World.class)
public abstract class WorldMixin {

/**
* @author micdoodle8
* @author SinTh0r4s
* @author glowredman
* @reason enable custom Galacticraft dimension behaviour
*/
@Overwrite
public float getRainStrength(float partialTicks) {
return WorldUtil.getRainStrength((World) (Object) this, partialTicks);
}
Expand Down

0 comments on commit 5d4d901

Please sign in to comment.