[ci skip] spotlessApply with the new settings

This commit is contained in:
Jason Mitchell committed 2023-01-29 12:44:17 -08:00
1 parent 1eaf9b7991
commit 62390a0d0f
79 files changed
+3118 -1929

No files matched your search

@@ -1,16 +1,11 @@
package taintedmagic.client;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.MinecraftForge;
import taintedmagic.client.handler.ClientHandler;
import taintedmagic.client.handler.HUDHandler;
import taintedmagic.client.handler.SashClientHandler;
@@ -24,27 +19,33 @@ import taintedmagic.common.entities.EntityDiffusion;
import taintedmagic.common.entities.EntityHomingShard;
import taintedmagic.common.registry.ItemRegistry;
import thaumcraft.client.renderers.entity.RenderEldritchOrb;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
public class ClientProxy extends CommonProxy {
@Override
public void preInit (final FMLPreInitializationEvent event) {
public void preInit(final FMLPreInitializationEvent event) {
super.preInit(event);
}
@Override
public void init (final FMLInitializationEvent event) {
public void init(final FMLInitializationEvent event) {
super.init(event);
registerRenderers();
}
@Override
public void postInit (final FMLPostInitializationEvent event) {
public void postInit(final FMLPostInitializationEvent event) {
super.postInit(event);
}
@Override
public void registerHandlers () {
public void registerHandlers() {
super.registerHandlers();
MinecraftForge.EVENT_BUS.register(new HUDHandler());
@@ -55,7 +56,7 @@ public class ClientProxy extends CommonProxy {
}
@Override
public void registerRenderers () {
public void registerRenderers() {
// Entities
RenderingRegistry.registerEntityRenderingHandler(EntityDarkMatter.class, new RenderEldritchOrb());
RenderingRegistry.registerEntityRenderingHandler(EntityHomingShard.class, new RenderEntityHomingShard());
@@ -66,7 +67,7 @@ public class ClientProxy extends CommonProxy {
}
@Override
public EntityPlayer getClientPlayer () {
public EntityPlayer getClientPlayer() {
return Minecraft.getMinecraft().thePlayer;
}
@@ -76,7 +77,7 @@ public class ClientProxy extends CommonProxy {
}
@Override
public World getClientWorld () {
public World getClientWorld() {
return FMLClientHandler.instance().getClient().theWorld;
}
}
@@ -3,22 +3,23 @@ package taintedmagic.client.handler;
import java.util.ArrayList;
import java.util.List;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraftforge.client.event.RenderPlayerEvent;
import taintedmagic.api.IRenderInventoryItem;
@SideOnly (Side.CLIENT)
import taintedmagic.api.IRenderInventoryItem;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ClientHandler {
@SubscribeEvent
public void tickEnd (final TickEvent event) {
public void tickEnd(final TickEvent event) {
if (event.phase == TickEvent.Phase.END) {
HUDHandler.updateTicks();
}
@@ -28,15 +29,15 @@ public class ClientHandler {
* Render items implementing IRenderInventoryItem
*/
@SubscribeEvent
public void onPlayerRender (final RenderPlayerEvent.Specials.Post event) {
public void onPlayerRender(final RenderPlayerEvent.Specials.Post event) {
final EntityPlayer player = event.entityPlayer;
if (player.getActivePotionEffect(Potion.invisibility) != null)
return;
if (player.getActivePotionEffect(Potion.invisibility) != null) return;
final ItemStack[] inv = player.inventory.mainInventory;
final List<Item> rendering = new ArrayList<>();
for (final ItemStack stack : inv) {
if (stack != null && stack.getItem() instanceof IRenderInventoryItem && !rendering.contains(stack.getItem())) {
if (stack != null && stack.getItem() instanceof IRenderInventoryItem
&& !rendering.contains(stack.getItem())) {
((IRenderInventoryItem) stack.getItem()).render(player, stack, event.partialRenderTick);
rendering.add(stack.getItem());
}
@@ -2,11 +2,6 @@ package taintedmagic.client.handler;
import java.awt.Color;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.ScaledResolution;
@@ -15,14 +10,20 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
import org.lwjgl.opengl.GL11;
import taintedmagic.api.IHeldItemHUD;
import taintedmagic.common.TaintedMagic;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public final class HUDHandler {
@SubscribeEvent
@SideOnly (Side.CLIENT)
public void renderGameOverlayEvent (final RenderGameOverlayEvent.Post event) {
@SideOnly(Side.CLIENT)
public void renderGameOverlayEvent(final RenderGameOverlayEvent.Post event) {
if (event.type == ElementType.ALL) {
renderHeldItemHUD(event.partialTicks);
renderString();
@@ -33,8 +34,8 @@ public final class HUDHandler {
private static ItemStack stack = null;
private static ItemStack last = null;
@SideOnly (Side.CLIENT)
private void renderHeldItemHUD (final float partialTicks) {
@SideOnly(Side.CLIENT)
private void renderHeldItemHUD(final float partialTicks) {
final EntityPlayer player = TaintedMagic.proxy.getClientPlayer();
final Minecraft mc = Minecraft.getMinecraft();
final ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
@@ -47,16 +48,14 @@ public final class HUDHandler {
boolean b = false;
if (stack != null && stack.getItem() instanceof IHeldItemHUD) {
b = true;
}
else {
} else {
b = false;
}
final float time = 30.0F;
if (b) {
ticksEquipped = Math.min(time, ticksEquipped + partialTicks);
}
else {
} else {
ticksEquipped = Math.max(0F, ticksEquipped - partialTicks);
}
@@ -64,8 +63,7 @@ public final class HUDHandler {
if (b) {
((IHeldItemHUD) stack.getItem()).renderHUD(res, player, stack, partialTicks, fract);
}
else if (!b && ticksEquipped != 0) {
} else if (!b && ticksEquipped != 0) {
((IHeldItemHUD) last.getItem()).renderHUD(res, player, last, partialTicks, fract);
}
}
@@ -78,25 +76,25 @@ public final class HUDHandler {
/**
* Displays text above the health bar for a specified duration.
*
* @param text The string to display.
* @param text The string to display.
* @param duration The duration to display for (in ticks).
* @param rainbow Display the string in rainbow.
* @param rainbow Display the string in rainbow.
*/
public static void displayString (final String text, final int duration, final boolean rainbow) {
public static void displayString(final String text, final int duration, final boolean rainbow) {
currentText = text;
ticks = time = duration;
isRainbow = rainbow;
}
@SideOnly (Side.CLIENT)
public static void updateTicks () {
@SideOnly(Side.CLIENT)
public static void updateTicks() {
if (ticks > 0) {
ticks--;
}
}
@SideOnly (Side.CLIENT)
private void renderString () {
@SideOnly(Side.CLIENT)
private void renderString() {
if (ticks > 0 && !MathHelper.stringNullOrLengthZero(currentText)) {
final Minecraft mc = Minecraft.getMinecraft();
final ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
@@ -8,13 +8,17 @@ public class SashClientHandler {
private static boolean sashEnabled = true;
public static void toggle() {
sashEnabled = !sashEnabled;
sashEnabled = !sashEnabled;
if (sashEnabled) {
HUDHandler.displayString(EnumChatFormatting.GREEN + StatCollector.translateToLocal("text.sash.speed.on"),
300, false);
HUDHandler.displayString(
EnumChatFormatting.GREEN + StatCollector.translateToLocal("text.sash.speed.on"),
300,
false);
} else {
HUDHandler.displayString(EnumChatFormatting.RED + StatCollector.translateToLocal("text.sash.speed.off"),
300, false);
HUDHandler.displayString(
EnumChatFormatting.RED + StatCollector.translateToLocal("text.sash.speed.off"),
300,
false);
}
}
@@ -1,5 +1,14 @@
package taintedmagic.client.handler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.item.ItemStack;
import org.lwjgl.input.Keyboard;
import taintedmagic.common.items.equipment.ItemVoidwalkerSash;
import taintedmagic.common.network.PacketHandler;
import taintedmagic.common.network.PacketSashToggle;
import baubles.common.lib.PlayerHandler;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.FMLCommonHandler;
@@ -7,18 +16,14 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.item.ItemStack;
import org.lwjgl.input.Keyboard;
import taintedmagic.common.items.equipment.ItemVoidwalkerSash;
import taintedmagic.common.network.PacketHandler;
import taintedmagic.common.network.PacketSashToggle;
@SideOnly(Side.CLIENT)
public class SashKeyListener {
private static final KeyBinding toggleSash = new KeyBinding("tmisc.toggleSash", Keyboard.CHAR_NONE, "tmisc.keyCategory");
private static final KeyBinding toggleSash = new KeyBinding(
"tmisc.toggleSash",
Keyboard.CHAR_NONE,
"tmisc.keyCategory");
public SashKeyListener() {
FMLCommonHandler.instance().bus().register(this);
@@ -2,6 +2,7 @@ package taintedmagic.client.handler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import taintedmagic.common.TaintedMagic;
public final class SashServerHandler {
@@ -11,8 +12,7 @@ public final class SashServerHandler {
private static NBTTagCompound getCompound(EntityPlayer player) {
NBTTagCompound cmp = player.getEntityData();
if (!cmp.hasKey(COMPOUND))
cmp.setTag(COMPOUND, new NBTTagCompound());
if (!cmp.hasKey(COMPOUND)) cmp.setTag(COMPOUND, new NBTTagCompound());
return cmp.getCompoundTag(COMPOUND);
}
@@ -7,11 +7,12 @@ import net.minecraft.client.model.ModelRenderer;
* Katana model - created by <wiiv> using Tabula 4.1.1
*/
public class ModelKatana extends ModelBase {
public ModelRenderer blade;
public ModelRenderer grip1;
public ModelRenderer grip2;
public ModelKatana () {
public ModelKatana() {
textureWidth = 32;
textureHeight = 64;
@@ -29,7 +30,7 @@ public class ModelKatana extends ModelBase {
grip1.addChild(grip2);
}
public void render (final float size) {
public void render(final float size) {
blade.render(size);
grip1.render(size);
}
@@ -7,9 +7,10 @@ import net.minecraft.client.model.ModelRenderer;
* Saya model - created by <wiiv> using Tabula 4.1.1
*/
public class ModelSaya extends ModelBase {
public ModelRenderer saya;
public ModelSaya () {
public ModelSaya() {
textureWidth = 32;
textureHeight = 64;
@@ -18,14 +19,14 @@ public class ModelSaya extends ModelBase {
saya.addBox(-1.0F, 0.5F, -2.0F, 2, 48, 4, 0.0F);
}
public void render (final float size) {
public void render(final float size) {
saya.render(size);
}
/**
* This is a helper function from Tabula to set the rotation of model parts
*/
public void setRotation (final ModelRenderer m, final float x, final float y, final float z) {
public void setRotation(final ModelRenderer m, final float x, final float y, final float z) {
m.rotateAngleX = x;
m.rotateAngleY = y;
m.rotateAngleZ = z;
@@ -1,11 +1,12 @@
package taintedmagic.client.renderer;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import taintedmagic.common.entities.EntityDiffusion;
import thaumcraft.client.fx.ParticleEngine;
import thaumcraft.client.lib.UtilsFX;
@@ -13,12 +14,12 @@ import thaumcraft.client.lib.UtilsFX;
public class RenderEntityDiffusion extends Render {
@Override
public void doRender (final Entity entity, final double x, final double y, final double z, final float f,
public void doRender(final Entity entity, final double x, final double y, final double z, final float f,
final float partialTicks) {
render((EntityDiffusion) entity, x, y, z, f, partialTicks);
}
public void render (final EntityDiffusion entity, final double x, final double y, final double z, final float f,
public void render(final EntityDiffusion entity, final double x, final double y, final double z, final float f,
final float partialTicks) {
final Tessellator t = Tessellator.instance;
@@ -67,7 +68,7 @@ public class RenderEntityDiffusion extends Render {
}
@Override
protected ResourceLocation getEntityTexture (final Entity entity) {
protected ResourceLocation getEntityTexture(final Entity entity) {
return null;
}
}
@@ -1,13 +1,14 @@
package taintedmagic.client.renderer;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import taintedmagic.common.entities.EntityHomingShard;
import thaumcraft.client.fx.ParticleEngine;
import thaumcraft.client.lib.UtilsFX;
@@ -17,17 +18,17 @@ import thaumcraft.client.lib.UtilsFX;
*/
public class RenderEntityHomingShard extends Render {
public RenderEntityHomingShard () {
public RenderEntityHomingShard() {
shadowSize = 0.0F;
}
@Override
public void doRender (final Entity entity, final double x, final double y, final double z, final float f,
public void doRender(final Entity entity, final double x, final double y, final double z, final float f,
final float partialTicks) {
render((EntityHomingShard) entity, x, y, z, f, partialTicks);
}
public void render (final EntityHomingShard entity, final double x, final double y, final double z, final float f,
public void render(final EntityHomingShard entity, final double x, final double y, final double z, final float f,
final float partialTicks) {
final Tessellator t = Tessellator.instance;
@@ -61,7 +62,9 @@ public class RenderEntityHomingShard extends Render {
GL11.glRotatef(180.0F - renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
GL11.glScalef(0.4F + 0.1F * entity.getStrength(), 0.4F + 0.1F * entity.getStrength(),
GL11.glScalef(
0.4F + 0.1F * entity.getStrength(),
0.4F + 0.1F * entity.getStrength(),
0.4F + 0.1F * entity.getStrength());
t.startDrawingQuads();
@@ -87,7 +90,7 @@ public class RenderEntityHomingShard extends Render {
}
@Override
protected ResourceLocation getEntityTexture (final Entity entity) {
protected ResourceLocation getEntityTexture(final Entity entity) {
return TextureMap.locationBlocksTexture;
}
}
@@ -1,34 +1,36 @@
package taintedmagic.client.renderer;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import taintedmagic.common.TaintedMagic;
import taintedmagic.common.items.tools.ItemKatana;
import thaumcraft.client.lib.UtilsFX;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly (Side.CLIENT)
@SideOnly(Side.CLIENT)
public class RenderItemKatana implements IItemRenderer {
@Override
public boolean handleRenderType (final ItemStack stack, final ItemRenderType type) {
public boolean handleRenderType(final ItemStack stack, final ItemRenderType type) {
return true;
}
@Override
public boolean shouldUseRenderHelper (final ItemRenderType type, final ItemStack stack, final ItemRendererHelper helper) {
public boolean shouldUseRenderHelper(final ItemRenderType type, final ItemStack stack,
final ItemRendererHelper helper) {
return true;
}
@Override
public void renderItem (final ItemRenderType type, final ItemStack stack, final Object... data) {
public void renderItem(final ItemRenderType type, final ItemStack stack, final Object... data) {
final EntityPlayer player = TaintedMagic.proxy.getClientPlayer();
GL11.glPushMatrix();
@@ -36,20 +38,18 @@ public class RenderItemKatana implements IItemRenderer {
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glScalef(1.4F, 1.4F, 1.4F);
if ( (player.getHeldItem() == null || player.getHeldItem() != stack) && type != ItemRenderType.EQUIPPED) {
if ((player.getHeldItem() == null || player.getHeldItem() != stack) && type != ItemRenderType.EQUIPPED) {
GL11.glPushMatrix();
if (type == ItemRenderType.ENTITY) {
GL11.glScalef(0.5F, 0.5F, 0.5F);
GL11.glTranslatef(0F, 0.5F, 0F);
GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
}
else if (type == ItemRenderType.INVENTORY) {
} else if (type == ItemRenderType.INVENTORY) {
GL11.glScalef(0.4F, 0.4F, 0.4F);
GL11.glRotatef(-65, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(-50, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(1F, 1F, 0.0F);
}
else {
} else {
GL11.glTranslatef(0.0F, -0.7F, 0.0F);
}
@@ -78,14 +78,12 @@ public class RenderItemKatana implements IItemRenderer {
GL11.glTranslatef(2.0F, 1.85F, -0.25F);
GL11.glRotatef(-10F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-10F, 0.0F, 0.0F, 1.0F);
}
else if (type == ItemRenderType.INVENTORY) {
} else if (type == ItemRenderType.INVENTORY) {
GL11.glScalef(0.4F, 0.4F, 0.4F);
GL11.glRotatef(-65, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(-50, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(1F, 1F, 0.0F);
}
else {
} else {
GL11.glRotatef(60, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(-40, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(70, 0.0F, 1.0F, 0.0F);
@@ -134,14 +132,15 @@ public class RenderItemKatana implements IItemRenderer {
/**
* TC method to draw runes on runed staves
*/
public static void drawRune (final double x, final double y, final double z, final int rune, final EntityPlayer player) {
public static void drawRune(final double x, final double y, final double z, final int rune,
final EntityPlayer player) {
GL11.glPushMatrix();
UtilsFX.bindTexture("textures/misc/script.png");
final float r = MathHelper.sin( (player.ticksExisted + rune * 5) / 5.0F) * 0.1F + 0.88F;
final float g = MathHelper.sin( (player.ticksExisted + rune * 5) / 7.0F) * 0.1F + 0.63F;
final float alpha = MathHelper.sin( (player.ticksExisted + rune * 5) / 10.0F) * 0.3F;
final float r = MathHelper.sin((player.ticksExisted + rune * 5) / 5.0F) * 0.1F + 0.88F;
final float g = MathHelper.sin((player.ticksExisted + rune * 5) / 7.0F) * 0.1F + 0.63F;
final float alpha = MathHelper.sin((player.ticksExisted + rune * 5) / 10.0F) * 0.3F;
GL11.glColor4f(r, g, 0.2F, alpha + 0.6F);
@@ -170,4 +169,4 @@ public class RenderItemKatana implements IItemRenderer {
GL11.glPopMatrix();
}
}
}