diff --git a/src/main/java/vazkii/botania/common/core/handler/PixieHandler.java b/src/main/java/vazkii/botania/common/core/handler/PixieHandler.java index e6e721e64..a627353a1 100644 --- a/src/main/java/vazkii/botania/common/core/handler/PixieHandler.java +++ b/src/main/java/vazkii/botania/common/core/handler/PixieHandler.java @@ -73,20 +73,20 @@ public final class PixieHandler { PlayerEntity player = (PlayerEntity) event.getEntityLiving(); double chance = player.func_233637_b_(PIXIE_SPAWN_CHANCE); ItemStack sword = PlayerHelper.getFirstHeldItem(player, s -> s.getItem() == ModItems.elementiumSword); - + if (Math.random() < chance) { EntityPixie pixie = new EntityPixie(player.world); pixie.setPosition(player.getPosX(), player.getPosY() + 2, player.getPosZ()); - + if (((ItemElementiumHelm) ModItems.elementiumHelm).hasArmorSet(player)) { pixie.setApplyPotionEffect(new EffectInstance(potions[event.getEntityLiving().world.rand.nextInt(potions.length)], 40, 0)); } - + float dmg = 4; if (!sword.isEmpty()) { dmg += 2; } - + pixie.setProps((LivingEntity) event.getSource().getTrueSource(), player, 0, dmg); pixie.onInitialSpawn(player.world, player.world.getDifficultyForLocation(pixie.func_233580_cy_()), SpawnReason.EVENT, null, null); diff --git a/src/main/java/vazkii/botania/mixin/MixinPlayerEntity.java b/src/main/java/vazkii/botania/mixin/MixinPlayerEntity.java index f4b9ccefb..c39e56a15 100644 --- a/src/main/java/vazkii/botania/mixin/MixinPlayerEntity.java +++ b/src/main/java/vazkii/botania/mixin/MixinPlayerEntity.java @@ -1,11 +1,21 @@ +/* + * This class is distributed as part of the Botania Mod. + * Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under the + * Botania License: http://botaniamod.net/license.php + */ package vazkii.botania.mixin; import net.minecraft.entity.ai.attributes.AttributeModifierMap; import net.minecraft.entity.player.PlayerEntity; + 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; + import vazkii.botania.common.core.handler.PixieHandler; @Mixin(PlayerEntity.class) diff --git a/src/main/java/vazkii/botania/mixin/MixinWorldRenderer.java b/src/main/java/vazkii/botania/mixin/MixinWorldRenderer.java index 86ce02ccc..cd34a863f 100644 --- a/src/main/java/vazkii/botania/mixin/MixinWorldRenderer.java +++ b/src/main/java/vazkii/botania/mixin/MixinWorldRenderer.java @@ -1,17 +1,28 @@ +/* + * This class is distributed as part of the Botania Mod. + * Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under the + * Botania License: http://botaniamod.net/license.php + */ package vazkii.botania.mixin; import com.mojang.blaze3d.matrix.MatrixStack; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.vertex.VertexBuffer; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.world.World; + import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.*; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + import vazkii.botania.client.render.world.SkyblockSkyRenderer; import vazkii.botania.common.core.handler.ConfigHandler; import vazkii.botania.common.world.SkyblockChunkGenerator; @@ -23,30 +34,41 @@ import javax.annotation.Nullable; */ @Mixin(WorldRenderer.class) public class MixinWorldRenderer { - @Shadow @Final private VertexFormat skyVertexFormat; + @Shadow + @Final + private VertexFormat skyVertexFormat; - @Shadow @Nullable private VertexBuffer starVBO; + @Shadow + @Nullable + private VertexBuffer starVBO; // TODO 1.16 isWorldSkyblock doesnt work on client (needs to be communicated separately) @Unique private static boolean isGogSky() { World world = Minecraft.getInstance().world; return ConfigHandler.CLIENT.enableFancySkybox.get() - && world.func_234923_W_() == World.field_234918_g_ - && (ConfigHandler.CLIENT.enableFancySkyboxInNormalWorlds.get() - || SkyblockChunkGenerator.isWorldSkyblock(world)); + && world.func_234923_W_() == World.field_234918_g_ + && (ConfigHandler.CLIENT.enableFancySkyboxInNormalWorlds.get() + || SkyblockChunkGenerator.isWorldSkyblock(world)); } /** * Render planets and other extras, after the first invoke to ms.rotate(Y) after getRainStrength is called - */ - @Inject(method = "renderSky(Lcom/mojang/blaze3d/matrix/MatrixStack;F)V", - slice = @Slice(from = @At(ordinal = 0, value = "INVOKE", - target = "Lnet/minecraft/client/world/ClientWorld;getRainStrength(F)F")), - at = @At(shift = At.Shift.AFTER, + */ + @Inject( + method = "renderSky(Lcom/mojang/blaze3d/matrix/MatrixStack;F)V", + slice = @Slice( + from = @At( + ordinal = 0, value = "INVOKE", + target = "Lnet/minecraft/client/world/ClientWorld;getRainStrength(F)F" + ) + ), + at = @At( + shift = At.Shift.AFTER, ordinal = 0, value = "INVOKE", - target = "Lcom/mojang/blaze3d/matrix/MatrixStack;rotate(Lnet/minecraft/util/math/vector/Quaternion;)V") + target = "Lcom/mojang/blaze3d/matrix/MatrixStack;rotate(Lnet/minecraft/util/math/vector/Quaternion;)V" + ) ) private void renderExtras(MatrixStack ms, float partialTicks, CallbackInfo ci) { if (isGogSky()) { @@ -56,11 +78,12 @@ public class MixinWorldRenderer { /** * Make the sun bigger, replace any 30.0F seen before first call to bindTexture - */ + */ @ModifyConstant( method = "renderSky(Lcom/mojang/blaze3d/matrix/MatrixStack;F)V", slice = @Slice(to = @At(ordinal = 0, value = "INVOKE", target = "Lnet/minecraft/client/renderer/texture/TextureManager;bindTexture(Lnet/minecraft/util/ResourceLocation;)V")), - constant = { @Constant(floatValue = 30.0F) }) + constant = { @Constant(floatValue = 30.0F) } + ) private float makeSunBigger(float oldValue) { if (isGogSky()) { return 60.0F; @@ -71,7 +94,7 @@ public class MixinWorldRenderer { /** * Make the moon bigger, replace any 20.0F seen between first and second call to bindTexture - */ + */ @ModifyConstant( method = "renderSky(Lcom/mojang/blaze3d/matrix/MatrixStack;F)V", slice = @Slice( @@ -90,7 +113,7 @@ public class MixinWorldRenderer { /** * Render lots of extra stars - */ + */ @Inject( method = "renderSky(Lcom/mojang/blaze3d/matrix/MatrixStack;F)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld;getStarBrightness(F)F")