Code Cleanup / Reformat

This commit is contained in:
Kam committed 2025-05-20 13:53:26 -04:00
1 parent 800eec4d81
commit 43bc1eb81f
40 files changed
+258 -243

No files matched your search

@@ -49,7 +49,12 @@ public class DBCClient {
}
// Animation Render Helper
public boolean applyRenderModel(ModelRenderer renderer) { return false; }
public boolean firstPersonAnimation(float partialRenderTick, EntityPlayer player, ModelBiped model, RenderBlocks renderBlocksIr, ResourceLocation resItemGlint) { return false; }
public boolean applyRenderModel(ModelRenderer renderer) {
return false;
}
public boolean firstPersonAnimation(float partialRenderTick, EntityPlayer player, ModelBiped model, RenderBlocks renderBlocksIr, ResourceLocation resItemGlint) {
return false;
}
}
@@ -3,7 +3,6 @@ package kamkeel.npcs.command;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.math.BlockPos;
import noppes.npcs.EventHooks;
@@ -44,7 +43,7 @@ public class CommandCommand extends CommandKamkeelBase {
ChunkCoordinates senderCoords = sender.getPlayerCoordinates();
IPos senderPos = NpcAPI.Instance().getIPos(new BlockPos(senderCoords.posX, senderCoords.posY, senderCoords.posZ));
if(sender instanceof EntityPlayer) {
if (sender instanceof EntityPlayer) {
CustomNPCsEvent.ScriptedCommandEvent event = new CustomNPCsEvent.ScriptedCommandEvent(senderWorld, senderPos, sender.getCommandSenderName(), commandId, commandArgs);
EventHooks.onScriptedCommand((EntityPlayer) sender, event);
@@ -81,7 +81,7 @@ public class AttributeController implements IAttributeHandler {
}
public IPlayerAttributes getPlayerAttributes(IPlayer player) {
if(player == null || player.getMCEntity() == null)
if (player == null || player.getMCEntity() == null)
return null;
EntityPlayer entityPlayer = (EntityPlayer) player.getMCEntity();
@@ -40,8 +40,8 @@ public class SoulbindRequirement implements IRequirementChecker {
}
private String getUsernameFromUUID(String uuid) {
if(uuidToUsername.containsKey(uuid)){
if(!uuidToUsername.get(uuid).equals("null")){
if (uuidToUsername.containsKey(uuid)) {
if (!uuidToUsername.get(uuid).equals("null")) {
return uuidToUsername.get(uuid);
}
}
@@ -91,12 +91,13 @@ public class SoulbindRequirement implements IRequirementChecker {
public boolean check(EntityPlayer player, NBTTagCompound nbt) {
if (nbt.hasKey(getKey())) {
String uuidString = nbt.getString(getKey());
if(uuidString != null && !uuidString.isEmpty()){
if (uuidString != null && !uuidString.isEmpty()) {
UUID convert = null;
try {
convert = UUID.fromString(uuidString);
} catch (Exception ignored){}
if(convert != null)
} catch (Exception ignored) {
}
if (convert != null)
return player.getUniqueID().equals(convert);
}
return false;
@@ -26,6 +26,7 @@ public final class AttributeRecalcEvent {
public static void registerListener(Listener l) {
postListeners.add(l);
}
public static void post(EntityPlayer player, PlayerAttributeTracker tracker) {
for (Listener l : postListeners) l.onPost(player, tracker);
}
@@ -149,7 +149,7 @@ public class PlayerAttributeTracker implements IPlayerAttributes {
*/
public void updatePlayerMaxHealth(EntityPlayer player) {
float bonusHealth = extraHealth;
float healthBoostPercent = extraHealthBoost / 100;
float healthBoostPercent = extraHealthBoost / 100;
IAttributeInstance maxHealthAttr = player.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.maxHealth);
try {
AttributeModifier oldFlat = maxHealthAttr.getModifier(healthUUID);
@@ -160,7 +160,8 @@ public class PlayerAttributeTracker implements IPlayerAttributes {
if (oldBoost != null) {
maxHealthAttr.removeModifier(oldBoost);
}
} catch (Exception ignored) { }
} catch (Exception ignored) {
}
// Apply the flat bonus (operation 0)
if (bonusHealth != 0) {
maxHealthAttr.applyModifier(new AttributeModifier(healthUUID, "RPGCoreHealthBonus", bonusHealth, 0));
@@ -177,14 +178,15 @@ public class PlayerAttributeTracker implements IPlayerAttributes {
}
public void updatePlayerMovementSpeed(EntityPlayer player) {
float extraSpeed = movementSpeed / 100;
float extraSpeed = movementSpeed / 100;
IAttributeInstance speedAttr = player.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.movementSpeed);
try {
AttributeModifier old = speedAttr.getModifier(movementSpeedUUID);
if (old != null) {
speedAttr.removeModifier(old);
}
} catch (Exception ignored) { }
} catch (Exception ignored) {
}
if (extraSpeed != 0) {
speedAttr.applyModifier(new AttributeModifier(movementSpeedUUID, "RPGCoreMovementSpeed", extraSpeed, 1));
}
@@ -198,7 +200,8 @@ public class PlayerAttributeTracker implements IPlayerAttributes {
if (old != null) {
knockResAttr.removeModifier(old);
}
} catch (Exception ignored) { }
} catch (Exception ignored) {
}
if (extraRes != 0) {
knockResAttr.applyModifier(new AttributeModifier(knockbackResUUID, "RPGCoreKnockbackRes", extraRes, 1));
}
@@ -222,7 +225,7 @@ public class PlayerAttributeTracker implements IPlayerAttributes {
}
public void recalculate(IPlayer player) {
if(player == null || player.getMCEntity() == null)
if (player == null || player.getMCEntity() == null)
return;
recalcAttributes((EntityPlayer) player.getMCEntity());
@@ -1,6 +1,5 @@
package kamkeel.npcs.controllers.data.attribute.tracker;
import kamkeel.npcs.util.AttributeItemUtil;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -33,12 +32,12 @@ public class PlayerEquipmentTracker {
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof PlayerEquipmentTracker)) return false;
PlayerEquipmentTracker other = (PlayerEquipmentTracker)o;
return areItemStacksEquivalent(heldItem, other.heldItem)
&& areItemStacksEquivalent(boots, other.boots)
&& areItemStacksEquivalent(leggings, other.leggings)
&& areItemStacksEquivalent(chestplate, other.chestplate)
&& areItemStacksEquivalent(helmet, other.helmet);
PlayerEquipmentTracker other = (PlayerEquipmentTracker) o;
return areItemStacksEquivalent(heldItem, other.heldItem)
&& areItemStacksEquivalent(boots, other.boots)
&& areItemStacksEquivalent(leggings, other.leggings)
&& areItemStacksEquivalent(chestplate, other.chestplate)
&& areItemStacksEquivalent(helmet, other.helmet);
}
@Override
@@ -28,7 +28,8 @@ public class GuiMagicBookPacket extends AbstractPacket {
this.posZ = posZ;
}
public GuiMagicBookPacket() {}
public GuiMagicBookPacket() {
}
@Override
public Enum getType() {
@@ -28,7 +28,8 @@ public class GuiPaintbrushPacket extends AbstractPacket {
this.posZ = posZ;
}
public GuiPaintbrushPacket() {}
public GuiPaintbrushPacket() {
}
@Override
public Enum getType() {
@@ -24,7 +24,8 @@ public class MagicCyclesPacket extends AbstractPacket {
private int id;
public MagicCyclesPacket() {}
public MagicCyclesPacket() {
}
public MagicCyclesPacket(int id) {
this.id = id;
@@ -54,7 +55,7 @@ public class MagicCyclesPacket extends AbstractPacket {
return;
int id = in.readInt();
if(id == -1){
if (id == -1) {
HashMap<String, Integer> map = new HashMap<>();
for (MagicCycle magicCycle : MagicController.getInstance().cycles.values()) {
map.put(magicCycle.displayName.replace("&", "\u00A7"), magicCycle.id);
@@ -62,7 +63,7 @@ public class MagicCyclesPacket extends AbstractPacket {
sendScrollData((EntityPlayerMP) player, map, EnumScrollData.MAGIC_CYCLES);
} else {
MagicCycle cycle = MagicController.getInstance().getCycle(id);
if(cycle == null)
if (cycle == null)
return;
NBTTagCompound compound = new NBTTagCompound();
NBTTagCompound magicCompound = new NBTTagCompound();
@@ -36,7 +36,7 @@ public class AttributeAttackUtil {
private static AllocationResult allocateMagicDamage(float physicalDamage, Map<Integer, MagicEntry> magicData) {
Map<Integer, Float> allocation = new HashMap<>();
float totalSplit = 0f;
if(magicData != null){
if (magicData != null) {
for (Map.Entry<Integer, MagicEntry> entry : magicData.entrySet()) {
int magicId = entry.getKey();
float splitVal = entry.getValue().split;
@@ -243,9 +243,9 @@ public class AttributeAttackUtil {
PlayerAttributeTracker tracker = getTracker(player);
// 1) Main-attack component
float mainAttackFlat = tracker.getAttributeValue(CustomAttributes.MAIN_ATTACK);
float mainAttackFlat = tracker.getAttributeValue(CustomAttributes.MAIN_ATTACK);
float mainBoostPercent = tracker.getAttributeValue(CustomAttributes.MAIN_BOOST) / 100f;
float mainDamage = (baseDamage * (1 + mainBoostPercent)) + mainAttackFlat;
float mainDamage = (baseDamage * (1 + mainBoostPercent)) + mainAttackFlat;
// 2) Gear component (neutral + magic) – gearOutput must itself divide its boosts by 100 internally
float gearDamage = tracker.gearOutput;
@@ -249,7 +249,7 @@ public class AttributeItemUtil {
// For non–magic we include everything.
Float value = attrTag.getFloat(key);
AttributeDefinition def = AttributeController.getAttribute(key);
if(def == null)
if (def == null)
continue;
AttributeDefinition.AttributeSection section = def != null ? def.getSection() : AttributeDefinition.AttributeSection.EXTRA;
@@ -226,7 +226,7 @@ public class AnimationMixinFunctions {
public static boolean mixin_renderFirstPersonAnimation(float partialRenderTick, EntityPlayer player, ModelBiped model, RenderBlocks renderBlocksIr, ResourceLocation resItemGlint) {
if (DBCAddon.IsAvailable()) {
return DBCClient.Instance.firstPersonAnimation(partialRenderTick, player,model, renderBlocksIr, resItemGlint);
return DBCClient.Instance.firstPersonAnimation(partialRenderTick, player, model, renderBlocksIr, resItemGlint);
}
AnimationData animationData = ClientCacheHandler.playerAnimations.get(player.getUniqueID());
+4 -4
View File
@@ -116,9 +116,9 @@ public class DataStats {
compound.setBoolean("FiringSoundBegin", onSoundBegin);
compound.setByte("AimType", aimType);
compound.setBoolean("ProjectilesKeepTerrain", projectilesKeepTerrain);
if(pTrail == EnumParticleType.Custom)
if (pTrail == EnumParticleType.Custom)
compound.setTag("pCustom", pCustom.writeToNBT());
if(pEffect == EnumPotionType.Fire)
if (pEffect == EnumPotionType.Fire)
compound.setBoolean("pBurnItem", pBurnItem);
compound.setBoolean("ImmuneToFire", immuneToFire);
@@ -185,9 +185,9 @@ public class DataStats {
onSoundBegin = compound.getBoolean("FiringSoundBegin");
aimType = compound.getByte("AimType");
projectilesKeepTerrain = compound.getBoolean("ProjectilesKeepTerrain");
if(pTrail == EnumParticleType.Custom)
if (pTrail == EnumParticleType.Custom)
pCustom = ScriptParticle.fromNBT(compound.getCompoundTag("pCustom"));
if(pEffect == EnumPotionType.Fire)
if (pEffect == EnumPotionType.Fire)
pBurnItem = compound.getBoolean("pBurnItem");
immuneToFire = compound.getBoolean("ImmuneToFire");
@@ -2,14 +2,11 @@ package noppes.npcs;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import kamkeel.npcs.network.PacketClient;
import kamkeel.npcs.network.packets.request.item.ColorBrushPacket;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
@@ -63,7 +60,7 @@ public class ScriptItemEventHandler {
if (!isValidContext(e.player) || e.isCanceled())
return;
if(e.entityItem == null)
if (e.entityItem == null)
return;
EntityItem entityItem = e.entityItem;
@@ -90,7 +87,7 @@ public class ScriptItemEventHandler {
if (e.world.isRemote || !(e.entity instanceof EntityItem))
return;
EntityItem itemEnt = (EntityItem)e.entity;
EntityItem itemEnt = (EntityItem) e.entity;
IItemCustomizable c = getCustomizable(itemEnt.getEntityItem());
if (c != null) {
e.setCanceled(EventHooks.onScriptItemSpawn(c, itemEnt));
@@ -117,12 +114,13 @@ public class ScriptItemEventHandler {
}
}
}
@SubscribeEvent
public void onPlayerInteract(PlayerInteractEvent e) {
EntityPlayer player = e.entityPlayer;
if (player == null || e.action == null) return;
if(!isValidContext(e.entityPlayer))
if (!isValidContext(e.entityPlayer))
return;
// Paintbrush on LEFT_CLICK_BLOCK
@@ -133,7 +131,7 @@ public class ScriptItemEventHandler {
TileEntity te = e.world.getTileEntity(e.x, e.y, e.z);
if (te instanceof TileColorable) {
int color = ((TileColorable)te).color;
int color = ((TileColorable) te).color;
if (!held.hasTagCompound()) {
held.setTagCompound(new NBTTagCompound());
}
@@ -172,7 +170,7 @@ public class ScriptItemEventHandler {
} else if (e.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
pd.hadInteract = true;
IWorld iw = (IWorld)NpcAPI.Instance().getIWorld(e.world);
IWorld iw = (IWorld) NpcAPI.Instance().getIWorld(e.world);
Object blockCtx = NpcAPI.Instance().getIBlock(iw, e.x, e.y, e.z);
if (EventHooks.onScriptItemRightClick(
c, new ItemEvent.RightClickEvent(c, ip, 2, blockCtx))) {
@@ -183,7 +181,7 @@ public class ScriptItemEventHandler {
@SubscribeEvent
public void onStartUseItem(PlayerUseItemEvent.Start e) {
if(!isValidContext(e.entityPlayer))
if (!isValidContext(e.entityPlayer))
return;
IItemCustomizable c = getCustomizable(e.item);
@@ -195,7 +193,7 @@ public class ScriptItemEventHandler {
@SubscribeEvent
public void onUseItemTick(PlayerUseItemEvent.Tick e) {
if(!isValidContext(e.entityPlayer))
if (!isValidContext(e.entityPlayer))
return;
IItemCustomizable c = getCustomizable(e.item);
@@ -207,7 +205,7 @@ public class ScriptItemEventHandler {
@SubscribeEvent
public void onStopUseItem(PlayerUseItemEvent.Stop e) {
if(!isValidContext(e.entityPlayer))
if (!isValidContext(e.entityPlayer))
return;
IItemCustomizable c = getCustomizable(e.item);
@@ -220,7 +218,7 @@ public class ScriptItemEventHandler {
@SubscribeEvent
public void onFinishUseItem(PlayerUseItemEvent.Finish e) {
if(!isValidContext(e.entityPlayer))
if (!isValidContext(e.entityPlayer))
return;
IItemCustomizable c = getCustomizable(e.item);
@@ -232,33 +230,33 @@ public class ScriptItemEventHandler {
@SubscribeEvent
public void onAnvilRepair(AnvilRepairEvent e) {
if(!isValidContext(e.entityPlayer))
if (!isValidContext(e.entityPlayer))
return;
if(e.output == null)
if (e.output == null)
return;
IItemStack out = NpcAPI.Instance().getIItemStack(e.output);
if (out instanceof IItemCustomizable) {
IPlayer ip = NoppesUtilServer.getIPlayer(e.entityPlayer);
IItemStack left = NpcAPI.Instance().getIItemStack(e.left);
IItemStack left = NpcAPI.Instance().getIItemStack(e.left);
IItemStack right = NpcAPI.Instance().getIItemStack(e.right);
EventHooks.onRepairCustomItem((IItemCustomizable)out, ip, left, right, e.breakChance);
EventHooks.onRepairCustomItem((IItemCustomizable) out, ip, left, right, e.breakChance);
}
}
@SubscribeEvent
public void onDestroyItem(PlayerDestroyItemEvent e) {
if(!isValidContext(e.entityPlayer))
if (!isValidContext(e.entityPlayer))
return;
if(e.original == null)
if (e.original == null)
return;
IItemStack orig = NpcAPI.Instance().getIItemStack(e.original);
if (orig instanceof IItemCustomizable) {
IPlayer ip = NoppesUtilServer.getIPlayer(e.entityPlayer);
EventHooks.onBreakCustomItem((IItemCustomizable)orig, ip);
EventHooks.onBreakCustomItem((IItemCustomizable) orig, ip);
}
}
@@ -572,7 +572,7 @@ public class ScriptPlayerEventHandler {
if (event.player == null || event.player.worldObj == null)
return;
if (event.player.worldObj instanceof WorldServer&& event.player instanceof EntityPlayerMP) {
if (event.player.worldObj instanceof WorldServer && event.player instanceof EntityPlayerMP) {
PlayerDataScript handler = ScriptController.Instance.getPlayerScripts(event.player);
IPlayer scriptPlayer = (IPlayer) NpcAPI.Instance().getIEntity(event.player);
AttributeController.removeTracker(event.player.getUniqueID());
@@ -27,7 +27,7 @@ public class EntityAIAnimation extends EntityAIBase {
if (npc.stats.aimType == 1 && npc.isAttacking())
return npc.currentAnimation != EnumAnimation.AIMING;
if(npc.stats.aimType == 2 && npc.isAttacking() && npc.getRangedTask() != null && npc.getRangedTask().isShooting())
if (npc.stats.aimType == 2 && npc.isAttacking() && npc.getRangedTask() != null && npc.getRangedTask().isShooting())
return npc.currentAnimation != EnumAnimation.AIMING;
if (npc.ais.animationType == EnumAnimation.NONE)
@@ -50,17 +50,17 @@ public class EntityAIRangedAttack extends EntityAIBase {
public boolean shouldExecute() {
EntityLivingBase var1 = this.entityHost.getAttackTarget();
if (var1 == null || !var1.isEntityAlive()){
if (var1 == null || !var1.isEntityAlive()) {
isShooting = false;
return false;
}
if (entityHost.getDistanceToEntity(var1) > entityHost.stats.aggroRange){
if (entityHost.getDistanceToEntity(var1) > entityHost.stats.aggroRange) {
isShooting = false;
return false;
}
if (this.entityHost.inventory.getProjectile() == null){
if (this.entityHost.inventory.getProjectile() == null) {
isShooting = false;
return false;
}
@@ -68,12 +68,10 @@ public class EntityAIRangedAttack extends EntityAIBase {
double var2 = this.entityHost.getDistanceSq(var1.posX, var1.boundingBox.minY, var1.posZ);
double var3 = this.entityHost.ais.distanceToMelee * this.entityHost.ais.distanceToMelee;
if (this.entityHost.ais.useRangeMelee >= 1 && var2 <= var3){
if (this.entityHost.ais.useRangeMelee >= 1 && var2 <= var3) {
isShooting = false;
return false;
}
else {
} else {
this.attackTarget = var1;
return true;
}
@@ -111,7 +111,7 @@ public class GuiMagicCycleMap extends GuiDiagram {
if (!orderMap.containsKey(targetId)) continue;
float percent = entry.getValue();
String modifier = "";
if(percent > 0.0)
if (percent > 0.0)
modifier += "+";
String hover = modifier + (int) (percent * 100) + "%";
conns.add(new DiagramConnection(m.id, targetId, percent, hover));
@@ -9,7 +9,7 @@ import noppes.npcs.constants.EnumPotionType;
public class SubGuiNpcProjectiles extends SubGuiInterface implements ITextfieldListener, ISubGuiListener {
private DataStats stats;
private String[] potionNames = new String[]{"gui.none", "tile.fire.name", "potion.poison", "potion.hunger", "potion.weakness", "potion.moveSlowdown", "potion.confusion", "potion.blindness", "potion.wither"};
private String[] trailNames = new String[]{ "gui.none", "trail.smoke", "trail.portal", "trail.redstone",
private String[] trailNames = new String[]{"gui.none", "trail.smoke", "trail.portal", "trail.redstone",
"trail.lightning", "trail.largesmoke", "trail.magic", "trail.enchant", "trail.crit",
"trail.explode", "trail.music", "trail.flame", "trail.lava", "trail.splash",
"trail.slime", "trail.heart", "trail.angryvillager", "trail.happyvillager", "trail.custom"
@@ -92,7 +92,7 @@ public class SubGuiNpcProjectiles extends SubGuiInterface implements ITextfieldL
addLabel(new GuiNpcLabel(8, "stats.trail", guiLeft + 5, y + 5));
addButton(new GuiNpcButton(5, guiLeft + 80, y, 75, 20, trailNames, stats.pTrail.ordinal()));
if(stats.pTrail == EnumParticleType.Custom){
if (stats.pTrail == EnumParticleType.Custom) {
int internalY = y + 30;
addLabel(new GuiNpcLabel(90, "trail.custom", guiLeft + 5, internalY + 5));
addButton(new GuiNpcButton(90, guiLeft + 80, internalY, 75, 20, "gui.edit"));
@@ -103,7 +103,7 @@ public class SubGuiNpcProjectiles extends SubGuiInterface implements ITextfieldL
addLabel(new GuiNpcLabel(10, "stats.spin", guiLeft + xSize - 80, guiTop + 45));
addButton(new GuiNpcButton(8, guiLeft + xSize - 40, guiTop + 40, 30, 20, new String[]{"gui.no", "gui.yes"}, stats.pSpin ? 1 : 0));
addLabel(new GuiNpcLabel(11, "stats.stick", guiLeft + xSize - 80, guiTop + 75));
addButton(new GuiNpcButton(9, guiLeft + xSize - 40, guiTop + 70, 30, 20, new String[]{"gui.no", "gui.yes"}, stats.pStick ? 1 : 0));
addButton(new GuiNpcButton(9, guiLeft + xSize - 40, guiTop + 70, 30, 20, new String[]{"gui.no", "gui.yes"}, stats.pStick ? 1 : 0));
}
addButton(new GuiNpcButton(66, guiLeft + xSize - 50, guiTop + 190, 40, 20, "gui.done"));
}
@@ -107,7 +107,7 @@ public class SubGuiNpcRangeProperties extends SubGuiInterface implements ITextfi
soundSelected = getTextField(7);
setSubGui(new GuiSoundSelection(soundSelected.getText()));
}
if(id == 10){
if (id == 10) {
stats.onSoundBegin = ((GuiNpcButton) guibutton).getValue() == 1;
}
if (id == 66) {
@@ -46,7 +46,7 @@ public class GuiNpcMagicBook extends GuiNPCInterface implements ICustomScrollLis
addScroll(leftScroll);
// --- Magic Map (Diagram) on the Right ---
if(magicCycle == null)
if (magicCycle == null)
return;
String displayName = magicCycle.getDisplayName().replace("&", "\u00A7");
@@ -76,7 +76,8 @@ public class GuiNpcMagicBook extends GuiNPCInterface implements ICustomScrollLis
}
@Override
public void actionPerformed(GuiButton guibutton) {}
public void actionPerformed(GuiButton guibutton) {
}
@Override
public void drawScreen(int i, int j, float f) {
@@ -84,7 +85,7 @@ public class GuiNpcMagicBook extends GuiNPCInterface implements ICustomScrollLis
}
@Override
protected void drawBackground(){
protected void drawBackground() {
super.drawBackground();
int spacing = 10;
@@ -144,7 +145,7 @@ public class GuiNpcMagicBook extends GuiNPCInterface implements ICustomScrollLis
@Override
public void setData(Vector<String> list, HashMap<String, Integer> data, EnumScrollData type) {
if(type == EnumScrollData.MAGIC_CYCLES){
if (type == EnumScrollData.MAGIC_CYCLES) {
cycleData.clear();
cycleData.putAll(data);
if (leftScroll != null) {
@@ -91,9 +91,9 @@ public class GuiModernDialogInteract extends GuiNPCInterface implements IGuiClos
}
public void drawLine(int x, int y, int width) {
drawRect(x, y, width, y + 1,0xff000000+ dialog.colorData.getLineColor1());
drawRect(x, y + 1, width, y + 2, 0xff000000+ dialog.colorData.getLineColor2());
drawRect(x, y + 2, width, y + 3, 0xff000000+ dialog.colorData.getLineColor3());
drawRect(x, y, width, y + 1, 0xff000000 + dialog.colorData.getLineColor1());
drawRect(x, y + 1, width, y + 2, 0xff000000 + dialog.colorData.getLineColor2());
drawRect(x, y + 2, width, y + 3, 0xff000000 + dialog.colorData.getLineColor3());
}
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
@@ -125,7 +125,7 @@ public class GuiModernDialogInteract extends GuiNPCInterface implements IGuiClos
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glTranslatef(image.x,image.y,0.0f);
GL11.glTranslatef(image.x, image.y, 0.0f);
GL11.glTranslatef(image.alignment % 3 * ((float) (scaledResolution.getScaledWidth()) / 2), (float) (Math.floor((float) (image.alignment / 3)) * ((float) (scaledResolution.getScaledHeight()) / 2)), 0.0F);
image.onRender(mc);
@@ -151,7 +151,7 @@ public class GuiModernDialogInteract extends GuiNPCInterface implements IGuiClos
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glTranslatef(image.x,image.y,0.0f);
GL11.glTranslatef(image.x, image.y, 0.0f);
GL11.glTranslatef(guiLeft + dialog.textOffsetX, optionStart + dialog.textOffsetY - image.height * image.scale, 0.0F);
image.onRender(mc);
@@ -179,22 +179,22 @@ public class GuiModernDialogInteract extends GuiNPCInterface implements IGuiClos
drawTextBlock(dialog.text, (width - textBlockWidth) / 2, height - textPartHeight + 23 + 3 + gap, textBlockWidth);
selected = -1;
for (int i = 0; i < this.options.size(); i++) {
int optionHeight = height/2-30 + i * (13 + 6);
int optionHeight = height / 2 - 30 + i * (13 + 6);
int optionNum = options.get(i);
DialogOption option = dialog.options.get(optionNum);
if (mouseX >= width-237 && mouseX <= width-14 && mouseY >= optionHeight && mouseY <= optionHeight + 13) {
if (mouseX >= width - 237 && mouseX <= width - 14 && mouseY >= optionHeight && mouseY <= optionHeight + 13) {
selected = i;
}
GL11.glEnable(GL11.GL_BLEND);
Minecraft.getMinecraft().getTextureManager().bindTexture(decomposed);
drawTexturedModalRect(width-233, optionHeight, 0, i == selected ? 13 : 0, 223, 13);
drawTexturedModalRect(width - 233, optionHeight, 0, i == selected ? 13 : 0, 223, 13);
GL11.glDisable(GL11.GL_BLEND);
if (getQuestByOptionId(optionNum) != null) {
drawString(fontRendererObj, "!", width-229, optionHeight + 3, 0x76e85b);
drawString(fontRendererObj, "!", width - 229, optionHeight + 3, 0x76e85b);
} else {
drawString(fontRendererObj, ">", width-229, optionHeight + 3, -1);
drawString(fontRendererObj, ">", width - 229, optionHeight + 3, -1);
}
drawString(fontRendererObj, option.title, width-221, optionHeight + 3, option.optionColor);
drawString(fontRendererObj, option.title, width - 221, optionHeight + 3, option.optionColor);
}
GL11.glPopMatrix();
GL11.glPopMatrix();
@@ -250,7 +250,7 @@ public class GuiModernDialogInteract extends GuiNPCInterface implements IGuiClos
entity.prevRotationYawHead = f5;
entity.rotationYawHead = f6;
npc.ais.orientation = orientation;
npc.display.showName=visibleName;
npc.display.showName = visibleName;
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
@@ -328,10 +328,10 @@ public class GuiModernDialogInteract extends GuiNPCInterface implements IGuiClos
optionId = selected;
else if (!options.isEmpty())
optionId = options.get(selected);
if(getQuestByOptionId(optionId) == null){
if (getQuestByOptionId(optionId) == null) {
PacketClient.sendClient(new DialogSelectPacket(dialog.id, optionId));
}else{
CustomNpcs.proxy.openGui(player, new GuiModernQuestDialog(npc,getQuestByOptionId(optionId),dialog,optionId));
} else {
CustomNpcs.proxy.openGui(player, new GuiModernQuestDialog(npc, getQuestByOptionId(optionId), dialog, optionId));
}
if (dialog == null || !dialog.hasOtherOptions() || options.isEmpty()) {
@@ -75,8 +75,8 @@ public class GuiModernQuestDialog extends GuiNPCInterface implements IGuiClose {
this.scaledResolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
this.drawDefaultBackground = prevDialog.darkenScreen;
setOptionOffset();
addButton(new GuiTexturedButton(0,"questgui.reject",720,326,156,40,decomposed.toString(),72,15));
addButton(new GuiTexturedButton(1,"questgui.accept",812,326,156,40,decomposed.toString(),72,15));
addButton(new GuiTexturedButton(0, "questgui.reject", 720, 326, 156, 40, decomposed.toString(), 72, 15));
addButton(new GuiTexturedButton(1, "questgui.accept", 812, 326, 156, 40, decomposed.toString(), 72, 15));
}
public void setOptionOffset() {
@@ -94,18 +94,18 @@ public class GuiModernQuestDialog extends GuiNPCInterface implements IGuiClose {
}
public void drawLine(int x, int y, int width) {
drawRect(x, y, width, y + 1,0xff000000+ prevDialog.colorData.getLineColor1());//0xff8d3800);//
drawRect(x, y + 1, width, y + 2, 0xff000000+ prevDialog.colorData.getLineColor2()); //0xfffea53b);//
drawRect(x, y + 2, width, y + 3, 0xff000000+ prevDialog.colorData.getLineColor3()); //0xff8d3800);
drawRect(x, y, width, y + 1, 0xff000000 + prevDialog.colorData.getLineColor1());//0xff8d3800);//
drawRect(x, y + 1, width, y + 2, 0xff000000 + prevDialog.colorData.getLineColor2()); //0xfffea53b);//
drawRect(x, y + 2, width, y + 3, 0xff000000 + prevDialog.colorData.getLineColor3()); //0xff8d3800);
}
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
GL11.glColor4f(1, 1, 1, 1);
this.drawGradientRect(0, 0, this.width, this.height, 0x66000000, 0x66000000);
if (!prevDialog.hideNPC) {
float scaleHeight = height/509f;
float scaleWidth = width/960f;
drawNpc(npc, -210+prevDialog.npcOffsetX+(int)(300*(1-scaleWidth)), 350+prevDialog.npcOffsetY-(int)(100*(1-scaleHeight)), 9.5F*prevDialog.npcScale*scaleHeight, -20);
float scaleHeight = height / 509f;
float scaleWidth = width / 960f;
drawNpc(npc, -210 + prevDialog.npcOffsetX + (int) (300 * (1 - scaleWidth)), 350 + prevDialog.npcOffsetY - (int) (100 * (1 - scaleHeight)), 9.5F * prevDialog.npcScale * scaleHeight, -20);
}
setOptionOffset();
@@ -166,7 +166,7 @@ public class GuiModernQuestDialog extends GuiNPCInterface implements IGuiClose {
}
GL11.glPopMatrix();
int textBlockWidth = 700;
String takeQuestString=translate("questgui.doyouaccept");
String takeQuestString = translate("questgui.doyouaccept");
int lineCount = getLineCount(takeQuestString, textBlockWidth);
int gap = Math.max(16, Math.min((int) (2.6f * (float) lineCount), 32));
int textPartHeight = 23 + 3 + lineCount * ClientProxy.Font.height() + 2 * gap;
@@ -177,24 +177,24 @@ public class GuiModernQuestDialog extends GuiNPCInterface implements IGuiClose {
GL11.glScalef(1.5f, 1.5f, 1);
drawString(fontRendererObj, npc.getCommandSenderName(), (int) (47 / 1.5), (int) ((height - textPartHeight + 5) / 1.5), prevDialog.titleColor);
GL11.glScalef(1 / 1.5f, 1 / 1.5f, 1);
drawTextBlock(takeQuestString, (width - textBlockWidth) / 2, height - textPartHeight + 23 + 3 + gap, textBlockWidth,-1);
drawTextBlock(takeQuestString, (width - textBlockWidth) / 2, height - textPartHeight + 23 + 3 + gap, textBlockWidth, -1);
Map<Integer, QuestData> activeQuests = PlayerData.get(this.player).questData.activeQuests;
boolean hadQuest = activeQuests.containsKey(quest.id);
activeQuests.put(quest.id,new QuestData(quest));
activeQuests.put(quest.id, new QuestData(quest));
StringBuilder objectiveString = new StringBuilder();
String[] questType = {translate("questgui.bringitems"), translate("questgui.readdialog"),
translate("questgui.killmobs"), translate("questgui.findlocation"), translate("questgui.defeat")};
translate("questgui.killmobs"), translate("questgui.findlocation"), translate("questgui.defeat")};
for (IQuestObjective objective : quest.questInterface.getObjectives(this.player)) {
if(objective!=null)
if (objective != null)
objectiveString.append("- " + questType[quest.getType()] + ": ").append(objective.getText()).append("\n");
}
if(!hadQuest)
if (!hadQuest)
activeQuests.remove(quest.id);
int questLineCount = getLineCount(quest.logText, 180);
int objectivesLineCount = getLineCount(objectiveString.toString(),180);
int topToTextBottom = (int)(height*0.08) + 38+questLineCount*ClientProxy.Font.height()+20;
int topToObjectivesBottom = topToTextBottom+19+objectivesLineCount*ClientProxy.Font.height()+14;
int objectivesLineCount = getLineCount(objectiveString.toString(), 180);
int topToTextBottom = (int) (height * 0.08) + 38 + questLineCount * ClientProxy.Font.height() + 20;
int topToObjectivesBottom = topToTextBottom + 19 + objectivesLineCount * ClientProxy.Font.height() + 14;
int rewardCount = 0;
List<Integer> facIDs = new ArrayList<Integer>();
@@ -202,74 +202,74 @@ public class GuiModernQuestDialog extends GuiNPCInterface implements IGuiClose {
if (facID != -1) facIDs.add(facID);
}
for (IItemStack reward : quest.getRewards().getItems()) {
if (reward!=null && !(reward.getMCItemStack()==null)) rewardCount++;
if (reward != null && !(reward.getMCItemStack() == null)) rewardCount++;
}
int topToRewardsBottom = topToObjectivesBottom+(rewardCount==0?0:(36+13));
int topToExpBottom = topToRewardsBottom+(quest.rewardExp==0?0:(12));
int topToRewardsBottom = topToObjectivesBottom + (rewardCount == 0 ? 0 : (36 + 13));
int topToExpBottom = topToRewardsBottom + (quest.rewardExp == 0 ? 0 : (12));
int topToFactionBottom = topToExpBottom + (facIDs.size() * 15);
int questBlockHeight = topToFactionBottom+28;
drawGradientRect( width-285, (int)(height*0.08), width-285+260, questBlockHeight, 0x99000000, 0x99000000);
int questBlockHeight = topToFactionBottom + 28;
drawGradientRect(width - 285, (int) (height * 0.08), width - 285 + 260, questBlockHeight, 0x99000000, 0x99000000);
GL11.glScalef(1.5f, 1.5f, 1);
drawString(fontRendererObj, quest.getName(), (int) ((width-268) / 1.5), (int) ((height*0.095) / 1.5), -1);
drawString(fontRendererObj, quest.getName(), (int) ((width - 268) / 1.5), (int) ((height * 0.095) / 1.5), -1);
GL11.glScalef(1 / 1.5f, 1 / 1.5f, 1);
drawLine(width-274,(int)(height*0.13),width-285+260-11);
drawTextBlock(quest.logText, width-245, (int)(height*0.157), 180,0xb8b8b8);
drawString(fontRendererObj, translate("questgui.objectives"),width-270, topToTextBottom, -1);
drawLeftAllignedTextBlock(objectiveString.toString(), width-255, topToTextBottom+12, 180,0xb8b8b8);
if(rewardCount!=0)
drawString(fontRendererObj, translate("questgui.rewards"),width-270, topToObjectivesBottom, -1);
for(int i=0;i<quest.rewardItems.getSizeInventory();i++){
drawLine(width - 274, (int) (height * 0.13), width - 285 + 260 - 11);
drawTextBlock(quest.logText, width - 245, (int) (height * 0.157), 180, 0xb8b8b8);
drawString(fontRendererObj, translate("questgui.objectives"), width - 270, topToTextBottom, -1);
drawLeftAllignedTextBlock(objectiveString.toString(), width - 255, topToTextBottom + 12, 180, 0xb8b8b8);
if (rewardCount != 0)
drawString(fontRendererObj, translate("questgui.rewards"), width - 270, topToObjectivesBottom, -1);
for (int i = 0; i < quest.rewardItems.getSizeInventory(); i++) {
ItemStack rewardStack = quest.rewardItems.getStackInSlot(i);
if(rewardStack==null) continue;
if (rewardStack == null) continue;
Minecraft.getMinecraft().getTextureManager().bindTexture(decomposed);
GL11.glDisable(GL11.GL_LIGHTING);
int color = prevDialog.colorData.getSlotColor();
GL11.glColor4f((color >> 16 & 0xff) / 255f, (color >> 8 & 0xff) / 255f, (color & 0xff) / 255f, 1);
drawTexturedModalRect(width-270+26*i, topToObjectivesBottom+16, 0, 27, 24, 24);
drawTexturedModalRect(width - 270 + 26 * i, topToObjectivesBottom + 16, 0, 27, 24, 24);
itemRender.renderItemAndEffectIntoGUI(fontRendererObj,Minecraft.getMinecraft().renderEngine, rewardStack, width-266+26*i, topToObjectivesBottom+20);
itemRender.renderItemOverlayIntoGUI(fontRendererObj,Minecraft.getMinecraft().renderEngine, rewardStack, width-266+26*i, topToObjectivesBottom+20, ""+rewardStack.stackSize);
itemRender.renderItemAndEffectIntoGUI(fontRendererObj, Minecraft.getMinecraft().renderEngine, rewardStack, width - 266 + 26 * i, topToObjectivesBottom + 20);
itemRender.renderItemOverlayIntoGUI(fontRendererObj, Minecraft.getMinecraft().renderEngine, rewardStack, width - 266 + 26 * i, topToObjectivesBottom + 20, "" + rewardStack.stackSize);
}
GL11.glDisable(GL11.GL_LIGHTING);
if(quest.rewardExp!=0) {
drawString(fontRendererObj, translate("questgui.experience"), width-270, topToRewardsBottom, 0xb8b8b8);
int expPosX = width-270+ClientProxy.Font.width(translate("questgui.experience"));
drawString(fontRendererObj, ""+quest.rewardExp, expPosX, topToRewardsBottom, -1);
int expSymbolPosX = expPosX+ClientProxy.Font.width(""+quest.rewardExp+" ");
if (quest.rewardExp != 0) {
drawString(fontRendererObj, translate("questgui.experience"), width - 270, topToRewardsBottom, 0xb8b8b8);
int expPosX = width - 270 + ClientProxy.Font.width(translate("questgui.experience"));
drawString(fontRendererObj, "" + quest.rewardExp, expPosX, topToRewardsBottom, -1);
int expSymbolPosX = expPosX + ClientProxy.Font.width("" + quest.rewardExp + " ");
Minecraft.getMinecraft().getTextureManager().bindTexture(decomposed);
drawTexturedModalRect(expSymbolPosX, topToRewardsBottom, 26, 27, 8, 8);
}
int fac1ID = quest.factionOptions.factionId;
int fac1ID = quest.factionOptions.factionId;
if (fac1ID != -1) {
String fac1Name = FactionController.getInstance().getFaction(fac1ID).getName();
String fac1Color = (quest.factionOptions.decreaseFactionPoints) ? "§c-" : "§a+";
int fac1Point = quest.factionOptions.factionPoints;
int facIDIndex = facIDs.indexOf(fac1ID);
drawString(fontRendererObj, fac1Name + " " + fac1Color + fac1Point, width-270, topToExpBottom + (facIDIndex * 12), 0xb8b8b8);
drawString(fontRendererObj, fac1Name + " " + fac1Color + fac1Point, width - 270, topToExpBottom + (facIDIndex * 12), 0xb8b8b8);
}
int fac2ID = quest.factionOptions.faction2Id;
int fac2ID = quest.factionOptions.faction2Id;
if (fac2ID != -1) {
String fac2Name = FactionController.getInstance().getFaction(fac2ID).getName();
String fac2Color = (quest.factionOptions.decreaseFaction2Points) ? "§c-" : "§a+";
int fac2Point = quest.factionOptions.faction2Points;
int facIDIndex = facIDs.indexOf(fac2ID);
drawString(fontRendererObj, fac2Name + " " + fac2Color + fac2Point, width-270, topToExpBottom + (facIDIndex * 12), 0xb8b8b8);
drawString(fontRendererObj, fac2Name + " " + fac2Color + fac2Point, width - 270, topToExpBottom + (facIDIndex * 12), 0xb8b8b8);
}
this.buttons.get(0).xPosition=width-240;
this.buttons.get(1).xPosition=width-148;
this.buttons.get(0).yPosition=topToFactionBottom;
this.buttons.get(1).yPosition=topToFactionBottom;
((GuiTexturedButton)this.buttons.get(0)).scale=0.5f;
((GuiTexturedButton)this.buttons.get(1)).scale=0.5f;
((GuiTexturedButton)this.buttons.get(0)).color=prevDialog.colorData.getButtonRejectColor();
((GuiTexturedButton)this.buttons.get(1)).color=prevDialog.colorData.getButtonAcceptColor();
this.buttons.get(0).xPosition = width - 240;
this.buttons.get(1).xPosition = width - 148;
this.buttons.get(0).yPosition = topToFactionBottom;
this.buttons.get(1).yPosition = topToFactionBottom;
((GuiTexturedButton) this.buttons.get(0)).scale = 0.5f;
((GuiTexturedButton) this.buttons.get(1)).scale = 0.5f;
((GuiTexturedButton) this.buttons.get(0)).color = prevDialog.colorData.getButtonRejectColor();
((GuiTexturedButton) this.buttons.get(1)).color = prevDialog.colorData.getButtonAcceptColor();
super.drawScreen(mouseX, mouseY, partialTicks);
GL11.glColor4f(1,1,1,1);
GL11.glColor4f(1, 1, 1, 1);
GL11.glPopMatrix();
GL11.glPopMatrix();
}
public String translate(String key){
public String translate(String key) {
return StatCollector.translateToLocal(key);
}
@@ -316,7 +316,7 @@ public class GuiModernQuestDialog extends GuiNPCInterface implements IGuiClose {
entity.prevRotationYawHead = f5;
entity.rotationYawHead = f6;
npc.ais.orientation = orientation;
npc.display.showName=visibleName;
npc.display.showName = visibleName;
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
@@ -330,21 +330,21 @@ public class GuiModernQuestDialog extends GuiNPCInterface implements IGuiClose {
public void drawString(FontRenderer fontRendererIn, String text, int x, int y, int color) {
ClientProxy.Font.drawString(text, x, y, color);
}
@Override
protected void actionPerformed(GuiButton guibutton) {
GuiNpcButton button = (GuiNpcButton) guibutton;
if(button.id==0){
if (button.id == 0) {
PacketClient.sendClient(new DialogSelectPacket(prevDialog.id, -1));
closed();
close();
}else if(button.id==1){
if(optionId!=-2){
} else if (button.id == 1) {
if (optionId != -2) {
PacketClient.sendClient(new DialogSelectPacket(prevDialog.id, optionId));
}else{
if(ConfigExperimental.ModernGuiSystem) {
} else {
if (ConfigExperimental.ModernGuiSystem) {
CustomNpcs.proxy.openGui(player, new GuiModernDialogInteract(npc, prevDialog));
}
else {
} else {
CustomNpcs.proxy.openGui(player, new GuiDialogInteract(npc, prevDialog));
}
}
@@ -378,6 +378,7 @@ public class GuiModernQuestDialog extends GuiNPCInterface implements IGuiClose {
drawCenteredString(fontRendererObj, line.getFormattedText(), x + width / 2, height, color);
}
}
public void drawLeftAllignedTextBlock(String text, int x, int y, int width, int color) {
TextBlockClient block = new TextBlockClient("", text, width, -1, player, npc);
@@ -664,6 +664,7 @@ public abstract class GuiDiagram extends Gui {
}
// --- Arrow Drawing Methods ---
/**
* Draws a connection line between two endpoints.
* If a reverse connection exists and allowTwoWay is false, the line is drawn with a perpendicular offset.
@@ -673,7 +674,7 @@ public abstract class GuiDiagram extends Gui {
boolean twoWay = (reverse != null && allowTwoWay);
boolean separateTwoWay = (reverse != null && !allowTwoWay);
int effectiveCurveAngle = (conn.customCurveAngle != null ? conn.customCurveAngle : this.curveAngle);
boolean useCustomCurveAngle = (conn.customAllowCurve != null ? conn.customAllowCurve : this.curvedArrows);
boolean useCustomCurveAngle = (conn.customAllowCurve != null ? conn.customAllowCurve : this.curvedArrows);
if (!useCustomCurveAngle) {
if (separateTwoWay) {
@@ -869,7 +870,7 @@ public abstract class GuiDiagram extends Gui {
color = 0xFFFFFFFF;
boolean separateTwoWay = (reverse != null && !allowTwoWay);
double angle;
boolean useCustomCurveAngle = (conn.customAllowCurve != null ? conn.customAllowCurve : this.curvedArrows);
boolean useCustomCurveAngle = (conn.customAllowCurve != null ? conn.customAllowCurve : this.curvedArrows);
if (!useCustomCurveAngle) {
if (separateTwoWay) {
@@ -1243,7 +1244,7 @@ public abstract class GuiDiagram extends Gui {
if (pFrom == null || pTo == null) continue;
double dist;
boolean separateTwoWay = (getConnectionByIds(conn.idTo, conn.idFrom) != null && !allowTwoWay);
boolean useCustomCurveAngle = (conn.customAllowCurve != null ? conn.customAllowCurve : this.curvedArrows);
boolean useCustomCurveAngle = (conn.customAllowCurve != null ? conn.customAllowCurve : this.curvedArrows);
if (separateTwoWay) {
if (useCustomCurveAngle) {
int offsetAmount = 4;
@@ -1339,7 +1340,7 @@ public abstract class GuiDiagram extends Gui {
GL11.glTranslatef(-centerX, -centerY, 0);
for (DiagramConnection conn : getConnections()) {
boolean showArrow = (conn.showArrowHead != null ? conn.showArrowHead : this.showArrowHeads);
if(!showArrow)
if (!showArrow)
continue;
DiagramIcon iconFrom = getIconById(conn.idFrom);
@@ -1419,13 +1420,13 @@ public abstract class GuiDiagram extends Gui {
int r, g, b;
if (value >= 0f) {
float t = value;
r = (int)(144 + (0 - 144) * t);
g = (int)(238 + (100 - 238) * t);
b = (int)(144 + (0 - 144) * t);
r = (int) (144 + (0 - 144) * t);
g = (int) (238 + (100 - 238) * t);
b = (int) (144 + (0 - 144) * t);
} else {
float t = -value;
r = (int)(255 + (139 - 255) * t);
g = (int)(200 + (0 - 200) * t);
r = (int) (255 + (139 - 255) * t);
g = (int) (200 + (0 - 200) * t);
b = 0;
}
return (0xFF << 24) | (r << 16) | (g << 8) | b;
@@ -320,7 +320,7 @@ public class RenderCNPCPlayer extends RenderPlayer {
this.modelBipedMain.onGround = 0.0F;
this.modelBipedMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, player);
if(this.modelBipedMain.bipedRightArm != null)
if (this.modelBipedMain.bipedRightArm != null)
this.modelBipedMain.bipedRightArm.render(0.0625F);
postRenderOverlay();
@@ -68,7 +68,7 @@ public class BlockCampfireRenderer extends BlockRendererInterface {
GL11.glEnable(GL11.GL_ALPHA_TEST);
Minecraft.getMinecraft().getTextureManager().bindTexture(Flame);
float animTime = CustomNpcs.ticks + var8;
float animTime = CustomNpcs.ticks + var8;
flameModel.render(null, animTime, 0, 0, 0, 0.0F, 0.0625F);
GL11.glDisable(GL11.GL_ALPHA_TEST);
@@ -78,9 +78,9 @@ public class ItemToolRenderer implements IItemRenderer {
float blue = (color & 0xFF) / 255.0F;
GL11.glColor3f(red, green, blue);
renderEntityCustomItem(itemStack, entityItem, PAINTBRUSH_BRUSH);
} else if (itemStack.getItemDamage() == 0){
} else if (itemStack.getItemDamage() == 0) {
renderEntityCustomItem(itemStack, entityItem, HAMMER);
} else if (itemStack.getItemDamage() == 2){
} else if (itemStack.getItemDamage() == 2) {
renderEntityCustomItem(itemStack, entityItem, MAGIC_BOOK);
}
GL11.glPopMatrix();
@@ -114,11 +114,11 @@ public class ItemToolRenderer implements IItemRenderer {
GL11.glPushMatrix();
renderItem3d(entityLivingBase, itemStack, PAINTBRUSH_BRUSH);
GL11.glPopMatrix();
} else if (itemStack.getItemDamage() == 0){
} else if (itemStack.getItemDamage() == 0) {
GL11.glPushMatrix();
renderItem3d(entityLivingBase, itemStack, HAMMER);
GL11.glPopMatrix();
} else if (itemStack.getItemDamage() == 2){
} else if (itemStack.getItemDamage() == 2) {
GL11.glPushMatrix();
renderItem3d(entityLivingBase, itemStack, MAGIC_BOOK);
GL11.glPopMatrix();
@@ -297,10 +297,10 @@ public class ItemToolRenderer implements IItemRenderer {
float blue = (color & 0xFF) / 255.0F;
textureManager.bindTexture(PAINTBRUSH_BRUSH);
renderCustomItemSlot(0, 0, 16, 16, red, green, blue);
} else if (itemStack.getItemDamage() == 0){
} else if (itemStack.getItemDamage() == 0) {
textureManager.bindTexture(HAMMER);
renderCustomItemSlot(0, 0, 16, 16, 1.0f, 1.0f, 1.0f);
} else if (itemStack.getItemDamage() == 2){
} else if (itemStack.getItemDamage() == 2) {
textureManager.bindTexture(MAGIC_BOOK);
renderCustomItemSlot(0, 0, 16, 16, 1.0f, 1.0f, 1.0f);
}
@@ -248,7 +248,7 @@ public class ConfigMain {
}
config.setCategoryPropertyOrder(ATTRIBUTES, new ArrayList<>(Arrays.asList("Enable Attributes",
"Critical Amount")));
"Critical Amount")));
// Attributes
AttributesEnabled = config.get(ATTRIBUTES, "Enable Attributes", true, "Allows Attributes to be applied to Items and Armors").getBoolean(true);
@@ -101,54 +101,54 @@ public class MagicController implements IMagicHandler {
// Insiders
earth.interactions.put(air.id, -0.50f);
air.interactions.put(earth.id, 0.50f);
air.interactions.put(earth.id, 0.50f);
water.interactions.put(earth.id, -0.50f);
earth.interactions.put(water.id, 0.50f);
earth.interactions.put(water.id, 0.50f);
fire.interactions.put(water.id, -0.50f);
water.interactions.put(fire.id, 0.50f);
water.interactions.put(fire.id, 0.50f);
air.interactions.put(fire.id, -0.50f);
fire.interactions.put(air.id, 0.50f);
fire.interactions.put(air.id, 0.50f);
// Outsiders
dark.interactions.put(nature.id, -0.50f);
nature.interactions.put(dark.id, 0.50f);
nature.interactions.put(dark.id, 0.50f);
nature.interactions.put(holy.id, -0.50f);
holy.interactions.put(nature.id, 0.50f);
holy.interactions.put(nature.id, 0.50f);
holy.interactions.put(arcane.id, -0.50f);
arcane.interactions.put(holy.id, 0.50f);
arcane.interactions.put(holy.id, 0.50f);
arcane.interactions.put(dark.id, -0.50f);
dark.interactions.put(arcane.id, 0.50f);
dark.interactions.put(arcane.id, 0.50f);
// Cross Interactions
earth.interactions.put(nature.id, -0.25f);
nature.interactions.put(earth.id, 0.25f);
nature.interactions.put(earth.id, 0.25f);
water.interactions.put(holy.id, -0.25f);
holy.interactions.put(water.id, 0.25f);
holy.interactions.put(water.id, 0.25f);
fire.interactions.put(arcane.id, -0.25f);
arcane.interactions.put(fire.id, 0.25f);
arcane.interactions.put(fire.id, 0.25f);
air.interactions.put(dark.id, -0.25f);
dark.interactions.put(air.id, 0.25f);
dark.interactions.put(air.id, 0.25f);
dark.interactions.put(fire.id, -0.25f);
fire.interactions.put(dark.id, 0.25f);
fire.interactions.put(dark.id, 0.25f);
nature.interactions.put(air.id, -0.25f);
air.interactions.put(nature.id, 0.25f);
air.interactions.put(nature.id, 0.25f);
holy.interactions.put(earth.id, -0.25f);
earth.interactions.put(holy.id, 0.25f);
earth.interactions.put(holy.id, 0.25f);
arcane.interactions.put(water.id, -0.25f);
water.interactions.put(arcane.id, 0.25f);
water.interactions.put(arcane.id, 0.25f);
// Add them to the registry
magics.put(earth.id, earth);
@@ -150,15 +150,15 @@ public class ScriptController {
}
}
public PlayerDataScript getPlayerScripts(EntityPlayer player){
if(ConfigScript.IndividualPlayerScripts)
public PlayerDataScript getPlayerScripts(EntityPlayer player) {
if (ConfigScript.IndividualPlayerScripts)
return PlayerData.get(player).scriptData;
return this.playerScripts;
}
public PlayerDataScript getPlayerScripts(IPlayer player){
if(ConfigScript.IndividualPlayerScripts)
public PlayerDataScript getPlayerScripts(IPlayer player) {
if (ConfigScript.IndividualPlayerScripts)
return PlayerData.get((EntityPlayer) player.getMCEntity()).scriptData;
return this.playerScripts;
@@ -182,7 +182,7 @@ public class CustomEffect implements ICustomEffect {
public void onAdded(EntityPlayer player, PlayerEffect playerEffect) {
IPlayer iPlayer = NoppesUtilServer.getIPlayer(player);
if(playerEffect.index == 0){
if (playerEffect.index == 0) {
PlayerEvent.EffectEvent.Added event = new PlayerEvent.EffectEvent.Added(iPlayer, playerEffect);
if (onAddedConsumer != null)
@@ -201,7 +201,7 @@ public class CustomEffect implements ICustomEffect {
public void onTick(EntityPlayer player, PlayerEffect playerEffect) {
IPlayer iPlayer = NoppesUtilServer.getIPlayer(player);
if(playerEffect.index == 0){
if (playerEffect.index == 0) {
PlayerEvent.EffectEvent.Ticked event = new PlayerEvent.EffectEvent.Ticked(iPlayer, playerEffect);
if (onTickConsumer != null) {
@@ -222,7 +222,7 @@ public class CustomEffect implements ICustomEffect {
public void onRemoved(EntityPlayer player, PlayerEffect playerEffect, PlayerEvent.EffectEvent.ExpirationType type) {
IPlayer iPlayer = NoppesUtilServer.getIPlayer(player);
if(playerEffect.index == 0){
if (playerEffect.index == 0) {
PlayerEvent.EffectEvent.Removed event = new PlayerEvent.EffectEvent.Removed(iPlayer, playerEffect, type);
if (onRemovedConsumer != null) {
@@ -13,7 +13,7 @@ public class DialogColorData {
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
compound.setBoolean("ColorSettings", enableColorSettings);
if(enableColorSettings){
if (enableColorSettings) {
compound.setInteger("LineColor1", lineColor1);
compound.setInteger("LineColor2", lineColor2);
compound.setInteger("LineColor3", lineColor3);
@@ -26,13 +26,13 @@ public class DialogColorData {
public void readFromNBT(NBTTagCompound compound) {
this.enableColorSettings = compound.getBoolean("ColorSettings");
if(enableColorSettings){
lineColor1 =compound.getInteger("LineColor1");
lineColor2 =compound.getInteger("LineColor2");
lineColor3 =compound.getInteger("LineColor3");
slotColor =compound.getInteger("SlotColor");
buttonAcceptColor =compound.getInteger("ButtonAcceptColor");
buttonRejectColor =compound.getInteger("ButtonRejectColor");
if (enableColorSettings) {
lineColor1 = compound.getInteger("LineColor1");
lineColor2 = compound.getInteger("LineColor2");
lineColor3 = compound.getInteger("LineColor3");
slotColor = compound.getInteger("SlotColor");
buttonAcceptColor = compound.getInteger("ButtonAcceptColor");
buttonRejectColor = compound.getInteger("ButtonRejectColor");
}
}
@@ -173,7 +173,7 @@ public class Magic implements IMagic {
@Override
public float getInteraction(int magicID, float value) {
if(hasInteraction(magicID))
if (hasInteraction(magicID))
return interactions.get(magicID);
return 0.0f;
}
@@ -18,7 +18,8 @@ public class MagicCycle implements IMagicCycle {
public EnumDiagramLayout layout = EnumDiagramLayout.CIRCULAR;
public HashMap<Integer, MagicAssociation> associations = new HashMap<>();
public MagicCycle(){}
public MagicCycle() {
}
public void readNBT(NBTTagCompound compound) {
id = compound.getInteger("ID");
@@ -93,7 +94,7 @@ public class MagicCycle implements IMagicCycle {
@Override
public void setLayoutType(int layout) {
if(layout < 0 || layout > EnumDiagramLayout.values().length - 1)
if (layout < 0 || layout > EnumDiagramLayout.values().length - 1)
return;
this.layout = EnumDiagramLayout.values()[layout];
}
@@ -85,16 +85,16 @@ public class PlayerDataScript implements INpcScriptHandler {
@Override
public void callScript(String hookName, Event event) {
if(!isEnabled())
if (!isEnabled())
return;
if(ConfigScript.IndividualPlayerScripts){
if(ScriptController.Instance.lastLoaded > lastInited || ScriptController.Instance.lastPlayerUpdate > lastPlayerUpdate){
if (ConfigScript.IndividualPlayerScripts) {
if (ScriptController.Instance.lastLoaded > lastInited || ScriptController.Instance.lastPlayerUpdate > lastPlayerUpdate) {
lastInited = ScriptController.Instance.lastLoaded;
errored.clear();
if(player != null) {
if (player != null) {
scripts.clear();
for(ScriptContainer script : ScriptController.Instance.playerScripts.scripts){
for (ScriptContainer script : ScriptController.Instance.playerScripts.scripts) {
ScriptContainer s = new ScriptContainer(this);
s.readFromNBT(script.writeToNBT(new NBTTagCompound()));
scripts.add(s);
@@ -106,16 +106,16 @@ public class PlayerDataScript implements INpcScriptHandler {
EventHooks.onPlayerInit(this, playerEvent.player);
}
}
for(int i = 0; i < scripts.size(); i++){
for (int i = 0; i < scripts.size(); i++) {
ScriptContainer script = scripts.get(i);
if(errored.contains(i))
if (errored.contains(i))
continue;
script.run(hookName, event);
if(script.errored){
if (script.errored) {
errored.add(i);
}
for(Entry<Long, String> entry : script.console.entrySet()){
if(!console.containsKey(entry.getKey()))
for (Entry<Long, String> entry : script.console.entrySet()) {
if (!console.containsKey(entry.getKey()))
console.put(entry.getKey(), " tab " + (i + 1) + ":\n" + entry.getValue());
}
script.console.clear();
@@ -190,7 +190,7 @@ public class PlayerDataScript implements INpcScriptHandler {
}
public Map<Long, String> getConsoleText() {
if(ConfigScript.IndividualPlayerScripts)
if (ConfigScript.IndividualPlayerScripts)
return console;
TreeMap<Long, String> map = new TreeMap<>();
@@ -206,7 +206,7 @@ public class PlayerDataScript implements INpcScriptHandler {
}
public void clearConsole() {
if(ConfigScript.IndividualPlayerScripts)
if (ConfigScript.IndividualPlayerScripts)
console.clear();
else {
for (ScriptContainer script : this.getScripts()) {
@@ -386,12 +386,12 @@ public class EntityProjectile extends EntityThrowable {
if (worldObj.isRemote && !this.dataWatcher.getWatchableObjectString(22).isEmpty()) {
String particle = this.dataWatcher.getWatchableObjectString(22);
if(!particle.equals("custom")){
if (!particle.equals("custom")) {
this.worldObj.spawnParticle(particle, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
}
} else if (!worldObj.isRemote){
if(this.npc != null && this.npc.stats.pTrail == EnumParticleType.Custom){
} else if (!worldObj.isRemote) {
if (this.npc != null && this.npc.stats.pTrail == EnumParticleType.Custom) {
this.npc.stats.pCustom.setPosition(this.posX, this.posY, this.posZ);
spawnScriptedParticle(this.npc.stats.pCustom.writeToNBT(), this.npc);
}
@@ -605,7 +605,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
}
@Override
public float getRotation(){
public float getRotation() {
return entity.rotationYaw;
}
@@ -843,5 +843,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
return this.getData().magicData;
}
public IPlayerAttributes getAttributes(){ return AttributeController.getTracker(this.player); }
public IPlayerAttributes getAttributes() {
return AttributeController.getTracker(this.player);
}
}
@@ -332,8 +332,8 @@ public class NBTJsonUtil {
comp2.setIntArray("intArray", new int[]{0, 0, 1, 1, 0});
// Primitive types
comp2.setByte("byte", (byte)7);
comp2.setShort("short", (short)123);
comp2.setByte("byte", (byte) 7);
comp2.setShort("short", (short) 123);
comp2.setInteger("int", 456);
comp2.setLong("long", 789L);
comp2.setFloat("float", 3.14F);