Skip to content
This repository was archived by the owner on Feb 19, 2019. It is now read-only.

Commit 3c6cb38

Browse files
committed
Rename CallbackInfoReturnable parameter names to cir
Also made TeamColorEvent receive the initial color of the entity
1 parent a8f8976 commit 3c6cb38

4 files changed

Lines changed: 13 additions & 10 deletions

File tree

src/main/java/clientapi/event/defaults/game/render/TeamColorEvent.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@ public final class TeamColorEvent extends Cancellable {
4141
/**
4242
* The color of the entity.
4343
*/
44-
private int color = 0xFFFFFFFF;
44+
private int color;
4545

46-
public TeamColorEvent(Entity entity) {
46+
public TeamColorEvent(Entity entity, int color) {
4747
this.entity = entity;
48+
this.color = color;
4849
}
4950

5051
/**

src/main/java/clientapi/load/mixin/MixinBlock.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ public abstract class MixinBlock {
4646
private BoundingBoxEvent bbEvent;
4747

4848
@Inject(method = "canCollideCheck", at = @At("HEAD"), cancellable = true)
49-
private void canCollideCheck(IBlockState state, boolean hitIfLiquid, CallbackInfoReturnable<Boolean> ci) {
49+
private void canCollideCheck(IBlockState state, boolean hitIfLiquid, CallbackInfoReturnable<Boolean> cir) {
5050
BlockCollisionEvent event = new BlockCollisionEvent((Block) (Object) this);
5151
ClientAPI.EVENT_BUS.post(event);
5252
if (event.isCancelled())
53-
ci.setReturnValue(false);
53+
cir.setReturnValue(false);
5454
}
5555

5656
@Inject(method = "addCollisionBoxToList(Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/AxisAlignedBB;Ljava/util/List;Lnet/minecraft/entity/Entity;Z)V",

src/main/java/clientapi/load/mixin/MixinEntityRenderer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444
public class MixinEntityRenderer {
4545

4646
@Inject(method = "getFOVModifier", at = @At("HEAD"), cancellable = true)
47-
private void getFOVModifier(float partialTicks, boolean useFOVSetting, CallbackInfoReturnable<Float> ci) {
47+
private void getFOVModifier(float partialTicks, boolean useFOVSetting, CallbackInfoReturnable<Float> cir) {
4848
if (Camera.isCapturing())
49-
ci.setReturnValue(90.0F);
49+
cir.setReturnValue(90.0F);
5050
}
5151

5252
@Inject(method = "updateCameraAndRender", at = @At(value = "INVOKE_STRING", target = "net/minecraft/profiler/Profiler.endStartSection(Ljava/lang/String;)V", args = { "ldc=gui" }))

src/main/java/clientapi/load/mixin/MixinRender.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@
2121
import clientapi.event.defaults.game.render.TeamColorEvent;
2222
import net.minecraft.client.renderer.entity.Render;
2323
import net.minecraft.entity.Entity;
24+
import net.minecraft.scoreboard.ScorePlayerTeam;
2425
import org.spongepowered.asm.mixin.Mixin;
2526
import org.spongepowered.asm.mixin.injection.At;
2627
import org.spongepowered.asm.mixin.injection.Inject;
2728
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
2829
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
30+
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
2931

3032
/**
3133
* @author Brady
@@ -34,12 +36,12 @@
3436
@Mixin(Render.class)
3537
public class MixinRender {
3638

37-
@Inject(method = "getTeamColor", at = @At("HEAD"), cancellable = true)
38-
private void getTeamColor(Entity entityIn, CallbackInfoReturnable<Integer> ci) {
39-
TeamColorEvent event = new TeamColorEvent(entityIn);
39+
@Inject(method = "getTeamColor", at = @At("RETURN"), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD)
40+
private void getTeamColor(Entity entityIn, CallbackInfoReturnable<Integer> cir, int i, ScorePlayerTeam scoreplayerteam) {
41+
TeamColorEvent event = new TeamColorEvent(entityIn, i);
4042
ClientAPI.EVENT_BUS.post(event);
4143
if (event.isCancelled())
42-
ci.setReturnValue(event.getColor());
44+
cir.setReturnValue(event.getColor());
4345
}
4446

4547
@Inject(method = "renderLivingLabel", at = @At("HEAD"), cancellable = true)

0 commit comments

Comments
 (0)