1.0.3
All checks were successful
Twine/pipeline/head This commit looks good

This commit is contained in:
TheBrokenRail 2020-06-27 13:16:13 -04:00
parent b19b22de43
commit 8c2bcd7ddb
3 changed files with 17 additions and 11 deletions

View File

@ -1,5 +1,8 @@
# Changelog # Changelog
**1.0.3**
* Fix Bug With ``initEquipment`` Redirect
**1.0.2** **1.0.2**
* Improve Versioning * Improve Versioning

View File

@ -10,7 +10,7 @@ org.gradle.jvmargs = -Xmx1G
fabric_loader_version = 0.8.8+build.202 fabric_loader_version = 0.8.8+build.202
# Mod Properties # Mod Properties
mod_version = 1.0.2 mod_version = 1.0.3
maven_group = com.thebrokenrail maven_group = com.thebrokenrail
# Dependencies # Dependencies

View File

@ -65,10 +65,11 @@ public class MixinMobEntity {
@Inject(at = @At("HEAD"), method = "isInDaylight", cancellable = true) @Inject(at = @At("HEAD"), method = "isInDaylight", cancellable = true)
public void isInDaylight(CallbackInfoReturnable<Boolean> info) { public void isInDaylight(CallbackInfoReturnable<Boolean> info) {
if (!((MobEntity) (Object) this).getEntityWorld().isClient()) { World world = ((MobEntity) (Object) this).getEntityWorld();
StageDataComponent component = StageDataComponent.getFromWorld((ServerWorld) ((MobEntity) (Object) this).getEntityWorld()); if (!world.isClient()) {
StageDataComponent component = StageDataComponent.getFromWorld((ServerWorld) world);
BlockPos blockPos = ((MobEntity) (Object) this).getBlockPos(); BlockPos blockPos = ((MobEntity) (Object) this).getBlockPos();
int stage = component.findEffectiveStageOfChunk((ServerWorld) ((MobEntity) (Object) this).getEntityWorld(), blockPos); int stage = component.findEffectiveStageOfChunk((ServerWorld) world, blockPos);
if (stage >= StageUtil.MOBS_NO_LONGER_BURN_IN_SUNLIGHT) { if (stage >= StageUtil.MOBS_NO_LONGER_BURN_IN_SUNLIGHT) {
info.setReturnValue(false); info.setReturnValue(false);
} }
@ -77,13 +78,15 @@ public class MixinMobEntity {
@Redirect(at = @At(value = "INVOKE", target = "Ljava/util/Random;nextFloat()F", ordinal = 0), method = "initEquipment", allow = 1) @Redirect(at = @At(value = "INVOKE", target = "Ljava/util/Random;nextFloat()F", ordinal = 0), method = "initEquipment", allow = 1)
public float initEquipment(Random random) { public float initEquipment(Random random) {
World world = ((MobEntity) (Object) this).getEntityWorld();
if (!world.isClient()) {
StageDataComponent component = StageDataComponent.getFromWorld((ServerWorld) ((MobEntity) (Object) this).getEntityWorld()); StageDataComponent component = StageDataComponent.getFromWorld((ServerWorld) ((MobEntity) (Object) this).getEntityWorld());
BlockPos blockPos = ((MobEntity) (Object) this).getBlockPos(); BlockPos blockPos = ((MobEntity) (Object) this).getBlockPos();
int stage = component.findEffectiveStageOfChunk((ServerWorld) ((MobEntity) (Object) this).getEntityWorld(), blockPos); int stage = component.findEffectiveStageOfChunk((ServerWorld) ((MobEntity) (Object) this).getEntityWorld(), blockPos);
if (stage >= StageUtil.MOBS_GUARANTEED_ARMOR) { if (stage >= StageUtil.MOBS_GUARANTEED_ARMOR) {
return -1f; return -1f;
} else { }
}
return random.nextFloat(); return random.nextFloat();
} }
}
} }